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_MAC_REG_8723A[] = {
137 void ODM_ReadAndConfig_MAC_REG_8723A(struct dm_odm_t *pDM_Odm)
139 #define READ_NEXT_PAIR(v1, v2, i) \
141 i += 2; v1 = Array[i]; v2 = Array[i+1]; \
147 u8 board = pDM_Odm->BoardType;
148 u32 ArrayLen = sizeof(Array_MAC_REG_8723A)/sizeof(u32);
149 u32 *Array = Array_MAC_REG_8723A;
152 hex += ODM_ITRF_USB << 8;
153 hex += platform << 16;
155 for (i = 0; i < ArrayLen; i += 2) {
159 /* This (offset, data) pair meets the condition. */
160 if (v1 < 0xCDCDCDCD) {
161 odm_ConfigMAC_8723A(pDM_Odm, v1, (u8)v2);
164 if (!CheckCondition(Array[i], hex)) {
165 /* Discard the following (offset, data) pairs. */
166 READ_NEXT_PAIR(v1, v2, i);
167 while (v2 != 0xDEAD &&
169 v2 != 0xCDCD && i < ArrayLen - 2)
170 READ_NEXT_PAIR(v1, v2, i);
171 i -= 2; /* prevent from for-loop += 2 */
173 /* Configure matched pairs and skip to end of if-else. */
174 READ_NEXT_PAIR(v1, v2, i);
175 while (v2 != 0xDEAD &&
177 v2 != 0xCDCD && i < ArrayLen - 2) {
178 odm_ConfigMAC_8723A(pDM_Odm, v1, (u8)v2);
179 READ_NEXT_PAIR(v1, v2, i);
182 while (v2 != 0xDEAD && i < ArrayLen - 2)
183 READ_NEXT_PAIR(v1, v2, i);