summaryrefslogtreecommitdiff
path: root/hw/ccid.h
diff options
context:
space:
mode:
authorAnthony Liguori <aliguori@us.ibm.com>2011-12-04 12:34:10 -0600
committerAnthony Liguori <aliguori@us.ibm.com>2012-01-27 10:50:47 -0600
commitba7c05205c4ba2fd08096b0083fc1e5decf3c342 (patch)
tree4f51677a29c97582ae914b94d6884e8857284aba /hw/ccid.h
parent62aed76583fe8bf8e6ba5955b2ecfa3619ea3540 (diff)
downloadqemu-ba7c05205c4ba2fd08096b0083fc1e5decf3c342.tar.gz
qemu-ba7c05205c4ba2fd08096b0083fc1e5decf3c342.tar.bz2
qemu-ba7c05205c4ba2fd08096b0083fc1e5decf3c342.zip
ccid: convert to QEMU Object Model
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw/ccid.h')
-rw-r--r--hw/ccid.h28
1 files changed, 18 insertions, 10 deletions
diff --git a/hw/ccid.h b/hw/ccid.h
index 9e3abe1b4c..9e4979c60e 100644
--- a/hw/ccid.h
+++ b/hw/ccid.h
@@ -15,26 +15,34 @@
typedef struct CCIDCardState CCIDCardState;
typedef struct CCIDCardInfo CCIDCardInfo;
-/*
- * state of the CCID Card device (i.e. hw/ccid-card-*.c)
- */
-struct CCIDCardState {
- DeviceState qdev;
- uint32_t slot; /* For future use with multiple slot reader. */
-};
+#define TYPE_CCID_CARD "ccid-card"
+#define CCID_CARD(obj) \
+ OBJECT_CHECK(CCIDCardState, (obj), TYPE_CCID_CARD)
+#define CCID_CARD_CLASS(klass) \
+ OBJECT_CLASS_CHECK(CCIDCardClass, (klass), TYPE_CCID_CARD)
+#define CCID_CARD_GET_CLASS(obj) \
+ OBJECT_GET_CLASS(CCIDCardClass, (obj), TYPE_CCID_CARD)
/*
* callbacks to be used by the CCID device (hw/usb-ccid.c) to call
* into the smartcard device (hw/ccid-card-*.c)
*/
-struct CCIDCardInfo {
- DeviceInfo qdev;
+typedef struct CCIDCardClass {
+ DeviceClass parent_class;
const uint8_t *(*get_atr)(CCIDCardState *card, uint32_t *len);
void (*apdu_from_guest)(CCIDCardState *card,
const uint8_t *apdu,
uint32_t len);
int (*exitfn)(CCIDCardState *card);
int (*initfn)(CCIDCardState *card);
+} CCIDCardClass;
+
+/*
+ * state of the CCID Card device (i.e. hw/ccid-card-*.c)
+ */
+struct CCIDCardState {
+ DeviceState qdev;
+ uint32_t slot; /* For future use with multiple slot reader. */
};
/*
@@ -46,7 +54,7 @@ void ccid_card_send_apdu_to_guest(CCIDCardState *card,
void ccid_card_card_removed(CCIDCardState *card);
void ccid_card_card_inserted(CCIDCardState *card);
void ccid_card_card_error(CCIDCardState *card, uint64_t error);
-void ccid_card_qdev_register(CCIDCardInfo *card);
+void ccid_card_qdev_register(DeviceInfo *card);
/*
* support guest visible insertion/removal of ccid devices based on actual