First pass changes to new MicroBlaze port layer done. No new functionality has yet been added.

pull/4/head
Richard Barry 14 years ago
parent cdac2c4f82
commit 8d23799758

@ -69,8 +69,9 @@
#include <xtmrctr.h> #include <xtmrctr.h>
#include <xil_exception.h> #include <xil_exception.h>
/* Tasks are started with interrupts enabled. */ /* Tasks are started with interrupts disabled as they will have their interrupts
#define portINITIAL_MSR_STATE ( ( portSTACK_TYPE ) 0x02 ) enabled as the task starts (when its context is restored for the first time). */
#define portINITIAL_MSR_STATE ( ( portSTACK_TYPE ) 0x00 )
/* Tasks are started with a critical section nesting of 0 - however prior /* Tasks are started with a critical section nesting of 0 - however prior
to the scheduler being commenced we don't want the critical nesting level to the scheduler being commenced we don't want the critical nesting level
@ -99,8 +100,7 @@ volatile unsigned portBASE_TYPE uxCriticalNesting = portINITIAL_NESTING_VALUE;
/* To limit the amount of stack required by each task, this port uses a /* To limit the amount of stack required by each task, this port uses a
separate stack for interrupts. */ separate stack for interrupts. */
unsigned long ulISRStack; unsigned long *pulISRStack;
unsigned long *pulISRStack = &ulISRStack;
/* The instance of the interrupt controller used by this port. */ /* The instance of the interrupt controller used by this port. */
static XIntc xInterruptControllerInstance; static XIntc xInterruptControllerInstance;
@ -143,10 +143,19 @@ const unsigned long ulR13 = ( unsigned long ) &_SDA_BASE_;
*pxTopOfStack = ( portSTACK_TYPE ) 0x33333333; *pxTopOfStack = ( portSTACK_TYPE ) 0x33333333;
pxTopOfStack--; pxTopOfStack--;
/* The debugger will look at the previous stack frame. */
*pxTopOfStack = ( portSTACK_TYPE ) 0x00000000;
pxTopOfStack--;
*pxTopOfStack = ( portSTACK_TYPE ) 0x00000000;
pxTopOfStack--;
*pxTopOfStack = ( portSTACK_TYPE ) 0x00000000;
pxTopOfStack--;
/* First stack an initial value for the critical section nesting. This /* First stack an initial value for the critical section nesting. This
is initialised to zero as tasks are started with interrupts enabled. */ is initialised to zero. */
*pxTopOfStack = ( portSTACK_TYPE ) 0x00; /* R0 is always zero. */ *pxTopOfStack = ( portSTACK_TYPE ) 0x00;
/* R0 is always zero. */
/* R1 is the SP. */ /* R1 is the SP. */
/* Place an initial value for all the general purpose registers. */ /* Place an initial value for all the general purpose registers. */
@ -159,7 +168,7 @@ const unsigned long ulR13 = ( unsigned long ) &_SDA_BASE_;
pxTopOfStack--; pxTopOfStack--;
*pxTopOfStack = ( portSTACK_TYPE ) pvParameters;/* R5 contains the function call parameters. */ *pxTopOfStack = ( portSTACK_TYPE ) pvParameters;/* R5 contains the function call parameters. */
pxTopOfStack--; pxTopOfStack--;
*pxTopOfStack = ( portSTACK_TYPE ) 0x06; /* R6 - other parameters and temporaries. */ *pxTopOfStack = ( portSTACK_TYPE ) 0x06; /* R6 - other parameters and temporaries. Used as the return address from vPortTaskEntryPoint. */
pxTopOfStack--; pxTopOfStack--;
*pxTopOfStack = ( portSTACK_TYPE ) 0x07; /* R7 - other parameters and temporaries. */ *pxTopOfStack = ( portSTACK_TYPE ) 0x07; /* R7 - other parameters and temporaries. */
pxTopOfStack--; pxTopOfStack--;
@ -185,7 +194,7 @@ const unsigned long ulR13 = ( unsigned long ) &_SDA_BASE_;
pxTopOfStack--; pxTopOfStack--;
*pxTopOfStack = ( portSTACK_TYPE ) 0x12; /* R18 - reserved for assembler and compiler temporaries. */ *pxTopOfStack = ( portSTACK_TYPE ) 0x12; /* R18 - reserved for assembler and compiler temporaries. */
pxTopOfStack--; pxTopOfStack--;
*pxTopOfStack = ( portSTACK_TYPE ) 0x13; /* R19 - must be saved across function calls. Callee-save. */ *pxTopOfStack = ( portSTACK_TYPE ) 0x00; /* R19 - must be saved across function calls. Callee-save. Seems to be interpreted as the frame pointer. */
pxTopOfStack--; pxTopOfStack--;
*pxTopOfStack = ( portSTACK_TYPE ) 0x14; /* R20 - reserved for storing a pointer to the Global Offset Table (GOT) in Position Independent Code (PIC). Non-volatile in non-PIC code. Must be saved across function calls. Callee-save. Not used by FreeRTOS. */ *pxTopOfStack = ( portSTACK_TYPE ) 0x14; /* R20 - reserved for storing a pointer to the Global Offset Table (GOT) in Position Independent Code (PIC). Non-volatile in non-PIC code. Must be saved across function calls. Callee-save. Not used by FreeRTOS. */
pxTopOfStack--; pxTopOfStack--;
@ -232,9 +241,12 @@ extern unsigned long _stack[];
this function is called. */ this function is called. */
vApplicationSetupTimerInterrupt(); vApplicationSetupTimerInterrupt();
/* Allocate the stack to be used by the interrupt handler. */ /* Reuse the stack from main as the stack for the interrupts/exceptions.
The value is adjusted slightly to allow functions called from the
interrupts/exceptions to write back into the stack of the interrupt/
exception function itself. */
pulISRStack = ( unsigned long * ) _stack; pulISRStack = ( unsigned long * ) _stack;
pulISRStack--; pulISRStack -= 2;
/* Restore the context of the first task that is going to run. From here /* Restore the context of the first task that is going to run. From here
on, the created tasks will be executing. */ on, the created tasks will be executing. */

@ -216,7 +216,9 @@ _interrupt_handler:
/* Stack the return address. */ /* Stack the return address. */
swi r14, r1, 76 swi r14, r1, 76
/* Switch to the ISR stack. */ /* Switch to the ISR stack. The pulISRStack value has already been set to
leave space for the caller function to write back into the stack of this
function. */
lwi r1, r0, pulISRStack lwi r1, r0, pulISRStack
/* The parameter to the interrupt handler. */ /* The parameter to the interrupt handler. */

Loading…
Cancel
Save