?? os_core.lst
字號:
\ 0000001E 17E0 B.N ??OSEventNameGet_1
139 }
140 switch (pevent->OSEventType) {
\ ??OSEventNameGet_0:
\ 00000020 2078 LDRB R0,[R4, #+0]
\ 00000022 401E SUBS R0,R0,#+1
\ 00000024 0328 CMP R0,#+3
\ 00000026 10D8 BHI.N ??OSEventNameGet_2
141 case OS_EVENT_TYPE_SEM:
142 case OS_EVENT_TYPE_MUTEX:
143 case OS_EVENT_TYPE_MBOX:
144 case OS_EVENT_TYPE_Q:
145 break;
146
147 default:
148 *perr = OS_ERR_EVENT_TYPE;
149 return (0u);
150 }
151 OS_ENTER_CRITICAL();
\ ??OSEventNameGet_3:
\ 00000028 ........ BL OS_CPU_SR_Save
\ 0000002C 8046 MOV R8,R0
152 *pname = pevent->OSEventName;
\ 0000002E 6069 LDR R0,[R4, #+20]
\ 00000030 2860 STR R0,[R5, #+0]
153 len = OS_StrLen(*pname);
\ 00000032 2868 LDR R0,[R5, #+0]
\ 00000034 ........ BL OS_StrLen
\ 00000038 0700 MOVS R7,R0
154 OS_EXIT_CRITICAL();
\ 0000003A 4046 MOV R0,R8
\ 0000003C ........ BL OS_CPU_SR_Restore
155 *perr = OS_ERR_NONE;
\ 00000040 0020 MOVS R0,#+0
\ 00000042 3070 STRB R0,[R6, #+0]
156 return (len);
\ 00000044 3800 MOVS R0,R7
\ 00000046 C0B2 UXTB R0,R0 ;; ZeroExt R0,R0,#+24,#+24
\ 00000048 02E0 B.N ??OSEventNameGet_1
\ ??OSEventNameGet_2:
\ 0000004A 0120 MOVS R0,#+1
\ 0000004C 3070 STRB R0,[R6, #+0]
\ 0000004E 0020 MOVS R0,#+0
\ ??OSEventNameGet_1:
\ 00000050 BDE8F081 POP {R4-R8,PC} ;; return
157 }
158 #endif
159
160 /*$PAGE*/
161 /*
162 *********************************************************************************************************
163 * ASSIGN A NAME TO A SEMAPHORE, MUTEX, MAILBOX or QUEUE
164 *
165 * Description: This function assigns a name to a semaphore, mutex, mailbox or queue.
166 *
167 * Arguments : pevent is a pointer to the event group. 'pevent' can point either to a semaphore,
168 * a mutex, a mailbox or a queue. Where this function is concerned, it doesn't
169 * matter the actual type.
170 *
171 * pname is a pointer to an ASCII string that will be used as the name of the semaphore,
172 * mutex, mailbox or queue.
173 *
174 * perr is a pointer to an error code that can contain one of the following values:
175 *
176 * OS_ERR_NONE if the requested task is resumed
177 * OS_ERR_EVENT_TYPE if 'pevent' is not pointing to the proper event
178 * control block type.
179 * OS_ERR_PNAME_NULL You passed a NULL pointer for 'pname'
180 * OS_ERR_PEVENT_NULL if you passed a NULL pointer for 'pevent'
181 * OS_ERR_NAME_SET_ISR if you called this function from an ISR
182 *
183 * Returns : None
184 *********************************************************************************************************
185 */
186
187 #if (OS_EVENT_EN) && (OS_EVENT_NAME_EN > 0u)
\ In section .text, align 2, keep-with-next
188 void OSEventNameSet (OS_EVENT *pevent,
189 INT8U *pname,
190 INT8U *perr)
191 {
\ OSEventNameSet:
\ 00000000 F8B5 PUSH {R3-R7,LR}
\ 00000002 0400 MOVS R4,R0
\ 00000004 0D00 MOVS R5,R1
\ 00000006 1600 MOVS R6,R2
192 #if OS_CRITICAL_METHOD == 3u /* Allocate storage for CPU status register */
193 OS_CPU_SR cpu_sr = 0u;
\ 00000008 0027 MOVS R7,#+0
194 #endif
195
196
197
198 #ifdef OS_SAFETY_CRITICAL
199 if (perr == (INT8U *)0) {
200 OS_SAFETY_CRITICAL_EXCEPTION();
201 return;
202 }
203 #endif
204
205 #if OS_ARG_CHK_EN > 0u
206 if (pevent == (OS_EVENT *)0) { /* Is 'pevent' a NULL pointer? */
207 *perr = OS_ERR_PEVENT_NULL;
208 return;
209 }
210 if (pname == (INT8U *)0) { /* Is 'pname' a NULL pointer? */
211 *perr = OS_ERR_PNAME_NULL;
212 return;
213 }
214 #endif
215 if (OSIntNesting > 0u) { /* See if trying to call from an ISR */
\ 0000000A ........ LDR.W R0,??DataTable26
\ 0000000E 0078 LDRB R0,[R0, #+0]
\ 00000010 0028 CMP R0,#+0
\ 00000012 02D0 BEQ.N ??OSEventNameSet_0
216 *perr = OS_ERR_NAME_SET_ISR;
\ 00000014 1220 MOVS R0,#+18
\ 00000016 3070 STRB R0,[R6, #+0]
217 return;
\ 00000018 0FE0 B.N ??OSEventNameSet_1
218 }
219 switch (pevent->OSEventType) {
\ ??OSEventNameSet_0:
\ 0000001A 2078 LDRB R0,[R4, #+0]
\ 0000001C 401E SUBS R0,R0,#+1
\ 0000001E 0328 CMP R0,#+3
\ 00000020 09D8 BHI.N ??OSEventNameSet_2
220 case OS_EVENT_TYPE_SEM:
221 case OS_EVENT_TYPE_MUTEX:
222 case OS_EVENT_TYPE_MBOX:
223 case OS_EVENT_TYPE_Q:
224 break;
225
226 default:
227 *perr = OS_ERR_EVENT_TYPE;
228 return;
229 }
230 OS_ENTER_CRITICAL();
\ ??OSEventNameSet_3:
\ 00000022 ........ BL OS_CPU_SR_Save
\ 00000026 0700 MOVS R7,R0
231 pevent->OSEventName = pname;
\ 00000028 6561 STR R5,[R4, #+20]
232 OS_EXIT_CRITICAL();
\ 0000002A 3800 MOVS R0,R7
\ 0000002C ........ BL OS_CPU_SR_Restore
233 *perr = OS_ERR_NONE;
\ 00000030 0020 MOVS R0,#+0
\ 00000032 3070 STRB R0,[R6, #+0]
234 }
\ 00000034 01E0 B.N ??OSEventNameSet_1
\ ??OSEventNameSet_2:
\ 00000036 0120 MOVS R0,#+1
\ 00000038 3070 STRB R0,[R6, #+0]
\ ??OSEventNameSet_1:
\ 0000003A F1BD POP {R0,R4-R7,PC} ;; return
235 #endif
236
237 /*$PAGE*/
238 /*
239 *********************************************************************************************************
240 * PEND ON MULTIPLE EVENTS
241 *
242 * Description: This function waits for multiple events. If multiple events are ready at the start of the
243 * pend call, then all available events are returned as ready. If the task must pend on the
244 * multiple events, then only the first posted or aborted event is returned as ready.
245 *
246 * Arguments : pevents_pend is a pointer to a NULL-terminated array of event control blocks to wait for.
247 *
248 * pevents_rdy is a pointer to an array to return which event control blocks are available
249 * or ready. The size of the array MUST be greater than or equal to the size
250 * of the 'pevents_pend' array, including terminating NULL.
251 *
252 * pmsgs_rdy is a pointer to an array to return messages from any available message-type
253 * events. The size of the array MUST be greater than or equal to the size of
254 * the 'pevents_pend' array, excluding the terminating NULL. Since NULL
255 * messages are valid messages, this array cannot be NULL-terminated. Instead,
256 * every available message-type event returns its messages in the 'pmsgs_rdy'
257 * array at the same index as the event is returned in the 'pevents_rdy' array.
258 * All other 'pmsgs_rdy' array indices are filled with NULL messages.
259 *
260 * timeout is an optional timeout period (in clock ticks). If non-zero, your task will
261 * wait for the resources up to the amount of time specified by this argument.
262 * If you specify 0, however, your task will wait forever for the specified
263 * events or, until the resources becomes available (or the events occur).
264 *
265 * perr is a pointer to where an error message will be deposited. Possible error
266 * messages are:
267 *
268 * OS_ERR_NONE The call was successful and your task owns the resources
269 * or, the events you are waiting for occurred; check the
270 * 'pevents_rdy' array for which events are available.
271 * OS_ERR_PEND_ABORT The wait on the events was aborted; check the
272 * 'pevents_rdy' array for which events were aborted.
273 * OS_ERR_TIMEOUT The events were not received within the specified
274 * 'timeout'.
275 * OS_ERR_PEVENT_NULL If 'pevents_pend', 'pevents_rdy', or 'pmsgs_rdy' is a
276 * NULL pointer.
277 * OS_ERR_EVENT_TYPE If you didn't pass a pointer to an array of semaphores,
278 * mailboxes, and/or queues.
279 * OS_ERR_PEND_ISR If you called this function from an ISR and the result
280 * would lead to a suspension.
281 * OS_ERR_PEND_LOCKED If you called this function when the scheduler is locked.
282 *
283 * Returns : > 0 the number of events returned as ready or aborted.
284 * == 0 if no events are returned as ready because of timeout or upon error.
285 *
286 * Notes : 1) a. Validate 'pevents_pend' array as valid OS_EVENTs :
287 *
288 * semaphores, mailboxes, queues
289 *
290 * b. Return ALL available events and messages, if any
291 *
292 * c. Add current task priority as pending to each events's wait list
294 *
295 * d. Wait on any of multiple events
296 *
297 * e. Remove current task priority as pending from each events's wait list
298 * Performed in OS_EventTaskRdy(), if events posted or aborted
299 *
300 * f. Return any event posted or aborted, if any
301 * else
302 * Return timeout
303 *
304 * 2) 'pevents_rdy' initialized to NULL PRIOR to all other validation or function handling in
305 * case of any error(s).
306 *********************************************************************************************************
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -