Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!wuarchive!sdd.hp.com!hp-pcd!hpmcaa!winter From: winter@hpmcaa.mcm.hp.com (Kirt Alan Winter) Newsgroups: comp.os.os2.programmer Subject: Re: OS/2 device drivers Message-ID: <1991Apr10.211127.13982@hpmcaa.mcm.hp.com> Date: 10 Apr 91 21:11:27 GMT References: <1991Apr09.151935.19325@lut.fi> Organization: HP Cardiology Business Unit - McMinnville, OR Lines: 32 cale@lut.fi (Antti Kirmanen) writes: > > I'm currently trying to write a device driver for OS/2. > My problem is, that I should use inp and outp functions to > communicate with a port. OS/2 programmers reference manual > says, that I should use DosPortAccess() function call but then ... > Program crashes allways in the first outp() or inp() call. > I'm using Microsoft C 6.0 with OS/2 1.1 > > Can anyone help me. A simple example would be great. > Thanks in advance.... Well, I just faced the same problem (though not inside a device driver), so I can perhaps shed a little light on the problem. The routines that do port I/O must execute at the IOPL (sorry if my OS/2 terminology is a bit sloppy, I'm new at this). Near as I can tell, it is useless to put the outp and inp calls in the library, as they will not work. I ended up writing my own inp and outp in assembly, so I could declare them as IOPL in the module definition file. For a better explanation, refer to Ray Duncan's _Advanced OS/2 Programming_, chapter 14. Kirt ------------------------------------------------------------------------------ Kirt Alan Winter winter@hpmcaa.mcm.hp.com Hewlett Packard - Cardiology Business Unit (503) 472-5101 x371 McMinnville, Oregon ------------------------------------------------------------------------------