can: Add CAN FD flags to CAN message header

EDL, BRS and ESI bits added to struct can_hdr_s.

The `ch_unused' field is useless (adjacent fields in
packed structs are aligned to the next byte), but some
drivers explicitly set this field to zero, so it is kept there
for API backward compatibility.

Signed-off-by: Jaroslav Beran <jara.beran@gmail.com>
This commit is contained in:
Jaroslav Beran 2021-03-19 10:46:41 +01:00 committed by Xiang Xiao
parent 4de28efbcb
commit a0f5892be9

View File

@ -455,7 +455,12 @@ begin_packed_struct struct can_hdr_s
uint8_t ch_error : 1; /* 1=ch_id is an error report */
#endif
uint8_t ch_extid : 1; /* Extended ID indication */
uint8_t ch_unused : 1; /* Unused */
#ifdef CONFIG_CAN_FD
uint8_t ch_edl : 1; /* Extended Data Length */
uint8_t ch_brs : 1; /* Bit Rate Switch */
uint8_t ch_esi : 1; /* Error State Indicator */
#endif
uint8_t ch_unused : 1; /* FIXME: This field is useless, kept for backward compatibility */
} end_packed_struct;
#else
@ -467,7 +472,12 @@ begin_packed_struct struct can_hdr_s
#ifdef CONFIG_CAN_ERRORS
uint8_t ch_error : 1; /* 1=ch_id is an error report */
#endif
uint8_t ch_unused : 2; /* Unused */
#ifdef CONFIG_CAN_FD
uint8_t ch_edl : 1; /* Extended Data Length */
uint8_t ch_brs : 1; /* Bit Rate Switch */
uint8_t ch_esi : 1; /* Error State Indicator */
#endif
uint8_t ch_unused : 1; /* FIXME: This field is useless, kept for backward compatibility */
} end_packed_struct;
#endif