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:
Richard Barry 2013-12-29 14:06:04 +00:00
parent f292243dcf
commit 3e20aa7d60
190 changed files with 4940 additions and 4603 deletions

View file

@ -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. */

View file

@ -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 );
/*

View file

@ -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. */
/*-----------------------------------------------------------*/

View file

@ -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 )

View file

@ -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 );
/*

View file

@ -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. */
/*-----------------------------------------------------------*/