|
Paparazzi UAS v7.1_unstable
Paparazzi is a free software Unmanned Aircraft System.
|
linux timing functions More...
#include "mcu_periph/sys_time.h"#include <stdio.h>#include <pthread.h>#include <sys/timerfd.h>#include <time.h>#include "rt_priority.h"#include "std.h"#include <unistd.h>Go to the source code of this file.
Macros | |
| #define | SYS_TIME_THREAD_PRIO 29 |
| #define | NSEC_OF_SEC(sec) |
Functions | |
| void | sys_tick_handler (void) |
| void * | sys_time_thread_main (void *data) |
| 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. | |
| void | sys_time_rtc_set (uint32_t unix_time, uint16_t unix_ms) |
| The system clock is not changed. | |
Variables | |
| static struct timespec | startup_time |
linux timing functions
Definition in file sys_time_arch.c.
| #define NSEC_OF_SEC | ( | sec | ) |
Definition at line 51 of file sys_time_arch.c.
Referenced by sys_time_thread_main().
| #define SYS_TIME_THREAD_PRIO 29 |
Definition at line 42 of file sys_time_arch.c.
Referenced by sys_time_thread_main().
| uint32_t get_sys_time_msec | ( | void | ) |
Get the time in milliseconds since startup.
Definition at line 205 of file sys_time_arch.c.
References startup_time.
| uint32_t get_sys_time_usec | ( | void | ) |
Get the time in microseconds since startup.
WARNING: overflows after 71min34seconds!
Definition at line 160 of file sys_time_arch.c.
References startup_time.
| uint32_t get_sys_time_usec100 | ( | void | ) |
Get the time in 100microseconds since startup.
WARNING: overflows after 7000 minutes!
Definition at line 183 of file sys_time_arch.c.
References startup_time.
| void sys_tick_handler | ( | void | ) |
Definition at line 115 of file sys_time_arch.c.
References sys_time_timer::cb, cpu_ticks_of_nsec(), sys_time_timer::duration, sys_time_timer::elapsed, sys_time_timer::end_time, sys_time_timer::in_use, LED_TOGGLE, sys_time::nb_sec, sys_time::nb_sec_rem, sys_time::nb_tick, startup_time, SYS_TIME_NB_TIMER, sys_time_ticks_of_sec(), sys_time_ticks_of_usec(), and sys_time::timer.
| void sys_time_arch_init | ( | void | ) |
Definition at line 97 of file sys_time_arch.c.
References sys_time::cpu_ticks_per_sec, sys_time::resolution, sys_time::resolution_cpu_ticks, startup_time, and sys_time_thread_main().
| void sys_time_msleep | ( | uint32_t | ms | ) |
Sleep.
| ms | milliseconds |
Definition at line 228 of file sys_time_arch.c.
References sys_time_usleep().
| uint32_t sys_time_rtc_millisecond | ( | void | ) |
Get the RTC time in milliseconds since midnight.
Definition at line 232 of file sys_time_arch.c.
The system clock is not changed.
Set the RTC to the UTC unix time (architecture specific, may do nothing).
Definition at line 245 of file sys_time_arch.c.
| void * sys_time_thread_main | ( | void * | data | ) |
Definition at line 53 of file sys_time_arch.c.
References fd, get_rt_prio(), NSEC_OF_SEC, sys_time::resolution, sys_tick_handler(), and SYS_TIME_THREAD_PRIO.
Referenced by sys_time_arch_init().
| void sys_time_usleep | ( | uint32_t | us | ) |
Sleep.
| us | microseconds |
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 223 of file sys_time_arch.c.
|
static |
Definition at line 45 of file sys_time_arch.c.
Referenced by get_sys_time_msec(), get_sys_time_usec(), get_sys_time_usec100(), sys_tick_handler(), and sys_time_arch_init().