Merge branch 'zim-some-esp-platform-markers' into 'master'

freertos: several ESP specific things clearly marked

See merge request espressif/esp-idf!14995
This commit is contained in:
Zim Kalinowski 2021-08-31 02:33:00 +00:00
commit 268eace13a
6 changed files with 37 additions and 13 deletions

View File

@ -84,7 +84,9 @@ typedef struct EventGroupDef_t
uint8_t ucStaticallyAllocated; /*< Set to pdTRUE if the event group is statically allocated to ensure no attempt is made to free the memory. */ uint8_t ucStaticallyAllocated; /*< Set to pdTRUE if the event group is statically allocated to ensure no attempt is made to free the memory. */
#endif #endif
#ifdef ESP_PLATFORM
portMUX_TYPE eventGroupMux; //Mutex required due to SMP portMUX_TYPE eventGroupMux; //Mutex required due to SMP
#endif // ESP_PLATFORM
} EventGroup_t; } EventGroup_t;
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
@ -140,8 +142,9 @@ static BaseType_t prvTestWaitCondition( const EventBits_t uxCurrentEventBits,
#endif /* configSUPPORT_DYNAMIC_ALLOCATION */ #endif /* configSUPPORT_DYNAMIC_ALLOCATION */
traceEVENT_GROUP_CREATE( pxEventBits ); traceEVENT_GROUP_CREATE( pxEventBits );
#ifdef ESP_PLATFORM
vPortCPUInitializeMutex( &pxEventBits->eventGroupMux ); vPortCPUInitializeMutex( &pxEventBits->eventGroupMux );
#endif // ESP_PLATFORM
} }
else else
{ {
@ -191,9 +194,9 @@ static BaseType_t prvTestWaitCondition( const EventBits_t uxCurrentEventBits,
pxEventBits->ucStaticallyAllocated = pdFALSE; pxEventBits->ucStaticallyAllocated = pdFALSE;
} }
#endif /* configSUPPORT_STATIC_ALLOCATION */ #endif /* configSUPPORT_STATIC_ALLOCATION */
#ifdef ESP_PLATFORM
vPortCPUInitializeMutex( &pxEventBits->eventGroupMux ); vPortCPUInitializeMutex( &pxEventBits->eventGroupMux );
#endif // ESP_PLATFORM
traceEVENT_GROUP_CREATE( pxEventBits ); traceEVENT_GROUP_CREATE( pxEventBits );
} }
else else

View File

@ -84,8 +84,11 @@
* \ingroup EventGroup * \ingroup EventGroup
*/ */
struct EventGroupDef_t; struct EventGroupDef_t;
#ifdef ESP_PLATFORM // IDF-3770
typedef void * EventGroupHandle_t; typedef void * EventGroupHandle_t;
// typedef struct EventGroupDef_t * EventGroupHandle_t; #else
typedef struct EventGroupDef_t * EventGroupHandle_t;
#endif // ESP_PLATFORM
/* /*
* The type that holds event bits always matches TickType_t - therefore the * The type that holds event bits always matches TickType_t - therefore the
* number of bits it holds is set by configUSE_16_BIT_TICKS (16 bits if set to 1, * number of bits it holds is set by configUSE_16_BIT_TICKS (16 bits if set to 1,

View File

@ -33,7 +33,9 @@
#endif #endif
#include "list.h" #include "list.h"
#ifdef ESP_PLATFORM // IDF-3793
#include "freertos/portmacro.h" #include "freertos/portmacro.h"
#endif // ESP_PLATFORM
/* *INDENT-OFF* */ /* *INDENT-OFF* */
#ifdef __cplusplus #ifdef __cplusplus
@ -72,8 +74,11 @@
* \ingroup Tasks * \ingroup Tasks
*/ */
struct tskTaskControlBlock; /* The old naming convention is used to prevent breaking kernel aware debuggers. */ struct tskTaskControlBlock; /* The old naming convention is used to prevent breaking kernel aware debuggers. */
//typedef struct tskTaskControlBlock* TaskHandle_t; #ifdef ESP_PLATFORM // IDF-3769
typedef void* TaskHandle_t; typedef void* TaskHandle_t;
#else
typedef struct tskTaskControlBlock* TaskHandle_t;
#endif // ESP_PLATFORM
/** /**
* Defines the prototype to which the application task hook function must * Defines the prototype to which the application task hook function must
* conform. * conform.
@ -2768,8 +2773,10 @@ TaskHandle_t pvTaskIncrementMutexHeldCount( void ) PRIVILEGED_FUNCTION;
*/ */
void vTaskInternalSetTimeOutState( TimeOut_t * const pxTimeOut ) PRIVILEGED_FUNCTION; void vTaskInternalSetTimeOutState( TimeOut_t * const pxTimeOut ) PRIVILEGED_FUNCTION;
#ifdef ESP_PLATFORM
/* TODO: IDF-3683 */ /* TODO: IDF-3683 */
#include "freertos/task_snapshot.h" #include "freertos/task_snapshot.h"
#endif // ESP_PLATFORM
/** @endcond */ /** @endcond */

View File

@ -75,8 +75,11 @@
* (for example, xTimerStart(), xTimerReset(), etc.). * (for example, xTimerStart(), xTimerReset(), etc.).
*/ */
struct tmrTimerControl; /* The old naming convention is used to prevent breaking kernel aware debuggers. */ struct tmrTimerControl; /* The old naming convention is used to prevent breaking kernel aware debuggers. */
//typedef struct tmrTimerControl * TimerHandle_t; #ifdef ESP_PLATFORM // IDF-3768
typedef void* TimerHandle_t; typedef void* TimerHandle_t;
#else
typedef struct tmrTimerControl * TimerHandle_t;
#endif // ESP_PLATFORM
/* /*
* Defines the prototype to which timer callback functions must conform. * Defines the prototype to which timer callback functions must conform.
*/ */

View File

@ -139,9 +139,9 @@ typedef struct QueueDefinition /* The old naming convention is used to prevent b
UBaseType_t uxQueueNumber; UBaseType_t uxQueueNumber;
uint8_t ucQueueType; uint8_t ucQueueType;
#endif #endif
#ifdef ESP_PLATFORM
portMUX_TYPE mux; //Mutex required due to SMP portMUX_TYPE mux; //Mutex required due to SMP
#endif // ESP_PLATFORM
} xQUEUE; } xQUEUE;
/* The old xQUEUE name is maintained above then typedefed to the new Queue_t /* The old xQUEUE name is maintained above then typedefed to the new Queue_t
@ -174,10 +174,10 @@ typedef xQUEUE Queue_t;
* The pcQueueName member of a structure being NULL is indicative of the * The pcQueueName member of a structure being NULL is indicative of the
* array position being vacant. */ * array position being vacant. */
PRIVILEGED_DATA QueueRegistryItem_t xQueueRegistry[ configQUEUE_REGISTRY_SIZE ]; PRIVILEGED_DATA QueueRegistryItem_t xQueueRegistry[ configQUEUE_REGISTRY_SIZE ];
#ifdef ESP_PLATFORM
//Need to add queue registry mutex to protect against simultaneous access //Need to add queue registry mutex to protect against simultaneous access
static portMUX_TYPE queue_registry_spinlock = portMUX_INITIALIZER_UNLOCKED; static portMUX_TYPE queue_registry_spinlock = portMUX_INITIALIZER_UNLOCKED;
#endif // ESP_PLATFORM
#endif /* configQUEUE_REGISTRY_SIZE */ #endif /* configQUEUE_REGISTRY_SIZE */
/* /*
@ -285,10 +285,12 @@ BaseType_t xQueueGenericReset( QueueHandle_t xQueue,
configASSERT( pxQueue ); configASSERT( pxQueue );
#ifdef ESP_PLATFORM
if( xNewQueue == pdTRUE ) if( xNewQueue == pdTRUE )
{ {
vPortCPUInitializeMutex(&pxQueue->mux); vPortCPUInitializeMutex(&pxQueue->mux);
} }
#endif // ESP_PLATFORM
taskENTER_CRITICAL(); taskENTER_CRITICAL();
{ {
@ -532,8 +534,9 @@ static void prvInitialiseNewQueue( const UBaseType_t uxQueueLength,
/* In case this is a recursive mutex. */ /* In case this is a recursive mutex. */
pxNewQueue->u.xSemaphore.uxRecursiveCallCount = 0; pxNewQueue->u.xSemaphore.uxRecursiveCallCount = 0;
#ifdef ESP_PLATFORM
vPortCPUInitializeMutex(&pxNewQueue->mux); vPortCPUInitializeMutex(&pxNewQueue->mux);
#endif // ESP_PLATFORM
traceCREATE_MUTEX( pxNewQueue ); traceCREATE_MUTEX( pxNewQueue );
/* Start with the semaphore in the expected state. */ /* Start with the semaphore in the expected state. */

View File

@ -152,8 +152,10 @@
PRIVILEGED_DATA static QueueHandle_t xTimerQueue = NULL; PRIVILEGED_DATA static QueueHandle_t xTimerQueue = NULL;
PRIVILEGED_DATA static TaskHandle_t xTimerTaskHandle = NULL; PRIVILEGED_DATA static TaskHandle_t xTimerTaskHandle = NULL;
#ifdef ESP_PLATFORM
/* Mux. We use a single mux for all the timers for now. ToDo: maybe increase granularity here? */ /* Mux. We use a single mux for all the timers for now. ToDo: maybe increase granularity here? */
PRIVILEGED_DATA portMUX_TYPE xTimerMux = portMUX_INITIALIZER_UNLOCKED; PRIVILEGED_DATA portMUX_TYPE xTimerMux = portMUX_INITIALIZER_UNLOCKED;
#endif // ESP_PLATFORM
/*lint -restore */ /*lint -restore */
@ -521,13 +523,15 @@ PRIVILEGED_DATA portMUX_TYPE xTimerMux = portMUX_INITIALIZER_UNLOCKED;
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
static void prvProcessExpiredTimer( const TickType_t xNextExpireTime, const TickType_t xTimeNow ) static void prvProcessExpiredTimer( const TickType_t xNextExpireTime,
const TickType_t xTimeNow )
{ {
BaseType_t xResult; BaseType_t xResult;
Timer_t * const pxTimer = ( Timer_t * ) listGET_OWNER_OF_HEAD_ENTRY( pxCurrentTimerList ); /*lint !e9087 !e9079 void * is used as this macro is used with tasks and co-routines too. Alignment is known to be fine as the type of the pointer stored and retrieved is the same. */ Timer_t * const pxTimer = ( Timer_t * ) listGET_OWNER_OF_HEAD_ENTRY( pxCurrentTimerList ); /*lint !e9087 !e9079 void * is used as this macro is used with tasks and co-routines too. Alignment is known to be fine as the type of the pointer stored and retrieved is the same. */
/* Remove the timer from the list of active timers. A check has already /* Remove the timer from the list of active timers. A check has already
* been performed to ensure the list is not empty. */ * been performed to ensure the list is not empty. */
( void ) uxListRemove( &( pxTimer->xTimerListItem ) ); ( void ) uxListRemove( &( pxTimer->xTimerListItem ) );
traceTIMER_EXPIRED( pxTimer ); traceTIMER_EXPIRED( pxTimer );
@ -965,8 +969,9 @@ PRIVILEGED_DATA portMUX_TYPE xTimerMux = portMUX_INITIALIZER_UNLOCKED;
/* Check that the list from which active timers are referenced, and the /* Check that the list from which active timers are referenced, and the
* queue used to communicate with the timer service, have been * queue used to communicate with the timer service, have been
* initialised. */ * initialised. */
#ifdef ESP_PLATFORM
if( xTimerQueue == NULL ) vPortCPUInitializeMutex( &xTimerMux ); if( xTimerQueue == NULL ) vPortCPUInitializeMutex( &xTimerMux );
#endif // ESP_PLATFORM
taskENTER_CRITICAL(); taskENTER_CRITICAL();
{ {