📄 os_cpu_a.asm
字号:
//;********************************************************************************************************
//; uC/OS-II
//; The Real-Time Kernel
//;
//; (c) Copyright 1992-2002, Jean J. Labrosse, Weston, FL
//; All Rights Reserved
//;
//;
//; unsp Specific code
//; LARGE MEMORY MODEL
//;
//; Borland C/C++ V4.51
//; (IBM/PC Compatible Target)
//;
//; File : OS_CPU_A.ASM
//; By : Jean J. Labrosse
//; Modify : Zhiquan Ni
//;********************************************************************************************************
//;********************************************************************************************************
//; PUBLIC and EXTERNAL REFERENCES
//;********************************************************************************************************
.include ..\SPCE061A.inc
.public _OSTickISR
.public _OSStartHighRdy
.public _OSCtxSw
.public _OSIntCtxSw
//---- external function
.external _OSIntEnter
.external _OSIntExit
.external _OSTimeTick
.external _OSTaskSwHook
.external _OSIntNesting
.external _OSPrioHighRdy
.external _OSPrioCur
.external _OSRunning
.external _OSTCBCur
.external _OSTCBHighRdy
.CODE
//*************************************************************
_OSStartHighRdy: .proc
call _OSTaskSwHook
r1 = 1
[_OSRunning] = r1
r1 = [_OSTCBHighRdy]
sp = [r1]
pop r5 from [sp]
pop r4 from [sp]
pop r3 from [sp]
pop r2 from [sp]
pop r1 from [sp]
reti
.endp
//*************************************************************
_OSCtxSw: .proc
push r1 to [sp]
push r2 to [sp]
push r3 to [sp]
push r4 to [sp]
push r5 to [sp]
//r1 = [_OSTCBHighRdy] // save current task stack
r1 = [_OSTCBCur]
[r1] = sp
call _OSTaskSwHook
r1 = [_OSTCBHighRdy] // _OSTCBCur = _OSTCBHighRdy
[_OSTCBCur] = r1 //
r1 = [_OSPrioHighRdy] // _OSPrioCur = _OSPrioHighRdy
[_OSPrioCur] = r1
r1 = [_OSTCBHighRdy]
sp = [r1]
pop r5 from [sp]
pop r4 from [sp]
pop r3 from [sp]
pop r2 from [sp]
pop r1 from [sp]
reti
.endp
//*************************************************************
_OSIntCtxSw: .proc
call _OSTaskSwHook
r1 = [_OSTCBHighRdy] // _OSTCBCur = _OSTCBHighRdy
[_OSPrioCur] = r1
r1 = [_OSPrioHighRdy] // _OSPrioCur = _OSPrioHighRdy
[_OSTCBCur] = r1
r1 = [_OSTCBHighRdy]
sp = [r1]
pop r5 from [sp]
pop r4 from [sp]
pop r3 from [sp]
pop r2 from [sp]
pop r1 from [sp]
reti
.endp
//*************************************************************
_OSTickISR: .proc
push r1 to [sp]
push r2 to [sp]
push r3 to [sp]
push r4 to [sp]
push r5 to [sp]
call _OSIntEnter;
r1 = [_OSIntNesting]
cmp r1, 1
jne _not_mul_int_neeting
r1 = [_OSTCBCur]
[r1] = sp
_not_mul_int_neeting:
// clear interrupt flag. for spce061a use time base 128Hz interrupt.
r1 = 1
[P_INT_Clear] = r1
// enalble interrupt (opt)
call _OSTimeTick
call _OSIntExit
pop r5 from [sp]
pop r4 from [sp]
pop r3 from [sp]
pop r2 from [sp]
pop r1 from [sp]
reti
.endp
//*************************************************************
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -