📄 os_task.lst
字号:
310 {
\ OSTaskCreateExt:
\ 00000000 F14F2DE9 PUSH {R0,R4-R11,LR}
\ 00000004 0150B0E1 MOVS R5,R1
\ 00000008 0260B0E1 MOVS R6,R2
\ 0000000C 0340B0E1 MOVS R4,R3
\ 00000010 B872DDE1 LDRH R7,[SP, #+40]
\ 00000014 2C809DE5 LDR R8,[SP, #+44]
\ 00000018 30909DE5 LDR R9,[SP, #+48]
\ 0000001C 34A09DE5 LDR R10,[SP, #+52]
\ 00000020 B8B3DDE1 LDRH R11,[SP, #+56]
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;
\ 00000024 0000A0E3 MOV R0,#+0
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 3B0000EA B ??OSTaskCreateExt_1
322 }
323 #endif
324 OS_ENTER_CRITICAL();
\ ??OSTaskCreateExt_0:
\ 00000038 ........ _BLF OS_CPU_SR_Save,??OS_CPU_SR_Save??rA
325 if (OSIntNesting > 0) { /* Make sure we don't create the task from within an ISR */
\ 0000003C ........ LDR R1,??DataTable26 ;; OSIntNesting
\ 00000040 0010D1E5 LDRB R1,[R1, #+0]
\ 00000044 010051E3 CMP R1,#+1
\ 00000048 0200003A BCC ??OSTaskCreateExt_2
326 OS_EXIT_CRITICAL();
\ 0000004C ........ _BLF OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rA
327 return (OS_ERR_TASK_CREATE_ISR);
\ 00000050 3C00A0E3 MOV R0,#+60
\ 00000054 330000EA B ??OSTaskCreateExt_1
328 }
329 if (OSTCBPrioTbl[prio] == (OS_TCB *)0) { /* Make sure task doesn't already exist at this priority */
\ ??OSTaskCreateExt_2:
\ 00000058 0410B0E1 MOVS R1,R4
\ 0000005C 0420A0E3 MOV R2,#+4
\ 00000060 ........ LDR R3,??DataTable59 ;; OSTCBPrioTbl
\ 00000064 923121E0 MLA R1,R2,R1,R3
\ 00000068 001091E5 LDR R1,[R1, #+0]
\ 0000006C 000051E3 CMP R1,#+0
\ 00000070 2A00001A BNE ??OSTaskCreateExt_3
330 OSTCBPrioTbl[prio] = (OS_TCB *)1; /* Reserve the priority to prevent others from doing ... */
\ 00000074 0410B0E1 MOVS R1,R4
\ 00000078 0420A0E3 MOV R2,#+4
\ 0000007C ........ LDR R3,??DataTable59 ;; OSTCBPrioTbl
\ 00000080 923121E0 MLA R1,R2,R1,R3
\ 00000084 0120A0E3 MOV R2,#+1
\ 00000088 002081E5 STR R2,[R1, #+0]
331 /* ... the same thing until task is created. */
332 OS_EXIT_CRITICAL();
\ 0000008C ........ _BLF OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rA
333
334 OS_TaskStkClr(pbos, stk_size, opt); /* Clear the task stack (if needed) */
\ 00000090 0B20B0E1 MOVS R2,R11
\ 00000094 0910B0E1 MOVS R1,R9
\ 00000098 0800B0E1 MOVS R0,R8
\ 0000009C ........ BL OS_TaskStkClr
335
336 psp = OSTaskStkInit(task, p_arg, ptos, opt); /* Initialize the task's stack */
\ 000000A0 0B30B0E1 MOVS R3,R11
\ 000000A4 0620B0E1 MOVS R2,R6
\ 000000A8 0510B0E1 MOVS R1,R5
\ 000000AC 00009DE5 LDR R0,[SP, #+0]
\ 000000B0 ........ _BLF OSTaskStkInit,??OSTaskStkInit??rA
\ 000000B4 0010B0E1 MOVS R1,R0
337 err = OS_TCBInit(prio, psp, pbos, id, stk_size, pext, opt);
\ 000000B8 00082DE9 PUSH {R11}
\ 000000BC 00042DE9 PUSH {R10}
\ 000000C0 00022DE9 PUSH {R9}
\ 000000C4 0730B0E1 MOVS R3,R7
\ 000000C8 0820B0E1 MOVS R2,R8
\ 000000CC 0400B0E1 MOVS R0,R4
\ 000000D0 ........ _BLF OS_TCBInit,??OS_TCBInit??rA
\ 000000D4 0CD08DE2 ADD SP,SP,#+12 ;; stack cleaning
\ 000000D8 0050B0E1 MOVS R5,R0
338 if (err == OS_ERR_NONE) {
\ 000000DC 000055E3 CMP R5,#+0
\ 000000E0 0500001A BNE ??OSTaskCreateExt_4
339 if (OSRunning == OS_TRUE) { /* Find HPT if multitasking has started */
\ 000000E4 ........ LDR R0,??DataTable47 ;; OSRunning
\ 000000E8 0000D0E5 LDRB R0,[R0, #+0]
\ 000000EC 010050E3 CMP R0,#+1
\ 000000F0 0800001A BNE ??OSTaskCreateExt_5
340 OS_Sched();
\ 000000F4 ........ _BLF OS_Sched,??OS_Sched??rA
\ 000000F8 060000EA B ??OSTaskCreateExt_5
341 }
342 } else {
343 OS_ENTER_CRITICAL();
\ ??OSTaskCreateExt_4:
\ 000000FC ........ _BLF OS_CPU_SR_Save,??OS_CPU_SR_Save??rA
344 OSTCBPrioTbl[prio] = (OS_TCB *)0; /* Make this priority avail. to others */
\ 00000100 0410A0E3 MOV R1,#+4
\ 00000104 ........ LDR R2,??DataTable59 ;; OSTCBPrioTbl
\ 00000108 912422E0 MLA R2,R1,R4,R2
\ 0000010C 0010A0E3 MOV R1,#+0
\ 00000110 001082E5 STR R1,[R2, #+0]
345 OS_EXIT_CRITICAL();
\ 00000114 ........ _BLF OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rA
346 }
347 return (err);
\ ??OSTaskCreateExt_5:
\ 00000118 0500B0E1 MOVS R0,R5
\ 0000011C 010000EA B ??OSTaskCreateExt_1
348 }
349 OS_EXIT_CRITICAL();
\ ??OSTaskCreateExt_3:
\ 00000120 ........ _BLF OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rA
350 return (OS_ERR_PRIO_EXIST);
\ 00000124 2800A0E3 MOV R0,#+40
\ ??OSTaskCreateExt_1:
\ 00000128 04D08DE2 ADD SP,SP,#+4 ;; stack cleaning
\ 0000012C 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 70402DE9 PUSH {R4-R6,LR}
\ 00000004 0050B0E1 MOVS R5,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 0040A0E3 MOV R4,#+0
403 #endif
404
405
406
407 if (OSIntNesting > 0) { /* See if trying to delete from ISR */
\ 0000000C ........ LDR R0,??DataTable26 ;; OSIntNesting
\ 00000010 0000D0E5 LDRB R0,[R0, #+0]
\ 00000014 010050E3 CMP R0,#+1
\ 00000018 0100003A BCC ??OSTaskDel_0
408 return (OS_ERR_TASK_DEL_ISR);
\ 0000001C 4000A0E3 MOV R0,#+64
\ 00000020 960000EA B ??OSTaskDel_1
409 }
410 if (prio == OS_TASK_IDLE_PRIO) { /* Not allowed to delete idle task */
\ ??OSTaskDel_0:
\ 00000024 1F0055E3 CMP R5,#+31
\ 00000028 0100001A BNE ??OSTaskDel_2
411 return (OS_ERR_TASK_DEL_IDLE);
\ 0000002C 3E00A0E3 MOV R0,#+62
\ 00000030 920000EA B ??OSTaskDel_1
412 }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -