Class IO_Port

Class IO_Port

Placement in the overall structure

Module
machine
Base classes
None
Derived classes
None
Time of creation
Specification of Task 1
Files
io_port.h io_port.asm

Description

This class allows accesses to x86's I/O address space. This special address space can only be accessed with the machine instructions 'in' and 'out'. An IO_Port object is bound to a specific I/O address (called "port") at instantiation time and can then be used for byte- or word-wise input or output operations.

Public methods

IO_Port (int addr)
The parameter of the constructor specifies the port address to be accessed by this IO_Port object.
void outb (int val)
Writes the least significant byte of the parameter val to the port.
void outw (int val)
Writes one word (the two least significant bytes) of the val parameter to the port.
int inb ()
Reads a byte from the port.
int inw ()
Reads a word from the port.