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 IoPortManager & instance ()
 

Private Member Functions

 IoPortManager () INITIALISATION_ONLY
 
virtual ~IoPortManager ()
 
 IoPortManager (const IoPortManager &)
 
IoPortManager & operator= (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 ProcessorBase
 

Detailed Description

Manages hardware I/O port (de)allocations.

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

Definition at line 37 of file IoPortManager.h.

Constructor & Destructor Documentation

◆ IoPortManager() [1/2]

IoPortManager::IoPortManager ( )
private

The default constructor

Definition at line 90 of file IoPortManager.cc.

◆ ~IoPortManager()

IoPortManager::~IoPortManager ( )
privatevirtual

The destructor

Definition at line 91 of file IoPortManager.cc.

◆ IoPortManager() [2/2]

IoPortManager::IoPortManager ( const IoPortManager &  )
private

The copy-constructor

Note
No implementation provided (IoPortManager is a singleton)

Member Function Documentation

◆ allocate()

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 28 of file IoPortManager.cc.

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

◆ allocateIoPortList()

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 64 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:

◆ free()

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 44 of file IoPortManager.cc.

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

Referenced by IoPort::free().

+ Here is the caller graph for this function:

◆ freeIoPortList()

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

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

Referenced by IoCommand::execute().

+ Here is the caller graph for this function:

◆ initialise()

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 86 of file IoPortManager.cc.

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

◆ instance()

static IoPortManager & IoPortManager::instance ( )
inlinestatic

Get the instance of the I/O manager

Definition at line 42 of file IoPortManager.h.

References m_Instance.

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

+ Here is the caller graph for this function:

◆ operator=()

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

The assignment operator

Note
No implementation provided (IoPortManager is a singleton)

Friends And Related Symbol Documentation

◆ ProcessorBase

friend class ProcessorBase
friend

Definition at line 38 of file IoPortManager.h.

Member Data Documentation

◆ m_FreeIoPorts

RangeList<uint32_t> IoPortManager::m_FreeIoPorts
private

The list of free I/O ports

Definition at line 104 of file IoPortManager.h.

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

◆ m_Instance

IoPortManager IoPortManager::m_Instance
staticprivate

The IoPortManager instance

Definition at line 109 of file IoPortManager.h.

Referenced by instance().

◆ m_Lock

Spinlock IoPortManager::m_Lock
private

Lock

Definition at line 101 of file IoPortManager.h.

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

◆ m_UsedIoPorts

Vector<IoPort*> IoPortManager::m_UsedIoPorts
private

The list of used I/O ports

Definition at line 106 of file IoPortManager.h.

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


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