From 64220e796d5fc84a910d075169533700bfcf3716 Mon Sep 17 00:00:00 2001 From: rtel Date: Sun, 29 Dec 2013 14:06:04 +0000 Subject: [PATCH] Replace standard types with stdint.h types. Replace #define types with typedefs. Rename all typedefs to have a _t extension. Add #defines to automatically convert old FreeRTOS specific types to their new names (with the _t). git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@2147 1d2547de-c912-0410-9cb9-b8ca96c0e9e2 --- FreeRTOS/Source/croutine.c | 72 +-- FreeRTOS/Source/event_groups.c | 105 ++-- FreeRTOS/Source/include/FreeRTOS.h | 25 +- FreeRTOS/Source/include/StackMacros.h | 68 +-- FreeRTOS/Source/include/croutine.h | 112 ++-- FreeRTOS/Source/include/event_groups.h | 80 +-- FreeRTOS/Source/include/list.h | 60 +- FreeRTOS/Source/include/portable.h | 14 +- FreeRTOS/Source/include/projdefs.h | 14 +- FreeRTOS/Source/include/queue.h | 326 +++++----- FreeRTOS/Source/include/semphr.h | 120 ++-- FreeRTOS/Source/include/task.h | 240 ++++---- FreeRTOS/Source/include/timers.h | 168 +++--- FreeRTOS/Source/list.c | 31 +- .../portable/BCC/16BitDOS/Flsh186/port.c | 38 +- .../portable/BCC/16BitDOS/Flsh186/prtmacro.h | 22 +- .../Source/portable/BCC/16BitDOS/PC/port.c | 32 +- .../portable/BCC/16BitDOS/PC/prtmacro.h | 24 +- .../portable/BCC/16BitDOS/common/portasm.h | 4 +- .../portable/BCC/16BitDOS/common/portcomn.c | 20 +- .../Source/portable/CCS/ARM_Cortex-R4/port.c | 76 +-- .../portable/CCS/ARM_Cortex-R4/portmacro.h | 20 +- FreeRTOS/Source/portable/CCS/MSP430X/port.c | 70 +-- .../Source/portable/CCS/MSP430X/portmacro.h | 32 +- .../portable/CodeWarrior/ColdFire_V1/port.c | 28 +- .../CodeWarrior/ColdFire_V1/portmacro.h | 25 +- .../portable/CodeWarrior/ColdFire_V2/port.c | 20 +- .../CodeWarrior/ColdFire_V2/portmacro.h | 24 +- .../Source/portable/CodeWarrior/HCS12/port.c | 38 +- .../portable/CodeWarrior/HCS12/portmacro.h | 52 +- .../portable/GCC/ARM7_AT91FR40008/port.c | 54 +- .../portable/GCC/ARM7_AT91FR40008/portISR.c | 10 +- .../portable/GCC/ARM7_AT91FR40008/portmacro.h | 46 +- .../GCC/ARM7_AT91SAM7S/lib_AT91SAM7X256.h | 46 +- .../Source/portable/GCC/ARM7_AT91SAM7S/port.c | 60 +- .../portable/GCC/ARM7_AT91SAM7S/portISR.c | 10 +- .../portable/GCC/ARM7_AT91SAM7S/portmacro.h | 42 +- .../Source/portable/GCC/ARM7_LPC2000/port.c | 66 +- .../portable/GCC/ARM7_LPC2000/portISR.c | 8 +- .../portable/GCC/ARM7_LPC2000/portmacro.h | 36 +- .../Source/portable/GCC/ARM7_LPC23xx/port.c | 68 +-- .../portable/GCC/ARM7_LPC23xx/portISR.c | 8 +- .../portable/GCC/ARM7_LPC23xx/portmacro.h | 42 +- FreeRTOS/Source/portable/GCC/ARM_CM0/port.c | 26 +- .../Source/portable/GCC/ARM_CM0/portmacro.h | 24 +- FreeRTOS/Source/portable/GCC/ARM_CM3/port.c | 68 +-- .../Source/portable/GCC/ARM_CM3/portmacro.h | 30 +- .../Source/portable/GCC/ARM_CM3_MPU/port.c | 422 ++++++------- .../portable/GCC/ARM_CM3_MPU/portmacro.h | 24 +- FreeRTOS/Source/portable/GCC/ARM_CM4F/port.c | 70 +-- .../Source/portable/GCC/ARM_CM4F/portmacro.h | 30 +- FreeRTOS/Source/portable/GCC/ATMega323/port.c | 102 ++-- .../Source/portable/GCC/ATMega323/portmacro.h | 24 +- FreeRTOS/Source/portable/GCC/AVR32_UC3/port.c | 54 +- .../Source/portable/GCC/AVR32_UC3/portmacro.h | 34 +- .../Source/portable/GCC/CORTUS_APS3/port.c | 8 +- .../portable/GCC/CORTUS_APS3/portmacro.h | 20 +- .../Source/portable/GCC/ColdFire_V2/port.c | 20 +- .../portable/GCC/ColdFire_V2/portmacro.h | 24 +- FreeRTOS/Source/portable/GCC/H8S2329/port.c | 42 +- .../Source/portable/GCC/H8S2329/portmacro.h | 24 +- FreeRTOS/Source/portable/GCC/HCS12/port.c | 32 +- .../Source/portable/GCC/HCS12/portmacro.h | 45 +- FreeRTOS/Source/portable/GCC/MCF5235/port.c | 54 +- .../Source/portable/GCC/MCF5235/portmacro.h | 22 +- .../Source/portable/GCC/MSP430F449/port.c | 50 +- .../portable/GCC/MSP430F449/portmacro.h | 30 +- .../Source/portable/GCC/MicroBlaze/port.c | 100 ++-- .../portable/GCC/MicroBlaze/portmacro.h | 30 +- .../Source/portable/GCC/MicroBlazeV8/port.c | 112 ++-- .../GCC/MicroBlazeV8/port_exceptions.c | 24 +- .../portable/GCC/MicroBlazeV8/portmacro.h | 194 +++--- FreeRTOS/Source/portable/GCC/NiosII/port.c | 18 +- .../Source/portable/GCC/NiosII/portmacro.h | 24 +- .../Source/portable/GCC/PPC405_Xilinx/port.c | 26 +- .../portable/GCC/PPC405_Xilinx/portmacro.h | 26 +- .../Source/portable/GCC/PPC440_Xilinx/port.c | 26 +- .../portable/GCC/PPC440_Xilinx/portmacro.h | 26 +- FreeRTOS/Source/portable/GCC/RX100/port.c | 42 +- .../Source/portable/GCC/RX100/portmacro.h | 40 +- FreeRTOS/Source/portable/GCC/RX600/port.c | 16 +- .../Source/portable/GCC/RX600/portmacro.h | 42 +- FreeRTOS/Source/portable/GCC/STR75x/port.c | 48 +- FreeRTOS/Source/portable/GCC/STR75x/portISR.c | 4 +- .../Source/portable/GCC/STR75x/portmacro.h | 36 +- .../Source/portable/GCC/TriCore_1782/port.c | 64 +- .../portable/GCC/TriCore_1782/portmacro.h | 36 +- .../portable/GCC/TriCore_1782/porttrap.c | 2 +- FreeRTOS/Source/portable/IAR/78K0R/port.c | 46 +- .../Source/portable/IAR/78K0R/portmacro.h | 26 +- FreeRTOS/Source/portable/IAR/ARM_CA9/port.c | 66 +- .../Source/portable/IAR/ARM_CA9/portmacro.h | 31 +- FreeRTOS/Source/portable/IAR/ARM_CM0/port.c | 20 +- .../Source/portable/IAR/ARM_CM0/portmacro.h | 23 +- FreeRTOS/Source/portable/IAR/ARM_CM3/port.c | 64 +- .../Source/portable/IAR/ARM_CM3/portmacro.h | 22 +- FreeRTOS/Source/portable/IAR/ARM_CM4F/port.c | 66 +- .../Source/portable/IAR/ARM_CM4F/portmacro.h | 26 +- FreeRTOS/Source/portable/IAR/ATMega323/port.c | 106 ++-- .../Source/portable/IAR/ATMega323/portmacro.h | 22 +- FreeRTOS/Source/portable/IAR/AVR32_UC3/port.c | 54 +- .../Source/portable/IAR/AVR32_UC3/portmacro.h | 35 +- FreeRTOS/Source/portable/IAR/AVR32_UC3/read.c | 2 +- .../Source/portable/IAR/AVR32_UC3/write.c | 2 +- .../IAR/AtmelSAM7S64/lib_AT91SAM7S64.h | 20 +- .../IAR/AtmelSAM7S64/lib_AT91SAM7X128.h | 46 +- .../IAR/AtmelSAM7S64/lib_AT91SAM7X256.h | 46 +- .../Source/portable/IAR/AtmelSAM7S64/port.c | 60 +- .../portable/IAR/AtmelSAM7S64/portmacro.h | 28 +- .../Source/portable/IAR/AtmelSAM9XE/port.c | 58 +- .../portable/IAR/AtmelSAM9XE/portmacro.h | 29 +- FreeRTOS/Source/portable/IAR/LPC2000/port.c | 80 +-- .../Source/portable/IAR/LPC2000/portmacro.h | 29 +- FreeRTOS/Source/portable/IAR/MSP430/port.c | 48 +- .../Source/portable/IAR/MSP430/portmacro.h | 31 +- FreeRTOS/Source/portable/IAR/MSP430X/port.c | 70 +-- .../Source/portable/IAR/MSP430X/portmacro.h | 32 +- FreeRTOS/Source/portable/IAR/RL78/port.c | 70 +-- FreeRTOS/Source/portable/IAR/RL78/portmacro.h | 29 +- FreeRTOS/Source/portable/IAR/RX100/port.c | 38 +- .../Source/portable/IAR/RX100/portmacro.h | 29 +- FreeRTOS/Source/portable/IAR/RX600/port.c | 12 +- .../Source/portable/IAR/RX600/portmacro.h | 43 +- FreeRTOS/Source/portable/IAR/STR71x/port.c | 52 +- .../Source/portable/IAR/STR71x/portmacro.h | 35 +- FreeRTOS/Source/portable/IAR/STR75x/port.c | 48 +- .../Source/portable/IAR/STR75x/portmacro.h | 29 +- FreeRTOS/Source/portable/IAR/STR91x/port.c | 80 +-- .../Source/portable/IAR/STR91x/portmacro.h | 29 +- FreeRTOS/Source/portable/IAR/V850ES/port.c | 78 +-- .../Source/portable/IAR/V850ES/portmacro.h | 24 +- FreeRTOS/Source/portable/MPLAB/PIC18F/port.c | 92 +-- .../Source/portable/MPLAB/PIC18F/portmacro.h | 20 +- .../Source/portable/MPLAB/PIC24_dsPIC/port.c | 26 +- .../portable/MPLAB/PIC24_dsPIC/portmacro.h | 24 +- FreeRTOS/Source/portable/MPLAB/PIC32MX/port.c | 40 +- .../Source/portable/MPLAB/PIC32MX/portmacro.h | 30 +- FreeRTOS/Source/portable/MPLAB/PIC32MZ/port.c | 42 +- .../Source/portable/MPLAB/PIC32MZ/portmacro.h | 30 +- FreeRTOS/Source/portable/MSVC-MingW/port.c | 64 +- .../Source/portable/MSVC-MingW/portmacro.h | 27 +- FreeRTOS/Source/portable/MemMang/heap_1.c | 6 +- FreeRTOS/Source/portable/MemMang/heap_2.c | 44 +- FreeRTOS/Source/portable/MemMang/heap_4.c | 54 +- .../Paradigm/Tern_EE/large_untested/port.c | 30 +- .../Paradigm/Tern_EE/large_untested/portasm.h | 4 +- .../Tern_EE/large_untested/portmacro.h | 25 +- .../portable/Paradigm/Tern_EE/small/port.c | 32 +- .../portable/Paradigm/Tern_EE/small/portasm.h | 4 +- .../Paradigm/Tern_EE/small/portmacro.h | 25 +- .../Source/portable/RVDS/ARM7_LPC21xx/port.c | 76 +-- .../portable/RVDS/ARM7_LPC21xx/portmacro.h | 43 +- FreeRTOS/Source/portable/RVDS/ARM_CA9/port.c | 80 +-- .../Source/portable/RVDS/ARM_CA9/portmacro.h | 29 +- FreeRTOS/Source/portable/RVDS/ARM_CM0/port.c | 26 +- .../Source/portable/RVDS/ARM_CM0/portmacro.h | 24 +- FreeRTOS/Source/portable/RVDS/ARM_CM3/port.c | 70 +-- .../Source/portable/RVDS/ARM_CM3/portmacro.h | 26 +- FreeRTOS/Source/portable/RVDS/ARM_CM4F/port.c | 72 +-- .../Source/portable/RVDS/ARM_CM4F/portmacro.h | 26 +- FreeRTOS/Source/portable/Renesas/RX100/port.c | 42 +- .../Source/portable/Renesas/RX100/portmacro.h | 36 +- FreeRTOS/Source/portable/Renesas/RX200/port.c | 14 +- .../Source/portable/Renesas/RX200/portmacro.h | 36 +- FreeRTOS/Source/portable/Renesas/RX600/port.c | 16 +- .../Source/portable/Renesas/RX600/portmacro.h | 34 +- .../Source/portable/Renesas/SH2A_FPU/port.c | 22 +- .../portable/Renesas/SH2A_FPU/portmacro.h | 34 +- .../Source/portable/Rowley/MSP430F449/port.c | 48 +- .../portable/Rowley/MSP430F449/portmacro.h | 37 +- FreeRTOS/Source/portable/SDCC/Cygnal/port.c | 70 +-- .../Source/portable/SDCC/Cygnal/portmacro.h | 30 +- .../Source/portable/Softune/MB91460/port.c | 52 +- .../portable/Softune/MB91460/portmacro.h | 23 +- .../Source/portable/Softune/MB96340/port.c | 46 +- .../portable/Softune/MB96340/portmacro.h | 25 +- .../Source/portable/Tasking/ARM_CM4F/port.c | 30 +- .../portable/Tasking/ARM_CM4F/portmacro.h | 25 +- .../portable/WizC/PIC18/Drivers/Tick/Tick.c | 8 +- FreeRTOS/Source/portable/WizC/PIC18/port.c | 66 +- .../Source/portable/WizC/PIC18/portmacro.h | 43 +- .../portable/oWatcom/16BitDOS/Flsh186/port.c | 38 +- .../oWatcom/16BitDOS/Flsh186/portmacro.h | 25 +- .../portable/oWatcom/16BitDOS/PC/port.c | 32 +- .../portable/oWatcom/16BitDOS/PC/portmacro.h | 29 +- .../oWatcom/16BitDOS/common/portasm.h | 4 +- .../oWatcom/16BitDOS/common/portcomn.c | 16 +- FreeRTOS/Source/queue.c | 384 ++++++------ FreeRTOS/Source/tasks.c | 566 +++++++++--------- FreeRTOS/Source/timers.c | 166 ++--- 190 files changed, 4940 insertions(+), 4603 deletions(-) diff --git a/FreeRTOS/Source/croutine.c b/FreeRTOS/Source/croutine.c index 04b229a47..814cc7a75 100644 --- a/FreeRTOS/Source/croutine.c +++ b/FreeRTOS/Source/croutine.c @@ -77,17 +77,17 @@ /* Lists for ready and blocked co-routines. --------------------*/ -static xList pxReadyCoRoutineLists[ configMAX_CO_ROUTINE_PRIORITIES ]; /*< Prioritised ready co-routines. */ -static xList xDelayedCoRoutineList1; /*< Delayed co-routines. */ -static xList xDelayedCoRoutineList2; /*< Delayed co-routines (two lists are used - one for delays that have overflowed the current tick count. */ -static xList * pxDelayedCoRoutineList; /*< Points to the delayed co-routine list currently being used. */ -static xList * pxOverflowDelayedCoRoutineList; /*< Points to the delayed co-routine list currently being used to hold co-routines that have overflowed the current tick count. */ -static xList xPendingReadyCoRoutineList; /*< Holds co-routines that have been readied by an external event. They cannot be added directly to the ready lists as the ready lists cannot be accessed by interrupts. */ +static List_t pxReadyCoRoutineLists[ configMAX_CO_ROUTINE_PRIORITIES ]; /*< Prioritised ready co-routines. */ +static List_t xDelayedCoRoutineList1; /*< Delayed co-routines. */ +static List_t xDelayedCoRoutineList2; /*< Delayed co-routines (two lists are used - one for delays that have overflowed the current tick count. */ +static List_t * pxDelayedCoRoutineList; /*< Points to the delayed co-routine list currently being used. */ +static List_t * pxOverflowDelayedCoRoutineList; /*< Points to the delayed co-routine list currently being used to hold co-routines that have overflowed the current tick count. */ +static List_t xPendingReadyCoRoutineList; /*< Holds co-routines that have been readied by an external event. They cannot be added directly to the ready lists as the ready lists cannot be accessed by interrupts. */ /* Other file private variables. --------------------------------*/ -corCRCB * pxCurrentCoRoutine = NULL; -static unsigned portBASE_TYPE uxTopCoRoutineReadyPriority = 0; -static portTickType xCoRoutineTickCount = 0, xLastTickCount = 0, xPassedTicks = 0; +CRCB_t * pxCurrentCoRoutine = NULL; +static UBaseType_t uxTopCoRoutineReadyPriority = 0; +static TickType_t xCoRoutineTickCount = 0, xLastTickCount = 0, xPassedTicks = 0; /* The initial state of the co-routine when it is created. */ #define corINITIAL_STATE ( 0 ) @@ -105,7 +105,7 @@ static portTickType xCoRoutineTickCount = 0, xLastTickCount = 0, xPassedTicks = { \ uxTopCoRoutineReadyPriority = pxCRCB->uxPriority; \ } \ - vListInsertEnd( ( xList * ) &( pxReadyCoRoutineLists[ pxCRCB->uxPriority ] ), &( pxCRCB->xGenericListItem ) ); \ + vListInsertEnd( ( List_t * ) &( pxReadyCoRoutineLists[ pxCRCB->uxPriority ] ), &( pxCRCB->xGenericListItem ) ); \ } /* @@ -134,13 +134,13 @@ static void prvCheckDelayedList( void ); /*-----------------------------------------------------------*/ -signed portBASE_TYPE xCoRoutineCreate( crCOROUTINE_CODE pxCoRoutineCode, unsigned portBASE_TYPE uxPriority, unsigned portBASE_TYPE uxIndex ) +BaseType_t xCoRoutineCreate( crCOROUTINE_CODE pxCoRoutineCode, UBaseType_t uxPriority, UBaseType_t uxIndex ) { -signed portBASE_TYPE xReturn; -corCRCB *pxCoRoutine; +BaseType_t xReturn; +CRCB_t *pxCoRoutine; /* Allocate the memory that will store the co-routine control block. */ - pxCoRoutine = ( corCRCB * ) pvPortMalloc( sizeof( corCRCB ) ); + pxCoRoutine = ( CRCB_t * ) pvPortMalloc( sizeof( CRCB_t ) ); if( pxCoRoutine ) { /* If pxCurrentCoRoutine is NULL then this is the first co-routine to @@ -167,14 +167,14 @@ corCRCB *pxCoRoutine; vListInitialiseItem( &( pxCoRoutine->xGenericListItem ) ); vListInitialiseItem( &( pxCoRoutine->xEventListItem ) ); - /* Set the co-routine control block as a link back from the xListItem. + /* Set the co-routine control block as a link back from the ListItem_t. This is so we can get back to the containing CRCB from a generic item in a list. */ listSET_LIST_ITEM_OWNER( &( pxCoRoutine->xGenericListItem ), pxCoRoutine ); listSET_LIST_ITEM_OWNER( &( pxCoRoutine->xEventListItem ), pxCoRoutine ); /* Event lists are always in priority order. */ - listSET_LIST_ITEM_VALUE( &( pxCoRoutine->xEventListItem ), ( ( portTickType ) configMAX_CO_ROUTINE_PRIORITIES - ( portTickType ) uxPriority ) ); + listSET_LIST_ITEM_VALUE( &( pxCoRoutine->xEventListItem ), ( ( TickType_t ) configMAX_CO_ROUTINE_PRIORITIES - ( TickType_t ) uxPriority ) ); /* Now the co-routine has been initialised it can be added to the ready list at the correct priority. */ @@ -191,9 +191,9 @@ corCRCB *pxCoRoutine; } /*-----------------------------------------------------------*/ -void vCoRoutineAddToDelayedList( portTickType xTicksToDelay, xList *pxEventList ) +void vCoRoutineAddToDelayedList( TickType_t xTicksToDelay, List_t *pxEventList ) { -portTickType xTimeToWake; +TickType_t xTimeToWake; /* Calculate the time to wake - this may overflow but this is not a problem. */ @@ -202,7 +202,7 @@ portTickType xTimeToWake; /* We must remove ourselves from the ready list before adding ourselves to the blocked list as the same list item is used for both lists. */ - ( void ) uxListRemove( ( xListItem * ) &( pxCurrentCoRoutine->xGenericListItem ) ); + ( void ) uxListRemove( ( ListItem_t * ) &( pxCurrentCoRoutine->xGenericListItem ) ); /* The list item will be inserted in wake time order. */ listSET_LIST_ITEM_VALUE( &( pxCurrentCoRoutine->xGenericListItem ), xTimeToWake ); @@ -211,13 +211,13 @@ portTickType xTimeToWake; { /* Wake time has overflowed. Place this item in the overflow list. */ - vListInsert( ( xList * ) pxOverflowDelayedCoRoutineList, ( xListItem * ) &( pxCurrentCoRoutine->xGenericListItem ) ); + vListInsert( ( List_t * ) pxOverflowDelayedCoRoutineList, ( ListItem_t * ) &( pxCurrentCoRoutine->xGenericListItem ) ); } else { /* The wake time has not overflowed, so we can use the current block list. */ - vListInsert( ( xList * ) pxDelayedCoRoutineList, ( xListItem * ) &( pxCurrentCoRoutine->xGenericListItem ) ); + vListInsert( ( List_t * ) pxDelayedCoRoutineList, ( ListItem_t * ) &( pxCurrentCoRoutine->xGenericListItem ) ); } if( pxEventList ) @@ -236,12 +236,12 @@ static void prvCheckPendingReadyList( void ) the ready lists itself. */ while( listLIST_IS_EMPTY( &xPendingReadyCoRoutineList ) == pdFALSE ) { - corCRCB *pxUnblockedCRCB; + CRCB_t *pxUnblockedCRCB; /* The pending ready list can be accessed by an ISR. */ portDISABLE_INTERRUPTS(); { - pxUnblockedCRCB = ( corCRCB * ) listGET_OWNER_OF_HEAD_ENTRY( (&xPendingReadyCoRoutineList) ); + pxUnblockedCRCB = ( CRCB_t * ) listGET_OWNER_OF_HEAD_ENTRY( (&xPendingReadyCoRoutineList) ); ( void ) uxListRemove( &( pxUnblockedCRCB->xEventListItem ) ); } portENABLE_INTERRUPTS(); @@ -254,7 +254,7 @@ static void prvCheckPendingReadyList( void ) static void prvCheckDelayedList( void ) { -corCRCB *pxCRCB; +CRCB_t *pxCRCB; xPassedTicks = xTaskGetTickCount() - xLastTickCount; while( xPassedTicks ) @@ -265,7 +265,7 @@ corCRCB *pxCRCB; /* If the tick count has overflowed we need to swap the ready lists. */ if( xCoRoutineTickCount == 0 ) { - xList * pxTemp; + List_t * pxTemp; /* Tick count has overflowed so we need to swap the delay lists. If there are any items in pxDelayedCoRoutineList here then there is an error! */ @@ -277,7 +277,7 @@ corCRCB *pxCRCB; /* See if this tick has made a timeout expire. */ while( listLIST_IS_EMPTY( pxDelayedCoRoutineList ) == pdFALSE ) { - pxCRCB = ( corCRCB * ) listGET_OWNER_OF_HEAD_ENTRY( pxDelayedCoRoutineList ); + pxCRCB = ( CRCB_t * ) listGET_OWNER_OF_HEAD_ENTRY( pxDelayedCoRoutineList ); if( xCoRoutineTickCount < listGET_LIST_ITEM_VALUE( &( pxCRCB->xGenericListItem ) ) ) { @@ -342,16 +342,16 @@ void vCoRoutineSchedule( void ) static void prvInitialiseCoRoutineLists( void ) { -unsigned portBASE_TYPE uxPriority; +UBaseType_t uxPriority; for( uxPriority = 0; uxPriority < configMAX_CO_ROUTINE_PRIORITIES; uxPriority++ ) { - vListInitialise( ( xList * ) &( pxReadyCoRoutineLists[ uxPriority ] ) ); + vListInitialise( ( List_t * ) &( pxReadyCoRoutineLists[ uxPriority ] ) ); } - vListInitialise( ( xList * ) &xDelayedCoRoutineList1 ); - vListInitialise( ( xList * ) &xDelayedCoRoutineList2 ); - vListInitialise( ( xList * ) &xPendingReadyCoRoutineList ); + vListInitialise( ( List_t * ) &xDelayedCoRoutineList1 ); + vListInitialise( ( List_t * ) &xDelayedCoRoutineList2 ); + vListInitialise( ( List_t * ) &xPendingReadyCoRoutineList ); /* Start with pxDelayedCoRoutineList using list1 and the pxOverflowDelayedCoRoutineList using list2. */ @@ -360,17 +360,17 @@ unsigned portBASE_TYPE uxPriority; } /*-----------------------------------------------------------*/ -signed portBASE_TYPE xCoRoutineRemoveFromEventList( const xList *pxEventList ) +BaseType_t xCoRoutineRemoveFromEventList( const List_t *pxEventList ) { -corCRCB *pxUnblockedCRCB; -signed portBASE_TYPE xReturn; +CRCB_t *pxUnblockedCRCB; +BaseType_t xReturn; /* This function is called from within an interrupt. It can only access event lists and the pending ready list. This function assumes that a check has already been made to ensure pxEventList is not empty. */ - pxUnblockedCRCB = ( corCRCB * ) listGET_OWNER_OF_HEAD_ENTRY( pxEventList ); + pxUnblockedCRCB = ( CRCB_t * ) listGET_OWNER_OF_HEAD_ENTRY( pxEventList ); ( void ) uxListRemove( &( pxUnblockedCRCB->xEventListItem ) ); - vListInsertEnd( ( xList * ) &( xPendingReadyCoRoutineList ), &( pxUnblockedCRCB->xEventListItem ) ); + vListInsertEnd( ( List_t * ) &( xPendingReadyCoRoutineList ), &( pxUnblockedCRCB->xEventListItem ) ); if( pxUnblockedCRCB->uxPriority >= pxCurrentCoRoutine->uxPriority ) { diff --git a/FreeRTOS/Source/event_groups.c b/FreeRTOS/Source/event_groups.c index 981d420b2..c5017caf0 100644 --- a/FreeRTOS/Source/event_groups.c +++ b/FreeRTOS/Source/event_groups.c @@ -106,18 +106,11 @@ taskEVENT_LIST_ITEM_VALUE_IN_USE definition. */ #define eventEVENT_BITS_CONTROL_BYTES 0xff000000UL #endif -typedef struct EventBitsDefinition +typedef struct EVENT_GROUP_DEFINITION { - xEventBitsType uxEventBits; - xList xTasksWaitingForBits; /*< List of tasks waiting for a bit to be set. */ -} xEVENT_BITS; - -/* Used internally only. */ -typedef struct EVENT_GROUP_CALLBACK_PARAMTERS -{ - xEventGroupHandle xTargetEventGroup; - xEventBitsType xBitsToSet; -} xEventGroupCallbackParameters; + EventBits_t uxEventBits; + List_t xTasksWaitingForBits; /*< List of tasks waiting for a bit to be set. */ +} EventGroup_t; /*-----------------------------------------------------------*/ @@ -129,15 +122,15 @@ typedef struct EVENT_GROUP_CALLBACK_PARAMTERS * wait condition is met if any of the bits set in uxBitsToWait for are also set * in uxCurrentEventBits. */ -static portBASE_TYPE prvTestWaitCondition( const xEventBitsType uxCurrentEventBits, const xEventBitsType uxBitsToWaitFor, const portBASE_TYPE xWaitForAllBits ); +static BaseType_t prvTestWaitCondition( const EventBits_t uxCurrentEventBits, const EventBits_t uxBitsToWaitFor, const BaseType_t xWaitForAllBits ); /*-----------------------------------------------------------*/ -xEventGroupHandle xEventGroupCreate( void ) +EventGroupHandle_t xEventGroupCreate( void ) { -xEVENT_BITS *pxEventBits; +EventGroup_t *pxEventBits; - pxEventBits = pvPortMalloc( sizeof( xEVENT_BITS ) ); + pxEventBits = pvPortMalloc( sizeof( EventGroup_t ) ); if( pxEventBits != NULL ) { pxEventBits->uxEventBits = 0; @@ -149,15 +142,15 @@ xEVENT_BITS *pxEventBits; traceEVENT_GROUP_CREATE_FAILED(); } - return ( xEventGroupHandle ) pxEventBits; + return ( EventGroupHandle_t ) pxEventBits; } /*-----------------------------------------------------------*/ -xEventBitsType xEventGroupSync( xEventGroupHandle xEventGroup, const xEventBitsType uxBitsToSet, const xEventBitsType uxBitsToWaitFor, portTickType xTicksToWait ) +EventBits_t xEventGroupSync( EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToSet, const EventBits_t uxBitsToWaitFor, TickType_t xTicksToWait ) { -xEventBitsType uxOriginalBitValue, uxReturn; -xEVENT_BITS *pxEventBits = ( xEVENT_BITS * ) xEventGroup; -portBASE_TYPE xAlreadyYielded; +EventBits_t uxOriginalBitValue, uxReturn; +EventGroup_t *pxEventBits = ( EventGroup_t * ) xEventGroup; +BaseType_t xAlreadyYielded; configASSERT( ( uxBitsToWaitFor & eventEVENT_BITS_CONTROL_BYTES ) == 0 ); configASSERT( uxBitsToWaitFor != 0 ); @@ -188,7 +181,7 @@ portBASE_TYPE xAlreadyYielded; } else { - if( xTicksToWait != ( portTickType ) 0 ) + if( xTicksToWait != ( TickType_t ) 0 ) { /* Store the bits that the calling task is waiting for in the task's event list item so the kernel knows when a match is @@ -211,7 +204,7 @@ portBASE_TYPE xAlreadyYielded; } xAlreadyYielded = xTaskResumeAll(); - if( xTicksToWait != ( portTickType ) 0 ) + if( xTicksToWait != ( TickType_t ) 0 ) { if( xAlreadyYielded == pdFALSE ) { @@ -228,7 +221,7 @@ portBASE_TYPE xAlreadyYielded; event list item, and they should now be retrieved then cleared. */ uxReturn = uxTaskResetEventItemValue(); - if( ( uxReturn & eventUNBLOCKED_DUE_TO_BIT_SET ) == ( xEventBitsType ) 0 ) + if( ( uxReturn & eventUNBLOCKED_DUE_TO_BIT_SET ) == ( EventBits_t ) 0 ) { /* The task timed out, just return the current event bit value. */ taskENTER_CRITICAL(); @@ -263,11 +256,11 @@ portBASE_TYPE xAlreadyYielded; } /*-----------------------------------------------------------*/ -xEventBitsType xEventGroupWaitBits( xEventGroupHandle xEventGroup, const xEventBitsType uxBitsToWaitFor, const portBASE_TYPE xClearOnExit, const portBASE_TYPE xWaitForAllBits, portTickType xTicksToWait ) +EventBits_t xEventGroupWaitBits( EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToWaitFor, const BaseType_t xClearOnExit, const BaseType_t xWaitForAllBits, TickType_t xTicksToWait ) { -xEVENT_BITS *pxEventBits = ( xEVENT_BITS * ) xEventGroup; -xEventBitsType uxReturn, uxControlBits = 0; -portBASE_TYPE xWaitConditionMet, xAlreadyYielded; +EventGroup_t *pxEventBits = ( EventGroup_t * ) xEventGroup; +EventBits_t uxReturn, uxControlBits = 0; +BaseType_t xWaitConditionMet, xAlreadyYielded; /* Check the user is not attempting to wait on the bits used by the kernel itself, and that at least one bit is being requested. */ @@ -281,7 +274,7 @@ portBASE_TYPE xWaitConditionMet, xAlreadyYielded; vTaskSuspendAll(); { - const xEventBitsType uxCurrentEventBits = pxEventBits->uxEventBits; + const EventBits_t uxCurrentEventBits = pxEventBits->uxEventBits; traceEVENT_GROUP_WAIT_BITS_START( xEventGroup, uxBitsToWaitFor ); @@ -293,7 +286,7 @@ portBASE_TYPE xWaitConditionMet, xAlreadyYielded; /* The wait condition has already been met so there is no need to block. */ uxReturn = uxCurrentEventBits; - xTicksToWait = ( portTickType ) 0; + xTicksToWait = ( TickType_t ) 0; /* Clear the wait bits if requested to do so. */ if( xClearOnExit != pdFALSE ) @@ -305,7 +298,7 @@ portBASE_TYPE xWaitConditionMet, xAlreadyYielded; mtCOVERAGE_TEST_MARKER(); } } - else if( xTicksToWait == ( portTickType ) 0 ) + else if( xTicksToWait == ( TickType_t ) 0 ) { /* The wait condition has not been met, but no block time was specified, so just return the current value. */ @@ -348,7 +341,7 @@ portBASE_TYPE xWaitConditionMet, xAlreadyYielded; } xAlreadyYielded = xTaskResumeAll(); - if( xTicksToWait != ( portTickType ) 0 ) + if( xTicksToWait != ( TickType_t ) 0 ) { if( xAlreadyYielded == pdFALSE ) { @@ -365,7 +358,7 @@ portBASE_TYPE xWaitConditionMet, xAlreadyYielded; event list item, and they should now be retrieved then cleared. */ uxReturn = uxTaskResetEventItemValue(); - if( ( uxReturn & eventUNBLOCKED_DUE_TO_BIT_SET ) == ( xEventBitsType ) 0 ) + if( ( uxReturn & eventUNBLOCKED_DUE_TO_BIT_SET ) == ( EventBits_t ) 0 ) { taskENTER_CRITICAL(); { @@ -405,10 +398,10 @@ portBASE_TYPE xWaitConditionMet, xAlreadyYielded; } /*-----------------------------------------------------------*/ -xEventBitsType xEventGroupClearBits( xEventGroupHandle xEventGroup, const xEventBitsType uxBitsToClear ) +EventBits_t xEventGroupClearBits( EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToClear ) { -xEVENT_BITS *pxEventBits = ( xEVENT_BITS * ) xEventGroup; -xEventBitsType uxReturn; +EventGroup_t *pxEventBits = ( EventGroup_t * ) xEventGroup; +EventBits_t uxReturn; /* Check the user is not attempting to clear the bits used by the kernel itself. */ @@ -431,14 +424,14 @@ xEventBitsType uxReturn; } /*-----------------------------------------------------------*/ -xEventBitsType xEventGroupSetBits( xEventGroupHandle xEventGroup, const xEventBitsType uxBitsToSet ) +EventBits_t xEventGroupSetBits( EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToSet ) { -xListItem *pxListItem, *pxNext; -xListItem const *pxListEnd; -xList *pxList; -xEventBitsType uxBitsToClear = 0, uxBitsWaitedFor, uxControlBits; -xEVENT_BITS *pxEventBits = ( xEVENT_BITS * ) xEventGroup; -portBASE_TYPE xMatchFound = pdFALSE; +ListItem_t *pxListItem, *pxNext; +ListItem_t const *pxListEnd; +List_t *pxList; +EventBits_t uxBitsToClear = 0, uxBitsWaitedFor, uxControlBits; +EventGroup_t *pxEventBits = ( EventGroup_t * ) xEventGroup; +BaseType_t xMatchFound = pdFALSE; /* Check the user is not attempting to set the bits used by the kernel itself. */ @@ -466,10 +459,10 @@ portBASE_TYPE xMatchFound = pdFALSE; uxControlBits = uxBitsWaitedFor & eventEVENT_BITS_CONTROL_BYTES; uxBitsWaitedFor &= ~eventEVENT_BITS_CONTROL_BYTES; - if( ( uxControlBits & eventWAIT_FOR_ALL_BITS ) == ( xEventBitsType ) 0 ) + if( ( uxControlBits & eventWAIT_FOR_ALL_BITS ) == ( EventBits_t ) 0 ) { /* Just looking for single bit being set. */ - if( ( uxBitsWaitedFor & pxEventBits->uxEventBits ) != ( xEventBitsType ) 0 ) + if( ( uxBitsWaitedFor & pxEventBits->uxEventBits ) != ( EventBits_t ) 0 ) { xMatchFound = pdTRUE; } @@ -491,7 +484,7 @@ portBASE_TYPE xMatchFound = pdFALSE; if( xMatchFound != pdFALSE ) { /* The bits match. Should the bits be cleared on exit? */ - if( ( uxControlBits & eventCLEAR_EVENTS_ON_EXIT_BIT ) != ( xEventBitsType ) 0 ) + if( ( uxControlBits & eventCLEAR_EVENTS_ON_EXIT_BIT ) != ( EventBits_t ) 0 ) { uxBitsToClear |= uxBitsWaitedFor; } @@ -524,21 +517,21 @@ portBASE_TYPE xMatchFound = pdFALSE; } /*-----------------------------------------------------------*/ -void vEventGroupDelete( xEventGroupHandle xEventGroup ) +void vEventGroupDelete( EventGroupHandle_t xEventGroup ) { -xEVENT_BITS *pxEventBits = ( xEVENT_BITS * ) xEventGroup; -const xList *pxTasksWaitingForBits = &( pxEventBits->xTasksWaitingForBits ); +EventGroup_t *pxEventBits = ( EventGroup_t * ) xEventGroup; +const List_t *pxTasksWaitingForBits = &( pxEventBits->xTasksWaitingForBits ); vTaskSuspendAll(); { traceEVENT_GROUP_DELETE( xEventGroup ); - while( listCURRENT_LIST_LENGTH( pxTasksWaitingForBits ) > ( unsigned portBASE_TYPE ) 0 ) + while( listCURRENT_LIST_LENGTH( pxTasksWaitingForBits ) > ( UBaseType_t ) 0 ) { /* Unblock the task, returning 0 as the event list is being deleted and cannot therefore have any bits set. */ - configASSERT( pxTasksWaitingForBits->xListEnd.pxNext != ( xListItem * ) &( pxTasksWaitingForBits->xListEnd ) ); - ( void ) xTaskRemoveFromUnorderedEventList( pxTasksWaitingForBits->xListEnd.pxNext, ( portTickType ) eventUNBLOCKED_DUE_TO_BIT_SET ); + configASSERT( pxTasksWaitingForBits->xListEnd.pxNext != ( ListItem_t * ) &( pxTasksWaitingForBits->xListEnd ) ); + ( void ) xTaskRemoveFromUnorderedEventList( pxTasksWaitingForBits->xListEnd.pxNext, ( TickType_t ) eventUNBLOCKED_DUE_TO_BIT_SET ); } vPortFree( pxEventBits ); @@ -549,21 +542,21 @@ const xList *pxTasksWaitingForBits = &( pxEventBits->xTasksWaitingForBits ); /* For internal use only - execute a 'set bits' command that was pended from an interrupt. */ -void vEventGroupSetBitsCallback( void *pvEventGroup, const unsigned long ulBitsToSet ) +void vEventGroupSetBitsCallback( void *pvEventGroup, const uint32_t ulBitsToSet ) { - ( void ) xEventGroupSetBits( pvEventGroup, ( xEventBitsType ) ulBitsToSet ); + ( void ) xEventGroupSetBits( pvEventGroup, ( EventBits_t ) ulBitsToSet ); } /*-----------------------------------------------------------*/ -static portBASE_TYPE prvTestWaitCondition( const xEventBitsType uxCurrentEventBits, const xEventBitsType uxBitsToWaitFor, const portBASE_TYPE xWaitForAllBits ) +static BaseType_t prvTestWaitCondition( const EventBits_t uxCurrentEventBits, const EventBits_t uxBitsToWaitFor, const BaseType_t xWaitForAllBits ) { -portBASE_TYPE xWaitConditionMet = pdFALSE; +BaseType_t xWaitConditionMet = pdFALSE; if( xWaitForAllBits == pdFALSE ) { /* Task only has to wait for one bit within uxBitsToWaitFor to be set. Is one already set? */ - if( ( uxCurrentEventBits & uxBitsToWaitFor ) != ( xEventBitsType ) 0 ) + if( ( uxCurrentEventBits & uxBitsToWaitFor ) != ( EventBits_t ) 0 ) { xWaitConditionMet = pdTRUE; } diff --git a/FreeRTOS/Source/include/FreeRTOS.h b/FreeRTOS/Source/include/FreeRTOS.h index 9e557e0fe..b2539f4b5 100644 --- a/FreeRTOS/Source/include/FreeRTOS.h +++ b/FreeRTOS/Source/include/FreeRTOS.h @@ -71,6 +71,7 @@ * Include the generic headers required for the FreeRTOS port being used. */ #include +#include /* Basic FreeRTOS definitions. */ #include "projdefs.h" @@ -90,12 +91,12 @@ is included as it is used by the port layer. */ /* Defines the prototype to which the application task hook function must conform. */ -typedef portBASE_TYPE (*pdTASK_HOOK_CODE)( void * ); +typedef BaseType_t (*pdTASK_HOOK_CODE)( void * ); -/* The type that holds event bits always matches portTickType - therefore the +/* The type that holds event bits always matches TickType_t - therefore the number of bits it holds is set by configUSE_16_BIT_TICKS (16 bits if set to 1, 32 bits if set to 0. */ -typedef portTickType xEventBitsType; +typedef TickType_t EventBits_t; /* * Check all the required application specific macros have been defined. @@ -312,7 +313,7 @@ typedef portTickType xEventBitsType; #endif #ifndef portPOINTER_SIZE_TYPE - #define portPOINTER_SIZE_TYPE unsigned long + #define portPOINTER_SIZE_TYPE uint32_t #endif /* Remove any unused trace macros. */ @@ -618,7 +619,7 @@ typedef portTickType xEventBitsType; #endif #ifndef portPRIVILEGE_BIT - #define portPRIVILEGE_BIT ( ( unsigned portBASE_TYPE ) 0x00 ) + #define portPRIVILEGE_BIT ( ( UBaseType_t ) 0x00 ) #endif #ifndef portYIELD_WITHIN_API @@ -693,8 +694,20 @@ typedef portTickType xEventBitsType; #define mtCOVERAGE_TEST_MARKER() #endif -/* For backward compatability. */ +/* For backward compatibility. */ #define eTaskStateGet eTaskGetState +#define portTickType TickType_t +#define xTaskHandle TaskHandle_t +#define xQueueHandle QueueHandle_t +#define xSemaphoreHandle SemaphoreHandle_t +#define xQueueSetHandle QueueSetHandle_t +#define xQueueSetMemberHandle QueueSetMember_t +#define xTimeoutType TimeOut_t +#define xMemoryRegion MemoryRegion_t +#define xTaskParameters TaskParameters_t +#define xTaskStatusType TaskStatus_t +#define xTimerHandle TimerHandle_t +#define xCoRoutineHandle CoRoutineHandle_t #endif /* INC_FREERTOS_H */ diff --git a/FreeRTOS/Source/include/StackMacros.h b/FreeRTOS/Source/include/StackMacros.h index 2a72dd2bf..724438def 100644 --- a/FreeRTOS/Source/include/StackMacros.h +++ b/FreeRTOS/Source/include/StackMacros.h @@ -1,5 +1,5 @@ /* - FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. + FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. All rights reserved VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. @@ -108,7 +108,7 @@ /* Is the currently saved stack pointer within the stack limit? */ \ if( pxCurrentTCB->pxTopOfStack <= pxCurrentTCB->pxStack ) \ { \ - vApplicationStackOverflowHook( ( xTaskHandle ) pxCurrentTCB, pxCurrentTCB->pcTaskName ); \ + vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pxCurrentTCB->pcTaskName ); \ } \ } @@ -124,7 +124,7 @@ /* Is the currently saved stack pointer within the stack limit? */ \ if( pxCurrentTCB->pxTopOfStack >= pxCurrentTCB->pxEndOfStack ) \ { \ - vApplicationStackOverflowHook( ( xTaskHandle ) pxCurrentTCB, pxCurrentTCB->pcTaskName ); \ + vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pxCurrentTCB->pcTaskName ); \ } \ } @@ -133,20 +133,20 @@ #if( ( configCHECK_FOR_STACK_OVERFLOW > 1 ) && ( portSTACK_GROWTH < 0 ) ) - #define taskSECOND_CHECK_FOR_STACK_OVERFLOW() \ - { \ - static const unsigned char ucExpectedStackBytes[] = { tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \ - tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \ - tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \ - tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \ - tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE }; \ - \ - \ - /* Has the extremity of the task stack ever been written over? */ \ - if( memcmp( ( void * ) pxCurrentTCB->pxStack, ( void * ) ucExpectedStackBytes, sizeof( ucExpectedStackBytes ) ) != 0 ) \ - { \ - vApplicationStackOverflowHook( ( xTaskHandle ) pxCurrentTCB, pxCurrentTCB->pcTaskName ); \ - } \ + #define taskSECOND_CHECK_FOR_STACK_OVERFLOW() \ + { \ + static const uint8_t ucExpectedStackBytes[] = { tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \ + tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \ + tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \ + tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \ + tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE }; \ + \ + \ + /* Has the extremity of the task stack ever been written over? */ \ + if( memcmp( ( void * ) pxCurrentTCB->pxStack, ( void * ) ucExpectedStackBytes, sizeof( ucExpectedStackBytes ) ) != 0 ) \ + { \ + vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pxCurrentTCB->pcTaskName ); \ + } \ } #endif /* #if( configCHECK_FOR_STACK_OVERFLOW > 1 ) */ @@ -154,23 +154,23 @@ #if( ( configCHECK_FOR_STACK_OVERFLOW > 1 ) && ( portSTACK_GROWTH > 0 ) ) - #define taskSECOND_CHECK_FOR_STACK_OVERFLOW() \ - { \ - char *pcEndOfStack = ( char * ) pxCurrentTCB->pxEndOfStack; \ - static const unsigned char ucExpectedStackBytes[] = { tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \ - tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \ - tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \ - tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \ - tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE }; \ - \ - \ - pcEndOfStack -= sizeof( ucExpectedStackBytes ); \ - \ - /* Has the extremity of the task stack ever been written over? */ \ - if( memcmp( ( void * ) pcEndOfStack, ( void * ) ucExpectedStackBytes, sizeof( ucExpectedStackBytes ) ) != 0 ) \ - { \ - vApplicationStackOverflowHook( ( xTaskHandle ) pxCurrentTCB, pxCurrentTCB->pcTaskName ); \ - } \ + #define taskSECOND_CHECK_FOR_STACK_OVERFLOW() \ + { \ + int8_t *pcEndOfStack = ( int8_t * ) pxCurrentTCB->pxEndOfStack; \ + static const uint8_t ucExpectedStackBytes[] = { tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \ + tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \ + tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \ + tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \ + tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE }; \ + \ + \ + pcEndOfStack -= sizeof( ucExpectedStackBytes ); \ + \ + /* Has the extremity of the task stack ever been written over? */ \ + if( memcmp( ( void * ) pcEndOfStack, ( void * ) ucExpectedStackBytes, sizeof( ucExpectedStackBytes ) ) != 0 ) \ + { \ + vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pxCurrentTCB->pcTaskName ); \ + } \ } #endif /* #if( configCHECK_FOR_STACK_OVERFLOW > 1 ) */ diff --git a/FreeRTOS/Source/include/croutine.h b/FreeRTOS/Source/include/croutine.h index e42ff9232..965ec54c1 100644 --- a/FreeRTOS/Source/include/croutine.h +++ b/FreeRTOS/Source/include/croutine.h @@ -1,5 +1,5 @@ /* - FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. + FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. All rights reserved VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. @@ -79,28 +79,28 @@ extern "C" { /* Used to hide the implementation of the co-routine control block. The control block structure however has to be included in the header due to the macro implementation of the co-routine functionality. */ -typedef void * xCoRoutineHandle; +typedef void * CoRoutineHandle_t; /* Defines the prototype to which co-routine functions must conform. */ -typedef void (*crCOROUTINE_CODE)( xCoRoutineHandle, unsigned portBASE_TYPE ); +typedef void (*crCOROUTINE_CODE)( CoRoutineHandle_t, UBaseType_t ); typedef struct corCoRoutineControlBlock { - crCOROUTINE_CODE pxCoRoutineFunction; - xListItem xGenericListItem; /*< List item used to place the CRCB in ready and blocked queues. */ - xListItem xEventListItem; /*< List item used to place the CRCB in event lists. */ - unsigned portBASE_TYPE uxPriority; /*< The priority of the co-routine in relation to other co-routines. */ - unsigned portBASE_TYPE uxIndex; /*< Used to distinguish between co-routines when multiple co-routines use the same co-routine function. */ - unsigned short uxState; /*< Used internally by the co-routine implementation. */ -} corCRCB; /* Co-routine control block. Note must be identical in size down to uxPriority with tskTCB. */ + crCOROUTINE_CODE pxCoRoutineFunction; + ListItem_t xGenericListItem; /*< List item used to place the CRCB in ready and blocked queues. */ + ListItem_t xEventListItem; /*< List item used to place the CRCB in event lists. */ + UBaseType_t uxPriority; /*< The priority of the co-routine in relation to other co-routines. */ + UBaseType_t uxIndex; /*< Used to distinguish between co-routines when multiple co-routines use the same co-routine function. */ + uint16_t uxState; /*< Used internally by the co-routine implementation. */ +} CRCB_t; /* Co-routine control block. Note must be identical in size down to uxPriority with TCB_t. */ /** * croutine. h *
- portBASE_TYPE xCoRoutineCreate(
+ BaseType_t xCoRoutineCreate(
                                  crCOROUTINE_CODE pxCoRoutineCode,
-                                 unsigned portBASE_TYPE uxPriority,
-                                 unsigned portBASE_TYPE uxIndex
+                                 UBaseType_t uxPriority,
+                                 UBaseType_t uxIndex
                                );
* * Create a new co-routine and add it to the list of co-routines that are @@ -123,12 +123,12 @@ typedef struct corCoRoutineControlBlock * Example usage:
  // Co-routine to be created.
- void vFlashCoRoutine( xCoRoutineHandle xHandle, unsigned portBASE_TYPE uxIndex )
+ void vFlashCoRoutine( CoRoutineHandle_t xHandle, UBaseType_t uxIndex )
  {
  // Variables in co-routines must be declared static if they must maintain value across a blocking call.
  // This may not be necessary for const variables.
  static const char cLedToFlash[ 2 ] = { 5, 6 };
- static const portTickType uxFlashRates[ 2 ] = { 200, 400 };
+ static const TickType_t uxFlashRates[ 2 ] = { 200, 400 };
 
      // Must start every co-routine with a call to crSTART();
      crSTART( xHandle );
@@ -138,7 +138,7 @@ typedef struct corCoRoutineControlBlock
          // This co-routine just delays for a fixed period, then toggles
          // an LED.  Two co-routines are created using this function, so
          // the uxIndex parameter is used to tell the co-routine which
-         // LED to flash and how long to delay.  This assumes xQueue has
+         // LED to flash and how int32_t to delay.  This assumes xQueue has
          // already been created.
          vParTestToggleLED( cLedToFlash[ uxIndex ] );
          crDELAY( xHandle, uxFlashRates[ uxIndex ] );
@@ -151,9 +151,9 @@ typedef struct corCoRoutineControlBlock
  // Function that creates two co-routines.
  void vOtherFunction( void )
  {
- unsigned char ucParameterToPass;
- xTaskHandle xHandle;
-		
+ uint8_t ucParameterToPass;
+ TaskHandle_t xHandle;
+
      // Create two co-routines at priority 0.  The first is given index 0
      // so (from the code above) toggles LED 5 every 200 ticks.  The second
      // is given index 1 so toggles LED 6 every 400 ticks.
@@ -166,7 +166,7 @@ typedef struct corCoRoutineControlBlock
  * \defgroup xCoRoutineCreate xCoRoutineCreate
  * \ingroup Tasks
  */
-signed portBASE_TYPE xCoRoutineCreate( crCOROUTINE_CODE pxCoRoutineCode, unsigned portBASE_TYPE uxPriority, unsigned portBASE_TYPE uxIndex );
+BaseType_t xCoRoutineCreate( crCOROUTINE_CODE pxCoRoutineCode, UBaseType_t uxPriority, UBaseType_t uxIndex );
 
 
 /**
@@ -213,17 +213,17 @@ void vCoRoutineSchedule( void );
 /**
  * croutine. h
  * 
- crSTART( xCoRoutineHandle xHandle );
+ crSTART( CoRoutineHandle_t xHandle );
* * This macro MUST always be called at the start of a co-routine function. * * Example usage:
  // Co-routine to be created.
- void vACoRoutine( xCoRoutineHandle xHandle, unsigned portBASE_TYPE uxIndex )
+ void vACoRoutine( CoRoutineHandle_t xHandle, UBaseType_t uxIndex )
  {
  // Variables in co-routines must be declared static if they must maintain value across a blocking call.
- static long ulAVariable;
+ static int32_t ulAVariable;
 
      // Must start every co-routine with a call to crSTART();
      crSTART( xHandle );
@@ -239,7 +239,7 @@ void vCoRoutineSchedule( void );
  * \defgroup crSTART crSTART
  * \ingroup Tasks
  */
-#define crSTART( pxCRCB ) switch( ( ( corCRCB * )( pxCRCB ) )->uxState ) { case 0:
+#define crSTART( pxCRCB ) switch( ( ( CRCB_t * )( pxCRCB ) )->uxState ) { case 0:
 
 /**
  * croutine. h
@@ -251,10 +251,10 @@ void vCoRoutineSchedule( void );
  * Example usage:
    
  // Co-routine to be created.
- void vACoRoutine( xCoRoutineHandle xHandle, unsigned portBASE_TYPE uxIndex )
+ void vACoRoutine( CoRoutineHandle_t xHandle, UBaseType_t uxIndex )
  {
  // Variables in co-routines must be declared static if they must maintain value across a blocking call.
- static long ulAVariable;
+ static int32_t ulAVariable;
 
      // Must start every co-routine with a call to crSTART();
      crSTART( xHandle );
@@ -276,13 +276,13 @@ void vCoRoutineSchedule( void );
  * These macros are intended for internal use by the co-routine implementation
  * only.  The macros should not be used directly by application writers.
  */
-#define crSET_STATE0( xHandle ) ( ( corCRCB * )( xHandle ) )->uxState = (__LINE__ * 2); return; case (__LINE__ * 2):
-#define crSET_STATE1( xHandle ) ( ( corCRCB * )( xHandle ) )->uxState = ((__LINE__ * 2)+1); return; case ((__LINE__ * 2)+1):
+#define crSET_STATE0( xHandle ) ( ( CRCB_t * )( xHandle ) )->uxState = (__LINE__ * 2); return; case (__LINE__ * 2):
+#define crSET_STATE1( xHandle ) ( ( CRCB_t * )( xHandle ) )->uxState = ((__LINE__ * 2)+1); return; case ((__LINE__ * 2)+1):
 
 /**
  * croutine. h
  *
- crDELAY( xCoRoutineHandle xHandle, portTickType xTicksToDelay );
+ crDELAY( CoRoutineHandle_t xHandle, TickType_t xTicksToDelay );
* * Delay a co-routine for a fixed period of time. * @@ -301,7 +301,7 @@ void vCoRoutineSchedule( void ); * Example usage:
  // Co-routine to be created.
- void vACoRoutine( xCoRoutineHandle xHandle, unsigned portBASE_TYPE uxIndex )
+ void vACoRoutine( CoRoutineHandle_t xHandle, UBaseType_t uxIndex )
  {
  // Variables in co-routines must be declared static if they must maintain value across a blocking call.
  // This may not be necessary for const variables.
@@ -335,11 +335,11 @@ void vCoRoutineSchedule( void );
 /**
  * 
  crQUEUE_SEND(
-                  xCoRoutineHandle xHandle,
-                  xQueueHandle pxQueue,
+                  CoRoutineHandle_t xHandle,
+                  QueueHandle_t pxQueue,
                   void *pvItemToQueue,
-                  portTickType xTicksToWait,
-                  portBASE_TYPE *pxResult
+                  TickType_t xTicksToWait,
+                  BaseType_t *pxResult
              )
* * The macro's crQUEUE_SEND() and crQUEUE_RECEIVE() are the co-routine @@ -383,11 +383,11 @@ void vCoRoutineSchedule( void );
  // Co-routine function that blocks for a fixed period then posts a number onto
  // a queue.
- static void prvCoRoutineFlashTask( xCoRoutineHandle xHandle, unsigned portBASE_TYPE uxIndex )
+ static void prvCoRoutineFlashTask( CoRoutineHandle_t xHandle, UBaseType_t uxIndex )
  {
  // Variables in co-routines must be declared static if they must maintain value across a blocking call.
- static portBASE_TYPE xNumberToPost = 0;
- static portBASE_TYPE xResult;
+ static BaseType_t xNumberToPost = 0;
+ static BaseType_t xResult;
 
     // Co-routines must begin with a call to crSTART().
     crSTART( xHandle );
@@ -434,11 +434,11 @@ void vCoRoutineSchedule( void );
  * croutine. h
  * 
   crQUEUE_RECEIVE(
-                     xCoRoutineHandle xHandle,
-                     xQueueHandle pxQueue,
+                     CoRoutineHandle_t xHandle,
+                     QueueHandle_t pxQueue,
                      void *pvBuffer,
-                     portTickType xTicksToWait,
-                     portBASE_TYPE *pxResult
+                     TickType_t xTicksToWait,
+                     BaseType_t *pxResult
                  )
* * The macro's crQUEUE_SEND() and crQUEUE_RECEIVE() are the co-routine @@ -481,11 +481,11 @@ void vCoRoutineSchedule( void );
  // A co-routine receives the number of an LED to flash from a queue.  It
  // blocks on the queue until the number is received.
- static void prvCoRoutineFlashWorkTask( xCoRoutineHandle xHandle, unsigned portBASE_TYPE uxIndex )
+ static void prvCoRoutineFlashWorkTask( CoRoutineHandle_t xHandle, UBaseType_t uxIndex )
  {
  // Variables in co-routines must be declared static if they must maintain value across a blocking call.
- static portBASE_TYPE xResult;
- static unsigned portBASE_TYPE uxLEDToFlash;
+ static BaseType_t xResult;
+ static UBaseType_t uxLEDToFlash;
 
     // All co-routines must start with a call to crSTART().
     crSTART( xHandle );
@@ -526,9 +526,9 @@ void vCoRoutineSchedule( void );
  * croutine. h
  * 
   crQUEUE_SEND_FROM_ISR(
-                            xQueueHandle pxQueue,
+                            QueueHandle_t pxQueue,
                             void *pvItemToQueue,
-                            portBASE_TYPE xCoRoutinePreviouslyWoken
+                            BaseType_t xCoRoutinePreviouslyWoken
                        )
* * The macro's crQUEUE_SEND_FROM_ISR() and crQUEUE_RECEIVE_FROM_ISR() are the @@ -566,10 +566,10 @@ void vCoRoutineSchedule( void ); * Example usage:
  // A co-routine that blocks on a queue waiting for characters to be received.
- static void vReceivingCoRoutine( xCoRoutineHandle xHandle, unsigned portBASE_TYPE uxIndex )
+ static void vReceivingCoRoutine( CoRoutineHandle_t xHandle, UBaseType_t uxIndex )
  {
  char cRxedChar;
- portBASE_TYPE xResult;
+ BaseType_t xResult;
 
      // All co-routines must start with a call to crSTART().
      crSTART( xHandle );
@@ -596,7 +596,7 @@ void vCoRoutineSchedule( void );
  void vUART_ISR( void )
  {
  char cRxedChar;
- portBASE_TYPE xCRWokenByPost = pdFALSE;
+ BaseType_t xCRWokenByPost = pdFALSE;
 
      // We loop around reading characters until there are none left in the UART.
      while( UART_RX_REG_NOT_EMPTY() )
@@ -623,9 +623,9 @@ void vCoRoutineSchedule( void );
  * croutine. h
  * 
   crQUEUE_SEND_FROM_ISR(
-                            xQueueHandle pxQueue,
+                            QueueHandle_t pxQueue,
                             void *pvBuffer,
-                            portBASE_TYPE * pxCoRoutineWoken
+                            BaseType_t * pxCoRoutineWoken
                        )
* * The macro's crQUEUE_SEND_FROM_ISR() and crQUEUE_RECEIVE_FROM_ISR() are the @@ -664,12 +664,12 @@ void vCoRoutineSchedule( void );
  // A co-routine that posts a character to a queue then blocks for a fixed
  // period.  The character is incremented each time.
- static void vSendingCoRoutine( xCoRoutineHandle xHandle, unsigned portBASE_TYPE uxIndex )
+ static void vSendingCoRoutine( CoRoutineHandle_t xHandle, UBaseType_t uxIndex )
  {
  // cChar holds its value while this co-routine is blocked and must therefore
  // be declared static.
  static char cCharToTx = 'a';
- portBASE_TYPE xResult;
+ BaseType_t xResult;
 
      // All co-routines must start with a call to crSTART().
      crSTART( xHandle );
@@ -712,7 +712,7 @@ void vCoRoutineSchedule( void );
  void vUART_ISR( void )
  {
  char cCharToTx;
- portBASE_TYPE xCRWokenByPost = pdFALSE;
+ BaseType_t xCRWokenByPost = pdFALSE;
 
      while( UART_TX_REG_EMPTY() )
      {
@@ -740,7 +740,7 @@ void vCoRoutineSchedule( void );
  * Removes the current co-routine from its ready list and places it in the
  * appropriate delayed list.
  */
-void vCoRoutineAddToDelayedList( portTickType xTicksToDelay, xList *pxEventList );
+void vCoRoutineAddToDelayedList( TickType_t xTicksToDelay, List_t *pxEventList );
 
 /*
  * This function is intended for internal use by the queue implementation only.
@@ -749,7 +749,7 @@ void vCoRoutineAddToDelayedList( portTickType xTicksToDelay, xList *pxEventList
  * Removes the highest priority co-routine from the event list and places it in
  * the pending ready list.
  */
-signed portBASE_TYPE xCoRoutineRemoveFromEventList( const xList *pxEventList );
+BaseType_t xCoRoutineRemoveFromEventList( const List_t *pxEventList );
 
 #ifdef __cplusplus
 }
diff --git a/FreeRTOS/Source/include/event_groups.h b/FreeRTOS/Source/include/event_groups.h
index b10eb563f..6ede831ab 100644
--- a/FreeRTOS/Source/include/event_groups.h
+++ b/FreeRTOS/Source/include/event_groups.h
@@ -109,18 +109,18 @@ extern "C" {
  * event_groups.h
  *
  * Type by which event groups are referenced.  For example, a call to
- * xEventGroupCreate() returns an xEventGroupHandle variable that can then
+ * xEventGroupCreate() returns an EventGroupHandle_t variable that can then
  * be used as a parameter to other event group functions.
  *
- * \defgroup xEventGroupHandle xEventGroupHandle
+ * \defgroup EventGroupHandle_t EventGroupHandle_t
  * \ingroup EventGroup
  */
-typedef void * xEventGroupHandle;
+typedef void * EventGroupHandle_t;
 
 /**
  * event_groups.h
  *
- xEventGroupHandle xEventGroupCreate( void );
+ EventGroupHandle_t xEventGroupCreate( void );
  
* * Create a new event group. This function cannot be called from an interrupt. @@ -130,7 +130,7 @@ typedef void * xEventGroupHandle; * on the configUSE_16_BIT_TICKS setting in FreeRTOSConfig.h. If * configUSE_16_BIT_TICKS is 1 then each event group contains 8 usable bits (bit * 0 to bit 7). If configUSE_16_BIT_TICKS is set to 0 then each event group has - * 24 usable bits (bit 0 to bit 23). The xEventBitsType type is used to store + * 24 usable bits (bit 0 to bit 23). The EventBits_t type is used to store * event bits within an event group. * * @return If the event group was created then a handle to the event group is @@ -140,7 +140,7 @@ typedef void * xEventGroupHandle; * Example usage:
 	// Declare a variable to hold the created event group.
-	xEventGroupHandle xCreatedEventGroup;
+	EventGroupHandle_t xCreatedEventGroup;
 
 	// Attempt to create the event group.
 	xCreatedEventGroup = xEventGroupCreate();
@@ -159,16 +159,16 @@ typedef void * xEventGroupHandle;
  * \defgroup xEventGroupCreate xEventGroupCreate
  * \ingroup EventGroup
  */
-xEventGroupHandle xEventGroupCreate( void ) PRIVILEGED_FUNCTION;
+EventGroupHandle_t xEventGroupCreate( void ) PRIVILEGED_FUNCTION;
 
 /**
  * event_groups.h
  *
-	xEventBitsType xEventGroupWaitBits( xEventGroupHandle xEventGroup,
-										const xEventBitsType uxBitsToWaitFor,
-										const portBASE_TYPE xClearOnExit,
-										const portBASE_TYPE xWaitForAllBits,
-										const portTickType xTicksToWait );
+	EventBits_t xEventGroupWaitBits( 	EventGroupHandle_t xEventGroup,
+										const EventBits_t uxBitsToWaitFor,
+										const BaseType_t xClearOnExit,
+										const BaseType_t xWaitForAllBits,
+										const TickType_t xTicksToWait );
  
* * [Potentially] block to wait for one or more bits to be set within a @@ -217,10 +217,10 @@ xEventGroupHandle xEventGroupCreate( void ) PRIVILEGED_FUNCTION; #define BIT_0 ( 1 << 0 ) #define BIT_4 ( 1 << 4 ) - void aFunction( xEventGroupHandle xEventGroup ) + void aFunction( EventGroupHandle_t xEventGroup ) { - xEventBitsType uxBits; - const portTickType xTicksToWait = 100 / portTICK_RATE_MS; + EventBits_t uxBits; + const TickType_t xTicksToWait = 100 / portTICK_RATE_MS; // Wait a maximum of 100ms for either bit 0 or bit 4 to be set within // the event group. Clear the bits before exiting. @@ -253,12 +253,12 @@ xEventGroupHandle xEventGroupCreate( void ) PRIVILEGED_FUNCTION; * \defgroup xEventGroupWaitBits xEventGroupWaitBits * \ingroup EventGroup */ -xEventBitsType xEventGroupWaitBits( xEventGroupHandle xEventGroup, const xEventBitsType uxBitsToWaitFor, const portBASE_TYPE xClearOnExit, const portBASE_TYPE xWaitForAllBits, portTickType xTicksToWait ) PRIVILEGED_FUNCTION; +EventBits_t xEventGroupWaitBits( EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToWaitFor, const BaseType_t xClearOnExit, const BaseType_t xWaitForAllBits, TickType_t xTicksToWait ) PRIVILEGED_FUNCTION; /** * event_groups.h *
-	xEventBitsType xEventGroupClearBits( xEventGroupHandle xEventGroup, const xEventBitsType uxBitsToClear );
+	EventBits_t xEventGroupClearBits( EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToClear );
  
* * Clear bits within an event group. This function cannot be called from an @@ -277,9 +277,9 @@ xEventBitsType xEventGroupWaitBits( xEventGroupHandle xEventGroup, const xEventB #define BIT_0 ( 1 << 0 ) #define BIT_4 ( 1 << 4 ) - void aFunction( xEventGroupHandle xEventGroup ) + void aFunction( EventGroupHandle_t xEventGroup ) { - xEventBitsType uxBits; + EventBits_t uxBits; // Clear bit 0 and bit 4 in xEventGroup. uxBits = xEventGroupClearBits( @@ -310,12 +310,12 @@ xEventBitsType xEventGroupWaitBits( xEventGroupHandle xEventGroup, const xEventB * \defgroup xEventGroupClearBits xEventGroupClearBits * \ingroup EventGroup */ -xEventBitsType xEventGroupClearBits( xEventGroupHandle xEventGroup, const xEventBitsType uxBitsToClear ) PRIVILEGED_FUNCTION; +EventBits_t xEventGroupClearBits( EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToClear ) PRIVILEGED_FUNCTION; /** * event_groups.h *
-	xEventBitsType xEventGroupSetBits( xEventGroupHandle xEventGroup, const xEventBitsType uxBitsToSet );
+	EventBits_t xEventGroupSetBits( EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToSet );
  
* * Set bits within an event group. @@ -346,9 +346,9 @@ xEventBitsType xEventGroupClearBits( xEventGroupHandle xEventGroup, const xEvent #define BIT_0 ( 1 << 0 ) #define BIT_4 ( 1 << 4 ) - void aFunction( xEventGroupHandle xEventGroup ) + void aFunction( EventGroupHandle_t xEventGroup ) { - xEventBitsType uxBits; + EventBits_t uxBits; // Set bit 0 and bit 4 in xEventGroup. uxBits = xEventGroupSetBits( @@ -384,12 +384,12 @@ xEventBitsType xEventGroupClearBits( xEventGroupHandle xEventGroup, const xEvent * \defgroup xEventGroupSetBits xEventGroupSetBits * \ingroup EventGroup */ -xEventBitsType xEventGroupSetBits( xEventGroupHandle xEventGroup, const xEventBitsType uxBitsToSet ) PRIVILEGED_FUNCTION; +EventBits_t xEventGroupSetBits( EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToSet ) PRIVILEGED_FUNCTION; /** * event_groups.h *
-	xEventBitsType xEventGroupSetBitsFromISR( xEventGroupHandle xEventGroup, const xEventBitsType uxBitsToSet, portBASE_TYPE *pxHigherPriorityTaskWoken );
+	EventBits_t xEventGroupSetBitsFromISR( EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToSet, BaseType_t *pxHigherPriorityTaskWoken );
  
* * A version of xEventGroupSetBits() that can be called from an interrupt. @@ -429,11 +429,11 @@ xEventBitsType xEventGroupSetBits( xEventGroupHandle xEventGroup, const xEventBi // An event group which it is assumed has already been created by a call to // xEventGroupCreate(). - xEventGroupHandle xEventGroup; + EventGroupHandle_t xEventGroup; void anInterruptHandler( void ) { - portBASE_TYPE xHigherPriorityTaskWoken; + BaseType_t xHigherPriorityTaskWoken; // xHigherPriorityTaskWoken must be initialised to pdFALSE. xHigherPriorityTaskWoken = pdFALSE; @@ -454,15 +454,15 @@ xEventBitsType xEventGroupSetBits( xEventGroupHandle xEventGroup, const xEventBi * \defgroup xEventGroupSetBitsFromISR xEventGroupSetBitsFromISR * \ingroup EventGroup */ -#define xEventGroupSetBitsFromISR( xEventGroup, uxBitsToSet, pxHigherPriorityTaskWoken ) xTimerPendCallbackFromISR( vEventGroupSetBitsCallback, ( void * ) xEventGroup, ( unsigned long ) uxBitsToSet, pxHigherPriorityTaskWoken ) +#define xEventGroupSetBitsFromISR( xEventGroup, uxBitsToSet, pxHigherPriorityTaskWoken ) xTimerPendCallbackFromISR( vEventGroupSetBitsCallback, ( void * ) xEventGroup, ( uint32_t ) uxBitsToSet, pxHigherPriorityTaskWoken ) /** * event_groups.h *
-	xEventBitsType xEventGroupSync(	xEventGroupHandle xEventGroup,
-									const xEventBitsType uxBitsToSet,
-									const xEventBitsType uxBitsToWaitFor,
-									portTickType xTicksToWait );
+	EventBits_t xEventGroupSync(	EventGroupHandle_t xEventGroup,
+									const EventBits_t uxBitsToSet,
+									const EventBits_t uxBitsToWaitFor,
+									TickType_t xTicksToWait );
  
* * Atomically set bits within an event group, then wait for a combination of @@ -512,12 +512,12 @@ xEventBitsType xEventGroupSetBits( xEventGroupHandle xEventGroup, const xEventBi // Use an event group to synchronise three tasks. It is assumed this event // group has already been created elsewhere. - xEventGroupHandle xEventBits; + EventGroupHandle_t xEventBits; void vTask0( void *pvParameters ) { - xEventBitsType uxReturn; - portTickType xTicksToWait = 100 / portTICK_RATE_MS; + EventBits_t uxReturn; + TickType_t xTicksToWait = 100 / portTICK_RATE_MS; for( ;; ) { @@ -580,13 +580,13 @@ xEventBitsType xEventGroupSetBits( xEventGroupHandle xEventGroup, const xEventBi * \defgroup xEventGroupSync xEventGroupSync * \ingroup EventGroup */ -xEventBitsType xEventGroupSync( xEventGroupHandle xEventGroup, const xEventBitsType uxBitsToSet, const xEventBitsType uxBitsToWaitFor, portTickType xTicksToWait ) PRIVILEGED_FUNCTION; +EventBits_t xEventGroupSync( EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToSet, const EventBits_t uxBitsToWaitFor, TickType_t xTicksToWait ) PRIVILEGED_FUNCTION; /** * event_groups.h *
-	xEventBitsType xEventGroupGetBits( xEventGroupHandle xEventGroup );
+	EventBits_t xEventGroupGetBits( EventGroupHandle_t xEventGroup );
  
* * Returns the current value of the bits in an event group. This function @@ -604,7 +604,7 @@ xEventBitsType xEventGroupSync( xEventGroupHandle xEventGroup, const xEventBitsT /** * event_groups.h *
-	void xEventGroupDelete( xEventGroupHandle xEventGroup );
+	void xEventGroupDelete( EventGroupHandle_t xEventGroup );
  
* * Delete an event group that was previously created by a call to @@ -613,10 +613,10 @@ xEventBitsType xEventGroupSync( xEventGroupHandle xEventGroup, const xEventBitsT * * @param xEventGroup The event group being deleted. */ -void vEventGroupDelete( xEventGroupHandle xEventGroup ); +void vEventGroupDelete( EventGroupHandle_t xEventGroup ); /* For internal use only. */ -void vEventGroupSetBitsCallback( void *pvEventGroup, const unsigned long ulBitsToSet ); +void vEventGroupSetBitsCallback( void *pvEventGroup, const uint32_t ulBitsToSet ); #ifdef __cplusplus diff --git a/FreeRTOS/Source/include/list.h b/FreeRTOS/Source/include/list.h index 41f269e06..3d2c1ca0a 100644 --- a/FreeRTOS/Source/include/list.h +++ b/FreeRTOS/Source/include/list.h @@ -68,7 +68,7 @@ * heavily for the schedulers needs, it is also available for use by * application code. * - * xLists can only store pointers to xListItems. Each xListItem contains a + * list_ts can only store pointers to list_item_ts. Each ListItem_t contains a * numeric value (xItemValue). Most of the time the lists are sorted in * descending item value order. * @@ -135,31 +135,31 @@ extern "C" { */ struct xLIST_ITEM { - configLIST_VOLATILE portTickType xItemValue; /*< The value being listed. In most cases this is used to sort the list in descending order. */ - struct xLIST_ITEM * configLIST_VOLATILE pxNext; /*< Pointer to the next xListItem in the list. */ - struct xLIST_ITEM * configLIST_VOLATILE pxPrevious;/*< Pointer to the previous xListItem in the list. */ - void * pvOwner; /*< Pointer to the object (normally a TCB) that contains the list item. There is therefore a two way link between the object containing the list item and the list item itself. */ - void * configLIST_VOLATILE pvContainer; /*< Pointer to the list in which this list item is placed (if any). */ + configLIST_VOLATILE TickType_t xItemValue; /*< The value being listed. In most cases this is used to sort the list in descending order. */ + struct xLIST_ITEM * configLIST_VOLATILE pxNext; /*< Pointer to the next ListItem_t in the list. */ + struct xLIST_ITEM * configLIST_VOLATILE pxPrevious; /*< Pointer to the previous ListItem_t in the list. */ + void * pvOwner; /*< Pointer to the object (normally a TCB) that contains the list item. There is therefore a two way link between the object containing the list item and the list item itself. */ + void * configLIST_VOLATILE pvContainer; /*< Pointer to the list in which this list item is placed (if any). */ }; -typedef struct xLIST_ITEM xListItem; /* For some reason lint wants this as two separate definitions. */ +typedef struct xLIST_ITEM ListItem_t; /* For some reason lint wants this as two separate definitions. */ struct xMINI_LIST_ITEM { - configLIST_VOLATILE portTickType xItemValue; + configLIST_VOLATILE TickType_t xItemValue; struct xLIST_ITEM * configLIST_VOLATILE pxNext; struct xLIST_ITEM * configLIST_VOLATILE pxPrevious; }; -typedef struct xMINI_LIST_ITEM xMiniListItem; +typedef struct xMINI_LIST_ITEM MiniListItem_t; /* * Definition of the type of queue used by the scheduler. */ typedef struct xLIST { - configLIST_VOLATILE unsigned portBASE_TYPE uxNumberOfItems; - xListItem * configLIST_VOLATILE pxIndex; /*< Used to walk through the list. Points to the last item returned by a call to listGET_OWNER_OF_NEXT_ENTRY (). */ - xMiniListItem xListEnd; /*< List item that contains the maximum possible item value meaning it is always at the end of the list and is therefore used as a marker. */ -} xList; + configLIST_VOLATILE UBaseType_t uxNumberOfItems; + ListItem_t * configLIST_VOLATILE pxIndex; /*< Used to walk through the list. Points to the last item returned by a call to listGET_OWNER_OF_NEXT_ENTRY (). */ + MiniListItem_t xListEnd; /*< List item that contains the maximum possible item value meaning it is always at the end of the list and is therefore used as a marker. */ +} List_t; /* * Access macro to set the owner of a list item. The owner of a list item @@ -177,7 +177,7 @@ typedef struct xLIST * \page listSET_LIST_ITEM_OWNER listSET_LIST_ITEM_OWNER * \ingroup LinkedList */ -#define listGET_LIST_ITEM_OWNER( pxListItem ) ( ( pxListItem )->pvOwner ) +#define listGET_LIST_ITEM_OWNER( pxListItem ) ( ( pxListItem )->pvOwner ) /* * Access macro to set the value of the list item. In most cases the value is @@ -186,7 +186,7 @@ typedef struct xLIST * \page listSET_LIST_ITEM_VALUE listSET_LIST_ITEM_VALUE * \ingroup LinkedList */ -#define listSET_LIST_ITEM_VALUE( pxListItem, xValue ) ( ( pxListItem )->xItemValue = ( xValue ) ) +#define listSET_LIST_ITEM_VALUE( pxListItem, xValue ) ( ( pxListItem )->xItemValue = ( xValue ) ) /* * Access macro to retrieve the value of the list item. The value can @@ -196,7 +196,7 @@ typedef struct xLIST * \page listGET_LIST_ITEM_VALUE listGET_LIST_ITEM_VALUE * \ingroup LinkedList */ -#define listGET_LIST_ITEM_VALUE( pxListItem ) ( ( pxListItem )->xItemValue ) +#define listGET_LIST_ITEM_VALUE( pxListItem ) ( ( pxListItem )->xItemValue ) /* * Access macro to retrieve the value of the list item at the head of a given @@ -205,7 +205,7 @@ typedef struct xLIST * \page listGET_LIST_ITEM_VALUE listGET_LIST_ITEM_VALUE * \ingroup LinkedList */ -#define listGET_ITEM_VALUE_OF_HEAD_ENTRY( pxList ) ( ( ( pxList )->xListEnd ).pxNext->xItemValue ) +#define listGET_ITEM_VALUE_OF_HEAD_ENTRY( pxList ) ( ( ( pxList )->xListEnd ).pxNext->xItemValue ) /* * Return the list item at the head of the list. @@ -213,7 +213,7 @@ typedef struct xLIST * \page listGET_HEAD_ENTRY listGET_HEAD_ENTRY * \ingroup LinkedList */ -#define listGET_HEAD_ENTRY( pxList ) ( ( ( pxList )->xListEnd ).pxNext ) +#define listGET_HEAD_ENTRY( pxList ) ( ( ( pxList )->xListEnd ).pxNext ) /* * Return the list item at the head of the list. @@ -221,7 +221,7 @@ typedef struct xLIST * \page listGET_HEAD_ENTRY listGET_HEAD_ENTRY * \ingroup LinkedList */ -#define listGET_NEXT( pxListItem ) ( ( pxListItem )->pxNext ) +#define listGET_NEXT( pxListItem ) ( ( pxListItem )->pxNext ) /* * Return the list item that marks the end of the list @@ -229,7 +229,7 @@ typedef struct xLIST * \page listGET_END_MARKER listGET_END_MARKER * \ingroup LinkedList */ -#define listGET_END_MARKER( pxList ) ( ( xListItem const * ) ( &( ( pxList )->xListEnd ) ) ) +#define listGET_END_MARKER( pxList ) ( ( ListItem_t const * ) ( &( ( pxList )->xListEnd ) ) ) /* * Access macro to determine if a list contains any items. The macro will @@ -238,12 +238,12 @@ typedef struct xLIST * \page listLIST_IS_EMPTY listLIST_IS_EMPTY * \ingroup LinkedList */ -#define listLIST_IS_EMPTY( pxList ) ( ( portBASE_TYPE ) ( ( pxList )->uxNumberOfItems == ( unsigned portBASE_TYPE ) 0 ) ) +#define listLIST_IS_EMPTY( pxList ) ( ( BaseType_t ) ( ( pxList )->uxNumberOfItems == ( UBaseType_t ) 0 ) ) /* * Access macro to return the number of items in the list. */ -#define listCURRENT_LIST_LENGTH( pxList ) ( ( pxList )->uxNumberOfItems ) +#define listCURRENT_LIST_LENGTH( pxList ) ( ( pxList )->uxNumberOfItems ) /* * Access function to obtain the owner of the next entry in a list. @@ -267,7 +267,7 @@ typedef struct xLIST */ #define listGET_OWNER_OF_NEXT_ENTRY( pxTCB, pxList ) \ { \ -xList * const pxConstList = ( pxList ); \ +List_t * const pxConstList = ( pxList ); \ /* Increment the index to the next item and return the item, ensuring */ \ /* we don't return the marker used at the end of the list. */ \ ( pxConstList )->pxIndex = ( pxConstList )->pxIndex->pxNext; \ @@ -306,13 +306,13 @@ xList * const pxConstList = ( pxList ); \ * @param pxListItem The list item we want to know if is in the list. * @return pdTRUE if the list item is in the list, otherwise pdFALSE. */ -#define listIS_CONTAINED_WITHIN( pxList, pxListItem ) ( ( portBASE_TYPE ) ( ( pxListItem )->pvContainer == ( void * ) ( pxList ) ) ) +#define listIS_CONTAINED_WITHIN( pxList, pxListItem ) ( ( BaseType_t ) ( ( pxListItem )->pvContainer == ( void * ) ( pxList ) ) ) /* * Return the list a list item is contained within (referenced from). * * @param pxListItem The list item being queried. - * @return A pointer to the xList object that references the pxListItem + * @return A pointer to the List_t object that references the pxListItem */ #define listLIST_ITEM_CONTAINER( pxListItem ) ( ( pxListItem )->pvContainer ) @@ -333,7 +333,7 @@ xList * const pxConstList = ( pxList ); \ * \page vListInitialise vListInitialise * \ingroup LinkedList */ -void vListInitialise( xList * const pxList ); +void vListInitialise( List_t * const pxList ); /* * Must be called before a list item is used. This sets the list container to @@ -344,7 +344,7 @@ void vListInitialise( xList * const pxList ); * \page vListInitialiseItem vListInitialiseItem * \ingroup LinkedList */ -void vListInitialiseItem( xListItem * const pxItem ); +void vListInitialiseItem( ListItem_t * const pxItem ); /* * Insert a list item into a list. The item will be inserted into the list in @@ -357,7 +357,7 @@ void vListInitialiseItem( xListItem * const pxItem ); * \page vListInsert vListInsert * \ingroup LinkedList */ -void vListInsert( xList * const pxList, xListItem * const pxNewListItem ); +void vListInsert( List_t * const pxList, ListItem_t * const pxNewListItem ); /* * Insert a list item into a list. The item will be inserted in a position @@ -378,7 +378,7 @@ void vListInsert( xList * const pxList, xListItem * const pxNewListItem ); * \page vListInsertEnd vListInsertEnd * \ingroup LinkedList */ -void vListInsertEnd( xList * const pxList, xListItem * const pxNewListItem ); +void vListInsertEnd( List_t * const pxList, ListItem_t * const pxNewListItem ); /* * Remove an item from a list. The list item has a pointer to the list that @@ -393,7 +393,7 @@ void vListInsertEnd( xList * const pxList, xListItem * const pxNewListItem ); * \page uxListRemove uxListRemove * \ingroup LinkedList */ -unsigned portBASE_TYPE uxListRemove( xListItem * const pxItemToRemove ); +UBaseType_t uxListRemove( ListItem_t * const pxItemToRemove ); #ifdef __cplusplus } diff --git a/FreeRTOS/Source/include/portable.h b/FreeRTOS/Source/include/portable.h index 9af5eb27d..b28ecfdfe 100644 --- a/FreeRTOS/Source/include/portable.h +++ b/FreeRTOS/Source/include/portable.h @@ -70,8 +70,10 @@ #ifndef PORTABLE_H #define PORTABLE_H -/* Include the macro file relevant to the port being used. */ - +/* Include the macro file relevant to the port being used. +NOTE: The following definitions are *DEPRECATED* as it is preferred to instead +just add the path to the correct portmacro.h header file to the compiler's +include path. */ #ifdef OPEN_WATCOM_INDUSTRIAL_PC_PORT #include "..\..\Source\portable\owatcom\16bitdos\pc\portmacro.h" typedef void ( __interrupt __far *pxISR )(); @@ -356,9 +358,9 @@ extern "C" { * */ #if( portUSING_MPU_WRAPPERS == 1 ) - portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters, portBASE_TYPE xRunPrivileged ) PRIVILEGED_FUNCTION; + StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters, BaseType_t xRunPrivileged ) PRIVILEGED_FUNCTION; #else - portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) PRIVILEGED_FUNCTION; + StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) PRIVILEGED_FUNCTION; #endif /* @@ -374,7 +376,7 @@ size_t xPortGetMinimumEverFreeHeapSize( void ) PRIVILEGED_FUNCTION; * Setup the hardware ready for the scheduler to take control. This generally * sets up a tick interrupt and sets timers for the correct tick frequency. */ -portBASE_TYPE xPortStartScheduler( void ) PRIVILEGED_FUNCTION; +BaseType_t xPortStartScheduler( void ) PRIVILEGED_FUNCTION; /* * Undo any hardware/ISR setup that was performed by xPortStartScheduler() so @@ -392,7 +394,7 @@ void vPortEndScheduler( void ) PRIVILEGED_FUNCTION; */ #if( portUSING_MPU_WRAPPERS == 1 ) struct xMEMORY_REGION; - void vPortStoreTaskMPUSettings( xMPU_SETTINGS *xMPUSettings, const struct xMEMORY_REGION * const xRegions, portSTACK_TYPE *pxBottomOfStack, unsigned short usStackDepth ) PRIVILEGED_FUNCTION; + void vPortStoreTaskMPUSettings( xMPU_SETTINGS *xMPUSettings, const struct xMEMORY_REGION * const xRegions, StackType_t *pxBottomOfStack, uint16_t usStackDepth ) PRIVILEGED_FUNCTION; #endif #ifdef __cplusplus diff --git a/FreeRTOS/Source/include/projdefs.h b/FreeRTOS/Source/include/projdefs.h index 766424dbf..2d2259695 100644 --- a/FreeRTOS/Source/include/projdefs.h +++ b/FreeRTOS/Source/include/projdefs.h @@ -71,15 +71,15 @@ typedef void (*pdTASK_CODE)( void * ); /* Defines the prototype to which callback functions called from the RTOS/timer daemon task must conform. */ -typedef void (*pdAPPLICATION_CALLBACK_CODE)( void *, unsigned long ); +typedef void (*pdAPPLICATION_CALLBACK_CODE)( void *, uint32_t ); -#define pdFALSE ( ( portBASE_TYPE ) 0 ) -#define pdTRUE ( ( portBASE_TYPE ) 1 ) +#define pdFALSE ( ( BaseType_t ) 0 ) +#define pdTRUE ( ( BaseType_t ) 1 ) -#define pdPASS ( pdTRUE ) -#define pdFAIL ( pdFALSE ) -#define errQUEUE_EMPTY ( ( portBASE_TYPE ) 0 ) -#define errQUEUE_FULL ( ( portBASE_TYPE ) 0 ) +#define pdPASS ( pdTRUE ) +#define pdFAIL ( pdFALSE ) +#define errQUEUE_EMPTY ( ( BaseType_t ) 0 ) +#define errQUEUE_FULL ( ( BaseType_t ) 0 ) /* Error definitions. */ #define errCOULD_NOT_ALLOCATE_REQUIRED_MEMORY ( -1 ) diff --git a/FreeRTOS/Source/include/queue.h b/FreeRTOS/Source/include/queue.h index 5a4b81ae7..1d86d2e16 100644 --- a/FreeRTOS/Source/include/queue.h +++ b/FreeRTOS/Source/include/queue.h @@ -78,44 +78,44 @@ extern "C" { /** * Type by which queues are referenced. For example, a call to xQueueCreate() - * returns an xQueueHandle variable that can then be used as a parameter to + * returns an QueueHandle_t variable that can then be used as a parameter to * xQueueSend(), xQueueReceive(), etc. */ -typedef void * xQueueHandle; +typedef void * QueueHandle_t; /** * Type by which queue sets are referenced. For example, a call to * xQueueCreateSet() returns an xQueueSet variable that can then be used as a * parameter to xQueueSelectFromSet(), xQueueAddToSet(), etc. */ -typedef void * xQueueSetHandle; +typedef void * QueueSetHandle_t; /** * Queue sets can contain both queues and semaphores, so the - * xQueueSetMemberHandle is defined as a type to be used where a parameter or - * return value can be either an xQueueHandle or an xSemaphoreHandle. + * QueueSetMember_t is defined as a type to be used where a parameter or + * return value can be either an QueueHandle_t or an SemaphoreHandle_t. */ -typedef void * xQueueSetMemberHandle; +typedef void * QueueSetMember_t; /* For internal use only. */ -#define queueSEND_TO_BACK ( ( portBASE_TYPE ) 0 ) -#define queueSEND_TO_FRONT ( ( portBASE_TYPE ) 1 ) -#define queueOVERWRITE ( ( portBASE_TYPE ) 2 ) +#define queueSEND_TO_BACK ( ( BaseType_t ) 0 ) +#define queueSEND_TO_FRONT ( ( BaseType_t ) 1 ) +#define queueOVERWRITE ( ( BaseType_t ) 2 ) /* For internal use only. These definitions *must* match those in queue.c. */ -#define queueQUEUE_TYPE_BASE ( ( unsigned char ) 0U ) -#define queueQUEUE_TYPE_SET ( ( unsigned char ) 0U ) -#define queueQUEUE_TYPE_MUTEX ( ( unsigned char ) 1U ) -#define queueQUEUE_TYPE_COUNTING_SEMAPHORE ( ( unsigned char ) 2U ) -#define queueQUEUE_TYPE_BINARY_SEMAPHORE ( ( unsigned char ) 3U ) -#define queueQUEUE_TYPE_RECURSIVE_MUTEX ( ( unsigned char ) 4U ) +#define queueQUEUE_TYPE_BASE ( ( uint8_t ) 0U ) +#define queueQUEUE_TYPE_SET ( ( uint8_t ) 0U ) +#define queueQUEUE_TYPE_MUTEX ( ( uint8_t ) 1U ) +#define queueQUEUE_TYPE_COUNTING_SEMAPHORE ( ( uint8_t ) 2U ) +#define queueQUEUE_TYPE_BINARY_SEMAPHORE ( ( uint8_t ) 3U ) +#define queueQUEUE_TYPE_RECURSIVE_MUTEX ( ( uint8_t ) 4U ) /** * queue. h *
- xQueueHandle xQueueCreate(
-							  unsigned portBASE_TYPE uxQueueLength,
-							  unsigned portBASE_TYPE uxItemSize
+ QueueHandle_t xQueueCreate(
+							  UBaseType_t uxQueueLength,
+							  UBaseType_t uxItemSize
 						  );
  * 
* @@ -143,10 +143,10 @@ typedef void * xQueueSetMemberHandle; void vATask( void *pvParameters ) { - xQueueHandle xQueue1, xQueue2; + QueueHandle_t xQueue1, xQueue2; - // Create a queue capable of containing 10 unsigned long values. - xQueue1 = xQueueCreate( 10, sizeof( unsigned long ) ); + // Create a queue capable of containing 10 uint32_t values. + xQueue1 = xQueueCreate( 10, sizeof( uint32_t ) ); if( xQueue1 == 0 ) { // Queue was not created and must not be used. @@ -171,10 +171,10 @@ typedef void * xQueueSetMemberHandle; /** * queue. h *
- portBASE_TYPE xQueueSendToToFront(
-								   xQueueHandle	xQueue,
+ BaseType_t xQueueSendToToFront(
+								   QueueHandle_t	xQueue,
 								   const void	*	pvItemToQueue,
-								   portTickType	xTicksToWait
+								   TickType_t	xTicksToWait
 							   );
  * 
* @@ -208,15 +208,15 @@ typedef void * xQueueSetMemberHandle; char ucData[ 20 ]; } xMessage; - unsigned long ulVar = 10UL; + uint32_t ulVar = 10UL; void vATask( void *pvParameters ) { - xQueueHandle xQueue1, xQueue2; + QueueHandle_t xQueue1, xQueue2; struct AMessage *pxMessage; - // Create a queue capable of containing 10 unsigned long values. - xQueue1 = xQueueCreate( 10, sizeof( unsigned long ) ); + // Create a queue capable of containing 10 uint32_t values. + xQueue1 = xQueueCreate( 10, sizeof( uint32_t ) ); // Create a queue capable of containing 10 pointers to AMessage structures. // These should be passed by pointer as they contain a lot of data. @@ -226,9 +226,9 @@ typedef void * xQueueSetMemberHandle; if( xQueue1 != 0 ) { - // Send an unsigned long. Wait for 10 ticks for space to become + // Send an uint32_t. Wait for 10 ticks for space to become // available if necessary. - if( xQueueSendToFront( xQueue1, ( void * ) &ulVar, ( portTickType ) 10 ) != pdPASS ) + if( xQueueSendToFront( xQueue1, ( void * ) &ulVar, ( TickType_t ) 10 ) != pdPASS ) { // Failed to post the message, even after 10 ticks. } @@ -239,7 +239,7 @@ typedef void * xQueueSetMemberHandle; // Send a pointer to a struct AMessage object. Don't block if the // queue is already full. pxMessage = & xMessage; - xQueueSendToFront( xQueue2, ( void * ) &pxMessage, ( portTickType ) 0 ); + xQueueSendToFront( xQueue2, ( void * ) &pxMessage, ( TickType_t ) 0 ); } // ... Rest of task code. @@ -253,10 +253,10 @@ typedef void * xQueueSetMemberHandle; /** * queue. h *
- portBASE_TYPE xQueueSendToBack(
-								   xQueueHandle	xQueue,
-								   const	void	*	pvItemToQueue,
-								   portTickType	xTicksToWait
+ BaseType_t xQueueSendToBack(
+								   QueueHandle_t	xQueue,
+								   const void		*pvItemToQueue,
+								   TickType_t		xTicksToWait
 							   );
  * 
* @@ -290,15 +290,15 @@ typedef void * xQueueSetMemberHandle; char ucData[ 20 ]; } xMessage; - unsigned long ulVar = 10UL; + uint32_t ulVar = 10UL; void vATask( void *pvParameters ) { - xQueueHandle xQueue1, xQueue2; + QueueHandle_t xQueue1, xQueue2; struct AMessage *pxMessage; - // Create a queue capable of containing 10 unsigned long values. - xQueue1 = xQueueCreate( 10, sizeof( unsigned long ) ); + // Create a queue capable of containing 10 uint32_t values. + xQueue1 = xQueueCreate( 10, sizeof( uint32_t ) ); // Create a queue capable of containing 10 pointers to AMessage structures. // These should be passed by pointer as they contain a lot of data. @@ -308,9 +308,9 @@ typedef void * xQueueSetMemberHandle; if( xQueue1 != 0 ) { - // Send an unsigned long. Wait for 10 ticks for space to become + // Send an uint32_t. Wait for 10 ticks for space to become // available if necessary. - if( xQueueSendToBack( xQueue1, ( void * ) &ulVar, ( portTickType ) 10 ) != pdPASS ) + if( xQueueSendToBack( xQueue1, ( void * ) &ulVar, ( TickType_t ) 10 ) != pdPASS ) { // Failed to post the message, even after 10 ticks. } @@ -321,7 +321,7 @@ typedef void * xQueueSetMemberHandle; // Send a pointer to a struct AMessage object. Don't block if the // queue is already full. pxMessage = & xMessage; - xQueueSendToBack( xQueue2, ( void * ) &pxMessage, ( portTickType ) 0 ); + xQueueSendToBack( xQueue2, ( void * ) &pxMessage, ( TickType_t ) 0 ); } // ... Rest of task code. @@ -335,10 +335,10 @@ typedef void * xQueueSetMemberHandle; /** * queue. h *
- portBASE_TYPE xQueueSend(
-							  xQueueHandle xQueue,
+ BaseType_t xQueueSend(
+							  QueueHandle_t xQueue,
 							  const void * pvItemToQueue,
-							  portTickType xTicksToWait
+							  TickType_t xTicksToWait
 						 );
  * 
* @@ -374,15 +374,15 @@ typedef void * xQueueSetMemberHandle; char ucData[ 20 ]; } xMessage; - unsigned long ulVar = 10UL; + uint32_t ulVar = 10UL; void vATask( void *pvParameters ) { - xQueueHandle xQueue1, xQueue2; + QueueHandle_t xQueue1, xQueue2; struct AMessage *pxMessage; - // Create a queue capable of containing 10 unsigned long values. - xQueue1 = xQueueCreate( 10, sizeof( unsigned long ) ); + // Create a queue capable of containing 10 uint32_t values. + xQueue1 = xQueueCreate( 10, sizeof( uint32_t ) ); // Create a queue capable of containing 10 pointers to AMessage structures. // These should be passed by pointer as they contain a lot of data. @@ -392,9 +392,9 @@ typedef void * xQueueSetMemberHandle; if( xQueue1 != 0 ) { - // Send an unsigned long. Wait for 10 ticks for space to become + // Send an uint32_t. Wait for 10 ticks for space to become // available if necessary. - if( xQueueSend( xQueue1, ( void * ) &ulVar, ( portTickType ) 10 ) != pdPASS ) + if( xQueueSend( xQueue1, ( void * ) &ulVar, ( TickType_t ) 10 ) != pdPASS ) { // Failed to post the message, even after 10 ticks. } @@ -405,7 +405,7 @@ typedef void * xQueueSetMemberHandle; // Send a pointer to a struct AMessage object. Don't block if the // queue is already full. pxMessage = & xMessage; - xQueueSend( xQueue2, ( void * ) &pxMessage, ( portTickType ) 0 ); + xQueueSend( xQueue2, ( void * ) &pxMessage, ( TickType_t ) 0 ); } // ... Rest of task code. @@ -419,8 +419,8 @@ typedef void * xQueueSetMemberHandle; /** * queue. h *
- portBASE_TYPE xQueueOverwrite(
-							  xQueueHandle xQueue,
+ BaseType_t xQueueOverwrite(
+							  QueueHandle_t xQueue,
 							  const void * pvItemToQueue
 						 );
  * 
@@ -451,14 +451,14 @@ typedef void * xQueueSetMemberHandle; void vFunction( void *pvParameters ) { - xQueueHandle xQueue; - unsigned long ulVarToSend, ulValReceived; + QueueHandle_t xQueue; + uint32_t ulVarToSend, ulValReceived; - // Create a queue to hold one unsigned long value. It is strongly + // Create a queue to hold one uint32_t value. It is strongly // recommended *not* to use xQueueOverwrite() on queues that can // contain more than one value, and doing so will trigger an assertion // if configASSERT() is defined. - xQueue = xQueueCreate( 1, sizeof( unsigned long ) ); + xQueue = xQueueCreate( 1, sizeof( uint32_t ) ); // Write the value 10 to the queue using xQueueOverwrite(). ulVarToSend = 10; @@ -503,11 +503,11 @@ typedef void * xQueueSetMemberHandle; /** * queue. h *
- portBASE_TYPE xQueueGenericSend(
-									xQueueHandle xQueue,
+ BaseType_t xQueueGenericSend(
+									QueueHandle_t xQueue,
 									const void * pvItemToQueue,
-									portTickType xTicksToWait
-									portBASE_TYPE xCopyPosition
+									TickType_t xTicksToWait
+									BaseType_t xCopyPosition
 								);
  * 
* @@ -545,15 +545,15 @@ typedef void * xQueueSetMemberHandle; char ucData[ 20 ]; } xMessage; - unsigned long ulVar = 10UL; + uint32_t ulVar = 10UL; void vATask( void *pvParameters ) { - xQueueHandle xQueue1, xQueue2; + QueueHandle_t xQueue1, xQueue2; struct AMessage *pxMessage; - // Create a queue capable of containing 10 unsigned long values. - xQueue1 = xQueueCreate( 10, sizeof( unsigned long ) ); + // Create a queue capable of containing 10 uint32_t values. + xQueue1 = xQueueCreate( 10, sizeof( uint32_t ) ); // Create a queue capable of containing 10 pointers to AMessage structures. // These should be passed by pointer as they contain a lot of data. @@ -563,9 +563,9 @@ typedef void * xQueueSetMemberHandle; if( xQueue1 != 0 ) { - // Send an unsigned long. Wait for 10 ticks for space to become + // Send an uint32_t. Wait for 10 ticks for space to become // available if necessary. - if( xQueueGenericSend( xQueue1, ( void * ) &ulVar, ( portTickType ) 10, queueSEND_TO_BACK ) != pdPASS ) + if( xQueueGenericSend( xQueue1, ( void * ) &ulVar, ( TickType_t ) 10, queueSEND_TO_BACK ) != pdPASS ) { // Failed to post the message, even after 10 ticks. } @@ -576,7 +576,7 @@ typedef void * xQueueSetMemberHandle; // Send a pointer to a struct AMessage object. Don't block if the // queue is already full. pxMessage = & xMessage; - xQueueGenericSend( xQueue2, ( void * ) &pxMessage, ( portTickType ) 0, queueSEND_TO_BACK ); + xQueueGenericSend( xQueue2, ( void * ) &pxMessage, ( TickType_t ) 0, queueSEND_TO_BACK ); } // ... Rest of task code. @@ -585,15 +585,15 @@ typedef void * xQueueSetMemberHandle; * \defgroup xQueueSend xQueueSend * \ingroup QueueManagement */ -signed portBASE_TYPE xQueueGenericSend( xQueueHandle xQueue, const void * const pvItemToQueue, portTickType xTicksToWait, const portBASE_TYPE xCopyPosition ) PRIVILEGED_FUNCTION; +BaseType_t xQueueGenericSend( QueueHandle_t xQueue, const void * const pvItemToQueue, TickType_t xTicksToWait, const BaseType_t xCopyPosition ) PRIVILEGED_FUNCTION; /** * queue. h *
- portBASE_TYPE xQueuePeek(
-							 xQueueHandle xQueue,
+ BaseType_t xQueuePeek(
+							 QueueHandle_t xQueue,
 							 void *pvBuffer,
-							 portTickType xTicksToWait
+							 TickType_t xTicksToWait
 						 );
* * This is a macro that calls the xQueueGenericReceive() function. @@ -634,7 +634,7 @@ signed portBASE_TYPE xQueueGenericSend( xQueueHandle xQueue, const void * const char ucData[ 20 ]; } xMessage; - xQueueHandle xQueue; + QueueHandle_t xQueue; // Task to create a queue and post a value. void vATask( void *pvParameters ) @@ -654,7 +654,7 @@ signed portBASE_TYPE xQueueGenericSend( xQueueHandle xQueue, const void * const // Send a pointer to a struct AMessage object. Don't block if the // queue is already full. pxMessage = & xMessage; - xQueueSend( xQueue, ( void * ) &pxMessage, ( portTickType ) 0 ); + xQueueSend( xQueue, ( void * ) &pxMessage, ( TickType_t ) 0 ); // ... Rest of task code. } @@ -668,7 +668,7 @@ signed portBASE_TYPE xQueueGenericSend( xQueueHandle xQueue, const void * const { // Peek a message on the created queue. Block for 10 ticks if a // message is not immediately available. - if( xQueuePeek( xQueue, &( pxRxedMessage ), ( portTickType ) 10 ) ) + if( xQueuePeek( xQueue, &( pxRxedMessage ), ( TickType_t ) 10 ) ) { // pcRxedMessage now points to the struct AMessage variable posted // by vATask, but the item still remains on the queue. @@ -686,8 +686,8 @@ signed portBASE_TYPE xQueueGenericSend( xQueueHandle xQueue, const void * const /** * queue. h *
- portBASE_TYPE xQueuePeekFromISR(
-									xQueueHandle xQueue,
+ BaseType_t xQueuePeekFromISR(
+									QueueHandle_t xQueue,
 									void *pvBuffer,
 								);
* @@ -714,15 +714,15 @@ signed portBASE_TYPE xQueueGenericSend( xQueueHandle xQueue, const void * const * \defgroup xQueuePeekFromISR xQueuePeekFromISR * \ingroup QueueManagement */ -signed portBASE_TYPE xQueuePeekFromISR( xQueueHandle xQueue, void * const pvBuffer ) PRIVILEGED_FUNCTION; +BaseType_t xQueuePeekFromISR( QueueHandle_t xQueue, void * const pvBuffer ) PRIVILEGED_FUNCTION; /** * queue. h *
- portBASE_TYPE xQueueReceive(
-								 xQueueHandle xQueue,
+ BaseType_t xQueueReceive(
+								 QueueHandle_t xQueue,
 								 void *pvBuffer,
-								 portTickType xTicksToWait
+								 TickType_t xTicksToWait
 							);
* * This is a macro that calls the xQueueGenericReceive() function. @@ -760,7 +760,7 @@ signed portBASE_TYPE xQueuePeekFromISR( xQueueHandle xQueue, void * const pvBuff char ucData[ 20 ]; } xMessage; - xQueueHandle xQueue; + QueueHandle_t xQueue; // Task to create a queue and post a value. void vATask( void *pvParameters ) @@ -780,7 +780,7 @@ signed portBASE_TYPE xQueuePeekFromISR( xQueueHandle xQueue, void * const pvBuff // Send a pointer to a struct AMessage object. Don't block if the // queue is already full. pxMessage = & xMessage; - xQueueSend( xQueue, ( void * ) &pxMessage, ( portTickType ) 0 ); + xQueueSend( xQueue, ( void * ) &pxMessage, ( TickType_t ) 0 ); // ... Rest of task code. } @@ -794,7 +794,7 @@ signed portBASE_TYPE xQueuePeekFromISR( xQueueHandle xQueue, void * const pvBuff { // Receive a message on the created queue. Block for 10 ticks if a // message is not immediately available. - if( xQueueReceive( xQueue, &( pxRxedMessage ), ( portTickType ) 10 ) ) + if( xQueueReceive( xQueue, &( pxRxedMessage ), ( TickType_t ) 10 ) ) { // pcRxedMessage now points to the struct AMessage variable posted // by vATask. @@ -813,11 +813,11 @@ signed portBASE_TYPE xQueuePeekFromISR( xQueueHandle xQueue, void * const pvBuff /** * queue. h *
- portBASE_TYPE xQueueGenericReceive(
-									   xQueueHandle	xQueue,
+ BaseType_t xQueueGenericReceive(
+									   QueueHandle_t	xQueue,
 									   void	*pvBuffer,
-									   portTickType	xTicksToWait
-									   portBASE_TYPE	xJustPeek
+									   TickType_t	xTicksToWait
+									   BaseType_t	xJustPeek
 									);
* * It is preferred that the macro xQueueReceive() be used rather than calling @@ -859,7 +859,7 @@ signed portBASE_TYPE xQueuePeekFromISR( xQueueHandle xQueue, void * const pvBuff char ucData[ 20 ]; } xMessage; - xQueueHandle xQueue; + QueueHandle_t xQueue; // Task to create a queue and post a value. void vATask( void *pvParameters ) @@ -879,7 +879,7 @@ signed portBASE_TYPE xQueuePeekFromISR( xQueueHandle xQueue, void * const pvBuff // Send a pointer to a struct AMessage object. Don't block if the // queue is already full. pxMessage = & xMessage; - xQueueSend( xQueue, ( void * ) &pxMessage, ( portTickType ) 0 ); + xQueueSend( xQueue, ( void * ) &pxMessage, ( TickType_t ) 0 ); // ... Rest of task code. } @@ -893,7 +893,7 @@ signed portBASE_TYPE xQueuePeekFromISR( xQueueHandle xQueue, void * const pvBuff { // Receive a message on the created queue. Block for 10 ticks if a // message is not immediately available. - if( xQueueGenericReceive( xQueue, &( pxRxedMessage ), ( portTickType ) 10 ) ) + if( xQueueGenericReceive( xQueue, &( pxRxedMessage ), ( TickType_t ) 10 ) ) { // pcRxedMessage now points to the struct AMessage variable posted // by vATask. @@ -906,11 +906,11 @@ signed portBASE_TYPE xQueuePeekFromISR( xQueueHandle xQueue, void * const pvBuff * \defgroup xQueueReceive xQueueReceive * \ingroup QueueManagement */ -signed portBASE_TYPE xQueueGenericReceive( xQueueHandle xQueue, void * const pvBuffer, portTickType xTicksToWait, const portBASE_TYPE xJustPeek ) PRIVILEGED_FUNCTION; +BaseType_t xQueueGenericReceive( QueueHandle_t xQueue, void * const pvBuffer, TickType_t xTicksToWait, const BaseType_t xJustPeek ) PRIVILEGED_FUNCTION; /** * queue. h - *
unsigned portBASE_TYPE uxQueueMessagesWaiting( const xQueueHandle xQueue );
+ *
UBaseType_t uxQueueMessagesWaiting( const QueueHandle_t xQueue );
* * Return the number of messages stored in a queue. * @@ -921,11 +921,11 @@ signed portBASE_TYPE xQueueGenericReceive( xQueueHandle xQueue, void * const pvB * \defgroup uxQueueMessagesWaiting uxQueueMessagesWaiting * \ingroup QueueManagement */ -unsigned portBASE_TYPE uxQueueMessagesWaiting( const xQueueHandle xQueue ) PRIVILEGED_FUNCTION; +UBaseType_t uxQueueMessagesWaiting( const QueueHandle_t xQueue ) PRIVILEGED_FUNCTION; /** * queue. h - *
unsigned portBASE_TYPE uxQueueSpacesAvailable( const xQueueHandle xQueue );
+ *
UBaseType_t uxQueueSpacesAvailable( const QueueHandle_t xQueue );
* * Return the number of free spaces available in a queue. This is equal to the * number of items that can be sent to the queue before the queue becomes full @@ -938,11 +938,11 @@ unsigned portBASE_TYPE uxQueueMessagesWaiting( const xQueueHandle xQueue ) PRIVI * \defgroup uxQueueMessagesWaiting uxQueueMessagesWaiting * \ingroup QueueManagement */ -unsigned portBASE_TYPE uxQueueSpacesAvailable( const xQueueHandle xQueue ) PRIVILEGED_FUNCTION; +UBaseType_t uxQueueSpacesAvailable( const QueueHandle_t xQueue ) PRIVILEGED_FUNCTION; /** * queue. h - *
void vQueueDelete( xQueueHandle xQueue );
+ *
void vQueueDelete( QueueHandle_t xQueue );
* * Delete a queue - freeing all the memory allocated for storing of items * placed on the queue. @@ -952,15 +952,15 @@ unsigned portBASE_TYPE uxQueueSpacesAvailable( const xQueueHandle xQueue ) PRIVI * \defgroup vQueueDelete vQueueDelete * \ingroup QueueManagement */ -void vQueueDelete( xQueueHandle xQueue ) PRIVILEGED_FUNCTION; +void vQueueDelete( QueueHandle_t xQueue ) PRIVILEGED_FUNCTION; /** * queue. h *
- portBASE_TYPE xQueueSendToFrontFromISR(
-										 xQueueHandle xQueue,
+ BaseType_t xQueueSendToFrontFromISR(
+										 QueueHandle_t xQueue,
 										 const void *pvItemToQueue,
-										 portBASE_TYPE *pxHigherPriorityTaskWoken
+										 BaseType_t *pxHigherPriorityTaskWoken
 									  );
  
* @@ -995,7 +995,7 @@ void vQueueDelete( xQueueHandle xQueue ) PRIVILEGED_FUNCTION; void vBufferISR( void ) { char cIn; - portBASE_TYPE xHigherPrioritTaskWoken; + BaseType_t xHigherPrioritTaskWoken; // We have not woken a task at the start of the ISR. xHigherPriorityTaskWoken = pdFALSE; @@ -1028,10 +1028,10 @@ void vQueueDelete( xQueueHandle xQueue ) PRIVILEGED_FUNCTION; /** * queue. h *
- portBASE_TYPE xQueueSendToBackFromISR(
-										 xQueueHandle xQueue,
+ BaseType_t xQueueSendToBackFromISR(
+										 QueueHandle_t xQueue,
 										 const void *pvItemToQueue,
-										 portBASE_TYPE *pxHigherPriorityTaskWoken
+										 BaseType_t *pxHigherPriorityTaskWoken
 									  );
  
* @@ -1066,7 +1066,7 @@ void vQueueDelete( xQueueHandle xQueue ) PRIVILEGED_FUNCTION; void vBufferISR( void ) { char cIn; - portBASE_TYPE xHigherPriorityTaskWoken; + BaseType_t xHigherPriorityTaskWoken; // We have not woken a task at the start of the ISR. xHigherPriorityTaskWoken = pdFALSE; @@ -1098,10 +1098,10 @@ void vQueueDelete( xQueueHandle xQueue ) PRIVILEGED_FUNCTION; /** * queue. h *
- portBASE_TYPE xQueueOverwriteFromISR(
-							  xQueueHandle xQueue,
+ BaseType_t xQueueOverwriteFromISR(
+							  QueueHandle_t xQueue,
 							  const void * pvItemToQueue,
-							  portBASE_TYPE *pxHigherPriorityTaskWoken
+							  BaseType_t *pxHigherPriorityTaskWoken
 						 );
  * 
* @@ -1136,22 +1136,22 @@ void vQueueDelete( xQueueHandle xQueue ) PRIVILEGED_FUNCTION; * Example usage:
 
- xQueueHandle xQueue;
+ QueueHandle_t xQueue;
 
  void vFunction( void *pvParameters )
  {
- 	// Create a queue to hold one unsigned long value.  It is strongly
+ 	// Create a queue to hold one uint32_t value.  It is strongly
 	// recommended *not* to use xQueueOverwriteFromISR() on queues that can
 	// contain more than one value, and doing so will trigger an assertion
 	// if configASSERT() is defined.
-	xQueue = xQueueCreate( 1, sizeof( unsigned long ) );
+	xQueue = xQueueCreate( 1, sizeof( uint32_t ) );
 }
 
 void vAnInterruptHandler( void )
 {
 // xHigherPriorityTaskWoken must be set to pdFALSE before it is used.
-portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;
-unsigned long ulVarToSend, ulValReceived;
+BaseType_t xHigherPriorityTaskWoken = pdFALSE;
+uint32_t ulVarToSend, ulValReceived;
 
 	// Write the value 10 to the queue using xQueueOverwriteFromISR().
 	ulVarToSend = 10;
@@ -1185,10 +1185,10 @@ unsigned long ulVarToSend, ulValReceived;
 /**
  * queue. h
  * 
- portBASE_TYPE xQueueSendFromISR(
-									 xQueueHandle xQueue,
+ BaseType_t xQueueSendFromISR(
+									 QueueHandle_t xQueue,
 									 const void *pvItemToQueue,
-									 portBASE_TYPE *pxHigherPriorityTaskWoken
+									 BaseType_t *pxHigherPriorityTaskWoken
 								);
  
* @@ -1226,7 +1226,7 @@ unsigned long ulVarToSend, ulValReceived; void vBufferISR( void ) { char cIn; - portBASE_TYPE xHigherPriorityTaskWoken; + BaseType_t xHigherPriorityTaskWoken; // We have not woken a task at the start of the ISR. xHigherPriorityTaskWoken = pdFALSE; @@ -1259,11 +1259,11 @@ unsigned long ulVarToSend, ulValReceived; /** * queue. h *
- portBASE_TYPE xQueueGenericSendFromISR(
-										   xQueueHandle		xQueue,
+ BaseType_t xQueueGenericSendFromISR(
+										   QueueHandle_t		xQueue,
 										   const	void	*pvItemToQueue,
-										   portBASE_TYPE	*pxHigherPriorityTaskWoken,
-										   portBASE_TYPE	xCopyPosition
+										   BaseType_t	*pxHigherPriorityTaskWoken,
+										   BaseType_t	xCopyPosition
 									   );
  
* @@ -1304,7 +1304,7 @@ unsigned long ulVarToSend, ulValReceived; void vBufferISR( void ) { char cIn; - portBASE_TYPE xHigherPriorityTaskWokenByPost; + BaseType_t xHigherPriorityTaskWokenByPost; // We have not woken a task at the start of the ISR. xHigherPriorityTaskWokenByPost = pdFALSE; @@ -1332,15 +1332,15 @@ unsigned long ulVarToSend, ulValReceived; * \defgroup xQueueSendFromISR xQueueSendFromISR * \ingroup QueueManagement */ -signed portBASE_TYPE xQueueGenericSendFromISR( xQueueHandle xQueue, const void * const pvItemToQueue, signed portBASE_TYPE * const pxHigherPriorityTaskWoken, const portBASE_TYPE xCopyPosition ) PRIVILEGED_FUNCTION; +BaseType_t xQueueGenericSendFromISR( QueueHandle_t xQueue, const void * const pvItemToQueue, BaseType_t * const pxHigherPriorityTaskWoken, const BaseType_t xCopyPosition ) PRIVILEGED_FUNCTION; /** * queue. h *
- portBASE_TYPE xQueueReceiveFromISR(
-									   xQueueHandle	xQueue,
+ BaseType_t xQueueReceiveFromISR(
+									   QueueHandle_t	xQueue,
 									   void	*pvBuffer,
-									   portBASE_TYPE *pxTaskWoken
+									   BaseType_t *pxTaskWoken
 								   );
  * 
* @@ -1364,13 +1364,13 @@ signed portBASE_TYPE xQueueGenericSendFromISR( xQueueHandle xQueue, const void * * Example usage:
 
- xQueueHandle xQueue;
+ QueueHandle_t xQueue;
 
  // Function to create a queue and post some values.
  void vAFunction( void *pvParameters )
  {
  char cValueToPost;
- const portTickType xBlockTime = ( portTickType )0xff;
+ const TickType_t xBlockTime = ( TickType_t )0xff;
 
 	// Create a queue capable of containing 10 characters.
 	xQueue = xQueueCreate( 10, sizeof( char ) );
@@ -1398,7 +1398,7 @@ signed portBASE_TYPE xQueueGenericSendFromISR( xQueueHandle xQueue, const void *
  // ISR that outputs all the characters received on the queue.
  void vISR_Routine( void )
  {
- portBASE_TYPE xTaskWokenByReceive = pdFALSE;
+ BaseType_t xTaskWokenByReceive = pdFALSE;
  char cRxedChar;
 
 	while( xQueueReceiveFromISR( xQueue, ( void * ) &cRxedChar, &xTaskWokenByReceive) )
@@ -1421,15 +1421,15 @@ signed portBASE_TYPE xQueueGenericSendFromISR( xQueueHandle xQueue, const void *
  * \defgroup xQueueReceiveFromISR xQueueReceiveFromISR
  * \ingroup QueueManagement
  */
-signed portBASE_TYPE xQueueReceiveFromISR( xQueueHandle xQueue, void * const pvBuffer, signed portBASE_TYPE * const pxHigherPriorityTaskWoken ) PRIVILEGED_FUNCTION;
+BaseType_t xQueueReceiveFromISR( QueueHandle_t xQueue, void * const pvBuffer, BaseType_t * const pxHigherPriorityTaskWoken ) PRIVILEGED_FUNCTION;
 
 /*
  * Utilities to query queues that are safe to use from an ISR.  These utilities
  * should be used only from witin an ISR, or within a critical section.
  */
-signed portBASE_TYPE xQueueIsQueueEmptyFromISR( const xQueueHandle xQueue ) PRIVILEGED_FUNCTION;
-signed portBASE_TYPE xQueueIsQueueFullFromISR( const xQueueHandle xQueue ) PRIVILEGED_FUNCTION;
-unsigned portBASE_TYPE uxQueueMessagesWaitingFromISR( const xQueueHandle xQueue ) PRIVILEGED_FUNCTION;
+BaseType_t xQueueIsQueueEmptyFromISR( const QueueHandle_t xQueue ) PRIVILEGED_FUNCTION;
+BaseType_t xQueueIsQueueFullFromISR( const QueueHandle_t xQueue ) PRIVILEGED_FUNCTION;
+UBaseType_t uxQueueMessagesWaitingFromISR( const QueueHandle_t xQueue ) PRIVILEGED_FUNCTION;
 
 
 /*
@@ -1446,8 +1446,8 @@ unsigned portBASE_TYPE uxQueueMessagesWaitingFromISR( const xQueueHandle xQueue
  * responsiveness to gain execution speed, whereas the fully featured API
  * sacrifices execution speed to ensure better interrupt responsiveness.
  */
-signed portBASE_TYPE xQueueAltGenericSend( xQueueHandle xQueue, const void * const pvItemToQueue, portTickType xTicksToWait, portBASE_TYPE xCopyPosition );
-signed portBASE_TYPE xQueueAltGenericReceive( xQueueHandle xQueue, void * const pvBuffer, portTickType xTicksToWait, portBASE_TYPE xJustPeeking );
+BaseType_t xQueueAltGenericSend( QueueHandle_t xQueue, const void * const pvItemToQueue, TickType_t xTicksToWait, BaseType_t xCopyPosition );
+BaseType_t xQueueAltGenericReceive( QueueHandle_t xQueue, void * const pvBuffer, TickType_t xTicksToWait, BaseType_t xJustPeeking );
 #define xQueueAltSendToFront( xQueue, pvItemToQueue, xTicksToWait ) xQueueAltGenericSend( ( xQueue ), ( pvItemToQueue ), ( xTicksToWait ), queueSEND_TO_FRONT )
 #define xQueueAltSendToBack( xQueue, pvItemToQueue, xTicksToWait ) xQueueAltGenericSend( ( xQueue ), ( pvItemToQueue ), ( xTicksToWait ), queueSEND_TO_BACK )
 #define xQueueAltReceive( xQueue, pvBuffer, xTicksToWait ) xQueueAltGenericReceive( ( xQueue ), ( pvBuffer ), ( xTicksToWait ), pdFALSE )
@@ -1462,26 +1462,26 @@ signed portBASE_TYPE xQueueAltGenericReceive( xQueueHandle xQueue, void * const
  * should not be called directly from application code.  Instead use the macro
  * wrappers defined within croutine.h.
  */
-signed portBASE_TYPE xQueueCRSendFromISR( xQueueHandle xQueue, const void *pvItemToQueue, signed portBASE_TYPE xCoRoutinePreviouslyWoken );
-signed portBASE_TYPE xQueueCRReceiveFromISR( xQueueHandle xQueue, void *pvBuffer, signed portBASE_TYPE *pxTaskWoken );
-signed portBASE_TYPE xQueueCRSend( xQueueHandle xQueue, const void *pvItemToQueue, portTickType xTicksToWait );
-signed portBASE_TYPE xQueueCRReceive( xQueueHandle xQueue, void *pvBuffer, portTickType xTicksToWait );
+BaseType_t xQueueCRSendFromISR( QueueHandle_t xQueue, const void *pvItemToQueue, BaseType_t xCoRoutinePreviouslyWoken );
+BaseType_t xQueueCRReceiveFromISR( QueueHandle_t xQueue, void *pvBuffer, BaseType_t *pxTaskWoken );
+BaseType_t xQueueCRSend( QueueHandle_t xQueue, const void *pvItemToQueue, TickType_t xTicksToWait );
+BaseType_t xQueueCRReceive( QueueHandle_t xQueue, void *pvBuffer, TickType_t xTicksToWait );
 
 /*
  * For internal use only.  Use xSemaphoreCreateMutex(),
  * xSemaphoreCreateCounting() or xSemaphoreGetMutexHolder() instead of calling
  * these functions directly.
  */
-xQueueHandle xQueueCreateMutex( const unsigned char ucQueueType ) PRIVILEGED_FUNCTION;
-xQueueHandle xQueueCreateCountingSemaphore( const unsigned portBASE_TYPE uxMaxCount, const unsigned portBASE_TYPE uxInitialCount ) PRIVILEGED_FUNCTION;
-void* xQueueGetMutexHolder( xQueueHandle xSemaphore ) PRIVILEGED_FUNCTION;
+QueueHandle_t xQueueCreateMutex( const uint8_t ucQueueType ) PRIVILEGED_FUNCTION;
+QueueHandle_t xQueueCreateCountingSemaphore( const UBaseType_t uxMaxCount, const UBaseType_t uxInitialCount ) PRIVILEGED_FUNCTION;
+void* xQueueGetMutexHolder( QueueHandle_t xSemaphore ) PRIVILEGED_FUNCTION;
 
 /*
  * For internal use only.  Use xSemaphoreTakeMutexRecursive() or
  * xSemaphoreGiveMutexRecursive() instead of calling these functions directly.
  */
-portBASE_TYPE xQueueTakeMutexRecursive( xQueueHandle xMutex, portTickType xBlockTime ) PRIVILEGED_FUNCTION;
-portBASE_TYPE xQueueGiveMutexRecursive( xQueueHandle pxMutex ) PRIVILEGED_FUNCTION;
+BaseType_t xQueueTakeMutexRecursive( QueueHandle_t xMutex, TickType_t xBlockTime ) PRIVILEGED_FUNCTION;
+BaseType_t xQueueGiveMutexRecursive( QueueHandle_t pxMutex ) PRIVILEGED_FUNCTION;
 
 /*
  * Reset a queue back to its original empty state.  pdPASS is returned if the
@@ -1514,7 +1514,7 @@ portBASE_TYPE xQueueGiveMutexRecursive( xQueueHandle pxMutex ) PRIVILEGED_FUNCTI
  * preferably in ROM/Flash), not on the stack.
  */
 #if configQUEUE_REGISTRY_SIZE > 0
-	void vQueueAddToRegistry( xQueueHandle xQueue, char *pcName ) PRIVILEGED_FUNCTION; /*lint !e971 Unqualified char types are allowed for strings and single characters only. */
+	void vQueueAddToRegistry( QueueHandle_t xQueue, char *pcName ) PRIVILEGED_FUNCTION; /*lint !e971 Unqualified char types are allowed for strings and single characters only. */
 #endif
 
 /*
@@ -1528,14 +1528,14 @@ portBASE_TYPE xQueueGiveMutexRecursive( xQueueHandle pxMutex ) PRIVILEGED_FUNCTI
  * @param xQueue The handle of the queue being removed from the registry.
  */
 #if configQUEUE_REGISTRY_SIZE > 0
-	void vQueueUnregisterQueue( xQueueHandle xQueue ) PRIVILEGED_FUNCTION;
+	void vQueueUnregisterQueue( QueueHandle_t xQueue ) PRIVILEGED_FUNCTION;
 #endif
 
 /*
  * Generic version of the queue creation function, which is in turn called by
  * any queue, semaphore or mutex creation function or macro.
  */
-xQueueHandle xQueueGenericCreate( const unsigned portBASE_TYPE uxQueueLength, const unsigned portBASE_TYPE uxItemSize, const unsigned char ucQueueType ) PRIVILEGED_FUNCTION;
+QueueHandle_t xQueueGenericCreate( const UBaseType_t uxQueueLength, const UBaseType_t uxItemSize, const uint8_t ucQueueType ) PRIVILEGED_FUNCTION;
 
 /*
  * Queue sets provide a mechanism to allow a task to block (pend) on a read
@@ -1585,7 +1585,7 @@ xQueueHandle xQueueGenericCreate( const unsigned portBASE_TYPE uxQueueLength, co
  * @return If the queue set is created successfully then a handle to the created
  * queue set is returned.  Otherwise NULL is returned.
  */
-xQueueSetHandle xQueueCreateSet( const unsigned portBASE_TYPE uxEventQueueLength ) PRIVILEGED_FUNCTION;
+QueueSetHandle_t xQueueCreateSet( const UBaseType_t uxEventQueueLength ) PRIVILEGED_FUNCTION;
 
 /*
  * Adds a queue or semaphore to a queue set that was previously created by a
@@ -1599,7 +1599,7 @@ xQueueSetHandle xQueueCreateSet( const unsigned portBASE_TYPE uxEventQueueLength
  * a call to xQueueSelectFromSet() has first returned a handle to that set member.
  *
  * @param xQueueOrSemaphore The handle of the queue or semaphore being added to
- * the queue set (cast to an xQueueSetMemberHandle type).
+ * the queue set (cast to an QueueSetMember_t type).
  *
  * @param xQueueSet The handle of the queue set to which the queue or semaphore
  * is being added.
@@ -1609,7 +1609,7 @@ xQueueSetHandle xQueueCreateSet( const unsigned portBASE_TYPE uxEventQueueLength
  * queue set because it is already a member of a different queue set then pdFAIL
  * is returned.
  */
-portBASE_TYPE xQueueAddToSet( xQueueSetMemberHandle xQueueOrSemaphore, xQueueSetHandle xQueueSet ) PRIVILEGED_FUNCTION;
+BaseType_t xQueueAddToSet( QueueSetMember_t xQueueOrSemaphore, QueueSetHandle_t xQueueSet ) PRIVILEGED_FUNCTION;
 
 /*
  * Removes a queue or semaphore from a queue set.  A queue or semaphore can only
@@ -1619,7 +1619,7 @@ portBASE_TYPE xQueueAddToSet( xQueueSetMemberHandle xQueueOrSemaphore, xQueueSet
  * function.
  *
  * @param xQueueOrSemaphore The handle of the queue or semaphore being removed
- * from the queue set (cast to an xQueueSetMemberHandle type).
+ * from the queue set (cast to an QueueSetMember_t type).
  *
  * @param xQueueSet The handle of the queue set in which the queue or semaphore
  * is included.
@@ -1628,7 +1628,7 @@ portBASE_TYPE xQueueAddToSet( xQueueSetMemberHandle xQueueOrSemaphore, xQueueSet
  * then pdPASS is returned.  If the queue was not in the queue set, or the
  * queue (or semaphore) was not empty, then pdFAIL is returned.
  */
-portBASE_TYPE xQueueRemoveFromSet( xQueueSetMemberHandle xQueueOrSemaphore, xQueueSetHandle xQueueSet ) PRIVILEGED_FUNCTION;
+BaseType_t xQueueRemoveFromSet( QueueSetMember_t xQueueOrSemaphore, QueueSetHandle_t xQueueSet ) PRIVILEGED_FUNCTION;
 
 /*
  * xQueueSelectFromSet() selects from the members of a queue set a queue or
@@ -1659,24 +1659,24 @@ portBASE_TYPE xQueueRemoveFromSet( xQueueSetMemberHandle xQueueOrSemaphore, xQue
  * operation.
  *
  * @return xQueueSelectFromSet() will return the handle of a queue (cast to
- * a xQueueSetMemberHandle type) contained in the queue set that contains data,
- * or the handle of a semaphore (cast to a xQueueSetMemberHandle type) contained
+ * a QueueSetMember_t type) contained in the queue set that contains data,
+ * or the handle of a semaphore (cast to a QueueSetMember_t type) contained
  * in the queue set that is available, or NULL if no such queue or semaphore
  * exists before before the specified block time expires.
  */
-xQueueSetMemberHandle xQueueSelectFromSet( xQueueSetHandle xQueueSet, const portTickType xBlockTimeTicks ) PRIVILEGED_FUNCTION;
+QueueSetMember_t xQueueSelectFromSet( QueueSetHandle_t xQueueSet, const TickType_t xBlockTimeTicks ) PRIVILEGED_FUNCTION;
 
 /*
  * A version of xQueueSelectFromSet() that can be used from an ISR.
  */
-xQueueSetMemberHandle xQueueSelectFromSetFromISR( xQueueSetHandle xQueueSet ) PRIVILEGED_FUNCTION;
+QueueSetMember_t xQueueSelectFromSetFromISR( QueueSetHandle_t xQueueSet ) PRIVILEGED_FUNCTION;
 
 /* Not public API functions. */
-void vQueueWaitForMessageRestricted( xQueueHandle xQueue, portTickType xTicksToWait ) PRIVILEGED_FUNCTION;
-portBASE_TYPE xQueueGenericReset( xQueueHandle xQueue, portBASE_TYPE xNewQueue ) PRIVILEGED_FUNCTION;
-void vQueueSetQueueNumber( xQueueHandle xQueue, unsigned portBASE_TYPE uxQueueNumber ) PRIVILEGED_FUNCTION;
-unsigned portBASE_TYPE uxQueueGetQueueNumber( xQueueHandle xQueue ) PRIVILEGED_FUNCTION;
-unsigned char ucQueueGetQueueType( xQueueHandle xQueue ) PRIVILEGED_FUNCTION;
+void vQueueWaitForMessageRestricted( QueueHandle_t xQueue, TickType_t xTicksToWait ) PRIVILEGED_FUNCTION;
+BaseType_t xQueueGenericReset( QueueHandle_t xQueue, BaseType_t xNewQueue ) PRIVILEGED_FUNCTION;
+void vQueueSetQueueNumber( QueueHandle_t xQueue, UBaseType_t uxQueueNumber ) PRIVILEGED_FUNCTION;
+UBaseType_t uxQueueGetQueueNumber( QueueHandle_t xQueue ) PRIVILEGED_FUNCTION;
+uint8_t ucQueueGetQueueType( QueueHandle_t xQueue ) PRIVILEGED_FUNCTION;
 
 
 #ifdef __cplusplus
diff --git a/FreeRTOS/Source/include/semphr.h b/FreeRTOS/Source/include/semphr.h
index 9fd8caad2..c46543a2b 100644
--- a/FreeRTOS/Source/include/semphr.h
+++ b/FreeRTOS/Source/include/semphr.h
@@ -72,16 +72,16 @@
 
 #include "queue.h"
 
-typedef xQueueHandle xSemaphoreHandle;
+typedef QueueHandle_t SemaphoreHandle_t;
 
-#define semBINARY_SEMAPHORE_QUEUE_LENGTH	( ( unsigned char ) 1U )
-#define semSEMAPHORE_QUEUE_ITEM_LENGTH		( ( unsigned char ) 0U )
-#define semGIVE_BLOCK_TIME					( ( portTickType ) 0U )
+#define semBINARY_SEMAPHORE_QUEUE_LENGTH	( ( uint8_t ) 1U )
+#define semSEMAPHORE_QUEUE_ITEM_LENGTH		( ( uint8_t ) 0U )
+#define semGIVE_BLOCK_TIME					( ( TickType_t ) 0U )
 
 
 /**
  * semphr. h
- * 
vSemaphoreCreateBinary( xSemaphoreHandle xSemaphore )
+ *
vSemaphoreCreateBinary( SemaphoreHandle_t xSemaphore )
* * This old vSemaphoreCreateBinary() macro is now deprecated in favour of the * xSemaphoreCreateBinary() function. Note that binary semaphores created using @@ -102,11 +102,11 @@ typedef xQueueHandle xSemaphoreHandle; * semaphore does not use a priority inheritance mechanism. For an alternative * that does use priority inheritance see xSemaphoreCreateMutex(). * - * @param xSemaphore Handle to the created semaphore. Should be of type xSemaphoreHandle. + * @param xSemaphore Handle to the created semaphore. Should be of type SemaphoreHandle_t. * * Example usage:
- xSemaphoreHandle xSemaphore = NULL;
+ SemaphoreHandle_t xSemaphore = NULL;
 
  void vATask( void * pvParameters )
  {
@@ -124,18 +124,18 @@ typedef xQueueHandle xSemaphoreHandle;
  * \defgroup vSemaphoreCreateBinary vSemaphoreCreateBinary
  * \ingroup Semaphores
  */
-#define vSemaphoreCreateBinary( xSemaphore )																									\
-	{																																			\
-		( xSemaphore ) = xQueueGenericCreate( ( unsigned portBASE_TYPE ) 1, semSEMAPHORE_QUEUE_ITEM_LENGTH, queueQUEUE_TYPE_BINARY_SEMAPHORE );	\
-		if( ( xSemaphore ) != NULL )																											\
-		{																																		\
-			( void ) xSemaphoreGive( ( xSemaphore ) );																							\
-		}																																		\
+#define vSemaphoreCreateBinary( xSemaphore )																							\
+	{																																	\
+		( xSemaphore ) = xQueueGenericCreate( ( UBaseType_t ) 1, semSEMAPHORE_QUEUE_ITEM_LENGTH, queueQUEUE_TYPE_BINARY_SEMAPHORE );	\
+		if( ( xSemaphore ) != NULL )																									\
+		{																																\
+			( void ) xSemaphoreGive( ( xSemaphore ) );																					\
+		}																																\
 	}
 
 /**
  * semphr. h
- * 
xSemaphoreHandle xSemaphoreCreateBinary( void )
+ *
SemaphoreHandle_t xSemaphoreCreateBinary( void )
* * The old vSemaphoreCreateBinary() macro is now deprecated in favour of this * xSemaphoreCreateBinary() function. Note that binary semaphores created using @@ -160,7 +160,7 @@ typedef xQueueHandle xSemaphoreHandle; * * Example usage:
- xSemaphoreHandle xSemaphore = NULL;
+ SemaphoreHandle_t xSemaphore = NULL;
 
  void vATask( void * pvParameters )
  {
@@ -178,13 +178,13 @@ typedef xQueueHandle xSemaphoreHandle;
  * \defgroup vSemaphoreCreateBinary vSemaphoreCreateBinary
  * \ingroup Semaphores
  */
-#define xSemaphoreCreateBinary() xQueueGenericCreate( ( unsigned portBASE_TYPE ) 1, semSEMAPHORE_QUEUE_ITEM_LENGTH, queueQUEUE_TYPE_BINARY_SEMAPHORE )
+#define xSemaphoreCreateBinary() xQueueGenericCreate( ( UBaseType_t ) 1, semSEMAPHORE_QUEUE_ITEM_LENGTH, queueQUEUE_TYPE_BINARY_SEMAPHORE )
 
 /**
  * semphr. h
  * 
xSemaphoreTake(
- *                   xSemaphoreHandle xSemaphore,
- *                   portTickType xBlockTime
+ *                   SemaphoreHandle_t xSemaphore,
+ *                   TickType_t xBlockTime
  *               )
* * Macro to obtain a semaphore. The semaphore must have previously been @@ -205,7 +205,7 @@ typedef xQueueHandle xSemaphoreHandle; * * Example usage:
- xSemaphoreHandle xSemaphore = NULL;
+ SemaphoreHandle_t xSemaphore = NULL;
 
  // A task that creates a semaphore.
  void vATask( void * pvParameters )
@@ -223,7 +223,7 @@ typedef xQueueHandle xSemaphoreHandle;
     {
         // See if we can obtain the semaphore.  If the semaphore is not available
         // wait 10 ticks to see if it becomes free.
-        if( xSemaphoreTake( xSemaphore, ( portTickType ) 10 ) == pdTRUE )
+        if( xSemaphoreTake( xSemaphore, ( TickType_t ) 10 ) == pdTRUE )
         {
             // We were able to obtain the semaphore and can now access the
             // shared resource.
@@ -245,13 +245,13 @@ typedef xQueueHandle xSemaphoreHandle;
  * \defgroup xSemaphoreTake xSemaphoreTake
  * \ingroup Semaphores
  */
-#define xSemaphoreTake( xSemaphore, xBlockTime )		xQueueGenericReceive( ( xQueueHandle ) ( xSemaphore ), NULL, ( xBlockTime ), pdFALSE )
+#define xSemaphoreTake( xSemaphore, xBlockTime )		xQueueGenericReceive( ( QueueHandle_t ) ( xSemaphore ), NULL, ( xBlockTime ), pdFALSE )
 
 /**
  * semphr. h
  * xSemaphoreTakeRecursive(
- *                          xSemaphoreHandle xMutex,
- *                          portTickType xBlockTime
+ *                          SemaphoreHandle_t xMutex,
+ *                          TickType_t xBlockTime
  *                        )
  *
  * Macro to recursively obtain, or 'take', a mutex type semaphore.
@@ -284,7 +284,7 @@ typedef xQueueHandle xSemaphoreHandle;
  *
  * Example usage:
  
- xSemaphoreHandle xMutex = NULL;
+ SemaphoreHandle_t xMutex = NULL;
 
  // A task that creates a mutex.
  void vATask( void * pvParameters )
@@ -302,7 +302,7 @@ typedef xQueueHandle xSemaphoreHandle;
     {
         // See if we can obtain the mutex.  If the mutex is not available
         // wait 10 ticks to see if it becomes free.
-        if( xSemaphoreTakeRecursive( xSemaphore, ( portTickType ) 10 ) == pdTRUE )
+        if( xSemaphoreTakeRecursive( xSemaphore, ( TickType_t ) 10 ) == pdTRUE )
         {
             // We were able to obtain the mutex and can now access the
             // shared resource.
@@ -313,8 +313,8 @@ typedef xQueueHandle xSemaphoreHandle;
 			// code these would not be just sequential calls as this would make
 			// no sense.  Instead the calls are likely to be buried inside
 			// a more complex call structure.
-            xSemaphoreTakeRecursive( xMutex, ( portTickType ) 10 );
-            xSemaphoreTakeRecursive( xMutex, ( portTickType ) 10 );
+            xSemaphoreTakeRecursive( xMutex, ( TickType_t ) 10 );
+            xSemaphoreTakeRecursive( xMutex, ( TickType_t ) 10 );
 
             // The mutex has now been 'taken' three times, so will not be
 			// available to another task until it has also been given back
@@ -353,11 +353,11 @@ typedef xQueueHandle xSemaphoreHandle;
  * responsiveness to gain execution speed, whereas the fully featured API
  * sacrifices execution speed to ensure better interrupt responsiveness.
  */
-#define xSemaphoreAltTake( xSemaphore, xBlockTime )		xQueueAltGenericReceive( ( xQueueHandle ) ( xSemaphore ), NULL, ( xBlockTime ), pdFALSE )
+#define xSemaphoreAltTake( xSemaphore, xBlockTime )		xQueueAltGenericReceive( ( QueueHandle_t ) ( xSemaphore ), NULL, ( xBlockTime ), pdFALSE )
 
 /**
  * semphr. h
- * 
xSemaphoreGive( xSemaphoreHandle xSemaphore )
+ *
xSemaphoreGive( SemaphoreHandle_t xSemaphore )
* * Macro to release a semaphore. The semaphore must have previously been * created with a call to vSemaphoreCreateBinary(), xSemaphoreCreateMutex() or @@ -379,7 +379,7 @@ typedef xQueueHandle xSemaphoreHandle; * * Example usage:
- xSemaphoreHandle xSemaphore = NULL;
+ SemaphoreHandle_t xSemaphore = NULL;
 
  void vATask( void * pvParameters )
  {
@@ -396,7 +396,7 @@ typedef xQueueHandle xSemaphoreHandle;
 
         // Obtain the semaphore - don't block if the semaphore is not
         // immediately available.
-        if( xSemaphoreTake( xSemaphore, ( portTickType ) 0 ) )
+        if( xSemaphoreTake( xSemaphore, ( TickType_t ) 0 ) )
         {
             // We now have the semaphore and can access the shared resource.
 
@@ -416,11 +416,11 @@ typedef xQueueHandle xSemaphoreHandle;
  * \defgroup xSemaphoreGive xSemaphoreGive
  * \ingroup Semaphores
  */
-#define xSemaphoreGive( xSemaphore )		xQueueGenericSend( ( xQueueHandle ) ( xSemaphore ), NULL, semGIVE_BLOCK_TIME, queueSEND_TO_BACK )
+#define xSemaphoreGive( xSemaphore )		xQueueGenericSend( ( QueueHandle_t ) ( xSemaphore ), NULL, semGIVE_BLOCK_TIME, queueSEND_TO_BACK )
 
 /**
  * semphr. h
- * 
xSemaphoreGiveRecursive( xSemaphoreHandle xMutex )
+ *
xSemaphoreGiveRecursive( SemaphoreHandle_t xMutex )
* * Macro to recursively release, or 'give', a mutex type semaphore. * The mutex must have previously been created using a call to @@ -445,7 +445,7 @@ typedef xQueueHandle xSemaphoreHandle; * * Example usage:
- xSemaphoreHandle xMutex = NULL;
+ SemaphoreHandle_t xMutex = NULL;
 
  // A task that creates a mutex.
  void vATask( void * pvParameters )
@@ -463,7 +463,7 @@ typedef xQueueHandle xSemaphoreHandle;
     {
         // See if we can obtain the mutex.  If the mutex is not available
         // wait 10 ticks to see if it becomes free.
-        if( xSemaphoreTakeRecursive( xMutex, ( portTickType ) 10 ) == pdTRUE )
+        if( xSemaphoreTakeRecursive( xMutex, ( TickType_t ) 10 ) == pdTRUE )
         {
             // We were able to obtain the mutex and can now access the
             // shared resource.
@@ -474,8 +474,8 @@ typedef xQueueHandle xSemaphoreHandle;
 			// code these would not be just sequential calls as this would make
 			// no sense.  Instead the calls are likely to be buried inside
 			// a more complex call structure.
-            xSemaphoreTakeRecursive( xMutex, ( portTickType ) 10 );
-            xSemaphoreTakeRecursive( xMutex, ( portTickType ) 10 );
+            xSemaphoreTakeRecursive( xMutex, ( TickType_t ) 10 );
+            xSemaphoreTakeRecursive( xMutex, ( TickType_t ) 10 );
 
             // The mutex has now been 'taken' three times, so will not be
 			// available to another task until it has also been given back
@@ -514,14 +514,14 @@ typedef xQueueHandle xSemaphoreHandle;
  * responsiveness to gain execution speed, whereas the fully featured API
  * sacrifices execution speed to ensure better interrupt responsiveness.
  */
-#define xSemaphoreAltGive( xSemaphore )		xQueueAltGenericSend( ( xQueueHandle ) ( xSemaphore ), NULL, semGIVE_BLOCK_TIME, queueSEND_TO_BACK )
+#define xSemaphoreAltGive( xSemaphore )		xQueueAltGenericSend( ( QueueHandle_t ) ( xSemaphore ), NULL, semGIVE_BLOCK_TIME, queueSEND_TO_BACK )
 
 /**
  * semphr. h
  * 
  xSemaphoreGiveFromISR(
-                          xSemaphoreHandle xSemaphore,
-                          signed portBASE_TYPE *pxHigherPriorityTaskWoken
+                          SemaphoreHandle_t xSemaphore,
+                          BaseType_t *pxHigherPriorityTaskWoken
                       )
* * Macro to release a semaphore. The semaphore must have previously been @@ -547,7 +547,7 @@ typedef xQueueHandle xSemaphoreHandle;
  \#define LONG_TIME 0xffff
  \#define TICKS_TO_WAIT	10
- xSemaphoreHandle xSemaphore = NULL;
+ SemaphoreHandle_t xSemaphore = NULL;
 
  // Repetitive task.
  void vATask( void * pvParameters )
@@ -575,8 +575,8 @@ typedef xQueueHandle xSemaphoreHandle;
  // Timer ISR
  void vTimerISR( void * pvParameters )
  {
- static unsigned char ucLocalTickCount = 0;
- static signed portBASE_TYPE xHigherPriorityTaskWoken;
+ static uint8_t ucLocalTickCount = 0;
+ static BaseType_t xHigherPriorityTaskWoken;
 
     // A timer tick has occurred.
 
@@ -605,14 +605,14 @@ typedef xQueueHandle xSemaphoreHandle;
  * \defgroup xSemaphoreGiveFromISR xSemaphoreGiveFromISR
  * \ingroup Semaphores
  */
-#define xSemaphoreGiveFromISR( xSemaphore, pxHigherPriorityTaskWoken )			xQueueGenericSendFromISR( ( xQueueHandle ) ( xSemaphore ), NULL, ( pxHigherPriorityTaskWoken ), queueSEND_TO_BACK )
+#define xSemaphoreGiveFromISR( xSemaphore, pxHigherPriorityTaskWoken )	xQueueGenericSendFromISR( ( QueueHandle_t ) ( xSemaphore ), NULL, ( pxHigherPriorityTaskWoken ), queueSEND_TO_BACK )
 
 /**
  * semphr. h
  * 
  xSemaphoreTakeFromISR(
-                          xSemaphoreHandle xSemaphore,
-                          signed portBASE_TYPE *pxHigherPriorityTaskWoken
+                          SemaphoreHandle_t xSemaphore,
+                          BaseType_t *pxHigherPriorityTaskWoken
                       )
* * Macro to take a semaphore from an ISR. The semaphore must have @@ -639,11 +639,11 @@ typedef xQueueHandle xSemaphoreHandle; * @return pdTRUE if the semaphore was successfully taken, otherwise * pdFALSE */ -#define xSemaphoreTakeFromISR( xSemaphore, pxHigherPriorityTaskWoken ) xQueueReceiveFromISR( ( xQueueHandle ) ( xSemaphore ), NULL, ( pxHigherPriorityTaskWoken ) ) +#define xSemaphoreTakeFromISR( xSemaphore, pxHigherPriorityTaskWoken ) xQueueReceiveFromISR( ( QueueHandle_t ) ( xSemaphore ), NULL, ( pxHigherPriorityTaskWoken ) ) /** * semphr. h - *
xSemaphoreHandle xSemaphoreCreateMutex( void )
+ *
SemaphoreHandle_t xSemaphoreCreateMutex( void )
* * Macro that implements a mutex semaphore by using the existing queue * mechanism. @@ -664,11 +664,11 @@ typedef xQueueHandle xSemaphoreHandle; * service routines. * * @return xSemaphore Handle to the created mutex semaphore. Should be of type - * xSemaphoreHandle. + * SemaphoreHandle_t. * * Example usage:
- xSemaphoreHandle xSemaphore;
+ SemaphoreHandle_t xSemaphore;
 
  void vATask( void * pvParameters )
  {
@@ -691,7 +691,7 @@ typedef xQueueHandle xSemaphoreHandle;
 
 /**
  * semphr. h
- * 
xSemaphoreHandle xSemaphoreCreateRecursiveMutex( void )
+ *
SemaphoreHandle_t xSemaphoreCreateRecursiveMutex( void )
* * Macro that implements a recursive mutex by using the existing queue * mechanism. @@ -719,11 +719,11 @@ typedef xQueueHandle xSemaphoreHandle; * service routines. * * @return xSemaphore Handle to the created mutex semaphore. Should be of type - * xSemaphoreHandle. + * SemaphoreHandle_t. * * Example usage:
- xSemaphoreHandle xSemaphore;
+ SemaphoreHandle_t xSemaphore;
 
  void vATask( void * pvParameters )
  {
@@ -745,7 +745,7 @@ typedef xQueueHandle xSemaphoreHandle;
 
 /**
  * semphr. h
- * 
xSemaphoreHandle xSemaphoreCreateCounting( unsigned portBASE_TYPE uxMaxCount, unsigned portBASE_TYPE uxInitialCount )
+ *
SemaphoreHandle_t xSemaphoreCreateCounting( UBaseType_t uxMaxCount, UBaseType_t uxInitialCount )
* * Macro that creates a counting semaphore by using the existing * queue mechanism. @@ -783,11 +783,11 @@ typedef xQueueHandle xSemaphoreHandle; * * Example usage:
- xSemaphoreHandle xSemaphore;
+ SemaphoreHandle_t xSemaphore;
 
  void vATask( void * pvParameters )
  {
- xSemaphoreHandle xSemaphore = NULL;
+ SemaphoreHandle_t xSemaphore = NULL;
 
     // Semaphore cannot be used before a call to xSemaphoreCreateCounting().
     // The max value to which the semaphore can count should be 10, and the
@@ -808,7 +808,7 @@ typedef xQueueHandle xSemaphoreHandle;
 
 /**
  * semphr. h
- * 
void vSemaphoreDelete( xSemaphoreHandle xSemaphore );
+ *
void vSemaphoreDelete( SemaphoreHandle_t xSemaphore );
* * Delete a semaphore. This function must be used with care. For example, * do not delete a mutex type semaphore if the mutex is held by a task. @@ -818,11 +818,11 @@ typedef xQueueHandle xSemaphoreHandle; * \defgroup vSemaphoreDelete vSemaphoreDelete * \ingroup Semaphores */ -#define vSemaphoreDelete( xSemaphore ) vQueueDelete( ( xQueueHandle ) ( xSemaphore ) ) +#define vSemaphoreDelete( xSemaphore ) vQueueDelete( ( QueueHandle_t ) ( xSemaphore ) ) /** * semphr.h - *
xTaskHandle xSemaphoreGetMutexHolder( xSemaphoreHandle xMutex );
+ *
TaskHandle_t xSemaphoreGetMutexHolder( SemaphoreHandle_t xMutex );
* * If xMutex is indeed a mutex type semaphore, return the current mutex holder. * If xMutex is not a mutex type semaphore, or the mutex is available (not held diff --git a/FreeRTOS/Source/include/task.h b/FreeRTOS/Source/include/task.h index 12fc1980b..849ed35d8 100644 --- a/FreeRTOS/Source/include/task.h +++ b/FreeRTOS/Source/include/task.h @@ -87,13 +87,13 @@ extern "C" { * task. h * * Type by which tasks are referenced. For example, a call to xTaskCreate - * returns (via a pointer parameter) an xTaskHandle variable that can then + * returns (via a pointer parameter) an TaskHandle_t variable that can then * be used as a parameter to vTaskDelete to delete the task. * - * \defgroup xTaskHandle xTaskHandle + * \defgroup TaskHandle_t TaskHandle_t * \ingroup Tasks */ -typedef void * xTaskHandle; +typedef void * TaskHandle_t; /* Task states returned by eTaskGetState. */ typedef enum @@ -110,9 +110,9 @@ typedef enum */ typedef struct xTIME_OUT { - portBASE_TYPE xOverflowCount; - portTickType xTimeOnEntering; -} xTimeOutType; + BaseType_t xOverflowCount; + TickType_t xTimeOnEntering; +} TimeOut_t; /* * Defines the memory ranges allocated to the task when an MPU is used. @@ -120,9 +120,9 @@ typedef struct xTIME_OUT typedef struct xMEMORY_REGION { void *pvBaseAddress; - unsigned long ulLengthInBytes; - unsigned long ulParameters; -} xMemoryRegion; + uint32_t ulLengthInBytes; + uint32_t ulParameters; +} MemoryRegion_t; /* * Parameters required to create an MPU protected task. @@ -131,26 +131,26 @@ typedef struct xTASK_PARAMETERS { pdTASK_CODE pvTaskCode; const char * const pcName; /*lint !e971 Unqualified char types are allowed for strings and single characters only. */ - unsigned short usStackDepth; + uint16_t usStackDepth; void *pvParameters; - unsigned portBASE_TYPE uxPriority; - portSTACK_TYPE *puxStackBuffer; - xMemoryRegion xRegions[ portNUM_CONFIGURABLE_REGIONS ]; -} xTaskParameters; + UBaseType_t uxPriority; + StackType_t *puxStackBuffer; + MemoryRegion_t xRegions[ portNUM_CONFIGURABLE_REGIONS ]; +} TaskParameters_t; /* Used with the uxTaskGetSystemState() function to return the state of each task in the system. */ typedef struct xTASK_STATUS { - xTaskHandle xHandle; /* The handle of the task to which the rest of the information in the structure relates. */ - const char *pcTaskName; /* A pointer to the task's name. This value will be invalid if the task was deleted since the structure was populated! */ /*lint !e971 Unqualified char types are allowed for strings and single characters only. */ - unsigned portBASE_TYPE xTaskNumber; /* A number unique to the task. */ - eTaskState eCurrentState; /* The state in which the task existed when the structure was populated. */ - unsigned portBASE_TYPE uxCurrentPriority; /* The priority at which the task was running (may be inherited) when the structure was populated. */ - unsigned portBASE_TYPE uxBasePriority; /* The priority to which the task will return if the task's current priority has been inherited to avoid unbounded priority inversion when obtaining a mutex. Only valid if configUSE_MUTEXES is defined as 1 in FreeRTOSConfig.h. */ - unsigned long ulRunTimeCounter; /* The total run time allocated to the task so far, as defined by the run time stats clock. See http://www.freertos.org/rtos-run-time-stats.html. Only valid when configGENERATE_RUN_TIME_STATS is defined as 1 in FreeRTOSConfig.h. */ - unsigned short usStackHighWaterMark; /* The minimum amount of stack space that has remained for the task since the task was created. The closer this value is to zero the closer the task has come to overflowing its stack. */ -} xTaskStatusType; + TaskHandle_t xHandle; /* The handle of the task to which the rest of the information in the structure relates. */ + const char *pcTaskName; /* A pointer to the task's name. This value will be invalid if the task was deleted since the structure was populated! */ /*lint !e971 Unqualified char types are allowed for strings and single characters only. */ + UBaseType_t xTaskNumber; /* A number unique to the task. */ + eTaskState eCurrentState; /* The state in which the task existed when the structure was populated. */ + UBaseType_t uxCurrentPriority; /* The priority at which the task was running (may be inherited) when the structure was populated. */ + UBaseType_t uxBasePriority; /* The priority to which the task will return if the task's current priority has been inherited to avoid unbounded priority inversion when obtaining a mutex. Only valid if configUSE_MUTEXES is defined as 1 in FreeRTOSConfig.h. */ + uint32_t ulRunTimeCounter; /* The total run time allocated to the task so far, as defined by the run time stats clock. See http://www.freertos.org/rtos-run-time-stats.html. Only valid when configGENERATE_RUN_TIME_STATS is defined as 1 in FreeRTOSConfig.h. */ + uint16_t usStackHighWaterMark; /* The minimum amount of stack space that has remained for the task since the task was created. The closer this value is to zero the closer the task has come to overflowing its stack. */ +} TaskStatus_t; /* Possible return values for eTaskConfirmSleepModeStatus(). */ typedef enum @@ -166,7 +166,7 @@ typedef enum * * \ingroup TaskUtils */ -#define tskIDLE_PRIORITY ( ( unsigned portBASE_TYPE ) 0U ) +#define tskIDLE_PRIORITY ( ( UBaseType_t ) 0U ) /** * task. h @@ -229,9 +229,9 @@ typedef enum /* Definitions returned by xTaskGetSchedulerState(). taskSCHEDULER_SUSPENDED is 0 to generate more optimal code when configASSERT() is defined as the constant is used in assert() statements. */ -#define taskSCHEDULER_SUSPENDED ( ( portBASE_TYPE ) 0 ) -#define taskSCHEDULER_NOT_STARTED ( ( portBASE_TYPE ) 1 ) -#define taskSCHEDULER_RUNNING ( ( portBASE_TYPE ) 2 ) +#define taskSCHEDULER_SUSPENDED ( ( BaseType_t ) 0 ) +#define taskSCHEDULER_NOT_STARTED ( ( BaseType_t ) 1 ) +#define taskSCHEDULER_RUNNING ( ( BaseType_t ) 2 ) /*----------------------------------------------------------- @@ -241,13 +241,13 @@ is used in assert() statements. */ /** * task. h *
- portBASE_TYPE xTaskCreate(
+ BaseType_t xTaskCreate(
 							  pdTASK_CODE pvTaskCode,
 							  const char * const pcName,
-							  unsigned short usStackDepth,
+							  uint16_t usStackDepth,
 							  void *pvParameters,
-							  unsigned portBASE_TYPE uxPriority,
-							  xTaskHandle *pvCreatedTask
+							  UBaseType_t uxPriority,
+							  TaskHandle_t *pvCreatedTask
 						  );
* * Create a new task and add it to the list of tasks that are ready to run. @@ -298,8 +298,8 @@ is used in assert() statements. */ // Function that creates a task. void vOtherFunction( void ) { - static unsigned char ucParameterToPass; - xTaskHandle xHandle = NULL; + static uint8_t ucParameterToPass; + TaskHandle_t xHandle = NULL; // Create the task, storing the handle. Note that the passed parameter ucParameterToPass // must exist for the lifetime of the task, so in this case is declared static. If it was just an @@ -323,7 +323,7 @@ is used in assert() statements. */ /** * task. h *
- portBASE_TYPE xTaskCreateRestricted( xTaskParameters *pxTaskDefinition, xTaskHandle *pxCreatedTask );
+ BaseType_t xTaskCreateRestricted( TaskParameters_t *pxTaskDefinition, TaskHandle_t *pxCreatedTask );
* * xTaskCreateRestricted() should only be used in systems that include an MPU * implementation. @@ -345,8 +345,8 @@ is used in assert() statements. */ * * Example usage:
-// Create an xTaskParameters structure that defines the task to be created.
-static const xTaskParameters xCheckTaskParameters =
+// Create an TaskParameters_t structure that defines the task to be created.
+static const TaskParameters_t xCheckTaskParameters =
 {
 	vATask,		// pvTaskCode - the function that implements the task.
 	"ATask",	// pcName - just a text name for the task to assist debugging.
@@ -369,7 +369,7 @@ static const xTaskParameters xCheckTaskParameters =
 
 int main( void )
 {
-xTaskHandle xHandle;
+TaskHandle_t xHandle;
 
 	// Create a task from the const structure defined above.  The task handle
 	// is requested (the second parameter is not NULL) but in this case just for
@@ -392,7 +392,7 @@ xTaskHandle xHandle;
 /**
  * task. h
  *
- void vTaskAllocateMPURegions( xTaskHandle xTask, const xMemoryRegion * const pxRegions );
+ void vTaskAllocateMPURegions( TaskHandle_t xTask, const MemoryRegion_t * const pxRegions );
* * Memory regions are assigned to a restricted task when the task is created by * a call to xTaskCreateRestricted(). These regions can be redefined using @@ -400,16 +400,16 @@ xTaskHandle xHandle; * * @param xTask The handle of the task being updated. * - * @param xRegions A pointer to an xMemoryRegion structure that contains the + * @param xRegions A pointer to an MemoryRegion_t structure that contains the * new memory region definitions. * * Example usage:
-// Define an array of xMemoryRegion structures that configures an MPU region
+// Define an array of MemoryRegion_t structures that configures an MPU region
 // allowing read/write access for 1024 bytes starting at the beginning of the
 // ucOneKByte array.  The other two of the maximum 3 definable regions are
 // unused so set to zero.
-static const xMemoryRegion xAltRegions[ portNUM_CONFIGURABLE_REGIONS ] =
+static const MemoryRegion_t xAltRegions[ portNUM_CONFIGURABLE_REGIONS ] =
 {
 	// Base address		Length		Parameters
 	{ ucOneKByte,		1024,		portMPU_REGION_READ_WRITE },
@@ -435,11 +435,11 @@ void vATask( void *pvParameters )
  * \defgroup xTaskCreateRestricted xTaskCreateRestricted
  * \ingroup Tasks
  */
-void vTaskAllocateMPURegions( xTaskHandle xTask, const xMemoryRegion * const pxRegions ) PRIVILEGED_FUNCTION;
+void vTaskAllocateMPURegions( TaskHandle_t xTask, const MemoryRegion_t * const pxRegions ) PRIVILEGED_FUNCTION;
 
 /**
  * task. h
- * 
void vTaskDelete( xTaskHandle xTask );
+ *
void vTaskDelete( TaskHandle_t xTask );
* * INCLUDE_vTaskDelete must be defined as 1 for this function to be available. * See the configuration section for more information. @@ -464,7 +464,7 @@ void vTaskAllocateMPURegions( xTaskHandle xTask, const xMemoryRegion * const pxR
  void vOtherFunction( void )
  {
- xTaskHandle xHandle;
+ TaskHandle_t xHandle;
 
 	 // Create the task, storing the handle.
 	 xTaskCreate( vTaskCode, "NAME", STACK_SIZE, NULL, tskIDLE_PRIORITY, &xHandle );
@@ -476,7 +476,7 @@ void vTaskAllocateMPURegions( xTaskHandle xTask, const xMemoryRegion * const pxR
  * \defgroup vTaskDelete vTaskDelete
  * \ingroup Tasks
  */
-void vTaskDelete( xTaskHandle xTaskToDelete ) PRIVILEGED_FUNCTION;
+void vTaskDelete( TaskHandle_t xTaskToDelete ) PRIVILEGED_FUNCTION;
 
 /*-----------------------------------------------------------
  * TASK CONTROL API
@@ -484,7 +484,7 @@ void vTaskDelete( xTaskHandle xTaskToDelete ) PRIVILEGED_FUNCTION;
 
 /**
  * task. h
- * 
void vTaskDelay( const portTickType xTicksToDelay );
+ *
void vTaskDelay( const TickType_t xTicksToDelay );
* * Delay a task for a given number of ticks. The actual time that the * task remains blocked depends on the tick rate. The constant @@ -515,7 +515,7 @@ void vTaskDelete( xTaskHandle xTaskToDelete ) PRIVILEGED_FUNCTION; void vTaskFunction( void * pvParameters ) { // Block for 500ms. - const portTickType xDelay = 500 / portTICK_RATE_MS; + const TickType_t xDelay = 500 / portTICK_RATE_MS; for( ;; ) { @@ -528,11 +528,11 @@ void vTaskDelete( xTaskHandle xTaskToDelete ) PRIVILEGED_FUNCTION; * \defgroup vTaskDelay vTaskDelay * \ingroup TaskCtrl */ -void vTaskDelay( const portTickType xTicksToDelay ) PRIVILEGED_FUNCTION; +void vTaskDelay( const TickType_t xTicksToDelay ) PRIVILEGED_FUNCTION; /** * task. h - *
void vTaskDelayUntil( portTickType *pxPreviousWakeTime, const portTickType xTimeIncrement );
+ *
void vTaskDelayUntil( TickType_t *pxPreviousWakeTime, const TickType_t xTimeIncrement );
* * INCLUDE_vTaskDelayUntil must be defined as 1 for this function to be available. * See the configuration section for more information. @@ -570,8 +570,8 @@ void vTaskDelay( const portTickType xTicksToDelay ) PRIVILEGED_FUNCTION; // Perform an action every 10 ticks. void vTaskFunction( void * pvParameters ) { - portTickType xLastWakeTime; - const portTickType xFrequency = 10; + TickType_t xLastWakeTime; + const TickType_t xFrequency = 10; // Initialise the xLastWakeTime variable with the current time. xLastWakeTime = xTaskGetTickCount (); @@ -587,11 +587,11 @@ void vTaskDelay( const portTickType xTicksToDelay ) PRIVILEGED_FUNCTION; * \defgroup vTaskDelayUntil vTaskDelayUntil * \ingroup TaskCtrl */ -void vTaskDelayUntil( portTickType * const pxPreviousWakeTime, const portTickType xTimeIncrement ) PRIVILEGED_FUNCTION; +void vTaskDelayUntil( TickType_t * const pxPreviousWakeTime, const TickType_t xTimeIncrement ) PRIVILEGED_FUNCTION; /** * task. h - *
unsigned portBASE_TYPE uxTaskPriorityGet( xTaskHandle xTask );
+ *
UBaseType_t uxTaskPriorityGet( TaskHandle_t xTask );
* * INCLUDE_uxTaskPriorityGet must be defined as 1 for this function to be available. * See the configuration section for more information. @@ -607,7 +607,7 @@ void vTaskDelayUntil( portTickType * const pxPreviousWakeTime, const portTickTyp
  void vAFunction( void )
  {
- xTaskHandle xHandle;
+ TaskHandle_t xHandle;
 
 	 // Create a task, storing the handle.
 	 xTaskCreate( vTaskCode, "NAME", STACK_SIZE, NULL, tskIDLE_PRIORITY, &xHandle );
@@ -634,11 +634,11 @@ void vTaskDelayUntil( portTickType * const pxPreviousWakeTime, const portTickTyp
  * \defgroup uxTaskPriorityGet uxTaskPriorityGet
  * \ingroup TaskCtrl
  */
-unsigned portBASE_TYPE uxTaskPriorityGet( xTaskHandle xTask ) PRIVILEGED_FUNCTION;
+UBaseType_t uxTaskPriorityGet( TaskHandle_t xTask ) PRIVILEGED_FUNCTION;
 
 /**
  * task. h
- * 
eTaskState eTaskGetState( xTaskHandle xTask );
+ *
eTaskState eTaskGetState( TaskHandle_t xTask );
* * INCLUDE_eTaskGetState must be defined as 1 for this function to be available. * See the configuration section for more information. @@ -652,11 +652,11 @@ unsigned portBASE_TYPE uxTaskPriorityGet( xTaskHandle xTask ) PRIVILEGED_FUNCTIO * state of the task might change between the function being called, and the * functions return value being tested by the calling task. */ -eTaskState eTaskGetState( xTaskHandle xTask ) PRIVILEGED_FUNCTION; +eTaskState eTaskGetState( TaskHandle_t xTask ) PRIVILEGED_FUNCTION; /** * task. h - *
void vTaskPrioritySet( xTaskHandle xTask, unsigned portBASE_TYPE uxNewPriority );
+ *
void vTaskPrioritySet( TaskHandle_t xTask, UBaseType_t uxNewPriority );
* * INCLUDE_vTaskPrioritySet must be defined as 1 for this function to be available. * See the configuration section for more information. @@ -675,7 +675,7 @@ eTaskState eTaskGetState( xTaskHandle xTask ) PRIVILEGED_FUNCTION;
  void vAFunction( void )
  {
- xTaskHandle xHandle;
+ TaskHandle_t xHandle;
 
 	 // Create a task, storing the handle.
 	 xTaskCreate( vTaskCode, "NAME", STACK_SIZE, NULL, tskIDLE_PRIORITY, &xHandle );
@@ -694,11 +694,11 @@ eTaskState eTaskGetState( xTaskHandle xTask ) PRIVILEGED_FUNCTION;
  * \defgroup vTaskPrioritySet vTaskPrioritySet
  * \ingroup TaskCtrl
  */
-void vTaskPrioritySet( xTaskHandle xTask, unsigned portBASE_TYPE uxNewPriority ) PRIVILEGED_FUNCTION;
+void vTaskPrioritySet( TaskHandle_t xTask, UBaseType_t uxNewPriority ) PRIVILEGED_FUNCTION;
 
 /**
  * task. h
- * 
void vTaskSuspend( xTaskHandle xTaskToSuspend );
+ *
void vTaskSuspend( TaskHandle_t xTaskToSuspend );
* * INCLUDE_vTaskSuspend must be defined as 1 for this function to be available. * See the configuration section for more information. @@ -717,7 +717,7 @@ void vTaskPrioritySet( xTaskHandle xTask, unsigned portBASE_TYPE uxNewPriority )
  void vAFunction( void )
  {
- xTaskHandle xHandle;
+ TaskHandle_t xHandle;
 
 	 // Create a task, storing the handle.
 	 xTaskCreate( vTaskCode, "NAME", STACK_SIZE, NULL, tskIDLE_PRIORITY, &xHandle );
@@ -745,11 +745,11 @@ void vTaskPrioritySet( xTaskHandle xTask, unsigned portBASE_TYPE uxNewPriority )
  * \defgroup vTaskSuspend vTaskSuspend
  * \ingroup TaskCtrl
  */
-void vTaskSuspend( xTaskHandle xTaskToSuspend ) PRIVILEGED_FUNCTION;
+void vTaskSuspend( TaskHandle_t xTaskToSuspend ) PRIVILEGED_FUNCTION;
 
 /**
  * task. h
- * 
void vTaskResume( xTaskHandle xTaskToResume );
+ *
void vTaskResume( TaskHandle_t xTaskToResume );
* * INCLUDE_vTaskSuspend must be defined as 1 for this function to be available. * See the configuration section for more information. @@ -766,7 +766,7 @@ void vTaskSuspend( xTaskHandle xTaskToSuspend ) PRIVILEGED_FUNCTION;
  void vAFunction( void )
  {
- xTaskHandle xHandle;
+ TaskHandle_t xHandle;
 
 	 // Create a task, storing the handle.
 	 xTaskCreate( vTaskCode, "NAME", STACK_SIZE, NULL, tskIDLE_PRIORITY, &xHandle );
@@ -794,11 +794,11 @@ void vTaskSuspend( xTaskHandle xTaskToSuspend ) PRIVILEGED_FUNCTION;
  * \defgroup vTaskResume vTaskResume
  * \ingroup TaskCtrl
  */
-void vTaskResume( xTaskHandle xTaskToResume ) PRIVILEGED_FUNCTION;
+void vTaskResume( TaskHandle_t xTaskToResume ) PRIVILEGED_FUNCTION;
 
 /**
  * task. h
- * 
void xTaskResumeFromISR( xTaskHandle xTaskToResume );
+ *
void xTaskResumeFromISR( TaskHandle_t xTaskToResume );
* * INCLUDE_xTaskResumeFromISR must be defined as 1 for this function to be * available. See the configuration section for more information. @@ -823,7 +823,7 @@ void vTaskResume( xTaskHandle xTaskToResume ) PRIVILEGED_FUNCTION; * \defgroup vTaskResumeFromISR vTaskResumeFromISR * \ingroup TaskCtrl */ -portBASE_TYPE xTaskResumeFromISR( xTaskHandle xTaskToResume ) PRIVILEGED_FUNCTION; +BaseType_t xTaskResumeFromISR( TaskHandle_t xTaskToResume ) PRIVILEGED_FUNCTION; /*----------------------------------------------------------- * SCHEDULER CONTROL @@ -967,7 +967,7 @@ void vTaskSuspendAll( void ) PRIVILEGED_FUNCTION; /** * task. h - *
char xTaskResumeAll( void );
+ *
BaseType_t xTaskResumeAll( void );
* * Resumes scheduler activity after it was suspended by a call to * vTaskSuspendAll(). @@ -1017,18 +1017,18 @@ void vTaskSuspendAll( void ) PRIVILEGED_FUNCTION; * \defgroup xTaskResumeAll xTaskResumeAll * \ingroup SchedulerControl */ -signed portBASE_TYPE xTaskResumeAll( void ) PRIVILEGED_FUNCTION; +BaseType_t xTaskResumeAll( void ) PRIVILEGED_FUNCTION; /** * task. h - *
signed portBASE_TYPE xTaskIsTaskSuspended( const xTaskHandle xTask );
+ *
BaseType_t xTaskIsTaskSuspended( const TaskHandle_t xTask );
* * Utility task that simply returns pdTRUE if the task referenced by xTask is * currently in the Suspended state, or pdFALSE if the task referenced by xTask * is in any other state. * */ -signed portBASE_TYPE xTaskIsTaskSuspended( const xTaskHandle xTask ) PRIVILEGED_FUNCTION; +BaseType_t xTaskIsTaskSuspended( const TaskHandle_t xTask ) PRIVILEGED_FUNCTION; /*----------------------------------------------------------- * TASK UTILITIES @@ -1036,34 +1036,34 @@ signed portBASE_TYPE xTaskIsTaskSuspended( const xTaskHandle xTask ) PRIVILEGED_ /** * task. h - *
portTickType xTaskGetTickCount( void );
+ *
TickType_t xTaskGetTickCount( void );
* * @return The count of ticks since vTaskStartScheduler was called. * * \defgroup xTaskGetTickCount xTaskGetTickCount * \ingroup TaskUtils */ -portTickType xTaskGetTickCount( void ) PRIVILEGED_FUNCTION; +TickType_t xTaskGetTickCount( void ) PRIVILEGED_FUNCTION; /** * task. h - *
portTickType xTaskGetTickCountFromISR( void );
+ *
TickType_t xTaskGetTickCountFromISR( void );
* * @return The count of ticks since vTaskStartScheduler was called. * * This is a version of xTaskGetTickCount() that is safe to be called from an - * ISR - provided that portTickType is the natural word size of the + * ISR - provided that TickType_t is the natural word size of the * microcontroller being used or interrupt nesting is either not supported or * not being used. * * \defgroup xTaskGetTickCountFromISR xTaskGetTickCountFromISR * \ingroup TaskUtils */ -portTickType xTaskGetTickCountFromISR( void ) PRIVILEGED_FUNCTION; +TickType_t xTaskGetTickCountFromISR( void ) PRIVILEGED_FUNCTION; /** * task. h - *
unsigned short uxTaskGetNumberOfTasks( void );
+ *
uint16_t uxTaskGetNumberOfTasks( void );
* * @return The number of tasks that the real time kernel is currently managing. * This includes all ready, blocked and suspended tasks. A task that @@ -1073,11 +1073,11 @@ portTickType xTaskGetTickCountFromISR( void ) PRIVILEGED_FUNCTION; * \defgroup uxTaskGetNumberOfTasks uxTaskGetNumberOfTasks * \ingroup TaskUtils */ -unsigned portBASE_TYPE uxTaskGetNumberOfTasks( void ) PRIVILEGED_FUNCTION; +UBaseType_t uxTaskGetNumberOfTasks( void ) PRIVILEGED_FUNCTION; /** * task. h - *
char *pcTaskGetTaskName( xTaskHandle xTaskToQuery );
+ *
char *pcTaskGetTaskName( TaskHandle_t xTaskToQuery );
* * @return The text (human readable) name of the task referenced by the handle * xTaskToQuery. A task can query its own name by either passing in its own @@ -1087,11 +1087,11 @@ unsigned portBASE_TYPE uxTaskGetNumberOfTasks( void ) PRIVILEGED_FUNCTION; * \defgroup pcTaskGetTaskName pcTaskGetTaskName * \ingroup TaskUtils */ -char *pcTaskGetTaskName( xTaskHandle xTaskToQuery ) PRIVILEGED_FUNCTION; /*lint !e971 Unqualified char types are allowed for strings and single characters only. */ +char *pcTaskGetTaskName( TaskHandle_t xTaskToQuery ) PRIVILEGED_FUNCTION; /*lint !e971 Unqualified char types are allowed for strings and single characters only. */ /** * task.h - *
unsigned portBASE_TYPE uxTaskGetStackHighWaterMark( xTaskHandle xTask );
+ *
UBaseType_t uxTaskGetStackHighWaterMark( TaskHandle_t xTask );
* * INCLUDE_uxTaskGetStackHighWaterMark must be set to 1 in FreeRTOSConfig.h for * this function to be available. @@ -1108,7 +1108,7 @@ char *pcTaskGetTaskName( xTaskHandle xTaskToQuery ) PRIVILEGED_FUNCTION; /*lint * actual spaces on the stack rather than bytes) since the task referenced by * xTask was created. */ -unsigned portBASE_TYPE uxTaskGetStackHighWaterMark( xTaskHandle xTask ) PRIVILEGED_FUNCTION; +UBaseType_t uxTaskGetStackHighWaterMark( TaskHandle_t xTask ) PRIVILEGED_FUNCTION; /* When using trace macros it is sometimes necessary to include task.h before FreeRTOS.h. When this is done pdTASK_HOOK_CODE will not yet have been defined, @@ -1120,27 +1120,27 @@ constant. */ #if configUSE_APPLICATION_TASK_TAG == 1 /** * task.h - *
void vTaskSetApplicationTaskTag( xTaskHandle xTask, pdTASK_HOOK_CODE pxHookFunction );
+ *
void vTaskSetApplicationTaskTag( TaskHandle_t xTask, pdTASK_HOOK_CODE pxHookFunction );
* * Sets pxHookFunction to be the task hook function used by the task xTask. * Passing xTask as NULL has the effect of setting the calling tasks hook * function. */ - void vTaskSetApplicationTaskTag( xTaskHandle xTask, pdTASK_HOOK_CODE pxHookFunction ) PRIVILEGED_FUNCTION; + void vTaskSetApplicationTaskTag( TaskHandle_t xTask, pdTASK_HOOK_CODE pxHookFunction ) PRIVILEGED_FUNCTION; /** * task.h - *
void xTaskGetApplicationTaskTag( xTaskHandle xTask );
+ *
void xTaskGetApplicationTaskTag( TaskHandle_t xTask );
* * Returns the pxHookFunction value assigned to the task xTask. */ - pdTASK_HOOK_CODE xTaskGetApplicationTaskTag( xTaskHandle xTask ) PRIVILEGED_FUNCTION; + pdTASK_HOOK_CODE xTaskGetApplicationTaskTag( TaskHandle_t xTask ) PRIVILEGED_FUNCTION; #endif /* configUSE_APPLICATION_TASK_TAG ==1 */ #endif /* ifdef configUSE_APPLICATION_TASK_TAG */ /** * task.h - *
portBASE_TYPE xTaskCallApplicationTaskHook( xTaskHandle xTask, void *pvParameter );
+ *
BaseType_t xTaskCallApplicationTaskHook( TaskHandle_t xTask, void *pvParameter );
* * Calls the hook function associated with xTask. Passing xTask as NULL has * the effect of calling the Running tasks (the calling task) hook function. @@ -1149,7 +1149,7 @@ constant. */ * wants. The return value is the value returned by the task hook function * registered by the user. */ -portBASE_TYPE xTaskCallApplicationTaskHook( xTaskHandle xTask, void *pvParameter ) PRIVILEGED_FUNCTION; +BaseType_t xTaskCallApplicationTaskHook( TaskHandle_t xTask, void *pvParameter ) PRIVILEGED_FUNCTION; /** * xTaskGetIdleTaskHandle() is only available if @@ -1158,29 +1158,29 @@ portBASE_TYPE xTaskCallApplicationTaskHook( xTaskHandle xTask, void *pvParameter * Simply returns the handle of the idle task. It is not valid to call * xTaskGetIdleTaskHandle() before the scheduler has been started. */ -xTaskHandle xTaskGetIdleTaskHandle( void ); +TaskHandle_t xTaskGetIdleTaskHandle( void ); /** * configUSE_TRACE_FACILITY must be defined as 1 in FreeRTOSConfig.h for * uxTaskGetSystemState() to be available. * - * uxTaskGetSystemState() populates an xTaskStatusType structure for each task in - * the system. xTaskStatusType structures contain, among other things, members + * uxTaskGetSystemState() populates an TaskStatus_t structure for each task in + * the system. TaskStatus_t structures contain, among other things, members * for the task handle, task name, task priority, task state, and total amount - * of run time consumed by the task. See the xTaskStatusType structure + * of run time consumed by the task. See the TaskStatus_t structure * definition in this file for the full member list. * * NOTE: This function is intended for debugging use only as its use results in * the scheduler remaining suspended for an extended period. * - * @param pxTaskStatusArray A pointer to an array of xTaskStatusType structures. - * The array must contain at least one xTaskStatusType structure for each task + * @param pxTaskStatusArray A pointer to an array of TaskStatus_t structures. + * The array must contain at least one TaskStatus_t structure for each task * that is under the control of the RTOS. The number of tasks under the control * of the RTOS can be determined using the uxTaskGetNumberOfTasks() API function. * * @param uxArraySize The size of the array pointed to by the pxTaskStatusArray * parameter. The size is specified as the number of indexes in the array, or - * the number of xTaskStatusType structures contained in the array, not by the + * the number of TaskStatus_t structures contained in the array, not by the * number of bytes in the array. * * @param pulTotalRunTime If configGENERATE_RUN_TIME_STATS is set to 1 in @@ -1189,7 +1189,7 @@ xTaskHandle xTaskGetIdleTaskHandle( void ); * http://www.freertos.org/rtos-run-time-stats.html) since the target booted. * pulTotalRunTime can be set to NULL to omit the total run time information. * - * @return The number of xTaskStatusType structures that were populated by + * @return The number of TaskStatus_t structures that were populated by * uxTaskGetSystemState(). This should equal the number returned by the * uxTaskGetNumberOfTasks() API function, but will be zero if the value passed * in the uxArraySize parameter was too small. @@ -1201,9 +1201,9 @@ xTaskHandle xTaskGetIdleTaskHandle( void ); // The human readable table is written to pcWriteBuffer void vTaskGetRunTimeStats( char *pcWriteBuffer ) { - xTaskStatusType *pxTaskStatusArray; - volatile unsigned portBASE_TYPE uxArraySize, x; - unsigned long ulTotalRunTime, ulStatsAsPercentage; + TaskStatus_t *pxTaskStatusArray; + volatile UBaseType_t uxArraySize, x; + uint32_t ulTotalRunTime, ulStatsAsPercentage; // Make sure the write buffer does not contain a string. *pcWriteBuffer = 0x00; @@ -1212,9 +1212,9 @@ xTaskHandle xTaskGetIdleTaskHandle( void ); // function is executing. uxArraySize = uxTaskGetNumberOfTasks(); - // Allocate a xTaskStatusType structure for each task. An array could be + // Allocate a TaskStatus_t structure for each task. An array could be // allocated statically at compile time. - pxTaskStatusArray = pvPortMalloc( uxArraySize * sizeof( xTaskStatusType ) ); + pxTaskStatusArray = pvPortMalloc( uxArraySize * sizeof( TaskStatus_t ) ); if( pxTaskStatusArray != NULL ) { @@ -1257,7 +1257,7 @@ xTaskHandle xTaskGetIdleTaskHandle( void ); }
*/ -unsigned portBASE_TYPE uxTaskGetSystemState( xTaskStatusType * const pxTaskStatusArray, const unsigned portBASE_TYPE uxArraySize, unsigned long * const pulTotalRunTime ); +UBaseType_t uxTaskGetSystemState( TaskStatus_t * const pxTaskStatusArray, const UBaseType_t uxArraySize, uint32_t * const pulTotalRunTime ); /** * task. h @@ -1379,7 +1379,7 @@ void vTaskGetRunTimeStats( char *pcWriteBuffer ) PRIVILEGED_FUNCTION; /*lint !e9 * + Time slicing is in use and there is a task of equal priority to the * currently running task. */ -portBASE_TYPE xTaskIncrementTick( void ) PRIVILEGED_FUNCTION; +BaseType_t xTaskIncrementTick( void ) PRIVILEGED_FUNCTION; /* * THIS FUNCTION MUST NOT BE USED FROM APPLICATION CODE. IT IS AN @@ -1412,8 +1412,8 @@ portBASE_TYPE xTaskIncrementTick( void ) PRIVILEGED_FUNCTION; * portTICK_RATE_MS can be used to convert kernel ticks into a real time * period. */ -void vTaskPlaceOnEventList( xList * const pxEventList, const portTickType xTicksToWait ) PRIVILEGED_FUNCTION; -void vTaskPlaceOnUnorderedEventList( xList * pxEventList, const portTickType xItemValue, const portTickType xTicksToWait ) PRIVILEGED_FUNCTION; +void vTaskPlaceOnEventList( List_t * const pxEventList, const TickType_t xTicksToWait ) PRIVILEGED_FUNCTION; +void vTaskPlaceOnUnorderedEventList( List_t * pxEventList, const TickType_t xItemValue, const TickType_t xTicksToWait ) PRIVILEGED_FUNCTION; /* * THIS FUNCTION MUST NOT BE USED FROM APPLICATION CODE. IT IS AN @@ -1426,7 +1426,7 @@ void vTaskPlaceOnUnorderedEventList( xList * pxEventList, const portTickType xIt * indefinitely, whereas vTaskPlaceOnEventList() does. * */ -void vTaskPlaceOnEventListRestricted( xList * const pxEventList, const portTickType xTicksToWait ) PRIVILEGED_FUNCTION; +void vTaskPlaceOnEventListRestricted( List_t * const pxEventList, const TickType_t xTicksToWait ) PRIVILEGED_FUNCTION; /* * THIS FUNCTION MUST NOT BE USED FROM APPLICATION CODE. IT IS AN @@ -1452,8 +1452,8 @@ void vTaskPlaceOnEventListRestricted( xList * const pxEventList, const portTickT * @return pdTRUE if the task being removed has a higher priority than the task * making the call, otherwise pdFALSE. */ -signed portBASE_TYPE xTaskRemoveFromEventList( const xList * const pxEventList ) PRIVILEGED_FUNCTION; -signed portBASE_TYPE xTaskRemoveFromUnorderedEventList( xListItem * pxEventListItem, const portTickType xItemValue ) PRIVILEGED_FUNCTION; +BaseType_t xTaskRemoveFromEventList( const List_t * const pxEventList ) PRIVILEGED_FUNCTION; +BaseType_t xTaskRemoveFromUnorderedEventList( ListItem_t * pxEventListItem, const TickType_t xItemValue ) PRIVILEGED_FUNCTION; /* * THIS FUNCTION MUST NOT BE USED FROM APPLICATION CODE. IT IS ONLY @@ -1469,23 +1469,23 @@ void vTaskSwitchContext( void ) PRIVILEGED_FUNCTION; * THESE FUNCTIONS MUST NOT BE USED FROM APPLICATION CODE. THEY ARE USED BY * THE EVENT BITS MODULE. */ -portTickType uxTaskResetEventItemValue( void ) PRIVILEGED_FUNCTION; +TickType_t uxTaskResetEventItemValue( void ) PRIVILEGED_FUNCTION; /* * Return the handle of the calling task. */ -xTaskHandle xTaskGetCurrentTaskHandle( void ) PRIVILEGED_FUNCTION; +TaskHandle_t xTaskGetCurrentTaskHandle( void ) PRIVILEGED_FUNCTION; /* * Capture the current time status for future reference. */ -void vTaskSetTimeOutState( xTimeOutType * const pxTimeOut ) PRIVILEGED_FUNCTION; +void vTaskSetTimeOutState( TimeOut_t * const pxTimeOut ) PRIVILEGED_FUNCTION; /* * Compare the time status now with that previously captured to see if the * timeout has expired. */ -portBASE_TYPE xTaskCheckForTimeOut( xTimeOutType * const pxTimeOut, portTickType * const pxTicksToWait ) PRIVILEGED_FUNCTION; +BaseType_t xTaskCheckForTimeOut( TimeOut_t * const pxTimeOut, TickType_t * const pxTicksToWait ) PRIVILEGED_FUNCTION; /* * Shortcut used by the queue implementation to prevent unnecessary call to @@ -1497,36 +1497,36 @@ void vTaskMissedYield( void ) PRIVILEGED_FUNCTION; * Returns the scheduler state as taskSCHEDULER_RUNNING, * taskSCHEDULER_NOT_STARTED or taskSCHEDULER_SUSPENDED. */ -portBASE_TYPE xTaskGetSchedulerState( void ) PRIVILEGED_FUNCTION; +BaseType_t xTaskGetSchedulerState( void ) PRIVILEGED_FUNCTION; /* * Raises the priority of the mutex holder to that of the calling task should * the mutex holder have a priority less than the calling task. */ -void vTaskPriorityInherit( xTaskHandle const pxMutexHolder ) PRIVILEGED_FUNCTION; +void vTaskPriorityInherit( TaskHandle_t const pxMutexHolder ) PRIVILEGED_FUNCTION; /* * Set the priority of a task back to its proper priority in the case that it * inherited a higher priority while it was holding a semaphore. */ -void vTaskPriorityDisinherit( xTaskHandle const pxMutexHolder ) PRIVILEGED_FUNCTION; +void vTaskPriorityDisinherit( TaskHandle_t const pxMutexHolder ) PRIVILEGED_FUNCTION; /* * Generic version of the task creation function which is in turn called by the * xTaskCreate() and xTaskCreateRestricted() macros. */ -signed portBASE_TYPE xTaskGenericCreate( pdTASK_CODE pxTaskCode, const char * const pcName, const unsigned short usStackDepth, void * const pvParameters, unsigned portBASE_TYPE uxPriority, xTaskHandle * const pxCreatedTask, portSTACK_TYPE * const puxStackBuffer, const xMemoryRegion * const xRegions ) PRIVILEGED_FUNCTION; /*lint !e971 Unqualified char types are allowed for strings and single characters only. */ +BaseType_t xTaskGenericCreate( pdTASK_CODE pxTaskCode, const char * const pcName, const uint16_t usStackDepth, void * const pvParameters, UBaseType_t uxPriority, TaskHandle_t * const pxCreatedTask, StackType_t * const puxStackBuffer, const MemoryRegion_t * const xRegions ) PRIVILEGED_FUNCTION; /*lint !e971 Unqualified char types are allowed for strings and single characters only. */ /* * Get the uxTCBNumber assigned to the task referenced by the xTask parameter. */ -unsigned portBASE_TYPE uxTaskGetTaskNumber( xTaskHandle xTask ) PRIVILEGED_FUNCTION; +UBaseType_t uxTaskGetTaskNumber( TaskHandle_t xTask ) PRIVILEGED_FUNCTION; /* * Set the uxTaskNumber of the task referenced by the xTask parameter to * uxHandle. */ -void vTaskSetTaskNumber( xTaskHandle xTask, const unsigned portBASE_TYPE uxHandle ) PRIVILEGED_FUNCTION; +void vTaskSetTaskNumber( TaskHandle_t xTask, const UBaseType_t uxHandle ) PRIVILEGED_FUNCTION; /* * Only available when configUSE_TICKLESS_IDLE is set to 1. @@ -1536,7 +1536,7 @@ void vTaskSetTaskNumber( xTaskHandle xTask, const unsigned portBASE_TYPE uxHandl * to date with the actual execution time by being skipped forward by a time * equal to the idle period. */ -void vTaskStepTick( const portTickType xTicksToJump ) PRIVILEGED_FUNCTION; +void vTaskStepTick( const TickType_t xTicksToJump ) PRIVILEGED_FUNCTION; /* * Only avilable when configUSE_TICKLESS_IDLE is set to 1. diff --git a/FreeRTOS/Source/include/timers.h b/FreeRTOS/Source/include/timers.h index ddb876391..3029330d9 100644 --- a/FreeRTOS/Source/include/timers.h +++ b/FreeRTOS/Source/include/timers.h @@ -87,27 +87,27 @@ extern "C" { /* IDs for commands that can be sent/received on the timer queue. These are to be used solely through the macros that make up the public software timer API, as defined below. */ -#define tmrCOMMAND_EXECUTE_CALLBACK ( ( portBASE_TYPE ) -1 ) -#define tmrCOMMAND_START ( ( portBASE_TYPE ) 0 ) -#define tmrCOMMAND_STOP ( ( portBASE_TYPE ) 1 ) -#define tmrCOMMAND_CHANGE_PERIOD ( ( portBASE_TYPE ) 2 ) -#define tmrCOMMAND_DELETE ( ( portBASE_TYPE ) 3 ) +#define tmrCOMMAND_EXECUTE_CALLBACK ( ( BaseType_t ) -1 ) +#define tmrCOMMAND_START ( ( BaseType_t ) 0 ) +#define tmrCOMMAND_STOP ( ( BaseType_t ) 1 ) +#define tmrCOMMAND_CHANGE_PERIOD ( ( BaseType_t ) 2 ) +#define tmrCOMMAND_DELETE ( ( BaseType_t ) 3 ) /** * Type by which software timers are referenced. For example, a call to - * xTimerCreate() returns an xTimerHandle variable that can then be used to + * xTimerCreate() returns an TimerHandle_t variable that can then be used to * reference the subject timer in calls to other software timer API functions * (for example, xTimerStart(), xTimerReset(), etc.). */ -typedef void * xTimerHandle; +typedef void * TimerHandle_t; /* Define the prototype to which timer callback functions must conform. */ -typedef void (*tmrTIMER_CALLBACK)( xTimerHandle xTimer ); +typedef void (*tmrTIMER_CALLBACK)( TimerHandle_t xTimer ); /** - * xTimerHandle xTimerCreate( const char * const pcTimerName, - * portTickType xTimerPeriodInTicks, - * unsigned portBASE_TYPE uxAutoReload, + * TimerHandle_t xTimerCreate( const char * const pcTimerName, + * TickType_t xTimerPeriodInTicks, + * UBaseType_t uxAutoReload, * void * pvTimerID, * tmrTIMER_CALLBACK pxCallbackFunction ); * @@ -117,23 +117,24 @@ typedef void (*tmrTIMER_CALLBACK)( xTimerHandle xTimer ); * * Timers are created in the dormant state. The xTimerStart(), xTimerReset(), * xTimerStartFromISR(), xTimerResetFromISR(), xTimerChangePeriod() and - * xTimerChangePeriodFromISR() API functions can all be used to transition a timer into the - * active state. + * xTimerChangePeriodFromISR() API functions can all be used to transition a + * timer into the active state. * * @param pcTimerName A text name that is assigned to the timer. This is done - * purely to assist debugging. The kernel itself only ever references a timer by - * its handle, and never by its name. + * purely to assist debugging. The kernel itself only ever references a timer + * by its handle, and never by its name. * - * @param xTimerPeriodInTicks The timer period. The time is defined in tick periods so - * the constant portTICK_RATE_MS can be used to convert a time that has been - * specified in milliseconds. For example, if the timer must expire after 100 - * ticks, then xTimerPeriodInTicks should be set to 100. Alternatively, if the timer - * must expire after 500ms, then xPeriod can be set to ( 500 / portTICK_RATE_MS ) - * provided configTICK_RATE_HZ is less than or equal to 1000. + * @param xTimerPeriodInTicks The timer period. The time is defined in tick + * periods so the constant portTICK_RATE_MS can be used to convert a time that + * has been specified in milliseconds. For example, if the timer must expire + * after 100 ticks, then xTimerPeriodInTicks should be set to 100. + * Alternatively, if the timer must expire after 500ms, then xPeriod can be set + * to ( 500 / portTICK_RATE_MS ) provided configTICK_RATE_HZ is less than or + * equal to 1000. * * @param uxAutoReload If uxAutoReload is set to pdTRUE then the timer will - * expire repeatedly with a frequency set by the xTimerPeriodInTicks parameter. If - * uxAutoReload is set to pdFALSE then the timer will be a one-shot timer and + * expire repeatedly with a frequency set by the xTimerPeriodInTicks parameter. + * If uxAutoReload is set to pdFALSE then the timer will be a one-shot timer and * enter the dormant state after it expires. * * @param pvTimerID An identifier that is assigned to the timer being created. @@ -143,7 +144,7 @@ typedef void (*tmrTIMER_CALLBACK)( xTimerHandle xTimer ); * * @param pxCallbackFunction The function to call when the timer expires. * Callback functions must have the prototype defined by tmrTIMER_CALLBACK, - * which is "void vCallbackFunction( xTimerHandle xTimer );". + * which is "void vCallbackFunction( TimerHandle_t xTimer );". * * @return If the timer is successfully created then a handle to the newly * created timer is returned. If the timer cannot be created (because either @@ -155,25 +156,25 @@ typedef void (*tmrTIMER_CALLBACK)( xTimerHandle xTimer ); * #define NUM_TIMERS 5 * * // An array to hold handles to the created timers. - * xTimerHandle xTimers[ NUM_TIMERS ]; + * TimerHandle_t xTimers[ NUM_TIMERS ]; * * // An array to hold a count of the number of times each timer expires. - * long lExpireCounters[ NUM_TIMERS ] = { 0 }; + * int32_t lExpireCounters[ NUM_TIMERS ] = { 0 }; * * // Define a callback function that will be used by multiple timer instances. * // The callback function does nothing but count the number of times the * // associated timer expires, and stop the timer once the timer has expired * // 10 times. - * void vTimerCallback( xTimerHandle pxTimer ) + * void vTimerCallback( TimerHandle_t pxTimer ) * { - * long lArrayIndex; - * const long xMaxExpiryCountBeforeStopping = 10; + * int32_t lArrayIndex; + * const int32_t xMaxExpiryCountBeforeStopping = 10; * * // Optionally do something if the pxTimer parameter is NULL. * configASSERT( pxTimer ); * * // Which timer expired? - * lArrayIndex = ( long ) pvTimerGetTimerID( pxTimer ); + * lArrayIndex = ( int32_t ) pvTimerGetTimerID( pxTimer ); * * // Increment the number of times that pxTimer has expired. * lExpireCounters[ lArrayIndex ] += 1; @@ -189,18 +190,18 @@ typedef void (*tmrTIMER_CALLBACK)( xTimerHandle xTimer ); * * void main( void ) * { - * long x; + * int32_t x; * * // Create then start some timers. Starting the timers before the scheduler * // has been started means the timers will start running immediately that * // the scheduler starts. * for( x = 0; x < NUM_TIMERS; x++ ) * { - * xTimers[ x ] = xTimerCreate( "Timer", // Just a text name, not used by the kernel. - * ( 100 * x ), // The timer period in ticks. - * pdTRUE, // The timers will auto-reload themselves when they expire. - * ( void * ) x, // Assign each timer a unique id equal to its array index. - * vTimerCallback // Each timer calls the same callback when it expires. + * xTimers[ x ] = xTimerCreate( "Timer", // Just a text name, not used by the kernel. + * ( 100 * x ), // The timer period in ticks. + * pdTRUE, // The timers will auto-reload themselves when they expire. + * ( void * ) x, // Assign each timer a unique id equal to its array index. + * vTimerCallback // Each timer calls the same callback when it expires. * ); * * if( xTimers[ x ] == NULL ) @@ -232,10 +233,10 @@ typedef void (*tmrTIMER_CALLBACK)( xTimerHandle xTimer ); * } * @endverbatim */ -xTimerHandle xTimerCreate( const char * const pcTimerName, const portTickType xTimerPeriodInTicks, const unsigned portBASE_TYPE uxAutoReload, void * const pvTimerID, tmrTIMER_CALLBACK pxCallbackFunction ) PRIVILEGED_FUNCTION; /*lint !e971 Unqualified char types are allowed for strings and single characters only. */ +TimerHandle_t xTimerCreate( const char * const pcTimerName, const TickType_t xTimerPeriodInTicks, const UBaseType_t uxAutoReload, void * const pvTimerID, tmrTIMER_CALLBACK pxCallbackFunction ) PRIVILEGED_FUNCTION; /*lint !e971 Unqualified char types are allowed for strings and single characters only. */ /** - * void *pvTimerGetTimerID( xTimerHandle xTimer ); + * void *pvTimerGetTimerID( TimerHandle_t xTimer ); * * Returns the ID assigned to the timer. * @@ -254,10 +255,10 @@ xTimerHandle xTimerCreate( const char * const pcTimerName, const portTickType xT * * See the xTimerCreate() API function example usage scenario. */ -void *pvTimerGetTimerID( xTimerHandle xTimer ) PRIVILEGED_FUNCTION; +void *pvTimerGetTimerID( TimerHandle_t xTimer ) PRIVILEGED_FUNCTION; /** - * portBASE_TYPE xTimerIsTimerActive( xTimerHandle xTimer ); + * BaseType_t xTimerIsTimerActive( TimerHandle_t xTimer ); * * Queries a timer to see if it is active or dormant. * @@ -278,7 +279,7 @@ void *pvTimerGetTimerID( xTimerHandle xTimer ) PRIVILEGED_FUNCTION; * Example usage: * @verbatim * // This function assumes xTimer has already been created. - * void vAFunction( xTimerHandle xTimer ) + * void vAFunction( TimerHandle_t xTimer ) * { * if( xTimerIsTimerActive( xTimer ) != pdFALSE ) // or more simply and equivalently "if( xTimerIsTimerActive( xTimer ) )" * { @@ -291,10 +292,10 @@ void *pvTimerGetTimerID( xTimerHandle xTimer ) PRIVILEGED_FUNCTION; * } * @endverbatim */ -portBASE_TYPE xTimerIsTimerActive( xTimerHandle xTimer ) PRIVILEGED_FUNCTION; +BaseType_t xTimerIsTimerActive( TimerHandle_t xTimer ) PRIVILEGED_FUNCTION; /** - * xTaskHandle xTimerGetTimerDaemonTaskHandle( void ); + * TaskHandle_t xTimerGetTimerDaemonTaskHandle( void ); * * xTimerGetTimerDaemonTaskHandle() is only available if * INCLUDE_xTimerGetTimerDaemonTaskHandle is set to 1 in FreeRTOSConfig.h. @@ -302,10 +303,10 @@ portBASE_TYPE xTimerIsTimerActive( xTimerHandle xTimer ) PRIVILEGED_FUNCTION; * Simply returns the handle of the timer service/daemon task. It it not valid * to call xTimerGetTimerDaemonTaskHandle() before the scheduler has been started. */ -xTaskHandle xTimerGetTimerDaemonTaskHandle( void ); +TaskHandle_t xTimerGetTimerDaemonTaskHandle( void ); /** - * portBASE_TYPE xTimerStart( xTimerHandle xTimer, portTickType xBlockTime ); + * BaseType_t xTimerStart( TimerHandle_t xTimer, TickType_t xBlockTime ); * * Timer functionality is provided by a timer service/daemon task. Many of the * public FreeRTOS timer API functions send commands to the timer service task @@ -357,7 +358,7 @@ xTaskHandle xTimerGetTimerDaemonTaskHandle( void ); #define xTimerStart( xTimer, xBlockTime ) xTimerGenericCommand( ( xTimer ), tmrCOMMAND_START, ( xTaskGetTickCount() ), NULL, ( xBlockTime ) ) /** - * portBASE_TYPE xTimerStop( xTimerHandle xTimer, portTickType xBlockTime ); + * BaseType_t xTimerStop( TimerHandle_t xTimer, TickType_t xBlockTime ); * * Timer functionality is provided by a timer service/daemon task. Many of the * public FreeRTOS timer API functions send commands to the timer service task @@ -399,9 +400,9 @@ xTaskHandle xTimerGetTimerDaemonTaskHandle( void ); #define xTimerStop( xTimer, xBlockTime ) xTimerGenericCommand( ( xTimer ), tmrCOMMAND_STOP, 0U, NULL, ( xBlockTime ) ) /** - * portBASE_TYPE xTimerChangePeriod( xTimerHandle xTimer, - * portTickType xNewPeriod, - * portTickType xBlockTime ); + * BaseType_t xTimerChangePeriod( TimerHandle_t xTimer, + * TickType_t xNewPeriod, + * TickType_t xBlockTime ); * * Timer functionality is provided by a timer service/daemon task. Many of the * public FreeRTOS timer API functions send commands to the timer service task @@ -450,7 +451,7 @@ xTaskHandle xTimerGetTimerDaemonTaskHandle( void ); * // is deleted. If the timer referenced by xTimer is not active when it is * // called, then the period of the timer is set to 500ms and the timer is * // started. - * void vAFunction( xTimerHandle xTimer ) + * void vAFunction( TimerHandle_t xTimer ) * { * if( xTimerIsTimerActive( xTimer ) != pdFALSE ) // or more simply and equivalently "if( xTimerIsTimerActive( xTimer ) )" * { @@ -479,7 +480,7 @@ xTaskHandle xTimerGetTimerDaemonTaskHandle( void ); #define xTimerChangePeriod( xTimer, xNewPeriod, xBlockTime ) xTimerGenericCommand( ( xTimer ), tmrCOMMAND_CHANGE_PERIOD, ( xNewPeriod ), NULL, ( xBlockTime ) ) /** - * portBASE_TYPE xTimerDelete( xTimerHandle xTimer, portTickType xBlockTime ); + * BaseType_t xTimerDelete( TimerHandle_t xTimer, TickType_t xBlockTime ); * * Timer functionality is provided by a timer service/daemon task. Many of the * public FreeRTOS timer API functions send commands to the timer service task @@ -517,7 +518,7 @@ xTaskHandle xTimerGetTimerDaemonTaskHandle( void ); #define xTimerDelete( xTimer, xBlockTime ) xTimerGenericCommand( ( xTimer ), tmrCOMMAND_DELETE, 0U, NULL, ( xBlockTime ) ) /** - * portBASE_TYPE xTimerReset( xTimerHandle xTimer, portTickType xBlockTime ); + * BaseType_t xTimerReset( TimerHandle_t xTimer, TickType_t xBlockTime ); * * Timer functionality is provided by a timer service/daemon task. Many of the * public FreeRTOS timer API functions send commands to the timer service task @@ -569,11 +570,11 @@ xTaskHandle xTimerGetTimerDaemonTaskHandle( void ); * // without a key being pressed, then the LCD back-light is switched off. In * // this case, the timer is a one-shot timer. * - * xTimerHandle xBacklightTimer = NULL; + * TimerHandle_t xBacklightTimer = NULL; * * // The callback function assigned to the one-shot timer. In this case the * // parameter is not used. - * void vBacklightTimerCallback( xTimerHandle pxTimer ) + * void vBacklightTimerCallback( TimerHandle_t pxTimer ) * { * // The timer expired, therefore 5 seconds must have passed since a key * // was pressed. Switch off the LCD back-light. @@ -599,7 +600,7 @@ xTaskHandle xTimerGetTimerDaemonTaskHandle( void ); * * void main( void ) * { - * long x; + * int32_t x; * * // Create then start the one-shot timer that is responsible for turning * // the back-light off if no keys are pressed within a 5 second period. @@ -641,8 +642,8 @@ xTaskHandle xTimerGetTimerDaemonTaskHandle( void ); #define xTimerReset( xTimer, xBlockTime ) xTimerGenericCommand( ( xTimer ), tmrCOMMAND_START, ( xTaskGetTickCount() ), NULL, ( xBlockTime ) ) /** - * portBASE_TYPE xTimerStartFromISR( xTimerHandle xTimer, - * portBASE_TYPE *pxHigherPriorityTaskWoken ); + * BaseType_t xTimerStartFromISR( TimerHandle_t xTimer, + * BaseType_t *pxHigherPriorityTaskWoken ); * * A version of xTimerStart() that can be called from an interrupt service * routine. @@ -666,8 +667,9 @@ xTaskHandle xTimerGetTimerDaemonTaskHandle( void ); * successfully sent to the timer command queue. When the command is actually * processed will depend on the priority of the timer service/daemon task * relative to other tasks in the system, although the timers expiry time is - * relative to when xTimerStartFromISR() is actually called. The timer service/daemon - * task priority is set by the configTIMER_TASK_PRIORITY configuration constant. + * relative to when xTimerStartFromISR() is actually called. The timer + * service/daemon task priority is set by the configTIMER_TASK_PRIORITY + * configuration constant. * * Example usage: * @verbatim @@ -680,7 +682,7 @@ xTaskHandle xTimerGetTimerDaemonTaskHandle( void ); * * // The callback function assigned to the one-shot timer. In this case the * // parameter is not used. - * void vBacklightTimerCallback( xTimerHandle pxTimer ) + * void vBacklightTimerCallback( TimerHandle_t pxTimer ) * { * // The timer expired, therefore 5 seconds must have passed since a key * // was pressed. Switch off the LCD back-light. @@ -690,7 +692,7 @@ xTaskHandle xTimerGetTimerDaemonTaskHandle( void ); * // The key press interrupt service routine. * void vKeyPressEventInterruptHandler( void ) * { - * portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE; + * BaseType_t xHigherPriorityTaskWoken = pdFALSE; * * // Ensure the LCD back-light is on, then restart the timer that is * // responsible for turning the back-light off after 5 seconds of @@ -726,8 +728,8 @@ xTaskHandle xTimerGetTimerDaemonTaskHandle( void ); #define xTimerStartFromISR( xTimer, pxHigherPriorityTaskWoken ) xTimerGenericCommand( ( xTimer ), tmrCOMMAND_START, ( xTaskGetTickCountFromISR() ), ( pxHigherPriorityTaskWoken ), 0U ) /** - * portBASE_TYPE xTimerStopFromISR( xTimerHandle xTimer, - * portBASE_TYPE *pxHigherPriorityTaskWoken ); + * BaseType_t xTimerStopFromISR( TimerHandle_t xTimer, + * BaseType_t *pxHigherPriorityTaskWoken ); * * A version of xTimerStop() that can be called from an interrupt service * routine. @@ -761,7 +763,7 @@ xTaskHandle xTimerGetTimerDaemonTaskHandle( void ); * // The interrupt service routine that stops the timer. * void vAnExampleInterruptServiceRoutine( void ) * { - * portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE; + * BaseType_t xHigherPriorityTaskWoken = pdFALSE; * * // The interrupt has occurred - simply stop the timer. * // xHigherPriorityTaskWoken was set to pdFALSE where it was defined @@ -789,9 +791,9 @@ xTaskHandle xTimerGetTimerDaemonTaskHandle( void ); #define xTimerStopFromISR( xTimer, pxHigherPriorityTaskWoken ) xTimerGenericCommand( ( xTimer ), tmrCOMMAND_STOP, 0, ( pxHigherPriorityTaskWoken ), 0U ) /** - * portBASE_TYPE xTimerChangePeriodFromISR( xTimerHandle xTimer, - * portTickType xNewPeriod, - * portBASE_TYPE *pxHigherPriorityTaskWoken ); + * BaseType_t xTimerChangePeriodFromISR( TimerHandle_t xTimer, + * TickType_t xNewPeriod, + * BaseType_t *pxHigherPriorityTaskWoken ); * * A version of xTimerChangePeriod() that can be called from an interrupt * service routine. @@ -834,7 +836,7 @@ xTaskHandle xTimerGetTimerDaemonTaskHandle( void ); * // The interrupt service routine that changes the period of xTimer. * void vAnExampleInterruptServiceRoutine( void ) * { - * portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE; + * BaseType_t xHigherPriorityTaskWoken = pdFALSE; * * // The interrupt has occurred - change the period of xTimer to 500ms. * // xHigherPriorityTaskWoken was set to pdFALSE where it was defined @@ -862,8 +864,8 @@ xTaskHandle xTimerGetTimerDaemonTaskHandle( void ); #define xTimerChangePeriodFromISR( xTimer, xNewPeriod, pxHigherPriorityTaskWoken ) xTimerGenericCommand( ( xTimer ), tmrCOMMAND_CHANGE_PERIOD, ( xNewPeriod ), ( pxHigherPriorityTaskWoken ), 0U ) /** - * portBASE_TYPE xTimerResetFromISR( xTimerHandle xTimer, - * portBASE_TYPE *pxHigherPriorityTaskWoken ); + * BaseType_t xTimerResetFromISR( TimerHandle_t xTimer, + * BaseType_t *pxHigherPriorityTaskWoken ); * * A version of xTimerReset() that can be called from an interrupt service * routine. @@ -902,7 +904,7 @@ xTaskHandle xTimerGetTimerDaemonTaskHandle( void ); * * // The callback function assigned to the one-shot timer. In this case the * // parameter is not used. - * void vBacklightTimerCallback( xTimerHandle pxTimer ) + * void vBacklightTimerCallback( TimerHandle_t pxTimer ) * { * // The timer expired, therefore 5 seconds must have passed since a key * // was pressed. Switch off the LCD back-light. @@ -912,7 +914,7 @@ xTaskHandle xTimerGetTimerDaemonTaskHandle( void ); * // The key press interrupt service routine. * void vKeyPressEventInterruptHandler( void ) * { - * portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE; + * BaseType_t xHigherPriorityTaskWoken = pdFALSE; * * // Ensure the LCD back-light is on, then reset the timer that is * // responsible for turning the back-light off after 5 seconds of @@ -949,10 +951,10 @@ xTaskHandle xTimerGetTimerDaemonTaskHandle( void ); /** - * portBASE_TYPE xTimerPendCallbackFromISR( pdAPPLICATION_CALLBACK_CODE pvCallbackFunction, + * BaseType_t xTimerPendCallbackFromISR( pdAPPLICATION_CALLBACK_CODE pvCallbackFunction, * void *pvParameter1, - * unsigned long ulParameter2, - * portBASE_TYPE *pxHigherPriorityTaskWoken ); + * uint32_t ulParameter2, + * BaseType_t *pxHigherPriorityTaskWoken ); * * * Can be used by interrupt service routines to request that a function (the @@ -1001,13 +1003,13 @@ xTaskHandle xTimerGetTimerDaemonTaskHandle( void ); * * // The callback function that will execute in the context of the daemon task. * // Note callback functions must all use this same prototype. - * void vProcessInterface( void *pvParameter1, unsigned long ulParameter2 ) + * void vProcessInterface( void *pvParameter1, uint32_t ulParameter2 ) * { - * portBASE_TYPE xInterfaceToService; + * BaseType_t xInterfaceToService; * * // The interface that requires servicing is passed in the second * // parameter. The first parameter is not used in this case. - * xInterfaceToService = ( portBASE_TYPE ) ulParameter2; + * xInterfaceToService = ( BaseType_t ) ulParameter2; * * // ...Perform the processing here... * } @@ -1015,7 +1017,7 @@ xTaskHandle xTimerGetTimerDaemonTaskHandle( void ); * // An ISR that receives data packets from multiple interfaces * void vAnISR( void ) * { - * portBASE_TYPE xInterfaceToService, xHigherPriorityTaskWoken; + * BaseType_t xInterfaceToService, xHigherPriorityTaskWoken; * * // Query the hardware to determine which interface needs processing. * xInterfaceToService = prvCheckInterfaces(); @@ -1026,7 +1028,7 @@ xTaskHandle xTimerGetTimerDaemonTaskHandle( void ); * // service is passed in the second parameter. The first parameter is * // not used in this case. * xHigherPriorityTaskWoken = pdFALSE; - * xTimerPendCallbackFromISR( vProcessInterface, NULL, ( unsigned long ) xInterfaceToService, &xHigherPriorityTaskWoken ); + * xTimerPendCallbackFromISR( vProcessInterface, NULL, ( uint32_t ) xInterfaceToService, &xHigherPriorityTaskWoken ); * * // If xHigherPriorityTaskWoken is now set to pdTRUE then a context * // switch should be requested. The macro used is port specific and will @@ -1037,14 +1039,14 @@ xTaskHandle xTimerGetTimerDaemonTaskHandle( void ); * } * @endverbatim */ -portBASE_TYPE xTimerPendCallbackFromISR( pdAPPLICATION_CALLBACK_CODE pvCallbackFunction, void *pvParameter1, unsigned long ulParameter2, portBASE_TYPE *pxHigherPriorityTaskWoken ); +BaseType_t xTimerPendCallbackFromISR( pdAPPLICATION_CALLBACK_CODE pvCallbackFunction, void *pvParameter1, uint32_t ulParameter2, BaseType_t *pxHigherPriorityTaskWoken ); /* * Functions beyond this part are not part of the public API and are intended * for use by the kernel only. */ -portBASE_TYPE xTimerCreateTimerTask( void ) PRIVILEGED_FUNCTION; -portBASE_TYPE xTimerGenericCommand( xTimerHandle xTimer, const portBASE_TYPE xCommandID, const portTickType xOptionalValue, signed portBASE_TYPE * const pxHigherPriorityTaskWoken, const portTickType xBlockTime ) PRIVILEGED_FUNCTION; +BaseType_t xTimerCreateTimerTask( void ) PRIVILEGED_FUNCTION; +BaseType_t xTimerGenericCommand( TimerHandle_t xTimer, const BaseType_t xCommandID, const TickType_t xOptionalValue, BaseType_t * const pxHigherPriorityTaskWoken, const TickType_t xBlockTime ) PRIVILEGED_FUNCTION; #ifdef __cplusplus } diff --git a/FreeRTOS/Source/list.c b/FreeRTOS/Source/list.c index 3c11a88f7..78cc14ffc 100644 --- a/FreeRTOS/Source/list.c +++ b/FreeRTOS/Source/list.c @@ -72,12 +72,12 @@ * PUBLIC LIST API documented in list.h *----------------------------------------------------------*/ -void vListInitialise( xList * const pxList ) +void vListInitialise( List_t * 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 as the only list entry. */ - pxList->pxIndex = ( xListItem * ) &( pxList->xListEnd ); /*lint !e826 !e740 The mini list structure is used as the list end to save RAM. This is checked and valid. */ + pxList->pxIndex = ( ListItem_t * ) &( pxList->xListEnd ); /*lint !e826 !e740 The mini list structure is used as the list end to save RAM. This is checked and valid. */ /* The list end value is the highest possible value in the list to ensure it remains at the end of the list. */ @@ -85,23 +85,23 @@ void vListInitialise( xList * const pxList ) /* The list end next and previous pointers point to itself so we know when the list is empty. */ - pxList->xListEnd.pxNext = ( xListItem * ) &( pxList->xListEnd ); /*lint !e826 !e740 The mini list structure is used as the list end to save RAM. This is checked and valid. */ - pxList->xListEnd.pxPrevious = ( xListItem * ) &( pxList->xListEnd );/*lint !e826 !e740 The mini list structure is used as the list end to save RAM. This is checked and valid. */ + pxList->xListEnd.pxNext = ( ListItem_t * ) &( pxList->xListEnd ); /*lint !e826 !e740 The mini list structure is used as the list end to save RAM. This is checked and valid. */ + pxList->xListEnd.pxPrevious = ( ListItem_t * ) &( pxList->xListEnd );/*lint !e826 !e740 The mini list structure is used as the list end to save RAM. This is checked and valid. */ - pxList->uxNumberOfItems = ( unsigned portBASE_TYPE ) 0U; + pxList->uxNumberOfItems = ( UBaseType_t ) 0U; } /*-----------------------------------------------------------*/ -void vListInitialiseItem( xListItem * const pxItem ) +void vListInitialiseItem( ListItem_t * 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( List_t * const pxList, ListItem_t * const pxNewListItem ) { -xListItem * const pxIndex = pxList->pxIndex; +ListItem_t * const pxIndex = pxList->pxIndex; /* Insert a new list item into pxList, but rather than sort the list, makes the new list item the last item to be removed by a call to @@ -118,10 +118,10 @@ xListItem * const pxIndex = pxList->pxIndex; } /*-----------------------------------------------------------*/ -void vListInsert( xList * const pxList, xListItem * const pxNewListItem ) +void vListInsert( List_t * const pxList, ListItem_t * const pxNewListItem ) { -xListItem *pxIterator; -const portTickType xValueOfInsertion = pxNewListItem->xItemValue; +ListItem_t *pxIterator; +const TickType_t xValueOfInsertion = pxNewListItem->xItemValue; /* Insert the new list item into the list, sorted in xItemValue order. @@ -152,10 +152,11 @@ const portTickType xValueOfInsertion = pxNewListItem->xItemValue; 4) Using a queue or semaphore before it has been initialised or before the scheduler has been started (are interrupts firing before vTaskStartScheduler() has been called?). - See http://www.freertos.org/FAQHelp.html for more tips. + See http://www.freertos.org/FAQHelp.html for more tips, and ensure + configASSERT() is defined! http://www.freertos.org/a00110.html#configASSERT **********************************************************************/ - for( pxIterator = ( xListItem * ) &( pxList->xListEnd ); pxIterator->pxNext->xItemValue <= xValueOfInsertion; pxIterator = pxIterator->pxNext ) /*lint !e826 !e740 The mini list structure is used as the list end to save RAM. This is checked and valid. */ + for( pxIterator = ( ListItem_t * ) &( pxList->xListEnd ); pxIterator->pxNext->xItemValue <= xValueOfInsertion; pxIterator = pxIterator->pxNext ) /*lint !e826 !e740 The mini list structure is used as the list end to save RAM. This is checked and valid. */ { /* There is nothing to do here, we are just iterating to the wanted insertion position. */ @@ -175,11 +176,11 @@ const portTickType xValueOfInsertion = pxNewListItem->xItemValue; } /*-----------------------------------------------------------*/ -unsigned portBASE_TYPE uxListRemove( xListItem * const pxItemToRemove ) +UBaseType_t uxListRemove( ListItem_t * const pxItemToRemove ) { /* The list item knows which list it is in. Obtain the list from the list item. */ -xList * const pxList = ( xList * ) pxItemToRemove->pvContainer; +List_t * const pxList = ( List_t * ) pxItemToRemove->pvContainer; pxItemToRemove->pxNext->pxPrevious = pxItemToRemove->pxPrevious; pxItemToRemove->pxPrevious->pxNext = pxItemToRemove->pxNext; diff --git a/FreeRTOS/Source/portable/BCC/16BitDOS/Flsh186/port.c b/FreeRTOS/Source/portable/BCC/16BitDOS/Flsh186/port.c index e7a8b9187..416b2c6d0 100644 --- a/FreeRTOS/Source/portable/BCC/16BitDOS/Flsh186/port.c +++ b/FreeRTOS/Source/portable/BCC/16BitDOS/Flsh186/port.c @@ -92,15 +92,15 @@ Changes from V2.6.1 /*lint -e950 Non ANSI reserved words okay in this file only. */ #define portTIMER_EOI_TYPE ( 8 ) -#define portRESET_PIC() portOUTPUT_WORD( ( unsigned short ) 0xff22, portTIMER_EOI_TYPE ) +#define portRESET_PIC() portOUTPUT_WORD( ( uint16_t ) 0xff22, portTIMER_EOI_TYPE ) #define portTIMER_INT_NUMBER 0x12 -#define portTIMER_1_CONTROL_REGISTER ( ( unsigned short ) 0xff5e ) -#define portTIMER_0_CONTROL_REGISTER ( ( unsigned short ) 0xff56 ) -#define portTIMER_INTERRUPT_ENABLE ( ( unsigned short ) 0x2000 ) +#define portTIMER_1_CONTROL_REGISTER ( ( uint16_t ) 0xff5e ) +#define portTIMER_0_CONTROL_REGISTER ( ( uint16_t ) 0xff56 ) +#define portTIMER_INTERRUPT_ENABLE ( ( uint16_t ) 0x2000 ) /* Setup the hardware to generate the required tick frequency. */ -static void prvSetTickFrequency( unsigned long ulTickRateHz ); +static void prvSetTickFrequency( uint32_t ulTickRateHz ); /* Set the hardware back to the state as per before the scheduler started. */ static void prvExitFunction( void ); @@ -123,7 +123,7 @@ static void __interrupt __far prvYieldProcessor( void ); /*lint -e956 File scopes necessary here. */ /* Set true when the vectors are set so the scheduler will service the tick. */ -static portBASE_TYPE xSchedulerRunning = pdFALSE; +static BaseType_t xSchedulerRunning = pdFALSE; /* Points to the original routine installed on the vector we use for manual context switches. This is then used to restore the original routine during @@ -136,7 +136,7 @@ static jmp_buf xJumpBuf; /*lint +e956 */ /*-----------------------------------------------------------*/ -portBASE_TYPE xPortStartScheduler( void ) +BaseType_t xPortStartScheduler( void ) { /* This is called with interrupts already disabled. */ @@ -224,8 +224,8 @@ void vPortEndScheduler( void ) static void prvExitFunction( void ) { -const unsigned short usTimerDisable = 0x0000; -unsigned short usTimer0Control; +const uint16_t usTimerDisable = 0x0000; +uint16_t usTimer0Control; /* Interrupts should be disabled here anyway - but no harm in making sure. */ @@ -252,23 +252,23 @@ unsigned short usTimer0Control; } /*-----------------------------------------------------------*/ -static void prvSetTickFrequency( unsigned long ulTickRateHz ) +static void prvSetTickFrequency( uint32_t ulTickRateHz ) { -const unsigned short usMaxCountRegister = 0xff5a; -const unsigned short usTimerPriorityRegister = 0xff32; -const unsigned short usTimerEnable = 0xC000; -const unsigned short usRetrigger = 0x0001; -const unsigned short usTimerHighPriority = 0x0000; -unsigned short usTimer0Control; +const uint16_t usMaxCountRegister = 0xff5a; +const uint16_t usTimerPriorityRegister = 0xff32; +const uint16_t usTimerEnable = 0xC000; +const uint16_t usRetrigger = 0x0001; +const uint16_t usTimerHighPriority = 0x0000; +uint16_t usTimer0Control; /* ( CPU frequency / 4 ) / clock 2 max count [inpw( 0xff62 ) = 7] */ -const unsigned long ulClockFrequency = ( unsigned long ) 0x7f31a0UL; +const uint32_t ulClockFrequency = ( uint32_t ) 0x7f31a0UL; -unsigned long ulTimerCount = ulClockFrequency / ulTickRateHz; +uint32_t ulTimerCount = ulClockFrequency / ulTickRateHz; portOUTPUT_WORD( portTIMER_1_CONTROL_REGISTER, usTimerEnable | portTIMER_INTERRUPT_ENABLE | usRetrigger ); - portOUTPUT_WORD( usMaxCountRegister, ( unsigned short ) ulTimerCount ); + portOUTPUT_WORD( usMaxCountRegister, ( uint16_t ) ulTimerCount ); portOUTPUT_WORD( usTimerPriorityRegister, usTimerHighPriority ); /* Stop the DOS tick - don't do this if you want to maintain a TOD clock. */ diff --git a/FreeRTOS/Source/portable/BCC/16BitDOS/Flsh186/prtmacro.h b/FreeRTOS/Source/portable/BCC/16BitDOS/Flsh186/prtmacro.h index 04ca47ee8..2675dbbce 100644 --- a/FreeRTOS/Source/portable/BCC/16BitDOS/Flsh186/prtmacro.h +++ b/FreeRTOS/Source/portable/BCC/16BitDOS/Flsh186/prtmacro.h @@ -1,5 +1,5 @@ /* - FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. + FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. All rights reserved VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. @@ -67,7 +67,7 @@ #define PORTMACRO_H /*----------------------------------------------------------- - * Port specific definitions. + * Port specific definitions. * * The settings in this file configure FreeRTOS correctly for the * given hardware and compiler. @@ -82,15 +82,19 @@ #define portDOUBLE long #define portLONG long #define portSHORT int -#define portSTACK_TYPE unsigned portSHORT +#define portSTACK_TYPE uint16_t #define portBASE_TYPE portSHORT +typedef portSTACK_TYPE StackType_t; +typedef short BaseType_t; +typedef unsigned short UBaseType_t; + #if( configUSE_16_BIT_TICKS == 1 ) - typedef unsigned portSHORT portTickType; - #define portMAX_DELAY ( portTickType ) 0xffff + typedef uint16_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffff #else - typedef unsigned portLONG portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffffUL + typedef uint32_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffffffffUL #endif /*-----------------------------------------------------------*/ @@ -109,8 +113,8 @@ #define portNOP() __asm{ nop } #define portSTACK_GROWTH ( -1 ) #define portSWITCH_INT_NUMBER 0x80 -#define portYIELD() __asm{ int portSWITCH_INT_NUMBER } -#define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ ) +#define portYIELD() __asm{ int portSWITCH_INT_NUMBER } +#define portTICK_RATE_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ ) #define portBYTE_ALIGNMENT 2 #define portINITIAL_SW ( ( portSTACK_TYPE ) 0x0202 ) /* Start the tasks with interrupts enabled. */ /*-----------------------------------------------------------*/ diff --git a/FreeRTOS/Source/portable/BCC/16BitDOS/PC/port.c b/FreeRTOS/Source/portable/BCC/16BitDOS/PC/port.c index 29e5de914..cce5be8e7 100644 --- a/FreeRTOS/Source/portable/BCC/16BitDOS/PC/port.c +++ b/FreeRTOS/Source/portable/BCC/16BitDOS/PC/port.c @@ -93,7 +93,7 @@ Changes from V4.0.1 #define portTIMER_INT_NUMBER 0x08 /* Setup hardware for required tick interrupt rate. */ -static void prvSetTickFrequency( unsigned long ulTickRateHz ); +static void prvSetTickFrequency( uint32_t ulTickRateHz ); /* Restore hardware to as it was prior to starting the scheduler. */ static void prvExitFunction( void ); @@ -125,10 +125,10 @@ static void prvSetTickFrequencyDefault( void ); /*lint -e956 File scopes necessary here. */ /* Used to signal when to chain to the DOS tick, and when to just clear the PIC ourselves. */ -static short sDOSTickCounter; +static int16_t sDOSTickCounter; /* Set true when the vectors are set so the scheduler will service the tick. */ -static portBASE_TYPE xSchedulerRunning = pdFALSE; +static BaseType_t xSchedulerRunning = pdFALSE; /* Points to the original routine installed on the vector we use for manual context switches. This is then used to restore the original routine during prvExitFunction(). */ static void ( __interrupt __far *pxOldSwitchISR )(); @@ -142,7 +142,7 @@ static jmp_buf xJumpBuf; /*lint +e956 */ /*-----------------------------------------------------------*/ -portBASE_TYPE xPortStartScheduler( void ) +BaseType_t xPortStartScheduler( void ) { pxISR pxOriginalTickISR; @@ -243,7 +243,7 @@ static void prvPortResetPIC( void ) --sDOSTickCounter; if( sDOSTickCounter <= 0 ) { - sDOSTickCounter = ( short ) portTICKS_PER_DOS_TICK; + sDOSTickCounter = ( int16_t ) portTICKS_PER_DOS_TICK; __asm{ int portSWITCH_INT_NUMBER + 1 }; } else @@ -293,28 +293,28 @@ void ( __interrupt __far *pxOriginalTickISR )(); } /*-----------------------------------------------------------*/ -static void prvSetTickFrequency( unsigned long ulTickRateHz ) +static void prvSetTickFrequency( uint32_t ulTickRateHz ) { -const unsigned short usPIT_MODE = ( unsigned short ) 0x43; -const unsigned short usPIT0 = ( unsigned short ) 0x40; -const unsigned long ulPIT_CONST = ( unsigned long ) 1193180UL; -const unsigned short us8254_CTR0_MODE3 = ( unsigned short ) 0x36; -unsigned long ulOutput; +const uint16_t usPIT_MODE = ( uint16_t ) 0x43; +const uint16_t usPIT0 = ( uint16_t ) 0x40; +const uint32_t ulPIT_CONST = ( uint32_t ) 1193180UL; +const uint16_t us8254_CTR0_MODE3 = ( uint16_t ) 0x36; +uint32_t ulOutput; /* Setup the 8245 to tick at the wanted frequency. */ portOUTPUT_BYTE( usPIT_MODE, us8254_CTR0_MODE3 ); ulOutput = ulPIT_CONST / ulTickRateHz; - portOUTPUT_BYTE( usPIT0, ( unsigned short )( ulOutput & ( unsigned long ) 0xff ) ); + portOUTPUT_BYTE( usPIT0, ( uint16_t )( ulOutput & ( uint32_t ) 0xff ) ); ulOutput >>= 8; - portOUTPUT_BYTE( usPIT0, ( unsigned short ) ( ulOutput & ( unsigned long ) 0xff ) ); + portOUTPUT_BYTE( usPIT0, ( uint16_t ) ( ulOutput & ( uint32_t ) 0xff ) ); } /*-----------------------------------------------------------*/ static void prvSetTickFrequencyDefault( void ) { -const unsigned short usPIT_MODE = ( unsigned short ) 0x43; -const unsigned short usPIT0 = ( unsigned short ) 0x40; -const unsigned short us8254_CTR0_MODE3 = ( unsigned short ) 0x36; +const uint16_t usPIT_MODE = ( uint16_t ) 0x43; +const uint16_t usPIT0 = ( uint16_t ) 0x40; +const uint16_t us8254_CTR0_MODE3 = ( uint16_t ) 0x36; portOUTPUT_BYTE( usPIT_MODE, us8254_CTR0_MODE3 ); portOUTPUT_BYTE( usPIT0,0 ); diff --git a/FreeRTOS/Source/portable/BCC/16BitDOS/PC/prtmacro.h b/FreeRTOS/Source/portable/BCC/16BitDOS/PC/prtmacro.h index 21ff0000d..b3d1ae2f1 100644 --- a/FreeRTOS/Source/portable/BCC/16BitDOS/PC/prtmacro.h +++ b/FreeRTOS/Source/portable/BCC/16BitDOS/PC/prtmacro.h @@ -1,5 +1,5 @@ /* - FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. + FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. All rights reserved VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. @@ -67,7 +67,7 @@ #define PORTMACRO_H /*----------------------------------------------------------- - * Port specific definitions. + * Port specific definitions. * * The settings in this file configure FreeRTOS correctly for the * given hardware and compiler. @@ -82,15 +82,19 @@ #define portDOUBLE long #define portLONG long #define portSHORT int -#define portSTACK_TYPE unsigned portSHORT +#define portSTACK_TYPE uint16_t #define portBASE_TYPE portSHORT +typedef portSTACK_TYPE StackType_t; +typedef short BaseType_t; +typedef unsigned short UBaseType_t; + #if( configUSE_16_BIT_TICKS == 1 ) - typedef unsigned portSHORT portTickType; - #define portMAX_DELAY ( portTickType ) 0xffff + typedef uint16_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffff #else - typedef unsigned portLONG portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffffUL + typedef uint32_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffffffffUL #endif /*-----------------------------------------------------------*/ @@ -109,10 +113,10 @@ #define portNOP() __asm{ nop } #define portSTACK_GROWTH ( -1 ) #define portSWITCH_INT_NUMBER 0x80 -#define portYIELD() __asm{ int portSWITCH_INT_NUMBER } +#define portYIELD() __asm{ int portSWITCH_INT_NUMBER } #define portDOS_TICK_RATE ( 18.20648 ) -#define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ ) -#define portTICKS_PER_DOS_TICK ( ( unsigned portSHORT ) ( ( ( portDOUBLE ) configTICK_RATE_HZ / portDOS_TICK_RATE ) + 0.5 ) ) +#define portTICK_RATE_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ ) +#define portTICKS_PER_DOS_TICK ( ( uint16_t ) ( ( ( portDOUBLE ) configTICK_RATE_HZ / portDOS_TICK_RATE ) + 0.5 ) ) #define portINITIAL_SW ( ( portSTACK_TYPE ) 0x0202 ) /* Start the tasks with interrupts enabled. */ #define portBYTE_ALIGNMENT ( 2 ) /*-----------------------------------------------------------*/ diff --git a/FreeRTOS/Source/portable/BCC/16BitDOS/common/portasm.h b/FreeRTOS/Source/portable/BCC/16BitDOS/common/portasm.h index ccfbbb321..a404f4746 100644 --- a/FreeRTOS/Source/portable/BCC/16BitDOS/common/portasm.h +++ b/FreeRTOS/Source/portable/BCC/16BitDOS/common/portasm.h @@ -66,8 +66,8 @@ #ifndef PORT_ASM_H #define PORT_ASM_H -typedef void tskTCB; -extern volatile tskTCB * volatile pxCurrentTCB; +typedef void TCB_t; +extern volatile TCB_t * volatile pxCurrentTCB; extern void vTaskSwitchContext( void ); /* diff --git a/FreeRTOS/Source/portable/BCC/16BitDOS/common/portcomn.c b/FreeRTOS/Source/portable/BCC/16BitDOS/common/portcomn.c index 7a62ce9a2..ded7c32bc 100644 --- a/FreeRTOS/Source/portable/BCC/16BitDOS/common/portcomn.c +++ b/FreeRTOS/Source/portable/BCC/16BitDOS/common/portcomn.c @@ -83,9 +83,9 @@ Changes from V2.6.1 /*-----------------------------------------------------------*/ /* See header file for description. */ -portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) +StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) { -portSTACK_TYPE DS_Reg = 0; +StackType_t DS_Reg = 0; /* Place a few bytes of known values on the bottom of the stack. This is just useful for debugging. */ @@ -128,15 +128,15 @@ portSTACK_TYPE DS_Reg = 0; /* The remaining registers would be pushed on the stack by our context switch function. These are loaded with values simply to make debugging easier. */ - *pxTopOfStack = ( portSTACK_TYPE ) 0xAAAA; /* AX */ + *pxTopOfStack = ( StackType_t ) 0xAAAA; /* AX */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0xBBBB; /* BX */ + *pxTopOfStack = ( StackType_t ) 0xBBBB; /* BX */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0xCCCC; /* CX */ + *pxTopOfStack = ( StackType_t ) 0xCCCC; /* CX */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0xDDDD; /* DX */ + *pxTopOfStack = ( StackType_t ) 0xDDDD; /* DX */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0xEEEE; /* ES */ + *pxTopOfStack = ( StackType_t ) 0xEEEE; /* ES */ pxTopOfStack--; /* We need the true data segment. */ @@ -144,11 +144,11 @@ portSTACK_TYPE DS_Reg = 0; *pxTopOfStack = DS_Reg; /* DS */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x0123; /* SI */ + *pxTopOfStack = ( StackType_t ) 0x0123; /* SI */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0xDDDD; /* DI */ + *pxTopOfStack = ( StackType_t ) 0xDDDD; /* DI */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0xBBBB; /* BP */ + *pxTopOfStack = ( StackType_t ) 0xBBBB; /* BP */ /*lint +e950 +e611 +e923 */ diff --git a/FreeRTOS/Source/portable/CCS/ARM_Cortex-R4/port.c b/FreeRTOS/Source/portable/CCS/ARM_Cortex-R4/port.c index 7fd41deed..93481c32a 100644 --- a/FreeRTOS/Source/portable/CCS/ARM_Cortex-R4/port.c +++ b/FreeRTOS/Source/portable/CCS/ARM_Cortex-R4/port.c @@ -70,29 +70,29 @@ /*-----------------------------------------------------------*/ /* Count of the critical section nesting depth. */ -unsigned portLONG ulCriticalNesting = 9999; +uint32_t ulCriticalNesting = 9999; /*-----------------------------------------------------------*/ /* Registers required to configure the RTI. */ -#define portRTI_GCTRL_REG ( * ( ( volatile unsigned long * ) 0xFFFFFC00 ) ) -#define portRTI_TBCTRL_REG ( * ( ( volatile unsigned long * ) 0xFFFFFC04 ) ) -#define portRTI_COMPCTRL_REG ( * ( ( volatile unsigned long * ) 0xFFFFFC0C ) ) -#define portRTI_CNT0_FRC0_REG ( * ( ( volatile unsigned long * ) 0xFFFFFC10 ) ) -#define portRTI_CNT0_UC0_REG ( * ( ( volatile unsigned long * ) 0xFFFFFC14 ) ) -#define portRTI_CNT0_CPUC0_REG ( * ( ( volatile unsigned long * ) 0xFFFFFC18 ) ) -#define portRTI_CNT0_COMP0_REG ( * ( ( volatile unsigned long * ) 0xFFFFFC50 ) ) -#define portRTI_CNT0_UDCP0_REG ( * ( ( volatile unsigned long * ) 0xFFFFFC54 ) ) -#define portRTI_SETINTENA_REG ( * ( ( volatile unsigned long * ) 0xFFFFFC80 ) ) -#define portRTI_CLEARINTENA_REG ( * ( ( volatile unsigned long * ) 0xFFFFFC84 ) ) -#define portRTI_INTFLAG_REG ( * ( ( volatile unsigned long * ) 0xFFFFFC88 ) ) +#define portRTI_GCTRL_REG ( * ( ( volatile uint32_t * ) 0xFFFFFC00 ) ) +#define portRTI_TBCTRL_REG ( * ( ( volatile uint32_t * ) 0xFFFFFC04 ) ) +#define portRTI_COMPCTRL_REG ( * ( ( volatile uint32_t * ) 0xFFFFFC0C ) ) +#define portRTI_CNT0_FRC0_REG ( * ( ( volatile uint32_t * ) 0xFFFFFC10 ) ) +#define portRTI_CNT0_UC0_REG ( * ( ( volatile uint32_t * ) 0xFFFFFC14 ) ) +#define portRTI_CNT0_CPUC0_REG ( * ( ( volatile uint32_t * ) 0xFFFFFC18 ) ) +#define portRTI_CNT0_COMP0_REG ( * ( ( volatile uint32_t * ) 0xFFFFFC50 ) ) +#define portRTI_CNT0_UDCP0_REG ( * ( ( volatile uint32_t * ) 0xFFFFFC54 ) ) +#define portRTI_SETINTENA_REG ( * ( ( volatile uint32_t * ) 0xFFFFFC80 ) ) +#define portRTI_CLEARINTENA_REG ( * ( ( volatile uint32_t * ) 0xFFFFFC84 ) ) +#define portRTI_INTFLAG_REG ( * ( ( volatile uint32_t * ) 0xFFFFFC88 ) ) /* Constants required to set up the initial stack of each task. */ -#define portINITIAL_SPSR ( ( portSTACK_TYPE ) 0x1F ) -#define portINITIAL_FPSCR ( ( portSTACK_TYPE ) 0x00 ) -#define portINSTRUCTION_SIZE ( ( portSTACK_TYPE ) 0x04 ) -#define portTHUMB_MODE_BIT ( ( portSTACK_TYPE ) 0x20 ) +#define portINITIAL_SPSR ( ( StackType_t ) 0x1F ) +#define portINITIAL_FPSCR ( ( StackType_t ) 0x00 ) +#define portINSTRUCTION_SIZE ( ( StackType_t ) 0x04 ) +#define portTHUMB_MODE_BIT ( ( StackType_t ) 0x20 ) /* The number of words on the stack frame between the saved Top Of Stack and R0 (in which the parameters are passed. */ @@ -107,7 +107,7 @@ extern void vPortStartFirstTask( void ); /* Saved as part of the task context. Set to pdFALSE if the task does not require an FPU context. */ -unsigned long ulTaskHasFPUContext = 0; +uint32_t ulTaskHasFPUContext = 0; /*-----------------------------------------------------------*/ @@ -115,9 +115,9 @@ unsigned long ulTaskHasFPUContext = 0; /* * See header file for description. */ -portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) +StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) { -portSTACK_TYPE *pxOriginalTOS; +StackType_t *pxOriginalTOS; pxOriginalTOS = pxTopOfStack; @@ -134,39 +134,39 @@ portSTACK_TYPE *pxOriginalTOS; /* First on the stack is the return address - which is the start of the as the task has not executed yet. The offset is added to make the return address appear as it would within an IRQ ISR. */ - *pxTopOfStack = ( portSTACK_TYPE ) pxCode + portINSTRUCTION_SIZE; + *pxTopOfStack = ( StackType_t ) pxCode + portINSTRUCTION_SIZE; pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x00000000; /* R14 */ + *pxTopOfStack = ( StackType_t ) 0x00000000; /* R14 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) pxOriginalTOS; /* Stack used when task starts goes in R13. */ + *pxTopOfStack = ( StackType_t ) pxOriginalTOS; /* Stack used when task starts goes in R13. */ pxTopOfStack--; #ifdef portPRELOAD_TASK_REGISTERS { - *pxTopOfStack = ( portSTACK_TYPE ) 0x12121212; /* R12 */ + *pxTopOfStack = ( StackType_t ) 0x12121212; /* R12 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x11111111; /* R11 */ + *pxTopOfStack = ( StackType_t ) 0x11111111; /* R11 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x10101010; /* R10 */ + *pxTopOfStack = ( StackType_t ) 0x10101010; /* R10 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x09090909; /* R9 */ + *pxTopOfStack = ( StackType_t ) 0x09090909; /* R9 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x08080808; /* R8 */ + *pxTopOfStack = ( StackType_t ) 0x08080808; /* R8 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x07070707; /* R7 */ + *pxTopOfStack = ( StackType_t ) 0x07070707; /* R7 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x06060606; /* R6 */ + *pxTopOfStack = ( StackType_t ) 0x06060606; /* R6 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x05050505; /* R5 */ + *pxTopOfStack = ( StackType_t ) 0x05050505; /* R5 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x04040404; /* R4 */ + *pxTopOfStack = ( StackType_t ) 0x04040404; /* R4 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x03030303; /* R3 */ + *pxTopOfStack = ( StackType_t ) 0x03030303; /* R3 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x02020202; /* R2 */ + *pxTopOfStack = ( StackType_t ) 0x02020202; /* R2 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x01010101; /* R1 */ + *pxTopOfStack = ( StackType_t ) 0x01010101; /* R1 */ pxTopOfStack--; } #else @@ -176,13 +176,13 @@ portSTACK_TYPE *pxOriginalTOS; #endif /* Function parameters are passed in R0. */ - *pxTopOfStack = ( portSTACK_TYPE ) pvParameters; /* R0 */ + *pxTopOfStack = ( StackType_t ) pvParameters; /* R0 */ pxTopOfStack--; /* Set the status register for system mode, with interrupts enabled. */ - *pxTopOfStack = ( portSTACK_TYPE ) ( ( _get_CPSR() & ~0xFF ) | portINITIAL_SPSR ); + *pxTopOfStack = ( StackType_t ) ( ( _get_CPSR() & ~0xFF ) | portINITIAL_SPSR ); - if( ( ( unsigned long ) pxCode & 0x01UL ) != 0x00 ) + if( ( ( uint32_t ) pxCode & 0x01UL ) != 0x00 ) { /* The task will start in thumb mode. */ *pxTopOfStack |= portTHUMB_MODE_BIT; @@ -236,7 +236,7 @@ static void prvSetupTimerInterrupt(void) /* * See header file for description. */ -portBASE_TYPE xPortStartScheduler(void) +BaseType_t xPortStartScheduler(void) { /* Start the timer that generates the tick ISR. */ prvSetupTimerInterrupt(); diff --git a/FreeRTOS/Source/portable/CCS/ARM_Cortex-R4/portmacro.h b/FreeRTOS/Source/portable/CCS/ARM_Cortex-R4/portmacro.h index beb539eaf..f81b40cbb 100644 --- a/FreeRTOS/Source/portable/CCS/ARM_Cortex-R4/portmacro.h +++ b/FreeRTOS/Source/portable/CCS/ARM_Cortex-R4/portmacro.h @@ -1,5 +1,5 @@ /* - FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. + FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. All rights reserved VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. @@ -82,21 +82,25 @@ #define portDOUBLE double #define portLONG long #define portSHORT short -#define portSTACK_TYPE unsigned long +#define portSTACK_TYPE uint32_t #define portBASE_TYPE long +typedef portSTACK_TYPE StackType_t; +typedef long BaseType_t; +typedef unsigned long UBaseType_t; + #if (configUSE_16_BIT_TICKS == 1) - typedef unsigned portSHORT portTickType; - #define portMAX_DELAY (portTickType) 0xFFFF + typedef uint16_t TickType_t; + #define portMAX_DELAY (TickType_t) 0xFFFF #else - typedef unsigned portLONG portTickType; - #define portMAX_DELAY (portTickType) 0xFFFFFFFFF + typedef uint32_t TickType_t; + #define portMAX_DELAY (TickType_t) 0xFFFFFFFFF #endif /* Architecture specifics. */ #define portSTACK_GROWTH (-1) -#define portTICK_RATE_MS ((portTickType) 1000 / configTICK_RATE_HZ) +#define portTICK_RATE_MS ((TickType_t) 1000 / configTICK_RATE_HZ) #define portBYTE_ALIGNMENT 8 /* Critical section handling. */ @@ -111,7 +115,7 @@ extern void vPortExitCritical(void); #pragma SWI_ALIAS( vPortYield, 0 ) extern void vPortYield( void ); #define portYIELD() vPortYield() -#define portSYS_SSIR1_REG ( * ( ( volatile unsigned long * ) 0xFFFFFFB0 ) ) +#define portSYS_SSIR1_REG ( * ( ( volatile uint32_t * ) 0xFFFFFFB0 ) ) #define portSYS_SSIR1_SSKEY ( 0x7500UL ) #define portYIELD_WITHIN_API() { portSYS_SSIR1_REG = portSYS_SSIR1_SSKEY; asm( " DSB " ); asm( " ISB " ); } #define portYIELD_FROM_ISR( x ) if( x != pdFALSE ){ portSYS_SSIR1_REG = portSYS_SSIR1_SSKEY; ( void ) portSYS_SSIR1_REG; } diff --git a/FreeRTOS/Source/portable/CCS/MSP430X/port.c b/FreeRTOS/Source/portable/CCS/MSP430X/port.c index 4dae94cfc..69d81325c 100644 --- a/FreeRTOS/Source/portable/CCS/MSP430X/port.c +++ b/FreeRTOS/Source/portable/CCS/MSP430X/port.c @@ -73,14 +73,14 @@ /* Constants required for hardware setup. The tick ISR runs off the ACLK, not the MCLK. */ -#define portACLK_FREQUENCY_HZ ( ( portTickType ) 32768 ) -#define portINITIAL_CRITICAL_NESTING ( ( unsigned short ) 10 ) -#define portFLAGS_INT_ENABLED ( ( portSTACK_TYPE ) 0x08 ) +#define portACLK_FREQUENCY_HZ ( ( TickType_t ) 32768 ) +#define portINITIAL_CRITICAL_NESTING ( ( uint16_t ) 10 ) +#define portFLAGS_INT_ENABLED ( ( StackType_t ) 0x08 ) /* We require the address of the pxCurrentTCB variable, but don't want to know any details of its type. */ -typedef void tskTCB; -extern volatile tskTCB * volatile pxCurrentTCB; +typedef void TCB_t; +extern volatile TCB_t * volatile pxCurrentTCB; /* Each task maintains a count of the critical section nesting depth. Each time a critical section is entered the count is incremented. Each time a @@ -90,7 +90,7 @@ being re-enabled if the count is zero. usCriticalNesting will get set to zero when the scheduler starts, but must not be initialised to zero as this will cause problems during the startup sequence. */ -volatile unsigned short usCriticalNesting = portINITIAL_CRITICAL_NESTING; +volatile uint16_t usCriticalNesting = portINITIAL_CRITICAL_NESTING; /*-----------------------------------------------------------*/ @@ -107,83 +107,83 @@ void vPortSetupTimerInterrupt( void ); * * See the header file portable.h. */ -portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) +StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) { -unsigned short *pusTopOfStack; -unsigned long *pulTopOfStack, ulTemp; +uint16_t *pusTopOfStack; +uint32_t *pulTopOfStack, ulTemp; /* Place a few bytes of known values on the bottom of the stack. This is just useful for debugging and can be included if required. - *pxTopOfStack = ( portSTACK_TYPE ) 0x1111; + *pxTopOfStack = ( StackType_t ) 0x1111; pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x2222; + *pxTopOfStack = ( StackType_t ) 0x2222; pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x3333; + *pxTopOfStack = ( StackType_t ) 0x3333; pxTopOfStack--; */ /* Data types are need either 16 bits or 32 bits depending on the data and code model used. */ - if( sizeof( pxCode ) == sizeof( unsigned short ) ) + if( sizeof( pxCode ) == sizeof( uint16_t ) ) { - pusTopOfStack = ( unsigned short * ) pxTopOfStack; - ulTemp = ( unsigned long ) pxCode; - *pusTopOfStack = ( unsigned short ) ulTemp; + pusTopOfStack = ( uint16_t * ) pxTopOfStack; + ulTemp = ( uint32_t ) pxCode; + *pusTopOfStack = ( uint16_t ) ulTemp; } else { /* Make room for a 20 bit value stored as a 32 bit value. */ - pusTopOfStack = ( unsigned short * ) pxTopOfStack; + pusTopOfStack = ( uint16_t * ) pxTopOfStack; pusTopOfStack--; - pulTopOfStack = ( unsigned long * ) pusTopOfStack; - *pulTopOfStack = ( unsigned long ) pxCode; + pulTopOfStack = ( uint32_t * ) pusTopOfStack; + *pulTopOfStack = ( uint32_t ) pxCode; } pusTopOfStack--; *pusTopOfStack = portFLAGS_INT_ENABLED; - pusTopOfStack -= ( sizeof( portSTACK_TYPE ) / 2 ); + pusTopOfStack -= ( sizeof( StackType_t ) / 2 ); /* From here on the size of stacked items depends on the memory model. */ - pxTopOfStack = ( portSTACK_TYPE * ) pusTopOfStack; + pxTopOfStack = ( StackType_t * ) pusTopOfStack; /* Next the general purpose registers. */ #ifdef PRELOAD_REGISTER_VALUES - *pxTopOfStack = ( portSTACK_TYPE ) 0xffff; + *pxTopOfStack = ( StackType_t ) 0xffff; pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0xeeee; + *pxTopOfStack = ( StackType_t ) 0xeeee; pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0xdddd; + *pxTopOfStack = ( StackType_t ) 0xdddd; pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) pvParameters; + *pxTopOfStack = ( StackType_t ) pvParameters; pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0xbbbb; + *pxTopOfStack = ( StackType_t ) 0xbbbb; pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0xaaaa; + *pxTopOfStack = ( StackType_t ) 0xaaaa; pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x9999; + *pxTopOfStack = ( StackType_t ) 0x9999; pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x8888; + *pxTopOfStack = ( StackType_t ) 0x8888; pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x5555; + *pxTopOfStack = ( StackType_t ) 0x5555; pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x6666; + *pxTopOfStack = ( StackType_t ) 0x6666; pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x5555; + *pxTopOfStack = ( StackType_t ) 0x5555; pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x4444; + *pxTopOfStack = ( StackType_t ) 0x4444; pxTopOfStack--; #else pxTopOfStack -= 3; - *pxTopOfStack = ( portSTACK_TYPE ) pvParameters; + *pxTopOfStack = ( StackType_t ) pvParameters; pxTopOfStack -= 9; #endif /* A variable is used to keep track of the critical section nesting. This variable has to be stored as part of the task context and is initially set to zero. */ - *pxTopOfStack = ( portSTACK_TYPE ) portNO_CRITICAL_SECTION_NESTING; + *pxTopOfStack = ( StackType_t ) portNO_CRITICAL_SECTION_NESTING; /* Return a pointer to the top of the stack we have generated so this can be stored in the task control block for the task. */ diff --git a/FreeRTOS/Source/portable/CCS/MSP430X/portmacro.h b/FreeRTOS/Source/portable/CCS/MSP430X/portmacro.h index 4a9785bef..f10ea228f 100644 --- a/FreeRTOS/Source/portable/CCS/MSP430X/portmacro.h +++ b/FreeRTOS/Source/portable/CCS/MSP430X/portmacro.h @@ -1,5 +1,5 @@ /* - FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. + FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. All rights reserved VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. @@ -89,20 +89,24 @@ /* The stack type changes depending on the data model. */ #ifdef __LARGE_DATA_MODEL__ - #define portSTACK_TYPE unsigned long + #define portSTACK_TYPE uint32_t #else - #define portSTACK_TYPE unsigned short + #define portSTACK_TYPE uint16_t #endif +typedef portSTACK_TYPE StackType_t; +typedef short BaseType_t; +typedef unsigned short UBaseType_t; + #if( configUSE_16_BIT_TICKS == 1 ) - typedef unsigned portSHORT portTickType; - #define portMAX_DELAY ( portTickType ) 0xffff + typedef uint16_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffff #else - typedef unsigned portLONG portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffffUL + typedef uint32_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffffffffUL #endif -/*-----------------------------------------------------------*/ +/*-----------------------------------------------------------*/ /* Interrupt control macros. */ #define portDISABLE_INTERRUPTS() _disable_interrupt(); _nop() @@ -110,11 +114,11 @@ /*-----------------------------------------------------------*/ /* Critical section control macros. */ -#define portNO_CRITICAL_SECTION_NESTING ( ( unsigned portSHORT ) 0 ) +#define portNO_CRITICAL_SECTION_NESTING ( ( uint16_t ) 0 ) #define portENTER_CRITICAL() \ { \ -extern volatile unsigned short usCriticalNesting; \ +extern volatile uint16_t usCriticalNesting; \ \ portDISABLE_INTERRUPTS(); \ \ @@ -126,7 +130,7 @@ extern volatile unsigned short usCriticalNesting; \ #define portEXIT_CRITICAL() \ { \ -extern volatile unsigned short usCriticalNesting; \ +extern volatile uint16_t usCriticalNesting; \ \ if( usCriticalNesting > portNO_CRITICAL_SECTION_NESTING ) \ { \ @@ -155,8 +159,8 @@ extern void vPortYield( void ); /* Hardware specifics. */ #define portBYTE_ALIGNMENT 2 #define portSTACK_GROWTH ( -1 ) -#define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ ) -#define portNOP() __no_operation() +#define portTICK_RATE_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ ) +#define portNOP() __no_operation() /*-----------------------------------------------------------*/ /* Task function macros as described on the FreeRTOS.org WEB site. */ @@ -165,7 +169,7 @@ extern void vPortYield( void ); extern void vTaskSwitchContext( void ); #define portYIELD_FROM_ISR( x ) if( x ) vPortYield() - + void vApplicationSetupTimerInterrupt( void ); /* sizeof( int ) != sizeof( long ) so a full printf() library is required if diff --git a/FreeRTOS/Source/portable/CodeWarrior/ColdFire_V1/port.c b/FreeRTOS/Source/portable/CodeWarrior/ColdFire_V1/port.c index a3c280030..f4f1d2907 100644 --- a/FreeRTOS/Source/portable/CodeWarrior/ColdFire_V1/port.c +++ b/FreeRTOS/Source/portable/CodeWarrior/ColdFire_V1/port.c @@ -68,49 +68,49 @@ #include "task.h" -#define portINITIAL_FORMAT_VECTOR ( ( portSTACK_TYPE ) 0x4000 ) +#define portINITIAL_FORMAT_VECTOR ( ( StackType_t ) 0x4000 ) /* Supervisor mode set. */ -#define portINITIAL_STATUS_REGISTER ( ( portSTACK_TYPE ) 0x2000) +#define portINITIAL_STATUS_REGISTER ( ( StackType_t ) 0x2000) /* The clock prescale into the timer peripheral. */ -#define portPRESCALE_VALUE ( ( unsigned char ) 10 ) +#define portPRESCALE_VALUE ( ( uint8_t ) 10 ) /* The clock frequency into the RTC. */ -#define portRTC_CLOCK_HZ ( ( unsigned long ) 1000 ) +#define portRTC_CLOCK_HZ ( ( uint32_t ) 1000 ) asm void interrupt VectorNumber_VL1swi vPortYieldISR( void ); static void prvSetupTimerInterrupt( void ); /* Used to keep track of the number of nested calls to taskENTER_CRITICAL(). This will be set to 0 prior to the first task being started. */ -static unsigned long ulCriticalNesting = 0x9999UL; +static uint32_t ulCriticalNesting = 0x9999UL; /*-----------------------------------------------------------*/ -portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE * pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) +StackType_t *pxPortInitialiseStack( StackType_t * pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) { -unsigned long ulOriginalA5; +uint32_t ulOriginalA5; __asm{ MOVE.L A5, ulOriginalA5 }; - *pxTopOfStack = (portSTACK_TYPE) 0xDEADBEEF; + *pxTopOfStack = (StackType_t) 0xDEADBEEF; pxTopOfStack--; /* Exception stack frame starts with the return address. */ - *pxTopOfStack = ( portSTACK_TYPE ) pxCode; + *pxTopOfStack = ( StackType_t ) pxCode; pxTopOfStack--; *pxTopOfStack = ( portINITIAL_FORMAT_VECTOR << 16UL ) | ( portINITIAL_STATUS_REGISTER ); pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x0; /*FP*/ + *pxTopOfStack = ( StackType_t ) 0x0; /*FP*/ pxTopOfStack -= 14; /* A5 to D0. */ /* Parameter in A0. */ - *( pxTopOfStack + 8 ) = ( portSTACK_TYPE ) pvParameters; + *( pxTopOfStack + 8 ) = ( StackType_t ) pvParameters; /* A5 must be maintained as it is resurved by the compiler. */ *( pxTopOfStack + 13 ) = ulOriginalA5; @@ -119,7 +119,7 @@ unsigned long ulOriginalA5; } /*-----------------------------------------------------------*/ -portBASE_TYPE xPortStartScheduler( void ) +BaseType_t xPortStartScheduler( void ) { extern void vPortStartFirstTask( void ); @@ -189,7 +189,7 @@ void vPortExitCritical( void ) void vPortYieldHandler( void ) { -unsigned long ulSavedInterruptMask; +uint32_t ulSavedInterruptMask; ulSavedInterruptMask = portSET_INTERRUPT_MASK_FROM_ISR(); { @@ -203,7 +203,7 @@ unsigned long ulSavedInterruptMask; void interrupt VectorNumber_Vrtc vPortTickISR( void ) { -unsigned long ulSavedInterruptMask; +uint32_t ulSavedInterruptMask; /* Clear the interrupt. */ RTCSC |= RTCSC_RTIF_MASK; diff --git a/FreeRTOS/Source/portable/CodeWarrior/ColdFire_V1/portmacro.h b/FreeRTOS/Source/portable/CodeWarrior/ColdFire_V1/portmacro.h index 65b3dba55..341b73f4c 100644 --- a/FreeRTOS/Source/portable/CodeWarrior/ColdFire_V1/portmacro.h +++ b/FreeRTOS/Source/portable/CodeWarrior/ColdFire_V1/portmacro.h @@ -1,5 +1,5 @@ /* - FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. + FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. All rights reserved VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. @@ -86,25 +86,30 @@ extern "C" { #define portDOUBLE double #define portLONG long #define portSHORT short -#define portSTACK_TYPE unsigned long +#define portSTACK_TYPE uint32_t #define portBASE_TYPE long +typedef portSTACK_TYPE StackType_t; +typedef long BaseType_t; +typedef unsigned long UBaseType_t; + + #if( configUSE_16_BIT_TICKS == 1 ) - typedef unsigned portSHORT portTickType; - #define portMAX_DELAY ( portTickType ) 0xffff + typedef uint16_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffff #else - typedef unsigned portLONG portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffffUL + typedef uint32_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffffffffUL #endif /*-----------------------------------------------------------*/ /* Hardware specifics. */ #define portBYTE_ALIGNMENT 4 #define portSTACK_GROWTH -1 -#define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ ) +#define portTICK_RATE_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ ) /*-----------------------------------------------------------*/ -unsigned portLONG ulPortSetIPL( unsigned portLONG ); +uint32_t ulPortSetIPL( uint32_t ); #define portDISABLE_INTERRUPTS() ulPortSetIPL( configMAX_SYSCALL_INTERRUPT_PRIORITY ) #define portENABLE_INTERRUPTS() ulPortSetIPL( 0 ) @@ -114,8 +119,8 @@ extern void vPortExitCritical( void ); #define portENTER_CRITICAL() vPortEnterCritical() #define portEXIT_CRITICAL() vPortExitCritical() -extern unsigned portBASE_TYPE uxPortSetInterruptMaskFromISR( void ); -extern void vPortClearInterruptMaskFromISR( unsigned portBASE_TYPE ); +extern UBaseType_t uxPortSetInterruptMaskFromISR( void ); +extern void vPortClearInterruptMaskFromISR( UBaseType_t ); #define portSET_INTERRUPT_MASK_FROM_ISR() ulPortSetIPL( configMAX_SYSCALL_INTERRUPT_PRIORITY ) #define portCLEAR_INTERRUPT_MASK_FROM_ISR( uxSavedStatusRegister ) ulPortSetIPL( uxSavedStatusRegister ) diff --git a/FreeRTOS/Source/portable/CodeWarrior/ColdFire_V2/port.c b/FreeRTOS/Source/portable/CodeWarrior/ColdFire_V2/port.c index 9acaa90aa..0874951da 100644 --- a/FreeRTOS/Source/portable/CodeWarrior/ColdFire_V2/port.c +++ b/FreeRTOS/Source/portable/CodeWarrior/ColdFire_V2/port.c @@ -68,14 +68,14 @@ #include "task.h" -#define portINITIAL_FORMAT_VECTOR ( ( portSTACK_TYPE ) 0x4000 ) +#define portINITIAL_FORMAT_VECTOR ( ( StackType_t ) 0x4000 ) /* Supervisor mode set. */ -#define portINITIAL_STATUS_REGISTER ( ( portSTACK_TYPE ) 0x2000) +#define portINITIAL_STATUS_REGISTER ( ( StackType_t ) 0x2000) /* Used to keep track of the number of nested calls to taskENTER_CRITICAL(). This will be set to 0 prior to the first task being started. */ -static unsigned long ulCriticalNesting = 0x9999UL; +static uint32_t ulCriticalNesting = 0x9999UL; #define portSAVE_CONTEXT() \ @@ -95,29 +95,29 @@ static unsigned long ulCriticalNesting = 0x9999UL; /*-----------------------------------------------------------*/ -portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE * pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) +StackType_t *pxPortInitialiseStack( StackType_t * pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) { - *pxTopOfStack = ( portSTACK_TYPE ) pvParameters; + *pxTopOfStack = ( StackType_t ) pvParameters; pxTopOfStack--; - *pxTopOfStack = (portSTACK_TYPE) 0xDEADBEEF; + *pxTopOfStack = (StackType_t) 0xDEADBEEF; pxTopOfStack--; /* Exception stack frame starts with the return address. */ - *pxTopOfStack = ( portSTACK_TYPE ) pxCode; + *pxTopOfStack = ( StackType_t ) pxCode; pxTopOfStack--; *pxTopOfStack = ( portINITIAL_FORMAT_VECTOR << 16UL ) | ( portINITIAL_STATUS_REGISTER ); pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x0; /*FP*/ + *pxTopOfStack = ( StackType_t ) 0x0; /*FP*/ pxTopOfStack -= 14; /* A5 to D0. */ return pxTopOfStack; } /*-----------------------------------------------------------*/ -portBASE_TYPE xPortStartScheduler( void ) +BaseType_t xPortStartScheduler( void ) { extern void vPortStartFirstTask( void ); @@ -173,7 +173,7 @@ void vPortExitCritical( void ) void vPortYieldHandler( void ) { -unsigned long ulSavedInterruptMask; +uint32_t ulSavedInterruptMask; ulSavedInterruptMask = portSET_INTERRUPT_MASK_FROM_ISR(); /* Note this will clear all forced interrupts - this is done for speed. */ diff --git a/FreeRTOS/Source/portable/CodeWarrior/ColdFire_V2/portmacro.h b/FreeRTOS/Source/portable/CodeWarrior/ColdFire_V2/portmacro.h index dea63b3db..38ad5a33f 100644 --- a/FreeRTOS/Source/portable/CodeWarrior/ColdFire_V2/portmacro.h +++ b/FreeRTOS/Source/portable/CodeWarrior/ColdFire_V2/portmacro.h @@ -1,5 +1,5 @@ /* - FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. + FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. All rights reserved VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. @@ -86,24 +86,28 @@ extern "C" { #define portDOUBLE double #define portLONG long #define portSHORT short -#define portSTACK_TYPE unsigned long +#define portSTACK_TYPE uint32_t #define portBASE_TYPE long +typedef portSTACK_TYPE StackType_t; +typedef long BaseType_t; +typedef unsigned long UBaseType_t; + #if( configUSE_16_BIT_TICKS == 1 ) - typedef unsigned portSHORT portTickType; - #define portMAX_DELAY ( portTickType ) 0xffff + typedef uint16_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffff #else - typedef unsigned portLONG portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffffUL + typedef uint32_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffffffffUL #endif /*-----------------------------------------------------------*/ /* Hardware specifics. */ #define portBYTE_ALIGNMENT 4 #define portSTACK_GROWTH -1 -#define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ ) +#define portTICK_RATE_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ ) /*-----------------------------------------------------------*/ -unsigned portLONG ulPortSetIPL( unsigned portLONG ); +uint32_t ulPortSetIPL( uint32_t ); #define portDISABLE_INTERRUPTS() ulPortSetIPL( configMAX_SYSCALL_INTERRUPT_PRIORITY ) #define portENABLE_INTERRUPTS() ulPortSetIPL( 0 ) @@ -113,8 +117,8 @@ extern void vPortExitCritical( void ); #define portENTER_CRITICAL() vPortEnterCritical() #define portEXIT_CRITICAL() vPortExitCritical() -extern unsigned portBASE_TYPE uxPortSetInterruptMaskFromISR( void ); -extern void vPortClearInterruptMaskFromISR( unsigned portBASE_TYPE ); +extern UBaseType_t uxPortSetInterruptMaskFromISR( void ); +extern void vPortClearInterruptMaskFromISR( UBaseType_t ); #define portSET_INTERRUPT_MASK_FROM_ISR() ulPortSetIPL( configMAX_SYSCALL_INTERRUPT_PRIORITY ) #define portCLEAR_INTERRUPT_MASK_FROM_ISR( uxSavedStatusRegister ) ulPortSetIPL( uxSavedStatusRegister ) diff --git a/FreeRTOS/Source/portable/CodeWarrior/HCS12/port.c b/FreeRTOS/Source/portable/CodeWarrior/HCS12/port.c index e21b522e2..0b00b3f57 100644 --- a/FreeRTOS/Source/portable/CodeWarrior/HCS12/port.c +++ b/FreeRTOS/Source/portable/CodeWarrior/HCS12/port.c @@ -93,7 +93,7 @@ scheduler startup function. */ start the scheduler directly because the header file containing the xPortStartScheduler() prototype is part of the common kernel code, and therefore cannot use the CODE_SEG pragma. */ - static portBASE_TYPE xBankedStartScheduler( void ); + static BaseType_t xBankedStartScheduler( void ); #pragma CODE_SEG DEFAULT @@ -103,24 +103,24 @@ until the nesting depth reaches 0. This variable simply tracks the nesting depth. Each task maintains it's own critical nesting depth variable so uxCriticalNesting is saved and restored from the task stack during a context switch. */ -volatile unsigned portBASE_TYPE uxCriticalNesting = 0xff; +volatile UBaseType_t uxCriticalNesting = 0xff; /*-----------------------------------------------------------*/ /* * See header file for description. */ -portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) +StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) { /* Place a few bytes of known values on the bottom of the stack. This can be uncommented to provide useful stack markers when debugging. - *pxTopOfStack = ( portSTACK_TYPE ) 0x11; + *pxTopOfStack = ( StackType_t ) 0x11; pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x22; + *pxTopOfStack = ( StackType_t ) 0x22; pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x33; + *pxTopOfStack = ( StackType_t ) 0x33; pxTopOfStack--; */ @@ -132,47 +132,47 @@ portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE /* The address of the task function is placed in the stack byte at a time. */ - *pxTopOfStack = ( portSTACK_TYPE ) *( ((portSTACK_TYPE *) (&pxCode) ) + 1 ); + *pxTopOfStack = ( StackType_t ) *( ((StackType_t *) (&pxCode) ) + 1 ); pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) *( ((portSTACK_TYPE *) (&pxCode) ) + 0 ); + *pxTopOfStack = ( StackType_t ) *( ((StackType_t *) (&pxCode) ) + 0 ); pxTopOfStack--; /* Next are all the registers that form part of the task context. */ /* Y register */ - *pxTopOfStack = ( portSTACK_TYPE ) 0xff; + *pxTopOfStack = ( StackType_t ) 0xff; pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0xee; + *pxTopOfStack = ( StackType_t ) 0xee; pxTopOfStack--; /* X register */ - *pxTopOfStack = ( portSTACK_TYPE ) 0xdd; + *pxTopOfStack = ( StackType_t ) 0xdd; pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0xcc; + *pxTopOfStack = ( StackType_t ) 0xcc; pxTopOfStack--; /* A register contains parameter high byte. */ - *pxTopOfStack = ( portSTACK_TYPE ) *( ((portSTACK_TYPE *) (&pvParameters) ) + 0 ); + *pxTopOfStack = ( StackType_t ) *( ((StackType_t *) (&pvParameters) ) + 0 ); pxTopOfStack--; /* B register contains parameter low byte. */ - *pxTopOfStack = ( portSTACK_TYPE ) *( ((portSTACK_TYPE *) (&pvParameters) ) + 1 ); + *pxTopOfStack = ( StackType_t ) *( ((StackType_t *) (&pvParameters) ) + 1 ); pxTopOfStack--; /* CCR: Note that when the task starts interrupts will be enabled since "I" bit of CCR is cleared */ - *pxTopOfStack = ( portSTACK_TYPE ) 0x00; + *pxTopOfStack = ( StackType_t ) 0x00; pxTopOfStack--; #ifdef BANKED_MODEL /* The page of the task. */ - *pxTopOfStack = ( portSTACK_TYPE ) ( ( int ) pxCode ); + *pxTopOfStack = ( StackType_t ) ( ( int ) pxCode ); pxTopOfStack--; #endif /* Finally the critical nesting depth is initialised with 0 (not within a critical section). */ - *pxTopOfStack = ( portSTACK_TYPE ) 0x00; + *pxTopOfStack = ( StackType_t ) 0x00; return pxTopOfStack; } @@ -191,7 +191,7 @@ static void prvSetupTimerInterrupt( void ) } /*-----------------------------------------------------------*/ -portBASE_TYPE xPortStartScheduler( void ) +BaseType_t xPortStartScheduler( void ) { /* xPortStartScheduler() does not start the scheduler directly because the header file containing the xPortStartScheduler() prototype is part @@ -205,7 +205,7 @@ portBASE_TYPE xPortStartScheduler( void ) #pragma CODE_SEG __NEAR_SEG NON_BANKED -static portBASE_TYPE xBankedStartScheduler( void ) +static BaseType_t xBankedStartScheduler( void ) { /* Configure the timer that will generate the RTOS tick. Interrupts are disabled when this function is called. */ diff --git a/FreeRTOS/Source/portable/CodeWarrior/HCS12/portmacro.h b/FreeRTOS/Source/portable/CodeWarrior/HCS12/portmacro.h index c159b5e00..e09ead6f4 100644 --- a/FreeRTOS/Source/portable/CodeWarrior/HCS12/portmacro.h +++ b/FreeRTOS/Source/portable/CodeWarrior/HCS12/portmacro.h @@ -1,5 +1,5 @@ /* - FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. + FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. All rights reserved VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. @@ -68,7 +68,7 @@ #define PORTMACRO_H /*----------------------------------------------------------- - * Port specific definitions. + * Port specific definitions. * * The settings in this file configure FreeRTOS correctly for the * given hardware and compiler. @@ -83,28 +83,32 @@ #define portDOUBLE double #define portLONG long #define portSHORT short -#define portSTACK_TYPE unsigned portCHAR +#define portSTACK_TYPE uint8_t #define portBASE_TYPE char +typedef portSTACK_TYPE StackType_t; +typedef signed char BaseType_t; +typedef unsigned char UBaseType_t; + #if( configUSE_16_BIT_TICKS == 1 ) - typedef unsigned portSHORT portTickType; - #define portMAX_DELAY ( portTickType ) 0xffff + typedef uint16_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffff #else - typedef unsigned portLONG portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffffUL + typedef uint32_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffffffffUL #endif /*-----------------------------------------------------------*/ /* Hardware specifics. */ #define portBYTE_ALIGNMENT 1 #define portSTACK_GROWTH ( -1 ) -#define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ ) +#define portTICK_RATE_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ ) #define portYIELD() __asm( "swi" ); #define portNOP() __asm( "nop" ); /*-----------------------------------------------------------*/ /* Critical section handling. */ -#define portENABLE_INTERRUPTS() __asm( "cli" ) +#define portENABLE_INTERRUPTS() __asm( "cli" ) #define portDISABLE_INTERRUPTS() __asm( "sei" ) /* @@ -115,7 +119,7 @@ */ #define portENTER_CRITICAL() \ { \ - extern volatile unsigned portBASE_TYPE uxCriticalNesting; \ + extern volatile UBaseType_t uxCriticalNesting; \ \ portDISABLE_INTERRUPTS(); \ uxCriticalNesting++; \ @@ -123,12 +127,12 @@ /* * Interrupts are disabled so we can access the nesting count directly. If the - * nesting is found to be 0 (no nesting) then we are leaving the critical + * nesting is found to be 0 (no nesting) then we are leaving the critical * section and interrupts can be re-enabled. */ #define portEXIT_CRITICAL() \ { \ - extern volatile unsigned portBASE_TYPE uxCriticalNesting; \ + extern volatile UBaseType_t uxCriticalNesting; \ \ uxCriticalNesting--; \ if( uxCriticalNesting == 0 ) \ @@ -140,10 +144,10 @@ /* Task utilities. */ -/* - * These macros are very simple as the processor automatically saves and +/* + * These macros are very simple as the processor automatically saves and * restores its registers as interrupts are entered and exited. In - * addition to the (automatically stacked) registers we also stack the + * addition to the (automatically stacked) registers we also stack the * critical nesting count. Each task maintains its own critical nesting * count as it is legitimate for a task to yield from within a critical * section. If the banked memory model is being used then the PPAGE @@ -151,15 +155,15 @@ */ #ifdef BANKED_MODEL - /* + /* * Load the stack pointer for the task, then pull the critical nesting - * count and PPAGE register from the stack. The remains of the + * count and PPAGE register from the stack. The remains of the * context are restored by the RTI instruction. */ #define portRESTORE_CONTEXT() \ { \ extern volatile void * pxCurrentTCB; \ - extern volatile unsigned portBASE_TYPE uxCriticalNesting; \ + extern volatile UBaseType_t uxCriticalNesting; \ \ __asm( "ldx pxCurrentTCB" ); \ __asm( "lds 0, x" ); \ @@ -169,15 +173,15 @@ __asm( "staa 0x30" ); /* 0x30 = PPAGE */ \ } - /* + /* * By the time this macro is called the processor has already stacked the - * registers. Simply stack the nesting count and PPAGE value, then save + * registers. Simply stack the nesting count and PPAGE value, then save * the task stack pointer. */ #define portSAVE_CONTEXT() \ { \ extern volatile void * pxCurrentTCB; \ - extern volatile unsigned portBASE_TYPE uxCriticalNesting; \ + extern volatile UBaseType_t uxCriticalNesting; \ \ __asm( "ldaa 0x30" ); /* 0x30 = PPAGE */ \ __asm( "psha" ); \ @@ -188,7 +192,7 @@ } #else - /* + /* * These macros are as per the BANKED versions above, but without saving * and restoring the PPAGE register. */ @@ -196,7 +200,7 @@ #define portRESTORE_CONTEXT() \ { \ extern volatile void * pxCurrentTCB; \ - extern volatile unsigned portBASE_TYPE uxCriticalNesting; \ + extern volatile UBaseType_t uxCriticalNesting; \ \ __asm( "ldx pxCurrentTCB" ); \ __asm( "lds 0, x" ); \ @@ -207,7 +211,7 @@ #define portSAVE_CONTEXT() \ { \ extern volatile void * pxCurrentTCB; \ - extern volatile unsigned portBASE_TYPE uxCriticalNesting; \ + extern volatile UBaseType_t uxCriticalNesting; \ \ __asm( "ldaa uxCriticalNesting" ); \ __asm( "psha" ); \ diff --git a/FreeRTOS/Source/portable/GCC/ARM7_AT91FR40008/port.c b/FreeRTOS/Source/portable/GCC/ARM7_AT91FR40008/port.c index 2acaed96a..508e66bd2 100644 --- a/FreeRTOS/Source/portable/GCC/ARM7_AT91FR40008/port.c +++ b/FreeRTOS/Source/portable/GCC/ARM7_AT91FR40008/port.c @@ -87,10 +87,10 @@ #include "tc.h" /* Constants required to setup the task context. */ -#define portINITIAL_SPSR ( ( portSTACK_TYPE ) 0x1f ) /* System mode, ARM mode, interrupts enabled. */ -#define portTHUMB_MODE_BIT ( ( portSTACK_TYPE ) 0x20 ) -#define portINSTRUCTION_SIZE ( ( portSTACK_TYPE ) 4 ) -#define portNO_CRITICAL_SECTION_NESTING ( ( portSTACK_TYPE ) 0 ) +#define portINITIAL_SPSR ( ( StackType_t ) 0x1f ) /* System mode, ARM mode, interrupts enabled. */ +#define portTHUMB_MODE_BIT ( ( StackType_t ) 0x20 ) +#define portINSTRUCTION_SIZE ( ( StackType_t ) 4 ) +#define portNO_CRITICAL_SECTION_NESTING ( ( StackType_t ) 0 ) #define portTICK_PRIORITY_6 ( 6 ) /*-----------------------------------------------------------*/ @@ -111,9 +111,9 @@ extern void vPortISRStartFirstTask( void ); * * See header file for description. */ -portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) +StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) { -portSTACK_TYPE *pxOriginalTOS; +StackType_t *pxOriginalTOS; pxOriginalTOS = pxTopOfStack; @@ -127,46 +127,46 @@ portSTACK_TYPE *pxOriginalTOS; /* First on the stack is the return address - which in this case is the start of the task. The offset is added to make the return address appear as it would within an IRQ ISR. */ - *pxTopOfStack = ( portSTACK_TYPE ) pxCode + portINSTRUCTION_SIZE; + *pxTopOfStack = ( StackType_t ) pxCode + portINSTRUCTION_SIZE; pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0xaaaaaaaa; /* R14 */ + *pxTopOfStack = ( StackType_t ) 0xaaaaaaaa; /* R14 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) pxOriginalTOS; /* Stack used when task starts goes in R13. */ + *pxTopOfStack = ( StackType_t ) pxOriginalTOS; /* Stack used when task starts goes in R13. */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x12121212; /* R12 */ + *pxTopOfStack = ( StackType_t ) 0x12121212; /* R12 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x11111111; /* R11 */ + *pxTopOfStack = ( StackType_t ) 0x11111111; /* R11 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x10101010; /* R10 */ + *pxTopOfStack = ( StackType_t ) 0x10101010; /* R10 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x09090909; /* R9 */ + *pxTopOfStack = ( StackType_t ) 0x09090909; /* R9 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x08080808; /* R8 */ + *pxTopOfStack = ( StackType_t ) 0x08080808; /* R8 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x07070707; /* R7 */ + *pxTopOfStack = ( StackType_t ) 0x07070707; /* R7 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x06060606; /* R6 */ + *pxTopOfStack = ( StackType_t ) 0x06060606; /* R6 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x05050505; /* R5 */ + *pxTopOfStack = ( StackType_t ) 0x05050505; /* R5 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x04040404; /* R4 */ + *pxTopOfStack = ( StackType_t ) 0x04040404; /* R4 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x03030303; /* R3 */ + *pxTopOfStack = ( StackType_t ) 0x03030303; /* R3 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x02020202; /* R2 */ + *pxTopOfStack = ( StackType_t ) 0x02020202; /* R2 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x01010101; /* R1 */ + *pxTopOfStack = ( StackType_t ) 0x01010101; /* R1 */ pxTopOfStack--; /* When the task starts is will expect to find the function parameter in R0. */ - *pxTopOfStack = ( portSTACK_TYPE ) pvParameters; /* R0 */ + *pxTopOfStack = ( StackType_t ) pvParameters; /* R0 */ pxTopOfStack--; /* The last thing onto the stack is the status register, which is set for system mode, with interrupts enabled. */ - *pxTopOfStack = ( portSTACK_TYPE ) portINITIAL_SPSR; + *pxTopOfStack = ( StackType_t ) portINITIAL_SPSR; #ifdef THUMB_INTERWORK { @@ -187,7 +187,7 @@ portSTACK_TYPE *pxOriginalTOS; } /*-----------------------------------------------------------*/ -portBASE_TYPE xPortStartScheduler( void ) +BaseType_t xPortStartScheduler( void ) { /* Start the timer that generates the tick ISR. Interrupts are disabled here already. */ @@ -213,7 +213,7 @@ void vPortEndScheduler( void ) */ static void prvSetupTimerInterrupt( void ) { -volatile unsigned long ulDummy; +volatile uint32_t ulDummy; /* Enable clock to the tick timer... */ AT91C_BASE_PS->PS_PCER = portTIMER_CLK_ENABLE_BIT; @@ -233,12 +233,12 @@ volatile unsigned long ulDummy; #if configUSE_PREEMPTION == 1 { extern void ( vPreemptiveTick )( void ); - AT91C_BASE_AIC->AIC_SVR[portTIMER_AIC_CHANNEL] = ( unsigned long ) vPreemptiveTick; + AT91C_BASE_AIC->AIC_SVR[portTIMER_AIC_CHANNEL] = ( uint32_t ) vPreemptiveTick; } #else // else use cooperative scheduler { extern void ( vNonPreemptiveTick )( void ); - AT91C_BASE_AIC->AIC_SVR[portTIMER_AIC_CHANNEL] = ( unsigned long ) vNonPreemptiveTick; + AT91C_BASE_AIC->AIC_SVR[portTIMER_AIC_CHANNEL] = ( uint32_t ) vNonPreemptiveTick; } #endif diff --git a/FreeRTOS/Source/portable/GCC/ARM7_AT91FR40008/portISR.c b/FreeRTOS/Source/portable/GCC/ARM7_AT91FR40008/portISR.c index 3dc4ff629..0cea89f01 100644 --- a/FreeRTOS/Source/portable/GCC/ARM7_AT91FR40008/portISR.c +++ b/FreeRTOS/Source/portable/GCC/ARM7_AT91FR40008/portISR.c @@ -83,11 +83,11 @@ #include "task.h" /* Constants required to handle interrupts. */ -#define portCLEAR_AIC_INTERRUPT ( ( unsigned long ) 0 ) +#define portCLEAR_AIC_INTERRUPT ( ( uint32_t ) 0 ) /* Constants required to handle critical sections. */ -#define portNO_CRITICAL_NESTING ( ( unsigned long ) 0 ) -volatile unsigned long ulCriticalNesting = 9999UL; +#define portNO_CRITICAL_NESTING ( ( uint32_t ) 0 ) +volatile uint32_t ulCriticalNesting = 9999UL; /*-----------------------------------------------------------*/ @@ -147,7 +147,7 @@ void vPortYieldProcessor( void ) void vNonPreemptiveTick( void ) __attribute__ ((interrupt ("IRQ"))); void vNonPreemptiveTick( void ) { - static volatile unsigned long ulDummy; + static volatile uint32_t ulDummy; /* Clear tick timer interrupt indication. */ ulDummy = portTIMER_REG_BASE_PTR->TC_SR; @@ -170,7 +170,7 @@ void vPortYieldProcessor( void ) /* WARNING - Do not use local (stack) variables here. Use globals if you must! */ - static volatile unsigned long ulDummy; + static volatile uint32_t ulDummy; /* Clear tick timer interrupt indication. */ ulDummy = portTIMER_REG_BASE_PTR->TC_SR; diff --git a/FreeRTOS/Source/portable/GCC/ARM7_AT91FR40008/portmacro.h b/FreeRTOS/Source/portable/GCC/ARM7_AT91FR40008/portmacro.h index 6fd0f401b..d7ed74bb7 100644 --- a/FreeRTOS/Source/portable/GCC/ARM7_AT91FR40008/portmacro.h +++ b/FreeRTOS/Source/portable/GCC/ARM7_AT91FR40008/portmacro.h @@ -1,5 +1,5 @@ /* - FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. + FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. All rights reserved VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. @@ -65,12 +65,12 @@ /* Changes from V3.2.3 - + + Modified portENTER_SWITCHING_ISR() to allow use with GCC V4.0.1. Changes from V3.2.4 - + Removed the use of the %0 parameter within the assembler macros and + + Removed the use of the %0 parameter within the assembler macros and replaced them with hard coded registers. This will ensure the assembler does not select the link register as the temp register as was occasionally happening previously. @@ -81,7 +81,7 @@ Changes from V4.5.0 + Removed the portENTER_SWITCHING_ISR() and portEXIT_SWITCHING_ISR() macros - and replaced them with portYIELD_FROM_ISR() macro. Application code + and replaced them with portYIELD_FROM_ISR() macro. Application code should now make use of the portSAVE_CONTEXT() and portRESTORE_CONTEXT() macros as per the V4.5.1 demo code. */ @@ -94,7 +94,7 @@ extern "C" { #endif /*----------------------------------------------------------- - * Port specific definitions. + * Port specific definitions. * * The settings in this file configure FreeRTOS correctly for the * given hardware and compiler. @@ -109,21 +109,25 @@ extern "C" { #define portDOUBLE double #define portLONG long #define portSHORT short -#define portSTACK_TYPE unsigned portLONG +#define portSTACK_TYPE uint32_t #define portBASE_TYPE long +typedef portSTACK_TYPE StackType_t; +typedef long BaseType_t; +typedef unsigned long UBaseType_t; + #if( configUSE_16_BIT_TICKS == 1 ) - typedef unsigned portSHORT portTickType; - #define portMAX_DELAY ( portTickType ) 0xffff + typedef uint16_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffff #else - typedef unsigned portLONG portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffffUL + typedef uint32_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffffffffUL #endif -/*-----------------------------------------------------------*/ +/*-----------------------------------------------------------*/ /* Hardware specifics. */ #define portSTACK_GROWTH ( -1 ) -#define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ ) +#define portTICK_RATE_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ ) #define portBYTE_ALIGNMENT 8 #define portYIELD() asm volatile ( "SWI 0" ) #define portNOP() asm volatile ( "NOP" ) @@ -135,8 +139,8 @@ extern "C" { */ #define portTIMER_REG_BASE_PTR AT91C_BASE_TC0 #define portTIMER_CLK_ENABLE_BIT AT91C_PS_TC0 -#define portTIMER_AIC_CHANNEL ( ( unsigned portLONG ) 4 ) -/*-----------------------------------------------------------*/ +#define portTIMER_AIC_CHANNEL ( ( uint32_t ) 4 ) +/*-----------------------------------------------------------*/ /* Task utilities. */ @@ -150,7 +154,7 @@ extern "C" { #define portRESTORE_CONTEXT() \ { \ extern volatile void * volatile pxCurrentTCB; \ -extern volatile unsigned portLONG ulCriticalNesting; \ +extern volatile uint32_t ulCriticalNesting; \ \ /* Set the LR to the task stack. */ \ asm volatile ( \ @@ -187,7 +191,7 @@ extern volatile unsigned portLONG ulCriticalNesting; \ #define portSAVE_CONTEXT() \ { \ extern volatile void * volatile pxCurrentTCB; \ -extern volatile unsigned portLONG ulCriticalNesting; \ +extern volatile uint32_t ulCriticalNesting; \ \ /* Push R0 as we are going to use the register. */ \ asm volatile ( \ @@ -236,8 +240,8 @@ extern volatile unsigned portLONG ulCriticalNesting; \ /* * The interrupt management utilities can only be called from ARM mode. When - * THUMB_INTERWORK is defined the utilities are defined as functions in - * portISR.c to ensure a switch to ARM mode. When THUMB_INTERWORK is not + * THUMB_INTERWORK is defined the utilities are defined as functions in + * portISR.c to ensure a switch to ARM mode. When THUMB_INTERWORK is not * defined then the utilities are defined as macros here - as per other ports. */ @@ -248,7 +252,7 @@ extern volatile unsigned portLONG ulCriticalNesting; \ #define portDISABLE_INTERRUPTS() vPortDisableInterruptsFromThumb() #define portENABLE_INTERRUPTS() vPortEnableInterruptsFromThumb() - + #else #define portDISABLE_INTERRUPTS() \ @@ -258,7 +262,7 @@ extern volatile unsigned portLONG ulCriticalNesting; \ "ORR R0, R0, #0xC0 \n\t" /* Disable IRQ, FIQ. */ \ "MSR CPSR, R0 \n\t" /* Write back modified value. */ \ "LDMIA SP!, {R0} " ) /* Pop R0. */ - + #define portENABLE_INTERRUPTS() \ asm volatile ( \ "STMDB SP!, {R0} \n\t" /* Push R0. */ \ @@ -275,7 +279,7 @@ extern void vPortExitCritical( void ); #define portENTER_CRITICAL() vPortEnterCritical(); #define portEXIT_CRITICAL() vPortExitCritical(); -/*-----------------------------------------------------------*/ +/*-----------------------------------------------------------*/ /* Task function macros as described on the FreeRTOS.org WEB site. */ #define portTASK_FUNCTION_PROTO( vFunction, pvParameters ) void vFunction( void *pvParameters ) diff --git a/FreeRTOS/Source/portable/GCC/ARM7_AT91SAM7S/lib_AT91SAM7X256.h b/FreeRTOS/Source/portable/GCC/ARM7_AT91SAM7S/lib_AT91SAM7X256.h index e66b4e1e1..ffa550476 100644 --- a/FreeRTOS/Source/portable/GCC/ARM7_AT91SAM7S/lib_AT91SAM7X256.h +++ b/FreeRTOS/Source/portable/GCC/ARM7_AT91SAM7S/lib_AT91SAM7X256.h @@ -2262,7 +2262,7 @@ __inline unsigned int AT91F_US_ReceiveFrame ( //*---------------------------------------------------------------------------- __inline void AT91F_US_SetIrdaFilter ( AT91PS_USART pUSART, - unsigned char value + uint8_t value ) { pUSART->US_IF = value; @@ -2704,7 +2704,7 @@ __inline void AT91F_UDP_DisableIt ( //*---------------------------------------------------------------------------- __inline void AT91F_UDP_SetAddress ( AT91PS_UDP pUDP, // \arg pointer to a UDP controller - unsigned char address) // \arg new UDP address + uint8_t address) // \arg new UDP address { pUDP->UDP_FADDR = (AT91C_UDP_FEN | address); } @@ -2715,7 +2715,7 @@ __inline void AT91F_UDP_SetAddress ( //*---------------------------------------------------------------------------- __inline void AT91F_UDP_EnableEp ( AT91PS_UDP pUDP, // \arg pointer to a UDP controller - unsigned char endpoint) // \arg endpoint number + uint8_t endpoint) // \arg endpoint number { pUDP->UDP_CSR[endpoint] |= AT91C_UDP_EPEDS; } @@ -2726,7 +2726,7 @@ __inline void AT91F_UDP_EnableEp ( //*---------------------------------------------------------------------------- __inline void AT91F_UDP_DisableEp ( AT91PS_UDP pUDP, // \arg pointer to a UDP controller - unsigned char endpoint) // \arg endpoint number + uint8_t endpoint) // \arg endpoint number { pUDP->UDP_CSR[endpoint] &= ~AT91C_UDP_EPEDS; } @@ -2771,7 +2771,7 @@ __inline void AT91F_UDP_ResetEp ( // \return the UDP device state //*---------------------------------------------------------------------------- __inline void AT91F_UDP_EpStall( AT91PS_UDP pUDP, // \arg pointer to a UDP controller - unsigned char endpoint) // \arg endpoint number + uint8_t endpoint) // \arg endpoint number { pUDP->UDP_CSR[endpoint] |= AT91C_UDP_FORCESTALL; } @@ -2782,8 +2782,8 @@ __inline void AT91F_UDP_EpStall( //*---------------------------------------------------------------------------- __inline void AT91F_UDP_EpWrite( AT91PS_UDP pUDP, // \arg pointer to a UDP controller - unsigned char endpoint, // \arg endpoint number - unsigned char value) // \arg value to be written in the DPR + uint8_t endpoint, // \arg endpoint number + uint8_t value) // \arg value to be written in the DPR { pUDP->UDP_FDR[endpoint] = value; } @@ -2794,7 +2794,7 @@ __inline void AT91F_UDP_EpWrite( //*---------------------------------------------------------------------------- __inline unsigned int AT91F_UDP_EpRead( AT91PS_UDP pUDP, // \arg pointer to a UDP controller - unsigned char endpoint) // \arg endpoint number + uint8_t endpoint) // \arg endpoint number { return pUDP->UDP_FDR[endpoint]; } @@ -2805,7 +2805,7 @@ __inline unsigned int AT91F_UDP_EpRead( //*---------------------------------------------------------------------------- __inline void AT91F_UDP_EpEndOfWr( AT91PS_UDP pUDP, // \arg pointer to a UDP controller - unsigned char endpoint) // \arg endpoint number + uint8_t endpoint) // \arg endpoint number { pUDP->UDP_CSR[endpoint] |= AT91C_UDP_TXPKTRDY; } @@ -2816,7 +2816,7 @@ __inline void AT91F_UDP_EpEndOfWr( //*---------------------------------------------------------------------------- __inline void AT91F_UDP_EpClear( AT91PS_UDP pUDP, // \arg pointer to a UDP controller - unsigned char endpoint, // \arg endpoint number + uint8_t endpoint, // \arg endpoint number unsigned int flag) // \arg flag to be cleared { pUDP->UDP_CSR[endpoint] &= ~(flag); @@ -2828,7 +2828,7 @@ __inline void AT91F_UDP_EpClear( //*---------------------------------------------------------------------------- __inline void AT91F_UDP_EpSet( AT91PS_UDP pUDP, // \arg pointer to a UDP controller - unsigned char endpoint, // \arg endpoint number + uint8_t endpoint, // \arg endpoint number unsigned int flag) // \arg flag to be cleared { pUDP->UDP_CSR[endpoint] |= flag; @@ -2840,7 +2840,7 @@ __inline void AT91F_UDP_EpSet( //*---------------------------------------------------------------------------- __inline unsigned int AT91F_UDP_EpStatus( AT91PS_UDP pUDP, // \arg pointer to a UDP controller - unsigned char endpoint) // \arg endpoint number + uint8_t endpoint) // \arg endpoint number { return pUDP->UDP_CSR[endpoint]; } @@ -3158,7 +3158,7 @@ __inline unsigned int AT91F_CAN_GetMessageModeReg ( __inline void AT91F_CAN_CfgMessageIDReg ( AT91PS_CAN_MB CAN_Mailbox, // pointer to a CAN Mailbox unsigned int id, - unsigned char version) + uint8_t version) { if(version==0) // IDvA Standard Format CAN_Mailbox->CAN_MB_MID = id<<18; @@ -3680,7 +3680,7 @@ __inline void AT91F_AES_LoadNewSeed ( //*---------------------------------------------------------------------------- __inline void AT91F_AES_SetCryptoKey ( AT91PS_AES pAES, // pointer to a AES controller - unsigned char index, + uint8_t index, unsigned int keyword ) { @@ -3693,7 +3693,7 @@ __inline void AT91F_AES_SetCryptoKey ( //*---------------------------------------------------------------------------- __inline void AT91F_AES_InputData ( AT91PS_AES pAES, // pointer to a AES controller - unsigned char index, + uint8_t index, unsigned int indata ) { @@ -3706,7 +3706,7 @@ __inline void AT91F_AES_InputData ( //*---------------------------------------------------------------------------- __inline unsigned int AT91F_AES_GetOutputData ( AT91PS_AES pAES, // pointer to a AES controller - unsigned char index + uint8_t index ) { return pAES->AES_ODATAxR[index]; @@ -3718,7 +3718,7 @@ __inline unsigned int AT91F_AES_GetOutputData ( //*---------------------------------------------------------------------------- __inline void AT91F_AES_SetInitializationVector ( AT91PS_AES pAES, // pointer to a AES controller - unsigned char index, + uint8_t index, unsigned int initvector ) { @@ -3845,7 +3845,7 @@ __inline void AT91F_TDES_SoftReset ( //*---------------------------------------------------------------------------- __inline void AT91F_TDES_SetCryptoKey1 ( AT91PS_TDES pTDES, // pointer to a TDES controller - unsigned char index, + uint8_t index, unsigned int keyword ) { @@ -3858,7 +3858,7 @@ __inline void AT91F_TDES_SetCryptoKey1 ( //*---------------------------------------------------------------------------- __inline void AT91F_TDES_SetCryptoKey2 ( AT91PS_TDES pTDES, // pointer to a TDES controller - unsigned char index, + uint8_t index, unsigned int keyword ) { @@ -3871,7 +3871,7 @@ __inline void AT91F_TDES_SetCryptoKey2 ( //*---------------------------------------------------------------------------- __inline void AT91F_TDES_SetCryptoKey3 ( AT91PS_TDES pTDES, // pointer to a TDES controller - unsigned char index, + uint8_t index, unsigned int keyword ) { @@ -3884,7 +3884,7 @@ __inline void AT91F_TDES_SetCryptoKey3 ( //*---------------------------------------------------------------------------- __inline void AT91F_TDES_InputData ( AT91PS_TDES pTDES, // pointer to a TDES controller - unsigned char index, + uint8_t index, unsigned int indata ) { @@ -3897,7 +3897,7 @@ __inline void AT91F_TDES_InputData ( //*---------------------------------------------------------------------------- __inline unsigned int AT91F_TDES_GetOutputData ( AT91PS_TDES pTDES, // pointer to a TDES controller - unsigned char index + uint8_t index ) { return pTDES->TDES_ODATAxR[index]; @@ -3909,7 +3909,7 @@ __inline unsigned int AT91F_TDES_GetOutputData ( //*---------------------------------------------------------------------------- __inline void AT91F_TDES_SetInitializationVector ( AT91PS_TDES pTDES, // pointer to a TDES controller - unsigned char index, + uint8_t index, unsigned int initvector ) { diff --git a/FreeRTOS/Source/portable/GCC/ARM7_AT91SAM7S/port.c b/FreeRTOS/Source/portable/GCC/ARM7_AT91SAM7S/port.c index df87d289a..818444ea2 100644 --- a/FreeRTOS/Source/portable/GCC/ARM7_AT91SAM7S/port.c +++ b/FreeRTOS/Source/portable/GCC/ARM7_AT91SAM7S/port.c @@ -83,24 +83,24 @@ #include "AT91SAM7X256.h" /* Constants required to setup the task context. */ -#define portINITIAL_SPSR ( ( portSTACK_TYPE ) 0x1f ) /* System mode, ARM mode, interrupts enabled. */ -#define portTHUMB_MODE_BIT ( ( portSTACK_TYPE ) 0x20 ) -#define portINSTRUCTION_SIZE ( ( portSTACK_TYPE ) 4 ) -#define portNO_CRITICAL_SECTION_NESTING ( ( portSTACK_TYPE ) 0 ) +#define portINITIAL_SPSR ( ( StackType_t ) 0x1f ) /* System mode, ARM mode, interrupts enabled. */ +#define portTHUMB_MODE_BIT ( ( StackType_t ) 0x20 ) +#define portINSTRUCTION_SIZE ( ( StackType_t ) 4 ) +#define portNO_CRITICAL_SECTION_NESTING ( ( StackType_t ) 0 ) /* Constants required to setup the tick ISR. */ -#define portENABLE_TIMER ( ( unsigned char ) 0x01 ) +#define portENABLE_TIMER ( ( uint8_t ) 0x01 ) #define portPRESCALE_VALUE 0x00 -#define portINTERRUPT_ON_MATCH ( ( unsigned long ) 0x01 ) -#define portRESET_COUNT_ON_MATCH ( ( unsigned long ) 0x02 ) +#define portINTERRUPT_ON_MATCH ( ( uint32_t ) 0x01 ) +#define portRESET_COUNT_ON_MATCH ( ( uint32_t ) 0x02 ) /* Constants required to setup the PIT. */ -#define portPIT_CLOCK_DIVISOR ( ( unsigned long ) 16 ) +#define portPIT_CLOCK_DIVISOR ( ( uint32_t ) 16 ) #define portPIT_COUNTER_VALUE ( ( ( configCPU_CLOCK_HZ / portPIT_CLOCK_DIVISOR ) / 1000UL ) * portTICK_RATE_MS ) #define portINT_LEVEL_SENSITIVE 0 -#define portPIT_ENABLE ( ( unsigned short ) 0x1 << 24 ) -#define portPIT_INT_ENABLE ( ( unsigned short ) 0x1 << 25 ) +#define portPIT_ENABLE ( ( uint16_t ) 0x1 << 24 ) +#define portPIT_INT_ENABLE ( ( uint16_t ) 0x1 << 25 ) /*-----------------------------------------------------------*/ /* Setup the timer to generate the tick interrupts. */ @@ -120,9 +120,9 @@ extern void vPortISRStartFirstTask( void ); * * See header file for description. */ -portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) +StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) { -portSTACK_TYPE *pxOriginalTOS; +StackType_t *pxOriginalTOS; pxOriginalTOS = pxTopOfStack; @@ -136,46 +136,46 @@ portSTACK_TYPE *pxOriginalTOS; /* First on the stack is the return address - which in this case is the start of the task. The offset is added to make the return address appear as it would within an IRQ ISR. */ - *pxTopOfStack = ( portSTACK_TYPE ) pxCode + portINSTRUCTION_SIZE; + *pxTopOfStack = ( StackType_t ) pxCode + portINSTRUCTION_SIZE; pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x00000000; /* R14 */ + *pxTopOfStack = ( StackType_t ) 0x00000000; /* R14 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) pxOriginalTOS; /* Stack used when task starts goes in R13. */ + *pxTopOfStack = ( StackType_t ) pxOriginalTOS; /* Stack used when task starts goes in R13. */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x12121212; /* R12 */ + *pxTopOfStack = ( StackType_t ) 0x12121212; /* R12 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x11111111; /* R11 */ + *pxTopOfStack = ( StackType_t ) 0x11111111; /* R11 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x10101010; /* R10 */ + *pxTopOfStack = ( StackType_t ) 0x10101010; /* R10 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x09090909; /* R9 */ + *pxTopOfStack = ( StackType_t ) 0x09090909; /* R9 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x08080808; /* R8 */ + *pxTopOfStack = ( StackType_t ) 0x08080808; /* R8 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x07070707; /* R7 */ + *pxTopOfStack = ( StackType_t ) 0x07070707; /* R7 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x06060606; /* R6 */ + *pxTopOfStack = ( StackType_t ) 0x06060606; /* R6 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x05050505; /* R5 */ + *pxTopOfStack = ( StackType_t ) 0x05050505; /* R5 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x04040404; /* R4 */ + *pxTopOfStack = ( StackType_t ) 0x04040404; /* R4 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x03030303; /* R3 */ + *pxTopOfStack = ( StackType_t ) 0x03030303; /* R3 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x02020202; /* R2 */ + *pxTopOfStack = ( StackType_t ) 0x02020202; /* R2 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x01010101; /* R1 */ + *pxTopOfStack = ( StackType_t ) 0x01010101; /* R1 */ pxTopOfStack--; /* When the task starts is will expect to find the function parameter in R0. */ - *pxTopOfStack = ( portSTACK_TYPE ) pvParameters; /* R0 */ + *pxTopOfStack = ( StackType_t ) pvParameters; /* R0 */ pxTopOfStack--; /* The last thing onto the stack is the status register, which is set for system mode, with interrupts enabled. */ - *pxTopOfStack = ( portSTACK_TYPE ) portINITIAL_SPSR; + *pxTopOfStack = ( StackType_t ) portINITIAL_SPSR; #ifdef THUMB_INTERWORK { @@ -196,7 +196,7 @@ portSTACK_TYPE *pxOriginalTOS; } /*-----------------------------------------------------------*/ -portBASE_TYPE xPortStartScheduler( void ) +BaseType_t xPortStartScheduler( void ) { /* Start the timer that generates the tick ISR. Interrupts are disabled here already. */ diff --git a/FreeRTOS/Source/portable/GCC/ARM7_AT91SAM7S/portISR.c b/FreeRTOS/Source/portable/GCC/ARM7_AT91SAM7S/portISR.c index 4ee89f8c1..c293b6483 100644 --- a/FreeRTOS/Source/portable/GCC/ARM7_AT91SAM7S/portISR.c +++ b/FreeRTOS/Source/portable/GCC/ARM7_AT91SAM7S/portISR.c @@ -84,12 +84,12 @@ #include "AT91SAM7X256.h" /* Constants required to handle interrupts. */ -#define portTIMER_MATCH_ISR_BIT ( ( unsigned char ) 0x01 ) -#define portCLEAR_VIC_INTERRUPT ( ( unsigned long ) 0 ) +#define portTIMER_MATCH_ISR_BIT ( ( uint8_t ) 0x01 ) +#define portCLEAR_VIC_INTERRUPT ( ( uint32_t ) 0 ) /* Constants required to handle critical sections. */ -#define portNO_CRITICAL_NESTING ( ( unsigned long ) 0 ) -volatile unsigned long ulCriticalNesting = 9999UL; +#define portNO_CRITICAL_NESTING ( ( uint32_t ) 0 ) +volatile uint32_t ulCriticalNesting = 9999UL; /*-----------------------------------------------------------*/ @@ -149,7 +149,7 @@ void vPortYieldProcessor( void ) void vNonPreemptiveTick( void ) __attribute__ ((interrupt ("IRQ"))); void vNonPreemptiveTick( void ) { - unsigned long ulDummy; + uint32_t ulDummy; /* Increment the tick count - which may wake some tasks but as the preemptive scheduler is not being used any woken task is not given diff --git a/FreeRTOS/Source/portable/GCC/ARM7_AT91SAM7S/portmacro.h b/FreeRTOS/Source/portable/GCC/ARM7_AT91SAM7S/portmacro.h index 4bc8b5c86..b93c1c103 100644 --- a/FreeRTOS/Source/portable/GCC/ARM7_AT91SAM7S/portmacro.h +++ b/FreeRTOS/Source/portable/GCC/ARM7_AT91SAM7S/portmacro.h @@ -1,5 +1,5 @@ /* - FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. + FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. All rights reserved VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. @@ -65,12 +65,12 @@ /* Changes from V3.2.3 - + + Modified portENTER_SWITCHING_ISR() to allow use with GCC V4.0.1. Changes from V3.2.4 - + Removed the use of the %0 parameter within the assembler macros and + + Removed the use of the %0 parameter within the assembler macros and replaced them with hard coded registers. This will ensure the assembler does not select the link register as the temp register as was occasionally happening previously. @@ -81,7 +81,7 @@ Changes from V4.5.0 + Removed the portENTER_SWITCHING_ISR() and portEXIT_SWITCHING_ISR() macros - and replaced them with portYIELD_FROM_ISR() macro. Application code + and replaced them with portYIELD_FROM_ISR() macro. Application code should now make use of the portSAVE_CONTEXT() and portRESTORE_CONTEXT() macros as per the V4.5.1 demo code. */ @@ -94,7 +94,7 @@ extern "C" { #endif /*----------------------------------------------------------- - * Port specific definitions. + * Port specific definitions. * * The settings in this file configure FreeRTOS correctly for the * given hardware and compiler. @@ -109,24 +109,28 @@ extern "C" { #define portDOUBLE double #define portLONG long #define portSHORT short -#define portSTACK_TYPE unsigned portLONG +#define portSTACK_TYPE uint32_t #define portBASE_TYPE portLONG +typedef portSTACK_TYPE StackType_t; +typedef long BaseType_t; +typedef unsigned long UBaseType_t; + #if( configUSE_16_BIT_TICKS == 1 ) - typedef unsigned portSHORT portTickType; - #define portMAX_DELAY ( portTickType ) 0xffff + typedef uint16_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffff #else - typedef unsigned portLONG portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffffUL + typedef uint32_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffffffffUL #endif -/*-----------------------------------------------------------*/ +/*-----------------------------------------------------------*/ /* Architecture specifics. */ #define portSTACK_GROWTH ( -1 ) -#define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ ) +#define portTICK_RATE_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ ) #define portBYTE_ALIGNMENT 8 #define portNOP() asm volatile ( "NOP" ); -/*-----------------------------------------------------------*/ +/*-----------------------------------------------------------*/ /* Scheduler utilities. */ @@ -141,7 +145,7 @@ extern "C" { #define portRESTORE_CONTEXT() \ { \ extern volatile void * volatile pxCurrentTCB; \ -extern volatile unsigned portLONG ulCriticalNesting; \ +extern volatile uint32_t ulCriticalNesting; \ \ /* Set the LR to the task stack. */ \ asm volatile ( \ @@ -178,7 +182,7 @@ extern volatile unsigned portLONG ulCriticalNesting; \ #define portSAVE_CONTEXT() \ { \ extern volatile void * volatile pxCurrentTCB; \ -extern volatile unsigned portLONG ulCriticalNesting; \ +extern volatile uint32_t ulCriticalNesting; \ \ /* Push R0 as we are going to use the register. */ \ asm volatile ( \ @@ -231,8 +235,8 @@ extern volatile unsigned portLONG ulCriticalNesting; \ /* * The interrupt management utilities can only be called from ARM mode. When - * THUMB_INTERWORK is defined the utilities are defined as functions in - * portISR.c to ensure a switch to ARM mode. When THUMB_INTERWORK is not + * THUMB_INTERWORK is defined the utilities are defined as functions in + * portISR.c to ensure a switch to ARM mode. When THUMB_INTERWORK is not * defined then the utilities are defined as macros here - as per other ports. */ @@ -243,7 +247,7 @@ extern volatile unsigned portLONG ulCriticalNesting; \ #define portDISABLE_INTERRUPTS() vPortDisableInterruptsFromThumb() #define portENABLE_INTERRUPTS() vPortEnableInterruptsFromThumb() - + #else #define portDISABLE_INTERRUPTS() \ @@ -253,7 +257,7 @@ extern volatile unsigned portLONG ulCriticalNesting; \ "ORR R0, R0, #0xC0 \n\t" /* Disable IRQ, FIQ. */ \ "MSR CPSR, R0 \n\t" /* Write back modified value. */ \ "LDMIA SP!, {R0} " ) /* Pop R0. */ - + #define portENABLE_INTERRUPTS() \ asm volatile ( \ "STMDB SP!, {R0} \n\t" /* Push R0. */ \ diff --git a/FreeRTOS/Source/portable/GCC/ARM7_LPC2000/port.c b/FreeRTOS/Source/portable/GCC/ARM7_LPC2000/port.c index 245c343f8..ec43a2cef 100644 --- a/FreeRTOS/Source/portable/GCC/ARM7_LPC2000/port.c +++ b/FreeRTOS/Source/portable/GCC/ARM7_LPC2000/port.c @@ -81,21 +81,21 @@ #include "task.h" /* Constants required to setup the task context. */ -#define portINITIAL_SPSR ( ( portSTACK_TYPE ) 0x1f ) /* System mode, ARM mode, interrupts enabled. */ -#define portTHUMB_MODE_BIT ( ( portSTACK_TYPE ) 0x20 ) -#define portINSTRUCTION_SIZE ( ( portSTACK_TYPE ) 4 ) -#define portNO_CRITICAL_SECTION_NESTING ( ( portSTACK_TYPE ) 0 ) +#define portINITIAL_SPSR ( ( StackType_t ) 0x1f ) /* System mode, ARM mode, interrupts enabled. */ +#define portTHUMB_MODE_BIT ( ( StackType_t ) 0x20 ) +#define portINSTRUCTION_SIZE ( ( StackType_t ) 4 ) +#define portNO_CRITICAL_SECTION_NESTING ( ( StackType_t ) 0 ) /* Constants required to setup the tick ISR. */ -#define portENABLE_TIMER ( ( unsigned char ) 0x01 ) +#define portENABLE_TIMER ( ( uint8_t ) 0x01 ) #define portPRESCALE_VALUE 0x00 -#define portINTERRUPT_ON_MATCH ( ( unsigned long ) 0x01 ) -#define portRESET_COUNT_ON_MATCH ( ( unsigned long ) 0x02 ) +#define portINTERRUPT_ON_MATCH ( ( uint32_t ) 0x01 ) +#define portRESET_COUNT_ON_MATCH ( ( uint32_t ) 0x02 ) /* Constants required to setup the VIC for the tick ISR. */ -#define portTIMER_VIC_CHANNEL ( ( unsigned long ) 0x0004 ) -#define portTIMER_VIC_CHANNEL_BIT ( ( unsigned long ) 0x0010 ) -#define portTIMER_VIC_ENABLE ( ( unsigned long ) 0x0020 ) +#define portTIMER_VIC_CHANNEL ( ( uint32_t ) 0x0004 ) +#define portTIMER_VIC_CHANNEL_BIT ( ( uint32_t ) 0x0010 ) +#define portTIMER_VIC_ENABLE ( ( uint32_t ) 0x0020 ) /*-----------------------------------------------------------*/ @@ -116,9 +116,9 @@ extern void vPortISRStartFirstTask( void ); * * See header file for description. */ -portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) +StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) { -portSTACK_TYPE *pxOriginalTOS; +StackType_t *pxOriginalTOS; pxOriginalTOS = pxTopOfStack; @@ -132,48 +132,48 @@ portSTACK_TYPE *pxOriginalTOS; /* First on the stack is the return address - which in this case is the start of the task. The offset is added to make the return address appear as it would within an IRQ ISR. */ - *pxTopOfStack = ( portSTACK_TYPE ) pxCode + portINSTRUCTION_SIZE; + *pxTopOfStack = ( StackType_t ) pxCode + portINSTRUCTION_SIZE; pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0xaaaaaaaa; /* R14 */ + *pxTopOfStack = ( StackType_t ) 0xaaaaaaaa; /* R14 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) pxOriginalTOS; /* Stack used when task starts goes in R13. */ + *pxTopOfStack = ( StackType_t ) pxOriginalTOS; /* Stack used when task starts goes in R13. */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x12121212; /* R12 */ + *pxTopOfStack = ( StackType_t ) 0x12121212; /* R12 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x11111111; /* R11 */ + *pxTopOfStack = ( StackType_t ) 0x11111111; /* R11 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x10101010; /* R10 */ + *pxTopOfStack = ( StackType_t ) 0x10101010; /* R10 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x09090909; /* R9 */ + *pxTopOfStack = ( StackType_t ) 0x09090909; /* R9 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x08080808; /* R8 */ + *pxTopOfStack = ( StackType_t ) 0x08080808; /* R8 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x07070707; /* R7 */ + *pxTopOfStack = ( StackType_t ) 0x07070707; /* R7 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x06060606; /* R6 */ + *pxTopOfStack = ( StackType_t ) 0x06060606; /* R6 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x05050505; /* R5 */ + *pxTopOfStack = ( StackType_t ) 0x05050505; /* R5 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x04040404; /* R4 */ + *pxTopOfStack = ( StackType_t ) 0x04040404; /* R4 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x03030303; /* R3 */ + *pxTopOfStack = ( StackType_t ) 0x03030303; /* R3 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x02020202; /* R2 */ + *pxTopOfStack = ( StackType_t ) 0x02020202; /* R2 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x01010101; /* R1 */ + *pxTopOfStack = ( StackType_t ) 0x01010101; /* R1 */ pxTopOfStack--; /* When the task starts is will expect to find the function parameter in R0. */ - *pxTopOfStack = ( portSTACK_TYPE ) pvParameters; /* R0 */ + *pxTopOfStack = ( StackType_t ) pvParameters; /* R0 */ pxTopOfStack--; /* The last thing onto the stack is the status register, which is set for system mode, with interrupts enabled. */ - *pxTopOfStack = ( portSTACK_TYPE ) portINITIAL_SPSR; + *pxTopOfStack = ( StackType_t ) portINITIAL_SPSR; - if( ( ( unsigned long ) pxCode & 0x01UL ) != 0x00 ) + if( ( ( uint32_t ) pxCode & 0x01UL ) != 0x00 ) { /* We want the task to start in thumb mode. */ *pxTopOfStack |= portTHUMB_MODE_BIT; @@ -191,7 +191,7 @@ portSTACK_TYPE *pxOriginalTOS; } /*-----------------------------------------------------------*/ -portBASE_TYPE xPortStartScheduler( void ) +BaseType_t xPortStartScheduler( void ) { /* Start the timer that generates the tick ISR. Interrupts are disabled here already. */ @@ -217,7 +217,7 @@ void vPortEndScheduler( void ) */ static void prvSetupTimerInterrupt( void ) { -unsigned long ulCompareMatch; +uint32_t ulCompareMatch; extern void ( vTickISR )( void ); /* A 1ms tick does not require the use of the timer prescale. This is @@ -246,7 +246,7 @@ extern void ( vTickISR )( void ); /* The ISR installed depends on whether the preemptive or cooperative scheduler is being used. */ - VICVectAddr0 = ( long ) vTickISR; + VICVectAddr0 = ( int32_t ) vTickISR; VICVectCntl0 = portTIMER_VIC_CHANNEL | portTIMER_VIC_ENABLE; /* Start the timer - interrupts are disabled when this function is called diff --git a/FreeRTOS/Source/portable/GCC/ARM7_LPC2000/portISR.c b/FreeRTOS/Source/portable/GCC/ARM7_LPC2000/portISR.c index 778cabc25..504297293 100644 --- a/FreeRTOS/Source/portable/GCC/ARM7_LPC2000/portISR.c +++ b/FreeRTOS/Source/portable/GCC/ARM7_LPC2000/portISR.c @@ -93,12 +93,12 @@ #include "FreeRTOS.h" /* Constants required to handle interrupts. */ -#define portTIMER_MATCH_ISR_BIT ( ( unsigned char ) 0x01 ) -#define portCLEAR_VIC_INTERRUPT ( ( unsigned long ) 0 ) +#define portTIMER_MATCH_ISR_BIT ( ( uint8_t ) 0x01 ) +#define portCLEAR_VIC_INTERRUPT ( ( uint32_t ) 0 ) /* Constants required to handle critical sections. */ -#define portNO_CRITICAL_NESTING ( ( unsigned long ) 0 ) -volatile unsigned long ulCriticalNesting = 9999UL; +#define portNO_CRITICAL_NESTING ( ( uint32_t ) 0 ) +volatile uint32_t ulCriticalNesting = 9999UL; /*-----------------------------------------------------------*/ diff --git a/FreeRTOS/Source/portable/GCC/ARM7_LPC2000/portmacro.h b/FreeRTOS/Source/portable/GCC/ARM7_LPC2000/portmacro.h index 62a2b9335..5e8f6d2da 100644 --- a/FreeRTOS/Source/portable/GCC/ARM7_LPC2000/portmacro.h +++ b/FreeRTOS/Source/portable/GCC/ARM7_LPC2000/portmacro.h @@ -1,5 +1,5 @@ /* - FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. + FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. All rights reserved VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. @@ -71,7 +71,7 @@ extern "C" { #endif /*----------------------------------------------------------- - * Port specific definitions. + * Port specific definitions. * * The settings in this file configure FreeRTOS correctly for the * given hardware and compiler. @@ -86,24 +86,28 @@ extern "C" { #define portDOUBLE double #define portLONG long #define portSHORT short -#define portSTACK_TYPE unsigned portLONG +#define portSTACK_TYPE uint32_t #define portBASE_TYPE portLONG +typedef portSTACK_TYPE StackType_t; +typedef long BaseType_t; +typedef unsigned long UBaseType_t; + #if( configUSE_16_BIT_TICKS == 1 ) - typedef unsigned portSHORT portTickType; - #define portMAX_DELAY ( portTickType ) 0xffff + typedef uint16_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffff #else - typedef unsigned portLONG portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffffUL + typedef uint32_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffffffffUL #endif -/*-----------------------------------------------------------*/ +/*-----------------------------------------------------------*/ /* Architecture specifics. */ #define portSTACK_GROWTH ( -1 ) -#define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ ) +#define portTICK_RATE_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ ) #define portBYTE_ALIGNMENT 8 #define portNOP() __asm volatile ( "NOP" ); -/*-----------------------------------------------------------*/ +/*-----------------------------------------------------------*/ /* Scheduler utilities. */ @@ -118,7 +122,7 @@ extern "C" { #define portRESTORE_CONTEXT() \ { \ extern volatile void * volatile pxCurrentTCB; \ -extern volatile unsigned portLONG ulCriticalNesting; \ +extern volatile uint32_t ulCriticalNesting; \ \ /* Set the LR to the task stack. */ \ __asm volatile ( \ @@ -155,7 +159,7 @@ extern volatile unsigned portLONG ulCriticalNesting; \ #define portSAVE_CONTEXT() \ { \ extern volatile void * volatile pxCurrentTCB; \ -extern volatile unsigned portLONG ulCriticalNesting; \ +extern volatile uint32_t ulCriticalNesting; \ \ /* Push R0 as we are going to use the register. */ \ __asm volatile ( \ @@ -208,8 +212,8 @@ extern void vTaskSwitchContext( void ); /* * The interrupt management utilities can only be called from ARM mode. When - * THUMB_INTERWORK is defined the utilities are defined as functions in - * portISR.c to ensure a switch to ARM mode. When THUMB_INTERWORK is not + * THUMB_INTERWORK is defined the utilities are defined as functions in + * portISR.c to ensure a switch to ARM mode. When THUMB_INTERWORK is not * defined then the utilities are defined as macros here - as per other ports. */ @@ -220,7 +224,7 @@ extern void vTaskSwitchContext( void ); #define portDISABLE_INTERRUPTS() vPortDisableInterruptsFromThumb() #define portENABLE_INTERRUPTS() vPortEnableInterruptsFromThumb() - + #else #define portDISABLE_INTERRUPTS() \ @@ -230,7 +234,7 @@ extern void vTaskSwitchContext( void ); "ORR R0, R0, #0xC0 \n\t" /* Disable IRQ, FIQ. */ \ "MSR CPSR, R0 \n\t" /* Write back modified value. */ \ "LDMIA SP!, {R0} " ) /* Pop R0. */ - + #define portENABLE_INTERRUPTS() \ __asm volatile ( \ "STMDB SP!, {R0} \n\t" /* Push R0. */ \ diff --git a/FreeRTOS/Source/portable/GCC/ARM7_LPC23xx/port.c b/FreeRTOS/Source/portable/GCC/ARM7_LPC23xx/port.c index eee4815e2..54c72d71a 100644 --- a/FreeRTOS/Source/portable/GCC/ARM7_LPC23xx/port.c +++ b/FreeRTOS/Source/portable/GCC/ARM7_LPC23xx/port.c @@ -81,21 +81,21 @@ #include "task.h" /* Constants required to setup the task context. */ -#define portINITIAL_SPSR ( ( portSTACK_TYPE ) 0x1f ) /* System mode, ARM mode, interrupts enabled. */ -#define portTHUMB_MODE_BIT ( ( portSTACK_TYPE ) 0x20 ) -#define portINSTRUCTION_SIZE ( ( portSTACK_TYPE ) 4 ) -#define portNO_CRITICAL_SECTION_NESTING ( ( portSTACK_TYPE ) 0 ) +#define portINITIAL_SPSR ( ( StackType_t ) 0x1f ) /* System mode, ARM mode, interrupts enabled. */ +#define portTHUMB_MODE_BIT ( ( StackType_t ) 0x20 ) +#define portINSTRUCTION_SIZE ( ( StackType_t ) 4 ) +#define portNO_CRITICAL_SECTION_NESTING ( ( StackType_t ) 0 ) /* Constants required to setup the tick ISR. */ -#define portENABLE_TIMER ( ( unsigned portCHAR ) 0x01 ) +#define portENABLE_TIMER ( ( uint8_t ) 0x01 ) #define portPRESCALE_VALUE 0x00 -#define portINTERRUPT_ON_MATCH ( ( unsigned portLONG ) 0x01 ) -#define portRESET_COUNT_ON_MATCH ( ( unsigned portLONG ) 0x02 ) +#define portINTERRUPT_ON_MATCH ( ( uint32_t ) 0x01 ) +#define portRESET_COUNT_ON_MATCH ( ( uint32_t ) 0x02 ) /* Constants required to setup the VIC for the tick ISR. */ -#define portTIMER_VIC_CHANNEL ( ( unsigned portLONG ) 0x0004 ) -#define portTIMER_VIC_CHANNEL_BIT ( ( unsigned portLONG ) 0x0010 ) -#define portTIMER_VIC_ENABLE ( ( unsigned portLONG ) 0x0020 ) +#define portTIMER_VIC_CHANNEL ( ( uint32_t ) 0x0004 ) +#define portTIMER_VIC_CHANNEL_BIT ( ( uint32_t ) 0x0010 ) +#define portTIMER_VIC_ENABLE ( ( uint32_t ) 0x0020 ) /*-----------------------------------------------------------*/ @@ -116,9 +116,9 @@ extern void vPortISRStartFirstTask( void ); * * See header file for description. */ -portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) +StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) { -portSTACK_TYPE *pxOriginalTOS; +StackType_t *pxOriginalTOS; pxOriginalTOS = pxTopOfStack; @@ -132,48 +132,48 @@ portSTACK_TYPE *pxOriginalTOS; /* First on the stack is the return address - which in this case is the start of the task. The offset is added to make the return address appear as it would within an IRQ ISR. */ - *pxTopOfStack = ( portSTACK_TYPE ) pxCode + portINSTRUCTION_SIZE; + *pxTopOfStack = ( StackType_t ) pxCode + portINSTRUCTION_SIZE; pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x00000000; /* R14 */ + *pxTopOfStack = ( StackType_t ) 0x00000000; /* R14 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) pxOriginalTOS; /* Stack used when task starts goes in R13. */ + *pxTopOfStack = ( StackType_t ) pxOriginalTOS; /* Stack used when task starts goes in R13. */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x12121212; /* R12 */ + *pxTopOfStack = ( StackType_t ) 0x12121212; /* R12 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x11111111; /* R11 */ + *pxTopOfStack = ( StackType_t ) 0x11111111; /* R11 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x10101010; /* R10 */ + *pxTopOfStack = ( StackType_t ) 0x10101010; /* R10 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x09090909; /* R9 */ + *pxTopOfStack = ( StackType_t ) 0x09090909; /* R9 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x08080808; /* R8 */ + *pxTopOfStack = ( StackType_t ) 0x08080808; /* R8 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x07070707; /* R7 */ + *pxTopOfStack = ( StackType_t ) 0x07070707; /* R7 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x06060606; /* R6 */ + *pxTopOfStack = ( StackType_t ) 0x06060606; /* R6 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x05050505; /* R5 */ + *pxTopOfStack = ( StackType_t ) 0x05050505; /* R5 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x04040404; /* R4 */ + *pxTopOfStack = ( StackType_t ) 0x04040404; /* R4 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x03030303; /* R3 */ + *pxTopOfStack = ( StackType_t ) 0x03030303; /* R3 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x02020202; /* R2 */ + *pxTopOfStack = ( StackType_t ) 0x02020202; /* R2 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x01010101; /* R1 */ + *pxTopOfStack = ( StackType_t ) 0x01010101; /* R1 */ pxTopOfStack--; /* When the task starts is will expect to find the function parameter in R0. */ - *pxTopOfStack = ( portSTACK_TYPE ) pvParameters; /* R0 */ + *pxTopOfStack = ( StackType_t ) pvParameters; /* R0 */ pxTopOfStack--; /* The last thing onto the stack is the status register, which is set for system mode, with interrupts enabled. */ - *pxTopOfStack = ( portSTACK_TYPE ) portINITIAL_SPSR; + *pxTopOfStack = ( StackType_t ) portINITIAL_SPSR; - if( ( ( unsigned long ) pxCode & 0x01UL ) != 0x00 ) + if( ( ( uint32_t ) pxCode & 0x01UL ) != 0x00 ) { /* We want the task to start in thumb mode. */ *pxTopOfStack |= portTHUMB_MODE_BIT; @@ -191,7 +191,7 @@ portSTACK_TYPE *pxOriginalTOS; } /*-----------------------------------------------------------*/ -portBASE_TYPE xPortStartScheduler( void ) +BaseType_t xPortStartScheduler( void ) { /* Start the timer that generates the tick ISR. Interrupts are disabled here already. */ @@ -217,7 +217,7 @@ void vPortEndScheduler( void ) */ static void prvSetupTimerInterrupt( void ) { -unsigned portLONG ulCompareMatch; +uint32_t ulCompareMatch; PCLKSEL0 = (PCLKSEL0 & (~(0x3<<2))) | (0x01 << 2); T0TCR = 2; /* Stop and reset the timer */ @@ -250,12 +250,12 @@ unsigned portLONG ulCompareMatch; #if configUSE_PREEMPTION == 1 { extern void ( vPreemptiveTick )( void ); - VICVectAddr4 = ( portLONG ) vPreemptiveTick; + VICVectAddr4 = ( int32_t ) vPreemptiveTick; } #else { extern void ( vNonPreemptiveTick )( void ); - VICVectAddr4 = ( portLONG ) vNonPreemptiveTick; + VICVectAddr4 = ( int32_t ) vNonPreemptiveTick; } #endif diff --git a/FreeRTOS/Source/portable/GCC/ARM7_LPC23xx/portISR.c b/FreeRTOS/Source/portable/GCC/ARM7_LPC23xx/portISR.c index be4fc61da..169a6063f 100644 --- a/FreeRTOS/Source/portable/GCC/ARM7_LPC23xx/portISR.c +++ b/FreeRTOS/Source/portable/GCC/ARM7_LPC23xx/portISR.c @@ -75,12 +75,12 @@ #include "task.h" /* Constants required to handle interrupts. */ -#define portTIMER_MATCH_ISR_BIT ( ( unsigned portCHAR ) 0x01 ) -#define portCLEAR_VIC_INTERRUPT ( ( unsigned portLONG ) 0 ) +#define portTIMER_MATCH_ISR_BIT ( ( uint8_t ) 0x01 ) +#define portCLEAR_VIC_INTERRUPT ( ( uint32_t ) 0 ) /* Constants required to handle critical sections. */ -#define portNO_CRITICAL_NESTING ( ( unsigned portLONG ) 0 ) -volatile unsigned portLONG ulCriticalNesting = 9999UL; +#define portNO_CRITICAL_NESTING ( ( uint32_t ) 0 ) +volatile uint32_t ulCriticalNesting = 9999UL; /*-----------------------------------------------------------*/ diff --git a/FreeRTOS/Source/portable/GCC/ARM7_LPC23xx/portmacro.h b/FreeRTOS/Source/portable/GCC/ARM7_LPC23xx/portmacro.h index 80f0bb27d..a1b56ca68 100644 --- a/FreeRTOS/Source/portable/GCC/ARM7_LPC23xx/portmacro.h +++ b/FreeRTOS/Source/portable/GCC/ARM7_LPC23xx/portmacro.h @@ -1,5 +1,5 @@ /* - FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. + FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. All rights reserved VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. @@ -65,12 +65,12 @@ /* Changes from V3.2.3 - + + Modified portENTER_SWITCHING_ISR() to allow use with GCC V4.0.1. Changes from V3.2.4 - + Removed the use of the %0 parameter within the assembler macros and + + Removed the use of the %0 parameter within the assembler macros and replaced them with hard coded registers. This will ensure the assembler does not select the link register as the temp register as was occasionally happening previously. @@ -81,7 +81,7 @@ Changes from V4.5.0 + Removed the portENTER_SWITCHING_ISR() and portEXIT_SWITCHING_ISR() macros - and replaced them with portYIELD_FROM_ISR() macro. Application code + and replaced them with portYIELD_FROM_ISR() macro. Application code should now make use of the portSAVE_CONTEXT() and portRESTORE_CONTEXT() macros as per the V4.5.1 demo code. */ @@ -94,7 +94,7 @@ extern "C" { #endif /*----------------------------------------------------------- - * Port specific definitions. + * Port specific definitions. * * The settings in this file configure FreeRTOS correctly for the * given hardware and compiler. @@ -109,24 +109,28 @@ extern "C" { #define portDOUBLE double #define portLONG long #define portSHORT short -#define portSTACK_TYPE unsigned portLONG +#define portSTACK_TYPE uint32_t #define portBASE_TYPE portLONG +typedef portSTACK_TYPE StackType_t; +typedef long BaseType_t; +typedef unsigned long UBaseType_t; + #if( configUSE_16_BIT_TICKS == 1 ) - typedef unsigned portSHORT portTickType; - #define portMAX_DELAY ( portTickType ) 0xffff + typedef uint16_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffff #else - typedef unsigned portLONG portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffffUL + typedef uint32_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffffffffUL #endif -/*-----------------------------------------------------------*/ +/*-----------------------------------------------------------*/ /* Architecture specifics. */ #define portSTACK_GROWTH ( -1 ) -#define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ ) +#define portTICK_RATE_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ ) #define portBYTE_ALIGNMENT 8 #define portNOP() __asm volatile ( "NOP" ); -/*-----------------------------------------------------------*/ +/*-----------------------------------------------------------*/ /* Scheduler utilities. */ @@ -141,7 +145,7 @@ extern "C" { #define portRESTORE_CONTEXT() \ { \ extern volatile void * volatile pxCurrentTCB; \ -extern volatile unsigned portLONG ulCriticalNesting; \ +extern volatile uint32_t ulCriticalNesting; \ \ /* Set the LR to the task stack. */ \ __asm volatile ( \ @@ -178,7 +182,7 @@ extern volatile unsigned portLONG ulCriticalNesting; \ #define portSAVE_CONTEXT() \ { \ extern volatile void * volatile pxCurrentTCB; \ -extern volatile unsigned portLONG ulCriticalNesting; \ +extern volatile uint32_t ulCriticalNesting; \ \ /* Push R0 as we are going to use the register. */ \ __asm volatile ( \ @@ -231,8 +235,8 @@ extern volatile unsigned portLONG ulCriticalNesting; \ /* * The interrupt management utilities can only be called from ARM mode. When - * THUMB_INTERWORK is defined the utilities are defined as functions in - * portISR.c to ensure a switch to ARM mode. When THUMB_INTERWORK is not + * THUMB_INTERWORK is defined the utilities are defined as functions in + * portISR.c to ensure a switch to ARM mode. When THUMB_INTERWORK is not * defined then the utilities are defined as macros here - as per other ports. */ @@ -243,7 +247,7 @@ extern volatile unsigned portLONG ulCriticalNesting; \ #define portDISABLE_INTERRUPTS() vPortDisableInterruptsFromThumb() #define portENABLE_INTERRUPTS() vPortEnableInterruptsFromThumb() - + #else #define portDISABLE_INTERRUPTS() \ @@ -253,7 +257,7 @@ extern volatile unsigned portLONG ulCriticalNesting; \ "ORR R0, R0, #0xC0 \n\t" /* Disable IRQ, FIQ. */ \ "MSR CPSR, R0 \n\t" /* Write back modified value. */ \ "LDMIA SP!, {R0} " ) /* Pop R0. */ - + #define portENABLE_INTERRUPTS() \ __asm volatile ( \ "STMDB SP!, {R0} \n\t" /* Push R0. */ \ diff --git a/FreeRTOS/Source/portable/GCC/ARM_CM0/port.c b/FreeRTOS/Source/portable/GCC/ARM_CM0/port.c index b469a9ebf..e7c8e68f7 100644 --- a/FreeRTOS/Source/portable/GCC/ARM_CM0/port.c +++ b/FreeRTOS/Source/portable/GCC/ARM_CM0/port.c @@ -72,10 +72,10 @@ #include "task.h" /* Constants required to manipulate the NVIC. */ -#define portNVIC_SYSTICK_CTRL ( ( volatile unsigned long *) 0xe000e010 ) -#define portNVIC_SYSTICK_LOAD ( ( volatile unsigned long *) 0xe000e014 ) -#define portNVIC_INT_CTRL ( ( volatile unsigned long *) 0xe000ed04 ) -#define portNVIC_SYSPRI2 ( ( volatile unsigned long *) 0xe000ed20 ) +#define portNVIC_SYSTICK_CTRL ( ( volatile uint32_t *) 0xe000e010 ) +#define portNVIC_SYSTICK_LOAD ( ( volatile uint32_t *) 0xe000e014 ) +#define portNVIC_INT_CTRL ( ( volatile uint32_t *) 0xe000ed04 ) +#define portNVIC_SYSPRI2 ( ( volatile uint32_t *) 0xe000ed20 ) #define portNVIC_SYSTICK_CLK 0x00000004 #define portNVIC_SYSTICK_INT 0x00000002 #define portNVIC_SYSTICK_ENABLE 0x00000001 @@ -98,7 +98,7 @@ debugger. */ /* Each task maintains its own interrupt status in the critical nesting variable. */ -static unsigned portBASE_TYPE uxCriticalNesting = 0xaaaaaaaa; +static UBaseType_t uxCriticalNesting = 0xaaaaaaaa; /* * Setup the timer to generate the tick interrupts. @@ -127,18 +127,18 @@ static void prvTaskExitError( void ); /* * See header file for description. */ -portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) +StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) { /* Simulate the stack frame as it would be created by a context switch interrupt. */ pxTopOfStack--; /* Offset added to account for the way the MCU uses the stack on entry/exit of interrupts. */ *pxTopOfStack = portINITIAL_XPSR; /* xPSR */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) pxCode; /* PC */ + *pxTopOfStack = ( StackType_t ) pxCode; /* PC */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) portTASK_RETURN_ADDRESS; /* LR */ + *pxTopOfStack = ( StackType_t ) portTASK_RETURN_ADDRESS; /* LR */ pxTopOfStack -= 5; /* R12, R3, R2 and R1. */ - *pxTopOfStack = ( portSTACK_TYPE ) pvParameters; /* R0 */ + *pxTopOfStack = ( StackType_t ) pvParameters; /* R0 */ pxTopOfStack -= 8; /* R11..R4. */ return pxTopOfStack; @@ -193,7 +193,7 @@ void vPortStartFirstTask( void ) /* * See header file for description. */ -portBASE_TYPE xPortStartScheduler( void ) +BaseType_t xPortStartScheduler( void ) { /* Make PendSV, CallSV and SysTick the same priroity as the kernel. */ *(portNVIC_SYSPRI2) |= portNVIC_PENDSV_PRI; @@ -260,7 +260,7 @@ void vPortExitCritical( void ) } /*-----------------------------------------------------------*/ -unsigned long ulSetInterruptMaskFromISR( void ) +uint32_t ulSetInterruptMaskFromISR( void ) { __asm volatile( " mrs r0, PRIMASK \n" @@ -273,7 +273,7 @@ unsigned long ulSetInterruptMaskFromISR( void ) } /*-----------------------------------------------------------*/ -void vClearInterruptMaskFromISR( unsigned long ulMask ) +void vClearInterruptMaskFromISR( uint32_t ulMask ) { __asm volatile( " msr PRIMASK, r0 \n" @@ -335,7 +335,7 @@ void xPortPendSVHandler( void ) void xPortSysTickHandler( void ) { -unsigned long ulPreviousMask; +uint32_t ulPreviousMask; ulPreviousMask = portSET_INTERRUPT_MASK_FROM_ISR(); { diff --git a/FreeRTOS/Source/portable/GCC/ARM_CM0/portmacro.h b/FreeRTOS/Source/portable/GCC/ARM_CM0/portmacro.h index 0492ef4a7..010c617e4 100644 --- a/FreeRTOS/Source/portable/GCC/ARM_CM0/portmacro.h +++ b/FreeRTOS/Source/portable/GCC/ARM_CM0/portmacro.h @@ -1,5 +1,5 @@ /* - FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. + FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. All rights reserved VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. @@ -87,28 +87,32 @@ extern "C" { #define portDOUBLE double #define portLONG long #define portSHORT short -#define portSTACK_TYPE unsigned portLONG +#define portSTACK_TYPE uint32_t #define portBASE_TYPE long +typedef portSTACK_TYPE StackType_t; +typedef long BaseType_t; +typedef unsigned long UBaseType_t; + #if( configUSE_16_BIT_TICKS == 1 ) - typedef unsigned portSHORT portTickType; - #define portMAX_DELAY ( portTickType ) 0xffff + typedef uint16_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffff #else - typedef unsigned portLONG portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffffUL + typedef uint32_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffffffffUL #endif /*-----------------------------------------------------------*/ /* Architecture specifics. */ #define portSTACK_GROWTH ( -1 ) -#define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ ) +#define portTICK_RATE_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ ) #define portBYTE_ALIGNMENT 8 /*-----------------------------------------------------------*/ /* Scheduler utilities. */ extern void vPortYield( void ); -#define portNVIC_INT_CTRL_REG ( * ( ( volatile unsigned long * ) 0xe000ed04 ) ) +#define portNVIC_INT_CTRL_REG ( * ( ( volatile uint32_t * ) 0xe000ed04 ) ) #define portNVIC_PENDSVSET_BIT ( 1UL << 28UL ) #define portYIELD() vPortYield() #define portEND_SWITCHING_ISR( xSwitchRequired ) if( xSwitchRequired ) portNVIC_INT_CTRL_REG = portNVIC_PENDSVSET_BIT @@ -119,8 +123,8 @@ extern void vPortYield( void ); /* Critical section management. */ extern void vPortEnterCritical( void ); extern void vPortExitCritical( void ); -extern unsigned long ulSetInterruptMaskFromISR( void ) __attribute__((naked)); -extern void vClearInterruptMaskFromISR( unsigned long ulMask ) __attribute__((naked)); +extern uint32_t ulSetInterruptMaskFromISR( void ) __attribute__((naked)); +extern void vClearInterruptMaskFromISR( uint32_t ulMask ) __attribute__((naked)); #define portSET_INTERRUPT_MASK_FROM_ISR() ulSetInterruptMaskFromISR() #define portCLEAR_INTERRUPT_MASK_FROM_ISR(x) vClearInterruptMaskFromISR( x ) diff --git a/FreeRTOS/Source/portable/GCC/ARM_CM3/port.c b/FreeRTOS/Source/portable/GCC/ARM_CM3/port.c index 0b80e07ef..cd7681098 100644 --- a/FreeRTOS/Source/portable/GCC/ARM_CM3/port.c +++ b/FreeRTOS/Source/portable/GCC/ARM_CM3/port.c @@ -89,10 +89,10 @@ FreeRTOS.org versions prior to V4.4.0 did not include this definition. */ #endif /* Constants required to manipulate the core. Registers first... */ -#define portNVIC_SYSTICK_CTRL_REG ( * ( ( volatile unsigned long * ) 0xe000e010 ) ) -#define portNVIC_SYSTICK_LOAD_REG ( * ( ( volatile unsigned long * ) 0xe000e014 ) ) -#define portNVIC_SYSTICK_CURRENT_VALUE_REG ( * ( ( volatile unsigned long * ) 0xe000e018 ) ) -#define portNVIC_SYSPRI2_REG ( * ( ( volatile unsigned long * ) 0xe000ed20 ) ) +#define portNVIC_SYSTICK_CTRL_REG ( * ( ( volatile uint32_t * ) 0xe000e010 ) ) +#define portNVIC_SYSTICK_LOAD_REG ( * ( ( volatile uint32_t * ) 0xe000e014 ) ) +#define portNVIC_SYSTICK_CURRENT_VALUE_REG ( * ( ( volatile uint32_t * ) 0xe000e018 ) ) +#define portNVIC_SYSPRI2_REG ( * ( ( volatile uint32_t * ) 0xe000ed20 ) ) /* ...then bits in the registers. */ #define portNVIC_SYSTICK_INT_BIT ( 1UL << 1UL ) #define portNVIC_SYSTICK_ENABLE_BIT ( 1UL << 0UL ) @@ -100,16 +100,16 @@ FreeRTOS.org versions prior to V4.4.0 did not include this definition. */ #define portNVIC_PENDSVCLEAR_BIT ( 1UL << 27UL ) #define portNVIC_PEND_SYSTICK_CLEAR_BIT ( 1UL << 25UL ) -#define portNVIC_PENDSV_PRI ( ( ( unsigned long ) configKERNEL_INTERRUPT_PRIORITY ) << 16UL ) -#define portNVIC_SYSTICK_PRI ( ( ( unsigned long ) configKERNEL_INTERRUPT_PRIORITY ) << 24UL ) +#define portNVIC_PENDSV_PRI ( ( ( uint32_t ) configKERNEL_INTERRUPT_PRIORITY ) << 16UL ) +#define portNVIC_SYSTICK_PRI ( ( ( uint32_t ) configKERNEL_INTERRUPT_PRIORITY ) << 24UL ) /* Constants required to check the validity of an interrupt priority. */ #define portFIRST_USER_INTERRUPT_NUMBER ( 16 ) #define portNVIC_IP_REGISTERS_OFFSET_16 ( 0xE000E3F0 ) -#define portAIRCR_REG ( * ( ( volatile unsigned long * ) 0xE000ED0C ) ) -#define portMAX_8_BIT_VALUE ( ( unsigned char ) 0xff ) -#define portTOP_BIT_OF_BYTE ( ( unsigned char ) 0x80 ) -#define portMAX_PRIGROUP_BITS ( ( unsigned char ) 7 ) +#define portAIRCR_REG ( * ( ( volatile uint32_t * ) 0xE000ED0C ) ) +#define portMAX_8_BIT_VALUE ( ( uint8_t ) 0xff ) +#define portTOP_BIT_OF_BYTE ( ( uint8_t ) 0x80 ) +#define portMAX_PRIGROUP_BITS ( ( uint8_t ) 7 ) #define portPRIORITY_GROUP_MASK ( 0x07UL << 8UL ) #define portPRIGROUP_SHIFT ( 8UL ) @@ -135,7 +135,7 @@ debugger. */ /* Each task maintains its own interrupt status in the critical nesting variable. */ -static unsigned portBASE_TYPE uxCriticalNesting = 0xaaaaaaaa; +static UBaseType_t uxCriticalNesting = 0xaaaaaaaa; /* * Setup the timer to generate the tick interrupts. The implementation in this @@ -167,7 +167,7 @@ static void prvTaskExitError( void ); * The number of SysTick increments that make up one tick period. */ #if configUSE_TICKLESS_IDLE == 1 - static unsigned long ulTimerCountsForOneTick = 0; + static uint32_t ulTimerCountsForOneTick = 0; #endif /* configUSE_TICKLESS_IDLE */ /* @@ -175,7 +175,7 @@ static void prvTaskExitError( void ); * 24 bit resolution of the SysTick timer. */ #if configUSE_TICKLESS_IDLE == 1 - static unsigned long xMaximumPossibleSuppressedTicks = 0; + static uint32_t xMaximumPossibleSuppressedTicks = 0; #endif /* configUSE_TICKLESS_IDLE */ /* @@ -183,7 +183,7 @@ static void prvTaskExitError( void ); * power functionality only. */ #if configUSE_TICKLESS_IDLE == 1 - static unsigned long ulStoppedTimerCompensation = 0; + static uint32_t ulStoppedTimerCompensation = 0; #endif /* configUSE_TICKLESS_IDLE */ /* @@ -192,9 +192,9 @@ static void prvTaskExitError( void ); * a priority above configMAX_SYSCALL_INTERRUPT_PRIORITY. */ #if ( configASSERT_DEFINED == 1 ) - static unsigned char ucMaxSysCallPriority = 0; - static unsigned long ulMaxPRIGROUPValue = 0; - static const volatile unsigned char * const pcInterruptPriorityRegisters = ( const volatile unsigned char * const ) portNVIC_IP_REGISTERS_OFFSET_16; + static uint8_t ucMaxSysCallPriority = 0; + static uint32_t ulMaxPRIGROUPValue = 0; + static const volatile uint8_t * const pcInterruptPriorityRegisters = ( const volatile uint8_t * const ) portNVIC_IP_REGISTERS_OFFSET_16; #endif /* configASSERT_DEFINED */ /*-----------------------------------------------------------*/ @@ -202,18 +202,18 @@ static void prvTaskExitError( void ); /* * See header file for description. */ -portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) +StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) { /* Simulate the stack frame as it would be created by a context switch interrupt. */ pxTopOfStack--; /* Offset added to account for the way the MCU uses the stack on entry/exit of interrupts. */ *pxTopOfStack = portINITIAL_XPSR; /* xPSR */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) pxCode; /* PC */ + *pxTopOfStack = ( StackType_t ) pxCode; /* PC */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) portTASK_RETURN_ADDRESS; /* LR */ + *pxTopOfStack = ( StackType_t ) portTASK_RETURN_ADDRESS; /* LR */ pxTopOfStack -= 5; /* R12, R3, R2 and R1. */ - *pxTopOfStack = ( portSTACK_TYPE ) pvParameters; /* R0 */ + *pxTopOfStack = ( StackType_t ) pvParameters; /* R0 */ pxTopOfStack -= 8; /* R11, R10, R9, R8, R7, R6, R5 and R4. */ return pxTopOfStack; @@ -273,7 +273,7 @@ static void prvPortStartFirstTask( void ) /* * See header file for description. */ -portBASE_TYPE xPortStartScheduler( void ) +BaseType_t xPortStartScheduler( void ) { /* configMAX_SYSCALL_INTERRUPT_PRIORITY must not be set to 0. See http://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html */ @@ -281,9 +281,9 @@ portBASE_TYPE xPortStartScheduler( void ) #if( configASSERT_DEFINED == 1 ) { - volatile unsigned long ulOriginalPriority; - volatile char * const pcFirstUserPriorityRegister = ( volatile char * const ) ( portNVIC_IP_REGISTERS_OFFSET_16 + portFIRST_USER_INTERRUPT_NUMBER ); - volatile unsigned char ucMaxPriorityValue; + volatile uint32_t ulOriginalPriority; + volatile int8_t * const pcFirstUserPriorityRegister = ( volatile int8_t * const ) ( portNVIC_IP_REGISTERS_OFFSET_16 + portFIRST_USER_INTERRUPT_NUMBER ); + volatile uint8_t ucMaxPriorityValue; /* Determine the maximum priority from which ISR safe FreeRTOS API functions can be called. ISR safe functions are those that end in @@ -309,7 +309,7 @@ portBASE_TYPE xPortStartScheduler( void ) while( ( ucMaxPriorityValue & portTOP_BIT_OF_BYTE ) == portTOP_BIT_OF_BYTE ) { ulMaxPRIGROUPValue--; - ucMaxPriorityValue <<= ( unsigned char ) 0x01; + ucMaxPriorityValue <<= ( uint8_t ) 0x01; } /* Shift the priority group value back to its position within the AIRCR @@ -388,7 +388,7 @@ void vPortExitCritical( void ) } /*-----------------------------------------------------------*/ -__attribute__(( naked )) unsigned long ulPortSetInterruptMask( void ) +__attribute__(( naked )) uint32_t ulPortSetInterruptMask( void ) { __asm volatile \ ( \ @@ -405,7 +405,7 @@ __attribute__(( naked )) unsigned long ulPortSetInterruptMask( void ) } /*-----------------------------------------------------------*/ -__attribute__(( naked )) void vPortClearInterruptMask( unsigned long ulNewMaskValue ) +__attribute__(( naked )) void vPortClearInterruptMask( uint32_t ulNewMaskValue ) { __asm volatile \ ( \ @@ -478,10 +478,10 @@ void xPortSysTickHandler( void ) #if configUSE_TICKLESS_IDLE == 1 - __attribute__((weak)) void vPortSuppressTicksAndSleep( portTickType xExpectedIdleTime ) + __attribute__((weak)) void vPortSuppressTicksAndSleep( TickType_t xExpectedIdleTime ) { - unsigned long ulReloadValue, ulCompleteTickPeriods, ulCompletedSysTickDecrements, ulSysTickCTRL; - portTickType xModifiableIdleTime; + uint32_t ulReloadValue, ulCompleteTickPeriods, ulCompletedSysTickDecrements, ulSysTickCTRL; + TickType_t xModifiableIdleTime; /* Make sure the SysTick reload value does not overflow the counter. */ if( xExpectedIdleTime > xMaximumPossibleSuppressedTicks ) @@ -567,7 +567,7 @@ void xPortSysTickHandler( void ) if( ( ulSysTickCTRL & portNVIC_SYSTICK_COUNT_FLAG_BIT ) != 0 ) { - unsigned long ulCalculatedLoadValue; + uint32_t ulCalculatedLoadValue; /* The tick interrupt has already executed, and the SysTick count reloaded with ulReloadValue. Reset the @@ -653,8 +653,8 @@ __attribute__(( weak )) void vPortSetupTimerInterrupt( void ) void vPortValidateInterruptPriority( void ) { - unsigned long ulCurrentInterrupt; - unsigned char ucCurrentPriority; + uint32_t ulCurrentInterrupt; + uint8_t ucCurrentPriority; /* Obtain the number of the currently executing interrupt. */ __asm volatile( "mrs %0, ipsr" : "=r"( ulCurrentInterrupt ) ); diff --git a/FreeRTOS/Source/portable/GCC/ARM_CM3/portmacro.h b/FreeRTOS/Source/portable/GCC/ARM_CM3/portmacro.h index e7dcd63ce..20339e7de 100644 --- a/FreeRTOS/Source/portable/GCC/ARM_CM3/portmacro.h +++ b/FreeRTOS/Source/portable/GCC/ARM_CM3/portmacro.h @@ -1,5 +1,5 @@ /* - FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. + FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. All rights reserved VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. @@ -87,28 +87,32 @@ extern "C" { #define portDOUBLE double #define portLONG long #define portSHORT short -#define portSTACK_TYPE unsigned portLONG +#define portSTACK_TYPE uint32_t #define portBASE_TYPE long +typedef portSTACK_TYPE StackType_t; +typedef long BaseType_t; +typedef unsigned long UBaseType_t; + #if( configUSE_16_BIT_TICKS == 1 ) - typedef unsigned portSHORT portTickType; - #define portMAX_DELAY ( portTickType ) 0xffff + typedef uint16_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffff #else - typedef unsigned portLONG portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffffUL + typedef uint32_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffffffffUL #endif /*-----------------------------------------------------------*/ /* Architecture specifics. */ #define portSTACK_GROWTH ( -1 ) -#define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ ) +#define portTICK_RATE_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ ) #define portBYTE_ALIGNMENT 8 /*-----------------------------------------------------------*/ /* Scheduler utilities. */ extern void vPortYield( void ); -#define portNVIC_INT_CTRL_REG ( * ( ( volatile unsigned long * ) 0xe000ed04 ) ) +#define portNVIC_INT_CTRL_REG ( * ( ( volatile uint32_t * ) 0xe000ed04 ) ) #define portNVIC_PENDSVSET_BIT ( 1UL << 28UL ) #define portYIELD() vPortYield() #define portEND_SWITCHING_ISR( xSwitchRequired ) if( xSwitchRequired ) portNVIC_INT_CTRL_REG = portNVIC_PENDSVSET_BIT @@ -118,8 +122,8 @@ extern void vPortYield( void ); /* Critical section management. */ extern void vPortEnterCritical( void ); extern void vPortExitCritical( void ); -extern unsigned long ulPortSetInterruptMask( void ); -extern void vPortClearInterruptMask( unsigned long ulNewMaskValue ); +extern uint32_t ulPortSetInterruptMask( void ); +extern void vPortClearInterruptMask( uint32_t ulNewMaskValue ); #define portSET_INTERRUPT_MASK_FROM_ISR() ulPortSetInterruptMask() #define portCLEAR_INTERRUPT_MASK_FROM_ISR(x) vPortClearInterruptMask(x) #define portDISABLE_INTERRUPTS() ulPortSetInterruptMask() @@ -137,7 +141,7 @@ not necessary for to use this port. They are defined so the common demo files /* Tickless idle/low power functionality. */ #ifndef portSUPPRESS_TICKS_AND_SLEEP - extern void vPortSuppressTicksAndSleep( portTickType xExpectedIdleTime ); + extern void vPortSuppressTicksAndSleep( TickType_t xExpectedIdleTime ); #define portSUPPRESS_TICKS_AND_SLEEP( xExpectedIdleTime ) vPortSuppressTicksAndSleep( xExpectedIdleTime ) #endif /*-----------------------------------------------------------*/ @@ -146,9 +150,9 @@ not necessary for to use this port. They are defined so the common demo files #if configUSE_PORT_OPTIMISED_TASK_SELECTION == 1 /* Generic helper function. */ - __attribute__( ( always_inline ) ) static inline unsigned char ucPortCountLeadingZeros( unsigned long ulBitmap ) + __attribute__( ( always_inline ) ) static inline uint8_t ucPortCountLeadingZeros( uint32_t ulBitmap ) { - unsigned char ucReturn; + uint8_t ucReturn; __asm volatile ( "clz %0, %1" : "=r" ( ucReturn ) : "r" ( ulBitmap ) ); return ucReturn; diff --git a/FreeRTOS/Source/portable/GCC/ARM_CM3_MPU/port.c b/FreeRTOS/Source/portable/GCC/ARM_CM3_MPU/port.c index e776faf24..c18f8e9aa 100644 --- a/FreeRTOS/Source/portable/GCC/ARM_CM3_MPU/port.c +++ b/FreeRTOS/Source/portable/GCC/ARM_CM3_MPU/port.c @@ -80,18 +80,18 @@ task.h is included from an application file. */ #undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE /* Constants required to access and manipulate the NVIC. */ -#define portNVIC_SYSTICK_CTRL ( ( volatile unsigned long * ) 0xe000e010 ) -#define portNVIC_SYSTICK_LOAD ( ( volatile unsigned long * ) 0xe000e014 ) -#define portNVIC_SYSPRI2 ( ( volatile unsigned long * ) 0xe000ed20 ) -#define portNVIC_SYSPRI1 ( ( volatile unsigned long * ) 0xe000ed1c ) -#define portNVIC_SYS_CTRL_STATE ( ( volatile unsigned long * ) 0xe000ed24 ) +#define portNVIC_SYSTICK_CTRL ( ( volatile uint32_t * ) 0xe000e010 ) +#define portNVIC_SYSTICK_LOAD ( ( volatile uint32_t * ) 0xe000e014 ) +#define portNVIC_SYSPRI2 ( ( volatile uint32_t * ) 0xe000ed20 ) +#define portNVIC_SYSPRI1 ( ( volatile uint32_t * ) 0xe000ed1c ) +#define portNVIC_SYS_CTRL_STATE ( ( volatile uint32_t * ) 0xe000ed24 ) #define portNVIC_MEM_FAULT_ENABLE ( 1UL << 16UL ) /* Constants required to access and manipulate the MPU. */ -#define portMPU_TYPE ( ( volatile unsigned long * ) 0xe000ed90 ) -#define portMPU_REGION_BASE_ADDRESS ( ( volatile unsigned long * ) 0xe000ed9C ) -#define portMPU_REGION_ATTRIBUTE ( ( volatile unsigned long * ) 0xe000edA0 ) -#define portMPU_CTRL ( ( volatile unsigned long * ) 0xe000ed94 ) +#define portMPU_TYPE ( ( volatile uint32_t * ) 0xe000ed90 ) +#define portMPU_REGION_BASE_ADDRESS ( ( volatile uint32_t * ) 0xe000ed9C ) +#define portMPU_REGION_ATTRIBUTE ( ( volatile uint32_t * ) 0xe000edA0 ) +#define portMPU_CTRL ( ( volatile uint32_t * ) 0xe000ed94 ) #define portEXPECTED_MPU_TYPE_VALUE ( 8UL << 8UL ) /* 8 regions, unified. */ #define portMPU_ENABLE ( 0x01UL ) #define portMPU_BACKGROUND_ENABLE ( 1UL << 2UL ) @@ -105,9 +105,9 @@ task.h is included from an application file. */ #define portNVIC_SYSTICK_CLK ( 0x00000004UL ) #define portNVIC_SYSTICK_INT ( 0x00000002UL ) #define portNVIC_SYSTICK_ENABLE ( 0x00000001UL ) -#define portNVIC_PENDSV_PRI ( ( ( unsigned long ) configKERNEL_INTERRUPT_PRIORITY ) << 16UL ) -#define portNVIC_SYSTICK_PRI ( ( ( unsigned long ) configKERNEL_INTERRUPT_PRIORITY ) << 24UL ) -#define portNVIC_SVC_PRI ( ( ( unsigned long ) configKERNEL_INTERRUPT_PRIORITY ) << 24UL ) +#define portNVIC_PENDSV_PRI ( ( ( uint32_t ) configKERNEL_INTERRUPT_PRIORITY ) << 16UL ) +#define portNVIC_SYSTICK_PRI ( ( ( uint32_t ) configKERNEL_INTERRUPT_PRIORITY ) << 24UL ) +#define portNVIC_SVC_PRI ( ( ( uint32_t ) configKERNEL_INTERRUPT_PRIORITY ) << 24UL ) /* Constants required to set up the initial stack. */ #define portINITIAL_XPSR ( 0x01000000 ) @@ -123,7 +123,7 @@ task.h is included from an application file. */ /* Each task maintains its own interrupt status in the critical nesting variable. Note this is not saved as part of the task context as context switches can only occur when uxCriticalNesting is zero. */ -static unsigned portBASE_TYPE uxCriticalNesting = 0xaaaaaaaa; +static UBaseType_t uxCriticalNesting = 0xaaaaaaaa; /* * Setup the timer to generate the tick interrupts. @@ -140,14 +140,14 @@ static void prvSetupMPU( void ) PRIVILEGED_FUNCTION; * into. The region size is returned as the value that should be programmed * into the region attribute register for that region. */ -static unsigned long prvGetMPURegionSizeSetting( unsigned long ulActualSizeInBytes ) PRIVILEGED_FUNCTION; +static uint32_t prvGetMPURegionSizeSetting( uint32_t ulActualSizeInBytes ) PRIVILEGED_FUNCTION; /* * Checks to see if being called from the context of an unprivileged task, and * if so raises the privilege level and returns false - otherwise does nothing * other than return true. */ -static portBASE_TYPE prvRaisePrivilege( void ) __attribute__(( naked )); +static BaseType_t prvRaisePrivilege( void ) __attribute__(( naked )); /* * Standard FreeRTOS exception handlers. @@ -165,76 +165,76 @@ static void prvRestoreContextOfFirstTask( void ) __attribute__(( naked )) PRIVIL * C portion of the SVC handler. The SVC handler is split between an asm entry * and a C wrapper for simplicity of coding and maintenance. */ -static void prvSVCHandler( unsigned long *pulRegisters ) __attribute__(( noinline )) PRIVILEGED_FUNCTION; +static void prvSVCHandler( uint32_t *pulRegisters ) __attribute__(( noinline )) PRIVILEGED_FUNCTION; /* * Prototypes for all the MPU wrappers. */ -signed portBASE_TYPE MPU_xTaskGenericCreate( pdTASK_CODE pvTaskCode, const char * const pcName, unsigned short usStackDepth, void *pvParameters, unsigned portBASE_TYPE uxPriority, xTaskHandle *pxCreatedTask, portSTACK_TYPE *puxStackBuffer, const xMemoryRegion * const xRegions ); -void MPU_vTaskAllocateMPURegions( xTaskHandle xTask, const xMemoryRegion * const xRegions ); -void MPU_vTaskDelete( xTaskHandle pxTaskToDelete ); -void MPU_vTaskDelayUntil( portTickType * const pxPreviousWakeTime, portTickType xTimeIncrement ); -void MPU_vTaskDelay( portTickType xTicksToDelay ); -unsigned portBASE_TYPE MPU_uxTaskPriorityGet( xTaskHandle pxTask ); -void MPU_vTaskPrioritySet( xTaskHandle pxTask, unsigned portBASE_TYPE uxNewPriority ); -eTaskState MPU_eTaskGetState( xTaskHandle pxTask ); -void MPU_vTaskSuspend( xTaskHandle pxTaskToSuspend ); -signed portBASE_TYPE MPU_xTaskIsTaskSuspended( xTaskHandle xTask ); -void MPU_vTaskResume( xTaskHandle pxTaskToResume ); +BaseType_t MPU_xTaskGenericCreate( pdTASK_CODE pvTaskCode, const char * const pcName, uint16_t usStackDepth, void *pvParameters, UBaseType_t uxPriority, TaskHandle_t *pxCreatedTask, StackType_t *puxStackBuffer, const MemoryRegion_t * const xRegions ); +void MPU_vTaskAllocateMPURegions( TaskHandle_t xTask, const MemoryRegion_t * const xRegions ); +void MPU_vTaskDelete( TaskHandle_t pxTaskToDelete ); +void MPU_vTaskDelayUntil( TickType_t * const pxPreviousWakeTime, TickType_t xTimeIncrement ); +void MPU_vTaskDelay( TickType_t xTicksToDelay ); +UBaseType_t MPU_uxTaskPriorityGet( TaskHandle_t pxTask ); +void MPU_vTaskPrioritySet( TaskHandle_t pxTask, UBaseType_t uxNewPriority ); +eTaskState MPU_eTaskGetState( TaskHandle_t pxTask ); +void MPU_vTaskSuspend( TaskHandle_t pxTaskToSuspend ); +BaseType_t MPU_xTaskIsTaskSuspended( TaskHandle_t xTask ); +void MPU_vTaskResume( TaskHandle_t pxTaskToResume ); void MPU_vTaskSuspendAll( void ); -signed portBASE_TYPE MPU_xTaskResumeAll( void ); -portTickType MPU_xTaskGetTickCount( void ); -unsigned portBASE_TYPE MPU_uxTaskGetNumberOfTasks( void ); +BaseType_t MPU_xTaskResumeAll( void ); +TickType_t MPU_xTaskGetTickCount( void ); +UBaseType_t MPU_uxTaskGetNumberOfTasks( void ); void MPU_vTaskList( char *pcWriteBuffer ); void MPU_vTaskGetRunTimeStats( char *pcWriteBuffer ); -void MPU_vTaskSetApplicationTaskTag( xTaskHandle xTask, pdTASK_HOOK_CODE pxTagValue ); -pdTASK_HOOK_CODE MPU_xTaskGetApplicationTaskTag( xTaskHandle xTask ); -portBASE_TYPE MPU_xTaskCallApplicationTaskHook( xTaskHandle xTask, void *pvParameter ); -unsigned portBASE_TYPE MPU_uxTaskGetStackHighWaterMark( xTaskHandle xTask ); -xTaskHandle MPU_xTaskGetCurrentTaskHandle( void ); -portBASE_TYPE MPU_xTaskGetSchedulerState( void ); -xTaskHandle MPU_xTaskGetIdleTaskHandle( void ); -unsigned portBASE_TYPE MPU_uxTaskGetSystemState( xTaskStatusType *pxTaskStatusArray, unsigned portBASE_TYPE uxArraySize, unsigned long *pulTotalRunTime ); -xQueueHandle MPU_xQueueGenericCreate( unsigned portBASE_TYPE uxQueueLength, unsigned portBASE_TYPE uxItemSize, unsigned char ucQueueType ); -signed portBASE_TYPE MPU_xQueueGenericSend( xQueueHandle xQueue, const void * const pvItemToQueue, portTickType xTicksToWait, portBASE_TYPE xCopyPosition ); -portBASE_TYPE MPU_xQueueGenericReset( xQueueHandle pxQueue, portBASE_TYPE xNewQueue ); -unsigned portBASE_TYPE MPU_uxQueueMessagesWaiting( const xQueueHandle pxQueue ); -signed portBASE_TYPE MPU_xQueueGenericReceive( xQueueHandle pxQueue, void * const pvBuffer, portTickType xTicksToWait, portBASE_TYPE xJustPeeking ); -xQueueHandle MPU_xQueueCreateMutex( void ); -xQueueHandle MPU_xQueueCreateCountingSemaphore( unsigned portBASE_TYPE uxCountValue, unsigned portBASE_TYPE uxInitialCount ); -portBASE_TYPE MPU_xQueueTakeMutexRecursive( xQueueHandle xMutex, portTickType xBlockTime ); -portBASE_TYPE MPU_xQueueGiveMutexRecursive( xQueueHandle xMutex ); -signed portBASE_TYPE MPU_xQueueAltGenericSend( xQueueHandle pxQueue, const void * const pvItemToQueue, portTickType xTicksToWait, portBASE_TYPE xCopyPosition ); -signed portBASE_TYPE MPU_xQueueAltGenericReceive( xQueueHandle pxQueue, void * const pvBuffer, portTickType xTicksToWait, portBASE_TYPE xJustPeeking ); -void MPU_vQueueAddToRegistry( xQueueHandle xQueue, char *pcName ); -void MPU_vQueueDelete( xQueueHandle xQueue ); +void MPU_vTaskSetApplicationTaskTag( TaskHandle_t xTask, pdTASK_HOOK_CODE pxTagValue ); +pdTASK_HOOK_CODE MPU_xTaskGetApplicationTaskTag( TaskHandle_t xTask ); +BaseType_t MPU_xTaskCallApplicationTaskHook( TaskHandle_t xTask, void *pvParameter ); +UBaseType_t MPU_uxTaskGetStackHighWaterMark( TaskHandle_t xTask ); +TaskHandle_t MPU_xTaskGetCurrentTaskHandle( void ); +BaseType_t MPU_xTaskGetSchedulerState( void ); +TaskHandle_t MPU_xTaskGetIdleTaskHandle( void ); +UBaseType_t MPU_uxTaskGetSystemState( TaskStatus_t *pxTaskStatusArray, UBaseType_t uxArraySize, uint32_t *pulTotalRunTime ); +QueueHandle_t MPU_xQueueGenericCreate( UBaseType_t uxQueueLength, UBaseType_t uxItemSize, uint8_t ucQueueType ); +BaseType_t MPU_xQueueGenericSend( QueueHandle_t xQueue, const void * const pvItemToQueue, TickType_t xTicksToWait, BaseType_t xCopyPosition ); +BaseType_t MPU_xQueueGenericReset( QueueHandle_t pxQueue, BaseType_t xNewQueue ); +UBaseType_t MPU_uxQueueMessagesWaiting( const QueueHandle_t pxQueue ); +BaseType_t MPU_xQueueGenericReceive( QueueHandle_t pxQueue, void * const pvBuffer, TickType_t xTicksToWait, BaseType_t xJustPeeking ); +QueueHandle_t MPU_xQueueCreateMutex( void ); +QueueHandle_t MPU_xQueueCreateCountingSemaphore( UBaseType_t uxCountValue, UBaseType_t uxInitialCount ); +BaseType_t MPU_xQueueTakeMutexRecursive( QueueHandle_t xMutex, TickType_t xBlockTime ); +BaseType_t MPU_xQueueGiveMutexRecursive( QueueHandle_t xMutex ); +BaseType_t MPU_xQueueAltGenericSend( QueueHandle_t pxQueue, const void * const pvItemToQueue, TickType_t xTicksToWait, BaseType_t xCopyPosition ); +BaseType_t MPU_xQueueAltGenericReceive( QueueHandle_t pxQueue, void * const pvBuffer, TickType_t xTicksToWait, BaseType_t xJustPeeking ); +void MPU_vQueueAddToRegistry( QueueHandle_t xQueue, char *pcName ); +void MPU_vQueueDelete( QueueHandle_t xQueue ); void *MPU_pvPortMalloc( size_t xSize ); void MPU_vPortFree( void *pv ); void MPU_vPortInitialiseBlocks( void ); size_t MPU_xPortGetFreeHeapSize( void ); -xQueueSetHandle MPU_xQueueCreateSet( unsigned portBASE_TYPE uxEventQueueLength ); -xQueueSetMemberHandle MPU_xQueueSelectFromSet( xQueueSetHandle xQueueSet, portTickType xBlockTimeTicks ); -portBASE_TYPE MPU_xQueueAddToSet( xQueueSetMemberHandle xQueueOrSemaphore, xQueueSetHandle xQueueSet ); -portBASE_TYPE MPU_xQueueRemoveFromSet( xQueueSetMemberHandle xQueueOrSemaphore, xQueueSetHandle xQueueSet ); -signed portBASE_TYPE MPU_xQueuePeekFromISR( xQueueHandle xQueue, void * const pvBuffer ); +QueueSetHandle_t MPU_xQueueCreateSet( UBaseType_t uxEventQueueLength ); +QueueSetMember_t MPU_xQueueSelectFromSet( QueueSetHandle_t xQueueSet, TickType_t xBlockTimeTicks ); +BaseType_t MPU_xQueueAddToSet( QueueSetMember_t xQueueOrSemaphore, QueueSetHandle_t xQueueSet ); +BaseType_t MPU_xQueueRemoveFromSet( QueueSetMember_t xQueueOrSemaphore, QueueSetHandle_t xQueueSet ); +BaseType_t MPU_xQueuePeekFromISR( QueueHandle_t xQueue, void * const pvBuffer ); /*-----------------------------------------------------------*/ /* * See header file for description. */ -portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters, portBASE_TYPE xRunPrivileged ) +StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters, BaseType_t xRunPrivileged ) { /* Simulate the stack frame as it would be created by a context switch interrupt. */ pxTopOfStack--; /* Offset added to account for the way the MCU uses the stack on entry/exit of interrupts. */ *pxTopOfStack = portINITIAL_XPSR; /* xPSR */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) pxCode; /* PC */ + *pxTopOfStack = ( StackType_t ) pxCode; /* PC */ pxTopOfStack--; *pxTopOfStack = 0; /* LR */ pxTopOfStack -= 5; /* R12, R3, R2 and R1. */ - *pxTopOfStack = ( portSTACK_TYPE ) pvParameters; /* R0 */ + *pxTopOfStack = ( StackType_t ) pvParameters; /* R0 */ pxTopOfStack -= 9; /* R11, R10, R9, R8, R7, R6, R5 and R4. */ if( xRunPrivileged == pdTRUE ) @@ -269,13 +269,13 @@ void vPortSVCHandler( void ) } /*-----------------------------------------------------------*/ -static void prvSVCHandler( unsigned long *pulParam ) +static void prvSVCHandler( uint32_t *pulParam ) { -unsigned char ucSVCNumber; +uint8_t ucSVCNumber; /* The stack contains: r0, r1, r2, r3, r12, r14, the return address and xPSR. The first argument (r0) is pulParam[ 0 ]. */ - ucSVCNumber = ( ( unsigned char * ) pulParam[ portOFFSET_TO_PC ] )[ -2 ]; + ucSVCNumber = ( ( uint8_t * ) pulParam[ portOFFSET_TO_PC ] )[ -2 ]; switch( ucSVCNumber ) { case portSVC_START_SCHEDULER : *(portNVIC_SYSPRI1) |= portNVIC_SVC_PRI; @@ -339,7 +339,7 @@ static void prvRestoreContextOfFirstTask( void ) /* * See header file for description. */ -portBASE_TYPE xPortStartScheduler( void ) +BaseType_t xPortStartScheduler( void ) { /* configMAX_SYSCALL_INTERRUPT_PRIORITY must not be set to 0. See http://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html */ @@ -378,7 +378,7 @@ void vPortEndScheduler( void ) void vPortEnterCritical( void ) { -portBASE_TYPE xRunningPrivileged = prvRaisePrivilege(); +BaseType_t xRunningPrivileged = prvRaisePrivilege(); portDISABLE_INTERRUPTS(); uxCriticalNesting++; @@ -389,7 +389,7 @@ portBASE_TYPE xRunningPrivileged = prvRaisePrivilege(); void vPortExitCritical( void ) { -portBASE_TYPE xRunningPrivileged = prvRaisePrivilege(); +BaseType_t xRunningPrivileged = prvRaisePrivilege(); configASSERT( uxCriticalNesting ); uxCriticalNesting--; @@ -445,7 +445,7 @@ void xPortPendSVHandler( void ) void xPortSysTickHandler( void ) { -unsigned long ulDummy; +uint32_t ulDummy; ulDummy = portSET_INTERRUPT_MASK_FROM_ISR(); { @@ -474,46 +474,46 @@ static void prvSetupTimerInterrupt( void ) static void prvSetupMPU( void ) { -extern unsigned long __privileged_functions_end__[]; -extern unsigned long __FLASH_segment_start__[]; -extern unsigned long __FLASH_segment_end__[]; -extern unsigned long __privileged_data_start__[]; -extern unsigned long __privileged_data_end__[]; +extern uint32_t __privileged_functions_end__[]; +extern uint32_t __FLASH_segment_start__[]; +extern uint32_t __FLASH_segment_end__[]; +extern uint32_t __privileged_data_start__[]; +extern uint32_t __privileged_data_end__[]; /* Check the expected MPU is present. */ if( *portMPU_TYPE == portEXPECTED_MPU_TYPE_VALUE ) { /* First setup the entire flash for unprivileged read only access. */ - *portMPU_REGION_BASE_ADDRESS = ( ( unsigned long ) __FLASH_segment_start__ ) | /* Base address. */ + *portMPU_REGION_BASE_ADDRESS = ( ( uint32_t ) __FLASH_segment_start__ ) | /* Base address. */ ( portMPU_REGION_VALID ) | ( portUNPRIVILEGED_FLASH_REGION ); *portMPU_REGION_ATTRIBUTE = ( portMPU_REGION_READ_ONLY ) | ( portMPU_REGION_CACHEABLE_BUFFERABLE ) | - ( prvGetMPURegionSizeSetting( ( unsigned long ) __FLASH_segment_end__ - ( unsigned long ) __FLASH_segment_start__ ) ) | + ( prvGetMPURegionSizeSetting( ( uint32_t ) __FLASH_segment_end__ - ( uint32_t ) __FLASH_segment_start__ ) ) | ( portMPU_REGION_ENABLE ); /* Setup the first 16K for privileged only access (even though less than 10K is actually being used). This is where the kernel code is placed. */ - *portMPU_REGION_BASE_ADDRESS = ( ( unsigned long ) __FLASH_segment_start__ ) | /* Base address. */ + *portMPU_REGION_BASE_ADDRESS = ( ( uint32_t ) __FLASH_segment_start__ ) | /* Base address. */ ( portMPU_REGION_VALID ) | ( portPRIVILEGED_FLASH_REGION ); *portMPU_REGION_ATTRIBUTE = ( portMPU_REGION_PRIVILEGED_READ_ONLY ) | ( portMPU_REGION_CACHEABLE_BUFFERABLE ) | - ( prvGetMPURegionSizeSetting( ( unsigned long ) __privileged_functions_end__ - ( unsigned long ) __FLASH_segment_start__ ) ) | + ( prvGetMPURegionSizeSetting( ( uint32_t ) __privileged_functions_end__ - ( uint32_t ) __FLASH_segment_start__ ) ) | ( portMPU_REGION_ENABLE ); /* Setup the privileged data RAM region. This is where the kernel data is placed. */ - *portMPU_REGION_BASE_ADDRESS = ( ( unsigned long ) __privileged_data_start__ ) | /* Base address. */ + *portMPU_REGION_BASE_ADDRESS = ( ( uint32_t ) __privileged_data_start__ ) | /* Base address. */ ( portMPU_REGION_VALID ) | ( portPRIVILEGED_RAM_REGION ); *portMPU_REGION_ATTRIBUTE = ( portMPU_REGION_PRIVILEGED_READ_WRITE ) | ( portMPU_REGION_CACHEABLE_BUFFERABLE ) | - prvGetMPURegionSizeSetting( ( unsigned long ) __privileged_data_end__ - ( unsigned long ) __privileged_data_start__ ) | + prvGetMPURegionSizeSetting( ( uint32_t ) __privileged_data_end__ - ( uint32_t ) __privileged_data_start__ ) | ( portMPU_REGION_ENABLE ); /* By default allow everything to access the general peripherals. The @@ -535,9 +535,9 @@ extern unsigned long __privileged_data_end__[]; } /*-----------------------------------------------------------*/ -static unsigned long prvGetMPURegionSizeSetting( unsigned long ulActualSizeInBytes ) +static uint32_t prvGetMPURegionSizeSetting( uint32_t ulActualSizeInBytes ) { -unsigned long ulRegionSize, ulReturnValue = 4; +uint32_t ulRegionSize, ulReturnValue = 4; /* 32 is the smallest region size, 31 is the largest valid value for ulReturnValue. */ @@ -559,7 +559,7 @@ unsigned long ulRegionSize, ulReturnValue = 4; } /*-----------------------------------------------------------*/ -static portBASE_TYPE prvRaisePrivilege( void ) +static BaseType_t prvRaisePrivilege( void ) { __asm volatile ( @@ -577,40 +577,40 @@ static portBASE_TYPE prvRaisePrivilege( void ) } /*-----------------------------------------------------------*/ -void vPortStoreTaskMPUSettings( xMPU_SETTINGS *xMPUSettings, const struct xMEMORY_REGION * const xRegions, portSTACK_TYPE *pxBottomOfStack, unsigned short usStackDepth ) +void vPortStoreTaskMPUSettings( xMPU_SETTINGS *xMPUSettings, const struct xMEMORY_REGION * const xRegions, StackType_t *pxBottomOfStack, uint16_t usStackDepth ) { -extern unsigned long __SRAM_segment_start__[]; -extern unsigned long __SRAM_segment_end__[]; -extern unsigned long __privileged_data_start__[]; -extern unsigned long __privileged_data_end__[]; -long lIndex; -unsigned long ul; +extern uint32_t __SRAM_segment_start__[]; +extern uint32_t __SRAM_segment_end__[]; +extern uint32_t __privileged_data_start__[]; +extern uint32_t __privileged_data_end__[]; +int32_t lIndex; +uint32_t ul; if( xRegions == NULL ) { /* No MPU regions are specified so allow access to all RAM. */ xMPUSettings->xRegion[ 0 ].ulRegionBaseAddress = - ( ( unsigned long ) __SRAM_segment_start__ ) | /* Base address. */ + ( ( uint32_t ) __SRAM_segment_start__ ) | /* Base address. */ ( portMPU_REGION_VALID ) | ( portSTACK_REGION ); xMPUSettings->xRegion[ 0 ].ulRegionAttribute = ( portMPU_REGION_READ_WRITE ) | ( portMPU_REGION_CACHEABLE_BUFFERABLE ) | - ( prvGetMPURegionSizeSetting( ( unsigned long ) __SRAM_segment_end__ - ( unsigned long ) __SRAM_segment_start__ ) ) | + ( prvGetMPURegionSizeSetting( ( uint32_t ) __SRAM_segment_end__ - ( uint32_t ) __SRAM_segment_start__ ) ) | ( portMPU_REGION_ENABLE ); /* Re-instate the privileged only RAM region as xRegion[ 0 ] will have just removed the privileged only parameters. */ xMPUSettings->xRegion[ 1 ].ulRegionBaseAddress = - ( ( unsigned long ) __privileged_data_start__ ) | /* Base address. */ + ( ( uint32_t ) __privileged_data_start__ ) | /* Base address. */ ( portMPU_REGION_VALID ) | ( portSTACK_REGION + 1 ); xMPUSettings->xRegion[ 1 ].ulRegionAttribute = ( portMPU_REGION_PRIVILEGED_READ_WRITE ) | ( portMPU_REGION_CACHEABLE_BUFFERABLE ) | - prvGetMPURegionSizeSetting( ( unsigned long ) __privileged_data_end__ - ( unsigned long ) __privileged_data_start__ ) | + prvGetMPURegionSizeSetting( ( uint32_t ) __privileged_data_end__ - ( uint32_t ) __privileged_data_start__ ) | ( portMPU_REGION_ENABLE ); /* Invalidate all other regions. */ @@ -630,13 +630,13 @@ unsigned long ul; { /* Define the region that allows access to the stack. */ xMPUSettings->xRegion[ 0 ].ulRegionBaseAddress = - ( ( unsigned long ) pxBottomOfStack ) | + ( ( uint32_t ) pxBottomOfStack ) | ( portMPU_REGION_VALID ) | ( portSTACK_REGION ); /* Region number. */ xMPUSettings->xRegion[ 0 ].ulRegionAttribute = ( portMPU_REGION_READ_WRITE ) | /* Read and write. */ - ( prvGetMPURegionSizeSetting( ( unsigned long ) usStackDepth * ( unsigned long ) sizeof( portSTACK_TYPE ) ) ) | + ( prvGetMPURegionSizeSetting( ( uint32_t ) usStackDepth * ( uint32_t ) sizeof( StackType_t ) ) ) | ( portMPU_REGION_CACHEABLE_BUFFERABLE ) | ( portMPU_REGION_ENABLE ); } @@ -651,7 +651,7 @@ unsigned long ul; xRegions into the CM3 specific MPU settings that are then stored in xMPUSettings. */ xMPUSettings->xRegion[ ul ].ulRegionBaseAddress = - ( ( unsigned long ) xRegions[ lIndex ].pvBaseAddress ) | + ( ( uint32_t ) xRegions[ lIndex ].pvBaseAddress ) | ( portMPU_REGION_VALID ) | ( portSTACK_REGION + ul ); /* Region number. */ @@ -673,10 +673,10 @@ unsigned long ul; } /*-----------------------------------------------------------*/ -signed portBASE_TYPE MPU_xTaskGenericCreate( pdTASK_CODE pvTaskCode, const char * const pcName, unsigned short usStackDepth, void *pvParameters, unsigned portBASE_TYPE uxPriority, xTaskHandle *pxCreatedTask, portSTACK_TYPE *puxStackBuffer, const xMemoryRegion * const xRegions ) +BaseType_t MPU_xTaskGenericCreate( pdTASK_CODE pvTaskCode, const char * const pcName, uint16_t usStackDepth, void *pvParameters, UBaseType_t uxPriority, TaskHandle_t *pxCreatedTask, StackType_t *puxStackBuffer, const MemoryRegion_t * const xRegions ) { -signed portBASE_TYPE xReturn; -portBASE_TYPE xRunningPrivileged = prvRaisePrivilege(); +BaseType_t xReturn; +BaseType_t xRunningPrivileged = prvRaisePrivilege(); xReturn = xTaskGenericCreate( pvTaskCode, pcName, usStackDepth, pvParameters, uxPriority, pxCreatedTask, puxStackBuffer, xRegions ); portRESET_PRIVILEGE( xRunningPrivileged ); @@ -684,9 +684,9 @@ portBASE_TYPE xRunningPrivileged = prvRaisePrivilege(); } /*-----------------------------------------------------------*/ -void MPU_vTaskAllocateMPURegions( xTaskHandle xTask, const xMemoryRegion * const xRegions ) +void MPU_vTaskAllocateMPURegions( TaskHandle_t xTask, const MemoryRegion_t * const xRegions ) { -portBASE_TYPE xRunningPrivileged = prvRaisePrivilege(); +BaseType_t xRunningPrivileged = prvRaisePrivilege(); vTaskAllocateMPURegions( xTask, xRegions ); portRESET_PRIVILEGE( xRunningPrivileged ); @@ -694,9 +694,9 @@ portBASE_TYPE xRunningPrivileged = prvRaisePrivilege(); /*-----------------------------------------------------------*/ #if ( INCLUDE_vTaskDelete == 1 ) - void MPU_vTaskDelete( xTaskHandle pxTaskToDelete ) + void MPU_vTaskDelete( TaskHandle_t pxTaskToDelete ) { - portBASE_TYPE xRunningPrivileged = prvRaisePrivilege(); + BaseType_t xRunningPrivileged = prvRaisePrivilege(); vTaskDelete( pxTaskToDelete ); portRESET_PRIVILEGE( xRunningPrivileged ); @@ -705,9 +705,9 @@ portBASE_TYPE xRunningPrivileged = prvRaisePrivilege(); /*-----------------------------------------------------------*/ #if ( INCLUDE_vTaskDelayUntil == 1 ) - void MPU_vTaskDelayUntil( portTickType * const pxPreviousWakeTime, portTickType xTimeIncrement ) + void MPU_vTaskDelayUntil( TickType_t * const pxPreviousWakeTime, TickType_t xTimeIncrement ) { - portBASE_TYPE xRunningPrivileged = prvRaisePrivilege(); + BaseType_t xRunningPrivileged = prvRaisePrivilege(); vTaskDelayUntil( pxPreviousWakeTime, xTimeIncrement ); portRESET_PRIVILEGE( xRunningPrivileged ); @@ -716,9 +716,9 @@ portBASE_TYPE xRunningPrivileged = prvRaisePrivilege(); /*-----------------------------------------------------------*/ #if ( INCLUDE_vTaskDelay == 1 ) - void MPU_vTaskDelay( portTickType xTicksToDelay ) + void MPU_vTaskDelay( TickType_t xTicksToDelay ) { - portBASE_TYPE xRunningPrivileged = prvRaisePrivilege(); + BaseType_t xRunningPrivileged = prvRaisePrivilege(); vTaskDelay( xTicksToDelay ); portRESET_PRIVILEGE( xRunningPrivileged ); @@ -727,10 +727,10 @@ portBASE_TYPE xRunningPrivileged = prvRaisePrivilege(); /*-----------------------------------------------------------*/ #if ( INCLUDE_uxTaskPriorityGet == 1 ) - unsigned portBASE_TYPE MPU_uxTaskPriorityGet( xTaskHandle pxTask ) + UBaseType_t MPU_uxTaskPriorityGet( TaskHandle_t pxTask ) { - unsigned portBASE_TYPE uxReturn; - portBASE_TYPE xRunningPrivileged = prvRaisePrivilege(); + UBaseType_t uxReturn; + BaseType_t xRunningPrivileged = prvRaisePrivilege(); uxReturn = uxTaskPriorityGet( pxTask ); portRESET_PRIVILEGE( xRunningPrivileged ); @@ -740,9 +740,9 @@ portBASE_TYPE xRunningPrivileged = prvRaisePrivilege(); /*-----------------------------------------------------------*/ #if ( INCLUDE_vTaskPrioritySet == 1 ) - void MPU_vTaskPrioritySet( xTaskHandle pxTask, unsigned portBASE_TYPE uxNewPriority ) + void MPU_vTaskPrioritySet( TaskHandle_t pxTask, UBaseType_t uxNewPriority ) { - portBASE_TYPE xRunningPrivileged = prvRaisePrivilege(); + BaseType_t xRunningPrivileged = prvRaisePrivilege(); vTaskPrioritySet( pxTask, uxNewPriority ); portRESET_PRIVILEGE( xRunningPrivileged ); @@ -751,9 +751,9 @@ portBASE_TYPE xRunningPrivileged = prvRaisePrivilege(); /*-----------------------------------------------------------*/ #if ( INCLUDE_eTaskGetState == 1 ) - eTaskState MPU_eTaskGetState( xTaskHandle pxTask ) + eTaskState MPU_eTaskGetState( TaskHandle_t pxTask ) { - portBASE_TYPE xRunningPrivileged = prvRaisePrivilege(); + BaseType_t xRunningPrivileged = prvRaisePrivilege(); eTaskState eReturn; eReturn = eTaskGetState( pxTask ); @@ -764,10 +764,10 @@ portBASE_TYPE xRunningPrivileged = prvRaisePrivilege(); /*-----------------------------------------------------------*/ #if ( INCLUDE_xTaskGetIdleTaskHandle == 1 ) - xTaskHandle MPU_xTaskGetIdleTaskHandle( void ) + TaskHandle_t MPU_xTaskGetIdleTaskHandle( void ) { - xTaskHandle xReturn; - portBASE_TYPE xRunningPrivileged = prvRaisePrivilege(); + TaskHandle_t xReturn; + BaseType_t xRunningPrivileged = prvRaisePrivilege(); xReturn = xTaskGetIdleTaskHandle(); portRESET_PRIVILEGE( xRunningPrivileged ); @@ -777,9 +777,9 @@ portBASE_TYPE xRunningPrivileged = prvRaisePrivilege(); /*-----------------------------------------------------------*/ #if ( INCLUDE_vTaskSuspend == 1 ) - void MPU_vTaskSuspend( xTaskHandle pxTaskToSuspend ) + void MPU_vTaskSuspend( TaskHandle_t pxTaskToSuspend ) { - portBASE_TYPE xRunningPrivileged = prvRaisePrivilege(); + BaseType_t xRunningPrivileged = prvRaisePrivilege(); vTaskSuspend( pxTaskToSuspend ); portRESET_PRIVILEGE( xRunningPrivileged ); @@ -788,10 +788,10 @@ portBASE_TYPE xRunningPrivileged = prvRaisePrivilege(); /*-----------------------------------------------------------*/ #if ( INCLUDE_vTaskSuspend == 1 ) - signed portBASE_TYPE MPU_xTaskIsTaskSuspended( xTaskHandle xTask ) + BaseType_t MPU_xTaskIsTaskSuspended( TaskHandle_t xTask ) { - signed portBASE_TYPE xReturn; - portBASE_TYPE xRunningPrivileged = prvRaisePrivilege(); + BaseType_t xReturn; + BaseType_t xRunningPrivileged = prvRaisePrivilege(); xReturn = xTaskIsTaskSuspended( xTask ); portRESET_PRIVILEGE( xRunningPrivileged ); @@ -801,9 +801,9 @@ portBASE_TYPE xRunningPrivileged = prvRaisePrivilege(); /*-----------------------------------------------------------*/ #if ( INCLUDE_vTaskSuspend == 1 ) - void MPU_vTaskResume( xTaskHandle pxTaskToResume ) + void MPU_vTaskResume( TaskHandle_t pxTaskToResume ) { - portBASE_TYPE xRunningPrivileged = prvRaisePrivilege(); + BaseType_t xRunningPrivileged = prvRaisePrivilege(); vTaskResume( pxTaskToResume ); portRESET_PRIVILEGE( xRunningPrivileged ); @@ -813,17 +813,17 @@ portBASE_TYPE xRunningPrivileged = prvRaisePrivilege(); void MPU_vTaskSuspendAll( void ) { -portBASE_TYPE xRunningPrivileged = prvRaisePrivilege(); +BaseType_t xRunningPrivileged = prvRaisePrivilege(); vTaskSuspendAll(); portRESET_PRIVILEGE( xRunningPrivileged ); } /*-----------------------------------------------------------*/ -signed portBASE_TYPE MPU_xTaskResumeAll( void ) +BaseType_t MPU_xTaskResumeAll( void ) { -signed portBASE_TYPE xReturn; -portBASE_TYPE xRunningPrivileged = prvRaisePrivilege(); +BaseType_t xReturn; +BaseType_t xRunningPrivileged = prvRaisePrivilege(); xReturn = xTaskResumeAll(); portRESET_PRIVILEGE( xRunningPrivileged ); @@ -831,10 +831,10 @@ portBASE_TYPE xRunningPrivileged = prvRaisePrivilege(); } /*-----------------------------------------------------------*/ -portTickType MPU_xTaskGetTickCount( void ) +TickType_t MPU_xTaskGetTickCount( void ) { -portTickType xReturn; -portBASE_TYPE xRunningPrivileged = prvRaisePrivilege(); +TickType_t xReturn; +BaseType_t xRunningPrivileged = prvRaisePrivilege(); xReturn = xTaskGetTickCount(); portRESET_PRIVILEGE( xRunningPrivileged ); @@ -842,10 +842,10 @@ portBASE_TYPE xRunningPrivileged = prvRaisePrivilege(); } /*-----------------------------------------------------------*/ -unsigned portBASE_TYPE MPU_uxTaskGetNumberOfTasks( void ) +UBaseType_t MPU_uxTaskGetNumberOfTasks( void ) { -unsigned portBASE_TYPE uxReturn; -portBASE_TYPE xRunningPrivileged = prvRaisePrivilege(); +UBaseType_t uxReturn; +BaseType_t xRunningPrivileged = prvRaisePrivilege(); uxReturn = uxTaskGetNumberOfTasks(); portRESET_PRIVILEGE( xRunningPrivileged ); @@ -856,7 +856,7 @@ portBASE_TYPE xRunningPrivileged = prvRaisePrivilege(); #if ( configUSE_TRACE_FACILITY == 1 ) void MPU_vTaskList( char *pcWriteBuffer ) { - portBASE_TYPE xRunningPrivileged = prvRaisePrivilege(); + BaseType_t xRunningPrivileged = prvRaisePrivilege(); vTaskList( pcWriteBuffer ); portRESET_PRIVILEGE( xRunningPrivileged ); @@ -867,7 +867,7 @@ portBASE_TYPE xRunningPrivileged = prvRaisePrivilege(); #if ( configGENERATE_RUN_TIME_STATS == 1 ) void MPU_vTaskGetRunTimeStats( char *pcWriteBuffer ) { - portBASE_TYPE xRunningPrivileged = prvRaisePrivilege(); + BaseType_t xRunningPrivileged = prvRaisePrivilege(); vTaskGetRunTimeStats( pcWriteBuffer ); portRESET_PRIVILEGE( xRunningPrivileged ); @@ -876,9 +876,9 @@ portBASE_TYPE xRunningPrivileged = prvRaisePrivilege(); /*-----------------------------------------------------------*/ #if ( configUSE_APPLICATION_TASK_TAG == 1 ) - void MPU_vTaskSetApplicationTaskTag( xTaskHandle xTask, pdTASK_HOOK_CODE pxTagValue ) + void MPU_vTaskSetApplicationTaskTag( TaskHandle_t xTask, pdTASK_HOOK_CODE pxTagValue ) { - portBASE_TYPE xRunningPrivileged = prvRaisePrivilege(); + BaseType_t xRunningPrivileged = prvRaisePrivilege(); vTaskSetApplicationTaskTag( xTask, pxTagValue ); portRESET_PRIVILEGE( xRunningPrivileged ); @@ -887,10 +887,10 @@ portBASE_TYPE xRunningPrivileged = prvRaisePrivilege(); /*-----------------------------------------------------------*/ #if ( configUSE_APPLICATION_TASK_TAG == 1 ) - pdTASK_HOOK_CODE MPU_xTaskGetApplicationTaskTag( xTaskHandle xTask ) + pdTASK_HOOK_CODE MPU_xTaskGetApplicationTaskTag( TaskHandle_t xTask ) { pdTASK_HOOK_CODE xReturn; - portBASE_TYPE xRunningPrivileged = prvRaisePrivilege(); + BaseType_t xRunningPrivileged = prvRaisePrivilege(); xReturn = xTaskGetApplicationTaskTag( xTask ); portRESET_PRIVILEGE( xRunningPrivileged ); @@ -900,10 +900,10 @@ portBASE_TYPE xRunningPrivileged = prvRaisePrivilege(); /*-----------------------------------------------------------*/ #if ( configUSE_APPLICATION_TASK_TAG == 1 ) - portBASE_TYPE MPU_xTaskCallApplicationTaskHook( xTaskHandle xTask, void *pvParameter ) + BaseType_t MPU_xTaskCallApplicationTaskHook( TaskHandle_t xTask, void *pvParameter ) { - portBASE_TYPE xReturn; - portBASE_TYPE xRunningPrivileged = prvRaisePrivilege(); + BaseType_t xReturn; + BaseType_t xRunningPrivileged = prvRaisePrivilege(); xReturn = xTaskCallApplicationTaskHook( xTask, pvParameter ); portRESET_PRIVILEGE( xRunningPrivileged ); @@ -913,10 +913,10 @@ portBASE_TYPE xRunningPrivileged = prvRaisePrivilege(); /*-----------------------------------------------------------*/ #if ( configUSE_TRACE_FACILITY == 1 ) - unsigned portBASE_TYPE MPU_uxTaskGetSystemState( xTaskStatusType *pxTaskStatusArray, unsigned portBASE_TYPE uxArraySize, unsigned long *pulTotalRunTime ) + UBaseType_t MPU_uxTaskGetSystemState( TaskStatus_t *pxTaskStatusArray, UBaseType_t uxArraySize, uint32_t *pulTotalRunTime ) { - unsigned portBASE_TYPE uxReturn; - portBASE_TYPE xRunningPrivileged = prvRaisePrivilege(); + UBaseType_t uxReturn; + BaseType_t xRunningPrivileged = prvRaisePrivilege(); uxReturn = uxTaskGetSystemState( pxTaskStatusArray, uxArraySize, pulTotalRunTime ); portRESET_PRIVILEGE( xRunningPrivileged ); @@ -926,10 +926,10 @@ portBASE_TYPE xRunningPrivileged = prvRaisePrivilege(); /*-----------------------------------------------------------*/ #if ( INCLUDE_uxTaskGetStackHighWaterMark == 1 ) - unsigned portBASE_TYPE MPU_uxTaskGetStackHighWaterMark( xTaskHandle xTask ) + UBaseType_t MPU_uxTaskGetStackHighWaterMark( TaskHandle_t xTask ) { - unsigned portBASE_TYPE uxReturn; - portBASE_TYPE xRunningPrivileged = prvRaisePrivilege(); + UBaseType_t uxReturn; + BaseType_t xRunningPrivileged = prvRaisePrivilege(); uxReturn = uxTaskGetStackHighWaterMark( xTask ); portRESET_PRIVILEGE( xRunningPrivileged ); @@ -939,10 +939,10 @@ portBASE_TYPE xRunningPrivileged = prvRaisePrivilege(); /*-----------------------------------------------------------*/ #if ( INCLUDE_xTaskGetCurrentTaskHandle == 1 ) - xTaskHandle MPU_xTaskGetCurrentTaskHandle( void ) + TaskHandle_t MPU_xTaskGetCurrentTaskHandle( void ) { - xTaskHandle xReturn; - portBASE_TYPE xRunningPrivileged = prvRaisePrivilege(); + TaskHandle_t xReturn; + BaseType_t xRunningPrivileged = prvRaisePrivilege(); xReturn = xTaskGetCurrentTaskHandle(); portRESET_PRIVILEGE( xRunningPrivileged ); @@ -952,10 +952,10 @@ portBASE_TYPE xRunningPrivileged = prvRaisePrivilege(); /*-----------------------------------------------------------*/ #if ( INCLUDE_xTaskGetSchedulerState == 1 ) - portBASE_TYPE MPU_xTaskGetSchedulerState( void ) + BaseType_t MPU_xTaskGetSchedulerState( void ) { - portBASE_TYPE xReturn; - portBASE_TYPE xRunningPrivileged = prvRaisePrivilege(); + BaseType_t xReturn; + BaseType_t xRunningPrivileged = prvRaisePrivilege(); xReturn = xTaskGetSchedulerState(); portRESET_PRIVILEGE( xRunningPrivileged ); @@ -964,10 +964,10 @@ portBASE_TYPE xRunningPrivileged = prvRaisePrivilege(); #endif /*-----------------------------------------------------------*/ -xQueueHandle MPU_xQueueGenericCreate( unsigned portBASE_TYPE uxQueueLength, unsigned portBASE_TYPE uxItemSize, unsigned char ucQueueType ) +QueueHandle_t MPU_xQueueGenericCreate( UBaseType_t uxQueueLength, UBaseType_t uxItemSize, uint8_t ucQueueType ) { -xQueueHandle xReturn; -portBASE_TYPE xRunningPrivileged = prvRaisePrivilege(); +QueueHandle_t xReturn; +BaseType_t xRunningPrivileged = prvRaisePrivilege(); xReturn = xQueueGenericCreate( uxQueueLength, uxItemSize, ucQueueType ); portRESET_PRIVILEGE( xRunningPrivileged ); @@ -975,10 +975,10 @@ portBASE_TYPE xRunningPrivileged = prvRaisePrivilege(); } /*-----------------------------------------------------------*/ -portBASE_TYPE MPU_xQueueGenericReset( xQueueHandle pxQueue, portBASE_TYPE xNewQueue ) +BaseType_t MPU_xQueueGenericReset( QueueHandle_t pxQueue, BaseType_t xNewQueue ) { -portBASE_TYPE xReturn; -portBASE_TYPE xRunningPrivileged = prvRaisePrivilege(); +BaseType_t xReturn; +BaseType_t xRunningPrivileged = prvRaisePrivilege(); xReturn = xQueueGenericReset( pxQueue, xNewQueue ); portRESET_PRIVILEGE( xRunningPrivileged ); @@ -986,10 +986,10 @@ portBASE_TYPE xRunningPrivileged = prvRaisePrivilege(); } /*-----------------------------------------------------------*/ -signed portBASE_TYPE MPU_xQueueGenericSend( xQueueHandle xQueue, const void * const pvItemToQueue, portTickType xTicksToWait, portBASE_TYPE xCopyPosition ) +BaseType_t MPU_xQueueGenericSend( QueueHandle_t xQueue, const void * const pvItemToQueue, TickType_t xTicksToWait, BaseType_t xCopyPosition ) { -signed portBASE_TYPE xReturn; -portBASE_TYPE xRunningPrivileged = prvRaisePrivilege(); +BaseType_t xReturn; +BaseType_t xRunningPrivileged = prvRaisePrivilege(); xReturn = xQueueGenericSend( xQueue, pvItemToQueue, xTicksToWait, xCopyPosition ); portRESET_PRIVILEGE( xRunningPrivileged ); @@ -997,10 +997,10 @@ portBASE_TYPE xRunningPrivileged = prvRaisePrivilege(); } /*-----------------------------------------------------------*/ -unsigned portBASE_TYPE MPU_uxQueueMessagesWaiting( const xQueueHandle pxQueue ) +UBaseType_t MPU_uxQueueMessagesWaiting( const QueueHandle_t pxQueue ) { -portBASE_TYPE xRunningPrivileged = prvRaisePrivilege(); -unsigned portBASE_TYPE uxReturn; +BaseType_t xRunningPrivileged = prvRaisePrivilege(); +UBaseType_t uxReturn; uxReturn = uxQueueMessagesWaiting( pxQueue ); portRESET_PRIVILEGE( xRunningPrivileged ); @@ -1008,10 +1008,10 @@ unsigned portBASE_TYPE uxReturn; } /*-----------------------------------------------------------*/ -signed portBASE_TYPE MPU_xQueueGenericReceive( xQueueHandle pxQueue, void * const pvBuffer, portTickType xTicksToWait, portBASE_TYPE xJustPeeking ) +BaseType_t MPU_xQueueGenericReceive( QueueHandle_t pxQueue, void * const pvBuffer, TickType_t xTicksToWait, BaseType_t xJustPeeking ) { -portBASE_TYPE xRunningPrivileged = prvRaisePrivilege(); -signed portBASE_TYPE xReturn; +BaseType_t xRunningPrivileged = prvRaisePrivilege(); +BaseType_t xReturn; xReturn = xQueueGenericReceive( pxQueue, pvBuffer, xTicksToWait, xJustPeeking ); portRESET_PRIVILEGE( xRunningPrivileged ); @@ -1019,10 +1019,10 @@ signed portBASE_TYPE xReturn; } /*-----------------------------------------------------------*/ -signed portBASE_TYPE MPU_xQueuePeekFromISR( xQueueHandle pxQueue, void * const pvBuffer ) +BaseType_t MPU_xQueuePeekFromISR( QueueHandle_t pxQueue, void * const pvBuffer ) { -portBASE_TYPE xRunningPrivileged = prvRaisePrivilege(); -signed portBASE_TYPE xReturn; +BaseType_t xRunningPrivileged = prvRaisePrivilege(); +BaseType_t xReturn; xReturn = xQueuePeekFromISR( pxQueue, pvBuffer ); portRESET_PRIVILEGE( xRunningPrivileged ); @@ -1031,10 +1031,10 @@ signed portBASE_TYPE xReturn; /*-----------------------------------------------------------*/ #if ( configUSE_MUTEXES == 1 ) - xQueueHandle MPU_xQueueCreateMutex( void ) + QueueHandle_t MPU_xQueueCreateMutex( void ) { - xQueueHandle xReturn; - portBASE_TYPE xRunningPrivileged = prvRaisePrivilege(); + QueueHandle_t xReturn; + BaseType_t xRunningPrivileged = prvRaisePrivilege(); xReturn = xQueueCreateMutex( queueQUEUE_TYPE_MUTEX ); portRESET_PRIVILEGE( xRunningPrivileged ); @@ -1044,10 +1044,10 @@ signed portBASE_TYPE xReturn; /*-----------------------------------------------------------*/ #if configUSE_COUNTING_SEMAPHORES == 1 - xQueueHandle MPU_xQueueCreateCountingSemaphore( unsigned portBASE_TYPE uxCountValue, unsigned portBASE_TYPE uxInitialCount ) + QueueHandle_t MPU_xQueueCreateCountingSemaphore( UBaseType_t uxCountValue, UBaseType_t uxInitialCount ) { - xQueueHandle xReturn; - portBASE_TYPE xRunningPrivileged = prvRaisePrivilege(); + QueueHandle_t xReturn; + BaseType_t xRunningPrivileged = prvRaisePrivilege(); xReturn = xQueueCreateCountingSemaphore( uxCountValue, uxInitialCount ); portRESET_PRIVILEGE( xRunningPrivileged ); @@ -1057,10 +1057,10 @@ signed portBASE_TYPE xReturn; /*-----------------------------------------------------------*/ #if ( configUSE_MUTEXES == 1 ) - portBASE_TYPE MPU_xQueueTakeMutexRecursive( xQueueHandle xMutex, portTickType xBlockTime ) + BaseType_t MPU_xQueueTakeMutexRecursive( QueueHandle_t xMutex, TickType_t xBlockTime ) { - portBASE_TYPE xReturn; - portBASE_TYPE xRunningPrivileged = prvRaisePrivilege(); + BaseType_t xReturn; + BaseType_t xRunningPrivileged = prvRaisePrivilege(); xReturn = xQueueTakeMutexRecursive( xMutex, xBlockTime ); portRESET_PRIVILEGE( xRunningPrivileged ); @@ -1070,10 +1070,10 @@ signed portBASE_TYPE xReturn; /*-----------------------------------------------------------*/ #if ( configUSE_MUTEXES == 1 ) - portBASE_TYPE MPU_xQueueGiveMutexRecursive( xQueueHandle xMutex ) + BaseType_t MPU_xQueueGiveMutexRecursive( QueueHandle_t xMutex ) { - portBASE_TYPE xReturn; - portBASE_TYPE xRunningPrivileged = prvRaisePrivilege(); + BaseType_t xReturn; + BaseType_t xRunningPrivileged = prvRaisePrivilege(); xReturn = xQueueGiveMutexRecursive( xMutex ); portRESET_PRIVILEGE( xRunningPrivileged ); @@ -1083,10 +1083,10 @@ signed portBASE_TYPE xReturn; /*-----------------------------------------------------------*/ #if ( configUSE_QUEUE_SETS == 1 ) - xQueueSetHandle MPU_xQueueCreateSet( unsigned portBASE_TYPE uxEventQueueLength ) + QueueSetHandle_t MPU_xQueueCreateSet( UBaseType_t uxEventQueueLength ) { - xQueueSetHandle xReturn; - portBASE_TYPE xRunningPrivileged = prvRaisePrivilege(); + QueueSetHandle_t xReturn; + BaseType_t xRunningPrivileged = prvRaisePrivilege(); xReturn = xQueueCreateSet( uxEventQueueLength ); portRESET_PRIVILEGE( xRunningPrivileged ); @@ -1096,10 +1096,10 @@ signed portBASE_TYPE xReturn; /*-----------------------------------------------------------*/ #if ( configUSE_QUEUE_SETS == 1 ) - xQueueSetMemberHandle MPU_xQueueSelectFromSet( xQueueSetHandle xQueueSet, portTickType xBlockTimeTicks ) + QueueSetMember_t MPU_xQueueSelectFromSet( QueueSetHandle_t xQueueSet, TickType_t xBlockTimeTicks ) { - xQueueSetMemberHandle xReturn; - portBASE_TYPE xRunningPrivileged = prvRaisePrivilege(); + QueueSetMember_t xReturn; + BaseType_t xRunningPrivileged = prvRaisePrivilege(); xReturn = xQueueSelectFromSet( xQueueSet, xBlockTimeTicks ); portRESET_PRIVILEGE( xRunningPrivileged ); @@ -1109,10 +1109,10 @@ signed portBASE_TYPE xReturn; /*-----------------------------------------------------------*/ #if ( configUSE_QUEUE_SETS == 1 ) - portBASE_TYPE MPU_xQueueAddToSet( xQueueSetMemberHandle xQueueOrSemaphore, xQueueSetHandle xQueueSet ) + BaseType_t MPU_xQueueAddToSet( QueueSetMember_t xQueueOrSemaphore, QueueSetHandle_t xQueueSet ) { - portBASE_TYPE xReturn; - portBASE_TYPE xRunningPrivileged = prvRaisePrivilege(); + BaseType_t xReturn; + BaseType_t xRunningPrivileged = prvRaisePrivilege(); xReturn = xQueueAddToSet( xQueueOrSemaphore, xQueueSet ); portRESET_PRIVILEGE( xRunningPrivileged ); @@ -1122,10 +1122,10 @@ signed portBASE_TYPE xReturn; /*-----------------------------------------------------------*/ #if ( configUSE_QUEUE_SETS == 1 ) - portBASE_TYPE MPU_xQueueRemoveFromSet( xQueueSetMemberHandle xQueueOrSemaphore, xQueueSetHandle xQueueSet ) + BaseType_t MPU_xQueueRemoveFromSet( QueueSetMember_t xQueueOrSemaphore, QueueSetHandle_t xQueueSet ) { - portBASE_TYPE xReturn; - portBASE_TYPE xRunningPrivileged = prvRaisePrivilege(); + BaseType_t xReturn; + BaseType_t xRunningPrivileged = prvRaisePrivilege(); xReturn = xQueueRemoveFromSet( xQueueOrSemaphore, xQueueSet ); portRESET_PRIVILEGE( xRunningPrivileged ); @@ -1135,12 +1135,12 @@ signed portBASE_TYPE xReturn; /*-----------------------------------------------------------*/ #if configUSE_ALTERNATIVE_API == 1 - signed portBASE_TYPE MPU_xQueueAltGenericSend( xQueueHandle pxQueue, const void * const pvItemToQueue, portTickType xTicksToWait, portBASE_TYPE xCopyPosition ) + BaseType_t MPU_xQueueAltGenericSend( QueueHandle_t pxQueue, const void * const pvItemToQueue, TickType_t xTicksToWait, BaseType_t xCopyPosition ) { - signed portBASE_TYPE xReturn; - portBASE_TYPE xRunningPrivileged = prvRaisePrivilege(); + BaseType_t xReturn; + BaseType_t xRunningPrivileged = prvRaisePrivilege(); - xReturn = signed portBASE_TYPE xQueueAltGenericSend( pxQueue, pvItemToQueue, xTicksToWait, xCopyPosition ); + xReturn = BaseType_t xQueueAltGenericSend( pxQueue, pvItemToQueue, xTicksToWait, xCopyPosition ); portRESET_PRIVILEGE( xRunningPrivileged ); return xReturn; } @@ -1148,10 +1148,10 @@ signed portBASE_TYPE xReturn; /*-----------------------------------------------------------*/ #if configUSE_ALTERNATIVE_API == 1 - signed portBASE_TYPE MPU_xQueueAltGenericReceive( xQueueHandle pxQueue, void * const pvBuffer, portTickType xTicksToWait, portBASE_TYPE xJustPeeking ) + BaseType_t MPU_xQueueAltGenericReceive( QueueHandle_t pxQueue, void * const pvBuffer, TickType_t xTicksToWait, BaseType_t xJustPeeking ) { - signed portBASE_TYPE xReturn; - portBASE_TYPE xRunningPrivileged = prvRaisePrivilege(); + BaseType_t xReturn; + BaseType_t xRunningPrivileged = prvRaisePrivilege(); xReturn = xQueueAltGenericReceive( pxQueue, pvBuffer, xTicksToWait, xJustPeeking ); portRESET_PRIVILEGE( xRunningPrivileged ); @@ -1161,9 +1161,9 @@ signed portBASE_TYPE xReturn; /*-----------------------------------------------------------*/ #if configQUEUE_REGISTRY_SIZE > 0 - void MPU_vQueueAddToRegistry( xQueueHandle xQueue, char *pcName ) + void MPU_vQueueAddToRegistry( QueueHandle_t xQueue, char *pcName ) { - portBASE_TYPE xRunningPrivileged = prvRaisePrivilege(); + BaseType_t xRunningPrivileged = prvRaisePrivilege(); vQueueAddToRegistry( xQueue, pcName ); @@ -1172,9 +1172,9 @@ signed portBASE_TYPE xReturn; #endif /*-----------------------------------------------------------*/ -void MPU_vQueueDelete( xQueueHandle xQueue ) +void MPU_vQueueDelete( QueueHandle_t xQueue ) { -portBASE_TYPE xRunningPrivileged = prvRaisePrivilege(); +BaseType_t xRunningPrivileged = prvRaisePrivilege(); vQueueDelete( xQueue ); @@ -1185,7 +1185,7 @@ portBASE_TYPE xRunningPrivileged = prvRaisePrivilege(); void *MPU_pvPortMalloc( size_t xSize ) { void *pvReturn; -portBASE_TYPE xRunningPrivileged = prvRaisePrivilege(); +BaseType_t xRunningPrivileged = prvRaisePrivilege(); pvReturn = pvPortMalloc( xSize ); @@ -1197,7 +1197,7 @@ portBASE_TYPE xRunningPrivileged = prvRaisePrivilege(); void MPU_vPortFree( void *pv ) { -portBASE_TYPE xRunningPrivileged = prvRaisePrivilege(); +BaseType_t xRunningPrivileged = prvRaisePrivilege(); vPortFree( pv ); @@ -1207,7 +1207,7 @@ portBASE_TYPE xRunningPrivileged = prvRaisePrivilege(); void MPU_vPortInitialiseBlocks( void ) { -portBASE_TYPE xRunningPrivileged = prvRaisePrivilege(); +BaseType_t xRunningPrivileged = prvRaisePrivilege(); vPortInitialiseBlocks(); @@ -1218,7 +1218,7 @@ portBASE_TYPE xRunningPrivileged = prvRaisePrivilege(); size_t MPU_xPortGetFreeHeapSize( void ) { size_t xReturn; -portBASE_TYPE xRunningPrivileged = prvRaisePrivilege(); +BaseType_t xRunningPrivileged = prvRaisePrivilege(); xReturn = xPortGetFreeHeapSize(); @@ -1234,7 +1234,7 @@ equals the privilege state on entry. For example: void MPU_FunctionName( [parameters ] ) { -portBASE_TYPE xRunningPrivileged = prvRaisePrivilege(); +BaseType_t xRunningPrivileged = prvRaisePrivilege(); FunctionName( [parameters ] ); diff --git a/FreeRTOS/Source/portable/GCC/ARM_CM3_MPU/portmacro.h b/FreeRTOS/Source/portable/GCC/ARM_CM3_MPU/portmacro.h index b2bda49d8..190f6b44c 100644 --- a/FreeRTOS/Source/portable/GCC/ARM_CM3_MPU/portmacro.h +++ b/FreeRTOS/Source/portable/GCC/ARM_CM3_MPU/portmacro.h @@ -1,5 +1,5 @@ /* - FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. + FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. All rights reserved VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. @@ -87,15 +87,19 @@ extern "C" { #define portDOUBLE double #define portLONG long #define portSHORT short -#define portSTACK_TYPE unsigned portLONG +#define portSTACK_TYPE uint32_t #define portBASE_TYPE long +typedef portSTACK_TYPE StackType_t; +typedef long BaseType_t; +typedef unsigned long UBaseType_t; + #if( configUSE_16_BIT_TICKS == 1 ) - typedef unsigned portSHORT portTickType; - #define portMAX_DELAY ( portTickType ) 0xffff + typedef uint16_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffff #else - typedef unsigned portLONG portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffffUL + typedef uint32_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffffffffUL #endif /*-----------------------------------------------------------*/ @@ -124,8 +128,8 @@ extern "C" { typedef struct MPU_REGION_REGISTERS { - unsigned portLONG ulRegionBaseAddress; - unsigned portLONG ulRegionAttribute; + uint32_t ulRegionBaseAddress; + uint32_t ulRegionAttribute; } xMPU_REGION_REGISTERS; /* Plus 1 to create space for the stack region. */ @@ -136,7 +140,7 @@ typedef struct MPU_SETTINGS /* Architecture specifics. */ #define portSTACK_GROWTH ( -1 ) -#define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ ) +#define portTICK_RATE_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ ) #define portBYTE_ALIGNMENT 8 /*-----------------------------------------------------------*/ @@ -150,7 +154,7 @@ typedef struct MPU_SETTINGS #define portYIELD() __asm volatile ( " SVC %0 \n" :: "i" (portSVC_YIELD) ) #define portYIELD_WITHIN_API() *(portNVIC_INT_CTRL) = portNVIC_PENDSVSET -#define portNVIC_INT_CTRL ( ( volatile unsigned portLONG *) 0xe000ed04 ) +#define portNVIC_INT_CTRL ( ( volatile uint32_t *) 0xe000ed04 ) #define portNVIC_PENDSVSET 0x10000000 #define portEND_SWITCHING_ISR( xSwitchRequired ) if( xSwitchRequired ) *(portNVIC_INT_CTRL) = portNVIC_PENDSVSET #define portYIELD_FROM_ISR( x ) portEND_SWITCHING_ISR( x ) diff --git a/FreeRTOS/Source/portable/GCC/ARM_CM4F/port.c b/FreeRTOS/Source/portable/GCC/ARM_CM4F/port.c index 0d7f56a5b..a75cebfd1 100644 --- a/FreeRTOS/Source/portable/GCC/ARM_CM4F/port.c +++ b/FreeRTOS/Source/portable/GCC/ARM_CM4F/port.c @@ -86,10 +86,10 @@ #endif /* Constants required to manipulate the core. Registers first... */ -#define portNVIC_SYSTICK_CTRL_REG ( * ( ( volatile unsigned long * ) 0xe000e010 ) ) -#define portNVIC_SYSTICK_LOAD_REG ( * ( ( volatile unsigned long * ) 0xe000e014 ) ) -#define portNVIC_SYSTICK_CURRENT_VALUE_REG ( * ( ( volatile unsigned long * ) 0xe000e018 ) ) -#define portNVIC_SYSPRI2_REG ( * ( ( volatile unsigned long * ) 0xe000ed20 ) ) +#define portNVIC_SYSTICK_CTRL_REG ( * ( ( volatile uint32_t * ) 0xe000e010 ) ) +#define portNVIC_SYSTICK_LOAD_REG ( * ( ( volatile uint32_t * ) 0xe000e014 ) ) +#define portNVIC_SYSTICK_CURRENT_VALUE_REG ( * ( ( volatile uint32_t * ) 0xe000e018 ) ) +#define portNVIC_SYSPRI2_REG ( * ( ( volatile uint32_t * ) 0xe000ed20 ) ) /* ...then bits in the registers. */ #define portNVIC_SYSTICK_INT_BIT ( 1UL << 1UL ) #define portNVIC_SYSTICK_ENABLE_BIT ( 1UL << 0UL ) @@ -97,21 +97,21 @@ #define portNVIC_PENDSVCLEAR_BIT ( 1UL << 27UL ) #define portNVIC_PEND_SYSTICK_CLEAR_BIT ( 1UL << 25UL ) -#define portNVIC_PENDSV_PRI ( ( ( unsigned long ) configKERNEL_INTERRUPT_PRIORITY ) << 16UL ) -#define portNVIC_SYSTICK_PRI ( ( ( unsigned long ) configKERNEL_INTERRUPT_PRIORITY ) << 24UL ) +#define portNVIC_PENDSV_PRI ( ( ( uint32_t ) configKERNEL_INTERRUPT_PRIORITY ) << 16UL ) +#define portNVIC_SYSTICK_PRI ( ( ( uint32_t ) configKERNEL_INTERRUPT_PRIORITY ) << 24UL ) /* Constants required to check the validity of an interrupt priority. */ #define portFIRST_USER_INTERRUPT_NUMBER ( 16 ) #define portNVIC_IP_REGISTERS_OFFSET_16 ( 0xE000E3F0 ) -#define portAIRCR_REG ( * ( ( volatile unsigned long * ) 0xE000ED0C ) ) -#define portMAX_8_BIT_VALUE ( ( unsigned char ) 0xff ) -#define portTOP_BIT_OF_BYTE ( ( unsigned char ) 0x80 ) -#define portMAX_PRIGROUP_BITS ( ( unsigned char ) 7 ) +#define portAIRCR_REG ( * ( ( volatile uint32_t * ) 0xE000ED0C ) ) +#define portMAX_8_BIT_VALUE ( ( uint8_t ) 0xff ) +#define portTOP_BIT_OF_BYTE ( ( uint8_t ) 0x80 ) +#define portMAX_PRIGROUP_BITS ( ( uint8_t ) 7 ) #define portPRIORITY_GROUP_MASK ( 0x07UL << 8UL ) #define portPRIGROUP_SHIFT ( 8UL ) /* Constants required to manipulate the VFP. */ -#define portFPCCR ( ( volatile unsigned long * ) 0xe000ef34 ) /* Floating point context control register. */ +#define portFPCCR ( ( volatile uint32_t * ) 0xe000ef34 ) /* Floating point context control register. */ #define portASPEN_AND_LSPEN_BITS ( 0x3UL << 30UL ) /* Constants required to set up the initial stack. */ @@ -137,7 +137,7 @@ debugger. */ /* Each task maintains its own interrupt status in the critical nesting variable. */ -static unsigned portBASE_TYPE uxCriticalNesting = 0xaaaaaaaa; +static UBaseType_t uxCriticalNesting = 0xaaaaaaaa; /* * Setup the timer to generate the tick interrupts. The implementation in this @@ -174,7 +174,7 @@ static void prvTaskExitError( void ); * The number of SysTick increments that make up one tick period. */ #if configUSE_TICKLESS_IDLE == 1 - static unsigned long ulTimerCountsForOneTick = 0; + static uint32_t ulTimerCountsForOneTick = 0; #endif /* configUSE_TICKLESS_IDLE */ /* @@ -182,7 +182,7 @@ static void prvTaskExitError( void ); * 24 bit resolution of the SysTick timer. */ #if configUSE_TICKLESS_IDLE == 1 - static unsigned long xMaximumPossibleSuppressedTicks = 0; + static uint32_t xMaximumPossibleSuppressedTicks = 0; #endif /* configUSE_TICKLESS_IDLE */ /* @@ -190,7 +190,7 @@ static void prvTaskExitError( void ); * power functionality only. */ #if configUSE_TICKLESS_IDLE == 1 - static unsigned long ulStoppedTimerCompensation = 0; + static uint32_t ulStoppedTimerCompensation = 0; #endif /* configUSE_TICKLESS_IDLE */ /* @@ -199,9 +199,9 @@ static void prvTaskExitError( void ); * a priority above configMAX_SYSCALL_INTERRUPT_PRIORITY. */ #if ( configASSERT_DEFINED == 1 ) - static unsigned char ucMaxSysCallPriority = 0; - static unsigned long ulMaxPRIGROUPValue = 0; - static const volatile unsigned char * const pcInterruptPriorityRegisters = ( const volatile unsigned char * const ) portNVIC_IP_REGISTERS_OFFSET_16; + static uint8_t ucMaxSysCallPriority = 0; + static uint32_t ulMaxPRIGROUPValue = 0; + static const volatile uint8_t * const pcInterruptPriorityRegisters = ( const volatile uint8_t * const ) portNVIC_IP_REGISTERS_OFFSET_16; #endif /* configASSERT_DEFINED */ /*-----------------------------------------------------------*/ @@ -209,7 +209,7 @@ static void prvTaskExitError( void ); /* * See header file for description. */ -portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) +StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) { /* Simulate the stack frame as it would be created by a context switch interrupt. */ @@ -220,13 +220,13 @@ portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE *pxTopOfStack = portINITIAL_XPSR; /* xPSR */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) pxCode; /* PC */ + *pxTopOfStack = ( StackType_t ) pxCode; /* PC */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) portTASK_RETURN_ADDRESS; /* LR */ + *pxTopOfStack = ( StackType_t ) portTASK_RETURN_ADDRESS; /* LR */ /* Save code space by skipping register initialisation. */ pxTopOfStack -= 5; /* R12, R3, R2 and R1. */ - *pxTopOfStack = ( portSTACK_TYPE ) pvParameters; /* R0 */ + *pxTopOfStack = ( StackType_t ) pvParameters; /* R0 */ /* A save method is being used that requires each task to maintain its own exec return value. */ @@ -291,7 +291,7 @@ static void prvPortStartFirstTask( void ) /* * See header file for description. */ -portBASE_TYPE xPortStartScheduler( void ) +BaseType_t xPortStartScheduler( void ) { /* configMAX_SYSCALL_INTERRUPT_PRIORITY must not be set to 0. See http://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html */ @@ -299,9 +299,9 @@ portBASE_TYPE xPortStartScheduler( void ) #if( configASSERT_DEFINED == 1 ) { - volatile unsigned long ulOriginalPriority; - volatile char * const pcFirstUserPriorityRegister = ( volatile char * const ) ( portNVIC_IP_REGISTERS_OFFSET_16 + portFIRST_USER_INTERRUPT_NUMBER ); - volatile unsigned char ucMaxPriorityValue; + volatile uint32_t ulOriginalPriority; + volatile int8_t * const pcFirstUserPriorityRegister = ( volatile int8_t * const ) ( portNVIC_IP_REGISTERS_OFFSET_16 + portFIRST_USER_INTERRUPT_NUMBER ); + volatile uint8_t ucMaxPriorityValue; /* Determine the maximum priority from which ISR safe FreeRTOS API functions can be called. ISR safe functions are those that end in @@ -327,7 +327,7 @@ portBASE_TYPE xPortStartScheduler( void ) while( ( ucMaxPriorityValue & portTOP_BIT_OF_BYTE ) == portTOP_BIT_OF_BYTE ) { ulMaxPRIGROUPValue--; - ucMaxPriorityValue <<= ( unsigned char ) 0x01; + ucMaxPriorityValue <<= ( uint8_t ) 0x01; } /* Shift the priority group value back to its position within the AIRCR @@ -412,7 +412,7 @@ void vPortExitCritical( void ) } /*-----------------------------------------------------------*/ -__attribute__(( naked )) unsigned long ulPortSetInterruptMask( void ) +__attribute__(( naked )) uint32_t ulPortSetInterruptMask( void ) { __asm volatile \ ( \ @@ -429,7 +429,7 @@ __attribute__(( naked )) unsigned long ulPortSetInterruptMask( void ) } /*-----------------------------------------------------------*/ -__attribute__(( naked )) void vPortClearInterruptMask( unsigned long ulNewMaskValue ) +__attribute__(( naked )) void vPortClearInterruptMask( uint32_t ulNewMaskValue ) { __asm volatile \ ( \ @@ -521,10 +521,10 @@ void xPortSysTickHandler( void ) #if configUSE_TICKLESS_IDLE == 1 - __attribute__((weak)) void vPortSuppressTicksAndSleep( portTickType xExpectedIdleTime ) + __attribute__((weak)) void vPortSuppressTicksAndSleep( TickType_t xExpectedIdleTime ) { - unsigned long ulReloadValue, ulCompleteTickPeriods, ulCompletedSysTickDecrements, ulSysTickCTRL; - portTickType xModifiableIdleTime; + uint32_t ulReloadValue, ulCompleteTickPeriods, ulCompletedSysTickDecrements, ulSysTickCTRL; + TickType_t xModifiableIdleTime; /* Make sure the SysTick reload value does not overflow the counter. */ if( xExpectedIdleTime > xMaximumPossibleSuppressedTicks ) @@ -610,7 +610,7 @@ void xPortSysTickHandler( void ) if( ( ulSysTickCTRL & portNVIC_SYSTICK_COUNT_FLAG_BIT ) != 0 ) { - unsigned long ulCalculatedLoadValue; + uint32_t ulCalculatedLoadValue; /* The tick interrupt has already executed, and the SysTick count reloaded with ulReloadValue. Reset the @@ -711,8 +711,8 @@ static void vPortEnableVFP( void ) void vPortValidateInterruptPriority( void ) { - unsigned long ulCurrentInterrupt; - unsigned char ucCurrentPriority; + uint32_t ulCurrentInterrupt; + uint8_t ucCurrentPriority; /* Obtain the number of the currently executing interrupt. */ __asm volatile( "mrs %0, ipsr" : "=r"( ulCurrentInterrupt ) ); diff --git a/FreeRTOS/Source/portable/GCC/ARM_CM4F/portmacro.h b/FreeRTOS/Source/portable/GCC/ARM_CM4F/portmacro.h index cb411bc88..98ec55bd4 100644 --- a/FreeRTOS/Source/portable/GCC/ARM_CM4F/portmacro.h +++ b/FreeRTOS/Source/portable/GCC/ARM_CM4F/portmacro.h @@ -1,5 +1,5 @@ /* - FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. + FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. All rights reserved VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. @@ -87,28 +87,32 @@ extern "C" { #define portDOUBLE double #define portLONG long #define portSHORT short -#define portSTACK_TYPE unsigned portLONG +#define portSTACK_TYPE uint32_t #define portBASE_TYPE long +typedef portSTACK_TYPE StackType_t; +typedef long BaseType_t; +typedef unsigned long UBaseType_t; + #if( configUSE_16_BIT_TICKS == 1 ) - typedef unsigned portSHORT portTickType; - #define portMAX_DELAY ( portTickType ) 0xffff + typedef uint16_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffff #else - typedef unsigned portLONG portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffffUL + typedef uint32_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffffffffUL #endif /*-----------------------------------------------------------*/ /* Architecture specifics. */ #define portSTACK_GROWTH ( -1 ) -#define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ ) +#define portTICK_RATE_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ ) #define portBYTE_ALIGNMENT 8 /*-----------------------------------------------------------*/ /* Scheduler utilities. */ extern void vPortYield( void ); -#define portNVIC_INT_CTRL_REG ( * ( ( volatile unsigned long * ) 0xe000ed04 ) ) +#define portNVIC_INT_CTRL_REG ( * ( ( volatile uint32_t * ) 0xe000ed04 ) ) #define portNVIC_PENDSVSET_BIT ( 1UL << 28UL ) #define portYIELD() vPortYield() #define portEND_SWITCHING_ISR( xSwitchRequired ) if( xSwitchRequired ) portNVIC_INT_CTRL_REG = portNVIC_PENDSVSET_BIT @@ -118,8 +122,8 @@ extern void vPortYield( void ); /* Critical section management. */ extern void vPortEnterCritical( void ); extern void vPortExitCritical( void ); -extern unsigned long ulPortSetInterruptMask( void ); -extern void vPortClearInterruptMask( unsigned long ulNewMaskValue ); +extern uint32_t ulPortSetInterruptMask( void ); +extern void vPortClearInterruptMask( uint32_t ulNewMaskValue ); #define portSET_INTERRUPT_MASK_FROM_ISR() ulPortSetInterruptMask() #define portCLEAR_INTERRUPT_MASK_FROM_ISR(x) vPortClearInterruptMask(x) #define portDISABLE_INTERRUPTS() ulPortSetInterruptMask() @@ -138,7 +142,7 @@ not necessary for to use this port. They are defined so the common demo files /* Tickless idle/low power functionality. */ #ifndef portSUPPRESS_TICKS_AND_SLEEP - extern void vPortSuppressTicksAndSleep( portTickType xExpectedIdleTime ); + extern void vPortSuppressTicksAndSleep( TickType_t xExpectedIdleTime ); #define portSUPPRESS_TICKS_AND_SLEEP( xExpectedIdleTime ) vPortSuppressTicksAndSleep( xExpectedIdleTime ) #endif /*-----------------------------------------------------------*/ @@ -147,9 +151,9 @@ not necessary for to use this port. They are defined so the common demo files #if configUSE_PORT_OPTIMISED_TASK_SELECTION == 1 /* Generic helper function. */ - __attribute__( ( always_inline ) ) static inline unsigned char ucPortCountLeadingZeros( unsigned long ulBitmap ) + __attribute__( ( always_inline ) ) static inline uint8_t ucPortCountLeadingZeros( uint32_t ulBitmap ) { - unsigned char ucReturn; + uint8_t ucReturn; __asm volatile ( "clz %0, %1" : "=r" ( ucReturn ) : "r" ( ulBitmap ) ); return ucReturn; diff --git a/FreeRTOS/Source/portable/GCC/ATMega323/port.c b/FreeRTOS/Source/portable/GCC/ATMega323/port.c index 0e97aa419..3a8a27211 100644 --- a/FreeRTOS/Source/portable/GCC/ATMega323/port.c +++ b/FreeRTOS/Source/portable/GCC/ATMega323/port.c @@ -83,20 +83,20 @@ Changes from V2.6.0 *----------------------------------------------------------*/ /* Start tasks with interrupts enables. */ -#define portFLAGS_INT_ENABLED ( ( portSTACK_TYPE ) 0x80 ) +#define portFLAGS_INT_ENABLED ( ( StackType_t ) 0x80 ) /* Hardware constants for timer 1. */ -#define portCLEAR_COUNTER_ON_MATCH ( ( unsigned char ) 0x08 ) -#define portPRESCALE_64 ( ( unsigned char ) 0x03 ) -#define portCLOCK_PRESCALER ( ( unsigned long ) 64 ) -#define portCOMPARE_MATCH_A_INTERRUPT_ENABLE ( ( unsigned char ) 0x10 ) +#define portCLEAR_COUNTER_ON_MATCH ( ( uint8_t ) 0x08 ) +#define portPRESCALE_64 ( ( uint8_t ) 0x03 ) +#define portCLOCK_PRESCALER ( ( uint32_t ) 64 ) +#define portCOMPARE_MATCH_A_INTERRUPT_ENABLE ( ( uint8_t ) 0x10 ) /*-----------------------------------------------------------*/ /* We require the address of the pxCurrentTCB variable, but don't want to know any details of its type. */ -typedef void tskTCB; -extern volatile tskTCB * volatile pxCurrentTCB; +typedef void TCB_t; +extern volatile TCB_t * volatile pxCurrentTCB; /*-----------------------------------------------------------*/ @@ -220,9 +220,9 @@ static void prvSetupTimerInterrupt( void ); /* * See header file for description. */ -portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) +StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) { -unsigned short usAddress; +uint16_t usAddress; /* Place a few bytes of known values on the bottom of the stack. This is just useful for debugging. */ @@ -241,92 +241,92 @@ unsigned short usAddress; /* The start of the task code will be popped off the stack last, so place it on first. */ - usAddress = ( unsigned short ) pxCode; - *pxTopOfStack = ( portSTACK_TYPE ) ( usAddress & ( unsigned short ) 0x00ff ); + usAddress = ( uint16_t ) pxCode; + *pxTopOfStack = ( StackType_t ) ( usAddress & ( uint16_t ) 0x00ff ); pxTopOfStack--; usAddress >>= 8; - *pxTopOfStack = ( portSTACK_TYPE ) ( usAddress & ( unsigned short ) 0x00ff ); + *pxTopOfStack = ( StackType_t ) ( usAddress & ( uint16_t ) 0x00ff ); pxTopOfStack--; /* Next simulate the stack as if after a call to portSAVE_CONTEXT(). portSAVE_CONTEXT places the flags on the stack immediately after r0 to ensure the interrupts get disabled as soon as possible, and so ensuring the stack use is minimal should a context switch interrupt occur. */ - *pxTopOfStack = ( portSTACK_TYPE ) 0x00; /* R0 */ + *pxTopOfStack = ( StackType_t ) 0x00; /* R0 */ pxTopOfStack--; *pxTopOfStack = portFLAGS_INT_ENABLED; pxTopOfStack--; /* Now the remaining registers. The compiler expects R1 to be 0. */ - *pxTopOfStack = ( portSTACK_TYPE ) 0x00; /* R1 */ + *pxTopOfStack = ( StackType_t ) 0x00; /* R1 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x02; /* R2 */ + *pxTopOfStack = ( StackType_t ) 0x02; /* R2 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x03; /* R3 */ + *pxTopOfStack = ( StackType_t ) 0x03; /* R3 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x04; /* R4 */ + *pxTopOfStack = ( StackType_t ) 0x04; /* R4 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x05; /* R5 */ + *pxTopOfStack = ( StackType_t ) 0x05; /* R5 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x06; /* R6 */ + *pxTopOfStack = ( StackType_t ) 0x06; /* R6 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x07; /* R7 */ + *pxTopOfStack = ( StackType_t ) 0x07; /* R7 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x08; /* R8 */ + *pxTopOfStack = ( StackType_t ) 0x08; /* R8 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x09; /* R9 */ + *pxTopOfStack = ( StackType_t ) 0x09; /* R9 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x10; /* R10 */ + *pxTopOfStack = ( StackType_t ) 0x10; /* R10 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x11; /* R11 */ + *pxTopOfStack = ( StackType_t ) 0x11; /* R11 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x12; /* R12 */ + *pxTopOfStack = ( StackType_t ) 0x12; /* R12 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x13; /* R13 */ + *pxTopOfStack = ( StackType_t ) 0x13; /* R13 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x14; /* R14 */ + *pxTopOfStack = ( StackType_t ) 0x14; /* R14 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x15; /* R15 */ + *pxTopOfStack = ( StackType_t ) 0x15; /* R15 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x16; /* R16 */ + *pxTopOfStack = ( StackType_t ) 0x16; /* R16 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x17; /* R17 */ + *pxTopOfStack = ( StackType_t ) 0x17; /* R17 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x18; /* R18 */ + *pxTopOfStack = ( StackType_t ) 0x18; /* R18 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x19; /* R19 */ + *pxTopOfStack = ( StackType_t ) 0x19; /* R19 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x20; /* R20 */ + *pxTopOfStack = ( StackType_t ) 0x20; /* R20 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x21; /* R21 */ + *pxTopOfStack = ( StackType_t ) 0x21; /* R21 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x22; /* R22 */ + *pxTopOfStack = ( StackType_t ) 0x22; /* R22 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x23; /* R23 */ + *pxTopOfStack = ( StackType_t ) 0x23; /* R23 */ pxTopOfStack--; /* Place the parameter on the stack in the expected location. */ - usAddress = ( unsigned short ) pvParameters; - *pxTopOfStack = ( portSTACK_TYPE ) ( usAddress & ( unsigned short ) 0x00ff ); + usAddress = ( uint16_t ) pvParameters; + *pxTopOfStack = ( StackType_t ) ( usAddress & ( uint16_t ) 0x00ff ); pxTopOfStack--; usAddress >>= 8; - *pxTopOfStack = ( portSTACK_TYPE ) ( usAddress & ( unsigned short ) 0x00ff ); + *pxTopOfStack = ( StackType_t ) ( usAddress & ( uint16_t ) 0x00ff ); pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x26; /* R26 X */ + *pxTopOfStack = ( StackType_t ) 0x26; /* R26 X */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x27; /* R27 */ + *pxTopOfStack = ( StackType_t ) 0x27; /* R27 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x28; /* R28 Y */ + *pxTopOfStack = ( StackType_t ) 0x28; /* R28 Y */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x29; /* R29 */ + *pxTopOfStack = ( StackType_t ) 0x29; /* R29 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x30; /* R30 Z */ + *pxTopOfStack = ( StackType_t ) 0x30; /* R30 Z */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x031; /* R31 */ + *pxTopOfStack = ( StackType_t ) 0x031; /* R31 */ pxTopOfStack--; /*lint +e950 +e611 +e923 */ @@ -335,7 +335,7 @@ unsigned short usAddress; } /*-----------------------------------------------------------*/ -portBASE_TYPE xPortStartScheduler( void ) +BaseType_t xPortStartScheduler( void ) { /* Setup the hardware to generate the tick. */ prvSetupTimerInterrupt(); @@ -399,8 +399,8 @@ void vPortYieldFromTick( void ) */ static void prvSetupTimerInterrupt( void ) { -unsigned long ulCompareMatch; -unsigned char ucHighByte, ucLowByte; +uint32_t ulCompareMatch; +uint8_t ucHighByte, ucLowByte; /* Using 16bit timer 1 to generate the tick. Correct fuses must be selected for the configCPU_CLOCK_HZ clock. */ @@ -411,13 +411,13 @@ unsigned char ucHighByte, ucLowByte; ulCompareMatch /= portCLOCK_PRESCALER; /* Adjust for correct value. */ - ulCompareMatch -= ( unsigned long ) 1; + ulCompareMatch -= ( uint32_t ) 1; /* Setup compare match value for compare match A. Interrupts are disabled before this is called so we need not worry here. */ - ucLowByte = ( unsigned char ) ( ulCompareMatch & ( unsigned long ) 0xff ); + ucLowByte = ( uint8_t ) ( ulCompareMatch & ( uint32_t ) 0xff ); ulCompareMatch >>= 8; - ucHighByte = ( unsigned char ) ( ulCompareMatch & ( unsigned long ) 0xff ); + ucHighByte = ( uint8_t ) ( ulCompareMatch & ( uint32_t ) 0xff ); OCR1AH = ucHighByte; OCR1AL = ucLowByte; diff --git a/FreeRTOS/Source/portable/GCC/ATMega323/portmacro.h b/FreeRTOS/Source/portable/GCC/ATMega323/portmacro.h index 301aa8628..da7d68316 100644 --- a/FreeRTOS/Source/portable/GCC/ATMega323/portmacro.h +++ b/FreeRTOS/Source/portable/GCC/ATMega323/portmacro.h @@ -1,5 +1,5 @@ /* - FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. + FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. All rights reserved VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. @@ -66,7 +66,7 @@ /* Changes from V1.2.3 - + portCPU_CLOSK_HZ definition changed to 8MHz base 10, previously it + + portCPU_CLOSK_HZ definition changed to 8MHz base 10, previously it base 16. */ @@ -78,7 +78,7 @@ extern "C" { #endif /*----------------------------------------------------------- - * Port specific definitions. + * Port specific definitions. * * The settings in this file configure FreeRTOS correctly for the * given hardware and compiler. @@ -93,17 +93,21 @@ extern "C" { #define portDOUBLE double #define portLONG long #define portSHORT int -#define portSTACK_TYPE unsigned portCHAR +#define portSTACK_TYPE uint8_t #define portBASE_TYPE char +typedef portSTACK_TYPE StackType_t; +typedef signed char BaseType_t; +typedef unsigned char UBaseType_t; + #if( configUSE_16_BIT_TICKS == 1 ) - typedef unsigned portSHORT portTickType; - #define portMAX_DELAY ( portTickType ) 0xffff + typedef uint16_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffff #else - typedef unsigned portLONG portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffffUL + typedef uint32_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffffffffUL #endif -/*-----------------------------------------------------------*/ +/*-----------------------------------------------------------*/ /* Critical section management. */ #define portENTER_CRITICAL() asm volatile ( "in __tmp_reg__, __SREG__" :: ); \ @@ -119,7 +123,7 @@ extern "C" { /* Architecture specifics. */ #define portSTACK_GROWTH ( -1 ) -#define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ ) +#define portTICK_RATE_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ ) #define portBYTE_ALIGNMENT 1 #define portNOP() asm volatile ( "nop" ); /*-----------------------------------------------------------*/ diff --git a/FreeRTOS/Source/portable/GCC/AVR32_UC3/port.c b/FreeRTOS/Source/portable/GCC/AVR32_UC3/port.c index d05ef31d0..1c4a1339f 100644 --- a/FreeRTOS/Source/portable/GCC/AVR32_UC3/port.c +++ b/FreeRTOS/Source/portable/GCC/AVR32_UC3/port.c @@ -96,12 +96,12 @@ /* Constants required to setup the task context. */ -#define portINITIAL_SR ( ( portSTACK_TYPE ) 0x00400000 ) /* AVR32 : [M2:M0]=001 I1M=0 I0M=0, GM=0 */ -#define portINSTRUCTION_SIZE ( ( portSTACK_TYPE ) 0 ) +#define portINITIAL_SR ( ( StackType_t ) 0x00400000 ) /* AVR32 : [M2:M0]=001 I1M=0 I0M=0, GM=0 */ +#define portINSTRUCTION_SIZE ( ( StackType_t ) 0 ) /* Each task maintains its own critical nesting variable. */ -#define portNO_CRITICAL_NESTING ( ( unsigned long ) 0 ) -volatile unsigned long ulCriticalNesting = 9999UL; +#define portNO_CRITICAL_NESTING ( ( uint32_t ) 0 ) +volatile uint32_t ulCriticalNesting = 9999UL; #if( configTICK_USE_TC==0 ) static void prvScheduleNextTick( void ); @@ -130,7 +130,7 @@ void _init_startup(void) #if configHEAP_INIT extern void __heap_start__; extern void __heap_end__; - portBASE_TYPE *pxMem; + BaseType_t *pxMem; #endif /* Load the Exception Vector Base Address in the corresponding system register. */ @@ -145,7 +145,7 @@ void _init_startup(void) #if configHEAP_INIT /* Initialize the heap used by malloc. */ - for( pxMem = &__heap_start__; pxMem < ( portBASE_TYPE * )&__heap_end__; ) + for( pxMem = &__heap_start__; pxMem < ( BaseType_t * )&__heap_end__; ) { *pxMem++ = 0xA5A5A5A5; } @@ -298,36 +298,36 @@ __attribute__((__noinline__)) void vPortExitCritical( void ) * * See header file for description. */ -portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) +StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) { /* Setup the initial stack of the task. The stack is set exactly as expected by the portRESTORE_CONTEXT() macro. */ /* When the task starts, it will expect to find the function parameter in R12. */ pxTopOfStack--; - *pxTopOfStack-- = ( portSTACK_TYPE ) 0x08080808; /* R8 */ - *pxTopOfStack-- = ( portSTACK_TYPE ) 0x09090909; /* R9 */ - *pxTopOfStack-- = ( portSTACK_TYPE ) 0x0A0A0A0A; /* R10 */ - *pxTopOfStack-- = ( portSTACK_TYPE ) 0x0B0B0B0B; /* R11 */ - *pxTopOfStack-- = ( portSTACK_TYPE ) pvParameters; /* R12 */ - *pxTopOfStack-- = ( portSTACK_TYPE ) 0xDEADBEEF; /* R14/LR */ - *pxTopOfStack-- = ( portSTACK_TYPE ) pxCode + portINSTRUCTION_SIZE; /* R15/PC */ - *pxTopOfStack-- = ( portSTACK_TYPE ) portINITIAL_SR; /* SR */ - *pxTopOfStack-- = ( portSTACK_TYPE ) 0xFF0000FF; /* R0 */ - *pxTopOfStack-- = ( portSTACK_TYPE ) 0x01010101; /* R1 */ - *pxTopOfStack-- = ( portSTACK_TYPE ) 0x02020202; /* R2 */ - *pxTopOfStack-- = ( portSTACK_TYPE ) 0x03030303; /* R3 */ - *pxTopOfStack-- = ( portSTACK_TYPE ) 0x04040404; /* R4 */ - *pxTopOfStack-- = ( portSTACK_TYPE ) 0x05050505; /* R5 */ - *pxTopOfStack-- = ( portSTACK_TYPE ) 0x06060606; /* R6 */ - *pxTopOfStack-- = ( portSTACK_TYPE ) 0x07070707; /* R7 */ - *pxTopOfStack = ( portSTACK_TYPE ) portNO_CRITICAL_NESTING; /* ulCriticalNesting */ + *pxTopOfStack-- = ( StackType_t ) 0x08080808; /* R8 */ + *pxTopOfStack-- = ( StackType_t ) 0x09090909; /* R9 */ + *pxTopOfStack-- = ( StackType_t ) 0x0A0A0A0A; /* R10 */ + *pxTopOfStack-- = ( StackType_t ) 0x0B0B0B0B; /* R11 */ + *pxTopOfStack-- = ( StackType_t ) pvParameters; /* R12 */ + *pxTopOfStack-- = ( StackType_t ) 0xDEADBEEF; /* R14/LR */ + *pxTopOfStack-- = ( StackType_t ) pxCode + portINSTRUCTION_SIZE; /* R15/PC */ + *pxTopOfStack-- = ( StackType_t ) portINITIAL_SR; /* SR */ + *pxTopOfStack-- = ( StackType_t ) 0xFF0000FF; /* R0 */ + *pxTopOfStack-- = ( StackType_t ) 0x01010101; /* R1 */ + *pxTopOfStack-- = ( StackType_t ) 0x02020202; /* R2 */ + *pxTopOfStack-- = ( StackType_t ) 0x03030303; /* R3 */ + *pxTopOfStack-- = ( StackType_t ) 0x04040404; /* R4 */ + *pxTopOfStack-- = ( StackType_t ) 0x05050505; /* R5 */ + *pxTopOfStack-- = ( StackType_t ) 0x06060606; /* R6 */ + *pxTopOfStack-- = ( StackType_t ) 0x07070707; /* R7 */ + *pxTopOfStack = ( StackType_t ) portNO_CRITICAL_NESTING; /* ulCriticalNesting */ return pxTopOfStack; } /*-----------------------------------------------------------*/ -portBASE_TYPE xPortStartScheduler( void ) +BaseType_t xPortStartScheduler( void ) { /* Start the timer that generates the tick ISR. Interrupts are disabled here already. */ @@ -353,7 +353,7 @@ clock cycles from now. */ #if( configTICK_USE_TC==0 ) static void prvScheduleFirstTick(void) { - unsigned long lCycles; + uint32_t lCycles; lCycles = Get_system_register(AVR32_COUNT); lCycles += (configCPU_CLOCK_HZ/configTICK_RATE_HZ); @@ -368,7 +368,7 @@ clock cycles from now. */ __attribute__((__noinline__)) static void prvScheduleNextTick(void) { - unsigned long lCycles, lCount; + uint32_t lCycles, lCount; lCycles = Get_system_register(AVR32_COMPARE); lCycles += (configCPU_CLOCK_HZ/configTICK_RATE_HZ); diff --git a/FreeRTOS/Source/portable/GCC/AVR32_UC3/portmacro.h b/FreeRTOS/Source/portable/GCC/AVR32_UC3/portmacro.h index ad022b0e1..f8949d35c 100644 --- a/FreeRTOS/Source/portable/GCC/AVR32_UC3/portmacro.h +++ b/FreeRTOS/Source/portable/GCC/AVR32_UC3/portmacro.h @@ -13,7 +13,7 @@ *****************************************************************************/ /* - FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. + FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. All rights reserved VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. @@ -105,8 +105,12 @@ extern "C" { #define portDOUBLE double #define portLONG long #define portSHORT short -#define portSTACK_TYPE unsigned portLONG -#define portBASE_TYPE portLONG +#define portSTACK_TYPE uint32_t +#define portBASE_TYPE long + +typedef portSTACK_TYPE StackType_t; +typedef long BaseType_t; +typedef unsigned long UBaseType_t; #define TASK_DELAY_MS(x) ( (x) /portTICK_RATE_MS ) #define TASK_DELAY_S(x) ( (x)*1000 /portTICK_RATE_MS ) @@ -115,17 +119,17 @@ extern "C" { #define configTICK_TC_IRQ ATPASTE2(AVR32_TC_IRQ, configTICK_TC_CHANNEL) #if( configUSE_16_BIT_TICKS == 1 ) - typedef unsigned portSHORT portTickType; - #define portMAX_DELAY ( portTickType ) 0xffff + typedef uint16_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffff #else - typedef unsigned portLONG portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffffUL + typedef uint32_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffffffffUL #endif /*-----------------------------------------------------------*/ /* Architecture specifics. */ #define portSTACK_GROWTH ( -1 ) -#define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ ) +#define portTICK_RATE_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ ) #define portBYTE_ALIGNMENT 4 #define portNOP() {__asm__ __volatile__ ("nop");} /*-----------------------------------------------------------*/ @@ -193,7 +197,7 @@ extern void *pvPortRealloc( void *pv, size_t xSize ); */ #define portRESTORE_CONTEXT() \ { \ - extern volatile unsigned portLONG ulCriticalNesting; \ + extern volatile uint32_t ulCriticalNesting; \ extern volatile void *volatile pxCurrentTCB; \ \ __asm__ __volatile__ ( \ @@ -299,7 +303,7 @@ extern void *pvPortRealloc( void *pv, size_t xSize ); */ #define portSAVE_CONTEXT_OS_INT() \ { \ - extern volatile unsigned portLONG ulCriticalNesting; \ + extern volatile uint32_t ulCriticalNesting; \ extern volatile void *volatile pxCurrentTCB; \ \ /* When we come here */ \ @@ -351,7 +355,7 @@ extern void *pvPortRealloc( void *pv, size_t xSize ); */ #define portRESTORE_CONTEXT_OS_INT() \ { \ - extern volatile unsigned portLONG ulCriticalNesting; \ + extern volatile uint32_t ulCriticalNesting; \ extern volatile void *volatile pxCurrentTCB; \ \ /* Check if INT0 or higher were being handled (case where the OS tick interrupted another */ \ @@ -417,7 +421,7 @@ extern void *pvPortRealloc( void *pv, size_t xSize ); */ #define portSAVE_CONTEXT_SCALL() \ { \ - extern volatile unsigned portLONG ulCriticalNesting; \ + extern volatile uint32_t ulCriticalNesting; \ extern volatile void *volatile pxCurrentTCB; \ \ /* Warning: the stack layout after SCALL doesn't match the one after an interrupt. */ \ @@ -484,7 +488,7 @@ extern void *pvPortRealloc( void *pv, size_t xSize ); */ #define portRESTORE_CONTEXT_SCALL() \ { \ - extern volatile unsigned portLONG ulCriticalNesting; \ + extern volatile uint32_t ulCriticalNesting; \ extern volatile void *volatile pxCurrentTCB; \ \ /* Restore all registers */ \ @@ -576,7 +580,7 @@ extern void *pvPortRealloc( void *pv, size_t xSize ); */ #define portENTER_SWITCHING_ISR() \ { \ - extern volatile unsigned portLONG ulCriticalNesting; \ + extern volatile uint32_t ulCriticalNesting; \ extern volatile void *volatile pxCurrentTCB; \ \ /* When we come here */ \ @@ -624,7 +628,7 @@ extern void *pvPortRealloc( void *pv, size_t xSize ); */ #define portEXIT_SWITCHING_ISR() \ { \ - extern volatile unsigned portLONG ulCriticalNesting; \ + extern volatile uint32_t ulCriticalNesting; \ extern volatile void *volatile pxCurrentTCB; \ \ __asm__ __volatile__ ( \ diff --git a/FreeRTOS/Source/portable/GCC/CORTUS_APS3/port.c b/FreeRTOS/Source/portable/GCC/CORTUS_APS3/port.c index d4bda9fc9..c37435c34 100644 --- a/FreeRTOS/Source/portable/GCC/CORTUS_APS3/port.c +++ b/FreeRTOS/Source/portable/GCC/CORTUS_APS3/port.c @@ -86,7 +86,7 @@ static void prvSetupTimerInterrupt( void ); /*-----------------------------------------------------------*/ -portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE * pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) +StackType_t *pxPortInitialiseStack( StackType_t * pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) { /* Make space on the stack for the context - this leaves a couple of spaces empty. */ @@ -95,7 +95,7 @@ portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE * pxTopOfStack, pdTASK_COD /* Fill the registers with known values to assist debugging. */ pxTopOfStack[ 16 ] = 0; pxTopOfStack[ 15 ] = portINITIAL_PSR; - pxTopOfStack[ 14 ] = ( unsigned long ) pxCode; + pxTopOfStack[ 14 ] = ( uint32_t ) pxCode; pxTopOfStack[ 13 ] = 0x00000000UL; /* R15. */ pxTopOfStack[ 12 ] = 0x00000000UL; /* R14. */ pxTopOfStack[ 11 ] = 0x0d0d0d0dUL; @@ -109,13 +109,13 @@ portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE * pxTopOfStack, pdTASK_COD pxTopOfStack[ 3 ] = 0x05050505UL; pxTopOfStack[ 2 ] = 0x04040404UL; pxTopOfStack[ 1 ] = 0x03030303UL; - pxTopOfStack[ 0 ] = ( unsigned long ) pvParameters; + pxTopOfStack[ 0 ] = ( uint32_t ) pvParameters; return pxTopOfStack; } /*-----------------------------------------------------------*/ -portBASE_TYPE xPortStartScheduler( void ) +BaseType_t xPortStartScheduler( void ) { /* Set-up the timer interrupt. */ prvSetupTimerInterrupt(); diff --git a/FreeRTOS/Source/portable/GCC/CORTUS_APS3/portmacro.h b/FreeRTOS/Source/portable/GCC/CORTUS_APS3/portmacro.h index 73bb0dbeb..1c4caa998 100644 --- a/FreeRTOS/Source/portable/GCC/CORTUS_APS3/portmacro.h +++ b/FreeRTOS/Source/portable/GCC/CORTUS_APS3/portmacro.h @@ -1,5 +1,5 @@ /* - FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. + FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. All rights reserved VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. @@ -88,21 +88,25 @@ extern "C" { #define portDOUBLE double #define portLONG long #define portSHORT short -#define portSTACK_TYPE unsigned portLONG -#define portBASE_TYPE portLONG +#define portSTACK_TYPE uint32_t +#define portBASE_TYPE long + +typedef portSTACK_TYPE StackType_t; +typedef long BaseType_t; +typedef unsigned long UBaseType_t; #if( configUSE_16_BIT_TICKS == 1 ) - typedef unsigned portSHORT portTickType; - #define portMAX_DELAY ( portTickType ) 0xffff + typedef uint16_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffff #else - typedef unsigned portLONG portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffffUL + typedef uint32_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffffffffUL #endif /*-----------------------------------------------------------*/ /* Architecture specifics. */ #define portSTACK_GROWTH ( -1 ) -#define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ ) +#define portTICK_RATE_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ ) #define portBYTE_ALIGNMENT 4 #define portNOP() __asm__ volatile ( "mov r0, r0" ) #define portCRITICAL_NESTING_IN_TCB 1 diff --git a/FreeRTOS/Source/portable/GCC/ColdFire_V2/port.c b/FreeRTOS/Source/portable/GCC/ColdFire_V2/port.c index f51423042..0646f10b7 100644 --- a/FreeRTOS/Source/portable/GCC/ColdFire_V2/port.c +++ b/FreeRTOS/Source/portable/GCC/ColdFire_V2/port.c @@ -67,40 +67,40 @@ #include "FreeRTOS.h" #include "task.h" -#define portINITIAL_FORMAT_VECTOR ( ( portSTACK_TYPE ) 0x4000 ) +#define portINITIAL_FORMAT_VECTOR ( ( StackType_t ) 0x4000 ) /* Supervisor mode set. */ -#define portINITIAL_STATUS_REGISTER ( ( portSTACK_TYPE ) 0x2000) +#define portINITIAL_STATUS_REGISTER ( ( StackType_t ) 0x2000) /* Used to keep track of the number of nested calls to taskENTER_CRITICAL(). This will be set to 0 prior to the first task being started. */ -static unsigned long ulCriticalNesting = 0x9999UL; +static uint32_t ulCriticalNesting = 0x9999UL; /*-----------------------------------------------------------*/ -portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE * pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) +StackType_t *pxPortInitialiseStack( StackType_t * pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) { - *pxTopOfStack = ( portSTACK_TYPE ) pvParameters; + *pxTopOfStack = ( StackType_t ) pvParameters; pxTopOfStack--; - *pxTopOfStack = (portSTACK_TYPE) 0xDEADBEEF; + *pxTopOfStack = (StackType_t) 0xDEADBEEF; pxTopOfStack--; /* Exception stack frame starts with the return address. */ - *pxTopOfStack = ( portSTACK_TYPE ) pxCode; + *pxTopOfStack = ( StackType_t ) pxCode; pxTopOfStack--; *pxTopOfStack = ( portINITIAL_FORMAT_VECTOR << 16UL ) | ( portINITIAL_STATUS_REGISTER ); pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x0; /*FP*/ + *pxTopOfStack = ( StackType_t ) 0x0; /*FP*/ pxTopOfStack -= 14; /* A5 to D0. */ return pxTopOfStack; } /*-----------------------------------------------------------*/ -portBASE_TYPE xPortStartScheduler( void ) +BaseType_t xPortStartScheduler( void ) { extern void vPortStartFirstTask( void ); @@ -156,7 +156,7 @@ void vPortExitCritical( void ) void vPortYieldHandler( void ) { -unsigned long ulSavedInterruptMask; +uint32_t ulSavedInterruptMask; ulSavedInterruptMask = portSET_INTERRUPT_MASK_FROM_ISR(); /* Note this will clear all forced interrupts - this is done for speed. */ diff --git a/FreeRTOS/Source/portable/GCC/ColdFire_V2/portmacro.h b/FreeRTOS/Source/portable/GCC/ColdFire_V2/portmacro.h index 76c4c4e25..2199367f5 100644 --- a/FreeRTOS/Source/portable/GCC/ColdFire_V2/portmacro.h +++ b/FreeRTOS/Source/portable/GCC/ColdFire_V2/portmacro.h @@ -1,5 +1,5 @@ /* - FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. + FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. All rights reserved VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. @@ -86,24 +86,28 @@ extern "C" { #define portDOUBLE double #define portLONG long #define portSHORT short -#define portSTACK_TYPE unsigned long +#define portSTACK_TYPE uint32_t #define portBASE_TYPE long +typedef portSTACK_TYPE StackType_t; +typedef long BaseType_t; +typedef unsigned long UBaseType_t; + #if( configUSE_16_BIT_TICKS == 1 ) - typedef unsigned portSHORT portTickType; - #define portMAX_DELAY ( portTickType ) 0xffff + typedef uint16_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffff #else - typedef unsigned portLONG portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffffUL + typedef uint32_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffffffffUL #endif /*-----------------------------------------------------------*/ /* Hardware specifics. */ #define portBYTE_ALIGNMENT 4 #define portSTACK_GROWTH -1 -#define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ ) +#define portTICK_RATE_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ ) /*-----------------------------------------------------------*/ -unsigned portLONG ulPortSetIPL( unsigned portLONG ); +uint32_t ulPortSetIPL( uint32_t ); #define portDISABLE_INTERRUPTS() ulPortSetIPL( configMAX_SYSCALL_INTERRUPT_PRIORITY ) #define portENABLE_INTERRUPTS() ulPortSetIPL( 0 ) @@ -113,8 +117,8 @@ extern void vPortExitCritical( void ); #define portENTER_CRITICAL() vPortEnterCritical() #define portEXIT_CRITICAL() vPortExitCritical() -extern unsigned portBASE_TYPE uxPortSetInterruptMaskFromISR( void ); -extern void vPortClearInterruptMaskFromISR( unsigned portBASE_TYPE ); +extern UBaseType_t uxPortSetInterruptMaskFromISR( void ); +extern void vPortClearInterruptMaskFromISR( UBaseType_t ); #define portSET_INTERRUPT_MASK_FROM_ISR() ulPortSetIPL( configMAX_SYSCALL_INTERRUPT_PRIORITY ) #define portCLEAR_INTERRUPT_MASK_FROM_ISR( uxSavedStatusRegister ) ulPortSetIPL( uxSavedStatusRegister ) diff --git a/FreeRTOS/Source/portable/GCC/H8S2329/port.c b/FreeRTOS/Source/portable/GCC/H8S2329/port.c index 157b3bf5e..5dec2fdb5 100644 --- a/FreeRTOS/Source/portable/GCC/H8S2329/port.c +++ b/FreeRTOS/Source/portable/GCC/H8S2329/port.c @@ -76,15 +76,15 @@ /*-----------------------------------------------------------*/ /* When the task starts interrupts should be enabled. */ -#define portINITIAL_CCR ( ( portSTACK_TYPE ) 0x00 ) +#define portINITIAL_CCR ( ( StackType_t ) 0x00 ) /* Hardware specific constants used to generate the RTOS tick from the TPU. */ -#define portCLEAR_ON_TGRA_COMPARE_MATCH ( ( unsigned char ) 0x20 ) -#define portCLOCK_DIV_64 ( ( unsigned char ) 0x03 ) -#define portCLOCK_DIV ( ( unsigned long ) 64 ) -#define portTGRA_INTERRUPT_ENABLE ( ( unsigned char ) 0x01 ) -#define portTIMER_CHANNEL ( ( unsigned char ) 0x02 ) -#define portMSTP13 ( ( unsigned short ) 0x2000 ) +#define portCLEAR_ON_TGRA_COMPARE_MATCH ( ( uint8_t ) 0x20 ) +#define portCLOCK_DIV_64 ( ( uint8_t ) 0x03 ) +#define portCLOCK_DIV ( ( uint32_t ) 64 ) +#define portTGRA_INTERRUPT_ENABLE ( ( uint8_t ) 0x01 ) +#define portTIMER_CHANNEL ( ( uint8_t ) 0x02 ) +#define portMSTP13 ( ( uint16_t ) 0x2000 ) /* * Setup TPU channel one for the RTOS tick at the requested frequency. @@ -101,12 +101,12 @@ void vPortYield( void ) __attribute__ ( ( saveall, interrupt_handler ) ); /* * See header file for description. */ -portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) +StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) { -unsigned long ulValue; +uint32_t ulValue; /* This requires an even address. */ - ulValue = ( unsigned long ) pxTopOfStack; + ulValue = ( uint32_t ) pxTopOfStack; if( ulValue & 1UL ) { pxTopOfStack = pxTopOfStack - 1; @@ -125,16 +125,16 @@ unsigned long ulValue; /* The initial stack mimics an interrupt stack. First there is the program counter (24 bits). */ - ulValue = ( unsigned long ) pxCode; + ulValue = ( uint32_t ) pxCode; pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) ( ulValue & 0xff ); + *pxTopOfStack = ( StackType_t ) ( ulValue & 0xff ); pxTopOfStack--; ulValue >>= 8UL; - *pxTopOfStack = ( portSTACK_TYPE ) ( ulValue & 0xff ); + *pxTopOfStack = ( StackType_t ) ( ulValue & 0xff ); pxTopOfStack--; ulValue >>= 8UL; - *pxTopOfStack = ( portSTACK_TYPE ) ( ulValue & 0xff ); + *pxTopOfStack = ( StackType_t ) ( ulValue & 0xff ); /* Followed by the CCR. */ pxTopOfStack--; @@ -155,19 +155,19 @@ unsigned long ulValue; *pxTopOfStack = 0x66; /* ER0 */ - ulValue = ( unsigned long ) pvParameters; + ulValue = ( uint32_t ) pvParameters; pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) ( ulValue & 0xff ); + *pxTopOfStack = ( StackType_t ) ( ulValue & 0xff ); pxTopOfStack--; ulValue >>= 8UL; - *pxTopOfStack = ( portSTACK_TYPE ) ( ulValue & 0xff ); + *pxTopOfStack = ( StackType_t ) ( ulValue & 0xff ); pxTopOfStack--; ulValue >>= 8UL; - *pxTopOfStack = ( portSTACK_TYPE ) ( ulValue & 0xff ); + *pxTopOfStack = ( StackType_t ) ( ulValue & 0xff ); pxTopOfStack--; ulValue >>= 8UL; - *pxTopOfStack = ( portSTACK_TYPE ) ( ulValue & 0xff ); + *pxTopOfStack = ( StackType_t ) ( ulValue & 0xff ); /* ER1 */ pxTopOfStack--; @@ -223,7 +223,7 @@ unsigned long ulValue; } /*-----------------------------------------------------------*/ -portBASE_TYPE xPortStartScheduler( void ) +BaseType_t xPortStartScheduler( void ) { extern void * pxCurrentTCB; @@ -319,7 +319,7 @@ void vPortYield( void ) */ static void prvSetupTimerInterrupt( void ) { -const unsigned long ulCompareMatch = ( configCPU_CLOCK_HZ / configTICK_RATE_HZ ) / portCLOCK_DIV; +const uint32_t ulCompareMatch = ( configCPU_CLOCK_HZ / configTICK_RATE_HZ ) / portCLOCK_DIV; /* Turn the module on. */ MSTPCR &= ~portMSTP13; diff --git a/FreeRTOS/Source/portable/GCC/H8S2329/portmacro.h b/FreeRTOS/Source/portable/GCC/H8S2329/portmacro.h index 939266ab2..8010c7848 100644 --- a/FreeRTOS/Source/portable/GCC/H8S2329/portmacro.h +++ b/FreeRTOS/Source/portable/GCC/H8S2329/portmacro.h @@ -1,5 +1,5 @@ /* - FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. + FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. All rights reserved VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. @@ -72,7 +72,7 @@ extern "C" { #endif /*----------------------------------------------------------- - * Port specific definitions. + * Port specific definitions. * * The settings in this file configure FreeRTOS correctly for the * given hardware and compiler. @@ -87,22 +87,26 @@ extern "C" { #define portDOUBLE double #define portLONG long #define portSHORT short -#define portSTACK_TYPE unsigned portCHAR +#define portSTACK_TYPE uint8_t #define portBASE_TYPE char +typedef portSTACK_TYPE StackType_t; +typedef signed char BaseType_t; +typedef unsigned char UBaseType_t; + #if( configUSE_16_BIT_TICKS == 1 ) - typedef unsigned portSHORT portTickType; - #define portMAX_DELAY ( portTickType ) 0xffff + typedef uint16_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffff #else - typedef unsigned portLONG portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffffUL + typedef uint32_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffffffffUL #endif /*-----------------------------------------------------------*/ /* Hardware specifics. */ #define portBYTE_ALIGNMENT 2 #define portSTACK_GROWTH ( -1 ) -#define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ ) +#define portTICK_RATE_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ ) #define portYIELD() asm volatile( "TRAPA #0" ) #define portNOP() asm volatile( "NOP" ) /*-----------------------------------------------------------*/ @@ -121,8 +125,8 @@ extern "C" { /* Task utilities. */ -/* Context switch macros. These macros are very simple as the context -is saved simply by selecting the saveall attribute of the context switch +/* Context switch macros. These macros are very simple as the context +is saved simply by selecting the saveall attribute of the context switch interrupt service routines. These macros save and restore the stack pointer to the TCB. */ diff --git a/FreeRTOS/Source/portable/GCC/HCS12/port.c b/FreeRTOS/Source/portable/GCC/HCS12/port.c index 8bc1c5d23..5f9752ae4 100644 --- a/FreeRTOS/Source/portable/GCC/HCS12/port.c +++ b/FreeRTOS/Source/portable/GCC/HCS12/port.c @@ -96,7 +96,7 @@ void ATTR_NEAR vPortYield( void ); void ATTR_NEAR vPortTickInterrupt( void ); /* Function in non-banked memory which actually switches to first task. */ -portBASE_TYPE ATTR_NEAR xStartSchedulerNear( void ); +BaseType_t ATTR_NEAR xStartSchedulerNear( void ); /* Calls to portENTER_CRITICAL() can be nested. When they are nested the critical section should not be left (i.e. interrupts should not be re-enabled) @@ -104,14 +104,14 @@ until the nesting depth reaches 0. This variable simply tracks the nesting depth. Each task maintains it's own critical nesting depth variable so uxCriticalNesting is saved and restored from the task stack during a context switch. */ -volatile unsigned portBASE_TYPE uxCriticalNesting = 0x80; // un-initialized +volatile UBaseType_t uxCriticalNesting = 0x80; // un-initialized /*-----------------------------------------------------------*/ /* * See header file for description. */ -portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) +StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) { @@ -121,28 +121,28 @@ portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE /* The address of the task function is placed in the stack byte at a time. */ - *pxTopOfStack = ( portSTACK_TYPE ) *( ((portSTACK_TYPE *) (&pxCode) ) + 1 ); - *--pxTopOfStack = ( portSTACK_TYPE ) *( ((portSTACK_TYPE *) (&pxCode) ) + 0 ); + *pxTopOfStack = ( StackType_t ) *( ((StackType_t *) (&pxCode) ) + 1 ); + *--pxTopOfStack = ( StackType_t ) *( ((StackType_t *) (&pxCode) ) + 0 ); /* Next are all the registers that form part of the task context. */ /* Y register */ - *--pxTopOfStack = ( portSTACK_TYPE ) 0xff; - *--pxTopOfStack = ( portSTACK_TYPE ) 0xee; + *--pxTopOfStack = ( StackType_t ) 0xff; + *--pxTopOfStack = ( StackType_t ) 0xee; /* X register */ - *--pxTopOfStack = ( portSTACK_TYPE ) 0xdd; - *--pxTopOfStack = ( portSTACK_TYPE ) 0xcc; + *--pxTopOfStack = ( StackType_t ) 0xdd; + *--pxTopOfStack = ( StackType_t ) 0xcc; /* A register contains parameter high byte. */ - *--pxTopOfStack = ( portSTACK_TYPE ) *( ((portSTACK_TYPE *) (&pvParameters) ) + 0 ); + *--pxTopOfStack = ( StackType_t ) *( ((StackType_t *) (&pvParameters) ) + 0 ); /* B register contains parameter low byte. */ - *--pxTopOfStack = ( portSTACK_TYPE ) *( ((portSTACK_TYPE *) (&pvParameters) ) + 1 ); + *--pxTopOfStack = ( StackType_t ) *( ((StackType_t *) (&pvParameters) ) + 1 ); /* CCR: Note that when the task starts interrupts will be enabled since "I" bit of CCR is cleared */ - *--pxTopOfStack = ( portSTACK_TYPE ) 0x80; // keeps Stop disabled (MCU default) + *--pxTopOfStack = ( StackType_t ) 0x80; // keeps Stop disabled (MCU default) /* tmp softregs used by GCC. Values right now don't matter. */ __asm("\n\ @@ -161,7 +161,7 @@ portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE /* The critical nesting depth is initialised with 0 (meaning not in a critical section). */ - *--pxTopOfStack = ( portSTACK_TYPE ) 0x00; + *--pxTopOfStack = ( StackType_t ) 0x00; return pxTopOfStack; @@ -183,7 +183,7 @@ static void prvSetupTimerInterrupt( void ) } /*-----------------------------------------------------------*/ -portBASE_TYPE xPortStartScheduler( void ) +BaseType_t xPortStartScheduler( void ) { /* xPortStartScheduler() does not start the scheduler directly because the header file containing the xPortStartScheduler() prototype is part @@ -191,13 +191,13 @@ portBASE_TYPE xPortStartScheduler( void ) Instead it simply calls the locally defined xNearStartScheduler() - which does use the CODE_SEG pragma. */ - short register d; + int16_t register d; __asm ("jmp xStartSchedulerNear ; will never return": "=d"(d)); return d; } /*-----------------------------------------------------------*/ -portBASE_TYPE xStartSchedulerNear( void ) +BaseType_t xStartSchedulerNear( void ) { /* Configure the timer that will generate the RTOS tick. Interrupts are disabled when this function is called. */ diff --git a/FreeRTOS/Source/portable/GCC/HCS12/portmacro.h b/FreeRTOS/Source/portable/GCC/HCS12/portmacro.h index ddf523b93..7d0e282bf 100644 --- a/FreeRTOS/Source/portable/GCC/HCS12/portmacro.h +++ b/FreeRTOS/Source/portable/GCC/HCS12/portmacro.h @@ -1,5 +1,5 @@ /* - FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. + FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. All rights reserved VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. @@ -72,7 +72,7 @@ extern "C" { #endif /*----------------------------------------------------------- - * Port specific definitions. + * Port specific definitions. * * The settings in this file configure FreeRTOS correctly for the * given hardware and compiler. @@ -87,27 +87,32 @@ extern "C" { #define portDOUBLE double #define portLONG long #define portSHORT short -#define portSTACK_TYPE unsigned portCHAR +#define portSTACK_TYPE uint8_t #define portBASE_TYPE char +typedef portSTACK_TYPE StackType_t; +typedef signed char BaseType_t; +typedef unsigned char UBaseType_t; + + #if( configUSE_16_BIT_TICKS == 1 ) - typedef unsigned portSHORT portTickType; - #define portMAX_DELAY ( portTickType ) 0xffff + typedef uint16_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffff #else - typedef unsigned portLONG portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffffUL + typedef uint32_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffffffffUL #endif /*-----------------------------------------------------------*/ /* Hardware specifics. */ #define portBYTE_ALIGNMENT 1 #define portSTACK_GROWTH ( -1 ) -#define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ ) +#define portTICK_RATE_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ ) #define portYIELD() __asm( "swi" ); /*-----------------------------------------------------------*/ /* Critical section handling. */ -#define portENABLE_INTERRUPTS() __asm( "cli" ) +#define portENABLE_INTERRUPTS() __asm( "cli" ) #define portDISABLE_INTERRUPTS() __asm( "sei" ) /* @@ -118,7 +123,7 @@ extern "C" { */ #define portENTER_CRITICAL() \ { \ - extern volatile unsigned portBASE_TYPE uxCriticalNesting; \ + extern volatile UBaseType_t uxCriticalNesting; \ \ portDISABLE_INTERRUPTS(); \ uxCriticalNesting++; \ @@ -126,12 +131,12 @@ extern "C" { /* * Interrupts are disabled so we can access the nesting count directly. If the - * nesting is found to be 0 (no nesting) then we are leaving the critical + * nesting is found to be 0 (no nesting) then we are leaving the critical * section and interrupts can be re-enabled. */ #define portEXIT_CRITICAL() \ { \ - extern volatile unsigned portBASE_TYPE uxCriticalNesting; \ + extern volatile UBaseType_t uxCriticalNesting; \ \ uxCriticalNesting--; \ if( uxCriticalNesting == 0 ) \ @@ -143,10 +148,10 @@ extern "C" { /* Task utilities. */ -/* - * These macros are very simple as the processor automatically saves and +/* + * These macros are very simple as the processor automatically saves and * restores its registers as interrupts are entered and exited. In - * addition to the (automatically stacked) registers we also stack the + * addition to the (automatically stacked) registers we also stack the * critical nesting count. Each task maintains its own critical nesting * count as it is legitimate for a task to yield from within a critical * section. If the banked memory model is being used then the PPAGE @@ -154,9 +159,9 @@ extern "C" { */ #ifdef BANKED_MODEL - /* + /* * Load the stack pointer for the task, then pull the critical nesting - * count and PPAGE register from the stack. The remains of the + * count and PPAGE register from the stack. The remains of the * context are restored by the RTI instruction. */ #define portRESTORE_CONTEXT() \ @@ -173,9 +178,9 @@ extern "C" { " ); \ } - /* + /* * By the time this macro is called the processor has already stacked the - * registers. Simply stack the nesting count and PPAGE value, then save + * registers. Simply stack the nesting count and PPAGE value, then save * the task stack pointer. */ #define portSAVE_CONTEXT() \ @@ -193,7 +198,7 @@ extern "C" { } #else - /* + /* * These macros are as per the BANKED versions above, but without saving * and restoring the PPAGE register. */ diff --git a/FreeRTOS/Source/portable/GCC/MCF5235/port.c b/FreeRTOS/Source/portable/GCC/MCF5235/port.c index f5b6e4f68..cb3d2c1d8 100644 --- a/FreeRTOS/Source/portable/GCC/MCF5235/port.c +++ b/FreeRTOS/Source/portable/GCC/MCF5235/port.c @@ -58,9 +58,9 @@ #include "task.h" /* ------------------------ Types ----------------------------------------- */ -typedef volatile unsigned long vuint32; -typedef volatile unsigned short vuint16; -typedef volatile unsigned char vuint8; +typedef volatile uint32_t vuint32; +typedef volatile uint16_t vuint16; +typedef volatile uint8_t vuint8; /* ------------------------ Defines --------------------------------------- */ #define portVECTOR_TABLE __RAMVEC @@ -86,11 +86,11 @@ typedef volatile unsigned char vuint8; #define MCF_INTC0_ICRn_IP(x) ( ( ( x ) & 0x07 ) << 0 ) #define MCF_INTC0_ICRn_IL(x) ( ( ( x ) & 0x07 ) << 3 ) -#define portNO_CRITICAL_NESTING ( ( unsigned long ) 0 ) -#define portINITIAL_CRITICAL_NESTING ( ( unsigned long ) 10 ) +#define portNO_CRITICAL_NESTING ( ( uint32_t ) 0 ) +#define portINITIAL_CRITICAL_NESTING ( ( uint32_t ) 10 ) /* ------------------------ Static variables ------------------------------ */ -volatile unsigned long ulCriticalNesting = portINITIAL_CRITICAL_NESTING; +volatile uint32_t ulCriticalNesting = portINITIAL_CRITICAL_NESTING; /* ------------------------ Static functions ------------------------------ */ #if configUSE_PREEMPTION == 0 @@ -101,22 +101,22 @@ static void prvPortPreemptiveTick ( void ); /* ------------------------ Start implementation -------------------------- */ -portSTACK_TYPE * -pxPortInitialiseStack( portSTACK_TYPE * pxTopOfStack, pdTASK_CODE pxCode, +StackType_t * +pxPortInitialiseStack( StackType_t * pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) { /* Place the parameter on the stack in the expected location. */ - *pxTopOfStack = ( portSTACK_TYPE ) pvParameters; + *pxTopOfStack = ( StackType_t ) pvParameters; pxTopOfStack--; /* Place dummy return address on stack. Tasks should never terminate so * we can set this to anything. */ - *pxTopOfStack = ( portSTACK_TYPE ) 0; + *pxTopOfStack = ( StackType_t ) 0; pxTopOfStack--; /* Create a Motorola Coldfire exception stack frame. First comes the return * address. */ - *pxTopOfStack = ( portSTACK_TYPE ) pxCode; + *pxTopOfStack = ( StackType_t ) pxCode; pxTopOfStack--; /* Format, fault-status, vector number for exception stack frame. Task @@ -129,35 +129,35 @@ pxPortInitialiseStack( portSTACK_TYPE * pxTopOfStack, pdTASK_CODE pxCode, *pxTopOfStack = 0; *pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0xA6; /* A6 / FP */ + *pxTopOfStack = ( StackType_t ) 0xA6; /* A6 / FP */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0xA5; /* A5 */ + *pxTopOfStack = ( StackType_t ) 0xA5; /* A5 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0xA4; /* A4 */ + *pxTopOfStack = ( StackType_t ) 0xA4; /* A4 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0xA3; /* A3 */ + *pxTopOfStack = ( StackType_t ) 0xA3; /* A3 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0xA2; /* A2 */ + *pxTopOfStack = ( StackType_t ) 0xA2; /* A2 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0xA1; /* A1 */ + *pxTopOfStack = ( StackType_t ) 0xA1; /* A1 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0xA0; /* A0 */ + *pxTopOfStack = ( StackType_t ) 0xA0; /* A0 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0xD7; /* D7 */ + *pxTopOfStack = ( StackType_t ) 0xD7; /* D7 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0xD6; /* D6 */ + *pxTopOfStack = ( StackType_t ) 0xD6; /* D6 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0xD5; /* D5 */ + *pxTopOfStack = ( StackType_t ) 0xD5; /* D5 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0xD4; /* D4 */ + *pxTopOfStack = ( StackType_t ) 0xD4; /* D4 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0xD3; /* D3 */ + *pxTopOfStack = ( StackType_t ) 0xD3; /* D3 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0xD2; /* D2 */ + *pxTopOfStack = ( StackType_t ) 0xD2; /* D2 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0xD1; /* D1 */ + *pxTopOfStack = ( StackType_t ) 0xD1; /* D1 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0xD0; /* D0 */ + *pxTopOfStack = ( StackType_t ) 0xD0; /* D0 */ return pxTopOfStack; } @@ -248,7 +248,7 @@ vPortExitCritical() } } -portBASE_TYPE +BaseType_t xPortStartScheduler( void ) { extern void ( *portVECTOR_TABLE[ ] ) ( ); diff --git a/FreeRTOS/Source/portable/GCC/MCF5235/portmacro.h b/FreeRTOS/Source/portable/GCC/MCF5235/portmacro.h index e986d6d26..32455c40f 100644 --- a/FreeRTOS/Source/portable/GCC/MCF5235/portmacro.h +++ b/FreeRTOS/Source/portable/GCC/MCF5235/portmacro.h @@ -41,13 +41,13 @@ Please ensure to read the configuration and relevant port sections of the online documentation. - http://www.FreeRTOS.org - Documentation, latest information, license and + http://www.FreeRTOS.org - Documentation, latest information, license and contact details. - http://www.SafeRTOS.com - A version that is certified for use in safety + http://www.SafeRTOS.com - A version that is certified for use in safety critical systems. - http://www.OpenRTOS.com - Commercial support, development, porting, + http://www.OpenRTOS.com - Commercial support, development, porting, licensing and training services. */ @@ -67,17 +67,21 @@ extern "C" { #define portSTACK_TYPE unsigned int #define portBASE_TYPE int +typedef portSTACK_TYPE StackType_t; +typedef long BaseType_t; +typedef unsigned long UBaseType_t; + #if( configUSE_16_BIT_TICKS == 1 ) - typedef unsigned portSHORT portTickType; - #define portMAX_DELAY ( portTickType ) 0xffff + typedef uint16_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffff #else - typedef unsigned portLONG portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffffUL + typedef uint32_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffffffffUL #endif /* ------------------------ Architecture specifics ------------------------ */ #define portSTACK_GROWTH ( -1 ) -#define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ ) +#define portTICK_RATE_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ ) #define portBYTE_ALIGNMENT 4 #define portTRAP_YIELD 0 /* Trap 0 */ @@ -160,7 +164,7 @@ extern "C" { /* ------------------------ Function prototypes --------------------------- */ void vPortEnterCritical( void ); void vPortExitCritical( void ); -int asm_set_ipl( unsigned long int uiNewIPL ); +int asm_set_ipl( uint32_t int uiNewIPL ); /* ------------------------ Compiler specifics ---------------------------- */ #define portTASK_FUNCTION_PROTO( vFunction, pvParameters ) \ diff --git a/FreeRTOS/Source/portable/GCC/MSP430F449/port.c b/FreeRTOS/Source/portable/GCC/MSP430F449/port.c index 49b247e86..c67277f67 100644 --- a/FreeRTOS/Source/portable/GCC/MSP430F449/port.c +++ b/FreeRTOS/Source/portable/GCC/MSP430F449/port.c @@ -83,14 +83,14 @@ /* Constants required for hardware setup. The tick ISR runs off the ACLK, not the MCLK. */ -#define portACLK_FREQUENCY_HZ ( ( portTickType ) 32768 ) -#define portINITIAL_CRITICAL_NESTING ( ( unsigned short ) 10 ) -#define portFLAGS_INT_ENABLED ( ( portSTACK_TYPE ) 0x08 ) +#define portACLK_FREQUENCY_HZ ( ( TickType_t ) 32768 ) +#define portINITIAL_CRITICAL_NESTING ( ( uint16_t ) 10 ) +#define portFLAGS_INT_ENABLED ( ( StackType_t ) 0x08 ) /* We require the address of the pxCurrentTCB variable, but don't want to know any details of its type. */ -typedef void tskTCB; -extern volatile tskTCB * volatile pxCurrentTCB; +typedef void TCB_t; +extern volatile TCB_t * volatile pxCurrentTCB; /* Most ports implement critical sections by placing the interrupt flags on the stack before disabling interrupts. Exiting the critical section is then @@ -104,7 +104,7 @@ with interrupts only being re-enabled if the count is zero. usCriticalNesting will get set to zero when the scheduler starts, but must not be initialised to zero as this will cause problems during the startup sequence. */ -volatile unsigned short usCriticalNesting = portINITIAL_CRITICAL_NESTING; +volatile uint16_t usCriticalNesting = portINITIAL_CRITICAL_NESTING; /*-----------------------------------------------------------*/ /* @@ -178,17 +178,17 @@ static void prvSetupTimerInterrupt( void ); * * See the header file portable.h. */ -portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) +StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) { /* Place a few bytes of known values on the bottom of the stack. This is just useful for debugging and can be included if required. - *pxTopOfStack = ( portSTACK_TYPE ) 0x1111; + *pxTopOfStack = ( StackType_t ) 0x1111; pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x2222; + *pxTopOfStack = ( StackType_t ) 0x2222; pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x3333; + *pxTopOfStack = ( StackType_t ) 0x3333; pxTopOfStack--; */ @@ -196,38 +196,38 @@ portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE executing an ISR. We want the stack to look just as if this has happened so place a pointer to the start of the task on the stack first - followed by the flags we want the task to use when it starts up. */ - *pxTopOfStack = ( portSTACK_TYPE ) pxCode; + *pxTopOfStack = ( StackType_t ) pxCode; pxTopOfStack--; *pxTopOfStack = portFLAGS_INT_ENABLED; pxTopOfStack--; /* Next the general purpose registers. */ - *pxTopOfStack = ( portSTACK_TYPE ) 0x4444; + *pxTopOfStack = ( StackType_t ) 0x4444; pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x5555; + *pxTopOfStack = ( StackType_t ) 0x5555; pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x6666; + *pxTopOfStack = ( StackType_t ) 0x6666; pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x7777; + *pxTopOfStack = ( StackType_t ) 0x7777; pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x8888; + *pxTopOfStack = ( StackType_t ) 0x8888; pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x9999; + *pxTopOfStack = ( StackType_t ) 0x9999; pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0xaaaa; + *pxTopOfStack = ( StackType_t ) 0xaaaa; pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0xbbbb; + *pxTopOfStack = ( StackType_t ) 0xbbbb; pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0xcccc; + *pxTopOfStack = ( StackType_t ) 0xcccc; pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0xdddd; + *pxTopOfStack = ( StackType_t ) 0xdddd; pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0xeeee; + *pxTopOfStack = ( StackType_t ) 0xeeee; pxTopOfStack--; /* When the task starts is will expect to find the function parameter in R15. */ - *pxTopOfStack = ( portSTACK_TYPE ) pvParameters; + *pxTopOfStack = ( StackType_t ) pvParameters; pxTopOfStack--; /* The code generated by the mspgcc compiler does not maintain separate @@ -235,7 +235,7 @@ portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE use the stack as per other ports. Instead a variable is used to keep track of the critical section nesting. This variable has to be stored as part of the task context and is initially set to zero. */ - *pxTopOfStack = ( portSTACK_TYPE ) portNO_CRITICAL_SECTION_NESTING; + *pxTopOfStack = ( StackType_t ) portNO_CRITICAL_SECTION_NESTING; /* Return a pointer to the top of the stack we have generated so this can be stored in the task control block for the task. */ @@ -243,7 +243,7 @@ portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE } /*-----------------------------------------------------------*/ -portBASE_TYPE xPortStartScheduler( void ) +BaseType_t xPortStartScheduler( void ) { /* Setup the hardware to generate the tick. Interrupts are disabled when this function is called. */ diff --git a/FreeRTOS/Source/portable/GCC/MSP430F449/portmacro.h b/FreeRTOS/Source/portable/GCC/MSP430F449/portmacro.h index dbe229bee..901c47b42 100644 --- a/FreeRTOS/Source/portable/GCC/MSP430F449/portmacro.h +++ b/FreeRTOS/Source/portable/GCC/MSP430F449/portmacro.h @@ -1,5 +1,5 @@ /* - FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. + FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. All rights reserved VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. @@ -71,7 +71,7 @@ extern "C" { #endif /*----------------------------------------------------------- - * Port specific definitions. + * Port specific definitions. * * The settings in this file configure FreeRTOS correctly for the * given hardware and compiler. @@ -86,17 +86,21 @@ extern "C" { #define portDOUBLE double #define portLONG long #define portSHORT int -#define portSTACK_TYPE unsigned portSHORT -#define portBASE_TYPE portSHORT +#define portSTACK_TYPE uint16_t +#define portBASE_TYPE short + +typedef portSTACK_TYPE StackType_t; +typedef short BaseType_t; +typedef unsigned short UBaseType_t; #if( configUSE_16_BIT_TICKS == 1 ) - typedef unsigned portSHORT portTickType; - #define portMAX_DELAY ( portTickType ) 0xffff + typedef uint16_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffff #else - typedef unsigned portLONG portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffffUL + typedef uint32_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffffffffUL #endif -/*-----------------------------------------------------------*/ +/*-----------------------------------------------------------*/ /* Interrupt control macros. */ #define portDISABLE_INTERRUPTS() asm volatile ( "DINT" ); asm volatile ( "NOP" ) @@ -104,11 +108,11 @@ extern "C" { /*-----------------------------------------------------------*/ /* Critical section control macros. */ -#define portNO_CRITICAL_SECTION_NESTING ( ( unsigned portSHORT ) 0 ) +#define portNO_CRITICAL_SECTION_NESTING ( ( uint16_t ) 0 ) #define portENTER_CRITICAL() \ { \ -extern volatile unsigned portSHORT usCriticalNesting; \ +extern volatile uint16_t usCriticalNesting; \ \ portDISABLE_INTERRUPTS(); \ \ @@ -120,7 +124,7 @@ extern volatile unsigned portSHORT usCriticalNesting; \ #define portEXIT_CRITICAL() \ { \ -extern volatile unsigned portSHORT usCriticalNesting; \ +extern volatile uint16_t usCriticalNesting; \ \ if( usCriticalNesting > portNO_CRITICAL_SECTION_NESTING ) \ { \ @@ -146,7 +150,7 @@ extern void vPortYield( void ) __attribute__ ( ( naked ) ); /* Hardwware specifics. */ #define portBYTE_ALIGNMENT 2 #define portSTACK_GROWTH ( -1 ) -#define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ ) +#define portTICK_RATE_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ ) /*-----------------------------------------------------------*/ /* Task function macros as described on the FreeRTOS.org WEB site. */ diff --git a/FreeRTOS/Source/portable/GCC/MicroBlaze/port.c b/FreeRTOS/Source/portable/GCC/MicroBlaze/port.c index 04434041a..b4726ee95 100644 --- a/FreeRTOS/Source/portable/GCC/MicroBlaze/port.c +++ b/FreeRTOS/Source/portable/GCC/MicroBlaze/port.c @@ -81,7 +81,7 @@ #include /* Tasks are started with interrupts enabled. */ -#define portINITIAL_MSR_STATE ( ( portSTACK_TYPE ) 0x02 ) +#define portINITIAL_MSR_STATE ( ( StackType_t ) 0x02 ) /* Tasks are started with a critical section nesting of 0 - however prior to the scheduler being commenced we don't want the critical nesting level @@ -98,11 +98,11 @@ debugging. */ /* Counts the nesting depth of calls to portENTER_CRITICAL(). Each task maintains it's own count, so this variable is saved as part of the task context. */ -volatile unsigned portBASE_TYPE uxCriticalNesting = portINITIAL_NESTING_VALUE; +volatile UBaseType_t uxCriticalNesting = portINITIAL_NESTING_VALUE; /* To limit the amount of stack required by each task, this port uses a separate stack for interrupts. */ -unsigned long *pulISRStack; +uint32_t *pulISRStack; /*-----------------------------------------------------------*/ @@ -119,93 +119,93 @@ static void prvSetupTimerInterrupt( void ); * * See the header file portable.h. */ -portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) +StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) { extern void *_SDA2_BASE_, *_SDA_BASE_; -const unsigned long ulR2 = ( unsigned long ) &_SDA2_BASE_; -const unsigned long ulR13 = ( unsigned long ) &_SDA_BASE_; +const uint32_t ulR2 = ( uint32_t ) &_SDA2_BASE_; +const uint32_t ulR13 = ( uint32_t ) &_SDA_BASE_; /* Place a few bytes of known values on the bottom of the stack. This is essential for the Microblaze port and these lines must not be omitted. The parameter value will overwrite the 0x22222222 value during the function prologue. */ - *pxTopOfStack = ( portSTACK_TYPE ) 0x11111111; + *pxTopOfStack = ( StackType_t ) 0x11111111; pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x22222222; + *pxTopOfStack = ( StackType_t ) 0x22222222; pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x33333333; + *pxTopOfStack = ( StackType_t ) 0x33333333; pxTopOfStack--; /* First stack an initial value for the critical section nesting. This is initialised to zero as tasks are started with interrupts enabled. */ - *pxTopOfStack = ( portSTACK_TYPE ) 0x00; /* R0. */ + *pxTopOfStack = ( StackType_t ) 0x00; /* R0. */ /* Place an initial value for all the general purpose registers. */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) ulR2; /* R2 - small data area. */ + *pxTopOfStack = ( StackType_t ) ulR2; /* R2 - small data area. */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x03; /* R3. */ + *pxTopOfStack = ( StackType_t ) 0x03; /* R3. */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x04; /* R4. */ + *pxTopOfStack = ( StackType_t ) 0x04; /* R4. */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) pvParameters;/* R5 contains the function call parameters. */ + *pxTopOfStack = ( StackType_t ) pvParameters;/* R5 contains the function call parameters. */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x06; /* R6. */ + *pxTopOfStack = ( StackType_t ) 0x06; /* R6. */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x07; /* R7. */ + *pxTopOfStack = ( StackType_t ) 0x07; /* R7. */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x08; /* R8. */ + *pxTopOfStack = ( StackType_t ) 0x08; /* R8. */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x09; /* R9. */ + *pxTopOfStack = ( StackType_t ) 0x09; /* R9. */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x0a; /* R10. */ + *pxTopOfStack = ( StackType_t ) 0x0a; /* R10. */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x0b; /* R11. */ + *pxTopOfStack = ( StackType_t ) 0x0b; /* R11. */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x0c; /* R12. */ + *pxTopOfStack = ( StackType_t ) 0x0c; /* R12. */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) ulR13; /* R13 - small data read write area. */ + *pxTopOfStack = ( StackType_t ) ulR13; /* R13 - small data read write area. */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) pxCode; /* R14. */ + *pxTopOfStack = ( StackType_t ) pxCode; /* R14. */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x0f; /* R15. */ + *pxTopOfStack = ( StackType_t ) 0x0f; /* R15. */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x10; /* R16. */ + *pxTopOfStack = ( StackType_t ) 0x10; /* R16. */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x11; /* R17. */ + *pxTopOfStack = ( StackType_t ) 0x11; /* R17. */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x12; /* R18. */ + *pxTopOfStack = ( StackType_t ) 0x12; /* R18. */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x13; /* R19. */ + *pxTopOfStack = ( StackType_t ) 0x13; /* R19. */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x14; /* R20. */ + *pxTopOfStack = ( StackType_t ) 0x14; /* R20. */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x15; /* R21. */ + *pxTopOfStack = ( StackType_t ) 0x15; /* R21. */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x16; /* R22. */ + *pxTopOfStack = ( StackType_t ) 0x16; /* R22. */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x17; /* R23. */ + *pxTopOfStack = ( StackType_t ) 0x17; /* R23. */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x18; /* R24. */ + *pxTopOfStack = ( StackType_t ) 0x18; /* R24. */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x19; /* R25. */ + *pxTopOfStack = ( StackType_t ) 0x19; /* R25. */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x1a; /* R26. */ + *pxTopOfStack = ( StackType_t ) 0x1a; /* R26. */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x1b; /* R27. */ + *pxTopOfStack = ( StackType_t ) 0x1b; /* R27. */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x1c; /* R28. */ + *pxTopOfStack = ( StackType_t ) 0x1c; /* R28. */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x1d; /* R29. */ + *pxTopOfStack = ( StackType_t ) 0x1d; /* R29. */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x1e; /* R30. */ + *pxTopOfStack = ( StackType_t ) 0x1e; /* R30. */ pxTopOfStack--; /* The MSR is stacked between R30 and R31. */ *pxTopOfStack = portINITIAL_MSR_STATE; pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x1f; /* R31. */ + *pxTopOfStack = ( StackType_t ) 0x1f; /* R31. */ pxTopOfStack--; /* Return a pointer to the top of the stack we have generated so this can @@ -214,7 +214,7 @@ const unsigned long ulR13 = ( unsigned long ) &_SDA_BASE_; } /*-----------------------------------------------------------*/ -portBASE_TYPE xPortStartScheduler( void ) +BaseType_t xPortStartScheduler( void ) { extern void ( __FreeRTOS_interrupt_Handler )( void ); extern void ( vStartFirstTask )( void ); @@ -232,13 +232,13 @@ extern void ( vStartFirstTask )( void ); prvSetupTimerInterrupt(); /* Allocate the stack to be used by the interrupt handler. */ - pulISRStack = ( unsigned long * ) pvPortMalloc( configMINIMAL_STACK_SIZE * sizeof( portSTACK_TYPE ) ); + pulISRStack = ( uint32_t * ) pvPortMalloc( configMINIMAL_STACK_SIZE * sizeof( StackType_t ) ); /* Restore the context of the first task that is going to run. */ if( pulISRStack != NULL ) { /* Fill the ISR stack with a known value to facilitate debugging. */ - memset( pulISRStack, portISR_STACK_FILL_VALUE, configMINIMAL_STACK_SIZE * sizeof( portSTACK_TYPE ) ); + memset( pulISRStack, portISR_STACK_FILL_VALUE, configMINIMAL_STACK_SIZE * sizeof( StackType_t ) ); pulISRStack += ( configMINIMAL_STACK_SIZE - 1 ); /* Kick off the first task. */ @@ -281,8 +281,8 @@ extern void VPortYieldASM( void ); static void prvSetupTimerInterrupt( void ) { XTmrCtr xTimer; -const unsigned long ulCounterValue = configCPU_CLOCK_HZ / configTICK_RATE_HZ; -unsigned portBASE_TYPE uxMask; +const uint32_t ulCounterValue = configCPU_CLOCK_HZ / configTICK_RATE_HZ; +UBaseType_t uxMask; /* The OPB timer1 is used to generate the tick. Use the provided library functions to enable the timer and set the tick frequency. */ @@ -311,7 +311,7 @@ unsigned portBASE_TYPE uxMask; */ void vTaskISRHandler( void ) { -static unsigned long ulPending; +static uint32_t ulPending; /* Which interrupts are pending? */ ulPending = XIntc_In32( ( XPAR_INTC_SINGLE_BASEADDR + XIN_IVR_OFFSET ) ); @@ -320,12 +320,12 @@ static unsigned long ulPending; { static XIntc_VectorTableEntry *pxTablePtr; static XIntc_Config *pxConfig; - static unsigned long ulInterruptMask; + static uint32_t ulInterruptMask; - ulInterruptMask = ( unsigned long ) 1 << ulPending; + ulInterruptMask = ( uint32_t ) 1 << ulPending; /* Get the configuration data using the device ID */ - pxConfig = &XIntc_ConfigTable[ ( unsigned long ) XPAR_INTC_SINGLE_DEVICE_ID ]; + pxConfig = &XIntc_ConfigTable[ ( uint32_t ) XPAR_INTC_SINGLE_DEVICE_ID ]; pxTablePtr = &( pxConfig->HandlerTable[ ulPending ] ); if( pxConfig->AckBeforeService & ( ulInterruptMask ) ) @@ -347,7 +347,7 @@ static unsigned long ulPending; */ void vTickISR( void *pvBaseAddress ) { -unsigned long ulCSR; +uint32_t ulCSR; /* Increment the RTOS tick - this might cause a task to unblock. */ if( xTaskIncrementTick() != pdFALSE ) diff --git a/FreeRTOS/Source/portable/GCC/MicroBlaze/portmacro.h b/FreeRTOS/Source/portable/GCC/MicroBlaze/portmacro.h index 39d70723e..9a6f76422 100644 --- a/FreeRTOS/Source/portable/GCC/MicroBlaze/portmacro.h +++ b/FreeRTOS/Source/portable/GCC/MicroBlaze/portmacro.h @@ -1,5 +1,5 @@ /* - FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. + FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. All rights reserved VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. @@ -71,7 +71,7 @@ extern "C" { #endif /*----------------------------------------------------------- - * Port specific definitions. + * Port specific definitions. * * The settings in this file configure FreeRTOS correctly for the * given hardware and compiler. @@ -86,17 +86,21 @@ extern "C" { #define portDOUBLE double #define portLONG long #define portSHORT short -#define portSTACK_TYPE unsigned portLONG -#define portBASE_TYPE portLONG +#define portSTACK_TYPE uint32_t +#define portBASE_TYPE long + +typedef portSTACK_TYPE StackType_t; +typedef long BaseType_t; +typedef unsigned long UBaseType_t; #if( configUSE_16_BIT_TICKS == 1 ) - typedef unsigned portSHORT portTickType; - #define portMAX_DELAY ( portTickType ) 0xffff + typedef uint16_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffff #else - typedef unsigned portLONG portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffffUL + typedef uint32_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffffffffUL #endif -/*-----------------------------------------------------------*/ +/*-----------------------------------------------------------*/ /* Interrupt control macros. */ void microblaze_disable_interrupts( void ); @@ -109,13 +113,13 @@ void microblaze_enable_interrupts( void ); void vPortEnterCritical( void ); void vPortExitCritical( void ); #define portENTER_CRITICAL() { \ - extern unsigned portBASE_TYPE uxCriticalNesting; \ + extern UBaseType_t uxCriticalNesting; \ microblaze_disable_interrupts(); \ uxCriticalNesting++; \ } - + #define portEXIT_CRITICAL() { \ - extern unsigned portBASE_TYPE uxCriticalNesting; \ + extern UBaseType_t uxCriticalNesting; \ /* Interrupts are disabled, so we can */ \ /* access the variable directly. */ \ uxCriticalNesting--; \ @@ -140,7 +144,7 @@ void vTaskSwitchContext(); /* Hardware specifics. */ #define portBYTE_ALIGNMENT 4 #define portSTACK_GROWTH ( -1 ) -#define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ ) +#define portTICK_RATE_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ ) #define portNOP() asm volatile ( "NOP" ) /*-----------------------------------------------------------*/ diff --git a/FreeRTOS/Source/portable/GCC/MicroBlazeV8/port.c b/FreeRTOS/Source/portable/GCC/MicroBlazeV8/port.c index 1fe020a30..f6cb4f3ee 100644 --- a/FreeRTOS/Source/portable/GCC/MicroBlazeV8/port.c +++ b/FreeRTOS/Source/portable/GCC/MicroBlazeV8/port.c @@ -98,24 +98,24 @@ created. */ /* * Initialise the interrupt controller instance. */ -static long prvInitialiseInterruptController( void ); +static int32_t prvInitialiseInterruptController( void ); /* Ensure the interrupt controller instance variable is initialised before it is * used, and that the initialisation only happens once. */ -static long prvEnsureInterruptControllerIsInitialised( void ); +static int32_t prvEnsureInterruptControllerIsInitialised( void ); /*-----------------------------------------------------------*/ /* Counts the nesting depth of calls to portENTER_CRITICAL(). Each task maintains its own count, so this variable is saved as part of the task context. */ -volatile unsigned portBASE_TYPE uxCriticalNesting = portINITIAL_NESTING_VALUE; +volatile UBaseType_t uxCriticalNesting = portINITIAL_NESTING_VALUE; /* This port uses a separate stack for interrupts. This prevents the stack of every task needing to be large enough to hold an entire interrupt stack on top of the task stack. */ -unsigned long *pulISRStack; +uint32_t *pulISRStack; /* If an interrupt requests a context switch, then ulTaskSwitchRequested will get set to 1. ulTaskSwitchRequested is inspected just before the main interrupt @@ -125,7 +125,7 @@ the interrupt exists is the highest priority task that is able to run. This is an unusual mechanism, but is used for this port because a single interrupt can cause the servicing of multiple peripherals - and it is inefficient to call vTaskSwitchContext() multiple times as each peripheral is serviced. */ -volatile unsigned long ulTaskSwitchRequested = 0UL; +volatile uint32_t ulTaskSwitchRequested = 0UL; /* The instance of the interrupt controller used by this port. This is required by the Xilinx library API functions. */ @@ -139,20 +139,20 @@ static XIntc xInterruptControllerInstance; * * See the portable.h header file. */ -portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) +StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) { extern void *_SDA2_BASE_, *_SDA_BASE_; -const unsigned long ulR2 = ( unsigned long ) &_SDA2_BASE_; -const unsigned long ulR13 = ( unsigned long ) &_SDA_BASE_; +const uint32_t ulR2 = ( uint32_t ) &_SDA2_BASE_; +const uint32_t ulR13 = ( uint32_t ) &_SDA_BASE_; /* Place a few bytes of known values on the bottom of the stack. This is essential for the Microblaze port and these lines must not be omitted. */ - *pxTopOfStack = ( portSTACK_TYPE ) 0x00000000; + *pxTopOfStack = ( StackType_t ) 0x00000000; pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x00000000; + *pxTopOfStack = ( StackType_t ) 0x00000000; pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x00000000; + *pxTopOfStack = ( StackType_t ) 0x00000000; pxTopOfStack--; #if XPAR_MICROBLAZE_0_USE_FPU == 1 @@ -169,86 +169,86 @@ const unsigned long ulR13 = ( unsigned long ) &_SDA_BASE_; /* First stack an initial value for the critical section nesting. This is initialised to zero. */ - *pxTopOfStack = ( portSTACK_TYPE ) 0x00; + *pxTopOfStack = ( StackType_t ) 0x00; /* R0 is always zero. */ /* R1 is the SP. */ /* Place an initial value for all the general purpose registers. */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) ulR2; /* R2 - read only small data area. */ + *pxTopOfStack = ( StackType_t ) ulR2; /* R2 - read only small data area. */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x03; /* R3 - return values and temporaries. */ + *pxTopOfStack = ( StackType_t ) 0x03; /* R3 - return values and temporaries. */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x04; /* R4 - return values and temporaries. */ + *pxTopOfStack = ( StackType_t ) 0x04; /* R4 - return values and temporaries. */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) pvParameters;/* R5 contains the function call parameters. */ + *pxTopOfStack = ( StackType_t ) pvParameters;/* R5 contains the function call parameters. */ #ifdef portPRE_LOAD_STACK_FOR_DEBUGGING pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x06; /* R6 - other parameters and temporaries. Used as the return address from vPortTaskEntryPoint. */ + *pxTopOfStack = ( StackType_t ) 0x06; /* R6 - other parameters and temporaries. Used as the return address from vPortTaskEntryPoint. */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x07; /* R7 - other parameters and temporaries. */ + *pxTopOfStack = ( StackType_t ) 0x07; /* R7 - other parameters and temporaries. */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x08; /* R8 - other parameters and temporaries. */ + *pxTopOfStack = ( StackType_t ) 0x08; /* R8 - other parameters and temporaries. */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x09; /* R9 - other parameters and temporaries. */ + *pxTopOfStack = ( StackType_t ) 0x09; /* R9 - other parameters and temporaries. */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x0a; /* R10 - other parameters and temporaries. */ + *pxTopOfStack = ( StackType_t ) 0x0a; /* R10 - other parameters and temporaries. */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x0b; /* R11 - temporaries. */ + *pxTopOfStack = ( StackType_t ) 0x0b; /* R11 - temporaries. */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x0c; /* R12 - temporaries. */ + *pxTopOfStack = ( StackType_t ) 0x0c; /* R12 - temporaries. */ pxTopOfStack--; #else pxTopOfStack-= 8; #endif - *pxTopOfStack = ( portSTACK_TYPE ) ulR13; /* R13 - read/write small data area. */ + *pxTopOfStack = ( StackType_t ) ulR13; /* R13 - read/write small data area. */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) pxCode; /* R14 - return address for interrupt. */ + *pxTopOfStack = ( StackType_t ) pxCode; /* R14 - return address for interrupt. */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) NULL; /* R15 - return address for subroutine. */ + *pxTopOfStack = ( StackType_t ) NULL; /* R15 - return address for subroutine. */ #ifdef portPRE_LOAD_STACK_FOR_DEBUGGING pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x10; /* R16 - return address for trap (debugger). */ + *pxTopOfStack = ( StackType_t ) 0x10; /* R16 - return address for trap (debugger). */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x11; /* R17 - return address for exceptions, if configured. */ + *pxTopOfStack = ( StackType_t ) 0x11; /* R17 - return address for exceptions, if configured. */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x12; /* R18 - reserved for assembler and compiler temporaries. */ + *pxTopOfStack = ( StackType_t ) 0x12; /* R18 - reserved for assembler and compiler temporaries. */ pxTopOfStack--; #else pxTopOfStack -= 4; #endif - *pxTopOfStack = ( portSTACK_TYPE ) 0x00; /* R19 - must be saved across function calls. Callee-save. Seems to be interpreted as the frame pointer. */ + *pxTopOfStack = ( StackType_t ) 0x00; /* R19 - must be saved across function calls. Callee-save. Seems to be interpreted as the frame pointer. */ #ifdef portPRE_LOAD_STACK_FOR_DEBUGGING pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x14; /* R20 - reserved for storing a pointer to the Global Offset Table (GOT) in Position Independent Code (PIC). Non-volatile in non-PIC code. Must be saved across function calls. Callee-save. Not used by FreeRTOS. */ + *pxTopOfStack = ( StackType_t ) 0x14; /* R20 - reserved for storing a pointer to the Global Offset Table (GOT) in Position Independent Code (PIC). Non-volatile in non-PIC code. Must be saved across function calls. Callee-save. Not used by FreeRTOS. */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x15; /* R21 - must be saved across function calls. Callee-save. */ + *pxTopOfStack = ( StackType_t ) 0x15; /* R21 - must be saved across function calls. Callee-save. */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x16; /* R22 - must be saved across function calls. Callee-save. */ + *pxTopOfStack = ( StackType_t ) 0x16; /* R22 - must be saved across function calls. Callee-save. */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x17; /* R23 - must be saved across function calls. Callee-save. */ + *pxTopOfStack = ( StackType_t ) 0x17; /* R23 - must be saved across function calls. Callee-save. */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x18; /* R24 - must be saved across function calls. Callee-save. */ + *pxTopOfStack = ( StackType_t ) 0x18; /* R24 - must be saved across function calls. Callee-save. */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x19; /* R25 - must be saved across function calls. Callee-save. */ + *pxTopOfStack = ( StackType_t ) 0x19; /* R25 - must be saved across function calls. Callee-save. */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x1a; /* R26 - must be saved across function calls. Callee-save. */ + *pxTopOfStack = ( StackType_t ) 0x1a; /* R26 - must be saved across function calls. Callee-save. */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x1b; /* R27 - must be saved across function calls. Callee-save. */ + *pxTopOfStack = ( StackType_t ) 0x1b; /* R27 - must be saved across function calls. Callee-save. */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x1c; /* R28 - must be saved across function calls. Callee-save. */ + *pxTopOfStack = ( StackType_t ) 0x1c; /* R28 - must be saved across function calls. Callee-save. */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x1d; /* R29 - must be saved across function calls. Callee-save. */ + *pxTopOfStack = ( StackType_t ) 0x1d; /* R29 - must be saved across function calls. Callee-save. */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x1e; /* R30 - must be saved across function calls. Callee-save. */ + *pxTopOfStack = ( StackType_t ) 0x1e; /* R30 - must be saved across function calls. Callee-save. */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x1f; /* R31 - must be saved across function calls. Callee-save. */ + *pxTopOfStack = ( StackType_t ) 0x1f; /* R31 - must be saved across function calls. Callee-save. */ pxTopOfStack--; #else pxTopOfStack -= 13; @@ -260,10 +260,10 @@ const unsigned long ulR13 = ( unsigned long ) &_SDA_BASE_; } /*-----------------------------------------------------------*/ -portBASE_TYPE xPortStartScheduler( void ) +BaseType_t xPortStartScheduler( void ) { extern void ( vPortStartFirstTask )( void ); -extern unsigned long _stack[]; +extern uint32_t _stack[]; /* Setup the hardware to generate the tick. Interrupts are disabled when this function is called. @@ -277,7 +277,7 @@ extern unsigned long _stack[]; vApplicationSetupTimerInterrupt(); /* Reuse the stack from main() as the stack for the interrupts/exceptions. */ - pulISRStack = ( unsigned long * ) _stack; + pulISRStack = ( uint32_t * ) _stack; /* Ensure there is enough space for the functions called from the interrupt service routines to write back into the stack frame of the caller. */ @@ -321,9 +321,9 @@ extern void VPortYieldASM( void ); } /*-----------------------------------------------------------*/ -void vPortEnableInterrupt( unsigned char ucInterruptID ) +void vPortEnableInterrupt( uint8_t ucInterruptID ) { -long lReturn; +int32_t lReturn; /* An API function is provided to enable an interrupt in the interrupt controller because the interrupt controller instance variable is private @@ -338,9 +338,9 @@ long lReturn; } /*-----------------------------------------------------------*/ -void vPortDisableInterrupt( unsigned char ucInterruptID ) +void vPortDisableInterrupt( uint8_t ucInterruptID ) { -long lReturn; +int32_t lReturn; /* An API function is provided to disable an interrupt in the interrupt controller because the interrupt controller instance variable is private @@ -356,9 +356,9 @@ long lReturn; } /*-----------------------------------------------------------*/ -portBASE_TYPE xPortInstallInterruptHandler( unsigned char ucInterruptID, XInterruptHandler pxHandler, void *pvCallBackRef ) +BaseType_t xPortInstallInterruptHandler( uint8_t ucInterruptID, XInterruptHandler pxHandler, void *pvCallBackRef ) { -long lReturn; +int32_t lReturn; /* An API function is provided to install an interrupt handler because the interrupt controller instance variable is private to this file. */ @@ -381,10 +381,10 @@ long lReturn; } /*-----------------------------------------------------------*/ -static long prvEnsureInterruptControllerIsInitialised( void ) +static int32_t prvEnsureInterruptControllerIsInitialised( void ) { -static long lInterruptControllerInitialised = pdFALSE; -long lReturn; +static int32_t lInterruptControllerInitialised = pdFALSE; +int32_t lReturn; /* Ensure the interrupt controller instance variable is initialised before it is used, and that the initialisation only happens once. */ @@ -434,9 +434,9 @@ extern void vApplicationClearTimerInterrupt( void ); } /*-----------------------------------------------------------*/ -static long prvInitialiseInterruptController( void ) +static int32_t prvInitialiseInterruptController( void ) { -long lStatus; +int32_t lStatus; lStatus = XIntc_Initialize( &xInterruptControllerInstance, configINTERRUPT_CONTROLLER_TO_USE ); diff --git a/FreeRTOS/Source/portable/GCC/MicroBlazeV8/port_exceptions.c b/FreeRTOS/Source/portable/GCC/MicroBlazeV8/port_exceptions.c index e76411e93..f5c5562de 100644 --- a/FreeRTOS/Source/portable/GCC/MicroBlazeV8/port_exceptions.c +++ b/FreeRTOS/Source/portable/GCC/MicroBlazeV8/port_exceptions.c @@ -104,7 +104,7 @@ configINSTALL_EXCEPTION_HANDLERS is not set to 1. */ /* This variable is set in the exception entry code, before vPortExceptionHandler is called. */ -unsigned long *pulStackPointerOnFunctionEntry = NULL; +uint32_t *pulStackPointerOnFunctionEntry = NULL; /* This is the structure that is filled with the MicroBlaze context as it existed immediately prior to the exception occurrence. A pointer to this @@ -186,7 +186,7 @@ extern void *pxCurrentTCB; xRegisterDump.ulR29 = mfgpr( R29 ); xRegisterDump.ulR30 = mfgpr( R30 ); xRegisterDump.ulR31 = mfgpr( R31 ); - xRegisterDump.ulR1_SP = ( ( unsigned long ) pulStackPointerOnFunctionEntry ) + portexASM_HANDLER_STACK_FRAME_SIZE; + xRegisterDump.ulR1_SP = ( ( uint32_t ) pulStackPointerOnFunctionEntry ) + portexASM_HANDLER_STACK_FRAME_SIZE; xRegisterDump.ulEAR = mfear(); xRegisterDump.ulESR = mfesr(); xRegisterDump.ulEDR = mfedr(); @@ -209,40 +209,40 @@ extern void *pxCurrentTCB; /* Also fill in a string that describes what type of exception this is. The string uses the same ID names as defined in the MicroBlaze standard library exception header files. */ - switch( ( unsigned long ) pvExceptionID ) + switch( ( uint32_t ) pvExceptionID ) { case XEXC_ID_FSL : - xRegisterDump.pcExceptionCause = ( signed char * const ) "XEXC_ID_FSL"; + xRegisterDump.pcExceptionCause = ( int8_t * const ) "XEXC_ID_FSL"; break; case XEXC_ID_UNALIGNED_ACCESS : - xRegisterDump.pcExceptionCause = ( signed char * const ) "XEXC_ID_UNALIGNED_ACCESS"; + xRegisterDump.pcExceptionCause = ( int8_t * const ) "XEXC_ID_UNALIGNED_ACCESS"; break; case XEXC_ID_ILLEGAL_OPCODE : - xRegisterDump.pcExceptionCause = ( signed char * const ) "XEXC_ID_ILLEGAL_OPCODE"; + xRegisterDump.pcExceptionCause = ( int8_t * const ) "XEXC_ID_ILLEGAL_OPCODE"; break; case XEXC_ID_M_AXI_I_EXCEPTION : - xRegisterDump.pcExceptionCause = ( signed char * const ) "XEXC_ID_M_AXI_I_EXCEPTION or XEXC_ID_IPLB_EXCEPTION"; + xRegisterDump.pcExceptionCause = ( int8_t * const ) "XEXC_ID_M_AXI_I_EXCEPTION or XEXC_ID_IPLB_EXCEPTION"; break; case XEXC_ID_M_AXI_D_EXCEPTION : - xRegisterDump.pcExceptionCause = ( signed char * const ) "XEXC_ID_M_AXI_D_EXCEPTION or XEXC_ID_DPLB_EXCEPTION"; + xRegisterDump.pcExceptionCause = ( int8_t * const ) "XEXC_ID_M_AXI_D_EXCEPTION or XEXC_ID_DPLB_EXCEPTION"; break; case XEXC_ID_DIV_BY_ZERO : - xRegisterDump.pcExceptionCause = ( signed char * const ) "XEXC_ID_DIV_BY_ZERO"; + xRegisterDump.pcExceptionCause = ( int8_t * const ) "XEXC_ID_DIV_BY_ZERO"; break; case XEXC_ID_STACK_VIOLATION : - xRegisterDump.pcExceptionCause = ( signed char * const ) "XEXC_ID_STACK_VIOLATION or XEXC_ID_MMU"; + xRegisterDump.pcExceptionCause = ( int8_t * const ) "XEXC_ID_STACK_VIOLATION or XEXC_ID_MMU"; break; #if XPAR_MICROBLAZE_0_USE_FPU == 1 case XEXC_ID_FPU : - xRegisterDump.pcExceptionCause = ( signed char * const ) "XEXC_ID_FPU see ulFSR value"; + xRegisterDump.pcExceptionCause = ( int8_t * const ) "XEXC_ID_FPU see ulFSR value"; break; #endif /* XPAR_MICROBLAZE_0_USE_FPU */ @@ -265,7 +265,7 @@ extern void *pxCurrentTCB; void vPortExceptionsInstallHandlers( void ) { -static unsigned long ulHandlersAlreadyInstalled = pdFALSE; +static uint32_t ulHandlersAlreadyInstalled = pdFALSE; if( ulHandlersAlreadyInstalled == pdFALSE ) { diff --git a/FreeRTOS/Source/portable/GCC/MicroBlazeV8/portmacro.h b/FreeRTOS/Source/portable/GCC/MicroBlazeV8/portmacro.h index 73e4248c7..bc8f1ae46 100644 --- a/FreeRTOS/Source/portable/GCC/MicroBlazeV8/portmacro.h +++ b/FreeRTOS/Source/portable/GCC/MicroBlazeV8/portmacro.h @@ -1,5 +1,5 @@ /* - FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. + FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. All rights reserved VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. @@ -75,7 +75,7 @@ extern "C" { #include /*----------------------------------------------------------- - * Port specific definitions. + * Port specific definitions. * * The settings in this file configure FreeRTOS correctly for the * given hardware and compiler. @@ -90,17 +90,21 @@ extern "C" { #define portDOUBLE double #define portLONG long #define portSHORT short -#define portSTACK_TYPE unsigned long +#define portSTACK_TYPE uint32_t #define portBASE_TYPE long +typedef portSTACK_TYPE StackType_t; +typedef long BaseType_t; +typedef unsigned long UBaseType_t; + #if( configUSE_16_BIT_TICKS == 1 ) - typedef unsigned portSHORT portTickType; - #define portMAX_DELAY ( portTickType ) 0xffff + typedef uint16_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffff #else - typedef unsigned portLONG portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffffUL + typedef uint32_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffffffffUL #endif -/*-----------------------------------------------------------*/ +/*-----------------------------------------------------------*/ /* Interrupt control macros and functions. */ void microblaze_disable_interrupts( void ); @@ -114,13 +118,13 @@ void microblaze_enable_interrupts( void ); void vPortEnterCritical( void ); void vPortExitCritical( void ); #define portENTER_CRITICAL() { \ - extern volatile unsigned portBASE_TYPE uxCriticalNesting; \ + extern volatile UBaseType_t uxCriticalNesting; \ microblaze_disable_interrupts(); \ uxCriticalNesting++; \ } #define portEXIT_CRITICAL() { \ - extern volatile unsigned portBASE_TYPE uxCriticalNesting; \ + extern volatile UBaseType_t uxCriticalNesting; \ /* Interrupts are disabled, so we can */ \ /* access the variable directly. */ \ uxCriticalNesting--; \ @@ -144,14 +148,14 @@ then checks this flag, and calls vTaskSwitchContext() before restoring a task context, if the flag is not false. This is done to prevent multiple calls to vTaskSwitchContext() being made from a single interrupt, as a single interrupt can result in multiple peripherals being serviced. */ -extern volatile unsigned long ulTaskSwitchRequested; +extern volatile uint32_t ulTaskSwitchRequested; #define portYIELD_FROM_ISR( x ) if( x != pdFALSE ) ulTaskSwitchRequested = 1 /*-----------------------------------------------------------*/ /* Hardware specifics. */ #define portBYTE_ALIGNMENT 4 #define portSTACK_GROWTH ( -1 ) -#define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ ) +#define portTICK_RATE_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ ) #define portNOP() asm volatile ( "NOP" ) /*-----------------------------------------------------------*/ @@ -167,53 +171,53 @@ typedef struct PORT_REGISTER_DUMP { /* The following structure members hold the values of the MicroBlaze registers at the time the exception was raised. */ - unsigned long ulR1_SP; - unsigned long ulR2_small_data_area; - unsigned long ulR3; - unsigned long ulR4; - unsigned long ulR5; - unsigned long ulR6; - unsigned long ulR7; - unsigned long ulR8; - unsigned long ulR9; - unsigned long ulR10; - unsigned long ulR11; - unsigned long ulR12; - unsigned long ulR13_read_write_small_data_area; - unsigned long ulR14_return_address_from_interrupt; - unsigned long ulR15_return_address_from_subroutine; - unsigned long ulR16_return_address_from_trap; - unsigned long ulR17_return_address_from_exceptions; /* The exception entry code will copy the BTR into R17 if the exception occurred in the delay slot of a branch instruction. */ - unsigned long ulR18; - unsigned long ulR19; - unsigned long ulR20; - unsigned long ulR21; - unsigned long ulR22; - unsigned long ulR23; - unsigned long ulR24; - unsigned long ulR25; - unsigned long ulR26; - unsigned long ulR27; - unsigned long ulR28; - unsigned long ulR29; - unsigned long ulR30; - unsigned long ulR31; - unsigned long ulPC; - unsigned long ulESR; - unsigned long ulMSR; - unsigned long ulEAR; - unsigned long ulFSR; - unsigned long ulEDR; + uint32_t ulR1_SP; + uint32_t ulR2_small_data_area; + uint32_t ulR3; + uint32_t ulR4; + uint32_t ulR5; + uint32_t ulR6; + uint32_t ulR7; + uint32_t ulR8; + uint32_t ulR9; + uint32_t ulR10; + uint32_t ulR11; + uint32_t ulR12; + uint32_t ulR13_read_write_small_data_area; + uint32_t ulR14_return_address_from_interrupt; + uint32_t ulR15_return_address_from_subroutine; + uint32_t ulR16_return_address_from_trap; + uint32_t ulR17_return_address_from_exceptions; /* The exception entry code will copy the BTR into R17 if the exception occurred in the delay slot of a branch instruction. */ + uint32_t ulR18; + uint32_t ulR19; + uint32_t ulR20; + uint32_t ulR21; + uint32_t ulR22; + uint32_t ulR23; + uint32_t ulR24; + uint32_t ulR25; + uint32_t ulR26; + uint32_t ulR27; + uint32_t ulR28; + uint32_t ulR29; + uint32_t ulR30; + uint32_t ulR31; + uint32_t ulPC; + uint32_t ulESR; + uint32_t ulMSR; + uint32_t ulEAR; + uint32_t ulFSR; + uint32_t ulEDR; /* A human readable description of the exception cause. The strings used are the same as the #define constant names found in the microblaze_exceptions_i.h header file */ - signed char *pcExceptionCause; + int8_t *pcExceptionCause; /* The human readable name of the task that was running at the time the exception occurred. This is the name that was given to the task when the task was created using the FreeRTOS xTaskCreate() API function. */ - signed char *pcCurrentTaskName; + int8_t *pcCurrentTaskName; /* The handle of the task that was running a the time the exception occurred. */ @@ -223,15 +227,15 @@ typedef struct PORT_REGISTER_DUMP /* - * Installs pxHandler as the interrupt handler for the peripheral specified by + * Installs pxHandler as the interrupt handler for the peripheral specified by * the ucInterruptID parameter. * * ucInterruptID: - * + * * The ID of the peripheral that will have pxHandler assigned as its interrupt - * handler. Peripheral IDs are defined in the xparameters.h header file, which - * is itself part of the BSP project. For example, in the official demo - * application for this port, xparameters.h defines the following IDs for the + * handler. Peripheral IDs are defined in the xparameters.h header file, which + * is itself part of the BSP project. For example, in the official demo + * application for this port, xparameters.h defines the following IDs for the * four possible interrupt sources: * * XPAR_INTC_0_UARTLITE_1_VEC_ID - for the UARTlite peripheral. @@ -241,7 +245,7 @@ typedef struct PORT_REGISTER_DUMP * * * pxHandler: - * + * * A pointer to the interrupt handler function itself. This must be a void * function that takes a (void *) parameter. * @@ -253,23 +257,23 @@ typedef struct PORT_REGISTER_DUMP * the peripheral instance variable, so it can be accessed from inside the * handler function. * - * + * * pdPASS is returned if the function executes successfully. Any other value * being returned indicates that the function did not execute correctly. */ -portBASE_TYPE xPortInstallInterruptHandler( unsigned char ucInterruptID, XInterruptHandler pxHandler, void *pvCallBackRef ); +BaseType_t xPortInstallInterruptHandler( uint8_t ucInterruptID, XInterruptHandler pxHandler, void *pvCallBackRef ); /* - * Enables the interrupt, within the interrupt controller, for the peripheral + * Enables the interrupt, within the interrupt controller, for the peripheral * specified by the ucInterruptID parameter. * * ucInterruptID: - * + * * The ID of the peripheral that will have its interrupt enabled in the - * interrupt controller. Peripheral IDs are defined in the xparameters.h header - * file, which is itself part of the BSP project. For example, in the official - * demo application for this port, xparameters.h defines the following IDs for + * interrupt controller. Peripheral IDs are defined in the xparameters.h header + * file, which is itself part of the BSP project. For example, in the official + * demo application for this port, xparameters.h defines the following IDs for * the four possible interrupt sources: * * XPAR_INTC_0_UARTLITE_1_VEC_ID - for the UARTlite peripheral. @@ -278,18 +282,18 @@ portBASE_TYPE xPortInstallInterruptHandler( unsigned char ucInterruptID, XInterr * XPAR_INTC_0_GPIO_1_VEC_ID - for the button inputs. * */ -void vPortEnableInterrupt( unsigned char ucInterruptID ); +void vPortEnableInterrupt( uint8_t ucInterruptID ); /* - * Disables the interrupt, within the interrupt controller, for the peripheral + * Disables the interrupt, within the interrupt controller, for the peripheral * specified by the ucInterruptID parameter. * * ucInterruptID: - * + * * The ID of the peripheral that will have its interrupt disabled in the - * interrupt controller. Peripheral IDs are defined in the xparameters.h header - * file, which is itself part of the BSP project. For example, in the official - * demo application for this port, xparameters.h defines the following IDs for + * interrupt controller. Peripheral IDs are defined in the xparameters.h header + * file, which is itself part of the BSP project. For example, in the official + * demo application for this port, xparameters.h defines the following IDs for * the four possible interrupt sources: * * XPAR_INTC_0_UARTLITE_1_VEC_ID - for the UARTlite peripheral. @@ -298,49 +302,49 @@ void vPortEnableInterrupt( unsigned char ucInterruptID ); * XPAR_INTC_0_GPIO_1_VEC_ID - for the button inputs. * */ -void vPortDisableInterrupt( unsigned char ucInterruptID ); +void vPortDisableInterrupt( uint8_t ucInterruptID ); /* * This is an application defined callback function used to install the tick - * interrupt handler. It is provided as an application callback because the - * kernel will run on lots of different MicroBlaze and FPGA configurations - not - * all of which will have the same timer peripherals defined or available. This - * example uses the AXI Timer 0. If that is available on your hardware platform - * then this example callback implementation should not require modification. - * The name of the interrupt handler that should be installed is vPortTickISR(), + * interrupt handler. It is provided as an application callback because the + * kernel will run on lots of different MicroBlaze and FPGA configurations - not + * all of which will have the same timer peripherals defined or available. This + * example uses the AXI Timer 0. If that is available on your hardware platform + * then this example callback implementation should not require modification. + * The name of the interrupt handler that should be installed is vPortTickISR(), * which the function below declares as an extern. - */ + */ void vApplicationSetupTimerInterrupt( void ); -/* +/* * This is an application defined callback function used to clear whichever * interrupt was installed by the the vApplicationSetupTimerInterrupt() callback - * function - in this case the interrupt generated by the AXI timer. It is - * provided as an application callback because the kernel will run on lots of - * different MicroBlaze and FPGA configurations - not all of which will have the - * same timer peripherals defined or available. This example uses the AXI Timer 0. - * If that is available on your hardware platform then this example callback + * function - in this case the interrupt generated by the AXI timer. It is + * provided as an application callback because the kernel will run on lots of + * different MicroBlaze and FPGA configurations - not all of which will have the + * same timer peripherals defined or available. This example uses the AXI Timer 0. + * If that is available on your hardware platform then this example callback * implementation should not require modification provided the example definition - * of vApplicationSetupTimerInterrupt() is also not modified. + * of vApplicationSetupTimerInterrupt() is also not modified. */ void vApplicationClearTimerInterrupt( void ); /* * vPortExceptionsInstallHandlers() is only available when the MicroBlaze - * is configured to include exception functionality, and + * is configured to include exception functionality, and * configINSTALL_EXCEPTION_HANDLERS is set to 1 in FreeRTOSConfig.h. * * vPortExceptionsInstallHandlers() installs the FreeRTOS exception handler - * for every possible exception cause. + * for every possible exception cause. * * vPortExceptionsInstallHandlers() can be called explicitly from application * code. After that is done, the default FreeRTOS exception handler that will - * have been installed can be replaced for any specific exception cause by using + * have been installed can be replaced for any specific exception cause by using * the standard Xilinx library function microblaze_register_exception_handler(). * - * If vPortExceptionsInstallHandlers() is not called explicitly by the + * If vPortExceptionsInstallHandlers() is not called explicitly by the * application, it will be called automatically by the kernel the first time - * xPortInstallInterruptHandler() is called. At that time, any exception + * xPortInstallInterruptHandler() is called. At that time, any exception * handlers that may have already been installed will be replaced. * * See the description of vApplicationExceptionRegisterDump() for information @@ -349,16 +353,16 @@ void vApplicationClearTimerInterrupt( void ); void vPortExceptionsInstallHandlers( void ); /* - * The FreeRTOS exception handler fills an xPortRegisterDump structure (defined - * in portmacro.h) with the MicroBlaze context, as it was at the time the + * The FreeRTOS exception handler fills an xPortRegisterDump structure (defined + * in portmacro.h) with the MicroBlaze context, as it was at the time the * exception occurred. The exception handler then calls * vApplicationExceptionRegisterDump(), passing in the completed * xPortRegisterDump structure as its parameter. * * The FreeRTOS kernel provides its own implementation of - * vApplicationExceptionRegisterDump(), but the kernel provided implementation - * is declared as being 'weak'. The weak definition allows the application - * writer to provide their own implementation, should they wish to use the + * vApplicationExceptionRegisterDump(), but the kernel provided implementation + * is declared as being 'weak'. The weak definition allows the application + * writer to provide their own implementation, should they wish to use the * register dump information. For example, an implementation could be provided * that wrote the register dump data to a display, or a UART port. */ diff --git a/FreeRTOS/Source/portable/GCC/NiosII/port.c b/FreeRTOS/Source/portable/GCC/NiosII/port.c index c4849565f..506a62a71 100644 --- a/FreeRTOS/Source/portable/GCC/NiosII/port.c +++ b/FreeRTOS/Source/portable/GCC/NiosII/port.c @@ -81,7 +81,7 @@ #include "task.h" /* Interrupts are enabled. */ -#define portINITIAL_ESTATUS ( portSTACK_TYPE ) 0x01 +#define portINITIAL_ESTATUS ( StackType_t ) 0x01 /*-----------------------------------------------------------*/ @@ -97,7 +97,7 @@ void vPortSysTickHandler( void * context, alt_u32 id ); /*-----------------------------------------------------------*/ -static void prvReadGp( unsigned long *ulValue ) +static void prvReadGp( uint32_t *ulValue ) { asm( "stw gp, (%0)" :: "r"(ulValue) ); } @@ -106,10 +106,10 @@ static void prvReadGp( unsigned long *ulValue ) /* * See header file for description. */ -portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) +StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) { -portSTACK_TYPE *pxFramePointer = pxTopOfStack - 1; -portSTACK_TYPE xGlobalPointer; +StackType_t *pxFramePointer = pxTopOfStack - 1; +StackType_t xGlobalPointer; prvReadGp( &xGlobalPointer ); @@ -117,7 +117,7 @@ portSTACK_TYPE xGlobalPointer; *pxTopOfStack = 0xdeadbeef; pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) pxFramePointer; + *pxTopOfStack = ( StackType_t ) pxFramePointer; pxTopOfStack--; *pxTopOfStack = xGlobalPointer; @@ -125,7 +125,7 @@ portSTACK_TYPE xGlobalPointer; /* Space for R23 to R16. */ pxTopOfStack -= 9; - *pxTopOfStack = ( portSTACK_TYPE ) pxCode; + *pxTopOfStack = ( StackType_t ) pxCode; pxTopOfStack--; *pxTopOfStack = portINITIAL_ESTATUS; @@ -133,7 +133,7 @@ portSTACK_TYPE xGlobalPointer; /* Space for R15 to R5. */ pxTopOfStack -= 12; - *pxTopOfStack = ( portSTACK_TYPE ) pvParameters; + *pxTopOfStack = ( StackType_t ) pvParameters; /* Space for R3 to R1, muldiv and RA. */ pxTopOfStack -= 5; @@ -145,7 +145,7 @@ portSTACK_TYPE xGlobalPointer; /* * See header file for description. */ -portBASE_TYPE xPortStartScheduler( void ) +BaseType_t xPortStartScheduler( void ) { /* Start the timer that generates the tick ISR. Interrupts are disabled here already. */ diff --git a/FreeRTOS/Source/portable/GCC/NiosII/portmacro.h b/FreeRTOS/Source/portable/GCC/NiosII/portmacro.h index 8e8ba3898..b3ad0b75b 100644 --- a/FreeRTOS/Source/portable/GCC/NiosII/portmacro.h +++ b/FreeRTOS/Source/portable/GCC/NiosII/portmacro.h @@ -1,5 +1,5 @@ /* - FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. + FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. All rights reserved VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. @@ -73,7 +73,7 @@ extern "C" { #include "sys/alt_irq.h" /*----------------------------------------------------------- - * Port specific definitions. + * Port specific definitions. * * The settings in this file configure FreeRTOS correctly for the * given hardware and compiler. @@ -88,25 +88,29 @@ extern "C" { #define portDOUBLE double #define portLONG long #define portSHORT short -#define portSTACK_TYPE unsigned portLONG +#define portSTACK_TYPE uint32_t #define portBASE_TYPE long +typedef portSTACK_TYPE StackType_t; +typedef long BaseType_t; +typedef unsigned long UBaseType_t; + #if( configUSE_16_BIT_TICKS == 1 ) - typedef unsigned portSHORT portTickType; - #define portMAX_DELAY ( portTickType ) 0xffff + typedef uint16_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffff #else - typedef unsigned portLONG portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffffUL + typedef uint32_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffffffffUL #endif -/*-----------------------------------------------------------*/ +/*-----------------------------------------------------------*/ /* Architecture specifics. */ #define portSTACK_GROWTH ( -1 ) -#define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ ) +#define portTICK_RATE_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ ) #define portBYTE_ALIGNMENT 4 #define portNOP() asm volatile ( "NOP" ) #define portCRITICAL_NESTING_IN_TCB 1 -/*-----------------------------------------------------------*/ +/*-----------------------------------------------------------*/ extern void vTaskSwitchContext( void ); #define portYIELD() asm volatile ( "trap" ); diff --git a/FreeRTOS/Source/portable/GCC/PPC405_Xilinx/port.c b/FreeRTOS/Source/portable/GCC/PPC405_Xilinx/port.c index 92a91e31f..7537f5181 100644 --- a/FreeRTOS/Source/portable/GCC/PPC405_Xilinx/port.c +++ b/FreeRTOS/Source/portable/GCC/PPC405_Xilinx/port.c @@ -134,7 +134,7 @@ static XIntc xInterruptController; * * See the header file portable.h. */ -portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) +StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) { /* Place a known value at the bottom of the stack for debugging. */ *pxTopOfStack = 0xDEADBEEF; @@ -144,15 +144,15 @@ portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxTopOfStack -= 20; /* Previous backchain and LR, R31 to R4 inclusive. */ /* Parameters in R13. */ - *pxTopOfStack = ( portSTACK_TYPE ) &_SDA_BASE_; /* address of the first small data area */ + *pxTopOfStack = ( StackType_t ) &_SDA_BASE_; /* address of the first small data area */ pxTopOfStack -= 10; /* Parameters in R3. */ - *pxTopOfStack = ( portSTACK_TYPE ) pvParameters; + *pxTopOfStack = ( StackType_t ) pvParameters; pxTopOfStack--; /* Parameters in R2. */ - *pxTopOfStack = ( portSTACK_TYPE ) &_SDA2_BASE_; /* address of the second small data area */ + *pxTopOfStack = ( StackType_t ) &_SDA2_BASE_; /* address of the second small data area */ pxTopOfStack--; /* R1 is the stack pointer so is omitted. */ @@ -167,13 +167,13 @@ portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxTopOfStack--; *pxTopOfStack = 0x00000000UL; /* CTR. */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) vPortEndScheduler; /* LR. */ + *pxTopOfStack = ( StackType_t ) vPortEndScheduler; /* LR. */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) pxCode; /* SRR0. */ + *pxTopOfStack = ( StackType_t ) pxCode; /* SRR0. */ pxTopOfStack--; *pxTopOfStack = portINITIAL_MSR;/* SRR1. */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) vPortEndScheduler;/* Next LR. */ + *pxTopOfStack = ( StackType_t ) vPortEndScheduler;/* Next LR. */ pxTopOfStack--; *pxTopOfStack = 0x00000000UL;/* Backchain. */ @@ -181,7 +181,7 @@ portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE } /*-----------------------------------------------------------*/ -portBASE_TYPE xPortStartScheduler( void ) +BaseType_t xPortStartScheduler( void ) { prvSetupTimerInterrupt(); XExc_RegisterHandler( XEXC_ID_SYSTEM_CALL, ( XExceptionHandler ) vPortYield, ( void * ) 0 ); @@ -204,7 +204,7 @@ void vPortEndScheduler( void ) */ static void prvSetupTimerInterrupt( void ) { -const unsigned long ulInterval = ( ( configCPU_CLOCK_HZ / configTICK_RATE_HZ ) - 1UL ); +const uint32_t ulInterval = ( ( configCPU_CLOCK_HZ / configTICK_RATE_HZ ) - 1UL ); XTime_PITClearInterrupt(); XTime_FITClearInterrupt(); @@ -222,8 +222,8 @@ const unsigned long ulInterval = ( ( configCPU_CLOCK_HZ / configTICK_RATE_HZ ) - void vPortISRHandler( void *pvNullDoNotUse ) { -unsigned long ulInterruptStatus, ulInterruptMask = 1UL; -portBASE_TYPE xInterruptNumber; +uint32_t ulInterruptStatus, ulInterruptMask = 1UL; +BaseType_t xInterruptNumber; XIntc_Config *pxInterruptController; XIntc_VectorTableEntry *pxTable; @@ -281,9 +281,9 @@ extern void vPortISRWrapper( void ); } /*-----------------------------------------------------------*/ -portBASE_TYPE xPortInstallInterruptHandler( unsigned char ucInterruptID, XInterruptHandler pxHandler, void *pvCallBackRef ) +BaseType_t xPortInstallInterruptHandler( uint8_t ucInterruptID, XInterruptHandler pxHandler, void *pvCallBackRef ) { -portBASE_TYPE xReturn = pdFAIL; +BaseType_t xReturn = pdFAIL; /* This function is defined here so the scope of xInterruptController can remain within this file. */ diff --git a/FreeRTOS/Source/portable/GCC/PPC405_Xilinx/portmacro.h b/FreeRTOS/Source/portable/GCC/PPC405_Xilinx/portmacro.h index 3a57cf146..0cd7cc0fb 100644 --- a/FreeRTOS/Source/portable/GCC/PPC405_Xilinx/portmacro.h +++ b/FreeRTOS/Source/portable/GCC/PPC405_Xilinx/portmacro.h @@ -1,5 +1,5 @@ /* - FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. + FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. All rights reserved VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. @@ -73,7 +73,7 @@ extern "C" { #endif /*----------------------------------------------------------- - * Port specific definitions. + * Port specific definitions. * * The settings in this file configure FreeRTOS correctly for the * given hardware and compiler. @@ -88,17 +88,21 @@ extern "C" { #define portDOUBLE double #define portLONG long #define portSHORT short -#define portSTACK_TYPE unsigned portLONG -#define portBASE_TYPE portLONG +#define portSTACK_TYPE uint32_t +#define portBASE_TYPE long + +typedef portSTACK_TYPE StackType_t; +typedef long BaseType_t; +typedef unsigned long UBaseType_t; #if( configUSE_16_BIT_TICKS == 1 ) - typedef unsigned portSHORT portTickType; - #define portMAX_DELAY ( portTickType ) 0xffff + typedef uint16_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffff #else - typedef unsigned portLONG portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffffUL + typedef uint32_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffffffffUL #endif -/*-----------------------------------------------------------*/ +/*-----------------------------------------------------------*/ /* This port uses the critical nesting count from the TCB rather than maintaining a separate value and then saving this value in the task stack. */ @@ -128,7 +132,7 @@ void vPortYield( void ); /* Hardware specifics. */ #define portBYTE_ALIGNMENT 8 #define portSTACK_GROWTH ( -1 ) -#define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ ) +#define portTICK_RATE_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ ) #define portNOP() asm volatile ( "NOP" ) /* There are 32 * 32bit floating point regieters, plus the FPSCR to save. */ @@ -142,7 +146,7 @@ void vPortYield( void ); /* Port specific interrupt handling functions. */ void vPortSetupInterruptController( void ); -portBASE_TYPE xPortInstallInterruptHandler( unsigned portCHAR ucInterruptID, XInterruptHandler pxHandler, void *pvCallBackRef ); +BaseType_t xPortInstallInterruptHandler( uint8_t ucInterruptID, XInterruptHandler pxHandler, void *pvCallBackRef ); #ifdef __cplusplus } diff --git a/FreeRTOS/Source/portable/GCC/PPC440_Xilinx/port.c b/FreeRTOS/Source/portable/GCC/PPC440_Xilinx/port.c index 7df226d8a..0f72e1277 100644 --- a/FreeRTOS/Source/portable/GCC/PPC440_Xilinx/port.c +++ b/FreeRTOS/Source/portable/GCC/PPC440_Xilinx/port.c @@ -134,7 +134,7 @@ static XIntc xInterruptController; * * See the header file portable.h. */ -portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) +StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) { /* Place a known value at the bottom of the stack for debugging. */ *pxTopOfStack = 0xDEADBEEF; @@ -144,15 +144,15 @@ portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxTopOfStack -= 20; /* Previous backchain and LR, R31 to R4 inclusive. */ /* Parameters in R13. */ - *pxTopOfStack = ( portSTACK_TYPE ) &_SDA_BASE_; /* address of the first small data area */ + *pxTopOfStack = ( StackType_t ) &_SDA_BASE_; /* address of the first small data area */ pxTopOfStack -= 10; /* Parameters in R3. */ - *pxTopOfStack = ( portSTACK_TYPE ) pvParameters; + *pxTopOfStack = ( StackType_t ) pvParameters; pxTopOfStack--; /* Parameters in R2. */ - *pxTopOfStack = ( portSTACK_TYPE ) &_SDA2_BASE_; /* address of the second small data area */ + *pxTopOfStack = ( StackType_t ) &_SDA2_BASE_; /* address of the second small data area */ pxTopOfStack--; /* R1 is the stack pointer so is omitted. */ @@ -167,13 +167,13 @@ portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxTopOfStack--; *pxTopOfStack = 0x00000000UL; /* CTR. */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) vPortEndScheduler; /* LR. */ + *pxTopOfStack = ( StackType_t ) vPortEndScheduler; /* LR. */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) pxCode; /* SRR0. */ + *pxTopOfStack = ( StackType_t ) pxCode; /* SRR0. */ pxTopOfStack--; *pxTopOfStack = portINITIAL_MSR;/* SRR1. */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) vPortEndScheduler;/* Next LR. */ + *pxTopOfStack = ( StackType_t ) vPortEndScheduler;/* Next LR. */ pxTopOfStack--; *pxTopOfStack = 0x00000000UL;/* Backchain. */ @@ -181,7 +181,7 @@ portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE } /*-----------------------------------------------------------*/ -portBASE_TYPE xPortStartScheduler( void ) +BaseType_t xPortStartScheduler( void ) { prvSetupTimerInterrupt(); XExc_RegisterHandler( XEXC_ID_SYSTEM_CALL, ( XExceptionHandler ) vPortYield, ( void * ) 0 ); @@ -204,7 +204,7 @@ void vPortEndScheduler( void ) */ static void prvSetupTimerInterrupt( void ) { -const unsigned long ulInterval = ( ( configCPU_CLOCK_HZ / configTICK_RATE_HZ ) - 1UL ); +const uint32_t ulInterval = ( ( configCPU_CLOCK_HZ / configTICK_RATE_HZ ) - 1UL ); XTime_DECClearInterrupt(); XTime_FITClearInterrupt(); @@ -222,8 +222,8 @@ const unsigned long ulInterval = ( ( configCPU_CLOCK_HZ / configTICK_RATE_HZ ) - void vPortISRHandler( void *pvNullDoNotUse ) { -unsigned long ulInterruptStatus, ulInterruptMask = 1UL; -portBASE_TYPE xInterruptNumber; +uint32_t ulInterruptStatus, ulInterruptMask = 1UL; +BaseType_t xInterruptNumber; XIntc_Config *pxInterruptController; XIntc_VectorTableEntry *pxTable; @@ -281,9 +281,9 @@ extern void vPortISRWrapper( void ); } /*-----------------------------------------------------------*/ -portBASE_TYPE xPortInstallInterruptHandler( unsigned char ucInterruptID, XInterruptHandler pxHandler, void *pvCallBackRef ) +BaseType_t xPortInstallInterruptHandler( uint8_t ucInterruptID, XInterruptHandler pxHandler, void *pvCallBackRef ) { -portBASE_TYPE xReturn = pdFAIL; +BaseType_t xReturn = pdFAIL; /* This function is defined here so the scope of xInterruptController can remain within this file. */ diff --git a/FreeRTOS/Source/portable/GCC/PPC440_Xilinx/portmacro.h b/FreeRTOS/Source/portable/GCC/PPC440_Xilinx/portmacro.h index 3a57cf146..0cd7cc0fb 100644 --- a/FreeRTOS/Source/portable/GCC/PPC440_Xilinx/portmacro.h +++ b/FreeRTOS/Source/portable/GCC/PPC440_Xilinx/portmacro.h @@ -1,5 +1,5 @@ /* - FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. + FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. All rights reserved VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. @@ -73,7 +73,7 @@ extern "C" { #endif /*----------------------------------------------------------- - * Port specific definitions. + * Port specific definitions. * * The settings in this file configure FreeRTOS correctly for the * given hardware and compiler. @@ -88,17 +88,21 @@ extern "C" { #define portDOUBLE double #define portLONG long #define portSHORT short -#define portSTACK_TYPE unsigned portLONG -#define portBASE_TYPE portLONG +#define portSTACK_TYPE uint32_t +#define portBASE_TYPE long + +typedef portSTACK_TYPE StackType_t; +typedef long BaseType_t; +typedef unsigned long UBaseType_t; #if( configUSE_16_BIT_TICKS == 1 ) - typedef unsigned portSHORT portTickType; - #define portMAX_DELAY ( portTickType ) 0xffff + typedef uint16_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffff #else - typedef unsigned portLONG portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffffUL + typedef uint32_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffffffffUL #endif -/*-----------------------------------------------------------*/ +/*-----------------------------------------------------------*/ /* This port uses the critical nesting count from the TCB rather than maintaining a separate value and then saving this value in the task stack. */ @@ -128,7 +132,7 @@ void vPortYield( void ); /* Hardware specifics. */ #define portBYTE_ALIGNMENT 8 #define portSTACK_GROWTH ( -1 ) -#define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ ) +#define portTICK_RATE_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ ) #define portNOP() asm volatile ( "NOP" ) /* There are 32 * 32bit floating point regieters, plus the FPSCR to save. */ @@ -142,7 +146,7 @@ void vPortYield( void ); /* Port specific interrupt handling functions. */ void vPortSetupInterruptController( void ); -portBASE_TYPE xPortInstallInterruptHandler( unsigned portCHAR ucInterruptID, XInterruptHandler pxHandler, void *pvCallBackRef ); +BaseType_t xPortInstallInterruptHandler( uint8_t ucInterruptID, XInterruptHandler pxHandler, void *pvCallBackRef ); #ifdef __cplusplus } diff --git a/FreeRTOS/Source/portable/GCC/RX100/port.c b/FreeRTOS/Source/portable/GCC/RX100/port.c index 24fab584b..57f70fd53 100644 --- a/FreeRTOS/Source/portable/GCC/RX100/port.c +++ b/FreeRTOS/Source/portable/GCC/RX100/port.c @@ -84,7 +84,7 @@ /* Tasks should start with interrupts enabled and in Supervisor mode, therefore PSW is set with U and I set, and PM and IPL clear. */ -#define portINITIAL_PSW ( ( portSTACK_TYPE ) 0x00030000 ) +#define portINITIAL_PSW ( ( StackType_t ) 0x00030000 ) /* The peripheral clock is divided by this value before being supplying the CMT. */ @@ -153,7 +153,7 @@ static void prvSetupTimerInterrupt( void ); * instruction. */ #if configUSE_TICKLESS_IDLE == 1 - static void prvSleep( portTickType xExpectedIdleTime ); + static void prvSleep( TickType_t xExpectedIdleTime ); #endif /* configUSE_TICKLESS_IDLE */ /*-----------------------------------------------------------*/ @@ -162,7 +162,7 @@ static void prvSetupTimerInterrupt( void ); extern void *pxCurrentTCB; /* Calculate how many clock increments make up a single tick period. */ -static const unsigned long ulMatchValueForOneTick = ( ( configPERIPHERAL_CLOCK_HZ / portCLOCK_DIVISOR ) / configTICK_RATE_HZ ); +static const uint32_t ulMatchValueForOneTick = ( ( configPERIPHERAL_CLOCK_HZ / portCLOCK_DIVISOR ) / configTICK_RATE_HZ ); #if configUSE_TICKLESS_IDLE == 1 @@ -170,7 +170,7 @@ static const unsigned long ulMatchValueForOneTick = ( ( configPERIPHERAL_CLOCK_H basically how far into the future an interrupt can be generated. Set during initialisation. This is the maximum possible value that the compare match register can hold divided by ulMatchValueForOneTick. */ - static const portTickType xMaximumPossibleSuppressedTicks = USHRT_MAX / ( ( configPERIPHERAL_CLOCK_HZ / portCLOCK_DIVISOR ) / configTICK_RATE_HZ ); + static const TickType_t xMaximumPossibleSuppressedTicks = USHRT_MAX / ( ( configPERIPHERAL_CLOCK_HZ / portCLOCK_DIVISOR ) / configTICK_RATE_HZ ); /* Flag set from the tick interrupt to allow the sleep processing to know if sleep mode was exited because of a tick interrupt, or an interrupt @@ -183,7 +183,7 @@ static const unsigned long ulMatchValueForOneTick = ( ( configPERIPHERAL_CLOCK_H compensate for the lost time. The large difference between the divided CMT clock and the CPU clock means it is likely ulStoppedTimerCompensation will equal zero - and be optimised away. */ - static const unsigned long ulStoppedTimerCompensation = 100UL / ( configCPU_CLOCK_HZ / ( configPERIPHERAL_CLOCK_HZ / portCLOCK_DIVISOR ) ); + static const uint32_t ulStoppedTimerCompensation = 100UL / ( configCPU_CLOCK_HZ / ( configPERIPHERAL_CLOCK_HZ / portCLOCK_DIVISOR ) ); #endif @@ -192,7 +192,7 @@ static const unsigned long ulMatchValueForOneTick = ( ( configPERIPHERAL_CLOCK_H /* * See header file for description. */ -portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) +StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) { /* Offset to end up on 8 byte boundary. */ pxTopOfStack--; @@ -204,7 +204,7 @@ portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxTopOfStack--; *pxTopOfStack = portINITIAL_PSW; pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) pxCode; + *pxTopOfStack = ( StackType_t ) pxCode; /* When debugging it can be useful if every register is set to a known value. Otherwise code space can be saved by just setting the registers @@ -249,7 +249,7 @@ portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE } #endif - *pxTopOfStack = ( portSTACK_TYPE ) pvParameters; /* R1 */ + *pxTopOfStack = ( StackType_t ) pvParameters; /* R1 */ pxTopOfStack--; *pxTopOfStack = 0x12345678; /* Accumulator. */ pxTopOfStack--; @@ -259,7 +259,7 @@ portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE } /*-----------------------------------------------------------*/ -portBASE_TYPE xPortStartScheduler( void ) +BaseType_t xPortStartScheduler( void ) { /* Use pxCurrentTCB just so it does not get optimised away. */ if( pxCurrentTCB != NULL ) @@ -446,13 +446,13 @@ void vPortTickISR( void ) /* If this is the first tick since exiting tickless mode then the CMT compare match value needs resetting. */ - CMT0.CMCOR = ( unsigned short ) ulMatchValueForOneTick; + CMT0.CMCOR = ( uint16_t ) ulMatchValueForOneTick; } #endif } /*-----------------------------------------------------------*/ -unsigned long ulPortGetIPL( void ) +uint32_t ulPortGetIPL( void ) { __asm volatile ( @@ -466,7 +466,7 @@ unsigned long ulPortGetIPL( void ) } /*-----------------------------------------------------------*/ -void vPortSetIPL( unsigned long ulNewIPL ) +void vPortSetIPL( uint32_t ulNewIPL ) { __asm volatile ( @@ -497,7 +497,7 @@ static void prvSetupTimerInterrupt( void ) CMT0.CMCR.BIT.CMIE = 1; /* Set the compare match value. */ - CMT0.CMCOR = ( unsigned short ) ulMatchValueForOneTick; + CMT0.CMCOR = ( uint16_t ) ulMatchValueForOneTick; /* Divide the PCLK. */ #if portCLOCK_DIVISOR == 512 @@ -535,7 +535,7 @@ static void prvSetupTimerInterrupt( void ) #if configUSE_TICKLESS_IDLE == 1 - static void prvSleep( portTickType xExpectedIdleTime ) + static void prvSleep( TickType_t xExpectedIdleTime ) { /* Allow the application to define some pre-sleep processing. */ configPRE_SLEEP_PROCESSING( xExpectedIdleTime ); @@ -557,9 +557,9 @@ static void prvSetupTimerInterrupt( void ) #if configUSE_TICKLESS_IDLE == 1 - void vPortSuppressTicksAndSleep( portTickType xExpectedIdleTime ) + void vPortSuppressTicksAndSleep( TickType_t xExpectedIdleTime ) { - unsigned long ulMatchValue, ulCompleteTickPeriods, ulCurrentCount; + uint32_t ulMatchValue, ulCompleteTickPeriods, ulCurrentCount; eSleepModeStatus eSleepAction; /* THIS FUNCTION IS CALLED WITH THE SCHEDULER SUSPENDED. */ @@ -642,8 +642,8 @@ static void prvSetupTimerInterrupt( void ) /* Adjust the match value to take into account that the current time slice is already partially complete. */ - ulMatchValue -= ( unsigned long ) CMT0.CMCNT; - CMT0.CMCOR = ( unsigned short ) ulMatchValue; + ulMatchValue -= ( uint32_t ) CMT0.CMCNT; + CMT0.CMCOR = ( uint16_t ) ulMatchValue; /* Restart the CMT to count up to the new match value. */ CMT0.CMCNT = 0; @@ -663,7 +663,7 @@ static void prvSetupTimerInterrupt( void ) /* Nothing to do here. */ } - ulCurrentCount = ( unsigned long ) CMT0.CMCNT; + ulCurrentCount = ( uint32_t ) CMT0.CMCNT; if( ulTickFlag != pdFALSE ) { @@ -673,7 +673,7 @@ static void prvSetupTimerInterrupt( void ) exited. Reset the match value with whatever remains of this tick period. */ ulMatchValue = ulMatchValueForOneTick - ulCurrentCount; - CMT0.CMCOR = ( unsigned short ) ulMatchValue; + CMT0.CMCOR = ( uint16_t ) ulMatchValue; /* The tick interrupt handler will already have pended the tick processing in the kernel. As the pending tick will be @@ -693,7 +693,7 @@ static void prvSetupTimerInterrupt( void ) /* The match value is set to whatever fraction of a single tick period remains. */ ulMatchValue = ulCurrentCount - ( ulCompleteTickPeriods * ulMatchValueForOneTick ); - CMT0.CMCOR = ( unsigned short ) ulMatchValue; + CMT0.CMCOR = ( uint16_t ) ulMatchValue; } /* Restart the CMT so it runs up to the match value. The match value diff --git a/FreeRTOS/Source/portable/GCC/RX100/portmacro.h b/FreeRTOS/Source/portable/GCC/RX100/portmacro.h index c51ae9d50..c010be28e 100644 --- a/FreeRTOS/Source/portable/GCC/RX100/portmacro.h +++ b/FreeRTOS/Source/portable/GCC/RX100/portmacro.h @@ -1,5 +1,5 @@ /* - FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. + FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. All rights reserved VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. @@ -88,22 +88,26 @@ portSTACK_TYPE and portBASE_TYPE. */ #define portDOUBLE double #define portLONG long #define portSHORT short -#define portSTACK_TYPE unsigned portLONG +#define portSTACK_TYPE uint32_t #define portBASE_TYPE long +typedef portSTACK_TYPE StackType_t; +typedef long BaseType_t; +typedef unsigned long UBaseType_t; + #if( configUSE_16_BIT_TICKS == 1 ) - typedef unsigned portSHORT portTickType; - #define portMAX_DELAY ( portTickType ) 0xffff + typedef uint16_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffff #else - typedef unsigned portLONG portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffffUL + typedef uint32_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffffffffUL #endif /*-----------------------------------------------------------*/ /* Hardware specifics. */ #define portBYTE_ALIGNMENT 8 /* Could make four, according to manual. */ #define portSTACK_GROWTH -1 -#define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ ) +#define portTICK_RATE_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ ) #define portNOP() __asm volatile( "NOP" ) /* Save clobbered register, set ITU SWINR (at address 0x872E0), read the value @@ -120,14 +124,14 @@ register. */ #define portYIELD_FROM_ISR( x ) if( x != pdFALSE ) { portYIELD(); } -/* These macros should not be called directly, but through the -taskENTER_CRITICAL() and taskEXIT_CRITICAL() macros. An extra check is -performed if configASSERT() is defined to ensure an assertion handler does not -inadvertently attempt to lower the IPL when the call to assert was triggered -because the IPL value was found to be above configMAX_SYSCALL_INTERRUPT_PRIORITY -when an ISR safe FreeRTOS API function was executed. ISR safe FreeRTOS API -functions are those that end in FromISR. FreeRTOS maintains a separate -interrupt API to ensure API function and interrupt entry is as fast and as +/* These macros should not be called directly, but through the +taskENTER_CRITICAL() and taskEXIT_CRITICAL() macros. An extra check is +performed if configASSERT() is defined to ensure an assertion handler does not +inadvertently attempt to lower the IPL when the call to assert was triggered +because the IPL value was found to be above configMAX_SYSCALL_INTERRUPT_PRIORITY +when an ISR safe FreeRTOS API function was executed. ISR safe FreeRTOS API +functions are those that end in FromISR. FreeRTOS maintains a separate +interrupt API to ensure API function and interrupt entry is as fast and as simple as possible. */ #define portENABLE_INTERRUPTS() __asm volatile ( "MVTIPL #0" ) #ifdef configASSERT @@ -147,15 +151,15 @@ extern void vTaskExitCritical( void ); #define portEXIT_CRITICAL() vTaskExitCritical() /* As this port allows interrupt nesting... */ -unsigned long ulPortGetIPL( void ) __attribute__((naked)); -void vPortSetIPL( unsigned long ulNewIPL ) __attribute__((naked)); +uint32_t ulPortGetIPL( void ) __attribute__((naked)); +void vPortSetIPL( uint32_t ulNewIPL ) __attribute__((naked)); #define portSET_INTERRUPT_MASK_FROM_ISR() ulPortGetIPL(); portDISABLE_INTERRUPTS() #define portCLEAR_INTERRUPT_MASK_FROM_ISR( uxSavedInterruptStatus ) vPortSetIPL( uxSavedInterruptStatus ) /* Tickless idle/low power functionality. */ #if configUSE_TICKLESS_IDLE == 1 #ifndef portSUPPRESS_TICKS_AND_SLEEP - extern void vPortSuppressTicksAndSleep( portTickType xExpectedIdleTime ); + extern void vPortSuppressTicksAndSleep( TickType_t xExpectedIdleTime ); #define portSUPPRESS_TICKS_AND_SLEEP( xExpectedIdleTime ) vPortSuppressTicksAndSleep( xExpectedIdleTime ) #endif #endif diff --git a/FreeRTOS/Source/portable/GCC/RX600/port.c b/FreeRTOS/Source/portable/GCC/RX600/port.c index 68b4d5a6d..7c9cdf66d 100644 --- a/FreeRTOS/Source/portable/GCC/RX600/port.c +++ b/FreeRTOS/Source/portable/GCC/RX600/port.c @@ -81,8 +81,8 @@ /* Tasks should start with interrupts enabled and in Supervisor mode, therefore PSW is set with U and I set, and PM and IPL clear. */ -#define portINITIAL_PSW ( ( portSTACK_TYPE ) 0x00030000 ) -#define portINITIAL_FPSW ( ( portSTACK_TYPE ) 0x00000100 ) +#define portINITIAL_PSW ( ( StackType_t ) 0x00030000 ) +#define portINITIAL_FPSW ( ( StackType_t ) 0x00000100 ) /* These macros allow a critical section to be added around the call to xTaskIncrementTick(), which is only ever called from interrupts at the kernel @@ -121,7 +121,7 @@ extern void *pxCurrentTCB; /* * See header file for description. */ -portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) +StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) { /* R0 is not included as it is the stack pointer. */ @@ -129,7 +129,7 @@ portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxTopOfStack--; *pxTopOfStack = portINITIAL_PSW; pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) pxCode; + *pxTopOfStack = ( StackType_t ) pxCode; /* When debugging it can be useful if every register is set to a known value. Otherwise code space can be saved by just setting the registers @@ -172,7 +172,7 @@ portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE } #endif - *pxTopOfStack = ( portSTACK_TYPE ) pvParameters; /* R1 */ + *pxTopOfStack = ( StackType_t ) pvParameters; /* R1 */ pxTopOfStack--; *pxTopOfStack = portINITIAL_FPSW; pxTopOfStack--; @@ -184,7 +184,7 @@ portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE } /*-----------------------------------------------------------*/ -portBASE_TYPE xPortStartScheduler( void ) +BaseType_t xPortStartScheduler( void ) { extern void vApplicationSetupTimerInterrupt( void ); @@ -366,7 +366,7 @@ void vTickISR( void ) } /*-----------------------------------------------------------*/ -unsigned long ulPortGetIPL( void ) +uint32_t ulPortGetIPL( void ) { __asm volatile ( @@ -380,7 +380,7 @@ unsigned long ulPortGetIPL( void ) } /*-----------------------------------------------------------*/ -void vPortSetIPL( unsigned long ulNewIPL ) +void vPortSetIPL( uint32_t ulNewIPL ) { __asm volatile ( diff --git a/FreeRTOS/Source/portable/GCC/RX600/portmacro.h b/FreeRTOS/Source/portable/GCC/RX600/portmacro.h index c17591af1..0940aa9a4 100644 --- a/FreeRTOS/Source/portable/GCC/RX600/portmacro.h +++ b/FreeRTOS/Source/portable/GCC/RX600/portmacro.h @@ -1,5 +1,5 @@ /* - FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. + FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. All rights reserved VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. @@ -72,7 +72,7 @@ extern "C" { #endif /*----------------------------------------------------------- - * Port specific definitions. + * Port specific definitions. * * The settings in this file configure FreeRTOS correctly for the * given hardware and compiler. @@ -88,27 +88,31 @@ portSTACK_TYPE and portBASE_TYPE. */ #define portDOUBLE double #define portLONG long #define portSHORT short -#define portSTACK_TYPE unsigned portLONG +#define portSTACK_TYPE uint32_t #define portBASE_TYPE long +typedef portSTACK_TYPE StackType_t; +typedef long BaseType_t; +typedef unsigned long UBaseType_t; + #if( configUSE_16_BIT_TICKS == 1 ) - typedef unsigned portSHORT portTickType; - #define portMAX_DELAY ( portTickType ) 0xffff + typedef uint16_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffff #else - typedef unsigned portLONG portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffffUL + typedef uint32_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffffffffUL #endif /*-----------------------------------------------------------*/ /* Hardware specifics. */ #define portBYTE_ALIGNMENT 8 /* Could make four, according to manual. */ #define portSTACK_GROWTH -1 -#define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ ) +#define portTICK_RATE_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ ) #define portNOP() __asm volatile( "NOP" ) /* Yield equivalent to "*portITU_SWINTR = 0x01; ( void ) *portITU_SWINTR;" where portITU_SWINTR is the location of the software interrupt register -(0x000872E0). Don't rely on the assembler to select a register, so instead +(0x000872E0). Don't rely on the assembler to select a register, so instead save and restore clobbered registers manually. */ #define portYIELD() \ __asm volatile \ @@ -122,14 +126,14 @@ save and restore clobbered registers manually. */ #define portYIELD_FROM_ISR( x ) if( x != pdFALSE ) portYIELD() -/* These macros should not be called directly, but through the -taskENTER_CRITICAL() and taskEXIT_CRITICAL() macros. An extra check is -performed if configASSERT() is defined to ensure an assertion handler does not -inadvertently attempt to lower the IPL when the call to assert was triggered -because the IPL value was found to be above configMAX_SYSCALL_INTERRUPT_PRIORITY -when an ISR safe FreeRTOS API function was executed. ISR safe FreeRTOS API -functions are those that end in FromISR. FreeRTOS maintains a separate -interrupt API to ensure API function and interrupt entry is as fast and as +/* These macros should not be called directly, but through the +taskENTER_CRITICAL() and taskEXIT_CRITICAL() macros. An extra check is +performed if configASSERT() is defined to ensure an assertion handler does not +inadvertently attempt to lower the IPL when the call to assert was triggered +because the IPL value was found to be above configMAX_SYSCALL_INTERRUPT_PRIORITY +when an ISR safe FreeRTOS API function was executed. ISR safe FreeRTOS API +functions are those that end in FromISR. FreeRTOS maintains a separate +interrupt API to ensure API function and interrupt entry is as fast and as simple as possible. */ #define portENABLE_INTERRUPTS() __asm volatile ( "MVTIPL #0" ) #ifdef configASSERT @@ -149,8 +153,8 @@ extern void vTaskExitCritical( void ); #define portEXIT_CRITICAL() vTaskExitCritical() /* As this port allows interrupt nesting... */ -unsigned long ulPortGetIPL( void ) __attribute__((naked)); -void vPortSetIPL( unsigned long ulNewIPL ) __attribute__((naked)); +uint32_t ulPortGetIPL( void ) __attribute__((naked)); +void vPortSetIPL( uint32_t ulNewIPL ) __attribute__((naked)); #define portSET_INTERRUPT_MASK_FROM_ISR() ulPortGetIPL(); portDISABLE_INTERRUPTS() #define portCLEAR_INTERRUPT_MASK_FROM_ISR( uxSavedInterruptStatus ) vPortSetIPL( uxSavedInterruptStatus ) diff --git a/FreeRTOS/Source/portable/GCC/STR75x/port.c b/FreeRTOS/Source/portable/GCC/STR75x/port.c index 1041e1c28..ebcc99e6a 100644 --- a/FreeRTOS/Source/portable/GCC/STR75x/port.c +++ b/FreeRTOS/Source/portable/GCC/STR75x/port.c @@ -77,12 +77,12 @@ #include "task.h" /* Constants required to setup the initial stack. */ -#define portINITIAL_SPSR ( ( portSTACK_TYPE ) 0x1f ) /* System mode, ARM mode, interrupts enabled. */ -#define portTHUMB_MODE_BIT ( ( portSTACK_TYPE ) 0x20 ) -#define portINSTRUCTION_SIZE ( ( portSTACK_TYPE ) 4 ) +#define portINITIAL_SPSR ( ( StackType_t ) 0x1f ) /* System mode, ARM mode, interrupts enabled. */ +#define portTHUMB_MODE_BIT ( ( StackType_t ) 0x20 ) +#define portINSTRUCTION_SIZE ( ( StackType_t ) 4 ) /* Constants required to handle critical sections. */ -#define portNO_CRITICAL_NESTING ( ( unsigned long ) 0 ) +#define portNO_CRITICAL_NESTING ( ( uint32_t ) 0 ) /* Prescale used on the timer clock when calculating the tick period. */ #define portPRESCALE 20 @@ -101,9 +101,9 @@ static void prvSetupTimerInterrupt( void ); * * See header file for description. */ -portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) +StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) { -portSTACK_TYPE *pxOriginalTOS; +StackType_t *pxOriginalTOS; pxOriginalTOS = pxTopOfStack; @@ -117,45 +117,45 @@ portSTACK_TYPE *pxOriginalTOS; /* First on the stack is the return address - which in this case is the start of the task. The offset is added to make the return address appear as it would within an IRQ ISR. */ - *pxTopOfStack = ( portSTACK_TYPE ) pxCode + portINSTRUCTION_SIZE; + *pxTopOfStack = ( StackType_t ) pxCode + portINSTRUCTION_SIZE; pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0xaaaaaaaa; /* R14 */ + *pxTopOfStack = ( StackType_t ) 0xaaaaaaaa; /* R14 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) pxOriginalTOS; /* Stack used when task starts goes in R13. */ + *pxTopOfStack = ( StackType_t ) pxOriginalTOS; /* Stack used when task starts goes in R13. */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x12121212; /* R12 */ + *pxTopOfStack = ( StackType_t ) 0x12121212; /* R12 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x11111111; /* R11 */ + *pxTopOfStack = ( StackType_t ) 0x11111111; /* R11 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x10101010; /* R10 */ + *pxTopOfStack = ( StackType_t ) 0x10101010; /* R10 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x09090909; /* R9 */ + *pxTopOfStack = ( StackType_t ) 0x09090909; /* R9 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x08080808; /* R8 */ + *pxTopOfStack = ( StackType_t ) 0x08080808; /* R8 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x07070707; /* R7 */ + *pxTopOfStack = ( StackType_t ) 0x07070707; /* R7 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x06060606; /* R6 */ + *pxTopOfStack = ( StackType_t ) 0x06060606; /* R6 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x05050505; /* R5 */ + *pxTopOfStack = ( StackType_t ) 0x05050505; /* R5 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x04040404; /* R4 */ + *pxTopOfStack = ( StackType_t ) 0x04040404; /* R4 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x03030303; /* R3 */ + *pxTopOfStack = ( StackType_t ) 0x03030303; /* R3 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x02020202; /* R2 */ + *pxTopOfStack = ( StackType_t ) 0x02020202; /* R2 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x01010101; /* R1 */ + *pxTopOfStack = ( StackType_t ) 0x01010101; /* R1 */ pxTopOfStack--; /* When the task starts is will expect to find the function parameter in R0. */ - *pxTopOfStack = ( portSTACK_TYPE ) pvParameters; /* R0 */ + *pxTopOfStack = ( StackType_t ) pvParameters; /* R0 */ pxTopOfStack--; /* The status register is set for system mode, with interrupts enabled. */ - *pxTopOfStack = ( portSTACK_TYPE ) portINITIAL_SPSR; + *pxTopOfStack = ( StackType_t ) portINITIAL_SPSR; #ifdef THUMB_INTERWORK { @@ -175,7 +175,7 @@ portSTACK_TYPE *pxOriginalTOS; } /*-----------------------------------------------------------*/ -portBASE_TYPE xPortStartScheduler( void ) +BaseType_t xPortStartScheduler( void ) { extern void vPortISRStartFirstTask( void ); diff --git a/FreeRTOS/Source/portable/GCC/STR75x/portISR.c b/FreeRTOS/Source/portable/GCC/STR75x/portISR.c index 4bc5b8639..3df265ae4 100644 --- a/FreeRTOS/Source/portable/GCC/STR75x/portISR.c +++ b/FreeRTOS/Source/portable/GCC/STR75x/portISR.c @@ -78,9 +78,9 @@ #include "task.h" /* Constants required to handle critical sections. */ -#define portNO_CRITICAL_NESTING ( ( unsigned long ) 0 ) +#define portNO_CRITICAL_NESTING ( ( uint32_t ) 0 ) -volatile unsigned long ulCriticalNesting = 9999UL; +volatile uint32_t ulCriticalNesting = 9999UL; /*-----------------------------------------------------------*/ diff --git a/FreeRTOS/Source/portable/GCC/STR75x/portmacro.h b/FreeRTOS/Source/portable/GCC/STR75x/portmacro.h index 8621f7452..bef92cfaf 100644 --- a/FreeRTOS/Source/portable/GCC/STR75x/portmacro.h +++ b/FreeRTOS/Source/portable/GCC/STR75x/portmacro.h @@ -1,5 +1,5 @@ /* - FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. + FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. All rights reserved VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. @@ -87,31 +87,35 @@ extern "C" { #define portDOUBLE double #define portLONG long #define portSHORT short -#define portSTACK_TYPE unsigned portLONG -#define portBASE_TYPE portLONG +#define portSTACK_TYPE uint32_t +#define portBASE_TYPE long + +typedef portSTACK_TYPE StackType_t; +typedef long BaseType_t; +typedef unsigned long UBaseType_t; #if( configUSE_16_BIT_TICKS == 1 ) - typedef unsigned portSHORT portTickType; - #define portMAX_DELAY ( portTickType ) 0xffff + typedef uint16_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffff #else - typedef unsigned portLONG portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffffUL + typedef uint32_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffffffffUL #endif -/*-----------------------------------------------------------*/ +/*-----------------------------------------------------------*/ /* Hardware specifics. */ #define portSTACK_GROWTH ( -1 ) -#define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ ) +#define portTICK_RATE_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ ) #define portBYTE_ALIGNMENT 8 #define portYIELD() asm volatile ( "SWI 0" ) #define portNOP() asm volatile ( "NOP" ) -/*-----------------------------------------------------------*/ +/*-----------------------------------------------------------*/ /* Critical section handling. */ /* * The interrupt management utilities can only be called from ARM mode. When - * THUMB_INTERWORK is defined the utilities are defined as functions in - * portISR.c to ensure a switch to ARM mode. When THUMB_INTERWORK is not + * THUMB_INTERWORK is defined the utilities are defined as functions in + * portISR.c to ensure a switch to ARM mode. When THUMB_INTERWORK is not * defined then the utilities are defined as macros here - as per other ports. */ @@ -122,7 +126,7 @@ extern "C" { #define portDISABLE_INTERRUPTS() vPortDisableInterruptsFromThumb() #define portENABLE_INTERRUPTS() vPortEnableInterruptsFromThumb() - + #else #define portDISABLE_INTERRUPTS() \ @@ -132,7 +136,7 @@ extern "C" { "ORR R0, R0, #0xC0 \n\t" /* Disable IRQ, FIQ. */ \ "MSR CPSR, R0 \n\t" /* Write back modified value. */ \ "LDMIA SP!, {R0} " ) /* Pop R0. */ - + #define portENABLE_INTERRUPTS() \ asm volatile ( \ "STMDB SP!, {R0} \n\t" /* Push R0. */ \ @@ -148,7 +152,7 @@ extern void vPortExitCritical( void ); #define portENTER_CRITICAL() vPortEnterCritical(); #define portEXIT_CRITICAL() vPortExitCritical(); -/*-----------------------------------------------------------*/ +/*-----------------------------------------------------------*/ /* Task utilities. */ #define portEND_SWITCHING_ISR( xSwitchRequired ) \ @@ -160,7 +164,7 @@ extern void vTaskSwitchContext( void ); \ vTaskSwitchContext(); \ } \ } -/*-----------------------------------------------------------*/ +/*-----------------------------------------------------------*/ /* Task function macros as described on the FreeRTOS.org WEB site. */ #define portTASK_FUNCTION_PROTO( vFunction, pvParameters ) void vFunction( void * pvParameters ) diff --git a/FreeRTOS/Source/portable/GCC/TriCore_1782/port.c b/FreeRTOS/Source/portable/GCC/TriCore_1782/port.c index eb7e4b2ae..73abb4e73 100644 --- a/FreeRTOS/Source/portable/GCC/TriCore_1782/port.c +++ b/FreeRTOS/Source/portable/GCC/TriCore_1782/port.c @@ -126,17 +126,17 @@ static void prvInterruptYield( int iTrapIdentification ); /*-----------------------------------------------------------*/ /* This reference is required by the save/restore context macros. */ -extern volatile unsigned long *pxCurrentTCB; +extern volatile uint32_t *pxCurrentTCB; /* Precalculate the compare match value at compile time. */ -static const unsigned long ulCompareMatchValue = ( configPERIPHERAL_CLOCK_HZ / configTICK_RATE_HZ ); +static const uint32_t ulCompareMatchValue = ( configPERIPHERAL_CLOCK_HZ / configTICK_RATE_HZ ); /*-----------------------------------------------------------*/ -portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE * pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) +StackType_t *pxPortInitialiseStack( StackType_t * pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) { -unsigned long *pulUpperCSA = NULL; -unsigned long *pulLowerCSA = NULL; +uint32_t *pulUpperCSA = NULL; +uint32_t *pulLowerCSA = NULL; /* 16 Address Registers (4 Address registers are global), 16 Data Registers, and 3 System Registers. @@ -189,24 +189,24 @@ unsigned long *pulLowerCSA = NULL; portEXIT_CRITICAL(); /* Clear the upper CSA. */ - memset( pulUpperCSA, 0, portNUM_WORDS_IN_CSA * sizeof( unsigned long ) ); + memset( pulUpperCSA, 0, portNUM_WORDS_IN_CSA * sizeof( uint32_t ) ); /* Upper Context. */ - pulUpperCSA[ 2 ] = ( unsigned long )pxTopOfStack; /* A10; Stack Return aka Stack Pointer */ + pulUpperCSA[ 2 ] = ( uint32_t )pxTopOfStack; /* A10; Stack Return aka Stack Pointer */ pulUpperCSA[ 1 ] = portSYSTEM_PROGRAM_STATUS_WORD; /* PSW */ /* Clear the lower CSA. */ - memset( pulLowerCSA, 0, portNUM_WORDS_IN_CSA * sizeof( unsigned long ) ); + memset( pulLowerCSA, 0, portNUM_WORDS_IN_CSA * sizeof( uint32_t ) ); /* Lower Context. */ - pulLowerCSA[ 8 ] = ( unsigned long ) pvParameters; /* A4; Address Type Parameter Register */ - pulLowerCSA[ 1 ] = ( unsigned long ) pxCode; /* A11; Return Address aka RA */ + pulLowerCSA[ 8 ] = ( uint32_t ) pvParameters; /* A4; Address Type Parameter Register */ + pulLowerCSA[ 1 ] = ( uint32_t ) pxCode; /* A11; Return Address aka RA */ /* PCXI pointing to the Upper context. */ - pulLowerCSA[ 0 ] = ( portINITIAL_PCXI_UPPER_CONTEXT_WORD | ( unsigned long ) portADDRESS_TO_CSA( pulUpperCSA ) ); + pulLowerCSA[ 0 ] = ( portINITIAL_PCXI_UPPER_CONTEXT_WORD | ( uint32_t ) portADDRESS_TO_CSA( pulUpperCSA ) ); /* Save the link to the CSA in the top of stack. */ - pxTopOfStack = (unsigned long * ) portADDRESS_TO_CSA( pulLowerCSA ); + pxTopOfStack = (uint32_t * ) portADDRESS_TO_CSA( pulLowerCSA ); /* DSync to ensure that buffering is not a problem. */ _dsync(); @@ -215,12 +215,12 @@ unsigned long *pulLowerCSA = NULL; } /*-----------------------------------------------------------*/ -long xPortStartScheduler( void ) +int32_t xPortStartScheduler( void ) { extern void vTrapInstallHandlers( void ); -unsigned long ulMFCR = 0UL; -unsigned long *pulUpperCSA = NULL; -unsigned long *pulLowerCSA = NULL; +uint32_t ulMFCR = 0UL; +uint32_t *pulUpperCSA = NULL; +uint32_t *pulLowerCSA = NULL; /* Interrupts at or below configMAX_SYSCALL_INTERRUPT_PRIORITY are disable when this function is called. */ @@ -322,11 +322,11 @@ static void prvSetupTimerInterrupt( void ) static void prvSystemTickHandler( int iArg ) { -unsigned long ulSavedInterruptMask; -unsigned long *pxUpperCSA = NULL; -unsigned long xUpperCSA = 0UL; -extern volatile unsigned long *pxCurrentTCB; -long lYieldRequired; +uint32_t ulSavedInterruptMask; +uint32_t *pxUpperCSA = NULL; +uint32_t xUpperCSA = 0UL; +extern volatile uint32_t *pxCurrentTCB; +int32_t lYieldRequired; /* Just to avoid compiler warnings about unused parameters. */ ( void ) iArg; @@ -413,10 +413,10 @@ long lYieldRequired; * than they can be freed assuming that tasks are being spawned and * deleted frequently. */ -void vPortReclaimCSA( unsigned long *pxTCB ) +void vPortReclaimCSA( uint32_t *pxTCB ) { -unsigned long pxHeadCSA, pxTailCSA, pxFreeCSA; -unsigned long *pulNextCSA; +uint32_t pxHeadCSA, pxTailCSA, pxFreeCSA; +uint32_t *pulNextCSA; /* A pointer to the first CSA in the list of CSAs consumed by the task is stored in the first element of the tasks TCB structure (where the stack @@ -476,9 +476,9 @@ void vPortEndScheduler( void ) static void prvTrapYield( int iTrapIdentification ) { -unsigned long *pxUpperCSA = NULL; -unsigned long xUpperCSA = 0UL; -extern volatile unsigned long *pxCurrentTCB; +uint32_t *pxUpperCSA = NULL; +uint32_t xUpperCSA = 0UL; +extern volatile uint32_t *pxCurrentTCB; switch( iTrapIdentification ) { @@ -523,9 +523,9 @@ extern volatile unsigned long *pxCurrentTCB; static void prvInterruptYield( int iId ) { -unsigned long *pxUpperCSA = NULL; -unsigned long xUpperCSA = 0UL; -extern volatile unsigned long *pxCurrentTCB; +uint32_t *pxUpperCSA = NULL; +uint32_t xUpperCSA = 0UL; +extern volatile uint32_t *pxCurrentTCB; /* Just to remove compiler warnings. */ ( void ) iId; @@ -561,9 +561,9 @@ extern volatile unsigned long *pxCurrentTCB; } /*-----------------------------------------------------------*/ -unsigned long uxPortSetInterruptMaskFromISR( void ) +uint32_t uxPortSetInterruptMaskFromISR( void ) { -unsigned long uxReturn = 0UL; +uint32_t uxReturn = 0UL; _disable(); uxReturn = _mfcr( $ICR ); diff --git a/FreeRTOS/Source/portable/GCC/TriCore_1782/portmacro.h b/FreeRTOS/Source/portable/GCC/TriCore_1782/portmacro.h index bbe15baae..c8090ff85 100644 --- a/FreeRTOS/Source/portable/GCC/TriCore_1782/portmacro.h +++ b/FreeRTOS/Source/portable/GCC/TriCore_1782/portmacro.h @@ -1,5 +1,5 @@ /* - FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. + FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. All rights reserved VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. @@ -90,21 +90,25 @@ extern "C" { #define portDOUBLE double #define portLONG long #define portSHORT short -#define portSTACK_TYPE unsigned long +#define portSTACK_TYPE uint32_t #define portBASE_TYPE long +typedef portSTACK_TYPE StackType_t; +typedef long BaseType_t; +typedef unsigned long UBaseType_t; + #if( configUSE_16_BIT_TICKS == 1 ) - typedef unsigned portSHORT portTickType; - #define portMAX_DELAY ( portTickType ) 0xffff + typedef uint16_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffff #else - typedef unsigned portLONG portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffffUL + typedef uint32_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffffffffUL #endif /*---------------------------------------------------------------------------*/ /* Architecture specifics. */ #define portSTACK_GROWTH ( -1 ) -#define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ ) +#define portTICK_RATE_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ ) #define portBYTE_ALIGNMENT 4 #define portNOP() __asm volatile( " nop " ) #define portCRITICAL_NESTING_IN_TCB 1 @@ -113,7 +117,7 @@ extern "C" { /*---------------------------------------------------------------------------*/ -typedef struct MPU_SETTINGS { unsigned long ulNotUsed; } xMPU_SETTINGS; +typedef struct MPU_SETTINGS { uint32_t ulNotUsed; } xMPU_SETTINGS; /* Define away the instruction from the Restore Context Macro. */ #define portPRIVILEGE_BIT 0x0UL @@ -127,8 +131,8 @@ extern void vTaskExitCritical( void ); /*---------------------------------------------------------------------------*/ /* CSA Manipulation. */ -#define portCSA_TO_ADDRESS( pCSA ) ( ( unsigned long * )( ( ( ( pCSA ) & 0x000F0000 ) << 12 ) | ( ( ( pCSA ) & 0x0000FFFF ) << 6 ) ) ) -#define portADDRESS_TO_CSA( pAddress ) ( ( unsigned long )( ( ( ( (unsigned long)( pAddress ) ) & 0xF0000000 ) >> 12 ) | ( ( ( unsigned long )( pAddress ) & 0x003FFFC0 ) >> 6 ) ) ) +#define portCSA_TO_ADDRESS( pCSA ) ( ( uint32_t * )( ( ( ( pCSA ) & 0x000F0000 ) << 12 ) | ( ( ( pCSA ) & 0x0000FFFF ) << 6 ) ) ) +#define portADDRESS_TO_CSA( pAddress ) ( ( uint32_t )( ( ( ( (uint32_t)( pAddress ) ) & 0xF0000000 ) >> 12 ) | ( ( ( uint32_t )( pAddress ) & 0x003FFFC0 ) >> 6 ) ) ) /*---------------------------------------------------------------------------*/ #define portYIELD() _syscall( 0 ) @@ -141,7 +145,7 @@ extern void vTaskExitCritical( void ); /* Set ICR.CCPN to configMAX_SYSCALL_INTERRUPT_PRIORITY. */ #define portDISABLE_INTERRUPTS() { \ - unsigned long ulICR; \ + uint32_t ulICR; \ _disable(); \ ulICR = _mfcr( $ICR ); /* Get current ICR value. */ \ ulICR &= ~portCCPN_MASK; /* Clear down mask bits. */ \ @@ -153,7 +157,7 @@ extern void vTaskExitCritical( void ); /* Clear ICR.CCPN to allow all interrupt priorities. */ #define portENABLE_INTERRUPTS() { \ - unsigned long ulICR; \ + uint32_t ulICR; \ _disable(); \ ulICR = _mfcr( $ICR ); /* Get current ICR value. */ \ ulICR &= ~portCCPN_MASK; /* Clear down mask bits. */ \ @@ -164,7 +168,7 @@ extern void vTaskExitCritical( void ); /* Set ICR.CCPN to uxSavedMaskValue. */ #define portCLEAR_INTERRUPT_MASK_FROM_ISR( uxSavedMaskValue ) { \ - unsigned long ulICR; \ + uint32_t ulICR; \ _disable(); \ ulICR = _mfcr( $ICR ); /* Get current ICR value. */ \ ulICR &= ~portCCPN_MASK; /* Clear down mask bits. */ \ @@ -176,7 +180,7 @@ extern void vTaskExitCritical( void ); /* Set ICR.CCPN to configMAX_SYSCALL_INTERRUPT_PRIORITY */ -extern unsigned long uxPortSetInterruptMaskFromISR( void ); +extern uint32_t uxPortSetInterruptMaskFromISR( void ); #define portSET_INTERRUPT_MASK_FROM_ISR() uxPortSetInterruptMaskFromISR() /* Pend a priority 1 interrupt, which will take care of the context switch. */ @@ -193,8 +197,8 @@ extern unsigned long uxPortSetInterruptMaskFromISR( void ); * Port specific clean up macro required to free the CSAs that were consumed by * a task that has since been deleted. */ -void vPortReclaimCSA( unsigned long *pxTCB ); -#define portCLEAN_UP_TCB( pxTCB ) vPortReclaimCSA( ( unsigned long * ) ( pxTCB ) ) +void vPortReclaimCSA( uint32_t *pxTCB ); +#define portCLEAN_UP_TCB( pxTCB ) vPortReclaimCSA( ( uint32_t * ) ( pxTCB ) ) #ifdef __cplusplus } diff --git a/FreeRTOS/Source/portable/GCC/TriCore_1782/porttrap.c b/FreeRTOS/Source/portable/GCC/TriCore_1782/porttrap.c index f14749c9d..c607d3e96 100644 --- a/FreeRTOS/Source/portable/GCC/TriCore_1782/porttrap.c +++ b/FreeRTOS/Source/portable/GCC/TriCore_1782/porttrap.c @@ -75,7 +75,7 @@ /* * This reference is required by the Save/Restore Context Macros. */ -extern volatile unsigned long *pxCurrentTCB; +extern volatile uint32_t *pxCurrentTCB; /*-----------------------------------------------------------*/ /* diff --git a/FreeRTOS/Source/portable/IAR/78K0R/port.c b/FreeRTOS/Source/portable/IAR/78K0R/port.c index 80caf8f7b..ea951ff2a 100644 --- a/FreeRTOS/Source/portable/IAR/78K0R/port.c +++ b/FreeRTOS/Source/portable/IAR/78K0R/port.c @@ -72,7 +72,7 @@ /* The critical nesting value is initialised to a non zero value to ensure interrupts don't accidentally become enabled before the scheduler is started. */ -#define portINITIAL_CRITICAL_NESTING (( unsigned short ) 10) +#define portINITIAL_CRITICAL_NESTING (( uint16_t ) 10) /* Initial PSW value allocated to a newly created task. * 1100011000000000 @@ -89,8 +89,8 @@ interrupts don't accidentally become enabled before the scheduler is started. */ /* We require the address of the pxCurrentTCB variable, but don't want to know any details of its type. */ -typedef void tskTCB; -extern volatile tskTCB * volatile pxCurrentTCB; +typedef void TCB_t; +extern volatile TCB_t * volatile pxCurrentTCB; /* Most ports implement critical sections by placing the interrupt flags on the stack before disabling interrupts. Exiting the critical section is then @@ -104,7 +104,7 @@ with interrupts only being re-enabled if the count is zero. usCriticalNesting will get set to zero when the scheduler starts, but must not be initialised to zero as this will cause problems during the startup sequence. */ -volatile unsigned short usCriticalNesting = portINITIAL_CRITICAL_NESTING; +volatile uint16_t usCriticalNesting = portINITIAL_CRITICAL_NESTING; /*-----------------------------------------------------------*/ /* @@ -119,9 +119,9 @@ static void prvSetupTimerInterrupt( void ); * * See the header file portable.h. */ -portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) +StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) { -unsigned long *pulLocal; +uint32_t *pulLocal; #if configMEMORY_MODE == 1 { @@ -130,15 +130,15 @@ unsigned long *pulLocal; pxTopOfStack--; /* Write in the parameter value. */ - pulLocal = ( unsigned long * ) pxTopOfStack; - *pulLocal = ( unsigned long ) pvParameters; + pulLocal = ( uint32_t * ) pxTopOfStack; + *pulLocal = ( uint32_t ) pvParameters; pxTopOfStack--; /* These values are just spacers. The return address of the function would normally be written here. */ - *pxTopOfStack = ( portSTACK_TYPE ) 0xcdcd; + *pxTopOfStack = ( StackType_t ) 0xcdcd; pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0xcdcd; + *pxTopOfStack = ( StackType_t ) 0xcdcd; pxTopOfStack--; /* The start address / PSW value is also written in as a 32bit value, @@ -146,12 +146,12 @@ unsigned long *pulLocal; pxTopOfStack--; /* Task function start address combined with the PSW. */ - pulLocal = ( unsigned long * ) pxTopOfStack; - *pulLocal = ( ( ( unsigned long ) pxCode ) | ( portPSW << 24UL ) ); + pulLocal = ( uint32_t * ) pxTopOfStack; + *pulLocal = ( ( ( uint32_t ) pxCode ) | ( portPSW << 24UL ) ); pxTopOfStack--; /* An initial value for the AX register. */ - *pxTopOfStack = ( portSTACK_TYPE ) 0x1111; + *pxTopOfStack = ( StackType_t ) 0x1111; pxTopOfStack--; } #else @@ -162,33 +162,33 @@ unsigned long *pulLocal; pxTopOfStack--; /* Task function start address combined with the PSW. */ - pulLocal = ( unsigned long * ) pxTopOfStack; - *pulLocal = ( ( ( unsigned long ) pxCode ) | ( portPSW << 24UL ) ); + pulLocal = ( uint32_t * ) pxTopOfStack; + *pulLocal = ( ( ( uint32_t ) pxCode ) | ( portPSW << 24UL ) ); pxTopOfStack--; /* The parameter is passed in AX. */ - *pxTopOfStack = ( portSTACK_TYPE ) pvParameters; + *pxTopOfStack = ( StackType_t ) pvParameters; pxTopOfStack--; } #endif /* An initial value for the HL register. */ - *pxTopOfStack = ( portSTACK_TYPE ) 0x2222; + *pxTopOfStack = ( StackType_t ) 0x2222; pxTopOfStack--; /* CS and ES registers. */ - *pxTopOfStack = ( portSTACK_TYPE ) 0x0F00; + *pxTopOfStack = ( StackType_t ) 0x0F00; pxTopOfStack--; /* Finally the remaining general purpose registers DE and BC */ - *pxTopOfStack = ( portSTACK_TYPE ) 0xDEDE; + *pxTopOfStack = ( StackType_t ) 0xDEDE; pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0xBCBC; + *pxTopOfStack = ( StackType_t ) 0xBCBC; pxTopOfStack--; /* Finally the critical section nesting count is set to zero when the task first starts. */ - *pxTopOfStack = ( portSTACK_TYPE ) portNO_CRITICAL_SECTION_NESTING; + *pxTopOfStack = ( StackType_t ) portNO_CRITICAL_SECTION_NESTING; /* Return a pointer to the top of the stack we have generated so this can be stored in the task control block for the task. */ @@ -196,7 +196,7 @@ unsigned long *pulLocal; } /*-----------------------------------------------------------*/ -portBASE_TYPE xPortStartScheduler( void ) +BaseType_t xPortStartScheduler( void ) { /* Setup the hardware to generate the tick. Interrupts are disabled when this function is called. */ @@ -242,7 +242,7 @@ static void prvSetupTimerInterrupt( void ) TMR05 = 0x0000; /* Set the compare match value according to the tick rate we want. */ - TDR05 = ( portTickType ) ( configCPU_CLOCK_HZ / configTICK_RATE_HZ ); + TDR05 = ( TickType_t ) ( configCPU_CLOCK_HZ / configTICK_RATE_HZ ); /* Set Timer Array Unit Channel 5 output mode */ TOM0 &= ~0x0020; diff --git a/FreeRTOS/Source/portable/IAR/78K0R/portmacro.h b/FreeRTOS/Source/portable/IAR/78K0R/portmacro.h index e1842a801..9d1c42633 100644 --- a/FreeRTOS/Source/portable/IAR/78K0R/portmacro.h +++ b/FreeRTOS/Source/portable/IAR/78K0R/portmacro.h @@ -1,5 +1,5 @@ /* - FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. + FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. All rights reserved VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. @@ -87,17 +87,21 @@ extern "C" { #define portDOUBLE double #define portLONG long #define portSHORT short -#define portSTACK_TYPE unsigned short +#define portSTACK_TYPE uint16_t #define portBASE_TYPE short +typedef portSTACK_TYPE StackType_t; +typedef short BaseType_t; +typedef unsigned short UBaseType_t; + #if (configUSE_16_BIT_TICKS==1) - typedef unsigned int portTickType; - #define portMAX_DELAY ( portTickType ) 0xffff + typedef unsigned int TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffff #else - typedef unsigned long portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffffUL + typedef uint32_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffffffffUL #endif -/*-----------------------------------------------------------*/ +/*-----------------------------------------------------------*/ /* Interrupt control macros. */ #define portDISABLE_INTERRUPTS() __asm ( "DI" ) @@ -105,11 +109,11 @@ extern "C" { /*-----------------------------------------------------------*/ /* Critical section control macros. */ -#define portNO_CRITICAL_SECTION_NESTING ( ( unsigned portSHORT ) 0 ) +#define portNO_CRITICAL_SECTION_NESTING ( ( uint16_t ) 0 ) #define portENTER_CRITICAL() \ { \ -extern volatile unsigned portSHORT usCriticalNesting; \ +extern volatile uint16_t usCriticalNesting; \ \ portDISABLE_INTERRUPTS(); \ \ @@ -121,7 +125,7 @@ extern volatile unsigned portSHORT usCriticalNesting; \ #define portEXIT_CRITICAL() \ { \ -extern volatile unsigned portSHORT usCriticalNesting; \ +extern volatile uint16_t usCriticalNesting; \ \ if( usCriticalNesting > portNO_CRITICAL_SECTION_NESTING ) \ { \ @@ -148,7 +152,7 @@ extern void vPortStart( void ); /* Hardwware specifics. */ #define portBYTE_ALIGNMENT 2 #define portSTACK_GROWTH ( -1 ) -#define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ ) +#define portTICK_RATE_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ ) /*-----------------------------------------------------------*/ /* Task function macros as described on the FreeRTOS.org WEB site. */ diff --git a/FreeRTOS/Source/portable/IAR/ARM_CA9/port.c b/FreeRTOS/Source/portable/IAR/ARM_CA9/port.c index 8e86d3406..a83b07bd4 100644 --- a/FreeRTOS/Source/portable/IAR/ARM_CA9/port.c +++ b/FreeRTOS/Source/portable/IAR/ARM_CA9/port.c @@ -115,7 +115,7 @@ /* A critical section is exited when the critical section nesting count reaches this value. */ -#define portNO_CRITICAL_NESTING ( ( unsigned long ) 0 ) +#define portNO_CRITICAL_NESTING ( ( uint32_t ) 0 ) /* In all GICs 255 can be written to the priority mask register to unmask all (but the lowest) interrupt priority. */ @@ -126,17 +126,17 @@ floating point context after they have been created. A variable is stored as part of the tasks context that holds portNO_FLOATING_POINT_CONTEXT if the task does not have an FPU context, or any other value if the task does have an FPU context. */ -#define portNO_FLOATING_POINT_CONTEXT ( ( portSTACK_TYPE ) 0 ) +#define portNO_FLOATING_POINT_CONTEXT ( ( StackType_t ) 0 ) /* Constants required to setup the initial task context. */ -#define portINITIAL_SPSR ( ( portSTACK_TYPE ) 0x1f ) /* System mode, ARM mode, interrupts enabled. */ -#define portTHUMB_MODE_BIT ( ( portSTACK_TYPE ) 0x20 ) +#define portINITIAL_SPSR ( ( StackType_t ) 0x1f ) /* System mode, ARM mode, interrupts enabled. */ +#define portTHUMB_MODE_BIT ( ( StackType_t ) 0x20 ) #define portINTERRUPT_ENABLE_BIT ( 0x80UL ) #define portTHUMB_MODE_ADDRESS ( 0x01UL ) /* Used by portASSERT_IF_INTERRUPT_PRIORITY_INVALID() when ensuring the binary point is zero. */ -#define portBINARY_POINT_BITS ( ( unsigned char ) 0x03 ) +#define portBINARY_POINT_BITS ( ( uint8_t ) 0x03 ) /* Masks all bits in the APSR other than the mode bits. */ #define portAPSR_MODE_BITS_MASK ( 0x1F ) @@ -170,18 +170,18 @@ variable has to be stored as part of the task context and must be initialised to a non zero value to ensure interrupts don't inadvertently become unmasked before the scheduler starts. As it is stored as part of the task context it will automatically be set to 0 when the first task is started. */ -volatile unsigned long ulCriticalNesting = 9999UL; +volatile uint32_t ulCriticalNesting = 9999UL; /* Saved as part of the task context. If ulPortTaskHasFPUContext is non-zero then a floating point context must be saved and restored for the task. */ -unsigned long ulPortTaskHasFPUContext = pdFALSE; +uint32_t ulPortTaskHasFPUContext = pdFALSE; /* Set to 1 to pend a context switch from an ISR. */ -unsigned long ulPortYieldRequired = pdFALSE; +uint32_t ulPortYieldRequired = pdFALSE; /* Counts the interrupt nesting depth. A context switch is only performed if if the nesting depth is 0. */ -unsigned long ulPortInterruptNesting = 0UL; +uint32_t ulPortInterruptNesting = 0UL; /*-----------------------------------------------------------*/ @@ -189,7 +189,7 @@ unsigned long ulPortInterruptNesting = 0UL; /* * See header file for description. */ -portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) +StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) { /* Setup the initial stack of the task. The stack is set exactly as expected by the portRESTORE_CONTEXT() macro. @@ -203,9 +203,9 @@ portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxTopOfStack--; *pxTopOfStack = NULL; pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) portINITIAL_SPSR; + *pxTopOfStack = ( StackType_t ) portINITIAL_SPSR; - if( ( ( unsigned long ) pxCode & portTHUMB_MODE_ADDRESS ) != 0x00UL ) + if( ( ( uint32_t ) pxCode & portTHUMB_MODE_ADDRESS ) != 0x00UL ) { /* The task will start in THUMB mode. */ *pxTopOfStack |= portTHUMB_MODE_BIT; @@ -214,37 +214,37 @@ portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxTopOfStack--; /* Next the return address, which in this case is the start of the task. */ - *pxTopOfStack = ( portSTACK_TYPE ) pxCode; + *pxTopOfStack = ( StackType_t ) pxCode; pxTopOfStack--; /* Next all the registers other than the stack pointer. */ - *pxTopOfStack = ( portSTACK_TYPE ) 0x00000000; /* R14 */ + *pxTopOfStack = ( StackType_t ) 0x00000000; /* R14 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x12121212; /* R12 */ + *pxTopOfStack = ( StackType_t ) 0x12121212; /* R12 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x11111111; /* R11 */ + *pxTopOfStack = ( StackType_t ) 0x11111111; /* R11 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x10101010; /* R10 */ + *pxTopOfStack = ( StackType_t ) 0x10101010; /* R10 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x09090909; /* R9 */ + *pxTopOfStack = ( StackType_t ) 0x09090909; /* R9 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x08080808; /* R8 */ + *pxTopOfStack = ( StackType_t ) 0x08080808; /* R8 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x07070707; /* R7 */ + *pxTopOfStack = ( StackType_t ) 0x07070707; /* R7 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x06060606; /* R6 */ + *pxTopOfStack = ( StackType_t ) 0x06060606; /* R6 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x05050505; /* R5 */ + *pxTopOfStack = ( StackType_t ) 0x05050505; /* R5 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x04040404; /* R4 */ + *pxTopOfStack = ( StackType_t ) 0x04040404; /* R4 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x03030303; /* R3 */ + *pxTopOfStack = ( StackType_t ) 0x03030303; /* R3 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x02020202; /* R2 */ + *pxTopOfStack = ( StackType_t ) 0x02020202; /* R2 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x01010101; /* R1 */ + *pxTopOfStack = ( StackType_t ) 0x01010101; /* R1 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) pvParameters; /* R0 */ + *pxTopOfStack = ( StackType_t ) pvParameters; /* R0 */ pxTopOfStack--; /* The task will start with a critical nesting count of 0 as interrupts are @@ -261,9 +261,9 @@ portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE } /*-----------------------------------------------------------*/ -portBASE_TYPE xPortStartScheduler( void ) +BaseType_t xPortStartScheduler( void ) { -unsigned long ulAPSR; +uint32_t ulAPSR; /* Only continue if the CPU is not in User mode. The CPU must be in a Privileged mode for the scheduler to start. */ @@ -359,7 +359,7 @@ void FreeRTOS_Tick_Handler( void ) void vPortTaskUsesFPU( void ) { -unsigned long ulInitialFPSCR = 0; +uint32_t ulInitialFPSCR = 0; /* A task is registering the fact that it needs an FPU context. Set the FPU flag (which is saved as part of the task context). */ @@ -370,7 +370,7 @@ unsigned long ulInitialFPSCR = 0; } /*-----------------------------------------------------------*/ -void vPortClearInterruptMask( unsigned long ulNewMaskValue ) +void vPortClearInterruptMask( uint32_t ulNewMaskValue ) { if( ulNewMaskValue == pdFALSE ) { @@ -379,9 +379,9 @@ void vPortClearInterruptMask( unsigned long ulNewMaskValue ) } /*-----------------------------------------------------------*/ -unsigned long ulPortSetInterruptMask( void ) +uint32_t ulPortSetInterruptMask( void ) { -unsigned long ulReturn; +uint32_t ulReturn; __disable_irq(); if( portICCPMR_PRIORITY_MASK_REGISTER == ( configMAX_API_CALL_INTERRUPT_PRIORITY << portPRIORITY_SHIFT ) ) diff --git a/FreeRTOS/Source/portable/IAR/ARM_CA9/portmacro.h b/FreeRTOS/Source/portable/IAR/ARM_CA9/portmacro.h index c0c79c78d..7f927bd54 100644 --- a/FreeRTOS/Source/portable/IAR/ARM_CA9/portmacro.h +++ b/FreeRTOS/Source/portable/IAR/ARM_CA9/portmacro.h @@ -1,5 +1,5 @@ /* - FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. + FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. All rights reserved VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. @@ -91,16 +91,21 @@ #define portDOUBLE double #define portLONG long #define portSHORT short - #define portSTACK_TYPE unsigned long - #define portBASE_TYPE portLONG - typedef unsigned long portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffffUL + #define portSTACK_TYPE uint32_t + #define portBASE_TYPE long + +typedef portSTACK_TYPE StackType_t; +typedef long BaseType_t; +typedef unsigned long UBaseType_t; + + typedef uint32_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffffffffUL /*-----------------------------------------------------------*/ /* Hardware specifics. */ #define portSTACK_GROWTH ( -1 ) - #define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ ) + #define portTICK_RATE_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ ) #define portBYTE_ALIGNMENT 8 /*-----------------------------------------------------------*/ @@ -110,7 +115,7 @@ /* Called at the end of an ISR that can cause a context switch. */ #define portEND_SWITCHING_ISR( xSwitchRequired )\ { \ - extern unsigned long ulPortYieldRequired; \ + extern uint32_t ulPortYieldRequired; \ \ if( xSwitchRequired != pdFALSE ) \ { \ @@ -128,8 +133,8 @@ extern void vPortEnterCritical( void ); extern void vPortExitCritical( void ); - extern unsigned long ulPortSetInterruptMask( void ); - extern void vPortClearInterruptMask( unsigned long ulNewMaskValue ); + extern uint32_t ulPortSetInterruptMask( void ); + extern void vPortClearInterruptMask( uint32_t ulNewMaskValue ); /* These macros do not globally disable/enable interrupts. They do mask off interrupts that have a priority below configMAX_API_CALL_INTERRUPT_PRIORITY. */ @@ -157,7 +162,7 @@ void vPortTaskUsesFPU( void ); #define portTASK_USES_FLOATING_POINT() vPortTaskUsesFPU() - #define portLOWEST_INTERRUPT_PRIORITY ( ( ( unsigned long ) configUNIQUE_INTERRUPT_PRIORITIES ) - 1UL ) + #define portLOWEST_INTERRUPT_PRIORITY ( ( ( uint32_t ) configUNIQUE_INTERRUPT_PRIORITIES ) - 1UL ) #define portLOWEST_USABLE_INTERRUPT_PRIORITY ( portLOWEST_INTERRUPT_PRIORITY - 1UL ) /* Architecture specific optimisations. */ @@ -223,12 +228,12 @@ number of bits implemented by the interrupt controller. */ #define portICCRPR_RUNNING_PRIORITY_OFFSET ( 0x14 ) #define portINTERRUPT_CONTROLLER_CPU_INTERFACE_ADDRESS ( configINTERRUPT_CONTROLLER_BASE_ADDRESS + configINTERRUPT_CONTROLLER_CPU_INTERFACE_OFFSET ) -#define portICCPMR_PRIORITY_MASK_REGISTER ( *( ( volatile unsigned char * ) ( portINTERRUPT_CONTROLLER_CPU_INTERFACE_ADDRESS + portICCPMR_PRIORITY_MASK_OFFSET ) ) ) +#define portICCPMR_PRIORITY_MASK_REGISTER ( *( ( volatile uint8_t * ) ( portINTERRUPT_CONTROLLER_CPU_INTERFACE_ADDRESS + portICCPMR_PRIORITY_MASK_OFFSET ) ) ) #define portICCIAR_INTERRUPT_ACKNOWLEDGE_REGISTER_ADDRESS ( portINTERRUPT_CONTROLLER_CPU_INTERFACE_ADDRESS + portICCIAR_INTERRUPT_ACKNOWLEDGE_OFFSET ) #define portICCEOIR_END_OF_INTERRUPT_REGISTER_ADDRESS ( portINTERRUPT_CONTROLLER_CPU_INTERFACE_ADDRESS + portICCEOIR_END_OF_INTERRUPT_OFFSET ) #define portICCPMR_PRIORITY_MASK_REGISTER_ADDRESS ( portINTERRUPT_CONTROLLER_CPU_INTERFACE_ADDRESS + portICCPMR_PRIORITY_MASK_OFFSET ) -#define portICCBPR_BINARY_POINT_REGISTER ( *( ( const volatile unsigned long * ) ( portINTERRUPT_CONTROLLER_CPU_INTERFACE_ADDRESS + portICCBPR_BINARY_POINT_OFFSET ) ) ) -#define portICCRPR_RUNNING_PRIORITY_REGISTER ( *( ( const volatile unsigned char * ) ( portINTERRUPT_CONTROLLER_CPU_INTERFACE_ADDRESS + portICCRPR_RUNNING_PRIORITY_OFFSET ) ) ) +#define portICCBPR_BINARY_POINT_REGISTER ( *( ( const volatile uint32_t * ) ( portINTERRUPT_CONTROLLER_CPU_INTERFACE_ADDRESS + portICCBPR_BINARY_POINT_OFFSET ) ) ) +#define portICCRPR_RUNNING_PRIORITY_REGISTER ( *( ( const volatile uint8_t * ) ( portINTERRUPT_CONTROLLER_CPU_INTERFACE_ADDRESS + portICCRPR_RUNNING_PRIORITY_OFFSET ) ) ) #endif /* PORTMACRO_H */ diff --git a/FreeRTOS/Source/portable/IAR/ARM_CM0/port.c b/FreeRTOS/Source/portable/IAR/ARM_CM0/port.c index c1fa13709..9db99de7c 100644 --- a/FreeRTOS/Source/portable/IAR/ARM_CM0/port.c +++ b/FreeRTOS/Source/portable/IAR/ARM_CM0/port.c @@ -75,9 +75,9 @@ #include "task.h" /* Constants required to manipulate the NVIC. */ -#define portNVIC_SYSTICK_CTRL ( ( volatile unsigned long *) 0xe000e010 ) -#define portNVIC_SYSTICK_LOAD ( ( volatile unsigned long *) 0xe000e014 ) -#define portNVIC_SYSPRI2 ( ( volatile unsigned long *) 0xe000ed20 ) +#define portNVIC_SYSTICK_CTRL ( ( volatile uint32_t *) 0xe000e010 ) +#define portNVIC_SYSTICK_LOAD ( ( volatile uint32_t *) 0xe000e014 ) +#define portNVIC_SYSPRI2 ( ( volatile uint32_t *) 0xe000ed20 ) #define portNVIC_SYSTICK_CLK 0x00000004 #define portNVIC_SYSTICK_INT 0x00000002 #define portNVIC_SYSTICK_ENABLE 0x00000001 @@ -97,7 +97,7 @@ FreeRTOS.org versions prior to V4.3.0 did not include this definition. */ /* Each task maintains its own interrupt status in the critical nesting variable. */ -static unsigned portBASE_TYPE uxCriticalNesting = 0xaaaaaaaa; +static UBaseType_t uxCriticalNesting = 0xaaaaaaaa; /* * Setup the timer to generate the tick interrupts. @@ -124,18 +124,18 @@ static void prvTaskExitError( void ); /* * See header file for description. */ -portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) +StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) { /* Simulate the stack frame as it would be created by a context switch interrupt. */ pxTopOfStack--; /* Offset added to account for the way the MCU uses the stack on entry/exit of interrupts. */ *pxTopOfStack = portINITIAL_XPSR; /* xPSR */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) pxCode; /* PC */ + *pxTopOfStack = ( StackType_t ) pxCode; /* PC */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) prvTaskExitError; /* LR */ + *pxTopOfStack = ( StackType_t ) prvTaskExitError; /* LR */ pxTopOfStack -= 5; /* R12, R3, R2 and R1. */ - *pxTopOfStack = ( portSTACK_TYPE ) pvParameters; /* R0 */ + *pxTopOfStack = ( StackType_t ) pvParameters; /* R0 */ pxTopOfStack -= 8; /* R11..R4. */ return pxTopOfStack; @@ -159,7 +159,7 @@ static void prvTaskExitError( void ) /* * See header file for description. */ -portBASE_TYPE xPortStartScheduler( void ) +BaseType_t xPortStartScheduler( void ) { /* Make PendSV and SysTick the lowest priority interrupts. */ *(portNVIC_SYSPRI2) |= portNVIC_PENDSV_PRI; @@ -222,7 +222,7 @@ void vPortExitCritical( void ) void xPortSysTickHandler( void ) { -unsigned long ulPreviousMask; +uint32_t ulPreviousMask; ulPreviousMask = portSET_INTERRUPT_MASK_FROM_ISR(); { diff --git a/FreeRTOS/Source/portable/IAR/ARM_CM0/portmacro.h b/FreeRTOS/Source/portable/IAR/ARM_CM0/portmacro.h index 67d04cfcb..cdddb802a 100644 --- a/FreeRTOS/Source/portable/IAR/ARM_CM0/portmacro.h +++ b/FreeRTOS/Source/portable/IAR/ARM_CM0/portmacro.h @@ -87,28 +87,33 @@ extern "C" { #define portDOUBLE double #define portLONG long #define portSHORT short -#define portSTACK_TYPE unsigned portLONG +#define portSTACK_TYPE uint32_t #define portBASE_TYPE long +typedef portSTACK_TYPE StackType_t; +typedef long BaseType_t; +typedef unsigned long UBaseType_t; + + #if( configUSE_16_BIT_TICKS == 1 ) - typedef unsigned portSHORT portTickType; - #define portMAX_DELAY ( portTickType ) 0xffff + typedef uint16_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffff #else - typedef unsigned portLONG portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffffUL + typedef uint32_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffffffffUL #endif /*-----------------------------------------------------------*/ /* Architecture specifics. */ #define portSTACK_GROWTH ( -1 ) -#define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ ) +#define portTICK_RATE_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ ) #define portBYTE_ALIGNMENT 8 /*-----------------------------------------------------------*/ /* Scheduler utilities. */ extern void vPortYield( void ); -#define portNVIC_INT_CTRL ( ( volatile unsigned long *) 0xe000ed04 ) +#define portNVIC_INT_CTRL ( ( volatile uint32_t *) 0xe000ed04 ) #define portNVIC_PENDSVSET 0x10000000 #define portYIELD() vPortYield() #define portEND_SWITCHING_ISR( xSwitchRequired ) if( xSwitchRequired ) *(portNVIC_INT_CTRL) = portNVIC_PENDSVSET @@ -120,8 +125,8 @@ extern void vPortYield( void ); extern void vPortEnterCritical( void ); extern void vPortExitCritical( void ); -extern unsigned long ulSetInterruptMaskFromISR( void ); -extern void vClearInterruptMaskFromISR( unsigned long ulMask ); +extern uint32_t ulSetInterruptMaskFromISR( void ); +extern void vClearInterruptMaskFromISR( uint32_t ulMask ); #define portDISABLE_INTERRUPTS() __asm volatile( "cpsid i" ) #define portENABLE_INTERRUPTS() __asm volatile( "cpsie i" ) diff --git a/FreeRTOS/Source/portable/IAR/ARM_CM3/port.c b/FreeRTOS/Source/portable/IAR/ARM_CM3/port.c index 2278e480c..cb5a6e985 100644 --- a/FreeRTOS/Source/portable/IAR/ARM_CM3/port.c +++ b/FreeRTOS/Source/portable/IAR/ARM_CM3/port.c @@ -89,10 +89,10 @@ #endif /* Constants required to manipulate the core. Registers first... */ -#define portNVIC_SYSTICK_CTRL_REG ( * ( ( volatile unsigned long * ) 0xe000e010 ) ) -#define portNVIC_SYSTICK_LOAD_REG ( * ( ( volatile unsigned long * ) 0xe000e014 ) ) -#define portNVIC_SYSTICK_CURRENT_VALUE_REG ( * ( ( volatile unsigned long * ) 0xe000e018 ) ) -#define portNVIC_SYSPRI2_REG ( * ( ( volatile unsigned long * ) 0xe000ed20 ) ) +#define portNVIC_SYSTICK_CTRL_REG ( * ( ( volatile uint32_t * ) 0xe000e010 ) ) +#define portNVIC_SYSTICK_LOAD_REG ( * ( ( volatile uint32_t * ) 0xe000e014 ) ) +#define portNVIC_SYSTICK_CURRENT_VALUE_REG ( * ( ( volatile uint32_t * ) 0xe000e018 ) ) +#define portNVIC_SYSPRI2_REG ( * ( ( volatile uint32_t * ) 0xe000ed20 ) ) /* ...then bits in the registers. */ #define portNVIC_SYSTICK_INT_BIT ( 1UL << 1UL ) #define portNVIC_SYSTICK_ENABLE_BIT ( 1UL << 0UL ) @@ -100,16 +100,16 @@ #define portNVIC_PENDSVCLEAR_BIT ( 1UL << 27UL ) #define portNVIC_PEND_SYSTICK_CLEAR_BIT ( 1UL << 25UL ) -#define portNVIC_PENDSV_PRI ( ( ( unsigned long ) configKERNEL_INTERRUPT_PRIORITY ) << 16UL ) -#define portNVIC_SYSTICK_PRI ( ( ( unsigned long ) configKERNEL_INTERRUPT_PRIORITY ) << 24UL ) +#define portNVIC_PENDSV_PRI ( ( ( uint32_t ) configKERNEL_INTERRUPT_PRIORITY ) << 16UL ) +#define portNVIC_SYSTICK_PRI ( ( ( uint32_t ) configKERNEL_INTERRUPT_PRIORITY ) << 24UL ) /* Constants required to check the validity of an interrupt priority. */ #define portFIRST_USER_INTERRUPT_NUMBER ( 16 ) #define portNVIC_IP_REGISTERS_OFFSET_16 ( 0xE000E3F0 ) -#define portAIRCR_REG ( * ( ( volatile unsigned long * ) 0xE000ED0C ) ) -#define portMAX_8_BIT_VALUE ( ( unsigned char ) 0xff ) -#define portTOP_BIT_OF_BYTE ( ( unsigned char ) 0x80 ) -#define portMAX_PRIGROUP_BITS ( ( unsigned char ) 7 ) +#define portAIRCR_REG ( * ( ( volatile uint32_t * ) 0xE000ED0C ) ) +#define portMAX_8_BIT_VALUE ( ( uint8_t ) 0xff ) +#define portTOP_BIT_OF_BYTE ( ( uint8_t ) 0x80 ) +#define portMAX_PRIGROUP_BITS ( ( uint8_t ) 7 ) #define portPRIORITY_GROUP_MASK ( 0x07UL << 8UL ) #define portPRIGROUP_SHIFT ( 8UL ) @@ -133,7 +133,7 @@ FreeRTOS.org versions prior to V4.3.0 did not include this definition. */ /* Each task maintains its own interrupt status in the critical nesting variable. */ -static unsigned portBASE_TYPE uxCriticalNesting = 0xaaaaaaaa; +static UBaseType_t uxCriticalNesting = 0xaaaaaaaa; /* * Setup the timer to generate the tick interrupts. The implementation in this @@ -163,7 +163,7 @@ static void prvTaskExitError( void ); * The number of SysTick increments that make up one tick period. */ #if configUSE_TICKLESS_IDLE == 1 - static unsigned long ulTimerCountsForOneTick = 0; + static uint32_t ulTimerCountsForOneTick = 0; #endif /* configUSE_TICKLESS_IDLE */ /* @@ -171,7 +171,7 @@ static void prvTaskExitError( void ); * 24 bit resolution of the SysTick timer. */ #if configUSE_TICKLESS_IDLE == 1 - static unsigned long xMaximumPossibleSuppressedTicks = 0; + static uint32_t xMaximumPossibleSuppressedTicks = 0; #endif /* configUSE_TICKLESS_IDLE */ /* @@ -179,7 +179,7 @@ static void prvTaskExitError( void ); * power functionality only. */ #if configUSE_TICKLESS_IDLE == 1 - static unsigned long ulStoppedTimerCompensation = 0; + static uint32_t ulStoppedTimerCompensation = 0; #endif /* configUSE_TICKLESS_IDLE */ /* @@ -188,9 +188,9 @@ static void prvTaskExitError( void ); * a priority above configMAX_SYSCALL_INTERRUPT_PRIORITY. */ #if ( configASSERT_DEFINED == 1 ) - static unsigned char ucMaxSysCallPriority = 0; - static unsigned long ulMaxPRIGROUPValue = 0; - static const volatile unsigned char * const pcInterruptPriorityRegisters = ( const volatile unsigned char * const ) portNVIC_IP_REGISTERS_OFFSET_16; + static uint8_t ucMaxSysCallPriority = 0; + static uint32_t ulMaxPRIGROUPValue = 0; + static const volatile uint8_t * const pcInterruptPriorityRegisters = ( const volatile uint8_t * const ) portNVIC_IP_REGISTERS_OFFSET_16; #endif /* configASSERT_DEFINED */ /*-----------------------------------------------------------*/ @@ -198,18 +198,18 @@ static void prvTaskExitError( void ); /* * See header file for description. */ -portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) +StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) { /* Simulate the stack frame as it would be created by a context switch interrupt. */ pxTopOfStack--; /* Offset added to account for the way the MCU uses the stack on entry/exit of interrupts. */ *pxTopOfStack = portINITIAL_XPSR; /* xPSR */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) pxCode; /* PC */ + *pxTopOfStack = ( StackType_t ) pxCode; /* PC */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) prvTaskExitError; /* LR */ + *pxTopOfStack = ( StackType_t ) prvTaskExitError; /* LR */ pxTopOfStack -= 5; /* R12, R3, R2 and R1. */ - *pxTopOfStack = ( portSTACK_TYPE ) pvParameters; /* R0 */ + *pxTopOfStack = ( StackType_t ) pvParameters; /* R0 */ pxTopOfStack -= 8; /* R11, R10, R9, R8, R7, R6, R5 and R4. */ return pxTopOfStack; @@ -233,13 +233,13 @@ static void prvTaskExitError( void ) /* * See header file for description. */ -portBASE_TYPE xPortStartScheduler( void ) +BaseType_t xPortStartScheduler( void ) { #if( configASSERT_DEFINED == 1 ) { - volatile unsigned long ulOriginalPriority; - volatile char * const pcFirstUserPriorityRegister = ( volatile char * const ) ( portNVIC_IP_REGISTERS_OFFSET_16 + portFIRST_USER_INTERRUPT_NUMBER ); - volatile unsigned char ucMaxPriorityValue; + volatile uint32_t ulOriginalPriority; + volatile int8_t * const pcFirstUserPriorityRegister = ( volatile int8_t * const ) ( portNVIC_IP_REGISTERS_OFFSET_16 + portFIRST_USER_INTERRUPT_NUMBER ); + volatile uint8_t ucMaxPriorityValue; /* Determine the maximum priority from which ISR safe FreeRTOS API functions can be called. ISR safe functions are those that end in @@ -265,7 +265,7 @@ portBASE_TYPE xPortStartScheduler( void ) while( ( ucMaxPriorityValue & portTOP_BIT_OF_BYTE ) == portTOP_BIT_OF_BYTE ) { ulMaxPRIGROUPValue--; - ucMaxPriorityValue <<= ( unsigned char ) 0x01; + ucMaxPriorityValue <<= ( uint8_t ) 0x01; } /* Shift the priority group value back to its position within the AIRCR @@ -360,10 +360,10 @@ void xPortSysTickHandler( void ) #if configUSE_TICKLESS_IDLE == 1 - __weak void vPortSuppressTicksAndSleep( portTickType xExpectedIdleTime ) + __weak void vPortSuppressTicksAndSleep( TickType_t xExpectedIdleTime ) { - unsigned long ulReloadValue, ulCompleteTickPeriods, ulCompletedSysTickDecrements, ulSysTickCTRL; - portTickType xModifiableIdleTime; + uint32_t ulReloadValue, ulCompleteTickPeriods, ulCompletedSysTickDecrements, ulSysTickCTRL; + TickType_t xModifiableIdleTime; /* Make sure the SysTick reload value does not overflow the counter. */ if( xExpectedIdleTime > xMaximumPossibleSuppressedTicks ) @@ -449,7 +449,7 @@ void xPortSysTickHandler( void ) if( ( ulSysTickCTRL & portNVIC_SYSTICK_COUNT_FLAG_BIT ) != 0 ) { - unsigned long ulCalculatedLoadValue; + uint32_t ulCalculatedLoadValue; /* The tick interrupt has already executed, and the SysTick count reloaded with ulReloadValue. Reset the @@ -535,8 +535,8 @@ __weak void vPortSetupTimerInterrupt( void ) void vPortValidateInterruptPriority( void ) { - unsigned long ulCurrentInterrupt; - unsigned char ucCurrentPriority; + uint32_t ulCurrentInterrupt; + uint8_t ucCurrentPriority; /* Obtain the number of the currently executing interrupt. */ __asm volatile( "mrs %0, ipsr" : "=r"( ulCurrentInterrupt ) ); diff --git a/FreeRTOS/Source/portable/IAR/ARM_CM3/portmacro.h b/FreeRTOS/Source/portable/IAR/ARM_CM3/portmacro.h index c3a31158c..7ab063931 100644 --- a/FreeRTOS/Source/portable/IAR/ARM_CM3/portmacro.h +++ b/FreeRTOS/Source/portable/IAR/ARM_CM3/portmacro.h @@ -1,5 +1,5 @@ /* - FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. + FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. All rights reserved VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. @@ -87,27 +87,31 @@ extern "C" { #define portDOUBLE double #define portLONG long #define portSHORT short -#define portSTACK_TYPE unsigned portLONG +#define portSTACK_TYPE uint32_t #define portBASE_TYPE long +typedef portSTACK_TYPE StackType_t; +typedef long BaseType_t; +typedef unsigned long UBaseType_t; + #if( configUSE_16_BIT_TICKS == 1 ) - typedef unsigned portSHORT portTickType; + typedef uint16_t TickType_t; #define portMAX_DELAY 0xffff #else - typedef unsigned portLONG portTickType; + typedef uint32_t TickType_t; #define portMAX_DELAY 0xffffffffUL #endif /*-----------------------------------------------------------*/ /* Architecture specifics. */ #define portSTACK_GROWTH ( -1 ) -#define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ ) +#define portTICK_RATE_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ ) #define portBYTE_ALIGNMENT 8 /*-----------------------------------------------------------*/ /* Scheduler utilities. */ extern void vPortYield( void ); -#define portNVIC_INT_CTRL_REG ( * ( ( volatile unsigned long * ) 0xe000ed04UL ) ) +#define portNVIC_INT_CTRL_REG ( * ( ( volatile uint32_t * ) 0xe000ed04UL ) ) #define portNVIC_PENDSVSET_BIT ( 1UL << 28UL ) #define portYIELD() vPortYield() #define portEND_SWITCHING_ISR( xSwitchRequired ) if( xSwitchRequired ) portNVIC_INT_CTRL_REG = portNVIC_PENDSVSET_BIT @@ -137,8 +141,8 @@ extern void vPortYield( void ); /* Critical section management. */ extern void vPortEnterCritical( void ); extern void vPortExitCritical( void ); -extern unsigned long ulPortSetInterruptMask( void ); -extern void vPortClearInterruptMask( unsigned long ulNewMask ); +extern uint32_t ulPortSetInterruptMask( void ); +extern void vPortClearInterruptMask( uint32_t ulNewMask ); #define portDISABLE_INTERRUPTS() ulPortSetInterruptMask() #define portENABLE_INTERRUPTS() vPortClearInterruptMask( 0 ) @@ -150,7 +154,7 @@ extern void vPortClearInterruptMask( unsigned long ulNewMask ); /* Tickless idle/low power functionality. */ #ifndef portSUPPRESS_TICKS_AND_SLEEP - extern void vPortSuppressTicksAndSleep( portTickType xExpectedIdleTime ); + extern void vPortSuppressTicksAndSleep( TickType_t xExpectedIdleTime ); #define portSUPPRESS_TICKS_AND_SLEEP( xExpectedIdleTime ) vPortSuppressTicksAndSleep( xExpectedIdleTime ) #endif /*-----------------------------------------------------------*/ diff --git a/FreeRTOS/Source/portable/IAR/ARM_CM4F/port.c b/FreeRTOS/Source/portable/IAR/ARM_CM4F/port.c index ea0373fd7..258d76173 100644 --- a/FreeRTOS/Source/portable/IAR/ARM_CM4F/port.c +++ b/FreeRTOS/Source/portable/IAR/ARM_CM4F/port.c @@ -93,10 +93,10 @@ #endif /* Constants required to manipulate the core. Registers first... */ -#define portNVIC_SYSTICK_CTRL_REG ( * ( ( volatile unsigned long * ) 0xe000e010 ) ) -#define portNVIC_SYSTICK_LOAD_REG ( * ( ( volatile unsigned long * ) 0xe000e014 ) ) -#define portNVIC_SYSTICK_CURRENT_VALUE_REG ( * ( ( volatile unsigned long * ) 0xe000e018 ) ) -#define portNVIC_SYSPRI2_REG ( * ( ( volatile unsigned long * ) 0xe000ed20 ) ) +#define portNVIC_SYSTICK_CTRL_REG ( * ( ( volatile uint32_t * ) 0xe000e010 ) ) +#define portNVIC_SYSTICK_LOAD_REG ( * ( ( volatile uint32_t * ) 0xe000e014 ) ) +#define portNVIC_SYSTICK_CURRENT_VALUE_REG ( * ( ( volatile uint32_t * ) 0xe000e018 ) ) +#define portNVIC_SYSPRI2_REG ( * ( ( volatile uint32_t * ) 0xe000ed20 ) ) /* ...then bits in the registers. */ #define portNVIC_SYSTICK_INT_BIT ( 1UL << 1UL ) #define portNVIC_SYSTICK_ENABLE_BIT ( 1UL << 0UL ) @@ -104,21 +104,21 @@ #define portNVIC_PENDSVCLEAR_BIT ( 1UL << 27UL ) #define portNVIC_PEND_SYSTICK_CLEAR_BIT ( 1UL << 25UL ) -#define portNVIC_PENDSV_PRI ( ( ( unsigned long ) configKERNEL_INTERRUPT_PRIORITY ) << 16UL ) -#define portNVIC_SYSTICK_PRI ( ( ( unsigned long ) configKERNEL_INTERRUPT_PRIORITY ) << 24UL ) +#define portNVIC_PENDSV_PRI ( ( ( uint32_t ) configKERNEL_INTERRUPT_PRIORITY ) << 16UL ) +#define portNVIC_SYSTICK_PRI ( ( ( uint32_t ) configKERNEL_INTERRUPT_PRIORITY ) << 24UL ) /* Constants required to check the validity of an interrupt priority. */ #define portFIRST_USER_INTERRUPT_NUMBER ( 16 ) #define portNVIC_IP_REGISTERS_OFFSET_16 ( 0xE000E3F0 ) -#define portAIRCR_REG ( * ( ( volatile unsigned long * ) 0xE000ED0C ) ) -#define portMAX_8_BIT_VALUE ( ( unsigned char ) 0xff ) -#define portTOP_BIT_OF_BYTE ( ( unsigned char ) 0x80 ) -#define portMAX_PRIGROUP_BITS ( ( unsigned char ) 7 ) +#define portAIRCR_REG ( * ( ( volatile uint32_t * ) 0xE000ED0C ) ) +#define portMAX_8_BIT_VALUE ( ( int8_t ) 0xff ) +#define portTOP_BIT_OF_BYTE ( ( uint8_t ) 0x80 ) +#define portMAX_PRIGROUP_BITS ( ( uint8_t ) 7 ) #define portPRIORITY_GROUP_MASK ( 0x07UL << 8UL ) #define portPRIGROUP_SHIFT ( 8UL ) /* Constants required to manipulate the VFP. */ -#define portFPCCR ( ( volatile unsigned long * ) 0xe000ef34 ) /* Floating point context control register. */ +#define portFPCCR ( ( volatile uint32_t * ) 0xe000ef34 ) /* Floating point context control register. */ #define portASPEN_AND_LSPEN_BITS ( 0x3UL << 30UL ) /* Constants required to set up the initial stack. */ @@ -136,7 +136,7 @@ calculations. */ /* Each task maintains its own interrupt status in the critical nesting variable. */ -static unsigned portBASE_TYPE uxCriticalNesting = 0xaaaaaaaa; +static UBaseType_t uxCriticalNesting = 0xaaaaaaaa; /* * Setup the timer to generate the tick interrupts. The implementation in this @@ -171,7 +171,7 @@ static void prvTaskExitError( void ); * The number of SysTick increments that make up one tick period. */ #if configUSE_TICKLESS_IDLE == 1 - static unsigned long ulTimerCountsForOneTick = 0; + static uint32_t ulTimerCountsForOneTick = 0; #endif /* configUSE_TICKLESS_IDLE */ /* @@ -179,7 +179,7 @@ static void prvTaskExitError( void ); * 24 bit resolution of the SysTick timer. */ #if configUSE_TICKLESS_IDLE == 1 - static unsigned long xMaximumPossibleSuppressedTicks = 0; + static uint32_t xMaximumPossibleSuppressedTicks = 0; #endif /* configUSE_TICKLESS_IDLE */ /* @@ -187,7 +187,7 @@ static void prvTaskExitError( void ); * power functionality only. */ #if configUSE_TICKLESS_IDLE == 1 - static unsigned long ulStoppedTimerCompensation = 0; + static uint32_t ulStoppedTimerCompensation = 0; #endif /* configUSE_TICKLESS_IDLE */ /* @@ -196,9 +196,9 @@ static void prvTaskExitError( void ); * a priority above configMAX_SYSCALL_INTERRUPT_PRIORITY. */ #if ( configASSERT_DEFINED == 1 ) - static unsigned char ucMaxSysCallPriority = 0; - static unsigned long ulMaxPRIGROUPValue = 0; - static const volatile unsigned char * const pcInterruptPriorityRegisters = ( const volatile unsigned char * const ) portNVIC_IP_REGISTERS_OFFSET_16; + static uint8_t ucMaxSysCallPriority = 0; + static uint32_t ulMaxPRIGROUPValue = 0; + static const volatile uint8_t * const pcInterruptPriorityRegisters = ( const volatile uint8_t * const ) portNVIC_IP_REGISTERS_OFFSET_16; #endif /* configASSERT_DEFINED */ /*-----------------------------------------------------------*/ @@ -206,7 +206,7 @@ static void prvTaskExitError( void ); /* * See header file for description. */ -portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) +StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) { /* Simulate the stack frame as it would be created by a context switch interrupt. */ @@ -217,13 +217,13 @@ portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE *pxTopOfStack = portINITIAL_XPSR; /* xPSR */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) pxCode; /* PC */ + *pxTopOfStack = ( StackType_t ) pxCode; /* PC */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) prvTaskExitError; /* LR */ + *pxTopOfStack = ( StackType_t ) prvTaskExitError; /* LR */ /* Save code space by skipping register initialisation. */ pxTopOfStack -= 5; /* R12, R3, R2 and R1. */ - *pxTopOfStack = ( portSTACK_TYPE ) pvParameters; /* R0 */ + *pxTopOfStack = ( StackType_t ) pvParameters; /* R0 */ /* A save method is being used that requires each task to maintain its own exec return value. */ @@ -253,13 +253,13 @@ static void prvTaskExitError( void ) /* * See header file for description. */ -portBASE_TYPE xPortStartScheduler( void ) +BaseType_t xPortStartScheduler( void ) { #if( configASSERT_DEFINED == 1 ) { - volatile unsigned long ulOriginalPriority; - volatile char * const pcFirstUserPriorityRegister = ( volatile char * const ) ( portNVIC_IP_REGISTERS_OFFSET_16 + portFIRST_USER_INTERRUPT_NUMBER ); - volatile unsigned char ucMaxPriorityValue; + volatile uint32_t ulOriginalPriority; + volatile int8_t * const pcFirstUserPriorityRegister = ( volatile int8_t * const ) ( portNVIC_IP_REGISTERS_OFFSET_16 + portFIRST_USER_INTERRUPT_NUMBER ); + volatile uint8_t ucMaxPriorityValue; /* Determine the maximum priority from which ISR safe FreeRTOS API functions can be called. ISR safe functions are those that end in @@ -285,7 +285,7 @@ portBASE_TYPE xPortStartScheduler( void ) while( ( ucMaxPriorityValue & portTOP_BIT_OF_BYTE ) == portTOP_BIT_OF_BYTE ) { ulMaxPRIGROUPValue--; - ucMaxPriorityValue <<= ( unsigned char ) 0x01; + ucMaxPriorityValue <<= ( uint8_t ) 0x01; } /* Shift the priority group value back to its position within the AIRCR @@ -386,10 +386,10 @@ void xPortSysTickHandler( void ) #if configUSE_TICKLESS_IDLE == 1 - __weak void vPortSuppressTicksAndSleep( portTickType xExpectedIdleTime ) + __weak void vPortSuppressTicksAndSleep( TickType_t xExpectedIdleTime ) { - unsigned long ulReloadValue, ulCompleteTickPeriods, ulCompletedSysTickDecrements, ulSysTickCTRL; - portTickType xModifiableIdleTime; + uint32_t ulReloadValue, ulCompleteTickPeriods, ulCompletedSysTickDecrements, ulSysTickCTRL; + TickType_t xModifiableIdleTime; /* Make sure the SysTick reload value does not overflow the counter. */ if( xExpectedIdleTime > xMaximumPossibleSuppressedTicks ) @@ -475,7 +475,7 @@ void xPortSysTickHandler( void ) if( ( ulSysTickCTRL & portNVIC_SYSTICK_COUNT_FLAG_BIT ) != 0 ) { - unsigned long ulCalculatedLoadValue; + uint32_t ulCalculatedLoadValue; /* The tick interrupt has already executed, and the SysTick count reloaded with ulReloadValue. Reset the @@ -561,8 +561,8 @@ __weak void vPortSetupTimerInterrupt( void ) void vPortValidateInterruptPriority( void ) { - unsigned long ulCurrentInterrupt; - unsigned char ucCurrentPriority; + uint32_t ulCurrentInterrupt; + uint8_t ucCurrentPriority; /* Obtain the number of the currently executing interrupt. */ __asm volatile( "mrs %0, ipsr" : "=r"( ulCurrentInterrupt ) ); diff --git a/FreeRTOS/Source/portable/IAR/ARM_CM4F/portmacro.h b/FreeRTOS/Source/portable/IAR/ARM_CM4F/portmacro.h index dfe6acfb6..05d89ecfc 100644 --- a/FreeRTOS/Source/portable/IAR/ARM_CM4F/portmacro.h +++ b/FreeRTOS/Source/portable/IAR/ARM_CM4F/portmacro.h @@ -1,5 +1,5 @@ /* - FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. + FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. All rights reserved VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. @@ -87,27 +87,31 @@ extern "C" { #define portDOUBLE double #define portLONG long #define portSHORT short -#define portSTACK_TYPE unsigned portLONG +#define portSTACK_TYPE uint32_t #define portBASE_TYPE long +typedef portSTACK_TYPE StackType_t; +typedef long BaseType_t; +typedef unsigned long UBaseType_t; + #if( configUSE_16_BIT_TICKS == 1 ) - typedef unsigned portSHORT portTickType; - #define portMAX_DELAY ( portTickType ) 0xffff + typedef uint16_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffff #else - typedef unsigned portLONG portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffffUL + typedef uint32_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffffffffUL #endif /*-----------------------------------------------------------*/ /* Architecture specifics. */ #define portSTACK_GROWTH ( -1 ) -#define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ ) +#define portTICK_RATE_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ ) #define portBYTE_ALIGNMENT 8 /*-----------------------------------------------------------*/ /* Scheduler utilities. */ extern void vPortYield( void ); -#define portNVIC_INT_CTRL_REG ( * ( ( volatile unsigned long * ) 0xe000ed04 ) ) +#define portNVIC_INT_CTRL_REG ( * ( ( volatile uint32_t * ) 0xe000ed04 ) ) #define portNVIC_PENDSVSET_BIT ( 1UL << 28UL ) #define portYIELD() vPortYield() #define portEND_SWITCHING_ISR( xSwitchRequired ) if( xSwitchRequired ) portNVIC_INT_CTRL_REG = portNVIC_PENDSVSET_BIT @@ -137,8 +141,8 @@ extern void vPortYield( void ); /* Critical section management. */ extern void vPortEnterCritical( void ); extern void vPortExitCritical( void ); -extern unsigned long ulPortSetInterruptMask( void ); -extern void vPortClearInterruptMask( unsigned long ulNewMask ); +extern uint32_t ulPortSetInterruptMask( void ); +extern void vPortClearInterruptMask( uint32_t ulNewMask ); #define portDISABLE_INTERRUPTS() ulPortSetInterruptMask() #define portENABLE_INTERRUPTS() vPortClearInterruptMask( 0 ) @@ -150,7 +154,7 @@ extern void vPortClearInterruptMask( unsigned long ulNewMask ); /* Tickless idle/low power functionality. */ #ifndef portSUPPRESS_TICKS_AND_SLEEP - extern void vPortSuppressTicksAndSleep( portTickType xExpectedIdleTime ); + extern void vPortSuppressTicksAndSleep( TickType_t xExpectedIdleTime ); #define portSUPPRESS_TICKS_AND_SLEEP( xExpectedIdleTime ) vPortSuppressTicksAndSleep( xExpectedIdleTime ) #endif diff --git a/FreeRTOS/Source/portable/IAR/ATMega323/port.c b/FreeRTOS/Source/portable/IAR/ATMega323/port.c index bf28ba8aa..920caa27f 100644 --- a/FreeRTOS/Source/portable/IAR/ATMega323/port.c +++ b/FreeRTOS/Source/portable/IAR/ATMega323/port.c @@ -73,13 +73,13 @@ *----------------------------------------------------------*/ /* Start tasks with interrupts enables. */ -#define portFLAGS_INT_ENABLED ( ( portSTACK_TYPE ) 0x80 ) +#define portFLAGS_INT_ENABLED ( ( StackType_t ) 0x80 ) /* Hardware constants for timer 1. */ -#define portCLEAR_COUNTER_ON_MATCH ( ( unsigned char ) 0x08 ) -#define portPRESCALE_64 ( ( unsigned char ) 0x03 ) -#define portCLOCK_PRESCALER ( ( unsigned long ) 64 ) -#define portCOMPARE_MATCH_A_INTERRUPT_ENABLE ( ( unsigned char ) 0x10 ) +#define portCLEAR_COUNTER_ON_MATCH ( ( uint8_t ) 0x08 ) +#define portPRESCALE_64 ( ( uint8_t ) 0x03 ) +#define portCLOCK_PRESCALER ( ( uint32_t ) 64 ) +#define portCOMPARE_MATCH_A_INTERRUPT_ENABLE ( ( uint8_t ) 0x10 ) /* The number of bytes used on the hardware stack by the task start address. */ #define portBYTES_USED_BY_RETURN_ADDRESS ( 2 ) @@ -87,8 +87,8 @@ /* Stores the critical section nesting. This must not be initialised to 0. It will be initialised when a task starts. */ -#define portNO_CRITICAL_NESTING ( ( unsigned portBASE_TYPE ) 0 ) -unsigned portBASE_TYPE uxCriticalNesting = 0x50; +#define portNO_CRITICAL_NESTING ( ( UBaseType_t ) 0 ) +UBaseType_t uxCriticalNesting = 0x50; /* @@ -108,10 +108,10 @@ extern void vPortStart( void ); /* * See header file for description. */ -portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) +StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) { -unsigned short usAddress; -portSTACK_TYPE *pxTopOfHardwareStack; +uint16_t usAddress; +StackType_t *pxTopOfHardwareStack; /* Place a few bytes of known values on the bottom of the stack. This is just useful for debugging. */ @@ -149,12 +149,12 @@ portSTACK_TYPE *pxTopOfHardwareStack; The first part of the stack is the hardware stack. Place the start address of the task on the hardware stack. */ - usAddress = ( unsigned short ) pxCode; - *pxTopOfStack = ( portSTACK_TYPE ) ( usAddress & ( unsigned short ) 0x00ff ); + usAddress = ( uint16_t ) pxCode; + *pxTopOfStack = ( StackType_t ) ( usAddress & ( uint16_t ) 0x00ff ); pxTopOfStack--; usAddress >>= 8; - *pxTopOfStack = ( portSTACK_TYPE ) ( usAddress & ( unsigned short ) 0x00ff ); + *pxTopOfStack = ( StackType_t ) ( usAddress & ( uint16_t ) 0x00ff ); pxTopOfStack--; @@ -169,7 +169,7 @@ portSTACK_TYPE *pxTopOfHardwareStack; portSAVE_CONTEXT places the flags on the stack immediately after r0 to ensure the interrupts get disabled as soon as possible, and so ensuring the stack use is minimal should a context switch interrupt occur. */ - *pxTopOfStack = ( portSTACK_TYPE ) 0x00; /* R0 */ + *pxTopOfStack = ( StackType_t ) 0x00; /* R0 */ pxTopOfStack--; *pxTopOfStack = portFLAGS_INT_ENABLED; pxTopOfStack--; @@ -177,88 +177,88 @@ portSTACK_TYPE *pxTopOfHardwareStack; /* Next place the address of the hardware stack. This is required so the AVR stack pointer can be restored to point to the hardware stack. */ pxTopOfHardwareStack -= portBYTES_USED_BY_RETURN_ADDRESS; - usAddress = ( unsigned short ) pxTopOfHardwareStack; + usAddress = ( uint16_t ) pxTopOfHardwareStack; /* SPL */ - *pxTopOfStack = ( portSTACK_TYPE ) ( usAddress & ( unsigned short ) 0x00ff ); + *pxTopOfStack = ( StackType_t ) ( usAddress & ( uint16_t ) 0x00ff ); pxTopOfStack--; /* SPH */ usAddress >>= 8; - *pxTopOfStack = ( portSTACK_TYPE ) ( usAddress & ( unsigned short ) 0x00ff ); + *pxTopOfStack = ( StackType_t ) ( usAddress & ( uint16_t ) 0x00ff ); pxTopOfStack--; /* Now the remaining registers. */ - *pxTopOfStack = ( portSTACK_TYPE ) 0x01; /* R1 */ + *pxTopOfStack = ( StackType_t ) 0x01; /* R1 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x02; /* R2 */ + *pxTopOfStack = ( StackType_t ) 0x02; /* R2 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x03; /* R3 */ + *pxTopOfStack = ( StackType_t ) 0x03; /* R3 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x04; /* R4 */ + *pxTopOfStack = ( StackType_t ) 0x04; /* R4 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x05; /* R5 */ + *pxTopOfStack = ( StackType_t ) 0x05; /* R5 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x06; /* R6 */ + *pxTopOfStack = ( StackType_t ) 0x06; /* R6 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x07; /* R7 */ + *pxTopOfStack = ( StackType_t ) 0x07; /* R7 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x08; /* R8 */ + *pxTopOfStack = ( StackType_t ) 0x08; /* R8 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x09; /* R9 */ + *pxTopOfStack = ( StackType_t ) 0x09; /* R9 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x10; /* R10 */ + *pxTopOfStack = ( StackType_t ) 0x10; /* R10 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x11; /* R11 */ + *pxTopOfStack = ( StackType_t ) 0x11; /* R11 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x12; /* R12 */ + *pxTopOfStack = ( StackType_t ) 0x12; /* R12 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x13; /* R13 */ + *pxTopOfStack = ( StackType_t ) 0x13; /* R13 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x14; /* R14 */ + *pxTopOfStack = ( StackType_t ) 0x14; /* R14 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x15; /* R15 */ + *pxTopOfStack = ( StackType_t ) 0x15; /* R15 */ pxTopOfStack--; /* Place the parameter on the stack in the expected location. */ - usAddress = ( unsigned short ) pvParameters; - *pxTopOfStack = ( portSTACK_TYPE ) ( usAddress & ( unsigned short ) 0x00ff ); + usAddress = ( uint16_t ) pvParameters; + *pxTopOfStack = ( StackType_t ) ( usAddress & ( uint16_t ) 0x00ff ); pxTopOfStack--; usAddress >>= 8; - *pxTopOfStack = ( portSTACK_TYPE ) ( usAddress & ( unsigned short ) 0x00ff ); + *pxTopOfStack = ( StackType_t ) ( usAddress & ( uint16_t ) 0x00ff ); pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x18; /* R18 */ + *pxTopOfStack = ( StackType_t ) 0x18; /* R18 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x19; /* R19 */ + *pxTopOfStack = ( StackType_t ) 0x19; /* R19 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x20; /* R20 */ + *pxTopOfStack = ( StackType_t ) 0x20; /* R20 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x21; /* R21 */ + *pxTopOfStack = ( StackType_t ) 0x21; /* R21 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x22; /* R22 */ + *pxTopOfStack = ( StackType_t ) 0x22; /* R22 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x23; /* R23 */ + *pxTopOfStack = ( StackType_t ) 0x23; /* R23 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x24; /* R24 */ + *pxTopOfStack = ( StackType_t ) 0x24; /* R24 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x25; /* R25 */ + *pxTopOfStack = ( StackType_t ) 0x25; /* R25 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x26; /* R26 X */ + *pxTopOfStack = ( StackType_t ) 0x26; /* R26 X */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x27; /* R27 */ + *pxTopOfStack = ( StackType_t ) 0x27; /* R27 */ pxTopOfStack--; /* The Y register is not stored as it is used as the software stack and gets saved into the task control block. */ - *pxTopOfStack = ( portSTACK_TYPE ) 0x30; /* R30 Z */ + *pxTopOfStack = ( StackType_t ) 0x30; /* R30 Z */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x031; /* R31 */ + *pxTopOfStack = ( StackType_t ) 0x031; /* R31 */ pxTopOfStack--; *pxTopOfStack = portNO_CRITICAL_NESTING; /* Critical nesting is zero when the task starts. */ @@ -269,7 +269,7 @@ portSTACK_TYPE *pxTopOfHardwareStack; } /*-----------------------------------------------------------*/ -portBASE_TYPE xPortStartScheduler( void ) +BaseType_t xPortStartScheduler( void ) { /* Setup the hardware to generate the tick. */ prvSetupTimerInterrupt(); @@ -296,8 +296,8 @@ void vPortEndScheduler( void ) */ static void prvSetupTimerInterrupt( void ) { -unsigned long ulCompareMatch; -unsigned char ucHighByte, ucLowByte; +uint32_t ulCompareMatch; +uint8_t ucHighByte, ucLowByte; /* Using 16bit timer 1 to generate the tick. Correct fuses must be selected for the configCPU_CLOCK_HZ clock. */ @@ -308,13 +308,13 @@ unsigned char ucHighByte, ucLowByte; ulCompareMatch /= portCLOCK_PRESCALER; /* Adjust for correct value. */ - ulCompareMatch -= ( unsigned long ) 1; + ulCompareMatch -= ( uint32_t ) 1; /* Setup compare match value for compare match A. Interrupts are disabled before this is called so we need not worry here. */ - ucLowByte = ( unsigned char ) ( ulCompareMatch & ( unsigned long ) 0xff ); + ucLowByte = ( uint8_t ) ( ulCompareMatch & ( uint32_t ) 0xff ); ulCompareMatch >>= 8; - ucHighByte = ( unsigned char ) ( ulCompareMatch & ( unsigned long ) 0xff ); + ucHighByte = ( uint8_t ) ( ulCompareMatch & ( uint32_t ) 0xff ); OCR1AH = ucHighByte; OCR1AL = ucLowByte; diff --git a/FreeRTOS/Source/portable/IAR/ATMega323/portmacro.h b/FreeRTOS/Source/portable/IAR/ATMega323/portmacro.h index 1f6614477..06f163e03 100644 --- a/FreeRTOS/Source/portable/IAR/ATMega323/portmacro.h +++ b/FreeRTOS/Source/portable/IAR/ATMega323/portmacro.h @@ -1,5 +1,5 @@ /* - FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. + FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. All rights reserved VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. @@ -93,16 +93,20 @@ extern "C" { #define portDOUBLE double #define portLONG long #define portSHORT int -#define portSTACK_TYPE unsigned portCHAR -#define portBASE_TYPE portCHAR -#define portPOINTER_SIZE_TYPE unsigned short +#define portSTACK_TYPE uint8_t +#define portBASE_TYPE char +#define portPOINTER_SIZE_TYPE uint16_t + +typedef portSTACK_TYPE StackType_t; +typedef signed char BaseType_t; +typedef unsigned char UBaseType_t; #if( configUSE_16_BIT_TICKS == 1 ) - typedef unsigned portSHORT portTickType; - #define portMAX_DELAY ( portTickType ) 0xffff + typedef uint16_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffff #else - typedef unsigned portLONG portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffffUL + typedef uint32_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffffffffUL #endif /*-----------------------------------------------------------*/ @@ -119,7 +123,7 @@ extern void vPortExitCritical( void ); /* Architecture specifics. */ #define portSTACK_GROWTH ( -1 ) -#define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ ) +#define portTICK_RATE_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ ) #define portBYTE_ALIGNMENT 1 #define portNOP() asm( "nop" ) /*-----------------------------------------------------------*/ diff --git a/FreeRTOS/Source/portable/IAR/AVR32_UC3/port.c b/FreeRTOS/Source/portable/IAR/AVR32_UC3/port.c index ad36659c3..94fdaa0d7 100644 --- a/FreeRTOS/Source/portable/IAR/AVR32_UC3/port.c +++ b/FreeRTOS/Source/portable/IAR/AVR32_UC3/port.c @@ -97,12 +97,12 @@ /* Constants required to setup the task context. */ -#define portINITIAL_SR ( ( portSTACK_TYPE ) 0x00400000 ) /* AVR32 : [M2:M0]=001 I1M=0 I0M=0, GM=0 */ -#define portINSTRUCTION_SIZE ( ( portSTACK_TYPE ) 0 ) +#define portINITIAL_SR ( ( StackType_t ) 0x00400000 ) /* AVR32 : [M2:M0]=001 I1M=0 I0M=0, GM=0 */ +#define portINSTRUCTION_SIZE ( ( StackType_t ) 0 ) /* Each task maintains its own critical nesting variable. */ -#define portNO_CRITICAL_NESTING ( ( unsigned long ) 0 ) -volatile unsigned long ulCriticalNesting = 9999UL; +#define portNO_CRITICAL_NESTING ( ( uint32_t ) 0 ) +volatile uint32_t ulCriticalNesting = 9999UL; #if( configTICK_USE_TC==0 ) static void prvScheduleNextTick( void ); @@ -123,7 +123,7 @@ int __low_level_init(void) { #if configHEAP_INIT #pragma segment = "HEAP" - portBASE_TYPE *pxMem; + BaseType_t *pxMem; #endif /* Enable exceptions. */ @@ -135,7 +135,7 @@ int __low_level_init(void) #if configHEAP_INIT { /* Initialize the heap used by malloc. */ - for( pxMem = __segment_begin( "HEAP" ); pxMem < ( portBASE_TYPE * ) __segment_end( "HEAP" ); ) + for( pxMem = __segment_begin( "HEAP" ); pxMem < ( BaseType_t * ) __segment_end( "HEAP" ); ) { *pxMem++ = 0xA5A5A5A5; } @@ -267,36 +267,36 @@ void vPortExitCritical( void ) * * See header file for description. */ -portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) +StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) { /* Setup the initial stack of the task. The stack is set exactly as expected by the portRESTORE_CONTEXT() macro. */ /* When the task starts, it will expect to find the function parameter in R12. */ pxTopOfStack--; - *pxTopOfStack-- = ( portSTACK_TYPE ) 0x08080808; /* R8 */ - *pxTopOfStack-- = ( portSTACK_TYPE ) 0x09090909; /* R9 */ - *pxTopOfStack-- = ( portSTACK_TYPE ) 0x0A0A0A0A; /* R10 */ - *pxTopOfStack-- = ( portSTACK_TYPE ) 0x0B0B0B0B; /* R11 */ - *pxTopOfStack-- = ( portSTACK_TYPE ) pvParameters; /* R12 */ - *pxTopOfStack-- = ( portSTACK_TYPE ) 0xDEADBEEF; /* R14/LR */ - *pxTopOfStack-- = ( portSTACK_TYPE ) pxCode + portINSTRUCTION_SIZE; /* R15/PC */ - *pxTopOfStack-- = ( portSTACK_TYPE ) portINITIAL_SR; /* SR */ - *pxTopOfStack-- = ( portSTACK_TYPE ) 0xFF0000FF; /* R0 */ - *pxTopOfStack-- = ( portSTACK_TYPE ) 0x01010101; /* R1 */ - *pxTopOfStack-- = ( portSTACK_TYPE ) 0x02020202; /* R2 */ - *pxTopOfStack-- = ( portSTACK_TYPE ) 0x03030303; /* R3 */ - *pxTopOfStack-- = ( portSTACK_TYPE ) 0x04040404; /* R4 */ - *pxTopOfStack-- = ( portSTACK_TYPE ) 0x05050505; /* R5 */ - *pxTopOfStack-- = ( portSTACK_TYPE ) 0x06060606; /* R6 */ - *pxTopOfStack-- = ( portSTACK_TYPE ) 0x07070707; /* R7 */ - *pxTopOfStack = ( portSTACK_TYPE ) portNO_CRITICAL_NESTING; /* ulCriticalNesting */ + *pxTopOfStack-- = ( StackType_t ) 0x08080808; /* R8 */ + *pxTopOfStack-- = ( StackType_t ) 0x09090909; /* R9 */ + *pxTopOfStack-- = ( StackType_t ) 0x0A0A0A0A; /* R10 */ + *pxTopOfStack-- = ( StackType_t ) 0x0B0B0B0B; /* R11 */ + *pxTopOfStack-- = ( StackType_t ) pvParameters; /* R12 */ + *pxTopOfStack-- = ( StackType_t ) 0xDEADBEEF; /* R14/LR */ + *pxTopOfStack-- = ( StackType_t ) pxCode + portINSTRUCTION_SIZE; /* R15/PC */ + *pxTopOfStack-- = ( StackType_t ) portINITIAL_SR; /* SR */ + *pxTopOfStack-- = ( StackType_t ) 0xFF0000FF; /* R0 */ + *pxTopOfStack-- = ( StackType_t ) 0x01010101; /* R1 */ + *pxTopOfStack-- = ( StackType_t ) 0x02020202; /* R2 */ + *pxTopOfStack-- = ( StackType_t ) 0x03030303; /* R3 */ + *pxTopOfStack-- = ( StackType_t ) 0x04040404; /* R4 */ + *pxTopOfStack-- = ( StackType_t ) 0x05050505; /* R5 */ + *pxTopOfStack-- = ( StackType_t ) 0x06060606; /* R6 */ + *pxTopOfStack-- = ( StackType_t ) 0x07070707; /* R7 */ + *pxTopOfStack = ( StackType_t ) portNO_CRITICAL_NESTING; /* ulCriticalNesting */ return pxTopOfStack; } /*-----------------------------------------------------------*/ -portBASE_TYPE xPortStartScheduler( void ) +BaseType_t xPortStartScheduler( void ) { /* Start the timer that generates the tick ISR. Interrupts are disabled here already. */ @@ -322,7 +322,7 @@ clock cycles from now. */ #if( configTICK_USE_TC==0 ) static void prvScheduleFirstTick(void) { - unsigned long lCycles; + uint32_t lCycles; lCycles = Get_system_register(AVR32_COUNT); lCycles += (configCPU_CLOCK_HZ/configTICK_RATE_HZ); @@ -338,7 +338,7 @@ clock cycles from now. */ #pragma optimize = no_inline static void prvScheduleNextTick(void) { - unsigned long lCycles, lCount; + uint32_t lCycles, lCount; lCycles = Get_system_register(AVR32_COMPARE); lCycles += (configCPU_CLOCK_HZ/configTICK_RATE_HZ); diff --git a/FreeRTOS/Source/portable/IAR/AVR32_UC3/portmacro.h b/FreeRTOS/Source/portable/IAR/AVR32_UC3/portmacro.h index fb781c224..eb6b03f08 100644 --- a/FreeRTOS/Source/portable/IAR/AVR32_UC3/portmacro.h +++ b/FreeRTOS/Source/portable/IAR/AVR32_UC3/portmacro.h @@ -13,7 +13,7 @@ *****************************************************************************/ /* - FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. + FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. All rights reserved VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. @@ -106,8 +106,13 @@ extern "C" { #define portDOUBLE double #define portLONG long #define portSHORT short -#define portSTACK_TYPE unsigned portLONG -#define portBASE_TYPE portLONG +#define portSTACK_TYPE uint32_t +#define portBASE_TYPE long + +typedef portSTACK_TYPE StackType_t; +typedef long BaseType_t; +typedef unsigned long UBaseType_t; + #define TASK_DELAY_MS(x) ( (x) /portTICK_RATE_MS ) #define TASK_DELAY_S(x) ( (x)*1000 /portTICK_RATE_MS ) @@ -116,17 +121,17 @@ extern "C" { #define configTICK_TC_IRQ ATPASTE2(AVR32_TC_IRQ, configTICK_TC_CHANNEL) #if( configUSE_16_BIT_TICKS == 1 ) - typedef unsigned portSHORT portTickType; - #define portMAX_DELAY ( portTickType ) 0xffff + typedef uint16_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffff #else - typedef unsigned portLONG portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffffUL + typedef uint32_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffffffffUL #endif /*-----------------------------------------------------------*/ /* Architecture specifics. */ #define portSTACK_GROWTH ( -1 ) -#define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ ) +#define portTICK_RATE_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ ) #define portBYTE_ALIGNMENT 4 #define portNOP() {__asm__ __volatile__ ("nop");} /*-----------------------------------------------------------*/ @@ -194,7 +199,7 @@ extern void *pvPortRealloc( void *pv, size_t xSize ); */ #define portRESTORE_CONTEXT() \ { \ - extern volatile unsigned portLONG ulCriticalNesting; \ + extern volatile uint32_t ulCriticalNesting; \ extern volatile void *volatile pxCurrentTCB; \ \ __asm__ __volatile__ ( \ @@ -300,7 +305,7 @@ extern void *pvPortRealloc( void *pv, size_t xSize ); */ #define portSAVE_CONTEXT_OS_INT() \ { \ - extern volatile unsigned portLONG ulCriticalNesting; \ + extern volatile uint32_t ulCriticalNesting; \ extern volatile void *volatile pxCurrentTCB; \ \ /* When we come here */ \ @@ -348,7 +353,7 @@ extern void *pvPortRealloc( void *pv, size_t xSize ); */ #define portRESTORE_CONTEXT_OS_INT() \ { \ - extern volatile unsigned portLONG ulCriticalNesting; \ + extern volatile uint32_t ulCriticalNesting; \ extern volatile void *volatile pxCurrentTCB; \ \ /* Check if INT0 or higher were being handled (case where the OS tick interrupted another */ \ @@ -412,7 +417,7 @@ extern void *pvPortRealloc( void *pv, size_t xSize ); */ #define portSAVE_CONTEXT_SCALL() \ { \ - extern volatile unsigned portLONG ulCriticalNesting; \ + extern volatile uint32_t ulCriticalNesting; \ extern volatile void *volatile pxCurrentTCB; \ \ /* Warning: the stack layout after SCALL doesn't match the one after an interrupt. */ \ @@ -475,7 +480,7 @@ extern void *pvPortRealloc( void *pv, size_t xSize ); */ #define portRESTORE_CONTEXT_SCALL() \ { \ - extern volatile unsigned portLONG ulCriticalNesting; \ + extern volatile uint32_t ulCriticalNesting; \ extern volatile void *volatile pxCurrentTCB; \ \ /* Restore all registers */ \ @@ -567,7 +572,7 @@ extern void *pvPortRealloc( void *pv, size_t xSize ); */ #define portENTER_SWITCHING_ISR() \ { \ - extern volatile unsigned portLONG ulCriticalNesting; \ + extern volatile uint32_t ulCriticalNesting; \ extern volatile void *volatile pxCurrentTCB; \ \ /* When we come here */ \ @@ -612,7 +617,7 @@ extern void *pvPortRealloc( void *pv, size_t xSize ); */ #define portEXIT_SWITCHING_ISR() \ { \ - extern volatile unsigned portLONG ulCriticalNesting; \ + extern volatile uint32_t ulCriticalNesting; \ extern volatile void *volatile pxCurrentTCB; \ \ __asm__ __volatile__ ( \ diff --git a/FreeRTOS/Source/portable/IAR/AVR32_UC3/read.c b/FreeRTOS/Source/portable/IAR/AVR32_UC3/read.c index 925c196f7..30b5ee85d 100644 --- a/FreeRTOS/Source/portable/IAR/AVR32_UC3/read.c +++ b/FreeRTOS/Source/portable/IAR/AVR32_UC3/read.c @@ -65,7 +65,7 @@ extern volatile avr32_usart_t *volatile stdio_usart_base; * \return The number of bytes read, \c 0 at the end of the file, or * \c _LLIO_ERROR on failure. */ -size_t __read(int handle, unsigned char *buffer, size_t size) +size_t __read(int handle, uint8_t *buffer, size_t size) { int nChars = 0; diff --git a/FreeRTOS/Source/portable/IAR/AVR32_UC3/write.c b/FreeRTOS/Source/portable/IAR/AVR32_UC3/write.c index 7dc8a71bb..859487eca 100644 --- a/FreeRTOS/Source/portable/IAR/AVR32_UC3/write.c +++ b/FreeRTOS/Source/portable/IAR/AVR32_UC3/write.c @@ -69,7 +69,7 @@ __no_init volatile avr32_usart_t *volatile stdio_usart_base; * * \return The number of bytes written, or \c _LLIO_ERROR on failure. */ -size_t __write(int handle, const unsigned char *buffer, size_t size) +size_t __write(int handle, const uint8_t *buffer, size_t size) { size_t nChars = 0; diff --git a/FreeRTOS/Source/portable/IAR/AtmelSAM7S64/lib_AT91SAM7S64.h b/FreeRTOS/Source/portable/IAR/AtmelSAM7S64/lib_AT91SAM7S64.h index 9d012c4d7..08e3d29e7 100644 --- a/FreeRTOS/Source/portable/IAR/AtmelSAM7S64/lib_AT91SAM7S64.h +++ b/FreeRTOS/Source/portable/IAR/AtmelSAM7S64/lib_AT91SAM7S64.h @@ -2472,7 +2472,7 @@ __inline unsigned int AT91F_US_ReceiveFrame ( //*---------------------------------------------------------------------------- __inline void AT91F_US_SetIrdaFilter ( AT91PS_USART pUSART, - unsigned char value + uint8_t value ) { pUSART->US_IF = value; @@ -2511,7 +2511,7 @@ __inline void AT91F_UDP_DisableIt ( //*---------------------------------------------------------------------------- __inline void AT91F_UDP_SetAddress ( AT91PS_UDP pUDP, // \arg pointer to a UDP controller - unsigned char address) // \arg new UDP address + uint8_t address) // \arg new UDP address { pUDP->UDP_FADDR = (AT91C_UDP_FEN | address); } @@ -2577,7 +2577,7 @@ __inline void AT91F_UDP_ResetEp ( // \return the UDP device state //*---------------------------------------------------------------------------- __inline void AT91F_UDP_EpStall( AT91PS_UDP pUDP, // \arg pointer to a UDP controller - unsigned char endpoint) // \arg endpoint number + uint8_t endpoint) // \arg endpoint number { pUDP->UDP_CSR[endpoint] |= AT91C_UDP_FORCESTALL; } @@ -2588,8 +2588,8 @@ __inline void AT91F_UDP_EpStall( //*---------------------------------------------------------------------------- __inline void AT91F_UDP_EpWrite( AT91PS_UDP pUDP, // \arg pointer to a UDP controller - unsigned char endpoint, // \arg endpoint number - unsigned char value) // \arg value to be written in the DPR + uint8_t endpoint, // \arg endpoint number + uint8_t value) // \arg value to be written in the DPR { pUDP->UDP_FDR[endpoint] = value; } @@ -2600,7 +2600,7 @@ __inline void AT91F_UDP_EpWrite( //*---------------------------------------------------------------------------- __inline unsigned int AT91F_UDP_EpRead( AT91PS_UDP pUDP, // \arg pointer to a UDP controller - unsigned char endpoint) // \arg endpoint number + uint8_t endpoint) // \arg endpoint number { return pUDP->UDP_FDR[endpoint]; } @@ -2611,7 +2611,7 @@ __inline unsigned int AT91F_UDP_EpRead( //*---------------------------------------------------------------------------- __inline void AT91F_UDP_EpEndOfWr( AT91PS_UDP pUDP, // \arg pointer to a UDP controller - unsigned char endpoint) // \arg endpoint number + uint8_t endpoint) // \arg endpoint number { pUDP->UDP_CSR[endpoint] |= AT91C_UDP_TXPKTRDY; } @@ -2622,7 +2622,7 @@ __inline void AT91F_UDP_EpEndOfWr( //*---------------------------------------------------------------------------- __inline void AT91F_UDP_EpClear( AT91PS_UDP pUDP, // \arg pointer to a UDP controller - unsigned char endpoint, // \arg endpoint number + uint8_t endpoint, // \arg endpoint number unsigned int flag) // \arg flag to be cleared { pUDP->UDP_CSR[endpoint] &= ~(flag); @@ -2634,7 +2634,7 @@ __inline void AT91F_UDP_EpClear( //*---------------------------------------------------------------------------- __inline void AT91F_UDP_EpSet( AT91PS_UDP pUDP, // \arg pointer to a UDP controller - unsigned char endpoint, // \arg endpoint number + uint8_t endpoint, // \arg endpoint number unsigned int flag) // \arg flag to be cleared { pUDP->UDP_CSR[endpoint] |= flag; @@ -2646,7 +2646,7 @@ __inline void AT91F_UDP_EpSet( //*---------------------------------------------------------------------------- __inline unsigned int AT91F_UDP_EpStatus( AT91PS_UDP pUDP, // \arg pointer to a UDP controller - unsigned char endpoint) // \arg endpoint number + uint8_t endpoint) // \arg endpoint number { return pUDP->UDP_CSR[endpoint]; } diff --git a/FreeRTOS/Source/portable/IAR/AtmelSAM7S64/lib_AT91SAM7X128.h b/FreeRTOS/Source/portable/IAR/AtmelSAM7S64/lib_AT91SAM7X128.h index 805a2bce9..cb33b6f54 100644 --- a/FreeRTOS/Source/portable/IAR/AtmelSAM7S64/lib_AT91SAM7X128.h +++ b/FreeRTOS/Source/portable/IAR/AtmelSAM7S64/lib_AT91SAM7X128.h @@ -2262,7 +2262,7 @@ __inline unsigned int AT91F_US_ReceiveFrame ( //*---------------------------------------------------------------------------- __inline void AT91F_US_SetIrdaFilter ( AT91PS_USART pUSART, - unsigned char value + uint8_t value ) { pUSART->US_IF = value; @@ -2704,7 +2704,7 @@ __inline void AT91F_UDP_DisableIt ( //*---------------------------------------------------------------------------- __inline void AT91F_UDP_SetAddress ( AT91PS_UDP pUDP, // \arg pointer to a UDP controller - unsigned char address) // \arg new UDP address + uint8_t address) // \arg new UDP address { pUDP->UDP_FADDR = (AT91C_UDP_FEN | address); } @@ -2715,7 +2715,7 @@ __inline void AT91F_UDP_SetAddress ( //*---------------------------------------------------------------------------- __inline void AT91F_UDP_EnableEp ( AT91PS_UDP pUDP, // \arg pointer to a UDP controller - unsigned char endpoint) // \arg endpoint number + uint8_t endpoint) // \arg endpoint number { pUDP->UDP_CSR[endpoint] |= AT91C_UDP_EPEDS; } @@ -2726,7 +2726,7 @@ __inline void AT91F_UDP_EnableEp ( //*---------------------------------------------------------------------------- __inline void AT91F_UDP_DisableEp ( AT91PS_UDP pUDP, // \arg pointer to a UDP controller - unsigned char endpoint) // \arg endpoint number + uint8_t endpoint) // \arg endpoint number { pUDP->UDP_CSR[endpoint] &= ~AT91C_UDP_EPEDS; } @@ -2771,7 +2771,7 @@ __inline void AT91F_UDP_ResetEp ( // \return the UDP device state //*---------------------------------------------------------------------------- __inline void AT91F_UDP_EpStall( AT91PS_UDP pUDP, // \arg pointer to a UDP controller - unsigned char endpoint) // \arg endpoint number + uint8_t endpoint) // \arg endpoint number { pUDP->UDP_CSR[endpoint] |= AT91C_UDP_FORCESTALL; } @@ -2782,8 +2782,8 @@ __inline void AT91F_UDP_EpStall( //*---------------------------------------------------------------------------- __inline void AT91F_UDP_EpWrite( AT91PS_UDP pUDP, // \arg pointer to a UDP controller - unsigned char endpoint, // \arg endpoint number - unsigned char value) // \arg value to be written in the DPR + uint8_t endpoint, // \arg endpoint number + uint8_t value) // \arg value to be written in the DPR { pUDP->UDP_FDR[endpoint] = value; } @@ -2794,7 +2794,7 @@ __inline void AT91F_UDP_EpWrite( //*---------------------------------------------------------------------------- __inline unsigned int AT91F_UDP_EpRead( AT91PS_UDP pUDP, // \arg pointer to a UDP controller - unsigned char endpoint) // \arg endpoint number + uint8_t endpoint) // \arg endpoint number { return pUDP->UDP_FDR[endpoint]; } @@ -2805,7 +2805,7 @@ __inline unsigned int AT91F_UDP_EpRead( //*---------------------------------------------------------------------------- __inline void AT91F_UDP_EpEndOfWr( AT91PS_UDP pUDP, // \arg pointer to a UDP controller - unsigned char endpoint) // \arg endpoint number + uint8_t endpoint) // \arg endpoint number { pUDP->UDP_CSR[endpoint] |= AT91C_UDP_TXPKTRDY; } @@ -2816,7 +2816,7 @@ __inline void AT91F_UDP_EpEndOfWr( //*---------------------------------------------------------------------------- __inline void AT91F_UDP_EpClear( AT91PS_UDP pUDP, // \arg pointer to a UDP controller - unsigned char endpoint, // \arg endpoint number + uint8_t endpoint, // \arg endpoint number unsigned int flag) // \arg flag to be cleared { pUDP->UDP_CSR[endpoint] &= ~(flag); @@ -2828,7 +2828,7 @@ __inline void AT91F_UDP_EpClear( //*---------------------------------------------------------------------------- __inline void AT91F_UDP_EpSet( AT91PS_UDP pUDP, // \arg pointer to a UDP controller - unsigned char endpoint, // \arg endpoint number + uint8_t endpoint, // \arg endpoint number unsigned int flag) // \arg flag to be cleared { pUDP->UDP_CSR[endpoint] |= flag; @@ -2840,7 +2840,7 @@ __inline void AT91F_UDP_EpSet( //*---------------------------------------------------------------------------- __inline unsigned int AT91F_UDP_EpStatus( AT91PS_UDP pUDP, // \arg pointer to a UDP controller - unsigned char endpoint) // \arg endpoint number + uint8_t endpoint) // \arg endpoint number { return pUDP->UDP_CSR[endpoint]; } @@ -3158,7 +3158,7 @@ __inline unsigned int AT91F_CAN_GetMessageModeReg ( __inline void AT91F_CAN_CfgMessageIDReg ( AT91PS_CAN_MB CAN_Mailbox, // pointer to a CAN Mailbox unsigned int id, - unsigned char version) + uint8_t version) { if(version==0) // IDvA Standard Format CAN_Mailbox->CAN_MB_MID = id<<18; @@ -3680,7 +3680,7 @@ __inline void AT91F_AES_LoadNewSeed ( //*---------------------------------------------------------------------------- __inline void AT91F_AES_SetCryptoKey ( AT91PS_AES pAES, // pointer to a AES controller - unsigned char index, + uint8_t index, unsigned int keyword ) { @@ -3693,7 +3693,7 @@ __inline void AT91F_AES_SetCryptoKey ( //*---------------------------------------------------------------------------- __inline void AT91F_AES_InputData ( AT91PS_AES pAES, // pointer to a AES controller - unsigned char index, + uint8_t index, unsigned int indata ) { @@ -3706,7 +3706,7 @@ __inline void AT91F_AES_InputData ( //*---------------------------------------------------------------------------- __inline unsigned int AT91F_AES_GetOutputData ( AT91PS_AES pAES, // pointer to a AES controller - unsigned char index + uint8_t index ) { return pAES->AES_ODATAxR[index]; @@ -3718,7 +3718,7 @@ __inline unsigned int AT91F_AES_GetOutputData ( //*---------------------------------------------------------------------------- __inline void AT91F_AES_SetInitializationVector ( AT91PS_AES pAES, // pointer to a AES controller - unsigned char index, + uint8_t index, unsigned int initvector ) { @@ -3845,7 +3845,7 @@ __inline void AT91F_TDES_SoftReset ( //*---------------------------------------------------------------------------- __inline void AT91F_TDES_SetCryptoKey1 ( AT91PS_TDES pTDES, // pointer to a TDES controller - unsigned char index, + uint8_t index, unsigned int keyword ) { @@ -3858,7 +3858,7 @@ __inline void AT91F_TDES_SetCryptoKey1 ( //*---------------------------------------------------------------------------- __inline void AT91F_TDES_SetCryptoKey2 ( AT91PS_TDES pTDES, // pointer to a TDES controller - unsigned char index, + uint8_t index, unsigned int keyword ) { @@ -3871,7 +3871,7 @@ __inline void AT91F_TDES_SetCryptoKey2 ( //*---------------------------------------------------------------------------- __inline void AT91F_TDES_SetCryptoKey3 ( AT91PS_TDES pTDES, // pointer to a TDES controller - unsigned char index, + uint8_t index, unsigned int keyword ) { @@ -3884,7 +3884,7 @@ __inline void AT91F_TDES_SetCryptoKey3 ( //*---------------------------------------------------------------------------- __inline void AT91F_TDES_InputData ( AT91PS_TDES pTDES, // pointer to a TDES controller - unsigned char index, + uint8_t index, unsigned int indata ) { @@ -3897,7 +3897,7 @@ __inline void AT91F_TDES_InputData ( //*---------------------------------------------------------------------------- __inline unsigned int AT91F_TDES_GetOutputData ( AT91PS_TDES pTDES, // pointer to a TDES controller - unsigned char index + uint8_t index ) { return pTDES->TDES_ODATAxR[index]; @@ -3909,7 +3909,7 @@ __inline unsigned int AT91F_TDES_GetOutputData ( //*---------------------------------------------------------------------------- __inline void AT91F_TDES_SetInitializationVector ( AT91PS_TDES pTDES, // pointer to a TDES controller - unsigned char index, + uint8_t index, unsigned int initvector ) { diff --git a/FreeRTOS/Source/portable/IAR/AtmelSAM7S64/lib_AT91SAM7X256.h b/FreeRTOS/Source/portable/IAR/AtmelSAM7S64/lib_AT91SAM7X256.h index 02ee9008d..0a1553ed7 100644 --- a/FreeRTOS/Source/portable/IAR/AtmelSAM7S64/lib_AT91SAM7X256.h +++ b/FreeRTOS/Source/portable/IAR/AtmelSAM7S64/lib_AT91SAM7X256.h @@ -2262,7 +2262,7 @@ __inline unsigned int AT91F_US_ReceiveFrame ( //*---------------------------------------------------------------------------- __inline void AT91F_US_SetIrdaFilter ( AT91PS_USART pUSART, - unsigned char value + uint8_t value ) { pUSART->US_IF = value; @@ -2704,7 +2704,7 @@ __inline void AT91F_UDP_DisableIt ( //*---------------------------------------------------------------------------- __inline void AT91F_UDP_SetAddress ( AT91PS_UDP pUDP, // \arg pointer to a UDP controller - unsigned char address) // \arg new UDP address + uint8_t address) // \arg new UDP address { pUDP->UDP_FADDR = (AT91C_UDP_FEN | address); } @@ -2715,7 +2715,7 @@ __inline void AT91F_UDP_SetAddress ( //*---------------------------------------------------------------------------- __inline void AT91F_UDP_EnableEp ( AT91PS_UDP pUDP, // \arg pointer to a UDP controller - unsigned char endpoint) // \arg endpoint number + uint8_t endpoint) // \arg endpoint number { pUDP->UDP_CSR[endpoint] |= AT91C_UDP_EPEDS; } @@ -2726,7 +2726,7 @@ __inline void AT91F_UDP_EnableEp ( //*---------------------------------------------------------------------------- __inline void AT91F_UDP_DisableEp ( AT91PS_UDP pUDP, // \arg pointer to a UDP controller - unsigned char endpoint) // \arg endpoint number + uint8_t endpoint) // \arg endpoint number { pUDP->UDP_CSR[endpoint] &= ~AT91C_UDP_EPEDS; } @@ -2771,7 +2771,7 @@ __inline void AT91F_UDP_ResetEp ( // \return the UDP device state //*---------------------------------------------------------------------------- __inline void AT91F_UDP_EpStall( AT91PS_UDP pUDP, // \arg pointer to a UDP controller - unsigned char endpoint) // \arg endpoint number + uint8_t endpoint) // \arg endpoint number { pUDP->UDP_CSR[endpoint] |= AT91C_UDP_FORCESTALL; } @@ -2782,8 +2782,8 @@ __inline void AT91F_UDP_EpStall( //*---------------------------------------------------------------------------- __inline void AT91F_UDP_EpWrite( AT91PS_UDP pUDP, // \arg pointer to a UDP controller - unsigned char endpoint, // \arg endpoint number - unsigned char value) // \arg value to be written in the DPR + uint8_t endpoint, // \arg endpoint number + uint8_t value) // \arg value to be written in the DPR { pUDP->UDP_FDR[endpoint] = value; } @@ -2794,7 +2794,7 @@ __inline void AT91F_UDP_EpWrite( //*---------------------------------------------------------------------------- __inline unsigned int AT91F_UDP_EpRead( AT91PS_UDP pUDP, // \arg pointer to a UDP controller - unsigned char endpoint) // \arg endpoint number + uint8_t endpoint) // \arg endpoint number { return pUDP->UDP_FDR[endpoint]; } @@ -2805,7 +2805,7 @@ __inline unsigned int AT91F_UDP_EpRead( //*---------------------------------------------------------------------------- __inline void AT91F_UDP_EpEndOfWr( AT91PS_UDP pUDP, // \arg pointer to a UDP controller - unsigned char endpoint) // \arg endpoint number + uint8_t endpoint) // \arg endpoint number { pUDP->UDP_CSR[endpoint] |= AT91C_UDP_TXPKTRDY; } @@ -2816,7 +2816,7 @@ __inline void AT91F_UDP_EpEndOfWr( //*---------------------------------------------------------------------------- __inline void AT91F_UDP_EpClear( AT91PS_UDP pUDP, // \arg pointer to a UDP controller - unsigned char endpoint, // \arg endpoint number + uint8_t endpoint, // \arg endpoint number unsigned int flag) // \arg flag to be cleared { pUDP->UDP_CSR[endpoint] &= ~(flag); @@ -2828,7 +2828,7 @@ __inline void AT91F_UDP_EpClear( //*---------------------------------------------------------------------------- __inline void AT91F_UDP_EpSet( AT91PS_UDP pUDP, // \arg pointer to a UDP controller - unsigned char endpoint, // \arg endpoint number + uint8_t endpoint, // \arg endpoint number unsigned int flag) // \arg flag to be cleared { pUDP->UDP_CSR[endpoint] |= flag; @@ -2840,7 +2840,7 @@ __inline void AT91F_UDP_EpSet( //*---------------------------------------------------------------------------- __inline unsigned int AT91F_UDP_EpStatus( AT91PS_UDP pUDP, // \arg pointer to a UDP controller - unsigned char endpoint) // \arg endpoint number + uint8_t endpoint) // \arg endpoint number { return pUDP->UDP_CSR[endpoint]; } @@ -3158,7 +3158,7 @@ __inline unsigned int AT91F_CAN_GetMessageModeReg ( __inline void AT91F_CAN_CfgMessageIDReg ( AT91PS_CAN_MB CAN_Mailbox, // pointer to a CAN Mailbox unsigned int id, - unsigned char version) + uint8_t version) { if(version==0) // IDvA Standard Format CAN_Mailbox->CAN_MB_MID = id<<18; @@ -3680,7 +3680,7 @@ __inline void AT91F_AES_LoadNewSeed ( //*---------------------------------------------------------------------------- __inline void AT91F_AES_SetCryptoKey ( AT91PS_AES pAES, // pointer to a AES controller - unsigned char index, + uint8_t index, unsigned int keyword ) { @@ -3693,7 +3693,7 @@ __inline void AT91F_AES_SetCryptoKey ( //*---------------------------------------------------------------------------- __inline void AT91F_AES_InputData ( AT91PS_AES pAES, // pointer to a AES controller - unsigned char index, + uint8_t index, unsigned int indata ) { @@ -3706,7 +3706,7 @@ __inline void AT91F_AES_InputData ( //*---------------------------------------------------------------------------- __inline unsigned int AT91F_AES_GetOutputData ( AT91PS_AES pAES, // pointer to a AES controller - unsigned char index + uint8_t index ) { return pAES->AES_ODATAxR[index]; @@ -3718,7 +3718,7 @@ __inline unsigned int AT91F_AES_GetOutputData ( //*---------------------------------------------------------------------------- __inline void AT91F_AES_SetInitializationVector ( AT91PS_AES pAES, // pointer to a AES controller - unsigned char index, + uint8_t index, unsigned int initvector ) { @@ -3845,7 +3845,7 @@ __inline void AT91F_TDES_SoftReset ( //*---------------------------------------------------------------------------- __inline void AT91F_TDES_SetCryptoKey1 ( AT91PS_TDES pTDES, // pointer to a TDES controller - unsigned char index, + uint8_t index, unsigned int keyword ) { @@ -3858,7 +3858,7 @@ __inline void AT91F_TDES_SetCryptoKey1 ( //*---------------------------------------------------------------------------- __inline void AT91F_TDES_SetCryptoKey2 ( AT91PS_TDES pTDES, // pointer to a TDES controller - unsigned char index, + uint8_t index, unsigned int keyword ) { @@ -3871,7 +3871,7 @@ __inline void AT91F_TDES_SetCryptoKey2 ( //*---------------------------------------------------------------------------- __inline void AT91F_TDES_SetCryptoKey3 ( AT91PS_TDES pTDES, // pointer to a TDES controller - unsigned char index, + uint8_t index, unsigned int keyword ) { @@ -3884,7 +3884,7 @@ __inline void AT91F_TDES_SetCryptoKey3 ( //*---------------------------------------------------------------------------- __inline void AT91F_TDES_InputData ( AT91PS_TDES pTDES, // pointer to a TDES controller - unsigned char index, + uint8_t index, unsigned int indata ) { @@ -3897,7 +3897,7 @@ __inline void AT91F_TDES_InputData ( //*---------------------------------------------------------------------------- __inline unsigned int AT91F_TDES_GetOutputData ( AT91PS_TDES pTDES, // pointer to a TDES controller - unsigned char index + uint8_t index ) { return pTDES->TDES_ODATAxR[index]; @@ -3909,7 +3909,7 @@ __inline unsigned int AT91F_TDES_GetOutputData ( //*---------------------------------------------------------------------------- __inline void AT91F_TDES_SetInitializationVector ( AT91PS_TDES pTDES, // pointer to a TDES controller - unsigned char index, + uint8_t index, unsigned int initvector ) { diff --git a/FreeRTOS/Source/portable/IAR/AtmelSAM7S64/port.c b/FreeRTOS/Source/portable/IAR/AtmelSAM7S64/port.c index 334f02472..3109ad90b 100644 --- a/FreeRTOS/Source/portable/IAR/AtmelSAM7S64/port.c +++ b/FreeRTOS/Source/portable/IAR/AtmelSAM7S64/port.c @@ -76,21 +76,21 @@ #include "task.h" /* Constants required to setup the initial stack. */ -#define portINITIAL_SPSR ( ( portSTACK_TYPE ) 0x1f ) /* System mode, ARM mode, interrupts enabled. */ -#define portTHUMB_MODE_BIT ( ( portSTACK_TYPE ) 0x20 ) -#define portINSTRUCTION_SIZE ( ( portSTACK_TYPE ) 4 ) +#define portINITIAL_SPSR ( ( StackType_t ) 0x1f ) /* System mode, ARM mode, interrupts enabled. */ +#define portTHUMB_MODE_BIT ( ( StackType_t ) 0x20 ) +#define portINSTRUCTION_SIZE ( ( StackType_t ) 4 ) /* Constants required to setup the PIT. */ -#define portPIT_CLOCK_DIVISOR ( ( unsigned long ) 16 ) +#define portPIT_CLOCK_DIVISOR ( ( uint32_t ) 16 ) #define portPIT_COUNTER_VALUE ( ( ( configCPU_CLOCK_HZ / portPIT_CLOCK_DIVISOR ) / 1000UL ) * portTICK_RATE_MS ) /* Constants required to handle critical sections. */ -#define portNO_CRITICAL_NESTING ( ( unsigned long ) 0 ) +#define portNO_CRITICAL_NESTING ( ( uint32_t ) 0 ) #define portINT_LEVEL_SENSITIVE 0 -#define portPIT_ENABLE ( ( unsigned short ) 0x1 << 24 ) -#define portPIT_INT_ENABLE ( ( unsigned short ) 0x1 << 25 ) +#define portPIT_ENABLE ( ( uint16_t ) 0x1 << 24 ) +#define portPIT_INT_ENABLE ( ( uint16_t ) 0x1 << 25 ) /*-----------------------------------------------------------*/ /* Setup the PIT to generate the tick interrupts. */ @@ -99,7 +99,7 @@ static void prvSetupTimerInterrupt( void ); /* ulCriticalNesting will get set to zero when the first task starts. It cannot be initialised to 0 as this will cause interrupts to be enabled during the kernel initialisation process. */ -unsigned long ulCriticalNesting = ( unsigned long ) 9999; +uint32_t ulCriticalNesting = ( uint32_t ) 9999; /*-----------------------------------------------------------*/ @@ -109,9 +109,9 @@ unsigned long ulCriticalNesting = ( unsigned long ) 9999; * * See header file for description. */ -portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) +StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) { -portSTACK_TYPE *pxOriginalTOS; +StackType_t *pxOriginalTOS; pxOriginalTOS = pxTopOfStack; @@ -125,47 +125,47 @@ portSTACK_TYPE *pxOriginalTOS; /* First on the stack is the return address - which in this case is the start of the task. The offset is added to make the return address appear as it would within an IRQ ISR. */ - *pxTopOfStack = ( portSTACK_TYPE ) pxCode + portINSTRUCTION_SIZE; + *pxTopOfStack = ( StackType_t ) pxCode + portINSTRUCTION_SIZE; pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0xaaaaaaaa; /* R14 */ + *pxTopOfStack = ( StackType_t ) 0xaaaaaaaa; /* R14 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) pxOriginalTOS; /* Stack used when task starts goes in R13. */ + *pxTopOfStack = ( StackType_t ) pxOriginalTOS; /* Stack used when task starts goes in R13. */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x12121212; /* R12 */ + *pxTopOfStack = ( StackType_t ) 0x12121212; /* R12 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x11111111; /* R11 */ + *pxTopOfStack = ( StackType_t ) 0x11111111; /* R11 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x10101010; /* R10 */ + *pxTopOfStack = ( StackType_t ) 0x10101010; /* R10 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x09090909; /* R9 */ + *pxTopOfStack = ( StackType_t ) 0x09090909; /* R9 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x08080808; /* R8 */ + *pxTopOfStack = ( StackType_t ) 0x08080808; /* R8 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x07070707; /* R7 */ + *pxTopOfStack = ( StackType_t ) 0x07070707; /* R7 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x06060606; /* R6 */ + *pxTopOfStack = ( StackType_t ) 0x06060606; /* R6 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x05050505; /* R5 */ + *pxTopOfStack = ( StackType_t ) 0x05050505; /* R5 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x04040404; /* R4 */ + *pxTopOfStack = ( StackType_t ) 0x04040404; /* R4 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x03030303; /* R3 */ + *pxTopOfStack = ( StackType_t ) 0x03030303; /* R3 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x02020202; /* R2 */ + *pxTopOfStack = ( StackType_t ) 0x02020202; /* R2 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x01010101; /* R1 */ + *pxTopOfStack = ( StackType_t ) 0x01010101; /* R1 */ pxTopOfStack--; /* When the task starts is will expect to find the function parameter in R0. */ - *pxTopOfStack = ( portSTACK_TYPE ) pvParameters; /* R0 */ + *pxTopOfStack = ( StackType_t ) pvParameters; /* R0 */ pxTopOfStack--; /* The status register is set for system mode, with interrupts enabled. */ - *pxTopOfStack = ( portSTACK_TYPE ) portINITIAL_SPSR; + *pxTopOfStack = ( StackType_t ) portINITIAL_SPSR; - if( ( ( unsigned long ) pxCode & 0x01UL ) != 0x00UL ) + if( ( ( uint32_t ) pxCode & 0x01UL ) != 0x00UL ) { /* We want the task to start in thumb mode. */ *pxTopOfStack |= portTHUMB_MODE_BIT; @@ -182,7 +182,7 @@ portSTACK_TYPE *pxOriginalTOS; } /*-----------------------------------------------------------*/ -portBASE_TYPE xPortStartScheduler( void ) +BaseType_t xPortStartScheduler( void ) { extern void vPortStartFirstTask( void ); @@ -212,7 +212,7 @@ void vPortEndScheduler( void ) static __arm __irq void vPortNonPreemptiveTick( void ); static __arm __irq void vPortNonPreemptiveTick( void ) { - unsigned long ulDummy; + uint32_t ulDummy; /* Increment the tick count - which may wake some tasks but as the preemptive scheduler is not being used any woken task is not given diff --git a/FreeRTOS/Source/portable/IAR/AtmelSAM7S64/portmacro.h b/FreeRTOS/Source/portable/IAR/AtmelSAM7S64/portmacro.h index 13a35ac24..257e54d89 100644 --- a/FreeRTOS/Source/portable/IAR/AtmelSAM7S64/portmacro.h +++ b/FreeRTOS/Source/portable/IAR/AtmelSAM7S64/portmacro.h @@ -1,5 +1,5 @@ /* - FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. + FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. All rights reserved VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. @@ -87,25 +87,29 @@ extern "C" { #define portDOUBLE double #define portLONG long #define portSHORT short -#define portSTACK_TYPE unsigned portLONG -#define portBASE_TYPE portLONG +#define portSTACK_TYPE uint32_t +#define portBASE_TYPE long + +typedef portSTACK_TYPE StackType_t; +typedef long BaseType_t; +typedef unsigned long UBaseType_t; #if( configUSE_16_BIT_TICKS == 1 ) - typedef unsigned portSHORT portTickType; - #define portMAX_DELAY ( portTickType ) 0xffff + typedef uint16_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffff #else - typedef unsigned portLONG portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffffUL + typedef uint32_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffffffffUL #endif -/*-----------------------------------------------------------*/ +/*-----------------------------------------------------------*/ /* Hardware specifics. */ #define portSTACK_GROWTH ( -1 ) -#define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ ) +#define portTICK_RATE_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ ) #define portBYTE_ALIGNMENT 8 #define portYIELD() asm ( "SWI 0" ) #define portNOP() asm ( "NOP" ) -/*-----------------------------------------------------------*/ +/*-----------------------------------------------------------*/ /* Critical section handling. */ __arm __interwork void vPortDisableInterruptsFromThumb( void ); @@ -117,7 +121,7 @@ __arm __interwork void vPortExitCritical( void ); #define portENABLE_INTERRUPTS() __enable_interrupt() #define portENTER_CRITICAL() vPortEnterCritical() #define portEXIT_CRITICAL() vPortExitCritical() -/*-----------------------------------------------------------*/ +/*-----------------------------------------------------------*/ /* Task utilities. */ #define portEND_SWITCHING_ISR( xSwitchRequired ) \ @@ -129,7 +133,7 @@ extern void vTaskSwitchContext( void ); \ vTaskSwitchContext(); \ } \ } -/*-----------------------------------------------------------*/ +/*-----------------------------------------------------------*/ /* Task function macros as described on the FreeRTOS.org WEB site. */ diff --git a/FreeRTOS/Source/portable/IAR/AtmelSAM9XE/port.c b/FreeRTOS/Source/portable/IAR/AtmelSAM9XE/port.c index 192736b03..35960f6ea 100644 --- a/FreeRTOS/Source/portable/IAR/AtmelSAM9XE/port.c +++ b/FreeRTOS/Source/portable/IAR/AtmelSAM9XE/port.c @@ -88,21 +88,21 @@ /*-----------------------------------------------------------*/ /* Constants required to setup the initial stack. */ -#define portINITIAL_SPSR ( ( portSTACK_TYPE ) 0x1f ) /* System mode, ARM mode, interrupts enabled. */ -#define portTHUMB_MODE_BIT ( ( portSTACK_TYPE ) 0x20 ) -#define portINSTRUCTION_SIZE ( ( portSTACK_TYPE ) 4 ) +#define portINITIAL_SPSR ( ( StackType_t ) 0x1f ) /* System mode, ARM mode, interrupts enabled. */ +#define portTHUMB_MODE_BIT ( ( StackType_t ) 0x20 ) +#define portINSTRUCTION_SIZE ( ( StackType_t ) 4 ) /* Constants required to setup the PIT. */ #define port1MHz_IN_Hz ( 1000000ul ) #define port1SECOND_IN_uS ( 1000000.0 ) /* Constants required to handle critical sections. */ -#define portNO_CRITICAL_NESTING ( ( unsigned long ) 0 ) +#define portNO_CRITICAL_NESTING ( ( uint32_t ) 0 ) #define portINT_LEVEL_SENSITIVE 0 -#define portPIT_ENABLE ( ( unsigned short ) 0x1 << 24 ) -#define portPIT_INT_ENABLE ( ( unsigned short ) 0x1 << 25 ) +#define portPIT_ENABLE ( ( uint16_t ) 0x1 << 24 ) +#define portPIT_INT_ENABLE ( ( uint16_t ) 0x1 << 25 ) /*-----------------------------------------------------------*/ /* Setup the PIT to generate the tick interrupts. */ @@ -114,7 +114,7 @@ static void vPortTickISR( void ); /* ulCriticalNesting will get set to zero when the first task starts. It cannot be initialised to 0 as this will cause interrupts to be enabled during the kernel initialisation process. */ -unsigned long ulCriticalNesting = ( unsigned long ) 9999; +uint32_t ulCriticalNesting = ( uint32_t ) 9999; /*-----------------------------------------------------------*/ @@ -124,9 +124,9 @@ unsigned long ulCriticalNesting = ( unsigned long ) 9999; * * See header file for description. */ -portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) +StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) { -portSTACK_TYPE *pxOriginalTOS; +StackType_t *pxOriginalTOS; pxOriginalTOS = pxTopOfStack; @@ -140,45 +140,45 @@ portSTACK_TYPE *pxOriginalTOS; /* First on the stack is the return address - which in this case is the start of the task. The offset is added to make the return address appear as it would within an IRQ ISR. */ - *pxTopOfStack = ( portSTACK_TYPE ) pxCode + portINSTRUCTION_SIZE; + *pxTopOfStack = ( StackType_t ) pxCode + portINSTRUCTION_SIZE; pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0xaaaaaaaa; /* R14 */ + *pxTopOfStack = ( StackType_t ) 0xaaaaaaaa; /* R14 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) pxOriginalTOS; /* Stack used when task starts goes in R13. */ + *pxTopOfStack = ( StackType_t ) pxOriginalTOS; /* Stack used when task starts goes in R13. */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x12121212; /* R12 */ + *pxTopOfStack = ( StackType_t ) 0x12121212; /* R12 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x11111111; /* R11 */ + *pxTopOfStack = ( StackType_t ) 0x11111111; /* R11 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x10101010; /* R10 */ + *pxTopOfStack = ( StackType_t ) 0x10101010; /* R10 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x09090909; /* R9 */ + *pxTopOfStack = ( StackType_t ) 0x09090909; /* R9 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x08080808; /* R8 */ + *pxTopOfStack = ( StackType_t ) 0x08080808; /* R8 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x07070707; /* R7 */ + *pxTopOfStack = ( StackType_t ) 0x07070707; /* R7 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x06060606; /* R6 */ + *pxTopOfStack = ( StackType_t ) 0x06060606; /* R6 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x05050505; /* R5 */ + *pxTopOfStack = ( StackType_t ) 0x05050505; /* R5 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x04040404; /* R4 */ + *pxTopOfStack = ( StackType_t ) 0x04040404; /* R4 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x03030303; /* R3 */ + *pxTopOfStack = ( StackType_t ) 0x03030303; /* R3 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x02020202; /* R2 */ + *pxTopOfStack = ( StackType_t ) 0x02020202; /* R2 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x01010101; /* R1 */ + *pxTopOfStack = ( StackType_t ) 0x01010101; /* R1 */ pxTopOfStack--; /* When the task starts is will expect to find the function parameter in R0. */ - *pxTopOfStack = ( portSTACK_TYPE ) pvParameters; /* R0 */ + *pxTopOfStack = ( StackType_t ) pvParameters; /* R0 */ pxTopOfStack--; /* The status register is set for system mode, with interrupts enabled. */ - *pxTopOfStack = ( portSTACK_TYPE ) portINITIAL_SPSR; + *pxTopOfStack = ( StackType_t ) portINITIAL_SPSR; #ifdef THUMB_INTERWORK { @@ -198,7 +198,7 @@ portSTACK_TYPE *pxOriginalTOS; } /*-----------------------------------------------------------*/ -portBASE_TYPE xPortStartScheduler( void ) +BaseType_t xPortStartScheduler( void ) { extern void vPortStartFirstTask( void ); @@ -223,7 +223,7 @@ void vPortEndScheduler( void ) static __arm void vPortTickISR( void ) { -volatile unsigned long ulDummy; +volatile uint32_t ulDummy; /* Increment the tick count - which may wake some tasks but as the preemptive scheduler is not being used any woken task is not given @@ -245,7 +245,7 @@ volatile unsigned long ulDummy; static void prvSetupTimerInterrupt( void ) { -const unsigned long ulPeriodIn_uS = ( 1.0 / ( double ) configTICK_RATE_HZ ) * port1SECOND_IN_uS; +const uint32_t ulPeriodIn_uS = ( 1.0 / ( double ) configTICK_RATE_HZ ) * port1SECOND_IN_uS; /* Setup the PIT for the required frequency. */ PIT_Init( ulPeriodIn_uS, BOARD_MCK / port1MHz_IN_Hz ); diff --git a/FreeRTOS/Source/portable/IAR/AtmelSAM9XE/portmacro.h b/FreeRTOS/Source/portable/IAR/AtmelSAM9XE/portmacro.h index 0a763e866..fcbd10e71 100644 --- a/FreeRTOS/Source/portable/IAR/AtmelSAM9XE/portmacro.h +++ b/FreeRTOS/Source/portable/IAR/AtmelSAM9XE/portmacro.h @@ -1,5 +1,5 @@ /* - FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. + FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. All rights reserved VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. @@ -89,25 +89,30 @@ extern "C" { #define portDOUBLE double #define portLONG long #define portSHORT short -#define portSTACK_TYPE unsigned portLONG -#define portBASE_TYPE portLONG +#define portSTACK_TYPE uint32_t +#define portBASE_TYPE long + +typedef portSTACK_TYPE StackType_t; +typedef long BaseType_t; +typedef unsigned long UBaseType_t; + #if( configUSE_16_BIT_TICKS == 1 ) - typedef unsigned portSHORT portTickType; - #define portMAX_DELAY ( portTickType ) 0xffff + typedef uint16_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffff #else - typedef unsigned portLONG portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffffUL + typedef uint32_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffffffffUL #endif -/*-----------------------------------------------------------*/ +/*-----------------------------------------------------------*/ /* Hardware specifics. */ #define portSTACK_GROWTH ( -1 ) -#define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ ) +#define portTICK_RATE_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ ) #define portBYTE_ALIGNMENT 8 #define portYIELD() asm ( "SWI 0" ) #define portNOP() asm ( "NOP" ) -/*-----------------------------------------------------------*/ +/*-----------------------------------------------------------*/ /* Critical section handling. */ __arm __interwork void vPortDisableInterruptsFromThumb( void ); @@ -119,7 +124,7 @@ __arm __interwork void vPortExitCritical( void ); #define portENABLE_INTERRUPTS() __enable_irq() #define portENTER_CRITICAL() vPortEnterCritical() #define portEXIT_CRITICAL() vPortExitCritical() -/*-----------------------------------------------------------*/ +/*-----------------------------------------------------------*/ /* Task utilities. */ #define portEND_SWITCHING_ISR( xSwitchRequired ) \ @@ -131,7 +136,7 @@ extern void vTaskSwitchContext( void ); \ vTaskSwitchContext(); \ } \ } -/*-----------------------------------------------------------*/ +/*-----------------------------------------------------------*/ /* Task function macros as described on the FreeRTOS.org WEB site. */ diff --git a/FreeRTOS/Source/portable/IAR/LPC2000/port.c b/FreeRTOS/Source/portable/IAR/LPC2000/port.c index 092ed7f23..d47d72ab2 100644 --- a/FreeRTOS/Source/portable/IAR/LPC2000/port.c +++ b/FreeRTOS/Source/portable/IAR/LPC2000/port.c @@ -84,36 +84,36 @@ #include "task.h" /* Constants required to setup the tick ISR. */ -#define portENABLE_TIMER ( ( unsigned char ) 0x01 ) +#define portENABLE_TIMER ( ( uint8_t ) 0x01 ) #define portPRESCALE_VALUE 0x00 -#define portINTERRUPT_ON_MATCH ( ( unsigned long ) 0x01 ) -#define portRESET_COUNT_ON_MATCH ( ( unsigned long ) 0x02 ) +#define portINTERRUPT_ON_MATCH ( ( uint32_t ) 0x01 ) +#define portRESET_COUNT_ON_MATCH ( ( uint32_t ) 0x02 ) /* Constants required to setup the initial stack. */ -#define portINITIAL_SPSR ( ( portSTACK_TYPE ) 0x1f ) /* System mode, ARM mode, interrupts enabled. */ -#define portTHUMB_MODE_BIT ( ( portSTACK_TYPE ) 0x20 ) -#define portINSTRUCTION_SIZE ( ( portSTACK_TYPE ) 4 ) +#define portINITIAL_SPSR ( ( StackType_t ) 0x1f ) /* System mode, ARM mode, interrupts enabled. */ +#define portTHUMB_MODE_BIT ( ( StackType_t ) 0x20 ) +#define portINSTRUCTION_SIZE ( ( StackType_t ) 4 ) /* Constants required to setup the PIT. */ -#define portPIT_CLOCK_DIVISOR ( ( unsigned long ) 16 ) +#define portPIT_CLOCK_DIVISOR ( ( uint32_t ) 16 ) #define portPIT_COUNTER_VALUE ( ( ( configCPU_CLOCK_HZ / portPIT_CLOCK_DIVISOR ) / 1000UL ) * portTICK_RATE_MS ) /* Constants required to handle interrupts. */ -#define portTIMER_MATCH_ISR_BIT ( ( unsigned char ) 0x01 ) -#define portCLEAR_VIC_INTERRUPT ( ( unsigned long ) 0 ) +#define portTIMER_MATCH_ISR_BIT ( ( uint8_t ) 0x01 ) +#define portCLEAR_VIC_INTERRUPT ( ( uint32_t ) 0 ) /* Constants required to handle critical sections. */ -#define portNO_CRITICAL_NESTING ( ( unsigned long ) 0 ) +#define portNO_CRITICAL_NESTING ( ( uint32_t ) 0 ) #define portINT_LEVEL_SENSITIVE 0 -#define portPIT_ENABLE ( ( unsigned short ) 0x1 << 24 ) -#define portPIT_INT_ENABLE ( ( unsigned short ) 0x1 << 25 ) +#define portPIT_ENABLE ( ( uint16_t ) 0x1 << 24 ) +#define portPIT_INT_ENABLE ( ( uint16_t ) 0x1 << 25 ) /* Constants required to setup the VIC for the tick ISR. */ -#define portTIMER_VIC_CHANNEL ( ( unsigned long ) 0x0004 ) -#define portTIMER_VIC_CHANNEL_BIT ( ( unsigned long ) 0x0010 ) -#define portTIMER_VIC_ENABLE ( ( unsigned long ) 0x0020 ) +#define portTIMER_VIC_CHANNEL ( ( uint32_t ) 0x0004 ) +#define portTIMER_VIC_CHANNEL_BIT ( ( uint32_t ) 0x0010 ) +#define portTIMER_VIC_ENABLE ( ( uint32_t ) 0x0020 ) /*-----------------------------------------------------------*/ @@ -123,7 +123,7 @@ static void prvSetupTimerInterrupt( void ); /* ulCriticalNesting will get set to zero when the first task starts. It cannot be initialised to 0 as this will cause interrupts to be enabled during the kernel initialisation process. */ -unsigned long ulCriticalNesting = ( unsigned long ) 9999; +uint32_t ulCriticalNesting = ( uint32_t ) 9999; /*-----------------------------------------------------------*/ @@ -133,9 +133,9 @@ unsigned long ulCriticalNesting = ( unsigned long ) 9999; * * See header file for description. */ -portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) +StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) { -portSTACK_TYPE *pxOriginalTOS; +StackType_t *pxOriginalTOS; pxOriginalTOS = pxTopOfStack; @@ -145,47 +145,47 @@ portSTACK_TYPE *pxOriginalTOS; /* First on the stack is the return address - which in this case is the start of the task. The offset is added to make the return address appear as it would within an IRQ ISR. */ - *pxTopOfStack = ( portSTACK_TYPE ) pxCode + portINSTRUCTION_SIZE; + *pxTopOfStack = ( StackType_t ) pxCode + portINSTRUCTION_SIZE; pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0xaaaaaaaa; /* R14 */ + *pxTopOfStack = ( StackType_t ) 0xaaaaaaaa; /* R14 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) pxOriginalTOS; /* Stack used when task starts goes in R13. */ + *pxTopOfStack = ( StackType_t ) pxOriginalTOS; /* Stack used when task starts goes in R13. */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x12121212; /* R12 */ + *pxTopOfStack = ( StackType_t ) 0x12121212; /* R12 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x11111111; /* R11 */ + *pxTopOfStack = ( StackType_t ) 0x11111111; /* R11 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x10101010; /* R10 */ + *pxTopOfStack = ( StackType_t ) 0x10101010; /* R10 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x09090909; /* R9 */ + *pxTopOfStack = ( StackType_t ) 0x09090909; /* R9 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x08080808; /* R8 */ + *pxTopOfStack = ( StackType_t ) 0x08080808; /* R8 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x07070707; /* R7 */ + *pxTopOfStack = ( StackType_t ) 0x07070707; /* R7 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x06060606; /* R6 */ + *pxTopOfStack = ( StackType_t ) 0x06060606; /* R6 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x05050505; /* R5 */ + *pxTopOfStack = ( StackType_t ) 0x05050505; /* R5 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x04040404; /* R4 */ + *pxTopOfStack = ( StackType_t ) 0x04040404; /* R4 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x03030303; /* R3 */ + *pxTopOfStack = ( StackType_t ) 0x03030303; /* R3 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x02020202; /* R2 */ + *pxTopOfStack = ( StackType_t ) 0x02020202; /* R2 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x01010101; /* R1 */ + *pxTopOfStack = ( StackType_t ) 0x01010101; /* R1 */ pxTopOfStack--; /* When the task starts is will expect to find the function parameter in R0. */ - *pxTopOfStack = ( portSTACK_TYPE ) pvParameters; /* R0 */ + *pxTopOfStack = ( StackType_t ) pvParameters; /* R0 */ pxTopOfStack--; /* The status register is set for system mode, with interrupts enabled. */ - *pxTopOfStack = ( portSTACK_TYPE ) portINITIAL_SPSR; + *pxTopOfStack = ( StackType_t ) portINITIAL_SPSR; - if( ( ( unsigned long ) pxCode & 0x01UL ) != 0x00UL ) + if( ( ( uint32_t ) pxCode & 0x01UL ) != 0x00UL ) { /* We want the task to start in thumb mode. */ *pxTopOfStack |= portTHUMB_MODE_BIT; @@ -202,7 +202,7 @@ portSTACK_TYPE *pxOriginalTOS; } /*-----------------------------------------------------------*/ -portBASE_TYPE xPortStartScheduler( void ) +BaseType_t xPortStartScheduler( void ) { extern void vPortStartFirstTask( void ); @@ -269,7 +269,7 @@ void vPortEndScheduler( void ) static void prvSetupTimerInterrupt( void ) { -unsigned long ulCompareMatch; +uint32_t ulCompareMatch; /* A 1ms tick does not require the use of the timer prescale. This is defaulted to zero but can be used if necessary. */ @@ -301,13 +301,13 @@ unsigned long ulCompareMatch; { extern void ( vPortPreemptiveTickEntry )( void ); - VICVectAddr0 = ( unsigned long ) vPortPreemptiveTickEntry; + VICVectAddr0 = ( uint32_t ) vPortPreemptiveTickEntry; } #else { extern void ( vNonPreemptiveTick )( void ); - VICVectAddr0 = ( long ) vPortNonPreemptiveTick; + VICVectAddr0 = ( int32_t ) vPortNonPreemptiveTick; } #endif diff --git a/FreeRTOS/Source/portable/IAR/LPC2000/portmacro.h b/FreeRTOS/Source/portable/IAR/LPC2000/portmacro.h index 6172cd6a5..16203d9be 100644 --- a/FreeRTOS/Source/portable/IAR/LPC2000/portmacro.h +++ b/FreeRTOS/Source/portable/IAR/LPC2000/portmacro.h @@ -1,5 +1,5 @@ /* - FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. + FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. All rights reserved VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. @@ -89,25 +89,30 @@ extern "C" { #define portDOUBLE double #define portLONG long #define portSHORT short -#define portSTACK_TYPE unsigned portLONG -#define portBASE_TYPE portLONG +#define portSTACK_TYPE uint32_t +#define portBASE_TYPE long + +typedef portSTACK_TYPE StackType_t; +typedef long BaseType_t; +typedef unsigned long UBaseType_t; + #if( configUSE_16_BIT_TICKS == 1 ) - typedef unsigned portSHORT portTickType; - #define portMAX_DELAY ( portTickType ) 0xffff + typedef uint16_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffff #else - typedef unsigned portLONG portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffffUL + typedef uint32_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffffffffUL #endif -/*-----------------------------------------------------------*/ +/*-----------------------------------------------------------*/ /* Hardware specifics. */ #define portSTACK_GROWTH ( -1 ) -#define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ ) +#define portTICK_RATE_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ ) #define portBYTE_ALIGNMENT 8 #define portYIELD() asm ( "SWI 0" ) #define portNOP() asm ( "NOP" ) -/*-----------------------------------------------------------*/ +/*-----------------------------------------------------------*/ /* Critical section handling. */ __arm __interwork void vPortDisableInterruptsFromThumb( void ); @@ -119,7 +124,7 @@ __arm __interwork void vPortExitCritical( void ); #define portENABLE_INTERRUPTS() __enable_interrupt() #define portENTER_CRITICAL() vPortEnterCritical() #define portEXIT_CRITICAL() vPortExitCritical() -/*-----------------------------------------------------------*/ +/*-----------------------------------------------------------*/ /* Task utilities. */ #define portEND_SWITCHING_ISR( xSwitchRequired ) \ @@ -131,7 +136,7 @@ extern void vTaskSwitchContext( void ); \ vTaskSwitchContext(); \ } \ } -/*-----------------------------------------------------------*/ +/*-----------------------------------------------------------*/ /* Task function macros as described on the FreeRTOS.org WEB site. */ #define portTASK_FUNCTION_PROTO( vFunction, pvParameters ) void vFunction( void * pvParameters ) diff --git a/FreeRTOS/Source/portable/IAR/MSP430/port.c b/FreeRTOS/Source/portable/IAR/MSP430/port.c index 634dd2cd9..e864e262a 100644 --- a/FreeRTOS/Source/portable/IAR/MSP430/port.c +++ b/FreeRTOS/Source/portable/IAR/MSP430/port.c @@ -73,14 +73,14 @@ /* Constants required for hardware setup. The tick ISR runs off the ACLK, not the MCLK. */ -#define portACLK_FREQUENCY_HZ ( ( portTickType ) 32768 ) -#define portINITIAL_CRITICAL_NESTING ( ( unsigned short ) 10 ) -#define portFLAGS_INT_ENABLED ( ( portSTACK_TYPE ) 0x08 ) +#define portACLK_FREQUENCY_HZ ( ( TickType_t ) 32768 ) +#define portINITIAL_CRITICAL_NESTING ( ( uint16_t ) 10 ) +#define portFLAGS_INT_ENABLED ( ( StackType_t ) 0x08 ) /* We require the address of the pxCurrentTCB variable, but don't want to know any details of its type. */ -typedef void tskTCB; -extern volatile tskTCB * volatile pxCurrentTCB; +typedef void TCB_t; +extern volatile TCB_t * volatile pxCurrentTCB; /* Each task maintains a count of the critical section nesting depth. Each time a critical section is entered the count is incremented. Each time a @@ -90,7 +90,7 @@ being re-enabled if the count is zero. usCriticalNesting will get set to zero when the scheduler starts, but must not be initialised to zero as this will cause problems during the startup sequence. */ -volatile unsigned short usCriticalNesting = portINITIAL_CRITICAL_NESTING; +volatile uint16_t usCriticalNesting = portINITIAL_CRITICAL_NESTING; /*-----------------------------------------------------------*/ @@ -107,17 +107,17 @@ void vPortSetupTimerInterrupt( void ); * * See the header file portable.h. */ -portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) +StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) { /* Place a few bytes of known values on the bottom of the stack. This is just useful for debugging and can be included if required. - *pxTopOfStack = ( portSTACK_TYPE ) 0x1111; + *pxTopOfStack = ( StackType_t ) 0x1111; pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x2222; + *pxTopOfStack = ( StackType_t ) 0x2222; pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x3333; + *pxTopOfStack = ( StackType_t ) 0x3333; pxTopOfStack--; */ @@ -125,45 +125,45 @@ portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE executing an ISR. We want the stack to look just as if this has happened so place a pointer to the start of the task on the stack first - followed by the flags we want the task to use when it starts up. */ - *pxTopOfStack = ( portSTACK_TYPE ) pxCode; + *pxTopOfStack = ( StackType_t ) pxCode; pxTopOfStack--; *pxTopOfStack = portFLAGS_INT_ENABLED; pxTopOfStack--; /* Next the general purpose registers. */ - *pxTopOfStack = ( portSTACK_TYPE ) 0x4444; + *pxTopOfStack = ( StackType_t ) 0x4444; pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x5555; + *pxTopOfStack = ( StackType_t ) 0x5555; pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x6666; + *pxTopOfStack = ( StackType_t ) 0x6666; pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x7777; + *pxTopOfStack = ( StackType_t ) 0x7777; pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x8888; + *pxTopOfStack = ( StackType_t ) 0x8888; pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x9999; + *pxTopOfStack = ( StackType_t ) 0x9999; pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0xaaaa; + *pxTopOfStack = ( StackType_t ) 0xaaaa; pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0xbbbb; + *pxTopOfStack = ( StackType_t ) 0xbbbb; pxTopOfStack--; /* When the task starts is will expect to find the function parameter in R15. */ - *pxTopOfStack = ( portSTACK_TYPE ) pvParameters; + *pxTopOfStack = ( StackType_t ) pvParameters; pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0xdddd; + *pxTopOfStack = ( StackType_t ) 0xdddd; pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0xeeee; + *pxTopOfStack = ( StackType_t ) 0xeeee; pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0xffff; + *pxTopOfStack = ( StackType_t ) 0xffff; pxTopOfStack--; /* A variable is used to keep track of the critical section nesting. This variable has to be stored as part of the task context and is initially set to zero. */ - *pxTopOfStack = ( portSTACK_TYPE ) portNO_CRITICAL_SECTION_NESTING; + *pxTopOfStack = ( StackType_t ) portNO_CRITICAL_SECTION_NESTING; /* Return a pointer to the top of the stack we have generated so this can be stored in the task control block for the task. */ diff --git a/FreeRTOS/Source/portable/IAR/MSP430/portmacro.h b/FreeRTOS/Source/portable/IAR/MSP430/portmacro.h index 86174be24..421e6fc13 100644 --- a/FreeRTOS/Source/portable/IAR/MSP430/portmacro.h +++ b/FreeRTOS/Source/portable/IAR/MSP430/portmacro.h @@ -1,5 +1,5 @@ /* - FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. + FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. All rights reserved VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. @@ -82,18 +82,23 @@ #define portDOUBLE double #define portLONG long #define portSHORT int -#define portSTACK_TYPE unsigned portSHORT -#define portBASE_TYPE portSHORT +#define portSTACK_TYPE uint16_t +#define portBASE_TYPE short + +typedef portSTACK_TYPE StackType_t; +typedef short BaseType_t; +typedef unsigned short UBaseType_t; + #if( configUSE_16_BIT_TICKS == 1 ) - typedef unsigned portSHORT portTickType; - #define portMAX_DELAY ( portTickType ) 0xffff + typedef uint16_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffff #else - typedef unsigned portLONG portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffffUL + typedef uint32_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffffffffUL #endif -/*-----------------------------------------------------------*/ +/*-----------------------------------------------------------*/ /* Interrupt control macros. */ #define portDISABLE_INTERRUPTS() _DINT(); _NOP() @@ -101,11 +106,11 @@ /*-----------------------------------------------------------*/ /* Critical section control macros. */ -#define portNO_CRITICAL_SECTION_NESTING ( ( unsigned portSHORT ) 0 ) +#define portNO_CRITICAL_SECTION_NESTING ( ( uint16_t ) 0 ) #define portENTER_CRITICAL() \ { \ -extern volatile unsigned portSHORT usCriticalNesting; \ +extern volatile uint16_t usCriticalNesting; \ \ portDISABLE_INTERRUPTS(); \ \ @@ -117,7 +122,7 @@ extern volatile unsigned portSHORT usCriticalNesting; \ #define portEXIT_CRITICAL() \ { \ -extern volatile unsigned portSHORT usCriticalNesting; \ +extern volatile uint16_t usCriticalNesting; \ \ if( usCriticalNesting > portNO_CRITICAL_SECTION_NESTING ) \ { \ @@ -146,8 +151,8 @@ extern void vPortYield( void ); /* Hardware specifics. */ #define portBYTE_ALIGNMENT 2 #define portSTACK_GROWTH ( -1 ) -#define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ ) -#define portNOP() +#define portTICK_RATE_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ ) +#define portNOP() /*-----------------------------------------------------------*/ /* Task function macros as described on the FreeRTOS.org WEB site. */ diff --git a/FreeRTOS/Source/portable/IAR/MSP430X/port.c b/FreeRTOS/Source/portable/IAR/MSP430X/port.c index c79978559..f3b870826 100644 --- a/FreeRTOS/Source/portable/IAR/MSP430X/port.c +++ b/FreeRTOS/Source/portable/IAR/MSP430X/port.c @@ -73,14 +73,14 @@ /* Constants required for hardware setup. The tick ISR runs off the ACLK, not the MCLK. */ -#define portACLK_FREQUENCY_HZ ( ( portTickType ) 32768 ) -#define portINITIAL_CRITICAL_NESTING ( ( unsigned short ) 10 ) -#define portFLAGS_INT_ENABLED ( ( portSTACK_TYPE ) 0x08 ) +#define portACLK_FREQUENCY_HZ ( ( TickType_t ) 32768 ) +#define portINITIAL_CRITICAL_NESTING ( ( uint16_t ) 10 ) +#define portFLAGS_INT_ENABLED ( ( StackType_t ) 0x08 ) /* We require the address of the pxCurrentTCB variable, but don't want to know any details of its type. */ -typedef void tskTCB; -extern volatile tskTCB * volatile pxCurrentTCB; +typedef void TCB_t; +extern volatile TCB_t * volatile pxCurrentTCB; /* Each task maintains a count of the critical section nesting depth. Each time a critical section is entered the count is incremented. Each time a @@ -90,7 +90,7 @@ being re-enabled if the count is zero. usCriticalNesting will get set to zero when the scheduler starts, but must not be initialised to zero as this will cause problems during the startup sequence. */ -volatile unsigned short usCriticalNesting = portINITIAL_CRITICAL_NESTING; +volatile uint16_t usCriticalNesting = portINITIAL_CRITICAL_NESTING; /*-----------------------------------------------------------*/ @@ -107,76 +107,76 @@ void vPortSetupTimerInterrupt( void ); * * See the header file portable.h. */ -portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) +StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) { -unsigned short *pusTopOfStack; -unsigned long *pulTopOfStack; +uint16_t *pusTopOfStack; +uint32_t *pulTopOfStack; /* Place a few bytes of known values on the bottom of the stack. This is just useful for debugging and can be included if required. - *pxTopOfStack = ( portSTACK_TYPE ) 0x1111; + *pxTopOfStack = ( StackType_t ) 0x1111; pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x2222; + *pxTopOfStack = ( StackType_t ) 0x2222; pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x3333; + *pxTopOfStack = ( StackType_t ) 0x3333; */ - /* portSTACK_TYPE is either 16 bits or 32 bits depending on the data model. + /* StackType_t is either 16 bits or 32 bits depending on the data model. Some stacked items do not change size depending on the data model so have to be explicitly cast to the correct size so this function will work whichever data model is being used. */ - if( sizeof( portSTACK_TYPE ) == sizeof( unsigned short ) ) + if( sizeof( StackType_t ) == sizeof( uint16_t ) ) { /* Make room for a 20 bit value stored as a 32 bit value. */ - pusTopOfStack = ( unsigned short * ) pxTopOfStack; + pusTopOfStack = ( uint16_t * ) pxTopOfStack; pusTopOfStack--; - pulTopOfStack = ( unsigned long * ) pusTopOfStack; + pulTopOfStack = ( uint32_t * ) pusTopOfStack; } else { - pulTopOfStack = ( unsigned long * ) pxTopOfStack; + pulTopOfStack = ( uint32_t * ) pxTopOfStack; } - *pulTopOfStack = ( unsigned long ) pxCode; + *pulTopOfStack = ( uint32_t ) pxCode; - pusTopOfStack = ( unsigned short * ) pulTopOfStack; + pusTopOfStack = ( uint16_t * ) pulTopOfStack; pusTopOfStack--; *pusTopOfStack = portFLAGS_INT_ENABLED; - pusTopOfStack -= ( sizeof( portSTACK_TYPE ) / 2 ); + pusTopOfStack -= ( sizeof( StackType_t ) / 2 ); /* From here on the size of stacked items depends on the memory model. */ - pxTopOfStack = ( portSTACK_TYPE * ) pusTopOfStack; + pxTopOfStack = ( StackType_t * ) pusTopOfStack; /* Next the general purpose registers. */ #ifdef PRELOAD_REGISTER_VALUES - *pxTopOfStack = ( portSTACK_TYPE ) 0xffff; + *pxTopOfStack = ( StackType_t ) 0xffff; pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0xeeee; + *pxTopOfStack = ( StackType_t ) 0xeeee; pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0xdddd; + *pxTopOfStack = ( StackType_t ) 0xdddd; pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) pvParameters; + *pxTopOfStack = ( StackType_t ) pvParameters; pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0xbbbb; + *pxTopOfStack = ( StackType_t ) 0xbbbb; pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0xaaaa; + *pxTopOfStack = ( StackType_t ) 0xaaaa; pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x9999; + *pxTopOfStack = ( StackType_t ) 0x9999; pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x8888; + *pxTopOfStack = ( StackType_t ) 0x8888; pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x5555; + *pxTopOfStack = ( StackType_t ) 0x5555; pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x6666; + *pxTopOfStack = ( StackType_t ) 0x6666; pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x5555; + *pxTopOfStack = ( StackType_t ) 0x5555; pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x4444; + *pxTopOfStack = ( StackType_t ) 0x4444; pxTopOfStack--; #else pxTopOfStack -= 3; - *pxTopOfStack = ( portSTACK_TYPE ) pvParameters; + *pxTopOfStack = ( StackType_t ) pvParameters; pxTopOfStack -= 9; #endif @@ -184,7 +184,7 @@ unsigned long *pulTopOfStack; /* A variable is used to keep track of the critical section nesting. This variable has to be stored as part of the task context and is initially set to zero. */ - *pxTopOfStack = ( portSTACK_TYPE ) portNO_CRITICAL_SECTION_NESTING; + *pxTopOfStack = ( StackType_t ) portNO_CRITICAL_SECTION_NESTING; /* Return a pointer to the top of the stack we have generated so this can be stored in the task control block for the task. */ diff --git a/FreeRTOS/Source/portable/IAR/MSP430X/portmacro.h b/FreeRTOS/Source/portable/IAR/MSP430X/portmacro.h index 68a75eadb..abf5399c0 100644 --- a/FreeRTOS/Source/portable/IAR/MSP430X/portmacro.h +++ b/FreeRTOS/Source/portable/IAR/MSP430X/portmacro.h @@ -1,5 +1,5 @@ /* - FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. + FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. All rights reserved VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. @@ -85,24 +85,28 @@ #define portDOUBLE double #define portLONG long #define portSHORT int -#define portBASE_TYPE portSHORT +#define portBASE_TYPE short /* The stack type changes depending on the data model. */ #if( __DATA_MODEL__ == __DATA_MODEL_SMALL__ ) - #define portSTACK_TYPE unsigned short + #define portSTACK_TYPE uint16_t #else - #define portSTACK_TYPE unsigned long + #define portSTACK_TYPE uint32_t #endif +typedef portSTACK_TYPE StackType_t; +typedef short BaseType_t; +typedef unsigned short UBaseType_t; + #if( configUSE_16_BIT_TICKS == 1 ) - typedef unsigned portSHORT portTickType; - #define portMAX_DELAY ( portTickType ) 0xffff + typedef uint16_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffff #else - typedef unsigned portLONG portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffffUL + typedef uint32_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffffffffUL #endif -/*-----------------------------------------------------------*/ +/*-----------------------------------------------------------*/ /* Interrupt control macros. */ #define portDISABLE_INTERRUPTS() _DINT();_NOP() @@ -110,11 +114,11 @@ /*-----------------------------------------------------------*/ /* Critical section control macros. */ -#define portNO_CRITICAL_SECTION_NESTING ( ( unsigned portSHORT ) 0 ) +#define portNO_CRITICAL_SECTION_NESTING ( ( uint16_t ) 0 ) #define portENTER_CRITICAL() \ { \ -extern volatile unsigned short usCriticalNesting; \ +extern volatile uint16_t usCriticalNesting; \ \ portDISABLE_INTERRUPTS(); \ \ @@ -126,7 +130,7 @@ extern volatile unsigned short usCriticalNesting; \ #define portEXIT_CRITICAL() \ { \ -extern volatile unsigned short usCriticalNesting; \ +extern volatile uint16_t usCriticalNesting; \ \ if( usCriticalNesting > portNO_CRITICAL_SECTION_NESTING ) \ { \ @@ -155,7 +159,7 @@ extern void vPortYield( void ); /* Hardware specifics. */ #define portBYTE_ALIGNMENT 2 #define portSTACK_GROWTH ( -1 ) -#define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ ) +#define portTICK_RATE_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ ) #define portNOP() __no_operation() /*-----------------------------------------------------------*/ @@ -165,7 +169,7 @@ extern void vPortYield( void ); extern void vTaskSwitchContext( void ); #define portYIELD_FROM_ISR( x ) if( x ) vPortYield() - + void vApplicationSetupTimerInterrupt( void ); /* sizeof( int ) != sizeof( long ) so a full printf() library is required if diff --git a/FreeRTOS/Source/portable/IAR/RL78/port.c b/FreeRTOS/Source/portable/IAR/RL78/port.c index 03c45e8eb..e31f1b57a 100644 --- a/FreeRTOS/Source/portable/IAR/RL78/port.c +++ b/FreeRTOS/Source/portable/IAR/RL78/port.c @@ -69,7 +69,7 @@ /* The critical nesting value is initialised to a non zero value to ensure interrupts don't accidentally become enabled before the scheduler is started. */ -#define portINITIAL_CRITICAL_NESTING ( ( unsigned short ) 10 ) +#define portINITIAL_CRITICAL_NESTING ( ( uint16_t ) 10 ) /* Initial PSW value allocated to a newly created task. * 1100011000000000 @@ -86,8 +86,8 @@ interrupts don't accidentally become enabled before the scheduler is started. */ /* The address of the pxCurrentTCB variable, but don't know or need to know its type. */ -typedef void tskTCB; -extern volatile tskTCB * volatile pxCurrentTCB; +typedef void TCB_t; +extern volatile TCB_t * volatile pxCurrentTCB; /* Each task maintains a count of the critical section nesting depth. Each time a critical section is entered the count is incremented. Each time a critical @@ -97,7 +97,7 @@ re-enabled if the count is zero. usCriticalNesting will get set to zero when the scheduler starts, but must not be initialised to zero as that could cause problems during the startup sequence. */ -volatile unsigned short usCriticalNesting = portINITIAL_CRITICAL_NESTING; +volatile uint16_t usCriticalNesting = portINITIAL_CRITICAL_NESTING; /*-----------------------------------------------------------*/ @@ -128,9 +128,9 @@ extern void vPortStartFirstTask( void ); * * See the header file portable.h. */ -portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) +StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) { -unsigned long *pulLocal; +uint32_t *pulLocal; #if __DATA_MODEL__ == __DATA_MODEL_FAR__ { @@ -139,15 +139,15 @@ unsigned long *pulLocal; pxTopOfStack--; /* Write in the parameter value. */ - pulLocal = ( unsigned long * ) pxTopOfStack; - *pulLocal = ( unsigned long ) pvParameters; + pulLocal = ( uint32_t * ) pxTopOfStack; + *pulLocal = ( uint32_t ) pvParameters; pxTopOfStack--; /* These values are just spacers. The return address of the function would normally be written here. */ - *pxTopOfStack = ( portSTACK_TYPE ) 0xcdcd; + *pxTopOfStack = ( StackType_t ) 0xcdcd; pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0xcdcd; + *pxTopOfStack = ( StackType_t ) 0xcdcd; pxTopOfStack--; /* The start address / PSW value is also written in as a 32bit value, @@ -155,12 +155,12 @@ unsigned long *pulLocal; pxTopOfStack--; /* Task function start address combined with the PSW. */ - pulLocal = ( unsigned long * ) pxTopOfStack; - *pulLocal = ( ( ( unsigned long ) pxCode ) | ( portPSW << 24UL ) ); + pulLocal = ( uint32_t * ) pxTopOfStack; + *pulLocal = ( ( ( uint32_t ) pxCode ) | ( portPSW << 24UL ) ); pxTopOfStack--; /* An initial value for the AX register. */ - *pxTopOfStack = ( portSTACK_TYPE ) 0x1111; + *pxTopOfStack = ( StackType_t ) 0x1111; pxTopOfStack--; } #else @@ -171,33 +171,33 @@ unsigned long *pulLocal; pxTopOfStack--; /* Task function start address combined with the PSW. */ - pulLocal = ( unsigned long * ) pxTopOfStack; - *pulLocal = ( ( ( unsigned long ) pxCode ) | ( portPSW << 24UL ) ); + pulLocal = ( uint32_t * ) pxTopOfStack; + *pulLocal = ( ( ( uint32_t ) pxCode ) | ( portPSW << 24UL ) ); pxTopOfStack--; /* The parameter is passed in AX. */ - *pxTopOfStack = ( portSTACK_TYPE ) pvParameters; + *pxTopOfStack = ( StackType_t ) pvParameters; pxTopOfStack--; } #endif /* An initial value for the HL register. */ - *pxTopOfStack = ( portSTACK_TYPE ) 0x2222; + *pxTopOfStack = ( StackType_t ) 0x2222; pxTopOfStack--; /* CS and ES registers. */ - *pxTopOfStack = ( portSTACK_TYPE ) 0x0F00; + *pxTopOfStack = ( StackType_t ) 0x0F00; pxTopOfStack--; /* The remaining general purpose registers DE and BC */ - *pxTopOfStack = ( portSTACK_TYPE ) 0xDEDE; + *pxTopOfStack = ( StackType_t ) 0xDEDE; pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0xBCBC; + *pxTopOfStack = ( StackType_t ) 0xBCBC; pxTopOfStack--; /* Finally the critical section nesting count is set to zero when the task first starts. */ - *pxTopOfStack = ( portSTACK_TYPE ) portNO_CRITICAL_SECTION_NESTING; + *pxTopOfStack = ( StackType_t ) portNO_CRITICAL_SECTION_NESTING; /* Return a pointer to the top of the stack that has been generated so it can be stored in the task control block for the task. */ @@ -205,7 +205,7 @@ unsigned long *pulLocal; } /*-----------------------------------------------------------*/ -portBASE_TYPE xPortStartScheduler( void ) +BaseType_t xPortStartScheduler( void ) { /* Setup the hardware to generate the tick. Interrupts are disabled when this function is called. */ @@ -233,53 +233,53 @@ void vPortEndScheduler( void ) static void prvSetupTimerInterrupt( void ) { -const unsigned short usClockHz = 15000UL; /* Internal clock. */ -const unsigned short usCompareMatch = ( usClockHz / configTICK_RATE_HZ ) + 1UL; +const uint16_t usClockHz = 15000UL; /* Internal clock. */ +const uint16_t usCompareMatch = ( usClockHz / configTICK_RATE_HZ ) + 1UL; /* Use the internal 15K clock. */ - OSMC = ( unsigned char ) 0x16; + OSMC = ( uint8_t ) 0x16; #ifdef RTCEN { /* Supply the interval timer clock. */ - RTCEN = ( unsigned char ) 1U; + RTCEN = ( uint8_t ) 1U; /* Disable INTIT interrupt. */ - ITMK = ( unsigned char ) 1; + ITMK = ( uint8_t ) 1; /* Disable ITMC operation. */ - ITMC = ( unsigned char ) 0x0000; + ITMC = ( uint8_t ) 0x0000; /* Clear INIT interrupt. */ - ITIF = ( unsigned char ) 0; + ITIF = ( uint8_t ) 0; /* Set interval and enable interrupt operation. */ ITMC = usCompareMatch | 0x8000U; /* Enable INTIT interrupt. */ - ITMK = ( unsigned char ) 0; + ITMK = ( uint8_t ) 0; } #endif #ifdef TMKAEN { /* Supply the interval timer clock. */ - TMKAEN = ( unsigned char ) 1U; + TMKAEN = ( uint8_t ) 1U; /* Disable INTIT interrupt. */ - TMKAMK = ( unsigned char ) 1; + TMKAMK = ( uint8_t ) 1; /* Disable ITMC operation. */ - ITMC = ( unsigned char ) 0x0000; + ITMC = ( uint8_t ) 0x0000; /* Clear INIT interrupt. */ - TMKAIF = ( unsigned char ) 0; + TMKAIF = ( uint8_t ) 0; /* Set interval and enable interrupt operation. */ ITMC = usCompareMatch | 0x8000U; /* Enable INTIT interrupt. */ - TMKAMK = ( unsigned char ) 0; + TMKAMK = ( uint8_t ) 0; } #endif } diff --git a/FreeRTOS/Source/portable/IAR/RL78/portmacro.h b/FreeRTOS/Source/portable/IAR/RL78/portmacro.h index a02c896c2..f0925b85c 100644 --- a/FreeRTOS/Source/portable/IAR/RL78/portmacro.h +++ b/FreeRTOS/Source/portable/IAR/RL78/portmacro.h @@ -1,5 +1,5 @@ /* - FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. + FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. All rights reserved VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. @@ -95,22 +95,27 @@ extern "C" { #define portDOUBLE double #define portLONG long #define portSHORT short -#define portSTACK_TYPE unsigned short +#define portSTACK_TYPE uint16_t #define portBASE_TYPE short +typedef portSTACK_TYPE StackType_t; +typedef short BaseType_t; +typedef unsigned short UBaseType_t; + + #if __DATA_MODEL__ == __DATA_MODEL_FAR__ - #define portPOINTER_SIZE_TYPE unsigned long + #define portPOINTER_SIZE_TYPE uint32_t #else - #define portPOINTER_SIZE_TYPE unsigned short + #define portPOINTER_SIZE_TYPE uint16_t #endif #if ( configUSE_16_BIT_TICKS == 1 ) - typedef unsigned int portTickType; - #define portMAX_DELAY ( portTickType ) 0xffff + typedef unsigned int TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffff #else - typedef unsigned long portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffffUL + typedef uint32_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffffffffUL #endif /*-----------------------------------------------------------*/ @@ -120,11 +125,11 @@ extern "C" { /*-----------------------------------------------------------*/ /* Critical section control macros. */ -#define portNO_CRITICAL_SECTION_NESTING ( ( unsigned portSHORT ) 0 ) +#define portNO_CRITICAL_SECTION_NESTING ( ( uint16_t ) 0 ) #define portENTER_CRITICAL() \ { \ -extern volatile unsigned short usCriticalNesting; \ +extern volatile uint16_t usCriticalNesting; \ \ portDISABLE_INTERRUPTS(); \ \ @@ -136,7 +141,7 @@ extern volatile unsigned short usCriticalNesting; \ #define portEXIT_CRITICAL() \ { \ -extern volatile unsigned short usCriticalNesting; \ +extern volatile uint16_t usCriticalNesting; \ \ if( usCriticalNesting > portNO_CRITICAL_SECTION_NESTING ) \ { \ @@ -162,7 +167,7 @@ extern volatile unsigned short usCriticalNesting; \ /* Hardwware specifics. */ #define portBYTE_ALIGNMENT 2 #define portSTACK_GROWTH ( -1 ) -#define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ ) +#define portTICK_RATE_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ ) /*-----------------------------------------------------------*/ /* Task function macros as described on the FreeRTOS.org WEB site. */ diff --git a/FreeRTOS/Source/portable/IAR/RX100/port.c b/FreeRTOS/Source/portable/IAR/RX100/port.c index a2e49bd3c..40895072d 100644 --- a/FreeRTOS/Source/portable/IAR/RX100/port.c +++ b/FreeRTOS/Source/portable/IAR/RX100/port.c @@ -84,7 +84,7 @@ /* Tasks should start with interrupts enabled and in Supervisor mode, therefore PSW is set with U and I set, and PM and IPL clear. */ -#define portINITIAL_PSW ( ( portSTACK_TYPE ) 0x00030000 ) +#define portINITIAL_PSW ( ( StackType_t ) 0x00030000 ) /* The peripheral clock is divided by this value before being supplying the CMT. */ @@ -140,7 +140,7 @@ static void prvSetupTimerInterrupt( void ); * instruction. */ #if configUSE_TICKLESS_IDLE == 1 - static void prvSleep( portTickType xExpectedIdleTime ); + static void prvSleep( TickType_t xExpectedIdleTime ); #endif /* configUSE_TICKLESS_IDLE */ /*-----------------------------------------------------------*/ @@ -150,7 +150,7 @@ extern void *pxCurrentTCB; /*-----------------------------------------------------------*/ /* Calculate how many clock increments make up a single tick period. */ -static const unsigned long ulMatchValueForOneTick = ( ( configPERIPHERAL_CLOCK_HZ / portCLOCK_DIVISOR ) / configTICK_RATE_HZ ); +static const uint32_t ulMatchValueForOneTick = ( ( configPERIPHERAL_CLOCK_HZ / portCLOCK_DIVISOR ) / configTICK_RATE_HZ ); #if configUSE_TICKLESS_IDLE == 1 @@ -158,7 +158,7 @@ static const unsigned long ulMatchValueForOneTick = ( ( configPERIPHERAL_CLOCK_H basically how far into the future an interrupt can be generated. Set during initialisation. This is the maximum possible value that the compare match register can hold divided by ulMatchValueForOneTick. */ - static const portTickType xMaximumPossibleSuppressedTicks = USHRT_MAX / ( ( configPERIPHERAL_CLOCK_HZ / portCLOCK_DIVISOR ) / configTICK_RATE_HZ ); + static const TickType_t xMaximumPossibleSuppressedTicks = USHRT_MAX / ( ( configPERIPHERAL_CLOCK_HZ / portCLOCK_DIVISOR ) / configTICK_RATE_HZ ); /* Flag set from the tick interrupt to allow the sleep processing to know if sleep mode was exited because of a tick interrupt, or an interrupt @@ -171,7 +171,7 @@ static const unsigned long ulMatchValueForOneTick = ( ( configPERIPHERAL_CLOCK_H compensate for the lost time. The large difference between the divided CMT clock and the CPU clock means it is likely ulStoppedTimerCompensation will equal zero - and be optimised away. */ - static const unsigned long ulStoppedTimerCompensation = 100UL / ( configCPU_CLOCK_HZ / ( configPERIPHERAL_CLOCK_HZ / portCLOCK_DIVISOR ) ); + static const uint32_t ulStoppedTimerCompensation = 100UL / ( configCPU_CLOCK_HZ / ( configPERIPHERAL_CLOCK_HZ / portCLOCK_DIVISOR ) ); #endif @@ -180,7 +180,7 @@ static const unsigned long ulMatchValueForOneTick = ( ( configPERIPHERAL_CLOCK_H /* * See header file for description. */ -portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) +StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) { /* Offset to end up on 8 byte boundary. */ pxTopOfStack--; @@ -192,7 +192,7 @@ portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxTopOfStack--; *pxTopOfStack = portINITIAL_PSW; pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) pxCode; + *pxTopOfStack = ( StackType_t ) pxCode; /* When debugging it can be useful if every register is set to a known value. Otherwise code space can be saved by just setting the registers @@ -237,7 +237,7 @@ portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE } #endif - *pxTopOfStack = ( portSTACK_TYPE ) pvParameters; /* R1 */ + *pxTopOfStack = ( StackType_t ) pvParameters; /* R1 */ pxTopOfStack--; *pxTopOfStack = 0x12345678; /* Accumulator. */ pxTopOfStack--; @@ -247,7 +247,7 @@ portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE } /*-----------------------------------------------------------*/ -portBASE_TYPE xPortStartScheduler( void ) +BaseType_t xPortStartScheduler( void ) { /* Use pxCurrentTCB just so it does not get optimised away. */ if( pxCurrentTCB != NULL ) @@ -309,7 +309,7 @@ __interrupt static void prvTickISR( void ) /* If this is the first tick since exiting tickless mode then the CMT compare match value needs resetting. */ - CMT0.CMCOR = ( unsigned short ) ulMatchValueForOneTick; + CMT0.CMCOR = ( uint16_t ) ulMatchValueForOneTick; } #endif } @@ -338,7 +338,7 @@ static void prvSetupTimerInterrupt( void ) CMT0.CMCR.BIT.CMIE = 1; /* Set the compare match value. */ - CMT0.CMCOR = ( unsigned short ) ulMatchValueForOneTick; + CMT0.CMCOR = ( uint16_t ) ulMatchValueForOneTick; /* Divide the PCLK. */ #if portCLOCK_DIVISOR == 512 @@ -377,7 +377,7 @@ static void prvSetupTimerInterrupt( void ) #if configUSE_TICKLESS_IDLE == 1 - static void prvSleep( portTickType xExpectedIdleTime ) + static void prvSleep( TickType_t xExpectedIdleTime ) { /* Allow the application to define some pre-sleep processing. */ configPRE_SLEEP_PROCESSING( xExpectedIdleTime ); @@ -399,9 +399,9 @@ static void prvSetupTimerInterrupt( void ) #if configUSE_TICKLESS_IDLE == 1 - void vPortSuppressTicksAndSleep( portTickType xExpectedIdleTime ) + void vPortSuppressTicksAndSleep( TickType_t xExpectedIdleTime ) { - unsigned long ulMatchValue, ulCompleteTickPeriods, ulCurrentCount; + uint32_t ulMatchValue, ulCompleteTickPeriods, ulCurrentCount; eSleepModeStatus eSleepAction; /* THIS FUNCTION IS CALLED WITH THE SCHEDULER SUSPENDED. */ @@ -484,8 +484,8 @@ static void prvSetupTimerInterrupt( void ) /* Adjust the match value to take into account that the current time slice is already partially complete. */ - ulMatchValue -= ( unsigned long ) CMT0.CMCNT; - CMT0.CMCOR = ( unsigned short ) ulMatchValue; + ulMatchValue -= ( uint32_t ) CMT0.CMCNT; + CMT0.CMCOR = ( uint16_t ) ulMatchValue; /* Restart the CMT to count up to the new match value. */ CMT0.CMCNT = 0; @@ -505,7 +505,7 @@ static void prvSetupTimerInterrupt( void ) /* Nothing to do here. */ } - ulCurrentCount = ( unsigned long ) CMT0.CMCNT; + ulCurrentCount = ( uint32_t ) CMT0.CMCNT; if( ulTickFlag != pdFALSE ) { @@ -515,7 +515,7 @@ static void prvSetupTimerInterrupt( void ) exited. Reset the match value with whatever remains of this tick period. */ ulMatchValue = ulMatchValueForOneTick - ulCurrentCount; - CMT0.CMCOR = ( unsigned short ) ulMatchValue; + CMT0.CMCOR = ( uint16_t ) ulMatchValue; /* The tick interrupt handler will already have pended the tick processing in the kernel. As the pending tick will be @@ -535,7 +535,7 @@ static void prvSetupTimerInterrupt( void ) /* The match value is set to whatever fraction of a single tick period remains. */ ulMatchValue = ulCurrentCount - ( ulCompleteTickPeriods * ulMatchValueForOneTick ); - CMT0.CMCOR = ( unsigned short ) ulMatchValue; + CMT0.CMCOR = ( uint16_t ) ulMatchValue; } /* Restart the CMT so it runs up to the match value. The match value diff --git a/FreeRTOS/Source/portable/IAR/RX100/portmacro.h b/FreeRTOS/Source/portable/IAR/RX100/portmacro.h index e21653038..5b63c6adf 100644 --- a/FreeRTOS/Source/portable/IAR/RX100/portmacro.h +++ b/FreeRTOS/Source/portable/IAR/RX100/portmacro.h @@ -1,5 +1,5 @@ /* - FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. + FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. All rights reserved VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. @@ -93,22 +93,27 @@ portSTACK_TYPE and portBASE_TYPE. */ #define portDOUBLE double #define portLONG long #define portSHORT short -#define portSTACK_TYPE unsigned portLONG +#define portSTACK_TYPE uint32_t #define portBASE_TYPE long +typedef portSTACK_TYPE StackType_t; +typedef long BaseType_t; +typedef unsigned long UBaseType_t; + + #if( configUSE_16_BIT_TICKS == 1 ) - typedef unsigned portSHORT portTickType; - #define portMAX_DELAY ( portTickType ) 0xffff + typedef uint16_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffff #else - typedef unsigned portLONG portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffffUL + typedef uint32_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffffffffUL #endif /*-----------------------------------------------------------*/ /* Hardware specifics. */ #define portBYTE_ALIGNMENT 8 /* Could make four, according to manual. */ #define portSTACK_GROWTH -1 -#define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ ) +#define portTICK_RATE_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ ) #define portNOP() __no_operation() #define portYIELD() \ @@ -131,12 +136,12 @@ when an ISR safe FreeRTOS API function was executed. ISR safe FreeRTOS API functions are those that end in FromISR. FreeRTOS maintains a separate interrupt API to ensure API function and interrupt entry is as fast and as simple as possible. */ -#define portENABLE_INTERRUPTS() __set_interrupt_level( ( unsigned char ) 0 ) +#define portENABLE_INTERRUPTS() __set_interrupt_level( ( uint8_t ) 0 ) #ifdef configASSERT #define portASSERT_IF_INTERRUPT_PRIORITY_INVALID() configASSERT( ( __get_interrupt_level() <= configMAX_SYSCALL_INTERRUPT_PRIORITY ) ) - #define portDISABLE_INTERRUPTS() if( __get_interrupt_level() < configMAX_SYSCALL_INTERRUPT_PRIORITY ) __set_interrupt_level( ( unsigned char ) configMAX_SYSCALL_INTERRUPT_PRIORITY ) + #define portDISABLE_INTERRUPTS() if( __get_interrupt_level() < configMAX_SYSCALL_INTERRUPT_PRIORITY ) __set_interrupt_level( ( uint8_t ) configMAX_SYSCALL_INTERRUPT_PRIORITY ) #else - #define portDISABLE_INTERRUPTS() __set_interrupt_level( ( unsigned char ) configMAX_SYSCALL_INTERRUPT_PRIORITY ) + #define portDISABLE_INTERRUPTS() __set_interrupt_level( ( uint8_t ) configMAX_SYSCALL_INTERRUPT_PRIORITY ) #endif /* Critical nesting counts are stored in the TCB. */ @@ -150,12 +155,12 @@ extern void vTaskExitCritical( void ); /* As this port allows interrupt nesting... */ #define portSET_INTERRUPT_MASK_FROM_ISR() __get_interrupt_level(); portDISABLE_INTERRUPTS() -#define portCLEAR_INTERRUPT_MASK_FROM_ISR( uxSavedInterruptStatus ) __set_interrupt_level( ( unsigned char ) ( uxSavedInterruptStatus ) ) +#define portCLEAR_INTERRUPT_MASK_FROM_ISR( uxSavedInterruptStatus ) __set_interrupt_level( ( uint8_t ) ( uxSavedInterruptStatus ) ) /* Tickless idle/low power functionality. */ #if configUSE_TICKLESS_IDLE == 1 #ifndef portSUPPRESS_TICKS_AND_SLEEP - extern void vPortSuppressTicksAndSleep( portTickType xExpectedIdleTime ); + extern void vPortSuppressTicksAndSleep( TickType_t xExpectedIdleTime ); #define portSUPPRESS_TICKS_AND_SLEEP( xExpectedIdleTime ) vPortSuppressTicksAndSleep( xExpectedIdleTime ) #endif #endif diff --git a/FreeRTOS/Source/portable/IAR/RX600/port.c b/FreeRTOS/Source/portable/IAR/RX600/port.c index 53fa6104c..444716ec3 100644 --- a/FreeRTOS/Source/portable/IAR/RX600/port.c +++ b/FreeRTOS/Source/portable/IAR/RX600/port.c @@ -81,8 +81,8 @@ /* Tasks should start with interrupts enabled and in Supervisor mode, therefore PSW is set with U and I set, and PM and IPL clear. */ -#define portINITIAL_PSW ( ( portSTACK_TYPE ) 0x00030000 ) -#define portINITIAL_FPSW ( ( portSTACK_TYPE ) 0x00000100 ) +#define portINITIAL_PSW ( ( StackType_t ) 0x00030000 ) +#define portINITIAL_FPSW ( ( StackType_t ) 0x00000100 ) /*-----------------------------------------------------------*/ @@ -107,7 +107,7 @@ extern void *pxCurrentTCB; /* * See header file for description. */ -portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) +StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) { /* R0 is not included as it is the stack pointer. */ @@ -115,7 +115,7 @@ portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxTopOfStack--; *pxTopOfStack = portINITIAL_PSW; pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) pxCode; + *pxTopOfStack = ( StackType_t ) pxCode; /* When debugging it can be useful if every register is set to a known value. Otherwise code space can be saved by just setting the registers @@ -158,7 +158,7 @@ portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE } #endif - *pxTopOfStack = ( portSTACK_TYPE ) pvParameters; /* R1 */ + *pxTopOfStack = ( StackType_t ) pvParameters; /* R1 */ pxTopOfStack--; *pxTopOfStack = portINITIAL_FPSW; pxTopOfStack--; @@ -170,7 +170,7 @@ portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE } /*-----------------------------------------------------------*/ -portBASE_TYPE xPortStartScheduler( void ) +BaseType_t xPortStartScheduler( void ) { extern void vApplicationSetupTimerInterrupt( void ); diff --git a/FreeRTOS/Source/portable/IAR/RX600/portmacro.h b/FreeRTOS/Source/portable/IAR/RX600/portmacro.h index 2fd450e3b..3501f6d32 100644 --- a/FreeRTOS/Source/portable/IAR/RX600/portmacro.h +++ b/FreeRTOS/Source/portable/IAR/RX600/portmacro.h @@ -1,5 +1,5 @@ /* - FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. + FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. All rights reserved VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. @@ -90,22 +90,27 @@ portSTACK_TYPE and portBASE_TYPE. */ #define portDOUBLE double #define portLONG long #define portSHORT short -#define portSTACK_TYPE unsigned portLONG +#define portSTACK_TYPE uint32_t #define portBASE_TYPE long +typedef portSTACK_TYPE StackType_t; +typedef long BaseType_t; +typedef unsigned long UBaseType_t; + + #if( configUSE_16_BIT_TICKS == 1 ) - typedef unsigned portSHORT portTickType; - #define portMAX_DELAY ( portTickType ) 0xffff + typedef uint16_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffff #else - typedef unsigned portLONG portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffffUL + typedef uint32_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffffffffUL #endif /*-----------------------------------------------------------*/ /* Hardware specifics. */ #define portBYTE_ALIGNMENT 8 /* Could make four, according to manual. */ #define portSTACK_GROWTH -1 -#define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ ) +#define portTICK_RATE_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ ) #define portNOP() __no_operation() /* Yield equivalent to "*portITU_SWINTR = 0x01; ( void ) *portITU_SWINTR;" @@ -124,21 +129,21 @@ save and restore clobbered registers manually. */ #define portYIELD_FROM_ISR( x ) if( ( x ) != pdFALSE ) portYIELD() -/* These macros should not be called directly, but through the -taskENTER_CRITICAL() and taskEXIT_CRITICAL() macros. An extra check is -performed if configASSERT() is defined to ensure an assertion handler does not -inadvertently attempt to lower the IPL when the call to assert was triggered -because the IPL value was found to be above configMAX_SYSCALL_INTERRUPT_PRIORITY -when an ISR safe FreeRTOS API function was executed. ISR safe FreeRTOS API -functions are those that end in FromISR. FreeRTOS maintains a separate -interrupt API to ensure API function and interrupt entry is as fast and as +/* These macros should not be called directly, but through the +taskENTER_CRITICAL() and taskEXIT_CRITICAL() macros. An extra check is +performed if configASSERT() is defined to ensure an assertion handler does not +inadvertently attempt to lower the IPL when the call to assert was triggered +because the IPL value was found to be above configMAX_SYSCALL_INTERRUPT_PRIORITY +when an ISR safe FreeRTOS API function was executed. ISR safe FreeRTOS API +functions are those that end in FromISR. FreeRTOS maintains a separate +interrupt API to ensure API function and interrupt entry is as fast and as simple as possible. */ -#define portENABLE_INTERRUPTS() __set_interrupt_level( ( unsigned char ) 0 ) +#define portENABLE_INTERRUPTS() __set_interrupt_level( ( uint8_t ) 0 ) #ifdef configASSERT #define portASSERT_IF_INTERRUPT_PRIORITY_INVALID() configASSERT( ( __get_interrupt_level() <= configMAX_SYSCALL_INTERRUPT_PRIORITY ) ) - #define portDISABLE_INTERRUPTS() if( __get_interrupt_level() < configMAX_SYSCALL_INTERRUPT_PRIORITY ) __set_interrupt_level( ( unsigned char ) configMAX_SYSCALL_INTERRUPT_PRIORITY ) + #define portDISABLE_INTERRUPTS() if( __get_interrupt_level() < configMAX_SYSCALL_INTERRUPT_PRIORITY ) __set_interrupt_level( ( uint8_t ) configMAX_SYSCALL_INTERRUPT_PRIORITY ) #else - #define portDISABLE_INTERRUPTS() __set_interrupt_level( ( unsigned char ) configMAX_SYSCALL_INTERRUPT_PRIORITY ) + #define portDISABLE_INTERRUPTS() __set_interrupt_level( ( uint8_t ) configMAX_SYSCALL_INTERRUPT_PRIORITY ) #endif /* Critical nesting counts are stored in the TCB. */ @@ -152,7 +157,7 @@ extern void vTaskExitCritical( void ); /* As this port allows interrupt nesting... */ #define portSET_INTERRUPT_MASK_FROM_ISR() __get_interrupt_level(); portDISABLE_INTERRUPTS() -#define portCLEAR_INTERRUPT_MASK_FROM_ISR( uxSavedInterruptStatus ) __set_interrupt_level( ( unsigned char ) ( uxSavedInterruptStatus ) ) +#define portCLEAR_INTERRUPT_MASK_FROM_ISR( uxSavedInterruptStatus ) __set_interrupt_level( ( uint8_t ) ( uxSavedInterruptStatus ) ) /*-----------------------------------------------------------*/ diff --git a/FreeRTOS/Source/portable/IAR/STR71x/port.c b/FreeRTOS/Source/portable/IAR/STR71x/port.c index 8f8bf047a..446d91611 100644 --- a/FreeRTOS/Source/portable/IAR/STR71x/port.c +++ b/FreeRTOS/Source/portable/IAR/STR71x/port.c @@ -80,12 +80,12 @@ #include "task.h" /* Constants required to setup the initial stack. */ -#define portINITIAL_SPSR ( ( portSTACK_TYPE ) 0x1f ) /* System mode, ARM mode, interrupts enabled. */ -#define portTHUMB_MODE_BIT ( ( portSTACK_TYPE ) 0x20 ) -#define portINSTRUCTION_SIZE ( ( portSTACK_TYPE ) 4 ) +#define portINITIAL_SPSR ( ( StackType_t ) 0x1f ) /* System mode, ARM mode, interrupts enabled. */ +#define portTHUMB_MODE_BIT ( ( StackType_t ) 0x20 ) +#define portINSTRUCTION_SIZE ( ( StackType_t ) 4 ) /* Constants required to handle critical sections. */ -#define portNO_CRITICAL_NESTING ( ( unsigned long ) 0 ) +#define portNO_CRITICAL_NESTING ( ( uint32_t ) 0 ) #define portMICROS_PER_SECOND 1000000 @@ -97,7 +97,7 @@ static void prvSetupTimerInterrupt( void ); /* ulCriticalNesting will get set to zero when the first task starts. It cannot be initialised to 0 as this will cause interrupts to be enabled during the kernel initialisation process. */ -unsigned long ulCriticalNesting = ( unsigned long ) 9999; +uint32_t ulCriticalNesting = ( uint32_t ) 9999; /* Tick interrupt routines for cooperative and preemptive operation respectively. The preemptive version is not defined as __irq as it is called @@ -113,9 +113,9 @@ void vPortPreemptiveTick( void ); * * See header file for description. */ -portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) +StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) { -portSTACK_TYPE *pxOriginalTOS; +StackType_t *pxOriginalTOS; pxOriginalTOS = pxTopOfStack; @@ -129,47 +129,47 @@ portSTACK_TYPE *pxOriginalTOS; /* First on the stack is the return address - which in this case is the start of the task. The offset is added to make the return address appear as it would within an IRQ ISR. */ - *pxTopOfStack = ( portSTACK_TYPE ) pxCode + portINSTRUCTION_SIZE; + *pxTopOfStack = ( StackType_t ) pxCode + portINSTRUCTION_SIZE; pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0xaaaaaaaa; /* R14 */ + *pxTopOfStack = ( StackType_t ) 0xaaaaaaaa; /* R14 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) pxOriginalTOS; /* Stack used when task starts goes in R13. */ + *pxTopOfStack = ( StackType_t ) pxOriginalTOS; /* Stack used when task starts goes in R13. */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x12121212; /* R12 */ + *pxTopOfStack = ( StackType_t ) 0x12121212; /* R12 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x11111111; /* R11 */ + *pxTopOfStack = ( StackType_t ) 0x11111111; /* R11 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x10101010; /* R10 */ + *pxTopOfStack = ( StackType_t ) 0x10101010; /* R10 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x09090909; /* R9 */ + *pxTopOfStack = ( StackType_t ) 0x09090909; /* R9 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x08080808; /* R8 */ + *pxTopOfStack = ( StackType_t ) 0x08080808; /* R8 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x07070707; /* R7 */ + *pxTopOfStack = ( StackType_t ) 0x07070707; /* R7 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x06060606; /* R6 */ + *pxTopOfStack = ( StackType_t ) 0x06060606; /* R6 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x05050505; /* R5 */ + *pxTopOfStack = ( StackType_t ) 0x05050505; /* R5 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x04040404; /* R4 */ + *pxTopOfStack = ( StackType_t ) 0x04040404; /* R4 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x03030303; /* R3 */ + *pxTopOfStack = ( StackType_t ) 0x03030303; /* R3 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x02020202; /* R2 */ + *pxTopOfStack = ( StackType_t ) 0x02020202; /* R2 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x01010101; /* R1 */ + *pxTopOfStack = ( StackType_t ) 0x01010101; /* R1 */ pxTopOfStack--; /* When the task starts is will expect to find the function parameter in R0. */ - *pxTopOfStack = ( portSTACK_TYPE ) pvParameters; /* R0 */ + *pxTopOfStack = ( StackType_t ) pvParameters; /* R0 */ pxTopOfStack--; /* The status register is set for system mode, with interrupts enabled. */ - *pxTopOfStack = ( portSTACK_TYPE ) portINITIAL_SPSR; + *pxTopOfStack = ( StackType_t ) portINITIAL_SPSR; - if( ( ( unsigned long ) pxCode & 0x01UL ) != 0x00UL ) + if( ( ( uint32_t ) pxCode & 0x01UL ) != 0x00UL ) { /* We want the task to start in thumb mode. */ *pxTopOfStack |= portTHUMB_MODE_BIT; @@ -186,7 +186,7 @@ portSTACK_TYPE *pxOriginalTOS; } /*-----------------------------------------------------------*/ -portBASE_TYPE xPortStartScheduler( void ) +BaseType_t xPortStartScheduler( void ) { extern void vPortStartFirstTask( void ); diff --git a/FreeRTOS/Source/portable/IAR/STR71x/portmacro.h b/FreeRTOS/Source/portable/IAR/STR71x/portmacro.h index 3ae75b7f3..08bc5c124 100644 --- a/FreeRTOS/Source/portable/IAR/STR71x/portmacro.h +++ b/FreeRTOS/Source/portable/IAR/STR71x/portmacro.h @@ -1,5 +1,5 @@ /* - FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. + FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. All rights reserved VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. @@ -90,25 +90,30 @@ extern "C" { #define portDOUBLE double #define portLONG long #define portSHORT short -#define portSTACK_TYPE unsigned portLONG -#define portBASE_TYPE portLONG +#define portSTACK_TYPE uint32_t +#define portBASE_TYPE long + +typedef portSTACK_TYPE StackType_t; +typedef long BaseType_t; +typedef unsigned long UBaseType_t; + #if( configUSE_16_BIT_TICKS == 1 ) - typedef unsigned portSHORT portTickType; - #define portMAX_DELAY ( portTickType ) 0xffff + typedef uint16_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffff #else - typedef unsigned portLONG portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffffUL + typedef uint32_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffffffffUL #endif -/*-----------------------------------------------------------*/ +/*-----------------------------------------------------------*/ /* Hardware specifics. */ #define portSTACK_GROWTH ( -1 ) -#define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ ) +#define portTICK_RATE_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ ) #define portBYTE_ALIGNMENT 8 #define portYIELD() asm ( "SWI 0" ) #define portNOP() asm ( "NOP" ) -/*-----------------------------------------------------------*/ +/*-----------------------------------------------------------*/ /* Critical section handling. */ __arm __interwork void vPortDisableInterruptsFromThumb( void ); @@ -120,7 +125,7 @@ __arm __interwork void vPortExitCritical( void ); #define portENABLE_INTERRUPTS() __enable_interrupt() #define portENTER_CRITICAL() vPortEnterCritical() #define portEXIT_CRITICAL() vPortExitCritical() -/*-----------------------------------------------------------*/ +/*-----------------------------------------------------------*/ /* Task utilities. */ #define portEND_SWITCHING_ISR( xSwitchRequired ) \ @@ -132,14 +137,14 @@ extern void vTaskSwitchContext( void ); \ vTaskSwitchContext(); \ } \ } -/*-----------------------------------------------------------*/ +/*-----------------------------------------------------------*/ /* EIC utilities. */ -#define portEIC_CICR_ADDR *( ( unsigned portLONG * ) 0xFFFFF804 ) -#define portEIC_IPR_ADDR *( ( unsigned portLONG * ) 0xFFFFF840 ) +#define portEIC_CICR_ADDR *( ( uint32_t * ) 0xFFFFF804 ) +#define portEIC_IPR_ADDR *( ( uint32_t * ) 0xFFFFF840 ) #define portCLEAR_EIC() portEIC_IPR_ADDR = 0x01 << portEIC_CICR_ADDR -/*-----------------------------------------------------------*/ +/*-----------------------------------------------------------*/ /* Task function macros as described on the FreeRTOS.org WEB site. */ #define portTASK_FUNCTION_PROTO( vFunction, pvParameters ) void vFunction( void * pvParameters ) diff --git a/FreeRTOS/Source/portable/IAR/STR75x/port.c b/FreeRTOS/Source/portable/IAR/STR75x/port.c index 0322412f0..2d7db2bb1 100644 --- a/FreeRTOS/Source/portable/IAR/STR75x/port.c +++ b/FreeRTOS/Source/portable/IAR/STR75x/port.c @@ -77,11 +77,11 @@ #include "task.h" /* Constants required to setup the initial stack. */ -#define portINITIAL_SPSR ( ( portSTACK_TYPE ) 0x3f ) /* System mode, THUMB mode, interrupts enabled. */ -#define portINSTRUCTION_SIZE ( ( portSTACK_TYPE ) 4 ) +#define portINITIAL_SPSR ( ( StackType_t ) 0x3f ) /* System mode, THUMB mode, interrupts enabled. */ +#define portINSTRUCTION_SIZE ( ( StackType_t ) 4 ) /* Constants required to handle critical sections. */ -#define portNO_CRITICAL_NESTING ( ( unsigned long ) 0 ) +#define portNO_CRITICAL_NESTING ( ( uint32_t ) 0 ) /* Prescale used on the timer clock when calculating the tick period. */ #define portPRESCALE 20 @@ -95,7 +95,7 @@ static void prvSetupTimerInterrupt( void ); /* ulCriticalNesting will get set to zero when the first task starts. It cannot be initialised to 0 as this will cause interrupts to be enabled during the kernel initialisation process. */ -unsigned long ulCriticalNesting = ( unsigned long ) 9999; +uint32_t ulCriticalNesting = ( uint32_t ) 9999; /* Tick interrupt routines for preemptive operation. */ __arm void vPortPreemptiveTick( void ); @@ -108,9 +108,9 @@ __arm void vPortPreemptiveTick( void ); * * See header file for description. */ -portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) +StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) { -portSTACK_TYPE *pxOriginalTOS; +StackType_t *pxOriginalTOS; pxOriginalTOS = pxTopOfStack; @@ -124,45 +124,45 @@ portSTACK_TYPE *pxOriginalTOS; /* First on the stack is the return address - which in this case is the start of the task. The offset is added to make the return address appear as it would within an IRQ ISR. */ - *pxTopOfStack = ( portSTACK_TYPE ) pxCode + portINSTRUCTION_SIZE; + *pxTopOfStack = ( StackType_t ) pxCode + portINSTRUCTION_SIZE; pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0xaaaaaaaa; /* R14 */ + *pxTopOfStack = ( StackType_t ) 0xaaaaaaaa; /* R14 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) pxOriginalTOS; /* Stack used when task starts goes in R13. */ + *pxTopOfStack = ( StackType_t ) pxOriginalTOS; /* Stack used when task starts goes in R13. */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x12121212; /* R12 */ + *pxTopOfStack = ( StackType_t ) 0x12121212; /* R12 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x11111111; /* R11 */ + *pxTopOfStack = ( StackType_t ) 0x11111111; /* R11 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x10101010; /* R10 */ + *pxTopOfStack = ( StackType_t ) 0x10101010; /* R10 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x09090909; /* R9 */ + *pxTopOfStack = ( StackType_t ) 0x09090909; /* R9 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x08080808; /* R8 */ + *pxTopOfStack = ( StackType_t ) 0x08080808; /* R8 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x07070707; /* R7 */ + *pxTopOfStack = ( StackType_t ) 0x07070707; /* R7 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x06060606; /* R6 */ + *pxTopOfStack = ( StackType_t ) 0x06060606; /* R6 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x05050505; /* R5 */ + *pxTopOfStack = ( StackType_t ) 0x05050505; /* R5 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x04040404; /* R4 */ + *pxTopOfStack = ( StackType_t ) 0x04040404; /* R4 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x03030303; /* R3 */ + *pxTopOfStack = ( StackType_t ) 0x03030303; /* R3 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x02020202; /* R2 */ + *pxTopOfStack = ( StackType_t ) 0x02020202; /* R2 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x01010101; /* R1 */ + *pxTopOfStack = ( StackType_t ) 0x01010101; /* R1 */ pxTopOfStack--; /* When the task starts is will expect to find the function parameter in R0. */ - *pxTopOfStack = ( portSTACK_TYPE ) pvParameters; /* R0 */ + *pxTopOfStack = ( StackType_t ) pvParameters; /* R0 */ pxTopOfStack--; /* The status register is set for system mode, with interrupts enabled. */ - *pxTopOfStack = ( portSTACK_TYPE ) portINITIAL_SPSR; + *pxTopOfStack = ( StackType_t ) portINITIAL_SPSR; pxTopOfStack--; /* Interrupt flags cannot always be stored on the stack and will @@ -174,7 +174,7 @@ portSTACK_TYPE *pxOriginalTOS; } /*-----------------------------------------------------------*/ -portBASE_TYPE xPortStartScheduler( void ) +BaseType_t xPortStartScheduler( void ) { extern void vPortStartFirstTask( void ); diff --git a/FreeRTOS/Source/portable/IAR/STR75x/portmacro.h b/FreeRTOS/Source/portable/IAR/STR75x/portmacro.h index 4f7999258..5f1313465 100644 --- a/FreeRTOS/Source/portable/IAR/STR75x/portmacro.h +++ b/FreeRTOS/Source/portable/IAR/STR75x/portmacro.h @@ -1,5 +1,5 @@ /* - FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. + FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. All rights reserved VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. @@ -89,25 +89,30 @@ extern "C" { #define portDOUBLE double #define portLONG long #define portSHORT short -#define portSTACK_TYPE unsigned portLONG -#define portBASE_TYPE portLONG +#define portSTACK_TYPE uint32_t +#define portBASE_TYPE long + +typedef portSTACK_TYPE StackType_t; +typedef long BaseType_t; +typedef unsigned long UBaseType_t; + #if( configUSE_16_BIT_TICKS == 1 ) - typedef unsigned portSHORT portTickType; - #define portMAX_DELAY ( portTickType ) 0xffff + typedef uint16_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffff #else - typedef unsigned portLONG portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffffUL + typedef uint32_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffffffffUL #endif -/*-----------------------------------------------------------*/ +/*-----------------------------------------------------------*/ /* Hardware specifics. */ #define portSTACK_GROWTH ( -1 ) -#define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ ) +#define portTICK_RATE_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ ) #define portBYTE_ALIGNMENT 8 #define portYIELD() asm ( "SWI 0" ) #define portNOP() asm ( "NOP" ) -/*-----------------------------------------------------------*/ +/*-----------------------------------------------------------*/ /* Critical section handling. */ __arm __interwork void vPortEnterCritical( void ); @@ -117,7 +122,7 @@ __arm __interwork void vPortExitCritical( void ); #define portENABLE_INTERRUPTS() __enable_interrupt() #define portENTER_CRITICAL() vPortEnterCritical() #define portEXIT_CRITICAL() vPortExitCritical() -/*-----------------------------------------------------------*/ +/*-----------------------------------------------------------*/ /* Task utilities. */ #define portEND_SWITCHING_ISR( xSwitchRequired ) \ @@ -129,7 +134,7 @@ extern void vTaskSwitchContext( void ); \ vTaskSwitchContext(); \ } \ } -/*-----------------------------------------------------------*/ +/*-----------------------------------------------------------*/ /* Task function macros as described on the FreeRTOS.org WEB site. */ diff --git a/FreeRTOS/Source/portable/IAR/STR91x/port.c b/FreeRTOS/Source/portable/IAR/STR91x/port.c index 488649203..019fe9e20 100644 --- a/FreeRTOS/Source/portable/IAR/STR91x/port.c +++ b/FreeRTOS/Source/portable/IAR/STR91x/port.c @@ -85,15 +85,15 @@ /* Constants required to setup the initial stack. */ #ifndef _RUN_TASK_IN_ARM_MODE_ - #define portINITIAL_SPSR ( ( portSTACK_TYPE ) 0x3f ) /* System mode, THUMB mode, interrupts enabled. */ + #define portINITIAL_SPSR ( ( StackType_t ) 0x3f ) /* System mode, THUMB mode, interrupts enabled. */ #else - #define portINITIAL_SPSR ( ( portSTACK_TYPE ) 0x1f ) /* System mode, ARM mode, interrupts enabled. */ + #define portINITIAL_SPSR ( ( StackType_t ) 0x1f ) /* System mode, ARM mode, interrupts enabled. */ #endif -#define portINSTRUCTION_SIZE ( ( portSTACK_TYPE ) 4 ) +#define portINSTRUCTION_SIZE ( ( StackType_t ) 4 ) /* Constants required to handle critical sections. */ -#define portNO_CRITICAL_NESTING ( ( unsigned long ) 0 ) +#define portNO_CRITICAL_NESTING ( ( uint32_t ) 0 ) #ifndef abs #define abs(x) ((x)>0 ? (x) : -(x)) @@ -130,7 +130,7 @@ static void prvSetupTimerInterrupt( void ); /* ulCriticalNesting will get set to zero when the first task starts. It cannot be initialised to 0 as this will cause interrupts to be enabled during the kernel initialisation process. */ -unsigned long ulCriticalNesting = ( unsigned long ) 9999; +uint32_t ulCriticalNesting = ( uint32_t ) 9999; /* Tick interrupt routines for cooperative and preemptive operation respectively. The preemptive version is not defined as __irq as it is called @@ -153,9 +153,9 @@ static void prvDefaultHandler( void ); * * See header file for description. */ -portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) +StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) { - portSTACK_TYPE *pxOriginalTOS; + StackType_t *pxOriginalTOS; pxOriginalTOS = pxTopOfStack; @@ -169,45 +169,45 @@ portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE /* First on the stack is the return address - which in this case is the start of the task. The offset is added to make the return address appear as it would within an IRQ ISR. */ - *pxTopOfStack = ( portSTACK_TYPE ) pxCode + portINSTRUCTION_SIZE; + *pxTopOfStack = ( StackType_t ) pxCode + portINSTRUCTION_SIZE; pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0xaaaaaaaa; /* R14 */ + *pxTopOfStack = ( StackType_t ) 0xaaaaaaaa; /* R14 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) pxOriginalTOS; /* Stack used when task starts goes in R13. */ + *pxTopOfStack = ( StackType_t ) pxOriginalTOS; /* Stack used when task starts goes in R13. */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x12121212; /* R12 */ + *pxTopOfStack = ( StackType_t ) 0x12121212; /* R12 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x11111111; /* R11 */ + *pxTopOfStack = ( StackType_t ) 0x11111111; /* R11 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x10101010; /* R10 */ + *pxTopOfStack = ( StackType_t ) 0x10101010; /* R10 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x09090909; /* R9 */ + *pxTopOfStack = ( StackType_t ) 0x09090909; /* R9 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x08080808; /* R8 */ + *pxTopOfStack = ( StackType_t ) 0x08080808; /* R8 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x07070707; /* R7 */ + *pxTopOfStack = ( StackType_t ) 0x07070707; /* R7 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x06060606; /* R6 */ + *pxTopOfStack = ( StackType_t ) 0x06060606; /* R6 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x05050505; /* R5 */ + *pxTopOfStack = ( StackType_t ) 0x05050505; /* R5 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x04040404; /* R4 */ + *pxTopOfStack = ( StackType_t ) 0x04040404; /* R4 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x03030303; /* R3 */ + *pxTopOfStack = ( StackType_t ) 0x03030303; /* R3 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x02020202; /* R2 */ + *pxTopOfStack = ( StackType_t ) 0x02020202; /* R2 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x01010101; /* R1 */ + *pxTopOfStack = ( StackType_t ) 0x01010101; /* R1 */ pxTopOfStack--; /* When the task starts is will expect to find the function parameter in R0. */ - *pxTopOfStack = ( portSTACK_TYPE ) pvParameters; /* R0 */ + *pxTopOfStack = ( StackType_t ) pvParameters; /* R0 */ pxTopOfStack--; /* The status register is set for system mode, with interrupts enabled. */ - *pxTopOfStack = ( portSTACK_TYPE ) portINITIAL_SPSR; + *pxTopOfStack = ( StackType_t ) portINITIAL_SPSR; pxTopOfStack--; /* Interrupt flags cannot always be stored on the stack and will @@ -219,7 +219,7 @@ portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE } /*-----------------------------------------------------------*/ -portBASE_TYPE xPortStartScheduler( void ) +BaseType_t xPortStartScheduler( void ) { extern void vPortStartFirstTask( void ); @@ -253,7 +253,7 @@ keyword. */ u32 b0; u16 a0; - long err, err_min=n; + int32_t err, err_min=n; *a = a0 = ((n-1)/65536ul) + 1; *b = b0 = n / *a; @@ -261,11 +261,11 @@ keyword. */ for (; *a <= 256; (*a)++) { *b = n / *a; - err = (long)*a * (long)*b - (long)n; + err = (int32_t)*a * (int32_t)*b - (int32_t)n; if (abs(err) > (*a / 2)) { (*b)++; - err = (long)*a * (long)*b - (long)n; + err = (int32_t)*a * (int32_t)*b - (int32_t)n; } if (abs(err) < abs(err_min)) { @@ -284,8 +284,8 @@ keyword. */ static void prvSetupTimerInterrupt( void ) { WDG_InitTypeDef xWdg; - unsigned short a; - unsigned long n = configCPU_PERIPH_HZ / configTICK_RATE_HZ, b; + uint16_t a; + uint32_t n = configCPU_PERIPH_HZ / configTICK_RATE_HZ, b; /* Configure the watchdog as a free running timer that generates a periodic interrupt. */ @@ -304,8 +304,8 @@ keyword. */ VIC_ITCmd( WDG_ITLine, ENABLE ); /* Install the default handlers for both VIC's. */ - VIC0->DVAR = ( unsigned long ) prvDefaultHandler; - VIC1->DVAR = ( unsigned long ) prvDefaultHandler; + VIC0->DVAR = ( uint32_t ) prvDefaultHandler; + VIC1->DVAR = ( uint32_t ) prvDefaultHandler; WDG_Cmd(ENABLE); } @@ -335,7 +335,7 @@ keyword. */ u16 b0; u8 a0; - long err, err_min=n; + int32_t err, err_min=n; *a = a0 = ((n-1)/256) + 1; @@ -344,11 +344,11 @@ keyword. */ for (; *a <= 256; (*a)++) { *b = n / *a; - err = (long)*a * (long)*b - (long)n; + err = (int32_t)*a * (int32_t)*b - (int32_t)n; if (abs(err) > (*a / 2)) { (*b)++; - err = (long)*a * (long)*b - (long)n; + err = (int32_t)*a * (int32_t)*b - (int32_t)n; } if (abs(err) < abs(err_min)) { @@ -366,9 +366,9 @@ keyword. */ static void prvSetupTimerInterrupt( void ) { - unsigned char a; - unsigned short b; - unsigned long n = configCPU_PERIPH_HZ / configTICK_RATE_HZ; + uint8_t a; + uint16_t b; + uint32_t n = configCPU_PERIPH_HZ / configTICK_RATE_HZ; TIM_InitTypeDef timer; @@ -392,8 +392,8 @@ keyword. */ VIC_ITCmd( TIM2_ITLine, ENABLE ); /* Install the default handlers for both VIC's. */ - VIC0->DVAR = ( unsigned long ) prvDefaultHandler; - VIC1->DVAR = ( unsigned long ) prvDefaultHandler; + VIC0->DVAR = ( uint32_t ) prvDefaultHandler; + VIC1->DVAR = ( uint32_t ) prvDefaultHandler; TIM_CounterCmd(TIM2, TIM_CLEAR); TIM_CounterCmd(TIM2, TIM_START); diff --git a/FreeRTOS/Source/portable/IAR/STR91x/portmacro.h b/FreeRTOS/Source/portable/IAR/STR91x/portmacro.h index 31eedd0be..22ea18786 100644 --- a/FreeRTOS/Source/portable/IAR/STR91x/portmacro.h +++ b/FreeRTOS/Source/portable/IAR/STR91x/portmacro.h @@ -1,5 +1,5 @@ /* - FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. + FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. All rights reserved VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. @@ -89,25 +89,30 @@ extern "C" { #define portDOUBLE double #define portLONG long #define portSHORT short -#define portSTACK_TYPE unsigned portLONG -#define portBASE_TYPE portLONG +#define portSTACK_TYPE uint32_t +#define portBASE_TYPE long + +typedef portSTACK_TYPE StackType_t; +typedef long BaseType_t; +typedef unsigned long UBaseType_t; + #if( configUSE_16_BIT_TICKS == 1 ) - typedef unsigned portSHORT portTickType; - #define portMAX_DELAY ( portTickType ) 0xffff + typedef uint16_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffff #else - typedef unsigned portLONG portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffffUL + typedef uint32_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffffffffUL #endif -/*-----------------------------------------------------------*/ +/*-----------------------------------------------------------*/ /* Hardware specifics. */ #define portSTACK_GROWTH ( -1 ) -#define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ ) +#define portTICK_RATE_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ ) #define portBYTE_ALIGNMENT 8 #define portYIELD() asm ( "SWI 0" ) #define portNOP() asm ( "NOP" ) -/*-----------------------------------------------------------*/ +/*-----------------------------------------------------------*/ /* Critical section handling. */ __arm __interwork void vPortEnterCritical( void ); @@ -119,7 +124,7 @@ __arm __interwork void vPortExitCritical( void ); #define portENABLE_INTERRUPTS() __enable_interrupt() -/*-----------------------------------------------------------*/ +/*-----------------------------------------------------------*/ /* Task utilities. */ #define portEND_SWITCHING_ISR( xSwitchRequired ) \ @@ -131,7 +136,7 @@ extern void vTaskSwitchContext( void ); \ vTaskSwitchContext(); \ } \ } -/*-----------------------------------------------------------*/ +/*-----------------------------------------------------------*/ /* Task function macros as described on the FreeRTOS.org WEB site. */ diff --git a/FreeRTOS/Source/portable/IAR/V850ES/port.c b/FreeRTOS/Source/portable/IAR/V850ES/port.c index a4c95a007..edf7bf116 100644 --- a/FreeRTOS/Source/portable/IAR/V850ES/port.c +++ b/FreeRTOS/Source/portable/IAR/V850ES/port.c @@ -72,95 +72,95 @@ /* Critical nesting should be initialised to a non zero value so interrupts don't accidentally get enabled before the scheduler is started. */ -#define portINITIAL_CRITICAL_NESTING (( portSTACK_TYPE ) 10) +#define portINITIAL_CRITICAL_NESTING (( StackType_t ) 10) /* The PSW value assigned to tasks when they start to run for the first time. */ -#define portPSW (( portSTACK_TYPE ) 0x00000000) +#define portPSW (( StackType_t ) 0x00000000) /* We require the address of the pxCurrentTCB variable, but don't want to know any details of its type. */ -typedef void tskTCB; -extern volatile tskTCB * volatile pxCurrentTCB; +typedef void TCB_t; +extern volatile TCB_t * volatile pxCurrentTCB; /* Keeps track of the nesting level of critical sections. */ -volatile portSTACK_TYPE usCriticalNesting = portINITIAL_CRITICAL_NESTING; +volatile StackType_t usCriticalNesting = portINITIAL_CRITICAL_NESTING; /*-----------------------------------------------------------*/ /* Sets up the timer to generate the tick interrupt. */ static void prvSetupTimerInterrupt( void ); /*-----------------------------------------------------------*/ -portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) +StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) { - *pxTopOfStack = ( portSTACK_TYPE ) pxCode; /* Task function start address */ + *pxTopOfStack = ( StackType_t ) pxCode; /* Task function start address */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) pxCode; /* Task function start address */ + *pxTopOfStack = ( StackType_t ) pxCode; /* Task function start address */ pxTopOfStack--; *pxTopOfStack = portPSW; /* Initial PSW value */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x20202020; /* Initial Value of R20 */ + *pxTopOfStack = ( StackType_t ) 0x20202020; /* Initial Value of R20 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x21212121; /* Initial Value of R21 */ + *pxTopOfStack = ( StackType_t ) 0x21212121; /* Initial Value of R21 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x22222222; /* Initial Value of R22 */ + *pxTopOfStack = ( StackType_t ) 0x22222222; /* Initial Value of R22 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x23232323; /* Initial Value of R23 */ + *pxTopOfStack = ( StackType_t ) 0x23232323; /* Initial Value of R23 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x24242424; /* Initial Value of R24 */ + *pxTopOfStack = ( StackType_t ) 0x24242424; /* Initial Value of R24 */ pxTopOfStack--; #if (__DATA_MODEL__ == 0) || (__DATA_MODEL__ == 1) - *pxTopOfStack = ( portSTACK_TYPE ) 0x25252525; /* Initial Value of R25 */ + *pxTopOfStack = ( StackType_t ) 0x25252525; /* Initial Value of R25 */ pxTopOfStack--; #endif /* configDATA_MODE */ - *pxTopOfStack = ( portSTACK_TYPE ) 0x26262626; /* Initial Value of R26 */ + *pxTopOfStack = ( StackType_t ) 0x26262626; /* Initial Value of R26 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x27272727; /* Initial Value of R27 */ + *pxTopOfStack = ( StackType_t ) 0x27272727; /* Initial Value of R27 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x28282828; /* Initial Value of R28 */ + *pxTopOfStack = ( StackType_t ) 0x28282828; /* Initial Value of R28 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x29292929; /* Initial Value of R29 */ + *pxTopOfStack = ( StackType_t ) 0x29292929; /* Initial Value of R29 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x30303030; /* Initial Value of R30 */ + *pxTopOfStack = ( StackType_t ) 0x30303030; /* Initial Value of R30 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x19191919; /* Initial Value of R19 */ + *pxTopOfStack = ( StackType_t ) 0x19191919; /* Initial Value of R19 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x18181818; /* Initial Value of R18 */ + *pxTopOfStack = ( StackType_t ) 0x18181818; /* Initial Value of R18 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x17171717; /* Initial Value of R17 */ + *pxTopOfStack = ( StackType_t ) 0x17171717; /* Initial Value of R17 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x16161616; /* Initial Value of R16 */ + *pxTopOfStack = ( StackType_t ) 0x16161616; /* Initial Value of R16 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x15151515; /* Initial Value of R15 */ + *pxTopOfStack = ( StackType_t ) 0x15151515; /* Initial Value of R15 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x14141414; /* Initial Value of R14 */ + *pxTopOfStack = ( StackType_t ) 0x14141414; /* Initial Value of R14 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x13131313; /* Initial Value of R13 */ + *pxTopOfStack = ( StackType_t ) 0x13131313; /* Initial Value of R13 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x12121212; /* Initial Value of R12 */ + *pxTopOfStack = ( StackType_t ) 0x12121212; /* Initial Value of R12 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x11111111; /* Initial Value of R11 */ + *pxTopOfStack = ( StackType_t ) 0x11111111; /* Initial Value of R11 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x10101010; /* Initial Value of R10 */ + *pxTopOfStack = ( StackType_t ) 0x10101010; /* Initial Value of R10 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x99999999; /* Initial Value of R09 */ + *pxTopOfStack = ( StackType_t ) 0x99999999; /* Initial Value of R09 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x88888888; /* Initial Value of R08 */ + *pxTopOfStack = ( StackType_t ) 0x88888888; /* Initial Value of R08 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x77777777; /* Initial Value of R07 */ + *pxTopOfStack = ( StackType_t ) 0x77777777; /* Initial Value of R07 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x66666666; /* Initial Value of R06 */ + *pxTopOfStack = ( StackType_t ) 0x66666666; /* Initial Value of R06 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x55555555; /* Initial Value of R05 */ + *pxTopOfStack = ( StackType_t ) 0x55555555; /* Initial Value of R05 */ pxTopOfStack--; #if __DATA_MODEL__ == 0 || __DATA_MODEL__ == 1 - *pxTopOfStack = ( portSTACK_TYPE ) 0x44444444; /* Initial Value of R04 */ + *pxTopOfStack = ( StackType_t ) 0x44444444; /* Initial Value of R04 */ pxTopOfStack--; #endif /* configDATA_MODE */ - *pxTopOfStack = ( portSTACK_TYPE ) 0x22222222; /* Initial Value of R02 */ + *pxTopOfStack = ( StackType_t ) 0x22222222; /* Initial Value of R02 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) pvParameters; /* R1 is expected to hold the function parameter*/ + *pxTopOfStack = ( StackType_t ) pvParameters; /* R1 is expected to hold the function parameter*/ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) portNO_CRITICAL_SECTION_NESTING; + *pxTopOfStack = ( StackType_t ) portNO_CRITICAL_SECTION_NESTING; /* * Return a pointer to the top of the stack we have generated so this can @@ -170,7 +170,7 @@ portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE } /*-----------------------------------------------------------*/ -portBASE_TYPE xPortStartScheduler( void ) +BaseType_t xPortStartScheduler( void ) { /* Setup the hardware to generate the tick. Interrupts are disabled when this function is called. */ diff --git a/FreeRTOS/Source/portable/IAR/V850ES/portmacro.h b/FreeRTOS/Source/portable/IAR/V850ES/portmacro.h index 2c1d2337f..0a967e5c7 100644 --- a/FreeRTOS/Source/portable/IAR/V850ES/portmacro.h +++ b/FreeRTOS/Source/portable/IAR/V850ES/portmacro.h @@ -1,5 +1,5 @@ /* - FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. + FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. All rights reserved VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. @@ -89,15 +89,19 @@ extern "C" { #define portSTACK_TYPE unsigned int #define portBASE_TYPE int +typedef portSTACK_TYPE StackType_t; +typedef long BaseType_t; +typedef unsigned long UBaseType_t; + #if (configUSE_16_BIT_TICKS==1) - typedef unsigned portSHORT portTickType; - #define portMAX_DELAY ( portTickType ) 0xffff + typedef uint16_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffff #else - typedef unsigned portLONG portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffffUL + typedef uint32_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffffffffUL #endif -/*-----------------------------------------------------------*/ +/*-----------------------------------------------------------*/ /* Interrupt control macros. */ #define portDISABLE_INTERRUPTS() __asm ( "DI" ) @@ -105,11 +109,11 @@ extern "C" { /*-----------------------------------------------------------*/ /* Critical section control macros. */ -#define portNO_CRITICAL_SECTION_NESTING ( ( unsigned portBASE_TYPE ) 0 ) +#define portNO_CRITICAL_SECTION_NESTING ( ( UBaseType_t ) 0 ) #define portENTER_CRITICAL() \ { \ -extern volatile /*unsigned portSHORT*/ portSTACK_TYPE usCriticalNesting; \ +extern volatile /*uint16_t*/ portSTACK_TYPE usCriticalNesting; \ \ portDISABLE_INTERRUPTS(); \ \ @@ -121,7 +125,7 @@ extern volatile /*unsigned portSHORT*/ portSTACK_TYPE usCriticalNesting; \ #define portEXIT_CRITICAL() \ { \ -extern volatile /*unsigned portSHORT*/ portSTACK_TYPE usCriticalNesting; \ +extern volatile /*uint16_t*/ portSTACK_TYPE usCriticalNesting; \ \ if( usCriticalNesting > portNO_CRITICAL_SECTION_NESTING ) \ { \ @@ -153,7 +157,7 @@ extern void vTaskSwitchContext( void ); /* Hardwware specifics. */ #define portBYTE_ALIGNMENT 4 #define portSTACK_GROWTH ( -1 ) -#define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ ) +#define portTICK_RATE_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ ) /*-----------------------------------------------------------*/ /* Task function macros as described on the FreeRTOS.org WEB site. */ diff --git a/FreeRTOS/Source/portable/MPLAB/PIC18F/port.c b/FreeRTOS/Source/portable/MPLAB/PIC18F/port.c index 4ee757dd4..089bfa67b 100644 --- a/FreeRTOS/Source/portable/MPLAB/PIC18F/port.c +++ b/FreeRTOS/Source/portable/MPLAB/PIC18F/port.c @@ -104,7 +104,7 @@ Changes from V3.2.0 *----------------------------------------------------------*/ /* Hardware setup for tick. */ -#define portTIMER_FOSC_SCALE ( ( unsigned long ) 4 ) +#define portTIMER_FOSC_SCALE ( ( uint32_t ) 4 ) /* Initial interrupt enable state for newly created tasks. This value is copied into INTCON when a task switches in for the first time. */ @@ -121,16 +121,16 @@ enable state to be unchanged when the interrupted task is switched back in. */ area's get used by the compiler for temporary storage, especially when performing mathematical operations, or when using 32bit data types. This constant defines the size of memory area which must be saved. */ -#define portCOMPILER_MANAGED_MEMORY_SIZE ( ( unsigned char ) 0x13 ) +#define portCOMPILER_MANAGED_MEMORY_SIZE ( ( uint8_t ) 0x13 ) /* We require the address of the pxCurrentTCB variable, but don't want to know any details of its type. */ -typedef void tskTCB; -extern volatile tskTCB * volatile pxCurrentTCB; +typedef void TCB_t; +extern volatile TCB_t * volatile pxCurrentTCB; /* IO port constants. */ -#define portBIT_SET ( ( unsigned char ) 1 ) -#define portBIT_CLEAR ( ( unsigned char ) 0 ) +#define portBIT_SET ( ( uint8_t ) 1 ) +#define portBIT_CLEAR ( ( uint8_t ) 0 ) /* * The serial port ISR's are defined in serial.c, but are called from portable @@ -243,7 +243,7 @@ static void prvLowInterrupt( void ); _endasm \ \ /* Store each address from the hardware stack. */ \ - while( STKPTR > ( unsigned char ) 0 ) \ + while( STKPTR > ( uint8_t ) 0 ) \ { \ _asm \ MOVFF TOSL, PREINC1 \ @@ -380,10 +380,10 @@ static void prvLowInterrupt( void ); /* * See header file for description. */ -portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) +StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) { -unsigned long ulAddress; -unsigned char ucBlock; +uint32_t ulAddress; +uint8_t ucBlock; /* Place a few bytes of known values on the bottom of the stack. This is just useful for debugging. */ @@ -401,12 +401,12 @@ unsigned char ucBlock; First store the function parameters. This is where the task will expect to find them when it starts running. */ - ulAddress = ( unsigned long ) pvParameters; - *pxTopOfStack = ( portSTACK_TYPE ) ( ulAddress & ( unsigned long ) 0x00ff ); + ulAddress = ( uint32_t ) pvParameters; + *pxTopOfStack = ( StackType_t ) ( ulAddress & ( uint32_t ) 0x00ff ); pxTopOfStack++; ulAddress >>= 8; - *pxTopOfStack = ( portSTACK_TYPE ) ( ulAddress & ( unsigned long ) 0x00ff ); + *pxTopOfStack = ( StackType_t ) ( ulAddress & ( uint32_t ) 0x00ff ); pxTopOfStack++; /* Next we just leave a space. When a context is saved the stack pointer @@ -418,97 +418,97 @@ unsigned char ucBlock; /* Next are all the registers that form part of the task context. */ - *pxTopOfStack = ( portSTACK_TYPE ) 0x66; /* WREG. */ + *pxTopOfStack = ( StackType_t ) 0x66; /* WREG. */ pxTopOfStack++; - *pxTopOfStack = ( portSTACK_TYPE ) 0xcc; /* Status. */ + *pxTopOfStack = ( StackType_t ) 0xcc; /* Status. */ pxTopOfStack++; /* INTCON is saved with interrupts enabled. */ - *pxTopOfStack = ( portSTACK_TYPE ) portINITAL_INTERRUPT_STATE; /* INTCON */ + *pxTopOfStack = ( StackType_t ) portINITAL_INTERRUPT_STATE; /* INTCON */ pxTopOfStack++; - *pxTopOfStack = ( portSTACK_TYPE ) 0x11; /* BSR. */ + *pxTopOfStack = ( StackType_t ) 0x11; /* BSR. */ pxTopOfStack++; - *pxTopOfStack = ( portSTACK_TYPE ) 0x22; /* FSR2L. */ + *pxTopOfStack = ( StackType_t ) 0x22; /* FSR2L. */ pxTopOfStack++; - *pxTopOfStack = ( portSTACK_TYPE ) 0x33; /* FSR2H. */ + *pxTopOfStack = ( StackType_t ) 0x33; /* FSR2H. */ pxTopOfStack++; - *pxTopOfStack = ( portSTACK_TYPE ) 0x44; /* FSR0L. */ + *pxTopOfStack = ( StackType_t ) 0x44; /* FSR0L. */ pxTopOfStack++; - *pxTopOfStack = ( portSTACK_TYPE ) 0x55; /* FSR0H. */ + *pxTopOfStack = ( StackType_t ) 0x55; /* FSR0H. */ pxTopOfStack++; - *pxTopOfStack = ( portSTACK_TYPE ) 0x66; /* TABLAT. */ + *pxTopOfStack = ( StackType_t ) 0x66; /* TABLAT. */ pxTopOfStack++; - *pxTopOfStack = ( portSTACK_TYPE ) 0x00; /* TBLPTRU. */ + *pxTopOfStack = ( StackType_t ) 0x00; /* TBLPTRU. */ pxTopOfStack++; - *pxTopOfStack = ( portSTACK_TYPE ) 0x88; /* TBLPTRUH. */ + *pxTopOfStack = ( StackType_t ) 0x88; /* TBLPTRUH. */ pxTopOfStack++; - *pxTopOfStack = ( portSTACK_TYPE ) 0x99; /* TBLPTRUL. */ + *pxTopOfStack = ( StackType_t ) 0x99; /* TBLPTRUL. */ pxTopOfStack++; - *pxTopOfStack = ( portSTACK_TYPE ) 0xaa; /* PRODH. */ + *pxTopOfStack = ( StackType_t ) 0xaa; /* PRODH. */ pxTopOfStack++; - *pxTopOfStack = ( portSTACK_TYPE ) 0xbb; /* PRODL. */ + *pxTopOfStack = ( StackType_t ) 0xbb; /* PRODL. */ pxTopOfStack++; - *pxTopOfStack = ( portSTACK_TYPE ) 0x00; /* PCLATU. */ + *pxTopOfStack = ( StackType_t ) 0x00; /* PCLATU. */ pxTopOfStack++; - *pxTopOfStack = ( portSTACK_TYPE ) 0x00; /* PCLATH. */ + *pxTopOfStack = ( StackType_t ) 0x00; /* PCLATH. */ pxTopOfStack++; /* Next the .tmpdata and MATH_DATA sections. */ for( ucBlock = 0; ucBlock <= portCOMPILER_MANAGED_MEMORY_SIZE; ucBlock++ ) { - *pxTopOfStack = ( portSTACK_TYPE ) ucBlock; + *pxTopOfStack = ( StackType_t ) ucBlock; *pxTopOfStack++; } /* Store the top of the global data section. */ - *pxTopOfStack = ( portSTACK_TYPE ) portCOMPILER_MANAGED_MEMORY_SIZE; /* Low. */ + *pxTopOfStack = ( StackType_t ) portCOMPILER_MANAGED_MEMORY_SIZE; /* Low. */ pxTopOfStack++; - *pxTopOfStack = ( portSTACK_TYPE ) 0x00; /* High. */ + *pxTopOfStack = ( StackType_t ) 0x00; /* High. */ pxTopOfStack++; /* The only function return address so far is the address of the task. */ - ulAddress = ( unsigned long ) pxCode; + ulAddress = ( uint32_t ) pxCode; /* TOS low. */ - *pxTopOfStack = ( portSTACK_TYPE ) ( ulAddress & ( unsigned long ) 0x00ff ); + *pxTopOfStack = ( StackType_t ) ( ulAddress & ( uint32_t ) 0x00ff ); pxTopOfStack++; ulAddress >>= 8; /* TOS high. */ - *pxTopOfStack = ( portSTACK_TYPE ) ( ulAddress & ( unsigned long ) 0x00ff ); + *pxTopOfStack = ( StackType_t ) ( ulAddress & ( uint32_t ) 0x00ff ); pxTopOfStack++; ulAddress >>= 8; /* TOS even higher. */ - *pxTopOfStack = ( portSTACK_TYPE ) ( ulAddress & ( unsigned long ) 0x00ff ); + *pxTopOfStack = ( StackType_t ) ( ulAddress & ( uint32_t ) 0x00ff ); pxTopOfStack++; /* Store the number of return addresses on the hardware stack - so far only the address of the task entry point. */ - *pxTopOfStack = ( portSTACK_TYPE ) 1; + *pxTopOfStack = ( StackType_t ) 1; pxTopOfStack++; return pxTopOfStack; } /*-----------------------------------------------------------*/ -portBASE_TYPE xPortStartScheduler( void ) +BaseType_t xPortStartScheduler( void ) { /* Setup a timer for the tick ISR is using the preemptive scheduler. */ prvSetupTimerInterrupt(); @@ -617,9 +617,9 @@ static void prvTickISR( void ) */ static void prvSetupTimerInterrupt( void ) { -const unsigned long ulConstCompareValue = ( ( configCPU_CLOCK_HZ / portTIMER_FOSC_SCALE ) / configTICK_RATE_HZ ); -unsigned long ulCompareValue; -unsigned char ucByte; +const uint32_t ulConstCompareValue = ( ( configCPU_CLOCK_HZ / portTIMER_FOSC_SCALE ) / configTICK_RATE_HZ ); +uint32_t ulCompareValue; +uint8_t ucByte; /* Interrupts are disabled when this function is called. @@ -627,14 +627,14 @@ unsigned char ucByte; 1. Clear the time count then setup timer. */ - TMR1H = ( unsigned char ) 0x00; - TMR1L = ( unsigned char ) 0x00; + TMR1H = ( uint8_t ) 0x00; + TMR1L = ( uint8_t ) 0x00; /* Set the compare match value. */ ulCompareValue = ulConstCompareValue; - CCPR1L = ( unsigned char ) ( ulCompareValue & ( unsigned long ) 0xff ); - ulCompareValue >>= ( unsigned long ) 8; - CCPR1H = ( unsigned char ) ( ulCompareValue & ( unsigned long ) 0xff ); + CCPR1L = ( uint8_t ) ( ulCompareValue & ( uint32_t ) 0xff ); + ulCompareValue >>= ( uint32_t ) 8; + CCPR1H = ( uint8_t ) ( ulCompareValue & ( uint32_t ) 0xff ); CCP1CONbits.CCP1M0 = portBIT_SET; /*< Compare match mode. */ CCP1CONbits.CCP1M1 = portBIT_SET; /*< Compare match mode. */ diff --git a/FreeRTOS/Source/portable/MPLAB/PIC18F/portmacro.h b/FreeRTOS/Source/portable/MPLAB/PIC18F/portmacro.h index 3327499a3..f61ab0b46 100644 --- a/FreeRTOS/Source/portable/MPLAB/PIC18F/portmacro.h +++ b/FreeRTOS/Source/portable/MPLAB/PIC18F/portmacro.h @@ -1,5 +1,5 @@ /* - FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. + FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. All rights reserved VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. @@ -67,7 +67,7 @@ #define PORTMACRO_H /*----------------------------------------------------------- - * Port specific definitions. + * Port specific definitions. * * The settings in this file configure FreeRTOS correctly for the * given hardware and compiler. @@ -82,15 +82,19 @@ #define portDOUBLE double #define portLONG long #define portSHORT int -#define portSTACK_TYPE unsigned char +#define portSTACK_TYPE uint8_t #define portBASE_TYPE char +typedef portSTACK_TYPE StackType_t; +typedef signed char BaseType_t; +typedef unsigned char UBaseType_t; + #if( configUSE_16_BIT_TICKS == 1 ) - typedef unsigned portSHORT portTickType; - #define portMAX_DELAY ( portTickType ) 0xffff + typedef uint16_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffff #else - typedef unsigned portLONG portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffffUL + typedef uint32_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffffffffUL #endif /*-----------------------------------------------------------*/ @@ -98,7 +102,7 @@ #define portBYTE_ALIGNMENT 1 #define portGLOBAL_INT_ENABLE_BIT 0x80 #define portSTACK_GROWTH 1 -#define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ ) +#define portTICK_RATE_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ ) /*-----------------------------------------------------------*/ /* Critical section management. */ diff --git a/FreeRTOS/Source/portable/MPLAB/PIC24_dsPIC/port.c b/FreeRTOS/Source/portable/MPLAB/PIC24_dsPIC/port.c index a19e1b15a..7cca24a3a 100644 --- a/FreeRTOS/Source/portable/MPLAB/PIC24_dsPIC/port.c +++ b/FreeRTOS/Source/portable/MPLAB/PIC24_dsPIC/port.c @@ -98,7 +98,7 @@ not provided their own. */ #define portUNUSED_PR_BITS 0x7f /* Records the nesting depth of calls to portENTER_CRITICAL(). */ -unsigned portBASE_TYPE uxCriticalNesting = 0xef; +UBaseType_t uxCriticalNesting = 0xef; #if configKERNEL_INTERRUPT_PRIORITY != 1 #error If configKERNEL_INTERRUPT_PRIORITY is not 1 then the #32 in the following macros needs changing to equal the portINTERRUPT_BITS value, which is ( configKERNEL_INTERRUPT_PRIORITY << 5 ) @@ -194,12 +194,12 @@ void vApplicationSetupTickTimerInterrupt( void ); /* * See header file for description. */ -portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) +StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) { -unsigned short usCode; -unsigned portBASE_TYPE i; +uint16_t usCode; +UBaseType_t i; -const portSTACK_TYPE xInitialStack[] = +const StackType_t xInitialStack[] = { 0x1111, /* W1 */ 0x2222, /* W2 */ @@ -237,14 +237,14 @@ const portSTACK_TYPE xInitialStack[] = /* Setup the stack as if a yield had occurred. Save the low bytes of the program counter. */ - usCode = ( unsigned short ) pxCode; - *pxTopOfStack = ( portSTACK_TYPE ) usCode; + usCode = ( uint16_t ) pxCode; + *pxTopOfStack = ( StackType_t ) usCode; pxTopOfStack++; /* Save the high byte of the program counter. This will always be zero here as it is passed in a 16bit pointer. If the address is greater than 16 bits then the pointer will point to a jump table. */ - *pxTopOfStack = ( portSTACK_TYPE ) 0; + *pxTopOfStack = ( StackType_t ) 0; pxTopOfStack++; /* Status register with interrupts enabled. */ @@ -252,10 +252,10 @@ const portSTACK_TYPE xInitialStack[] = pxTopOfStack++; /* Parameters are passed in W0. */ - *pxTopOfStack = ( portSTACK_TYPE ) pvParameters; + *pxTopOfStack = ( StackType_t ) pvParameters; pxTopOfStack++; - for( i = 0; i < ( sizeof( xInitialStack ) / sizeof( portSTACK_TYPE ) ); i++ ) + for( i = 0; i < ( sizeof( xInitialStack ) / sizeof( StackType_t ) ); i++ ) { *pxTopOfStack = xInitialStack[ i ]; pxTopOfStack++; @@ -282,7 +282,7 @@ const portSTACK_TYPE xInitialStack[] = } /*-----------------------------------------------------------*/ -portBASE_TYPE xPortStartScheduler( void ) +BaseType_t xPortStartScheduler( void ) { /* Setup a timer for the tick ISR. */ vApplicationSetupTickTimerInterrupt(); @@ -311,13 +311,13 @@ void vPortEndScheduler( void ) */ __attribute__(( weak )) void vApplicationSetupTickTimerInterrupt( void ) { -const unsigned long ulCompareMatch = ( ( configCPU_CLOCK_HZ / portTIMER_PRESCALE ) / configTICK_RATE_HZ ) - 1; +const uint32_t ulCompareMatch = ( ( configCPU_CLOCK_HZ / portTIMER_PRESCALE ) / configTICK_RATE_HZ ) - 1; /* Prescale of 8. */ T1CON = 0; TMR1 = 0; - PR1 = ( unsigned short ) ulCompareMatch; + PR1 = ( uint16_t ) ulCompareMatch; /* Setup timer 1 interrupt priority. */ IPC0bits.T1IP = configKERNEL_INTERRUPT_PRIORITY; diff --git a/FreeRTOS/Source/portable/MPLAB/PIC24_dsPIC/portmacro.h b/FreeRTOS/Source/portable/MPLAB/PIC24_dsPIC/portmacro.h index 65c162901..695b49195 100644 --- a/FreeRTOS/Source/portable/MPLAB/PIC24_dsPIC/portmacro.h +++ b/FreeRTOS/Source/portable/MPLAB/PIC24_dsPIC/portmacro.h @@ -1,5 +1,5 @@ /* - FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. + FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. All rights reserved VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. @@ -71,7 +71,7 @@ extern "C" { #endif /*----------------------------------------------------------- - * Port specific definitions. + * Port specific definitions. * * The settings in this file configure FreeRTOS correctly for the * given hardware and compiler. @@ -86,28 +86,32 @@ extern "C" { #define portDOUBLE double #define portLONG long #define portSHORT short -#define portSTACK_TYPE unsigned short +#define portSTACK_TYPE uint16_t #define portBASE_TYPE short +typedef portSTACK_TYPE StackType_t; +typedef short BaseType_t; +typedef unsigned short UBaseType_t; + #if( configUSE_16_BIT_TICKS == 1 ) - typedef unsigned portSHORT portTickType; - #define portMAX_DELAY ( portTickType ) 0xffff + typedef uint16_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffff #else - typedef unsigned portLONG portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffffUL + typedef uint32_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffffffffUL #endif /*-----------------------------------------------------------*/ /* Hardware specifics. */ #define portBYTE_ALIGNMENT 2 #define portSTACK_GROWTH 1 -#define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ ) +#define portTICK_RATE_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ ) /*-----------------------------------------------------------*/ /* Critical section management. */ -#define portINTERRUPT_BITS ( ( unsigned portSHORT ) configKERNEL_INTERRUPT_PRIORITY << ( unsigned portSHORT ) 5 ) +#define portINTERRUPT_BITS ( ( uint16_t ) configKERNEL_INTERRUPT_PRIORITY << ( uint16_t ) 5 ) -#define portDISABLE_INTERRUPTS() SR |= portINTERRUPT_BITS +#define portDISABLE_INTERRUPTS() SR |= portINTERRUPT_BITS #define portENABLE_INTERRUPTS() SR &= ~portINTERRUPT_BITS /* Note that exiting a critical sectino will set the IPL bits to 0, nomatter diff --git a/FreeRTOS/Source/portable/MPLAB/PIC32MX/port.c b/FreeRTOS/Source/portable/MPLAB/PIC32MX/port.c index cb8ba11d6..b988edd84 100644 --- a/FreeRTOS/Source/portable/MPLAB/PIC32MX/port.c +++ b/FreeRTOS/Source/portable/MPLAB/PIC32MX/port.c @@ -137,7 +137,7 @@ task stack, not the ISR stack). */ the ISR stack. */ #define portISR_STACK_FILL_BYTE 0xee - static const unsigned char ucExpectedStackBytes[] = { + static const uint8_t ucExpectedStackBytes[] = { portISR_STACK_FILL_BYTE, portISR_STACK_FILL_BYTE, portISR_STACK_FILL_BYTE, portISR_STACK_FILL_BYTE, \ portISR_STACK_FILL_BYTE, portISR_STACK_FILL_BYTE, portISR_STACK_FILL_BYTE, portISR_STACK_FILL_BYTE, \ portISR_STACK_FILL_BYTE, portISR_STACK_FILL_BYTE, portISR_STACK_FILL_BYTE, portISR_STACK_FILL_BYTE, \ @@ -178,47 +178,47 @@ static void prvTaskExitError( void ); /* Records the interrupt nesting depth. This is initialised to one as it is decremented to 0 when the first task starts. */ -volatile unsigned portBASE_TYPE uxInterruptNesting = 0x01; +volatile UBaseType_t uxInterruptNesting = 0x01; /* Stores the task stack pointer when a switch is made to use the system stack. */ -unsigned portBASE_TYPE uxSavedTaskStackPointer = 0; +UBaseType_t uxSavedTaskStackPointer = 0; /* The stack used by interrupt service routines that cause a context switch. */ -portSTACK_TYPE xISRStack[ configISR_STACK_SIZE ] = { 0 }; +StackType_t xISRStack[ configISR_STACK_SIZE ] = { 0 }; /* The top of stack value ensures there is enough space to store 6 registers on the callers stack, as some functions seem to want to do this. */ -const portSTACK_TYPE * const xISRStackTop = &( xISRStack[ configISR_STACK_SIZE - 7 ] ); +const StackType_t * const xISRStackTop = &( xISRStack[ configISR_STACK_SIZE - 7 ] ); /*-----------------------------------------------------------*/ /* * See header file for description. */ -portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) +StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) { /* Ensure byte alignment is maintained when leaving this function. */ pxTopOfStack--; - *pxTopOfStack = (portSTACK_TYPE) 0xDEADBEEF; + *pxTopOfStack = (StackType_t) 0xDEADBEEF; pxTopOfStack--; - *pxTopOfStack = (portSTACK_TYPE) 0x12345678; /* Word to which the stack pointer will be left pointing after context restore. */ + *pxTopOfStack = (StackType_t) 0x12345678; /* Word to which the stack pointer will be left pointing after context restore. */ pxTopOfStack--; - *pxTopOfStack = (portSTACK_TYPE) _CP0_GET_CAUSE(); + *pxTopOfStack = (StackType_t) _CP0_GET_CAUSE(); pxTopOfStack--; - *pxTopOfStack = (portSTACK_TYPE) portINITIAL_SR;/* CP0_STATUS */ + *pxTopOfStack = (StackType_t) portINITIAL_SR;/* CP0_STATUS */ pxTopOfStack--; - *pxTopOfStack = (portSTACK_TYPE) pxCode; /* CP0_EPC */ + *pxTopOfStack = (StackType_t) pxCode; /* CP0_EPC */ pxTopOfStack--; - *pxTopOfStack = (portSTACK_TYPE) portTASK_RETURN_ADDRESS; /* ra */ + *pxTopOfStack = (StackType_t) portTASK_RETURN_ADDRESS; /* ra */ pxTopOfStack -= 15; - *pxTopOfStack = (portSTACK_TYPE) pvParameters; /* Parameters to pass in. */ + *pxTopOfStack = (StackType_t) pvParameters; /* Parameters to pass in. */ pxTopOfStack -= 15; return pxTopOfStack; @@ -250,7 +250,7 @@ static void prvTaskExitError( void ) */ __attribute__(( weak )) void vApplicationSetupTickTimerInterrupt( void ) { -const unsigned long ulCompareMatch = ( (configPERIPHERAL_CLOCK_HZ / portTIMER_PRESCALE) / configTICK_RATE_HZ ) - 1; +const uint32_t ulCompareMatch = ( (configPERIPHERAL_CLOCK_HZ / portTIMER_PRESCALE) / configTICK_RATE_HZ ) - 1; T1CON = 0x0000; T1CONbits.TCKPS = portPRESCALE_BITS; @@ -276,7 +276,7 @@ void vPortEndScheduler(void) } /*-----------------------------------------------------------*/ -portBASE_TYPE xPortStartScheduler( void ) +BaseType_t xPortStartScheduler( void ) { extern void vPortStartFirstTask( void ); extern void *pxCurrentTCB; @@ -305,7 +305,7 @@ extern void *pxCurrentTCB; /* Kick off the highest priority task that has been created so far. Its stack location is loaded into uxSavedTaskStackPointer. */ - uxSavedTaskStackPointer = *( unsigned portBASE_TYPE * ) pxCurrentTCB; + uxSavedTaskStackPointer = *( UBaseType_t * ) pxCurrentTCB; vPortStartFirstTask(); /* Should never get here as the tasks will now be executing! Call the task @@ -320,7 +320,7 @@ extern void *pxCurrentTCB; void vPortIncrementTick( void ) { -unsigned portBASE_TYPE uxSavedStatus; +UBaseType_t uxSavedStatus; uxSavedStatus = uxPortSetInterruptMaskFromISR(); { @@ -340,9 +340,9 @@ unsigned portBASE_TYPE uxSavedStatus; } /*-----------------------------------------------------------*/ -unsigned portBASE_TYPE uxPortSetInterruptMaskFromISR( void ) +UBaseType_t uxPortSetInterruptMaskFromISR( void ) { -unsigned portBASE_TYPE uxSavedStatusRegister; +UBaseType_t uxSavedStatusRegister; __builtin_disable_interrupts(); uxSavedStatusRegister = _CP0_GET_STATUS() | 0x01; @@ -358,7 +358,7 @@ unsigned portBASE_TYPE uxSavedStatusRegister; } /*-----------------------------------------------------------*/ -void vPortClearInterruptMaskFromISR( unsigned portBASE_TYPE uxSavedStatusRegister ) +void vPortClearInterruptMaskFromISR( UBaseType_t uxSavedStatusRegister ) { _CP0_SET_STATUS( uxSavedStatusRegister ); } diff --git a/FreeRTOS/Source/portable/MPLAB/PIC32MX/portmacro.h b/FreeRTOS/Source/portable/MPLAB/PIC32MX/portmacro.h index e1730981e..f4e6806d5 100644 --- a/FreeRTOS/Source/portable/MPLAB/PIC32MX/portmacro.h +++ b/FreeRTOS/Source/portable/MPLAB/PIC32MX/portmacro.h @@ -1,5 +1,5 @@ /* - FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. + FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. All rights reserved VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. @@ -89,22 +89,26 @@ extern "C" { #define portDOUBLE double #define portLONG long #define portSHORT short -#define portSTACK_TYPE unsigned long +#define portSTACK_TYPE uint32_t #define portBASE_TYPE long +typedef portSTACK_TYPE StackType_t; +typedef long BaseType_t; +typedef unsigned long UBaseType_t; + #if( configUSE_16_BIT_TICKS == 1 ) - typedef unsigned portSHORT portTickType; - #define portMAX_DELAY ( portTickType ) 0xffff + typedef uint16_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffff #else - typedef unsigned long portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffffUL + typedef uint32_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffffffffUL #endif /*-----------------------------------------------------------*/ /* Hardware specifics. */ #define portBYTE_ALIGNMENT 8 #define portSTACK_GROWTH -1 -#define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ ) +#define portTICK_RATE_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ ) /*-----------------------------------------------------------*/ /* Critical section management. */ @@ -123,7 +127,7 @@ ensure API function and interrupt entry is as fast and as simple as possible. */ #ifdef configASSERT #define portDISABLE_INTERRUPTS() \ { \ - unsigned long ulStatus; \ + uint32_t ulStatus; \ \ /* Mask interrupts at and below the kernel interrupt priority. */ \ ulStatus = _CP0_GET_STATUS(); \ @@ -138,7 +142,7 @@ ensure API function and interrupt entry is as fast and as simple as possible. */ #else /* configASSERT */ #define portDISABLE_INTERRUPTS() \ { \ - unsigned long ulStatus; \ + uint32_t ulStatus; \ \ /* Mask interrupts at and below the kernel interrupt priority. */ \ ulStatus = _CP0_GET_STATUS(); \ @@ -149,7 +153,7 @@ ensure API function and interrupt entry is as fast and as simple as possible. */ #define portENABLE_INTERRUPTS() \ { \ -unsigned long ulStatus; \ +uint32_t ulStatus; \ \ /* Unmask all interrupts. */ \ ulStatus = _CP0_GET_STATUS(); \ @@ -164,8 +168,8 @@ extern void vTaskExitCritical( void ); #define portENTER_CRITICAL() vTaskEnterCritical() #define portEXIT_CRITICAL() vTaskExitCritical() -extern unsigned portBASE_TYPE uxPortSetInterruptMaskFromISR(); -extern void vPortClearInterruptMaskFromISR( unsigned portBASE_TYPE ); +extern UBaseType_t uxPortSetInterruptMaskFromISR(); +extern void vPortClearInterruptMaskFromISR( UBaseType_t ); #define portSET_INTERRUPT_MASK_FROM_ISR() uxPortSetInterruptMaskFromISR() #define portCLEAR_INTERRUPT_MASK_FROM_ISR( uxSavedStatusRegister ) vPortClearInterruptMaskFromISR( uxSavedStatusRegister ) @@ -192,7 +196,7 @@ extern void vPortClearInterruptMaskFromISR( unsigned portBASE_TYPE ); #define portYIELD() \ { \ -unsigned long ulCause; \ +uint32_t ulCause; \ \ /* Trigger software interrupt. */ \ ulCause = _CP0_GET_CAUSE(); \ diff --git a/FreeRTOS/Source/portable/MPLAB/PIC32MZ/port.c b/FreeRTOS/Source/portable/MPLAB/PIC32MZ/port.c index 4b2e2c078..dcef42d91 100644 --- a/FreeRTOS/Source/portable/MPLAB/PIC32MZ/port.c +++ b/FreeRTOS/Source/portable/MPLAB/PIC32MZ/port.c @@ -144,7 +144,7 @@ task stack, not the ISR stack). */ the ISR stack. */ #define portISR_STACK_FILL_BYTE 0xee - static const unsigned char ucExpectedStackBytes[] = { + static const uint8_t ucExpectedStackBytes[] = { portISR_STACK_FILL_BYTE, portISR_STACK_FILL_BYTE, portISR_STACK_FILL_BYTE, portISR_STACK_FILL_BYTE, \ portISR_STACK_FILL_BYTE, portISR_STACK_FILL_BYTE, portISR_STACK_FILL_BYTE, portISR_STACK_FILL_BYTE, \ portISR_STACK_FILL_BYTE, portISR_STACK_FILL_BYTE, portISR_STACK_FILL_BYTE, portISR_STACK_FILL_BYTE, \ @@ -184,50 +184,50 @@ static void prvTaskExitError( void ); /* Records the interrupt nesting depth. This is initialised to one as it is decremented to 0 when the first task starts. */ -volatile unsigned portBASE_TYPE uxInterruptNesting = 0x01; +volatile UBaseType_t uxInterruptNesting = 0x01; /* Stores the task stack pointer when a switch is made to use the system stack. */ -unsigned portBASE_TYPE uxSavedTaskStackPointer = 0; +UBaseType_t uxSavedTaskStackPointer = 0; /* The stack used by interrupt service routines that cause a context switch. */ -portSTACK_TYPE xISRStack[ configISR_STACK_SIZE ] = { 0 }; +StackType_t xISRStack[ configISR_STACK_SIZE ] = { 0 }; /* The top of stack value ensures there is enough space to store 6 registers on the callers stack, as some functions seem to want to do this. */ -const portSTACK_TYPE * const xISRStackTop = &( xISRStack[ configISR_STACK_SIZE - 7 ] ); +const StackType_t * const xISRStackTop = &( xISRStack[ configISR_STACK_SIZE - 7 ] ); /*-----------------------------------------------------------*/ /* * See header file for description. */ -portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) +StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) { /* Ensure byte alignment is maintained when leaving this function. */ pxTopOfStack--; - *pxTopOfStack = (portSTACK_TYPE) 0xDEADBEEF; + *pxTopOfStack = (StackType_t) 0xDEADBEEF; pxTopOfStack--; - *pxTopOfStack = (portSTACK_TYPE) 0x12345678; /* Word to which the stack pointer will be left pointing after context restore. */ + *pxTopOfStack = (StackType_t) 0x12345678; /* Word to which the stack pointer will be left pointing after context restore. */ pxTopOfStack--; - *pxTopOfStack = (portSTACK_TYPE) _CP0_GET_CAUSE(); + *pxTopOfStack = (StackType_t) _CP0_GET_CAUSE(); pxTopOfStack--; - *pxTopOfStack = (portSTACK_TYPE) portINITIAL_SR;/* CP0_STATUS */ + *pxTopOfStack = (StackType_t) portINITIAL_SR;/* CP0_STATUS */ pxTopOfStack--; - *pxTopOfStack = (portSTACK_TYPE) pxCode; /* CP0_EPC */ + *pxTopOfStack = (StackType_t) pxCode; /* CP0_EPC */ pxTopOfStack -= 7; /* Includes space for AC1 - AC3. */ - *pxTopOfStack = (portSTACK_TYPE) 0x00000000; /* DSPControl */ + *pxTopOfStack = (StackType_t) 0x00000000; /* DSPControl */ pxTopOfStack--; - *pxTopOfStack = (portSTACK_TYPE) portTASK_RETURN_ADDRESS; /* ra */ + *pxTopOfStack = (StackType_t) portTASK_RETURN_ADDRESS; /* ra */ pxTopOfStack -= 15; - *pxTopOfStack = (portSTACK_TYPE) pvParameters; /* Parameters to pass in. */ + *pxTopOfStack = (StackType_t) pvParameters; /* Parameters to pass in. */ pxTopOfStack -= 15; return pxTopOfStack; @@ -259,7 +259,7 @@ static void prvTaskExitError( void ) */ __attribute__(( weak )) void vApplicationSetupTickTimerInterrupt( void ) { -const unsigned long ulCompareMatch = ( (configPERIPHERAL_CLOCK_HZ / portTIMER_PRESCALE) / configTICK_RATE_HZ ) - 1; +const uint32_t ulCompareMatch = ( (configPERIPHERAL_CLOCK_HZ / portTIMER_PRESCALE) / configTICK_RATE_HZ ) - 1; T1CON = 0x0000; T1CONbits.TCKPS = portPRESCALE_BITS; @@ -285,7 +285,7 @@ void vPortEndScheduler(void) } /*-----------------------------------------------------------*/ -portBASE_TYPE xPortStartScheduler( void ) +BaseType_t xPortStartScheduler( void ) { extern void vPortStartFirstTask( void ); extern void *pxCurrentTCB; @@ -314,7 +314,7 @@ extern void *pxCurrentTCB; /* Kick off the highest priority task that has been created so far. Its stack location is loaded into uxSavedTaskStackPointer. */ - uxSavedTaskStackPointer = *( unsigned portBASE_TYPE * ) pxCurrentTCB; + uxSavedTaskStackPointer = *( UBaseType_t * ) pxCurrentTCB; vPortStartFirstTask(); /* Should never get here as the tasks will now be executing! Call the task @@ -329,7 +329,7 @@ extern void *pxCurrentTCB; void vPortIncrementTick( void ) { -unsigned portBASE_TYPE uxSavedStatus; +UBaseType_t uxSavedStatus; uxSavedStatus = uxPortSetInterruptMaskFromISR(); { @@ -349,9 +349,9 @@ unsigned portBASE_TYPE uxSavedStatus; } /*-----------------------------------------------------------*/ -unsigned portBASE_TYPE uxPortSetInterruptMaskFromISR( void ) +UBaseType_t uxPortSetInterruptMaskFromISR( void ) { -unsigned portBASE_TYPE uxSavedStatusRegister; +UBaseType_t uxSavedStatusRegister; __builtin_disable_interrupts(); uxSavedStatusRegister = _CP0_GET_STATUS() | 0x01; @@ -367,7 +367,7 @@ unsigned portBASE_TYPE uxSavedStatusRegister; } /*-----------------------------------------------------------*/ -void vPortClearInterruptMaskFromISR( unsigned portBASE_TYPE uxSavedStatusRegister ) +void vPortClearInterruptMaskFromISR( UBaseType_t uxSavedStatusRegister ) { _CP0_SET_STATUS( uxSavedStatusRegister ); } diff --git a/FreeRTOS/Source/portable/MPLAB/PIC32MZ/portmacro.h b/FreeRTOS/Source/portable/MPLAB/PIC32MZ/portmacro.h index cd4ca1927..aa9cde999 100644 --- a/FreeRTOS/Source/portable/MPLAB/PIC32MZ/portmacro.h +++ b/FreeRTOS/Source/portable/MPLAB/PIC32MZ/portmacro.h @@ -89,27 +89,31 @@ extern "C" { #define portDOUBLE double #define portLONG long #define portSHORT short -#define portSTACK_TYPE unsigned long +#define portSTACK_TYPE uint32_t #define portBASE_TYPE long +typedef portSTACK_TYPE StackType_t; +typedef long BaseType_t; +typedef unsigned long UBaseType_t; + #if( configUSE_16_BIT_TICKS == 1 ) - typedef unsigned portSHORT portTickType; - #define portMAX_DELAY ( portTickType ) 0xffff + typedef uint16_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffff #else - typedef unsigned long portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffffUL + typedef uint32_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffffffffUL #endif /*-----------------------------------------------------------*/ /* Hardware specifics. */ #define portBYTE_ALIGNMENT 8 #define portSTACK_GROWTH -1 -#define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ ) +#define portTICK_RATE_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ ) /*-----------------------------------------------------------*/ /* Critical section management. */ #define portIPL_SHIFT ( 10UL ) -/* Don't straddle the CEE bit. Interrupts calling FreeRTOS functions should +/* Don't straddle the CEE bit. Interrupts calling FreeRTOS functions should never have higher IPL bits set anyway. */ #define portALL_IPL_BITS ( 0x7FUL << portIPL_SHIFT ) #define portSW0_BIT ( 0x01 << 8 ) @@ -125,7 +129,7 @@ ensure API function and interrupt entry is as fast and as simple as possible. */ #ifdef configASSERT #define portDISABLE_INTERRUPTS() \ { \ - unsigned long ulStatus; \ + uint32_t ulStatus; \ \ /* Mask interrupts at and below the kernel interrupt priority. */ \ ulStatus = _CP0_GET_STATUS(); \ @@ -140,7 +144,7 @@ ensure API function and interrupt entry is as fast and as simple as possible. */ #else /* configASSERT */ #define portDISABLE_INTERRUPTS() \ { \ - unsigned long ulStatus; \ + uint32_t ulStatus; \ \ /* Mask interrupts at and below the kernel interrupt priority. */ \ ulStatus = _CP0_GET_STATUS(); \ @@ -151,7 +155,7 @@ ensure API function and interrupt entry is as fast and as simple as possible. */ #define portENABLE_INTERRUPTS() \ { \ -unsigned long ulStatus; \ +uint32_t ulStatus; \ \ /* Unmask all interrupts. */ \ ulStatus = _CP0_GET_STATUS(); \ @@ -166,8 +170,8 @@ extern void vTaskExitCritical( void ); #define portENTER_CRITICAL() vTaskEnterCritical() #define portEXIT_CRITICAL() vTaskExitCritical() -extern unsigned portBASE_TYPE uxPortSetInterruptMaskFromISR(); -extern void vPortClearInterruptMaskFromISR( unsigned portBASE_TYPE ); +extern UBaseType_t uxPortSetInterruptMaskFromISR(); +extern void vPortClearInterruptMaskFromISR( UBaseType_t ); #define portSET_INTERRUPT_MASK_FROM_ISR() uxPortSetInterruptMaskFromISR() #define portCLEAR_INTERRUPT_MASK_FROM_ISR( uxSavedStatusRegister ) vPortClearInterruptMaskFromISR( uxSavedStatusRegister ) @@ -194,7 +198,7 @@ extern void vPortClearInterruptMaskFromISR( unsigned portBASE_TYPE ); #define portYIELD() \ { \ -unsigned long ulCause; \ +uint32_t ulCause; \ \ /* Trigger software interrupt. */ \ ulCause = _CP0_GET_CAUSE(); \ diff --git a/FreeRTOS/Source/portable/MSVC-MingW/port.c b/FreeRTOS/Source/portable/MSVC-MingW/port.c index e7d98984d..603d771b1 100644 --- a/FreeRTOS/Source/portable/MSVC-MingW/port.c +++ b/FreeRTOS/Source/portable/MSVC-MingW/port.c @@ -74,8 +74,8 @@ #pragma comment(lib, "winmm.lib") #endif -#define portMAX_INTERRUPTS ( ( unsigned long ) sizeof( unsigned long ) * 8UL ) /* The number of bits in an unsigned long. */ -#define portNO_CRITICAL_NESTING ( ( unsigned long ) 0 ) +#define portMAX_INTERRUPTS ( ( uint32_t ) sizeof( uint32_t ) * 8UL ) /* The number of bits in an uint32_t. */ +#define portNO_CRITICAL_NESTING ( ( uint32_t ) 0 ) /* * Created as a high priority thread, this function uses a timer to simulate @@ -95,8 +95,8 @@ static void prvProcessSimulatedInterrupts( void ); * Interrupt handlers used by the kernel itself. These are executed from the * simulated interrupt handler thread. */ -static unsigned long prvProcessYieldInterrupt( void ); -static unsigned long prvProcessTickInterrupt( void ); +static uint32_t prvProcessYieldInterrupt( void ); +static uint32_t prvProcessTickInterrupt( void ); /* * Called when the process exits to let Windows know the high timer resolution @@ -120,7 +120,7 @@ typedef struct /* Simulated interrupts waiting to be processed. This is a bit mask where each bit represents one interrupt, so a maximum of 32 interrupts can be simulated. */ -static volatile unsigned long ulPendingInterrupts = 0UL; +static volatile uint32_t ulPendingInterrupts = 0UL; /* An event used to inform the simulated interrupt processing thread (a high priority thread that simulated interrupt processing) that an interrupt is @@ -138,30 +138,30 @@ ulCriticalNesting will get set to zero when the first task runs. This initialisation is probably not critical in this simulated environment as the simulated interrupt handlers do not get created until the FreeRTOS scheduler is started anyway. */ -static unsigned long ulCriticalNesting = 9999UL; +static uint32_t ulCriticalNesting = 9999UL; /* Handlers for all the simulated software interrupts. The first two positions are used for the Yield and Tick interrupts so are handled slightly differently, all the other interrupts can be user defined. */ -static unsigned long (*ulIsrHandler[ portMAX_INTERRUPTS ])( void ) = { 0 }; +static uint32_t (*ulIsrHandler[ portMAX_INTERRUPTS ])( void ) = { 0 }; /* Pointer to the TCB of the currently executing task. */ extern void *pxCurrentTCB; /* Used to ensure nothing is processed during the startup sequence. */ -static portBASE_TYPE xPortRunning = pdFALSE; +static BaseType_t xPortRunning = pdFALSE; /*-----------------------------------------------------------*/ static DWORD WINAPI prvSimulatedPeripheralTimer( LPVOID lpParameter ) { -portTickType xMinimumWindowsBlockTime; +TickType_t xMinimumWindowsBlockTime; TIMECAPS xTimeCaps; /* Set the timer resolution to the maximum possible. */ if( timeGetDevCaps( &xTimeCaps, sizeof( xTimeCaps ) ) == MMSYSERR_NOERROR ) { - xMinimumWindowsBlockTime = ( portTickType ) xTimeCaps.wPeriodMin; + xMinimumWindowsBlockTime = ( TickType_t ) xTimeCaps.wPeriodMin; timeBeginPeriod( xTimeCaps.wPeriodMin ); /* Register an exit handler so the timeBeginPeriod() function can be @@ -170,7 +170,7 @@ TIMECAPS xTimeCaps; } else { - xMinimumWindowsBlockTime = ( portTickType ) 20; + xMinimumWindowsBlockTime = ( TickType_t ) 20; } /* Just to prevent compiler warnings. */ @@ -237,10 +237,10 @@ TIMECAPS xTimeCaps; } /*-----------------------------------------------------------*/ -portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) +StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) { xThreadState *pxThreadState = NULL; -signed char *pcTopOfStack = ( char * ) pxTopOfStack; +int8_t *pcTopOfStack = ( int8_t * ) pxTopOfStack; /* In this simulated case a stack is not initialised, but instead a thread is created that will execute the task being created. The thread handles @@ -257,14 +257,14 @@ signed char *pcTopOfStack = ( char * ) pxTopOfStack; SetThreadPriorityBoost( pxThreadState->pvThread, TRUE ); SetThreadPriority( pxThreadState->pvThread, THREAD_PRIORITY_IDLE ); - return ( portSTACK_TYPE * ) pxThreadState; + return ( StackType_t * ) pxThreadState; } /*-----------------------------------------------------------*/ -portBASE_TYPE xPortStartScheduler( void ) +BaseType_t xPortStartScheduler( void ) { void *pvHandle; -long lSuccess = pdPASS; +int32_t lSuccess = pdPASS; xThreadState *pxThreadState; /* Install the interrupt handlers used by the scheduler itself. */ @@ -316,7 +316,7 @@ xThreadState *pxThreadState; /* Start the highest priority task by obtaining its associated thread state structure, in which is stored the thread handle. */ - pxThreadState = ( xThreadState * ) *( ( unsigned long * ) pxCurrentTCB ); + pxThreadState = ( xThreadState * ) *( ( uint32_t * ) pxCurrentTCB ); ulCriticalNesting = portNO_CRITICAL_NESTING; /* Bump up the priority of the thread that is going to run, in the @@ -335,19 +335,19 @@ xThreadState *pxThreadState; } /*-----------------------------------------------------------*/ -static unsigned long prvProcessYieldInterrupt( void ) +static uint32_t prvProcessYieldInterrupt( void ) { return pdTRUE; } /*-----------------------------------------------------------*/ -static unsigned long prvProcessTickInterrupt( void ) +static uint32_t prvProcessTickInterrupt( void ) { -unsigned long ulSwitchRequired; +uint32_t ulSwitchRequired; /* Process the tick itself. */ configASSERT( xPortRunning ); - ulSwitchRequired = ( unsigned long ) xTaskIncrementTick(); + ulSwitchRequired = ( uint32_t ) xTaskIncrementTick(); return ulSwitchRequired; } @@ -355,7 +355,7 @@ unsigned long ulSwitchRequired; static void prvProcessSimulatedInterrupts( void ) { -unsigned long ulSwitchRequired, i; +uint32_t ulSwitchRequired, i; xThreadState *pxThreadState; void *pvObjectList[ 2 ]; @@ -416,12 +416,12 @@ void *pvObjectList[ 2 ]; if( pvOldCurrentTCB != pxCurrentTCB ) { /* Suspend the old thread. */ - pxThreadState = ( xThreadState *) *( ( unsigned long * ) pvOldCurrentTCB ); + pxThreadState = ( xThreadState *) *( ( uint32_t * ) pvOldCurrentTCB ); SuspendThread( pxThreadState->pvThread ); /* Obtain the state of the task now selected to enter the Running state. */ - pxThreadState = ( xThreadState * ) ( *( unsigned long *) pxCurrentTCB ); + pxThreadState = ( xThreadState * ) ( *( uint32_t *) pxCurrentTCB ); ResumeThread( pxThreadState->pvThread ); } } @@ -434,13 +434,13 @@ void *pvObjectList[ 2 ]; void vPortDeleteThread( void *pvTaskToDelete ) { xThreadState *pxThreadState; -unsigned long ulErrorCode; +uint32_t ulErrorCode; /* Remove compiler warnings if configASSERT() is not defined. */ ( void ) ulErrorCode; /* Find the handle of the thread being deleted. */ - pxThreadState = ( xThreadState * ) ( *( unsigned long *) pvTaskToDelete ); + pxThreadState = ( xThreadState * ) ( *( uint32_t *) pvTaskToDelete ); /* Check that the thread is still valid, it might have been closed by vPortCloseRunningThread() - which will be the case if the task associated @@ -461,17 +461,17 @@ unsigned long ulErrorCode; } /*-----------------------------------------------------------*/ -void vPortCloseRunningThread( void *pvTaskToDelete, volatile portBASE_TYPE *pxPendYield ) +void vPortCloseRunningThread( void *pvTaskToDelete, volatile BaseType_t *pxPendYield ) { xThreadState *pxThreadState; void *pvThread; -unsigned long ulErrorCode; +uint32_t ulErrorCode; /* Remove compiler warnings if configASSERT() is not defined. */ ( void ) ulErrorCode; /* Find the handle of the thread being deleted. */ - pxThreadState = ( xThreadState * ) ( *( unsigned long *) pvTaskToDelete ); + pxThreadState = ( xThreadState * ) ( *( uint32_t *) pvTaskToDelete ); pvThread = pxThreadState->pvThread; /* Raise the Windows priority of the thread to ensure the FreeRTOS scheduler @@ -503,7 +503,7 @@ void vPortEndScheduler( void ) } /*-----------------------------------------------------------*/ -void vPortGenerateSimulatedInterrupt( unsigned long ulInterruptNumber ) +void vPortGenerateSimulatedInterrupt( uint32_t ulInterruptNumber ) { configASSERT( xPortRunning ); @@ -526,7 +526,7 @@ void vPortGenerateSimulatedInterrupt( unsigned long ulInterruptNumber ) } /*-----------------------------------------------------------*/ -void vPortSetInterruptHandler( unsigned long ulInterruptNumber, unsigned long (*pvHandler)( void ) ) +void vPortSetInterruptHandler( uint32_t ulInterruptNumber, uint32_t (*pvHandler)( void ) ) { if( ulInterruptNumber < portMAX_INTERRUPTS ) { @@ -562,7 +562,7 @@ void vPortEnterCritical( void ) void vPortExitCritical( void ) { -long lMutexNeedsReleasing; +int32_t lMutexNeedsReleasing; /* The interrupt event mutex should already be held by this thread as it was obtained on entry to the critical section. */ diff --git a/FreeRTOS/Source/portable/MSVC-MingW/portmacro.h b/FreeRTOS/Source/portable/MSVC-MingW/portmacro.h index 528e04e5e..791c1f788 100644 --- a/FreeRTOS/Source/portable/MSVC-MingW/portmacro.h +++ b/FreeRTOS/Source/portable/MSVC-MingW/portmacro.h @@ -1,5 +1,5 @@ /* - FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. + FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. All rights reserved VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. @@ -77,25 +77,30 @@ #define portDOUBLE double #define portLONG long #define portSHORT short -#define portSTACK_TYPE unsigned portLONG -#define portBASE_TYPE portLONG +#define portSTACK_TYPE uint32_t +#define portBASE_TYPE long + +typedef portSTACK_TYPE StackType_t; +typedef long BaseType_t; +typedef unsigned long UBaseType_t; + #if( configUSE_16_BIT_TICKS == 1 ) - typedef unsigned portSHORT portTickType; - #define portMAX_DELAY ( portTickType ) 0xffff + typedef uint16_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffff #else - typedef unsigned portLONG portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffffUL + typedef uint32_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffffffffUL #endif /* Hardware specifics. */ #define portSTACK_GROWTH ( -1 ) -#define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ ) +#define portTICK_RATE_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ ) #define portBYTE_ALIGNMENT 4 #define portYIELD() vPortGenerateSimulatedInterrupt( portINTERRUPT_YIELD ) -void vPortCloseRunningThread( void *pvTaskToDelete, volatile portBASE_TYPE *pxPendYield ); +void vPortCloseRunningThread( void *pvTaskToDelete, volatile BaseType_t *pxPendYield ); void vPortDeleteThread( void *pvThreadToDelete ); #define portCLEAN_UP_TCB( pxTCB ) vPortDeleteThread( pxTCB ) #define portPRE_TASK_DELETE_HOOK( pvTaskToDelete, pxPendYield ) vPortCloseRunningThread( ( pvTaskToDelete ), ( pxPendYield ) ) @@ -153,7 +158,7 @@ void vPortExitCritical( void ); * Each bit can be used to represent an individual interrupt - with the first * two bits being used for the Yield and Tick interrupts respectively. */ -void vPortGenerateSimulatedInterrupt( unsigned long ulInterruptNumber ); +void vPortGenerateSimulatedInterrupt( uint32_t ulInterruptNumber ); /* * Install an interrupt handler to be called by the simulated interrupt handler @@ -164,6 +169,6 @@ void vPortGenerateSimulatedInterrupt( unsigned long ulInterruptNumber ); * Interrupt handler functions must return a non-zero value if executing the * handler resulted in a task switch being required. */ -void vPortSetInterruptHandler( unsigned long ulInterruptNumber, unsigned long (*pvHandler)( void ) ); +void vPortSetInterruptHandler( uint32_t ulInterruptNumber, uint32_t (*pvHandler)( void ) ); #endif diff --git a/FreeRTOS/Source/portable/MemMang/heap_1.c b/FreeRTOS/Source/portable/MemMang/heap_1.c index 6c4c8c058..2d9ef7a37 100644 --- a/FreeRTOS/Source/portable/MemMang/heap_1.c +++ b/FreeRTOS/Source/portable/MemMang/heap_1.c @@ -87,7 +87,7 @@ task.h is included from an application file. */ #define configADJUSTED_HEAP_SIZE ( configTOTAL_HEAP_SIZE - portBYTE_ALIGNMENT ) /* Allocate the memory for the heap. */ -static unsigned char ucHeap[ configTOTAL_HEAP_SIZE ]; +static uint8_t ucHeap[ configTOTAL_HEAP_SIZE ]; static size_t xNextFreeByte = ( size_t ) 0; /*-----------------------------------------------------------*/ @@ -95,7 +95,7 @@ static size_t xNextFreeByte = ( size_t ) 0; void *pvPortMalloc( size_t xWantedSize ) { void *pvReturn = NULL; -static unsigned char *pucAlignedHeap = NULL; +static uint8_t *pucAlignedHeap = NULL; /* Ensure that blocks are always aligned to the required number of bytes. */ #if portBYTE_ALIGNMENT != 1 @@ -111,7 +111,7 @@ static unsigned char *pucAlignedHeap = NULL; if( pucAlignedHeap == NULL ) { /* Ensure the heap starts on a correctly aligned boundary. */ - pucAlignedHeap = ( unsigned char * ) ( ( ( portPOINTER_SIZE_TYPE ) &ucHeap[ portBYTE_ALIGNMENT ] ) & ( ( portPOINTER_SIZE_TYPE ) ~portBYTE_ALIGNMENT_MASK ) ); + pucAlignedHeap = ( uint8_t * ) ( ( ( portPOINTER_SIZE_TYPE ) &ucHeap[ portBYTE_ALIGNMENT ] ) & ( ( portPOINTER_SIZE_TYPE ) ~portBYTE_ALIGNMENT_MASK ) ); } /* Check there is enough room left for the allocation. */ diff --git a/FreeRTOS/Source/portable/MemMang/heap_2.c b/FreeRTOS/Source/portable/MemMang/heap_2.c index 64391bea3..d618e2d58 100644 --- a/FreeRTOS/Source/portable/MemMang/heap_2.c +++ b/FreeRTOS/Source/portable/MemMang/heap_2.c @@ -1,5 +1,5 @@ /* - FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. + FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. All rights reserved VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. @@ -87,13 +87,13 @@ task.h is included from an application file. */ /* A few bytes might be lost to byte aligning the heap start address. */ #define configADJUSTED_HEAP_SIZE ( configTOTAL_HEAP_SIZE - portBYTE_ALIGNMENT ) -/* +/* * Initialises the heap structures before their first use. */ static void prvHeapInit( void ); /* Allocate the memory for the heap. */ -static unsigned char ucHeap[ configTOTAL_HEAP_SIZE ]; +static uint8_t ucHeap[ configTOTAL_HEAP_SIZE ]; /* Define the linked list structure. This is used to link free blocks in order of their size. */ @@ -101,14 +101,14 @@ typedef struct A_BLOCK_LINK { struct A_BLOCK_LINK *pxNextFreeBlock; /*<< The next free block in the list. */ size_t xBlockSize; /*<< The size of the free block. */ -} xBlockLink; +} BlockLink_t; -static const unsigned short heapSTRUCT_SIZE = ( ( sizeof ( xBlockLink ) + ( portBYTE_ALIGNMENT - 1 ) ) & ~portBYTE_ALIGNMENT_MASK ); +static const uint16_t heapSTRUCT_SIZE = ( ( sizeof ( BlockLink_t ) + ( portBYTE_ALIGNMENT - 1 ) ) & ~portBYTE_ALIGNMENT_MASK ); #define heapMINIMUM_BLOCK_SIZE ( ( size_t ) ( heapSTRUCT_SIZE * 2 ) ) /* Create a couple of list links to mark the start and end of the list. */ -static xBlockLink xStart, xEnd; +static BlockLink_t xStart, xEnd; /* Keeps track of the number of free bytes remaining, but says nothing about fragmentation. */ @@ -123,7 +123,7 @@ static size_t xFreeBytesRemaining = configADJUSTED_HEAP_SIZE; */ #define prvInsertBlockIntoFreeList( pxBlockToInsert ) \ { \ -xBlockLink *pxIterator; \ +BlockLink_t *pxIterator; \ size_t xBlockSize; \ \ xBlockSize = pxBlockToInsert->xBlockSize; \ @@ -144,8 +144,8 @@ size_t xBlockSize; \ void *pvPortMalloc( size_t xWantedSize ) { -xBlockLink *pxBlock, *pxPreviousBlock, *pxNewBlockLink; -static portBASE_TYPE xHeapHasBeenInitialised = pdFALSE; +BlockLink_t *pxBlock, *pxPreviousBlock, *pxNewBlockLink; +static BaseType_t xHeapHasBeenInitialised = pdFALSE; void *pvReturn = NULL; vTaskSuspendAll(); @@ -158,7 +158,7 @@ void *pvReturn = NULL; xHeapHasBeenInitialised = pdTRUE; } - /* The wanted size is increased so it can contain a xBlockLink + /* The wanted size is increased so it can contain a BlockLink_t structure in addition to the requested amount of bytes. */ if( xWantedSize > 0 ) { @@ -187,9 +187,9 @@ void *pvReturn = NULL; /* If we found the end marker then a block of adequate size was not found. */ if( pxBlock != &xEnd ) { - /* Return the memory space - jumping over the xBlockLink structure + /* Return the memory space - jumping over the BlockLink_t structure at its start. */ - pvReturn = ( void * ) ( ( ( unsigned char * ) pxPreviousBlock->pxNextFreeBlock ) + heapSTRUCT_SIZE ); + pvReturn = ( void * ) ( ( ( uint8_t * ) pxPreviousBlock->pxNextFreeBlock ) + heapSTRUCT_SIZE ); /* This block is being returned for use so must be taken out of the list of free blocks. */ @@ -201,7 +201,7 @@ void *pvReturn = NULL; /* This block is to be split into two. Create a new block following the number of bytes requested. The void cast is used to prevent byte alignment warnings from the compiler. */ - pxNewBlockLink = ( void * ) ( ( ( unsigned char * ) pxBlock ) + xWantedSize ); + pxNewBlockLink = ( void * ) ( ( ( uint8_t * ) pxBlock ) + xWantedSize ); /* Calculate the sizes of two blocks split from the single block. */ @@ -215,7 +215,7 @@ void *pvReturn = NULL; xFreeBytesRemaining -= pxBlock->xBlockSize; } } - + traceMALLOC( pvReturn, xWantedSize ); } xTaskResumeAll(); @@ -236,23 +236,23 @@ void *pvReturn = NULL; void vPortFree( void *pv ) { -unsigned char *puc = ( unsigned char * ) pv; -xBlockLink *pxLink; +uint8_t *puc = ( uint8_t * ) pv; +BlockLink_t *pxLink; if( pv != NULL ) { - /* The memory being freed will have an xBlockLink structure immediately + /* The memory being freed will have an BlockLink_t structure immediately before it. */ puc -= heapSTRUCT_SIZE; - /* This unexpected casting is to keep some compilers from issuing + /* This unexpected casting is to keep some compilers from issuing byte alignment warnings. */ pxLink = ( void * ) puc; vTaskSuspendAll(); { /* Add this block to the list of free blocks. */ - prvInsertBlockIntoFreeList( ( ( xBlockLink * ) pxLink ) ); + prvInsertBlockIntoFreeList( ( ( BlockLink_t * ) pxLink ) ); xFreeBytesRemaining += pxLink->xBlockSize; traceFREE( pv, pxLink->xBlockSize ); } @@ -275,11 +275,11 @@ void vPortInitialiseBlocks( void ) static void prvHeapInit( void ) { -xBlockLink *pxFirstFreeBlock; -unsigned char *pucAlignedHeap; +BlockLink_t *pxFirstFreeBlock; +uint8_t *pucAlignedHeap; /* Ensure the heap starts on a correctly aligned boundary. */ - pucAlignedHeap = ( unsigned char * ) ( ( ( portPOINTER_SIZE_TYPE ) &ucHeap[ portBYTE_ALIGNMENT ] ) & ( ( portPOINTER_SIZE_TYPE ) ~portBYTE_ALIGNMENT_MASK ) ); + pucAlignedHeap = ( uint8_t * ) ( ( ( portPOINTER_SIZE_TYPE ) &ucHeap[ portBYTE_ALIGNMENT ] ) & ( ( portPOINTER_SIZE_TYPE ) ~portBYTE_ALIGNMENT_MASK ) ); /* xStart is used to hold a pointer to the first item in the list of free blocks. The void cast is used to prevent compiler warnings. */ diff --git a/FreeRTOS/Source/portable/MemMang/heap_4.c b/FreeRTOS/Source/portable/MemMang/heap_4.c index 7a2f98ed9..e52ce6d4a 100644 --- a/FreeRTOS/Source/portable/MemMang/heap_4.c +++ b/FreeRTOS/Source/portable/MemMang/heap_4.c @@ -93,7 +93,7 @@ task.h is included from an application file. */ #define heapADJUSTED_HEAP_SIZE ( configTOTAL_HEAP_SIZE - portBYTE_ALIGNMENT ) /* Allocate the memory for the heap. */ -static unsigned char ucHeap[ configTOTAL_HEAP_SIZE ]; +static uint8_t ucHeap[ configTOTAL_HEAP_SIZE ]; /* Define the linked list structure. This is used to link free blocks in order of their memory address. */ @@ -101,7 +101,7 @@ typedef struct A_BLOCK_LINK { struct A_BLOCK_LINK *pxNextFreeBlock; /*<< The next free block in the list. */ size_t xBlockSize; /*<< The size of the free block. */ -} xBlockLink; +} BlockLink_t; /*-----------------------------------------------------------*/ @@ -111,7 +111,7 @@ typedef struct A_BLOCK_LINK * the block in front it and/or the block behind it if the memory blocks are * adjacent to each other. */ -static void prvInsertBlockIntoFreeList( xBlockLink *pxBlockToInsert ); +static void prvInsertBlockIntoFreeList( BlockLink_t *pxBlockToInsert ); /* * Called automatically to setup the required heap structures the first time @@ -123,13 +123,13 @@ static void prvHeapInit( void ); /* The size of the structure placed at the beginning of each allocated memory block must by correctly byte aligned. */ -static const unsigned short heapSTRUCT_SIZE = ( ( sizeof ( xBlockLink ) + ( portBYTE_ALIGNMENT - 1 ) ) & ~portBYTE_ALIGNMENT_MASK ); +static const uint16_t heapSTRUCT_SIZE = ( ( sizeof ( BlockLink_t ) + ( portBYTE_ALIGNMENT - 1 ) ) & ~portBYTE_ALIGNMENT_MASK ); /* Ensure the pxEnd pointer will end up on the correct byte alignment. */ static const size_t xTotalHeapSize = ( ( size_t ) heapADJUSTED_HEAP_SIZE ) & ( ( size_t ) ~portBYTE_ALIGNMENT_MASK ); /* Create a couple of list links to mark the start and end of the list. */ -static xBlockLink xStart, *pxEnd = NULL; +static BlockLink_t xStart, *pxEnd = NULL; /* Keeps track of the number of free bytes remaining, but says nothing about fragmentation. */ @@ -137,7 +137,7 @@ static size_t xFreeBytesRemaining = ( ( size_t ) heapADJUSTED_HEAP_SIZE ) & ( ( static size_t xMinimumEverFreeBytesRemaining = ( ( size_t ) heapADJUSTED_HEAP_SIZE ) & ( ( size_t ) ~portBYTE_ALIGNMENT_MASK ); /* Gets set to the top bit of an size_t type. When this bit in the xBlockSize -member of an xBlockLink structure is set then the block belongs to the +member of an BlockLink_t structure is set then the block belongs to the application. When the bit is free the block is still part of the free heap space. */ static size_t xBlockAllocatedBit = 0; @@ -146,7 +146,7 @@ static size_t xBlockAllocatedBit = 0; void *pvPortMalloc( size_t xWantedSize ) { -xBlockLink *pxBlock, *pxPreviousBlock, *pxNewBlockLink; +BlockLink_t *pxBlock, *pxPreviousBlock, *pxNewBlockLink; void *pvReturn = NULL; vTaskSuspendAll(); @@ -163,12 +163,12 @@ void *pvReturn = NULL; } /* Check the requested block size is not so large that the top bit is - set. The top bit of the block size member of the xBlockLink structure + set. The top bit of the block size member of the BlockLink_t structure is used to determine who owns the block - the application or the kernel, so it must be free. */ if( ( xWantedSize & xBlockAllocatedBit ) == 0 ) { - /* The wanted size is increased so it can contain a xBlockLink + /* The wanted size is increased so it can contain a BlockLink_t structure in addition to the requested amount of bytes. */ if( xWantedSize > 0 ) { @@ -208,8 +208,8 @@ void *pvReturn = NULL; if( pxBlock != pxEnd ) { /* Return the memory space pointed to - jumping over the - xBlockLink structure at its start. */ - pvReturn = ( void * ) ( ( ( unsigned char * ) pxPreviousBlock->pxNextFreeBlock ) + heapSTRUCT_SIZE ); + BlockLink_t structure at its start. */ + pvReturn = ( void * ) ( ( ( uint8_t * ) pxPreviousBlock->pxNextFreeBlock ) + heapSTRUCT_SIZE ); /* This block is being returned for use so must be taken out of the list of free blocks. */ @@ -223,7 +223,7 @@ void *pvReturn = NULL; block following the number of bytes requested. The void cast is used to prevent byte alignment warnings from the compiler. */ - pxNewBlockLink = ( void * ) ( ( ( unsigned char * ) pxBlock ) + xWantedSize ); + pxNewBlockLink = ( void * ) ( ( ( uint8_t * ) pxBlock ) + xWantedSize ); /* Calculate the sizes of two blocks split from the single block. */ @@ -293,12 +293,12 @@ void *pvReturn = NULL; void vPortFree( void *pv ) { -unsigned char *puc = ( unsigned char * ) pv; -xBlockLink *pxLink; +uint8_t *puc = ( uint8_t * ) pv; +BlockLink_t *pxLink; if( pv != NULL ) { - /* The memory being freed will have an xBlockLink structure immediately + /* The memory being freed will have an BlockLink_t structure immediately before it. */ puc -= heapSTRUCT_SIZE; @@ -321,7 +321,7 @@ xBlockLink *pxLink; { /* Add this block to the list of free blocks. */ xFreeBytesRemaining += pxLink->xBlockSize; - prvInsertBlockIntoFreeList( ( ( xBlockLink * ) pxLink ) ); + prvInsertBlockIntoFreeList( ( ( BlockLink_t * ) pxLink ) ); traceFREE( pv, pxLink->xBlockSize ); } xTaskResumeAll(); @@ -359,11 +359,11 @@ void vPortInitialiseBlocks( void ) static void prvHeapInit( void ) { -xBlockLink *pxFirstFreeBlock; -unsigned char *pucHeapEnd, *pucAlignedHeap; +BlockLink_t *pxFirstFreeBlock; +uint8_t *pucHeapEnd, *pucAlignedHeap; /* Ensure the heap starts on a correctly aligned boundary. */ - pucAlignedHeap = ( unsigned char * ) ( ( ( portPOINTER_SIZE_TYPE ) &ucHeap[ portBYTE_ALIGNMENT ] ) & ( ( portPOINTER_SIZE_TYPE ) ~portBYTE_ALIGNMENT_MASK ) ); + pucAlignedHeap = ( uint8_t * ) ( ( ( portPOINTER_SIZE_TYPE ) &ucHeap[ portBYTE_ALIGNMENT ] ) & ( ( portPOINTER_SIZE_TYPE ) ~portBYTE_ALIGNMENT_MASK ) ); /* xStart is used to hold a pointer to the first item in the list of free blocks. The void cast is used to prevent compiler warnings. */ @@ -375,7 +375,7 @@ unsigned char *pucHeapEnd, *pucAlignedHeap; pucHeapEnd = pucAlignedHeap + xTotalHeapSize; pucHeapEnd -= heapSTRUCT_SIZE; pxEnd = ( void * ) pucHeapEnd; - configASSERT( ( ( ( unsigned long ) pxEnd ) & ( ( unsigned long ) portBYTE_ALIGNMENT_MASK ) ) == 0UL ); + configASSERT( ( ( ( uint32_t ) pxEnd ) & ( ( uint32_t ) portBYTE_ALIGNMENT_MASK ) ) == 0UL ); pxEnd->xBlockSize = 0; pxEnd->pxNextFreeBlock = NULL; @@ -393,10 +393,10 @@ unsigned char *pucHeapEnd, *pucAlignedHeap; } /*-----------------------------------------------------------*/ -static void prvInsertBlockIntoFreeList( xBlockLink *pxBlockToInsert ) +static void prvInsertBlockIntoFreeList( BlockLink_t *pxBlockToInsert ) { -xBlockLink *pxIterator; -unsigned char *puc; +BlockLink_t *pxIterator; +uint8_t *puc; /* Iterate through the list until a block is found that has a higher address than the block being inserted. */ @@ -407,8 +407,8 @@ unsigned char *puc; /* Do the block being inserted, and the block it is being inserted after make a contiguous block of memory? */ - puc = ( unsigned char * ) pxIterator; - if( ( puc + pxIterator->xBlockSize ) == ( unsigned char * ) pxBlockToInsert ) + puc = ( uint8_t * ) pxIterator; + if( ( puc + pxIterator->xBlockSize ) == ( uint8_t * ) pxBlockToInsert ) { pxIterator->xBlockSize += pxBlockToInsert->xBlockSize; pxBlockToInsert = pxIterator; @@ -420,8 +420,8 @@ unsigned char *puc; /* Do the block being inserted, and the block it is being inserted before make a contiguous block of memory? */ - puc = ( unsigned char * ) pxBlockToInsert; - if( ( puc + pxBlockToInsert->xBlockSize ) == ( unsigned char * ) pxIterator->pxNextFreeBlock ) + puc = ( uint8_t * ) pxBlockToInsert; + if( ( puc + pxBlockToInsert->xBlockSize ) == ( uint8_t * ) pxIterator->pxNextFreeBlock ) { if( pxIterator->pxNextFreeBlock != pxEnd ) { diff --git a/FreeRTOS/Source/portable/Paradigm/Tern_EE/large_untested/port.c b/FreeRTOS/Source/portable/Paradigm/Tern_EE/large_untested/port.c index 36c03c23d..570745f57 100644 --- a/FreeRTOS/Source/portable/Paradigm/Tern_EE/large_untested/port.c +++ b/FreeRTOS/Source/portable/Paradigm/Tern_EE/large_untested/port.c @@ -79,10 +79,10 @@ #include "portasm.h" /* The timer increments every four clocks, hence the divide by 4. */ -#define portTIMER_COMPARE ( unsigned short ) ( ( configCPU_CLOCK_HZ / configTICK_RATE_HZ ) / ( unsigned long ) 4 ) +#define portTIMER_COMPARE ( uint16_t ) ( ( configCPU_CLOCK_HZ / configTICK_RATE_HZ ) / ( uint32_t ) 4 ) /* From the RDC data sheet. */ -#define portENABLE_TIMER_AND_INTERRUPT ( unsigned short ) 0xe001 +#define portENABLE_TIMER_AND_INTERRUPT ( uint16_t ) 0xe001 /* Interrupt control. */ #define portEIO_REGISTER 0xff22 @@ -113,9 +113,9 @@ static void __interrupt __far prvDummyISR( void ); /*-----------------------------------------------------------*/ /* See header file for description. */ -portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) +StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) { -portSTACK_TYPE DS_Reg = 0; +StackType_t DS_Reg = 0; /* Place a few bytes of known values on the bottom of the stack. This is just useful for debugging. */ @@ -151,15 +151,15 @@ portSTACK_TYPE DS_Reg = 0; /* The remaining registers would be pushed on the stack by our context switch function. These are loaded with values simply to make debugging easier. */ - *pxTopOfStack = ( portSTACK_TYPE ) 0xAAAA; /* AX */ + *pxTopOfStack = ( StackType_t ) 0xAAAA; /* AX */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0xBBBB; /* BX */ + *pxTopOfStack = ( StackType_t ) 0xBBBB; /* BX */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0xCCCC; /* CX */ + *pxTopOfStack = ( StackType_t ) 0xCCCC; /* CX */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0xDDDD; /* DX */ + *pxTopOfStack = ( StackType_t ) 0xDDDD; /* DX */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0xEEEE; /* ES */ + *pxTopOfStack = ( StackType_t ) 0xEEEE; /* ES */ pxTopOfStack--; /* We need the true data segment. */ @@ -167,17 +167,17 @@ portSTACK_TYPE DS_Reg = 0; *pxTopOfStack = DS_Reg; /* DS */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x0123; /* SI */ + *pxTopOfStack = ( StackType_t ) 0x0123; /* SI */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0xDDDD; /* DI */ + *pxTopOfStack = ( StackType_t ) 0xDDDD; /* DI */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0xBBBB; /* BP */ + *pxTopOfStack = ( StackType_t ) 0xBBBB; /* BP */ return pxTopOfStack; } /*-----------------------------------------------------------*/ -portBASE_TYPE xPortStartScheduler( void ) +BaseType_t xPortStartScheduler( void ) { /* This is called with interrupts already disabled. */ @@ -248,8 +248,8 @@ void vPortEndScheduler( void ) static void prvSetupTimerInterrupt( void ) { -const unsigned short usTimerACompare = portTIMER_COMPARE, usTimerAMode = portENABLE_TIMER_AND_INTERRUPT; -const unsigned short usT2_IRQ = 0x13; +const uint16_t usTimerACompare = portTIMER_COMPARE, usTimerAMode = portENABLE_TIMER_AND_INTERRUPT; +const uint16_t usT2_IRQ = 0x13; /* Configure the timer, the dummy handler is used here as the init function leaves interrupts enabled. */ diff --git a/FreeRTOS/Source/portable/Paradigm/Tern_EE/large_untested/portasm.h b/FreeRTOS/Source/portable/Paradigm/Tern_EE/large_untested/portasm.h index 723432ba5..6da778f49 100644 --- a/FreeRTOS/Source/portable/Paradigm/Tern_EE/large_untested/portasm.h +++ b/FreeRTOS/Source/portable/Paradigm/Tern_EE/large_untested/portasm.h @@ -63,8 +63,8 @@ 1 tab == 4 spaces! */ -typedef void tskTCB; -extern volatile tskTCB * volatile pxCurrentTCB; +typedef void TCB_t; +extern volatile TCB_t * volatile pxCurrentTCB; extern void vTaskSwitchContext( void ); /* diff --git a/FreeRTOS/Source/portable/Paradigm/Tern_EE/large_untested/portmacro.h b/FreeRTOS/Source/portable/Paradigm/Tern_EE/large_untested/portmacro.h index 6b979a7cf..d78e6091e 100644 --- a/FreeRTOS/Source/portable/Paradigm/Tern_EE/large_untested/portmacro.h +++ b/FreeRTOS/Source/portable/Paradigm/Tern_EE/large_untested/portmacro.h @@ -1,5 +1,5 @@ /* - FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. + FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. All rights reserved VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. @@ -71,7 +71,7 @@ extern "C" { #endif /*----------------------------------------------------------- - * Port specific definitions. + * Port specific definitions. * * The settings in this file configure FreeRTOS correctly for the * given hardware and compiler. @@ -86,15 +86,20 @@ extern "C" { #define portDOUBLE long #define portLONG long #define portSHORT int -#define portSTACK_TYPE unsigned portSHORT -#define portBASE_TYPE portSHORT +#define portSTACK_TYPE uint16_t +#define portBASE_TYPE short + +typedef portSTACK_TYPE StackType_t; +typedef short BaseType_t; +typedef unsigned short UBaseType_t; + #if( configUSE_16_BIT_TICKS == 1 ) - typedef unsigned portSHORT portTickType; - #define portMAX_DELAY ( portTickType ) 0xffff + typedef uint16_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffff #else - typedef unsigned portLONG portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffffUL + typedef uint32_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffffffffUL #endif /*-----------------------------------------------------------*/ @@ -113,8 +118,8 @@ extern "C" { #define portNOP() __asm{ nop } #define portSTACK_GROWTH ( -1 ) #define portSWITCH_INT_NUMBER 0x80 -#define portYIELD() __asm{ int portSWITCH_INT_NUMBER } -#define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ ) +#define portYIELD() __asm{ int portSWITCH_INT_NUMBER } +#define portTICK_RATE_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ ) #define portBYTE_ALIGNMENT 2 #define portINITIAL_SW ( ( portSTACK_TYPE ) 0x0202 ) /* Start the tasks with interrupts enabled. */ /*-----------------------------------------------------------*/ diff --git a/FreeRTOS/Source/portable/Paradigm/Tern_EE/small/port.c b/FreeRTOS/Source/portable/Paradigm/Tern_EE/small/port.c index d28d030ea..7ed2dd1b8 100644 --- a/FreeRTOS/Source/portable/Paradigm/Tern_EE/small/port.c +++ b/FreeRTOS/Source/portable/Paradigm/Tern_EE/small/port.c @@ -83,8 +83,8 @@ #define portTIMER_COMPARE ( configCPU_CLOCK_HZ / ( configTICK_RATE_HZ * 4UL ) ) /* From the RDC data sheet. */ -#define portENABLE_TIMER_AND_INTERRUPT ( unsigned short ) 0xe00b -#define portENABLE_TIMER ( unsigned short ) 0xC001 +#define portENABLE_TIMER_AND_INTERRUPT ( uint16_t ) 0xe00b +#define portENABLE_TIMER ( uint16_t ) 0xC001 /* Interrupt control. */ #define portEIO_REGISTER 0xff22 @@ -110,9 +110,9 @@ static void __interrupt __far prvYieldProcessor( void ); /*-----------------------------------------------------------*/ /* See header file for description. */ -portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) +StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) { -portSTACK_TYPE DS_Reg = 0; +StackType_t DS_Reg = 0; /* We need the true data segment. */ __asm{ MOV DS_Reg, DS }; @@ -147,30 +147,30 @@ portSTACK_TYPE DS_Reg = 0; /* The remaining registers would be pushed on the stack by our context switch function. These are loaded with values simply to make debugging easier. */ - *pxTopOfStack = ( portSTACK_TYPE ) 0xAAAA; /* AX */ + *pxTopOfStack = ( StackType_t ) 0xAAAA; /* AX */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0xBBBB; /* BX */ + *pxTopOfStack = ( StackType_t ) 0xBBBB; /* BX */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0xCCCC; /* CX */ + *pxTopOfStack = ( StackType_t ) 0xCCCC; /* CX */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0xDDDD; /* DX */ + *pxTopOfStack = ( StackType_t ) 0xDDDD; /* DX */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0xEEEE; /* ES */ + *pxTopOfStack = ( StackType_t ) 0xEEEE; /* ES */ pxTopOfStack--; *pxTopOfStack = DS_Reg; /* DS */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x0123; /* SI */ + *pxTopOfStack = ( StackType_t ) 0x0123; /* SI */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0xDDDD; /* DI */ + *pxTopOfStack = ( StackType_t ) 0xDDDD; /* DI */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0xBBBB; /* BP */ + *pxTopOfStack = ( StackType_t ) 0xBBBB; /* BP */ return pxTopOfStack; } /*-----------------------------------------------------------*/ -portBASE_TYPE xPortStartScheduler( void ) +BaseType_t xPortStartScheduler( void ) { /* This is called with interrupts already disabled. */ @@ -232,10 +232,10 @@ void vPortEndScheduler( void ) static void prvSetupTimerInterrupt( void ) { -const unsigned long ulCompareValue = portTIMER_COMPARE; -unsigned short usTimerCompare; +const uint32_t ulCompareValue = portTIMER_COMPARE; +uint16_t usTimerCompare; - usTimerCompare = ( unsigned short ) ( ulCompareValue >> 4 ); + usTimerCompare = ( uint16_t ) ( ulCompareValue >> 4 ); t2_init( portENABLE_TIMER, portPRESCALE_VALUE, NULL ); #if( configUSE_PREEMPTION == 1 ) diff --git a/FreeRTOS/Source/portable/Paradigm/Tern_EE/small/portasm.h b/FreeRTOS/Source/portable/Paradigm/Tern_EE/small/portasm.h index 11e50f5da..028adeb70 100644 --- a/FreeRTOS/Source/portable/Paradigm/Tern_EE/small/portasm.h +++ b/FreeRTOS/Source/portable/Paradigm/Tern_EE/small/portasm.h @@ -66,8 +66,8 @@ #ifndef PORT_ASM_H #define PORT_ASM_H -typedef void tskTCB; -extern volatile tskTCB * volatile pxCurrentTCB; +typedef void TCB_t; +extern volatile TCB_t * volatile pxCurrentTCB; extern void vTaskSwitchContext( void ); /* diff --git a/FreeRTOS/Source/portable/Paradigm/Tern_EE/small/portmacro.h b/FreeRTOS/Source/portable/Paradigm/Tern_EE/small/portmacro.h index fe7bca553..5a913aa7d 100644 --- a/FreeRTOS/Source/portable/Paradigm/Tern_EE/small/portmacro.h +++ b/FreeRTOS/Source/portable/Paradigm/Tern_EE/small/portmacro.h @@ -1,5 +1,5 @@ /* - FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. + FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. All rights reserved VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. @@ -71,7 +71,7 @@ extern "C" { #endif /*----------------------------------------------------------- - * Port specific definitions. + * Port specific definitions. * * The settings in this file configure FreeRTOS correctly for the * given hardware and compiler. @@ -86,17 +86,22 @@ extern "C" { #define portDOUBLE long #define portLONG long #define portSHORT int -#define portSTACK_TYPE unsigned portSHORT -#define portBASE_TYPE portSHORT +#define portSTACK_TYPE uint16_t +#define portBASE_TYPE short + +typedef portSTACK_TYPE StackType_t; +typedef short BaseType_t; +typedef unsigned short UBaseType_t; + typedef void ( __interrupt __far *pxISR )(); #if( configUSE_16_BIT_TICKS == 1 ) - typedef unsigned portSHORT portTickType; - #define portMAX_DELAY ( portTickType ) 0xffff + typedef uint16_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffff #else - typedef unsigned portLONG portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffffUL + typedef uint32_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffffffffUL #endif /*-----------------------------------------------------------*/ @@ -115,8 +120,8 @@ typedef void ( __interrupt __far *pxISR )(); #define portNOP() __asm{ nop } #define portSTACK_GROWTH ( -1 ) #define portSWITCH_INT_NUMBER 0x80 -#define portYIELD() __asm{ int portSWITCH_INT_NUMBER } -#define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ ) +#define portYIELD() __asm{ int portSWITCH_INT_NUMBER } +#define portTICK_RATE_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ ) #define portBYTE_ALIGNMENT 2 #define portINITIAL_SW ( ( portSTACK_TYPE ) 0x0202 ) /* Start the tasks with interrupts enabled. */ /*-----------------------------------------------------------*/ diff --git a/FreeRTOS/Source/portable/RVDS/ARM7_LPC21xx/port.c b/FreeRTOS/Source/portable/RVDS/ARM7_LPC21xx/port.c index b3e95fb4b..a9d6e005c 100644 --- a/FreeRTOS/Source/portable/RVDS/ARM7_LPC21xx/port.c +++ b/FreeRTOS/Source/portable/RVDS/ARM7_LPC21xx/port.c @@ -72,25 +72,25 @@ #include "task.h" /* Constants required to setup the initial task context. */ -#define portINITIAL_SPSR ( ( portSTACK_TYPE ) 0x1f ) /* System mode, ARM mode, interrupts enabled. */ -#define portTHUMB_MODE_BIT ( ( portSTACK_TYPE ) 0x20 ) -#define portINSTRUCTION_SIZE ( ( portSTACK_TYPE ) 4 ) -#define portNO_CRITICAL_SECTION_NESTING ( ( portSTACK_TYPE ) 0 ) +#define portINITIAL_SPSR ( ( StackType_t ) 0x1f ) /* System mode, ARM mode, interrupts enabled. */ +#define portTHUMB_MODE_BIT ( ( StackType_t ) 0x20 ) +#define portINSTRUCTION_SIZE ( ( StackType_t ) 4 ) +#define portNO_CRITICAL_SECTION_NESTING ( ( StackType_t ) 0 ) /* Constants required to setup the tick ISR. */ -#define portENABLE_TIMER ( ( unsigned portCHAR ) 0x01 ) +#define portENABLE_TIMER ( ( uint8_t ) 0x01 ) #define portPRESCALE_VALUE 0x00 -#define portINTERRUPT_ON_MATCH ( ( unsigned portLONG ) 0x01 ) -#define portRESET_COUNT_ON_MATCH ( ( unsigned portLONG ) 0x02 ) +#define portINTERRUPT_ON_MATCH ( ( uint32_t ) 0x01 ) +#define portRESET_COUNT_ON_MATCH ( ( uint32_t ) 0x02 ) /* Constants required to setup the VIC for the tick ISR. */ -#define portTIMER_VIC_CHANNEL ( ( unsigned portLONG ) 0x0004 ) -#define portTIMER_VIC_CHANNEL_BIT ( ( unsigned portLONG ) 0x0010 ) -#define portTIMER_VIC_ENABLE ( ( unsigned portLONG ) 0x0020 ) +#define portTIMER_VIC_CHANNEL ( ( uint32_t ) 0x0004 ) +#define portTIMER_VIC_CHANNEL_BIT ( ( uint32_t ) 0x0010 ) +#define portTIMER_VIC_ENABLE ( ( uint32_t ) 0x0020 ) /* Constants required to handle interrupts. */ -#define portTIMER_MATCH_ISR_BIT ( ( unsigned portCHAR ) 0x01 ) -#define portCLEAR_VIC_INTERRUPT ( ( unsigned portLONG ) 0 ) +#define portTIMER_MATCH_ISR_BIT ( ( uint8_t ) 0x01 ) +#define portCLEAR_VIC_INTERRUPT ( ( uint32_t ) 0 ) /*-----------------------------------------------------------*/ @@ -100,8 +100,8 @@ use the stack as per other ports. Instead a variable is used to keep track of the critical section nesting. This variable has to be stored as part of the task context and must be initialised to a non zero value. */ -#define portNO_CRITICAL_NESTING ( ( unsigned portLONG ) 0 ) -volatile unsigned portLONG ulCriticalNesting = 9999UL; +#define portNO_CRITICAL_NESTING ( ( uint32_t ) 0 ) +volatile uint32_t ulCriticalNesting = 9999UL; /*-----------------------------------------------------------*/ @@ -119,9 +119,9 @@ extern __asm void vPortStartFirstTask( void ); /* * See header file for description. */ -portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) +StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) { -portSTACK_TYPE *pxOriginalTOS; +StackType_t *pxOriginalTOS; /* Setup the initial stack of the task. The stack is set exactly as expected by the portRESTORE_CONTEXT() macro. @@ -137,45 +137,45 @@ portSTACK_TYPE *pxOriginalTOS; /* First on the stack is the return address - which in this case is the start of the task. The offset is added to make the return address appear as it would within an IRQ ISR. */ - *pxTopOfStack = ( portSTACK_TYPE ) pxCode + portINSTRUCTION_SIZE; + *pxTopOfStack = ( StackType_t ) pxCode + portINSTRUCTION_SIZE; pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0xaaaaaaaa; /* R14 */ + *pxTopOfStack = ( StackType_t ) 0xaaaaaaaa; /* R14 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) pxOriginalTOS; /* Stack used when task starts goes in R13. */ + *pxTopOfStack = ( StackType_t ) pxOriginalTOS; /* Stack used when task starts goes in R13. */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x12121212; /* R12 */ + *pxTopOfStack = ( StackType_t ) 0x12121212; /* R12 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x11111111; /* R11 */ + *pxTopOfStack = ( StackType_t ) 0x11111111; /* R11 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x10101010; /* R10 */ + *pxTopOfStack = ( StackType_t ) 0x10101010; /* R10 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x09090909; /* R9 */ + *pxTopOfStack = ( StackType_t ) 0x09090909; /* R9 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x08080808; /* R8 */ + *pxTopOfStack = ( StackType_t ) 0x08080808; /* R8 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x07070707; /* R7 */ + *pxTopOfStack = ( StackType_t ) 0x07070707; /* R7 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x06060606; /* R6 */ + *pxTopOfStack = ( StackType_t ) 0x06060606; /* R6 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x05050505; /* R5 */ + *pxTopOfStack = ( StackType_t ) 0x05050505; /* R5 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x04040404; /* R4 */ + *pxTopOfStack = ( StackType_t ) 0x04040404; /* R4 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x03030303; /* R3 */ + *pxTopOfStack = ( StackType_t ) 0x03030303; /* R3 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x02020202; /* R2 */ + *pxTopOfStack = ( StackType_t ) 0x02020202; /* R2 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x01010101; /* R1 */ + *pxTopOfStack = ( StackType_t ) 0x01010101; /* R1 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) pvParameters; /* R0 */ + *pxTopOfStack = ( StackType_t ) pvParameters; /* R0 */ pxTopOfStack--; /* The last thing onto the stack is the status register, which is set for system mode, with interrupts enabled. */ - *pxTopOfStack = ( portSTACK_TYPE ) portINITIAL_SPSR; + *pxTopOfStack = ( StackType_t ) portINITIAL_SPSR; - if( ( ( unsigned long ) pxCode & 0x01UL ) != 0x00UL ) + if( ( ( uint32_t ) pxCode & 0x01UL ) != 0x00UL ) { /* We want the task to start in thumb mode. */ *pxTopOfStack |= portTHUMB_MODE_BIT; @@ -194,7 +194,7 @@ portSTACK_TYPE *pxOriginalTOS; } /*-----------------------------------------------------------*/ -portBASE_TYPE xPortStartScheduler( void ) +BaseType_t xPortStartScheduler( void ) { /* Start the timer that generates the tick ISR. */ prvSetupTimerInterrupt(); @@ -250,7 +250,7 @@ void vPortEndScheduler( void ) static void prvSetupTimerInterrupt( void ) { -unsigned portLONG ulCompareMatch; +uint32_t ulCompareMatch; /* A 1ms tick does not require the use of the timer prescale. This is defaulted to zero but can be used if necessary. */ @@ -280,11 +280,11 @@ unsigned portLONG ulCompareMatch; scheduler is being used. */ #if configUSE_PREEMPTION == 1 { - VICVectAddr0 = ( unsigned portLONG ) vPreemptiveTick; + VICVectAddr0 = ( uint32_t ) vPreemptiveTick; } #else { - VICVectAddr0 = ( unsigned portLONG ) vNonPreemptiveTick; + VICVectAddr0 = ( uint32_t ) vNonPreemptiveTick; } #endif diff --git a/FreeRTOS/Source/portable/RVDS/ARM7_LPC21xx/portmacro.h b/FreeRTOS/Source/portable/RVDS/ARM7_LPC21xx/portmacro.h index 0dddc9692..61bbce76b 100644 --- a/FreeRTOS/Source/portable/RVDS/ARM7_LPC21xx/portmacro.h +++ b/FreeRTOS/Source/portable/RVDS/ARM7_LPC21xx/portmacro.h @@ -1,5 +1,5 @@ /* - FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. + FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. All rights reserved VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. @@ -72,7 +72,7 @@ extern "C" { #endif /*----------------------------------------------------------- - * Port specific definitions. + * Port specific definitions. * * The settings in this file configure FreeRTOS correctly for the * given hardware and compiler. @@ -87,23 +87,28 @@ extern "C" { #define portDOUBLE double #define portLONG long #define portSHORT short -#define portSTACK_TYPE unsigned portLONG -#define portBASE_TYPE portLONG +#define portSTACK_TYPE uint32_t +#define portBASE_TYPE long + +typedef portSTACK_TYPE StackType_t; +typedef long BaseType_t; +typedef unsigned long UBaseType_t; + #if( configUSE_16_BIT_TICKS == 1 ) - typedef unsigned portSHORT portTickType; - #define portMAX_DELAY ( portTickType ) 0xffff + typedef uint16_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffff #else - typedef unsigned portLONG portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffffUL + typedef uint32_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffffffffUL #endif -/*-----------------------------------------------------------*/ +/*-----------------------------------------------------------*/ /* Hardware specifics. */ #define portSTACK_GROWTH ( -1 ) -#define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ ) +#define portTICK_RATE_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ ) #define portBYTE_ALIGNMENT 8 -/*-----------------------------------------------------------*/ +/*-----------------------------------------------------------*/ /* Task utilities. */ @@ -112,7 +117,7 @@ extern "C" { * is required from an ISR. *----------------------------------------------------------*/ -/* If a switch is required then we just need to call */ +/* If a switch is required then we just need to call */ /* vTaskSwitchContext() as the context has already been */ /* saved. */ @@ -133,14 +138,14 @@ extern void vPortYield( void ); /* Critical section management. */ /* - ****************************************************************** + ****************************************************************** * We don't need to worry about whether we're in ARM or - * THUMB mode with the Keil Real View compiler when enabling - * or disabling interrupts as the compiler's intrinsic functions + * THUMB mode with the Keil Real View compiler when enabling + * or disabling interrupts as the compiler's intrinsic functions * take care of that for us. ******************************************************************* */ -#define portDISABLE_INTERRUPTS() __disable_irq() +#define portDISABLE_INTERRUPTS() __disable_irq() #define portENABLE_INTERRUPTS() __enable_irq() @@ -150,7 +155,7 @@ extern void vPortYield( void ); * The code generated by the Keil compiler does not maintain separate * stack and frame pointers. The portENTER_CRITICAL macro cannot therefore * use the stack as per other ports. Instead a variable is used to keep - * track of the critical section nesting. This necessitates the use of a + * track of the critical section nesting. This necessitates the use of a * function in place of the macro. *----------------------------------------------------------*/ @@ -159,13 +164,13 @@ extern void vPortExitCritical( void ); #define portENTER_CRITICAL() vPortEnterCritical(); #define portEXIT_CRITICAL() vPortExitCritical(); -/*-----------------------------------------------------------*/ +/*-----------------------------------------------------------*/ /* Compiler specifics. */ #define inline #define register #define portNOP() __asm{ NOP } -/*-----------------------------------------------------------*/ +/*-----------------------------------------------------------*/ /* Task function macros as described on the FreeRTOS.org WEB site. */ #define portTASK_FUNCTION_PROTO( vFunction, pvParameters ) void vFunction( void *pvParameters ) diff --git a/FreeRTOS/Source/portable/RVDS/ARM_CA9/port.c b/FreeRTOS/Source/portable/RVDS/ARM_CA9/port.c index ba9634d9a..745e84051 100644 --- a/FreeRTOS/Source/portable/RVDS/ARM_CA9/port.c +++ b/FreeRTOS/Source/portable/RVDS/ARM_CA9/port.c @@ -133,7 +133,7 @@ number of bits implemented by the interrupt controller. */ /* A critical section is exited when the critical section nesting count reaches this value. */ -#define portNO_CRITICAL_NESTING ( ( unsigned long ) 0 ) +#define portNO_CRITICAL_NESTING ( ( uint32_t ) 0 ) /* In all GICs 255 can be written to the priority mask register to unmask all (but the lowest) interrupt priority. */ @@ -144,7 +144,7 @@ floating point context after they have been created. A variable is stored as part of the tasks context that holds portNO_FLOATING_POINT_CONTEXT if the task does not have an FPU context, or any other value if the task does have an FPU context. */ -#define portNO_FLOATING_POINT_CONTEXT ( ( portSTACK_TYPE ) 0 ) +#define portNO_FLOATING_POINT_CONTEXT ( ( StackType_t ) 0 ) /* Interrupt controller access addresses. */ #define portICCPMR_PRIORITY_MASK_OFFSET ( 0x04 ) @@ -153,20 +153,20 @@ context. */ #define portICCBPR_BINARY_POINT_OFFSET ( 0x08 ) #define portICCRPR_RUNNING_PRIORITY_OFFSET ( 0x14 ) #define portINTERRUPT_CONTROLLER_CPU_INTERFACE_ADDRESS ( configINTERRUPT_CONTROLLER_BASE_ADDRESS + configINTERRUPT_CONTROLLER_CPU_INTERFACE_OFFSET ) -#define portICCPMR_PRIORITY_MASK_REGISTER ( *( ( volatile unsigned long * ) ( portINTERRUPT_CONTROLLER_CPU_INTERFACE_ADDRESS + portICCPMR_PRIORITY_MASK_OFFSET ) ) ) +#define portICCPMR_PRIORITY_MASK_REGISTER ( *( ( volatile uint32_t * ) ( portINTERRUPT_CONTROLLER_CPU_INTERFACE_ADDRESS + portICCPMR_PRIORITY_MASK_OFFSET ) ) ) #define portICCIAR_INTERRUPT_ACKNOWLEDGE_REGISTER_ADDRESS ( portINTERRUPT_CONTROLLER_CPU_INTERFACE_ADDRESS + portICCIAR_INTERRUPT_ACKNOWLEDGE_OFFSET ) #define portICCEOIR_END_OF_INTERRUPT_REGISTER_ADDRESS ( portINTERRUPT_CONTROLLER_CPU_INTERFACE_ADDRESS + portICCEOIR_END_OF_INTERRUPT_OFFSET ) #define portICCPMR_PRIORITY_MASK_REGISTER_ADDRESS ( portINTERRUPT_CONTROLLER_CPU_INTERFACE_ADDRESS + portICCPMR_PRIORITY_MASK_OFFSET ) -#define portICCBPR_BINARY_POINT_REGISTER ( *( ( const volatile unsigned long * ) ( portINTERRUPT_CONTROLLER_CPU_INTERFACE_ADDRESS + portICCBPR_BINARY_POINT_OFFSET ) ) ) -#define portICCRPR_RUNNING_PRIORITY_REGISTER ( *( ( const volatile unsigned char * ) ( portINTERRUPT_CONTROLLER_CPU_INTERFACE_ADDRESS + portICCRPR_RUNNING_PRIORITY_OFFSET ) ) ) +#define portICCBPR_BINARY_POINT_REGISTER ( *( ( const volatile uint32_t * ) ( portINTERRUPT_CONTROLLER_CPU_INTERFACE_ADDRESS + portICCBPR_BINARY_POINT_OFFSET ) ) ) +#define portICCRPR_RUNNING_PRIORITY_REGISTER ( *( ( const volatile uint8_t * ) ( portINTERRUPT_CONTROLLER_CPU_INTERFACE_ADDRESS + portICCRPR_RUNNING_PRIORITY_OFFSET ) ) ) /* Used by portASSERT_IF_INTERRUPT_PRIORITY_INVALID() when ensuring the binary point is zero. */ -#define portBINARY_POINT_BITS ( ( unsigned char ) 0x03 ) +#define portBINARY_POINT_BITS ( ( uint8_t ) 0x03 ) /* Constants required to setup the initial task context. */ -#define portINITIAL_SPSR ( ( portSTACK_TYPE ) 0x1f ) /* System mode, ARM mode, interrupts enabled. */ -#define portTHUMB_MODE_BIT ( ( portSTACK_TYPE ) 0x20 ) +#define portINITIAL_SPSR ( ( StackType_t ) 0x1f ) /* System mode, ARM mode, interrupts enabled. */ +#define portTHUMB_MODE_BIT ( ( StackType_t ) 0x20 ) #define portINTERRUPT_ENABLE_BIT ( 0x80UL ) #define portTHUMB_MODE_ADDRESS ( 0x01UL ) @@ -202,33 +202,33 @@ variable has to be stored as part of the task context and must be initialised to a non zero value to ensure interrupts don't inadvertently become unmasked before the scheduler starts. As it is stored as part of the task context it will automatically be set to 0 when the first task is started. */ -volatile unsigned long ulCriticalNesting = 9999UL; +volatile uint32_t ulCriticalNesting = 9999UL; /* Used to pass constants into the ASM code. The address at which variables are placed is the constant value so indirect loads in the asm code are not required. */ -unsigned long ulICCIAR __attribute__( ( at( portICCIAR_INTERRUPT_ACKNOWLEDGE_REGISTER_ADDRESS ) ) ); -unsigned long ulICCEOIR __attribute__( ( at( portICCEOIR_END_OF_INTERRUPT_REGISTER_ADDRESS ) ) ); -unsigned long ulICCPMR __attribute__( ( at( portICCPMR_PRIORITY_MASK_REGISTER_ADDRESS ) ) ); -unsigned long ulAsmAPIPriorityMask __attribute__( ( at( configMAX_API_CALL_INTERRUPT_PRIORITY << portPRIORITY_SHIFT ) ) ); +uint32_t ulICCIAR __attribute__( ( at( portICCIAR_INTERRUPT_ACKNOWLEDGE_REGISTER_ADDRESS ) ) ); +uint32_t ulICCEOIR __attribute__( ( at( portICCEOIR_END_OF_INTERRUPT_REGISTER_ADDRESS ) ) ); +uint32_t ulICCPMR __attribute__( ( at( portICCPMR_PRIORITY_MASK_REGISTER_ADDRESS ) ) ); +uint32_t ulAsmAPIPriorityMask __attribute__( ( at( configMAX_API_CALL_INTERRUPT_PRIORITY << portPRIORITY_SHIFT ) ) ); /* Saved as part of the task context. If ulPortTaskHasFPUContext is non-zero then a floating point context must be saved and restored for the task. */ -unsigned long ulPortTaskHasFPUContext = pdFALSE; +uint32_t ulPortTaskHasFPUContext = pdFALSE; /* Set to 1 to pend a context switch from an ISR. */ -unsigned long ulPortYieldRequired = pdFALSE; +uint32_t ulPortYieldRequired = pdFALSE; /* Counts the interrupt nesting depth. A context switch is only performed if if the nesting depth is 0. */ -unsigned long ulPortInterruptNesting = 0UL; +uint32_t ulPortInterruptNesting = 0UL; /*-----------------------------------------------------------*/ /* * See header file for description. */ -portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) +StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) { /* Setup the initial stack of the task. The stack is set exactly as expected by the portRESTORE_CONTEXT() macro. @@ -242,9 +242,9 @@ portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxTopOfStack--; *pxTopOfStack = NULL; pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) portINITIAL_SPSR; + *pxTopOfStack = ( StackType_t ) portINITIAL_SPSR; - if( ( ( unsigned long ) pxCode & portTHUMB_MODE_ADDRESS ) != 0x00UL ) + if( ( ( uint32_t ) pxCode & portTHUMB_MODE_ADDRESS ) != 0x00UL ) { /* The task will start in THUMB mode. */ *pxTopOfStack |= portTHUMB_MODE_BIT; @@ -253,37 +253,37 @@ portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxTopOfStack--; /* Next the return address, which in this case is the start of the task. */ - *pxTopOfStack = ( portSTACK_TYPE ) pxCode; + *pxTopOfStack = ( StackType_t ) pxCode; pxTopOfStack--; /* Next all the registers other than the stack pointer. */ - *pxTopOfStack = ( portSTACK_TYPE ) 0x00000000; /* R14 */ + *pxTopOfStack = ( StackType_t ) 0x00000000; /* R14 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x12121212; /* R12 */ + *pxTopOfStack = ( StackType_t ) 0x12121212; /* R12 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x11111111; /* R11 */ + *pxTopOfStack = ( StackType_t ) 0x11111111; /* R11 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x10101010; /* R10 */ + *pxTopOfStack = ( StackType_t ) 0x10101010; /* R10 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x09090909; /* R9 */ + *pxTopOfStack = ( StackType_t ) 0x09090909; /* R9 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x08080808; /* R8 */ + *pxTopOfStack = ( StackType_t ) 0x08080808; /* R8 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x07070707; /* R7 */ + *pxTopOfStack = ( StackType_t ) 0x07070707; /* R7 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x06060606; /* R6 */ + *pxTopOfStack = ( StackType_t ) 0x06060606; /* R6 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x05050505; /* R5 */ + *pxTopOfStack = ( StackType_t ) 0x05050505; /* R5 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x04040404; /* R4 */ + *pxTopOfStack = ( StackType_t ) 0x04040404; /* R4 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x03030303; /* R3 */ + *pxTopOfStack = ( StackType_t ) 0x03030303; /* R3 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x02020202; /* R2 */ + *pxTopOfStack = ( StackType_t ) 0x02020202; /* R2 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x01010101; /* R1 */ + *pxTopOfStack = ( StackType_t ) 0x01010101; /* R1 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) pvParameters; /* R0 */ + *pxTopOfStack = ( StackType_t ) pvParameters; /* R0 */ pxTopOfStack--; /* The task will start with a critical nesting count of 0 as interrupts are @@ -300,9 +300,9 @@ portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE } /*-----------------------------------------------------------*/ -portBASE_TYPE xPortStartScheduler( void ) +BaseType_t xPortStartScheduler( void ) { -unsigned long ulAPSR; +uint32_t ulAPSR; /* Only continue if the CPU is not in User mode. The CPU must be in a Privileged mode for the scheduler to start. */ @@ -398,7 +398,7 @@ void FreeRTOS_Tick_Handler( void ) void vPortTaskUsesFPU( void ) { -unsigned long ulInitialFPSCR = 0; +uint32_t ulInitialFPSCR = 0; /* A task is registering the fact that it needs an FPU context. Set the FPU flag (which is saved as part of the task context). */ @@ -409,7 +409,7 @@ unsigned long ulInitialFPSCR = 0; } /*-----------------------------------------------------------*/ -void vPortClearInterruptMask( unsigned long ulNewMaskValue ) +void vPortClearInterruptMask( uint32_t ulNewMaskValue ) { if( ulNewMaskValue == pdFALSE ) { @@ -418,9 +418,9 @@ void vPortClearInterruptMask( unsigned long ulNewMaskValue ) } /*-----------------------------------------------------------*/ -unsigned long ulPortSetInterruptMask( void ) +uint32_t ulPortSetInterruptMask( void ) { -unsigned long ulReturn; +uint32_t ulReturn; __disable_irq(); if( portICCPMR_PRIORITY_MASK_REGISTER == ( configMAX_API_CALL_INTERRUPT_PRIORITY << portPRIORITY_SHIFT ) ) diff --git a/FreeRTOS/Source/portable/RVDS/ARM_CA9/portmacro.h b/FreeRTOS/Source/portable/RVDS/ARM_CA9/portmacro.h index 7aff296f7..d853fb22c 100644 --- a/FreeRTOS/Source/portable/RVDS/ARM_CA9/portmacro.h +++ b/FreeRTOS/Source/portable/RVDS/ARM_CA9/portmacro.h @@ -1,5 +1,5 @@ /* - FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. + FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. All rights reserved VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. @@ -86,21 +86,26 @@ extern "C" { #define portDOUBLE double #define portLONG long #define portSHORT short -#define portSTACK_TYPE unsigned long -#define portBASE_TYPE portLONG +#define portSTACK_TYPE uint32_t +#define portBASE_TYPE long + +typedef portSTACK_TYPE StackType_t; +typedef long BaseType_t; +typedef unsigned long UBaseType_t; + #if( configUSE_16_BIT_TICKS == 1 ) - typedef unsigned short portTickType; - #define portMAX_DELAY ( portTickType ) 0xffff + typedef uint16_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffff #else - typedef unsigned long portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffffUL + typedef uint32_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffffffffUL #endif /*-----------------------------------------------------------*/ /* Hardware specifics. */ #define portSTACK_GROWTH ( -1 ) -#define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ ) +#define portTICK_RATE_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ ) #define portBYTE_ALIGNMENT 8 /*-----------------------------------------------------------*/ @@ -110,7 +115,7 @@ extern "C" { /* Called at the end of an ISR that can cause a context switch. */ #define portEND_SWITCHING_ISR( xSwitchRequired )\ { \ -extern unsigned long ulPortYieldRequired; \ +extern uint32_t ulPortYieldRequired; \ \ if( xSwitchRequired != pdFALSE ) \ { \ @@ -128,8 +133,8 @@ extern unsigned long ulPortYieldRequired; \ extern void vPortEnterCritical( void ); extern void vPortExitCritical( void ); -extern unsigned long ulPortSetInterruptMask( void ); -extern void vPortClearInterruptMask( unsigned long ulNewMaskValue ); +extern uint32_t ulPortSetInterruptMask( void ); +extern void vPortClearInterruptMask( uint32_t ulNewMaskValue ); /* These macros do not globally disable/enable interrupts. They do mask off interrupts that have a priority below configMAX_API_CALL_INTERRUPT_PRIORITY. */ @@ -157,7 +162,7 @@ before any floating point instructions are executed. */ void vPortTaskUsesFPU( void ); #define portTASK_USES_FLOATING_POINT() vPortTaskUsesFPU() -#define portLOWEST_INTERRUPT_PRIORITY ( ( ( unsigned long ) configUNIQUE_INTERRUPT_PRIORITIES ) - 1UL ) +#define portLOWEST_INTERRUPT_PRIORITY ( ( ( uint32_t ) configUNIQUE_INTERRUPT_PRIORITIES ) - 1UL ) #define portLOWEST_USABLE_INTERRUPT_PRIORITY ( portLOWEST_INTERRUPT_PRIORITY - 1UL ) /* Architecture specific optimisations. */ diff --git a/FreeRTOS/Source/portable/RVDS/ARM_CM0/port.c b/FreeRTOS/Source/portable/RVDS/ARM_CM0/port.c index e7bb261b4..da750ae98 100644 --- a/FreeRTOS/Source/portable/RVDS/ARM_CM0/port.c +++ b/FreeRTOS/Source/portable/RVDS/ARM_CM0/port.c @@ -72,10 +72,10 @@ #include "task.h" /* Constants required to manipulate the NVIC. */ -#define portNVIC_SYSTICK_CTRL ( ( volatile unsigned long *) 0xe000e010 ) -#define portNVIC_SYSTICK_LOAD ( ( volatile unsigned long *) 0xe000e014 ) -#define portNVIC_INT_CTRL ( ( volatile unsigned long *) 0xe000ed04 ) -#define portNVIC_SYSPRI2 ( ( volatile unsigned long *) 0xe000ed20 ) +#define portNVIC_SYSTICK_CTRL ( ( volatile uint32_t *) 0xe000e010 ) +#define portNVIC_SYSTICK_LOAD ( ( volatile uint32_t *) 0xe000e014 ) +#define portNVIC_INT_CTRL ( ( volatile uint32_t *) 0xe000ed04 ) +#define portNVIC_SYSPRI2 ( ( volatile uint32_t *) 0xe000ed20 ) #define portNVIC_SYSTICK_CLK 0x00000004 #define portNVIC_SYSTICK_INT 0x00000002 #define portNVIC_SYSTICK_ENABLE 0x00000001 @@ -92,7 +92,7 @@ /* Each task maintains its own interrupt status in the critical nesting variable. */ -static unsigned portBASE_TYPE uxCriticalNesting = 0xaaaaaaaa; +static UBaseType_t uxCriticalNesting = 0xaaaaaaaa; /* * Setup the timer to generate the tick interrupts. @@ -121,18 +121,18 @@ static void prvTaskExitError( void ); /* * See header file for description. */ -portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) +StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) { /* Simulate the stack frame as it would be created by a context switch interrupt. */ pxTopOfStack--; /* Offset added to account for the way the MCU uses the stack on entry/exit of interrupts. */ *pxTopOfStack = portINITIAL_XPSR; /* xPSR */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) pxCode; /* PC */ + *pxTopOfStack = ( StackType_t ) pxCode; /* PC */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) prvTaskExitError; /* LR */ + *pxTopOfStack = ( StackType_t ) prvTaskExitError; /* LR */ pxTopOfStack -= 5; /* R12, R3, R2 and R1. */ - *pxTopOfStack = ( portSTACK_TYPE ) pvParameters; /* R0 */ + *pxTopOfStack = ( StackType_t ) pvParameters; /* R0 */ pxTopOfStack -= 8; /* R11..R4. */ return pxTopOfStack; @@ -189,7 +189,7 @@ __asm void prvPortStartFirstTask( void ) /* * See header file for description. */ -portBASE_TYPE xPortStartScheduler( void ) +BaseType_t xPortStartScheduler( void ) { /* Make PendSV, CallSV and SysTick the same priroity as the kernel. */ *(portNVIC_SYSPRI2) |= portNVIC_PENDSV_PRI; @@ -250,7 +250,7 @@ void vPortExitCritical( void ) } /*-----------------------------------------------------------*/ -__asm unsigned long ulSetInterruptMaskFromISR( void ) +__asm uint32_t ulSetInterruptMaskFromISR( void ) { mrs r0, PRIMASK cpsid i @@ -258,7 +258,7 @@ __asm unsigned long ulSetInterruptMaskFromISR( void ) } /*-----------------------------------------------------------*/ -__asm void vClearInterruptMaskFromISR( unsigned long ulMask ) +__asm void vClearInterruptMaskFromISR( uint32_t ulMask ) { msr PRIMASK, r0 bx lr @@ -313,7 +313,7 @@ __asm void xPortPendSVHandler( void ) void xPortSysTickHandler( void ) { -unsigned long ulPreviousMask; +uint32_t ulPreviousMask; ulPreviousMask = portSET_INTERRUPT_MASK_FROM_ISR(); { diff --git a/FreeRTOS/Source/portable/RVDS/ARM_CM0/portmacro.h b/FreeRTOS/Source/portable/RVDS/ARM_CM0/portmacro.h index 1f7aefa0a..96e8c30f2 100644 --- a/FreeRTOS/Source/portable/RVDS/ARM_CM0/portmacro.h +++ b/FreeRTOS/Source/portable/RVDS/ARM_CM0/portmacro.h @@ -1,5 +1,5 @@ /* - FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. + FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. All rights reserved VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. @@ -87,28 +87,32 @@ extern "C" { #define portDOUBLE double #define portLONG long #define portSHORT short -#define portSTACK_TYPE unsigned portLONG +#define portSTACK_TYPE uint32_t #define portBASE_TYPE long +typedef portSTACK_TYPE StackType_t; +typedef long BaseType_t; +typedef unsigned long UBaseType_t; + #if( configUSE_16_BIT_TICKS == 1 ) - typedef unsigned portSHORT portTickType; - #define portMAX_DELAY ( portTickType ) 0xffff + typedef uint16_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffff #else - typedef unsigned portLONG portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffffUL + typedef uint32_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffffffffUL #endif /*-----------------------------------------------------------*/ /* Architecture specifics. */ #define portSTACK_GROWTH ( -1 ) -#define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ ) +#define portTICK_RATE_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ ) #define portBYTE_ALIGNMENT 8 /*-----------------------------------------------------------*/ /* Scheduler utilities. */ extern void vPortYield( void ); -#define portNVIC_INT_CTRL_REG ( * ( ( volatile unsigned long * ) 0xe000ed04 ) ) +#define portNVIC_INT_CTRL_REG ( * ( ( volatile uint32_t * ) 0xe000ed04 ) ) #define portNVIC_PENDSVSET_BIT ( 1UL << 28UL ) #define portYIELD() vPortYield() #define portEND_SWITCHING_ISR( xSwitchRequired ) if( xSwitchRequired ) portNVIC_INT_CTRL_REG = portNVIC_PENDSVSET_BIT @@ -118,8 +122,8 @@ extern void vPortYield( void ); /* Critical section management. */ extern void vPortEnterCritical( void ); extern void vPortExitCritical( void ); -extern unsigned long ulSetInterruptMaskFromISR( void ); -extern void vClearInterruptMaskFromISR( unsigned long ulMask ); +extern uint32_t ulSetInterruptMaskFromISR( void ); +extern void vClearInterruptMaskFromISR( uint32_t ulMask ); #define portSET_INTERRUPT_MASK_FROM_ISR() ulSetInterruptMaskFromISR() #define portCLEAR_INTERRUPT_MASK_FROM_ISR(x) vClearInterruptMaskFromISR( x ) diff --git a/FreeRTOS/Source/portable/RVDS/ARM_CM3/port.c b/FreeRTOS/Source/portable/RVDS/ARM_CM3/port.c index c57f1fa7f..35124d7ac 100644 --- a/FreeRTOS/Source/portable/RVDS/ARM_CM3/port.c +++ b/FreeRTOS/Source/portable/RVDS/ARM_CM3/port.c @@ -99,10 +99,10 @@ is defined. */ #endif /* Constants required to manipulate the core. Registers first... */ -#define portNVIC_SYSTICK_CTRL_REG ( * ( ( volatile unsigned long * ) 0xe000e010 ) ) -#define portNVIC_SYSTICK_LOAD_REG ( * ( ( volatile unsigned long * ) 0xe000e014 ) ) -#define portNVIC_SYSTICK_CURRENT_VALUE_REG ( * ( ( volatile unsigned long * ) 0xe000e018 ) ) -#define portNVIC_SYSPRI2_REG ( * ( ( volatile unsigned long * ) 0xe000ed20 ) ) +#define portNVIC_SYSTICK_CTRL_REG ( * ( ( volatile uint32_t * ) 0xe000e010 ) ) +#define portNVIC_SYSTICK_LOAD_REG ( * ( ( volatile uint32_t * ) 0xe000e014 ) ) +#define portNVIC_SYSTICK_CURRENT_VALUE_REG ( * ( ( volatile uint32_t * ) 0xe000e018 ) ) +#define portNVIC_SYSPRI2_REG ( * ( ( volatile uint32_t * ) 0xe000ed20 ) ) /* ...then bits in the registers. */ #define portNVIC_SYSTICK_INT_BIT ( 1UL << 1UL ) #define portNVIC_SYSTICK_ENABLE_BIT ( 1UL << 0UL ) @@ -110,16 +110,16 @@ is defined. */ #define portNVIC_PENDSVCLEAR_BIT ( 1UL << 27UL ) #define portNVIC_PEND_SYSTICK_CLEAR_BIT ( 1UL << 25UL ) -#define portNVIC_PENDSV_PRI ( ( ( unsigned long ) configKERNEL_INTERRUPT_PRIORITY ) << 16UL ) -#define portNVIC_SYSTICK_PRI ( ( ( unsigned long ) configKERNEL_INTERRUPT_PRIORITY ) << 24UL ) +#define portNVIC_PENDSV_PRI ( ( ( uint32_t ) configKERNEL_INTERRUPT_PRIORITY ) << 16UL ) +#define portNVIC_SYSTICK_PRI ( ( ( uint32_t ) configKERNEL_INTERRUPT_PRIORITY ) << 24UL ) /* Constants required to check the validity of an interrupt priority. */ #define portFIRST_USER_INTERRUPT_NUMBER ( 16 ) #define portNVIC_IP_REGISTERS_OFFSET_16 ( 0xE000E3F0 ) -#define portAIRCR_REG ( * ( ( volatile unsigned long * ) 0xE000ED0C ) ) -#define portMAX_8_BIT_VALUE ( ( unsigned char ) 0xff ) -#define portTOP_BIT_OF_BYTE ( ( unsigned char ) 0x80 ) -#define portMAX_PRIGROUP_BITS ( ( unsigned char ) 7 ) +#define portAIRCR_REG ( * ( ( volatile uint32_t * ) 0xE000ED0C ) ) +#define portMAX_8_BIT_VALUE ( ( uint8_t ) 0xff ) +#define portTOP_BIT_OF_BYTE ( ( uint8_t ) 0x80 ) +#define portMAX_PRIGROUP_BITS ( ( uint8_t ) 7 ) #define portPRIORITY_GROUP_MASK ( 0x07UL << 8UL ) #define portPRIGROUP_SHIFT ( 8UL ) @@ -139,7 +139,7 @@ calculations. */ /* Each task maintains its own interrupt status in the critical nesting variable. */ -static unsigned portBASE_TYPE uxCriticalNesting = 0xaaaaaaaa; +static UBaseType_t uxCriticalNesting = 0xaaaaaaaa; /* * Setup the timer to generate the tick interrupts. The implementation in this @@ -171,7 +171,7 @@ static void prvTaskExitError( void ); * The number of SysTick increments that make up one tick period. */ #if configUSE_TICKLESS_IDLE == 1 - static unsigned long ulTimerCountsForOneTick = 0; + static uint32_t ulTimerCountsForOneTick = 0; #endif /* configUSE_TICKLESS_IDLE */ /* @@ -179,7 +179,7 @@ static void prvTaskExitError( void ); * 24 bit resolution of the SysTick timer. */ #if configUSE_TICKLESS_IDLE == 1 - static unsigned long xMaximumPossibleSuppressedTicks = 0; + static uint32_t xMaximumPossibleSuppressedTicks = 0; #endif /* configUSE_TICKLESS_IDLE */ /* @@ -187,7 +187,7 @@ static void prvTaskExitError( void ); * power functionality only. */ #if configUSE_TICKLESS_IDLE == 1 - static unsigned long ulStoppedTimerCompensation = 0; + static uint32_t ulStoppedTimerCompensation = 0; #endif /* configUSE_TICKLESS_IDLE */ /* @@ -196,9 +196,9 @@ static void prvTaskExitError( void ); * a priority above configMAX_SYSCALL_INTERRUPT_PRIORITY. */ #if ( configASSERT_DEFINED == 1 ) - static unsigned char ucMaxSysCallPriority = 0; - static unsigned long ulMaxPRIGROUPValue = 0; - static const volatile unsigned char * const pcInterruptPriorityRegisters = ( unsigned char * ) portNVIC_IP_REGISTERS_OFFSET_16; + static uint8_t ucMaxSysCallPriority = 0; + static uint32_t ulMaxPRIGROUPValue = 0; + static const volatile uint8_t * const pcInterruptPriorityRegisters = ( uint8_t * ) portNVIC_IP_REGISTERS_OFFSET_16; #endif /* configASSERT_DEFINED */ /*-----------------------------------------------------------*/ @@ -206,19 +206,19 @@ static void prvTaskExitError( void ); /* * See header file for description. */ -portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) +StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) { /* Simulate the stack frame as it would be created by a context switch interrupt. */ pxTopOfStack--; /* Offset added to account for the way the MCU uses the stack on entry/exit of interrupts. */ *pxTopOfStack = portINITIAL_XPSR; /* xPSR */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) pxCode; /* PC */ + *pxTopOfStack = ( StackType_t ) pxCode; /* PC */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) prvTaskExitError; /* LR */ + *pxTopOfStack = ( StackType_t ) prvTaskExitError; /* LR */ pxTopOfStack -= 5; /* R12, R3, R2 and R1. */ - *pxTopOfStack = ( portSTACK_TYPE ) pvParameters; /* R0 */ + *pxTopOfStack = ( StackType_t ) pvParameters; /* R0 */ pxTopOfStack -= 8; /* R11, R10, R9, R8, R7, R6, R5 and R4. */ return pxTopOfStack; @@ -279,13 +279,13 @@ __asm void prvStartFirstTask( void ) /* * See header file for description. */ -portBASE_TYPE xPortStartScheduler( void ) +BaseType_t xPortStartScheduler( void ) { #if( configASSERT_DEFINED == 1 ) { - volatile unsigned long ulOriginalPriority; - volatile char * const pcFirstUserPriorityRegister = ( char * ) ( portNVIC_IP_REGISTERS_OFFSET_16 + portFIRST_USER_INTERRUPT_NUMBER ); - volatile unsigned char ucMaxPriorityValue; + volatile uint32_t ulOriginalPriority; + volatile int8_t * const pcFirstUserPriorityRegister = ( int8_t * ) ( portNVIC_IP_REGISTERS_OFFSET_16 + portFIRST_USER_INTERRUPT_NUMBER ); + volatile uint8_t ucMaxPriorityValue; /* Determine the maximum priority from which ISR safe FreeRTOS API functions can be called. ISR safe functions are those that end in @@ -311,7 +311,7 @@ portBASE_TYPE xPortStartScheduler( void ) while( ( ucMaxPriorityValue & portTOP_BIT_OF_BYTE ) == portTOP_BIT_OF_BYTE ) { ulMaxPRIGROUPValue--; - ucMaxPriorityValue <<= ( unsigned char ) 0x01; + ucMaxPriorityValue <<= ( uint8_t ) 0x01; } /* Shift the priority group value back to its position within the AIRCR @@ -441,10 +441,10 @@ void xPortSysTickHandler( void ) #if configUSE_TICKLESS_IDLE == 1 - __weak void vPortSuppressTicksAndSleep( portTickType xExpectedIdleTime ) + __weak void vPortSuppressTicksAndSleep( TickType_t xExpectedIdleTime ) { - unsigned long ulReloadValue, ulCompleteTickPeriods, ulCompletedSysTickDecrements, ulSysTickCTRL; - portTickType xModifiableIdleTime; + uint32_t ulReloadValue, ulCompleteTickPeriods, ulCompletedSysTickDecrements, ulSysTickCTRL; + TickType_t xModifiableIdleTime; /* Make sure the SysTick reload value does not overflow the counter. */ if( xExpectedIdleTime > xMaximumPossibleSuppressedTicks ) @@ -530,7 +530,7 @@ void xPortSysTickHandler( void ) if( ( ulSysTickCTRL & portNVIC_SYSTICK_COUNT_FLAG_BIT ) != 0 ) { - unsigned long ulCalculatedLoadValue; + uint32_t ulCalculatedLoadValue; /* The tick interrupt has already executed, and the SysTick count reloaded with ulReloadValue. Reset the @@ -617,7 +617,7 @@ void xPortSysTickHandler( void ) #endif /* configOVERRIDE_DEFAULT_TICK_CONFIGURATION */ /*-----------------------------------------------------------*/ -__asm unsigned long ulPortSetInterruptMask( void ) +__asm uint32_t ulPortSetInterruptMask( void ) { PRESERVE8 @@ -628,7 +628,7 @@ __asm unsigned long ulPortSetInterruptMask( void ) } /*-----------------------------------------------------------*/ -__asm void vPortClearInterruptMask( unsigned long ulNewMask ) +__asm void vPortClearInterruptMask( uint32_t ulNewMask ) { PRESERVE8 @@ -637,7 +637,7 @@ __asm void vPortClearInterruptMask( unsigned long ulNewMask ) } /*-----------------------------------------------------------*/ -__asm unsigned long vPortGetIPSR( void ) +__asm uint32_t vPortGetIPSR( void ) { PRESERVE8 @@ -650,8 +650,8 @@ __asm unsigned long vPortGetIPSR( void ) void vPortValidateInterruptPriority( void ) { - unsigned long ulCurrentInterrupt; - unsigned char ucCurrentPriority; + uint32_t ulCurrentInterrupt; + uint8_t ucCurrentPriority; /* Obtain the number of the currently executing interrupt. */ ulCurrentInterrupt = vPortGetIPSR(); diff --git a/FreeRTOS/Source/portable/RVDS/ARM_CM3/portmacro.h b/FreeRTOS/Source/portable/RVDS/ARM_CM3/portmacro.h index e7c0c33e7..ed57e228f 100644 --- a/FreeRTOS/Source/portable/RVDS/ARM_CM3/portmacro.h +++ b/FreeRTOS/Source/portable/RVDS/ARM_CM3/portmacro.h @@ -1,5 +1,5 @@ /* - FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. + FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. All rights reserved VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. @@ -87,27 +87,31 @@ extern "C" { #define portDOUBLE double #define portLONG long #define portSHORT short -#define portSTACK_TYPE unsigned portLONG +#define portSTACK_TYPE uint32_t #define portBASE_TYPE long +typedef portSTACK_TYPE StackType_t; +typedef long BaseType_t; +typedef unsigned long UBaseType_t; + #if( configUSE_16_BIT_TICKS == 1 ) - typedef unsigned portSHORT portTickType; - #define portMAX_DELAY ( portTickType ) 0xffff + typedef uint16_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffff #else - typedef unsigned portLONG portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffffUL + typedef uint32_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffffffffUL #endif /*-----------------------------------------------------------*/ /* Architecture specifics. */ #define portSTACK_GROWTH ( -1 ) -#define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ ) +#define portTICK_RATE_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ ) #define portBYTE_ALIGNMENT 8 /*-----------------------------------------------------------*/ /* Scheduler utilities. */ extern void vPortYield( void ); -#define portNVIC_INT_CTRL_REG ( * ( ( volatile unsigned long * ) 0xe000ed04 ) ) +#define portNVIC_INT_CTRL_REG ( * ( ( volatile uint32_t * ) 0xe000ed04 ) ) #define portNVIC_PENDSVSET_BIT ( 1UL << 28UL ) #define portYIELD() vPortYield() #define portEND_SWITCHING_ISR( xSwitchRequired ) if( xSwitchRequired ) portNVIC_INT_CTRL_REG = portNVIC_PENDSVSET_BIT @@ -115,8 +119,8 @@ extern void vPortYield( void ); /*-----------------------------------------------------------*/ /* Critical section management. */ -extern unsigned long ulPortSetInterruptMask( void ); -extern void vPortClearInterruptMask( unsigned long ulNewMask ); +extern uint32_t ulPortSetInterruptMask( void ); +extern void vPortClearInterruptMask( uint32_t ulNewMask ); extern void vPortEnterCritical( void ); extern void vPortExitCritical( void ); @@ -130,7 +134,7 @@ extern void vPortExitCritical( void ); /* Tickless idle/low power functionality. */ #ifndef portSUPPRESS_TICKS_AND_SLEEP - extern void vPortSuppressTicksAndSleep( portTickType xExpectedIdleTime ); + extern void vPortSuppressTicksAndSleep( TickType_t xExpectedIdleTime ); #define portSUPPRESS_TICKS_AND_SLEEP( xExpectedIdleTime ) vPortSuppressTicksAndSleep( xExpectedIdleTime ) #endif /*-----------------------------------------------------------*/ diff --git a/FreeRTOS/Source/portable/RVDS/ARM_CM4F/port.c b/FreeRTOS/Source/portable/RVDS/ARM_CM4F/port.c index e46fcb285..61cbde758 100644 --- a/FreeRTOS/Source/portable/RVDS/ARM_CM4F/port.c +++ b/FreeRTOS/Source/portable/RVDS/ARM_CM4F/port.c @@ -99,10 +99,10 @@ is defined. */ #endif /* Constants required to manipulate the core. Registers first... */ -#define portNVIC_SYSTICK_CTRL_REG ( * ( ( volatile unsigned long * ) 0xe000e010 ) ) -#define portNVIC_SYSTICK_LOAD_REG ( * ( ( volatile unsigned long * ) 0xe000e014 ) ) -#define portNVIC_SYSTICK_CURRENT_VALUE_REG ( * ( ( volatile unsigned long * ) 0xe000e018 ) ) -#define portNVIC_SYSPRI2_REG ( * ( ( volatile unsigned long * ) 0xe000ed20 ) ) +#define portNVIC_SYSTICK_CTRL_REG ( * ( ( volatile uint32_t * ) 0xe000e010 ) ) +#define portNVIC_SYSTICK_LOAD_REG ( * ( ( volatile uint32_t * ) 0xe000e014 ) ) +#define portNVIC_SYSTICK_CURRENT_VALUE_REG ( * ( ( volatile uint32_t * ) 0xe000e018 ) ) +#define portNVIC_SYSPRI2_REG ( * ( ( volatile uint32_t * ) 0xe000ed20 ) ) /* ...then bits in the registers. */ #define portNVIC_SYSTICK_INT_BIT ( 1UL << 1UL ) #define portNVIC_SYSTICK_ENABLE_BIT ( 1UL << 0UL ) @@ -110,21 +110,21 @@ is defined. */ #define portNVIC_PENDSVCLEAR_BIT ( 1UL << 27UL ) #define portNVIC_PEND_SYSTICK_CLEAR_BIT ( 1UL << 25UL ) -#define portNVIC_PENDSV_PRI ( ( ( unsigned long ) configKERNEL_INTERRUPT_PRIORITY ) << 16UL ) -#define portNVIC_SYSTICK_PRI ( ( ( unsigned long ) configKERNEL_INTERRUPT_PRIORITY ) << 24UL ) +#define portNVIC_PENDSV_PRI ( ( ( uint32_t ) configKERNEL_INTERRUPT_PRIORITY ) << 16UL ) +#define portNVIC_SYSTICK_PRI ( ( ( uint32_t ) configKERNEL_INTERRUPT_PRIORITY ) << 24UL ) /* Constants required to check the validity of an interrupt priority. */ #define portFIRST_USER_INTERRUPT_NUMBER ( 16 ) #define portNVIC_IP_REGISTERS_OFFSET_16 ( 0xE000E3F0 ) -#define portAIRCR_REG ( * ( ( volatile unsigned long * ) 0xE000ED0C ) ) -#define portMAX_8_BIT_VALUE ( ( unsigned char ) 0xff ) -#define portTOP_BIT_OF_BYTE ( ( unsigned char ) 0x80 ) -#define portMAX_PRIGROUP_BITS ( ( unsigned char ) 7 ) +#define portAIRCR_REG ( * ( ( volatile uint32_t * ) 0xE000ED0C ) ) +#define portMAX_8_BIT_VALUE ( ( uint8_t ) 0xff ) +#define portTOP_BIT_OF_BYTE ( ( uint8_t ) 0x80 ) +#define portMAX_PRIGROUP_BITS ( ( uint8_t ) 7 ) #define portPRIORITY_GROUP_MASK ( 0x07UL << 8UL ) #define portPRIGROUP_SHIFT ( 8UL ) /* Constants required to manipulate the VFP. */ -#define portFPCCR ( ( volatile unsigned long * ) 0xe000ef34 ) /* Floating point context control register. */ +#define portFPCCR ( ( volatile uint32_t * ) 0xe000ef34 ) /* Floating point context control register. */ #define portASPEN_AND_LSPEN_BITS ( 0x3UL << 30UL ) /* Constants required to set up the initial stack. */ @@ -144,7 +144,7 @@ calculations. */ /* Each task maintains its own interrupt status in the critical nesting variable. */ -static unsigned portBASE_TYPE uxCriticalNesting = 0xaaaaaaaa; +static UBaseType_t uxCriticalNesting = 0xaaaaaaaa; /* * Setup the timer to generate the tick interrupts. The implementation in this @@ -181,7 +181,7 @@ static void prvTaskExitError( void ); * The number of SysTick increments that make up one tick period. */ #if configUSE_TICKLESS_IDLE == 1 - static unsigned long ulTimerCountsForOneTick = 0; + static uint32_t ulTimerCountsForOneTick = 0; #endif /* configUSE_TICKLESS_IDLE */ /* @@ -189,7 +189,7 @@ static void prvTaskExitError( void ); * 24 bit resolution of the SysTick timer. */ #if configUSE_TICKLESS_IDLE == 1 - static unsigned long xMaximumPossibleSuppressedTicks = 0; + static uint32_t xMaximumPossibleSuppressedTicks = 0; #endif /* configUSE_TICKLESS_IDLE */ /* @@ -197,7 +197,7 @@ static void prvTaskExitError( void ); * power functionality only. */ #if configUSE_TICKLESS_IDLE == 1 - static unsigned long ulStoppedTimerCompensation = 0; + static uint32_t ulStoppedTimerCompensation = 0; #endif /* configUSE_TICKLESS_IDLE */ /* @@ -206,9 +206,9 @@ static void prvTaskExitError( void ); * a priority above configMAX_SYSCALL_INTERRUPT_PRIORITY. */ #if ( configASSERT_DEFINED == 1 ) - static unsigned char ucMaxSysCallPriority = 0; - static unsigned long ulMaxPRIGROUPValue = 0; - static const volatile unsigned char * const pcInterruptPriorityRegisters = ( unsigned char * ) portNVIC_IP_REGISTERS_OFFSET_16; + static uint8_t ucMaxSysCallPriority = 0; + static uint32_t ulMaxPRIGROUPValue = 0; + static const volatile uint8_t * const pcInterruptPriorityRegisters = ( uint8_t * ) portNVIC_IP_REGISTERS_OFFSET_16; #endif /* configASSERT_DEFINED */ /*-----------------------------------------------------------*/ @@ -216,7 +216,7 @@ static void prvTaskExitError( void ); /* * See header file for description. */ -portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) +StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) { /* Simulate the stack frame as it would be created by a context switch interrupt. */ @@ -227,13 +227,13 @@ portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE *pxTopOfStack = portINITIAL_XPSR; /* xPSR */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) pxCode; /* PC */ + *pxTopOfStack = ( StackType_t ) pxCode; /* PC */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) prvTaskExitError; /* LR */ + *pxTopOfStack = ( StackType_t ) prvTaskExitError; /* LR */ /* Save code space by skipping register initialisation. */ pxTopOfStack -= 5; /* R12, R3, R2 and R1. */ - *pxTopOfStack = ( portSTACK_TYPE ) pvParameters; /* R0 */ + *pxTopOfStack = ( StackType_t ) pvParameters; /* R0 */ /* A save method is being used that requires each task to maintain its own exec return value. */ @@ -317,13 +317,13 @@ __asm void prvEnableVFP( void ) /* * See header file for description. */ -portBASE_TYPE xPortStartScheduler( void ) +BaseType_t xPortStartScheduler( void ) { #if( configASSERT_DEFINED == 1 ) { - volatile unsigned long ulOriginalPriority; - volatile char * const pcFirstUserPriorityRegister = ( char * ) ( portNVIC_IP_REGISTERS_OFFSET_16 + portFIRST_USER_INTERRUPT_NUMBER ); - volatile unsigned char ucMaxPriorityValue; + volatile uint32_t ulOriginalPriority; + volatile int8_t * const pcFirstUserPriorityRegister = ( int8_t * ) ( portNVIC_IP_REGISTERS_OFFSET_16 + portFIRST_USER_INTERRUPT_NUMBER ); + volatile uint8_t ucMaxPriorityValue; /* Determine the maximum priority from which ISR safe FreeRTOS API functions can be called. ISR safe functions are those that end in @@ -349,7 +349,7 @@ portBASE_TYPE xPortStartScheduler( void ) while( ( ucMaxPriorityValue & portTOP_BIT_OF_BYTE ) == portTOP_BIT_OF_BYTE ) { ulMaxPRIGROUPValue--; - ucMaxPriorityValue <<= ( unsigned char ) 0x01; + ucMaxPriorityValue <<= ( uint8_t ) 0x01; } /* Shift the priority group value back to its position within the AIRCR @@ -511,10 +511,10 @@ void xPortSysTickHandler( void ) #if configUSE_TICKLESS_IDLE == 1 - __weak void vPortSuppressTicksAndSleep( portTickType xExpectedIdleTime ) + __weak void vPortSuppressTicksAndSleep( TickType_t xExpectedIdleTime ) { - unsigned long ulReloadValue, ulCompleteTickPeriods, ulCompletedSysTickDecrements, ulSysTickCTRL; - portTickType xModifiableIdleTime; + uint32_t ulReloadValue, ulCompleteTickPeriods, ulCompletedSysTickDecrements, ulSysTickCTRL; + TickType_t xModifiableIdleTime; /* Make sure the SysTick reload value does not overflow the counter. */ if( xExpectedIdleTime > xMaximumPossibleSuppressedTicks ) @@ -600,7 +600,7 @@ void xPortSysTickHandler( void ) if( ( ulSysTickCTRL & portNVIC_SYSTICK_COUNT_FLAG_BIT ) != 0 ) { - unsigned long ulCalculatedLoadValue; + uint32_t ulCalculatedLoadValue; /* The tick interrupt has already executed, and the SysTick count reloaded with ulReloadValue. Reset the @@ -687,7 +687,7 @@ void xPortSysTickHandler( void ) #endif /* configOVERRIDE_DEFAULT_TICK_CONFIGURATION */ /*-----------------------------------------------------------*/ -__asm unsigned long ulPortSetInterruptMask( void ) +__asm uint32_t ulPortSetInterruptMask( void ) { PRESERVE8 @@ -698,7 +698,7 @@ __asm unsigned long ulPortSetInterruptMask( void ) } /*-----------------------------------------------------------*/ -__asm void vPortClearInterruptMask( unsigned long ulNewMask ) +__asm void vPortClearInterruptMask( uint32_t ulNewMask ) { PRESERVE8 @@ -707,7 +707,7 @@ __asm void vPortClearInterruptMask( unsigned long ulNewMask ) } /*-----------------------------------------------------------*/ -__asm unsigned long vPortGetIPSR( void ) +__asm uint32_t vPortGetIPSR( void ) { PRESERVE8 @@ -720,8 +720,8 @@ __asm unsigned long vPortGetIPSR( void ) void vPortValidateInterruptPriority( void ) { - unsigned long ulCurrentInterrupt; - unsigned char ucCurrentPriority; + uint32_t ulCurrentInterrupt; + uint8_t ucCurrentPriority; /* Obtain the number of the currently executing interrupt. */ ulCurrentInterrupt = vPortGetIPSR(); diff --git a/FreeRTOS/Source/portable/RVDS/ARM_CM4F/portmacro.h b/FreeRTOS/Source/portable/RVDS/ARM_CM4F/portmacro.h index 52beda0f8..61d897650 100644 --- a/FreeRTOS/Source/portable/RVDS/ARM_CM4F/portmacro.h +++ b/FreeRTOS/Source/portable/RVDS/ARM_CM4F/portmacro.h @@ -1,5 +1,5 @@ /* - FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. + FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. All rights reserved VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. @@ -87,27 +87,31 @@ extern "C" { #define portDOUBLE double #define portLONG long #define portSHORT short -#define portSTACK_TYPE unsigned portLONG +#define portSTACK_TYPE uint32_t #define portBASE_TYPE long +typedef portSTACK_TYPE StackType_t; +typedef long BaseType_t; +typedef unsigned long UBaseType_t; + #if( configUSE_16_BIT_TICKS == 1 ) - typedef unsigned portSHORT portTickType; - #define portMAX_DELAY ( portTickType ) 0xffff + typedef uint16_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffff #else - typedef unsigned portLONG portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffffUL + typedef uint32_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffffffffUL #endif /*-----------------------------------------------------------*/ /* Architecture specifics. */ #define portSTACK_GROWTH ( -1 ) -#define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ ) +#define portTICK_RATE_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ ) #define portBYTE_ALIGNMENT 8 /*-----------------------------------------------------------*/ /* Scheduler utilities. */ extern void vPortYield( void ); -#define portNVIC_INT_CTRL_REG ( * ( ( volatile unsigned long * ) 0xe000ed04 ) ) +#define portNVIC_INT_CTRL_REG ( * ( ( volatile uint32_t * ) 0xe000ed04 ) ) #define portNVIC_PENDSVSET_BIT ( 1UL << 28UL ) #define portYIELD() vPortYield() #define portEND_SWITCHING_ISR( xSwitchRequired ) if( xSwitchRequired ) portNVIC_INT_CTRL_REG = portNVIC_PENDSVSET_BIT @@ -115,8 +119,8 @@ extern void vPortYield( void ); /*-----------------------------------------------------------*/ /* Critical section management. */ -extern unsigned long ulPortSetInterruptMask( void ); -extern void vPortClearInterruptMask( unsigned long ulNewMask ); +extern uint32_t ulPortSetInterruptMask( void ); +extern void vPortClearInterruptMask( uint32_t ulNewMask ); extern void vPortEnterCritical( void ); extern void vPortExitCritical( void ); @@ -131,7 +135,7 @@ extern void vPortExitCritical( void ); /* Tickless idle/low power functionality. */ #ifndef portSUPPRESS_TICKS_AND_SLEEP - extern void vPortSuppressTicksAndSleep( portTickType xExpectedIdleTime ); + extern void vPortSuppressTicksAndSleep( TickType_t xExpectedIdleTime ); #define portSUPPRESS_TICKS_AND_SLEEP( xExpectedIdleTime ) vPortSuppressTicksAndSleep( xExpectedIdleTime ) #endif /*-----------------------------------------------------------*/ diff --git a/FreeRTOS/Source/portable/Renesas/RX100/port.c b/FreeRTOS/Source/portable/Renesas/RX100/port.c index 5f4946646..7b82e48d3 100644 --- a/FreeRTOS/Source/portable/Renesas/RX100/port.c +++ b/FreeRTOS/Source/portable/Renesas/RX100/port.c @@ -84,7 +84,7 @@ /* Tasks should start with interrupts enabled and in Supervisor mode, therefore PSW is set with U and I set, and PM and IPL clear. */ -#define portINITIAL_PSW ( ( portSTACK_TYPE ) 0x00030000 ) +#define portINITIAL_PSW ( ( StackType_t ) 0x00030000 ) /* The peripheral clock is divided by this value before being supplying the CMT. */ @@ -112,8 +112,8 @@ respectively. */ /* The following lines are to ensure vSoftwareInterruptEntry can be referenced, and therefore installed in the vector table, when the FreeRTOS code is built as a library. */ -extern portBASE_TYPE vSoftwareInterruptEntry; -const portBASE_TYPE * p_vSoftwareInterruptEntry = &vSoftwareInterruptEntry; +extern BaseType_t vSoftwareInterruptEntry; +const BaseType_t * p_vSoftwareInterruptEntry = &vSoftwareInterruptEntry; /*-----------------------------------------------------------*/ @@ -157,7 +157,7 @@ static void prvSetupTimerInterrupt( void ); * instruction. */ #if configUSE_TICKLESS_IDLE == 1 - static void prvSleep( portTickType xExpectedIdleTime ); + static void prvSleep( TickType_t xExpectedIdleTime ); #endif /* configUSE_TICKLESS_IDLE */ /*-----------------------------------------------------------*/ @@ -169,7 +169,7 @@ extern void vTaskSwitchContext( void ); /*-----------------------------------------------------------*/ /* Calculate how many clock increments make up a single tick period. */ -static const unsigned long ulMatchValueForOneTick = ( ( configPERIPHERAL_CLOCK_HZ / portCLOCK_DIVISOR ) / configTICK_RATE_HZ ); +static const uint32_t ulMatchValueForOneTick = ( ( configPERIPHERAL_CLOCK_HZ / portCLOCK_DIVISOR ) / configTICK_RATE_HZ ); #if configUSE_TICKLESS_IDLE == 1 @@ -177,7 +177,7 @@ static const unsigned long ulMatchValueForOneTick = ( ( configPERIPHERAL_CLOCK_H basically how far into the future an interrupt can be generated. Set during initialisation. This is the maximum possible value that the compare match register can hold divided by ulMatchValueForOneTick. */ - static const portTickType xMaximumPossibleSuppressedTicks = USHRT_MAX / ( ( configPERIPHERAL_CLOCK_HZ / portCLOCK_DIVISOR ) / configTICK_RATE_HZ ); + static const TickType_t xMaximumPossibleSuppressedTicks = USHRT_MAX / ( ( configPERIPHERAL_CLOCK_HZ / portCLOCK_DIVISOR ) / configTICK_RATE_HZ ); /* Flag set from the tick interrupt to allow the sleep processing to know if sleep mode was exited because of a tick interrupt, or an interrupt @@ -190,7 +190,7 @@ static const unsigned long ulMatchValueForOneTick = ( ( configPERIPHERAL_CLOCK_H compensate for the lost time. The large difference between the divided CMT clock and the CPU clock means it is likely ulStoppedTimerCompensation will equal zero - and be optimised away. */ - static const unsigned long ulStoppedTimerCompensation = 100UL / ( configCPU_CLOCK_HZ / ( configPERIPHERAL_CLOCK_HZ / portCLOCK_DIVISOR ) ); + static const uint32_t ulStoppedTimerCompensation = 100UL / ( configCPU_CLOCK_HZ / ( configPERIPHERAL_CLOCK_HZ / portCLOCK_DIVISOR ) ); #endif @@ -199,7 +199,7 @@ static const unsigned long ulMatchValueForOneTick = ( ( configPERIPHERAL_CLOCK_H /* * See header file for description. */ -portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) +StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) { /* Offset to end up on 8 byte boundary. */ pxTopOfStack--; @@ -211,7 +211,7 @@ portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxTopOfStack--; *pxTopOfStack = portINITIAL_PSW; pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) pxCode; + *pxTopOfStack = ( StackType_t ) pxCode; /* When debugging it can be useful if every register is set to a known value. Otherwise code space can be saved by just setting the registers @@ -256,7 +256,7 @@ portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE } #endif - *pxTopOfStack = ( portSTACK_TYPE ) pvParameters; /* R1 */ + *pxTopOfStack = ( StackType_t ) pvParameters; /* R1 */ pxTopOfStack--; *pxTopOfStack = 0x12345678; /* Accumulator. */ pxTopOfStack--; @@ -266,7 +266,7 @@ portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE } /*-----------------------------------------------------------*/ -portBASE_TYPE xPortStartScheduler( void ) +BaseType_t xPortStartScheduler( void ) { /* Use pxCurrentTCB just so it does not get optimised away. */ if( pxCurrentTCB != NULL ) @@ -355,7 +355,7 @@ void prvTickISR( void ) /* If this is the first tick since exiting tickless mode then the CMT compare match value needs resetting. */ - CMT0.CMCOR = ( unsigned short ) ulMatchValueForOneTick; + CMT0.CMCOR = ( uint16_t ) ulMatchValueForOneTick; } #endif } @@ -468,7 +468,7 @@ static void prvSetupTimerInterrupt( void ) CMT0.CMCR.BIT.CMIE = 1; /* Set the compare match value. */ - CMT0.CMCOR = ( unsigned short ) ulMatchValueForOneTick; + CMT0.CMCOR = ( uint16_t ) ulMatchValueForOneTick; /* Divide the PCLK. */ #if portCLOCK_DIVISOR == 512 @@ -507,7 +507,7 @@ static void prvSetupTimerInterrupt( void ) #if configUSE_TICKLESS_IDLE == 1 - static void prvSleep( portTickType xExpectedIdleTime ) + static void prvSleep( TickType_t xExpectedIdleTime ) { /* Allow the application to define some pre-sleep processing. */ configPRE_SLEEP_PROCESSING( xExpectedIdleTime ); @@ -529,9 +529,9 @@ static void prvSetupTimerInterrupt( void ) #if configUSE_TICKLESS_IDLE == 1 - void vPortSuppressTicksAndSleep( portTickType xExpectedIdleTime ) + void vPortSuppressTicksAndSleep( TickType_t xExpectedIdleTime ) { - unsigned long ulMatchValue, ulCompleteTickPeriods, ulCurrentCount; + uint32_t ulMatchValue, ulCompleteTickPeriods, ulCurrentCount; eSleepModeStatus eSleepAction; /* THIS FUNCTION IS CALLED WITH THE SCHEDULER SUSPENDED. */ @@ -614,8 +614,8 @@ static void prvSetupTimerInterrupt( void ) /* Adjust the match value to take into account that the current time slice is already partially complete. */ - ulMatchValue -= ( unsigned long ) CMT0.CMCNT; - CMT0.CMCOR = ( unsigned short ) ulMatchValue; + ulMatchValue -= ( uint32_t ) CMT0.CMCNT; + CMT0.CMCOR = ( uint16_t ) ulMatchValue; /* Restart the CMT to count up to the new match value. */ CMT0.CMCNT = 0; @@ -635,7 +635,7 @@ static void prvSetupTimerInterrupt( void ) /* Nothing to do here. */ } - ulCurrentCount = ( unsigned long ) CMT0.CMCNT; + ulCurrentCount = ( uint32_t ) CMT0.CMCNT; if( ulTickFlag != pdFALSE ) { @@ -645,7 +645,7 @@ static void prvSetupTimerInterrupt( void ) exited. Reset the match value with whatever remains of this tick period. */ ulMatchValue = ulMatchValueForOneTick - ulCurrentCount; - CMT0.CMCOR = ( unsigned short ) ulMatchValue; + CMT0.CMCOR = ( uint16_t ) ulMatchValue; /* The tick interrupt handler will already have pended the tick processing in the kernel. As the pending tick will be @@ -665,7 +665,7 @@ static void prvSetupTimerInterrupt( void ) /* The match value is set to whatever fraction of a single tick period remains. */ ulMatchValue = ulCurrentCount - ( ulCompleteTickPeriods * ulMatchValueForOneTick ); - CMT0.CMCOR = ( unsigned short ) ulMatchValue; + CMT0.CMCOR = ( uint16_t ) ulMatchValue; } /* Restart the CMT so it runs up to the match value. The match value diff --git a/FreeRTOS/Source/portable/Renesas/RX100/portmacro.h b/FreeRTOS/Source/portable/Renesas/RX100/portmacro.h index bdf7fd0d9..0ac9f6c4c 100644 --- a/FreeRTOS/Source/portable/Renesas/RX100/portmacro.h +++ b/FreeRTOS/Source/portable/Renesas/RX100/portmacro.h @@ -1,5 +1,5 @@ /* - FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. + FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. All rights reserved VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. @@ -91,22 +91,26 @@ than portSTACK_TYPE and portBASE_TYPE. */ #define portDOUBLE double #define portLONG long #define portSHORT short -#define portSTACK_TYPE unsigned portLONG +#define portSTACK_TYPE uint32_t #define portBASE_TYPE long +typedef portSTACK_TYPE StackType_t; +typedef long BaseType_t; +typedef unsigned long UBaseType_t; + #if( configUSE_16_BIT_TICKS == 1 ) - typedef unsigned portSHORT portTickType; - #define portMAX_DELAY ( portTickType ) 0xffff + typedef uint16_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffff #else - typedef unsigned portLONG portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffffUL + typedef uint32_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffffffffUL #endif /*-----------------------------------------------------------*/ /* Hardware specifics. */ #define portBYTE_ALIGNMENT 8 /* Could make four, according to manual. */ #define portSTACK_GROWTH -1 -#define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ ) +#define portTICK_RATE_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ ) #define portNOP() nop() #pragma inline_asm vPortYield @@ -127,14 +131,14 @@ static void vPortYield( void ) #define portYIELD() vPortYield() #define portYIELD_FROM_ISR( x ) if( x != pdFALSE ) { portYIELD(); } -/* These macros should not be called directly, but through the -taskENTER_CRITICAL() and taskEXIT_CRITICAL() macros. An extra check is -performed if configASSERT() is defined to ensure an assertion handler does not -inadvertently attempt to lower the IPL when the call to assert was triggered -because the IPL value was found to be above configMAX_SYSCALL_INTERRUPT_PRIORITY -when an ISR safe FreeRTOS API function was executed. ISR safe FreeRTOS API -functions are those that end in FromISR. FreeRTOS maintains a separate -interrupt API to ensure API function and interrupt entry is as fast and as +/* These macros should not be called directly, but through the +taskENTER_CRITICAL() and taskEXIT_CRITICAL() macros. An extra check is +performed if configASSERT() is defined to ensure an assertion handler does not +inadvertently attempt to lower the IPL when the call to assert was triggered +because the IPL value was found to be above configMAX_SYSCALL_INTERRUPT_PRIORITY +when an ISR safe FreeRTOS API function was executed. ISR safe FreeRTOS API +functions are those that end in FromISR. FreeRTOS maintains a separate +interrupt API to ensure API function and interrupt entry is as fast and as simple as possible. */ #define portENABLE_INTERRUPTS() set_ipl( ( long ) 0 ) #ifdef configASSERT @@ -162,7 +166,7 @@ extern void vTaskExitCritical( void ); /* Tickless idle/low power functionality. */ #if configUSE_TICKLESS_IDLE == 1 #ifndef portSUPPRESS_TICKS_AND_SLEEP - extern void vPortSuppressTicksAndSleep( portTickType xExpectedIdleTime ); + extern void vPortSuppressTicksAndSleep( TickType_t xExpectedIdleTime ); #define portSUPPRESS_TICKS_AND_SLEEP( xExpectedIdleTime ) vPortSuppressTicksAndSleep( xExpectedIdleTime ) #endif #endif diff --git a/FreeRTOS/Source/portable/Renesas/RX200/port.c b/FreeRTOS/Source/portable/Renesas/RX200/port.c index 2dad68672..638b59d9d 100644 --- a/FreeRTOS/Source/portable/Renesas/RX200/port.c +++ b/FreeRTOS/Source/portable/Renesas/RX200/port.c @@ -81,15 +81,15 @@ /* Tasks should start with interrupts enabled and in Supervisor mode, therefore PSW is set with U and I set, and PM and IPL clear. */ -#define portINITIAL_PSW ( ( portSTACK_TYPE ) 0x00030000 ) +#define portINITIAL_PSW ( ( StackType_t ) 0x00030000 ) /*-----------------------------------------------------------*/ /* The following lines are to ensure vSoftwareInterruptEntry can be referenced, and therefore installed in the vector table, when the FreeRTOS code is built as a library. */ -extern portBASE_TYPE vSoftwareInterruptEntry; -const portBASE_TYPE * p_vSoftwareInterruptEntry = &vSoftwareInterruptEntry; +extern BaseType_t vSoftwareInterruptEntry; +const BaseType_t * p_vSoftwareInterruptEntry = &vSoftwareInterruptEntry; /*-----------------------------------------------------------*/ @@ -126,7 +126,7 @@ extern void vTaskSwitchContext( void ); /* * See header file for description. */ -portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) +StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) { /* Offset to end up on 8 byte boundary. */ pxTopOfStack--; @@ -138,7 +138,7 @@ portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxTopOfStack--; *pxTopOfStack = portINITIAL_PSW; pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) pxCode; + *pxTopOfStack = ( StackType_t ) pxCode; /* When debugging it can be useful if every register is set to a known value. Otherwise code space can be saved by just setting the registers @@ -181,7 +181,7 @@ portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE } #endif - *pxTopOfStack = ( portSTACK_TYPE ) pvParameters; /* R1 */ + *pxTopOfStack = ( StackType_t ) pvParameters; /* R1 */ pxTopOfStack--; *pxTopOfStack = 0x12345678; /* Accumulator. */ pxTopOfStack--; @@ -191,7 +191,7 @@ portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE } /*-----------------------------------------------------------*/ -portBASE_TYPE xPortStartScheduler( void ) +BaseType_t xPortStartScheduler( void ) { extern void vApplicationSetupTimerInterrupt( void ); diff --git a/FreeRTOS/Source/portable/Renesas/RX200/portmacro.h b/FreeRTOS/Source/portable/Renesas/RX200/portmacro.h index 575bd12ac..a74c43b88 100644 --- a/FreeRTOS/Source/portable/Renesas/RX200/portmacro.h +++ b/FreeRTOS/Source/portable/Renesas/RX200/portmacro.h @@ -1,5 +1,5 @@ /* - FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. + FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. All rights reserved VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. @@ -75,7 +75,7 @@ extern "C" { #include "machine.h" /*----------------------------------------------------------- - * Port specific definitions. + * Port specific definitions. * * The settings in this file configure FreeRTOS correctly for the * given hardware and compiler. @@ -91,22 +91,26 @@ portSTACK_TYPE and portBASE_TYPE. */ #define portDOUBLE double #define portLONG long #define portSHORT short -#define portSTACK_TYPE unsigned portLONG +#define portSTACK_TYPE uint32_t #define portBASE_TYPE long +typedef portSTACK_TYPE StackType_t; +typedef long BaseType_t; +typedef unsigned long UBaseType_t; + #if( configUSE_16_BIT_TICKS == 1 ) - typedef unsigned portSHORT portTickType; - #define portMAX_DELAY ( portTickType ) 0xffff + typedef uint16_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffff #else - typedef unsigned portLONG portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffffUL + typedef uint32_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffffffffUL #endif /*-----------------------------------------------------------*/ /* Hardware specifics. */ #define portBYTE_ALIGNMENT 8 /* Could make four, according to manual. */ #define portSTACK_GROWTH -1 -#define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ ) +#define portTICK_RATE_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ ) #define portNOP() nop() #pragma inline_asm vPortYield @@ -127,14 +131,14 @@ static void vPortYield( void ) #define portYIELD() vPortYield() #define portYIELD_FROM_ISR( x ) if( x != pdFALSE ) portYIELD() -/* These macros should not be called directly, but through the -taskENTER_CRITICAL() and taskEXIT_CRITICAL() macros. An extra check is -performed if configASSERT() is defined to ensure an assertion handler does not -inadvertently attempt to lower the IPL when the call to assert was triggered -because the IPL value was found to be above configMAX_SYSCALL_INTERRUPT_PRIORITY -when an ISR safe FreeRTOS API function was executed. ISR safe FreeRTOS API -functions are those that end in FromISR. FreeRTOS maintains a separate -interrupt API to ensure API function and interrupt entry is as fast and as +/* These macros should not be called directly, but through the +taskENTER_CRITICAL() and taskEXIT_CRITICAL() macros. An extra check is +performed if configASSERT() is defined to ensure an assertion handler does not +inadvertently attempt to lower the IPL when the call to assert was triggered +because the IPL value was found to be above configMAX_SYSCALL_INTERRUPT_PRIORITY +when an ISR safe FreeRTOS API function was executed. ISR safe FreeRTOS API +functions are those that end in FromISR. FreeRTOS maintains a separate +interrupt API to ensure API function and interrupt entry is as fast and as simple as possible. */ #define portENABLE_INTERRUPTS() set_ipl( ( long ) 0 ) #ifdef configASSERT diff --git a/FreeRTOS/Source/portable/Renesas/RX600/port.c b/FreeRTOS/Source/portable/Renesas/RX600/port.c index 636c8e62f..9ec2931ed 100644 --- a/FreeRTOS/Source/portable/Renesas/RX600/port.c +++ b/FreeRTOS/Source/portable/Renesas/RX600/port.c @@ -81,16 +81,16 @@ /* Tasks should start with interrupts enabled and in Supervisor mode, therefore PSW is set with U and I set, and PM and IPL clear. */ -#define portINITIAL_PSW ( ( portSTACK_TYPE ) 0x00030000 ) -#define portINITIAL_FPSW ( ( portSTACK_TYPE ) 0x00000100 ) +#define portINITIAL_PSW ( ( StackType_t ) 0x00030000 ) +#define portINITIAL_FPSW ( ( StackType_t ) 0x00000100 ) /*-----------------------------------------------------------*/ /* The following lines are to ensure vSoftwareInterruptEntry can be referenced, and therefore installed in the vector table, when the FreeRTOS code is built as a library. */ -extern portBASE_TYPE vSoftwareInterruptEntry; -const portBASE_TYPE * p_vSoftwareInterruptEntry = &vSoftwareInterruptEntry; +extern BaseType_t vSoftwareInterruptEntry; +const BaseType_t * p_vSoftwareInterruptEntry = &vSoftwareInterruptEntry; /*-----------------------------------------------------------*/ @@ -127,7 +127,7 @@ extern void vTaskSwitchContext( void ); /* * See header file for description. */ -portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) +StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) { /* R0 is not included as it is the stack pointer. */ @@ -135,7 +135,7 @@ portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxTopOfStack--; *pxTopOfStack = portINITIAL_PSW; pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) pxCode; + *pxTopOfStack = ( StackType_t ) pxCode; /* When debugging it can be useful if every register is set to a known value. Otherwise code space can be saved by just setting the registers @@ -178,7 +178,7 @@ portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE } #endif - *pxTopOfStack = ( portSTACK_TYPE ) pvParameters; /* R1 */ + *pxTopOfStack = ( StackType_t ) pvParameters; /* R1 */ pxTopOfStack--; *pxTopOfStack = portINITIAL_FPSW; pxTopOfStack--; @@ -190,7 +190,7 @@ portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE } /*-----------------------------------------------------------*/ -portBASE_TYPE xPortStartScheduler( void ) +BaseType_t xPortStartScheduler( void ) { extern void vApplicationSetupTimerInterrupt( void ); diff --git a/FreeRTOS/Source/portable/Renesas/RX600/portmacro.h b/FreeRTOS/Source/portable/Renesas/RX600/portmacro.h index 847021405..e1fe541c5 100644 --- a/FreeRTOS/Source/portable/Renesas/RX600/portmacro.h +++ b/FreeRTOS/Source/portable/Renesas/RX600/portmacro.h @@ -1,5 +1,5 @@ /* - FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. + FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. All rights reserved VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. @@ -91,22 +91,26 @@ portSTACK_TYPE and portBASE_TYPE. */ #define portDOUBLE double #define portLONG long #define portSHORT short -#define portSTACK_TYPE unsigned portLONG +#define portSTACK_TYPE uint32_t #define portBASE_TYPE long +typedef portSTACK_TYPE StackType_t; +typedef long BaseType_t; +typedef unsigned long UBaseType_t; + #if( configUSE_16_BIT_TICKS == 1 ) - typedef unsigned portSHORT portTickType; - #define portMAX_DELAY ( portTickType ) 0xffff + typedef uint16_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffff #else - typedef unsigned portLONG portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffffUL + typedef uint32_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffffffffUL #endif /*-----------------------------------------------------------*/ /* Hardware specifics. */ #define portBYTE_ALIGNMENT 8 /* Could make four, according to manual. */ #define portSTACK_GROWTH -1 -#define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ ) +#define portTICK_RATE_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ ) #define portNOP() nop() @@ -128,14 +132,14 @@ static void vPortYield( void ) #define portYIELD() vPortYield() #define portYIELD_FROM_ISR( x ) if( x != pdFALSE ) portYIELD() -/* These macros should not be called directly, but through the -taskENTER_CRITICAL() and taskEXIT_CRITICAL() macros. An extra check is -performed if configASSERT() is defined to ensure an assertion handler does not -inadvertently attempt to lower the IPL when the call to assert was triggered -because the IPL value was found to be above configMAX_SYSCALL_INTERRUPT_PRIORITY -when an ISR safe FreeRTOS API function was executed. ISR safe FreeRTOS API -functions are those that end in FromISR. FreeRTOS maintains a separate -interrupt API to ensure API function and interrupt entry is as fast and as +/* These macros should not be called directly, but through the +taskENTER_CRITICAL() and taskEXIT_CRITICAL() macros. An extra check is +performed if configASSERT() is defined to ensure an assertion handler does not +inadvertently attempt to lower the IPL when the call to assert was triggered +because the IPL value was found to be above configMAX_SYSCALL_INTERRUPT_PRIORITY +when an ISR safe FreeRTOS API function was executed. ISR safe FreeRTOS API +functions are those that end in FromISR. FreeRTOS maintains a separate +interrupt API to ensure API function and interrupt entry is as fast and as simple as possible. */ #define portENABLE_INTERRUPTS() set_ipl( ( long ) 0 ) #ifdef configASSERT diff --git a/FreeRTOS/Source/portable/Renesas/SH2A_FPU/port.c b/FreeRTOS/Source/portable/Renesas/SH2A_FPU/port.c index 68eeb1a1d..1fd30d300 100644 --- a/FreeRTOS/Source/portable/Renesas/SH2A_FPU/port.c +++ b/FreeRTOS/Source/portable/Renesas/SH2A_FPU/port.c @@ -102,14 +102,14 @@ extern void vPortStartFirstTask( void ); /* * Obtains the current GBR value - defined in portasm.src. */ -extern unsigned long ulPortGetGBR( void ); +extern uint32_t ulPortGetGBR( void ); /*-----------------------------------------------------------*/ /* * See header file for description. */ -portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) +StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) { /* Mark the end of the stack - used for debugging only and can be removed. */ *pxTopOfStack = 0x11111111UL; @@ -124,7 +124,7 @@ portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxTopOfStack--; /* PC. */ - *pxTopOfStack = ( unsigned long ) pxCode; + *pxTopOfStack = ( uint32_t ) pxCode; pxTopOfStack--; /* PR. */ @@ -172,7 +172,7 @@ portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxTopOfStack--; /* R4. */ - *pxTopOfStack = ( unsigned long ) pvParameters; + *pxTopOfStack = ( uint32_t ) pvParameters; pxTopOfStack--; /* R3. */ @@ -211,7 +211,7 @@ portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE } /*-----------------------------------------------------------*/ -portBASE_TYPE xPortStartScheduler( void ) +BaseType_t xPortStartScheduler( void ) { extern void vApplicationSetupTimerInterrupt( void ); @@ -240,7 +240,7 @@ void vPortEndScheduler( void ) void vPortYield( void ) { -long lInterruptMask; +int32_t lInterruptMask; /* Ensure the yield trap runs at the same priority as the other interrupts that can cause a context switch. */ @@ -259,10 +259,10 @@ long lInterruptMask; } /*-----------------------------------------------------------*/ -portBASE_TYPE xPortUsesFloatingPoint( xTaskHandle xTask ) +BaseType_t xPortUsesFloatingPoint( TaskHandle_t xTask ) { -unsigned long *pulFlopBuffer; -portBASE_TYPE xReturn; +uint32_t *pulFlopBuffer; +BaseType_t xReturn; extern void * volatile pxCurrentTCB; /* This function tells the kernel that the task referenced by xTask is @@ -273,11 +273,11 @@ extern void * volatile pxCurrentTCB; subject task - so pxCurrentTCB is the task handle. */ if( xTask == NULL ) { - xTask = ( xTaskHandle ) pxCurrentTCB; + xTask = ( TaskHandle_t ) pxCurrentTCB; } /* Allocate a buffer large enough to hold all the flop registers. */ - pulFlopBuffer = ( unsigned long * ) pvPortMalloc( portFLOP_STORAGE_SIZE ); + pulFlopBuffer = ( uint32_t * ) pvPortMalloc( portFLOP_STORAGE_SIZE ); if( pulFlopBuffer != NULL ) { diff --git a/FreeRTOS/Source/portable/Renesas/SH2A_FPU/portmacro.h b/FreeRTOS/Source/portable/Renesas/SH2A_FPU/portmacro.h index d6fba0b4e..8ec346578 100644 --- a/FreeRTOS/Source/portable/Renesas/SH2A_FPU/portmacro.h +++ b/FreeRTOS/Source/portable/Renesas/SH2A_FPU/portmacro.h @@ -1,5 +1,5 @@ /* - FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. + FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. All rights reserved VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. @@ -74,7 +74,7 @@ extern "C" { #endif /*----------------------------------------------------------- - * Port specific definitions. + * Port specific definitions. * * The settings in this file configure FreeRTOS correctly for the * given hardware and compiler. @@ -90,22 +90,26 @@ portSTACK_TYPE and portBASE_TYPE. */ #define portDOUBLE double #define portLONG long #define portSHORT short -#define portSTACK_TYPE unsigned portLONG +#define portSTACK_TYPE uint32_t #define portBASE_TYPE long +typedef portSTACK_TYPE StackType_t; +typedef long BaseType_t; +typedef unsigned long UBaseType_t; + #if( configUSE_16_BIT_TICKS == 1 ) - typedef unsigned portSHORT portTickType; - #define portMAX_DELAY ( portTickType ) 0xffff + typedef uint16_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffff #else - typedef unsigned portLONG portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffffUL + typedef uint32_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffffffffUL #endif /*-----------------------------------------------------------*/ /* Hardware specifics. */ #define portBYTE_ALIGNMENT 8 #define portSTACK_GROWTH -1 -#define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ ) +#define portTICK_RATE_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ ) #define portNOP() nop() #define portSTART_SCHEDULER_TRAP_NO ( 32 ) #define portYIELD_TRAP_NO ( 33 ) @@ -117,22 +121,22 @@ void vPortYield( void ); extern void vTaskSwitchContext( void ); #define portYIELD_FROM_ISR( x ) if( x != pdFALSE ) vTaskSwitchContext() -/* - * This function tells the kernel that the task referenced by xTask is going to - * use the floating point registers and therefore requires the floating point - * registers saved as part of its context. +/* + * This function tells the kernel that the task referenced by xTask is going to + * use the floating point registers and therefore requires the floating point + * registers saved as part of its context. */ -portBASE_TYPE xPortUsesFloatingPoint( void* xTask ); +BaseType_t xPortUsesFloatingPoint( void* xTask ); /* * The flop save and restore functions are defined in portasm.src and called by - * the trace "task switched in" and "trace task switched out" macros. + * the trace "task switched in" and "trace task switched out" macros. */ void vPortSaveFlopRegisters( void *pulBuffer ); void vPortRestoreFlopRegisters( void *pulBuffer ); /* - * pxTaskTag is used to point to the buffer into which the floating point + * pxTaskTag is used to point to the buffer into which the floating point * context should be saved. If pxTaskTag is NULL then the task does not use * a floating point context. */ diff --git a/FreeRTOS/Source/portable/Rowley/MSP430F449/port.c b/FreeRTOS/Source/portable/Rowley/MSP430F449/port.c index ac91a852b..5ab8c4c6a 100644 --- a/FreeRTOS/Source/portable/Rowley/MSP430F449/port.c +++ b/FreeRTOS/Source/portable/Rowley/MSP430F449/port.c @@ -73,14 +73,14 @@ /* Constants required for hardware setup. The tick ISR runs off the ACLK, not the MCLK. */ -#define portACLK_FREQUENCY_HZ ( ( portTickType ) 32768 ) -#define portINITIAL_CRITICAL_NESTING ( ( unsigned short ) 10 ) -#define portFLAGS_INT_ENABLED ( ( portSTACK_TYPE ) 0x08 ) +#define portACLK_FREQUENCY_HZ ( ( TickType_t ) 32768 ) +#define portINITIAL_CRITICAL_NESTING ( ( uint16_t ) 10 ) +#define portFLAGS_INT_ENABLED ( ( StackType_t ) 0x08 ) /* We require the address of the pxCurrentTCB variable, but don't want to know any details of its type. */ -typedef void tskTCB; -extern volatile tskTCB * volatile pxCurrentTCB; +typedef void TCB_t; +extern volatile TCB_t * volatile pxCurrentTCB; /* Each task maintains a count of the critical section nesting depth. Each time a critical section is entered the count is incremented. Each time a @@ -90,7 +90,7 @@ being re-enabled if the count is zero. usCriticalNesting will get set to zero when the scheduler starts, but must not be initialised to zero as this will cause problems during the startup sequence. */ -volatile unsigned short usCriticalNesting = portINITIAL_CRITICAL_NESTING; +volatile uint16_t usCriticalNesting = portINITIAL_CRITICAL_NESTING; /*-----------------------------------------------------------*/ @@ -107,17 +107,17 @@ void prvSetupTimerInterrupt( void ); * * See the header file portable.h. */ -portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) +StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) { /* Place a few bytes of known values on the bottom of the stack. This is just useful for debugging and can be included if required. - *pxTopOfStack = ( portSTACK_TYPE ) 0x1111; + *pxTopOfStack = ( StackType_t ) 0x1111; pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x2222; + *pxTopOfStack = ( StackType_t ) 0x2222; pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x3333; + *pxTopOfStack = ( StackType_t ) 0x3333; pxTopOfStack--; */ @@ -125,44 +125,44 @@ portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE executing an ISR. We want the stack to look just as if this has happened so place a pointer to the start of the task on the stack first - followed by the flags we want the task to use when it starts up. */ - *pxTopOfStack = ( portSTACK_TYPE ) pxCode; + *pxTopOfStack = ( StackType_t ) pxCode; pxTopOfStack--; *pxTopOfStack = portFLAGS_INT_ENABLED; pxTopOfStack--; /* Next the general purpose registers. */ - *pxTopOfStack = ( portSTACK_TYPE ) 0x4444; + *pxTopOfStack = ( StackType_t ) 0x4444; pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x5555; + *pxTopOfStack = ( StackType_t ) 0x5555; pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x6666; + *pxTopOfStack = ( StackType_t ) 0x6666; pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x7777; + *pxTopOfStack = ( StackType_t ) 0x7777; pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x8888; + *pxTopOfStack = ( StackType_t ) 0x8888; pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x9999; + *pxTopOfStack = ( StackType_t ) 0x9999; pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0xaaaa; + *pxTopOfStack = ( StackType_t ) 0xaaaa; pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0xbbbb; + *pxTopOfStack = ( StackType_t ) 0xbbbb; pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0xcccc; + *pxTopOfStack = ( StackType_t ) 0xcccc; pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0xdddd; + *pxTopOfStack = ( StackType_t ) 0xdddd; pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0xeeee; + *pxTopOfStack = ( StackType_t ) 0xeeee; pxTopOfStack--; /* When the task starts is will expect to find the function parameter in R15. */ - *pxTopOfStack = ( portSTACK_TYPE ) pvParameters; + *pxTopOfStack = ( StackType_t ) pvParameters; pxTopOfStack--; /* A variable is used to keep track of the critical section nesting. This variable has to be stored as part of the task context and is initially set to zero. */ - *pxTopOfStack = ( portSTACK_TYPE ) portNO_CRITICAL_SECTION_NESTING; + *pxTopOfStack = ( StackType_t ) portNO_CRITICAL_SECTION_NESTING; /* Return a pointer to the top of the stack we have generated so this can be stored in the task control block for the task. */ diff --git a/FreeRTOS/Source/portable/Rowley/MSP430F449/portmacro.h b/FreeRTOS/Source/portable/Rowley/MSP430F449/portmacro.h index 322ae3e26..f50a88255 100644 --- a/FreeRTOS/Source/portable/Rowley/MSP430F449/portmacro.h +++ b/FreeRTOS/Source/portable/Rowley/MSP430F449/portmacro.h @@ -1,5 +1,5 @@ /* - FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. + FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. All rights reserved VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. @@ -67,7 +67,7 @@ #define PORTMACRO_H /*----------------------------------------------------------- - * Port specific definitions. + * Port specific definitions. * * The settings in this file configure FreeRTOS correctly for the * given hardware and compiler. @@ -82,18 +82,23 @@ #define portDOUBLE double #define portLONG long #define portSHORT int -#define portSTACK_TYPE unsigned portSHORT -#define portBASE_TYPE portSHORT +#define portSTACK_TYPE uint16_t +#define portBASE_TYPE short + +typedef portSTACK_TYPE StackType_t; +typedef short BaseType_t; +typedef unsigned short UBaseType_t; + #if( configUSE_16_BIT_TICKS == 1 ) - typedef unsigned portSHORT portTickType; - #define portMAX_DELAY ( portTickType ) 0xffff + typedef uint16_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffff #else - typedef unsigned portLONG portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffffUL + typedef uint32_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffffffffUL #endif -/*-----------------------------------------------------------*/ +/*-----------------------------------------------------------*/ /* Interrupt control macros. */ #define portDISABLE_INTERRUPTS() _DINT(); _NOP() @@ -101,11 +106,11 @@ /*-----------------------------------------------------------*/ /* Critical section control macros. */ -#define portNO_CRITICAL_SECTION_NESTING ( ( unsigned portSHORT ) 0 ) +#define portNO_CRITICAL_SECTION_NESTING ( ( uint16_t ) 0 ) #define portENTER_CRITICAL() \ { \ -extern volatile unsigned portSHORT usCriticalNesting; \ +extern volatile uint16_t usCriticalNesting; \ \ portDISABLE_INTERRUPTS(); \ \ @@ -117,7 +122,7 @@ extern volatile unsigned portSHORT usCriticalNesting; \ #define portEXIT_CRITICAL() \ { \ -extern volatile unsigned portSHORT usCriticalNesting; \ +extern volatile uint16_t usCriticalNesting; \ \ if( usCriticalNesting > portNO_CRITICAL_SECTION_NESTING ) \ { \ @@ -137,17 +142,17 @@ extern volatile unsigned portSHORT usCriticalNesting; \ /* Task utilities. */ /* - * Manual context switch called by portYIELD or taskYIELD. + * Manual context switch called by portYIELD or taskYIELD. */ -extern void vPortYield( void ); +extern void vPortYield( void ); #define portYIELD() vPortYield() /*-----------------------------------------------------------*/ /* Hardware specifics. */ #define portBYTE_ALIGNMENT 2 #define portSTACK_GROWTH ( -1 ) -#define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ ) -#define portNOP() +#define portTICK_RATE_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ ) +#define portNOP() /*-----------------------------------------------------------*/ /* Task function macros as described on the FreeRTOS.org WEB site. */ diff --git a/FreeRTOS/Source/portable/SDCC/Cygnal/port.c b/FreeRTOS/Source/portable/SDCC/Cygnal/port.c index fc568a051..6de638578 100644 --- a/FreeRTOS/Source/portable/SDCC/Cygnal/port.c +++ b/FreeRTOS/Source/portable/SDCC/Cygnal/port.c @@ -75,36 +75,36 @@ #include "task.h" /* Constants required to setup timer 2 to produce the RTOS tick. */ -#define portCLOCK_DIVISOR ( ( unsigned long ) 12 ) -#define portMAX_TIMER_VALUE ( ( unsigned long ) 0xffff ) -#define portENABLE_TIMER ( ( unsigned char ) 0x04 ) -#define portTIMER_2_INTERRUPT_ENABLE ( ( unsigned char ) 0x20 ) +#define portCLOCK_DIVISOR ( ( uint32_t ) 12 ) +#define portMAX_TIMER_VALUE ( ( uint32_t ) 0xffff ) +#define portENABLE_TIMER ( ( uint8_t ) 0x04 ) +#define portTIMER_2_INTERRUPT_ENABLE ( ( uint8_t ) 0x20 ) /* The value used in the IE register when a task first starts. */ -#define portGLOBAL_INTERRUPT_BIT ( ( portSTACK_TYPE ) 0x80 ) +#define portGLOBAL_INTERRUPT_BIT ( ( StackType_t ) 0x80 ) /* The value used in the PSW register when a task first starts. */ -#define portINITIAL_PSW ( ( portSTACK_TYPE ) 0x00 ) +#define portINITIAL_PSW ( ( StackType_t ) 0x00 ) /* Macro to clear the timer 2 interrupt flag. */ #define portCLEAR_INTERRUPT_FLAG() TMR2CN &= ~0x80; /* Used during a context switch to store the size of the stack being copied to or from XRAM. */ -data static unsigned char ucStackBytes; +data static uint8_t ucStackBytes; /* Used during a context switch to point to the next byte in XRAM from/to which a RAM byte is to be copied. */ -xdata static portSTACK_TYPE * data pxXRAMStack; +xdata static StackType_t * data pxXRAMStack; /* Used during a context switch to point to the next byte in RAM from/to which an XRAM byte is to be copied. */ -data static portSTACK_TYPE * data pxRAMStack; +data static StackType_t * data pxRAMStack; /* We require the address of the pxCurrentTCB variable, but don't want to know any details of its type. */ -typedef void tskTCB; -extern volatile tskTCB * volatile pxCurrentTCB; +typedef void TCB_t; +extern volatile TCB_t * volatile pxCurrentTCB; /* * Setup the hardware to generate an interrupt off timer 2 at the required @@ -123,10 +123,10 @@ static void prvSetupTimerInterrupt( void ); /* pxCurrentTCB points to a TCB which itself points to the location into \ which the first stack byte should be copied. Set pxXRAMStack to point \ to the location into which the first stack byte is to be copied. */ \ - pxXRAMStack = ( xdata portSTACK_TYPE * ) *( ( xdata portSTACK_TYPE ** ) pxCurrentTCB ); \ + pxXRAMStack = ( xdata StackType_t * ) *( ( xdata StackType_t ** ) pxCurrentTCB ); \ \ /* Set pxRAMStack to point to the first byte to be coped from the stack. */ \ - pxRAMStack = ( data portSTACK_TYPE * data ) configSTACK_START; \ + pxRAMStack = ( data StackType_t * data ) configSTACK_START; \ \ /* Calculate the size of the stack we are about to copy from the current \ stack pointer value. */ \ @@ -156,8 +156,8 @@ static void prvSetupTimerInterrupt( void ); { \ /* Setup the pointers as per portCOPY_STACK_TO_XRAM(), but this time to \ copy the data back out of XRAM and into the stack. */ \ - pxXRAMStack = ( xdata portSTACK_TYPE * ) *( ( xdata portSTACK_TYPE ** ) pxCurrentTCB ); \ - pxRAMStack = ( data portSTACK_TYPE * data ) ( configSTACK_START - 1 ); \ + pxXRAMStack = ( xdata StackType_t * ) *( ( xdata StackType_t ** ) pxCurrentTCB ); \ + pxRAMStack = ( data StackType_t * data ) ( configSTACK_START - 1 ); \ \ /* The first value stored in XRAM was the size of the stack - i.e. the \ number of bytes we need to copy back. */ \ @@ -173,7 +173,7 @@ static void prvSetupTimerInterrupt( void ); } while( ucStackBytes ); \ \ /* Restore the stack pointer ready to use the restored stack. */ \ - SP = ( unsigned char ) pxRAMStack; \ + SP = ( uint8_t ) pxRAMStack; \ } /*-----------------------------------------------------------*/ @@ -250,10 +250,10 @@ static void prvSetupTimerInterrupt( void ); /* * See header file for description. */ -portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) +StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) { -unsigned long ulAddress; -portSTACK_TYPE *pxStartOfStack; +uint32_t ulAddress; +StackType_t *pxStartOfStack; /* Leave space to write the size of the stack as the first byte. */ pxStartOfStack = pxTopOfStack; @@ -273,11 +273,11 @@ portSTACK_TYPE *pxStartOfStack; ISR. The return address that would have been pushed by the MCU. */ - ulAddress = ( unsigned long ) pxCode; - *pxTopOfStack = ( portSTACK_TYPE ) ulAddress; + ulAddress = ( uint32_t ) pxCode; + *pxTopOfStack = ( StackType_t ) ulAddress; ulAddress >>= 8; pxTopOfStack++; - *pxTopOfStack = ( portSTACK_TYPE ) ( ulAddress ); + *pxTopOfStack = ( StackType_t ) ( ulAddress ); pxTopOfStack++; /* Next all the registers will have been pushed by portSAVE_CONTEXT(). */ @@ -290,14 +290,14 @@ portSTACK_TYPE *pxStartOfStack; /* The function parameters will be passed in the DPTR and B register as a three byte generic pointer is used. */ - ulAddress = ( unsigned long ) pvParameters; - *pxTopOfStack = ( portSTACK_TYPE ) ulAddress; /* DPL */ + ulAddress = ( uint32_t ) pvParameters; + *pxTopOfStack = ( StackType_t ) ulAddress; /* DPL */ ulAddress >>= 8; *pxTopOfStack++; - *pxTopOfStack = ( portSTACK_TYPE ) ulAddress; /* DPH */ + *pxTopOfStack = ( StackType_t ) ulAddress; /* DPH */ ulAddress >>= 8; pxTopOfStack++; - *pxTopOfStack = ( portSTACK_TYPE ) ulAddress; /* b */ + *pxTopOfStack = ( StackType_t ) ulAddress; /* b */ pxTopOfStack++; /* The remaining registers are straight forward. */ @@ -325,7 +325,7 @@ portSTACK_TYPE *pxStartOfStack; the stack size byte as part of the stack size count. Finally we place the stack size at the beginning. */ - *pxStartOfStack = ( portSTACK_TYPE ) ( pxTopOfStack - pxStartOfStack ); + *pxStartOfStack = ( StackType_t ) ( pxTopOfStack - pxStartOfStack ); /* Unlike most ports, we return the start of the stack as this is where the size of the stack is stored. */ @@ -336,7 +336,7 @@ portSTACK_TYPE *pxStartOfStack; /* * See header file for description. */ -portBASE_TYPE xPortStartScheduler( void ) +BaseType_t xPortStartScheduler( void ) { /* Setup timer 2 to generate the RTOS tick. */ prvSetupTimerInterrupt(); @@ -419,14 +419,14 @@ void vPortYield( void ) _naked static void prvSetupTimerInterrupt( void ) { -unsigned char ucOriginalSFRPage; +uint8_t ucOriginalSFRPage; /* Constants calculated to give the required timer capture values. */ -const unsigned long ulTicksPerSecond = configCPU_CLOCK_HZ / portCLOCK_DIVISOR; -const unsigned long ulCaptureTime = ulTicksPerSecond / configTICK_RATE_HZ; -const unsigned long ulCaptureValue = portMAX_TIMER_VALUE - ulCaptureTime; -const unsigned char ucLowCaptureByte = ( unsigned char ) ( ulCaptureValue & ( unsigned long ) 0xff ); -const unsigned char ucHighCaptureByte = ( unsigned char ) ( ulCaptureValue >> ( unsigned long ) 8 ); +const uint32_t ulTicksPerSecond = configCPU_CLOCK_HZ / portCLOCK_DIVISOR; +const uint32_t ulCaptureTime = ulTicksPerSecond / configTICK_RATE_HZ; +const uint32_t ulCaptureValue = portMAX_TIMER_VALUE - ulCaptureTime; +const uint8_t ucLowCaptureByte = ( uint8_t ) ( ulCaptureValue & ( uint32_t ) 0xff ); +const uint8_t ucHighCaptureByte = ( uint8_t ) ( ulCaptureValue >> ( uint32_t ) 8 ); /* NOTE: This uses a timer only present on 8052 architecture. */ @@ -436,7 +436,7 @@ const unsigned char ucHighCaptureByte = ( unsigned char ) ( ulCaptureValue >> ( SFRPAGE = 0; /* TMR2CF can be left in its default state. */ - TMR2CF = ( unsigned char ) 0; + TMR2CF = ( uint8_t ) 0; /* Setup the overflow reload value. */ RCAP2L = ucLowCaptureByte; diff --git a/FreeRTOS/Source/portable/SDCC/Cygnal/portmacro.h b/FreeRTOS/Source/portable/SDCC/Cygnal/portmacro.h index 9f4e33aa9..63a19fa7f 100644 --- a/FreeRTOS/Source/portable/SDCC/Cygnal/portmacro.h +++ b/FreeRTOS/Source/portable/SDCC/Cygnal/portmacro.h @@ -1,5 +1,5 @@ /* - FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. + FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. All rights reserved VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. @@ -76,7 +76,7 @@ void vSerialISR( void ) interrupt 4; /*----------------------------------------------------------- - * Port specific definitions. + * Port specific definitions. * * The settings in this file configure FreeRTOS correctly for the * given hardware and compiler. @@ -91,17 +91,21 @@ void vSerialISR( void ) interrupt 4; #define portDOUBLE float #define portLONG long #define portSHORT short -#define portSTACK_TYPE unsigned portCHAR +#define portSTACK_TYPE uint8_t #define portBASE_TYPE char +typedef portSTACK_TYPE StackType_t; +typedef signed char BaseType_t; +typedef unsigned char UBaseType_t; + #if( configUSE_16_BIT_TICKS == 1 ) - typedef unsigned portSHORT portTickType; - #define portMAX_DELAY ( portTickType ) 0xffff + typedef uint16_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffff #else - typedef unsigned portLONG portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffffUL + typedef uint32_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffffffffUL #endif -/*-----------------------------------------------------------*/ +/*-----------------------------------------------------------*/ /* Critical section management. */ #define portENTER_CRITICAL() _asm \ @@ -121,24 +125,24 @@ void vSerialISR( void ) interrupt 4; #define portDISABLE_INTERRUPTS() EA = 0; #define portENABLE_INTERRUPTS() EA = 1; -/*-----------------------------------------------------------*/ +/*-----------------------------------------------------------*/ /* Hardware specifics. */ #define portBYTE_ALIGNMENT 1 #define portSTACK_GROWTH ( 1 ) -#define portTICK_RATE_MS ( ( unsigned portLONG ) 1000 / configTICK_RATE_HZ ) -/*-----------------------------------------------------------*/ +#define portTICK_RATE_MS ( ( uint32_t ) 1000 / configTICK_RATE_HZ ) +/*-----------------------------------------------------------*/ /* Task utilities. */ void vPortYield( void ) _naked; #define portYIELD() vPortYield(); -/*-----------------------------------------------------------*/ +/*-----------------------------------------------------------*/ #define portNOP() _asm \ nop \ _endasm; -/*-----------------------------------------------------------*/ +/*-----------------------------------------------------------*/ /* Task function macros as described on the FreeRTOS.org WEB site. */ #define portTASK_FUNCTION_PROTO( vFunction, pvParameters ) void vFunction( void *pvParameters ) diff --git a/FreeRTOS/Source/portable/Softune/MB91460/port.c b/FreeRTOS/Source/portable/Softune/MB91460/port.c index bd71b455c..0e9d47a21 100644 --- a/FreeRTOS/Source/portable/Softune/MB91460/port.c +++ b/FreeRTOS/Source/portable/Softune/MB91460/port.c @@ -71,8 +71,8 @@ /* We require the address of the pxCurrentTCB variable, but don't want to know any details of its type. */ -typedef void tskTCB; -extern volatile tskTCB * volatile pxCurrentTCB; +typedef void TCB_t; +extern volatile TCB_t * volatile pxCurrentTCB; /*-----------------------------------------------------------*/ @@ -143,7 +143,7 @@ static void prvSetupTimerInterrupt( void ); * * See the header file portable.h. */ -portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) +StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) { /* Place a few bytes of known values on the bottom of the stack. This is just useful for debugging. */ @@ -158,63 +158,63 @@ portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE /* This is a redundant push to the stack, it may be required if in some implementations of the compiler the parameter to the task is passed on to the stack rather than in R4 register. */ - *pxTopOfStack = (portSTACK_TYPE)(pvParameters); + *pxTopOfStack = (StackType_t)(pvParameters); pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x00000000; /* RP */ + *pxTopOfStack = ( StackType_t ) 0x00000000; /* RP */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x00007777; /* R7 */ + *pxTopOfStack = ( StackType_t ) 0x00007777; /* R7 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x00006666; /* R6 */ + *pxTopOfStack = ( StackType_t ) 0x00006666; /* R6 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x00005555; /* R5 */ + *pxTopOfStack = ( StackType_t ) 0x00005555; /* R5 */ pxTopOfStack--; /* In the current implementation of the compiler the first parameter to the task (or function) is passed via R4 parameter to the task, hence the pvParameters pointer is copied into the R4 register. See compiler manual section 4.6.2 for more information. */ - *pxTopOfStack = ( portSTACK_TYPE ) (pvParameters); /* R4 */ + *pxTopOfStack = ( StackType_t ) (pvParameters); /* R4 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x00003333; /* R3 */ + *pxTopOfStack = ( StackType_t ) 0x00003333; /* R3 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x00002222; /* R2 */ + *pxTopOfStack = ( StackType_t ) 0x00002222; /* R2 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x00001111; /* R1 */ + *pxTopOfStack = ( StackType_t ) 0x00001111; /* R1 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x00000001; /* R0 */ + *pxTopOfStack = ( StackType_t ) 0x00000001; /* R0 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x0000EEEE; /* R14 */ + *pxTopOfStack = ( StackType_t ) 0x0000EEEE; /* R14 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x0000DDDD; /* R13 */ + *pxTopOfStack = ( StackType_t ) 0x0000DDDD; /* R13 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x0000CCCC; /* R12 */ + *pxTopOfStack = ( StackType_t ) 0x0000CCCC; /* R12 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x0000BBBB; /* R11 */ + *pxTopOfStack = ( StackType_t ) 0x0000BBBB; /* R11 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x0000AAAA; /* R10 */ + *pxTopOfStack = ( StackType_t ) 0x0000AAAA; /* R10 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x00009999; /* R9 */ + *pxTopOfStack = ( StackType_t ) 0x00009999; /* R9 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x00008888; /* R8 */ + *pxTopOfStack = ( StackType_t ) 0x00008888; /* R8 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x11110000; /* MDH */ + *pxTopOfStack = ( StackType_t ) 0x11110000; /* MDH */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x22220000; /* MDL */ + *pxTopOfStack = ( StackType_t ) 0x22220000; /* MDL */ pxTopOfStack--; /* The start of the task code. */ - *pxTopOfStack = ( portSTACK_TYPE ) pxCode; /* PC */ + *pxTopOfStack = ( StackType_t ) pxCode; /* PC */ pxTopOfStack--; /* PS - User Mode, USP, ILM=31, Interrupts enabled */ - *pxTopOfStack = ( portSTACK_TYPE ) 0x001F0030; /* PS */ + *pxTopOfStack = ( StackType_t ) 0x001F0030; /* PS */ return pxTopOfStack; } /*-----------------------------------------------------------*/ -portBASE_TYPE xPortStartScheduler( void ) +BaseType_t xPortStartScheduler( void ) { /* Setup the hardware to generate the tick. */ prvSetupTimerInterrupt(); @@ -243,7 +243,7 @@ void vPortEndScheduler( void ) static void prvSetupTimerInterrupt( void ) { /* The peripheral clock divided by 32 is used by the timer. */ -const unsigned short usReloadValue = ( unsigned short ) ( ( ( configPER_CLOCK_HZ / configTICK_RATE_HZ ) / 32UL ) - 1UL ); +const uint16_t usReloadValue = ( uint16_t ) ( ( ( configPER_CLOCK_HZ / configTICK_RATE_HZ ) / 32UL ) - 1UL ); /* Setup RLT0 to generate a tick interrupt. */ diff --git a/FreeRTOS/Source/portable/Softune/MB91460/portmacro.h b/FreeRTOS/Source/portable/Softune/MB91460/portmacro.h index 26a931435..faf2fb85e 100644 --- a/FreeRTOS/Source/portable/Softune/MB91460/portmacro.h +++ b/FreeRTOS/Source/portable/Softune/MB91460/portmacro.h @@ -1,5 +1,5 @@ /* - FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. + FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. All rights reserved VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. @@ -73,7 +73,7 @@ #include /*----------------------------------------------------------- - * Port specific definitions. + * Port specific definitions. * * The settings in this file configure FreeRTOS correctly for the * given hardware and compiler. @@ -88,17 +88,22 @@ #define portDOUBLE double #define portLONG long #define portSHORT short -#define portSTACK_TYPE unsigned portLONG +#define portSTACK_TYPE uint32_t #define portBASE_TYPE long +typedef portSTACK_TYPE StackType_t; +typedef long BaseType_t; +typedef unsigned long UBaseType_t; + + #if( configUSE_16_BIT_TICKS == 1 ) - typedef unsigned portSHORT portTickType; - #define portMAX_DELAY ( portTickType ) 0xffff + typedef uint16_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffff #else - typedef unsigned portLONG portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffffUL + typedef uint32_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffffffffUL #endif -/*-----------------------------------------------------------*/ +/*-----------------------------------------------------------*/ /* Critical section management. */ #if configKERNEL_INTERRUPT_PRIORITY != 30 @@ -119,7 +124,7 @@ /* Architecture specifics. */ #define portSTACK_GROWTH ( -1 ) -#define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ ) +#define portTICK_RATE_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ ) #define portBYTE_ALIGNMENT 4 #define portNOP() __asm( " nop " ); /*-----------------------------------------------------------*/ diff --git a/FreeRTOS/Source/portable/Softune/MB96340/port.c b/FreeRTOS/Source/portable/Softune/MB96340/port.c index cb5cd30e5..1fb04a680 100644 --- a/FreeRTOS/Source/portable/Softune/MB96340/port.c +++ b/FreeRTOS/Source/portable/Softune/MB96340/port.c @@ -73,12 +73,12 @@ /* * Get current value of DPR and ADB registers */ -portSTACK_TYPE xGet_DPR_ADB_bank( void ); +StackType_t xGet_DPR_ADB_bank( void ); /* * Get current value of DTB and PCB registers */ -portSTACK_TYPE xGet_DTB_PCB_bank( void ); +StackType_t xGet_DTB_PCB_bank( void ); /* * Sets up the periodic ISR used for the RTOS tick. This uses RLT0, but @@ -92,8 +92,8 @@ static void prvSetupRLT0Interrupt( void ); * We require the address of the pxCurrentTCB variable, but don't want to know * any details of its type. */ -typedef void tskTCB; -extern volatile tskTCB * volatile pxCurrentTCB; +typedef void TCB_t; +extern volatile TCB_t * volatile pxCurrentTCB; /*-----------------------------------------------------------*/ @@ -298,7 +298,7 @@ _xGet_DTB_PCB_bank: * * See the header file portable.h. */ -portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) +StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) { /* Place a few bytes of known values on the bottom of the stack. This is just useful for debugging. */ @@ -316,12 +316,12 @@ portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE bits. */ #if( ( configMEMMODEL == portCOMPACT ) || ( configMEMMODEL == portLARGE ) ) { - *pxTopOfStack = ( portSTACK_TYPE ) ( ( unsigned long ) ( pvParameters ) >> 16 ); + *pxTopOfStack = ( StackType_t ) ( ( uint32_t ) ( pvParameters ) >> 16 ); pxTopOfStack--; } #endif - *pxTopOfStack = ( portSTACK_TYPE ) ( pvParameters ); + *pxTopOfStack = ( StackType_t ) ( pvParameters ); pxTopOfStack--; /* This is redundant push to the stack. This is required in order to introduce @@ -329,14 +329,14 @@ portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE the task stack. */ #if( ( configMEMMODEL == portMEDIUM ) || ( configMEMMODEL == portLARGE ) ) { - *pxTopOfStack = ( xGet_DTB_PCB_bank() & 0xff00 ) | ( ( ( long ) ( pxCode ) >> 16 ) & 0xff ); + *pxTopOfStack = ( xGet_DTB_PCB_bank() & 0xff00 ) | ( ( ( int32_t ) ( pxCode ) >> 16 ) & 0xff ); pxTopOfStack--; } #endif /* This is redundant push to the stack. This is required in order to introduce an offset so the task correctly accesses the parameter passed on the task stack. */ - *pxTopOfStack = ( portSTACK_TYPE ) ( pxCode ); + *pxTopOfStack = ( StackType_t ) ( pxCode ); pxTopOfStack--; /* PS - User Mode, ILM=7, RB=0, Interrupts enabled,USP */ @@ -344,7 +344,7 @@ portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxTopOfStack--; /* PC */ - *pxTopOfStack = ( portSTACK_TYPE ) ( pxCode ); + *pxTopOfStack = ( StackType_t ) ( pxCode ); pxTopOfStack--; /* DTB | PCB */ @@ -359,7 +359,7 @@ portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE along with PC to indicate the start address of the function. */ #if( ( configMEMMODEL == portMEDIUM ) || ( configMEMMODEL == portLARGE ) ) { - *pxTopOfStack = ( xGet_DTB_PCB_bank() & 0xff00 ) | ( ( ( long ) ( pxCode ) >> 16 ) & 0xff ); + *pxTopOfStack = ( xGet_DTB_PCB_bank() & 0xff00 ) | ( ( ( int32_t ) ( pxCode ) >> 16 ) & 0xff ); pxTopOfStack--; } #endif @@ -369,29 +369,29 @@ portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxTopOfStack--; /* AL */ - *pxTopOfStack = ( portSTACK_TYPE ) 0x9999; + *pxTopOfStack = ( StackType_t ) 0x9999; pxTopOfStack--; /* AH */ - *pxTopOfStack = ( portSTACK_TYPE ) 0xAAAA; + *pxTopOfStack = ( StackType_t ) 0xAAAA; pxTopOfStack--; /* Next the general purpose registers. */ - *pxTopOfStack = ( portSTACK_TYPE ) 0x7777; /* RW7 */ + *pxTopOfStack = ( StackType_t ) 0x7777; /* RW7 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x6666; /* RW6 */ + *pxTopOfStack = ( StackType_t ) 0x6666; /* RW6 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x5555; /* RW5 */ + *pxTopOfStack = ( StackType_t ) 0x5555; /* RW5 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x4444; /* RW4 */ + *pxTopOfStack = ( StackType_t ) 0x4444; /* RW4 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x3333; /* RW3 */ + *pxTopOfStack = ( StackType_t ) 0x3333; /* RW3 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x2222; /* RW2 */ + *pxTopOfStack = ( StackType_t ) 0x2222; /* RW2 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x1111; /* RW1 */ + *pxTopOfStack = ( StackType_t ) 0x1111; /* RW1 */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x8888; /* RW0 */ + *pxTopOfStack = ( StackType_t ) 0x8888; /* RW0 */ return pxTopOfStack; } @@ -400,7 +400,7 @@ portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE static void prvSetupRLT0Interrupt( void ) { /* The peripheral clock divided by 16 is used by the timer. */ -const unsigned short usReloadValue = ( unsigned short ) ( ( ( configCLKP1_CLOCK_HZ / configTICK_RATE_HZ ) / 16UL ) - 1UL ); +const uint16_t usReloadValue = ( uint16_t ) ( ( ( configCLKP1_CLOCK_HZ / configTICK_RATE_HZ ) / 16UL ) - 1UL ); /* set reload value = 34999+1, TICK Interrupt after 10 ms @ 56MHz of CLKP1 */ TMRLR0 = usReloadValue; @@ -410,7 +410,7 @@ const unsigned short usReloadValue = ( unsigned short ) ( ( ( configCLKP1_CLOCK_ } /*-----------------------------------------------------------*/ -portBASE_TYPE xPortStartScheduler( void ) +BaseType_t xPortStartScheduler( void ) { /* Setup the hardware to generate the tick. */ prvSetupRLT0Interrupt(); diff --git a/FreeRTOS/Source/portable/Softune/MB96340/portmacro.h b/FreeRTOS/Source/portable/Softune/MB96340/portmacro.h index c8fe208bf..dd5c31ef3 100644 --- a/FreeRTOS/Source/portable/Softune/MB96340/portmacro.h +++ b/FreeRTOS/Source/portable/Softune/MB96340/portmacro.h @@ -1,5 +1,5 @@ /* - FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. + FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. All rights reserved VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. @@ -79,7 +79,7 @@ FreeRTOSConfig.h to set the configMEMMODEL value. */ /*----------------------------------------------------------- - * Port specific definitions. + * Port specific definitions. * * The settings in this file configure FreeRTOS correctly for the * given hardware and compiler. @@ -94,17 +94,22 @@ FreeRTOSConfig.h to set the configMEMMODEL value. */ #define portDOUBLE double #define portLONG long #define portSHORT short -#define portSTACK_TYPE unsigned portSHORT -#define portBASE_TYPE portSHORT +#define portSTACK_TYPE uint16_t +#define portBASE_TYPE short + +typedef portSTACK_TYPE StackType_t; +typedef short BaseType_t; +typedef unsigned short UBaseType_t; + #if( configUSE_16_BIT_TICKS == 1 ) - typedef unsigned portSHORT portTickType; - #define portMAX_DELAY ( portTickType ) 0xffff + typedef uint16_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffff #else - typedef unsigned portLONG portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffffUL + typedef uint32_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffffffffUL #endif -/*-----------------------------------------------------------*/ +/*-----------------------------------------------------------*/ /* Critical section handling. */ #if configKERNEL_INTERRUPT_PRIORITY != 6 @@ -126,7 +131,7 @@ FreeRTOSConfig.h to set the configMEMMODEL value. */ /* Architecture specifics. */ #define portSTACK_GROWTH ( -1 ) -#define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ ) +#define portTICK_RATE_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ ) #define portBYTE_ALIGNMENT 2 #define portNOP() __asm( " NOP " ); /*-----------------------------------------------------------*/ diff --git a/FreeRTOS/Source/portable/Tasking/ARM_CM4F/port.c b/FreeRTOS/Source/portable/Tasking/ARM_CM4F/port.c index 02b99dbbb..3cc163bfa 100644 --- a/FreeRTOS/Source/portable/Tasking/ARM_CM4F/port.c +++ b/FreeRTOS/Source/portable/Tasking/ARM_CM4F/port.c @@ -72,17 +72,17 @@ #include "task.h" /* Constants required to manipulate the NVIC. */ -#define portNVIC_SYSTICK_CTRL ( ( volatile unsigned long * ) 0xe000e010 ) -#define portNVIC_SYSTICK_LOAD ( ( volatile unsigned long * ) 0xe000e014 ) -#define portNVIC_SYSPRI2 ( ( volatile unsigned long * ) 0xe000ed20 ) +#define portNVIC_SYSTICK_CTRL ( ( volatile uint32_t * ) 0xe000e010 ) +#define portNVIC_SYSTICK_LOAD ( ( volatile uint32_t * ) 0xe000e014 ) +#define portNVIC_SYSPRI2 ( ( volatile uint32_t * ) 0xe000ed20 ) #define portNVIC_SYSTICK_CLK 0x00000004 #define portNVIC_SYSTICK_INT 0x00000002 #define portNVIC_SYSTICK_ENABLE 0x00000001 -#define portNVIC_PENDSV_PRI ( ( ( unsigned long ) configKERNEL_INTERRUPT_PRIORITY ) << 16 ) -#define portNVIC_SYSTICK_PRI ( ( ( unsigned long ) configKERNEL_INTERRUPT_PRIORITY ) << 24 ) +#define portNVIC_PENDSV_PRI ( ( ( uint32_t ) configKERNEL_INTERRUPT_PRIORITY ) << 16 ) +#define portNVIC_SYSTICK_PRI ( ( ( uint32_t ) configKERNEL_INTERRUPT_PRIORITY ) << 24 ) /* Constants required to manipulate the VFP. */ -#define portFPCCR ( ( volatile unsigned long * ) 0xe000ef34 ) /* Floating point context control register. */ +#define portFPCCR ( ( volatile uint32_t * ) 0xe000ef34 ) /* Floating point context control register. */ #define portASPEN_AND_LSPEN_BITS ( 0x3UL << 30UL ) /* Constants required to set up the initial stack. */ @@ -100,11 +100,11 @@ debugger. */ /* The priority used by the kernel is assigned to a variable to make access from inline assembler easier. */ -const unsigned long ulKernelPriority = configKERNEL_INTERRUPT_PRIORITY; +const uint32_t ulKernelPriority = configKERNEL_INTERRUPT_PRIORITY; /* Each task maintains its own interrupt status in the critical nesting variable. */ -static unsigned long ulCriticalNesting = 0xaaaaaaaaUL; +static uint32_t ulCriticalNesting = 0xaaaaaaaaUL; /* * Setup the timer to generate the tick interrupts. @@ -129,14 +129,14 @@ static void prvTaskExitError( void ); /* This exists purely to allow the const to be used from within the port_asm.asm assembly file. */ -const unsigned long ulMaxSyscallInterruptPriorityConst = configMAX_SYSCALL_INTERRUPT_PRIORITY; +const uint32_t ulMaxSyscallInterruptPriorityConst = configMAX_SYSCALL_INTERRUPT_PRIORITY; /*-----------------------------------------------------------*/ /* * See header file for description. */ -portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) +StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) { /* Simulate the stack frame as it would be created by a context switch interrupt. */ @@ -147,13 +147,13 @@ portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE *pxTopOfStack = portINITIAL_XPSR; /* xPSR */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) pxCode; /* PC */ + *pxTopOfStack = ( StackType_t ) pxCode; /* PC */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) portTASK_RETURN_ADDRESS; /* LR */ + *pxTopOfStack = ( StackType_t ) portTASK_RETURN_ADDRESS; /* LR */ /* Save code space by skipping register initialisation. */ pxTopOfStack -= 5; /* R12, R3, R2 and R1. */ - *pxTopOfStack = ( portSTACK_TYPE ) pvParameters; /* R0 */ + *pxTopOfStack = ( StackType_t ) pvParameters; /* R0 */ /* A save method is being used that requires each task to maintain its own exec return value. */ @@ -183,7 +183,7 @@ static void prvTaskExitError( void ) /* * See header file for description. */ -portBASE_TYPE xPortStartScheduler( void ) +BaseType_t xPortStartScheduler( void ) { /* configMAX_SYSCALL_INTERRUPT_PRIORITY must not be set to 0. See http://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html */ @@ -256,7 +256,7 @@ void vPortExitCritical( void ) void SysTick_Handler( void ) { -unsigned long ulDummy; +uint32_t ulDummy; ulDummy = portSET_INTERRUPT_MASK_FROM_ISR(); { diff --git a/FreeRTOS/Source/portable/Tasking/ARM_CM4F/portmacro.h b/FreeRTOS/Source/portable/Tasking/ARM_CM4F/portmacro.h index 99596091d..dd32f2d2f 100644 --- a/FreeRTOS/Source/portable/Tasking/ARM_CM4F/portmacro.h +++ b/FreeRTOS/Source/portable/Tasking/ARM_CM4F/portmacro.h @@ -1,5 +1,5 @@ /* - FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. + FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. All rights reserved VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. @@ -87,28 +87,33 @@ extern "C" { #define portDOUBLE double #define portLONG long #define portSHORT short -#define portSTACK_TYPE unsigned portLONG +#define portSTACK_TYPE uint32_t #define portBASE_TYPE long +typedef portSTACK_TYPE StackType_t; +typedef long BaseType_t; +typedef unsigned long UBaseType_t; + + #if( configUSE_16_BIT_TICKS == 1 ) - typedef unsigned portSHORT portTickType; - #define portMAX_DELAY ( portTickType ) 0xffff + typedef uint16_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffff #else - typedef unsigned portLONG portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffffUL + typedef uint32_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffffffffUL #endif /*-----------------------------------------------------------*/ /* Architecture specifics. */ #define portSTACK_GROWTH ( -1 ) -#define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ ) +#define portTICK_RATE_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ ) #define portBYTE_ALIGNMENT 8 /*-----------------------------------------------------------*/ /* Scheduler utilities. */ extern void vPortYield( void ); -#define portNVIC_INT_CTRL ( ( volatile unsigned long * ) 0xe000ed04 ) +#define portNVIC_INT_CTRL ( ( volatile uint32_t * ) 0xe000ed04 ) #define portNVIC_PENDSVSET 0x10000000 #define portYIELD() vPortYield() @@ -132,8 +137,8 @@ extern void vPortYield( void ); */ #define portCLEAR_INTERRUPT_MASK() __set_BASEPRI( 0 ) -extern unsigned long ulPortSetInterruptMask( void ); -extern void vPortClearInterruptMask( unsigned long ulNewMask ); +extern uint32_t ulPortSetInterruptMask( void ); +extern void vPortClearInterruptMask( uint32_t ulNewMask ); #define portSET_INTERRUPT_MASK_FROM_ISR() ulPortSetInterruptMask() #define portCLEAR_INTERRUPT_MASK_FROM_ISR(x) vPortClearInterruptMask( x ) diff --git a/FreeRTOS/Source/portable/WizC/PIC18/Drivers/Tick/Tick.c b/FreeRTOS/Source/portable/WizC/PIC18/Drivers/Tick/Tick.c index 233d126f4..75a9b082e 100644 --- a/FreeRTOS/Source/portable/WizC/PIC18/Drivers/Tick/Tick.c +++ b/FreeRTOS/Source/portable/WizC/PIC18/Drivers/Tick/Tick.c @@ -128,8 +128,8 @@ void portSetupTick( void ) /* * Set the compare match value. */ - CCPR1H = ( unsigned char ) ( ( portTIMER_COMPARE_VALUE >> 8 ) & 0xff ); - CCPR1L = ( unsigned char ) ( portTIMER_COMPARE_VALUE & 0xff ); + CCPR1H = ( uint8_t ) ( ( portTIMER_COMPARE_VALUE >> 8 ) & 0xff ); + CCPR1L = ( uint8_t ) ( portTIMER_COMPARE_VALUE & 0xff ); /* * Set Compare Special Event Trigger Mode @@ -159,8 +159,8 @@ void portSetupTick( void ) /* * Clear the time count */ - TMR1H = ( unsigned char ) 0x00; - TMR1L = ( unsigned char ) 0x00; + TMR1H = ( uint8_t ) 0x00; + TMR1L = ( uint8_t ) 0x00; /* * Setup the timer diff --git a/FreeRTOS/Source/portable/WizC/PIC18/port.c b/FreeRTOS/Source/portable/WizC/PIC18/port.c index 80c2a7fb7..1a26a5893 100644 --- a/FreeRTOS/Source/portable/WizC/PIC18/port.c +++ b/FreeRTOS/Source/portable/WizC/PIC18/port.c @@ -92,8 +92,8 @@ Changes from V3.0.1 * We require the address of the pxCurrentTCB variable, but don't want to * know any details of its type. */ -typedef void tskTCB; -extern volatile tskTCB * volatile pxCurrentTCB; +typedef void TCB_t; +extern volatile TCB_t * volatile pxCurrentTCB; /* * Define minimal-stack constants @@ -125,17 +125,17 @@ extern volatile tskTCB * volatile pxCurrentTCB; #define portSTACK_MINIMAL_CALLRETURN_DEPTH ( 10 ) #define portSTACK_OTHER_BYTES ( 20 ) -unsigned short usCalcMinStackSize = 0; +uint16_t usCalcMinStackSize = 0; /*-----------------------------------------------------------*/ /* * We initialise ucCriticalNesting to the middle value an - * unsigned char can contain. This way portENTER_CRITICAL() + * uint8_t can contain. This way portENTER_CRITICAL() * and portEXIT_CRITICAL() can be called without interrupts * being enabled before the scheduler starts. */ -register unsigned char ucCriticalNesting = 0x7F; +register uint8_t ucCriticalNesting = 0x7F; /*-----------------------------------------------------------*/ @@ -143,9 +143,9 @@ register unsigned char ucCriticalNesting = 0x7F; * Initialise the stack of a new task. * See portSAVE_CONTEXT macro for description. */ -portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) +StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) { -unsigned char ucScratch; +uint8_t ucScratch; /* * Get the size of the RAMarea in page 0 used by the compiler * We do this here already to avoid W-register conflicts. @@ -173,38 +173,38 @@ unsigned char ucScratch; * First store the function parameters. This is where the task expects * to find them when it starts running. */ - *pxTopOfStack-- = ( portSTACK_TYPE ) ( (( unsigned short ) pvParameters >> 8) & 0x00ff ); - *pxTopOfStack-- = ( portSTACK_TYPE ) ( ( unsigned short ) pvParameters & 0x00ff ); + *pxTopOfStack-- = ( StackType_t ) ( (( uint16_t ) pvParameters >> 8) & 0x00ff ); + *pxTopOfStack-- = ( StackType_t ) ( ( uint16_t ) pvParameters & 0x00ff ); /* * Next are all the registers that form part of the task context. */ - *pxTopOfStack-- = ( portSTACK_TYPE ) 0x11; /* STATUS. */ - *pxTopOfStack-- = ( portSTACK_TYPE ) 0x22; /* WREG. */ - *pxTopOfStack-- = ( portSTACK_TYPE ) 0x33; /* BSR. */ - *pxTopOfStack-- = ( portSTACK_TYPE ) 0x44; /* PRODH. */ - *pxTopOfStack-- = ( portSTACK_TYPE ) 0x55; /* PRODL. */ - *pxTopOfStack-- = ( portSTACK_TYPE ) 0x66; /* FSR0H. */ - *pxTopOfStack-- = ( portSTACK_TYPE ) 0x77; /* FSR0L. */ - *pxTopOfStack-- = ( portSTACK_TYPE ) 0x88; /* FSR1H. */ - *pxTopOfStack-- = ( portSTACK_TYPE ) 0x99; /* FSR1L. */ - *pxTopOfStack-- = ( portSTACK_TYPE ) 0xAA; /* TABLAT. */ + *pxTopOfStack-- = ( StackType_t ) 0x11; /* STATUS. */ + *pxTopOfStack-- = ( StackType_t ) 0x22; /* WREG. */ + *pxTopOfStack-- = ( StackType_t ) 0x33; /* BSR. */ + *pxTopOfStack-- = ( StackType_t ) 0x44; /* PRODH. */ + *pxTopOfStack-- = ( StackType_t ) 0x55; /* PRODL. */ + *pxTopOfStack-- = ( StackType_t ) 0x66; /* FSR0H. */ + *pxTopOfStack-- = ( StackType_t ) 0x77; /* FSR0L. */ + *pxTopOfStack-- = ( StackType_t ) 0x88; /* FSR1H. */ + *pxTopOfStack-- = ( StackType_t ) 0x99; /* FSR1L. */ + *pxTopOfStack-- = ( StackType_t ) 0xAA; /* TABLAT. */ #if _ROMSIZE > 0x8000 - *pxTopOfStack-- = ( portSTACK_TYPE ) 0x00; /* TBLPTRU. */ + *pxTopOfStack-- = ( StackType_t ) 0x00; /* TBLPTRU. */ #endif - *pxTopOfStack-- = ( portSTACK_TYPE ) 0xCC; /* TBLPTRH. */ - *pxTopOfStack-- = ( portSTACK_TYPE ) 0xDD; /* TBLPTRL. */ + *pxTopOfStack-- = ( StackType_t ) 0xCC; /* TBLPTRH. */ + *pxTopOfStack-- = ( StackType_t ) 0xDD; /* TBLPTRL. */ #if _ROMSIZE > 0x8000 - *pxTopOfStack-- = ( portSTACK_TYPE ) 0xEE; /* PCLATU. */ + *pxTopOfStack-- = ( StackType_t ) 0xEE; /* PCLATU. */ #endif - *pxTopOfStack-- = ( portSTACK_TYPE ) 0xFF; /* PCLATH. */ + *pxTopOfStack-- = ( StackType_t ) 0xFF; /* PCLATH. */ /* * Next the compiler's scratchspace. */ while(ucScratch-- > 0) { - *pxTopOfStack-- = ( portSTACK_TYPE ) 0; + *pxTopOfStack-- = ( StackType_t ) 0; } /* @@ -214,16 +214,16 @@ unsigned char ucScratch; * functionpointers to point above 64kB in ROM. */ #if _ROMSIZE > 0x8000 - *pxTopOfStack-- = ( portSTACK_TYPE ) 0; + *pxTopOfStack-- = ( StackType_t ) 0; #endif - *pxTopOfStack-- = ( portSTACK_TYPE ) ( ( ( unsigned short ) pxCode >> 8 ) & 0x00ff ); - *pxTopOfStack-- = ( portSTACK_TYPE ) ( ( unsigned short ) pxCode & 0x00ff ); + *pxTopOfStack-- = ( StackType_t ) ( ( ( uint16_t ) pxCode >> 8 ) & 0x00ff ); + *pxTopOfStack-- = ( StackType_t ) ( ( uint16_t ) pxCode & 0x00ff ); /* * Store the number of return addresses on the hardware stack. * So far only the address of the task entry point. */ - *pxTopOfStack-- = ( portSTACK_TYPE ) 1; + *pxTopOfStack-- = ( StackType_t ) 1; /* * The code generated by wizC does not maintain separate @@ -232,13 +232,13 @@ unsigned char ucScratch; * track of the critical section nesting. This variable has to be stored * as part of the task context and is initially set to zero. */ - *pxTopOfStack-- = ( portSTACK_TYPE ) portNO_CRITICAL_SECTION_NESTING; + *pxTopOfStack-- = ( StackType_t ) portNO_CRITICAL_SECTION_NESTING; return pxTopOfStack; } /*-----------------------------------------------------------*/ -unsigned short usPortCALCULATE_MINIMAL_STACK_SIZE( void ) +uint16_t usPortCALCULATE_MINIMAL_STACK_SIZE( void ) { /* * Fetch the size of compiler's scratchspace. @@ -261,7 +261,7 @@ unsigned short usPortCALCULATE_MINIMAL_STACK_SIZE( void ) /*-----------------------------------------------------------*/ -portBASE_TYPE xPortStartScheduler( void ) +BaseType_t xPortStartScheduler( void ) { extern void portSetupTick( void ); @@ -320,7 +320,7 @@ void vPortYield( void ) /*-----------------------------------------------------------*/ -void *pvPortMalloc( unsigned short usWantedSize ) +void *pvPortMalloc( uint16_t usWantedSize ) { void *pvReturn; diff --git a/FreeRTOS/Source/portable/WizC/PIC18/portmacro.h b/FreeRTOS/Source/portable/WizC/PIC18/portmacro.h index aadb9a33b..513f413c6 100644 --- a/FreeRTOS/Source/portable/WizC/PIC18/portmacro.h +++ b/FreeRTOS/Source/portable/WizC/PIC18/portmacro.h @@ -1,5 +1,5 @@ /* - FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. + FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. All rights reserved VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. @@ -63,7 +63,7 @@ 1 tab == 4 spaces! */ -/* +/* Changes from V3.0.0 Changes from V3.0.1 @@ -87,15 +87,20 @@ Changes from V3.0.1 #define portDOUBLE portFLOAT #define portLONG long #define portSHORT short -#define portSTACK_TYPE unsigned char +#define portSTACK_TYPE uint8_t #define portBASE_TYPE char +typedef portSTACK_TYPE StackType_t; +typedef signed char BaseType_t; +typedef unsigned char UBaseType_t; + + #if( configUSE_16_BIT_TICKS == 1 ) - typedef unsigned portSHORT portTickType; - #define portMAX_DELAY ( portTickType ) ( 0xFFFF ) + typedef uint16_t TickType_t; + #define portMAX_DELAY ( TickType_t ) ( 0xFFFF ) #else - typedef unsigned portLONG portTickType; - #define portMAX_DELAY ( portTickType ) ( 0xFFFFFFFF ) + typedef uint32_t TickType_t; + #define portMAX_DELAY ( TickType_t ) ( 0xFFFFFFFF ) #endif #define portBYTE_ALIGNMENT 1 @@ -103,13 +108,13 @@ Changes from V3.0.1 /*-----------------------------------------------------------*/ /* - * Constant used for context switch macro when we require the interrupt + * Constant used for context switch macro when we require the interrupt * enable state to be forced when the interrupted task is switched back in. */ #define portINTERRUPTS_FORCED (0x01) /* - * Constant used for context switch macro when we require the interrupt + * Constant used for context switch macro when we require the interrupt * enable state to be unchanged when the interrupted task is switched back in. */ #define portINTERRUPTS_UNCHANGED (0x00) @@ -127,21 +132,21 @@ Changes from V3.0.1 { \ bGIE=0; \ } while(bGIE) // MicroChip recommends this check! - + #define portENABLE_INTERRUPTS() \ do \ { \ bGIE=1; \ } while(0) -/*-----------------------------------------------------------*/ +/*-----------------------------------------------------------*/ /* * Critical section macros. */ -extern unsigned portCHAR ucCriticalNesting; +extern uint8_t ucCriticalNesting; -#define portNO_CRITICAL_SECTION_NESTING ( ( unsigned portCHAR ) 0 ) +#define portNO_CRITICAL_SECTION_NESTING ( ( uint8_t ) 0 ) #define portENTER_CRITICAL() \ do \ @@ -186,8 +191,8 @@ extern unsigned portCHAR ucCriticalNesting; * portMINIMAL_STACK_SIZE. Some input to this calculation is * compiletime determined, other input is port-defined (see port.c) */ -extern unsigned portSHORT usPortCALCULATE_MINIMAL_STACK_SIZE( void ); -extern unsigned portSHORT usCalcMinStackSize; +extern uint16_t usPortCALCULATE_MINIMAL_STACK_SIZE( void ); +extern uint16_t usCalcMinStackSize; #define portMINIMAL_STACK_SIZE \ ((usCalcMinStackSize == 0) \ @@ -205,15 +210,15 @@ extern unsigned portSHORT usCalcMinStackSize; * Macro's that pushes all the registers that make up the context of a task onto * the stack, then saves the new top of stack into the TCB. TOSU and TBLPTRU * are only saved/restored on devices with more than 64kB (32k Words) ROM. - * + * * The stackpointer is helt by WizC in FSR2 and points to the first free byte. * WizC uses a "downgrowing" stack. There is no framepointer. * * We keep track of the interruptstatus using ucCriticalNesting. When this * value equals zero, interrupts have to be enabled upon exit from the * portRESTORE_CONTEXT macro. - * - * If this is called from an ISR then the interrupt enable bits must have been + * + * If this is called from an ISR then the interrupt enable bits must have been * set for the ISR to ever get called. Therefore we want to save * ucCriticalNesting with value zero. This means the interrupts will again be * re-enabled when the interrupted task is switched back in. @@ -428,7 +433,7 @@ extern unsigned portSHORT usCalcMinStackSize; /*-----------------------------------------------------------*/ -#define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ ) +#define portTICK_RATE_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ ) /*-----------------------------------------------------------*/ diff --git a/FreeRTOS/Source/portable/oWatcom/16BitDOS/Flsh186/port.c b/FreeRTOS/Source/portable/oWatcom/16BitDOS/Flsh186/port.c index 8f375a03c..4a9d78e43 100644 --- a/FreeRTOS/Source/portable/oWatcom/16BitDOS/Flsh186/port.c +++ b/FreeRTOS/Source/portable/oWatcom/16BitDOS/Flsh186/port.c @@ -98,15 +98,15 @@ Changes from V2.6.1 /*lint -e950 Non ANSI reserved words okay in this file only. */ #define portTIMER_EOI_TYPE ( 8 ) -#define portRESET_PIC() portOUTPUT_WORD( ( unsigned short ) 0xff22, portTIMER_EOI_TYPE ) +#define portRESET_PIC() portOUTPUT_WORD( ( uint16_t ) 0xff22, portTIMER_EOI_TYPE ) #define portTIMER_INT_NUMBER 0x12 -#define portTIMER_1_CONTROL_REGISTER ( ( unsigned short ) 0xff5e ) -#define portTIMER_0_CONTROL_REGISTER ( ( unsigned short ) 0xff56 ) -#define portTIMER_INTERRUPT_ENABLE ( ( unsigned short ) 0x2000 ) +#define portTIMER_1_CONTROL_REGISTER ( ( uint16_t ) 0xff5e ) +#define portTIMER_0_CONTROL_REGISTER ( ( uint16_t ) 0xff56 ) +#define portTIMER_INTERRUPT_ENABLE ( ( uint16_t ) 0x2000 ) /* Setup the hardware to generate the required tick frequency. */ -static void prvSetTickFrequency( unsigned long ulTickRateHz ); +static void prvSetTickFrequency( uint32_t ulTickRateHz ); /* Set the hardware back to the state as per before the scheduler started. */ static void prvExitFunction( void ); @@ -127,7 +127,7 @@ static void __interrupt __far prvYieldProcessor( void ); /*lint -e956 File scopes necessary here. */ /* Set true when the vectors are set so the scheduler will service the tick. */ -static short sSchedulerRunning = pdFALSE; +static int16_t sSchedulerRunning = pdFALSE; /* Points to the original routine installed on the vector we use for manual context switches. This is then used to restore the original routine during prvExitFunction(). */ static void ( __interrupt __far *pxOldSwitchISR )(); @@ -138,7 +138,7 @@ static jmp_buf xJumpBuf; /*lint +e956 */ /*-----------------------------------------------------------*/ -portBASE_TYPE xPortStartScheduler( void ) +BaseType_t xPortStartScheduler( void ) { /* This is called with interrupts already disabled. */ @@ -226,8 +226,8 @@ void vPortEndScheduler( void ) static void prvExitFunction( void ) { -const unsigned short usTimerDisable = 0x0000; -unsigned short usTimer0Control; +const uint16_t usTimerDisable = 0x0000; +uint16_t usTimer0Control; /* Interrupts should be disabled here anyway - but no harm in making sure. */ @@ -254,23 +254,23 @@ unsigned short usTimer0Control; } /*-----------------------------------------------------------*/ -static void prvSetTickFrequency( unsigned long ulTickRateHz ) +static void prvSetTickFrequency( uint32_t ulTickRateHz ) { -const unsigned short usMaxCountRegister = 0xff5a; -const unsigned short usTimerPriorityRegister = 0xff32; -const unsigned short usTimerEnable = 0xC000; -const unsigned short usRetrigger = 0x0001; -const unsigned short usTimerHighPriority = 0x0000; -unsigned short usTimer0Control; +const uint16_t usMaxCountRegister = 0xff5a; +const uint16_t usTimerPriorityRegister = 0xff32; +const uint16_t usTimerEnable = 0xC000; +const uint16_t usRetrigger = 0x0001; +const uint16_t usTimerHighPriority = 0x0000; +uint16_t usTimer0Control; /* ( CPU frequency / 4 ) / clock 2 max count [inpw( 0xff62 ) = 7] */ -const unsigned long ulClockFrequency = 0x7f31a0; +const uint32_t ulClockFrequency = 0x7f31a0; -unsigned long ulTimerCount = ulClockFrequency / ulTickRateHz; +uint32_t ulTimerCount = ulClockFrequency / ulTickRateHz; portOUTPUT_WORD( portTIMER_1_CONTROL_REGISTER, usTimerEnable | portTIMER_INTERRUPT_ENABLE | usRetrigger ); - portOUTPUT_WORD( usMaxCountRegister, ( unsigned short ) ulTimerCount ); + portOUTPUT_WORD( usMaxCountRegister, ( uint16_t ) ulTimerCount ); portOUTPUT_WORD( usTimerPriorityRegister, usTimerHighPriority ); /* Stop the DOS tick - don't do this if you want to maintain a TOD clock. */ diff --git a/FreeRTOS/Source/portable/oWatcom/16BitDOS/Flsh186/portmacro.h b/FreeRTOS/Source/portable/oWatcom/16BitDOS/Flsh186/portmacro.h index e17e66834..ae6242862 100644 --- a/FreeRTOS/Source/portable/oWatcom/16BitDOS/Flsh186/portmacro.h +++ b/FreeRTOS/Source/portable/oWatcom/16BitDOS/Flsh186/portmacro.h @@ -1,5 +1,5 @@ /* - FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. + FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. All rights reserved VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. @@ -71,7 +71,7 @@ extern "C" { #endif /*----------------------------------------------------------- - * Port specific definitions. + * Port specific definitions. * * The settings in this file configure FreeRTOS correctly for the * given hardware and compiler. @@ -87,15 +87,20 @@ extern "C" { #define portDOUBLE long #define portLONG long #define portSHORT int -#define portSTACK_TYPE unsigned portSHORT -#define portBASE_TYPE portSHORT +#define portSTACK_TYPE uint16_t +#define portBASE_TYPE short + +typedef portSTACK_TYPE StackType_t; +typedef short BaseType_t; +typedef unsigned short UBaseType_t; + #if( configUSE_16_BIT_TICKS == 1 ) - typedef unsigned portSHORT portTickType; - #define portMAX_DELAY ( portTickType ) 0xffff + typedef uint16_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffff #else - typedef unsigned portLONG portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffffUL + typedef uint32_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffffffffUL #endif /*-----------------------------------------------------------*/ @@ -117,8 +122,8 @@ void portENABLE_INTERRUPTS( void ); /* Architecture specifics. */ #define portSTACK_GROWTH ( -1 ) #define portSWITCH_INT_NUMBER 0x80 -#define portYIELD() __asm{ int portSWITCH_INT_NUMBER } -#define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ ) +#define portYIELD() __asm{ int portSWITCH_INT_NUMBER } +#define portTICK_RATE_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ ) #define portBYTE_ALIGNMENT 2 #define portINITIAL_SW ( ( portSTACK_TYPE ) 0x0202 ) /* Start the tasks with interrupts enabled. */ #define portNOP() __asm{ nop } diff --git a/FreeRTOS/Source/portable/oWatcom/16BitDOS/PC/port.c b/FreeRTOS/Source/portable/oWatcom/16BitDOS/PC/port.c index 0f0736481..2b192601a 100644 --- a/FreeRTOS/Source/portable/oWatcom/16BitDOS/PC/port.c +++ b/FreeRTOS/Source/portable/oWatcom/16BitDOS/PC/port.c @@ -106,7 +106,7 @@ Changes from V4.0.1 #define portTIMER_INT_NUMBER 0x08 /* Setup hardware for required tick interrupt rate. */ -static void prvSetTickFrequency( unsigned long ulTickRateHz ); +static void prvSetTickFrequency( uint32_t ulTickRateHz ); /* Restore hardware to as it was prior to starting the scheduler. */ static void prvExitFunction( void ); @@ -137,10 +137,10 @@ static void prvSetTickFrequencyDefault( void ); /*lint -e956 File scopes necessary here. */ /* Used to signal when to chain to the DOS tick, and when to just clear the PIC ourselves. */ -static short sDOSTickCounter; +static int16_t sDOSTickCounter; /* Set true when the vectors are set so the scheduler will service the tick. */ -static short sSchedulerRunning = pdFALSE; +static int16_t sSchedulerRunning = pdFALSE; /* Points to the original routine installed on the vector we use for manual context switches. This is then used to restore the original routine during prvExitFunction(). */ static void ( __interrupt __far *pxOldSwitchISR )(); @@ -154,7 +154,7 @@ static jmp_buf xJumpBuf; /*lint +e956 */ /*-----------------------------------------------------------*/ -portBASE_TYPE xPortStartScheduler( void ) +BaseType_t xPortStartScheduler( void ) { pxISR pxOriginalTickISR; @@ -256,7 +256,7 @@ static void prvPortResetPIC( void ) --sDOSTickCounter; if( sDOSTickCounter <= 0 ) { - sDOSTickCounter = ( short ) portTICKS_PER_DOS_TICK; + sDOSTickCounter = ( int16_t ) portTICKS_PER_DOS_TICK; __asm{ int portSWITCH_INT_NUMBER + 1 }; } else @@ -306,29 +306,29 @@ void ( __interrupt __far *pxOriginalTickISR )(); } /*-----------------------------------------------------------*/ -static void prvSetTickFrequency( unsigned long ulTickRateHz ) +static void prvSetTickFrequency( uint32_t ulTickRateHz ) { -const unsigned short usPIT_MODE = ( unsigned short ) 0x43; -const unsigned short usPIT0 = ( unsigned short ) 0x40; -const unsigned long ulPIT_CONST = ( unsigned long ) 1193180; -const unsigned short us8254_CTR0_MODE3 = ( unsigned short ) 0x36; -unsigned long ulOutput; +const uint16_t usPIT_MODE = ( uint16_t ) 0x43; +const uint16_t usPIT0 = ( uint16_t ) 0x40; +const uint32_t ulPIT_CONST = ( uint32_t ) 1193180; +const uint16_t us8254_CTR0_MODE3 = ( uint16_t ) 0x36; +uint32_t ulOutput; /* Setup the 8245 to tick at the wanted frequency. */ portOUTPUT_BYTE( usPIT_MODE, us8254_CTR0_MODE3 ); ulOutput = ulPIT_CONST / ulTickRateHz; - portOUTPUT_BYTE( usPIT0, ( unsigned short )( ulOutput & ( unsigned long ) 0xff ) ); + portOUTPUT_BYTE( usPIT0, ( uint16_t )( ulOutput & ( uint32_t ) 0xff ) ); ulOutput >>= 8; - portOUTPUT_BYTE( usPIT0, ( unsigned short ) ( ulOutput & ( unsigned long ) 0xff ) ); + portOUTPUT_BYTE( usPIT0, ( uint16_t ) ( ulOutput & ( uint32_t ) 0xff ) ); } /*-----------------------------------------------------------*/ static void prvSetTickFrequencyDefault( void ) { -const unsigned short usPIT_MODE = ( unsigned short ) 0x43; -const unsigned short usPIT0 = ( unsigned short ) 0x40; -const unsigned short us8254_CTR0_MODE3 = ( unsigned short ) 0x36; +const uint16_t usPIT_MODE = ( uint16_t ) 0x43; +const uint16_t usPIT0 = ( uint16_t ) 0x40; +const uint16_t us8254_CTR0_MODE3 = ( uint16_t ) 0x36; portOUTPUT_BYTE( usPIT_MODE, us8254_CTR0_MODE3 ); portOUTPUT_BYTE( usPIT0,0 ); diff --git a/FreeRTOS/Source/portable/oWatcom/16BitDOS/PC/portmacro.h b/FreeRTOS/Source/portable/oWatcom/16BitDOS/PC/portmacro.h index 15e42fb66..debe4dbd1 100644 --- a/FreeRTOS/Source/portable/oWatcom/16BitDOS/PC/portmacro.h +++ b/FreeRTOS/Source/portable/oWatcom/16BitDOS/PC/portmacro.h @@ -1,5 +1,5 @@ /* - FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. + FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. All rights reserved VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. @@ -71,7 +71,7 @@ extern "C" { #endif /*----------------------------------------------------------- - * Port specific definitions. + * Port specific definitions. * * The settings in this file configure FreeRTOS correctly for the * given hardware and compiler. @@ -86,15 +86,20 @@ extern "C" { #define portDOUBLE double #define portLONG long #define portSHORT int -#define portSTACK_TYPE unsigned portSHORT -#define portBASE_TYPE portSHORT +#define portSTACK_TYPE uint16_t +#define portBASE_TYPE short + +typedef portSTACK_TYPE StackType_t; +typedef short BaseType_t; +typedef unsigned short UBaseType_t; + #if( configUSE_16_BIT_TICKS == 1 ) - typedef unsigned portSHORT portTickType; - #define portMAX_DELAY ( portTickType ) 0xffff + typedef uint16_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffff #else - typedef unsigned portLONG portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffffUL + typedef uint32_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffffffffUL #endif /*-----------------------------------------------------------*/ @@ -104,7 +109,7 @@ void portLOCAL_ENTER_CRITICAL( void ); #pragma aux portLOCAL_ENTER_CRITICAL = "pushf" \ "cli"; #define portENTER_CRITICAL() portLOCAL_ENTER_CRITICAL() - + void portEXIT_CRITICAL( void ); #pragma aux portEXIT_CRITICAL = "popf"; @@ -118,10 +123,10 @@ void portENABLE_INTERRUPTS( void ); /* Architecture specifics. */ #define portSTACK_GROWTH ( -1 ) #define portSWITCH_INT_NUMBER 0x80 -#define portYIELD() __asm{ int portSWITCH_INT_NUMBER } +#define portYIELD() __asm{ int portSWITCH_INT_NUMBER } #define portDOS_TICK_RATE ( 18.20648 ) -#define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ ) -#define portTICKS_PER_DOS_TICK ( ( unsigned portSHORT ) ( ( ( portDOUBLE ) configTICK_RATE_HZ / portDOS_TICK_RATE ) + 0.5 ) ) +#define portTICK_RATE_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ ) +#define portTICKS_PER_DOS_TICK ( ( uint16_t ) ( ( ( portDOUBLE ) configTICK_RATE_HZ / portDOS_TICK_RATE ) + 0.5 ) ) #define portINITIAL_SW ( ( portSTACK_TYPE ) 0x0202 ) /* Start the tasks with interrupts enabled. */ #define portBYTE_ALIGNMENT ( 2 ) /*-----------------------------------------------------------*/ diff --git a/FreeRTOS/Source/portable/oWatcom/16BitDOS/common/portasm.h b/FreeRTOS/Source/portable/oWatcom/16BitDOS/common/portasm.h index 636ad387f..6e7caf78a 100644 --- a/FreeRTOS/Source/portable/oWatcom/16BitDOS/common/portasm.h +++ b/FreeRTOS/Source/portable/oWatcom/16BitDOS/common/portasm.h @@ -63,8 +63,8 @@ 1 tab == 4 spaces! */ -typedef void tskTCB; -extern volatile tskTCB * volatile pxCurrentTCB; +typedef void TCB_t; +extern volatile TCB_t * volatile pxCurrentTCB; extern void vTaskSwitchContext( void ); /* diff --git a/FreeRTOS/Source/portable/oWatcom/16BitDOS/common/portcomn.c b/FreeRTOS/Source/portable/oWatcom/16BitDOS/common/portcomn.c index 77503e0c5..29d90048a 100644 --- a/FreeRTOS/Source/portable/oWatcom/16BitDOS/common/portcomn.c +++ b/FreeRTOS/Source/portable/oWatcom/16BitDOS/common/portcomn.c @@ -88,9 +88,9 @@ Changes from V2.6.1: /*-----------------------------------------------------------*/ /* See header file for description. */ -portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) +StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) { -portSTACK_TYPE DS_Reg = 0, *pxOriginalSP; +StackType_t DS_Reg = 0, *pxOriginalSP; /* Place a few bytes of known values on the bottom of the stack. This is just useful for debugging. */ @@ -132,19 +132,19 @@ portSTACK_TYPE DS_Reg = 0, *pxOriginalSP; easier. */ *pxTopOfStack = FP_OFF( pvParameters ); /* AX */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0xCCCC; /* CX */ + *pxTopOfStack = ( StackType_t ) 0xCCCC; /* CX */ pxTopOfStack--; *pxTopOfStack = FP_SEG( pvParameters ); /* DX */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0xBBBB; /* BX */ + *pxTopOfStack = ( StackType_t ) 0xBBBB; /* BX */ pxTopOfStack--; *pxTopOfStack = FP_OFF( pxOriginalSP ); /* SP */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0xBBBB; /* BP */ + *pxTopOfStack = ( StackType_t ) 0xBBBB; /* BP */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0x0123; /* SI */ + *pxTopOfStack = ( StackType_t ) 0x0123; /* SI */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0xDDDD; /* DI */ + *pxTopOfStack = ( StackType_t ) 0xDDDD; /* DI */ /* We need the true data segment. */ __asm{ MOV DS_Reg, DS }; @@ -153,7 +153,7 @@ portSTACK_TYPE DS_Reg = 0, *pxOriginalSP; *pxTopOfStack = DS_Reg; /* DS */ pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0xEEEE; /* ES */ + *pxTopOfStack = ( StackType_t ) 0xEEEE; /* ES */ /* The AX register is pushed again twice - don't know why. */ pxTopOfStack--; diff --git a/FreeRTOS/Source/queue.c b/FreeRTOS/Source/queue.c index 6b7a91a25..eafbd0efe 100644 --- a/FreeRTOS/Source/queue.c +++ b/FreeRTOS/Source/queue.c @@ -87,12 +87,12 @@ privileged Vs unprivileged linkage and placement. */ /* Constants used with the cRxLock and xTxLock structure members. */ -#define queueUNLOCKED ( ( signed portBASE_TYPE ) -1 ) -#define queueLOCKED_UNMODIFIED ( ( signed portBASE_TYPE ) 0 ) +#define queueUNLOCKED ( ( BaseType_t ) -1 ) +#define queueLOCKED_UNMODIFIED ( ( BaseType_t ) 0 ) -/* When the xQUEUE structure is used to represent a base queue its pcHead and +/* When the Queue_t structure is used to represent a base queue its pcHead and pcTail members are used as pointers into the queue storage area. When the -xQUEUE structure is used to represent a mutex pcHead and pcTail pointers are +Queue_t structure is used to represent a mutex pcHead and pcTail pointers are not necessary, and the pcHead pointer is set to NULL to indicate that the pcTail pointer actually points to the mutex holder (if any). Map alternative names to the pcHead and pcTail structure members to ensure the readability of @@ -107,8 +107,8 @@ structure member). */ /* Semaphores do not actually store or copy data, so have an item size of zero. */ -#define queueSEMAPHORE_QUEUE_ITEM_LENGTH ( ( unsigned portBASE_TYPE ) 0 ) -#define queueMUTEX_GIVE_BLOCK_TIME ( ( portTickType ) 0U ) +#define queueSEMAPHORE_QUEUE_ITEM_LENGTH ( ( UBaseType_t ) 0 ) +#define queueMUTEX_GIVE_BLOCK_TIME ( ( TickType_t ) 0U ) #if( configUSE_PREEMPTION == 0 ) /* If the cooperative scheduler is being used then a yield should not be @@ -124,36 +124,36 @@ zero. */ */ typedef struct QueueDefinition { - signed char *pcHead; /*< Points to the beginning of the queue storage area. */ - signed char *pcTail; /*< Points to the byte at the end of the queue storage area. Once more byte is allocated than necessary to store the queue items, this is used as a marker. */ - signed char *pcWriteTo; /*< Points to the free next place in the storage area. */ + int8_t *pcHead; /*< Points to the beginning of the queue storage area. */ + int8_t *pcTail; /*< Points to the byte at the end of the queue storage area. Once more byte is allocated than necessary to store the queue items, this is used as a marker. */ + int8_t *pcWriteTo; /*< Points to the free next place in the storage area. */ - union /* Use of a union is an exception to the coding standard to ensure two mutually exclusive structure members don't appear simultaneously (wasting RAM). */ + union /* Use of a union is an exception to the coding standard to ensure two mutually exclusive structure members don't appear simultaneously (wasting RAM). */ { - signed char *pcReadFrom; /*< Points to the last place that a queued item was read from when the structure is used as a queue. */ - unsigned portBASE_TYPE uxRecursiveCallCount;/*< Maintains a count of the number of times a recursive mutex has been recursively 'taken' when the structure is used as a mutex. */ + int8_t *pcReadFrom; /*< Points to the last place that a queued item was read from when the structure is used as a queue. */ + UBaseType_t uxRecursiveCallCount;/*< Maintains a count of the number of times a recursive mutex has been recursively 'taken' when the structure is used as a mutex. */ } u; - xList xTasksWaitingToSend; /*< List of tasks that are blocked waiting to post onto this queue. Stored in priority order. */ - xList xTasksWaitingToReceive; /*< List of tasks that are blocked waiting to read from this queue. Stored in priority order. */ + List_t xTasksWaitingToSend; /*< List of tasks that are blocked waiting to post onto this queue. Stored in priority order. */ + List_t xTasksWaitingToReceive; /*< List of tasks that are blocked waiting to read from this queue. Stored in priority order. */ - volatile unsigned portBASE_TYPE uxMessagesWaiting;/*< The number of items currently in the queue. */ - unsigned portBASE_TYPE uxLength; /*< The length of the queue defined as the number of items it will hold, not the number of bytes. */ - unsigned portBASE_TYPE uxItemSize; /*< The size of each items that the queue will hold. */ + volatile UBaseType_t uxMessagesWaiting;/*< The number of items currently in the queue. */ + UBaseType_t uxLength; /*< The length of the queue defined as the number of items it will hold, not the number of bytes. */ + UBaseType_t uxItemSize; /*< The size of each items that the queue will hold. */ - volatile signed portBASE_TYPE xRxLock; /*< Stores the number of items received from the queue (removed from the queue) while the queue was locked. Set to queueUNLOCKED when the queue is not locked. */ - volatile signed portBASE_TYPE xTxLock; /*< Stores the number of items transmitted to the queue (added to the queue) while the queue was locked. Set to queueUNLOCKED when the queue is not locked. */ + volatile BaseType_t xRxLock; /*< Stores the number of items received from the queue (removed from the queue) while the queue was locked. Set to queueUNLOCKED when the queue is not locked. */ + volatile BaseType_t xTxLock; /*< Stores the number of items transmitted to the queue (added to the queue) while the queue was locked. Set to queueUNLOCKED when the queue is not locked. */ #if ( configUSE_TRACE_FACILITY == 1 ) - unsigned portBASE_TYPE uxQueueNumber; - unsigned char ucQueueType; + UBaseType_t uxQueueNumber; + uint8_t ucQueueType; #endif #if ( configUSE_QUEUE_SETS == 1 ) struct QueueDefinition *pxQueueSetContainer; #endif -} xQUEUE; +} Queue_t; /*-----------------------------------------------------------*/ /* @@ -168,13 +168,13 @@ typedef struct QueueDefinition typedef struct QUEUE_REGISTRY_ITEM { char *pcQueueName; /*lint !e971 Unqualified char types are allowed for strings and single characters only. */ - xQueueHandle xHandle; - } xQueueRegistryItem; + QueueHandle_t xHandle; + } QueueRegistryItem_t; - /* The queue registry is simply an array of xQueueRegistryItem structures. + /* The queue registry is simply an array of QueueRegistryItem_t structures. The pcQueueName member of a structure being NULL is indicative of the array position being vacant. */ - xQueueRegistryItem xQueueRegistry[ configQUEUE_REGISTRY_SIZE ]; + QueueRegistryItem_t xQueueRegistry[ configQUEUE_REGISTRY_SIZE ]; #endif /* configQUEUE_REGISTRY_SIZE */ @@ -186,39 +186,39 @@ typedef struct QueueDefinition * to indicate that a task may require unblocking. When the queue in unlocked * these lock counts are inspected, and the appropriate action taken. */ -static void prvUnlockQueue( xQUEUE * const pxQueue ) PRIVILEGED_FUNCTION; +static void prvUnlockQueue( Queue_t * const pxQueue ) PRIVILEGED_FUNCTION; /* * Uses a critical section to determine if there is any data in a queue. * * @return pdTRUE if the queue contains no items, otherwise pdFALSE. */ -static signed portBASE_TYPE prvIsQueueEmpty( const xQUEUE *pxQueue ) PRIVILEGED_FUNCTION; +static BaseType_t prvIsQueueEmpty( const Queue_t *pxQueue ) PRIVILEGED_FUNCTION; /* * Uses a critical section to determine if there is any space in a queue. * * @return pdTRUE if there is no space, otherwise pdFALSE; */ -static signed portBASE_TYPE prvIsQueueFull( const xQUEUE *pxQueue ) PRIVILEGED_FUNCTION; +static BaseType_t prvIsQueueFull( const Queue_t *pxQueue ) PRIVILEGED_FUNCTION; /* * Copies an item into the queue, either at the front of the queue or the * back of the queue. */ -static void prvCopyDataToQueue( xQUEUE * const pxQueue, const void *pvItemToQueue, const portBASE_TYPE xPosition ) PRIVILEGED_FUNCTION; +static void prvCopyDataToQueue( Queue_t * const pxQueue, const void *pvItemToQueue, const BaseType_t xPosition ) PRIVILEGED_FUNCTION; /* * Copies an item out of a queue. */ -static void prvCopyDataFromQueue( xQUEUE * const pxQueue, void * const pvBuffer ) PRIVILEGED_FUNCTION; +static void prvCopyDataFromQueue( Queue_t * const pxQueue, void * const pvBuffer ) PRIVILEGED_FUNCTION; #if ( configUSE_QUEUE_SETS == 1 ) /* * Checks to see if a queue is a member of a queue set, and if so, notifies * the queue set that the queue contains data. */ - static portBASE_TYPE prvNotifyQueueSetContainer( const xQUEUE * const pxQueue, const portBASE_TYPE xCopyPosition ) PRIVILEGED_FUNCTION; + static BaseType_t prvNotifyQueueSetContainer( const Queue_t * const pxQueue, const BaseType_t xCopyPosition ) PRIVILEGED_FUNCTION; #endif /*-----------------------------------------------------------*/ @@ -242,18 +242,18 @@ static void prvCopyDataFromQueue( xQUEUE * const pxQueue, void * const pvBuffer taskEXIT_CRITICAL() /*-----------------------------------------------------------*/ -portBASE_TYPE xQueueGenericReset( xQueueHandle xQueue, portBASE_TYPE xNewQueue ) +BaseType_t xQueueGenericReset( QueueHandle_t xQueue, BaseType_t xNewQueue ) { -xQUEUE * const pxQueue = ( xQUEUE * ) xQueue; +Queue_t * const pxQueue = ( Queue_t * ) xQueue; configASSERT( pxQueue ); taskENTER_CRITICAL(); { pxQueue->pcTail = pxQueue->pcHead + ( pxQueue->uxLength * pxQueue->uxItemSize ); - pxQueue->uxMessagesWaiting = ( unsigned portBASE_TYPE ) 0U; + pxQueue->uxMessagesWaiting = ( UBaseType_t ) 0U; pxQueue->pcWriteTo = pxQueue->pcHead; - pxQueue->u.pcReadFrom = pxQueue->pcHead + ( ( pxQueue->uxLength - ( unsigned portBASE_TYPE ) 1U ) * pxQueue->uxItemSize ); + pxQueue->u.pcReadFrom = pxQueue->pcHead + ( ( pxQueue->uxLength - ( UBaseType_t ) 1U ) * pxQueue->uxItemSize ); pxQueue->xRxLock = queueUNLOCKED; pxQueue->xTxLock = queueUNLOCKED; @@ -295,27 +295,27 @@ xQUEUE * const pxQueue = ( xQUEUE * ) xQueue; } /*-----------------------------------------------------------*/ -xQueueHandle xQueueGenericCreate( const unsigned portBASE_TYPE uxQueueLength, const unsigned portBASE_TYPE uxItemSize, const unsigned char ucQueueType ) +QueueHandle_t xQueueGenericCreate( const UBaseType_t uxQueueLength, const UBaseType_t uxItemSize, const uint8_t ucQueueType ) { -xQUEUE *pxNewQueue; +Queue_t *pxNewQueue; size_t xQueueSizeInBytes; -xQueueHandle xReturn = NULL; +QueueHandle_t xReturn = NULL; /* Remove compiler warnings about unused parameters should configUSE_TRACE_FACILITY not be set to 1. */ ( void ) ucQueueType; /* Allocate the new queue structure. */ - if( uxQueueLength > ( unsigned portBASE_TYPE ) 0 ) + if( uxQueueLength > ( UBaseType_t ) 0 ) { - pxNewQueue = ( xQUEUE * ) pvPortMalloc( sizeof( xQUEUE ) ); + pxNewQueue = ( Queue_t * ) pvPortMalloc( sizeof( Queue_t ) ); if( pxNewQueue != NULL ) { /* Create the list of pointers to queue items. The queue is one byte longer than asked for to make wrap checking easier/faster. */ xQueueSizeInBytes = ( size_t ) ( uxQueueLength * uxItemSize ) + ( size_t ) 1; /*lint !e961 MISRA exception as the casts are only redundant for some ports. */ - pxNewQueue->pcHead = ( signed char * ) pvPortMalloc( xQueueSizeInBytes ); + pxNewQueue->pcHead = ( int8_t * ) pvPortMalloc( xQueueSizeInBytes ); if( pxNewQueue->pcHead != NULL ) { /* Initialise the queue members as described above where the @@ -363,16 +363,16 @@ xQueueHandle xReturn = NULL; #if ( configUSE_MUTEXES == 1 ) - xQueueHandle xQueueCreateMutex( const unsigned char ucQueueType ) + QueueHandle_t xQueueCreateMutex( const uint8_t ucQueueType ) { - xQUEUE *pxNewQueue; + Queue_t *pxNewQueue; /* Prevent compiler warnings about unused parameters if configUSE_TRACE_FACILITY does not equal 1. */ ( void ) ucQueueType; /* Allocate the new queue structure. */ - pxNewQueue = ( xQUEUE * ) pvPortMalloc( sizeof( xQUEUE ) ); + pxNewQueue = ( Queue_t * ) pvPortMalloc( sizeof( Queue_t ) ); if( pxNewQueue != NULL ) { /* Information required for priority inheritance. */ @@ -387,9 +387,9 @@ xQueueHandle xReturn = NULL; /* Each mutex has a length of 1 (like a binary semaphore) and an item size of 0 as nothing is actually copied into or out of the mutex. */ - pxNewQueue->uxMessagesWaiting = ( unsigned portBASE_TYPE ) 0U; - pxNewQueue->uxLength = ( unsigned portBASE_TYPE ) 1U; - pxNewQueue->uxItemSize = ( unsigned portBASE_TYPE ) 0U; + pxNewQueue->uxMessagesWaiting = ( UBaseType_t ) 0U; + pxNewQueue->uxLength = ( UBaseType_t ) 1U; + pxNewQueue->uxItemSize = ( UBaseType_t ) 0U; pxNewQueue->xRxLock = queueUNLOCKED; pxNewQueue->xTxLock = queueUNLOCKED; @@ -412,7 +412,7 @@ xQueueHandle xReturn = NULL; traceCREATE_MUTEX( pxNewQueue ); /* Start with the semaphore in the expected state. */ - ( void ) xQueueGenericSend( pxNewQueue, NULL, ( portTickType ) 0U, queueSEND_TO_BACK ); + ( void ) xQueueGenericSend( pxNewQueue, NULL, ( TickType_t ) 0U, queueSEND_TO_BACK ); } else { @@ -428,7 +428,7 @@ xQueueHandle xReturn = NULL; #if ( ( configUSE_MUTEXES == 1 ) && ( INCLUDE_xSemaphoreGetMutexHolder == 1 ) ) - void* xQueueGetMutexHolder( xQueueHandle xSemaphore ) + void* xQueueGetMutexHolder( QueueHandle_t xSemaphore ) { void *pxReturn; @@ -439,9 +439,9 @@ xQueueHandle xReturn = NULL; following critical section exiting and the function returning. */ taskENTER_CRITICAL(); { - if( ( ( xQUEUE * ) xSemaphore )->uxQueueType == queueQUEUE_IS_MUTEX ) + if( ( ( Queue_t * ) xSemaphore )->uxQueueType == queueQUEUE_IS_MUTEX ) { - pxReturn = ( void * ) ( ( xQUEUE * ) xSemaphore )->pxMutexHolder; + pxReturn = ( void * ) ( ( Queue_t * ) xSemaphore )->pxMutexHolder; } else { @@ -458,10 +458,10 @@ xQueueHandle xReturn = NULL; #if ( configUSE_RECURSIVE_MUTEXES == 1 ) - portBASE_TYPE xQueueGiveMutexRecursive( xQueueHandle xMutex ) + BaseType_t xQueueGiveMutexRecursive( QueueHandle_t xMutex ) { - portBASE_TYPE xReturn; - xQUEUE * const pxMutex = ( xQUEUE * ) xMutex; + BaseType_t xReturn; + Queue_t * const pxMutex = ( Queue_t * ) xMutex; configASSERT( pxMutex ); @@ -471,7 +471,7 @@ xQueueHandle xReturn = NULL; this is the only condition we are interested in it does not matter if pxMutexHolder is accessed simultaneously by another task. Therefore no mutual exclusion is required to test the pxMutexHolder variable. */ - if( pxMutex->pxMutexHolder == ( void * ) xTaskGetCurrentTaskHandle() ) /*lint !e961 Not a redundant cast as xTaskHandle is a typedef. */ + if( pxMutex->pxMutexHolder == ( void * ) xTaskGetCurrentTaskHandle() ) /*lint !e961 Not a redundant cast as TaskHandle_t is a typedef. */ { traceGIVE_MUTEX_RECURSIVE( pxMutex ); @@ -483,7 +483,7 @@ xQueueHandle xReturn = NULL; ( pxMutex->u.uxRecursiveCallCount )--; /* Have we unwound the call count? */ - if( pxMutex->u.uxRecursiveCallCount == ( unsigned portBASE_TYPE ) 0 ) + if( pxMutex->u.uxRecursiveCallCount == ( UBaseType_t ) 0 ) { /* Return the mutex. This will automatically unblock any other task that might be waiting to access the mutex. */ @@ -512,10 +512,10 @@ xQueueHandle xReturn = NULL; #if ( configUSE_RECURSIVE_MUTEXES == 1 ) - portBASE_TYPE xQueueTakeMutexRecursive( xQueueHandle xMutex, portTickType xBlockTime ) + BaseType_t xQueueTakeMutexRecursive( QueueHandle_t xMutex, TickType_t xBlockTime ) { - portBASE_TYPE xReturn; - xQUEUE * const pxMutex = ( xQUEUE * ) xMutex; + BaseType_t xReturn; + Queue_t * const pxMutex = ( Queue_t * ) xMutex; configASSERT( pxMutex ); @@ -524,7 +524,7 @@ xQueueHandle xReturn = NULL; traceTAKE_MUTEX_RECURSIVE( pxMutex ); - if( pxMutex->pxMutexHolder == ( void * ) xTaskGetCurrentTaskHandle() ) /*lint !e961 Cast is not redundant as xTaskHandle is a typedef. */ + if( pxMutex->pxMutexHolder == ( void * ) xTaskGetCurrentTaskHandle() ) /*lint !e961 Cast is not redundant as TaskHandle_t is a typedef. */ { ( pxMutex->u.uxRecursiveCallCount )++; xReturn = pdPASS; @@ -553,9 +553,9 @@ xQueueHandle xReturn = NULL; #if ( configUSE_COUNTING_SEMAPHORES == 1 ) - xQueueHandle xQueueCreateCountingSemaphore( const unsigned portBASE_TYPE uxMaxCount, const unsigned portBASE_TYPE uxInitialCount ) + QueueHandle_t xQueueCreateCountingSemaphore( const UBaseType_t uxMaxCount, const UBaseType_t uxInitialCount ) { - xQueueHandle xHandle; + QueueHandle_t xHandle; configASSERT( uxMaxCount != 0 ); configASSERT( uxInitialCount <= uxMaxCount ); @@ -564,7 +564,7 @@ xQueueHandle xReturn = NULL; if( xHandle != NULL ) { - ( ( xQUEUE * ) xHandle )->uxMessagesWaiting = uxInitialCount; + ( ( Queue_t * ) xHandle )->uxMessagesWaiting = uxInitialCount; traceCREATE_COUNTING_SEMAPHORE(); } @@ -580,14 +580,14 @@ xQueueHandle xReturn = NULL; #endif /* configUSE_COUNTING_SEMAPHORES */ /*-----------------------------------------------------------*/ -signed portBASE_TYPE xQueueGenericSend( xQueueHandle xQueue, const void * const pvItemToQueue, portTickType xTicksToWait, const portBASE_TYPE xCopyPosition ) +BaseType_t xQueueGenericSend( QueueHandle_t xQueue, const void * const pvItemToQueue, TickType_t xTicksToWait, const BaseType_t xCopyPosition ) { -signed portBASE_TYPE xEntryTimeSet = pdFALSE; -xTimeOutType xTimeOut; -xQUEUE * const pxQueue = ( xQUEUE * ) xQueue; +BaseType_t xEntryTimeSet = pdFALSE; +TimeOut_t xTimeOut; +Queue_t * const pxQueue = ( Queue_t * ) xQueue; configASSERT( pxQueue ); - configASSERT( !( ( pvItemToQueue == NULL ) && ( pxQueue->uxItemSize != ( unsigned portBASE_TYPE ) 0U ) ) ); + configASSERT( !( ( pvItemToQueue == NULL ) && ( pxQueue->uxItemSize != ( UBaseType_t ) 0U ) ) ); configASSERT( !( ( xCopyPosition == queueOVERWRITE ) && ( pxQueue->uxLength != 1 ) ) ); #if ( ( INCLUDE_xTaskGetSchedulerState == 1 ) || ( configUSE_TIMERS == 1 ) ) { @@ -687,7 +687,7 @@ xQUEUE * const pxQueue = ( xQUEUE * ) xQueue; } else { - if( xTicksToWait == ( portTickType ) 0 ) + if( xTicksToWait == ( TickType_t ) 0 ) { /* The queue was full and no block time is specified (or the block time has expired) so leave now. */ @@ -769,14 +769,14 @@ xQUEUE * const pxQueue = ( xQUEUE * ) xQueue; #if ( configUSE_ALTERNATIVE_API == 1 ) - signed portBASE_TYPE xQueueAltGenericSend( xQueueHandle xQueue, const void * const pvItemToQueue, portTickType xTicksToWait, portBASE_TYPE xCopyPosition ) + BaseType_t xQueueAltGenericSend( QueueHandle_t xQueue, const void * const pvItemToQueue, TickType_t xTicksToWait, BaseType_t xCopyPosition ) { - signed portBASE_TYPE xEntryTimeSet = pdFALSE; - xTimeOutType xTimeOut; - xQUEUE * const pxQueue = ( xQUEUE * ) xQueue; + BaseType_t xEntryTimeSet = pdFALSE; + TimeOut_t xTimeOut; + Queue_t * const pxQueue = ( Queue_t * ) xQueue; configASSERT( pxQueue ); - configASSERT( !( ( pvItemToQueue == NULL ) && ( pxQueue->uxItemSize != ( unsigned portBASE_TYPE ) 0U ) ) ); + configASSERT( !( ( pvItemToQueue == NULL ) && ( pxQueue->uxItemSize != ( UBaseType_t ) 0U ) ) ); for( ;; ) { @@ -814,7 +814,7 @@ xQUEUE * const pxQueue = ( xQUEUE * ) xQueue; } else { - if( xTicksToWait == ( portTickType ) 0 ) + if( xTicksToWait == ( TickType_t ) 0 ) { taskEXIT_CRITICAL(); return errQUEUE_FULL; @@ -859,21 +859,21 @@ xQUEUE * const pxQueue = ( xQUEUE * ) xQueue; #if ( configUSE_ALTERNATIVE_API == 1 ) - signed portBASE_TYPE xQueueAltGenericReceive( xQueueHandle xQueue, void * const pvBuffer, portTickType xTicksToWait, portBASE_TYPE xJustPeeking ) + BaseType_t xQueueAltGenericReceive( QueueHandle_t xQueue, void * const pvBuffer, TickType_t xTicksToWait, BaseType_t xJustPeeking ) { - signed portBASE_TYPE xEntryTimeSet = pdFALSE; - xTimeOutType xTimeOut; - signed char *pcOriginalReadPosition; - xQUEUE * const pxQueue = ( xQUEUE * ) xQueue; + BaseType_t xEntryTimeSet = pdFALSE; + TimeOut_t xTimeOut; + int8_t *pcOriginalReadPosition; + Queue_t * const pxQueue = ( Queue_t * ) xQueue; configASSERT( pxQueue ); - configASSERT( !( ( pvBuffer == NULL ) && ( pxQueue->uxItemSize != ( unsigned portBASE_TYPE ) 0U ) ) ); + configASSERT( !( ( pvBuffer == NULL ) && ( pxQueue->uxItemSize != ( UBaseType_t ) 0U ) ) ); for( ;; ) { taskENTER_CRITICAL(); { - if( pxQueue->uxMessagesWaiting > ( unsigned portBASE_TYPE ) 0 ) + if( pxQueue->uxMessagesWaiting > ( UBaseType_t ) 0 ) { /* Remember our read position in case we are just peeking. */ pcOriginalReadPosition = pxQueue->u.pcReadFrom; @@ -893,7 +893,7 @@ xQUEUE * const pxQueue = ( xQUEUE * ) xQueue; { /* Record the information required to implement priority inheritance should it become necessary. */ - pxQueue->pxMutexHolder = ( signed char * ) xTaskGetCurrentTaskHandle(); + pxQueue->pxMutexHolder = ( int8_t * ) xTaskGetCurrentTaskHandle(); } else { @@ -949,7 +949,7 @@ xQUEUE * const pxQueue = ( xQUEUE * ) xQueue; } else { - if( xTicksToWait == ( portTickType ) 0 ) + if( xTicksToWait == ( TickType_t ) 0 ) { taskEXIT_CRITICAL(); traceQUEUE_RECEIVE_FAILED( pxQueue ); @@ -1012,14 +1012,14 @@ xQUEUE * const pxQueue = ( xQUEUE * ) xQueue; #endif /* configUSE_ALTERNATIVE_API */ /*-----------------------------------------------------------*/ -signed portBASE_TYPE xQueueGenericSendFromISR( xQueueHandle xQueue, const void * const pvItemToQueue, signed portBASE_TYPE * const pxHigherPriorityTaskWoken, const portBASE_TYPE xCopyPosition ) +BaseType_t xQueueGenericSendFromISR( QueueHandle_t xQueue, const void * const pvItemToQueue, BaseType_t * const pxHigherPriorityTaskWoken, const BaseType_t xCopyPosition ) { -signed portBASE_TYPE xReturn; -unsigned portBASE_TYPE uxSavedInterruptStatus; -xQUEUE * const pxQueue = ( xQUEUE * ) xQueue; +BaseType_t xReturn; +UBaseType_t uxSavedInterruptStatus; +Queue_t * const pxQueue = ( Queue_t * ) xQueue; configASSERT( pxQueue ); - configASSERT( !( ( pvItemToQueue == NULL ) && ( pxQueue->uxItemSize != ( unsigned portBASE_TYPE ) 0U ) ) ); + configASSERT( !( ( pvItemToQueue == NULL ) && ( pxQueue->uxItemSize != ( UBaseType_t ) 0U ) ) ); configASSERT( !( ( xCopyPosition == queueOVERWRITE ) && ( pxQueue->uxLength != 1 ) ) ); /* RTOS ports that support interrupt nesting have the concept of a maximum @@ -1156,15 +1156,15 @@ xQUEUE * const pxQueue = ( xQUEUE * ) xQueue; } /*-----------------------------------------------------------*/ -signed portBASE_TYPE xQueueGenericReceive( xQueueHandle xQueue, void * const pvBuffer, portTickType xTicksToWait, const portBASE_TYPE xJustPeeking ) +BaseType_t xQueueGenericReceive( QueueHandle_t xQueue, void * const pvBuffer, TickType_t xTicksToWait, const BaseType_t xJustPeeking ) { -signed portBASE_TYPE xEntryTimeSet = pdFALSE; -xTimeOutType xTimeOut; -signed char *pcOriginalReadPosition; -xQUEUE * const pxQueue = ( xQUEUE * ) xQueue; +BaseType_t xEntryTimeSet = pdFALSE; +TimeOut_t xTimeOut; +int8_t *pcOriginalReadPosition; +Queue_t * const pxQueue = ( Queue_t * ) xQueue; configASSERT( pxQueue ); - configASSERT( !( ( pvBuffer == NULL ) && ( pxQueue->uxItemSize != ( unsigned portBASE_TYPE ) 0U ) ) ); + configASSERT( !( ( pvBuffer == NULL ) && ( pxQueue->uxItemSize != ( UBaseType_t ) 0U ) ) ); #if ( ( INCLUDE_xTaskGetSchedulerState == 1 ) || ( configUSE_TIMERS == 1 ) ) { configASSERT( !( ( xTaskGetSchedulerState() == taskSCHEDULER_SUSPENDED ) && ( xTicksToWait != 0 ) ) ); @@ -1181,7 +1181,7 @@ xQUEUE * const pxQueue = ( xQUEUE * ) xQueue; { /* Is there data in the queue now? To be running we must be the highest priority task wanting to access the queue. */ - if( pxQueue->uxMessagesWaiting > ( unsigned portBASE_TYPE ) 0 ) + if( pxQueue->uxMessagesWaiting > ( UBaseType_t ) 0 ) { /* Remember the read position in case the queue is only being peeked. */ @@ -1202,7 +1202,7 @@ xQUEUE * const pxQueue = ( xQUEUE * ) xQueue; { /* Record the information required to implement priority inheritance should it become necessary. */ - pxQueue->pxMutexHolder = ( signed char * ) xTaskGetCurrentTaskHandle(); /*lint !e961 Cast is not redundant as xTaskHandle is a typedef. */ + pxQueue->pxMutexHolder = ( int8_t * ) xTaskGetCurrentTaskHandle(); /*lint !e961 Cast is not redundant as TaskHandle_t is a typedef. */ } else { @@ -1262,7 +1262,7 @@ xQUEUE * const pxQueue = ( xQUEUE * ) xQueue; } else { - if( xTicksToWait == ( portTickType ) 0 ) + if( xTicksToWait == ( TickType_t ) 0 ) { /* The queue was empty and no block time is specified (or the block time has expired) so leave now. */ @@ -1345,14 +1345,14 @@ xQUEUE * const pxQueue = ( xQUEUE * ) xQueue; } /*-----------------------------------------------------------*/ -signed portBASE_TYPE xQueueReceiveFromISR( xQueueHandle xQueue, void * const pvBuffer, signed portBASE_TYPE * const pxHigherPriorityTaskWoken ) +BaseType_t xQueueReceiveFromISR( QueueHandle_t xQueue, void * const pvBuffer, BaseType_t * const pxHigherPriorityTaskWoken ) { -signed portBASE_TYPE xReturn; -unsigned portBASE_TYPE uxSavedInterruptStatus; -xQUEUE * const pxQueue = ( xQUEUE * ) xQueue; +BaseType_t xReturn; +UBaseType_t uxSavedInterruptStatus; +Queue_t * const pxQueue = ( Queue_t * ) xQueue; configASSERT( pxQueue ); - configASSERT( !( ( pvBuffer == NULL ) && ( pxQueue->uxItemSize != ( unsigned portBASE_TYPE ) 0U ) ) ); + configASSERT( !( ( pvBuffer == NULL ) && ( pxQueue->uxItemSize != ( UBaseType_t ) 0U ) ) ); /* RTOS ports that support interrupt nesting have the concept of a maximum system call (or maximum API call) interrupt priority. Interrupts that are @@ -1373,7 +1373,7 @@ xQUEUE * const pxQueue = ( xQUEUE * ) xQueue; uxSavedInterruptStatus = portSET_INTERRUPT_MASK_FROM_ISR(); { /* Cannot block in an ISR, so check there is data available. */ - if( pxQueue->uxMessagesWaiting > ( unsigned portBASE_TYPE ) 0 ) + if( pxQueue->uxMessagesWaiting > ( UBaseType_t ) 0 ) { traceQUEUE_RECEIVE_FROM_ISR( pxQueue ); @@ -1432,15 +1432,15 @@ xQUEUE * const pxQueue = ( xQUEUE * ) xQueue; } /*-----------------------------------------------------------*/ -signed portBASE_TYPE xQueuePeekFromISR( xQueueHandle xQueue, void * const pvBuffer ) +BaseType_t xQueuePeekFromISR( QueueHandle_t xQueue, void * const pvBuffer ) { -signed portBASE_TYPE xReturn; -unsigned portBASE_TYPE uxSavedInterruptStatus; -signed char *pcOriginalReadPosition; -xQUEUE * const pxQueue = ( xQUEUE * ) xQueue; +BaseType_t xReturn; +UBaseType_t uxSavedInterruptStatus; +int8_t *pcOriginalReadPosition; +Queue_t * const pxQueue = ( Queue_t * ) xQueue; configASSERT( pxQueue ); - configASSERT( !( ( pvBuffer == NULL ) && ( pxQueue->uxItemSize != ( unsigned portBASE_TYPE ) 0U ) ) ); + configASSERT( !( ( pvBuffer == NULL ) && ( pxQueue->uxItemSize != ( UBaseType_t ) 0U ) ) ); /* RTOS ports that support interrupt nesting have the concept of a maximum system call (or maximum API call) interrupt priority. Interrupts that are @@ -1461,7 +1461,7 @@ xQUEUE * const pxQueue = ( xQUEUE * ) xQueue; uxSavedInterruptStatus = portSET_INTERRUPT_MASK_FROM_ISR(); { /* Cannot block in an ISR, so check there is data available. */ - if( pxQueue->uxMessagesWaiting > ( unsigned portBASE_TYPE ) 0 ) + if( pxQueue->uxMessagesWaiting > ( UBaseType_t ) 0 ) { traceQUEUE_PEEK_FROM_ISR( pxQueue ); @@ -1485,15 +1485,15 @@ xQUEUE * const pxQueue = ( xQUEUE * ) xQueue; } /*-----------------------------------------------------------*/ -unsigned portBASE_TYPE uxQueueMessagesWaiting( const xQueueHandle xQueue ) +UBaseType_t uxQueueMessagesWaiting( const QueueHandle_t xQueue ) { -unsigned portBASE_TYPE uxReturn; +UBaseType_t uxReturn; configASSERT( xQueue ); taskENTER_CRITICAL(); { - uxReturn = ( ( xQUEUE * ) xQueue )->uxMessagesWaiting; + uxReturn = ( ( Queue_t * ) xQueue )->uxMessagesWaiting; } taskEXIT_CRITICAL(); @@ -1501,12 +1501,12 @@ unsigned portBASE_TYPE uxReturn; } /*lint !e818 Pointer cannot be declared const as xQueue is a typedef not pointer. */ /*-----------------------------------------------------------*/ -unsigned portBASE_TYPE uxQueueSpacesAvailable( const xQueueHandle xQueue ) +UBaseType_t uxQueueSpacesAvailable( const QueueHandle_t xQueue ) { -unsigned portBASE_TYPE uxReturn; -xQUEUE *pxQueue; +UBaseType_t uxReturn; +Queue_t *pxQueue; - pxQueue = ( xQUEUE * ) xQueue; + pxQueue = ( Queue_t * ) xQueue; configASSERT( pxQueue ); taskENTER_CRITICAL(); @@ -1519,21 +1519,21 @@ xQUEUE *pxQueue; } /*lint !e818 Pointer cannot be declared const as xQueue is a typedef not pointer. */ /*-----------------------------------------------------------*/ -unsigned portBASE_TYPE uxQueueMessagesWaitingFromISR( const xQueueHandle xQueue ) +UBaseType_t uxQueueMessagesWaitingFromISR( const QueueHandle_t xQueue ) { -unsigned portBASE_TYPE uxReturn; +UBaseType_t uxReturn; configASSERT( xQueue ); - uxReturn = ( ( xQUEUE * ) xQueue )->uxMessagesWaiting; + uxReturn = ( ( Queue_t * ) xQueue )->uxMessagesWaiting; return uxReturn; } /*lint !e818 Pointer cannot be declared const as xQueue is a typedef not pointer. */ /*-----------------------------------------------------------*/ -void vQueueDelete( xQueueHandle xQueue ) +void vQueueDelete( QueueHandle_t xQueue ) { -xQUEUE * const pxQueue = ( xQUEUE * ) xQueue; +Queue_t * const pxQueue = ( Queue_t * ) xQueue; configASSERT( pxQueue ); @@ -1553,9 +1553,9 @@ xQUEUE * const pxQueue = ( xQUEUE * ) xQueue; #if ( configUSE_TRACE_FACILITY == 1 ) - unsigned portBASE_TYPE uxQueueGetQueueNumber( xQueueHandle xQueue ) + UBaseType_t uxQueueGetQueueNumber( QueueHandle_t xQueue ) { - return ( ( xQUEUE * ) xQueue )->uxQueueNumber; + return ( ( Queue_t * ) xQueue )->uxQueueNumber; } #endif /* configUSE_TRACE_FACILITY */ @@ -1563,9 +1563,9 @@ xQUEUE * const pxQueue = ( xQUEUE * ) xQueue; #if ( configUSE_TRACE_FACILITY == 1 ) - void vQueueSetQueueNumber( xQueueHandle xQueue, unsigned portBASE_TYPE uxQueueNumber ) + void vQueueSetQueueNumber( QueueHandle_t xQueue, UBaseType_t uxQueueNumber ) { - ( ( xQUEUE * ) xQueue )->uxQueueNumber = uxQueueNumber; + ( ( Queue_t * ) xQueue )->uxQueueNumber = uxQueueNumber; } #endif /* configUSE_TRACE_FACILITY */ @@ -1573,17 +1573,17 @@ xQUEUE * const pxQueue = ( xQUEUE * ) xQueue; #if ( configUSE_TRACE_FACILITY == 1 ) - unsigned char ucQueueGetQueueType( xQueueHandle xQueue ) + uint8_t ucQueueGetQueueType( QueueHandle_t xQueue ) { - return ( ( xQUEUE * ) xQueue )->ucQueueType; + return ( ( Queue_t * ) xQueue )->ucQueueType; } #endif /* configUSE_TRACE_FACILITY */ /*-----------------------------------------------------------*/ -static void prvCopyDataToQueue( xQUEUE * const pxQueue, const void *pvItemToQueue, const portBASE_TYPE xPosition ) +static void prvCopyDataToQueue( Queue_t * const pxQueue, const void *pvItemToQueue, const BaseType_t xPosition ) { - if( pxQueue->uxItemSize == ( unsigned portBASE_TYPE ) 0 ) + if( pxQueue->uxItemSize == ( UBaseType_t ) 0 ) { #if ( configUSE_MUTEXES == 1 ) { @@ -1628,7 +1628,7 @@ static void prvCopyDataToQueue( xQUEUE * const pxQueue, const void *pvItemToQueu if( xPosition == queueOVERWRITE ) { - if( pxQueue->uxMessagesWaiting > ( unsigned portBASE_TYPE ) 0 ) + if( pxQueue->uxMessagesWaiting > ( UBaseType_t ) 0 ) { /* An item is not being added but overwritten, so subtract one from the recorded number of items in the queue so when @@ -1651,7 +1651,7 @@ static void prvCopyDataToQueue( xQUEUE * const pxQueue, const void *pvItemToQueu } /*-----------------------------------------------------------*/ -static void prvCopyDataFromQueue( xQUEUE * const pxQueue, void * const pvBuffer ) +static void prvCopyDataFromQueue( Queue_t * const pxQueue, void * const pvBuffer ) { if( pxQueue->uxQueueType != queueQUEUE_IS_MUTEX ) { @@ -1673,7 +1673,7 @@ static void prvCopyDataFromQueue( xQUEUE * const pxQueue, void * const pvBuffer } /*-----------------------------------------------------------*/ -static void prvUnlockQueue( xQUEUE * const pxQueue ) +static void prvUnlockQueue( Queue_t * const pxQueue ) { /* THIS FUNCTION MUST BE CALLED WITH THE SCHEDULER SUSPENDED. */ @@ -1788,13 +1788,13 @@ static void prvUnlockQueue( xQUEUE * const pxQueue ) } /*-----------------------------------------------------------*/ -static signed portBASE_TYPE prvIsQueueEmpty( const xQUEUE *pxQueue ) +static BaseType_t prvIsQueueEmpty( const Queue_t *pxQueue ) { -signed portBASE_TYPE xReturn; +BaseType_t xReturn; taskENTER_CRITICAL(); { - if( pxQueue->uxMessagesWaiting == ( unsigned portBASE_TYPE ) 0 ) + if( pxQueue->uxMessagesWaiting == ( UBaseType_t ) 0 ) { xReturn = pdTRUE; } @@ -1809,12 +1809,12 @@ signed portBASE_TYPE xReturn; } /*-----------------------------------------------------------*/ -signed portBASE_TYPE xQueueIsQueueEmptyFromISR( const xQueueHandle xQueue ) +BaseType_t xQueueIsQueueEmptyFromISR( const QueueHandle_t xQueue ) { -signed portBASE_TYPE xReturn; +BaseType_t xReturn; configASSERT( xQueue ); - if( ( ( xQUEUE * ) xQueue )->uxMessagesWaiting == ( unsigned portBASE_TYPE ) 0 ) + if( ( ( Queue_t * ) xQueue )->uxMessagesWaiting == ( UBaseType_t ) 0 ) { xReturn = pdTRUE; } @@ -1827,9 +1827,9 @@ signed portBASE_TYPE xReturn; } /*lint !e818 xQueue could not be pointer to const because it is a typedef. */ /*-----------------------------------------------------------*/ -static signed portBASE_TYPE prvIsQueueFull( const xQUEUE *pxQueue ) +static BaseType_t prvIsQueueFull( const Queue_t *pxQueue ) { -signed portBASE_TYPE xReturn; +BaseType_t xReturn; taskENTER_CRITICAL(); { @@ -1848,12 +1848,12 @@ signed portBASE_TYPE xReturn; } /*-----------------------------------------------------------*/ -signed portBASE_TYPE xQueueIsQueueFullFromISR( const xQueueHandle xQueue ) +BaseType_t xQueueIsQueueFullFromISR( const QueueHandle_t xQueue ) { -signed portBASE_TYPE xReturn; +BaseType_t xReturn; configASSERT( xQueue ); - if( ( ( xQUEUE * ) xQueue )->uxMessagesWaiting == ( ( xQUEUE * ) xQueue )->uxLength ) + if( ( ( Queue_t * ) xQueue )->uxMessagesWaiting == ( ( Queue_t * ) xQueue )->uxLength ) { xReturn = pdTRUE; } @@ -1868,10 +1868,10 @@ signed portBASE_TYPE xReturn; #if ( configUSE_CO_ROUTINES == 1 ) - signed portBASE_TYPE xQueueCRSend( xQueueHandle xQueue, const void *pvItemToQueue, portTickType xTicksToWait ) + BaseType_t xQueueCRSend( QueueHandle_t xQueue, const void *pvItemToQueue, TickType_t xTicksToWait ) { - signed portBASE_TYPE xReturn; - xQUEUE * const pxQueue = ( xQUEUE * ) xQueue; + BaseType_t xReturn; + Queue_t * const pxQueue = ( Queue_t * ) xQueue; /* 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 @@ -1882,7 +1882,7 @@ signed portBASE_TYPE xReturn; { /* The queue is full - do we want to block or just leave without posting? */ - if( xTicksToWait > ( portTickType ) 0 ) + if( xTicksToWait > ( TickType_t ) 0 ) { /* As this is called from a coroutine we cannot block directly, but return indicating that we need to block. */ @@ -1945,21 +1945,21 @@ signed portBASE_TYPE xReturn; #if ( configUSE_CO_ROUTINES == 1 ) - signed portBASE_TYPE xQueueCRReceive( xQueueHandle xQueue, void *pvBuffer, portTickType xTicksToWait ) + BaseType_t xQueueCRReceive( QueueHandle_t xQueue, void *pvBuffer, TickType_t xTicksToWait ) { - signed portBASE_TYPE xReturn; - xQUEUE * const pxQueue = ( xQUEUE * ) xQueue; + BaseType_t xReturn; + Queue_t * const pxQueue = ( Queue_t * ) xQueue; /* 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(); { - if( pxQueue->uxMessagesWaiting == ( unsigned portBASE_TYPE ) 0 ) + if( pxQueue->uxMessagesWaiting == ( UBaseType_t ) 0 ) { /* There are no messages in the queue, do we want to block or just leave with nothing? */ - if( xTicksToWait > ( portTickType ) 0 ) + if( xTicksToWait > ( TickType_t ) 0 ) { /* As this is a co-routine we cannot block directly, but return indicating that we need to block. */ @@ -1982,7 +1982,7 @@ signed portBASE_TYPE xReturn; portDISABLE_INTERRUPTS(); { - if( pxQueue->uxMessagesWaiting > ( unsigned portBASE_TYPE ) 0 ) + if( pxQueue->uxMessagesWaiting > ( UBaseType_t ) 0 ) { /* Data is available from the queue. */ pxQueue->u.pcReadFrom += pxQueue->uxItemSize; @@ -2035,9 +2035,9 @@ signed portBASE_TYPE xReturn; #if ( configUSE_CO_ROUTINES == 1 ) - signed portBASE_TYPE xQueueCRSendFromISR( xQueueHandle xQueue, const void *pvItemToQueue, signed portBASE_TYPE xCoRoutinePreviouslyWoken ) + BaseType_t xQueueCRSendFromISR( QueueHandle_t xQueue, const void *pvItemToQueue, BaseType_t xCoRoutinePreviouslyWoken ) { - xQUEUE * const pxQueue = ( xQUEUE * ) xQueue; + Queue_t * const pxQueue = ( Queue_t * ) xQueue; /* Cannot block within an ISR so if there is no space on the queue then exit without doing anything. */ @@ -2083,14 +2083,14 @@ signed portBASE_TYPE xReturn; #if ( configUSE_CO_ROUTINES == 1 ) - signed portBASE_TYPE xQueueCRReceiveFromISR( xQueueHandle xQueue, void *pvBuffer, signed portBASE_TYPE *pxCoRoutineWoken ) + BaseType_t xQueueCRReceiveFromISR( QueueHandle_t xQueue, void *pvBuffer, BaseType_t *pxCoRoutineWoken ) { - signed portBASE_TYPE xReturn; - xQUEUE * const pxQueue = ( xQUEUE * ) xQueue; + BaseType_t xReturn; + Queue_t * const pxQueue = ( Queue_t * ) xQueue; /* We cannot block from an ISR, so check there is data available. If not then just leave without doing anything. */ - if( pxQueue->uxMessagesWaiting > ( unsigned portBASE_TYPE ) 0 ) + if( pxQueue->uxMessagesWaiting > ( UBaseType_t ) 0 ) { /* Copy the data from the queue. */ pxQueue->u.pcReadFrom += pxQueue->uxItemSize; @@ -2143,13 +2143,13 @@ signed portBASE_TYPE xReturn; #if ( configQUEUE_REGISTRY_SIZE > 0 ) - void vQueueAddToRegistry( xQueueHandle xQueue, char *pcQueueName ) /*lint !e971 Unqualified char types are allowed for strings and single characters only. */ + void vQueueAddToRegistry( QueueHandle_t xQueue, char *pcQueueName ) /*lint !e971 Unqualified char types are allowed for strings and single characters only. */ { - unsigned portBASE_TYPE ux; + UBaseType_t ux; /* See if there is an empty space in the registry. A NULL name denotes a free slot. */ - for( ux = ( unsigned portBASE_TYPE ) 0U; ux < ( unsigned portBASE_TYPE ) configQUEUE_REGISTRY_SIZE; ux++ ) + for( ux = ( UBaseType_t ) 0U; ux < ( UBaseType_t ) configQUEUE_REGISTRY_SIZE; ux++ ) { if( xQueueRegistry[ ux ].pcQueueName == NULL ) { @@ -2170,13 +2170,13 @@ signed portBASE_TYPE xReturn; #if ( configQUEUE_REGISTRY_SIZE > 0 ) - void vQueueUnregisterQueue( xQueueHandle xQueue ) + void vQueueUnregisterQueue( QueueHandle_t xQueue ) { - unsigned portBASE_TYPE ux; + UBaseType_t ux; /* See if the handle of the queue being unregistered in actually in the registry. */ - for( ux = ( unsigned portBASE_TYPE ) 0U; ux < ( unsigned portBASE_TYPE ) configQUEUE_REGISTRY_SIZE; ux++ ) + for( ux = ( UBaseType_t ) 0U; ux < ( UBaseType_t ) configQUEUE_REGISTRY_SIZE; ux++ ) { if( xQueueRegistry[ ux ].xHandle == xQueue ) { @@ -2197,9 +2197,9 @@ signed portBASE_TYPE xReturn; #if ( configUSE_TIMERS == 1 ) - void vQueueWaitForMessageRestricted( xQueueHandle xQueue, portTickType xTicksToWait ) + void vQueueWaitForMessageRestricted( QueueHandle_t xQueue, TickType_t xTicksToWait ) { - xQUEUE * const pxQueue = ( xQUEUE * ) xQueue; + Queue_t * const pxQueue = ( Queue_t * ) xQueue; /* This function should not be called by application code hence the 'Restricted' in its name. It is not part of the public API. It is @@ -2216,7 +2216,7 @@ signed portBASE_TYPE xReturn; the queue is locked, and the calling task blocks on the queue, then the calling task will be immediately unblocked when the queue is unlocked. */ prvLockQueue( pxQueue ); - if( pxQueue->uxMessagesWaiting == ( unsigned portBASE_TYPE ) 0U ) + if( pxQueue->uxMessagesWaiting == ( UBaseType_t ) 0U ) { /* There is nothing in the queue, block for the specified period. */ vTaskPlaceOnEventListRestricted( &( pxQueue->xTasksWaitingToReceive ), xTicksToWait ); @@ -2233,11 +2233,11 @@ signed portBASE_TYPE xReturn; #if ( configUSE_QUEUE_SETS == 1 ) - xQueueSetHandle xQueueCreateSet( const unsigned portBASE_TYPE uxEventQueueLength ) + QueueSetHandle_t xQueueCreateSet( const UBaseType_t uxEventQueueLength ) { - xQueueSetHandle pxQueue; + QueueSetHandle_t pxQueue; - pxQueue = xQueueGenericCreate( uxEventQueueLength, sizeof( xQUEUE * ), queueQUEUE_TYPE_SET ); + pxQueue = xQueueGenericCreate( uxEventQueueLength, sizeof( Queue_t * ), queueQUEUE_TYPE_SET ); return pxQueue; } @@ -2247,16 +2247,16 @@ signed portBASE_TYPE xReturn; #if ( configUSE_QUEUE_SETS == 1 ) - portBASE_TYPE xQueueAddToSet( xQueueSetMemberHandle xQueueOrSemaphore, xQueueSetHandle xQueueSet ) + BaseType_t xQueueAddToSet( QueueSetMember_t xQueueOrSemaphore, QueueSetHandle_t xQueueSet ) { - portBASE_TYPE xReturn; + BaseType_t xReturn; - if( ( ( xQUEUE * ) xQueueOrSemaphore )->pxQueueSetContainer != NULL ) + if( ( ( Queue_t * ) xQueueOrSemaphore )->pxQueueSetContainer != NULL ) { /* Cannot add a queue/semaphore to more than one queue set. */ xReturn = pdFAIL; } - else if( ( ( xQUEUE * ) xQueueOrSemaphore )->uxMessagesWaiting != ( unsigned portBASE_TYPE ) 0 ) + else if( ( ( Queue_t * ) xQueueOrSemaphore )->uxMessagesWaiting != ( UBaseType_t ) 0 ) { /* Cannot add a queue/semaphore to a queue set if there are already items in the queue/semaphore. */ @@ -2266,7 +2266,7 @@ signed portBASE_TYPE xReturn; { taskENTER_CRITICAL(); { - ( ( xQUEUE * ) xQueueOrSemaphore )->pxQueueSetContainer = xQueueSet; + ( ( Queue_t * ) xQueueOrSemaphore )->pxQueueSetContainer = xQueueSet; } taskEXIT_CRITICAL(); xReturn = pdPASS; @@ -2280,17 +2280,17 @@ signed portBASE_TYPE xReturn; #if ( configUSE_QUEUE_SETS == 1 ) - portBASE_TYPE xQueueRemoveFromSet( xQueueSetMemberHandle xQueueOrSemaphore, xQueueSetHandle xQueueSet ) + BaseType_t xQueueRemoveFromSet( QueueSetMember_t xQueueOrSemaphore, QueueSetHandle_t xQueueSet ) { - portBASE_TYPE xReturn; - xQUEUE * const pxQueueOrSemaphore = ( xQUEUE * ) xQueueOrSemaphore; + BaseType_t xReturn; + Queue_t * const pxQueueOrSemaphore = ( Queue_t * ) xQueueOrSemaphore; if( pxQueueOrSemaphore->pxQueueSetContainer != xQueueSet ) { /* The queue was not a member of the set. */ xReturn = pdFAIL; } - else if( pxQueueOrSemaphore->uxMessagesWaiting != ( unsigned portBASE_TYPE ) 0 ) + else if( pxQueueOrSemaphore->uxMessagesWaiting != ( UBaseType_t ) 0 ) { /* It is dangerous to remove a queue from a set when the queue is not empty because the queue set will still hold pending events for @@ -2316,11 +2316,11 @@ signed portBASE_TYPE xReturn; #if ( configUSE_QUEUE_SETS == 1 ) - xQueueSetMemberHandle xQueueSelectFromSet( xQueueSetHandle xQueueSet, portTickType const xBlockTimeTicks ) + QueueSetMember_t xQueueSelectFromSet( QueueSetHandle_t xQueueSet, TickType_t const xBlockTimeTicks ) { - xQueueSetMemberHandle xReturn = NULL; + QueueSetMember_t xReturn = NULL; - ( void ) xQueueGenericReceive( ( xQueueHandle ) xQueueSet, &xReturn, xBlockTimeTicks, pdFALSE ); /*lint !e961 Casting from one typedef to another is not redundant. */ + ( void ) xQueueGenericReceive( ( QueueHandle_t ) xQueueSet, &xReturn, xBlockTimeTicks, pdFALSE ); /*lint !e961 Casting from one typedef to another is not redundant. */ return xReturn; } @@ -2329,11 +2329,11 @@ signed portBASE_TYPE xReturn; #if ( configUSE_QUEUE_SETS == 1 ) - xQueueSetMemberHandle xQueueSelectFromSetFromISR( xQueueSetHandle xQueueSet ) + QueueSetMember_t xQueueSelectFromSetFromISR( QueueSetHandle_t xQueueSet ) { - xQueueSetMemberHandle xReturn = NULL; + QueueSetMember_t xReturn = NULL; - ( void ) xQueueReceiveFromISR( ( xQueueHandle ) xQueueSet, &xReturn, NULL ); /*lint !e961 Casting from one typedef to another is not redundant. */ + ( void ) xQueueReceiveFromISR( ( QueueHandle_t ) xQueueSet, &xReturn, NULL ); /*lint !e961 Casting from one typedef to another is not redundant. */ return xReturn; } @@ -2342,10 +2342,10 @@ signed portBASE_TYPE xReturn; #if ( configUSE_QUEUE_SETS == 1 ) - static portBASE_TYPE prvNotifyQueueSetContainer( const xQUEUE * const pxQueue, const portBASE_TYPE xCopyPosition ) + static BaseType_t prvNotifyQueueSetContainer( const Queue_t * const pxQueue, const BaseType_t xCopyPosition ) { - xQUEUE *pxQueueSetContainer = pxQueue->pxQueueSetContainer; - portBASE_TYPE xReturn = pdFALSE; + Queue_t *pxQueueSetContainer = pxQueue->pxQueueSetContainer; + BaseType_t xReturn = pdFALSE; configASSERT( pxQueueSetContainer ); configASSERT( pxQueueSetContainer->uxMessagesWaiting < pxQueueSetContainer->uxLength ); diff --git a/FreeRTOS/Source/tasks.c b/FreeRTOS/Source/tasks.c index 3b6c60447..f89adc564 100644 --- a/FreeRTOS/Source/tasks.c +++ b/FreeRTOS/Source/tasks.c @@ -119,33 +119,33 @@ privileged Vs unprivileged linkage and placement. */ */ typedef struct tskTaskControlBlock { - volatile portSTACK_TYPE *pxTopOfStack; /*< Points to the location of the last item placed on the tasks stack. THIS MUST BE THE FIRST MEMBER OF THE TCB STRUCT. */ + volatile StackType_t *pxTopOfStack; /*< Points to the location of the last item placed on the tasks stack. THIS MUST BE THE FIRST MEMBER OF THE TCB STRUCT. */ #if ( portUSING_MPU_WRAPPERS == 1 ) - xMPU_SETTINGS xMPUSettings; /*< The MPU settings are defined as part of the port layer. THIS MUST BE THE SECOND MEMBER OF THE TCB STRUCT. */ + xMPU_SETTINGS xMPUSettings; /*< The MPU settings are defined as part of the port layer. THIS MUST BE THE SECOND MEMBER OF THE TCB STRUCT. */ #endif - xListItem xGenericListItem; /*< The list that the state list item of a task is reference from denotes the state of that task (Ready, Blocked, Suspended ). */ - xListItem xEventListItem; /*< Used to reference a task from an event list. */ - unsigned portBASE_TYPE uxPriority; /*< The priority of the task. 0 is the lowest priority. */ - portSTACK_TYPE *pxStack; /*< Points to the start of the stack. */ - char pcTaskName[ configMAX_TASK_NAME_LEN ];/*< Descriptive name given to the task when created. Facilitates debugging only. */ /*lint !e971 Unqualified char types are allowed for strings and single characters only. */ + ListItem_t xGenericListItem; /*< The list that the state list item of a task is reference from denotes the state of that task (Ready, Blocked, Suspended ). */ + ListItem_t xEventListItem; /*< Used to reference a task from an event list. */ + UBaseType_t uxPriority; /*< The priority of the task. 0 is the lowest priority. */ + StackType_t *pxStack; /*< Points to the start of the stack. */ + char pcTaskName[ configMAX_TASK_NAME_LEN ];/*< Descriptive name given to the task when created. Facilitates debugging only. */ /*lint !e971 Unqualified char types are allowed for strings and single characters only. */ #if ( portSTACK_GROWTH > 0 ) - portSTACK_TYPE *pxEndOfStack; /*< Points to the end of the stack on architectures where the stack grows up from low memory. */ + StackType_t *pxEndOfStack; /*< Points to the end of the stack on architectures where the stack grows up from low memory. */ #endif #if ( portCRITICAL_NESTING_IN_TCB == 1 ) - unsigned portBASE_TYPE uxCriticalNesting; /*< Holds the critical section nesting depth for ports that do not maintain their own count in the port layer. */ + UBaseType_t uxCriticalNesting; /*< Holds the critical section nesting depth for ports that do not maintain their own count in the port layer. */ #endif #if ( configUSE_TRACE_FACILITY == 1 ) - unsigned portBASE_TYPE uxTCBNumber; /*< Stores a number that increments each time a TCB is created. It allows debuggers to determine when a task has been deleted and then recreated. */ - unsigned portBASE_TYPE uxTaskNumber; /*< Stores a number specifically for use by third party trace code. */ + UBaseType_t uxTCBNumber; /*< Stores a number that increments each time a TCB is created. It allows debuggers to determine when a task has been deleted and then recreated. */ + UBaseType_t uxTaskNumber; /*< Stores a number specifically for use by third party trace code. */ #endif #if ( configUSE_MUTEXES == 1 ) - unsigned portBASE_TYPE uxBasePriority; /*< The priority last assigned to the task - used by the priority inheritance mechanism. */ + UBaseType_t uxBasePriority; /*< The priority last assigned to the task - used by the priority inheritance mechanism. */ #endif #if ( configUSE_APPLICATION_TASK_TAG == 1 ) @@ -153,7 +153,7 @@ typedef struct tskTaskControlBlock #endif #if ( configGENERATE_RUN_TIME_STATS == 1 ) - unsigned long ulRunTimeCounter; /*< Stores the amount of time the task has spent in the Running state. */ + uint32_t ulRunTimeCounter; /*< Stores the amount of time the task has spent in the Running state. */ #endif #if ( configUSE_NEWLIB_REENTRANT == 1 ) @@ -164,10 +164,10 @@ typedef struct tskTaskControlBlock newlib and must provide system-wide implementations of the necessary stubs. Be warned that (at the time of writing) the current newlib design implements a system-wide malloc() that must be provided with locks. */ - struct _reent xNewLib_reent; + struct _reent xNewLib_reent; #endif -} tskTCB; +} TCB_t; /* * Some kernel aware debuggers require the data the debugger needs access to to @@ -180,51 +180,51 @@ typedef struct tskTaskControlBlock /*lint -e956 A manual analysis and inspection has been used to determine which static variables must be declared volatile. */ -PRIVILEGED_DATA tskTCB * volatile pxCurrentTCB = NULL; +PRIVILEGED_DATA TCB_t * volatile pxCurrentTCB = NULL; /* Lists for ready and blocked tasks. --------------------*/ -PRIVILEGED_DATA static xList pxReadyTasksLists[ configMAX_PRIORITIES ]; /*< Prioritised ready tasks. */ -PRIVILEGED_DATA static xList xDelayedTaskList1; /*< Delayed tasks. */ -PRIVILEGED_DATA static xList xDelayedTaskList2; /*< Delayed tasks (two lists are used - one for delays that have overflowed the current tick count. */ -PRIVILEGED_DATA static xList * volatile pxDelayedTaskList; /*< Points to the delayed task list currently being used. */ -PRIVILEGED_DATA static xList * volatile pxOverflowDelayedTaskList; /*< Points to the delayed task list currently being used to hold tasks that have overflowed the current tick count. */ -PRIVILEGED_DATA static xList xPendingReadyList; /*< Tasks that have been readied while the scheduler was suspended. They will be moved to the ready list when the scheduler is resumed. */ +PRIVILEGED_DATA static List_t pxReadyTasksLists[ configMAX_PRIORITIES ];/*< Prioritised ready tasks. */ +PRIVILEGED_DATA static List_t xDelayedTaskList1; /*< Delayed tasks. */ +PRIVILEGED_DATA static List_t xDelayedTaskList2; /*< Delayed tasks (two lists are used - one for delays that have overflowed the current tick count. */ +PRIVILEGED_DATA static List_t * volatile pxDelayedTaskList; /*< Points to the delayed task list currently being used. */ +PRIVILEGED_DATA static List_t * volatile pxOverflowDelayedTaskList; /*< Points to the delayed task list currently being used to hold tasks that have overflowed the current tick count. */ +PRIVILEGED_DATA static List_t xPendingReadyList; /*< Tasks that have been readied while the scheduler was suspended. They will be moved to the ready list when the scheduler is resumed. */ #if ( INCLUDE_vTaskDelete == 1 ) - PRIVILEGED_DATA static xList xTasksWaitingTermination; /*< Tasks that have been deleted - but their memory not yet freed. */ - PRIVILEGED_DATA static volatile unsigned portBASE_TYPE uxTasksDeleted = ( unsigned portBASE_TYPE ) 0U; + PRIVILEGED_DATA static List_t xTasksWaitingTermination; /*< Tasks that have been deleted - but their memory not yet freed. */ + PRIVILEGED_DATA static volatile UBaseType_t uxTasksDeleted = ( UBaseType_t ) 0U; #endif #if ( INCLUDE_vTaskSuspend == 1 ) - PRIVILEGED_DATA static xList xSuspendedTaskList; /*< Tasks that are currently suspended. */ + PRIVILEGED_DATA static List_t xSuspendedTaskList; /*< Tasks that are currently suspended. */ #endif #if ( INCLUDE_xTaskGetIdleTaskHandle == 1 ) - PRIVILEGED_DATA static xTaskHandle xIdleTaskHandle = NULL; /*< Holds the handle of the idle task. The idle task is created automatically when the scheduler is started. */ + PRIVILEGED_DATA static TaskHandle_t xIdleTaskHandle = NULL; /*< Holds the handle of the idle task. The idle task is created automatically when the scheduler is started. */ #endif /* Other file private variables. --------------------------------*/ -PRIVILEGED_DATA static volatile unsigned portBASE_TYPE uxCurrentNumberOfTasks = ( unsigned portBASE_TYPE ) 0U; -PRIVILEGED_DATA static volatile portTickType xTickCount = ( portTickType ) 0U; -PRIVILEGED_DATA static volatile unsigned portBASE_TYPE uxTopReadyPriority = tskIDLE_PRIORITY; -PRIVILEGED_DATA static volatile signed portBASE_TYPE xSchedulerRunning = pdFALSE; -PRIVILEGED_DATA static volatile unsigned portBASE_TYPE uxSchedulerSuspended = ( unsigned portBASE_TYPE ) pdFALSE; -PRIVILEGED_DATA static volatile unsigned portBASE_TYPE uxPendedTicks = ( unsigned portBASE_TYPE ) 0U; -PRIVILEGED_DATA static volatile portBASE_TYPE xYieldPending = pdFALSE; -PRIVILEGED_DATA static volatile portBASE_TYPE xNumOfOverflows = ( portBASE_TYPE ) 0; -PRIVILEGED_DATA static unsigned portBASE_TYPE uxTaskNumber = ( unsigned portBASE_TYPE ) 0U; -PRIVILEGED_DATA static volatile portTickType xNextTaskUnblockTime = portMAX_DELAY; +PRIVILEGED_DATA static volatile UBaseType_t uxCurrentNumberOfTasks = ( UBaseType_t ) 0U; +PRIVILEGED_DATA static volatile TickType_t xTickCount = ( TickType_t ) 0U; +PRIVILEGED_DATA static volatile UBaseType_t uxTopReadyPriority = tskIDLE_PRIORITY; +PRIVILEGED_DATA static volatile BaseType_t xSchedulerRunning = pdFALSE; +PRIVILEGED_DATA static volatile UBaseType_t uxSchedulerSuspended = ( UBaseType_t ) pdFALSE; +PRIVILEGED_DATA static volatile UBaseType_t uxPendedTicks = ( UBaseType_t ) 0U; +PRIVILEGED_DATA static volatile BaseType_t xYieldPending = pdFALSE; +PRIVILEGED_DATA static volatile BaseType_t xNumOfOverflows = ( BaseType_t ) 0; +PRIVILEGED_DATA static UBaseType_t uxTaskNumber = ( UBaseType_t ) 0U; +PRIVILEGED_DATA static volatile TickType_t xNextTaskUnblockTime = portMAX_DELAY; #if ( configGENERATE_RUN_TIME_STATS == 1 ) - PRIVILEGED_DATA static unsigned long ulTaskSwitchedInTime = 0UL; /*< Holds the value of a timer/counter the last time a task was switched in. */ - PRIVILEGED_DATA static unsigned long ulTotalRunTime = 0UL; /*< Holds the total amount of execution time as defined by the run time counter clock. */ + PRIVILEGED_DATA static uint32_t ulTaskSwitchedInTime = 0UL; /*< Holds the value of a timer/counter the last time a task was switched in. */ + PRIVILEGED_DATA static uint32_t ulTotalRunTime = 0UL; /*< Holds the total amount of execution time as defined by the run time counter clock. */ #endif @@ -256,28 +256,28 @@ PRIVILEGED_DATA static volatile portTickType xNextTaskUnblockTime = portMAX_D /* uxTopReadyPriority holds the priority of the highest priority ready state task. */ - #define taskRECORD_READY_PRIORITY( uxPriority ) \ - { \ - if( ( uxPriority ) > uxTopReadyPriority ) \ - { \ - uxTopReadyPriority = ( uxPriority ); \ - } \ + #define taskRECORD_READY_PRIORITY( uxPriority ) \ + { \ + if( ( uxPriority ) > uxTopReadyPriority ) \ + { \ + uxTopReadyPriority = ( uxPriority ); \ + } \ } /* taskRECORD_READY_PRIORITY */ /*-----------------------------------------------------------*/ - #define taskSELECT_HIGHEST_PRIORITY_TASK() \ - { \ - /* Find the highest priority queue that contains ready tasks. */ \ - while( listLIST_IS_EMPTY( &( pxReadyTasksLists[ uxTopReadyPriority ] ) ) ) \ - { \ - configASSERT( uxTopReadyPriority ); \ - --uxTopReadyPriority; \ - } \ - \ - /* listGET_OWNER_OF_NEXT_ENTRY indexes through the list, so the tasks of \ - the same priority get an equal share of the processor time. */ \ - listGET_OWNER_OF_NEXT_ENTRY( pxCurrentTCB, &( pxReadyTasksLists[ uxTopReadyPriority ] ) ); \ + #define taskSELECT_HIGHEST_PRIORITY_TASK() \ + { \ + /* Find the highest priority queue that contains ready tasks. */ \ + while( listLIST_IS_EMPTY( &( pxReadyTasksLists[ uxTopReadyPriority ] ) ) ) \ + { \ + configASSERT( uxTopReadyPriority ); \ + --uxTopReadyPriority; \ + } \ + \ + /* listGET_OWNER_OF_NEXT_ENTRY indexes through the list, so the tasks of \ + the same priority get an equal share of the processor time. */ \ + listGET_OWNER_OF_NEXT_ENTRY( pxCurrentTCB, &( pxReadyTasksLists[ uxTopReadyPriority ] ) ); \ } /* taskSELECT_HIGHEST_PRIORITY_TASK */ /*-----------------------------------------------------------*/ @@ -301,7 +301,7 @@ PRIVILEGED_DATA static volatile portTickType xNextTaskUnblockTime = portMAX_D #define taskSELECT_HIGHEST_PRIORITY_TASK() \ { \ - unsigned portBASE_TYPE uxTopPriority; \ + UBaseType_t uxTopPriority; \ \ /* Find the highest priority queue that contains ready tasks. */ \ portGET_HIGHEST_PRIORITY( uxTopPriority, uxTopReadyPriority ); \ @@ -330,7 +330,7 @@ PRIVILEGED_DATA static volatile portTickType xNextTaskUnblockTime = portMAX_D count overflows. */ #define taskSWITCH_DELAYED_LISTS() \ { \ - xList *pxTemp; \ + List_t *pxTemp; \ \ /* The delayed tasks list should be empty when the lists are switched. */ \ configASSERT( ( listLIST_IS_EMPTY( pxDelayedTaskList ) ) ); \ @@ -348,19 +348,19 @@ count overflows. */ * Place the task represented by pxTCB into the appropriate ready list for * the task. It is inserted at the end of the list. */ -#define prvAddTaskToReadyList( pxTCB ) \ - traceMOVED_TASK_TO_READY_STATE( pxTCB ) \ - taskRECORD_READY_PRIORITY( ( pxTCB )->uxPriority ); \ +#define prvAddTaskToReadyList( pxTCB ) \ + traceMOVED_TASK_TO_READY_STATE( pxTCB ) \ + taskRECORD_READY_PRIORITY( ( pxTCB )->uxPriority ); \ vListInsertEnd( &( pxReadyTasksLists[ ( pxTCB )->uxPriority ] ), &( ( pxTCB )->xGenericListItem ) ) /*-----------------------------------------------------------*/ /* - * Several functions take an xTaskHandle parameter that can optionally be NULL, + * Several functions take an TaskHandle_t parameter that can optionally be NULL, * where NULL is used to indicate that the handle of the currently executing * task should be used in place of the parameter. This macro simply checks to * see if the parameter is NULL and returns a pointer to the appropriate TCB. */ -#define prvGetTCBFromHandle( pxHandle ) ( ( ( pxHandle ) == NULL ) ? ( tskTCB * ) pxCurrentTCB : ( tskTCB * ) ( pxHandle ) ) +#define prvGetTCBFromHandle( pxHandle ) ( ( ( pxHandle ) == NULL ) ? ( TCB_t * ) pxCurrentTCB : ( TCB_t * ) ( pxHandle ) ) /* The item value of the event list item is normally used to hold the priority of the task to which it belongs (coded to allow it to be held in reverse @@ -378,7 +378,7 @@ to its original value when it is released. */ /* Callback function prototypes. --------------------------*/ #if configCHECK_FOR_STACK_OVERFLOW > 0 - extern void vApplicationStackOverflowHook( xTaskHandle xTask, char *pcTaskName ); + extern void vApplicationStackOverflowHook( TaskHandle_t xTask, char *pcTaskName ); #endif #if configUSE_TICK_HOOK > 0 @@ -391,7 +391,7 @@ to its original value when it is released. */ * Utility to ready a TCB for a given task. Mainly just copies the parameters * into the TCB structure. */ -static void prvInitialiseTCBVariables( tskTCB * const pxTCB, const char * const pcName, unsigned portBASE_TYPE uxPriority, const xMemoryRegion * const xRegions, const unsigned short usStackDepth ) PRIVILEGED_FUNCTION; /*lint !e971 Unqualified char types are allowed for strings and single characters only. */ +static void prvInitialiseTCBVariables( TCB_t * const pxTCB, const char * const pcName, UBaseType_t uxPriority, const MemoryRegion_t * const xRegions, const uint16_t usStackDepth ) PRIVILEGED_FUNCTION; /*lint !e971 Unqualified char types are allowed for strings and single characters only. */ /* * Utility to ready all the lists used by the scheduler. This is called @@ -421,7 +421,7 @@ static portTASK_FUNCTION_PROTO( prvIdleTask, pvParameters ); */ #if ( INCLUDE_vTaskDelete == 1 ) - static void prvDeleteTCB( tskTCB *pxTCB ) PRIVILEGED_FUNCTION; + static void prvDeleteTCB( TCB_t *pxTCB ) PRIVILEGED_FUNCTION; #endif @@ -436,16 +436,16 @@ static void prvCheckTasksWaitingTermination( void ) PRIVILEGED_FUNCTION; * The currently executing task is entering the Blocked state. Add the task to * either the current or the overflow delayed task list. */ -static void prvAddCurrentTaskToDelayedList( const portTickType xTimeToWake ) PRIVILEGED_FUNCTION; +static void prvAddCurrentTaskToDelayedList( const TickType_t xTimeToWake ) PRIVILEGED_FUNCTION; /* * Allocates memory from the heap for a TCB and associated stack. Checks the * allocation was successful. */ -static tskTCB *prvAllocateTCBAndStack( const unsigned short usStackDepth, portSTACK_TYPE * const puxStackBuffer ) PRIVILEGED_FUNCTION; +static TCB_t *prvAllocateTCBAndStack( const uint16_t usStackDepth, StackType_t * const puxStackBuffer ) PRIVILEGED_FUNCTION; /* - * Fills an xTaskStatusType structure with information on each task that is + * Fills an TaskStatus_t structure with information on each task that is * referenced from the pxList list (which may be a ready list, a delayed list, * a suspended list, etc.). * @@ -454,7 +454,7 @@ static tskTCB *prvAllocateTCBAndStack( const unsigned short usStackDepth, portST */ #if ( configUSE_TRACE_FACILITY == 1 ) - static unsigned portBASE_TYPE prvListTaskWithinSingleList( xTaskStatusType *pxTaskStatusArray, xList *pxList, eTaskState eState ) PRIVILEGED_FUNCTION; + static UBaseType_t prvListTaskWithinSingleList( TaskStatus_t *pxTaskStatusArray, List_t *pxList, eTaskState eState ) PRIVILEGED_FUNCTION; #endif @@ -465,7 +465,7 @@ static tskTCB *prvAllocateTCBAndStack( const unsigned short usStackDepth, portST */ #if ( ( configUSE_TRACE_FACILITY == 1 ) || ( INCLUDE_uxTaskGetStackHighWaterMark == 1 ) ) - static unsigned short prvTaskCheckFreeStackSpace( const unsigned char * pucStackByte ) PRIVILEGED_FUNCTION; + static uint16_t prvTaskCheckFreeStackSpace( const uint8_t * pucStackByte ) PRIVILEGED_FUNCTION; #endif @@ -480,7 +480,7 @@ static tskTCB *prvAllocateTCBAndStack( const unsigned short usStackDepth, portST */ #if ( configUSE_TICKLESS_IDLE != 0 ) - static portTickType prvGetExpectedIdleTime( void ) PRIVILEGED_FUNCTION; + static TickType_t prvGetExpectedIdleTime( void ) PRIVILEGED_FUNCTION; #endif @@ -492,10 +492,10 @@ static void prvResetNextTaskUnblockTime( void ); /*-----------------------------------------------------------*/ -signed portBASE_TYPE xTaskGenericCreate( pdTASK_CODE pxTaskCode, const char * const pcName, const unsigned short usStackDepth, void * const pvParameters, unsigned portBASE_TYPE uxPriority, xTaskHandle * const pxCreatedTask, portSTACK_TYPE * const puxStackBuffer, const xMemoryRegion * const xRegions ) /*lint !e971 Unqualified char types are allowed for strings and single characters only. */ +BaseType_t xTaskGenericCreate( pdTASK_CODE pxTaskCode, const char * const pcName, const uint16_t usStackDepth, void * const pvParameters, UBaseType_t uxPriority, TaskHandle_t * const pxCreatedTask, StackType_t * const puxStackBuffer, const MemoryRegion_t * const xRegions ) /*lint !e971 Unqualified char types are allowed for strings and single characters only. */ { -signed portBASE_TYPE xReturn; -tskTCB * pxNewTCB; +BaseType_t xReturn; +TCB_t * pxNewTCB; configASSERT( pxTaskCode ); configASSERT( ( ( uxPriority & ( ~portPRIVILEGE_BIT ) ) < configMAX_PRIORITIES ) ); @@ -506,11 +506,11 @@ tskTCB * pxNewTCB; if( pxNewTCB != NULL ) { - portSTACK_TYPE *pxTopOfStack; + StackType_t *pxTopOfStack; #if( portUSING_MPU_WRAPPERS == 1 ) /* Should the task be created in privileged mode? */ - portBASE_TYPE xRunPrivileged; + BaseType_t xRunPrivileged; if( ( uxPriority & portPRIVILEGE_BIT ) != 0U ) { xRunPrivileged = pdTRUE; @@ -528,18 +528,18 @@ tskTCB * pxNewTCB; required by the port. */ #if( portSTACK_GROWTH < 0 ) { - pxTopOfStack = pxNewTCB->pxStack + ( usStackDepth - ( unsigned short ) 1 ); - pxTopOfStack = ( portSTACK_TYPE * ) ( ( ( portPOINTER_SIZE_TYPE ) pxTopOfStack ) & ( ( portPOINTER_SIZE_TYPE ) ~portBYTE_ALIGNMENT_MASK ) ); /*lint !e923 MISRA exception. Avoiding casts between pointers and integers is not practical. Size differences accounted for using portPOINTER_SIZE_TYPE type. */ + pxTopOfStack = pxNewTCB->pxStack + ( usStackDepth - ( uint16_t ) 1 ); + pxTopOfStack = ( StackType_t * ) ( ( ( portPOINTER_SIZE_TYPE ) pxTopOfStack ) & ( ( portPOINTER_SIZE_TYPE ) ~portBYTE_ALIGNMENT_MASK ) ); /*lint !e923 MISRA exception. Avoiding casts between pointers and integers is not practical. Size differences accounted for using portPOINTER_SIZE_TYPE type. */ /* Check the alignment of the calculated top of stack is correct. */ - configASSERT( ( ( ( unsigned long ) pxTopOfStack & ( unsigned long ) portBYTE_ALIGNMENT_MASK ) == 0UL ) ); + configASSERT( ( ( ( uint32_t ) pxTopOfStack & ( uint32_t ) portBYTE_ALIGNMENT_MASK ) == 0UL ) ); } #else /* portSTACK_GROWTH */ { pxTopOfStack = pxNewTCB->pxStack; /* Check the alignment of the stack buffer is correct. */ - configASSERT( ( ( ( unsigned long ) pxNewTCB->pxStack & ( unsigned long ) portBYTE_ALIGNMENT_MASK ) == 0UL ) ); + configASSERT( ( ( ( uint32_t ) pxNewTCB->pxStack & ( uint32_t ) portBYTE_ALIGNMENT_MASK ) == 0UL ) ); /* If we want to use stack checking on architectures that use a positive stack growth direction then we also need to store the @@ -570,7 +570,7 @@ tskTCB * pxNewTCB; /* Pass the TCB out - in an anonymous way. The calling function/ task can use this as a handle to delete the task later if required.*/ - *pxCreatedTask = ( xTaskHandle ) pxNewTCB; + *pxCreatedTask = ( TaskHandle_t ) pxNewTCB; } else { @@ -588,7 +588,7 @@ tskTCB * pxNewTCB; the suspended state - make this the current task. */ pxCurrentTCB = pxNewTCB; - if( uxCurrentNumberOfTasks == ( unsigned portBASE_TYPE ) 1 ) + if( uxCurrentNumberOfTasks == ( UBaseType_t ) 1 ) { /* This is the first task to be created so do the preliminary initialisation required. We will not recover if this call @@ -672,9 +672,9 @@ tskTCB * pxNewTCB; #if ( INCLUDE_vTaskDelete == 1 ) - void vTaskDelete( xTaskHandle xTaskToDelete ) + void vTaskDelete( TaskHandle_t xTaskToDelete ) { - tskTCB *pxTCB; + TCB_t *pxTCB; taskENTER_CRITICAL(); { @@ -686,7 +686,7 @@ tskTCB * pxNewTCB; This will stop the task from be scheduled. The idle task will check the termination list and free up any memory allocated by the scheduler for the TCB and stack. */ - if( uxListRemove( &( pxTCB->xGenericListItem ) ) == ( unsigned portBASE_TYPE ) 0 ) + if( uxListRemove( &( pxTCB->xGenericListItem ) ) == ( UBaseType_t ) 0 ) { taskRESET_READY_PRIORITY( pxTCB->uxPriority ); } @@ -750,10 +750,10 @@ tskTCB * pxNewTCB; #if ( INCLUDE_vTaskDelayUntil == 1 ) - void vTaskDelayUntil( portTickType * const pxPreviousWakeTime, const portTickType xTimeIncrement ) + void vTaskDelayUntil( TickType_t * const pxPreviousWakeTime, const TickType_t xTimeIncrement ) { - portTickType xTimeToWake; - portBASE_TYPE xAlreadyYielded, xShouldDelay = pdFALSE; + TickType_t xTimeToWake; + BaseType_t xAlreadyYielded, xShouldDelay = pdFALSE; configASSERT( pxPreviousWakeTime ); configASSERT( ( xTimeIncrement > 0U ) ); @@ -763,7 +763,7 @@ tskTCB * pxNewTCB; { /* Minor optimisation. The tick count cannot change in this block. */ - const portTickType xConstTickCount = xTickCount; + const TickType_t xConstTickCount = xTickCount; /* Generate the tick time at which the task wants to wake. */ xTimeToWake = *pxPreviousWakeTime + xTimeIncrement; @@ -809,7 +809,7 @@ tskTCB * pxNewTCB; /* We must remove ourselves from the ready list before adding ourselves to the blocked list as the same list item is used for both lists. */ - if( uxListRemove( &( pxCurrentTCB->xGenericListItem ) ) == ( unsigned portBASE_TYPE ) 0 ) + if( uxListRemove( &( pxCurrentTCB->xGenericListItem ) ) == ( UBaseType_t ) 0 ) { /* The current task must be in a ready list, so there is no need to check, and the port reset macro can be called @@ -847,14 +847,14 @@ tskTCB * pxNewTCB; #if ( INCLUDE_vTaskDelay == 1 ) - void vTaskDelay( const portTickType xTicksToDelay ) + void vTaskDelay( const TickType_t xTicksToDelay ) { - portTickType xTimeToWake; - signed portBASE_TYPE xAlreadyYielded = pdFALSE; + TickType_t xTimeToWake; + BaseType_t xAlreadyYielded = pdFALSE; /* A delay time of zero just forces a reschedule. */ - if( xTicksToDelay > ( portTickType ) 0U ) + if( xTicksToDelay > ( TickType_t ) 0U ) { configASSERT( uxSchedulerSuspended == 0 ); vTaskSuspendAll(); @@ -876,7 +876,7 @@ tskTCB * pxNewTCB; /* We must remove ourselves from the ready list before adding ourselves to the blocked list as the same list item is used for both lists. */ - if( uxListRemove( &( pxCurrentTCB->xGenericListItem ) ) == ( unsigned portBASE_TYPE ) 0 ) + if( uxListRemove( &( pxCurrentTCB->xGenericListItem ) ) == ( UBaseType_t ) 0 ) { /* The current task must be in a ready list, so there is no need to check, and the port reset macro can be called @@ -913,11 +913,11 @@ tskTCB * pxNewTCB; #if ( INCLUDE_eTaskGetState == 1 ) - eTaskState eTaskGetState( xTaskHandle xTask ) + eTaskState eTaskGetState( TaskHandle_t xTask ) { eTaskState eReturn; - xList *pxStateList; - const tskTCB * const pxTCB = ( tskTCB * ) xTask; + List_t *pxStateList; + const TCB_t * const pxTCB = ( TCB_t * ) xTask; configASSERT( pxTCB ); @@ -930,7 +930,7 @@ tskTCB * pxNewTCB; { taskENTER_CRITICAL(); { - pxStateList = ( xList * ) listLIST_ITEM_CONTAINER( &( pxTCB->xGenericListItem ) ); + pxStateList = ( List_t * ) listLIST_ITEM_CONTAINER( &( pxTCB->xGenericListItem ) ); } taskEXIT_CRITICAL(); @@ -983,10 +983,10 @@ tskTCB * pxNewTCB; #if ( INCLUDE_uxTaskPriorityGet == 1 ) - unsigned portBASE_TYPE uxTaskPriorityGet( xTaskHandle xTask ) + UBaseType_t uxTaskPriorityGet( TaskHandle_t xTask ) { - tskTCB *pxTCB; - unsigned portBASE_TYPE uxReturn; + TCB_t *pxTCB; + UBaseType_t uxReturn; taskENTER_CRITICAL(); { @@ -1005,18 +1005,18 @@ tskTCB * pxNewTCB; #if ( INCLUDE_vTaskPrioritySet == 1 ) - void vTaskPrioritySet( xTaskHandle xTask, unsigned portBASE_TYPE uxNewPriority ) + void vTaskPrioritySet( TaskHandle_t xTask, UBaseType_t uxNewPriority ) { - tskTCB *pxTCB; - unsigned portBASE_TYPE uxCurrentBasePriority, uxPriorityUsedOnEntry; - portBASE_TYPE xYieldRequired = pdFALSE; + TCB_t *pxTCB; + UBaseType_t uxCurrentBasePriority, uxPriorityUsedOnEntry; + BaseType_t xYieldRequired = pdFALSE; configASSERT( ( uxNewPriority < configMAX_PRIORITIES ) ); /* Ensure the new priority is valid. */ - if( uxNewPriority >= ( unsigned portBASE_TYPE ) configMAX_PRIORITIES ) + if( uxNewPriority >= ( UBaseType_t ) configMAX_PRIORITIES ) { - uxNewPriority = ( unsigned portBASE_TYPE ) configMAX_PRIORITIES - ( unsigned portBASE_TYPE ) 1U; + uxNewPriority = ( UBaseType_t ) configMAX_PRIORITIES - ( UBaseType_t ) 1U; } else { @@ -1113,7 +1113,7 @@ tskTCB * pxNewTCB; being used for anything else. */ if( ( listGET_LIST_ITEM_VALUE( &( pxTCB->xEventListItem ) ) & taskEVENT_LIST_ITEM_VALUE_IN_USE ) == 0UL ) { - listSET_LIST_ITEM_VALUE( &( pxTCB->xEventListItem ), ( ( portTickType ) configMAX_PRIORITIES - ( portTickType ) uxNewPriority ) ); /*lint !e961 MISRA exception as the casts are only redundant for some ports. */ + listSET_LIST_ITEM_VALUE( &( pxTCB->xEventListItem ), ( ( TickType_t ) configMAX_PRIORITIES - ( TickType_t ) uxNewPriority ) ); /*lint !e961 MISRA exception as the casts are only redundant for some ports. */ } else { @@ -1129,7 +1129,7 @@ tskTCB * pxNewTCB; /* The task is currently in its ready list - remove before adding it to it's new ready list. As we are in a critical section we can do this even if the scheduler is suspended. */ - if( uxListRemove( &( pxTCB->xGenericListItem ) ) == ( unsigned portBASE_TYPE ) 0 ) + if( uxListRemove( &( pxTCB->xGenericListItem ) ) == ( UBaseType_t ) 0 ) { /* It is known that the task is in its ready list so there is no need to check again and the port level @@ -1169,9 +1169,9 @@ tskTCB * pxNewTCB; #if ( INCLUDE_vTaskSuspend == 1 ) - void vTaskSuspend( xTaskHandle xTaskToSuspend ) + void vTaskSuspend( TaskHandle_t xTaskToSuspend ) { - tskTCB *pxTCB; + TCB_t *pxTCB; taskENTER_CRITICAL(); { @@ -1183,7 +1183,7 @@ tskTCB * pxNewTCB; /* Remove task from the ready/delayed list and place in the suspended list. */ - if( uxListRemove( &( pxTCB->xGenericListItem ) ) == ( unsigned portBASE_TYPE ) 0 ) + if( uxListRemove( &( pxTCB->xGenericListItem ) ) == ( UBaseType_t ) 0 ) { taskRESET_READY_PRIORITY( pxTCB->uxPriority ); } @@ -1254,10 +1254,10 @@ tskTCB * pxNewTCB; #if ( INCLUDE_vTaskSuspend == 1 ) - signed portBASE_TYPE xTaskIsTaskSuspended( const xTaskHandle xTask ) + BaseType_t xTaskIsTaskSuspended( const TaskHandle_t xTask ) { - signed portBASE_TYPE xReturn = pdFALSE; - const tskTCB * const pxTCB = ( tskTCB * ) xTask; + BaseType_t xReturn = pdFALSE; + const TCB_t * const pxTCB = ( TCB_t * ) xTask; /* It does not make sense to check if the calling task is suspended. */ configASSERT( xTask ); @@ -1300,9 +1300,9 @@ tskTCB * pxNewTCB; #if ( INCLUDE_vTaskSuspend == 1 ) - void vTaskResume( xTaskHandle xTaskToResume ) + void vTaskResume( TaskHandle_t xTaskToResume ) { - tskTCB * const pxTCB = ( tskTCB * ) xTaskToResume; + TCB_t * const pxTCB = ( TCB_t * ) xTaskToResume; /* It does not make sense to resume the calling task. */ configASSERT( xTaskToResume ); @@ -1354,11 +1354,11 @@ tskTCB * pxNewTCB; #if ( ( INCLUDE_xTaskResumeFromISR == 1 ) && ( INCLUDE_vTaskSuspend == 1 ) ) - portBASE_TYPE xTaskResumeFromISR( xTaskHandle xTaskToResume ) + BaseType_t xTaskResumeFromISR( TaskHandle_t xTaskToResume ) { - portBASE_TYPE xYieldRequired = pdFALSE; - tskTCB * const pxTCB = ( tskTCB * ) xTaskToResume; - unsigned portBASE_TYPE uxSavedInterruptStatus; + BaseType_t xYieldRequired = pdFALSE; + TCB_t * const pxTCB = ( TCB_t * ) xTaskToResume; + UBaseType_t uxSavedInterruptStatus; configASSERT( xTaskToResume ); @@ -1386,7 +1386,7 @@ tskTCB * pxNewTCB; { traceTASK_RESUME_FROM_ISR( pxTCB ); - if( uxSchedulerSuspended == ( unsigned portBASE_TYPE ) pdFALSE ) + if( uxSchedulerSuspended == ( UBaseType_t ) pdFALSE ) { if( pxTCB->uxPriority >= pxCurrentTCB->uxPriority ) { @@ -1423,7 +1423,7 @@ tskTCB * pxNewTCB; void vTaskStartScheduler( void ) { -portBASE_TYPE xReturn; +BaseType_t xReturn; /* Add the idle task at the lowest priority. */ #if ( INCLUDE_xTaskGetIdleTaskHandle == 1 ) @@ -1470,7 +1470,7 @@ portBASE_TYPE xReturn; #endif /* configUSE_NEWLIB_REENTRANT */ xSchedulerRunning = pdTRUE; - xTickCount = ( portTickType ) 0U; + xTickCount = ( TickType_t ) 0U; /* If configGENERATE_RUN_TIME_STATS is defined then the following macro must be defined to configure the timer/counter used to generate @@ -1513,7 +1513,7 @@ void vTaskEndScheduler( void ) void vTaskSuspendAll( void ) { /* A critical section is not required as the variable is of type - portBASE_TYPE. Please read Richard Barry's reply in the following link to a + BaseType_t. Please read Richard Barry's reply in the following link to a post in the FreeRTOS support forum before reporting this as a bug! - http://goo.gl/wu4acr */ ++uxSchedulerSuspended; @@ -1522,9 +1522,9 @@ void vTaskSuspendAll( void ) #if ( configUSE_TICKLESS_IDLE != 0 ) - static portTickType prvGetExpectedIdleTime( void ) + static TickType_t prvGetExpectedIdleTime( void ) { - portTickType xReturn; + TickType_t xReturn; if( pxCurrentTCB->uxPriority > tskIDLE_PRIORITY ) { @@ -1548,10 +1548,10 @@ void vTaskSuspendAll( void ) #endif /* configUSE_TICKLESS_IDLE */ /*----------------------------------------------------------*/ -signed portBASE_TYPE xTaskResumeAll( void ) +BaseType_t xTaskResumeAll( void ) { -tskTCB *pxTCB; -portBASE_TYPE xAlreadyYielded = pdFALSE; +TCB_t *pxTCB; +BaseType_t xAlreadyYielded = pdFALSE; /* If uxSchedulerSuspended is zero then this function does not match a previous call to vTaskSuspendAll(). */ @@ -1566,15 +1566,15 @@ portBASE_TYPE xAlreadyYielded = pdFALSE; { --uxSchedulerSuspended; - if( uxSchedulerSuspended == ( unsigned portBASE_TYPE ) pdFALSE ) + if( uxSchedulerSuspended == ( UBaseType_t ) pdFALSE ) { - if( uxCurrentNumberOfTasks > ( unsigned portBASE_TYPE ) 0U ) + if( uxCurrentNumberOfTasks > ( UBaseType_t ) 0U ) { /* Move any readied tasks from the pending list into the appropriate ready list. */ while( listLIST_IS_EMPTY( &xPendingReadyList ) == pdFALSE ) { - pxTCB = ( tskTCB * ) listGET_OWNER_OF_HEAD_ENTRY( ( &xPendingReadyList ) ); + pxTCB = ( TCB_t * ) listGET_OWNER_OF_HEAD_ENTRY( ( &xPendingReadyList ) ); ( void ) uxListRemove( &( pxTCB->xEventListItem ) ); ( void ) uxListRemove( &( pxTCB->xGenericListItem ) ); prvAddTaskToReadyList( pxTCB ); @@ -1595,9 +1595,9 @@ portBASE_TYPE xAlreadyYielded = pdFALSE; they should be processed now. This ensures the tick count does not slip, and that any delayed tasks are resumed at the correct time. */ - if( uxPendedTicks > ( unsigned portBASE_TYPE ) 0U ) + if( uxPendedTicks > ( UBaseType_t ) 0U ) { - while( uxPendedTicks > ( unsigned portBASE_TYPE ) 0U ) + while( uxPendedTicks > ( UBaseType_t ) 0U ) { if( xTaskIncrementTick() != pdFALSE ) { @@ -1641,9 +1641,9 @@ portBASE_TYPE xAlreadyYielded = pdFALSE; } /*-----------------------------------------------------------*/ -portTickType xTaskGetTickCount( void ) +TickType_t xTaskGetTickCount( void ) { -portTickType xTicks; +TickType_t xTicks; /* Critical section required if running on a 16 bit processor. */ taskENTER_CRITICAL(); @@ -1656,10 +1656,10 @@ portTickType xTicks; } /*-----------------------------------------------------------*/ -portTickType xTaskGetTickCountFromISR( void ) +TickType_t xTaskGetTickCountFromISR( void ) { -portTickType xReturn; -unsigned portBASE_TYPE uxSavedInterruptStatus; +TickType_t xReturn; +UBaseType_t uxSavedInterruptStatus; /* RTOS ports that support interrupt nesting have the concept of a maximum system call (or maximum API call) interrupt priority. Interrupts that are @@ -1685,19 +1685,19 @@ unsigned portBASE_TYPE uxSavedInterruptStatus; } /*-----------------------------------------------------------*/ -unsigned portBASE_TYPE uxTaskGetNumberOfTasks( void ) +UBaseType_t uxTaskGetNumberOfTasks( void ) { /* A critical section is not required because the variables are of type - portBASE_TYPE. */ + BaseType_t. */ return uxCurrentNumberOfTasks; } /*-----------------------------------------------------------*/ #if ( INCLUDE_pcTaskGetTaskName == 1 ) - char *pcTaskGetTaskName( xTaskHandle xTaskToQuery ) + char *pcTaskGetTaskName( TaskHandle_t xTaskToQuery ) { - tskTCB *pxTCB; + TCB_t *pxTCB; /* If null is passed in here then the name of the calling task is being queried. */ pxTCB = prvGetTCBFromHandle( xTaskToQuery ); @@ -1710,32 +1710,32 @@ unsigned portBASE_TYPE uxTaskGetNumberOfTasks( void ) #if ( configUSE_TRACE_FACILITY == 1 ) - unsigned portBASE_TYPE uxTaskGetSystemState( xTaskStatusType * const pxTaskStatusArray, const unsigned portBASE_TYPE uxArraySize, unsigned long * const pulTotalRunTime ) + UBaseType_t uxTaskGetSystemState( TaskStatus_t * const pxTaskStatusArray, const UBaseType_t uxArraySize, uint32_t * const pulTotalRunTime ) { - unsigned portBASE_TYPE uxTask = 0, uxQueue = configMAX_PRIORITIES; + UBaseType_t uxTask = 0, uxQueue = configMAX_PRIORITIES; vTaskSuspendAll(); { /* Is there a space in the array for each task in the system? */ if( uxArraySize >= uxCurrentNumberOfTasks ) { - /* Fill in an xTaskStatusType structure with information on each + /* Fill in an TaskStatus_t structure with information on each task in the Ready state. */ do { uxQueue--; uxTask += prvListTaskWithinSingleList( &( pxTaskStatusArray[ uxTask ] ), &( pxReadyTasksLists[ uxQueue ] ), eReady ); - } while( uxQueue > ( unsigned portBASE_TYPE ) tskIDLE_PRIORITY ); /*lint !e961 MISRA exception as the casts are only redundant for some ports. */ + } while( uxQueue > ( UBaseType_t ) tskIDLE_PRIORITY ); /*lint !e961 MISRA exception as the casts are only redundant for some ports. */ - /* Fill in an xTaskStatusType structure with information on each + /* Fill in an TaskStatus_t structure with information on each task in the Blocked state. */ - uxTask += prvListTaskWithinSingleList( &( pxTaskStatusArray[ uxTask ] ), ( xList * ) pxDelayedTaskList, eBlocked ); - uxTask += prvListTaskWithinSingleList( &( pxTaskStatusArray[ uxTask ] ), ( xList * ) pxOverflowDelayedTaskList, eBlocked ); + uxTask += prvListTaskWithinSingleList( &( pxTaskStatusArray[ uxTask ] ), ( List_t * ) pxDelayedTaskList, eBlocked ); + uxTask += prvListTaskWithinSingleList( &( pxTaskStatusArray[ uxTask ] ), ( List_t * ) pxOverflowDelayedTaskList, eBlocked ); #if( INCLUDE_vTaskDelete == 1 ) { - /* Fill in an xTaskStatusType structure with information on + /* Fill in an TaskStatus_t structure with information on each task that has been deleted but not yet cleaned up. */ uxTask += prvListTaskWithinSingleList( &( pxTaskStatusArray[ uxTask ] ), &xTasksWaitingTermination, eDeleted ); } @@ -1743,7 +1743,7 @@ unsigned portBASE_TYPE uxTaskGetNumberOfTasks( void ) #if ( INCLUDE_vTaskSuspend == 1 ) { - /* Fill in an xTaskStatusType structure with information on + /* Fill in an TaskStatus_t structure with information on each task in the Suspended state. */ uxTask += prvListTaskWithinSingleList( &( pxTaskStatusArray[ uxTask ] ), &xSuspendedTaskList, eSuspended ); } @@ -1784,7 +1784,7 @@ unsigned portBASE_TYPE uxTaskGetNumberOfTasks( void ) #if ( INCLUDE_xTaskGetIdleTaskHandle == 1 ) - xTaskHandle xTaskGetIdleTaskHandle( void ) + TaskHandle_t xTaskGetIdleTaskHandle( void ) { /* If xTaskGetIdleTaskHandle() is called before the scheduler has been started, then xIdleTaskHandle will be NULL. */ @@ -1801,7 +1801,7 @@ implementations require configUSE_TICKLESS_IDLE to be set to a value other than 1. */ #if ( configUSE_TICKLESS_IDLE != 0 ) - void vTaskStepTick( const portTickType xTicksToJump ) + void vTaskStepTick( const TickType_t 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 @@ -1814,17 +1814,17 @@ implementations require configUSE_TICKLESS_IDLE to be set to a value other than #endif /* configUSE_TICKLESS_IDLE */ /*----------------------------------------------------------*/ -portBASE_TYPE xTaskIncrementTick( void ) +BaseType_t xTaskIncrementTick( void ) { -tskTCB * pxTCB; -portTickType xItemValue; -portBASE_TYPE xSwitchRequired = pdFALSE; +TCB_t * pxTCB; +TickType_t xItemValue; +BaseType_t xSwitchRequired = pdFALSE; /* Called by the portable layer each time a tick interrupt occurs. Increments the tick then checks to see if the new tick value will cause any tasks to be unblocked. */ traceTASK_INCREMENT_TICK( xTickCount ); - if( uxSchedulerSuspended == ( unsigned portBASE_TYPE ) pdFALSE ) + if( uxSchedulerSuspended == ( UBaseType_t ) pdFALSE ) { /* Increment the RTOS tick, switching the delayed and overflowed delayed lists if it wraps to 0. */ @@ -1833,9 +1833,9 @@ portBASE_TYPE xSwitchRequired = pdFALSE; { /* Minor optimisation. The tick count cannot change in this block. */ - const portTickType xConstTickCount = xTickCount; + const TickType_t xConstTickCount = xTickCount; - if( xConstTickCount == ( portTickType ) 0U ) + if( xConstTickCount == ( TickType_t ) 0U ) { taskSWITCH_DELAYED_LISTS(); } @@ -1868,7 +1868,7 @@ portBASE_TYPE xSwitchRequired = pdFALSE; item at the head of the delayed list. This is the time at which the task at the head of the delayed list must be removed from the Blocked state. */ - pxTCB = ( tskTCB * ) listGET_OWNER_OF_HEAD_ENTRY( pxDelayedTaskList ); + pxTCB = ( TCB_t * ) listGET_OWNER_OF_HEAD_ENTRY( pxDelayedTaskList ); xItemValue = listGET_LIST_ITEM_VALUE( &( pxTCB->xGenericListItem ) ); if( xConstTickCount < xItemValue ) @@ -1932,7 +1932,7 @@ portBASE_TYPE xSwitchRequired = pdFALSE; writer has not explicitly turned time slicing off. */ #if ( ( configUSE_PREEMPTION == 1 ) && ( configUSE_TIME_SLICING == 1 ) ) { - if( listCURRENT_LIST_LENGTH( &( pxReadyTasksLists[ pxCurrentTCB->uxPriority ] ) ) > ( unsigned portBASE_TYPE ) 1 ) + if( listCURRENT_LIST_LENGTH( &( pxReadyTasksLists[ pxCurrentTCB->uxPriority ] ) ) > ( UBaseType_t ) 1 ) { xSwitchRequired = pdTRUE; } @@ -1947,7 +1947,7 @@ portBASE_TYPE xSwitchRequired = pdFALSE; { /* Guard against the tick hook being called when the pended tick count is being unwound (when the scheduler is being unlocked). */ - if( uxPendedTicks == ( unsigned portBASE_TYPE ) 0U ) + if( uxPendedTicks == ( UBaseType_t ) 0U ) { vApplicationTickHook(); } @@ -1990,19 +1990,19 @@ portBASE_TYPE xSwitchRequired = pdFALSE; #if ( configUSE_APPLICATION_TASK_TAG == 1 ) - void vTaskSetApplicationTaskTag( xTaskHandle xTask, pdTASK_HOOK_CODE pxHookFunction ) + void vTaskSetApplicationTaskTag( TaskHandle_t xTask, pdTASK_HOOK_CODE pxHookFunction ) { - tskTCB *xTCB; + TCB_t *xTCB; /* If xTask is NULL then it is the task hook of the calling task that is getting set. */ if( xTask == NULL ) { - xTCB = ( tskTCB * ) pxCurrentTCB; + xTCB = ( TCB_t * ) pxCurrentTCB; } else { - xTCB = ( tskTCB * ) xTask; + xTCB = ( TCB_t * ) xTask; } /* Save the hook function in the TCB. A critical section is required as @@ -2017,19 +2017,19 @@ portBASE_TYPE xSwitchRequired = pdFALSE; #if ( configUSE_APPLICATION_TASK_TAG == 1 ) - pdTASK_HOOK_CODE xTaskGetApplicationTaskTag( xTaskHandle xTask ) + pdTASK_HOOK_CODE xTaskGetApplicationTaskTag( TaskHandle_t xTask ) { - tskTCB *xTCB; + TCB_t *xTCB; pdTASK_HOOK_CODE xReturn; /* If xTask is NULL then we are setting our own task hook. */ if( xTask == NULL ) { - xTCB = ( tskTCB * ) pxCurrentTCB; + xTCB = ( TCB_t * ) pxCurrentTCB; } else { - xTCB = ( tskTCB * ) xTask; + xTCB = ( TCB_t * ) xTask; } /* Save the hook function in the TCB. A critical section is required as @@ -2048,19 +2048,19 @@ portBASE_TYPE xSwitchRequired = pdFALSE; #if ( configUSE_APPLICATION_TASK_TAG == 1 ) - portBASE_TYPE xTaskCallApplicationTaskHook( xTaskHandle xTask, void *pvParameter ) + BaseType_t xTaskCallApplicationTaskHook( TaskHandle_t xTask, void *pvParameter ) { - tskTCB *xTCB; - portBASE_TYPE xReturn; + TCB_t *xTCB; + BaseType_t xReturn; /* If xTask is NULL then we are calling our own task hook. */ if( xTask == NULL ) { - xTCB = ( tskTCB * ) pxCurrentTCB; + xTCB = ( TCB_t * ) pxCurrentTCB; } else { - xTCB = ( tskTCB * ) xTask; + xTCB = ( TCB_t * ) xTask; } if( xTCB->pxTaskTag != NULL ) @@ -2080,7 +2080,7 @@ portBASE_TYPE xSwitchRequired = pdFALSE; void vTaskSwitchContext( void ) { - if( uxSchedulerSuspended != ( unsigned portBASE_TYPE ) pdFALSE ) + if( uxSchedulerSuspended != ( UBaseType_t ) pdFALSE ) { /* The scheduler is currently suspended - do not allow a context switch. */ @@ -2136,9 +2136,9 @@ void vTaskSwitchContext( void ) } /*-----------------------------------------------------------*/ -void vTaskPlaceOnEventList( xList * const pxEventList, const portTickType xTicksToWait ) +void vTaskPlaceOnEventList( List_t * const pxEventList, const TickType_t xTicksToWait ) { -portTickType xTimeToWake; +TickType_t xTimeToWake; configASSERT( pxEventList ); @@ -2153,7 +2153,7 @@ portTickType xTimeToWake; /* We must remove ourselves from the ready list before adding ourselves to the blocked list as the same list item is used for both lists. We have exclusive access to the ready lists as the scheduler is locked. */ - if( uxListRemove( &( pxCurrentTCB->xGenericListItem ) ) == ( unsigned portBASE_TYPE ) 0 ) + if( uxListRemove( &( pxCurrentTCB->xGenericListItem ) ) == ( UBaseType_t ) 0 ) { /* The current task must be in a ready list, so there is no need to check, and the port reset macro can be called directly. */ @@ -2192,9 +2192,9 @@ portTickType xTimeToWake; } /*-----------------------------------------------------------*/ -void vTaskPlaceOnUnorderedEventList( xList * pxEventList, const portTickType xItemValue, const portTickType xTicksToWait ) +void vTaskPlaceOnUnorderedEventList( List_t * pxEventList, const TickType_t xItemValue, const TickType_t xTicksToWait ) { -portTickType xTimeToWake; +TickType_t xTimeToWake; configASSERT( pxEventList ); @@ -2211,7 +2211,7 @@ portTickType xTimeToWake; /* The task must be removed from the ready list before it is added to the blocked list. Exclusive access can be assured to the ready list as the scheduler is locked. */ - if( uxListRemove( &( pxCurrentTCB->xGenericListItem ) ) == ( unsigned portBASE_TYPE ) 0 ) + if( uxListRemove( &( pxCurrentTCB->xGenericListItem ) ) == ( UBaseType_t ) 0 ) { /* The current task must be in a ready list, so there is no need to check, and the port reset macro can be called directly. */ @@ -2252,9 +2252,9 @@ portTickType xTimeToWake; #if configUSE_TIMERS == 1 - void vTaskPlaceOnEventListRestricted( xList * const pxEventList, const portTickType xTicksToWait ) + void vTaskPlaceOnEventListRestricted( List_t * const pxEventList, const TickType_t xTicksToWait ) { - portTickType xTimeToWake; + TickType_t xTimeToWake; configASSERT( pxEventList ); @@ -2273,7 +2273,7 @@ portTickType xTimeToWake; /* We must remove this task from the ready list before adding it to the blocked list as the same list item is used for both lists. This function is called form a critical section. */ - if( uxListRemove( &( pxCurrentTCB->xGenericListItem ) ) == ( unsigned portBASE_TYPE ) 0 ) + if( uxListRemove( &( pxCurrentTCB->xGenericListItem ) ) == ( UBaseType_t ) 0 ) { /* The current task must be in a ready list, so there is no need to check, and the port reset macro can be called directly. */ @@ -2295,10 +2295,10 @@ portTickType xTimeToWake; #endif /* configUSE_TIMERS */ /*-----------------------------------------------------------*/ -signed portBASE_TYPE xTaskRemoveFromEventList( const xList * const pxEventList ) +BaseType_t xTaskRemoveFromEventList( const List_t * const pxEventList ) { -tskTCB *pxUnblockedTCB; -portBASE_TYPE xReturn; +TCB_t *pxUnblockedTCB; +BaseType_t xReturn; /* THIS FUNCTION MUST BE CALLED WITH INTERRUPTS DISABLED OR THE SCHEDULER SUSPENDED. It can also be called from within an ISR. */ @@ -2313,11 +2313,11 @@ portBASE_TYPE xReturn; This function assumes that a check has already been made to ensure that pxEventList is not empty. */ - pxUnblockedTCB = ( tskTCB * ) listGET_OWNER_OF_HEAD_ENTRY( pxEventList ); + pxUnblockedTCB = ( TCB_t * ) listGET_OWNER_OF_HEAD_ENTRY( pxEventList ); configASSERT( pxUnblockedTCB ); ( void ) uxListRemove( &( pxUnblockedTCB->xEventListItem ) ); - if( uxSchedulerSuspended == ( unsigned portBASE_TYPE ) pdFALSE ) + if( uxSchedulerSuspended == ( UBaseType_t ) pdFALSE ) { ( void ) uxListRemove( &( pxUnblockedTCB->xGenericListItem ) ); prvAddTaskToReadyList( pxUnblockedTCB ); @@ -2350,10 +2350,10 @@ portBASE_TYPE xReturn; } /*-----------------------------------------------------------*/ -signed portBASE_TYPE xTaskRemoveFromUnorderedEventList( xListItem * pxEventListItem, const portTickType xItemValue ) +BaseType_t xTaskRemoveFromUnorderedEventList( ListItem_t * pxEventListItem, const TickType_t xItemValue ) { -tskTCB *pxUnblockedTCB; -portBASE_TYPE xReturn; +TCB_t *pxUnblockedTCB; +BaseType_t xReturn; /* THIS FUNCTION MUST BE CALLED WITH INTERRUPTS DISABLED OR THE SCHEDULER SUSPENDED. It can also be called from within an ISR. */ @@ -2363,11 +2363,11 @@ portBASE_TYPE xReturn; /* Remove the TCB from the delayed list, and add it to the ready list. */ - pxUnblockedTCB = ( tskTCB * ) listGET_LIST_ITEM_OWNER( pxEventListItem ); + pxUnblockedTCB = ( TCB_t * ) listGET_LIST_ITEM_OWNER( pxEventListItem ); configASSERT( pxUnblockedTCB ); ( void ) uxListRemove( pxEventListItem ); - if( uxSchedulerSuspended == ( unsigned portBASE_TYPE ) pdFALSE ) + if( uxSchedulerSuspended == ( UBaseType_t ) pdFALSE ) { ( void ) uxListRemove( &( pxUnblockedTCB->xGenericListItem ) ); prvAddTaskToReadyList( pxUnblockedTCB ); @@ -2400,7 +2400,7 @@ portBASE_TYPE xReturn; } /*-----------------------------------------------------------*/ -void vTaskSetTimeOutState( xTimeOutType * const pxTimeOut ) +void vTaskSetTimeOutState( TimeOut_t * const pxTimeOut ) { configASSERT( pxTimeOut ); pxTimeOut->xOverflowCount = xNumOfOverflows; @@ -2408,9 +2408,9 @@ void vTaskSetTimeOutState( xTimeOutType * const pxTimeOut ) } /*-----------------------------------------------------------*/ -portBASE_TYPE xTaskCheckForTimeOut( xTimeOutType * const pxTimeOut, portTickType * const pxTicksToWait ) +BaseType_t xTaskCheckForTimeOut( TimeOut_t * const pxTimeOut, TickType_t * const pxTicksToWait ) { -portBASE_TYPE xReturn; +BaseType_t xReturn; configASSERT( pxTimeOut ); configASSERT( pxTicksToWait ); @@ -2418,7 +2418,7 @@ portBASE_TYPE xReturn; taskENTER_CRITICAL(); { /* Minor optimisation. The tick count cannot change in this block. */ - const portTickType xConstTickCount = xTickCount; + const TickType_t xConstTickCount = xTickCount; #if ( INCLUDE_vTaskSuspend == 1 ) /* If INCLUDE_vTaskSuspend is set to 1 and the block time specified is @@ -2465,14 +2465,14 @@ void vTaskMissedYield( void ) #if ( configUSE_TRACE_FACILITY == 1 ) - unsigned portBASE_TYPE uxTaskGetTaskNumber( xTaskHandle xTask ) + UBaseType_t uxTaskGetTaskNumber( TaskHandle_t xTask ) { - unsigned portBASE_TYPE uxReturn; - tskTCB *pxTCB; + UBaseType_t uxReturn; + TCB_t *pxTCB; if( xTask != NULL ) { - pxTCB = ( tskTCB * ) xTask; + pxTCB = ( TCB_t * ) xTask; uxReturn = pxTCB->uxTaskNumber; } else @@ -2488,13 +2488,13 @@ void vTaskMissedYield( void ) #if ( configUSE_TRACE_FACILITY == 1 ) - void vTaskSetTaskNumber( xTaskHandle xTask, const unsigned portBASE_TYPE uxHandle ) + void vTaskSetTaskNumber( TaskHandle_t xTask, const UBaseType_t uxHandle ) { - tskTCB *pxTCB; + TCB_t *pxTCB; if( xTask != NULL ) { - pxTCB = ( tskTCB * ) xTask; + pxTCB = ( TCB_t * ) xTask; pxTCB->uxTaskNumber = uxHandle; } } @@ -2543,7 +2543,7 @@ static portTASK_FUNCTION( prvIdleTask, pvParameters ) the list, and an occasional incorrect value will not matter. If the ready list at the idle priority contains more than one task then a task other than the idle task is ready to execute. */ - if( listCURRENT_LIST_LENGTH( &( pxReadyTasksLists[ tskIDLE_PRIORITY ] ) ) > ( unsigned portBASE_TYPE ) 1 ) + if( listCURRENT_LIST_LENGTH( &( pxReadyTasksLists[ tskIDLE_PRIORITY ] ) ) > ( UBaseType_t ) 1 ) { taskYIELD(); } @@ -2573,7 +2573,7 @@ static portTASK_FUNCTION( prvIdleTask, pvParameters ) configUSE_TICKLESS_IDLE to be set to a value other than 1. */ #if ( configUSE_TICKLESS_IDLE != 0 ) { - portTickType xExpectedIdleTime; + TickType_t xExpectedIdleTime; /* It is not desirable to suspend then resume the scheduler on each iteration of the idle task. Therefore, a preliminary @@ -2636,7 +2636,7 @@ static portTASK_FUNCTION( prvIdleTask, pvParameters ) #if configUSE_TIMERS == 0 { /* The idle task exists in addition to the application tasks. */ - const unsigned portBASE_TYPE uxNonApplicationTasks = 1; + const UBaseType_t uxNonApplicationTasks = 1; /* If timers are not being used and all the tasks are in the suspended list (which might mean they have an infinite block @@ -2659,12 +2659,12 @@ static portTASK_FUNCTION( prvIdleTask, pvParameters ) #endif /* configUSE_TICKLESS_IDLE */ /*-----------------------------------------------------------*/ -static void prvInitialiseTCBVariables( tskTCB * const pxTCB, const char * const pcName, unsigned portBASE_TYPE uxPriority, const xMemoryRegion * const xRegions, const unsigned short usStackDepth ) /*lint !e971 Unqualified char types are allowed for strings and single characters only. */ +static void prvInitialiseTCBVariables( TCB_t * const pxTCB, const char * const pcName, UBaseType_t uxPriority, const MemoryRegion_t * const xRegions, const uint16_t usStackDepth ) /*lint !e971 Unqualified char types are allowed for strings and single characters only. */ { -unsigned portBASE_TYPE x; +UBaseType_t x; /* Store the task name in the TCB. */ - for( x = ( unsigned portBASE_TYPE ) 0; x < ( unsigned portBASE_TYPE ) configMAX_TASK_NAME_LEN; x++ ) + for( x = ( UBaseType_t ) 0; x < ( UBaseType_t ) configMAX_TASK_NAME_LEN; x++ ) { pxTCB->pcTaskName[ x ] = pcName[ x ]; @@ -2687,9 +2687,9 @@ unsigned portBASE_TYPE x; /* This is used as an array index so must ensure it's not too large. First remove the privilege bit if one is present. */ - if( uxPriority >= ( unsigned portBASE_TYPE ) configMAX_PRIORITIES ) + if( uxPriority >= ( UBaseType_t ) configMAX_PRIORITIES ) { - uxPriority = ( unsigned portBASE_TYPE ) configMAX_PRIORITIES - ( unsigned portBASE_TYPE ) 1U; + uxPriority = ( UBaseType_t ) configMAX_PRIORITIES - ( UBaseType_t ) 1U; } else { @@ -2706,17 +2706,17 @@ unsigned portBASE_TYPE x; vListInitialiseItem( &( pxTCB->xGenericListItem ) ); vListInitialiseItem( &( pxTCB->xEventListItem ) ); - /* Set the pxTCB as a link back from the xListItem. This is so we can get + /* Set the pxTCB as a link back from the ListItem_t. This is so we can get back to the containing TCB from a generic item in a list. */ listSET_LIST_ITEM_OWNER( &( pxTCB->xGenericListItem ), pxTCB ); /* Event lists are always in priority order. */ - listSET_LIST_ITEM_VALUE( &( pxTCB->xEventListItem ), ( portTickType ) configMAX_PRIORITIES - ( portTickType ) uxPriority ); /*lint !e961 MISRA exception as the casts are only redundant for some ports. */ + listSET_LIST_ITEM_VALUE( &( pxTCB->xEventListItem ), ( TickType_t ) configMAX_PRIORITIES - ( TickType_t ) uxPriority ); /*lint !e961 MISRA exception as the casts are only redundant for some ports. */ listSET_LIST_ITEM_OWNER( &( pxTCB->xEventListItem ), pxTCB ); #if ( portCRITICAL_NESTING_IN_TCB == 1 ) { - pxTCB->uxCriticalNesting = ( unsigned portBASE_TYPE ) 0U; + pxTCB->uxCriticalNesting = ( UBaseType_t ) 0U; } #endif /* portCRITICAL_NESTING_IN_TCB */ @@ -2754,9 +2754,9 @@ unsigned portBASE_TYPE x; #if ( portUSING_MPU_WRAPPERS == 1 ) - void vTaskAllocateMPURegions( xTaskHandle xTaskToModify, const xMemoryRegion * const xRegions ) + void vTaskAllocateMPURegions( TaskHandle_t xTaskToModify, const MemoryRegion_t * const xRegions ) { - tskTCB *pxTCB; + TCB_t *pxTCB; /* If null is passed in here then we are deleting ourselves. */ pxTCB = prvGetTCBFromHandle( xTaskToModify ); @@ -2769,9 +2769,9 @@ unsigned portBASE_TYPE x; static void prvInitialiseTaskLists( void ) { -unsigned portBASE_TYPE uxPriority; +UBaseType_t uxPriority; - for( uxPriority = ( unsigned portBASE_TYPE ) 0U; uxPriority < ( unsigned portBASE_TYPE ) configMAX_PRIORITIES; uxPriority++ ) + for( uxPriority = ( UBaseType_t ) 0U; uxPriority < ( UBaseType_t ) configMAX_PRIORITIES; uxPriority++ ) { vListInitialise( &( pxReadyTasksLists[ uxPriority ] ) ); } @@ -2803,11 +2803,11 @@ static void prvCheckTasksWaitingTermination( void ) { #if ( INCLUDE_vTaskDelete == 1 ) { - portBASE_TYPE xListIsEmpty; + BaseType_t xListIsEmpty; /* ucTasksDeleted is used to prevent vTaskSuspendAll() being called too often in the idle task. */ - while( uxTasksDeleted > ( unsigned portBASE_TYPE ) 0U ) + while( uxTasksDeleted > ( UBaseType_t ) 0U ) { vTaskSuspendAll(); xListIsEmpty = listLIST_IS_EMPTY( &xTasksWaitingTermination ); @@ -2815,11 +2815,11 @@ static void prvCheckTasksWaitingTermination( void ) if( xListIsEmpty == pdFALSE ) { - tskTCB *pxTCB; + TCB_t *pxTCB; taskENTER_CRITICAL(); { - pxTCB = ( tskTCB * ) listGET_OWNER_OF_HEAD_ENTRY( ( &xTasksWaitingTermination ) ); + pxTCB = ( TCB_t * ) listGET_OWNER_OF_HEAD_ENTRY( ( &xTasksWaitingTermination ) ); ( void ) uxListRemove( &( pxTCB->xGenericListItem ) ); --uxCurrentNumberOfTasks; --uxTasksDeleted; @@ -2838,7 +2838,7 @@ static void prvCheckTasksWaitingTermination( void ) } /*-----------------------------------------------------------*/ -static void prvAddCurrentTaskToDelayedList( const portTickType xTimeToWake ) +static void prvAddCurrentTaskToDelayedList( const TickType_t xTimeToWake ) { /* The list item will be inserted in wake time order. */ listSET_LIST_ITEM_VALUE( &( pxCurrentTCB->xGenericListItem ), xTimeToWake ); @@ -2868,20 +2868,20 @@ static void prvAddCurrentTaskToDelayedList( const portTickType xTimeToWake ) } /*-----------------------------------------------------------*/ -static tskTCB *prvAllocateTCBAndStack( const unsigned short usStackDepth, portSTACK_TYPE * const puxStackBuffer ) +static TCB_t *prvAllocateTCBAndStack( const uint16_t usStackDepth, StackType_t * const puxStackBuffer ) { -tskTCB *pxNewTCB; +TCB_t *pxNewTCB; /* Allocate space for the TCB. Where the memory comes from depends on the implementation of the port malloc function. */ - pxNewTCB = ( tskTCB * ) pvPortMalloc( sizeof( tskTCB ) ); + pxNewTCB = ( TCB_t * ) pvPortMalloc( sizeof( TCB_t ) ); if( pxNewTCB != NULL ) { /* Allocate space for the stack used by the task being created. The base of the stack memory stored in the TCB so the task can be deleted later if required. */ - pxNewTCB->pxStack = ( 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 = ( StackType_t * ) pvPortMallocAligned( ( ( ( size_t ) usStackDepth ) * sizeof( StackType_t ) ), puxStackBuffer ); /*lint !e961 MISRA exception as the casts are only redundant for some ports. */ if( pxNewTCB->pxStack == NULL ) { @@ -2895,7 +2895,7 @@ tskTCB *pxNewTCB; #if( ( configCHECK_FOR_STACK_OVERFLOW > 1 ) || ( configUSE_TRACE_FACILITY == 1 ) || ( INCLUDE_uxTaskGetStackHighWaterMark == 1 ) ) { /* Just to help debugging. */ - ( void ) memset( pxNewTCB->pxStack, ( int ) tskSTACK_FILL_BYTE, ( size_t ) usStackDepth * sizeof( portSTACK_TYPE ) ); + ( void ) memset( pxNewTCB->pxStack, ( int ) tskSTACK_FILL_BYTE, ( size_t ) usStackDepth * sizeof( StackType_t ) ); } #endif /* ( ( configCHECK_FOR_STACK_OVERFLOW > 1 ) || ( ( configUSE_TRACE_FACILITY == 1 ) || ( INCLUDE_uxTaskGetStackHighWaterMark == 1 ) ) ) */ } @@ -2907,24 +2907,24 @@ tskTCB *pxNewTCB; #if ( configUSE_TRACE_FACILITY == 1 ) - static unsigned portBASE_TYPE prvListTaskWithinSingleList( xTaskStatusType *pxTaskStatusArray, xList *pxList, eTaskState eState ) + static UBaseType_t prvListTaskWithinSingleList( TaskStatus_t *pxTaskStatusArray, List_t *pxList, eTaskState eState ) { - volatile tskTCB *pxNextTCB, *pxFirstTCB; - unsigned portBASE_TYPE uxTask = 0; + volatile TCB_t *pxNextTCB, *pxFirstTCB; + UBaseType_t uxTask = 0; - if( listCURRENT_LIST_LENGTH( pxList ) > ( unsigned portBASE_TYPE ) 0 ) + if( listCURRENT_LIST_LENGTH( pxList ) > ( UBaseType_t ) 0 ) { listGET_OWNER_OF_NEXT_ENTRY( pxFirstTCB, pxList ); - /* Populate an xTaskStatusType structure within the + /* Populate an TaskStatus_t structure within the pxTaskStatusArray array for each task that is referenced from - pxList. See the definition of xTaskStatusType in task.h for the - meaning of each xTaskStatusType structure member. */ + pxList. See the definition of TaskStatus_t in task.h for the + meaning of each TaskStatus_t structure member. */ do { listGET_OWNER_OF_NEXT_ENTRY( pxNextTCB, pxList ); - pxTaskStatusArray[ uxTask ].xHandle = ( xTaskHandle ) pxNextTCB; + pxTaskStatusArray[ uxTask ].xHandle = ( TaskHandle_t ) pxNextTCB; pxTaskStatusArray[ uxTask ].pcTaskName = ( const char * ) &( pxNextTCB->pcTaskName [ 0 ] ); pxTaskStatusArray[ uxTask ].xTaskNumber = pxNextTCB->uxTCBNumber; pxTaskStatusArray[ uxTask ].eCurrentState = eState; @@ -2952,11 +2952,11 @@ tskTCB *pxNewTCB; #if ( portSTACK_GROWTH > 0 ) { - pxTaskStatusArray[ uxTask ].usStackHighWaterMark = prvTaskCheckFreeStackSpace( ( unsigned char * ) pxNextTCB->pxEndOfStack ); + pxTaskStatusArray[ uxTask ].usStackHighWaterMark = prvTaskCheckFreeStackSpace( ( uint8_t * ) pxNextTCB->pxEndOfStack ); } #else { - pxTaskStatusArray[ uxTask ].usStackHighWaterMark = prvTaskCheckFreeStackSpace( ( unsigned char * ) pxNextTCB->pxStack ); + pxTaskStatusArray[ uxTask ].usStackHighWaterMark = prvTaskCheckFreeStackSpace( ( uint8_t * ) pxNextTCB->pxStack ); } #endif @@ -2977,9 +2977,9 @@ tskTCB *pxNewTCB; #if ( ( configUSE_TRACE_FACILITY == 1 ) || ( INCLUDE_uxTaskGetStackHighWaterMark == 1 ) ) - static unsigned short prvTaskCheckFreeStackSpace( const unsigned char * pucStackByte ) + static uint16_t prvTaskCheckFreeStackSpace( const uint8_t * pucStackByte ) { - unsigned long ulCount = 0U; + uint32_t ulCount = 0U; while( *pucStackByte == tskSTACK_FILL_BYTE ) { @@ -2987,9 +2987,9 @@ tskTCB *pxNewTCB; ulCount++; } - ulCount /= ( unsigned long ) sizeof( portSTACK_TYPE ); + ulCount /= ( uint32_t ) sizeof( StackType_t ); - return ( unsigned short ) ulCount; + return ( uint16_t ) ulCount; } #endif /* ( ( configUSE_TRACE_FACILITY == 1 ) || ( INCLUDE_uxTaskGetStackHighWaterMark == 1 ) ) */ @@ -2997,25 +2997,25 @@ tskTCB *pxNewTCB; #if ( INCLUDE_uxTaskGetStackHighWaterMark == 1 ) - unsigned portBASE_TYPE uxTaskGetStackHighWaterMark( xTaskHandle xTask ) + UBaseType_t uxTaskGetStackHighWaterMark( TaskHandle_t xTask ) { - tskTCB *pxTCB; - unsigned char *pucEndOfStack; - unsigned portBASE_TYPE uxReturn; + TCB_t *pxTCB; + uint8_t *pucEndOfStack; + UBaseType_t uxReturn; pxTCB = prvGetTCBFromHandle( xTask ); #if portSTACK_GROWTH < 0 { - pucEndOfStack = ( unsigned char * ) pxTCB->pxStack; + pucEndOfStack = ( uint8_t * ) pxTCB->pxStack; } #else { - pucEndOfStack = ( unsigned char * ) pxTCB->pxEndOfStack; + pucEndOfStack = ( uint8_t * ) pxTCB->pxEndOfStack; } #endif - uxReturn = ( unsigned portBASE_TYPE ) prvTaskCheckFreeStackSpace( pucEndOfStack ); + uxReturn = ( UBaseType_t ) prvTaskCheckFreeStackSpace( pucEndOfStack ); return uxReturn; } @@ -3025,7 +3025,7 @@ tskTCB *pxNewTCB; #if ( INCLUDE_vTaskDelete == 1 ) - static void prvDeleteTCB( tskTCB *pxTCB ) + static void prvDeleteTCB( TCB_t *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 @@ -3043,7 +3043,7 @@ tskTCB *pxNewTCB; static void prvResetNextTaskUnblockTime( void ) { -tskTCB *pxTCB; +TCB_t *pxTCB; if( listLIST_IS_EMPTY( pxDelayedTaskList ) != pdFALSE ) { @@ -3060,7 +3060,7 @@ tskTCB *pxTCB; the item at the head of the delayed list. This is the time at which the task at the head of the delayed list should be removed from the Blocked state. */ - ( pxTCB ) = ( tskTCB * ) listGET_OWNER_OF_HEAD_ENTRY( pxDelayedTaskList ); + ( pxTCB ) = ( TCB_t * ) listGET_OWNER_OF_HEAD_ENTRY( pxDelayedTaskList ); xNextTaskUnblockTime = listGET_LIST_ITEM_VALUE( &( ( pxTCB )->xGenericListItem ) ); } } @@ -3068,9 +3068,9 @@ tskTCB *pxTCB; #if ( ( INCLUDE_xTaskGetCurrentTaskHandle == 1 ) || ( configUSE_MUTEXES == 1 ) ) - xTaskHandle xTaskGetCurrentTaskHandle( void ) + TaskHandle_t xTaskGetCurrentTaskHandle( void ) { - xTaskHandle xReturn; + TaskHandle_t xReturn; /* A critical section is not required as this is not called from an interrupt and the current TCB will always be the same for any @@ -3085,9 +3085,9 @@ tskTCB *pxTCB; #if ( ( INCLUDE_xTaskGetSchedulerState == 1 ) || ( configUSE_TIMERS == 1 ) ) - portBASE_TYPE xTaskGetSchedulerState( void ) + BaseType_t xTaskGetSchedulerState( void ) { - portBASE_TYPE xReturn; + BaseType_t xReturn; if( xSchedulerRunning == pdFALSE ) { @@ -3095,7 +3095,7 @@ tskTCB *pxTCB; } else { - if( uxSchedulerSuspended == ( unsigned portBASE_TYPE ) pdFALSE ) + if( uxSchedulerSuspended == ( UBaseType_t ) pdFALSE ) { xReturn = taskSCHEDULER_RUNNING; } @@ -3113,9 +3113,9 @@ tskTCB *pxTCB; #if ( configUSE_MUTEXES == 1 ) - void vTaskPriorityInherit( xTaskHandle const pxMutexHolder ) + void vTaskPriorityInherit( TaskHandle_t const pxMutexHolder ) { - tskTCB * const pxTCB = ( tskTCB * ) pxMutexHolder; + TCB_t * const pxTCB = ( TCB_t * ) pxMutexHolder; /* If the mutex was given back by an interrupt while the queue was locked then the mutex holder might now be NULL. */ @@ -3128,7 +3128,7 @@ tskTCB *pxTCB; not being used for anything else. */ if( ( listGET_LIST_ITEM_VALUE( &( pxTCB->xEventListItem ) ) & taskEVENT_LIST_ITEM_VALUE_IN_USE ) == 0UL ) { - listSET_LIST_ITEM_VALUE( &( pxTCB->xEventListItem ), ( portTickType ) configMAX_PRIORITIES - ( portTickType ) pxCurrentTCB->uxPriority ); /*lint !e961 MISRA exception as the casts are only redundant for some ports. */ + listSET_LIST_ITEM_VALUE( &( pxTCB->xEventListItem ), ( TickType_t ) configMAX_PRIORITIES - ( TickType_t ) pxCurrentTCB->uxPriority ); /*lint !e961 MISRA exception as the casts are only redundant for some ports. */ } else { @@ -3139,7 +3139,7 @@ tskTCB *pxTCB; be moved into a new list. */ if( listIS_CONTAINED_WITHIN( &( pxReadyTasksLists[ pxTCB->uxPriority ] ), &( pxTCB->xGenericListItem ) ) != pdFALSE ) { - if( uxListRemove( &( pxTCB->xGenericListItem ) ) == ( unsigned portBASE_TYPE ) 0 ) + if( uxListRemove( &( pxTCB->xGenericListItem ) ) == ( UBaseType_t ) 0 ) { taskRESET_READY_PRIORITY( pxTCB->uxPriority ); } @@ -3176,9 +3176,9 @@ tskTCB *pxTCB; #if ( configUSE_MUTEXES == 1 ) - void vTaskPriorityDisinherit( xTaskHandle const pxMutexHolder ) + void vTaskPriorityDisinherit( TaskHandle_t const pxMutexHolder ) { - tskTCB * const pxTCB = ( tskTCB * ) pxMutexHolder; + TCB_t * const pxTCB = ( TCB_t * ) pxMutexHolder; if( pxMutexHolder != NULL ) { @@ -3186,7 +3186,7 @@ tskTCB *pxTCB; { /* We must be the running task to be able to give the mutex back. Remove ourselves from the ready list we currently appear in. */ - if( uxListRemove( &( pxTCB->xGenericListItem ) ) == ( unsigned portBASE_TYPE ) 0 ) + if( uxListRemove( &( pxTCB->xGenericListItem ) ) == ( UBaseType_t ) 0 ) { taskRESET_READY_PRIORITY( pxTCB->uxPriority ); } @@ -3204,7 +3204,7 @@ tskTCB *pxTCB; being used for anything else. */ if( ( listGET_LIST_ITEM_VALUE( &( pxTCB->xEventListItem ) ) & taskEVENT_LIST_ITEM_VALUE_IN_USE ) == 0UL ) { - listSET_LIST_ITEM_VALUE( &( pxTCB->xEventListItem ), ( portTickType ) configMAX_PRIORITIES - ( portTickType ) pxTCB->uxPriority ); /*lint !e961 MISRA exception as the casts are only redundant for some ports. */ + listSET_LIST_ITEM_VALUE( &( pxTCB->xEventListItem ), ( TickType_t ) configMAX_PRIORITIES - ( TickType_t ) pxTCB->uxPriority ); /*lint !e961 MISRA exception as the casts are only redundant for some ports. */ } else { @@ -3282,8 +3282,8 @@ tskTCB *pxTCB; void vTaskList( char * pcWriteBuffer ) { - xTaskStatusType *pxTaskStatusArray; - volatile unsigned portBASE_TYPE uxArraySize, x; + TaskStatus_t *pxTaskStatusArray; + volatile UBaseType_t uxArraySize, x; char cStatus; /* @@ -3319,7 +3319,7 @@ tskTCB *pxTCB; uxArraySize = uxCurrentNumberOfTasks; /* Allocate an array index for each task. */ - pxTaskStatusArray = pvPortMalloc( uxCurrentNumberOfTasks * sizeof( xTaskStatusType ) ); + pxTaskStatusArray = pvPortMalloc( uxCurrentNumberOfTasks * sizeof( TaskStatus_t ) ); if( pxTaskStatusArray != NULL ) { @@ -3369,9 +3369,9 @@ tskTCB *pxTCB; void vTaskGetRunTimeStats( char *pcWriteBuffer ) { - xTaskStatusType *pxTaskStatusArray; - volatile unsigned portBASE_TYPE uxArraySize, x; - unsigned long ulTotalTime, ulStatsAsPercentage; + TaskStatus_t *pxTaskStatusArray; + volatile UBaseType_t uxArraySize, x; + uint32_t ulTotalTime, ulStatsAsPercentage; /* * PLEASE NOTE: @@ -3406,7 +3406,7 @@ tskTCB *pxTCB; uxArraySize = uxCurrentNumberOfTasks; /* Allocate an array index for each task. */ - pxTaskStatusArray = pvPortMalloc( uxCurrentNumberOfTasks * sizeof( xTaskStatusType ) ); + pxTaskStatusArray = pvPortMalloc( uxCurrentNumberOfTasks * sizeof( TaskStatus_t ) ); if( pxTaskStatusArray != NULL ) { @@ -3478,15 +3478,15 @@ tskTCB *pxTCB; #endif /* ( ( configGENERATE_RUN_TIME_STATS == 1 ) && ( configUSE_STATS_FORMATTING_FUNCTIONS == 1 ) ) */ /*-----------------------------------------------------------*/ -portTickType uxTaskResetEventItemValue( void ) +TickType_t uxTaskResetEventItemValue( void ) { -portTickType uxReturn; +TickType_t uxReturn; uxReturn = listGET_LIST_ITEM_VALUE( &( pxCurrentTCB->xEventListItem ) ); /* Reset the event list item to its normal value - so it can be used with queues and semaphores. */ - listSET_LIST_ITEM_VALUE( &( pxCurrentTCB->xEventListItem ), ( ( portTickType ) configMAX_PRIORITIES - ( portTickType ) pxCurrentTCB->uxPriority ) ); /*lint !e961 MISRA exception as the casts are only redundant for some ports. */ + listSET_LIST_ITEM_VALUE( &( pxCurrentTCB->xEventListItem ), ( ( TickType_t ) configMAX_PRIORITIES - ( TickType_t ) pxCurrentTCB->uxPriority ) ); /*lint !e961 MISRA exception as the casts are only redundant for some ports. */ return uxReturn; } diff --git a/FreeRTOS/Source/timers.c b/FreeRTOS/Source/timers.c index d7f38b46c..f0a9914e2 100644 --- a/FreeRTOS/Source/timers.c +++ b/FreeRTOS/Source/timers.c @@ -94,18 +94,18 @@ configUSE_TIMERS is set to 1 in FreeRTOSConfig.h. */ #if ( configUSE_TIMERS == 1 ) /* Misc definitions. */ -#define tmrNO_DELAY ( portTickType ) 0U +#define tmrNO_DELAY ( TickType_t ) 0U /* The definition of the timers themselves. */ typedef struct tmrTimerControl { - 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. */ - xListItem xTimerListItem; /*<< Standard linked list item as used by all kernel features for event management. */ - portTickType xTimerPeriodInTicks;/*<< How quickly and often the timer expires. */ - unsigned portBASE_TYPE uxAutoReload; /*<< Set to pdTRUE if the timer should be automatically restarted once expired. Set to pdFALSE if the timer is, in effect, a one-shot timer. */ - void *pvTimerID; /*<< An ID to identify the timer. This allows the timer to be identified when the same callback is used for multiple timers. */ - tmrTIMER_CALLBACK pxCallbackFunction; /*<< The function that will be called when the timer expires. */ -} xTIMER; + 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. */ + ListItem_t xTimerListItem; /*<< Standard linked list item as used by all kernel features for event management. */ + TickType_t xTimerPeriodInTicks;/*<< How quickly and often the timer expires. */ + UBaseType_t uxAutoReload; /*<< Set to pdTRUE if the timer should be automatically restarted once expired. Set to pdFALSE if the timer is, in effect, a one-shot timer. */ + void *pvTimerID; /*<< An ID to identify the timer. This allows the timer to be identified when the same callback is used for multiple timers. */ + tmrTIMER_CALLBACK pxCallbackFunction; /*<< The function that will be called when the timer expires. */ +} Timer_t; /* The definition of messages that can be sent and received on the timer queue. Two types of message can be queued - messages that manipulate a software timer, @@ -114,34 +114,34 @@ two message types are defined in two separate structures, xTimerParametersType and xCallbackParametersType respectively. */ typedef struct tmrTimerParameters { - portTickType xMessageValue; /*<< An optional value used by a subset of commands, for example, when changing the period of a timer. */ - xTIMER * pxTimer; /*<< The timer to which the command will be applied. */ -} xTimerParametersType; + TickType_t xMessageValue; /*<< An optional value used by a subset of commands, for example, when changing the period of a timer. */ + Timer_t * pxTimer; /*<< The timer to which the command will be applied. */ +} TimerParameter_t; typedef struct tmrCallbackParameters { pdAPPLICATION_CALLBACK_CODE pxCallbackFunction; /* << The callback function to execute. */ void *pvParameter1; /* << The value that will be used as the callback functions first parameter. */ - unsigned long ulParameter2; /* << The value that will be used as the callback functions second parameter. */ -} xCallbackParametersType; + uint32_t ulParameter2; /* << The value that will be used as the callback functions second parameter. */ +} CallbackParameters_t; /* The structure that contains the two message types, along with an identifier that is used to determine which message type is valid. */ typedef struct tmrTimerQueueMessage { - portBASE_TYPE xMessageID; /*<< The command being sent to the timer service task. */ + BaseType_t xMessageID; /*<< The command being sent to the timer service task. */ union { - xTimerParametersType xTimerParameters; + TimerParameter_t xTimerParameters; /* Don't include xCallbackParameters if it is not going to be used as it makes the structure (and therefore the timer queue) larger. */ #if ( INCLUDE_xTimerPendCallbackFromISR == 1 ) - xCallbackParametersType xCallbackParameters; + CallbackParameters_t xCallbackParameters; #endif /* INCLUDE_xTimerPendCallbackFromISR */ } u; -} xDAEMON_TASK_MESSAGE; +} DaemonTaskMessage_t; /*lint -e956 A manual analysis and inspection has been used to determine which static variables must be declared volatile. */ @@ -149,17 +149,17 @@ static variables must be declared volatile. */ /* The list in which active timers are stored. Timers are referenced in expire time order, with the nearest expiry time at the front of the list. Only the timer service task is allowed to access these lists. */ -PRIVILEGED_DATA static xList xActiveTimerList1; -PRIVILEGED_DATA static xList xActiveTimerList2; -PRIVILEGED_DATA static xList *pxCurrentTimerList; -PRIVILEGED_DATA static xList *pxOverflowTimerList; +PRIVILEGED_DATA static List_t xActiveTimerList1; +PRIVILEGED_DATA static List_t xActiveTimerList2; +PRIVILEGED_DATA static List_t *pxCurrentTimerList; +PRIVILEGED_DATA static List_t *pxOverflowTimerList; /* A queue that is used to send commands to the timer service task. */ -PRIVILEGED_DATA static xQueueHandle xTimerQueue = NULL; +PRIVILEGED_DATA static QueueHandle_t xTimerQueue = NULL; #if ( INCLUDE_xTimerGetTimerDaemonTaskHandle == 1 ) - PRIVILEGED_DATA static xTaskHandle xTimerTaskHandle = NULL; + PRIVILEGED_DATA static TaskHandle_t xTimerTaskHandle = NULL; #endif @@ -190,13 +190,13 @@ static void prvProcessReceivedCommands( void ) PRIVILEGED_FUNCTION; * Insert the timer into either xActiveTimerList1, or xActiveTimerList2, * depending on if the expire time causes a timer counter overflow. */ -static portBASE_TYPE prvInsertTimerInActiveList( xTIMER * const pxTimer, const portTickType xNextExpiryTime, const portTickType xTimeNow, const portTickType xCommandTime ) PRIVILEGED_FUNCTION; +static BaseType_t prvInsertTimerInActiveList( Timer_t * const pxTimer, const TickType_t xNextExpiryTime, const TickType_t xTimeNow, const TickType_t xCommandTime ) PRIVILEGED_FUNCTION; /* * An active timer has reached its expire time. Reload the timer if it is an * auto reload timer, then call its callback. */ -static void prvProcessExpiredTimer( const portTickType xNextExpireTime, const portTickType xTimeNow ) PRIVILEGED_FUNCTION; +static void prvProcessExpiredTimer( const TickType_t xNextExpireTime, const TickType_t xTimeNow ) PRIVILEGED_FUNCTION; /* * The tick count has overflowed. Switch the timer lists after ensuring the @@ -208,7 +208,7 @@ static void prvSwitchTimerLists( void ) PRIVILEGED_FUNCTION; * Obtain the current tick count, setting *pxTimerListsWereSwitched to pdTRUE * if a tick count overflow occurred since prvSampleTimeNow() was last called. */ -static portTickType prvSampleTimeNow( portBASE_TYPE * const pxTimerListsWereSwitched ) PRIVILEGED_FUNCTION; +static TickType_t prvSampleTimeNow( BaseType_t * const pxTimerListsWereSwitched ) PRIVILEGED_FUNCTION; /* * If the timer list contains any active timers then return the expire time of @@ -216,19 +216,19 @@ static portTickType prvSampleTimeNow( portBASE_TYPE * const pxTimerListsWereSwit * timer list does not contain any timers then return 0 and set *pxListWasEmpty * to pdTRUE. */ -static portTickType prvGetNextExpireTime( portBASE_TYPE * const pxListWasEmpty ) PRIVILEGED_FUNCTION; +static TickType_t prvGetNextExpireTime( BaseType_t * const pxListWasEmpty ) PRIVILEGED_FUNCTION; /* * If a timer has expired, process it. Otherwise, block the timer service task * until either a timer does expire or a command is received. */ -static void prvProcessTimerOrBlockTask( const portTickType xNextExpireTime, const portBASE_TYPE xListWasEmpty ) PRIVILEGED_FUNCTION; +static void prvProcessTimerOrBlockTask( const TickType_t xNextExpireTime, const BaseType_t xListWasEmpty ) PRIVILEGED_FUNCTION; /*-----------------------------------------------------------*/ -portBASE_TYPE xTimerCreateTimerTask( void ) +BaseType_t xTimerCreateTimerTask( void ) { -portBASE_TYPE xReturn = pdFAIL; +BaseType_t xReturn = pdFAIL; /* This function is called when the scheduler is started if configUSE_TIMERS is set to 1. Check that the infrastructure used by the @@ -242,12 +242,12 @@ 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, "Tmr Svc", ( unsigned short ) configTIMER_TASK_STACK_DEPTH, NULL, ( ( unsigned portBASE_TYPE ) configTIMER_TASK_PRIORITY ) | portPRIVILEGE_BIT, &xTimerTaskHandle ); + xReturn = xTaskCreate( prvTimerTask, "Tmr Svc", ( uint16_t ) configTIMER_TASK_STACK_DEPTH, NULL, ( ( UBaseType_t ) configTIMER_TASK_PRIORITY ) | portPRIVILEGE_BIT, &xTimerTaskHandle ); } #else { /* Create the timer task without storing its handle. */ - xReturn = xTaskCreate( prvTimerTask, "Tmr Svc", ( unsigned short ) configTIMER_TASK_STACK_DEPTH, NULL, ( ( unsigned portBASE_TYPE ) configTIMER_TASK_PRIORITY ) | portPRIVILEGE_BIT, NULL); + xReturn = xTaskCreate( prvTimerTask, "Tmr Svc", ( uint16_t ) configTIMER_TASK_STACK_DEPTH, NULL, ( ( UBaseType_t ) configTIMER_TASK_PRIORITY ) | portPRIVILEGE_BIT, NULL); } #endif } @@ -261,18 +261,18 @@ portBASE_TYPE xReturn = pdFAIL; } /*-----------------------------------------------------------*/ -xTimerHandle xTimerCreate( const char * const pcTimerName, const portTickType xTimerPeriodInTicks, const unsigned portBASE_TYPE uxAutoReload, void * const pvTimerID, tmrTIMER_CALLBACK pxCallbackFunction ) /*lint !e971 Unqualified char types are allowed for strings and single characters only. */ +TimerHandle_t xTimerCreate( const char * const pcTimerName, const TickType_t xTimerPeriodInTicks, const UBaseType_t uxAutoReload, void * const pvTimerID, tmrTIMER_CALLBACK pxCallbackFunction ) /*lint !e971 Unqualified char types are allowed for strings and single characters only. */ { -xTIMER *pxNewTimer; +Timer_t *pxNewTimer; /* Allocate the timer structure. */ - if( xTimerPeriodInTicks == ( portTickType ) 0U ) + if( xTimerPeriodInTicks == ( TickType_t ) 0U ) { pxNewTimer = NULL; } else { - pxNewTimer = ( xTIMER * ) pvPortMalloc( sizeof( xTIMER ) ); + pxNewTimer = ( Timer_t * ) pvPortMalloc( sizeof( Timer_t ) ); if( pxNewTimer != NULL ) { /* Ensure the infrastructure used by the timer service task has been @@ -298,14 +298,14 @@ xTIMER *pxNewTimer; /* 0 is not a valid value for xTimerPeriodInTicks. */ configASSERT( ( xTimerPeriodInTicks > 0 ) ); - return ( xTimerHandle ) pxNewTimer; + return ( TimerHandle_t ) pxNewTimer; } /*-----------------------------------------------------------*/ -portBASE_TYPE xTimerGenericCommand( xTimerHandle xTimer, const portBASE_TYPE xCommandID, const portTickType xOptionalValue, signed portBASE_TYPE * const pxHigherPriorityTaskWoken, const portTickType xBlockTime ) +BaseType_t xTimerGenericCommand( TimerHandle_t xTimer, const BaseType_t xCommandID, const TickType_t xOptionalValue, BaseType_t * const pxHigherPriorityTaskWoken, const TickType_t xBlockTime ) { -portBASE_TYPE xReturn = pdFAIL; -xDAEMON_TASK_MESSAGE xMessage; +BaseType_t xReturn = pdFAIL; +DaemonTaskMessage_t xMessage; /* Send a message to the timer service task to perform a particular action on a particular timer definition. */ @@ -314,7 +314,7 @@ xDAEMON_TASK_MESSAGE xMessage; /* Send a command to the timer service task to start the xTimer timer. */ xMessage.xMessageID = xCommandID; xMessage.u.xTimerParameters.xMessageValue = xOptionalValue; - xMessage.u.xTimerParameters.pxTimer = ( xTIMER * ) xTimer; + xMessage.u.xTimerParameters.pxTimer = ( Timer_t * ) xTimer; if( pxHigherPriorityTaskWoken == NULL ) { @@ -345,7 +345,7 @@ xDAEMON_TASK_MESSAGE xMessage; #if ( INCLUDE_xTimerGetTimerDaemonTaskHandle == 1 ) - xTaskHandle xTimerGetTimerDaemonTaskHandle( void ) + TaskHandle_t xTimerGetTimerDaemonTaskHandle( void ) { /* If xTimerGetTimerDaemonTaskHandle() is called before the scheduler has been started, then xTimerTaskHandle will be NULL. */ @@ -356,10 +356,10 @@ xDAEMON_TASK_MESSAGE xMessage; #endif /*-----------------------------------------------------------*/ -static void prvProcessExpiredTimer( const portTickType xNextExpireTime, const portTickType xTimeNow ) +static void prvProcessExpiredTimer( const TickType_t xNextExpireTime, const TickType_t xTimeNow ) { -portBASE_TYPE xResult; -xTIMER * const pxTimer = ( xTIMER * ) listGET_OWNER_OF_HEAD_ENTRY( pxCurrentTimerList ); +BaseType_t xResult; +Timer_t * const pxTimer = ( Timer_t * ) listGET_OWNER_OF_HEAD_ENTRY( pxCurrentTimerList ); /* Remove the timer from the list of active timers. A check has already been performed to ensure the list is not empty. */ @@ -368,7 +368,7 @@ xTIMER * const pxTimer = ( xTIMER * ) listGET_OWNER_OF_HEAD_ENTRY( pxCurrentTime /* If the timer is an auto reload timer then calculate the next expiry time and re-insert the timer in the list of active timers. */ - if( pxTimer->uxAutoReload == ( unsigned portBASE_TYPE ) pdTRUE ) + if( pxTimer->uxAutoReload == ( UBaseType_t ) pdTRUE ) { /* The timer is inserted into a list using a time relative to anything other than the current time. It will therefore be inserted into the @@ -392,14 +392,14 @@ xTIMER * const pxTimer = ( xTIMER * ) listGET_OWNER_OF_HEAD_ENTRY( pxCurrentTime } /* Call the timer callback. */ - pxTimer->pxCallbackFunction( ( xTimerHandle ) pxTimer ); + pxTimer->pxCallbackFunction( ( TimerHandle_t ) pxTimer ); } /*-----------------------------------------------------------*/ static void prvTimerTask( void *pvParameters ) { -portTickType xNextExpireTime; -portBASE_TYPE xListWasEmpty; +TickType_t xNextExpireTime; +BaseType_t xListWasEmpty; /* Just to avoid compiler warnings. */ ( void ) pvParameters; @@ -420,10 +420,10 @@ portBASE_TYPE xListWasEmpty; } /*-----------------------------------------------------------*/ -static void prvProcessTimerOrBlockTask( const portTickType xNextExpireTime, const portBASE_TYPE xListWasEmpty ) +static void prvProcessTimerOrBlockTask( const TickType_t xNextExpireTime, const BaseType_t xListWasEmpty ) { -portTickType xTimeNow; -portBASE_TYPE xTimerListsWereSwitched; +TickType_t xTimeNow; +BaseType_t xTimerListsWereSwitched; vTaskSuspendAll(); { @@ -473,9 +473,9 @@ portBASE_TYPE xTimerListsWereSwitched; } /*-----------------------------------------------------------*/ -static portTickType prvGetNextExpireTime( portBASE_TYPE * const pxListWasEmpty ) +static TickType_t prvGetNextExpireTime( BaseType_t * const pxListWasEmpty ) { -portTickType xNextExpireTime; +TickType_t xNextExpireTime; /* Timers are listed in expiry time order, with the head of the list referencing the task that will expire first. Obtain the time at which @@ -492,17 +492,17 @@ portTickType xNextExpireTime; else { /* Ensure the task unblocks when the tick count rolls over. */ - xNextExpireTime = ( portTickType ) 0U; + xNextExpireTime = ( TickType_t ) 0U; } return xNextExpireTime; } /*-----------------------------------------------------------*/ -static portTickType prvSampleTimeNow( portBASE_TYPE * const pxTimerListsWereSwitched ) +static TickType_t prvSampleTimeNow( BaseType_t * const pxTimerListsWereSwitched ) { -portTickType xTimeNow; -PRIVILEGED_DATA static portTickType xLastTime = ( portTickType ) 0U; /*lint !e956 Variable is only accessible to one task. */ +TickType_t xTimeNow; +PRIVILEGED_DATA static TickType_t xLastTime = ( TickType_t ) 0U; /*lint !e956 Variable is only accessible to one task. */ xTimeNow = xTaskGetTickCount(); @@ -522,9 +522,9 @@ PRIVILEGED_DATA static portTickType xLastTime = ( portTickType ) 0U; /*lint !e95 } /*-----------------------------------------------------------*/ -static portBASE_TYPE prvInsertTimerInActiveList( xTIMER * const pxTimer, const portTickType xNextExpiryTime, const portTickType xTimeNow, const portTickType xCommandTime ) +static BaseType_t prvInsertTimerInActiveList( Timer_t * const pxTimer, const TickType_t xNextExpiryTime, const TickType_t xTimeNow, const TickType_t xCommandTime ) { -portBASE_TYPE xProcessTimerNow = pdFALSE; +BaseType_t xProcessTimerNow = pdFALSE; listSET_LIST_ITEM_VALUE( &( pxTimer->xTimerListItem ), xNextExpiryTime ); listSET_LIST_ITEM_OWNER( &( pxTimer->xTimerListItem ), pxTimer ); @@ -565,10 +565,10 @@ portBASE_TYPE xProcessTimerNow = pdFALSE; static void prvProcessReceivedCommands( void ) { -xDAEMON_TASK_MESSAGE xMessage; -xTIMER *pxTimer; -portBASE_TYPE xTimerListsWereSwitched, xResult; -portTickType xTimeNow; +DaemonTaskMessage_t xMessage; +Timer_t *pxTimer; +BaseType_t xTimerListsWereSwitched, xResult; +TickType_t xTimeNow; while( xQueueReceive( xTimerQueue, &xMessage, tmrNO_DELAY ) != pdFAIL ) /*lint !e603 xMessage does not have to be initialised as it is passed out, not in, and it is not used unless xQueueReceive() returns pdTRUE. */ { @@ -576,7 +576,7 @@ portTickType xTimeNow; { if( xMessage.xMessageID == tmrCOMMAND_EXECUTE_CALLBACK ) { - const xCallbackParametersType * const pxCallback = &( xMessage.u.xCallbackParameters ); + const CallbackParameters_t * const pxCallback = &( xMessage.u.xCallbackParameters ); /* The timer uses the xCallbackParameters member to request a callback be executed. Check the callback is not NULL. */ @@ -626,10 +626,10 @@ portTickType xTimeNow; { /* The timer expired before it was added to the active timer list. Process it now. */ - pxTimer->pxCallbackFunction( ( xTimerHandle ) pxTimer ); + pxTimer->pxCallbackFunction( ( TimerHandle_t ) pxTimer ); traceTIMER_EXPIRED( pxTimer ); - if( pxTimer->uxAutoReload == ( unsigned portBASE_TYPE ) pdTRUE ) + if( pxTimer->uxAutoReload == ( UBaseType_t ) pdTRUE ) { xResult = xTimerGenericCommand( pxTimer, tmrCOMMAND_START, xMessage.u.xTimerParameters.xMessageValue + pxTimer->xTimerPeriodInTicks, NULL, tmrNO_DELAY ); configASSERT( xResult ); @@ -681,10 +681,10 @@ portTickType xTimeNow; static void prvSwitchTimerLists( void ) { -portTickType xNextExpireTime, xReloadTime; -xList *pxTemp; -xTIMER *pxTimer; -portBASE_TYPE xResult; +TickType_t xNextExpireTime, xReloadTime; +List_t *pxTemp; +Timer_t *pxTimer; +BaseType_t xResult; /* The tick count has overflowed. The timer lists must be switched. If there are any timers still referenced from the current timer list @@ -695,16 +695,16 @@ portBASE_TYPE xResult; xNextExpireTime = listGET_ITEM_VALUE_OF_HEAD_ENTRY( pxCurrentTimerList ); /* Remove the timer from the list. */ - pxTimer = ( xTIMER * ) listGET_OWNER_OF_HEAD_ENTRY( pxCurrentTimerList ); + pxTimer = ( Timer_t * ) listGET_OWNER_OF_HEAD_ENTRY( pxCurrentTimerList ); ( void ) uxListRemove( &( pxTimer->xTimerListItem ) ); traceTIMER_EXPIRED( pxTimer ); /* 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( ( TimerHandle_t ) pxTimer ); - if( pxTimer->uxAutoReload == ( unsigned portBASE_TYPE ) pdTRUE ) + if( pxTimer->uxAutoReload == ( UBaseType_t ) pdTRUE ) { /* Calculate the reload value, and if the reload value results in the timer going into the same timer list then it has already expired @@ -751,7 +751,7 @@ static void prvCheckForValidListAndQueue( void ) vListInitialise( &xActiveTimerList2 ); pxCurrentTimerList = &xActiveTimerList1; pxOverflowTimerList = &xActiveTimerList2; - xTimerQueue = xQueueCreate( ( unsigned portBASE_TYPE ) configTIMER_QUEUE_LENGTH, sizeof( xDAEMON_TASK_MESSAGE ) ); + xTimerQueue = xQueueCreate( ( UBaseType_t ) configTIMER_QUEUE_LENGTH, sizeof( DaemonTaskMessage_t ) ); configASSERT( xTimerQueue ); #if ( configQUEUE_REGISTRY_SIZE > 0 ) @@ -776,10 +776,10 @@ static void prvCheckForValidListAndQueue( void ) } /*-----------------------------------------------------------*/ -portBASE_TYPE xTimerIsTimerActive( xTimerHandle xTimer ) +BaseType_t xTimerIsTimerActive( TimerHandle_t xTimer ) { -portBASE_TYPE xTimerIsInActiveList; -xTIMER *pxTimer = ( xTIMER * ) xTimer; +BaseType_t xTimerIsInActiveList; +Timer_t *pxTimer = ( Timer_t * ) xTimer; /* Is the timer in the list of active timers? */ taskENTER_CRITICAL(); @@ -795,9 +795,9 @@ xTIMER *pxTimer = ( xTIMER * ) xTimer; } /*-----------------------------------------------------------*/ -void *pvTimerGetTimerID( const xTimerHandle xTimer ) +void *pvTimerGetTimerID( const TimerHandle_t xTimer ) { -xTIMER * const pxTimer = ( xTIMER * ) xTimer; +Timer_t * const pxTimer = ( Timer_t * ) xTimer; return pxTimer->pvTimerID; } @@ -805,10 +805,10 @@ xTIMER * const pxTimer = ( xTIMER * ) xTimer; #if( INCLUDE_xTimerPendCallbackFromISR == 1 ) - portBASE_TYPE xTimerPendCallbackFromISR( pdAPPLICATION_CALLBACK_CODE pvCallbackFunction, void *pvParameter1, unsigned long ulParameter2, portBASE_TYPE *pxHigherPriorityTaskWoken ) + BaseType_t xTimerPendCallbackFromISR( pdAPPLICATION_CALLBACK_CODE pvCallbackFunction, void *pvParameter1, uint32_t ulParameter2, BaseType_t *pxHigherPriorityTaskWoken ) { - xDAEMON_TASK_MESSAGE xMessage; - portBASE_TYPE xReturn; + DaemonTaskMessage_t xMessage; + BaseType_t xReturn; /* Complete the message with the function parameters and post it to the daemon task. */ -- 2.39.5