home *** CD-ROM | disk | FTP | other *** search
/ Il CD di internet / CD.iso / SOURCE / KERNEL-S / V1.2 / LINUX-1.2 / LINUX-1 / linux / drivers / net / wavelan.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-02-01  |  10.4 KB  |  255 lines

  1. #if    defined(CONFIG_WAVELAN)
  2. #define WAVELAN_ADDR_SIZE    6    /* Size of a MAC address */
  3. #define SA_ADDR0        0x08    /* First octet of WaveLAN MAC addresses */
  4. #define SA_ADDR1        0x00    /* Second octet of WaveLAN MAC addresses */
  5. #define SA_ADDR2        0x0E    /* Third octet of WaveLAN MAC addresses */
  6. #define WAVELAN_MTU        1500    /* Maximum size of WaveLAN packet */
  7.  
  8. /*
  9.  * Parameter Storage Area (PSA).
  10.  */
  11. typedef struct psa_t    psa_t;
  12. struct psa_t
  13. {
  14.     unsigned char    psa_io_base_addr_1;    /* Base address 1 ??? */
  15.     unsigned char    psa_io_base_addr_2;    /* Base address 2 */
  16.     unsigned char    psa_io_base_addr_3;    /* Base address 3 */
  17.     unsigned char    psa_io_base_addr_4;    /* Base address 4 */
  18.     unsigned char    psa_rem_boot_addr_1;    /* Remote Boot Address 1 */
  19.     unsigned char    psa_rem_boot_addr_2;    /* Remote Boot Address 2 */
  20.     unsigned char    psa_rem_boot_addr_3;    /* Remote Boot Address 3 */
  21.     unsigned char    psa_holi_params;    /* HOst Lan Interface (HOLI) Parameters */
  22.     unsigned char    psa_int_req_no;        /* Interrupt Request Line */
  23.     unsigned char    psa_unused0[7];        /* unused */
  24.     unsigned char    psa_univ_mac_addr[WAVELAN_ADDR_SIZE];    /* Universal (factory) MAC Address */
  25.     unsigned char    psa_local_mac_addr[WAVELAN_ADDR_SIZE];    /* Local MAC Address */
  26.     unsigned char    psa_univ_local_sel;    /* Universal Local Selection */
  27. #define        PSA_UNIVERSAL    0        /* Universal (factory) */
  28. #define        PSA_LOCAL    1        /* Local */
  29.     unsigned char    psa_comp_number;    /* Compatibility Number: */
  30. #define        PSA_COMP_PC_AT_915    0     /* PC-AT 915 MHz    */
  31. #define        PSA_COMP_PC_MC_915    1     /* PC-MC 915 MHz    */
  32. #define        PSA_COMP_PC_AT_2400    2     /* PC-AT 2.4 GHz    */
  33. #define        PSA_COMP_PC_MC_2400    3     /* PC-MC 2.4 GHz    */
  34. #define        PSA_COMP_PCMCIA_915    4     /* PCMCIA 915 MHz    */
  35.     unsigned char    psa_thr_pre_set;    /* Modem Threshold Preset */
  36.     unsigned char    psa_feature_select;    /* ??? */
  37. #if    0
  38.     <alias for above>
  39.     unsigned char    psa_decay_prm;        /* Modem Decay */
  40. #endif    /* 0 */
  41.     unsigned char    psa_subband;        /* Subband    */
  42. #define        PSA_SUBBAND_915        0    /* 915 MHz    */
  43. #define        PSA_SUBBAND_2425    1    /* 2425 MHz    */
  44. #define        PSA_SUBBAND_2460    2    /* 2460 MHz    */
  45. #define        PSA_SUBBAND_2484    3    /* 2484 MHz    */
  46. #define        PSA_SUBBAND_2430_5    4    /* 2430.5 MHz    */
  47. #if    0
  48.     <alias for above>
  49.     unsigned char    psa_decay_updat_prm;    /* Modem Decay Update ??? */
  50. #endif    /* 0 */
  51.     unsigned char    psa_quality_thr;    /* Modem Quality Threshold */
  52.     unsigned char    psa_mod_delay;        /* Modem Delay ??? */
  53.     unsigned char    psa_nwid[2];        /* Network ID */
  54.     unsigned char    psa_undefined;        /* undefined */
  55.     unsigned char    psa_encryption_select;    /* Encryption On Off */
  56.     unsigned char    psa_encryption_key[8];    /* Encryption Key */
  57.     unsigned char    psa_databus_width;    /* 8/16 bit bus width */
  58.     unsigned char    psa_call_code;        /* ??? */
  59. #if    0
  60.     <alias for above>
  61.     unsigned char    psa_auto_squelch;    /* Automatic Squelch level On off ??? */
  62. #endif    /* 0 */
  63.     unsigned char    psa_no_of_retries;    /* LAN Cont. No of retries */
  64.     unsigned char    psa_acr;        /* LAN Cont. ACR */
  65.     unsigned char    psa_dump_count;        /* number of Dump Commands in TFB */
  66.     unsigned char    psa_unused1[4];        /* unused */
  67.     unsigned char    psa_nwid_prefix;    /* ??? */
  68.     unsigned char    psa_unused2[3];        /* unused */
  69.     unsigned char    psa_conf_status;    /* Card Configuration Status */
  70.     unsigned char    psa_crc[2];        /* CRC over PSA */
  71.     unsigned char    psa_crc_status;        /* CRC Valid Flag */
  72. };
  73. #if    STRUCT_CHECK == 1
  74. #define    PSA_SIZE    64
  75. #endif    /* STRUCT_CHECK == 1 */
  76.  
  77. /*
  78.  * Modem Management Controller (MMC) write structure.
  79.  */
  80. typedef struct mmw_t    mmw_t;
  81. struct mmw_t
  82. {
  83.     unsigned char    mmw_encr_key[8];    /* encryption key */
  84.     unsigned char    mmw_encr_enable;    /* enable/disable encryption */
  85.     unsigned char    mmw_unused0[1];        /* unused */
  86.     unsigned char    mmw_des_io_invert;    /* ??? */
  87.     unsigned char    mmw_unused1[5];        /* unused */
  88.     unsigned char    mmw_loopt_sel;        /* looptest selection */
  89. #define        MMW_LOOPT_SEL_UNDEFINED    0x40    /* undefined */
  90. #define        MMW_LOOPT_SEL_INT    0x20    /* activate Attention Request */
  91. #define        MMW_LOOPT_SEL_LS    0x10    /* looptest without collision avoidance */
  92. #define        MMW_LOOPT_SEL_LT3A    0x08    /* looptest 3a */
  93. #define        MMW_LOOPT_SEL_LT3B    0x04    /* looptest 3b */
  94. #define        MMW_LOOPT_SEL_LT3C    0x02    /* looptest 3c */
  95. #define        MMW_LOOPT_SEL_LT3D    0x01    /* looptest 3d */
  96.     unsigned char    mmw_jabber_enable;    /* jabber timer enable */
  97.     unsigned char    mmw_freeze;        /* freeze / unfreeze signal level */
  98.     unsigned char    mmw_anten_sel;        /* antenna selection */
  99. #define        MMW_ANTEN_SEL_SEL    0x01    /* direct antenna selection */
  100. #define        MMW_ANTEN_SEL_ALG_EN    0x02    /* antenna selection algorithm enable */
  101.     unsigned char    mmw_ifs;        /* inter frame spacing */
  102.     unsigned char    mmw_mod_delay;         /* modem delay */
  103.     unsigned char    mmw_jam_time;        /* jamming time */
  104.     unsigned char    mmw_unused2[1];        /* unused */
  105.     unsigned char    mmw_thr_pre_set;    /* level threshold preset */
  106.     unsigned char    mmw_decay_prm;        /* decay parameters */
  107.     unsigned char    mmw_decay_updat_prm;    /* decay update parameters */
  108.     unsigned char    mmw_quality_thr;    /* quality (z-quotient) threshold */
  109.     unsigned char    mmw_netw_id_l;        /* NWID low order byte */
  110.     unsigned char    mmw_netw_id_h;        /* NWID high order byte */
  111. };
  112. #if    STRUCT_CHECK == 1
  113. #define    MMW_SIZE    30
  114. #endif    /* STRUCT_CHECK == 1 */
  115.  
  116. #define    mmwoff(p,f)     (unsigned short)((void *)(&((mmw_t *)((void *)0 + (p)))->f) - (void *)0)
  117.  
  118. /*
  119.  * Modem Management Controller (MMC) read structure.
  120.  */
  121. typedef struct mmr_t    mmr_t;
  122. struct mmr_t
  123. {
  124.     unsigned char    mmr_unused0[8];        /* unused */
  125.     unsigned char    mmr_des_status;        /* encryption status */
  126.     unsigned char    mmr_des_avail;        /* encryption available (0x55 read) */
  127.     unsigned char    mmr_des_io_invert;    /* des I/O invert register */
  128.     unsigned char    mmr_unused1[5];        /* unused */
  129.     unsigned char    mmr_dce_status;        /* DCE status */
  130. #define        MMR_DCE_STATUS_ENERG_DET    0x01    /* energy detected */
  131. #define        MMR_DCE_STATUS_LOOPT_IND    0x02    /* loop test indicated */
  132. #define        MMR_DCE_STATUS_XMTITR_IND    0x04    /* transmitter on */
  133. #define        MMR_DCE_STATUS_JBR_EXPIRED    0x08    /* jabber timer expired */
  134.     unsigned char    mmr_unused2[3];        /* unused */
  135.     unsigned char    mmr_correct_nwid_l;    /* no. of correct NWID's rxd (low) */
  136.     unsigned char    mmr_correct_nwid_h;    /* no. of correct NWID's rxd (high) */
  137.     unsigned char    mmr_wrong_nwid_l;    /* count of wrong NWID's received (low) */
  138.     unsigned char    mmr_wrong_nwid_h;    /* count of wrong NWID's received (high) */
  139.     unsigned char    mmr_thr_pre_set;    /* level threshold preset */
  140.     unsigned char    mmr_signal_lvl;        /* signal level */
  141.     unsigned char    mmr_silence_lvl;    /* silence level */
  142.     unsigned char    mmr_sgnl_qual;        /* signal quality */
  143. #define        MMR_SGNL_QUAL_0        0x01    /* signal quality 0 */
  144. #define        MMR_SGNL_QUAL_1        0x02    /* signal quality 1 */
  145. #define        MMR_SGNL_QUAL_2        0x04    /* signal quality 2 */
  146. #define        MMR_SGNL_QUAL_3        0x08    /* signal quality 3 */
  147. #define        MMR_SGNL_QUAL_S_A    0x80    /* currently selected antenna */
  148.     unsigned char    mmr_netw_id_l;        /* NWID low order byte ??? */
  149.     unsigned char    mmr_unused3[1];        /* unused */
  150. };
  151. #if    STRUCT_CHECK == 1
  152. #define    MMR_SIZE    30
  153. #endif    /* STRUCT_CHECK == 1 */
  154.  
  155. #define    MMR_LEVEL_MASK    0x3F
  156.  
  157. #define    mmroff(p,f)     (unsigned short)((void *)(&((mmr_t *)((void *)0 + (p)))->f) - (void *)0)
  158.  
  159. /*
  160.  * Host Adaptor structure.
  161.  * (base is board port address).
  162.  */
  163. typedef union hacs_u    hacs_u;
  164. union hacs_u
  165. {
  166.     unsigned short    hu_command;        /* Command register */
  167. #define        HACR_RESET        0x0001    /* Reset board */
  168. #define        HACR_CA            0x0002    /* Set Channel Attention for 82586 */
  169. #define        HACR_16BITS        0x0004    /* 16 bits operation (0 => 8bits) */
  170. #define        HACR_OUT0        0x0008    /* General purpose output pin 0 */
  171.                         /* not used - must be 1 */
  172. #define        HACR_OUT1        0x0010    /* General purpose output pin 1 */
  173.                         /* not used - must be 1 */
  174. #define        HACR_82586_INT_ENABLE    0x0020    /* Enable 82586 interrupts */
  175. #define        HACR_MMC_INT_ENABLE    0x0040    /* Enable MMC interrupts */
  176. #define        HACR_INTR_CLR_ENABLE    0x0080    /* Enable interrupt status read/clear */
  177.     unsigned short    hu_status;        /* Status Register */
  178. #define        HASR_82586_INTR        0x0001    /* Interrupt request from 82586 */
  179. #define        HASR_MMC_INTR        0x0002    /* Interrupt request from MMC */
  180. #define        HASR_MMC_BUSY        0x0004    /* MMC busy indication */
  181. #define        HASR_PSA_BUSY        0x0008    /* LAN parameter storage area busy */
  182. };
  183.  
  184. typedef struct ha_t    ha_t;
  185. struct ha_t
  186. {
  187.     hacs_u        ha_cs;        /* Command and status registers */
  188. #define         ha_command    ha_cs.hu_command
  189. #define         ha_status    ha_cs.hu_status
  190.     unsigned short    ha_mmcr;    /* Modem Management Ctrl Register */
  191.     unsigned short    ha_pior0;    /* Program I/O Address Register Port 0 */
  192.     unsigned short    ha_piop0;    /* Program I/O Port 0 */
  193.     unsigned short    ha_pior1;    /* Program I/O Address Register Port 1 */
  194.     unsigned short    ha_piop1;    /* Program I/O Port 1 */
  195.     unsigned short    ha_pior2;    /* Program I/O Address Register Port 2 */
  196.     unsigned short    ha_piop2;    /* Program I/O Port 2 */
  197. };
  198. #if    STRUCT_CHECK == 1
  199. #define HA_SIZE        16
  200. #endif    /* STRUCT_CHECK == 1 */
  201.  
  202. #define    hoff(p,f)     (unsigned short)((void *)(&((ha_t *)((void *)0 + (p)))->f) - (void *)0)
  203. #define    HACR(p)        hoff(p, ha_command)
  204. #define    HASR(p)        hoff(p, ha_status)
  205. #define    MMCR(p)        hoff(p, ha_mmcr)
  206. #define    PIOR0(p)    hoff(p, ha_pior0)
  207. #define    PIOP0(p)    hoff(p, ha_piop0)
  208. #define    PIOR1(p)    hoff(p, ha_pior1)
  209. #define    PIOP1(p)    hoff(p, ha_piop1)
  210. #define    PIOR2(p)    hoff(p, ha_pior2)
  211. #define    PIOP2(p)    hoff(p, ha_piop2)
  212.  
  213. /*
  214.  * Program I/O Mode Register values.
  215.  */
  216. #define STATIC_PIO        0    /* Mode 1: static mode */
  217.                     /* RAM access ??? */
  218. #define AUTOINCR_PIO        1    /* Mode 2: auto increment mode */
  219.                     /* RAM access ??? */
  220. #define AUTODECR_PIO        2    /* Mode 3: auto decrement mode */
  221.                     /* RAM access ??? */
  222. #define PARAM_ACCESS_PIO    3    /* Mode 4: LAN parameter access mode */
  223.                     /* Parameter access. */
  224. #define PIO_MASK        3    /* register mask */
  225. #define PIOM(cmd,piono)        ((u_short)cmd << 10 << (piono * 2))
  226.  
  227. #define    HACR_DEFAULT        (HACR_OUT0 | HACR_OUT1 | HACR_16BITS | PIOM(STATIC_PIO, 0) | PIOM(AUTOINCR_PIO, 1) | PIOM(PARAM_ACCESS_PIO, 2))
  228. #define    HACR_INTRON        (HACR_82586_INT_ENABLE | HACR_MMC_INT_ENABLE | HACR_INTR_CLR_ENABLE)
  229.  
  230. #define    MAXDATAZ        (WAVELAN_ADDR_SIZE + WAVELAN_ADDR_SIZE + 2 + WAVELAN_MTU)
  231.  
  232. /*
  233.  * Onboard 64k RAM layout.
  234.  * (Offsets from 0x0000.)
  235.  */
  236. #define OFFSET_RU        0x0000
  237. #define OFFSET_CU        0x8000
  238. #define OFFSET_SCB        (OFFSET_ISCP - sizeof(scb_t))
  239. #define OFFSET_ISCP        (OFFSET_SCP - sizeof(iscp_t))
  240. #define OFFSET_SCP        I82586_SCP_ADDR
  241.  
  242. #define    RXBLOCKZ        (sizeof(fd_t) + sizeof(rbd_t) + MAXDATAZ)
  243. #define    TXBLOCKZ        (sizeof(ac_tx_t) + sizeof(ac_nop_t) + sizeof(tbd_t) + MAXDATAZ)
  244.  
  245. #define    NRXBLOCKS        ((OFFSET_CU - OFFSET_RU) / RXBLOCKZ)
  246. #define    NTXBLOCKS        ((OFFSET_SCB - OFFSET_CU) / TXBLOCKZ)
  247.  
  248. /*
  249.  * This software may only be used and distributed
  250.  * according to the terms of the GNU Public License.
  251.  *
  252.  * For more details, see wavelan.c.
  253.  */
  254. #endif    /* defined(CONFIG_WAVELAN) */
  255.