blob: 605ebe24bb2e273ec2ba5f9f11295ef139a9a0f9 [file] [log] [blame]
Harald Weltec1986ee2005-11-13 16:06:29 -08001#ifndef _CM4000_H_
2#define _CM4000_H_
3
4#define MAX_ATR 33
5
6#define CM4000_MAX_DEV 4
7
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
12typedef struct atreq {
13 int32_t atr_len;
14 unsigned char atr[64];
15 int32_t power_act;
16 unsigned char bIFSD;
17 unsigned char bIFSC;
18} atreq_t;
19
20
21/* what is particularly stupid in the original driver is the arch-dependant
22 * member sizes. This leads to CONFIG_COMPAT breakage, since 32bit userspace
23 * will lay out the structure members differently than the 64bit kernel.
24 *
25 * I've changed "ptsreq.protocol" from "unsigned long" to "u_int32_t".
26 * On 32bit this will make no difference. With 64bit kernels, it will make
27 * 32bit apps work, too.
28 */
29
30typedef struct ptsreq {
31 u_int32_t protocol; /*T=0: 2^0, T=1: 2^1*/
32 unsigned char flags;
33 unsigned char pts1;
34 unsigned char pts2;
35 unsigned char pts3;
36} ptsreq_t;
37
38#define CM_IOC_MAGIC 'c'
39#define CM_IOC_MAXNR 255
40
41#define CM_IOCGSTATUS _IOR (CM_IOC_MAGIC, 0, unsigned char *)
42#define CM_IOCGATR _IOWR(CM_IOC_MAGIC, 1, atreq_t *)
43#define CM_IOCSPTS _IOW (CM_IOC_MAGIC, 2, ptsreq_t *)
44#define CM_IOCSRDR _IO (CM_IOC_MAGIC, 3)
45#define CM_IOCARDOFF _IO (CM_IOC_MAGIC, 4)
46
47#define CM_IOSDBGLVL _IOW(CM_IOC_MAGIC, 250, int*)
48
49/* card and device states */
50#define CM_CARD_INSERTED 0x01
51#define CM_CARD_POWERED 0x02
52#define CM_ATR_PRESENT 0x04
53#define CM_ATR_VALID 0x08
54#define CM_STATE_VALID 0x0f
55/* extra info only from CM4000 */
56#define CM_NO_READER 0x10
57#define CM_BAD_CARD 0x20
58
59
60#ifdef __KERNEL__
61
62#define DEVICE_NAME "cmm"
63#define MODULE_NAME "cm4000_cs"
64
65#endif /* __KERNEL__ */
66#endif /* _CM4000_H_ */