]> git.proxmox.com Git - qemu.git/blame - hw/ccid.h
Merge remote-tracking branch 'kraxel/usb.31' into staging
[qemu.git] / hw / ccid.h
CommitLineData
36707144
AL
1/*
2 * CCID Passthru Card Device emulation
3 *
4 * Copyright (c) 2011 Red Hat.
5 * Written by Alon Levy.
6 *
8e31bf38 7 * This code is licensed under the GNU LGPL, version 2 or later.
36707144
AL
8 */
9
10#ifndef CCID_H
11#define CCID_H
12
13#include "qdev.h"
14
15typedef struct CCIDCardState CCIDCardState;
16typedef struct CCIDCardInfo CCIDCardInfo;
17
18/*
19 * state of the CCID Card device (i.e. hw/ccid-card-*.c)
20 */
21struct CCIDCardState {
22 DeviceState qdev;
23 uint32_t slot; /* For future use with multiple slot reader. */
24};
25
26/*
27 * callbacks to be used by the CCID device (hw/usb-ccid.c) to call
28 * into the smartcard device (hw/ccid-card-*.c)
29 */
30struct CCIDCardInfo {
31 DeviceInfo qdev;
36707144
AL
32 const uint8_t *(*get_atr)(CCIDCardState *card, uint32_t *len);
33 void (*apdu_from_guest)(CCIDCardState *card,
34 const uint8_t *apdu,
35 uint32_t len);
36 int (*exitfn)(CCIDCardState *card);
37 int (*initfn)(CCIDCardState *card);
38};
39
40/*
41 * API for smartcard calling the CCID device (used by hw/ccid-card-*.c)
42 */
43void ccid_card_send_apdu_to_guest(CCIDCardState *card,
44 uint8_t *apdu,
45 uint32_t len);
46void ccid_card_card_removed(CCIDCardState *card);
47void ccid_card_card_inserted(CCIDCardState *card);
48void ccid_card_card_error(CCIDCardState *card, uint64_t error);
49void ccid_card_qdev_register(CCIDCardInfo *card);
50
51/*
52 * support guest visible insertion/removal of ccid devices based on actual
53 * devices connected/removed. Called by card implementation (passthru, local)
54 */
55int ccid_card_ccid_attach(CCIDCardState *card);
56void ccid_card_ccid_detach(CCIDCardState *card);
57
58#endif /* CCID_H */