FreeNOS
Public Member Functions | Private Attributes
IntelIO Class Reference

Intel I/O functions. More...

#include <IntelIO.h>

Inheritance diagram for IntelIO:
IO

Public Member Functions

 IntelIO ()
 Constructor. More...
 
void setPortBase (const u16 base)
 Set port I/O base address. More...
 
u8 inb (u16 port) const
 Read a byte from a port. More...
 
u16 inw (u16 port) const
 Read a word from a port. More...
 
void outb (u16 port, u8 byte)
 Output a byte to a port. More...
 
void outw (u16 port, u16 word)
 Output a word to a port. More...
 
void outl (u16 port, u32 l)
 Output a long to a I/O port. More...
 
u32 read (const Address addr) const
 Read memory mapped register. More...
 
void read (Address addr, Size count, void *buf) const
 Read a number of 32-bit values. More...
 
void write (const Address addr, const u32 data)
 Write memory mapped register. More...
 
void write (Address addr, Size count, const void *buf)
 Write a number of 32-bit values. More...
 
void set (Address addr, u32 data)
 Set bits in memory mapped register. More...
 
void unset (Address addr, u32 data)
 Unset bits in memory mapped register. More...
 
- Public Member Functions inherited from IO
 IO ()
 Constructor. More...
 
Address getBase () const
 Get memory I/O base offset. More...
 
void setBase (const Address base)
 Set memory I/O base offset. More...
 
Result map (Address phys, Size size=4096, Memory::Access access=Memory::Readable|Memory::Writable|Memory::User)
 Map I/O address space. More...
 
Result unmap ()
 Unmap I/O address space. More...
 

Private Attributes

u16 m_portBase
 Port I/O base address. More...
 

Additional Inherited Members

- Public Types inherited from IO
enum  Result { Success, MapFailure, OutOfMemory }
 Result codes. More...
 
- Protected Attributes inherited from IO
Address m_base
 memory I/O base offset is added to each I/O address. More...
 
Memory::Range m_range
 Memory range for performing I/O mappings. More...
 

Detailed Description

Intel I/O functions.

Definition at line 38 of file IntelIO.h.

Constructor & Destructor Documentation

◆ IntelIO()

IntelIO::IntelIO ( )
inline

Constructor.

Definition at line 45 of file IntelIO.h.

Member Function Documentation

◆ inb()

u8 IntelIO::inb ( u16  port) const
inline

Read a byte from a port.

Parameters
portThe I/O port to read from.
Returns
A byte read from the port.

Definition at line 68 of file IntelIO.h.

References m_portBase.

Referenced by IntelPIC::disable(), IntelPIC::enable(), and IntelPIT::getCounter().

◆ inw()

u16 IntelIO::inw ( u16  port) const
inline

Read a word from a port.

Parameters
portThe I/O port to read from.
Returns
Word read from the port.

Definition at line 83 of file IntelIO.h.

References m_portBase.

◆ outb()

void IntelIO::outb ( u16  port,
u8  byte 
)
inline

Output a byte to a port.

Parameters
portPort to write to.
byteThe byte to output.

Definition at line 97 of file IntelIO.h.

References m_portBase.

Referenced by IntelPIC::clear(), IntelPIC::disable(), IntelPIC::enable(), IntelPIC::initialize(), IntelPIT::setControl(), and IntelPIT::setFrequency().

◆ outl()

void IntelIO::outl ( u16  port,
u32  l 
)
inline

Output a long to a I/O port.

Parameters
portTarget I/O port.
lThe long 32-bit number to output.

Definition at line 121 of file IntelIO.h.

References m_portBase.

◆ outw()

void IntelIO::outw ( u16  port,
u16  word 
)
inline

Output a word to a port.

Parameters
portPort to write to.
wordThe word to output.

Definition at line 109 of file IntelIO.h.

References m_portBase.

◆ read() [1/2]

void IntelIO::read ( Address  addr,
Size  count,
void *  buf 
) const
inline

Read a number of 32-bit values.

Parameters
addrAddress of the starting 32-bit value.
countNumber of bytes to read.
bufOutput buffer.

Definition at line 147 of file IntelIO.h.

References read().

◆ read() [2/2]

u32 IntelIO::read ( const Address  addr) const
inline

Read memory mapped register.

Parameters
addrAddress of the register to read.
Returns
32-bit value of the register.

Definition at line 134 of file IntelIO.h.

References IO::m_base.

Referenced by IntelAPIC::getCounter(), read(), IntelAPIC::sendIPI(), IntelAPIC::sendStartupIPI(), set(), IntelAPIC::start(), unset(), and IntelAPIC::wait().

◆ set()

void IntelIO::set ( Address  addr,
u32  data 
)
inline

Set bits in memory mapped register.

Parameters
addrAddress of the register to write.
data32-bit value containing the bits to set (bitwise or).

Definition at line 188 of file IntelIO.h.

References read(), and write().

Referenced by IntelAPIC::initialize().

◆ setPortBase()

void IntelIO::setPortBase ( const u16  base)
inline

Set port I/O base address.

Parameters
baseNew I/O base address.

Definition at line 56 of file IntelIO.h.

References m_portBase.

Referenced by IntelPIC::IntelPIC().

◆ unset()

void IntelIO::unset ( Address  addr,
u32  data 
)
inline

Unset bits in memory mapped register.

Parameters
addrAddress of the register to write.
data32-bit value containing the bits to set (bitwise or).

Definition at line 201 of file IntelIO.h.

References read(), and write().

◆ write() [1/2]

void IntelIO::write ( Address  addr,
Size  count,
const void *  buf 
)
inline

Write a number of 32-bit values.

Parameters
addrAddress of the starting 32-bit value.
countNumber of bytes to write.
bufInput buffer.

Definition at line 174 of file IntelIO.h.

References write().

◆ write() [2/2]

void IntelIO::write ( const Address  addr,
const u32  data 
)
inline

Write memory mapped register.

Parameters
addrAddress of the register to write.
data32-bit value to write in the register.

Definition at line 161 of file IntelIO.h.

References IO::m_base.

Referenced by IntelAPIC::clear(), IntelAPIC::initialize(), IntelAPIC::sendIPI(), IntelAPIC::sendStartupIPI(), set(), IntelAPIC::start(), IntelAPIC::stop(), unset(), and write().

Field Documentation

◆ m_portBase

u16 IntelIO::m_portBase
private

Port I/O base address.

Definition at line 211 of file IntelIO.h.

Referenced by inb(), inw(), outb(), outl(), outw(), and setPortBase().


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