Replace FreeRTOS core/non-portable files with unmodified variants from vanilla 7.5.2

This commit is contained in:
Angus Gratton 2015-05-07 12:12:53 +10:00
parent b50ba19b1f
commit b7e0e232dd
5 changed files with 152 additions and 325 deletions

View file

@ -238,14 +238,12 @@ static void prvCheckPendingReadyList( void )
corCRCB *pxUnblockedCRCB; corCRCB *pxUnblockedCRCB;
/* The pending ready list can be accessed by an ISR. */ /* The pending ready list can be accessed by an ISR. */
//portDISABLE_INTERRUPTS(); portDISABLE_INTERRUPTS();
PortDisableInt_NoNest();
{ {
pxUnblockedCRCB = ( corCRCB * ) listGET_OWNER_OF_HEAD_ENTRY( (&xPendingReadyCoRoutineList) ); pxUnblockedCRCB = ( corCRCB * ) listGET_OWNER_OF_HEAD_ENTRY( (&xPendingReadyCoRoutineList) );
( void ) uxListRemove( &( pxUnblockedCRCB->xEventListItem ) ); ( void ) uxListRemove( &( pxUnblockedCRCB->xEventListItem ) );
} }
// portENABLE_INTERRUPTS(); portENABLE_INTERRUPTS();
PortEnableInt_NoNest();
( void ) uxListRemove( &( pxUnblockedCRCB->xGenericListItem ) ); ( void ) uxListRemove( &( pxUnblockedCRCB->xGenericListItem ) );
prvAddCoRoutineToReadyQueue( pxUnblockedCRCB ); prvAddCoRoutineToReadyQueue( pxUnblockedCRCB );
@ -286,8 +284,7 @@ corCRCB *pxCRCB;
break; break;
} }
//portDISABLE_INTERRUPTS(); portDISABLE_INTERRUPTS();
PortDisableInt_NoNest();
{ {
/* The event could have occurred just before this critical /* The event could have occurred just before this critical
section. If this is the case then the generic list item will section. If this is the case then the generic list item will
@ -302,8 +299,7 @@ PortDisableInt_NoNest();
( void ) uxListRemove( &( pxCRCB->xEventListItem ) ); ( void ) uxListRemove( &( pxCRCB->xEventListItem ) );
} }
} }
// portENABLE_INTERRUPTS(); portENABLE_INTERRUPTS();
PortEnableInt_NoNest();
prvAddCoRoutineToReadyQueue( pxCRCB ); prvAddCoRoutineToReadyQueue( pxCRCB );
} }

View file

@ -71,8 +71,7 @@
* PUBLIC LIST API documented in list.h * PUBLIC LIST API documented in list.h
*----------------------------------------------------------*/ *----------------------------------------------------------*/
void ICACHE_FLASH_ATTR void vListInitialise( xList * const pxList )
vListInitialise( xList * const pxList )
{ {
/* The list structure contains a list item which is used to mark the /* The list structure contains a list item which is used to mark the
end of the list. To initialise the list the list end is inserted end of the list. To initialise the list the list end is inserted
@ -92,16 +91,14 @@ vListInitialise( xList * const pxList )
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
void ICACHE_FLASH_ATTR void vListInitialiseItem( xListItem * const pxItem )
vListInitialiseItem( xListItem * const pxItem )
{ {
/* Make sure the list item is not recorded as being on a list. */ /* Make sure the list item is not recorded as being on a list. */
pxItem->pvContainer = NULL; pxItem->pvContainer = NULL;
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
void void vListInsertEnd( xList * const pxList, xListItem * const pxNewListItem )
vListInsertEnd( xList * const pxList, xListItem * const pxNewListItem )
{ {
xListItem * pxIndex; xListItem * pxIndex;
@ -122,8 +119,7 @@ xListItem * pxIndex;
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
void ICACHE_FLASH_ATTR void vListInsert( xList * const pxList, xListItem * const pxNewListItem )
vListInsert( xList * const pxList, xListItem * const pxNewListItem )
{ {
xListItem *pxIterator; xListItem *pxIterator;
portTickType xValueOfInsertion; portTickType xValueOfInsertion;
@ -181,8 +177,7 @@ portTickType xValueOfInsertion;
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
unsigned portBASE_TYPE unsigned portBASE_TYPE uxListRemove( xListItem * const pxItemToRemove )
uxListRemove( xListItem * const pxItemToRemove )
{ {
xList * pxList; xList * pxList;

View file

@ -75,7 +75,7 @@ task.h is included from an application file. */
#include "queue.h" #include "queue.h"
#if ( configUSE_CO_ROUTINES == 1 ) #if ( configUSE_CO_ROUTINES == 1 )
#include "freertos/croutine.h" #include "croutine.h"
#endif #endif
/* Lint e961 and e750 are suppressed as a MISRA exception justified because the /* Lint e961 and e750 are suppressed as a MISRA exception justified because the
@ -234,9 +234,7 @@ static void prvCopyDataFromQueue( xQUEUE * const pxQueue, const void * const pvB
} \ } \
taskEXIT_CRITICAL() taskEXIT_CRITICAL()
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
portBASE_TYPE xQueueGenericReset( xQueueHandle xQueue, portBASE_TYPE xNewQueue )
portBASE_TYPE ICACHE_FLASH_ATTR
xQueueGenericReset( xQueueHandle xQueue, portBASE_TYPE xNewQueue )
{ {
xQUEUE * const pxQueue = ( xQUEUE * ) xQueue; xQUEUE * const pxQueue = ( xQUEUE * ) xQueue;
@ -281,8 +279,7 @@ xQUEUE * const pxQueue = ( xQUEUE * ) xQueue;
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
xQueueHandle ICACHE_FLASH_ATTR xQueueHandle xQueueGenericCreate( unsigned portBASE_TYPE uxQueueLength, unsigned portBASE_TYPE uxItemSize, unsigned char ucQueueType )
xQueueGenericCreate( unsigned portBASE_TYPE uxQueueLength, unsigned portBASE_TYPE uxItemSize, unsigned char ucQueueType )
{ {
xQUEUE *pxNewQueue; xQUEUE *pxNewQueue;
size_t xQueueSizeInBytes; size_t xQueueSizeInBytes;
@ -341,9 +338,7 @@ xQueueHandle xReturn = NULL;
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
#if ( configUSE_MUTEXES == 1 ) #if ( configUSE_MUTEXES == 1 )
xQueueHandle xQueueCreateMutex( unsigned char ucQueueType )
xQueueHandle ICACHE_FLASH_ATTR
xQueueCreateMutex( unsigned char ucQueueType )
{ {
xQUEUE *pxNewQueue; xQUEUE *pxNewQueue;
@ -407,9 +402,7 @@ xQueueHandle xReturn = NULL;
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
#if ( ( configUSE_MUTEXES == 1 ) && ( INCLUDE_xSemaphoreGetMutexHolder == 1 ) ) #if ( ( configUSE_MUTEXES == 1 ) && ( INCLUDE_xSemaphoreGetMutexHolder == 1 ) )
void* xQueueGetMutexHolder( xQueueHandle xSemaphore )
void* ICACHE_FLASH_ATTR
xQueueGetMutexHolder( xQueueHandle xSemaphore )
{ {
void *pxReturn; void *pxReturn;
@ -438,9 +431,7 @@ xQueueHandle xReturn = NULL;
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
#if ( configUSE_RECURSIVE_MUTEXES == 1 ) #if ( configUSE_RECURSIVE_MUTEXES == 1 )
portBASE_TYPE xQueueGiveMutexRecursive( xQueueHandle xMutex )
portBASE_TYPE ICACHE_FLASH_ATTR
xQueueGiveMutexRecursive( xQueueHandle xMutex )
{ {
portBASE_TYPE xReturn; portBASE_TYPE xReturn;
xQUEUE * const pxMutex = ( xQUEUE * ) xMutex; xQUEUE * const pxMutex = ( xQUEUE * ) xMutex;
@ -489,9 +480,7 @@ xQueueHandle xReturn = NULL;
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
#if ( configUSE_RECURSIVE_MUTEXES == 1 ) #if ( configUSE_RECURSIVE_MUTEXES == 1 )
portBASE_TYPE xQueueTakeMutexRecursive( xQueueHandle xMutex, portTickType xBlockTime )
portBASE_TYPE ICACHE_FLASH_ATTR
xQueueTakeMutexRecursive( xQueueHandle xMutex, portTickType xBlockTime )
{ {
portBASE_TYPE xReturn; portBASE_TYPE xReturn;
xQUEUE * const pxMutex = ( xQUEUE * ) xMutex; xQUEUE * const pxMutex = ( xQUEUE * ) xMutex;
@ -531,9 +520,7 @@ xQueueHandle xReturn = NULL;
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
#if ( configUSE_COUNTING_SEMAPHORES == 1 ) #if ( configUSE_COUNTING_SEMAPHORES == 1 )
xQueueHandle xQueueCreateCountingSemaphore( unsigned portBASE_TYPE uxCountValue, unsigned portBASE_TYPE uxInitialCount )
xQueueHandle ICACHE_FLASH_ATTR
xQueueCreateCountingSemaphore( unsigned portBASE_TYPE uxCountValue, unsigned portBASE_TYPE uxInitialCount )
{ {
xQueueHandle xHandle; xQueueHandle xHandle;
@ -556,9 +543,7 @@ xQueueHandle xReturn = NULL;
#endif /* configUSE_COUNTING_SEMAPHORES */ #endif /* configUSE_COUNTING_SEMAPHORES */
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
signed portBASE_TYPE xQueueGenericSend( xQueueHandle xQueue, const void * const pvItemToQueue, portTickType xTicksToWait, portBASE_TYPE xCopyPosition )
signed portBASE_TYPE ICACHE_FLASH_ATTR
xQueueGenericSend( xQueueHandle xQueue, const void * const pvItemToQueue, portTickType xTicksToWait, portBASE_TYPE xCopyPosition )
{ {
signed portBASE_TYPE xEntryTimeSet = pdFALSE; signed portBASE_TYPE xEntryTimeSet = pdFALSE;
xTimeOutType xTimeOut; xTimeOutType xTimeOut;
@ -719,9 +704,7 @@ xQUEUE * const pxQueue = ( xQUEUE * ) xQueue;
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
#if ( configUSE_ALTERNATIVE_API == 1 ) #if ( configUSE_ALTERNATIVE_API == 1 )
signed portBASE_TYPE xQueueAltGenericSend( xQueueHandle xQueue, const void * const pvItemToQueue, portTickType xTicksToWait, portBASE_TYPE xCopyPosition )
signed portBASE_TYPE ICACHE_FLASH_ATTR
xQueueAltGenericSend( xQueueHandle xQueue, const void * const pvItemToQueue, portTickType xTicksToWait, portBASE_TYPE xCopyPosition )
{ {
signed portBASE_TYPE xEntryTimeSet = pdFALSE; signed portBASE_TYPE xEntryTimeSet = pdFALSE;
xTimeOutType xTimeOut; xTimeOutType xTimeOut;
@ -798,9 +781,7 @@ xQUEUE * const pxQueue = ( xQUEUE * ) xQueue;
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
#if ( configUSE_ALTERNATIVE_API == 1 ) #if ( configUSE_ALTERNATIVE_API == 1 )
signed portBASE_TYPE xQueueAltGenericReceive( xQueueHandle xQueue, void * const pvBuffer, portTickType xTicksToWait, portBASE_TYPE xJustPeeking )
signed portBASE_TYPE ICACHE_FLASH_ATTR
xQueueAltGenericReceive( xQueueHandle xQueue, void * const pvBuffer, portTickType xTicksToWait, portBASE_TYPE xJustPeeking )
{ {
signed portBASE_TYPE xEntryTimeSet = pdFALSE; signed portBASE_TYPE xEntryTimeSet = pdFALSE;
xTimeOutType xTimeOut; xTimeOutType xTimeOut;
@ -929,9 +910,7 @@ xQUEUE * const pxQueue = ( xQUEUE * ) xQueue;
#endif /* configUSE_ALTERNATIVE_API */ #endif /* configUSE_ALTERNATIVE_API */
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
signed portBASE_TYPE xQueueGenericSendFromISR( xQueueHandle xQueue, const void * const pvItemToQueue, signed portBASE_TYPE *pxHigherPriorityTaskWoken, portBASE_TYPE xCopyPosition )
signed portBASE_TYPE
xQueueGenericSendFromISR( xQueueHandle xQueue, const void * const pvItemToQueue, signed portBASE_TYPE *pxHigherPriorityTaskWoken, portBASE_TYPE xCopyPosition )
{ {
signed portBASE_TYPE xReturn; signed portBASE_TYPE xReturn;
unsigned portBASE_TYPE uxSavedInterruptStatus; unsigned portBASE_TYPE uxSavedInterruptStatus;
@ -962,9 +941,7 @@ xQUEUE * const pxQueue = ( xQUEUE * ) xQueue;
queue read, instead we return a flag to say whether a context switch is queue read, instead we return a flag to say whether a context switch is
required or not (i.e. has a task with a higher priority than us been woken required or not (i.e. has a task with a higher priority than us been woken
by this post). */ by this post). */
// uxSavedInterruptStatus = portSET_INTERRUPT_MASK_FROM_ISR(); uxSavedInterruptStatus = portSET_INTERRUPT_MASK_FROM_ISR();
portSET_INTERRUPT_MASK_FROM_ISR();
{ {
if( ( pxQueue->uxMessagesWaiting < pxQueue->uxLength ) || ( xCopyPosition == queueOVERWRITE ) ) if( ( pxQueue->uxMessagesWaiting < pxQueue->uxLength ) || ( xCopyPosition == queueOVERWRITE ) )
{ {
@ -1044,9 +1021,7 @@ xQUEUE * const pxQueue = ( xQUEUE * ) xQueue;
return xReturn; return xReturn;
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
signed portBASE_TYPE xQueueGenericReceive( xQueueHandle xQueue, const void * const pvBuffer, portTickType xTicksToWait, portBASE_TYPE xJustPeeking )
signed portBASE_TYPE ICACHE_FLASH_ATTR
xQueueGenericReceive( xQueueHandle xQueue, const void * const pvBuffer, portTickType xTicksToWait, portBASE_TYPE xJustPeeking )
{ {
signed portBASE_TYPE xEntryTimeSet = pdFALSE; signed portBASE_TYPE xEntryTimeSet = pdFALSE;
xTimeOutType xTimeOut; xTimeOutType xTimeOut;
@ -1200,9 +1175,7 @@ xQUEUE * const pxQueue = ( xQUEUE * ) xQueue;
} }
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
signed portBASE_TYPE xQueueReceiveFromISR( xQueueHandle xQueue, const void * const pvBuffer, signed portBASE_TYPE *pxHigherPriorityTaskWoken )
signed portBASE_TYPE
xQueueReceiveFromISR( xQueueHandle xQueue, const void * const pvBuffer, signed portBASE_TYPE *pxHigherPriorityTaskWoken )
{ {
signed portBASE_TYPE xReturn; signed portBASE_TYPE xReturn;
unsigned portBASE_TYPE uxSavedInterruptStatus; unsigned portBASE_TYPE uxSavedInterruptStatus;
@ -1227,9 +1200,7 @@ xQUEUE * const pxQueue = ( xQUEUE * ) xQueue;
link: http://www.freertos.org/RTOS-Cortex-M3-M4.html */ link: http://www.freertos.org/RTOS-Cortex-M3-M4.html */
portASSERT_IF_INTERRUPT_PRIORITY_INVALID(); portASSERT_IF_INTERRUPT_PRIORITY_INVALID();
// uxSavedInterruptStatus = portSET_INTERRUPT_MASK_FROM_ISR(); uxSavedInterruptStatus = portSET_INTERRUPT_MASK_FROM_ISR();
portSET_INTERRUPT_MASK_FROM_ISR();
{ {
/* Cannot block in an ISR, so check there is data available. */ /* Cannot block in an ISR, so check there is data available. */
if( pxQueue->uxMessagesWaiting > ( unsigned portBASE_TYPE ) 0 ) if( pxQueue->uxMessagesWaiting > ( unsigned portBASE_TYPE ) 0 )
@ -1278,9 +1249,7 @@ xQUEUE * const pxQueue = ( xQUEUE * ) xQueue;
return xReturn; return xReturn;
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
signed portBASE_TYPE xQueuePeekFromISR( xQueueHandle xQueue, const void * const pvBuffer )
signed portBASE_TYPE
xQueuePeekFromISR( xQueueHandle xQueue, const void * const pvBuffer )
{ {
signed portBASE_TYPE xReturn; signed portBASE_TYPE xReturn;
unsigned portBASE_TYPE uxSavedInterruptStatus; unsigned portBASE_TYPE uxSavedInterruptStatus;
@ -1306,9 +1275,7 @@ xQUEUE * const pxQueue = ( xQUEUE * ) xQueue;
link: http://www.freertos.org/RTOS-Cortex-M3-M4.html */ link: http://www.freertos.org/RTOS-Cortex-M3-M4.html */
portASSERT_IF_INTERRUPT_PRIORITY_INVALID(); portASSERT_IF_INTERRUPT_PRIORITY_INVALID();
// uxSavedInterruptStatus = portSET_INTERRUPT_MASK_FROM_ISR(); uxSavedInterruptStatus = portSET_INTERRUPT_MASK_FROM_ISR();
portSET_INTERRUPT_MASK_FROM_ISR();
{ {
/* Cannot block in an ISR, so check there is data available. */ /* Cannot block in an ISR, so check there is data available. */
if( pxQueue->uxMessagesWaiting > ( unsigned portBASE_TYPE ) 0 ) if( pxQueue->uxMessagesWaiting > ( unsigned portBASE_TYPE ) 0 )
@ -1335,8 +1302,7 @@ xQUEUE * const pxQueue = ( xQUEUE * ) xQueue;
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
unsigned portBASE_TYPE ICACHE_FLASH_ATTR unsigned portBASE_TYPE uxQueueMessagesWaiting( const xQueueHandle xQueue )
uxQueueMessagesWaiting( const xQueueHandle xQueue )
{ {
unsigned portBASE_TYPE uxReturn; unsigned portBASE_TYPE uxReturn;
@ -1350,8 +1316,7 @@ unsigned portBASE_TYPE uxReturn;
} /*lint !e818 Pointer cannot be declared const as xQueue is a typedef not pointer. */ } /*lint !e818 Pointer cannot be declared const as xQueue is a typedef not pointer. */
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
unsigned portBASE_TYPE unsigned portBASE_TYPE uxQueueMessagesWaitingFromISR( const xQueueHandle xQueue )
uxQueueMessagesWaitingFromISR( const xQueueHandle xQueue )
{ {
unsigned portBASE_TYPE uxReturn; unsigned portBASE_TYPE uxReturn;
@ -1363,8 +1328,7 @@ unsigned portBASE_TYPE uxReturn;
} /*lint !e818 Pointer cannot be declared const as xQueue is a typedef not pointer. */ } /*lint !e818 Pointer cannot be declared const as xQueue is a typedef not pointer. */
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
void ICACHE_FLASH_ATTR void vQueueDelete( xQueueHandle xQueue )
vQueueDelete( xQueueHandle xQueue )
{ {
xQUEUE * const pxQueue = ( xQUEUE * ) xQueue; xQUEUE * const pxQueue = ( xQUEUE * ) xQueue;
@ -1383,8 +1347,7 @@ xQUEUE * const pxQueue = ( xQUEUE * ) xQueue;
#if ( configUSE_TRACE_FACILITY == 1 ) #if ( configUSE_TRACE_FACILITY == 1 )
unsigned char ICACHE_FLASH_ATTR unsigned char ucQueueGetQueueNumber( xQueueHandle xQueue )
ucQueueGetQueueNumber( xQueueHandle xQueue )
{ {
return ( ( xQUEUE * ) xQueue )->ucQueueNumber; return ( ( xQUEUE * ) xQueue )->ucQueueNumber;
} }
@ -1394,8 +1357,7 @@ xQUEUE * const pxQueue = ( xQUEUE * ) xQueue;
#if ( configUSE_TRACE_FACILITY == 1 ) #if ( configUSE_TRACE_FACILITY == 1 )
void ICACHE_FLASH_ATTR void vQueueSetQueueNumber( xQueueHandle xQueue, unsigned char ucQueueNumber )
vQueueSetQueueNumber( xQueueHandle xQueue, unsigned char ucQueueNumber )
{ {
( ( xQUEUE * ) xQueue )->ucQueueNumber = ucQueueNumber; ( ( xQUEUE * ) xQueue )->ucQueueNumber = ucQueueNumber;
} }
@ -1405,17 +1367,14 @@ xQUEUE * const pxQueue = ( xQUEUE * ) xQueue;
#if ( configUSE_TRACE_FACILITY == 1 ) #if ( configUSE_TRACE_FACILITY == 1 )
unsigned char ICACHE_FLASH_ATTR unsigned char ucQueueGetQueueType( xQueueHandle xQueue )
ucQueueGetQueueType( xQueueHandle xQueue )
{ {
return ( ( xQUEUE * ) xQueue )->ucQueueType; return ( ( xQUEUE * ) xQueue )->ucQueueType;
} }
#endif /* configUSE_TRACE_FACILITY */ #endif /* configUSE_TRACE_FACILITY */
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
static void prvCopyDataToQueue( xQUEUE *pxQueue, const void *pvItemToQueue, portBASE_TYPE xPosition )
static void
prvCopyDataToQueue( xQUEUE *pxQueue, const void *pvItemToQueue, portBASE_TYPE xPosition )
{ {
if( pxQueue->uxItemSize == ( unsigned portBASE_TYPE ) 0 ) if( pxQueue->uxItemSize == ( unsigned portBASE_TYPE ) 0 )
{ {
@ -1464,9 +1423,7 @@ prvCopyDataToQueue( xQUEUE *pxQueue, const void *pvItemToQueue, portBASE_TYPE xP
++( pxQueue->uxMessagesWaiting ); ++( pxQueue->uxMessagesWaiting );
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
static void prvCopyDataFromQueue( xQUEUE * const pxQueue, const void * const pvBuffer )
static void
prvCopyDataFromQueue( xQUEUE * const pxQueue, const void * const pvBuffer )
{ {
if( pxQueue->uxQueueType != queueQUEUE_IS_MUTEX ) if( pxQueue->uxQueueType != queueQUEUE_IS_MUTEX )
{ {
@ -1479,9 +1436,7 @@ prvCopyDataFromQueue( xQUEUE * const pxQueue, const void * const pvBuffer )
} }
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
static void prvUnlockQueue( xQUEUE *pxQueue )
static void ICACHE_FLASH_ATTR
prvUnlockQueue( xQUEUE *pxQueue )
{ {
/* THIS FUNCTION MUST BE CALLED WITH THE SCHEDULER SUSPENDED. */ /* THIS FUNCTION MUST BE CALLED WITH THE SCHEDULER SUSPENDED. */
@ -1579,9 +1534,7 @@ prvUnlockQueue( xQUEUE *pxQueue )
taskEXIT_CRITICAL(); taskEXIT_CRITICAL();
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
static signed portBASE_TYPE prvIsQueueEmpty( const xQUEUE *pxQueue )
static signed portBASE_TYPE ICACHE_FLASH_ATTR
prvIsQueueEmpty( const xQUEUE *pxQueue )
{ {
signed portBASE_TYPE xReturn; signed portBASE_TYPE xReturn;
@ -1601,9 +1554,7 @@ signed portBASE_TYPE xReturn;
return xReturn; return xReturn;
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
signed portBASE_TYPE xQueueIsQueueEmptyFromISR( const xQueueHandle xQueue )
signed portBASE_TYPE
xQueueIsQueueEmptyFromISR( const xQueueHandle xQueue )
{ {
signed portBASE_TYPE xReturn; signed portBASE_TYPE xReturn;
@ -1620,9 +1571,7 @@ signed portBASE_TYPE xReturn;
return xReturn; return xReturn;
} /*lint !e818 xQueue could not be pointer to const because it is a typedef. */ } /*lint !e818 xQueue could not be pointer to const because it is a typedef. */
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
static signed portBASE_TYPE prvIsQueueFull( const xQUEUE *pxQueue )
static signed portBASE_TYPE ICACHE_FLASH_ATTR
prvIsQueueFull( const xQUEUE *pxQueue )
{ {
signed portBASE_TYPE xReturn; signed portBASE_TYPE xReturn;
@ -1642,9 +1591,7 @@ signed portBASE_TYPE xReturn;
return xReturn; return xReturn;
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
signed portBASE_TYPE xQueueIsQueueFullFromISR( const xQueueHandle xQueue )
signed portBASE_TYPE
xQueueIsQueueFullFromISR( const xQueueHandle xQueue )
{ {
signed portBASE_TYPE xReturn; signed portBASE_TYPE xReturn;
@ -1663,9 +1610,7 @@ signed portBASE_TYPE xReturn;
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
#if ( configUSE_CO_ROUTINES == 1 ) #if ( configUSE_CO_ROUTINES == 1 )
signed portBASE_TYPE xQueueCRSend( xQueueHandle xQueue, const void *pvItemToQueue, portTickType xTicksToWait )
signed portBASE_TYPE ICACHE_FLASH_ATTR
xQueueCRSend( xQueueHandle xQueue, const void *pvItemToQueue, portTickType xTicksToWait )
{ {
signed portBASE_TYPE xReturn; signed portBASE_TYPE xReturn;
xQUEUE * const pxQueue = ( xQUEUE * ) xQueue; xQUEUE * const pxQueue = ( xQUEUE * ) xQueue;
@ -1673,9 +1618,7 @@ signed portBASE_TYPE xReturn;
/* If the queue is already full we may have to block. A critical section /* If the queue is already full we may have to block. A critical section
is required to prevent an interrupt removing something from the queue is required to prevent an interrupt removing something from the queue
between the check to see if the queue is full and blocking on the queue. */ between the check to see if the queue is full and blocking on the queue. */
portDISABLE_INTERRUPTS();
//portDISABLE_INTERRUPTS();
PortDisableInt_NoNest();
{ {
if( prvIsQueueFull( pxQueue ) != pdFALSE ) if( prvIsQueueFull( pxQueue ) != pdFALSE )
{ {
@ -1686,23 +1629,19 @@ PortDisableInt_NoNest();
/* As this is called from a coroutine we cannot block directly, but /* As this is called from a coroutine we cannot block directly, but
return indicating that we need to block. */ return indicating that we need to block. */
vCoRoutineAddToDelayedList( xTicksToWait, &( pxQueue->xTasksWaitingToSend ) ); vCoRoutineAddToDelayedList( xTicksToWait, &( pxQueue->xTasksWaitingToSend ) );
//portENABLE_INTERRUPTS(); portENABLE_INTERRUPTS();
PortEnableInt_NoNest();
return errQUEUE_BLOCKED; return errQUEUE_BLOCKED;
} }
else else
{ {
//portENABLE_INTERRUPTS(); portENABLE_INTERRUPTS();
PortEnableInt_NoNest();
return errQUEUE_FULL; return errQUEUE_FULL;
} }
} }
} }
//portENABLE_INTERRUPTS(); portENABLE_INTERRUPTS();
PortEnableInt_NoNest();
//portDISABLE_INTERRUPTS(); portDISABLE_INTERRUPTS();
PortDisableInt_NoNest();
{ {
if( pxQueue->uxMessagesWaiting < pxQueue->uxLength ) if( pxQueue->uxMessagesWaiting < pxQueue->uxLength )
{ {
@ -1730,8 +1669,8 @@ PortDisableInt_NoNest();
xReturn = errQUEUE_FULL; xReturn = errQUEUE_FULL;
} }
} }
//portENABLE_INTERRUPTS(); portENABLE_INTERRUPTS();
PortEnableInt_NoNest();
return xReturn; return xReturn;
} }
@ -1739,9 +1678,7 @@ PortEnableInt_NoNest();
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
#if ( configUSE_CO_ROUTINES == 1 ) #if ( configUSE_CO_ROUTINES == 1 )
signed portBASE_TYPE xQueueCRReceive( xQueueHandle xQueue, void *pvBuffer, portTickType xTicksToWait )
signed portBASE_TYPE ICACHE_FLASH_ATTR
xQueueCRReceive( xQueueHandle xQueue, void *pvBuffer, portTickType xTicksToWait )
{ {
signed portBASE_TYPE xReturn; signed portBASE_TYPE xReturn;
xQUEUE * const pxQueue = ( xQUEUE * ) xQueue; xQUEUE * const pxQueue = ( xQUEUE * ) xQueue;
@ -1749,9 +1686,7 @@ PortEnableInt_NoNest();
/* If the queue is already empty we may have to block. A critical section /* If the queue is already empty we may have to block. A critical section
is required to prevent an interrupt adding something to the queue is required to prevent an interrupt adding something to the queue
between the check to see if the queue is empty and blocking on the queue. */ between the check to see if the queue is empty and blocking on the queue. */
portDISABLE_INTERRUPTS();
//portDISABLE_INTERRUPTS();
PortDisableInt_NoNest();
{ {
if( pxQueue->uxMessagesWaiting == ( unsigned portBASE_TYPE ) 0 ) if( pxQueue->uxMessagesWaiting == ( unsigned portBASE_TYPE ) 0 )
{ {
@ -1762,23 +1697,19 @@ PortDisableInt_NoNest();
/* As this is a co-routine we cannot block directly, but return /* As this is a co-routine we cannot block directly, but return
indicating that we need to block. */ indicating that we need to block. */
vCoRoutineAddToDelayedList( xTicksToWait, &( pxQueue->xTasksWaitingToReceive ) ); vCoRoutineAddToDelayedList( xTicksToWait, &( pxQueue->xTasksWaitingToReceive ) );
//portENABLE_INTERRUPTS(); portENABLE_INTERRUPTS();
PortEnableInt_NoNest();
return errQUEUE_BLOCKED; return errQUEUE_BLOCKED;
} }
else else
{ {
//portENABLE_INTERRUPTS(); portENABLE_INTERRUPTS();
PortEnableInt_NoNest();
return errQUEUE_FULL; return errQUEUE_FULL;
} }
} }
} }
//portENABLE_INTERRUPTS(); portENABLE_INTERRUPTS();
PortEnableInt_NoNest();
//portDISABLE_INTERRUPTS(); portDISABLE_INTERRUPTS();
PortDisableInt_NoNest();
{ {
if( pxQueue->uxMessagesWaiting > ( unsigned portBASE_TYPE ) 0 ) if( pxQueue->uxMessagesWaiting > ( unsigned portBASE_TYPE ) 0 )
{ {
@ -1811,8 +1742,7 @@ PortDisableInt_NoNest();
xReturn = pdFAIL; xReturn = pdFAIL;
} }
} }
//portENABLE_INTERRUPTS(); portENABLE_INTERRUPTS();
PortEnableInt_NoNest();
return xReturn; return xReturn;
} }
@ -1821,9 +1751,7 @@ PortEnableInt_NoNest();
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
#if ( configUSE_CO_ROUTINES == 1 ) #if ( configUSE_CO_ROUTINES == 1 )
signed portBASE_TYPE xQueueCRSendFromISR( xQueueHandle xQueue, const void *pvItemToQueue, signed portBASE_TYPE xCoRoutinePreviouslyWoken )
signed portBASE_TYPE
xQueueCRSendFromISR( xQueueHandle xQueue, const void *pvItemToQueue, signed portBASE_TYPE xCoRoutinePreviouslyWoken )
{ {
xQUEUE * const pxQueue = ( xQUEUE * ) xQueue; xQUEUE * const pxQueue = ( xQUEUE * ) xQueue;
@ -1855,8 +1783,7 @@ PortEnableInt_NoNest();
#if ( configUSE_CO_ROUTINES == 1 ) #if ( configUSE_CO_ROUTINES == 1 )
signed portBASE_TYPE signed portBASE_TYPE xQueueCRReceiveFromISR( xQueueHandle xQueue, void *pvBuffer, signed portBASE_TYPE *pxCoRoutineWoken )
xQueueCRReceiveFromISR( xQueueHandle xQueue, void *pvBuffer, signed portBASE_TYPE *pxCoRoutineWoken )
{ {
signed portBASE_TYPE xReturn; signed portBASE_TYPE xReturn;
xQUEUE * const pxQueue = ( xQUEUE * ) xQueue; xQUEUE * const pxQueue = ( xQUEUE * ) xQueue;
@ -1900,8 +1827,7 @@ PortEnableInt_NoNest();
#if ( configQUEUE_REGISTRY_SIZE > 0 ) #if ( configQUEUE_REGISTRY_SIZE > 0 )
void ICACHE_FLASH_ATTR void vQueueAddToRegistry( xQueueHandle xQueue, signed char *pcQueueName )
vQueueAddToRegistry( xQueueHandle xQueue, signed char *pcQueueName )
{ {
unsigned portBASE_TYPE ux; unsigned portBASE_TYPE ux;
@ -1924,8 +1850,7 @@ PortEnableInt_NoNest();
#if ( configQUEUE_REGISTRY_SIZE > 0 ) #if ( configQUEUE_REGISTRY_SIZE > 0 )
void ICACHE_FLASH_ATTR void vQueueUnregisterQueue( xQueueHandle xQueue )
vQueueUnregisterQueue( xQueueHandle xQueue )
{ {
unsigned portBASE_TYPE ux; unsigned portBASE_TYPE ux;
@ -1948,8 +1873,7 @@ PortEnableInt_NoNest();
#if ( configUSE_TIMERS == 1 ) #if ( configUSE_TIMERS == 1 )
void ICACHE_FLASH_ATTR void vQueueWaitForMessageRestricted( xQueueHandle xQueue, portTickType xTicksToWait )
vQueueWaitForMessageRestricted( xQueueHandle xQueue, portTickType xTicksToWait )
{ {
xQUEUE * const pxQueue = ( xQUEUE * ) xQueue; xQUEUE * const pxQueue = ( xQUEUE * ) xQueue;
@ -1981,8 +1905,7 @@ PortEnableInt_NoNest();
#if ( configUSE_QUEUE_SETS == 1 ) #if ( configUSE_QUEUE_SETS == 1 )
xQueueSetHandle ICACHE_FLASH_ATTR xQueueSetHandle xQueueCreateSet( unsigned portBASE_TYPE uxEventQueueLength )
xQueueCreateSet( unsigned portBASE_TYPE uxEventQueueLength )
{ {
xQueueSetHandle pxQueue; xQueueSetHandle pxQueue;
@ -1996,8 +1919,7 @@ PortEnableInt_NoNest();
#if ( configUSE_QUEUE_SETS == 1 ) #if ( configUSE_QUEUE_SETS == 1 )
portBASE_TYPE ICACHE_FLASH_ATTR portBASE_TYPE xQueueAddToSet( xQueueSetMemberHandle xQueueOrSemaphore, xQueueSetHandle xQueueSet )
xQueueAddToSet( xQueueSetMemberHandle xQueueOrSemaphore, xQueueSetHandle xQueueSet )
{ {
portBASE_TYPE xReturn; portBASE_TYPE xReturn;
@ -2030,8 +1952,7 @@ PortEnableInt_NoNest();
#if ( configUSE_QUEUE_SETS == 1 ) #if ( configUSE_QUEUE_SETS == 1 )
portBASE_TYPE ICACHE_FLASH_ATTR portBASE_TYPE xQueueRemoveFromSet( xQueueSetMemberHandle xQueueOrSemaphore, xQueueSetHandle xQueueSet )
xQueueRemoveFromSet( xQueueSetMemberHandle xQueueOrSemaphore, xQueueSetHandle xQueueSet )
{ {
portBASE_TYPE xReturn; portBASE_TYPE xReturn;
xQUEUE * const pxQueueOrSemaphore = ( xQUEUE * ) xQueueOrSemaphore; xQUEUE * const pxQueueOrSemaphore = ( xQUEUE * ) xQueueOrSemaphore;
@ -2067,8 +1988,7 @@ PortEnableInt_NoNest();
#if ( configUSE_QUEUE_SETS == 1 ) #if ( configUSE_QUEUE_SETS == 1 )
xQueueSetMemberHandle ICACHE_FLASH_ATTR xQueueSetMemberHandle xQueueSelectFromSet( xQueueSetHandle xQueueSet, portTickType xBlockTimeTicks )
xQueueSelectFromSet( xQueueSetHandle xQueueSet, portTickType xBlockTimeTicks )
{ {
xQueueSetMemberHandle xReturn = NULL; xQueueSetMemberHandle xReturn = NULL;
@ -2081,8 +2001,7 @@ PortEnableInt_NoNest();
#if ( configUSE_QUEUE_SETS == 1 ) #if ( configUSE_QUEUE_SETS == 1 )
xQueueSetMemberHandle xQueueSetMemberHandle xQueueSelectFromSetFromISR( xQueueSetHandle xQueueSet )
xQueueSelectFromSetFromISR( xQueueSetHandle xQueueSet )
{ {
xQueueSetMemberHandle xReturn = NULL; xQueueSetMemberHandle xReturn = NULL;
@ -2095,8 +2014,7 @@ PortEnableInt_NoNest();
#if ( configUSE_QUEUE_SETS == 1 ) #if ( configUSE_QUEUE_SETS == 1 )
static portBASE_TYPE ICACHE_FLASH_ATTR static portBASE_TYPE prvNotifyQueueSetContainer( const xQUEUE * const pxQueue, portBASE_TYPE xCopyPosition )
prvNotifyQueueSetContainer( const xQUEUE * const pxQueue, portBASE_TYPE xCopyPosition )
{ {
xQUEUE *pxQueueSetContainer = pxQueue->pxQueueSetContainer; xQUEUE *pxQueueSetContainer = pxQueue->pxQueueSetContainer;
portBASE_TYPE xReturn = pdFALSE; portBASE_TYPE xReturn = pdFALSE;

View file

@ -101,7 +101,7 @@ privileged Vs unprivileged linkage and placement. */
/* /*
* Defines the size, in words, of the stack allocated to the idle task. * Defines the size, in words, of the stack allocated to the idle task.
*/ */
#define tskIDLE_STACK_SIZE 176 //configMINIMAL_STACK_SIZE #define tskIDLE_STACK_SIZE configMINIMAL_STACK_SIZE
/* /*
* Task control block. A task control block (TCB) is allocated for each task, * Task control block. A task control block (TCB) is allocated for each task,
@ -475,8 +475,7 @@ static tskTCB *prvAllocateTCBAndStack( unsigned short usStackDepth, portSTACK_TY
#endif #endif
signed portBASE_TYPE ICACHE_FLASH_ATTR signed portBASE_TYPE xTaskGenericCreate( pdTASK_CODE pxTaskCode, const signed char * const pcName, unsigned short usStackDepth, void *pvParameters, unsigned portBASE_TYPE uxPriority, xTaskHandle *pxCreatedTask, portSTACK_TYPE *puxStackBuffer, const xMemoryRegion * const xRegions )
xTaskGenericCreate( pdTASK_CODE pxTaskCode, const signed char * const pcName, unsigned short usStackDepth, void *pvParameters, unsigned portBASE_TYPE uxPriority, xTaskHandle *pxCreatedTask, portSTACK_TYPE *puxStackBuffer, const xMemoryRegion * const xRegions )
{ {
signed portBASE_TYPE xReturn; signed portBASE_TYPE xReturn;
tskTCB * pxNewTCB; tskTCB * pxNewTCB;
@ -632,8 +631,7 @@ tskTCB * pxNewTCB;
#if ( INCLUDE_vTaskDelete == 1 ) #if ( INCLUDE_vTaskDelete == 1 )
void ICACHE_FLASH_ATTR void vTaskDelete( xTaskHandle xTaskToDelete )
vTaskDelete( xTaskHandle xTaskToDelete )
{ {
tskTCB *pxTCB; tskTCB *pxTCB;
@ -687,8 +685,7 @@ tskTCB * pxNewTCB;
#if ( INCLUDE_vTaskDelayUntil == 1 ) #if ( INCLUDE_vTaskDelayUntil == 1 )
void ICACHE_FLASH_ATTR void vTaskDelayUntil( portTickType * const pxPreviousWakeTime, portTickType xTimeIncrement )
vTaskDelayUntil( portTickType * const pxPreviousWakeTime, portTickType xTimeIncrement )
{ {
portTickType xTimeToWake; portTickType xTimeToWake;
portBASE_TYPE xAlreadyYielded, xShouldDelay = pdFALSE; portBASE_TYPE xAlreadyYielded, xShouldDelay = pdFALSE;
@ -764,8 +761,7 @@ tskTCB * pxNewTCB;
#if ( INCLUDE_vTaskDelay == 1 ) #if ( INCLUDE_vTaskDelay == 1 )
void ICACHE_FLASH_ATTR void vTaskDelay( portTickType xTicksToDelay )
vTaskDelay( portTickType xTicksToDelay )
{ {
portTickType xTimeToWake; portTickType xTimeToWake;
signed portBASE_TYPE xAlreadyYielded = pdFALSE; signed portBASE_TYPE xAlreadyYielded = pdFALSE;
@ -817,8 +813,7 @@ tskTCB * pxNewTCB;
#if ( INCLUDE_eTaskGetState == 1 ) #if ( INCLUDE_eTaskGetState == 1 )
eTaskState ICACHE_FLASH_ATTR eTaskState eTaskGetState( xTaskHandle xTask )
eTaskGetState( xTaskHandle xTask )
{ {
eTaskState eReturn; eTaskState eReturn;
xList *pxStateList; xList *pxStateList;
@ -878,8 +873,7 @@ tskTCB * pxNewTCB;
#if ( INCLUDE_uxTaskPriorityGet == 1 ) #if ( INCLUDE_uxTaskPriorityGet == 1 )
unsigned portBASE_TYPE ICACHE_FLASH_ATTR unsigned portBASE_TYPE uxTaskPriorityGet( xTaskHandle xTask )
uxTaskPriorityGet( xTaskHandle xTask )
{ {
tskTCB *pxTCB; tskTCB *pxTCB;
unsigned portBASE_TYPE uxReturn; unsigned portBASE_TYPE uxReturn;
@ -901,8 +895,7 @@ tskTCB * pxNewTCB;
#if ( INCLUDE_vTaskPrioritySet == 1 ) #if ( INCLUDE_vTaskPrioritySet == 1 )
void ICACHE_FLASH_ATTR void vTaskPrioritySet( xTaskHandle xTask, unsigned portBASE_TYPE uxNewPriority )
vTaskPrioritySet( xTaskHandle xTask, unsigned portBASE_TYPE uxNewPriority )
{ {
tskTCB *pxTCB; tskTCB *pxTCB;
unsigned portBASE_TYPE uxCurrentBasePriority, uxPriorityUsedOnEntry; unsigned portBASE_TYPE uxCurrentBasePriority, uxPriorityUsedOnEntry;
@ -1033,8 +1026,7 @@ tskTCB * pxNewTCB;
#if ( INCLUDE_vTaskSuspend == 1 ) #if ( INCLUDE_vTaskSuspend == 1 )
void ICACHE_FLASH_ATTR void vTaskSuspend( xTaskHandle xTaskToSuspend )
vTaskSuspend( xTaskHandle xTaskToSuspend )
{ {
tskTCB *pxTCB; tskTCB *pxTCB;
@ -1095,8 +1087,7 @@ tskTCB * pxNewTCB;
#if ( INCLUDE_vTaskSuspend == 1 ) #if ( INCLUDE_vTaskSuspend == 1 )
signed portBASE_TYPE ICACHE_FLASH_ATTR signed portBASE_TYPE xTaskIsTaskSuspended( xTaskHandle xTask )
xTaskIsTaskSuspended( xTaskHandle xTask )
{ {
portBASE_TYPE xReturn = pdFALSE; portBASE_TYPE xReturn = pdFALSE;
const tskTCB * const pxTCB = ( tskTCB * ) xTask; const tskTCB * const pxTCB = ( tskTCB * ) xTask;
@ -1130,8 +1121,7 @@ tskTCB * pxNewTCB;
#if ( INCLUDE_vTaskSuspend == 1 ) #if ( INCLUDE_vTaskSuspend == 1 )
void ICACHE_FLASH_ATTR void vTaskResume( xTaskHandle xTaskToResume )
vTaskResume( xTaskHandle xTaskToResume )
{ {
tskTCB * const pxTCB = ( tskTCB * ) xTaskToResume; tskTCB * const pxTCB = ( tskTCB * ) xTaskToResume;
@ -1172,8 +1162,7 @@ tskTCB * pxNewTCB;
#if ( ( INCLUDE_xTaskResumeFromISR == 1 ) && ( INCLUDE_vTaskSuspend == 1 ) ) #if ( ( INCLUDE_xTaskResumeFromISR == 1 ) && ( INCLUDE_vTaskSuspend == 1 ) )
portBASE_TYPE portBASE_TYPE xTaskResumeFromISR( xTaskHandle xTaskToResume )
xTaskResumeFromISR( xTaskHandle xTaskToResume )
{ {
portBASE_TYPE xYieldRequired = pdFALSE; portBASE_TYPE xYieldRequired = pdFALSE;
tskTCB * const pxTCB = ( tskTCB * ) xTaskToResume; tskTCB * const pxTCB = ( tskTCB * ) xTaskToResume;
@ -1199,9 +1188,7 @@ tskTCB * pxNewTCB;
http://www.freertos.org/RTOS-Cortex-M3-M4.html */ http://www.freertos.org/RTOS-Cortex-M3-M4.html */
portASSERT_IF_INTERRUPT_PRIORITY_INVALID(); portASSERT_IF_INTERRUPT_PRIORITY_INVALID();
// uxSavedInterruptStatus = portSET_INTERRUPT_MASK_FROM_ISR(); uxSavedInterruptStatus = portSET_INTERRUPT_MASK_FROM_ISR();
portSET_INTERRUPT_MASK_FROM_ISR();
{ {
if( xTaskIsTaskSuspended( pxTCB ) == pdTRUE ) if( xTaskIsTaskSuspended( pxTCB ) == pdTRUE )
{ {
@ -1230,8 +1217,7 @@ tskTCB * pxNewTCB;
#endif /* ( ( INCLUDE_xTaskResumeFromISR == 1 ) && ( INCLUDE_vTaskSuspend == 1 ) ) */ #endif /* ( ( INCLUDE_xTaskResumeFromISR == 1 ) && ( INCLUDE_vTaskSuspend == 1 ) ) */
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
void ICACHE_FLASH_ATTR void vTaskStartScheduler( void )
vTaskStartScheduler( void )
{ {
portBASE_TYPE xReturn; portBASE_TYPE xReturn;
@ -1241,7 +1227,6 @@ portBASE_TYPE xReturn;
/* Create the idle task, storing its handle in xIdleTaskHandle so it can /* Create the idle task, storing its handle in xIdleTaskHandle so it can
be returned by the xTaskGetIdleTaskHandle() function. */ be returned by the xTaskGetIdleTaskHandle() function. */
xReturn = xTaskCreate( prvIdleTask, ( signed char * ) "IDLE", tskIDLE_STACK_SIZE, ( void * ) NULL, ( tskIDLE_PRIORITY | portPRIVILEGE_BIT ), &xIdleTaskHandle ); /*lint !e961 MISRA exception, justified as it is not a redundant explicit cast to all supported compilers. */ xReturn = xTaskCreate( prvIdleTask, ( signed char * ) "IDLE", tskIDLE_STACK_SIZE, ( void * ) NULL, ( tskIDLE_PRIORITY | portPRIVILEGE_BIT ), &xIdleTaskHandle ); /*lint !e961 MISRA exception, justified as it is not a redundant explicit cast to all supported compilers. */
printf("idle_task_hdl : %x\n", xIdleTaskHandle);
} }
#else #else
{ {
@ -1269,8 +1254,7 @@ printf("idle_task_hdl : %x\n", xIdleTaskHandle);
STEPPING THROUGH HERE USING A DEBUGGER CAN CAUSE BIG PROBLEMS IF THE STEPPING THROUGH HERE USING A DEBUGGER CAN CAUSE BIG PROBLEMS IF THE
DEBUGGER ALLOWS INTERRUPTS TO BE PROCESSED. */ DEBUGGER ALLOWS INTERRUPTS TO BE PROCESSED. */
//portDISABLE_INTERRUPTS(); portDISABLE_INTERRUPTS();
PortDisableInt_NoNest();
xSchedulerRunning = pdTRUE; xSchedulerRunning = pdTRUE;
xTickCount = ( portTickType ) 0U; xTickCount = ( portTickType ) 0U;
@ -1302,22 +1286,18 @@ PortDisableInt_NoNest();
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
void ICACHE_FLASH_ATTR void vTaskEndScheduler( void )
vTaskEndScheduler( void )
{ {
/* Stop the scheduler interrupts and call the portable scheduler end /* Stop the scheduler interrupts and call the portable scheduler end
routine so the original ISRs can be restored if necessary. The port routine so the original ISRs can be restored if necessary. The port
layer must ensure interrupts enable bit is left in the correct state. */ layer must ensure interrupts enable bit is left in the correct state. */
portDISABLE_INTERRUPTS();
//portDISABLE_INTERRUPTS();
PortDisableInt_NoNest();
xSchedulerRunning = pdFALSE; xSchedulerRunning = pdFALSE;
vPortEndScheduler(); vPortEndScheduler();
} }
/*----------------------------------------------------------*/ /*----------------------------------------------------------*/
void ICACHE_FLASH_ATTR void vTaskSuspendAll( void )
vTaskSuspendAll( void )
{ {
/* A critical section is not required as the variable is of type /* A critical section is not required as the variable is of type
portBASE_TYPE. */ portBASE_TYPE. */
@ -1327,8 +1307,7 @@ vTaskSuspendAll( void )
#if ( configUSE_TICKLESS_IDLE != 0 ) #if ( configUSE_TICKLESS_IDLE != 0 )
static portTickType ICACHE_FLASH_ATTR static portTickType prvGetExpectedIdleTime( void )
prvGetExpectedIdleTime( void )
{ {
portTickType xReturn; portTickType xReturn;
@ -1354,8 +1333,7 @@ vTaskSuspendAll( void )
#endif /* configUSE_TICKLESS_IDLE */ #endif /* configUSE_TICKLESS_IDLE */
/*----------------------------------------------------------*/ /*----------------------------------------------------------*/
signed portBASE_TYPE ICACHE_FLASH_ATTR signed portBASE_TYPE xTaskResumeAll( void )
xTaskResumeAll( void )
{ {
tskTCB *pxTCB; tskTCB *pxTCB;
portBASE_TYPE xAlreadyYielded = pdFALSE; portBASE_TYPE xAlreadyYielded = pdFALSE;
@ -1425,8 +1403,7 @@ portBASE_TYPE xYieldRequired = pdFALSE;
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
portTickType ICACHE_FLASH_ATTR portTickType xTaskGetTickCount( void )
xTaskGetTickCount( void )
{ {
portTickType xTicks; portTickType xTicks;
@ -1441,8 +1418,7 @@ portTickType xTicks;
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
portTickType portTickType xTaskGetTickCountFromISR( void )
xTaskGetTickCountFromISR( void )
{ {
portTickType xReturn; portTickType xReturn;
unsigned portBASE_TYPE uxSavedInterruptStatus; unsigned portBASE_TYPE uxSavedInterruptStatus;
@ -1463,9 +1439,7 @@ unsigned portBASE_TYPE uxSavedInterruptStatus;
link: http://www.freertos.org/RTOS-Cortex-M3-M4.html */ link: http://www.freertos.org/RTOS-Cortex-M3-M4.html */
portASSERT_IF_INTERRUPT_PRIORITY_INVALID(); portASSERT_IF_INTERRUPT_PRIORITY_INVALID();
// uxSavedInterruptStatus = portSET_INTERRUPT_MASK_FROM_ISR(); uxSavedInterruptStatus = portSET_INTERRUPT_MASK_FROM_ISR();
portSET_INTERRUPT_MASK_FROM_ISR();
xReturn = xTickCount; xReturn = xTickCount;
portCLEAR_INTERRUPT_MASK_FROM_ISR( uxSavedInterruptStatus ); portCLEAR_INTERRUPT_MASK_FROM_ISR( uxSavedInterruptStatus );
@ -1473,8 +1447,7 @@ unsigned portBASE_TYPE uxSavedInterruptStatus;
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
unsigned portBASE_TYPE ICACHE_FLASH_ATTR unsigned portBASE_TYPE uxTaskGetNumberOfTasks( void )
uxTaskGetNumberOfTasks( void )
{ {
/* A critical section is not required because the variables are of type /* A critical section is not required because the variables are of type
portBASE_TYPE. */ portBASE_TYPE. */
@ -1484,8 +1457,7 @@ uxTaskGetNumberOfTasks( void )
#if ( INCLUDE_pcTaskGetTaskName == 1 ) #if ( INCLUDE_pcTaskGetTaskName == 1 )
signed char * ICACHE_FLASH_ATTR signed char *pcTaskGetTaskName( xTaskHandle xTaskToQuery )
pcTaskGetTaskName( xTaskHandle xTaskToQuery )
{ {
tskTCB *pxTCB; tskTCB *pxTCB;
@ -1500,8 +1472,7 @@ uxTaskGetNumberOfTasks( void )
#if ( configUSE_TRACE_FACILITY == 1 ) #if ( configUSE_TRACE_FACILITY == 1 )
unsigned portBASE_TYPE ICACHE_FLASH_ATTR unsigned portBASE_TYPE uxTaskGetSystemState( xTaskStatusType *pxTaskStatusArray, unsigned portBASE_TYPE uxArraySize, unsigned long *pulTotalRunTime )
uxTaskGetSystemState( xTaskStatusType *pxTaskStatusArray, unsigned portBASE_TYPE uxArraySize, unsigned long *pulTotalRunTime )
{ {
unsigned portBASE_TYPE uxTask = 0, uxQueue = configMAX_PRIORITIES; unsigned portBASE_TYPE uxTask = 0, uxQueue = configMAX_PRIORITIES;
@ -1567,8 +1538,7 @@ uxTaskGetNumberOfTasks( void )
#if ( INCLUDE_xTaskGetIdleTaskHandle == 1 ) #if ( INCLUDE_xTaskGetIdleTaskHandle == 1 )
xTaskHandle ICACHE_FLASH_ATTR xTaskHandle xTaskGetIdleTaskHandle( void )
xTaskGetIdleTaskHandle( void )
{ {
/* If xTaskGetIdleTaskHandle() is called before the scheduler has been /* If xTaskGetIdleTaskHandle() is called before the scheduler has been
started, then xIdleTaskHandle will be NULL. */ started, then xIdleTaskHandle will be NULL. */
@ -1585,8 +1555,7 @@ implementations require configUSE_TICKLESS_IDLE to be set to a value other than
1. */ 1. */
#if ( configUSE_TICKLESS_IDLE != 0 ) #if ( configUSE_TICKLESS_IDLE != 0 )
void ICACHE_FLASH_ATTR void vTaskStepTick( portTickType xTicksToJump )
vTaskStepTick( portTickType xTicksToJump )
{ {
/* Correct the tick count value after a period during which the tick /* Correct the tick count value after a period during which the tick
was suppressed. Note this does *not* call the tick hook function for was suppressed. Note this does *not* call the tick hook function for
@ -1599,8 +1568,7 @@ implementations require configUSE_TICKLESS_IDLE to be set to a value other than
#endif /* configUSE_TICKLESS_IDLE */ #endif /* configUSE_TICKLESS_IDLE */
/*----------------------------------------------------------*/ /*----------------------------------------------------------*/
portBASE_TYPE portBASE_TYPE xTaskIncrementTick( void )
xTaskIncrementTick( void )
{ {
tskTCB * pxTCB; tskTCB * pxTCB;
portTickType xItemValue; portTickType xItemValue;
@ -1737,8 +1705,7 @@ portBASE_TYPE xSwitchRequired = pdFALSE;
#if ( configUSE_APPLICATION_TASK_TAG == 1 ) #if ( configUSE_APPLICATION_TASK_TAG == 1 )
void ICACHE_FLASH_ATTR void vTaskSetApplicationTaskTag( xTaskHandle xTask, pdTASK_HOOK_CODE pxHookFunction )
vTaskSetApplicationTaskTag( xTaskHandle xTask, pdTASK_HOOK_CODE pxHookFunction )
{ {
tskTCB *xTCB; tskTCB *xTCB;
@ -1764,8 +1731,7 @@ portBASE_TYPE xSwitchRequired = pdFALSE;
#if ( configUSE_APPLICATION_TASK_TAG == 1 ) #if ( configUSE_APPLICATION_TASK_TAG == 1 )
pdTASK_HOOK_CODE ICACHE_FLASH_ATTR pdTASK_HOOK_CODE xTaskGetApplicationTaskTag( xTaskHandle xTask )
xTaskGetApplicationTaskTag( xTaskHandle xTask )
{ {
tskTCB *xTCB; tskTCB *xTCB;
pdTASK_HOOK_CODE xReturn; pdTASK_HOOK_CODE xReturn;
@ -1794,8 +1760,7 @@ portBASE_TYPE xSwitchRequired = pdFALSE;
#if ( configUSE_APPLICATION_TASK_TAG == 1 ) #if ( configUSE_APPLICATION_TASK_TAG == 1 )
portBASE_TYPE ICACHE_FLASH_ATTR portBASE_TYPE xTaskCallApplicationTaskHook( xTaskHandle xTask, void *pvParameter )
xTaskCallApplicationTaskHook( xTaskHandle xTask, void *pvParameter )
{ {
tskTCB *xTCB; tskTCB *xTCB;
portBASE_TYPE xReturn; portBASE_TYPE xReturn;
@ -1825,8 +1790,7 @@ portBASE_TYPE xSwitchRequired = pdFALSE;
#endif /* configUSE_APPLICATION_TASK_TAG */ #endif /* configUSE_APPLICATION_TASK_TAG */
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
void void vTaskSwitchContext( void )
vTaskSwitchContext( void )
{ {
if( uxSchedulerSuspended != ( unsigned portBASE_TYPE ) pdFALSE ) if( uxSchedulerSuspended != ( unsigned portBASE_TYPE ) pdFALSE )
{ {
@ -1879,8 +1843,7 @@ vTaskSwitchContext( void )
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
void ICACHE_FLASH_ATTR void vTaskPlaceOnEventList( xList * const pxEventList, portTickType xTicksToWait )
vTaskPlaceOnEventList( xList * const pxEventList, portTickType xTicksToWait )
{ {
portTickType xTimeToWake; portTickType xTimeToWake;
@ -1934,8 +1897,7 @@ portTickType xTimeToWake;
#if configUSE_TIMERS == 1 #if configUSE_TIMERS == 1
void ICACHE_FLASH_ATTR void vTaskPlaceOnEventListRestricted( xList * const pxEventList, portTickType xTicksToWait )
vTaskPlaceOnEventListRestricted( xList * const pxEventList, portTickType xTicksToWait )
{ {
portTickType xTimeToWake; portTickType xTimeToWake;
@ -1974,8 +1936,7 @@ portTickType xTimeToWake;
#endif /* configUSE_TIMERS */ #endif /* configUSE_TIMERS */
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
signed portBASE_TYPE signed portBASE_TYPE xTaskRemoveFromEventList( const xList * const pxEventList )
xTaskRemoveFromEventList( const xList * const pxEventList )
{ {
tskTCB *pxUnblockedTCB; tskTCB *pxUnblockedTCB;
portBASE_TYPE xReturn; portBASE_TYPE xReturn;
@ -2026,8 +1987,7 @@ portBASE_TYPE xReturn;
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
void ICACHE_FLASH_ATTR void vTaskSetTimeOutState( xTimeOutType * const pxTimeOut )
vTaskSetTimeOutState( xTimeOutType * const pxTimeOut )
{ {
configASSERT( pxTimeOut ); configASSERT( pxTimeOut );
pxTimeOut->xOverflowCount = xNumOfOverflows; pxTimeOut->xOverflowCount = xNumOfOverflows;
@ -2035,8 +1995,7 @@ vTaskSetTimeOutState( xTimeOutType * const pxTimeOut )
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
portBASE_TYPE ICACHE_FLASH_ATTR portBASE_TYPE xTaskCheckForTimeOut( xTimeOutType * const pxTimeOut, portTickType * const pxTicksToWait )
xTaskCheckForTimeOut( xTimeOutType * const pxTimeOut, portTickType * const pxTicksToWait )
{ {
portBASE_TYPE xReturn; portBASE_TYPE xReturn;
@ -2085,8 +2044,7 @@ portBASE_TYPE xReturn;
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
void ICACHE_FLASH_ATTR void vTaskMissedYield( void )
vTaskMissedYield( void )
{ {
xYieldPending = pdTRUE; xYieldPending = pdTRUE;
} }
@ -2094,8 +2052,7 @@ vTaskMissedYield( void )
#if ( configUSE_TRACE_FACILITY == 1 ) #if ( configUSE_TRACE_FACILITY == 1 )
unsigned portBASE_TYPE ICACHE_FLASH_ATTR unsigned portBASE_TYPE uxTaskGetTaskNumber( xTaskHandle xTask )
uxTaskGetTaskNumber( xTaskHandle xTask )
{ {
unsigned portBASE_TYPE uxReturn; unsigned portBASE_TYPE uxReturn;
tskTCB *pxTCB; tskTCB *pxTCB;
@ -2118,8 +2075,7 @@ vTaskMissedYield( void )
#if ( configUSE_TRACE_FACILITY == 1 ) #if ( configUSE_TRACE_FACILITY == 1 )
void ICACHE_FLASH_ATTR void vTaskSetTaskNumber( xTaskHandle xTask, unsigned portBASE_TYPE uxHandle )
vTaskSetTaskNumber( xTaskHandle xTask, unsigned portBASE_TYPE uxHandle )
{ {
tskTCB *pxTCB; tskTCB *pxTCB;
@ -2143,8 +2099,7 @@ vTaskMissedYield( void )
* void prvIdleTask( void *pvParameters ); * void prvIdleTask( void *pvParameters );
* *
*/ */
static ICACHE_FLASH_ATTR static portTASK_FUNCTION( prvIdleTask, pvParameters )
portTASK_FUNCTION( prvIdleTask, pvParameters )
{ {
/* Stop warnings. */ /* Stop warnings. */
( void ) pvParameters; ( void ) pvParameters;
@ -2237,8 +2192,7 @@ portTASK_FUNCTION( prvIdleTask, pvParameters )
#if configUSE_TICKLESS_IDLE != 0 #if configUSE_TICKLESS_IDLE != 0
eSleepModeStatus ICACHE_FLASH_ATTR eSleepModeStatus eTaskConfirmSleepModeStatus( void )
eTaskConfirmSleepModeStatus( void )
{ {
eSleepModeStatus eReturn = eStandardSleep; eSleepModeStatus eReturn = eStandardSleep;
@ -2276,8 +2230,7 @@ portTASK_FUNCTION( prvIdleTask, pvParameters )
#endif /* configUSE_TICKLESS_IDLE */ #endif /* configUSE_TICKLESS_IDLE */
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
static void ICACHE_FLASH_ATTR static void prvInitialiseTCBVariables( tskTCB *pxTCB, const signed char * const pcName, unsigned portBASE_TYPE uxPriority, const xMemoryRegion * const xRegions, unsigned short usStackDepth )
prvInitialiseTCBVariables( tskTCB *pxTCB, const signed char * const pcName, unsigned portBASE_TYPE uxPriority, const xMemoryRegion * const xRegions, unsigned short usStackDepth )
{ {
unsigned portBASE_TYPE x; unsigned portBASE_TYPE x;
@ -2364,8 +2317,7 @@ unsigned portBASE_TYPE x;
#if ( portUSING_MPU_WRAPPERS == 1 ) #if ( portUSING_MPU_WRAPPERS == 1 )
void ICACHE_FLASH_ATTR void vTaskAllocateMPURegions( xTaskHandle xTaskToModify, const xMemoryRegion * const xRegions )
vTaskAllocateMPURegions( xTaskHandle xTaskToModify, const xMemoryRegion * const xRegions )
{ {
tskTCB *pxTCB; tskTCB *pxTCB;
@ -2378,8 +2330,7 @@ unsigned portBASE_TYPE x;
#endif /* portUSING_MPU_WRAPPERS */ #endif /* portUSING_MPU_WRAPPERS */
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
static void ICACHE_FLASH_ATTR static void prvInitialiseTaskLists( void )
prvInitialiseTaskLists( void )
{ {
unsigned portBASE_TYPE uxPriority; unsigned portBASE_TYPE uxPriority;
@ -2411,8 +2362,7 @@ unsigned portBASE_TYPE uxPriority;
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
static void ICACHE_FLASH_ATTR static void prvCheckTasksWaitingTermination( void )
prvCheckTasksWaitingTermination( void )
{ {
#if ( INCLUDE_vTaskDelete == 1 ) #if ( INCLUDE_vTaskDelete == 1 )
{ {
@ -2447,8 +2397,7 @@ prvCheckTasksWaitingTermination( void )
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
static void ICACHE_FLASH_ATTR static void prvAddCurrentTaskToDelayedList( portTickType xTimeToWake )
prvAddCurrentTaskToDelayedList( portTickType xTimeToWake )
{ {
/* The list item will be inserted in wake time order. */ /* The list item will be inserted in wake time order. */
listSET_LIST_ITEM_VALUE( &( pxCurrentTCB->xGenericListItem ), xTimeToWake ); listSET_LIST_ITEM_VALUE( &( pxCurrentTCB->xGenericListItem ), xTimeToWake );
@ -2474,8 +2423,7 @@ prvAddCurrentTaskToDelayedList( portTickType xTimeToWake )
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
static tskTCB * ICACHE_FLASH_ATTR static tskTCB *prvAllocateTCBAndStack( unsigned short usStackDepth, portSTACK_TYPE *puxStackBuffer )
prvAllocateTCBAndStack( unsigned short usStackDepth, portSTACK_TYPE *puxStackBuffer )
{ {
tskTCB *pxNewTCB; tskTCB *pxNewTCB;
@ -2489,6 +2437,7 @@ tskTCB *pxNewTCB;
The base of the stack memory stored in the TCB so the task can The base of the stack memory stored in the TCB so the task can
be deleted later if required. */ be deleted later if required. */
pxNewTCB->pxStack = ( portSTACK_TYPE * ) pvPortMallocAligned( ( ( ( size_t ) usStackDepth ) * sizeof( portSTACK_TYPE ) ), puxStackBuffer ); /*lint !e961 MISRA exception as the casts are only redundant for some ports. */ pxNewTCB->pxStack = ( portSTACK_TYPE * ) pvPortMallocAligned( ( ( ( size_t ) usStackDepth ) * sizeof( portSTACK_TYPE ) ), puxStackBuffer ); /*lint !e961 MISRA exception as the casts are only redundant for some ports. */
if( pxNewTCB->pxStack == NULL ) if( pxNewTCB->pxStack == NULL )
{ {
/* Could not allocate the stack. Delete the allocated TCB. */ /* Could not allocate the stack. Delete the allocated TCB. */
@ -2508,8 +2457,7 @@ tskTCB *pxNewTCB;
#if ( configUSE_TRACE_FACILITY == 1 ) #if ( configUSE_TRACE_FACILITY == 1 )
static unsigned portBASE_TYPE ICACHE_FLASH_ATTR static unsigned portBASE_TYPE prvListTaskWithinSingleList( xTaskStatusType *pxTaskStatusArray, xList *pxList, eTaskState eState )
prvListTaskWithinSingleList( xTaskStatusType *pxTaskStatusArray, xList *pxList, eTaskState eState )
{ {
volatile tskTCB *pxNextTCB, *pxFirstTCB; volatile tskTCB *pxNextTCB, *pxFirstTCB;
unsigned portBASE_TYPE uxTask = 0; unsigned portBASE_TYPE uxTask = 0;
@ -2575,8 +2523,7 @@ tskTCB *pxNewTCB;
#if ( ( configUSE_TRACE_FACILITY == 1 ) || ( INCLUDE_uxTaskGetStackHighWaterMark == 1 ) ) #if ( ( configUSE_TRACE_FACILITY == 1 ) || ( INCLUDE_uxTaskGetStackHighWaterMark == 1 ) )
static unsigned short ICACHE_FLASH_ATTR static unsigned short prvTaskCheckFreeStackSpace( const unsigned char * pucStackByte )
prvTaskCheckFreeStackSpace( const unsigned char * pucStackByte )
{ {
register unsigned short usCount = 0U; register unsigned short usCount = 0U;
@ -2596,8 +2543,7 @@ tskTCB *pxNewTCB;
#if ( INCLUDE_uxTaskGetStackHighWaterMark == 1 ) #if ( INCLUDE_uxTaskGetStackHighWaterMark == 1 )
unsigned portBASE_TYPE ICACHE_FLASH_ATTR unsigned portBASE_TYPE uxTaskGetStackHighWaterMark( xTaskHandle xTask )
uxTaskGetStackHighWaterMark( xTaskHandle xTask )
{ {
tskTCB *pxTCB; tskTCB *pxTCB;
unsigned char *pcEndOfStack; unsigned char *pcEndOfStack;
@ -2625,8 +2571,7 @@ tskTCB *pxNewTCB;
#if ( INCLUDE_vTaskDelete == 1 ) #if ( INCLUDE_vTaskDelete == 1 )
static void ICACHE_FLASH_ATTR static void prvDeleteTCB( tskTCB *pxTCB )
prvDeleteTCB( tskTCB *pxTCB )
{ {
/* This call is required specifically for the TriCore port. It must be /* This call is required specifically for the TriCore port. It must be
above the vPortFree() calls. The call is also used by ports/demos that above the vPortFree() calls. The call is also used by ports/demos that
@ -2644,8 +2589,7 @@ tskTCB *pxNewTCB;
#if ( ( INCLUDE_xTaskGetCurrentTaskHandle == 1 ) || ( configUSE_MUTEXES == 1 ) ) #if ( ( INCLUDE_xTaskGetCurrentTaskHandle == 1 ) || ( configUSE_MUTEXES == 1 ) )
xTaskHandle ICACHE_FLASH_ATTR xTaskHandle xTaskGetCurrentTaskHandle( void )
xTaskGetCurrentTaskHandle( void )
{ {
xTaskHandle xReturn; xTaskHandle xReturn;
@ -2662,8 +2606,7 @@ tskTCB *pxNewTCB;
#if ( ( INCLUDE_xTaskGetSchedulerState == 1 ) || ( configUSE_TIMERS == 1 ) ) #if ( ( INCLUDE_xTaskGetSchedulerState == 1 ) || ( configUSE_TIMERS == 1 ) )
portBASE_TYPE ICACHE_FLASH_ATTR portBASE_TYPE xTaskGetSchedulerState( void )
xTaskGetSchedulerState( void )
{ {
portBASE_TYPE xReturn; portBASE_TYPE xReturn;
@ -2691,8 +2634,7 @@ tskTCB *pxNewTCB;
#if ( configUSE_MUTEXES == 1 ) #if ( configUSE_MUTEXES == 1 )
void ICACHE_FLASH_ATTR void vTaskPriorityInherit( xTaskHandle const pxMutexHolder )
vTaskPriorityInherit( xTaskHandle const pxMutexHolder )
{ {
tskTCB * const pxTCB = ( tskTCB * ) pxMutexHolder; tskTCB * const pxTCB = ( tskTCB * ) pxMutexHolder;
@ -2734,8 +2676,7 @@ tskTCB *pxNewTCB;
#if ( configUSE_MUTEXES == 1 ) #if ( configUSE_MUTEXES == 1 )
void void vTaskPriorityDisinherit( xTaskHandle const pxMutexHolder )
vTaskPriorityDisinherit( xTaskHandle const pxMutexHolder )
{ {
tskTCB * const pxTCB = ( tskTCB * ) pxMutexHolder; tskTCB * const pxTCB = ( tskTCB * ) pxMutexHolder;
@ -2765,11 +2706,10 @@ tskTCB *pxNewTCB;
#if ( portCRITICAL_NESTING_IN_TCB == 1 ) #if ( portCRITICAL_NESTING_IN_TCB == 1 )
void ICACHE_FLASH_ATTR void vTaskEnterCritical( void )
vTaskEnterCritical( void )
{ {
//portDISABLE_INTERRUPTS(); portDISABLE_INTERRUPTS();
PortDisableInt_NoNest();
if( xSchedulerRunning != pdFALSE ) if( xSchedulerRunning != pdFALSE )
{ {
( pxCurrentTCB->uxCriticalNesting )++; ( pxCurrentTCB->uxCriticalNesting )++;
@ -2781,8 +2721,7 @@ PortDisableInt_NoNest();
#if ( portCRITICAL_NESTING_IN_TCB == 1 ) #if ( portCRITICAL_NESTING_IN_TCB == 1 )
void ICACHE_FLASH_ATTR void vTaskExitCritical( void )
vTaskExitCritical( void )
{ {
if( xSchedulerRunning != pdFALSE ) if( xSchedulerRunning != pdFALSE )
{ {
@ -2792,8 +2731,7 @@ PortDisableInt_NoNest();
if( pxCurrentTCB->uxCriticalNesting == 0U ) if( pxCurrentTCB->uxCriticalNesting == 0U )
{ {
//portENABLE_INTERRUPTS(); portENABLE_INTERRUPTS();
PortEnableInt_NoNest();
} }
} }
} }
@ -2804,8 +2742,7 @@ PortDisableInt_NoNest();
#if ( ( configUSE_TRACE_FACILITY == 1 ) && ( configUSE_STATS_FORMATTING_FUNCTIONS == 1 ) ) #if ( ( configUSE_TRACE_FACILITY == 1 ) && ( configUSE_STATS_FORMATTING_FUNCTIONS == 1 ) )
void ICACHE_FLASH_ATTR void vTaskList( signed char *pcWriteBuffer )
vTaskList( signed char *pcWriteBuffer )
{ {
xTaskStatusType *pxTaskStatusArray; xTaskStatusType *pxTaskStatusArray;
volatile unsigned portBASE_TYPE uxArraySize, x; volatile unsigned portBASE_TYPE uxArraySize, x;
@ -2888,8 +2825,7 @@ PortDisableInt_NoNest();
#if ( ( configGENERATE_RUN_TIME_STATS == 1 ) && ( configUSE_STATS_FORMATTING_FUNCTIONS == 1 ) ) #if ( ( configGENERATE_RUN_TIME_STATS == 1 ) && ( configUSE_STATS_FORMATTING_FUNCTIONS == 1 ) )
void ICACHE_FLASH_ATTR void vTaskGetRunTimeStats( signed char *pcWriteBuffer )
vTaskGetRunTimeStats( signed char *pcWriteBuffer )
{ {
xTaskStatusType *pxTaskStatusArray; xTaskStatusType *pxTaskStatusArray;
volatile unsigned portBASE_TYPE uxArraySize, x; volatile unsigned portBASE_TYPE uxArraySize, x;

View file

@ -194,8 +194,7 @@ static void prvProcessTimerOrBlockTask( portTickType xNextExpireTime, portBASE_T
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
portBASE_TYPE ICACHE_FLASH_ATTR portBASE_TYPE xTimerCreateTimerTask( void )
xTimerCreateTimerTask( void )
{ {
portBASE_TYPE xReturn = pdFAIL; portBASE_TYPE xReturn = pdFAIL;
@ -212,7 +211,6 @@ portBASE_TYPE xReturn = pdFAIL;
/* Create the timer task, storing its handle in xTimerTaskHandle so /* Create the timer task, storing its handle in xTimerTaskHandle so
it can be returned by the xTimerGetTimerDaemonTaskHandle() function. */ it can be returned by the xTimerGetTimerDaemonTaskHandle() function. */
xReturn = xTaskCreate( prvTimerTask, ( const signed char * ) "Tmr Svc", ( unsigned short ) configTIMER_TASK_STACK_DEPTH, NULL, ( ( unsigned portBASE_TYPE ) configTIMER_TASK_PRIORITY ) | portPRIVILEGE_BIT, &xTimerTaskHandle ); xReturn = xTaskCreate( prvTimerTask, ( const signed char * ) "Tmr Svc", ( unsigned short ) configTIMER_TASK_STACK_DEPTH, NULL, ( ( unsigned portBASE_TYPE ) configTIMER_TASK_PRIORITY ) | portPRIVILEGE_BIT, &xTimerTaskHandle );
printf("tim_task_hdl : %x\n", xTimerTaskHandle);
} }
#else #else
{ {
@ -227,8 +225,7 @@ printf("tim_task_hdl : %x\n", xTimerTaskHandle);
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
xTimerHandle ICACHE_FLASH_ATTR xTimerHandle xTimerCreate( const signed char * const pcTimerName, portTickType xTimerPeriodInTicks, unsigned portBASE_TYPE uxAutoReload, void *pvTimerID, tmrTIMER_CALLBACK pxCallbackFunction )
xTimerCreate( const signed char * const pcTimerName, portTickType xTimerPeriodInTicks, unsigned portBASE_TYPE uxAutoReload, void *pvTimerID, tmrTIMER_CALLBACK pxCallbackFunction )
{ {
xTIMER *pxNewTimer; xTIMER *pxNewTimer;
@ -267,8 +264,7 @@ xTIMER *pxNewTimer;
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
portBASE_TYPE ICACHE_FLASH_ATTR portBASE_TYPE xTimerGenericCommand( xTimerHandle xTimer, portBASE_TYPE xCommandID, portTickType xOptionalValue, signed portBASE_TYPE *pxHigherPriorityTaskWoken, portTickType xBlockTime )
xTimerGenericCommand( xTimerHandle xTimer, portBASE_TYPE xCommandID, portTickType xOptionalValue, signed portBASE_TYPE *pxHigherPriorityTaskWoken, portTickType xBlockTime )
{ {
portBASE_TYPE xReturn = pdFAIL; portBASE_TYPE xReturn = pdFAIL;
xTIMER_MESSAGE xMessage; xTIMER_MESSAGE xMessage;
@ -307,8 +303,7 @@ xTIMER_MESSAGE xMessage;
#if ( INCLUDE_xTimerGetTimerDaemonTaskHandle == 1 ) #if ( INCLUDE_xTimerGetTimerDaemonTaskHandle == 1 )
xTaskHandle ICACHE_FLASH_ATTR xTaskHandle xTimerGetTimerDaemonTaskHandle( void )
xTimerGetTimerDaemonTaskHandle( void )
{ {
/* If xTimerGetTimerDaemonTaskHandle() is called before the scheduler has been /* If xTimerGetTimerDaemonTaskHandle() is called before the scheduler has been
started, then xTimerTaskHandle will be NULL. */ started, then xTimerTaskHandle will be NULL. */
@ -319,8 +314,7 @@ xTIMER_MESSAGE xMessage;
#endif #endif
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
static void ICACHE_FLASH_ATTR static void prvProcessExpiredTimer( portTickType xNextExpireTime, portTickType xTimeNow )
prvProcessExpiredTimer( portTickType xNextExpireTime, portTickType xTimeNow )
{ {
xTIMER *pxTimer; xTIMER *pxTimer;
portBASE_TYPE xResult; portBASE_TYPE xResult;
@ -352,14 +346,11 @@ portBASE_TYPE xResult;
} }
/* Call the timer callback. */ /* Call the timer callback. */
//pxTimer->pxCallbackFunction( ( xTimerHandle ) pxTimer ); pxTimer->pxCallbackFunction( ( xTimerHandle ) pxTimer );
pxTimer->pxCallbackFunction( ( void * ) (pxTimer->pvTimerID) );
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
static void ICACHE_FLASH_ATTR static void prvTimerTask( void *pvParameters )
prvTimerTask( void *pvParameters )
{ {
portTickType xNextExpireTime; portTickType xNextExpireTime;
portBASE_TYPE xListWasEmpty; portBASE_TYPE xListWasEmpty;
@ -383,8 +374,7 @@ portBASE_TYPE xListWasEmpty;
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
static void ICACHE_FLASH_ATTR static void prvProcessTimerOrBlockTask( portTickType xNextExpireTime, portBASE_TYPE xListWasEmpty )
prvProcessTimerOrBlockTask( portTickType xNextExpireTime, portBASE_TYPE xListWasEmpty )
{ {
portTickType xTimeNow; portTickType xTimeNow;
portBASE_TYPE xTimerListsWereSwitched; portBASE_TYPE xTimerListsWereSwitched;
@ -433,8 +423,7 @@ portBASE_TYPE xTimerListsWereSwitched;
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
static portTickType ICACHE_FLASH_ATTR static portTickType prvGetNextExpireTime( portBASE_TYPE *pxListWasEmpty )
prvGetNextExpireTime( portBASE_TYPE *pxListWasEmpty )
{ {
portTickType xNextExpireTime; portTickType xNextExpireTime;
@ -460,8 +449,7 @@ portTickType xNextExpireTime;
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
static portTickType ICACHE_FLASH_ATTR static portTickType prvSampleTimeNow( portBASE_TYPE *pxTimerListsWereSwitched )
prvSampleTimeNow( portBASE_TYPE *pxTimerListsWereSwitched )
{ {
portTickType xTimeNow; portTickType xTimeNow;
PRIVILEGED_DATA static portTickType xLastTime = ( portTickType ) 0U; /*lint !e956 Variable is only accessible to one task. */ PRIVILEGED_DATA static portTickType xLastTime = ( portTickType ) 0U; /*lint !e956 Variable is only accessible to one task. */
@ -484,8 +472,7 @@ PRIVILEGED_DATA static portTickType xLastTime = ( portTickType ) 0U; /*lint !e95
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
static portBASE_TYPE ICACHE_FLASH_ATTR static portBASE_TYPE prvInsertTimerInActiveList( xTIMER *pxTimer, portTickType xNextExpiryTime, portTickType xTimeNow, portTickType xCommandTime )
prvInsertTimerInActiveList( xTIMER *pxTimer, portTickType xNextExpiryTime, portTickType xTimeNow, portTickType xCommandTime )
{ {
portBASE_TYPE xProcessTimerNow = pdFALSE; portBASE_TYPE xProcessTimerNow = pdFALSE;
@ -526,8 +513,7 @@ portBASE_TYPE xProcessTimerNow = pdFALSE;
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
static void ICACHE_FLASH_ATTR static void prvProcessReceivedCommands( void )
prvProcessReceivedCommands( void )
{ {
xTIMER_MESSAGE xMessage; xTIMER_MESSAGE xMessage;
xTIMER *pxTimer; xTIMER *pxTimer;
@ -562,8 +548,7 @@ portTickType xTimeNow;
{ {
/* The timer expired before it was added to the active timer /* The timer expired before it was added to the active timer
list. Process it now. */ list. Process it now. */
//pxTimer->pxCallbackFunction( ( xTimerHandle ) pxTimer ); pxTimer->pxCallbackFunction( ( xTimerHandle ) pxTimer );
pxTimer->pxCallbackFunction( ( void * ) (pxTimer->pvTimerID) );
if( pxTimer->uxAutoReload == ( unsigned portBASE_TYPE ) pdTRUE ) if( pxTimer->uxAutoReload == ( unsigned portBASE_TYPE ) pdTRUE )
{ {
@ -599,8 +584,7 @@ portTickType xTimeNow;
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
static void ICACHE_FLASH_ATTR static void prvSwitchTimerLists( portTickType xLastTime )
prvSwitchTimerLists( portTickType xLastTime )
{ {
portTickType xNextExpireTime, xReloadTime; portTickType xNextExpireTime, xReloadTime;
xList *pxTemp; xList *pxTemp;
@ -625,8 +609,7 @@ portBASE_TYPE xResult;
/* Execute its callback, then send a command to restart the timer if /* Execute its callback, then send a command to restart the timer if
it is an auto-reload timer. It cannot be restarted here as the lists it is an auto-reload timer. It cannot be restarted here as the lists
have not yet been switched. */ have not yet been switched. */
//pxTimer->pxCallbackFunction( ( xTimerHandle ) pxTimer ); pxTimer->pxCallbackFunction( ( xTimerHandle ) pxTimer );
pxTimer->pxCallbackFunction( ( void * ) (pxTimer->pvTimerID) );
if( pxTimer->uxAutoReload == ( unsigned portBASE_TYPE ) pdTRUE ) if( pxTimer->uxAutoReload == ( unsigned portBASE_TYPE ) pdTRUE )
{ {
@ -658,8 +641,7 @@ portBASE_TYPE xResult;
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
static void ICACHE_FLASH_ATTR static void prvCheckForValidListAndQueue( void )
prvCheckForValidListAndQueue( void )
{ {
/* 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
@ -679,8 +661,7 @@ prvCheckForValidListAndQueue( void )
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
portBASE_TYPE ICACHE_FLASH_ATTR portBASE_TYPE xTimerIsTimerActive( xTimerHandle xTimer )
xTimerIsTimerActive( xTimerHandle xTimer )
{ {
portBASE_TYPE xTimerIsInActiveList; portBASE_TYPE xTimerIsInActiveList;
xTIMER *pxTimer = ( xTIMER * ) xTimer; xTIMER *pxTimer = ( xTIMER * ) xTimer;
@ -699,8 +680,7 @@ xTIMER *pxTimer = ( xTIMER * ) xTimer;
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
void * ICACHE_FLASH_ATTR void *pvTimerGetTimerID( xTimerHandle xTimer )
pvTimerGetTimerID( xTimerHandle xTimer )
{ {
xTIMER *pxTimer = ( xTIMER * ) xTimer; xTIMER *pxTimer = ( xTIMER * ) xTimer;
@ -711,5 +691,7 @@ xTIMER *pxTimer = ( xTIMER * ) xTimer;
/* This entire source file will be skipped if the application is not configured /* This entire source file will be skipped if the application is not configured
to include software timer functionality. If you want to include software timer to include software timer functionality. If you want to include software timer
functionality then ensure configUSE_TIMERS is set to 1 in FreeRTOSConfig.h. */ functionality then ensure configUSE_TIMERS is set to 1 in FreeRTOSConfig.h. */
#endif /* configUSE_TIMERS == 1 */ #endif /* configUSE_TIMERS == 1 */