Reading the manual it says on Table 17-3
"Configure pin M3. If this pin is programmed to function as INT6, it is not available as a GPIO."
and later
"INT6 is always available on pin M3. It can be enabled by programming the appropriate bits in interrupt
control register 4, see Section 7.2.2.4, “Interrupt Control Register 4 (ICR4), and the programmable
interrupt transition register described in Section 7.2.4, “Programmable Interrupt Transition Register
(PITR)."
So I think I'm doing all this but I can't get an interrupt. I'm wondering if since INT6 is on a pin that's shared if there is something special I need to do for INT6 that I don't have to do for the other interrupts.
Also I've always been unclear on the hex value passed to the interrupt routine, I thought 0x21 represent priority 1, through 0x26 for priority 6. Are there rules on these values and how you set up other things in the interrupt?
Here are snippets of the code I'm using for INT6 - these were cut and pasted from various places.
Code: Select all
//CONSTANTS FOR IRQ6
const unsigned long RISING_EDGE_BIT_INT6 = 0x00000020L; //Bit 5 of 31
//IRQ 6 is on icr4 and it is one BYTE down from the msb. make it level 6 by writing 1110 (0E)
const unsigned long DISABLE_IRQ6 = 0x00800000L;
const unsigned long ENABLE_IRQ6 = 0x00E00000L; // put irq 6 at priority 6 (write 1110 in the correct nibble)
const unsigned long IRQ6_MASK = 0x00F00000L;
const int IRQ6_OFFSET = 91;
INTERRUPT(ext_trig_isr, 0x2600 )
{
Interrupts::DisableInterrupt6();
OSSemPost(&Interrupts::m_pendExtTrig);
}
void Interrupts::Init()
{
...
OSSemInit(&m_pendExtTrig, 0);
vector_base.table[IRQ6_OFFSET] = reinterpret_cast<unsigned long>(ext_trig_isr);
SetExtTrigEdge(extTrigIsRising);
EnableInterrupt6();
...
}
void Interrupts::EnableInterrupt6()
{
sim.icr4 = ((sim.icr4 & ~IRQ6_MASK) | ENABLE_IRQ6);
}
void Interrupts::SetExtTrigEdge(bool isRising)
{
if (isRising) sim.pitr |= RISING_EDGE_BIT_INT6;
else sim.pitr &= (~RISING_EDGE_BIT_INT6);
}