This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

EL1 Interrupt handler in C for Cortex R52

Hello

I'm quite a beginner with development of drivers for R52.

I just want, for trials purpose, to write a C interrupt handler (EL1) for some peripheral.

I wrote a very simple "hello world" style and managed to trigger it when my peripheral sends an interruptions to the R52 virtual model.

But now, I would like to know how to clear my interrupt from my C handler, because I do not know which registers must be written and in which order. Could

you please tell me what I have to do to clear my SPI interrupt ?

Best Regards

Frederic

Parents
  • I know you didn't ask about virtualization, but this guide might be useful: Armv8-R virtualization

    The guide includes a description of the GIC and some examples are how it is used.

    But to try to answer your direct question:

    On entry to the interrupt handler you'd need to read ICC_IAR0/1 (ICC_IAR0 for FIQs, ICC_IAR1 for IRQs).  That acknowledges receipt of the interrupt, returning the INTID to software and updating the interrupt's state in the GIC.

    Depending on what the interrupt is, you might then need to access the peripheral to clear the interrupt signal. That's going to entirely depend on what the interrupt source is, and whether it's edge or level signalled. 

    Then, you would write ICC_EOIR0/1 (with the INTID returned earlier) to tell the GIC you'd finishing handling that instance of that interrupt.  That updates the interrupt state again, and updates the running priority of the CPU.

    Note: I'm assuming you have not set EOImode to 1.  Otherwise you'd need to write ICC_EOIR0/1 and ICC_DIR.

Reply
  • I know you didn't ask about virtualization, but this guide might be useful: Armv8-R virtualization

    The guide includes a description of the GIC and some examples are how it is used.

    But to try to answer your direct question:

    On entry to the interrupt handler you'd need to read ICC_IAR0/1 (ICC_IAR0 for FIQs, ICC_IAR1 for IRQs).  That acknowledges receipt of the interrupt, returning the INTID to software and updating the interrupt's state in the GIC.

    Depending on what the interrupt is, you might then need to access the peripheral to clear the interrupt signal. That's going to entirely depend on what the interrupt source is, and whether it's edge or level signalled. 

    Then, you would write ICC_EOIR0/1 (with the INTID returned earlier) to tell the GIC you'd finishing handling that instance of that interrupt.  That updates the interrupt state again, and updates the running priority of the CPU.

    Note: I'm assuming you have not set EOImode to 1.  Otherwise you'd need to write ICC_EOIR0/1 and ICC_DIR.

Children