Paparazzi UAS v7.1_unstable
Paparazzi is a free software Unmanned Aircraft System.
Loading...
Searching...
No Matches
sys_time_arch.c File Reference

Handling of sys_time in sim. More...

#include "mcu_periph/sys_time.h"
#include "std.h"
#include <time.h>
+ Include dependency graph for sys_time_arch.c:

Go to the source code of this file.

Functions

void sys_tick_handler (void)
 
void sys_time_arch_init (void)
 
uint32_t get_sys_time_usec (void)
 Get the time in microseconds since startup.
 
uint32_t get_sys_time_usec100 (void)
 Get the time in 100microseconds since startup.
 
uint32_t get_sys_time_msec (void)
 Get the time in milliseconds since startup.
 
void sys_time_usleep (uint32_t us)
 Sleep.
 
void sys_time_msleep (uint32_t ms)
 Sleep.
 
uint32_t sys_time_rtc_millisecond (void)
 Get the RTC time in milliseconds since midnight.
 

Variables

static uint32_t rtc_ms_start
 

Detailed Description

Handling of sys_time in sim.

Definition in file sys_time_arch.c.

Function Documentation

◆ get_sys_time_msec()

uint32_t get_sys_time_msec ( void  )

Get the time in milliseconds since startup.

Returns
milliseconds since startup as uint32_t

Definition at line 64 of file sys_time_arch.c.

References msec_of_cpu_ticks(), sys_time::nb_sec, and sys_time::nb_sec_rem.

+ Here is the call graph for this function:

◆ get_sys_time_usec()

uint32_t get_sys_time_usec ( void  )

Get the time in microseconds since startup.

WARNING: overflows after 70min!

Returns
microseconds since startup as uint32_t

WARNING: overflows after 71min34seconds!

Returns
current system time as uint32_t

Definition at line 52 of file sys_time_arch.c.

References sys_time::nb_sec, sys_time::nb_sec_rem, and usec_of_cpu_ticks().

+ Here is the call graph for this function:

◆ get_sys_time_usec100()

uint32_t get_sys_time_usec100 ( void  )

Get the time in 100microseconds since startup.

WARNING: overflows after 7000min!

Returns
100microseconds since startup as uint32_t

Get the time in 100microseconds since startup.

WARNING: overflows after 7000min!

Returns
100microseconds since startup as uint32_t

WARNING: overflows after 7000 minutes!

Returns
current system time as uint32_t

Definition at line 58 of file sys_time_arch.c.

References sys_time::nb_sec, sys_time::nb_sec_rem, and usec_of_cpu_ticks().

+ Here is the call graph for this function:

◆ sys_tick_handler()

◆ sys_time_arch_init()

void sys_time_arch_init ( void  )

◆ sys_time_msleep()

void sys_time_msleep ( uint32_t  ms)

Sleep.

Parameters
msmilliseconds

Definition at line 92 of file sys_time_arch.c.

References sys_time_usleep().

+ Here is the call graph for this function:

◆ sys_time_rtc_millisecond()

uint32_t sys_time_rtc_millisecond ( void  )

Get the RTC time in milliseconds since midnight.

Returns
milliseconds since midnight as uint32_t

Definition at line 96 of file sys_time_arch.c.

References sys_time::cpu_ticks_per_sec, foo, sys_time::nb_sec, sys_time::nb_sec_rem, and rtc_ms_start.

◆ sys_time_usleep()

void sys_time_usleep ( uint32_t  us)

Sleep.

Parameters
usmicroseconds

Sleep.

using intermediate 64 bits variable to avoid wrapping

max sleep time is around 10 days (2^32 / CH_CFG_ST_FREQUENCY) at 10kHz

Definition at line 90 of file sys_time_arch.c.

Variable Documentation

◆ rtc_ms_start

uint32_t rtc_ms_start
static

Definition at line 33 of file sys_time_arch.c.

Referenced by sys_time_arch_init(), and sys_time_rtc_millisecond().