?? hal.h
字號:
//===========================================================================
// HAL.H
//---------------------------------------------------------------------------
// Copyright (c) 2003 Epson Research and Development, Inc.
// All Rights Reserved.
//===========================================================================
#ifndef __HAL_H__
#define __HAL_H__
#include "datatype.h" // Grab public definitions and data types.
#include "hal_regs.h" // Grap chip-specific register information.
#include "halapi.h" // Grab public HAL API functions.
//===========================================================================
// HAL Structure
//===========================================================================
#pragma pack(1)
typedef struct RegInitCamera
{
UInt16 uchIndex;
UInt16 uchValue;
}REG_CAMERA;
typedef struct tagRegStruct
{
UInt16 Index; // Register index
UInt16 Value; // Register data
} REG_STRUCT, *PREG_STRUCT;
typedef struct tagHalStruct
{
#ifdef EPSON_ORIGINAL /* Robert.Chen removed, 2004-06-05 */
char szIdString[16]; // HAL ID string
char szConfigString[256]; // Configuration description
char sLCD1StringPool[256]; // Parallel LCD1 strings pool in {index,"string"} format
char sLCD2StringPool[256]; // Parallel LCD2 strings pool in {index,"string"} format
char sLCD3StringPool[256]; // Parallel LCD3 strings pool in {index,"string"} format
UInt16 wSize; // Sizeof this structure
UInt16 wHalCRC; // CRC of the rest of structure
char szChipId[8]; // S1Dxxx chip ID
UInt16 wDetectEndian; // Endian detect (LE=0x1234)
UInt16 wReserved1; // Reserved for alignment
#endif
UInt32 dwClkI; // CLKI frequency (in Hz)
UInt32 dwInternalOSC; // Internal OSC frequency (in Hz)
UInt32 dwBaseAddress; // Physical base memory address
UInt32 dwRegisterOffset; // Physical register address offset form base address
UInt32 dwMemoryOffset; // Physical memory address offset form base address
UInt16 wCam1Width, wCam1Height; // Camera1 expected image size
UInt32 dwRequiredVRAM; // Required VRAM (in bytes)
UInt32 dwFlags; // Hal information flags
UInt32 LCD1Regs[HAL_LCDSIZE]; // Parallel LCD register initialization sequence (LCD1)
UInt32 LCD2Regs[HAL_LCDSIZE]; // Parallel LCD register initialization sequence (LCD2)
UInt32 LCD3Regs[HAL_LCDSIZE]; // Parallel LCD register initialization sequence (LCD3)
REG_STRUCT Regs[HAL_REGSIZE]; // Initialization registers
REG_CAMERA RegCam1[HAL_REGCAMSIZE]; // Initialization camera data
} HAL_STRUCT, *PHAL_STRUCT;
#ifdef EPSON_ORIGINAL
#pragma pack()
#endif
// Definitions for HAL_STRUCT.dwFlags
#define fNO_RESET 0x00000001UL // True if software reset is not needed during chip init.
#define fNO_INIT_I2C 0x00000002UL // True if not supporting I2C bus on GPIO pins
#define fINDIRECT_SERIAL 0x00000004UL // True if Indirect Interface should be used
#define fPLL_LOWPOWER 0x00000008UL // True if prefer using low power consumption by PLL
#define fDEBUG_REG_WRITES 0x00000010UL // True if HAL debugging of register writes is enabled
#define fINDIRECT_ADDR16 0x00000020UL // True if Indirect ADDR cycle is 16 bits
#define fINDIRECT_DATA16 0x00000040UL // True if Indirect DATA cycle is 16 bits
#define fSAA7111_SVIDEO 0x00010000UL // True if SAA7111A input is S-Video, else CVBS
#define fSAA7111_PAL 0x00020000UL // True if SAA7111A input is PAL, else NTSC
#define fSAA7111_DITHER 0x00040000UL // True if SAA7111A dithering enabled (sub-address 12h bit 2)
#define fSAA7127_SVIDEO 0x00100000UL // True if SAA7127H output is S-Video, else RGB
#define fSAA7127_PAL 0x00200000UL // True if SAA7127H output is PAL, else NTSC
#define fEPSONCAM_PROTO25 0x01000000UL // True if Epson Camera is Proto2-5 (not proto2-2)
// Definitions for HAL_STRUCT.LCD1Regs and HAL_STRUCT.LCD2Regs
#define HAL_LCD_ENDOFTABLE 0x00000000UL // End of parallel LCD list when an entry EQUALS this value
#define HAL_LCD_COMMAND 0x10000000UL // True if this entry is a parallel LCD command
#define HAL_LCD_PARAM 0x20000000UL // True if this entry is a parallel LCD parameter (data)
#define HAL_LCD_DELAY 0x40000000UL // True if this entry is a millisecond delay value
#define HAL_LCD_FLAGMASK 0xF0000000UL // Parallel LCD flag mask
#define HAL_LCD_DATAMASK 0x0FFFFFFFUL // Parallel LCD data mask
// Definitions for HAL_STRUCT.wDetectEndian
#define HAL_LITTLE_ENDIAN 0x1234
#define HAL_BIG_ENDIAN 0x3412
//=========================================================================
// LUT Structure
//=========================================================================
typedef struct tagLutStruct
{
UInt8 lut1[256*3]; // LUT1 has 256 elements
} LUT_STRUCT, *PLUT_STRUCT;
//===========================================================================
// API Support
//===========================================================================
// Definitions for Flags in halInitController()
// Note that the fJUST_xxx definitions must be equal to (fDONT_xxx << 16).
// Specifying ANY fJUST_xxx flag will cause any specified fDONT_xxx flag to be ignored!
#define fINIT_NORMAL 0x00000000UL // Normal intialization - reset the chip, set the clocks, init regs and LUT,
// program I2C bus, and clear display memory.
#define fDONT_RESET 0x00000001UL // Do not reset before doing the init.
#define fDONT_INIT_I2C 0x00000002UL // Do not init the I2C bus as part of the init sequence.
#define fDONT_INIT_REGS 0x00000010UL // Do not init the regs as part of the init sequence (doesn't include the LUT).
#define fDONT_PROG_LCDS 0x00000020UL // Do not program parallel LCD panels as part of the initialization.
#define fDONT_INIT_LUT 0x00000040UL // Do not set the LUT to default values as part of the initialization.
#define fDONT_CLEAR_MEM 0x00000080UL // Don't clear video memory as the final step of controller initialization.
#define fDONT_CHECK_CRC 0x00008000UL // Don't check for valid CRC.
#define fJUST_RESET (fDONT_RESET<<16) // Only reset before doing the init.
#define fJUST_INIT_I2C (fDONT_INIT_I2C<<16) // Only init the I2C bus as part of the init sequence.
#define fJUST_INIT_REGS (fDONT_INIT_REGS<<16) // Only init the regs as part of the init sequence (doesn't include the LUT).
#define fJUST_PROG_LCDS (fDONT_PROG_LCDS<<16) // Only program parallel LCD panels as part of the initialization.
#define fJUST_INIT_LUT (fDONT_INIT_LUT<<16) // Only set the LUT to default values as part of the initialization.
#define fJUST_CLEAR_MEM (fDONT_CLEAR_MEM<<16) // Only clear video memory as the final step of controller initialization.
#define fJUST_CHECK_CRC (fDONT_CHECK_CRC<<16) // Only check for valid CRC.
// Static values used by the HAL for specific timing delays.
#define HAL_DELAY_RESET 100000 // Delay after issuing a software reset (in microseconds)
#define HAL_DELAY_PLL_OFF 244 // Delay after 1st write of reg 0012h (in microseconds)
#define HAL_DELAY_PLL_ON 100 // Delay after 2nd write of reg 0012h (in microseconds)
// Error condition codes, see halGetLastError()
enum
{
ERR_NONE = 0, // No error, call was successful.
ERR_SAME_REGMEM, // The register address is same as memory adress.
ERR_NOT_CONFIGURED, // The file has not been configured.
ERR_BAD_I2C_INIT, // Error during I2C bus initialization/programming.
ERR_NOT_ACQUIRED, // The controller has not been acquired.
ERR_FAILED // Catch-all error condition.
};
//===========================================================================
// Chip-Specific HAL Data and Function Exports
//===========================================================================
#ifdef __cplusplus
extern "C" {
#endif
extern HAL_STRUCT HalInfo; // Export HalInfo for application usage
//extern LUT_STRUCT LutInfo; // Export LutInfo for application usage
typedef struct tagDataStruct
{
UInt32 BaseAddress; // HAL acquired base address (virtual)
UInt32 RegisterAddress; // HAL acquired register address (virtual)
UInt32 MemoryAddress; // HAL acquired memory address (virtual)
UInt32 BlockSize; // HAL acquired memory block size (bytes)
int nErrorCode; // HAL error code value
} DATA_STRUCT;
extern const DATA_STRUCT* const gpHalData; // Global HAL private data storage pointer (read only)
//---------------------------------------------------------------------------
// FUNCTION: halAcquireController()
//
// DESCRIPTION:
// This is the discovery portion of the the start-up sequence.
// On the Intel platform, halAcquireController() initiates the link
// between the application and the hardware by attempting to load
// S1D13xxx.VxD. If the driver is loaded successfully then a call
// is made to the VxD to determine the presence and the address
// of the LCD controller. On all other platforms, this routine takes
// the register and display memory addresses provided by CFG.
//
// This routine MUST be called before any other call to the HAL is made!
// (i.e. halInitController)
//
// PARAMETERS:
// None
//
// RETURNS:
// TRUE if the routine is able to locate an LCD controller.
// FALSE if an LCD controller is not located.
// If additional error information is required call halGetLastError().
//
// MODIFIES:
// This routine does not modify any register contents.
//---------------------------------------------------------------------------
Boolean halAcquireController( void );
//---------------------------------------------------------------------------
// FUNCTION: halInitController()
//
// DESCRIPTION:
// This routine performs the initialization portion of the startup
// sequence. If the HAL has not been CFGed then initialization is
// bypassed and this function returns FALSE.
//
// Initialization consists of several steps:
// - Check that halAcquireController was successful
// - Check that the program was correctly configured
// - Reset the controller
// - Initialize the controller registers
// - Program the parallel panel values
// - Initialize the LUT
// - Intialize the I2C bus
// - Clear Video Memory
//
// Parameters passed in dwFlags can cause any or all of these steps to
// be bypassed. This allows for run-time operational changes.
// Specifying ANY fJUST_xxx flag will cause any specified fDONT_xxx
// flag to be ignored, as fJUST_xxx flags have the highest priority.
//
// PARAMETERS:
// Flags - contains initialization specific information.
//
// RETURNS:
// TRUE if the initialization was successful.
// FALSE if the HAL was unable to initialize the LCD controller or if the
// system has not been CFGed.
//
// If additional error information is required call halGetLastError()
//
// MODIFIES:
// Nearly every register and all display memory can or will be affected.
//---------------------------------------------------------------------------
Boolean halInitController( UInt32 Flags );
//-----------------------------------------------------------------------------
// FUNCTION: halGetLastError();
//
// DESCRIPTION:
// This routine retrieves information about the last error detected by the
// HAL.
//
// PARAMETERS:
// ErrMsg - String pointer to receive the textual error message.
// If ErrMsg is NULL then only the error code will be returned.
// MaxSize Maximum number of bytes that can be copied into the string
// pointed to by ErrMsg.
//
// RETURNS:
// The return value consists of the numerical error value and character
// array refererenced by ErrMsg is filled with text describing the last
// error.
//
// MODIFIES:
//-----------------------------------------------------------------------------
int halGetLastError();
//---------------------------------------------------------------------------
// FUNCTION: halInitLUT()
//
// DESCRIPTION:
// This function will set the LUT to a known state.
// The routine cracks the color depth and display type to determine
// the LUT values to use and then proceeds to write the LUT.
//
// PARAMETERS:
// fUseGradientPalette - If TRUE, LUT1 will be programmed to a gradient
// palette ONLY in 256-color non-bypassed mode.
// For all other cases a standard "pretty' HAL
// palette will be used.
//
// RETURNS: Nothing
//
// MODIFIES:
// A number of LUT entries based on the current color depth.
//---------------------------------------------------------------------------
void halInitLUT( Boolean fUseGradientPalette );
void halSetProcessExclusivity( Boolean fExclusive );
#endif // __HAL_H__
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -