📄 os_time.lst
字号:
##############################################################################
# #
# IAR ARM ANSI C/C++ Compiler V4.42A/W32 EVALUATION 12/Dec/2008 17:14:26 #
# Copyright 1999-2005 IAR Systems. All rights reserved. #
# #
# Cpu mode = arm #
# Endian = little #
# Stack alignment = 4 #
# Source file = E:\IAR_2478\IAR_2478\26uCOS\Src\uCOS\UCOS-II\uCOS-II #
# \Source\os_time.c #
# Command line = E:\IAR_2478\IAR_2478\26uCOS\Src\uCOS\UCOS-II\uCOS-II #
# \Source\os_time.c -lCN E:\IAR_2478\IAR_2478\26uCOS\S #
# rc\uCOS\RAM_Debug\List\ -o #
# E:\IAR_2478\IAR_2478\26uCOS\Src\uCOS\RAM_Debug\Obj\ #
# -z2 --no_cse --no_unroll --no_inline #
# --no_code_motion --no_tbaa --no_clustering #
# --no_scheduling --debug --cpu_mode arm --endian #
# little --cpu ARM7TDMI-S --stack_align 4 -e --fpu #
# None --dlib_config "C:\Program Files\IAR #
# Systems\Embedded Workbench 4.0 #
# Evaluation\arm\LIB\dl4tpannl8n.h" -I #
# E:\IAR_2478\IAR_2478\26uCOS\Src\uCOS\include\ -I #
# E:\IAR_2478\IAR_2478\26uCOS\Src\uCOS\ucos-ii\include #
# \ -I "C:\Program Files\IAR Systems\Embedded #
# Workbench 4.0 Evaluation\arm\INC\" #
# List file = E:\IAR_2478\IAR_2478\26uCOS\Src\uCOS\RAM_Debug\List\ #
# os_time.lst #
# Object file = E:\IAR_2478\IAR_2478\26uCOS\Src\uCOS\RAM_Debug\Obj\o #
# s_time.r79 #
# #
# #
##############################################################################
E:\IAR_2478\IAR_2478\26uCOS\Src\uCOS\UCOS-II\uCOS-II\Source\os_time.c
1 /*
2 *********************************************************************************************************
3 * uC/OS-II
4 * The Real-Time Kernel
5 * TIME MANAGEMENT
6 *
7 * (c) Copyright 1992-2007, Jean J. Labrosse, Weston, FL
8 * All Rights Reserved
9 *
10 * File : OS_TIME.C
11 * By : Jean J. Labrosse
12 * Version : V2.84
13 *
14 * LICENSING TERMS:
15 * ---------------
16 * uC/OS-II is provided in source form for FREE evaluation, for educational use or for peaceful research.
17 * If you plan on using uC/OS-II in a commercial product you need to contact Micri祄 to properly license
18 * its use in your product. We provide ALL the source code for your convenience and to help you experience
19 * uC/OS-II. The fact that the source is provided does NOT mean that you can use it without paying a
20 * licensing fee.
21 *********************************************************************************************************
22 */
23
24 #ifndef OS_MASTER_FILE
25 #include <ucos_ii.h>
26 #endif
27
28 /*
29 *********************************************************************************************************
30 * DELAY TASK 'n' TICKS (n from 0 to 65535)
31 *
32 * Description: This function is called to delay execution of the currently running task until the
33 * specified number of system ticks expires. This, of course, directly equates to delaying
34 * the current task for some time to expire. No delay will result If the specified delay is
35 * 0. If the specified delay is greater than 0 then, a context switch will result.
36 *
37 * Arguments : ticks is the time delay that the task will be suspended in number of clock 'ticks'.
38 * Note that by specifying 0, the task will not be delayed.
39 *
40 * Returns : none
41 *********************************************************************************************************
42 */
43
\ In segment CODE, align 4, keep-with-next
44 void OSTimeDly (INT16U ticks)
45 {
\ OSTimeDly:
\ 00000000 70402DE9 PUSH {R4-R6,LR}
\ 00000004 0040B0E1 MOVS R4,R0
46 INT8U y;
47 #if OS_CRITICAL_METHOD == 3 /* Allocate storage for CPU status register */
48 OS_CPU_SR cpu_sr = 0;
\ 00000008 0000A0E3 MOV R0,#+0
\ 0000000C 0060B0E1 MOVS R6,R0
49 #endif
50
51
52
53 if (ticks > 0) { /* 0 means no delay! */
\ 00000010 010054E3 CMP R4,#+1
\ 00000014 2200003A BCC ??OSTimeDly_0
54 OS_ENTER_CRITICAL();
\ 00000018 ........ _BLF OS_CPU_SR_Save,??OS_CPU_SR_Save??rA
\ 0000001C 0060B0E1 MOVS R6,R0
55 y = OSTCBCur->OSTCBY; /* Delay current task */
\ 00000020 80009FE5 LDR R0,??OSTimeDly_1 ;; OSTCBCur
\ 00000024 000090E5 LDR R0,[R0, #+0]
\ 00000028 3000D0E5 LDRB R0,[R0, #+48]
\ 0000002C 0050B0E1 MOVS R5,R0
56 OSRdyTbl[y] &= ~OSTCBCur->OSTCBBitX;
\ 00000030 0500B0E1 MOVS R0,R5
\ 00000034 ........ LDR R1,??DataTable8 ;; OSRdyTbl
\ 00000038 0520B0E1 MOVS R2,R5
\ 0000003C ........ LDR R3,??DataTable8 ;; OSRdyTbl
\ 00000040 0320D2E7 LDRB R2,[R2, +R3]
\ 00000044 5C309FE5 LDR R3,??OSTimeDly_1 ;; OSTCBCur
\ 00000048 003093E5 LDR R3,[R3, #+0]
\ 0000004C 3130D3E5 LDRB R3,[R3, #+49]
\ 00000050 0320D2E1 BICS R2,R2,R3
\ 00000054 0120C0E7 STRB R2,[R0, +R1]
57 if (OSRdyTbl[y] == 0) {
\ 00000058 0500B0E1 MOVS R0,R5
\ 0000005C ........ LDR R1,??DataTable8 ;; OSRdyTbl
\ 00000060 0100D0E7 LDRB R0,[R0, +R1]
\ 00000064 000050E3 CMP R0,#+0
\ 00000068 0700001A BNE ??OSTimeDly_2
58 OSRdyGrp &= ~OSTCBCur->OSTCBBitY;
\ 0000006C ........ LDR R0,??DataTable6 ;; OSRdyGrp
\ 00000070 ........ LDR R1,??DataTable6 ;; OSRdyGrp
\ 00000074 0010D1E5 LDRB R1,[R1, #+0]
\ 00000078 28209FE5 LDR R2,??OSTimeDly_1 ;; OSTCBCur
\ 0000007C 002092E5 LDR R2,[R2, #+0]
\ 00000080 3220D2E5 LDRB R2,[R2, #+50]
\ 00000084 0210D1E1 BICS R1,R1,R2
\ 00000088 0010C0E5 STRB R1,[R0, #+0]
59 }
60 OSTCBCur->OSTCBDly = ticks; /* Load ticks in TCB */
\ ??OSTimeDly_2:
\ 0000008C 14009FE5 LDR R0,??OSTimeDly_1 ;; OSTCBCur
\ 00000090 000090E5 LDR R0,[R0, #+0]
\ 00000094 BA42C0E1 STRH R4,[R0, #+42]
61 OS_EXIT_CRITICAL();
\ 00000098 0600B0E1 MOVS R0,R6
\ 0000009C ........ _BLF OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rA
62 OS_Sched(); /* Find next task to run! */
\ 000000A0 ........ _BLF OS_Sched,??OS_Sched??rA
63 }
64 }
\ ??OSTimeDly_0:
\ 000000A4 7080BDE8 POP {R4-R6,PC} ;; return
\ ??OSTimeDly_1:
\ 000000A8 ........ DC32 OSTCBCur
65 /*$PAGE*/
66 /*
67 *********************************************************************************************************
68 * DELAY TASK FOR SPECIFIED TIME
69 *
70 * Description: This function is called to delay execution of the currently running task until some time
71 * expires. This call allows you to specify the delay time in HOURS, MINUTES, SECONDS and
72 * MILLISECONDS instead of ticks.
73 *
74 * Arguments : hours specifies the number of hours that the task will be delayed (max. is 255)
75 * minutes specifies the number of minutes (max. 59)
76 * seconds specifies the number of seconds (max. 59)
77 * milli specifies the number of milliseconds (max. 999)
78 *
79 * Returns : OS_ERR_NONE
80 * OS_ERR_TIME_INVALID_MINUTES
81 * OS_ERR_TIME_INVALID_SECONDS
82 * OS_ERR_TIME_INVALID_MS
83 * OS_ERR_TIME_ZERO_DLY
84 *
85 * Note(s) : The resolution on the milliseconds depends on the tick rate. For example, you can't do
86 * a 10 mS delay if the ticker interrupts every 100 mS. In this case, the delay would be
87 * set to 0. The actual delay is rounded to the nearest tick.
88 *********************************************************************************************************
89 */
90
91 #if OS_TIME_DLY_HMSM_EN > 0
\ In segment CODE, align 4, keep-with-next
92 INT8U OSTimeDlyHMSM (INT8U hours, INT8U minutes, INT8U seconds, INT16U ms)
93 {
\ OSTimeDlyHMSM:
\ 00000000 F0432DE9 PUSH {R4-R9,LR}
\ 00000004 0040B0E1 MOVS R4,R0
\ 00000008 0150B0E1 MOVS R5,R1
\ 0000000C 0260B0E1 MOVS R6,R2
\ 00000010 0370B0E1 MOVS R7,R3
94 INT32U ticks;
95 INT16U loops;
96
97
98 #if OS_ARG_CHK_EN > 0
99 if (hours == 0) {
\ 00000014 000054E3 CMP R4,#+0
\ 00000018 0700001A BNE ??OSTimeDlyHMSM_0
100 if (minutes == 0) {
\ 0000001C 000055E3 CMP R5,#+0
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -