Tidy up the RL78 port layer.

pull/4/head
Richard Barry 14 years ago
parent 476a87dfdc
commit 573497fbe0

@ -76,7 +76,7 @@ interrupts don't accidentally become enabled before the scheduler is started. */
* |--------------------- Zero Flag set
* ---------------------- Global Interrupt Flag set (enabled)
*/
#define portPSW ( 0xc6U )
#define portPSW ( 0xc6UL )
/* The address of the pxCurrentTCB variable, but don't know or need to know its
type. */
@ -100,6 +100,12 @@ volatile unsigned short usCriticalNesting = portINITIAL_CRITICAL_NESTING;
*/
static void prvSetupTimerInterrupt( void );
/*
* Defined in portasm.s87, this function starts the scheduler by loading the
* context of the first task to run.
*/
extern void vPortStartFirstTask( void );
/*-----------------------------------------------------------*/
/*
@ -192,7 +198,7 @@ portBASE_TYPE xPortStartScheduler( void )
prvSetupTimerInterrupt();
/* Restore the context of the first task that is going to run. */
vPortStart();
vPortStartFirstTask();
/* Execution should not reach here as the tasks are now running! */
return pdTRUE;

@ -61,40 +61,15 @@
#define CS 0xFFFFC
#define ES 0xFFFFD
; Functions implemented in this file
;------------------------------------------------------------------------------
PUBLIC vPortYield
PUBLIC vPortStart
PUBLIC vPortStartFirstTask
PUBLIC vPortTickISR
; Functions used by scheduler
;------------------------------------------------------------------------------
EXTERN vTaskSwitchContext
EXTERN vTaskIncrementTick
; Tick ISR Prototype
;------------------------------------------------------------------------------
EXTERN ?CLRL78_V1_0_L00
PUBWEAK `??MD_INTIT??INTVEC 56`
PUBLIC MD_INTIT
MD_INTIT SYMBOL "MD_INTIT"
`??MD_INTIT??INTVEC 56` SYMBOL "??INTVEC 56", MD_INTIT
;------------------------------------------------------------------------------
; 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
;
;------------------------------------------------------------------------------
; FreeRTOS yield handler. This is installed as the BRK software interrupt
; handler.
RSEG CODE:CODE
vPortYield:
portSAVE_CONTEXT ; Save the context of the current task.
@ -103,35 +78,17 @@ vPortYield:
retb
;------------------------------------------------------------------------------
; Restore the context of the first task that is going to run.
;
; Input: NONE
;
; Call: CALL vPortStart
;
; Output: NONE
;
;------------------------------------------------------------------------------
; Starts the scheduler by restoring the context of the task that will execute
; first.
RSEG CODE:CODE
vPortStart:
vPortStartFirstTask:
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_INTIT:
; FreeRTOS tick handler. This is installed as the interval timer interrupt
; handler.
vPortTickISR:
portSAVE_CONTEXT ; Save the context of the current task.
call vTaskIncrementTick ; Call the timer tick function.
@ -142,23 +99,15 @@ MD_INTIT:
reti
; Install the interrupt handlers
REQUIRE ?CLRL78_V1_0_L00
COMMON INTVEC:CODE:ROOT(1) ; Set ISR location to the Interrupt vector table.
COMMON INTVEC:CODE:ROOT(1)
ORG 56
`??MD_INTIT??INTVEC 56`:
DW MD_INTIT
DW vPortTickISR
COMMON INTVEC:CODE:ROOT(1) ; Set ISR location to the Interrupt vector table.
COMMON INTVEC:CODE:ROOT(1)
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

@ -140,7 +140,6 @@ extern volatile unsigned short usCriticalNesting; \
/*-----------------------------------------------------------*/
/* Task utilities. */
extern void vPortStart( void );
#define portYIELD() __asm( "BRK" )
#define portYIELD_FROM_ISR( xHigherPriorityTaskWoken ) if( xHigherPriorityTaskWoken ) vTaskSwitchContext()
#define portNOP() __asm( "NOP" )

Loading…
Cancel
Save