ztimer API More...

Detailed Description

#include <stdint.h>
#include "sched.h"
#include "msg.h"
#include "mutex.h"
#include "rmutex.h"
+ Include dependency graph for ztimer.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  ztimer_base
 Minimum information for each timer. More...
 
struct  ztimer_t
 ztimer structure More...
 
struct  ztimer_ops_t
 ztimer backend method structure More...
 
struct  ztimer_clock
 ztimer device structure More...
 

Macros

#define ZTIMER_CLOCK_NO_REQUIRED_PM_MODE   (UINT8_MAX)
 Disables interaction with pm_layered for a clock.
 
#define MSG_ZTIMER   0xc83e
 msg type used by ztimer_msg_receive_timeout
 

Typedefs

typedef struct ztimer_base ztimer_base_t
 ztimer_base_t forward declaration
 
typedef struct ztimer_clock ztimer_clock_t
 ztimer_clock_t forward declaration
 
typedef uint32_t ztimer_now_t
 type for ztimer_now() result
 

Functions

void ztimer_handler (ztimer_clock_t *clock)
 main ztimer callback handler More...
 
uint32_t ztimer_set (ztimer_clock_t *clock, ztimer_t *timer, uint32_t val)
 Set a timer on a clock. More...
 
unsigned ztimer_is_set (const ztimer_clock_t *clock, const ztimer_t *timer)
 Check if a timer is currently active. More...
 
bool ztimer_remove (ztimer_clock_t *clock, ztimer_t *timer)
 Remove a timer from a clock. More...
 
void ztimer_set_msg (ztimer_clock_t *clock, ztimer_t *timer, uint32_t offset, msg_t *msg, kernel_pid_t target_pid)
 Post a message after a delay. More...
 
int ztimer_msg_receive_timeout (ztimer_clock_t *clock, msg_t *msg, uint32_t timeout)
 receive a message (blocking, with timeout) More...
 
ztimer_now_t _ztimer_now_extend (ztimer_clock_t *clock)
 ztimer_now() for extending timers
 
static ztimer_now_t ztimer_now (ztimer_clock_t *clock)
 Get the current time from a clock. More...
 
void ztimer_periodic_wakeup (ztimer_clock_t *clock, uint32_t *last_wakeup, uint32_t period)
 Suspend the calling thread until the time (last_wakeup + period) More...
 
void ztimer_sleep (ztimer_clock_t *clock, uint32_t duration)
 Put the calling thread to sleep for the specified number of ticks. More...
 
static void ztimer_spin (ztimer_clock_t *clock, uint32_t duration)
 Busy-wait specified duration. More...
 
void ztimer_set_wakeup (ztimer_clock_t *clock, ztimer_t *timer, uint32_t offset, kernel_pid_t pid)
 Set a timer that wakes up a thread. More...
 
void ztimer_set_timeout_flag (ztimer_clock_t *clock, ztimer_t *timer, uint32_t timeout)
 Set timeout thread flag after timeout. More...
 
int ztimer_mutex_lock_timeout (ztimer_clock_t *clock, mutex_t *mutex, uint32_t timeout)
 Try to lock the given mutex, but give up after timeout. More...
 
int ztimer_rmutex_lock_timeout (ztimer_clock_t *clock, rmutex_t *rmutex, uint32_t timeout)
 Try to lock the given rmutex, but give up after timeout. More...
 
void ztimer_init (void)
 Initialize the board-specific default ztimer configuration.
 
static void ztimer_init_extend (ztimer_clock_t *clock)
 Initialize possible ztimer extension intermediate timer. More...
 

Variables

ztimer_clock_t *const ZTIMER_USEC
 Default ztimer microsecond clock.
 
ztimer_clock_t *const ZTIMER_MSEC
 Default ztimer millisecond clock.
 
ztimer_clock_t *const ZTIMER_SEC
 Default ztimer second clock.
 
ztimer_clock_t *const ZTIMER_USEC_BASE
 Base ztimer for the microsecond clock (ZTIMER_USEC) More...
 
ztimer_clock_t *const ZTIMER_MSEC_BASE
 Base ztimer for the millisecond clock (ZTIMER_MSEC) More...