mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-08-01 08:54:14 -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
|
@ -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;
|
||||
|
|
|
@ -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. */
|
||||
|
|
|
@ -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 ) )
|
||||
|
|
|
@ -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 */
|
||||
|
||||
|
|
|
@ -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();
|
||||
{
|
||||
|
|
|
@ -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" )
|
||||
|
|
|
@ -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 ) );
|
||||
|
|
|
@ -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
|
||||
/*-----------------------------------------------------------*/
|
||||
|
|
|
@ -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 ) );
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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" )
|
||||
/*-----------------------------------------------------------*/
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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__ ( \
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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];
|
||||
}
|
||||
|
|
|
@ -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
|
||||
)
|
||||
{
|
||||
|
|
|
@ -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
|
||||
)
|
||||
{
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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. */
|
||||
|
|
|
@ -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 );
|
||||
|
|
|
@ -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. */
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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 )
|
||||
|
|
|
@ -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. */
|
||||
|
|
|
@ -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. */
|
||||
|
|
|
@ -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. */
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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. */
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 );
|
||||
|
||||
|
|
|
@ -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 ) )
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
|
|
|
@ -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 );
|
||||
|
||||
|
|
|
@ -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 )
|
||||
|
|
|
@ -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 );
|
||||
|
||||
|
|
|
@ -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. */
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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. */
|
||||
|
|
|
@ -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. */
|
||||
|
|
|
@ -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. */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue