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.

CSL_intcPlugEventHandler and CSL_intcHookIsr

I find their description in csl source documents.

CSL_intcPlugEventHandler description as follow:

Associate an event-handler with an event.
CSL_intcPlugEventHandler(..) ties an event-handler to an event; so that the occurence of the event, would result in the event-handler being invoked.

CSL_intcHookIsr description as follow:

Hook up an exception handler.
This API hooks up the handler to the specified exception.
Note: In this case, it is done by inserting a B(ranch) instruction to the handler.
Because of the restriction in the instruction the handler must be within 32MB of the exception vector. Also, the function assumes that the exception vector table is located at its default ("low")address.

  1. I don't understand what's the difference between CSL_intcPlugEventHandler and CSL_intcHookIsr.
    Some CSL examples use CSL_intcPlugEventHandler() such as AIF,EMAC,FSYNC,EDC;
    and some others use the other CSL_intcHookIsr() like INTC,Timer,EDMA,CFG.
    I think they are both hook ISR fonction to system interrupt event, is that right?
  2. I don't know what's the difference between "event" and "exception".
  3. I have little knowledge about "exception",could you suggest some documents for me ?

Thank you for your help.
Best regards.

  • I found them in SPRAA10–"CSL 2.x to CSL 3.x Migration"

    Section 6.4 for CSL_intcHookIsr and Section 6.5 for CSL_intcPlugEventHanler.

    CSL_intcHookIsr  "are provided to hook an ISR directly into the chip interrupt vector table with the necessary code to branch to that ISR."

    CSL_intcPlugEventHanler is a fonction for "internal Interrupt Dispatcher" provided in CSL 3.x.
    You should Call CSL_intcDispatcherInit() after calling CSL_intcInit().
    Plug the event handler corresponding to this interrupt using CSL_intcPlugEventHandler().

    But it seems that in some CSL examples they don't call CSL_intcDispatcherInit() before using CSL_intcPlugEventHandler().It looks like we can use CSL_intcDispatcherInit() the same as CSL_intcHookIsr,is that right?

    I am confused.

    What's the advantage about the "internal Interrupt Dispatcher" ?
    In which case I shoud use that expect use CSL_intcHookIsr?

    Thank you for your help.
    Best regards.


  • Wang nan said:
    1. I don't understand what's the difference between CSL_intcPlugEventHandler and CSL_intcHookIsr.
      I think they are both hook ISR function to system interrupt event, is that right?

    When an interrupt occurs, one of 12 available DSP core interrupts will be asserted in IFR. There is an interrupt vector table that contains the starting code for each of the DSP core interrupts. CSL_intcHookIsr will write the code into that interrupt vector table so it will branch to an ISR of your choice. This will require the use of the "interrupt" keyword in front of the C function that is your ISR.

    Another choice is to use the Interrupt Dispatcher to make your job a little easier. Since I have not used it, I may have some details wrong. But with the Interrupt Dispatcher, it will fill the interrupt vector table with branches to itself, it will handle the context save/restore so you do not need to use the "interrupt" keyword for your ISR, and it will know which function to call for your ISR. CSL_intcPlugEventHandler is the function to call to plug your ISR function name into a table of interrupts that the Interrupt Dispatcher will access.

    The easiest way, though, is to use DSP/BIOS and the HWI Dispatcher and let it take care of the context save/restore. And you map an HWI to an ISR in the DSP/BIOS configuration GUI.

    CSL_intcHookIsr and CSL_intcPlugEventHandler are similar in that they both help with ISRs, but they do it different ways. They are not interchangeable.

    Wang nan said:
    1. I don't know what's the difference between "event" and "exception".
    2. I have little knowledge about "exception",could you suggest some documents for me ?

    An event is a general term for internal or external signals that may be used to generate an interrupt.

    An exception is a special type of event that represents an error or fault condition. Exception may also be used to refer to an interrupt that is generated in response to an error or fault condition.

    Since you did not state which DSP you are using, we will limit this to the C6455. It has an INTC interrupt controller that accepts up to 64 events that can be mapped to one of the 12 DSP core interrupts.

    There is also an Exception Combiner part of the INTC that can map any of the 64 events to a single exception interrupt instead of the DSP core interrupts. There are also device faults and protection violation flags that can be mapped into the exception interrupt. The Non-Maskable Interrupt (NMI) is used for the exception interrupt to the DSP.

    Read more about the Interrupt Controller and Exceptions in the C64x+ DSP Megamodule Reference Guide spru871 . 

  • Thank you for your help, RandyP

    Best Regards.