📄 os_q.lst
字号:
111 OS_CPU_SR cpu_sr;
112 #endif
113 OS_EVENT *pevent;
114 OS_Q *pq;
115
116
117 if (OSIntNesting > 0) { /* See if called from ISR ... */
\ 00000006 .... LDR R0,??DataTable19 ;; OSIntNesting
\ 00000008 0078 LDRB R0,[R0, #+0]
\ 0000000A 0128 CMP R0,#+1
\ 0000000C 01D3 BCC ??OSQCreate_0
118 return ((OS_EVENT *)0); /* ... can't CREATE from an ISR */
\ 0000000E 0020 MOVS R0,#+0
\ 00000010 3FE0 B ??OSQCreate_1
119 }
120 OS_ENTER_CRITICAL();
\ ??OSQCreate_0:
\ 00000012 ........ _BLF OS_CPU_SR_Save,??OS_CPU_SR_Save??rT
121 pevent = OSEventFreeList; /* Get next free event control block */
\ 00000016 .... LDR R1,??DataTable18 ;; OSEventFreeList
\ 00000018 0E68 LDR R6,[R1, #+0]
122 if (OSEventFreeList != (OS_EVENT *)0) { /* See if pool of free ECB pool was empty */
\ 0000001A .... LDR R1,??DataTable18 ;; OSEventFreeList
\ 0000001C 0968 LDR R1,[R1, #+0]
\ 0000001E 0029 CMP R1,#+0
\ 00000020 04D0 BEQ ??OSQCreate_2
123 OSEventFreeList = (OS_EVENT *)OSEventFreeList->OSEventPtr;
\ 00000022 .... LDR R1,??DataTable18 ;; OSEventFreeList
\ 00000024 .... LDR R2,??DataTable18 ;; OSEventFreeList
\ 00000026 1268 LDR R2,[R2, #+0]
\ 00000028 5268 LDR R2,[R2, #+4]
\ 0000002A 0A60 STR R2,[R1, #+0]
124 }
125 OS_EXIT_CRITICAL();
\ ??OSQCreate_2:
\ 0000002C ........ _BLF OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT
126 if (pevent != (OS_EVENT *)0) { /* See if we have an event control block */
\ 00000030 002E CMP R6,#+0
\ 00000032 2DD0 BEQ ??OSQCreate_3
127 OS_ENTER_CRITICAL();
\ 00000034 ........ _BLF OS_CPU_SR_Save,??OS_CPU_SR_Save??rT
128 pq = OSQFreeList; /* Get a free queue control block */
\ 00000038 .... LDR R1,??DataTable16 ;; OSQFreeList
\ 0000003A 0F68 LDR R7,[R1, #+0]
129 if (pq != (OS_Q *)0) { /* Were we able to get a queue control block ? */
\ 0000003C 002F CMP R7,#+0
\ 0000003E 1FD0 BEQ ??OSQCreate_4
130 OSQFreeList = OSQFreeList->OSQPtr; /* Yes, Adjust free list pointer to next free*/
\ 00000040 .... LDR R1,??DataTable16 ;; OSQFreeList
\ 00000042 .... LDR R2,??DataTable16 ;; OSQFreeList
\ 00000044 1268 LDR R2,[R2, #+0]
\ 00000046 1268 LDR R2,[R2, #+0]
\ 00000048 0A60 STR R2,[R1, #+0]
131 OS_EXIT_CRITICAL();
\ 0000004A ........ _BLF OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT
132 pq->OSQStart = start; /* Initialize the queue */
\ 0000004E 7C60 STR R4,[R7, #+4]
133 pq->OSQEnd = &start[size];
\ 00000050 2D04 LSLS R5,R5,#+16 ;; ZeroExtS R5,R5,#+16,#+16
\ 00000052 2D0C LSRS R5,R5,#+16
\ 00000054 0420 MOVS R0,#+4
\ 00000056 6843 MULS R0,R5,R0
\ 00000058 2018 ADDS R0,R4,R0
\ 0000005A B860 STR R0,[R7, #+8]
134 pq->OSQIn = start;
\ 0000005C FC60 STR R4,[R7, #+12]
135 pq->OSQOut = start;
\ 0000005E 3C61 STR R4,[R7, #+16]
136 pq->OSQSize = size;
\ 00000060 BD82 STRH R5,[R7, #+20]
137 pq->OSQEntries = 0;
\ 00000062 0020 MOVS R0,#+0
\ 00000064 F882 STRH R0,[R7, #+22]
138 pevent->OSEventType = OS_EVENT_TYPE_Q;
\ 00000066 0220 MOVS R0,#+2
\ 00000068 3070 STRB R0,[R6, #+0]
139 pevent->OSEventCnt = 0;
\ 0000006A 0020 MOVS R0,#+0
\ 0000006C 7080 STRH R0,[R6, #+2]
140 pevent->OSEventPtr = pq;
\ 0000006E 7760 STR R7,[R6, #+4]
141 #if OS_EVENT_NAME_SIZE > 1
142 pevent->OSEventName[0] = '?'; /* Unknown name */
\ 00000070 3F20 MOVS R0,#+63
\ 00000072 3074 STRB R0,[R6, #+16]
143 pevent->OSEventName[1] = OS_ASCII_NUL;
\ 00000074 0020 MOVS R0,#+0
\ 00000076 7074 STRB R0,[R6, #+17]
144 #endif
145 OS_EventWaitListInit(pevent); /* Initalize the wait list */
\ 00000078 3000 MOVS R0,R6
\ 0000007A ........ _BLF OS_EventWaitListInit,??OS_EventWaitListInit??rT
\ 0000007E 07E0 B ??OSQCreate_3
146 } else {
147 pevent->OSEventPtr = (void *)OSEventFreeList; /* No, Return event control block on error */
\ ??OSQCreate_4:
\ 00000080 .... LDR R1,??DataTable18 ;; OSEventFreeList
\ 00000082 0968 LDR R1,[R1, #+0]
\ 00000084 7160 STR R1,[R6, #+4]
148 OSEventFreeList = pevent;
\ 00000086 .... LDR R1,??DataTable18 ;; OSEventFreeList
\ 00000088 0E60 STR R6,[R1, #+0]
149 OS_EXIT_CRITICAL();
\ 0000008A ........ _BLF OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT
150 pevent = (OS_EVENT *)0;
\ 0000008E 0026 MOVS R6,#+0
151 }
152 }
153 return (pevent);
\ ??OSQCreate_3:
\ 00000090 3000 MOVS R0,R6
\ ??OSQCreate_1:
\ 00000092 F0BC POP {R4-R7}
\ 00000094 02BC POP {R1}
\ 00000096 0847 BX R1 ;; return
154 }
155 /*$PAGE*/
156 /*
157 *********************************************************************************************************
158 * DELETE A MESSAGE QUEUE
159 *
160 * Description: This function deletes a message queue and readies all tasks pending on the queue.
161 *
162 * Arguments : pevent is a pointer to the event control block associated with the desired
163 * queue.
164 *
165 * opt determines delete options as follows:
166 * opt == OS_DEL_NO_PEND Delete the queue ONLY if no task pending
167 * opt == OS_DEL_ALWAYS Deletes the queue even if tasks are waiting.
168 * In this case, all the tasks pending will be readied.
169 *
170 * err is a pointer to an error code that can contain one of the following values:
171 * OS_NO_ERR The call was successful and the queue was deleted
172 * OS_ERR_DEL_ISR If you tried to delete the queue from an ISR
173 * OS_ERR_INVALID_OPT An invalid option was specified
174 * OS_ERR_TASK_WAITING One or more tasks were waiting on the queue
175 * OS_ERR_EVENT_TYPE If you didn't pass a pointer to a queue
176 * OS_ERR_PEVENT_NULL If 'pevent' is a NULL pointer.
177 *
178 * Returns : pevent upon error
179 * (OS_EVENT *)0 if the queue was successfully deleted.
180 *
181 * Note(s) : 1) This function must be used with care. Tasks that would normally expect the presence of
182 * the queue MUST check the return code of OSQPend().
183 * 2) OSQAccept() callers will not know that the intended queue has been deleted unless
184 * they check 'pevent' to see that it's a NULL pointer.
185 * 3) This call can potentially disable interrupts for a long time. The interrupt disable
186 * time is directly proportional to the number of tasks waiting on the queue.
187 * 4) Because ALL tasks pending on the queue will be readied, you MUST be careful in
188 * applications where the queue is used for mutual exclusion because the resource(s)
189 * will no longer be guarded by the queue.
190 * 5) If the storage for the message queue was allocated dynamically (i.e. using a malloc()
191 * type call) then your application MUST release the memory storage by call the counterpart
192 * call of the dynamic allocation scheme used. If the queue storage was created statically
193 * then, the storage can be reused.
194 *********************************************************************************************************
195 */
196
197 #if OS_Q_DEL_EN > 0
\ In segment CODE, align 4, keep-with-next
198 OS_EVENT *OSQDel (OS_EVENT *pevent, INT8U opt, INT8U *err)
199 {
\ OSQDel:
\ 00000000 F2B5 PUSH {R1,R4-R7,LR}
\ 00000002 0400 MOVS R4,R0
\ 00000004 1500 MOVS R5,R2
200 #if OS_CRITICAL_METHOD == 3 /* Allocate storage for CPU status register */
201 OS_CPU_SR cpu_sr;
202 #endif
203 BOOLEAN tasks_waiting;
204 OS_Q *pq;
205
206
207 if (OSIntNesting > 0) { /* See if called from ISR ... */
\ 00000006 .... LDR R0,??DataTable19 ;; OSIntNesting
\ 00000008 0078 LDRB R0,[R0, #+0]
\ 0000000A 0128 CMP R0,#+1
\ 0000000C 03D3 BCC ??OSQDel_0
208 *err = OS_ERR_DEL_ISR; /* ... can't DELETE from an ISR */
\ 0000000E 8C20 MOVS R0,#+140
\ 00000010 2870 STRB R0,[R5, #+0]
209 return ((OS_EVENT *)0);
\ 00000012 0020 MOVS R0,#+0
\ 00000014 6BE0 B ??OSQDel_1
210 }
211 #if OS_ARG_CHK_EN > 0
212 if (pevent == (OS_EVENT *)0) { /* Validate 'pevent' */
\ ??OSQDel_0:
\ 00000016 002C CMP R4,#+0
\ 00000018 03D1 BNE ??OSQDel_2
213 *err = OS_ERR_PEVENT_NULL;
\ 0000001A 0420 MOVS R0,#+4
\ 0000001C 2870 STRB R0,[R5, #+0]
214 return (pevent);
\ 0000001E 2000 MOVS R0,R4
\ 00000020 65E0 B ??OSQDel_1
215 }
216 #endif
217 if (pevent->OSEventType != OS_EVENT_TYPE_Q) { /* Validate event block type */
\ ??OSQDel_2:
\ 00000022 2078 LDRB R0,[R4, #+0]
\ 00000024 0228 CMP R0,#+2
\ 00000026 03D0 BEQ ??OSQDel_3
218 *err = OS_ERR_EVENT_TYPE;
\ 00000028 0120 MOVS R0,#+1
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -