OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [linux/] [linux-2.4/] [drivers/] [pcmcia/] [cs_internal.h] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1275 phoenix
/*
2
 * cs_internal.h 1.57 2002/10/24 06:11:43
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
 
19
#ifndef _LINUX_CS_INTERNAL_H
20
#define _LINUX_CS_INTERNAL_H
21
 
22
#include <linux/config.h>
23
 
24
typedef struct erase_busy_t {
25
    eraseq_entry_t      *erase;
26
    client_handle_t     client;
27
    struct timer_list   timeout;
28
    struct erase_busy_t *prev, *next;
29
} erase_busy_t;
30
 
31
#define ERASEQ_MAGIC    0xFA67
32
typedef struct eraseq_t {
33
    u_short             eraseq_magic;
34
    client_handle_t     handle;
35
    int                 count;
36
    eraseq_entry_t      *entry;
37
} eraseq_t;
38
 
39
#define CLIENT_MAGIC    0x51E6
40
typedef struct client_t {
41
    u_short             client_magic;
42
    socket_t            Socket;
43
    u_char              Function;
44
    dev_info_t          dev_info;
45
    u_int               Attributes;
46
    u_int               state;
47
    event_t             EventMask, PendingEvents;
48
    int (*event_handler)(event_t event, int priority,
49
                         event_callback_args_t *);
50
    event_callback_args_t event_callback_args;
51
    struct client_t     *next;
52
    u_int               mtd_count;
53
    wait_queue_head_t   mtd_req;
54
    erase_busy_t        erase_busy;
55
} client_t;
56
 
57
/* Flags in client state */
58
#define CLIENT_CONFIG_LOCKED    0x0001
59
#define CLIENT_IRQ_REQ          0x0002
60
#define CLIENT_IO_REQ           0x0004
61
#define CLIENT_UNBOUND          0x0008
62
#define CLIENT_STALE            0x0010
63
#define CLIENT_WIN_REQ(i)       (0x20<<(i))
64
#define CLIENT_CARDBUS          0x8000
65
 
66
typedef struct io_window_t {
67
    u_int               Attributes;
68
    ioaddr_t            BasePort, NumPorts;
69
    ioaddr_t            InUse, Config;
70
} io_window_t;
71
 
72
#define WINDOW_MAGIC    0xB35C
73
typedef struct window_t {
74
    u_short             magic;
75
    u_short             index;
76
    client_handle_t     handle;
77
    struct socket_info_t *sock;
78
    u_long              base;
79
    u_long              size;
80
    pccard_mem_map      ctl;
81
} window_t;
82
 
83
#define REGION_MAGIC    0xE3C9
84
typedef struct region_t {
85
    u_short             region_magic;
86
    u_short             state;
87
    dev_info_t          dev_info;
88
    client_handle_t     mtd;
89
    u_int               MediaID;
90
    region_info_t       info;
91
} region_t;
92
 
93
#define REGION_STALE    0x01
94
 
95
/* Each card function gets one of these guys */
96
typedef struct config_t {
97
    u_int               state;
98
    u_int               Attributes;
99
    u_int               Vcc, Vpp1, Vpp2;
100
    u_int               IntType;
101
    u_int               ConfigBase;
102
    u_char              Status, Pin, Copy, Option, ExtStatus;
103
    u_int               Present;
104
    u_int               CardValues;
105
    io_req_t            io;
106
    struct {
107
        u_int           Attributes;
108
    } irq;
109
} config_t;
110
 
111
/* Maximum number of IO windows per socket */
112
#define MAX_IO_WIN 2
113
 
114
/* Maximum number of memory windows per socket */
115
#define MAX_WIN 4
116
 
117
/* The size of the CIS cache */
118
#define MAX_CIS_TABLE   64
119
#define MAX_CIS_DATA    512
120
 
121
typedef struct socket_info_t {
122
    spinlock_t                  lock;
123
    struct pccard_operations *  ss_entry;
124
    u_int                       sock;
125
    socket_state_t              socket;
126
    socket_cap_t                cap;
127
    u_int                       state;
128
    u_short                     functions;
129
    u_short                     lock_count;
130
    client_handle_t             clients;
131
    u_int                       real_clients;
132
    client_handle_t             reset_handle;
133
    pccard_mem_map              cis_mem;
134
    u_char                      *cis_virt;
135
    config_t                    *config;
136
#ifdef CONFIG_CARDBUS
137
    struct resource *           cb_cis_res;
138
    u_char                      *cb_cis_virt;
139
    struct cb_config_t          *cb_config;
140
#endif
141
    struct {
142
        u_int                   AssignedIRQ;
143
        u_int                   Config;
144
    } irq;
145
    io_window_t                 io[MAX_IO_WIN];
146
    window_t                    win[MAX_WIN];
147
    region_t                    *c_region, *a_region;
148
    erase_busy_t                erase_busy;
149
    int                         cis_used;
150
    struct {
151
        u_int                   addr;
152
        u_short                 len;
153
        u_short                 attr;
154
    }                           cis_table[MAX_CIS_TABLE];
155
    char                        cis_cache[MAX_CIS_DATA];
156
    u_int                       fake_cis_len;
157
    char                        *fake_cis;
158
#ifdef CONFIG_PROC_FS
159
    struct proc_dir_entry       *proc;
160
#endif
161
    int                         use_bus_pm;
162
} socket_info_t;
163
 
164
/* Flags in config state */
165
#define CONFIG_LOCKED           0x01
166
#define CONFIG_IRQ_REQ          0x02
167
#define CONFIG_IO_REQ           0x04
168
 
169
/* Flags in socket state */
170
#define SOCKET_PRESENT          0x0008
171
#define SOCKET_SETUP_PENDING    0x0010
172
#define SOCKET_SHUTDOWN_PENDING 0x0020
173
#define SOCKET_RESET_PENDING    0x0040
174
#define SOCKET_SUSPEND          0x0080
175
#define SOCKET_WIN_REQ(i)       (0x0100<<(i))
176
#define SOCKET_IO_REQ(i)        (0x1000<<(i))
177
#define SOCKET_REGION_INFO      0x4000
178
#define SOCKET_CARDBUS          0x8000
179
 
180
#define CHECK_HANDLE(h) \
181
    (((h) == NULL) || ((h)->client_magic != CLIENT_MAGIC))
182
 
183
#define CHECK_SOCKET(s) \
184
    (((s) >= sockets) || (socket_table[s]->ss_entry == NULL))
185
 
186
#define SOCKET(h) (socket_table[(h)->Socket])
187
#define CONFIG(h) (&SOCKET(h)->config[(h)->Function])
188
 
189
#define CHECK_REGION(r) \
190
    (((r) == NULL) || ((r)->region_magic != REGION_MAGIC))
191
 
192
#define CHECK_ERASEQ(q) \
193
    (((q) == NULL) || ((q)->eraseq_magic != ERASEQ_MAGIC))
194
 
195
#define EVENT(h, e, p) \
196
    ((h)->event_handler((e), (p), &(h)->event_callback_args))
197
 
198
/* In cardbus.c */
199
int cb_alloc(socket_info_t *s);
200
void cb_free(socket_info_t *s);
201
int cb_config(socket_info_t *s);
202
void cb_release(socket_info_t *s);
203
void cb_enable(socket_info_t *s);
204
void cb_disable(socket_info_t *s);
205
int read_cb_mem(socket_info_t *s, u_char fn, int space,
206
                u_int addr, u_int len, void *ptr);
207
void cb_release_cis_mem(socket_info_t *s);
208
 
209
/* In cistpl.c */
210
int read_cis_mem(socket_info_t *s, int attr,
211
                 u_int addr, u_int len, void *ptr);
212
void write_cis_mem(socket_info_t *s, int attr,
213
                   u_int addr, u_int len, void *ptr);
214
void release_cis_mem(socket_info_t *s);
215
int verify_cis_cache(socket_info_t *s);
216
void preload_cis_cache(socket_info_t *s);
217
int get_first_tuple(client_handle_t handle, tuple_t *tuple);
218
int get_next_tuple(client_handle_t handle, tuple_t *tuple);
219
int get_tuple_data(client_handle_t handle, tuple_t *tuple);
220
int parse_tuple(client_handle_t handle, tuple_t *tuple, cisparse_t *parse);
221
int validate_cis(client_handle_t handle, cisinfo_t *info);
222
int replace_cis(client_handle_t handle, cisdump_t *cis);
223
int read_tuple(client_handle_t handle, cisdata_t code, void *parse);
224
 
225
/* In bulkmem.c */
226
void retry_erase_list(struct erase_busy_t *list, u_int cause);
227
int get_first_region(client_handle_t handle, region_info_t *rgn);
228
int get_next_region(client_handle_t handle, region_info_t *rgn);
229
int register_mtd(client_handle_t handle, mtd_reg_t *reg);
230
int register_erase_queue(client_handle_t *handle, eraseq_hdr_t *header);
231
int deregister_erase_queue(eraseq_handle_t eraseq);
232
int check_erase_queue(eraseq_handle_t eraseq);
233
int open_memory(client_handle_t *handle, open_mem_t *open);
234
int close_memory(memory_handle_t handle);
235
int read_memory(memory_handle_t handle, mem_op_t *req, caddr_t buf);
236
int write_memory(memory_handle_t handle, mem_op_t *req, caddr_t buf);
237
int copy_memory(memory_handle_t handle, copy_op_t *req);
238
 
239
/* In rsrc_mgr */
240
void validate_mem(int (*is_valid)(u_long), int (*do_cksum)(u_long),
241
                  int force_low, socket_info_t *s);
242
int find_io_region(ioaddr_t *base, ioaddr_t num, ioaddr_t align,
243
                   char *name, socket_info_t *s);
244
int find_mem_region(u_long *base, u_long num, u_long align,
245
                    int force_low, char *name, socket_info_t *s);
246
int try_irq(u_int Attributes, int irq, int specific);
247
void undo_irq(u_int Attributes, int irq);
248
int adjust_resource_info(client_handle_t handle, adjust_t *adj);
249
void release_resource_db(void);
250
int proc_read_io(char *buf, char **start, off_t pos,
251
                 int count, int *eof, void *data);
252
int proc_read_mem(char *buf, char **start, off_t pos,
253
                  int count, int *eof, void *data);
254
 
255
#define MAX_SOCK 8
256
extern socket_t sockets;
257
extern socket_info_t *socket_table[MAX_SOCK];
258
 
259
#ifdef CONFIG_PROC_FS
260
extern struct proc_dir_entry *proc_pccard;
261
#endif
262
 
263
#ifdef PCMCIA_DEBUG
264
extern int pc_debug;
265
#define DEBUG(n, args...) do { if (pc_debug>(n)) printk(KERN_DEBUG args); } while (0)
266
#else
267
#define DEBUG(n, args...) do { } while (0)
268
#endif
269
 
270
#endif /* _LINUX_CS_INTERNAL_H */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.