Call back problem with Causeway DOS Extender

The intent of this forum is to discuss my DOS TSR programs (available at http://bretjohnson.us), how they work and don't work, new/missing features, status of updates, and anything else related to them that may need to be discussed.

Call back problem with Causeway DOS Extender

Postby branquinho » Fri Apr 01, 2011 5:40 am

Hy friends

I´m trying to read a USB Touch Screen on DOS. I wrote the code with the Turbo C++ 3.0 and it works very well, but when i try to do the same with the Open Watcom using the Causeway DOS Extender, the program crash when USBUHCIL try notify my program using the call back routine when i plug-off the USB cable. Follow what i did:

The following routine, works very well, and i get see the correct value on the statusDriver variable:

void Int14TestInstall(void)
{
union REGS regs; //CPU Registers
struct SREGS sregs;

regs.w.ax = I14AXInstallCheck; //AX = Function (Installation Check)
regs.w.bx = I14BXInput; //BX = Correct Value
regs.w.cx = I14CXInput; //CX = Correct Value
memset(&sregs,0,sizeof(sregs));

int386x(0x14,&regs,&regs,&sregs);
if ((regs.w.ax != 0x0000) || (regs.w.bx != I14CXInput) || (regs.w.cx != I14BXInput))
statusDriver=0; //Err
else
statusDriver=1; //Ok
}

Bellow, we can see the call back routine. For me is enough the variable to receive the value "1" (only for tests, of course):

void interrupt callBackRoutine(void) {
statusCallBack=1;
}

Bellow, is the code that realize the interface own registration:

struct Int14RequestStruc Int14Request;
struct Int14RequestStruc far *Int14RequestPtr;

Here, i allocated conventional memory (first mega) to the Int14RequestStruct:

memset(&sregs,0,sizeof(sregs));
regs.w.ax=0x0ff21;
regs.w.bx=0x0010;
int386x(0x31,&regs,&regs,&sregs);
segmentInt14Request=regs.w.ax;
selectorInt14Request=regs.w.dx;
Int14RequestPtr=(struct Int14RequestStruc far *)MK_FP(selectorInt14Request,0);

Now, i prepare the request:

Int14RequestPtr->I14RRequestType = I14RRTRegIntfOwner;
Int14RequestPtr->I14RHostIndex = 255; //Todos
Int14RequestPtr->I14RDeviceAddress = 0; //Novo
Int14RequestPtr->I14RVendorID = 0; //Nao importa o vendedor
Int14RequestPtr->I14RProductID = 0; //Nao importa o ID do produto
Int14RequestPtr->I14RDvcClass = 255; //Nao importa qual
Int14RequestPtr->I14RDvcSubClass = 255; //Nao importa
Int14RequestPtr->I14RDvcProtocol = 255; //Nao importa
Int14RequestPtr->I14RIntfClass = 255;
Int14RequestPtr->I14RIntfSubClass = 255;
Int14RequestPtr->I14RIntfProtocol = 255;
Int14RequestPtr->I14RCallBackAddrOff=(unsigned short) FP_OFF(callBackRotine);
Int14RequestPtr->I14RCallBackAddrSeg=(unsigned short) FP_SEG(callBackRotine);
Int14RequestPtr->I14RUserPktID = 88;

Now, i set-up a real-mode call. The call is correct, because if i put "zeros" on SEG and OFFSET of call back address, the API return the error 0x21 on statusRegistering variable:

struct rminfo rmi;

memset(&rmi,0,sizeof(rmi));
rmi.EAX=I14AXDoFunction;
rmi.EBX=I14BXInput;
rmi.ECX=I14CXInput;
rmi.DS=segmentInt14Request;
rmi.EDX=0;

regs.w.ax=0x0ff01;
regs.h.bl=0x14;
sregs.es=FP_SEG(&rmi);
regs.x.edi=FP_OFF(&rmi);
int386x(0x31,&regs,&regs,&sregs);
statusRegistering=rmi.EAX;

Every thing seens to work, but when i pull up the USB connector, the computer CRASH. I don´t know what can be anymore.

Could someone help me ?

Thanks a lot

Fernando Branquinho (from Brazil)
branquinho
 
Posts: 11
Joined: Fri Apr 01, 2011 5:13 am

Re: Call back problem with Causeway DOS Extender

Postby Bret » Tue Apr 05, 2011 8:10 am

Fernando:

I'm afraid I can't help you directly since I don't write for DOS extenders or DPMi or anything like that. Hopefully somebody with relevant experience can help you with this.
Bret
 
Posts: 478
Joined: Fri Oct 10, 2008 3:43 am
Location: Rio Rancho, NM

Re: Call back problem with Causeway DOS Extender

Postby branquinho » Mon Apr 25, 2011 8:08 am

Ok Bret. I understood. I did a real mode call back routine (with Turbo C++ for DOS) and get the data from my application. Works fine until now. Thank you very much.
branquinho
 
Posts: 11
Joined: Fri Apr 01, 2011 5:13 am


Return to Programs

Who is online

Users browsing this forum: No registered users and 1 guest

cron