dev: Put PS2 classes in the ps2 namespace
These classes belong in the ps2 namespace. Use this opportunity to rename PS2Device as ps2::Device, and PS2TouchKit as ps2::TouchKit. Unfortunately, since the ps2::Mouse and ps2::Keyboard namespaces are being deprecated, these names cannot be used as of now to rename PS2Mouse and PS2Keyboard. Change-Id: I9a57b87053a6a0acb380a919e09ab427fdb8eca4 Signed-off-by: Daniel R. Carvalho <odanrc@yahoo.com.br> Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/45395 Maintainer: Bobby R. Bruce <bbruce@ucdavis.edu> Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Hoa Nguyen <hoanguyen@ucdavis.edu>
This commit is contained in:
committed by
Daniel Carvalho
parent
62610709df
commit
fd660886c7
@@ -52,7 +52,9 @@
|
||||
#include "dev/arm/amba_device.hh"
|
||||
#include "params/Pl050.hh"
|
||||
|
||||
class PS2Device;
|
||||
namespace ps2 {
|
||||
class Device;
|
||||
} // namespace ps2
|
||||
|
||||
class Pl050 : public AmbaIntDevice
|
||||
{
|
||||
@@ -123,7 +125,7 @@ class Pl050 : public AmbaIntDevice
|
||||
InterruptReg getInterrupt() const;
|
||||
|
||||
/** PS2 device connected to this KMI interface */
|
||||
PS2Device *ps2Device;
|
||||
ps2::Device *ps2Device;
|
||||
|
||||
public:
|
||||
Pl050(const Pl050Params &p);
|
||||
|
||||
@@ -40,20 +40,24 @@ from m5.proxy import *
|
||||
class PS2Device(SimObject):
|
||||
type = 'PS2Device'
|
||||
cxx_header = "dev/ps2/device.hh"
|
||||
cxx_class = "ps2::Device"
|
||||
abstract = True
|
||||
|
||||
class PS2Keyboard(PS2Device):
|
||||
type = 'PS2Keyboard'
|
||||
cxx_header = "dev/ps2/keyboard.hh"
|
||||
cxx_class = "ps2::PS2Keyboard"
|
||||
|
||||
vnc = Param.VncInput(Parent.any, "VNC server providing keyboard input")
|
||||
|
||||
class PS2Mouse(PS2Device):
|
||||
type = 'PS2Mouse'
|
||||
cxx_header = "dev/ps2/mouse.hh"
|
||||
cxx_class = "ps2::PS2Mouse"
|
||||
|
||||
class PS2TouchKit(PS2Device):
|
||||
type = 'PS2TouchKit'
|
||||
cxx_header = "dev/ps2/touchkit.hh"
|
||||
cxx_class = "ps2::TouchKit"
|
||||
|
||||
vnc = Param.VncInput(Parent.any, "VNC server providing mouse input")
|
||||
|
||||
@@ -40,6 +40,8 @@
|
||||
|
||||
#include "dev/ps2/device.hh"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include "base/logging.hh"
|
||||
#include "base/trace.hh"
|
||||
#include "debug/PS2.hh"
|
||||
@@ -47,14 +49,17 @@
|
||||
#include "params/PS2Device.hh"
|
||||
#include "sim/serialize.hh"
|
||||
|
||||
PS2Device::PS2Device(const PS2DeviceParams &p)
|
||||
namespace ps2
|
||||
{
|
||||
|
||||
Device::Device(const PS2DeviceParams &p)
|
||||
: SimObject(p)
|
||||
{
|
||||
inBuffer.reserve(16);
|
||||
}
|
||||
|
||||
void
|
||||
PS2Device::serialize(CheckpointOut &cp) const
|
||||
Device::serialize(CheckpointOut &cp) const
|
||||
{
|
||||
std::vector<uint8_t> buffer(outBuffer.size());
|
||||
std::copy(outBuffer.begin(), outBuffer.end(), buffer.begin());
|
||||
@@ -64,7 +69,7 @@ PS2Device::serialize(CheckpointOut &cp) const
|
||||
}
|
||||
|
||||
void
|
||||
PS2Device::unserialize(CheckpointIn &cp)
|
||||
Device::unserialize(CheckpointIn &cp)
|
||||
{
|
||||
std::vector<uint8_t> buffer;
|
||||
arrayParamIn(cp, "outBuffer", buffer);
|
||||
@@ -75,7 +80,7 @@ PS2Device::unserialize(CheckpointIn &cp)
|
||||
}
|
||||
|
||||
void
|
||||
PS2Device::hostRegDataAvailable(const std::function<void()> &c)
|
||||
Device::hostRegDataAvailable(const std::function<void()> &c)
|
||||
{
|
||||
fatal_if(dataAvailableCallback,
|
||||
"A data pending callback has already been associated with this "
|
||||
@@ -85,7 +90,7 @@ PS2Device::hostRegDataAvailable(const std::function<void()> &c)
|
||||
}
|
||||
|
||||
uint8_t
|
||||
PS2Device::hostRead()
|
||||
Device::hostRead()
|
||||
{
|
||||
uint8_t data = outBuffer.front();
|
||||
outBuffer.pop_front();
|
||||
@@ -93,7 +98,7 @@ PS2Device::hostRead()
|
||||
}
|
||||
|
||||
void
|
||||
PS2Device::hostWrite(uint8_t c)
|
||||
Device::hostWrite(uint8_t c)
|
||||
{
|
||||
DPRINTF(PS2, "PS2: Host -> device: %#x\n", c);
|
||||
inBuffer.push_back(c);
|
||||
@@ -102,7 +107,7 @@ PS2Device::hostWrite(uint8_t c)
|
||||
}
|
||||
|
||||
void
|
||||
PS2Device::send(const uint8_t *data, size_t size)
|
||||
Device::send(const uint8_t *data, size_t size)
|
||||
{
|
||||
assert(data || size == 0);
|
||||
while (size) {
|
||||
@@ -117,7 +122,9 @@ PS2Device::send(const uint8_t *data, size_t size)
|
||||
}
|
||||
|
||||
void
|
||||
PS2Device::sendAck()
|
||||
Device::sendAck()
|
||||
{
|
||||
send(ps2::Ack);
|
||||
send(Ack);
|
||||
}
|
||||
|
||||
} // namespace ps2
|
||||
|
||||
@@ -41,17 +41,23 @@
|
||||
#ifndef __DEV_PS2_DEVICE_HH__
|
||||
#define __DEV_PS2_DEVICE_HH__
|
||||
|
||||
#include <cstdint>
|
||||
#include <deque>
|
||||
#include <functional>
|
||||
#include <vector>
|
||||
|
||||
#include "base/compiler.hh"
|
||||
#include "sim/sim_object.hh"
|
||||
|
||||
struct PS2DeviceParams;
|
||||
|
||||
class PS2Device : public SimObject
|
||||
namespace ps2
|
||||
{
|
||||
|
||||
class Device : public SimObject
|
||||
{
|
||||
public:
|
||||
PS2Device(const PS2DeviceParams &p);
|
||||
Device(const PS2DeviceParams &p);
|
||||
|
||||
void serialize(CheckpointOut &cp) const override;
|
||||
void unserialize(CheckpointIn &cp) override;
|
||||
@@ -142,4 +148,8 @@ class PS2Device : public SimObject
|
||||
std::function<void()> dataAvailableCallback;
|
||||
};
|
||||
|
||||
} // namespace ps2
|
||||
|
||||
GEM5_DEPRECATED_CLASS(PS2Device, ps2::Device);
|
||||
|
||||
#endif // __DEV_PS2_HOUSE_HH__
|
||||
|
||||
@@ -40,14 +40,20 @@
|
||||
|
||||
#include "dev/ps2/keyboard.hh"
|
||||
|
||||
#include <cstdint>
|
||||
#include <list>
|
||||
|
||||
#include "base/logging.hh"
|
||||
#include "base/trace.hh"
|
||||
#include "debug/PS2.hh"
|
||||
#include "dev/ps2/types.hh"
|
||||
#include "params/PS2Keyboard.hh"
|
||||
|
||||
namespace ps2
|
||||
{
|
||||
|
||||
PS2Keyboard::PS2Keyboard(const PS2KeyboardParams &p)
|
||||
: PS2Device(p),
|
||||
: Device(p),
|
||||
shiftDown(false),
|
||||
enabled(false)
|
||||
{
|
||||
@@ -58,7 +64,7 @@ PS2Keyboard::PS2Keyboard(const PS2KeyboardParams &p)
|
||||
void
|
||||
PS2Keyboard::serialize(CheckpointOut &cp) const
|
||||
{
|
||||
PS2Device::serialize(cp);
|
||||
Device::serialize(cp);
|
||||
SERIALIZE_SCALAR(shiftDown);
|
||||
SERIALIZE_SCALAR(enabled);
|
||||
}
|
||||
@@ -66,7 +72,7 @@ PS2Keyboard::serialize(CheckpointOut &cp) const
|
||||
void
|
||||
PS2Keyboard::unserialize(CheckpointIn &cp)
|
||||
{
|
||||
PS2Device::unserialize(cp);
|
||||
Device::unserialize(cp);
|
||||
UNSERIALIZE_SCALAR(shiftDown);
|
||||
UNSERIALIZE_SCALAR(enabled);
|
||||
}
|
||||
@@ -75,36 +81,36 @@ bool
|
||||
PS2Keyboard::recv(const std::vector<uint8_t> &data)
|
||||
{
|
||||
switch (data[0]) {
|
||||
case ps2::ReadID:
|
||||
case ReadID:
|
||||
DPRINTF(PS2, "Got keyboard read ID command.\n");
|
||||
sendAck();
|
||||
send(ps2::Keyboard::ID);
|
||||
send(Keyboard::ID);
|
||||
return true;
|
||||
case ps2::Enable:
|
||||
case Enable:
|
||||
DPRINTF(PS2, "Enabling the keyboard.\n");
|
||||
enabled = true;
|
||||
sendAck();
|
||||
return true;
|
||||
case ps2::Disable:
|
||||
case Disable:
|
||||
DPRINTF(PS2, "Disabling the keyboard.\n");
|
||||
enabled = false;
|
||||
sendAck();
|
||||
return true;
|
||||
case ps2::DefaultsAndDisable:
|
||||
case DefaultsAndDisable:
|
||||
DPRINTF(PS2, "Disabling and resetting the keyboard.\n");
|
||||
enabled = false;
|
||||
sendAck();
|
||||
return true;
|
||||
case ps2::Reset:
|
||||
case Reset:
|
||||
DPRINTF(PS2, "Resetting keyboard.\n");
|
||||
enabled = true;
|
||||
sendAck();
|
||||
send(ps2::SelfTestPass);
|
||||
send(SelfTestPass);
|
||||
return true;
|
||||
case ps2::Resend:
|
||||
case Resend:
|
||||
panic("Keyboard resend unimplemented.\n");
|
||||
|
||||
case ps2::Keyboard::LEDWrite:
|
||||
case Keyboard::LEDWrite:
|
||||
if (data.size() == 1) {
|
||||
DPRINTF(PS2, "Got LED write command.\n");
|
||||
sendAck();
|
||||
@@ -118,11 +124,11 @@ PS2Keyboard::recv(const std::vector<uint8_t> &data)
|
||||
sendAck();
|
||||
return true;
|
||||
}
|
||||
case ps2::Keyboard::DiagnosticEcho:
|
||||
case Keyboard::DiagnosticEcho:
|
||||
panic("Keyboard diagnostic echo unimplemented.\n");
|
||||
case ps2::Keyboard::AlternateScanCodes:
|
||||
case Keyboard::AlternateScanCodes:
|
||||
panic("Accessing alternate scan codes unimplemented.\n");
|
||||
case ps2::Keyboard::TypematicInfo:
|
||||
case Keyboard::TypematicInfo:
|
||||
if (data.size() == 1) {
|
||||
DPRINTF(PS2, "Setting typematic info.\n");
|
||||
sendAck();
|
||||
@@ -132,20 +138,20 @@ PS2Keyboard::recv(const std::vector<uint8_t> &data)
|
||||
sendAck();
|
||||
return true;
|
||||
}
|
||||
case ps2::Keyboard::AllKeysToTypematic:
|
||||
case Keyboard::AllKeysToTypematic:
|
||||
panic("Setting all keys to typemantic unimplemented.\n");
|
||||
case ps2::Keyboard::AllKeysToMakeRelease:
|
||||
case Keyboard::AllKeysToMakeRelease:
|
||||
panic("Setting all keys to make/release unimplemented.\n");
|
||||
case ps2::Keyboard::AllKeysToMake:
|
||||
case Keyboard::AllKeysToMake:
|
||||
panic("Setting all keys to make unimplemented.\n");
|
||||
case ps2::Keyboard::AllKeysToTypematicMakeRelease:
|
||||
case Keyboard::AllKeysToTypematicMakeRelease:
|
||||
panic("Setting all keys to "
|
||||
"typematic/make/release unimplemented.\n");
|
||||
case ps2::Keyboard::KeyToTypematic:
|
||||
case Keyboard::KeyToTypematic:
|
||||
panic("Setting a key to typematic unimplemented.\n");
|
||||
case ps2::Keyboard::KeyToMakeRelease:
|
||||
case Keyboard::KeyToMakeRelease:
|
||||
panic("Setting a key to make/release unimplemented.\n");
|
||||
case ps2::Keyboard::KeyToMakeOnly:
|
||||
case Keyboard::KeyToMakeOnly:
|
||||
panic("Setting key to make only unimplemented.\n");
|
||||
default:
|
||||
panic("Unknown keyboard command %#02x.\n", data[0]);
|
||||
@@ -159,7 +165,7 @@ PS2Keyboard::keyPress(uint32_t key, bool down)
|
||||
|
||||
// convert the X11 keysym into ps2 codes and update the shift
|
||||
// state (shiftDown)
|
||||
ps2::keySymToPs2(key, down, shiftDown, keys);
|
||||
keySymToPs2(key, down, shiftDown, keys);
|
||||
|
||||
// Drop key presses if the keyboard hasn't been enabled by the
|
||||
// host. We do that after translating the key code to ensure that
|
||||
@@ -171,3 +177,5 @@ PS2Keyboard::keyPress(uint32_t key, bool down)
|
||||
for (uint8_t c : keys)
|
||||
send(c);
|
||||
}
|
||||
|
||||
} // namespace ps2
|
||||
|
||||
@@ -46,7 +46,10 @@
|
||||
|
||||
struct PS2KeyboardParams;
|
||||
|
||||
class PS2Keyboard : public PS2Device, VncKeyboard
|
||||
namespace ps2
|
||||
{
|
||||
|
||||
class PS2Keyboard : public Device, VncKeyboard
|
||||
{
|
||||
protected:
|
||||
/** is the shift key currently down */
|
||||
@@ -61,12 +64,13 @@ class PS2Keyboard : public PS2Device, VncKeyboard
|
||||
void serialize(CheckpointOut &cp) const override;
|
||||
void unserialize(CheckpointIn &cp) override;
|
||||
|
||||
protected: // PS2Device
|
||||
protected: // from Device
|
||||
bool recv(const std::vector<uint8_t> &data) override;
|
||||
|
||||
public: // VncKeyboard
|
||||
void keyPress(uint32_t key, bool down) override;
|
||||
};
|
||||
|
||||
#endif // __DEV_PS2_KEYBOARD_hH__
|
||||
} // namespace ps2
|
||||
|
||||
#endif // __DEV_PS2_KEYBOARD_hH__
|
||||
|
||||
@@ -47,8 +47,11 @@
|
||||
#include "params/PS2Mouse.hh"
|
||||
#include "sim/serialize.hh"
|
||||
|
||||
namespace ps2
|
||||
{
|
||||
|
||||
PS2Mouse::PS2Mouse(const PS2MouseParams &p)
|
||||
: PS2Device(p),
|
||||
: Device(p),
|
||||
status(0), resolution(4), sampleRate(100)
|
||||
{
|
||||
}
|
||||
@@ -57,45 +60,45 @@ bool
|
||||
PS2Mouse::recv(const std::vector<uint8_t> &data)
|
||||
{
|
||||
switch (data[0]) {
|
||||
case ps2::ReadID:
|
||||
case ReadID:
|
||||
DPRINTF(PS2, "Mouse ID requested.\n");
|
||||
sendAck();
|
||||
send(ps2::Mouse::ID);
|
||||
send(Mouse::ID);
|
||||
return true;
|
||||
case ps2::Disable:
|
||||
case Disable:
|
||||
DPRINTF(PS2, "Disabling data reporting.\n");
|
||||
status.enabled = 0;
|
||||
sendAck();
|
||||
return true;
|
||||
case ps2::Enable:
|
||||
case Enable:
|
||||
DPRINTF(PS2, "Enabling data reporting.\n");
|
||||
status.enabled = 1;
|
||||
sendAck();
|
||||
return true;
|
||||
case ps2::Resend:
|
||||
case Resend:
|
||||
panic("Mouse resend unimplemented.\n");
|
||||
case ps2::Reset:
|
||||
case Reset:
|
||||
DPRINTF(PS2, "Resetting the mouse.\n");
|
||||
sampleRate = 100;
|
||||
resolution = 4;
|
||||
status.twoToOne = 0;
|
||||
status.enabled = 0;
|
||||
sendAck();
|
||||
send(ps2::SelfTestPass);
|
||||
send(ps2::Mouse::ID);
|
||||
send(SelfTestPass);
|
||||
send(Mouse::ID);
|
||||
return true;
|
||||
|
||||
case ps2::Mouse::Scale1to1:
|
||||
case Mouse::Scale1to1:
|
||||
DPRINTF(PS2, "Setting mouse scale to 1:1.\n");
|
||||
status.twoToOne = 0;
|
||||
sendAck();
|
||||
return true;
|
||||
case ps2::Mouse::Scale2to1:
|
||||
case Mouse::Scale2to1:
|
||||
DPRINTF(PS2, "Setting mouse scale to 2:1.\n");
|
||||
status.twoToOne = 1;
|
||||
sendAck();
|
||||
return true;
|
||||
case ps2::Mouse::SetResolution:
|
||||
case Mouse::SetResolution:
|
||||
if (data.size() == 1) {
|
||||
DPRINTF(PS2, "Setting mouse resolution.\n");
|
||||
sendAck();
|
||||
@@ -106,22 +109,22 @@ PS2Mouse::recv(const std::vector<uint8_t> &data)
|
||||
sendAck();
|
||||
return true;
|
||||
}
|
||||
case ps2::Mouse::GetStatus:
|
||||
case Mouse::GetStatus:
|
||||
DPRINTF(PS2, "Getting mouse status.\n");
|
||||
sendAck();
|
||||
send((uint8_t *)&(status), 1);
|
||||
send(&resolution, sizeof(resolution));
|
||||
send(&sampleRate, sizeof(sampleRate));
|
||||
return true;
|
||||
case ps2::Mouse::ReadData:
|
||||
case Mouse::ReadData:
|
||||
panic("Reading mouse data unimplemented.\n");
|
||||
case ps2::Mouse::ResetWrapMode:
|
||||
case Mouse::ResetWrapMode:
|
||||
panic("Resetting mouse wrap mode unimplemented.\n");
|
||||
case ps2::Mouse::WrapMode:
|
||||
case Mouse::WrapMode:
|
||||
panic("Setting mouse wrap mode unimplemented.\n");
|
||||
case ps2::Mouse::RemoteMode:
|
||||
case Mouse::RemoteMode:
|
||||
panic("Setting mouse remote mode unimplemented.\n");
|
||||
case ps2::Mouse::SampleRate:
|
||||
case Mouse::SampleRate:
|
||||
if (data.size() == 1) {
|
||||
DPRINTF(PS2, "Setting mouse sample rate.\n");
|
||||
sendAck();
|
||||
@@ -133,7 +136,7 @@ PS2Mouse::recv(const std::vector<uint8_t> &data)
|
||||
sendAck();
|
||||
return true;
|
||||
}
|
||||
case ps2::DefaultsAndDisable:
|
||||
case DefaultsAndDisable:
|
||||
DPRINTF(PS2, "Disabling and resetting mouse.\n");
|
||||
sampleRate = 100;
|
||||
resolution = 4;
|
||||
@@ -143,7 +146,7 @@ PS2Mouse::recv(const std::vector<uint8_t> &data)
|
||||
return true;
|
||||
default:
|
||||
warn("Unknown mouse command %#02x.\n", data[0]);
|
||||
send(ps2::Resend);
|
||||
send(Resend);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -151,7 +154,7 @@ PS2Mouse::recv(const std::vector<uint8_t> &data)
|
||||
void
|
||||
PS2Mouse::serialize(CheckpointOut &cp) const
|
||||
{
|
||||
PS2Device::serialize(cp);
|
||||
Device::serialize(cp);
|
||||
|
||||
SERIALIZE_SCALAR(status);
|
||||
SERIALIZE_SCALAR(resolution);
|
||||
@@ -161,9 +164,11 @@ PS2Mouse::serialize(CheckpointOut &cp) const
|
||||
void
|
||||
PS2Mouse::unserialize(CheckpointIn &cp)
|
||||
{
|
||||
PS2Device::unserialize(cp);
|
||||
Device::unserialize(cp);
|
||||
|
||||
UNSERIALIZE_SCALAR(status);
|
||||
UNSERIALIZE_SCALAR(resolution);
|
||||
UNSERIALIZE_SCALAR(sampleRate);
|
||||
}
|
||||
|
||||
} // namespace ps2
|
||||
|
||||
@@ -46,7 +46,10 @@
|
||||
|
||||
struct PS2MouseParams;
|
||||
|
||||
class PS2Mouse : public PS2Device
|
||||
namespace ps2
|
||||
{
|
||||
|
||||
class PS2Mouse : public Device
|
||||
{
|
||||
protected:
|
||||
BitUnion8(Status)
|
||||
@@ -67,9 +70,11 @@ class PS2Mouse : public PS2Device
|
||||
void serialize(CheckpointOut &cp) const override;
|
||||
void unserialize(CheckpointIn &cp) override;
|
||||
|
||||
protected: // PS2Device
|
||||
protected: // from Device
|
||||
bool recv(const std::vector<uint8_t> &data) override;
|
||||
};
|
||||
|
||||
} // namespace ps2
|
||||
|
||||
#endif // __DEV_PS2_MOUSE_hH__
|
||||
|
||||
|
||||
@@ -40,14 +40,20 @@
|
||||
|
||||
#include "dev/ps2/touchkit.hh"
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
#include "base/logging.hh"
|
||||
#include "base/trace.hh"
|
||||
#include "debug/PS2.hh"
|
||||
#include "dev/ps2/mouse.hh"
|
||||
#include "dev/ps2/types.hh"
|
||||
#include "params/PS2TouchKit.hh"
|
||||
|
||||
PS2TouchKit::PS2TouchKit(const PS2TouchKitParams &p)
|
||||
: PS2Device(p),
|
||||
namespace ps2
|
||||
{
|
||||
|
||||
TouchKit::TouchKit(const PS2TouchKitParams &p)
|
||||
: Device(p),
|
||||
vnc(p.vnc),
|
||||
enabled(false), touchKitEnabled(false)
|
||||
{
|
||||
@@ -56,69 +62,69 @@ PS2TouchKit::PS2TouchKit(const PS2TouchKitParams &p)
|
||||
}
|
||||
|
||||
void
|
||||
PS2TouchKit::serialize(CheckpointOut &cp) const
|
||||
TouchKit::serialize(CheckpointOut &cp) const
|
||||
{
|
||||
PS2Device::serialize(cp);
|
||||
Device::serialize(cp);
|
||||
|
||||
SERIALIZE_SCALAR(enabled);
|
||||
SERIALIZE_SCALAR(touchKitEnabled);
|
||||
}
|
||||
|
||||
void
|
||||
PS2TouchKit::unserialize(CheckpointIn &cp)
|
||||
TouchKit::unserialize(CheckpointIn &cp)
|
||||
{
|
||||
PS2Device::unserialize(cp);
|
||||
Device::unserialize(cp);
|
||||
|
||||
UNSERIALIZE_SCALAR(enabled);
|
||||
UNSERIALIZE_SCALAR(touchKitEnabled);
|
||||
}
|
||||
|
||||
bool
|
||||
PS2TouchKit::recv(const std::vector<uint8_t> &data)
|
||||
TouchKit::recv(const std::vector<uint8_t> &data)
|
||||
{
|
||||
switch (data[0]) {
|
||||
case ps2::Reset:
|
||||
case Reset:
|
||||
DPRINTF(PS2, "Resetting device.\n");
|
||||
enabled = false;
|
||||
touchKitEnabled = false;
|
||||
sendAck();
|
||||
send(ps2::SelfTestPass);
|
||||
send(SelfTestPass);
|
||||
return true;
|
||||
|
||||
case ps2::ReadID:
|
||||
case ReadID:
|
||||
sendAck();
|
||||
send(ps2::Mouse::ID);
|
||||
send(Mouse::ID);
|
||||
return true;
|
||||
|
||||
case ps2::Disable:
|
||||
case Disable:
|
||||
DPRINTF(PS2, "Disabling device.\n");
|
||||
enabled = false;
|
||||
sendAck();
|
||||
return true;
|
||||
|
||||
case ps2::Enable:
|
||||
case Enable:
|
||||
DPRINTF(PS2, "Enabling device.\n");
|
||||
enabled = true;
|
||||
sendAck();
|
||||
return true;
|
||||
|
||||
case ps2::DefaultsAndDisable:
|
||||
case DefaultsAndDisable:
|
||||
DPRINTF(PS2, "Setting defaults and disabling device.\n");
|
||||
enabled = false;
|
||||
sendAck();
|
||||
return true;
|
||||
|
||||
case ps2::Mouse::Scale1to1:
|
||||
case ps2::Mouse::Scale2to1:
|
||||
case Mouse::Scale1to1:
|
||||
case Mouse::Scale2to1:
|
||||
sendAck();
|
||||
return true;
|
||||
|
||||
case ps2::Mouse::SetResolution:
|
||||
case ps2::Mouse::SampleRate:
|
||||
case Mouse::SetResolution:
|
||||
case Mouse::SampleRate:
|
||||
sendAck();
|
||||
return data.size() == 2;
|
||||
|
||||
case ps2::Mouse::GetStatus:
|
||||
case Mouse::GetStatus:
|
||||
sendAck();
|
||||
send(0);
|
||||
send(2); // default resolution
|
||||
@@ -143,7 +149,7 @@ PS2TouchKit::recv(const std::vector<uint8_t> &data)
|
||||
}
|
||||
|
||||
bool
|
||||
PS2TouchKit::recvTouchKit(const std::vector<uint8_t> &data)
|
||||
TouchKit::recvTouchKit(const std::vector<uint8_t> &data)
|
||||
{
|
||||
// Ack all incoming bytes
|
||||
sendAck();
|
||||
@@ -173,7 +179,7 @@ PS2TouchKit::recvTouchKit(const std::vector<uint8_t> &data)
|
||||
}
|
||||
|
||||
void
|
||||
PS2TouchKit::sendTouchKit(const uint8_t *data, size_t size)
|
||||
TouchKit::sendTouchKit(const uint8_t *data, size_t size)
|
||||
{
|
||||
send(TouchKitDiag);
|
||||
send(size);
|
||||
@@ -183,7 +189,7 @@ PS2TouchKit::sendTouchKit(const uint8_t *data, size_t size)
|
||||
|
||||
|
||||
void
|
||||
PS2TouchKit::mouseAt(uint16_t x, uint16_t y, uint8_t buttons)
|
||||
TouchKit::mouseAt(uint16_t x, uint16_t y, uint8_t buttons)
|
||||
{
|
||||
// If the driver hasn't initialized the device yet, no need to try and send
|
||||
// it anything. Similarly we can get vnc mouse events orders of magnitude
|
||||
@@ -204,3 +210,5 @@ PS2TouchKit::mouseAt(uint16_t x, uint16_t y, uint8_t buttons)
|
||||
|
||||
send(resp, sizeof(resp));
|
||||
}
|
||||
|
||||
} // namespace ps2
|
||||
|
||||
@@ -38,12 +38,16 @@
|
||||
#ifndef __DEV_PS2_TOUCHKIT_HH__
|
||||
#define __DEV_PS2_TOUCHKIT_HH__
|
||||
|
||||
#include "base/compiler.hh"
|
||||
#include "base/vnc/vncinput.hh"
|
||||
#include "dev/ps2/device.hh"
|
||||
|
||||
struct PS2TouchKitParams;
|
||||
|
||||
class PS2TouchKit : public PS2Device, public VncMouse
|
||||
namespace ps2
|
||||
{
|
||||
|
||||
class TouchKit : public Device, public VncMouse
|
||||
{
|
||||
protected:
|
||||
enum PS2Commands
|
||||
@@ -60,12 +64,12 @@ class PS2TouchKit : public PS2Device, public VncMouse
|
||||
};
|
||||
|
||||
public:
|
||||
PS2TouchKit(const PS2TouchKitParams &p);
|
||||
TouchKit(const PS2TouchKitParams &p);
|
||||
|
||||
void serialize(CheckpointOut &cp) const override;
|
||||
void unserialize(CheckpointIn &cp) override;
|
||||
|
||||
protected: // PS2Device
|
||||
protected: // from Device
|
||||
bool recv(const std::vector<uint8_t> &data) override;
|
||||
|
||||
public: // VncMouse
|
||||
@@ -89,5 +93,8 @@ class PS2TouchKit : public PS2Device, public VncMouse
|
||||
bool touchKitEnabled;
|
||||
};
|
||||
|
||||
#endif // __DEV_PS2_TOUCHKIT_HH__
|
||||
} // namespace ps2
|
||||
|
||||
GEM5_DEPRECATED_CLASS(PS2TouchKit, ps2::TouchKit);
|
||||
|
||||
#endif // __DEV_PS2_TOUCHKIT_HH__
|
||||
|
||||
@@ -42,13 +42,13 @@
|
||||
#include "base/logging.hh"
|
||||
#include "x11keysym/keysym.h"
|
||||
|
||||
const std::vector<uint8_t> ps2::Keyboard::ID{0xAB, 0x83};
|
||||
const std::vector<uint8_t> ps2::Mouse::ID{0x00};
|
||||
|
||||
GEM5_DEPRECATED_NAMESPACE(Ps2, ps2);
|
||||
namespace ps2
|
||||
{
|
||||
|
||||
const std::vector<uint8_t> Keyboard::ID{0xAB, 0x83};
|
||||
const std::vector<uint8_t> Mouse::ID{0x00};
|
||||
|
||||
/** Table to convert simple key symbols (0x00XX) into ps2 bytes. Lower byte
|
||||
* is the scan code to send and upper byte is if a modifier is required to
|
||||
* generate it. The table generates us keyboard codes, (e.g. the guest is
|
||||
|
||||
@@ -110,8 +110,8 @@ class I8042 : public BasicPioDevice
|
||||
std::vector<IntSourcePin<I8042> *> mouseIntPin;
|
||||
std::vector<IntSourcePin<I8042> *> keyboardIntPin;
|
||||
|
||||
PS2Device *mouse;
|
||||
PS2Device *keyboard;
|
||||
ps2::Device *mouse;
|
||||
ps2::Device *keyboard;
|
||||
|
||||
void writeData(uint8_t newData, bool mouse = false);
|
||||
uint8_t readDataOut();
|
||||
|
||||
Reference in New Issue
Block a user