diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2013-03-18 17:36:02 +0100 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2013-04-08 18:13:16 +0200 |
commit | 47b43a1f414c5b3eb9eb7502d0b0be0d134259ba (patch) | |
tree | 9acfd03f458083a077ac79bd462d5360916f445f /hw/usb | |
parent | 8d8b636d28a97af7bf43c3267d07f87b9530939a (diff) |
hw: move private headers to hw/ subdirectories.
Many headers are used only in a single directory. These can be
kept in hw/.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'hw/usb')
-rw-r--r-- | hw/usb/ccid-card-emulated.c | 2 | ||||
-rw-r--r-- | hw/usb/ccid-card-passthru.c | 2 | ||||
-rw-r--r-- | hw/usb/ccid.h | 65 | ||||
-rw-r--r-- | hw/usb/dev-smartcard-reader.c | 2 |
4 files changed, 68 insertions, 3 deletions
diff --git a/hw/usb/ccid-card-emulated.c b/hw/usb/ccid-card-emulated.c index c8f8ba3792..29dcd7acbf 100644 --- a/hw/usb/ccid-card-emulated.c +++ b/hw/usb/ccid-card-emulated.c @@ -34,7 +34,7 @@ #include "qemu/thread.h" #include "char/char.h" #include "monitor/monitor.h" -#include "hw/ccid.h" +#include "ccid.h" #define DPRINTF(card, lvl, fmt, ...) \ do {\ diff --git a/hw/usb/ccid-card-passthru.c b/hw/usb/ccid-card-passthru.c index 984bd0bf4c..5e017ae0ca 100644 --- a/hw/usb/ccid-card-passthru.c +++ b/hw/usb/ccid-card-passthru.c @@ -11,7 +11,7 @@ #include "char/char.h" #include "qemu/sockets.h" #include "monitor/monitor.h" -#include "hw/ccid.h" +#include "ccid.h" #include "libcacard/vscard_common.h" #define DPRINTF(card, lvl, fmt, ...) \ diff --git a/hw/usb/ccid.h b/hw/usb/ccid.h new file mode 100644 index 0000000000..9334da8acd --- /dev/null +++ b/hw/usb/ccid.h @@ -0,0 +1,65 @@ +/* + * CCID Passthru Card Device emulation + * + * Copyright (c) 2011 Red Hat. + * Written by Alon Levy. + * + * This code is licensed under the GNU LGPL, version 2 or later. + */ + +#ifndef CCID_H +#define CCID_H + +#include "hw/qdev.h" + +typedef struct CCIDCardState CCIDCardState; +typedef struct CCIDCardInfo CCIDCardInfo; + +#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) + */ +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. */ +}; + +/* + * API for smartcard calling the CCID device (used by hw/ccid-card-*.c) + */ +void ccid_card_send_apdu_to_guest(CCIDCardState *card, + uint8_t *apdu, + uint32_t len); +void ccid_card_card_removed(CCIDCardState *card); +void ccid_card_card_inserted(CCIDCardState *card); +void ccid_card_card_error(CCIDCardState *card, uint64_t error); + +/* + * support guest visible insertion/removal of ccid devices based on actual + * devices connected/removed. Called by card implementation (passthru, local) + */ +int ccid_card_ccid_attach(CCIDCardState *card); +void ccid_card_ccid_detach(CCIDCardState *card); + +#endif /* CCID_H */ diff --git a/hw/usb/dev-smartcard-reader.c b/hw/usb/dev-smartcard-reader.c index caebc1c3ff..db8ce02151 100644 --- a/hw/usb/dev-smartcard-reader.c +++ b/hw/usb/dev-smartcard-reader.c @@ -40,7 +40,7 @@ #include "hw/usb/desc.h" #include "monitor/monitor.h" -#include "hw/ccid.h" +#include "ccid.h" #define DPRINTF(s, lvl, fmt, ...) \ do { \ |