📄 os_mbox.lst
字号:
\ 0000007C B800C5E1 STRH R0,[R5, #+8]
109 pevent->OSEventPtr = msg; /* Deposit message in event control block */
\ 00000080 044085E5 STR R4,[R5, #+4]
110 #if OS_EVENT_NAME_SIZE > 1
111 pevent->OSEventName[0] = '?';
\ 00000084 3F00A0E3 MOV R0,#+63
\ 00000088 0F00C5E5 STRB R0,[R5, #+15]
112 pevent->OSEventName[1] = OS_ASCII_NUL;
\ 0000008C 0000A0E3 MOV R0,#+0
\ 00000090 1000C5E5 STRB R0,[R5, #+16]
113 #endif
114 OS_EventWaitListInit(pevent);
\ 00000094 0500B0E1 MOVS R0,R5
\ 00000098 ........ _BLF OS_EventWaitListInit,??OS_EventWaitListInit??rA
115 }
116 return (pevent); /* Return pointer to event control block */
\ ??OSMboxCreate_3:
\ 0000009C 0500B0E1 MOVS R0,R5
\ ??OSMboxCreate_1:
\ 000000A0 7080BDE8 POP {R4-R6,PC} ;; return
117 }
118 /*$PAGE*/
119 /*
120 *********************************************************************************************************
121 * DELETE A MAIBOX
122 *
123 * Description: This function deletes a mailbox and readies all tasks pending on the mailbox.
124 *
125 * Arguments : pevent is a pointer to the event control block associated with the desired
126 * mailbox.
127 *
128 * opt determines delete options as follows:
129 * opt == OS_DEL_NO_PEND Delete the mailbox ONLY if no task pending
130 * opt == OS_DEL_ALWAYS Deletes the mailbox even if tasks are waiting.
131 * In this case, all the tasks pending will be readied.
132 *
133 * err is a pointer to an error code that can contain one of the following values:
134 * OS_ERR_NONE The call was successful and the mailbox was deleted
135 * OS_ERR_DEL_ISR If you attempted to delete the mailbox from an ISR
136 * OS_ERR_INVALID_OPT An invalid option was specified
137 * OS_ERR_TASK_WAITING One or more tasks were waiting on the mailbox
138 * OS_ERR_EVENT_TYPE If you didn't pass a pointer to a mailbox
139 * OS_ERR_PEVENT_NULL If 'pevent' is a NULL pointer.
140 *
141 * Returns : pevent upon error
142 * (OS_EVENT *)0 if the mailbox was successfully deleted.
143 *
144 * Note(s) : 1) This function must be used with care. Tasks that would normally expect the presence of
145 * the mailbox MUST check the return code of OSMboxPend().
146 * 2) OSMboxAccept() callers will not know that the intended mailbox has been deleted!
147 * 3) This call can potentially disable interrupts for a long time. The interrupt disable
148 * time is directly proportional to the number of tasks waiting on the mailbox.
149 * 4) Because ALL tasks pending on the mailbox will be readied, you MUST be careful in
150 * applications where the mailbox is used for mutual exclusion because the resource(s)
151 * will no longer be guarded by the mailbox.
152 *********************************************************************************************************
153 */
154
155 #if OS_MBOX_DEL_EN > 0
\ In segment CODE, align 4, keep-with-next
156 OS_EVENT *OSMboxDel (OS_EVENT *pevent, INT8U opt, INT8U *err)
157 {
\ OSMboxDel:
\ 00000000 F0432DE9 PUSH {R4-R9,LR}
\ 00000004 0090B0E1 MOVS R9,R0
\ 00000008 0140B0E1 MOVS R4,R1
\ 0000000C 0250B0E1 MOVS R5,R2
158 BOOLEAN tasks_waiting;
159 OS_EVENT *pevent_return;
160 #if OS_CRITICAL_METHOD == 3 /* Allocate storage for CPU status register */
161 OS_CPU_SR cpu_sr = 0;
\ 00000010 0000A0E3 MOV R0,#+0
\ 00000014 0080B0E1 MOVS R8,R0
162 #endif
163
164
165
166 #if OS_ARG_CHK_EN > 0
167 if (err == (INT8U *)0) { /* Validate 'err' */
\ 00000018 000055E3 CMP R5,#+0
\ 0000001C 0100001A BNE ??OSMboxDel_0
168 return (pevent);
\ 00000020 0900B0E1 MOVS R0,R9
\ 00000024 660000EA B ??OSMboxDel_1
169 }
170 if (pevent == (OS_EVENT *)0) { /* Validate 'pevent' */
\ ??OSMboxDel_0:
\ 00000028 000059E3 CMP R9,#+0
\ 0000002C 0300001A BNE ??OSMboxDel_2
171 *err = OS_ERR_PEVENT_NULL;
\ 00000030 0400A0E3 MOV R0,#+4
\ 00000034 0000C5E5 STRB R0,[R5, #+0]
172 return (pevent);
\ 00000038 0900B0E1 MOVS R0,R9
\ 0000003C 600000EA B ??OSMboxDel_1
173 }
174 #endif
175 if (pevent->OSEventType != OS_EVENT_TYPE_MBOX) { /* Validate event block type */
\ ??OSMboxDel_2:
\ 00000040 0000D9E5 LDRB R0,[R9, #+0]
\ 00000044 010050E3 CMP R0,#+1
\ 00000048 0300000A BEQ ??OSMboxDel_3
176 *err = OS_ERR_EVENT_TYPE;
\ 0000004C 0100A0E3 MOV R0,#+1
\ 00000050 0000C5E5 STRB R0,[R5, #+0]
177 return (pevent);
\ 00000054 0900B0E1 MOVS R0,R9
\ 00000058 590000EA B ??OSMboxDel_1
178 }
179 if (OSIntNesting > 0) { /* See if called from ISR ... */
\ ??OSMboxDel_3:
\ 0000005C ........ LDR R0,??DataTable10 ;; OSIntNesting
\ 00000060 0000D0E5 LDRB R0,[R0, #+0]
\ 00000064 010050E3 CMP R0,#+1
\ 00000068 0300003A BCC ??OSMboxDel_4
180 *err = OS_ERR_DEL_ISR; /* ... can't DELETE from an ISR */
\ 0000006C 0F00A0E3 MOV R0,#+15
\ 00000070 0000C5E5 STRB R0,[R5, #+0]
181 return (pevent);
\ 00000074 0900B0E1 MOVS R0,R9
\ 00000078 510000EA B ??OSMboxDel_1
182 }
183 OS_ENTER_CRITICAL();
\ ??OSMboxDel_4:
\ 0000007C ........ _BLF OS_CPU_SR_Save,??OS_CPU_SR_Save??rA
\ 00000080 0080B0E1 MOVS R8,R0
184 if (pevent->OSEventGrp != 0) { /* See if any tasks waiting on mailbox */
\ 00000084 0A00D9E5 LDRB R0,[R9, #+10]
\ 00000088 000050E3 CMP R0,#+0
\ 0000008C 0200000A BEQ ??OSMboxDel_5
185 tasks_waiting = OS_TRUE; /* Yes */
\ 00000090 0100A0E3 MOV R0,#+1
\ 00000094 0060B0E1 MOVS R6,R0
\ 00000098 010000EA B ??OSMboxDel_6
186 } else {
187 tasks_waiting = OS_FALSE; /* No */
\ ??OSMboxDel_5:
\ 0000009C 0000A0E3 MOV R0,#+0
\ 000000A0 0060B0E1 MOVS R6,R0
188 }
189 switch (opt) {
\ ??OSMboxDel_6:
\ 000000A4 0400B0E1 MOVS R0,R4
\ 000000A8 000050E3 CMP R0,#+0
\ 000000AC 0200000A BEQ ??OSMboxDel_7
\ 000000B0 010050E3 CMP R0,#+1
\ 000000B4 1C00000A BEQ ??OSMboxDel_8
\ 000000B8 3B0000EA B ??OSMboxDel_9
190 case OS_DEL_NO_PEND: /* Delete mailbox only if no task waiting */
191 if (tasks_waiting == OS_FALSE) {
\ ??OSMboxDel_7:
\ 000000BC 000056E3 CMP R6,#+0
\ 000000C0 1300001A BNE ??OSMboxDel_10
192 #if OS_EVENT_NAME_SIZE > 1
193 pevent->OSEventName[0] = '?'; /* Unknown name */
\ 000000C4 3F00A0E3 MOV R0,#+63
\ 000000C8 0F00C9E5 STRB R0,[R9, #+15]
194 pevent->OSEventName[1] = OS_ASCII_NUL;
\ 000000CC 0000A0E3 MOV R0,#+0
\ 000000D0 1000C9E5 STRB R0,[R9, #+16]
195 #endif
196 pevent->OSEventType = OS_EVENT_TYPE_UNUSED;
\ 000000D4 0000A0E3 MOV R0,#+0
\ 000000D8 0000C9E5 STRB R0,[R9, #+0]
197 pevent->OSEventPtr = OSEventFreeList; /* Return Event Control Block to free list */
\ 000000DC ........ LDR R0,??DataTable9 ;; OSEventFreeList
\ 000000E0 000090E5 LDR R0,[R0, #+0]
\ 000000E4 040089E5 STR R0,[R9, #+4]
198 pevent->OSEventCnt = 0;
\ 000000E8 0000A0E3 MOV R0,#+0
\ 000000EC B800C9E1 STRH R0,[R9, #+8]
199 OSEventFreeList = pevent; /* Get next free event control block */
\ 000000F0 ........ LDR R0,??DataTable9 ;; OSEventFreeList
\ 000000F4 009080E5 STR R9,[R0, #+0]
200 OS_EXIT_CRITICAL();
\ 000000F8 0800B0E1 MOVS R0,R8
\ 000000FC ........ _BLF OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rA
201 *err = OS_ERR_NONE;
\ 00000100 0000A0E3 MOV R0,#+0
\ 00000104 0000C5E5 STRB R0,[R5, #+0]
202 pevent_return = (OS_EVENT *)0; /* Mailbox has been deleted */
\ 00000108 0000A0E3 MOV R0,#+0
\ 0000010C 0070B0E1 MOVS R7,R0
\ 00000110 2A0000EA B ??OSMboxDel_11
203 } else {
204 OS_EXIT_CRITICAL();
\ ??OSMboxDel_10:
\ 00000114 0800B0E1 MOVS R0,R8
\ 00000118 ........ _BLF OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rA
205 *err = OS_ERR_TASK_WAITING;
\ 0000011C 4900A0E3 MOV R0,#+73
\ 00000120 0000C5E5 STRB R0,[R5, #+0]
206 pevent_return = pevent;
\ 00000124 0970B0E1 MOVS R7,R9
\ 00000128 240000EA B ??OSMboxDel_11
207 }
208 break;
209
210 case OS_DEL_ALWAYS: /* Always delete the mailbox */
211 while (pevent->OSEventGrp != 0) { /* Ready ALL tasks waiting for mailbox */
\ ??OSMboxDel_8:
\ 0000012C 0A00D9E5 LDRB R0,[R9, #+10]
\ 00000130 000050E3 CMP R0,#+0
\ 00000134 0500000A BEQ ??OSMboxDel_12
212 (void)OS_EventTaskRdy(pevent, (void *)0, OS_STAT_MBOX, OS_STAT_PEND_OK);
\ 00000138 0030A0E3 MOV R3,#+0
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -