os_time.s

来自「ucos如何移植到单片机mega128」· S 代码 · 共 126 行

S
126
字号
	.module OS_TIME.C
	.area text(rom, con, rel)
	.dbfile E:\study\ucos_ii\ucos2_iccavr\iccavr\ucos2_without_cpu\OS_TIME.C
	.dbfunc e OSTimeDly _OSTimeDly fV
;          ticks -> R20,R21
	.even
_OSTimeDly::
	xcall push_gset1
	movw R20,R16
	.dbline -1
	.dbline 36
; /*
; *********************************************************************************************************
; *                                                uC/OS-II
; *                                          The Real-Time Kernel
; *                                             TIME MANAGEMENT
; *
; *                          (c) Copyright 1992-2002, Jean J. Labrosse, Weston, FL
; *                                           All Rights Reserved
; *
; * File : OS_TIME.C
; * By   : Jean J. Labrosse
; *********************************************************************************************************
; */
; 
; #ifndef  OS_MASTER_FILE
; #include "..\ucos2_application\includes.h"
; #endif
; 
; /*
; *********************************************************************************************************
; *                                DELAY TASK 'n' TICKS   (n from 0 to 65535)
; *
; * Description: This function is called to delay execution of the currently running task until the
; *              specified number of system ticks expires.  This, of course, directly equates to delaying
; *              the current task for some time to expire.  No delay will result If the specified delay is
; *              0.  If the specified delay is greater than 0 then, a context switch will result.
; *
; * Arguments  : ticks     is the time delay that the task will be suspended in number of clock 'ticks'.
; *                        Note that by specifying 0, the task will not be delayed.
; *
; * Returns    : none
; *********************************************************************************************************
; */
; 
; void  OSTimeDly (INT16U ticks)
; {
	.dbline 42
; #if OS_CRITICAL_METHOD == 3                      /* Allocate storage for CPU status register           */
;     OS_CPU_SR  cpu_sr;
; #endif    
; 
; 
;     if (ticks > 0) {                                                      /* 0 means no delay!         */
	cpi R20,0
	cpc R20,R21
	brne X1
	xjmp L4
X1:
X0:
	.dbline 42
	.dbline 43
;         OS_ENTER_CRITICAL();
	st -y,r16
	in r16,0x3F
	cli
	push r16
	ld r16,y+
	.dbline 43
	.dbline 44
;         if ((OSRdyTbl[OSTCBCur->OSTCBY] &= ~OSTCBCur->OSTCBBitX) == 0) {  /* Delay current task        */
	ldi R24,<_OSRdyTbl
	ldi R25,>_OSRdyTbl
	lds R30,_OSTCBCur
	lds R31,_OSTCBCur+1
	ldd R2,z+14
	clr R3
	add R2,R24
	adc R3,R25
	lds R30,_OSTCBCur
	lds R31,_OSTCBCur+1
	ldd R4,z+15
	com R4
	movw R30,R2
	ldd R5,z+0
	and R5,R4
	mov R4,R5
	std z+0,R4
	tst R5
	brne L6
	.dbline 44
	.dbline 45
;             OSRdyGrp &= ~OSTCBCur->OSTCBBitY;
	lds R30,_OSTCBCur
	lds R31,_OSTCBCur+1
	ldd R2,z+16
	com R2
	lds R3,_OSRdyGrp
	and R3,R2
	sts _OSRdyGrp,R3
	.dbline 46
;         }
L6:
	.dbline 47
	lds R30,_OSTCBCur
	lds R31,_OSTCBCur+1
	std z+10,R21
	std z+9,R20
	.dbline 48
	st -y,r16
	pop r16
	out 0x3F,r16
	ld r16,y+
	.dbline 48
	.dbline 49
	xcall _OS_Sched
	.dbline 50
L4:
	.dbline -2
L3:
	xcall pop_gset1
	.dbline 0 ; func end
	ret
	.dbsym r ticks 20 i
	.dbend

⌨️ 快捷键说明

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