🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: comp.os.os2.programmer
4 messages
4 total messages Started by Antti Kirmanen Tue, 09 Apr 1991 15:19
OS/2 device drivers
#2522
Author: Antti Kirmanen
Date: Tue, 09 Apr 1991 15:19
18 lines
1104 bytes
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....

Please e-mail: cale@kannel.lut.fi

-- 
       __________________________________________________
       : Antti Kirmanen    internet: cale@kannel.lut.fi :
       : Laserkatu  2 E 7  53850 LPR      tel 953-20079 : 
       --------------------------------------------------
Re: OS/2 device drivers
#2529
Author: Kirt Alan Winter
Date: Wed, 10 Apr 1991 21:11
32 lines
1847 bytes
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
------------------------------------------------------------------------------
Re: OS/2 device drivers
#2535
Author: Peter Forsberg
Date: Thu, 11 Apr 1991 21:24
26 lines
1942 bytes
In article <1991Apr10.211127.13982@hpmcaa.mcm.hp.com> winter@hpmcaa.mcm.hp.com (Kirt Alan Winter) writes:
   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....

The reason that you should use the DosPortAccess() API is *portability*.
In OS/2 2.0 32-bit programs neither IOPL-segments, nor the C-functions
inp() or outp() will be supported. This is because this is very hardware-
specific stuff, and will be hard to support in (possible) future versions
of OS/2 on hardware platforms other than the i[34]86 ("New Technology").
Just for your info...

/ Peter Forsberg  (RIT & IBM Sweden)
--
_______________________________________________________________________________
Peter Forsberg 		      Royal Institute of Technology, Stockholm, Sweden.
Internet: d88-pfo@nada.kth.se
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Re: OS/2 device drivers
#2537
Author: Jan Mikkelsen
Date: Sat, 13 Apr 1991 15:53
18 lines
1169 bytes
In article <1991Apr09.151935.19325@lut.fi> 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
>

You need to do a "#pragma intrinsic" for inp() and outp() in your source
code.  It has been some time since I did a device driver for OS/2, but
I believe this will solve your problem.

-- 
Jan Mikkelsen
janm@dramba.neis.oz.AU or janm%dramba.neis.oz@metro.ucc.su.oz.au
"She really is."
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads