Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Interrupts

Status
Not open for further replies.

elfanddot

Programmer
Feb 21, 2002
28
US
Im having trouble w/ interupts. X-)
I got the code off the web and am modifying it.
here is the code im having trouble w/

struct Ssoundcard card
{
int intcount,autoinit,...
void (interrupt far *oldintvector)(void);
void (interrupt far *inthandler)();//
//**********inthandler wasn't declaired in original code
}

static void interrupt inthandler(Ssoundcard card)
{
card.intcount++;

if (!card.autoinit)/* Start next block first if not using auto-init DMA */
{
startblocksc(card);
copydata(card);
setcurblock(card,!card.curblock); /* Toggle block */
}

updatevoices(card);
mixvoices(card);

if (card.autoinit)
{
copydata(card);
setcurblock(card,!card.curblock);/* Toggle block */
}

inp(card.ackport);//Acknowled interrupt with sound card
outp(0xA0, 0x20);//Acknowledg interrupt with PIC2
outp(0x20, 0x20);//Acknowledg interrupt with PIC1
}

static void installhandler(Ssoundcard card)
{
disable();
outp(card.picmaskport, (inp(card.picmaskport) | card.irqstopmask));

1*:->* card.oldintvector = _dos_getvect(card.irqintvector);
2*:->* _dos_setvect(card.irqintvector, inthandler);

outp(card.picmaskport, (inp(card.picmaskport) & card.irqstartmask));
enable();

card.handlerinstalled = TRUE;
}

static void uninstallhandler(Ssoundcard card)
{
disable();
outp(card.picmaskport, (inp(card.picmaskport) | card.irqstopmask));

3*:->* _dos_setvect(card.irqintvector, card.oldintvector);

enable();

card.handlerinstalled = FALSE;
}


im using borlandc v3.1 and the error messages im recieving
are
1*:->* cannot convert 'void (interrupt far*)(...)' to 'void (interrupt far*)()'
1*:->* cannot convert 'void (interrupt far*)(Ssoundcard)' to 'void (interrupt far*)(...)'
2*:->* type mismatch in parameter '__isr' in call to '_dos_setvect(unsigned int, void (interrupt far*)(...)'
3*:->* cannot convert 'void (interrupt far*)() to void (interrupt far*)(...)'
3*:->* type mismatch in parameter '__isr' in call to '_dos_setvect(unsigned int, void (interrupt far*)(...)'

the original code was writen in C and im compiling in C++.
i understand what the error messages mean yet i don't understand interupt coding very much
any help would be very apprecitated.
 
When you added the declaration:
void (interrupt far *inthandler)();//

You told the compiler that the callback shouldn't
have any arguements. Actually, old C lets you use ()
for "whatever". C++ however doesn't. You'll have to
match parameters in the declaration with reality.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top