os_cpu.a51 File Reference

Go to the source code of this file.

Functions

NAME OS_CPU_A51 $include (8052sfr.inc) public OsCpuStack

Variables

stack base public OSPrioCur
Current running task id PUBLIC OSPrioHighRdy
Next ready task id public OSTCBCur
Current running task public OSTCBHighRdy
Next task ready to run public OsCpuLoadContext
Function for load task to run
public 
OsCpuContextSwitch
Function for task level
context switch public 
OsCpuContextSwitchIsr
Function for interrupt level
context switch PUSHA MACRO IRP 
REG
Function for interrupt level
context switch PUSHA MACRO IRP
< ACC, B, DPH, DPL, PSW, R0,
R1, R2, R3, R4, R5, R6, R7 >
MOV 
A
Function for interrupt level
context switch PUSHA MACRO IRP
< ACC, B, DPH, DPL, PSW, R0,
R1, R2, R3, R4, R5, R6, R7 >
MOV REG PUSH ACC ENDM ENDM
POPA MACRO IRP< R7, R6, R5, R4,
R3, R2, R1, R0, PSW, DPL, DPH,
B, ACC > POP ACC MOV A ENDM
ENDM DT OsCpuStackPointer
SEGMENT DATA RSEG DT
OsCpuStackPointer 
OsCpuStackPointer
STACK is declare as DS at
startup a51 RSEG 
STACK
OsCpuStack __pad0__
mov dph
get task control block struct
address of current task inc 
dptr
Skip byte of OsCpuTaskStack
byte is pointer type byte movx 
a
mov dpl
get byte in task memory stack mov sp
assign to sp sfr mov r0
index to next byte of task
memory stack 
L_LoadLoop
Take out r0 ~r7
Take out r0 psw
Take out r0 b
Take out r0 acc setb ea
Enable all interrupt ret
Task level context switch PUSHA
Push acc
A stack space for storing
stack depth mov
OsCpuStackPointer mov
OsCpuStackPointer clr c xch
dpl subb dpl jnc L_ContextSave
dec dph 
L_ContextSave
Save sp top to task memory stack L_ContextSaveLoop
Get task memory stack pointer
in OS_TCB mov 
OsCpuStackPointer2
Get stack top from task memory
stack mov sp inc dptr 
L_OsCpuContextLoadLoop
update OSPrioHighRdy to OSPrioCur POPA
Pop out isr call out address
A stack space for storing
stack depth mov
OsCpuStackPointer mov
OsCpuStackPointer clr c xch
dpl subb dpl jnc
L_ContextSaveIsr dec dph 
L_ContextSaveIsr
Save sp top to task memory stack L_ContextSaveLoopIsr
Get stack top from task memory
stack mov sp inc dptr 
L_OsCpuContextLoadLoopIsr
enable interrupt reti


Function Documentation

NAME OS_CPU_A51 $include ( 8052sfr.  inc  ) 


Variable Documentation

Definition at line 45 of file os_cpu.a51.

save task stack pointer back to task control block struct movx dptr a [read]

Definition at line 54 of file os_cpu.a51.

Function for interrupt level context switch PUSHA MACRO IRP<ACC,B,DPH,DPL,PSW,R0,R1,R2,R3,R4,R5,R6,R7> MOV A

Definition at line 22 of file os_cpu.a51.

Loop for copying stack to task memory stack pop acc

Definition at line 91 of file os_cpu.a51.

Pop out isr call out address

Initial value:

task call out address+PUSHA
    pop   acc

Definition at line 177 of file os_cpu.a51.

Push b

Definition at line 85 of file os_cpu.a51.

save dptr to next task stack pointer mov dph [read]

Definition at line 51 of file os_cpu.a51.

save dptr to next task stack pointer mov OSTCBHighRdy mov dpl

Definition at line 61 of file os_cpu.a51.

Loop for copying task memory stack to stack inc dptr [read]

Definition at line 52 of file os_cpu.a51.

pop out next task stack setb ea

Definition at line 85 of file os_cpu.a51.

A stack space for storing stack depth mov OsCpuStackPointer mov OsCpuStackPointer clr c xch dpl subb dpl jnc L_ContextSave dec dph L_ContextSave

Definition at line 106 of file os_cpu.a51.

A stack space for storing stack depth mov OsCpuStackPointer mov OsCpuStackPointer clr c xch dpl subb dpl jnc L_ContextSaveIsr dec dph L_ContextSaveIsr

Definition at line 194 of file os_cpu.a51.

Loop for copying stack to task memory stack djnz L_ContextSaveLoop

Definition at line 119 of file os_cpu.a51.

Loop for copying stack to task memory stack djnz L_ContextSaveLoopIsr

Definition at line 208 of file os_cpu.a51.

index to next byte of task memory stack L_LoadLoop

Definition at line 66 of file os_cpu.a51.

Get stack top from task memory stack mov sp inc dptr L_OsCpuContextLoadLoop

Definition at line 147 of file os_cpu.a51.

Get stack top from task memory stack mov sp inc dptr L_OsCpuContextLoadLoopIsr

Definition at line 235 of file os_cpu.a51.

return to Task which is pre_store in task stack OsCpuContextSwitch

Definition at line 18 of file os_cpu.a51.

Referenced by OsCoreScheduler().

return to next task OsCpuContextSwitchIsr

Definition at line 19 of file os_cpu.a51.

Referenced by IsrTimer0().

OsCpuStack is STACK PR MemberFunc OS_CPU_A51 SEGMENT CODE RSEG PR MemberFunc OS_CPU_A51 OsCpuLoadContext

Definition at line 17 of file os_cpu.a51.

Referenced by OsCoreStart().

Save task stack pointer back to task control block struct inc dptr mov a OsCpuStackPointer [read]

Definition at line 22 of file os_cpu.a51.

save task stack pointer back to task control block struct inc dptr mov a OsCpuStackPointer2 [read]

Definition at line 138 of file os_cpu.a51.

Definition at line 13 of file os_cpu.a51.

Referenced by OsCoreStart().

Definition at line 14 of file os_cpu.a51.

Referenced by OsCoreScheduler(), and OsCoreSchedulerIsr().

update OSTCBHighRdy to OSTCBCur mov OSTCBCur [read]

Definition at line 15 of file os_cpu.a51.

Referenced by OsCoreStart().

update OSTCBHighRdy to OSTCBCur mov OSTCBHighRdy [read]

Definition at line 16 of file os_cpu.a51.

Referenced by OsCoreScheduler(), and OsCoreSchedulerIsr().

Definition at line 171 of file os_cpu.a51.

Push psw

Definition at line 85 of file os_cpu.a51.

Task level context switch PUSHA

Definition at line 91 of file os_cpu.a51.

Loop for copying task memory stack to stack cjne r0

Definition at line 64 of file os_cpu.a51.

Function for interrupt level context switch PUSHA MACRO IRP< ACC, B, DPH, DPL, PSW, R0, R1, R2, R3, R4, R5, R6, R7 > MOV REG PUSH ACC ENDM ENDM POPA MACRO IRP< R7, R6, R5, R4, R3, R2, R1, R0, PSW, DPL, DPH, B, ACC > POP ACC MOV REG

Definition at line 22 of file os_cpu.a51.

enable interrupt ret

Definition at line 87 of file os_cpu.a51.

enable interrupt reti

Definition at line 261 of file os_cpu.a51.

Get stack top from task memory stack mov sp

Definition at line 63 of file os_cpu.a51.

STACK is declare as DS at startup a51 RSEG STACK

Definition at line 44 of file os_cpu.a51.

Take out r0 ~r7

Definition at line 85 of file os_cpu.a51.


Generated on Sat Aug 9 12:09:59 2008 for A Small Multi-Tasking Operation System Using 8051 by  doxygen 1.5.6