⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 hal.h

📁 瑞萨单片机开发软代码.非常实用小巧的平台,很多应用都可以在上面实现.
💻 H
📖 第 1 页 / 共 2 页
字号:
//===========================================================================
//	HAL.H
// (Tabs set to every 4)
//---------------------------------------------------------------------------
//  Copyright (c) 2002 Epson Research and Development, Inc.
//  All Rights Reserved.
//===========================================================================

#define PRODUCTCODE 13715


#include "hal_regs.h"					// Grap chip-specific register information.
#define UInt8 unsigned char
#define UInt16 unsigned short 
#define UInt32 unsigned long

//===========================================================================
//                              HAL Structure
//===========================================================================
//13715 mike
typedef struct RegCamera
{
   UInt8 uchIndex;
   UInt8 uchValue;
}REG_CAMERA_CHAR;

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
{
	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
	UInt16	wSize;						// Sizeof this structure
	UInt16	wHalCRC;					// CRC of the rest of structure

	char	szChipId[8];				// SED chip ID
	UInt16	wDetectEndian;				// Endian detect (LE=0x1234)
	UInt16	wReserved1;					// Reserved for alignment

	UInt16	dwClkI;						// CLKI frequency (in Hz)
	UInt16	dwInternalOSC;				// Internal OSC frequency (in Hz)

	UInt16	dwBaseAddress;				// Physical base memory address
	UInt16	dwRegisterOffset;			// Physical register address offset form base address
	UInt16	dwMemoryOffset;				// Physical memory address offset form base address

	UInt16	wLcdPowerdownTime;			// LCD power off time (in ms)
	UInt16	wLcdPowerupTime;			// LCD power on time (in ms)
	UInt16	wGPIOLcdPowerPin;			// GPIO LCD power pin mask bit
	UInt16	wCam1Width, wCam1Height;	// Camera1 expected image size
	UInt16	wCam2Width, wCam2Height;	// Camera2 expected image size

	UInt16	dwRequiredVRAM;				// Required VRAM (in bytes)
	UInt16	dwFlags;					// Hal information flags

	UInt16	LCD1Regs[HAL_LCDSIZE];		// Parallel LCD register initialization sequence (LCD1)
	UInt16	LCD2Regs[HAL_LCDSIZE];		// Parallel LCD register initialization sequence (LCD2)

	REG_STRUCT	Regs[HAL_REGSIZE];		// Initialization S1D13714 registers
	
	REG_CAMERA RegCam1[HAL_REGCAMSIZE];	// Initialization camera data
	
} HAL_STRUCT, *PHAL_STRUCT;


// Definitions for HAL_STRUCT.dwFlags

#define fNO_RESET			0x00000001UL	// True if software reset is not needed during chip init.
#define fFIXED_STRIDE		0x00000002UL	// True if line address offset is set by user
#define fFIXED_PIPSTRIDE	0x00000004UL	// True if PIP line address offset is set by user
#define fNO_INIT_I2C		0x00000010UL	// True if not supporting I2C bus on GPIO pins
#define fINDIRECT_INTERFACE	0x00000020UL	// Bits are set if Indirect Interface is enabled
#define fPLL_LOWPOWER		0x00000040UL	// True if prefer using low power consumption by PLL
#define fDEBUG_REG_WRITES	0x00008000UL	// True if HAL debugging of register writes is enabled

#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		500		// Delay after issuing a software reset (in microseconds)

//	Error condition codes, see halGetLastError()

enum
{
	ERR_NONE = 0,				// No error, call was successful.
	ERR_WIDTH_ZERO,				// The BLT Source width or Destination width is zero.
	ERR_PCI_ADAPTER_NOT_FOUND,	// The VxD was unable to locate the LCD controller.
	ERR_NOT_CONFIGURED,			// The file has not been configured.
	ERR_BAD_CFG_DATA,			// CFG data does not match the CRC.
	ERR_BAD_I2C_INIT,			// Error during I2C bus initialization/programming.
	ERR_NOT_ACQUIRED,			// The controller has not been acquired.
	ERR_IRQ_FAILURE,			// The interrupt handler failed.
	ERR_BAD_CNF1_SETTING,		// The CNF1 pin is low (all GPIO pins are outputs).
	ERR_FAILED					// Catch-all error condition.
};



//===========================================================================
//              Chip-Specific HAL Data and Function Exports
//===========================================================================

#ifdef __cplusplus
   extern "C" {
#endif


extern const char	gszHALRevision[];	// Full HAL revision string, in SourceSafe format.
extern const char	gszLIBRevision[];	// Full LIB revision string, in SourceSafe format.
extern HAL_STRUCT	HalInfo;			// Export HalInfo for application usage
extern LUT_STRUCT	LutInfo;			// Export LutInfo for application usage



//---------------------------------------------------------------------------
//  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)
//		
//		Applications can call this routine only to obtain pointers to the
//		registers and display memory and from there take over all access

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -