diff --git a/FreeRTOS/Source/croutine.c b/FreeRTOS/Source/croutine.c index ac63661..b95ff45 100644 --- a/FreeRTOS/Source/croutine.c +++ b/FreeRTOS/Source/croutine.c @@ -238,14 +238,12 @@ static void prvCheckPendingReadyList( void ) corCRCB *pxUnblockedCRCB; /* The pending ready list can be accessed by an ISR. */ - //portDISABLE_INTERRUPTS(); -PortDisableInt_NoNest(); + portDISABLE_INTERRUPTS(); { pxUnblockedCRCB = ( corCRCB * ) listGET_OWNER_OF_HEAD_ENTRY( (&xPendingReadyCoRoutineList) ); ( void ) uxListRemove( &( pxUnblockedCRCB->xEventListItem ) ); } -// portENABLE_INTERRUPTS(); -PortEnableInt_NoNest(); + portENABLE_INTERRUPTS(); ( void ) uxListRemove( &( pxUnblockedCRCB->xGenericListItem ) ); prvAddCoRoutineToReadyQueue( pxUnblockedCRCB ); @@ -286,8 +284,7 @@ corCRCB *pxCRCB; break; } - //portDISABLE_INTERRUPTS(); -PortDisableInt_NoNest(); + portDISABLE_INTERRUPTS(); { /* The event could have occurred just before this critical section. If this is the case then the generic list item will @@ -302,8 +299,7 @@ PortDisableInt_NoNest(); ( void ) uxListRemove( &( pxCRCB->xEventListItem ) ); } } -// portENABLE_INTERRUPTS(); -PortEnableInt_NoNest(); + portENABLE_INTERRUPTS(); prvAddCoRoutineToReadyQueue( pxCRCB ); } diff --git a/FreeRTOS/Source/list.c b/FreeRTOS/Source/list.c index d5e0113..f16d6c5 100644 --- a/FreeRTOS/Source/list.c +++ b/FreeRTOS/Source/list.c @@ -71,8 +71,7 @@ * PUBLIC LIST API documented in list.h *----------------------------------------------------------*/ -void ICACHE_FLASH_ATTR -vListInitialise( xList * const pxList ) +void vListInitialise( xList * const pxList ) { /* 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 @@ -92,16 +91,14 @@ vListInitialise( xList * const pxList ) } /*-----------------------------------------------------------*/ -void ICACHE_FLASH_ATTR -vListInitialiseItem( xListItem * const pxItem ) +void vListInitialiseItem( xListItem * const pxItem ) { /* Make sure the list item is not recorded as being on a list. */ pxItem->pvContainer = NULL; } /*-----------------------------------------------------------*/ -void -vListInsertEnd( xList * const pxList, xListItem * const pxNewListItem ) +void vListInsertEnd( xList * const pxList, xListItem * const pxNewListItem ) { xListItem * pxIndex; @@ -122,8 +119,7 @@ xListItem * pxIndex; } /*-----------------------------------------------------------*/ -void ICACHE_FLASH_ATTR -vListInsert( xList * const pxList, xListItem * const pxNewListItem ) +void vListInsert( xList * const pxList, xListItem * const pxNewListItem ) { xListItem *pxIterator; portTickType xValueOfInsertion; @@ -181,8 +177,7 @@ portTickType xValueOfInsertion; } /*-----------------------------------------------------------*/ -unsigned portBASE_TYPE -uxListRemove( xListItem * const pxItemToRemove ) +unsigned portBASE_TYPE uxListRemove( xListItem * const pxItemToRemove ) { xList * pxList; diff --git a/FreeRTOS/Source/queue.c b/FreeRTOS/Source/queue.c index 0b75ade..0a7b76e 100644 --- a/FreeRTOS/Source/queue.c +++ b/FreeRTOS/Source/queue.c @@ -75,7 +75,7 @@ task.h is included from an application file. */ #include "queue.h" #if ( configUSE_CO_ROUTINES == 1 ) - #include "freertos/croutine.h" + #include "croutine.h" #endif /* 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() /*-----------------------------------------------------------*/ - -portBASE_TYPE ICACHE_FLASH_ATTR -xQueueGenericReset( xQueueHandle xQueue, portBASE_TYPE xNewQueue ) +portBASE_TYPE xQueueGenericReset( xQueueHandle xQueue, portBASE_TYPE xNewQueue ) { xQUEUE * const pxQueue = ( xQUEUE * ) xQueue; @@ -281,8 +279,7 @@ xQUEUE * const pxQueue = ( xQUEUE * ) xQueue; } /*-----------------------------------------------------------*/ -xQueueHandle ICACHE_FLASH_ATTR -xQueueGenericCreate( unsigned portBASE_TYPE uxQueueLength, unsigned portBASE_TYPE uxItemSize, unsigned char ucQueueType ) +xQueueHandle xQueueGenericCreate( unsigned portBASE_TYPE uxQueueLength, unsigned portBASE_TYPE uxItemSize, unsigned char ucQueueType ) { xQUEUE *pxNewQueue; size_t xQueueSizeInBytes; @@ -341,9 +338,7 @@ xQueueHandle xReturn = NULL; /*-----------------------------------------------------------*/ #if ( configUSE_MUTEXES == 1 ) - - xQueueHandle ICACHE_FLASH_ATTR - xQueueCreateMutex( unsigned char ucQueueType ) + xQueueHandle xQueueCreateMutex( unsigned char ucQueueType ) { xQUEUE *pxNewQueue; @@ -407,9 +402,7 @@ xQueueHandle xReturn = NULL; /*-----------------------------------------------------------*/ #if ( ( configUSE_MUTEXES == 1 ) && ( INCLUDE_xSemaphoreGetMutexHolder == 1 ) ) - - void* ICACHE_FLASH_ATTR - xQueueGetMutexHolder( xQueueHandle xSemaphore ) + void* xQueueGetMutexHolder( xQueueHandle xSemaphore ) { void *pxReturn; @@ -438,9 +431,7 @@ xQueueHandle xReturn = NULL; /*-----------------------------------------------------------*/ #if ( configUSE_RECURSIVE_MUTEXES == 1 ) - - portBASE_TYPE ICACHE_FLASH_ATTR - xQueueGiveMutexRecursive( xQueueHandle xMutex ) + portBASE_TYPE xQueueGiveMutexRecursive( xQueueHandle xMutex ) { portBASE_TYPE xReturn; xQUEUE * const pxMutex = ( xQUEUE * ) xMutex; @@ -489,9 +480,7 @@ xQueueHandle xReturn = NULL; /*-----------------------------------------------------------*/ #if ( configUSE_RECURSIVE_MUTEXES == 1 ) - - portBASE_TYPE ICACHE_FLASH_ATTR - xQueueTakeMutexRecursive( xQueueHandle xMutex, portTickType xBlockTime ) + portBASE_TYPE xQueueTakeMutexRecursive( xQueueHandle xMutex, portTickType xBlockTime ) { portBASE_TYPE xReturn; xQUEUE * const pxMutex = ( xQUEUE * ) xMutex; @@ -531,9 +520,7 @@ xQueueHandle xReturn = NULL; /*-----------------------------------------------------------*/ #if ( configUSE_COUNTING_SEMAPHORES == 1 ) - - xQueueHandle ICACHE_FLASH_ATTR - xQueueCreateCountingSemaphore( unsigned portBASE_TYPE uxCountValue, unsigned portBASE_TYPE uxInitialCount ) + xQueueHandle xQueueCreateCountingSemaphore( unsigned portBASE_TYPE uxCountValue, unsigned portBASE_TYPE uxInitialCount ) { xQueueHandle xHandle; @@ -556,9 +543,7 @@ xQueueHandle xReturn = NULL; #endif /* configUSE_COUNTING_SEMAPHORES */ /*-----------------------------------------------------------*/ - -signed portBASE_TYPE ICACHE_FLASH_ATTR -xQueueGenericSend( xQueueHandle xQueue, const void * const pvItemToQueue, portTickType xTicksToWait, portBASE_TYPE xCopyPosition ) +signed portBASE_TYPE xQueueGenericSend( xQueueHandle xQueue, const void * const pvItemToQueue, portTickType xTicksToWait, portBASE_TYPE xCopyPosition ) { signed portBASE_TYPE xEntryTimeSet = pdFALSE; xTimeOutType xTimeOut; @@ -719,9 +704,7 @@ xQUEUE * const pxQueue = ( xQUEUE * ) xQueue; /*-----------------------------------------------------------*/ #if ( configUSE_ALTERNATIVE_API == 1 ) - - signed portBASE_TYPE ICACHE_FLASH_ATTR - xQueueAltGenericSend( xQueueHandle xQueue, const void * const pvItemToQueue, portTickType xTicksToWait, portBASE_TYPE xCopyPosition ) + signed portBASE_TYPE xQueueAltGenericSend( xQueueHandle xQueue, const void * const pvItemToQueue, portTickType xTicksToWait, portBASE_TYPE xCopyPosition ) { signed portBASE_TYPE xEntryTimeSet = pdFALSE; xTimeOutType xTimeOut; @@ -798,9 +781,7 @@ xQUEUE * const pxQueue = ( xQUEUE * ) xQueue; /*-----------------------------------------------------------*/ #if ( configUSE_ALTERNATIVE_API == 1 ) - - signed portBASE_TYPE ICACHE_FLASH_ATTR - xQueueAltGenericReceive( xQueueHandle xQueue, void * const pvBuffer, portTickType xTicksToWait, portBASE_TYPE xJustPeeking ) + signed portBASE_TYPE xQueueAltGenericReceive( xQueueHandle xQueue, void * const pvBuffer, portTickType xTicksToWait, portBASE_TYPE xJustPeeking ) { signed portBASE_TYPE xEntryTimeSet = pdFALSE; xTimeOutType xTimeOut; @@ -929,9 +910,7 @@ xQUEUE * const pxQueue = ( xQUEUE * ) xQueue; #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; 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 required or not (i.e. has a task with a higher priority than us been woken by this post). */ -// uxSavedInterruptStatus = portSET_INTERRUPT_MASK_FROM_ISR(); - portSET_INTERRUPT_MASK_FROM_ISR(); - + uxSavedInterruptStatus = portSET_INTERRUPT_MASK_FROM_ISR(); { if( ( pxQueue->uxMessagesWaiting < pxQueue->uxLength ) || ( xCopyPosition == queueOVERWRITE ) ) { @@ -1044,9 +1021,7 @@ xQUEUE * const pxQueue = ( xQUEUE * ) xQueue; return xReturn; } /*-----------------------------------------------------------*/ - -signed portBASE_TYPE ICACHE_FLASH_ATTR -xQueueGenericReceive( xQueueHandle xQueue, const void * const pvBuffer, portTickType xTicksToWait, portBASE_TYPE xJustPeeking ) +signed portBASE_TYPE xQueueGenericReceive( xQueueHandle xQueue, const void * const pvBuffer, portTickType xTicksToWait, portBASE_TYPE xJustPeeking ) { signed portBASE_TYPE xEntryTimeSet = pdFALSE; 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; unsigned portBASE_TYPE uxSavedInterruptStatus; @@ -1227,9 +1200,7 @@ xQUEUE * const pxQueue = ( xQUEUE * ) xQueue; link: http://www.freertos.org/RTOS-Cortex-M3-M4.html */ portASSERT_IF_INTERRUPT_PRIORITY_INVALID(); -// uxSavedInterruptStatus = portSET_INTERRUPT_MASK_FROM_ISR(); - portSET_INTERRUPT_MASK_FROM_ISR(); - + uxSavedInterruptStatus = portSET_INTERRUPT_MASK_FROM_ISR(); { /* Cannot block in an ISR, so check there is data available. */ if( pxQueue->uxMessagesWaiting > ( unsigned portBASE_TYPE ) 0 ) @@ -1278,9 +1249,7 @@ xQUEUE * const pxQueue = ( xQUEUE * ) xQueue; 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; unsigned portBASE_TYPE uxSavedInterruptStatus; @@ -1306,9 +1275,7 @@ xQUEUE * const pxQueue = ( xQUEUE * ) xQueue; link: http://www.freertos.org/RTOS-Cortex-M3-M4.html */ portASSERT_IF_INTERRUPT_PRIORITY_INVALID(); -// uxSavedInterruptStatus = portSET_INTERRUPT_MASK_FROM_ISR(); - portSET_INTERRUPT_MASK_FROM_ISR(); - + uxSavedInterruptStatus = portSET_INTERRUPT_MASK_FROM_ISR(); { /* Cannot block in an ISR, so check there is data available. */ if( pxQueue->uxMessagesWaiting > ( unsigned portBASE_TYPE ) 0 ) @@ -1335,8 +1302,7 @@ xQUEUE * const pxQueue = ( xQUEUE * ) xQueue; } /*-----------------------------------------------------------*/ -unsigned portBASE_TYPE ICACHE_FLASH_ATTR -uxQueueMessagesWaiting( const xQueueHandle xQueue ) +unsigned portBASE_TYPE uxQueueMessagesWaiting( const xQueueHandle xQueue ) { 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. */ /*-----------------------------------------------------------*/ -unsigned portBASE_TYPE -uxQueueMessagesWaitingFromISR( const xQueueHandle xQueue ) +unsigned portBASE_TYPE uxQueueMessagesWaitingFromISR( const xQueueHandle xQueue ) { 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. */ /*-----------------------------------------------------------*/ -void ICACHE_FLASH_ATTR -vQueueDelete( xQueueHandle xQueue ) +void vQueueDelete( xQueueHandle xQueue ) { xQUEUE * const pxQueue = ( xQUEUE * ) xQueue; @@ -1383,8 +1347,7 @@ xQUEUE * const pxQueue = ( xQUEUE * ) xQueue; #if ( configUSE_TRACE_FACILITY == 1 ) - unsigned char ICACHE_FLASH_ATTR - ucQueueGetQueueNumber( xQueueHandle xQueue ) + unsigned char ucQueueGetQueueNumber( xQueueHandle xQueue ) { return ( ( xQUEUE * ) xQueue )->ucQueueNumber; } @@ -1394,8 +1357,7 @@ xQUEUE * const pxQueue = ( xQUEUE * ) xQueue; #if ( configUSE_TRACE_FACILITY == 1 ) - void ICACHE_FLASH_ATTR - vQueueSetQueueNumber( xQueueHandle xQueue, unsigned char ucQueueNumber ) + void vQueueSetQueueNumber( xQueueHandle xQueue, unsigned char ucQueueNumber ) { ( ( xQUEUE * ) xQueue )->ucQueueNumber = ucQueueNumber; } @@ -1405,17 +1367,14 @@ xQUEUE * const pxQueue = ( xQUEUE * ) xQueue; #if ( configUSE_TRACE_FACILITY == 1 ) - unsigned char ICACHE_FLASH_ATTR - ucQueueGetQueueType( xQueueHandle xQueue ) + unsigned char ucQueueGetQueueType( xQueueHandle xQueue ) { return ( ( xQUEUE * ) xQueue )->ucQueueType; } #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 ) { @@ -1464,9 +1423,7 @@ prvCopyDataToQueue( xQUEUE *pxQueue, const void *pvItemToQueue, portBASE_TYPE xP ++( 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 ) { @@ -1479,9 +1436,7 @@ prvCopyDataFromQueue( xQUEUE * const pxQueue, const void * const pvBuffer ) } } /*-----------------------------------------------------------*/ - -static void ICACHE_FLASH_ATTR -prvUnlockQueue( xQUEUE *pxQueue ) +static void prvUnlockQueue( xQUEUE *pxQueue ) { /* THIS FUNCTION MUST BE CALLED WITH THE SCHEDULER SUSPENDED. */ @@ -1579,9 +1534,7 @@ prvUnlockQueue( xQUEUE *pxQueue ) taskEXIT_CRITICAL(); } /*-----------------------------------------------------------*/ - -static signed portBASE_TYPE ICACHE_FLASH_ATTR -prvIsQueueEmpty( const xQUEUE *pxQueue ) +static signed portBASE_TYPE prvIsQueueEmpty( const xQUEUE *pxQueue ) { signed portBASE_TYPE xReturn; @@ -1601,9 +1554,7 @@ signed portBASE_TYPE xReturn; return xReturn; } /*-----------------------------------------------------------*/ - -signed portBASE_TYPE -xQueueIsQueueEmptyFromISR( const xQueueHandle xQueue ) +signed portBASE_TYPE xQueueIsQueueEmptyFromISR( const xQueueHandle xQueue ) { signed portBASE_TYPE xReturn; @@ -1620,9 +1571,7 @@ signed portBASE_TYPE xReturn; return xReturn; } /*lint !e818 xQueue could not be pointer to const because it is a typedef. */ /*-----------------------------------------------------------*/ - -static signed portBASE_TYPE ICACHE_FLASH_ATTR -prvIsQueueFull( const xQUEUE *pxQueue ) +static signed portBASE_TYPE prvIsQueueFull( const xQUEUE *pxQueue ) { signed portBASE_TYPE xReturn; @@ -1642,9 +1591,7 @@ signed portBASE_TYPE xReturn; return xReturn; } /*-----------------------------------------------------------*/ - -signed portBASE_TYPE -xQueueIsQueueFullFromISR( const xQueueHandle xQueue ) +signed portBASE_TYPE xQueueIsQueueFullFromISR( const xQueueHandle xQueue ) { signed portBASE_TYPE xReturn; @@ -1663,9 +1610,7 @@ signed portBASE_TYPE xReturn; /*-----------------------------------------------------------*/ #if ( configUSE_CO_ROUTINES == 1 ) - - signed portBASE_TYPE ICACHE_FLASH_ATTR - xQueueCRSend( xQueueHandle xQueue, const void *pvItemToQueue, portTickType xTicksToWait ) + signed portBASE_TYPE xQueueCRSend( xQueueHandle xQueue, const void *pvItemToQueue, portTickType xTicksToWait ) { signed portBASE_TYPE xReturn; 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 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. */ - - //portDISABLE_INTERRUPTS(); -PortDisableInt_NoNest(); + portDISABLE_INTERRUPTS(); { if( prvIsQueueFull( pxQueue ) != pdFALSE ) { @@ -1686,23 +1629,19 @@ PortDisableInt_NoNest(); /* As this is called from a coroutine we cannot block directly, but return indicating that we need to block. */ vCoRoutineAddToDelayedList( xTicksToWait, &( pxQueue->xTasksWaitingToSend ) ); - //portENABLE_INTERRUPTS(); -PortEnableInt_NoNest(); + portENABLE_INTERRUPTS(); return errQUEUE_BLOCKED; } else { - //portENABLE_INTERRUPTS(); -PortEnableInt_NoNest(); + portENABLE_INTERRUPTS(); return errQUEUE_FULL; } } } - //portENABLE_INTERRUPTS(); -PortEnableInt_NoNest(); + portENABLE_INTERRUPTS(); - //portDISABLE_INTERRUPTS(); -PortDisableInt_NoNest(); + portDISABLE_INTERRUPTS(); { if( pxQueue->uxMessagesWaiting < pxQueue->uxLength ) { @@ -1730,8 +1669,8 @@ PortDisableInt_NoNest(); xReturn = errQUEUE_FULL; } } - //portENABLE_INTERRUPTS(); -PortEnableInt_NoNest(); + portENABLE_INTERRUPTS(); + return xReturn; } @@ -1739,9 +1678,7 @@ PortEnableInt_NoNest(); /*-----------------------------------------------------------*/ #if ( configUSE_CO_ROUTINES == 1 ) - - signed portBASE_TYPE ICACHE_FLASH_ATTR - xQueueCRReceive( xQueueHandle xQueue, void *pvBuffer, portTickType xTicksToWait ) + signed portBASE_TYPE xQueueCRReceive( xQueueHandle xQueue, void *pvBuffer, portTickType xTicksToWait ) { signed portBASE_TYPE xReturn; 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 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. */ - - //portDISABLE_INTERRUPTS(); -PortDisableInt_NoNest(); + portDISABLE_INTERRUPTS(); { 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 indicating that we need to block. */ vCoRoutineAddToDelayedList( xTicksToWait, &( pxQueue->xTasksWaitingToReceive ) ); - //portENABLE_INTERRUPTS(); -PortEnableInt_NoNest(); + portENABLE_INTERRUPTS(); return errQUEUE_BLOCKED; } else { - //portENABLE_INTERRUPTS(); -PortEnableInt_NoNest(); + portENABLE_INTERRUPTS(); return errQUEUE_FULL; } } } - //portENABLE_INTERRUPTS(); -PortEnableInt_NoNest(); + portENABLE_INTERRUPTS(); - //portDISABLE_INTERRUPTS(); -PortDisableInt_NoNest(); + portDISABLE_INTERRUPTS(); { if( pxQueue->uxMessagesWaiting > ( unsigned portBASE_TYPE ) 0 ) { @@ -1811,8 +1742,7 @@ PortDisableInt_NoNest(); xReturn = pdFAIL; } } - //portENABLE_INTERRUPTS(); -PortEnableInt_NoNest(); + portENABLE_INTERRUPTS(); return xReturn; } @@ -1821,9 +1751,7 @@ PortEnableInt_NoNest(); /*-----------------------------------------------------------*/ #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; @@ -1855,8 +1783,7 @@ PortEnableInt_NoNest(); #if ( configUSE_CO_ROUTINES == 1 ) - signed portBASE_TYPE - xQueueCRReceiveFromISR( xQueueHandle xQueue, void *pvBuffer, signed portBASE_TYPE *pxCoRoutineWoken ) + signed portBASE_TYPE xQueueCRReceiveFromISR( xQueueHandle xQueue, void *pvBuffer, signed portBASE_TYPE *pxCoRoutineWoken ) { signed portBASE_TYPE xReturn; xQUEUE * const pxQueue = ( xQUEUE * ) xQueue; @@ -1900,8 +1827,7 @@ PortEnableInt_NoNest(); #if ( configQUEUE_REGISTRY_SIZE > 0 ) - void ICACHE_FLASH_ATTR - vQueueAddToRegistry( xQueueHandle xQueue, signed char *pcQueueName ) + void vQueueAddToRegistry( xQueueHandle xQueue, signed char *pcQueueName ) { unsigned portBASE_TYPE ux; @@ -1924,8 +1850,7 @@ PortEnableInt_NoNest(); #if ( configQUEUE_REGISTRY_SIZE > 0 ) - void ICACHE_FLASH_ATTR - vQueueUnregisterQueue( xQueueHandle xQueue ) + void vQueueUnregisterQueue( xQueueHandle xQueue ) { unsigned portBASE_TYPE ux; @@ -1948,8 +1873,7 @@ PortEnableInt_NoNest(); #if ( configUSE_TIMERS == 1 ) - void ICACHE_FLASH_ATTR - vQueueWaitForMessageRestricted( xQueueHandle xQueue, portTickType xTicksToWait ) + void vQueueWaitForMessageRestricted( xQueueHandle xQueue, portTickType xTicksToWait ) { xQUEUE * const pxQueue = ( xQUEUE * ) xQueue; @@ -1981,8 +1905,7 @@ PortEnableInt_NoNest(); #if ( configUSE_QUEUE_SETS == 1 ) - xQueueSetHandle ICACHE_FLASH_ATTR - xQueueCreateSet( unsigned portBASE_TYPE uxEventQueueLength ) + xQueueSetHandle xQueueCreateSet( unsigned portBASE_TYPE uxEventQueueLength ) { xQueueSetHandle pxQueue; @@ -1996,8 +1919,7 @@ PortEnableInt_NoNest(); #if ( configUSE_QUEUE_SETS == 1 ) - portBASE_TYPE ICACHE_FLASH_ATTR - xQueueAddToSet( xQueueSetMemberHandle xQueueOrSemaphore, xQueueSetHandle xQueueSet ) + portBASE_TYPE xQueueAddToSet( xQueueSetMemberHandle xQueueOrSemaphore, xQueueSetHandle xQueueSet ) { portBASE_TYPE xReturn; @@ -2030,8 +1952,7 @@ PortEnableInt_NoNest(); #if ( configUSE_QUEUE_SETS == 1 ) - portBASE_TYPE ICACHE_FLASH_ATTR - xQueueRemoveFromSet( xQueueSetMemberHandle xQueueOrSemaphore, xQueueSetHandle xQueueSet ) + portBASE_TYPE xQueueRemoveFromSet( xQueueSetMemberHandle xQueueOrSemaphore, xQueueSetHandle xQueueSet ) { portBASE_TYPE xReturn; xQUEUE * const pxQueueOrSemaphore = ( xQUEUE * ) xQueueOrSemaphore; @@ -2067,8 +1988,7 @@ PortEnableInt_NoNest(); #if ( configUSE_QUEUE_SETS == 1 ) - xQueueSetMemberHandle ICACHE_FLASH_ATTR - xQueueSelectFromSet( xQueueSetHandle xQueueSet, portTickType xBlockTimeTicks ) + xQueueSetMemberHandle xQueueSelectFromSet( xQueueSetHandle xQueueSet, portTickType xBlockTimeTicks ) { xQueueSetMemberHandle xReturn = NULL; @@ -2081,8 +2001,7 @@ PortEnableInt_NoNest(); #if ( configUSE_QUEUE_SETS == 1 ) - xQueueSetMemberHandle - xQueueSelectFromSetFromISR( xQueueSetHandle xQueueSet ) + xQueueSetMemberHandle xQueueSelectFromSetFromISR( xQueueSetHandle xQueueSet ) { xQueueSetMemberHandle xReturn = NULL; @@ -2095,8 +2014,7 @@ PortEnableInt_NoNest(); #if ( configUSE_QUEUE_SETS == 1 ) - static portBASE_TYPE ICACHE_FLASH_ATTR - prvNotifyQueueSetContainer( const xQUEUE * const pxQueue, portBASE_TYPE xCopyPosition ) + static portBASE_TYPE prvNotifyQueueSetContainer( const xQUEUE * const pxQueue, portBASE_TYPE xCopyPosition ) { xQUEUE *pxQueueSetContainer = pxQueue->pxQueueSetContainer; portBASE_TYPE xReturn = pdFALSE; diff --git a/FreeRTOS/Source/tasks.c b/FreeRTOS/Source/tasks.c index 5cd4966..64966d4 100644 --- a/FreeRTOS/Source/tasks.c +++ b/FreeRTOS/Source/tasks.c @@ -101,7 +101,7 @@ privileged Vs unprivileged linkage and placement. */ /* * 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, @@ -475,8 +475,7 @@ static tskTCB *prvAllocateTCBAndStack( unsigned short usStackDepth, portSTACK_TY #endif -signed portBASE_TYPE ICACHE_FLASH_ATTR -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 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; tskTCB * pxNewTCB; @@ -632,8 +631,7 @@ tskTCB * pxNewTCB; #if ( INCLUDE_vTaskDelete == 1 ) - void ICACHE_FLASH_ATTR - vTaskDelete( xTaskHandle xTaskToDelete ) + void vTaskDelete( xTaskHandle xTaskToDelete ) { tskTCB *pxTCB; @@ -687,8 +685,7 @@ tskTCB * pxNewTCB; #if ( INCLUDE_vTaskDelayUntil == 1 ) - void ICACHE_FLASH_ATTR - vTaskDelayUntil( portTickType * const pxPreviousWakeTime, portTickType xTimeIncrement ) + void vTaskDelayUntil( portTickType * const pxPreviousWakeTime, portTickType xTimeIncrement ) { portTickType xTimeToWake; portBASE_TYPE xAlreadyYielded, xShouldDelay = pdFALSE; @@ -764,8 +761,7 @@ tskTCB * pxNewTCB; #if ( INCLUDE_vTaskDelay == 1 ) - void ICACHE_FLASH_ATTR - vTaskDelay( portTickType xTicksToDelay ) + void vTaskDelay( portTickType xTicksToDelay ) { portTickType xTimeToWake; signed portBASE_TYPE xAlreadyYielded = pdFALSE; @@ -817,8 +813,7 @@ tskTCB * pxNewTCB; #if ( INCLUDE_eTaskGetState == 1 ) - eTaskState ICACHE_FLASH_ATTR - eTaskGetState( xTaskHandle xTask ) + eTaskState eTaskGetState( xTaskHandle xTask ) { eTaskState eReturn; xList *pxStateList; @@ -878,8 +873,7 @@ tskTCB * pxNewTCB; #if ( INCLUDE_uxTaskPriorityGet == 1 ) - unsigned portBASE_TYPE ICACHE_FLASH_ATTR - uxTaskPriorityGet( xTaskHandle xTask ) + unsigned portBASE_TYPE uxTaskPriorityGet( xTaskHandle xTask ) { tskTCB *pxTCB; unsigned portBASE_TYPE uxReturn; @@ -901,8 +895,7 @@ tskTCB * pxNewTCB; #if ( INCLUDE_vTaskPrioritySet == 1 ) - void ICACHE_FLASH_ATTR - vTaskPrioritySet( xTaskHandle xTask, unsigned portBASE_TYPE uxNewPriority ) + void vTaskPrioritySet( xTaskHandle xTask, unsigned portBASE_TYPE uxNewPriority ) { tskTCB *pxTCB; unsigned portBASE_TYPE uxCurrentBasePriority, uxPriorityUsedOnEntry; @@ -1033,8 +1026,7 @@ tskTCB * pxNewTCB; #if ( INCLUDE_vTaskSuspend == 1 ) - void ICACHE_FLASH_ATTR - vTaskSuspend( xTaskHandle xTaskToSuspend ) + void vTaskSuspend( xTaskHandle xTaskToSuspend ) { tskTCB *pxTCB; @@ -1095,8 +1087,7 @@ tskTCB * pxNewTCB; #if ( INCLUDE_vTaskSuspend == 1 ) - signed portBASE_TYPE ICACHE_FLASH_ATTR - xTaskIsTaskSuspended( xTaskHandle xTask ) + signed portBASE_TYPE xTaskIsTaskSuspended( xTaskHandle xTask ) { portBASE_TYPE xReturn = pdFALSE; const tskTCB * const pxTCB = ( tskTCB * ) xTask; @@ -1130,8 +1121,7 @@ tskTCB * pxNewTCB; #if ( INCLUDE_vTaskSuspend == 1 ) - void ICACHE_FLASH_ATTR - vTaskResume( xTaskHandle xTaskToResume ) + void vTaskResume( xTaskHandle xTaskToResume ) { tskTCB * const pxTCB = ( tskTCB * ) xTaskToResume; @@ -1172,8 +1162,7 @@ tskTCB * pxNewTCB; #if ( ( INCLUDE_xTaskResumeFromISR == 1 ) && ( INCLUDE_vTaskSuspend == 1 ) ) - portBASE_TYPE - xTaskResumeFromISR( xTaskHandle xTaskToResume ) + portBASE_TYPE xTaskResumeFromISR( xTaskHandle xTaskToResume ) { portBASE_TYPE xYieldRequired = pdFALSE; tskTCB * const pxTCB = ( tskTCB * ) xTaskToResume; @@ -1199,9 +1188,7 @@ tskTCB * pxNewTCB; http://www.freertos.org/RTOS-Cortex-M3-M4.html */ portASSERT_IF_INTERRUPT_PRIORITY_INVALID(); -// uxSavedInterruptStatus = portSET_INTERRUPT_MASK_FROM_ISR(); - portSET_INTERRUPT_MASK_FROM_ISR(); - + uxSavedInterruptStatus = portSET_INTERRUPT_MASK_FROM_ISR(); { if( xTaskIsTaskSuspended( pxTCB ) == pdTRUE ) { @@ -1230,8 +1217,7 @@ tskTCB * pxNewTCB; #endif /* ( ( INCLUDE_xTaskResumeFromISR == 1 ) && ( INCLUDE_vTaskSuspend == 1 ) ) */ /*-----------------------------------------------------------*/ -void ICACHE_FLASH_ATTR -vTaskStartScheduler( void ) +void vTaskStartScheduler( void ) { portBASE_TYPE xReturn; @@ -1241,7 +1227,6 @@ portBASE_TYPE xReturn; /* Create the idle task, storing its handle in xIdleTaskHandle so it can 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. */ -printf("idle_task_hdl : %x\n", xIdleTaskHandle); } #else { @@ -1269,8 +1254,7 @@ printf("idle_task_hdl : %x\n", xIdleTaskHandle); STEPPING THROUGH HERE USING A DEBUGGER CAN CAUSE BIG PROBLEMS IF THE DEBUGGER ALLOWS INTERRUPTS TO BE PROCESSED. */ - //portDISABLE_INTERRUPTS(); -PortDisableInt_NoNest(); + portDISABLE_INTERRUPTS(); xSchedulerRunning = pdTRUE; xTickCount = ( portTickType ) 0U; @@ -1302,22 +1286,18 @@ PortDisableInt_NoNest(); } /*-----------------------------------------------------------*/ -void ICACHE_FLASH_ATTR -vTaskEndScheduler( void ) +void vTaskEndScheduler( void ) { /* Stop the scheduler interrupts and call the portable scheduler end routine so the original ISRs can be restored if necessary. The port layer must ensure interrupts enable bit is left in the correct state. */ - - //portDISABLE_INTERRUPTS(); -PortDisableInt_NoNest(); + portDISABLE_INTERRUPTS(); xSchedulerRunning = pdFALSE; vPortEndScheduler(); } /*----------------------------------------------------------*/ -void ICACHE_FLASH_ATTR -vTaskSuspendAll( void ) +void vTaskSuspendAll( void ) { /* A critical section is not required as the variable is of type portBASE_TYPE. */ @@ -1327,8 +1307,7 @@ vTaskSuspendAll( void ) #if ( configUSE_TICKLESS_IDLE != 0 ) - static portTickType ICACHE_FLASH_ATTR - prvGetExpectedIdleTime( void ) + static portTickType prvGetExpectedIdleTime( void ) { portTickType xReturn; @@ -1354,8 +1333,7 @@ vTaskSuspendAll( void ) #endif /* configUSE_TICKLESS_IDLE */ /*----------------------------------------------------------*/ -signed portBASE_TYPE ICACHE_FLASH_ATTR -xTaskResumeAll( void ) +signed portBASE_TYPE xTaskResumeAll( void ) { tskTCB *pxTCB; portBASE_TYPE xAlreadyYielded = pdFALSE; @@ -1425,8 +1403,7 @@ portBASE_TYPE xYieldRequired = pdFALSE; } /*-----------------------------------------------------------*/ -portTickType ICACHE_FLASH_ATTR -xTaskGetTickCount( void ) +portTickType xTaskGetTickCount( void ) { portTickType xTicks; @@ -1441,8 +1418,7 @@ portTickType xTicks; } /*-----------------------------------------------------------*/ -portTickType -xTaskGetTickCountFromISR( void ) +portTickType xTaskGetTickCountFromISR( void ) { portTickType xReturn; unsigned portBASE_TYPE uxSavedInterruptStatus; @@ -1463,9 +1439,7 @@ unsigned portBASE_TYPE uxSavedInterruptStatus; link: http://www.freertos.org/RTOS-Cortex-M3-M4.html */ portASSERT_IF_INTERRUPT_PRIORITY_INVALID(); -// uxSavedInterruptStatus = portSET_INTERRUPT_MASK_FROM_ISR(); - portSET_INTERRUPT_MASK_FROM_ISR(); - + uxSavedInterruptStatus = portSET_INTERRUPT_MASK_FROM_ISR(); xReturn = xTickCount; portCLEAR_INTERRUPT_MASK_FROM_ISR( uxSavedInterruptStatus ); @@ -1473,8 +1447,7 @@ unsigned portBASE_TYPE uxSavedInterruptStatus; } /*-----------------------------------------------------------*/ -unsigned portBASE_TYPE ICACHE_FLASH_ATTR -uxTaskGetNumberOfTasks( void ) +unsigned portBASE_TYPE uxTaskGetNumberOfTasks( void ) { /* A critical section is not required because the variables are of type portBASE_TYPE. */ @@ -1484,8 +1457,7 @@ uxTaskGetNumberOfTasks( void ) #if ( INCLUDE_pcTaskGetTaskName == 1 ) - signed char * ICACHE_FLASH_ATTR - pcTaskGetTaskName( xTaskHandle xTaskToQuery ) + signed char *pcTaskGetTaskName( xTaskHandle xTaskToQuery ) { tskTCB *pxTCB; @@ -1500,8 +1472,7 @@ uxTaskGetNumberOfTasks( void ) #if ( configUSE_TRACE_FACILITY == 1 ) - unsigned portBASE_TYPE ICACHE_FLASH_ATTR - uxTaskGetSystemState( xTaskStatusType *pxTaskStatusArray, unsigned portBASE_TYPE uxArraySize, unsigned long *pulTotalRunTime ) + unsigned portBASE_TYPE uxTaskGetSystemState( xTaskStatusType *pxTaskStatusArray, unsigned portBASE_TYPE uxArraySize, unsigned long *pulTotalRunTime ) { unsigned portBASE_TYPE uxTask = 0, uxQueue = configMAX_PRIORITIES; @@ -1567,8 +1538,7 @@ uxTaskGetNumberOfTasks( void ) #if ( INCLUDE_xTaskGetIdleTaskHandle == 1 ) - xTaskHandle ICACHE_FLASH_ATTR - xTaskGetIdleTaskHandle( void ) + xTaskHandle xTaskGetIdleTaskHandle( void ) { /* If xTaskGetIdleTaskHandle() is called before the scheduler has been started, then xIdleTaskHandle will be NULL. */ @@ -1585,8 +1555,7 @@ implementations require configUSE_TICKLESS_IDLE to be set to a value other than 1. */ #if ( configUSE_TICKLESS_IDLE != 0 ) - void ICACHE_FLASH_ATTR - vTaskStepTick( portTickType xTicksToJump ) + void vTaskStepTick( portTickType xTicksToJump ) { /* Correct the tick count value after a period during which the tick 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 */ /*----------------------------------------------------------*/ -portBASE_TYPE -xTaskIncrementTick( void ) +portBASE_TYPE xTaskIncrementTick( void ) { tskTCB * pxTCB; portTickType xItemValue; @@ -1737,8 +1705,7 @@ portBASE_TYPE xSwitchRequired = pdFALSE; #if ( configUSE_APPLICATION_TASK_TAG == 1 ) - void ICACHE_FLASH_ATTR - vTaskSetApplicationTaskTag( xTaskHandle xTask, pdTASK_HOOK_CODE pxHookFunction ) + void vTaskSetApplicationTaskTag( xTaskHandle xTask, pdTASK_HOOK_CODE pxHookFunction ) { tskTCB *xTCB; @@ -1764,8 +1731,7 @@ portBASE_TYPE xSwitchRequired = pdFALSE; #if ( configUSE_APPLICATION_TASK_TAG == 1 ) - pdTASK_HOOK_CODE ICACHE_FLASH_ATTR - xTaskGetApplicationTaskTag( xTaskHandle xTask ) + pdTASK_HOOK_CODE xTaskGetApplicationTaskTag( xTaskHandle xTask ) { tskTCB *xTCB; pdTASK_HOOK_CODE xReturn; @@ -1794,8 +1760,7 @@ portBASE_TYPE xSwitchRequired = pdFALSE; #if ( configUSE_APPLICATION_TASK_TAG == 1 ) - portBASE_TYPE ICACHE_FLASH_ATTR - xTaskCallApplicationTaskHook( xTaskHandle xTask, void *pvParameter ) + portBASE_TYPE xTaskCallApplicationTaskHook( xTaskHandle xTask, void *pvParameter ) { tskTCB *xTCB; portBASE_TYPE xReturn; @@ -1825,8 +1790,7 @@ portBASE_TYPE xSwitchRequired = pdFALSE; #endif /* configUSE_APPLICATION_TASK_TAG */ /*-----------------------------------------------------------*/ -void -vTaskSwitchContext( void ) +void vTaskSwitchContext( void ) { if( uxSchedulerSuspended != ( unsigned portBASE_TYPE ) pdFALSE ) { @@ -1879,8 +1843,7 @@ vTaskSwitchContext( void ) } /*-----------------------------------------------------------*/ -void ICACHE_FLASH_ATTR -vTaskPlaceOnEventList( xList * const pxEventList, portTickType xTicksToWait ) +void vTaskPlaceOnEventList( xList * const pxEventList, portTickType xTicksToWait ) { portTickType xTimeToWake; @@ -1934,8 +1897,7 @@ portTickType xTimeToWake; #if configUSE_TIMERS == 1 - void ICACHE_FLASH_ATTR - vTaskPlaceOnEventListRestricted( xList * const pxEventList, portTickType xTicksToWait ) + void vTaskPlaceOnEventListRestricted( xList * const pxEventList, portTickType xTicksToWait ) { portTickType xTimeToWake; @@ -1974,8 +1936,7 @@ portTickType xTimeToWake; #endif /* configUSE_TIMERS */ /*-----------------------------------------------------------*/ -signed portBASE_TYPE -xTaskRemoveFromEventList( const xList * const pxEventList ) +signed portBASE_TYPE xTaskRemoveFromEventList( const xList * const pxEventList ) { tskTCB *pxUnblockedTCB; portBASE_TYPE xReturn; @@ -2026,8 +1987,7 @@ portBASE_TYPE xReturn; } /*-----------------------------------------------------------*/ -void ICACHE_FLASH_ATTR -vTaskSetTimeOutState( xTimeOutType * const pxTimeOut ) +void vTaskSetTimeOutState( xTimeOutType * const pxTimeOut ) { configASSERT( pxTimeOut ); pxTimeOut->xOverflowCount = xNumOfOverflows; @@ -2035,8 +1995,7 @@ vTaskSetTimeOutState( xTimeOutType * const pxTimeOut ) } /*-----------------------------------------------------------*/ -portBASE_TYPE ICACHE_FLASH_ATTR -xTaskCheckForTimeOut( xTimeOutType * const pxTimeOut, portTickType * const pxTicksToWait ) +portBASE_TYPE xTaskCheckForTimeOut( xTimeOutType * const pxTimeOut, portTickType * const pxTicksToWait ) { portBASE_TYPE xReturn; @@ -2085,8 +2044,7 @@ portBASE_TYPE xReturn; } /*-----------------------------------------------------------*/ -void ICACHE_FLASH_ATTR -vTaskMissedYield( void ) +void vTaskMissedYield( void ) { xYieldPending = pdTRUE; } @@ -2094,8 +2052,7 @@ vTaskMissedYield( void ) #if ( configUSE_TRACE_FACILITY == 1 ) - unsigned portBASE_TYPE ICACHE_FLASH_ATTR - uxTaskGetTaskNumber( xTaskHandle xTask ) + unsigned portBASE_TYPE uxTaskGetTaskNumber( xTaskHandle xTask ) { unsigned portBASE_TYPE uxReturn; tskTCB *pxTCB; @@ -2118,8 +2075,7 @@ vTaskMissedYield( void ) #if ( configUSE_TRACE_FACILITY == 1 ) - void ICACHE_FLASH_ATTR - vTaskSetTaskNumber( xTaskHandle xTask, unsigned portBASE_TYPE uxHandle ) + void vTaskSetTaskNumber( xTaskHandle xTask, unsigned portBASE_TYPE uxHandle ) { tskTCB *pxTCB; @@ -2143,8 +2099,7 @@ vTaskMissedYield( void ) * void prvIdleTask( void *pvParameters ); * */ -static ICACHE_FLASH_ATTR -portTASK_FUNCTION( prvIdleTask, pvParameters ) +static portTASK_FUNCTION( prvIdleTask, pvParameters ) { /* Stop warnings. */ ( void ) pvParameters; @@ -2237,8 +2192,7 @@ portTASK_FUNCTION( prvIdleTask, pvParameters ) #if configUSE_TICKLESS_IDLE != 0 - eSleepModeStatus ICACHE_FLASH_ATTR - eTaskConfirmSleepModeStatus( void ) + eSleepModeStatus eTaskConfirmSleepModeStatus( void ) { eSleepModeStatus eReturn = eStandardSleep; @@ -2276,8 +2230,7 @@ portTASK_FUNCTION( prvIdleTask, pvParameters ) #endif /* configUSE_TICKLESS_IDLE */ /*-----------------------------------------------------------*/ -static void ICACHE_FLASH_ATTR -prvInitialiseTCBVariables( tskTCB *pxTCB, const signed char * const pcName, unsigned portBASE_TYPE uxPriority, const xMemoryRegion * const xRegions, unsigned short usStackDepth ) +static void prvInitialiseTCBVariables( tskTCB *pxTCB, const signed char * const pcName, unsigned portBASE_TYPE uxPriority, const xMemoryRegion * const xRegions, unsigned short usStackDepth ) { unsigned portBASE_TYPE x; @@ -2364,8 +2317,7 @@ unsigned portBASE_TYPE x; #if ( portUSING_MPU_WRAPPERS == 1 ) - void ICACHE_FLASH_ATTR - vTaskAllocateMPURegions( xTaskHandle xTaskToModify, const xMemoryRegion * const xRegions ) + void vTaskAllocateMPURegions( xTaskHandle xTaskToModify, const xMemoryRegion * const xRegions ) { tskTCB *pxTCB; @@ -2378,8 +2330,7 @@ unsigned portBASE_TYPE x; #endif /* portUSING_MPU_WRAPPERS */ /*-----------------------------------------------------------*/ -static void ICACHE_FLASH_ATTR -prvInitialiseTaskLists( void ) +static void prvInitialiseTaskLists( void ) { unsigned portBASE_TYPE uxPriority; @@ -2411,8 +2362,7 @@ unsigned portBASE_TYPE uxPriority; } /*-----------------------------------------------------------*/ -static void ICACHE_FLASH_ATTR -prvCheckTasksWaitingTermination( void ) +static void prvCheckTasksWaitingTermination( void ) { #if ( INCLUDE_vTaskDelete == 1 ) { @@ -2447,8 +2397,7 @@ prvCheckTasksWaitingTermination( void ) } /*-----------------------------------------------------------*/ -static void ICACHE_FLASH_ATTR -prvAddCurrentTaskToDelayedList( portTickType xTimeToWake ) +static void prvAddCurrentTaskToDelayedList( portTickType xTimeToWake ) { /* The list item will be inserted in wake time order. */ listSET_LIST_ITEM_VALUE( &( pxCurrentTCB->xGenericListItem ), xTimeToWake ); @@ -2474,8 +2423,7 @@ prvAddCurrentTaskToDelayedList( portTickType xTimeToWake ) } /*-----------------------------------------------------------*/ -static tskTCB * ICACHE_FLASH_ATTR -prvAllocateTCBAndStack( unsigned short usStackDepth, portSTACK_TYPE *puxStackBuffer ) +static tskTCB *prvAllocateTCBAndStack( unsigned short usStackDepth, portSTACK_TYPE *puxStackBuffer ) { tskTCB *pxNewTCB; @@ -2489,6 +2437,7 @@ tskTCB *pxNewTCB; The base of the stack memory stored in the TCB so the task can 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. */ + if( pxNewTCB->pxStack == NULL ) { /* Could not allocate the stack. Delete the allocated TCB. */ @@ -2508,8 +2457,7 @@ tskTCB *pxNewTCB; #if ( configUSE_TRACE_FACILITY == 1 ) - static unsigned portBASE_TYPE ICACHE_FLASH_ATTR - prvListTaskWithinSingleList( xTaskStatusType *pxTaskStatusArray, xList *pxList, eTaskState eState ) + static unsigned portBASE_TYPE prvListTaskWithinSingleList( xTaskStatusType *pxTaskStatusArray, xList *pxList, eTaskState eState ) { volatile tskTCB *pxNextTCB, *pxFirstTCB; unsigned portBASE_TYPE uxTask = 0; @@ -2575,8 +2523,7 @@ tskTCB *pxNewTCB; #if ( ( configUSE_TRACE_FACILITY == 1 ) || ( INCLUDE_uxTaskGetStackHighWaterMark == 1 ) ) - static unsigned short ICACHE_FLASH_ATTR - prvTaskCheckFreeStackSpace( const unsigned char * pucStackByte ) + static unsigned short prvTaskCheckFreeStackSpace( const unsigned char * pucStackByte ) { register unsigned short usCount = 0U; @@ -2596,8 +2543,7 @@ tskTCB *pxNewTCB; #if ( INCLUDE_uxTaskGetStackHighWaterMark == 1 ) - unsigned portBASE_TYPE ICACHE_FLASH_ATTR - uxTaskGetStackHighWaterMark( xTaskHandle xTask ) + unsigned portBASE_TYPE uxTaskGetStackHighWaterMark( xTaskHandle xTask ) { tskTCB *pxTCB; unsigned char *pcEndOfStack; @@ -2625,8 +2571,7 @@ tskTCB *pxNewTCB; #if ( INCLUDE_vTaskDelete == 1 ) - static void ICACHE_FLASH_ATTR - prvDeleteTCB( tskTCB *pxTCB ) + static void prvDeleteTCB( tskTCB *pxTCB ) { /* 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 @@ -2644,8 +2589,7 @@ tskTCB *pxNewTCB; #if ( ( INCLUDE_xTaskGetCurrentTaskHandle == 1 ) || ( configUSE_MUTEXES == 1 ) ) - xTaskHandle ICACHE_FLASH_ATTR - xTaskGetCurrentTaskHandle( void ) + xTaskHandle xTaskGetCurrentTaskHandle( void ) { xTaskHandle xReturn; @@ -2662,8 +2606,7 @@ tskTCB *pxNewTCB; #if ( ( INCLUDE_xTaskGetSchedulerState == 1 ) || ( configUSE_TIMERS == 1 ) ) - portBASE_TYPE ICACHE_FLASH_ATTR - xTaskGetSchedulerState( void ) + portBASE_TYPE xTaskGetSchedulerState( void ) { portBASE_TYPE xReturn; @@ -2691,8 +2634,7 @@ tskTCB *pxNewTCB; #if ( configUSE_MUTEXES == 1 ) - void ICACHE_FLASH_ATTR - vTaskPriorityInherit( xTaskHandle const pxMutexHolder ) + void vTaskPriorityInherit( xTaskHandle const pxMutexHolder ) { tskTCB * const pxTCB = ( tskTCB * ) pxMutexHolder; @@ -2734,8 +2676,7 @@ tskTCB *pxNewTCB; #if ( configUSE_MUTEXES == 1 ) - void - vTaskPriorityDisinherit( xTaskHandle const pxMutexHolder ) + void vTaskPriorityDisinherit( xTaskHandle const pxMutexHolder ) { tskTCB * const pxTCB = ( tskTCB * ) pxMutexHolder; @@ -2765,11 +2706,10 @@ tskTCB *pxNewTCB; #if ( portCRITICAL_NESTING_IN_TCB == 1 ) - void ICACHE_FLASH_ATTR - vTaskEnterCritical( void ) + void vTaskEnterCritical( void ) { - //portDISABLE_INTERRUPTS(); -PortDisableInt_NoNest(); + portDISABLE_INTERRUPTS(); + if( xSchedulerRunning != pdFALSE ) { ( pxCurrentTCB->uxCriticalNesting )++; @@ -2781,8 +2721,7 @@ PortDisableInt_NoNest(); #if ( portCRITICAL_NESTING_IN_TCB == 1 ) - void ICACHE_FLASH_ATTR - vTaskExitCritical( void ) + void vTaskExitCritical( void ) { if( xSchedulerRunning != pdFALSE ) { @@ -2792,8 +2731,7 @@ PortDisableInt_NoNest(); if( pxCurrentTCB->uxCriticalNesting == 0U ) { - //portENABLE_INTERRUPTS(); - PortEnableInt_NoNest(); + portENABLE_INTERRUPTS(); } } } @@ -2804,8 +2742,7 @@ PortDisableInt_NoNest(); #if ( ( configUSE_TRACE_FACILITY == 1 ) && ( configUSE_STATS_FORMATTING_FUNCTIONS == 1 ) ) - void ICACHE_FLASH_ATTR - vTaskList( signed char *pcWriteBuffer ) + void vTaskList( signed char *pcWriteBuffer ) { xTaskStatusType *pxTaskStatusArray; volatile unsigned portBASE_TYPE uxArraySize, x; @@ -2888,8 +2825,7 @@ PortDisableInt_NoNest(); #if ( ( configGENERATE_RUN_TIME_STATS == 1 ) && ( configUSE_STATS_FORMATTING_FUNCTIONS == 1 ) ) - void ICACHE_FLASH_ATTR - vTaskGetRunTimeStats( signed char *pcWriteBuffer ) + void vTaskGetRunTimeStats( signed char *pcWriteBuffer ) { xTaskStatusType *pxTaskStatusArray; volatile unsigned portBASE_TYPE uxArraySize, x; diff --git a/FreeRTOS/Source/timers.c b/FreeRTOS/Source/timers.c index f23a957..783a461 100644 --- a/FreeRTOS/Source/timers.c +++ b/FreeRTOS/Source/timers.c @@ -194,8 +194,7 @@ static void prvProcessTimerOrBlockTask( portTickType xNextExpireTime, portBASE_T /*-----------------------------------------------------------*/ -portBASE_TYPE ICACHE_FLASH_ATTR -xTimerCreateTimerTask( void ) +portBASE_TYPE xTimerCreateTimerTask( void ) { portBASE_TYPE xReturn = pdFAIL; @@ -212,7 +211,6 @@ portBASE_TYPE xReturn = pdFAIL; /* Create the timer task, storing its handle in xTimerTaskHandle so 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 ); -printf("tim_task_hdl : %x\n", xTimerTaskHandle); } #else { @@ -227,8 +225,7 @@ printf("tim_task_hdl : %x\n", xTimerTaskHandle); } /*-----------------------------------------------------------*/ -xTimerHandle ICACHE_FLASH_ATTR -xTimerCreate( const signed char * const pcTimerName, portTickType xTimerPeriodInTicks, unsigned portBASE_TYPE uxAutoReload, void *pvTimerID, tmrTIMER_CALLBACK pxCallbackFunction ) +xTimerHandle xTimerCreate( const signed char * const pcTimerName, portTickType xTimerPeriodInTicks, unsigned portBASE_TYPE uxAutoReload, void *pvTimerID, tmrTIMER_CALLBACK pxCallbackFunction ) { xTIMER *pxNewTimer; @@ -267,8 +264,7 @@ xTIMER *pxNewTimer; } /*-----------------------------------------------------------*/ -portBASE_TYPE ICACHE_FLASH_ATTR -xTimerGenericCommand( xTimerHandle xTimer, portBASE_TYPE xCommandID, portTickType xOptionalValue, signed portBASE_TYPE *pxHigherPriorityTaskWoken, portTickType xBlockTime ) +portBASE_TYPE xTimerGenericCommand( xTimerHandle xTimer, portBASE_TYPE xCommandID, portTickType xOptionalValue, signed portBASE_TYPE *pxHigherPriorityTaskWoken, portTickType xBlockTime ) { portBASE_TYPE xReturn = pdFAIL; xTIMER_MESSAGE xMessage; @@ -307,8 +303,7 @@ xTIMER_MESSAGE xMessage; #if ( INCLUDE_xTimerGetTimerDaemonTaskHandle == 1 ) - xTaskHandle ICACHE_FLASH_ATTR - xTimerGetTimerDaemonTaskHandle( void ) + xTaskHandle xTimerGetTimerDaemonTaskHandle( void ) { /* If xTimerGetTimerDaemonTaskHandle() is called before the scheduler has been started, then xTimerTaskHandle will be NULL. */ @@ -319,8 +314,7 @@ xTIMER_MESSAGE xMessage; #endif /*-----------------------------------------------------------*/ -static void ICACHE_FLASH_ATTR -prvProcessExpiredTimer( portTickType xNextExpireTime, portTickType xTimeNow ) +static void prvProcessExpiredTimer( portTickType xNextExpireTime, portTickType xTimeNow ) { xTIMER *pxTimer; portBASE_TYPE xResult; @@ -352,14 +346,11 @@ portBASE_TYPE xResult; } /* Call the timer callback. */ - //pxTimer->pxCallbackFunction( ( xTimerHandle ) pxTimer ); - pxTimer->pxCallbackFunction( ( void * ) (pxTimer->pvTimerID) ); - + pxTimer->pxCallbackFunction( ( xTimerHandle ) pxTimer ); } /*-----------------------------------------------------------*/ -static void ICACHE_FLASH_ATTR -prvTimerTask( void *pvParameters ) +static void prvTimerTask( void *pvParameters ) { portTickType xNextExpireTime; portBASE_TYPE xListWasEmpty; @@ -383,8 +374,7 @@ portBASE_TYPE xListWasEmpty; } /*-----------------------------------------------------------*/ -static void ICACHE_FLASH_ATTR -prvProcessTimerOrBlockTask( portTickType xNextExpireTime, portBASE_TYPE xListWasEmpty ) +static void prvProcessTimerOrBlockTask( portTickType xNextExpireTime, portBASE_TYPE xListWasEmpty ) { portTickType xTimeNow; portBASE_TYPE xTimerListsWereSwitched; @@ -433,8 +423,7 @@ portBASE_TYPE xTimerListsWereSwitched; } /*-----------------------------------------------------------*/ -static portTickType ICACHE_FLASH_ATTR -prvGetNextExpireTime( portBASE_TYPE *pxListWasEmpty ) +static portTickType prvGetNextExpireTime( portBASE_TYPE *pxListWasEmpty ) { portTickType xNextExpireTime; @@ -460,8 +449,7 @@ portTickType xNextExpireTime; } /*-----------------------------------------------------------*/ -static portTickType ICACHE_FLASH_ATTR -prvSampleTimeNow( portBASE_TYPE *pxTimerListsWereSwitched ) +static portTickType prvSampleTimeNow( portBASE_TYPE *pxTimerListsWereSwitched ) { portTickType xTimeNow; 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 -prvInsertTimerInActiveList( xTIMER *pxTimer, portTickType xNextExpiryTime, portTickType xTimeNow, portTickType xCommandTime ) +static portBASE_TYPE prvInsertTimerInActiveList( xTIMER *pxTimer, portTickType xNextExpiryTime, portTickType xTimeNow, portTickType xCommandTime ) { portBASE_TYPE xProcessTimerNow = pdFALSE; @@ -526,8 +513,7 @@ portBASE_TYPE xProcessTimerNow = pdFALSE; } /*-----------------------------------------------------------*/ -static void ICACHE_FLASH_ATTR -prvProcessReceivedCommands( void ) +static void prvProcessReceivedCommands( void ) { xTIMER_MESSAGE xMessage; xTIMER *pxTimer; @@ -562,8 +548,7 @@ portTickType xTimeNow; { /* The timer expired before it was added to the active timer list. Process it now. */ - //pxTimer->pxCallbackFunction( ( xTimerHandle ) pxTimer ); - pxTimer->pxCallbackFunction( ( void * ) (pxTimer->pvTimerID) ); + pxTimer->pxCallbackFunction( ( xTimerHandle ) pxTimer ); if( pxTimer->uxAutoReload == ( unsigned portBASE_TYPE ) pdTRUE ) { @@ -599,8 +584,7 @@ portTickType xTimeNow; } /*-----------------------------------------------------------*/ -static void ICACHE_FLASH_ATTR -prvSwitchTimerLists( portTickType xLastTime ) +static void prvSwitchTimerLists( portTickType xLastTime ) { portTickType xNextExpireTime, xReloadTime; xList *pxTemp; @@ -625,8 +609,7 @@ portBASE_TYPE xResult; /* 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 have not yet been switched. */ - //pxTimer->pxCallbackFunction( ( xTimerHandle ) pxTimer ); - pxTimer->pxCallbackFunction( ( void * ) (pxTimer->pvTimerID) ); + pxTimer->pxCallbackFunction( ( xTimerHandle ) pxTimer ); if( pxTimer->uxAutoReload == ( unsigned portBASE_TYPE ) pdTRUE ) { @@ -658,8 +641,7 @@ portBASE_TYPE xResult; } /*-----------------------------------------------------------*/ -static void ICACHE_FLASH_ATTR -prvCheckForValidListAndQueue( void ) +static void prvCheckForValidListAndQueue( void ) { /* Check that the list from which active timers are referenced, and the queue used to communicate with the timer service, have been @@ -679,8 +661,7 @@ prvCheckForValidListAndQueue( void ) } /*-----------------------------------------------------------*/ -portBASE_TYPE ICACHE_FLASH_ATTR -xTimerIsTimerActive( xTimerHandle xTimer ) +portBASE_TYPE xTimerIsTimerActive( xTimerHandle xTimer ) { portBASE_TYPE xTimerIsInActiveList; xTIMER *pxTimer = ( xTIMER * ) xTimer; @@ -699,8 +680,7 @@ xTIMER *pxTimer = ( xTIMER * ) xTimer; } /*-----------------------------------------------------------*/ -void * ICACHE_FLASH_ATTR -pvTimerGetTimerID( xTimerHandle xTimer ) +void *pvTimerGetTimerID( xTimerHandle 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 to include software timer functionality. If you want to include software timer functionality then ensure configUSE_TIMERS is set to 1 in FreeRTOSConfig.h. */ - #endif /* configUSE_TIMERS == 1 */ + + +