You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by ra...@apache.org on 2022/05/06 06:55:10 UTC
[incubator-nuttx] 06/07: stm32: SocketCAN: allow non-late netdev initialization
This is an automated email from the ASF dual-hosted git repository.
raiden00 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
commit 0a37bd8d4f45f84a78f3e06ee7ec0780e08f12e0
Author: JacobCrabill <ja...@flyvoly.com>
AuthorDate: Sun Apr 10 11:33:11 2022 -0700
stm32: SocketCAN: allow non-late netdev initialization
---
arch/arm/src/stm32/stm32_can_sock.c | 25 +++++++++++++++++++++++++
arch/arm/src/stm32/stm32_fdcan_sock.c | 25 +++++++++++++++++++++++++
2 files changed, 50 insertions(+)
diff --git a/arch/arm/src/stm32/stm32_can_sock.c b/arch/arm/src/stm32/stm32_can_sock.c
index ede1261f26..6125f64a02 100644
--- a/arch/arm/src/stm32/stm32_can_sock.c
+++ b/arch/arm/src/stm32/stm32_can_sock.c
@@ -2461,3 +2461,28 @@ int stm32_cansockinitialize(int port)
errout:
return ret;
}
+
+/****************************************************************************
+ * Name: arm_netinitialize
+ *
+ * Description:
+ * Initialize the CAN device interfaces. If there is more than one device
+ * interface in the chip, then board-specific logic will have to provide
+ * this function to determine which, if any, CAN interfaces should be
+ * initialized.
+ *
+ ****************************************************************************/
+
+#if !defined(CONFIG_NETDEV_LATEINIT)
+void arm_netinitialize(void)
+{
+#ifdef CONFIG_STM32_CAN1
+ stm32_cansockinitialize(0);
+#endif
+
+#ifdef CONFIG_STM32_CAN2
+ stm32_cansockinitialize(1);
+#endif
+}
+#endif
+
diff --git a/arch/arm/src/stm32/stm32_fdcan_sock.c b/arch/arm/src/stm32/stm32_fdcan_sock.c
index e38bad9dc4..a2c2ee6551 100644
--- a/arch/arm/src/stm32/stm32_fdcan_sock.c
+++ b/arch/arm/src/stm32/stm32_fdcan_sock.c
@@ -3293,3 +3293,28 @@ int stm32_fdcansockinitialize(int port)
errout:
return ret;
}
+
+/****************************************************************************
+ * Name: arm_netinitialize
+ *
+ * Description:
+ * Initialize the CAN device interfaces. If there is more than one device
+ * interface in the chip, then board-specific logic will have to provide
+ * this function to determine which, if any, CAN interfaces should be
+ * initialized.
+ *
+ ****************************************************************************/
+
+#if !defined(CONFIG_NETDEV_LATEINIT)
+void arm_netinitialize(void)
+{
+#ifdef CONFIG_STM32_CAN1
+ stm32_fdcansockinitialize(0);
+#endif
+
+#ifdef CONFIG_STM32_CAN2
+ stm32_fdcansockinitialize(1);
+#endif
+}
+#endif
+