lnc.h

Go to the documentation of this file.
00001 /*****************************************************************************************
00002  Copyright (c) 2002-2004 The UbixOS Project
00003  All rights reserved.
00004 
00005  Redistribution and use in source and binary forms, with or without modification, are
00006  permitted provided that the following conditions are met:
00007 
00008  Redistributions of source code must retain the above copyright notice, this list of
00009  conditions, the following disclaimer and the list of authors.  Redistributions in binary
00010  form must reproduce the above copyright notice, this list of conditions, the following
00011  disclaimer and the list of authors in the documentation and/or other materials provided
00012  with the distribution. Neither the name of the UbixOS Project nor the names of its
00013  contributors may be used to endorse or promote products derived from this software
00014  without specific prior written permission.
00015 
00016  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
00017  EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
00018  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
00019  THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
00020  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
00021  OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
00022  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
00023  TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00024  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00025 
00026  $Id: lnc_8h-source.html 88 2016-01-12 00:11:29Z reddawg $
00027 
00028 *****************************************************************************************/
00029 
00030 #ifndef _LNC_H
00031 #define _LNC_H
00032 
00033 #include <ubixos/types.h>
00034 
00035 #define NDESC(len2) (1 << len2)
00036 #define NORMAL 0
00037 #define MEM_SLEW 8
00038 #define TRANSBUFSIZE 1518
00039 #define RECVBUFSIZE 1518
00040 #define NRDRE 3
00041 #define NTDRE 3
00042 #define    ETHER_ADDR_LEN          6
00043 #define NE2100_IOSIZE  24
00044 #define PCNET_RDP    0x10        /* Register Data Port */
00045 #define PCNET_RAP    0x12        /* Register Address Port */
00046 #define PCNET_RESET  0x14
00047 #define PCNET_BDP    0x16
00048 #define PCNET_VSW    0x18
00049 #define NE2100          2
00050 
00051 /* mem_mode values */
00052 #define DMA_FIXED       1
00053 #define DMA_MBUF        2
00054 #define SHMEM           4
00055 
00056 
00057 /********** Chip Types **********/
00058 #define UNKNOWN         0        /* Unknown  */
00059 #define LANCE           1        /* Am7990   */
00060 #define C_LANCE         2        /* Am79C90  */
00061 #define PCnet_ISA       3        /* Am79C960 */
00062 #define PCnet_ISAplus   4        /* Am79C961 */
00063 #define PCnet_ISA_II    5        /* Am79C961A */
00064 #define PCnet_32        6        /* Am79C965 */
00065 #define PCnet_PCI       7        /* Am79C970 */
00066 #define PCnet_PCI_II    8        /* Am79C970A */
00067 #define PCnet_FAST      9        /* Am79C971 */
00068 #define PCnet_FASTplus  10       /* Am79C972 */
00069 #define PCnet_Home      11       /* Am79C978 */
00070 
00071 /******** AM7990 Specifics **************/
00072 #define CSR0    0x0000
00073 #define CSR1    1
00074 #define CSR2    2
00075 #define CSR3    3
00076 #define CSR88   88
00077 #define CSR89   89
00078 
00079 #define ERR     0x8000
00080 #define BABL    0x4000
00081 #define CERR    0x2000
00082 #define MISS    0x1000
00083 #define MERR    0x0800
00084 #define RINT    0x0400
00085 #define TINT    0x0200
00086 #define IDON    0x0100
00087 #define INTR    0x0080
00088 #define INEA    0x0040
00089 #define RXON    0x0020
00090 #define TXON    0x0010
00091 #define TDMD    0x0008
00092 #define STOP    0x0004
00093 #define STRT    0x0002
00094 #define INIT    0x0001
00095 
00096 
00097 /* CSR88-89: Chip ID masks */
00098 #define AMD_MASK  0x003
00099 #define PART_MASK 0xffff
00100 #define Am79C960  0x0003
00101 #define Am79C961  0x2260
00102 #define Am79C961A 0x2261
00103 #define Am79C965  0x2430
00104 #define Am79C970  0x0242
00105 #define Am79C970A 0x2621
00106 #define Am79C971  0x2623
00107 #define Am79C972  0x2624
00108 #define Am79C973  0x2625
00109 #define Am79C978  0x2626
00110 
00111 /********** Structs **********/
00112 
00113 
00114 
00115 
00116 struct initBlock {
00117   uInt16 mode;           /* Mode register                        */
00118   uInt8  padr[6];        /* Ethernet address                     */
00119   uInt8  ladrf[8];       /* Logical address filter (multicast)   */
00120   uInt16 rdra;           /* Low order pointer to receive ring    */
00121   uInt16 rlen;           /* High order pointer and no. rings     */
00122   uInt16 tdra;           /* Low order pointer to transmit ring   */
00123   uInt16 tlen;           /* High order pointer and no rings      */
00124   };
00125 
00126 struct mds {
00127   uInt16 md0;
00128   uInt16 md1;
00129   short  md2;
00130   uInt16 md3;
00131   };
00132 
00133 struct hostRingEntry {
00134   struct mds *md;
00135   union {
00136     //struct mbuf *mbuf;
00137     char *data;
00138     }buff;
00139   };
00140 
00141 struct arpcom {
00142   //struct  ifnet ac_if;            /* network-visible interface */
00143   uInt8  ac_enaddr[6];           /* ethernet hardware address */
00144   int    ac_multicnt;            /* length of ac_multiaddrs list */
00145   void   *ac_netgraph;           /* ng_ether(4) netgraph node info */
00146   };
00147 
00148 struct nicInfo {
00149   int ident;         /* Type of card */
00150   int ic;            /* Type of ic, Am7990, Am79C960 etc. */
00151   int memMode;
00152   int iobase;
00153   int mode;          /* Mode setting at initialization */
00154   };
00155 
00156 struct lncInfo {
00157   struct arpcom        arpcom;
00158   struct nicInfo       nic;
00159   struct hostRingEntry *recvRing;
00160   struct hostRingEntry *transRings;
00161   struct initBlock     *initBloack;
00162   int                  rap;
00163   int                  rdp;
00164   int                  bdp;
00165   int                  nrdre;
00166   int                  ntdre;
00167   };
00168 
00169 extern struct lncInfo *lnc;
00170 
00171 void writeCsr(struct lncInfo *lnc, uInt16 port, uInt16 val);
00172 uInt16 readCsr(struct lncInfo *lnc, uInt16 port);
00173 void writeBcr(struct lncInfo *lnc, uInt16 port, uInt16 val);
00174 uInt16 readBcr(struct lncInfo *lnc, uInt16 port);
00175 
00176 void initLNC();
00177 int probe(struct lncInfo *lnc);
00178 int lanceProbe(struct lncInfo *lnc);
00179 int lncAttach(struct lncInfo *lnc,int unit);
00180 
00181 
00182 void lncInt();
00183 void _lncInt();
00184 
00185 #endif
00186 
00187 /***
00188  $Log: lnc_8h-source.html,v $
00188  Revision 1.7  2006/12/15 17:47:06  reddawg
00188  Updates
00188 
00189  Revision 1.1.1.1  2006/06/01 12:46:14  reddawg
00190  ubix2
00191 
00192  Revision 1.2  2005/10/12 00:13:37  reddawg
00193  Removed
00194 
00195  Revision 1.1.1.1  2005/09/26 17:23:50  reddawg
00196  no message
00197 
00198  Revision 1.2  2004/05/21 15:05:07  reddawg
00199  Cleaned up
00200 
00201 
00202  END
00203  ***/

Generated on Fri Dec 15 11:18:54 2006 for UbixOS V2 by  doxygen 1.4.7