PebbleOS
Loading...
Searching...
No Matches
Data Structures | Macros | Typedefs | Functions
types.h File Reference
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <pbl/kernel/backend.h>

Data Structures

struct  pbl_timeout_t
 Timeout of a blocking call. More...
 

Macros

#define PBL_TICK_HZ   CONFIG_KERNEL_TICK_HZ
 Tick rate in Hz, from CONFIG_KERNEL_TICK_HZ.
 
#define PBL_TICK_FOREVER   UINT32_MAX
 Tick count that stands for an infinite timeout.
 
#define PBL_NO_WAIT   ((pbl_timeout_t){.ticks = 0})
 Do not wait: fail with -EBUSY if the call would block.
 
#define PBL_FOREVER   ((pbl_timeout_t){.ticks = PBL_TICK_FOREVER})
 Wait without a time limit.
 
#define PBL_TICKS(t)   ((pbl_timeout_t){.ticks = (t)})
 Timeout in ticks.
 
#define PBL_MSEC(ms)   ((pbl_timeout_t){.ticks = pbl_ms_to_ticks(ms)})
 Timeout in milliseconds, rounded down to whole ticks.
 
#define PBL_SEC(s)   PBL_MSEC((s) * 1000U)
 Timeout in seconds.
 
#define PBL_PRIO_IDLE   ((pbl_prio_t)0)
 Lowest priority, the one of the idle thread.
 
#define PBL_PRIO_MAX   ((pbl_prio_t)(CONFIG_KERNEL_NUM_PRIORITIES - 1))
 Highest priority, CONFIG_KERNEL_NUM_PRIORITIES - 1.
 

Typedefs

typedef uint32_t pbl_tick_t
 Kernel tick count.
 
typedef uint8_t pbl_prio_t
 Thread priority.
 

Functions

pbl_tick_t pbl_ms_to_ticks (uint32_t ms)
 Convert milliseconds to ticks, rounding down.
 
uint32_t pbl_ticks_to_ms (pbl_tick_t ticks)
 Convert ticks to milliseconds, rounding down.
 
static bool pbl_timeout_is_forever (pbl_timeout_t t)
 Check whether a timeout is PBL_FOREVER.
 
static bool pbl_timeout_is_no_wait (pbl_timeout_t t)
 Check whether a timeout is PBL_NO_WAIT.