if_uralvar.h revision 253757
176082Sbmah/* $FreeBSD: head/sys/dev/usb/wlan/if_uralvar.h 253757 2013-07-29 05:54:13Z hselasky $ */ 276082Sbmah 376082Sbmah/*- 476082Sbmah * Copyright (c) 2005 576082Sbmah * Damien Bergamini <damien.bergamini@free.fr> 676082Sbmah * 776082Sbmah * Permission to use, copy, modify, and distribute this software for any 876082Sbmah * purpose with or without fee is hereby granted, provided that the above 976082Sbmah * copyright notice and this permission notice appear in all copies. 1076082Sbmah * 1176082Sbmah * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 1276082Sbmah * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 1376082Sbmah * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 1476082Sbmah * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 1576082Sbmah * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 1676082Sbmah * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 1776082Sbmah * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 1876082Sbmah */ 1976082Sbmah 2076082Sbmah#define RAL_TX_LIST_COUNT 8 2176254Sbmah#define RAL_TX_MINFREE 2 2276254Sbmah 2376222Sbmah#define URAL_SCAN_START 1 2476222Sbmah#define URAL_SCAN_END 2 2586150Solgeni#define URAL_SET_CHANNEL 3 2676222Sbmah 27241122Sgabor 2876254Sbmahstruct ural_rx_radiotap_header { 2976254Sbmah struct ieee80211_radiotap_header wr_ihdr; 3076254Sbmah uint8_t wr_flags; 31241122Sgabor uint8_t wr_rate; 3276254Sbmah uint16_t wr_chan_freq; 3376254Sbmah uint16_t wr_chan_flags; 3476254Sbmah int8_t wr_antsignal; 3576254Sbmah int8_t wr_antnoise; 36241122Sgabor uint8_t wr_antenna; 3776222Sbmah} __packed __aligned(8); 3876222Sbmah 3976222Sbmah#define RAL_RX_RADIOTAP_PRESENT \ 4076222Sbmah ((1 << IEEE80211_RADIOTAP_FLAGS) | \ 4176222Sbmah (1 << IEEE80211_RADIOTAP_RATE) | \ 42158627Swilko (1 << IEEE80211_RADIOTAP_CHANNEL) | \ 43241122Sgabor (1 << IEEE80211_RADIOTAP_ANTENNA) | \ 4476082Sbmah (1 << IEEE80211_RADIOTAP_DBM_ANTSIGNAL) | \ 4576082Sbmah (1 << IEEE80211_RADIOTAP_DBM_ANTNOISE)) 4676082Sbmah 4776082Sbmahstruct ural_tx_radiotap_header { 48241122Sgabor struct ieee80211_radiotap_header wt_ihdr; 4976254Sbmah uint8_t wt_flags; 5076254Sbmah uint8_t wt_rate; 5176254Sbmah uint16_t wt_chan_freq; 5276254Sbmah uint16_t wt_chan_flags; 5376254Sbmah uint8_t wt_antenna; 54241122Sgabor} __packed __aligned(8); 5576254Sbmah 5676082Sbmah#define RAL_TX_RADIOTAP_PRESENT \ 5776082Sbmah ((1 << IEEE80211_RADIOTAP_FLAGS) | \ 5876082Sbmah (1 << IEEE80211_RADIOTAP_RATE) | \ 5976082Sbmah (1 << IEEE80211_RADIOTAP_CHANNEL) | \ 6076082Sbmah (1 << IEEE80211_RADIOTAP_ANTENNA)) 6176082Sbmah 6276082Sbmahstruct ural_softc; 6376082Sbmah 6476082Sbmahstruct ural_tx_data { 6576082Sbmah STAILQ_ENTRY(ural_tx_data) next; 6676082Sbmah struct ural_softc *sc; 6776082Sbmah struct ural_tx_desc desc; 6876082Sbmah struct mbuf *m; 6976082Sbmah struct ieee80211_node *ni; 7076082Sbmah int rate; 7176082Sbmah}; 7276082Sbmahtypedef STAILQ_HEAD(, ural_tx_data) ural_txdhead; 7376082Sbmah 7476082Sbmahstruct ural_vap { 7576082Sbmah struct ieee80211vap vap; 7676082Sbmah struct ieee80211_beacon_offsets bo; 7776082Sbmah struct usb_callout ratectl_ch; 7876082Sbmah struct task ratectl_task; 7976082Sbmah 8076082Sbmah int (*newstate)(struct ieee80211vap *, 8176082Sbmah enum ieee80211_state, int); 8276138Sbmah}; 8376138Sbmah#define URAL_VAP(vap) ((struct ural_vap *)(vap)) 8476138Sbmah 8576138Sbmahenum { 8676138Sbmah URAL_BULK_WR, 8776138Sbmah URAL_BULK_RD, 8876138Sbmah URAL_N_TRANSFER = 2, 8976138Sbmah}; 9076082Sbmah 91241122Sgaborstruct ural_softc { 9276082Sbmah struct ifnet *sc_ifp; 9376082Sbmah device_t sc_dev; 9476082Sbmah struct usb_device *sc_udev; 9576082Sbmah 9676082Sbmah uint32_t asic_rev; 9776082Sbmah uint8_t rf_rev; 9876082Sbmah 9976082Sbmah struct usb_xfer *sc_xfer[URAL_N_TRANSFER]; 100158627Swilko 10176082Sbmah struct ural_tx_data tx_data[RAL_TX_LIST_COUNT]; 102198114Shrs ural_txdhead tx_q; 103198114Shrs ural_txdhead tx_free; 104198114Shrs int tx_nfree; 105198114Shrs struct ural_rx_desc sc_rx_desc; 10676082Sbmah 10776082Sbmah struct mtx sc_mtx; 10876082Sbmah 10976254Sbmah uint16_t sta[11]; 11076254Sbmah uint32_t rf_regs[4]; 111241122Sgabor uint8_t txpow[14]; 11276254Sbmah uint8_t sc_bssid[6]; 113241122Sgabor uint8_t sc_detached; 11476254Sbmah 11576254Sbmah struct { 11676082Sbmah uint8_t val; 11777211Sbmah uint8_t reg; 11877494Sbmah } __packed bbp_prom[16]; 11977494Sbmah 12077494Sbmah int led_mode; 12176082Sbmah int hw_radio; 12276082Sbmah int rx_ant; 12377211Sbmah int tx_ant; 12486150Solgeni int nb_ant; 12576082Sbmah 12678040Sache struct ural_rx_radiotap_header sc_rxtap; 12776082Sbmah int sc_rxtap_len; 128 129 struct ural_tx_radiotap_header sc_txtap; 130 int sc_txtap_len; 131}; 132 133#define RAL_LOCK(sc) mtx_lock(&(sc)->sc_mtx) 134#define RAL_UNLOCK(sc) mtx_unlock(&(sc)->sc_mtx) 135#define RAL_LOCK_ASSERT(sc, t) mtx_assert(&(sc)->sc_mtx, t) 136