summaryrefslogtreecommitdiff
path: root/drivers/net/wireless/bcmdhd/include/wlioctl.h
blob: 5ec0c9ade1975ed783cee40110a170c5ecb181fd (plain)
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
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
/*
 * Custom OID/ioctl definitions for
 * Broadcom 802.11abg Networking Device Driver
 *
 * Definitions subject to change without notice.
 *
 * Copyright (C) 1999-2011, Broadcom Corporation
 * 
 *         Unless you and Broadcom execute a separate written software license
 * agreement governing use of this software, this software is licensed to you
 * under the terms of the GNU General Public License version 2 (the "GPL"),
 * available at http://www.broadcom.com/licenses/GPLv2.php, with the
 * following added to such license:
 * 
 *      As a special exception, the copyright holders of this software give you
 * permission to link this software with independent modules, and to copy and
 * distribute the resulting executable under terms of your choice, provided that
 * you also meet, for each linked independent module, the terms and conditions of
 * the license of that module.  An independent module is a module which is not
 * derived from this software.  The special exception does not apply to any
 * modifications of the software.
 * 
 *      Notwithstanding the above, under no circumstances may you combine this
 * software in any way with any other Broadcom software provided under a license
 * other than the GPL, without Broadcom's express prior written consent.
 *
 * $Id: wlioctl.h 331292 2012-05-04 09:04:23Z $
 */


#ifndef _wlioctl_h_
#define _wlioctl_h_

#include <typedefs.h>
#include <proto/ethernet.h>
#include <proto/bcmeth.h>
#include <proto/bcmevent.h>
#include <proto/802.11.h>
#include <bcmwifi.h>

#include <bcmcdc.h>

#ifndef INTF_NAME_SIZ
#define INTF_NAME_SIZ   16
#endif


typedef struct remote_ioctl {
	cdc_ioctl_t     msg;
	uint        data_len;
	char            intf_name[INTF_NAME_SIZ];
} rem_ioctl_t;
#define REMOTE_SIZE sizeof(rem_ioctl_t)

#define ACTION_FRAME_SIZE 1040

typedef struct wl_action_frame {
	struct ether_addr   da;
	uint16          len;
	uint32          packetId;
	uint8           data[ACTION_FRAME_SIZE];
} wl_action_frame_t;

#define WL_WIFI_ACTION_FRAME_SIZE sizeof(struct wl_action_frame)

typedef struct ssid_info
{
	uint8		ssid_len;	
	uint8		ssid[32];	
} ssid_info_t;

typedef struct wl_af_params {
	uint32          channel;
	int32           dwell_time;
	struct ether_addr   BSSID;
	wl_action_frame_t   action_frame;
} wl_af_params_t;

#define WL_WIFI_AF_PARAMS_SIZE sizeof(struct wl_af_params)


#define BWL_DEFAULT_PACKING
#include <packed_section_start.h>





#define LEGACY2_WL_BSS_INFO_VERSION 108     


typedef struct wl_bss_info_108 {
	uint32      version;        
	uint32      length;         
	struct ether_addr BSSID;
	uint16      beacon_period;      
	uint16      capability;     
	uint8       SSID_len;
	uint8       SSID[32];
	struct {
		uint    count;          
		uint8   rates[16];      
	} rateset;              
	chanspec_t  chanspec;       
	uint16      atim_window;        
	uint8       dtim_period;        
	int16       RSSI;           
	int8        phy_noise;      

	uint8       n_cap;          
	uint32      nbss_cap;       
	uint8       ctl_ch;         
	uint32      reserved32[1];      
	uint8       flags;          
	uint8       reserved[3];        
	uint8       basic_mcs[MCSSET_LEN];  

	uint16      ie_offset;      
	uint32      ie_length;      
	
	
} wl_bss_info_108_t;

#define WL_BSS_INFO_VERSION 109     


typedef struct wl_bss_info {
	uint32      version;        
	uint32      length;         
	struct ether_addr BSSID;
	uint16      beacon_period;      
	uint16      capability;     
	uint8       SSID_len;
	uint8       SSID[32];
	struct {
		uint    count;          
		uint8   rates[16];      
	} rateset;              
	chanspec_t  chanspec;       
	uint16      atim_window;        
	uint8       dtim_period;        
	int16       RSSI;           
	int8        phy_noise;      

	uint8       n_cap;          
	uint32      nbss_cap;       
	uint8       ctl_ch;         
	uint32      reserved32[1];      
	uint8       flags;          
	uint8       reserved[3];        
	uint8       basic_mcs[MCSSET_LEN];  

	uint16      ie_offset;      
	uint32      ie_length;      
	int16       SNR;            
	
	
} wl_bss_info_t;

typedef struct wl_bsscfg {
	uint32  wsec;
	uint32  WPA_auth;
	uint32  wsec_index;
	uint32  associated;
	uint32  BSS;
	uint32  phytest_on;
	struct ether_addr   prev_BSSID;
	struct ether_addr   BSSID;
} wl_bsscfg_t;

typedef struct wl_bss_config {
	uint32  atim_window;
	uint32  beacon_period;
	uint32  chanspec;
} wl_bss_config_t;


typedef struct wlc_ssid {
	uint32      SSID_len;
	uchar       SSID[32];
} wlc_ssid_t;


#define WL_BSSTYPE_INFRA 1
#define WL_BSSTYPE_INDEP 0
#define WL_BSSTYPE_ANY   2


#define WL_SCANFLAGS_PASSIVE 0x01       
#define WL_SCANFLAGS_RESERVED 0x02      
#define WL_SCANFLAGS_PROHIBITED 0x04    

#define WL_SCAN_PARAMS_SSID_MAX 	10

typedef struct wl_scan_params {
	wlc_ssid_t ssid;        
	struct ether_addr bssid;    
	int8 bss_type;          
	uint8 scan_type;        
	int32 nprobes;          
	int32 active_time;      
	int32 passive_time;     
	int32 home_time;        
	int32 channel_num;      
	uint16 channel_list[1];     
} wl_scan_params_t;


#define WL_SCAN_PARAMS_FIXED_SIZE 64


#define WL_SCAN_PARAMS_COUNT_MASK 0x0000ffff
#define WL_SCAN_PARAMS_NSSID_SHIFT 16

#define WL_SCAN_ACTION_START      1
#define WL_SCAN_ACTION_CONTINUE   2
#define WL_SCAN_ACTION_ABORT      3

#define ISCAN_REQ_VERSION 1


typedef struct wl_iscan_params {
	uint32 version;
	uint16 action;
	uint16 scan_duration;
	wl_scan_params_t params;
} wl_iscan_params_t;


#define WL_ISCAN_PARAMS_FIXED_SIZE (OFFSETOF(wl_iscan_params_t, params) + sizeof(wlc_ssid_t))

typedef struct wl_scan_results {
	uint32 buflen;
	uint32 version;
	uint32 count;
	wl_bss_info_t bss_info[1];
} wl_scan_results_t;


#define WL_SCAN_RESULTS_FIXED_SIZE (sizeof(wl_scan_results_t) - sizeof(wl_bss_info_t))


#define WL_SCAN_RESULTS_SUCCESS 0
#define WL_SCAN_RESULTS_PARTIAL 1
#define WL_SCAN_RESULTS_PENDING 2
#define WL_SCAN_RESULTS_ABORTED 3
#define WL_SCAN_RESULTS_NO_MEM  4


#define DNGL_RXCTXT_SIZE	45

#if defined(SIMPLE_ISCAN)
#define ISCAN_RETRY_CNT   5
#define ISCAN_STATE_IDLE   0
#define ISCAN_STATE_SCANING 1
#define ISCAN_STATE_PENDING 2


#define WLC_IW_ISCAN_MAXLEN   2048
typedef struct iscan_buf {
	struct iscan_buf * next;
	char   iscan_buf[WLC_IW_ISCAN_MAXLEN];
} iscan_buf_t;
#endif 

#define ESCAN_REQ_VERSION 1

typedef struct wl_escan_params {
	uint32 version;
	uint16 action;
	uint16 sync_id;
	wl_scan_params_t params;
} wl_escan_params_t;

#define WL_ESCAN_PARAMS_FIXED_SIZE (OFFSETOF(wl_escan_params_t, params) + sizeof(wlc_ssid_t))

typedef struct wl_escan_result {
	uint32 buflen;
	uint32 version;
	uint16 sync_id;
	uint16 bss_count;
	wl_bss_info_t bss_info[1];
} wl_escan_result_t;

#define WL_ESCAN_RESULTS_FIXED_SIZE (sizeof(wl_escan_result_t) - sizeof(wl_bss_info_t))


typedef struct wl_iscan_results {
	uint32 status;
	wl_scan_results_t results;
} wl_iscan_results_t;


#define WL_ISCAN_RESULTS_FIXED_SIZE \
	(WL_SCAN_RESULTS_FIXED_SIZE + OFFSETOF(wl_iscan_results_t, results))

typedef struct wl_probe_params {
	wlc_ssid_t ssid;
	struct ether_addr bssid;
	struct ether_addr mac;
} wl_probe_params_t;

#define WL_NUMRATES     16  
typedef struct wl_rateset {
	uint32  count;          
	uint8   rates[WL_NUMRATES]; 
} wl_rateset_t;

typedef struct wl_rateset_args {
	uint32  count;          
	uint8   rates[WL_NUMRATES]; 
	uint8   mcs[MCSSET_LEN];        
} wl_rateset_args_t;


typedef struct wl_uint32_list {
	
	uint32 count;
	
	uint32 element[1];
} wl_uint32_list_t;


typedef struct wl_assoc_params {
	struct ether_addr bssid;    
	uint16 bssid_cnt;       
	int32 chanspec_num;     
	chanspec_t chanspec_list[1];    
} wl_assoc_params_t;
#define WL_ASSOC_PARAMS_FIXED_SIZE  (sizeof(wl_assoc_params_t) - sizeof(chanspec_t))


typedef wl_assoc_params_t wl_reassoc_params_t;
#define WL_REASSOC_PARAMS_FIXED_SIZE    WL_ASSOC_PARAMS_FIXED_SIZE


typedef wl_assoc_params_t wl_join_assoc_params_t;
#define WL_JOIN_ASSOC_PARAMS_FIXED_SIZE        WL_ASSOC_PARAMS_FIXED_SIZE


typedef struct wl_join_params {
	wlc_ssid_t ssid;
	wl_assoc_params_t params;   
} wl_join_params_t;
#define WL_JOIN_PARAMS_FIXED_SIZE   (sizeof(wl_join_params_t) - sizeof(chanspec_t))


typedef struct wl_join_scan_params {
	uint8 scan_type;                
	int32 nprobes;                  
	int32 active_time;              
	int32 passive_time;             
	int32 home_time;                
} wl_join_scan_params_t;


typedef struct wl_extjoin_params {
	wlc_ssid_t ssid;                
	wl_join_scan_params_t scan;
	wl_join_assoc_params_t assoc;   
} wl_extjoin_params_t;
#define WL_EXTJOIN_PARAMS_FIXED_SIZE    (sizeof(wl_extjoin_params_t) - sizeof(chanspec_t))

typedef struct {
	uint32 num;
	chanspec_t list[1];
} chanspec_list_t;


#define NRATE_MCS_INUSE 0x00000080  
#define NRATE_RATE_MASK 0x0000007f  
#define NRATE_STF_MASK  0x0000ff00  
#define NRATE_STF_SHIFT 8       
#define NRATE_OVERRIDE  0x80000000  
#define NRATE_OVERRIDE_MCS_ONLY 0x40000000 
#define NRATE_SGI_MASK  0x00800000      
#define NRATE_SGI_SHIFT 23              
#define NRATE_LDPC_CODING 0x00400000    
#define NRATE_LDPC_SHIFT 22             
#define NRATE_BCMC_OVERRIDE 0x00200000    
#define NRATE_BCMC_SHIFT 21             

#define NRATE_STF_SISO  0       
#define NRATE_STF_CDD   1       
#define NRATE_STF_STBC  2       
#define NRATE_STF_SDM   3       

#define ANTENNA_NUM_1   1       
#define ANTENNA_NUM_2   2
#define ANTENNA_NUM_3   3
#define ANTENNA_NUM_4   4

#define ANT_SELCFG_AUTO     0x80    
#define ANT_SELCFG_MASK     0x33    
#define ANT_SELCFG_MAX      4   
#define ANT_SELCFG_TX_UNICAST   0   
#define ANT_SELCFG_RX_UNICAST   1   
#define ANT_SELCFG_TX_DEF   2   
#define ANT_SELCFG_RX_DEF   3   

#define MAX_STREAMS_SUPPORTED   4   

typedef struct {
	uint8 ant_config[ANT_SELCFG_MAX];   
	uint8 num_antcfg;   
} wlc_antselcfg_t;

#define HIGHEST_SINGLE_STREAM_MCS   7 

#define MAX_CCA_CHANNELS 38 
#define MAX_CCA_SECS     60 

#define IBSS_MED        15  
#define IBSS_HI         25  
#define OBSS_MED        12
#define OBSS_HI         25
#define INTERFER_MED    5
#define INTERFER_HI     10

#define  CCA_FLAG_2G_ONLY       0x01    
#define  CCA_FLAG_5G_ONLY       0x02    
#define  CCA_FLAG_IGNORE_DURATION   0x04    
#define  CCA_FLAGS_PREFER_1_6_11    0x10
#define  CCA_FLAG_IGNORE_INTERFER   0x20 

#define CCA_ERRNO_BAND      1   
#define CCA_ERRNO_DURATION  2   
#define CCA_ERRNO_PREF_CHAN 3   
#define CCA_ERRNO_INTERFER  4   
#define CCA_ERRNO_TOO_FEW   5   

typedef struct {
	uint32 duration;    
	uint32 congest_ibss;    
				
	uint32 congest_obss;    
	uint32 interference;    
	uint32 timestamp;   
} cca_congest_t;

typedef struct {
	chanspec_t chanspec;    
	uint8 num_secs;     
	cca_congest_t  secs[1]; 
} cca_congest_channel_req_t;

#define WLC_CNTRY_BUF_SZ    4       

typedef struct wl_country {
	char country_abbrev[WLC_CNTRY_BUF_SZ];  
	int32 rev;              
	char ccode[WLC_CNTRY_BUF_SZ];       
} wl_country_t;

typedef struct wl_channels_in_country {
	uint32 buflen;
	uint32 band;
	char country_abbrev[WLC_CNTRY_BUF_SZ];
	uint32 count;
	uint32 channel[1];
} wl_channels_in_country_t;

typedef struct wl_country_list {
	uint32 buflen;
	uint32 band_set;
	uint32 band;
	uint32 count;
	char country_abbrev[1];
} wl_country_list_t;

#define WL_NUM_RPI_BINS     8
#define WL_RM_TYPE_BASIC    1
#define WL_RM_TYPE_CCA      2
#define WL_RM_TYPE_RPI      3

#define WL_RM_FLAG_PARALLEL (1<<0)

#define WL_RM_FLAG_LATE     (1<<1)
#define WL_RM_FLAG_INCAPABLE    (1<<2)
#define WL_RM_FLAG_REFUSED  (1<<3)

typedef struct wl_rm_req_elt {
	int8    type;
	int8    flags;
	chanspec_t  chanspec;
	uint32  token;      
	uint32  tsf_h;      
	uint32  tsf_l;      
	uint32  dur;        
} wl_rm_req_elt_t;

typedef struct wl_rm_req {
	uint32  token;      
	uint32  count;      
	void    *cb;        
	void    *cb_arg;    
	wl_rm_req_elt_t req[1]; 
} wl_rm_req_t;
#define WL_RM_REQ_FIXED_LEN OFFSETOF(wl_rm_req_t, req)

typedef struct wl_rm_rep_elt {
	int8    type;
	int8    flags;
	chanspec_t  chanspec;
	uint32  token;      
	uint32  tsf_h;      
	uint32  tsf_l;      
	uint32  dur;        
	uint32  len;        
	uint8   data[1];    
} wl_rm_rep_elt_t;
#define WL_RM_REP_ELT_FIXED_LEN 24  

#define WL_RPI_REP_BIN_NUM 8
typedef struct wl_rm_rpi_rep {
	uint8   rpi[WL_RPI_REP_BIN_NUM];
	int8    rpi_max[WL_RPI_REP_BIN_NUM];
} wl_rm_rpi_rep_t;

typedef struct wl_rm_rep {
	uint32  token;      
	uint32  len;        
	wl_rm_rep_elt_t rep[1]; 
} wl_rm_rep_t;
#define WL_RM_REP_FIXED_LEN 8


typedef enum sup_auth_status {
	
	WLC_SUP_DISCONNECTED = 0,
	WLC_SUP_CONNECTING,
	WLC_SUP_IDREQUIRED,
	WLC_SUP_AUTHENTICATING,
	WLC_SUP_AUTHENTICATED,
	WLC_SUP_KEYXCHANGE,
	WLC_SUP_KEYED,
	WLC_SUP_TIMEOUT,
	WLC_SUP_LAST_BASIC_STATE,

	
	
	WLC_SUP_KEYXCHANGE_WAIT_M1 = WLC_SUP_AUTHENTICATED,
	
	WLC_SUP_KEYXCHANGE_PREP_M2 = WLC_SUP_KEYXCHANGE,
	
	WLC_SUP_KEYXCHANGE_WAIT_M3 = WLC_SUP_LAST_BASIC_STATE,
	WLC_SUP_KEYXCHANGE_PREP_M4, 
	WLC_SUP_KEYXCHANGE_WAIT_G1, 
	WLC_SUP_KEYXCHANGE_PREP_G2  
} sup_auth_status_t;


#define CRYPTO_ALGO_OFF         0
#define CRYPTO_ALGO_WEP1        1
#define CRYPTO_ALGO_TKIP        2
#define CRYPTO_ALGO_WEP128      3
#define CRYPTO_ALGO_AES_CCM     4
#define CRYPTO_ALGO_AES_OCB_MSDU    5
#define CRYPTO_ALGO_AES_OCB_MPDU    6
#define CRYPTO_ALGO_NALG        7
#define CRYPTO_ALGO_PMK			12	

#define WSEC_GEN_MIC_ERROR  0x0001
#define WSEC_GEN_REPLAY     0x0002
#define WSEC_GEN_ICV_ERROR  0x0004

#define WL_SOFT_KEY (1 << 0)    
#define WL_PRIMARY_KEY  (1 << 1)    
#define WL_KF_RES_4 (1 << 4)    
#define WL_KF_RES_5 (1 << 5)    
#define WL_IBSS_PEER_GROUP_KEY  (1 << 6)    

typedef struct wl_wsec_key {
	uint32      index;      
	uint32      len;        
	uint8       data[DOT11_MAX_KEY_SIZE];   
	uint32      pad_1[18];
	uint32      algo;       
	uint32      flags;      
	uint32      pad_2[2];
	int     pad_3;
	int     iv_initialized; 
	int     pad_4;
	
	struct {
		uint32  hi;     
		uint16  lo;     
	} rxiv;
	uint32      pad_5[2];
	struct ether_addr ea;       
} wl_wsec_key_t;

#define WSEC_MIN_PSK_LEN    8
#define WSEC_MAX_PSK_LEN    64


#define WSEC_PASSPHRASE     (1<<0)


typedef struct {
	ushort  key_len;        
	ushort  flags;          
	uint8   key[WSEC_MAX_PSK_LEN];  
} wsec_pmk_t;


#define WEP_ENABLED     0x0001
#define TKIP_ENABLED        0x0002
#define AES_ENABLED     0x0004
#define WSEC_SWFLAG     0x0008
#define SES_OW_ENABLED      0x0040  


#define WPA_AUTH_DISABLED   0x0000  
#define WPA_AUTH_NONE       0x0001  
#define WPA_AUTH_UNSPECIFIED    0x0002  
#define WPA_AUTH_PSK        0x0004  
 
#define WPA2_AUTH_UNSPECIFIED   0x0040  
#define WPA2_AUTH_PSK       0x0080  
#define BRCM_AUTH_PSK           0x0100  
#define BRCM_AUTH_DPT       0x0200  
#define WPA2_AUTH_MFP           0x1000  
#define WPA2_AUTH_TPK		0x2000 	
#define WPA2_AUTH_FT		0x4000 	


#define MAXPMKID        16

typedef struct _pmkid {
	struct ether_addr   BSSID;
	uint8           PMKID[WPA2_PMKID_LEN];
} pmkid_t;

typedef struct _pmkid_list {
	uint32  npmkid;
	pmkid_t pmkid[1];
} pmkid_list_t;

typedef struct _pmkid_cand {
	struct ether_addr   BSSID;
	uint8           preauth;
} pmkid_cand_t;

typedef struct _pmkid_cand_list {
	uint32  npmkid_cand;
	pmkid_cand_t    pmkid_cand[1];
} pmkid_cand_list_t;

typedef struct wl_assoc_info {
	uint32      req_len;
	uint32      resp_len;
	uint32      flags;
	struct dot11_assoc_req req;
	struct ether_addr reassoc_bssid;	
	struct dot11_assoc_resp resp;
} wl_assoc_info_t;


#define WLC_ASSOC_REQ_IS_REASSOC 0x01	


typedef struct {
	uint16          ver;        
	uint16          len;        
	uint16          cap;        
	uint32          flags;      
	uint32          idle;       
	struct ether_addr   ea;     
	wl_rateset_t        rateset;    
	uint32          in;     
	uint32          listen_interval_inms; 
	uint32          tx_pkts;    
	uint32          tx_failures;    
	uint32          rx_ucast_pkts;  
	uint32          rx_mcast_pkts;  
	uint32          tx_rate;    
	uint32          rx_rate;    
	uint32          rx_decrypt_succeeds;    
	uint32          rx_decrypt_failures;    
} sta_info_t;

#define WL_OLD_STAINFO_SIZE OFFSETOF(sta_info_t, tx_pkts)

#define WL_STA_VER      3


#define WL_STA_BRCM     0x1     
#define WL_STA_WME      0x2     
#define WL_STA_ABCAP        0x4
#define WL_STA_AUTHE        0x8     
#define WL_STA_ASSOC        0x10        
#define WL_STA_AUTHO        0x20        
#define WL_STA_WDS      0x40        
#define WL_STA_WDS_LINKUP   0x80        
#define WL_STA_PS       0x100       
#define WL_STA_APSD_BE      0x200       
#define WL_STA_APSD_BK      0x400       
#define WL_STA_APSD_VI      0x800       
#define WL_STA_APSD_VO      0x1000      
#define WL_STA_N_CAP        0x2000      
#define WL_STA_SCBSTATS     0x4000      

#define WL_WDS_LINKUP       WL_STA_WDS_LINKUP   


#define WLC_TXFILTER_OVERRIDE_DISABLED  0
#define WLC_TXFILTER_OVERRIDE_ENABLED   1


typedef struct {
	uint32  val;
	struct ether_addr ea;
} scb_val_t;


typedef struct {
	uint32 code;
	scb_val_t ioctl_args;
} authops_t;


typedef struct channel_info {
	int hw_channel;
	int target_channel;
	int scan_channel;
} channel_info_t;


struct maclist {
	uint count;         
	struct ether_addr ea[1];    
};


typedef struct get_pktcnt {
	uint rx_good_pkt;
	uint rx_bad_pkt;
	uint tx_good_pkt;
	uint tx_bad_pkt;
	uint rx_ocast_good_pkt; 
} get_pktcnt_t;

#define WL_IOCTL_ACTION_GET				0x0
#define WL_IOCTL_ACTION_SET				0x1
#define WL_IOCTL_ACTION_OVL_IDX_MASK	0x1e
#define WL_IOCTL_ACTION_OVL_RSV			0x20
#define WL_IOCTL_ACTION_OVL				0x40
#define WL_IOCTL_ACTION_MASK			0x7e
#define WL_IOCTL_ACTION_OVL_SHIFT		1


typedef struct wl_ioctl {
	uint cmd;   
	void *buf;  
	uint len;   
	uint8 set;		
	uint used;  
	uint needed;    
} wl_ioctl_t;


#define ioctl_subtype   set     
#define ioctl_pid   used        
#define ioctl_status    needed      


typedef struct wlc_rev_info {
	uint        vendorid;   
	uint        deviceid;   
	uint        radiorev;   
	uint        chiprev;    
	uint        corerev;    
	uint        boardid;    
	uint        boardvendor;    
	uint        boardrev;   
	uint        driverrev;  
	uint        ucoderev;   
	uint        bus;        
	uint        chipnum;    
	uint        phytype;    
	uint        phyrev;     
	uint        anarev;     
	uint        chippkg;    
} wlc_rev_info_t;

#define WL_REV_INFO_LEGACY_LENGTH   48

#define WL_BRAND_MAX 10
typedef struct wl_instance_info {
	uint instance;
	char brand[WL_BRAND_MAX];
} wl_instance_info_t;


typedef struct wl_txfifo_sz {
	uint16  magic;
	uint16  fifo;
	uint16  size;
} wl_txfifo_sz_t;

#define WL_TXFIFO_SZ_MAGIC  0xa5a5



#define WLC_IOV_NAME_LEN 30
typedef struct wlc_iov_trx_s {
	uint8 module;
	uint8 type;
	char name[WLC_IOV_NAME_LEN];
} wlc_iov_trx_t;


#define WLC_IOCTL_MAGIC     0x14e46c77


#define WLC_IOCTL_VERSION   1

#define WLC_IOCTL_MAXLEN        8192    
#define WLC_IOCTL_SMLEN         256 
#define WLC_IOCTL_MEDLEN        1536    
#ifdef WLC_HIGH_ONLY
#define WLC_SAMPLECOLLECT_MAXLEN    1024    
#define WLC_SAMPLECOLLECT_MAXLEN_LCN40  1024
#else
#if defined(LCNCONF) || defined(LCN40CONF)
#define WLC_SAMPLECOLLECT_MAXLEN	8192	
#else
#define WLC_SAMPLECOLLECT_MAXLEN	10240	
#endif
#define WLC_SAMPLECOLLECT_MAXLEN_LCN40  8192
#endif 


#define WLC_GET_MAGIC               0
#define WLC_GET_VERSION             1
#define WLC_UP                  2
#define WLC_DOWN                3
#define WLC_GET_LOOP                4
#define WLC_SET_LOOP                5
#define WLC_DUMP                6
#define WLC_GET_MSGLEVEL            7
#define WLC_SET_MSGLEVEL            8
#define WLC_GET_PROMISC             9
#define WLC_SET_PROMISC             10
#define WLC_OVERLAY_IOCTL           11
#define WLC_GET_RATE                12
 
#define WLC_GET_INSTANCE            14
 
 
 
 
#define WLC_GET_INFRA               19
#define WLC_SET_INFRA               20
#define WLC_GET_AUTH                21
#define WLC_SET_AUTH                22
#define WLC_GET_BSSID               23
#define WLC_SET_BSSID               24
#define WLC_GET_SSID                25
#define WLC_SET_SSID                26
#define WLC_RESTART             27
#define WLC_TERMINATED             28
 
#define WLC_GET_CHANNEL             29
#define WLC_SET_CHANNEL             30
#define WLC_GET_SRL             31
#define WLC_SET_SRL             32
#define WLC_GET_LRL             33
#define WLC_SET_LRL             34
#define WLC_GET_PLCPHDR             35
#define WLC_SET_PLCPHDR             36
#define WLC_GET_RADIO               37
#define WLC_SET_RADIO               38
#define WLC_GET_PHYTYPE             39
#define WLC_DUMP_RATE               40
#define WLC_SET_RATE_PARAMS         41
#define WLC_GET_FIXRATE             42
#define WLC_SET_FIXRATE             43
 
 
#define WLC_GET_KEY             44
#define WLC_SET_KEY             45
#define WLC_GET_REGULATORY          46
#define WLC_SET_REGULATORY          47
#define WLC_GET_PASSIVE_SCAN            48
#define WLC_SET_PASSIVE_SCAN            49
#define WLC_SCAN                50
#define WLC_SCAN_RESULTS            51
#define WLC_DISASSOC                52
#define WLC_REASSOC             53
#define WLC_GET_ROAM_TRIGGER            54
#define WLC_SET_ROAM_TRIGGER            55
#define WLC_GET_ROAM_DELTA          56
#define WLC_SET_ROAM_DELTA          57
#define WLC_GET_ROAM_SCAN_PERIOD        58
#define WLC_SET_ROAM_SCAN_PERIOD        59
#define WLC_EVM                 60  
#define WLC_GET_TXANT               61
#define WLC_SET_TXANT               62
#define WLC_GET_ANTDIV              63
#define WLC_SET_ANTDIV              64
 
 
#define WLC_GET_CLOSED              67
#define WLC_SET_CLOSED              68
#define WLC_GET_MACLIST             69
#define WLC_SET_MACLIST             70
#define WLC_GET_RATESET             71
#define WLC_SET_RATESET             72
 
#define WLC_LONGTRAIN               74
#define WLC_GET_BCNPRD              75
#define WLC_SET_BCNPRD              76
#define WLC_GET_DTIMPRD             77
#define WLC_SET_DTIMPRD             78
#define WLC_GET_SROM                79
#define WLC_SET_SROM                80
#define WLC_GET_WEP_RESTRICT            81
#define WLC_SET_WEP_RESTRICT            82
#define WLC_GET_COUNTRY             83
#define WLC_SET_COUNTRY             84
#define WLC_GET_PM              85
#define WLC_SET_PM              86
#define WLC_GET_WAKE                87
#define WLC_SET_WAKE                88
 
#define WLC_GET_FORCELINK           90  
#define WLC_SET_FORCELINK           91  
#define WLC_FREQ_ACCURACY           92  
#define WLC_CARRIER_SUPPRESS            93  
#define WLC_GET_PHYREG              94
#define WLC_SET_PHYREG              95
#define WLC_GET_RADIOREG            96
#define WLC_SET_RADIOREG            97
#define WLC_GET_REVINFO             98
#define WLC_GET_UCANTDIV            99
#define WLC_SET_UCANTDIV            100
#define WLC_R_REG               101
#define WLC_W_REG               102

 
#define WLC_GET_MACMODE             105
#define WLC_SET_MACMODE             106
#define WLC_GET_MONITOR             107
#define WLC_SET_MONITOR             108
#define WLC_GET_GMODE               109
#define WLC_SET_GMODE               110
#define WLC_GET_LEGACY_ERP          111
#define WLC_SET_LEGACY_ERP          112
#define WLC_GET_RX_ANT              113
#define WLC_GET_CURR_RATESET            114 
#define WLC_GET_SCANSUPPRESS            115
#define WLC_SET_SCANSUPPRESS            116
#define WLC_GET_AP              117
#define WLC_SET_AP              118
#define WLC_GET_EAP_RESTRICT            119
#define WLC_SET_EAP_RESTRICT            120
#define WLC_SCB_AUTHORIZE           121
#define WLC_SCB_DEAUTHORIZE         122
#define WLC_GET_WDSLIST             123
#define WLC_SET_WDSLIST             124
#define WLC_GET_ATIM                125
#define WLC_SET_ATIM                126
#define WLC_GET_RSSI                127
#define WLC_GET_PHYANTDIV           128
#define WLC_SET_PHYANTDIV           129
#define WLC_AP_RX_ONLY              130
#define WLC_GET_TX_PATH_PWR         131
#define WLC_SET_TX_PATH_PWR         132
#define WLC_GET_WSEC                133
#define WLC_SET_WSEC                134
#define WLC_GET_PHY_NOISE           135
#define WLC_GET_BSS_INFO            136
#define WLC_GET_PKTCNTS             137
#define WLC_GET_LAZYWDS             138
#define WLC_SET_LAZYWDS             139
#define WLC_GET_BANDLIST            140
#define WLC_GET_BAND                141
#define WLC_SET_BAND                142
#define WLC_SCB_DEAUTHENTICATE          143
#define WLC_GET_SHORTSLOT           144
#define WLC_GET_SHORTSLOT_OVERRIDE      145
#define WLC_SET_SHORTSLOT_OVERRIDE      146
#define WLC_GET_SHORTSLOT_RESTRICT      147
#define WLC_SET_SHORTSLOT_RESTRICT      148
#define WLC_GET_GMODE_PROTECTION        149
#define WLC_GET_GMODE_PROTECTION_OVERRIDE   150
#define WLC_SET_GMODE_PROTECTION_OVERRIDE   151
#define WLC_UPGRADE             152
 
 
#define WLC_GET_IGNORE_BCNS         155
#define WLC_SET_IGNORE_BCNS         156
#define WLC_GET_SCB_TIMEOUT         157
#define WLC_SET_SCB_TIMEOUT         158
#define WLC_GET_ASSOCLIST           159
#define WLC_GET_CLK             160
#define WLC_SET_CLK             161
#define WLC_GET_UP              162
#define WLC_OUT                 163
#define WLC_GET_WPA_AUTH            164
#define WLC_SET_WPA_AUTH            165
#define WLC_GET_UCFLAGS             166
#define WLC_SET_UCFLAGS             167
#define WLC_GET_PWRIDX              168
#define WLC_SET_PWRIDX              169
#define WLC_GET_TSSI                170
#define WLC_GET_SUP_RATESET_OVERRIDE        171
#define WLC_SET_SUP_RATESET_OVERRIDE        172
 
 
 
 
 
#define WLC_GET_PROTECTION_CONTROL      178
#define WLC_SET_PROTECTION_CONTROL      179
#define WLC_GET_PHYLIST             180
#define WLC_ENCRYPT_STRENGTH            181 
#define WLC_DECRYPT_STATUS          182 
#define WLC_GET_KEY_SEQ             183
#define WLC_GET_SCAN_CHANNEL_TIME       184
#define WLC_SET_SCAN_CHANNEL_TIME       185
#define WLC_GET_SCAN_UNASSOC_TIME       186
#define WLC_SET_SCAN_UNASSOC_TIME       187
#define WLC_GET_SCAN_HOME_TIME          188
#define WLC_SET_SCAN_HOME_TIME          189
#define WLC_GET_SCAN_NPROBES            190
#define WLC_SET_SCAN_NPROBES            191
#define WLC_GET_PRB_RESP_TIMEOUT        192
#define WLC_SET_PRB_RESP_TIMEOUT        193
#define WLC_GET_ATTEN               194
#define WLC_SET_ATTEN               195
#define WLC_GET_SHMEM               196 
#define WLC_SET_SHMEM               197 
 
 
#define WLC_SET_WSEC_TEST           200
#define WLC_SCB_DEAUTHENTICATE_FOR_REASON   201
#define WLC_TKIP_COUNTERMEASURES        202
#define WLC_GET_PIOMODE             203
#define WLC_SET_PIOMODE             204
#define WLC_SET_ASSOC_PREFER            205
#define WLC_GET_ASSOC_PREFER            206
#define WLC_SET_ROAM_PREFER         207
#define WLC_GET_ROAM_PREFER         208
#define WLC_SET_LED             209
#define WLC_GET_LED             210
#define WLC_GET_INTERFERENCE_MODE       211
#define WLC_SET_INTERFERENCE_MODE       212
#define WLC_GET_CHANNEL_QA          213
#define WLC_START_CHANNEL_QA            214
#define WLC_GET_CHANNEL_SEL         215
#define WLC_START_CHANNEL_SEL           216
#define WLC_GET_VALID_CHANNELS          217
#define WLC_GET_FAKEFRAG            218
#define WLC_SET_FAKEFRAG            219
#define WLC_GET_PWROUT_PERCENTAGE       220
#define WLC_SET_PWROUT_PERCENTAGE       221
#define WLC_SET_BAD_FRAME_PREEMPT       222
#define WLC_GET_BAD_FRAME_PREEMPT       223
#define WLC_SET_LEAP_LIST           224
#define WLC_GET_LEAP_LIST           225
#define WLC_GET_CWMIN               226
#define WLC_SET_CWMIN               227
#define WLC_GET_CWMAX               228
#define WLC_SET_CWMAX               229
#define WLC_GET_WET             230
#define WLC_SET_WET             231
#define WLC_GET_PUB             232
 
 
#define WLC_GET_KEY_PRIMARY         235
#define WLC_SET_KEY_PRIMARY         236
 
#define WLC_GET_ACI_ARGS            238
#define WLC_SET_ACI_ARGS            239
#define WLC_UNSET_CALLBACK          240
#define WLC_SET_CALLBACK            241
#define WLC_GET_RADAR               242
#define WLC_SET_RADAR               243
#define WLC_SET_SPECT_MANAGMENT         244
#define WLC_GET_SPECT_MANAGMENT         245
#define WLC_WDS_GET_REMOTE_HWADDR       246 
#define WLC_WDS_GET_WPA_SUP         247
#define WLC_SET_CS_SCAN_TIMER           248
#define WLC_GET_CS_SCAN_TIMER           249
#define WLC_MEASURE_REQUEST         250
#define WLC_INIT                251
#define WLC_SEND_QUIET              252
#define WLC_KEEPALIVE           253
#define WLC_SEND_PWR_CONSTRAINT         254
#define WLC_UPGRADE_STATUS          255
#define WLC_CURRENT_PWR             256
#define WLC_GET_SCAN_PASSIVE_TIME       257
#define WLC_SET_SCAN_PASSIVE_TIME       258
#define WLC_LEGACY_LINK_BEHAVIOR        259
#define WLC_GET_CHANNELS_IN_COUNTRY     260
#define WLC_GET_COUNTRY_LIST            261
#define WLC_GET_VAR             262 
#define WLC_SET_VAR             263 
#define WLC_NVRAM_GET               264 
#define WLC_NVRAM_SET               265
#define WLC_NVRAM_DUMP              266
#define WLC_REBOOT              267
#define WLC_SET_WSEC_PMK            268
#define WLC_GET_AUTH_MODE           269
#define WLC_SET_AUTH_MODE           270
#define WLC_GET_WAKEENTRY           271
#define WLC_SET_WAKEENTRY           272
#define WLC_NDCONFIG_ITEM           273 
#define WLC_NVOTPW              274
#define WLC_OTPW                275
#define WLC_IOV_BLOCK_GET           276
#define WLC_IOV_MODULES_GET         277
#define WLC_SOFT_RESET              278
#define WLC_GET_ALLOW_MODE          279
#define WLC_SET_ALLOW_MODE          280
#define WLC_GET_DESIRED_BSSID           281
#define WLC_SET_DESIRED_BSSID           282
#define WLC_DISASSOC_MYAP           283
#define WLC_GET_NBANDS              284 
#define WLC_GET_BANDSTATES          285 
#define WLC_GET_WLC_BSS_INFO            286 
#define WLC_GET_ASSOC_INFO          287 
#define WLC_GET_OID_PHY             288 
#define WLC_SET_OID_PHY             289 
#define WLC_SET_ASSOC_TIME          290 
#define WLC_GET_DESIRED_SSID            291 
#define WLC_GET_CHANSPEC            292 
#define WLC_GET_ASSOC_STATE         293 
#define WLC_SET_PHY_STATE           294 
#define WLC_GET_SCAN_PENDING            295 
#define WLC_GET_SCANREQ_PENDING         296 
#define WLC_GET_PREV_ROAM_REASON        297 
#define WLC_SET_PREV_ROAM_REASON        298 
#define WLC_GET_BANDSTATES_PI           299 
#define WLC_GET_PHY_STATE           300 
#define WLC_GET_BSS_WPA_RSN         301 
#define WLC_GET_BSS_WPA2_RSN            302 
#define WLC_GET_BSS_BCN_TS          303 
#define WLC_GET_INT_DISASSOC            304 
#define WLC_SET_NUM_PEERS           305     
#define WLC_GET_NUM_BSS             306 
#define WLC_NPHY_SAMPLE_COLLECT         307 
#define WLC_UM_PRIV             308 
#define WLC_GET_CMD             309
  
#define WLC_SET_INTERFERENCE_OVERRIDE_MODE  311 
#define WLC_GET_INTERFERENCE_OVERRIDE_MODE  312 
#define WLC_GET_WAI_RESTRICT            313 
#define WLC_SET_WAI_RESTRICT            314 
#define WLC_SET_WAI_REKEY           315 
#define WLC_SET_PEAKRATE            316 
#define WLC_GET_PEAKRATE            317
#define WLC_LAST                318

#ifndef EPICTRL_COOKIE
#define EPICTRL_COOKIE      0xABADCEDE
#endif


#define CMN_IOCTL_OFF 0x180




#define WL_OID_BASE     0xFFE41420


#define OID_WL_GETINSTANCE  (WL_OID_BASE + WLC_GET_INSTANCE)
#define OID_WL_GET_FORCELINK    (WL_OID_BASE + WLC_GET_FORCELINK)
#define OID_WL_SET_FORCELINK    (WL_OID_BASE + WLC_SET_FORCELINK)
#define OID_WL_ENCRYPT_STRENGTH (WL_OID_BASE + WLC_ENCRYPT_STRENGTH)
#define OID_WL_DECRYPT_STATUS   (WL_OID_BASE + WLC_DECRYPT_STATUS)
#define OID_LEGACY_LINK_BEHAVIOR (WL_OID_BASE + WLC_LEGACY_LINK_BEHAVIOR)
#define OID_WL_NDCONFIG_ITEM    (WL_OID_BASE + WLC_NDCONFIG_ITEM)


#define OID_STA_CHANSPEC    (WL_OID_BASE + WLC_GET_CHANSPEC)
#define OID_STA_NBANDS      (WL_OID_BASE + WLC_GET_NBANDS)
#define OID_STA_GET_PHY     (WL_OID_BASE + WLC_GET_OID_PHY)
#define OID_STA_SET_PHY     (WL_OID_BASE + WLC_SET_OID_PHY)
#define OID_STA_ASSOC_TIME  (WL_OID_BASE + WLC_SET_ASSOC_TIME)
#define OID_STA_DESIRED_SSID    (WL_OID_BASE + WLC_GET_DESIRED_SSID)
#define OID_STA_SET_PHY_STATE   (WL_OID_BASE + WLC_SET_PHY_STATE)
#define OID_STA_SCAN_PENDING    (WL_OID_BASE + WLC_GET_SCAN_PENDING)
#define OID_STA_SCANREQ_PENDING (WL_OID_BASE + WLC_GET_SCANREQ_PENDING)
#define OID_STA_GET_ROAM_REASON (WL_OID_BASE + WLC_GET_PREV_ROAM_REASON)
#define OID_STA_SET_ROAM_REASON (WL_OID_BASE + WLC_SET_PREV_ROAM_REASON)
#define OID_STA_GET_PHY_STATE   (WL_OID_BASE + WLC_GET_PHY_STATE)
#define OID_STA_INT_DISASSOC    (WL_OID_BASE + WLC_GET_INT_DISASSOC)
#define OID_STA_SET_NUM_PEERS   (WL_OID_BASE + WLC_SET_NUM_PEERS)
#define OID_STA_GET_NUM_BSS (WL_OID_BASE + WLC_GET_NUM_BSS)

#define WL_DECRYPT_STATUS_SUCCESS   1
#define WL_DECRYPT_STATUS_FAILURE   2
#define WL_DECRYPT_STATUS_UNKNOWN   3


#define WLC_UPGRADE_SUCCESS         0
#define WLC_UPGRADE_PENDING         1

#ifdef CONFIG_USBRNDIS_RETAIL

typedef struct {
	char *name;
	void *param;
} ndconfig_item_t;
#endif



#define WL_AUTH_OPEN_SYSTEM     0   
#define WL_AUTH_SHARED_KEY      1   
#define WL_AUTH_OPEN_SHARED		2	


#define WL_RADIO_SW_DISABLE     (1<<0)
#define WL_RADIO_HW_DISABLE     (1<<1)
#define WL_RADIO_MPC_DISABLE        (1<<2)
#define WL_RADIO_COUNTRY_DISABLE    (1<<3)  

#define WL_SPURAVOID_OFF    0
#define WL_SPURAVOID_ON1    1
#define WL_SPURAVOID_ON2    2


#define WL_TXPWR_OVERRIDE   (1U<<31)
#define WL_TXPWR_NEG   (1U<<30)

#define WL_PHY_PAVARS_LEN   6   

#define WL_PHY_PAVARS2_NUM	3	
#define WL_PHY_PAVAR_VER	1	
typedef struct wl_pavars2 {
	uint16 ver;		
	uint16 len;		
	uint16 inuse;		
	uint16 phy_type;	
	uint16 bandrange;
	uint16 chain;
	uint16 inpa[WL_PHY_PAVARS2_NUM];	
} wl_pavars2_t;

typedef struct wl_po {
	uint16  phy_type;   
	uint16  band;
	uint16  cckpo;
	uint32  ofdmpo;
	uint16  mcspo[8];
} wl_po_t;


#define WLC_TXPWR_MAX       (127)   


#define WL_DIAG_INTERRUPT           1   
#define WL_DIAG_LOOPBACK            2   
#define WL_DIAG_MEMORY              3   
#define WL_DIAG_LED             4   
#define WL_DIAG_REG             5   
#define WL_DIAG_SROM                6   
#define WL_DIAG_DMA             7   

#define WL_DIAGERR_SUCCESS          0
#define WL_DIAGERR_FAIL_TO_RUN          1   
#define WL_DIAGERR_NOT_SUPPORTED        2   
#define WL_DIAGERR_INTERRUPT_FAIL       3   
#define WL_DIAGERR_LOOPBACK_FAIL        4   
#define WL_DIAGERR_SROM_FAIL            5   
#define WL_DIAGERR_SROM_BADCRC          6   
#define WL_DIAGERR_REG_FAIL         7   
#define WL_DIAGERR_MEMORY_FAIL          8   
#define WL_DIAGERR_NOMEM            9   
#define WL_DIAGERR_DMA_FAIL         10  

#define WL_DIAGERR_MEMORY_TIMEOUT       11  
#define WL_DIAGERR_MEMORY_BADPATTERN        12  


#define WLC_BAND_AUTO       0   
#define WLC_BAND_5G     1   
#define WLC_BAND_2G     2   
#define WLC_BAND_ALL        3   


#define WL_CHAN_FREQ_RANGE_2G      0
#define WL_CHAN_FREQ_RANGE_5GL     1
#define WL_CHAN_FREQ_RANGE_5GM     2
#define WL_CHAN_FREQ_RANGE_5GH     3

#define WL_CHAN_FREQ_RANGE_5GLL_5BAND    4
#define WL_CHAN_FREQ_RANGE_5GLH_5BAND    5
#define WL_CHAN_FREQ_RANGE_5GML_5BAND    6
#define WL_CHAN_FREQ_RANGE_5GMH_5BAND    7
#define WL_CHAN_FREQ_RANGE_5GH_5BAND     8

#define WL_CHAN_FREQ_RANGE_5G_BAND0     1
#define WL_CHAN_FREQ_RANGE_5G_BAND1     2
#define WL_CHAN_FREQ_RANGE_5G_BAND2     3
#define WL_CHAN_FREQ_RANGE_5G_BAND3     4


#define WLC_PHY_TYPE_A      0
#define WLC_PHY_TYPE_B      1
#define WLC_PHY_TYPE_G      2
#define WLC_PHY_TYPE_N      4
#define WLC_PHY_TYPE_LP     5
#define WLC_PHY_TYPE_SSN    6
#define WLC_PHY_TYPE_HT     7
#define WLC_PHY_TYPE_LCN    8
#define WLC_PHY_TYPE_NULL   0xf


#define WLC_MACMODE_DISABLED    0   
#define WLC_MACMODE_DENY    1   
#define WLC_MACMODE_ALLOW   2   


#define GMODE_LEGACY_B      0
#define GMODE_AUTO      1
#define GMODE_ONLY      2
#define GMODE_B_DEFERRED    3
#define GMODE_PERFORMANCE   4
#define GMODE_LRS       5
#define GMODE_MAX       6


#define WLC_PLCP_AUTO   -1
#define WLC_PLCP_SHORT  0
#define WLC_PLCP_LONG   1


#define WLC_PROTECTION_AUTO     -1
#define WLC_PROTECTION_OFF      0
#define WLC_PROTECTION_ON       1
#define WLC_PROTECTION_MMHDR_ONLY   2
#define WLC_PROTECTION_CTS_ONLY     3


#define WLC_PROTECTION_CTL_OFF      0
#define WLC_PROTECTION_CTL_LOCAL    1
#define WLC_PROTECTION_CTL_OVERLAP  2


#define WLC_N_PROTECTION_OFF        0
#define WLC_N_PROTECTION_OPTIONAL   1
#define WLC_N_PROTECTION_20IN40     2
#define WLC_N_PROTECTION_MIXEDMODE  3


#define WLC_N_PREAMBLE_MIXEDMODE    0
#define WLC_N_PREAMBLE_GF       1
#define WLC_N_PREAMBLE_GF_BRCM          2


#define WLC_N_BW_20ALL          0
#define WLC_N_BW_40ALL          1
#define WLC_N_BW_20IN2G_40IN5G      2


#define WLC_N_TXRX_CHAIN0       0
#define WLC_N_TXRX_CHAIN1       1


#define WLC_N_SGI_20            0x01
#define WLC_N_SGI_40            0x02


#define PM_OFF  0
#define PM_MAX  1
#define PM_FAST 2

#define LISTEN_INTERVAL			10

#define INTERFERE_OVRRIDE_OFF   -1  
#define INTERFERE_NONE  0   
#define NON_WLAN    1   
#define WLAN_MANUAL 2   
#define WLAN_AUTO   3   
#define WLAN_AUTO_W_NOISE   4   
#define AUTO_ACTIVE (1 << 7) 

typedef struct wl_aci_args {
	int enter_aci_thresh; 
	int exit_aci_thresh; 
	int usec_spin; 
	int glitch_delay; 
	uint16 nphy_adcpwr_enter_thresh;    
	uint16 nphy_adcpwr_exit_thresh; 
	uint16 nphy_repeat_ctr;     
	uint16 nphy_num_samples;    
	uint16 nphy_undetect_window_sz; 
	uint16 nphy_b_energy_lo_aci;    
	uint16 nphy_b_energy_md_aci;    
	uint16 nphy_b_energy_hi_aci;    
	uint16 nphy_noise_noassoc_glitch_th_up; 
	uint16 nphy_noise_noassoc_glitch_th_dn;
	uint16 nphy_noise_assoc_glitch_th_up;
	uint16 nphy_noise_assoc_glitch_th_dn;
	uint16 nphy_noise_assoc_aci_glitch_th_up;
	uint16 nphy_noise_assoc_aci_glitch_th_dn;
	uint16 nphy_noise_assoc_enter_th;
	uint16 nphy_noise_noassoc_enter_th;
	uint16 nphy_noise_assoc_rx_glitch_badplcp_enter_th;
	uint16 nphy_noise_noassoc_crsidx_incr;
	uint16 nphy_noise_assoc_crsidx_incr;
	uint16 nphy_noise_crsidx_decr;
} wl_aci_args_t;

#define TRIGGER_NOW             0
#define TRIGGER_CRS             0x01
#define TRIGGER_CRSDEASSERT         0x02
#define TRIGGER_GOODFCS             0x04
#define TRIGGER_BADFCS              0x08
#define TRIGGER_BADPLCP             0x10
#define TRIGGER_CRSGLITCH           0x20
#define WL_ACI_ARGS_LEGACY_LENGTH   16  
#define	WL_SAMPLECOLLECT_T_VERSION	2	
typedef struct wl_samplecollect_args {
	
	uint8 coll_us;
	int cores;
	
	uint16 version;     
	uint16 length;      
	int8 trigger;
	uint16 timeout;
	uint16 mode;
	uint32 pre_dur;
	uint32 post_dur;
	uint8 gpio_sel;
	bool downsamp;
	bool be_deaf;
	bool agc;       
	bool filter;        
	
	uint8 trigger_state;
	uint8 module_sel1;
	uint8 module_sel2;
	uint16 nsamps;
} wl_samplecollect_args_t;

#define WL_SAMPLEDATA_HEADER_TYPE   1
#define WL_SAMPLEDATA_HEADER_SIZE   80  
#define WL_SAMPLEDATA_TYPE      2
#define WL_SAMPLEDATA_SEQ       0xff    
#define WL_SAMPLEDATA_MORE_DATA     0x100   
#define WL_SAMPLEDATA_T_VERSION     1   

#define WL_SAMPLEDATA_T_VERSION_SPEC_AN 2

typedef struct wl_sampledata {
	uint16 version; 
	uint16 size;    
	uint16 tag; 
	uint16 length;  
	uint32 flag;    
} wl_sampledata_t;


#define WL_CHAN_VALID_HW    (1 << 0)
#define WL_CHAN_VALID_SW    (1 << 1)
#define WL_CHAN_BAND_5G     (1 << 2)
#define WL_CHAN_RADAR       (1 << 3)
#define WL_CHAN_INACTIVE    (1 << 4)
#define WL_CHAN_PASSIVE     (1 << 5)
#define WL_CHAN_RESTRICTED  (1 << 6)


#define WL_ERROR_VAL        0x00000001
#define WL_TRACE_VAL        0x00000002
#define WL_PRHDRS_VAL       0x00000004
#define WL_PRPKT_VAL        0x00000008
#define WL_INFORM_VAL       0x00000010
#define WL_TMP_VAL      0x00000020
#define WL_OID_VAL      0x00000040
#define WL_RATE_VAL     0x00000080
#define WL_ASSOC_VAL        0x00000100
#define WL_PRUSR_VAL        0x00000200
#define WL_PS_VAL       0x00000400
#define WL_TXPWR_VAL        0x00000800  
#define WL_PORT_VAL     0x00001000
#define WL_DUAL_VAL     0x00002000
#define WL_WSEC_VAL     0x00004000
#define WL_WSEC_DUMP_VAL    0x00008000
#define WL_LOG_VAL      0x00010000
#define WL_NRSSI_VAL        0x00020000  
#define WL_LOFT_VAL     0x00040000  
#define WL_REGULATORY_VAL   0x00080000
#define WL_PHYCAL_VAL       0x00100000  
#define WL_RADAR_VAL        0x00200000  
#define WL_MPC_VAL      0x00400000
#define WL_APSTA_VAL        0x00800000
#define WL_DFS_VAL      0x01000000
#define WL_BA_VAL       0x02000000
#define WL_ACI_VAL      0x04000000
#define WL_MBSS_VAL     0x04000000
#define WL_CAC_VAL      0x08000000
#define WL_AMSDU_VAL        0x10000000
#define WL_AMPDU_VAL        0x20000000
#define WL_FFPLD_VAL        0x40000000


#define WL_DPT_VAL      0x00000001
#define WL_SCAN_VAL     0x00000002
#define WL_WOWL_VAL     0x00000004
#define WL_COEX_VAL     0x00000008
#define WL_RTDC_VAL     0x00000010
#define WL_PROTO_VAL        0x00000020
#define WL_BTA_VAL      0x00000040
#define WL_CHANINT_VAL      0x00000080
#define WL_THERMAL_VAL      0x00000100  
#define WL_P2P_VAL      0x00000200
#define WL_TXRX_VAL		0x00000400
#define WL_MCHAN_VAL            0x00000800
#define WL_TDLS_VAL		0x00001000


#define WL_LED_NUMGPIO      16  


#define WL_LED_OFF      0       
#define WL_LED_ON       1       
#define WL_LED_ACTIVITY     2       
#define WL_LED_RADIO        3       
#define WL_LED_ARADIO       4       
#define WL_LED_BRADIO       5       
#define WL_LED_BGMODE       6       
#define WL_LED_WI1      7
#define WL_LED_WI2      8
#define WL_LED_WI3      9
#define WL_LED_ASSOC        10      
#define WL_LED_INACTIVE     11      
#define WL_LED_ASSOCACT     12      
#define WL_LED_WI4      13
#define WL_LED_WI5      14
#define WL_LED_BLINKSLOW    15      
#define WL_LED_BLINKMED     16      
#define WL_LED_BLINKFAST    17      
#define WL_LED_BLINKCUSTOM  18      
#define WL_LED_BLINKPERIODIC    19      
#define WL_LED_ASSOC_WITH_SEC   20      
						
#define WL_LED_START_OFF    21      
#define WL_LED_NUMBEHAVIOR  22


#define WL_LED_BEH_MASK     0x7f        
#define WL_LED_AL_MASK      0x80        


#define WL_NUMCHANNELS      64
#define WL_NUMCHANSPECS     100


#define WL_WDS_WPA_ROLE_AUTH    0   
#define WL_WDS_WPA_ROLE_SUP 1   
#define WL_WDS_WPA_ROLE_AUTO    255 


#define WL_EVENTING_MASK_LEN    16




#define WL_JOIN_PREF_RSSI   1   
#define WL_JOIN_PREF_WPA    2   
#define WL_JOIN_PREF_BAND   3   
#define WL_JOIN_PREF_RSSI_DELTA 4   
#define WL_JOIN_PREF_TRANS_PREF	5	


#define WLJP_BAND_ASSOC_PREF    255 


#define WL_WPA_ACP_MCS_ANY  "\x00\x00\x00\x00"

struct tsinfo_arg {
	uint8 octets[3];
};

#define NFIFO           6   

#define WL_CNT_T_VERSION    6   

typedef struct {
	uint16  version;    
	uint16  length;     

	
	uint32  txframe;    
	uint32  txbyte;     
	uint32  txretrans;  
	uint32  txerror;    
	uint32  txctl;      
	uint32  txprshort;  
	uint32  txserr;     
	uint32  txnobuf;    
	uint32  txnoassoc;  
	uint32  txrunt;     
	uint32  txchit;     
	uint32  txcmiss;    

	
	uint32  txuflo;     
	uint32  txphyerr;   
	uint32  txphycrs;

	
	uint32  rxframe;    
	uint32  rxbyte;     
	uint32  rxerror;    
	uint32  rxctl;      
	uint32  rxnobuf;    
	uint32  rxnondata;  
	uint32  rxbadds;    
	uint32  rxbadcm;    
	uint32  rxfragerr;  
	uint32  rxrunt;     
	uint32  rxgiant;    
	uint32  rxnoscb;    
	uint32  rxbadproto; 
	uint32  rxbadsrcmac;    
	uint32  rxbadda;    
	uint32  rxfilter;   

	
	uint32  rxoflo;     
	uint32  rxuflo[NFIFO];  

	uint32  d11cnt_txrts_off;   
	uint32  d11cnt_rxcrc_off;   
	uint32  d11cnt_txnocts_off; 

	
	uint32  dmade;      
	uint32  dmada;      
	uint32  dmape;      
	uint32  reset;      
	uint32  tbtt;       
	uint32  txdmawar;
	uint32  pkt_callback_reg_fail;  

	
	uint32  txallfrm;   
	uint32  txrtsfrm;   
	uint32  txctsfrm;   
	uint32  txackfrm;   
	uint32  txdnlfrm;   
	uint32  txbcnfrm;   
	uint32  txfunfl[8]; 
	uint32  txtplunfl;  
	uint32  txphyerror; 
	uint32  rxfrmtoolong;   
	uint32  rxfrmtooshrt;   
	uint32  rxinvmachdr;    
	uint32  rxbadfcs;   
	uint32  rxbadplcp;  
	uint32  rxcrsglitch;    
	uint32  rxstrt;     
	uint32  rxdfrmucastmbss; 
	uint32  rxmfrmucastmbss; 
	uint32  rxcfrmucast;    
	uint32  rxrtsucast; 
	uint32  rxctsucast; 
	uint32  rxackucast; 
	uint32  rxdfrmocast;    
	uint32  rxmfrmocast;    
	uint32  rxcfrmocast;    
	uint32  rxrtsocast; 
	uint32  rxctsocast; 
	uint32  rxdfrmmcast;    
	uint32  rxmfrmmcast;    
	uint32  rxcfrmmcast;    
	uint32  rxbeaconmbss;   
	uint32  rxdfrmucastobss; 
	uint32  rxbeaconobss;   
	uint32  rxrsptmout; 
	uint32  bcntxcancl; 
	uint32  rxf0ovfl;   
	uint32  rxf1ovfl;   
	uint32  rxf2ovfl;   
	uint32  txsfovfl;   
	uint32  pmqovfl;    
	uint32  rxcgprqfrm; 
	uint32  rxcgprsqovfl;   
	uint32  txcgprsfail;    
	uint32  txcgprssuc; 
	uint32  prs_timeout;    
	uint32  rxnack;
	uint32  frmscons;
	uint32  txnack;
	uint32  txglitch_nack;  
	uint32  txburst;    

	
	uint32  txfrag;     
	uint32  txmulti;    
	uint32  txfail;     
	uint32  txretry;    
	uint32  txretrie;   
	uint32  rxdup;      
	uint32  txrts;      
	uint32  txnocts;    
	uint32  txnoack;    
	uint32  rxfrag;     
	uint32  rxmulti;    
	uint32  rxcrc;      
	uint32  txfrmsnt;   
	uint32  rxundec;    

	
	uint32  tkipmicfaill;   
	uint32  tkipcntrmsr;    
	uint32  tkipreplay; 
	uint32  ccmpfmterr; 
	uint32  ccmpreplay; 
	uint32  ccmpundec;  
	uint32  fourwayfail;    
	uint32  wepundec;   
	uint32  wepicverr;  
	uint32  decsuccess; 
	uint32  tkipicverr; 
	uint32  wepexcluded;    

	uint32  rxundec_mcst;   

	
	uint32  tkipmicfaill_mcst;  
	uint32  tkipcntrmsr_mcst;   
	uint32  tkipreplay_mcst;    
	uint32  ccmpfmterr_mcst;    
	uint32  ccmpreplay_mcst;    
	uint32  ccmpundec_mcst; 
	uint32  fourwayfail_mcst;   
	uint32  wepundec_mcst;  
	uint32  wepicverr_mcst; 
	uint32  decsuccess_mcst;    
	uint32  tkipicverr_mcst;    
	uint32  wepexcluded_mcst;   

	uint32  txchanrej;  
	uint32  txexptime;  
	uint32  psmwds;     
	uint32  phywatchdog;    

	
	uint32  prq_entries_handled;    
	uint32  prq_undirected_entries; 
	uint32  prq_bad_entries;    
	uint32  atim_suppress_count;    
	uint32  bcn_template_not_ready; 
	uint32  bcn_template_not_ready_done; 
	uint32  late_tbtt_dpc;  

	
	uint32  rx1mbps;    
	uint32  rx2mbps;    
	uint32  rx5mbps5;   
	uint32  rx6mbps;    
	uint32  rx9mbps;    
	uint32  rx11mbps;   
	uint32  rx12mbps;   
	uint32  rx18mbps;   
	uint32  rx24mbps;   
	uint32  rx36mbps;   
	uint32  rx48mbps;   
	uint32  rx54mbps;   
	uint32  rx108mbps;  
	uint32  rx162mbps;  
	uint32  rx216mbps;  
	uint32  rx270mbps;  
	uint32  rx324mbps;  
	uint32  rx378mbps;  
	uint32  rx432mbps;  
	uint32  rx486mbps;  
	uint32  rx540mbps;  

	
	uint32  pktengrxducast; 
	uint32  pktengrxdmcast; 

	uint32  rfdisable;  
	uint32  bphy_rxcrsglitch;   

	uint32  txmpdu_sgi; 
	uint32  rxmpdu_sgi; 
	uint32  txmpdu_stbc;    
	uint32  rxmpdu_stbc;    
} wl_cnt_t;


#define WL_WME_CNT_VERSION  1   

typedef struct {
	uint32 packets;
	uint32 bytes;
} wl_traffic_stats_t;

typedef struct {
	uint16  version;    
	uint16  length;     

	wl_traffic_stats_t tx[AC_COUNT];    
	wl_traffic_stats_t tx_failed[AC_COUNT]; 
	wl_traffic_stats_t rx[AC_COUNT];    
	wl_traffic_stats_t rx_failed[AC_COUNT]; 

	wl_traffic_stats_t forward[AC_COUNT];   

	wl_traffic_stats_t tx_expired[AC_COUNT];    

} wl_wme_cnt_t;

struct wl_msglevel2 {
	uint32 low;
	uint32 high;
};

typedef struct wl_mkeep_alive_pkt {
	uint16	version; 
	uint16	length; 
	uint32	period_msec;
	uint16	len_bytes;
	uint8	keep_alive_id; 
	uint8	data[1];
} wl_mkeep_alive_pkt_t;

#define WL_MKEEP_ALIVE_VERSION		1
#define WL_MKEEP_ALIVE_FIXED_LEN	OFFSETOF(wl_mkeep_alive_pkt_t, data)
#define WL_MKEEP_ALIVE_PRECISION	500



#define WLC_ROAM_TRIGGER_DEFAULT    0 
#define WLC_ROAM_TRIGGER_BANDWIDTH  1 
#define WLC_ROAM_TRIGGER_DISTANCE   2 
#define WLC_ROAM_TRIGGER_AUTO       3 
#define WLC_ROAM_TRIGGER_MAX_VALUE  3 


#define WPA_AUTH_PFN_ANY	0xffffffff	

enum {
	PFN_LIST_ORDER,
	PFN_RSSI
};

enum {
	DISABLE,
	ENABLE
};

enum {
	OFF_ADAPT,
	SMART_ADAPT,
	STRICT_ADAPT,
	SLOW_ADAPT
};

#define SORT_CRITERIA_BIT		0
#define AUTO_NET_SWITCH_BIT		1
#define ENABLE_BKGRD_SCAN_BIT	2
#define IMMEDIATE_SCAN_BIT		3
#define	AUTO_CONNECT_BIT		4
#define	ENABLE_BD_SCAN_BIT		5
#define ENABLE_ADAPTSCAN_BIT	6
#define IMMEDIATE_EVENT_BIT		8

#define SORT_CRITERIA_MASK		0x0001
#define AUTO_NET_SWITCH_MASK	0x0002
#define ENABLE_BKGRD_SCAN_MASK	0x0004
#define IMMEDIATE_SCAN_MASK		0x0008
#define	AUTO_CONNECT_MASK		0x0010
#define ENABLE_BD_SCAN_MASK		0x0020
#define ENABLE_ADAPTSCAN_MASK	0x00c0
#define IMMEDIATE_EVENT_MASK	0x0100

#define PFN_VERSION				2
#define PFN_SCANRESULT_VERSION	1
#define MAX_PFN_LIST_COUNT	16

#define PFN_COMPLETE			1
#define PFN_INCOMPLETE			0

#define DEFAULT_BESTN			2
#define DEFAULT_MSCAN			0
#define DEFAULT_REPEAT			10
#define DEFAULT_EXP				2


typedef struct wl_pfn_subnet_info {
	struct ether_addr BSSID;
	uint8	channel; 
	uint8	SSID_len;
	uint8	SSID[32];
} wl_pfn_subnet_info_t;

typedef struct wl_pfn_net_info {
	wl_pfn_subnet_info_t pfnsubnet;
	int16	RSSI; 
	uint16	timestamp; 
} wl_pfn_net_info_t;

typedef struct wl_pfn_scanresults {
	uint32 version;
	uint32 status;
	uint32 count;
	wl_pfn_net_info_t netinfo[1];
} wl_pfn_scanresults_t;


typedef struct wl_pfn_param {
	int32 version;			
	int32 scan_freq;		
	int32 lost_network_timeout;	
	int16 flags;			
	int16 rssi_margin;		
	uint8 bestn; 
	uint8 mscan; 
	uint8 repeat; 
	uint8 exp; 
	int32 slow_freq; 
} wl_pfn_param_t;

typedef struct wl_pfn_bssid {
	struct ether_addr 	macaddr;
	
	uint16				flags;
} wl_pfn_bssid_t;
#define WL_PFN_SUPPRESSFOUND_MASK	0x08
#define WL_PFN_SUPPRESSLOST_MASK	0x10

typedef struct wl_pfn_cfg {
	uint32				reporttype;
	int32				channel_num;
	uint16				channel_list[WL_NUMCHANNELS];
} wl_pfn_cfg_t;
#define WL_PFN_REPORT_ALLNET 	0
#define WL_PFN_REPORT_SSIDNET 	1
#define WL_PFN_REPORT_BSSIDNET 	2

typedef struct wl_pfn {
	wlc_ssid_t		ssid;			
	int32			flags;			
	int32			infra;			
	int32			auth;			
	int32			wpa_auth;		
	int32			wsec;			
} wl_pfn_t;
#define WL_PFN_HIDDEN_BIT		2
#define PNO_SCAN_MAX_FW		508*1000	
#define PNO_SCAN_MAX_FW_SEC	PNO_SCAN_MAX_FW/1000 
#define PNO_SCAN_MIN_FW_SEC	10			
#define WL_PFN_HIDDEN_MASK		0x4


#define TOE_TX_CSUM_OL      0x00000001
#define TOE_RX_CSUM_OL      0x00000002


#define TOE_ERRTEST_TX_CSUM 0x00000001
#define TOE_ERRTEST_RX_CSUM 0x00000002
#define TOE_ERRTEST_RX_CSUM2    0x00000004

struct toe_ol_stats_t {
	
	uint32 tx_summed;

	
	uint32 tx_iph_fill;
	uint32 tx_tcp_fill;
	uint32 tx_udp_fill;
	uint32 tx_icmp_fill;

	
	uint32 rx_iph_good;
	uint32 rx_iph_bad;
	uint32 rx_tcp_good;
	uint32 rx_tcp_bad;
	uint32 rx_udp_good;
	uint32 rx_udp_bad;
	uint32 rx_icmp_good;
	uint32 rx_icmp_bad;

	
	uint32 tx_tcp_errinj;
	uint32 tx_udp_errinj;
	uint32 tx_icmp_errinj;

	
	uint32 rx_tcp_errinj;
	uint32 rx_udp_errinj;
	uint32 rx_icmp_errinj;
};


#define ARP_OL_AGENT        0x00000001
#define ARP_OL_SNOOP        0x00000002
#define ARP_OL_HOST_AUTO_REPLY  0x00000004
#define ARP_OL_PEER_AUTO_REPLY  0x00000008


#define ARP_ERRTEST_REPLY_PEER  0x1
#define ARP_ERRTEST_REPLY_HOST  0x2

#define ARP_MULTIHOMING_MAX 8   


struct arp_ol_stats_t {
	uint32  host_ip_entries;    
	uint32  host_ip_overflow;   

	uint32  arp_table_entries;  
	uint32  arp_table_overflow; 

	uint32  host_request;       
	uint32  host_reply;     
	uint32  host_service;       

	uint32  peer_request;       
	uint32  peer_request_drop;  
	uint32  peer_reply;     
	uint32  peer_reply_drop;    
	uint32  peer_service;       
};




typedef struct wl_keep_alive_pkt {
	uint32  period_msec;    
	uint16  len_bytes;  
	uint8   data[1];    
} wl_keep_alive_pkt_t;

#define WL_KEEP_ALIVE_FIXED_LEN     OFFSETOF(wl_keep_alive_pkt_t, data)




#define MAX_WAKE_PACKET_BYTES 128


typedef struct pm_wake_packet {
	uint32	status;		
	uint32	pattern_id;	
	uint32	original_packet_size;
	uint32	saved_packet_size;
	uchar	packet[MAX_WAKE_PACKET_BYTES];
} pm_wake_packet_t;



#define PKT_FILTER_MODE_FORWARD_ON_MATCH      		1

#define PKT_FILTER_MODE_DISABLE					2

#define PKT_FILTER_MODE_PKT_CACHE_ON_MATCH    		4

#define PKT_FILTER_MODE_PKT_FORWARD_OFF_DEFAULT 8


typedef enum wl_pkt_filter_type {
	WL_PKT_FILTER_TYPE_PATTERN_MATCH,	
	WL_PKT_FILTER_TYPE_MAGIC_PATTERN_MATCH	
} wl_pkt_filter_type_t;

#define WL_PKT_FILTER_TYPE wl_pkt_filter_type_t


typedef struct wl_pkt_filter_pattern {
	uint32  offset;     
	uint32  size_bytes; 
	uint8   mask_and_pattern[1]; 
} wl_pkt_filter_pattern_t;


typedef struct wl_pkt_filter {
	uint32  id;     
	uint32  type;       
	uint32  negate_match;   
	union {         
		wl_pkt_filter_pattern_t pattern;    
	} u;
} wl_pkt_filter_t;

#define WL_PKT_FILTER_FIXED_LEN       OFFSETOF(wl_pkt_filter_t, u)
#define WL_PKT_FILTER_PATTERN_FIXED_LEN   OFFSETOF(wl_pkt_filter_pattern_t, mask_and_pattern)


typedef struct wl_pkt_filter_enable {
	uint32  id;     
	uint32  enable;     
} wl_pkt_filter_enable_t;


typedef struct wl_pkt_filter_list {
	uint32  num;        
	wl_pkt_filter_t filter[1];  
} wl_pkt_filter_list_t;

#define WL_PKT_FILTER_LIST_FIXED_LEN      OFFSETOF(wl_pkt_filter_list_t, filter)


typedef struct wl_pkt_filter_stats {
	uint32  num_pkts_matched;   
	uint32  num_pkts_forwarded; 
	uint32  num_pkts_discarded; 
} wl_pkt_filter_stats_t;


typedef struct wl_seq_cmd_ioctl {
	uint32 cmd;     
	uint32 len;     
} wl_seq_cmd_ioctl_t;

#define WL_SEQ_CMD_ALIGN_BYTES  4


#define WL_SEQ_CMDS_GET_IOCTL_FILTER(cmd) \
	(((cmd) == WLC_GET_MAGIC) || \
	 ((cmd) == WLC_GET_VERSION) || \
	 ((cmd) == WLC_GET_AP) || \
	 ((cmd) == WLC_GET_INSTANCE))



#define WL_PKTENG_PER_TX_START          0x01
#define WL_PKTENG_PER_TX_STOP           0x02
#define WL_PKTENG_PER_RX_START          0x04
#define WL_PKTENG_PER_RX_WITH_ACK_START     0x05
#define WL_PKTENG_PER_TX_WITH_ACK_START     0x06
#define WL_PKTENG_PER_RX_STOP           0x08
#define WL_PKTENG_PER_MASK          0xff

#define WL_PKTENG_SYNCHRONOUS           0x100   

typedef struct wl_pkteng {
	uint32 flags;
	uint32 delay;           
	uint32 nframes;         
	uint32 length;          
	uint8  seqno;           
	struct ether_addr dest;     
	struct ether_addr src;      
} wl_pkteng_t;

#define NUM_80211b_RATES    4
#define NUM_80211ag_RATES   8
#define NUM_80211n_RATES    32
#define NUM_80211_RATES     (NUM_80211b_RATES+NUM_80211ag_RATES+NUM_80211n_RATES)
typedef struct wl_pkteng_stats {
	uint32 lostfrmcnt;      
	int32 rssi;         
	int32 snr;          
	uint16 rxpktcnt[NUM_80211_RATES+1];
} wl_pkteng_stats_t;


#define WL_WOWL_MAGIC   (1 << 0)    
#define WL_WOWL_NET (1 << 1)    
#define WL_WOWL_DIS (1 << 2)    
#define WL_WOWL_RETR    (1 << 3)    
#define WL_WOWL_BCN (1 << 4)    
#define WL_WOWL_TST (1 << 5)    
#define WL_WOWL_M1      (1 << 6)        
#define WL_WOWL_EAPID   (1 << 7)        
#define WL_WOWL_KEYROT  (1 << 14)       
#define WL_WOWL_BCAST   (1 << 15)   

#define MAGIC_PKT_MINLEN 102    

typedef struct {
	uint masksize;      
	uint offset;        
	uint patternoffset; 
	uint patternsize;   
	ulong id;       
	
	
} wl_wowl_pattern_t;

typedef struct {
	uint            count;
	wl_wowl_pattern_t   pattern[1];
} wl_wowl_pattern_list_t;

typedef struct {
	uint8   pci_wakeind;    
	uint16  ucode_wakeind;  
} wl_wowl_wakeind_t;


typedef struct wl_txrate_class {
	uint8       init_rate;
	uint8       min_rate;
	uint8       max_rate;
} wl_txrate_class_t;




#define WLC_OBSS_SCAN_PASSIVE_DWELL_DEFAULT     20  
#define WLC_OBSS_SCAN_PASSIVE_DWELL_MIN         5   
#define WLC_OBSS_SCAN_PASSIVE_DWELL_MAX         1000    
#define WLC_OBSS_SCAN_ACTIVE_DWELL_DEFAULT      10  
#define WLC_OBSS_SCAN_ACTIVE_DWELL_MIN          10  
#define WLC_OBSS_SCAN_ACTIVE_DWELL_MAX          1000    
#define WLC_OBSS_SCAN_WIDTHSCAN_INTERVAL_DEFAULT    300 
#define WLC_OBSS_SCAN_WIDTHSCAN_INTERVAL_MIN        10  
#define WLC_OBSS_SCAN_WIDTHSCAN_INTERVAL_MAX        900 
#define WLC_OBSS_SCAN_CHANWIDTH_TRANSITION_DLY_DEFAULT  5
#define WLC_OBSS_SCAN_CHANWIDTH_TRANSITION_DLY_MIN  5
#define WLC_OBSS_SCAN_CHANWIDTH_TRANSITION_DLY_MAX  100
#define WLC_OBSS_SCAN_PASSIVE_TOTAL_PER_CHANNEL_DEFAULT 200 
#define WLC_OBSS_SCAN_PASSIVE_TOTAL_PER_CHANNEL_MIN 200 
#define WLC_OBSS_SCAN_PASSIVE_TOTAL_PER_CHANNEL_MAX 10000   
#define WLC_OBSS_SCAN_ACTIVE_TOTAL_PER_CHANNEL_DEFAULT  20  
#define WLC_OBSS_SCAN_ACTIVE_TOTAL_PER_CHANNEL_MIN  20  
#define WLC_OBSS_SCAN_ACTIVE_TOTAL_PER_CHANNEL_MAX  10000   
#define WLC_OBSS_SCAN_ACTIVITY_THRESHOLD_DEFAULT    25  
#define WLC_OBSS_SCAN_ACTIVITY_THRESHOLD_MIN        0   
#define WLC_OBSS_SCAN_ACTIVITY_THRESHOLD_MAX        100 


typedef struct wl_obss_scan_arg {
	int16   passive_dwell;
	int16   active_dwell;
	int16   bss_widthscan_interval;
	int16   passive_total;
	int16   active_total;
	int16   chanwidth_transition_delay;
	int16   activity_threshold;
} wl_obss_scan_arg_t;

#define WL_OBSS_SCAN_PARAM_LEN  sizeof(wl_obss_scan_arg_t)
#define WL_MIN_NUM_OBSS_SCAN_ARG 7  

#define WL_COEX_INFO_MASK       0x07
#define WL_COEX_INFO_REQ        0x01
#define WL_COEX_40MHZ_INTOLERANT    0x02
#define WL_COEX_WIDTH20         0x04

#define WLC_RSSI_INVALID     0  

#define MAX_RSSI_LEVELS 8


typedef struct wl_rssi_event {
	uint32 rate_limit_msec;     
	uint8 num_rssi_levels;      
	int8 rssi_levels[MAX_RSSI_LEVELS];  
} wl_rssi_event_t;

typedef struct wl_action_obss_coex_req {
	uint8 info;
	uint8 num;
	uint8 ch_list[1];
} wl_action_obss_coex_req_t;


#define EXTLOG_CUR_VER      0x0100

#define MAX_ARGSTR_LEN      18 


#define LOG_MODULE_COMMON   0x0001
#define LOG_MODULE_ASSOC    0x0002
#define LOG_MODULE_EVENT    0x0004
#define LOG_MODULE_MAX      3           


#define WL_LOG_LEVEL_DISABLE    0
#define WL_LOG_LEVEL_ERR    1
#define WL_LOG_LEVEL_WARN   2
#define WL_LOG_LEVEL_INFO   3
#define WL_LOG_LEVEL_MAX    WL_LOG_LEVEL_INFO   


#define LOG_FLAG_EVENT      1


#define LOG_ARGTYPE_NULL    0
#define LOG_ARGTYPE_STR     1   
#define LOG_ARGTYPE_INT     2   
#define LOG_ARGTYPE_INT_STR 3   
#define LOG_ARGTYPE_STR_INT 4   

typedef struct wlc_extlog_cfg {
	int max_number;
	uint16 module;  
	uint8 level;
	uint8 flag;
	uint16 version;
} wlc_extlog_cfg_t;

typedef struct log_record {
	uint32 time;
	uint16 module;
	uint16 id;
	uint8 level;
	uint8 sub_unit;
	uint8 seq_num;
	int32 arg;
	char str[MAX_ARGSTR_LEN];
} log_record_t;

typedef struct wlc_extlog_req {
	uint32 from_last;
	uint32 num;
} wlc_extlog_req_t;

typedef struct wlc_extlog_results {
	uint16 version;
	uint16 record_len;
	uint32 num;
	log_record_t logs[1];
} wlc_extlog_results_t;

typedef struct log_idstr {
	uint16  id;
	uint16  flag;
	uint8   arg_type;
	const char  *fmt_str;
} log_idstr_t;

#define FMTSTRF_USER        1


typedef enum {
	FMTSTR_DRIVER_UP_ID = 0,
	FMTSTR_DRIVER_DOWN_ID = 1,
	FMTSTR_SUSPEND_MAC_FAIL_ID = 2,
	FMTSTR_NO_PROGRESS_ID = 3,
	FMTSTR_RFDISABLE_ID = 4,
	FMTSTR_REG_PRINT_ID = 5,
	FMTSTR_EXPTIME_ID = 6,
	FMTSTR_JOIN_START_ID = 7,
	FMTSTR_JOIN_COMPLETE_ID = 8,
	FMTSTR_NO_NETWORKS_ID = 9,
	FMTSTR_SECURITY_MISMATCH_ID = 10,
	FMTSTR_RATE_MISMATCH_ID = 11,
	FMTSTR_AP_PRUNED_ID = 12,
	FMTSTR_KEY_INSERTED_ID = 13,
	FMTSTR_DEAUTH_ID = 14,
	FMTSTR_DISASSOC_ID = 15,
	FMTSTR_LINK_UP_ID = 16,
	FMTSTR_LINK_DOWN_ID = 17,
	FMTSTR_RADIO_HW_OFF_ID = 18,
	FMTSTR_RADIO_HW_ON_ID = 19,
	FMTSTR_EVENT_DESC_ID = 20,
	FMTSTR_PNP_SET_POWER_ID = 21,
	FMTSTR_RADIO_SW_OFF_ID = 22,
	FMTSTR_RADIO_SW_ON_ID = 23,
	FMTSTR_PWD_MISMATCH_ID = 24,
	FMTSTR_FATAL_ERROR_ID = 25,
	FMTSTR_AUTH_FAIL_ID = 26,
	FMTSTR_ASSOC_FAIL_ID = 27,
	FMTSTR_IBSS_FAIL_ID = 28,
	FMTSTR_EXTAP_FAIL_ID = 29,
	FMTSTR_MAX_ID
} log_fmtstr_id_t;

#ifdef DONGLEOVERLAYS
typedef struct {
	uint32 flags_idx;	
	uint32 offset;		
	uint32 len;			
	
} wl_ioctl_overlay_t;

#define OVERLAY_IDX_MASK		0x000000ff
#define OVERLAY_IDX_SHIFT		0
#define OVERLAY_FLAGS_MASK		0xffffff00
#define OVERLAY_FLAGS_SHIFT		8

#define OVERLAY_FLAG_POSTLOAD	0x100

#define OVERLAY_FLAG_DEFER_DL	0x200

#define OVERLAY_FLAG_PRESLEEP	0x400

#define OVERLAY_DOWNLOAD_CHUNKSIZE	1024
#endif 


#include <packed_section_end.h>


#include <packed_section_start.h>

#define VNDR_IE_CMD_LEN     4   


#define VNDR_IE_BEACON_FLAG 0x1
#define VNDR_IE_PRBRSP_FLAG 0x2
#define VNDR_IE_ASSOCRSP_FLAG   0x4
#define VNDR_IE_AUTHRSP_FLAG    0x8
#define VNDR_IE_PRBREQ_FLAG 0x10
#define VNDR_IE_ASSOCREQ_FLAG   0x20
#define VNDR_IE_CUSTOM_FLAG 0x100 

#define VNDR_IE_INFO_HDR_LEN    (sizeof(uint32))

typedef BWL_PRE_PACKED_STRUCT struct {
	uint32 pktflag;         
	vndr_ie_t vndr_ie_data;     
} BWL_POST_PACKED_STRUCT vndr_ie_info_t;

typedef BWL_PRE_PACKED_STRUCT struct {
	int iecount;            
	vndr_ie_info_t vndr_ie_list[1]; 
} BWL_POST_PACKED_STRUCT vndr_ie_buf_t;

typedef BWL_PRE_PACKED_STRUCT struct {
	char cmd[VNDR_IE_CMD_LEN];  
	vndr_ie_buf_t vndr_ie_buffer;   
} BWL_POST_PACKED_STRUCT vndr_ie_setbuf_t;



typedef BWL_PRE_PACKED_STRUCT struct sta_prbreq_wps_ie_hdr {
	struct ether_addr staAddr;
	uint16 ieLen;
} BWL_POST_PACKED_STRUCT sta_prbreq_wps_ie_hdr_t;

typedef BWL_PRE_PACKED_STRUCT struct sta_prbreq_wps_ie_data {
	sta_prbreq_wps_ie_hdr_t hdr;
	uint8 ieData[1];
} BWL_POST_PACKED_STRUCT sta_prbreq_wps_ie_data_t;

typedef BWL_PRE_PACKED_STRUCT struct sta_prbreq_wps_ie_list {
	uint32 totLen;
	uint8 ieDataList[1];
} BWL_POST_PACKED_STRUCT sta_prbreq_wps_ie_list_t;


#ifdef WLMEDIA_TXFAILEVENT
typedef BWL_PRE_PACKED_STRUCT struct {
	char   dest[ETHER_ADDR_LEN]; 
	uint8  prio;            
	uint8  flags;           
	uint32 tsf_l;           
	uint32 tsf_h;           
	uint16 rates;           
	uint16 txstatus;        
} BWL_POST_PACKED_STRUCT txfailinfo_t;
#endif 

#include <packed_section_end.h>


#define ASSERTLOG_CUR_VER   0x0100
#define MAX_ASSRTSTR_LEN    64

typedef struct assert_record {
	uint32 time;
	uint8 seq_num;
	char str[MAX_ASSRTSTR_LEN];
} assert_record_t;

typedef struct assertlog_results {
	uint16 version;
	uint16 record_len;
	uint32 num;
	assert_record_t logs[1];
} assertlog_results_t;

#define LOGRRC_FIX_LEN  8
#define IOBUF_ALLOWED_NUM_OF_LOGREC(type, len) ((len - LOGRRC_FIX_LEN)/sizeof(type))





#define CHANIM_DISABLE  0   
#define CHANIM_DETECT   1   
#define CHANIM_ACT  2   
#define CHANIM_MODE_MAX 2


#define APCS_IOCTL      1
#define APCS_CHANIM     2
#define APCS_CSTIMER    3
#define APCS_BTA        4


#define CHANIM_ACS_RECORD           10


typedef struct {
	bool valid;
	uint8 trigger;
	chanspec_t selected_chspc;
	uint32 glitch_cnt;
	uint8 ccastats;
	uint timestamp;
} chanim_acs_record_t;

typedef struct {
	chanim_acs_record_t acs_record[CHANIM_ACS_RECORD];
	uint8 count;
	uint timestamp;
} wl_acs_record_t;



#define SMFS_VERSION 1

typedef struct wl_smfs_elem {
	uint32 count;
	uint16 code;  
} wl_smfs_elem_t;

typedef struct wl_smf_stats {
	uint32 version;
	uint16 length;  
	uint8 type;
	uint8 codetype;
	uint32 ignored_cnt;
	uint32 malformed_cnt;
	uint32 count_total; 
	wl_smfs_elem_t elem[1];
} wl_smf_stats_t;

#define WL_SMFSTATS_FIXED_LEN OFFSETOF(wl_smf_stats_t, elem);

enum {
	SMFS_CODETYPE_SC,
	SMFS_CODETYPE_RC
};


#define SMFS_CODE_MALFORMED 0xFFFE
#define SMFS_CODE_IGNORED   0xFFFD

typedef enum smfs_type {
	SMFS_TYPE_AUTH,
	SMFS_TYPE_ASSOC,
	SMFS_TYPE_REASSOC,
	SMFS_TYPE_DISASSOC_TX,
	SMFS_TYPE_DISASSOC_RX,
	SMFS_TYPE_DEAUTH_TX,
	SMFS_TYPE_DEAUTH_RX,
	SMFS_TYPE_MAX
} smfs_type_t;

#ifdef PHYMON

#define PHYMON_VERSION 1

typedef struct wl_phycal_core_state {
	
	int16 tx_iqlocal_a;
	int16 tx_iqlocal_b;
	int8 tx_iqlocal_ci;
	int8 tx_iqlocal_cq;
	int8 tx_iqlocal_di;
	int8 tx_iqlocal_dq;
	int8 tx_iqlocal_ei;
	int8 tx_iqlocal_eq;
	int8 tx_iqlocal_fi;
	int8 tx_iqlocal_fq;

	
	int16 rx_iqcal_a;
	int16 rx_iqcal_b;

	uint8 tx_iqlocal_pwridx; 
	uint32 papd_epsilon_table[64]; 
	int16 papd_epsilon_offset; 
	uint8 curr_tx_pwrindex; 
	int8 idle_tssi; 
	int8 est_tx_pwr; 
	int8 est_rx_pwr; 
	uint16 rx_gaininfo; 
	uint16 init_gaincode; 
	int8 estirr_tx;
	int8 estirr_rx;

} wl_phycal_core_state_t;

typedef struct wl_phycal_state {
	int version;
	int8 num_phy_cores; 
	int8 curr_temperature; 
	chanspec_t chspec; 
	bool aci_state; 
	uint16 crsminpower; 
	uint16 crsminpowerl; 
	uint16 crsminpoweru; 
	wl_phycal_core_state_t phycal_core[1];
} wl_phycal_state_t;

#define WL_PHYCAL_STAT_FIXED_LEN OFFSETOF(wl_phycal_state_t, phycal_core)
#endif 

#ifdef WLDSTA
typedef struct wl_dsta_if {
	struct ether_addr addr;
} wl_dsta_if_t;
#endif

#ifdef WLP2P

typedef struct wl_p2p_disc_st {
	uint8 state;    
	chanspec_t chspec;  
	uint16 dwell;   
} wl_p2p_disc_st_t;


#define WL_P2P_DISC_ST_SCAN 0
#define WL_P2P_DISC_ST_LISTEN   1
#define WL_P2P_DISC_ST_SEARCH   2


typedef struct wl_p2p_scan {
	uint8 type;     
	uint8 reserved[3];
	
} wl_p2p_scan_t;


typedef struct wl_p2p_if {
	struct ether_addr addr;
	uint8 type; 
	chanspec_t chspec;  
} wl_p2p_if_t;


#define WL_P2P_IF_CLIENT    0
#define WL_P2P_IF_GO        1
#define WL_P2P_IF_DYNBCN_GO     2
#define WL_P2P_IF_DEV       3


typedef struct wl_p2p_ifq {
	uint bsscfgidx;
	char ifname[BCM_MSG_IFNAME_MAX];
} wl_p2p_ifq_t;


typedef struct wl_p2p_ops {
	uint8 ops;  
	uint8 ctw;  
} wl_p2p_ops_t;


typedef struct wl_p2p_sched_desc {
	uint32 start;
	uint32 interval;
	uint32 duration;
	uint32 count;   
} wl_p2p_sched_desc_t;


#define WL_P2P_SCHED_RSVD   0
#define WL_P2P_SCHED_REPEAT 255 

typedef struct wl_p2p_sched {
	uint8 type; 
	uint8 action;   
	uint8 option;   
	wl_p2p_sched_desc_t desc[1];
} wl_p2p_sched_t;
#define WL_P2P_SCHED_FIXED_LEN      3


#define WL_P2P_SCHED_TYPE_ABS       0   
#define WL_P2P_SCHED_TYPE_REQ_ABS   1   


#define WL_P2P_SCHED_ACTION_NONE    0   
#define WL_P2P_SCHED_ACTION_DOZE    1   

#define WL_P2P_SCHED_ACTION_GOOFF   2   

#define WL_P2P_SCHED_ACTION_RESET   255 


#define WL_P2P_SCHED_OPTION_NORMAL  0   
#define WL_P2P_SCHED_OPTION_BCNPCT  1   

#define WL_P2P_SCHED_OPTION_TSFOFS  2   


#define WL_P2P_FEAT_GO_CSA      (1 << 0)        
#define WL_P2P_FEAT_GO_NOLEGACY (1 << 1)        
#define WL_P2P_FEAT_RESTRICT_DEV_RESP (1 << 2)  
#endif 


#define BCM_ACTION_RFAWARE      0x77
#define BCM_ACTION_RFAWARE_DCS  0x01



#define WL_11N_2x2          1
#define WL_11N_3x3          3
#define WL_11N_4x4          4


#define WLFEATURE_DISABLE_11N       0x00000001
#define WLFEATURE_DISABLE_11N_STBC_TX   0x00000002
#define WLFEATURE_DISABLE_11N_STBC_RX   0x00000004
#define WLFEATURE_DISABLE_11N_SGI_TX    0x00000008
#define WLFEATURE_DISABLE_11N_SGI_RX    0x00000010
#define WLFEATURE_DISABLE_11N_AMPDU_TX  0x00000020
#define WLFEATURE_DISABLE_11N_AMPDU_RX  0x00000040
#define WLFEATURE_DISABLE_11N_GF    0x00000080


#define LQ_IDX_LAST             3
#define MCS_INDEX_SIZE          33

#define LQ_IDX_MIN              0
#define LQ_IDX_MAX              1
#define LQ_IDX_AVG              2
#define LQ_IDX_SUM              2
#define LQ_IDX_LAST             3
#define LQ_STOP_MONITOR         0
#define LQ_START_MONITOR        1

#define LINKQUAL_V1     0x01

struct  wl_lq {
	int32 enable;
	int32 rssi[LQ_IDX_LAST];    
	int32 rssicnt;
	int32 snr[LQ_IDX_LAST];     
	uint32 nsamples;            
	uint8 isvalid;              
	uint8 version;
}; 

typedef struct wl_lq wl_lq_t;
typedef struct wl_lq  wl_lq_stats_t;

typedef struct {
	struct  ether_addr ea;  
	uint8   ac_cat; 
	uint8   num_pkts;   
} wl_mac_ratehisto_cmd_t;   


typedef struct {
	uint32  rate[WLC_MAXRATE + 1];  
	uint32  mcs_index[MCS_INDEX_SIZE];  
	uint32  tsf_timer[2][2];    
} wl_mac_ratehisto_res_t;   

#ifdef PROP_TXSTATUS


#define WLFC_FLAGS_RSSI_SIGNALS                         1


#define WLFC_FLAGS_XONXOFF_SIGNALS                      2


#define WLFC_FLAGS_CREDIT_STATUS_SIGNALS        4

#define WLFC_FLAGS_HOST_PROPTXSTATUS_ACTIVE     8
#define WLFC_FLAGS_PSQ_GENERATIONFSM_ENABLE     16
#define WLFC_FLAGS_PSQ_ZERO_BUFFER_ENABLE	32
#endif 

#define BTA_STATE_LOG_SZ    64


enum {
	HCIReset = 1,
	HCIReadLocalAMPInfo,
	HCIReadLocalAMPASSOC,
	HCIWriteRemoteAMPASSOC,
	HCICreatePhysicalLink,
	HCIAcceptPhysicalLinkRequest,
	HCIDisconnectPhysicalLink,
	HCICreateLogicalLink,
	HCIAcceptLogicalLink,
	HCIDisconnectLogicalLink,
	HCILogicalLinkCancel,
	HCIAmpStateChange,
	HCIWriteLogicalLinkAcceptTimeout
};

typedef struct flush_txfifo {
	uint32 txfifobmp;
	uint32 hwtxfifoflush;
	struct ether_addr ea;
} flush_txfifo_t;

#define CHANNEL_5G_LOW_START    36      
#define CHANNEL_5G_MID_START    52      
#define CHANNEL_5G_HIGH_START   100     
#define CHANNEL_5G_UPPER_START  149     

enum {
	SPATIAL_MODE_2G_IDX = 0,
	SPATIAL_MODE_5G_LOW_IDX,
	SPATIAL_MODE_5G_MID_IDX,
	SPATIAL_MODE_5G_HIGH_IDX,
	SPATIAL_MODE_5G_UPPER_IDX,
	SPATIAL_MODE_MAX_IDX
};

#endif