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

📄 utility.h

📁 ARM得编程实例。很经典。在win ce5.0环境下的编程实例
💻 H
字号:
/*******************************************************************
 
*******************************************************************/

#ifndef UTILITY_H
#define UTILITY_H

/*************************** Compiler Switch **************************/
#define DEBUG 
/* #define HARDWARETEST */
/* #define SIMULATION */

/*********************** Customer Constant Macros *********************/
#ifdef INTEL_X86_CPU
    #define  VERSION_STRING  "Version: TCC SP 1.00 for x86"
#endif

#ifdef ARM_XSCALE_CPU
    #define  VERSION_STRING  "Version: TCC SP 0.01 for arm"
#endif

#define NORMAL  0xAA
#define FAIL    0x55

#define TSYSA           0xAA
#define TSYSB           0x55
#define TSYSUNKNOWN     0x00

#ifdef INTEL_X86_CPU
    #define FILE_PATH_LEN  80   /* file path name length */
#endif

/* system status code */
#define SYS_NOERR 0x0000    /* No error occurred   */
#define DBS_ERROR 0x1100    /* Dbs Module error    */
#define DPM_ERROR 0x2200    /* Dual-port RAM error */
#define NET_ERROR 0x3300    /* Net Module error    */
#define SYN_ERROR 0x4400    /* Syn Module error    */
#define INL_ERROR 0x5500    /* Inl Module error    */

/*************************** Utility Macros **************************/

#ifdef ARM_XSCALE_CPU  /* arm xscale */
    #define LOBYTE(w)           ((INT8U)(w))               
    #define HIBYTE(w)           ((INT8U)(((INT16U)(w) >> 8) & 0xFF))
    #define MAKEWORD(l,h)       (((INT16U)(l)) | (((INT16U)(h)) <<8))
    #define MAKELONG(l,h)       ((INT32U)(((INT16U)(l)) | (((INT32U)((INT16U)(h))) <<16)))
    #define MK_FP(sel, off)     ((void *)MAKELONG((off), (sel))) 

    /* Wrap system write port operation */
    #define WritePort(PORT_ADDRESS,PORT_DATA)   outp(((unsigned short)\
                               (PORT_ADDRESS)) , (unsigned char)(PORT_DATA))
    
    /* Wrap system read port operation */
    #define ReadPort(PORT_ADDRESS)   inp (((unsigned short)(PORT_ADDRESS)))
#else  /* x86 */
    #define LOBYTE(w)           ((BYTE)(w))               
    #define HIBYTE(w)           ((BYTE)(((UINT)(w) >> 8) & 0xFF))
    #define MAKEWORD(l,h)       (((WORD)(l)) | (((WORD)(h)) <<8))
    #define MAKELONG(l,h)       ((LONG)(((WORD)(l)) | (((DWORD)((WORD)(h))) <<16)))
    #define MAKELP(sel, off)    ((void FAR*)MAKELONG((off), (sel))) 
    #define MK_FP(sel,off)      MAKELP(sel,off) 

    /* Wrap system write port operation */
    #define WritePort(PORT_ADDRESS,PORT_DATA)   outp(((unsigned short)\
                              (PORT_ADDRESS)) , (unsigned char)(PORT_DATA))
    
    /* Wrap system read port operation */
    #define ReadPort(PORT_ADDRESS)   inp (((unsigned short)(PORT_ADDRESS)))
#endif

#endif /* UTILITY_H */

⌨️ 快捷键说明

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