1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _RAYCTL_H_
3 #define _RAYCTL_H_
4 
5 typedef unsigned char UCHAR;
6 
7 /****** IEEE 802.11 constants ************************************************/
8 #define ADDRLEN           6
9 /* Frame control 1 bit fields */
10 #define PROTOCOL_VER      0x00
11 #define DATA_TYPE         0x08
12 #define ASSOC_REQ_TYPE    0x00
13 #define ASSOC_RESP_TYPE   0x10
14 #define REASSOC_REQ_TYPE  0x20
15 #define REASSOC_RESP_TYPE 0x30
16 #define NULL_MSG_TYPE     0x48
17 #define BEACON_TYPE       0x80
18 #define DISASSOC_TYPE     0xA0
19 #define PSPOLL_TYPE       0xA4
20 #define AUTHENTIC_TYPE    0xB0
21 #define DEAUTHENTIC_TYPE  0xC0
22 /* Frame control 2 bit fields */
23 #define FC2_TO_DS         0x01
24 #define FC2_FROM_DS       0x02
25 #define FC2_MORE_FRAG     0x04
26 #define FC2_RETRY         0x08
27 #define FC2_PSM           0x10
28 #define FC2_MORE_DATA     0x20
29 #define FC2_WEP           0x40
30 #define FC2_ORDER         0x80
31 /*****************************************************************************/
32 /* 802.11 element ID's and lengths */
33 #define C_BP_CAPABILITY_ESS             0x01
34 #define C_BP_CAPABILITY_IBSS            0x02
35 #define C_BP_CAPABILITY_CF_POLLABLE     0x04
36 #define C_BP_CAPABILITY_CF_POLL_REQUEST 0x08
37 #define C_BP_CAPABILITY_PRIVACY         0x10
38 
39 #define C_ESSID_ELEMENT_ID               0
40 #define C_ESSID_ELEMENT_MAX_LENGTH       32
41 
42 #define C_SUPPORTED_RATES_ELEMENT_ID     1
43 #define C_SUPPORTED_RATES_ELEMENT_LENGTH 2
44 
45 #define C_FH_PARAM_SET_ELEMENT_ID        2
46 #define C_FH_PARAM_SET_ELEMENT_LNGTH     5
47 
48 #define C_CF_PARAM_SET_ELEMENT_ID        4
49 #define C_CF_PARAM_SET_ELEMENT_LNGTH     6
50 
51 #define C_TIM_ELEMENT_ID                 5
52 #define C_TIM_BITMAP_LENGTH            251
53 #define C_TIM_BMCAST_BIT              0x01
54 
55 #define C_IBSS_ELEMENT_ID                6
56 #define C_IBSS_ELEMENT_LENGTH            2
57 
58 #define C_JAPAN_CALL_SIGN_ELEMENT_ID    51
59 #define C_JAPAN_CALL_SIGN_ELEMENT_LNGTH 12
60 
61 #define C_DISASSOC_REASON_CODE_LEN       2
62 #define C_DISASSOC_REASON_CODE_DEFAULT   8
63 
64 #define C_CRC_LEN                        4
65 #define C_NUM_SUPPORTED_RATES            8
66 /****** IEEE 802.11 mac header for type data packets *************************/
67 struct mac_header {
68   UCHAR frame_ctl_1;
69   UCHAR frame_ctl_2;
70   UCHAR duration_lsb;
71   UCHAR duration_msb;
72   UCHAR addr_1[ADDRLEN];
73   UCHAR addr_2[ADDRLEN];
74   UCHAR addr_3[ADDRLEN];
75   UCHAR seq_frag_num[2];
76 /*  UCHAR addr_4[ADDRLEN]; *//* only present for AP to AP (TO DS and FROM DS */
77 };
78 /****** IEEE 802.11 frame element structures *********************************/
79 struct essid_element
80 {
81   UCHAR id;
82   UCHAR length;
83   UCHAR text[C_ESSID_ELEMENT_MAX_LENGTH];
84 };
85 struct rates_element
86 {
87   UCHAR id;
88   UCHAR length;
89   UCHAR value[8];
90 };
91 struct freq_hop_element
92 {
93   UCHAR id;
94   UCHAR length;
95   UCHAR dwell_time[2];
96   UCHAR hop_set;
97   UCHAR hop_pattern;
98   UCHAR hop_index;
99 };
100 struct tim_element
101 {
102   UCHAR id;
103   UCHAR length;
104   UCHAR dtim_count;
105   UCHAR dtim_period;
106   UCHAR bitmap_control;
107   UCHAR tim[C_TIM_BITMAP_LENGTH];
108 };
109 struct ibss_element
110 {
111   UCHAR id;
112   UCHAR length;
113   UCHAR atim_window[2];
114 };
115 struct japan_call_sign_element
116 {
117   UCHAR id;
118   UCHAR length;
119   UCHAR call_sign[12];
120 };
121 /****** Beacon message structures ********************************************/
122 /* .elements is a large lump of max size because elements are variable size  */
123 struct infra_beacon
124 {
125     UCHAR timestamp[8];
126     UCHAR beacon_intvl[2];
127     UCHAR capability[2];
128     UCHAR elements[sizeof(struct essid_element)
129                   + sizeof(struct rates_element)
130                   + sizeof(struct freq_hop_element)
131                   + sizeof(struct japan_call_sign_element)
132                   + sizeof(struct tim_element)];
133 };
134 struct adhoc_beacon
135 {
136     UCHAR timestamp[8];
137     UCHAR beacon_intvl[2];
138     UCHAR capability[2];
139     UCHAR elements[sizeof(struct essid_element)
140                   + sizeof(struct rates_element)
141                   + sizeof(struct freq_hop_element)
142                   + sizeof(struct japan_call_sign_element)
143                   + sizeof(struct ibss_element)];
144 };
145 /*****************************************************************************/
146 /*****************************************************************************/
147 /* #define C_MAC_HDR_2_WEP 0x40 */
148 /* TX/RX CCS constants */
149 #define TX_HEADER_LENGTH 0x1C
150 #define RX_MAC_HEADER_LENGTH 0x18
151 #define TX_AUTHENTICATE_LENGTH (TX_HEADER_LENGTH + 6)
152 #define TX_AUTHENTICATE_LENGTH_MSB (TX_AUTHENTICATE_LENGTH >> 8)
153 #define TX_AUTHENTICATE_LENGTH_LSB (TX_AUTHENTICATE_LENGTH & 0xff)
154 #define TX_DEAUTHENTICATE_LENGTH (TX_HEADER_LENGTH + 2)
155 #define TX_DEAUTHENTICATE_LENGTH_MSB (TX_AUTHENTICATE_LENGTH >> 8)
156 #define TX_DEAUTHENTICATE_LENGTH_LSB (TX_AUTHENTICATE_LENGTH & 0xff)
157 #define FCS_LEN           4
158 
159 #define ADHOC                 0
160 #define INFRA                 1
161 
162 #define TYPE_STA              0
163 #define TYPE_AP               1
164 
165 #define PASSIVE_SCAN          1
166 #define ACTIVE_SCAN           1
167 
168 #define PSM_CAM               0
169 
170 /* Country codes */
171 #define USA                   1
172 #define EUROPE                2
173 #define JAPAN                 3
174 #define KOREA                 4
175 #define SPAIN                 5
176 #define FRANCE                6
177 #define ISRAEL                7
178 #define AUSTRALIA             8
179 #define JAPAN_TEST            9
180 
181 /* Hop pattern lengths */
182 #define USA_HOP_MOD          79
183 #define EUROPE_HOP_MOD       79
184 #define JAPAN_HOP_MOD        23
185 #define KOREA_HOP_MOD        23
186 #define SPAIN_HOP_MOD        27
187 #define FRANCE_HOP_MOD       35
188 #define ISRAEL_HOP_MOD       35
189 #define AUSTRALIA_HOP_MOD    47
190 #define JAPAN_TEST_HOP_MOD   23
191 
192 #define ESSID_SIZE           32
193 /**********************************************************************/
194 /* CIS Register Constants */
195 #define CIS_OFFSET             0x0f00
196 /* Configuration Option Register (0x0F00) */
197 #define COR_OFFSET             0x00
198 #define COR_SOFT_RESET         0x80
199 #define COR_LEVEL_IRQ          0x40
200 #define COR_CONFIG_NUM         0x01
201 #define COR_DEFAULT            (COR_LEVEL_IRQ | COR_CONFIG_NUM)
202 
203 /* Card Configuration and Status Register (0x0F01) */
204 #define CCSR_OFFSET            0x01
205 #define CCSR_HOST_INTR_PENDING 0x01
206 #define CCSR_POWER_DOWN        0x04
207 
208 /* HCS Interrupt Register (0x0F05) */
209 #define HCS_INTR_OFFSET        0x05
210 /* #define HCS_INTR_OFFSET        0x0A */
211 #define HCS_INTR_CLEAR         0x00
212 
213 /* ECF Interrupt Register (0x0F06) */
214 #define ECF_INTR_OFFSET        0x06
215 /* #define ECF_INTR_OFFSET        0x0C */
216 #define ECF_INTR_SET           0x01
217 
218 /* Authorization Register 0 (0x0F08) */
219 #define AUTH_0_ON              0x57
220 
221 /* Authorization Register 1 (0x0F09) */
222 #define AUTH_1_ON              0x82
223 
224 /* Program Mode Register (0x0F0A) */
225 #define PC2PM                  0x02
226 #define PC2CAL                 0x10
227 #define PC2MLSE                0x20
228 
229 /* PC Test Mode Register (0x0F0B) */
230 #define PC_TEST_MODE           0x08
231 
232 /* Frequency Control Word (0x0F10) */
233 /* Range 0x02 - 0xA6 */
234 
235 /* Test Mode Control 1-4 (0x0F14 - 0x0F17) */
236 
237 /**********************************************************************/
238 
239 /* Shared RAM Area */
240 #define SCB_BASE               0x0000
241 #define STATUS_BASE            0x0100
242 #define HOST_TO_ECF_BASE       0x0200
243 #define ECF_TO_HOST_BASE       0x0300
244 #define CCS_BASE               0x0400
245 #define RCS_BASE               0x0800
246 #define INFRA_TIM_BASE         0x0C00
247 #define SSID_LIST_BASE         0x0D00
248 #define TX_BUF_BASE            0x1000
249 #define RX_BUF_BASE            0x8000
250 
251 #define NUMBER_OF_CCS    64
252 #define NUMBER_OF_RCS    64
253 /*#define NUMBER_OF_TX_CCS 14 */
254 #define NUMBER_OF_TX_CCS 14
255 
256 #define TX_BUF_SIZE      (2048 - sizeof(struct tx_msg))
257 #define RX_BUFF_END      0x3FFF
258 /* Values for buffer_status */
259 #define CCS_BUFFER_FREE       0
260 #define CCS_BUFFER_BUSY       1
261 #define CCS_COMMAND_COMPLETE  2
262 #define CCS_COMMAND_FAILED    3
263 
264 /* Values for cmd */
265 #define CCS_DOWNLOAD_STARTUP_PARAMS    1
266 #define CCS_UPDATE_PARAMS              2
267 #define CCS_REPORT_PARAMS              3
268 #define CCS_UPDATE_MULTICAST_LIST      4
269 #define CCS_UPDATE_POWER_SAVINGS_MODE  5
270 #define CCS_START_NETWORK              6
271 #define CCS_JOIN_NETWORK               7
272 #define CCS_START_ASSOCIATION          8
273 #define CCS_TX_REQUEST                 9
274 #define CCS_TEST_MEMORY              0xa
275 #define CCS_SHUTDOWN                 0xb
276 #define CCS_DUMP_MEMORY              0xc
277 #define CCS_START_TIMER              0xe
278 #define CCS_LAST_CMD                 CCS_START_TIMER
279 
280 /* Values for link field */
281 #define CCS_END_LIST                 0xff
282 
283 /* values for buffer_status field */
284 #define RCS_BUFFER_FREE       0
285 #define RCS_BUFFER_BUSY       1
286 #define RCS_COMPLETE          2
287 #define RCS_FAILED            3
288 #define RCS_BUFFER_RELEASE    0xFF
289 
290 /* values for interrupt_id field */
291 #define PROCESS_RX_PACKET           0x80 /* */
292 #define REJOIN_NET_COMPLETE         0x81 /* RCS ID: Rejoin Net Complete */
293 #define ROAMING_INITIATED           0x82 /* RCS ID: Roaming Initiated   */
294 #define JAPAN_CALL_SIGN_RXD         0x83 /* RCS ID: New Japan Call Sign */
295 
296 /*****************************************************************************/
297 /* Memory types for dump memory command */
298 #define C_MEM_PROG  0
299 #define C_MEM_XDATA 1
300 #define C_MEM_SFR   2
301 #define C_MEM_IDATA 3
302 
303 /*** Return values for hw_xmit **********/
304 #define XMIT_OK        (0)
305 #define XMIT_MSG_BAD   (-1)
306 #define XMIT_NO_CCS    (-2)
307 #define XMIT_NO_INTR   (-3)
308 #define XMIT_NEED_AUTH (-4)
309 
310 /*** Values for card status */
311 #define CARD_INSERTED       (0)
312 
313 #define CARD_AWAITING_PARAM (1)
314 #define CARD_INIT_ERROR     (11)
315 
316 #define CARD_DL_PARAM       (2)
317 #define CARD_DL_PARAM_ERROR (12)
318 
319 #define CARD_DOING_ACQ      (3)
320 
321 #define CARD_ACQ_COMPLETE   (4)
322 #define CARD_ACQ_FAILED     (14)
323 
324 #define CARD_AUTH_COMPLETE  (5)
325 #define CARD_AUTH_REFUSED   (15)
326 
327 #define CARD_ASSOC_COMPLETE (6)
328 #define CARD_ASSOC_FAILED   (16)
329 
330 /*** Values for authentication_state ***********************************/
331 #define UNAUTHENTICATED     (0)
332 #define AWAITING_RESPONSE   (1)
333 #define AUTHENTICATED       (2)
334 #define NEED_TO_AUTH        (3)
335 
336 /*** Values for authentication type ************************************/
337 #define OPEN_AUTH_REQUEST   (1)
338 #define OPEN_AUTH_RESPONSE  (2)
339 #define BROADCAST_DEAUTH    (0xc0)
340 /*** Values for timer functions ****************************************/
341 #define TODO_NOTHING              (0)
342 #define TODO_VERIFY_DL_START      (-1)
343 #define TODO_START_NET            (-2)
344 #define TODO_JOIN_NET             (-3)
345 #define TODO_AUTHENTICATE_TIMEOUT (-4)
346 #define TODO_SEND_CCS             (-5)
347 /***********************************************************************/
348 /* Parameter passing structure for update/report parameter CCS's */
349 struct object_id {
350     void          *object_addr;
351     unsigned char object_length;
352 };
353 
354 #define OBJID_network_type            0
355 #define OBJID_acting_as_ap_status     1
356 #define OBJID_current_ess_id          2
357 #define OBJID_scanning_mode           3
358 #define OBJID_power_mgt_state         4
359 #define OBJID_mac_address             5
360 #define OBJID_frag_threshold          6
361 #define OBJID_hop_time                7
362 #define OBJID_beacon_period           8
363 #define OBJID_dtim_period             9
364 #define OBJID_retry_max              10
365 #define OBJID_ack_timeout            11
366 #define OBJID_sifs                   12
367 #define OBJID_difs                   13
368 #define OBJID_pifs                   14
369 #define OBJID_rts_threshold          15
370 #define OBJID_scan_dwell_time        16
371 #define OBJID_max_scan_dwell_time    17
372 #define OBJID_assoc_resp_timeout     18
373 #define OBJID_adhoc_scan_cycle_max   19
374 #define OBJID_infra_scan_cycle_max   20
375 #define OBJID_infra_super_cycle_max  21
376 #define OBJID_promiscuous_mode       22
377 #define OBJID_unique_word            23
378 #define OBJID_slot_time              24
379 #define OBJID_roaming_low_snr        25
380 #define OBJID_low_snr_count_thresh   26
381 #define OBJID_infra_missed_bcn       27
382 #define OBJID_adhoc_missed_bcn       28
383 #define OBJID_curr_country_code      29
384 #define OBJID_hop_pattern            30
385 #define OBJID_reserved               31
386 #define OBJID_cw_max_msb             32
387 #define OBJID_cw_min_msb             33
388 #define OBJID_noise_filter_gain      34
389 #define OBJID_noise_limit_offset     35
390 #define OBJID_det_rssi_thresh_offset 36
391 #define OBJID_med_busy_thresh_offset 37
392 #define OBJID_det_sync_thresh        38
393 #define OBJID_test_mode              39
394 #define OBJID_test_min_chan_num      40
395 #define OBJID_test_max_chan_num      41
396 #define OBJID_allow_bcast_ID_prbrsp  42
397 #define OBJID_privacy_must_start     43
398 #define OBJID_privacy_can_join       44
399 #define OBJID_basic_rate_set         45
400 
401 /**** Configuration/Status/Control Area ***************************/
402 /*    System Control Block (SCB) Area
403  *    Located at Shared RAM offset 0
404  */
405 struct scb {
406     UCHAR ccs_index;
407     UCHAR rcs_index;
408 };
409 
410 /****** Status area at Shared RAM offset 0x0100 ******************************/
411 struct status {
412     UCHAR mrx_overflow_for_host;         /* 0=ECF may write, 1=host may write*/
413     UCHAR mrx_checksum_error_for_host;   /* 0=ECF may write, 1=host may write*/
414     UCHAR rx_hec_error_for_host;         /* 0=ECF may write, 1=host may write*/
415     UCHAR reserved1;
416     short mrx_overflow;                  /* ECF increments on rx overflow    */
417     short mrx_checksum_error;            /* ECF increments on rx CRC error   */
418     short rx_hec_error;                  /* ECF incs on mac header CRC error */
419     UCHAR rxnoise;                       /* Average RSL measurement          */
420 };
421 
422 /****** Host-to-ECF Data Area at Shared RAM offset 0x200 *********************/
423 struct host_to_ecf_area {
424 
425 };
426 
427 /****** ECF-to-Host Data Area at Shared RAM offset 0x0300 ********************/
428 struct startup_res_518 {
429     UCHAR startup_word;
430     UCHAR station_addr[ADDRLEN];
431     UCHAR calc_prog_chksum;
432     UCHAR calc_cis_chksum;
433     UCHAR ecf_spare[7];
434     UCHAR japan_call_sign[12];
435 };
436 
437 struct startup_res_6 {
438     UCHAR startup_word;
439     UCHAR station_addr[ADDRLEN];
440     UCHAR reserved;
441     UCHAR supp_rates[8];
442     UCHAR japan_call_sign[12];
443     UCHAR calc_prog_chksum;
444     UCHAR calc_cis_chksum;
445     UCHAR firmware_version[3];
446     UCHAR asic_version;
447     UCHAR tib_length;
448 };
449 
450 struct start_join_net_params {
451     UCHAR net_type;
452     UCHAR ssid[ESSID_SIZE];
453     UCHAR reserved;
454     UCHAR privacy_can_join;
455 };
456 
457 /****** Command Control Structure area at Shared ram offset 0x0400 ***********/
458 /* Structures for command specific parameters (ccs.var) */
459 struct update_param_cmd {
460     UCHAR object_id;
461     UCHAR number_objects;
462     UCHAR failure_cause;
463 };
464 struct report_param_cmd {
465     UCHAR object_id;
466     UCHAR number_objects;
467     UCHAR failure_cause;
468     UCHAR length;
469 };
470 struct start_network_cmd {
471     UCHAR update_param;
472     UCHAR bssid[ADDRLEN];
473     UCHAR net_initiated;
474     UCHAR net_default_tx_rate;
475     UCHAR encryption;
476 };
477 struct join_network_cmd {
478     UCHAR update_param;
479     UCHAR bssid[ADDRLEN];
480     UCHAR net_initiated;
481     UCHAR net_default_tx_rate;
482     UCHAR encryption;
483 };
484 struct tx_requested_cmd {
485 
486     UCHAR tx_data_ptr[2];
487     UCHAR tx_data_length[2];
488     UCHAR host_reserved[2];
489     UCHAR reserved[3];
490     UCHAR tx_rate;
491     UCHAR pow_sav_mode;
492     UCHAR retries;
493     UCHAR antenna;
494 };
495 struct tx_requested_cmd_4 {
496 
497     UCHAR tx_data_ptr[2];
498     UCHAR tx_data_length[2];
499     UCHAR dest_addr[ADDRLEN];
500     UCHAR pow_sav_mode;
501     UCHAR retries;
502     UCHAR station_id;
503 };
504 struct memory_dump_cmd {
505     UCHAR memory_type;
506     UCHAR memory_ptr[2];
507     UCHAR length;
508 };
509 struct update_association_cmd {
510     UCHAR status;
511     UCHAR aid[2];
512 };
513 struct start_timer_cmd {
514     UCHAR duration[2];
515 };
516 
517 struct ccs {
518     UCHAR buffer_status;                 /* 0 = buffer free, 1 = buffer busy */
519                                          /* 2 = command complete, 3 = failed */
520     UCHAR cmd;                           /* command to ECF                   */
521     UCHAR link;                          /* link to next CCS, FF=end of list */
522     /* command specific parameters      */
523     union {
524         char reserved[13];
525         struct update_param_cmd update_param;
526         struct report_param_cmd report_param;
527         UCHAR nummulticast;
528         UCHAR mode;
529         struct start_network_cmd start_network;
530         struct join_network_cmd join_network;
531         struct tx_requested_cmd tx_request;
532         struct memory_dump_cmd memory_dump;
533         struct update_association_cmd update_assoc;
534         struct start_timer_cmd start_timer;
535     } var;
536 };
537 
538 /*****************************************************************************/
539 /* Transmit buffer structures */
540 struct tib_structure {
541     UCHAR ccs_index;
542     UCHAR psm;
543     UCHAR pass_fail;
544     UCHAR retry_count;
545     UCHAR max_retries;
546     UCHAR frags_remaining;
547     UCHAR no_rb;
548     UCHAR rts_reqd;
549     UCHAR csma_tx_cntrl_2;
550     UCHAR sifs_tx_cntrl_2;
551     UCHAR tx_dma_addr_1[2];
552     UCHAR tx_dma_addr_2[2];
553     UCHAR var_dur_2mhz[2];
554     UCHAR var_dur_1mhz[2];
555     UCHAR max_dur_2mhz[2];
556     UCHAR max_dur_1mhz[2];
557     UCHAR hdr_len;
558     UCHAR max_frag_len[2];
559     UCHAR var_len[2];
560     UCHAR phy_hdr_4;
561     UCHAR mac_hdr_1;
562     UCHAR mac_hdr_2;
563     UCHAR sid[2];
564 };
565 
566 struct phy_header {
567     UCHAR sfd[2];
568     UCHAR hdr_3;
569     UCHAR hdr_4;
570 };
571 struct ray_rx_msg {
572     struct mac_header mac;
573 	UCHAR	var[];
574 };
575 
576 struct tx_msg {
577     struct tib_structure tib;
578     struct phy_header phy;
579     struct mac_header mac;
580     UCHAR  var[1];
581 };
582 
583 /****** ECF Receive Control Structure (RCS) Area at Shared RAM offset 0x0800  */
584 /* Structures for command specific parameters (rcs.var) */
585 struct rx_packet_cmd {
586     UCHAR rx_data_ptr[2];
587     UCHAR rx_data_length[2];
588     UCHAR rx_sig_lev;
589     UCHAR next_frag_rcs_index;
590     UCHAR totalpacketlength[2];
591 };
592 struct rejoin_net_cmplt_cmd {
593     UCHAR reserved;
594     UCHAR bssid[ADDRLEN];
595 };
596 struct japan_call_sign_rxd {
597     UCHAR rxd_call_sign[8];
598     UCHAR reserved[5];
599 };
600 
601 struct rcs {
602     UCHAR buffer_status;
603     UCHAR interrupt_id;
604     UCHAR link_field;
605     /* command specific parameters      */
606     union {
607         UCHAR reserved[13];
608         struct rx_packet_cmd rx_packet;
609         struct rejoin_net_cmplt_cmd rejoin_net_complete;
610         struct japan_call_sign_rxd japan_call_sign;
611     } var;
612 };
613 
614 /****** Startup parameter structures for both versions of firmware ***********/
615 struct b4_startup_params {
616     UCHAR a_network_type;                /* C_ADHOC, C_INFRA                 */
617     UCHAR a_acting_as_ap_status;         /* C_TYPE_STA, C_TYPE_AP            */
618     UCHAR a_current_ess_id[ESSID_SIZE];  /* Null terminated unless 32 long   */
619     UCHAR a_scanning_mode;               /* passive 0, active 1              */
620     UCHAR a_power_mgt_state;             /* CAM 0,                           */
621     UCHAR a_mac_addr[ADDRLEN];           /*                                  */
622     UCHAR a_frag_threshold[2];           /* 512                              */
623     UCHAR a_hop_time[2];                 /* 16k * 2**n, n=0-4 in Kus         */
624     UCHAR a_beacon_period[2];            /* n * a_hop_time  in Kus           */
625     UCHAR a_dtim_period;                 /* in beacons                       */
626     UCHAR a_retry_max;                   /*                                  */
627     UCHAR a_ack_timeout;                 /*                                  */
628     UCHAR a_sifs;                        /*                                  */
629     UCHAR a_difs;                        /*                                  */
630     UCHAR a_pifs;                        /*                                  */
631     UCHAR a_rts_threshold[2];            /*                                  */
632     UCHAR a_scan_dwell_time[2];          /*                                  */
633     UCHAR a_max_scan_dwell_time[2];      /*                                  */
634     UCHAR a_assoc_resp_timeout_thresh;   /*                                  */
635     UCHAR a_adhoc_scan_cycle_max;        /*                                  */
636     UCHAR a_infra_scan_cycle_max;        /*                                  */
637     UCHAR a_infra_super_scan_cycle_max;  /*                                  */
638     UCHAR a_promiscuous_mode;            /*                                  */
639     UCHAR a_unique_word[2];              /*                                  */
640     UCHAR a_slot_time;                   /*                                  */
641     UCHAR a_roaming_low_snr_thresh;      /*                                  */
642     UCHAR a_low_snr_count_thresh;        /*                                  */
643     UCHAR a_infra_missed_bcn_thresh;     /*                                  */
644     UCHAR a_adhoc_missed_bcn_thresh;     /*                                  */
645     UCHAR a_curr_country_code;           /* C_USA                            */
646     UCHAR a_hop_pattern;                 /*                                  */
647     UCHAR a_hop_pattern_length;          /*                                  */
648 /* b4 - b5 differences start here */
649     UCHAR a_cw_max;                      /*                                  */
650     UCHAR a_cw_min;                      /*                                  */
651     UCHAR a_noise_filter_gain;           /*                                  */
652     UCHAR a_noise_limit_offset;          /*                                  */
653     UCHAR a_det_rssi_thresh_offset;      /*                                  */
654     UCHAR a_med_busy_thresh_offset;      /*                                  */
655     UCHAR a_det_sync_thresh;             /*                                  */
656     UCHAR a_test_mode;                   /*                                  */
657     UCHAR a_test_min_chan_num;           /*                                  */
658     UCHAR a_test_max_chan_num;           /*                                  */
659     UCHAR a_rx_tx_delay;                 /*                                  */
660     UCHAR a_current_bss_id[ADDRLEN];     /*                                  */
661     UCHAR a_hop_set;                     /*                                  */
662 };
663 struct b5_startup_params {
664     UCHAR a_network_type;                /* C_ADHOC, C_INFRA                 */
665     UCHAR a_acting_as_ap_status;         /* C_TYPE_STA, C_TYPE_AP            */
666     UCHAR a_current_ess_id[ESSID_SIZE];  /* Null terminated unless 32 long   */
667     UCHAR a_scanning_mode;               /* passive 0, active 1              */
668     UCHAR a_power_mgt_state;             /* CAM 0,                           */
669     UCHAR a_mac_addr[ADDRLEN];           /*                                  */
670     UCHAR a_frag_threshold[2];           /* 512                              */
671     UCHAR a_hop_time[2];                 /* 16k * 2**n, n=0-4 in Kus         */
672     UCHAR a_beacon_period[2];            /* n * a_hop_time  in Kus           */
673     UCHAR a_dtim_period;                 /* in beacons                       */
674     UCHAR a_retry_max;                   /* 4                                */
675     UCHAR a_ack_timeout;                 /*                                  */
676     UCHAR a_sifs;                        /*                                  */
677     UCHAR a_difs;                        /*                                  */
678     UCHAR a_pifs;                        /*                                  */
679     UCHAR a_rts_threshold[2];            /*                                  */
680     UCHAR a_scan_dwell_time[2];          /*                                  */
681     UCHAR a_max_scan_dwell_time[2];      /*                                  */
682     UCHAR a_assoc_resp_timeout_thresh;   /*                                  */
683     UCHAR a_adhoc_scan_cycle_max;        /*                                  */
684     UCHAR a_infra_scan_cycle_max;        /*                                  */
685     UCHAR a_infra_super_scan_cycle_max;  /*                                  */
686     UCHAR a_promiscuous_mode;            /*                                  */
687     UCHAR a_unique_word[2];              /*                                  */
688     UCHAR a_slot_time;                   /*                                  */
689     UCHAR a_roaming_low_snr_thresh;      /*                                  */
690     UCHAR a_low_snr_count_thresh;        /*                                  */
691     UCHAR a_infra_missed_bcn_thresh;     /*                                  */
692     UCHAR a_adhoc_missed_bcn_thresh;     /*                                  */
693     UCHAR a_curr_country_code;           /* C_USA                            */
694     UCHAR a_hop_pattern;                 /*                                  */
695     UCHAR a_hop_pattern_length;          /*                                  */
696 /* b4 - b5 differences start here */
697     UCHAR a_cw_max[2];                   /*                                  */
698     UCHAR a_cw_min[2];                   /*                                  */
699     UCHAR a_noise_filter_gain;           /*                                  */
700     UCHAR a_noise_limit_offset;          /*                                  */
701     UCHAR a_det_rssi_thresh_offset;      /*                                  */
702     UCHAR a_med_busy_thresh_offset;      /*                                  */
703     UCHAR a_det_sync_thresh;             /*                                  */
704     UCHAR a_test_mode;                   /*                                  */
705     UCHAR a_test_min_chan_num;           /*                                  */
706     UCHAR a_test_max_chan_num;           /*                                  */
707     UCHAR a_allow_bcast_SSID_probe_rsp;
708     UCHAR a_privacy_must_start;
709     UCHAR a_privacy_can_join;
710     UCHAR a_basic_rate_set[8];
711 };
712 
713 /*****************************************************************************/
714 #define RAY_IOCG_PARMS (SIOCDEVPRIVATE)
715 #define RAY_IOCS_PARMS (SIOCDEVPRIVATE + 1)
716 #define RAY_DO_CMD     (SIOCDEVPRIVATE + 2)
717 
718 /****** ethernet <-> 802.11 translation **************************************/
719 typedef struct snaphdr_t
720 {
721   UCHAR   dsap;
722   UCHAR   ssap;
723   UCHAR   ctrl;
724   UCHAR   org[3];
725   UCHAR   ethertype[2];
726 } snaphdr_t;
727 
728 #define BRIDGE_ENCAP  0xf80000
729 #define RFC1042_ENCAP 0
730 #define SNAP_ID       0x0003aaaa
731 #define RAY_IPX_TYPE  0x8137
732 #define APPLEARP_TYPE 0x80f3
733 /*****************************************************************************/
734 #endif /* _RAYCTL_H_ */
735