delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/07/25/02:18:16

Date: Thu, 25 Jul 1996 09:13:33 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: Brent Morgan <bmorgan AT sdcc3 DOT ucsd DOT edu>
Cc: djgpp AT delorie DOT com
Subject: Re: to inportb() or not?
In-Reply-To: <4t5n5u$8si@sdcc12.ucsd.edu>
Message-Id: <Pine.SUN.3.91.960725090518.16044M-100000@is>
Mime-Version: 1.0

On 24 Jul 1996, Brent Morgan wrote:

> I'm writing a device driver for a multipurpose I/O card (RTI815) and
> I've been using inportb() and outportb() to write to the card (it's an
> 8-bit card).  So far it's worked fine, but having just read the FAQ, I
> didn't see anything mentioned about these calls.  The FAQ instead
> mentioned breaking the memory mapped address space of the card into
> segmet+offset and calling a different routine (the name of which I do
> not remember).  Why is my method working?  Should I use the alternate
> routines mentioned in the FAQ?

These are two entirely different methods of communicating with the 
peripheral devices, they are by no means exchangeable!  `inportb' and 
`outportb' read and write the I/O ports, whereas accessing peripherals 
via far pointers only works with memory-mapped devices, which map their 
on-board buffers into the PC address space.  The I/O ports are a totally 
different address space on the PC, which cannot be accessed with a memory 
pointer.

From the machine instructions point of view, memory is accessed with 
instructions such as MOV, MOVSW, STOSB, LODSW etc., while I/O ports are 
accessed with IN, OUT, INSD, OUTSW etc.

The FAQ doesn't discuss port I/O functions because there is nothing here
that's DJGPP-specific, the same functions exist in any other DOS-based C
compiler. 

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019