Examples‎ > ‎

Simple Task

First, we call the creation function and we store the pointer to the task structure that it returns.
 
ULONG ulMySerialPort = 1;
 
E_TASK* pTaskSerialManager = eTaskCreate("SerialManager", SerialManager, ulMySerialPort, E_PRIORITY_ABOVE_NORMAL, 600, E_START_NOW);
 
The parameters, are: the name of the task, the entry function, a numeric parameter for the entry function,  the priority, the stack size in bytes, and the options flag.
 
It returns a pointer with all the information about this task.
 
The entry point is the function that the kernel is going to call when it starts this task.
 
VOID SerialManager(ULONG ulSerialPort)
    ULONG ulEventFlagsResult;
    INT nEvent1Counter = 0;
 
    while (eEventWait(0xFFFFFFFF, &ulEventFlagsResult, E_WAIT_FOREVER)==E_OK)
    {
        if (ulEventFlagsResult & E_EVENT1)
        {
            ++nEvent1Counter;
        }
    }
}
 If you want to shoot the event from an interrupt, you must use this method.
 
__declspec(interrupt) void isrSerial(void)
{
    eInterruptEnter();
    eEventSignal(pTaskSerialManager, E_EVENT1);
    eInterruptExit();
}
Comments