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.

Files

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  include/can/pkt.h
 CAN memory allocation module.
 
file  can/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...
 

Macros

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

Typedefs

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

Enumerations

enum  can_state {
  CAN_STATE_ERROR_ACTIVE = 0, CAN_STATE_ERROR_WARNING, CAN_STATE_ERROR_PASSIVE, CAN_STATE_BUS_OFF,
  CAN_STATE_STOPPED, CAN_STATE_SLEEPING, CAN_STATE_MAX
}
 CAN operational and error states. More...
 

CAN_ID flags and masks

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

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.

Enumerator
CAN_STATE_ERROR_ACTIVE 

RX/TX error count < 96.

CAN_STATE_ERROR_WARNING 

RX/TX error count < 128.

CAN_STATE_ERROR_PASSIVE 

RX/TX error count < 256.

CAN_STATE_BUS_OFF 

RX/TX error count >= 256.

CAN_STATE_STOPPED 

Device is stopped.

CAN_STATE_SLEEPING 

Device is sleeping.

Definition at line 65 of file can.h.