mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-08-19 09:38:32 -04:00
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).
This commit is contained in:
parent
f292243dcf
commit
3e20aa7d60
190 changed files with 4940 additions and 4603 deletions
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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 )
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue