ChibiOS/HAL
6.1.0
|
OSAL module header. More...
#include <stddef.h>
#include <stdint.h>
#include <stdbool.h>
Go to the source code of this file.
Data Structures | |
struct | event_source |
Events source object. More... | |
struct | threads_queue_t |
Type of a thread queue. More... | |
Macros | |
#define | OSAL_DBG_ENABLE_ASSERTS FALSE |
Enables OSAL assertions. More... | |
#define | OSAL_DBG_ENABLE_CHECKS FALSE |
Enables OSAL functions parameters checks. More... | |
Common constants | |
#define | FALSE 0 |
#define | TRUE 1 |
#define | OSAL_SUCCESS false |
#define | OSAL_FAILED true |
Messages | |
#define | MSG_OK (msg_t)0 |
#define | MSG_TIMEOUT (msg_t)-1 |
#define | MSG_RESET (msg_t)-2 |
Special time constants | |
#define | TIME_IMMEDIATE ((sysinterval_t)0) |
#define | TIME_INFINITE ((sysinterval_t)-1) |
Systick modes. | |
#define | OSAL_ST_MODE_NONE 0 |
#define | OSAL_ST_MODE_PERIODIC 1 |
#define | OSAL_ST_MODE_FREERUNNING 2 |
Systick parameters. | |
#define | OSAL_ST_RESOLUTION 32 |
Size in bits of the systick_t type. More... | |
#define | OSAL_ST_FREQUENCY 1000 |
Required systick frequency or resolution. More... | |
#define | OSAL_ST_MODE OSAL_ST_MODE_PERIODIC |
Systick mode required by the underlying OS. More... | |
IRQ-related constants | |
#define | OSAL_IRQ_PRIORITY_LEVELS 16U |
Total priority levels. More... | |
#define | OSAL_IRQ_MAXIMUM_PRIORITY 0U |
Highest IRQ priority for HAL drivers. More... | |
Debug related macros | |
#define | osalDbgAssert(c, remark) |
Condition assertion. More... | |
#define | osalDbgCheck(c) |
Function parameters check. More... | |
#define | osalDbgCheckClassI() |
I-Class state check. More... | |
#define | osalDbgCheckClassS() |
S-Class state check. More... | |
IRQ service routines wrappers | |
#define | OSAL_IRQ_IS_VALID_PRIORITY(n) (((n) >= OSAL_IRQ_MAXIMUM_PRIORITY) && ((n) < OSAL_IRQ_PRIORITY_LEVELS)) |
Priority level verification macro. More... | |
#define | OSAL_IRQ_PROLOGUE() |
IRQ prologue code. More... | |
#define | OSAL_IRQ_EPILOGUE() |
IRQ epilogue code. More... | |
#define | OSAL_IRQ_HANDLER(id) void id(void) |
IRQ handler function declaration. More... | |
Time conversion utilities | |
#define | OSAL_S2I(secs) ((sysinterval_t)((uint32_t)(secs) * (uint32_t)OSAL_ST_FREQUENCY)) |
Seconds to system ticks. More... | |
#define | OSAL_MS2I(msecs) |
Milliseconds to system ticks. More... | |
#define | OSAL_US2I(usecs) |
Microseconds to system ticks. More... | |
Time conversion utilities for the realtime counter | |
#define | OSAL_S2RTC(freq, sec) ((freq) * (sec)) |
Seconds to realtime counter. More... | |
#define | OSAL_MS2RTC(freq, msec) (rtcnt_t)((((freq) + 999UL) / 1000UL) * (msec)) |
Milliseconds to realtime counter. More... | |
#define | OSAL_US2RTC(freq, usec) (rtcnt_t)((((freq) + 999999UL) / 1000000UL) * (usec)) |
Microseconds to realtime counter. More... | |
Sleep macros using absolute time | |
#define | osalThreadSleepSeconds(secs) osalThreadSleep(OSAL_S2I(secs)) |
Delays the invoking thread for the specified number of seconds. More... | |
#define | osalThreadSleepMilliseconds(msecs) osalThreadSleep(OSAL_MS2I(msecs)) |
Delays the invoking thread for the specified number of milliseconds. More... | |
#define | osalThreadSleepMicroseconds(usecs) osalThreadSleep(OSAL_US2I(usecs)) |
Delays the invoking thread for the specified number of microseconds. More... | |
Typedefs | |
typedef uint32_t | syssts_t |
Type of a system status word. More... | |
typedef int32_t | msg_t |
Type of a message. More... | |
typedef uint32_t | systime_t |
Type of system time counter. More... | |
typedef uint32_t | sysinterval_t |
Type of system time interval. More... | |
typedef uint32_t | rtcnt_t |
Type of realtime counter. More... | |
typedef void * | thread_reference_t |
Type of a thread reference. More... | |
typedef uint32_t | eventflags_t |
Type of an event flags mask. More... | |
typedef struct event_source | event_source_t |
Type of an event flags object. More... | |
typedef void(* | eventcallback_t) (event_source_t *esp) |
Type of an event source callback. More... | |
typedef uint32_t | mutex_t |
Type of a mutex. More... | |
Functions | |
void | osalInit (void) |
OSAL module initialization. More... | |
void | osalSysHalt (const char *reason) |
System halt with error message. More... | |
void | osalSysPolledDelayX (rtcnt_t cycles) |
Polled delay. More... | |
void | osalOsTimerHandlerI (void) |
System timer handler. More... | |
void | osalOsRescheduleS (void) |
Checks if a reschedule is required and performs it. More... | |
systime_t | osalOsGetSystemTimeX (void) |
Current system time. More... | |
void | osalThreadSleepS (sysinterval_t time) |
Suspends the invoking thread for the specified time. More... | |
void | osalThreadSleep (sysinterval_t time) |
Suspends the invoking thread for the specified time. More... | |
msg_t | osalThreadSuspendS (thread_reference_t *trp) |
Sends the current thread sleeping and sets a reference variable. More... | |
msg_t | osalThreadSuspendTimeoutS (thread_reference_t *trp, sysinterval_t timeout) |
Sends the current thread sleeping and sets a reference variable. More... | |
void | osalThreadResumeI (thread_reference_t *trp, msg_t msg) |
Wakes up a thread waiting on a thread reference object. More... | |
void | osalThreadResumeS (thread_reference_t *trp, msg_t msg) |
Wakes up a thread waiting on a thread reference object. More... | |
msg_t | osalThreadEnqueueTimeoutS (threads_queue_t *tqp, sysinterval_t timeout) |
Enqueues the caller thread. More... | |
void | osalThreadDequeueNextI (threads_queue_t *tqp, msg_t msg) |
Dequeues and wakes up one thread from the queue, if any. More... | |
void | osalThreadDequeueAllI (threads_queue_t *tqp, msg_t msg) |
Dequeues and wakes up all threads from the queue. More... | |
void | osalEventBroadcastFlagsI (event_source_t *esp, eventflags_t flags) |
Add flags to an event source object. More... | |
void | osalEventBroadcastFlags (event_source_t *esp, eventflags_t flags) |
Add flags to an event source object. More... | |
void | osalEventSetCallback (event_source_t *esp, eventcallback_t cb, void *param) |
Event callback setup. More... | |
void | osalMutexLock (mutex_t *mp) |
Locks the specified mutex. More... | |
void | osalMutexUnlock (mutex_t *mp) |
Unlocks the specified mutex. More... | |
static void | osalSysDisable (void) |
Disables interrupts globally. More... | |
static void | osalSysEnable (void) |
Enables interrupts globally. More... | |
static void | osalSysLock (void) |
Enters a critical zone from thread context. More... | |
static void | osalSysUnlock (void) |
Leaves a critical zone from thread context. More... | |
static void | osalSysLockFromISR (void) |
Enters a critical zone from ISR context. More... | |
static void | osalSysUnlockFromISR (void) |
Leaves a critical zone from ISR context. More... | |
static syssts_t | osalSysGetStatusAndLockX (void) |
Returns the execution status and enters a critical zone. More... | |
static void | osalSysRestoreStatusX (syssts_t sts) |
Restores the specified execution status and leaves a critical zone. More... | |
static systime_t | osalTimeAddX (systime_t systime, sysinterval_t interval) |
Adds an interval to a system time returning a system time. More... | |
static sysinterval_t | osalTimeDiffX (systime_t start, systime_t end) |
Subtracts two system times returning an interval. More... | |
static bool | osalTimeIsInRangeX (systime_t time, systime_t start, systime_t end) |
Checks if the specified time is within the specified time window. More... | |
static void | osalThreadQueueObjectInit (threads_queue_t *tqp) |
Initializes a threads queue object. More... | |
static void | osalEventObjectInit (event_source_t *esp) |
Initializes an event source object. More... | |
static void | osalMutexObjectInit (mutex_t *mp) |
Initializes s mutex_t object. More... | |
Variables | |
const char * | osal_halt_msg |
Pointer to a halt error message. More... | |
OSAL module header.
Definition in file osal.h.