From fbc307529e8fac6e2095e98b1c759311f4fa37a1 Mon Sep 17 00:00:00 2001 From: thread-liu Date: Fri, 28 Aug 2020 11:55:27 +0800 Subject: [PATCH 1/2] [update] error Structural member variables --- bsp/stm32/libraries/HAL_Drivers/drv_hwtimer.c | 25 ++++++++++++++----- 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/bsp/stm32/libraries/HAL_Drivers/drv_hwtimer.c b/bsp/stm32/libraries/HAL_Drivers/drv_hwtimer.c index cf0b82ae1d..bb6ec20ffa 100644 --- a/bsp/stm32/libraries/HAL_Drivers/drv_hwtimer.c +++ b/bsp/stm32/libraries/HAL_Drivers/drv_hwtimer.c @@ -154,10 +154,10 @@ static struct stm32_hwtimer stm32_hwtimer_obj[] = }; /* APBx timer clocks frequency doubler state related to APB1CLKDivider value */ -static void pclkx_doubler_get(uint32_t *pclk1_doubler, uint32_t *pclk2_doubler) +static void pclkx_doubler_get(rt_uint32_t *pclk1_doubler, rt_uint32_t *pclk2_doubler) { - uint32_t flatency = 0; - RCC_ClkInitTypeDef RCC_ClkInitStruct; + rt_uint32_t flatency = 0; + RCC_ClkInitTypeDef RCC_ClkInitStruct = {0}; RT_ASSERT(pclk1_doubler != RT_NULL); RT_ASSERT(pclk1_doubler != RT_NULL); @@ -167,15 +167,28 @@ static void pclkx_doubler_get(uint32_t *pclk1_doubler, uint32_t *pclk2_doubler) *pclk1_doubler = 1; *pclk2_doubler = 1; - if(RCC_ClkInitStruct.APB1CLKDivider != RCC_HCLK_DIV1) +#if defined(SOC_SERIES_STM32MP1) + if (RCC_ClkInitStruct.APB1_Div != RCC_APB1_DIV1) + { + *pclk1_doubler = 2; + } + if (RCC_ClkInitStruct.APB2_Div != RCC_APB2_DIV1) + { + *pclk2_doubler = 2; + } +#else + + if (RCC_ClkInitStruct.APB1CLKDivider != RCC_HCLK_DIV1) { *pclk1_doubler = 2; } - - if(RCC_ClkInitStruct.APB2CLKDivider != RCC_HCLK_DIV1) +#if !defined(SOC_SERIES_STM32F0) && !defined(SOC_SERIES_STM32G0) + if (RCC_ClkInitStruct.APB2CLKDivider != RCC_HCLK_DIV1) { *pclk2_doubler = 2; } +#endif +#endif } static void timer_init(struct rt_hwtimer_device *timer, rt_uint32_t state) From c77e9991ea6fe111434d64d99c8915b67033e585 Mon Sep 17 00:00:00 2001 From: thread-liu Date: Fri, 28 Aug 2020 13:47:46 +0800 Subject: [PATCH 2/2] [update] delete extra null string. --- bsp/stm32/libraries/HAL_Drivers/drv_hwtimer.c | 1 - 1 file changed, 1 deletion(-) diff --git a/bsp/stm32/libraries/HAL_Drivers/drv_hwtimer.c b/bsp/stm32/libraries/HAL_Drivers/drv_hwtimer.c index bb6ec20ffa..274f3dc44f 100644 --- a/bsp/stm32/libraries/HAL_Drivers/drv_hwtimer.c +++ b/bsp/stm32/libraries/HAL_Drivers/drv_hwtimer.c @@ -177,7 +177,6 @@ static void pclkx_doubler_get(rt_uint32_t *pclk1_doubler, rt_uint32_t *pclk2_dou *pclk2_doubler = 2; } #else - if (RCC_ClkInitStruct.APB1CLKDivider != RCC_HCLK_DIV1) { *pclk1_doubler = 2;