libopencm3
A free/libre/open-source firmware library for various ARM Cortex-M3 microcontrollers.
CAN defines

libopencm3 Defined Constants and Types for STM32 CAN More...

Collaboration diagram for CAN defines:

Modules

 CAN register base address
 

Macros

#define CAN_MCR(can_base)   MMIO32((can_base) + 0x000)
 
#define CAN_MSR(can_base)   MMIO32((can_base) + 0x004)
 
#define CAN_TSR(can_base)   MMIO32((can_base) + 0x008)
 
#define CAN_RF0R(can_base)   MMIO32((can_base) + 0x00C)
 
#define CAN_RF1R(can_base)   MMIO32((can_base) + 0x010)
 
#define CAN_IER(can_base)   MMIO32((can_base) + 0x014)
 
#define CAN_ESR(can_base)   MMIO32((can_base) + 0x018)
 
#define CAN_BTR(can_base)   MMIO32((can_base) + 0x01C)
 
#define CAN_MBOX0   0x180
 
#define CAN_MBOX1   0x190
 
#define CAN_MBOX2   0x1A0
 
#define CAN_FIFO0   0x1B0
 
#define CAN_FIFO1   0x1C0
 
#define CAN_TIxR(can_base, mbox)   MMIO32((can_base) + (mbox) + 0x0)
 
#define CAN_TI0R(can_base)   CAN_TIxR(can_base, CAN_MBOX0)
 
#define CAN_TI1R(can_base)   CAN_TIxR(can_base, CAN_MBOX1)
 
#define CAN_TI2R(can_base)   CAN_TIxR(can_base, CAN_MBOX2)
 
#define CAN_TDTxR(can_base, mbox)   MMIO32((can_base) + (mbox) + 0x4)
 
#define CAN_TDT0R(can_base)   CAN_TDTxR((can_base), CAN_MBOX0)
 
#define CAN_TDT1R(can_base)   CAN_TDTxR((can_base), CAN_MBOX1)
 
#define CAN_TDT2R(can_base)   CAN_TDTxR((can_base), CAN_MBOX2)
 
#define CAN_TDLxR(can_base, mbox)   MMIO32((can_base) + (mbox) + 0x8)
 
#define CAN_TDL0R(can_base)   CAN_TDLxR((can_base), CAN_MBOX0)
 
#define CAN_TDL1R(can_base)   CAN_TDLxR((can_base), CAN_MBOX1)
 
#define CAN_TDL2R(can_base)   CAN_TDLxR((can_base), CAN_MBOX2)
 
#define CAN_TDHxR(can_base, mbox)   MMIO32((can_base) + (mbox) + 0xC)
 
#define CAN_TDH0R(can_base)   CAN_TDHxR((can_base), CAN_MBOX0)
 
#define CAN_TDH1R(can_base)   CAN_TDHxR((can_base), CAN_MBOX1)
 
#define CAN_TDH2R(can_base)   CAN_TDHxR((can_base), CAN_MBOX2)
 
#define CAN_RIxR(can_base, fifo)   MMIO32((can_base) + (fifo) + 0x0)
 
#define CAN_RI0R(can_base)   CAN_RIxR((can_base), CAN_FIFO0)
 
#define CAN_RI1R(can_base)   CAN_RIxR((can_base), CAN_FIFO1)
 
#define CAN_RDTxR(can_base, fifo)   MMIO32((can_base) + (fifo) + 0x4)
 
#define CAN_RDT0R(can_base)   CAN_RDTxR((can_base), CAN_FIFO0)
 
#define CAN_RDT1R(can_base)   CAN_RDTxR((can_base), CAN_FIFO1)
 
#define CAN_RDLxR(can_base, fifo)   MMIO32((can_base) + (fifo) + 0x8)
 
#define CAN_RDL0R(can_base)   CAN_RDLxR((can_base), CAN_FIFO0)
 
#define CAN_RDL1R(can_base)   CAN_RDLxR((can_base), CAN_FIFO1)
 
#define CAN_RDHxR(can_base, fifo)   MMIO32((can_base) + (fifo) + 0xC)
 
#define CAN_RDH0R(can_base)   CAN_RDHxR((can_base), CAN_FIFO0)
 
#define CAN_RDH1R(can_base)   CAN_RDHxR((can_base), CAN_FIFO1)
 
#define CAN_FMR(can_base)   MMIO32((can_base) + 0x200)
 
#define CAN_FM1R(can_base)   MMIO32((can_base) + 0x204)
 
#define CAN_FS1R(can_base)   MMIO32((can_base) + 0x20C)
 
#define CAN_FFA1R(can_base)   MMIO32((can_base) + 0x214)
 
#define CAN_FA1R(can_base)   MMIO32((can_base) + 0x21C)
 
#define CAN_FiR1(can_base, bank)
 
#define CAN_FiR2(can_base, bank)
 
#define CAN_MCR_DBF   (1 << 16)
 
#define CAN_MCR_RESET   (1 << 15)
 
#define CAN_MCR_TTCM   (1 << 7)
 
#define CAN_MCR_ABOM   (1 << 6)
 
#define CAN_MCR_AWUM   (1 << 5)
 
#define CAN_MCR_NART   (1 << 4)
 
#define CAN_MCR_RFLM   (1 << 3)
 
#define CAN_MCR_TXFP   (1 << 2)
 
#define CAN_MCR_SLEEP   (1 << 1)
 
#define CAN_MCR_INRQ   (1 << 0)
 
#define CAN_MSR_RX   (1 << 11)
 
#define CAN_MSR_SAMP   (1 << 10)
 
#define CAN_MSR_RXM   (1 << 9)
 
#define CAN_MSR_TXM   (1 << 8)
 
#define CAN_MSR_SLAKI   (1 << 4)
 
#define CAN_MSR_WKUI   (1 << 3)
 
#define CAN_MSR_ERRI   (1 << 2)
 
#define CAN_MSR_SLAK   (1 << 1)
 
#define CAN_MSR_INAK   (1 << 0)
 
#define CAN_TSR_LOW2   (1 << 31)
 
#define CAN_TSR_LOW1   (1 << 30)
 
#define CAN_TSR_LOW0   (1 << 29)
 
#define CAN_TSR_TME2   (1 << 28)
 
#define CAN_TSR_TME1   (1 << 27)
 
#define CAN_TSR_TME0   (1 << 26)
 
#define CAN_TSR_CODE_MASK   (0x3 << 24)
 
#define CAN_TSR_ABRQ2   (1 << 23)
 
#define CAN_TSR_TERR2   (1 << 19)
 
#define CAN_TSR_ALST2   (1 << 18)
 
#define CAN_TSR_TXOK2   (1 << 17)
 
#define CAN_TSR_RQCP2   (1 << 16)
 
#define CAN_TSR_ABRQ1   (1 << 15)
 
#define CAN_TSR_TERR1   (1 << 11)
 
#define CAN_TSR_ALST1   (1 << 10)
 
#define CAN_TSR_TXOK1   (1 << 9)
 
#define CAN_TSR_RQCP1   (1 << 8)
 
#define CAN_TSR_ABRQ0   (1 << 7)
 
#define CAN_TSR_TERR0   (1 << 3)
 
#define CAN_TSR_ALST0   (1 << 2)
 
#define CAN_TSR_TXOK0   (1 << 1)
 
#define CAN_TSR_RQCP0   (1 << 0)
 
#define CAN_RF0R_RFOM0   (1 << 5)
 
#define CAN_RF0R_FOVR0   (1 << 4)
 
#define CAN_RF0R_FULL0   (1 << 3)
 
#define CAN_RF0R_FMP0_MASK   (0x3 << 0)
 
#define CAN_RF1R_RFOM1   (1 << 5)
 
#define CAN_RF1R_FOVR1   (1 << 4)
 
#define CAN_RF1R_FULL1   (1 << 3)
 
#define CAN_RF1R_FMP1_MASK   (0x3 << 0)
 
#define CAN_IER_SLKIE   (1 << 17)
 
#define CAN_IER_WKUIE   (1 << 16)
 
#define CAN_IER_ERRIE   (1 << 15)
 
#define CAN_IER_LECIE   (1 << 11)
 
#define CAN_IER_BOFIE   (1 << 10)
 
#define CAN_IER_EPVIE   (1 << 9)
 
#define CAN_IER_EWGIE   (1 << 8)
 
#define CAN_IER_FOVIE1   (1 << 6)
 
#define CAN_IER_FFIE1   (1 << 5)
 
#define CAN_IER_FMPIE1   (1 << 4)
 
#define CAN_IER_FOVIE0   (1 << 3)
 
#define CAN_IER_FFIE0   (1 << 2)
 
#define CAN_IER_FMPIE0   (1 << 1)
 
#define CAN_IER_TMEIE   (1 << 0)
 
#define CAN_ESR_REC_MASK   (0xF << 24)
 
#define CAN_ESR_TEC_MASK   (0xF << 16)
 
#define CAN_ESR_LEC_NO_ERROR   (0x0 << 4)
 
#define CAN_ESR_LEC_STUFF_ERROR   (0x1 << 4)
 
#define CAN_ESR_LEC_FORM_ERROR   (0x2 << 4)
 
#define CAN_ESR_LEC_ACK_ERROR   (0x3 << 4)
 
#define CAN_ESR_LEC_REC_ERROR   (0x4 << 4)
 
#define CAN_ESR_LEC_DOM_ERROR   (0x5 << 4)
 
#define CAN_ESR_LEC_CRC_ERROR   (0x6 << 4)
 
#define CAN_ESR_LEC_SOFT_ERROR   (0x7 << 4)
 
#define CAN_ESR_LEC_MASK   (0x7 << 4)
 
#define CAN_ESR_BOFF   (1 << 2)
 
#define CAN_ESR_EPVF   (1 << 1)
 
#define CAN_ESR_EWGF   (1 << 0)
 
#define CAN_BTR_SILM   (1 << 31)
 
#define CAN_BTR_LBKM   (1 << 30)
 
#define CAN_BTR_SJW_1TQ   (0x0 << 24)
 
#define CAN_BTR_SJW_2TQ   (0x1 << 24)
 
#define CAN_BTR_SJW_3TQ   (0x2 << 24)
 
#define CAN_BTR_SJW_4TQ   (0x3 << 24)
 
#define CAN_BTR_SJW_MASK   (0x3 << 24)
 
#define CAN_BTR_SJW_SHIFT   24
 
#define CAN_BTR_TS2_1TQ   (0x0 << 20)
 
#define CAN_BTR_TS2_2TQ   (0x1 << 20)
 
#define CAN_BTR_TS2_3TQ   (0x2 << 20)
 
#define CAN_BTR_TS2_4TQ   (0x3 << 20)
 
#define CAN_BTR_TS2_5TQ   (0x4 << 20)
 
#define CAN_BTR_TS2_6TQ   (0x5 << 20)
 
#define CAN_BTR_TS2_7TQ   (0x6 << 20)
 
#define CAN_BTR_TS2_8TQ   (0x7 << 20)
 
#define CAN_BTR_TS2_MASK   (0x7 << 20)
 
#define CAN_BTR_TS2_SHIFT   20
 
#define CAN_BTR_TS1_1TQ   (0x0 << 16)
 
#define CAN_BTR_TS1_2TQ   (0x1 << 16)
 
#define CAN_BTR_TS1_3TQ   (0x2 << 16)
 
#define CAN_BTR_TS1_4TQ   (0x3 << 16)
 
#define CAN_BTR_TS1_5TQ   (0x4 << 16)
 
#define CAN_BTR_TS1_6TQ   (0x5 << 16)
 
#define CAN_BTR_TS1_7TQ   (0x6 << 16)
 
#define CAN_BTR_TS1_8TQ   (0x7 << 16)
 
#define CAN_BTR_TS1_9TQ   (0x8 << 16)
 
#define CAN_BTR_TS1_10TQ   (0x9 << 16)
 
#define CAN_BTR_TS1_11TQ   (0xA << 16)
 
#define CAN_BTR_TS1_12TQ   (0xB << 16)
 
#define CAN_BTR_TS1_13TQ   (0xC << 16)
 
#define CAN_BTR_TS1_14TQ   (0xD << 16)
 
#define CAN_BTR_TS1_15TQ   (0xE << 16)
 
#define CAN_BTR_TS1_16TQ   (0xF << 16)
 
#define CAN_BTR_TS1_MASK   (0xF << 16)
 
#define CAN_BTR_TS1_SHIFT   16
 
#define CAN_BTR_BRP_MASK   (0x3FFUL << 0)
 
#define CAN_TIxR_STID_MASK   (0x7FF << 21)
 
#define CAN_TIxR_STID_SHIFT   21
 
#define CAN_TIxR_EXID_MASK   (0x1FFFFFF << 3)
 
#define CAN_TIxR_EXID_SHIFT   3
 
#define CAN_TIxR_IDE   (1 << 2)
 
#define CAN_TIxR_RTR   (1 << 1)
 
#define CAN_TIxR_TXRQ   (1 << 0)
 
#define CAN_TDTxR_TIME_MASK   (0xFFFF << 15)
 
#define CAN_TDTxR_TIME_SHIFT   15
 
#define CAN_TDTxR_TGT   (1 << 5)
 
#define CAN_TDTxR_DLC_MASK   (0xF << 0)
 
#define CAN_TDTxR_DLC_SHIFT   0
 
#define CAN_RIxR_STID_MASK   (0x7FF)
 
#define CAN_RIxR_STID_SHIFT   21
 
#define CAN_RIxR_EXID_MASK   (0x1FFFFFFF)
 
#define CAN_RIxR_EXID_SHIFT   3
 
#define CAN_RIxR_IDE   (1 << 2)
 
#define CAN_RIxR_RTR   (1 << 1)
 
#define CAN_RDTxR_TIME_MASK   (0xFFFF << 16)
 
#define CAN_RDTxR_TIME_SHIFT   16
 
#define CAN_RDTxR_FMI_MASK   (0xFF << 8)
 
#define CAN_RDTxR_FMI_SHIFT   8
 
#define CAN_RDTxR_DLC_MASK   (0xF << 0)
 
#define CAN_RDTxR_DLC_SHIFT   0
 
#define CAN_FMR_CAN2SB_SHIFT   8
 
#define CAN_FMR_CAN2SB_MASK   (0x3F << CAN_FMR_CAN2SB_SHIFT)
 
#define CAN_FMR_FINIT   (1 << 0)
 

Functions

void can_reset (uint32_t canport)
 CAN Reset. More...
 
int can_init (uint32_t canport, bool ttcm, bool abom, bool awum, bool nart, bool rflm, bool txfp, uint32_t sjw, uint32_t ts1, uint32_t ts2, uint32_t brp, bool loopback, bool silent)
 CAN Init. More...
 
void can_filter_init (uint32_t nr, bool scale_32bit, bool id_list_mode, uint32_t fr1, uint32_t fr2, uint32_t fifo, bool enable)
 CAN Filter Init. More...
 
void can_filter_id_mask_16bit_init (uint32_t nr, uint16_t id1, uint16_t mask1, uint16_t id2, uint16_t mask2, uint32_t fifo, bool enable)
 CAN Initialize a 16bit Message ID Mask Filter. More...
 
void can_filter_id_mask_32bit_init (uint32_t nr, uint32_t id, uint32_t mask, uint32_t fifo, bool enable)
 CAN Initialize a 32bit Message ID Mask Filter. More...
 
void can_filter_id_list_16bit_init (uint32_t nr, uint16_t id1, uint16_t id2, uint16_t id3, uint16_t id4, uint32_t fifo, bool enable)
 CAN Initialize a 16bit Message ID List Filter. More...
 
void can_filter_id_list_32bit_init (uint32_t nr, uint32_t id1, uint32_t id2, uint32_t fifo, bool enable)
 CAN Initialize a 32bit Message ID List Filter. More...
 
void can_enable_irq (uint32_t canport, uint32_t irq)
 CAN Enable IRQ. More...
 
void can_disable_irq (uint32_t canport, uint32_t irq)
 CAN Disable IRQ. More...
 
int can_transmit (uint32_t canport, uint32_t id, bool ext, bool rtr, uint8_t length, uint8_t *data)
 CAN Transmit Message. More...
 
void can_receive (uint32_t canport, uint8_t fifo, bool release, uint32_t *id, bool *ext, bool *rtr, uint8_t *fmi, uint8_t *length, uint8_t *data, uint16_t *timestamp)
 CAN Receive Message. More...
 
void can_fifo_release (uint32_t canport, uint8_t fifo)
 CAN Release FIFO. More...
 
bool can_available_mailbox (uint32_t canport)
 

Detailed Description

libopencm3 Defined Constants and Types for STM32 CAN

Version
1.0.0
Author
© 2010 Piotr Esden-Tempski piotr.nosp@m.@esd.nosp@m.en.ne.nosp@m.t
Date
12 November 2012

LGPL License Terms libopencm3 License

Macro Definition Documentation

◆ CAN_BTR

#define CAN_BTR (   can_base)    MMIO32((can_base) + 0x01C)

Definition at line 73 of file can.h.

Referenced by can_init().

◆ CAN_BTR_BRP_MASK

#define CAN_BTR_BRP_MASK   (0x3FFUL << 0)

Definition at line 483 of file can.h.

Referenced by can_init().

◆ CAN_BTR_LBKM

#define CAN_BTR_LBKM   (1 << 30)

Definition at line 434 of file can.h.

Referenced by can_init().

◆ CAN_BTR_SILM

#define CAN_BTR_SILM   (1 << 31)

Definition at line 431 of file can.h.

Referenced by can_init().

◆ CAN_BTR_SJW_1TQ

#define CAN_BTR_SJW_1TQ   (0x0 << 24)

Definition at line 439 of file can.h.

◆ CAN_BTR_SJW_2TQ

#define CAN_BTR_SJW_2TQ   (0x1 << 24)

Definition at line 440 of file can.h.

◆ CAN_BTR_SJW_3TQ

#define CAN_BTR_SJW_3TQ   (0x2 << 24)

Definition at line 441 of file can.h.

◆ CAN_BTR_SJW_4TQ

#define CAN_BTR_SJW_4TQ   (0x3 << 24)

Definition at line 442 of file can.h.

◆ CAN_BTR_SJW_MASK

#define CAN_BTR_SJW_MASK   (0x3 << 24)

Definition at line 443 of file can.h.

◆ CAN_BTR_SJW_SHIFT

#define CAN_BTR_SJW_SHIFT   24

Definition at line 444 of file can.h.

◆ CAN_BTR_TS1_10TQ

#define CAN_BTR_TS1_10TQ   (0x9 << 16)

Definition at line 470 of file can.h.

◆ CAN_BTR_TS1_11TQ

#define CAN_BTR_TS1_11TQ   (0xA << 16)

Definition at line 471 of file can.h.

◆ CAN_BTR_TS1_12TQ

#define CAN_BTR_TS1_12TQ   (0xB << 16)

Definition at line 472 of file can.h.

◆ CAN_BTR_TS1_13TQ

#define CAN_BTR_TS1_13TQ   (0xC << 16)

Definition at line 473 of file can.h.

◆ CAN_BTR_TS1_14TQ

#define CAN_BTR_TS1_14TQ   (0xD << 16)

Definition at line 474 of file can.h.

◆ CAN_BTR_TS1_15TQ

#define CAN_BTR_TS1_15TQ   (0xE << 16)

Definition at line 475 of file can.h.

◆ CAN_BTR_TS1_16TQ

#define CAN_BTR_TS1_16TQ   (0xF << 16)

Definition at line 476 of file can.h.

◆ CAN_BTR_TS1_1TQ

#define CAN_BTR_TS1_1TQ   (0x0 << 16)

Definition at line 461 of file can.h.

◆ CAN_BTR_TS1_2TQ

#define CAN_BTR_TS1_2TQ   (0x1 << 16)

Definition at line 462 of file can.h.

◆ CAN_BTR_TS1_3TQ

#define CAN_BTR_TS1_3TQ   (0x2 << 16)

Definition at line 463 of file can.h.

◆ CAN_BTR_TS1_4TQ

#define CAN_BTR_TS1_4TQ   (0x3 << 16)

Definition at line 464 of file can.h.

◆ CAN_BTR_TS1_5TQ

#define CAN_BTR_TS1_5TQ   (0x4 << 16)

Definition at line 465 of file can.h.

◆ CAN_BTR_TS1_6TQ

#define CAN_BTR_TS1_6TQ   (0x5 << 16)

Definition at line 466 of file can.h.

◆ CAN_BTR_TS1_7TQ

#define CAN_BTR_TS1_7TQ   (0x6 << 16)

Definition at line 467 of file can.h.

◆ CAN_BTR_TS1_8TQ

#define CAN_BTR_TS1_8TQ   (0x7 << 16)

Definition at line 468 of file can.h.

◆ CAN_BTR_TS1_9TQ

#define CAN_BTR_TS1_9TQ   (0x8 << 16)

Definition at line 469 of file can.h.

◆ CAN_BTR_TS1_MASK

#define CAN_BTR_TS1_MASK   (0xF << 16)

Definition at line 477 of file can.h.

◆ CAN_BTR_TS1_SHIFT

#define CAN_BTR_TS1_SHIFT   16

Definition at line 478 of file can.h.

◆ CAN_BTR_TS2_1TQ

#define CAN_BTR_TS2_1TQ   (0x0 << 20)

Definition at line 449 of file can.h.

◆ CAN_BTR_TS2_2TQ

#define CAN_BTR_TS2_2TQ   (0x1 << 20)

Definition at line 450 of file can.h.

◆ CAN_BTR_TS2_3TQ

#define CAN_BTR_TS2_3TQ   (0x2 << 20)

Definition at line 451 of file can.h.

◆ CAN_BTR_TS2_4TQ

#define CAN_BTR_TS2_4TQ   (0x3 << 20)

Definition at line 452 of file can.h.

◆ CAN_BTR_TS2_5TQ

#define CAN_BTR_TS2_5TQ   (0x4 << 20)

Definition at line 453 of file can.h.

◆ CAN_BTR_TS2_6TQ

#define CAN_BTR_TS2_6TQ   (0x5 << 20)

Definition at line 454 of file can.h.

◆ CAN_BTR_TS2_7TQ

#define CAN_BTR_TS2_7TQ   (0x6 << 20)

Definition at line 455 of file can.h.

◆ CAN_BTR_TS2_8TQ

#define CAN_BTR_TS2_8TQ   (0x7 << 20)

Definition at line 456 of file can.h.

◆ CAN_BTR_TS2_MASK

#define CAN_BTR_TS2_MASK   (0x7 << 20)

Definition at line 457 of file can.h.

◆ CAN_BTR_TS2_SHIFT

#define CAN_BTR_TS2_SHIFT   20

Definition at line 458 of file can.h.

◆ CAN_ESR

#define CAN_ESR (   can_base)    MMIO32((can_base) + 0x018)

Definition at line 71 of file can.h.

◆ CAN_ESR_BOFF

#define CAN_ESR_BOFF   (1 << 2)

Definition at line 420 of file can.h.

◆ CAN_ESR_EPVF

#define CAN_ESR_EPVF   (1 << 1)

Definition at line 423 of file can.h.

◆ CAN_ESR_EWGF

#define CAN_ESR_EWGF   (1 << 0)

Definition at line 426 of file can.h.

◆ CAN_ESR_LEC_ACK_ERROR

#define CAN_ESR_LEC_ACK_ERROR   (0x3 << 4)

Definition at line 410 of file can.h.

◆ CAN_ESR_LEC_CRC_ERROR

#define CAN_ESR_LEC_CRC_ERROR   (0x6 << 4)

Definition at line 413 of file can.h.

◆ CAN_ESR_LEC_DOM_ERROR

#define CAN_ESR_LEC_DOM_ERROR   (0x5 << 4)

Definition at line 412 of file can.h.

◆ CAN_ESR_LEC_FORM_ERROR

#define CAN_ESR_LEC_FORM_ERROR   (0x2 << 4)

Definition at line 409 of file can.h.

◆ CAN_ESR_LEC_MASK

#define CAN_ESR_LEC_MASK   (0x7 << 4)

Definition at line 415 of file can.h.

◆ CAN_ESR_LEC_NO_ERROR

#define CAN_ESR_LEC_NO_ERROR   (0x0 << 4)

Definition at line 407 of file can.h.

◆ CAN_ESR_LEC_REC_ERROR

#define CAN_ESR_LEC_REC_ERROR   (0x4 << 4)

Definition at line 411 of file can.h.

◆ CAN_ESR_LEC_SOFT_ERROR

#define CAN_ESR_LEC_SOFT_ERROR   (0x7 << 4)

Definition at line 414 of file can.h.

◆ CAN_ESR_LEC_STUFF_ERROR

#define CAN_ESR_LEC_STUFF_ERROR   (0x1 << 4)

Definition at line 408 of file can.h.

◆ CAN_ESR_REC_MASK

#define CAN_ESR_REC_MASK   (0xF << 24)

Definition at line 399 of file can.h.

◆ CAN_ESR_TEC_MASK

#define CAN_ESR_TEC_MASK   (0xF << 16)

Definition at line 402 of file can.h.

◆ CAN_FA1R

#define CAN_FA1R (   can_base)    MMIO32((can_base) + 0x21C)

Definition at line 151 of file can.h.

Referenced by can_filter_init().

◆ CAN_FFA1R

#define CAN_FFA1R (   can_base)    MMIO32((can_base) + 0x214)

Definition at line 146 of file can.h.

Referenced by can_filter_init().

◆ CAN_FIFO0

#define CAN_FIFO0   0x1B0

Definition at line 83 of file can.h.

Referenced by can_receive().

◆ CAN_FIFO1

#define CAN_FIFO1   0x1C0

Definition at line 84 of file can.h.

Referenced by can_receive().

◆ CAN_FiR1

#define CAN_FiR1 (   can_base,
  bank 
)
Value:
MMIO32((can_base) + 0x240 + \
((bank) * 0x8) + 0x0)
#define MMIO32(addr)
Definition: common.h:69

Definition at line 162 of file can.h.

Referenced by can_filter_init().

◆ CAN_FiR2

#define CAN_FiR2 (   can_base,
  bank 
)
Value:
MMIO32((can_base) + 0x240 + \
((bank) * 0x8) + 0x4)
#define MMIO32(addr)
Definition: common.h:69

Definition at line 164 of file can.h.

Referenced by can_filter_init().

◆ CAN_FM1R

#define CAN_FM1R (   can_base)    MMIO32((can_base) + 0x204)

Definition at line 136 of file can.h.

Referenced by can_filter_init().

◆ CAN_FMR

#define CAN_FMR (   can_base)    MMIO32((can_base) + 0x200)

Definition at line 133 of file can.h.

Referenced by can_filter_init().

◆ CAN_FMR_CAN2SB_MASK

#define CAN_FMR_CAN2SB_MASK   (0x3F << CAN_FMR_CAN2SB_SHIFT)

Definition at line 592 of file can.h.

◆ CAN_FMR_CAN2SB_SHIFT

#define CAN_FMR_CAN2SB_SHIFT   8

Definition at line 591 of file can.h.

◆ CAN_FMR_FINIT

#define CAN_FMR_FINIT   (1 << 0)

Definition at line 597 of file can.h.

Referenced by can_filter_init().

◆ CAN_FS1R

#define CAN_FS1R (   can_base)    MMIO32((can_base) + 0x20C)

Definition at line 141 of file can.h.

Referenced by can_filter_init().

◆ CAN_IER

#define CAN_IER (   can_base)    MMIO32((can_base) + 0x014)

Definition at line 69 of file can.h.

Referenced by can_disable_irq(), and can_enable_irq().

◆ CAN_IER_BOFIE

#define CAN_IER_BOFIE   (1 << 10)

Definition at line 365 of file can.h.

◆ CAN_IER_EPVIE

#define CAN_IER_EPVIE   (1 << 9)

Definition at line 368 of file can.h.

◆ CAN_IER_ERRIE

#define CAN_IER_ERRIE   (1 << 15)

Definition at line 357 of file can.h.

◆ CAN_IER_EWGIE

#define CAN_IER_EWGIE   (1 << 8)

Definition at line 371 of file can.h.

◆ CAN_IER_FFIE0

#define CAN_IER_FFIE0   (1 << 2)

Definition at line 388 of file can.h.

◆ CAN_IER_FFIE1

#define CAN_IER_FFIE1   (1 << 5)

Definition at line 379 of file can.h.

◆ CAN_IER_FMPIE0

#define CAN_IER_FMPIE0   (1 << 1)

Definition at line 391 of file can.h.

◆ CAN_IER_FMPIE1

#define CAN_IER_FMPIE1   (1 << 4)

Definition at line 382 of file can.h.

◆ CAN_IER_FOVIE0

#define CAN_IER_FOVIE0   (1 << 3)

Definition at line 385 of file can.h.

◆ CAN_IER_FOVIE1

#define CAN_IER_FOVIE1   (1 << 6)

Definition at line 376 of file can.h.

◆ CAN_IER_LECIE

#define CAN_IER_LECIE   (1 << 11)

Definition at line 362 of file can.h.

◆ CAN_IER_SLKIE

#define CAN_IER_SLKIE   (1 << 17)

Definition at line 351 of file can.h.

◆ CAN_IER_TMEIE

#define CAN_IER_TMEIE   (1 << 0)

Definition at line 394 of file can.h.

◆ CAN_IER_WKUIE

#define CAN_IER_WKUIE   (1 << 16)

Definition at line 354 of file can.h.

◆ CAN_MBOX0

#define CAN_MBOX0   0x180

Definition at line 80 of file can.h.

Referenced by can_transmit().

◆ CAN_MBOX1

#define CAN_MBOX1   0x190

Definition at line 81 of file can.h.

Referenced by can_transmit().

◆ CAN_MBOX2

#define CAN_MBOX2   0x1A0

Definition at line 82 of file can.h.

Referenced by can_transmit().

◆ CAN_MCR

#define CAN_MCR (   can_base)    MMIO32((can_base) + 0x000)

Definition at line 57 of file can.h.

Referenced by can_init().

◆ CAN_MCR_ABOM

#define CAN_MCR_ABOM   (1 << 6)

Definition at line 183 of file can.h.

Referenced by can_init().

◆ CAN_MCR_AWUM

#define CAN_MCR_AWUM   (1 << 5)

Definition at line 186 of file can.h.

Referenced by can_init().

◆ CAN_MCR_DBF

#define CAN_MCR_DBF   (1 << 16)

Definition at line 172 of file can.h.

◆ CAN_MCR_INRQ

#define CAN_MCR_INRQ   (1 << 0)

Definition at line 201 of file can.h.

Referenced by can_init().

◆ CAN_MCR_NART

#define CAN_MCR_NART   (1 << 4)

Definition at line 189 of file can.h.

Referenced by can_init().

◆ CAN_MCR_RESET

#define CAN_MCR_RESET   (1 << 15)

Definition at line 175 of file can.h.

◆ CAN_MCR_RFLM

#define CAN_MCR_RFLM   (1 << 3)

Definition at line 192 of file can.h.

Referenced by can_init().

◆ CAN_MCR_SLEEP

#define CAN_MCR_SLEEP   (1 << 1)

Definition at line 198 of file can.h.

Referenced by can_init().

◆ CAN_MCR_TTCM

#define CAN_MCR_TTCM   (1 << 7)

Definition at line 180 of file can.h.

Referenced by can_init().

◆ CAN_MCR_TXFP

#define CAN_MCR_TXFP   (1 << 2)

Definition at line 195 of file can.h.

Referenced by can_init().

◆ CAN_MSR

#define CAN_MSR (   can_base)    MMIO32((can_base) + 0x004)

Definition at line 59 of file can.h.

Referenced by can_init().

◆ CAN_MSR_ERRI

#define CAN_MSR_ERRI   (1 << 2)

Definition at line 228 of file can.h.

◆ CAN_MSR_INAK

#define CAN_MSR_INAK   (1 << 0)

Definition at line 234 of file can.h.

Referenced by can_init().

◆ CAN_MSR_RX

#define CAN_MSR_RX   (1 << 11)

Definition at line 208 of file can.h.

◆ CAN_MSR_RXM

#define CAN_MSR_RXM   (1 << 9)

Definition at line 214 of file can.h.

◆ CAN_MSR_SAMP

#define CAN_MSR_SAMP   (1 << 10)

Definition at line 211 of file can.h.

◆ CAN_MSR_SLAK

#define CAN_MSR_SLAK   (1 << 1)

Definition at line 231 of file can.h.

◆ CAN_MSR_SLAKI

#define CAN_MSR_SLAKI   (1 << 4)

Definition at line 222 of file can.h.

◆ CAN_MSR_TXM

#define CAN_MSR_TXM   (1 << 8)

Definition at line 217 of file can.h.

◆ CAN_MSR_WKUI

#define CAN_MSR_WKUI   (1 << 3)

Definition at line 225 of file can.h.

◆ CAN_RDH0R

#define CAN_RDH0R (   can_base)    CAN_RDHxR((can_base), CAN_FIFO0)

Definition at line 127 of file can.h.

◆ CAN_RDH1R

#define CAN_RDH1R (   can_base)    CAN_RDHxR((can_base), CAN_FIFO1)

Definition at line 128 of file can.h.

◆ CAN_RDHxR

#define CAN_RDHxR (   can_base,
  fifo 
)    MMIO32((can_base) + (fifo) + 0xC)

Definition at line 126 of file can.h.

Referenced by can_receive().

◆ CAN_RDL0R

#define CAN_RDL0R (   can_base)    CAN_RDLxR((can_base), CAN_FIFO0)

Definition at line 122 of file can.h.

◆ CAN_RDL1R

#define CAN_RDL1R (   can_base)    CAN_RDLxR((can_base), CAN_FIFO1)

Definition at line 123 of file can.h.

◆ CAN_RDLxR

#define CAN_RDLxR (   can_base,
  fifo 
)    MMIO32((can_base) + (fifo) + 0x8)

Definition at line 121 of file can.h.

Referenced by can_receive().

◆ CAN_RDT0R

#define CAN_RDT0R (   can_base)    CAN_RDTxR((can_base), CAN_FIFO0)

Definition at line 117 of file can.h.

◆ CAN_RDT1R

#define CAN_RDT1R (   can_base)    CAN_RDTxR((can_base), CAN_FIFO1)

Definition at line 118 of file can.h.

◆ CAN_RDTxR

#define CAN_RDTxR (   can_base,
  fifo 
)    MMIO32((can_base) + (fifo) + 0x4)

Definition at line 116 of file can.h.

Referenced by can_receive().

◆ CAN_RDTxR_DLC_MASK

#define CAN_RDTxR_DLC_MASK   (0xF << 0)

Definition at line 566 of file can.h.

Referenced by can_receive().

◆ CAN_RDTxR_DLC_SHIFT

#define CAN_RDTxR_DLC_SHIFT   0

Definition at line 567 of file can.h.

◆ CAN_RDTxR_FMI_MASK

#define CAN_RDTxR_FMI_MASK   (0xFF << 8)

Definition at line 560 of file can.h.

Referenced by can_receive().

◆ CAN_RDTxR_FMI_SHIFT

#define CAN_RDTxR_FMI_SHIFT   8

Definition at line 561 of file can.h.

Referenced by can_receive().

◆ CAN_RDTxR_TIME_MASK

#define CAN_RDTxR_TIME_MASK   (0xFFFF << 16)

Definition at line 556 of file can.h.

Referenced by can_receive().

◆ CAN_RDTxR_TIME_SHIFT

#define CAN_RDTxR_TIME_SHIFT   16

Definition at line 557 of file can.h.

Referenced by can_receive().

◆ CAN_RF0R

#define CAN_RF0R (   can_base)    MMIO32((can_base) + 0x00C)

Definition at line 64 of file can.h.

Referenced by can_fifo_release().

◆ CAN_RF0R_FMP0_MASK

#define CAN_RF0R_FMP0_MASK   (0x3 << 0)

Definition at line 326 of file can.h.

◆ CAN_RF0R_FOVR0

#define CAN_RF0R_FOVR0   (1 << 4)

Definition at line 318 of file can.h.

◆ CAN_RF0R_FULL0

#define CAN_RF0R_FULL0   (1 << 3)

Definition at line 321 of file can.h.

◆ CAN_RF0R_RFOM0

#define CAN_RF0R_RFOM0   (1 << 5)

Definition at line 315 of file can.h.

◆ CAN_RF1R

#define CAN_RF1R (   can_base)    MMIO32((can_base) + 0x010)

Definition at line 66 of file can.h.

Referenced by can_fifo_release().

◆ CAN_RF1R_FMP1_MASK

#define CAN_RF1R_FMP1_MASK   (0x3 << 0)

Definition at line 344 of file can.h.

◆ CAN_RF1R_FOVR1

#define CAN_RF1R_FOVR1   (1 << 4)

Definition at line 336 of file can.h.

◆ CAN_RF1R_FULL1

#define CAN_RF1R_FULL1   (1 << 3)

Definition at line 339 of file can.h.

◆ CAN_RF1R_RFOM1

#define CAN_RF1R_RFOM1   (1 << 5)

Definition at line 333 of file can.h.

Referenced by can_fifo_release().

◆ CAN_RI0R

#define CAN_RI0R (   can_base)    CAN_RIxR((can_base), CAN_FIFO0)

Definition at line 112 of file can.h.

◆ CAN_RI1R

#define CAN_RI1R (   can_base)    CAN_RIxR((can_base), CAN_FIFO1)

Definition at line 113 of file can.h.

◆ CAN_RIxR

#define CAN_RIxR (   can_base,
  fifo 
)    MMIO32((can_base) + (fifo) + 0x0)

Definition at line 111 of file can.h.

Referenced by can_receive().

◆ CAN_RIxR_EXID_MASK

#define CAN_RIxR_EXID_MASK   (0x1FFFFFFF)

Definition at line 542 of file can.h.

Referenced by can_receive().

◆ CAN_RIxR_EXID_SHIFT

#define CAN_RIxR_EXID_SHIFT   3

Definition at line 543 of file can.h.

Referenced by can_receive().

◆ CAN_RIxR_IDE

#define CAN_RIxR_IDE   (1 << 2)

Definition at line 546 of file can.h.

Referenced by can_receive().

◆ CAN_RIxR_RTR

#define CAN_RIxR_RTR   (1 << 1)

Definition at line 549 of file can.h.

Referenced by can_receive().

◆ CAN_RIxR_STID_MASK

#define CAN_RIxR_STID_MASK   (0x7FF)

Definition at line 538 of file can.h.

Referenced by can_receive().

◆ CAN_RIxR_STID_SHIFT

#define CAN_RIxR_STID_SHIFT   21

Definition at line 539 of file can.h.

Referenced by can_receive().

◆ CAN_TDH0R

#define CAN_TDH0R (   can_base)    CAN_TDHxR((can_base), CAN_MBOX0)

Definition at line 106 of file can.h.

◆ CAN_TDH1R

#define CAN_TDH1R (   can_base)    CAN_TDHxR((can_base), CAN_MBOX1)

Definition at line 107 of file can.h.

◆ CAN_TDH2R

#define CAN_TDH2R (   can_base)    CAN_TDHxR((can_base), CAN_MBOX2)

Definition at line 108 of file can.h.

◆ CAN_TDHxR

#define CAN_TDHxR (   can_base,
  mbox 
)    MMIO32((can_base) + (mbox) + 0xC)

Definition at line 105 of file can.h.

Referenced by can_transmit().

◆ CAN_TDL0R

#define CAN_TDL0R (   can_base)    CAN_TDLxR((can_base), CAN_MBOX0)

Definition at line 100 of file can.h.

◆ CAN_TDL1R

#define CAN_TDL1R (   can_base)    CAN_TDLxR((can_base), CAN_MBOX1)

Definition at line 101 of file can.h.

◆ CAN_TDL2R

#define CAN_TDL2R (   can_base)    CAN_TDLxR((can_base), CAN_MBOX2)

Definition at line 102 of file can.h.

◆ CAN_TDLxR

#define CAN_TDLxR (   can_base,
  mbox 
)    MMIO32((can_base) + (mbox) + 0x8)

Definition at line 99 of file can.h.

Referenced by can_transmit().

◆ CAN_TDT0R

#define CAN_TDT0R (   can_base)    CAN_TDTxR((can_base), CAN_MBOX0)

Definition at line 94 of file can.h.

◆ CAN_TDT1R

#define CAN_TDT1R (   can_base)    CAN_TDTxR((can_base), CAN_MBOX1)

Definition at line 95 of file can.h.

◆ CAN_TDT2R

#define CAN_TDT2R (   can_base)    CAN_TDTxR((can_base), CAN_MBOX2)

Definition at line 96 of file can.h.

◆ CAN_TDTxR

#define CAN_TDTxR (   can_base,
  mbox 
)    MMIO32((can_base) + (mbox) + 0x4)

Definition at line 93 of file can.h.

Referenced by can_transmit().

◆ CAN_TDTxR_DLC_MASK

#define CAN_TDTxR_DLC_MASK   (0xF << 0)

Definition at line 518 of file can.h.

Referenced by can_transmit().

◆ CAN_TDTxR_DLC_SHIFT

#define CAN_TDTxR_DLC_SHIFT   0

Definition at line 519 of file can.h.

◆ CAN_TDTxR_TGT

#define CAN_TDTxR_TGT   (1 << 5)

Definition at line 513 of file can.h.

◆ CAN_TDTxR_TIME_MASK

#define CAN_TDTxR_TIME_MASK   (0xFFFF << 15)

Definition at line 507 of file can.h.

◆ CAN_TDTxR_TIME_SHIFT

#define CAN_TDTxR_TIME_SHIFT   15

Definition at line 508 of file can.h.

◆ CAN_TI0R

#define CAN_TI0R (   can_base)    CAN_TIxR(can_base, CAN_MBOX0)

Definition at line 88 of file can.h.

◆ CAN_TI1R

#define CAN_TI1R (   can_base)    CAN_TIxR(can_base, CAN_MBOX1)

Definition at line 89 of file can.h.

◆ CAN_TI2R

#define CAN_TI2R (   can_base)    CAN_TIxR(can_base, CAN_MBOX2)

Definition at line 90 of file can.h.

◆ CAN_TIxR

#define CAN_TIxR (   can_base,
  mbox 
)    MMIO32((can_base) + (mbox) + 0x0)

Definition at line 87 of file can.h.

Referenced by can_transmit().

◆ CAN_TIxR_EXID_MASK

#define CAN_TIxR_EXID_MASK   (0x1FFFFFF << 3)

Definition at line 492 of file can.h.

◆ CAN_TIxR_EXID_SHIFT

#define CAN_TIxR_EXID_SHIFT   3

Definition at line 493 of file can.h.

Referenced by can_transmit().

◆ CAN_TIxR_IDE

#define CAN_TIxR_IDE   (1 << 2)

Definition at line 496 of file can.h.

Referenced by can_transmit().

◆ CAN_TIxR_RTR

#define CAN_TIxR_RTR   (1 << 1)

Definition at line 499 of file can.h.

Referenced by can_transmit().

◆ CAN_TIxR_STID_MASK

#define CAN_TIxR_STID_MASK   (0x7FF << 21)

Definition at line 488 of file can.h.

◆ CAN_TIxR_STID_SHIFT

#define CAN_TIxR_STID_SHIFT   21

Definition at line 489 of file can.h.

Referenced by can_transmit().

◆ CAN_TIxR_TXRQ

#define CAN_TIxR_TXRQ   (1 << 0)

Definition at line 502 of file can.h.

Referenced by can_transmit().

◆ CAN_TSR

#define CAN_TSR (   can_base)    MMIO32((can_base) + 0x008)

Definition at line 61 of file can.h.

Referenced by can_available_mailbox(), and can_transmit().

◆ CAN_TSR_ABRQ0

#define CAN_TSR_ABRQ0   (1 << 7)

Definition at line 294 of file can.h.

◆ CAN_TSR_ABRQ1

#define CAN_TSR_ABRQ1   (1 << 15)

Definition at line 277 of file can.h.

◆ CAN_TSR_ABRQ2

#define CAN_TSR_ABRQ2   (1 << 23)

Definition at line 260 of file can.h.

◆ CAN_TSR_ALST0

#define CAN_TSR_ALST0   (1 << 2)

Definition at line 302 of file can.h.

◆ CAN_TSR_ALST1

#define CAN_TSR_ALST1   (1 << 10)

Definition at line 285 of file can.h.

◆ CAN_TSR_ALST2

#define CAN_TSR_ALST2   (1 << 18)

Definition at line 268 of file can.h.

◆ CAN_TSR_CODE_MASK

#define CAN_TSR_CODE_MASK   (0x3 << 24)

Definition at line 257 of file can.h.

◆ CAN_TSR_LOW0

#define CAN_TSR_LOW0   (1 << 29)

Definition at line 245 of file can.h.

◆ CAN_TSR_LOW1

#define CAN_TSR_LOW1   (1 << 30)

Definition at line 242 of file can.h.

◆ CAN_TSR_LOW2

#define CAN_TSR_LOW2   (1 << 31)

Definition at line 239 of file can.h.

◆ CAN_TSR_RQCP0

#define CAN_TSR_RQCP0   (1 << 0)

Definition at line 308 of file can.h.

◆ CAN_TSR_RQCP1

#define CAN_TSR_RQCP1   (1 << 8)

Definition at line 291 of file can.h.

◆ CAN_TSR_RQCP2

#define CAN_TSR_RQCP2   (1 << 16)

Definition at line 274 of file can.h.

◆ CAN_TSR_TERR0

#define CAN_TSR_TERR0   (1 << 3)

Definition at line 299 of file can.h.

◆ CAN_TSR_TERR1

#define CAN_TSR_TERR1   (1 << 11)

Definition at line 282 of file can.h.

◆ CAN_TSR_TERR2

#define CAN_TSR_TERR2   (1 << 19)

Definition at line 265 of file can.h.

◆ CAN_TSR_TME0

#define CAN_TSR_TME0   (1 << 26)

Definition at line 254 of file can.h.

Referenced by can_available_mailbox(), and can_transmit().

◆ CAN_TSR_TME1

#define CAN_TSR_TME1   (1 << 27)

Definition at line 251 of file can.h.

Referenced by can_available_mailbox(), and can_transmit().

◆ CAN_TSR_TME2

#define CAN_TSR_TME2   (1 << 28)

Definition at line 248 of file can.h.

Referenced by can_available_mailbox(), and can_transmit().

◆ CAN_TSR_TXOK0

#define CAN_TSR_TXOK0   (1 << 1)

Definition at line 305 of file can.h.

◆ CAN_TSR_TXOK1

#define CAN_TSR_TXOK1   (1 << 9)

Definition at line 288 of file can.h.

◆ CAN_TSR_TXOK2

#define CAN_TSR_TXOK2   (1 << 17)

Definition at line 271 of file can.h.

Function Documentation

◆ can_available_mailbox()

bool can_available_mailbox ( uint32_t  canport)

Definition at line 547 of file can.c.

References CAN_TSR, CAN_TSR_TME0, CAN_TSR_TME1, and CAN_TSR_TME2.

◆ can_disable_irq()

void can_disable_irq ( uint32_t  canport,
uint32_t  irq 
)

CAN Disable IRQ.

Parameters
[in]canportUnsigned int32. CAN block register base CAN register base address.
[in]irqUnsigned int32. IRQ bit(s).

Definition at line 337 of file can.c.

References CAN_IER.

◆ can_enable_irq()

void can_enable_irq ( uint32_t  canport,
uint32_t  irq 
)

CAN Enable IRQ.

Parameters
[in]canportUnsigned int32. CAN block register base CAN register base address.
[in]irqUnsigned int32. IRQ bit(s).

Definition at line 326 of file can.c.

References CAN_IER.

◆ can_fifo_release()

void can_fifo_release ( uint32_t  canport,
uint8_t  fifo 
)

CAN Release FIFO.

Parameters
[in]canportUnsigned int32. CAN block register base CAN register base address.
[in]fifoUnsigned int8. FIFO id.

Definition at line 446 of file can.c.

References CAN_RF0R, CAN_RF1R, and CAN_RF1R_RFOM1.

Referenced by can_receive().

Here is the caller graph for this function:

◆ can_filter_id_list_16bit_init()

void can_filter_id_list_16bit_init ( uint32_t  nr,
uint16_t  id1,
uint16_t  id2,
uint16_t  id3,
uint16_t  id4,
uint32_t  fifo,
bool  enable 
)

CAN Initialize a 16bit Message ID List Filter.

Parameters
[in]nrUnsigned int32. ID number of the filter.
[in]id1Unsigned int16. First message ID to match.
[in]id2Unsigned int16. Second message ID to match.
[in]id3Unsigned int16. Third message ID to match.
[in]id4Unsigned int16. Fourth message ID to match.
[in]fifoUnsigned int32. FIFO id.
[in]enablebool. Enable filter?

Definition at line 294 of file can.c.

References can_filter_init().

Here is the call graph for this function:

◆ can_filter_id_list_32bit_init()

void can_filter_id_list_32bit_init ( uint32_t  nr,
uint32_t  id1,
uint32_t  id2,
uint32_t  fifo,
bool  enable 
)

CAN Initialize a 32bit Message ID List Filter.

Parameters
[in]nrUnsigned int32. ID number of the filter.
[in]id1Unsigned int32. First message ID to match.
[in]id2Unsigned int32. Second message ID to match.
[in]fifoUnsigned int32. FIFO id.
[in]enablebool. Enable filter?

Definition at line 313 of file can.c.

References can_filter_init().

Here is the call graph for this function:

◆ can_filter_id_mask_16bit_init()

void can_filter_id_mask_16bit_init ( uint32_t  nr,
uint16_t  id1,
uint16_t  mask1,
uint16_t  id2,
uint16_t  mask2,
uint32_t  fifo,
bool  enable 
)

CAN Initialize a 16bit Message ID Mask Filter.

Parameters
[in]nrUnsigned int32. ID number of the filter.
[in]id1Unsigned int16. First message ID to filter.
[in]mask1Unsigned int16. First message ID bit mask.
[in]id2Unsigned int16. Second message ID to filter.
[in]mask2Unsigned int16. Second message ID bit mask.
[in]fifoUnsigned int32. FIFO id.
[in]enablebool. Enable filter?

Definition at line 259 of file can.c.

References can_filter_init().

Here is the call graph for this function:

◆ can_filter_id_mask_32bit_init()

void can_filter_id_mask_32bit_init ( uint32_t  nr,
uint32_t  id,
uint32_t  mask,
uint32_t  fifo,
bool  enable 
)

CAN Initialize a 32bit Message ID Mask Filter.

Parameters
[in]nrUnsigned int32. ID number of the filter.
[in]idUnsigned int32. Message ID to filter.
[in]maskUnsigned int32. Message ID bit mask.
[in]fifoUnsigned int32. FIFO id.
[in]enablebool. Enable filter?

Definition at line 277 of file can.c.

References can_filter_init().

Here is the call graph for this function:

◆ can_filter_init()

void can_filter_init ( uint32_t  nr,
bool  scale_32bit,
bool  id_list_mode,
uint32_t  fr1,
uint32_t  fr2,
uint32_t  fifo,
bool  enable 
)

CAN Filter Init.

Initialize incoming message filter and assign to FIFO.

Parameters
[in]nrUnsigned int32. ID number of the filter.
[in]scale_32bittrue for single 32bit, false for dual 16bit
[in]id_list_modetrue for id lists, false for id/mask
[in]fr1Unsigned int32. First filter register content.
[in]fr2Unsigned int32. Second filter register content.
[in]fifoUnsigned int32. FIFO id.
[in]enablebool. Enable filter?

Definition at line 199 of file can.c.

References CAN1, CAN_FA1R, CAN_FFA1R, CAN_FiR1, CAN_FiR2, CAN_FM1R, CAN_FMR, CAN_FMR_FINIT, and CAN_FS1R.

Referenced by can_filter_id_list_16bit_init(), can_filter_id_list_32bit_init(), can_filter_id_mask_16bit_init(), and can_filter_id_mask_32bit_init().

Here is the caller graph for this function:

◆ can_init()

int can_init ( uint32_t  canport,
bool  ttcm,
bool  abom,
bool  awum,
bool  nart,
bool  rflm,
bool  txfp,
uint32_t  sjw,
uint32_t  ts1,
uint32_t  ts2,
uint32_t  brp,
bool  loopback,
bool  silent 
)

CAN Init.

Initialize the selected CAN peripheral block.

Parameters
[in]canportUnsigend int32. CAN register base address CAN register base address.
[in]ttcmbool. Time triggered communication mode.
[in]abombool. Automatic bus-off management.
[in]awumbool. Automatic wakeup mode.
[in]nartbool. No automatic retransmission.
[in]rflmbool. Receive FIFO locked mode.
[in]txfpbool. Transmit FIFO priority.
[in]sjwUnsigned int32. Resynchronization time quanta jump width.
[in]ts1Unsigned int32. Time segment 1 time quanta width.
[in]ts2Unsigned int32. Time segment 2 time quanta width.
[in]brpUnsigned int32. Baud rate prescaler.
Returns
int 0 on success, 1 on initialization failure.

Definition at line 92 of file can.c.

References CAN_BTR, CAN_BTR_BRP_MASK, CAN_BTR_LBKM, CAN_BTR_SILM, CAN_MCR, CAN_MCR_ABOM, CAN_MCR_AWUM, CAN_MCR_INRQ, CAN_MCR_NART, CAN_MCR_RFLM, CAN_MCR_SLEEP, CAN_MCR_TTCM, CAN_MCR_TXFP, CAN_MSR, CAN_MSR_INAK, and CAN_MSR_INAK_TIMEOUT.

◆ can_receive()

void can_receive ( uint32_t  canport,
uint8_t  fifo,
bool  release,
uint32_t *  id,
bool *  ext,
bool *  rtr,
uint8_t *  fmi,
uint8_t *  length,
uint8_t *  data,
uint16_t *  timestamp 
)

CAN Receive Message.

Parameters
[in]canportUnsigned int32. CAN block register base CAN register base address.
[in]fifoUnsigned int8. FIFO id.
[in]releasebool. Release the FIFO automatically after coping data out.
[out]idUnsigned int32 pointer. Message ID.
[out]extbool pointer. The message ID is extended?
[out]rtrbool pointer. Request of transmission?
[out]fmiUnsigned int8 pointer. ID of the matched filter.
[out]lengthUnsigned int8 pointer. Length of message payload.
[out]dataUnsigned int8[]. Message payload data.
[out]timestamp.Pointer to store the message timestamp. Only valid on time triggered CAN. Use NULL to ignore.

Definition at line 470 of file can.c.

References CAN_FIFO0, CAN_FIFO1, can_fifo_release(), CAN_RDHxR, CAN_RDLxR, CAN_RDTxR, CAN_RDTxR_DLC_MASK, CAN_RDTxR_FMI_MASK, CAN_RDTxR_FMI_SHIFT, CAN_RDTxR_TIME_MASK, CAN_RDTxR_TIME_SHIFT, CAN_RIxR, CAN_RIxR_EXID_MASK, CAN_RIxR_EXID_SHIFT, CAN_RIxR_IDE, CAN_RIxR_RTR, CAN_RIxR_STID_MASK, and CAN_RIxR_STID_SHIFT.

Here is the call graph for this function:

◆ can_reset()

void can_reset ( uint32_t  canport)

CAN Reset.

The CAN peripheral and all its associated configuration registers are placed in the reset condition. The reset is effective via the RCC peripheral reset system.

Parameters
[in]canportUnsigned int32. CAN block register address base CAN register base address.

Definition at line 63 of file can.c.

References CAN1, rcc_periph_reset_pulse(), and RST_CAN1.

Here is the call graph for this function:

◆ can_transmit()

int can_transmit ( uint32_t  canport,
uint32_t  id,
bool  ext,
bool  rtr,
uint8_t  length,
uint8_t *  data 
)

CAN Transmit Message.

Parameters
[in]canportUnsigned int32. CAN block register base CAN register base address.
[in]idUnsigned int32. Message ID.
[in]extbool. Extended message ID?
[in]rtrbool. Request transmit?
[in]lengthUnsigned int8. Message payload length.
[in]dataUnsigned int8[]. Message payload data.
Returns
int 0, 1 or 2 on success and depending on which outgoing mailbox got selected. -1 if no mailbox was available and no transmission got queued.

Definition at line 354 of file can.c.

References CAN_MBOX0, CAN_MBOX1, CAN_MBOX2, CAN_TDHxR, CAN_TDLxR, CAN_TDTxR, CAN_TDTxR_DLC_MASK, CAN_TIxR, CAN_TIxR_EXID_SHIFT, CAN_TIxR_IDE, CAN_TIxR_RTR, CAN_TIxR_STID_SHIFT, CAN_TIxR_TXRQ, CAN_TSR, CAN_TSR_TME0, CAN_TSR_TME1, and CAN_TSR_TME2.