1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35#include "mac.h"
36#include "rf.h"
37#include "baseband.h"
38#include "control.h"
39#include "rndis.h"
40#include "datarate.h"
41
42static int msglevel =MSG_LEVEL_INFO;
43
44#define BY_AL2230_REG_LEN 23
45#define CB_AL2230_INIT_SEQ 15
46#define AL2230_PWR_IDX_LEN 64
47
48#define BY_AL7230_REG_LEN 23
49#define CB_AL7230_INIT_SEQ 16
50#define AL7230_PWR_IDX_LEN 64
51
52
53#define BY_VT3226_REG_LEN 23
54#define CB_VT3226_INIT_SEQ 11
55#define VT3226_PWR_IDX_LEN 64
56
57
58
59#define BY_VT3342_REG_LEN 23
60#define CB_VT3342_INIT_SEQ 13
61#define VT3342_PWR_IDX_LEN 64
62
63
64u8 abyAL2230InitTable[CB_AL2230_INIT_SEQ][3] = {
65 {0x03, 0xF7, 0x90},
66 {0x03, 0x33, 0x31},
67 {0x01, 0xB8, 0x02},
68 {0x00, 0xFF, 0xF3},
69 {0x00, 0x05, 0xA4},
70 {0x0F, 0x4D, 0xC5},
71 {0x08, 0x05, 0xB6},
72 {0x01, 0x47, 0xC7},
73 {0x00, 0x06, 0x88},
74 {0x04, 0x03, 0xB9},
75 {0x00, 0xDB, 0xBA},
76 {0x00, 0x09, 0x9B},
77 {0x0B, 0xDF, 0xFC},
78 {0x00, 0x00, 0x0D},
79 {0x00, 0x58, 0x0F}
80 };
81
82u8 abyAL2230ChannelTable0[CB_MAX_CHANNEL_24G][3] = {
83 {0x03, 0xF7, 0x90},
84 {0x03, 0xF7, 0x90},
85 {0x03, 0xE7, 0x90},
86 {0x03, 0xE7, 0x90},
87 {0x03, 0xF7, 0xA0},
88 {0x03, 0xF7, 0xA0},
89 {0x03, 0xE7, 0xA0},
90 {0x03, 0xE7, 0xA0},
91 {0x03, 0xF7, 0xB0},
92 {0x03, 0xF7, 0xB0},
93 {0x03, 0xE7, 0xB0},
94 {0x03, 0xE7, 0xB0},
95 {0x03, 0xF7, 0xC0},
96 {0x03, 0xE7, 0xC0}
97 };
98
99u8 abyAL2230ChannelTable1[CB_MAX_CHANNEL_24G][3] = {
100 {0x03, 0x33, 0x31},
101 {0x0B, 0x33, 0x31},
102 {0x03, 0x33, 0x31},
103 {0x0B, 0x33, 0x31},
104 {0x03, 0x33, 0x31},
105 {0x0B, 0x33, 0x31},
106 {0x03, 0x33, 0x31},
107 {0x0B, 0x33, 0x31},
108 {0x03, 0x33, 0x31},
109 {0x0B, 0x33, 0x31},
110 {0x03, 0x33, 0x31},
111 {0x0B, 0x33, 0x31},
112 {0x03, 0x33, 0x31},
113 {0x06, 0x66, 0x61}
114 };
115
116
117
118u8 abyAL7230InitTable[CB_AL7230_INIT_SEQ][3] = {
119 {0x20, 0x37, 0x90},
120 {0x13, 0x33, 0x31},
121 {0x84, 0x1F, 0xF2},
122 {0x3F, 0xDF, 0xA3},
123 {0x7F, 0xD7, 0x84},
124
125
126 {0x80, 0x2B, 0x55},
127 {0x56, 0xAF, 0x36},
128 {0xCE, 0x02, 0x07},
129 {0x6E, 0xBC, 0x98},
130 {0x22, 0x1B, 0xB9},
131 {0xE0, 0x00, 0x0A},
132 {0x08, 0x03, 0x1B},
133
134
135 {0x00, 0x0A, 0x3C},
136 {0xFF, 0xFF, 0xFD},
137 {0x00, 0x00, 0x0E},
138 {0x1A, 0xBA, 0x8F}
139 };
140
141u8 abyAL7230InitTableAMode[CB_AL7230_INIT_SEQ][3] = {
142 {0x2F, 0xF5, 0x20},
143 {0x00, 0x00, 0x01},
144 {0x45, 0x1F, 0xE2},
145 {0x5F, 0xDF, 0xA3},
146 {0x6F, 0xD7, 0x84},
147 {0x85, 0x3F, 0x55},
148 {0x56, 0xAF, 0x36},
149 {0xCE, 0x02, 0x07},
150 {0x6E, 0xBC, 0x98},
151 {0x22, 0x1B, 0xB9},
152 {0xE0, 0x60, 0x0A},
153 {0x08, 0x03, 0x1B},
154 {0x00, 0x14, 0x7C},
155 {0xFF, 0xFF, 0xFD},
156 {0x00, 0x00, 0x0E},
157 {0x12, 0xBA, 0xCF}
158 };
159
160u8 abyAL7230ChannelTable0[CB_MAX_CHANNEL][3] = {
161 {0x20, 0x37, 0x90},
162 {0x20, 0x37, 0x90},
163 {0x20, 0x37, 0x90},
164 {0x20, 0x37, 0x90},
165 {0x20, 0x37, 0xA0},
166 {0x20, 0x37, 0xA0},
167 {0x20, 0x37, 0xA0},
168 {0x20, 0x37, 0xA0},
169 {0x20, 0x37, 0xB0},
170 {0x20, 0x37, 0xB0},
171 {0x20, 0x37, 0xB0},
172 {0x20, 0x37, 0xB0},
173 {0x20, 0x37, 0xC0},
174 {0x20, 0x37, 0xC0},
175
176
177 {0x0F, 0xF5, 0x20},
178 {0x2F, 0xF5, 0x20},
179 {0x0F, 0xF5, 0x20},
180 {0x0F, 0xF5, 0x20},
181 {0x2F, 0xF5, 0x20},
182 {0x0F, 0xF5, 0x20},
183 {0x2F, 0xF5, 0x30},
184 {0x2F, 0xF5, 0x30},
185
186
187
188
189 {0x0F, 0xF5, 0x40},
190 {0x2F, 0xF5, 0x40},
191 {0x0F, 0xF5, 0x40},
192 {0x0F, 0xF5, 0x40},
193 {0x2F, 0xF5, 0x40},
194 {0x2F, 0xF5, 0x50},
195 {0x2F, 0xF5, 0x60},
196 {0x2F, 0xF5, 0x60},
197 {0x2F, 0xF5, 0x70},
198 {0x2F, 0xF5, 0x70},
199 {0x2F, 0xF5, 0x70},
200 {0x2F, 0xF5, 0x70},
201 {0x2F, 0xF5, 0x70},
202 {0x2F, 0xF5, 0x70},
203 {0x2F, 0xF5, 0x80},
204 {0x2F, 0xF5, 0x80},
205 {0x2F, 0xF5, 0x80},
206 {0x2F, 0xF5, 0x90},
207
208 {0x2F, 0xF5, 0xC0},
209 {0x2F, 0xF5, 0xC0},
210 {0x2F, 0xF5, 0xC0},
211 {0x2F, 0xF5, 0xD0},
212 {0x2F, 0xF5, 0xD0},
213 {0x2F, 0xF5, 0xD0},
214 {0x2F, 0xF5, 0xE0},
215 {0x2F, 0xF5, 0xE0},
216 {0x2F, 0xF5, 0xE0},
217 {0x2F, 0xF5, 0xF0},
218 {0x2F, 0xF5, 0xF0},
219 {0x2F, 0xF6, 0x00},
220 {0x2F, 0xF6, 0x00},
221 {0x2F, 0xF6, 0x00},
222 {0x2F, 0xF6, 0x10},
223 {0x2F, 0xF6, 0x10}
224 };
225
226u8 abyAL7230ChannelTable1[CB_MAX_CHANNEL][3] = {
227 {0x13, 0x33, 0x31},
228 {0x1B, 0x33, 0x31},
229 {0x03, 0x33, 0x31},
230 {0x0B, 0x33, 0x31},
231 {0x13, 0x33, 0x31},
232 {0x1B, 0x33, 0x31},
233 {0x03, 0x33, 0x31},
234 {0x0B, 0x33, 0x31},
235 {0x13, 0x33, 0x31},
236 {0x1B, 0x33, 0x31},
237 {0x03, 0x33, 0x31},
238 {0x0B, 0x33, 0x31},
239 {0x13, 0x33, 0x31},
240 {0x06, 0x66, 0x61},
241
242
243 {0x1D, 0x55, 0x51},
244 {0x00, 0x00, 0x01},
245 {0x02, 0xAA, 0xA1},
246 {0x08, 0x00, 0x01},
247 {0x0A, 0xAA, 0xA1},
248 {0x0D, 0x55, 0x51},
249 {0x15, 0x55, 0x51},
250 {0x00, 0x00, 0x01},
251
252
253
254 {0x1D, 0x55, 0x51},
255 {0x00, 0x00, 0x01},
256 {0x02, 0xAA, 0xA1},
257 {0x08, 0x00, 0x01},
258 {0x0A, 0xAA, 0xA1},
259 {0x15, 0x55, 0x51},
260 {0x05, 0x55, 0x51},
261 {0x0A, 0xAA, 0xA1},
262 {0x10, 0x00, 0x01},
263 {0x15, 0x55, 0x51},
264 {0x1A, 0xAA, 0xA1},
265 {0x00, 0x00, 0x01},
266 {0x05, 0x55, 0x51},
267 {0x0A, 0xAA, 0xA1},
268 {0x15, 0x55, 0x51},
269 {0x00, 0x00, 0x01},
270 {0x0A, 0xAA, 0xA1},
271 {0x15, 0x55, 0x51},
272 {0x15, 0x55, 0x51},
273 {0x00, 0x00, 0x01},
274 {0x0A, 0xAA, 0xA1},
275 {0x15, 0x55, 0x51},
276 {0x00, 0x00, 0x01},
277 {0x0A, 0xAA, 0xA1},
278 {0x15, 0x55, 0x51},
279 {0x00, 0x00, 0x01},
280 {0x0A, 0xAA, 0xA1},
281 {0x15, 0x55, 0x51},
282 {0x00, 0x00, 0x01},
283 {0x18, 0x00, 0x01},
284 {0x02, 0xAA, 0xA1},
285 {0x0D, 0x55, 0x51},
286 {0x18, 0x00, 0x01},
287 {0x02, 0xAA, 0xB1}
288 };
289
290u8 abyAL7230ChannelTable2[CB_MAX_CHANNEL][3] = {
291 {0x7F, 0xD7, 0x84},
292 {0x7F, 0xD7, 0x84},
293 {0x7F, 0xD7, 0x84},
294 {0x7F, 0xD7, 0x84},
295 {0x7F, 0xD7, 0x84},
296 {0x7F, 0xD7, 0x84},
297 {0x7F, 0xD7, 0x84},
298 {0x7F, 0xD7, 0x84},
299 {0x7F, 0xD7, 0x84},
300 {0x7F, 0xD7, 0x84},
301 {0x7F, 0xD7, 0x84},
302 {0x7F, 0xD7, 0x84},
303 {0x7F, 0xD7, 0x84},
304 {0x7F, 0xD7, 0x84},
305
306
307 {0x7F, 0xD7, 0x84},
308 {0x6F, 0xD7, 0x84},
309 {0x7F, 0xD7, 0x84},
310 {0x7F, 0xD7, 0x84},
311 {0x7F, 0xD7, 0x84},
312 {0x7F, 0xD7, 0x84},
313 {0x7F, 0xD7, 0x84},
314 {0x6F, 0xD7, 0x84},
315
316
317
318 {0x7F, 0xD7, 0x84},
319 {0x6F, 0xD7, 0x84},
320 {0x7F, 0xD7, 0x84},
321 {0x7F, 0xD7, 0x84},
322 {0x7F, 0xD7, 0x84},
323 {0x7F, 0xD7, 0x84},
324 {0x7F, 0xD7, 0x84},
325 {0x7F, 0xD7, 0x84},
326 {0x7F, 0xD7, 0x84},
327 {0x7F, 0xD7, 0x84},
328 {0x7F, 0xD7, 0x84},
329 {0x6F, 0xD7, 0x84},
330 {0x7F, 0xD7, 0x84},
331 {0x7F, 0xD7, 0x84},
332 {0x7F, 0xD7, 0x84},
333 {0x6F, 0xD7, 0x84},
334 {0x7F, 0xD7, 0x84},
335 {0x7F, 0xD7, 0x84},
336 {0x7F, 0xD7, 0x84},
337 {0x6F, 0xD7, 0x84},
338 {0x7F, 0xD7, 0x84},
339 {0x7F, 0xD7, 0x84},
340 {0x6F, 0xD7, 0x84},
341 {0x7F, 0xD7, 0x84},
342 {0x7F, 0xD7, 0x84},
343 {0x6F, 0xD7, 0x84},
344 {0x7F, 0xD7, 0x84},
345 {0x7F, 0xD7, 0x84},
346 {0x6F, 0xD7, 0x84},
347 {0x7F, 0xD7, 0x84},
348 {0x7F, 0xD7, 0x84},
349 {0x7F, 0xD7, 0x84},
350 {0x7F, 0xD7, 0x84},
351 {0x7F, 0xD7, 0x84}
352 };
353
354
355u8 abyVT3226_InitTable[CB_VT3226_INIT_SEQ][3] = {
356 {0x03, 0xFF, 0x80},
357 {0x02, 0x82, 0xA1},
358 {0x03, 0xC6, 0xA2},
359 {0x01, 0x97, 0x93},
360 {0x03, 0x66, 0x64},
361 {0x00, 0x61, 0xA5},
362 {0x01, 0x7B, 0xD6},
363 {0x00, 0x80, 0x17},
364 {0x03, 0xF8, 0x08},
365 {0x00, 0x02, 0x39},
366 {0x02, 0x00, 0x2A}
367 };
368
369u8 abyVT3226D0_InitTable[CB_VT3226_INIT_SEQ][3] = {
370 {0x03, 0xFF, 0x80},
371 {0x03, 0x02, 0x21},
372 {0x03, 0xC6, 0xA2},
373 {0x01, 0x97, 0x93},
374 {0x03, 0x66, 0x64},
375 {0x00, 0x71, 0xA5},
376 {0x01, 0x15, 0xC6},
377 {0x01, 0x2E, 0x07},
378 {0x00, 0x58, 0x08},
379 {0x00, 0x02, 0x79},
380 {0x02, 0x01, 0xAA}
381 };
382
383u8 abyVT3226_ChannelTable0[CB_MAX_CHANNEL_24G][3] = {
384 {0x01, 0x97, 0x83},
385 {0x01, 0x97, 0x83},
386 {0x01, 0x97, 0x93},
387 {0x01, 0x97, 0x93},
388 {0x01, 0x97, 0x93},
389 {0x01, 0x97, 0x93},
390 {0x01, 0x97, 0xA3},
391 {0x01, 0x97, 0xA3},
392 {0x01, 0x97, 0xA3},
393 {0x01, 0x97, 0xA3},
394 {0x01, 0x97, 0xB3},
395 {0x01, 0x97, 0xB3},
396 {0x01, 0x97, 0xB3},
397 {0x03, 0x37, 0xC3}
398 };
399
400u8 abyVT3226_ChannelTable1[CB_MAX_CHANNEL_24G][3] = {
401 {0x02, 0x66, 0x64},
402 {0x03, 0x66, 0x64},
403 {0x00, 0x66, 0x64},
404 {0x01, 0x66, 0x64},
405 {0x02, 0x66, 0x64},
406 {0x03, 0x66, 0x64},
407 {0x00, 0x66, 0x64},
408 {0x01, 0x66, 0x64},
409 {0x02, 0x66, 0x64},
410 {0x03, 0x66, 0x64},
411 {0x00, 0x66, 0x64},
412 {0x01, 0x66, 0x64},
413 {0x02, 0x66, 0x64},
414 {0x00, 0xCC, 0xC4}
415 };
416
417
418
419u32 dwVT3226D0LoCurrentTable[CB_MAX_CHANNEL_24G] = {
420 0x0135C600+(BY_VT3226_REG_LEN<<3)+IFREGCTL_REGW,
421 0x0135C600+(BY_VT3226_REG_LEN<<3)+IFREGCTL_REGW,
422 0x0235C600+(BY_VT3226_REG_LEN<<3)+IFREGCTL_REGW,
423 0x0235C600+(BY_VT3226_REG_LEN<<3)+IFREGCTL_REGW,
424 0x0235C600+(BY_VT3226_REG_LEN<<3)+IFREGCTL_REGW,
425 0x0335C600+(BY_VT3226_REG_LEN<<3)+IFREGCTL_REGW,
426 0x0335C600+(BY_VT3226_REG_LEN<<3)+IFREGCTL_REGW,
427 0x0335C600+(BY_VT3226_REG_LEN<<3)+IFREGCTL_REGW,
428 0x0335C600+(BY_VT3226_REG_LEN<<3)+IFREGCTL_REGW,
429 0x0335C600+(BY_VT3226_REG_LEN<<3)+IFREGCTL_REGW,
430 0x0335C600+(BY_VT3226_REG_LEN<<3)+IFREGCTL_REGW,
431 0x0335C600+(BY_VT3226_REG_LEN<<3)+IFREGCTL_REGW,
432 0x0335C600+(BY_VT3226_REG_LEN<<3)+IFREGCTL_REGW,
433 0x0135C600+(BY_VT3226_REG_LEN<<3)+IFREGCTL_REGW
434};
435
436
437
438u8 abyVT3342A0_InitTable[CB_VT3342_INIT_SEQ][3] = {
439 {0x03, 0xFF, 0x80},
440 {0x02, 0x08, 0x81},
441 {0x00, 0xC6, 0x02},
442 {0x03, 0xC5, 0x13},
443 {0x00, 0xEE, 0xE4},
444 {0x00, 0x71, 0xA5},
445 {0x01, 0x75, 0x46},
446 {0x01, 0x40, 0x27},
447 {0x01, 0x54, 0x08},
448 {0x00, 0x01, 0x69},
449 {0x02, 0x00, 0xAA},
450 {0x00, 0x08, 0xCB},
451 {0x01, 0x70, 0x0C}
452 };
453
454
455
456
457
458
459
460
461u8 abyVT3342_ChannelTable0[CB_MAX_CHANNEL][3] = {
462 {0x02, 0x05, 0x03},
463 {0x01, 0x15, 0x03},
464 {0x03, 0xC5, 0x03},
465 {0x02, 0x65, 0x03},
466 {0x01, 0x15, 0x13},
467 {0x03, 0xC5, 0x13},
468 {0x02, 0x05, 0x13},
469 {0x01, 0x15, 0x13},
470 {0x03, 0xC5, 0x13},
471 {0x02, 0x65, 0x13},
472 {0x01, 0x15, 0x23},
473 {0x03, 0xC5, 0x23},
474 {0x02, 0x05, 0x23},
475 {0x00, 0xD5, 0x23},
476
477
478 {0x01, 0x15, 0x13},
479 {0x01, 0x15, 0x13},
480 {0x01, 0x15, 0x13},
481 {0x01, 0x15, 0x13},
482 {0x01, 0x15, 0x13},
483 {0x01, 0x15, 0x13},
484 {0x01, 0x15, 0x13},
485 {0x01, 0x15, 0x13},
486
487
488
489 {0x01, 0x15, 0x13},
490 {0x01, 0x15, 0x13},
491 {0x01, 0x15, 0x13},
492 {0x01, 0x15, 0x13},
493 {0x01, 0x15, 0x13},
494 {0x01, 0x15, 0x13},
495 {0x01, 0x15, 0x13},
496 {0x01, 0x55, 0x63},
497 {0x01, 0x55, 0x63},
498 {0x02, 0xA5, 0x63},
499 {0x02, 0xA5, 0x63},
500 {0x00, 0x05, 0x73},
501 {0x00, 0x05, 0x73},
502 {0x01, 0x55, 0x73},
503 {0x02, 0xA5, 0x73},
504 {0x00, 0x05, 0x83},
505 {0x01, 0x55, 0x83},
506 {0x02, 0xA5, 0x83},
507
508 {0x02, 0xA5, 0x83},
509 {0x02, 0xA5, 0x83},
510 {0x02, 0xA5, 0x83},
511 {0x02, 0xA5, 0x83},
512 {0x02, 0xA5, 0x83},
513 {0x02, 0xA5, 0x83},
514 {0x02, 0xA5, 0x83},
515 {0x02, 0xA5, 0x83},
516 {0x02, 0xA5, 0x83},
517 {0x02, 0xA5, 0x83},
518 {0x02, 0xA5, 0x83},
519
520 {0x00, 0x05, 0xF3},
521 {0x01, 0x56, 0x03},
522 {0x02, 0xA6, 0x03},
523 {0x00, 0x06, 0x03},
524 {0x00, 0x06, 0x03}
525 };
526
527u8 abyVT3342_ChannelTable1[CB_MAX_CHANNEL][3] = {
528 {0x01, 0x99, 0x94},
529 {0x02, 0x44, 0x44},
530 {0x02, 0xEE, 0xE4},
531 {0x03, 0x99, 0x94},
532 {0x00, 0x44, 0x44},
533 {0x00, 0xEE, 0xE4},
534 {0x01, 0x99, 0x94},
535 {0x02, 0x44, 0x44},
536 {0x02, 0xEE, 0xE4},
537 {0x03, 0x99, 0x94},
538 {0x00, 0x44, 0x44},
539 {0x00, 0xEE, 0xE4},
540 {0x01, 0x99, 0x94},
541 {0x03, 0x33, 0x34},
542
543
544 {0x00, 0x44, 0x44},
545 {0x00, 0x44, 0x44},
546 {0x00, 0x44, 0x44},
547 {0x00, 0x44, 0x44},
548 {0x00, 0x44, 0x44},
549 {0x00, 0x44, 0x44},
550 {0x00, 0x44, 0x44},
551 {0x00, 0x44, 0x44},
552
553
554
555 {0x00, 0x44, 0x44},
556 {0x00, 0x44, 0x44},
557 {0x00, 0x44, 0x44},
558 {0x00, 0x44, 0x44},
559 {0x00, 0x44, 0x44},
560 {0x00, 0x44, 0x44},
561 {0x00, 0x44, 0x44},
562 {0x01, 0x55, 0x54},
563 {0x01, 0x55, 0x54},
564 {0x02, 0xAA, 0xA4},
565 {0x02, 0xAA, 0xA4},
566 {0x00, 0x00, 0x04},
567 {0x00, 0x00, 0x04},
568 {0x01, 0x55, 0x54},
569 {0x02, 0xAA, 0xA4},
570 {0x00, 0x00, 0x04},
571 {0x01, 0x55, 0x54},
572 {0x02, 0xAA, 0xA4},
573 {0x02, 0xAA, 0xA4},
574 {0x02, 0xAA, 0xA4},
575 {0x02, 0xAA, 0xA4},
576 {0x02, 0xAA, 0xA4},
577 {0x02, 0xAA, 0xA4},
578 {0x02, 0xAA, 0xA4},
579 {0x02, 0xAA, 0xA4},
580 {0x02, 0xAA, 0xA4},
581 {0x02, 0xAA, 0xA4},
582 {0x02, 0xAA, 0xA4},
583 {0x02, 0xAA, 0xA4},
584 {0x03, 0x00, 0x04},
585 {0x00, 0x55, 0x54},
586 {0x01, 0xAA, 0xA4},
587 {0x03, 0x00, 0x04},
588 {0x03, 0x00, 0x04}
589 };
590
591
592
593
594
595
596
597const u32 dwAL2230PowerTable[AL2230_PWR_IDX_LEN] = {
598 0x04040900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW,
599 0x04041900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW,
600 0x04042900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW,
601 0x04043900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW,
602 0x04044900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW,
603 0x04045900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW,
604 0x04046900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW,
605 0x04047900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW,
606 0x04048900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW,
607 0x04049900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW,
608 0x0404A900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW,
609 0x0404B900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW,
610 0x0404C900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW,
611 0x0404D900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW,
612 0x0404E900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW,
613 0x0404F900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW,
614 0x04050900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW,
615 0x04051900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW,
616 0x04052900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW,
617 0x04053900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW,
618 0x04054900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW,
619 0x04055900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW,
620 0x04056900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW,
621 0x04057900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW,
622 0x04058900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW,
623 0x04059900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW,
624 0x0405A900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW,
625 0x0405B900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW,
626 0x0405C900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW,
627 0x0405D900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW,
628 0x0405E900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW,
629 0x0405F900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW,
630 0x04060900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW,
631 0x04061900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW,
632 0x04062900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW,
633 0x04063900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW,
634 0x04064900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW,
635 0x04065900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW,
636 0x04066900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW,
637 0x04067900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW,
638 0x04068900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW,
639 0x04069900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW,
640 0x0406A900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW,
641 0x0406B900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW,
642 0x0406C900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW,
643 0x0406D900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW,
644 0x0406E900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW,
645 0x0406F900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW,
646 0x04070900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW,
647 0x04071900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW,
648 0x04072900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW,
649 0x04073900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW,
650 0x04074900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW,
651 0x04075900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW,
652 0x04076900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW,
653 0x04077900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW,
654 0x04078900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW,
655 0x04079900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW,
656 0x0407A900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW,
657 0x0407B900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW,
658 0x0407C900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW,
659 0x0407D900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW,
660 0x0407E900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW,
661 0x0407F900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW
662 };
663
664
665
666
667
668
669const u8 RFaby11aChannelIndex[200] = {
670
671 00, 00, 00, 00, 00, 00, 23, 24, 25, 00,
672 26, 27, 00, 00, 00, 28, 00, 00, 00, 00,
673 00, 00, 00, 00, 00, 00, 00, 00, 00, 00,
674 00, 00, 00, 29, 00, 30, 00, 31, 00, 32,
675 00, 33, 00, 34, 00, 35, 00, 36, 00, 00,
676 00, 37, 00, 00, 00, 38, 00, 00, 00, 39,
677 00, 00, 00, 40, 00, 00, 00, 00, 00, 00,
678 00, 00, 00, 00, 00, 00, 00, 00, 00, 00,
679 00, 00, 00, 00, 00, 00, 00, 00, 00, 00,
680 00, 00, 00, 00, 00, 00, 00, 00, 00, 41,
681
682 00, 00, 00, 42, 00, 00, 00, 43, 00, 00,
683 00, 44, 00, 00, 00, 45, 00, 00, 00, 46,
684 00, 00, 00, 47, 00, 00, 00, 48, 00, 00,
685 00, 49, 00, 00, 00, 50, 00, 00, 00, 51,
686 00, 00, 00, 00, 00, 00, 00, 00, 52, 00,
687 00, 00, 53, 00, 00, 00, 54, 00, 00, 00,
688 55, 00, 00, 00, 56, 00, 00, 00, 00, 00,
689 00, 00, 00, 00, 00, 00, 00, 00, 00, 00,
690 00, 00, 15, 16, 17, 00, 18, 19, 20, 00,
691 00, 21, 00, 00, 00, 22, 00, 00, 00, 00
692};
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707int IFRFbWriteEmbedded(struct vnt_private *pDevice, u32 dwData)
708{
709 u8 pbyData[4];
710
711 pbyData[0] = (u8)dwData;
712 pbyData[1] = (u8)(dwData >> 8);
713 pbyData[2] = (u8)(dwData >> 16);
714 pbyData[3] = (u8)(dwData >> 24);
715
716 CONTROLnsRequestOut(pDevice,
717 MESSAGE_TYPE_WRITE_IFRF, 0, 0, 4, pbyData);
718
719 return true;
720}
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735int RFbSetPower(struct vnt_private *pDevice, u32 uRATE, u32 uCH)
736{
737 int bResult = true;
738 u8 byPwr = pDevice->byCCKPwr;
739
740 if (pDevice->dwDiagRefCount)
741 return true;
742
743 if (uCH == 0)
744 return -EINVAL;
745
746 switch (uRATE) {
747 case RATE_1M:
748 case RATE_2M:
749 case RATE_5M:
750 case RATE_11M:
751 byPwr = pDevice->abyCCKPwrTbl[uCH-1];
752 break;
753 case RATE_6M:
754 case RATE_9M:
755 case RATE_18M:
756 case RATE_24M:
757 case RATE_36M:
758 case RATE_48M:
759 case RATE_54M:
760 if (uCH > CB_MAX_CHANNEL_24G) {
761 byPwr = pDevice->abyOFDMAPwrTbl[uCH-15];
762 } else {
763 byPwr = pDevice->abyOFDMPwrTbl[uCH-1];
764 }
765 break;
766 }
767
768 bResult = RFbRawSetPower(pDevice, byPwr, uRATE);
769
770 return bResult;
771}
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787int RFbRawSetPower(struct vnt_private *pDevice, u8 byPwr, u32 uRATE)
788{
789 int bResult = true;
790
791 if (pDevice->byCurPwr == byPwr)
792 return true;
793
794 pDevice->byCurPwr = byPwr;
795
796 switch (pDevice->byRFType) {
797
798 case RF_AL2230 :
799 if (pDevice->byCurPwr >= AL2230_PWR_IDX_LEN)
800 return false;
801 bResult &= IFRFbWriteEmbedded(pDevice, dwAL2230PowerTable[pDevice->byCurPwr]);
802 if (uRATE <= RATE_11M)
803 bResult &= IFRFbWriteEmbedded(pDevice, 0x0001B400+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW);
804 else
805 bResult &= IFRFbWriteEmbedded(pDevice, 0x0005A400+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW);
806 break;
807
808 case RF_AL2230S :
809 if (pDevice->byCurPwr >= AL2230_PWR_IDX_LEN)
810 return false;
811 bResult &= IFRFbWriteEmbedded(pDevice, dwAL2230PowerTable[pDevice->byCurPwr]);
812 if (uRATE <= RATE_11M) {
813 bResult &= IFRFbWriteEmbedded(pDevice, 0x040C1400+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW);
814 bResult &= IFRFbWriteEmbedded(pDevice, 0x00299B00+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW);
815 }else {
816 bResult &= IFRFbWriteEmbedded(pDevice, 0x0005A400+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW);
817 bResult &= IFRFbWriteEmbedded(pDevice, 0x00099B00+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW);
818 }
819 break;
820
821 case RF_AIROHA7230:
822 {
823 u32 dwMax7230Pwr;
824
825 if (uRATE <= RATE_11M) {
826 bResult &= IFRFbWriteEmbedded(pDevice, 0x111BB900+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW);
827 }
828 else {
829 bResult &= IFRFbWriteEmbedded(pDevice, 0x221BB900+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW);
830 }
831
832 if (pDevice->byCurPwr > AL7230_PWR_IDX_LEN) return false;
833
834
835 dwMax7230Pwr = 0x080C0B00 | ( (pDevice->byCurPwr) << 12 ) |
836 (BY_AL7230_REG_LEN << 3 ) | IFREGCTL_REGW;
837
838 bResult &= IFRFbWriteEmbedded(pDevice, dwMax7230Pwr);
839 break;
840 }
841 break;
842
843 case RF_VT3226:
844 {
845 u32 dwVT3226Pwr;
846
847 if (pDevice->byCurPwr >= VT3226_PWR_IDX_LEN)
848 return false;
849 dwVT3226Pwr = ((0x3F-pDevice->byCurPwr) << 20 ) | ( 0x17 << 8 ) |
850 (BY_VT3226_REG_LEN << 3 ) | IFREGCTL_REGW;
851 bResult &= IFRFbWriteEmbedded(pDevice, dwVT3226Pwr);
852 break;
853 }
854
855 case RF_VT3226D0:
856 {
857 u32 dwVT3226Pwr;
858
859 if (pDevice->byCurPwr >= VT3226_PWR_IDX_LEN)
860 return false;
861
862 if (uRATE <= RATE_11M) {
863
864 dwVT3226Pwr = ((0x3F-pDevice->byCurPwr) << 20 ) | ( 0xE07 << 8 ) |
865 (BY_VT3226_REG_LEN << 3 ) | IFREGCTL_REGW;
866 bResult &= IFRFbWriteEmbedded(pDevice, dwVT3226Pwr);
867
868 bResult &= IFRFbWriteEmbedded(pDevice, 0x03C6A200+(BY_VT3226_REG_LEN<<3)+IFREGCTL_REGW);
869 if (pDevice->vnt_mgmt.eScanState != WMAC_NO_SCANNING) {
870
871 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO
872 "RFbRawSetPower> 11B mode uCurrChannel[%d]\n",
873 pDevice->vnt_mgmt.uScanChannel);
874 bResult &= IFRFbWriteEmbedded(pDevice,
875 dwVT3226D0LoCurrentTable[pDevice->
876 vnt_mgmt.uScanChannel - 1]);
877 } else {
878 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO
879 "RFbRawSetPower> 11B mode uCurrChannel[%d]\n",
880 pDevice->vnt_mgmt.uCurrChannel);
881 bResult &= IFRFbWriteEmbedded(pDevice,
882 dwVT3226D0LoCurrentTable[pDevice->
883 vnt_mgmt.uCurrChannel - 1]);
884 }
885
886 bResult &= IFRFbWriteEmbedded(pDevice, 0x015C0800+(BY_VT3226_REG_LEN<<3)+IFREGCTL_REGW);
887 } else {
888 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"@@@@ RFbRawSetPower> 11G mode\n");
889 dwVT3226Pwr = ((0x3F-pDevice->byCurPwr) << 20 ) | ( 0x7 << 8 ) |
890 (BY_VT3226_REG_LEN << 3 ) | IFREGCTL_REGW;
891 bResult &= IFRFbWriteEmbedded(pDevice, dwVT3226Pwr);
892 bResult &= IFRFbWriteEmbedded(pDevice, 0x00C6A200+(BY_VT3226_REG_LEN<<3)+IFREGCTL_REGW);
893 bResult &= IFRFbWriteEmbedded(pDevice, 0x016BC600+(BY_VT3226_REG_LEN<<3)+IFREGCTL_REGW);
894 bResult &= IFRFbWriteEmbedded(pDevice, 0x00900800+(BY_VT3226_REG_LEN<<3)+IFREGCTL_REGW);
895 }
896 break;
897 }
898
899
900 case RF_VT3342A0:
901 {
902 u32 dwVT3342Pwr;
903
904 if (pDevice->byCurPwr >= VT3342_PWR_IDX_LEN)
905 return false;
906
907 dwVT3342Pwr = ((0x3F-pDevice->byCurPwr) << 20 ) | ( 0x27 << 8 ) |
908 (BY_VT3342_REG_LEN << 3 ) | IFREGCTL_REGW;
909 bResult &= IFRFbWriteEmbedded(pDevice, dwVT3342Pwr);
910 break;
911 }
912
913 default :
914 break;
915 }
916 return bResult;
917}
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934void RFvRSSITodBm(struct vnt_private *pDevice, u8 byCurrRSSI, long *pldBm)
935{
936 u8 byIdx = (((byCurrRSSI & 0xC0) >> 6) & 0x03);
937 signed long b = (byCurrRSSI & 0x3F);
938 signed long a = 0;
939 u8 abyAIROHARF[4] = {0, 18, 0, 40};
940
941 switch (pDevice->byRFType) {
942 case RF_AL2230:
943 case RF_AL2230S:
944 case RF_AIROHA7230:
945 case RF_VT3226:
946 case RF_VT3226D0:
947 case RF_VT3342A0:
948 a = abyAIROHARF[byIdx];
949 break;
950 default:
951 break;
952 }
953
954 *pldBm = -1 * (a + b * 2);
955}
956
957void RFbRFTableDownload(struct vnt_private *pDevice)
958{
959 u16 wLength1 = 0, wLength2 = 0, wLength3 = 0;
960 u8 *pbyAddr1 = NULL, *pbyAddr2 = NULL, *pbyAddr3 = NULL;
961 u16 wLength, wValue;
962 u8 abyArray[256];
963
964 switch ( pDevice->byRFType ) {
965 case RF_AL2230:
966 case RF_AL2230S:
967 wLength1 = CB_AL2230_INIT_SEQ * 3;
968 wLength2 = CB_MAX_CHANNEL_24G * 3;
969 wLength3 = CB_MAX_CHANNEL_24G * 3;
970 pbyAddr1 = &(abyAL2230InitTable[0][0]);
971 pbyAddr2 = &(abyAL2230ChannelTable0[0][0]);
972 pbyAddr3 = &(abyAL2230ChannelTable1[0][0]);
973 break;
974 case RF_AIROHA7230:
975 wLength1 = CB_AL7230_INIT_SEQ * 3;
976 wLength2 = CB_MAX_CHANNEL * 3;
977 wLength3 = CB_MAX_CHANNEL * 3;
978 pbyAddr1 = &(abyAL7230InitTable[0][0]);
979 pbyAddr2 = &(abyAL7230ChannelTable0[0][0]);
980 pbyAddr3 = &(abyAL7230ChannelTable1[0][0]);
981 break;
982 case RF_VT3226:
983 wLength1 = CB_VT3226_INIT_SEQ * 3;
984 wLength2 = CB_MAX_CHANNEL_24G * 3;
985 wLength3 = CB_MAX_CHANNEL_24G * 3;
986 pbyAddr1 = &(abyVT3226_InitTable[0][0]);
987 pbyAddr2 = &(abyVT3226_ChannelTable0[0][0]);
988 pbyAddr3 = &(abyVT3226_ChannelTable1[0][0]);
989 break;
990 case RF_VT3226D0:
991 wLength1 = CB_VT3226_INIT_SEQ * 3;
992 wLength2 = CB_MAX_CHANNEL_24G * 3;
993 wLength3 = CB_MAX_CHANNEL_24G * 3;
994 pbyAddr1 = &(abyVT3226D0_InitTable[0][0]);
995 pbyAddr2 = &(abyVT3226_ChannelTable0[0][0]);
996 pbyAddr3 = &(abyVT3226_ChannelTable1[0][0]);
997 break;
998 case RF_VT3342A0:
999 wLength1 = CB_VT3342_INIT_SEQ * 3;
1000 wLength2 = CB_MAX_CHANNEL * 3;
1001 wLength3 = CB_MAX_CHANNEL * 3;
1002 pbyAddr1 = &(abyVT3342A0_InitTable[0][0]);
1003 pbyAddr2 = &(abyVT3342_ChannelTable0[0][0]);
1004 pbyAddr3 = &(abyVT3342_ChannelTable1[0][0]);
1005 break;
1006
1007 }
1008
1009
1010 memcpy(abyArray, pbyAddr1, wLength1);
1011 CONTROLnsRequestOut(pDevice,
1012 MESSAGE_TYPE_WRITE,
1013 0,
1014 MESSAGE_REQUEST_RF_INIT,
1015 wLength1,
1016 abyArray
1017 );
1018
1019 wValue = 0;
1020 while ( wLength2 > 0 ) {
1021
1022 if ( wLength2 >= 64 ) {
1023 wLength = 64;
1024 } else {
1025 wLength = wLength2;
1026 }
1027 memcpy(abyArray, pbyAddr2, wLength);
1028 CONTROLnsRequestOut(pDevice,
1029 MESSAGE_TYPE_WRITE,
1030 wValue,
1031 MESSAGE_REQUEST_RF_CH0,
1032 wLength,
1033 abyArray);
1034
1035 wLength2 -= wLength;
1036 wValue += wLength;
1037 pbyAddr2 += wLength;
1038 }
1039
1040 wValue = 0;
1041 while ( wLength3 > 0 ) {
1042
1043 if ( wLength3 >= 64 ) {
1044 wLength = 64;
1045 } else {
1046 wLength = wLength3;
1047 }
1048 memcpy(abyArray, pbyAddr3, wLength);
1049 CONTROLnsRequestOut(pDevice,
1050 MESSAGE_TYPE_WRITE,
1051 wValue,
1052 MESSAGE_REQUEST_RF_CH1,
1053 wLength,
1054 abyArray);
1055
1056 wLength3 -= wLength;
1057 wValue += wLength;
1058 pbyAddr3 += wLength;
1059 }
1060
1061
1062 if ( pDevice->byRFType == RF_AIROHA7230 ) {
1063 wLength1 = CB_AL7230_INIT_SEQ * 3;
1064 wLength2 = CB_MAX_CHANNEL * 3;
1065 pbyAddr1 = &(abyAL7230InitTableAMode[0][0]);
1066 pbyAddr2 = &(abyAL7230ChannelTable2[0][0]);
1067 memcpy(abyArray, pbyAddr1, wLength1);
1068
1069 CONTROLnsRequestOut(pDevice,
1070 MESSAGE_TYPE_WRITE,
1071 0,
1072 MESSAGE_REQUEST_RF_INIT2,
1073 wLength1,
1074 abyArray);
1075
1076
1077 wValue = 0;
1078 while ( wLength2 > 0 ) {
1079
1080 if ( wLength2 >= 64 ) {
1081 wLength = 64;
1082 } else {
1083 wLength = wLength2;
1084 }
1085 memcpy(abyArray, pbyAddr2, wLength);
1086 CONTROLnsRequestOut(pDevice,
1087 MESSAGE_TYPE_WRITE,
1088 wValue,
1089 MESSAGE_REQUEST_RF_CH2,
1090 wLength,
1091 abyArray);
1092
1093 wLength2 -= wLength;
1094 wValue += wLength;
1095 pbyAddr2 += wLength;
1096 }
1097 }
1098
1099}
1100