ChibiOS/HAL  6.1.0
OSAL

Operating System Abstraction Layer. More...

Collaboration diagram for OSAL:

Detailed Description

Operating System Abstraction Layer.

The OSAL

The OSAL is the link between ChibiOS/HAL and services provided by operating systems like:

ChibiOS/HAL is designed to tightly integrate with the underlying RTOS in order to provide the best experience to developers and minimize integration issues.
This section describes the API that OSALs are expected to expose to the HAL.

RTOS Requirements

The OSAL API closely resembles the ChibiOS/RT API, for obvious reasons, however an OSAL module can be implemented for any reasonably complete RTOS or even a RTOS-less bare metal machine, if required.
In order to be able to support an HAL an RTOS should support the following minimal set of features:

All the above requirements can be satisfied even on naked HW with a very think SW layer. In case that the HAL is required to work without an RTOS.

Supported RTOSes

The RTOSes supported out of the box are:

Implementations have also been successfully created on RTOSes not belonging to the ChibiOS products family but are not supported as a core feature of ChibiOS/HAL.

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...
 

Data Structures

struct  event_source
 Events source object. More...
 
struct  threads_queue_t
 Type of a thread queue. 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...
 
const char * osal_halt_msg
 Pointer to a halt error message. More...
 

Macro Definition Documentation

#define OSAL_ST_RESOLUTION   32

Size in bits of the systick_t type.

Definition at line 86 of file osal.h.

#define OSAL_ST_FREQUENCY   1000

Required systick frequency or resolution.

Definition at line 91 of file osal.h.

#define OSAL_ST_MODE   OSAL_ST_MODE_PERIODIC

Systick mode required by the underlying OS.

Definition at line 96 of file osal.h.

#define OSAL_IRQ_PRIORITY_LEVELS   16U

Total priority levels.

Implementation not mandatory.

Definition at line 107 of file osal.h.

#define OSAL_IRQ_MAXIMUM_PRIORITY   0U

Highest IRQ priority for HAL drivers.

Implementation not mandatory.

Definition at line 113 of file osal.h.

#define OSAL_DBG_ENABLE_ASSERTS   FALSE

Enables OSAL assertions.

Definition at line 124 of file osal.h.

#define OSAL_DBG_ENABLE_CHECKS   FALSE

Enables OSAL functions parameters checks.

Definition at line 131 of file osal.h.

#define osalDbgAssert (   c,
  remark 
)
Value:
do { \
/*lint -save -e506 -e774 [2.1, 14.3] Can be a constant by design.*/ \
if (OSAL_DBG_ENABLE_ASSERTS != FALSE) { \
if (!(c)) { \
/*lint -restore*/ \
osalSysHalt(__func__); \
} \
} \
} while (false)
void osalSysHalt(const char *reason)
System halt with error message.
Definition: osal.c:77
#define OSAL_DBG_ENABLE_ASSERTS
Enables OSAL assertions.
Definition: osal.h:124

Condition assertion.

If the condition check fails then the OSAL panics with a message and halts.

Note
The condition is tested only if the OSAL_ENABLE_ASSERTIONS switch is enabled.
The remark string is not currently used except for putting a comment in the code about the assertion.
Parameters
[in]cthe condition to be verified to be true
[in]remarka remark string
Function Class:Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 258 of file osal.h.

Referenced by _usb_ep0in(), _usb_ep0out(), adcConvert(), adcStart(), adcStartConversionI(), adcStop(), adcStopConversion(), adcStopConversionI(), canReceiveTimeout(), canSleep(), canStart(), canStop(), canTransmitTimeout(), canTryReceiveI(), canTryTransmitI(), canWakeup(), cryDecryptAES(), cryDecryptAES_CBC(), cryDecryptAES_CFB(), cryDecryptAES_CTR(), cryDecryptAES_ECB(), cryDecryptAES_GCM(), cryDecryptDES(), cryDecryptDES_CBC(), cryDecryptDES_ECB(), cryEncryptAES(), cryEncryptAES_CBC(), cryEncryptAES_CFB(), cryEncryptAES_CTR(), cryEncryptAES_ECB(), cryEncryptAES_GCM(), cryEncryptDES(), cryEncryptDES_CBC(), cryEncryptDES_ECB(), crySHA1Final(), crySHA1Init(), crySHA1Update(), crySHA256Final(), crySHA256Init(), crySHA256Update(), crySHA512Final(), crySHA512Init(), crySHA512Update(), cryStart(), cryStop(), cryTRNG(), dacPutChannelX(), dacStart(), dacStartConversionI(), dacStop(), dacStopConversion(), dacStopConversionI(), extChannelDisable(), extChannelEnable(), extSetChannelModeI(), extStart(), extStop(), flashGetSectorOffset(), flashGetSectorSize(), gptChangeInterval(), gptPolledDelay(), gptStart(), gptStartContinuousI(), gptStartOneShotI(), gptStop(), gptStopTimerI(), i2cMasterReceiveTimeout(), i2cMasterTransmitTimeout(), i2cStart(), i2cStop(), i2sStart(), i2sStartExchange(), i2sStop(), i2sStopExchange(), ibqGetFullBufferTimeoutS(), ibqPostFullBufferI(), ibqReleaseEmptyBufferS(), icuDisableNotifications(), icuEnableNotifications(), icuStart(), icuStartCapture(), icuStop(), icuStopCapture(), icuWaitCapture(), macPollLinkStatus(), macStart(), macStop(), macWaitReceiveDescriptor(), macWaitTransmitDescriptor(), mfsStart(), mfsStop(), mmc_cmd6_construct(), mmc_set_bus_width(), mmcConnect(), mmcDisconnect(), mmcStart(), mmcStartSequentialRead(), mmcStartSequentialWrite(), mmcStop(), obqGetEmptyBufferTimeoutS(), obqPostFullBufferS(), obqReleaseEmptyBufferI(), pwmChangePeriod(), pwmDisableChannel(), pwmDisableChannelNotification(), pwmDisablePeriodicNotification(), pwmEnableChannel(), pwmEnableChannelNotification(), pwmEnablePeriodicNotification(), pwmStart(), pwmStop(), qspiCommand(), qspiMapFlash(), qspiReceive(), qspiSend(), qspiStart(), qspiStartCommand(), qspiStartReceive(), qspiStartSend(), qspiStop(), qspiUnmapFlash(), sdc_cmd6_construct(), sdc_lld_set_bus_mode(), sdcConnect(), sdcDisconnect(), sdcErase(), sdcGetAndClearErrors(), sdcRead(), sdcStart(), sdcStop(), sdcWrite(), sdStart(), sdStop(), sduSOFHookI(), sduStart(), sduStop(), spiAbort(), spiAbortI(), spiExchange(), spiIgnore(), spiReceive(), spiSelect(), spiSend(), spiStart(), spiStartExchange(), spiStartIgnore(), spiStartReceive(), spiStartSend(), spiStop(), spiUnselect(), stGetAlarm(), stSetAlarm(), stStartAlarm(), uartReceiveTimeout(), uartSendFullTimeout(), uartSendTimeout(), uartStart(), uartStartReceive(), uartStartReceiveI(), uartStartSend(), uartStartSendI(), uartStop(), uartStopReceive(), uartStopReceiveI(), uartStopSend(), uartStopSendI(), usbDisableEndpointsI(), usbInitEndpointI(), usbStart(), usbStartReceiveI(), usbStartTransmitI(), usbStop(), wdgReset(), wdgStart(), and wdgStop().

#define osalDbgCheck (   c)
Value:
do { \
/*lint -save -e506 -e774 [2.1, 14.3] Can be a constant by design.*/ \
if (OSAL_DBG_ENABLE_CHECKS != FALSE) { \
if (!(c)) { \
/*lint -restore*/ \
osalSysHalt(__func__); \
} \
} \
} while (false)
void osalSysHalt(const char *reason)
System halt with error message.
Definition: osal.c:77
#define OSAL_DBG_ENABLE_CHECKS
Enables OSAL functions parameters checks.
Definition: osal.h:131

Function parameters check.

If the condition check fails then the OSAL panics and halts.

Note
The condition is tested only if the OSAL_ENABLE_CHECKS switch is enabled.
Parameters
[in]cthe condition to be verified to be true
Function Class:Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 278 of file osal.h.

Referenced by _mmcsd_get_capacity(), _mmcsd_get_capacity_ext(), _mmcsd_get_slice(), _mmcsd_unpack_csd_mmc(), _mmcsd_unpack_csd_v10(), _mmcsd_unpack_csd_v20(), _mmcsd_unpack_mmc_cid(), _mmcsd_unpack_sdc_cid(), adcAcquireBus(), adcReleaseBus(), adcStart(), adcStartConversionI(), adcStop(), adcStopConversion(), adcStopConversionI(), canReceiveTimeout(), canSleep(), canStart(), canStop(), canTransmitTimeout(), canTryReceiveI(), canTryTransmitI(), canWakeup(), cryDecryptAES(), cryDecryptAES_CBC(), cryDecryptAES_CFB(), cryDecryptAES_CTR(), cryDecryptAES_ECB(), cryDecryptAES_GCM(), cryDecryptDES(), cryDecryptDES_CBC(), cryDecryptDES_ECB(), cryEncryptAES(), cryEncryptAES_CBC(), cryEncryptAES_CFB(), cryEncryptAES_CTR(), cryEncryptAES_ECB(), cryEncryptAES_GCM(), cryEncryptDES(), cryEncryptDES_CBC(), cryEncryptDES_ECB(), cryLoadTransientKey(), crySHA1Final(), crySHA1Init(), crySHA1Update(), crySHA256Final(), crySHA256Init(), crySHA256Update(), crySHA512Final(), crySHA512Init(), crySHA512Update(), cryStart(), cryStop(), cryTRNG(), dacAcquireBus(), dacPutChannelX(), dacReleaseBus(), dacStart(), dacStartConversionI(), dacStop(), dacStopConversion(), dacStopConversionI(), extChannelDisable(), extChannelEnable(), extSetChannelModeI(), extStart(), extStop(), gptChangeInterval(), gptStart(), gptStartContinuousI(), gptStartOneShotI(), gptStop(), gptStopTimerI(), i2cAcquireBus(), i2cGetErrors(), i2cMasterReceiveTimeout(), i2cMasterTransmitTimeout(), i2cReleaseBus(), i2cStart(), i2cStop(), i2sStart(), i2sStartExchange(), i2sStop(), i2sStopExchange(), ibqObjectInit(), ibqPostFullBufferI(), ibqReadTimeout(), icuDisableNotifications(), icuEnableNotifications(), icuStart(), icuStartCapture(), icuStop(), icuStopCapture(), icuWaitCapture(), iq_read(), iqReadTimeout(), macPollLinkStatus(), macReleaseReceiveDescriptor(), macReleaseTransmitDescriptor(), macStart(), macStop(), macWaitReceiveDescriptor(), macWaitTransmitDescriptor(), mfsErase(), mfsEraseRecord(), mfsObjectInit(), mfsPerformGarbageCollection(), mfsReadRecord(), mfsStart(), mfsStop(), mfsWriteRecord(), mmcConnect(), mmcDisconnect(), mmcErase(), mmcGetInfo(), mmcSequentialRead(), mmcSequentialWrite(), mmcStart(), mmcStartSequentialRead(), mmcStartSequentialWrite(), mmcStop(), mmcStopSequentialRead(), mmcStopSequentialWrite(), mmcSync(), obqObjectInit(), obqPostFullBufferS(), obqWriteTimeout(), oq_write(), oqWriteTimeout(), osalEventBroadcastFlags(), osalEventBroadcastFlagsI(), osalEventObjectInit(), osalEventSetCallback(), osalMutexLock(), osalMutexObjectInit(), osalMutexUnlock(), osalThreadDequeueNextI(), osalThreadEnqueueTimeoutS(), osalThreadQueueObjectInit(), osalThreadResumeI(), osalThreadResumeS(), osalThreadSuspendS(), osalThreadSuspendTimeoutS(), palReadBus(), palSetBusMode(), palWriteBus(), pwmChangePeriod(), pwmDisableChannel(), pwmDisableChannelNotification(), pwmDisablePeriodicNotification(), pwmEnableChannel(), pwmEnableChannelNotification(), pwmEnablePeriodicNotification(), pwmStart(), pwmStop(), qspiAcquireBus(), qspiCommand(), qspiMapFlash(), qspiReceive(), qspiReleaseBus(), qspiSend(), qspiStart(), qspiStartCommand(), qspiStartReceive(), qspiStartSend(), qspiStop(), qspiUnmapFlash(), rtcGetAlarm(), rtcGetTime(), rtcSetAlarm(), rtcSetCallback(), rtcSetTime(), sdcConnect(), sdcDisconnect(), sdcErase(), sdcGetAndClearErrors(), sdcGetInfo(), sdcRead(), sdcStart(), sdcStop(), sdcSync(), sdcWrite(), sdIncomingDataI(), sdRequestDataI(), sdStart(), sdStop(), sduStart(), sduStop(), spiAbortI(), spiAcquireBus(), spiExchange(), spiIgnore(), spiReceive(), spiReleaseBus(), spiSelect(), spiSend(), spiStart(), spiStartExchange(), spiStartIgnore(), spiStartReceive(), spiStartSend(), spiStop(), spiUnselect(), uartAcquireBus(), uartReceiveTimeout(), uartReleaseBus(), uartSendFullTimeout(), uartSendTimeout(), uartStart(), uartStartReceive(), uartStartReceiveI(), uartStartSend(), uartStartSendI(), uartStop(), uartStopReceive(), uartStopReceiveI(), uartStopSend(), uartStopSendI(), usbDisableEndpointsI(), usbInitEndpointI(), usbStallReceiveI(), usbStallTransmitI(), usbStart(), usbStartReceiveI(), usbStartTransmitI(), usbStop(), wdgReset(), wdgStart(), and wdgStop().

#define osalDbgCheckClassS ( )

S-Class state check.

Note
Implementation is optional.

Definition at line 298 of file osal.h.

Referenced by ibqGetFullBufferTimeoutS(), ibqReleaseEmptyBufferS(), obqGetEmptyBufferTimeoutS(), and obqPostFullBufferS().

#define OSAL_IRQ_IS_VALID_PRIORITY (   n)    (((n) >= OSAL_IRQ_MAXIMUM_PRIORITY) && ((n) < OSAL_IRQ_PRIORITY_LEVELS))

Priority level verification macro.

Definition at line 308 of file osal.h.

#define OSAL_IRQ_PROLOGUE ( )

IRQ prologue code.

This macro must be inserted at the start of all IRQ handlers.

Definition at line 315 of file osal.h.

#define OSAL_IRQ_EPILOGUE ( )

IRQ epilogue code.

This macro must be inserted at the end of all IRQ handlers.

Definition at line 321 of file osal.h.

#define OSAL_IRQ_HANDLER (   id)    void id(void)

IRQ handler function declaration.

This macro hides the details of an ISR function declaration.

Parameters
[in]ida vector name as defined in vectors.s

Definition at line 329 of file osal.h.

#define OSAL_S2I (   secs)    ((sysinterval_t)((uint32_t)(secs) * (uint32_t)OSAL_ST_FREQUENCY))

Seconds to system ticks.

Converts from seconds to system ticks number.

Note
The result is rounded upward to the next tick boundary.
Parameters
[in]secsnumber of seconds
Returns
The number of ticks.
Function Class:Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 346 of file osal.h.

#define OSAL_MS2I (   msecs)
Value:
((sysinterval_t)((((((uint32_t)(msecs)) * \
((uint32_t)OSAL_ST_FREQUENCY)) - 1UL) / 1000UL) + 1UL))
#define OSAL_ST_FREQUENCY
Required systick frequency or resolution.
Definition: osal.h:91
uint32_t sysinterval_t
Type of system time interval.
Definition: osal.h:170

Milliseconds to system ticks.

Converts from milliseconds to system ticks number.

Note
The result is rounded upward to the next tick boundary.
Parameters
[in]msecsnumber of milliseconds
Returns
The number of ticks.
Function Class:Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 359 of file osal.h.

#define OSAL_US2I (   usecs)
Value:
((sysinterval_t)((((((uint32_t)(usecs)) * \
((uint32_t)OSAL_ST_FREQUENCY)) - 1UL) / 1000000UL) + 1UL))
#define OSAL_ST_FREQUENCY
Required systick frequency or resolution.
Definition: osal.h:91
uint32_t sysinterval_t
Type of system time interval.
Definition: osal.h:170

Microseconds to system ticks.

Converts from microseconds to system ticks number.

Note
The result is rounded upward to the next tick boundary.
Parameters
[in]usecsnumber of microseconds
Returns
The number of ticks.
Function Class:Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 373 of file osal.h.

#define OSAL_S2RTC (   freq,
  sec 
)    ((freq) * (sec))

Seconds to realtime counter.

Converts from seconds to realtime counter cycles.

Note
The macro assumes that freq >= 1.
Parameters
[in]freqclock frequency, in Hz, of the realtime counter
[in]secnumber of seconds
Returns
The number of cycles.
Function Class:Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 393 of file osal.h.

#define OSAL_MS2RTC (   freq,
  msec 
)    (rtcnt_t)((((freq) + 999UL) / 1000UL) * (msec))

Milliseconds to realtime counter.

Converts from milliseconds to realtime counter cycles.

Note
The result is rounded upward to the next millisecond boundary.
The macro assumes that freq >= 1000.
Parameters
[in]freqclock frequency, in Hz, of the realtime counter
[in]msecnumber of milliseconds
Returns
The number of cycles.
Function Class:Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 407 of file osal.h.

#define OSAL_US2RTC (   freq,
  usec 
)    (rtcnt_t)((((freq) + 999999UL) / 1000000UL) * (usec))

Microseconds to realtime counter.

Converts from microseconds to realtime counter cycles.

Note
The result is rounded upward to the next microsecond boundary.
The macro assumes that freq >= 1000000.
Parameters
[in]freqclock frequency, in Hz, of the realtime counter
[in]usecnumber of microseconds
Returns
The number of cycles.
Function Class:Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 421 of file osal.h.

#define osalThreadSleepSeconds (   secs)    osalThreadSleep(OSAL_S2I(secs))

Delays the invoking thread for the specified number of seconds.

Note
The specified time is rounded up to a value allowed by the real system tick clock.
The maximum specifiable value is implementation dependent.
Parameters
[in]secstime in seconds, must be different from zero
Function Class:Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 438 of file osal.h.

#define osalThreadSleepMilliseconds (   msecs)    osalThreadSleep(OSAL_MS2I(msecs))

Delays the invoking thread for the specified number of milliseconds.

Note
The specified time is rounded up to a value allowed by the real system tick clock.
The maximum specifiable value is implementation dependent.
Parameters
[in]msecstime in milliseconds, must be different from zero
Function Class:Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 451 of file osal.h.

Referenced by _sdc_wait_for_transfer_state(), flashWaitErase(), mmc_init(), mmcConnect(), sdc_init(), sync(), and wait().

#define osalThreadSleepMicroseconds (   usecs)    osalThreadSleep(OSAL_US2I(usecs))

Delays the invoking thread for the specified number of microseconds.

Note
The specified time is rounded up to a value allowed by the real system tick clock.
The maximum specifiable value is implementation dependent.
Parameters
[in]usecstime in microseconds, must be different from zero
Function Class:Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 464 of file osal.h.

Typedef Documentation

typedef uint32_t syssts_t

Type of a system status word.

Definition at line 155 of file osal.h.

typedef int32_t msg_t

Type of a message.

Definition at line 160 of file osal.h.

typedef uint32_t systime_t

Type of system time counter.

Definition at line 165 of file osal.h.

typedef uint32_t sysinterval_t

Type of system time interval.

Definition at line 170 of file osal.h.

typedef uint32_t rtcnt_t

Type of realtime counter.

Definition at line 175 of file osal.h.

typedef void* thread_reference_t

Type of a thread reference.

Definition at line 180 of file osal.h.

typedef uint32_t eventflags_t

Type of an event flags mask.

Definition at line 185 of file osal.h.

typedef struct event_source event_source_t

Type of an event flags object.

Note
The content of this structure is not part of the API and should not be relied upon. Implementers may define this structure in an entirely different way.
Retrieval and clearing of the flags are not defined in this API and are implementation-dependent.

Definition at line 195 of file osal.h.

typedef void(* eventcallback_t) (event_source_t *esp)

Type of an event source callback.

Note
This type is not part of the OSAL API and is provided exclusively as an example and for convenience.

Definition at line 202 of file osal.h.

typedef uint32_t mutex_t

Type of a mutex.

Note
If the OS does not support mutexes or there is no OS then them mechanism can be simulated.

Definition at line 223 of file osal.h.

Function Documentation

void osalInit ( void  )

OSAL module initialization.

Function Class:Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 63 of file osal.c.

Referenced by halInit().

void osalSysHalt ( const char *  reason)

System halt with error message.

Parameters
[in]reasonthe halt message pointer
Function Class:Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 77 of file osal.c.

References osal_halt_msg, and osalSysDisable().

Here is the call graph for this function:

void osalSysPolledDelayX ( rtcnt_t  cycles)

Polled delay.

Note
The real delay is always few cycles in excess of the specified value.
Parameters
[in]cyclesnumber of cycles
Function Class:This is an X-Class API, this function can be invoked from any context.

Definition at line 94 of file osal.c.

void osalOsTimerHandlerI ( void  )

System timer handler.

The handler is used for scheduling and Virtual Timers management.

Function Class:This is an I-Class API, this function can be invoked from within a system lock zone by both threads and interrupt handlers.

Definition at line 105 of file osal.c.

References osalDbgCheckClassI.

void osalOsRescheduleS ( void  )

Checks if a reschedule is required and performs it.

Note
I-Class functions invoked from thread context must not reschedule by themselves, an explicit reschedule using this function is required in this scenario.
Not implemented in this simplified OSAL.
Function Class:This is an S-Class API, this function can be invoked from within a system lock zone by threads only.

Definition at line 119 of file osal.c.

Referenced by canSleep(), canStop(), canWakeup(), sdStop(), sduStop(), spiAbort(), and usbStop().

systime_t osalOsGetSystemTimeX ( void  )

Current system time.

Returns the number of system ticks since the osalInit() invocation.

Note
The counter can reach its maximum and then restart from zero.
This function can be called from any context but its atomicity is not guaranteed on architectures whose word size is less than systime_t size.
Returns
The system time in ticks.
Function Class:This is an X-Class API, this function can be invoked from any context.

Definition at line 136 of file osal.c.

void osalThreadSleepS ( sysinterval_t  time)

Suspends the invoking thread for the specified time.

Parameters
[in]timethe delay in system ticks, the special values are handled as follow:
  • TIME_INFINITE is allowed but interpreted as a normal time specification.
  • TIME_IMMEDIATE this value is not allowed.
Function Class:This is an S-Class API, this function can be invoked from within a system lock zone by threads only.

Definition at line 153 of file osal.c.

void osalThreadSleep ( sysinterval_t  time)

Suspends the invoking thread for the specified time.

Parameters
[in]timethe delay in system ticks, the special values are handled as follow:
  • TIME_INFINITE is allowed but interpreted as a normal time specification.
  • TIME_IMMEDIATE this value is not allowed.
Function Class:Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 170 of file osal.c.

msg_t osalThreadSuspendS ( thread_reference_t trp)

Sends the current thread sleeping and sets a reference variable.

Note
This function must reschedule, it can only be called from thread context.
Parameters
[in]trpa pointer to a thread reference object
Returns
The wake up message.
Function Class:This is an S-Class API, this function can be invoked from within a system lock zone by threads only.

Definition at line 185 of file osal.c.

References osalDbgCheck.

Referenced by adcConvert(), dacConvert(), qspiCommand(), qspiReceive(), qspiSend(), spiExchange(), spiIgnore(), spiReceive(), spiSend(), usbReceive(), and usbTransmit().

msg_t osalThreadSuspendTimeoutS ( thread_reference_t trp,
sysinterval_t  timeout 
)

Sends the current thread sleeping and sets a reference variable.

Note
This function must reschedule, it can only be called from thread context.
Parameters
[in]trpa pointer to a thread reference object
[in]timeoutthe timeout in system ticks, the special values are handled as follow:
  • TIME_INFINITE the thread enters an infinite sleep state.
  • TIME_IMMEDIATE the thread is not enqueued and the function returns MSG_TIMEOUT as if a timeout occurred.
Returns
The wake up message.
Return values
MSG_TIMEOUTif the operation timed out.
Function Class:This is an S-Class API, this function can be invoked from within a system lock zone by threads only.

Definition at line 211 of file osal.c.

References osalDbgCheck.

Referenced by uartReceiveTimeout(), uartSendFullTimeout(), and uartSendTimeout().

void osalThreadResumeI ( thread_reference_t trp,
msg_t  msg 
)

Wakes up a thread waiting on a thread reference object.

Note
This function must not reschedule because it can be called from ISR context.
Parameters
[in]trpa pointer to a thread reference object
[in]msgthe message code
Function Class:This is an I-Class API, this function can be invoked from within a system lock zone by both threads and interrupt handlers.

Definition at line 230 of file osal.c.

References osalDbgCheck.

Referenced by _usb_reset(), _usb_suspend(), spiAbortI(), usbDisableEndpointsI(), and usbStop().

void osalThreadResumeS ( thread_reference_t trp,
msg_t  msg 
)

Wakes up a thread waiting on a thread reference object.

Note
This function must reschedule, it can only be called from thread context.
Parameters
[in]trpa pointer to a thread reference object
[in]msgthe message code
Function Class:This is an I-Class API, this function can be invoked from within a system lock zone by both threads and interrupt handlers.

Definition at line 247 of file osal.c.

References osalDbgCheck.

msg_t osalThreadEnqueueTimeoutS ( threads_queue_t tqp,
sysinterval_t  timeout 
)

Enqueues the caller thread.

The caller thread is enqueued and put to sleep until it is dequeued or the specified timeouts expires.

Parameters
[in]tqppointer to the threads queue object
[in]timeoutthe timeout in system ticks, the special values are handled as follow:
  • TIME_INFINITE the thread enters an infinite sleep state.
  • TIME_IMMEDIATE the thread is not enqueued and the function returns MSG_TIMEOUT as if a timeout occurred.
Returns
The message from osalQueueWakeupOneI() or osalQueueWakeupAllI() functions.
Return values
MSG_TIMEOUTif the thread has not been dequeued within the specified timeout or if the function has been invoked with TIME_IMMEDIATE as timeout specification.
Function Class:This is an S-Class API, this function can be invoked from within a system lock zone by threads only.

Definition at line 277 of file osal.c.

References osalDbgCheck.

Referenced by canReceiveTimeout(), canTransmitTimeout(), ibqGetFullBufferTimeoutS(), iqGetTimeout(), iqReadTimeout(), macWaitReceiveDescriptor(), macWaitTransmitDescriptor(), obqGetEmptyBufferTimeoutS(), oqPutTimeout(), oqWriteTimeout(), palWaitLineTimeoutS(), and palWaitPadTimeoutS().

void osalThreadDequeueNextI ( threads_queue_t tqp,
msg_t  msg 
)

Dequeues and wakes up one thread from the queue, if any.

Parameters
[in]tqppointer to the threads queue object
[in]msgthe message code
Function Class:This is an I-Class API, this function can be invoked from within a system lock zone by both threads and interrupt handlers.

Definition at line 294 of file osal.c.

References osalDbgCheck.

Referenced by ibqPostFullBufferI(), iqPutI(), obqReleaseEmptyBufferI(), and oqGetI().

void osalThreadDequeueAllI ( threads_queue_t tqp,
msg_t  msg 
)

Dequeues and wakes up all threads from the queue.

Parameters
[in]tqppointer to the threads queue object
[in]msgthe message code
Function Class:This is an I-Class API, this function can be invoked from within a system lock zone by both threads and interrupt handlers.

Definition at line 309 of file osal.c.

Referenced by canStop(), ibqResetI(), iqResetI(), obqResetI(), and oqResetI().

void osalEventBroadcastFlagsI ( event_source_t esp,
eventflags_t  flags 
)

Add flags to an event source object.

Parameters
[in]esppointer to the event flags object
[in]flagsflags to be ORed to the flags mask
Function Class:This is an I-Class API, this function can be invoked from within a system lock zone by both threads and interrupt handlers.

Definition at line 323 of file osal.c.

References event_source::cb, event_source::flags, and osalDbgCheck.

Referenced by canSleep(), canWakeup(), and osalEventBroadcastFlags().

void osalEventBroadcastFlags ( event_source_t esp,
eventflags_t  flags 
)

Add flags to an event source object.

Parameters
[in]esppointer to the event flags object
[in]flagsflags to be ORed to the flags mask
Function Class:This is an I-Class API, this function can be invoked from within a system lock zone by both threads and interrupt handlers.

Definition at line 341 of file osal.c.

References osalDbgCheck, osalEventBroadcastFlagsI(), osalSysLock(), and osalSysUnlock().

Here is the call graph for this function:

void osalEventSetCallback ( event_source_t esp,
eventcallback_t  cb,
void *  param 
)

Event callback setup.

Note
The callback is invoked from ISR context and can only invoke I-Class functions. The callback is meant to wakeup the task that will handle the event by calling osalEventGetAndClearFlagsI().
This function is not part of the OSAL API and is provided exclusively as an example and for convenience.
Parameters
[in]esppointer to the event flags object
[in]cbpointer to the callback function
[in]paramparameter to be passed to the callback function
Function Class:Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 365 of file osal.c.

References event_source::cb, osalDbgCheck, and event_source::param.

void osalMutexLock ( mutex_t mp)

Locks the specified mutex.

Postcondition
The mutex is locked and inserted in the per-thread stack of owned mutexes.
Parameters
[in,out]mppointer to the mutex_t object
Function Class:Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 384 of file osal.c.

References osalDbgCheck.

Referenced by adcAcquireBus(), dacAcquireBus(), i2cAcquireBus(), qspiAcquireBus(), spiAcquireBus(), and uartAcquireBus().

void osalMutexUnlock ( mutex_t mp)

Unlocks the specified mutex.

Note
The HAL guarantees to release mutex in reverse lock order. The mutex being unlocked is guaranteed to be the last locked mutex by the invoking thread. The implementation can rely on this behavior and eventually ignore the mp parameter which is supplied in order to support those OSes not supporting a stack of the owned mutexes.
Parameters
[in,out]mppointer to the mutex_t object
Function Class:Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 404 of file osal.c.

References osalDbgCheck.

Referenced by adcReleaseBus(), dacReleaseBus(), i2cReleaseBus(), qspiReleaseBus(), spiReleaseBus(), and uartReleaseBus().

static void osalSysDisable ( void  )
inlinestatic

Disables interrupts globally.

Function Class:Special function, this function has special requirements see the notes.

Definition at line 511 of file osal.h.

Referenced by osalSysHalt().

static void osalSysEnable ( void  )
inlinestatic

Enables interrupts globally.

Function Class:Special function, this function has special requirements see the notes.

Definition at line 520 of file osal.h.

static void osalSysLock ( void  )
inlinestatic

Enters a critical zone from thread context.

Note
This function cannot be used for reentrant critical zones.
Function Class:Special function, this function has special requirements see the notes.

Definition at line 530 of file osal.h.

Referenced by adcConvert(), adcStart(), adcStartConversion(), adcStop(), adcStopConversion(), canReceiveTimeout(), canSleep(), canStart(), canStop(), canTransmitTimeout(), canWakeup(), cryStart(), cryStop(), dacConvert(), dacStart(), dacStartConversion(), dacStop(), dacStopConversion(), extChannelDisable(), extChannelEnable(), extStart(), extStop(), gptChangeInterval(), gptStart(), gptStartContinuous(), gptStartOneShot(), gptStop(), gptStopTimer(), i2cMasterReceiveTimeout(), i2cMasterTransmitTimeout(), i2cStart(), i2cStop(), i2sStart(), i2sStartExchange(), i2sStop(), i2sStopExchange(), ibqGetFullBufferTimeout(), ibqGetTimeout(), ibqReadTimeout(), ibqReleaseEmptyBuffer(), icuDisableNotifications(), icuEnableNotifications(), icuStart(), icuStartCapture(), icuStop(), icuStopCapture(), icuWaitCapture(), iqGetTimeout(), iqReadTimeout(), macStart(), macStop(), macWaitReceiveDescriptor(), macWaitTransmitDescriptor(), mmcDisconnect(), obqFlush(), obqGetEmptyBufferTimeout(), obqPostFullBuffer(), obqPutTimeout(), obqWriteTimeout(), oqPutTimeout(), oqWriteTimeout(), osalEventBroadcastFlags(), palWaitLineTimeout(), palWaitPadTimeout(), pwmChangePeriod(), pwmDisableChannel(), pwmDisableChannelNotification(), pwmDisablePeriodicNotification(), pwmEnableChannel(), pwmEnableChannelNotification(), pwmEnablePeriodicNotification(), pwmStart(), pwmStop(), qspiCommand(), qspiMapFlash(), qspiReceive(), qspiSend(), qspiStart(), qspiStartCommand(), qspiStartReceive(), qspiStartSend(), qspiStop(), qspiUnmapFlash(), sdcDisconnect(), sdcGetAndClearErrors(), sdcStart(), sdcStop(), sdGetWouldBlock(), sdPutWouldBlock(), sdStart(), sdStop(), sduStart(), sduStop(), spiAbort(), spiExchange(), spiIgnore(), spiReceive(), spiSelect(), spiSend(), spiStart(), spiStartExchange(), spiStartIgnore(), spiStartReceive(), spiStartSend(), spiStop(), spiUnselect(), uartReceiveTimeout(), uartSendFullTimeout(), uartSendTimeout(), uartStart(), uartStartReceive(), uartStartSend(), uartStop(), uartStopReceive(), uartStopSend(), usbReceive(), usbStart(), usbStop(), usbTransmit(), wdgReset(), wdgStart(), and wdgStop().

static void osalSysUnlock ( void  )
inlinestatic

Leaves a critical zone from thread context.

Note
This function cannot be used for reentrant critical zones.
Function Class:Special function, this function has special requirements see the notes.

Definition at line 540 of file osal.h.

Referenced by adcConvert(), adcStart(), adcStartConversion(), adcStop(), adcStopConversion(), canReceiveTimeout(), canSleep(), canStart(), canStop(), canTransmitTimeout(), canWakeup(), cryStart(), cryStop(), dacConvert(), dacStart(), dacStartConversion(), dacStop(), dacStopConversion(), extChannelDisable(), extChannelEnable(), extStart(), extStop(), gptChangeInterval(), gptStart(), gptStartContinuous(), gptStartOneShot(), gptStop(), gptStopTimer(), i2cMasterReceiveTimeout(), i2cMasterTransmitTimeout(), i2cStart(), i2cStop(), i2sStart(), i2sStartExchange(), i2sStop(), i2sStopExchange(), ibqGetFullBufferTimeout(), ibqGetTimeout(), ibqReadTimeout(), ibqReleaseEmptyBuffer(), icuDisableNotifications(), icuEnableNotifications(), icuStart(), icuStartCapture(), icuStop(), icuStopCapture(), icuWaitCapture(), iqGetTimeout(), iqReadTimeout(), macStart(), macStop(), macWaitReceiveDescriptor(), macWaitTransmitDescriptor(), mmcDisconnect(), obqFlush(), obqGetEmptyBufferTimeout(), obqPostFullBuffer(), obqPutTimeout(), obqWriteTimeout(), oqPutTimeout(), oqWriteTimeout(), osalEventBroadcastFlags(), palWaitLineTimeout(), palWaitPadTimeout(), pwmChangePeriod(), pwmDisableChannel(), pwmDisableChannelNotification(), pwmDisablePeriodicNotification(), pwmEnableChannel(), pwmEnableChannelNotification(), pwmEnablePeriodicNotification(), pwmStart(), pwmStop(), qspiCommand(), qspiMapFlash(), qspiReceive(), qspiSend(), qspiStart(), qspiStartCommand(), qspiStartReceive(), qspiStartSend(), qspiStop(), qspiUnmapFlash(), sdcDisconnect(), sdcGetAndClearErrors(), sdcStart(), sdcStop(), sdGetWouldBlock(), sdPutWouldBlock(), sdStart(), sdStop(), sduStart(), sduStop(), spiAbort(), spiExchange(), spiIgnore(), spiReceive(), spiSelect(), spiSend(), spiStart(), spiStartExchange(), spiStartIgnore(), spiStartReceive(), spiStartSend(), spiStop(), spiUnselect(), uartReceiveTimeout(), uartSendFullTimeout(), uartSendTimeout(), uartStart(), uartStartReceive(), uartStartSend(), uartStop(), uartStopReceive(), uartStopSend(), usbReceive(), usbStart(), usbStop(), usbTransmit(), wdgReset(), wdgStart(), and wdgStop().

static void osalSysLockFromISR ( void  )
inlinestatic

Enters a critical zone from ISR context.

Note
This function cannot be used for reentrant critical zones.
Function Class:Special function, this function has special requirements see the notes.

Definition at line 550 of file osal.h.

Referenced by _usb_ep0in(), _usb_ep0out(), _usb_ep0setup(), _usb_reset(), _usb_suspend(), default_handler(), sduDataReceived(), and sduDataTransmitted().

static void osalSysUnlockFromISR ( void  )
inlinestatic

Leaves a critical zone from ISR context.

Note
This function cannot be used for reentrant critical zones.
Function Class:Special function, this function has special requirements see the notes.

Definition at line 560 of file osal.h.

Referenced by _usb_ep0in(), _usb_ep0out(), _usb_ep0setup(), _usb_reset(), _usb_suspend(), default_handler(), sduDataReceived(), and sduDataTransmitted().

static syssts_t osalSysGetStatusAndLockX ( void  )
inlinestatic

Returns the execution status and enters a critical zone.

This functions enters into a critical zone and can be called from any context. Because its flexibility it is less efficient than chSysLock() which is preferable when the calling context is known.

Postcondition
The system is in a critical zone.
Returns
The previous system status, the encoding of this status word is architecture-dependent and opaque.
Function Class:This is an X-Class API, this function can be invoked from any context.

Definition at line 577 of file osal.h.

static void osalSysRestoreStatusX ( syssts_t  sts)
inlinestatic

Restores the specified execution status and leaves a critical zone.

Note
A call to chSchRescheduleS() is automatically performed if exiting the critical zone and if not in ISR context.
Parameters
[in]ststhe system status to be restored.
Function Class:This is an X-Class API, this function can be invoked from any context.

Definition at line 591 of file osal.h.

static systime_t osalTimeAddX ( systime_t  systime,
sysinterval_t  interval 
)
inlinestatic

Adds an interval to a system time returning a system time.

Parameters
[in]systimebase system time
[in]intervalinterval to be added
Returns
The new system time.
Function Class:This is an X-Class API, this function can be invoked from any context.

Definition at line 605 of file osal.h.

static sysinterval_t osalTimeDiffX ( systime_t  start,
systime_t  end 
)
inlinestatic

Subtracts two system times returning an interval.

Parameters
[in]startfirst system time
[in]endsecond system time
Returns
The interval representing the time difference.
Function Class:This is an X-Class API, this function can be invoked from any context.

Definition at line 620 of file osal.h.

static bool osalTimeIsInRangeX ( systime_t  time,
systime_t  start,
systime_t  end 
)
inlinestatic

Checks if the specified time is within the specified time window.

Note
When start==end then the function returns always true because the whole time range is specified.
This function can be called from any context.
Parameters
[in]timethe time to be verified
[in]startthe start of the time window (inclusive)
[in]endthe end of the time window (non inclusive)
Return values
truecurrent time within the specified time window.
falsecurrent time not within the specified time window.
Function Class:This is an X-Class API, this function can be invoked from any context.

Definition at line 639 of file osal.h.

static void osalThreadQueueObjectInit ( threads_queue_t tqp)
inlinestatic

Initializes a threads queue object.

Parameters
[out]tqppointer to the threads queue object
Function Class:Initializer, this function just initializes an object and can be invoked before the kernel is initialized.

Definition at line 653 of file osal.h.

References osalDbgCheck.

Referenced by canObjectInit(), ibqObjectInit(), iqObjectInit(), macObjectInit(), obqObjectInit(), and oqObjectInit().

static void osalEventObjectInit ( event_source_t esp)
inlinestatic

Initializes an event source object.

Parameters
[out]esppointer to the event source object
Function Class:Initializer, this function just initializes an object and can be invoked before the kernel is initialized.

Definition at line 665 of file osal.h.

References event_source::cb, event_source::flags, osalDbgCheck, and event_source::param.

Referenced by canObjectInit(), macObjectInit(), sdObjectInit(), and sduObjectInit().

static void osalMutexObjectInit ( mutex_t mp)
inlinestatic

Initializes s mutex_t object.

Parameters
[out]mppointer to the mutex_t object
Function Class:Initializer, this function just initializes an object and can be invoked before the kernel is initialized.

Definition at line 681 of file osal.h.

References osalDbgCheck.

Referenced by adcObjectInit(), dacObjectInit(), i2cObjectInit(), qspiObjectInit(), spiObjectInit(), and uartObjectInit().

Variable Documentation

const char* osal_halt_msg

Pointer to a halt error message.

Note
The message is meant to be retrieved by the debugger after the system halt caused by an unexpected error.

Definition at line 40 of file osal.c.

Referenced by osalSysHalt().

const char* osal_halt_msg

Pointer to a halt error message.

Note
The message is meant to be retrieved by the debugger after the system halt caused by an unexpected error.

Definition at line 40 of file osal.c.

Referenced by osalSysHalt().