The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/dev/usb/if_ruereg.h

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*-
    2  * Copyright (c) 2001-2003, Shunsuke Akiyama <akiyama@FreeBSD.org>.
    3  * All rights reserved.
    4  *
    5  * Redistribution and use in source and binary forms, with or without
    6  * modification, are permitted provided that the following conditions
    7  * are met:
    8  * 1. Redistributions of source code must retain the above copyright
    9  *    notice, this list of conditions and the following disclaimer.
   10  * 2. Redistributions in binary form must reproduce the above copyright
   11  *    notice, this list of conditions and the following disclaimer in the
   12  *    documentation and/or other materials provided with the distribution.
   13  *
   14  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
   15  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   16  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   17  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
   18  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   19  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   20  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   21  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   22  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   23  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   24  * SUCH DAMAGE.
   25  *
   26  * $FreeBSD: releng/7.3/sys/dev/usb/if_ruereg.h 171331 2007-07-09 20:56:39Z imp $
   27  */
   28 
   29 #ifndef _IF_RUEREG_H_
   30 #define _IF_RUEREG_H_
   31 
   32 #define RUE_INTR_PIPE           1       /* Use INTR PIPE */
   33 
   34 #define RUE_CONFIG_NO           1
   35 #define RUE_IFACE_IDX           0
   36 
   37 #define RUE_ENDPT_RX            0x0
   38 #define RUE_ENDPT_TX            0x1
   39 #define RUE_ENDPT_INTR          0x2
   40 #define RUE_ENDPT_MAX           0x3
   41 
   42 #define RUE_INTR_PKTLEN         0x8
   43 
   44 #define RUE_TIMEOUT             1000
   45 #define ETHER_ALIGN             2
   46 #define RUE_MIN_FRAMELEN        60
   47 #define RUE_INTR_INTERVAL       100     /* ms */
   48 
   49 /*
   50  * Registers
   51  */
   52 
   53 #define RUE_IDR0                0x0120
   54 #define RUE_IDR1                0x0121
   55 #define RUE_IDR2                0x0122
   56 #define RUE_IDR3                0x0123
   57 #define RUE_IDR4                0x0124
   58 #define RUE_IDR5                0x0125
   59 
   60 #define RUE_MAR0                0x0126
   61 #define RUE_MAR1                0x0127
   62 #define RUE_MAR2                0x0128
   63 #define RUE_MAR3                0x0129
   64 #define RUE_MAR4                0x012A
   65 #define RUE_MAR5                0x012B
   66 #define RUE_MAR6                0x012C
   67 #define RUE_MAR7                0x012D
   68 
   69 #define RUE_CR                  0x012E          /* B, R/W */
   70 #define RUE_CR_SOFT_RST         0x10
   71 #define RUE_CR_RE               0x08
   72 #define RUE_CR_TE               0x04
   73 #define RUE_CR_EP3CLREN         0x02
   74 
   75 #define RUE_TCR                 0x012F          /* B, R/W */
   76 #define RUE_TCR_TXRR1           0x80
   77 #define RUE_TCR_TXRR0           0x40
   78 #define RUE_TCR_IFG1            0x10
   79 #define RUE_TCR_IFG0            0x08
   80 #define RUE_TCR_NOCRC           0x01
   81 #define RUE_TCR_CONFIG          (RUE_TCR_TXRR1|RUE_TCR_TXRR0|RUE_TCR_IFG1|RUE_TCR_IFG0)
   82 
   83 #define RUE_RCR                 0x0130          /* W, R/W */
   84 #define RUE_RCR_TAIL            0x80
   85 #define RUE_RCR_AER             0x40
   86 #define RUE_RCR_AR              0x20
   87 #define RUE_RCR_AM              0x10
   88 #define RUE_RCR_AB              0x08
   89 #define RUE_RCR_AD              0x04
   90 #define RUE_RCR_AAM             0x02
   91 #define RUE_RCR_AAP             0x01
   92 #define RUE_RCR_CONFIG          (RUE_RCR_TAIL|RUE_RCR_AD)
   93 
   94 #define RUE_TSR                 0x0132
   95 #define RUE_RSR                 0x0133
   96 #define RUE_CON0                0x0135
   97 #define RUE_CON1                0x0136
   98 #define RUE_MSR                 0x0137
   99 #define RUE_PHYADD              0x0138
  100 #define RUE_PHYDAT              0x0139
  101 
  102 #define RUE_PHYCNT              0x013B          /* B, R/W */
  103 #define RUE_PHYCNT_PHYOWN       0x40
  104 #define RUE_PHYCNT_RWCR         0x20
  105 
  106 #define RUE_GPPC                0x013D
  107 #define RUE_WAKECNT             0x013E
  108 
  109 #define RUE_BMCR                0x0140
  110 #define RUE_BMCR_SPD_SET        0x2000
  111 #define RUE_BMCR_DUPLEX         0x0100
  112 
  113 #define RUE_BMSR                0x0142
  114 
  115 #define RUE_ANAR                0x0144          /* W, R/W */
  116 #define RUE_ANAR_PAUSE          0x0400
  117 
  118 #define RUE_ANLP                0x0146          /* W, R/O */
  119 #define RUE_ANLP_PAUSE          0x0400
  120 
  121 #define RUE_AER                 0x0148
  122 
  123 #define RUE_NWAYT               0x014A
  124 #define RUE_CSCR                0x014C
  125 
  126 #define RUE_CRC0                0x014E
  127 #define RUE_CRC1                0x0150
  128 #define RUE_CRC2                0x0152
  129 #define RUE_CRC3                0x0154
  130 #define RUE_CRC4                0x0156
  131 
  132 #define RUE_BYTEMASK0           0x0158
  133 #define RUE_BYTEMASK1           0x0160
  134 #define RUE_BYTEMASK2           0x0168
  135 #define RUE_BYTEMASK3           0x0170
  136 #define RUE_BYTEMASK4           0x0178
  137 
  138 #define RUE_PHY1                0x0180
  139 #define RUE_PHY2                0x0184
  140 
  141 #define RUE_TW1                 0x0186
  142 
  143 #define RUE_REG_MIN             0x0120
  144 #define RUE_REG_MAX             0x0189
  145 
  146 /*
  147  * EEPROM address declarations
  148  */
  149 
  150 #define RUE_EEPROM_BASE         0x1200
  151 
  152 #define RUE_EEPROM_IDR0         (RUE_EEPROM_BASE + 0x02)
  153 #define RUE_EEPROM_IDR1         (RUE_EEPROM_BASE + 0x03)
  154 #define RUE_EEPROM_IDR2         (RUE_EEPROM_BASE + 0x03)
  155 #define RUE_EEPROM_IDR3         (RUE_EEPROM_BASE + 0x03)
  156 #define RUE_EEPROM_IDR4         (RUE_EEPROM_BASE + 0x03)
  157 #define RUE_EEPROM_IDR5         (RUE_EEPROM_BASE + 0x03)
  158 
  159 #define RUE_EEPROM_INTERVAL     (RUE_EEPROM_BASE + 0x17)
  160 
  161 struct rue_intrpkt {
  162         u_int8_t                rue_tsr;
  163         u_int8_t                rue_rsr;
  164         u_int8_t                rue_gep_msr;
  165         u_int8_t                rue_waksr;
  166         u_int8_t                rue_txok_cnt;
  167         u_int8_t                rue_rxlost_cnt;
  168         u_int8_t                rue_crcerr_cnt;
  169         u_int8_t                rue_col_cnt;
  170 };
  171 
  172 struct rue_rxpkt {
  173         u_int16_t               rue_pktlen : 12;
  174         u_int16_t               rue_rxstat : 4;
  175 };
  176 
  177 #define RUE_RXSTAT_VALID        0x01
  178 #define RUE_RXSTAT_RUNT         0x02
  179 #define RUE_RXSTAT_PMATCH       0x04
  180 #define RUE_RXSTAT_MCAST        0x08
  181 
  182 #define RUE_RXSTAT_MASK         RUE_RXSTAT_VALID
  183 
  184 struct rue_type {
  185         u_int16_t               rue_vid;
  186         u_int16_t               rue_did;
  187 };
  188 
  189 struct rue_softc {
  190         struct ifnet            *rue_ifp;
  191         device_t                rue_dev;
  192         device_t                rue_miibus;
  193         usbd_device_handle      rue_udev;
  194         usbd_interface_handle   rue_iface;
  195         struct rue_type         *rue_info;
  196         int                     rue_ed[RUE_ENDPT_MAX];
  197         usbd_pipe_handle        rue_ep[RUE_ENDPT_MAX];
  198         int                     rue_unit;
  199         u_int8_t                rue_link;
  200         int                     rue_if_flags;
  201         struct ue_cdata         rue_cdata;
  202         struct callout_handle   rue_stat_ch;
  203         struct mtx              rue_mtx;
  204         char                    rue_dying;
  205         struct timeval          rue_rx_notice;
  206         struct usb_qdat         rue_qdat;
  207         struct usb_task         rue_tick_task;
  208 };
  209 
  210 #if defined(__FreeBSD__)
  211 #define GET_MII(sc)     (device_get_softc((sc)->rue_miibus))
  212 #elif defined(__NetBSD__)
  213 #define GET_MII(sc)     (&(sc)->rue_mii)
  214 #elif defined(__OpenBSD__)
  215 #define GET_MII(sc)     (&(sc)->rue_mii)
  216 #endif
  217 
  218 #if 0
  219 #define RUE_LOCK(_sc)           mtx_lock(&(_sc)->rue_mtx)
  220 #define RUE_UNLOCK(_sc)         mtx_unlock(&(_sc)->rue_mtx)
  221 #else
  222 #define RUE_LOCK(_sc)
  223 #define RUE_UNLOCK(_sc)
  224 #endif
  225 
  226 #endif /* _IF_RUEREG_H_ */

Cache object: 7a91aa69eede91452b8a1f6287c2170e


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.