📄 os_mem.lst
字号:
61 =2 *
62 =2 * Method #2: Disable/Enable interrupts by preserving the state of interrupts. In other words, if
63 =2 * interrupts were disabled before entering the critical section, they will be disabled when
64 =2 * leaving the critical section.
65 =2 *
66 =2 * Method #3: Disable/Enable interrupts by preserving the state of interrupts. Generally speaking you
67 =2 * would store the state of the interrupt disable flag in the local variable 'cpu_sr' and then
68 =2 * disable interrupts. 'cpu_sr' is allocated in all of uC/OS-II's functions that need to
69 =2 * disable interrupts. You would restore the interrupt disable state by copying back 'cpu_sr'
70 =2 * into the CPU's status register.
71 =2 *********************************************************************************************************
72 =2 */
73 =2
74 =2 #if OS_CRITICAL_METHOD == 1
=2 #define OS_ENTER_CRITICAL() EA=0 /* Disable interrupts *
-/
=2 #define OS_EXIT_CRITICAL() EA=1 /* Enable interrupts *
-/
=2 #endif
78 =2
79 =2 #if OS_CRITICAL_METHOD == 2
=2 #define OS_ENTER_CRITICAL() /* Disable interrupts *
-/
=2 #define OS_EXIT_CRITICAL() /* Enable interrupts *
-/
=2 #endif
83 =2
84 =2 #if OS_CRITICAL_METHOD == 3
85 =2 #define OS_ENTER_CRITICAL() cpu_sr = IE & 0x80; IE &= 0x7F /* Disable interrupts *
-/
86 =2 #define OS_EXIT_CRITICAL() IE |= cpu_sr /* Enable interrupts *
-/
C51 COMPILER V7.50 OS_MEM 01/12/2005 21:47:40 PAGE 9
87 =2 #endif
88 =2
89 =2 #define OS_TICKS_PER_SEC 50 /* Set the number of ticks in one second
- */
90 =2
91 =2 #define OS_STK_GROWTH 0 //MCU-51堆栈从下往上增长 1=向下,0=向上
92 =2
93 =2 #define OS_TASK_SW() OSCtxSw() //因为MCU-51没有软中断指令,所以用程序调用代替。两者的堆栈格式相同,
94 =2 //RETI指令复位中断系统,RET则没有。实践表明,对于MCU-51,用子程序调
95 =2 //用入栈,用中断返回指令RETI出栈是没有问题的,反之中断入栈RET出栈则
96 =2 //不行。总之,对于入栈,子程序调用与中断调用效果是一样的,可以混用。
97 =2 //在没有中断发生的情况下复位中断系统也不会影响系统正常运行。
98 =2 //详见《uC/OS-II》第八章193页第12行
99 =2 #endif
25 =1 #include "..\ucos261\ucos_ii.h"
1 =2 /*
2 =2 *********************************************************************************************************
3 =2 * uC/OS-II
4 =2 * The Real-Time Kernel
5 =2 *
6 =2 * (c) Copyright 1992-2002, Jean J. Labrosse, Weston, FL
7 =2 * All Rights Reserved
8 =2 *
9 =2 * File : uCOS_II.H
10 =2 * By : Jean J. Labrosse
11 =2 *********************************************************************************************************
12 =2 */
13 =2
14 =2 #ifdef __cplusplus
=2 extern "C" {
=2 #endif
17 =2
18 =2 /*
19 =2 *********************************************************************************************************
20 =2 * MISCELLANEOUS
21 =2 *********************************************************************************************************
22 =2 */
23 =2
24 =2 #define OS_VERSION 261u /* Version of uC/OS-II (Vx.yy mult. by 100) */
25 =2
26 =2 #ifdef OS_GLOBALS
=2 #define OS_EXT
=2 #else
29 =2 #define OS_EXT extern
30 =2 #endif
31 =2
32 =2 #ifndef FALSE
33 =2 #define FALSE 0
34 =2 #endif
35 =2
36 =2 #ifndef TRUE
37 =2 #define TRUE 1
38 =2 #endif
39 =2
40 =2 #define OS_PRIO_SELF 0xFF /* Indicate SELF priority */
41 =2
42 =2 #if OS_TASK_STAT_EN > 0
=2 #define OS_N_SYS_TASKS 2 /* Number of system tasks */
=2 #else
45 =2 #define OS_N_SYS_TASKS 1
46 =2 #endif
47 =2
C51 COMPILER V7.50 OS_MEM 01/12/2005 21:47:40 PAGE 10
48 =2 #define OS_STAT_PRIO (OS_LOWEST_PRIO - 1) /* Statistic task priority */
49 =2 #define OS_IDLE_PRIO (OS_LOWEST_PRIO) /* IDLE task priority */
50 =2
51 =2 #define OS_EVENT_TBL_SIZE ((OS_LOWEST_PRIO) / 8 + 1) /* Size of event table */
52 =2 #define OS_RDY_TBL_SIZE ((OS_LOWEST_PRIO) / 8 + 1) /* Size of ready table */
53 =2
54 =2 #define OS_TASK_IDLE_ID 65535u /* I.D. numbers for Idle and Stat tasks */
55 =2 #define OS_TASK_STAT_ID 65534u
56 =2
57 =2 #define OS_EVENT_EN (((OS_Q_EN > 0) && (OS_MAX_QS > 0)) || (OS_MBOX_EN > 0) || (OS_SEM_EN > 0) || (
-OS_MUTEX_EN > 0))
58 =2
59 =2
60 =2 /*
61 =2 *********************************************************************************************************
62 =2 * TASK STATUS (Bit definition for OSTCBStat)
63 =2 *********************************************************************************************************
64 =2 */
65 =2 #define OS_STAT_RDY 0x00 /* Ready to run */
66 =2 #define OS_STAT_SEM 0x01 /* Pending on semaphore */
67 =2 #define OS_STAT_MBOX 0x02 /* Pending on mailbox */
68 =2 #define OS_STAT_Q 0x04 /* Pending on queue */
69 =2 #define OS_STAT_SUSPEND 0x08 /* Task is suspended */
70 =2 #define OS_STAT_MUTEX 0x10 /* Pending on mutual exclusion semaphore */
71 =2 #define OS_STAT_FLAG 0x20 /* Pending on event flag group */
72 =2
73 =2 /*
74 =2 *********************************************************************************************************
75 =2 * OS_EVENT types
76 =2 *********************************************************************************************************
77 =2 */
78 =2 #define OS_EVENT_TYPE_UNUSED 0
79 =2 #define OS_EVENT_TYPE_MBOX 1
80 =2 #define OS_EVENT_TYPE_Q 2
81 =2 #define OS_EVENT_TYPE_SEM 3
82 =2 #define OS_EVENT_TYPE_MUTEX 4
83 =2 #define OS_EVENT_TYPE_FLAG 5
84 =2
85 =2 /*
86 =2 *********************************************************************************************************
87 =2 * EVENT FLAGS
88 =2 *********************************************************************************************************
89 =2 */
90 =2 #define OS_FLAG_WAIT_CLR_ALL 0 /* Wait for ALL the bits specified to be CLR (i.e. 0) */
91 =2 #define OS_FLAG_WAIT_CLR_AND 0
92 =2
93 =2 #define OS_FLAG_WAIT_CLR_ANY 1 /* Wait for ANY of the bits specified to be CLR (i.e. 0) */
94 =2 #define OS_FLAG_WAIT_CLR_OR 1
95 =2
96 =2 #define OS_FLAG_WAIT_SET_ALL 2 /* Wait for ALL the bits specified to be SET (i.e. 1) */
97 =2 #define OS_FLAG_WAIT_SET_AND 2
98 =2
99 =2 #define OS_FLAG_WAIT_SET_ANY 3 /* Wait for ANY of the bits specified to be SET (i.e. 1) */
100 =2 #define OS_FLAG_WAIT_SET_OR 3
101 =2
102 =2
103 =2 #define OS_FLAG_CONSUME 0x80 /* Consume the flags if condition(s) satisfied */
104 =2
105 =2
106 =2 #define OS_FLAG_CLR 0
107 =2 #define OS_FLAG_SET 1
108 =2
C51 COMPILER V7.50 OS_MEM 01/12/2005 21:47:40 PAGE 11
109 =2 /*
110 =2 *********************************************************************************************************
111 =2 * Values for OSTickStepState
112 =2 *
113 =2 * Note(s): This feature is used by uC/OS-View.
114 =2 *********************************************************************************************************
115 =2 */
116 =2
117 =2 #if OS_TICK_STEP_EN > 0
=2 #define OS_TICK_STEP_DIS 0 /* Stepping is disabled, tick runs as mormal */
=2 #define OS_TICK_STEP_WAIT 1 /* Waiting for uC/OS-View to set OSTickStepState to _ONCE */
=2 #define OS_TICK_STEP_ONCE 2 /* Process tick once and wait for next cmd from uC/OS-View */
=2 #endif
122 =2
123 =2 /*
124 =2 *********************************************************************************************************
125 =2 * Possible values for 'opt' argument of OSSemDel(), OSMboxDel(), OSQDel() and OSMutexDel()
126 =2 *********************************************************************************************************
127 =2 */
128 =2 #define OS_DEL_NO_PEND 0
129 =2 #define OS_DEL_ALWAYS 1
130 =2
131 =2 /*
132 =2 *********************************************************************************************************
133 =2 * OS???PostOpt() OPTIONS
134 =2 *
135 =2 * These #defines are used to establish the options for OSMboxPostOpt() and OSQPostOpt().
136 =2 *********************************************************************************************************
137 =2 */
138 =2 #define OS_POST_OPT_NONE 0x00 /* Post to highest priority task waiting */
139 =2 #define OS_POST_OPT_BROADCAST 0x01 /* Broadcast message to ALL tasks waiting */
-
140 =2 #define OS_POST_OPT_FRONT 0x02 /* Post to highest priority task waiting */
141 =2
142 =2 /*
143 =2 *********************************************************************************************************
144 =2 * TASK OPTIONS (see OSTaskCreateExt())
145 =2 *********************************************************************************************************
146 =2 */
147 =2 #define OS_TASK_OPT_STK_CHK 0x0001 /* Enable stack checking for the task */
148 =2 #define OS_TASK_OPT_STK_CLR 0x0002 /* Clear the stack when the task is create */
149 =2 #define OS_TASK_OPT_SAVE_FP 0x0004 /* Save the contents of any floating-point registers */
150 =2
151 =2 /*
152 =2 *********************************************************************************************************
153 =2 * ERROR CODES
154 =2 *********************************************************************************************************
155 =2 */
156 =2 #define OS_NO_ERR 0
157 =2
158 =2 #define OS_ERR_EVENT_TYPE 1u
159 =2 #define OS_ERR_PEND_ISR 2u
160 =2 #define OS_ERR_POST_NULL_PTR 3u
161 =2 #define OS_ERR_PEVENT_NULL 4u
162 =2 #define OS_ERR_POST_ISR 5u
163 =2 #define OS_ERR_QUERY_ISR 6u
164 =2 #define OS_ERR_INVALID_OPT 7u
165 =2 #define OS_ERR_TASK_WAITING 8u
166 =2
167 =2 #define OS_TIMEOUT 10u
168 =2 #define OS_TASK_NOT_EXIST 11u
169 =2 #define OS_ERR_EVENT_NAME_TOO_LONG 12u
C51 COMPILER V7.50 OS_MEM 01/12/2005 21:47:40 PAGE 12
170 =2 #define OS_ERR_FLAG_NAME_TOO_LONG 13u
171 =2 #define OS_ERR_TASK_NAME_TOO_LONG 14u
172 =2 #define OS_ERR_PNAME_NULL 15u
173 =2
174 =2 #define OS_MBOX_FULL 20u
175 =2
176 =2 #define OS_Q_FULL 30u
177 =2 #define OS_Q_EMPTY 31u
178 =2
179 =2 #define OS_PRIO_EXIST 40u
180 =2 #define OS_PRIO_ERR 41u
181 =2 #define OS_PRIO_INVALID 42u
182 =2
183 =2 #define OS_SEM_OVF 50u
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -