ccid_message.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. /* Copyright (C) 2020 RDA Technologies Limited and/or its affiliates("RDA").
  2. * All rights reserved.
  3. *
  4. * This software is supplied "AS IS" without any warranties.
  5. * RDA assumes no responsibility or liability for the use of the software,
  6. * conveys no license or title under any patent, copyright, or mask work
  7. * right to the product. RDA reserves the right to make changes in the
  8. * software without notification. RDA also make no representation or
  9. * warranty that such application will be suitable for the specified use
  10. * without further testing or modification.
  11. */
  12. #ifndef _USB_CCID_MESSAGE_H_
  13. #define _USB_CCID_MESSAGE_H_
  14. #include <stdint.h>
  15. #define CCID_RDRTOPC_NOTIFY_SLOT_CHANGE 0x50
  16. #define CCID_RDRTOPC_HARDWARE_ERROR 0x51
  17. #define ABDATA_SIZE 512
  18. // refer to ccid spec 6.3
  19. struct ccid_notification
  20. {
  21. uint8_t bMessageType;
  22. union {
  23. uint8_t buf[3];
  24. struct
  25. {
  26. uint8_t bSlot;
  27. uint8_t bSeq;
  28. uint8_t bHardwareErrorCode;
  29. };
  30. };
  31. } __attribute__((packed));
  32. struct ccid_bulk_in_header
  33. {
  34. uint8_t bMessageType;
  35. uint32_t dwLength;
  36. uint8_t bSlot;
  37. uint8_t bSeq;
  38. uint8_t bStatus;
  39. uint8_t bError;
  40. uint8_t bSpecific;
  41. uint8_t abData[ABDATA_SIZE];
  42. uint8_t bSizeToSend;
  43. } __attribute__((packed));
  44. struct ccid_bulk_out_header
  45. {
  46. uint8_t bMessageType;
  47. uint32_t dwLength;
  48. uint8_t bSlot;
  49. uint8_t bSeq;
  50. uint8_t bSpecific_0;
  51. uint8_t bSpecific_1;
  52. uint8_t bSpecific_2;
  53. uint8_t APDU[ABDATA_SIZE];
  54. } __attribute__((packed));
  55. #endif