The Pedigree Project
0.1
|
Manages hardware I/O port (de)allocations. More...
#include <IoPortManager.h>
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 | Processor |
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.
|
private |
The default constructor
Definition at line 105 of file IoPortManager.cc.
|
privatevirtual |
The destructor
Definition at line 108 of file IoPortManager.cc.
|
private |
The copy-constructor
bool IoPortManager::allocate | ( | IoPort * | Port, |
io_port_t | ioPort, | ||
size_t | size | ||
) |
Allocate a number of successive I/O ports
[in] | Port | pointer to the I/O port range object |
[in] | ioPort | the I/O port number |
[in] | size | the number of successive I/O ports - 1 to allocate |
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
[in,out] | IoPorts | container 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().
void IoPortManager::free | ( | IoPort * | Port | ) |
Free a number of successive I/O ports
[in] | Port | pointer 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().
void IoPortManager::freeIoPortList | ( | Vector< IoPortInfo * > & | IoPorts | ) |
Free the I/O port list created with allocateIoPortList.
[in,out] | IoPorts | container 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().
void IoPortManager::initialise | ( | io_port_t | ioPortBase, |
size_t | size | ||
) |
Initialise the IoPortManager with an initial I/O range
[in] | ioPortBase | base I/O port for the range |
[in] | size | number of successive I/O ports - 1 |
Definition at line 100 of file IoPortManager.cc.
References RangeList< T, Reversed >::free(), and m_FreeIoPorts.
|
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().
|
private |
The assignment operator
|
private |
The list of free I/O ports
Definition at line 110 of file IoPortManager.h.
Referenced by allocate(), free(), and initialise().
|
staticprivate |
The IoPortManager instance
Definition at line 115 of file IoPortManager.h.
Referenced by instance().
|
private |
Lock
Definition at line 107 of file IoPortManager.h.
Referenced by allocate(), allocateIoPortList(), and free().
The list of used I/O ports
Definition at line 112 of file IoPortManager.h.
Referenced by allocate(), allocateIoPortList(), and free().