CAN Data Link Layer. More...

Detailed Description

CAN Data Link Layer.

The Data Link Layer is composed of the device, router, pkt and dll files. It can be used to send and receive raw CAN frames through multiple CAN controllers.


file  can.h
 Definitions high-level CAN interface.
file  device.h
 Definitions of CAN device interface.
file  dll.h
 Definitions of low-level CAN DLL interface.
file  pkt.h
 CAN memory allocation module.
file  raw.h
 Definitions high-level RAW CAN interface.
file  router.h
 Functions for routing RX can frames.

Data Structures

struct  can_frame
 Controller Area Network frame. More...
struct  can_filter
 Controller Area Network filter. More...
struct  can_bittiming
 CAN bit-timing parameters. More...
struct  can_bittiming_const
 CAN hardware-dependent bit-timing constant. More...


#define CAN_MAX_DLEN   (8)
 Max data length for a CAN frame. More...


typedef uint32_t canid_t
 Controller Area Network Identifier structure. More...


enum  can_state {
 CAN operational and error states. More...

CAN_ID flags and masks

#define CAN_EFF_FLAG   (0x80000000U)
 EFF/SFF is set in the MSB. More...
#define CAN_RTR_FLAG   (0x40000000U)
 remote transmission request More...
#define CAN_ERR_FLAG   (0x20000000U)
 error message frame More...
#define CAN_SFF_MASK   (0x000007FFU)
 standard frame format (SFF) More...
#define CAN_EFF_MASK   (0x1FFFFFFFU)
 extended frame format (EFF) More...
#define CAN_ERR_MASK   (0x1FFFFFFFU)
 omit EFF, RTR, ERR flags More...

Macro Definition Documentation


#define CAN_EFF_FLAG   (0x80000000U)

EFF/SFF is set in the MSB.

Definition at line 52 of file can.h.


#define CAN_EFF_MASK   (0x1FFFFFFFU)

extended frame format (EFF)

Definition at line 58 of file can.h.


#define CAN_ERR_FLAG   (0x20000000U)

error message frame

Definition at line 54 of file can.h.


#define CAN_ERR_MASK   (0x1FFFFFFFU)

omit EFF, RTR, ERR flags

Definition at line 59 of file can.h.


#define CAN_MAX_DLEN   (8)

Max data length for a CAN frame.

Definition at line 45 of file can.h.


#define CAN_RTR_FLAG   (0x40000000U)

remote transmission request

Definition at line 53 of file can.h.


#define CAN_SFF_MASK   (0x000007FFU)

standard frame format (SFF)

Definition at line 57 of file can.h.

Typedef Documentation

◆ canid_t

typedef uint32_t canid_t

Controller Area Network Identifier structure.

bit 0-28 : CAN identifier (11/29 bit) right aligned for 11 bit bit 29 : error message frame flag (0 = data frame, 1 = error message) bit 30 : remote transmission request flag (1 = rtr frame) bit 31 : frame format flag (0 = standard 11 bit, 1 = extended 29 bit)

Definition at line 83 of file can.h.

Enumeration Type Documentation

◆ can_state

enum can_state

CAN operational and error states.


RX/TX error count < 96.


RX/TX error count < 128.


RX/TX error count < 256.


RX/TX error count >= 256.


Device is stopped.


Device is sleeping.

Definition at line 65 of file can.h.