blob: 3c4aac406175d6d21438643be35dcc78a2a23e49 [file] [log] [blame]
Harald Weltec1986ee2005-11-13 16:06:29 -08001#ifndef _CM4000_H_
2#define _CM4000_H_
3
Arnd Bergmann9adfbfb2009-02-26 00:51:40 +01004#include <linux/types.h>
5
Harald Weltec1986ee2005-11-13 16:06:29 -08006#define MAX_ATR 33
7
8#define CM4000_MAX_DEV 4
9
10/* those two structures are passed via ioctl() from/to userspace. They are
11 * used by existing userspace programs, so I kepth the awkward "bIFSD" naming
12 * not to break compilation of userspace apps. -HW */
13
14typedef struct atreq {
Arnd Bergmann9adfbfb2009-02-26 00:51:40 +010015 __s32 atr_len;
Harald Weltec1986ee2005-11-13 16:06:29 -080016 unsigned char atr[64];
Arnd Bergmann9adfbfb2009-02-26 00:51:40 +010017 __s32 power_act;
Harald Weltec1986ee2005-11-13 16:06:29 -080018 unsigned char bIFSD;
19 unsigned char bIFSC;
20} atreq_t;
21
22
Lucas De Marchi25985ed2011-03-30 22:57:33 -030023/* what is particularly stupid in the original driver is the arch-dependent
Harald Weltec1986ee2005-11-13 16:06:29 -080024 * member sizes. This leads to CONFIG_COMPAT breakage, since 32bit userspace
25 * will lay out the structure members differently than the 64bit kernel.
26 *
Arnd Bergmann9adfbfb2009-02-26 00:51:40 +010027 * I've changed "ptsreq.protocol" from "unsigned long" to "__u32".
Harald Weltec1986ee2005-11-13 16:06:29 -080028 * On 32bit this will make no difference. With 64bit kernels, it will make
29 * 32bit apps work, too.
30 */
31
32typedef struct ptsreq {
Arnd Bergmann9adfbfb2009-02-26 00:51:40 +010033 __u32 protocol; /*T=0: 2^0, T=1: 2^1*/
Harald Weltec1986ee2005-11-13 16:06:29 -080034 unsigned char flags;
35 unsigned char pts1;
36 unsigned char pts2;
37 unsigned char pts3;
38} ptsreq_t;
39
40#define CM_IOC_MAGIC 'c'
41#define CM_IOC_MAXNR 255
42
43#define CM_IOCGSTATUS _IOR (CM_IOC_MAGIC, 0, unsigned char *)
44#define CM_IOCGATR _IOWR(CM_IOC_MAGIC, 1, atreq_t *)
45#define CM_IOCSPTS _IOW (CM_IOC_MAGIC, 2, ptsreq_t *)
46#define CM_IOCSRDR _IO (CM_IOC_MAGIC, 3)
47#define CM_IOCARDOFF _IO (CM_IOC_MAGIC, 4)
48
49#define CM_IOSDBGLVL _IOW(CM_IOC_MAGIC, 250, int*)
50
51/* card and device states */
52#define CM_CARD_INSERTED 0x01
53#define CM_CARD_POWERED 0x02
54#define CM_ATR_PRESENT 0x04
55#define CM_ATR_VALID 0x08
56#define CM_STATE_VALID 0x0f
57/* extra info only from CM4000 */
58#define CM_NO_READER 0x10
59#define CM_BAD_CARD 0x20
60
61
62#ifdef __KERNEL__
63
64#define DEVICE_NAME "cmm"
65#define MODULE_NAME "cm4000_cs"
66
67#endif /* __KERNEL__ */
68#endif /* _CM4000_H_ */