![]() |
S32 SDK
|
OS Interface Layer (OSIF)
This module is for SDK internal use only. It provides an abstract OS interface to SDK drivers (even if no OS is present) for basic OS operations (mutex and semaphore handling and time delay service).
A compile-time symbol, USING_OS_FREERTOS, needs to be defined.
FreeRTOS configuration file needs to have these options activated:
If no OS is present, the corresponding bare-metal version of OSIF needs to be linked.
Mutex operations are dummy operations (always return success) and semaphore is implemented as a simple counter.
Time delay is implemented using the core Systick timer.
To correctly measure time, a hardware timer is required. The Systick is employed for this purpose. As a consequence, the Systick timer is a blocked resource to the user application.
Macros | |
#define | OSIF_WAIT_FOREVER 0xFFFFFFFFu |
Functions | |
void | OSIF_TimeDelay (const uint32_t delay) |
Delays execution for a number of milliseconds. More... | |
uint32_t | OSIF_GetMilliseconds (void) |
Returns the number of miliseconds elapsed since starting the internal timer or starting the scheduler. More... | |
status_t | OSIF_MutexLock (const mutex_t *const pMutex, const uint32_t timeout) |
Waits for a mutex and locks it. More... | |
status_t | OSIF_MutexUnlock (const mutex_t *const pMutex) |
Unlocks a previously locked mutex. More... | |
status_t | OSIF_MutexCreate (mutex_t *const pMutex) |
Create an unlocked mutex. More... | |
status_t | OSIF_MutexDestroy (const mutex_t *const pMutex) |
Destroys a previously created mutex. More... | |
status_t | OSIF_SemaWait (semaphore_t *const pSem, const uint32_t timeout) |
Decrement a semaphore with timeout. More... | |
status_t | OSIF_SemaPost (semaphore_t *const pSem) |
Increment a semaphore. More... | |
status_t | OSIF_SemaCreate (semaphore_t *const pSem, const uint8_t initValue) |
Creates a semaphore with a given value. More... | |
status_t | OSIF_SemaDestroy (const semaphore_t *const pSem) |
Destroys a previously created semaphore. More... | |
uint32_t OSIF_GetMilliseconds | ( | void | ) |
Returns the number of miliseconds elapsed since starting the internal timer or starting the scheduler.
Definition at line 138 of file osif_baremetal.c.
status_t OSIF_MutexCreate | ( | mutex_t *const | pMutex | ) |
Create an unlocked mutex.
[in] | pMutex | reference to the mutex object |
Definition at line 186 of file osif_baremetal.c.
status_t OSIF_MutexDestroy | ( | const mutex_t *const | pMutex | ) |
Destroys a previously created mutex.
[in] | pMutex | reference to the mutex object |
Definition at line 200 of file osif_baremetal.c.
status_t OSIF_MutexLock | ( | const mutex_t *const | pMutex, |
const uint32_t | timeout | ||
) |
Waits for a mutex and locks it.
[in] | pMutex | reference to the mutex object |
[in] | timeout | time-out value in milliseconds |
Definition at line 156 of file osif_baremetal.c.
status_t OSIF_MutexUnlock | ( | const mutex_t *const | pMutex | ) |
Unlocks a previously locked mutex.
[in] | pMutex | reference to the mutex object |
Definition at line 172 of file osif_baremetal.c.
status_t OSIF_SemaCreate | ( | semaphore_t *const | pSem, |
const uint8_t | initValue | ||
) |
Creates a semaphore with a given value.
[in] | pSem | reference to the semaphore object |
[in] | initValue | initial value of the semaphore |
Definition at line 292 of file osif_baremetal.c.
status_t OSIF_SemaDestroy | ( | const semaphore_t *const | pSem | ) |
Destroys a previously created semaphore.
[in] | pSem | reference to the semaphore object |
Definition at line 311 of file osif_baremetal.c.
status_t OSIF_SemaPost | ( | semaphore_t *const | pSem | ) |
Increment a semaphore.
[in] | pSem | reference to the semaphore object |
Definition at line 265 of file osif_baremetal.c.
status_t OSIF_SemaWait | ( | semaphore_t *const | pSem, |
const uint32_t | timeout | ||
) |
Decrement a semaphore with timeout.
[in] | pSem | reference to the semaphore object |
[in] | timeout | time-out value in milliseconds |
Definition at line 214 of file osif_baremetal.c.
void OSIF_TimeDelay | ( | const uint32_t | delay | ) |
Delays execution for a number of milliseconds.
[in] | delay | Time delay in milliseconds. |
Definition at line 113 of file osif_baremetal.c.