Blame view

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