📄 os_task.lst
字号:
\ 0000008A 706A LDR R0,[R6, #+36]
401 if (pnode != (OS_FLAG_NODE *)0) { /* If task is waiting on event flag */
\ 0000008C 0028 CMP R0,#+0
\ 0000008E 01D0 BEQ ??OSTaskDel_9
402 OS_FlagUnlink(pnode); /* Remove from wait list */
\ 00000090 ........ _BLF OS_FlagUnlink,??OS_FlagUnlink??rT
403 }
404 #endif
405 ptcb->OSTCBDly = 0; /* Prevent OSTimeTick() from updating */
\ ??OSTaskDel_9:
\ 00000094 0020 MOVS R0,#+0
\ 00000096 7085 STRH R0,[R6, #+42]
406 ptcb->OSTCBStat = OS_STAT_RDY; /* Prevent task from being resumed */
\ 00000098 2C20 MOVS R0,#+44
\ 0000009A 0021 MOVS R1,#+0
\ 0000009C 3154 STRB R1,[R6, R0]
407 if (OSLockNesting < 255u) {
\ 0000009E 2748 LDR R0,??OSTaskDel_0+0x4 ;; OSLockNesting
\ 000000A0 0078 LDRB R0,[R0, #+0]
\ 000000A2 FF28 CMP R0,#+255
\ 000000A4 04D0 BEQ ??OSTaskDel_10
408 OSLockNesting++;
\ 000000A6 2548 LDR R0,??OSTaskDel_0+0x4 ;; OSLockNesting
\ 000000A8 2449 LDR R1,??OSTaskDel_0+0x4 ;; OSLockNesting
\ 000000AA 0978 LDRB R1,[R1, #+0]
\ 000000AC 491C ADDS R1,R1,#+1
\ 000000AE 0170 STRB R1,[R0, #+0]
409 }
410 OS_EXIT_CRITICAL(); /* Enabling INT. ignores next instruc. */
\ ??OSTaskDel_10:
\ 000000B0 2000 MOVS R0,R4
\ 000000B2 ........ _BLF OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT
411 OS_Dummy(); /* ... Dummy ensures that INTs will be */
\ 000000B6 ........ _BLF OS_Dummy,??OS_Dummy??rT
412 OS_ENTER_CRITICAL(); /* ... disabled HERE! */
\ 000000BA ........ _BLF OS_CPU_SR_Save,??OS_CPU_SR_Save??rT
\ 000000BE 0400 MOVS R4,R0
413 if (OSLockNesting > 0) {
\ 000000C0 1E48 LDR R0,??OSTaskDel_0+0x4 ;; OSLockNesting
\ 000000C2 0078 LDRB R0,[R0, #+0]
\ 000000C4 0028 CMP R0,#+0
\ 000000C6 04D0 BEQ ??OSTaskDel_11
414 OSLockNesting--;
\ 000000C8 1C48 LDR R0,??OSTaskDel_0+0x4 ;; OSLockNesting
\ 000000CA 1C49 LDR R1,??OSTaskDel_0+0x4 ;; OSLockNesting
\ 000000CC 0978 LDRB R1,[R1, #+0]
\ 000000CE 491E SUBS R1,R1,#+1
\ 000000D0 0170 STRB R1,[R0, #+0]
415 }
416 OSTaskDelHook(ptcb); /* Call user defined hook */
\ ??OSTaskDel_11:
\ 000000D2 3000 MOVS R0,R6
\ 000000D4 ........ _BLF OSTaskDelHook,??OSTaskDelHook??rT
417 OSTaskCtr--; /* One less task being managed */
\ 000000D8 .... LDR R0,??DataTable32 ;; OSTaskCtr
\ 000000DA .... LDR R1,??DataTable32 ;; OSTaskCtr
\ 000000DC 0978 LDRB R1,[R1, #+0]
\ 000000DE 491E SUBS R1,R1,#+1
\ 000000E0 0170 STRB R1,[R0, #+0]
418 OSTCBPrioTbl[prio] = (OS_TCB *)0; /* Clear old priority entry */
\ 000000E2 A800 LSLS R0,R5,#+2
\ 000000E4 .... LDR R1,??DataTable40 ;; OSTCBPrioTbl
\ 000000E6 0022 MOVS R2,#+0
\ 000000E8 0A50 STR R2,[R1, R0]
419 if (ptcb->OSTCBPrev == (OS_TCB *)0) { /* Remove from TCB chain */
\ 000000EA B069 LDR R0,[R6, #+24]
\ 000000EC 0028 CMP R0,#+0
\ 000000EE 05D1 BNE ??OSTaskDel_12
420 ptcb->OSTCBNext->OSTCBPrev = (OS_TCB *)0;
\ 000000F0 7069 LDR R0,[R6, #+20]
\ 000000F2 8261 STR R2,[R0, #+24]
421 OSTCBList = ptcb->OSTCBNext;
\ 000000F4 1248 LDR R0,??OSTaskDel_0+0x8 ;; OSTCBList
\ 000000F6 7169 LDR R1,[R6, #+20]
\ 000000F8 0160 STR R1,[R0, #+0]
\ 000000FA 04E0 B ??OSTaskDel_13
422 } else {
423 ptcb->OSTCBPrev->OSTCBNext = ptcb->OSTCBNext;
\ ??OSTaskDel_12:
\ 000000FC 7169 LDR R1,[R6, #+20]
\ 000000FE 4161 STR R1,[R0, #+20]
424 ptcb->OSTCBNext->OSTCBPrev = ptcb->OSTCBPrev;
\ 00000100 7069 LDR R0,[R6, #+20]
\ 00000102 B169 LDR R1,[R6, #+24]
\ 00000104 8161 STR R1,[R0, #+24]
425 }
426 ptcb->OSTCBNext = OSTCBFreeList; /* Return TCB to free TCB list */
\ ??OSTaskDel_13:
\ 00000106 0F48 LDR R0,??OSTaskDel_0+0xC ;; OSTCBFreeList
\ 00000108 0068 LDR R0,[R0, #+0]
\ 0000010A 7061 STR R0,[R6, #+20]
427 OSTCBFreeList = ptcb;
\ 0000010C 0D48 LDR R0,??OSTaskDel_0+0xC ;; OSTCBFreeList
\ 0000010E 0660 STR R6,[R0, #+0]
428 #if OS_TASK_NAME_SIZE > 1
429 ptcb->OSTCBTaskName[0] = '?'; /* Unknown name */
\ 00000110 4820 MOVS R0,#+72
\ 00000112 3F21 MOVS R1,#+63
\ 00000114 3154 STRB R1,[R6, R0]
430 ptcb->OSTCBTaskName[1] = OS_ASCII_NUL;
\ 00000116 4936 ADDS R6,R6,#+73
\ 00000118 3270 STRB R2,[R6, #+0]
431 #endif
432 OS_EXIT_CRITICAL();
\ 0000011A 2000 MOVS R0,R4
\ 0000011C ........ _BLF OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT
433 OS_Sched(); /* Find new highest priority task */
\ 00000120 ........ _BLF OS_Sched,??OS_Sched??rT
434 return (OS_NO_ERR);
\ 00000124 0020 MOVS R0,#+0
\ 00000126 03E0 B ??OSTaskDel_2
435 }
436 OS_EXIT_CRITICAL();
\ ??OSTaskDel_6:
\ 00000128 2000 MOVS R0,R4
\ 0000012A ........ _BLF OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT
437 return (OS_TASK_DEL_ERR);
\ 0000012E 3C20 MOVS R0,#+60
\ ??OSTaskDel_2:
\ 00000130 F0BC POP {R4-R7}
\ 00000132 02BC POP {R1}
\ 00000134 0847 BX R1 ;; return
\ 00000136 C046 Nop
\ ??OSTaskDel_0:
\ 00000138 ........ DC32 OSIntNesting
\ 0000013C ........ DC32 OSLockNesting
\ 00000140 ........ DC32 OSTCBList
\ 00000144 ........ DC32 OSTCBFreeList
438 }
439 #endif
440
441 /*
442 *********************************************************************************************************
443 * REQUEST THAT A TASK DELETE ITSELF
444 *
445 * Description: This function is used to:
446 * a) notify a task to delete itself.
447 * b) to see if a task requested that the current task delete itself.
448 * This function is a little tricky to understand. Basically, you have a task that needs
449 * to be deleted however, this task has resources that it has allocated (memory buffers,
450 * semaphores, mailboxes, queues etc.). The task cannot be deleted otherwise these
451 * resources would not be freed. The requesting task calls OSTaskDelReq() to indicate that
452 * the task needs to be deleted. Deleting of the task is however, deferred to the task to
453 * be deleted. For example, suppose that task #10 needs to be deleted. The requesting task
454 * example, task #5, would call OSTaskDelReq(10). When task #10 gets to execute, it calls
455 * this function by specifying OS_PRIO_SELF and monitors the returned value. If the return
456 * value is OS_TASK_DEL_REQ, another task requested a task delete. Task #10 would look like
457 * this:
458 *
459 * void Task(void *p_arg)
460 * {
461 * .
462 * .
463 * while (1) {
464 * OSTimeDly(1);
465 * if (OSTaskDelReq(OS_PRIO_SELF) == OS_TASK_DEL_REQ) {
466 * Release any owned resources;
467 * De-allocate any dynamic memory;
468 * OSTaskDel(OS_PRIO_SELF);
469 * }
470 * }
471 * }
472 *
473 * Arguments : prio is the priority of the task to request the delete from
474 *
475 * Returns : OS_NO_ERR if the task exist and the request has been registered
476 * OS_TASK_NOT_EXIST if the task has been deleted. This allows the caller to know whether
477 * the request has been executed.
478 * OS_TASK_DEL_IDLE if you requested to delete uC/OS-II's idle task
479 * OS_PRIO_INVALID if the priority you specify is higher that the maximum allowed
480 * (i.e. >= OS_LOWEST_PRIO) or, you have not specified OS_PRIO_SELF.
481 * OS_TASK_DEL_REQ if a task (possibly another task) requested that the running task be
482 * deleted.
483 *********************************************************************************************************
484 */
485
486 #if OS_TASK_DEL_EN > 0
\ In segment CODE, align 4, keep-with-next
487 INT8U OSTaskDelReq (INT8U prio)
488 {
\ OSTaskDelReq:
\ 00000000 10B5 PUSH {R4,LR}
\ 00000002 0400 MOVS R4,R0
489 #if OS_CRITICAL_METHOD == 3 /* Allocate storage for CPU status register */
490 OS_CPU_SR cpu_sr;
491 #endif
492 BOOLEAN stat;
493 INT8U err;
494 OS_TCB *ptcb;
495
496
497 #if OS_ARG_CHK_EN > 0
498 if (prio == OS_IDLE_PRIO) { /* Not allowed to delete idle task */
\ 00000004 3F2C CMP R4,#+63
\ 00000006 01D1 BNE ??OSTaskDelReq_0
499 return (OS_TASK_DEL_IDLE);
\ 00000008 3D20 MOVS R0,#+61
\ 0000000A 1DE0 B ??OSTaskDelReq_1
500 }
501 if (prio >= OS_LOWEST_PRIO) { /* Task priority valid ? */
\ ??OSTaskDelReq_0:
\ 0000000C 03D3 BCC ??OSTaskDelReq_2
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -