Hey Folks,
I'm working on an interrupt service routine for the I2C modules on the OMAP L138. I2C module is accessed from the DSP.
In an attempt to not repeat code, I wrote the ISR to check for the specific I2C module that caused the interrupt and to take action accordingly. The snippet of code below shows the source of the interrupt is detected.
I2C_ISR {
unsigned int intCode = 0;
unsigned int sysIntNum = 0;
unsigned int i2c_evt_reg, i2c_interruptor;
i2c_evt_reg = (SOC_INTC_0_REGS + DSPINTC_EVTFLAG(1));
i2c_interruptor = HWREG(i2c_evt_reg);
if (i2c_interruptor & DSPINTC_EVTFLG_EF(SYS_INT_I2C0_INT))
{
sysIntNum = SYS_INT_I2C0_INT;
i2c_base = SOC_I2C_0_REGS;
}
else if (i2c_interruptor & DSPINTC_EVTFLG_EF(SYS_INT_I2C1_INT))
{
sysIntNum = SYS_INT_I2C1_INT;
i2c_base = SOC_I2C_1_REGS;
}
...code to process the interrupt
}
I noticed that Starterware does not define a function to read the sources of an interrupt.
Is there a specific reason this is not included? I do see that there is no use for this if every ISR was tied to a single interrupt. Please let me know if you have any suggestions on better ways to implement this.