📄 untitl~1.searchresults
字号:
Os_task.c (source):#if OS_TASK_CREATE_EXT_EN > 0
Os_task.c (source):INT8U OSTaskCreateExt (void (*task)(void *pd),
Os_task.c (source): if (OSTCBPrioTbl[prio] == (OS_TCB *)0) { /* Make sure task doesn't already exist at this priority */
Os_task.c (source): /* ... the same thing until task is created. */
Os_task.c (source): if (((opt & OS_TASK_OPT_STK_CHK) != 0x0000) || /* See if stack checking has been enabled */
Os_task.c (source): ((opt & OS_TASK_OPT_STK_CLR) != 0x0000)) { /* See if stack needs to be cleared */
Os_task.c (source): psp = (OS_STK *)OSTaskStkInit(task, pdata, ptos, opt); /* Initialize the task's stack */
Os_task.c (source): OSTaskCtr++; /* Increment the #tasks counter */
Os_task.c (source): if (OSRunning == TRUE) { /* Find HPT if multitasking has started */
Os_task.c (source):* DELETE A TASK
Os_task.c (source):* Description: This function allows you to delete a task. The calling task can delete itself by
Os_task.c (source):* its own priority number. The deleted task is returned to the dormant state and can be
Os_task.c (source):* re-activated by creating the deleted task again.
Os_task.c (source):* Arguments : prio is the priority of the task to delete. Note that you can explicitely delete
Os_task.c (source):* the current task without knowing its priority level by setting 'prio' to
Os_task.c (source):* OS_TASK_DEL_IDLE if you attempted to delete uC/OS-II's idle task
Os_task.c (source):* OS_TASK_DEL_ERR if the task you want to delete does not exist
Os_task.c (source):* OS_TASK_DEL_ISR if you tried to delete a task from an ISR
Os_task.c (source):* Notes : 1) To reduce interrupt latency, OSTaskDel() 'disables' the task:
Os_task.c (source):* c) by preventing OSTimeTick() from making the task ready to run.
Os_task.c (source):* The task can then be 'unlinked' from the miscellaneous structures in uC/OS-II.
Os_task.c (source):* 3) An ISR cannot delete a task.
Os_task.c (source):* task is being deleted, the current task would not be able to be rescheduled because it
Os_task.c (source):* is removed from the ready list. Incrementing the nesting counter prevents another task
Os_task.c (source):* from being schedule. This means that an ISR would return to the current task which is
Os_task.c (source):#if OS_TASK_DEL_EN > 0
Os_task.c (source):INT8U OSTaskDel (INT8U prio)
Os_task.c (source): return (OS_TASK_DEL_ISR);
Os_task.c (source): if (prio == OS_IDLE_PRIO) { /* Not allowed to delete idle task */
Os_task.c (source): return (OS_TASK_DEL_IDLE);
Os_task.c (source): if (prio >= OS_LOWEST_PRIO && prio != OS_PRIO_SELF) { /* Task priority valid ? */
Os_task.c (source): if (ptcb != (OS_TCB *)0) { /* Task to delete must exist */
Os_task.c (source): if ((OSRdyTbl[ptcb->OSTCBY] &= ~ptcb->OSTCBBitX) == 0x00) { /* Make task not ready */
Os_task.c (source): if (pevent != (OS_EVENT *)0) { /* If task is waiting on event */
Os_task.c (source): if ((pevent->OSEventTbl[ptcb->OSTCBY] &= ~ptcb->OSTCBBitX) == 0) { /* ... remove task from */
Os_task.c (source): if (pnode != (OS_FLAG_NODE *)0) { /* If task is waiting on event flag */
Os_task.c (source): ptcb->OSTCBStat = OS_STAT_RDY; /* Prevent task from being resumed */
Os_task.c (source): OSTaskDelHook(ptcb); /* Call user defined hook */
Os_task.c (source): OSTaskCtr--; /* One less task being managed */
Os_task.c (source): OS_Sched(); /* Find new highest priority task */
Os_task.c (source): return (OS_TASK_DEL_ERR);
Os_task.c (source):* REQUEST THAT A TASK DELETE ITSELF
Os_task.c (source):* a) notify a task to delete itself.
Os_task.c (source):* b) to see if a task requested that the current task delete itself.
Os_task.c (source):* This function is a little tricky to understand. Basically, you have a task that needs
Os_task.c (source):* to be deleted however, this task has resources that it has allocated (memory buffers,
Os_task.c (source):* semaphores, mailboxes, queues etc.). The task cannot be deleted otherwise these
Os_task.c (source):* resources would not be freed. The requesting task calls OSTaskDelReq() to indicate that
Os_task.c (source):* the task needs to be deleted. Deleting of the task is however, deferred to the task to
Os_task.c (source):* be deleted. For example, suppose that task #10 needs to be deleted. The requesting task
Os_task.c (source):* example, task #5, would call OSTaskDelReq(10). When task #10 gets to execute, it calls
Os_task.c (source):* value is OS_TASK_DEL_REQ, another task requested a task delete. Task #10 would look like
Os_task.c (source):* void Task(void *data)
Os_task.c (source):* if (OSTaskDelReq(OS_PRIO_SELF) == OS_TASK_DEL_REQ) {
Os_task.c (source):* OSTaskDel(OS_PRIO_SELF);
Os_task.c (source):* Arguments : prio is the priority of the task to request the delete from
Os_task.c (source):* Returns : OS_NO_ERR if the task exist and the request has been registered
Os_task.c (source):* OS_TASK_NOT_EXIST if the task has been deleted. This allows the caller to know whether
Os_task.c (source):* OS_TASK_DEL_IDLE if you requested to delete uC/OS-II's idle task
Os_task.c (source):* OS_TASK_DEL_REQ if a task (possibly another task) requested that the running task be
Os_task.c (source):#if OS_TASK_DEL_EN > 0
Os_task.c (source):INT8U OSTaskDelReq (INT8U prio)
Os_task.c (source): if (prio == OS_IDLE_PRIO) { /* Not allowed to delete idle task */
Os_task.c (source): return (OS_TASK_DEL_IDLE);
Os_task.c (source): if (prio >= OS_LOWEST_PRIO && prio != OS_PRIO_SELF) { /* Task priority valid ? */
Os_task.c (source): if (prio == OS_PRIO_SELF) { /* See if a task is requesting to ... */
Os_task.c (source): OS_ENTER_CRITICAL(); /* ... this task to delete itself */
Os_task.c (source): if (ptcb != (OS_TCB *)0) { /* Task to delete must exist */
Os_task.c (source): ptcb->OSTCBDelReq = OS_TASK_DEL_REQ; /* Set flag indicating task to be DEL. */
Os_task.c (source): err = OS_TASK_NOT_EXIST; /* Task must be deleted */
Os_task.c (source):* RESUME A SUSPENDED TASK
Os_task.c (source):* Description: This function is called to resume a previously suspended task. This is the only call that
Os_task.c (source):* will remove an explicit task suspension.
Os_task.c (source):* Arguments : prio is the priority of the task to resume.
Os_task.c (source):* Returns : OS_NO_ERR if the requested task is resumed
Os_task.c (source):* OS_TASK_RESUME_PRIO if the task to resume does not exist
Os_task.c (source):* OS_TASK_NOT_SUSPENDED if the task to resume has not been suspended
Os_task.c (source):#if OS_TASK_SUSPEND_EN > 0
Os_task.c (source):INT8U OSTaskResume (INT8U prio)
Os_task.c (source): if (prio >= OS_LOWEST_PRIO) { /* Make sure task priority is valid */
Os_task.c (source): if (ptcb == (OS_TCB *)0) { /* Task to suspend must exist */
Os_task.c (source): return (OS_TASK_RESUME_PRIO);
Os_task.c (source): if ((ptcb->OSTCBStat & OS_STAT_SUSPEND) != OS_STAT_RDY) { /* Task must be suspended */
Os_task.c (source): OSRdyGrp |= ptcb->OSTCBBitY; /* Make task ready to run */
Os_task.c (source): return (OS_TASK_NOT_SUSPENDED);
Os_task.c (source):* Description: This function is called to check the amount of free memory left on the specified task's
Os_task.c (source):* Arguments : prio is the task priority
Os_task.c (source):* OS_TASK_NOT_EXIST if the desired task has not been created
Os_task.c (source):* OS_TASK_OPT_ERR if you did NOT specified OS_TASK_OPT_STK_CHK when the task was created
Os_task.c (source):#if OS_TASK_CREATE_EXT_EN > 0
Os_task.c (source):INT8U OSTaskStkChk (INT8U prio, OS_STK_DATA *pdata)
Os_task.c (source): if (prio > OS_LOWEST_PRIO && prio != OS_PRIO_SELF) { /* Make sure task priority is valid */
Os_task.c (source): if (ptcb == (OS_TCB *)0) { /* Make sure task exist */
Os_task.c (source): return (OS_TASK_NOT_EXIST);
Os_task.c (source): if ((ptcb->OSTCBOpt & OS_TASK_OPT_STK_CHK) == 0) { /* Make sure stack checking option is set */
Os_task.c (source): return (OS_TASK_OPT_ERR);
Os_task.c (source):* SUSPEND A TASK
Os_task.c (source):* Description: This function is called to suspend a task. The task can be the calling task if the
Os_task.c (source):* priority passed to OSTaskSuspend() is the priority of the calling task or OS_PRIO_SELF.
Os_task.c (source):* Arguments : prio is the priority of the task to suspend. If you specify OS_PRIO_SELF, the
Os_task.c (source):* calling task will suspend itself and rescheduling will occur.
Os_task.c (source):* Returns : OS_NO_ERR if the requested task is suspended
Os_task.c (source):* OS_TASK_SUSPEND_IDLE if you attempted to suspend the idle task which is not allowed.
Os_task.c (source):* OS_TASK_SUSPEND_PRIO if the task to suspend does not exist
Os_task.c (source):* Note : You should use this function with great care. If you suspend a task that is waiting for
Os_task.c (source):* an event (i.e. a message, a semaphore, a queue ...) you will prevent this task from
Os_task.c (source):#if OS_TASK_SUSPEND_EN > 0
Os_task.c (source):INT8U OSTaskSuspend (INT8U prio)
Os_task.c (source): if (prio == OS_IDLE_PRIO) { /* Not allowed to suspend idle task */
Os_task.c (source): return (OS_TASK_SUSPEND_IDLE);
Os_task.c (source): if (prio >= OS_LOWEST_PRIO && prio != OS_PRIO_SELF) { /* Task priority valid ? */
Os_task.c (source): self = FALSE; /* No suspending another task */
Os_task.c (source): if (ptcb == (OS_TCB *)0) { /* Task to suspend must exist */
Os_task.c (source): return (OS_TASK_SUSPEND_PRIO);
Os_task.c (source): if ((OSRdyTbl[ptcb->OSTCBY] &= ~ptcb->OSTCBBitX) == 0x00) { /* Make task not ready */
Os_task.c (source): ptcb->OSTCBStat |= OS_STAT_SUSPEND; /* Status of task is 'SUSPENDED' */
Os_task.c (source):* QUERY A TASK
Os_task.c (source):* Description: This function is called to obtain a copy of the desired task's TCB.
Os_task.c (source):* Arguments : prio is the priority of the task to obtain information from.
Os_task.c (source):* Returns : OS_NO_ERR if the requested task is suspended
Os_task.c (source):* OS_PRIO_ERR if the desired task has not been created
Os_task.c (source):#if OS_TASK_QUERY_EN > 0
Os_task.c (source):INT8U OSTaskQuery (INT8U prio, OS_TCB *pdata)
Os_task.c (source): if (prio > OS_LOWEST_PRIO && prio != OS_PRIO_SELF) { /* Task priority valid ? */
Os_task.c (source): if (ptcb == (OS_TCB
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -