Driver_CAN.h 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384
  1. /*
  2. * Copyright (c) 2015-2020 ARM Limited. All rights reserved.
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Licensed under the Apache License, Version 2.0 (the License); you may
  7. * not use this file except in compliance with the License.
  8. * You may obtain a copy of the License at
  9. *
  10. * www.apache.org/licenses/LICENSE-2.0
  11. *
  12. * Unless required by applicable law or agreed to in writing, software
  13. * distributed under the License is distributed on an AS IS BASIS, WITHOUT
  14. * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. * See the License for the specific language governing permissions and
  16. * limitations under the License.
  17. *
  18. * $Date: 24. January 2020
  19. * $Revision: V1.3
  20. *
  21. * Project: CAN (Controller Area Network) Driver definitions
  22. */
  23. /* History:
  24. * Version 1.3
  25. * Removed volatile from ARM_CAN_STATUS
  26. * Version 1.2
  27. * Added ARM_CAN_UNIT_STATE_BUS_OFF unit state and
  28. * ARM_CAN_EVENT_UNIT_INACTIVE unit event
  29. * Version 1.1
  30. * ARM_CAN_STATUS made volatile
  31. * Version 1.0
  32. * Initial release
  33. */
  34. #ifndef DRIVER_CAN_H_
  35. #define DRIVER_CAN_H_
  36. #ifdef __cplusplus
  37. extern "C"
  38. {
  39. #endif
  40. #include "Driver_Common.h"
  41. #define ARM_CAN_API_VERSION ARM_DRIVER_VERSION_MAJOR_MINOR(1,3) /* API version */
  42. /****** CAN Bitrate selection codes *****/
  43. typedef enum _ARM_CAN_BITRATE_SELECT {
  44. ARM_CAN_BITRATE_NOMINAL, ///< Select nominal (flexible data-rate arbitration) bitrate
  45. ARM_CAN_BITRATE_FD_DATA ///< Select flexible data-rate data bitrate
  46. } ARM_CAN_BITRATE_SELECT;
  47. /****** CAN Bit Propagation Segment codes (PROP_SEG) *****/
  48. #define ARM_CAN_BIT_PROP_SEG_Pos 0UL ///< bits 7..0
  49. #define ARM_CAN_BIT_PROP_SEG_Msk (0xFFUL << ARM_CAN_BIT_PROP_SEG_Pos)
  50. #define ARM_CAN_BIT_PROP_SEG(x) (((x) << ARM_CAN_BIT_PROP_SEG_Pos) & ARM_CAN_BIT_PROP_SEG_Msk)
  51. /****** CAN Bit Phase Buffer Segment 1 (PHASE_SEG1) codes *****/
  52. #define ARM_CAN_BIT_PHASE_SEG1_Pos 8UL ///< bits 15..8
  53. #define ARM_CAN_BIT_PHASE_SEG1_Msk (0xFFUL << ARM_CAN_BIT_PHASE_SEG1_Pos)
  54. #define ARM_CAN_BIT_PHASE_SEG1(x) (((x) << ARM_CAN_BIT_PHASE_SEG1_Pos) & ARM_CAN_BIT_PHASE_SEG1_Msk)
  55. /****** CAN Bit Phase Buffer Segment 2 (PHASE_SEG2) codes *****/
  56. #define ARM_CAN_BIT_PHASE_SEG2_Pos 16UL ///< bits 23..16
  57. #define ARM_CAN_BIT_PHASE_SEG2_Msk (0xFFUL << ARM_CAN_BIT_PHASE_SEG2_Pos)
  58. #define ARM_CAN_BIT_PHASE_SEG2(x) (((x) << ARM_CAN_BIT_PHASE_SEG2_Pos) & ARM_CAN_BIT_PHASE_SEG2_Msk)
  59. /****** CAN Bit (Re)Synchronization Jump Width Segment (SJW) *****/
  60. #define ARM_CAN_BIT_SJW_Pos 24UL ///< bits 28..24
  61. #define ARM_CAN_BIT_SJW_Msk (0x1FUL << ARM_CAN_BIT_SJW_Pos)
  62. #define ARM_CAN_BIT_SJW(x) (((x) << ARM_CAN_BIT_SJW_Pos) & ARM_CAN_BIT_SJW_Msk)
  63. /****** CAN Mode codes *****/
  64. typedef enum _ARM_CAN_MODE {
  65. ARM_CAN_MODE_INITIALIZATION, ///< Initialization mode
  66. ARM_CAN_MODE_NORMAL, ///< Normal operation mode
  67. ARM_CAN_MODE_RESTRICTED, ///< Restricted operation mode
  68. ARM_CAN_MODE_MONITOR, ///< Bus monitoring mode
  69. ARM_CAN_MODE_LOOPBACK_INTERNAL, ///< Loopback internal mode
  70. ARM_CAN_MODE_LOOPBACK_EXTERNAL ///< Loopback external mode
  71. } ARM_CAN_MODE;
  72. /****** CAN Filter Operation codes *****/
  73. typedef enum _ARM_CAN_FILTER_OPERATION {
  74. ARM_CAN_FILTER_ID_EXACT_ADD, ///< Add exact id filter
  75. ARM_CAN_FILTER_ID_EXACT_REMOVE, ///< Remove exact id filter
  76. ARM_CAN_FILTER_ID_RANGE_ADD, ///< Add range id filter
  77. ARM_CAN_FILTER_ID_RANGE_REMOVE, ///< Remove range id filter
  78. ARM_CAN_FILTER_ID_MASKABLE_ADD, ///< Add maskable id filter
  79. ARM_CAN_FILTER_ID_MASKABLE_REMOVE ///< Remove maskable id filter
  80. } ARM_CAN_FILTER_OPERATION;
  81. /****** CAN Object Configuration codes *****/
  82. typedef enum _ARM_CAN_OBJ_CONFIG {
  83. ARM_CAN_OBJ_INACTIVE, ///< CAN object inactive
  84. ARM_CAN_OBJ_TX, ///< CAN transmit object
  85. ARM_CAN_OBJ_RX, ///< CAN receive object
  86. ARM_CAN_OBJ_RX_RTR_TX_DATA, ///< CAN object that on RTR reception automatically transmits Data Frame
  87. ARM_CAN_OBJ_TX_RTR_RX_DATA ///< CAN object that transmits RTR and automatically receives Data Frame
  88. } ARM_CAN_OBJ_CONFIG;
  89. /**
  90. \brief CAN Object Capabilities
  91. */
  92. typedef struct _ARM_CAN_OBJ_CAPABILITIES {
  93. uint32_t tx : 1; ///< Object supports transmission
  94. uint32_t rx : 1; ///< Object supports reception
  95. uint32_t rx_rtr_tx_data : 1; ///< Object supports RTR reception and automatic Data Frame transmission
  96. uint32_t tx_rtr_rx_data : 1; ///< Object supports RTR transmission and automatic Data Frame reception
  97. uint32_t multiple_filters : 1; ///< Object allows assignment of multiple filters to it
  98. uint32_t exact_filtering : 1; ///< Object supports exact identifier filtering
  99. uint32_t range_filtering : 1; ///< Object supports range identifier filtering
  100. uint32_t mask_filtering : 1; ///< Object supports mask identifier filtering
  101. uint32_t message_depth : 8; ///< Number of messages buffers (FIFO) for that object
  102. uint32_t reserved : 16; ///< Reserved (must be zero)
  103. } ARM_CAN_OBJ_CAPABILITIES;
  104. /****** CAN Control Function Operation codes *****/
  105. #define ARM_CAN_CONTROL_Pos 0UL
  106. #define ARM_CAN_CONTROL_Msk (0xFFUL << ARM_CAN_CONTROL_Pos)
  107. #define ARM_CAN_SET_FD_MODE (1UL << ARM_CAN_CONTROL_Pos) ///< Set FD operation mode; arg: 0 = disable, 1 = enable
  108. #define ARM_CAN_ABORT_MESSAGE_SEND (2UL << ARM_CAN_CONTROL_Pos) ///< Abort sending of CAN message; arg = object
  109. #define ARM_CAN_CONTROL_RETRANSMISSION (3UL << ARM_CAN_CONTROL_Pos) ///< Enable/disable automatic retransmission; arg: 0 = disable, 1 = enable (default state)
  110. #define ARM_CAN_SET_TRANSCEIVER_DELAY (4UL << ARM_CAN_CONTROL_Pos) ///< Set transceiver delay; arg = delay in time quanta
  111. /****** CAN ID Frame Format codes *****/
  112. #define ARM_CAN_ID_IDE_Pos 31UL
  113. #define ARM_CAN_ID_IDE_Msk (1UL << ARM_CAN_ID_IDE_Pos)
  114. /****** CAN Identifier encoding *****/
  115. #define ARM_CAN_STANDARD_ID(id) (id & 0x000007FFUL) ///< CAN identifier in standard format (11-bits)
  116. #define ARM_CAN_EXTENDED_ID(id) ((id & 0x1FFFFFFFUL) | ARM_CAN_ID_IDE_Msk)///< CAN identifier in extended format (29-bits)
  117. /**
  118. \brief CAN Message Information
  119. */
  120. typedef struct _ARM_CAN_MSG_INFO {
  121. uint32_t id; ///< CAN identifier with frame format specifier (bit 31)
  122. uint32_t rtr : 1; ///< Remote transmission request frame
  123. uint32_t edl : 1; ///< Flexible data-rate format extended data length
  124. uint32_t brs : 1; ///< Flexible data-rate format with bitrate switch
  125. uint32_t esi : 1; ///< Flexible data-rate format error state indicator
  126. uint32_t dlc : 4; ///< Data length code
  127. uint32_t reserved : 24;
  128. } ARM_CAN_MSG_INFO;
  129. /****** CAN specific error code *****/
  130. #define ARM_CAN_INVALID_BITRATE_SELECT (ARM_DRIVER_ERROR_SPECIFIC - 1) ///< Bitrate selection not supported
  131. #define ARM_CAN_INVALID_BITRATE (ARM_DRIVER_ERROR_SPECIFIC - 2) ///< Requested bitrate not supported
  132. #define ARM_CAN_INVALID_BIT_PROP_SEG (ARM_DRIVER_ERROR_SPECIFIC - 3) ///< Propagation segment value not supported
  133. #define ARM_CAN_INVALID_BIT_PHASE_SEG1 (ARM_DRIVER_ERROR_SPECIFIC - 4) ///< Phase segment 1 value not supported
  134. #define ARM_CAN_INVALID_BIT_PHASE_SEG2 (ARM_DRIVER_ERROR_SPECIFIC - 5) ///< Phase segment 2 value not supported
  135. #define ARM_CAN_INVALID_BIT_SJW (ARM_DRIVER_ERROR_SPECIFIC - 6) ///< SJW value not supported
  136. #define ARM_CAN_NO_MESSAGE_AVAILABLE (ARM_DRIVER_ERROR_SPECIFIC - 7) ///< Message is not available
  137. /****** CAN Status codes *****/
  138. #define ARM_CAN_UNIT_STATE_INACTIVE (0U) ///< Unit state: Not active on bus (initialization)
  139. #define ARM_CAN_UNIT_STATE_ACTIVE (1U) ///< Unit state: Active on bus (can generate active error frame)
  140. #define ARM_CAN_UNIT_STATE_PASSIVE (2U) ///< Unit state: Error passive (can not generate active error frame)
  141. #define ARM_CAN_UNIT_STATE_BUS_OFF (3U) ///< Unit state: Bus-off (can recover to active state)
  142. #define ARM_CAN_LEC_NO_ERROR (0U) ///< Last error code: No error
  143. #define ARM_CAN_LEC_BIT_ERROR (1U) ///< Last error code: Bit error
  144. #define ARM_CAN_LEC_STUFF_ERROR (2U) ///< Last error code: Bit stuffing error
  145. #define ARM_CAN_LEC_CRC_ERROR (3U) ///< Last error code: CRC error
  146. #define ARM_CAN_LEC_FORM_ERROR (4U) ///< Last error code: Illegal fixed-form bit
  147. #define ARM_CAN_LEC_ACK_ERROR (5U) ///< Last error code: Acknowledgment error
  148. /**
  149. \brief CAN Status
  150. */
  151. typedef struct _ARM_CAN_STATUS {
  152. uint32_t unit_state : 4; ///< Unit bus state
  153. uint32_t last_error_code : 4; ///< Last error code
  154. uint32_t tx_error_count : 8; ///< Transmitter error count
  155. uint32_t rx_error_count : 8; ///< Receiver error count
  156. uint32_t reserved : 8;
  157. } ARM_CAN_STATUS;
  158. /****** CAN Unit Event *****/
  159. #define ARM_CAN_EVENT_UNIT_INACTIVE (0U) ///< Unit entered Inactive state
  160. #define ARM_CAN_EVENT_UNIT_ACTIVE (1U) ///< Unit entered Error Active state
  161. #define ARM_CAN_EVENT_UNIT_WARNING (2U) ///< Unit entered Error Warning state (one or both error counters >= 96)
  162. #define ARM_CAN_EVENT_UNIT_PASSIVE (3U) ///< Unit entered Error Passive state
  163. #define ARM_CAN_EVENT_UNIT_BUS_OFF (4U) ///< Unit entered Bus-off state
  164. /****** CAN Send/Receive Event *****/
  165. #define ARM_CAN_EVENT_SEND_COMPLETE (1UL << 0) ///< Send complete
  166. #define ARM_CAN_EVENT_RECEIVE (1UL << 1) ///< Message received
  167. #define ARM_CAN_EVENT_RECEIVE_OVERRUN (1UL << 2) ///< Received message overrun
  168. // Function documentation
  169. /**
  170. \fn ARM_DRIVER_VERSION ARM_CAN_GetVersion (void)
  171. \brief Get driver version.
  172. \return \ref ARM_DRIVER_VERSION
  173. \fn ARM_CAN_CAPABILITIES ARM_CAN_GetCapabilities (void)
  174. \brief Get driver capabilities.
  175. \return \ref ARM_CAN_CAPABILITIES
  176. \fn int32_t ARM_CAN_Initialize (ARM_CAN_SignalUnitEvent_t cb_unit_event,
  177. ARM_CAN_SignalObjectEvent_t cb_object_event)
  178. \brief Initialize CAN interface and register signal (callback) functions.
  179. \param[in] cb_unit_event Pointer to \ref ARM_CAN_SignalUnitEvent callback function
  180. \param[in] cb_object_event Pointer to \ref ARM_CAN_SignalObjectEvent callback function
  181. \return \ref execution_status
  182. \fn int32_t ARM_CAN_Uninitialize (void)
  183. \brief De-initialize CAN interface.
  184. \return \ref execution_status
  185. \fn int32_t ARM_CAN_PowerControl (ARM_POWER_STATE state)
  186. \brief Control CAN interface power.
  187. \param[in] state Power state
  188. - \ref ARM_POWER_OFF : power off: no operation possible
  189. - \ref ARM_POWER_LOW : low power mode: retain state, detect and signal wake-up events
  190. - \ref ARM_POWER_FULL : power on: full operation at maximum performance
  191. \return \ref execution_status
  192. \fn uint32_t ARM_CAN_GetClock (void)
  193. \brief Retrieve CAN base clock frequency.
  194. \return base clock frequency
  195. \fn int32_t ARM_CAN_SetBitrate (ARM_CAN_BITRATE_SELECT select, uint32_t bitrate, uint32_t bit_segments)
  196. \brief Set bitrate for CAN interface.
  197. \param[in] select Bitrate selection
  198. - \ref ARM_CAN_BITRATE_NOMINAL : nominal (flexible data-rate arbitration) bitrate
  199. - \ref ARM_CAN_BITRATE_FD_DATA : flexible data-rate data bitrate
  200. \param[in] bitrate Bitrate
  201. \param[in] bit_segments Bit segments settings
  202. - \ref ARM_CAN_BIT_PROP_SEG(x) : number of time quanta for propagation time segment
  203. - \ref ARM_CAN_BIT_PHASE_SEG1(x) : number of time quanta for phase buffer segment 1
  204. - \ref ARM_CAN_BIT_PHASE_SEG2(x) : number of time quanta for phase buffer Segment 2
  205. - \ref ARM_CAN_BIT_SJW(x) : number of time quanta for (re-)synchronization jump width
  206. \return \ref execution_status
  207. \fn int32_t ARM_CAN_SetMode (ARM_CAN_MODE mode)
  208. \brief Set operating mode for CAN interface.
  209. \param[in] mode Operating mode
  210. - \ref ARM_CAN_MODE_INITIALIZATION : initialization mode
  211. - \ref ARM_CAN_MODE_NORMAL : normal operation mode
  212. - \ref ARM_CAN_MODE_RESTRICTED : restricted operation mode
  213. - \ref ARM_CAN_MODE_MONITOR : bus monitoring mode
  214. - \ref ARM_CAN_MODE_LOOPBACK_INTERNAL : loopback internal mode
  215. - \ref ARM_CAN_MODE_LOOPBACK_EXTERNAL : loopback external mode
  216. \return \ref execution_status
  217. \fn ARM_CAN_OBJ_CAPABILITIES ARM_CAN_ObjectGetCapabilities (uint32_t obj_idx)
  218. \brief Retrieve capabilities of an object.
  219. \param[in] obj_idx Object index
  220. \return \ref ARM_CAN_OBJ_CAPABILITIES
  221. \fn int32_t ARM_CAN_ObjectSetFilter (uint32_t obj_idx, ARM_CAN_FILTER_OPERATION operation, uint32_t id, uint32_t arg)
  222. \brief Add or remove filter for message reception.
  223. \param[in] obj_idx Object index of object that filter should be or is assigned to
  224. \param[in] operation Operation on filter
  225. - \ref ARM_CAN_FILTER_ID_EXACT_ADD : add exact id filter
  226. - \ref ARM_CAN_FILTER_ID_EXACT_REMOVE : remove exact id filter
  227. - \ref ARM_CAN_FILTER_ID_RANGE_ADD : add range id filter
  228. - \ref ARM_CAN_FILTER_ID_RANGE_REMOVE : remove range id filter
  229. - \ref ARM_CAN_FILTER_ID_MASKABLE_ADD : add maskable id filter
  230. - \ref ARM_CAN_FILTER_ID_MASKABLE_REMOVE : remove maskable id filter
  231. \param[in] id ID or start of ID range (depending on filter type)
  232. \param[in] arg Mask or end of ID range (depending on filter type)
  233. \return \ref execution_status
  234. \fn int32_t ARM_CAN_ObjectConfigure (uint32_t obj_idx, ARM_CAN_OBJ_CONFIG obj_cfg)
  235. \brief Configure object.
  236. \param[in] obj_idx Object index
  237. \param[in] obj_cfg Object configuration state
  238. - \ref ARM_CAN_OBJ_INACTIVE : deactivate object
  239. - \ref ARM_CAN_OBJ_RX : configure object for reception
  240. - \ref ARM_CAN_OBJ_TX : configure object for transmission
  241. - \ref ARM_CAN_OBJ_RX_RTR_TX_DATA : configure object that on RTR reception automatically transmits Data Frame
  242. - \ref ARM_CAN_OBJ_TX_RTR_RX_DATA : configure object that transmits RTR and automatically receives Data Frame
  243. \return \ref execution_status
  244. \fn int32_t ARM_CAN_MessageSend (uint32_t obj_idx, ARM_CAN_MSG_INFO *msg_info, const uint8_t *data, uint8_t size)
  245. \brief Send message on CAN bus.
  246. \param[in] obj_idx Object index
  247. \param[in] msg_info Pointer to CAN message information
  248. \param[in] data Pointer to data buffer
  249. \param[in] size Number of data bytes to send
  250. \return value >= 0 number of data bytes accepted to send
  251. \return value < 0 \ref execution_status
  252. \fn int32_t ARM_CAN_MessageRead (uint32_t obj_idx, ARM_CAN_MSG_INFO *msg_info, uint8_t *data, uint8_t size)
  253. \brief Read message received on CAN bus.
  254. \param[in] obj_idx Object index
  255. \param[out] msg_info Pointer to read CAN message information
  256. \param[out] data Pointer to data buffer for read data
  257. \param[in] size Maximum number of data bytes to read
  258. \return value >= 0 number of data bytes read
  259. \return value < 0 \ref execution_status
  260. \fn int32_t ARM_CAN_Control (uint32_t control, uint32_t arg)
  261. \brief Control CAN interface.
  262. \param[in] control Operation
  263. - \ref ARM_CAN_SET_FD_MODE : set FD operation mode
  264. - \ref ARM_CAN_ABORT_MESSAGE_SEND : abort sending of CAN message
  265. - \ref ARM_CAN_CONTROL_RETRANSMISSION : enable/disable automatic retransmission
  266. - \ref ARM_CAN_SET_TRANSCEIVER_DELAY : set transceiver delay
  267. \param[in] arg Argument of operation
  268. \return \ref execution_status
  269. \fn ARM_CAN_STATUS ARM_CAN_GetStatus (void)
  270. \brief Get CAN status.
  271. \return CAN status \ref ARM_CAN_STATUS
  272. \fn void ARM_CAN_SignalUnitEvent (uint32_t event)
  273. \brief Signal CAN unit event.
  274. \param[in] event \ref CAN_unit_events
  275. \return none
  276. \fn void ARM_CAN_SignalObjectEvent (uint32_t obj_idx, uint32_t event)
  277. \brief Signal CAN object event.
  278. \param[in] obj_idx Object index
  279. \param[in] event \ref CAN_events
  280. \return none
  281. */
  282. typedef void (*ARM_CAN_SignalUnitEvent_t) (uint32_t event); ///< Pointer to \ref ARM_CAN_SignalUnitEvent : Signal CAN Unit Event.
  283. typedef void (*ARM_CAN_SignalObjectEvent_t) (uint32_t obj_idx, uint32_t event); ///< Pointer to \ref ARM_CAN_SignalObjectEvent : Signal CAN Object Event.
  284. /**
  285. \brief CAN Device Driver Capabilities.
  286. */
  287. typedef struct _ARM_CAN_CAPABILITIES {
  288. uint32_t num_objects : 8; ///< Number of \ref can_objects available
  289. uint32_t reentrant_operation : 1; ///< Support for reentrant calls to \ref ARM_CAN_MessageSend, \ref ARM_CAN_MessageRead, \ref ARM_CAN_ObjectConfigure and abort message sending used by \ref ARM_CAN_Control
  290. uint32_t fd_mode : 1; ///< Support for CAN with flexible data-rate mode (CAN_FD) (set by \ref ARM_CAN_Control)
  291. uint32_t restricted_mode : 1; ///< Support for restricted operation mode (set by \ref ARM_CAN_SetMode)
  292. uint32_t monitor_mode : 1; ///< Support for bus monitoring mode (set by \ref ARM_CAN_SetMode)
  293. uint32_t internal_loopback : 1; ///< Support for internal loopback mode (set by \ref ARM_CAN_SetMode)
  294. uint32_t external_loopback : 1; ///< Support for external loopback mode (set by \ref ARM_CAN_SetMode)
  295. uint32_t reserved : 18; ///< Reserved (must be zero)
  296. } ARM_CAN_CAPABILITIES;
  297. /**
  298. \brief Access structure of the CAN Driver.
  299. */
  300. typedef struct _ARM_DRIVER_CAN {
  301. ARM_DRIVER_VERSION (*GetVersion) (void); ///< Pointer to \ref ARM_CAN_GetVersion : Get driver version.
  302. ARM_CAN_CAPABILITIES (*GetCapabilities) (void); ///< Pointer to \ref ARM_CAN_GetCapabilities : Get driver capabilities.
  303. int32_t (*Initialize) (ARM_CAN_SignalUnitEvent_t cb_unit_event,
  304. ARM_CAN_SignalObjectEvent_t cb_object_event); ///< Pointer to \ref ARM_CAN_Initialize : Initialize CAN interface.
  305. int32_t (*Uninitialize) (void); ///< Pointer to \ref ARM_CAN_Uninitialize : De-initialize CAN interface.
  306. int32_t (*PowerControl) (ARM_POWER_STATE state); ///< Pointer to \ref ARM_CAN_PowerControl : Control CAN interface power.
  307. uint32_t (*GetClock) (void); ///< Pointer to \ref ARM_CAN_GetClock : Retrieve CAN base clock frequency.
  308. int32_t (*SetBitrate) (ARM_CAN_BITRATE_SELECT select,
  309. uint32_t bitrate,
  310. uint32_t bit_segments); ///< Pointer to \ref ARM_CAN_SetBitrate : Set bitrate for CAN interface.
  311. int32_t (*SetMode) (ARM_CAN_MODE mode); ///< Pointer to \ref ARM_CAN_SetMode : Set operating mode for CAN interface.
  312. ARM_CAN_OBJ_CAPABILITIES (*ObjectGetCapabilities) (uint32_t obj_idx); ///< Pointer to \ref ARM_CAN_ObjectGetCapabilities : Retrieve capabilities of an object.
  313. int32_t (*ObjectSetFilter) (uint32_t obj_idx,
  314. ARM_CAN_FILTER_OPERATION operation,
  315. uint32_t id,
  316. uint32_t arg); ///< Pointer to \ref ARM_CAN_ObjectSetFilter : Add or remove filter for message reception.
  317. int32_t (*ObjectConfigure) (uint32_t obj_idx,
  318. ARM_CAN_OBJ_CONFIG obj_cfg); ///< Pointer to \ref ARM_CAN_ObjectConfigure : Configure object.
  319. int32_t (*MessageSend) (uint32_t obj_idx,
  320. ARM_CAN_MSG_INFO *msg_info,
  321. const uint8_t *data,
  322. uint8_t size); ///< Pointer to \ref ARM_CAN_MessageSend : Send message on CAN bus.
  323. int32_t (*MessageRead) (uint32_t obj_idx,
  324. ARM_CAN_MSG_INFO *msg_info,
  325. uint8_t *data,
  326. uint8_t size); ///< Pointer to \ref ARM_CAN_MessageRead : Read message received on CAN bus.
  327. int32_t (*Control) (uint32_t control,
  328. uint32_t arg); ///< Pointer to \ref ARM_CAN_Control : Control CAN interface.
  329. ARM_CAN_STATUS (*GetStatus) (void); ///< Pointer to \ref ARM_CAN_GetStatus : Get CAN status.
  330. } const ARM_DRIVER_CAN;
  331. #ifdef __cplusplus
  332. }
  333. #endif
  334. #endif /* DRIVER_CAN_H_ */