File tree Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -29,6 +29,18 @@ config CAN_FD_MODE
2929 help
3030 Enable CAN-FD compatible API
3131
32+ if CAN_FD_MODE
33+
34+ config CANFD_MAX_DLC
35+ int "Max data length code in CAN frames"
36+ range 8 15
37+ default 15
38+ help
39+ Maximum allowed DLC in a CAN frame. This parameter sets the
40+ data buffer size in a CAN frame and is therefore only used to
41+ optimize memory consumption.
42+ endif # CAN_FD_MODE
43+
3244config CAN_INIT_PRIORITY
3345 int "CAN driver init priority"
3446 default 80
Original file line number Diff line number Diff line change @@ -33,7 +33,22 @@ extern "C" {
3333#define CAN_STD_ID_MASK CAN_MAX_STD_ID
3434#define CAN_EXT_ID_MASK (0x1FFFFFFF)
3535#define CAN_MAX_DLC (8)
36+ #define CANFD_MAX_DLC CONFIG_CANFD_MAX_DLC
37+ #ifndef CONFIG_CANFD_MAX_DLC
3638#define CAN_MAX_DLEN 8
39+ #else
40+ #if CONFIG_CANFD_MAX_DLC <= 8
41+ #define CAN_MAX_DLEN CONFIG_CANFD_MAX_DLC
42+ #elif CONFIG_CANFD_MAX_DLC <= 12
43+ #define CAN_MAX_DLEN CONFIG_CANFD_MAX_DLC + (CONFIG_CANFD_MAX_DLC - 8) * 4
44+ #elif CONFIG_CANFD_MAX_DLC == 13
45+ #define CAN_MAX_DLEN 32
46+ #elif CONFIG_CANFD_MAX_DLC == 14
47+ #define CAN_MAX_DLEN 48
48+ #elif CONFIG_CANFD_MAX_DLC == 15
49+ #define CAN_MAX_DLEN 64
50+ #endif
51+ #endif /* CONFIG_CANFD_MAX_DLC */
3752
3853/* CAN_TX_* are the error flags from tx_callback and send.*/
3954/** send successfully */
You can’t perform that action at this time.
0 commit comments