os_cpu_c.src
来自「我移植的uCos 2.52版本,在MCS51上运行,代码进行了一些优化,可以编译」· SRC 代码 · 共 1,279 行 · 第 1/3 页
SRC
1,279 行
CLR EA
; C_XBP=OSTCBCur->OSTCBStkPtr;
; SOURCE LINE # 243
MOV R0,OSTCBCur
MOV A,@R0
MOV R6,A
INC R0
MOV A,@R0
MOV C_XBP,R6
MOV C_XBP+01H,A
; #pragma ASM
; // SP=SaveSP
; // C_IBP=SaveC_IBP;
; MOV SP,SaveSP
MOV SP,SaveSP
; MOV ?C_IBP,SaveC_IBP
MOV ?C_IBP,SaveC_IBP
; #pragma ENDASM
; #pragma ASM
; POP IE
POP IE
; #pragma ENDASM
; }
; SOURCE LINE # 253
;
; }
; SOURCE LINE # 255
?C0007:
POP AR7
POP AR6
POP AR5
POP AR4
POP AR3
POP AR2
POP AR1
POP AR0
POP PSW
POP DPL
POP DPH
POP B
POP ACC
RETI
; END OF OSTickISR
CSEG AT 00023H
LJMP SerialIntr
;
; /* Sample user ISR: Serial communication */
; /* If you want to write ISRs for your own, just do as following */
; void SerialIntr(void) interrupt 4
RSEG ?PR?SerialIntr?OS_CPU_C
USING 0
SerialIntr:
PUSH ACC
PUSH B
PUSH DPH
PUSH DPL
PUSH PSW
MOV PSW,#00H
PUSH AR0
PUSH AR1
PUSH AR2
PUSH AR3
PUSH AR4
PUSH AR5
PUSH AR6
PUSH AR7
USING 0
; SOURCE LINE # 259
; {
; /* Do this first */
; OSIntNesting++; /* Increment ISR nesting level directly to speed up processing */
; SOURCE LINE # 262
INC OSIntNesting
; // OSIntEnter(); /* Must be called first at every hardware interrupt entry point */
; if(OSIntNesting==1) /* Only at the outerest interrupt we do these. */
; SOURCE LINE # 264
MOV A,OSIntNesting
CJNE A,#01H,?C0008
; {
; SOURCE LINE # 265
; #pragma ASM
; PUSH IE
PUSH IE
; #pragma ENDASM
; EA=0;
; SOURCE LINE # 269
CLR EA
;
; #pragma ASM
; //SaveC_IBP=C_IBP;
; //SaveSP=SP;
; MOV SaveC_IBP,?C_IBP
MOV SaveC_IBP,?C_IBP
; MOV SaveSP,SP
MOV SaveSP,SP
; #pragma ENDASM
; OSTCBCur->OSTCBStkPtr=C_XBP; /* OSTCBCur->OSTCBStkPtr is free now, so it can be used to story the value of SP */
; SOURCE LINE # 277
MOV R0,OSTCBCur
MOV @R0,C_XBP
INC R0
MOV @R0,C_XBP+01H
; EA=1;
; SOURCE LINE # 278
SETB EA
; }
; SOURCE LINE # 279
?C0008:
;
;
; /* Next you can do something for yourself. */
; /* Finally, before exit from ISR, must do as following. */
; OSIntExit(); /* Must be called finally at every hardware interupt exit point */
; SOURCE LINE # 284
LCALL _?OSIntExit
; if(OSIntNesting==0)
; SOURCE LINE # 285
MOV A,OSIntNesting
JNZ ?C0010
; {
; SOURCE LINE # 286
; EA=0;
; SOURCE LINE # 287
CLR EA
; C_XBP=OSTCBCur->OSTCBStkPtr;
; SOURCE LINE # 288
MOV R0,OSTCBCur
MOV A,@R0
MOV R6,A
INC R0
MOV A,@R0
MOV C_XBP,R6
MOV C_XBP+01H,A
; //C_IBP=SaveC_IBP;
; //SP=SaveSP;
; #pragma ASM
; // SP=SaveSP
; // C_IBP=SaveC_IBP;
; MOV SP,SaveSP
MOV SP,SaveSP
; MOV ?C_IBP,SaveC_IBP
MOV ?C_IBP,SaveC_IBP
; #pragma ENDASM
; #pragma ASM
; POP IE
POP IE
; #pragma ENDASM
; }
; SOURCE LINE # 300
; }
; SOURCE LINE # 301
?C0010:
POP AR7
POP AR6
POP AR5
POP AR4
POP AR3
POP AR2
POP AR1
POP AR0
POP PSW
POP DPL
POP DPH
POP B
POP ACC
RETI
; END OF SerialIntr
;
;
; /*$PAGE*/
; #if OS_CPU_HOOKS_EN
; /*
; *********************************************************************************************************
; * OS INITIALIZATION HOOK
; * (BEGINNING)
; *
; * Description: This function is called by OSInit() at the beginning of OSInit().
; *
; * Arguments : none
; *
; * Note(s) : 1) Interrupts should be disabled during this call.
; *********************************************************************************************************
; */
; #if OS_VERSION > 203
; void OSInitHookBegin (void) KCREENTRANT
RSEG ?PR?_?OSInitHookBegin?OS_CPU_C
_?OSInitHookBegin:
; SOURCE LINE # 319
; {
; }
; SOURCE LINE # 321
RET
; END OF _?OSInitHookBegin
; #endif
;
; /*
; *********************************************************************************************************
; * OS INITIALIZATION HOOK
; * (END)
; *
; * Description: This function is called by OSInit() at the end of OSInit().
; *
; * Arguments : none
; *
; * Note(s) : 1) Interrupts should be disabled during this call.
; *********************************************************************************************************
; */
; #if OS_VERSION > 203
; void OSInitHookEnd (void) KCREENTRANT
RSEG ?PR?_?OSInitHookEnd?OS_CPU_C
_?OSInitHookEnd:
; SOURCE LINE # 337
; {
; }
; SOURCE LINE # 339
RET
; END OF _?OSInitHookEnd
; #endif
;
;
; /*
; *********************************************************************************************************
; * TASK CREATION HOOK
; *
; * Description: This function is called when a task is created.
; *
; * Arguments : ptcb is a pointer to the task control block of the task being created.
; *
; * Note(s) : 1) Interrupts are disabled during this call.
; *********************************************************************************************************
; */
; void OSTaskCreateHook (OS_TCB _IDATA *ptcb) KCREENTRANT
RSEG ?PR?_?OSTaskCreateHook?OS_CPU_C
_?OSTaskCreateHook:
USING 0
; SOURCE LINE # 354
DEC ?C_IBP
MOV R0,?C_IBP
MOV @R0,AR7
; {
; ptcb = ptcb; /* Prevent compiler warning */
; SOURCE LINE # 356
MOV R0,?C_IBP
MOV A,@R0
MOV @R0,A
; }
; SOURCE LINE # 357
INC ?C_IBP
RET
; END OF _?OSTaskCreateHook
;
;
; /*
; *********************************************************************************************************
; * TASK DELETION HOOK
; *
; * Description: This function is called when a task is deleted.
; *
; * Arguments : ptcb is a pointer to the task control block of the task being deleted.
; *
; * Note(s) : 1) Interrupts are disabled during this call.
; *********************************************************************************************************
; */
; #if OS_TASK_DEL_EN > 0
; void OSTaskDelHook (OS_TCB _IDATA *ptcb) KCREENTRANT
; {
; //ptcb = ptcb; /* Prevent compiler warning
; ptcb+=0; */
; }
; #endif
;
; /*
; *********************************************************************************************************
; * TASK SWITCH HOOK
; *
; * Description: This function is called when a task switch is performed. This allows you to perform other
; * operations during a context switch.
; *
; * Arguments : none
; *
; * Note(s) : 1) Interrupts are disabled during this call.
; * 2) It is assumed that the global pointer 'OSTCBHighRdy' points to the TCB of the task that
; * will be 'switched in' (i.e. the highest priority task) and, 'OSTCBCur' points to the
; * task being switched out (i.e. the preempted task).
; *********************************************************************************************************
; */
; void OSTaskSwHook (void) KCREENTRANT
RSEG ?PR?_?OSTaskSwHook?OS_CPU_C
_?OSTaskSwHook:
; SOURCE LINE # 394
; {
; }
; SOURCE LINE # 396
RET
; END OF _?OSTaskSwHook
;
; /*
; *********************************************************************************************************
; * STATISTIC TASK HOOK
; *
; * Description: This function is called every second by uC/OS-II's statistics task. This allows your
; * application to add functionality to the statistics task.
; *
; * Arguments : none
; *********************************************************************************************************
; */
; void OSTaskStatHook (void) KCREENTRANT
RSEG ?PR?_?OSTaskStatHook?OS_CPU_C
_?OSTaskStatHook:
; SOURCE LINE # 408
; {
; }
; SOURCE LINE # 410
RET
; END OF _?OSTaskStatHook
;
; /*
; *********************************************************************************************************
; * OSTCBInit() HOOK
; *
; * Description: This function is called by OSTCBInit() after setting up most of the TCB.
; *
; * Arguments : ptcb is a pointer to the TCB of the task being created.
; *
; * Note(s) : 1) Interrupts may or may not be ENABLED during this call.
; *********************************************************************************************************
; */
; #if OS_VERSION > 203
; void OSTCBInitHook (OS_TCB _IDATA *ptcb) KCREENTRANT
RSEG ?PR?_?OSTCBInitHook?OS_CPU_C
_?OSTCBInitHook:
USING 0
; SOURCE LINE # 424
DEC ?C_IBP
MOV R0,?C_IBP
MOV @R0,AR7
; {
; ptcb = ptcb; /* Prevent Compiler warning */
; SOURCE LINE # 426
MOV R0,?C_IBP
MOV A,@R0
MOV @R0,A
; }
; SOURCE LINE # 427
INC ?C_IBP
RET
; END OF _?OSTCBInitHook
; #endif
;
;
; /*
; *********************************************************************************************************
; * TICK HOOK
; *
; * Description: This function is called every tick.
; *
; * Arguments : none
; *
; * Note(s) : 1) Interrupts may or may not be ENABLED during this call.
; *********************************************************************************************************
; */
; void OSTimeTickHook (void) KCREENTRANT
RSEG ?PR?_?OSTimeTickHook?OS_CPU_C
_?OSTimeTickHook:
; SOURCE LINE # 442
; {
; }
; SOURCE LINE # 444
RET
; END OF _?OSTimeTickHook
;
;
; /*
; *********************************************************************************************************
; * IDLE TASK HOOK
; *
; * Description: This function is called by the idle task. This hook has been added to allow you to do
; * such things as STOP the CPU to conserve power.
; *
; * Arguments : none
; *
; * Note(s) : 1) Interrupts are enabled during this call.
; *********************************************************************************************************
; */
; #if OS_VERSION >= 251
; void OSTaskIdleHook (void) KCREENTRANT
RSEG ?PR?_?OSTaskIdleHook?OS_CPU_C
_?OSTaskIdleHook:
; SOURCE LINE # 460
; {
; PCON = PCON | 0x01;
; SOURCE LINE # 462
ORL PCON,#01H
; }
; SOURCE LINE # 463
RET
; END OF _?OSTaskIdleHook
END
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?