1 /******************************************************************************
2 *
3 * Copyright(c) 2015 - 2016 Realtek Corporation. All rights reserved.
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 * 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
17 *
18 *
19 ******************************************************************************/
20 #include <drv_types.h>
21 
22 #include "HalEfuseMask8822B_USB.h"
23 
24 /******************************************************************************
25 *                           MUSB.TXT
26 ******************************************************************************/
27 
28 u1Byte Array_MP_8822B_MUSB[] = {
29 	0xFF,
30 	0xF7,
31 	0xEF,
32 	0xDE,
33 	0xFC,
34 	0xFB,
35 	0x10,
36 	0x00,
37 	0x00,
38 	0x00,
39 	0x00,
40 	0x0F,
41 	0xF7,
42 	0x00,
43 	0x00,
44 	0x00,
45 	0xFF,
46 	0xFF,
47 	0xF3,
48 	0x00,
49 	0xF0,
50 	0x00,
51 	0x00,
52 	0x00,
53 	0x00,
54 	0x00,
55 	0x00,
56 	0x00,
57 	0x00,
58 	0x00,
59 	0x08,
60 	0x00,
61 	0x80,
62 	0x00,
63 	0x00,
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 
78 };
79 
EFUSE_GetArrayLen_MP_8822B_MUSB(VOID)80 u2Byte EFUSE_GetArrayLen_MP_8822B_MUSB(VOID)
81 {
82 	return sizeof(Array_MP_8822B_MUSB) / sizeof(u1Byte);
83 }
84 
EFUSE_GetMaskArray_MP_8822B_MUSB(pu1Byte Array)85 VOID EFUSE_GetMaskArray_MP_8822B_MUSB(pu1Byte Array)
86 {
87 	u2Byte len = EFUSE_GetArrayLen_MP_8822B_MUSB(), i = 0;
88 
89 	for (i = 0; i < len; ++i)
90 		Array[i] = Array_MP_8822B_MUSB[i];
91 }
92 
EFUSE_IsAddressMasked_MP_8822B_MUSB(u2Byte Offset)93 BOOLEAN EFUSE_IsAddressMasked_MP_8822B_MUSB(u2Byte  Offset)
94 {
95 	int r = Offset / 16;
96 	int c = (Offset % 16) / 2;
97 	int result = 0;
98 
99 	if (c < 4) /*Upper double word*/
100 		result = (Array_MP_8822B_MUSB[r] & (0x10 << c));
101 	else
102 		result = (Array_MP_8822B_MUSB[r] & (0x01 << (c - 4)));
103 
104 	return (result > 0) ? 0 : 1;
105 }
106