Main Page | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

wavelan.h

Go to the documentation of this file.
00001 /*
00002  *      WaveLAN ISA driver
00003  *
00004  *              Jean II - HPLB '96
00005  *
00006  * Reorganisation and extension of the driver.
00007  * Original copyright follows. See wavelan.p.h for details.
00008  *
00009  * This file contains the declarations for the WaveLAN hardware. Note that
00010  * the WaveLAN ISA includes a i82586 controller (see definitions in
00011  * file i82586.h).
00012  *
00013  * The main difference between the ISA hardware and the PCMCIA one is
00014  * the Ethernet controller (i82586 instead of i82593).
00015  * The i82586 allows multiple transmit buffers.  The PSA needs to be accessed
00016  * through the host interface.
00017  */
00018 
00019 #ifndef _WAVELAN_H
00020 #define _WAVELAN_H
00021 
00022 /************************** MAGIC NUMBERS ***************************/
00023 
00024 /* Detection of the WaveLAN card is done by reading the MAC
00025  * address from the card and checking it.  If you have a non-AT&T
00026  * product (OEM, like DEC RoamAbout, Digital Ocean, or Epson),
00027  * you might need to modify this part to accommodate your hardware.
00028  */
00029 const char      MAC_ADDRESSES[][3] =
00030 {
00031   { 0x08, 0x00, 0x0E },         /* AT&T WaveLAN (standard) & DEC RoamAbout */
00032   { 0x08, 0x00, 0x6A },         /* AT&T WaveLAN (alternate) */
00033   { 0x00, 0x00, 0xE1 },         /* Hitachi Wavelan */
00034   { 0x00, 0x60, 0x1D }          /* Lucent Wavelan (another one) */
00035   /* Add your card here and send me the patch! */
00036 };
00037 
00038 #define WAVELAN_ADDR_SIZE       6       /* Size of a MAC address */
00039 
00040 #define WAVELAN_MTU             1500    /* Maximum size of WaveLAN packet */
00041 
00042 #define MAXDATAZ                (WAVELAN_ADDR_SIZE + WAVELAN_ADDR_SIZE + 2 + WAVELAN_MTU)
00043 
00044 /*
00045  * Constants used to convert channels to frequencies
00046  */
00047 
00048 /* Frequency available in the 2.0 modem, in units of 250 kHz
00049  * (as read in the offset register of the dac area).
00050  * Used to map channel numbers used by `wfreqsel' to frequencies
00051  */
00052 const short     channel_bands[] = { 0x30, 0x58, 0x64, 0x7A, 0x80, 0xA8,
00053                                     0xD0, 0xF0, 0xF8, 0x150 };
00054 
00055 /* Frequencies of the 1.0 modem (fixed frequencies).
00056  * Use to map the PSA `subband' to a frequency
00057  * Note : all frequencies apart from the first one need to be multiplied by 10
00058  */
00059 const int       fixed_bands[] = { 915e6, 2.425e8, 2.46e8, 2.484e8, 2.4305e8 };
00060 
00061 
00062 
00063 /*************************** PC INTERFACE ****************************/
00064 
00065 /*
00066  * Host Adaptor structure.
00067  * (base is board port address).
00068  */
00069 typedef union hacs_u    hacs_u;
00070 union hacs_u
00071 {
00072         unsigned short  hu_command;             /* Command register */
00073 #define         HACR_RESET              0x0001  /* Reset board */
00074 #define         HACR_CA                 0x0002  /* Set Channel Attention for 82586 */
00075 #define         HACR_16BITS             0x0004  /* 16-bit operation (0 => 8bits) */
00076 #define         HACR_OUT0               0x0008  /* General purpose output pin 0 */
00077                                                 /* not used - must be 1 */
00078 #define         HACR_OUT1               0x0010  /* General purpose output pin 1 */
00079                                                 /* not used - must be 1 */
00080 #define         HACR_82586_INT_ENABLE   0x0020  /* Enable 82586 interrupts */
00081 #define         HACR_MMC_INT_ENABLE     0x0040  /* Enable MMC interrupts */
00082 #define         HACR_INTR_CLR_ENABLE    0x0080  /* Enable interrupt status read/clear */
00083         unsigned short  hu_status;              /* Status Register */
00084 #define         HASR_82586_INTR         0x0001  /* Interrupt request from 82586 */
00085 #define         HASR_MMC_INTR           0x0002  /* Interrupt request from MMC */
00086 #define         HASR_MMC_BUSY           0x0004  /* MMC busy indication */
00087 #define         HASR_PSA_BUSY           0x0008  /* LAN parameter storage area busy */
00088 };
00089 
00090 typedef struct ha_t     ha_t;
00091 struct ha_t
00092 {
00093         hacs_u          ha_cs;          /* Command and status registers */
00094 #define                 ha_command      ha_cs.hu_command
00095 #define                 ha_status       ha_cs.hu_status
00096         unsigned short  ha_mmcr;        /* Modem Management Ctrl Register */
00097         unsigned short  ha_pior0;       /* Program I/O Address Register Port 0 */
00098         unsigned short  ha_piop0;       /* Program I/O Port 0 */
00099         unsigned short  ha_pior1;       /* Program I/O Address Register Port 1 */
00100         unsigned short  ha_piop1;       /* Program I/O Port 1 */
00101         unsigned short  ha_pior2;       /* Program I/O Address Register Port 2 */
00102         unsigned short  ha_piop2;       /* Program I/O Port 2 */
00103 };
00104 
00105 #define HA_SIZE         16
00106 
00107 #define hoff(p,f)       (unsigned short)((void *)(&((ha_t *)((void *)0 + (p)))->f) - (void *)0)
00108 #define HACR(p)         hoff(p, ha_command)
00109 #define HASR(p)         hoff(p, ha_status)
00110 #define MMCR(p)         hoff(p, ha_mmcr)
00111 #define PIOR0(p)        hoff(p, ha_pior0)
00112 #define PIOP0(p)        hoff(p, ha_piop0)
00113 #define PIOR1(p)        hoff(p, ha_pior1)
00114 #define PIOP1(p)        hoff(p, ha_piop1)
00115 #define PIOR2(p)        hoff(p, ha_pior2)
00116 #define PIOP2(p)        hoff(p, ha_piop2)
00117 
00118 /*
00119  * Program I/O Mode Register values.
00120  */
00121 #define STATIC_PIO              0       /* Mode 1: static mode */
00122                                         /* RAM access ??? */
00123 #define AUTOINCR_PIO            1       /* Mode 2: auto increment mode */
00124                                         /* RAM access ??? */
00125 #define AUTODECR_PIO            2       /* Mode 3: auto decrement mode */
00126                                         /* RAM access ??? */
00127 #define PARAM_ACCESS_PIO        3       /* Mode 4: LAN parameter access mode */
00128                                         /* Parameter access. */
00129 #define PIO_MASK                3       /* register mask */
00130 #define PIOM(cmd,piono)         ((u_short)cmd << 10 << (piono * 2))
00131 
00132 #define HACR_DEFAULT            (HACR_OUT0 | HACR_OUT1 | HACR_16BITS | PIOM(STATIC_PIO, 0) | PIOM(AUTOINCR_PIO, 1) | PIOM(PARAM_ACCESS_PIO, 2))
00133 #define HACR_INTRON             (HACR_82586_INT_ENABLE | HACR_MMC_INT_ENABLE | HACR_INTR_CLR_ENABLE)
00134 
00135 /************************** MEMORY LAYOUT **************************/
00136 
00137 /*
00138  * Onboard 64 k RAM layout.
00139  * (Offsets from 0x0000.)
00140  */
00141 #define OFFSET_RU               0x0000          /* 75% memory */
00142 #define OFFSET_CU               0xC000          /* 25% memory */
00143 #define OFFSET_SCB              (OFFSET_ISCP - sizeof(scb_t))
00144 #define OFFSET_ISCP             (OFFSET_SCP - sizeof(iscp_t))
00145 #define OFFSET_SCP              I82586_SCP_ADDR
00146 
00147 #define RXBLOCKZ                (sizeof(fd_t) + sizeof(rbd_t) + MAXDATAZ)
00148 #define TXBLOCKZ                (sizeof(ac_tx_t) + sizeof(ac_nop_t) + sizeof(tbd_t) + MAXDATAZ)
00149 
00150 #define NRXBLOCKS               ((OFFSET_CU - OFFSET_RU) / RXBLOCKZ)
00151 #define NTXBLOCKS               ((OFFSET_SCB - OFFSET_CU) / TXBLOCKZ)
00152 
00153 /********************** PARAMETER STORAGE AREA **********************/
00154 
00155 /*
00156  * Parameter Storage Area (PSA).
00157  */
00158 typedef struct psa_t    psa_t;
00159 struct psa_t
00160 {
00161   unsigned char psa_io_base_addr_1;     /* [0x00] Base address 1 ??? */
00162   unsigned char psa_io_base_addr_2;     /* [0x01] Base address 2 */
00163   unsigned char psa_io_base_addr_3;     /* [0x02] Base address 3 */
00164   unsigned char psa_io_base_addr_4;     /* [0x03] Base address 4 */
00165   unsigned char psa_rem_boot_addr_1;    /* [0x04] Remote Boot Address 1 */
00166   unsigned char psa_rem_boot_addr_2;    /* [0x05] Remote Boot Address 2 */
00167   unsigned char psa_rem_boot_addr_3;    /* [0x06] Remote Boot Address 3 */
00168   unsigned char psa_holi_params;        /* [0x07] HOst Lan Interface (HOLI) Parameters */
00169   unsigned char psa_int_req_no;         /* [0x08] Interrupt Request Line */
00170   unsigned char psa_unused0[7];         /* [0x09-0x0F] unused */
00171 
00172   unsigned char psa_univ_mac_addr[WAVELAN_ADDR_SIZE];   /* [0x10-0x15] Universal (factory) MAC Address */
00173   unsigned char psa_local_mac_addr[WAVELAN_ADDR_SIZE];  /* [0x16-1B] Local MAC Address */
00174   unsigned char psa_univ_local_sel;     /* [0x1C] Universal Local Selection */
00175 #define         PSA_UNIVERSAL   0               /* Universal (factory) */
00176 #define         PSA_LOCAL       1               /* Local */
00177   unsigned char psa_comp_number;        /* [0x1D] Compatibility Number:  */
00178 #define         PSA_COMP_PC_AT_915      0       /* PC-AT 915 MHz         */
00179 #define         PSA_COMP_PC_MC_915      1       /* PC-MC 915 MHz         */
00180 #define         PSA_COMP_PC_AT_2400     2       /* PC-AT 2.4 GHz         */
00181 #define         PSA_COMP_PC_MC_2400     3       /* PC-MC 2.4 GHz         */
00182 #define         PSA_COMP_PCMCIA_915     4       /* PCMCIA 915 MHz or 2.0 */
00183   unsigned char psa_thr_pre_set;        /* [0x1E] Modem Threshold Preset */
00184   unsigned char psa_feature_select;     /* [0x1F] Call code required (1=on) */
00185 #define         PSA_FEATURE_CALL_CODE   0x01    /* Call code required (Japan) */
00186   unsigned char psa_subband;            /* [0x20] Subband         */
00187 #define         PSA_SUBBAND_915         0       /* 915 MHz or 2.0 */
00188 #define         PSA_SUBBAND_2425        1       /* 2425 MHz       */
00189 #define         PSA_SUBBAND_2460        2       /* 2460 MHz       */
00190 #define         PSA_SUBBAND_2484        3       /* 2484 MHz       */
00191 #define         PSA_SUBBAND_2430_5      4       /* 2430.5 MHz     */
00192   unsigned char psa_quality_thr;        /* [0x21] Modem Quality Threshold */
00193   unsigned char psa_mod_delay;          /* [0x22] Modem Delay (?) (reserved) */
00194   unsigned char psa_nwid[2];            /* [0x23-0x24] Network ID */
00195   unsigned char psa_nwid_select;        /* [0x25] Network ID Select On/Off */
00196   unsigned char psa_encryption_select;  /* [0x26] Encryption On/Off */
00197   unsigned char psa_encryption_key[8];  /* [0x27-0x2E] Encryption Key */
00198   unsigned char psa_databus_width;      /* [0x2F] AT bus width select 8/16 */
00199   unsigned char psa_call_code[8];       /* [0x30-0x37] (Japan) Call Code */
00200   unsigned char psa_nwid_prefix[2];     /* [0x38-0x39] Roaming domain */
00201   unsigned char psa_reserved[2];        /* [0x3A-0x3B] Reserved - fixed 00 */
00202   unsigned char psa_conf_status;        /* [0x3C] Conf Status, bit 0=1:config*/
00203   unsigned char psa_crc[2];             /* [0x3D] CRC-16 over PSA */
00204   unsigned char psa_crc_status;         /* [0x3F] CRC Valid Flag */
00205 };
00206 
00207 #define PSA_SIZE        64
00208 
00209 /* Calculate offset of a field in the above structure.
00210  * Warning:  only even addresses are used. */
00211 #define psaoff(p,f)     ((unsigned short) ((void *)(&((psa_t *) ((void *) NULL + (p)))->f) - (void *) NULL))
00212 
00213 /******************** MODEM MANAGEMENT INTERFACE ********************/
00214 
00215 /*
00216  * Modem Management Controller (MMC) write structure.
00217  */
00218 typedef struct mmw_t    mmw_t;
00219 struct mmw_t
00220 {
00221   unsigned char mmw_encr_key[8];        /* encryption key */
00222   unsigned char mmw_encr_enable;        /* Enable or disable encryption. */
00223 #define MMW_ENCR_ENABLE_MODE    0x02    /* mode of security option */
00224 #define MMW_ENCR_ENABLE_EN      0x01    /* Enable security option. */
00225   unsigned char mmw_unused0[1];         /* unused */
00226   unsigned char mmw_des_io_invert;      /* encryption option */
00227 #define MMW_DES_IO_INVERT_RES   0x0F    /* reserved */
00228 #define MMW_DES_IO_INVERT_CTRL  0xF0    /* control (?) (set to 0) */
00229   unsigned char mmw_unused1[5];         /* unused */
00230   unsigned char mmw_loopt_sel;          /* looptest selection */
00231 #define MMW_LOOPT_SEL_DIS_NWID  0x40    /* Disable NWID filtering. */
00232 #define MMW_LOOPT_SEL_INT       0x20    /* Activate Attention Request. */
00233 #define MMW_LOOPT_SEL_LS        0x10    /* looptest, no collision avoidance */
00234 #define MMW_LOOPT_SEL_LT3A      0x08    /* looptest 3a */
00235 #define MMW_LOOPT_SEL_LT3B      0x04    /* looptest 3b */
00236 #define MMW_LOOPT_SEL_LT3C      0x02    /* looptest 3c */
00237 #define MMW_LOOPT_SEL_LT3D      0x01    /* looptest 3d */
00238   unsigned char mmw_jabber_enable;      /* jabber timer enable */
00239   /* Abort transmissions > 200 ms */
00240   unsigned char mmw_freeze;             /* freeze or unfreeze signal level */
00241   /* 0 : signal level & qual updated for every new message, 1 : frozen */
00242   unsigned char mmw_anten_sel;          /* antenna selection */
00243 #define MMW_ANTEN_SEL_SEL       0x01    /* direct antenna selection */
00244 #define MMW_ANTEN_SEL_ALG_EN    0x02    /* antenna selection algo. enable */
00245   unsigned char mmw_ifs;                /* inter frame spacing */
00246   /* min time between transmission in bit periods (.5 us) - bit 0 ignored */
00247   unsigned char mmw_mod_delay;          /* modem delay (synchro) */
00248   unsigned char mmw_jam_time;           /* jamming time (after collision) */
00249   unsigned char mmw_unused2[1];         /* unused */
00250   unsigned char mmw_thr_pre_set;        /* level threshold preset */
00251   /* Discard all packet with signal < this value (4) */
00252   unsigned char mmw_decay_prm;          /* decay parameters */
00253   unsigned char mmw_decay_updat_prm;    /* decay update parameters */
00254   unsigned char mmw_quality_thr;        /* quality (z-quotient) threshold */
00255   /* Discard all packet with quality < this value (3) */
00256   unsigned char mmw_netw_id_l;          /* NWID low order byte */
00257   unsigned char mmw_netw_id_h;          /* NWID high order byte */
00258   /* Network ID or Domain : create virtual net on the air */
00259 
00260   /* 2.0 Hardware extension - frequency selection support */
00261   unsigned char mmw_mode_select;        /* for analog tests (set to 0) */
00262   unsigned char mmw_unused3[1];         /* unused */
00263   unsigned char mmw_fee_ctrl;           /* frequency EEPROM control */
00264 #define MMW_FEE_CTRL_PRE        0x10    /* Enable protected instructions. */
00265 #define MMW_FEE_CTRL_DWLD       0x08    /* Download EEPROM to mmc. */
00266 #define MMW_FEE_CTRL_CMD        0x07    /* EEPROM commands:  */
00267 #define MMW_FEE_CTRL_READ       0x06    /* Read */
00268 #define MMW_FEE_CTRL_WREN       0x04    /* Write enable */
00269 #define MMW_FEE_CTRL_WRITE      0x05    /* Write data to address. */
00270 #define MMW_FEE_CTRL_WRALL      0x04    /* Write data to all addresses. */
00271 #define MMW_FEE_CTRL_WDS        0x04    /* Write disable */
00272 #define MMW_FEE_CTRL_PRREAD     0x16    /* Read addr from protect register */
00273 #define MMW_FEE_CTRL_PREN       0x14    /* Protect register enable */
00274 #define MMW_FEE_CTRL_PRCLEAR    0x17    /* Unprotect all registers. */
00275 #define MMW_FEE_CTRL_PRWRITE    0x15    /* Write address in protect register */
00276 #define MMW_FEE_CTRL_PRDS       0x14    /* Protect register disable */
00277   /* Never issue the PRDS command:  it's irreversible! */
00278 
00279   unsigned char mmw_fee_addr;           /* EEPROM address */
00280 #define MMW_FEE_ADDR_CHANNEL    0xF0    /* Select the channel. */
00281 #define MMW_FEE_ADDR_OFFSET     0x0F    /* Offset in channel data */
00282 #define MMW_FEE_ADDR_EN         0xC0    /* FEE_CTRL enable operations */
00283 #define MMW_FEE_ADDR_DS         0x00    /* FEE_CTRL disable operations */
00284 #define MMW_FEE_ADDR_ALL        0x40    /* FEE_CTRL all operations */
00285 #define MMW_FEE_ADDR_CLEAR      0xFF    /* FEE_CTRL clear operations */
00286 
00287   unsigned char mmw_fee_data_l;         /* Write data to EEPROM. */
00288   unsigned char mmw_fee_data_h;         /* high octet */
00289   unsigned char mmw_ext_ant;            /* Setting for external antenna */
00290 #define MMW_EXT_ANT_EXTANT      0x01    /* Select external antenna */
00291 #define MMW_EXT_ANT_POL         0x02    /* Polarity of the antenna */
00292 #define MMW_EXT_ANT_INTERNAL    0x00    /* Internal antenna */
00293 #define MMW_EXT_ANT_EXTERNAL    0x03    /* External antenna */
00294 #define MMW_EXT_ANT_IQ_TEST     0x1C    /* IQ test pattern (set to 0) */
00295 };
00296 
00297 #define MMW_SIZE        37
00298 
00299 #define mmwoff(p,f)     (unsigned short)((void *)(&((mmw_t *)((void *)0 + (p)))->f) - (void *)0)
00300 
00301 /*
00302  * Modem Management Controller (MMC) read structure.
00303  */
00304 typedef struct mmr_t    mmr_t;
00305 struct mmr_t
00306 {
00307   unsigned char mmr_unused0[8];         /* unused */
00308   unsigned char mmr_des_status;         /* encryption status */
00309   unsigned char mmr_des_avail;          /* encryption available (0x55 read) */
00310 #define MMR_DES_AVAIL_DES       0x55            /* DES available */
00311 #define MMR_DES_AVAIL_AES       0x33            /* AES (AT&T) available */
00312   unsigned char mmr_des_io_invert;      /* des I/O invert register */
00313   unsigned char mmr_unused1[5];         /* unused */
00314   unsigned char mmr_dce_status;         /* DCE status */
00315 #define MMR_DCE_STATUS_RX_BUSY          0x01    /* receiver busy */
00316 #define MMR_DCE_STATUS_LOOPT_IND        0x02    /* loop test indicated */
00317 #define MMR_DCE_STATUS_TX_BUSY          0x04    /* transmitter on */
00318 #define MMR_DCE_STATUS_JBR_EXPIRED      0x08    /* jabber timer expired */
00319 #define MMR_DCE_STATUS                  0x0F    /* mask to get the bits */
00320   unsigned char mmr_dsp_id;             /* DSP ID (AA = Daedalus rev A) */
00321   unsigned char mmr_unused2[2];         /* unused */
00322   unsigned char mmr_correct_nwid_l;     /* # of correct NWIDs rxd (low) */
00323   unsigned char mmr_correct_nwid_h;     /* # of correct NWIDs rxd (high) */
00324   /* Warning:  read high-order octet first! */
00325   unsigned char mmr_wrong_nwid_l;       /* # of wrong NWIDs rxd (low) */
00326   unsigned char mmr_wrong_nwid_h;       /* # of wrong NWIDs rxd (high) */
00327   unsigned char mmr_thr_pre_set;        /* level threshold preset */
00328 #define MMR_THR_PRE_SET         0x3F            /* level threshold preset */
00329 #define MMR_THR_PRE_SET_CUR     0x80            /* Current signal above it */
00330   unsigned char mmr_signal_lvl;         /* signal level */
00331 #define MMR_SIGNAL_LVL          0x3F            /* signal level */
00332 #define MMR_SIGNAL_LVL_VALID    0x80            /* Updated since last read */
00333   unsigned char mmr_silence_lvl;        /* silence level (noise) */
00334 #define MMR_SILENCE_LVL         0x3F            /* silence level */
00335 #define MMR_SILENCE_LVL_VALID   0x80            /* Updated since last read */
00336   unsigned char mmr_sgnl_qual;          /* signal quality */
00337 #define MMR_SGNL_QUAL           0x0F            /* signal quality */
00338 #define MMR_SGNL_QUAL_ANT       0x80            /* current antenna used */
00339   unsigned char mmr_netw_id_l;          /* NWID low order byte (?) */
00340   unsigned char mmr_unused3[3];         /* unused */
00341 
00342   /* 2.0 Hardware extension - frequency selection support */
00343   unsigned char mmr_fee_status;         /* Status of frequency EEPROM */
00344 #define MMR_FEE_STATUS_ID       0xF0            /* Modem revision ID */
00345 #define MMR_FEE_STATUS_DWLD     0x08            /* Download in progress */
00346 #define MMR_FEE_STATUS_BUSY     0x04            /* EEPROM busy */
00347   unsigned char mmr_unused4[1];         /* unused */
00348   unsigned char mmr_fee_data_l;         /* Read data from EEPROM (low) */
00349   unsigned char mmr_fee_data_h;         /* Read data from EEPROM (high) */
00350 };
00351 
00352 #define MMR_SIZE        36
00353 
00354 #define mmroff(p,f)     (unsigned short)((void *)(&((mmr_t *)((void *)0 + (p)))->f) - (void *)0)
00355 
00356 /* Make the two above structures one */
00357 typedef union mm_t
00358 {
00359   struct mmw_t  w;      /* Write to the mmc */
00360   struct mmr_t  r;      /* Read from the mmc */
00361 } mm_t;
00362 
00363 #endif /* _WAVELAN_H */
00364 
00365 /*
00366  * This software may only be used and distributed
00367  * according to the terms of the GNU Public License.
00368  *
00369  * For more details, see wavelan.c.
00370  */