50#define FDCAN_LSS_COUNT(can_base) \
51 ((FDCAN_SIDFC(can_base) >> FDCAN_SIDFC_LSS_SHIFT) & FDCAN_SIDFC_LSS_MASK)
53#define FDCAN_LSE_COUNT(can_base) \
54 ((FDCAN_XIDFC(can_base) >> FDCAN_XIDFC_LSE_SHIFT) & FDCAN_XIDFC_LSE_MASK)
74 unsigned element_size;
96 unsigned element_size;
215 if (rxbufdlc == 0xFF || rxfifo0dlc == 0xFF || rxfifo1dlc == 0xFF) {
226 rxbufdlc &= ~(1 << 4);
229 if (rxfifo0dlc <= 8) {
232 rxfifo0dlc &= ~(1 << 4);
235 if (rxfifo1dlc <= 8) {
238 rxfifo1dlc &= ~(1 << 4);
265 if (txbufdlc == 0xFF) {
272 txbufdlc &= ~(1 << 4);
317 lfeofs = lfsofs - lfesize;
330 for (
int q = 0; q < 28; ++q) {
336 for (
int q = 0; q < 8; ++q) {
380 int fifo1_size = fifo0_size;
419 if (lfesa_offs == 0) {
#define FDCAN_LSE_COUNT(can_base)
uint8_t fdcan_dlc_to_length(uint32_t dlc)
Converts DLC value into frame payload length.
int fdcan_cccr_init_cfg(uint32_t canport, bool set, uint32_t timeout)
Routine implementing FDCAN_CCCR's INIT bit manipulation.
struct fdcan_standard_filter * fdcan_get_flssa_addr(uint32_t canport)
Returns standard filter start address in message RAM.
struct fdcan_extended_filter * fdcan_get_flesa_addr(uint32_t canport)
Returns extended filter start address in message RAM.
uint32_t fdcan_length_to_dlc(uint8_t length)
Converts frame length to DLC value.
#define FDCAN_RXESC_RBDS_SHIFT
#define FDCAN_TXEFC_EFSA_SHIFT
#define FDCAN_SIDFC_LSS_SHIFT
#define FDCAN_TXBC_TBSA_MASK
TBSA[7:0]: Transmit buffer start address.
#define FDCAN_TXESC_TBDS_MASK
TBDS[3:0]: TX buffer data field size.
#define FDCAN_TXEVT_OFFSET(can_base)
#define FDCAN_RXFIC_FIS_SHIFT
#define FDCAN_RXFIC_FISA_MASK
#define FDCAN_SIDFC(can_base)
#define FDCAN_TXBUF_OFFSET(can_base)
#define FDCAN_TXEFC_EFS_SHIFT
#define FDCAN_XIDFC_FLESA_SHIFT
#define FDCAN_TXBC_TFQS_MASK
TFQS[5:0]: Tx FIFO/Queue size.
#define FDCAN_BLOCK_ID(can_base)
#define FDCAN_RXESC_F0DS_MASK
F0DS[3:0]: FIFO0 data field size.
#define FDCAN_TXBC_TBSA_SHIFT
#define FDCAN_XIDFC_LSE_SHIFT
#define FDCAN_TXEFC_EFSA_MASK
EFSA[7:0]: (Transmit) event FIFO start address.
#define FDCAN_TXESC_TBDS_SHIFT
#define FDCAN_SIDFC_FLSSA_SHIFT
#define FDCAN_TXEFC(can_base)
#define FDCAN_RXFIFO_OFFSET(can_base, fifo_id)
#define FDCAN_RXESC_F0DS_SHIFT
#define FDCAN_RXFIC_FIS_MASK
#define FDCAN_LFESA_OFFSET(can_base)
#define FDCAN_TXBC_TFQS_SHIFT
#define FDCAN_TXESC(can_base)
#define FDCAN_TXBC(can_base)
#define FDCAN_RXFIC_FISA_SHIFT
#define FDCAN_RXF1C(can_base)
#define FDCAN_TXEFC_EFS_MASK
#define FDCAN_RXESC_F1DS_SHIFT
#define FDCAN_RXFIC(can_base, fifo_id)
#define FDCAN_RXF0C(can_base)
#define FDCAN_XIDFC(can_base)
#define FDCAN_RXESC(can_base)
#define FDCAN_E_TIMEOUT
Timeout waiting for FDCAN block to accept INIT bit change.
#define FDCAN_E_OK
No error.
#define FDCAN_E_INVALID
Value provided was invalid (FIFO index, FDCAN block base address, length, etc.)
void fdcan_init_tx_event_ram(uint32_t canport, uint32_t tesa, uint8_t tes)
Initialize allocation of transmit event block in CAN message RAM.
int fdcan_set_rx_element_size(uint32_t canport, uint8_t rxbuf, uint8_t rxfifo0, uint8_t rxfifo1)
Initialize size of data fields in reception buffers.
void fdcan_init_fifo_ram(uint32_t canport, unsigned fifo_id, uint32_t fxsa, uint8_t fxs)
Initialize allocation of FIFO block in CAN message RAM.
void fdcan_set_fifo_locked_mode(uint32_t canport, bool locked)
Configure FDCAN FIFO lock mode.
int fdcan_start(uint32_t canport, uint32_t timeout)
Enable FDCAN operation after FDCAN block has been set up.
void fdcan_init_std_filter_ram(uint32_t canport, uint32_t flssa, uint8_t lss)
Initialize allocation of standard filter block in CAN message RAM.
void fdcan_init_tx_buffer_ram(uint32_t canport, uint32_t tbsa, uint8_t tbs)
Initialize allocation of transmit queue block in CAN message RAM.
int fdcan_set_tx_element_size(uint32_t canport, uint8_t txbuf)
Initialize size of data fields in transmit buffers.
void fdcan_init_ext_filter_ram(uint32_t canport, uint32_t flesa, uint8_t lse)
Initialize allocation of extended filter block in CAN message RAM.
unsigned fdcan_get_fifo_element_size(uint32_t canport, unsigned fifo_id)
Returns actual size of FIFO entry in FIFO for given CAN port and FIFO.
void fdcan_init_filter(uint32_t canport, uint8_t std_filt, uint8_t ext_filt)
Configure amount of filters and initialize filtering block.
unsigned fdcan_get_txbuf_element_size(uint32_t canport)
Returns actual size of transmit entry in transmit queue/FIFO for given CAN port.
Structure describing extended ID filters.
uint32_t type_id2
Aggregate of filter type and extended ID or mask.
uint32_t conf_id1
Aggregate of filter action and extended ID.
Structure describing receive FIFO element.
Structure describing standard ID filter.
uint32_t type_id1_conf_id2
Aggregate of filter type, filter action and two IDs
Structure describing transmit buffer element.
Structure describing transmit event element.