00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 #ifndef _CANpie_MacroSupport_
00033 #define _CANpie_MacroSupport_
00034
00035
00036 #include "compiler.h"
00037
00038
00039
00040
00041
00081
00082
00083
00084
00085
00086
00087
00093 #define CP_MASK_STD_FRAME 0x000007FF
00094
00095
00096
00102 #define CP_MASK_EXT_FRAME 0x1FFFFFFF
00103
00104
00105
00111 #define CP_MASK_EXT_BIT 0x80000000
00112
00113
00114
00120 #define CP_MASK_RTR_BIT 0x40000000
00121
00122
00123
00129 #define CP_MASK_DLC_BITS 0x0000000F
00130
00131
00132
00138 #define CP_MASK_BUF_BITS 0x000000F0
00139
00140
00150 #define CpMacGetBufNum(MSG_PTR) (_U08)(((MSG_PTR)->v_MsgFlags) >> 4)
00151
00152
00163 #define CpMacGetData(MSG_PTR, POS) ( (MSG_PTR)->v_MsgData[POS] )
00164
00165
00174 #define CpMacGetDlc(MSG_PTR) (_U08)(((MSG_PTR)->v_MsgFlags) & CP_MASK_DLC_BITS)
00175
00176
00186 #define CpMacGetExtId(MSG_PTR) (((MSG_PTR)->v_MsgId) & CP_MASK_EXT_FRAME)
00187
00188
00199 #define CpMacGetStdId(MSG_PTR) (_U16)(((MSG_PTR)->v_MsgId) & CP_MASK_STD_FRAME)
00200
00201
00211 #define CpMacIsExtended(MSG_PTR) (_U08)(((MSG_PTR)->v_MsgId & CP_MASK_EXT_BIT ) != 0)
00212
00213
00223 #define CpMacIsRemote(MSG_PTR) (_U08)(((MSG_PTR)->v_MsgId & CP_MASK_RTR_BIT) != 0)
00224
00225
00235 #define CpMacMsgClear(MSG_PTR) (MSG_PTR)->v_MsgId= 0;(MSG_PTR)->v_MsgFlags = 0
00236
00237
00248 #define CpMacSetBufNum(MSG_PTR, VAL) (MSG_PTR)->v_MsgFlags &= (~CP_MASK_BUF_BITS); (MSG_PTR)->v_MsgFlags |= (VAL << 4)
00249
00250
00263 #define CpMacSetData(MSG_PTR, POS, VAL) (MSG_PTR)->v_MsgData[POS] = VAL
00264
00265
00277 #define CpMacSetDlc(MSG_PTR, DLC) (MSG_PTR)->v_MsgFlags &= (~CP_MASK_DLC_BITS); (MSG_PTR)->v_MsgFlags |= DLC
00278
00279
00290 #define CpMacSetExtId(MSG_PTR, VAL) (MSG_PTR)->v_MsgId = VAL | CP_MASK_EXT_BIT
00291
00292
00300 #define CpMacSetRemote(MSG_PTR) (MSG_PTR)->v_MsgId |= CP_MASK_RTR_BIT
00301
00302
00313 #define CpMacSetStdId(MSG_PTR, VAL) (MSG_PTR)->v_MsgId = VAL
00314
00315
00316
00317 #endif
00318