1 /******************************************************************************
2 *
3 * Copyright(c) 2015 - 2017 Realtek Corporation.
4 *
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.
8 *
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
12 * more details.
13 *
14 *****************************************************************************/
15 #include <drv_types.h>
16
17 #include "HalEfuseMask8822C_PCIE.h"
18
19 /******************************************************************************
20 * MPCIE.TXT
21 ******************************************************************************/
22
23 u8 Array_MP_8822C_MPCIE_BT[] = {
24 0x00,
25 0x41,
26 0x00,
27 0x70,
28 0x00,
29 0x00,
30 0x00,
31 0x00,
32 0x00,
33 0x00,
34 0x00,
35 0x00,
36 0x00,
37 0x02,
38 0x00,
39 0x00,
40 0x00,
41 0x00,
42 0x00,
43 0x00,
44 0x00,
45 0x00,
46 0x00,
47 0x00,
48 0x00,
49 0x00,
50 0x00,
51 0x00,
52 0x08,
53 0x00,
54 0x00,
55 0x00,
56 0x00,
57 0x00,
58 0x00,
59 0x00,
60 0x00,
61 0x00,
62 0x00,
63 0xCF,
64 0xFF,
65 0x00,
66 0x00,
67 0x00,
68 0x00,
69 0x00,
70 0x00,
71 0x00,
72 0x00,
73 0x00,
74 0x00,
75 0x00,
76 0x00,
77 0x00,
78 0x00,
79 0x00,
80 0x00,
81 0x00,
82 0x00,
83 0x00,
84 0x00,
85 0x00,
86 0x00,
87 0x00,
88 };
89
90 u8 Array_MP_8822C_MPCIE[] = {
91 0xFF,
92 0xF7,
93 0xEF,
94 0xDE,
95 0xFC,
96 0xFB,
97 0x10,
98 0x00,
99 0x00,
100 0x00,
101 0x00,
102 0x03,
103 0xF7,
104 0xD7,
105 0x00,
106 0x00,
107 0x71,
108 0xF1,
109 0xFF,
110 0xFF,
111 0x7E,
112 0xFC,
113 0xFF,
114 0xF1,
115 0x00,
116 0xD0,
117 0x00,
118 0x00,
119 0x00,
120 0x00,
121 0x00,
122 0x00,
123 0x00,
124 0x00,
125 0x00,
126 0x00,
127 0x00,
128 0x00,
129 0x00,
130 0x00,
131 0x00,
132 0x00,
133 0x00,
134 0x00,
135 0x00,
136 0x00,
137 0x00,
138 0x00,
139 };
140
141 /* BT eFuse Maks */
EFUSE_GetBTArrayLen_MP_8822C_MPCIE(void)142 u16 EFUSE_GetBTArrayLen_MP_8822C_MPCIE(void)
143 {
144 return sizeof(Array_MP_8822C_MPCIE_BT) / sizeof(u8);
145 }
146
EFUSE_GetBTMaskArray_MP_8822C_MPCIE(u8 * Array)147 void EFUSE_GetBTMaskArray_MP_8822C_MPCIE(u8 *Array)
148 {
149 u16 len = EFUSE_GetBTArrayLen_MP_8822C_MPCIE(), i = 0;
150
151 for (i = 0; i < len; ++i)
152 Array[i] = Array_MP_8822C_MPCIE_BT[i];
153 }
154
EFUSE_IsBTAddressMasked_MP_8822C_MPCIE(u16 Offset)155 BOOLEAN EFUSE_IsBTAddressMasked_MP_8822C_MPCIE(u16 Offset)
156 {
157 int r = Offset / 16;
158 int c = (Offset % 16) / 2;
159 int result = 0;
160
161 if (c < 4) /*Upper double word*/
162 result = (Array_MP_8822C_MPCIE_BT[r] & (0x10 << c));
163 else
164 result = (Array_MP_8822C_MPCIE_BT[r] & (0x01 << (c - 4)));
165
166 return (result > 0) ? 0 : 1;
167 }
168
169 /* WiFi eFuse Maks */
EFUSE_GetArrayLen_MP_8822C_MPCIE(void)170 u16 EFUSE_GetArrayLen_MP_8822C_MPCIE(void)
171 {
172 return sizeof(Array_MP_8822C_MPCIE) / sizeof(u8);
173 }
174
EFUSE_GetMaskArray_MP_8822C_MPCIE(u8 * Array)175 void EFUSE_GetMaskArray_MP_8822C_MPCIE(u8 *Array)
176 {
177 u16 len = EFUSE_GetArrayLen_MP_8822C_MPCIE(), i = 0;
178
179 for (i = 0; i < len; ++i)
180 Array[i] = Array_MP_8822C_MPCIE[i];
181 }
182
EFUSE_IsAddressMasked_MP_8822C_MPCIE(u16 Offset)183 BOOLEAN EFUSE_IsAddressMasked_MP_8822C_MPCIE(u16 Offset)
184 {
185 int r = Offset / 16;
186 int c = (Offset % 16) / 2;
187 int result = 0;
188
189 if (c < 4) /*Upper double word*/
190 result = (Array_MP_8822C_MPCIE[r] & (0x10 << c));
191 else
192 result = (Array_MP_8822C_MPCIE[r] & (0x01 << (c - 4)));
193
194 return (result > 0) ? 0 : 1;
195 }
196