summaryrefslogtreecommitdiff
path: root/src/dev/ps2/device.hh
diff options
context:
space:
mode:
Diffstat (limited to 'src/dev/ps2/device.hh')
-rw-r--r--src/dev/ps2/device.hh16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/dev/ps2/device.hh b/src/dev/ps2/device.hh
index 5252ac8d8..0ff31d4dc 100644
--- a/src/dev/ps2/device.hh
+++ b/src/dev/ps2/device.hh
@@ -45,6 +45,7 @@
#define __DEV_PS2_DEVICE_HH__
#include <deque>
+#include <vector>
#include "sim/sim_object.hh"
@@ -92,8 +93,18 @@ class PS2Device : public SimObject
protected: /* Device interface */
/**
* Data received from host.
+ *
+ * Data sent to the device is buffered one byte at a time. Each
+ * time a byte is added, this function is called and passed the
+ * current buffer. It should return true if it has consumed the
+ * data and the buffer can be cleared, or false if more data is
+ * needed to process the current command.
+ *
+ * @param data Pending input data (at least one byte)
+ * @return false if more data is needed to process the current
+ * command, true otherwise.
*/
- virtual void recv(uint8_t data) = 0;
+ virtual bool recv(const std::vector<uint8_t> &data) = 0;
/**
* Send data from a PS/2 device to a host
@@ -128,6 +139,9 @@ class PS2Device : public SimObject
/** Device -> host FIFO */
std::deque<uint8_t> outBuffer;
+ /** Host -> device buffer */
+ std::vector<uint8_t> inBuffer;
+
std::function<void()> dataAvailableCallback;
};