Home | History | Annotate | Line # | Download | only in usb
if_uralvar.h revision 1.1
      1 /*	$NetBSD: if_uralvar.h,v 1.1 2005/07/01 20:06:56 drochner Exp $ */
      2 /*	$OpenBSD: if_ralvar.h,v 1.2 2005/05/13 18:42:50 damien Exp $  */
      3 
      4 /*-
      5  * Copyright (c) 2005
      6  *	Damien Bergamini <damien.bergamini (at) free.fr>
      7  *
      8  * Permission to use, copy, modify, and distribute this software for any
      9  * purpose with or without fee is hereby granted, provided that the above
     10  * copyright notice and this permission notice appear in all copies.
     11  *
     12  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
     13  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
     14  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
     15  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
     16  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
     17  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
     18  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
     19  */
     20 
     21 #define RAL_RX_LIST_COUNT	1
     22 #define RAL_TX_LIST_COUNT	1
     23 
     24 struct ural_rx_radiotap_header {
     25 	struct ieee80211_radiotap_header wr_ihdr;
     26 	uint8_t		wr_flags;
     27 	uint16_t	wr_chan_freq;
     28 	uint16_t	wr_chan_flags;
     29 	uint8_t		wr_antenna;
     30 	uint8_t		wr_antsignal;
     31 } __packed;
     32 
     33 #define RAL_RX_RADIOTAP_PRESENT						\
     34 	((1 << IEEE80211_RADIOTAP_FLAGS) |				\
     35 	 (1 << IEEE80211_RADIOTAP_CHANNEL) |				\
     36 	 (1 << IEEE80211_RADIOTAP_ANTENNA) |				\
     37 	 (1 << IEEE80211_RADIOTAP_DB_ANTSIGNAL))
     38 
     39 struct ural_tx_radiotap_header {
     40 	struct ieee80211_radiotap_header wt_ihdr;
     41 	uint8_t		wt_flags;
     42 	uint8_t		wt_rate;
     43 	uint16_t	wt_chan_freq;
     44 	uint16_t	wt_chan_flags;
     45 	uint8_t		wt_antenna;
     46 } __packed;
     47 
     48 #define RAL_TX_RADIOTAP_PRESENT						\
     49 	((1 << IEEE80211_RADIOTAP_FLAGS) |				\
     50 	 (1 << IEEE80211_RADIOTAP_RATE) |				\
     51 	 (1 << IEEE80211_RADIOTAP_CHANNEL) |				\
     52 	 (1 << IEEE80211_RADIOTAP_ANTENNA))
     53 
     54 struct ural_softc;
     55 
     56 struct ural_tx_data {
     57 	struct ural_softc	*sc;
     58 	usbd_xfer_handle	xfer;
     59 	uint8_t			*buf;
     60 	struct mbuf		*m;
     61 	struct ieee80211_node	*ni;
     62 };
     63 
     64 struct ural_rx_data {
     65 	struct ural_softc	*sc;
     66 	usbd_xfer_handle	xfer;
     67 	uint8_t			*buf;
     68 	struct mbuf		*m;
     69 };
     70 
     71 struct ural_softc {
     72 	USBBASEDEVICE		sc_dev;
     73 	struct ethercom		sc_ec;
     74 	struct ieee80211com	sc_ic;
     75 	int			(*sc_newstate)(struct ieee80211com *,
     76 				    enum ieee80211_state, int);
     77 
     78 	usbd_device_handle	sc_udev;
     79 	usbd_interface_handle	sc_iface;
     80 
     81 	int			sc_rx_no;
     82 	int			sc_tx_no;
     83 
     84 	uint32_t		asic_rev;
     85 	uint8_t			rf_rev;
     86 
     87 	usbd_pipe_handle	sc_rx_pipeh;
     88 	usbd_pipe_handle	sc_tx_pipeh;
     89 
     90 	enum ieee80211_state	sc_state;
     91 	struct usb_task		sc_task;
     92 
     93 	struct ural_rx_data	rx_data[RAL_RX_LIST_COUNT];
     94 	struct ural_tx_data	tx_data[RAL_TX_LIST_COUNT];
     95 	int			tx_queued;
     96 
     97 	struct ieee80211_beacon_offsets sc_bo;
     98 
     99 	struct callout		scan_ch;
    100 
    101 	int			sc_tx_timer;
    102 
    103 	uint32_t		rf_regs[4];
    104 	uint8_t			txpow[14];
    105 
    106 	struct {
    107 		uint8_t	val;
    108 		uint8_t	reg;
    109 	} __packed		bbp_prom[16];
    110 
    111 	int			led_mode;
    112 	int			hw_radio;
    113 	int			rx_ant;
    114 	int			tx_ant;
    115 	int			nb_ant;
    116 
    117 #if NBPFILTER > 0
    118 	caddr_t			sc_drvbpf;
    119 
    120 	union {
    121 		struct ural_rx_radiotap_header th;
    122 		uint8_t	pad[64];
    123 	}			sc_rxtapu;
    124 #define sc_rxtap	sc_rxtapu.th
    125 	int			sc_rxtap_len;
    126 
    127 	union {
    128 		struct ural_tx_radiotap_header th;
    129 		uint8_t	pad[64];
    130 	}			sc_txtapu;
    131 #define sc_txtap	sc_txtapu.th
    132 	int			sc_txtap_len;
    133 #endif
    134 };
    135