aboutsummaryrefslogtreecommitdiff
path: root/hw/adb.h
diff options
context:
space:
mode:
authorAndreas Färber <afaerber@suse.de>2013-01-23 23:04:03 +0000
committerAlexander Graf <agraf@suse.de>2013-01-25 22:02:55 +0100
commit84ede329083b649c54f078276e7e06d48e910b9d (patch)
tree50995b149b5ab378f16170f8bc0f6567cc18d30a /hw/adb.h
parent45fa67fb68e73b395cd93ec97e45785944d4ee6a (diff)
adb: QOM'ify Apple Desktop Bus
It was not a qbus before, turn it into a first-class bus and initialize it properly from CUDA. Leave it a global variable as long as devices are not QOM'ified yet. Signed-off-by: Andreas Färber <afaerber@suse.de> Signed-off-by: Alexander Graf <agraf@suse.de>
Diffstat (limited to 'hw/adb.h')
-rw-r--r--hw/adb.h16
1 files changed, 13 insertions, 3 deletions
diff --git a/hw/adb.h b/hw/adb.h
index 5b27da2dd3..c23f804fe4 100644
--- a/hw/adb.h
+++ b/hw/adb.h
@@ -26,10 +26,13 @@
#if !defined(__ADB_H__)
#define __ADB_H__
+#include "qdev.h"
+
#define MAX_ADB_DEVICES 16
#define ADB_MAX_OUT_LEN 16
+typedef struct ADBBusState ADBBusState;
typedef struct ADBDevice ADBDevice;
/* buf = NULL means polling */
@@ -38,7 +41,7 @@ typedef int ADBDeviceRequest(ADBDevice *d, uint8_t *buf_out,
typedef int ADBDeviceReset(ADBDevice *d);
struct ADBDevice {
- struct ADBBusState *bus;
+ ADBBusState *bus;
int devaddr;
int handler;
ADBDeviceRequest *devreq;
@@ -46,11 +49,18 @@ struct ADBDevice {
void *opaque;
};
-typedef struct ADBBusState {
+#define TYPE_ADB_BUS "apple-desktop-bus"
+#define ADB_BUS(obj) OBJECT_CHECK(ADBBusState, (obj), TYPE_ADB_BUS)
+
+struct ADBBusState {
+ /*< private >*/
+ BusState parent_obj;
+ /*< public >*/
+
ADBDevice devices[MAX_ADB_DEVICES];
int nb_devices;
int poll_index;
-} ADBBusState;
+};
int adb_request(ADBBusState *s, uint8_t *buf_out,
const uint8_t *buf, int len);