📄 os_task.lst
字号:
\ OSTaskCreateExt:
\ 00000000 F74F2DE9 PUSH {R0-R2,R4-R11,LR}
\ 00000004 04D04DE2 SUB SP,SP,#+4
\ 00000008 0340B0E1 MOVS R4,R3
\ 0000000C B453DDE1 LDRH R5,[SP, #+52]
\ 00000010 38609DE5 LDR R6,[SP, #+56]
\ 00000014 3C709DE5 LDR R7,[SP, #+60]
\ 00000018 40809DE5 LDR R8,[SP, #+64]
\ 0000001C B494DDE1 LDRH R9,[SP, #+68]
311 OS_STK *psp;
312 INT8U err;
313 #if OS_CRITICAL_METHOD == 3 /* Allocate storage for CPU status register */
314 OS_CPU_SR cpu_sr = 0;
\ 00000020 0000A0E3 MOV R0,#+0
\ 00000024 00B0B0E1 MOVS R11,R0
315 #endif
316
317
318
319 #if OS_ARG_CHK_EN > 0
320 if (prio > OS_LOWEST_PRIO) { /* Make sure priority is within allowable range */
\ 00000028 200054E3 CMP R4,#+32
\ 0000002C 0100003A BCC ??OSTaskCreateExt_0
321 return (OS_ERR_PRIO_INVALID);
\ 00000030 2A00A0E3 MOV R0,#+42
\ 00000034 460000EA B ??OSTaskCreateExt_1
322 }
323 #endif
324 OS_ENTER_CRITICAL();
\ ??OSTaskCreateExt_0:
\ 00000038 ........ _BLF OS_CPU_SR_Save,??OS_CPU_SR_Save??rA
\ 0000003C 00B0B0E1 MOVS R11,R0
325 if (OSIntNesting > 0) { /* Make sure we don't create the task from within an ISR */
\ 00000040 ........ LDR R0,??DataTable26 ;; OSIntNesting
\ 00000044 0000D0E5 LDRB R0,[R0, #+0]
\ 00000048 010050E3 CMP R0,#+1
\ 0000004C 0300003A BCC ??OSTaskCreateExt_2
326 OS_EXIT_CRITICAL();
\ 00000050 0B00B0E1 MOVS R0,R11
\ 00000054 ........ _BLF OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rA
327 return (OS_ERR_TASK_CREATE_ISR);
\ 00000058 3C00A0E3 MOV R0,#+60
\ 0000005C 3C0000EA B ??OSTaskCreateExt_1
328 }
329 if (OSTCBPrioTbl[prio] == (OS_TCB *)0) { /* Make sure task doesn't already exist at this priority */
\ ??OSTaskCreateExt_2:
\ 00000060 0400B0E1 MOVS R0,R4
\ 00000064 0410A0E3 MOV R1,#+4
\ 00000068 ........ LDR R2,??DataTable52 ;; OSTCBPrioTbl
\ 0000006C 912020E0 MLA R0,R1,R0,R2
\ 00000070 000090E5 LDR R0,[R0, #+0]
\ 00000074 000050E3 CMP R0,#+0
\ 00000078 3200001A BNE ??OSTaskCreateExt_3
330 OSTCBPrioTbl[prio] = (OS_TCB *)1; /* Reserve the priority to prevent others from doing ... */
\ 0000007C 0400B0E1 MOVS R0,R4
\ 00000080 0410A0E3 MOV R1,#+4
\ 00000084 ........ LDR R2,??DataTable52 ;; OSTCBPrioTbl
\ 00000088 912020E0 MLA R0,R1,R0,R2
\ 0000008C 0110A0E3 MOV R1,#+1
\ 00000090 001080E5 STR R1,[R0, #+0]
331 /* ... the same thing until task is created. */
332 OS_EXIT_CRITICAL();
\ 00000094 0B00B0E1 MOVS R0,R11
\ 00000098 ........ _BLF OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rA
333
334 OS_TaskStkClr(pbos, stk_size, opt); /* Clear the task stack (if needed) */
\ 0000009C 0920B0E1 MOVS R2,R9
\ 000000A0 0710B0E1 MOVS R1,R7
\ 000000A4 0600B0E1 MOVS R0,R6
\ 000000A8 ........ BL OS_TaskStkClr
335
336 psp = OSTaskStkInit(task, p_arg, ptos, opt); /* Initialize the task's stack */
\ 000000AC 0930B0E1 MOVS R3,R9
\ 000000B0 0C209DE5 LDR R2,[SP, #+12]
\ 000000B4 08109DE5 LDR R1,[SP, #+8]
\ 000000B8 04009DE5 LDR R0,[SP, #+4]
\ 000000BC ........ _BLF OSTaskStkInit,??OSTaskStkInit??rA
\ 000000C0 00008DE5 STR R0,[SP, #+0]
337 err = OS_TCBInit(prio, psp, pbos, id, stk_size, pext, opt);
\ 000000C4 0900B0E1 MOVS R0,R9
\ 000000C8 01002DE9 PUSH {R0}
\ 000000CC 0800B0E1 MOVS R0,R8
\ 000000D0 01002DE9 PUSH {R0}
\ 000000D4 0700B0E1 MOVS R0,R7
\ 000000D8 01002DE9 PUSH {R0}
\ 000000DC 0530B0E1 MOVS R3,R5
\ 000000E0 0620B0E1 MOVS R2,R6
\ 000000E4 0C109DE5 LDR R1,[SP, #+12]
\ 000000E8 0400B0E1 MOVS R0,R4
\ 000000EC ........ _BLF OS_TCBInit,??OS_TCBInit??rA
\ 000000F0 0CD08DE2 ADD SP,SP,#+12 ;; stack cleaning
\ 000000F4 00A0B0E1 MOVS R10,R0
338 if (err == OS_ERR_NONE) {
\ 000000F8 00005AE3 CMP R10,#+0
\ 000000FC 0500001A BNE ??OSTaskCreateExt_4
339 if (OSRunning == OS_TRUE) { /* Find HPT if multitasking has started */
\ 00000100 ........ LDR R0,??DataTable47 ;; OSRunning
\ 00000104 0000D0E5 LDRB R0,[R0, #+0]
\ 00000108 010050E3 CMP R0,#+1
\ 0000010C 0B00001A BNE ??OSTaskCreateExt_5
340 OS_Sched();
\ 00000110 ........ _BLF OS_Sched,??OS_Sched??rA
\ 00000114 090000EA B ??OSTaskCreateExt_5
341 }
342 } else {
343 OS_ENTER_CRITICAL();
\ ??OSTaskCreateExt_4:
\ 00000118 ........ _BLF OS_CPU_SR_Save,??OS_CPU_SR_Save??rA
\ 0000011C 00B0B0E1 MOVS R11,R0
344 OSTCBPrioTbl[prio] = (OS_TCB *)0; /* Make this priority avail. to others */
\ 00000120 0400B0E1 MOVS R0,R4
\ 00000124 0410A0E3 MOV R1,#+4
\ 00000128 ........ LDR R2,??DataTable52 ;; OSTCBPrioTbl
\ 0000012C 912020E0 MLA R0,R1,R0,R2
\ 00000130 0010A0E3 MOV R1,#+0
\ 00000134 001080E5 STR R1,[R0, #+0]
345 OS_EXIT_CRITICAL();
\ 00000138 0B00B0E1 MOVS R0,R11
\ 0000013C ........ _BLF OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rA
346 }
347 return (err);
\ ??OSTaskCreateExt_5:
\ 00000140 0A00B0E1 MOVS R0,R10
\ 00000144 020000EA B ??OSTaskCreateExt_1
348 }
349 OS_EXIT_CRITICAL();
\ ??OSTaskCreateExt_3:
\ 00000148 0B00B0E1 MOVS R0,R11
\ 0000014C ........ _BLF OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rA
350 return (OS_ERR_PRIO_EXIST);
\ 00000150 2800A0E3 MOV R0,#+40
\ ??OSTaskCreateExt_1:
\ 00000154 10D08DE2 ADD SP,SP,#+16 ;; stack cleaning
\ 00000158 F08FBDE8 POP {R4-R11,PC} ;; return
351 }
352 #endif
353 /*$PAGE*/
354 /*
355 *********************************************************************************************************
356 * DELETE A TASK
357 *
358 * Description: This function allows you to delete a task. The calling task can delete itself by
359 * its own priority number. The deleted task is returned to the dormant state and can be
360 * re-activated by creating the deleted task again.
361 *
362 * Arguments : prio is the priority of the task to delete. Note that you can explicitely delete
363 * the current task without knowing its priority level by setting 'prio' to
364 * OS_PRIO_SELF.
365 *
366 * Returns : OS_ERR_NONE if the call is successful
367 * OS_ERR_TASK_DEL_IDLE if you attempted to delete uC/OS-II's idle task
368 * OS_ERR_PRIO_INVALID if the priority you specify is higher that the maximum allowed
369 * (i.e. >= OS_LOWEST_PRIO) or, you have not specified OS_PRIO_SELF.
370 * OS_ERR_TASK_DEL if the task is assigned to a Mutex PIP.
371 * OS_ERR_TASK_NOT_EXIST if the task you want to delete does not exist.
372 * OS_ERR_TASK_DEL_ISR if you tried to delete a task from an ISR
373 *
374 * Notes : 1) To reduce interrupt latency, OSTaskDel() 'disables' the task:
375 * a) by making it not ready
376 * b) by removing it from any wait lists
377 * c) by preventing OSTimeTick() from making the task ready to run.
378 * The task can then be 'unlinked' from the miscellaneous structures in uC/OS-II.
379 * 2) The function OS_Dummy() is called after OS_EXIT_CRITICAL() because, on most processors,
380 * the next instruction following the enable interrupt instruction is ignored.
381 * 3) An ISR cannot delete a task.
382 * 4) The lock nesting counter is incremented because, for a brief instant, if the current
383 * task is being deleted, the current task would not be able to be rescheduled because it
384 * is removed from the ready list. Incrementing the nesting counter prevents another task
385 * from being schedule. This means that an ISR would return to the current task which is
386 * being deleted. The rest of the deletion would thus be able to be completed.
387 *********************************************************************************************************
388 */
389 /*$PAGE*/
390 #if OS_TASK_DEL_EN > 0
\ In segment CODE, align 4, keep-with-next
391 INT8U OSTaskDel (INT8U prio)
392 {
\ OSTaskDel:
\ 00000000 F0432DE9 PUSH {R4-R9,LR}
\ 00000004 0040B0E1 MOVS R4,R0
393 #if OS_EVENT_EN
394 OS_EVENT *pevent;
395 #endif
396 #if (OS_VERSION >= 251) && (OS_FLAG_EN > 0) && (OS_MAX_FLAGS > 0)
397 OS_FLAG_NODE *pnode;
398 #endif
399 OS_TCB *ptcb;
400 INT8U y;
401 #if OS_CRITICAL_METHOD == 3 /* Allocate storage for CPU status register */
402 OS_CPU_SR cpu_sr = 0;
\ 00000008 0000A0E3 MOV R0,#+0
\ 0000000C 0090B0E1 MOVS R9,R0
403 #endif
404
405
406
407 if (OSIntNesting > 0) { /* See if trying to delete from ISR */
\ 00000010 ........ LDR R0,??DataTable26 ;; OSIntNesting
\ 00000014 0000D0E5 LDRB R0,[R0, #+0]
\ 00000018 010050E3 CMP R0,#+1
\ 0000001C 0100003A BCC ??OSTaskDel_0
408 return (OS_ERR_TASK_DEL_ISR);
\ 00000020 4000A0E3 MOV R0,#+64
\ 00000024 9E0000EA B ??OSTaskDel_1
409 }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -