Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
0002 #ifndef _UAPI_CM4000_H_
0003 #define _UAPI_CM4000_H_
0004 
0005 #include <linux/types.h>
0006 #include <linux/ioctl.h>
0007 
0008 #define MAX_ATR         33
0009 
0010 #define CM4000_MAX_DEV      4
0011 
0012 /* those two structures are passed via ioctl() from/to userspace.  They are
0013  * used by existing userspace programs, so I kepth the awkward "bIFSD" naming
0014  * not to break compilation of userspace apps. -HW */
0015 
0016 typedef struct atreq {
0017     __s32 atr_len;
0018     unsigned char atr[64];
0019     __s32 power_act;
0020     unsigned char bIFSD;
0021     unsigned char bIFSC;
0022 } atreq_t;
0023 
0024 
0025 /* what is particularly stupid in the original driver is the arch-dependent
0026  * member sizes. This leads to CONFIG_COMPAT breakage, since 32bit userspace
0027  * will lay out the structure members differently than the 64bit kernel.
0028  *
0029  * I've changed "ptsreq.protocol" from "unsigned long" to "__u32".
0030  * On 32bit this will make no difference.  With 64bit kernels, it will make
0031  * 32bit apps work, too.
0032  */
0033 
0034 typedef struct ptsreq {
0035     __u32 protocol; /*T=0: 2^0, T=1:  2^1*/
0036     unsigned char flags;
0037     unsigned char pts1;
0038     unsigned char pts2;
0039     unsigned char pts3;
0040 } ptsreq_t;
0041 
0042 #define CM_IOC_MAGIC        'c'
0043 #define CM_IOC_MAXNR            255
0044 
0045 #define CM_IOCGSTATUS       _IOR (CM_IOC_MAGIC, 0, unsigned char *)
0046 #define CM_IOCGATR      _IOWR(CM_IOC_MAGIC, 1, atreq_t *)
0047 #define CM_IOCSPTS      _IOW (CM_IOC_MAGIC, 2, ptsreq_t *)
0048 #define CM_IOCSRDR      _IO  (CM_IOC_MAGIC, 3)
0049 #define CM_IOCARDOFF            _IO  (CM_IOC_MAGIC, 4)
0050 
0051 #define CM_IOSDBGLVL            _IOW(CM_IOC_MAGIC, 250, int*)
0052 
0053 /* card and device states */
0054 #define CM_CARD_INSERTED        0x01
0055 #define CM_CARD_POWERED         0x02
0056 #define CM_ATR_PRESENT          0x04
0057 #define CM_ATR_VALID            0x08
0058 #define CM_STATE_VALID          0x0f
0059 /* extra info only from CM4000 */
0060 #define CM_NO_READER            0x10
0061 #define CM_BAD_CARD         0x20
0062 
0063 
0064 #endif /* _UAPI_CM4000_H_ */