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

Memory mapped I/O range. More...

#include <MemoryMappedIo.h>

+ Inheritance diagram for MemoryMappedIo:
+ Collaboration diagram for MemoryMappedIo:

Public Member Functions

 MemoryMappedIo (const char *pName, uintptr_t offset=0, uintptr_t padding=1)
 
virtual ~MemoryMappedIo ()
 
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
 
- 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)
 
- Public Member Functions inherited from MemoryRegion
 MemoryRegion (const char *pName)
 
virtual ~MemoryRegion ()
 
void free ()
 
void * virtualAddress () const
 
physical_uintptr_t physicalAddress () const
 
size_t size () const
 
const char * name () const
 
 operator bool () const
 
bool physicalBoundsCheck (physical_uintptr_t address)
 
template<typename T >
T * convertPhysicalPointer (physical_uintptr_t address)
 
void setNonRamMemory (bool b)
 
bool getNonRamMemory ()
 
void setForced (bool b)
 
bool getForced ()
 

Private Member Functions

 MemoryMappedIo (const MemoryMappedIo &)
 
MemoryMappedIooperator= (const MemoryMappedIo &)
 

Private Attributes

uintptr_t m_Offset
 
size_t m_Padding
 

Additional Inherited Members

- Protected Member Functions inherited from IoBase
 IoBase ()
 

Detailed Description

Memory mapped I/O range.

The MemoryMappedIo handles special MemoryRegions for I/O to hardware devices

Definition at line 32 of file MemoryMappedIo.h.

Constructor & Destructor Documentation

MemoryMappedIo::~MemoryMappedIo ( )
virtual

The destructor frees the allocated ressources

Definition at line 30 of file MemoryMappedIo.cc.

MemoryMappedIo::MemoryMappedIo ( const MemoryMappedIo )
private

The copy-constructor

Note
NOT implemented

Member Function Documentation

MemoryMappedIo::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 127 of file MemoryMappedIo.cc.

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

The assignment operator

Note
NOT implemented
uint16_t MemoryMappedIo::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 50 of file MemoryMappedIo.cc.

References Processor::halt().

uint32_t MemoryMappedIo::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 61 of file MemoryMappedIo.cc.

References Processor::halt().

uint64_t MemoryMappedIo::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 72 of file MemoryMappedIo.cc.

References Processor::halt().

uint8_t MemoryMappedIo::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 39 of file MemoryMappedIo.cc.

References Processor::halt().

size_t MemoryMappedIo::size ( ) const
virtual

Get the size of the I/O region in bytes

Implements IoBase.

Definition at line 34 of file MemoryMappedIo.cc.

References MemoryRegion::size().

void MemoryMappedIo::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 94 of file MemoryMappedIo.cc.

References Processor::halt().

void MemoryMappedIo::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 105 of file MemoryMappedIo.cc.

References Processor::halt().

void MemoryMappedIo::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 116 of file MemoryMappedIo.cc.

References Processor::halt().

void MemoryMappedIo::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 83 of file MemoryMappedIo.cc.

References Processor::halt().

Member Data Documentation

uintptr_t MemoryMappedIo::m_Offset
private

MemoryRegion only supports allocation on a page boundary. This variable adds an offset onto each access to make up for this (if required)

Definition at line 69 of file MemoryMappedIo.h.

size_t MemoryMappedIo::m_Padding
private

It is possible that registers may not follow one another directly in memory, instead being padded to some boundary.

Definition at line 73 of file MemoryMappedIo.h.


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