From b8bfa9fa35fb6f855b3c687f06f64df8ec36e670 Mon Sep 17 00:00:00 2001 From: Jeroen Domburg Date: Fri, 23 Sep 2016 17:46:16 +0800 Subject: [PATCH] Spinlocks already come initialized. Remove the code that would essentially re-initialize them at runtime --- components/freertos/tasks.c | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/components/freertos/tasks.c b/components/freertos/tasks.c index ff3a0530d6..b9035bda0f 100644 --- a/components/freertos/tasks.c +++ b/components/freertos/tasks.c @@ -275,9 +275,7 @@ when the scheduler is unsuspended. The pending ready list itself can only be accessed from a critical section. */ PRIVILEGED_DATA static volatile UBaseType_t uxSchedulerSuspended[ portNUM_PROCESSORS ] = { ( UBaseType_t ) pdFALSE }; -/* Muxes used in the task code */ -PRIVILEGED_DATA static portBASE_TYPE xMutexesInitialised = pdFALSE; -/* For now, we use just one mux for all the critical sections. ToDo: give evrything a bit more granularity; +/* For now, we use just one mux for all the critical sections. ToDo: give everything a bit more granularity; that could improve performance by not needlessly spinning in spinlocks for unrelated resources. */ PRIVILEGED_DATA static portMUX_TYPE xTaskQueueMutex = portMUX_INITIALIZER_UNLOCKED; PRIVILEGED_DATA static portMUX_TYPE xTickCountMutex = portMUX_INITIALIZER_UNLOCKED; @@ -577,15 +575,6 @@ static void prvResetNextTaskUnblockTime( void ); #endif -/*-----------------------------------------------------------*/ - - -static void vTaskInitializeLocalMuxes( void ) -{ - vPortCPUInitializeMutex(&xTaskQueueMutex); - vPortCPUInitializeMutex(&xTickCountMutex); - xMutexesInitialised = pdTRUE; -} /*-----------------------------------------------------------*/ @@ -596,9 +585,6 @@ TCB_t * pxNewTCB; StackType_t *pxTopOfStack; BaseType_t i; - /* Initialize mutexes, if they're not already initialized. */ - if (xMutexesInitialised == pdFALSE) vTaskInitializeLocalMuxes(); - configASSERT( pxTaskCode ); configASSERT( ( ( uxPriority & ( ~portPRIVILEGE_BIT ) ) < configMAX_PRIORITIES ) ); configASSERT( (xCoreID>=0 && xCoreID