|
|
@ -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
|