5 * acxusb.h: USB specific constants and structures.
7 * Copyright (c) 2008 Francis Galiegue <fgaliegue@gmail.com> for the ACX100
10 * This file is licensed under the GPLv2. See the README file for details.
12 /* Used for usb_txbuffer.desc field */
13 #define USB_TXBUF_TXDESC 0xA
14 /* Size of header (everything up to data[]) */
15 #define USB_TXBUF_HDRSIZE 14
16 typedef struct usb_txbuffer
{
25 /* wlan packet content is placed here: */
26 u8 data
[30 + 2312 + 4]; /*WLAN_A4FR_MAXLEN_WEP_FCS]*/
27 } __attribute__ ((packed
)) usb_txbuffer_t
;
29 /* USB returns either rx packets (see rxbuffer) or
30 ** these "tx status" structs: */
31 typedef struct usb_txstatus
{
32 u16 mac_cnt_rcvd
; /* only 12 bits are len! (0xfff) */
34 u8 mac_status
; /* seen 0x20 on tx failure */
40 // struct ieee80211_tx_status txstatus;
41 // struct sk_buff *skb;
42 } __attribute__ ((packed
)) usb_txstatus_t
;
44 typedef struct usb_tx
{
48 /* actual USB bulk output data block is here: */
49 usb_txbuffer_t bulkout
;
59 typedef struct usb_rx
{
64 /* Make entire structure 4k */
65 u8 padding
[4*1024 - sizeof(struct usb_rx_plain
)];
70 /* most frequent accesses first (dereferencing and cache line!) */
81 /* The IRQ we have inherited */
83 /* Are IRQs currently activated? FIXME: should get rid of this */
85 /* The interrupts we can acknowledge (see acx_irq.h) */
87 /* The mask of IRQs saved by the IRQ top half routine */
90 * FIXME: these ones should disappear
92 unsigned int irq_loops_this_jiffy
;
93 unsigned long irq_last_jiffies
;
94 /* Barely used in USB case (FIXME?) */
96 int irq_reason
; /* FIXME: should be u16 */
97 /* Mask of jobs we have to schedule post interrupt */
98 u8 after_interrupt_jobs
;
100 * Work queue for the bottom half. FIXME: only one, consider a
101 * delayed_work struct some day?
103 struct work_struct after_interrupt_task
;
104 #if defined(PARANOID_LOCKING) /* Lock debugging */
105 const char *last_sem
;
106 const char *last_lock
;
107 unsigned long sem_time
;
108 unsigned long lock_time
;
111 /*** Linux network device ***/
112 //struct device *dev; /* pointer to linux netdevice */
114 /*** Device statistics ***/
115 struct ieee80211_low_level_stats ieee_stats
; /* wireless device statistics */
117 /*** Device statistics ***/
118 struct net_device_stats stats
; /* net device statistics */
121 // struct iw_statistics wstats; /* wireless statistics */
123 struct ieee80211_hw
*ieee
;
124 struct ieee80211_hw_mode modes
[2];
125 struct ieee80211_rx_status rx_status
;
127 struct ieee80211_vif
*vif
;
129 /*** Power managment ***/
130 struct pm_dev
*pm
; /* PM crap */
132 /*** Management timer ***/
133 struct timer_list mgmt_timer
;
135 /*** Hardware identification ***/
136 const char *chip_name
;
142 /*** Config retrieved from EEPROM ***/
144 u16 cfgopt_NVS_vendor_offs
;
146 u16 cfgopt_probe_delay
;
147 u32 cfgopt_eof_memory
;
148 u8 cfgopt_dot11CCAModes
;
149 u8 cfgopt_dot11Diversity
;
150 u8 cfgopt_dot11ShortPreambleOption
;
151 u8 cfgopt_dot11PBCCOption
;
152 u8 cfgopt_dot11ChannelAgility
;
153 u8 cfgopt_dot11PhyType
;
154 u8 cfgopt_dot11TempType
;
155 co_antennas_t cfgopt_antennas
;
156 co_powerlevels_t cfgopt_power_levels
;
157 co_datarates_t cfgopt_data_rates
;
158 co_domains_t cfgopt_domains
;
159 co_product_id_t cfgopt_product_id
;
160 co_manuf_t cfgopt_manufacturer
;
162 /*** Firmware identification ***/
163 char firmware_version
[FW_ID_SIZE
+1];
167 const u16
*ie_len_dot11
;
169 /*** Device state ***/
171 u8 led_power
; /* power LED status */
172 u32 get_mask
; /* mask of settings to fetch from the card */
173 u32 set_mask
; /* mask of settings to write to the card */
178 u16 scan_count
; /* number of times to do channel scan */
179 u8 scan_mode
; /* 0 == active, 1 == passive, 2 == background */
182 u16 scan_probe_delay
;
183 #if WIRELESS_EXT > 15
184 // struct iw_spy_data spy_data; /* FIXME: needs to be implemented! */
187 /*** Virtual interface struct ***/
188 struct acx_interface interface
;
190 /*** Wireless network settings ***/
191 /* copy of the device address (ifconfig hw ether) that we actually use
192 ** for 802.11; copied over from the network device's MAC address
193 ** (ifconfig) when it makes sense only */
194 u8 dev_addr
[MAX_ADDR_LEN
];
195 u8 bssid
[ETH_ALEN
]; /* the BSSID after having joined */
196 u8 ap
[ETH_ALEN
]; /* The AP we want, FF:FF:FF:FF:FF:FF is any */
197 u16 aid
; /* The Association ID sent from the AP / last used AID if we're an AP */
198 u16 mode
; /* mode from iwconfig */
199 int monitor_type
; /* ARPHRD_IEEE80211 or ARPHRD_IEEE80211_PRISM */
200 u16 status
; /* 802.11 association status */
201 u8 essid_active
; /* specific ESSID active, or select any? */
202 u8 essid_len
; /* to avoid dozens of strlen() */
203 /* INCLUDES \0 termination for easy printf - but many places
204 ** simply want the string data memcpy'd plus a length indicator!
205 ** Keep that in mind... */
206 char essid
[IW_ESSID_MAX_SIZE
+1];
207 /* essid we are going to use for association, in case of "essid 'any'"
208 ** and in case of hidden ESSID (use configured ESSID then) */
209 char essid_for_assoc
[IW_ESSID_MAX_SIZE
+1];
210 char nick
[IW_ESSID_MAX_SIZE
+1]; /* see essid! */
212 u8 reg_dom_id
; /* reg domain setting */
213 u16 reg_dom_chanmask
;
214 u16 auth_or_assoc_retries
;
216 unsigned long scan_start
; /* YES, jiffies is defined as "unsigned long" */
219 /* MAC80211 Template Reference */
220 struct sk_buff
*beacon_cache
;
221 /* stations known to us (if we're an ap) */
222 // client_t sta_list[32]; /* tab is larger than list, so that */
223 // client_t *sta_hash_tab[64]; /* hash collisions are not likely */
224 // client_t *ap_client; /* this one is our AP (STA mode only) */
228 unsigned long dup_msg_expiry
;
229 u16 last_seq_ctrl
; /* duplicate packet detection */
231 /* 802.11 power save mode */
233 u8 ps_listen_interval
;
235 u8 ps_hangover_period
;
236 u32 ps_enhanced_transition_time
;
237 u32 ps_beacon_rx_time
;
239 /*** PHY settings ***/
240 u8 fallback_threshold
;
246 u8 rate_auto
; /* false if "iwconfig rate N" (WITHOUT 'auto'!) */
247 u8 preamble_mode
; /* 0 == Long Preamble, 1 == Short, 2 == Auto */
252 /* u8 tx_level_val; */
253 /* u8 tx_level_auto; whether to do automatic power adjustment */
255 unsigned long recalib_time_last_success
;
256 unsigned long recalib_time_last_attempt
;
257 int recalib_failure_count
;
258 int recalib_msg_ratelimit
;
259 int retry_errors_msg_ratelimit
;
261 unsigned long brange_time_last_state_change
; /* time the power LED was last changed */
262 u8 brange_last_state
; /* last state of the LED */
263 u8 brange_max_quality
; /* maximum quality that equates to full speed */
266 u8 antenna
; /* antenna settings */
267 u8 ed_threshold
; /* energy detect threshold */
268 u8 cca
; /* clear channel assessment */
275 u16 listen_interval
; /* given in units of beacon interval */
279 u8 rate_supported_len
;
280 u8 rate_supported
[13];
282 /*** Encryption settings (WEP) ***/
283 u32 auth_alg
; /* used in transmit_authen1 */
286 u8 wep_current_index
;
287 wep_key_t wep_keys
[DOT11_MAX_DEFAULT_WEP_KEYS
]; /* the default WEP keys */
289 key_struct_t wep_key_struct
[10];
291 /*** Encryption Replacement for mac80211 ***/
292 struct acx_key key
[54];
300 /*** Card Rx/Tx management ***/
304 unsigned int tx_free
;
305 unsigned int tx_head
; /* keep as close as possible to Tx stuff below (cache line) */
309 * Bus specific (USB here) stuff.
312 /* hack to let common code compile. FIXME */
313 dma_addr_t rxhostdesc_startphy
;
315 struct usb_device
*usbdev
;
317 rxbuffer_t rxtruncbuf
;
322 int bulkinep
; /* bulk-in endpoint */
323 int bulkoutep
; /* bulk-out endpoint */
329 #endif /* _ACXUSB_H_ */