📄 pccdef.h
字号:
/* General definitions
-----------------------*/
#define arm__
#ifndef arm__
#define __BORLANDC__
#define SDL
#define PC_U32
#endif
/*if uese rtos (nucleus)
#define RTOS
*/
/*Aliases for minimum and maximum for types
----------------------------------------------*/
#define U8_MAX 0xFF
#define U8_MIN 0x00
#define U16_MAX 0xFFFF
#define U16_MIN 0x0000
#define U32_MAX 0xFFFFFFFF
#define U32_MIN 0x00000000
#define S8_MAX 0x7F
#define S8_MIN 0x80
#define S16_MAX 0x7FFF
#define S16_MIN 0x8000
#define S32_MAX 0x7FFFFFFF
#define S32_MIN 0x80000000
#ifndef TRUE
#define TRUE (0x1)
#endif
#ifndef FALSE
#define FALSE (0x0)
#endif
#ifndef NULL /* may already be defined in stdio.h */
#define NULL (0)
#endif
#ifndef NIL
#define NIL (0)
#endif
/* Type definition
--------------- */
#define PCC_T_REQ 0
#define PCC_T_CNF 1
#define PCC_T_ERR 2
#define PCC_T_IND 3
#define PCC_T_RSP 4
#define PCC_T_RJT 5
#define PCC_T_TIM 6
#define PCC_T_MASK 0xFFF8
#ifdef arm__
#define PACKED __packed
#endif
#ifdef __BORLANDC__
#define PACKED pack
#endif
/* ------------------------------------------------------- */
#ifndef PCCDEF_HET
#define PCCDEF_HET
/*common types*/
typedef unsigned char bool;
typedef unsigned char u8;
typedef unsigned short u16;
typedef unsigned long u32;
typedef signed char s8;
typedef signed short s16;
typedef signed long s32;
typedef double f64;
typedef unsigned char UINT8;
typedef unsigned short UINT16;
typedef unsigned long UINT32;
typedef signed char SINT8;
typedef signed short SINT16;
typedef signed long SINT32;
typedef double F64;
typedef char ascii; /* for compatibility with standard library */
#endif
/* ------------------------------------------------------- */
#ifndef PCCDEF_HEM
#define PCCDEF_HEM
/*=========================================================================
* Memory alignment tools
*=========================================================================*/
#ifndef OBJ_TO_L1
#define MC_PCC_FILL_STRUCT1 u8 v_FillerU8;
#define MC_PCC_FILL_STRUCT2 u16 v_FillerU16;
#define MC_PCC_FILL_STRUCT3 u8 v_FillerU8_1 ; u16 v_FillerU16_1;
#endif
#ifdef OBJ_TO_L1
#define MC_PCC_FILL_STRUCT1
#define MC_PCC_FILL_STRUCT2
#define MC_PCC_FILL_STRUCT3
#endif
#define MC_PCC_FILL_MEMSTRUCT1(v_MemberU8) u8 v_MemberU8 ;
#define MC_PCC_FILL_MEMSTRUCT2(v_MemberU16) u16 v_MemberU16 ;
#define MC_PCC_FILL_MEMSTRUCT3(v_MemberU8,v_MemberU16) u8 v_MemberU8 ; u16 v_MemberU16;
#define MC_PCC_FILL_INISTRUCT1 0,
#define MC_PCC_FILL_INISTRUCT2 0,
#define MC_PCC_FILL_INISTRUCT3 0,0,
/*---------- */
#define MC_PCC_HEADER( ProcessTx, ProcessRx, EventName, Event_id ) \
enum { EventName = Event_id };
#define MC_PCC_TYPE( StrucName )
/* Structure definition
-------------------- */
#define MC_PCC_BEGIN_NO_HEAD_STRUC( StrucName ) \
typedef struct {
#define MC_PCC_BEGIN_API_STRUC( HeaderType, StrucName ) \
typedef struct { \
HeaderType s_MsgHeader;
#define MC_PCC_BEGIN_STRUC( StrucName ) \
MC_PCC_BEGIN_API_STRUC( T_MsgHeader, StrucName)
#define MC_PCC_END_STRUC( StrucName ) \
} StrucName;
/* Field definitions
----------------- */
#define MC_PCC_FIELD( FieldType, FieldName ) \
FieldType FieldName;
#define MC_PCC_GAP( FieldName ) \
u8:0; u8:8; u8:0;
#define MC_PCC_ARRAY( FieldType, FieldName, ArraySize ) \
FieldType FieldName[ArraySize];
/* Sub array
--------- */
#define MC_PCC_BEGIN_STRUC_ARRAY( StrucName, ArraySize ) \
struct {
#define MC_PCC_END_STRUC_ARRAY( StrucName, ArraySize ) \
} StrucName[ArraySize];
/* External structure
------------------ */
#define MC_PCC_BEGIN_EXT_TYPE( StrucName ) \
typedef struct {
#define MC_PCC_END_EXT_TYPE( StrucName ) \
} StrucName;
/* Union and bit-field
------------------- */
#define MC_PCC_BEGIN_UNION( StructName ) \
typedef union {
#define MC_PCC_END_UNION( StructName ) \
} StructName;
#define MC_PCC_BIT_FIELD( FieldType, FieldName, NbByte ) \
FieldType FieldName : NbByte;
/* Modify the operation type of a message
-------------------------------------- */
#define MC_PCC_MESSAGE_ERR( OpType ) ( ( OpType & PCC_T_MASK ) | PCC_T_ERR )
/* definition of the operation type
-------------------------------- */
#define MC_PCC_FUNCTION_TYPE( Function, Type ) ( ( Function << 3 ) | Type )
#define MC_PCC_PROCESS_OPERATION( Interface, Function ) \
( ((Function << 6) & 0xC000) | ((Interface) << 8) | (Function & 0x00FF) )
#define MC_PCC_PROCESS_TIMER( TaskName, Instance, Operation ) \
(( TaskName << (sizeof(t_OperationType)*8) ) | Operation )
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -