📄 os_mbox.lst
字号:
125:../OSsrc/os_mbox.c **** * Arguments : pevent is a pointer to the event control block associated with the desired
126:../OSsrc/os_mbox.c **** * mailbox.
127:../OSsrc/os_mbox.c **** *
128:../OSsrc/os_mbox.c **** * opt determines delete options as follows:
129:../OSsrc/os_mbox.c **** * opt == OS_DEL_NO_PEND Delete the mailbox ONLY if no task pending
130:../OSsrc/os_mbox.c **** * opt == OS_DEL_ALWAYS Deletes the mailbox even if tasks are waiting.
131:../OSsrc/os_mbox.c **** * In this case, all the tasks pending will be re
132:../OSsrc/os_mbox.c **** *
133:../OSsrc/os_mbox.c **** * perr is a pointer to an error code that can contain one of the following va
134:../OSsrc/os_mbox.c **** * OS_ERR_NONE The call was successful and the mailbox was de
135:../OSsrc/os_mbox.c **** * OS_ERR_DEL_ISR If you attempted to delete the mailbox from an
136:../OSsrc/os_mbox.c **** * OS_ERR_INVALID_OPT An invalid option was specified
137:../OSsrc/os_mbox.c **** * OS_ERR_TASK_WAITING One or more tasks were waiting on the mailbox
138:../OSsrc/os_mbox.c **** * OS_ERR_EVENT_TYPE If you didn't pass a pointer to a mailbox
139:../OSsrc/os_mbox.c **** * OS_ERR_PEVENT_NULL If 'pevent' is a NULL pointer.
140:../OSsrc/os_mbox.c **** *
141:../OSsrc/os_mbox.c **** * Returns : pevent upon error
142:../OSsrc/os_mbox.c **** * (OS_EVENT *)0 if the mailbox was successfully deleted.
143:../OSsrc/os_mbox.c **** *
144:../OSsrc/os_mbox.c **** * Note(s) : 1) This function must be used with care. Tasks that would normally expect the prese
145:../OSsrc/os_mbox.c **** * the mailbox MUST check the return code of OSMboxPend().
146:../OSsrc/os_mbox.c **** * 2) OSMboxAccept() callers will not know that the intended mailbox has been deleted!
147:../OSsrc/os_mbox.c **** * 3) This call can potentially disable interrupts for a long time. The interrupt disa
148:../OSsrc/os_mbox.c **** * time is directly proportional to the number of tasks waiting on the mailbox.
149:../OSsrc/os_mbox.c **** * 4) Because ALL tasks pending on the mailbox will be readied, you MUST be careful in
150:../OSsrc/os_mbox.c **** * applications where the mailbox is used for mutual exclusion because the resource(
151:../OSsrc/os_mbox.c **** * will no longer be guarded by the mailbox.
152:../OSsrc/os_mbox.c **** ***************************************************************************************************
153:../OSsrc/os_mbox.c **** */
154:../OSsrc/os_mbox.c ****
155:../OSsrc/os_mbox.c **** #if OS_MBOX_DEL_EN > 0
156:../OSsrc/os_mbox.c **** OS_EVENT *OSMboxDel (OS_EVENT *pevent, INT8U opt, INT8U *perr)
157:../OSsrc/os_mbox.c **** {
264 .LM27:
265 /* prologue: frame size=0 */
266 0076 FF92 push r15
267 0078 0F93 push r16
268 007a 1F93 push r17
269 007c CF93 push r28
270 007e DF93 push r29
271 /* prologue end (size=5) */
272 0080 EC01 movw r28,r24
273 0082 8A01 movw r16,r20
158:../OSsrc/os_mbox.c **** BOOLEAN tasks_waiting;
159:../OSsrc/os_mbox.c **** OS_EVENT *pevent_return;
160:../OSsrc/os_mbox.c **** #if OS_CRITICAL_METHOD == 3 /* Allocate storage for CPU status regis
161:../OSsrc/os_mbox.c **** OS_CPU_SR cpu_sr = 0;
162:../OSsrc/os_mbox.c **** #endif
163:../OSsrc/os_mbox.c ****
164:../OSsrc/os_mbox.c ****
165:../OSsrc/os_mbox.c ****
166:../OSsrc/os_mbox.c **** #if OS_ARG_CHK_EN > 0
167:../OSsrc/os_mbox.c **** if (perr == (INT8U *)0) { /* Validate 'perr'
275 .LM28:
276 0084 452B or r20,r21
277 0086 09F4 brne .+2
278 0088 60C0 rjmp .L28
168:../OSsrc/os_mbox.c **** return (pevent);
169:../OSsrc/os_mbox.c **** }
170:../OSsrc/os_mbox.c **** if (pevent == (OS_EVENT *)0) { /* Validate 'pevent'
280 .LM29:
281 008a 892B or r24,r25
282 008c 11F4 brne .L10
171:../OSsrc/os_mbox.c **** *perr = OS_ERR_PEVENT_NULL;
284 .LM30:
285 008e 84E0 ldi r24,lo8(4)
286 0090 5AC0 rjmp .L27
287 .L10:
172:../OSsrc/os_mbox.c **** return (pevent);
173:../OSsrc/os_mbox.c **** }
174:../OSsrc/os_mbox.c **** #endif
175:../OSsrc/os_mbox.c **** if (pevent->OSEventType != OS_EVENT_TYPE_MBOX) { /* Validate event block type
289 .LM31:
290 0092 8881 ld r24,Y
291 0094 8130 cpi r24,lo8(1)
292 0096 11F0 breq .L11
176:../OSsrc/os_mbox.c **** *perr = OS_ERR_EVENT_TYPE;
294 .LM32:
295 0098 81E0 ldi r24,lo8(1)
296 009a 55C0 rjmp .L27
297 .L11:
177:../OSsrc/os_mbox.c **** return (pevent);
178:../OSsrc/os_mbox.c **** }
179:../OSsrc/os_mbox.c **** if (OSIntNesting > 0) { /* See if called from ISR ...
299 .LM33:
300 009c 8091 0000 lds r24,OSIntNesting
301 00a0 8823 tst r24
302 00a2 11F0 breq .L12
180:../OSsrc/os_mbox.c **** *perr = OS_ERR_DEL_ISR; /* ... can't DELETE from an ISR
304 .LM34:
305 00a4 8FE0 ldi r24,lo8(15)
306 00a6 4FC0 rjmp .L27
307 .L12:
181:../OSsrc/os_mbox.c **** return (pevent);
182:../OSsrc/os_mbox.c **** }
183:../OSsrc/os_mbox.c **** OS_ENTER_CRITICAL();
309 .LM35:
310 /* #APP */
311 00a8 F894 cli
184:../OSsrc/os_mbox.c **** if (pevent->OSEventGrp != 0) { /* See if any tasks waiting on mailbox
313 .LM36:
314 /* #NOAPP */
315 00aa 8D81 ldd r24,Y+5
316 00ac 8823 tst r24
317 00ae 19F0 breq .L13
185:../OSsrc/os_mbox.c **** tasks_waiting = OS_TRUE; /* Yes
319 .LM37:
320 00b0 91E0 ldi r25,lo8(1)
321 00b2 F92E mov r15,r25
322 00b4 01C0 rjmp .L14
323 .L13:
186:../OSsrc/os_mbox.c **** } else {
187:../OSsrc/os_mbox.c **** tasks_waiting = OS_FALSE; /* No
325 .LM38:
326 00b6 F82E mov r15,r24
327 .L14:
188:../OSsrc/os_mbox.c **** }
189:../OSsrc/os_mbox.c **** switch (opt) {
329 .LM39:
330 00b8 7727 clr r23
331 00ba 6115 cp r22,__zero_reg__
332 00bc 7105 cpc r23,__zero_reg__
333 00be 21F0 breq .L16
334 00c0 6130 cpi r22,1
335 00c2 7105 cpc r23,__zero_reg__
336 00c4 C1F0 breq .L19
337 00c6 3DC0 rjmp .L24
338 .L16:
190:../OSsrc/os_mbox.c **** case OS_DEL_NO_PEND: /* Delete mailbox only if no task waitin
191:../OSsrc/os_mbox.c **** if (tasks_waiting == OS_FALSE) {
340 .LM40:
341 00c8 FF20 tst r15
342 00ca 91F4 brne .L17
192:../OSsrc/os_mbox.c **** #if OS_EVENT_NAME_SIZE > 1
193:../OSsrc/os_mbox.c **** pevent->OSEventName[0] = '?'; /* Unknown name
344 .LM41:
345 00cc 8FE3 ldi r24,lo8(63)
346 00ce 8E87 std Y+14,r24
194:../OSsrc/os_mbox.c **** pevent->OSEventName[1] = OS_ASCII_NUL;
348 .LM42:
349 00d0 FF86 std Y+15,r15
195:../OSsrc/os_mbox.c **** #endif
196:../OSsrc/os_mbox.c **** pevent->OSEventType = OS_EVENT_TYPE_UNUSED;
351 .LM43:
352 00d2 F882 st Y,r15
197:../OSsrc/os_mbox.c **** pevent->OSEventPtr = OSEventFreeList; /* Return Event Control Block to free li
354 .LM44:
355 00d4 8091 0000 lds r24,OSEventFreeList
356 00d8 9091 0000 lds r25,(OSEventFreeList)+1
357 00dc 9A83 std Y+2,r25
358 00de 8983 std Y+1,r24
198:../OSsrc/os_mbox.c **** pevent->OSEventCnt = 0;
360 .LM45:
361 00e0 7C83 std Y+4,r23
362 00e2 6B83 std Y+3,r22
199:../OSsrc/os_mbox.c **** OSEventFreeList = pevent; /* Get next free event control block
364 .LM46:
365 00e4 D093 0000 sts (OSEventFreeList)+1,r29
366 00e8 C093 0000 sts OSEventFreeList,r28
200:../OSsrc/os_mbox.c **** OS_EXIT_CRITICAL();
368 .LM47:
369 /* #APP */
370 00ec 7894 sei
371 /* #NOAPP */
372 00ee 24C0 rjmp .L23
373 .L17:
201:../OSsrc/os_mbox.c **** *perr = OS_ERR_NONE;
202:../OSsrc/os_mbox.c **** pevent_return = (OS_EVENT *)0; /* Mailbox has been deleted
203:../OSsrc/os_mbox.c **** } else {
204:../OSsrc/os_mbox.c **** OS_EXIT_CRITICAL();
375 .LM48:
376 /* #APP */
377 00f0 7894 sei
205:../OSsrc/os_mbox.c **** *perr = OS_ERR_TASK_WAITING;
379 .LM49:
380 /* #NOAPP */
381 00f2 89E4 ldi r24,lo8(73)
382 00f4 28C0 rjmp .L27
383 .L19:
206:../OSsrc/os_mbox.c **** pevent_return = pevent;
207:../OSsrc/os_mbox.c **** }
208:../OSsrc/os_mbox.c **** break;
209:../OSsrc/os_mbox.c ****
210:../OSsrc/os_mbox.c **** case OS_DEL_ALWAYS: /* Always delete the mailbox
211:../OSsrc/os_mbox.c **** while (pevent->OSEventGrp != 0) { /* Ready ALL tasks waiting for mailbox
212:../OSsrc/os_mbox.c **** (void)OS_EventTaskRdy(pevent, (void *)0, OS_STAT_MBOX, OS_STAT_PEND_OK);
385 .LM50:
386 00f6 8823 tst r24
387 00f8 49F0 breq .L26
388 00fa 20E0 ldi r18,lo8(0)
389 00fc 42E0 ldi r20,lo8(2)
390 00fe 60E0 ldi r22,lo8(0)
391 0100 70E0 ldi r23,hi8(0)
392 0102 CE01 movw r24,r28
393 0104 0E94 0000 call OS_EventTaskRdy
394 0108 8D81 ldd r24,Y+5
395 010a F5CF rjmp .L19
396 .L26:
213:../OSsrc/os_mbox.c **** }
214:../OSsrc/os_mbox.c **** #if OS_EVENT_NAME_SIZE > 1
215:../OSsrc/os_mbox.c **** pevent->OSEventName[0] = '?'; /* Unknown name
398 .LM51:
399 010c 8FE3 ldi r24,lo8(63)
400 010e 8E87 std Y+14,r24
216:../OSsrc/os_mbox.c **** pevent->OSEventName[1] = OS_ASCII_NUL;
402 .LM52:
403 0110 1F86 std Y+15,__zero_reg__
217:../OSsrc/os_mbox.c **** #endif
218:../OSsrc/os_mbox.c **** pevent->OSEventType = OS_EVENT_TYPE_UNUSED;
405 .LM53:
406 0112 1882 st Y,__zero_reg__
219:../OSsrc/os_mbox.c **** pevent->OSEventPtr = OSEventFreeList; /* Return Event Control Block to free li
408 .LM54:
409 0114 8091 0000 lds r24,OSEventFreeList
410 0118 9091 0000 lds r25,(OSEventFreeList)+1
411 011c 9A83 std Y+2,r25
412 011e 8983 std Y+1,r24
220:../OSsrc/os_mbox.c **** pevent->OSEventCnt = 0;
414 .LM55:
415 0120 1C82 std Y+4,__zero_reg__
416 0122 1B82 std Y+3,__zero_reg__
221:../OSsrc/os_mbox.c **** OSEventFreeList = pevent; /* Get next free event control block
418 .LM56:
419 0124 D093 0000 sts (OSEventFreeList)+1,r29
420 0128 C093 0000 sts OSEventFreeList,r28
222:../OSsrc/os_mbox.c **** OS_EXIT_CRITICAL();
422 .LM57:
423 /* #APP */
424 012c 7894 sei
223:../OSsrc/os_mbox.c **** if (tasks_waiting == OS_TRUE) { /* Reschedule only if task(s) were waiti
426 .LM58:
427 /* #NOAPP */
428 012e F1E0 ldi r31,lo8(1)
429 0130 FF16 cp r15,r31
430 0132 11F4 brne .L23
224:../OSsrc/os_mbox.c **** OS_Sched(); /* Find highest priority task ready to r
432 .LM59:
433 0134 0E94 0000 call OS_Sched
434 .L23:
225:../OSsrc/os_mbox.c **** }
226:../OSsrc/os_mbox.c **** *perr = OS_ERR_NONE;
436 .LM60:
437 0138 F801 movw r30,r16
438 013a 1082 st Z,__zero_reg__
227:../OSsrc/os_mbox.c **** pevent_return = (OS_EVENT *)0; /* Mailbox has been deleted
440 .LM61:
441 013c 80E0 ldi r24,lo8(0)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -