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_SDIO.h"
18
19 /******************************************************************************
20 * MSDIO.TXT
21 ******************************************************************************/
22 u8 Array_MP_8822C_MSDIO_BT[] = {
23 0x00,
24 0x41,
25 0x00,
26 0x70,
27 0x00,
28 0x00,
29 0x00,
30 0x00,
31 0x00,
32 0x00,
33 0x00,
34 0x00,
35 0x00,
36 0x02,
37 0x00,
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 0x08,
52 0x00,
53 0x00,
54 0x00,
55 0x00,
56 0x00,
57 0x00,
58 0x00,
59 0x00,
60 0x00,
61 0x00,
62 0xCF,
63 0xFF,
64 0x00,
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 };
88
89 u8 Array_MP_8822C_MSDIO[] = {
90 0xFF,
91 0xF7,
92 0xEF,
93 0xDE,
94 0xFC,
95 0xFB,
96 0x10,
97 0x00,
98 0x00,
99 0x00,
100 0x00,
101 0x03,
102 0xF7,
103 0xD7,
104 0x00,
105 0x00,
106 0x71,
107 0xF1,
108 0x76,
109 0x00,
110 0x00,
111 0x00,
112 0x0E,
113 0x00,
114 0x00,
115 0x00,
116 0x00,
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 };
139
140 /* BT eFuse Mask */
EFUSE_GetBTArrayLen_MP_8822C_MSDIO(void)141 u16 EFUSE_GetBTArrayLen_MP_8822C_MSDIO(void)
142 {
143 return sizeof(Array_MP_8822C_MSDIO_BT) / sizeof(u8);
144 }
145
EFUSE_GetBTMaskArray_MP_8822C_MSDIO(u8 * Array)146 void EFUSE_GetBTMaskArray_MP_8822C_MSDIO(u8 *Array)
147 {
148 u16 len = EFUSE_GetBTArrayLen_MP_8822C_MSDIO(), i = 0;
149
150 for (i = 0; i < len; ++i)
151 Array[i] = Array_MP_8822C_MSDIO_BT[i];
152 }
153
EFUSE_IsBTAddressMasked_MP_8822C_MSDIO(u16 Offset)154 BOOLEAN EFUSE_IsBTAddressMasked_MP_8822C_MSDIO(u16 Offset)
155 {
156 int r = Offset / 16;
157 int c = (Offset % 16) / 2;
158 int result = 0;
159
160 if (c < 4) /*Upper double word*/
161 result = (Array_MP_8822C_MSDIO_BT[r] & (0x10 << c));
162 else
163 result = (Array_MP_8822C_MSDIO_BT[r] & (0x01 << (c - 4)));
164
165 return (result > 0) ? 0 : 1;
166 }
167
168 /* WiFi eFuse Mask */
EFUSE_GetArrayLen_MP_8822C_MSDIO(void)169 u16 EFUSE_GetArrayLen_MP_8822C_MSDIO(void)
170 {
171 return sizeof(Array_MP_8822C_MSDIO) / sizeof(u8);
172 }
173
EFUSE_GetMaskArray_MP_8822C_MSDIO(u8 * Array)174 void EFUSE_GetMaskArray_MP_8822C_MSDIO(u8 *Array)
175 {
176 u16 len = EFUSE_GetArrayLen_MP_8822C_MSDIO(), i = 0;
177
178 for (i = 0; i < len; ++i)
179 Array[i] = Array_MP_8822C_MSDIO[i];
180 }
181
EFUSE_IsAddressMasked_MP_8822C_MSDIO(u16 Offset)182 BOOLEAN EFUSE_IsAddressMasked_MP_8822C_MSDIO(u16 Offset)
183 {
184 int r = Offset / 16;
185 int c = (Offset % 16) / 2;
186 int result = 0;
187
188 if (c < 4) /*Upper double word*/
189 result = (Array_MP_8822C_MSDIO[r] & (0x10 << c));
190 else
191 result = (Array_MP_8822C_MSDIO[r] & (0x01 << (c - 4)));
192
193 return (result > 0) ? 0 : 1;
194 }
195