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

📄 ha_typedef.h

📁 这时linux下 usb 硬件测试的代码 很好很强大
💻 H
字号:
/**************************************************************************************
 *
 *  (c) 2004 ASIC,all rights reserved
 *         
 *           
 *	This source code and any compilation or derivative thereof 
 *is proprietary information and is confidential in nature.
 *	Under no circumstance is this software to be exposed or placed
 *under an open source License of any type without expressed
 *written permission of ASIC.  
 *
 *filename:	HA_TypeDef.h          
 *history:
 *
 *    Version         Date            Author            Comments
 *------------------------------------------------------------------------------------    
 *     1.0          2004.9.24           lmq             Initial Creation
 *     
 **************************************************************************************/

/***  General-Purpose Data Types *******************************************/
typedef char            S8;      /* signed 8-bit integer */
typedef short           S16;      /* signed 16-bit integer */
typedef long            S32;      /* signed 32-bit integer */
typedef unsigned char   U8;     /* unsigned 8-bit integer */
typedef unsigned short  U16;     /* unsigned 16-bit integer */
typedef unsigned long   U32;     /* unsigned 32-bit integer */

typedef	volatile U32 *RP;		/* register connecting to hardware's change */
typedef volatile U16 *V16;
typedef volatile U8  *V8;
typedef volatile U8  *RP8;
typedef volatile U16 *RP16;

typedef void            *VP;    /* pointer to an unpredictable data type */
typedef void            (*FP)(); /* program start address */

#ifndef _BOOL_TYPE_
#define _BOOL_TYPE_
typedef int             BOOL;	/* Boolean value.  TRUE (1) or FALSE (0). */
#endif  

//define ERROR CODE   2003-4-1 15:22, LC ADD
typedef int             ER;     /* Error code.  A signed integer. */

//IF SUCCESS RETURN 0, ELSE RETURN OTHER ERROR CODE, parameter error return (-33)/E_PAR, hardware error reture (-99)/E_HA
/***************************************************************************
***  Error Codes                                                   ***
***************************************************************************/
#define E_OK       0        /* Normal completion */
#define E_SYS      (-5)     /* System error */
#define E_NOMEM    (-10)    /* Insufficient memory */
#define E_NOSPT    (-17)    /* Feature not supported */
#define E_INOSPT   (-18)    /* Feature not supported 
                               by ITRON/FILE specification */
#define E_RSFN     (-20)    /* Reserved function code number */
#define E_RSATR    (-24)    /* Reserved attribute */
#define E_PAR      (-33)    /* Parameter error */
#define E_ID       (-35)    /* Invalid ID number */
#define E_NOEXS    (-52)    /* Object does not exist */
#define E_OBJ      (-63)    /* Invalid object state */
#define E_MACV     (-65)    /* Memory access disabled or memory access 
                               violation */
#define E_OACV     (-66)    /* Object access violation */
#define E_CTX      (-69)    /* Context error */
#define E_QOVR     (-73)    /* Queuing or nesting overflow */
#define E_DLT      (-81)    /* Object being waited for was deleted */
#define E_TMOUT    (-85)    /* Polling failure or timeout exceeded */
#define E_RLWAI    (-86)    /* WAIT state was forcibly released */ 

#define	E_HA		(-99)  // HARD WARE ERROR

//define the error code and the space where the error code is placed
#define	HA_DEBUG_MODULE	  1 //enable to generate the verify harware code
#define	HA_DEBUG_GPT  
#define	HA_DEBUG_RTC
#define	HA_DEBUG_UART
#define	HA_DEBUG_EBI
#define	HA_DEBUG_LCDC
#define	HA_DEBUG_USB
#define	HA_DEBUG_CFC
#define	HA_DEBUG_DMAC
#define	HA_DEBUG_INTC
#define	HA_DEBUG_


//DEFINE THE SPACE    //the error code area space is 0x00600000 to 0x006008ff
#define	HA_ERRORBASE				0X00600000      //THE SPACE THE THE ERROR CODE
#define	HA_ERRORBASE_GPT			0X00600000      //0X00600000 TO 0X006000FF   ,256 BYTES, 64 WORDS
#define	HA_ERRORBASE_RTC			0X00600100      //0X00600100 TO 0X005001FF
#define	HA_ERRORBASE_UART			0X00600200		//0X00600200 TO 0X006002FF
#define	HA_ERRORBASE_EBI			0X00600300		//0X00600300 TO 0X006003FF
#define	HA_ERRORBASE_LCDC			0X00600400		//0X00640000 TO 0X006004FF	
#define	HA_ERRORBASE_USB            0X00600500		//0X00650000 TO 0X006005FF	
#define	HA_ERRORBASE_CFC            0X00600600		//0X00660000 TO 0X006006FF	
#define	HA_ERRORBASE_DMAC           0X00600700		//0X00670000 TO 0X006007FF	
#define	HA_ERRORBASE_INTC           0X00600800		//0X00680000 TO 0X006008FF	
#define	HA_ERRORBASE_SYS			                   
#define  HA_ERRORTOP					0X00600900

//DEFINE THE ERROR CODE, YOU CAN DEFINE MORE ERROR CODE,IF NECESSARY
#define HA_EOK		0X00000000
#define	HA_EOR_1	0X00000001        //you can use the error code to identify the sorts of error
#define	HA_EOR_2	0x00000002
#define	HA_EOR_3    0x00000003
#define	HA_EOR_4    0x00000004
#define	HA_EOR_5    0x00000005
#define	HA_EOR_6    0x00000006
#define	HA_EOR_7    0x00000007
#define	HA_EOR_8    0x00000008
#define	HA_EOR_9    0x00000009
#define	HA_EOR_10   0x0000000a
#define	HA_EOR_11   0x0000000b
#define	HA_EOR_12   0x0000000c
#define	HA_EOR_13   0x0000000d
#define	HA_EOR_14   0x0000000e
//etc.
#define HA_EOR		0XFFFFFFFF


//define the MACRO to direct the compiler to generate the code for release or for debug
#ifndef	RELEASE_CODE
#define	DEBUG_CODE	1    //enable the generate the debug code
#endif

////////////////////////
#define	SIM

#ifndef	SIM
#define	HW
#endif
///////////////////////

//////////////////////
#ifdef HW	
#define	HA_PRINT(  ADD,  ERROR_CODE  )	\
		HA_HW_PRINT(  ADD,  ERROR_CODE )
#endif

#ifdef SIM	
#define	HA_PRINT(  ADD,  ERROR_CODE  )	\
		HA_SIM_PRINT(  ADD,  ERROR_CODE )
#endif

extern	ER HA_SIM_PRINT( U32 ADD, U32 ERROR_CODE );
extern    ER HA_HW_PRINT( U32 ADD, U32 ERROR_CODE );
////////////////////////////

⌨️ 快捷键说明

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