P8UWaterPlasticIES4G/hardinterface/inc/type.h

158 lines
3.6 KiB
C
Raw Permalink Normal View History

2024-06-03 15:49:39 +08:00
/***********************************************************************************
* @Copyright (c) :(C)2013, Qindao ieslab Co., Ltd
* @FileName :type.h
* @Author :wf200 team
* @Version :V1.0
* @Date :2013-11-29
* @Description :Data type definition
************************************************************************************/
#ifndef TYPE_H
#define TYPE_H
#include <ddl.h>
#ifdef __cplusplus
extern "C"
{
#endif /* #ifdef __cplusplus */
/*---------------------------- Variable Define -------------------------------------*/
#pragma pack(1) //1<>ֽڶ<D6BD><DAB6><EFBFBD>
typedef signed int s32;
typedef signed short int s16;
typedef signed char s8;
typedef signed int const sc32; /* Read Only */
typedef signed short const sc16; /* Read Only */
typedef signed char const sc8; /* Read Only */
typedef volatile signed long vs32;
typedef volatile signed short vs16;
typedef volatile signed char vs8;
typedef unsigned int u32;
typedef unsigned short int u16;
typedef unsigned char u8, *PU8;;
typedef unsigned char u8;
typedef unsigned char bcd;
typedef unsigned int const uc32; /* Read Only */
typedef unsigned short const uc16; /* Read Only */
typedef unsigned char const uc8; /* Read Only */
typedef volatile unsigned int vu32;
typedef volatile unsigned short vu16;
typedef volatile unsigned char vu8;
typedef unsigned long long u64;
typedef long long s64;
typedef unsigned char BIT;
typedef unsigned char BOOL;
typedef void VOID;
typedef void* PVOID;
#define U8_MAX ((u8)255)
#define S8_MAX ((s8)127)
#define S8_MIN ((s8)-128)
#define U16_MAX ((u16)65535u)
#define S16_MAX ((s16)32767)
#define S16_MIN ((s16)-32768)
#define U32_MAX ((u32)4294967295uL)
#define S32_MAX ((s32)2147483647)
#define S32_MIN ((s32)-2147483648)
#define SUCCESS_IES 0x01
#define ERROR_IES 0x00
#define ENABLE 0x01
#define DISABLE 0x00
//GPIO Bit SET and Bit RESET enumeration
typedef enum
{
GPIO_PIN_RESET = 0,
GPIO_PIN_SET = 1,
}GPIO_PinState;
#define TASK_IDLE 1 //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڿ<EFBFBD><DABF><EFBFBD>״̬
#define TASK_BUSY 0 //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>æµ״̬
#define TASK_CONTINUE 2 //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD>
#define TASK_COMPLETE 3 //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
#define BIT0 0x0001 //һ<><D2BB><EFBFBD>ֽ<EFBFBD><D6BD><EFBFBD>ȡbit0
#define BIT1 0x0002 //һ<><D2BB><EFBFBD>ֽ<EFBFBD><D6BD><EFBFBD>ȡbit1
#define BIT2 0x0004 //һ<><D2BB><EFBFBD>ֽ<EFBFBD><D6BD><EFBFBD>ȡbit2
#define BIT3 0x0008 //һ<><D2BB><EFBFBD>ֽ<EFBFBD><D6BD><EFBFBD>ȡbit3
#define BIT4 0x0010 //һ<><D2BB><EFBFBD>ֽ<EFBFBD><D6BD><EFBFBD>ȡbit4
#define BIT5 0x0020 //һ<><D2BB><EFBFBD>ֽ<EFBFBD><D6BD><EFBFBD>ȡbit5
#define BIT6 0x0040 //һ<><D2BB><EFBFBD>ֽ<EFBFBD><D6BD><EFBFBD>ȡbit6
#define BIT7 0x0080 //һ<><D2BB><EFBFBD>ֽ<EFBFBD><D6BD><EFBFBD>ȡbit7
#define BIT8 0x0100 //һ<><D2BB><EFBFBD>ֽ<EFBFBD><D6BD><EFBFBD>ȡbit0
#define BIT9 0x0200 //һ<><D2BB><EFBFBD>ֽ<EFBFBD><D6BD><EFBFBD>ȡbit1
#define BIT10 0x0400 //һ<><D2BB><EFBFBD>ֽ<EFBFBD><D6BD><EFBFBD>ȡbit2
#define BIT11 0x0800 //һ<><D2BB><EFBFBD>ֽ<EFBFBD><D6BD><EFBFBD>ȡbit3
#define BIT12 0x1000 //һ<><D2BB><EFBFBD>ֽ<EFBFBD><D6BD><EFBFBD>ȡbit4
#define BIT13 0x2000 //һ<><D2BB><EFBFBD>ֽ<EFBFBD><D6BD><EFBFBD>ȡbit5
#define BIT14 0x4000 //һ<><D2BB><EFBFBD>ֽ<EFBFBD><D6BD><EFBFBD>ȡbit6
#define BIT15 0x8000 //һ<><D2BB><EFBFBD>ֽ<EFBFBD><D6BD><EFBFBD>ȡbit7
typedef union {
u16 to_uint16;
s16 to_sint16;
u8 to_uint8[2];
s8 to_sint8[2];
} mtype16_;
#define BYTE_L 0
#define BYTE_H 1
typedef union {
float to_float;
u32 to_uint32;
s32 to_sint32;
u16 to_uint16[2];
s16 to_sint16[2];
u8 to_uint8[4];
s8 to_sint8[4];
} mtype32_;
#define WORD_L 0
#define WORD_M 1
#define WORD_H 2
#define WORD_P 3
typedef union
{
struct
{
u8 data0;
u8 data1;
u8 data2;
u8 data3;
} datas_map;
u8 data_buf[4];
u32 datas;
} UNION_4U8TOU32;
typedef union
{
struct
{
u8 data0;
u8 data1;
} datas_map;
u8 data_buf[2];
u16 datas;
} UNION_2U8TOU16;
/*---------------------------- Function Declare -----------------------------------*/
#ifdef __cplusplus
}
#endif
#endif //#ifndef __TYPE_H