cleanup
[linux-2.4.git] / include / pcmcia / ss.h
1 /*
2  * ss.h 1.28 2000/06/12 21:55:40
3  *
4  * The contents of this file are subject to the Mozilla Public License
5  * Version 1.1 (the "License"); you may not use this file except in
6  * compliance with the License. You may obtain a copy of the License
7  * at http://www.mozilla.org/MPL/
8  *
9  * Software distributed under the License is distributed on an "AS IS"
10  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
11  * the License for the specific language governing rights and
12  * limitations under the License. 
13  *
14  * The initial developer of the original code is David A. Hinds
15  * <dahinds@users.sourceforge.net>.  Portions created by David A. Hinds
16  * are Copyright (C) 1999 David A. Hinds.  All Rights Reserved.
17  *
18  * Alternatively, the contents of this file may be used under the
19  * terms of the GNU General Public License version 2 (the "GPL"), in which
20  * case the provisions of the GPL are applicable instead of the
21  * above.  If you wish to allow the use of your version of this file
22  * only under the terms of the GPL and not to allow others to use
23  * your version of this file under the MPL, indicate your decision by
24  * deleting the provisions above and replace them with the notice and
25  * other provisions required by the GPL.  If you do not delete the
26  * provisions above, a recipient may use your version of this file
27  * under either the MPL or the GPL.
28  */
29
30 #ifndef _LINUX_SS_H
31 #define _LINUX_SS_H
32
33 #include <pcmcia/cs_types.h>
34
35 /* Definitions for card status flags for GetStatus */
36 #define SS_WRPROT       0x0001
37 #define SS_CARDLOCK     0x0002
38 #define SS_EJECTION     0x0004
39 #define SS_INSERTION    0x0008
40 #define SS_BATDEAD      0x0010
41 #define SS_BATWARN      0x0020
42 #define SS_READY        0x0040
43 #define SS_DETECT       0x0080
44 #define SS_POWERON      0x0100
45 #define SS_GPI          0x0200
46 #define SS_STSCHG       0x0400
47 #define SS_CARDBUS      0x0800
48 #define SS_3VCARD       0x1000
49 #define SS_XVCARD       0x2000
50 #define SS_PENDING      0x4000
51
52 /* for InquireSocket */
53 typedef struct socket_cap_t {
54     u_int       features;
55     u_int       irq_mask;
56     u_int       map_size;
57     ioaddr_t    io_offset;
58     u_char      pci_irq;
59     struct pci_dev *cb_dev;
60     struct bus_operations *bus;
61 } socket_cap_t;
62
63 /* InquireSocket capabilities */
64 #define SS_CAP_PAGE_REGS        0x0001
65 #define SS_CAP_VIRTUAL_BUS      0x0002
66 #define SS_CAP_MEM_ALIGN        0x0004
67 #define SS_CAP_STATIC_MAP       0x0008
68 #define SS_CAP_PCCARD           0x4000
69 #define SS_CAP_CARDBUS          0x8000
70
71 /* for GetSocket, SetSocket */
72 typedef struct socket_state_t {
73     u_int       flags;
74     u_int       csc_mask;
75     u_char      Vcc, Vpp;
76     u_char      io_irq;
77 } socket_state_t;
78
79 extern socket_state_t dead_socket;
80
81 /* Socket configuration flags */
82 #define SS_PWR_AUTO     0x0010
83 #define SS_IOCARD       0x0020
84 #define SS_RESET        0x0040
85 #define SS_DMA_MODE     0x0080
86 #define SS_SPKR_ENA     0x0100
87 #define SS_OUTPUT_ENA   0x0200
88 #define SS_DEBOUNCED    0x0400  /* Tell driver that the debounce delay has ended */
89 #define SS_ZVCARD       0x0800
90
91 /* Flags for I/O port and memory windows */
92 #define MAP_ACTIVE      0x01
93 #define MAP_16BIT       0x02
94 #define MAP_AUTOSZ      0x04
95 #define MAP_0WS         0x08
96 #define MAP_WRPROT      0x10
97 #define MAP_ATTRIB      0x20
98 #define MAP_USE_WAIT    0x40
99 #define MAP_PREFETCH    0x80
100
101 /* Use this just for bridge windows */
102 #define MAP_IOSPACE     0x20
103
104 typedef struct pccard_io_map {
105     u_char      map;
106     u_char      flags;
107     u_short     speed;
108     ioaddr_t    start, stop;
109 } pccard_io_map;
110
111 typedef struct pccard_mem_map {
112     u_char      map;
113     u_char      flags;
114     u_short     speed;
115     u_long      sys_start, sys_stop;
116     u_int       card_start;
117 } pccard_mem_map;
118
119 typedef struct cb_bridge_map {
120     u_char      map;
121     u_char      flags;
122     u_int       start, stop;
123 } cb_bridge_map;
124
125 /*
126  * Socket operations.
127  */
128 struct pccard_operations {
129         int (*init)(unsigned int sock);
130         int (*suspend)(unsigned int sock);
131         int (*register_callback)(unsigned int sock, void (*handler)(void *, unsigned int), void * info);
132         int (*inquire_socket)(unsigned int sock, socket_cap_t *cap);
133         int (*get_status)(unsigned int sock, u_int *value);
134         int (*get_socket)(unsigned int sock, socket_state_t *state);
135         int (*set_socket)(unsigned int sock, socket_state_t *state);
136         int (*get_io_map)(unsigned int sock, struct pccard_io_map *io);
137         int (*set_io_map)(unsigned int sock, struct pccard_io_map *io);
138         int (*get_mem_map)(unsigned int sock, struct pccard_mem_map *mem);
139         int (*set_mem_map)(unsigned int sock, struct pccard_mem_map *mem);
140         void (*proc_setup)(unsigned int sock, struct proc_dir_entry *base);
141 };
142
143 /*
144  *  Calls to set up low-level "Socket Services" drivers
145  */
146 extern int register_ss_entry(int nsock, struct pccard_operations *ops);
147 extern void unregister_ss_entry(struct pccard_operations *ops);
148
149 #endif /* _LINUX_SS_H */