DSPRelated.com
Forums

Sharc 21369 Interrupts problem

Started by get2...@hotmail.com August 25, 2007
Hello,
We are new to DSPs and have recently been required to use the Sharc processor. We've just spent some time trying to understand and get an interrupt signal working. Unfortunately we're quite confused as to how the code goes about looking up interrupts when they happen. Currently we need a very simple interrupt to occur: when a pin on the DPI goes high (rising edge), an interrupt is set. This has to be done within the sample UART talkthrough program (ASM).

We understand that the UART takes the DPI interrupt, as well as the P14I assignment (is the P14I assignment part of the PICR settings?). We want to know if it's possible to interrupt with the extra signal on a DPI pin (since the UART already seems to use the DPI as the interrupt, and we cannot use the DAI as we will be needing it in future). Also, is this done through the 4 elements of the IVT or through another interrupt label in the IVT?

We've written some code, and was wondering if you could correct this or tell us if we're going in the right direction:

//This is the part in the UART program which enables and sets up the UART interrupt.
//Enable Global Interrupts
bit set mode1 IRPTEN;

// Maps the UART0 receive interrupt to P14 using the programmable interrupt controller
ustat1 = dm(PICR2);
bit clr ustat1 MASKP14;
bit set ustat1 UART0Rx;
dm(PICR2) = ustat1;

bit set IMASK P14I; //Unmasks the UART Receive interrupt

ustat1 = UARTRBFIE;
dm(UART0IER) = ustat1; // Enables UART receive interrupt

//Here we add some code to try to set up a new interrupt signal
ustat1 = dm(PICR2);
bit clr ustat1 MASKBITS;
bit set ustat1 DPIINTERRUPT; //DPIINTERRUPT defined as (0x0E<<10)
dm(PICR2) = ustat1;

bit set IMASK P14I; //does this need to be P13I or another P label? Also, how is it routed to the IVT?

I'm assuming the DPI to EXT_MISC SRU line should be soemthing like this:
SRU2(DPI_P02_I, EXT_MISC_2)

And we set the DPI interrupt settings for rising edge:
bit set DPI_IRPTL_RE 0x1; //not sure of specifics but something similar to this

The IVT section should have something like this:

__DPII:
__P13I :

jump _signalisr;
jump (pc,0);
jump (pc,0);
jump (pc,0);
__DPII: // 0x64: DPI interrupt
__P14I :

jump _rxisr;
jump (pc,0);
jump (pc,0);
jump (pc,0);
Is the above code roughly correct or are we misunderstanding the interrupt functionality? We've gone through the manuals numerous times but it does not seem to bother explaining the link between the interrupt functions.

If anyone could give us a brief explanation of how something like this might be implemented, and something about how the chip handles the interrupts and the meaning of the labels, vector elements, etc, it would be hugely appreciated.

Thank you,

David