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.

Interrupt service routine on C64x DSP

Hi,

I'm woking with the Turbo-Decoder Coprocessor on the C6416 DSP. And I've managed to create an interrupt from the EDMA when the decoding is finished. Everything is running as it should and the code jumps to position 0x100 in the memory where the interrupt service routine (ISR) should lie. My problem is that I don't now how to put the ISR in the right place. The suggestions I've found is that the DSP/BIOS is useful but the problem is that when i run my code with DSP/BIOS code composer studio crashes during the decoding on the coprocessor (before any interrupt).

So my question is: how can I write an interrupt service routine without using the DSP/BIOS?

I've tried to use #pragma and __interrupt void myIsr(void), but this doesn't work. (might be because I'm writing in C++ instead of C?)

I've also tried with the chip support library and the IRQ functionality but the documentation states that:

This function dynamically configures an entry in the interrupt dispatcher table with the information contained in the configuration structure.
To use this function, a DSP/BIOS configuration .cdb must be defined. Two constraints must be met before this function has any effect:
1) The event must be mapped to an interrupt
2) The interrupt this event is mapped to must be using the dispatcher
If either of the above two conditions are not met, this function will have no
effect.


Which I guess means that I need to use DSP/BIOS for that to work?

I've also seen some examples with a vectors.asm files which does the job, but I don't know how I should create or link or include such a file.

I would appreciate any kind of help or suggestion on how to solve this problem!

  • Hi Johan-

    The base of the interrupt vector table is not fixed, but can be found by reading the ISTP register. E.G.,

     

    void Dummy_Vector()
    {
     asm(" MVKL.S1 Dummy_Isr,A3");
     asm(" MVKH.S1 Dummy_Isr,A3");
     asm(" NOP");
     asm(" B.S2X  A3");
     asm(" NOP");
     asm(" NOP");
     asm(" NOP");
     asm(" NOP");
    }

    ...............

     src=(char *)Dummy_Vector;
     ISTPAdr=(ISTP&0xFFFFFC00);
     dst=(char *)ISTPAdr;

     memcpy(dst+0x20*4,src,0x20);

    dst then points to base of interrut vector table. Once you have the base, you can fill the appropriate region with code to branch to your custom service routine. From base, each interrupt is allocate 0x20 bytes (8 instructions)--e.g., Vector zero starts at base, Vector 4 starts at base+0x20*3, etc....

    In my example above, Dummy_Isr is a C function for the vector, and the code places a branch to it for interrupt vector 4.

    Jim

     

  • Johan Ahlqvist,

    Jim's code example is amazingly clever and shows his good understanding of the C64x interrupt vector table, plus great C code use of pointers and addresses. But, with apologies, do not use it. It could fail in subtle ways and it will fail because of the assembly code. Instead of debugging and repairing this code, DSP/BIOS or other proven methods should be used.

    DSP/BIOS is offered for the purpose of making your application implementation as easy as possible. So the easiest thing to do is to use DSP/BIOS. Use the HWI_Dispatcher for your interrupts. Do not use the "interrupt" keyword for your ISR C function.

    There are name mangling issues with C++, so my quickest advice would be to write your ISR in C and put it in a .c file. That might might throw in other issues, so proceed carefully. The Compiler User's Guide for your version of the compiler will have information on interrupts and C++, I think.

    The most information and guidance will come from some archived training classes. Go to the TI Wiki Pages and search for "C6416 workshop" without the quotes. Look through some of the search hits and do a page search in your browser for C6416 until you find the workshop material. We used to teach the C6000 Integration Workship around the C6416, so there will be some great examples and instruction material for you.

    Regards,
    RandyP

     

    If you need more help, please reply back. If this answers the question, please click  Verify Answer  , below.