Re: <INTEGRITY RTOS> Passing arguments to an entry point function of the CreateTask() task kernel call
- From: "Alex Vinokur" <alexvn@xxxxxxxxxxxxxxxxxxxxx>
- Date: 26 Feb 2006 09:07:29 -0800
Stefan Reuther wrote:
Alex Vinokur wrote:
Can that (entry point) function have arguments? How to pass these
arguments to the entry point function while calling CreateTask() and
similar task kernel calls.
No, it can't have arguments. But you can associate an address with the
task using Get/SetTaskIdentification; that address can point to a
structure containing the arguments (like in Win32 or pthreads, where you
also can pass a single pointer only, not arbitrary arguments).
Stefan
Thank you.
It works quite fine.
Here is an example:
====== foo.c ======
/* INTEGRITY RTOS */
#include "INTEGRITY.h"
#include <stdio.h>
void CHECK(Error TheError)
{
if (TheError) HaltTask(CurrentTask());
}
void entry_point()
{
Address TheAddress;
Error TheError = GetTaskIdentification(CurrentTask(),&TheAddress);
if (TheError == Success)
{
printf("Success -> GetTaskIdentification returned %s\n", TheAddress);
}
else
{
printf("Failure -> GetTaskIdentification returned Error=%d\n",
TheError);
}
Exit(0);
}
int main()
{
Task task;
char* ptr = "ABCDXYZ";
CHECK (CreateProtectedTask(1, (Address)entry_point, 0x1000,
"the-task", &task));
CHECK (SetTaskIdentification(task, (Address)ptr));
CHECK (RunTask(task));
exit(0);
}
===================
===== Output ======
Success -> GetTaskIdentification returned ABCDXYZ
===================
Alex Vinokur
email: alex DOT vinokur AT gmail DOT com
http://mathforum.org/library/view/10978.html
http://sourceforge.net/users/alexvn
.
- Follow-Ups:
- References:
- Prev by Date: Low power consumption board with memory
- Next by Date: Re: [Comparison] PIC vs 8051
- Previous by thread: Re: <INTEGRITY RTOS> Passing arguments to an entry point function of the CreateTask() task kernel call
- Next by thread: Re: <INTEGRITY RTOS> Passing arguments to an entry point function of the CreateTask() task kernel call
- Index(es):