1 1.12 thorpej /* $NetBSD: if_rumvar.h,v 1.12 2020/03/15 23:04:50 thorpej Exp $ */ 2 1.4 kiyohara /* $OpenBSD: if_rumvar.h,v 1.7 2006/11/13 20:06:38 damien Exp $ */ 3 1.1 joerg 4 1.1 joerg /*- 5 1.1 joerg * Copyright (c) 2005, 2006 Damien Bergamini <damien.bergamini (at) free.fr> 6 1.1 joerg * Copyright (c) 2006 Niall O'Higgins <niallo (at) openbsd.org> 7 1.1 joerg * 8 1.1 joerg * Permission to use, copy, modify, and distribute this software for any 9 1.1 joerg * purpose with or without fee is hereby granted, provided that the above 10 1.1 joerg * copyright notice and this permission notice appear in all copies. 11 1.1 joerg * 12 1.1 joerg * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 13 1.1 joerg * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 14 1.1 joerg * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 15 1.1 joerg * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 16 1.1 joerg * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 17 1.1 joerg * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 18 1.1 joerg * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 19 1.1 joerg */ 20 1.1 joerg 21 1.4 kiyohara #define RUM_RX_LIST_COUNT 1 22 1.9 jmcneill #define RUM_TX_LIST_COUNT 8 23 1.1 joerg 24 1.1 joerg struct rum_rx_radiotap_header { 25 1.1 joerg struct ieee80211_radiotap_header wr_ihdr; 26 1.1 joerg uint8_t wr_flags; 27 1.1 joerg uint8_t wr_rate; 28 1.1 joerg uint16_t wr_chan_freq; 29 1.1 joerg uint16_t wr_chan_flags; 30 1.1 joerg uint8_t wr_antenna; 31 1.1 joerg uint8_t wr_antsignal; 32 1.11 mrg }; 33 1.1 joerg 34 1.1 joerg #define RT2573_RX_RADIOTAP_PRESENT \ 35 1.1 joerg ((1 << IEEE80211_RADIOTAP_FLAGS) | \ 36 1.1 joerg (1 << IEEE80211_RADIOTAP_RATE) | \ 37 1.1 joerg (1 << IEEE80211_RADIOTAP_CHANNEL) | \ 38 1.1 joerg (1 << IEEE80211_RADIOTAP_ANTENNA) | \ 39 1.1 joerg (1 << IEEE80211_RADIOTAP_DB_ANTSIGNAL)) 40 1.1 joerg 41 1.1 joerg struct rum_tx_radiotap_header { 42 1.1 joerg struct ieee80211_radiotap_header wt_ihdr; 43 1.1 joerg uint8_t wt_flags; 44 1.1 joerg uint8_t wt_rate; 45 1.1 joerg uint16_t wt_chan_freq; 46 1.1 joerg uint16_t wt_chan_flags; 47 1.1 joerg uint8_t wt_antenna; 48 1.11 mrg }; 49 1.1 joerg 50 1.1 joerg #define RT2573_TX_RADIOTAP_PRESENT \ 51 1.1 joerg ((1 << IEEE80211_RADIOTAP_FLAGS) | \ 52 1.1 joerg (1 << IEEE80211_RADIOTAP_RATE) | \ 53 1.1 joerg (1 << IEEE80211_RADIOTAP_CHANNEL) | \ 54 1.1 joerg (1 << IEEE80211_RADIOTAP_ANTENNA)) 55 1.1 joerg 56 1.1 joerg struct rum_softc; 57 1.1 joerg 58 1.1 joerg struct rum_tx_data { 59 1.1 joerg struct rum_softc *sc; 60 1.10 skrll struct usbd_xfer *xfer; 61 1.1 joerg uint8_t *buf; 62 1.1 joerg struct mbuf *m; 63 1.1 joerg struct ieee80211_node *ni; 64 1.1 joerg }; 65 1.1 joerg 66 1.1 joerg struct rum_rx_data { 67 1.1 joerg struct rum_softc *sc; 68 1.10 skrll struct usbd_xfer *xfer; 69 1.1 joerg uint8_t *buf; 70 1.1 joerg struct mbuf *m; 71 1.1 joerg }; 72 1.1 joerg 73 1.1 joerg struct rum_softc { 74 1.8 dyoung device_t sc_dev; 75 1.1 joerg struct ethercom sc_ec; 76 1.1 joerg #define sc_if sc_ec.ec_if 77 1.1 joerg struct ieee80211com sc_ic; 78 1.1 joerg int (*sc_newstate)(struct ieee80211com *, 79 1.1 joerg enum ieee80211_state, int); 80 1.1 joerg 81 1.12 thorpej kmutex_t sc_media_mtx; /* XXX */ 82 1.12 thorpej 83 1.10 skrll struct usbd_device * sc_udev; 84 1.10 skrll struct usbd_interface * sc_iface; 85 1.1 joerg int sc_flags; 86 1.1 joerg #define RT2573_FWLOADED (1 << 0) 87 1.1 joerg 88 1.1 joerg struct ieee80211_channel *sc_curchan; 89 1.1 joerg 90 1.1 joerg int sc_rx_no; 91 1.1 joerg int sc_tx_no; 92 1.1 joerg 93 1.1 joerg uint16_t macbbp_rev; 94 1.1 joerg uint8_t rf_rev; 95 1.1 joerg uint8_t rffreq; 96 1.1 joerg 97 1.10 skrll struct usbd_xfer * amrr_xfer; 98 1.1 joerg 99 1.10 skrll struct usbd_pipe * sc_rx_pipeh; 100 1.10 skrll struct usbd_pipe * sc_tx_pipeh; 101 1.1 joerg 102 1.1 joerg enum ieee80211_state sc_state; 103 1.9 jmcneill int sc_arg; 104 1.1 joerg struct usb_task sc_task; 105 1.1 joerg 106 1.1 joerg struct ieee80211_amrr amrr; 107 1.1 joerg struct ieee80211_amrr_node amn; 108 1.1 joerg 109 1.4 kiyohara struct rum_rx_data rx_data[RUM_RX_LIST_COUNT]; 110 1.4 kiyohara struct rum_tx_data tx_data[RUM_TX_LIST_COUNT]; 111 1.1 joerg int tx_queued; 112 1.9 jmcneill int tx_cur; 113 1.1 joerg 114 1.1 joerg struct ieee80211_beacon_offsets sc_bo; 115 1.1 joerg 116 1.8 dyoung struct callout sc_scan_ch; 117 1.8 dyoung struct callout sc_amrr_ch; 118 1.1 joerg 119 1.1 joerg int sc_tx_timer; 120 1.1 joerg 121 1.1 joerg uint32_t sta[6]; 122 1.1 joerg uint32_t rf_regs[4]; 123 1.1 joerg uint8_t txpow[44]; 124 1.1 joerg 125 1.1 joerg struct { 126 1.1 joerg uint8_t val; 127 1.1 joerg uint8_t reg; 128 1.1 joerg } __packed bbp_prom[16]; 129 1.1 joerg 130 1.1 joerg int hw_radio; 131 1.1 joerg int rx_ant; 132 1.1 joerg int tx_ant; 133 1.1 joerg int nb_ant; 134 1.1 joerg int ext_2ghz_lna; 135 1.1 joerg int ext_5ghz_lna; 136 1.1 joerg int rssi_2ghz_corr; 137 1.1 joerg int rssi_5ghz_corr; 138 1.1 joerg int sifs; 139 1.1 joerg uint8_t bbp17; 140 1.1 joerg 141 1.6 pooka struct bpf_if * sc_drvbpf; 142 1.1 joerg 143 1.1 joerg union { 144 1.1 joerg struct rum_rx_radiotap_header th; 145 1.1 joerg uint8_t pad[64]; 146 1.1 joerg } sc_rxtapu; 147 1.1 joerg #define sc_rxtap sc_rxtapu.th 148 1.1 joerg int sc_rxtap_len; 149 1.1 joerg 150 1.1 joerg union { 151 1.1 joerg struct rum_tx_radiotap_header th; 152 1.1 joerg uint8_t pad[64]; 153 1.1 joerg } sc_txtapu; 154 1.1 joerg #define sc_txtap sc_txtapu.th 155 1.1 joerg int sc_txtap_len; 156 1.1 joerg }; 157