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 * |--------------------- Zero Flag set
* ---------------------- Global Interrupt Flag set (enabled) * ---------------------- 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 /* The address of the pxCurrentTCB variable, but don't know or need to know its
type. */ type. */
@ -100,6 +100,12 @@ volatile unsigned short usCriticalNesting = portINITIAL_CRITICAL_NESTING;
*/ */
static void prvSetupTimerInterrupt( void ); 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(); 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. */
vPortStart(); vPortStartFirstTask();
/* Execution should not reach here as the tasks are now running! */ /* Execution should not reach here as the tasks are now running! */
return pdTRUE; return pdTRUE;

@ -61,40 +61,15 @@
#define CS 0xFFFFC #define CS 0xFFFFC
#define ES 0xFFFFD #define ES 0xFFFFD
; Functions implemented in this file
;------------------------------------------------------------------------------
PUBLIC vPortYield PUBLIC vPortYield
PUBLIC vPortStart PUBLIC vPortStartFirstTask
PUBLIC vPortTickISR
; Functions used by scheduler
;------------------------------------------------------------------------------
EXTERN vTaskSwitchContext EXTERN vTaskSwitchContext
EXTERN vTaskIncrementTick EXTERN vTaskIncrementTick
; Tick ISR Prototype ; FreeRTOS yield handler. This is installed as the BRK software interrupt
;------------------------------------------------------------------------------ ; handler.
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
;
;------------------------------------------------------------------------------
RSEG CODE:CODE RSEG CODE:CODE
vPortYield: vPortYield:
portSAVE_CONTEXT ; Save the context of the current task. portSAVE_CONTEXT ; Save the context of the current task.
@ -103,35 +78,17 @@ vPortYield:
retb retb
;------------------------------------------------------------------------------ ; Starts the scheduler by restoring the context of the task that will execute
; Restore the context of the first task that is going to run. ; first.
;
; Input: NONE
;
; Call: CALL vPortStart
;
; Output: NONE
;
;------------------------------------------------------------------------------
RSEG CODE:CODE RSEG CODE:CODE
vPortStart: vPortStartFirstTask:
portRESTORE_CONTEXT ; Restore the context of whichever task the ... portRESTORE_CONTEXT ; Restore the context of whichever task the ...
reti ; An interrupt stack frame is used so the task reti ; An interrupt stack frame is used so the task
; is started using a RETI instruction. ; is started using a RETI instruction.
;------------------------------------------------------------------------------ ; FreeRTOS tick handler. This is installed as the interval timer interrupt
; Perform the necessary steps of the Tick Count Increment and Task Switch ; handler.
; depending on the chosen kernel configuration vPortTickISR:
;
; Input: NONE
;
; Call: ISR
;
; Output: NONE
;
;------------------------------------------------------------------------------
MD_INTIT:
portSAVE_CONTEXT ; Save the context of the current task. portSAVE_CONTEXT ; Save the context of the current task.
call vTaskIncrementTick ; Call the timer tick function. call vTaskIncrementTick ; Call the timer tick function.
@ -142,23 +99,15 @@ MD_INTIT:
reti reti
; Install the interrupt handlers
REQUIRE ?CLRL78_V1_0_L00 COMMON INTVEC:CODE:ROOT(1)
COMMON INTVEC:CODE:ROOT(1) ; Set ISR location to the Interrupt vector table.
ORG 56 ORG 56
`??MD_INTIT??INTVEC 56`: DW vPortTickISR
DW MD_INTIT
COMMON INTVEC:CODE:ROOT(1) ; Set ISR location to the Interrupt vector table. COMMON INTVEC:CODE:ROOT(1)
ORG 126 ORG 126
`??vPortYield??INTVEC 126`:
DW vPortYield DW vPortYield
; Set value for the usCriticalNesting.
RSEG NEAR_ID:CONST:SORT:NOROOT(1)
`?<Initializer for usCriticalNesting>`:
DW 10
;#endif
END END

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

Loading…
Cancel
Save