Daniel Carvalho has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/45393 )

Change subject: base,dev: Remove ps2::Mouse namespace
......................................................................

base,dev: Remove ps2::Mouse namespace

As part of recent decisions regarding namespace
naming conventions, all namespaces will be changed
to snake case.

This namespace didn't bring any benefit on top of
the existing PS2Mouse class, so it was removed.

Change-Id: Ieecad4f6bc2e5e2844f165f317da7e51d7593923
Signed-off-by: Daniel R. Carvalho <[email protected]>
---
M src/dev/ps2/mouse.cc
M src/dev/ps2/mouse.hh
M src/dev/ps2/touchkit.cc
M src/dev/ps2/types.cc
M src/dev/ps2/types.hh
M src/dev/x86/i8042.cc
M src/dev/x86/i8042.hh
7 files changed, 44 insertions(+), 42 deletions(-)



diff --git a/src/dev/ps2/mouse.cc b/src/dev/ps2/mouse.cc
index 108a759..5d71019 100644
--- a/src/dev/ps2/mouse.cc
+++ b/src/dev/ps2/mouse.cc
@@ -47,6 +47,8 @@
 #include "params/PS2Mouse.hh"
 #include "sim/serialize.hh"

+const std::vector<uint8_t> PS2Mouse::ID{0x00};
+
 PS2Mouse::PS2Mouse(const PS2MouseParams &p)
     : PS2Device(p),
       status(0), resolution(4), sampleRate(100)
@@ -60,7 +62,7 @@
       case ps2::ReadID:
         DPRINTF(PS2, "Mouse ID requested.\n");
         sendAck();
-        send(ps2::Mouse::ID);
+        send(ID);
         return true;
       case ps2::Disable:
         DPRINTF(PS2, "Disabling data reporting.\n");
@@ -82,20 +84,20 @@
         status.enabled = 0;
         sendAck();
         send(ps2::SelfTestPass);
-        send(ps2::Mouse::ID);
+        send(ID);
         return true;

-      case ps2::Mouse::Scale1to1:
+      case Scale1to1:
         DPRINTF(PS2, "Setting mouse scale to 1:1.\n");
         status.twoToOne = 0;
         sendAck();
         return true;
-      case ps2::Mouse::Scale2to1:
+      case Scale2to1:
         DPRINTF(PS2, "Setting mouse scale to 2:1.\n");
         status.twoToOne = 1;
         sendAck();
         return true;
-      case ps2::Mouse::SetResolution:
+      case SetResolution:
         if (data.size() == 1) {
             DPRINTF(PS2, "Setting mouse resolution.\n");
             sendAck();
@@ -106,22 +108,22 @@
             sendAck();
             return true;
         }
-      case ps2::Mouse::GetStatus:
+      case 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 ReadData:
         panic("Reading mouse data unimplemented.\n");
-      case ps2::Mouse::ResetWrapMode:
+      case ResetWrapMode:
         panic("Resetting mouse wrap mode unimplemented.\n");
-      case ps2::Mouse::WrapMode:
+      case WrapMode:
         panic("Setting mouse wrap mode unimplemented.\n");
-      case ps2::Mouse::RemoteMode:
+      case RemoteMode:
         panic("Setting mouse remote mode unimplemented.\n");
-      case ps2::Mouse::SampleRate:
+      case SampleRate:
         if (data.size() == 1) {
             DPRINTF(PS2, "Setting mouse sample rate.\n");
             sendAck();
diff --git a/src/dev/ps2/mouse.hh b/src/dev/ps2/mouse.hh
index 0a526db..7536cd9 100644
--- a/src/dev/ps2/mouse.hh
+++ b/src/dev/ps2/mouse.hh
@@ -41,6 +41,9 @@
 #ifndef __DEV_PS2_MOUSE_HH__
 #define __DEV_PS2_MOUSE_HH__

+#include <cstdint>
+#include <vector>
+
 #include "base/bitunion.hh"
 #include "dev/ps2/device.hh"

@@ -62,6 +65,21 @@
     uint8_t sampleRate;

   public:
+    enum
+    {
+        Scale1to1 = 0xE6,
+        Scale2to1 = 0xE7,
+        SetResolution = 0xE8,
+        GetStatus = 0xE9,
+        ReadData = 0xEB,
+        ResetWrapMode = 0xEC,
+        WrapMode = 0xEE,
+        RemoteMode = 0xF0,
+        SampleRate = 0xF3,
+    };
+
+    static const std::vector<uint8_t> ID;
+
     PS2Mouse(const PS2MouseParams &p);

     void serialize(CheckpointOut &cp) const override;
@@ -71,5 +89,7 @@
     bool recv(const std::vector<uint8_t> &data) override;
 };

+const std::vector<uint8_t> PS2Mouse::ID{0x00};
+
 #endif // __DEV_PS2_MOUSE_hH__

diff --git a/src/dev/ps2/touchkit.cc b/src/dev/ps2/touchkit.cc
index f07a2b4..8b564b1 100644
--- a/src/dev/ps2/touchkit.cc
+++ b/src/dev/ps2/touchkit.cc
@@ -87,7 +87,7 @@

       case ps2::ReadID:
         sendAck();
-        send(ps2::Mouse::ID);
+        send(PS2Mouse::ID);
         return true;

       case ps2::Disable:
@@ -108,17 +108,17 @@
         sendAck();
         return true;

-      case ps2::Mouse::Scale1to1:
-      case ps2::Mouse::Scale2to1:
+      case PS2Mouse::Scale1to1:
+      case PS2Mouse::Scale2to1:
         sendAck();
         return true;

-      case ps2::Mouse::SetResolution:
-      case ps2::Mouse::SampleRate:
+      case PS2Mouse::SetResolution:
+      case PS2Mouse::SampleRate:
         sendAck();
         return data.size() == 2;

-      case ps2::Mouse::GetStatus:
+      case PS2Mouse::GetStatus:
         sendAck();
         send(0);
         send(2); // default resolution
diff --git a/src/dev/ps2/types.cc b/src/dev/ps2/types.cc
index 78f71ff..bb2233a 100644
--- a/src/dev/ps2/types.cc
+++ b/src/dev/ps2/types.cc
@@ -43,7 +43,6 @@
 #include "x11keysym/keysym.h"

 const std::vector<uint8_t> ps2::Keyboard::ID{0xAB, 0x83};
-const std::vector<uint8_t> ps2::Mouse::ID{0x00};

 namespace ps2 {

diff --git a/src/dev/ps2/types.hh b/src/dev/ps2/types.hh
index 2b4decc..8c5d3a0 100644
--- a/src/dev/ps2/types.hh
+++ b/src/dev/ps2/types.hh
@@ -87,25 +87,6 @@

 };

-namespace Mouse {
-
-enum
-{
-    Scale1to1 = 0xE6,
-    Scale2to1 = 0xE7,
-    SetResolution = 0xE8,
-    GetStatus = 0xE9,
-    ReadData = 0xEB,
-    ResetWrapMode = 0xEC,
-    WrapMode = 0xEE,
-    RemoteMode = 0xF0,
-    SampleRate = 0xF3,
-};
-
-extern const std::vector<uint8_t> ID;
-
-};
-
 /** A bitfield that represents the first byte of a mouse movement packet
  */
 BitUnion8(Ps2MouseMovement)
diff --git a/src/dev/x86/i8042.cc b/src/dev/x86/i8042.cc
index c6c1dd4..5fd001e 100644
--- a/src/dev/x86/i8042.cc
+++ b/src/dev/x86/i8042.cc
@@ -84,20 +84,20 @@
 }

 void
-X86ISA::I8042::writeData(uint8_t newData, bool mouse)
+X86ISA::I8042::writeData(uint8_t newData, bool mouse_output_full)
 {
     DPRINTF(I8042, "Set data %#02x.\n", newData);
     dataReg = newData;
     statusReg.outputFull = 1;
-    statusReg.mouseOutputFull = (mouse ? 1 : 0);
-    if (!mouse && commandByte.keyboardFullInt) {
+    statusReg.mouseOutputFull = (mouse_output_full ? 1 : 0);
+    if (!mouse_output_full && commandByte.keyboardFullInt) {
         DPRINTF(I8042, "Sending keyboard interrupt.\n");
         for (auto *wire: keyboardIntPin) {
             wire->raise();
             //This is a hack
             wire->lower();
         }
-    } else if (mouse && commandByte.mouseFullInt) {
+    } else if (mouse_output_full && commandByte.mouseFullInt) {
         DPRINTF(I8042, "Sending mouse interrupt.\n");
         for (auto *wire: mouseIntPin) {
             wire->raise();
diff --git a/src/dev/x86/i8042.hh b/src/dev/x86/i8042.hh
index 1cde2cd..f05403a 100644
--- a/src/dev/x86/i8042.hh
+++ b/src/dev/x86/i8042.hh
@@ -113,7 +113,7 @@
     PS2Device *mouse;
     PS2Device *keyboard;

-    void writeData(uint8_t newData, bool mouse = false);
+    void writeData(uint8_t newData, bool mouse_output_full = false);
     uint8_t readDataOut();

   public:

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/45393
To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: Ieecad4f6bc2e5e2844f165f317da7e51d7593923
Gerrit-Change-Number: 45393
Gerrit-PatchSet: 1
Gerrit-Owner: Daniel Carvalho <[email protected]>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

Reply via email to