📄 os_core.lst
字号:
\ 00000018 ........ _BLF OS_FlagInit,??OS_FlagInit??rA
253 #endif
254
255 #if (OS_MEM_EN > 0) && (OS_MAX_MEM_PART > 0)
256 OS_MemInit(); /* Initialize the memory manager */
\ 0000001C ........ _BLF OS_MemInit,??OS_MemInit??rA
257 #endif
258
259 #if (OS_Q_EN > 0) && (OS_MAX_QS > 0)
260 OS_QInit(); /* Initialize the message queue structures */
\ 00000020 ........ _BLF OS_QInit,??OS_QInit??rA
261 #endif
262
263 OS_InitTaskIdle(); /* Create the Idle Task */
\ 00000024 ........ BL OS_InitTaskIdle
264 #if OS_TASK_STAT_EN > 0
265 OS_InitTaskStat(); /* Create the Statistic Task */
\ 00000028 ........ BL OS_InitTaskStat
266 #endif
267
268 #if OS_TMR_EN > 0
269 OSTmr_Init(); /* Initialize the Timer Manager */
\ 0000002C ........ _BLF OSTmr_Init,??OSTmr_Init??rA
270 #endif
271
272 #if OS_VERSION >= 204
273 OSInitHookEnd(); /* Call port specific init. code */
\ 00000030 ........ _BLF OSInitHookEnd,??OSInitHookEnd??rA
274 #endif
275
276 #if OS_VERSION >= 270 && OS_DEBUG_EN > 0
277 OSDebugInit();
\ 00000034 ........ _BLF OSDebugInit,??OSDebugInit??rA
278 #endif
279 }
\ 00000038 0080BDE8 POP {PC} ;; return
280 /*$PAGE*/
281 /*
282 *********************************************************************************************************
283 * ENTER ISR
284 *
285 * Description: This function is used to notify uC/OS-II that you are about to service an interrupt
286 * service routine (ISR). This allows uC/OS-II to keep track of interrupt nesting and thus
287 * only perform rescheduling at the last nested ISR.
288 *
289 * Arguments : none
290 *
291 * Returns : none
292 *
293 * Notes : 1) This function should be called ith interrupts already disabled
294 * 2) Your ISR can directly increment OSIntNesting without calling this function because
295 * OSIntNesting has been declared 'global'.
296 * 3) You MUST still call OSIntExit() even though you increment OSIntNesting directly.
297 * 4) You MUST invoke OSIntEnter() and OSIntExit() in pair. In other words, for every call
298 * to OSIntEnter() at the beginning of the ISR you MUST have a call to OSIntExit() at the
299 * end of the ISR.
300 * 5) You are allowed to nest interrupts up to 255 levels deep.
301 * 6) I removed the OS_ENTER_CRITICAL() and OS_EXIT_CRITICAL() around the increment because
302 * OSIntEnter() is always called with interrupts disabled.
303 *********************************************************************************************************
304 */
305
\ In segment CODE, align 4, keep-with-next
306 void OSIntEnter (void)
307 {
308 if (OSRunning == OS_TRUE) {
\ OSIntEnter:
\ 00000000 ........ LDR R0,??DataTable80 ;; OSRunning
\ 00000004 0000D0E5 LDRB R0,[R0, #+0]
\ 00000008 010050E3 CMP R0,#+1
\ 0000000C 0800001A BNE ??OSIntEnter_0
309 if (OSIntNesting < 255u) {
\ 00000010 ........ LDR R0,??DataTable95 ;; OSIntNesting
\ 00000014 0000D0E5 LDRB R0,[R0, #+0]
\ 00000018 FF0050E3 CMP R0,#+255
\ 0000001C 0400000A BEQ ??OSIntEnter_0
310 OSIntNesting++; /* Increment ISR nesting level */
\ 00000020 ........ LDR R0,??DataTable95 ;; OSIntNesting
\ 00000024 ........ LDR R1,??DataTable95 ;; OSIntNesting
\ 00000028 0010D1E5 LDRB R1,[R1, #+0]
\ 0000002C 011091E2 ADDS R1,R1,#+1
\ 00000030 0010C0E5 STRB R1,[R0, #+0]
311 }
312 }
313 }
\ ??OSIntEnter_0:
\ 00000034 0EF0A0E1 MOV PC,LR ;; return
314 /*$PAGE*/
315 /*
316 *********************************************************************************************************
317 * EXIT ISR
318 *
319 * Description: This function is used to notify uC/OS-II that you have completed serviving an ISR. When
320 * the last nested ISR has completed, uC/OS-II will call the scheduler to determine whether
321 * a new, high-priority task, is ready to run.
322 *
323 * Arguments : none
324 *
325 * Returns : none
326 *
327 * Notes : 1) You MUST invoke OSIntEnter() and OSIntExit() in pair. In other words, for every call
328 * to OSIntEnter() at the beginning of the ISR you MUST have a call to OSIntExit() at the
329 * end of the ISR.
330 * 2) Rescheduling is prevented when the scheduler is locked (see OS_SchedLock())
331 *********************************************************************************************************
332 */
333
\ In segment CODE, align 4, keep-with-next
334 void OSIntExit (void)
335 {
\ OSIntExit:
\ 00000000 10402DE9 PUSH {R4,LR}
336 #if OS_CRITICAL_METHOD == 3 /* Allocate storage for CPU status register */
337 OS_CPU_SR cpu_sr = 0;
\ 00000004 0040A0E3 MOV R4,#+0
338 #endif
339
340
341
342 if (OSRunning == OS_TRUE) {
\ 00000008 ........ LDR R0,??DataTable80 ;; OSRunning
\ 0000000C 0000D0E5 LDRB R0,[R0, #+0]
\ 00000010 010050E3 CMP R0,#+1
\ 00000014 3000001A BNE ??OSIntExit_0
343 OS_ENTER_CRITICAL();
\ 00000018 ........ _BLF OS_CPU_SR_Save,??OS_CPU_SR_Save??rA
\ 0000001C 0040B0E1 MOVS R4,R0
344 if (OSIntNesting > 0) { /* Prevent OSIntNesting from wrapping */
\ 00000020 ........ LDR R0,??DataTable95 ;; OSIntNesting
\ 00000024 0000D0E5 LDRB R0,[R0, #+0]
\ 00000028 010050E3 CMP R0,#+1
\ 0000002C 0400003A BCC ??OSIntExit_1
345 OSIntNesting--;
\ 00000030 ........ LDR R0,??DataTable95 ;; OSIntNesting
\ 00000034 ........ LDR R1,??DataTable95 ;; OSIntNesting
\ 00000038 0010D1E5 LDRB R1,[R1, #+0]
\ 0000003C 011051E2 SUBS R1,R1,#+1
\ 00000040 0010C0E5 STRB R1,[R0, #+0]
346 }
347 if (OSIntNesting == 0) { /* Reschedule only if all ISRs complete ... */
\ ??OSIntExit_1:
\ 00000044 ........ LDR R0,??DataTable95 ;; OSIntNesting
\ 00000048 0000D0E5 LDRB R0,[R0, #+0]
\ 0000004C 000050E3 CMP R0,#+0
\ 00000050 1F00001A BNE ??OSIntExit_2
348 if (OSLockNesting == 0) { /* ... and not locked. */
\ 00000054 ........ LDR R0,??DataTable96 ;; OSLockNesting
\ 00000058 0000D0E5 LDRB R0,[R0, #+0]
\ 0000005C 000050E3 CMP R0,#+0
\ 00000060 1B00001A BNE ??OSIntExit_2
349 OS_SchedNew();
\ 00000064 ........ BL OS_SchedNew
350 if (OSPrioHighRdy != OSPrioCur) { /* No Ctx Sw if current task is highest rdy */
\ 00000068 ........ LDR R0,??DataTable108 ;; OSPrioHighRdy
\ 0000006C 0000D0E5 LDRB R0,[R0, #+0]
\ 00000070 ........ LDR R1,??DataTable98 ;; OSPrioCur
\ 00000074 0010D1E5 LDRB R1,[R1, #+0]
\ 00000078 010050E1 CMP R0,R1
\ 0000007C 1400000A BEQ ??OSIntExit_2
351 OSTCBHighRdy = OSTCBPrioTbl[OSPrioHighRdy];
\ 00000080 ........ LDR R0,??DataTable103 ;; OSTCBHighRdy
\ 00000084 ........ LDR R1,??DataTable108 ;; OSPrioHighRdy
\ 00000088 0010D1E5 LDRB R1,[R1, #+0]
\ 0000008C 0420A0E3 MOV R2,#+4
\ 00000090 ........ LDR R3,??DataTable120 ;; OSTCBPrioTbl
\ 00000094 923121E0 MLA R1,R2,R1,R3
\ 00000098 001091E5 LDR R1,[R1, #+0]
\ 0000009C 001080E5 STR R1,[R0, #+0]
352 #if OS_TASK_PROFILE_EN > 0
353 OSTCBHighRdy->OSTCBCtxSwCtr++; /* Inc. # of context switches to this task */
\ 000000A0 ........ LDR R0,??DataTable103 ;; OSTCBHighRdy
\ 000000A4 000090E5 LDR R0,[R0, #+0]
\ 000000A8 ........ LDR R1,??DataTable103 ;; OSTCBHighRdy
\ 000000AC 001091E5 LDR R1,[R1, #+0]
\ 000000B0 341091E5 LDR R1,[R1, #+52]
\ 000000B4 011091E2 ADDS R1,R1,#+1
\ 000000B8 341080E5 STR R1,[R0, #+52]
354 #endif
355 OSCtxSwCtr++; /* Keep track of the number of ctx switches */
\ 000000BC ........ LDR R0,??DataTable105 ;; OSCtxSwCtr
\ 000000C0 ........ LDR R1,??DataTable105 ;; OSCtxSwCtr
\ 000000C4 001091E5 LDR R1,[R1, #+0]
\ 000000C8 011091E2 ADDS R1,R1,#+1
\ 000000CC 001080E5 STR R1,[R0, #+0]
356 OSIntCtxSw(); /* Perform interrupt level ctx switch */
\ 000000D0 ........ _BLF OSIntCtxSw,??OSIntCtxSw??rA
357 }
358 }
359 }
360 OS_EXIT_CRITICAL();
\ ??OSIntExit_2:
\ 000000D4 0400B0E1 MOVS R0,R4
\ 000000D8 ........ _BLF OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rA
361 }
362 }
\ ??OSIntExit_0:
\ 000000DC 1080BDE8 POP {R4,PC} ;; return
363 /*$PAGE*/
364 /*
365 *********************************************************************************************************
366 * PREVENT SCHEDULING
367 *
368 * Description: This function is used to prevent rescheduling to take place. This allows your application
369 * to prevent context switches until you are ready to permit context switching.
370 *
371 * Arguments : none
372 *
373 * Returns : none
374 *
375 * Notes : 1) You MUST invoke OSSchedLock() and OSSchedUnlock() in pair. In other words, for every
376 * call to OSSchedLock() you MUST have a call to OSSchedUnlock().
377 *********************************************************************************************************
378 */
379
380 #if OS_SCHED_LOCK_EN > 0
\ In segment CODE, align 4, keep-with-next
381 void OSSchedLock (void)
382 {
\ OSSchedLock:
\ 00000000 00402DE9 PUSH {LR}
383 #if OS_CRITICAL_METHOD == 3 /* Allocate storage for CPU status register */
384 OS_CPU_SR cpu_sr = 0;
\ 00000004 0000A0E3 MOV R0,#+0
385 #endif
386
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -