cm4000_cs.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. #ifndef _UAPI_CM4000_H_
  2. #define _UAPI_CM4000_H_
  3. #include <linux/types.h>
  4. #include <linux/ioctl.h>
  5. #define MAX_ATR 33
  6. #define CM4000_MAX_DEV 4
  7. /* those two structures are passed via ioctl() from/to userspace. They are
  8. * used by existing userspace programs, so I kepth the awkward "bIFSD" naming
  9. * not to break compilation of userspace apps. -HW */
  10. typedef struct atreq {
  11. __s32 atr_len;
  12. unsigned char atr[64];
  13. __s32 power_act;
  14. unsigned char bIFSD;
  15. unsigned char bIFSC;
  16. } atreq_t;
  17. /* what is particularly stupid in the original driver is the arch-dependent
  18. * member sizes. This leads to CONFIG_COMPAT breakage, since 32bit userspace
  19. * will lay out the structure members differently than the 64bit kernel.
  20. *
  21. * I've changed "ptsreq.protocol" from "unsigned long" to "__u32".
  22. * On 32bit this will make no difference. With 64bit kernels, it will make
  23. * 32bit apps work, too.
  24. */
  25. typedef struct ptsreq {
  26. __u32 protocol; /*T=0: 2^0, T=1: 2^1*/
  27. unsigned char flags;
  28. unsigned char pts1;
  29. unsigned char pts2;
  30. unsigned char pts3;
  31. } ptsreq_t;
  32. #define CM_IOC_MAGIC 'c'
  33. #define CM_IOC_MAXNR 255
  34. #define CM_IOCGSTATUS _IOR (CM_IOC_MAGIC, 0, unsigned char *)
  35. #define CM_IOCGATR _IOWR(CM_IOC_MAGIC, 1, atreq_t *)
  36. #define CM_IOCSPTS _IOW (CM_IOC_MAGIC, 2, ptsreq_t *)
  37. #define CM_IOCSRDR _IO (CM_IOC_MAGIC, 3)
  38. #define CM_IOCARDOFF _IO (CM_IOC_MAGIC, 4)
  39. #define CM_IOSDBGLVL _IOW(CM_IOC_MAGIC, 250, int*)
  40. /* card and device states */
  41. #define CM_CARD_INSERTED 0x01
  42. #define CM_CARD_POWERED 0x02
  43. #define CM_ATR_PRESENT 0x04
  44. #define CM_ATR_VALID 0x08
  45. #define CM_STATE_VALID 0x0f
  46. /* extra info only from CM4000 */
  47. #define CM_NO_READER 0x10
  48. #define CM_BAD_CARD 0x20
  49. #endif /* _UAPI_CM4000_H_ */