OSTaskCreate
-------------
Purpose To create a task.
Syntax :
unsigned char OSTaskCreate (void (*task) (void * pd), void *pdata, unsigned char *pstk, unsigned long stk_size, unsigned char prio);
where, task is a pointer to the task's code.
pdata is a pointer to an optional data area, which can be used to pass parameters to the task when it is created.
pstk is a pointer to the task's top of stack. The stack is used to store local
variables, function parameters, return addresses, and CPU registers during an
interrupt. The size of this stack is defined by the task requirements and the
anticipated interrupt nesting. Determining the size of the stack involves
knowing how many bytes are required for storage of local variables for the task itself, all nested functions, as well as requirements for interrupts (accountingfor nesting).
prio is the task priority. A unique priority number must be assigned to each
task; the lower the number, the higher the priority.
Example OSTaskCreate (beep_task, (void *)0, beep_stk, 256, 10);
/* create a beep_task with priority 10 */
static unsigned char beep_stk [256];
Description This function allows an application to create a task. The task is managed by
μC/OS. Tasks can be created prior to the start of multitasking or by a running
task. Note that a task cannot be created by an ISR.
Partager