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

📄 os_cpu_c.src

📁 uC/OS操作系统在51平台的移植代码
💻 SRC
📖 第 1 页 / 共 2 页
字号:
; 	*--stk			 = 0;                   /* R0  */
			; SOURCE LINE # 80
	LCALL	L?0010
	CLR  	A
	LCALL	?C?CSTPTR
; 
; 	stk				-= sizeof(void *);      /* Keil C uses R1,R2,R3 to pass the */
			; SOURCE LINE # 82
	LCALL	L?0013
	INC  	DPTR
	MOV  	A,#0FFH
	MOV  	B,#0FDH
	LCALL	?C?IILDX
; 	*(void**)stk	 = vd;                  /* arguments of functions.          */
			; SOURCE LINE # 83
	MOV  	DPTR,#06H
	LCALL	?C?XBPOFF
	LCALL	?C?PLDXDATA
	PUSH 	AR3
	PUSH 	AR2
	PUSH 	AR1
	LCALL	L?0013
	LCALL	?C?PLDXDATA
	LCALL	?C?PSTPTR
; 
; 	*--stk			 = 4;                   /* R4  */
			; SOURCE LINE # 85
	LCALL	L?0011
	MOV  	A,#04H
; 	*--stk			 = 5;                   /* R5  */
			; SOURCE LINE # 86
	LCALL	L?0010
	MOV  	A,#05H
; 	*--stk			 = 6;                   /* R6  */
			; SOURCE LINE # 87
	LCALL	L?0010
	MOV  	A,#06H
; 	*--stk			 = 7;                   /* R7  */
			; SOURCE LINE # 88
	LCALL	L?0010
	MOV  	A,#07H
; 
;     *--stk           = 0x80;                /* IE, EA is enabled  */
			; SOURCE LINE # 90
	LCALL	L?0010
	MOV  	A,#080H
	LCALL	?C?CSTPTR
; /*
;     Next is calculating the hardware stack pointer.
; */
;     *--stk			 = (INT8U) Stack-1    /* Initial value when main was called    */
			; SOURCE LINE # 94
	MOV  	A,#LOW (Stack)
	ADD  	A,#011H
	MOV  	R7,A
	LCALL	L?0011
	MOV  	A,R7
	LCALL	?C?CSTPTR
; 	                   +1                   /* IE */
; 	                   +8                   /* R0-R7, eight registers was saved      */
;                        +5                   /* PSW, ACC, B, DPH, DPL, five registers */
;                        +sizeof(INT16U)      /* The PC value to be loaded             */
;                        +sizeof(INT16U)      /* The PC value to be loaded             */
; 					   ;
; 
;     return ((void *)stk);
			; SOURCE LINE # 102
	LCALL	L?0013
	LCALL	?C?PLDXDATA
; }
			; SOURCE LINE # 103
?C0001:
	MOV  	DPTR,#0EH
	LJMP 	?C?ADDXBP
; END OF _?OSTaskStkInit

CSEG	AT	0000BH
	LJMP	_?OSTickISR

; 
; 
; 
; void UserTickTimer(void) KCREENTRANT;
; 
; /* OSTickISR can be writen in c language now, so it is more easy for user to write code for their own */
; void OSTickISR(void) KCREENTRANT interrupt 1 

	RSEG  ?PR?_?OSTickISR?OS_CPU_C
	USING	0
_?OSTickISR:
	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 # 110
; {
;  
; #pragma ASM
; PUSH IE
	  PUSH IE
; #pragma ENDASM
; OSIntEnter();
			; SOURCE LINE # 116
	LCALL	_?OSIntEnter
; UserTickTimer();				
			; SOURCE LINE # 117
	LCALL	_?UserTickTimer
; OSTimeTick();					
			; SOURCE LINE # 118
	LCALL	_?OSTimeTick
; OSIntExit();
			; SOURCE LINE # 119
	LCALL	_?OSIntExit
; #pragma ASM
; POP IE
	  POP IE
; #pragma ENDASM		
; }
			; SOURCE LINE # 123
	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

; 
; /* If you want to write ISRs for your own, just do as OSTickISR() */
; 
; /*$PAGE*/
; #if OS_CPU_HOOKS_EN
; 
; 
; /*
; *********************************************************************************************************
; *                                          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 # 142
	LCALL	L?0014
; {
;     ptcb = ptcb;                       /* Prevent compiler warning                                     */
			; SOURCE LINE # 144
	LCALL	L?0013
	LCALL	?C?PLDXDATA
	LCALL	L?0013
	LCALL	?C?PSTXDATA
; }
			; SOURCE LINE # 145
	MOV  	DPTR,#03H
	LJMP 	?C?ADDXBP
; 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.
; *********************************************************************************************************
; */
; void OSTaskDelHook (OS_TCB *ptcb) KCREENTRANT

	RSEG  ?PR?_?OSTaskDelHook?OS_CPU_C
_?OSTaskDelHook:
	USING	0
			; SOURCE LINE # 159
	LCALL	L?0015
; {
;     ptcb = ptcb;                       /* Prevent compiler warning                                     */
			; SOURCE LINE # 161
	LCALL	L?0013
	LCALL	?C?PLDXDATA
	LCALL	L?0013
	LCALL	?C?PSTXDATA
; }
			; SOURCE LINE # 162
	MOV  	DPTR,#03H
	LJMP 	?C?ADDXBP
; END OF _?OSTaskDelHook

; 
; /*
; *********************************************************************************************************
; *                                           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 # 179
; {
; }
			; SOURCE LINE # 181
	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 # 193
; {
; }
			; SOURCE LINE # 195
	RET  	
; END OF _?OSTaskStatHook

; 
; /*
; *********************************************************************************************************
; *                                               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 # 208
; {
; }
			; SOURCE LINE # 210
	RET  	
; END OF _?OSTimeTickHook

	END

⌨️ 快捷键说明

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