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/ral/if_ralreg.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 /*      $FreeBSD: releng/6.0/sys/dev/ral/if_ralreg.h 145247 2005-04-18 18:47:38Z damien $       */
    2 
    3 /*-
    4  * Copyright (c) 2005
    5  *      Damien Bergamini <damien.bergamini@free.fr>
    6  *
    7  * Permission to use, copy, modify, and distribute this software for any
    8  * purpose with or without fee is hereby granted, provided that the above
    9  * copyright notice and this permission notice appear in all copies.
   10  *
   11  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
   12  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
   13  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
   14  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
   15  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
   16  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
   17  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
   18  */
   19 
   20 #define RAL_TX_RING_COUNT       48
   21 #define RAL_ATIM_RING_COUNT     4
   22 #define RAL_PRIO_RING_COUNT     16
   23 #define RAL_BEACON_RING_COUNT   1
   24 #define RAL_RX_RING_COUNT       32
   25 
   26 #define RAL_TX_DESC_SIZE        (sizeof (struct ral_tx_desc))
   27 #define RAL_RX_DESC_SIZE        (sizeof (struct ral_rx_desc))
   28 
   29 #define RAL_MAX_SCATTER 1
   30 
   31 /*
   32  * Control and status registers.
   33  */
   34 #define RAL_CSR0        0x0000  /* ASIC version number */
   35 #define RAL_CSR1        0x0004  /* System control */
   36 #define RAL_CSR3        0x000c  /* STA MAC address 0 */
   37 #define RAL_CSR4        0x0010  /* STA MAC address 1 */
   38 #define RAL_CSR5        0x0014  /* BSSID 0 */
   39 #define RAL_CSR6        0x0018  /* BSSID 1 */
   40 #define RAL_CSR7        0x001c  /* Interrupt source */
   41 #define RAL_CSR8        0x0020  /* Interrupt mask */
   42 #define RAL_CSR9        0x0024  /* Maximum frame length */
   43 #define RAL_SECCSR0     0x0028  /* WEP control */
   44 #define RAL_CSR11       0x002c  /* Back-off control */
   45 #define RAL_CSR12       0x0030  /* Synchronization configuration 0 */
   46 #define RAL_CSR13       0x0034  /* Synchronization configuration 1 */
   47 #define RAL_CSR14       0x0038  /* Synchronization control */
   48 #define RAL_CSR15       0x003c  /* Synchronization status */
   49 #define RAL_CSR16       0x0040  /* TSF timer 0 */
   50 #define RAL_CSR17       0x0044  /* TSF timer 1 */
   51 #define RAL_CSR18       0x0048  /* IFS timer 0 */
   52 #define RAL_CSR19       0x004c  /* IFS timer 1 */
   53 #define RAL_CSR20       0x0050  /* WAKEUP timer */
   54 #define RAL_CSR21       0x0054  /* EEPROM control */
   55 #define RAL_CSR22       0x0058  /* CFP control */
   56 #define RAL_TXCSR0      0x0060  /* TX control */
   57 #define RAL_TXCSR1      0x0064  /* TX configuration */
   58 #define RAL_TXCSR2      0x0068  /* TX descriptor configuration */
   59 #define RAL_TXCSR3      0x006c  /* TX ring base address */
   60 #define RAL_TXCSR4      0x0070  /* TX ATIM ring base address */
   61 #define RAL_TXCSR5      0x0074  /* TX PRIO ring base address */
   62 #define RAL_TXCSR6      0x0078  /* Beacon base address */
   63 #define RAL_TXCSR7      0x007c  /* AutoResponder control */
   64 #define RAL_RXCSR0      0x0080  /* RX control */
   65 #define RAL_RXCSR1      0x0084  /* RX descriptor configuration */
   66 #define RAL_RXCSR2      0x0088  /* RX ring base address */
   67 #define RAL_PCICSR      0x008c  /* PCI control */
   68 #define RAL_RXCSR3      0x0090  /* BBP ID 0 */
   69 #define RAL_TXCSR9      0x0094  /* OFDM TX BBP */
   70 #define RAL_ARSP_PLCP_0 0x0098  /* Auto Responder PLCP address */
   71 #define RAL_ARSP_PLCP_1 0x009c  /* Auto Responder PLCP Basic Rate bit mask */
   72 #define RAL_CNT0        0x00a0  /* FCS error counter */
   73 #define RAL_CNT1        0x00ac  /* PLCP error counter */
   74 #define RAL_CNT2        0x00b0  /* Long error counter */
   75 #define RAL_CNT3        0x00b8  /* CCA false alarm counter */
   76 #define RAL_CNT4        0x00bc  /* RX FIFO Overflow counter */
   77 #define RAL_CNT5        0x00c0  /* Tx FIFO Underrun counter */
   78 #define RAL_PWRCSR0     0x00c4  /* Power mode configuration */
   79 #define RAL_PSCSR0      0x00c8  /* Power state transition time */
   80 #define RAL_PSCSR1      0x00cc  /* Power state transition time */
   81 #define RAL_PSCSR2      0x00d0  /* Power state transition time */
   82 #define RAL_PSCSR3      0x00d4  /* Power state transition time */
   83 #define RAL_PWRCSR1     0x00d8  /* Manual power control/status */
   84 #define RAL_TIMECSR     0x00dc  /* Timer control */
   85 #define RAL_MACCSR0     0x00e0  /* MAC configuration */
   86 #define RAL_MACCSR1     0x00e4  /* MAC configuration */
   87 #define RAL_RALINKCSR   0x00e8  /* Ralink RX auto-reset BBCR */
   88 #define RAL_BCNCSR      0x00ec  /* Beacon interval control */
   89 #define RAL_BBPCSR      0x00f0  /* BBP serial control */
   90 #define RAL_RFCSR       0x00f4  /* RF serial control */
   91 #define RAL_LEDCSR      0x00f8  /* LED control */
   92 #define RAL_SECCSR3     0x00fc  /* XXX not documented */
   93 #define RAL_DMACSR0     0x0100  /* Current RX ring address */
   94 #define RAL_DMACSR1     0x0104  /* Current Tx ring address */
   95 #define RAL_DMACSR2     0x0104  /* Current Priority ring address */
   96 #define RAL_DMACSR3     0x0104  /* Current ATIM ring address */
   97 #define RAL_TXACKCSR0   0x0110  /* XXX not documented */
   98 #define RAL_GPIOCSR     0x0120  /* */
   99 #define RAL_BBBPPCSR    0x0124  /* BBP Pin Control */
  100 #define RAL_FIFOCSR0    0x0128  /* TX FIFO pointer */
  101 #define RAL_FIFOCSR1    0x012c  /* RX FIFO pointer */
  102 #define RAL_BCNOCSR     0x0130  /* Beacon time offset */
  103 #define RAL_RLPWCSR     0x0134  /* RX_PE Low Width */
  104 #define RAL_TESTCSR     0x0138  /* Test Mode Select */
  105 #define RAL_PLCP1MCSR   0x013c  /* Signal/Service/Length of ACK/CTS @1M */
  106 #define RAL_PLCP2MCSR   0x0140  /* Signal/Service/Length of ACK/CTS @2M */
  107 #define RAL_PLCP5p5MCSR 0x0144  /* Signal/Service/Length of ACK/CTS @5.5M */
  108 #define RAL_PLCP11MCSR  0x0148  /* Signal/Service/Length of ACK/CTS @11M */
  109 #define RAL_ACKPCTCSR   0x014c  /* ACK/CTS padload consume time */
  110 #define RAL_ARTCSR1     0x0150  /* ACK/CTS padload consume time */
  111 #define RAL_ARTCSR2     0x0154  /* ACK/CTS padload consume time */
  112 #define RAL_SECCSR1     0x0158  /* WEP control */
  113 #define RAL_BBPCSR1     0x015c  /* BBP TX Configuration */
  114 
  115 
  116 /* possible flags for register RXCSR0 */
  117 #define RAL_DISABLE_RX          (1 << 0)
  118 #define RAL_DROP_CRC_ERROR      (1 << 1)
  119 #define RAL_DROP_PHY_ERROR      (1 << 2)
  120 #define RAL_DROP_CTL            (1 << 3)
  121 #define RAL_DROP_NOT_TO_ME      (1 << 4)
  122 #define RAL_DROP_TODS           (1 << 5)
  123 #define RAL_DROP_VERSION_ERROR  (1 << 6)
  124 
  125 /* possible flags for register CSR1 */
  126 #define RAL_RESET_ASIC  (1 << 0)
  127 #define RAL_RESET_BBP   (1 << 1)
  128 #define RAL_HOST_READY  (1 << 2)
  129 
  130 /* possible flags for register CSR14 */
  131 #define RAL_ENABLE_TSF                  (1 << 0)
  132 #define RAL_ENABLE_TSF_SYNC(x)          (((x) & 0x3) << 1)
  133 #define RAL_ENABLE_TBCN                 (1 << 3)
  134 #define RAL_ENABLE_BEACON_GENERATOR     (1 << 6)
  135 
  136 /* possible flags for register CSR21 */
  137 #define RAL_EEPROM_C            (1 << 1)
  138 #define RAL_EEPROM_S            (1 << 2)
  139 #define RAL_EEPROM_D            (1 << 3)
  140 #define RAL_EEPROM_Q            (1 << 4)
  141 #define RAL_EEPROM_93C46        (1 << 5)
  142 
  143 #define RAL_EEPROM_SHIFT_D      3
  144 #define RAL_EEPROM_SHIFT_Q      4
  145 
  146 /* possible flags for register TXCSR0 */
  147 #define RAL_KICK_TX     (1 << 0)
  148 #define RAL_KICK_ATIM   (1 << 1)
  149 #define RAL_KICK_PRIO   (1 << 2)
  150 #define RAL_ABORT_TX    (1 << 3)
  151 
  152 /* possible flags for register SECCSR0 */
  153 #define RAL_KICK_DECRYPT        (1 << 0)
  154 
  155 /* possible flags for register SECCSR1 */
  156 #define RAL_KICK_ENCRYPT        (1 << 0)
  157 
  158 /* possible flags for register CSR7 */
  159 #define RAL_BEACON_EXPIRE       0x00000001
  160 #define RAL_WAKEUP_EXPIRE       0x00000002
  161 #define RAL_ATIM_EXPIRE         0x00000004
  162 #define RAL_TX_DONE             0x00000008
  163 #define RAL_ATIM_DONE           0x00000010
  164 #define RAL_PRIO_DONE           0x00000020
  165 #define RAL_RX_DONE             0x00000040
  166 #define RAL_DECRYPTION_DONE     0x00000080
  167 #define RAL_ENCRYPTION_DONE     0x00000100
  168 
  169 #define RAL_INTR_MASK                                                   \
  170         (~(RAL_BEACON_EXPIRE | RAL_WAKEUP_EXPIRE | RAL_TX_DONE |        \
  171            RAL_PRIO_DONE | RAL_RX_DONE | RAL_DECRYPTION_DONE |          \
  172            RAL_ENCRYPTION_DONE))
  173 
  174 /* Tx descriptor */
  175 struct ral_tx_desc {
  176         uint32_t        flags;
  177 #define RAL_TX_BUSY             (1 << 0)
  178 #define RAL_TX_VALID            (1 << 1)
  179 
  180 #define RAL_TX_RESULT_MASK      0x0000001c
  181 #define RAL_TX_SUCCESS          (0 << 2)
  182 #define RAL_TX_SUCCESS_RETRY    (1 << 2)
  183 #define RAL_TX_FAIL_RETRY       (2 << 2)
  184 #define RAL_TX_FAIL_INVALID     (3 << 2)
  185 #define RAL_TX_FAIL_OTHER       (4 << 2)
  186 
  187 #define RAL_TX_MORE_FRAG        (1 << 8)
  188 #define RAL_TX_ACK              (1 << 9)
  189 #define RAL_TX_TIMESTAMP        (1 << 10)
  190 #define RAL_TX_OFDM             (1 << 11)
  191 #define RAL_TX_CIPHER_BUSY      (1 << 12)
  192 
  193 #define RAL_TX_IFS_MASK         0x00006000
  194 #define RAL_TX_IFS_BACKOFF      (0 << 13)
  195 #define RAL_TX_IFS_SIFS         (1 << 13)
  196 #define RAL_TX_IFS_NEWBACKOFF   (2 << 13)
  197 #define RAL_TX_IFS_NONE         (3 << 13)
  198 
  199 #define RAL_TX_LONG_RETRY       (1 << 15)
  200 
  201 #define RAL_TX_CIPHER_MASK      0xe0000000
  202 #define RAL_TX_CIPHER_NONE      (0 << 29)
  203 #define RAL_TX_CIPHER_WEP40     (1 << 29)
  204 #define RAL_TX_CIPHER_WEP104    (2 << 29)
  205 #define RAL_TX_CIPHER_TKIP      (3 << 29)
  206 #define RAL_TX_CIPHER_AES       (4 << 29)
  207 
  208         uint32_t        physaddr;
  209         uint16_t        wme;
  210 #define RAL_LOGCWMAX(x)         (((x) & 0xf) << 12)
  211 #define RAL_LOGCWMIN(x)         (((x) & 0xf) << 8)
  212 #define RAL_AIFSN(x)            (((x) & 0x3) << 6)
  213 #define RAL_IVOFFSET(x)         (((x) & 0x3f))
  214 
  215         uint16_t        reserved1;
  216         uint8_t         plcp_signal;
  217         uint8_t         plcp_service;
  218 #define RAL_PLCP_LENGEXT        0x80
  219 
  220         uint16_t        plcp_length;
  221         uint32_t        iv;
  222         uint32_t        eiv;
  223         uint8_t         key[IEEE80211_KEYBUF_SIZE];
  224         uint32_t        reserved2[2];
  225 } __packed;
  226 
  227 /* Rx descriptor */
  228 struct ral_rx_desc {
  229         uint32_t        flags;
  230 #define RAL_RX_BUSY             (1 << 0)
  231 #define RAL_RX_CRC_ERROR        (1 << 5)
  232 #define RAL_RX_PHY_ERROR        (1 << 7)
  233 #define RAL_RX_CIPHER_BUSY      (1 << 8)
  234 #define RAL_RX_ICV_ERROR        (1 << 9)
  235 
  236 #define RAL_RX_CIPHER_MASK      0xe0000000
  237 #define RAL_RX_CIPHER_NONE      (0 << 29)
  238 #define RAL_RX_CIPHER_WEP40     (1 << 29)
  239 #define RAL_RX_CIPHER_WEP104    (2 << 29)
  240 #define RAL_RX_CIPHER_TKIP      (3 << 29)
  241 #define RAL_RX_CIPHER_AES       (4 << 29)
  242 
  243         uint32_t        physaddr;
  244         uint8_t         rate;
  245         uint8_t         rssi;
  246         uint8_t         ta[IEEE80211_ADDR_LEN];
  247         uint32_t        iv;
  248         uint32_t        eiv;
  249         uint8_t         key[IEEE80211_KEYBUF_SIZE];
  250         uint32_t        reserved[2];
  251 } __packed;
  252 
  253 #define RAL_RF1 0
  254 #define RAL_RF2 2
  255 #define RAL_RF3 1
  256 #define RAL_RF4 3
  257 
  258 #define RAL_RF1_AUTOTUNE        0x08000
  259 #define RAL_RF3_AUTOTUNE        0x00040
  260 
  261 #define RAL_BBP_BUSY    (1 << 15)
  262 #define RAL_BBP_WRITE   (1 << 16)
  263 #define RAL_RF_20BIT    (20 << 24)
  264 #define RAL_RF_BUSY     (1 << 31)
  265 
  266 #define RAL_RF_2522     0x00
  267 #define RAL_RF_2523     0x01
  268 #define RAL_RF_2524     0x02
  269 #define RAL_RF_2525     0x03
  270 #define RAL_RF_2525E    0x04
  271 #define RAL_RF_2526     0x05
  272 /* dual-band RF */
  273 #define RAL_RF_5222     0x10
  274 
  275 #define RAL_BBP_VERSION 0
  276 #define RAL_BBP_TX      2
  277 #define RAL_BBP_RX      14
  278 
  279 #define RAL_BBP_ANTA            0x00
  280 #define RAL_BBP_DIVERSITY       0x01
  281 #define RAL_BBP_ANTB            0x02
  282 #define RAL_BBP_ANTMASK         0x03
  283 #define RAL_BBP_FLIPIQ          0x04
  284 
  285 #define RAL_LED_MODE_DEFAULT            0
  286 #define RAL_LED_MODE_TXRX_ACTIVITY      1
  287 #define RAL_LED_MODE_SINGLE             2
  288 #define RAL_LED_MODE_ASUS               3
  289 
  290 #define RAL_JAPAN_FILTER        0x8
  291 
  292 #define RAL_EEPROM_DELAY        1       /* minimum hold time (microsecond) */
  293 
  294 #define RAL_EEPROM_CONFIG0      16
  295 #define RAL_EEPROM_BBP_BASE     19
  296 #define RAL_EEPROM_TXPOWER      35
  297 
  298 /*
  299  * control and status registers access macros
  300  */
  301 #define RAL_READ(sc, reg)                                               \
  302         bus_space_read_4((sc)->sc_st, (sc)->sc_sh, (reg))
  303 
  304 #define RAL_WRITE(sc, reg, val)                                         \
  305         bus_space_write_4((sc)->sc_st, (sc)->sc_sh, (reg), (val))
  306 
  307 /*
  308  * EEPROM access macro
  309  */
  310 #define RAL_EEPROM_CTL(sc, val) do {                                    \
  311         RAL_WRITE((sc), RAL_CSR21, (val));                              \
  312         DELAY(RAL_EEPROM_DELAY);                                        \
  313 } while (/* CONSTCOND */0)

Cache object: 8f826c8d8c7a064701b6526c54ad1681


[ 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.