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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [rc203soc/] [sw/] [uClinux/] [drivers/] [net/] [wavelan.h] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1626 jcastillo
/*
2
 *      Wavelan ISA driver
3
 *
4
 *              Jean II - HPLB '96
5
 *
6
 * Reorganisation and extension of the driver.
7
 * Original copyrigth follow. See wavelan.p.h for details.
8
 *
9
 * This file contain the declarations of the Wavelan hardware. Note that
10
 * the Wavelan ISA include a i82586 controler (see definitions in
11
 * file i82586.h).
12
 *
13
 * The main difference between the ISA hardware and the pcmcia one is
14
 * the Ethernet Controler (i82586 instead of i82593).
15
 * The i82586 allow multiple transmit buffers. The PSA need to be accessed
16
 * through the host interface.
17
 */
18
 
19
#ifndef _WAVELAN_H
20
#define _WAVELAN_H
21
 
22
/* The detection of the wavelan card is made by reading the MAC
23
 * address from the card and checking it. If you have a non AT&T
24
 * product (OEM, like DEC RoamAbout, or Digital Ocean, Epson, ...),
25
 * you might need to modify this part to accomodate your hardware...
26
 */
27
const char      MAC_ADDRESSES[][3] =
28
{
29
  { 0x08, 0x00, 0x0E },         /* AT&T Wavelan (standard) & DEC RoamAbout */
30
  { 0x08, 0x00, 0x6A },         /* AT&T Wavelan (alternate) */
31
  { 0x00, 0x00, 0xE1 },         /* Hitachi Wavelan */
32
  { 0x00, 0x60, 0x1D }          /* Lucent Wavelan (another one) */
33
  /* Add your card here and send me the patch ! */
34
};
35
 
36
#define WAVELAN_ADDR_SIZE       6       /* Size of a MAC address */
37
 
38
#define WAVELAN_MTU             1500    /* Maximum size of WaveLAN packet */
39
 
40
#define MAXDATAZ                (WAVELAN_ADDR_SIZE + WAVELAN_ADDR_SIZE + 2 + WAVELAN_MTU)
41
 
42
/*************************** PC INTERFACE ****************************/
43
 
44
/*
45
 * Host Adaptor structure.
46
 * (base is board port address).
47
 */
48
typedef union hacs_u    hacs_u;
49
union hacs_u
50
{
51
        unsigned short  hu_command;             /* Command register */
52
#define         HACR_RESET              0x0001  /* Reset board */
53
#define         HACR_CA                 0x0002  /* Set Channel Attention for 82586 */
54
#define         HACR_16BITS             0x0004  /* 16 bits operation (0 => 8bits) */
55
#define         HACR_OUT0               0x0008  /* General purpose output pin 0 */
56
                                                /* not used - must be 1 */
57
#define         HACR_OUT1               0x0010  /* General purpose output pin 1 */
58
                                                /* not used - must be 1 */
59
#define         HACR_82586_INT_ENABLE   0x0020  /* Enable 82586 interrupts */
60
#define         HACR_MMC_INT_ENABLE     0x0040  /* Enable MMC interrupts */
61
#define         HACR_INTR_CLR_ENABLE    0x0080  /* Enable interrupt status read/clear */
62
        unsigned short  hu_status;              /* Status Register */
63
#define         HASR_82586_INTR         0x0001  /* Interrupt request from 82586 */
64
#define         HASR_MMC_INTR           0x0002  /* Interrupt request from MMC */
65
#define         HASR_MMC_BUSY           0x0004  /* MMC busy indication */
66
#define         HASR_PSA_BUSY           0x0008  /* LAN parameter storage area busy */
67
};
68
 
69
typedef struct ha_t     ha_t;
70
struct ha_t
71
{
72
        hacs_u          ha_cs;          /* Command and status registers */
73
#define                 ha_command      ha_cs.hu_command
74
#define                 ha_status       ha_cs.hu_status
75
        unsigned short  ha_mmcr;        /* Modem Management Ctrl Register */
76
        unsigned short  ha_pior0;       /* Program I/O Address Register Port 0 */
77
        unsigned short  ha_piop0;       /* Program I/O Port 0 */
78
        unsigned short  ha_pior1;       /* Program I/O Address Register Port 1 */
79
        unsigned short  ha_piop1;       /* Program I/O Port 1 */
80
        unsigned short  ha_pior2;       /* Program I/O Address Register Port 2 */
81
        unsigned short  ha_piop2;       /* Program I/O Port 2 */
82
};
83
 
84
#define HA_SIZE         16
85
 
86
#define hoff(p,f)       (unsigned short)((void *)(&((ha_t *)((void *)0 + (p)))->f) - (void *)0)
87
#define HACR(p)         hoff(p, ha_command)
88
#define HASR(p)         hoff(p, ha_status)
89
#define MMCR(p)         hoff(p, ha_mmcr)
90
#define PIOR0(p)        hoff(p, ha_pior0)
91
#define PIOP0(p)        hoff(p, ha_piop0)
92
#define PIOR1(p)        hoff(p, ha_pior1)
93
#define PIOP1(p)        hoff(p, ha_piop1)
94
#define PIOR2(p)        hoff(p, ha_pior2)
95
#define PIOP2(p)        hoff(p, ha_piop2)
96
 
97
/*
98
 * Program I/O Mode Register values.
99
 */
100
#define STATIC_PIO              0        /* Mode 1: static mode */
101
                                        /* RAM access ??? */
102
#define AUTOINCR_PIO            1       /* Mode 2: auto increment mode */
103
                                        /* RAM access ??? */
104
#define AUTODECR_PIO            2       /* Mode 3: auto decrement mode */
105
                                        /* RAM access ??? */
106
#define PARAM_ACCESS_PIO        3       /* Mode 4: LAN parameter access mode */
107
                                        /* Parameter access. */
108
#define PIO_MASK                3       /* register mask */
109
#define PIOM(cmd,piono)         ((u_short)cmd << 10 << (piono * 2))
110
 
111
#define HACR_DEFAULT            (HACR_OUT0 | HACR_OUT1 | HACR_16BITS | PIOM(STATIC_PIO, 0) | PIOM(AUTOINCR_PIO, 1) | PIOM(PARAM_ACCESS_PIO, 2))
112
#define HACR_INTRON             (HACR_82586_INT_ENABLE | HACR_MMC_INT_ENABLE | HACR_INTR_CLR_ENABLE)
113
 
114
/************************** MEMORY LAYOUT **************************/
115
 
116
/*
117
 * Onboard 64k RAM layout.
118
 * (Offsets from 0x0000.)
119
 */
120
#define OFFSET_RU               0x0000          /* 75 % memory */
121
#define OFFSET_CU               0xC000          /* 25 % memory */
122
#define OFFSET_SCB              (OFFSET_ISCP - sizeof(scb_t))
123
#define OFFSET_ISCP             (OFFSET_SCP - sizeof(iscp_t))
124
#define OFFSET_SCP              I82586_SCP_ADDR
125
 
126
#define RXBLOCKZ                (sizeof(fd_t) + sizeof(rbd_t) + MAXDATAZ)
127
#define TXBLOCKZ                (sizeof(ac_tx_t) + sizeof(ac_nop_t) + sizeof(tbd_t) + MAXDATAZ)
128
 
129
#define NRXBLOCKS               ((OFFSET_CU - OFFSET_RU) / RXBLOCKZ)
130
#define NTXBLOCKS               ((OFFSET_SCB - OFFSET_CU) / TXBLOCKZ)
131
 
132
/********************** PARAMETER STORAGE AREA **********************/
133
 
134
/*
135
 * Parameter Storage Area (PSA).
136
 */
137
typedef struct psa_t    psa_t;
138
struct psa_t
139
{
140
  unsigned char psa_io_base_addr_1;     /* [0x00] Base address 1 ??? */
141
  unsigned char psa_io_base_addr_2;     /* [0x01] Base address 2 */
142
  unsigned char psa_io_base_addr_3;     /* [0x02] Base address 3 */
143
  unsigned char psa_io_base_addr_4;     /* [0x03] Base address 4 */
144
  unsigned char psa_rem_boot_addr_1;    /* [0x04] Remote Boot Address 1 */
145
  unsigned char psa_rem_boot_addr_2;    /* [0x05] Remote Boot Address 2 */
146
  unsigned char psa_rem_boot_addr_3;    /* [0x06] Remote Boot Address 3 */
147
  unsigned char psa_holi_params;        /* [0x07] HOst Lan Interface (HOLI) Parameters */
148
  unsigned char psa_int_req_no;         /* [0x08] Interrupt Request Line */
149
  unsigned char psa_unused0[7];         /* [0x09-0x0F] unused */
150
 
151
  unsigned char psa_univ_mac_addr[WAVELAN_ADDR_SIZE];   /* [0x10-0x15] Universal (factory) MAC Address */
152
  unsigned char psa_local_mac_addr[WAVELAN_ADDR_SIZE];  /* [0x16-1B] Local MAC Address */
153
  unsigned char psa_univ_local_sel;     /* [0x1C] Universal Local Selection */
154
#define         PSA_UNIVERSAL   0                /* Universal (factory) */
155
#define         PSA_LOCAL       1               /* Local */
156
  unsigned char psa_comp_number;        /* [0x1D] Compatability Number: */
157
#define         PSA_COMP_PC_AT_915      0       /* PC-AT 915 MHz        */
158
#define         PSA_COMP_PC_MC_915      1       /* PC-MC 915 MHz        */
159
#define         PSA_COMP_PC_AT_2400     2       /* PC-AT 2.4 GHz        */
160
#define         PSA_COMP_PC_MC_2400     3       /* PC-MC 2.4 GHz        */
161
#define         PSA_COMP_PCMCIA_915     4       /* PCMCIA 915 MHz or 2.0 */
162
  unsigned char psa_thr_pre_set;        /* [0x1E] Modem Threshold Preset */
163
  unsigned char psa_feature_select;     /* [0x1F] Call code required (1=on) */
164
#define         PSA_FEATURE_CALL_CODE   0x01    /* Call code required (Japan) */
165
  unsigned char psa_subband;            /* [0x20] Subband       */
166
#define         PSA_SUBBAND_915         0        /* 915 MHz or 2.0 */
167
#define         PSA_SUBBAND_2425        1       /* 2425 MHz     */
168
#define         PSA_SUBBAND_2460        2       /* 2460 MHz     */
169
#define         PSA_SUBBAND_2484        3       /* 2484 MHz     */
170
#define         PSA_SUBBAND_2430_5      4       /* 2430.5 MHz   */
171
  unsigned char psa_quality_thr;        /* [0x21] Modem Quality Threshold */
172
  unsigned char psa_mod_delay;          /* [0x22] Modem Delay ??? (reserved) */
173
  unsigned char psa_nwid[2];            /* [0x23-0x24] Network ID */
174
  unsigned char psa_nwid_select;        /* [0x25] Network ID Select On Off */
175
  unsigned char psa_encryption_select;  /* [0x26] Encryption On Off */
176
  unsigned char psa_encryption_key[8];  /* [0x27-0x2E] Encryption Key */
177
  unsigned char psa_databus_width;      /* [0x2F] AT bus width select 8/16 */
178
  unsigned char psa_call_code[8];       /* [0x30-0x37] (Japan) Call Code */
179
  unsigned char psa_nwid_prefix[2];     /* [0x38-0x39] Roaming domain */
180
  unsigned char psa_reserved[2];        /* [0x3A-0x3B] Reserved - fixed 00 */
181
  unsigned char psa_conf_status;        /* [0x3C] Conf Status, bit 0=1:config*/
182
  unsigned char psa_crc[2];             /* [0x3D] CRC-16 over PSA */
183
  unsigned char psa_crc_status;         /* [0x3F] CRC Valid Flag */
184
};
185
 
186
#define PSA_SIZE        64
187
 
188
/* Calculate offset of a field in the above structure
189
 * Warning : only even addresses are used */
190
#define psaoff(p,f)     ((unsigned short) ((void *)(&((psa_t *) ((void *) NULL + (p)))->f) - (void *) NULL))
191
 
192
/******************** MODEM MANAGEMENT INTERFACE ********************/
193
 
194
/*
195
 * Modem Management Controller (MMC) write structure.
196
 */
197
typedef struct mmw_t    mmw_t;
198
struct mmw_t
199
{
200
  unsigned char mmw_encr_key[8];        /* encryption key */
201
  unsigned char mmw_encr_enable;        /* enable/disable encryption */
202
#define MMW_ENCR_ENABLE_MODE    0x02    /* Mode of security option */
203
#define MMW_ENCR_ENABLE_EN      0x01    /* Enable security option */
204
  unsigned char mmw_unused0[1];         /* unused */
205
  unsigned char mmw_des_io_invert;      /* Encryption option */
206
#define MMW_DES_IO_INVERT_RES   0x0F    /* Reserved */
207
#define MMW_DES_IO_INVERT_CTRL  0xF0    /* Control ??? (set to 0) */
208
  unsigned char mmw_unused1[5];         /* unused */
209
  unsigned char mmw_loopt_sel;          /* looptest selection */
210
#define MMW_LOOPT_SEL_DIS_NWID  0x40    /* disable NWID filtering */
211
#define MMW_LOOPT_SEL_INT       0x20    /* activate Attention Request */
212
#define MMW_LOOPT_SEL_LS        0x10    /* looptest w/o collision avoidance */
213
#define MMW_LOOPT_SEL_LT3A      0x08    /* looptest 3a */
214
#define MMW_LOOPT_SEL_LT3B      0x04    /* looptest 3b */
215
#define MMW_LOOPT_SEL_LT3C      0x02    /* looptest 3c */
216
#define MMW_LOOPT_SEL_LT3D      0x01    /* looptest 3d */
217
  unsigned char mmw_jabber_enable;      /* jabber timer enable */
218
  /* Abort transmissions > 200 ms */
219
  unsigned char mmw_freeze;             /* freeze / unfreeeze signal level */
220
  /* 0 : signal level & qual updated for every new message, 1 : frozen */
221
  unsigned char mmw_anten_sel;          /* antenna selection */
222
#define MMW_ANTEN_SEL_SEL       0x01    /* direct antenna selection */
223
#define MMW_ANTEN_SEL_ALG_EN    0x02    /* antenna selection algo. enable */
224
  unsigned char mmw_ifs;                /* inter frame spacing */
225
  /* min time between transmission in bit periods (.5 us) - bit 0 ignored */
226
  unsigned char mmw_mod_delay;          /* modem delay (synchro) */
227
  unsigned char mmw_jam_time;           /* jamming time (after collision) */
228
  unsigned char mmw_unused2[1];         /* unused */
229
  unsigned char mmw_thr_pre_set;        /* level threshold preset */
230
  /* Discard all packet with signal < this value (4) */
231
  unsigned char mmw_decay_prm;          /* decay parameters */
232
  unsigned char mmw_decay_updat_prm;    /* decay update parameterz */
233
  unsigned char mmw_quality_thr;        /* quality (z-quotient) threshold */
234
  /* Discard all packet with quality < this value (3) */
235
  unsigned char mmw_netw_id_l;          /* NWID low order byte */
236
  unsigned char mmw_netw_id_h;          /* NWID high order byte */
237
  /* Network ID or Domain : create virtual net on the air */
238
 
239
  /* 2.0 Hardware extension - frequency selection support */
240
  unsigned char mmw_mode_select;        /* for analog tests (set to 0) */
241
  unsigned char mmw_unused3[1];         /* unused */
242
  unsigned char mmw_fee_ctrl;           /* frequency eeprom control */
243
#define MMW_FEE_CTRL_PRE        0x10    /* Enable protected instructions */
244
#define MMW_FEE_CTRL_DWLD       0x08    /* Download eeprom to mmc */
245
#define MMW_FEE_CTRL_CMD        0x07    /* EEprom commands : */
246
#define MMW_FEE_CTRL_READ       0x06    /* Read */
247
#define MMW_FEE_CTRL_WREN       0x04    /* Write enable */
248
#define MMW_FEE_CTRL_WRITE      0x05    /* Write data to address */
249
#define MMW_FEE_CTRL_WRALL      0x04    /* Write data to all addresses */
250
#define MMW_FEE_CTRL_WDS        0x04    /* Write disable */
251
#define MMW_FEE_CTRL_PRREAD     0x16    /* Read addr from protect register */
252
#define MMW_FEE_CTRL_PREN       0x14    /* Protect register enable */
253
#define MMW_FEE_CTRL_PRCLEAR    0x17    /* Unprotect all registers */
254
#define MMW_FEE_CTRL_PRWRITE    0x15    /* Write addr in protect register */
255
#define MMW_FEE_CTRL_PRDS       0x14    /* Protect register disable */
256
  /* Never issue this command (PRDS) : it's irreversible !!! */
257
 
258
  unsigned char mmw_fee_addr;           /* EEprom address */
259
#define MMW_FEE_ADDR_CHANNEL    0xF0    /* Select the channel */
260
#define MMW_FEE_ADDR_OFFSET     0x0F    /* Offset in channel data */
261
#define MMW_FEE_ADDR_EN         0xC0    /* FEE_CTRL enable operations */
262
#define MMW_FEE_ADDR_DS         0x00    /* FEE_CTRL disable operations */
263
#define MMW_FEE_ADDR_ALL        0x40    /* FEE_CTRL all operations */
264
#define MMW_FEE_ADDR_CLEAR      0xFF    /* FEE_CTRL clear operations */
265
 
266
  unsigned char mmw_fee_data_l;         /* Write data to EEprom */
267
  unsigned char mmw_fee_data_h;         /* high octet */
268
  unsigned char mmw_ext_ant;            /* Setting for external antenna */
269
#define MMW_EXT_ANT_EXTANT      0x01    /* Select external antenna */
270
#define MMW_EXT_ANT_POL         0x02    /* Polarity of the antenna */
271
#define MMW_EXT_ANT_INTERNAL    0x00    /* Internal antenna */
272
#define MMW_EXT_ANT_EXTERNAL    0x03    /* External antenna */
273
#define MMW_EXT_ANT_IQ_TEST     0x1C    /* IQ test pattern (set to 0) */
274
};
275
 
276
#define MMW_SIZE        37
277
 
278
#define mmwoff(p,f)     (unsigned short)((void *)(&((mmw_t *)((void *)0 + (p)))->f) - (void *)0)
279
 
280
/*
281
 * Modem Management Controller (MMC) read structure.
282
 */
283
typedef struct mmr_t    mmr_t;
284
struct mmr_t
285
{
286
  unsigned char mmr_unused0[8];         /* unused */
287
  unsigned char mmr_des_status;         /* encryption status */
288
  unsigned char mmr_des_avail;          /* encryption available (0x55 read) */
289
#define MMR_DES_AVAIL_DES       0x55            /* DES available */
290
#define MMR_DES_AVAIL_AES       0x33            /* AES (AT&T) available */
291
  unsigned char mmr_des_io_invert;      /* des I/O invert register */
292
  unsigned char mmr_unused1[5];         /* unused */
293
  unsigned char mmr_dce_status;         /* DCE status */
294
#define MMR_DCE_STATUS_RX_BUSY          0x01    /* receiver busy */
295
#define MMR_DCE_STATUS_LOOPT_IND        0x02    /* loop test indicated */
296
#define MMR_DCE_STATUS_TX_BUSY          0x04    /* transmitter on */
297
#define MMR_DCE_STATUS_JBR_EXPIRED      0x08    /* jabber timer expired */
298
#define MMR_DCE_STATUS                  0x0F    /* mask to get the bits */
299
  unsigned char mmr_dsp_id;             /* DSP id (AA = Daedalus rev A) */
300
  unsigned char mmr_unused2[2];         /* unused */
301
  unsigned char mmr_correct_nwid_l;     /* # of correct NWID's rxd (low) */
302
  unsigned char mmr_correct_nwid_h;     /* # of correct NWID's rxd (high) */
303
  /* Warning : Read high order octet first !!! */
304
  unsigned char mmr_wrong_nwid_l;       /* # of wrong NWID's rxd (low) */
305
  unsigned char mmr_wrong_nwid_h;       /* # of wrong NWID's rxd (high) */
306
  unsigned char mmr_thr_pre_set;        /* level threshold preset */
307
#define MMR_THR_PRE_SET         0x3F            /* level threshold preset */
308
#define MMR_THR_PRE_SET_CUR     0x80            /* Current signal above it */
309
  unsigned char mmr_signal_lvl;         /* signal level */
310
#define MMR_SIGNAL_LVL          0x3F            /* signal level */
311
#define MMR_SIGNAL_LVL_VALID    0x80            /* Updated since last read */
312
  unsigned char mmr_silence_lvl;        /* silence level (noise) */
313
#define MMR_SILENCE_LVL         0x3F            /* silence level */
314
#define MMR_SILENCE_LVL_VALID   0x80            /* Updated since last read */
315
  unsigned char mmr_sgnl_qual;          /* signal quality */
316
#define MMR_SGNL_QUAL           0x0F            /* signal quality */
317
#define MMR_SGNL_QUAL_ANT       0x80            /* current antenna used */
318
  unsigned char mmr_netw_id_l;          /* NWID low order byte ??? */
319
  unsigned char mmr_unused3[3];         /* unused */
320
 
321
  /* 2.0 Hardware extension - frequency selection support */
322
  unsigned char mmr_fee_status;         /* Status of frequency eeprom */
323
#define MMR_FEE_STATUS_ID       0xF0            /* Modem revision id */
324
#define MMR_FEE_STATUS_DWLD     0x08            /* Download in progress */
325
#define MMR_FEE_STATUS_BUSY     0x04            /* EEprom busy */
326
  unsigned char mmr_unused4[1];         /* unused */
327
  unsigned char mmr_fee_data_l;         /* Read data from eeprom (low) */
328
  unsigned char mmr_fee_data_h;         /* Read data from eeprom (high) */
329
};
330
 
331
#define MMR_SIZE        36
332
 
333
#define mmroff(p,f)     (unsigned short)((void *)(&((mmr_t *)((void *)0 + (p)))->f) - (void *)0)
334
 
335
/* Make the two above structures one */
336
typedef union mm_t
337
{
338
  struct mmw_t  w;      /* Write to the mmc */
339
  struct mmr_t  r;      /* Read from the mmc */
340
} mm_t;
341
 
342
#endif /* _WAVELAN_H */
343
 
344
/*
345
 * This software may only be used and distributed
346
 * according to the terms of the GNU Public License.
347
 *
348
 * For more details, see wavelan.c.
349
 */

powered by: WebSVN 2.1.0

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