Commit | Line | Data |
---|---|---|
92b96797 FB |
1 | /* |
2 | * Copyright (c) 1996, 2003 VIA Networking Technologies, Inc. | |
3 | * All rights reserved. | |
4 | * | |
5 | * This program is free software; you can redistribute it and/or modify | |
6 | * it under the terms of the GNU General Public License as published by | |
7 | * the Free Software Foundation; either version 2 of the License, or | |
8 | * (at your option) any later version. | |
9 | * | |
10 | * This program is distributed in the hope that it will be useful, | |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | * GNU General Public License for more details. | |
14 | * | |
15 | * You should have received a copy of the GNU General Public License along | |
16 | * with this program; if not, write to the Free Software Foundation, Inc., | |
17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | |
18 | * | |
19 | * | |
20 | * File: baseband.c | |
21 | * | |
22 | * Purpose: Implement functions to access baseband | |
23 | * | |
24 | * Author: Jerry Chen | |
25 | * | |
26 | * Date: Jun. 5, 2002 | |
27 | * | |
28 | * Functions: | |
29 | * BBuGetFrameTime - Calculate data frame transmitting time | |
bda79783 | 30 | * BBvCalculateParameter - Calculate PhyLength, PhyService and Phy Signal parameter for baseband Tx |
92b96797 | 31 | * BBbVT3184Init - VIA VT3184 baseband chip init code |
92b96797 FB |
32 | * |
33 | * Revision History: | |
34 | * | |
35 | * | |
36 | */ | |
37 | ||
92b96797 | 38 | #include "tmacro.h" |
92b96797 | 39 | #include "tether.h" |
92b96797 | 40 | #include "mac.h" |
92b96797 | 41 | #include "baseband.h" |
92b96797 | 42 | #include "rf.h" |
92b96797 | 43 | #include "srom.h" |
92b96797 | 44 | #include "control.h" |
92b96797 | 45 | #include "datarate.h" |
92b96797 | 46 | #include "rndis.h" |
92b96797 | 47 | |
92b96797 FB |
48 | static int msglevel =MSG_LEVEL_INFO; |
49 | //static int msglevel =MSG_LEVEL_DEBUG; | |
50 | ||
3b138851 | 51 | static u8 abyVT3184_AGC[] = { |
92b96797 FB |
52 | 0x00, //0 |
53 | 0x00, //1 | |
54 | 0x02, //2 | |
55 | 0x02, //3 //RobertYu:20060505, 0x04, //3 | |
56 | 0x04, //4 | |
57 | 0x04, //5 //RobertYu:20060505, 0x06, //5 | |
58 | 0x06, //6 | |
59 | 0x06, //7 | |
60 | 0x08, //8 | |
61 | 0x08, //9 | |
62 | 0x0A, //A | |
63 | 0x0A, //B | |
64 | 0x0C, //C | |
65 | 0x0C, //D | |
66 | 0x0E, //E | |
67 | 0x0E, //F | |
68 | 0x10, //10 | |
69 | 0x10, //11 | |
70 | 0x12, //12 | |
71 | 0x12, //13 | |
72 | 0x14, //14 | |
73 | 0x14, //15 | |
74 | 0x16, //16 | |
75 | 0x16, //17 | |
76 | 0x18, //18 | |
77 | 0x18, //19 | |
78 | 0x1A, //1A | |
79 | 0x1A, //1B | |
80 | 0x1C, //1C | |
81 | 0x1C, //1D | |
82 | 0x1E, //1E | |
83 | 0x1E, //1F | |
84 | 0x20, //20 | |
85 | 0x20, //21 | |
86 | 0x22, //22 | |
87 | 0x22, //23 | |
88 | 0x24, //24 | |
89 | 0x24, //25 | |
90 | 0x26, //26 | |
91 | 0x26, //27 | |
92 | 0x28, //28 | |
93 | 0x28, //29 | |
94 | 0x2A, //2A | |
95 | 0x2A, //2B | |
96 | 0x2C, //2C | |
97 | 0x2C, //2D | |
98 | 0x2E, //2E | |
99 | 0x2E, //2F | |
100 | 0x30, //30 | |
101 | 0x30, //31 | |
102 | 0x32, //32 | |
103 | 0x32, //33 | |
104 | 0x34, //34 | |
105 | 0x34, //35 | |
106 | 0x36, //36 | |
107 | 0x36, //37 | |
108 | 0x38, //38 | |
109 | 0x38, //39 | |
110 | 0x3A, //3A | |
111 | 0x3A, //3B | |
112 | 0x3C, //3C | |
113 | 0x3C, //3D | |
114 | 0x3E, //3E | |
115 | 0x3E //3F | |
116 | }; | |
117 | ||
3b138851 | 118 | static u8 abyVT3184_AL2230[] = { |
92b96797 FB |
119 | 0x31,//00 |
120 | 0x00, | |
121 | 0x00, | |
122 | 0x00, | |
123 | 0x00, | |
124 | 0x80, | |
125 | 0x00, | |
126 | 0x00, | |
127 | 0x70, | |
128 | 0x45,//tx //0x64 for FPGA | |
129 | 0x2A, | |
130 | 0x76, | |
131 | 0x00, | |
132 | 0x00, | |
133 | 0x80, | |
134 | 0x00, | |
135 | 0x00,//10 | |
136 | 0x00, | |
137 | 0x00, | |
138 | 0x00, | |
139 | 0x00, | |
140 | 0x00, | |
141 | 0x00, | |
142 | 0x00, | |
143 | 0x00, | |
144 | 0x00, | |
145 | 0x00, | |
146 | 0x8e, //RobertYu:20060522, //0x8d, | |
147 | 0x0a, //RobertYu:20060515, //0x09, | |
148 | 0x00, | |
149 | 0x00, | |
150 | 0x00, | |
151 | 0x00,//20 | |
152 | 0x00, | |
153 | 0x00, | |
154 | 0x00, | |
155 | 0x00, | |
156 | 0x4a, | |
157 | 0x00, | |
158 | 0x00, | |
159 | 0x00, | |
160 | 0x00, | |
161 | 0x00, | |
162 | 0x00, | |
163 | 0x00, | |
164 | 0x4a, | |
165 | 0x00, | |
166 | 0x0c, //RobertYu:20060522, //0x10, | |
167 | 0x26,//30 | |
168 | 0x5b, | |
169 | 0x00, | |
170 | 0x00, | |
171 | 0x00, | |
172 | 0x00, | |
173 | 0xaa, | |
174 | 0xaa, | |
175 | 0xff, | |
176 | 0xff, | |
177 | 0x79, | |
178 | 0x00, | |
179 | 0x00, | |
180 | 0x0b, | |
181 | 0x48, | |
182 | 0x04, | |
183 | 0x00,//40 | |
184 | 0x08, | |
185 | 0x00, | |
186 | 0x08, | |
187 | 0x08, | |
188 | 0x14, | |
189 | 0x05, | |
190 | 0x09, | |
191 | 0x00, | |
192 | 0x00, | |
193 | 0x00, | |
194 | 0x00, | |
195 | 0x09, | |
196 | 0x73, | |
197 | 0x00, | |
198 | 0xc5, | |
199 | 0x00,//50 //RobertYu:20060505, //0x15,//50 | |
200 | 0x19, | |
201 | 0x00, | |
202 | 0x00, | |
203 | 0x00, | |
204 | 0x00, | |
205 | 0x00, | |
206 | 0x00, | |
207 | 0x00, | |
208 | 0xd0, //RobertYu:20060505, //0xb0, | |
209 | 0x00, | |
210 | 0x00, | |
211 | 0x00, | |
212 | 0x00, | |
213 | 0x00, | |
214 | 0x00, | |
215 | 0xe4,//60 | |
216 | 0x80, | |
217 | 0x00, | |
218 | 0x00, | |
219 | 0x00, | |
220 | 0x00, | |
221 | 0x98, | |
222 | 0x0a, | |
223 | 0x00, | |
224 | 0x00, | |
225 | 0x00, | |
226 | 0x00, | |
227 | 0x00, //0x80 for FPGA | |
228 | 0x03, | |
229 | 0x01, | |
230 | 0x00, | |
231 | 0x00,//70 | |
232 | 0x00, | |
233 | 0x00, | |
234 | 0x00, | |
235 | 0x00, | |
236 | 0x00, | |
237 | 0x00, | |
238 | 0x00, | |
239 | 0x00, | |
240 | 0x00, | |
241 | 0x00, | |
242 | 0x00, | |
243 | 0x00, | |
244 | 0x00, | |
245 | 0x00, | |
246 | 0x00, | |
247 | 0x8c,//80 | |
248 | 0x01, | |
249 | 0x09, | |
250 | 0x00, | |
251 | 0x00, | |
252 | 0x00, | |
253 | 0x00, | |
254 | 0x00, | |
255 | 0x08, | |
256 | 0x00, | |
257 | 0x1f, //RobertYu:20060516, //0x0f, | |
258 | 0xb7, | |
259 | 0x88, | |
260 | 0x47, | |
261 | 0xaa, | |
262 | 0x00, //RobertYu:20060505, //0x02, | |
263 | 0x20,//90 //RobertYu:20060505, //0x22,//90 | |
264 | 0x00, | |
265 | 0x00, | |
266 | 0x00, | |
267 | 0x00, | |
268 | 0x00, | |
269 | 0x00, | |
270 | 0xeb, | |
271 | 0x00, | |
272 | 0x00, | |
273 | 0x00, | |
274 | 0x00, | |
275 | 0x00, | |
276 | 0x00, | |
277 | 0x00, | |
278 | 0x01, | |
279 | 0x00,//a0 | |
280 | 0x00, | |
281 | 0x00, | |
282 | 0x00, | |
283 | 0x00, | |
284 | 0x00, | |
285 | 0x10, | |
286 | 0x00, | |
287 | 0x18, | |
288 | 0x00, | |
289 | 0x00, | |
290 | 0x00, | |
291 | 0x00, | |
292 | 0x15, //RobertYu:20060516, //0x00, | |
293 | 0x00, | |
294 | 0x18, | |
295 | 0x38,//b0 | |
296 | 0x30, | |
297 | 0x00, | |
298 | 0x00, | |
299 | 0xff, | |
300 | 0x0f, | |
301 | 0xe4, | |
302 | 0xe2, | |
303 | 0x00, | |
304 | 0x00, | |
305 | 0x00, | |
306 | 0x03, | |
307 | 0x01, | |
308 | 0x00, | |
309 | 0x00, | |
310 | 0x00, | |
311 | 0x18,//c0 | |
312 | 0x20, | |
313 | 0x07, | |
314 | 0x18, | |
315 | 0xff, | |
316 | 0xff, //RobertYu:20060509, //0x2c, | |
317 | 0x0e, //RobertYu:20060530, //0x0c, | |
318 | 0x0a, | |
319 | 0x0e, | |
320 | 0x00, //RobertYu:20060505, //0x01, | |
321 | 0x82, //RobertYu:20060516, //0x8f, | |
322 | 0xa7, | |
323 | 0x3c, | |
324 | 0x10, | |
325 | 0x30, //RobertYu:20060627, //0x0b, | |
326 | 0x05, //RobertYu:20060516, //0x25, | |
327 | 0x40,//d0 | |
328 | 0x12, | |
329 | 0x00, | |
330 | 0x00, | |
331 | 0x10, | |
332 | 0x28, | |
333 | 0x80, | |
334 | 0x2A, | |
335 | 0x00, | |
336 | 0x00, | |
337 | 0x00, | |
338 | 0x00, | |
339 | 0x00, | |
340 | 0x00, | |
341 | 0x00, | |
342 | 0x00, | |
343 | 0x00,//e0 | |
344 | 0xf3, //RobertYu:20060516, //0xd3, | |
345 | 0x00, | |
346 | 0x00, | |
347 | 0x00, | |
348 | 0x10, | |
349 | 0x00, | |
350 | 0x12, //RobertYu:20060627, //0x10, | |
351 | 0x00, | |
352 | 0xf4, | |
353 | 0x00, | |
354 | 0xff, | |
355 | 0x79, | |
356 | 0x20, | |
357 | 0x30, | |
358 | 0x05, //RobertYu:20060516, //0x0c, | |
359 | 0x00,//f0 | |
360 | 0x3e, | |
361 | 0x00, | |
362 | 0x00, | |
363 | 0x00, | |
364 | 0x00, | |
365 | 0x00, | |
366 | 0x00, | |
367 | 0x00, | |
368 | 0x00, | |
369 | 0x00, | |
370 | 0x00, | |
371 | 0x00, | |
372 | 0x00, | |
373 | 0x00, | |
374 | 0x00 | |
375 | }; | |
376 | ||
92b96797 | 377 | //{{RobertYu:20060515, new BB setting for VT3226D0 |
3b138851 | 378 | static u8 abyVT3184_VT3226D0[] = { |
92b96797 FB |
379 | 0x31,//00 |
380 | 0x00, | |
381 | 0x00, | |
382 | 0x00, | |
383 | 0x00, | |
384 | 0x80, | |
385 | 0x00, | |
386 | 0x00, | |
387 | 0x70, | |
388 | 0x45,//tx //0x64 for FPGA | |
389 | 0x2A, | |
390 | 0x76, | |
391 | 0x00, | |
392 | 0x00, | |
393 | 0x80, | |
394 | 0x00, | |
395 | 0x00,//10 | |
396 | 0x00, | |
397 | 0x00, | |
398 | 0x00, | |
399 | 0x00, | |
400 | 0x00, | |
401 | 0x00, | |
402 | 0x00, | |
403 | 0x00, | |
404 | 0x00, | |
405 | 0x00, | |
406 | 0x8e, //RobertYu:20060525, //0x8d, | |
407 | 0x0a, //RobertYu:20060515, //0x09, | |
408 | 0x00, | |
409 | 0x00, | |
410 | 0x00, | |
411 | 0x00,//20 | |
412 | 0x00, | |
413 | 0x00, | |
414 | 0x00, | |
415 | 0x00, | |
416 | 0x4a, | |
417 | 0x00, | |
418 | 0x00, | |
419 | 0x00, | |
420 | 0x00, | |
421 | 0x00, | |
422 | 0x00, | |
423 | 0x00, | |
424 | 0x4a, | |
425 | 0x00, | |
426 | 0x0c, //RobertYu:20060525, //0x10, | |
427 | 0x26,//30 | |
428 | 0x5b, | |
429 | 0x00, | |
430 | 0x00, | |
431 | 0x00, | |
432 | 0x00, | |
433 | 0xaa, | |
434 | 0xaa, | |
435 | 0xff, | |
436 | 0xff, | |
437 | 0x79, | |
438 | 0x00, | |
439 | 0x00, | |
440 | 0x0b, | |
441 | 0x48, | |
442 | 0x04, | |
443 | 0x00,//40 | |
444 | 0x08, | |
445 | 0x00, | |
446 | 0x08, | |
447 | 0x08, | |
448 | 0x14, | |
449 | 0x05, | |
450 | 0x09, | |
451 | 0x00, | |
452 | 0x00, | |
453 | 0x00, | |
454 | 0x00, | |
455 | 0x09, | |
456 | 0x73, | |
457 | 0x00, | |
458 | 0xc5, | |
459 | 0x00,//50 //RobertYu:20060505, //0x15,//50 | |
460 | 0x19, | |
461 | 0x00, | |
462 | 0x00, | |
463 | 0x00, | |
464 | 0x00, | |
465 | 0x00, | |
466 | 0x00, | |
467 | 0x00, | |
468 | 0xd0, //RobertYu:20060505, //0xb0, | |
469 | 0x00, | |
470 | 0x00, | |
471 | 0x00, | |
472 | 0x00, | |
473 | 0x00, | |
474 | 0x00, | |
475 | 0xe4,//60 | |
476 | 0x80, | |
477 | 0x00, | |
478 | 0x00, | |
479 | 0x00, | |
480 | 0x00, | |
481 | 0x98, | |
482 | 0x0a, | |
483 | 0x00, | |
484 | 0x00, | |
485 | 0x00, | |
486 | 0x00, | |
487 | 0x00, //0x80 for FPGA | |
488 | 0x03, | |
489 | 0x01, | |
490 | 0x00, | |
491 | 0x00,//70 | |
492 | 0x00, | |
493 | 0x00, | |
494 | 0x00, | |
495 | 0x00, | |
496 | 0x00, | |
497 | 0x00, | |
498 | 0x00, | |
499 | 0x00, | |
500 | 0x00, | |
501 | 0x00, | |
502 | 0x00, | |
503 | 0x00, | |
504 | 0x00, | |
505 | 0x00, | |
506 | 0x00, | |
507 | 0x8c,//80 | |
508 | 0x01, | |
509 | 0x09, | |
510 | 0x00, | |
511 | 0x00, | |
512 | 0x00, | |
513 | 0x00, | |
514 | 0x00, | |
515 | 0x08, | |
516 | 0x00, | |
517 | 0x1f, //RobertYu:20060515, //0x0f, | |
518 | 0xb7, | |
519 | 0x88, | |
520 | 0x47, | |
521 | 0xaa, | |
522 | 0x00, //RobertYu:20060505, //0x02, | |
523 | 0x20,//90 //RobertYu:20060505, //0x22,//90 | |
524 | 0x00, | |
525 | 0x00, | |
526 | 0x00, | |
527 | 0x00, | |
528 | 0x00, | |
529 | 0x00, | |
530 | 0xeb, | |
531 | 0x00, | |
532 | 0x00, | |
533 | 0x00, | |
534 | 0x00, | |
535 | 0x00, | |
536 | 0x00, | |
537 | 0x00, | |
538 | 0x01, | |
539 | 0x00,//a0 | |
540 | 0x00, | |
541 | 0x00, | |
542 | 0x00, | |
543 | 0x00, | |
544 | 0x00, | |
545 | 0x10, | |
546 | 0x00, | |
547 | 0x18, | |
548 | 0x00, | |
549 | 0x00, | |
550 | 0x00, | |
551 | 0x00, | |
552 | 0x00, | |
553 | 0x00, | |
554 | 0x18, | |
555 | 0x38,//b0 | |
556 | 0x30, | |
557 | 0x00, | |
558 | 0x00, | |
559 | 0xff, | |
560 | 0x0f, | |
561 | 0xe4, | |
562 | 0xe2, | |
563 | 0x00, | |
564 | 0x00, | |
565 | 0x00, | |
566 | 0x03, | |
567 | 0x01, | |
568 | 0x00, | |
569 | 0x00, | |
570 | 0x00, | |
571 | 0x18,//c0 | |
572 | 0x20, | |
573 | 0x07, | |
574 | 0x18, | |
575 | 0xff, | |
576 | 0xff, //RobertYu:20060509, //0x2c, | |
577 | 0x10, //RobertYu:20060525, //0x0c, | |
578 | 0x0a, | |
579 | 0x0e, | |
580 | 0x00, //RobertYu:20060505, //0x01, | |
581 | 0x84, //RobertYu:20060525, //0x8f, | |
582 | 0xa7, | |
583 | 0x3c, | |
584 | 0x10, | |
585 | 0x24, //RobertYu:20060627, //0x18, | |
586 | 0x05, //RobertYu:20060515, //0x25, | |
587 | 0x40,//d0 | |
588 | 0x12, | |
589 | 0x00, | |
590 | 0x00, | |
591 | 0x10, | |
592 | 0x28, | |
593 | 0x80, | |
594 | 0x2A, | |
595 | 0x00, | |
596 | 0x00, | |
597 | 0x00, | |
598 | 0x00, | |
599 | 0x00, | |
600 | 0x00, | |
601 | 0x00, | |
602 | 0x00, | |
603 | 0x00,//e0 | |
604 | 0xf3, //RobertYu:20060515, //0xd3, | |
605 | 0x00, | |
606 | 0x00, | |
607 | 0x00, | |
608 | 0x10, | |
609 | 0x00, | |
610 | 0x10, //RobertYu:20060627, //0x0e, | |
611 | 0x00, | |
612 | 0xf4, | |
613 | 0x00, | |
614 | 0xff, | |
615 | 0x79, | |
616 | 0x20, | |
617 | 0x30, | |
618 | 0x08, //RobertYu:20060515, //0x0c, | |
619 | 0x00,//f0 | |
620 | 0x3e, | |
621 | 0x00, | |
622 | 0x00, | |
623 | 0x00, | |
624 | 0x00, | |
625 | 0x00, | |
626 | 0x00, | |
627 | 0x00, | |
628 | 0x00, | |
629 | 0x00, | |
630 | 0x00, | |
631 | 0x00, | |
632 | 0x00, | |
633 | 0x00, | |
634 | 0x00, | |
635 | }; | |
636 | ||
3b138851 | 637 | static const u16 awcFrameTime[MAX_RATE] = |
92b96797 FB |
638 | {10, 20, 55, 110, 24, 36, 48, 72, 96, 144, 192, 216}; |
639 | ||
92b96797 FB |
640 | /* |
641 | static | |
cc856e61 | 642 | unsigned long |
92b96797 FB |
643 | s_ulGetLowSQ3(PSDevice pDevice); |
644 | ||
645 | static | |
cc856e61 | 646 | unsigned long |
92b96797 FB |
647 | s_ulGetRatio(PSDevice pDevice); |
648 | ||
649 | static | |
650 | void | |
651 | s_vClearSQ3Value(PSDevice pDevice); | |
652 | */ | |
653 | ||
92b96797 FB |
654 | /* |
655 | * Description: Calculate data frame transmitting time | |
656 | * | |
657 | * Parameters: | |
658 | * In: | |
659 | * byPreambleType - Preamble Type | |
660 | * byPktType - PK_TYPE_11A, PK_TYPE_11B, PK_TYPE_11GB, PK_TYPE_11GA | |
661 | * cbFrameLength - Baseband Type | |
662 | * wRate - Tx Rate | |
663 | * Out: | |
664 | * | |
665 | * Return Value: FrameTime | |
666 | * | |
667 | */ | |
cc856e61 | 668 | unsigned int |
98583c09 | 669 | BBuGetFrameTime( |
b902fbfe AM |
670 | u8 byPreambleType, |
671 | u8 byPktType, | |
cc856e61 | 672 | unsigned int cbFrameLength, |
3eaca0d2 | 673 | u16 wRate |
92b96797 FB |
674 | ) |
675 | { | |
cc856e61 AM |
676 | unsigned int uFrameTime; |
677 | unsigned int uPreamble; | |
678 | unsigned int uTmp; | |
679 | unsigned int uRateIdx = (unsigned int)wRate; | |
680 | unsigned int uRate = 0; | |
92b96797 | 681 | |
92b96797 | 682 | if (uRateIdx > RATE_54M) { |
92b96797 FB |
683 | return 0; |
684 | } | |
685 | ||
cc856e61 | 686 | uRate = (unsigned int)awcFrameTime[uRateIdx]; |
92b96797 FB |
687 | |
688 | if (uRateIdx <= 3) { //CCK mode | |
689 | ||
690 | if (byPreambleType == 1) {//Short | |
691 | uPreamble = 96; | |
692 | } else { | |
693 | uPreamble = 192; | |
694 | } | |
77f58b13 | 695 | uFrameTime = (cbFrameLength * 80) / uRate; //????? |
92b96797 FB |
696 | uTmp = (uFrameTime * uRate) / 80; |
697 | if (cbFrameLength != uTmp) { | |
698 | uFrameTime ++; | |
699 | } | |
700 | ||
701 | return (uPreamble + uFrameTime); | |
702 | } | |
703 | else { | |
77f58b13 | 704 | uFrameTime = (cbFrameLength * 8 + 22) / uRate; //???????? |
92b96797 FB |
705 | uTmp = ((uFrameTime * uRate) - 22) / 8; |
706 | if(cbFrameLength != uTmp) { | |
707 | uFrameTime ++; | |
708 | } | |
77f58b13 | 709 | uFrameTime = uFrameTime * 4; //??????? |
92b96797 FB |
710 | if(byPktType != PK_TYPE_11A) { |
711 | uFrameTime += 6; | |
712 | } | |
77f58b13 | 713 | return (20 + uFrameTime); //?????? |
92b96797 FB |
714 | } |
715 | } | |
716 | ||
717 | /* | |
a0a1f61a | 718 | * Description: Calculate Length, Service, and Signal fields of Phy for Tx |
92b96797 FB |
719 | * |
720 | * Parameters: | |
721 | * In: | |
722 | * pDevice - Device Structure | |
723 | * cbFrameLength - Tx Frame Length | |
724 | * wRate - Tx Rate | |
725 | * Out: | |
aed387c7 MP |
726 | * struct vnt_phy_field *phy |
727 | * - pointer to Phy Length field | |
728 | * - pointer to Phy Service field | |
729 | * - pointer to Phy Signal field | |
92b96797 FB |
730 | * |
731 | * Return Value: none | |
732 | * | |
733 | */ | |
98583c09 | 734 | void BBvCalculateParameter(struct vnt_private *pDevice, u32 cbFrameLength, |
aed387c7 | 735 | u16 wRate, u8 byPacketType, struct vnt_phy_field *phy) |
92b96797 | 736 | { |
98583c09 MP |
737 | u32 cbBitCount; |
738 | u32 cbUsCount = 0; | |
739 | u32 cbTmp; | |
740 | int bExtBit; | |
741 | u8 byPreambleType = pDevice->byPreambleType; | |
742 | int bCCK = pDevice->bCCK; | |
92b96797 FB |
743 | |
744 | cbBitCount = cbFrameLength * 8; | |
e269fc2d | 745 | bExtBit = false; |
92b96797 FB |
746 | |
747 | switch (wRate) { | |
748 | case RATE_1M : | |
749 | cbUsCount = cbBitCount; | |
aed387c7 | 750 | phy->signal = 0x00; |
92b96797 FB |
751 | break; |
752 | ||
753 | case RATE_2M : | |
754 | cbUsCount = cbBitCount / 2; | |
755 | if (byPreambleType == 1) | |
aed387c7 | 756 | phy->signal = 0x09; |
92b96797 | 757 | else // long preamble |
aed387c7 | 758 | phy->signal = 0x01; |
92b96797 FB |
759 | break; |
760 | ||
761 | case RATE_5M : | |
e269fc2d | 762 | if (bCCK == false) |
92b96797 FB |
763 | cbBitCount ++; |
764 | cbUsCount = (cbBitCount * 10) / 55; | |
765 | cbTmp = (cbUsCount * 55) / 10; | |
766 | if (cbTmp != cbBitCount) | |
767 | cbUsCount ++; | |
768 | if (byPreambleType == 1) | |
aed387c7 | 769 | phy->signal = 0x0a; |
92b96797 | 770 | else // long preamble |
aed387c7 | 771 | phy->signal = 0x02; |
92b96797 FB |
772 | break; |
773 | ||
774 | case RATE_11M : | |
775 | ||
e269fc2d | 776 | if (bCCK == false) |
92b96797 FB |
777 | cbBitCount ++; |
778 | cbUsCount = cbBitCount / 11; | |
779 | cbTmp = cbUsCount * 11; | |
780 | if (cbTmp != cbBitCount) { | |
781 | cbUsCount ++; | |
782 | if ((cbBitCount - cbTmp) <= 3) | |
4e9b5e2b | 783 | bExtBit = true; |
92b96797 FB |
784 | } |
785 | if (byPreambleType == 1) | |
aed387c7 | 786 | phy->signal = 0x0b; |
92b96797 | 787 | else // long preamble |
aed387c7 | 788 | phy->signal = 0x03; |
92b96797 FB |
789 | break; |
790 | ||
791 | case RATE_6M : | |
792 | if(byPacketType == PK_TYPE_11A) {//11a, 5GHZ | |
aed387c7 | 793 | phy->signal = 0x9b; |
92b96797 FB |
794 | } |
795 | else {//11g, 2.4GHZ | |
aed387c7 | 796 | phy->signal = 0x8b; |
92b96797 FB |
797 | } |
798 | break; | |
799 | ||
800 | case RATE_9M : | |
801 | if(byPacketType == PK_TYPE_11A) {//11a, 5GHZ | |
aed387c7 | 802 | phy->signal = 0x9f; |
92b96797 FB |
803 | } |
804 | else {//11g, 2.4GHZ | |
aed387c7 | 805 | phy->signal = 0x8f; |
92b96797 FB |
806 | } |
807 | break; | |
808 | ||
809 | case RATE_12M : | |
810 | if(byPacketType == PK_TYPE_11A) {//11a, 5GHZ | |
aed387c7 | 811 | phy->signal = 0x9a; |
92b96797 FB |
812 | } |
813 | else {//11g, 2.4GHZ | |
aed387c7 | 814 | phy->signal = 0x8a; |
92b96797 FB |
815 | } |
816 | break; | |
817 | ||
818 | case RATE_18M : | |
819 | if(byPacketType == PK_TYPE_11A) {//11a, 5GHZ | |
aed387c7 | 820 | phy->signal = 0x9e; |
92b96797 FB |
821 | } |
822 | else {//11g, 2.4GHZ | |
aed387c7 | 823 | phy->signal = 0x8e; |
92b96797 FB |
824 | } |
825 | break; | |
826 | ||
827 | case RATE_24M : | |
828 | if(byPacketType == PK_TYPE_11A) {//11a, 5GHZ | |
aed387c7 | 829 | phy->signal = 0x99; |
92b96797 FB |
830 | } |
831 | else {//11g, 2.4GHZ | |
aed387c7 | 832 | phy->signal = 0x89; |
92b96797 FB |
833 | } |
834 | break; | |
835 | ||
836 | case RATE_36M : | |
837 | if(byPacketType == PK_TYPE_11A) {//11a, 5GHZ | |
aed387c7 | 838 | phy->signal = 0x9d; |
92b96797 FB |
839 | } |
840 | else {//11g, 2.4GHZ | |
aed387c7 | 841 | phy->signal = 0x8d; |
92b96797 FB |
842 | } |
843 | break; | |
844 | ||
845 | case RATE_48M : | |
846 | if(byPacketType == PK_TYPE_11A) {//11a, 5GHZ | |
aed387c7 | 847 | phy->signal = 0x98; |
92b96797 FB |
848 | } |
849 | else {//11g, 2.4GHZ | |
aed387c7 | 850 | phy->signal = 0x88; |
92b96797 FB |
851 | } |
852 | break; | |
853 | ||
854 | case RATE_54M : | |
855 | if (byPacketType == PK_TYPE_11A) {//11a, 5GHZ | |
aed387c7 | 856 | phy->signal = 0x9c; |
92b96797 FB |
857 | } |
858 | else {//11g, 2.4GHZ | |
aed387c7 | 859 | phy->signal = 0x8c; |
92b96797 FB |
860 | } |
861 | break; | |
862 | ||
863 | default : | |
864 | if (byPacketType == PK_TYPE_11A) {//11a, 5GHZ | |
aed387c7 | 865 | phy->signal = 0x9c; |
92b96797 FB |
866 | } |
867 | else {//11g, 2.4GHZ | |
aed387c7 | 868 | phy->signal = 0x8c; |
92b96797 FB |
869 | } |
870 | break; | |
871 | } | |
872 | ||
4ac306e0 | 873 | if (byPacketType == PK_TYPE_11B) { |
aed387c7 | 874 | phy->service = 0x00; |
4ac306e0 | 875 | if (bExtBit) |
aed387c7 MP |
876 | phy->service |= 0x80; |
877 | phy->len = cpu_to_le16((u16)cbUsCount); | |
4ac306e0 | 878 | } else { |
aed387c7 MP |
879 | phy->service = 0x00; |
880 | phy->len = cpu_to_le16((u16)cbFrameLength); | |
4ac306e0 | 881 | } |
92b96797 FB |
882 | } |
883 | ||
92b96797 FB |
884 | /* |
885 | * Description: Set Antenna mode | |
886 | * | |
887 | * Parameters: | |
888 | * In: | |
889 | * pDevice - Device Structure | |
890 | * byAntennaMode - Antenna Mode | |
891 | * Out: | |
892 | * none | |
893 | * | |
894 | * Return Value: none | |
895 | * | |
896 | */ | |
98583c09 | 897 | void BBvSetAntennaMode(struct vnt_private *pDevice, u8 byAntennaMode) |
92b96797 | 898 | { |
92b96797 FB |
899 | switch (byAntennaMode) { |
900 | case ANT_TXA: | |
92b96797 FB |
901 | case ANT_TXB: |
902 | break; | |
903 | case ANT_RXA: | |
904 | pDevice->byBBRxConf &= 0xFC; | |
905 | break; | |
906 | case ANT_RXB: | |
907 | pDevice->byBBRxConf &= 0xFE; | |
859171ca | 908 | pDevice->byBBRxConf |= 0x02; |
92b96797 FB |
909 | break; |
910 | } | |
911 | ||
92b96797 FB |
912 | CONTROLnsRequestOut(pDevice, |
913 | MESSAGE_TYPE_SET_ANTMD, | |
3eaca0d2 | 914 | (u16) byAntennaMode, |
92b96797 FB |
915 | 0, |
916 | 0, | |
917 | NULL); | |
918 | } | |
919 | ||
920 | /* | |
921 | * Description: Set Antenna mode | |
922 | * | |
923 | * Parameters: | |
924 | * In: | |
925 | * pDevice - Device Structure | |
926 | * byAntennaMode - Antenna Mode | |
927 | * Out: | |
928 | * none | |
929 | * | |
930 | * Return Value: none | |
931 | * | |
932 | */ | |
6487c49e | 933 | |
9b89b049 | 934 | int BBbVT3184Init(struct vnt_private *priv) |
92b96797 | 935 | { |
9b89b049 MP |
936 | int status; |
937 | u16 lenght; | |
938 | u8 *addr; | |
939 | u8 *agc; | |
940 | u16 lenght_agc; | |
941 | u8 array[256]; | |
9df68292 | 942 | u8 data; |
92b96797 | 943 | |
9b89b049 MP |
944 | status = CONTROLnsRequestIn(priv, MESSAGE_TYPE_READ, 0, |
945 | MESSAGE_REQUEST_EEPROM, EEP_MAX_CONTEXT_SIZE, | |
946 | priv->abyEEPROM); | |
947 | if (status != STATUS_SUCCESS) | |
948 | return false; | |
949 | ||
950 | /* zonetype initial */ | |
951 | priv->byOriginalZonetype = priv->abyEEPROM[EEP_OFS_ZONETYPE]; | |
952 | ||
953 | if (priv->config_file.ZoneType >= 0) { | |
954 | if ((priv->config_file.ZoneType == 0) && | |
955 | (priv->abyEEPROM[EEP_OFS_ZONETYPE] != 0x00)) { | |
956 | priv->abyEEPROM[EEP_OFS_ZONETYPE] = 0; | |
957 | priv->abyEEPROM[EEP_OFS_MAXCHANNEL] = 0x0B; | |
958 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO | |
959 | "Init Zone Type :USA\n"); | |
960 | } else if ((priv->config_file.ZoneType == 1) && | |
961 | (priv->abyEEPROM[EEP_OFS_ZONETYPE] != 0x01)) { | |
962 | priv->abyEEPROM[EEP_OFS_ZONETYPE] = 0x01; | |
963 | priv->abyEEPROM[EEP_OFS_MAXCHANNEL] = 0x0D; | |
964 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO | |
965 | "Init Zone Type :Japan\n"); | |
966 | } else if ((priv->config_file.ZoneType == 2) && | |
967 | (priv->abyEEPROM[EEP_OFS_ZONETYPE] != 0x02)) { | |
968 | priv->abyEEPROM[EEP_OFS_ZONETYPE] = 0x02; | |
969 | priv->abyEEPROM[EEP_OFS_MAXCHANNEL] = 0x0D; | |
970 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO | |
971 | "Init Zone Type :Europe\n"); | |
972 | } else { | |
973 | if (priv->config_file.ZoneType != | |
974 | priv->abyEEPROM[EEP_OFS_ZONETYPE]) | |
975 | printk("zonetype in file[%02x]\ | |
976 | mismatch with in EEPROM[%02x]\n", | |
977 | priv->config_file.ZoneType, | |
978 | priv->abyEEPROM[EEP_OFS_ZONETYPE]); | |
979 | else | |
980 | printk("Read Zonetype file success,\ | |
981 | use default zonetype setting[%02x]\n", | |
982 | priv->config_file.ZoneType); | |
983 | } | |
984 | } | |
92b96797 | 985 | |
9b89b049 MP |
986 | if (!priv->bZoneRegExist) |
987 | priv->byZoneType = priv->abyEEPROM[EEP_OFS_ZONETYPE]; | |
988 | ||
989 | priv->byRFType = priv->abyEEPROM[EEP_OFS_RFTYPE]; | |
990 | ||
991 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Zone Type %x\n", | |
992 | priv->byZoneType); | |
993 | ||
994 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"RF Type %d\n", priv->byRFType); | |
995 | ||
996 | if ((priv->byRFType == RF_AL2230) || | |
997 | (priv->byRFType == RF_AL2230S)) { | |
998 | priv->byBBRxConf = abyVT3184_AL2230[10]; | |
999 | lenght = sizeof(abyVT3184_AL2230); | |
1000 | addr = abyVT3184_AL2230; | |
1001 | agc = abyVT3184_AGC; | |
1002 | lenght_agc = sizeof(abyVT3184_AGC); | |
1003 | ||
1004 | priv->abyBBVGA[0] = 0x1C; | |
1005 | priv->abyBBVGA[1] = 0x10; | |
1006 | priv->abyBBVGA[2] = 0x0; | |
1007 | priv->abyBBVGA[3] = 0x0; | |
1008 | priv->ldBmThreshold[0] = -70; | |
1009 | priv->ldBmThreshold[1] = -48; | |
1010 | priv->ldBmThreshold[2] = 0; | |
1011 | priv->ldBmThreshold[3] = 0; | |
1012 | } else if (priv->byRFType == RF_AIROHA7230) { | |
1013 | priv->byBBRxConf = abyVT3184_AL2230[10]; | |
1014 | lenght = sizeof(abyVT3184_AL2230); | |
1015 | addr = abyVT3184_AL2230; | |
1016 | agc = abyVT3184_AGC; | |
1017 | lenght_agc = sizeof(abyVT3184_AGC); | |
1018 | ||
1019 | addr[0xd7] = 0x06; | |
1020 | ||
1021 | priv->abyBBVGA[0] = 0x1c; | |
1022 | priv->abyBBVGA[1] = 0x10; | |
1023 | priv->abyBBVGA[2] = 0x0; | |
1024 | priv->abyBBVGA[3] = 0x0; | |
1025 | priv->ldBmThreshold[0] = -70; | |
1026 | priv->ldBmThreshold[1] = -48; | |
1027 | priv->ldBmThreshold[2] = 0; | |
1028 | priv->ldBmThreshold[3] = 0; | |
1029 | } else if ((priv->byRFType == RF_VT3226) || | |
1030 | (priv->byRFType == RF_VT3226D0)) { | |
1031 | priv->byBBRxConf = abyVT3184_VT3226D0[10]; | |
1032 | lenght = sizeof(abyVT3184_VT3226D0); | |
1033 | addr = abyVT3184_VT3226D0; | |
1034 | agc = abyVT3184_AGC; | |
1035 | lenght_agc = sizeof(abyVT3184_AGC); | |
1036 | ||
1037 | priv->abyBBVGA[0] = 0x20; | |
1038 | priv->abyBBVGA[1] = 0x10; | |
1039 | priv->abyBBVGA[2] = 0x0; | |
1040 | priv->abyBBVGA[3] = 0x0; | |
1041 | priv->ldBmThreshold[0] = -70; | |
1042 | priv->ldBmThreshold[1] = -48; | |
1043 | priv->ldBmThreshold[2] = 0; | |
1044 | priv->ldBmThreshold[3] = 0; | |
1045 | /* Fix VT3226 DFC system timing issue */ | |
1046 | MACvRegBitsOn(priv, MAC_REG_SOFTPWRCTL2, SOFTPWRCTL_RFLEOPT); | |
1047 | } else if ((priv->byRFType == RF_VT3342A0)) { | |
1048 | priv->byBBRxConf = abyVT3184_VT3226D0[10]; | |
1049 | lenght = sizeof(abyVT3184_VT3226D0); | |
1050 | addr = abyVT3184_VT3226D0; | |
1051 | agc = abyVT3184_AGC; | |
1052 | lenght_agc = sizeof(abyVT3184_AGC); | |
1053 | ||
1054 | priv->abyBBVGA[0] = 0x20; | |
1055 | priv->abyBBVGA[1] = 0x10; | |
1056 | priv->abyBBVGA[2] = 0x0; | |
1057 | priv->abyBBVGA[3] = 0x0; | |
1058 | priv->ldBmThreshold[0] = -70; | |
1059 | priv->ldBmThreshold[1] = -48; | |
1060 | priv->ldBmThreshold[2] = 0; | |
1061 | priv->ldBmThreshold[3] = 0; | |
1062 | /* Fix VT3226 DFC system timing issue */ | |
1063 | MACvRegBitsOn(priv, MAC_REG_SOFTPWRCTL2, SOFTPWRCTL_RFLEOPT); | |
1064 | } else { | |
1065 | return true; | |
1066 | } | |
92b96797 | 1067 | |
9b89b049 | 1068 | memcpy(array, addr, lenght); |
92b96797 | 1069 | |
9b89b049 MP |
1070 | CONTROLnsRequestOut(priv, MESSAGE_TYPE_WRITE, 0, |
1071 | MESSAGE_REQUEST_BBREG, lenght, array); | |
1072 | ||
1073 | memcpy(array, agc, lenght_agc); | |
1074 | ||
1075 | CONTROLnsRequestOut(priv, MESSAGE_TYPE_WRITE, 0, | |
1076 | MESSAGE_REQUEST_BBAGC, lenght_agc, array); | |
1077 | ||
1078 | if ((priv->byRFType == RF_VT3226) || | |
1079 | (priv->byRFType == RF_VT3342A0)) { | |
1080 | ControlvWriteByte(priv, MESSAGE_REQUEST_MACREG, | |
1081 | MAC_REG_ITRTMSET, 0x23); | |
1082 | MACvRegBitsOn(priv, MAC_REG_PAPEDELAY, 0x01); | |
1083 | } else if (priv->byRFType == RF_VT3226D0) { | |
1084 | ControlvWriteByte(priv, MESSAGE_REQUEST_MACREG, | |
1085 | MAC_REG_ITRTMSET, 0x11); | |
1086 | MACvRegBitsOn(priv, MAC_REG_PAPEDELAY, 0x01); | |
1087 | } | |
1088 | ||
1089 | ControlvWriteByte(priv, MESSAGE_REQUEST_BBREG, 0x04, 0x7f); | |
1090 | ControlvWriteByte(priv, MESSAGE_REQUEST_BBREG, 0x0d, 0x01); | |
92b96797 | 1091 | |
9b89b049 | 1092 | RFbRFTableDownload(priv); |
92b96797 | 1093 | |
9df68292 MP |
1094 | |
1095 | /* Fix for TX USB resets from vendors driver */ | |
9b89b049 | 1096 | CONTROLnsRequestIn(priv, MESSAGE_TYPE_READ, USB_REG4, |
9df68292 MP |
1097 | MESSAGE_REQUEST_MEM, sizeof(data), &data); |
1098 | ||
1099 | data |= 0x2; | |
1100 | ||
9b89b049 | 1101 | CONTROLnsRequestOut(priv, MESSAGE_TYPE_WRITE, USB_REG4, |
9df68292 MP |
1102 | MESSAGE_REQUEST_MEM, sizeof(data), &data); |
1103 | ||
9b89b049 | 1104 | return true; |
92b96797 FB |
1105 | } |
1106 | ||
92b96797 FB |
1107 | /* |
1108 | * Description: Set ShortSlotTime mode | |
1109 | * | |
1110 | * Parameters: | |
1111 | * In: | |
1112 | * pDevice - Device Structure | |
1113 | * Out: | |
1114 | * none | |
1115 | * | |
1116 | * Return Value: none | |
1117 | * | |
1118 | */ | |
98583c09 | 1119 | void BBvSetShortSlotTime(struct vnt_private *pDevice) |
92b96797 | 1120 | { |
b902fbfe | 1121 | u8 byBBVGA=0; |
92b96797 | 1122 | |
f001d7e2 | 1123 | if (pDevice->bShortSlotTime) |
92b96797 | 1124 | pDevice->byBBRxConf &= 0xDF;//1101 1111 |
f001d7e2 | 1125 | else |
92b96797 | 1126 | pDevice->byBBRxConf |= 0x20;//0010 0000 |
92b96797 FB |
1127 | |
1128 | ControlvReadByte (pDevice, MESSAGE_REQUEST_BBREG, 0xE7, &byBBVGA); | |
f001d7e2 | 1129 | if (byBBVGA == pDevice->abyBBVGA[0]) |
92b96797 | 1130 | pDevice->byBBRxConf |= 0x20;//0010 0000 |
92b96797 FB |
1131 | |
1132 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x0A, pDevice->byBBRxConf); | |
92b96797 FB |
1133 | } |
1134 | ||
b902fbfe | 1135 | void BBvSetVGAGainOffset(struct vnt_private *pDevice, u8 byData) |
92b96797 FB |
1136 | { |
1137 | ||
1138 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xE7, byData); | |
1139 | ||
1140 | // patch for 3253B0 Baseband with Cardbus module | |
f001d7e2 MPS |
1141 | if (pDevice->bShortSlotTime) |
1142 | pDevice->byBBRxConf &= 0xDF; /* 1101 1111 */ | |
1143 | else | |
1144 | pDevice->byBBRxConf |= 0x20; /* 0010 0000 */ | |
1145 | ||
92b96797 FB |
1146 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x0A, pDevice->byBBRxConf);//CR10 |
1147 | } | |
1148 | ||
92b96797 FB |
1149 | /* |
1150 | * Description: BBvSetDeepSleep | |
1151 | * | |
1152 | * Parameters: | |
1153 | * In: | |
1154 | * pDevice - Device Structure | |
1155 | * Out: | |
1156 | * none | |
1157 | * | |
1158 | * Return Value: none | |
1159 | * | |
1160 | */ | |
98583c09 | 1161 | void BBvSetDeepSleep(struct vnt_private *pDevice) |
92b96797 FB |
1162 | { |
1163 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x0c, 0x17);//CR12 | |
1164 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x0D, 0xB9);//CR13 | |
1165 | } | |
1166 | ||
98583c09 | 1167 | void BBvExitDeepSleep(struct vnt_private *pDevice) |
92b96797 FB |
1168 | { |
1169 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x0C, 0x00);//CR12 | |
1170 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x0D, 0x01);//CR13 | |
1171 | } | |
1172 | ||
98583c09 | 1173 | static unsigned long s_ulGetLowSQ3(struct vnt_private *pDevice) |
92b96797 | 1174 | { |
cc856e61 AM |
1175 | int ii; |
1176 | unsigned long ulSQ3 = 0; | |
1177 | unsigned long ulMaxPacket; | |
92b96797 FB |
1178 | |
1179 | ulMaxPacket = pDevice->aulPktNum[RATE_54M]; | |
f001d7e2 | 1180 | if (pDevice->aulPktNum[RATE_54M] != 0) |
92b96797 | 1181 | ulSQ3 = pDevice->aulSQ3Val[RATE_54M] / pDevice->aulPktNum[RATE_54M]; |
f001d7e2 MPS |
1182 | |
1183 | for (ii = RATE_48M; ii >= RATE_6M; ii--) | |
1184 | if (pDevice->aulPktNum[ii] > ulMaxPacket) { | |
92b96797 FB |
1185 | ulMaxPacket = pDevice->aulPktNum[ii]; |
1186 | ulSQ3 = pDevice->aulSQ3Val[ii] / pDevice->aulPktNum[ii]; | |
1187 | } | |
92b96797 FB |
1188 | |
1189 | return ulSQ3; | |
1190 | } | |
1191 | ||
98583c09 | 1192 | static unsigned long s_ulGetRatio(struct vnt_private *pDevice) |
92b96797 | 1193 | { |
cc856e61 AM |
1194 | int ii, jj; |
1195 | unsigned long ulRatio = 0; | |
1196 | unsigned long ulMaxPacket; | |
1197 | unsigned long ulPacketNum; | |
92b96797 FB |
1198 | |
1199 | //This is a thousand-ratio | |
1200 | ulMaxPacket = pDevice->aulPktNum[RATE_54M]; | |
1201 | if ( pDevice->aulPktNum[RATE_54M] != 0 ) { | |
1202 | ulPacketNum = pDevice->aulPktNum[RATE_54M]; | |
1203 | ulRatio = (ulPacketNum * 1000 / pDevice->uDiversityCnt); | |
1204 | ulRatio += TOP_RATE_54M; | |
1205 | } | |
f001d7e2 | 1206 | for (ii = RATE_48M; ii >= RATE_1M; ii--) |
92b96797 FB |
1207 | if ( pDevice->aulPktNum[ii] > ulMaxPacket ) { |
1208 | ulPacketNum = 0; | |
1209 | for ( jj=RATE_54M;jj>=ii;jj--) | |
1210 | ulPacketNum += pDevice->aulPktNum[jj]; | |
1211 | ulRatio = (ulPacketNum * 1000 / pDevice->uDiversityCnt); | |
1212 | ulRatio += TOP_RATE_48M; | |
1213 | ulMaxPacket = pDevice->aulPktNum[ii]; | |
1214 | } | |
1215 | ||
92b96797 FB |
1216 | return ulRatio; |
1217 | } | |
1218 | ||
98583c09 | 1219 | static void s_vClearSQ3Value(struct vnt_private *pDevice) |
92b96797 FB |
1220 | { |
1221 | int ii; | |
1222 | pDevice->uDiversityCnt = 0; | |
1223 | ||
1224 | for ( ii=RATE_1M;ii<MAX_RATE;ii++) { | |
1225 | pDevice->aulPktNum[ii] = 0; | |
1226 | pDevice->aulSQ3Val[ii] = 0; | |
1227 | } | |
1228 | } | |
1229 | ||
92b96797 FB |
1230 | /* |
1231 | * Description: Antenna Diversity | |
1232 | * | |
1233 | * Parameters: | |
1234 | * In: | |
1235 | * pDevice - Device Structure | |
1236 | * byRSR - RSR from received packet | |
1237 | * bySQ3 - SQ3 value from received packet | |
1238 | * Out: | |
1239 | * none | |
1240 | * | |
1241 | * Return Value: none | |
1242 | * | |
1243 | */ | |
1244 | ||
98583c09 MP |
1245 | void BBvAntennaDiversity(struct vnt_private *pDevice, |
1246 | u8 byRxRate, u8 bySQ3) | |
92b96797 FB |
1247 | { |
1248 | ||
1249 | pDevice->uDiversityCnt++; | |
1250 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pDevice->uDiversityCnt = %d\n", (int)pDevice->uDiversityCnt); | |
1251 | ||
1252 | if (byRxRate == 2) { | |
1253 | pDevice->aulPktNum[RATE_1M]++; | |
1254 | } | |
1255 | else if (byRxRate==4) { | |
1256 | pDevice->aulPktNum[RATE_2M]++; | |
1257 | } | |
1258 | else if (byRxRate==11) { | |
1259 | pDevice->aulPktNum[RATE_5M]++; | |
1260 | } | |
1261 | else if (byRxRate==22) { | |
1262 | pDevice->aulPktNum[RATE_11M]++; | |
1263 | } | |
1264 | else if(byRxRate==12){ | |
1265 | pDevice->aulPktNum[RATE_6M]++; | |
1266 | pDevice->aulSQ3Val[RATE_6M] += bySQ3; | |
1267 | } | |
1268 | else if(byRxRate==18){ | |
1269 | pDevice->aulPktNum[RATE_9M]++; | |
1270 | pDevice->aulSQ3Val[RATE_9M] += bySQ3; | |
1271 | } | |
1272 | else if(byRxRate==24){ | |
1273 | pDevice->aulPktNum[RATE_12M]++; | |
1274 | pDevice->aulSQ3Val[RATE_12M] += bySQ3; | |
1275 | } | |
1276 | else if(byRxRate==36){ | |
1277 | pDevice->aulPktNum[RATE_18M]++; | |
1278 | pDevice->aulSQ3Val[RATE_18M] += bySQ3; | |
1279 | } | |
1280 | else if(byRxRate==48){ | |
1281 | pDevice->aulPktNum[RATE_24M]++; | |
1282 | pDevice->aulSQ3Val[RATE_24M] += bySQ3; | |
1283 | } | |
1284 | else if(byRxRate==72){ | |
1285 | pDevice->aulPktNum[RATE_36M]++; | |
1286 | pDevice->aulSQ3Val[RATE_36M] += bySQ3; | |
1287 | } | |
1288 | else if(byRxRate==96){ | |
1289 | pDevice->aulPktNum[RATE_48M]++; | |
1290 | pDevice->aulSQ3Val[RATE_48M] += bySQ3; | |
1291 | } | |
1292 | else if(byRxRate==108){ | |
1293 | pDevice->aulPktNum[RATE_54M]++; | |
1294 | pDevice->aulSQ3Val[RATE_54M] += bySQ3; | |
1295 | } | |
1296 | ||
1297 | if (pDevice->byAntennaState == 0) { | |
1298 | ||
1299 | if (pDevice->uDiversityCnt > pDevice->ulDiversityNValue) { | |
1300 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"ulDiversityNValue=[%d],54M-[%d]\n",(int)pDevice->ulDiversityNValue, (int)pDevice->aulPktNum[RATE_54M]); | |
1301 | ||
1302 | pDevice->ulSQ3_State0 = s_ulGetLowSQ3(pDevice); | |
1303 | pDevice->ulRatio_State0 = s_ulGetRatio(pDevice); | |
1304 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"SQ3_State0, SQ3= [%08x] rate = [%08x]\n",(int)pDevice->ulSQ3_State0,(int)pDevice->ulRatio_State0); | |
1305 | ||
1306 | if ( ((pDevice->aulPktNum[RATE_54M] < pDevice->ulDiversityNValue/2) && | |
1307 | (pDevice->ulSQ3_State0 > pDevice->ulSQ3TH) ) || | |
1308 | (pDevice->ulSQ3_State0 == 0 ) ) { | |
1309 | ||
1310 | if ( pDevice->byTMax == 0 ) | |
1311 | return; | |
1312 | ||
0cbd8d98 AM |
1313 | bScheduleCommand((void *) pDevice, |
1314 | WLAN_CMD_CHANGE_ANTENNA, | |
1315 | NULL); | |
92b96797 FB |
1316 | |
1317 | pDevice->byAntennaState = 1; | |
1318 | ||
1319 | del_timer(&pDevice->TimerSQ3Tmax3); | |
1320 | del_timer(&pDevice->TimerSQ3Tmax2); | |
1321 | pDevice->TimerSQ3Tmax1.expires = RUN_AT(pDevice->byTMax * HZ); | |
1322 | add_timer(&pDevice->TimerSQ3Tmax1); | |
1323 | ||
1324 | } else { | |
1325 | pDevice->TimerSQ3Tmax3.expires = RUN_AT(pDevice->byTMax3 * HZ); | |
1326 | add_timer(&pDevice->TimerSQ3Tmax3); | |
1327 | } | |
1328 | s_vClearSQ3Value(pDevice); | |
1329 | ||
1330 | } | |
1331 | } else { //byAntennaState == 1 | |
1332 | ||
1333 | if (pDevice->uDiversityCnt > pDevice->ulDiversityMValue) { | |
1334 | ||
1335 | del_timer(&pDevice->TimerSQ3Tmax1); | |
1336 | pDevice->ulSQ3_State1 = s_ulGetLowSQ3(pDevice); | |
1337 | pDevice->ulRatio_State1 = s_ulGetRatio(pDevice); | |
1338 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"SQ3_State1, rate0 = %08x,rate1 = %08x\n",(int)pDevice->ulRatio_State0,(int)pDevice->ulRatio_State1); | |
1339 | ||
1340 | if ( ((pDevice->ulSQ3_State1 == 0) && (pDevice->ulSQ3_State0 != 0)) || | |
1341 | ((pDevice->ulSQ3_State1 == 0) && (pDevice->ulSQ3_State0 == 0) && (pDevice->ulRatio_State1 < pDevice->ulRatio_State0)) || | |
1342 | ((pDevice->ulSQ3_State1 != 0) && (pDevice->ulSQ3_State0 != 0) && (pDevice->ulSQ3_State0 < pDevice->ulSQ3_State1)) | |
1343 | ) { | |
1344 | ||
0cbd8d98 AM |
1345 | bScheduleCommand((void *) pDevice, |
1346 | WLAN_CMD_CHANGE_ANTENNA, | |
1347 | NULL); | |
92b96797 FB |
1348 | |
1349 | pDevice->TimerSQ3Tmax3.expires = RUN_AT(pDevice->byTMax3 * HZ); | |
1350 | pDevice->TimerSQ3Tmax2.expires = RUN_AT(pDevice->byTMax2 * HZ); | |
1351 | add_timer(&pDevice->TimerSQ3Tmax3); | |
1352 | add_timer(&pDevice->TimerSQ3Tmax2); | |
1353 | ||
1354 | } | |
1355 | pDevice->byAntennaState = 0; | |
1356 | s_vClearSQ3Value(pDevice); | |
1357 | } | |
1358 | } //byAntennaState | |
1359 | } | |
1360 | ||
92b96797 FB |
1361 | /*+ |
1362 | * | |
1363 | * Description: | |
1364 | * Timer for SQ3 antenna diversity | |
1365 | * | |
1366 | * Parameters: | |
1367 | * In: | |
1368 | * pvSysSpec1 | |
1369 | * hDeviceContext - Pointer to the adapter | |
1370 | * pvSysSpec2 | |
1371 | * pvSysSpec3 | |
1372 | * Out: | |
1373 | * none | |
1374 | * | |
1375 | * Return Value: none | |
1376 | * | |
1377 | -*/ | |
1378 | ||
98583c09 | 1379 | void TimerSQ3CallBack(struct vnt_private *pDevice) |
92b96797 | 1380 | { |
92b96797 FB |
1381 | |
1382 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"TimerSQ3CallBack..."); | |
1383 | spin_lock_irq(&pDevice->lock); | |
1384 | ||
0cbd8d98 | 1385 | bScheduleCommand((void *) pDevice, WLAN_CMD_CHANGE_ANTENNA, NULL); |
92b96797 FB |
1386 | pDevice->byAntennaState = 0; |
1387 | s_vClearSQ3Value(pDevice); | |
1388 | pDevice->TimerSQ3Tmax3.expires = RUN_AT(pDevice->byTMax3 * HZ); | |
1389 | pDevice->TimerSQ3Tmax2.expires = RUN_AT(pDevice->byTMax2 * HZ); | |
1390 | add_timer(&pDevice->TimerSQ3Tmax3); | |
1391 | add_timer(&pDevice->TimerSQ3Tmax2); | |
1392 | ||
92b96797 | 1393 | spin_unlock_irq(&pDevice->lock); |
92b96797 FB |
1394 | } |
1395 | ||
92b96797 FB |
1396 | /*+ |
1397 | * | |
1398 | * Description: | |
1399 | * Timer for SQ3 antenna diversity | |
1400 | * | |
1401 | * Parameters: | |
1402 | * In: | |
1403 | * pvSysSpec1 | |
1404 | * hDeviceContext - Pointer to the adapter | |
1405 | * pvSysSpec2 | |
1406 | * pvSysSpec3 | |
1407 | * Out: | |
1408 | * none | |
1409 | * | |
1410 | * Return Value: none | |
1411 | * | |
1412 | -*/ | |
1413 | ||
98583c09 | 1414 | void TimerSQ3Tmax3CallBack(struct vnt_private *pDevice) |
92b96797 | 1415 | { |
92b96797 FB |
1416 | |
1417 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"TimerSQ3Tmax3CallBack..."); | |
1418 | spin_lock_irq(&pDevice->lock); | |
1419 | ||
1420 | pDevice->ulRatio_State0 = s_ulGetRatio(pDevice); | |
1421 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"SQ3_State0 = [%08x]\n",(int)pDevice->ulRatio_State0); | |
1422 | ||
1423 | s_vClearSQ3Value(pDevice); | |
1424 | if ( pDevice->byTMax == 0 ) { | |
1425 | pDevice->TimerSQ3Tmax3.expires = RUN_AT(pDevice->byTMax3 * HZ); | |
1426 | add_timer(&pDevice->TimerSQ3Tmax3); | |
1427 | spin_unlock_irq(&pDevice->lock); | |
1428 | return; | |
1429 | } | |
1430 | ||
0cbd8d98 | 1431 | bScheduleCommand((void *) pDevice, WLAN_CMD_CHANGE_ANTENNA, NULL); |
92b96797 FB |
1432 | pDevice->byAntennaState = 1; |
1433 | del_timer(&pDevice->TimerSQ3Tmax3); | |
1434 | del_timer(&pDevice->TimerSQ3Tmax2); | |
1435 | pDevice->TimerSQ3Tmax1.expires = RUN_AT(pDevice->byTMax * HZ); | |
1436 | add_timer(&pDevice->TimerSQ3Tmax1); | |
1437 | ||
1438 | spin_unlock_irq(&pDevice->lock); | |
92b96797 FB |
1439 | } |
1440 | ||
98583c09 | 1441 | void BBvUpdatePreEDThreshold(struct vnt_private *pDevice, int bScanning) |
92b96797 FB |
1442 | { |
1443 | ||
92b96797 FB |
1444 | switch(pDevice->byRFType) |
1445 | { | |
1446 | case RF_AL2230: | |
1447 | case RF_AL2230S: | |
1448 | case RF_AIROHA7230: | |
1449 | //RobertYu:20060627, update new table | |
1450 | ||
1451 | if( bScanning ) | |
1452 | { // need Max sensitivity //RSSI -69, -70,.... | |
1453 | if(pDevice->byBBPreEDIndex == 0) break; | |
1454 | pDevice->byBBPreEDIndex = 0; | |
1455 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9) | |
1456 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x30); //CR206(0xCE) | |
1457 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -69, -70, -71,...\n"); | |
1458 | break; | |
1459 | } | |
1460 | ||
1461 | if(pDevice->byBBPreEDRSSI <= 45) { // RSSI 0, -1,-2,....-45 | |
1462 | if(pDevice->byBBPreEDIndex == 20) break; | |
1463 | pDevice->byBBPreEDIndex = 20; | |
1464 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0xFF); //CR201(0xC9) | |
1465 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE) | |
1466 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI 0, -1,-2,..-45\n"); | |
1467 | } else if(pDevice->byBBPreEDRSSI <= 46) { //RSSI -46 | |
1468 | if(pDevice->byBBPreEDIndex == 19) break; | |
1469 | pDevice->byBBPreEDIndex = 19; | |
1470 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x1A); //CR201(0xC9) | |
1471 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE) | |
1472 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -46\n"); | |
1473 | } else if(pDevice->byBBPreEDRSSI <= 47) { //RSSI -47 | |
1474 | if(pDevice->byBBPreEDIndex == 18) break; | |
1475 | pDevice->byBBPreEDIndex = 18; | |
1476 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x15); //CR201(0xC9) | |
1477 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE) | |
1478 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -47\n"); | |
1479 | } else if(pDevice->byBBPreEDRSSI <= 49) { //RSSI -48, -49 | |
1480 | if(pDevice->byBBPreEDIndex == 17) break; | |
1481 | pDevice->byBBPreEDIndex = 17; | |
1482 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x0E); //CR201(0xC9) | |
1483 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE) | |
1484 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -48,-49\n"); | |
1485 | } else if(pDevice->byBBPreEDRSSI <= 51) { //RSSI -50, -51 | |
1486 | if(pDevice->byBBPreEDIndex == 16) break; | |
1487 | pDevice->byBBPreEDIndex = 16; | |
1488 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x09); //CR201(0xC9) | |
1489 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE) | |
1490 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -50,-51\n"); | |
1491 | } else if(pDevice->byBBPreEDRSSI <= 53) { //RSSI -52, -53 | |
1492 | if(pDevice->byBBPreEDIndex == 15) break; | |
1493 | pDevice->byBBPreEDIndex = 15; | |
1494 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x06); //CR201(0xC9) | |
1495 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE) | |
1496 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -52,-53\n"); | |
1497 | } else if(pDevice->byBBPreEDRSSI <= 55) { //RSSI -54, -55 | |
1498 | if(pDevice->byBBPreEDIndex == 14) break; | |
1499 | pDevice->byBBPreEDIndex = 14; | |
1500 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x03); //CR201(0xC9) | |
1501 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE) | |
1502 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -54,-55\n"); | |
1503 | } else if(pDevice->byBBPreEDRSSI <= 56) { //RSSI -56 | |
1504 | if(pDevice->byBBPreEDIndex == 13) break; | |
1505 | pDevice->byBBPreEDIndex = 13; | |
1506 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x02); //CR201(0xC9) | |
1507 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0xA0); //CR206(0xCE) | |
1508 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -56\n"); | |
1509 | } else if(pDevice->byBBPreEDRSSI <= 57) { //RSSI -57 | |
1510 | if(pDevice->byBBPreEDIndex == 12) break; | |
1511 | pDevice->byBBPreEDIndex = 12; | |
1512 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x02); //CR201(0xC9) | |
1513 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x20); //CR206(0xCE) | |
1514 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -57\n"); | |
1515 | } else if(pDevice->byBBPreEDRSSI <= 58) { //RSSI -58 | |
1516 | if(pDevice->byBBPreEDIndex == 11) break; | |
1517 | pDevice->byBBPreEDIndex = 11; | |
1518 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x01); //CR201(0xC9) | |
1519 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0xA0); //CR206(0xCE) | |
1520 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -58\n"); | |
1521 | } else if(pDevice->byBBPreEDRSSI <= 59) { //RSSI -59 | |
1522 | if(pDevice->byBBPreEDIndex == 10) break; | |
1523 | pDevice->byBBPreEDIndex = 10; | |
1524 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x01); //CR201(0xC9) | |
1525 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x54); //CR206(0xCE) | |
1526 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -59\n"); | |
1527 | } else if(pDevice->byBBPreEDRSSI <= 60) { //RSSI -60 | |
1528 | if(pDevice->byBBPreEDIndex == 9) break; | |
1529 | pDevice->byBBPreEDIndex = 9; | |
1530 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x01); //CR201(0xC9) | |
1531 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x18); //CR206(0xCE) | |
1532 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -60\n"); | |
1533 | } else if(pDevice->byBBPreEDRSSI <= 61) { //RSSI -61 | |
1534 | if(pDevice->byBBPreEDIndex == 8) break; | |
1535 | pDevice->byBBPreEDIndex = 8; | |
1536 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9) | |
1537 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0xE3); //CR206(0xCE) | |
1538 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -61\n"); | |
1539 | } else if(pDevice->byBBPreEDRSSI <= 62) { //RSSI -62 | |
1540 | if(pDevice->byBBPreEDIndex == 7) break; | |
1541 | pDevice->byBBPreEDIndex = 7; | |
1542 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9) | |
1543 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0xB9); //CR206(0xCE) | |
1544 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -62\n"); | |
1545 | } else if(pDevice->byBBPreEDRSSI <= 63) { //RSSI -63 | |
1546 | if(pDevice->byBBPreEDIndex == 6) break; | |
1547 | pDevice->byBBPreEDIndex = 6; | |
1548 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9) | |
1549 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x93); //CR206(0xCE) | |
1550 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -63\n"); | |
1551 | } else if(pDevice->byBBPreEDRSSI <= 64) { //RSSI -64 | |
1552 | if(pDevice->byBBPreEDIndex == 5) break; | |
1553 | pDevice->byBBPreEDIndex = 5; | |
1554 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9) | |
1555 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x79); //CR206(0xCE) | |
1556 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -64\n"); | |
1557 | } else if(pDevice->byBBPreEDRSSI <= 65) { //RSSI -65 | |
1558 | if(pDevice->byBBPreEDIndex == 4) break; | |
1559 | pDevice->byBBPreEDIndex = 4; | |
1560 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9) | |
1561 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x62); //CR206(0xCE) | |
1562 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -65\n"); | |
1563 | } else if(pDevice->byBBPreEDRSSI <= 66) { //RSSI -66 | |
1564 | if(pDevice->byBBPreEDIndex == 3) break; | |
1565 | pDevice->byBBPreEDIndex = 3; | |
1566 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9) | |
1567 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x51); //CR206(0xCE) | |
1568 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -66\n"); | |
1569 | } else if(pDevice->byBBPreEDRSSI <= 67) { //RSSI -67 | |
1570 | if(pDevice->byBBPreEDIndex == 2) break; | |
1571 | pDevice->byBBPreEDIndex = 2; | |
1572 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9) | |
1573 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x43); //CR206(0xCE) | |
1574 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -67\n"); | |
1575 | } else if(pDevice->byBBPreEDRSSI <= 68) { //RSSI -68 | |
1576 | if(pDevice->byBBPreEDIndex == 1) break; | |
1577 | pDevice->byBBPreEDIndex = 1; | |
1578 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9) | |
1579 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x36); //CR206(0xCE) | |
1580 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -68\n"); | |
1581 | } else { //RSSI -69, -70,.... | |
1582 | if(pDevice->byBBPreEDIndex == 0) break; | |
1583 | pDevice->byBBPreEDIndex = 0; | |
1584 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9) | |
1585 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x30); //CR206(0xCE) | |
1586 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -69, -70,...\n"); | |
1587 | } | |
1588 | break; | |
1589 | ||
1590 | case RF_VT3226: | |
1591 | case RF_VT3226D0: | |
1592 | //RobertYu:20060627, update new table | |
1593 | ||
1594 | if( bScanning ) | |
1595 | { // need Max sensitivity //RSSI -69, -70, ... | |
1596 | if(pDevice->byBBPreEDIndex == 0) break; | |
1597 | pDevice->byBBPreEDIndex = 0; | |
1598 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9) | |
1599 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x24); //CR206(0xCE) | |
1600 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -69, -70,..\n"); | |
1601 | break; | |
1602 | } | |
1603 | ||
1604 | if(pDevice->byBBPreEDRSSI <= 41) { // RSSI 0, -1,-2,....-41 | |
1605 | if(pDevice->byBBPreEDIndex == 22) break; | |
1606 | pDevice->byBBPreEDIndex = 22; | |
1607 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0xFF); //CR201(0xC9) | |
1608 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE) | |
1609 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI 0, -1,-2,..-41\n"); | |
1610 | } else if(pDevice->byBBPreEDRSSI <= 42) { //RSSI -42 | |
1611 | if(pDevice->byBBPreEDIndex == 21) break; | |
1612 | pDevice->byBBPreEDIndex = 21; | |
1613 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x36); //CR201(0xC9) | |
1614 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE) | |
1615 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -42\n"); | |
1616 | } else if(pDevice->byBBPreEDRSSI <= 43) { //RSSI -43 | |
1617 | if(pDevice->byBBPreEDIndex == 20) break; | |
1618 | pDevice->byBBPreEDIndex = 20; | |
1619 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x26); //CR201(0xC9) | |
1620 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE) | |
1621 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -43\n"); | |
1622 | } else if(pDevice->byBBPreEDRSSI <= 45) { //RSSI -44, -45 | |
1623 | if(pDevice->byBBPreEDIndex == 19) break; | |
1624 | pDevice->byBBPreEDIndex = 19; | |
1625 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x18); //CR201(0xC9) | |
1626 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE) | |
1627 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -44,-45\n"); | |
1628 | } else if(pDevice->byBBPreEDRSSI <= 47) { //RSSI -46, -47 | |
1629 | if(pDevice->byBBPreEDIndex == 18) break; | |
1630 | pDevice->byBBPreEDIndex = 18; | |
1631 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x11); //CR201(0xC9) | |
1632 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE) | |
1633 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -46,-47\n"); | |
1634 | } else if(pDevice->byBBPreEDRSSI <= 49) { //RSSI -48, -49 | |
1635 | if(pDevice->byBBPreEDIndex == 17) break; | |
1636 | pDevice->byBBPreEDIndex = 17; | |
1637 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x0a); //CR201(0xC9) | |
1638 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE) | |
1639 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -48,-49\n"); | |
1640 | } else if(pDevice->byBBPreEDRSSI <= 51) { //RSSI -50, -51 | |
1641 | if(pDevice->byBBPreEDIndex == 16) break; | |
1642 | pDevice->byBBPreEDIndex = 16; | |
1643 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x07); //CR201(0xC9) | |
1644 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE) | |
1645 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -50,-51\n"); | |
1646 | } else if(pDevice->byBBPreEDRSSI <= 53) { //RSSI -52, -53 | |
1647 | if(pDevice->byBBPreEDIndex == 15) break; | |
1648 | pDevice->byBBPreEDIndex = 15; | |
1649 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x04); //CR201(0xC9) | |
1650 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE) | |
1651 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -52,-53\n"); | |
1652 | } else if(pDevice->byBBPreEDRSSI <= 55) { //RSSI -54, -55 | |
1653 | if(pDevice->byBBPreEDIndex == 14) break; | |
1654 | pDevice->byBBPreEDIndex = 14; | |
1655 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x02); //CR201(0xC9) | |
1656 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0xC0); //CR206(0xCE) | |
1657 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -54,-55\n"); | |
1658 | } else if(pDevice->byBBPreEDRSSI <= 56) { //RSSI -56 | |
1659 | if(pDevice->byBBPreEDIndex == 13) break; | |
1660 | pDevice->byBBPreEDIndex = 13; | |
1661 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x02); //CR201(0xC9) | |
1662 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x30); //CR206(0xCE) | |
1663 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -56\n"); | |
1664 | } else if(pDevice->byBBPreEDRSSI <= 57) { //RSSI -57 | |
1665 | if(pDevice->byBBPreEDIndex == 12) break; | |
1666 | pDevice->byBBPreEDIndex = 12; | |
1667 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x01); //CR201(0xC9) | |
1668 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0xB0); //CR206(0xCE) | |
1669 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -57\n"); | |
1670 | } else if(pDevice->byBBPreEDRSSI <= 58) { //RSSI -58 | |
1671 | if(pDevice->byBBPreEDIndex == 11) break; | |
1672 | pDevice->byBBPreEDIndex = 11; | |
1673 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x01); //CR201(0xC9) | |
1674 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x70); //CR206(0xCE) | |
1675 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -58\n"); | |
1676 | } else if(pDevice->byBBPreEDRSSI <= 59) { //RSSI -59 | |
1677 | if(pDevice->byBBPreEDIndex == 10) break; | |
1678 | pDevice->byBBPreEDIndex = 10; | |
1679 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x01); //CR201(0xC9) | |
1680 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x30); //CR206(0xCE) | |
1681 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -59\n"); | |
1682 | } else if(pDevice->byBBPreEDRSSI <= 60) { //RSSI -60 | |
1683 | if(pDevice->byBBPreEDIndex == 9) break; | |
1684 | pDevice->byBBPreEDIndex = 9; | |
1685 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9) | |
1686 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0xEA); //CR206(0xCE) | |
1687 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -60\n"); | |
1688 | } else if(pDevice->byBBPreEDRSSI <= 61) { //RSSI -61 | |
1689 | if(pDevice->byBBPreEDIndex == 8) break; | |
1690 | pDevice->byBBPreEDIndex = 8; | |
1691 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9) | |
1692 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0xC0); //CR206(0xCE) | |
1693 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -61\n"); | |
1694 | } else if(pDevice->byBBPreEDRSSI <= 62) { //RSSI -62 | |
1695 | if(pDevice->byBBPreEDIndex == 7) break; | |
1696 | pDevice->byBBPreEDIndex = 7; | |
1697 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9) | |
1698 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x9C); //CR206(0xCE) | |
1699 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -62\n"); | |
1700 | } else if(pDevice->byBBPreEDRSSI <= 63) { //RSSI -63 | |
1701 | if(pDevice->byBBPreEDIndex == 6) break; | |
1702 | pDevice->byBBPreEDIndex = 6; | |
1703 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9) | |
1704 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x80); //CR206(0xCE) | |
1705 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -63\n"); | |
1706 | } else if(pDevice->byBBPreEDRSSI <= 64) { //RSSI -64 | |
1707 | if(pDevice->byBBPreEDIndex == 5) break; | |
1708 | pDevice->byBBPreEDIndex = 5; | |
1709 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9) | |
1710 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x68); //CR206(0xCE) | |
1711 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -64\n"); | |
1712 | } else if(pDevice->byBBPreEDRSSI <= 65) { //RSSI -65 | |
1713 | if(pDevice->byBBPreEDIndex == 4) break; | |
1714 | pDevice->byBBPreEDIndex = 4; | |
1715 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9) | |
1716 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x52); //CR206(0xCE) | |
1717 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -65\n"); | |
1718 | } else if(pDevice->byBBPreEDRSSI <= 66) { //RSSI -66 | |
1719 | if(pDevice->byBBPreEDIndex == 3) break; | |
1720 | pDevice->byBBPreEDIndex = 3; | |
1721 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9) | |
1722 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x43); //CR206(0xCE) | |
1723 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -66\n"); | |
1724 | } else if(pDevice->byBBPreEDRSSI <= 67) { //RSSI -67 | |
1725 | if(pDevice->byBBPreEDIndex == 2) break; | |
1726 | pDevice->byBBPreEDIndex = 2; | |
1727 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9) | |
1728 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x36); //CR206(0xCE) | |
1729 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -67\n"); | |
1730 | } else if(pDevice->byBBPreEDRSSI <= 68) { //RSSI -68 | |
1731 | if(pDevice->byBBPreEDIndex == 1) break; | |
1732 | pDevice->byBBPreEDIndex = 1; | |
1733 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9) | |
1734 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x2D); //CR206(0xCE) | |
1735 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -68\n"); | |
1736 | } else { //RSSI -69, -70, ... | |
1737 | if(pDevice->byBBPreEDIndex == 0) break; | |
1738 | pDevice->byBBPreEDIndex = 0; | |
1739 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9) | |
1740 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x24); //CR206(0xCE) | |
1741 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -69, -70,..\n"); | |
1742 | } | |
1743 | break; | |
1744 | ||
1745 | case RF_VT3342A0: //RobertYu:20060627, testing table | |
1746 | if( bScanning ) | |
1747 | { // need Max sensitivity //RSSI -67, -68, ... | |
1748 | if(pDevice->byBBPreEDIndex == 0) break; | |
1749 | pDevice->byBBPreEDIndex = 0; | |
1750 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9) | |
1751 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x38); //CR206(0xCE) | |
1752 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -67, -68,..\n"); | |
1753 | break; | |
1754 | } | |
1755 | ||
1756 | if(pDevice->byBBPreEDRSSI <= 41) { // RSSI 0, -1,-2,....-41 | |
1757 | if(pDevice->byBBPreEDIndex == 20) break; | |
1758 | pDevice->byBBPreEDIndex = 20; | |
1759 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0xFF); //CR201(0xC9) | |
1760 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE) | |
1761 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI 0, -1,-2,..-41\n"); | |
1762 | } else if(pDevice->byBBPreEDRSSI <= 42) { //RSSI -42 | |
1763 | if(pDevice->byBBPreEDIndex == 19) break; | |
1764 | pDevice->byBBPreEDIndex = 19; | |
1765 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x36); //CR201(0xC9) | |
1766 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE) | |
1767 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -42\n"); | |
1768 | } else if(pDevice->byBBPreEDRSSI <= 43) { //RSSI -43 | |
1769 | if(pDevice->byBBPreEDIndex == 18) break; | |
1770 | pDevice->byBBPreEDIndex = 18; | |
1771 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x26); //CR201(0xC9) | |
1772 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE) | |
1773 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -43\n"); | |
1774 | } else if(pDevice->byBBPreEDRSSI <= 45) { //RSSI -44, -45 | |
1775 | if(pDevice->byBBPreEDIndex == 17) break; | |
1776 | pDevice->byBBPreEDIndex = 17; | |
1777 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x18); //CR201(0xC9) | |
1778 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE) | |
1779 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -44,-45\n"); | |
1780 | } else if(pDevice->byBBPreEDRSSI <= 47) { //RSSI -46, -47 | |
1781 | if(pDevice->byBBPreEDIndex == 16) break; | |
1782 | pDevice->byBBPreEDIndex = 16; | |
1783 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x11); //CR201(0xC9) | |
1784 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE) | |
1785 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -46,-47\n"); | |
1786 | } else if(pDevice->byBBPreEDRSSI <= 49) { //RSSI -48, -49 | |
1787 | if(pDevice->byBBPreEDIndex == 15) break; | |
1788 | pDevice->byBBPreEDIndex = 15; | |
1789 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x0a); //CR201(0xC9) | |
1790 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE) | |
1791 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -48,-49\n"); | |
1792 | } else if(pDevice->byBBPreEDRSSI <= 51) { //RSSI -50, -51 | |
1793 | if(pDevice->byBBPreEDIndex == 14) break; | |
1794 | pDevice->byBBPreEDIndex = 14; | |
1795 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x07); //CR201(0xC9) | |
1796 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE) | |
1797 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -50,-51\n"); | |
1798 | } else if(pDevice->byBBPreEDRSSI <= 53) { //RSSI -52, -53 | |
1799 | if(pDevice->byBBPreEDIndex == 13) break; | |
1800 | pDevice->byBBPreEDIndex = 13; | |
1801 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x04); //CR201(0xC9) | |
1802 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE) | |
1803 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -52,-53\n"); | |
1804 | } else if(pDevice->byBBPreEDRSSI <= 55) { //RSSI -54, -55 | |
1805 | if(pDevice->byBBPreEDIndex == 12) break; | |
1806 | pDevice->byBBPreEDIndex = 12; | |
1807 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x02); //CR201(0xC9) | |
1808 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0xC0); //CR206(0xCE) | |
1809 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -54,-55\n"); | |
1810 | } else if(pDevice->byBBPreEDRSSI <= 56) { //RSSI -56 | |
1811 | if(pDevice->byBBPreEDIndex == 11) break; | |
1812 | pDevice->byBBPreEDIndex = 11; | |
1813 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x02); //CR201(0xC9) | |
1814 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x30); //CR206(0xCE) | |
1815 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -56\n"); | |
1816 | } else if(pDevice->byBBPreEDRSSI <= 57) { //RSSI -57 | |
1817 | if(pDevice->byBBPreEDIndex == 10) break; | |
1818 | pDevice->byBBPreEDIndex = 10; | |
1819 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x01); //CR201(0xC9) | |
1820 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0xB0); //CR206(0xCE) | |
1821 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -57\n"); | |
1822 | } else if(pDevice->byBBPreEDRSSI <= 58) { //RSSI -58 | |
1823 | if(pDevice->byBBPreEDIndex == 9) break; | |
1824 | pDevice->byBBPreEDIndex = 9; | |
1825 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x01); //CR201(0xC9) | |
1826 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x70); //CR206(0xCE) | |
1827 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -58\n"); | |
1828 | } else if(pDevice->byBBPreEDRSSI <= 59) { //RSSI -59 | |
1829 | if(pDevice->byBBPreEDIndex == 8) break; | |
1830 | pDevice->byBBPreEDIndex = 8; | |
1831 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x01); //CR201(0xC9) | |
1832 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x30); //CR206(0xCE) | |
1833 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -59\n"); | |
1834 | } else if(pDevice->byBBPreEDRSSI <= 60) { //RSSI -60 | |
1835 | if(pDevice->byBBPreEDIndex == 7) break; | |
1836 | pDevice->byBBPreEDIndex = 7; | |
1837 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9) | |
1838 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0xEA); //CR206(0xCE) | |
1839 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -60\n"); | |
1840 | } else if(pDevice->byBBPreEDRSSI <= 61) { //RSSI -61 | |
1841 | if(pDevice->byBBPreEDIndex == 6) break; | |
1842 | pDevice->byBBPreEDIndex = 6; | |
1843 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9) | |
1844 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0xC0); //CR206(0xCE) | |
1845 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -61\n"); | |
1846 | } else if(pDevice->byBBPreEDRSSI <= 62) { //RSSI -62 | |
1847 | if(pDevice->byBBPreEDIndex == 5) break; | |
1848 | pDevice->byBBPreEDIndex = 5; | |
1849 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9) | |
1850 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x9C); //CR206(0xCE) | |
1851 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -62\n"); | |
1852 | } else if(pDevice->byBBPreEDRSSI <= 63) { //RSSI -63 | |
1853 | if(pDevice->byBBPreEDIndex == 4) break; | |
1854 | pDevice->byBBPreEDIndex = 4; | |
1855 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9) | |
1856 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x80); //CR206(0xCE) | |
1857 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -63\n"); | |
1858 | } else if(pDevice->byBBPreEDRSSI <= 64) { //RSSI -64 | |
1859 | if(pDevice->byBBPreEDIndex == 3) break; | |
1860 | pDevice->byBBPreEDIndex = 3; | |
1861 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9) | |
1862 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x68); //CR206(0xCE) | |
1863 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -64\n"); | |
1864 | } else if(pDevice->byBBPreEDRSSI <= 65) { //RSSI -65 | |
1865 | if(pDevice->byBBPreEDIndex == 2) break; | |
1866 | pDevice->byBBPreEDIndex = 2; | |
1867 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9) | |
1868 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x52); //CR206(0xCE) | |
1869 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -65\n"); | |
1870 | } else if(pDevice->byBBPreEDRSSI <= 66) { //RSSI -66 | |
1871 | if(pDevice->byBBPreEDIndex == 1) break; | |
1872 | pDevice->byBBPreEDIndex = 1; | |
1873 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9) | |
1874 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x43); //CR206(0xCE) | |
1875 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -66\n"); | |
1876 | } else { //RSSI -67, -68, ... | |
1877 | if(pDevice->byBBPreEDIndex == 0) break; | |
1878 | pDevice->byBBPreEDIndex = 0; | |
1879 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9) | |
1880 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x38); //CR206(0xCE) | |
1881 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -67, -68,..\n"); | |
1882 | } | |
1883 | break; | |
1884 | ||
1885 | } | |
1886 | ||
1887 | } | |
1888 |