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 &)
 
IoPortoperator= (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 34 of file IoPort.h.

Constructor & Destructor Documentation

IoPort::IoPort ( const char *  name)

The default constructor does nothing

Definition at line 25 of file IoPort.cc.

IoPort::~IoPort ( )
virtual

The destructor frees the allocated ressources

Definition at line 29 of file IoPort.cc.

References free().

IoPort::IoPort ( const IoPort )
private

The copy-constructor

Note
NOT implemented

Member Function Documentation

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 34 of file IoPort.cc.

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

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

+ Here is the caller graph for this function:

io_port_t IoPort::base ( ) const

Get the base I/O port

Definition at line 65 of file IoPort.cc.

References m_IoPort.

Referenced by IoPortManager::free().

+ Here is the caller graph for this function:

void IoPort::free ( )

Free an I/O port range

Definition at line 49 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:

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 75 of file IoPort.cc.

References m_Name.

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 70 of file IoPort.cc.

References m_Size.

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

The assignment operator

Note
NOT implemented
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 Processor::halt(), m_IoPort, and m_Size.

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 45 of file x86_common/IoPort.cc.

References Processor::halt(), m_IoPort, and m_Size.

Referenced by PciBus::initialise(), and PciBus::readConfigSpace().

+ Here is the caller graph for this function:

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 57 of file x86_common/IoPort.cc.

References Processor::halt().

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 23 of file x86_common/IoPort.cc.

References Processor::halt(), m_IoPort, and m_Size.

Referenced by Rtc::enableRtcUpdates(), Pic::interrupt(), Rtc::read(), Rtc::setIndex(), Pic::spurious(), and Rtc::waitForUpdateCompletion().

+ Here is the caller graph for this function:

size_t IoPort::size ( ) const
virtual

Get the size of the I/O region in bytes

Implements IoBase.

Definition at line 60 of file IoPort.cc.

References m_Size.

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

+ Here is the caller graph for this function:

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 72 of file x86_common/IoPort.cc.

References Processor::halt(), m_IoPort, and m_Size.

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 81 of file x86_common/IoPort.cc.

References Processor::halt(), m_IoPort, and m_Size.

Referenced by PciBus::initialise(), PciBus::readConfigSpace(), and PciBus::writeConfigSpace().

+ Here is the caller graph for this function:

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 91 of file x86_common/IoPort.cc.

References Processor::halt().

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 63 of file x86_common/IoPort.cc.

References Processor::halt(), m_IoPort, and m_Size.

Referenced by Rtc::enableRtcUpdates(), Pit::initialise(), Pic::initialise(), X86IsaDma::initTransfer(), Pic::interrupt(), PciAtaController::PciAtaController(), Rtc::setIndex(), Pic::spurious(), and Rtc::write().

+ Here is the caller graph for this function:

Member Data Documentation

io_port_t IoPort::m_IoPort
private

The base I/O port

Definition at line 82 of file IoPort.h.

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

const char* IoPort::m_Name
private

User-visible name of this I/O port range

Definition at line 86 of file IoPort.h.

Referenced by name().

size_t IoPort::m_Size
private

The number of successive I/O ports - 1

Definition at line 84 of file IoPort.h.

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


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