📄 os_task.s79
字号:
// 402 OS_FlagUnlink(pnode); /* Remove from wait list */
_BLF OS_FlagUnlink,??OS_FlagUnlink??rT
// 403 }
// 404 #endif
// 405 ptcb->OSTCBDly = 0; /* Prevent OSTimeTick() from updating */
??OSTaskDel_9:
MOVS R0,#+0
STRH R0,[R6, #+42]
// 406 ptcb->OSTCBStat = OS_STAT_RDY; /* Prevent task from being resumed */
MOVS R0,#+44
MOVS R1,#+0
STRB R1,[R6, R0]
// 407 if (OSLockNesting < 255u) {
LDR R0,??OSTaskDel_0+0x4 ;; OSLockNesting
LDRB R0,[R0, #+0]
CMP R0,#+255
BEQ ??OSTaskDel_10
// 408 OSLockNesting++;
LDR R0,??OSTaskDel_0+0x4 ;; OSLockNesting
LDR R1,??OSTaskDel_0+0x4 ;; OSLockNesting
LDRB R1,[R1, #+0]
ADDS R1,R1,#+1
STRB R1,[R0, #+0]
// 409 }
// 410 OS_EXIT_CRITICAL(); /* Enabling INT. ignores next instruc. */
??OSTaskDel_10:
MOVS R0,R4
_BLF OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT
// 411 OS_Dummy(); /* ... Dummy ensures that INTs will be */
_BLF OS_Dummy,??OS_Dummy??rT
// 412 OS_ENTER_CRITICAL(); /* ... disabled HERE! */
_BLF OS_CPU_SR_Save,??OS_CPU_SR_Save??rT
MOVS R4,R0
// 413 if (OSLockNesting > 0) {
LDR R0,??OSTaskDel_0+0x4 ;; OSLockNesting
LDRB R0,[R0, #+0]
CMP R0,#+1
BCC ??OSTaskDel_11
// 414 OSLockNesting--;
LDR R0,??OSTaskDel_0+0x4 ;; OSLockNesting
LDR R1,??OSTaskDel_0+0x4 ;; OSLockNesting
LDRB R1,[R1, #+0]
SUBS R1,R1,#+1
STRB R1,[R0, #+0]
// 415 }
// 416 OSTaskDelHook(ptcb); /* Call user defined hook */
??OSTaskDel_11:
MOVS R0,R6
_BLF OSTaskDelHook,??OSTaskDelHook??rT
// 417 OSTaskCtr--; /* One less task being managed */
LDR R0,??DataTable35 ;; OSTaskCtr
LDR R1,??DataTable35 ;; OSTaskCtr
LDRB R1,[R1, #+0]
SUBS R1,R1,#+1
STRB R1,[R0, #+0]
// 418 OSTCBPrioTbl[prio] = (OS_TCB *)0; /* Clear old priority entry */
MOVS R0,#+4
MULS R5,R0,R5
LDR R0,??DataTable42 ;; OSTCBPrioTbl
MOVS R1,#+0
STR R1,[R0, R5]
// 419 if (ptcb->OSTCBPrev == (OS_TCB *)0) { /* Remove from TCB chain */
LDR R0,[R6, #+24]
CMP R0,#+0
BNE ??OSTaskDel_12
// 420 ptcb->OSTCBNext->OSTCBPrev = (OS_TCB *)0;
LDR R0,[R6, #+20]
MOVS R1,#+0
STR R1,[R0, #+24]
// 421 OSTCBList = ptcb->OSTCBNext;
LDR R0,??OSTaskDel_0+0x8 ;; OSTCBList
LDR R1,[R6, #+20]
STR R1,[R0, #+0]
B ??OSTaskDel_13
// 422 } else {
// 423 ptcb->OSTCBPrev->OSTCBNext = ptcb->OSTCBNext;
??OSTaskDel_12:
LDR R0,[R6, #+24]
LDR R1,[R6, #+20]
STR R1,[R0, #+20]
// 424 ptcb->OSTCBNext->OSTCBPrev = ptcb->OSTCBPrev;
LDR R0,[R6, #+20]
LDR R1,[R6, #+24]
STR R1,[R0, #+24]
// 425 }
// 426 ptcb->OSTCBNext = OSTCBFreeList; /* Return TCB to free TCB list */
??OSTaskDel_13:
LDR R0,??OSTaskDel_0+0xC ;; OSTCBFreeList
LDR R0,[R0, #+0]
STR R0,[R6, #+20]
// 427 OSTCBFreeList = ptcb;
LDR R0,??OSTaskDel_0+0xC ;; OSTCBFreeList
STR R6,[R0, #+0]
// 428 #if OS_TASK_NAME_SIZE > 1
// 429 ptcb->OSTCBTaskName[0] = '?'; /* Unknown name */
MOVS R0,#+72
MOVS R1,#+63
STRB R1,[R6, R0]
// 430 ptcb->OSTCBTaskName[1] = OS_ASCII_NUL;
ADDS R6,R6,#+73
MOVS R0,#+0
STRB R0,[R6, #+0]
// 431 #endif
// 432 OS_EXIT_CRITICAL();
MOVS R0,R4
_BLF OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT
// 433 OS_Sched(); /* Find new highest priority task */
_BLF OS_Sched,??OS_Sched??rT
// 434 return (OS_NO_ERR);
MOVS R0,#+0
B ??OSTaskDel_2
// 435 }
// 436 OS_EXIT_CRITICAL();
??OSTaskDel_6:
MOVS R0,R4
_BLF OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT
// 437 return (OS_TASK_DEL_ERR);
MOVS R0,#+60
??OSTaskDel_2:
POP {R4-R7}
POP {R1}
BX R1 ;; return
Nop
DATA
??OSTaskDel_0:
DC32 OSIntNesting
DC32 OSLockNesting
DC32 OSTCBList
DC32 OSTCBFreeList
CFI EndBlock cfiBlock7
// 438 }
RSEG CODE:CODE:NOROOT(2)
DATA
??DataTable31:
DC32 OSRdyTbl
RSEG CODE:CODE:NOROOT(2)
DATA
??DataTable35:
DC32 OSTaskCtr
RSEG CODE:CODE:NOROOT(2)
CFI Block cfiBlock8 Using cfiCommon0
CFI NoFunction
ARM
??OSTaskDelReq??rA:
ADD R12,PC,#+1
BX R12
CFI EndBlock cfiBlock8
REQUIRE OSTaskDelReq
// 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
RSEG CODE:CODE:NOROOT(2)
CFI Block cfiBlock9 Using cfiCommon1
CFI Function OSTaskDelReq
THUMB
// 487 INT8U OSTaskDelReq (INT8U prio)
// 488 {
OSTaskDelReq:
PUSH {R4,LR}
CFI ?RET Frame(CFA, -4)
CFI R4 Frame(CFA, -8)
CFI CFA R13+8
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 */
CMP R4,#+63
BNE ??OSTaskDelReq_0
// 499 return (OS_TASK_DEL_IDLE);
MOVS R0,#+61
B ??OSTaskDelReq_1
// 500 }
// 501 if (prio >= OS_LOWEST_PRIO) { /* Task priority valid ? */
??OSTaskDelReq_0:
CMP R4,#+63
BCC ??OSTaskDelReq_2
// 502 if (prio != OS_PRIO_SELF) {
CMP R4,#+255
BEQ ??OSTaskDelReq_2
// 503 return (OS_PRIO_INVALID);
MOVS R0,#+42
B ??OSTaskDelReq_1
// 504 }
// 505 }
// 506 #endif
// 507 if (prio == OS_PRIO_SELF) { /* See if a task is requesting to ... */
??OSTaskDelReq_2:
CMP R4,#+255
BNE ??OSTaskDelReq_3
// 508 OS_ENTER_CRITICAL(); /* ... this task to delete itself */
_BLF OS_CPU_SR_Save,??OS_CPU_SR_Save??rT
// 509 stat = OSTCBCur->OSTCBDelReq; /* Return request status to caller */
LDR R1,??DataTable41 ;; OSTCBCur
LDR R1,[R1, #+0]
ADDS R1,R1,#+50
LDRB R4,[R1, #+0]
// 510 OS_EXIT_CRITICAL();
_BLF OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT
// 511 return (stat);
MOVS R0,R4
B ??OSTaskDelReq_1
// 512 }
// 513 OS_ENTER_CRITICAL();
??OSTaskDelReq_3:
_BLF OS_CPU_SR_Save,??OS_CPU_SR_Save??rT
// 514 ptcb = OSTCBPrioTbl[prio];
MOVS R1,#+4
MULS R4,R1,R4
LDR R1,??DataTable42 ;; OSTCBPrioTbl
LDR R1,[R1, R4]
// 515 if (ptcb != (OS_TCB *)0) { /* Task to delete must exist */
CMP R1,#+0
BEQ ??OSTaskDelReq_4
// 516 ptcb->OSTCBDelReq = OS_TASK_DEL_REQ; /* Set flag indicating task to be DEL. */
ADDS R1,R1,#+50
MOVS R2,#+62
STRB R2,[R1, #+0]
// 517 err = OS_NO_ERR;
MOVS R4,#+0
B ??OSTaskDelReq_5
// 518 } else {
// 519 err = OS_TASK_NOT_EXIST; /* Task must be deleted */
??OSTaskDelReq_4:
MOVS R4,#+11
// 520 }
// 521 OS_EXIT_CRITICAL();
??OSTaskDelReq_5:
_BLF OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT
// 522 return (err);
MOVS R0,R4
??OSTaskDelReq_1:
POP {R4}
POP {R1}
BX R1 ;; return
CFI EndBlock cfiBlock9
// 523 }
RSEG CODE:CODE:NOROOT(2)
CFI Block cfiBlock10 Using cfiCommon0
CFI NoFunction
ARM
??OSTaskNameGet??rA:
ADD R12,PC,#+1
BX R12
CFI EndBlock cfiBlock10
REQUIRE OSTaskNameGet
// 524 #endif
// 525
// 526 /*
// 527 *********************************************************************************************************
// 528 * GET THE NAME OF A TASK
// 529 *
// 530 * Description: This function is called to obtain the name of a task.
// 531 *
// 532 * Arguments : prio is the priority of the task that you want to obtain the name from.
// 533 *
// 534 * pname is a pointer to an ASCII string that will receive the name of the task. The
// 535 * string must be able to hold at least OS_TASK_NAME_SIZE characters.
// 536 *
// 537 * err is a point
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -