Skip to content

Commit c25f69d

Browse files
drivers: can: Add Kconfig option for CANFD datalenght
Add Kconfig option to select appropriate can data field length Signed-off-by: Alexander Wachter <[email protected]>
1 parent 911ba33 commit c25f69d

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

drivers/can/Kconfig

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,16 @@ config CAN_FD_MODE
2929
help
3030
Enable CAN-FD compatible API
3131

32+
if CAN_FD_MODE
33+
34+
config CAN_MAX_DLEN
35+
int "Max data lenght in CAN frames"
36+
range 8 64
37+
default 64
38+
help
39+
Size of the data field in the zcan_frame
40+
endif # CAN_FD_MODE
41+
3242
config CAN_INIT_PRIORITY
3343
int "CAN driver init priority"
3444
default 80

include/drivers/can.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,11 @@ 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+
#ifndef CONFIG_CAN_MAX_DLEN
3637
#define CAN_MAX_DLEN 8
38+
#else
39+
#define CAN_MAX_DLEN CONFIG_CAN_MAX_DLEN
40+
#endif
3741

3842
/* CAN_TX_* are the error flags from tx_callback and send.*/
3943
/** send successfully */

0 commit comments

Comments
 (0)