📄 os_task.lst
字号:
278:os/source/os_task.c **** #if OS_ARG_CHK_EN > 0
279:os/source/os_task.c **** if (prio > OS_LOWEST_PRIO) { /* Make sure priority is within allowable range
280:os/source/os_task.c **** return (OS_PRIO_INVALID);
281:os/source/os_task.c **** }
282:os/source/os_task.c **** #endif
283:os/source/os_task.c **** OS_ENTER_CRITICAL();
628 .LM59:
629 /* #APP */
630 025c F894 cli
284:os/source/os_task.c **** if (OSTCBPrioTbl[prio] == (OS_TCB *)0) { /* Make sure task doesn't already exist at this priori
632 .LM60:
633 /* #NOAPP */
634 025e 822E mov r8,r18
635 0260 9924 clr r9
636 0262 F401 movw r30,r8
637 0264 E80D add r30,r8
638 0266 F91D adc r31,r9
639 0268 E050 subi r30,lo8(-(OSTCBPrioTbl))
640 026a F040 sbci r31,hi8(-(OSTCBPrioTbl))
641 026c 6081 ld r22,Z
642 026e 7181 ldd r23,Z+1
643 0270 6115 cp r22,__zero_reg__
644 0272 7105 cpc r23,__zero_reg__
645 0274 09F0 breq .+2
646 0276 3AC0 rjmp .L18
285:os/source/os_task.c **** OSTCBPrioTbl[prio] = (OS_TCB *)1; /* Reserve the priority to prevent others from doing .
648 .LM61:
649 0278 81E0 ldi r24,lo8(1)
650 027a 90E0 ldi r25,hi8(1)
651 027c 9183 std Z+1,r25
652 027e 8083 st Z,r24
286:os/source/os_task.c **** /* ... the same thing until task is created.
287:os/source/os_task.c **** OS_EXIT_CRITICAL();
654 .LM62:
655 /* #APP */
656 0280 7894 sei
288:os/source/os_task.c ****
289:os/source/os_task.c **** if (((opt & OS_TASK_OPT_STK_CHK) != 0x0000) || /* See if stack checking has been enabled
658 .LM63:
659 /* #NOAPP */
660 0282 A0FC sbrc r10,0
661 0284 02C0 rjmp .L20
662 0286 A1FE sbrs r10,1
663 0288 04C0 rjmp .L19
664 .L20:
290:os/source/os_task.c **** ((opt & OS_TASK_OPT_STK_CLR) != 0x0000)) { /* See if stack needs to be cleared
291:os/source/os_task.c **** #if OS_STK_GROWTH == 1
292:os/source/os_task.c **** (void)memset(pbos, 0, stk_size * sizeof(OS_STK));
666 .LM64:
667 028a A701 movw r20,r14
668 028c C301 movw r24,r6
669 028e 0E94 0000 call memset
670 .L19:
293:os/source/os_task.c **** #else
294:os/source/os_task.c **** (void)memset(ptos, 0, stk_size * sizeof(OS_STK));
295:os/source/os_task.c **** #endif
296:os/source/os_task.c **** }
297:os/source/os_task.c ****
298:os/source/os_task.c **** psp = (OS_STK *)OSTaskStkInit(task, pdata, ptos, opt); /* Initialize the task's stack
672 .LM65:
673 0292 9501 movw r18,r10
674 0294 A201 movw r20,r4
675 0296 B101 movw r22,r2
676 0298 8981 ldd r24,Y+1
677 029a 9A81 ldd r25,Y+2
678 029c 0E94 0000 call OSTaskStkInit
299:os/source/os_task.c **** err = OS_TCBInit(prio, psp, pbos, id, stk_size, pext, opt);
680 .LM66:
681 02a0 2C81 ldd r18,Y+4
682 02a2 3D81 ldd r19,Y+5
683 02a4 A301 movw r20,r6
684 02a6 BC01 movw r22,r24
685 02a8 8B81 ldd r24,Y+3
686 02aa 0E94 0000 call OS_TCBInit
687 02ae 182F mov r17,r24
300:os/source/os_task.c **** if (err == OS_NO_ERR) {
689 .LM67:
690 02b0 8823 tst r24
691 02b2 71F4 brne .L21
301:os/source/os_task.c **** OS_ENTER_CRITICAL();
693 .LM68:
694 /* #APP */
695 02b4 F894 cli
302:os/source/os_task.c **** OSTaskCtr++; /* Increment the #tasks counter
697 .LM69:
698 /* #NOAPP */
699 02b6 8091 0000 lds r24,OSTaskCtr
700 02ba 8F5F subi r24,lo8(-(1))
701 02bc 8093 0000 sts OSTaskCtr,r24
303:os/source/os_task.c **** OS_EXIT_CRITICAL();
703 .LM70:
704 /* #APP */
705 02c0 7894 sei
304:os/source/os_task.c **** if (OSRunning == TRUE) { /* Find HPT if multitasking has star
707 .LM71:
708 /* #NOAPP */
709 02c2 8091 0000 lds r24,OSRunning
710 02c6 8130 cpi r24,lo8(1)
711 02c8 71F4 brne .L23
305:os/source/os_task.c **** OS_Sched();
713 .LM72:
714 02ca 0E94 0000 call OS_Sched
715 02ce 0BC0 rjmp .L23
716 .L21:
306:os/source/os_task.c **** }
307:os/source/os_task.c **** } else {
308:os/source/os_task.c **** OS_ENTER_CRITICAL();
718 .LM73:
719 /* #APP */
720 02d0 F894 cli
309:os/source/os_task.c **** OSTCBPrioTbl[prio] = (OS_TCB *)0; /* Make this priority avail. to othe
722 .LM74:
723 /* #NOAPP */
724 02d2 880C add r8,r8
725 02d4 991C adc r9,r9
726 02d6 E0E0 ldi r30,lo8(OSTCBPrioTbl)
727 02d8 F0E0 ldi r31,hi8(OSTCBPrioTbl)
728 02da 8E0E add r8,r30
729 02dc 9F1E adc r9,r31
730 02de F401 movw r30,r8
731 02e0 1182 std Z+1,__zero_reg__
732 02e2 1082 st Z,__zero_reg__
310:os/source/os_task.c **** OS_EXIT_CRITICAL();
734 .LM75:
735 /* #APP */
736 02e4 7894 sei
737 /* #NOAPP */
738 .L23:
311:os/source/os_task.c **** }
312:os/source/os_task.c **** return (err);
740 .LM76:
741 02e6 812F mov r24,r17
742 02e8 9927 clr r25
743 02ea 03C0 rjmp .L17
744 .L18:
313:os/source/os_task.c **** }
314:os/source/os_task.c **** OS_EXIT_CRITICAL();
746 .LM77:
747 /* #APP */
748 02ec 7894 sei
315:os/source/os_task.c **** return (OS_PRIO_EXIST);
750 .LM78:
751 /* #NOAPP */
752 02ee 88E2 ldi r24,lo8(40)
753 02f0 90E0 ldi r25,hi8(40)
754 .L17:
755 /* epilogue: frame size=5 */
756 02f2 2596 adiw r28,5
757 02f4 0FB6 in __tmp_reg__,__SREG__
758 02f6 F894 cli
759 02f8 DEBF out __SP_H__,r29
760 02fa 0FBE out __SREG__,__tmp_reg__
761 02fc CDBF out __SP_L__,r28
762 02fe DF91 pop r29
763 0300 CF91 pop r28
764 0302 1F91 pop r17
765 0304 0F91 pop r16
766 0306 FF90 pop r15
767 0308 EF90 pop r14
768 030a DF90 pop r13
769 030c CF90 pop r12
770 030e BF90 pop r11
771 0310 AF90 pop r10
772 0312 9F90 pop r9
773 0314 8F90 pop r8
774 0316 7F90 pop r7
775 0318 6F90 pop r6
776 031a 5F90 pop r5
777 031c 4F90 pop r4
778 031e 3F90 pop r3
779 0320 2F90 pop r2
780 0322 0895 ret
781 /* epilogue end (size=25) */
782 /* function OSTaskCreateExt size 145 (94) */
789 .Lscope2:
793 .global OSTaskStkChk
795 OSTaskStkChk:
316:os/source/os_task.c **** }
317:os/source/os_task.c **** #endif
318:os/source/os_task.c **** /*$PAGE*/
319:os/source/os_task.c **** /*
320:os/source/os_task.c **** ***************************************************************************************************
321:os/source/os_task.c **** * DELETE A TASK
322:os/source/os_task.c **** *
323:os/source/os_task.c **** * Description: This function allows you to delete a task. The calling task can delete itself by
324:os/source/os_task.c **** * its own priority number. The deleted task is returned to the dormant state and can
325:os/source/os_task.c **** * re-activated by creating the deleted task again.
326:os/source/os_task.c **** *
327:os/source/os_task.c **** * Arguments : prio is the priority of the task to delete. Note that you can explicitely delete
328:os/source/os_task.c **** * the current task without knowing its priority level by setting 'prio' to
329:os/source/os_task.c **** * OS_PRIO_SELF.
330:os/source/os_task.c **** *
331:os/source/os_task.c **** * Returns : OS_NO_ERR if the call is successful
332:os/source/os_task.c **** * OS_TASK_DEL_IDLE if you attempted to delete uC/OS-II's idle task
333:os/source/os_task.c **** * OS_PRIO_INVALID if the priority you specify is higher that the maximum allowed
334:os/source/os_task.c **** * (i.e. >= OS_LOWEST_PRIO) or, you have not specified OS_PRIO_SELF
335:os/source/os_task.c **** * OS_TASK_DEL_ERR if the task you want to delete does not exist
336:os/source/os_task.c **** * OS_TASK_DEL_ISR if you tried to delete a task from an ISR
337:os/source/os_task.c **** *
338:os/source/os_task.c **** * Notes : 1) To reduce interrupt latency, OSTaskDel() 'disables' the task:
339:os/source/os_task.c **** * a) by making it not ready
340:os/source/os_task.c **** * b) by removing it from any wait lists
341:os/source/os_task.c **** * c) by preventing OSTimeTick() from making the task ready to run.
342:os/source/os_task.c **** * The task can then be 'unlinked' from the miscellaneous structures in uC/OS-II.
343:os/source/os_task.c **** * 2) The function OS_Dummy() is called after OS_EXIT_CRITICAL() because, on most proce
344:os/source/os_task.c **** * the next instruction following the enable interrupt instruction is ignored.
345:os/source/os_task.c **** * 3) An ISR cannot delete a task.
346:os/source/os_task.c **** * 4) The lock nesting counter is incremented because, for a brief instant, if the curr
347:os/source/os_task.c **** * task is being deleted, the current task would not be able to be rescheduled becau
348:os/source/os_task.c **** * is removed from the ready list. Incrementing the nesting counter prevents anothe
349:os/source/os_task.c **** * from being schedule. This means that an ISR would return to the current task whi
350:os/source/os_task.c **** * being deleted. The rest of the deletion would thus be able to be completed.
351:os/source/os_task.c **** ***************************************************************************************************
352:os/source/os_task.c **** */
353:os/source/os_task.c **** /*$PAGE*/
354:os/source/os_task.c **** #if OS_TASK_DEL_EN > 0
355:os/source/os_task.c **** INT8U OSTaskDel (INT8U prio)
356:os/source/os_task.c **** {
357:os/source/os_task.c **** #if OS_CRITICAL_METHOD == 3 /* Allocate storage for CPU status register
358:os/source/os_task.c **** OS_CPU_SR cpu_sr;
359:os/source/os_task.c **** #endif
360:os/source/os_task.c ****
361:os/source/os_task.c **** #if OS_EVENT_EN > 0
362:os/source/os_task.c **** OS_EVENT *pevent;
363:os/source/os_task.c **** #endif
364:os/source/os_task.c **** #if (OS_VERSION >= 251) && (OS_FLAG_EN > 0) && (OS_MAX_FLAGS > 0)
365:os/source/os_task.c **** OS_FLAG_NODE *pnode;
366:os/source/os_task.c **** #endif
367:os/source/os_task.c **** OS_TCB *ptcb;
368:os/source/os_task.c ****
369:os/source/os_task.c ****
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -