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.

Multiple GIO interrupt

Hello

I am trying to implement GIO interrupt via multiple pins on the TMS57004. each interrupt is to perform a different function. 

Can someone please tell me how to implement this as there is only one ISR(gioNOTIFICATION()) function in notification.c. Do i define another function similar to this one in notification.c and if so then how is it decided which ISR will work for which pin?

  • Saharsh,


    The GIO module includes an interrupt OFFSET register for each priority level.

    The function of this register is to priority encode the interrupt pins when multiple are pending on the same priority level (There are two: high & low levels)

    Reading the offset register gives you the highest priority pending pin, and as a side effect also clears the interrupt flag for the pin so that the next read to the offset register gives you the next highest priority pin, and so on.

    The offset is passed as a parameter to the GIO notification function so therefore you can test the offset to determine which pin interrupted.

    See how this is handled by the ISR. There is not much software here though because the OFFSET uses hardware to determine priority.

    /* SourceId : GIO_SourceId_011 */
    /* DesignId : GIO_DesignId_011 */
    /* Requirements : HL_SR35, HL_SR36 */
    void gioHighLevelInterrupt(void)
    {
    uint32 offset = gioREG->OFF1;

    /* USER CODE BEGIN (14) */
    /* USER CODE END */

    if (offset != 0U)
    {
    offset = offset - 1U;
    if (offset >= 8U)
    {
    gioNotification(gioPORTB, offset - 8U);
    }
    else
    {
    gioNotification(gioPORTA, offset);
    }
    }
    /* USER CODE BEGIN (15) */
    /* USER CODE END */

    }
  • where is the flag cleared on this function? Im having troubles... for some reason I just go to gio notification once...
  • You clear the interrupt request flag by reading the GIO Offset register, GIO Offset A if it is a high level interrupt, GIO Offset B if it is a low level interrupt. From page 1268 of SPNU515:

  • What you could do is to map the pins like this:
    gioA-->high priority
    gioB-->low priority
    and then just call the gioEnableNotification(PortX, bit) for all the pins you need. This way, everytime you get the interrupt, for any pin, It will go and do something. And you could use an if inside the gioNotification, on notification.c
    if((bit==2)&&(port==gioPORTB))
    do this
    if((bit==3)&&(port==gioPORTA))
    do this other

    and so on.

    The other option is that you modify the gioLow/High_Interrupt function. Instead of going into gioNotification directly, you could do your "do something" inside there and then return, without using gioNotification but.... I prefer the first method. I used both for some tests and... I preferred the first. It depends on what are you doing.

    Hope this helps you