blob: d8990446c85bb4a0ce58ecebd281178494c8e873 [file] [log] [blame]
Chiranjeevi Velempatie130fd02011-11-29 05:06:13 +05301/*
Duy Truong790f06d2013-02-13 16:38:12 -08002 * Copyright (c) 2011, The Linux Foundation. All rights reserved.
Chiranjeevi Velempatie130fd02011-11-29 05:06:13 +05303
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 and
6 * only version 2 as published by the Free Software Foundation.
7
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details
12 */
13
14#ifndef __F_CCID_H
15#define __F_CCID_H
16
17#define PROTOCOL_TO 0x01
18#define PROTOCOL_T1 0x02
19#define ABDATA_SIZE 512
20
21/* define for dwFeatures for Smart Card Device Class Descriptors */
22/* No special characteristics */
23#define CCID_FEATURES_NADA 0x00000000
24/* Automatic parameter configuration based on ATR data */
25#define CCID_FEATURES_AUTO_PCONF 0x00000002
26/* Automatic activation of ICC on inserting */
27#define CCID_FEATURES_AUTO_ACTIV 0x00000004
28/* Automatic ICC voltage selection */
29#define CCID_FEATURES_AUTO_VOLT 0x00000008
30/* Automatic ICC clock frequency change */
31#define CCID_FEATURES_AUTO_CLOCK 0x00000010
32/* Automatic baud rate change */
33#define CCID_FEATURES_AUTO_BAUD 0x00000020
34/*Automatic parameters negotiation made by the CCID */
35#define CCID_FEATURES_AUTO_PNEGO 0x00000040
36/* Automatic PPS made by the CCID according to the active parameters */
37#define CCID_FEATURES_AUTO_PPS 0x00000080
38/* CCID can set ICC in clock stop mode */
39#define CCID_FEATURES_ICCSTOP 0x00000100
40/* NAD value other than 00 accepted (T=1 protocol in use) */
41#define CCID_FEATURES_NAD 0x00000200
42/* Automatic IFSD exchange as first exchange (T=1 protocol in use) */
43#define CCID_FEATURES_AUTO_IFSD 0x00000400
44/* TPDU level exchanges with CCID */
45#define CCID_FEATURES_EXC_TPDU 0x00010000
46/* Short APDU level exchange with CCID */
47#define CCID_FEATURES_EXC_SAPDU 0x00020000
48/* Short and Extended APDU level exchange with CCID */
49#define CCID_FEATURES_EXC_APDU 0x00040000
50/* USB Wake up signaling supported on card insertion and removal */
51#define CCID_FEATURES_WAKEUP 0x00100000
52
53#define CCID_NOTIFY_CARD _IOW('C', 1, struct usb_ccid_notification)
54#define CCID_NOTIFY_HWERROR _IOW('C', 2, struct usb_ccid_notification)
55#define CCID_READ_DTR _IOR('C', 3, int)
56
57struct usb_ccid_notification {
58 unsigned char buf[4];
59} __packed;
60
61struct ccid_bulk_in_header {
62 unsigned char bMessageType;
63 unsigned long wLength;
64 unsigned char bSlot;
65 unsigned char bSeq;
66 unsigned char bStatus;
67 unsigned char bError;
68 unsigned char bSpecific;
69 unsigned char abData[ABDATA_SIZE];
70 unsigned char bSizeToSend;
71} __packed;
72
73struct ccid_bulk_out_header {
74 unsigned char bMessageType;
75 unsigned long wLength;
76 unsigned char bSlot;
77 unsigned char bSeq;
78 unsigned char bSpecific_0;
79 unsigned char bSpecific_1;
80 unsigned char bSpecific_2;
81 unsigned char APDU[ABDATA_SIZE];
82} __packed;
83#endif