stm32/socketcan: fix the EFF flag for received frames

This commit is contained in:
raiden00pl 2022-10-21 15:45:04 +02:00 committed by Xiang Xiao
parent 4ea0c905e6
commit f1277a2233
2 changed files with 2 additions and 4 deletions

View File

@ -1207,12 +1207,11 @@ static int stm32can_rxinterrupt_work(struct stm32_can_s *priv, int rxmb)
if ((regval & CAN_RIR_IDE) != 0) if ((regval & CAN_RIR_IDE) != 0)
{ {
frame->can_id = (regval & CAN_RIR_EXID_MASK) >> CAN_RIR_EXID_SHIFT; frame->can_id = (regval & CAN_RIR_EXID_MASK) >> CAN_RIR_EXID_SHIFT;
frame->can_id &= ~CAN_EFF_FLAG; frame->can_id |= CAN_EFF_FLAG;
} }
else else
{ {
frame->can_id = (regval & CAN_RIR_STID_MASK) >> CAN_RIR_STID_SHIFT; frame->can_id = (regval & CAN_RIR_STID_MASK) >> CAN_RIR_STID_SHIFT;
frame->can_id |= CAN_EFF_FLAG;
} }
#else #else
if ((regval & CAN_RIR_IDE) != 0) if ((regval & CAN_RIR_IDE) != 0)

View File

@ -1231,12 +1231,11 @@ static int stm32can_rxinterrupt_work(struct stm32_can_s *priv, int rxmb)
if ((regval & CAN_RIR_IDE) != 0) if ((regval & CAN_RIR_IDE) != 0)
{ {
frame->can_id = (regval & CAN_RIR_EXID_MASK) >> CAN_RIR_EXID_SHIFT; frame->can_id = (regval & CAN_RIR_EXID_MASK) >> CAN_RIR_EXID_SHIFT;
frame->can_id &= ~CAN_EFF_FLAG; frame->can_id |= CAN_EFF_FLAG;
} }
else else
{ {
frame->can_id = (regval & CAN_RIR_STID_MASK) >> CAN_RIR_STID_SHIFT; frame->can_id = (regval & CAN_RIR_STID_MASK) >> CAN_RIR_STID_SHIFT;
frame->can_id |= CAN_EFF_FLAG;
} }
#else #else
if ((regval & CAN_RIR_IDE) != 0) if ((regval & CAN_RIR_IDE) != 0)