canbus: isotp: Fix ISO-TP padding config usage
ISOTP_ENABLE_TX_PADDING makes the device transmit frames with TX padding. ISOTP_REQUIRE_RX_PADDING ensures other devices on the bus use TX padding, by rejecting non-padded RX frames Signed-off-by: Grant Ramsay <gramsay@enphaseenergy.com>
This commit is contained in:
parent
f9daa0397c
commit
42dcc4e57f
2 changed files with 3 additions and 4 deletions
|
@ -51,7 +51,7 @@ config ISOTP_CR_TIMEOUT
|
|||
config ISOTP_REQUIRE_RX_PADDING
|
||||
bool "Require padding for received messages"
|
||||
help
|
||||
If enabled, SFs and the last CF must always have a DLC of 8 bytes
|
||||
If enabled, SFs, FCs and the last CF must always have a DLC of 8 bytes
|
||||
(for classic CAN) and unused bytes must be padded by the sending
|
||||
device. This setting allows to be compliant to AUTOSAR Specification
|
||||
of CAN Transport Layer.
|
||||
|
|
|
@ -137,8 +137,7 @@ static void receive_send_fc(struct isotp_recv_ctx *ctx, uint8_t fs)
|
|||
*data++ = ctx->opts.stmin;
|
||||
payload_len = data - frame.data;
|
||||
|
||||
#if defined(CONFIG_ISOTP_REQUIRE_RX_PADDING) || \
|
||||
defined(CONFIG_ISOTP_ENABLE_TX_PADDING)
|
||||
#ifdef CONFIG_ISOTP_ENABLE_TX_PADDING
|
||||
/* AUTOSAR requirement SWS_CanTp_00347 */
|
||||
memset(&frame.data[payload_len], 0xCC, ISOTP_CAN_DL - payload_len);
|
||||
frame.dlc = ISOTP_CAN_DL;
|
||||
|
@ -776,7 +775,7 @@ static void send_process_fc(struct isotp_send_ctx *ctx,
|
|||
return;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_ISOTP_ENABLE_TX_PADDING
|
||||
#ifdef CONFIG_ISOTP_REQUIRE_RX_PADDING
|
||||
/* AUTOSAR requirement SWS_CanTp_00349 */
|
||||
if (frame->dlc != ISOTP_CAN_DL) {
|
||||
LOG_ERR("FC DL invalid. Ignore");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue