/*
- * Copyright (c) 2010, 2017 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 "dev/arm/amba_device.hh"
#include "params/Pl050.hh"
-class Pl050 : public AmbaIntDevice, public VncKeyboard, public VncMouse
+class PS2Device;
+
+class Pl050 : public AmbaIntDevice
{
protected:
static const int kmiCr = 0x000;
/** 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) */
- VncInput *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();
+ /**
+ * Update the status of the interrupt and control registers and
+ * deliver an interrupt if required.
+ */
+ void updateIntCtrl(InterruptReg ints, ControlReg ctrl);
- /** Get interrupt value */
- InterruptReg getInterrupt() const {
- InterruptReg tmp_interrupt(0);
- tmp_interrupt.tx = rawInterrupts.tx & control.txint_enable;
- tmp_interrupt.rx = rawInterrupts.rx & control.rxint_enable;
- return tmp_interrupt;
- }
- /** Wrapper to create an event out of the thing */
- EventFunctionWrapper intEvent;
+ void setInterrupts(InterruptReg ints) { updateIntCtrl(ints, control); }
+ void setControl(ControlReg ctrl) { updateIntCtrl(rawInterrupts, ctrl); }
- /** Receive queue. This list contains all the pending commands that
- * need to be sent to the driver
- */
- std::list<uint8_t> rxQueue;
+ /** Get current interrupt value */
+ InterruptReg getInterrupt() const;
- /** Handle a command sent to the kmi and respond appropriately
- */
- void processCommand(uint8_t byte);
+ /** PS2 device connected to this KMI interface */
+ PS2Device *ps2;
public:
- typedef Pl050Params Params;
- const Params *
- params() const
- {
- return dynamic_cast<const Params *>(_params);
- }
-
- Pl050(const Params *p);
+ Pl050(const Pl050Params *p);
Tick read(PacketPtr pkt) override;
Tick write(PacketPtr pkt) override;
- void mouseAt(uint16_t x, uint16_t y, uint8_t buttons) override;
- void keyPress(uint32_t key, bool down) override;
-
void serialize(CheckpointOut &cp) const override;
void unserialize(CheckpointIn &cp) override;
};