Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 6 Current »

The table below shows the difference in API for task-management services.

µC/OS-II (os_task.c)

µC/OS-III (os_task.c)

Note

INT8U
OSTaskChangePrio(
    INT8U        oldprio,
    INT8U        newprio);
void
OSTaskChangePrio(
    OS_TCB       *p_tcb,
    OS_PRIO       prio,
    OS_ERR       *p_err);
(1)
INT8U
OSTaskCreate(
    void       (*task)(void *p_arg),
    void        *p_arg,
    OS_STK      *ptos,
    INT8U        prio);
void
OSTaskCreate(
    OS_TCB       *p_tcb,
    CPU_CHAR     *p_name,
    OS_TASK_PTR  *p_task,
    void         *p_arg,
    OS_PRIO       prio,
    CPU_STK      *p_stk_base,
    CPU_STK_SIZE  stk_limit,
    CPU_STK_SIZE  stk_size,
    OS_MSG_QTY    q_size,
    OS_TICK       time_quanta,
    void         *p_ext,
    OS_OPT        opt,
    OS_ERR       *p_err);
(2)  
INT8U
OSTaskCreateExt(
    void       (*task)(void *p_arg),
    void        *p_arg,
    OS_STK      *ptos,
    INT8U        prio,
    INT16U       id,
    OS_STK      *pbos,
    INT32U       stk_size,
    void        *pext,
    INT16U       opt);
void
OSTaskCreate(
    OS_TCB       *p_tcb,
    CPU_CHAR     *p_name,
    OS_TASK_PTR  *p_task,
    void         *p_arg,
    OS_PRIO       prio,
    CPU_STK      *p_stk_base,
    CPU_STK_SIZE  stk_limit,
    CPU_STK_SIZE  stk_size,
    OS_MSG_QTY    q_size,
    OS_TICK       time_quanta,
    void         *p_ext,
    OS_OPT        opt,
    OS_ERR       *p_err);
(2)
INT8U 
OSTaskDel(
    INT8U        prio);
void
OSTaskDel(
    OS_TCB       *p_tcb,
    OS_ERR       *p_err);

INT8U
OSTaskDelReq(
    INT8U        prio);


INT8U
OSTaskNameGet(
    INT8U        prio,
    INT8U      **pname,
    INT8U       *perr);


void
OSTaskNameSet(
    INT8U        prio,
    INT8U       *pname,
    INT8U       *perr);

(3)

OS_MSG_QTY
OSTaskQFlush(
    OS_TCB       *p_tcb,
    OS_ERR       *p_err);
(4)

void *
OSTaskQPend(
    OS_TICK      timeout,
    OS_OPT       opt,
    OS_MSG_SIZE *p_msg_size,
    CPU_TS      *p_ts,
    OS_ERR      *p_err);
(4)

CPU_BOOLEAN
OSTaskQPendAbort(
    OS_TCB      *p_tcb,
    OS_OPT       opt,
    OS_ERR      *p_err);
(4)

void
OSTaskQPost(
    OS_TCB      *p_tcb,
    void        *p_void,
    OS_MSG_SIZE  msg_size,
    OS_OPT       opt,
    OS_ERR      *p_err);
(4)
INT32U
OSTaskRegGet(
    INT8U        prio,
    INT8U        id,
    INT8U       *perr);
OS_REG
OSTaskRegGet(
    OS_TCB      *p_tcb,
    OS_REG_ID    id,
    OS_ERR      *p_err);

void
OSTaskRegSet(
    INT8U        prio,
    INT8U        id,
    INT32U       value,
    INT8U       *perr);
void
OSTaskRegGet(
    OS_TCB      *p_tcb,
    OS_REG_ID    id,
    OS_REG       value,
    OS_ERR      *p_err);

INT8U
OSTaskResume(
    INT8U        prio);
void
OSTaskResume(
    OS_TCB      *p_tcb,
    OS_ERR      *p_err);


OS_SEM_CTR
OSTaskSemPend(
    OS_TICK      timeout,
    OS_OPT       opt,
    CPU_TS      *p_ts,
    OS_ERR      *p_err);
(5)

CPU_BOOLEAN
OSTaskSemPendAbort(
    OS_TCB      *p_tcb,
    OS_OPT       opt,
    OS_ERR      *p_err);
(5)

CPU_BOOLEAN
OSTaskSemPendAbort(
    OS_TCB      *p_tcb,
    OS_OPT       opt,
    OS_ERR      *p_err);
(5)

OS_SEM_CTR
OSTaskSemPost(
    OS_TCB      *p_tcb,
    OS_OPT       opt,
    OS_ERR      *p_err);
(5)

OS_SEM_CTR
OSTaskSemSet(
    OS_TCB      *p_tcb,
    OS_SEM_CTR   cnt,
    OS_ERR      *p_err);
(5)
INT8U
OSTaskSuspend(
    INT8U        prio);
void
OSTaskSuspend(
    OS_TCB       *p_tcb,
    OS_ERR       *p_err);

INT8U
OSTaskStkChk(
    INT8U        prio,
    OS_STK_DATA *p_stk_data);
void
OSTaskStkChk(
    OS_TCB       *p_tcb,
    CPU_STK_SIZE *p_free,
    CPU_STK_SIZE *p_used,
    OS_ERR       *p_err);
(6)

void
OSTaskTimeQuantaSet(
    OS_TCB      *p_tcb,
    OS_TICK      time_quanta,
    OS_ERR      *p_err);
(7)
INT8U
OSTaskQuery(
    INT8U        prio,
    OS_TCB      *p_task_data);

(8)


(1) In µC/OS-II, each task must have a unique priority. The priority of a task can be changed at run-time, however it can only be changed to an unused priority. This is generally not a problem since µC/OS-II supports up to 255 different priority levels and is rare for an application to require all levels. Since µC/OS-III supports an unlimited number of tasks at each priority, the user can change the priority of a task to any available level.

(2) µC/OS-II provides two functions to create a task: OSTaskCreate() and OSTaskCreateExt()OSTaskCreateExt() is recommended since it offers more flexibility. In µC/OS-III, only one API is used to create a task, OSTaskCreate(), which offers similar features to OSTaskCreateExt() and provides additional ones.

(3) µC/OS-III does not need an OSTaskNameSet() since an ASCII name for the task is passed as an argument to OSTaskCreate().

(4) µC/OS-III allows tasks or ISRs to send messages directly to a task instead of having to pass through a mailbox or a message queue as does µC/OS-II.

(5) µC/OS-III allows tasks or ISRs to directly signal a task instead of having to pass through a semaphore as does µC/OS-II.

(6) In µC/OS-II, the user must allocate storage for a special data structure called OS_STK_DATA, which is used to place the result of a stack check of a task. This data structure contains only two fields: .OSFree and .OSUsed. In µC/OS-III, it is required that the caller pass pointers to destination variables where those values will be placed.

(7) µC/OS-III allows users to specify the time quanta of each task on a per-task basis. This is available since µC/OS-III supports multiple tasks at the same priority, and allows for round robin scheduling. The time quanta for a task is specified when the task is created, but it can be changed by the API at run time.

(8) µC/OS-III does not provide query services as they were rarely used.

  • No labels