1 #include <stm32f10x_map.h>
6 #include <debug-uart.h>
8 static volatile clock_time_t current_clock = 0;
9 static volatile unsigned long current_seconds = 0;
19 SCB->ICSR = SCB_ICSR_PENDSTCLR;
26 if (--second_countdown == 0) {
36 NVIC_SET_SYSTICK_PRI(8);
38 SysTick->CTRL = SysTick_CTRL_ENABLE | SysTick_CTRL_TICKINT;
51 #define SPIN_COUNT (((MCK*SPIN_TIME/1000000)-5)/4)
53 #ifndef __MAKING_DEPS__
59 asm volatile(
"1: mov r1,%2\n2:\tsub r1,#1\n\tbne 2b\n\tsub %0,#1\n\tbne 1b\n":
"=l"(t):
"0"(t),
"l"(SPIN_COUNT));
61 #error Must be compiled in thumb mode
70 return current_seconds;