aboutsummaryrefslogtreecommitdiff
path: root/include/hw
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2020-06-26 12:14:18 +0100
committerPeter Maydell <peter.maydell@linaro.org>2020-06-26 12:14:18 +0100
commit10f7ffabf9c507fc02382b89912003b1c43c3231 (patch)
tree874dccf979f03f5553e6103d39b86bae9046b743 /include/hw
parent611ac63305ff577604e2a7bacf4f204568e08bef (diff)
parente590e7f01479a1d4544aac062fe9fdb986502294 (diff)
Merge remote-tracking branch 'remotes/mcayland/tags/qemu-macppc-20200626' into staging
qemu-macppc patches # gpg: Signature made Fri 26 Jun 2020 10:15:36 BST # gpg: using RSA key CC621AB98E82200D915CC9C45BC2C56FAE0F321F # gpg: issuer "mark.cave-ayland@ilande.co.uk" # gpg: Good signature from "Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>" [full] # Primary key fingerprint: CC62 1AB9 8E82 200D 915C C9C4 5BC2 C56F AE0F 321F * remotes/mcayland/tags/qemu-macppc-20200626: (22 commits) adb: add ADB bus trace events adb: use adb_device prefix for ADB device trace events adb: only call autopoll callbacks when autopoll is not blocked mac_via: rework ADB state machine to be compatible with both MacOS and Linux mac_via: move VIA1 portB write logic into mos6522_q800_via1_write() pmu: add adb_autopoll_block() and adb_autopoll_unblock() functions cuda: add adb_autopoll_block() and adb_autopoll_unblock() functions adb: add autopoll_blocked variable to block autopoll adb: use adb_request() only for explicit requests adb: add status field for holding information about the last ADB request adb: keep track of devices with pending data adb: introduce new ADBDeviceHasData method to ADBDeviceClass mac_via: convert to use ADBBusState internal autopoll variables pmu: convert to use ADBBusState internal autopoll variables cuda: convert to use ADBBusState internal autopoll variables adb: create autopoll variables directly within ADBBusState adb: introduce realize/unrealize and VMStateDescription for ADB bus pmu: honour autopoll_rate_ms when rearming the ADB autopoll timer pmu: fix duplicate autopoll mask variable cuda: convert ADB autopoll timer from ns to ms ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'include/hw')
-rw-r--r--include/hw/input/adb.h26
-rw-r--r--include/hw/misc/mac_via.h2
-rw-r--r--include/hw/misc/macio/cuda.h4
-rw-r--r--include/hw/misc/macio/pmu.h4
4 files changed, 26 insertions, 10 deletions
diff --git a/include/hw/input/adb.h b/include/hw/input/adb.h
index b7b32e2b16..bb75a7b1e3 100644
--- a/include/hw/input/adb.h
+++ b/include/hw/input/adb.h
@@ -39,6 +39,8 @@ typedef struct ADBDevice ADBDevice;
typedef int ADBDeviceRequest(ADBDevice *d, uint8_t *buf_out,
const uint8_t *buf, int len);
+typedef bool ADBDeviceHasData(ADBDevice *d);
+
#define TYPE_ADB_DEVICE "adb-device"
#define ADB_DEVICE(obj) OBJECT_CHECK(ADBDevice, (obj), TYPE_ADB_DEVICE)
@@ -49,7 +51,6 @@ struct ADBDevice {
int devaddr;
int handler;
- bool disable_direct_reg3_writes;
};
#define ADB_DEVICE_CLASS(cls) \
@@ -63,25 +64,48 @@ typedef struct ADBDeviceClass {
/*< public >*/
ADBDeviceRequest *devreq;
+ ADBDeviceHasData *devhasdata;
} ADBDeviceClass;
#define TYPE_ADB_BUS "apple-desktop-bus"
#define ADB_BUS(obj) OBJECT_CHECK(ADBBusState, (obj), TYPE_ADB_BUS)
+#define ADB_STATUS_BUSTIMEOUT 0x1
+#define ADB_STATUS_POLLREPLY 0x2
+
struct ADBBusState {
/*< private >*/
BusState parent_obj;
/*< public >*/
ADBDevice *devices[MAX_ADB_DEVICES];
+ uint16_t pending;
int nb_devices;
int poll_index;
+ uint8_t status;
+
+ QEMUTimer *autopoll_timer;
+ bool autopoll_enabled;
+ bool autopoll_blocked;
+ uint8_t autopoll_rate_ms;
+ uint16_t autopoll_mask;
+ void (*autopoll_cb)(void *opaque);
+ void *autopoll_cb_opaque;
};
int adb_request(ADBBusState *s, uint8_t *buf_out,
const uint8_t *buf, int len);
int adb_poll(ADBBusState *s, uint8_t *buf_out, uint16_t poll_mask);
+void adb_autopoll_block(ADBBusState *s);
+void adb_autopoll_unblock(ADBBusState *s);
+
+void adb_set_autopoll_enabled(ADBBusState *s, bool enabled);
+void adb_set_autopoll_rate_ms(ADBBusState *s, int rate_ms);
+void adb_set_autopoll_mask(ADBBusState *s, uint16_t mask);
+void adb_register_autopoll_callback(ADBBusState *s, void (*cb)(void *opaque),
+ void *opaque);
+
#define TYPE_ADB_KEYBOARD "adb-keyboard"
#define TYPE_ADB_MOUSE "adb-mouse"
diff --git a/include/hw/misc/mac_via.h b/include/hw/misc/mac_via.h
index e74f85be0f..0be05d649b 100644
--- a/include/hw/misc/mac_via.h
+++ b/include/hw/misc/mac_via.h
@@ -106,13 +106,13 @@ typedef struct MacVIAState {
/* ADB */
ADBBusState adb_bus;
- QEMUTimer *adb_poll_timer;
qemu_irq adb_data_ready;
int adb_data_in_size;
int adb_data_in_index;
int adb_data_out_index;
uint8_t adb_data_in[128];
uint8_t adb_data_out[16];
+ uint8_t adb_autopoll_cmd;
} MacVIAState;
#endif
diff --git a/include/hw/misc/macio/cuda.h b/include/hw/misc/macio/cuda.h
index 5768075ac5..a8cf0be1ec 100644
--- a/include/hw/misc/macio/cuda.h
+++ b/include/hw/misc/macio/cuda.h
@@ -95,12 +95,8 @@ typedef struct CUDAState {
int data_out_index;
qemu_irq irq;
- uint16_t adb_poll_mask;
- uint8_t autopoll_rate_ms;
- uint8_t autopoll;
uint8_t data_in[128];
uint8_t data_out[16];
- QEMUTimer *adb_poll_timer;
} CUDAState;
#endif /* CUDA_H */
diff --git a/include/hw/misc/macio/pmu.h b/include/hw/misc/macio/pmu.h
index 7ef83dee4c..72f75612b6 100644
--- a/include/hw/misc/macio/pmu.h
+++ b/include/hw/misc/macio/pmu.h
@@ -218,10 +218,6 @@ typedef struct PMUState {
/* ADB */
bool has_adb;
ADBBusState adb_bus;
- uint16_t adb_poll_mask;
- uint8_t autopoll_rate_ms;
- uint8_t autopoll_mask;
- QEMUTimer *adb_poll_timer;
uint8_t adb_reply_size;
uint8_t adb_reply[ADB_MAX_OUT_LEN];