Line 17... |
Line 17... |
|
|
Internal Routines :
|
Internal Routines :
|
_reset Boot code installed at interrupt vector 0x100
|
_reset Boot code installed at interrupt vector 0x100
|
_start Start up sequence
|
_start Start up sequence
|
|
|
_OSTickISR Operating system timer tick interrupt service routine
|
_OSTickISR Operating system timer tick interrupt service
|
_OSStartHighRdy Starts the highest priority task that is available to run
|
routine
|
|
_OSStartHighRdy Starts the highest priority task that is
|
|
available to run
|
_OSCtxSwBP
|
_OSCtxSwBP
|
_OSCtxSw Task switch
|
_OSCtxSw Task switch
|
_OSIntCtxSw Task switch after interrupt
|
_OSIntCtxSw Task switch after interrupt
|
_UserISR Interrupt service routine template - requires code
|
_UserISR Interrupt service routine template - requires
|
_align Attempts to recover from memory alignment errors
|
code
|
|
_align Attempts to recover from memory alignment
|
|
errors
|
nest_not_one
|
nest_not_one
|
|
|
External Routines :
|
External Routines :
|
_OSIntExit
|
_OSIntExit
|
_OSTimeTick
|
_OSTimeTick
|
Line 70... |
Line 74... |
#include "spr-defs.h"
|
#include "spr-defs.h"
|
#include "board.h"
|
#include "board.h"
|
|
|
#define RED_ZONE_SIZE 128
|
#define RED_ZONE_SIZE 128
|
#define STK_FRAME_SIZE (128+RED_ZONE_SIZE)
|
#define STK_FRAME_SIZE (128+RED_ZONE_SIZE)
|
#define SPR_TTMR_LOAD (SPR_TTMR_IE | SPR_TTMR_RT | ((IN_CLK/TICKS_PER_SEC) & SPR_TTMR_PERIOD))
|
#define SPR_TTMR_LOAD (SPR_TTMR_IE | SPR_TTMR_RT | \
|
|
((IN_CLK/TICKS_PER_SEC) & SPR_TTMR_PERIOD))
|
|
|
/* function prototypes */
|
/* function prototypes */
|
|
|
.global OSTickISR /* internal functions */
|
.global OSTickISR /* internal functions */
|
.global OSStartHighRdy
|
.global OSStartHighRdy
|
Line 412... |
Line 417... |
|
|
OSCtxSw:
|
OSCtxSw:
|
/* l.sys exception for now so we are in supervisor mode */
|
/* l.sys exception for now so we are in supervisor mode */
|
/* exception - recover pc from epcr */
|
/* exception - recover pc from epcr */
|
|
|
l.mfspr r3,r0,SPR_EPCR_BASE /* save program counter that was put in exception register */
|
l.mfspr r3,r0,SPR_EPCR_BASE /* save program counter that was put in
|
|
exception register */
|
l.sw 0(r1),r3
|
l.sw 0(r1),r3
|
l.mfspr r3,r0,SPR_ESR_BASE /* save status register that was put in exception register */
|
l.mfspr r3,r0,SPR_ESR_BASE /* save status register that was put in
|
|
exception register */
|
l.sw 4(r1),r3
|
l.sw 4(r1),r3
|
|
|
store_context
|
store_context
|
/* Store current stack pointer */
|
/* Store current stack pointer */
|
load32i r3,OSTCBCur /* r3= &OSTCBCur */
|
load32i r3,OSTCBCur /* r3= &OSTCBCur */
|
Line 478... |
Line 485... |
|
|
load32i r3,OSRunning /* r3= &OSRunning */
|
load32i r3,OSRunning /* r3= &OSRunning */
|
|
|
l.ori r4,r0, 0x01 /* set OSRunning == TRUE */
|
l.ori r4,r0, 0x01 /* set OSRunning == TRUE */
|
l.sb 0(r3), r4
|
l.sb 0(r3), r4
|
/* load stack pointer from next task's TCB area */
|
/* load stack pointer from next task's
|
|
TCB area */
|
load32i r3,OSTCBHighRdy /* r3 = &OSTCBHighRdy */
|
load32i r3,OSTCBHighRdy /* r3 = &OSTCBHighRdy */
|
l.lwz r3,0(r3) /* r3 = &OS_TCB */
|
l.lwz r3,0(r3) /* r3 = &OS_TCB */
|
l.lwz r1, 0(r3) /* stack is the first element */
|
l.lwz r1, 0(r3) /* stack is the first element */
|
|
|
l.lwz r2,0(r1)
|
l.lwz r2,0(r1)
|
Line 505... |
Line 513... |
------------------------------
|
------------------------------
|
Uses :
|
Uses :
|
------------------------------
|
------------------------------
|
*/
|
*/
|
OSTickISR:
|
OSTickISR:
|
l.mfspr r3,r0,SPR_EPCR_BASE /* save program counter that was put in exception register */
|
l.mfspr r3,r0,SPR_EPCR_BASE /* save program counter that was put
|
|
in exception register */
|
l.sw 0(r1),r3
|
l.sw 0(r1),r3
|
l.mfspr r3,r0,SPR_ESR_BASE /* save status register that was put in exception register */
|
l.mfspr r3,r0,SPR_ESR_BASE /* save status register that was put in
|
|
exception register */
|
l.sw 4(r1),r3
|
l.sw 4(r1),r3
|
|
|
store_context
|
store_context
|
/* either call OSIntEnter or Increment OSIntNesting */
|
/* either call OSIntEnter or Increment OSIntNesting */
|
|
|
Line 549... |
Line 559... |
l.jal OSTimeTick
|
l.jal OSTimeTick
|
l.nop
|
l.nop
|
/*Call OSIntExit()*/
|
/*Call OSIntExit()*/
|
l.jal OSIntExit
|
l.jal OSIntExit
|
l.nop
|
l.nop
|
/* load stack pointer from next task's TCB area */
|
/* load stack pointer from next task's
|
|
TCB area */
|
load32i r3,OSTCBHighRdy /* r3 = &OSTCBHighRdy */
|
load32i r3,OSTCBHighRdy /* r3 = &OSTCBHighRdy */
|
l.lwz r3,0(r3) /* r3 = &OS_TCB */
|
l.lwz r3,0(r3) /* r3 = &OS_TCB */
|
l.lwz r1, 0(r3) /* stack is the first element */
|
l.lwz r1, 0(r3) /* stack is the first element */
|
|
|
l.lwz r2,0(r1)
|
l.lwz r2,0(r1)
|
Line 577... |
Line 588... |
------------------------------
|
------------------------------
|
Uses :
|
Uses :
|
------------------------------
|
------------------------------
|
*/
|
*/
|
UserISR:
|
UserISR:
|
l.mfspr r2,r0,SPR_EPCR_BASE /* save program counter that was put in exception register */
|
l.mfspr r3,r0,SPR_EPCR_BASE /* save program counter that was put in
|
l.sw 0(r1),r2
|
exception register */
|
l.mfspr r2,r0,SPR_ESR_BASE /* save status register that was put in exception register */
|
l.sw 0(r1),r3
|
l.sw 4(r1),r2
|
l.mfspr r3,r0,SPR_ESR_BASE /* save status register that was put
|
|
in exception register */
|
|
l.sw 4(r1),r3
|
|
|
store_context
|
store_context
|
/* either call OSIntEnter or Increment OSIntNesting */
|
/* either call OSIntEnter or Increment OSIntNesting */
|
|
|
/*
|
/*
|