FreeBSD/Linux Kernel Cross Reference
sys/pccard/cardinfo.h
1 /*
2 * Include file for PCMCIA user process interface
3 *
4 *-------------------------------------------------------------------------
5 *
6 * Copyright (c) 1995 Andrew McRae. All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 * 3. The name of the author may not be used to endorse or promote products
17 * derived from this software without specific prior written permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
20 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
21 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
22 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
23 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
24 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */
30
31 #ifndef _PCCARD_CARDINFO_H_
32 #define _PCCARD_CARDINFO_H_
33
34 #ifndef KERNEL
35 #include <sys/types.h>
36 #endif
37 #include <sys/ioccom.h>
38
39 #define PIOCGSTATE _IOR('P', 1, struct slotstate) /* Get slot state */
40 #define PIOCGMEM _IOWR('P', 2, struct mem_desc) /* Get memory map */
41 #define PIOCSMEM _IOW('P', 3, struct mem_desc) /* Set memory map */
42 #define PIOCGIO _IOWR('P', 4, struct io_desc) /* Get I/O map */
43 #define PIOCSIO _IOW('P', 5, struct io_desc) /* Set I/O map */
44 #define PIOCSDRV _IOW('P', 6, struct dev_desc) /* Set driver */
45 #define PIOCRWFLAG _IOW('P', 7, int) /* Set flags for drv use */
46 #define PIOCRWMEM _IOWR('P', 8, unsigned long) /* Set mem for drv use */
47 #define PIOCSPOW _IOW('P', 9, struct power) /* Set power structure */
48 #define PIOCSBEEP _IOW('P', 11, int) /* Select Beep */
49 /*
50 * Debug codes.
51 */
52 #define PIOCGREG _IOWR('P',100, struct pcic_reg) /* get reg */
53 #define PIOCSREG _IOW('P', 101, struct pcic_reg) /* Set reg */
54
55 /*
56 * Slot states for PIOCGSTATE
57 */
58 enum cardstate { noslot, empty, suspend, filled };
59
60 /*
61 * Descriptor structure for memory map.
62 */
63 struct mem_desc {
64 int window; /* Memory map window number (0-4) */
65 int flags; /* Flags - see below */
66 caddr_t start; /* System memory start */
67 int size; /* Size of memory area */
68 unsigned long card; /* Card memory address */
69 };
70
71 #define MDF_16BITS 0x01 /* Memory is 16 bits wide */
72 #define MDF_ZEROWS 0x02 /* Set no wait states for memory */
73 #define MDF_WS0 0x04 /* Wait state flags */
74 #define MDF_WS1 0x08
75 #define MDF_ATTR 0x10 /* Memory is attribute memory */
76 #define MDF_WP 0x20 /* Write protect memory */
77 #define MDF_ACTIVE 0x40 /* Context active (read-only) */
78
79 /*
80 * Descriptor structure for I/O map
81 */
82 struct io_desc {
83 int window; /* I/O map number (0-1) */
84 int flags; /* Flags - see below */
85 int start; /* I/O port start */
86 int size; /* Number of port addresses */
87 };
88
89 #define IODF_WS 0x01 /* Set wait states for 16 bit I/O access */
90 #define IODF_16BIT 0x02 /* I/O access are 16 bit */
91 #define IODF_CS16 0x04 /* Allow card selection of 16 bit access */
92 #define IODF_ZEROWS 0x08 /* No wait states for 8 bit I/O */
93 #define IODF_ACTIVE 0x10 /* Context active (read-only) */
94
95 /*
96 * Device descriptor for allocation of driver.
97 */
98 struct dev_desc {
99 char name[16]; /* Driver name */
100 int unit; /* Driver unit number */
101 unsigned long mem; /* Memory address of driver */
102 int memsize; /* Memory size (if used) */
103 int iobase; /* base of I/O ports */
104 int irqmask; /* Interrupt number(s) to allocate */
105 int flags; /* Device flags */
106 u_char misc[128]; /* For any random info */
107 };
108
109 struct pcic_reg {
110 unsigned char reg;
111 unsigned char value;
112 };
113
114 /*
115 * Slot information. Used to read current status of slot.
116 */
117 struct slotstate {
118 enum cardstate state; /* Current state of slot */
119 enum cardstate laststate; /* Previous state of slot */
120 int maxmem; /* Max allowed memory windows */
121 int maxio; /* Max allowed I/O windows */
122 int irqs; /* Bitmap of IRQs allowed */
123 int flags; /* Capability flags */
124 };
125
126 /*
127 * The power values are in volts * 10, e.g. 5V is 50, 3.3V is 33.
128 */
129 struct power {
130 int vcc;
131 int vpp;
132 };
133
134 /*
135 * Other system limits
136 */
137 #define MAXSLOT 16
138 #define NUM_MEM_WINDOWS 10
139 #define NUM_IO_WINDOWS 6
140 #define CARD_DEVICE "/dev/card%d" /* String for sprintf */
141
142 #endif /* !_PCCARD_CARDINFO_H_ */
Cache object: dcfb2cded99564517b82aeeb899c040e
|