You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by ac...@apache.org on 2020/06/29 12:05:53 UTC
[incubator-nuttx] 02/04: stm32f7: Add the option to include RTR in
CAN header
This is an automated email from the ASF dual-hosted git repository.
acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
commit 7a346bee2645bb849b8a6deddaf7bda3aec49a47
Author: Claudio Micheli <cl...@auterion.com>
AuthorDate: Mon May 25 10:29:42 2020 +0200
stm32f7: Add the option to include RTR in CAN header
Signed-off-by: Claudio Micheli <cl...@auterion.com>
---
arch/arm/src/stm32f7/stm32_can.c | 7 +++++--
drivers/can/Kconfig | 6 ++++++
2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/arch/arm/src/stm32f7/stm32_can.c b/arch/arm/src/stm32f7/stm32_can.c
index 6c76472..6f5ccda 100644
--- a/arch/arm/src/stm32f7/stm32_can.c
+++ b/arch/arm/src/stm32f7/stm32_can.c
@@ -1288,8 +1288,11 @@ static int stm32can_send(FAR struct can_dev_s *dev,
}
#else
- regval &= ~CAN_TIR_STID_MASK;
- regval |= (uint32_t)msg->cm_hdr.ch_id << CAN_TIR_STID_SHIFT;
+ regval |= ( ( (uint32_t) msg->cm_hdr.ch_id << CAN_TIR_STID_SHIFT) & CAN_TIR_STID_MASK );
+
+#ifdef CONFIG_CAN_USE_RTR
+ regval |= (msg->cm_hdr.ch_rtr ? CAN_TIR_RTR : 0);
+#endif
#endif
stm32can_putreg(priv, STM32_CAN_TIR_OFFSET(txmb), regval);
diff --git a/drivers/can/Kconfig b/drivers/can/Kconfig
index d5298d7..ae54205 100644
--- a/drivers/can/Kconfig
+++ b/drivers/can/Kconfig
@@ -128,6 +128,12 @@ config CAN_NPOLLWAITERS
---help---
The maximum number of threads that may be waiting on the
poll method.
+
+config CAN_USE_RTR
+ bool "Include RTR in CAN header"
+ default n
+ ---help---
+ This selection includes RTR bitfield in the CAN header.
comment "CAN Bus Controllers:"