I was wondering if any of you would know some links to learn more about OS tasks and semaphores (more or less concerning uC/OS-II realtime kernel. I want to create a task which I could start by posting a semaphore.
In theory this is what I am after:
Code:
static int foo_Task( void );
static os_event *foo_Task_Sem;
int StartFooTask( void );
int foo_Init()
{
foo_Task(); // OSTaskCreate() should be called instead of calling the function?
return 0;
}
int foo_Task()
{
for(;;)
{
os_semaphore_pend( foo_Task_Sem );
// Do the task here
}
}
int StartFooTask( void )
{
os_semaphore_post( foo_Task_Sem );
return 0;
}
I would, ofcourse, write functions os_semaphore_pend() and os_semaphore_post() myself to add some own checks in it.
Anyway, above code does not work, since code execution will end up in forever loop in foo_Task() function.
I read about OSTaskCreate() and I figure that's what I need to call to create a task which would be foo_Task() then. Am I right? Will OSTaskCreate() actually call the function and leave it running behind? (that's how I understood it).
I would really appreciate some help or any information about resources / links to details about OS tasks and semaphores.
Thanks
- Rennor