cm4000_cs.h 1.7 KB

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