dev-arm: Read correct version of ICC_BPR register
[gem5.git] / src / dev / arm / kmi.hh
index 1e25f8974832938de435a8288a43c966b4fdf465..8a94ff6063b8f0bcf77ccc7324bef6c090c92aa3 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010 ARM Limited
+ * Copyright (c) 2010, 2017-2018 ARM Limited
  * All rights reserved
  *
  * The license below extends only to copyright in the software and shall
 
 #include <list>
 
-#include "base/range.hh"
-#include "base/vnc/vncserver.hh"
+#include "base/vnc/vncinput.hh"
 #include "dev/arm/amba_device.hh"
 #include "params/Pl050.hh"
 
-class Gic;
+class PS2Device;
 
-class Pl050 : public AmbaIntDevice, public VncKeyboard, public VncMouse
+class Pl050 : public AmbaIntDevice
 {
   protected:
     static const int kmiCr       = 0x000;
@@ -104,64 +103,38 @@ class Pl050 : public AmbaIntDevice, public VncKeyboard, public VncMouse
         Bitfield<1> tx;
     EndBitUnion(InterruptReg)
 
-    /** interrupt status register. */
-    InterruptReg interrupts;
-
     /** raw interrupt register (unmasked) */
     InterruptReg rawInterrupts;
 
-    /** 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;
-
-    /** is the shift key currently down */
-    bool shiftDown;
-
-    /** The vnc server we're connected to (if any) */
-    VncServer *vnc;
-
-    /** If the linux driver has initialized the device yet and thus can we send
-     * mouse data */
-    bool driverInitialized;
+    /** Set or clear the TX interrupt */
+    void setTxInt(bool value);
 
-    /** Update the status of the interrupt registers and schedule an interrupt
-     * if required */
-    void updateIntStatus();
+    /** Update the RX interrupt using PS/2 device state */
+    void updateRxInt();
 
-    /** Function to generate interrupt */
-    void generateInterrupt();
-
-    /** 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
+    /**
+     * Update the status of the interrupt and control registers and
+     * deliver an interrupt if required.
      */
-    std::list<uint8_t> rxQueue;
+    void updateIntCtrl(InterruptReg ints, ControlReg ctrl);
 
-    /** Handle a command sent to the kmi and respond appropriately
-     */
-    void processCommand(uint8_t byte);
+    void setInterrupts(InterruptReg ints) { updateIntCtrl(ints, control); }
+    void setControl(ControlReg ctrl) { updateIntCtrl(rawInterrupts, ctrl); }
 
-  public:
-    typedef Pl050Params Params;
-    const Params *
-    params() const
-    {
-        return dynamic_cast<const Params *>(_params);
-    }
+    /** Get current interrupt value */
+    InterruptReg getInterrupt() const;
 
-    Pl050(const Params *p);
+    /** PS2 device connected to this KMI interface */
+    PS2Device *ps2;
 
-    virtual Tick read(PacketPtr pkt);
-    virtual Tick write(PacketPtr pkt);
+  public:
+    Pl050(const Pl050Params *p);
 
-    virtual void mouseAt(uint16_t x, uint16_t y, uint8_t buttons);
-    virtual void keyPress(uint32_t key, bool down);
+    Tick read(PacketPtr pkt) override;
+    Tick write(PacketPtr pkt) override;
 
-    virtual void serialize(std::ostream &os);
-    virtual void unserialize(Checkpoint *cp, const std::string &section);
+    void serialize(CheckpointOut &cp) const override;
+    void unserialize(CheckpointIn &cp) override;
 };
 
 #endif // __DEV_ARM_PL050_HH__