Linux Audio

Check our new training course

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