<< Previous | Next >>

OSTaskCreateExt

INT8U OSTaskCreateExt( void (* task)(), void * pdata, INT8U prio, INT16U id, INT16U stk_size, void * pext, INT16U opt );

Description

Creates a task to be managed by µC/OS-II. Tasks can either be created prior to the start of multitasking or by a running task. A task cannot be created by an ISR. This function is similar to OSTaskCreate() except that it allows additional information about a task to be specified.

Parameters

task
Pointer to task's code.

pdata
Pointer to optional data area; used to pass parameters to the task at start of execution.

prio
The task's unique priority number; the lower the number the higher the priority.

id
The task's identification number (0...65535).

stk_size
Size of the stack in number of elements. If OS_STK is set to INT8U, stk_size corresponds to the number of bytes available. If OS_STK is set to INT16U, stk_size contains the number of 16-bit entries available. Finally, if OS_STK is set to INT32U, stk_size contains the number of 32-bit entries available on the stack.

pext
Pointer to a user-supplied Task Control Block (TCB) extension.

opt
The lower 8 bits are reserved by µC/OS-II. The upper 8 bits control application-specific options. Select an option by setting the corresponding bit(s).

Return value

OS_NO_ERR
The call was successful.

OS_PRIO_EXIT
Task priority already exists (each task MUST have a unique priority).

OS_PRIO_INVALID
The priority specified is higher than the maximum allowed (i.e. OS_LOWEST_PRIO).

Library

UCOS2.LIB

See also

OSTaskCreate


Dynamic C Functions << Previous | Next >> rabbit.com