StuBS
IOPort Class Reference

Abstracts access to the I/O address space. More...

#include <machine/ioport.h>

Public Member Functions

 IOPort (uint16_t addr)
 Constructor.
 
void outb (uint8_t val) const
 Write one byte to the I/O port.
 
void outw (uint16_t val) const
 Write one word (2 bytes) to the I/O port.
 
uint8_t inb () const
 Read one byte from the I/O port.
 
uint16_t inw () const
 Read one word (2 bytes) from the I/O port.
 

Private Attributes

uint16_t address
 Address in I/O address space.
 

Detailed Description

Abstracts access to the I/O address space.

x86 PCs have a separated I/O address space that is accessible only via the machine instructions in and out. An IOPort object encapsulates the corresponding address in the I/O address space and can be used for byte or word-wise reading or writing.

Constructor & Destructor Documentation

◆ IOPort()

IOPort::IOPort ( uint16_t  addr)
inlineexplicit

Constructor.

Parameters
addrAddress from the I/O address space

Member Function Documentation

◆ outb()

void IOPort::outb ( uint8_t  val) const
inline

Write one byte to the I/O port.

Parameters
valThe value to be written

◆ outw()

void IOPort::outw ( uint16_t  val) const
inline

Write one word (2 bytes) to the I/O port.

Parameters
valThe value to be written

◆ inb()

uint8_t IOPort::inb ( ) const
inline

Read one byte from the I/O port.

Returns
Read byte

◆ inw()

uint16_t IOPort::inw ( ) const
inline

Read one word (2 bytes) from the I/O port.

Returns
Read word (2 bytes)

Member Data Documentation

◆ address

uint16_t IOPort::address
private

Address in I/O address space.


The documentation for this class was generated from the following file: