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 * You should have received a copy of the GNU General Public License along with
15 * this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
19 ******************************************************************************/
21 /*Image2HeaderVersion: 2.14*/
22 #include "mp_precomp.h"
23 #include "../phydm_precomp.h"
25 #if (RTL8723B_SUPPORT == 1)
29 IN const u4Byte Condition1,
30 IN const u4Byte Condition2,
31 IN const u4Byte Condition3,
32 IN const u4Byte Condition4
35 u1Byte _BoardType = ((pDM_Odm->BoardType & BIT4) >> 4) << 0 | /* _GLNA*/
36 ((pDM_Odm->BoardType & BIT3) >> 3) << 1 | /* _GPA*/
37 ((pDM_Odm->BoardType & BIT7) >> 7) << 2 | /* _ALNA*/
38 ((pDM_Odm->BoardType & BIT6) >> 6) << 3 | /* _APA */
39 ((pDM_Odm->BoardType & BIT2) >> 2) << 4; /* _BT*/
41 u4Byte cond1 = Condition1, cond2 = Condition2, cond3 = Condition3, cond4 = Condition4;
42 u4Byte driver1 = pDM_Odm->CutVersion << 24 |
43 (pDM_Odm->SupportInterface & 0xF0) << 16 |
44 pDM_Odm->SupportPlatform << 16 |
45 pDM_Odm->PackageType << 12 |
46 (pDM_Odm->SupportInterface & 0x0F) << 8 |
49 u4Byte driver2 = (pDM_Odm->TypeGLNA & 0xFF) << 0 |
50 (pDM_Odm->TypeGPA & 0xFF) << 8 |
51 (pDM_Odm->TypeALNA & 0xFF) << 16 |
52 (pDM_Odm->TypeAPA & 0xFF) << 24;
56 u4Byte driver4 = (pDM_Odm->TypeGLNA & 0xFF00) >> 8 |
57 (pDM_Odm->TypeGPA & 0xFF00) |
58 (pDM_Odm->TypeALNA & 0xFF00) << 8 |
59 (pDM_Odm->TypeAPA & 0xFF00) << 16;
61 ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_TRACE,
62 ("===> CheckPositive (cond1, cond2, cond3, cond4) = (0x%X 0x%X 0x%X 0x%X)\n", cond1, cond2, cond3, cond4));
63 ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_TRACE,
64 ("===> CheckPositive (driver1, driver2, driver3, driver4) = (0x%X 0x%X 0x%X 0x%X)\n", driver1, driver2, driver3, driver4));
66 ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_TRACE,
67 (" (Platform, Interface) = (0x%X, 0x%X)\n", pDM_Odm->SupportPlatform, pDM_Odm->SupportInterface));
68 ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_TRACE,
69 (" (Board, Package) = (0x%X, 0x%X)\n", pDM_Odm->BoardType, pDM_Odm->PackageType));
72 /*============== Value Defined Check ===============*/
73 /*QFN Type [15:12] and Cut Version [27:24] need to do value check*/
75 if (((cond1 & 0x0000F000) != 0) && ((cond1 & 0x0000F000) != (driver1 & 0x0000F000)))
77 if (((cond1 & 0x0F000000) != 0) && ((cond1 & 0x0F000000) != (driver1 & 0x0F000000)))
80 /*=============== Bit Defined Check ================*/
81 /* We don't care [31:28] */
84 driver1 &= 0x00FF0FFF;
86 if ((cond1 & driver1) == cond1) {
89 if ((cond1 & 0x0F) == 0) /* BoardType is DONTCARE*/
92 if ((cond1 & BIT0) != 0) /*GLNA*/
93 bitMask |= 0x000000FF;
94 if ((cond1 & BIT1) != 0) /*GPA*/
95 bitMask |= 0x0000FF00;
96 if ((cond1 & BIT2) != 0) /*ALNA*/
97 bitMask |= 0x00FF0000;
98 if ((cond1 & BIT3) != 0) /*APA*/
99 bitMask |= 0xFF000000;
101 if (((cond2 & bitMask) == (driver2 & bitMask)) && ((cond4 & bitMask) == (driver4 & bitMask))) /* BoardType of each RF path is matched*/
110 IN PDM_ODM_T pDM_Odm,
111 IN const u4Byte Condition1,
112 IN const u4Byte Condition2
118 /******************************************************************************
120 ******************************************************************************/
122 u4Byte Array_MP_8723B_MAC_REG[] = {
230 ODM_ReadAndConfig_MP_8723B_MAC_REG(
236 BOOLEAN bMatched = TRUE, bSkipped = FALSE;
237 u4Byte ArrayLen = sizeof(Array_MP_8723B_MAC_REG)/sizeof(u4Byte);
238 pu4Byte Array = Array_MP_8723B_MAC_REG;
240 u4Byte v1 = 0, v2 = 0, pre_v1 = 0, pre_v2 = 0;
242 ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_LOUD, ("===> ODM_ReadAndConfig_MP_8723B_MAC_REG\n"));
244 while ((i + 1) < ArrayLen) {
248 if (v1 & (BIT31 | BIT30)) {/*positive & negative condition*/
249 if (v1 & BIT31) {/* positive condition*/
250 cCond = (u1Byte)((v1 & (BIT29|BIT28)) >> 28);
251 if (cCond == COND_ENDIF) {/*end*/
254 ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_LOUD, ("ENDIF\n"));
255 } else if (cCond == COND_ELSE) { /*else*/
256 bMatched = bSkipped?FALSE:TRUE;
257 ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_LOUD, ("ELSE\n"));
259 else {/*if , else if*/
262 ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_LOUD, ("IF or ELSE IF\n"));
264 } else if (v1 & BIT30) { /*negative condition*/
265 if (bSkipped == FALSE) {
266 if (CheckPositive(pDM_Odm, pre_v1, pre_v2, v1, v2)) {
278 odm_ConfigMAC_8723B(pDM_Odm, v1, (u1Byte)v2);
285 ODM_GetVersion_MP_8723B_MAC_REG(void)
290 #endif /* end of HWIMG_SUPPORT*/