Tidy up - spell check.

pull/1/head
Richard Barry
parent c3e153145b
commit 5a418b56fa

@ -56,8 +56,6 @@ extern volatile tskTCB * volatile pxCurrentTCB;
volatile unsigned portLONG ulCriticalNesting = 9999UL; volatile unsigned portLONG ulCriticalNesting = 9999UL;
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
#pragma asm #pragma asm
#macro SaveContext #macro SaveContext
@ -104,7 +102,7 @@ volatile unsigned portLONG ulCriticalNesting = 9999UL;
ANDCCR #0xDF ;Switch to system stack ANDCCR #0xDF ;Switch to system stack
ST R0,@-R15 ;Store PC to system stack ST R0,@-R15 ;Store PC to system stack
ORCCR #0x20 ;Switch back to retreive the remaining context ORCCR #0x20 ;Switch back to retrieve the remaining context
LDI #_ulCriticalNesting, R0 ;Get the address of the critical nesting counter LDI #_ulCriticalNesting, R0 ;Get the address of the critical nesting counter
LD @R15+, R1 ;Get the saved critical nesting value LD @R15+, R1 ;Get the saved critical nesting value
@ -146,14 +144,14 @@ portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE
*pxTopOfStack = 0x33333333; *pxTopOfStack = 0x33333333;
pxTopOfStack--; pxTopOfStack--;
/* This is a redundant push to the stack, it may be required if in some implentation of the compiler /* This is a redundant push to the stack, it may be required if
the parameter to the task is passed on to the stack rather than in R4 register*/ in some implementations of the compiler the parameter to the task
is passed on to the stack rather than in R4 register. */
*pxTopOfStack = (portSTACK_TYPE)(pvParameters); *pxTopOfStack = (portSTACK_TYPE)(pvParameters);
pxTopOfStack--; pxTopOfStack--;
*pxTopOfStack = ( portSTACK_TYPE ) 0x00000000; /* RP */ *pxTopOfStack = ( portSTACK_TYPE ) 0x00000000; /* RP */
pxTopOfStack--; pxTopOfStack--;
*pxTopOfStack = ( portSTACK_TYPE ) 0x00007777; /* R7 */ *pxTopOfStack = ( portSTACK_TYPE ) 0x00007777; /* R7 */
pxTopOfStack--; pxTopOfStack--;
*pxTopOfStack = ( portSTACK_TYPE ) 0x00006666; /* R6 */ *pxTopOfStack = ( portSTACK_TYPE ) 0x00006666; /* R6 */
@ -161,10 +159,10 @@ portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE
*pxTopOfStack = ( portSTACK_TYPE ) 0x00005555; /* R5 */ *pxTopOfStack = ( portSTACK_TYPE ) 0x00005555; /* R5 */
pxTopOfStack--; pxTopOfStack--;
/* In the current implemention of the compiler the first /* In the current implementation of the compiler the first
parameter to the task(or function) is passed via R4 parameter parameter to the task (or function) is passed via R4 parameter
to the task, hennce the pvParameters pointer is copied in R4 to the task, hence the pvParameters pointer is copied into the R4
regsiter. See compiler manual section 4.6.2 for more information.*/ register. See compiler manual section 4.6.2 for more information. */
*pxTopOfStack = ( portSTACK_TYPE ) (pvParameters); /* R4 */ *pxTopOfStack = ( portSTACK_TYPE ) (pvParameters); /* R4 */
pxTopOfStack--; pxTopOfStack--;
*pxTopOfStack = ( portSTACK_TYPE ) 0x00003333; /* R3 */ *pxTopOfStack = ( portSTACK_TYPE ) 0x00003333; /* R3 */
@ -174,8 +172,7 @@ portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE
*pxTopOfStack = ( portSTACK_TYPE ) 0x00001111; /* R1 */ *pxTopOfStack = ( portSTACK_TYPE ) 0x00001111; /* R1 */
pxTopOfStack--; pxTopOfStack--;
*pxTopOfStack = ( portSTACK_TYPE ) 0x00000001; /* R0 */ *pxTopOfStack = ( portSTACK_TYPE ) 0x00000001; /* R0 */
pxTopOfStack--; pxTopOfStack--;
*pxTopOfStack = ( portSTACK_TYPE ) 0x0000EEEE; /* R14 */ *pxTopOfStack = ( portSTACK_TYPE ) 0x0000EEEE; /* R14 */
pxTopOfStack--; pxTopOfStack--;
*pxTopOfStack = ( portSTACK_TYPE ) 0x0000DDDD; /* R13 */ *pxTopOfStack = ( portSTACK_TYPE ) 0x0000DDDD; /* R13 */
@ -189,15 +186,14 @@ portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE
*pxTopOfStack = ( portSTACK_TYPE ) 0x00009999; /* R9 */ *pxTopOfStack = ( portSTACK_TYPE ) 0x00009999; /* R9 */
pxTopOfStack--; pxTopOfStack--;
*pxTopOfStack = ( portSTACK_TYPE ) 0x00008888; /* R8 */ *pxTopOfStack = ( portSTACK_TYPE ) 0x00008888; /* R8 */
pxTopOfStack--; pxTopOfStack--;
*pxTopOfStack = ( portSTACK_TYPE ) 0x11110000; /* MDH */ *pxTopOfStack = ( portSTACK_TYPE ) 0x11110000; /* MDH */
pxTopOfStack--; pxTopOfStack--;
*pxTopOfStack = ( portSTACK_TYPE ) 0x22220000; /* MDL */ *pxTopOfStack = ( portSTACK_TYPE ) 0x22220000; /* MDL */
pxTopOfStack--; pxTopOfStack--;
/* The task starts with its ulCriticalNesting variable set to 0, interrupts /* The task starts with its ulCriticalNesting variable set to 0,
being enabled. */ interrupts being enabled. */
*pxTopOfStack = portNO_CRITICAL_NESTING; *pxTopOfStack = portNO_CRITICAL_NESTING;
pxTopOfStack--; pxTopOfStack--;
@ -218,18 +214,16 @@ portBASE_TYPE xPortStartScheduler( void )
prvSetupTimerInterrupt(); prvSetupTimerInterrupt();
/* Restore the context of the first task that is going to run. */ /* Restore the context of the first task that is going to run. */
#pragma asm #pragma asm
RestoreContext RestoreContext
#pragma endasm #pragma endasm
/* Simulate a function call end as generated by the compiler. We will now /* Simulate a function call end as generated by the compiler. We will now
jump to the start of the task the context of which we have just restored. */ jump to the start of the task the context of which we have just restored. */
__asm(" reti "); __asm(" reti ");
/* Should not get here. */ /* Should not get here. */
return pdTRUE; return pdFAIL;
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
@ -240,26 +234,25 @@ void vPortEndScheduler( void )
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
/*
* Setup RLT0 to generate a tick interrupt.
*/
static void prvSetupTimerInterrupt( void ) static void prvSetupTimerInterrupt( void )
{ {
/* The peripheral clock divided by 32 is used by the timer. */ /* The peripheral clock divided by 32 is used by the timer. */
const unsigned portSHORT usReloadValue = ( unsigned portSHORT ) ( ( ( configPER_CLOCK_HZ / configTICK_RATE_HZ ) / 32UL ) - 1UL ); const unsigned portSHORT usReloadValue = ( unsigned portSHORT ) ( ( ( configPER_CLOCK_HZ / configTICK_RATE_HZ ) / 32UL ) - 1UL );
TMCSR0_CNTE=0; /* Count Disable */ /* Setup RLT0 to generate a tick interrupt. */
TMCSR0_CSL=0x2; /* CLKP/32 */
TMCSR0_MOD=0; /* Software trigger */ TMCSR0_CNTE = 0; /* Count Disable */
TMCSR0_RELD=1; /* Reload */ TMCSR0_CSL = 0x2; /* CLKP/32 */
TMCSR0_MOD = 0; /* Software trigger */
TMCSR0_RELD = 1; /* Reload */
TMCSR0_UF=0; /* Clear underflow flag */ TMCSR0_UF = 0; /* Clear underflow flag */
TMRLR0=usReloadValue; TMRLR0 = usReloadValue;
TMCSR0_INTE=1; /* Interrupt Enable */ TMCSR0_INTE = 1; /* Interrupt Enable */
TMCSR0_CNTE=1; /* Count Enable */ TMCSR0_CNTE = 1; /* Count Enable */
TMCSR0_TRG=1; /* Trigger */ TMCSR0_TRG = 1; /* Trigger */
PORTEN = 0x3; /* Port Enable */ PORTEN = 0x3; /* Port Enable */
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
@ -268,7 +261,7 @@ const unsigned portSHORT usReloadValue = ( unsigned portSHORT ) ( ( ( configPER_
/* /*
* Tick ISR for preemptive scheduler. The tick count is incremented * Tick ISR for preemptive scheduler. The tick count is incremented
* after the context is saved. Then the context is switched if required, * after the context is saved. Then the context is switched if required,
* at last the context of the task which is to be resume is restored. * and last the context of the task which is to be resumed is restored.
*/ */
#pragma asm #pragma asm
@ -277,9 +270,7 @@ const unsigned portSHORT usReloadValue = ( unsigned portSHORT ) ( ( ( configPER_
_ReloadTimer0_IRQHandler: _ReloadTimer0_IRQHandler:
ANDCCR #0xEF ;Disable Interrupts ANDCCR #0xEF ;Disable Interrupts
SaveContext ;Save context SaveContext ;Save context
ORCCR #0x10 ;Re-enable Interrupts ORCCR #0x10 ;Re-enable Interrupts
LDI #0xFFFB,R1 LDI #0xFFFB,R1
@ -287,13 +278,10 @@ const unsigned portSHORT usReloadValue = ( unsigned portSHORT ) ( ( ( configPER_
AND R1,@R0 ;Clear RLT0 interrupt flag AND R1,@R0 ;Clear RLT0 interrupt flag
CALL32 _vTaskIncrementTick,R12 ;Increment Tick CALL32 _vTaskIncrementTick,R12 ;Increment Tick
CALL32 _vTaskSwitchContext,R12 ;Switch context if required CALL32 _vTaskSwitchContext,R12 ;Switch context if required
ANDCCR #0xEF ;Disable Interrupts ANDCCR #0xEF ;Disable Interrupts
RestoreContext ;Restore context RestoreContext ;Restore context
ORCCR #0x10 ;Re-enable Interrupts ORCCR #0x10 ;Re-enable Interrupts
RETI RETI
@ -316,20 +304,18 @@ const unsigned portSHORT usReloadValue = ( unsigned portSHORT ) ( ( ( configPER_
#endif #endif
/* /*
* Manual context switch. We can use a __nosavereg attribute as the context * Manual context switch. We can use a __nosavereg attribute as the context
* would be saved by PortSAVE_CONTEXT(). The context is switched and then * would be saved by PortSAVE_CONTEXT(). The context is switched and then
* the context of the new task is restored saved. * the context of the new task is restored saved.
*/ */
#pragma asm #pragma asm
.global _vPortYieldDelayed .global _vPortYieldDelayed
_vPortYieldDelayed: _vPortYieldDelayed:
ANDCCR #0xEF ;Disable Interrupts ANDCCR #0xEF ;Disable Interrupts
SaveContext ;Save context SaveContext ;Save context
ORCCR #0x10 ;Re-enable Interrupts ORCCR #0x10 ;Re-enable Interrupts
LDI #_dicr, R0 LDI #_dicr, R0
@ -338,36 +324,31 @@ const unsigned portSHORT usReloadValue = ( unsigned portSHORT ) ( ( ( configPER_
CALL32 _vTaskSwitchContext,R12 ;Switch context if required CALL32 _vTaskSwitchContext,R12 ;Switch context if required
ANDCCR #0xEF ;Disable Interrupts ANDCCR #0xEF ;Disable Interrupts
RestoreContext ;Restore context RestoreContext ;Restore context
ORCCR #0x10 ;Re-enable Interrupts ORCCR #0x10 ;Re-enable Interrupts
RETI RETI
#pragma endasm #pragma endasm
/*-----------------------------------------------------------*/
/* /*
* Manual context switch. We can use a __nosavereg attribute as the context * Manual context switch. We can use a __nosavereg attribute as the context
* would be saved by PortSAVE_CONTEXT(). The context is switched and then * would be saved by PortSAVE_CONTEXT(). The context is switched and then
* the context of the new task is restored saved. * the context of the new task is restored saved.
*/ */
#pragma asm #pragma asm
.global _vPortYield .global _vPortYield
_vPortYield: _vPortYield:
SaveContext ;Save context SaveContext ;Save context
CALL32 _vTaskSwitchContext,R12 ;Switch context if required CALL32 _vTaskSwitchContext,R12 ;Switch context if required
RestoreContext ;Restore context RestoreContext ;Restore context
RETI RETI
#pragma endasm #pragma endasm
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
void vPortEnterCritical( void ) void vPortEnterCritical( void )

@ -43,7 +43,10 @@
#ifndef PORTMACRO_H #ifndef PORTMACRO_H
#define PORTMACRO_H #define PORTMACRO_H
/* Hardware specific includes. */
#include "mb91467d.h" #include "mb91467d.h"
/* Standard includes. */
#include <stddef.h> #include <stddef.h>
/*----------------------------------------------------------- /*-----------------------------------------------------------
@ -65,9 +68,6 @@
#define portSTACK_TYPE unsigned portLONG #define portSTACK_TYPE unsigned portLONG
#define portBASE_TYPE long #define portBASE_TYPE long
/* This is required since SOFTUNE doesn't support inline directive as is. */
#define inline
#if( configUSE_16_BIT_TICKS == 1 ) #if( configUSE_16_BIT_TICKS == 1 )
typedef unsigned portSHORT portTickType; typedef unsigned portSHORT portTickType;
#define portMAX_DELAY ( portTickType ) 0xffff #define portMAX_DELAY ( portTickType ) 0xffff
@ -94,7 +94,7 @@ void vPortExitCritical( void );
#define portNOP() __asm( " nop " ); #define portNOP() __asm( " nop " );
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
/* portYIELD() uses SW interrupt */ /* portYIELD() uses a SW interrupt */
#define portYIELD() __asm( " INT #40H " ); #define portYIELD() __asm( " INT #40H " );
/* portYIELD_FROM_ISR() uses delayed interrupt */ /* portYIELD_FROM_ISR() uses delayed interrupt */
@ -107,5 +107,8 @@ void vPortExitCritical( void );
#define portMINIMAL_STACK_SIZE configMINIMAL_STACK_SIZE #define portMINIMAL_STACK_SIZE configMINIMAL_STACK_SIZE
/* Remove the inline statement from within the kernel code. */
#define inline
#endif /* PORTMACRO_H */ #endif /* PORTMACRO_H */

@ -58,11 +58,6 @@ portSTACK_TYPE xGet_DPR_ADB_bank( void );
*/ */
portSTACK_TYPE xGet_DTB_PCB_bank( void ); portSTACK_TYPE xGet_DTB_PCB_bank( void );
/*
* Get current register pointer
*/
portCHAR xGet_RP( void );
/* /*
* Sets up the periodic ISR used for the RTOS tick. This uses RLT0, but * Sets up the periodic ISR used for the RTOS tick. This uses RLT0, but
* can be done using any given RLT. * can be done using any given RLT.
@ -93,8 +88,7 @@ volatile unsigned portBASE_TYPE uxCriticalNesting = 9999UL;
* stack. Finally the resultant stack pointer value is saved into the * stack. Finally the resultant stack pointer value is saved into the
* task control block so it can be retrieved the next time the task * task control block so it can be retrieved the next time the task
* executes. * executes.
*/ */
#if( ( configMEMMODEL == portSMALL ) || ( configMEMMODEL == portMEDIUM ) ) #if( ( configMEMMODEL == portSMALL ) || ( configMEMMODEL == portMEDIUM ) )
#define portSAVE_CONTEXT() \ #define portSAVE_CONTEXT() \
@ -134,15 +128,15 @@ volatile unsigned portBASE_TYPE uxCriticalNesting = 9999UL;
__asm(" OR CCR,#H'20 "); \ __asm(" OR CCR,#H'20 "); \
} }
/* /*
* Macro to restore a task context from the task stack. This is effecti- * Macro to restore a task context from the task stack. This is effecti-
* vely the reverse of SAVE_CONTEXT(). First the stack pointer value * vely the reverse of SAVE_CONTEXT(). First the stack pointer value
* (USP for SMALL and MEDIUM memory model amd USB:USP for COMPACT and * (USP for SMALL and MEDIUM memory model amd USB:USP for COMPACT and
* LARGE memory model ) is loaded from the task control block. Next the * LARGE memory model ) is loaded from the task control block. Next the
* value of all the general purpose registers RW0-RW7 is retrieved. Fina- * value of all the general purpose registers RW0-RW7 is retrieved. Fina-
* lly it copies of the context ( AH:AL, DPR:ADB, DTB:PCB, PC and PS) of * lly it copies of the context ( AH:AL, DPR:ADB, DTB:PCB, PC and PS) of
* the task to be executed upon RETI from user stack to system stack. * the task to be executed upon RETI from user stack to system stack.
*/ */
#define portRESTORE_CONTEXT() \ #define portRESTORE_CONTEXT() \
{ __asm(" MOVW A, _pxCurrentTCB "); \ { __asm(" MOVW A, _pxCurrentTCB "); \
@ -154,7 +148,7 @@ volatile unsigned portBASE_TYPE uxCriticalNesting = 9999UL;
__asm(" POPW (RW0) "); \ __asm(" POPW (RW0) "); \
\ \
/* Save the loaded value into the uxCriticalNesting variable. */ \ /* Save the loaded value into the uxCriticalNesting variable. */ \
__asm(" MOVW _uxCriticalNesting, RW0 "); \ __asm(" MOVW _uxCriticalNesting, RW0 "); \
\ \
__asm(" POPW (RW0,RW1,RW2,RW3,RW4,RW5,RW6,RW7) "); \ __asm(" POPW (RW0,RW1,RW2,RW3,RW4,RW5,RW6,RW7) "); \
__asm(" POPW A "); \ __asm(" POPW A "); \
@ -182,7 +176,7 @@ volatile unsigned portBASE_TYPE uxCriticalNesting = 9999UL;
__asm(" PUSHW A "); \ __asm(" PUSHW A "); \
} }
#elif (configMEMMODEL == portCOMPACT || configMEMMODEL == portLARGE) #elif( ( configMEMMODEL == portCOMPACT ) || ( configMEMMODEL == portLARGE ) )
#define portSAVE_CONTEXT() \ #define portSAVE_CONTEXT() \
{ __asm(" POPW A "); \ { __asm(" POPW A "); \
@ -209,6 +203,11 @@ volatile unsigned portBASE_TYPE uxCriticalNesting = 9999UL;
__asm(" AND CCR,#H'DF "); \ __asm(" AND CCR,#H'DF "); \
__asm(" PUSHW A "); \ __asm(" PUSHW A "); \
__asm(" PUSHW (RW0,RW1,RW2,RW3,RW4,RW5,RW6,RW7) "); \ __asm(" PUSHW (RW0,RW1,RW2,RW3,RW4,RW5,RW6,RW7) "); \
\
/* Save the critical nesting count to the stack. */ \
__asm(" MOVW RW0, _uxCriticalNesting "); \
__asm(" PUSHW (RW0) "); \
\
__asm(" MOVL A, _pxCurrentTCB "); \ __asm(" MOVL A, _pxCurrentTCB "); \
__asm(" MOVL RL2, A "); \ __asm(" MOVL RL2, A "); \
__asm(" MOVW A, SP "); \ __asm(" MOVW A, SP "); \
@ -225,6 +224,13 @@ volatile unsigned portBASE_TYPE uxCriticalNesting = 9999UL;
__asm(" MOVW SP, A "); \ __asm(" MOVW SP, A "); \
__asm(" MOV A, @RL2+2 "); \ __asm(" MOV A, @RL2+2 "); \
__asm(" MOV USB, A "); \ __asm(" MOV USB, A "); \
\
/* Load the saved uxCriticalNesting value into RW0. */ \
__asm(" POPW (RW0) "); \
\
/* Save the loaded value into the uxCriticalNesting variable. */ \
__asm(" MOVW _uxCriticalNesting, RW0 "); \
\
__asm(" POPW (RW0,RW1,RW2,RW3,RW4,RW5,RW6,RW7) "); \ __asm(" POPW (RW0,RW1,RW2,RW3,RW4,RW5,RW6,RW7) "); \
__asm(" POPW A "); \ __asm(" POPW A "); \
__asm(" OR CCR,#H'20 "); \ __asm(" OR CCR,#H'20 "); \
@ -255,15 +261,13 @@ volatile unsigned portBASE_TYPE uxCriticalNesting = 9999UL;
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
/* /*
* The below are the functions for getting the current value of DPR:ADB, * Functions for obtaining the current value of DPR:ADB, DTB:PCB bank registers
* DTB:PCB bank registers
*/ */
#pragma asm #pragma asm
.GLOBAL _xGet_DPR_ADB_bank .GLOBAL _xGet_DPR_ADB_bank
.GLOBAL _xGet_DTB_PCB_bank .GLOBAL _xGet_DTB_PCB_bank
.GLOBAL _xGet_RP
.SECTION CODE, CODE, ALIGN=1 .SECTION CODE, CODE, ALIGN=1
_xGet_DPR_ADB_bank: _xGet_DPR_ADB_bank:
@ -291,20 +295,6 @@ _xGet_DTB_PCB_bank:
RET RET
#endif #endif
_xGet_RP:
PUSHW PS
POPW A
SWAP
ANDW A,#0x1f
#if configMEMMODEL == portMEDIUM || configMEMMODEL == portLARGE
RETP
#elif configMEMMODEL == portSMALL || configMEMMODEL == portCOMPACT
RET
#endif
#pragma endasm #pragma endasm
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
@ -326,10 +316,10 @@ portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE
pxTopOfStack--; pxTopOfStack--;
/* Once the task is called the task would push the pointer to the /* Once the task is called the task would push the pointer to the
parameter on to the stack. Hence here the pointer would be copied first parameter onto the stack. Hence here the pointer would be copied to the stack
to the stack. In case of COMPACT or LARGE memory model such pointer first. When using the COMPACT or LARGE memory model the pointer would be 24
would be 24 bit and in case of SMALL or MEDIUM memory model such pointer bits, and when using the SMALL or MEDIUM memory model the pointer would be 16
would be 16 bit */ bits. */
#if( ( configMEMMODEL == portCOMPACT ) || ( configMEMMODEL == portLARGE ) ) #if( ( configMEMMODEL == portCOMPACT ) || ( configMEMMODEL == portLARGE ) )
{ {
*pxTopOfStack = ( portSTACK_TYPE ) ( ( unsigned portLONG ) ( pvParameters ) >> 16 ); *pxTopOfStack = ( portSTACK_TYPE ) ( ( unsigned portLONG ) ( pvParameters ) >> 16 );
@ -351,8 +341,7 @@ portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE
#endif #endif
/* This is redundant push to the stack. This is required in order to introduce /* This is redundant push to the stack. This is required in order to introduce
an offset so that the task accesses a parameter correctly that is passed on to an offset so the task correctly accesses the parameter passed on the task stack. */
the task stack. */
*pxTopOfStack = ( portSTACK_TYPE ) ( pxCode ); *pxTopOfStack = ( portSTACK_TYPE ) ( pxCode );
pxTopOfStack--; pxTopOfStack--;
@ -372,8 +361,8 @@ portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE
} }
#endif #endif
/* DTB | PCB, in case of portMEDIUM or portLARGE memory model PCB would be used /* DTB | PCB, in case of MEDIUM and LARGE memory models, PCB would be used
along with PC to indicate the start address of the functiom */ along with PC to indicate the start address of the function. */
#if( ( configMEMMODEL == portMEDIUM ) || ( configMEMMODEL == portLARGE ) ) #if( ( configMEMMODEL == portMEDIUM ) || ( configMEMMODEL == portLARGE ) )
{ {
*pxTopOfStack = ( xGet_DTB_PCB_bank() & 0xff00 ) | ( ( ( portLONG ) ( pxCode ) >> 16 ) & 0xff ); *pxTopOfStack = ( xGet_DTB_PCB_bank() & 0xff00 ) | ( ( ( portLONG ) ( pxCode ) >> 16 ) & 0xff );
@ -421,8 +410,11 @@ portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE
static void prvSetupRLT0Interrupt( void ) static void prvSetupRLT0Interrupt( void )
{ {
/* The peripheral clock divided by 16 is used by the timer. */
const unsigned portSHORT usReloadValue = ( unsigned portSHORT ) ( ( ( configCLKP1_CLOCK_HZ / configTICK_RATE_HZ ) / 16UL ) - 1UL );
/* set reload value = 34999+1, TICK Interrupt after 10 ms @ 56MHz of CLKP1 */ /* set reload value = 34999+1, TICK Interrupt after 10 ms @ 56MHz of CLKP1 */
TMRLR0 = 0x88B7; TMRLR0 = usReloadValue;
/* prescaler 1:16, reload, interrupt enable, count enable, trigger */ /* prescaler 1:16, reload, interrupt enable, count enable, trigger */
TMCSR0 = 0x041B; TMCSR0 = 0x041B;
@ -438,8 +430,7 @@ portBASE_TYPE xPortStartScheduler( void )
portRESTORE_CONTEXT(); portRESTORE_CONTEXT();
/* Simulate a function call end as generated by the compiler. We will now /* Simulate a function call end as generated by the compiler. We will now
jump to the start of the task the context of which we have just restored. */ jump to the start of the task the context of which we have just restored. */
__asm(" reti "); __asm(" reti ");
@ -465,8 +456,9 @@ void vPortEndScheduler( void )
/* /*
* Tick ISR for preemptive scheduler. We can use a __nosavereg attribute * Tick ISR for preemptive scheduler. We can use a __nosavereg attribute
* as the context would be saved by PortSAVE_CONTEXT(). The tick count * as the context is to be saved by the portSAVE_CONTEXT() macro, not the
* is incremented after the context is saved. * compiler generated code. The tick count is incremented after the context
* is saved.
*/ */
__nosavereg __interrupt void prvRLT0_TICKISR( void ) __nosavereg __interrupt void prvRLT0_TICKISR( void )
{ {
@ -518,8 +510,8 @@ void vPortEndScheduler( void )
/* /*
* Manual context switch. We can use a __nosavereg attribute as the context * Manual context switch. We can use a __nosavereg attribute as the context
* would be saved by PortSAVE_CONTEXT(). The context is switched and then * is to be saved by the portSAVE_CONTEXT() macro, not the compiler generated
* the context of the new task is restored saved. * code.
*/ */
__nosavereg __interrupt void vPortYield( void ) __nosavereg __interrupt void vPortYield( void )
{ {

@ -44,9 +44,14 @@
#ifndef PORTMACRO_H #ifndef PORTMACRO_H
#define PORTMACRO_H #define PORTMACRO_H
/* Device specific includes. */
#include "mb96348hs.h" #include "mb96348hs.h"
/* Standard includes. */
#include <stddef.h> #include <stddef.h>
/* Constants denoting the available memory models. These are used within
FreeRTOSConfig.h to set the configMEMMODEL value. */
#define portSMALL 0 #define portSMALL 0
#define portMEDIUM 1 #define portMEDIUM 1
#define portCOMPACT 2 #define portCOMPACT 2

Loading…
Cancel
Save