1 /* include/acx100_helper.h
3 * --------------------------------------------------------------------
5 * Copyright (C) 2003 ACX100 Open Source Project
7 * The contents of this file are subject to the Mozilla Public
8 * License Version 1.1 (the "License"); you may not use this file
9 * except in compliance with the License. You may obtain a copy of
10 * the License at http://www.mozilla.org/MPL/
12 * Software distributed under the License is distributed on an "AS
13 * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
14 * implied. See the License for the specific language governing
15 * rights and limitations under the License.
17 * Alternatively, the contents of this file may be used under the
18 * terms of the GNU Public License version 2 (the "GPL"), in which
19 * case the provisions of the GPL are applicable instead of the
20 * above. If you wish to allow the use of your version of this file
21 * only under the terms of the GPL and not to allow others to use
22 * your version of this file under the MPL, indicate your decision
23 * by deleting the provisions above and replace them with the notice
24 * and other provisions required by the GPL. If you do not delete
25 * the provisions above, a recipient may use your version of this
26 * file under either the MPL or the GPL.
28 * --------------------------------------------------------------------
30 * Inquiries regarding the ACX100 Open Source Project can be
33 * acx100-users@lists.sf.net
34 * http://acx100.sf.net
36 * --------------------------------------------------------------------
38 #ifndef __ACX_ACX100_HELPER_H
39 #define __ACX_ACX100_HELPER_H
41 #define ISTATUS_0_STARTED 0
42 #define ISTATUS_1_SCANNING 1
43 #define ISTATUS_2_WAIT_AUTH 2
44 #define ISTATUS_3_AUTHENTICATED 3
45 #define ISTATUS_4_ASSOCIATED 4
46 #define ISTATUS_5_UNKNOWN 5
50 /* a helper struct for quick implementation of commands */
51 typedef struct GenericPacket
{
56 typedef struct acx100_memmap
{
63 UINT32 PacketTemplateStart
;
64 UINT32 PacketTemplateEnd
;
71 typedef struct acx100_memconfigoption
{
75 UINT32 pRxHostDesc
; /* val0x8 */
80 } acx100_memconfigoption_t
;
83 typedef struct QueueConfig
{
85 UINT16 len
; /* length */
88 UINT8 QueueOptions
; /* queue options, val0xd */
89 UINT8 NumTxQueues
; /* # tx queues, val0xe */
90 UINT8 NumRxDesc
; /* for USB only */
91 UINT8 padf2
; /* # rx buffers */
93 UINT32 HostQueueEnd
; /* QueueEnd2*/
100 typedef struct ACX111QueueConfig
{
104 UINT32 tx_memory_block_address
;
105 UINT32 rx_memory_block_address
;
106 UINT32 rx1_queue_address
;
108 UINT32 tx1_queue_address
;
109 UINT8 tx1_attributes
;
113 } __WLAN_ATTRIB_PACK__ ACX111QueueConfig_t
;
115 typedef struct ACX111MemoryConfig
{
119 UINT16 no_of_stations
;
120 UINT16 memory_block_size
;
121 UINT8 tx_rx_memory_block_allocation
;
122 UINT8 count_rx_queues
;
123 UINT8 count_tx_queues
;
129 /* start of rx1 block */
130 UINT8 rx_queue1_count_descs
;
131 UINT8 rx_queue1_reserved1
;
132 UINT8 rx_queue1_reserved2
; /* must be set to 7 */
133 UINT8 rx_queue1_reserved3
; /* must be set to 0 */
134 UINT32 rx_queue1_host_rx_start
;
135 /* end of rx1 block */
137 /* start of tx1 block */
138 UINT8 tx_queue1_count_descs
;
139 UINT8 tx_queue1_reserved1
;
140 UINT8 tx_queue1_reserved2
;
141 UINT8 tx_queue1_attributes
;
142 /* end of tx1 block */
144 } __WLAN_ATTRIB_PACK__ ACX111MemoryConfig_t
;
150 UINT8 wep_key
[MAX_KEYLEN
];
155 typedef struct associd
{
159 #define PS_CFG_ENABLE 0x80
160 #define PS_CFG_PENDING 0x40 /* status flag when entering PS */
161 #define PS_CFG_WAKEUP_MODE_MASK 0x07
162 #define PS_CFG_WAKEUP_BY_HOST 0x03
163 #define PS_CFG_WAKEUP_EACH_ITVL 0x02
164 #define PS_CFG_WAKEUP_ON_DTIM 0x01
165 #define PS_CFG_WAKEUP_ALL_BEAC 0x00
167 #define PS_OPT_ENA_ENHANCED_PS 0x04 /* Enhanced PS mode: sleep until Rx Beacon w/ the STA's AID bit set in the TIM; newer firmwares only(?) */
168 #define PS_OPT_STILL_RCV_BCASTS 0x01
170 typedef struct acx100_powermgmt
{
174 UINT8 listen_interval
; /* for EACH_ITVL: wake up every "beacon units" interval */
176 UINT8 hangover_period
; /* remaining wake time after Tx MPDU w/ PS bit, in values of 1/1024 seconds */
177 UINT16 enhanced_ps_transition_time
; /* rem. wake time for Enh. PS */
178 } acx100_powermgmt_t
;
180 typedef struct acx111_powermgmt
{
184 UINT8 listen_interval
; /* for EACH_ITVL: wake up every "beacon units" interval */
186 UINT8 hangover_period
; /* remaining wake time after Tx MPDU w/ PS bit, in values of 1/1024 seconds */
188 UINT32 enhanced_ps_transition_time
; /* rem. wake time for Enh. PS */
189 } acx111_powermgmt_t
;
191 typedef struct defaultkey
{
195 typedef struct memmap
{
199 struct GenericPacket gp
;
202 struct defaultkey dkey
;
206 typedef struct sub3info
{
211 typedef struct subsubinfo
{
216 typedef struct subinfo
{
219 struct subsubinfo buf2
;
223 typedef struct beaconinfo
{
233 typedef struct beacon
{
235 struct beaconinfo inf
;
239 #define ACX_SCAN_ACTIVE 0
240 #define ACX_SCAN_PASSIVE 1
241 #define ACX_SCAN_BACKGROUND 2
243 typedef struct scan
{
244 UINT16 count
; /* number of scans to do, 0xffff == continuous */
246 UINT16 flags
; /* channel list mask; 0x8000 == all channels? */
247 UINT8 max_rate
; /* max. probe rate */
248 UINT8 options
; /* scan mode: 0 == active, 1 == passive, 2 == background */
249 UINT16 chan_duration
;
250 UINT16 max_probe_delay
;
251 } scan_t
; /* length 0xc */
253 typedef struct acx111_scan
{
254 UINT16 count
; /* number of scans to do */
255 UINT8 channel_list_select
;
260 UINT16 chan_duration
;
261 UINT16 max_probe_delay
;
263 UINT8 channel_list
[26];
264 } __WLAN_ATTRIB_PACK__ acx111_scan_t
;
272 typedef struct proberesp
{
275 } __WLAN_ATTRIB_PACK__ proberesp_t
;
277 typedef struct probereq
{
280 } __WLAN_ATTRIB_PACK__ probereq_t
;
282 typedef struct joinbss
{
283 UINT8 bssid
[ETH_ALEN
];
284 UINT16 beacon_interval
;
287 UINT8 rates_supported
;
293 char essid
[IW_ESSID_MAX_SIZE
];
294 } __WLAN_ATTRIB_PACK__ joinbss_t
; /* ACX100 specific join struct */
297 * I am temporarily redefining this because the above struct is somewhat wrong.
299 * NOTE: this is a generic struct for all sorts of different packet types.
300 * As such I guess that someone got confused about structure layout.
301 * In other words: it always has an "official" packet header (A4?)
302 * and then a custom packet body.
303 * The current form is probably a bit sub-optimal. However let's keep it
304 * for now and then redefine it later. Or maybe change it now to have a
305 * better struct layout for all sorts of management packets?
307 typedef struct acxp80211_hdr
{
309 UINT8 val0x18
[8]; /* this contains the Logical Link Control data
310 the first three bytes are the dsap, ssap and control
311 respectively. the following 3 bytes are either ieee_oui
312 or an RFC. See p80211conv.c/h for more. */
313 UINT16 beacon_interval
;
315 UINT8 info
[0x30]; /* 0x24 */
317 * info[1] is essid_len
318 * &info[2] is essid (max. 32 chars)
319 * FIXME: huh, then sizeof(info) == 0x18 cannot be correct! Adjusting
320 * to 0x30, which extends to end of this struct
322 /* p80211_hdr_a4_t b4; */
323 } acxp80211_hdr_t
; /* size: 0x54 */
325 /* struct used for Beacon and for Probe Response frames */
326 typedef struct acxp80211_beacon_prb_resp
{
327 p80211_hdr_a3_t hdr
; /* 24 Bytes */
328 UINT8 timestamp
[8]; /* 8 Bytes */
329 UINT16 beacon_interval
; /* 2 Bytes */
330 UINT16 caps
; /* 2 Bytes */
331 UINT8 info
[48]; /* 48 Bytes */
333 UINT8 ssid
[1+1+IW_ESSID_MAX_SIZE
]; /* 34 Bytes */
334 UINT8 supp_rates
[1+1+8]; /* 10 Bytes */
335 UINT8 ds_parms
[1+1+1]; /* 3 Bytes */
336 UINT8 filler
; /* 1 Byte alignment filler */
338 } acxp80211_beacon_prb_resp_t
;
340 typedef struct acxp80211_packet
{
341 UINT16 size
; /* packet len indicator for firmware */
342 struct acxp80211_hdr hdr
; /* actual packet */
343 } acxp80211_packet_t
; /* size: 0x56 */
347 UINT16 type
; /* 0x0 int. RAM / 0xffff MAC reg. / 0x81 PHY RAM / 0x82 PHY reg. */
352 typedef struct acxp80211_beacon_prb_resp_template
{
353 UINT16 size
; /* packet len indicator for firmware */
354 struct acxp80211_beacon_prb_resp pkt
;
355 } acxp80211_beacon_prb_resp_template_t
;
357 typedef struct acxp80211_nullframe
{
359 struct p80211_hdr_a3 hdr
;
360 } acxp80211_nullframe_t
;
365 UINT8 data
[1]; /* the byte array of the actual firmware... */
374 typedef struct acx100_wep_options
{
377 UINT16 NumKeys
; /* max # of keys */
379 UINT8 Pad
; /* used only for acx111 */
380 } acx100_wep_options_t
;
382 typedef struct dot11WEPDefaultKey
{
388 UINT8 Key
[29]; /* check this! was Key[19]. */
389 } dot11WEPDefaultKey_t
;
391 typedef struct dot11WEPDefaultKeyID
{
395 } dot11WEPDefaultKeyID_t
;
397 typedef struct acx100_wep_mgmt
{
398 UINT8 MacAddr
[ETH_ALEN
];
401 UINT8 Key
[29]; /* 29*8 == 232bits == WEP256 */
407 void acx100_schedule(long timeout
);
408 int acx100_reset_dev(netdevice_t
*dev
);
409 void acx100_join_bssid(wlandevice_t
*priv
);
410 int acx100_init_mac(netdevice_t
*dev
, UINT16 init
);
411 int acx100_set_defaults(wlandevice_t
*priv
);
412 void acx100_set_reg_domain(wlandevice_t
*priv
, unsigned char reg_dom_id
);
413 int acx100_set_probe_response_template(wlandevice_t
*priv
);
414 int acx100_set_beacon_template(wlandevice_t
*priv
);
415 void acx100_set_timer(wlandevice_t
*priv
, UINT32 time
);
416 void acx100_update_capabilities(wlandevice_t
*priv
);
417 UINT16
acx100_read_eeprom_offset(wlandevice_t
*priv
, UINT16 addr
,
419 UINT16
acx100_read_eeprom_area(wlandevice_t
*priv
);
420 UINT16
acx100_write_eeprom_offset(wlandevice_t
*priv
, UINT16 addr
,
421 UINT16 len
, UINT8
*charbuf
);
422 UINT16
acx100_read_phy_reg(wlandevice_t
*priv
, UINT16 reg
, UINT8
*charbuf
);
423 UINT16
acx100_write_phy_reg(wlandevice_t
*priv
, UINT16 reg
, UINT8 value
);
424 void acx100_start(wlandevice_t
*priv
);
425 void acx100_reset_mac(wlandevice_t
*priv
);
426 int acx100_check_file(const char *file
);
427 /*@null@*/ firmware_image_t
*acx_read_fw( const char *file
, UINT32
*size
);
428 int acx100_upload_fw(wlandevice_t
*priv
);
429 int acx100_write_fw(wlandevice_t
*priv
, const firmware_image_t
*apfw_image
, UINT32 offset
);
430 int acx100_validate_fw(wlandevice_t
*priv
, const firmware_image_t
*apfw_mage
, UINT32 offset
);
431 int acx100_verify_init(wlandevice_t
*priv
);
432 void acx100_init_mboxes(wlandevice_t
*priv
);
433 int acx100_init_wep(wlandevice_t
*priv
, acx100_memmap_t
*pt
);
434 int acx100_init_packet_templates(wlandevice_t
*priv
, acx100_memmap_t
*pt
);
435 int acx100_init_max_probe_request_template(wlandevice_t
*priv
);
436 int acx100_init_max_null_data_template(wlandevice_t
*priv
);
437 int acx100_init_max_beacon_template(wlandevice_t
*priv
);
438 int acx100_init_max_tim_template(wlandevice_t
*priv
);
439 int acx100_init_max_probe_response_template(wlandevice_t
*priv
);
440 int acx100_set_tim_template(wlandevice_t
*priv
);
441 int acx100_set_generic_beacon_probe_response_frame(wlandevice_t
*priv
,
442 struct acxp80211_beacon_prb_resp
*bcn
);
443 void acx100_update_card_settings(wlandevice_t
*priv
, int init
, int get_all
, int set_all
);
444 int acx_ioctl_old(netdevice_t
*dev
, struct ifreq
*ifr
, int cmd
);
445 void acx100_set_probe_request_template(wlandevice_t
*priv
);
446 void acx100_scan_chan(wlandevice_t
*priv
);
447 void acx100_scan_chan_p(wlandevice_t
*priv
, struct scan
*s
);
448 void acx111_scan_chan_p(wlandevice_t
*priv
, struct acx111_scan
*s
);
449 int acx100_set_rxconfig(wlandevice_t
*priv
);
450 int acx100_load_radio(wlandevice_t
*priv
);
451 int acx100_read_proc(char *page
, char **start
, off_t offset
, int count
,
452 int *eof
, void *data
);
453 int acx100_read_proc_diag(char *page
, char **start
, off_t offset
, int count
,
454 int *eof
, void *data
);
455 int acx100_read_proc_eeprom(char *page
, char **start
, off_t offset
, int count
,
456 int *eof
, void *data
);
457 int acx100_read_proc_phy(char *page
, char **start
, off_t offset
, int count
,
458 int *eof
, void *data
);
459 int acx100_proc_output(char *buf
, wlandevice_t
*priv
);
460 int acx100_proc_diag_output(char *buf
, wlandevice_t
*priv
);
461 int acx100_proc_eeprom_output(char *buf
, wlandevice_t
*priv
);
462 int acx100_proc_phy_output(char *buf
, wlandevice_t
*priv
);
463 #endif /* __ACX_ACX100_HELPER_H */