Blame view

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