INB(K) UNIX System V INB(K)
Name
inb, outb - reads a byte from or writes a byte to an I/O
address
Syntax
int
inb(read_addr)
int read_addr;
int
outb(write_addr, value)
int write_addr;
char value;
Description
The inb routine reads a byte from the I/O address specified
by the parameter read_addr.
The outb routine writes the byte specified by value to the
physical I/O address specified by write_addr.
Warning
If the specified read or write address is above 0x1000, call
flushtlb(K) before calling inb or outb. Refer to the
flushtlb manual page for more information.
Parameters
The value of read_addr is an integer specifying the physical
I/O address from which to read.
write_addr is an integer specifying the physical I/O address
to which to write.
value is a byte to write to write_addr.
Return
inb returns a byte. physical I/O address specified by
read_addr is returned. inb returns an integer whose high
byte or bytes have been cleared. Only the low byte is
meaningful.
Example
To read a byte register at I/O address 0x300 you could use
the following lines of code:
char val;
val = (char) inb(0x300);
To write the 8-bit value 0xF to a byte register at I/O
address 0x300 you could use the following line of code:
outb(0x300, 0xF);
See Also
flushtlb(K), ind(K), inw(K), repinsb(K), copyin(K)
(printed 7/19/89)