mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-08-19 17:48:33 -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
|
@ -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. */
|
||||
|
||||
|
|
|
@ -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 <stddef.h>
|
||||
|
||||
/*-----------------------------------------------------------
|
||||
* 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 " );
|
||||
/*-----------------------------------------------------------*/
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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 " );
|
||||
/*-----------------------------------------------------------*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue