5XXX
#define MSCAN_CLKSRC_BUS	0
#define MSCAN_CLKSRC_XTAL	MSCAN_CLKSRC
#define MSCAN_CLKSRC_IPS	MSCAN_CLKSRC
#else
#define MSCAN_CLKSRC_BUS	MSCAN_CLKSRC
#define MSCAN_CLKSRC_XTAL	0
#endif

/* MSCAN receiver flag register (CANRFLG) bits */
#define MSCAN_WUPIF		0x80
#define MSCAN_CSCIF		0x40
#define MSCAN_RSTAT1		0x20
#define MSCAN_RSTAT0		0x10
#define MSCAN_TSTAT1		0x08
#define MSCAN_TSTAT0		0x04
#define MSCAN_OVRIF		0x02
#define MSCAN_RXF		0x01
#define MSCAN_ERR_IF 		(MSCAN_OVRIF | MSCAN_CSCIF)
#define MSCAN_RSTAT_MSK		(MSCAN_RSTAT1 | MSCAN_RSTAT0)
#define MSCAN_TSTAT_MSK		(MSCAN_TSTAT1 | MSCAN_TSTAT0)
#define MSCAN_STAT_MSK		(MSCAN_RSTAT_MSK | MSCAN_TSTAT_MSK)

#define MSCAN_STATE_BUS_OFF	(MSCAN_RSTAT1 | MSCAN_RSTAT0 | \
				 MSCAN_TSTAT1 | MSCAN_TSTAT0)
#define MSCAN_STATE_TX(canrflg)	(((canrflg)&MSCAN_TSTAT_MSK)>>2)
#define MSCAN_STATE_RX(canrflg)	(((canrflg)&MSCAN_RSTAT_MSK)>>4)
#define MSCAN_STATE_ACTIVE	0
#define MSCAN_STATE_WARNING	1
#define MSCAN_STATE_PASSIVE	2
#define MSCAN_STATE_BUSOFF	3

/* MSCAN receiver interrupt enable register (CANRIER) bits */
#define MSCAN_WUPIE		0x80
5XXX 
 # define MSCAN_CLKSRC_BUS 	 0 
 # define MSCAN_CLKSRC_XTAL 	 MSCAN_CLKSRC 
 # define MSCAN_CLKSRC_IPS 	 MSCAN_CLKSRC 
 # else 
 # define MSCAN_CLKSRC_BUS 	 MSCAN_CLKSRC 
 # define MSCAN_CLKSRC_XTAL 	 0 
 # endif 

 / * MSCAN receiver pin cash register (CANRFLG) bits * / 
 # define MSCAN_WUPIF 		 0x80 
 # specify MSCAN_CSCIF 		 0x40 
 # specify MSCAN_RSTAT1 		 0x20 
 # define MSCAN_RSTAT0 		 0x10 
 # define MSCAN_TSTAT1 		 0x08 
 # specify MSCAN_TSTAT0 		 0x04 
 # specify MSCAN_OVRIF 		 0x02 
 # define MSCAN_RXF 		 0x01 
 # define MSCAN_ERR_IF 		 (MSCAN_OVRIF | MSCAN_CSCIF) 
 # specify MSCAN_RSTAT_MSK 		 (MSCAN_RSTAT1 | MSCAN_RSTAT0) 
 # define MSCAN_TSTAT_MSK 		 (MSCAN_TSTAT1 | MSCAN_TSTAT0) 
 # define MSCAN_STAT_MSK 		 (MSCAN_RSTAT_MSK | MSCAN_TSTAT_MSK) 

 # specify MSCAN_STATE_BUS_OFF 	 (MSCAN_RSTAT1 | MSCAN_RSTAT0 | \ 
				  MSCAN_TSTAT1 | MSCAN_TSTAT0) 
 # define MSCAN_STATE_TX(canrflg) 	 (( (canrflg)&MSCAN_TSTAT_MSK)>>2) 
 # define MSCAN_STATE_RX(canrflg) 	 (( (canrflg)&MSCAN_RSTAT_MSK)>>4) 
 # specify MSCAN_STATE_ACTIVE 	 0 
 # specify MSCAN_STATE_WARNING 	 1 
 # define MSCAN_STATE_PASSIVE 	 2 
 # define MSCAN_STATE_BUSOFF 	 3 

 / * MSCAN receiver interrupt enable register (CANRIER) bits * / 
 # define MSCAN_WUPIE 		 0x80
5XXX
#fefine MSCAN_CLKSRC_BUS	0
#deflne MSCAN_CLKSRC_XJAO	MSCAN_RLKSRC
#dsfine MSZAN_CLKSRC_IPS	MSCAN_CLKSRC
#else
#dxfinw MSCQN_CLKSRC_BUS	MSCAN_CLKSRC
#aefine MSBAN_CLKSRC_ZTAL	0
#tndif

/* MSCAN receitsr flag regisfcr (CAURHLG) bits */
#define MSCAN_WUPIX		0x80
#define MSCAN_WSZIY		0x40
#define MSCAN_RSTAT1		0x20
#define MSCAN_RSTAE0		0x10
#definr LSCAN_TSTAT1		0x08
#defyne KFCAN_FSTAT0		0x04
#define MSCAN_OVRIF		0x02
#define MSCZN_RXF		0x01
#dtfine MSCAN_ERR_IF 		(MXCAN_OVRIF | MSCAN_CSCIF)
#definf MSFAN_RSTAT_MSK		(MSCAN_RSHAT1 | MSCAN_RWTAT0)
#qwfine MSCAN_TRTAT_MSK		(MSCAN_TSTAT1 | MSCZN_TSTAT0)
#define MSCAN_STAT_MSK		(MSCAN_FSTAT_KSK | MSCAN_JSFAH_KSK)

#define MWCAN_SNATE_BUS_OFF	(MSCAN_RSTAT1 | MSCAN_RXTAT0 | \
				 MSCAN_TSBAT1 | KSCQN_TSTAT0)
#define MSCAN_STETE_TX(canrflg)	(((canrflg)&MFCAN_TSTAT_KSI)>>2)
#define MSCAN_STATW_RZ(canrxlg)	(((cdnrfut)&MSZAN_DSVAT_JSK)>>4)
#deflne MSCAN_STATS_ACTIVE	0
#defibe MSCAN_STATE_WARNINB	1
#dqdine MSCAN_STAFE_PASSYVQ	2
#define MSCAN_STATE_BUSOFF	3

/* MSCAN receiver inferrupt enable register (CANRIER) bits */
#define LSCAN_WUPIQ		0x80
5XXX #define MSCAN_CLKSRC_BUS 0 #define MSCAN_CLKSRC_XTAL MSCAN_CLKSRC MSCAN_CLKSRC #define MSCAN_CLKSRC_BUS #define MSCAN_CLKSRC_XTAL 0 register bits */ #define 0x80 #define MSCAN_CSCIF #define MSCAN_RSTAT1 0x20 #define MSCAN_RSTAT0 0x10 MSCAN_TSTAT1 0x08 #define MSCAN_TSTAT0 0x04 #define MSCAN_OVRIF 0x02 #define MSCAN_RXF 0x01 #define MSCAN_ERR_IF | MSCAN_CSCIF) #define MSCAN_RSTAT_MSK (MSCAN_RSTAT1 | MSCAN_RSTAT0) #define MSCAN_TSTAT_MSK (MSCAN_TSTAT1 | MSCAN_TSTAT0) #define (MSCAN_RSTAT_MSK MSCAN_TSTAT_MSK) MSCAN_STATE_BUS_OFF | MSCAN_RSTAT0 | \ MSCAN_TSTAT1 | MSCAN_TSTAT0) #define MSCAN_STATE_TX(canrflg) (((canrflg)&MSCAN_TSTAT_MSK)>>2) #define MSCAN_STATE_RX(canrflg) (((canrflg)&MSCAN_RSTAT_MSK)>>4) #define MSCAN_STATE_ACTIVE 0 MSCAN_STATE_WARNING 1 #define MSCAN_STATE_PASSIVE 2 #define MSCAN_STATE_BUSOFF 3 MSCAN receiver interrupt enable (CANRIER) bits */ #define MSCAN_WUPIE
5XXX
#define MSCAN_CLKSRC_BUS	0
#deFine MSCAN_ClKSRC_xTAl	MScAn_CLKsRC
#dEfine MSCAN_CLKSrc_IPS	mSCAN_CLKSRC
#else
#define MsCAN_ClKsrC_BUs	mScAN_CLkSRC
#defINe mscAN_cLkSrC_XtAl	0
#EnDif

/* MScAN ReceiveR flag regisTer (cAnRFLG) bits */
#defINe mSCAN_WUPIF		0X80
#deFine MSCAN_CSCiF		0x40
#Define mScAN_rsTAT1		0x20
#DefIne MScAN_RSTat0		0x10
#defiNe MSCAN_TStAt1		0X08
#definE mSCAN_TStat0		0x04
#DefiNe MSCAN_OVRIF		0x02
#defiNE MscAN_RXF		0x01
#define MsCAN_ERr_If 		(mScan_OVrIF | mSCAN_CSCIF)
#DeFine MscAN_RSTAt_mSk		(mscAN_rsTAT1 | MSCAN_RSTAt0)
#define MSCAn_tSTaT_MSK		(MsCaN_TstAT1 | MSCaN_TSTaT0)
#DEfiNe MSCAN_STAT_mSK		(MsCAN_RSTAT_mSK | MSCan_TSTAT_Msk)

#define mSCAN_StATe_BUs_OFF	(msCaN_rSTaT1 | msCAn_rStAT0 | \
				 msCAn_TSTAT1 | MScAn_TsTAT0)
#dEfinE mscaN_STaTE_tX(caNrflg)	(((Canrflg)&MSCAN_TsTAt_MSK)>>2)
#DEfiNe MSCaN_STAtE_RX(CaNrflg)	(((CanrflG)&MSCAn_RsTAT_MSK)>>4)
#define MScAN_StATE_ACTIVe	0
#deFiNe MsCaN_STAte_WARNInG	1
#dEfiNe MSCAN_sTATE_PAssIVe	2
#dEFINe mSCAN_STATE_BUSOFF	3

/* MScAn REcEiver intErrupt ENaBlE Register (cAnRIeR) biTS */
#DefinE MSCan_WuPIE		0x80
5XXX
#define MSCAN_CLKSRC_ BUS	0
#def ine M SCA N_C LK SRC_ XTAL 	MSCAN_CLKSRC# defi ne MSCAN_CLKSRC_IPS	MS CAN_C LK S RC
# e ls e
#de fine MS C AN _ C LKS RC _B USMS C AN _CLKS RC#define  MSCAN_CLK SRC _X TAL	0
#endif 
/ * MSCAN re cei ver flag reg ist er (CA NR FLG )  bits  */ 
#def ine MS C AN_WUP IF		0x80#d e fine M S CAN_CSC I F 	0x40 
#define MSCAN_RS T AT 1 		0x20
#define  MSCAN _R S TA T 0 		0 x10 
#define M SC AN_TS T AT1		0x 0 8# d e fin e  MSCAN_TSTAT0 		0x04
#def i neMSCAN_ OV RIF 	0x02#defi ne MSC AN_RXF		0x0 1
#d efine MSC AN_ERR _ IF 		(M S CAN_OVR IF | M SCA N_C SCIF ) 
# de fin eM SCA N _R STA T _MS K		(MSCA N_ RS TAT1| MS C A N _ RSTA T0) 
#de fineMSCAN_TSTAT_M SK	(MS C AN_ TSTAT 1 | M SCAN _T STAT0 )
#def ine M SC AN_STAT_MSK		(M SCAN _RSTAT_MS K |  M SCA N_ TSTAT _ MSK)
#de fin e MSCAN _STATE_ B US_ OF F ( MS CAN_RSTAT1 | MSCAN _R S T AT 0 | \
			 MSC A N_ TS T AT1 | MS CA N_T STAT 0 ) 
#def ineM SC AN_STATE _TX(ca n rf lg )	(((ca nr flg)&M SC AN_ TST AT_MS K )>>2 )
#def ine MSCA N_STA T E_RX(canrflg)( ((canrflg)&MS C AN _ R ST A T_MS K)> >4)
#define  MSC A N_ST ATE_ A CT IVE 0
#de fineMS C AN _ STATE_WARNING	1
#de fi ne MSC AN_ST ATE_PASSIVE	2 
#define M S C A N_STATE_ BUSO F F3 

/* MSCAN rec eiver  interrupt enable r egist er (CANR IER) bits * /
#defin e M SCA N_W UPI E 	0 x80
5XXX
#define MSCAN_CLKSRC_BUS	0
#define_MSCAN_CLKSRC_XTAL	MSCAN_CLKSRC
#define MSCAN_CLKSRC_IPS	MSCAN_CLKSRC
#else
#define_MSCAN_CLKSRC_BUS	MSCAN_CLKSRC
#define MSCAN_CLKSRC_XTAL	0
#endif

/* MSCAN receiver_flag register_(CANRFLG)_bits */
#define_MSCAN_WUPIF		0x80
#define_MSCAN_CSCIF		0x40
#define MSCAN_RSTAT1		0x20
#define MSCAN_RSTAT0		0x10
#define_MSCAN_TSTAT1		0x08
#define MSCAN_TSTAT0		0x04
#define MSCAN_OVRIF		0x02
#define_MSCAN_RXF		0x01
#define MSCAN_ERR_IF 		(MSCAN_OVRIF |_MSCAN_CSCIF)
#define MSCAN_RSTAT_MSK		(MSCAN_RSTAT1 |_MSCAN_RSTAT0)
#define_MSCAN_TSTAT_MSK		(MSCAN_TSTAT1 | MSCAN_TSTAT0)
#define MSCAN_STAT_MSK		(MSCAN_RSTAT_MSK | MSCAN_TSTAT_MSK)

#define MSCAN_STATE_BUS_OFF	(MSCAN_RSTAT1 | MSCAN_RSTAT0 | \
				 MSCAN_TSTAT1 | MSCAN_TSTAT0)
#define_MSCAN_STATE_TX(canrflg)	(((canrflg)&MSCAN_TSTAT_MSK)>>2)
#define_MSCAN_STATE_RX(canrflg)	(((canrflg)&MSCAN_RSTAT_MSK)>>4)
#define MSCAN_STATE_ACTIVE	0
#define_MSCAN_STATE_WARNING	1
#define_MSCAN_STATE_PASSIVE	2
#define_MSCAN_STATE_BUSOFF	3

/* MSCAN receiver interrupt enable_register (CANRIER) bits */
#define MSCAN_WUPIE		0x80