root/drivers/net/3c505.h

/* [previous][next][first][last][top][bottom][index][help] */

INCLUDED FROM


   1 /*****************************************************************
   2  *
   3  *  defines for 3Com Etherlink Plus adapter
   4  *
   5  *****************************************************************/
   6 
   7 /*
   8  * I/O register offsets
   9  */
  10 #define PORT_COMMAND    0x00    /* read/write, 8-bit */
  11 #define PORT_STATUS     0x02    /* read only, 8-bit */
  12 #define PORT_AUXDMA     0x02    /* write only, 8-bit */
  13 #define PORT_DATA       0x04    /* read/write, 16-bit */
  14 #define PORT_CONTROL    0x06    /* read/write, 8-bit */
  15 
  16 /*
  17  * host control registers bits
  18  */
  19 #define ATTN    0x80    /* attention */
  20 #define FLSH    0x40    /* flush data register */
  21 #define DMAE    0x20    /* DMA enable */
  22 #define DIR     0x10    /* direction */
  23 #define TCEN    0x08    /* terminal count interrupt enable */
  24 #define CMDE    0x04    /* command register interrupt enable */
  25 #define HSF2    0x02    /* host status flag 2 */
  26 #define HSF1    0x01    /* host status flag 1 */
  27 
  28 /*
  29  * combinations of HSF flags used for PCB transmission
  30  */
  31 #define HSF_PCB_ACK     HSF1
  32 #define HSF_PCB_NAK     HSF2
  33 #define HSF_PCB_END     (HSF2|HSF1)
  34 #define HSF_PCB_MASK    (HSF2|HSF1)
  35 
  36 /*
  37  * host status register bits
  38  */
  39 #define HRDY    0x80    /* data register ready */
  40 #define HCRE    0x40    /* command register empty */
  41 #define ACRF    0x20    /* adapter command register full */
  42 /* #define DIR  0x10    direction - same as in control register */
  43 #define DONE    0x08    /* DMA done */
  44 #define ASF3    0x04    /* adapter status flag 3 */
  45 #define ASF2    0x02    /* adapter status flag 2 */
  46 #define ASF1    0x01    /* adapter status flag 1 */
  47 
  48 /*
  49  * combinations of ASF flags used for PCB reception
  50  */
  51 #define ASF_PCB_ACK     ASF1
  52 #define ASF_PCB_NAK     ASF2
  53 #define ASF_PCB_END     (ASF2|ASF1)
  54 #define ASF_PCB_MASK    (ASF2|ASF1)
  55 
  56 /*
  57  * host aux DMA register bits
  58  */
  59 #define DMA_BRST        0x01    /* DMA burst */
  60 
  61 /*
  62  * maximum amount of data data allowed in a PCB
  63  */
  64 #define MAX_PCB_DATA    62
  65 
  66 /*****************************************************************
  67  *
  68  *  timeout value
  69  *      this is a rough value used for loops to stop them from 
  70  *      locking up the whole machine in the case of failure or
  71  *      error conditions
  72  *
  73  *****************************************************************/
  74 
  75 #define TIMEOUT 300
  76 
  77 /*****************************************************************
  78  *
  79  * PCB commands
  80  *
  81  *****************************************************************/
  82 
  83 enum {
  84   /*
  85    * host PCB commands
  86    */
  87   CMD_CONFIGURE_ADAPTER_MEMORY  = 0x01,
  88   CMD_CONFIGURE_82586           = 0x02,
  89   CMD_STATION_ADDRESS           = 0x03,
  90   CMD_DMA_DOWNLOAD              = 0x04,
  91   CMD_DMA_UPLOAD                = 0x05,
  92   CMD_PIO_DOWNLOAD              = 0x06,
  93   CMD_PIO_UPLOAD                = 0x07,
  94   CMD_RECEIVE_PACKET            = 0x08,
  95   CMD_TRANSMIT_PACKET           = 0x09,
  96   CMD_NETWORK_STATISTICS        = 0x0a,
  97   CMD_LOAD_MULTICAST_LIST       = 0x0b,
  98   CMD_CLEAR_PROGRAM             = 0x0c,
  99   CMD_DOWNLOAD_PROGRAM          = 0x0d,
 100   CMD_EXECUTE_PROGRAM           = 0x0e,
 101   CMD_SELF_TEST                 = 0x0f,
 102   CMD_SET_STATION_ADDRESS       = 0x10,
 103   CMD_ADAPTER_INFO              = 0x11,
 104   NUM_TRANSMIT_CMDS,
 105 
 106   /*
 107    * adapter PCB commands
 108    */
 109   CMD_CONFIGURE_ADAPTER_RESPONSE        = 0x31,
 110   CMD_CONFIGURE_82586_RESPONSE          = 0x32,
 111   CMD_ADDRESS_RESPONSE                  = 0x33,
 112   CMD_DOWNLOAD_DATA_REQUEST             = 0x34,
 113   CMD_UPLOAD_DATA_REQUEST               = 0x35,
 114   CMD_RECEIVE_PACKET_COMPLETE           = 0x38,
 115   CMD_TRANSMIT_PACKET_COMPLETE          = 0x39,
 116   CMD_NETWORK_STATISTICS_RESPONSE       = 0x3a,
 117   CMD_LOAD_MULTICAST_RESPONSE           = 0x3b,
 118   CMD_CLEAR_PROGRAM_RESPONSE            = 0x3c,
 119   CMD_DOWNLOAD_PROGRAM_RESPONSE         = 0x3d,
 120   CMD_EXECUTE_RESPONSE                  = 0x3e,
 121   CMD_SELF_TEST_RESPONSE                = 0x3f,
 122   CMD_SET_ADDRESS_RESPONSE              = 0x40,
 123   CMD_ADAPTER_INFO_RESPONSE             = 0x41
 124 };
 125 
 126 /* Definitions for the PCB data structure */
 127 
 128 /* Data units */
 129 typedef unsigned char         byte;
 130 typedef unsigned short int    word;
 131 typedef unsigned long int     dword;
 132 
 133 /* Data structures */
 134 struct Memconf {
 135         word    cmd_q,
 136                 rcv_q,
 137                 mcast,
 138                 frame,
 139                 rcv_b,
 140                 progs;
 141 };
 142 
 143 struct Rcv_pkt {
 144         word    buf_ofs,
 145                 buf_seg,
 146                 buf_len,
 147                 timeout;
 148 };
 149 
 150 struct Xmit_pkt {
 151         word    buf_ofs,
 152                 buf_seg,
 153                 pkt_len;
 154 };
 155 
 156 struct Rcv_resp {
 157         word    buf_ofs,
 158                 buf_seg,
 159                 buf_len,
 160                 pkt_len,
 161                 timeout,
 162                 status;
 163         dword   timetag;
 164 };
 165 
 166 struct Xmit_resp {
 167         word    buf_ofs,
 168                 buf_seg,
 169                 c_stat,
 170                 status;
 171 };
 172 
 173 
 174 struct Netstat {
 175         dword   tot_recv,
 176                 tot_xmit;
 177         word    err_CRC,
 178                 err_align,
 179                 err_res,
 180                 err_ovrrun;
 181 };
 182 
 183 
 184 struct Selftest {
 185         word    error;
 186         union {
 187                 word ROM_cksum;
 188                 struct {
 189                         word ofs, seg;
 190                 } RAM;
 191                 word i82586;
 192         } failure;
 193 };
 194 
 195 struct Info {
 196         byte    minor_vers,
 197                 major_vers;
 198         word    ROM_cksum,
 199                 RAM_sz,
 200                 free_ofs,
 201                 free_seg;
 202 };
 203 
 204 struct Memdump {
 205        word size,
 206             off,
 207             seg;
 208 };
 209 
 210 /*
 211 Primary Command Block. The most important data structure. All communication
 212 between the host and the adapter is done with these. (Except for the actual
 213 ethernet data, which has different packaging.)
 214 */
 215 typedef struct {
 216         byte    command;
 217         byte    length;
 218         union   {
 219                 struct Memconf          memconf;
 220                 word                    configure;
 221                 struct Rcv_pkt          rcv_pkt;
 222                 struct Xmit_pkt         xmit_pkt;
 223                 byte                    multicast[10][6];
 224                 byte                    eth_addr[6];
 225                 byte                    failed;
 226                 struct Rcv_resp         rcv_resp;
 227                 struct Xmit_resp        xmit_resp;
 228                 struct Netstat          netstat;
 229                 struct Selftest         selftest;
 230                 struct Info             info;
 231                 struct Memdump          memdump;
 232                 byte                    raw[62];
 233         } data;
 234 } pcb_struct;
 235 
 236 /* These defines for 'configure' */
 237 #define RECV_STATION    0x00
 238 #define RECV_BROAD      0x01
 239 #define RECV_MULTI      0x02
 240 #define RECV_PROMISC    0x04
 241 #define NO_LOOPBACK     0x00
 242 #define INT_LOOPBACK    0x08
 243 #define EXT_LOOPBACK    0x10

/* [previous][next][first][last][top][bottom][index][help] */