The Pedigree Project  0.1
Classes | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | Friends | List of all members
IoPortManager Class Reference

Manages hardware I/O port (de)allocations. More...

#include <IoPortManager.h>

+ Collaboration diagram for IoPortManager:

Classes

struct  IoPortInfo
 

Public Member Functions

bool allocate (IoPort *Port, io_port_t ioPort, size_t size)
 
void free (IoPort *Port)
 
void allocateIoPortList (Vector< IoPortInfo * > &IoPorts)
 
void freeIoPortList (Vector< IoPortInfo * > &IoPorts)
 
void initialise (io_port_t ioPortBase, size_t size) INITIALISATION_ONLY
 

Static Public Member Functions

static IoPortManagerinstance ()
 

Private Member Functions

 IoPortManager () INITIALISATION_ONLY
 
virtual ~IoPortManager ()
 
 IoPortManager (const IoPortManager &)
 
IoPortManageroperator= (const IoPortManager &)
 

Private Attributes

Spinlock m_Lock
 
RangeList< uint32_t > m_FreeIoPorts
 
Vector< IoPort * > m_UsedIoPorts
 

Static Private Attributes

static IoPortManager m_Instance
 

Friends

class Processor
 

Detailed Description

Manages hardware I/O port (de)allocations.

Singleton class which manages hardware I/O port (de)allocate

Definition at line 38 of file IoPortManager.h.

Constructor & Destructor Documentation

IoPortManager::IoPortManager ( )
private

The default constructor

Definition at line 105 of file IoPortManager.cc.

IoPortManager::~IoPortManager ( )
privatevirtual

The destructor

Definition at line 108 of file IoPortManager.cc.

IoPortManager::IoPortManager ( const IoPortManager )
private

The copy-constructor

Note
No implementation provided (IoPortManager is a singleton)

Member Function Documentation

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

Allocate a number of successive I/O ports

Note
This is normally called from an IoPort object
Parameters
[in]Portpointer to the I/O port range object
[in]ioPortthe I/O port number
[in]sizethe number of successive I/O ports - 1 to allocate
Returns
true, if the I/O port has been allocated successfull, false otherwise

Definition at line 30 of file IoPortManager.cc.

References RangeList< T, Reversed >::allocateSpecific(), Processor::halt(), Processor::isInitialised(), m_FreeIoPorts, m_Lock, m_UsedIoPorts, and Vector< T >::pushBack().

void IoPortManager::allocateIoPortList ( Vector< IoPortInfo * > &  IoPorts)

Copy the I/O port list

Parameters
[in,out]IoPortscontainer for the copy of the I/O ports

Definition at line 73 of file IoPortManager.cc.

References Vector< T >::count(), m_Lock, m_UsedIoPorts, and Vector< T >::pushBack().

Referenced by IoCommand::execute().

+ Here is the caller graph for this function:

void IoPortManager::free ( IoPort Port)

Free a number of successive I/O ports

Note
This is normally called from an IoPort object
Parameters
[in]Portpointer to the I/O port range object

Definition at line 49 of file IoPortManager.cc.

References IoPort::base(), Vector< T >::begin(), Vector< T >::end(), Vector< T >::erase(), RangeList< T, Reversed >::free(), Processor::halt(), Processor::isInitialised(), m_FreeIoPorts, m_Lock, m_UsedIoPorts, and IoPort::size().

Referenced by IoPort::free().

+ Here is the caller graph for this function:

void IoPortManager::freeIoPortList ( Vector< IoPortInfo * > &  IoPorts)

Free the I/O port list created with allocateIoPortList.

Parameters
[in,out]IoPortscontainer of the copy of the I/O ports

Definition at line 87 of file IoPortManager.cc.

References Vector< T >::count(), and Vector< T >::popBack().

Referenced by IoCommand::execute().

+ Here is the caller graph for this function:

void IoPortManager::initialise ( io_port_t  ioPortBase,
size_t  size 
)

Initialise the IoPortManager with an initial I/O range

Parameters
[in]ioPortBasebase I/O port for the range
[in]sizenumber of successive I/O ports - 1

Definition at line 100 of file IoPortManager.cc.

References RangeList< T, Reversed >::free(), and m_FreeIoPorts.

static IoPortManager& IoPortManager::instance ( )
inlinestatic

Get the instance of the I/O manager

Definition at line 44 of file IoPortManager.h.

References m_Instance.

Referenced by IoPort::allocate(), IoCommand::execute(), and IoPort::free().

+ Here is the caller graph for this function:

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

The assignment operator

Note
No implementation provided (IoPortManager is a singleton)

Member Data Documentation

RangeList<uint32_t> IoPortManager::m_FreeIoPorts
private

The list of free I/O ports

Definition at line 110 of file IoPortManager.h.

Referenced by allocate(), free(), and initialise().

IoPortManager IoPortManager::m_Instance
staticprivate

The IoPortManager instance

Definition at line 115 of file IoPortManager.h.

Referenced by instance().

Spinlock IoPortManager::m_Lock
private

Lock

Definition at line 107 of file IoPortManager.h.

Referenced by allocate(), allocateIoPortList(), and free().

Vector<IoPort *> IoPortManager::m_UsedIoPorts
private

The list of used I/O ports

Definition at line 112 of file IoPortManager.h.

Referenced by allocate(), allocateIoPortList(), and free().


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