os_core.lst
来自「针对STM32F103的UCOS移植」· LST 代码 · 共 1,139 行 · 第 1/5 页
LST
1,139 行
\ 00000044 ........ BL OS_StrCopy
\ 00000048 0600 MOVS R6,R0
147 OS_EXIT_CRITICAL();
\ 0000004A 2800 MOVS R0,R5
\ 0000004C ........ _BLF OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT
148 *perr = OS_ERR_NONE;
\ 00000050 0020 MOVS R0,#+0
\ 00000052 2070 STRB R0,[R4, #+0]
149 return (len);
\ 00000054 3000 MOVS R0,R6
\ 00000056 F0BD POP {R4-R7,PC}
\ ??OSEventNameGet_5:
\ 00000058 0120 MOVS R0,#+1
\ 0000005A 2070 STRB R0,[R4, #+0]
\ 0000005C D5E7 B.N ??OSEventNameGet_1
150 }
151 #endif
152
153 /*$PAGE*/
154 /*
155 *********************************************************************************************************
156 * ASSIGN A NAME TO A SEMAPHORE, MUTEX, MAILBOX or QUEUE
157 *
158 * Description: This function assigns a name to a semaphore, mutex, mailbox or queue.
159 *
160 * Arguments : pevent is a pointer to the event group. 'pevent' can point either to a semaphore,
161 * a mutex, a mailbox or a queue. Where this function is concerned, it doesn't
162 * matter the actual type.
163 *
164 * pname is a pointer to an ASCII string that will be used as the name of the semaphore,
165 * mutex, mailbox or queue. The string must be able to hold at least
166 * OS_EVENT_NAME_SIZE characters.
167 *
168 * perr is a pointer to an error code that can contain one of the following values:
169 *
170 * OS_ERR_NONE if the requested task is resumed
171 * OS_ERR_EVENT_TYPE if 'pevent' is not pointing to the proper event
172 * control block type.
173 * OS_ERR_PNAME_NULL You passed a NULL pointer for 'pname'
174 * OS_ERR_PEVENT_NULL if you passed a NULL pointer for 'pevent'
175 * OS_ERR_NAME_SET_ISR if you called this function from an ISR
176 *
177 * Returns : None
178 *********************************************************************************************************
179 */
180
181 #if OS_EVENT_EN && (OS_EVENT_NAME_SIZE > 1)
\ In segment CODE, align 4, keep-with-next
182 void OSEventNameSet (OS_EVENT *pevent, INT8U *pname, INT8U *perr)
183 {
\ OSEventNameSet:
\ 00000000 F0B5 PUSH {R4-R7,LR}
\ 00000002 0500 MOVS R5,R0
\ 00000004 0E00 MOVS R6,R1
\ 00000006 1400 MOVS R4,R2
184 INT8U len;
185 #if OS_CRITICAL_METHOD == 3 /* Allocate storage for CPU status register */
186 OS_CPU_SR cpu_sr = 0;
187 #endif
188
189
190
191 #if OS_ARG_CHK_EN > 0
192 if (perr == (INT8U *)0) { /* Validate 'perr' */
\ 00000008 2FD0 BEQ.N ??OSEventNameSet_0
193 return;
194 }
195 if (pevent == (OS_EVENT *)0) { /* Is 'pevent' a NULL pointer? */
\ 0000000A 002D CMP R5,#+0
\ 0000000C 02D1 BNE.N ??OSEventNameSet_1
196 *perr = OS_ERR_PEVENT_NULL;
\ 0000000E 0420 MOVS R0,#+4
\ 00000010 2070 STRB R0,[R4, #+0]
197 return;
\ 00000012 F0BD POP {R4-R7,PC}
198 }
199 if (pname == (INT8U *)0) { /* Is 'pname' a NULL pointer? */
\ ??OSEventNameSet_1:
\ 00000014 002E CMP R6,#+0
\ 00000016 02D1 BNE.N ??OSEventNameSet_2
200 *perr = OS_ERR_PNAME_NULL;
\ 00000018 0C20 MOVS R0,#+12
\ 0000001A 2070 STRB R0,[R4, #+0]
201 return;
\ 0000001C F0BD POP {R4-R7,PC}
202 }
203 #endif
204 if (OSIntNesting > 0) { /* See if trying to call from an ISR */
\ ??OSEventNameSet_2:
\ 0000001E .... LDR.N R0,??DataTable1 ;; OSCPUUsage + 2
\ 00000020 0078 LDRB R0,[R0, #+0]
\ 00000022 0028 CMP R0,#+0
\ 00000024 02D0 BEQ.N ??OSEventNameSet_3
205 *perr = OS_ERR_NAME_SET_ISR;
\ 00000026 1220 MOVS R0,#+18
\ 00000028 2070 STRB R0,[R4, #+0]
206 return;
\ 0000002A F0BD POP {R4-R7,PC}
207 }
208 switch (pevent->OSEventType) {
\ ??OSEventNameSet_3:
\ 0000002C 2878 LDRB R0,[R5, #+0]
\ 0000002E 401E SUBS R0,R0,#+1
\ 00000030 0328 CMP R0,#+3
\ 00000032 0DD8 BHI.N ??OSEventNameSet_4
209 case OS_EVENT_TYPE_SEM:
210 case OS_EVENT_TYPE_MUTEX:
211 case OS_EVENT_TYPE_MBOX:
212 case OS_EVENT_TYPE_Q:
213 break;
214
215 default:
216 *perr = OS_ERR_EVENT_TYPE;
217 return;
218 }
219 OS_ENTER_CRITICAL();
\ 00000034 ........ _BLF OS_CPU_SR_Save,??OS_CPU_SR_Save??rT
\ 00000038 0700 MOVS R7,R0
220 len = OS_StrLen(pname); /* Can we fit the string in the storage area? */
\ 0000003A 3000 MOVS R0,R6
\ 0000003C ........ BL OS_StrLen
221 if (len > (OS_EVENT_NAME_SIZE - 1)) { /* No */
\ 00000040 1028 CMP R0,#+16
\ 00000042 08D3 BCC.N ??OSEventNameSet_5
222 OS_EXIT_CRITICAL();
\ 00000044 3800 MOVS R0,R7
\ 00000046 ........ _BLF OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT
223 *perr = OS_ERR_EVENT_NAME_TOO_LONG;
\ 0000004A 0B20 MOVS R0,#+11
\ 0000004C 2070 STRB R0,[R4, #+0]
224 return;
\ 0000004E F0BD POP {R4-R7,PC}
225 }
\ ??OSEventNameSet_4:
\ 00000050 0120 MOVS R0,#+1
\ 00000052 2070 STRB R0,[R4, #+0]
\ 00000054 F0BD POP {R4-R7,PC}
226 (void)OS_StrCopy(pevent->OSEventName, pname); /* Yes, copy name to the event control block */
\ ??OSEventNameSet_5:
\ 00000056 3100 MOVS R1,R6
\ 00000058 0F35 ADDS R5,R5,#+15
\ 0000005A 2800 MOVS R0,R5
\ 0000005C ........ BL OS_StrCopy
227 OS_EXIT_CRITICAL();
\ 00000060 3800 MOVS R0,R7
\ 00000062 ........ _BLF OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT
228 *perr = OS_ERR_NONE;
\ 00000066 0020 MOVS R0,#+0
\ 00000068 2070 STRB R0,[R4, #+0]
229 }
\ ??OSEventNameSet_0:
\ 0000006A F0BD POP {R4-R7,PC} ;; return
230 #endif
231
232 /*$PAGE*/
233 /*
234 *********************************************************************************************************
235 * INITIALIZATION
236 *
237 * Description: This function is used to initialize the internals of uC/OS-II and MUST be called prior to
238 * creating any uC/OS-II object and, prior to calling OSStart().
239 *
240 * Arguments : none
241 *
242 * Returns : none
243 *********************************************************************************************************
244 */
245
\ In segment CODE, align 4, keep-with-next
246 void OSInit (void)
247 {
\ OSInit:
\ 00000000 00B5 PUSH {LR}
248 OSInitHookBegin(); /* Call port specific initialization code */
\ 00000002 ........ _BLF OSInitHookBegin,??OSInitHookBegin??rT
249
250 OS_InitMisc(); /* Initialize miscellaneous variables */
\ 00000006 ........ BL OS_InitMisc
251
252 OS_InitRdyList(); /* Initialize the Ready List */
\ 0000000A ........ BL OS_InitRdyList
253
254 OS_InitTCBList(); /* Initialize the free list of OS_TCBs */
\ 0000000E ........ BL OS_InitTCBList
255
256 OS_InitEventList(); /* Initialize the free list of OS_EVENTs */
\ 00000012 ........ BL OS_InitEventList
257
258 #if (OS_FLAG_EN > 0) && (OS_MAX_FLAGS > 0)
259 OS_FlagInit(); /* Initialize the event flag structures */
\ 00000016 ........ _BLF OS_FlagInit,??OS_FlagInit??rT
260 #endif
261
262 #if (OS_MEM_EN > 0) && (OS_MAX_MEM_PART > 0)
263 OS_MemInit(); /* Initialize the memory manager */
\ 0000001A ........ _BLF OS_MemInit,??OS_MemInit??rT
264 #endif
265
266 #if (OS_Q_EN > 0) && (OS_MAX_QS > 0)
267 OS_QInit(); /* Initialize the message queue structures */
\ 0000001E ........ _BLF OS_QInit,??OS_QInit??rT
268 #endif
269
270 OS_InitTaskIdle(); /* Create the Idle Task */
\ 00000022 ........ BL OS_InitTaskIdle
271 #if OS_TASK_STAT_EN > 0
272 OS_InitTaskStat(); /* Create the Statistic Task */
\ 00000026 ........ BL OS_InitTaskStat
273 #endif
274
275 #if OS_TMR_EN > 0
276 OSTmr_Init(); /* Initialize the Timer Manager */
\ 0000002A ........ _BLF OSTmr_Init,??OSTmr_Init??rT
277 #endif
278
279 OSInitHookEnd(); /* Call port specific init. code */
\ 0000002E ........ _BLF OSInitHookEnd,??OSInitHookEnd??rT
280
281 #if OS_DEBUG_EN > 0
282 OSDebugInit();
\ 00000032 ........ _BLF OSDebugInit,??OSDebugInit??rT
283 #endif
284 }
\ 00000036 00BD POP {PC} ;; return
285 /*$PAGE*/
286 /*
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?