1 /*
2 *************************************************************************
3 * Ralink Tech Inc.
4 * 5F., No.36, Taiyuan St., Jhubei City,
5 * Hsinchu County 302,
6 * Taiwan, R.O.C.
7 *
8 * (c) Copyright 2002-2007, Ralink Technology, Inc.
9 *
10 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU General Public License as published by *
12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. *
14 * *
15 * This program is distributed in the hope that it will be useful, *
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
18 * GNU General Public License for more details. *
19 * *
20 * You should have received a copy of the GNU General Public License *
21 * along with this program; if not, write to the *
22 * Free Software Foundation, Inc., *
23 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
24 * *
25 *************************************************************************
26 */
27 #include "../rt_config.h"
28
29 struct rt_ch_freq_map CH_HZ_ID_MAP[] = {
30 {1, 2412}
31 ,
32 {2, 2417}
33 ,
34 {3, 2422}
35 ,
36 {4, 2427}
37 ,
38 {5, 2432}
39 ,
40 {6, 2437}
41 ,
42 {7, 2442}
43 ,
44 {8, 2447}
45 ,
46 {9, 2452}
47 ,
48 {10, 2457}
49 ,
50 {11, 2462}
51 ,
52 {12, 2467}
53 ,
54 {13, 2472}
55 ,
56 {14, 2484}
57 ,
58
59 /* UNII */
60 {36, 5180}
61 ,
62 {40, 5200}
63 ,
64 {44, 5220}
65 ,
66 {48, 5240}
67 ,
68 {52, 5260}
69 ,
70 {56, 5280}
71 ,
72 {60, 5300}
73 ,
74 {64, 5320}
75 ,
76 {149, 5745}
77 ,
78 {153, 5765}
79 ,
80 {157, 5785}
81 ,
82 {161, 5805}
83 ,
84 {165, 5825}
85 ,
86 {167, 5835}
87 ,
88 {169, 5845}
89 ,
90 {171, 5855}
91 ,
92 {173, 5865}
93 ,
94
95 /* HiperLAN2 */
96 {100, 5500}
97 ,
98 {104, 5520}
99 ,
100 {108, 5540}
101 ,
102 {112, 5560}
103 ,
104 {116, 5580}
105 ,
106 {120, 5600}
107 ,
108 {124, 5620}
109 ,
110 {128, 5640}
111 ,
112 {132, 5660}
113 ,
114 {136, 5680}
115 ,
116 {140, 5700}
117 ,
118
119 /* Japan MMAC */
120 {34, 5170}
121 ,
122 {38, 5190}
123 ,
124 {42, 5210}
125 ,
126 {46, 5230}
127 ,
128
129 /* Japan */
130 {184, 4920}
131 ,
132 {188, 4940}
133 ,
134 {192, 4960}
135 ,
136 {196, 4980}
137 ,
138
139 {208, 5040}
140 , /* Japan, means J08 */
141 {212, 5060}
142 , /* Japan, means J12 */
143 {216, 5080}
144 , /* Japan, means J16 */
145 };
146
147 int CH_HZ_ID_MAP_NUM = (sizeof(CH_HZ_ID_MAP) / sizeof(struct rt_ch_freq_map));
148
149 struct rt_ch_region ChRegion[] = {
150 { /* Antigua and Berbuda */
151 "AG",
152 CE,
153 {
154 {1, 13, 20, BOTH, FALSE}
155 , /* 2.4 G, ch 1~13 */
156 {36, 4, 23, BOTH, FALSE}
157 , /* 5G, ch 36~48 */
158 {52, 4, 23, BOTH, FALSE}
159 , /* 5G, ch 52~64 */
160 {100, 11, 30, BOTH, FALSE}
161 , /* 5G, ch 100~140 */
162 {0}
163 , /* end */
164 }
165 }
166 ,
167
168 { /* Argentina */
169 "AR",
170 CE,
171 {
172 {1, 13, 20, BOTH, FALSE}
173 , /* 2.4 G, ch 1~13 */
174 {52, 4, 24, BOTH, FALSE}
175 , /* 5G, ch 52~64 */
176 {149, 4, 30, BOTH, FALSE}
177 , /* 5G, ch 149~161 */
178 {0}
179 , /* end */
180 }
181 }
182 ,
183
184 { /* Aruba */
185 "AW",
186 CE,
187 {
188 {1, 13, 20, BOTH, FALSE}
189 , /* 2.4 G, ch 1~13 */
190 {36, 4, 23, BOTH, FALSE}
191 , /* 5G, ch 36~48 */
192 {52, 4, 23, BOTH, FALSE}
193 , /* 5G, ch 52~64 */
194 {100, 11, 30, BOTH, FALSE}
195 , /* 5G, ch 100~140 */
196 {0}
197 , /* end */
198 }
199 }
200 ,
201
202 { /* Australia */
203 "AU",
204 CE,
205 {
206 {1, 13, 20, BOTH, FALSE}
207 , /* 2.4 G, ch 1~13 */
208 {36, 4, 23, BOTH, FALSE}
209 , /* 5G, ch 36~48 */
210 {52, 4, 24, BOTH, FALSE}
211 , /* 5G, ch 52~64 */
212 {149, 5, 30, BOTH, FALSE}
213 , /* 5G, ch 149~165 */
214 {0}
215 , /* end */
216 }
217 }
218 ,
219
220 { /* Austria */
221 "AT",
222 CE,
223 {
224 {1, 13, 20, BOTH, FALSE}
225 , /* 2.4 G, ch 1~13 */
226 {36, 4, 23, IDOR, TRUE}
227 , /* 5G, ch 36~48 */
228 {52, 4, 23, IDOR, TRUE}
229 , /* 5G, ch 52~64 */
230 {100, 11, 30, BOTH, TRUE}
231 , /* 5G, ch 100~140 */
232 {0}
233 , /* end */
234 }
235 }
236 ,
237
238 { /* Bahamas */
239 "BS",
240 CE,
241 {
242 {1, 13, 20, BOTH, FALSE}
243 , /* 2.4 G, ch 1~13 */
244 {36, 4, 23, BOTH, FALSE}
245 , /* 5G, ch 36~48 */
246 {52, 4, 24, BOTH, FALSE}
247 , /* 5G, ch 52~64 */
248 {149, 5, 30, BOTH, FALSE}
249 , /* 5G, ch 149~165 */
250 {0}
251 , /* end */
252 }
253 }
254 ,
255
256 { /* Barbados */
257 "BB",
258 CE,
259 {
260 {1, 13, 20, BOTH, FALSE}
261 , /* 2.4 G, ch 1~13 */
262 {36, 4, 23, BOTH, FALSE}
263 , /* 5G, ch 36~48 */
264 {52, 4, 24, BOTH, FALSE}
265 , /* 5G, ch 52~64 */
266 {100, 11, 30, BOTH, FALSE}
267 , /* 5G, ch 100~140 */
268 {0}
269 , /* end */
270 }
271 }
272 ,
273
274 { /* Bermuda */
275 "BM",
276 CE,
277 {
278 {1, 13, 20, BOTH, FALSE}
279 , /* 2.4 G, ch 1~13 */
280 {36, 4, 23, BOTH, FALSE}
281 , /* 5G, ch 36~48 */
282 {52, 4, 24, BOTH, FALSE}
283 , /* 5G, ch 52~64 */
284 {100, 11, 30, BOTH, FALSE}
285 , /* 5G, ch 100~140 */
286 {0}
287 , /* end */
288 }
289 }
290 ,
291
292 { /* Brazil */
293 "BR",
294 CE,
295 {
296 {1, 13, 20, BOTH, FALSE}
297 , /* 2.4 G, ch 1~13 */
298 {36, 4, 23, BOTH, FALSE}
299 , /* 5G, ch 36~48 */
300 {52, 4, 24, BOTH, FALSE}
301 , /* 5G, ch 52~64 */
302 {100, 11, 24, BOTH, FALSE}
303 , /* 5G, ch 100~140 */
304 {149, 5, 30, BOTH, FALSE}
305 , /* 5G, ch 100~140 */
306 {0}
307 , /* end */
308 }
309 }
310 ,
311
312 { /* Belgium */
313 "BE",
314 CE,
315 {
316 {1, 13, 20, BOTH, FALSE}
317 , /* 2.4 G, ch 1~13 */
318 {36, 4, 18, IDOR, FALSE}
319 , /* 5G, ch 36~48 */
320 {52, 4, 18, IDOR, FALSE}
321 , /* 5G, ch 52~64 */
322 {0}
323 , /* end */
324 }
325 }
326 ,
327
328 { /* Bulgaria */
329 "BG",
330 CE,
331 {
332 {1, 13, 20, BOTH, FALSE}
333 , /* 2.4 G, ch 1~13 */
334 {36, 4, 23, IDOR, FALSE}
335 , /* 5G, ch 36~48 */
336 {52, 4, 23, IDOR, TRUE}
337 , /* 5G, ch 52~64 */
338 {100, 11, 30, ODOR, TRUE}
339 , /* 5G, ch 100~140 */
340 {0}
341 , /* end */
342 }
343 }
344 ,
345
346 { /* Canada */
347 "CA",
348 CE,
349 {
350 {1, 13, 20, BOTH, FALSE}
351 , /* 2.4 G, ch 1~13 */
352 {36, 4, 23, BOTH, FALSE}
353 , /* 5G, ch 36~48 */
354 {52, 4, 23, BOTH, FALSE}
355 , /* 5G, ch 52~64 */
356 {149, 5, 30, BOTH, FALSE}
357 , /* 5G, ch 149~165 */
358 {0}
359 , /* end */
360 }
361 }
362 ,
363
364 { /* Cayman IsLands */
365 "KY",
366 CE,
367 {
368 {1, 13, 20, BOTH, FALSE}
369 , /* 2.4 G, ch 1~13 */
370 {36, 4, 23, BOTH, FALSE}
371 , /* 5G, ch 36~48 */
372 {52, 4, 24, BOTH, FALSE}
373 , /* 5G, ch 52~64 */
374 {100, 11, 30, BOTH, FALSE}
375 , /* 5G, ch 100~140 */
376 {0}
377 , /* end */
378 }
379 }
380 ,
381
382 { /* Chile */
383 "CL",
384 CE,
385 {
386 {1, 13, 20, BOTH, FALSE}
387 , /* 2.4 G, ch 1~13 */
388 {36, 4, 20, BOTH, FALSE}
389 , /* 5G, ch 36~48 */
390 {52, 4, 20, BOTH, FALSE}
391 , /* 5G, ch 52~64 */
392 {149, 5, 20, BOTH, FALSE}
393 , /* 5G, ch 149~165 */
394 {0}
395 , /* end */
396 }
397 }
398 ,
399
400 { /* China */
401 "CN",
402 CE,
403 {
404 {1, 13, 20, BOTH, FALSE}
405 , /* 2.4 G, ch 1~13 */
406 {149, 4, 27, BOTH, FALSE}
407 , /* 5G, ch 149~161 */
408 {0}
409 , /* end */
410 }
411 }
412 ,
413
414 { /* Colombia */
415 "CO",
416 CE,
417 {
418 {1, 13, 20, BOTH, FALSE}
419 , /* 2.4 G, ch 1~13 */
420 {36, 4, 17, BOTH, FALSE}
421 , /* 5G, ch 36~48 */
422 {52, 4, 24, BOTH, FALSE}
423 , /* 5G, ch 52~64 */
424 {100, 11, 30, BOTH, FALSE}
425 , /* 5G, ch 100~140 */
426 {149, 5, 30, BOTH, FALSE}
427 , /* 5G, ch 149~165 */
428 {0}
429 , /* end */
430 }
431 }
432 ,
433
434 { /* Costa Rica */
435 "CR",
436 CE,
437 {
438 {1, 13, 20, BOTH, FALSE}
439 , /* 2.4 G, ch 1~13 */
440 {36, 4, 17, BOTH, FALSE}
441 , /* 5G, ch 36~48 */
442 {52, 4, 24, BOTH, FALSE}
443 , /* 5G, ch 52~64 */
444 {149, 4, 30, BOTH, FALSE}
445 , /* 5G, ch 149~161 */
446 {0}
447 , /* end */
448 }
449 }
450 ,
451
452 { /* Cyprus */
453 "CY",
454 CE,
455 {
456 {1, 13, 20, BOTH, FALSE}
457 , /* 2.4 G, ch 1~13 */
458 {36, 4, 23, IDOR, FALSE}
459 , /* 5G, ch 36~48 */
460 {52, 4, 24, IDOR, TRUE}
461 , /* 5G, ch 52~64 */
462 {100, 11, 30, BOTH, TRUE}
463 , /* 5G, ch 100~140 */
464 {0}
465 , /* end */
466 }
467 }
468 ,
469
470 { /* Czech_Republic */
471 "CZ",
472 CE,
473 {
474 {1, 13, 20, BOTH, FALSE}
475 , /* 2.4 G, ch 1~13 */
476 {36, 4, 23, IDOR, FALSE}
477 , /* 5G, ch 36~48 */
478 {52, 4, 23, IDOR, TRUE}
479 , /* 5G, ch 52~64 */
480 {0}
481 , /* end */
482 }
483 }
484 ,
485
486 { /* Denmark */
487 "DK",
488 CE,
489 {
490 {1, 13, 20, BOTH, FALSE}
491 , /* 2.4 G, ch 1~13 */
492 {36, 4, 23, IDOR, FALSE}
493 , /* 5G, ch 36~48 */
494 {52, 4, 23, IDOR, TRUE}
495 , /* 5G, ch 52~64 */
496 {100, 11, 30, BOTH, TRUE}
497 , /* 5G, ch 100~140 */
498 {0}
499 , /* end */
500 }
501 }
502 ,
503
504 { /* Dominican Republic */
505 "DO",
506 CE,
507 {
508 {1, 0, 20, BOTH, FALSE}
509 , /* 2.4 G, ch 0 */
510 {149, 4, 20, BOTH, FALSE}
511 , /* 5G, ch 149~161 */
512 {0}
513 , /* end */
514 }
515 }
516 ,
517
518 { /* Equador */
519 "EC",
520 CE,
521 {
522 {1, 13, 20, BOTH, FALSE}
523 , /* 2.4 G, ch 1~13 */
524 {100, 11, 27, BOTH, FALSE}
525 , /* 5G, ch 100~140 */
526 {0}
527 , /* end */
528 }
529 }
530 ,
531
532 { /* El Salvador */
533 "SV",
534 CE,
535 {
536 {1, 13, 20, BOTH, FALSE}
537 , /* 2.4 G, ch 1~13 */
538 {36, 4, 23, IDOR, FALSE}
539 , /* 5G, ch 36~48 */
540 {52, 4, 30, BOTH, TRUE}
541 , /* 5G, ch 52~64 */
542 {149, 4, 36, BOTH, TRUE}
543 , /* 5G, ch 149~165 */
544 {0}
545 , /* end */
546 }
547 }
548 ,
549
550 { /* Finland */
551 "FI",
552 CE,
553 {
554 {1, 13, 20, BOTH, FALSE}
555 , /* 2.4 G, ch 1~13 */
556 {36, 4, 23, IDOR, FALSE}
557 , /* 5G, ch 36~48 */
558 {52, 4, 23, IDOR, TRUE}
559 , /* 5G, ch 52~64 */
560 {100, 11, 30, BOTH, TRUE}
561 , /* 5G, ch 100~140 */
562 {0}
563 , /* end */
564 }
565 }
566 ,
567
568 { /* France */
569 "FR",
570 CE,
571 {
572 {1, 13, 20, BOTH, FALSE}
573 , /* 2.4 G, ch 1~13 */
574 {36, 4, 23, IDOR, FALSE}
575 , /* 5G, ch 36~48 */
576 {52, 4, 23, IDOR, TRUE}
577 , /* 5G, ch 52~64 */
578 {0}
579 , /* end */
580 }
581 }
582 ,
583
584 { /* Germany */
585 "DE",
586 CE,
587 {
588 {1, 13, 20, BOTH, FALSE}
589 , /* 2.4 G, ch 1~13 */
590 {36, 4, 23, IDOR, FALSE}
591 , /* 5G, ch 36~48 */
592 {52, 4, 23, IDOR, TRUE}
593 , /* 5G, ch 52~64 */
594 {100, 11, 30, BOTH, TRUE}
595 , /* 5G, ch 100~140 */
596 {0}
597 , /* end */
598 }
599 }
600 ,
601
602 { /* Greece */
603 "GR",
604 CE,
605 {
606 {1, 13, 20, BOTH, FALSE}
607 , /* 2.4 G, ch 1~13 */
608 {36, 4, 23, IDOR, FALSE}
609 , /* 5G, ch 36~48 */
610 {52, 4, 23, IDOR, TRUE}
611 , /* 5G, ch 52~64 */
612 {100, 11, 30, ODOR, TRUE}
613 , /* 5G, ch 100~140 */
614 {0}
615 , /* end */
616 }
617 }
618 ,
619
620 { /* Guam */
621 "GU",
622 CE,
623 {
624 {1, 11, 20, BOTH, FALSE}
625 , /* 2.4 G, ch 1~11 */
626 {36, 4, 17, BOTH, FALSE}
627 , /* 5G, ch 36~48 */
628 {52, 4, 24, BOTH, FALSE}
629 , /* 5G, ch 52~64 */
630 {100, 11, 30, BOTH, FALSE}
631 , /* 5G, ch 100~140 */
632 {149, 5, 30, BOTH, FALSE}
633 , /* 5G, ch 149~165 */
634 {0}
635 , /* end */
636 }
637 }
638 ,
639
640 { /* Guatemala */
641 "GT",
642 CE,
643 {
644 {1, 13, 20, BOTH, FALSE}
645 , /* 2.4 G, ch 1~13 */
646 {36, 4, 17, BOTH, FALSE}
647 , /* 5G, ch 36~48 */
648 {52, 4, 24, BOTH, FALSE}
649 , /* 5G, ch 52~64 */
650 {149, 4, 30, BOTH, FALSE}
651 , /* 5G, ch 149~161 */
652 {0}
653 , /* end */
654 }
655 }
656 ,
657
658 { /* Haiti */
659 "HT",
660 CE,
661 {
662 {1, 13, 20, BOTH, FALSE}
663 , /* 2.4 G, ch 1~13 */
664 {36, 4, 17, BOTH, FALSE}
665 , /* 5G, ch 36~48 */
666 {52, 4, 24, BOTH, FALSE}
667 , /* 5G, ch 52~64 */
668 {149, 4, 30, BOTH, FALSE}
669 , /* 5G, ch 149~161 */
670 {0}
671 , /* end */
672 }
673 }
674 ,
675
676 { /* Honduras */
677 "HN",
678 CE,
679 {
680 {1, 13, 20, BOTH, FALSE}
681 , /* 2.4 G, ch 1~13 */
682 {149, 4, 27, BOTH, FALSE}
683 , /* 5G, ch 149~161 */
684 {0}
685 , /* end */
686 }
687 }
688 ,
689
690 { /* Hong Kong */
691 "HK",
692 CE,
693 {
694 {1, 13, 20, BOTH, FALSE}
695 , /* 2.4 G, ch 1~13 */
696 {36, 4, 23, IDOR, FALSE}
697 , /* 5G, ch 36~48 */
698 {52, 4, 23, IDOR, FALSE}
699 , /* 5G, ch 52~64 */
700 {149, 4, 30, BOTH, FALSE}
701 , /* 5G, ch 149~161 */
702 {0}
703 , /* end */
704 }
705 }
706 ,
707
708 { /* Hungary */
709 "HU",
710 CE,
711 {
712 {1, 13, 20, BOTH, FALSE}
713 , /* 2.4 G, ch 1~13 */
714 {36, 4, 23, IDOR, FALSE}
715 , /* 5G, ch 36~48 */
716 {52, 4, 23, IDOR, TRUE}
717 , /* 5G, ch 52~64 */
718 {0}
719 , /* end */
720 }
721 }
722 ,
723
724 { /* Iceland */
725 "IS",
726 CE,
727 {
728 {1, 13, 20, BOTH, FALSE}
729 , /* 2.4 G, ch 1~13 */
730 {36, 4, 23, IDOR, FALSE}
731 , /* 5G, ch 36~48 */
732 {52, 4, 23, IDOR, TRUE}
733 , /* 5G, ch 52~64 */
734 {100, 11, 30, BOTH, TRUE}
735 , /* 5G, ch 100~140 */
736 {0}
737 , /* end */
738 }
739 }
740 ,
741
742 { /* India */
743 "IN",
744 CE,
745 {
746 {1, 13, 20, BOTH, FALSE}
747 , /* 2.4 G, ch 1~13 */
748 {149, 4, 24, IDOR, FALSE}
749 , /* 5G, ch 149~161 */
750 {0}
751 , /* end */
752 }
753 }
754 ,
755
756 { /* Indonesia */
757 "ID",
758 CE,
759 {
760 {1, 13, 20, BOTH, FALSE}
761 , /* 2.4 G, ch 1~13 */
762 {149, 4, 27, BOTH, FALSE}
763 , /* 5G, ch 149~161 */
764 {0}
765 , /* end */
766 }
767 }
768 ,
769
770 { /* Ireland */
771 "IE",
772 CE,
773 {
774 {1, 13, 20, BOTH, FALSE}
775 , /* 2.4 G, ch 1~13 */
776 {36, 4, 23, IDOR, FALSE}
777 , /* 5G, ch 36~48 */
778 {52, 4, 23, IDOR, TRUE}
779 , /* 5G, ch 52~64 */
780 {100, 11, 30, ODOR, TRUE}
781 , /* 5G, ch 100~140 */
782 {0}
783 , /* end */
784 }
785 }
786 ,
787
788 { /* Israel */
789 "IL",
790 CE,
791 {
792 {1, 3, 20, IDOR, FALSE}
793 , /* 2.4 G, ch 1~3 */
794 {4, 6, 20, BOTH, FALSE}
795 , /* 2.4 G, ch 4~9 */
796 {10, 4, 20, IDOR, FALSE}
797 , /* 2.4 G, ch 10~13 */
798 {0}
799 , /* end */
800 }
801 }
802 ,
803
804 { /* Italy */
805 "IT",
806 CE,
807 {
808 {1, 13, 20, BOTH, FALSE}
809 , /* 2.4 G, ch 1~13 */
810 {36, 4, 23, IDOR, FALSE}
811 , /* 5G, ch 36~48 */
812 {52, 4, 23, IDOR, TRUE}
813 , /* 5G, ch 52~64 */
814 {100, 11, 30, ODOR, TRUE}
815 , /* 5G, ch 100~140 */
816 {0}
817 , /* end */
818 }
819 }
820 ,
821
822 { /* Japan */
823 "JP",
824 JAP,
825 {
826 {1, 14, 20, BOTH, FALSE}
827 , /* 2.4 G, ch 1~14 */
828 {36, 4, 23, IDOR, FALSE}
829 , /* 5G, ch 36~48 */
830 {0}
831 , /* end */
832 }
833 }
834 ,
835
836 { /* Jordan */
837 "JO",
838 CE,
839 {
840 {1, 13, 20, IDOR, FALSE}
841 , /* 2.4 G, ch 1~13 */
842 {36, 4, 23, IDOR, FALSE}
843 , /* 5G, ch 36~48 */
844 {149, 4, 23, IDOR, FALSE}
845 , /* 5G, ch 149~161 */
846 {0}
847 , /* end */
848 }
849 }
850 ,
851
852 { /* Latvia */
853 "LV",
854 CE,
855 {
856 {1, 13, 20, BOTH, FALSE}
857 , /* 2.4 G, ch 1~13 */
858 {36, 4, 23, IDOR, FALSE}
859 , /* 5G, ch 36~48 */
860 {52, 4, 23, IDOR, TRUE}
861 , /* 5G, ch 52~64 */
862 {100, 11, 30, BOTH, TRUE}
863 , /* 5G, ch 100~140 */
864 {0}
865 , /* end */
866 }
867 }
868 ,
869
870 { /* Liechtenstein */
871 "LI",
872 CE,
873 {
874 {1, 13, 20, BOTH, FALSE}
875 , /* 2.4 G, ch 1~13 */
876 {52, 4, 23, IDOR, TRUE}
877 , /* 5G, ch 52~64 */
878 {100, 11, 30, BOTH, TRUE}
879 , /* 5G, ch 100~140 */
880 {0}
881 , /* end */
882 }
883 }
884 ,
885
886 { /* Lithuania */
887 "LT",
888 CE,
889 {
890 {1, 13, 20, BOTH, FALSE}
891 , /* 2.4 G, ch 1~13 */
892 {36, 4, 23, IDOR, FALSE}
893 , /* 5G, ch 36~48 */
894 {52, 4, 23, IDOR, TRUE}
895 , /* 5G, ch 52~64 */
896 {100, 11, 30, BOTH, TRUE}
897 , /* 5G, ch 100~140 */
898 {0}
899 , /* end */
900 }
901 }
902 ,
903
904 { /* Luxemburg */
905 "LU",
906 CE,
907 {
908 {1, 13, 20, BOTH, FALSE}
909 , /* 2.4 G, ch 1~13 */
910 {36, 4, 23, IDOR, FALSE}
911 , /* 5G, ch 36~48 */
912 {52, 4, 23, IDOR, TRUE}
913 , /* 5G, ch 52~64 */
914 {100, 11, 30, BOTH, TRUE}
915 , /* 5G, ch 100~140 */
916 {0}
917 , /* end */
918 }
919 }
920 ,
921
922 { /* Malaysia */
923 "MY",
924 CE,
925 {
926 {36, 4, 23, BOTH, FALSE}
927 , /* 5G, ch 36~48 */
928 {52, 4, 23, BOTH, FALSE}
929 , /* 5G, ch 52~64 */
930 {149, 5, 20, BOTH, FALSE}
931 , /* 5G, ch 149~165 */
932 {0}
933 , /* end */
934 }
935 }
936 ,
937
938 { /* Malta */
939 "MT",
940 CE,
941 {
942 {1, 13, 20, BOTH, FALSE}
943 , /* 2.4 G, ch 1~13 */
944 {36, 4, 23, IDOR, FALSE}
945 , /* 5G, ch 36~48 */
946 {52, 4, 23, IDOR, TRUE}
947 , /* 5G, ch 52~64 */
948 {100, 11, 30, BOTH, TRUE}
949 , /* 5G, ch 100~140 */
950 {0}
951 , /* end */
952 }
953 }
954 ,
955
956 { /* Marocco */
957 "MA",
958 CE,
959 {
960 {1, 13, 20, BOTH, FALSE}
961 , /* 2.4 G, ch 1~13 */
962 {36, 4, 24, IDOR, FALSE}
963 , /* 5G, ch 36~48 */
964 {0}
965 , /* end */
966 }
967 }
968 ,
969
970 { /* Mexico */
971 "MX",
972 CE,
973 {
974 {1, 13, 20, BOTH, FALSE}
975 , /* 2.4 G, ch 1~13 */
976 {36, 4, 23, BOTH, FALSE}
977 , /* 5G, ch 36~48 */
978 {52, 4, 24, BOTH, FALSE}
979 , /* 5G, ch 52~64 */
980 {149, 5, 30, IDOR, FALSE}
981 , /* 5G, ch 149~165 */
982 {0}
983 , /* end */
984 }
985 }
986 ,
987
988 { /* Netherlands */
989 "NL",
990 CE,
991 {
992 {1, 13, 20, BOTH, FALSE}
993 , /* 2.4 G, ch 1~13 */
994 {36, 4, 23, IDOR, FALSE}
995 , /* 5G, ch 36~48 */
996 {52, 4, 24, IDOR, TRUE}
997 , /* 5G, ch 52~64 */
998 {100, 11, 30, BOTH, TRUE}
999 , /* 5G, ch 100~140 */
1000 {0}
1001 , /* end */
1002 }
1003 }
1004 ,
1005
1006 { /* New Zealand */
1007 "NZ",
1008 CE,
1009 {
1010 {1, 13, 20, BOTH, FALSE}
1011 , /* 2.4 G, ch 1~13 */
1012 {36, 4, 24, BOTH, FALSE}
1013 , /* 5G, ch 36~48 */
1014 {52, 4, 24, BOTH, FALSE}
1015 , /* 5G, ch 52~64 */
1016 {149, 4, 30, BOTH, FALSE}
1017 , /* 5G, ch 149~161 */
1018 {0}
1019 , /* end */
1020 }
1021 }
1022 ,
1023
1024 { /* Norway */
1025 "NO",
1026 CE,
1027 {
1028 {1, 13, 20, BOTH, FALSE}
1029 , /* 2.4 G, ch 1~13 */
1030 {36, 4, 24, IDOR, FALSE}
1031 , /* 5G, ch 36~48 */
1032 {52, 4, 24, IDOR, TRUE}
1033 , /* 5G, ch 52~64 */
1034 {100, 11, 30, BOTH, TRUE}
1035 , /* 5G, ch 149~161 */
1036 {0}
1037 , /* end */
1038 }
1039 }
1040 ,
1041
1042 { /* Peru */
1043 "PE",
1044 CE,
1045 {
1046 {1, 13, 20, BOTH, FALSE}
1047 , /* 2.4 G, ch 1~13 */
1048 {149, 4, 27, BOTH, FALSE}
1049 , /* 5G, ch 149~161 */
1050 {0}
1051 , /* end */
1052 }
1053 }
1054 ,
1055
1056 { /* Portugal */
1057 "PT",
1058 CE,
1059 {
1060 {1, 13, 20, BOTH, FALSE}
1061 , /* 2.4 G, ch 1~13 */
1062 {36, 4, 23, IDOR, FALSE}
1063 , /* 5G, ch 36~48 */
1064 {52, 4, 23, IDOR, TRUE}
1065 , /* 5G, ch 52~64 */
1066 {100, 11, 30, BOTH, TRUE}
1067 , /* 5G, ch 100~140 */
1068 {0}
1069 , /* end */
1070 }
1071 }
1072 ,
1073
1074 { /* Poland */
1075 "PL",
1076 CE,
1077 {
1078 {1, 13, 20, BOTH, FALSE}
1079 , /* 2.4 G, ch 1~13 */
1080 {36, 4, 23, IDOR, FALSE}
1081 , /* 5G, ch 36~48 */
1082 {52, 4, 23, IDOR, TRUE}
1083 , /* 5G, ch 52~64 */
1084 {100, 11, 30, BOTH, TRUE}
1085 , /* 5G, ch 100~140 */
1086 {0}
1087 , /* end */
1088 }
1089 }
1090 ,
1091
1092 { /* Romania */
1093 "RO",
1094 CE,
1095 {
1096 {1, 13, 20, BOTH, FALSE}
1097 , /* 2.4 G, ch 1~13 */
1098 {36, 4, 23, IDOR, FALSE}
1099 , /* 5G, ch 36~48 */
1100 {52, 4, 23, IDOR, TRUE}
1101 , /* 5G, ch 52~64 */
1102 {100, 11, 30, BOTH, TRUE}
1103 , /* 5G, ch 100~140 */
1104 {0}
1105 , /* end */
1106 }
1107 }
1108 ,
1109
1110 { /* Russia */
1111 "RU",
1112 CE,
1113 {
1114 {1, 13, 20, BOTH, FALSE}
1115 , /* 2.4 G, ch 1~13 */
1116 {149, 4, 20, IDOR, FALSE}
1117 , /* 5G, ch 149~161 */
1118 {0}
1119 , /* end */
1120 }
1121 }
1122 ,
1123
1124 { /* Saudi Arabia */
1125 "SA",
1126 CE,
1127 {
1128 {1, 13, 20, BOTH, FALSE}
1129 , /* 2.4 G, ch 1~13 */
1130 {36, 4, 23, BOTH, FALSE}
1131 , /* 5G, ch 36~48 */
1132 {52, 4, 23, BOTH, FALSE}
1133 , /* 5G, ch 52~64 */
1134 {149, 4, 23, BOTH, FALSE}
1135 , /* 5G, ch 149~161 */
1136 {0}
1137 , /* end */
1138 }
1139 }
1140 ,
1141
1142 { /* Serbia_and_Montenegro */
1143 "CS",
1144 CE,
1145 {
1146 {1, 13, 20, BOTH, FALSE}
1147 , /* 2.4 G, ch 1~13 */
1148 {0}
1149 , /* end */
1150 }
1151 }
1152 ,
1153
1154 { /* Singapore */
1155 "SG",
1156 CE,
1157 {
1158 {1, 13, 20, BOTH, FALSE}
1159 , /* 2.4 G, ch 1~13 */
1160 {36, 4, 23, BOTH, FALSE}
1161 , /* 5G, ch 36~48 */
1162 {52, 4, 23, BOTH, FALSE}
1163 , /* 5G, ch 52~64 */
1164 {149, 4, 20, BOTH, FALSE}
1165 , /* 5G, ch 149~161 */
1166 {0}
1167 , /* end */
1168 }
1169 }
1170 ,
1171
1172 { /* Slovakia */
1173 "SK",
1174 CE,
1175 {
1176 {1, 13, 20, BOTH, FALSE}
1177 , /* 2.4 G, ch 1~13 */
1178 {36, 4, 23, IDOR, FALSE}
1179 , /* 5G, ch 36~48 */
1180 {52, 4, 23, IDOR, TRUE}
1181 , /* 5G, ch 52~64 */
1182 {100, 11, 30, BOTH, TRUE}
1183 , /* 5G, ch 100~140 */
1184 {0}
1185 , /* end */
1186 }
1187 }
1188 ,
1189
1190 { /* Slovenia */
1191 "SI",
1192 CE,
1193 {
1194 {1, 13, 20, BOTH, FALSE}
1195 , /* 2.4 G, ch 1~13 */
1196 {36, 4, 23, IDOR, FALSE}
1197 , /* 5G, ch 36~48 */
1198 {52, 4, 23, IDOR, TRUE}
1199 , /* 5G, ch 52~64 */
1200 {0}
1201 , /* end */
1202 }
1203 }
1204 ,
1205
1206 { /* South Africa */
1207 "ZA",
1208 CE,
1209 {
1210 {1, 13, 20, BOTH, FALSE}
1211 , /* 2.4 G, ch 1~13 */
1212 {36, 4, 23, BOTH, FALSE}
1213 , /* 5G, ch 36~48 */
1214 {52, 4, 23, IDOR, FALSE}
1215 , /* 5G, ch 52~64 */
1216 {100, 11, 30, BOTH, TRUE}
1217 , /* 5G, ch 100~140 */
1218 {149, 4, 30, BOTH, FALSE}
1219 , /* 5G, ch 149~161 */
1220 {0}
1221 , /* end */
1222 }
1223 }
1224 ,
1225
1226 { /* South Korea */
1227 "KR",
1228 CE,
1229 {
1230 {1, 13, 20, BOTH, FALSE}
1231 , /* 2.4 G, ch 1~13 */
1232 {36, 4, 20, BOTH, FALSE}
1233 , /* 5G, ch 36~48 */
1234 {52, 4, 20, BOTH, FALSE}
1235 , /* 5G, ch 52~64 */
1236 {100, 8, 20, BOTH, FALSE}
1237 , /* 5G, ch 100~128 */
1238 {149, 4, 20, BOTH, FALSE}
1239 , /* 5G, ch 149~161 */
1240 {0}
1241 , /* end */
1242 }
1243 }
1244 ,
1245
1246 { /* Spain */
1247 "ES",
1248 CE,
1249 {
1250 {1, 13, 20, BOTH, FALSE}
1251 , /* 2.4 G, ch 1~13 */
1252 {36, 4, 17, IDOR, FALSE}
1253 , /* 5G, ch 36~48 */
1254 {52, 4, 23, IDOR, TRUE}
1255 , /* 5G, ch 52~64 */
1256 {100, 11, 30, BOTH, TRUE}
1257 , /* 5G, ch 100~140 */
1258 {0}
1259 , /* end */
1260 }
1261 }
1262 ,
1263
1264 { /* Sweden */
1265 "SE",
1266 CE,
1267 {
1268 {1, 13, 20, BOTH, FALSE}
1269 , /* 2.4 G, ch 1~13 */
1270 {36, 4, 23, IDOR, FALSE}
1271 , /* 5G, ch 36~48 */
1272 {52, 4, 23, IDOR, TRUE}
1273 , /* 5G, ch 52~64 */
1274 {100, 11, 30, BOTH, TRUE}
1275 , /* 5G, ch 100~140 */
1276 {0}
1277 , /* end */
1278 }
1279 }
1280 ,
1281
1282 { /* Switzerland */
1283 "CH",
1284 CE,
1285 {
1286 {1, 13, 20, BOTH, FALSE}
1287 , /* 2.4 G, ch 1~13 */
1288 {36, 4, 23, IDOR, TRUE}
1289 , /* 5G, ch 36~48 */
1290 {52, 4, 23, IDOR, TRUE}
1291 , /* 5G, ch 52~64 */
1292 {0}
1293 , /* end */
1294 }
1295 }
1296 ,
1297
1298 { /* Taiwan */
1299 "TW",
1300 CE,
1301 {
1302 {1, 11, 30, BOTH, FALSE}
1303 , /* 2.4 G, ch 1~11 */
1304 {52, 4, 23, IDOR, FALSE}
1305 , /* 5G, ch 52~64 */
1306 {0}
1307 , /* end */
1308 }
1309 }
1310 ,
1311
1312 { /* Turkey */
1313 "TR",
1314 CE,
1315 {
1316 {1, 13, 20, BOTH, FALSE}
1317 , /* 2.4 G, ch 1~11 */
1318 {36, 4, 23, BOTH, FALSE}
1319 , /* 5G, ch 36~48 */
1320 {52, 4, 23, BOTH, FALSE}
1321 , /* 5G, ch 52~64 */
1322 {0}
1323 , /* end */
1324 }
1325 }
1326 ,
1327
1328 { /* UK */
1329 "GB",
1330 CE,
1331 {
1332 {1, 13, 20, BOTH, FALSE}
1333 , /* 2.4 G, ch 1~11 */
1334 {36, 4, 23, IDOR, FALSE}
1335 , /* 5G, ch 52~64 */
1336 {52, 4, 23, IDOR, TRUE}
1337 , /* 5G, ch 52~64 */
1338 {100, 11, 30, BOTH, TRUE}
1339 , /* 5G, ch 100~140 */
1340 {0}
1341 , /* end */
1342 }
1343 }
1344 ,
1345
1346 { /* Ukraine */
1347 "UA",
1348 CE,
1349 {
1350 {1, 13, 20, BOTH, FALSE}
1351 , /* 2.4 G, ch 1~11 */
1352 {0}
1353 , /* end */
1354 }
1355 }
1356 ,
1357
1358 { /* United_Arab_Emirates */
1359 "AE",
1360 CE,
1361 {
1362 {1, 13, 20, BOTH, FALSE}
1363 , /* 2.4 G, ch 1~11 */
1364 {0}
1365 , /* end */
1366 }
1367 }
1368 ,
1369
1370 { /* United_States */
1371 "US",
1372 CE,
1373 {
1374 {1, 11, 30, BOTH, FALSE}
1375 , /* 2.4 G, ch 1~11 */
1376 {36, 4, 17, IDOR, FALSE}
1377 , /* 5G, ch 52~64 */
1378 {52, 4, 24, BOTH, TRUE}
1379 , /* 5G, ch 52~64 */
1380 {100, 11, 30, BOTH, TRUE}
1381 , /* 5G, ch 100~140 */
1382 {149, 5, 30, BOTH, FALSE}
1383 , /* 5G, ch 149~165 */
1384 {0}
1385 , /* end */
1386 }
1387 }
1388 ,
1389
1390 { /* Venezuela */
1391 "VE",
1392 CE,
1393 {
1394 {1, 13, 20, BOTH, FALSE}
1395 , /* 2.4 G, ch 1~11 */
1396 {149, 4, 27, BOTH, FALSE}
1397 , /* 5G, ch 149~161 */
1398 {0}
1399 , /* end */
1400 }
1401 }
1402 ,
1403
1404 { /* Default */
1405 "",
1406 CE,
1407 {
1408 {1, 11, 20, BOTH, FALSE}
1409 , /* 2.4 G, ch 1~11 */
1410 {36, 4, 20, BOTH, FALSE}
1411 , /* 5G, ch 52~64 */
1412 {52, 4, 20, BOTH, FALSE}
1413 , /* 5G, ch 52~64 */
1414 {100, 11, 20, BOTH, FALSE}
1415 , /* 5G, ch 100~140 */
1416 {149, 5, 20, BOTH, FALSE}
1417 , /* 5G, ch 149~165 */
1418 {0}
1419 , /* end */
1420 }
1421 }
1422 ,
1423 };
1424
GetChRegion(u8 * CntryCode)1425 static struct rt_ch_region *GetChRegion(u8 *CntryCode)
1426 {
1427 int loop = 0;
1428 struct rt_ch_region *pChRegion = NULL;
1429
1430 while (strcmp((char *)ChRegion[loop].CountReg, "") != 0) {
1431 if (strncmp
1432 ((char *)ChRegion[loop].CountReg, (char *)CntryCode,
1433 2) == 0) {
1434 pChRegion = &ChRegion[loop];
1435 break;
1436 }
1437 loop++;
1438 }
1439
1440 if (pChRegion == NULL)
1441 pChRegion = &ChRegion[loop];
1442 return pChRegion;
1443 }
1444
ChBandCheck(u8 PhyMode,u8 * pChType)1445 static void ChBandCheck(u8 PhyMode, u8 *pChType)
1446 {
1447 switch (PhyMode) {
1448 case PHY_11A:
1449 case PHY_11AN_MIXED:
1450 *pChType = BAND_5G;
1451 break;
1452 case PHY_11ABG_MIXED:
1453 case PHY_11AGN_MIXED:
1454 case PHY_11ABGN_MIXED:
1455 *pChType = BAND_BOTH;
1456 break;
1457
1458 default:
1459 *pChType = BAND_24G;
1460 break;
1461 }
1462 }
1463
FillChList(struct rt_rtmp_adapter * pAd,struct rt_ch_desp * pChDesp,u8 Offset,u8 increment)1464 static u8 FillChList(struct rt_rtmp_adapter *pAd,
1465 struct rt_ch_desp *pChDesp,
1466 u8 Offset, u8 increment)
1467 {
1468 int i, j, l;
1469 u8 channel;
1470
1471 j = Offset;
1472 for (i = 0; i < pChDesp->NumOfCh; i++) {
1473 channel = pChDesp->FirstChannel + i * increment;
1474 for (l = 0; l < MAX_NUM_OF_CHANNELS; l++) {
1475 if (channel == pAd->TxPower[l].Channel) {
1476 pAd->ChannelList[j].Power =
1477 pAd->TxPower[l].Power;
1478 pAd->ChannelList[j].Power2 =
1479 pAd->TxPower[l].Power2;
1480 break;
1481 }
1482 }
1483 if (l == MAX_NUM_OF_CHANNELS)
1484 continue;
1485
1486 pAd->ChannelList[j].Channel =
1487 pChDesp->FirstChannel + i * increment;
1488 pAd->ChannelList[j].MaxTxPwr = pChDesp->MaxTxPwr;
1489 pAd->ChannelList[j].DfsReq = pChDesp->DfsReq;
1490 j++;
1491 }
1492 pAd->ChannelListNum = j;
1493
1494 return j;
1495 }
1496
CreateChList(struct rt_rtmp_adapter * pAd,struct rt_ch_region * pChRegion,u8 Geography)1497 static inline void CreateChList(struct rt_rtmp_adapter *pAd,
1498 struct rt_ch_region *pChRegion, u8 Geography)
1499 {
1500 int i;
1501 u8 offset = 0;
1502 struct rt_ch_desp *pChDesp;
1503 u8 ChType;
1504 u8 increment;
1505
1506 if (pChRegion == NULL)
1507 return;
1508
1509 ChBandCheck(pAd->CommonCfg.PhyMode, &ChType);
1510
1511 for (i = 0; i < 10; i++) {
1512 pChDesp = &pChRegion->ChDesp[i];
1513 if (pChDesp->FirstChannel == 0)
1514 break;
1515
1516 if (ChType == BAND_5G) {
1517 if (pChDesp->FirstChannel <= 14)
1518 continue;
1519 } else if (ChType == BAND_24G) {
1520 if (pChDesp->FirstChannel > 14)
1521 continue;
1522 }
1523
1524 if ((pChDesp->Geography == BOTH)
1525 || (pChDesp->Geography == Geography)) {
1526 if (pChDesp->FirstChannel > 14)
1527 increment = 4;
1528 else
1529 increment = 1;
1530 offset = FillChList(pAd, pChDesp, offset, increment);
1531 }
1532 }
1533 }
1534
BuildChannelListEx(struct rt_rtmp_adapter * pAd)1535 void BuildChannelListEx(struct rt_rtmp_adapter *pAd)
1536 {
1537 struct rt_ch_region *pChReg;
1538
1539 pChReg = GetChRegion(pAd->CommonCfg.CountryCode);
1540 CreateChList(pAd, pChReg, pAd->CommonCfg.Geography);
1541 }
1542
BuildBeaconChList(struct rt_rtmp_adapter * pAd,u8 * pBuf,unsigned long * pBufLen)1543 void BuildBeaconChList(struct rt_rtmp_adapter *pAd,
1544 u8 *pBuf, unsigned long *pBufLen)
1545 {
1546 int i;
1547 unsigned long TmpLen;
1548 struct rt_ch_region *pChRegion;
1549 struct rt_ch_desp *pChDesp;
1550 u8 ChType;
1551
1552 pChRegion = GetChRegion(pAd->CommonCfg.CountryCode);
1553
1554 if (pChRegion == NULL)
1555 return;
1556
1557 ChBandCheck(pAd->CommonCfg.PhyMode, &ChType);
1558 *pBufLen = 0;
1559
1560 for (i = 0; i < 10; i++) {
1561 pChDesp = &pChRegion->ChDesp[i];
1562 if (pChDesp->FirstChannel == 0)
1563 break;
1564
1565 if (ChType == BAND_5G) {
1566 if (pChDesp->FirstChannel <= 14)
1567 continue;
1568 } else if (ChType == BAND_24G) {
1569 if (pChDesp->FirstChannel > 14)
1570 continue;
1571 }
1572
1573 if ((pChDesp->Geography == BOTH)
1574 || (pChDesp->Geography == pAd->CommonCfg.Geography)) {
1575 MakeOutgoingFrame(pBuf + *pBufLen, &TmpLen,
1576 1, &pChDesp->FirstChannel,
1577 1, &pChDesp->NumOfCh,
1578 1, &pChDesp->MaxTxPwr, END_OF_ARGS);
1579 *pBufLen += TmpLen;
1580 }
1581 }
1582 }
1583
IsValidChannel(struct rt_rtmp_adapter * pAd,u8 channel)1584 static BOOLEAN IsValidChannel(struct rt_rtmp_adapter *pAd, u8 channel)
1585 {
1586 int i;
1587
1588 for (i = 0; i < pAd->ChannelListNum; i++) {
1589 if (pAd->ChannelList[i].Channel == channel)
1590 break;
1591 }
1592
1593 if (i == pAd->ChannelListNum)
1594 return FALSE;
1595 else
1596 return TRUE;
1597 }
1598
GetExtCh(u8 Channel,u8 Direction)1599 static u8 GetExtCh(u8 Channel, u8 Direction)
1600 {
1601 char ExtCh;
1602
1603 if (Direction == EXTCHA_ABOVE)
1604 ExtCh = Channel + 4;
1605 else
1606 ExtCh = (Channel - 4) > 0 ? (Channel - 4) : 0;
1607
1608 return ExtCh;
1609 }
1610
N_ChannelCheck(struct rt_rtmp_adapter * pAd)1611 void N_ChannelCheck(struct rt_rtmp_adapter *pAd)
1612 {
1613 /*u8 ChannelNum = pAd->ChannelListNum; */
1614 u8 Channel = pAd->CommonCfg.Channel;
1615
1616 if ((pAd->CommonCfg.PhyMode >= PHY_11ABGN_MIXED)
1617 && (pAd->CommonCfg.RegTransmitSetting.field.BW == BW_40)) {
1618 if (Channel > 14) {
1619 if ((Channel == 36) || (Channel == 44)
1620 || (Channel == 52) || (Channel == 60)
1621 || (Channel == 100) || (Channel == 108)
1622 || (Channel == 116) || (Channel == 124)
1623 || (Channel == 132) || (Channel == 149)
1624 || (Channel == 157)) {
1625 pAd->CommonCfg.RegTransmitSetting.field.EXTCHA =
1626 EXTCHA_ABOVE;
1627 } else if ((Channel == 40) || (Channel == 48)
1628 || (Channel == 56) || (Channel == 64)
1629 || (Channel == 104) || (Channel == 112)
1630 || (Channel == 120) || (Channel == 128)
1631 || (Channel == 136) || (Channel == 153)
1632 || (Channel == 161)) {
1633 pAd->CommonCfg.RegTransmitSetting.field.EXTCHA =
1634 EXTCHA_BELOW;
1635 } else {
1636 pAd->CommonCfg.RegTransmitSetting.field.BW =
1637 BW_20;
1638 }
1639 } else {
1640 do {
1641 u8 ExtCh;
1642 u8 Dir =
1643 pAd->CommonCfg.RegTransmitSetting.field.
1644 EXTCHA;
1645 ExtCh = GetExtCh(Channel, Dir);
1646 if (IsValidChannel(pAd, ExtCh))
1647 break;
1648
1649 Dir =
1650 (Dir ==
1651 EXTCHA_ABOVE) ? EXTCHA_BELOW :
1652 EXTCHA_ABOVE;
1653 ExtCh = GetExtCh(Channel, Dir);
1654 if (IsValidChannel(pAd, ExtCh)) {
1655 pAd->CommonCfg.RegTransmitSetting.field.
1656 EXTCHA = Dir;
1657 break;
1658 }
1659 pAd->CommonCfg.RegTransmitSetting.field.BW =
1660 BW_20;
1661 } while (FALSE);
1662
1663 if (Channel == 14) {
1664 pAd->CommonCfg.RegTransmitSetting.field.BW =
1665 BW_20;
1666 /*pAd->CommonCfg.RegTransmitSetting.field.EXTCHA = EXTCHA_NONE; // We didn't set the ExtCh as NONE due to it'll set in RTMPSetHT() */
1667 }
1668 }
1669 }
1670
1671 }
1672
N_SetCenCh(struct rt_rtmp_adapter * pAd)1673 void N_SetCenCh(struct rt_rtmp_adapter *pAd)
1674 {
1675 if (pAd->CommonCfg.RegTransmitSetting.field.BW == BW_40) {
1676 if (pAd->CommonCfg.RegTransmitSetting.field.EXTCHA ==
1677 EXTCHA_ABOVE) {
1678 pAd->CommonCfg.CentralChannel =
1679 pAd->CommonCfg.Channel + 2;
1680 } else {
1681 if (pAd->CommonCfg.Channel == 14)
1682 pAd->CommonCfg.CentralChannel =
1683 pAd->CommonCfg.Channel - 1;
1684 else
1685 pAd->CommonCfg.CentralChannel =
1686 pAd->CommonCfg.Channel - 2;
1687 }
1688 } else {
1689 pAd->CommonCfg.CentralChannel = pAd->CommonCfg.Channel;
1690 }
1691 }
1692
GetCuntryMaxTxPwr(struct rt_rtmp_adapter * pAd,u8 channel)1693 u8 GetCuntryMaxTxPwr(struct rt_rtmp_adapter *pAd, u8 channel)
1694 {
1695 int i;
1696 for (i = 0; i < pAd->ChannelListNum; i++) {
1697 if (pAd->ChannelList[i].Channel == channel)
1698 break;
1699 }
1700
1701 if (i == pAd->ChannelListNum)
1702 return 0xff;
1703 else
1704 return pAd->ChannelList[i].MaxTxPwr;
1705 }
1706