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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [linux/] [linux-2.4/] [include/] [asm-arm/] [ecard.h] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1276 phoenix
/*
2
 * linux/include/asm-arm/ecard.h
3
 *
4
 * definitions for expansion cards
5
 *
6
 * This is a new system as from Linux 1.2.3
7
 *
8
 * Changelog:
9
 *  11-12-1996  RMK     Further minor improvements
10
 *  12-09-1997  RMK     Added interrupt enable/disable for card level
11
 *
12
 * Reference: Acorns Risc OS 3 Programmers Reference Manuals.
13
 */
14
 
15
#ifndef __ASM_ECARD_H
16
#define __ASM_ECARD_H
17
 
18
/*
19
 * Currently understood cards (but not necessarily
20
 * supported):
21
 *                        Manufacturer  Product ID
22
 */
23
#define MANU_ACORN              0x0000
24
#define PROD_ACORN_SCSI                 0x0002
25
#define PROD_ACORN_ETHER1               0x0003
26
#define PROD_ACORN_MFM                  0x000b
27
 
28
#define MANU_ANT2               0x0011
29
#define PROD_ANT_ETHER3                 0x00a4
30
 
31
#define MANU_ATOMWIDE           0x0017
32
#define PROD_ATOMWIDE_3PSERIAL          0x0090
33
 
34
#define MANU_IRLAM_INSTRUMENTS  0x001f
35
#define MANU_IRLAM_INSTRUMENTS_ETHERN   0x5678
36
 
37
#define MANU_OAK                0x0021
38
#define PROD_OAK_SCSI                   0x0058
39
 
40
#define MANU_MORLEY             0x002b
41
#define PROD_MORLEY_SCSI_UNCACHED       0x0067
42
 
43
#define MANU_CUMANA             0x003a
44
#define PROD_CUMANA_SCSI_2              0x003a
45
#define PROD_CUMANA_SCSI_1              0x00a0
46
 
47
#define MANU_ICS                0x003c
48
#define PROD_ICS_IDE                    0x00ae
49
 
50
#define MANU_ICS2               0x003d
51
#define PROD_ICS2_IDE                   0x00ae
52
 
53
#define MANU_SERPORT            0x003f
54
#define PROD_SERPORT_DSPORT             0x00b9
55
 
56
#define MANU_ARXE               0x0041
57
#define PROD_ARXE_SCSI                  0x00be
58
 
59
#define MANU_I3                 0x0046
60
#define PROD_I3_ETHERLAN500             0x00d4
61
#define PROD_I3_ETHERLAN600             0x00ec
62
#define PROD_I3_ETHERLAN600A            0x011e
63
 
64
#define MANU_ANT                0x0053
65
#define PROD_ANT_ETHERM                 0x00d8
66
#define PROD_ANT_ETHERB                 0x00e4
67
 
68
#define MANU_ALSYSTEMS          0x005b
69
#define PROD_ALSYS_SCSIATAPI            0x0107
70
 
71
#define MANU_MCS                0x0063
72
#define PROD_MCS_CONNECT32              0x0125
73
 
74
#define MANU_EESOX              0x0064
75
#define PROD_EESOX_SCSI2                0x008c
76
 
77
#define MANU_YELLOWSTONE        0x0096
78
#define PROD_YELLOWSTONE_RAPIDE32       0x0120
79
 
80
#ifdef ECARD_C
81
#define CONST
82
#else
83
#define CONST const
84
#endif
85
 
86
#define MAX_ECARDS      9
87
 
88
typedef enum {                          /* Cards address space          */
89
        ECARD_IOC,
90
        ECARD_MEMC,
91
        ECARD_EASI
92
} card_type_t;
93
 
94
typedef enum {                          /* Speed for ECARD_IOC space    */
95
        ECARD_SLOW       = 0,
96
        ECARD_MEDIUM     = 1,
97
        ECARD_FAST       = 2,
98
        ECARD_SYNC       = 3
99
} card_speed_t;
100
 
101
typedef struct ecard_id {               /* Card ID structure            */
102
        unsigned short  manufacturer;
103
        unsigned short  product;
104
        void            *data;
105
} card_ids;
106
 
107
struct in_ecid {                        /* Packed card ID information   */
108
        unsigned short  product;        /* Product code                 */
109
        unsigned short  manufacturer;   /* Manufacturer code            */
110
        unsigned char   id:4;           /* Simple ID                    */
111
        unsigned char   cd:1;           /* Chunk dir present            */
112
        unsigned char   is:1;           /* Interrupt status pointers    */
113
        unsigned char   w:2;            /* Width                        */
114
        unsigned char   country;        /* Country                      */
115
        unsigned char   irqmask;        /* IRQ mask                     */
116
        unsigned char   fiqmask;        /* FIQ mask                     */
117
        unsigned long   irqoff;         /* IRQ offset                   */
118
        unsigned long   fiqoff;         /* FIQ offset                   */
119
};
120
 
121
typedef struct expansion_card ecard_t;
122
typedef unsigned long *loader_t;
123
 
124
typedef struct {                        /* Card handler routines        */
125
        void (*irqenable)(ecard_t *ec, int irqnr);
126
        void (*irqdisable)(ecard_t *ec, int irqnr);
127
        int  (*irqpending)(ecard_t *ec);
128
        void (*fiqenable)(ecard_t *ec, int fiqnr);
129
        void (*fiqdisable)(ecard_t *ec, int fiqnr);
130
        int  (*fiqpending)(ecard_t *ec);
131
} expansioncard_ops_t;
132
 
133
#define ECARD_NUM_RESOURCES     (6)
134
 
135
#define ECARD_RES_IOCSLOW       (0)
136
#define ECARD_RES_IOCMEDIUM     (1)
137
#define ECARD_RES_IOCFAST       (2)
138
#define ECARD_RES_IOCSYNC       (3)
139
#define ECARD_RES_MEMC          (4)
140
#define ECARD_RES_EASI          (5)
141
 
142
#define ecard_resource_start(ec,nr)     ((ec)->resource[nr].start)
143
#define ecard_resource_end(ec,nr)       ((ec)->resource[nr].end)
144
#define ecard_resource_len(ec,nr)       ((ec)->resource[nr].end - \
145
                                         (ec)->resource[nr].start + 1)
146
 
147
struct ecard_driver;
148
 
149
/*
150
 * This contains all the info needed on an expansion card
151
 */
152
struct expansion_card {
153
        struct expansion_card  *next;
154
 
155
        void                    *driver_data;
156
        struct ecard_driver     *driver;
157
        struct resource         resource[ECARD_NUM_RESOURCES];
158
        char                    name[30];
159
 
160
        /* Public data */
161
        volatile unsigned char *irqaddr;        /* address of IRQ register      */
162
        volatile unsigned char *fiqaddr;        /* address of FIQ register      */
163
        unsigned char           irqmask;        /* IRQ mask                     */
164
        unsigned char           fiqmask;        /* FIQ mask                     */
165
        unsigned char           claimed;        /* Card claimed?                */
166
 
167
        void                    *irq_data;      /* Data for use for IRQ by card */
168
        void                    *fiq_data;      /* Data for use for FIQ by card */
169
        const expansioncard_ops_t *ops;         /* Enable/Disable Ops for card  */
170
 
171
        CONST unsigned int      slot_no;        /* Slot number                  */
172
        CONST unsigned int      dma;            /* DMA number (for request_dma) */
173
        CONST unsigned int      irq;            /* IRQ number (for request_irq) */
174
        CONST unsigned int      fiq;            /* FIQ number (for request_irq) */
175
        CONST card_type_t       type;           /* Type of card                 */
176
        CONST struct in_ecid    cid;            /* Card Identification          */
177
 
178
        /* Private internal data */
179
        const char              *card_desc;     /* Card description             */
180
        CONST unsigned int      podaddr;        /* Base Linux address for card  */
181
        CONST loader_t          loader;         /* loader program */
182
};
183
 
184
struct in_chunk_dir {
185
        unsigned int start_offset;
186
        union {
187
                unsigned char string[256];
188
                unsigned char data[1];
189
        } d;
190
};
191
 
192
/*
193
 * ecard_claim: claim an expansion card entry
194
 */
195
#define ecard_claim(ec) ((ec)->claimed = 1)
196
 
197
/*
198
 * ecard_release: release an expansion card entry
199
 */
200
#define ecard_release(ec) ((ec)->claimed = 0)
201
 
202
/*
203
 * Start finding cards from the top of the list
204
 */
205
extern void ecard_startfind (void);
206
 
207
/*
208
 * Find an expansion card with the correct cid, product and manufacturer code
209
 */
210
extern struct expansion_card *ecard_find (int cid, const card_ids *ids);
211
 
212
/*
213
 * Read a chunk from an expansion card
214
 * cd : where to put read data
215
 * ec : expansion card info struct
216
 * id : id number to find
217
 * num: (n+1)'th id to find.
218
 */
219
extern int ecard_readchunk (struct in_chunk_dir *cd, struct expansion_card *ec, int id, int num);
220
 
221
/*
222
 * Obtain the address of a card
223
 */
224
extern unsigned int ecard_address (struct expansion_card *ec, card_type_t card_type, card_speed_t speed);
225
 
226
#ifdef ECARD_C
227
/* Definitions internal to ecard.c - for it's use only!!
228
 *
229
 * External expansion card header as read from the card
230
 */
231
struct ex_ecid {
232
        unsigned char   r_irq:1;
233
        unsigned char   r_zero:1;
234
        unsigned char   r_fiq:1;
235
        unsigned char   r_id:4;
236
        unsigned char   r_a:1;
237
 
238
        unsigned char   r_cd:1;
239
        unsigned char   r_is:1;
240
        unsigned char   r_w:2;
241
        unsigned char   r_r1:4;
242
 
243
        unsigned char   r_r2:8;
244
 
245
        unsigned char   r_prod[2];
246
 
247
        unsigned char   r_manu[2];
248
 
249
        unsigned char   r_country;
250
 
251
        unsigned char   r_irqmask;
252
        unsigned char   r_irqoff[3];
253
 
254
        unsigned char   r_fiqmask;
255
        unsigned char   r_fiqoff[3];
256
};
257
 
258
/*
259
 * Chunk directory entry as read from the card
260
 */
261
struct ex_chunk_dir {
262
        unsigned char r_id;
263
        unsigned char r_len[3];
264
        unsigned long r_start;
265
        union {
266
                char string[256];
267
                char data[1];
268
        } d;
269
#define c_id(x)         ((x)->r_id)
270
#define c_len(x)        ((x)->r_len[0]|((x)->r_len[1]<<8)|((x)->r_len[2]<<16))
271
#define c_start(x)      ((x)->r_start)
272
};
273
 
274
#endif
275
 
276
struct ecard_driver {
277
        int                     (*probe)(struct expansion_card *, const struct ecard_id *);
278
        void                    (*remove)(struct expansion_card *);
279
        void                    (*shutdown)(struct expansion_card *);
280
        const struct ecard_id   *id_table;
281
        unsigned int            id;
282
};
283
 
284
#define ecard_set_drvdata(ec,data)      ((ec)->driver_data = (data))
285
#define ecard_get_drvdata(ec)           ((ec)->driver_data)
286
 
287
int ecard_register_driver(struct ecard_driver *);
288
void ecard_remove_driver(struct ecard_driver *);
289
 
290
#endif

powered by: WebSVN 2.1.0

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