INW(K) UNIX System V INW(K)
Name
inw, outw - reads, writes a 16-bit word from or to a
physical I/O address
Syntax
int
inw(read_addr)
int read_addr;
int
outw (write_addr, value)
int write_addr, value;
Description
The inw function reads a 16-bit word from the physical I/O
address specified by read_addr. outw writes a 16-bit word
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 inw or outw. Refer to the
flushtlb manual page for more information.
Parameters
read_addr is an integer that specifies the physical I/O
address to be read from.
write_addr is the physical I/O address being written to.
value is the 16-bit word bring written to write_addr.
Return
A 32-bit integer whose high 2 bytes are set to zero is
returned by inw. outw has no return value.
Example
To read a 16-bit register at I/O address 0x300 you could use
the following lines of code:
short int val;
val = (short int) inw(0x300);
To write the 16-bit value 0xFF0 to I/O address 0x300 you
could use the following code:
outw(0x300, 0xFF0);
See Also
flushtlb(K), inb(K), ind(K), repinsb(K), copyin(K)
(printed 7/19/89)