X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=blobdiff_plain;f=src%2Fstm%2Fao_timer.c;h=9e9436cfa685dae451ae27ff59b8c9af6b32be1c;hp=8db62e76a806b6ff51e49ecb3e23d0cc087aab72;hb=2f87e182d9f0b3c2856f62149371ad70b16148cf;hpb=c674a20432c2cb97e5bc2a3de891f78b9e172fe9 diff --git a/src/stm/ao_timer.c b/src/stm/ao_timer.c index 8db62e76..9e9436cf 100644 --- a/src/stm/ao_timer.c +++ b/src/stm/ao_timer.c @@ -3,7 +3,8 @@ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License. + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of @@ -25,6 +26,8 @@ #define HAS_TICK 1 #endif +#if HAS_TICK || defined(AO_TIMER_HOOK) + #if HAS_TICK volatile AO_TICK_TYPE ao_tick_count; @@ -33,16 +36,20 @@ ao_time(void) { return ao_tick_count; } +#endif #if AO_DATA_ALL -volatile __data uint8_t ao_data_interval = 1; -volatile __data uint8_t ao_data_count; +volatile uint8_t ao_data_interval = 1; +volatile uint8_t ao_data_count; #endif void stm_systick_isr(void) { + ao_validate_cur_stack(); if (stm_systick.csr & (1 << STM_SYSTICK_CSR_COUNTFLAG)) { +#if HAS_TICK ++ao_tick_count; +#endif #if HAS_TASK_QUEUE if (ao_task_alarm_tick && (int16_t) (ao_tick_count - ao_task_alarm_tick) >= 0) ao_task_check_alarm((uint16_t) ao_tick_count); @@ -88,6 +95,7 @@ ao_timer_init(void) stm_systick.csr = ((1 << STM_SYSTICK_CSR_ENABLE) | (1 << STM_SYSTICK_CSR_TICKINT) | (STM_SYSTICK_CSR_CLKSOURCE_HCLK_8 << STM_SYSTICK_CSR_CLKSOURCE)); + stm_nvic.shpr15_12 |= AO_STM_NVIC_CLOCK_PRIORITY << 24; } #endif @@ -146,7 +154,7 @@ ao_clock_init(void) #define STM_RCC_CFGR_PLLSRC_TARGET_CLOCK (0 << STM_RCC_CFGR_PLLSRC) #endif -#if !AO_HSE || HAS_ADC +#if !AO_HSE || HAS_ADC || HAS_ADC_SINGLE /* Enable HSI RC clock 16MHz */ stm_rcc.cr |= (1 << STM_RCC_CR_HSION); while (!(stm_rcc.cr & (1 << STM_RCC_CR_HSIRDY)))