From: Ivan Grokhotkov Date: Tue, 11 Oct 2016 05:34:45 +0000 (-0600) Subject: Merge branch 'master' into feature/freertos_static_buffers X-Git-Tag: v1.0~102^2~9 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8ee1a05914c5cec244fa2bb9b0dc2caa947ee1d0;p=esp-idf Merge branch 'master' into feature/freertos_static_buffers * master: (117 commits) build system: Add -fno-rtti when compiling C++ code FreeRTOS KConfig: Limit tick rate to 1000Hz bootloader: Fix accidental tabs introduced in !78 build system: Print a WARNING if any submodule is out of date Fix stack overflow message format 'make flash' targets: Print serial port when flashing lwip/esp32: support iperf Add data memory for RMT peripheral syscall write: Should return number of bytes written Also push relevant tags over esp32: add libsmartconfig.a to link libs esp32: not link wps esp32/lib: update wifi lib to a1e5f8b9 esp32: remove esp_wps.h add smartconfig header files(merge this after updating libsmartconfig.a version v2.6.2) esp32/lib: update wifi lib to 3853d7ae Add Comments Modify spinlock error in periph_ctrl.c Define xcoreid offset, add warning in tcb struct wrt the need to also change that define when struct changes components/tcpip_adapter: add some comments ... # Conflicts: # components/freertos/queue.c # components/freertos/tasks.c --- 8ee1a05914c5cec244fa2bb9b0dc2caa947ee1d0 diff --cc components/freertos/queue.c index 445a9e2e91,168f09f1a1..f404a243e6 --- a/components/freertos/queue.c +++ b/components/freertos/queue.c @@@ -163,11 -158,9 +158,8 @@@ typedef struct QueueDefinitio UBaseType_t uxLength; /*< The length of the queue defined as the number of items it will hold, not the number of bytes. */ UBaseType_t uxItemSize; /*< The size of each items that the queue will hold. */ - volatile BaseType_t xRxLock; /*< Stores the number of items received from the queue (removed from the queue) while the queue was locked. Set to queueUNLOCKED when the queue is not locked. */ - volatile BaseType_t xTxLock; /*< Stores the number of items transmitted to the queue (added to the queue) while the queue was locked. Set to queueUNLOCKED when the queue is not locked. */ - - #if ( configUSE_TRACE_FACILITY == 1 ) - UBaseType_t uxQueueNumber; - uint8_t ucQueueType; + #if( ( configSUPPORT_STATIC_ALLOCATION == 1 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) ) + uint8_t ucStaticallyAllocated; /*< Set to pdTRUE if the memory used by the queue was statically allocated to ensure no attempt is made to free the memory. */ #endif #if ( configUSE_QUEUE_SETS == 1 ) @@@ -259,42 -238,6 +242,21 @@@ static void prvCopyDataFromQueue( Queue static BaseType_t prvNotifyQueueSetContainer( const Queue_t * const pxQueue, const BaseType_t xCopyPosition ) PRIVILEGED_FUNCTION; #endif +/* + * Called after a Queue_t structure has been allocated either statically or + * dynamically to fill in the structure's members. + */ +static void prvInitialiseNewQueue( const UBaseType_t uxQueueLength, const UBaseType_t uxItemSize, uint8_t *pucQueueStorage, const uint8_t ucQueueType, Queue_t *pxNewQueue ) PRIVILEGED_FUNCTION; + +/* + * Mutexes are a special type of queue. When a mutex is created, first the + * queue is created, then prvInitialiseMutex() is called to configure the queue + * as a mutex. + */ +#if( configUSE_MUTEXES == 1 ) + static void prvInitialiseMutex( Queue_t *pxNewQueue ) PRIVILEGED_FUNCTION; +#endif + - /*-----------------------------------------------------------*/ - - /* - * Macro to mark a queue as locked. Locking a queue prevents an ISR from - * accessing the queue event lists. - */ - #define prvLockQueue( pxQueue ) \ - taskENTER_CRITICAL(&pxQueue->mux); \ - { \ - if( ( pxQueue )->xRxLock == queueUNLOCKED ) \ - { \ - ( pxQueue )->xRxLock = queueLOCKED_UNMODIFIED; \ - } \ - if( ( pxQueue )->xTxLock == queueUNLOCKED ) \ - { \ - ( pxQueue )->xTxLock = queueLOCKED_UNMODIFIED; \ - } \ - } \ - taskEXIT_CRITICAL(&pxQueue->mux) - /*-----------------------------------------------------------*/ - BaseType_t xQueueGenericReset( QueueHandle_t xQueue, BaseType_t xNewQueue ) { Queue_t * const pxQueue = ( Queue_t * ) xQueue; diff --cc components/freertos/tasks.c index 034ffc08ed,5eb4687e06..63a659b5d7 --- a/components/freertos/tasks.c +++ b/components/freertos/tasks.c @@@ -591,35 -578,6 +590,26 @@@ static void prvResetNextTaskUnblockTime #endif +/* + * Called after a Task_t structure has been allocated either statically or + * dynamically to fill in the structure's members. + */ +static void prvInitialiseNewTask( TaskFunction_t pxTaskCode, + const char * const pcName, + const uint32_t ulStackDepth, + void * const pvParameters, + UBaseType_t uxPriority, + TaskHandle_t * const pxCreatedTask, + TCB_t *pxNewTCB, + const MemoryRegion_t * const xRegions ) PRIVILEGED_FUNCTION; /*lint !e971 Unqualified char types are allowed for strings and single characters only. */ + +/* + * Called after a new task has been created and initialised to place the task + * under the control of the scheduler. + */ +static void prvAddNewTaskToReadyList( TCB_t *pxNewTCB, TaskFunction_t pxTaskCode, const BaseType_t xCoreID ) PRIVILEGED_FUNCTION; + + - /*-----------------------------------------------------------*/ - - - static void vTaskInitializeLocalMuxes( void ) - { - vPortCPUInitializeMutex(&xTaskQueueMutex); - vPortCPUInitializeMutex(&xTickCountMutex); - xMutexesInitialised = pdTRUE; - } /*-----------------------------------------------------------*/ @@@ -3488,6 -3264,93 +3474,18 @@@ static void prvAddCurrentTaskToDelayedL } /*-----------------------------------------------------------*/ -static TCB_t *prvAllocateTCBAndStack( const uint16_t usStackDepth, StackType_t * const puxStackBuffer ) -{ -TCB_t *pxNewTCB; - - /* If the stack grows down then allocate the stack then the TCB so the stack - does not grow into the TCB. Likewise if the stack grows up then allocate - the TCB then the stack. */ - #if( portSTACK_GROWTH > 0 ) - { - /* Allocate space for the TCB. Where the memory comes from depends on - the implementation of the port malloc function. */ - pxNewTCB = ( TCB_t * ) pvPortMalloc( sizeof( TCB_t ) ); - - if( pxNewTCB != NULL ) - { - /* Allocate space for the stack used by the task being created. - The base of the stack memory stored in the TCB so the task can - be deleted later if required. */ - pxNewTCB->pxStack = ( StackType_t * ) pvPortMallocAligned( ( ( ( size_t ) usStackDepth ) * sizeof( StackType_t ) ), puxStackBuffer ); /*lint !e961 MISRA exception as the casts are only redundant for some ports. */ - - if( pxNewTCB->pxStack == NULL ) - { - /* Could not allocate the stack. Delete the allocated TCB. */ - vPortFree( pxNewTCB ); - pxNewTCB = NULL; - } - } - } - #else /* portSTACK_GROWTH */ - { - StackType_t *pxStack; - - /* Allocate space for the stack used by the task being created. */ - pxStack = ( StackType_t * ) pvPortMallocAligned( ( ( ( size_t ) usStackDepth ) * sizeof( StackType_t ) ), puxStackBuffer ); /*lint !e961 MISRA exception as the casts are only redundant for some ports. */ - - if( pxStack != NULL ) - { - /* Allocate space for the TCB. Where the memory comes from depends - on the implementation of the port malloc function. */ - pxNewTCB = ( TCB_t * ) pvPortMalloc( sizeof( TCB_t ) ); - - if( pxNewTCB != NULL ) - { - /* Store the stack location in the TCB. */ - pxNewTCB->pxStack = pxStack; - } - else - { - /* The stack cannot be used as the TCB was not created. Free it - again. */ - vPortFree( pxStack ); - } - } - else - { - pxNewTCB = NULL; - } - } - #endif /* portSTACK_GROWTH */ - - if( pxNewTCB != NULL ) - { - /* Avoid dependency on memset() if it is not required. */ - #if( ( configCHECK_FOR_STACK_OVERFLOW > 1 ) || ( configUSE_TRACE_FACILITY == 1 ) || ( INCLUDE_uxTaskGetStackHighWaterMark == 1 ) ) - { - /* Just to help debugging. */ - ( void ) memset( pxNewTCB->pxStack, ( int ) tskSTACK_FILL_BYTE, ( size_t ) usStackDepth * sizeof( StackType_t ) ); - } - #endif /* ( ( configCHECK_FOR_STACK_OVERFLOW > 1 ) || ( ( configUSE_TRACE_FACILITY == 1 ) || ( INCLUDE_uxTaskGetStackHighWaterMark == 1 ) ) ) */ - } - - return pxNewTCB; -} -/*-----------------------------------------------------------*/ - + BaseType_t xTaskGetAffinity( TaskHandle_t xTask ) + { + TCB_t *pxTCB; + UBaseType_t uxReturn; + + pxTCB = prvGetTCBFromHandle( xTask ); + + return pxTCB->xCoreID; + } + /*-----------------------------------------------------------*/ + + #if ( configUSE_TRACE_FACILITY == 1 ) static UBaseType_t prvListTaskWithinSingleList( TaskStatus_t *pxTaskStatusArray, List_t *pxList, eTaskState eState )