f_ccid.h 2.8 KB

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