linux-user: add pselect6 syscall support
[qemu.git] / hw / ccid.h
blobdbfc13c4f53dcf462665c235314219ec92e45c0c
1 /*
2 * CCID Passthru Card Device emulation
4 * Copyright (c) 2011 Red Hat.
5 * Written by Alon Levy.
7 * This code is licenced under the GNU LGPL, version 2 or later.
8 */
10 #ifndef CCID_H
11 #define CCID_H
13 #include "qdev.h"
15 typedef struct CCIDCardState CCIDCardState;
16 typedef struct CCIDCardInfo CCIDCardInfo;
19 * state of the CCID Card device (i.e. hw/ccid-card-*.c)
21 struct CCIDCardState {
22 DeviceState qdev;
23 uint32_t slot; /* For future use with multiple slot reader. */
27 * callbacks to be used by the CCID device (hw/usb-ccid.c) to call
28 * into the smartcard device (hw/ccid-card-*.c)
30 struct CCIDCardInfo {
31 DeviceInfo qdev;
32 void (*print)(Monitor *mon, CCIDCardState *card, int indent);
33 const uint8_t *(*get_atr)(CCIDCardState *card, uint32_t *len);
34 void (*apdu_from_guest)(CCIDCardState *card,
35 const uint8_t *apdu,
36 uint32_t len);
37 int (*exitfn)(CCIDCardState *card);
38 int (*initfn)(CCIDCardState *card);
42 * API for smartcard calling the CCID device (used by hw/ccid-card-*.c)
44 void ccid_card_send_apdu_to_guest(CCIDCardState *card,
45 uint8_t *apdu,
46 uint32_t len);
47 void ccid_card_card_removed(CCIDCardState *card);
48 void ccid_card_card_inserted(CCIDCardState *card);
49 void ccid_card_card_error(CCIDCardState *card, uint64_t error);
50 void ccid_card_qdev_register(CCIDCardInfo *card);
53 * support guest visible insertion/removal of ccid devices based on actual
54 * devices connected/removed. Called by card implementation (passthru, local)
56 int ccid_card_ccid_attach(CCIDCardState *card);
57 void ccid_card_ccid_detach(CCIDCardState *card);
59 #endif /* CCID_H */