OSTaskCreate()

OSTaskCreate (): 
 
Synopsis:  
 
BYTE OSTaskCreate( void ( * task )( void * taskfunc ), void * data,
void * pstacktop, void * pstackbot, BYTE priority );  
 
Description:  
 
This function creates a new task. You must supply storage for the stack that this new task will
use.

Note: The stack must be 4 byte aligned.  
 
Warning: The uC/OS can only have one task at each priority.  
 
Parameters:  

Type Description
taskfunc The address of the function where this task will start executing.
data The data to pass to the task function.
pstacktop The highest address of the stack space.
pstackbot The lowest address of the stack space.
priority The priority for the new task(63 lowest priority and 1 is highest.


Returns: 
 
OS_NO_ERR (0) --- If successful 
OS_PRIO_EXIST (40) --- If the requested priority already exists   
OSTaskDelete --- Delete a task  
OSChangePrio --- Change a task's priority  
OSSimpleTaskCreate --- A macro that sets up the stack and starts the task at the proper priority  
 
Example: 
 
// Make sure they're 4 byte aligned to keep the Coldfire happy 
asm( " .align 4 " );
 
DWORD MyTaskStk[USER_TASK_STK_SIZE] __attribute__( ( aligned( 4 ) ) );
 
// The function the new task will start in. pdata will have the value
// of my_data as provided in the OSTaskCreate Call
void mytask(void * pdata)
 {
 }
 
if (OSTaskCreate(mytask, 
                (void*)my_data, 
                (void*)&MyTaskStk[USER_TASK_STK_SIZE], 
                (void *)MyTaskStk, MyPrio
                )!=OS_NO_ERR)
                  { // Handle error
                  }  
 
 

From the Web

Suggestions: (1)
Loading...

See few results | more results

Search: [Press Enter]

Share |