1 /******************************************************************************
3 * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as
7 * published by the Free Software Foundation.
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 ******************************************************************************/
16 #include "odm_precomp.h"
18 static bool CheckCondition(const u32 Condition, const u32 Hex)
20 u32 _board = (Hex & 0x000000FF);
21 u32 _interface = (Hex & 0x0000FF00) >> 8;
22 u32 _platform = (Hex & 0x00FF0000) >> 16;
25 if (Condition == 0xCDCDCDCD)
28 cond = Condition & 0x000000FF;
29 if ((_board == cond) && cond != 0x00)
32 cond = Condition & 0x0000FF00;
34 if ((_interface & cond) == 0 && cond != 0x07)
37 cond = Condition & 0x00FF0000;
39 if ((_platform & cond) == 0 && cond != 0x0F)
44 /******************************************************************************
46 ******************************************************************************/
48 static u32 Array_RadioA_1T_8723A[] = {
207 void ODM_ReadAndConfig_RadioA_1T_8723A(struct dm_odm_t *pDM_Odm)
209 #define READ_NEXT_PAIR(v1, v2, i) \
211 i += 2; v1 = Array[i]; v2 = Array[i+1];\
217 u8 interfaceValue = pDM_Odm->SupportInterface;
218 u8 board = pDM_Odm->BoardType;
219 u32 ArrayLen = sizeof(Array_RadioA_1T_8723A)/sizeof(u32);
220 u32 *Array = Array_RadioA_1T_8723A;
223 hex += interfaceValue << 8;
224 hex += platform << 16;
227 for (i = 0; i < ArrayLen; i += 2) {
231 /* This (offset, data) pair meets the condition. */
232 if (v1 < 0xCDCDCDCD) {
233 odm_ConfigRFReg_8723A(pDM_Odm, v1, v2, RF_PATH_A, v1);
236 if (!CheckCondition(Array[i], hex)) {
237 /* Discard the following (offset, data) pairs. */
238 READ_NEXT_PAIR(v1, v2, i);
239 while (v2 != 0xDEAD &&
241 v2 != 0xCDCD && i < ArrayLen - 2)
242 READ_NEXT_PAIR(v1, v2, i);
243 i -= 2; /* prevent from for-loop += 2 */
245 /* Configure matched pairs and skip to end of if-else. */
246 READ_NEXT_PAIR(v1, v2, i);
247 while (v2 != 0xDEAD &&
249 v2 != 0xCDCD && i < ArrayLen - 2) {
250 odm_ConfigRFReg_8723A(pDM_Odm, v1, v2,
252 READ_NEXT_PAIR(v1, v2, i);
255 while (v2 != 0xDEAD && i < ArrayLen - 2)
256 READ_NEXT_PAIR(v1, v2, i);