18#ifndef RT_CANMSG_BOX_SZ
19#define RT_CANMSG_BOX_SZ 16
21#ifndef RT_CANSND_BOX_NUM
22#define RT_CANSND_BOX_NUM 1
58#define RT_CAN_MODE_NORMAL 0
59#define RT_CAN_MODE_LISTEN 1
60#define RT_CAN_MODE_LOOPBACK 2
61#define RT_CAN_MODE_LOOPBACKANLISTEN 3
63#define RT_CAN_MODE_PRIV 0x01
64#define RT_CAN_MODE_NOPRIV 0x00
211#define CAN_RX_FIFO0 (0x00000000U)
212#define CAN_RX_FIFO1 (0x00000001U)
226#ifdef RT_CAN_USING_HDR
233#ifdef RT_CAN_USING_HDR
234#define RT_CAN_FILTER_ITEM_INIT(id,ide,rtr,mode,mask,ind,args) \
235 {(id), (ide), (rtr), (mode),(mask), -1, CAN_RX_FIFO0,(ind), (args)}
236#define RT_CAN_FILTER_STD_INIT(id,ind,args) \
237 RT_CAN_FILTER_ITEM_INIT(id,0,0,0,0xFFFFFFFF,ind,args)
238#define RT_CAN_FILTER_EXT_INIT(id,ind,args) \
239 RT_CAN_FILTER_ITEM_INIT(id,1,0,0,0xFFFFFFFF,ind,args)
240#define RT_CAN_STD_RMT_FILTER_INIT(id,ind,args) \
241 RT_CAN_FILTER_ITEM_INIT(id,0,1,0,0xFFFFFFFF,ind,args)
242#define RT_CAN_EXT_RMT_FILTER_INIT(id,ind,args) \
243 RT_CAN_FILTER_ITEM_INIT(id,1,1,0,0xFFFFFFFF,ind,args)
244#define RT_CAN_STD_RMT_DATA_FILTER_INIT(id,ind,args) \
245 RT_CAN_FILTER_ITEM_INIT(id,0,0,1,0xFFFFFFFF,ind,args)
246#define RT_CAN_EXT_RMT_DATA_FILTER_INIT(id,ind,args) \
247 RT_CAN_FILTER_ITEM_INIT(id,1,0,1,0xFFFFFFFF,ind,args)
250#define RT_CAN_FILTER_ITEM_INIT(id,ide,rtr,mode,mask) \
251 {(id), (ide), (rtr), (mode), (mask), -1, CAN_RX_FIFO0 }
252#define RT_CAN_FILTER_STD_INIT(id) \
253 RT_CAN_FILTER_ITEM_INIT(id,0,0,0,0xFFFFFFFF)
254#define RT_CAN_FILTER_EXT_INIT(id) \
255 RT_CAN_FILTER_ITEM_INIT(id,1,0,0,0xFFFFFFFF)
256#define RT_CAN_STD_RMT_FILTER_INIT(id) \
257 RT_CAN_FILTER_ITEM_INIT(id,0,1,0,0xFFFFFFFF)
258#define RT_CAN_EXT_RMT_FILTER_INIT(id) \
259 RT_CAN_FILTER_ITEM_INIT(id,1,1,0,0xFFFFFFFF)
260#define RT_CAN_STD_RMT_DATA_FILTER_INIT(id) \
261 RT_CAN_FILTER_ITEM_INIT(id,0,0,1,0xFFFFFFFF)
262#define RT_CAN_EXT_RMT_DATA_FILTER_INIT(id) \
263 RT_CAN_FILTER_ITEM_INIT(id,1,0,1,0xFFFFFFFF)
314#ifdef RT_CAN_USING_HDR
318#ifdef RT_CAN_USING_CANFD
330#define CANDEFAULTCONFIG \
339#define RT_CAN_CMD_SET_FILTER 0x13
340#define RT_CAN_CMD_SET_BAUD 0x14
341#define RT_CAN_CMD_SET_MODE 0x15
342#define RT_CAN_CMD_SET_PRIV 0x16
343#define RT_CAN_CMD_GET_STATUS 0x17
344#define RT_CAN_CMD_SET_STATUS_IND 0x18
345#define RT_CAN_CMD_SET_BUS_HOOK 0x19
346#define RT_CAN_CMD_SET_CANFD 0x1A
347#define RT_CAN_CMD_SET_BAUD_FD 0x1B
348#define RT_CAN_CMD_SET_BITTIMING 0x1C
349#define RT_CAN_CMD_START 0x1D
351#define RT_DEVICE_CAN_INT_ERR 0x1000
393#ifdef RT_CAN_USING_HDR
423#ifdef RT_CAN_USING_HDR
424 struct rt_can_hdr *hdr;
426#ifdef RT_CAN_USING_BUS_HOOK
435#define RT_CAN_STDID 0
436#define RT_CAN_EXTID 1
451#ifdef RT_CAN_USING_CANFD
460#ifdef RT_CAN_USING_CANFD
471#ifdef RT_CAN_USING_HDR
473 struct rt_can_hdr *owner;
487#define RT_CAN_SND_RESULT_OK 0
488#define RT_CAN_SND_RESULT_ERR 1
489#define RT_CAN_SND_RESULT_WAIT 2
491#define RT_CAN_EVENT_RX_IND 0x01
492#define RT_CAN_EVENT_TX_DONE 0x02
493#define RT_CAN_EVENT_TX_FAIL 0x03
494#define RT_CAN_EVENT_RX_TIMEOUT 0x05
495#define RT_CAN_EVENT_RXOF_IND 0x06
rt_err_t(* rt_canstatus_ind)(struct rt_can_device *, void *)
void rt_hw_can_isr(struct rt_can_device *can, int event)
CAN interrupt service routine
struct rt_can_msg * rt_can_msg_t
struct rt_can_status * rt_can_status_t
void(* rt_can_bus_hook)(struct rt_can_device *)
struct rt_can_device * rt_can_t
rt_err_t rt_hw_can_register(struct rt_can_device *can, const char *name, const struct rt_can_ops *ops, void *data)
Register a CAN device to device list
struct rt_can_status_ind_type * rt_can_status_ind_type_t
@ RT_CAN_BUS_EXPLICIT_BIT_ERR
@ RT_CAN_BUS_IMPLICIT_BIT_ERR
struct rt_device * rt_device_t
unsigned short rt_uint16_t
CAN bit timing configuration list
struct rt_can_bit_timing * items
struct rt_can_status_ind_type status_indicate
rt_uint32_t timerinitflag
struct can_configure config
const struct rt_can_ops * ops
struct rt_can_status status
struct rt_can_filter_item * items
rt_err_t(* control)(struct rt_can_device *can, int cmd, void *arg)
rt_err_t(* configure)(struct rt_can_device *can, struct can_configure *cfg)
rt_ssize_t(* recvmsg)(struct rt_can_device *can, void *buf, rt_uint32_t boxno)
rt_ssize_t(* sendmsg)(struct rt_can_device *can, const void *buf, rt_uint32_t boxno)
struct rt_can_msg_list * buffer
struct rt_list_node uselist
struct rt_list_node freelist
struct rt_completion completion
struct rt_can_sndbxinx_list * buffer
struct rt_list_node freelist