G4 FDCAN public API implementation.
More...
G4 FDCAN public API implementation.
- Author
- Millan Kumar (kumar.nosp@m.798@.nosp@m.purdu.nosp@m.e.ed.nosp@m.u)
Logic level code. All register/message-RAM detail lives in fdcan_priv.c.
◆ FDCAN1_IT0_IRQHandler()
| void FDCAN1_IT0_IRQHandler |
( |
void | | ) |
|
◆ FDCAN1_IT1_IRQHandler()
| void FDCAN1_IT1_IRQHandler |
( |
void | | ) |
|
◆ FDCAN2_IT0_IRQHandler()
| void FDCAN2_IT0_IRQHandler |
( |
void | | ) |
|
◆ FDCAN2_IT1_IRQHandler()
| void FDCAN2_IT1_IRQHandler |
( |
void | | ) |
|
◆ FDCAN3_IT0_IRQHandler()
| void FDCAN3_IT0_IRQHandler |
( |
void | | ) |
|
◆ FDCAN3_IT1_IRQHandler()
| void FDCAN3_IT1_IRQHandler |
( |
void | | ) |
|
◆ fdcan_rxIRQHandler()
| static void fdcan_rxIRQHandler |
( |
FDCAN_GlobalTypeDef * | fdcan | ) |
|
|
inlinestatic |
◆ fdcan_txIRQHandler()
| static void fdcan_txIRQHandler |
( |
FDCAN_GlobalTypeDef * | fdcan | ) |
|
|
inlinestatic |
◆ PHAL_FDCAN_init()
Initialize an FDCAN peripheral for classic (non-FD) CAN operation.
- Setups up FDCAN clock (from PCLK1)
- ~87.5% sample point
- Classic CAN mode (FD/BRS off), auto-retransmission enabled, TX pause on
- TX FIFO mode
- RX FIFO0 new message (line 0) and TX complete interrupts (line 1)
- Sets filter to accept everything into RX FIFO0
- Use PHAL_FDCAN_setFilters later
- Parameters
-
| fdcan | Peripheral instance (FDCAN1/2/3) |
| bit_rate | desired bit rate in bits per second |
◆ PHAL_FDCAN_rxCallback()
Weak callback fired once per received frame.
Called from FDCANx_IT0_IRQHandler (interrupt context) for every frame popped from RX FIFO0.
Default implementation does nothing.
- Parameters
-
| msg | the received frame (valid only for the duration of the call) |
◆ PHAL_FDCAN_send()
Queue a frame for transmission.
Non-blocking: if the TX FIFO is already full this returns false instead of blocking/waiting.
- Parameters
-
| msg | frame to send; sent on msg->Bus peripheral |
- Returns
- true if the frame was queued; false if the TX FIFO is full
◆ PHAL_FDCAN_setFilters()
| bool PHAL_FDCAN_setFilters |
( |
FDCAN_GlobalTypeDef * | fdcan, |
|
|
const uint32_t * | sid_list, |
|
|
uint32_t | num_sid, |
|
|
const uint32_t * | xid_list, |
|
|
uint32_t | num_xid ) |
Configure exact-match acceptance filters for RX FIFO0.
Every ID in sid_list/xid_list is matched exactly. Any message whose ID is not in either list is rejected.
Note: this replaces any previously existing filter configurations
- Parameters
-
| fdcan | Peripheral instance (FDCAN1/2/3) |
| sid_list | array of standard (11-bit) IDs to accept; may be NULL if num_sid == 0 |
| num_sid | number of entries in sid_list, up to MAX_NUM_SID_FILTER allowed |
| xid_list | array of extended (29-bit) IDs to accept; may be NULL if num_xid == 0 |
| num_xid | number of entries in xid_list, up to MAX_NUM_XID_FILTER allowed |
- Returns
- true on success; false if num_sid or num_xid exceeds its max
◆ PHAL_FDCAN_txCallback()
| void PHAL_FDCAN_txCallback |
( |
FDCAN_GlobalTypeDef * | fdcan | ) |
|
Weak callback fired when a queued frame finishes transmitting.
Called from FDCANx_IT1_IRQHandler (interrupt context).
Default implementation does nothing.
- Parameters
-
| fdcan | the peripheral instance that completed a transmission |
◆ PHAL_FDCAN_txFifoFree()
| bool PHAL_FDCAN_txFifoFree |
( |
const FDCAN_GlobalTypeDef * | fdcan | ) |
|
Check whether the TX FIFO has at least one free slot.
- Parameters
-
- Returns
- true if a slot is free