This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

How to reset an Event

Hello,

In task1 there is an event pending like below,

Event_pend(event_tx, Event_Id_00 + Event_Id_03,    Event_Id_NONE, BIOS_WAIT_FOREVER);

However ocasionally I need resync&re-start the task and I have to reset the event in task2.

How can I do that since BIOS user guide notes us that Only a single Task can pend on an Event object at a time?

 

In my case I use below code in task2 to reset the event (only event_id_03 might be set when resetting),

Event_pend(event_tx, Event_Id_03, Event_Id_NONE, BIOS_NO_WAIT);

It works however I am afraid there is potential problem in it.

 

B.R.

River Liu

  • You can

    1. use a timeout in the Event_pend

    2. Add another event_id. Post it when you need to restart. After the Event_pend to can check for that id and act accordingly.

    fyi: there was no "code below" in your post.

    Todd

  • Todd,

    Thanks, the second tip works for my case.

    Below is my working code,

     

    void tsk_reset(){

    ...

    Event_post(event_tx, Event_Id_05);

    ...

    }

     

    void task1(){

    ...

    Event_post(event_tx, Event_Id_00);

    ...

    }

    void task2(){

    ...

    Event_post(event_tx, Event_Id_03);

    ...

    }

    void task3(){

    ...

      events = Event_pend(event_tx, Event_Id_00 + Event_Id_03,    Event_Id_05, BIOS_WAIT_FOREVER);      

    if((events & Event_Id_05) == Event_Id_05)   {

        if((events & Event_Id_00) == Event_Id_00)     

          Event_pend(event_tx, Event_Id_NONE, Event_Id_00, BIOS_NO_WAIT);    

       if((events & Event_Id_03) == Event_Id_03)     

          Event_pend(event_tx, Event_Id_NONE, Event_Id_03, BIOS_NO_WAIT);    

        continue;   

    }

    ...

    }

    B.R.

    River Liu