3 typedef unsigned char UCHAR;
5 /****** IEEE 802.11 constants ************************************************/
7 /* Frame control 1 bit fields */
8 #define PROTOCOL_VER 0x00
10 #define ASSOC_REQ_TYPE 0x00
11 #define ASSOC_RESP_TYPE 0x10
12 #define REASSOC_REQ_TYPE 0x20
13 #define REASSOC_RESP_TYPE 0x30
14 #define NULL_MSG_TYPE 0x48
15 #define BEACON_TYPE 0x80
16 #define DISASSOC_TYPE 0xA0
17 #define PSPOLL_TYPE 0xA4
18 #define AUTHENTIC_TYPE 0xB0
19 #define DEAUTHENTIC_TYPE 0xC0
20 /* Frame control 2 bit fields */
21 #define FC2_TO_DS 0x01
22 #define FC2_FROM_DS 0x02
23 #define FC2_MORE_FRAG 0x04
24 #define FC2_RETRY 0x08
26 #define FC2_MORE_DATA 0x20
28 #define FC2_ORDER 0x80
29 /*****************************************************************************/
30 /* 802.11 element ID's and lengths */
31 #define C_BP_CAPABILITY_ESS 0x01
32 #define C_BP_CAPABILITY_IBSS 0x02
33 #define C_BP_CAPABILITY_CF_POLLABLE 0x04
34 #define C_BP_CAPABILITY_CF_POLL_REQUEST 0x08
35 #define C_BP_CAPABILITY_PRIVACY 0x10
37 #define C_ESSID_ELEMENT_ID 0
38 #define C_ESSID_ELEMENT_MAX_LENGTH 32
40 #define C_SUPPORTED_RATES_ELEMENT_ID 1
41 #define C_SUPPORTED_RATES_ELEMENT_LENGTH 2
43 #define C_FH_PARAM_SET_ELEMENT_ID 2
44 #define C_FH_PARAM_SET_ELEMENT_LNGTH 5
46 #define C_CF_PARAM_SET_ELEMENT_ID 4
47 #define C_CF_PARAM_SET_ELEMENT_LNGTH 6
49 #define C_TIM_ELEMENT_ID 5
50 #define C_TIM_BITMAP_LENGTH 251
51 #define C_TIM_BMCAST_BIT 0x01
53 #define C_IBSS_ELEMENT_ID 6
54 #define C_IBSS_ELEMENT_LENGTH 2
56 #define C_JAPAN_CALL_SIGN_ELEMENT_ID 51
57 #define C_JAPAN_CALL_SIGN_ELEMENT_LNGTH 12
59 #define C_DISASSOC_REASON_CODE_LEN 2
60 #define C_DISASSOC_REASON_CODE_DEFAULT 8
63 #define C_NUM_SUPPORTED_RATES 8
64 /****** IEEE 802.11 mac header for type data packets *************************/
70 UCHAR addr_1[ADDRLEN];
71 UCHAR addr_2[ADDRLEN];
72 UCHAR addr_3[ADDRLEN];
73 UCHAR seq_frag_num[2];
74 /* UCHAR addr_4[ADDRLEN]; *//* only present for AP to AP (TO DS and FROM DS */
76 /****** IEEE 802.11 frame element structures *********************************/
81 UCHAR text[C_ESSID_ELEMENT_MAX_LENGTH];
89 struct freq_hop_element
104 UCHAR bitmap_control;
105 UCHAR tim[C_TIM_BITMAP_LENGTH];
111 UCHAR atim_window[2];
113 struct japan_call_sign_element
119 /****** Beacon message structures ********************************************/
120 /* .elements is a large lump of max size because elements are variable size */
124 UCHAR beacon_intvl[2];
126 UCHAR elements[sizeof(struct essid_element)
127 + sizeof(struct rates_element)
128 + sizeof(struct freq_hop_element)
129 + sizeof(struct japan_call_sign_element)
130 + sizeof(struct tim_element)];
135 UCHAR beacon_intvl[2];
137 UCHAR elements[sizeof(struct essid_element)
138 + sizeof(struct rates_element)
139 + sizeof(struct freq_hop_element)
140 + sizeof(struct japan_call_sign_element)
141 + sizeof(struct ibss_element)];
143 /*****************************************************************************/
144 /*****************************************************************************/
145 /* #define C_MAC_HDR_2_WEP 0x40 */
146 /* TX/RX CCS constants */
147 #define TX_HEADER_LENGTH 0x1C
148 #define RX_MAC_HEADER_LENGTH 0x18
149 #define TX_AUTHENTICATE_LENGTH (TX_HEADER_LENGTH + 6)
150 #define TX_AUTHENTICATE_LENGTH_MSB (TX_AUTHENTICATE_LENGTH >> 8)
151 #define TX_AUTHENTICATE_LENGTH_LSB (TX_AUTHENTICATE_LENGTH & 0xff)
152 #define TX_DEAUTHENTICATE_LENGTH (TX_HEADER_LENGTH + 2)
153 #define TX_DEAUTHENTICATE_LENGTH_MSB (TX_AUTHENTICATE_LENGTH >> 8)
154 #define TX_DEAUTHENTICATE_LENGTH_LSB (TX_AUTHENTICATE_LENGTH & 0xff)
163 #define PASSIVE_SCAN 1
164 #define ACTIVE_SCAN 1
179 /* Hop pattern lengths */
180 #define USA_HOP_MOD 79
181 #define EUROPE_HOP_MOD 79
182 #define JAPAN_HOP_MOD 23
183 #define KOREA_HOP_MOD 23
184 #define SPAIN_HOP_MOD 27
185 #define FRANCE_HOP_MOD 35
186 #define ISRAEL_HOP_MOD 35
187 #define AUSTRALIA_HOP_MOD 47
188 #define JAPAN_TEST_HOP_MOD 23
190 #define ESSID_SIZE 32
191 /**********************************************************************/
192 /* CIS Register Constants */
193 #define CIS_OFFSET 0x0f00
194 /* Configuration Option Register (0x0F00) */
195 #define COR_OFFSET 0x00
196 #define COR_SOFT_RESET 0x80
197 #define COR_LEVEL_IRQ 0x40
198 #define COR_CONFIG_NUM 0x01
199 #define COR_DEFAULT (COR_LEVEL_IRQ | COR_CONFIG_NUM)
201 /* Card Configuration and Status Register (0x0F01) */
202 #define CCSR_OFFSET 0x01
203 #define CCSR_HOST_INTR_PENDING 0x01
204 #define CCSR_POWER_DOWN 0x04
206 /* HCS Interrupt Register (0x0F05) */
207 #define HCS_INTR_OFFSET 0x05
208 /* #define HCS_INTR_OFFSET 0x0A */
209 #define HCS_INTR_CLEAR 0x00
211 /* ECF Interrupt Register (0x0F06) */
212 #define ECF_INTR_OFFSET 0x06
213 /* #define ECF_INTR_OFFSET 0x0C */
214 #define ECF_INTR_SET 0x01
216 /* Authorization Register 0 (0x0F08) */
217 #define AUTH_0_ON 0x57
219 /* Authorization Register 1 (0x0F09) */
220 #define AUTH_1_ON 0x82
222 /* Program Mode Register (0x0F0A) */
227 /* PC Test Mode Register (0x0F0B) */
228 #define PC_TEST_MODE 0x08
230 /* Frequency Control Word (0x0F10) */
231 /* Range 0x02 - 0xA6 */
233 /* Test Mode Control 1-4 (0x0F14 - 0x0F17) */
235 /**********************************************************************/
237 /* Shared RAM Area */
238 #define SCB_BASE 0x0000
239 #define STATUS_BASE 0x0100
240 #define HOST_TO_ECF_BASE 0x0200
241 #define ECF_TO_HOST_BASE 0x0300
242 #define CCS_BASE 0x0400
243 #define RCS_BASE 0x0800
244 #define INFRA_TIM_BASE 0x0C00
245 #define SSID_LIST_BASE 0x0D00
246 #define TX_BUF_BASE 0x1000
247 #define RX_BUF_BASE 0x8000
249 #define NUMBER_OF_CCS 64
250 #define NUMBER_OF_RCS 64
251 /*#define NUMBER_OF_TX_CCS 14 */
252 #define NUMBER_OF_TX_CCS 14
254 #define TX_BUF_SIZE (2048 - sizeof(struct tx_msg))
255 #define RX_BUFF_END 0x3FFF
256 /* Values for buffer_status */
257 #define CCS_BUFFER_FREE 0
258 #define CCS_BUFFER_BUSY 1
259 #define CCS_COMMAND_COMPLETE 2
260 #define CCS_COMMAND_FAILED 3
263 #define CCS_DOWNLOAD_STARTUP_PARAMS 1
264 #define CCS_UPDATE_PARAMS 2
265 #define CCS_REPORT_PARAMS 3
266 #define CCS_UPDATE_MULTICAST_LIST 4
267 #define CCS_UPDATE_POWER_SAVINGS_MODE 5
268 #define CCS_START_NETWORK 6
269 #define CCS_JOIN_NETWORK 7
270 #define CCS_START_ASSOCIATION 8
271 #define CCS_TX_REQUEST 9
272 #define CCS_TEST_MEMORY 0xa
273 #define CCS_SHUTDOWN 0xb
274 #define CCS_DUMP_MEMORY 0xc
275 #define CCS_START_TIMER 0xe
276 #define CCS_LAST_CMD CCS_START_TIMER
278 /* Values for link field */
279 #define CCS_END_LIST 0xff
281 /* values for buffer_status field */
282 #define RCS_BUFFER_FREE 0
283 #define RCS_BUFFER_BUSY 1
284 #define RCS_COMPLETE 2
286 #define RCS_BUFFER_RELEASE 0xFF
288 /* values for interrupt_id field */
289 #define PROCESS_RX_PACKET 0x80 /* */
290 #define REJOIN_NET_COMPLETE 0x81 /* RCS ID: Rejoin Net Complete */
291 #define ROAMING_INITIATED 0x82 /* RCS ID: Roaming Initiated */
292 #define JAPAN_CALL_SIGN_RXD 0x83 /* RCS ID: New Japan Call Sign */
294 /*****************************************************************************/
295 /* Memory types for dump memory command */
297 #define C_MEM_XDATA 1
299 #define C_MEM_IDATA 3
301 /*** Return values for hw_xmit **********/
303 #define XMIT_MSG_BAD (-1)
304 #define XMIT_NO_CCS (-2)
305 #define XMIT_NO_INTR (-3)
306 #define XMIT_NEED_AUTH (-4)
308 /*** Values for card status */
309 #define CARD_INSERTED (0)
311 #define CARD_AWAITING_PARAM (1)
312 #define CARD_INIT_ERROR (11)
314 #define CARD_DL_PARAM (2)
315 #define CARD_DL_PARAM_ERROR (12)
317 #define CARD_DOING_ACQ (3)
319 #define CARD_ACQ_COMPLETE (4)
320 #define CARD_ACQ_FAILED (14)
322 #define CARD_AUTH_COMPLETE (5)
323 #define CARD_AUTH_REFUSED (15)
325 #define CARD_ASSOC_COMPLETE (6)
326 #define CARD_ASSOC_FAILED (16)
328 /*** Values for authentication_state ***********************************/
329 #define UNAUTHENTICATED (0)
330 #define AWAITING_RESPONSE (1)
331 #define AUTHENTICATED (2)
332 #define NEED_TO_AUTH (3)
334 /*** Values for authentication type ************************************/
335 #define OPEN_AUTH_REQUEST (1)
336 #define OPEN_AUTH_RESPONSE (2)
337 #define BROADCAST_DEAUTH (0xc0)
338 /*** Values for timer functions ****************************************/
339 #define TODO_NOTHING (0)
340 #define TODO_VERIFY_DL_START (-1)
341 #define TODO_START_NET (-2)
342 #define TODO_JOIN_NET (-3)
343 #define TODO_AUTHENTICATE_TIMEOUT (-4)
344 #define TODO_SEND_CCS (-5)
345 /***********************************************************************/
346 /* Parameter passing structure for update/report parameter CCS's */
349 unsigned char object_length;
352 #define OBJID_network_type 0
353 #define OBJID_acting_as_ap_status 1
354 #define OBJID_current_ess_id 2
355 #define OBJID_scanning_mode 3
356 #define OBJID_power_mgt_state 4
357 #define OBJID_mac_address 5
358 #define OBJID_frag_threshold 6
359 #define OBJID_hop_time 7
360 #define OBJID_beacon_period 8
361 #define OBJID_dtim_period 9
362 #define OBJID_retry_max 10
363 #define OBJID_ack_timeout 11
364 #define OBJID_sifs 12
365 #define OBJID_difs 13
366 #define OBJID_pifs 14
367 #define OBJID_rts_threshold 15
368 #define OBJID_scan_dwell_time 16
369 #define OBJID_max_scan_dwell_time 17
370 #define OBJID_assoc_resp_timeout 18
371 #define OBJID_adhoc_scan_cycle_max 19
372 #define OBJID_infra_scan_cycle_max 20
373 #define OBJID_infra_super_cycle_max 21
374 #define OBJID_promiscuous_mode 22
375 #define OBJID_unique_word 23
376 #define OBJID_slot_time 24
377 #define OBJID_roaming_low_snr 25
378 #define OBJID_low_snr_count_thresh 26
379 #define OBJID_infra_missed_bcn 27
380 #define OBJID_adhoc_missed_bcn 28
381 #define OBJID_curr_country_code 29
382 #define OBJID_hop_pattern 30
383 #define OBJID_reserved 31
384 #define OBJID_cw_max_msb 32
385 #define OBJID_cw_min_msb 33
386 #define OBJID_noise_filter_gain 34
387 #define OBJID_noise_limit_offset 35
388 #define OBJID_det_rssi_thresh_offset 36
389 #define OBJID_med_busy_thresh_offset 37
390 #define OBJID_det_sync_thresh 38
391 #define OBJID_test_mode 39
392 #define OBJID_test_min_chan_num 40
393 #define OBJID_test_max_chan_num 41
394 #define OBJID_allow_bcast_ID_prbrsp 42
395 #define OBJID_privacy_must_start 43
396 #define OBJID_privacy_can_join 44
397 #define OBJID_basic_rate_set 45
399 /**** Configuration/Status/Control Area ***************************/
400 /* System Control Block (SCB) Area
401 * Located at Shared RAM offset 0
408 /****** Status area at Shared RAM offset 0x0100 ******************************/
410 UCHAR mrx_overflow_for_host; /* 0=ECF may write, 1=host may write*/
411 UCHAR mrx_checksum_error_for_host; /* 0=ECF may write, 1=host may write*/
412 UCHAR rx_hec_error_for_host; /* 0=ECF may write, 1=host may write*/
414 short mrx_overflow; /* ECF increments on rx overflow */
415 short mrx_checksum_error; /* ECF increments on rx CRC error */
416 short rx_hec_error; /* ECF incs on mac header CRC error */
417 UCHAR rxnoise; /* Average RSL measurement */
420 /****** Host-to-ECF Data Area at Shared RAM offset 0x200 *********************/
421 struct host_to_ecf_area {
425 /****** ECF-to-Host Data Area at Shared RAM offset 0x0300 ********************/
426 struct startup_res_518 {
428 UCHAR station_addr[ADDRLEN];
429 UCHAR calc_prog_chksum;
430 UCHAR calc_cis_chksum;
432 UCHAR japan_call_sign[12];
435 struct startup_res_6 {
437 UCHAR station_addr[ADDRLEN];
440 UCHAR japan_call_sign[12];
441 UCHAR calc_prog_chksum;
442 UCHAR calc_cis_chksum;
443 UCHAR firmware_version[3];
448 struct start_join_net_params {
450 UCHAR ssid[ESSID_SIZE];
452 UCHAR privacy_can_join;
455 /****** Command Control Structure area at Shared ram offset 0x0400 ***********/
456 /* Structures for command specific parameters (ccs.var) */
457 struct update_param_cmd {
459 UCHAR number_objects;
462 struct report_param_cmd {
464 UCHAR number_objects;
468 struct start_network_cmd {
470 UCHAR bssid[ADDRLEN];
472 UCHAR net_default_tx_rate;
475 struct join_network_cmd {
477 UCHAR bssid[ADDRLEN];
479 UCHAR net_default_tx_rate;
482 struct tx_requested_cmd {
484 UCHAR tx_data_ptr[2];
485 UCHAR tx_data_length[2];
486 UCHAR host_reserved[2];
493 struct tx_requested_cmd_4 {
495 UCHAR tx_data_ptr[2];
496 UCHAR tx_data_length[2];
497 UCHAR dest_addr[ADDRLEN];
502 struct memory_dump_cmd {
507 struct update_association_cmd {
511 struct start_timer_cmd {
516 UCHAR buffer_status; /* 0 = buffer free, 1 = buffer busy */
517 /* 2 = command complete, 3 = failed */
518 UCHAR cmd; /* command to ECF */
519 UCHAR link; /* link to next CCS, FF=end of list */
520 /* command specific parameters */
523 struct update_param_cmd update_param;
524 struct report_param_cmd report_param;
527 struct start_network_cmd start_network;
528 struct join_network_cmd join_network;
529 struct tx_requested_cmd tx_request;
530 struct memory_dump_cmd memory_dump;
531 struct update_association_cmd update_assoc;
532 struct start_timer_cmd start_timer;
536 /*****************************************************************************/
537 /* Transmit buffer structures */
538 struct tib_structure {
544 UCHAR frags_remaining;
547 UCHAR csma_tx_cntrl_2;
548 UCHAR sifs_tx_cntrl_2;
549 UCHAR tx_dma_addr_1[2];
550 UCHAR tx_dma_addr_2[2];
551 UCHAR var_dur_2mhz[2];
552 UCHAR var_dur_1mhz[2];
553 UCHAR max_dur_2mhz[2];
554 UCHAR max_dur_1mhz[2];
556 UCHAR max_frag_len[2];
570 struct mac_header mac;
575 struct tib_structure tib;
576 struct phy_header phy;
577 struct mac_header mac;
581 /****** ECF Receive Control Stucture (RCS) Area at Shared RAM offset 0x0800 */
582 /* Structures for command specific parameters (rcs.var) */
583 struct rx_packet_cmd {
584 UCHAR rx_data_ptr[2];
585 UCHAR rx_data_length[2];
587 UCHAR next_frag_rcs_index;
588 UCHAR totalpacketlength[2];
590 struct rejoin_net_cmplt_cmd {
592 UCHAR bssid[ADDRLEN];
594 struct japan_call_sign_rxd {
595 UCHAR rxd_call_sign[8];
603 /* command specific parameters */
606 struct rx_packet_cmd rx_packet;
607 struct rejoin_net_cmplt_cmd rejoin_net_complete;
608 struct japan_call_sign_rxd japan_call_sign;
612 /****** Startup parameter structures for both versions of firmware ***********/
613 struct b4_startup_params {
614 UCHAR a_network_type; /* C_ADHOC, C_INFRA */
615 UCHAR a_acting_as_ap_status; /* C_TYPE_STA, C_TYPE_AP */
616 UCHAR a_current_ess_id[ESSID_SIZE]; /* Null terminated unless 32 long */
617 UCHAR a_scanning_mode; /* passive 0, active 1 */
618 UCHAR a_power_mgt_state; /* CAM 0, */
619 UCHAR a_mac_addr[ADDRLEN]; /* */
620 UCHAR a_frag_threshold[2]; /* 512 */
621 UCHAR a_hop_time[2]; /* 16k * 2**n, n=0-4 in Kus */
622 UCHAR a_beacon_period[2]; /* n * a_hop_time in Kus */
623 UCHAR a_dtim_period; /* in beacons */
624 UCHAR a_retry_max; /* */
625 UCHAR a_ack_timeout; /* */
629 UCHAR a_rts_threshold[2]; /* */
630 UCHAR a_scan_dwell_time[2]; /* */
631 UCHAR a_max_scan_dwell_time[2]; /* */
632 UCHAR a_assoc_resp_timeout_thresh; /* */
633 UCHAR a_adhoc_scan_cycle_max; /* */
634 UCHAR a_infra_scan_cycle_max; /* */
635 UCHAR a_infra_super_scan_cycle_max; /* */
636 UCHAR a_promiscuous_mode; /* */
637 UCHAR a_unique_word[2]; /* */
638 UCHAR a_slot_time; /* */
639 UCHAR a_roaming_low_snr_thresh; /* */
640 UCHAR a_low_snr_count_thresh; /* */
641 UCHAR a_infra_missed_bcn_thresh; /* */
642 UCHAR a_adhoc_missed_bcn_thresh; /* */
643 UCHAR a_curr_country_code; /* C_USA */
644 UCHAR a_hop_pattern; /* */
645 UCHAR a_hop_pattern_length; /* */
646 /* b4 - b5 differences start here */
647 UCHAR a_cw_max; /* */
648 UCHAR a_cw_min; /* */
649 UCHAR a_noise_filter_gain; /* */
650 UCHAR a_noise_limit_offset; /* */
651 UCHAR a_det_rssi_thresh_offset; /* */
652 UCHAR a_med_busy_thresh_offset; /* */
653 UCHAR a_det_sync_thresh; /* */
654 UCHAR a_test_mode; /* */
655 UCHAR a_test_min_chan_num; /* */
656 UCHAR a_test_max_chan_num; /* */
657 UCHAR a_rx_tx_delay; /* */
658 UCHAR a_current_bss_id[ADDRLEN]; /* */
659 UCHAR a_hop_set; /* */
661 struct b5_startup_params {
662 UCHAR a_network_type; /* C_ADHOC, C_INFRA */
663 UCHAR a_acting_as_ap_status; /* C_TYPE_STA, C_TYPE_AP */
664 UCHAR a_current_ess_id[ESSID_SIZE]; /* Null terminated unless 32 long */
665 UCHAR a_scanning_mode; /* passive 0, active 1 */
666 UCHAR a_power_mgt_state; /* CAM 0, */
667 UCHAR a_mac_addr[ADDRLEN]; /* */
668 UCHAR a_frag_threshold[2]; /* 512 */
669 UCHAR a_hop_time[2]; /* 16k * 2**n, n=0-4 in Kus */
670 UCHAR a_beacon_period[2]; /* n * a_hop_time in Kus */
671 UCHAR a_dtim_period; /* in beacons */
672 UCHAR a_retry_max; /* 4 */
673 UCHAR a_ack_timeout; /* */
677 UCHAR a_rts_threshold[2]; /* */
678 UCHAR a_scan_dwell_time[2]; /* */
679 UCHAR a_max_scan_dwell_time[2]; /* */
680 UCHAR a_assoc_resp_timeout_thresh; /* */
681 UCHAR a_adhoc_scan_cycle_max; /* */
682 UCHAR a_infra_scan_cycle_max; /* */
683 UCHAR a_infra_super_scan_cycle_max; /* */
684 UCHAR a_promiscuous_mode; /* */
685 UCHAR a_unique_word[2]; /* */
686 UCHAR a_slot_time; /* */
687 UCHAR a_roaming_low_snr_thresh; /* */
688 UCHAR a_low_snr_count_thresh; /* */
689 UCHAR a_infra_missed_bcn_thresh; /* */
690 UCHAR a_adhoc_missed_bcn_thresh; /* */
691 UCHAR a_curr_country_code; /* C_USA */
692 UCHAR a_hop_pattern; /* */
693 UCHAR a_hop_pattern_length; /* */
694 /* b4 - b5 differences start here */
695 UCHAR a_cw_max[2]; /* */
696 UCHAR a_cw_min[2]; /* */
697 UCHAR a_noise_filter_gain; /* */
698 UCHAR a_noise_limit_offset; /* */
699 UCHAR a_det_rssi_thresh_offset; /* */
700 UCHAR a_med_busy_thresh_offset; /* */
701 UCHAR a_det_sync_thresh; /* */
702 UCHAR a_test_mode; /* */
703 UCHAR a_test_min_chan_num; /* */
704 UCHAR a_test_max_chan_num; /* */
705 UCHAR a_allow_bcast_SSID_probe_rsp;
706 UCHAR a_privacy_must_start;
707 UCHAR a_privacy_can_join;
708 UCHAR a_basic_rate_set[8];
711 /*****************************************************************************/
712 #define RAY_IOCG_PARMS (SIOCDEVPRIVATE)
713 #define RAY_IOCS_PARMS (SIOCDEVPRIVATE + 1)
714 #define RAY_DO_CMD (SIOCDEVPRIVATE + 2)
716 /****** ethernet <-> 802.11 translation **************************************/
717 typedef struct snaphdr_t
726 #define BRIDGE_ENCAP 0xf80000
727 #define RFC1042_ENCAP 0
728 #define SNAP_ID 0x0003aaaa
729 #define RAY_IPX_TYPE 0x8137
730 #define APPLEARP_TYPE 0x80f3
731 /*****************************************************************************/
732 #endif /* #ifndef RAYLINK_H */