32 #ifndef SYS_TIME_ARCH_H
33 #define SYS_TIME_ARCH_H
37 #include <libopencm3/stm32/gpio.h>
38 #include <libopencm3/stm32/rcc.h>
39 #include <libopencm3/cm3/systick.h>
41 #ifdef RTOS_IS_CHIBIOS
42 #include "chibios_stub.h"
53 #ifdef RTOS_IS_CHIBIOS
54 return (chibios_chTimeNow() * (1000000 / CH_FREQUENCY));
68 #ifdef RTOS_IS_CHIBIOS
69 return (chibios_chTimeNow() * (1000 / CH_FREQUENCY));
85 #ifdef RTOS_IS_CHIBIOS
86 chibios_chThdSleepMicroseconds(us);
89 uint32_t start = systick_get_value();
103 end = systick_get_reload() - rem + start;
107 while (!systick_get_countflag());
111 while (systick_get_value() > end);
static uint32_t msec_of_cpu_ticks(uint32_t cpu_ticks)
static void sys_time_usleep(uint32_t us)
Busy wait in microseconds.
static uint32_t get_sys_time_usec(void)
Get the time in microseconds since startup.
static uint32_t usec_of_cpu_ticks(uint32_t cpu_ticks)
static uint32_t get_sys_time_msec(void)
Get the time in milliseconds since startup.
Architecture independent timing functions.
volatile uint32_t nb_sec_rem
remainder of seconds since startup in CPU_TICKS
volatile uint32_t nb_sec
full seconds since startup
static uint32_t cpu_ticks_of_usec(uint32_t usec)