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:51 UTC

[incubator-nuttx] branch master updated (676a2b7 -> 10f93b9)

This is an automated email from the ASF dual-hosted git repository.

acassis pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git.


    from 676a2b7  stdio.h: Implement fseeko and ftello function
     new f6039bb  stm32f7: add CANIOC_SET_NART and CANIOC_SET_ABOM ioctl's to can driver
     new 7a346be  stm32f7: Add the option to include RTR in CAN header
     new 94e87bb  stm32: extend CAN ioctrl with NART/ABOM. Add RTR to CAN header
     new 10f93b9  stm32l4: extend CAN ioctrl with NART/ABOM. Add RTR to CAN header

The 4 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 arch/arm/src/stm32/stm32_can.c     | 51 ++++++++++++++++++++++++++++++++++++--
 arch/arm/src/stm32f7/stm32_can.c   | 51 ++++++++++++++++++++++++++++++++++++--
 arch/arm/src/stm32l4/stm32l4_can.c | 51 ++++++++++++++++++++++++++++++++++++--
 drivers/can/Kconfig                |  6 +++++
 include/nuttx/can/can.h            | 22 +++++++++++++++-
 5 files changed, 174 insertions(+), 7 deletions(-)


[incubator-nuttx] 02/04: stm32f7: Add the option to include RTR in CAN header

Posted by ac...@apache.org.
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:"
 


[incubator-nuttx] 04/04: stm32l4: extend CAN ioctrl with NART/ABOM. Add RTR to CAN header

Posted by ac...@apache.org.
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 10f93b9d9b4c2b199a20397e4cd8310f28188699
Author: Claudio Micheli <cl...@auterion.com>
AuthorDate: Mon May 25 14:01:58 2020 +0200

    stm32l4: extend CAN ioctrl with NART/ABOM. Add RTR to CAN header
    
    Signed-off-by: Claudio Micheli <cl...@auterion.com>
---
 arch/arm/src/stm32l4/stm32l4_can.c | 51 ++++++++++++++++++++++++++++++++++++--
 1 file changed, 49 insertions(+), 2 deletions(-)

diff --git a/arch/arm/src/stm32l4/stm32l4_can.c b/arch/arm/src/stm32l4/stm32l4_can.c
index 81cc833..3caca66 100644
--- a/arch/arm/src/stm32l4/stm32l4_can.c
+++ b/arch/arm/src/stm32l4/stm32l4_can.c
@@ -1073,6 +1073,50 @@ static int stm32l4can_ioctl(FAR struct can_dev_s *dev, int cmd,
         }
         break;
 
+      case CANIOC_SET_NART:
+        {
+          uint32_t regval;
+          ret = stm32can_enterinitmode(priv);
+          if (ret != 0)
+            {
+              return ret;
+            }
+          regval = stm32can_getreg(priv, STM32_CAN_MCR_OFFSET);
+          if (arg == 1)
+            {
+              regval |= CAN_MCR_NART;
+            }
+          else
+            {
+              regval &= ~CAN_MCR_NART;
+            }
+          stm32can_putreg(priv, STM32_CAN_MCR_OFFSET, regval);
+          return stm32can_exitinitmode(priv);
+        }
+        break;
+
+      case CANIOC_SET_ABOM:
+        {
+          uint32_t regval;
+          ret = stm32can_enterinitmode(priv);
+          if (ret != 0)
+            {
+              return ret;
+            }
+          regval = stm32can_getreg(priv, STM32_CAN_MCR_OFFSET);
+          if (arg == 1)
+            {
+              regval |= CAN_MCR_ABOM;
+            }
+          else
+            {
+              regval &= ~CAN_MCR_ABOM;
+            }
+          stm32can_putreg(priv, STM32_CAN_MCR_OFFSET, regval);
+          return stm32can_exitinitmode(priv);
+        }
+        break;
+
       /* Unsupported/unrecognized command */
 
       default:
@@ -1182,8 +1226,11 @@ static int stm32l4can_send(FAR struct can_dev_s *dev,
       regval |= msg->cm_hdr.ch_id << CAN_TIR_STID_SHIFT;
     }
 #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
   stm32l4can_putreg(priv, STM32L4_CAN_TIR_OFFSET(txmb), regval);
 


[incubator-nuttx] 03/04: stm32: extend CAN ioctrl with NART/ABOM. Add RTR to CAN header

Posted by ac...@apache.org.
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 94e87bb6e8b42abe6b3740bfe6619bc90d478dec
Author: Claudio Micheli <cl...@auterion.com>
AuthorDate: Mon May 25 14:01:13 2020 +0200

    stm32: extend CAN ioctrl with NART/ABOM. Add RTR to CAN header
    
    Signed-off-by: Claudio Micheli <cl...@auterion.com>
---
 arch/arm/src/stm32/stm32_can.c | 51 ++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 49 insertions(+), 2 deletions(-)

diff --git a/arch/arm/src/stm32/stm32_can.c b/arch/arm/src/stm32/stm32_can.c
index 2cdeecc..6581479 100644
--- a/arch/arm/src/stm32/stm32_can.c
+++ b/arch/arm/src/stm32/stm32_can.c
@@ -1102,6 +1102,50 @@ static int stm32can_ioctl(FAR struct can_dev_s *dev, int cmd,
         }
         break;
 
+      case CANIOC_SET_NART:
+        {
+          uint32_t regval;
+          ret = stm32can_enterinitmode(priv);
+          if (ret != 0)
+            {
+              return ret;
+            }
+          regval = stm32can_getreg(priv, STM32_CAN_MCR_OFFSET);
+          if (arg == 1)
+            {
+              regval |= CAN_MCR_NART;
+            }
+          else
+            {
+              regval &= ~CAN_MCR_NART;
+            }
+          stm32can_putreg(priv, STM32_CAN_MCR_OFFSET, regval);
+          return stm32can_exitinitmode(priv);
+        }
+        break;
+
+      case CANIOC_SET_ABOM:
+        {
+          uint32_t regval;
+          ret = stm32can_enterinitmode(priv);
+          if (ret != 0)
+            {
+              return ret;
+            }
+          regval = stm32can_getreg(priv, STM32_CAN_MCR_OFFSET);
+          if (arg == 1)
+            {
+              regval |= CAN_MCR_ABOM;
+            }
+          else
+            {
+              regval &= ~CAN_MCR_ABOM;
+            }
+          stm32can_putreg(priv, STM32_CAN_MCR_OFFSET, regval);
+          return stm32can_exitinitmode(priv);
+        }
+        break;
+
       /* Unsupported/unrecognized command */
 
       default:
@@ -1211,8 +1255,11 @@ static int stm32can_send(FAR struct can_dev_s *dev,
       regval |= msg->cm_hdr.ch_id << CAN_TIR_STID_SHIFT;
     }
 #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);
 


[incubator-nuttx] 01/04: stm32f7: add CANIOC_SET_NART and CANIOC_SET_ABOM ioctl's to can driver

Posted by ac...@apache.org.
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 f6039bbfa7d64c3d4d54f82e703d39f53794f66b
Author: Beat Küng <be...@gmx.net>
AuthorDate: Tue Apr 21 14:21:00 2020 +0200

    stm32f7: add CANIOC_SET_NART and CANIOC_SET_ABOM ioctl's to can driver
---
 arch/arm/src/stm32f7/stm32_can.c | 44 ++++++++++++++++++++++++++++++++++++++++
 include/nuttx/can/can.h          | 22 +++++++++++++++++++-
 2 files changed, 65 insertions(+), 1 deletion(-)

diff --git a/arch/arm/src/stm32f7/stm32_can.c b/arch/arm/src/stm32f7/stm32_can.c
index d68c4ab..6c76472 100644
--- a/arch/arm/src/stm32f7/stm32_can.c
+++ b/arch/arm/src/stm32f7/stm32_can.c
@@ -1134,6 +1134,50 @@ static int stm32can_ioctl(FAR struct can_dev_s *dev, int cmd,
         }
         break;
 
+      case CANIOC_SET_NART:
+        {
+          uint32_t regval;
+          ret = stm32can_enterinitmode(priv);
+          if (ret != 0)
+            {
+              return ret;
+            }
+          regval = stm32can_getreg(priv, STM32_CAN_MCR_OFFSET);
+          if (arg == 1)
+            {
+              regval |= CAN_MCR_NART;
+            }
+          else
+            {
+              regval &= ~CAN_MCR_NART;
+            }
+          stm32can_putreg(priv, STM32_CAN_MCR_OFFSET, regval);
+          return stm32can_exitinitmode(priv);
+        }
+        break;
+
+      case CANIOC_SET_ABOM:
+        {
+          uint32_t regval;
+          ret = stm32can_enterinitmode(priv);
+          if (ret != 0)
+            {
+              return ret;
+            }
+          regval = stm32can_getreg(priv, STM32_CAN_MCR_OFFSET);
+          if (arg == 1)
+            {
+              regval |= CAN_MCR_ABOM;
+            }
+          else
+            {
+              regval &= ~CAN_MCR_ABOM;
+            }
+          stm32can_putreg(priv, STM32_CAN_MCR_OFFSET, regval);
+          return stm32can_exitinitmode(priv);
+        }
+        break;
+
       /* Unsupported/unrecognized command */
 
       default:
diff --git a/include/nuttx/can/can.h b/include/nuttx/can/can.h
index f462832..d1cd37d 100644
--- a/include/nuttx/can/can.h
+++ b/include/nuttx/can/can.h
@@ -197,6 +197,24 @@
  *                   is returned with the errno variable set to indicate the
  *                   nature of the error.
  *   Dependencies:   None
+ *
+ * CANIOC_SET_NART:
+ *   Description:    Enable/Disable NART (No Automatic Retry)
+ *   Argument:       Set to 1 to enable NART, 0 to disable. Default is
+ *                   disabled.
+ *   Returned Value: Zero (OK) is returned on success.  Otherwise -1 (ERROR)
+ *                   is returned with the errno variable set to indicate the
+ *                   nature of the error.
+ *   Dependencies:   None
+ *
+ * CANIOC_SET_ABOM:
+ *   Description:    Enable/Disable ABOM (Automatic Bus-off Management)
+ *   Argument:       Set to 1 to enable ABOM, 0 to disable. Default is
+ *                   disabled.
+ *   Returned Value: Zero (OK) is returned on success.  Otherwise -1 (ERROR)
+ *                   is returned with the errno variable set to indicate the
+ *                   nature of the error.
+ *   Dependencies:   None
  */
 
 #define CANIOC_RTR                _CANIOC(1)
@@ -209,9 +227,11 @@
 #define CANIOC_GET_CONNMODES      _CANIOC(8)
 #define CANIOC_SET_CONNMODES      _CANIOC(9)
 #define CANIOC_BUSOFF_RECOVERY    _CANIOC(10)
+#define CANIOC_SET_NART           _CANIOC(11)
+#define CANIOC_SET_ABOM           _CANIOC(12)
 
 #define CAN_FIRST                 0x0001         /* First common command */
-#define CAN_NCMDS                 10             /* Ten common commands */
+#define CAN_NCMDS                 12             /* Ten common commands */
 
 /* User defined ioctl commands are also supported. These will be forwarded
  * by the upper-half CAN driver to the lower-half CAN driver via the co_ioctl()