summaryrefslogtreecommitdiff
path: root/Source/portable/Softune
diff options
context:
space:
mode:
authorRichardBarry <RichardBarry@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>2008-02-13 10:39:07 +0000
committerRichardBarry <RichardBarry@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>2008-02-13 10:39:07 +0000
commita13582cc5b754c04702296e0daf5ba77f02b1126 (patch)
tree00ac422721b14114a720313ee17bcc41c8b3890b /Source/portable/Softune
parentfa96ca8a3aaceaadbe70573c7b7e193bc1ab2ebe (diff)
downloadfreertos-a13582cc5b754c04702296e0daf5ba77f02b1126.tar.gz
Tidy up - spell check.
git-svn-id: http://svn.code.sf.net/p/freertos/code/trunk@176 1d2547de-c912-0410-9cb9-b8ca96c0e9e2
Diffstat (limited to 'Source/portable/Softune')
-rw-r--r--Source/portable/Softune/MB91460/port.c101
-rw-r--r--Source/portable/Softune/MB91460/portmacro.h11
-rw-r--r--Source/portable/Softune/MB96340/port.c92
-rw-r--r--Source/portable/Softune/MB96340/portmacro.h5
4 files changed, 95 insertions, 114 deletions
diff --git a/Source/portable/Softune/MB91460/port.c b/Source/portable/Softune/MB91460/port.c
index 969f39826..80fe0b175 100644
--- a/Source/portable/Softune/MB91460/port.c
+++ b/Source/portable/Softune/MB91460/port.c
@@ -56,8 +56,6 @@ extern volatile tskTCB * volatile pxCurrentTCB;
volatile unsigned portLONG ulCriticalNesting = 9999UL;
/*-----------------------------------------------------------*/
-
-
#pragma asm
#macro SaveContext
@@ -104,7 +102,7 @@ volatile unsigned portLONG ulCriticalNesting = 9999UL;
ANDCCR #0xDF ;Switch 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
LD @R15+, R1 ;Get the saved critical nesting value
@@ -146,14 +144,14 @@ portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE
*pxTopOfStack = 0x33333333;
pxTopOfStack--;
- /* This is a redundant push to the stack, it may be required if in some implentation of the compiler
- the parameter to the task is passed on to the stack rather than in R4 register*/
+ /* This is a redundant push to the stack, it may be required if
+ in some implementations of the compiler the parameter to the task
+ is passed on to the stack rather than in R4 register. */
*pxTopOfStack = (portSTACK_TYPE)(pvParameters);
pxTopOfStack--;
*pxTopOfStack = ( portSTACK_TYPE ) 0x00000000; /* RP */
pxTopOfStack--;
-
*pxTopOfStack = ( portSTACK_TYPE ) 0x00007777; /* R7 */
pxTopOfStack--;
*pxTopOfStack = ( portSTACK_TYPE ) 0x00006666; /* R6 */
@@ -161,10 +159,10 @@ portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE
*pxTopOfStack = ( portSTACK_TYPE ) 0x00005555; /* R5 */
pxTopOfStack--;
- /* In the current implemention of the compiler the first
- parameter to the task(or function) is passed via R4 parameter
- to the task, hennce the pvParameters pointer is copied in R4
- regsiter. See compiler manual section 4.6.2 for more information.*/
+ /* In the current implementation of the compiler the first
+ parameter to the task (or function) is passed via R4 parameter
+ to the task, hence the pvParameters pointer is copied into the R4
+ register. See compiler manual section 4.6.2 for more information. */
*pxTopOfStack = ( portSTACK_TYPE ) (pvParameters); /* R4 */
pxTopOfStack--;
*pxTopOfStack = ( portSTACK_TYPE ) 0x00003333; /* R3 */
@@ -174,8 +172,7 @@ portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE
*pxTopOfStack = ( portSTACK_TYPE ) 0x00001111; /* R1 */
pxTopOfStack--;
*pxTopOfStack = ( portSTACK_TYPE ) 0x00000001; /* R0 */
- pxTopOfStack--;
-
+ pxTopOfStack--;
*pxTopOfStack = ( portSTACK_TYPE ) 0x0000EEEE; /* R14 */
pxTopOfStack--;
*pxTopOfStack = ( portSTACK_TYPE ) 0x0000DDDD; /* R13 */
@@ -189,15 +186,14 @@ portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE
*pxTopOfStack = ( portSTACK_TYPE ) 0x00009999; /* R9 */
pxTopOfStack--;
*pxTopOfStack = ( portSTACK_TYPE ) 0x00008888; /* R8 */
- pxTopOfStack--;
-
+ pxTopOfStack--;
*pxTopOfStack = ( portSTACK_TYPE ) 0x11110000; /* MDH */
pxTopOfStack--;
*pxTopOfStack = ( portSTACK_TYPE ) 0x22220000; /* MDL */
pxTopOfStack--;
- /* The task starts with its ulCriticalNesting variable set to 0, interrupts
- being enabled. */
+ /* The task starts with its ulCriticalNesting variable set to 0,
+ interrupts being enabled. */
*pxTopOfStack = portNO_CRITICAL_NESTING;
pxTopOfStack--;
@@ -218,18 +214,16 @@ portBASE_TYPE xPortStartScheduler( void )
prvSetupTimerInterrupt();
/* Restore the context of the first task that is going to run. */
-#pragma asm
- RestoreContext
-#pragma endasm
+ #pragma asm
+ RestoreContext
+ #pragma endasm
/* 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 ");
-
/* 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 )
{
/* 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 );
- TMCSR0_CNTE=0; /* Count Disable */
- TMCSR0_CSL=0x2; /* CLKP/32 */
- TMCSR0_MOD=0; /* Software trigger */
- TMCSR0_RELD=1; /* Reload */
+ /* Setup RLT0 to generate a tick interrupt. */
+
+ TMCSR0_CNTE = 0; /* Count Disable */
+ TMCSR0_CSL = 0x2; /* CLKP/32 */
+ TMCSR0_MOD = 0; /* Software trigger */
+ TMCSR0_RELD = 1; /* Reload */
- TMCSR0_UF=0; /* Clear underflow flag */
- TMRLR0=usReloadValue;
- TMCSR0_INTE=1; /* Interrupt Enable */
- TMCSR0_CNTE=1; /* Count Enable */
- TMCSR0_TRG=1; /* Trigger */
+ TMCSR0_UF = 0; /* Clear underflow flag */
+ TMRLR0 = usReloadValue;
+ TMCSR0_INTE = 1; /* Interrupt Enable */
+ TMCSR0_CNTE = 1; /* Count Enable */
+ 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
* 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
@@ -277,9 +270,7 @@ const unsigned portSHORT usReloadValue = ( unsigned portSHORT ) ( ( ( configPER_
_ReloadTimer0_IRQHandler:
ANDCCR #0xEF ;Disable Interrupts
-
SaveContext ;Save context
-
ORCCR #0x10 ;Re-enable Interrupts
LDI #0xFFFB,R1
@@ -287,13 +278,10 @@ const unsigned portSHORT usReloadValue = ( unsigned portSHORT ) ( ( ( configPER_
AND R1,@R0 ;Clear RLT0 interrupt flag
CALL32 _vTaskIncrementTick,R12 ;Increment Tick
-
CALL32 _vTaskSwitchContext,R12 ;Switch context if required
ANDCCR #0xEF ;Disable Interrupts
-
RestoreContext ;Restore context
-
ORCCR #0x10 ;Re-enable Interrupts
RETI
@@ -316,20 +304,18 @@ const unsigned portSHORT usReloadValue = ( unsigned portSHORT ) ( ( ( configPER_
#endif
- /*
- * Manual context switch. We can use a __nosavereg attribute as the context
- * would be saved by PortSAVE_CONTEXT(). The context is switched and then
- * the context of the new task is restored saved.
- */
+/*
+ * Manual context switch. We can use a __nosavereg attribute as the context
+ * would be saved by PortSAVE_CONTEXT(). The context is switched and then
+ * the context of the new task is restored saved.
+ */
#pragma asm
.global _vPortYieldDelayed
_vPortYieldDelayed:
ANDCCR #0xEF ;Disable Interrupts
-
SaveContext ;Save context
-
ORCCR #0x10 ;Re-enable Interrupts
LDI #_dicr, R0
@@ -338,36 +324,31 @@ const unsigned portSHORT usReloadValue = ( unsigned portSHORT ) ( ( ( configPER_
CALL32 _vTaskSwitchContext,R12 ;Switch context if required
ANDCCR #0xEF ;Disable Interrupts
-
RestoreContext ;Restore context
-
ORCCR #0x10 ;Re-enable Interrupts
RETI
#pragma endasm
+/*-----------------------------------------------------------*/
- /*
- * Manual context switch. We can use a __nosavereg attribute as the context
- * would be saved by PortSAVE_CONTEXT(). The context is switched and then
- * the context of the new task is restored saved.
- */
-
+/*
+ * Manual context switch. We can use a __nosavereg attribute as the context
+ * would be saved by PortSAVE_CONTEXT(). The context is switched and then
+ * the context of the new task is restored saved.
+ */
#pragma asm
.global _vPortYield
_vPortYield:
SaveContext ;Save context
-
CALL32 _vTaskSwitchContext,R12 ;Switch context if required
-
RestoreContext ;Restore context
RETI
#pragma endasm
-
/*-----------------------------------------------------------*/
void vPortEnterCritical( void )
diff --git a/Source/portable/Softune/MB91460/portmacro.h b/Source/portable/Softune/MB91460/portmacro.h
index 5b4ba3136..03a965f6e 100644
--- a/Source/portable/Softune/MB91460/portmacro.h
+++ b/Source/portable/Softune/MB91460/portmacro.h
@@ -43,7 +43,10 @@
#ifndef PORTMACRO_H
#define PORTMACRO_H
+/* Hardware specific includes. */
#include "mb91467d.h"
+
+/* Standard includes. */
#include <stddef.h>
/*-----------------------------------------------------------
@@ -65,9 +68,6 @@
#define portSTACK_TYPE unsigned portLONG
#define portBASE_TYPE long
-/* This is required since SOFTUNE doesn't support inline directive as is. */
-#define inline
-
#if( configUSE_16_BIT_TICKS == 1 )
typedef unsigned portSHORT portTickType;
#define portMAX_DELAY ( portTickType ) 0xffff
@@ -94,7 +94,7 @@ void vPortExitCritical( void );
#define portNOP() __asm( " nop " );
/*-----------------------------------------------------------*/
-/* portYIELD() uses SW interrupt */
+/* portYIELD() uses a SW interrupt */
#define portYIELD() __asm( " INT #40H " );
/* portYIELD_FROM_ISR() uses delayed interrupt */
@@ -107,5 +107,8 @@ void vPortExitCritical( void );
#define portMINIMAL_STACK_SIZE configMINIMAL_STACK_SIZE
+/* Remove the inline statement from within the kernel code. */
+#define inline
+
#endif /* PORTMACRO_H */
diff --git a/Source/portable/Softune/MB96340/port.c b/Source/portable/Softune/MB96340/port.c
index 6ab130b80..ef6798e88 100644
--- a/Source/portable/Softune/MB96340/port.c
+++ b/Source/portable/Softune/MB96340/port.c
@@ -58,11 +58,6 @@ portSTACK_TYPE xGet_DPR_ADB_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
* 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
* task control block so it can be retrieved the next time the task
* executes.
- */
-
+ */
#if( ( configMEMMODEL == portSMALL ) || ( configMEMMODEL == portMEDIUM ) )
#define portSAVE_CONTEXT() \
@@ -134,15 +128,15 @@ volatile unsigned portBASE_TYPE uxCriticalNesting = 9999UL;
__asm(" OR CCR,#H'20 "); \
}
- /*
- * Macro to restore a task context from the task stack. This is effecti-
- * vely the reverse of SAVE_CONTEXT(). First the stack pointer value
- * (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
- * 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
- * the task to be executed upon RETI from user stack to system stack.
- */
+/*
+ * Macro to restore a task context from the task stack. This is effecti-
+ * vely the reverse of SAVE_CONTEXT(). First the stack pointer value
+ * (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
+ * 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
+ * the task to be executed upon RETI from user stack to system stack.
+ */
#define portRESTORE_CONTEXT() \
{ __asm(" MOVW A, _pxCurrentTCB "); \
@@ -154,7 +148,7 @@ volatile unsigned portBASE_TYPE uxCriticalNesting = 9999UL;
__asm(" POPW (RW0) "); \
\
/* 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 A "); \
@@ -182,7 +176,7 @@ volatile unsigned portBASE_TYPE uxCriticalNesting = 9999UL;
__asm(" PUSHW A "); \
}
-#elif (configMEMMODEL == portCOMPACT || configMEMMODEL == portLARGE)
+#elif( ( configMEMMODEL == portCOMPACT ) || ( configMEMMODEL == portLARGE ) )
#define portSAVE_CONTEXT() \
{ __asm(" POPW A "); \
@@ -209,6 +203,11 @@ volatile unsigned portBASE_TYPE uxCriticalNesting = 9999UL;
__asm(" AND CCR,#H'DF "); \
__asm(" PUSHW A "); \
__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 RL2, A "); \
__asm(" MOVW A, SP "); \
@@ -225,6 +224,13 @@ volatile unsigned portBASE_TYPE uxCriticalNesting = 9999UL;
__asm(" MOVW SP, A "); \
__asm(" MOV A, @RL2+2 "); \
__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 A "); \
__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,
- * DTB:PCB bank registers
+ * Functions for obtaining the current value of DPR:ADB, DTB:PCB bank registers
*/
#pragma asm
.GLOBAL _xGet_DPR_ADB_bank
.GLOBAL _xGet_DTB_PCB_bank
- .GLOBAL _xGet_RP
.SECTION CODE, CODE, ALIGN=1
_xGet_DPR_ADB_bank:
@@ -291,20 +295,6 @@ _xGet_DTB_PCB_bank:
RET
#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
/*-----------------------------------------------------------*/
@@ -326,10 +316,10 @@ portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE
pxTopOfStack--;
/* 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
- to the stack. In case of COMPACT or LARGE memory model such pointer
- would be 24 bit and in case of SMALL or MEDIUM memory model such pointer
- would be 16 bit */
+ parameter onto the stack. Hence here the pointer would be copied to the stack
+ first. When using the COMPACT or LARGE memory model the pointer would be 24
+ bits, and when using the SMALL or MEDIUM memory model the pointer would be 16
+ bits. */
#if( ( configMEMMODEL == portCOMPACT ) || ( configMEMMODEL == portLARGE ) )
{
*pxTopOfStack = ( portSTACK_TYPE ) ( ( unsigned portLONG ) ( pvParameters ) >> 16 );
@@ -351,8 +341,7 @@ portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE
#endif
/* 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
- the task stack. */
+ an offset so the task correctly accesses the parameter passed on the task stack. */
*pxTopOfStack = ( portSTACK_TYPE ) ( pxCode );
pxTopOfStack--;
@@ -372,8 +361,8 @@ portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE
}
#endif
- /* DTB | PCB, in case of portMEDIUM or portLARGE memory model PCB would be used
- along with PC to indicate the start address of the functiom */
+ /* DTB | PCB, in case of MEDIUM and LARGE memory models, PCB would be used
+ along with PC to indicate the start address of the function. */
#if( ( configMEMMODEL == portMEDIUM ) || ( configMEMMODEL == portLARGE ) )
{
*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 )
{
+/* 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 */
- TMRLR0 = 0x88B7;
+ TMRLR0 = usReloadValue;
/* prescaler 1:16, reload, interrupt enable, count enable, trigger */
TMCSR0 = 0x041B;
@@ -438,8 +430,7 @@ portBASE_TYPE xPortStartScheduler( void )
portRESTORE_CONTEXT();
/* 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 ");
@@ -465,8 +456,9 @@ void vPortEndScheduler( void )
/*
* Tick ISR for preemptive scheduler. We can use a __nosavereg attribute
- * as the context would be saved by PortSAVE_CONTEXT(). The tick count
- * is incremented after the context is saved.
+ * as the context is to be saved by the portSAVE_CONTEXT() macro, not the
+ * compiler generated code. The tick count is incremented after the context
+ * is saved.
*/
__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
- * would be saved by PortSAVE_CONTEXT(). The context is switched and then
- * the context of the new task is restored saved.
+ * is to be saved by the portSAVE_CONTEXT() macro, not the compiler generated
+ * code.
*/
__nosavereg __interrupt void vPortYield( void )
{
diff --git a/Source/portable/Softune/MB96340/portmacro.h b/Source/portable/Softune/MB96340/portmacro.h
index cd7b60fa2..86af68415 100644
--- a/Source/portable/Softune/MB96340/portmacro.h
+++ b/Source/portable/Softune/MB96340/portmacro.h
@@ -44,9 +44,14 @@
#ifndef PORTMACRO_H
#define PORTMACRO_H
+/* Device specific includes. */
#include "mb96348hs.h"
+
+/* Standard includes. */
#include <stddef.h>
+/* Constants denoting the available memory models. These are used within
+FreeRTOSConfig.h to set the configMEMMODEL value. */
#define portSMALL 0
#define portMEDIUM 1
#define portCOMPACT 2