1
0

hw_can.h 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756
  1. //*****************************************************************************
  2. //
  3. // hw_can.h - Defines and macros used when accessing the CAN controllers.
  4. //
  5. // Copyright (c) 2006-2011 Texas Instruments Incorporated. All rights reserved.
  6. // Software License Agreement
  7. //
  8. // Texas Instruments (TI) is supplying this software for use solely and
  9. // exclusively on TI's microcontroller products. The software is owned by
  10. // TI and/or its suppliers, and is protected under applicable copyright
  11. // laws. You may not combine this software with "viral" open-source
  12. // software in order to form a larger program.
  13. //
  14. // THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS.
  15. // NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT
  16. // NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  17. // A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY
  18. // CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL
  19. // DAMAGES, FOR ANY REASON WHATSOEVER.
  20. //
  21. // This is part of revision 8264 of the Stellaris Firmware Development Package.
  22. //
  23. //*****************************************************************************
  24. #ifndef __HW_CAN_H__
  25. #define __HW_CAN_H__
  26. //*****************************************************************************
  27. //
  28. // The following are defines for the CAN register offsets.
  29. //
  30. //*****************************************************************************
  31. #define CAN_O_CTL 0x00000000 // CAN Control
  32. #define CAN_O_STS 0x00000004 // CAN Status
  33. #define CAN_O_ERR 0x00000008 // CAN Error Counter
  34. #define CAN_O_BIT 0x0000000C // CAN Bit Timing
  35. #define CAN_O_INT 0x00000010 // CAN Interrupt
  36. #define CAN_O_TST 0x00000014 // CAN Test
  37. #define CAN_O_BRPE 0x00000018 // CAN Baud Rate Prescaler
  38. // Extension
  39. #define CAN_O_IF1CRQ 0x00000020 // CAN IF1 Command Request
  40. #define CAN_O_IF1CMSK 0x00000024 // CAN IF1 Command Mask
  41. #define CAN_O_IF1MSK1 0x00000028 // CAN IF1 Mask 1
  42. #define CAN_O_IF1MSK2 0x0000002C // CAN IF1 Mask 2
  43. #define CAN_O_IF1ARB1 0x00000030 // CAN IF1 Arbitration 1
  44. #define CAN_O_IF1ARB2 0x00000034 // CAN IF1 Arbitration 2
  45. #define CAN_O_IF1MCTL 0x00000038 // CAN IF1 Message Control
  46. #define CAN_O_IF1DA1 0x0000003C // CAN IF1 Data A1
  47. #define CAN_O_IF1DA2 0x00000040 // CAN IF1 Data A2
  48. #define CAN_O_IF1DB1 0x00000044 // CAN IF1 Data B1
  49. #define CAN_O_IF1DB2 0x00000048 // CAN IF1 Data B2
  50. #define CAN_O_IF2CRQ 0x00000080 // CAN IF2 Command Request
  51. #define CAN_O_IF2CMSK 0x00000084 // CAN IF2 Command Mask
  52. #define CAN_O_IF2MSK1 0x00000088 // CAN IF2 Mask 1
  53. #define CAN_O_IF2MSK2 0x0000008C // CAN IF2 Mask 2
  54. #define CAN_O_IF2ARB1 0x00000090 // CAN IF2 Arbitration 1
  55. #define CAN_O_IF2ARB2 0x00000094 // CAN IF2 Arbitration 2
  56. #define CAN_O_IF2MCTL 0x00000098 // CAN IF2 Message Control
  57. #define CAN_O_IF2DA1 0x0000009C // CAN IF2 Data A1
  58. #define CAN_O_IF2DA2 0x000000A0 // CAN IF2 Data A2
  59. #define CAN_O_IF2DB1 0x000000A4 // CAN IF2 Data B1
  60. #define CAN_O_IF2DB2 0x000000A8 // CAN IF2 Data B2
  61. #define CAN_O_TXRQ1 0x00000100 // CAN Transmission Request 1
  62. #define CAN_O_TXRQ2 0x00000104 // CAN Transmission Request 2
  63. #define CAN_O_NWDA1 0x00000120 // CAN New Data 1
  64. #define CAN_O_NWDA2 0x00000124 // CAN New Data 2
  65. #define CAN_O_MSG1INT 0x00000140 // CAN Message 1 Interrupt Pending
  66. #define CAN_O_MSG2INT 0x00000144 // CAN Message 2 Interrupt Pending
  67. #define CAN_O_MSG1VAL 0x00000160 // CAN Message 1 Valid
  68. #define CAN_O_MSG2VAL 0x00000164 // CAN Message 2 Valid
  69. //*****************************************************************************
  70. //
  71. // The following are defines for the bit fields in the CAN_O_CTL register.
  72. //
  73. //*****************************************************************************
  74. #define CAN_CTL_TEST 0x00000080 // Test Mode Enable
  75. #define CAN_CTL_CCE 0x00000040 // Configuration Change Enable
  76. #define CAN_CTL_DAR 0x00000020 // Disable Automatic-Retransmission
  77. #define CAN_CTL_EIE 0x00000008 // Error Interrupt Enable
  78. #define CAN_CTL_SIE 0x00000004 // Status Interrupt Enable
  79. #define CAN_CTL_IE 0x00000002 // CAN Interrupt Enable
  80. #define CAN_CTL_INIT 0x00000001 // Initialization
  81. //*****************************************************************************
  82. //
  83. // The following are defines for the bit fields in the CAN_O_STS register.
  84. //
  85. //*****************************************************************************
  86. #define CAN_STS_BOFF 0x00000080 // Bus-Off Status
  87. #define CAN_STS_EWARN 0x00000040 // Warning Status
  88. #define CAN_STS_EPASS 0x00000020 // Error Passive
  89. #define CAN_STS_RXOK 0x00000010 // Received a Message Successfully
  90. #define CAN_STS_TXOK 0x00000008 // Transmitted a Message
  91. // Successfully
  92. #define CAN_STS_LEC_M 0x00000007 // Last Error Code
  93. #define CAN_STS_LEC_NONE 0x00000000 // No Error
  94. #define CAN_STS_LEC_STUFF 0x00000001 // Stuff Error
  95. #define CAN_STS_LEC_FORM 0x00000002 // Format Error
  96. #define CAN_STS_LEC_ACK 0x00000003 // ACK Error
  97. #define CAN_STS_LEC_BIT1 0x00000004 // Bit 1 Error
  98. #define CAN_STS_LEC_BIT0 0x00000005 // Bit 0 Error
  99. #define CAN_STS_LEC_CRC 0x00000006 // CRC Error
  100. #define CAN_STS_LEC_NOEVENT 0x00000007 // No Event
  101. //*****************************************************************************
  102. //
  103. // The following are defines for the bit fields in the CAN_O_ERR register.
  104. //
  105. //*****************************************************************************
  106. #define CAN_ERR_RP 0x00008000 // Received Error Passive
  107. #define CAN_ERR_REC_M 0x00007F00 // Receive Error Counter
  108. #define CAN_ERR_TEC_M 0x000000FF // Transmit Error Counter
  109. #define CAN_ERR_REC_S 8
  110. #define CAN_ERR_TEC_S 0
  111. //*****************************************************************************
  112. //
  113. // The following are defines for the bit fields in the CAN_O_BIT register.
  114. //
  115. //*****************************************************************************
  116. #define CAN_BIT_TSEG2_M 0x00007000 // Time Segment after Sample Point
  117. #define CAN_BIT_TSEG1_M 0x00000F00 // Time Segment Before Sample Point
  118. #define CAN_BIT_SJW_M 0x000000C0 // (Re)Synchronization Jump Width
  119. #define CAN_BIT_BRP_M 0x0000003F // Baud Rate Prescaler
  120. #define CAN_BIT_TSEG2_S 12
  121. #define CAN_BIT_TSEG1_S 8
  122. #define CAN_BIT_SJW_S 6
  123. #define CAN_BIT_BRP_S 0
  124. //*****************************************************************************
  125. //
  126. // The following are defines for the bit fields in the CAN_O_INT register.
  127. //
  128. //*****************************************************************************
  129. #define CAN_INT_INTID_M 0x0000FFFF // Interrupt Identifier
  130. #define CAN_INT_INTID_NONE 0x00000000 // No interrupt pending
  131. #define CAN_INT_INTID_STATUS 0x00008000 // Status Interrupt
  132. //*****************************************************************************
  133. //
  134. // The following are defines for the bit fields in the CAN_O_TST register.
  135. //
  136. //*****************************************************************************
  137. #define CAN_TST_RX 0x00000080 // Receive Observation
  138. #define CAN_TST_TX_M 0x00000060 // Transmit Control
  139. #define CAN_TST_TX_CANCTL 0x00000000 // CAN Module Control
  140. #define CAN_TST_TX_SAMPLE 0x00000020 // Sample Point
  141. #define CAN_TST_TX_DOMINANT 0x00000040 // Driven Low
  142. #define CAN_TST_TX_RECESSIVE 0x00000060 // Driven High
  143. #define CAN_TST_LBACK 0x00000010 // Loopback Mode
  144. #define CAN_TST_SILENT 0x00000008 // Silent Mode
  145. #define CAN_TST_BASIC 0x00000004 // Basic Mode
  146. //*****************************************************************************
  147. //
  148. // The following are defines for the bit fields in the CAN_O_BRPE register.
  149. //
  150. //*****************************************************************************
  151. #define CAN_BRPE_BRPE_M 0x0000000F // Baud Rate Prescaler Extension
  152. #define CAN_BRPE_BRPE_S 0
  153. //*****************************************************************************
  154. //
  155. // The following are defines for the bit fields in the CAN_O_IF1CRQ register.
  156. //
  157. //*****************************************************************************
  158. #define CAN_IF1CRQ_BUSY 0x00008000 // Busy Flag
  159. #define CAN_IF1CRQ_MNUM_M 0x0000003F // Message Number
  160. #define CAN_IF1CRQ_MNUM_RSVD 0x00000000 // 0 is not a valid message number;
  161. // it is interpreted as 0x20, or
  162. // object 32
  163. #define CAN_IF1CRQ_MNUM_S 0
  164. //*****************************************************************************
  165. //
  166. // The following are defines for the bit fields in the CAN_O_IF1CMSK register.
  167. //
  168. //*****************************************************************************
  169. #define CAN_IF1CMSK_WRNRD 0x00000080 // Write, Not Read
  170. #define CAN_IF1CMSK_MASK 0x00000040 // Access Mask Bits
  171. #define CAN_IF1CMSK_ARB 0x00000020 // Access Arbitration Bits
  172. #define CAN_IF1CMSK_CONTROL 0x00000010 // Access Control Bits
  173. #define CAN_IF1CMSK_CLRINTPND 0x00000008 // Clear Interrupt Pending Bit
  174. #define CAN_IF1CMSK_NEWDAT 0x00000004 // Access New Data
  175. #define CAN_IF1CMSK_TXRQST 0x00000004 // Access Transmission Request
  176. #define CAN_IF1CMSK_DATAA 0x00000002 // Access Data Byte 0 to 3
  177. #define CAN_IF1CMSK_DATAB 0x00000001 // Access Data Byte 4 to 7
  178. //*****************************************************************************
  179. //
  180. // The following are defines for the bit fields in the CAN_O_IF1MSK1 register.
  181. //
  182. //*****************************************************************************
  183. #define CAN_IF1MSK1_IDMSK_M 0x0000FFFF // Identifier Mask
  184. #define CAN_IF1MSK1_IDMSK_S 0
  185. //*****************************************************************************
  186. //
  187. // The following are defines for the bit fields in the CAN_O_IF1MSK2 register.
  188. //
  189. //*****************************************************************************
  190. #define CAN_IF1MSK2_MXTD 0x00008000 // Mask Extended Identifier
  191. #define CAN_IF1MSK2_MDIR 0x00004000 // Mask Message Direction
  192. #define CAN_IF1MSK2_IDMSK_M 0x00001FFF // Identifier Mask
  193. #define CAN_IF1MSK2_IDMSK_S 0
  194. //*****************************************************************************
  195. //
  196. // The following are defines for the bit fields in the CAN_O_IF1ARB1 register.
  197. //
  198. //*****************************************************************************
  199. #define CAN_IF1ARB1_ID_M 0x0000FFFF // Message Identifier
  200. #define CAN_IF1ARB1_ID_S 0
  201. //*****************************************************************************
  202. //
  203. // The following are defines for the bit fields in the CAN_O_IF1ARB2 register.
  204. //
  205. //*****************************************************************************
  206. #define CAN_IF1ARB2_MSGVAL 0x00008000 // Message Valid
  207. #define CAN_IF1ARB2_XTD 0x00004000 // Extended Identifier
  208. #define CAN_IF1ARB2_DIR 0x00002000 // Message Direction
  209. #define CAN_IF1ARB2_ID_M 0x00001FFF // Message Identifier
  210. #define CAN_IF1ARB2_ID_S 0
  211. //*****************************************************************************
  212. //
  213. // The following are defines for the bit fields in the CAN_O_IF1MCTL register.
  214. //
  215. //*****************************************************************************
  216. #define CAN_IF1MCTL_NEWDAT 0x00008000 // New Data
  217. #define CAN_IF1MCTL_MSGLST 0x00004000 // Message Lost
  218. #define CAN_IF1MCTL_INTPND 0x00002000 // Interrupt Pending
  219. #define CAN_IF1MCTL_UMASK 0x00001000 // Use Acceptance Mask
  220. #define CAN_IF1MCTL_TXIE 0x00000800 // Transmit Interrupt Enable
  221. #define CAN_IF1MCTL_RXIE 0x00000400 // Receive Interrupt Enable
  222. #define CAN_IF1MCTL_RMTEN 0x00000200 // Remote Enable
  223. #define CAN_IF1MCTL_TXRQST 0x00000100 // Transmit Request
  224. #define CAN_IF1MCTL_EOB 0x00000080 // End of Buffer
  225. #define CAN_IF1MCTL_DLC_M 0x0000000F // Data Length Code
  226. #define CAN_IF1MCTL_DLC_S 0
  227. //*****************************************************************************
  228. //
  229. // The following are defines for the bit fields in the CAN_O_IF1DA1 register.
  230. //
  231. //*****************************************************************************
  232. #define CAN_IF1DA1_DATA_M 0x0000FFFF // Data
  233. #define CAN_IF1DA1_DATA_S 0
  234. //*****************************************************************************
  235. //
  236. // The following are defines for the bit fields in the CAN_O_IF1DA2 register.
  237. //
  238. //*****************************************************************************
  239. #define CAN_IF1DA2_DATA_M 0x0000FFFF // Data
  240. #define CAN_IF1DA2_DATA_S 0
  241. //*****************************************************************************
  242. //
  243. // The following are defines for the bit fields in the CAN_O_IF1DB1 register.
  244. //
  245. //*****************************************************************************
  246. #define CAN_IF1DB1_DATA_M 0x0000FFFF // Data
  247. #define CAN_IF1DB1_DATA_S 0
  248. //*****************************************************************************
  249. //
  250. // The following are defines for the bit fields in the CAN_O_IF1DB2 register.
  251. //
  252. //*****************************************************************************
  253. #define CAN_IF1DB2_DATA_M 0x0000FFFF // Data
  254. #define CAN_IF1DB2_DATA_S 0
  255. //*****************************************************************************
  256. //
  257. // The following are defines for the bit fields in the CAN_O_IF2CRQ register.
  258. //
  259. //*****************************************************************************
  260. #define CAN_IF2CRQ_BUSY 0x00008000 // Busy Flag
  261. #define CAN_IF2CRQ_MNUM_M 0x0000003F // Message Number
  262. #define CAN_IF2CRQ_MNUM_RSVD 0x00000000 // 0 is not a valid message number;
  263. // it is interpreted as 0x20, or
  264. // object 32
  265. #define CAN_IF2CRQ_MNUM_S 0
  266. //*****************************************************************************
  267. //
  268. // The following are defines for the bit fields in the CAN_O_IF2CMSK register.
  269. //
  270. //*****************************************************************************
  271. #define CAN_IF2CMSK_WRNRD 0x00000080 // Write, Not Read
  272. #define CAN_IF2CMSK_MASK 0x00000040 // Access Mask Bits
  273. #define CAN_IF2CMSK_ARB 0x00000020 // Access Arbitration Bits
  274. #define CAN_IF2CMSK_CONTROL 0x00000010 // Access Control Bits
  275. #define CAN_IF2CMSK_CLRINTPND 0x00000008 // Clear Interrupt Pending Bit
  276. #define CAN_IF2CMSK_NEWDAT 0x00000004 // Access New Data
  277. #define CAN_IF2CMSK_TXRQST 0x00000004 // Access Transmission Request
  278. #define CAN_IF2CMSK_DATAA 0x00000002 // Access Data Byte 0 to 3
  279. #define CAN_IF2CMSK_DATAB 0x00000001 // Access Data Byte 4 to 7
  280. //*****************************************************************************
  281. //
  282. // The following are defines for the bit fields in the CAN_O_IF2MSK1 register.
  283. //
  284. //*****************************************************************************
  285. #define CAN_IF2MSK1_IDMSK_M 0x0000FFFF // Identifier Mask
  286. #define CAN_IF2MSK1_IDMSK_S 0
  287. //*****************************************************************************
  288. //
  289. // The following are defines for the bit fields in the CAN_O_IF2MSK2 register.
  290. //
  291. //*****************************************************************************
  292. #define CAN_IF2MSK2_MXTD 0x00008000 // Mask Extended Identifier
  293. #define CAN_IF2MSK2_MDIR 0x00004000 // Mask Message Direction
  294. #define CAN_IF2MSK2_IDMSK_M 0x00001FFF // Identifier Mask
  295. #define CAN_IF2MSK2_IDMSK_S 0
  296. //*****************************************************************************
  297. //
  298. // The following are defines for the bit fields in the CAN_O_IF2ARB1 register.
  299. //
  300. //*****************************************************************************
  301. #define CAN_IF2ARB1_ID_M 0x0000FFFF // Message Identifier
  302. #define CAN_IF2ARB1_ID_S 0
  303. //*****************************************************************************
  304. //
  305. // The following are defines for the bit fields in the CAN_O_IF2ARB2 register.
  306. //
  307. //*****************************************************************************
  308. #define CAN_IF2ARB2_MSGVAL 0x00008000 // Message Valid
  309. #define CAN_IF2ARB2_XTD 0x00004000 // Extended Identifier
  310. #define CAN_IF2ARB2_DIR 0x00002000 // Message Direction
  311. #define CAN_IF2ARB2_ID_M 0x00001FFF // Message Identifier
  312. #define CAN_IF2ARB2_ID_S 0
  313. //*****************************************************************************
  314. //
  315. // The following are defines for the bit fields in the CAN_O_IF2MCTL register.
  316. //
  317. //*****************************************************************************
  318. #define CAN_IF2MCTL_NEWDAT 0x00008000 // New Data
  319. #define CAN_IF2MCTL_MSGLST 0x00004000 // Message Lost
  320. #define CAN_IF2MCTL_INTPND 0x00002000 // Interrupt Pending
  321. #define CAN_IF2MCTL_UMASK 0x00001000 // Use Acceptance Mask
  322. #define CAN_IF2MCTL_TXIE 0x00000800 // Transmit Interrupt Enable
  323. #define CAN_IF2MCTL_RXIE 0x00000400 // Receive Interrupt Enable
  324. #define CAN_IF2MCTL_RMTEN 0x00000200 // Remote Enable
  325. #define CAN_IF2MCTL_TXRQST 0x00000100 // Transmit Request
  326. #define CAN_IF2MCTL_EOB 0x00000080 // End of Buffer
  327. #define CAN_IF2MCTL_DLC_M 0x0000000F // Data Length Code
  328. #define CAN_IF2MCTL_DLC_S 0
  329. //*****************************************************************************
  330. //
  331. // The following are defines for the bit fields in the CAN_O_IF2DA1 register.
  332. //
  333. //*****************************************************************************
  334. #define CAN_IF2DA1_DATA_M 0x0000FFFF // Data
  335. #define CAN_IF2DA1_DATA_S 0
  336. //*****************************************************************************
  337. //
  338. // The following are defines for the bit fields in the CAN_O_IF2DA2 register.
  339. //
  340. //*****************************************************************************
  341. #define CAN_IF2DA2_DATA_M 0x0000FFFF // Data
  342. #define CAN_IF2DA2_DATA_S 0
  343. //*****************************************************************************
  344. //
  345. // The following are defines for the bit fields in the CAN_O_IF2DB1 register.
  346. //
  347. //*****************************************************************************
  348. #define CAN_IF2DB1_DATA_M 0x0000FFFF // Data
  349. #define CAN_IF2DB1_DATA_S 0
  350. //*****************************************************************************
  351. //
  352. // The following are defines for the bit fields in the CAN_O_IF2DB2 register.
  353. //
  354. //*****************************************************************************
  355. #define CAN_IF2DB2_DATA_M 0x0000FFFF // Data
  356. #define CAN_IF2DB2_DATA_S 0
  357. //*****************************************************************************
  358. //
  359. // The following are defines for the bit fields in the CAN_O_TXRQ1 register.
  360. //
  361. //*****************************************************************************
  362. #define CAN_TXRQ1_TXRQST_M 0x0000FFFF // Transmission Request Bits
  363. #define CAN_TXRQ1_TXRQST_S 0
  364. //*****************************************************************************
  365. //
  366. // The following are defines for the bit fields in the CAN_O_TXRQ2 register.
  367. //
  368. //*****************************************************************************
  369. #define CAN_TXRQ2_TXRQST_M 0x0000FFFF // Transmission Request Bits
  370. #define CAN_TXRQ2_TXRQST_S 0
  371. //*****************************************************************************
  372. //
  373. // The following are defines for the bit fields in the CAN_O_NWDA1 register.
  374. //
  375. //*****************************************************************************
  376. #define CAN_NWDA1_NEWDAT_M 0x0000FFFF // New Data Bits
  377. #define CAN_NWDA1_NEWDAT_S 0
  378. //*****************************************************************************
  379. //
  380. // The following are defines for the bit fields in the CAN_O_NWDA2 register.
  381. //
  382. //*****************************************************************************
  383. #define CAN_NWDA2_NEWDAT_M 0x0000FFFF // New Data Bits
  384. #define CAN_NWDA2_NEWDAT_S 0
  385. //*****************************************************************************
  386. //
  387. // The following are defines for the bit fields in the CAN_O_MSG1INT register.
  388. //
  389. //*****************************************************************************
  390. #define CAN_MSG1INT_INTPND_M 0x0000FFFF // Interrupt Pending Bits
  391. #define CAN_MSG1INT_INTPND_S 0
  392. //*****************************************************************************
  393. //
  394. // The following are defines for the bit fields in the CAN_O_MSG2INT register.
  395. //
  396. //*****************************************************************************
  397. #define CAN_MSG2INT_INTPND_M 0x0000FFFF // Interrupt Pending Bits
  398. #define CAN_MSG2INT_INTPND_S 0
  399. //*****************************************************************************
  400. //
  401. // The following are defines for the bit fields in the CAN_O_MSG1VAL register.
  402. //
  403. //*****************************************************************************
  404. #define CAN_MSG1VAL_MSGVAL_M 0x0000FFFF // Message Valid Bits
  405. #define CAN_MSG1VAL_MSGVAL_S 0
  406. //*****************************************************************************
  407. //
  408. // The following are defines for the bit fields in the CAN_O_MSG2VAL register.
  409. //
  410. //*****************************************************************************
  411. #define CAN_MSG2VAL_MSGVAL_M 0x0000FFFF // Message Valid Bits
  412. #define CAN_MSG2VAL_MSGVAL_S 0
  413. //*****************************************************************************
  414. //
  415. // The following definitions are deprecated.
  416. //
  417. //*****************************************************************************
  418. #ifndef DEPRECATED
  419. //*****************************************************************************
  420. //
  421. // The following are deprecated defines for the CAN register offsets.
  422. //
  423. //*****************************************************************************
  424. #define CAN_O_MSGINT1 0x00000140 // Intr. Pending in Msg Obj 1 reg
  425. #define CAN_O_MSGINT2 0x00000144 // Intr. Pending in Msg Obj 2 reg
  426. #define CAN_O_MSGVAL1 0x00000160 // Message Valid in Msg Obj 1 reg
  427. #define CAN_O_MSGVAL2 0x00000164 // Message Valid in Msg Obj 2 reg
  428. //*****************************************************************************
  429. //
  430. // The following are deprecated defines for the bit fields in the CAN_O_STS
  431. // register.
  432. //
  433. //*****************************************************************************
  434. #define CAN_STS_LEC_MSK 0x00000007 // Last Error Code
  435. //*****************************************************************************
  436. //
  437. // The following are deprecated defines for the bit fields in the CAN_O_ERR
  438. // register.
  439. //
  440. //*****************************************************************************
  441. #define CAN_ERR_REC_MASK 0x00007F00 // Receive error counter status
  442. #define CAN_ERR_TEC_MASK 0x000000FF // Transmit error counter status
  443. #define CAN_ERR_REC_SHIFT 8 // Receive error counter bit pos
  444. #define CAN_ERR_TEC_SHIFT 0 // Transmit error counter bit pos
  445. //*****************************************************************************
  446. //
  447. // The following are deprecated defines for the bit fields in the CAN_O_BIT
  448. // register.
  449. //
  450. //*****************************************************************************
  451. #define CAN_BIT_TSEG2 0x00007000 // Time segment after sample point
  452. #define CAN_BIT_TSEG1 0x00000F00 // Time segment before sample point
  453. #define CAN_BIT_SJW 0x000000C0 // (Re)Synchronization jump width
  454. #define CAN_BIT_BRP 0x0000003F // Baud rate prescaler
  455. //*****************************************************************************
  456. //
  457. // The following are deprecated defines for the bit fields in the CAN_O_INT
  458. // register.
  459. //
  460. //*****************************************************************************
  461. #define CAN_INT_INTID_MSK 0x0000FFFF // Interrupt Identifier
  462. //*****************************************************************************
  463. //
  464. // The following are deprecated defines for the bit fields in the CAN_O_TST
  465. // register.
  466. //
  467. //*****************************************************************************
  468. #define CAN_TST_TX_MSK 0x00000060 // Overide control of CAN_TX pin
  469. //*****************************************************************************
  470. //
  471. // The following are deprecated defines for the bit fields in the CAN_O_BRPE
  472. // register.
  473. //
  474. //*****************************************************************************
  475. #define CAN_BRPE_BRPE 0x0000000F // Baud rate prescaler extension
  476. //*****************************************************************************
  477. //
  478. // The following are deprecated defines for the bit fields in the CAN_O_TXRQ1
  479. // register.
  480. //
  481. //*****************************************************************************
  482. #define CAN_TXRQ1_TXRQST 0x0000FFFF // Transmission Request Bits
  483. //*****************************************************************************
  484. //
  485. // The following are deprecated defines for the bit fields in the CAN_O_TXRQ2
  486. // register.
  487. //
  488. //*****************************************************************************
  489. #define CAN_TXRQ2_TXRQST 0x0000FFFF // Transmission Request Bits
  490. //*****************************************************************************
  491. //
  492. // The following are deprecated defines for the bit fields in the CAN_O_NWDA1
  493. // register.
  494. //
  495. //*****************************************************************************
  496. #define CAN_NWDA1_NEWDATA 0x0000FFFF // New Data Bits
  497. //*****************************************************************************
  498. //
  499. // The following are deprecated defines for the bit fields in the CAN_O_NWDA2
  500. // register.
  501. //
  502. //*****************************************************************************
  503. #define CAN_NWDA2_NEWDATA 0x0000FFFF // New Data Bits
  504. //*****************************************************************************
  505. //
  506. // The following are deprecated defines for the bit fields in the CAN_O_MSGINT1
  507. // register.
  508. //
  509. //*****************************************************************************
  510. #define CAN_MSGINT1_INTPND 0x0000FFFF // Interrupt Pending Bits
  511. //*****************************************************************************
  512. //
  513. // The following are deprecated defines for the bit fields in the CAN_O_MSGINT2
  514. // register.
  515. //
  516. //*****************************************************************************
  517. #define CAN_MSGINT2_INTPND 0x0000FFFF // Interrupt Pending Bits
  518. //*****************************************************************************
  519. //
  520. // The following are deprecated defines for the bit fields in the CAN_O_MSGVAL1
  521. // register.
  522. //
  523. //*****************************************************************************
  524. #define CAN_MSGVAL1_MSGVAL 0x0000FFFF // Message Valid Bits
  525. //*****************************************************************************
  526. //
  527. // The following are deprecated defines for the bit fields in the CAN_O_MSGVAL2
  528. // register.
  529. //
  530. //*****************************************************************************
  531. #define CAN_MSGVAL2_MSGVAL 0x0000FFFF // Message Valid Bits
  532. //*****************************************************************************
  533. //
  534. // The following are deprecated defines for the reset values of the can
  535. // registers.
  536. //
  537. //*****************************************************************************
  538. #define CAN_RV_IF1MSK2 0x0000FFFF
  539. #define CAN_RV_IF1MSK1 0x0000FFFF
  540. #define CAN_RV_IF2MSK1 0x0000FFFF
  541. #define CAN_RV_IF2MSK2 0x0000FFFF
  542. #define CAN_RV_BIT 0x00002301
  543. #define CAN_RV_CTL 0x00000001
  544. #define CAN_RV_IF1CRQ 0x00000001
  545. #define CAN_RV_IF2CRQ 0x00000001
  546. #define CAN_RV_TXRQ2 0x00000000
  547. #define CAN_RV_IF2DB1 0x00000000
  548. #define CAN_RV_INT 0x00000000
  549. #define CAN_RV_IF1DB2 0x00000000
  550. #define CAN_RV_BRPE 0x00000000
  551. #define CAN_RV_IF2DA2 0x00000000
  552. #define CAN_RV_MSGVAL2 0x00000000
  553. #define CAN_RV_TXRQ1 0x00000000
  554. #define CAN_RV_IF1MCTL 0x00000000
  555. #define CAN_RV_IF1DB1 0x00000000
  556. #define CAN_RV_STS 0x00000000
  557. #define CAN_RV_MSGINT1 0x00000000
  558. #define CAN_RV_IF1DA2 0x00000000
  559. #define CAN_RV_TST 0x00000000
  560. #define CAN_RV_IF1ARB1 0x00000000
  561. #define CAN_RV_IF1ARB2 0x00000000
  562. #define CAN_RV_NWDA2 0x00000000
  563. #define CAN_RV_IF2CMSK 0x00000000
  564. #define CAN_RV_NWDA1 0x00000000
  565. #define CAN_RV_IF1DA1 0x00000000
  566. #define CAN_RV_IF2DA1 0x00000000
  567. #define CAN_RV_IF2MCTL 0x00000000
  568. #define CAN_RV_MSGVAL1 0x00000000
  569. #define CAN_RV_IF1CMSK 0x00000000
  570. #define CAN_RV_ERR 0x00000000
  571. #define CAN_RV_IF2ARB2 0x00000000
  572. #define CAN_RV_MSGINT2 0x00000000
  573. #define CAN_RV_IF2ARB1 0x00000000
  574. #define CAN_RV_IF2DB2 0x00000000
  575. //*****************************************************************************
  576. //
  577. // The following are deprecated defines for the bit fields in the CAN_IF1CRQ
  578. // and CAN_IF1CRQ registers.
  579. // Note: All bits may not be available in all registers.
  580. //
  581. //*****************************************************************************
  582. #define CAN_IFCRQ_BUSY 0x00008000 // Busy flag status
  583. #define CAN_IFCRQ_MNUM_MSK 0x0000003F // Message Number
  584. //*****************************************************************************
  585. //
  586. // The following are deprecated defines for the bit fields in the CAN_IF1CMSK
  587. // and CAN_IF2CMSK registers.
  588. // Note: All bits may not be available in all registers.
  589. //
  590. //*****************************************************************************
  591. #define CAN_IFCMSK_WRNRD 0x00000080 // Write, not Read
  592. #define CAN_IFCMSK_MASK 0x00000040 // Access Mask Bits
  593. #define CAN_IFCMSK_ARB 0x00000020 // Access Arbitration Bits
  594. #define CAN_IFCMSK_CONTROL 0x00000010 // Access Control Bits
  595. #define CAN_IFCMSK_CLRINTPND 0x00000008 // Clear interrupt pending Bit
  596. #define CAN_IFCMSK_TXRQST 0x00000004 // Access Tx request bit (WRNRD=1)
  597. #define CAN_IFCMSK_NEWDAT 0x00000004 // Access New Data bit (WRNRD=0)
  598. #define CAN_IFCMSK_DATAA 0x00000002 // DataA access - bytes 0 to 3
  599. #define CAN_IFCMSK_DATAB 0x00000001 // DataB access - bytes 4 to 7
  600. //*****************************************************************************
  601. //
  602. // The following are deprecated defines for the bit fields in the CAN_IF1MSK1
  603. // and CAN_IF2MSK1 registers.
  604. // Note: All bits may not be available in all registers.
  605. //
  606. //*****************************************************************************
  607. #define CAN_IFMSK1_MSK 0x0000FFFF // Identifier Mask
  608. //*****************************************************************************
  609. //
  610. // The following are deprecated defines for the bit fields in the CAN_IF1MSK2
  611. // and CAN_IF2MSK2 registers.
  612. // Note: All bits may not be available in all registers.
  613. //
  614. //*****************************************************************************
  615. #define CAN_IFMSK2_MXTD 0x00008000 // Mask extended identifier
  616. #define CAN_IFMSK2_MDIR 0x00004000 // Mask message direction
  617. #define CAN_IFMSK2_MSK 0x00001FFF // Mask identifier
  618. //*****************************************************************************
  619. //
  620. // The following are deprecated defines for the bit fields in the CAN_IF1ARB1
  621. // and CAN_IF2ARB1 registers.
  622. // Note: All bits may not be available in all registers.
  623. //
  624. //*****************************************************************************
  625. #define CAN_IFARB1_ID 0x0000FFFF // Identifier
  626. //*****************************************************************************
  627. //
  628. // The following are deprecated defines for the bit fields in the CAN_IF1ARB2
  629. // and CAN_IF2ARB2 registers.
  630. // Note: All bits may not be available in all registers.
  631. //
  632. //*****************************************************************************
  633. #define CAN_IFARB2_MSGVAL 0x00008000 // Message valid
  634. #define CAN_IFARB2_XTD 0x00004000 // Extended identifier
  635. #define CAN_IFARB2_DIR 0x00002000 // Message direction
  636. #define CAN_IFARB2_ID 0x00001FFF // Message identifier
  637. //*****************************************************************************
  638. //
  639. // The following are deprecated defines for the bit fields in the CAN_IF1MCTL
  640. // and CAN_IF2MCTL registers.
  641. // Note: All bits may not be available in all registers.
  642. //
  643. //*****************************************************************************
  644. #define CAN_IFMCTL_NEWDAT 0x00008000 // New Data
  645. #define CAN_IFMCTL_MSGLST 0x00004000 // Message lost
  646. #define CAN_IFMCTL_INTPND 0x00002000 // Interrupt pending
  647. #define CAN_IFMCTL_UMASK 0x00001000 // Use acceptance mask
  648. #define CAN_IFMCTL_TXIE 0x00000800 // Transmit interrupt enable
  649. #define CAN_IFMCTL_RXIE 0x00000400 // Receive interrupt enable
  650. #define CAN_IFMCTL_RMTEN 0x00000200 // Remote enable
  651. #define CAN_IFMCTL_TXRQST 0x00000100 // Transmit request
  652. #define CAN_IFMCTL_EOB 0x00000080 // End of buffer
  653. #define CAN_IFMCTL_DLC 0x0000000F // Data length code
  654. //*****************************************************************************
  655. //
  656. // The following are deprecated defines for the bit fields in the CAN_IF1DA1
  657. // and CAN_IF2DA1 registers.
  658. // Note: All bits may not be available in all registers.
  659. //
  660. //*****************************************************************************
  661. #define CAN_IFDA1_DATA 0x0000FFFF // Data - bytes 1 and 0
  662. //*****************************************************************************
  663. //
  664. // The following are deprecated defines for the bit fields in the CAN_IF1DA2
  665. // and CAN_IF2DA2 registers.
  666. // Note: All bits may not be available in all registers.
  667. //
  668. //*****************************************************************************
  669. #define CAN_IFDA2_DATA 0x0000FFFF // Data - bytes 3 and 2
  670. //*****************************************************************************
  671. //
  672. // The following are deprecated defines for the bit fields in the CAN_IF1DB1
  673. // and CAN_IF2DB1 registers.
  674. // Note: All bits may not be available in all registers.
  675. //
  676. //*****************************************************************************
  677. #define CAN_IFDB1_DATA 0x0000FFFF // Data - bytes 5 and 4
  678. //*****************************************************************************
  679. //
  680. // The following are deprecated defines for the bit fields in the CAN_IF1DB2
  681. // and CAN_IF2DB2 registers.
  682. // Note: All bits may not be available in all registers.
  683. //
  684. //*****************************************************************************
  685. #define CAN_IFDB2_DATA 0x0000FFFF // Data - bytes 7 and 6
  686. #endif
  687. #endif // __HW_CAN_H__