dev_can.h 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545
  1. /*
  2. * Copyright (c) 2006-2024 RT-Thread Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. * 2015-05-14 aubrcool@qq.com first version
  9. * 2015-07-06 Bernard remove RT_CAN_USING_LED.
  10. * 2022-05-08 hpmicro add CANFD support, fixed typos
  11. */
  12. #ifndef __DEV_CAN_H_
  13. #define __DEV_CAN_H_
  14. #include <rtthread.h>
  15. #ifndef RT_CANMSG_BOX_SZ
  16. #define RT_CANMSG_BOX_SZ 16
  17. #endif
  18. #ifndef RT_CANSND_BOX_NUM
  19. #define RT_CANSND_BOX_NUM 1
  20. #endif
  21. enum CAN_DLC
  22. {
  23. CAN_MSG_0BYTE = 0,
  24. CAN_MSG_1BYTE,
  25. CAN_MSG_2BYTES,
  26. CAN_MSG_3BYTES,
  27. CAN_MSG_4BYTES,
  28. CAN_MSG_5BYTES,
  29. CAN_MSG_6BYTES,
  30. CAN_MSG_7BYTES,
  31. CAN_MSG_8BYTES,
  32. CAN_MSG_12BYTES,
  33. CAN_MSG_16BYTES,
  34. CAN_MSG_20BYTES,
  35. CAN_MSG_24BYTES,
  36. CAN_MSG_32BYTES,
  37. CAN_MSG_48BYTES,
  38. CAN_MSG_64BYTES,
  39. };
  40. enum CANBAUD
  41. {
  42. CAN1MBaud = 1000UL * 1000,/* 1 MBit/sec */
  43. CAN800kBaud = 1000UL * 800, /* 800 kBit/sec */
  44. CAN500kBaud = 1000UL * 500, /* 500 kBit/sec */
  45. CAN250kBaud = 1000UL * 250, /* 250 kBit/sec */
  46. CAN125kBaud = 1000UL * 125, /* 125 kBit/sec */
  47. CAN100kBaud = 1000UL * 100, /* 100 kBit/sec */
  48. CAN50kBaud = 1000UL * 50, /* 50 kBit/sec */
  49. CAN20kBaud = 1000UL * 20, /* 20 kBit/sec */
  50. CAN10kBaud = 1000UL * 10 /* 10 kBit/sec */
  51. };
  52. #define RT_CAN_MODE_NORMAL 0
  53. #define RT_CAN_MODE_LISTEN 1
  54. #define RT_CAN_MODE_LOOPBACK 2
  55. #define RT_CAN_MODE_LOOPBACKANLISTEN 3
  56. #define RT_CAN_MODE_PRIV 0x01
  57. #define RT_CAN_MODE_NOPRIV 0x00
  58. /**
  59. * @addtogroup Drivers RTTHREAD Driver
  60. * @defgroup CAN_Device CAN Driver
  61. *
  62. * @brief CAN driver api
  63. *
  64. * <b>Example</b>
  65. * @code {.c}
  66. * #include <rtthread.h>
  67. * #include "rtdevice.h"
  68. *
  69. * #define CAN_DEV_NAME "can1" // CAN 设备名称
  70. *
  71. * static struct rt_semaphore rx_sem; // 用于接收消息的信号量
  72. * static rt_device_t can_dev; // CAN 设备句柄
  73. *
  74. * // 接收数据回调函数
  75. * static rt_err_t can_rx_call(rt_device_t dev, rt_size_t size)
  76. * {
  77. * // CAN 接收到数据后产生中断,调用此回调函数,然后发送接收信号量
  78. * rt_sem_release(&rx_sem);
  79. *
  80. * return RT_EOK;
  81. * }
  82. *
  83. * static void can_rx_thread(void *parameter)
  84. * {
  85. * int i;
  86. * rt_err_t res;
  87. * struct rt_can_msg rxmsg = {0};
  88. *
  89. * // 设置接收回调函数
  90. * rt_device_set_rx_indicate(can_dev, can_rx_call);
  91. *
  92. * #ifdef RT_CAN_USING_HDR
  93. * struct rt_can_filter_item items[5] =
  94. * {
  95. * RT_CAN_FILTER_ITEM_INIT(0x100, 0, 0, 0, 0x700, RT_NULL, RT_NULL), // std,match ID:0x100~0x1ff,hdr 为 - 1,设置默认过滤表
  96. * RT_CAN_FILTER_ITEM_INIT(0x300, 0, 0, 0, 0x700, RT_NULL, RT_NULL), // std,match ID:0x300~0x3ff,hdr 为 - 1
  97. * RT_CAN_FILTER_ITEM_INIT(0x211, 0, 0, 0, 0x7ff, RT_NULL, RT_NULL), // std,match ID:0x211,hdr 为 - 1
  98. * RT_CAN_FILTER_STD_INIT(0x486, RT_NULL, RT_NULL), // std,match ID:0x486,hdr 为 - 1
  99. * {0x555, 0, 0, 0, 0x7ff, 7,} // std,match ID:0x555,hdr 为 7,指定设置 7 号过滤表
  100. * };
  101. * struct rt_can_filter_config cfg = {5, 1, items}; // 一共有 5 个过滤表
  102. * // 设置硬件过滤表
  103. * res = rt_device_control(can_dev, RT_CAN_CMD_SET_FILTER, &cfg);
  104. * RT_ASSERT(res == RT_EOK);
  105. * #endif
  106. *
  107. * while (1)
  108. * {
  109. * // hdr 值为 - 1,表示直接从 uselist 链表读取数据
  110. * rxmsg.hdr = -1;
  111. * // 阻塞等待接收信号量
  112. * rt_sem_take(&rx_sem, RT_WAITING_FOREVER);
  113. * // 从 CAN 读取一帧数据
  114. * rt_device_read(can_dev, 0, &rxmsg, sizeof(rxmsg));
  115. * // 打印数据 ID 及内容
  116. * rt_kprintf("ID:%x", rxmsg.id);
  117. * for (i = 0; i < 8; i++)
  118. * {
  119. * rt_kprintf("%2x", rxmsg.data[i]);
  120. * }
  121. *
  122. * rt_kprintf("\n");
  123. * }
  124. * }
  125. *
  126. * int can_sample(int argc, char *argv[])
  127. * {
  128. * struct rt_can_msg msg = {0};
  129. * rt_err_t res;
  130. * rt_size_t size;
  131. * rt_thread_t thread;
  132. * char can_name[RT_NAME_MAX];
  133. *
  134. * if (argc == 2)
  135. * {
  136. * rt_strncpy(can_name, argv[1], RT_NAME_MAX);
  137. * }
  138. * else
  139. * {
  140. * rt_strncpy(can_name, CAN_DEV_NAME, RT_NAME_MAX);
  141. * }
  142. * // 查找 CAN 设备
  143. * can_dev = rt_device_find(can_name);
  144. * if (!can_dev)
  145. * {
  146. * rt_kprintf("find %s failed!\n", can_name);
  147. * return -RT_ERROR;
  148. * }
  149. *
  150. * // 初始化 CAN 接收信号量
  151. * rt_sem_init(&rx_sem, "rx_sem", 0, RT_IPC_FLAG_FIFO);
  152. *
  153. * // 以中断接收及发送方式打开 CAN 设备
  154. * res = rt_device_open(can_dev, RT_DEVICE_FLAG_INT_TX | RT_DEVICE_FLAG_INT_RX);
  155. * RT_ASSERT(res == RT_EOK);
  156. * // 创建数据接收线程
  157. * thread = rt_thread_create("can_rx", can_rx_thread, RT_NULL, 1024, 25, 10);
  158. * if (thread != RT_NULL)
  159. * {
  160. * rt_thread_startup(thread);
  161. * }
  162. * else
  163. * {
  164. * rt_kprintf("create can_rx thread failed!\n");
  165. * }
  166. *
  167. * msg.id = 0x78; // ID 为 0x78
  168. * msg.ide = RT_CAN_STDID; // 标准格式
  169. * msg.rtr = RT_CAN_DTR; // 数据帧
  170. * msg.len = 8; // 数据长度为 8
  171. * // 待发送的 8 字节数据
  172. * msg.data[0] = 0x00;
  173. * msg.data[1] = 0x11;
  174. * msg.data[2] = 0x22;
  175. * msg.data[3] = 0x33;
  176. * msg.data[4] = 0x44;
  177. * msg.data[5] = 0x55;
  178. * msg.data[6] = 0x66;
  179. * msg.data[7] = 0x77;
  180. * // 发送一帧 CAN 数据
  181. * size = rt_device_write(can_dev, 0, &msg, sizeof(msg));
  182. * if (size == 0)
  183. * {
  184. * rt_kprintf("can dev write data failed!\n");
  185. * }
  186. *
  187. * return res;
  188. * }
  189. * // 导出到 msh 命令列表中
  190. * MSH_CMD_EXPORT(can_sample, can device sample);
  191. * @endcode
  192. *
  193. * @ingroup Drivers
  194. *
  195. */
  196. /*!
  197. * @addtogroup CAN_Device
  198. * @{
  199. */
  200. #define CAN_RX_FIFO0 (0x00000000U) /*!< CAN receive FIFO 0 */
  201. #define CAN_RX_FIFO1 (0x00000001U) /*!< CAN receive FIFO 1 */
  202. /**
  203. * @brief CAN filter item
  204. */
  205. struct rt_can_filter_item
  206. {
  207. rt_uint32_t id : 29;
  208. rt_uint32_t ide : 1;
  209. rt_uint32_t rtr : 1;
  210. rt_uint32_t mode : 1;
  211. rt_uint32_t mask;
  212. rt_int32_t hdr_bank;/*Should be defined as:rx.FilterBank,which should be changed to rt_int32_t hdr_bank*/
  213. rt_uint32_t rxfifo;/*Add a configuration item that CAN_RX_FIFO0/CAN_RX_FIFO1*/
  214. #ifdef RT_CAN_USING_HDR
  215. rt_err_t (*ind)(rt_device_t dev, void *args , rt_int32_t hdr, rt_size_t size);
  216. void *args;
  217. #endif /*RT_CAN_USING_HDR*/
  218. };
  219. #ifdef RT_CAN_USING_HDR
  220. #define RT_CAN_FILTER_ITEM_INIT(id,ide,rtr,mode,mask,ind,args) \
  221. {(id), (ide), (rtr), (mode),(mask), -1, CAN_RX_FIFO0,(ind), (args)}/*0:CAN_RX_FIFO0*/
  222. #define RT_CAN_FILTER_STD_INIT(id,ind,args) \
  223. RT_CAN_FILTER_ITEM_INIT(id,0,0,0,0xFFFFFFFF,ind,args)
  224. #define RT_CAN_FILTER_EXT_INIT(id,ind,args) \
  225. RT_CAN_FILTER_ITEM_INIT(id,1,0,0,0xFFFFFFFF,ind,args)
  226. #define RT_CAN_STD_RMT_FILTER_INIT(id,ind,args) \
  227. RT_CAN_FILTER_ITEM_INIT(id,0,1,0,0xFFFFFFFF,ind,args)
  228. #define RT_CAN_EXT_RMT_FILTER_INIT(id,ind,args) \
  229. RT_CAN_FILTER_ITEM_INIT(id,1,1,0,0xFFFFFFFF,ind,args)
  230. #define RT_CAN_STD_RMT_DATA_FILTER_INIT(id,ind,args) \
  231. RT_CAN_FILTER_ITEM_INIT(id,0,0,1,0xFFFFFFFF,ind,args)
  232. #define RT_CAN_EXT_RMT_DATA_FILTER_INIT(id,ind,args) \
  233. RT_CAN_FILTER_ITEM_INIT(id,1,0,1,0xFFFFFFFF,ind,args)
  234. #else
  235. #define RT_CAN_FILTER_ITEM_INIT(id,ide,rtr,mode,mask) \
  236. {(id), (ide), (rtr), (mode), (mask), -1, CAN_RX_FIFO0 }/*0:CAN_RX_FIFO0*/
  237. #define RT_CAN_FILTER_STD_INIT(id) \
  238. RT_CAN_FILTER_ITEM_INIT(id,0,0,0,0xFFFFFFFF)
  239. #define RT_CAN_FILTER_EXT_INIT(id) \
  240. RT_CAN_FILTER_ITEM_INIT(id,1,0,0,0xFFFFFFFF)
  241. #define RT_CAN_STD_RMT_FILTER_INIT(id) \
  242. RT_CAN_FILTER_ITEM_INIT(id,0,1,0,0xFFFFFFFF)
  243. #define RT_CAN_EXT_RMT_FILTER_INIT(id) \
  244. RT_CAN_FILTER_ITEM_INIT(id,1,1,0,0xFFFFFFFF)
  245. #define RT_CAN_STD_RMT_DATA_FILTER_INIT(id) \
  246. RT_CAN_FILTER_ITEM_INIT(id,0,0,1,0xFFFFFFFF)
  247. #define RT_CAN_EXT_RMT_DATA_FILTER_INIT(id) \
  248. RT_CAN_FILTER_ITEM_INIT(id,1,0,1,0xFFFFFFFF)
  249. #endif
  250. /**
  251. * @brief CAN filter configuration
  252. */
  253. struct rt_can_filter_config
  254. {
  255. rt_uint32_t count;
  256. rt_uint32_t actived;
  257. struct rt_can_filter_item *items;
  258. };
  259. /**
  260. * @brief CAN timing configuration
  261. */
  262. struct rt_can_bit_timing
  263. {
  264. rt_uint16_t prescaler; /* Pre-scaler */
  265. rt_uint16_t num_seg1; /* Bit Timing Segment 1, in terms of Tq */
  266. rt_uint16_t num_seg2; /* Bit Timing Segment 2, in terms of Tq */
  267. rt_uint8_t num_sjw; /* Synchronization Jump Width, in terms of Tq */
  268. rt_uint8_t num_sspoff; /* Secondary Sample Point Offset, in terms of Tq */
  269. };
  270. /**
  271. * @brief CAN bit timing configuration list
  272. * @note
  273. * items[0] always for CAN2.0/CANFD Arbitration Phase
  274. * items[1] always for CANFD (if it exists)
  275. */
  276. struct rt_can_bit_timing_config
  277. {
  278. rt_uint32_t count;
  279. struct rt_can_bit_timing *items;
  280. };
  281. /**
  282. * @brief CAN configuration
  283. */
  284. struct can_configure
  285. {
  286. rt_uint32_t baud_rate;
  287. rt_uint32_t msgboxsz;
  288. rt_uint32_t sndboxnumber;
  289. rt_uint32_t mode : 8;
  290. rt_uint32_t privmode : 8;
  291. rt_uint32_t reserved : 16;
  292. rt_uint32_t ticks;
  293. #ifdef RT_CAN_USING_HDR
  294. rt_uint32_t maxhdr;
  295. #endif
  296. #ifdef RT_CAN_USING_CANFD
  297. rt_uint32_t baud_rate_fd; /* CANFD data bit rate*/
  298. rt_uint32_t use_bit_timing: 8; /* Use the bit timing for CAN timing configuration */
  299. rt_uint32_t enable_canfd : 8; /* Enable CAN-FD mode */
  300. rt_uint32_t reserved1 : 16;
  301. /* The below fields take effect only if use_bit_timing is non-zero */
  302. struct rt_can_bit_timing can_timing; /* CAN bit-timing /CANFD bit-timing for arbitration phase */
  303. struct rt_can_bit_timing canfd_timing; /* CANFD bit-timing for datat phase */
  304. #endif
  305. };
  306. #define CANDEFAULTCONFIG \
  307. {\
  308. CAN1MBaud,\
  309. RT_CANMSG_BOX_SZ,\
  310. RT_CANSND_BOX_NUM,\
  311. RT_CAN_MODE_NORMAL,\
  312. };
  313. struct rt_can_ops;
  314. #define RT_CAN_CMD_SET_FILTER 0x13
  315. #define RT_CAN_CMD_SET_BAUD 0x14
  316. #define RT_CAN_CMD_SET_MODE 0x15
  317. #define RT_CAN_CMD_SET_PRIV 0x16
  318. #define RT_CAN_CMD_GET_STATUS 0x17
  319. #define RT_CAN_CMD_SET_STATUS_IND 0x18
  320. #define RT_CAN_CMD_SET_BUS_HOOK 0x19
  321. #define RT_CAN_CMD_SET_CANFD 0x1A
  322. #define RT_CAN_CMD_SET_BAUD_FD 0x1B
  323. #define RT_CAN_CMD_SET_BITTIMING 0x1C
  324. #define RT_DEVICE_CAN_INT_ERR 0x1000
  325. enum RT_CAN_STATUS_MODE
  326. {
  327. NORMAL = 0,
  328. ERRWARNING = 1,
  329. ERRPASSIVE = 2,
  330. BUSOFF = 4,
  331. };
  332. enum RT_CAN_BUS_ERR
  333. {
  334. RT_CAN_BUS_NO_ERR = 0,
  335. RT_CAN_BUS_BIT_PAD_ERR = 1,
  336. RT_CAN_BUS_FORMAT_ERR = 2,
  337. RT_CAN_BUS_ACK_ERR = 3,
  338. RT_CAN_BUS_IMPLICIT_BIT_ERR = 4,
  339. RT_CAN_BUS_EXPLICIT_BIT_ERR = 5,
  340. RT_CAN_BUS_CRC_ERR = 6,
  341. };
  342. /**
  343. * @brief CAN status
  344. */
  345. struct rt_can_status
  346. {
  347. rt_uint32_t rcverrcnt;
  348. rt_uint32_t snderrcnt;
  349. rt_uint32_t errcode;
  350. rt_uint32_t rcvpkg;
  351. rt_uint32_t dropedrcvpkg;
  352. rt_uint32_t sndpkg;
  353. rt_uint32_t dropedsndpkg;
  354. rt_uint32_t bitpaderrcnt;
  355. rt_uint32_t formaterrcnt;
  356. rt_uint32_t ackerrcnt;
  357. rt_uint32_t biterrcnt;
  358. rt_uint32_t crcerrcnt;
  359. rt_uint32_t rcvchange;
  360. rt_uint32_t sndchange;
  361. rt_uint32_t lasterrtype;
  362. };
  363. #ifdef RT_CAN_USING_HDR
  364. struct rt_can_hdr
  365. {
  366. rt_uint32_t connected;
  367. rt_uint32_t msgs;
  368. struct rt_can_filter_item filter;
  369. struct rt_list_node list;
  370. };
  371. #endif
  372. struct rt_can_device;
  373. typedef rt_err_t (*rt_canstatus_ind)(struct rt_can_device *, void *);
  374. typedef struct rt_can_status_ind_type
  375. {
  376. rt_canstatus_ind ind;
  377. void *args;
  378. } *rt_can_status_ind_type_t;
  379. typedef void (*rt_can_bus_hook)(struct rt_can_device *);
  380. struct rt_can_device
  381. {
  382. struct rt_device parent;
  383. const struct rt_can_ops *ops;
  384. struct can_configure config;
  385. struct rt_can_status status;
  386. rt_uint32_t timerinitflag;
  387. struct rt_timer timer;
  388. struct rt_can_status_ind_type status_indicate;
  389. #ifdef RT_CAN_USING_HDR
  390. struct rt_can_hdr *hdr;
  391. #endif
  392. #ifdef RT_CAN_USING_BUS_HOOK
  393. rt_can_bus_hook bus_hook;
  394. #endif /*RT_CAN_USING_BUS_HOOK*/
  395. struct rt_mutex lock;
  396. void *can_rx;
  397. void *can_tx;
  398. };
  399. typedef struct rt_can_device *rt_can_t;
  400. #define RT_CAN_STDID 0
  401. #define RT_CAN_EXTID 1
  402. #define RT_CAN_DTR 0
  403. #define RT_CAN_RTR 1
  404. typedef struct rt_can_status *rt_can_status_t;
  405. struct rt_can_msg
  406. {
  407. rt_uint32_t id : 29;
  408. rt_uint32_t ide : 1;
  409. rt_uint32_t rtr : 1;
  410. rt_uint32_t rsv : 1;
  411. rt_uint32_t len : 8;
  412. rt_uint32_t priv : 8;
  413. rt_int32_t hdr_index : 8;/*Should be defined as:rx.FilterMatchIndex,which should be changed to rt_int32_t hdr_index : 8*/
  414. #ifdef RT_CAN_USING_CANFD
  415. rt_uint32_t fd_frame : 1;
  416. rt_uint32_t brs : 1;
  417. rt_uint32_t rxfifo : 2;/*Redefined to return :CAN RX FIFO0/CAN RX FIFO1*/
  418. rt_uint32_t reserved : 4;
  419. #else
  420. rt_uint32_t rxfifo : 2;/*Redefined to return :CAN RX FIFO0/CAN RX FIFO1*/
  421. rt_uint32_t reserved : 6;
  422. #endif
  423. #ifdef RT_CAN_USING_CANFD
  424. rt_uint8_t data[64];
  425. #else
  426. rt_uint8_t data[8];
  427. #endif
  428. };
  429. typedef struct rt_can_msg *rt_can_msg_t;
  430. struct rt_can_msg_list
  431. {
  432. struct rt_list_node list;
  433. #ifdef RT_CAN_USING_HDR
  434. struct rt_list_node hdrlist;
  435. struct rt_can_hdr *owner;
  436. #endif
  437. struct rt_can_msg data;
  438. };
  439. struct rt_can_rx_fifo
  440. {
  441. /* software fifo */
  442. struct rt_can_msg_list *buffer;
  443. rt_uint32_t freenumbers;
  444. struct rt_list_node freelist;
  445. struct rt_list_node uselist;
  446. };
  447. #define RT_CAN_SND_RESULT_OK 0
  448. #define RT_CAN_SND_RESULT_ERR 1
  449. #define RT_CAN_SND_RESULT_WAIT 2
  450. #define RT_CAN_EVENT_RX_IND 0x01 /* Rx indication */
  451. #define RT_CAN_EVENT_TX_DONE 0x02 /* Tx complete */
  452. #define RT_CAN_EVENT_TX_FAIL 0x03 /* Tx fail */
  453. #define RT_CAN_EVENT_RX_TIMEOUT 0x05 /* Rx timeout */
  454. #define RT_CAN_EVENT_RXOF_IND 0x06 /* Rx overflow */
  455. struct rt_can_sndbxinx_list
  456. {
  457. struct rt_list_node list;
  458. struct rt_completion completion;
  459. rt_uint32_t result;
  460. };
  461. struct rt_can_tx_fifo
  462. {
  463. struct rt_can_sndbxinx_list *buffer;
  464. struct rt_semaphore sem;
  465. struct rt_list_node freelist;
  466. };
  467. /**
  468. * @brief CAN operators
  469. */
  470. struct rt_can_ops
  471. {
  472. rt_err_t (*configure)(struct rt_can_device *can, struct can_configure *cfg);
  473. rt_err_t (*control)(struct rt_can_device *can, int cmd, void *arg);
  474. rt_ssize_t (*sendmsg)(struct rt_can_device *can, const void *buf, rt_uint32_t boxno);
  475. rt_ssize_t (*recvmsg)(struct rt_can_device *can, void *buf, rt_uint32_t boxno);
  476. };
  477. /**
  478. * @brief Register a CAN device to device list
  479. *
  480. * @param can the CAN device object
  481. * @param name the name of CAN device
  482. * @param ops the CAN device operators
  483. * @param data the private data of CAN device
  484. *
  485. * @return the error code, RT_EOK on successfully
  486. */
  487. rt_err_t rt_hw_can_register(struct rt_can_device *can,
  488. const char *name,
  489. const struct rt_can_ops *ops,
  490. void *data);
  491. /**
  492. * @brief CAN interrupt service routine
  493. *
  494. * @param can the CAN device
  495. * @param event the event mask
  496. */
  497. void rt_hw_can_isr(struct rt_can_device *can, int event);
  498. /*! @}*/
  499. #endif /*__DEV_CAN_H*/