blob: 75fa3530345ba362f7460d18e7749ed08f3654c1 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * cs.h
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 *
8 * The initial developer of the original code is David A. Hinds
9 * <dahinds@users.sourceforge.net>. Portions created by David A. Hinds
10 * are Copyright (C) 1999 David A. Hinds. All Rights Reserved.
11 *
12 * (C) 1999 David A. Hinds
13 */
14
15#ifndef _LINUX_CS_H
16#define _LINUX_CS_H
17
Dominik Brodowski5fa91672009-11-08 17:24:46 +010018#ifdef __KERNEL__
19#include <linux/interrupt.h>
20#endif
21
Linus Torvalds1da177e2005-04-16 15:20:36 -070022/* For AccessConfigurationRegister */
23typedef struct conf_reg_t {
24 u_char Function;
25 u_int Action;
26 off_t Offset;
27 u_int Value;
28} conf_reg_t;
29
30/* Actions */
31#define CS_READ 1
32#define CS_WRITE 2
33
34/* for AdjustResourceInfo */
Linus Torvalds1da177e2005-04-16 15:20:36 -070035/* Action field */
36#define REMOVE_MANAGED_RESOURCE 1
37#define ADD_MANAGED_RESOURCE 2
Dominik Brodowskia5835782008-08-28 00:41:16 +020038
Linus Torvalds1da177e2005-04-16 15:20:36 -070039
Linus Torvalds1da177e2005-04-16 15:20:36 -070040typedef struct event_callback_args_t {
Dominik Brodowski2bc5a9b2005-07-07 17:59:02 -070041 struct pcmcia_device *client_handle;
42 void *client_data;
Linus Torvalds1da177e2005-04-16 15:20:36 -070043} event_callback_args_t;
44
Linus Torvalds1da177e2005-04-16 15:20:36 -070045/* For CardValues field */
46#define CV_OPTION_VALUE 0x01
47#define CV_STATUS_VALUE 0x02
48#define CV_PIN_REPLACEMENT 0x04
49#define CV_COPY_VALUE 0x08
50#define CV_EXT_STATUS 0x10
51
52/* For GetFirst/NextClient */
53typedef struct client_req_t {
54 socket_t Socket;
55 u_int Attributes;
56} client_req_t;
57
58#define CLIENT_THIS_SOCKET 0x01
59
Linus Torvalds1da177e2005-04-16 15:20:36 -070060/* ModifyConfiguration */
61typedef struct modconf_t {
62 u_int Attributes;
63 u_int Vcc, Vpp1, Vpp2;
64} modconf_t;
65
66/* Attributes for ModifyConfiguration */
Dominik Brodowski4bbed522006-01-15 11:18:12 +010067#define CONF_IRQ_CHANGE_VALID 0x0100
68#define CONF_VCC_CHANGE_VALID 0x0200
69#define CONF_VPP1_CHANGE_VALID 0x0400
70#define CONF_VPP2_CHANGE_VALID 0x0800
71#define CONF_IO_CHANGE_WIDTH 0x1000
Linus Torvalds1da177e2005-04-16 15:20:36 -070072
73/* For RequestConfiguration */
74typedef struct config_req_t {
75 u_int Attributes;
Dominik Brodowski70294b42006-01-15 12:43:16 +010076 u_int Vpp; /* both Vpp1 and Vpp2 */
Linus Torvalds1da177e2005-04-16 15:20:36 -070077 u_int IntType;
78 u_int ConfigBase;
79 u_char Status, Pin, Copy, ExtStatus;
80 u_char ConfigIndex;
81 u_int Present;
82} config_req_t;
83
84/* Attributes for RequestConfiguration */
85#define CONF_ENABLE_IRQ 0x01
86#define CONF_ENABLE_DMA 0x02
87#define CONF_ENABLE_SPKR 0x04
88#define CONF_VALID_CLIENT 0x100
89
90/* IntType field */
91#define INT_MEMORY 0x01
92#define INT_MEMORY_AND_IO 0x02
93#define INT_CARDBUS 0x04
94#define INT_ZOOMED_VIDEO 0x08
95
96/* For RequestIO and ReleaseIO */
97typedef struct io_req_t {
Olof Johanssonecb8a842008-02-04 22:27:34 -080098 u_int BasePort1;
99 u_int NumPorts1;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700100 u_int Attributes1;
Olof Johanssonecb8a842008-02-04 22:27:34 -0800101 u_int BasePort2;
102 u_int NumPorts2;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700103 u_int Attributes2;
104 u_int IOAddrLines;
105} io_req_t;
106
107/* Attributes for RequestIO and ReleaseIO */
108#define IO_SHARED 0x01
109#define IO_FIRST_SHARED 0x02
110#define IO_FORCE_ALIAS_ACCESS 0x04
111#define IO_DATA_PATH_WIDTH 0x18
112#define IO_DATA_PATH_WIDTH_8 0x00
113#define IO_DATA_PATH_WIDTH_16 0x08
114#define IO_DATA_PATH_WIDTH_AUTO 0x10
115
116/* For RequestIRQ and ReleaseIRQ */
117typedef struct irq_req_t {
Dominik Brodowski5fa91672009-11-08 17:24:46 +0100118 u_int Attributes;
119 u_int AssignedIRQ;
120 irq_handler_t Handler;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700121} irq_req_t;
122
123/* Attributes for RequestIRQ and ReleaseIRQ */
124#define IRQ_TYPE 0x03
125#define IRQ_TYPE_EXCLUSIVE 0x00
126#define IRQ_TYPE_TIME 0x01
127#define IRQ_TYPE_DYNAMIC_SHARING 0x02
128#define IRQ_FORCED_PULSE 0x04
Dominik Brodowskie15c1c12009-11-28 18:12:06 +0100129#define IRQ_FIRST_SHARED 0x08 /* unused */
130#define IRQ_HANDLE_PRESENT 0x10 /* unused */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700131#define IRQ_PULSE_ALLOCATED 0x100
132
133/* Bits in IRQInfo1 field */
134#define IRQ_MASK 0x0f
135#define IRQ_NMI_ID 0x01
136#define IRQ_IOCK_ID 0x02
137#define IRQ_BERR_ID 0x04
138#define IRQ_VEND_ID 0x08
139#define IRQ_INFO2_VALID 0x10
140#define IRQ_LEVEL_ID 0x20
141#define IRQ_PULSE_ID 0x40
142#define IRQ_SHARE_ID 0x80
143
144typedef struct eventmask_t {
145 u_int Attributes;
146 u_int EventMask;
147} eventmask_t;
148
149#define CONF_EVENT_MASK_VALID 0x01
150
151/* Configuration registers present */
152#define PRESENT_OPTION 0x001
153#define PRESENT_STATUS 0x002
154#define PRESENT_PIN_REPLACE 0x004
155#define PRESENT_COPY 0x008
156#define PRESENT_EXT_STATUS 0x010
157#define PRESENT_IOBASE_0 0x020
158#define PRESENT_IOBASE_1 0x040
159#define PRESENT_IOBASE_2 0x080
160#define PRESENT_IOBASE_3 0x100
161#define PRESENT_IOSIZE 0x200
162
163/* For GetMemPage, MapMemPage */
164typedef struct memreq_t {
165 u_int CardOffset;
166 page_t Page;
167} memreq_t;
168
169/* For ModifyWindow */
170typedef struct modwin_t {
171 u_int Attributes;
172 u_int AccessSpeed;
173} modwin_t;
174
175/* For RequestWindow */
176typedef struct win_req_t {
177 u_int Attributes;
178 u_long Base;
179 u_int Size;
180 u_int AccessSpeed;
181} win_req_t;
182
183/* Attributes for RequestWindow */
184#define WIN_ADDR_SPACE 0x0001
185#define WIN_ADDR_SPACE_MEM 0x0000
186#define WIN_ADDR_SPACE_IO 0x0001
187#define WIN_MEMORY_TYPE 0x0002
188#define WIN_MEMORY_TYPE_CM 0x0000
189#define WIN_MEMORY_TYPE_AM 0x0002
190#define WIN_ENABLE 0x0004
191#define WIN_DATA_WIDTH 0x0018
192#define WIN_DATA_WIDTH_8 0x0000
193#define WIN_DATA_WIDTH_16 0x0008
194#define WIN_DATA_WIDTH_32 0x0010
195#define WIN_PAGED 0x0020
196#define WIN_SHARED 0x0040
197#define WIN_FIRST_SHARED 0x0080
198#define WIN_USE_WAIT 0x0100
199#define WIN_STRICT_ALIGN 0x0200
200#define WIN_MAP_BELOW_1MB 0x0400
201#define WIN_PREFETCH 0x0800
202#define WIN_CACHEABLE 0x1000
203#define WIN_BAR_MASK 0xe000
204#define WIN_BAR_SHIFT 13
205
Linus Torvalds1da177e2005-04-16 15:20:36 -0700206typedef struct error_info_t {
207 int func;
208 int retcode;
209} error_info_t;
210
211/* Flag to bind to all functions */
212#define BIND_FN_ALL 0xff
213
214/* Events */
215#define CS_EVENT_PRI_LOW 0
216#define CS_EVENT_PRI_HIGH 1
217
218#define CS_EVENT_WRITE_PROTECT 0x000001
219#define CS_EVENT_CARD_LOCK 0x000002
220#define CS_EVENT_CARD_INSERTION 0x000004
221#define CS_EVENT_CARD_REMOVAL 0x000008
222#define CS_EVENT_BATTERY_DEAD 0x000010
223#define CS_EVENT_BATTERY_LOW 0x000020
224#define CS_EVENT_READY_CHANGE 0x000040
225#define CS_EVENT_CARD_DETECT 0x000080
226#define CS_EVENT_RESET_REQUEST 0x000100
227#define CS_EVENT_RESET_PHYSICAL 0x000200
228#define CS_EVENT_CARD_RESET 0x000400
229#define CS_EVENT_REGISTRATION_COMPLETE 0x000800
230#define CS_EVENT_PM_SUSPEND 0x002000
231#define CS_EVENT_PM_RESUME 0x004000
232#define CS_EVENT_INSERTION_REQUEST 0x008000
233#define CS_EVENT_EJECTION_REQUEST 0x010000
234#define CS_EVENT_MTD_REQUEST 0x020000
235#define CS_EVENT_ERASE_COMPLETE 0x040000
236#define CS_EVENT_REQUEST_ATTENTION 0x080000
237#define CS_EVENT_CB_DETECT 0x100000
238#define CS_EVENT_3VCARD 0x200000
239#define CS_EVENT_XVCARD 0x400000
240
Linus Torvalds1da177e2005-04-16 15:20:36 -0700241#endif /* _LINUX_CS_H */