xref: /haiku/headers/os/drivers/pcmcia/ss.h (revision 37a84232bb58d2f667df5dc4634dc96d9b921f16)
1d7cd6603SJérôme Duval /*
2*37a84232SJérôme Duval  * ss.h 1.31 2001/08/24 12:16:13
3d7cd6603SJérôme Duval  *
4d7cd6603SJérôme Duval  * The contents of this file are subject to the Mozilla Public License
5d7cd6603SJérôme Duval  * Version 1.1 (the "License"); you may not use this file except in
6d7cd6603SJérôme Duval  * compliance with the License. You may obtain a copy of the License
7d7cd6603SJérôme Duval  * at http://www.mozilla.org/MPL/
8d7cd6603SJérôme Duval  *
9d7cd6603SJérôme Duval  * Software distributed under the License is distributed on an "AS IS"
10d7cd6603SJérôme Duval  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
11d7cd6603SJérôme Duval  * the License for the specific language governing rights and
12d7cd6603SJérôme Duval  * limitations under the License.
13d7cd6603SJérôme Duval  *
14d7cd6603SJérôme Duval  * The initial developer of the original code is David A. Hinds
15*37a84232SJérôme Duval  * <dahinds@users.sourceforge.net>.  Portions created by David A. Hinds
16*37a84232SJérôme Duval  * are Copyright (C) 1999 David A. Hinds.  All Rights Reserved.
17*37a84232SJérôme Duval  *
18*37a84232SJérôme Duval  * Alternatively, the contents of this file may be used under the
19*37a84232SJérôme Duval  * terms of the GNU General Public License version 2 (the "GPL"), in
20*37a84232SJérôme Duval  * which case the provisions of the GPL are applicable instead of the
21*37a84232SJérôme Duval  * above.  If you wish to allow the use of your version of this file
22*37a84232SJérôme Duval  * only under the terms of the GPL and not to allow others to use
23*37a84232SJérôme Duval  * your version of this file under the MPL, indicate your decision by
24*37a84232SJérôme Duval  * deleting the provisions above and replace them with the notice and
25*37a84232SJérôme Duval  * other provisions required by the GPL.  If you do not delete the
26*37a84232SJérôme Duval  * provisions above, a recipient may use your version of this file
27*37a84232SJérôme Duval  * under either the MPL or the GPL.
28d7cd6603SJérôme Duval  */
29d7cd6603SJérôme Duval 
30d7cd6603SJérôme Duval #ifndef _LINUX_SS_H
31d7cd6603SJérôme Duval #define _LINUX_SS_H
32d7cd6603SJérôme Duval 
33d7cd6603SJérôme Duval /* For RegisterCallback */
34d7cd6603SJérôme Duval typedef struct ss_callback_t {
35d7cd6603SJérôme Duval     void	(*handler)(void *info, u_int events);
36d7cd6603SJérôme Duval     void	*info;
37d7cd6603SJérôme Duval } ss_callback_t;
38d7cd6603SJérôme Duval 
39d7cd6603SJérôme Duval /* Definitions for card status flags for GetStatus */
40d7cd6603SJérôme Duval #define SS_WRPROT	0x0001
41d7cd6603SJérôme Duval #define SS_CARDLOCK	0x0002
42d7cd6603SJérôme Duval #define SS_EJECTION	0x0004
43d7cd6603SJérôme Duval #define SS_INSERTION	0x0008
44d7cd6603SJérôme Duval #define SS_BATDEAD	0x0010
45d7cd6603SJérôme Duval #define SS_BATWARN	0x0020
46d7cd6603SJérôme Duval #define SS_READY	0x0040
47d7cd6603SJérôme Duval #define SS_DETECT	0x0080
48d7cd6603SJérôme Duval #define SS_POWERON	0x0100
49d7cd6603SJérôme Duval #define SS_GPI		0x0200
50d7cd6603SJérôme Duval #define SS_STSCHG	0x0400
51d7cd6603SJérôme Duval #define SS_CARDBUS	0x0800
52d7cd6603SJérôme Duval #define SS_3VCARD	0x1000
53d7cd6603SJérôme Duval #define SS_XVCARD	0x2000
54*37a84232SJérôme Duval #define SS_PENDING	0x4000
55d7cd6603SJérôme Duval 
56d7cd6603SJérôme Duval /* for InquireSocket */
57d7cd6603SJérôme Duval typedef struct socket_cap_t {
58d7cd6603SJérôme Duval     u_int	features;
59d7cd6603SJérôme Duval     u_int	irq_mask;
60d7cd6603SJérôme Duval     u_int	map_size;
61d7cd6603SJérôme Duval     u_char	pci_irq;
62d7cd6603SJérôme Duval     u_char	cardbus;
63d7cd6603SJérôme Duval     struct pci_bus *cb_bus;
64d7cd6603SJérôme Duval     struct bus_operations *bus;
65d7cd6603SJérôme Duval } socket_cap_t;
66d7cd6603SJérôme Duval 
67d7cd6603SJérôme Duval /* InquireSocket capabilities */
68d7cd6603SJérôme Duval #define SS_CAP_PAGE_REGS	0x0001
69d7cd6603SJérôme Duval #define SS_CAP_VIRTUAL_BUS	0x0002
70d7cd6603SJérôme Duval #define SS_CAP_MEM_ALIGN	0x0004
71*37a84232SJérôme Duval #define SS_CAP_STATIC_MAP	0x0008
72d7cd6603SJérôme Duval #define SS_CAP_PCCARD		0x4000
73d7cd6603SJérôme Duval #define SS_CAP_CARDBUS		0x8000
74d7cd6603SJérôme Duval 
75d7cd6603SJérôme Duval /* for GetSocket, SetSocket */
76d7cd6603SJérôme Duval typedef struct socket_state_t {
77d7cd6603SJérôme Duval     u_int	flags;
78d7cd6603SJérôme Duval     u_int	csc_mask;
79d7cd6603SJérôme Duval     u_char	Vcc, Vpp;
80d7cd6603SJérôme Duval     u_char	io_irq;
81d7cd6603SJérôme Duval } socket_state_t;
82d7cd6603SJérôme Duval 
83d7cd6603SJérôme Duval /* Socket configuration flags */
84d7cd6603SJérôme Duval #define SS_PWR_AUTO	0x0010
85d7cd6603SJérôme Duval #define SS_IOCARD	0x0020
86d7cd6603SJérôme Duval #define SS_RESET	0x0040
87d7cd6603SJérôme Duval #define SS_DMA_MODE	0x0080
88d7cd6603SJérôme Duval #define SS_SPKR_ENA	0x0100
89d7cd6603SJérôme Duval #define SS_OUTPUT_ENA	0x0200
90*37a84232SJérôme Duval #define SS_ZVCARD	0x0400
91d7cd6603SJérôme Duval 
92d7cd6603SJérôme Duval /* Flags for I/O port and memory windows */
93d7cd6603SJérôme Duval #define MAP_ACTIVE	0x01
94d7cd6603SJérôme Duval #define MAP_16BIT	0x02
95d7cd6603SJérôme Duval #define MAP_AUTOSZ	0x04
96d7cd6603SJérôme Duval #define MAP_0WS		0x08
97d7cd6603SJérôme Duval #define MAP_WRPROT	0x10
98d7cd6603SJérôme Duval #define MAP_ATTRIB	0x20
99d7cd6603SJérôme Duval #define MAP_USE_WAIT	0x40
100d7cd6603SJérôme Duval #define MAP_PREFETCH	0x80
101d7cd6603SJérôme Duval 
102d7cd6603SJérôme Duval /* Use this just for bridge windows */
103d7cd6603SJérôme Duval #define MAP_IOSPACE	0x20
104d7cd6603SJérôme Duval 
105d7cd6603SJérôme Duval typedef struct pccard_io_map {
106d7cd6603SJérôme Duval     u_char	map;
107d7cd6603SJérôme Duval     u_char	flags;
108d7cd6603SJérôme Duval     u_short	speed;
109d7cd6603SJérôme Duval     u_short	start, stop;
110d7cd6603SJérôme Duval } pccard_io_map;
111d7cd6603SJérôme Duval 
112d7cd6603SJérôme Duval typedef struct pccard_mem_map {
113d7cd6603SJérôme Duval     u_char	map;
114d7cd6603SJérôme Duval     u_char	flags;
115d7cd6603SJérôme Duval     u_short	speed;
116d7cd6603SJérôme Duval     u_long	sys_start, sys_stop;
117d7cd6603SJérôme Duval     u_int	card_start;
118d7cd6603SJérôme Duval } pccard_mem_map;
119d7cd6603SJérôme Duval 
120d7cd6603SJérôme Duval typedef struct cb_bridge_map {
121d7cd6603SJérôme Duval     u_char	map;
122d7cd6603SJérôme Duval     u_char	flags;
123d7cd6603SJérôme Duval     u_int	start, stop;
124d7cd6603SJérôme Duval } cb_bridge_map;
125d7cd6603SJérôme Duval 
126d7cd6603SJérôme Duval enum ss_service {
127d7cd6603SJérôme Duval     SS_RegisterCallback, SS_InquireSocket,
128d7cd6603SJérôme Duval     SS_GetStatus, SS_GetSocket, SS_SetSocket,
129d7cd6603SJérôme Duval     SS_GetIOMap, SS_SetIOMap, SS_GetMemMap, SS_SetMemMap,
130d7cd6603SJérôme Duval     SS_GetBridge, SS_SetBridge, SS_ProcSetup
131d7cd6603SJérôme Duval };
132d7cd6603SJérôme Duval 
133d7cd6603SJérôme Duval #endif /* _LINUX_SS_H */
134