cm4000_cs.h 1.8 KB

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