|
1 /* |
|
2 * wlanhwinitmain.cpp |
|
3 * |
|
4 * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved. |
|
5 * All rights reserved. |
|
6 * |
|
7 * This program and the accompanying materials are made available under the |
|
8 * terms of the Eclipse Public License v1.0 or BSD License which accompanies |
|
9 * this distribution. The Eclipse Public License is available at |
|
10 * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below. |
|
11 * |
|
12 * Redistribution and use in source and binary forms, with or without |
|
13 * modification, are permitted provided that the following conditions |
|
14 * are met: |
|
15 * |
|
16 * * Redistributions of source code must retain the above copyright |
|
17 * notice, this list of conditions and the following disclaimer. |
|
18 * * Redistributions in binary form must reproduce the above copyright |
|
19 * notice, this list of conditions and the following disclaimer in |
|
20 * the documentation and/or other materials provided with the |
|
21 * distribution. |
|
22 * * Neither the name Texas Instruments nor the names of its |
|
23 * contributors may be used to endorse or promote products derived |
|
24 * from this software without specific prior written permission. |
|
25 * |
|
26 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
|
27 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
|
28 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
|
29 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
|
30 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
|
31 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
|
32 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
|
33 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
|
34 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
|
35 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
|
36 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
|
37 */ |
|
38 |
|
39 |
|
40 /********************************************************************************************************************** |
|
41 |
|
42 FILENAME: wlanhwinitmain.cpp |
|
43 */ |
|
44 |
|
45 |
|
46 #include "WiLink6_nvs.h" |
|
47 #ifdef _FW_FROMFILE |
|
48 #include "wilink6_firmware.h" |
|
49 #endif |
|
50 #include "radio_ini.h" |
|
51 #include "gendebug.h" |
|
52 |
|
53 #include <e32base.h> |
|
54 #include <d32dbms.h> // RDbStoreDatabase |
|
55 #include <f32file.h> // RFs |
|
56 #include <s32file.h> // CFileStore |
|
57 |
|
58 #include "wlanhwinitmain.h" |
|
59 #define __FILE_ID__ FILE_ID_136 |
|
60 |
|
61 #define NVS_LEN 468 |
|
62 #define RADIO_LEN 208 |
|
63 |
|
64 /**************************************************************************** |
|
65 * CWlanHwInitMain::CWlanHwInitMain() |
|
66 **************************************************************************** |
|
67 * DESCRIPTION: class constructor |
|
68 * |
|
69 * INPUTS: None |
|
70 * |
|
71 * OUTPUT: None |
|
72 * |
|
73 * RETURNS: |
|
74 ****************************************************************************/ |
|
75 |
|
76 CWlanHwInitMain::CWlanHwInitMain() : |
|
77 ipaData ( 0 ) |
|
78 { |
|
79 // TraceDump( INFO_LEVEL, ( _L( "CWlanHwInitMain:CWlanHwInitMain()" ) ) ); |
|
80 } |
|
81 |
|
82 /**************************************************************************** |
|
83 * CWlanHwInitMain::ConstructL() |
|
84 **************************************************************************** |
|
85 * DESCRIPTION: class constructor |
|
86 * |
|
87 * INPUTS: None |
|
88 * |
|
89 * OUTPUT: None |
|
90 * |
|
91 * RETURNS: |
|
92 ****************************************************************************/ |
|
93 void CWlanHwInitMain::ConstructL() |
|
94 { |
|
95 |
|
96 } |
|
97 |
|
98 /**************************************************************************** |
|
99 * CWlanHwInitMain::NewL() |
|
100 **************************************************************************** |
|
101 * DESCRIPTION: create CWlanHwInitMain |
|
102 * |
|
103 * INPUTS: None |
|
104 * |
|
105 * OUTPUT: None |
|
106 * |
|
107 * RETURNS: |
|
108 ****************************************************************************/ |
|
109 CWlanHwInitMain* CWlanHwInitMain::NewL() |
|
110 { |
|
111 CWlanHwInitMain* self = new( ELeave ) CWlanHwInitMain; |
|
112 CleanupStack::PushL( self ); |
|
113 self->ConstructL(); |
|
114 CleanupStack::Pop( self ); |
|
115 return self; |
|
116 |
|
117 } |
|
118 |
|
119 /**************************************************************************** |
|
120 * ~CWlanHwInitMain() |
|
121 **************************************************************************** |
|
122 * DESCRIPTION: class deconstructor |
|
123 * |
|
124 * INPUTS: None |
|
125 * |
|
126 * OUTPUT: None |
|
127 * |
|
128 * RETURNS: |
|
129 ****************************************************************************/ |
|
130 CWlanHwInitMain::~CWlanHwInitMain() |
|
131 { |
|
132 // TraceDump( INFO_LEVEL, ( _L( "CWlanHwInitMain:~CWlanHwInitMain()" ) ) ); |
|
133 delete ipaData; |
|
134 } |
|
135 |
|
136 /**************************************************************************** |
|
137 * GetHwTestInitData |
|
138 **************************************************************************** |
|
139 * DESCRIPTION: |
|
140 * |
|
141 * INPUTS: |
|
142 * |
|
143 * OUTPUT: None |
|
144 * |
|
145 * RETURNS: |
|
146 ****************************************************************************/ |
|
147 void CWlanHwInitMain::GetHwTestInitData(const TUint8** aInitData, TUint& aInitLength, const TUint8** aFwData, TUint& aFwLength) |
|
148 { |
|
149 //TraceDump( INFO_LEVEL, ( _L( "CWlanHwInitMain:GetMacAddressL()" ) ) ); |
|
150 |
|
151 /* Update the pointer to the whole FW data (NVS + FW file) */ |
|
152 /* *aFwData = ipNvsData; |
|
153 aFwLength = sizeof(WiLink6m_nvs);*/ |
|
154 |
|
155 //TraceDump( INFO_LEVEL, ( _L( "CWlanHwInitMain:GetHwTestInitData()" ) ) ); |
|
156 } |
|
157 |
|
158 |
|
159 |
|
160 /**************************************************************************** |
|
161 * GetHwTestData |
|
162 **************************************************************************** |
|
163 * DESCRIPTION: |
|
164 * |
|
165 * INPUTS: |
|
166 * |
|
167 * OUTPUT: None |
|
168 * |
|
169 * RETURNS: |
|
170 ****************************************************************************/ |
|
171 TInt CWlanHwInitMain::GetHwTestData(TUint aId, TDes8& aData) |
|
172 { |
|
173 // TraceDump( INFO_LEVEL, ( _L( "CWlanHwInitMain:GetHwTestData()" ) ) ); |
|
174 |
|
175 return KErrNone; |
|
176 } |
|
177 |
|
178 /**************************************************************************** |
|
179 * SetHwTestData |
|
180 **************************************************************************** |
|
181 * DESCRIPTION: |
|
182 * |
|
183 * INPUTS: |
|
184 * |
|
185 * OUTPUT: None |
|
186 * |
|
187 * RETURNS: |
|
188 ****************************************************************************/ |
|
189 |
|
190 TInt CWlanHwInitMain::SetHwTestData(TUint aId, TDesC8& aData) |
|
191 { |
|
192 |
|
193 return KErrNone; |
|
194 } |
|
195 |
|
196 /** |
|
197 * \fn IsMMCFirmwareFound() |
|
198 * \brief Checks if a firmware file can be found from |
|
199 * the memory card. |
|
200 * |
|
201 * To success read the FW file from a card the FW bin file should be |
|
202 * in firmware directory in the root of the card |
|
203 * |
|
204 * \param None |
|
205 * \return alse if not found or error occured, True if |
|
206 * the firmware was successfully read. |
|
207 * The firmware is loaded only once. |
|
208 * \sa IsMMCFirmwareFound |
|
209 */ |
|
210 TBool CWlanHwInitMain::IsMMCFirmwareFound() |
|
211 { |
|
212 #ifdef LOAD_FW_FROM_MMC |
|
213 TraceDump( INFO_LEVEL, ( _L( "CWlanHwInitMain::IsMMCFirmwareFound()" ) ) ); |
|
214 |
|
215 _LIT(KSearchPath,"E:\\firmware\\*.*"); |
|
216 _LIT(KFilePath,"E:\\firmware\\"); |
|
217 |
|
218 // Check if the firmware is already loaded, |
|
219 // free the memory and continue |
|
220 |
|
221 if (iFirmwareMC) |
|
222 { |
|
223 TraceDump( INFO_LEVEL, ( _L( "Memory for MMC Firmware already reserved" ) ) ); |
|
224 return ETrue; |
|
225 } |
|
226 |
|
227 // Init store |
|
228 /* Define file only if FW is not loaded */ |
|
229 RFs fs; |
|
230 RFile file; |
|
231 CDir* dirList; |
|
232 TInt fileSize = -1; |
|
233 TBuf<60> fileName; |
|
234 fileName = KFilePath; |
|
235 |
|
236 |
|
237 // Connect to the file system |
|
238 if ( fs.Connect() != KErrNone) |
|
239 { |
|
240 TraceDump( CRIT_LEVEL, ( _L( "IsMMCFirmwareFound() fs.Connect()" ) ) ); |
|
241 return EFalse; |
|
242 } |
|
243 |
|
244 // If returns an error, the folder is not found |
|
245 // -> return false; |
|
246 if (fs.GetDir(KSearchPath, |
|
247 KEntryAttMaskSupported, |
|
248 ESortByName, |
|
249 dirList) != KErrNone ) |
|
250 { |
|
251 TraceDump( CRIT_LEVEL, ( _L( "IsMMCFirmwareFound() fs.GetDir" ) ) ); |
|
252 fs.Close(); |
|
253 delete dirList; |
|
254 return EFalse; |
|
255 } |
|
256 |
|
257 // If no file is not found, return false. |
|
258 if (dirList->Count() == 0) |
|
259 { |
|
260 TraceDump( CRIT_LEVEL, ( _L( "IsMMCFirmwareFound() No file found" ) ) ); |
|
261 fs.Close(); |
|
262 delete dirList; |
|
263 return EFalse; |
|
264 } |
|
265 |
|
266 // Take the first file in the list, further files |
|
267 // are not handled |
|
268 fileName.Append ((*dirList)[0].iName); // Assume there is enough space, otherwise panics... |
|
269 |
|
270 // Try to open the firmware file |
|
271 if ( file.Open(fs, fileName, EFileStream) != KErrNone) |
|
272 { |
|
273 TraceDump( CRIT_LEVEL, ( _L( "IsMMCFirmwareFound() can't open file" ) ) ); |
|
274 fs.Close(); |
|
275 delete dirList; |
|
276 return EFalse; |
|
277 } |
|
278 |
|
279 // Get the size of the file |
|
280 if (file.Size(fileSize) != KErrNone) |
|
281 { |
|
282 TraceDump( CRIT_LEVEL, ( _L( "IsMMCFirmwareFound() can't Get File size" ) ) ); |
|
283 file.Close(); |
|
284 fs.Close(); |
|
285 delete dirList; |
|
286 return EFalse; |
|
287 } |
|
288 |
|
289 // Reserve memory from heap for it |
|
290 TRAPD(err, iFirmwareMC = HBufC8::NewL(fileSize)); |
|
291 if (err != KErrNone) |
|
292 { |
|
293 TraceDump( CRIT_LEVEL, ( _L( "IsMMCFirmwareFound() can't reserve heap memory" ) ) ); |
|
294 file.Close(); |
|
295 fs.Close(); |
|
296 delete dirList; |
|
297 return EFalse; |
|
298 } |
|
299 |
|
300 // Get a pointer and read the contents |
|
301 // of the file. |
|
302 TPtr8 pBuf = iFirmwareMC->Des(); |
|
303 if (file.Read(pBuf) != KErrNone) |
|
304 { |
|
305 TraceDump( CRIT_LEVEL, ( _L( "IsMMCFirmwareFound() can't read file" ) ) ); |
|
306 file.Close(); |
|
307 fs.Close(); |
|
308 delete dirList; |
|
309 return EFalse; |
|
310 } |
|
311 |
|
312 // Successful |
|
313 TraceDump( CRIT_LEVEL, ( _L( "IsMMCFirmwareFound() Success" ) ) ); |
|
314 |
|
315 file.Close(); |
|
316 fs.Close(); |
|
317 delete dirList; |
|
318 return ETrue; |
|
319 #else |
|
320 /* In case we are not supporting read file from card */ |
|
321 return EFalse; |
|
322 #endif // LOAD_FW_FROM_MMC |
|
323 } |
|
324 |
|
325 |
|
326 |
|
327 /** |
|
328 * \fn IsMMCNvsFound() |
|
329 * \brief Checks if a NVS file can be found from the memory card. |
|
330 * |
|
331 * To success read the NVS file from a card the NVS bin file should be |
|
332 * in nvs directory in the root of the card |
|
333 * |
|
334 * In case that the NVS is taken from MMC card it will contain |
|
335 * only the NVS parameters without the Radio parameters |
|
336 * therefor the Radio parmeters will be taken from the extend NVS array |
|
337 * that include from the WiLink_nvs.h file |
|
338 * |
|
339 * \param None |
|
340 * \return false if not found or error occured, True if |
|
341 * the nvs was successfully read. |
|
342 * The nvs is loaded only once. |
|
343 * \sa IsMMCNvsFound |
|
344 */ |
|
345 TBool CWlanHwInitMain::IsMMCNvsFound() |
|
346 { |
|
347 #ifdef LOAD_NVS_FROM_MMC |
|
348 TraceDump( INFO_LEVEL, ( _L( "CWlanHwInitMain::IsMMCNvsFound()" ) ) ); |
|
349 |
|
350 _LIT(KSearchPath,"E:\\nvs\\*.*"); |
|
351 _LIT(KFilePath,"E:\\nvs\\"); |
|
352 |
|
353 /* |
|
354 * Check if the nvs is already loaded, |
|
355 * free the memory and continue |
|
356 */ |
|
357 if (pNvsMC) |
|
358 { |
|
359 TraceDump( INFO_LEVEL, ( _L( "Memory for MMC NVS already reserved" ) ) ); |
|
360 return ETrue; |
|
361 } |
|
362 |
|
363 /* Init store */ |
|
364 /* Define file only if NVS is not loaded */ |
|
365 RFs cFs; |
|
366 RFile cFile; |
|
367 CDir* pDirList; |
|
368 TInt iFileSize = -1; |
|
369 TBuf<60> aFileName; |
|
370 aFileName = KFilePath; |
|
371 |
|
372 /* Connect to the file system */ |
|
373 if ( cFs.Connect() != KErrNone) |
|
374 { |
|
375 TraceDump( CRIT_LEVEL, ( _L( "IsMMCNvsFound() cFs.Connect()" ) ) ); |
|
376 return EFalse; |
|
377 } |
|
378 |
|
379 /* If returns an error, the folder is not found */ |
|
380 /* -> return false; */ |
|
381 if (cFs.GetDir(KSearchPath, |
|
382 KEntryAttMaskSupported, |
|
383 ESortByName, |
|
384 pDirList) != KErrNone ) |
|
385 { |
|
386 TraceDump( CRIT_LEVEL, ( _L( "IsMMCNvsFound() cFs.GetDir" ) ) ); |
|
387 cFs.Close(); |
|
388 delete pDirList; |
|
389 return EFalse; |
|
390 } |
|
391 |
|
392 /* If no file is not found, return false. */ |
|
393 if (pDirList->Count() == 0) |
|
394 { |
|
395 TraceDump( CRIT_LEVEL, ( _L( "IsMMCNvsFound() No file found" ) ) ); |
|
396 cFs.Close(); |
|
397 delete pDirList; |
|
398 return EFalse; |
|
399 } |
|
400 |
|
401 /* Take the first file in the list, further files are not handled */ |
|
402 aFileName.Append ((*pDirList)[0].iName); /* Assume there is enough space, otherwise panics... */ |
|
403 |
|
404 /* Try to open the NVS file */ |
|
405 if ( cFile.Open(cFs, aFileName, EFileStream) != KErrNone) |
|
406 { |
|
407 TraceDump( CRIT_LEVEL, ( _L( "IsMMCNvsFound() can't open file" ) ) ); |
|
408 cFs.Close(); |
|
409 delete pDirList; |
|
410 return EFalse; |
|
411 } |
|
412 |
|
413 /* Get the size of the file */ |
|
414 if (cFile.Size(iFileSize) != KErrNone) |
|
415 { |
|
416 TraceDump( CRIT_LEVEL, ( _L( "IsMMCNvsFound() can't Get File size" ) ) ); |
|
417 cFile.Close(); |
|
418 cFs.Close(); |
|
419 delete pDirList; |
|
420 return EFalse; |
|
421 } |
|
422 |
|
423 /* Reserve memory from heap for it */ |
|
424 TRAPD(err, pNvsMC = HBufC8::NewL(iFileSize)); |
|
425 if (err != KErrNone) |
|
426 { |
|
427 TraceDump( CRIT_LEVEL, ( _L( "IsMMCNvsFound() can't reserve heap memory" ) ) ); |
|
428 cFile.Close(); |
|
429 cFs.Close(); |
|
430 delete pDirList; |
|
431 return EFalse; |
|
432 } |
|
433 |
|
434 /* Get a pointer and read the contents */ |
|
435 /* of the file. */ |
|
436 TPtr8 pBuf = pNvsMC->Des(); |
|
437 if (cFile.Read(pBuf) != KErrNone) |
|
438 { |
|
439 TraceDump( CRIT_LEVEL, ( _L( "IsMMCNvsFound() can't read file" ) ) ); |
|
440 cFile.Close(); |
|
441 cFs.Close(); |
|
442 delete pDirList; |
|
443 return EFalse; |
|
444 } |
|
445 |
|
446 /* Successful */ |
|
447 TraceDump( CRIT_LEVEL, ( _L( "IsMMCNvsFound() Success" ) ) ); |
|
448 |
|
449 cFile.Close(); |
|
450 cFs.Close(); |
|
451 delete pDirList; |
|
452 return ETrue; |
|
453 #else |
|
454 /* In case we are not supporting read file from card */ |
|
455 return EFalse; |
|
456 #endif /* LOAD_FW_FROM_MMC */ |
|
457 } |
|
458 |
|
459 |
|
460 |
|
461 /**************************************************************************** |
|
462 * GetHwInitData() |
|
463 **************************************************************************** |
|
464 * DESCRIPTION: init data NVS, Radio , FW file pointer |
|
465 * |
|
466 * INPUTS: data pointer |
|
467 * |
|
468 * OUTPUT: None |
|
469 * |
|
470 * RETURNS: |
|
471 ****************************************************************************/ |
|
472 void CWlanHwInitMain::GetHwInitData(const TUint8** ppConfigData, TUint& configLength, const TUint8** ppNvsData, TUint& nvsLength ) |
|
473 { |
|
474 /*TraceDump( INFO_LEVEL, ( _L( "CWlanHwInitMain:GetHwInitData()" ) ) );*/ |
|
475 |
|
476 /* Update Config data pointer */ |
|
477 *ppConfigData = NULL; |
|
478 configLength = 0; |
|
479 |
|
480 /* Temporary pointer for firmware */ |
|
481 const TUint8* pWiLink6fw; |
|
482 TUint32 WiLink6fwSize = 0; |
|
483 const TUint8* pWiLink6nvs; |
|
484 TUint32 WiLink6nvsSize = 0 ; |
|
485 TUint8* pWiLink6radio; |
|
486 TUint32 WiLink6radioSize = 0 ; |
|
487 TUint8* pWiLink6NvsRadio; |
|
488 |
|
489 #ifdef _FW_FROMFILE |
|
490 if (IsMMCFirmwareFound()) |
|
491 { |
|
492 TraceDump( CRIT_LEVEL, ( _L( "CWlanHwInitMain::GetHwInitData(): Firmware loaded from MMC card !!!" ) ) ); |
|
493 pWiLink6fw = reinterpret_cast<const TUint8*>( iFirmwareMC->Ptr() ); |
|
494 WiLink6fwSize = iFirmwareMC->Length(); |
|
495 } |
|
496 else |
|
497 { |
|
498 /* Init FW pointer & FW size */ |
|
499 pWiLink6fw = reinterpret_cast<const TUint8*>( wilink6_firmware); |
|
500 WiLink6fwSize = sizeof( wilink6_firmware ); |
|
501 } |
|
502 #else |
|
503 WiLink6fwSize = 0; |
|
504 #endif |
|
505 |
|
506 |
|
507 if (IsMMCNvsFound()) { |
|
508 TraceDump( CRIT_LEVEL, ( _L( "CWlanHwInitMain::GetHwInitData(): NVS loaded from MMC card !!!" ) ) ); |
|
509 pWiLink6nvs = reinterpret_cast<const TUint8*>( pNvsMC->Ptr() ); |
|
510 WiLink6nvsSize = pNvsMC->Length(); |
|
511 } |
|
512 else |
|
513 { |
|
514 /* Init NVS pointer & size */ |
|
515 pWiLink6nvs = reinterpret_cast<const TUint8*>( WiLink6_nvs ); |
|
516 /* Chaged from: sizeof(WiLink6_nvs) */ |
|
517 WiLink6nvsSize = NVS_LEN; |
|
518 } |
|
519 pWiLink6NvsRadio = (TUint8*)reinterpret_cast<const TUint8*>( WiLink6_nvs ) + NVS_LEN; |
|
520 |
|
521 /* Init Radio pointer & size */ |
|
522 /* Chaged from: sizeof(TAutoRadioIniParams) */ |
|
523 WiLink6radioSize = RADIO_LEN; |
|
524 |
|
525 /* |
|
526 aData structue : |
|
527 ____________________________________________________________________________________________ |
|
528 | | | | | | | |
|
529 |NVS Len | NVS File | Radio Len | Radio File | FW Len | FW File | |
|
530 |4 Bytes | WiLink6_nvs.h | 4 Bytes | radio_ini.h | 4 Bytes | wilink6_firmware.h | |
|
531 |_________|_______________|____________|______________|__________|__________________________| |
|
532 |
|
533 */ |
|
534 |
|
535 /* Alloc lenght for the whole FW Data that is composed of 1 DWORD for NVS len + 1 DWORD for FW Len + NVS array + FW Array + Radio len + Radio params*/ |
|
536 nvsLength = sizeof(TUint32) + WiLink6nvsSize + sizeof(TUint32) + WiLink6radioSize + sizeof(TUint32) + WiLink6fwSize; |
|
537 |
|
538 /* Reserve memory if it has not yet already been reserved */ |
|
539 if (ipaData == NULL) |
|
540 { |
|
541 ipaData = (TUint8*)User::Alloc(nvsLength); |
|
542 |
|
543 if (!ipaData) |
|
544 { |
|
545 /* Out of memory*/ |
|
546 ASSERT(0); |
|
547 } |
|
548 } |
|
549 /* Length of NVS*/ |
|
550 TUint8 *TempPtr = ipaData + 4; |
|
551 |
|
552 /*Write Nvs Length*/ |
|
553 *(TUint32*)ipaData = WiLink6nvsSize; |
|
554 |
|
555 /* Copy NVS data to correct position*/ |
|
556 Mem::Copy(ipaData + sizeof(TUint32), pWiLink6nvs, WiLink6nvsSize); |
|
557 |
|
558 TempPtr += WiLink6nvsSize; |
|
559 |
|
560 /*Write Radio length*/ |
|
561 *(TUint32*)TempPtr = WiLink6radioSize; |
|
562 TempPtr+= 4; |
|
563 /* Get Radio position pointer*/ |
|
564 pWiLink6radio = ipaData + 2*sizeof(TUint32)+ WiLink6nvsSize; |
|
565 /*This values need to be impoerted from Radio module team*/ |
|
566 /* Changed from: FillRadioData(pWiLink6radio); */ |
|
567 Mem::Copy(pWiLink6radio, pWiLink6NvsRadio, WiLink6radioSize); |
|
568 |
|
569 TempPtr += WiLink6radioSize; |
|
570 |
|
571 /*Write FW length*/ |
|
572 *(TUint32*)TempPtr = WiLink6fwSize; |
|
573 TempPtr+= 4; |
|
574 |
|
575 /* Copy Firmware to correct position*/ |
|
576 if (WiLink6fwSize != 0) |
|
577 { |
|
578 Mem::Copy(ipaData + 3*sizeof(TUint32) + WiLink6nvsSize + WiLink6radioSize, pWiLink6fw, WiLink6fwSize); |
|
579 } |
|
580 |
|
581 /* Updated given pointer to just built pointer */ |
|
582 *ppNvsData = ipaData; |
|
583 } |
|
584 |
|
585 |
|
586 /**************************************************************************** |
|
587 * GetMacAddress |
|
588 **************************************************************************** |
|
589 * DESCRIPTION: get MAC address from NVS |
|
590 * |
|
591 * INPUTS: |
|
592 * |
|
593 * OUTPUT: MacAddress |
|
594 * |
|
595 * RETURNS: OK |
|
596 ****************************************************************************/ |
|
597 TInt CWlanHwInitMain::GetMacAddress(TMacAddr& aMacAddress) |
|
598 { |
|
599 const TUint8* pWiLink6nvs; |
|
600 |
|
601 if (IsMMCNvsFound()) |
|
602 { |
|
603 pWiLink6nvs = reinterpret_cast<const TUint8*>( pNvsMC->Ptr() ); |
|
604 } |
|
605 else |
|
606 { |
|
607 pWiLink6nvs = WiLink6_nvs; |
|
608 } |
|
609 |
|
610 aMacAddress.iMacAddress[0] = pWiLink6nvs[11]; |
|
611 aMacAddress.iMacAddress[1] = pWiLink6nvs[10]; |
|
612 aMacAddress.iMacAddress[2] = pWiLink6nvs[6]; |
|
613 aMacAddress.iMacAddress[3] = pWiLink6nvs[5]; |
|
614 aMacAddress.iMacAddress[4] = pWiLink6nvs[4]; |
|
615 aMacAddress.iMacAddress[5] = pWiLink6nvs[3]; |
|
616 |
|
617 return KErrNone; |
|
618 } |
|
619 |
|
620 |
|
621 /**************************************************************************** |
|
622 * FillRadioData |
|
623 **************************************************************************** |
|
624 * DESCRIPTION: fill Radio params , in future will be done by Radio scope |
|
625 * |
|
626 * INPUTS: |
|
627 * |
|
628 * OUTPUT: radio params |
|
629 * |
|
630 * RETURNS: OK |
|
631 ****************************************************************************/ |
|
632 void CWlanHwInitMain::FillRadioData(TUint8 *WiLink6radio) |
|
633 { |
|
634 TAutoRadioIniParams *pRadioParams; |
|
635 |
|
636 pRadioParams = (TAutoRadioIniParams*)(WiLink6radio); |
|
637 |
|
638 pRadioParams->tGeneralParams.TXBiPFEMAutoDetect = FEM_AUTO_DETECT_MODE_E; |
|
639 pRadioParams->tGeneralParams.TXBiPFEMManufacturer = FEM_TRIQUINT_TYPE_E; |
|
640 |
|
641 pRadioParams->tGeneralParams.RefClk = REF_CLK_38_4_E; |
|
642 pRadioParams->tGeneralParams.SettlingTime = 5; |
|
643 pRadioParams->tGeneralParams.ClockValidOnWakeup = REF_CLK_NOT_VALID_E; |
|
644 pRadioParams->tGeneralParams.DC2DCMode = BT_SPI_IS_NOT_USED_E; |
|
645 pRadioParams->tGeneralParams.Single_Dual_Band_Solution = SINGLE_BAND_SOLUTION_E; |
|
646 |
|
647 pRadioParams->tStatRadioParams.RxTraceInsertionLoss_2_4G = 0; |
|
648 pRadioParams->tStatRadioParams.TXTraceLoss_2_4G = 0; |
|
649 pRadioParams->tStatRadioParams.RxRssiAndProcessCompensation_2_4G[0] = 0xEC; |
|
650 pRadioParams->tStatRadioParams.RxRssiAndProcessCompensation_2_4G[1] = 0xF6; |
|
651 pRadioParams->tStatRadioParams.RxRssiAndProcessCompensation_2_4G[2] = 0x00; |
|
652 pRadioParams->tStatRadioParams.RxRssiAndProcessCompensation_2_4G[3] = 0x0C; |
|
653 pRadioParams->tStatRadioParams.RxRssiAndProcessCompensation_2_4G[4] = 0x18; |
|
654 pRadioParams->tStatRadioParams.RxRssiAndProcessCompensation_2_4G[5] = 0xF8; |
|
655 pRadioParams->tStatRadioParams.RxRssiAndProcessCompensation_2_4G[6] = 0xFC; |
|
656 pRadioParams->tStatRadioParams.RxRssiAndProcessCompensation_2_4G[7] = 0x00; |
|
657 pRadioParams->tStatRadioParams.RxRssiAndProcessCompensation_2_4G[8] = 0x08; |
|
658 pRadioParams->tStatRadioParams.RxRssiAndProcessCompensation_2_4G[9] = 0x10; |
|
659 pRadioParams->tStatRadioParams.RxRssiAndProcessCompensation_2_4G[10] = 0xF0; |
|
660 pRadioParams->tStatRadioParams.RxRssiAndProcessCompensation_2_4G[11] = 0xF8; |
|
661 pRadioParams->tStatRadioParams.RxRssiAndProcessCompensation_2_4G[12] = 0x00; |
|
662 pRadioParams->tStatRadioParams.RxRssiAndProcessCompensation_2_4G[13] = 0x0A; |
|
663 pRadioParams->tStatRadioParams.RxRssiAndProcessCompensation_2_4G[14] = 0x14; |
|
664 |
|
665 /* RMFD deafult value */ |
|
666 if (pRadioParams->tGeneralParams.Single_Dual_Band_Solution == DUAL_BAND_SOLUTION_E) |
|
667 { |
|
668 pRadioParams->tDynRadioParams[0].TXBiPReferencePDvoltage_2_4G = 0 ; |
|
669 pRadioParams->tDynRadioParams[0].TxBiPReferencePower_2_4G = 0; |
|
670 pRadioParams->tDynRadioParams[0].TxBiPOffsetdB_2_4G = 0; |
|
671 pRadioParams->tDynRadioParams[0].TxPerRatePowerLimits_2_4G_Normal[0] = 0x1E; |
|
672 pRadioParams->tDynRadioParams[0].TxPerRatePowerLimits_2_4G_Normal[1] = 0x1F; |
|
673 pRadioParams->tDynRadioParams[0].TxPerRatePowerLimits_2_4G_Normal[2] = 0x22; |
|
674 pRadioParams->tDynRadioParams[0].TxPerRatePowerLimits_2_4G_Normal[3] = 0x24; |
|
675 pRadioParams->tDynRadioParams[0].TxPerRatePowerLimits_2_4G_Normal[4] = 0x28; |
|
676 pRadioParams->tDynRadioParams[0].TxPerRatePowerLimits_2_4G_Normal[5] = 0x29; |
|
677 pRadioParams->tDynRadioParams[0].TxPerRatePowerLimits_2_4G_Degraded[0] = 0x1B; |
|
678 pRadioParams->tDynRadioParams[0].TxPerRatePowerLimits_2_4G_Degraded[1] = 0x1C; |
|
679 pRadioParams->tDynRadioParams[0].TxPerRatePowerLimits_2_4G_Degraded[2] = 0x1E; |
|
680 pRadioParams->tDynRadioParams[0].TxPerRatePowerLimits_2_4G_Degraded[3] = 0x20; |
|
681 pRadioParams->tDynRadioParams[0].TxPerRatePowerLimits_2_4G_Degraded[4] = 0x24; |
|
682 pRadioParams->tDynRadioParams[0].TxPerRatePowerLimits_2_4G_Degraded[5] = 0x25; |
|
683 for (int i=0; i<NUMBER_OF_2_4_G_CHANNELS;i++) |
|
684 { |
|
685 pRadioParams->tDynRadioParams[0].TxPerChannelPowerLimits_2_4G_11b[i] = 0x50; |
|
686 pRadioParams->tDynRadioParams[0].TxPerChannelPowerLimits_2_4G_OFDM[i] = 0x50; |
|
687 } |
|
688 |
|
689 pRadioParams->tDynRadioParams[0].TxPerChannelPowerLimits_2_4G_OFDM[0] = 0x20; |
|
690 pRadioParams->tDynRadioParams[0].TxPerChannelPowerLimits_2_4G_OFDM[10] = 0x20; |
|
691 memset(&pRadioParams->tDynRadioParams[0].TxPDVsRateOffsets_2_4G[0],0,NUMBER_OF_RATE_GROUPS_E); |
|
692 for (int i=0; i<NUMBER_OF_RATE_GROUPS_E;i++) |
|
693 { |
|
694 pRadioParams->tDynRadioParams[0].TxIbiasTable_2_4G[i] = 0x0E; |
|
695 } |
|
696 pRadioParams->tDynRadioParams[0].TxIbiasTable_2_4G[5] = 0x17; |
|
697 pRadioParams->tDynRadioParams[0].RxFemInsertionLoss_2_4G = 0x0D; |
|
698 } |
|
699 else |
|
700 { |
|
701 pRadioParams->tDynRadioParams[0].TXBiPReferencePDvoltage_2_4G =0x24E ; |
|
702 pRadioParams->tDynRadioParams[0].TxBiPReferencePower_2_4G = 0x78; |
|
703 pRadioParams->tDynRadioParams[0].TxBiPOffsetdB_2_4G = 0; |
|
704 pRadioParams->tDynRadioParams[0].TxPerRatePowerLimits_2_4G_Normal[0] = 0x1E; |
|
705 pRadioParams->tDynRadioParams[0].TxPerRatePowerLimits_2_4G_Normal[1] = 0x1F; |
|
706 pRadioParams->tDynRadioParams[0].TxPerRatePowerLimits_2_4G_Normal[2] = 0x22; |
|
707 pRadioParams->tDynRadioParams[0].TxPerRatePowerLimits_2_4G_Normal[3] = 0x24; |
|
708 pRadioParams->tDynRadioParams[0].TxPerRatePowerLimits_2_4G_Normal[4] = 0x28; |
|
709 pRadioParams->tDynRadioParams[0].TxPerRatePowerLimits_2_4G_Normal[5] = 0x29; |
|
710 pRadioParams->tDynRadioParams[0].TxPerRatePowerLimits_2_4G_Degraded[0] = 0x1B; |
|
711 pRadioParams->tDynRadioParams[0].TxPerRatePowerLimits_2_4G_Degraded[1] = 0x1C; |
|
712 pRadioParams->tDynRadioParams[0].TxPerRatePowerLimits_2_4G_Degraded[2] = 0x1E; |
|
713 pRadioParams->tDynRadioParams[0].TxPerRatePowerLimits_2_4G_Degraded[3] = 0x20; |
|
714 pRadioParams->tDynRadioParams[0].TxPerRatePowerLimits_2_4G_Degraded[4] = 0x24; |
|
715 pRadioParams->tDynRadioParams[0].TxPerRatePowerLimits_2_4G_Degraded[5] = 0x25; |
|
716 for (int i =0;i<NUMBER_OF_2_4_G_CHANNELS;i++) |
|
717 { |
|
718 pRadioParams->tDynRadioParams[0].TxPerChannelPowerLimits_2_4G_11b[i] = 0x50; |
|
719 pRadioParams->tDynRadioParams[0].TxPerChannelPowerLimits_2_4G_OFDM[i] = 0x50; |
|
720 } |
|
721 pRadioParams->tDynRadioParams[0].TxPerChannelPowerLimits_2_4G_OFDM[0] = 0x20; |
|
722 pRadioParams->tDynRadioParams[0].TxPerChannelPowerLimits_2_4G_OFDM[10] = 0x20; |
|
723 memset(&pRadioParams->tDynRadioParams[0].TxPDVsRateOffsets_2_4G[0],0,NUMBER_OF_RATE_GROUPS_E); |
|
724 for (int i = 0 ;i <NUMBER_OF_RATE_GROUPS_E;i++) |
|
725 { |
|
726 pRadioParams->tDynRadioParams[0].TxIbiasTable_2_4G[i] = 0x1A; |
|
727 } |
|
728 |
|
729 pRadioParams->tDynRadioParams[0].TxIbiasTable_2_4G[5] = 0x2F; |
|
730 pRadioParams->tDynRadioParams[0].RxFemInsertionLoss_2_4G = 0; |
|
731 |
|
732 /* TriQuint default value */ |
|
733 pRadioParams->tDynRadioParams[1].TXBiPReferencePDvoltage_2_4G= 0x168; |
|
734 pRadioParams->tDynRadioParams[1].TxBiPReferencePower_2_4G= 0x83; |
|
735 pRadioParams->tDynRadioParams[1].TxBiPOffsetdB_2_4G=0; |
|
736 pRadioParams->tDynRadioParams[1].TxPerRatePowerLimits_2_4G_Normal[0] = 0x1E; |
|
737 pRadioParams->tDynRadioParams[1].TxPerRatePowerLimits_2_4G_Normal[1] = 0x1F; |
|
738 pRadioParams->tDynRadioParams[1].TxPerRatePowerLimits_2_4G_Normal[2] = 0x22; |
|
739 pRadioParams->tDynRadioParams[1].TxPerRatePowerLimits_2_4G_Normal[3] = 0x24; |
|
740 pRadioParams->tDynRadioParams[1].TxPerRatePowerLimits_2_4G_Normal[4] = 0x28; |
|
741 pRadioParams->tDynRadioParams[1].TxPerRatePowerLimits_2_4G_Normal[5] = 0x29; |
|
742 pRadioParams->tDynRadioParams[1].TxPerRatePowerLimits_2_4G_Degraded[0] = 0x1B; |
|
743 pRadioParams->tDynRadioParams[1].TxPerRatePowerLimits_2_4G_Degraded[1] = 0x1C; |
|
744 pRadioParams->tDynRadioParams[1].TxPerRatePowerLimits_2_4G_Degraded[2] = 0x1E; |
|
745 pRadioParams->tDynRadioParams[1].TxPerRatePowerLimits_2_4G_Degraded[3] = 0x20; |
|
746 pRadioParams->tDynRadioParams[1].TxPerRatePowerLimits_2_4G_Degraded[4] = 0x24; |
|
747 pRadioParams->tDynRadioParams[1].TxPerRatePowerLimits_2_4G_Degraded[5] = 0x25; |
|
748 for (int i =0;i<NUMBER_OF_2_4_G_CHANNELS;i++) |
|
749 { |
|
750 pRadioParams->tDynRadioParams[1].TxPerChannelPowerLimits_2_4G_11b[i] = 0x50; |
|
751 pRadioParams->tDynRadioParams[1].TxPerChannelPowerLimits_2_4G_OFDM[i] = 0x50; |
|
752 } |
|
753 pRadioParams->tDynRadioParams[1].TxPerChannelPowerLimits_2_4G_OFDM[0] = 0x20; |
|
754 pRadioParams->tDynRadioParams[1].TxPerChannelPowerLimits_2_4G_OFDM[10] = 0x20; |
|
755 memset(&pRadioParams->tDynRadioParams[1].TxPDVsRateOffsets_2_4G[0],0,NUMBER_OF_RATE_GROUPS_E); |
|
756 for (int i = 0 ;i <NUMBER_OF_RATE_GROUPS_E;i++) |
|
757 { |
|
758 pRadioParams->tDynRadioParams[1].TxIbiasTable_2_4G[i] = 0x11; |
|
759 } |
|
760 |
|
761 pRadioParams->tDynRadioParams[1].TxIbiasTable_2_4G[5] = 0x12; |
|
762 pRadioParams->tDynRadioParams[1].RxFemInsertionLoss_2_4G = 0x12; |
|
763 } |
|
764 } |
|
765 |