You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by an...@apache.org on 2021/03/08 04:58:29 UTC

[incubator-nuttx] 01/03: stm32h7: Allow custom clock configuration to use stdclockconfig

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

antmerlino pushed a commit to branch stm32h747xi
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit 7de194ff75da3d7e7789f0c9a00489e8ef1a62e2
Author: Anthony Merlino <an...@vergeaero.com>
AuthorDate: Sun Mar 7 22:03:27 2021 -0500

    stm32h7: Allow custom clock configuration to use stdclockconfig
---
 arch/arm/src/stm32h7/stm32_rcc.h       | 10 ++++++++
 arch/arm/src/stm32h7/stm32h7x3xx_rcc.c | 44 ++++++++++++++++----------------
 arch/arm/src/stm32h7/stm32h7x7xx_rcc.c | 46 ++++++++++++++++------------------
 3 files changed, 53 insertions(+), 47 deletions(-)

diff --git a/arch/arm/src/stm32h7/stm32_rcc.h b/arch/arm/src/stm32h7/stm32_rcc.h
index 583121a..00972c6 100644
--- a/arch/arm/src/stm32h7/stm32_rcc.h
+++ b/arch/arm/src/stm32h7/stm32_rcc.h
@@ -152,6 +152,16 @@ static inline void stm32_mco2config(uint32_t source, uint32_t div)
 void stm32_clockconfig(void);
 
 /****************************************************************************
+ * Name: stm32_stdclockconfig
+ *
+ * Description:
+ *   Setup the system using the "standard" clock configuration
+ *
+ ****************************************************************************/
+
+void stm32_stdclockconfig(void);
+
+/****************************************************************************
  * Name: stm32_board_clockconfig
  *
  * Description:
diff --git a/arch/arm/src/stm32h7/stm32h7x3xx_rcc.c b/arch/arm/src/stm32h7/stm32h7x3xx_rcc.c
index 3646682..6679976 100644
--- a/arch/arm/src/stm32h7/stm32h7x3xx_rcc.c
+++ b/arch/arm/src/stm32h7/stm32h7x3xx_rcc.c
@@ -558,6 +558,26 @@ static inline void rcc_enableapb4(void)
 }
 
 /****************************************************************************
+ * Name: rcc_enableperiphals
+ ****************************************************************************/
+
+static inline void rcc_enableperipherals(void)
+{
+  rcc_enableahb1();
+  rcc_enableahb2();
+  rcc_enableahb3();
+  rcc_enableahb4();
+  rcc_enableapb1();
+  rcc_enableapb2();
+  rcc_enableapb3();
+  rcc_enableapb4();
+}
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
  * Name: stm32_stdclockconfig
  *
  * Description:
@@ -567,8 +587,7 @@ static inline void rcc_enableapb4(void)
  *   power clocking modes!
  ****************************************************************************/
 
-#ifndef CONFIG_STM32H7_CUSTOM_CLOCKCONFIG
-static void stm32_stdclockconfig(void)
+void stm32_stdclockconfig(void)
 {
   uint32_t regval;
   volatile int32_t timeout;
@@ -943,24 +962,3 @@ static void stm32_stdclockconfig(void)
 #endif
     }
 }
-#endif
-
-/****************************************************************************
- * Name: rcc_enableperiphals
- ****************************************************************************/
-
-static inline void rcc_enableperipherals(void)
-{
-  rcc_enableahb1();
-  rcc_enableahb2();
-  rcc_enableahb3();
-  rcc_enableahb4();
-  rcc_enableapb1();
-  rcc_enableapb2();
-  rcc_enableapb3();
-  rcc_enableapb4();
-}
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
diff --git a/arch/arm/src/stm32h7/stm32h7x7xx_rcc.c b/arch/arm/src/stm32h7/stm32h7x7xx_rcc.c
index 859997c..f1c6821 100644
--- a/arch/arm/src/stm32h7/stm32h7x7xx_rcc.c
+++ b/arch/arm/src/stm32h7/stm32h7x7xx_rcc.c
@@ -560,6 +560,26 @@ static inline void rcc_enableapb4(void)
 }
 
 /****************************************************************************
+ * Name: rcc_enableperiphals
+ ****************************************************************************/
+
+static inline void rcc_enableperipherals(void)
+{
+  rcc_enableahb1();
+  rcc_enableahb2();
+  rcc_enableahb3();
+  rcc_enableahb4();
+  rcc_enableapb1();
+  rcc_enableapb2();
+  rcc_enableapb3();
+  rcc_enableapb4();
+}
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
  * Name: stm32_stdclockconfig
  *
  * Description:
@@ -569,8 +589,7 @@ static inline void rcc_enableapb4(void)
  *   power clocking modes!
  ****************************************************************************/
 
-#ifndef CONFIG_STM32H7_CUSTOM_CLOCKCONFIG
-static void stm32_stdclockconfig(void)
+void stm32_stdclockconfig(void)
 {
   uint32_t regval;
   volatile int32_t timeout;
@@ -932,25 +951,4 @@ static void stm32_stdclockconfig(void)
       stm32_rcc_enablelse();
 #endif
     }
-}
-#endif
-
-/****************************************************************************
- * Name: rcc_enableperiphals
- ****************************************************************************/
-
-static inline void rcc_enableperipherals(void)
-{
-  rcc_enableahb1();
-  rcc_enableahb2();
-  rcc_enableahb3();
-  rcc_enableahb4();
-  rcc_enableapb1();
-  rcc_enableapb2();
-  rcc_enableapb3();
-  rcc_enableapb4();
-}
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
+}
\ No newline at end of file