The Pedigree Project  0.1
Public Member Functions | Private Member Functions | Private Attributes | List of all members
Ps2Controller Class Reference
+ Inheritance diagram for Ps2Controller:
+ Collaboration diagram for Ps2Controller:

Public Member Functions

 Ps2Controller (Controller *pDev)
 
virtual void getName (String &str)
 
virtual void dump (String &str)
 
void initialise ()
 
void sendCommand (uint8_t command)
 Send a command to the PS/2 controller that has no response or data.
 
void sendCommand (uint8_t command, uint8_t data)
 
uint8_t sendCommandWithResponse (uint8_t command)
 Send a command to the PS/2 controller and report its response. More...
 
uint8_t sendCommandWithResponse (uint8_t command, uint8_t data)
 
void writeFirstPort (uint8_t byte)
 Send a byte to the first port of the PS/2 controller.
 
EXPORTED_PUBLIC void writeSecondPort (uint8_t byte)
 Send a byte to the second port of the PS/2 controller.
 
bool hasSecondPort () const
 Reports whether this PS/2 controller has two ports.
 
EXPORTED_PUBLIC void setIrqEnable (bool firstEnabled, bool secondEnabled)
 Enables/disables IRQs for the first or second ports.
 
uint8_t readByte ()
 Reads a single byte from the PS/2 controller by polling.
 
uint8_t readByteNonBlock ()
 
bool readFirstPort (uint8_t &byte, bool block=true)
 Reads a single byte from the first port.
 
EXPORTED_PUBLIC bool readSecondPort (uint8_t &byte, bool block=true)
 Reads a single byte from the second port.
 
void setDebugState (bool debugState)
 Sets the debug state (blocks IRQs to allow polling).
 
bool getDebugState () const
 Gets the debug state.
 
- Public Member Functions inherited from Controller
 Controller (Device *pDev)
 
virtual Type getType ()
 
- Public Member Functions inherited from Device
 Device (Device *p)
 
DevicegetParent () const
 
void setParent (Device *p)
 
virtual String getSpecificType ()
 
virtual void setSpecificType (String str)
 
void setPciPosition (uint32_t bus, uint32_t device, uint32_t func)
 
void setPciIdentifiers (uint8_t classCode, uint8_t subclassCode, uint16_t vendorId, uint16_t deviceId, uint8_t progIf)
 
void setPciConfigHeader (const PciBus::ConfigSpace &space)
 
PciBus::ConfigSpace getPciConfigHeader () const
 
uint8_t getPciClassCode ()
 
uint8_t getPciSubclassCode ()
 
uint16_t getPciVendorId ()
 
uint16_t getPciDeviceId ()
 
uint8_t getPciProgInterface ()
 
uint32_t getPciBusPosition ()
 
uint32_t getPciDevicePosition ()
 
uint32_t getPciFunctionNumber ()
 
virtual Vector< Address * > & addresses ()
 
virtual uintptr_t getInterruptNumber ()
 
virtual void setInterruptNumber (uintptr_t n)
 
void addChild (Device *pDevice)
 
DevicegetChild (size_t n)
 
size_t getNumChildren ()
 
void removeChild (size_t n)
 
void removeChild (Device *d)
 
void replaceChild (Device *src, Device *dest)
 

Private Member Functions

virtual bool irq (irq_id_t number, InterruptState &state)
 
void waitForReading ()
 
void waitForWriting ()
 
virtual ~IrqHandler ()
 

Private Attributes

IoBasem_pBase
 
bool m_bHasSecondPort
 
Buffer< uint8_t > m_FirstPortBuffer
 
Buffer< uint8_t > m_SecondPortBuffer
 
bool m_bFirstIrqEnabled
 
bool m_bSecondIrqEnabled
 
irq_id_t m_FirstIrqId
 
irq_id_t m_SecondIrqId
 
bool m_bDebugState
 
uint8_t m_ConfigByte
 
bool m_bDebugStateFirstIrqEnabled
 
bool m_bDebugStateSecondIrqEnabled
 

Additional Inherited Members

- Public Types inherited from Device
enum  Type {
  Generic, Root, Disk, Bus,
  Display, Network, Sound, Console,
  Mouse, Controller, UsbController, UsbGeneric,
  UsbContainer
}
 
typedef Device *(* Callback) (Device *)
 
- Static Public Member Functions inherited from Device
static void foreach (Callback callback, Device *root=0)
 
template<class F , class... Args>
static void foreach (pedigree_std::Callable< F > &callback, Device *root, Args...args)
 
static void addToRoot (Device *device)
 
static void searchByVendorId (uint16_t vendorId, void(*callback)(Device *), Device *root=0)
 
static void searchByVendorIdAndDeviceId (uint16_t vendorId, uint16_t deviceId, void(*callback)(Device *), Device *root=0)
 
static void searchByClass (uint16_t classCode, void(*callback)(Device *), Device *root=0)
 
static void searchByClassAndSubclass (uint16_t classCode, uint16_t subclassCode, void(*callback)(Device *), Device *root=0)
 
static void searchByClassSubclassAndProgInterface (uint16_t classCode, uint16_t subclassCode, uint8_t progInterface, void(*callback)(Device *), Device *root=0)
 
- Protected Member Functions inherited from Device
 NOT_COPYABLE_OR_ASSIGNABLE (Device)
 
- Static Protected Member Functions inherited from Device
static Deviceroot ()
 
- Protected Attributes inherited from Device
Vector< Address * > m_Addresses
 
Vector< Device * > m_Children
 
Devicem_pParent
 
uintptr_t m_InterruptNumber
 
String m_SpecificType
 
PciBus::ConfigSpace m_ConfigHeader
 
uint8_t m_ClassCode
 
uint8_t m_SubclassCode
 
uint16_t m_VendorId
 
uint16_t m_DeviceId
 
uint8_t m_ProgInterface
 
uint32_t m_PciBusPos
 
uint32_t m_PciDevicePos
 
uint32_t m_PciFunctionNum
 
- Static Protected Attributes inherited from Device
static Device m_Root
 
static Mutex m_TreeLock
 

Detailed Description

Definition at line 34 of file Ps2Controller.h.

Member Function Documentation

virtual void Ps2Controller::dump ( String str)
inlinevirtual

Dumps a textual representation of the device into the given string.

Reimplemented from Controller.

Definition at line 49 of file Ps2Controller.h.

References EXPORTED_PUBLIC, hasSecondPort(), readByte(), readFirstPort(), readSecondPort(), sendCommand(), sendCommandWithResponse(), setDebugState(), setIrqEnable(), writeFirstPort(), and writeSecondPort().

virtual void Ps2Controller::getName ( String str)
inlinevirtual

Stores the device's name in str.

Reimplemented from Controller.

Definition at line 44 of file Ps2Controller.h.

bool Ps2Controller::irq ( irq_id_t  number,
InterruptState &  state 
)
privatevirtual

Called when the handler is registered with the irq manager and the irq occurred

Note
If this function returns false you have to call IrqManager::acknowledgeIrq() when you removed the interrupt reason.
Parameters
[in]numberthe irq number
Returns
should return true, if the interrupt reason was removed, or false otherwise

Implements IrqHandler.

Definition at line 285 of file Ps2Controller.cc.

References ERROR, and Hex.

Referenced by getDebugState().

+ Here is the caller graph for this function:

uint8_t Ps2Controller::sendCommandWithResponse ( uint8_t  command)

Send a command to the PS/2 controller and report its response.

Todo:
handle this when we have irqs enabled

Definition at line 123 of file Ps2Controller.cc.

Referenced by dump().

+ Here is the caller graph for this function:

uint8_t Ps2Controller::sendCommandWithResponse ( uint8_t  command,
uint8_t  data 
)
Todo:
handle this when we have irqs enabled

Definition at line 132 of file Ps2Controller.cc.


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