⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 os_cpu_c.src

📁 我移植的uCos 2.86 版本,可以在单片51上运行,在AT89C51ED2上测试过.
💻 SRC
📖 第 1 页 / 共 3 页
字号:
	CLR  	EA
;         C_XBP = OSTCBCur->OSTCBStkPtr;
			; SOURCE LINE # 243
	MOV  	R0,#LOW (OSTCBCur)
	MOV  	A,@R0
	MOV  	R6,A
	INC  	R0
	MOV  	A,@R0
	MOV  	DPL,A
	MOV  	DPH,R6
	MOVX 	A,@DPTR
	MOV  	R6,A
	INC  	DPTR
	MOVX 	A,@DPTR
	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
	XRL  	AUXR1,#01H
	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
	XRL  	AUXR1,#01H
	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,#LOW (OSTCBCur)
	MOV  	A,@R0
	MOV  	R6,A
	INC  	R0
	MOV  	A,@R0
	MOV  	DPL,A
	MOV  	DPH,R6
	MOV  	A,C_XBP
	MOVX 	@DPTR,A
	INC  	DPTR
	MOV  	A,C_XBP+01H
	MOVX 	@DPTR,A
; 		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,#LOW (OSTCBCur)
	MOV  	A,@R0
	MOV  	R6,A
	INC  	R0
	MOV  	A,@R0
	MOV  	DPL,A
	MOV  	DPH,R6
	MOVX 	A,@DPTR
	MOV  	R6,A
	INC  	DPTR
	MOVX 	A,@DPTR
	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
	XRL  	AUXR1,#01H
	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:
	USING	0
			; SOURCE LINE # 319
; {
			; SOURCE LINE # 320
; }
			; 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:
	USING	0
			; SOURCE LINE # 337
; {
			; SOURCE LINE # 338
; }
			; 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 *ptcb) KCREENTRANT

	RSEG  ?PR?_OSTaskCreateHook?OS_CPU_C
_OSTaskCreateHook:
	USING	0
			; SOURCE LINE # 354
;---- Variable 'ptcb?845' assigned to Register 'R6/R7' ----
; {
			; SOURCE LINE # 355
;     ptcb = ptcb;                       /* Prevent compiler warning                                     */
			; SOURCE LINE # 356
; }
			; SOURCE LINE # 357
	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:
	USING	0
			; SOURCE LINE # 394
; {
			; SOURCE LINE # 395
; }
			; 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:
	USING	0
			; SOURCE LINE # 408
; {
			; SOURCE LINE # 409
; }
			; 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 *ptcb) KCREENTRANT

	RSEG  ?PR?_OSTCBInitHook?OS_CPU_C
_OSTCBInitHook:
	USING	0
			; SOURCE LINE # 424
;---- Variable 'ptcb?1146' assigned to Register 'R6/R7' ----
; {
			; SOURCE LINE # 425
;     ptcb = ptcb;                                           /* Prevent Compiler warning                 */
			; SOURCE LINE # 426
; }
			; SOURCE LINE # 427
	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:
	USING	0
			; SOURCE LINE # 442
; {
			; SOURCE LINE # 443
; }
			; 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:
	USING	0
			; SOURCE LINE # 460
; {
			; SOURCE LINE # 461
; 	PCON = PCON | 0x01;
			; SOURCE LINE # 462
	ORL  	PCON,#01H
; }
			; SOURCE LINE # 463
	RET  	
; END OF OSTaskIdleHook

	END

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -