cm4000_cs.h 1.8 KB

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