Reverted refactoring of 'interrogate' cmds to 'query'
[acx-mac80211.git] / acx_struct_usb.h
blob1f43e874b09ec68783dbea6ef33be664a63e9626
1 #ifndef _ACXUSB_H_
2 #define _ACXUSB_H_
4 /*
5 * acxusb.h: USB specific constants and structures.
7 * Copyright (c) 2008 Francis Galiegue <fgaliegue@gmail.com> for the ACX100
8 * driver project.
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 {
17 u16 desc;
18 u16 mpdu_len;
19 u8 queue_index;
20 u8 rate;
21 u32 hostdata;
22 u8 ctrl1;
23 u8 ctrl2;
24 u16 data_len;
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) */
33 u8 queue_index;
34 u8 mac_status; /* seen 0x20 on tx failure */
35 u32 hostdata;
36 u8 rate;
37 u8 ack_failures;
38 u8 rts_failures;
39 u8 rts_ok;
40 // struct ieee80211_tx_status txstatus;
41 // struct sk_buff *skb;
42 } __attribute__ ((packed)) usb_txstatus_t;
44 typedef struct usb_tx {
45 unsigned busy:1;
46 struct urb *urb;
47 acx_device_t *adev;
48 /* actual USB bulk output data block is here: */
49 usb_txbuffer_t bulkout;
50 } usb_tx_t;
52 struct usb_rx_plain {
53 unsigned busy:1;
54 struct urb *urb;
55 acx_device_t *adev;
56 rxbuffer_t bulkin;
59 typedef struct usb_rx {
60 unsigned busy:1;
61 struct urb *urb;
62 acx_device_t *adev;
63 rxbuffer_t bulkin;
64 /* Make entire structure 4k */
65 u8 padding[4*1024 - sizeof(struct usb_rx_plain)];
66 } usb_rx_t;
68 #if 0
69 struct acx_device {
70 /* most frequent accesses first (dereferencing and cache line!) */
73 * Locking
75 struct mutex mutex;
76 spinlock_t spinlock;
77 spinlock_t irqlock;
79 * IRQ handling
81 /* The IRQ we have inherited */
82 unsigned int irq;
83 /* Are IRQs currently activated? FIXME: should get rid of this */
84 u8 irqs_active;
85 /* The interrupts we can acknowledge (see acx_irq.h) */
86 u16 irq_mask;
87 /* The mask of IRQs saved by the IRQ top half routine */
88 u16 irq_saved_mask;
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?) */
95 u16 irq_status;
96 int irq_reason; /* FIXME: should be u16 */
97 /* Mask of jobs we have to schedule post interrupt */
98 u8 after_interrupt_jobs;
99 /*
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;
109 #endif
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 */
120 #ifdef WIRELESS_EXT
121 // struct iw_statistics wstats; /* wireless statistics */
122 #endif
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;
137 u8 chip_type;
138 u8 form_factor;
139 u8 radio_type;
140 u8 eeprom_version;
142 /*** Config retrieved from EEPROM ***/
143 char cfgopt_NVSv[8];
144 u16 cfgopt_NVS_vendor_offs;
145 u8 cfgopt_MAC[6];
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];
164 u32 firmware_numver;
165 u32 firmware_id;
166 const u16 *ie_len;
167 const u16 *ie_len_dot11;
169 /*** Device state ***/
170 u16 dev_state_mask;
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 */
174 u32 initialized:1;
177 /*** scanning ***/
178 u16 scan_count; /* number of times to do channel scan */
179 u8 scan_mode; /* 0 == active, 1 == passive, 2 == background */
180 u8 scan_rate;
181 u16 scan_duration;
182 u16 scan_probe_delay;
183 #if WIRELESS_EXT > 15
184 // struct iw_spy_data spy_data; /* FIXME: needs to be implemented! */
185 #endif
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! */
211 u8 channel;
212 u8 reg_dom_id; /* reg domain setting */
213 u16 reg_dom_chanmask;
214 u16 auth_or_assoc_retries;
215 u16 scan_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) */
226 int dup_count;
227 int nondup_count;
228 unsigned long dup_msg_expiry;
229 u16 last_seq_ctrl; /* duplicate packet detection */
231 /* 802.11 power save mode */
232 u8 ps_wakeup_cfg;
233 u8 ps_listen_interval;
234 u8 ps_options;
235 u8 ps_hangover_period;
236 u32 ps_enhanced_transition_time;
237 u32 ps_beacon_rx_time;
239 /*** PHY settings ***/
240 u8 fallback_threshold;
241 u8 stepup_threshold;
242 u16 rate_basic;
243 u16 rate_oper;
244 u16 rate_bcast;
245 u16 rate_bcast100;
246 u8 rate_auto; /* false if "iwconfig rate N" (WITHOUT 'auto'!) */
247 u8 preamble_mode; /* 0 == Long Preamble, 1 == Short, 2 == Auto */
248 u8 preamble_cur;
250 u8 tx_disabled;
251 u8 tx_level_dbm;
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 */
265 u8 sensitivity;
266 u8 antenna; /* antenna settings */
267 u8 ed_threshold; /* energy detect threshold */
268 u8 cca; /* clear channel assessment */
270 u16 rts_threshold;
271 u16 frag_threshold;
272 u32 short_retry;
273 u32 long_retry;
274 u16 msdu_lifetime;
275 u16 listen_interval; /* given in units of beacon interval */
276 u32 beacon_interval;
278 u16 capabilities;
279 u8 rate_supported_len;
280 u8 rate_supported[13];
282 /*** Encryption settings (WEP) ***/
283 u32 auth_alg; /* used in transmit_authen1 */
284 u8 wep_enabled;
285 u8 wep_restricted;
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];
293 u16 security_offset;
294 u8 default_key_idx;
297 /*** Unknown ***/
298 u8 dtim_interval;
300 /*** Card Rx/Tx management ***/
301 u16 rx_config_1;
302 u16 rx_config_2;
303 u16 memblocksize;
304 unsigned int tx_free;
305 unsigned int tx_head; /* keep as close as possible to Tx stuff below (cache line) */
306 u16 phy_header_len;
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;
319 usb_tx_t *usb_tx;
320 usb_rx_t *usb_rx;
322 int bulkinep; /* bulk-in endpoint */
323 int bulkoutep; /* bulk-out endpoint */
324 int rxtruncsize;
327 #endif
329 #endif /* _ACXUSB_H_ */