Paparazzi UAS  v4.2.2_stable-4-gcc32f65
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
sys_time_arch.h File Reference

STM32 timing functions. More...

#include "mcu_periph/sys_time.h"
#include <stm32/gpio.h>
#include <stm32/rcc.h>
#include "std.h"
+ Include dependency graph for sys_time_arch.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define CPU_TICKS_OF_SEC(s)   (uint32_t)((s) * AHB_CLK + 0.5)
 
#define SIGNED_CPU_TICKS_OF_SEC(s)   (int32_t)((s) * AHB_CLK + 0.5)
 
#define SEC_OF_CPU_TICKS(t)   ((t) / AHB_CLK)
 
#define MSEC_OF_CPU_TICKS(t)   ((t) / (AHB_CLK/1000))
 
#define USEC_OF_CPU_TICKS(t)   ((t) / (AHB_CLK/1000000))
 
#define GET_CUR_TIME_USEC()
 
#define SysTimeTimerStart(_t)   { _t = GET_CUR_TIME_USEC(); }
 
#define SysTimeTimer(_t)   ( GET_CUR_TIME_USEC() - (_t))
 
#define SysTimeTimerStop(_t)   { _t = ( GET_CUR_TIME_USEC() - (_t)); }
 

Functions

void sys_tick_irq_handler (void)
 
static void sys_time_usleep (uint32_t us)
 Busy wait, in microseconds. More...
 

Detailed Description

STM32 timing functions.

Definition in file sys_time_arch.h.

Macro Definition Documentation

#define CPU_TICKS_OF_SEC (   s)    (uint32_t)((s) * AHB_CLK + 0.5)

Definition at line 41 of file sys_time_arch.h.

#define GET_CUR_TIME_USEC ( )
Value:
(sys_time.nb_sec * 1000000 + \
USEC_OF_CPU_TICKS(SysTick->LOAD - SysTick->VAL))
#define USEC_OF_CPU_TICKS(t)
Definition: sys_time_arch.h:46
volatile uint32_t nb_sec_rem
remainder of second in CPU_TICKS
Definition: sys_time.h:56
volatile uint32_t nb_sec
full seconds since startup
Definition: sys_time.h:55

Definition at line 48 of file sys_time_arch.h.

Referenced by sys_time_usleep().

#define MSEC_OF_CPU_TICKS (   t)    ((t) / (AHB_CLK/1000))

Definition at line 45 of file sys_time_arch.h.

#define SEC_OF_CPU_TICKS (   t)    ((t) / AHB_CLK)

Definition at line 44 of file sys_time_arch.h.

#define SIGNED_CPU_TICKS_OF_SEC (   s)    (int32_t)((s) * AHB_CLK + 0.5)

Definition at line 42 of file sys_time_arch.h.

#define SysTimeTimer (   _t)    ( GET_CUR_TIME_USEC() - (_t))

Definition at line 53 of file sys_time_arch.h.

#define SysTimeTimerStart (   _t)    { _t = GET_CUR_TIME_USEC(); }

Definition at line 52 of file sys_time_arch.h.

#define SysTimeTimerStop (   _t)    { _t = ( GET_CUR_TIME_USEC() - (_t)); }

Definition at line 54 of file sys_time_arch.h.

#define USEC_OF_CPU_TICKS (   t)    ((t) / (AHB_CLK/1000000))

Definition at line 46 of file sys_time_arch.h.

Function Documentation

static void sys_time_usleep ( uint32_t  us)
inlinestatic

Busy wait, in microseconds.

Definition at line 59 of file sys_time_arch.h.

References GET_CUR_TIME_USEC.