📄 os_task.lst
字号:
283 return (OS_PRIO_INVALID);
\ 00000010 2A20 MOVS R0,#+42
\ 00000012 4BE0 B ??OSTaskCreateExt_1
284 }
285 #endif
286 OS_ENTER_CRITICAL();
\ ??OSTaskCreateExt_0:
\ 00000014 ........ _BLF OS_CPU_SR_Save,??OS_CPU_SR_Save??rT
287 if (OSTCBPrioTbl[prio] == (OS_TCB *)0) { /* Make sure task doesn't already exist at this priority */
\ 00000018 2D06 LSLS R5,R5,#+24 ;; ZeroExtS R5,R5,#+24,#+24
\ 0000001A 2D0E LSRS R5,R5,#+24
\ 0000001C 0421 MOVS R1,#+4
\ 0000001E 6943 MULS R1,R5,R1
\ 00000020 .... LDR R2,??DataTable26 ;; OSTCBPrioTbl
\ 00000022 5158 LDR R1,[R2, R1]
\ 00000024 0029 CMP R1,#+0
\ 00000026 3ED1 BNE ??OSTaskCreateExt_2
288 OSTCBPrioTbl[prio] = (OS_TCB *)1; /* Reserve the priority to prevent others from doing ... */
\ 00000028 2D06 LSLS R5,R5,#+24 ;; ZeroExtS R5,R5,#+24,#+24
\ 0000002A 2D0E LSRS R5,R5,#+24
\ 0000002C 0423 MOVS R3,#+4
\ 0000002E 6B43 MULS R3,R5,R3
\ 00000030 .... LDR R1,??DataTable26 ;; OSTCBPrioTbl
\ 00000032 0122 MOVS R2,#+1
\ 00000034 CA50 STR R2,[R1, R3]
289 /* ... the same thing until task is created. */
290 OS_EXIT_CRITICAL();
\ 00000036 ........ _BLF OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT
291
292 OS_TaskStkClr(pbos, stk_size, opt); /* Clear the task stack (if needed) */
\ 0000003A 3A00 MOVS R2,R7
\ 0000003C 3100 MOVS R1,R6
\ 0000003E 0898 LDR R0,[SP, #+32]
\ 00000040 ........ BL OS_TaskStkClr
293
294 psp = (OS_STK *)OSTaskStkInit(task, p_arg, ptos, opt); /* Initialize the task's stack */
\ 00000044 3B00 MOVS R3,R7
\ 00000046 2200 MOVS R2,R4
\ 00000048 0199 LDR R1,[SP, #+4]
\ 0000004A 0098 LDR R0,[SP, #+0]
\ 0000004C ........ _BLF OSTaskStkInit,??OSTaskStkInit??rT
\ 00000050 0400 MOVS R4,R0
295 err = OS_TCBInit(prio, psp, pbos, id, stk_size, pext, opt);
\ 00000052 3A00 MOVS R2,R7
\ 00000054 0A99 LDR R1,[SP, #+40]
\ 00000056 3000 MOVS R0,R6
\ 00000058 07B4 PUSH {R0-R2}
\ 0000005A 03A8 ADD R0,SP,#+12
\ 0000005C 838B LDRH R3,[R0, #+28]
\ 0000005E 0B9A LDR R2,[SP, #+44]
\ 00000060 2100 MOVS R1,R4
\ 00000062 2800 MOVS R0,R5
\ 00000064 ........ _BLF OS_TCBInit,??OS_TCBInit??rT
\ 00000068 03B0 ADD SP,SP,#+12
\ 0000006A 0400 MOVS R4,R0
296 if (err == OS_NO_ERR) {
\ 0000006C 002C CMP R4,#+0
\ 0000006E 0FD1 BNE ??OSTaskCreateExt_3
297 OS_ENTER_CRITICAL();
\ 00000070 ........ _BLF OS_CPU_SR_Save,??OS_CPU_SR_Save??rT
298 OSTaskCtr++; /* Increment the #tasks counter */
\ 00000074 .... LDR R1,??DataTable35 ;; OSTaskCtr
\ 00000076 .... LDR R2,??DataTable35 ;; OSTaskCtr
\ 00000078 1278 LDRB R2,[R2, #+0]
\ 0000007A 521C ADDS R2,R2,#+1
\ 0000007C 0A70 STRB R2,[R1, #+0]
299 OS_EXIT_CRITICAL();
\ 0000007E ........ _BLF OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT
300 if (OSRunning == TRUE) { /* Find HPT if multitasking has started */
\ 00000082 .... LDR R0,??DataTable25 ;; OSRunning
\ 00000084 0078 LDRB R0,[R0, #+0]
\ 00000086 0128 CMP R0,#+1
\ 00000088 0BD1 BNE ??OSTaskCreateExt_4
301 OS_Sched();
\ 0000008A ........ _BLF OS_Sched,??OS_Sched??rT
\ 0000008E 08E0 B ??OSTaskCreateExt_4
302 }
303 } else {
304 OS_ENTER_CRITICAL();
\ ??OSTaskCreateExt_3:
\ 00000090 ........ _BLF OS_CPU_SR_Save,??OS_CPU_SR_Save??rT
305 OSTCBPrioTbl[prio] = (OS_TCB *)0; /* Make this priority avail. to others */
\ 00000094 0421 MOVS R1,#+4
\ 00000096 4D43 MULS R5,R1,R5
\ 00000098 .... LDR R1,??DataTable26 ;; OSTCBPrioTbl
\ 0000009A 0022 MOVS R2,#+0
\ 0000009C 4A51 STR R2,[R1, R5]
306 OS_EXIT_CRITICAL();
\ 0000009E ........ _BLF OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT
307 }
308 return (err);
\ ??OSTaskCreateExt_4:
\ 000000A2 2000 MOVS R0,R4
\ 000000A4 02E0 B ??OSTaskCreateExt_1
309 }
310 OS_EXIT_CRITICAL();
\ ??OSTaskCreateExt_2:
\ 000000A6 ........ _BLF OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT
311 return (OS_PRIO_EXIST);
\ 000000AA 2820 MOVS R0,#+40
\ ??OSTaskCreateExt_1:
\ 000000AC 02B0 ADD SP,SP,#+8
\ 000000AE F0BC POP {R4-R7}
\ 000000B0 02BC POP {R1}
\ 000000B2 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 5648 LDR R0,??OSTaskDel_0 ;; OSIntNesting
\ 00000006 0078 LDRB R0,[R0, #+0]
\ 00000008 0128 CMP R0,#+1
\ 0000000A 01D3 BCC ??OSTaskDel_1
369 return (OS_TASK_DEL_ISR);
\ 0000000C 3F20 MOVS R0,#+63
\ 0000000E A3E0 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 9FE0 B ??OSTaskDel_2
374 }
375 if (prio >= OS_LOWEST_PRIO && prio != OS_PRIO_SELF) { /* Task priority valid ? */
\ ??OSTaskDel_3:
\ 00000018 3F2D CMP R5,#+63
\ 0000001A 03D3 BCC ??OSTaskDel_4
\ 0000001C FF2D CMP R5,#+255
\ 0000001E 01D0 BEQ ??OSTaskDel_4
376 return (OS_PRIO_INVALID);
\ 00000020 2A20 MOVS R0,#+42
\ 00000022 99E0 B ??OSTaskDel_2
377 }
378 #endif
379 OS_ENTER_CRITICAL();
\ ??OSTaskDel_4:
\ 00000024 ........ _BLF OS_CPU_SR_Save,??OS_CPU_SR_Save??rT
\ 00000028 0400 MOVS R4,R0
380 if (prio == OS_PRIO_SELF) { /* See if requesting to delete self */
\ 0000002A FF2D CMP R5,#+255
\ 0000002C 03D1 BNE ??OSTaskDel_5
381 prio = OSTCBCur->OSTCBPrio; /* Set priority to delete to current */
\ 0000002E .... LDR R0,??DataTable41 ;; OSTCBCur
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -