1 /* $OpenBSD: if_ralvar.h,v 1.2 2005/05/13 18:42:50 damien Exp $ */ 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_RX_LIST_COUNT 1 21 #define RAL_TX_LIST_COUNT 1 22 23 struct ural_rx_radiotap_header { 24 struct ieee80211_radiotap_header wr_ihdr; 25 uint8_t wr_flags; 26 uint16_t wr_chan_freq; 27 uint16_t wr_chan_flags; 28 uint8_t wr_antenna; 29 uint8_t wr_antsignal; 30 } __packed; 31 32 #define RAL_RX_RADIOTAP_PRESENT \ 33 ((1 << IEEE80211_RADIOTAP_FLAGS) | \ 34 (1 << IEEE80211_RADIOTAP_CHANNEL) | \ 35 (1 << IEEE80211_RADIOTAP_ANTENNA) | \ 36 (1 << IEEE80211_RADIOTAP_DB_ANTSIGNAL)) 37 38 struct ural_tx_radiotap_header { 39 struct ieee80211_radiotap_header wt_ihdr; 40 uint8_t wt_flags; 41 uint8_t wt_rate; 42 uint16_t wt_chan_freq; 43 uint16_t wt_chan_flags; 44 uint8_t wt_antenna; 45 } __packed; 46 47 #define RAL_TX_RADIOTAP_PRESENT \ 48 ((1 << IEEE80211_RADIOTAP_FLAGS) | \ 49 (1 << IEEE80211_RADIOTAP_RATE) | \ 50 (1 << IEEE80211_RADIOTAP_CHANNEL) | \ 51 (1 << IEEE80211_RADIOTAP_ANTENNA)) 52 53 struct ural_softc; 54 55 struct ural_tx_data { 56 struct ural_softc *sc; 57 usbd_xfer_handle xfer; 58 uint8_t *buf; 59 struct mbuf *m; 60 struct ieee80211_node *ni; 61 }; 62 63 struct ural_rx_data { 64 struct ural_softc *sc; 65 usbd_xfer_handle xfer; 66 uint8_t *buf; 67 struct mbuf *m; 68 }; 69 70 struct ural_softc { 71 USBBASEDEVICE sc_dev; 72 struct ieee80211com sc_ic; 73 int (*sc_newstate)(struct ieee80211com *, 74 enum ieee80211_state, int); 75 76 usbd_device_handle sc_udev; 77 usbd_interface_handle sc_iface; 78 79 int sc_rx_no; 80 int sc_tx_no; 81 82 uint32_t asic_rev; 83 uint8_t rf_rev; 84 85 usbd_pipe_handle sc_rx_pipeh; 86 usbd_pipe_handle sc_tx_pipeh; 87 88 enum ieee80211_state sc_state; 89 struct usb_task sc_task; 90 91 struct ural_rx_data rx_data[RAL_RX_LIST_COUNT]; 92 struct ural_tx_data tx_data[RAL_TX_LIST_COUNT]; 93 int tx_queued; 94 95 struct timeout scan_ch; 96 97 int sc_tx_timer; 98 99 uint32_t rf_regs[4]; 100 uint8_t txpow[14]; 101 102 struct { 103 uint8_t val; 104 uint8_t reg; 105 } __packed bbp_prom[16]; 106 107 int led_mode; 108 int hw_radio; 109 int rx_ant; 110 int tx_ant; 111 int nb_ant; 112 113 #if NBPFILTER > 0 114 caddr_t sc_drvbpf; 115 116 union { 117 struct ural_rx_radiotap_header th; 118 uint8_t pad[64]; 119 } sc_rxtapu; 120 #define sc_rxtap sc_rxtapu.th 121 int sc_rxtap_len; 122 123 union { 124 struct ural_tx_radiotap_header th; 125 uint8_t pad[64]; 126 } sc_txtapu; 127 #define sc_txtap sc_txtapu.th 128 int sc_txtap_len; 129 #endif 130 }; 131