The Pedigree Project 0.1
Public Member Functions | Private Member Functions | Private Attributes | List of all members
IoPort Class Reference

I/O port range. More...

#include <IoPort.h>

+ Inheritance diagram for IoPort:
+ Collaboration diagram for IoPort:

Public Member Functions

 IoPort (const char *name)
 
virtual ~IoPort ()
 
virtual size_t size () const
 
virtual uint8_t read8 (size_t offset=0)
 
virtual uint16_t read16 (size_t offset=0)
 
virtual uint32_t read32 (size_t offset=0)
 
virtual uint64_t read64 (size_t offset=0)
 
virtual void write8 (uint8_t value, size_t offset=0)
 
virtual void write16 (uint16_t value, size_t offset=0)
 
virtual void write32 (uint32_t value, size_t offset=0)
 
virtual void write64 (uint64_t value, size_t offset=0)
 
virtual operator bool () const
 
io_port_t base () const
 
const char * name () const
 
void free ()
 
bool allocate (io_port_t ioPort, size_t size)
 
- Public Member Functions inherited from IoBase
virtual ~IoBase ()
 
uint64_t read64LowFirst (size_t offset=0)
 
uint64_t read64HighFirst (size_t offset=0)
 
void write64LowFirst (uint64_t value, size_t offset=0)
 
void write64HighFirst (uint64_t value, size_t offset=0)
 

Private Member Functions

 IoPort (const IoPort &)
 
IoPort & operator= (const IoPort &)
 

Private Attributes

io_port_t m_IoPort
 
size_t m_Size
 
const char * m_Name
 

Additional Inherited Members

- Protected Member Functions inherited from IoBase
 IoBase ()
 

Detailed Description

I/O port range.

IoPort provides access to a range of hardware I/O port

Definition at line 33 of file IoPort.h.

Constructor & Destructor Documentation

◆ IoPort() [1/2]

IoPort::IoPort ( const char *  name)

The default constructor does nothing

Definition at line 23 of file IoPort.cc.

◆ ~IoPort()

IoPort::~IoPort ( )
virtual

The destructor frees the allocated ressources

Definition at line 25 of file IoPort.cc.

References free().

◆ IoPort() [2/2]

IoPort::IoPort ( const IoPort &  )
private

The copy-constructor

Note
NOT implemented

Member Function Documentation

◆ allocate()

bool IoPort::allocate ( io_port_t  ioPort,
size_t  size 
)

Allocate an I/O port range

Parameters
[in]ioPortthe base I/O port
[in]sizethe number of successive I/O ports - 1
Returns
true, if successfull, false otherwise

Definition at line 29 of file IoPort.cc.

References allocate(), free(), IoPortManager::instance(), m_IoPort, m_Size, and size().

Referenced by Device::Address::Address(), allocate(), Pic::initialise(), Pit::initialise(), Rtc::initialise1(), PciAtaController::PciAtaController(), and X86Serial::setBase().

+ Here is the caller graph for this function:

◆ base()

io_port_t IoPort::base ( ) const

Get the base I/O port

Definition at line 55 of file IoPort.cc.

References m_IoPort.

Referenced by IoPortManager::free().

+ Here is the caller graph for this function:

◆ free()

void IoPort::free ( )

Free an I/O port range

Definition at line 42 of file IoPort.cc.

References IoPortManager::free(), IoPortManager::instance(), m_IoPort, and m_Size.

Referenced by allocate(), Pit::uninitialise(), Rtc::uninitialise(), and ~IoPort().

+ Here is the caller graph for this function:

◆ name()

const char * IoPort::name ( ) const

Get the name of the I/O port range

Returns
pointer to the name of the I/O port range

Definition at line 63 of file IoPort.cc.

References m_Name.

◆ operator bool()

IoPort::operator bool ( ) const
virtual

Check whether this class is usable

Returns
true, if the class holds a ressource that is correctly allocated and usable

Implements IoBase.

Definition at line 59 of file IoPort.cc.

◆ operator=()

IoPort & IoPort::operator= ( const IoPort &  )
private

The assignment operator

Note
NOT implemented

◆ read16()

uint16_t IoPort::read16 ( size_t  offset = 0)
virtual

Read two byte (16bit) from the I/O Port or the memory-mapped I/O region

Parameters
[in]offsetoffset from the I/O base port or the I/O base memory address
Returns
the two byte (16bit) that have been read

Implements IoBase.

Definition at line 34 of file x86_common/IoPort.cc.

References m_IoPort, m_Size, and panic().

◆ read32()

uint32_t IoPort::read32 ( size_t  offset = 0)
virtual

Read four byte (32bit) from the I/O Port or the memory-mapped I/O region

Parameters
[in]offsetoffset from the I/O base port or the I/O base memory address
Returns
the four byte (32bit) that have been read

Implements IoBase.

Definition at line 44 of file x86_common/IoPort.cc.

References m_IoPort, m_Size, and panic().

◆ read64()

uint64_t IoPort::read64 ( size_t  offset = 0)
virtual

Read eight byte (64bit) from the I/O Port or the memory-mapped I/O region.

Parameters
[in]offsetoffset from the I/O base port or the I/O base memory address
Returns
the eight byte (64bit) that have been read

Implements IoBase.

Definition at line 55 of file x86_common/IoPort.cc.

References ProcessorBase::halt().

◆ read8()

uint8_t IoPort::read8 ( size_t  offset = 0)
virtual

Read a byte (8bit) from the I/O Port or the memory-mapped I/O region

Parameters
[in]offsetoffset from the I/O base port or the I/O base memory address
Returns
the byte (8bit) that have been read

Implements IoBase.

Definition at line 24 of file x86_common/IoPort.cc.

References m_IoPort, m_Size, and panic().

Referenced by Pic::reservePciRoute(), X86Serial::setBase(), Rtc::setIndexLocked(), Pic::spuriousLocked(), and Rtc::waitForUpdateCompletion().

+ Here is the caller graph for this function:

◆ size()

size_t IoPort::size ( ) const
virtual

Get the size of the I/O region in bytes

Implements IoBase.

Definition at line 51 of file IoPort.cc.

References m_Size.

Referenced by allocate(), and IoPortManager::free().

+ Here is the caller graph for this function:

◆ write16()

void IoPort::write16 ( uint16_t  value,
size_t  offset = 0 
)
virtual

Write two byte (16bit) to the I/O port or the memory-mapped I/O region

Parameters
[in]valuethe value that should be written
[in]offsetoffset from the I/O base port or the I/O base memory address

Implements IoBase.

Definition at line 68 of file x86_common/IoPort.cc.

References m_IoPort, m_Size, and panic().

◆ write32()

void IoPort::write32 ( uint32_t  value,
size_t  offset = 0 
)
virtual

Write four byte (32bit) to the I/O port or the memory-mapped I/O region

Parameters
[in]valuethe value that should be written
[in]offsetoffset from the I/O base port or the I/O base memory address

Implements IoBase.

Definition at line 76 of file x86_common/IoPort.cc.

References m_IoPort, m_Size, and panic().

◆ write64()

void IoPort::write64 ( uint64_t  value,
size_t  offset = 0 
)
virtual

Write eight byte (64bit) to the I/O Port or the memory-mapped I/O region.

Parameters
[in]valuethe value that should be written
[in]offsetoffset from the I/O base port or the I/O base memory address

Implements IoBase.

Definition at line 85 of file x86_common/IoPort.cc.

References ProcessorBase::halt().

◆ write8()

void IoPort::write8 ( uint8_t  value,
size_t  offset = 0 
)
virtual

Write a byte (8bit) to the I/O port or the memory-mapped I/O region

Parameters
[in]valuethe value that should be written
[in]offsetoffset from the I/O base port or the I/O base memory address

Implements IoBase.

Definition at line 60 of file x86_common/IoPort.cc.

References m_IoPort, m_Size, and panic().

Referenced by Pic::initialise(), Pit::initialise(), X86IsaDma::initTransfer(), Pic::interrupt(), PciAtaController::PciAtaController(), X86Serial::setBase(), Rtc::setIndexLocked(), and Pic::spuriousLocked().

+ Here is the caller graph for this function:

Member Data Documentation

◆ m_IoPort

io_port_t IoPort::m_IoPort
private

The base I/O port

Definition at line 80 of file IoPort.h.

Referenced by allocate(), base(), free(), read16(), read32(), read8(), write16(), write32(), and write8().

◆ m_Name

const char* IoPort::m_Name
private

User-visible name of this I/O port range

Definition at line 84 of file IoPort.h.

Referenced by name().

◆ m_Size

size_t IoPort::m_Size
private

The number of successive I/O ports - 1

Definition at line 82 of file IoPort.h.

Referenced by allocate(), free(), read16(), read32(), read8(), size(), write16(), write32(), and write8().


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