1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
| /******************************************************************************
| *
| * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
| *
| * This program is free software; you can redistribute it and/or modify it
| * under the terms of version 2 of the GNU General Public License as
| * published by the Free Software Foundation.
| *
| * This program is distributed in the hope that it will be useful, but WITHOUT
| * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
| * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
| * more details.
| *
| * You should have received a copy of the GNU General Public License along with
| * this program; if not, write to the Free Software Foundation, Inc.,
| * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
| *
| *
| ******************************************************************************/
|
| /*Image2HeaderVersion: 2.14*/
| #include "mp_precomp.h"
| #include "../phydm_precomp.h"
|
| #if (RTL8723B_SUPPORT == 1)
| static BOOLEAN
| CheckPositive(
| IN PDM_ODM_T pDM_Odm,
| IN const u4Byte Condition1,
| IN const u4Byte Condition2,
| IN const u4Byte Condition3,
| IN const u4Byte Condition4
| )
| {
| u1Byte _BoardType = ((pDM_Odm->BoardType & BIT4) >> 4) << 0 | /* _GLNA*/
| ((pDM_Odm->BoardType & BIT3) >> 3) << 1 | /* _GPA*/
| ((pDM_Odm->BoardType & BIT7) >> 7) << 2 | /* _ALNA*/
| ((pDM_Odm->BoardType & BIT6) >> 6) << 3 | /* _APA */
| ((pDM_Odm->BoardType & BIT2) >> 2) << 4; /* _BT*/
|
| u4Byte cond1 = Condition1, cond2 = Condition2, cond3 = Condition3, cond4 = Condition4;
| u4Byte driver1 = pDM_Odm->CutVersion << 24 |
| (pDM_Odm->SupportInterface & 0xF0) << 16 |
| pDM_Odm->SupportPlatform << 16 |
| pDM_Odm->PackageType << 12 |
| (pDM_Odm->SupportInterface & 0x0F) << 8 |
| _BoardType;
|
| u4Byte driver2 = (pDM_Odm->TypeGLNA & 0xFF) << 0 |
| (pDM_Odm->TypeGPA & 0xFF) << 8 |
| (pDM_Odm->TypeALNA & 0xFF) << 16 |
| (pDM_Odm->TypeAPA & 0xFF) << 24;
|
| u4Byte driver3 = 0;
|
| u4Byte driver4 = (pDM_Odm->TypeGLNA & 0xFF00) >> 8 |
| (pDM_Odm->TypeGPA & 0xFF00) |
| (pDM_Odm->TypeALNA & 0xFF00) << 8 |
| (pDM_Odm->TypeAPA & 0xFF00) << 16;
|
| ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_TRACE,
| ("===> CheckPositive (cond1, cond2, cond3, cond4) = (0x%X 0x%X 0x%X 0x%X)\n", cond1, cond2, cond3, cond4));
| ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_TRACE,
| ("===> CheckPositive (driver1, driver2, driver3, driver4) = (0x%X 0x%X 0x%X 0x%X)\n", driver1, driver2, driver3, driver4));
|
| ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_TRACE,
| (" (Platform, Interface) = (0x%X, 0x%X)\n", pDM_Odm->SupportPlatform, pDM_Odm->SupportInterface));
| ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_TRACE,
| (" (Board, Package) = (0x%X, 0x%X)\n", pDM_Odm->BoardType, pDM_Odm->PackageType));
|
|
| /*============== Value Defined Check ===============*/
| /*QFN Type [15:12] and Cut Version [27:24] need to do value check*/
|
| if (((cond1 & 0x0000F000) != 0) && ((cond1 & 0x0000F000) != (driver1 & 0x0000F000)))
| return FALSE;
| if (((cond1 & 0x0F000000) != 0) && ((cond1 & 0x0F000000) != (driver1 & 0x0F000000)))
| return FALSE;
|
| /*=============== Bit Defined Check ================*/
| /* We don't care [31:28] */
|
| cond1 &= 0x00FF0FFF;
| driver1 &= 0x00FF0FFF;
|
| if ((cond1 & driver1) == cond1) {
| u4Byte bitMask = 0;
|
| if ((cond1 & 0x0F) == 0) /* BoardType is DONTCARE*/
| return TRUE;
|
| if ((cond1 & BIT0) != 0) /*GLNA*/
| bitMask |= 0x000000FF;
| if ((cond1 & BIT1) != 0) /*GPA*/
| bitMask |= 0x0000FF00;
| if ((cond1 & BIT2) != 0) /*ALNA*/
| bitMask |= 0x00FF0000;
| if ((cond1 & BIT3) != 0) /*APA*/
| bitMask |= 0xFF000000;
|
| if (((cond2 & bitMask) == (driver2 & bitMask)) && ((cond4 & bitMask) == (driver4 & bitMask))) /* BoardType of each RF path is matched*/
| return TRUE;
| else
| return FALSE;
| } else
| return FALSE;
| }
| static BOOLEAN
| CheckNegative(
| IN PDM_ODM_T pDM_Odm,
| IN const u4Byte Condition1,
| IN const u4Byte Condition2
| )
| {
| return TRUE;
| }
|
| /******************************************************************************
| * MAC_REG.TXT
| ******************************************************************************/
|
| u4Byte Array_MP_8723B_MAC_REG[] = {
| 0x02F, 0x00000030,
| 0x035, 0x00000000,
| 0x039, 0x00000008,
| 0x064, 0x00000000,
| 0x067, 0x00000020,
| 0x421, 0x0000000F,
| 0x428, 0x0000000A,
| 0x429, 0x00000010,
| 0x430, 0x00000000,
| 0x431, 0x00000000,
| 0x432, 0x00000000,
| 0x433, 0x00000001,
| 0x434, 0x00000004,
| 0x435, 0x00000005,
| 0x436, 0x00000007,
| 0x437, 0x00000008,
| 0x43C, 0x00000004,
| 0x43D, 0x00000005,
| 0x43E, 0x00000007,
| 0x43F, 0x00000008,
| 0x440, 0x0000005D,
| 0x441, 0x00000001,
| 0x442, 0x00000000,
| 0x444, 0x00000010,
| 0x445, 0x00000000,
| 0x446, 0x00000000,
| 0x447, 0x00000000,
| 0x448, 0x00000000,
| 0x449, 0x000000F0,
| 0x44A, 0x0000000F,
| 0x44B, 0x0000003E,
| 0x44C, 0x00000010,
| 0x44D, 0x00000000,
| 0x44E, 0x00000000,
| 0x44F, 0x00000000,
| 0x450, 0x00000000,
| 0x451, 0x000000F0,
| 0x452, 0x0000000F,
| 0x453, 0x00000000,
| 0x456, 0x0000005E,
| 0x460, 0x00000066,
| 0x461, 0x00000066,
| 0x4C8, 0x000000FF,
| 0x4C9, 0x00000008,
| 0x4CC, 0x000000FF,
| 0x4CD, 0x000000FF,
| 0x4CE, 0x00000001,
| 0x500, 0x00000026,
| 0x501, 0x000000A2,
| 0x502, 0x0000002F,
| 0x503, 0x00000000,
| 0x504, 0x00000028,
| 0x505, 0x000000A3,
| 0x506, 0x0000005E,
| 0x507, 0x00000000,
| 0x508, 0x0000002B,
| 0x509, 0x000000A4,
| 0x50A, 0x0000005E,
| 0x50B, 0x00000000,
| 0x50C, 0x0000004F,
| 0x50D, 0x000000A4,
| 0x50E, 0x00000000,
| 0x50F, 0x00000000,
| 0x512, 0x0000001C,
| 0x514, 0x0000000A,
| 0x516, 0x0000000A,
| 0x525, 0x0000004F,
| 0x550, 0x00000010,
| 0x551, 0x00000010,
| 0x559, 0x00000002,
| 0x55C, 0x00000050,
| 0x55D, 0x000000FF,
| 0x605, 0x00000030,
| 0x608, 0x0000000E,
| 0x609, 0x0000002A,
| 0x620, 0x000000FF,
| 0x621, 0x000000FF,
| 0x622, 0x000000FF,
| 0x623, 0x000000FF,
| 0x624, 0x000000FF,
| 0x625, 0x000000FF,
| 0x626, 0x000000FF,
| 0x627, 0x000000FF,
| 0x638, 0x00000050,
| 0x63C, 0x0000000A,
| 0x63D, 0x0000000A,
| 0x63E, 0x0000000E,
| 0x63F, 0x0000000E,
| 0x640, 0x00000040,
| 0x642, 0x00000040,
| 0x643, 0x00000000,
| 0x652, 0x000000C8,
| 0x66E, 0x00000005,
| 0x700, 0x00000021,
| 0x701, 0x00000043,
| 0x702, 0x00000065,
| 0x703, 0x00000087,
| 0x708, 0x00000021,
| 0x709, 0x00000043,
| 0x70A, 0x00000065,
| 0x70B, 0x00000087,
| 0x765, 0x00000018,
| 0x76E, 0x00000004,
|
| };
|
| void
| ODM_ReadAndConfig_MP_8723B_MAC_REG(
| IN PDM_ODM_T pDM_Odm
| )
| {
| u4Byte i = 0;
| u1Byte cCond;
| BOOLEAN bMatched = TRUE, bSkipped = FALSE;
| u4Byte ArrayLen = sizeof(Array_MP_8723B_MAC_REG)/sizeof(u4Byte);
| pu4Byte Array = Array_MP_8723B_MAC_REG;
|
| u4Byte v1 = 0, v2 = 0, pre_v1 = 0, pre_v2 = 0;
|
| ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_LOUD, ("===> ODM_ReadAndConfig_MP_8723B_MAC_REG\n"));
|
| while ((i + 1) < ArrayLen) {
| v1 = Array[i];
| v2 = Array[i + 1];
|
| if (v1 & (BIT31 | BIT30)) {/*positive & negative condition*/
| if (v1 & BIT31) {/* positive condition*/
| cCond = (u1Byte)((v1 & (BIT29|BIT28)) >> 28);
| if (cCond == COND_ENDIF) {/*end*/
| bMatched = TRUE;
| bSkipped = FALSE;
| ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_LOUD, ("ENDIF\n"));
| } else if (cCond == COND_ELSE) { /*else*/
| bMatched = bSkipped?FALSE:TRUE;
| ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_LOUD, ("ELSE\n"));
| }
| else {/*if , else if*/
| pre_v1 = v1;
| pre_v2 = v2;
| ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_LOUD, ("IF or ELSE IF\n"));
| }
| } else if (v1 & BIT30) { /*negative condition*/
| if (bSkipped == FALSE) {
| if (CheckPositive(pDM_Odm, pre_v1, pre_v2, v1, v2)) {
| bMatched = TRUE;
| bSkipped = TRUE;
| } else {
| bMatched = FALSE;
| bSkipped = FALSE;
| }
| } else
| bMatched = FALSE;
| }
| } else {
| if (bMatched)
| odm_ConfigMAC_8723B(pDM_Odm, v1, (u1Byte)v2);
| }
| i = i + 2;
| }
| }
|
| u4Byte
| ODM_GetVersion_MP_8723B_MAC_REG(void)
| {
| return 24;
| }
|
| #endif /* end of HWIMG_SUPPORT*/
|
|
|