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.

SYSBIOS Semaphore vs. Event

Other Parts Discussed in Thread: SYSBIOS

DSP = C6748.  SYSBIOS = 6.34.4.22

We are using a Touch Screen controller IC.  It signals the DSP it has data to process via an interrupt pin (falling edge) that is tied to GPIO6[3].  The Touch Screen data has to be read via the I2C bus.  Because I2C transactions can take a long time, we have the HWI signal a TASK to do the I2C reads.  Currently we use a Semapore_post() to trigger the TASK to run, but I'm wondering if Event_post() would offer any benefits.  Events are new to us, as they didn't exist in DSPBIOS.

From the SYSBIOS users guide, an Event is defined as "Events provide a means for communicating between, and synchronizing threads."  Sounds exactly like what we are doing.  I understand Events allow you to specify mulitple condition that must happen before a thread run, and in our example we only have one Event (falling edge of GPIO6[3]).

The big question is, what are the pros / cons to using an Event in this case vs. a Semaphore?

Thanks, Dean

  • Dean,

    From your use-case description, I think you are better off using a Semaphore because it will yield a lower interrupt-to-task time than an Event object.

    Event objects are used when you want several things to be true before a Task is made ready to run.

    Each trigger source would post a different Event_Id. When the set of triggered Event_Ids matches either the 'and' or 'or' mask conditions of the Event object, only then will the task be unblocked.

    This seems like it is more overhead than you need for your simple use case.

    Alan

  • Alan, thanks for the feedback.  We'll stick with the Semaphore.  I was just curious if the Event module offered any benefits over a Semaphore in our simple case (since Events are new to us).  Obviously if I needed to have multiple things kick off a Task, then the Event object is the way to go.

    - Dean