summaryrefslogtreecommitdiff
path: root/src/dev/arm/kmi.hh
diff options
context:
space:
mode:
authorNathan Binkert <nate@binkert.org>2011-02-16 10:57:04 -0500
committerNathan Binkert <nate@binkert.org>2011-02-16 10:57:04 -0500
commite3d8d43b176d3a1eb69a5e5d16469d42292e514a (patch)
treeedb7203cec174b20363dc8d698e860076cc1c79c /src/dev/arm/kmi.hh
parentdfd4f6ad9395650f39057ceff8a6bf4d92408bfc (diff)
parent9836972a13576bcc7e9bfdf1e61b1d71ecb01cb7 (diff)
downloadgem5-e3d8d43b176d3a1eb69a5e5d16469d42292e514a.tar.xz
merge alpha system files into tree
Diffstat (limited to 'src/dev/arm/kmi.hh')
-rw-r--r--src/dev/arm/kmi.hh103
1 files changed, 74 insertions, 29 deletions
diff --git a/src/dev/arm/kmi.hh b/src/dev/arm/kmi.hh
index c96dd55a9..1e25f8974 100644
--- a/src/dev/arm/kmi.hh
+++ b/src/dev/arm/kmi.hh
@@ -48,13 +48,16 @@
#ifndef __DEV_ARM_PL050_HH__
#define __DEV_ARM_PL050_HH__
+#include <list>
+
#include "base/range.hh"
-#include "dev/io_device.hh"
+#include "base/vnc/vncserver.hh"
+#include "dev/arm/amba_device.hh"
#include "params/Pl050.hh"
class Gic;
-class Pl050 : public AmbaDevice
+class Pl050 : public AmbaIntDevice, public VncKeyboard, public VncMouse
{
protected:
static const int kmiCr = 0x000;
@@ -63,34 +66,68 @@ class Pl050 : public AmbaDevice
static const int kmiClkDiv = 0x00C;
static const int kmiISR = 0x010;
- // control register
- uint8_t control;
+ BitUnion8(ControlReg)
+ Bitfield<0> force_clock_low;
+ Bitfield<1> force_data_low;
+ Bitfield<2> enable;
+ Bitfield<3> txint_enable;
+ Bitfield<4> rxint_enable;
+ Bitfield<5> type;
+ EndBitUnion(ControlReg)
- // status register
- uint8_t status;
+ /** control register
+ */
+ ControlReg control;
+
+ /** KMI status register */
+ BitUnion8(StatusReg)
+ Bitfield<0> data_in;
+ Bitfield<1> clk_in;
+ Bitfield<2> rxparity;
+ Bitfield<3> rxbusy;
+ Bitfield<4> rxfull;
+ Bitfield<5> txbusy;
+ Bitfield<6> txempty;
+ EndBitUnion(StatusReg)
+
+ StatusReg status;
+
+ /** clock divisor register
+ * This register is just kept around to satisfy reads after driver does
+ * writes. The divsor does nothing, as we're not actually signaling ps2
+ * serial commands to anything.
+ */
+ uint8_t clkdiv;
- // received data (read) or data to be transmitted (write)
- uint8_t kmidata;
+ BitUnion8(InterruptReg)
+ Bitfield<0> rx;
+ Bitfield<1> tx;
+ EndBitUnion(InterruptReg)
- // clock divisor register
- uint8_t clkdiv;
+ /** interrupt status register. */
+ InterruptReg interrupts;
+
+ /** raw interrupt register (unmasked) */
+ InterruptReg rawInterrupts;
- BitUnion8(IntReg)
- Bitfield<0> txintr;
- Bitfield<1> rxintr;
- EndBitUnion(IntReg)
+ /** If the controller should ignore the next data byte and acknowledge it.
+ * The driver is attempting to setup some feature we don't care about
+ */
+ int ackNext;
- /** interrupt mask register. */
- IntReg intreg;
+ /** is the shift key currently down */
+ bool shiftDown;
- /** Interrupt number to generate */
- int intNum;
+ /** The vnc server we're connected to (if any) */
+ VncServer *vnc;
- /** Gic to use for interrupting */
- Gic *gic;
+ /** If the linux driver has initialized the device yet and thus can we send
+ * mouse data */
+ bool driverInitialized;
- /** Delay before interrupting */
- Tick intDelay;
+ /** Update the status of the interrupt registers and schedule an interrupt
+ * if required */
+ void updateIntStatus();
/** Function to generate interrupt */
void generateInterrupt();
@@ -98,6 +135,15 @@ class Pl050 : public AmbaDevice
/** Wrapper to create an event out of the thing */
EventWrapper<Pl050, &Pl050::generateInterrupt> intEvent;
+ /** Receive queue. This list contains all the pending commands that
+ * need to be sent to the driver
+ */
+ std::list<uint8_t> rxQueue;
+
+ /** Handle a command sent to the kmi and respond appropriately
+ */
+ void processCommand(uint8_t byte);
+
public:
typedef Pl050Params Params;
const Params *
@@ -111,12 +157,11 @@ class Pl050 : public AmbaDevice
virtual Tick read(PacketPtr pkt);
virtual Tick write(PacketPtr pkt);
- /**
- * Return if we have an interrupt pending
- * @return interrupt status
- * @todo fix me when implementation improves
- */
- virtual bool intStatus() { return false; }
+ virtual void mouseAt(uint16_t x, uint16_t y, uint8_t buttons);
+ virtual void keyPress(uint32_t key, bool down);
+
+ virtual void serialize(std::ostream &os);
+ virtual void unserialize(Checkpoint *cp, const std::string &section);
};
-#endif
+#endif // __DEV_ARM_PL050_HH__