f_ccid.h 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (c) 2011, 2017 The Linux Foundation. All rights reserved.
  4. * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
  5. */
  6. #ifndef __F_CCID_H
  7. #define __F_CCID_H
  8. #define PROTOCOL_TO 0x01
  9. #define PROTOCOL_T1 0x02
  10. #define ABDATA_SIZE 512
  11. /* define for dwFeatures for Smart Card Device Class Descriptors */
  12. /* No special characteristics */
  13. #define CCID_FEATURES_NADA 0x00000000
  14. /* Automatic parameter configuration based on ATR data */
  15. #define CCID_FEATURES_AUTO_PCONF 0x00000002
  16. /* Automatic activation of ICC on inserting */
  17. #define CCID_FEATURES_AUTO_ACTIV 0x00000004
  18. /* Automatic ICC voltage selection */
  19. #define CCID_FEATURES_AUTO_VOLT 0x00000008
  20. /* Automatic ICC clock frequency change */
  21. #define CCID_FEATURES_AUTO_CLOCK 0x00000010
  22. /* Automatic baud rate change */
  23. #define CCID_FEATURES_AUTO_BAUD 0x00000020
  24. /*Automatic parameters negotiation made by the CCID */
  25. #define CCID_FEATURES_AUTO_PNEGO 0x00000040
  26. /* Automatic PPS made by the CCID according to the active parameters */
  27. #define CCID_FEATURES_AUTO_PPS 0x00000080
  28. /* CCID can set ICC in clock stop mode */
  29. #define CCID_FEATURES_ICCSTOP 0x00000100
  30. /* NAD value other than 00 accepted (T=1 protocol in use) */
  31. #define CCID_FEATURES_NAD 0x00000200
  32. /* Automatic IFSD exchange as first exchange (T=1 protocol in use) */
  33. #define CCID_FEATURES_AUTO_IFSD 0x00000400
  34. /* TPDU level exchanges with CCID */
  35. #define CCID_FEATURES_EXC_TPDU 0x00010000
  36. /* Short APDU level exchange with CCID */
  37. #define CCID_FEATURES_EXC_SAPDU 0x00020000
  38. /* Short and Extended APDU level exchange with CCID */
  39. #define CCID_FEATURES_EXC_APDU 0x00040000
  40. /* USB Wake up signaling supported on card insertion and removal */
  41. #define CCID_FEATURES_WAKEUP 0x00100000
  42. #define CCID_NOTIFY_CARD _IOW('C', 1, struct usb_ccid_notification)
  43. #define CCID_NOTIFY_HWERROR _IOW('C', 2, struct usb_ccid_notification)
  44. #define CCID_READ_DTR _IOR('C', 3, int)
  45. struct usb_ccid_notification {
  46. __u8 buf[4];
  47. } __packed;
  48. struct ccid_bulk_in_header {
  49. __u8 bMessageType;
  50. __u32 wLength;
  51. __u8 bSlot;
  52. __u8 bSeq;
  53. __u8 bStatus;
  54. __u8 bError;
  55. __u8 bSpecific;
  56. __u8 abData[ABDATA_SIZE];
  57. __u8 bSizeToSend;
  58. } __packed;
  59. struct ccid_bulk_out_header {
  60. __u8 bMessageType;
  61. __u32 wLength;
  62. __u8 bSlot;
  63. __u8 bSeq;
  64. __u8 bSpecific_0;
  65. __u8 bSpecific_1;
  66. __u8 bSpecific_2;
  67. __u8 APDU[ABDATA_SIZE];
  68. } __packed;
  69. #endif