mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-08-20 18:18:32 -04:00
Normalize line endings and whitespace in source files
This commit is contained in:
parent
151fb04ad1
commit
01820d3ed9
574 changed files with 162626 additions and 172362 deletions
|
@ -1,83 +1,83 @@
|
|||
;/*
|
||||
; * FreeRTOS Kernel <DEVELOPMENT BRANCH>
|
||||
; * Copyright (C) 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
; *
|
||||
; * SPDX-License-Identifier: MIT
|
||||
; *
|
||||
; * Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
; * this software and associated documentation files (the "Software"), to deal in
|
||||
; * the Software without restriction, including without limitation the rights to
|
||||
; * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
; * the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
; * subject to the following conditions:
|
||||
; *
|
||||
; * The above copyright notice and this permission notice shall be included in all
|
||||
; * copies or substantial portions of the Software.
|
||||
; *
|
||||
; * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
; * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
; * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
; * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
; * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
; * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
; *
|
||||
; * https://www.FreeRTOS.org
|
||||
; * https://github.com/FreeRTOS
|
||||
; *
|
||||
; */
|
||||
|
||||
#include "FreeRTOSConfig.h"
|
||||
|
||||
; Variables used by scheduler
|
||||
;------------------------------------------------------------------------------
|
||||
EXTERN pxCurrentTCB
|
||||
EXTERN usCriticalNesting
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
; portSAVE_CONTEXT MACRO
|
||||
; Saves the context of the general purpose registers, CS and ES (only in far
|
||||
; memory mode) registers the usCriticalNesting Value and the Stack Pointer
|
||||
; of the active Task onto the task stack
|
||||
;------------------------------------------------------------------------------
|
||||
portSAVE_CONTEXT MACRO
|
||||
|
||||
PUSH AX ; Save AX Register to stack.
|
||||
PUSH HL
|
||||
MOV A, CS ; Save CS register.
|
||||
XCH A, X
|
||||
MOV A, ES ; Save ES register.
|
||||
PUSH AX
|
||||
PUSH DE ; Save the remaining general purpose registers.
|
||||
PUSH BC
|
||||
MOVW AX, usCriticalNesting ; Save the usCriticalNesting value.
|
||||
PUSH AX
|
||||
MOVW AX, pxCurrentTCB ; Save the Stack pointer.
|
||||
MOVW HL, AX
|
||||
MOVW AX, SP
|
||||
MOVW [HL], AX
|
||||
ENDM
|
||||
;------------------------------------------------------------------------------
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
; portRESTORE_CONTEXT MACRO
|
||||
; Restores the task Stack Pointer then use this to restore usCriticalNesting,
|
||||
; general purpose registers and the CS and ES (only in far memory mode)
|
||||
; of the selected task from the task stack
|
||||
;------------------------------------------------------------------------------
|
||||
portRESTORE_CONTEXT MACRO
|
||||
MOVW AX, pxCurrentTCB ; Restore the Stack pointer.
|
||||
MOVW HL, AX
|
||||
MOVW AX, [HL]
|
||||
MOVW SP, AX
|
||||
POP AX ; Restore usCriticalNesting value.
|
||||
MOVW usCriticalNesting, AX
|
||||
POP BC ; Restore the necessary general purpose registers.
|
||||
POP DE
|
||||
POP AX ; Restore the ES register.
|
||||
MOV ES, A
|
||||
XCH A, X ; Restore the CS register.
|
||||
MOV CS, A
|
||||
POP HL ; Restore general purpose register HL.
|
||||
POP AX ; Restore AX.
|
||||
ENDM
|
||||
;------------------------------------------------------------------------------
|
||||
;/*
|
||||
; * FreeRTOS Kernel <DEVELOPMENT BRANCH>
|
||||
; * Copyright (C) 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
; *
|
||||
; * SPDX-License-Identifier: MIT
|
||||
; *
|
||||
; * Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
; * this software and associated documentation files (the "Software"), to deal in
|
||||
; * the Software without restriction, including without limitation the rights to
|
||||
; * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
; * the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
; * subject to the following conditions:
|
||||
; *
|
||||
; * The above copyright notice and this permission notice shall be included in all
|
||||
; * copies or substantial portions of the Software.
|
||||
; *
|
||||
; * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
; * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
; * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
; * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
; * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
; * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
; *
|
||||
; * https://www.FreeRTOS.org
|
||||
; * https://github.com/FreeRTOS
|
||||
; *
|
||||
; */
|
||||
|
||||
#include "FreeRTOSConfig.h"
|
||||
|
||||
; Variables used by scheduler
|
||||
;------------------------------------------------------------------------------
|
||||
EXTERN pxCurrentTCB
|
||||
EXTERN usCriticalNesting
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
; portSAVE_CONTEXT MACRO
|
||||
; Saves the context of the general purpose registers, CS and ES (only in far
|
||||
; memory mode) registers the usCriticalNesting Value and the Stack Pointer
|
||||
; of the active Task onto the task stack
|
||||
;------------------------------------------------------------------------------
|
||||
portSAVE_CONTEXT MACRO
|
||||
|
||||
PUSH AX ; Save AX Register to stack.
|
||||
PUSH HL
|
||||
MOV A, CS ; Save CS register.
|
||||
XCH A, X
|
||||
MOV A, ES ; Save ES register.
|
||||
PUSH AX
|
||||
PUSH DE ; Save the remaining general purpose registers.
|
||||
PUSH BC
|
||||
MOVW AX, usCriticalNesting ; Save the usCriticalNesting value.
|
||||
PUSH AX
|
||||
MOVW AX, pxCurrentTCB ; Save the Stack pointer.
|
||||
MOVW HL, AX
|
||||
MOVW AX, SP
|
||||
MOVW [HL], AX
|
||||
ENDM
|
||||
;------------------------------------------------------------------------------
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
; portRESTORE_CONTEXT MACRO
|
||||
; Restores the task Stack Pointer then use this to restore usCriticalNesting,
|
||||
; general purpose registers and the CS and ES (only in far memory mode)
|
||||
; of the selected task from the task stack
|
||||
;------------------------------------------------------------------------------
|
||||
portRESTORE_CONTEXT MACRO
|
||||
MOVW AX, pxCurrentTCB ; Restore the Stack pointer.
|
||||
MOVW HL, AX
|
||||
MOVW AX, [HL]
|
||||
MOVW SP, AX
|
||||
POP AX ; Restore usCriticalNesting value.
|
||||
MOVW usCriticalNesting, AX
|
||||
POP BC ; Restore the necessary general purpose registers.
|
||||
POP DE
|
||||
POP AX ; Restore the ES register.
|
||||
MOV ES, A
|
||||
XCH A, X ; Restore the CS register.
|
||||
MOV CS, A
|
||||
POP HL ; Restore general purpose register HL.
|
||||
POP AX ; Restore AX.
|
||||
ENDM
|
||||
;------------------------------------------------------------------------------
|
||||
|
|
|
@ -1,226 +1,225 @@
|
|||
/*
|
||||
* FreeRTOS Kernel <DEVELOPMENT BRANCH>
|
||||
* Copyright (C) 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* https://www.FreeRTOS.org
|
||||
* https://github.com/FreeRTOS
|
||||
*
|
||||
*/
|
||||
|
||||
/* Standard includes. */
|
||||
#include <stdlib.h>
|
||||
|
||||
/* Scheduler includes. */
|
||||
#include "FreeRTOS.h"
|
||||
#include "task.h"
|
||||
|
||||
/* 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 (( uint16_t ) 10)
|
||||
|
||||
/* Initial PSW value allocated to a newly created task.
|
||||
* 1100011000000000
|
||||
* ||||||||-------------- Fill byte
|
||||
* |||||||--------------- Carry Flag cleared
|
||||
* |||||----------------- In-service priority Flags set to low level
|
||||
* ||||------------------ Register bank Select 0 Flag cleared
|
||||
* |||------------------- Auxiliary Carry Flag cleared
|
||||
* ||-------------------- Register bank Select 1 Flag cleared
|
||||
* |--------------------- Zero Flag set
|
||||
* ---------------------- Global Interrupt Flag set (enabled)
|
||||
*/
|
||||
#define portPSW (0xc6UL)
|
||||
|
||||
/* We require the address of the pxCurrentTCB variable, but don't want to know
|
||||
any details of its type. */
|
||||
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
|
||||
simply a case of popping the flags from the stack. As 78K0 IAR does not use
|
||||
a frame pointer this cannot be done as modifying the stack will clobber all
|
||||
the stack variables. Instead 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 section is left the count is decremented -
|
||||
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 uint16_t usCriticalNesting = portINITIAL_CRITICAL_NESTING;
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/*
|
||||
* Sets up the periodic ISR used for the RTOS tick.
|
||||
*/
|
||||
static void prvSetupTimerInterrupt( void );
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/*
|
||||
* Initialise the stack of a task to look exactly as if a call to
|
||||
* portSAVE_CONTEXT had been called.
|
||||
*
|
||||
* See the header file portable.h.
|
||||
*/
|
||||
StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, TaskFunction_t pxCode, void *pvParameters )
|
||||
{
|
||||
uint32_t *pulLocal;
|
||||
|
||||
#if configMEMORY_MODE == 1
|
||||
{
|
||||
/* Parameters are passed in on the stack, and written using a 32bit value
|
||||
hence a space is left for the second two bytes. */
|
||||
pxTopOfStack--;
|
||||
|
||||
/* Write in the parameter value. */
|
||||
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 = ( StackType_t ) 0xcdcd;
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( StackType_t ) 0xcdcd;
|
||||
pxTopOfStack--;
|
||||
|
||||
/* The start address / PSW value is also written in as a 32bit value,
|
||||
so leave a space for the second two bytes. */
|
||||
pxTopOfStack--;
|
||||
|
||||
/* Task function start address combined with the PSW. */
|
||||
pulLocal = ( uint32_t * ) pxTopOfStack;
|
||||
*pulLocal = ( ( ( uint32_t ) pxCode ) | ( portPSW << 24UL ) );
|
||||
pxTopOfStack--;
|
||||
|
||||
/* An initial value for the AX register. */
|
||||
*pxTopOfStack = ( StackType_t ) 0x1111;
|
||||
pxTopOfStack--;
|
||||
}
|
||||
#else
|
||||
{
|
||||
/* Task function address is written to the stack first. As it is
|
||||
written as a 32bit value a space is left on the stack for the second
|
||||
two bytes. */
|
||||
pxTopOfStack--;
|
||||
|
||||
/* Task function start address combined with the PSW. */
|
||||
pulLocal = ( uint32_t * ) pxTopOfStack;
|
||||
*pulLocal = ( ( ( uint32_t ) pxCode ) | ( portPSW << 24UL ) );
|
||||
pxTopOfStack--;
|
||||
|
||||
/* The parameter is passed in AX. */
|
||||
*pxTopOfStack = ( StackType_t ) pvParameters;
|
||||
pxTopOfStack--;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* An initial value for the HL register. */
|
||||
*pxTopOfStack = ( StackType_t ) 0x2222;
|
||||
pxTopOfStack--;
|
||||
|
||||
/* CS and ES registers. */
|
||||
*pxTopOfStack = ( StackType_t ) 0x0F00;
|
||||
pxTopOfStack--;
|
||||
|
||||
/* Finally the remaining general purpose registers DE and BC */
|
||||
*pxTopOfStack = ( StackType_t ) 0xDEDE;
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( StackType_t ) 0xBCBC;
|
||||
pxTopOfStack--;
|
||||
|
||||
/* Finally the critical section nesting count is set to zero when the task
|
||||
first starts. */
|
||||
*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. */
|
||||
return pxTopOfStack;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
BaseType_t xPortStartScheduler( void )
|
||||
{
|
||||
/* Setup the hardware to generate the tick. Interrupts are disabled when
|
||||
this function is called. */
|
||||
prvSetupTimerInterrupt();
|
||||
|
||||
/* Restore the context of the first task that is going to run. */
|
||||
vPortStart();
|
||||
|
||||
/* Should not get here as the tasks are now running! */
|
||||
return pdTRUE;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void vPortEndScheduler( void )
|
||||
{
|
||||
/* It is unlikely that the 78K0R port will get stopped. If required simply
|
||||
disable the tick interrupt here. */
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static void prvSetupTimerInterrupt( void )
|
||||
{
|
||||
/* Setup channel 5 of the TAU to generate the tick interrupt. */
|
||||
|
||||
/* First the Timer Array Unit has to be enabled. */
|
||||
TAU0EN = 1;
|
||||
|
||||
/* To configure the Timer Array Unit all Channels have to first be stopped. */
|
||||
TT0 = 0xff;
|
||||
|
||||
/* Interrupt of Timer Array Unit Channel 5 is disabled to set the interrupt
|
||||
priority. */
|
||||
TMMK05 = 1;
|
||||
|
||||
/* Clear Timer Array Unit Channel 5 interrupt flag. */
|
||||
TMIF05 = 0;
|
||||
|
||||
/* Set Timer Array Unit Channel 5 interrupt priority */
|
||||
TMPR005 = 0;
|
||||
TMPR105 = 0;
|
||||
|
||||
/* Set Timer Array Unit Channel 5 Mode as interval timer. */
|
||||
TMR05 = 0x0000;
|
||||
|
||||
/* Set the compare match value according to the tick rate we want. */
|
||||
TDR05 = ( TickType_t ) ( configCPU_CLOCK_HZ / configTICK_RATE_HZ );
|
||||
|
||||
/* Set Timer Array Unit Channel 5 output mode */
|
||||
TOM0 &= ~0x0020;
|
||||
|
||||
/* Set Timer Array Unit Channel 5 output level */
|
||||
TOL0 &= ~0x0020;
|
||||
|
||||
/* Set Timer Array Unit Channel 5 output enable */
|
||||
TOE0 &= ~0x0020;
|
||||
|
||||
/* Interrupt of Timer Array Unit Channel 5 enabled */
|
||||
TMMK05 = 0;
|
||||
|
||||
/* Start Timer Array Unit Channel 5.*/
|
||||
TS0 |= 0x0020;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/*
|
||||
* FreeRTOS Kernel <DEVELOPMENT BRANCH>
|
||||
* Copyright (C) 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* https://www.FreeRTOS.org
|
||||
* https://github.com/FreeRTOS
|
||||
*
|
||||
*/
|
||||
|
||||
/* Standard includes. */
|
||||
#include <stdlib.h>
|
||||
|
||||
/* Scheduler includes. */
|
||||
#include "FreeRTOS.h"
|
||||
#include "task.h"
|
||||
|
||||
/* 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 (( uint16_t ) 10)
|
||||
|
||||
/* Initial PSW value allocated to a newly created task.
|
||||
* 1100011000000000
|
||||
* ||||||||-------------- Fill byte
|
||||
* |||||||--------------- Carry Flag cleared
|
||||
* |||||----------------- In-service priority Flags set to low level
|
||||
* ||||------------------ Register bank Select 0 Flag cleared
|
||||
* |||------------------- Auxiliary Carry Flag cleared
|
||||
* ||-------------------- Register bank Select 1 Flag cleared
|
||||
* |--------------------- Zero Flag set
|
||||
* ---------------------- Global Interrupt Flag set (enabled)
|
||||
*/
|
||||
#define portPSW (0xc6UL)
|
||||
|
||||
/* We require the address of the pxCurrentTCB variable, but don't want to know
|
||||
any details of its type. */
|
||||
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
|
||||
simply a case of popping the flags from the stack. As 78K0 IAR does not use
|
||||
a frame pointer this cannot be done as modifying the stack will clobber all
|
||||
the stack variables. Instead 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 section is left the count is decremented -
|
||||
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 uint16_t usCriticalNesting = portINITIAL_CRITICAL_NESTING;
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/*
|
||||
* Sets up the periodic ISR used for the RTOS tick.
|
||||
*/
|
||||
static void prvSetupTimerInterrupt( void );
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/*
|
||||
* Initialise the stack of a task to look exactly as if a call to
|
||||
* portSAVE_CONTEXT had been called.
|
||||
*
|
||||
* See the header file portable.h.
|
||||
*/
|
||||
StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, TaskFunction_t pxCode, void *pvParameters )
|
||||
{
|
||||
uint32_t *pulLocal;
|
||||
|
||||
#if configMEMORY_MODE == 1
|
||||
{
|
||||
/* Parameters are passed in on the stack, and written using a 32bit value
|
||||
hence a space is left for the second two bytes. */
|
||||
pxTopOfStack--;
|
||||
|
||||
/* Write in the parameter value. */
|
||||
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 = ( StackType_t ) 0xcdcd;
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( StackType_t ) 0xcdcd;
|
||||
pxTopOfStack--;
|
||||
|
||||
/* The start address / PSW value is also written in as a 32bit value,
|
||||
so leave a space for the second two bytes. */
|
||||
pxTopOfStack--;
|
||||
|
||||
/* Task function start address combined with the PSW. */
|
||||
pulLocal = ( uint32_t * ) pxTopOfStack;
|
||||
*pulLocal = ( ( ( uint32_t ) pxCode ) | ( portPSW << 24UL ) );
|
||||
pxTopOfStack--;
|
||||
|
||||
/* An initial value for the AX register. */
|
||||
*pxTopOfStack = ( StackType_t ) 0x1111;
|
||||
pxTopOfStack--;
|
||||
}
|
||||
#else
|
||||
{
|
||||
/* Task function address is written to the stack first. As it is
|
||||
written as a 32bit value a space is left on the stack for the second
|
||||
two bytes. */
|
||||
pxTopOfStack--;
|
||||
|
||||
/* Task function start address combined with the PSW. */
|
||||
pulLocal = ( uint32_t * ) pxTopOfStack;
|
||||
*pulLocal = ( ( ( uint32_t ) pxCode ) | ( portPSW << 24UL ) );
|
||||
pxTopOfStack--;
|
||||
|
||||
/* The parameter is passed in AX. */
|
||||
*pxTopOfStack = ( StackType_t ) pvParameters;
|
||||
pxTopOfStack--;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* An initial value for the HL register. */
|
||||
*pxTopOfStack = ( StackType_t ) 0x2222;
|
||||
pxTopOfStack--;
|
||||
|
||||
/* CS and ES registers. */
|
||||
*pxTopOfStack = ( StackType_t ) 0x0F00;
|
||||
pxTopOfStack--;
|
||||
|
||||
/* Finally the remaining general purpose registers DE and BC */
|
||||
*pxTopOfStack = ( StackType_t ) 0xDEDE;
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( StackType_t ) 0xBCBC;
|
||||
pxTopOfStack--;
|
||||
|
||||
/* Finally the critical section nesting count is set to zero when the task
|
||||
first starts. */
|
||||
*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. */
|
||||
return pxTopOfStack;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
BaseType_t xPortStartScheduler( void )
|
||||
{
|
||||
/* Setup the hardware to generate the tick. Interrupts are disabled when
|
||||
this function is called. */
|
||||
prvSetupTimerInterrupt();
|
||||
|
||||
/* Restore the context of the first task that is going to run. */
|
||||
vPortStart();
|
||||
|
||||
/* Should not get here as the tasks are now running! */
|
||||
return pdTRUE;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void vPortEndScheduler( void )
|
||||
{
|
||||
/* It is unlikely that the 78K0R port will get stopped. If required simply
|
||||
disable the tick interrupt here. */
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static void prvSetupTimerInterrupt( void )
|
||||
{
|
||||
/* Setup channel 5 of the TAU to generate the tick interrupt. */
|
||||
|
||||
/* First the Timer Array Unit has to be enabled. */
|
||||
TAU0EN = 1;
|
||||
|
||||
/* To configure the Timer Array Unit all Channels have to first be stopped. */
|
||||
TT0 = 0xff;
|
||||
|
||||
/* Interrupt of Timer Array Unit Channel 5 is disabled to set the interrupt
|
||||
priority. */
|
||||
TMMK05 = 1;
|
||||
|
||||
/* Clear Timer Array Unit Channel 5 interrupt flag. */
|
||||
TMIF05 = 0;
|
||||
|
||||
/* Set Timer Array Unit Channel 5 interrupt priority */
|
||||
TMPR005 = 0;
|
||||
TMPR105 = 0;
|
||||
|
||||
/* Set Timer Array Unit Channel 5 Mode as interval timer. */
|
||||
TMR05 = 0x0000;
|
||||
|
||||
/* Set the compare match value according to the tick rate we want. */
|
||||
TDR05 = ( TickType_t ) ( configCPU_CLOCK_HZ / configTICK_RATE_HZ );
|
||||
|
||||
/* Set Timer Array Unit Channel 5 output mode */
|
||||
TOM0 &= ~0x0020;
|
||||
|
||||
/* Set Timer Array Unit Channel 5 output level */
|
||||
TOL0 &= ~0x0020;
|
||||
|
||||
/* Set Timer Array Unit Channel 5 output enable */
|
||||
TOE0 &= ~0x0020;
|
||||
|
||||
/* Interrupt of Timer Array Unit Channel 5 enabled */
|
||||
TMMK05 = 0;
|
||||
|
||||
/* Start Timer Array Unit Channel 5.*/
|
||||
TS0 |= 0x0020;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
|
|
@ -1,139 +1,139 @@
|
|||
;/*
|
||||
; * FreeRTOS Kernel <DEVELOPMENT BRANCH>
|
||||
; * Copyright (C) 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
; *
|
||||
; * SPDX-License-Identifier: MIT
|
||||
; *
|
||||
; * Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
; * this software and associated documentation files (the "Software"), to deal in
|
||||
; * the Software without restriction, including without limitation the rights to
|
||||
; * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
; * the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
; * subject to the following conditions:
|
||||
; *
|
||||
; * The above copyright notice and this permission notice shall be included in all
|
||||
; * copies or substantial portions of the Software.
|
||||
; *
|
||||
; * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
; * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
; * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
; * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
; * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
; * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
; *
|
||||
; * https://www.FreeRTOS.org
|
||||
; * https://github.com/FreeRTOS
|
||||
; *
|
||||
; */
|
||||
|
||||
#include "ISR_Support.h"
|
||||
;------------------------------------------------------------------------------
|
||||
|
||||
#if __CORE__ != __78K0R__
|
||||
#error "This file is only for 78K0R Devices"
|
||||
#endif
|
||||
|
||||
#define CS 0xFFFFC
|
||||
#define ES 0xFFFFD
|
||||
|
||||
; Functions implemented in this file
|
||||
;------------------------------------------------------------------------------
|
||||
PUBLIC vPortYield
|
||||
PUBLIC vPortStart
|
||||
|
||||
; Functions used by scheduler
|
||||
;------------------------------------------------------------------------------
|
||||
EXTERN vTaskSwitchContext
|
||||
EXTERN xTaskIncrementTick
|
||||
|
||||
; Tick ISR Prototype
|
||||
;------------------------------------------------------------------------------
|
||||
; EXTERN ?CL78K0R_V2_L00
|
||||
|
||||
PUBWEAK `??MD_INTTM05??INTVEC 68`
|
||||
PUBLIC MD_INTTM05
|
||||
|
||||
MD_INTTM05 SYMBOL "MD_INTTM05"
|
||||
`??MD_INTTM05??INTVEC 68` SYMBOL "??INTVEC 68", MD_INTTM05
|
||||
|
||||
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
; Yield to another task. Implemented as a software interrupt. The return
|
||||
; address and PSW will have been saved to the stack automatically before
|
||||
; this code runs.
|
||||
;
|
||||
; Input: NONE
|
||||
;
|
||||
; Call: CALL vPortYield
|
||||
;
|
||||
; Output: NONE
|
||||
;
|
||||
;------------------------------------------------------------------------------
|
||||
RSEG CODE:CODE
|
||||
vPortYield:
|
||||
portSAVE_CONTEXT ; Save the context of the current task.
|
||||
call vTaskSwitchContext ; Call the scheduler to select the next task.
|
||||
portRESTORE_CONTEXT ; Restore the context of the next task to run.
|
||||
retb
|
||||
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
; Restore the context of the first task that is going to run.
|
||||
;
|
||||
; Input: NONE
|
||||
;
|
||||
; Call: CALL vPortStart
|
||||
;
|
||||
; Output: NONE
|
||||
;
|
||||
;------------------------------------------------------------------------------
|
||||
RSEG CODE:CODE
|
||||
vPortStart:
|
||||
portRESTORE_CONTEXT ; Restore the context of whichever task the ...
|
||||
reti ; An interrupt stack frame is used so the task
|
||||
; is started using a RETI instruction.
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
; Perform the necessary steps of the Tick Count Increment and Task Switch
|
||||
; depending on the chosen kernel configuration
|
||||
;
|
||||
; Input: NONE
|
||||
;
|
||||
; Call: ISR
|
||||
;
|
||||
; Output: NONE
|
||||
;
|
||||
;------------------------------------------------------------------------------
|
||||
|
||||
MD_INTTM05:
|
||||
|
||||
portSAVE_CONTEXT ; Save the context of the current task.
|
||||
call xTaskIncrementTick ; Call the timer tick function.
|
||||
#if configUSE_PREEMPTION == 1
|
||||
call vTaskSwitchContext ; Call the scheduler to select the next task.
|
||||
#endif
|
||||
portRESTORE_CONTEXT ; Restore the context of the next task to run.
|
||||
reti
|
||||
|
||||
|
||||
|
||||
; REQUIRE ?CL78K0R_V2_L00
|
||||
COMMON INTVEC:CODE:ROOT(1) ; Set ISR location to the Interrupt vector table.
|
||||
ORG 68
|
||||
`??MD_INTTM05??INTVEC 68`:
|
||||
DW MD_INTTM05
|
||||
|
||||
COMMON INTVEC:CODE:ROOT(1) ; Set ISR location to the Interrupt vector table.
|
||||
ORG 126
|
||||
`??vPortYield??INTVEC 126`:
|
||||
DW vPortYield
|
||||
|
||||
; Set value for the usCriticalNesting.
|
||||
RSEG NEAR_ID:CONST:SORT:NOROOT(1)
|
||||
`?<Initializer for usCriticalNesting>`:
|
||||
DW 10
|
||||
|
||||
;#endif
|
||||
|
||||
END
|
||||
;/*
|
||||
; * FreeRTOS Kernel <DEVELOPMENT BRANCH>
|
||||
; * Copyright (C) 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
; *
|
||||
; * SPDX-License-Identifier: MIT
|
||||
; *
|
||||
; * Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
; * this software and associated documentation files (the "Software"), to deal in
|
||||
; * the Software without restriction, including without limitation the rights to
|
||||
; * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
; * the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
; * subject to the following conditions:
|
||||
; *
|
||||
; * The above copyright notice and this permission notice shall be included in all
|
||||
; * copies or substantial portions of the Software.
|
||||
; *
|
||||
; * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
; * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
; * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
; * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
; * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
; * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
; *
|
||||
; * https://www.FreeRTOS.org
|
||||
; * https://github.com/FreeRTOS
|
||||
; *
|
||||
; */
|
||||
|
||||
#include "ISR_Support.h"
|
||||
;------------------------------------------------------------------------------
|
||||
|
||||
#if __CORE__ != __78K0R__
|
||||
#error "This file is only for 78K0R Devices"
|
||||
#endif
|
||||
|
||||
#define CS 0xFFFFC
|
||||
#define ES 0xFFFFD
|
||||
|
||||
; Functions implemented in this file
|
||||
;------------------------------------------------------------------------------
|
||||
PUBLIC vPortYield
|
||||
PUBLIC vPortStart
|
||||
|
||||
; Functions used by scheduler
|
||||
;------------------------------------------------------------------------------
|
||||
EXTERN vTaskSwitchContext
|
||||
EXTERN xTaskIncrementTick
|
||||
|
||||
; Tick ISR Prototype
|
||||
;------------------------------------------------------------------------------
|
||||
; EXTERN ?CL78K0R_V2_L00
|
||||
|
||||
PUBWEAK `??MD_INTTM05??INTVEC 68`
|
||||
PUBLIC MD_INTTM05
|
||||
|
||||
MD_INTTM05 SYMBOL "MD_INTTM05"
|
||||
`??MD_INTTM05??INTVEC 68` SYMBOL "??INTVEC 68", MD_INTTM05
|
||||
|
||||
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
; Yield to another task. Implemented as a software interrupt. The return
|
||||
; address and PSW will have been saved to the stack automatically before
|
||||
; this code runs.
|
||||
;
|
||||
; Input: NONE
|
||||
;
|
||||
; Call: CALL vPortYield
|
||||
;
|
||||
; Output: NONE
|
||||
;
|
||||
;------------------------------------------------------------------------------
|
||||
RSEG CODE:CODE
|
||||
vPortYield:
|
||||
portSAVE_CONTEXT ; Save the context of the current task.
|
||||
call vTaskSwitchContext ; Call the scheduler to select the next task.
|
||||
portRESTORE_CONTEXT ; Restore the context of the next task to run.
|
||||
retb
|
||||
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
; Restore the context of the first task that is going to run.
|
||||
;
|
||||
; Input: NONE
|
||||
;
|
||||
; Call: CALL vPortStart
|
||||
;
|
||||
; Output: NONE
|
||||
;
|
||||
;------------------------------------------------------------------------------
|
||||
RSEG CODE:CODE
|
||||
vPortStart:
|
||||
portRESTORE_CONTEXT ; Restore the context of whichever task the ...
|
||||
reti ; An interrupt stack frame is used so the task
|
||||
; is started using a RETI instruction.
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
; Perform the necessary steps of the Tick Count Increment and Task Switch
|
||||
; depending on the chosen kernel configuration
|
||||
;
|
||||
; Input: NONE
|
||||
;
|
||||
; Call: ISR
|
||||
;
|
||||
; Output: NONE
|
||||
;
|
||||
;------------------------------------------------------------------------------
|
||||
|
||||
MD_INTTM05:
|
||||
|
||||
portSAVE_CONTEXT ; Save the context of the current task.
|
||||
call xTaskIncrementTick ; Call the timer tick function.
|
||||
#if configUSE_PREEMPTION == 1
|
||||
call vTaskSwitchContext ; Call the scheduler to select the next task.
|
||||
#endif
|
||||
portRESTORE_CONTEXT ; Restore the context of the next task to run.
|
||||
reti
|
||||
|
||||
|
||||
|
||||
; REQUIRE ?CL78K0R_V2_L00
|
||||
COMMON INTVEC:CODE:ROOT(1) ; Set ISR location to the Interrupt vector table.
|
||||
ORG 68
|
||||
`??MD_INTTM05??INTVEC 68`:
|
||||
DW MD_INTTM05
|
||||
|
||||
COMMON INTVEC:CODE:ROOT(1) ; Set ISR location to the Interrupt vector table.
|
||||
ORG 126
|
||||
`??vPortYield??INTVEC 126`:
|
||||
DW vPortYield
|
||||
|
||||
; Set value for the usCriticalNesting.
|
||||
RSEG NEAR_ID:CONST:SORT:NOROOT(1)
|
||||
`?<Initializer for usCriticalNesting>`:
|
||||
DW 10
|
||||
|
||||
;#endif
|
||||
|
||||
END
|
||||
|
|
|
@ -1,146 +1,145 @@
|
|||
/*
|
||||
* FreeRTOS Kernel <DEVELOPMENT BRANCH>
|
||||
* Copyright (C) 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* https://www.FreeRTOS.org
|
||||
* https://github.com/FreeRTOS
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef PORTMACRO_H
|
||||
#define PORTMACRO_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*-----------------------------------------------------------
|
||||
* Port specific definitions.
|
||||
*
|
||||
* The settings in this file configure FreeRTOS correctly for the
|
||||
* given hardware and compiler.
|
||||
*
|
||||
* These settings should not be altered.
|
||||
*-----------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* Type definitions. */
|
||||
|
||||
#define portCHAR char
|
||||
#define portFLOAT float
|
||||
#define portDOUBLE double
|
||||
#define portLONG long
|
||||
#define portSHORT 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 TickType_t;
|
||||
#define portMAX_DELAY ( TickType_t ) 0xffff
|
||||
#else
|
||||
typedef uint32_t TickType_t;
|
||||
#define portMAX_DELAY ( TickType_t ) 0xffffffffUL
|
||||
#endif
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* Interrupt control macros. */
|
||||
#define portDISABLE_INTERRUPTS() __asm ( "DI" )
|
||||
#define portENABLE_INTERRUPTS() __asm ( "EI" )
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* Critical section control macros. */
|
||||
#define portNO_CRITICAL_SECTION_NESTING ( ( uint16_t ) 0 )
|
||||
|
||||
#define portENTER_CRITICAL() \
|
||||
{ \
|
||||
extern volatile uint16_t usCriticalNesting; \
|
||||
\
|
||||
portDISABLE_INTERRUPTS(); \
|
||||
\
|
||||
/* Now interrupts are disabled ulCriticalNesting can be accessed */ \
|
||||
/* directly. Increment ulCriticalNesting to keep a count of how many */ \
|
||||
/* times portENTER_CRITICAL() has been called. */ \
|
||||
usCriticalNesting++; \
|
||||
}
|
||||
|
||||
#define portEXIT_CRITICAL() \
|
||||
{ \
|
||||
extern volatile uint16_t usCriticalNesting; \
|
||||
\
|
||||
if( usCriticalNesting > portNO_CRITICAL_SECTION_NESTING ) \
|
||||
{ \
|
||||
/* Decrement the nesting count as we are leaving a critical section. */ \
|
||||
usCriticalNesting--; \
|
||||
\
|
||||
/* If the nesting level has reached zero then interrupts should be */ \
|
||||
/* re-enabled. */ \
|
||||
if( usCriticalNesting == portNO_CRITICAL_SECTION_NESTING ) \
|
||||
{ \
|
||||
portENABLE_INTERRUPTS(); \
|
||||
} \
|
||||
} \
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* Task utilities. */
|
||||
extern void vPortStart( void );
|
||||
#define portYIELD() __asm( "BRK" )
|
||||
#define portYIELD_FROM_ISR( xHigherPriorityTaskWoken ) do { if( xHigherPriorityTaskWoken ) vTaskSwitchContext(); } while( 0 )
|
||||
#define portNOP() __asm( "NOP" )
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* Hardwware specifics. */
|
||||
#define portBYTE_ALIGNMENT 2
|
||||
#define portSTACK_GROWTH ( -1 )
|
||||
#define portTICK_PERIOD_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ )
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* Task function macros as described on the FreeRTOS.org WEB site. */
|
||||
#define portTASK_FUNCTION_PROTO( vFunction, pvParameters ) void vFunction( void *pvParameters )
|
||||
#define portTASK_FUNCTION( vFunction, pvParameters ) void vFunction( void *pvParameters )
|
||||
|
||||
|
||||
static __interrupt void P0_isr (void);
|
||||
|
||||
/* --------------------------------------------------------------------------*/
|
||||
/* Option-bytes and security ID */
|
||||
/* --------------------------------------------------------------------------*/
|
||||
#define OPT_BYTES_SIZE 4
|
||||
#define SECU_ID_SIZE 10
|
||||
#define WATCHDOG_DISABLED 0x00
|
||||
#define LVI_ENABLED 0xFE
|
||||
#define LVI_DISABLED 0xFF
|
||||
#define RESERVED_FF 0xFF
|
||||
#define OCD_DISABLED 0x04
|
||||
#define OCD_ENABLED 0x81
|
||||
#define OCD_ENABLED_ERASE 0x80
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* PORTMACRO_H */
|
||||
|
||||
/*
|
||||
* FreeRTOS Kernel <DEVELOPMENT BRANCH>
|
||||
* Copyright (C) 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* https://www.FreeRTOS.org
|
||||
* https://github.com/FreeRTOS
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef PORTMACRO_H
|
||||
#define PORTMACRO_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*-----------------------------------------------------------
|
||||
* Port specific definitions.
|
||||
*
|
||||
* The settings in this file configure FreeRTOS correctly for the
|
||||
* given hardware and compiler.
|
||||
*
|
||||
* These settings should not be altered.
|
||||
*-----------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* Type definitions. */
|
||||
|
||||
#define portCHAR char
|
||||
#define portFLOAT float
|
||||
#define portDOUBLE double
|
||||
#define portLONG long
|
||||
#define portSHORT 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 TickType_t;
|
||||
#define portMAX_DELAY ( TickType_t ) 0xffff
|
||||
#else
|
||||
typedef uint32_t TickType_t;
|
||||
#define portMAX_DELAY ( TickType_t ) 0xffffffffUL
|
||||
#endif
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* Interrupt control macros. */
|
||||
#define portDISABLE_INTERRUPTS() __asm ( "DI" )
|
||||
#define portENABLE_INTERRUPTS() __asm ( "EI" )
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* Critical section control macros. */
|
||||
#define portNO_CRITICAL_SECTION_NESTING ( ( uint16_t ) 0 )
|
||||
|
||||
#define portENTER_CRITICAL() \
|
||||
{ \
|
||||
extern volatile uint16_t usCriticalNesting; \
|
||||
\
|
||||
portDISABLE_INTERRUPTS(); \
|
||||
\
|
||||
/* Now interrupts are disabled ulCriticalNesting can be accessed */ \
|
||||
/* directly. Increment ulCriticalNesting to keep a count of how many */ \
|
||||
/* times portENTER_CRITICAL() has been called. */ \
|
||||
usCriticalNesting++; \
|
||||
}
|
||||
|
||||
#define portEXIT_CRITICAL() \
|
||||
{ \
|
||||
extern volatile uint16_t usCriticalNesting; \
|
||||
\
|
||||
if( usCriticalNesting > portNO_CRITICAL_SECTION_NESTING ) \
|
||||
{ \
|
||||
/* Decrement the nesting count as we are leaving a critical section. */ \
|
||||
usCriticalNesting--; \
|
||||
\
|
||||
/* If the nesting level has reached zero then interrupts should be */ \
|
||||
/* re-enabled. */ \
|
||||
if( usCriticalNesting == portNO_CRITICAL_SECTION_NESTING ) \
|
||||
{ \
|
||||
portENABLE_INTERRUPTS(); \
|
||||
} \
|
||||
} \
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* Task utilities. */
|
||||
extern void vPortStart( void );
|
||||
#define portYIELD() __asm( "BRK" )
|
||||
#define portYIELD_FROM_ISR( xHigherPriorityTaskWoken ) do { if( xHigherPriorityTaskWoken ) vTaskSwitchContext(); } while( 0 )
|
||||
#define portNOP() __asm( "NOP" )
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* Hardwware specifics. */
|
||||
#define portBYTE_ALIGNMENT 2
|
||||
#define portSTACK_GROWTH ( -1 )
|
||||
#define portTICK_PERIOD_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ )
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* Task function macros as described on the FreeRTOS.org WEB site. */
|
||||
#define portTASK_FUNCTION_PROTO( vFunction, pvParameters ) void vFunction( void *pvParameters )
|
||||
#define portTASK_FUNCTION( vFunction, pvParameters ) void vFunction( void *pvParameters )
|
||||
|
||||
|
||||
static __interrupt void P0_isr (void);
|
||||
|
||||
/* --------------------------------------------------------------------------*/
|
||||
/* Option-bytes and security ID */
|
||||
/* --------------------------------------------------------------------------*/
|
||||
#define OPT_BYTES_SIZE 4
|
||||
#define SECU_ID_SIZE 10
|
||||
#define WATCHDOG_DISABLED 0x00
|
||||
#define LVI_ENABLED 0xFE
|
||||
#define LVI_DISABLED 0xFF
|
||||
#define RESERVED_FF 0xFF
|
||||
#define OCD_DISABLED 0x04
|
||||
#define OCD_ENABLED 0x81
|
||||
#define OCD_ENABLED_ERASE 0x80
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* PORTMACRO_H */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue