summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
2c826a2)
Remove casts that are no longer required not type safe handles are used.
git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@2545
1d2547de-c912-0410-9cb9-
b8ca96c0e9e2
* @param pxListItem The list item we want to know if is in the list.\r
* @return pdTRUE if the list item is in the list, otherwise pdFALSE.\r
*/\r
* @param pxListItem The list item we want to know if is in the list.\r
* @return pdTRUE if the list item is in the list, otherwise pdFALSE.\r
*/\r
-#define listIS_CONTAINED_WITHIN( pxList, pxListItem ) ( ( ( pxListItem )->pxContainer == ( pxList ) ) ? pdTRUE : pdFALSE )\r
+#define listIS_CONTAINED_WITHIN( pxList, pxListItem ) ( ( ( pxListItem )->pxContainer == ( pxList ) ) ? ( pdTRUE ) : ( pdFALSE ) )\r
\r
/*\r
* Return the list a list item is contained within (referenced from).\r
\r
/*\r
* Return the list a list item is contained within (referenced from).\r
const uint32_t * const pulStack = ( uint32_t * ) pxCurrentTCB->pxStack; \\r
const uint32_t ulCheckValue = ( uint32_t ) 0xa5a5a5a5; \\r
\\r
const uint32_t * const pulStack = ( uint32_t * ) pxCurrentTCB->pxStack; \\r
const uint32_t ulCheckValue = ( uint32_t ) 0xa5a5a5a5; \\r
\\r
- if( ( pulStack[ 0 ] != ulCheckValue ) || \\r
- ( pulStack[ 1 ] != ulCheckValue ) || \\r
- ( pulStack[ 2 ] != ulCheckValue ) || \\r
- ( pulStack[ 3 ] != ulCheckValue ) ) \\r
+ if( ( pulStack[ 0 ] != ulCheckValue ) || \\r
+ ( pulStack[ 1 ] != ulCheckValue ) || \\r
+ ( pulStack[ 2 ] != ulCheckValue ) || \\r
+ ( pulStack[ 3 ] != ulCheckValue ) ) \\r
{ \\r
vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pxCurrentTCB->pcTaskName ); \\r
} \\r
{ \\r
vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pxCurrentTCB->pcTaskName ); \\r
} \\r
* reference the subject timer in calls to other software timer API functions\r
* (for example, xTimerStart(), xTimerReset(), etc.).\r
*/\r
* reference the subject timer in calls to other software timer API functions\r
* (for example, xTimerStart(), xTimerReset(), etc.).\r
*/\r
-typedef void * TimerHandle_t;\r
+struct TimerDef_t;\r
+typedef struct TimerDef_t * TimerHandle_t;\r
\r
/*\r
* Defines the prototype to which timer callback functions must conform.\r
\r
/*\r
* Defines the prototype to which timer callback functions must conform.\r
\r
BaseType_t xStreamBufferReset( StreamBufferHandle_t xStreamBuffer )\r
{\r
\r
BaseType_t xStreamBufferReset( StreamBufferHandle_t xStreamBuffer )\r
{\r
-StreamBuffer_t * const pxStreamBuffer = ( StreamBuffer_t * ) xStreamBuffer; /*lint !e9087 !e9079 Safe cast as StreamBufferHandle_t is opaque Streambuffer_t. */\r
+StreamBuffer_t * const pxStreamBuffer = xStreamBuffer;\r
BaseType_t xReturn = pdFAIL, xIsMessageBuffer;\r
\r
#if( configUSE_TRACE_FACILITY == 1 )\r
BaseType_t xReturn = pdFAIL, xIsMessageBuffer;\r
\r
#if( configUSE_TRACE_FACILITY == 1 )\r
- xTCB = ( TCB_t * ) xTask;\r
}\r
\r
/* Save the hook function in the TCB. A critical section is required as\r
}\r
\r
/* Save the hook function in the TCB. A critical section is required as\r
/* If xTask is NULL then we are calling our own task hook. */\r
if( xTask == NULL )\r
{\r
/* If xTask is NULL then we are calling our own task hook. */\r
if( xTask == NULL )\r
{\r
- xTCB = ( TCB_t * ) pxCurrentTCB;\r
\r
if( xTask != NULL )\r
{\r
\r
if( xTask != NULL )\r
{\r
- pxTCB = ( TCB_t * ) xTask;\r
uxReturn = pxTCB->uxTaskNumber;\r
}\r
else\r
uxReturn = pxTCB->uxTaskNumber;\r
}\r
else\r
\r
if( xTask != NULL )\r
{\r
\r
if( xTask != NULL )\r
{\r
- pxTCB = ( TCB_t * ) xTask;\r
pxTCB->uxTaskNumber = uxHandle;\r
}\r
}\r
pxTCB->uxTaskNumber = uxHandle;\r
}\r
}\r
uint8_t ucOriginalNotifyState;\r
\r
configASSERT( xTaskToNotify );\r
uint8_t ucOriginalNotifyState;\r
\r
configASSERT( xTaskToNotify );\r
- pxTCB = ( TCB_t * ) xTaskToNotify;\r
+ pxTCB = xTaskToNotify;\r
\r
taskENTER_CRITICAL();\r
{\r
\r
taskENTER_CRITICAL();\r
{\r
http://www.freertos.org/RTOS-Cortex-M3-M4.html */\r
portASSERT_IF_INTERRUPT_PRIORITY_INVALID();\r
\r
http://www.freertos.org/RTOS-Cortex-M3-M4.html */\r
portASSERT_IF_INTERRUPT_PRIORITY_INVALID();\r
\r
- pxTCB = ( TCB_t * ) xTaskToNotify;\r
+ pxTCB = xTaskToNotify;\r
\r
uxSavedInterruptStatus = portSET_INTERRUPT_MASK_FROM_ISR();\r
{\r
\r
uxSavedInterruptStatus = portSET_INTERRUPT_MASK_FROM_ISR();\r
{\r
http://www.freertos.org/RTOS-Cortex-M3-M4.html */\r
portASSERT_IF_INTERRUPT_PRIORITY_INVALID();\r
\r
http://www.freertos.org/RTOS-Cortex-M3-M4.html */\r
portASSERT_IF_INTERRUPT_PRIORITY_INVALID();\r
\r
- pxTCB = ( TCB_t * ) xTaskToNotify;\r
+ pxTCB = xTaskToNotify;\r
\r
uxSavedInterruptStatus = portSET_INTERRUPT_MASK_FROM_ISR();\r
{\r
\r
uxSavedInterruptStatus = portSET_INTERRUPT_MASK_FROM_ISR();\r
{\r
#error configUSE_TIMERS must be set to 1 to make the xTimerPendFunctionCall() function available.\r
#endif\r
\r
#error configUSE_TIMERS must be set to 1 to make the xTimerPendFunctionCall() function available.\r
#endif\r
\r
-/* Lint e961 and e750 are suppressed as a MISRA exception justified because the\r
-MPU ports require MPU_WRAPPERS_INCLUDED_FROM_API_FILE to be defined for the\r
-header files above, but not in this file, in order to generate the correct\r
-privileged Vs unprivileged linkage and placement. */\r
-#undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE /*lint !e961 !e750. */\r
+/* Lint e9021, e961 and e750 are suppressed as a MISRA exception justified\r
+because the MPU ports require MPU_WRAPPERS_INCLUDED_FROM_API_FILE to be defined\r
+for the header files above, but not in this file, in order to generate the\r
+correct privileged Vs unprivileged linkage and placement. */\r
+#undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE /*lint !e9021 !e961 !e750. */\r
\r
\r
/* This entire source file will be skipped if the application is not configured\r
\r
\r
/* This entire source file will be skipped if the application is not configured\r
#endif\r
\r
/* The definition of the timers themselves. */\r
#endif\r
\r
/* The definition of the timers themselves. */\r
-typedef struct tmrTimerControl\r
+typedef struct TimerDef_t\r
{\r
const char *pcTimerName; /*<< Text name. This is not used by the kernel, it is included simply to make debugging easier. */ /*lint !e971 Unqualified char types are allowed for strings and single characters only. */\r
ListItem_t xTimerListItem; /*<< Standard linked list item as used by all kernel features for event management. */\r
{\r
const char *pcTimerName; /*<< Text name. This is not used by the kernel, it is included simply to make debugging easier. */ /*lint !e971 Unqualified char types are allowed for strings and single characters only. */\r
ListItem_t xTimerListItem; /*<< Standard linked list item as used by all kernel features for event management. */\r
/* The list in which active timers are stored. Timers are referenced in expire\r
time order, with the nearest expiry time at the front of the list. Only the\r
timer service task is allowed to access these lists. */\r
/* The list in which active timers are stored. Timers are referenced in expire\r
time order, with the nearest expiry time at the front of the list. Only the\r
timer service task is allowed to access these lists. */\r
-PRIVILEGED_DATA static List_t xActiveTimerList1;\r
-PRIVILEGED_DATA static List_t xActiveTimerList2;\r
PRIVILEGED_DATA static List_t *pxCurrentTimerList;\r
PRIVILEGED_DATA static List_t *pxOverflowTimerList;\r
\r
PRIVILEGED_DATA static List_t *pxCurrentTimerList;\r
PRIVILEGED_DATA static List_t *pxOverflowTimerList;\r
\r
{\r
Timer_t *pxNewTimer;\r
\r
{\r
Timer_t *pxNewTimer;\r
\r
- pxNewTimer = ( Timer_t * ) pvPortMalloc( sizeof( Timer_t ) );\r
+ pxNewTimer = ( Timer_t * ) pvPortMalloc( sizeof( Timer_t ) ); /*lint !e9087 !e9079 All values returned by pvPortMalloc() have at least the alignment required by the MCU's stack, and the first member of Timer_t is always a pointer to the timer's mame. */\r
\r
if( pxNewTimer != NULL )\r
{\r
\r
if( pxNewTimer != NULL )\r
{\r
structure. */\r
volatile size_t xSize = sizeof( StaticTimer_t );\r
configASSERT( xSize == sizeof( Timer_t ) );\r
structure. */\r
volatile size_t xSize = sizeof( StaticTimer_t );\r
configASSERT( xSize == sizeof( Timer_t ) );\r
+ ( void ) xSize; /* Keeps lint quiet when configASSERT() is not defined. */\r
}\r
#endif /* configASSERT_DEFINED */\r
\r
/* A pointer to a StaticTimer_t structure MUST be provided, use it. */\r
configASSERT( pxTimerBuffer );\r
}\r
#endif /* configASSERT_DEFINED */\r
\r
/* A pointer to a StaticTimer_t structure MUST be provided, use it. */\r
configASSERT( pxTimerBuffer );\r
- pxNewTimer = ( Timer_t * ) pxTimerBuffer; /*lint !e740 Unusual cast is ok as the structures are designed to have the same alignment, and the size is checked by an assert. */\r
+ pxNewTimer = ( Timer_t * ) pxTimerBuffer; /*lint !e740 !e9087 StaticTimer_t is a pointer to a Timer_t, so guaranteed to be aligned and sized correctly (checked by an assert()), so this is safe. */\r
\r
if( pxNewTimer != NULL )\r
{\r
\r
if( pxNewTimer != NULL )\r
{\r
/* Send a command to the timer service task to start the xTimer timer. */\r
xMessage.xMessageID = xCommandID;\r
xMessage.u.xTimerParameters.xMessageValue = xOptionalValue;\r
/* Send a command to the timer service task to start the xTimer timer. */\r
xMessage.xMessageID = xCommandID;\r
xMessage.u.xTimerParameters.xMessageValue = xOptionalValue;\r
- xMessage.u.xTimerParameters.pxTimer = ( Timer_t * ) xTimer;\r
+ xMessage.u.xTimerParameters.pxTimer = xTimer;\r
\r
if( xCommandID < tmrFIRST_FROM_ISR_COMMAND )\r
{\r
\r
if( xCommandID < tmrFIRST_FROM_ISR_COMMAND )\r
{\r
\r
TickType_t xTimerGetPeriod( TimerHandle_t xTimer )\r
{\r
\r
TickType_t xTimerGetPeriod( TimerHandle_t xTimer )\r
{\r
-Timer_t *pxTimer = ( Timer_t * ) xTimer;\r
+Timer_t *pxTimer = xTimer;\r
\r
configASSERT( xTimer );\r
return pxTimer->xTimerPeriodInTicks;\r
\r
configASSERT( xTimer );\r
return pxTimer->xTimerPeriodInTicks;\r
\r
TickType_t xTimerGetExpiryTime( TimerHandle_t xTimer )\r
{\r
\r
TickType_t xTimerGetExpiryTime( TimerHandle_t xTimer )\r
{\r
-Timer_t * pxTimer = ( Timer_t * ) xTimer;\r
+Timer_t * pxTimer = xTimer;\r
TickType_t xReturn;\r
\r
configASSERT( xTimer );\r
TickType_t xReturn;\r
\r
configASSERT( xTimer );\r
\r
const char * pcTimerGetName( TimerHandle_t xTimer ) /*lint !e971 Unqualified char types are allowed for strings and single characters only. */\r
{\r
\r
const char * pcTimerGetName( TimerHandle_t xTimer ) /*lint !e971 Unqualified char types are allowed for strings and single characters only. */\r
{\r
-Timer_t *pxTimer = ( Timer_t * ) xTimer;\r
+Timer_t *pxTimer = xTimer;\r
\r
configASSERT( xTimer );\r
return pxTimer->pcTimerName;\r
\r
configASSERT( xTimer );\r
return pxTimer->pcTimerName;\r
static void prvProcessExpiredTimer( const TickType_t xNextExpireTime, const TickType_t xTimeNow )\r
{\r
BaseType_t xResult;\r
static void prvProcessExpiredTimer( const TickType_t xNextExpireTime, const TickType_t xTimeNow )\r
{\r
BaseType_t xResult;\r
-Timer_t * const pxTimer = ( Timer_t * ) listGET_OWNER_OF_HEAD_ENTRY( pxCurrentTimerList );\r
+Timer_t * const pxTimer = ( Timer_t * ) listGET_OWNER_OF_HEAD_ENTRY( pxCurrentTimerList ); /*lint !e9087 !e9079 void * is used as this macro is used with tasks and co-routines too. Alignment is known to be fine as the type of the pointer stored and retrieved is the same. */\r
\r
/* Remove the timer from the list of active timers. A check has already\r
been performed to ensure the list is not empty. */\r
\r
/* Remove the timer from the list of active timers. A check has already\r
been performed to ensure the list is not empty. */\r
xNextExpireTime = listGET_ITEM_VALUE_OF_HEAD_ENTRY( pxCurrentTimerList );\r
\r
/* Remove the timer from the list. */\r
xNextExpireTime = listGET_ITEM_VALUE_OF_HEAD_ENTRY( pxCurrentTimerList );\r
\r
/* Remove the timer from the list. */\r
- pxTimer = ( Timer_t * ) listGET_OWNER_OF_HEAD_ENTRY( pxCurrentTimerList );\r
+ pxTimer = ( Timer_t * ) listGET_OWNER_OF_HEAD_ENTRY( pxCurrentTimerList ); /*lint !e9087 !e9079 void * is used as this macro is used with tasks and co-routines too. Alignment is known to be fine as the type of the pointer stored and retrieved is the same. */\r
( void ) uxListRemove( &( pxTimer->xTimerListItem ) );\r
traceTIMER_EXPIRED( pxTimer );\r
\r
( void ) uxListRemove( &( pxTimer->xTimerListItem ) );\r
traceTIMER_EXPIRED( pxTimer );\r
\r
\r
static void prvCheckForValidListAndQueue( void )\r
{\r
\r
static void prvCheckForValidListAndQueue( void )\r
{\r
+PRIVILEGED_DATA static List_t xActiveTimerList1;\r
+PRIVILEGED_DATA static List_t xActiveTimerList2;\r
+\r
/* Check that the list from which active timers are referenced, and the\r
queue used to communicate with the timer service, have been\r
initialised. */\r
/* Check that the list from which active timers are referenced, and the\r
queue used to communicate with the timer service, have been\r
initialised. */\r
BaseType_t xTimerIsTimerActive( TimerHandle_t xTimer )\r
{\r
BaseType_t xTimerIsInActiveList;\r
BaseType_t xTimerIsTimerActive( TimerHandle_t xTimer )\r
{\r
BaseType_t xTimerIsInActiveList;\r
-Timer_t *pxTimer = ( Timer_t * ) xTimer;\r
+Timer_t *pxTimer = xTimer;\r
\r
configASSERT( xTimer );\r
\r
\r
configASSERT( xTimer );\r
\r
/* Checking to see if it is in the NULL list in effect checks to see if\r
it is referenced from either the current or the overflow timer lists in\r
one go, but the logic has to be reversed, hence the '!'. */\r
/* Checking to see if it is in the NULL list in effect checks to see if\r
it is referenced from either the current or the overflow timer lists in\r
one go, but the logic has to be reversed, hence the '!'. */\r
- xTimerIsInActiveList = ( BaseType_t ) !( listIS_CONTAINED_WITHIN( NULL, &( pxTimer->xTimerListItem ) ) ); /*lint !e961. Cast is only redundant when NULL is passed into the macro. */\r
+ if( listIS_CONTAINED_WITHIN( NULL, &( pxTimer->xTimerListItem ) ) == pdTRUE )\r
+ {\r
+ xTimerIsInActiveList = pdFALSE;\r
+ }\r
+ else\r
+ {\r
+ xTimerIsInActiveList = pdTRUE;\r
+ }\r
}\r
taskEXIT_CRITICAL();\r
\r
}\r
taskEXIT_CRITICAL();\r
\r
\r
void *pvTimerGetTimerID( const TimerHandle_t xTimer )\r
{\r
\r
void *pvTimerGetTimerID( const TimerHandle_t xTimer )\r
{\r
-Timer_t * const pxTimer = ( Timer_t * ) xTimer;\r
+Timer_t * const pxTimer = xTimer;\r
void *pvReturn;\r
\r
configASSERT( xTimer );\r
void *pvReturn;\r
\r
configASSERT( xTimer );\r
\r
void vTimerSetTimerID( TimerHandle_t xTimer, void *pvNewID )\r
{\r
\r
void vTimerSetTimerID( TimerHandle_t xTimer, void *pvNewID )\r
{\r
-Timer_t * const pxTimer = ( Timer_t * ) xTimer;\r
+Timer_t * const pxTimer = xTimer;\r
\r
configASSERT( xTimer );\r
\r
\r
configASSERT( xTimer );\r
\r