Zephyr Project API  3.2.0
A Scalable Open Source RTOS
can.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2021 Vestas Wind Systems A/S
3 * Copyright (c) 2018 Alexander Wachter
4 *
5 * SPDX-License-Identifier: Apache-2.0
6 */
7
8#ifndef ZEPHYR_INCLUDE_DRIVERS_CAN_H_
9#define ZEPHYR_INCLUDE_DRIVERS_CAN_H_
10
11#include <zephyr/types.h>
12#include <zephyr/device.h>
13#include <string.h>
14#include <zephyr/sys/util.h>
15
16#ifdef __cplusplus
17extern "C" {
18#endif
19
35#define CAN_STD_ID_MASK 0x7FFU
39#define CAN_MAX_STD_ID CAN_STD_ID_MASK
43#define CAN_EXT_ID_MASK 0x1FFFFFFFU
47#define CAN_MAX_EXT_ID CAN_EXT_ID_MASK
51#define CAN_MAX_DLC 8U
55#define CANFD_MAX_DLC 15U
56
61#ifndef CONFIG_CAN_FD_MODE
62#define CAN_MAX_DLEN 8U
63#else
64#define CAN_MAX_DLEN 64U
65#endif /* CONFIG_CAN_FD_MODE */
66
79#define CAN_MODE_NORMAL 0
80
82#define CAN_MODE_LOOPBACK BIT(0)
83
85#define CAN_MODE_LISTENONLY BIT(1)
86
88#define CAN_MODE_FD BIT(2)
89
91#define CAN_MODE_ONE_SHOT BIT(3)
92
94#define CAN_MODE_3_SAMPLES BIT(4)
95
107
122};
123
134
144
148struct can_frame {
162 uint8_t res : 7; /* reserved/padding. */
164#if defined(CONFIG_CAN_RX_TIMESTAMP) || defined(__DOXYGEN__)
173#else
175 uint8_t res0; /* reserved/padding. */
176 uint8_t res1; /* reserved/padding. */
178#endif
180 union {
181 uint8_t data[CAN_MAX_DLEN];
182 uint32_t data_32[ceiling_fraction(CAN_MAX_DLEN, sizeof(uint32_t))];
183 };
184};
185
193 uint32_t res0 : 1;
204 uint32_t res1 : 1;
212 uint32_t res2 : 1;
214};
215
224};
225
269};
270
279typedef void (*can_tx_callback_t)(const struct device *dev, int error, void *user_data);
280
288typedef void (*can_rx_callback_t)(const struct device *dev, struct can_frame *frame,
289 void *user_data);
290
299typedef void (*can_state_change_callback_t)(const struct device *dev,
300 enum can_state state,
301 struct can_bus_err_cnt err_cnt,
302 void *user_data);
303
314typedef int (*can_set_timing_t)(const struct device *dev,
315 const struct can_timing *timing);
316
321typedef int (*can_set_timing_data_t)(const struct device *dev,
322 const struct can_timing *timing_data);
323
328typedef int (*can_get_capabilities_t)(const struct device *dev, can_mode_t *cap);
329
334typedef int (*can_start_t)(const struct device *dev);
335
340typedef int (*can_stop_t)(const struct device *dev);
341
346typedef int (*can_set_mode_t)(const struct device *dev, can_mode_t mode);
347
355typedef int (*can_send_t)(const struct device *dev,
356 const struct can_frame *frame,
358 void *user_data);
359
364typedef int (*can_add_rx_filter_t)(const struct device *dev,
365 can_rx_callback_t callback,
366 void *user_data,
367 const struct can_filter *filter);
368
373typedef void (*can_remove_rx_filter_t)(const struct device *dev, int filter_id);
374
379typedef int (*can_recover_t)(const struct device *dev, k_timeout_t timeout);
380
385typedef int (*can_get_state_t)(const struct device *dev, enum can_state *state,
386 struct can_bus_err_cnt *err_cnt);
387
392typedef void(*can_set_state_change_callback_t)(const struct device *dev,
394 void *user_data);
395
400typedef int (*can_get_core_clock_t)(const struct device *dev, uint32_t *rate);
401
406typedef int (*can_get_max_filters_t)(const struct device *dev, enum can_ide id_type);
407
412typedef int (*can_get_max_bitrate_t)(const struct device *dev, uint32_t *max_bitrate);
413
414__subsystem struct can_driver_api {
415 can_get_capabilities_t get_capabilities;
416 can_start_t start;
417 can_stop_t stop;
418 can_set_mode_t set_mode;
419 can_set_timing_t set_timing;
420 can_send_t send;
421 can_add_rx_filter_t add_rx_filter;
422 can_remove_rx_filter_t remove_rx_filter;
423#if !defined(CONFIG_CAN_AUTO_BUS_OFF_RECOVERY) || defined(__DOXYGEN__)
424 can_recover_t recover;
425#endif /* CONFIG_CAN_AUTO_BUS_OFF_RECOVERY */
426 can_get_state_t get_state;
427 can_set_state_change_callback_t set_state_change_callback;
428 can_get_core_clock_t get_core_clock;
429 can_get_max_filters_t get_max_filters;
430 can_get_max_bitrate_t get_max_bitrate;
431 /* Min values for the timing registers */
432 struct can_timing timing_min;
433 /* Max values for the timing registers */
434 struct can_timing timing_max;
435#if defined(CONFIG_CAN_FD_MODE) || defined(__DOXYGEN__)
436 can_set_timing_data_t set_timing_data;
437 /* Min values for the timing registers during the data phase */
438 struct can_timing timing_data_min;
439 /* Max values for the timing registers during the data phase */
440 struct can_timing timing_data_max;
441#endif /* CONFIG_CAN_FD_MODE */
442};
443
446#if defined(CONFIG_CAN_STATS) || defined(__DOXYGEN__)
447
448#include <zephyr/stats/stats.h>
449
453STATS_SECT_ENTRY32(bit0_error)
454STATS_SECT_ENTRY32(bit1_error)
455STATS_SECT_ENTRY32(stuff_error)
456STATS_SECT_ENTRY32(crc_error)
457STATS_SECT_ENTRY32(form_error)
458STATS_SECT_ENTRY32(ack_error)
460
462STATS_NAME(can, bit0_error)
463STATS_NAME(can, bit1_error)
464STATS_NAME(can, stuff_error)
465STATS_NAME(can, crc_error)
466STATS_NAME(can, form_error)
467STATS_NAME(can, ack_error)
468STATS_NAME_END(can);
469
478 struct stats_can stats;
479};
480
486#define Z_CAN_GET_STATS(dev_) \
487 CONTAINER_OF(dev_->state, struct can_device_state, devstate)->stats
488
499#define CAN_STATS_BIT0_ERROR_INC(dev_) \
500 STATS_INC(Z_CAN_GET_STATS(dev_), bit0_error)
501
510#define CAN_STATS_BIT1_ERROR_INC(dev_) \
511 STATS_INC(Z_CAN_GET_STATS(dev_), bit1_error)
512
521#define CAN_STATS_STUFF_ERROR_INC(dev_) \
522 STATS_INC(Z_CAN_GET_STATS(dev_), stuff_error)
523
532#define CAN_STATS_CRC_ERROR_INC(dev_) \
533 STATS_INC(Z_CAN_GET_STATS(dev_), crc_error)
534
543#define CAN_STATS_FORM_ERROR_INC(dev_) \
544 STATS_INC(Z_CAN_GET_STATS(dev_), form_error)
545
554#define CAN_STATS_ACK_ERROR_INC(dev_) \
555 STATS_INC(Z_CAN_GET_STATS(dev_), ack_error)
556
562#define Z_CAN_DEVICE_STATE_DEFINE(node_id, dev_name) \
563 static struct can_device_state Z_DEVICE_STATE_NAME(dev_name) \
564 __attribute__((__section__(".z_devstate")));
565
572#define Z_CAN_INIT_FN(dev_name, init_fn) \
573 static inline int UTIL_CAT(dev_name, _init)(const struct device *dev) \
574 { \
575 struct can_device_state *state = \
576 CONTAINER_OF(dev->state, struct can_device_state, devstate); \
577 stats_init(&state->stats.s_hdr, STATS_SIZE_32, 6, \
578 STATS_NAME_INIT_PARMS(can)); \
579 stats_register(dev->name, &(state->stats.s_hdr)); \
580 return init_fn(dev); \
581 }
582
605#define CAN_DEVICE_DT_DEFINE(node_id, init_fn, pm_device, \
606 data_ptr, cfg_ptr, level, prio, \
607 api_ptr, ...) \
608 Z_CAN_DEVICE_STATE_DEFINE(node_id, Z_DEVICE_DT_DEV_NAME(node_id)); \
609 Z_CAN_INIT_FN(Z_DEVICE_DT_DEV_NAME(node_id), init_fn) \
610 Z_DEVICE_DEFINE(node_id, Z_DEVICE_DT_DEV_NAME(node_id), \
611 DEVICE_DT_NAME(node_id), \
612 &UTIL_CAT(Z_DEVICE_DT_DEV_NAME(node_id), _init), \
613 pm_device, \
614 data_ptr, cfg_ptr, level, prio, \
615 api_ptr, \
616 &(Z_DEVICE_STATE_NAME(Z_DEVICE_DT_DEV_NAME(node_id)).devstate), \
617 __VA_ARGS__)
618
619#else /* CONFIG_CAN_STATS */
620
621#define CAN_STATS_BIT0_ERROR_INC(dev_)
622#define CAN_STATS_BIT1_ERROR_INC(dev_)
623#define CAN_STATS_STUFF_ERROR_INC(dev_)
624#define CAN_STATS_CRC_ERROR_INC(dev_)
625#define CAN_STATS_FORM_ERROR_INC(dev_)
626#define CAN_STATS_ACK_ERROR_INC(dev_)
627
628#define CAN_DEVICE_DT_DEFINE(node_id, init_fn, pm_device, \
629 data_ptr, cfg_ptr, level, prio, \
630 api_ptr, ...) \
631 DEVICE_DT_DEFINE(node_id, init_fn, pm_device, \
632 data_ptr, cfg_ptr, level, prio, \
633 api_ptr, __VA_ARGS__)
634
635#endif /* CONFIG_CAN_STATS */
636
644#define CAN_DEVICE_DT_INST_DEFINE(inst, ...) \
645 CAN_DEVICE_DT_DEFINE(DT_DRV_INST(inst), __VA_ARGS__)
646
663__syscall int can_get_core_clock(const struct device *dev, uint32_t *rate);
664
665static inline int z_impl_can_get_core_clock(const struct device *dev, uint32_t *rate)
666{
667 const struct can_driver_api *api = (const struct can_driver_api *)dev->api;
668
669 return api->get_core_clock(dev, rate);
670}
671
683__syscall int can_get_max_bitrate(const struct device *dev, uint32_t *max_bitrate);
684
685static inline int z_impl_can_get_max_bitrate(const struct device *dev, uint32_t *max_bitrate)
686{
687 const struct can_driver_api *api = (const struct can_driver_api *)dev->api;
688
689 if (api->get_max_bitrate == NULL) {
690 return -ENOSYS;
691 }
692
693 return api->get_max_bitrate(dev, max_bitrate);
694}
695
703__syscall const struct can_timing *can_get_timing_min(const struct device *dev);
704
705static inline const struct can_timing *z_impl_can_get_timing_min(const struct device *dev)
706{
707 const struct can_driver_api *api = (const struct can_driver_api *)dev->api;
708
709 return &api->timing_min;
710}
711
719__syscall const struct can_timing *can_get_timing_max(const struct device *dev);
720
721static inline const struct can_timing *z_impl_can_get_timing_max(const struct device *dev)
722{
723 const struct can_driver_api *api = (const struct can_driver_api *)dev->api;
724
725 return &api->timing_max;
726}
727
749__syscall int can_calc_timing(const struct device *dev, struct can_timing *res,
750 uint32_t bitrate, uint16_t sample_pnt);
751
765__syscall const struct can_timing *can_get_timing_data_min(const struct device *dev);
766
767#ifdef CONFIG_CAN_FD_MODE
768static inline const struct can_timing *z_impl_can_get_timing_data_min(const struct device *dev)
769{
770 const struct can_driver_api *api = (const struct can_driver_api *)dev->api;
771
772 return &api->timing_data_min;
773}
774#endif /* CONFIG_CAN_FD_MODE */
775
789__syscall const struct can_timing *can_get_timing_data_max(const struct device *dev);
790
791#ifdef CONFIG_CAN_FD_MODE
792static inline const struct can_timing *z_impl_can_get_timing_data_max(const struct device *dev)
793{
794 const struct can_driver_api *api = (const struct can_driver_api *)dev->api;
795
796 return &api->timing_data_max;
797}
798#endif /* CONFIG_CAN_FD_MODE */
799
819__syscall int can_calc_timing_data(const struct device *dev, struct can_timing *res,
820 uint32_t bitrate, uint16_t sample_pnt);
821
839__syscall int can_set_timing_data(const struct device *dev,
840 const struct can_timing *timing_data);
841
842#ifdef CONFIG_CAN_FD_MODE
843static inline int z_impl_can_set_timing_data(const struct device *dev,
844 const struct can_timing *timing_data)
845{
846 const struct can_driver_api *api = (const struct can_driver_api *)dev->api;
847
848 return api->set_timing_data(dev, timing_data);
849}
850#endif /* CONFIG_CAN_FD_MODE */
851
880__syscall int can_set_bitrate_data(const struct device *dev, uint32_t bitrate_data);
881
898int can_calc_prescaler(const struct device *dev, struct can_timing *timing,
899 uint32_t bitrate);
900
904#define CAN_SJW_NO_CHANGE 0
905
920__syscall int can_set_timing(const struct device *dev,
921 const struct can_timing *timing);
922
923static inline int z_impl_can_set_timing(const struct device *dev,
924 const struct can_timing *timing)
925{
926 const struct can_driver_api *api = (const struct can_driver_api *)dev->api;
927
928 return api->set_timing(dev, timing);
929}
930
944__syscall int can_get_capabilities(const struct device *dev, can_mode_t *cap);
945
946static inline int z_impl_can_get_capabilities(const struct device *dev, can_mode_t *cap)
947{
948 const struct can_driver_api *api = (const struct can_driver_api *)dev->api;
949
950 return api->get_capabilities(dev, cap);
951}
952
968__syscall int can_start(const struct device *dev);
969
970static inline int z_impl_can_start(const struct device *dev)
971{
972 const struct can_driver_api *api = (const struct can_driver_api *)dev->api;
973
974 return api->start(dev);
975}
976
992__syscall int can_stop(const struct device *dev);
993
994static inline int z_impl_can_stop(const struct device *dev)
995{
996 const struct can_driver_api *api = (const struct can_driver_api *)dev->api;
997
998 return api->stop(dev);
999}
1000
1011__syscall int can_set_mode(const struct device *dev, can_mode_t mode);
1012
1013static inline int z_impl_can_set_mode(const struct device *dev, can_mode_t mode)
1014{
1015 const struct can_driver_api *api = (const struct can_driver_api *)dev->api;
1016
1017 return api->set_mode(dev, mode);
1018}
1019
1045__syscall int can_set_bitrate(const struct device *dev, uint32_t bitrate);
1046
1098__syscall int can_send(const struct device *dev, const struct can_frame *frame,
1100 void *user_data);
1101
1132static inline int can_add_rx_filter(const struct device *dev, can_rx_callback_t callback,
1133 void *user_data, const struct can_filter *filter)
1134{
1135 const struct can_driver_api *api = (const struct can_driver_api *)dev->api;
1136
1137 return api->add_rx_filter(dev, callback, user_data, filter);
1138}
1139
1150#define CAN_MSGQ_DEFINE(name, max_frames) \
1151 K_MSGQ_DEFINE(name, sizeof(struct can_frame), max_frames, 4)
1152
1175__syscall int can_add_rx_filter_msgq(const struct device *dev, struct k_msgq *msgq,
1176 const struct can_filter *filter);
1177
1187__syscall void can_remove_rx_filter(const struct device *dev, int filter_id);
1188
1189static inline void z_impl_can_remove_rx_filter(const struct device *dev, int filter_id)
1190{
1191 const struct can_driver_api *api = (const struct can_driver_api *)dev->api;
1192
1193 return api->remove_rx_filter(dev, filter_id);
1194}
1195
1208__syscall int can_get_max_filters(const struct device *dev, enum can_ide id_type);
1209
1210static inline int z_impl_can_get_max_filters(const struct device *dev, enum can_ide id_type)
1211{
1212 const struct can_driver_api *api = (const struct can_driver_api *)dev->api;
1213
1214 if (api->get_max_filters == NULL) {
1215 return -ENOSYS;
1216 }
1217
1218 return api->get_max_filters(dev, id_type);
1219}
1220
1242__syscall int can_get_state(const struct device *dev, enum can_state *state,
1243 struct can_bus_err_cnt *err_cnt);
1244
1245static inline int z_impl_can_get_state(const struct device *dev, enum can_state *state,
1246 struct can_bus_err_cnt *err_cnt)
1247{
1248 const struct can_driver_api *api = (const struct can_driver_api *)dev->api;
1249
1250 return api->get_state(dev, state, err_cnt);
1251}
1252
1268#if !defined(CONFIG_CAN_AUTO_BUS_OFF_RECOVERY) || defined(__DOXYGEN__)
1269__syscall int can_recover(const struct device *dev, k_timeout_t timeout);
1270
1271static inline int z_impl_can_recover(const struct device *dev, k_timeout_t timeout)
1272{
1273 const struct can_driver_api *api = (const struct can_driver_api *)dev->api;
1274
1275 return api->recover(dev, timeout);
1276}
1277#else /* CONFIG_CAN_AUTO_BUS_OFF_RECOVERY */
1278/* This implementation prevents inking errors for auto recovery */
1279static inline int z_impl_can_recover(const struct device *dev, k_timeout_t timeout)
1280{
1281 ARG_UNUSED(dev);
1282 ARG_UNUSED(timeout);
1283 return 0;
1284}
1285#endif /* !CONFIG_CAN_AUTO_BUS_OFF_RECOVERY */
1286
1300static inline void can_set_state_change_callback(const struct device *dev,
1302 void *user_data)
1303{
1304 const struct can_driver_api *api = (const struct can_driver_api *)dev->api;
1305
1306 api->set_state_change_callback(dev, callback, user_data);
1307}
1308
1325{
1326 static const uint8_t dlc_table[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 12,
1327 16, 20, 24, 32, 48, 64};
1328
1329 return dlc > 0x0F ? 64 : dlc_table[dlc];
1330}
1331
1339static inline uint8_t can_bytes_to_dlc(uint8_t num_bytes)
1340{
1341 return num_bytes <= 8 ? num_bytes :
1342 num_bytes <= 12 ? 9 :
1343 num_bytes <= 16 ? 10 :
1344 num_bytes <= 20 ? 11 :
1345 num_bytes <= 24 ? 12 :
1346 num_bytes <= 32 ? 13 :
1347 num_bytes <= 48 ? 14 :
1348 15;
1349}
1350
1357#ifdef __cplusplus
1358}
1359#endif
1360
1361#include <syscalls/can.h>
1362
1363#endif /* ZEPHYR_INCLUDE_DRIVERS_CAN_H_ */
ZTEST_BMEM int timeout
Definition: main.c:31
static ssize_t send(int sock, const void *buf, size_t len, int flags)
Definition: socket.h:738
void(* can_state_change_callback_t)(const struct device *dev, enum can_state state, struct can_bus_err_cnt err_cnt, void *user_data)
Defines the state change callback handler function signature.
Definition: can.h:299
int can_set_bitrate(const struct device *dev, uint32_t bitrate)
Set the bitrate of the CAN controller.
int can_set_bitrate_data(const struct device *dev, uint32_t bitrate_data)
Set the bitrate for the data phase of the CAN-FD controller.
uint32_t can_mode_t
Provides a type to hold CAN controller configuration flags.
Definition: can.h:106
static int can_add_rx_filter(const struct device *dev, can_rx_callback_t callback, void *user_data, const struct can_filter *filter)
Add a callback function for a given CAN filter.
Definition: can.h:1132
int can_stop(const struct device *dev)
Stop the CAN controller.
int can_set_timing(const struct device *dev, const struct can_timing *timing)
Configure the bus timing of a CAN controller.
int can_calc_timing_data(const struct device *dev, struct can_timing *res, uint32_t bitrate, uint16_t sample_pnt)
Calculate timing parameters for the data phase.
int can_send(const struct device *dev, const struct can_frame *frame, k_timeout_t timeout, can_tx_callback_t callback, void *user_data)
Queue a CAN frame for transmission on the CAN bus.
const struct can_timing * can_get_timing_data_max(const struct device *dev)
Get the maximum supported timing parameter values for the data phase.
int can_get_core_clock(const struct device *dev, uint32_t *rate)
Get the CAN core clock rate.
int can_get_capabilities(const struct device *dev, can_mode_t *cap)
Get the supported modes of the CAN controller.
const struct can_timing * can_get_timing_min(const struct device *dev)
Get the minimum supported timing parameter values.
int can_set_timing_data(const struct device *dev, const struct can_timing *timing_data)
Configure the bus timing for the data phase of a CAN-FD controller.
const struct can_timing * can_get_timing_data_min(const struct device *dev)
Get the minimum supported timing parameter values for the data phase.
int can_calc_prescaler(const struct device *dev, struct can_timing *timing, uint32_t bitrate)
Fill in the prescaler value for a given bitrate and timing.
void can_remove_rx_filter(const struct device *dev, int filter_id)
Remove a CAN RX filter.
static uint8_t can_bytes_to_dlc(uint8_t num_bytes)
Convert from number of bytes to Data Length Code (DLC)
Definition: can.h:1339
can_rtr
Defines if the CAN frame is a data frame or a Remote Transmission Request (RTR) frame.
Definition: can.h:138
int can_get_max_bitrate(const struct device *dev, uint32_t *max_bitrate)
Get maximum supported bitrate.
can_ide
Defines if the CAN frame has a standard (11-bit) or extended (29-bit) CAN identifier.
Definition: can.h:128
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:1324
int can_add_rx_filter_msgq(const struct device *dev, struct k_msgq *msgq, const struct can_filter *filter)
Wrapper function for adding a message queue for a given filter.
void(* can_rx_callback_t)(const struct device *dev, struct can_frame *frame, void *user_data)
Defines the application callback handler function signature for receiving.
Definition: can.h:288
int can_get_max_filters(const struct device *dev, enum can_ide id_type)
Get maximum number of RX filters.
void(* can_tx_callback_t)(const struct device *dev, int error, void *user_data)
Defines the application callback handler function signature.
Definition: can.h:279
int can_get_state(const struct device *dev, enum can_state *state, struct can_bus_err_cnt *err_cnt)
Get current CAN controller state.
const struct can_timing * can_get_timing_max(const struct device *dev)
Get the maximum supported timing parameter values.
int can_calc_timing(const struct device *dev, struct can_timing *res, uint32_t bitrate, uint16_t sample_pnt)
Calculate timing parameters from bitrate and sample point.
int can_recover(const struct device *dev, k_timeout_t timeout)
Recover from bus-off state.
can_state
Defines the state of the CAN controller.
Definition: can.h:111
static void can_set_state_change_callback(const struct device *dev, can_state_change_callback_t callback, void *user_data)
Set a callback for CAN controller state change events.
Definition: can.h:1300
int can_set_mode(const struct device *dev, can_mode_t mode)
Set the CAN controller to the given operation mode.
int can_start(const struct device *dev)
Start the CAN controller.
@ CAN_DATAFRAME
Definition: can.h:140
@ CAN_REMOTEREQUEST
Definition: can.h:142
@ CAN_EXTENDED_IDENTIFIER
Definition: can.h:132
@ CAN_STANDARD_IDENTIFIER
Definition: can.h:130
@ CAN_STATE_ERROR_ACTIVE
Definition: can.h:113
@ CAN_STATE_ERROR_WARNING
Definition: can.h:115
@ CAN_STATE_STOPPED
Definition: can.h:121
@ CAN_STATE_BUS_OFF
Definition: can.h:119
@ CAN_STATE_ERROR_PASSIVE
Definition: can.h:117
#define ceiling_fraction(numerator, divider)
Ceiling function applied to numerator / divider as a fraction.
Definition: util.h:237
#define ENOSYS
Definition: errno.h:83
state
Definition: http_parser_state.h:29
struct k_msgq msgq
Definition: test_msgq_contexts.c:12
Statistics.
#define STATS_NAME_END(name__)
Definition: stats.h:391
#define STATS_NAME(name__, entry__)
Definition: stats.h:390
#define STATS_SECT_END
Ends a stats group struct definition.
Definition: stats.h:89
#define STATS_SECT_ENTRY32(var__)
Definition: stats.h:359
#define STATS_NAME_START(name__)
Definition: stats.h:389
#define STATS_SECT_START(group__)
Definition: stats.h:354
__UINT32_TYPE__ uint32_t
Definition: stdint.h:90
__UINT8_TYPE__ uint8_t
Definition: stdint.h:88
__UINT16_TYPE__ uint16_t
Definition: stdint.h:89
CAN controller error counters.
Definition: can.h:219
uint8_t tx_err_cnt
Definition: can.h:221
uint8_t rx_err_cnt
Definition: can.h:223
CAN specific device state which allows for CAN device class specific additions.
Definition: can.h:476
struct device_state devstate
Definition: can.h:477
struct stats_can stats
Definition: can.h:478
CAN filter structure.
Definition: can.h:189
uint32_t rtr_mask
Definition: can.h:210
uint32_t id
Definition: can.h:191
uint32_t id_type
Definition: can.h:198
uint32_t id_mask
Definition: can.h:202
uint32_t rtr
Definition: can.h:196
CAN frame structure.
Definition: can.h:148
uint8_t dlc
Definition: can.h:158
uint32_t fd
Definition: can.h:152
uint32_t rtr
Definition: can.h:154
uint32_t data_32[ceiling_fraction(CAN_MAX_DLEN, sizeof(uint32_t))]
Definition: can.h:182
uint32_t id
Definition: can.h:150
uint32_t id_type
Definition: can.h:156
uint8_t data[CAN_MAX_DLEN]
Definition: can.h:181
uint8_t brs
Definition: can.h:160
uint16_t timestamp
Definition: can.h:172
CAN bus timing structure.
Definition: can.h:258
uint16_t sjw
Definition: can.h:260
uint16_t phase_seg2
Definition: can.h:266
uint16_t prescaler
Definition: can.h:268
uint16_t phase_seg1
Definition: can.h:264
uint16_t prop_seg
Definition: can.h:262
Runtime device dynamic structure (in RAM) per driver instance.
Definition: device.h:408
Runtime device structure (in ROM) per driver instance.
Definition: device.h:435
const void * api
Definition: device.h:441
Message Queue Structure.
Definition: kernel.h:4205
Kernel timeout type.
Definition: sys_clock.h:65
static const intptr_t user_data[5]
Definition: main.c:588
Misc utilities.