13#ifndef ZEPHYR_INCLUDE_NET_SOCKETCAN_UTILS_H_
14#define ZEPHYR_INCLUDE_NET_SOCKETCAN_UTILS_H_
39 memset(zframe, 0,
sizeof(*zframe));
63 memset(sframe, 0,
sizeof(*sframe));
93 memset(zfilter, 0,
sizeof(*zfilter));
109 memset(sfilter, 0,
sizeof(*sfilter));
Controller Area Network (CAN) driver API.
#define CAN_FRAME_BRS
Frame uses CAN FD Baud Rate Switch (BRS).
Definition can.h:160
#define CAN_FRAME_FDF
Frame uses CAN FD format (FDF)
Definition can.h:157
static uint8_t can_bytes_to_dlc(uint8_t num_bytes)
Convert from number of bytes to Data Length Code (DLC)
Definition can.h:1754
#define CAN_FRAME_IDE
Frame uses extended (29-bit) CAN ID.
Definition can.h:151
static uint8_t can_dlc_to_bytes(uint8_t dlc)
Convert from Data Length Code (DLC) to the number of data bytes.
Definition can.h:1739
#define CAN_FRAME_RTR
Frame is a Remote Transmission Request (RTR)
Definition can.h:154
#define CAN_FILTER_IDE
Filter matches frames with extended (29-bit) CAN IDs.
Definition can.h:211
static void socketcan_to_can_filter(const struct socketcan_filter *sfilter, struct can_filter *zfilter)
Translate a socketcan_filter struct to a can_filter struct.
Definition socketcan_utils.h:90
#define CANFD_FDF
Mark CAN FD for dual use of struct canfd_frame.
Definition socketcan.h:64
static void socketcan_from_can_frame(const struct can_frame *zframe, struct socketcan_frame *sframe)
Translate a can_frame struct to a socketcan_frame struct.
Definition socketcan_utils.h:60
static void socketcan_to_can_frame(const struct socketcan_frame *sframe, struct can_frame *zframe)
Translate a socketcan_frame struct to a can_frame struct.
Definition socketcan_utils.h:36
#define CANFD_BRS
Bit rate switch (second bitrate for payload data)
Definition socketcan.h:62
static void socketcan_from_can_filter(const struct can_filter *zfilter, struct socketcan_filter *sfilter)
Translate a can_filter struct to a socketcan_filter struct.
Definition socketcan_utils.h:106
#define IS_ENABLED(config_macro)
Check for macro definition in compiler-visible expressions.
Definition util_macro.h:124
#define BIT(n)
Unsigned integer with bit position n set (signed in assembly language).
Definition util_macro.h:44
#define MIN(a, b)
Obtain the minimum of two values.
Definition util.h:391
#define BIT_MASK(n)
Bit mask with bits 0 through n-1 (inclusive) set, or 0 if n is 0.
Definition util_macro.h:68
void * memset(void *buf, int c, size_t n)
void * memcpy(void *ZRESTRICT d, const void *ZRESTRICT s, size_t n)
CAN filter structure.
Definition can.h:218
uint32_t mask
CAN identifier matching mask.
Definition can.h:224
uint8_t flags
Flags.
Definition can.h:226
uint32_t id
CAN identifier to match.
Definition can.h:220
CAN frame structure.
Definition can.h:172
uint8_t dlc
Data Length Code (DLC) indicating data length in bytes.
Definition can.h:176
uint8_t flags
Flags.
Definition can.h:178
uint32_t id
Standard (11-bit) or extended (29-bit) CAN identifier.
Definition can.h:174
uint8_t data[CAN_MAX_DLEN]
Payload data accessed as unsigned 8 bit values.
Definition can.h:197
CAN filter for Linux SocketCAN compatibility.
Definition socketcan.h:131
socketcan_id_t can_mask
The mask applied to can_id for matching.
Definition socketcan.h:135
socketcan_id_t can_id
The CAN identifier to match.
Definition socketcan.h:133
CAN frame for Linux SocketCAN compatibility.
Definition socketcan.h:110
socketcan_id_t can_id
32-bit CAN ID + EFF/RTR/ERR flags.
Definition socketcan.h:112
uint8_t data[8U]
The payload data.
Definition socketcan.h:123
uint8_t len
Frame payload length in bytes.
Definition socketcan.h:114
uint8_t flags
Additional flags for CAN FD.
Definition socketcan.h:116