📄 os_task.lst
字号:
299 OS_EXIT_CRITICAL();
\ 00000070 ........ _BLF OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT
300 if (OSRunning == TRUE) { /* Find HPT if multitasking has started */
\ 00000074 .... LDR R0,??DataTable22 ;; OSRunning
\ 00000076 0078 LDRB R0,[R0, #+0]
\ 00000078 0128 CMP R0,#+1
\ 0000007A 0AD1 BNE ??OSTaskCreateExt_4
301 OS_Sched();
\ 0000007C ........ _BLF OS_Sched,??OS_Sched??rT
\ 00000080 07E0 B ??OSTaskCreateExt_4
302 }
303 } else {
304 OS_ENTER_CRITICAL();
\ ??OSTaskCreateExt_3:
\ 00000082 ........ _BLF OS_CPU_SR_Save,??OS_CPU_SR_Save??rT
305 OSTCBPrioTbl[prio] = (OS_TCB *)0; /* Make this priority avail. to others */
\ 00000086 A900 LSLS R1,R5,#+2
\ 00000088 .... LDR R2,??DataTable23 ;; OSTCBPrioTbl
\ 0000008A 0023 MOVS R3,#+0
\ 0000008C 5350 STR R3,[R2, R1]
306 OS_EXIT_CRITICAL();
\ 0000008E ........ _BLF OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT
307 }
308 return (err);
\ ??OSTaskCreateExt_4:
\ 00000092 2000 MOVS R0,R4
\ 00000094 02E0 B ??OSTaskCreateExt_1
309 }
310 OS_EXIT_CRITICAL();
\ ??OSTaskCreateExt_2:
\ 00000096 ........ _BLF OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT
311 return (OS_PRIO_EXIST);
\ 0000009A 2820 MOVS R0,#+40
\ ??OSTaskCreateExt_1:
\ 0000009C 02B0 ADD SP,SP,#+8
\ 0000009E F0BC POP {R4-R7}
\ 000000A0 02BC POP {R1}
\ 000000A2 0847 BX R1 ;; return
312 }
313 #endif
314
315 /*
316 *********************************************************************************************************
317 * DELETE A TASK
318 *
319 * Description: This function allows you to delete a task. The calling task can delete itself by
320 * its own priority number. The deleted task is returned to the dormant state and can be
321 * re-activated by creating the deleted task again.
322 *
323 * Arguments : prio is the priority of the task to delete. Note that you can explicitely delete
324 * the current task without knowing its priority level by setting 'prio' to
325 * OS_PRIO_SELF.
326 *
327 * Returns : OS_NO_ERR if the call is successful
328 * OS_TASK_DEL_IDLE if you attempted to delete uC/OS-II's idle task
329 * OS_PRIO_INVALID if the priority you specify is higher that the maximum allowed
330 * (i.e. >= OS_LOWEST_PRIO) or, you have not specified OS_PRIO_SELF.
331 * OS_TASK_DEL_ERR if the task you want to delete does not exist
332 * OS_TASK_DEL_ISR if you tried to delete a task from an ISR
333 *
334 * Notes : 1) To reduce interrupt latency, OSTaskDel() 'disables' the task:
335 * a) by making it not ready
336 * b) by removing it from any wait lists
337 * c) by preventing OSTimeTick() from making the task ready to run.
338 * The task can then be 'unlinked' from the miscellaneous structures in uC/OS-II.
339 * 2) The function OS_Dummy() is called after OS_EXIT_CRITICAL() because, on most processors,
340 * the next instruction following the enable interrupt instruction is ignored.
341 * 3) An ISR cannot delete a task.
342 * 4) The lock nesting counter is incremented because, for a brief instant, if the current
343 * task is being deleted, the current task would not be able to be rescheduled because it
344 * is removed from the ready list. Incrementing the nesting counter prevents another task
345 * from being schedule. This means that an ISR would return to the current task which is
346 * being deleted. The rest of the deletion would thus be able to be completed.
347 *********************************************************************************************************
348 */
349
350 #if OS_TASK_DEL_EN > 0
\ In segment CODE, align 4, keep-with-next
351 INT8U OSTaskDel (INT8U prio)
352 {
\ OSTaskDel:
\ 00000000 F0B5 PUSH {R4-R7,LR}
\ 00000002 0500 MOVS R5,R0
353 #if OS_CRITICAL_METHOD == 3 /* Allocate storage for CPU status register */
354 OS_CPU_SR cpu_sr;
355 #endif
356
357 #if OS_EVENT_EN > 0
358 OS_EVENT *pevent;
359 #endif
360 #if (OS_VERSION >= 251) && (OS_FLAG_EN > 0) && (OS_MAX_FLAGS > 0)
361 OS_FLAG_NODE *pnode;
362 #endif
363 OS_TCB *ptcb;
364 INT8U y;
365
366
367
368 if (OSIntNesting > 0) { /* See if trying to delete from ISR */
\ 00000004 4C48 LDR R0,??OSTaskDel_0 ;; OSIntNesting
\ 00000006 0078 LDRB R0,[R0, #+0]
\ 00000008 0028 CMP R0,#+0
\ 0000000A 01D0 BEQ ??OSTaskDel_1
369 return (OS_TASK_DEL_ISR);
\ 0000000C 3F20 MOVS R0,#+63
\ 0000000E 8FE0 B ??OSTaskDel_2
370 }
371 #if OS_ARG_CHK_EN > 0
372 if (prio == OS_IDLE_PRIO) { /* Not allowed to delete idle task */
\ ??OSTaskDel_1:
\ 00000010 3F2D CMP R5,#+63
\ 00000012 01D1 BNE ??OSTaskDel_3
373 return (OS_TASK_DEL_IDLE);
\ 00000014 3D20 MOVS R0,#+61
\ 00000016 8BE0 B ??OSTaskDel_2
374 }
375 if (prio >= OS_LOWEST_PRIO && prio != OS_PRIO_SELF) { /* Task priority valid ? */
\ ??OSTaskDel_3:
\ 00000018 03D3 BCC ??OSTaskDel_4
\ 0000001A FF2D CMP R5,#+255
\ 0000001C 01D0 BEQ ??OSTaskDel_4
376 return (OS_PRIO_INVALID);
\ 0000001E 2A20 MOVS R0,#+42
\ 00000020 86E0 B ??OSTaskDel_2
377 }
378 #endif
379 OS_ENTER_CRITICAL();
\ ??OSTaskDel_4:
\ 00000022 ........ _BLF OS_CPU_SR_Save,??OS_CPU_SR_Save??rT
\ 00000026 0400 MOVS R4,R0
380 if (prio == OS_PRIO_SELF) { /* See if requesting to delete self */
\ 00000028 FF2D CMP R5,#+255
\ 0000002A 03D1 BNE ??OSTaskDel_5
381 prio = OSTCBCur->OSTCBPrio; /* Set priority to delete to current */
\ 0000002C .... LDR R0,??DataTable38 ;; OSTCBCur
\ 0000002E 0068 LDR R0,[R0, #+0]
\ 00000030 2D30 ADDS R0,R0,#+45
\ 00000032 0578 LDRB R5,[R0, #+0]
382 }
383 ptcb = OSTCBPrioTbl[prio];
\ ??OSTaskDel_5:
\ 00000034 A800 LSLS R0,R5,#+2
\ 00000036 .... LDR R1,??DataTable40 ;; OSTCBPrioTbl
\ 00000038 0E58 LDR R6,[R1, R0]
384 if (ptcb != (OS_TCB *)0) { /* Task to delete must exist */
\ 0000003A 002E CMP R6,#+0
\ 0000003C 74D0 BEQ ??OSTaskDel_6
385 y = ptcb->OSTCBY;
\ 0000003E 2F20 MOVS R0,#+47
\ 00000040 315C LDRB R1,[R6, R0]
386 OSRdyTbl[y] &= ~ptcb->OSTCBBitX;
\ 00000042 .... LDR R3,??DataTable44 ;; OSRdyTbl
\ 00000044 .... LDR R7,??DataTable44 ;; OSRdyTbl
\ 00000046 7A5C LDRB R2,[R7, R1]
\ 00000048 3027 MOVS R7,#+48
\ 0000004A F75D LDRB R7,[R6, R7]
\ 0000004C BA43 BICS R2,R2,R7
\ 0000004E 5A54 STRB R2,[R3, R1]
387 if (OSRdyTbl[y] == 0x00) { /* Make task not ready */
\ 00000050 .... LDR R2,??DataTable44 ;; OSRdyTbl
\ 00000052 505C LDRB R0,[R2, R1]
\ 00000054 0028 CMP R0,#+0
\ 00000056 06D1 BNE ??OSTaskDel_7
388 OSRdyGrp &= ~ptcb->OSTCBBitY;
\ 00000058 .... LDR R0,??DataTable42 ;; OSRdyGrp
\ 0000005A .... LDR R2,??DataTable42 ;; OSRdyGrp
\ 0000005C 1278 LDRB R2,[R2, #+0]
\ 0000005E 3123 MOVS R3,#+49
\ 00000060 F35C LDRB R3,[R6, R3]
\ 00000062 9A43 BICS R2,R2,R3
\ 00000064 0270 STRB R2,[R0, #+0]
389 }
390 #if OS_EVENT_EN > 0
391 pevent = ptcb->OSTCBEventPtr;
\ ??OSTaskDel_7:
\ 00000066 F269 LDR R2,[R6, #+28]
392 if (pevent != (OS_EVENT *)0) { /* If task is waiting on event */
\ 00000068 002A CMP R2,#+0
\ 0000006A 0ED0 BEQ ??OSTaskDel_8
393 pevent->OSEventTbl[y] &= ~ptcb->OSTCBBitX;
\ 0000006C 5018 ADDS R0,R2,R1
\ 0000006E 5318 ADDS R3,R2,R1
\ 00000070 1B7A LDRB R3,[R3, #+8]
\ 00000072 3027 MOVS R7,#+48
\ 00000074 F75D LDRB R7,[R6, R7]
\ 00000076 BB43 BICS R3,R3,R7
\ 00000078 0372 STRB R3,[R0, #+8]
394 if (pevent->OSEventTbl[y] == 0) { /* ... remove task from ... */
\ 0000007A 007A LDRB R0,[R0, #+8]
\ 0000007C 0028 CMP R0,#+0
\ 0000007E 04D1 BNE ??OSTaskDel_8
395 pevent->OSEventGrp &= ~ptcb->OSTCBBitY; /* ... event ctrl block */
\ 00000080 5078 LDRB R0,[R2, #+1]
\ 00000082 3121 MOVS R1,#+49
\ 00000084 715C LDRB R1,[R6, R1]
\ 00000086 8843 BICS R0,R0,R1
\ 00000088 5070 STRB R0,[R2, #+1]
396 }
397 }
398 #endif
399 #if (OS_VERSION >= 251) && (OS_FLAG_EN > 0) && (OS_MAX_FLAGS > 0)
400 pnode = ptcb->OSTCBFlagNode;
\ ??OSTaskDel_8:
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -