From d39eedbad1073024257059eae47e29a862bf4dcf Mon Sep 17 00:00:00 2001 From: Erwan Gouriou Date: Fri, 17 Feb 2017 17:07:09 +0100 Subject: [PATCH] arch: stm32: provide tick to Cube HAL Cube HAL implements timeout based on 1ms tick. This commit allows Cube HAL to get Zephyr system clock. Change-Id: I9a59edcf6fa8e0ebfd5040348db537dadd9fcdfa Signed-off-by: Erwan Gouriou --- arch/arm/soc/st_stm32/stm32f1/soc.c | 11 +++++++++++ arch/arm/soc/st_stm32/stm32f3/soc.c | 11 +++++++++++ arch/arm/soc/st_stm32/stm32f4/soc.c | 11 +++++++++++ arch/arm/soc/st_stm32/stm32l4/soc.c | 11 +++++++++++ 4 files changed, 44 insertions(+) diff --git a/arch/arm/soc/st_stm32/stm32f1/soc.c b/arch/arm/soc/st_stm32/stm32f1/soc.c index db7ca5becf3..874eeaab749 100644 --- a/arch/arm/soc/st_stm32/stm32f1/soc.c +++ b/arch/arm/soc/st_stm32/stm32f1/soc.c @@ -16,6 +16,17 @@ #include #include +/** + * @brief This function configures the source of stm32cube time base. + * Cube HAL expects a 1ms tick which matches with k_uptime_get_32. + * Tick interrupt priority is not used + * @return HAL status + */ +uint32_t HAL_GetTick(void) +{ + return k_uptime_get_32(); +} + /** * @brief Perform basic hardware initialization at boot. * diff --git a/arch/arm/soc/st_stm32/stm32f3/soc.c b/arch/arm/soc/st_stm32/stm32f3/soc.c index 9855ea0ffed..4c554051834 100644 --- a/arch/arm/soc/st_stm32/stm32f3/soc.c +++ b/arch/arm/soc/st_stm32/stm32f3/soc.c @@ -16,6 +16,17 @@ #include #include +/** + * @brief This function configures the source of stm32cube time base. + * Cube HAL expects a 1ms tick which matches with k_uptime_get_32. + * Tick interrupt priority is not used + * @return HAL status + */ +uint32_t HAL_GetTick(void) +{ + return k_uptime_get_32(); +} + /** * @brief Perform basic hardware initialization at boot. * diff --git a/arch/arm/soc/st_stm32/stm32f4/soc.c b/arch/arm/soc/st_stm32/stm32f4/soc.c index 3857992a374..827bb1edcdc 100644 --- a/arch/arm/soc/st_stm32/stm32f4/soc.c +++ b/arch/arm/soc/st_stm32/stm32f4/soc.c @@ -17,6 +17,17 @@ #include #include +/** + * @brief This function configures the source of stm32cube time base. + * Cube HAL expects a 1ms tick which matches with k_uptime_get_32. + * Tick interrupt priority is not used + * @return HAL status + */ +uint32_t HAL_GetTick(void) +{ + return k_uptime_get_32(); +} + /** * @brief Perform basic hardware initialization at boot. * diff --git a/arch/arm/soc/st_stm32/stm32l4/soc.c b/arch/arm/soc/st_stm32/stm32l4/soc.c index 742960e4635..84ee3295d0f 100644 --- a/arch/arm/soc/st_stm32/stm32l4/soc.c +++ b/arch/arm/soc/st_stm32/stm32l4/soc.c @@ -17,6 +17,17 @@ #include #include +/** + * @brief This function configures the source of stm32cube time base. + * Cube HAL expects a 1ms tick which matches with k_uptime_get_32. + * Tick interrupt priority is not used + * @return HAL status + */ +uint32_t HAL_GetTick(void) +{ + return k_uptime_get_32(); +} + /** * @brief Perform basic hardware initialization at boot. *