mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-04-19 21:11:57 -04:00
Continue 78K0R development.
This commit is contained in:
parent
7acae9e570
commit
46425b4099
|
@ -67,7 +67,7 @@
|
|||
* |--------------------- Zero Flag set
|
||||
* ---------------------- Global Interrupt Flag set (enabled)
|
||||
*/
|
||||
#define portPSW (( portSTACK_TYPE ) 0xC600)
|
||||
#define portPSW (0xc6000000UL)
|
||||
|
||||
/* We require the address of the pxCurrentTCB variable, but don't want to know
|
||||
any details of its type. */
|
||||
|
@ -124,15 +124,16 @@ unsigned long *pulLocal;
|
|||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0xcdcd;
|
||||
pxTopOfStack--;
|
||||
|
||||
/* Initial PSW value. */
|
||||
// *pxTopOfStack = portPSW;
|
||||
|
||||
pxTopOfStack--;
|
||||
|
||||
|
||||
/* Task function start address. */
|
||||
pulLocal = ( unsigned long * ) pxTopOfStack;
|
||||
*pulLocal = ( unsigned long ) pxCode;
|
||||
pxTopOfStack--;
|
||||
|
||||
/* Initial PSW value. */
|
||||
*pxTopOfStack = portPSW;
|
||||
*pulLocal = ( ( ( unsigned long ) pxCode ) | portPSW );
|
||||
pxTopOfStack--;
|
||||
|
||||
/* Next general purpose register AX. */
|
||||
|
|
|
@ -77,6 +77,7 @@ MD_INTTM05 SYMBOL "MD_INTTM05"
|
|||
;------------------------------------------------------------------------------
|
||||
portSAVE_CONTEXT MACRO
|
||||
|
||||
PUSH AX ; save AX Register to stack
|
||||
PUSH HL
|
||||
#if configMEMORY_MODE == 1
|
||||
MOV A, CS ; save CS register
|
||||
|
@ -124,6 +125,7 @@ portRESTORE_CONTEXT MACRO
|
|||
MOV CS, A ; restore CS register
|
||||
#endif
|
||||
POP HL ; restore general purpose register HL
|
||||
POP AX ; restore AX
|
||||
ENDM
|
||||
;------------------------------------------------------------------------------
|
||||
|
||||
|
@ -139,16 +141,10 @@ portRESTORE_CONTEXT MACRO
|
|||
;------------------------------------------------------------------------------
|
||||
RSEG CODE:CODE
|
||||
vPortYield:
|
||||
PUSH PSW ; save Task PSW (Program Status Word)
|
||||
DI ; global disable interrupt
|
||||
PUSH AX
|
||||
portSAVE_CONTEXT ; Save the context of the current task.
|
||||
CALL vTaskSwitchContext ; Call the scheduler.
|
||||
call vTaskSwitchContext ; Call the scheduler.
|
||||
portRESTORE_CONTEXT ; Restore the context of whichever task the ...
|
||||
POP AX
|
||||
EI ; (re-)enable global interrupts
|
||||
POP PSW ; restore active task PSW
|
||||
RET ; ... scheduler decided should run.
|
||||
RETB
|
||||
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
|
@ -164,10 +160,8 @@ vPortYield:
|
|||
RSEG CODE:CODE
|
||||
vPortStart:
|
||||
portRESTORE_CONTEXT ; Restore the context of whichever task the ...
|
||||
POP AX
|
||||
EI ; enable global interrupts
|
||||
POP PSW ; restore active task PSW
|
||||
ret ; ... scheduler decided should run.
|
||||
; POP PSW ; restore active task PSW
|
||||
reti ; ... scheduler decided should run.
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
; Perform the necessary steps of the Tick Count Increment and Task Switch
|
||||
|
@ -183,22 +177,11 @@ vPortStart:
|
|||
#if configUSE_PREEMPTION == 1
|
||||
|
||||
MD_INTTM05:
|
||||
PUSH AX ; create temporary dummy area on stack
|
||||
PUSH AX ; save AX Register to stack
|
||||
MOVW AX, [SP+6] ; get PSW
|
||||
MOVW [SP+2], AX ; write PSW into dummy area on the stack
|
||||
|
||||
portSAVE_CONTEXT ; Save the context of the current task.
|
||||
call vTaskIncrementTick ; Call the timer tick function.
|
||||
call vTaskSwitchContext ; Call the scheduler.
|
||||
portRESTORE_CONTEXT ; Restore the context of whichever task the ...
|
||||
; ... scheduler decided should run.
|
||||
|
||||
MOVW AX, [SP+2] ; get PSW from stack
|
||||
MOVW [SP+6], AX ; write PSW to expected location for reti
|
||||
POP AX ; restore AX
|
||||
MOVW [SP+0], AX ; rewrite dummy stack area to expected value
|
||||
POP AX
|
||||
RETI
|
||||
#else
|
||||
|
||||
|
@ -220,6 +203,12 @@ MD_INTTM05:
|
|||
ORG 68
|
||||
`??MD_INTTM05??INTVEC 68`:
|
||||
DW MD_INTTM05
|
||||
|
||||
COMMON INTVEC:CODE:ROOT(1) ; set ISR location to the Interrupt vector table
|
||||
ORG 126
|
||||
`??vPortYield??INTVEC 126`:
|
||||
DW vPortYield
|
||||
|
||||
; set value for the usCriticalNesting
|
||||
RSEG NEAR_ID:CONST:SORT:NOROOT(1)
|
||||
`?<Initializer for usCriticalNesting>`:
|
||||
|
|
|
@ -123,12 +123,11 @@ extern volatile unsigned portSHORT usCriticalNesting; \
|
|||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* Task utilities. */
|
||||
extern void vPortYield( void );
|
||||
extern void vPortStart( void );
|
||||
extern void portSAVE_CONTEXT( void );
|
||||
extern void portRESTORE_CONTEXT( void );
|
||||
#define portYIELD() vPortYield()
|
||||
#define portNOP() __asm ( "NOP" )
|
||||
#define portYIELD() __asm( "BRK" )
|
||||
#define portNOP() __asm( "NOP" )
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* Hardwware specifics. */
|
||||
|
|
Loading…
Reference in a new issue