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