freertos: Remove legacy data types

This commit removes the usage of all legacy FreeRTOS data types that
are exposed via configENABLE_BACKWARD_COMPATIBILITY. Legacy types can
still be used by enabling CONFIG_FREERTOS_ENABLE_BACKWARD_COMPATIBILITY.
This commit is contained in:
Darian Leung
2022-02-08 17:39:38 +08:00
parent 5810ed1d04
commit 57fd78f5ba
169 changed files with 635 additions and 706 deletions

View File

@@ -17,7 +17,7 @@
/* Notes on our newlib lock implementation:
*
* - Use FreeRTOS mutex semaphores as locks.
* - lock_t is int, but we store an xSemaphoreHandle there.
* - lock_t is int, but we store an SemaphoreHandle_t there.
* - Locks are no-ops until the FreeRTOS scheduler is running.
* - Due to this, locks need to be lazily initialised the first time
* they are acquired. Initialisation/deinitialisation of locks is
@@ -61,7 +61,7 @@ static void IRAM_ATTR lock_init_generic(_lock_t *lock, uint8_t mutex_type) {
without writing wrappers. Doing it this way seems much less
spaghetti-like.
*/
xSemaphoreHandle new_sem = xQueueCreateMutex(mutex_type);
SemaphoreHandle_t new_sem = xQueueCreateMutex(mutex_type);
if (!new_sem) {
abort(); /* No more semaphores available or OOM */
}
@@ -93,7 +93,7 @@ void IRAM_ATTR _lock_init_recursive(_lock_t *lock) {
void IRAM_ATTR _lock_close(_lock_t *lock) {
portENTER_CRITICAL(&lock_init_spinlock);
if (*lock) {
xSemaphoreHandle h = (xSemaphoreHandle)(*lock);
SemaphoreHandle_t h = (SemaphoreHandle_t)(*lock);
#if (INCLUDE_xSemaphoreGetMutexHolder == 1)
configASSERT(xSemaphoreGetMutexHolder(h) == NULL); /* mutex should not be held */
#endif
@@ -109,14 +109,14 @@ void _lock_close_recursive(_lock_t *lock) __attribute__((alias("_lock_close")));
mutex_type is queueQUEUE_TYPE_RECURSIVE_MUTEX or queueQUEUE_TYPE_MUTEX
*/
static int IRAM_ATTR lock_acquire_generic(_lock_t *lock, uint32_t delay, uint8_t mutex_type) {
xSemaphoreHandle h = (xSemaphoreHandle)(*lock);
SemaphoreHandle_t h = (SemaphoreHandle_t)(*lock);
if (!h) {
if (xTaskGetSchedulerState() == taskSCHEDULER_NOT_STARTED) {
return 0; /* locking is a no-op before scheduler is up, so this "succeeds" */
}
/* lazy initialise lock - might have had a static initializer (that we don't use) */
lock_init_generic(lock, mutex_type);
h = (xSemaphoreHandle)(*lock);
h = (SemaphoreHandle_t)(*lock);
configASSERT(h != NULL);
}
@@ -173,7 +173,7 @@ static void IRAM_ATTR lock_release_generic(_lock_t *lock, uint8_t mutex_type) {
if (xTaskGetSchedulerState() == taskSCHEDULER_NOT_STARTED) {
return; /* locking is a no-op before scheduler is up */
}
xSemaphoreHandle h = (xSemaphoreHandle)(*lock);
SemaphoreHandle_t h = (SemaphoreHandle_t)(*lock);
assert(h);
if (!xPortCanYield()) {