The basic story is that I have a PC104 board interfacing with a single board computer. The board is configured to a test state where I can toggle ISA interrupt lines at will through an IO port. The IRQs the board is wired up to are 4, 6, 9, 11, 14, 15. As far as I can tell, 6, 9, 11, and 14 should be free on the single board computer. So far i have had no luck in getting an interrupt to respont properly. Below is the code I’m using to excersize the board and interrupts. Any help is greatly appreciated.
-Nick
UINT8 interruptHandledFlag;
const struct sigevent* intHandler(void *arg, int id)
{
(UINT8)arg = 1;
switch(id)
{
case 4:
{
out16(0x0182, ~0x0001);
break;
}
case 6:
{
out16(0x0182, ~0x0002);
break;
}
case 9:
{
out16(0x0182, ~0x0004);
break;
}
case 11:
{
out16(0x0182, ~0x0008);
break;
}
case 14:
{
out16(0x0182, ~0x0010);
break;
}
case 15:
{
out16(0x0182, ~0x0020);
break;
}
}
return NULL;
}
int runAnInterrupt(DSP_CLASS* DSP, int num, UINT32 dspStuff)
{
int retVal = PASS;
int intId;
int maskCount;
int timeoutcount = 0;
interruptHandledFlag = 0;
intId = InterruptAttach(num, intHandler, &interruptHandledFlag, sizeof(UINT8), 0);
InterruptEnable();
maskCount = InterruptUnmask(num, intId);
printf("interrupt %d mask count: %d\n", num, maskCount);
for(int s = 0; s < 10; s++)
{
//DSP->WriteData(DSP->EPLDControlReg2, clearInterruptsOnTheDsp | dspIRQ6);
DSP->WriteData(DSP->EPLDControlReg2, dspStuff);
int count = 0;
while(!interruptHandledFlag)
{
usleep(500);
count++;
if(count > 2000);
{
timeoutcount++;
DSP->WriteData(DSP->EPLDControlReg2, ~dspStuff);
retVal = FAIL;
break;
}
}
DSP->WriteData(DSP->EPLDControlReg2, ~dspStuff);
}
InterruptDetach(intId);
char printfStuffs[300];
sprintf(printfStuffs, "time out IRQ %d x %d", num, timeoutcount);
td_out(printfStuffs, VB_ERROR_ONLY);
return retVal;
}
static int intIsaTest (DSP_CLASS* DSP)
{
const UINT32 dspIRQ4 = 0x0001;
const UINT32 dspIRQ6 = 0x0002;
const UINT32 dspIRQ9 = 0x0004;
const UINT32 dspIRQ11 = 0x0008;
const UINT32 dspIRQ14 = 0x0010;
const UINT32 dspIRQ15 = 0x0020;
interruptHandledFlag = 0;
ThreadCtl(_NTO_TCTL_IO, 0);
// clear interrupts so that they can be transitioned high
DSP->WriteData(DSP->EPLDControlReg2, ~(dspIRQ4 | dspIRQ6 | dspIRQ9 | dspIRQ11 | dspIRQ14 | dspIRQ15));
sleep(1);
runAnInterrupt(DSP, 4, dspIRQ4);
runAnInterrupt(DSP, 6, dspIRQ6);
runAnInterrupt(DSP, 9, dspIRQ9);
runAnInterrupt(DSP, 11, dspIRQ11);
runAnInterrupt(DSP, 14, dspIRQ14);
runAnInterrupt(DSP, 15, dspIRQ15);
// set all interrupts high / tristate
DSP->WriteData(DSP->EPLDControlReg2, 0xffff);
return PASS;
}