- pre2
[davej-history.git] / include / pcmcia / ss.h
blobe00757ca446eb7b9d12ec3cec1a6cd39eaaca1f6
1 /*
2 * ss.h 1.28 2000/06/12 21:55:40
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/
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.
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.
18 * Alternatively, the contents of this file may be used under the
19 * terms of the GNU 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.
30 #ifndef _LINUX_SS_H
31 #define _LINUX_SS_H
33 /* Definitions for card status flags for GetStatus */
34 #define SS_WRPROT 0x0001
35 #define SS_CARDLOCK 0x0002
36 #define SS_EJECTION 0x0004
37 #define SS_INSERTION 0x0008
38 #define SS_BATDEAD 0x0010
39 #define SS_BATWARN 0x0020
40 #define SS_READY 0x0040
41 #define SS_DETECT 0x0080
42 #define SS_POWERON 0x0100
43 #define SS_GPI 0x0200
44 #define SS_STSCHG 0x0400
45 #define SS_CARDBUS 0x0800
46 #define SS_3VCARD 0x1000
47 #define SS_XVCARD 0x2000
48 #define SS_PENDING 0x4000
50 /* for InquireSocket */
51 typedef struct socket_cap_t {
52 u_int features;
53 u_int irq_mask;
54 u_int map_size;
55 u_char pci_irq;
56 struct pci_dev *cb_dev;
57 struct bus_operations *bus;
58 } socket_cap_t;
60 /* InquireSocket capabilities */
61 #define SS_CAP_PAGE_REGS 0x0001
62 #define SS_CAP_VIRTUAL_BUS 0x0002
63 #define SS_CAP_MEM_ALIGN 0x0004
64 #define SS_CAP_STATIC_MAP 0x0008
65 #define SS_CAP_PCCARD 0x4000
66 #define SS_CAP_CARDBUS 0x8000
68 /* for GetSocket, SetSocket */
69 typedef struct socket_state_t {
70 u_int flags;
71 u_int csc_mask;
72 u_char Vcc, Vpp;
73 u_char io_irq;
74 } socket_state_t;
76 extern socket_state_t dead_socket;
78 /* Socket configuration flags */
79 #define SS_PWR_AUTO 0x0010
80 #define SS_IOCARD 0x0020
81 #define SS_RESET 0x0040
82 #define SS_DMA_MODE 0x0080
83 #define SS_SPKR_ENA 0x0100
84 #define SS_OUTPUT_ENA 0x0200
86 /* Flags for I/O port and memory windows */
87 #define MAP_ACTIVE 0x01
88 #define MAP_16BIT 0x02
89 #define MAP_AUTOSZ 0x04
90 #define MAP_0WS 0x08
91 #define MAP_WRPROT 0x10
92 #define MAP_ATTRIB 0x20
93 #define MAP_USE_WAIT 0x40
94 #define MAP_PREFETCH 0x80
96 /* Use this just for bridge windows */
97 #define MAP_IOSPACE 0x20
99 typedef struct pccard_io_map {
100 u_char map;
101 u_char flags;
102 u_short speed;
103 u_short start, stop;
104 } pccard_io_map;
106 typedef struct pccard_mem_map {
107 u_char map;
108 u_char flags;
109 u_short speed;
110 u_long sys_start, sys_stop;
111 u_int card_start;
112 } pccard_mem_map;
114 typedef struct cb_bridge_map {
115 u_char map;
116 u_char flags;
117 u_int start, stop;
118 } cb_bridge_map;
121 * Socket operations.
123 struct pccard_operations {
124 int (*init)(unsigned int sock);
125 int (*suspend)(unsigned int sock);
126 int (*register_callback)(unsigned int sock, void (*handler)(void *, unsigned int), void * info);
127 int (*inquire_socket)(unsigned int sock, socket_cap_t *cap);
128 int (*get_status)(unsigned int sock, u_int *value);
129 int (*get_socket)(unsigned int sock, socket_state_t *state);
130 int (*set_socket)(unsigned int sock, socket_state_t *state);
131 int (*get_io_map)(unsigned int sock, struct pccard_io_map *io);
132 int (*set_io_map)(unsigned int sock, struct pccard_io_map *io);
133 int (*get_mem_map)(unsigned int sock, struct pccard_mem_map *mem);
134 int (*set_mem_map)(unsigned int sock, struct pccard_mem_map *mem);
135 void (*proc_setup)(unsigned int sock, struct proc_dir_entry *base);
139 * Calls to set up low-level "Socket Services" drivers
141 extern int register_ss_entry(int nsock, struct pccard_operations *ops);
142 extern void unregister_ss_entry(struct pccard_operations *ops);
144 #endif /* _LINUX_SS_H */