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 board = pDM_Odm->BoardType;
218 u32 ArrayLen = sizeof(Array_RadioA_1T_8723A)/sizeof(u32);
219 u32 *Array = Array_RadioA_1T_8723A;
222 hex += ODM_ITRF_USB << 8;
223 hex += platform << 16;
226 for (i = 0; i < ArrayLen; i += 2) {
230 /* This (offset, data) pair meets the condition. */
231 if (v1 < 0xCDCDCDCD) {
232 odm_ConfigRFReg_8723A(pDM_Odm, v1, v2, RF_PATH_A, v1);
235 if (!CheckCondition(Array[i], hex)) {
236 /* Discard the following (offset, data) pairs. */
237 READ_NEXT_PAIR(v1, v2, i);
238 while (v2 != 0xDEAD &&
240 v2 != 0xCDCD && i < ArrayLen - 2)
241 READ_NEXT_PAIR(v1, v2, i);
242 i -= 2; /* prevent from for-loop += 2 */
244 /* Configure matched pairs and skip to end of if-else. */
245 READ_NEXT_PAIR(v1, v2, i);
246 while (v2 != 0xDEAD &&
248 v2 != 0xCDCD && i < ArrayLen - 2) {
249 odm_ConfigRFReg_8723A(pDM_Odm, v1, v2,
251 READ_NEXT_PAIR(v1, v2, i);
254 while (v2 != 0xDEAD && i < ArrayLen - 2)
255 READ_NEXT_PAIR(v1, v2, i);