📄 def.h
字号:
/**************************************************************************
* *
* PROJECT : ARM port for UCOS-II *
* *
* MODULE : DEF.h *
* *
* AUTHOR : Michael Anburaj *
* URL : http://geocities.com/michaelanburaj/ *
* EMAIL: michaelanburaj@hotmail.com *
* *
* PROCESSOR : Any Processor *
* *
* IDE : Any IDE *
* *
* DESCRIPTION : *
* Common data type definition header file. *
* *
**************************************************************************/
#ifndef __DEF_H__
#define __DEF_H__
#ifdef __cplusplus
extern "C" {
#endif
/* ********************************************************************* */
/* Module configuration */
/* ********************************************************************* */
/* Interface macro & data definition */
#define U32 unsigned long
#define U16 unsigned short
#define S32 int
#define S16 short int
#define U8 unsigned char
#define S8 signed char
#define False 0
#define True !False
typedef struct _FORMAT_FLAG8BIT {
U8 bit0 :1;
U8 bit1 :1;
U8 bit2 :1;
U8 bit3 :1;
U8 bit4 :1;
U8 bit5 :1;
U8 bit6 :1;
U8 bit7 :1;
} FORMAT_FLAG8BIT;
typedef struct _FORMAT_FLAG16BIT {
U16 bit0 :1;
U16 bit1 :1;
U16 bit2 :1;
U16 bit3 :1;
U16 bit4 :1;
U16 bit5 :1;
U16 bit6 :1;
U16 bit7 :1;
U16 bit8 :1;
U16 bit9 :1;
U16 bit10 :1;
U16 bit11 :1;
U16 bit12 :1;
U16 bit13 :1;
U16 bit14 :1;
U16 bit15 :1;
} FORMAT_FLAG16BIT;
typedef struct _FORMAT_FLAG32BIT {
U32 bit0 :1;
U32 bit1 :1;
U32 bit2 :1;
U32 bit3 :1;
U32 bit4 :1;
U32 bit5 :1;
U32 bit6 :1;
U32 bit7 :1;
U32 bit8 :1;
U32 bit9 :1;
U32 bit10 :1;
U32 bit11 :1;
U32 bit12 :1;
U32 bit13 :1;
U32 bit14 :1;
U32 bit15 :1;
U32 bit16 :1;
U32 bit17 :1;
U32 bit18 :1;
U32 bit19 :1;
U32 bit20 :1;
U32 bit21 :1;
U32 bit22 :1;
U32 bit23 :1;
U32 bit24 :1;
U32 bit25 :1;
U32 bit26 :1;
U32 bit27 :1;
U32 bit28 :1;
U32 bit29 :1;
U32 bit30 :1;
U32 bit31 :1;
} FORMAT_FLAG32BIT;
/* Sets the result on bPort */
#define BIT_SET(bPort,bBitMask) (bPort |= bBitMask)
#define BIT_CLR(bPort,bBitMask) (bPort &= ~bBitMask)
/* Returns the result */
#define GET_BIT_SET(bPort,bBitMask) (bPort | bBitMask)
#define GET_BIT_CLR(bPort,bBitMask) (bPort & ~bBitMask)
/* Returns 0 if the condition is False & a non-zero value if it is True */
#define TEST_BIT_SET(bPort,bBitMask) (bPort & bBitMask)
#define TEST_BIT_CLR(bPort,bBitMask) ((~bPort) & bBitMask)
/* ********************************************************************* */
/* Interface function definition */
#define Delay(x) {\
volatile U32 i = x;\
while(i--);\
}
/* ********************************************************************* */
#ifdef __cplusplus
}
#endif
#endif /*__DEF_H__*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -