Semaphore/vTaskResume - 7.3.0

2012-11-02
2013-09-16
  • First - Richard - I haven't had a chance to go through the new items in v7.3 - but for the low power additions - anything there specific for the MSP430 in the updated kernel?  I will take a look.

    2nd question - just a sanity check:
    I have a semaphore that is given from an ISR periodically from a Timer IRQ.  There is a task that blocks on this - but the task is also resumed asynchronously to, but not necessarily so, by another task. 
    Question is - if the timer IRQ makes the semaphore available more than once - and the task isn''t resumed - is that a problem?  The semaphore is a binary semaphore - the ones preferred to be used from a timer IRQ - correct?

    Thanks In Advance,
    John

     
  • Richard
    Richard
    2012-11-02

    anything there specific for the MSP430 in the updated kernel

    There is not yet anything specific to the MSP430.  There are generic hooks that allow the tickless mode to be used with a little coding on the application site too, as explained here: http://www.freertos.org/low-power-tickless-rtos.html.  The Cortex-M ports have a built in implementation, and other ports will do in the future.

    Question is - if the timer IRQ makes the semaphore available more than once - and the task isn''t resumed - is that a problem?

    So, if the task is being resumed, it must have been suspended?  Is that correct?

    If it is suspended while it is waiting for a semaphore, when it is resumed it will re-check to see if the semaphore is available.  If the semaphore is not available then it will block again to wait for it (assuming any specified block time remains).  If the semaphore is available it will take it and exit the xSemaphoreTake() function.

    If an interrupt 'gives' the semaphore twice while the task is suspended then the task will recognise the semaphore is available when it is resumed, but it won't recognise that the semaphore has been given twice.  If you need it to know the semaphore has been given twice then use a counting semaphore.

    Whether a binary or counting semaphore is preferred depends on the application. 

    Regards.