You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by GitBox <gi...@apache.org> on 2018/04/26 08:36:08 UTC

[GitHub] mkiiskila commented on a change in pull request #1039: Add stm32 common hal_timer (f4/f7/f3/l1)

mkiiskila commented on a change in pull request #1039: Add stm32 common hal_timer (f4/f7/f3/l1)
URL: https://github.com/apache/mynewt-core/pull/1039#discussion_r184309210
 
 

 ##########
 File path: hw/mcu/stm/stm32_common/src/hal_timer.c
 ##########
 @@ -308,26 +409,80 @@ stm32f7_hw_setdown(TIM_TypeDef *regs)
 int
 hal_timer_init(int num, void *cfg)
 {
-    struct stm32f7_hal_tmr *tmr;
+    struct stm32_hal_tmr *tmr;
+    TIM_TypeDef *regs;
 
-    if (num >= STM32F7_HAL_TIMER_MAX || !(tmr = stm32f7_tmr_devs[num]) ||
+    if (num >= STM32_HAL_TIMER_MAX || !(tmr = stm32_tmr_devs[num]) ||
         (cfg == NULL)) {
         return -1;
     }
 
-    tmr->sht_regs = (TIM_TypeDef *)cfg;
+    regs = tmr->sht_regs = (TIM_TypeDef *)cfg;
 
-    if (!IS_TIM_CC1_INSTANCE(tmr->sht_regs)) {
+    if (!IS_TIM_CC1_INSTANCE(regs)) {
         return -1;
     }
 
-    stm32f7_hw_setup(num, tmr->sht_regs);
+    stm32_hw_setup(num, regs);
 
     /*
-     * Stop the timers at debugger. XXX Which TIM?
+     * Stop the timers at debugger.
      */
-    DBGMCU->APB1FZ |= 0x1ff; /* TIM2 - TIM7, TIM12-TIM14 */
-    DBGMCU->APB2FZ |= 0x70003; /* TIM1, TIM8-TIM11 */
+#ifdef TIM1
 
 Review comment:
   Opinion: this is a lot of code space being used for very little gain.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services