#include <rtl.h>
OS_TID os_tsk_create_user_ex (
void (*task)(void *), /* Task to create */
U8 priority, /* Task priority (1-254) */
void* stk, /* Pointer to the task's stack */
U16 size, /* Size of stack in bytes */
void* argv ); /* Argument to the task */
Description
The os_tsk_create_user_ex function creates the task
identified by the task function pointer argument and then adds
the task to the ready queue. It dynamically assigns a task identifier
value (TID) to the new task. This function enables you to provide a
separate stack for the task. This is useful when a task needs a
bigger stack for its local variables. The
os_tsk_create_user_ex function is an extension to the
os_tsk_create_user function that enables you to pass an
argument to the task.
The priority argument specifies the priority for the task.
The default task priority is 1. Priority 0 is reserved for the Idle
Task. If a value of 0 is specified for the priority, it is
automatically replaced with a value of 1. Priority 255 is also
reserved. If the new task has a higher priority than the currently
executing task, then a task switch occurs immediately to execute the
new task.
The stk argument is a pointer to the memory block reserved
for the stack of this task. The size argument specifies the
number of bytes in the stack.
The argv argument is passed directly to the task when it
starts. An argument to a task can be useful to differentiate between
multiple instances of the same task. Multiple instances of the same
task can behave differently based on the argument.
The os_tsk_create_user_ex function is in the RL-RTX
library. The prototype is defined in rtl.h.
note
The stack stk must be aligned at an 8-byte boundary and
must be declared as an array of type U64 (unsigned long long).
The default stack size is defined in rtx_config.c.
Return Value
The os_tsk_create_user_ex function returns the task
identifier value (TID) of the new task. If the function fails, for
example due to an invalid argument, it returns 0.
Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers of your data.