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 "HalEfuseMask8822B_SDIO.h"
18 
19 /******************************************************************************
20 *                           MSDIO.TXT
21 ******************************************************************************/
22 
23 u8 Array_MP_8822B_MSDIO[] = {
24 0xFF,
25 0xF7,
26 0xEF,
27 0xDE,
28 0xFC,
29 0xFB,
30 0x10,
31 0x00,
32 0x00,
33 0x00,
34 0x00,
35 0x03,
36 0xF7,
37 0xFF,
38 0xFF,
39 0xFF,
40 0xFF,
41 0xFF,
42 0x00,
43 0x00,
44 0x00,
45 0x00,
46 0x00,
47 0x00,
48 0x00,
49 0x00,
50 0x00,
51 0x00,
52 0x00,
53 0x00,
54 0x00,
55 0x00,
56 0x00,
57 0x00,
58 0x00,
59 0x00,
60 0x00,
61 0x00,
62 0x00,
63 0x00,
64 0x00,
65 0x00,
66 0x00,
67 0x00,
68 0x00,
69 0x00,
70 0x00,
71 0x00,
72 
73 };
74 
EFUSE_GetArrayLen_MP_8822B_MSDIO(void)75 u16 EFUSE_GetArrayLen_MP_8822B_MSDIO(void)
76 {
77 	return sizeof(Array_MP_8822B_MSDIO) / sizeof(u8);
78 }
79 
EFUSE_GetMaskArray_MP_8822B_MSDIO(u8 * Array)80 void EFUSE_GetMaskArray_MP_8822B_MSDIO(u8 *Array)
81 {
82 	u16 len = EFUSE_GetArrayLen_MP_8822B_MSDIO(), i = 0;
83 
84 	for (i = 0; i < len; ++i)
85 		Array[i] = Array_MP_8822B_MSDIO[i];
86 }
87 
EFUSE_IsAddressMasked_MP_8822B_MSDIO(u16 Offset)88 BOOLEAN EFUSE_IsAddressMasked_MP_8822B_MSDIO(u16 Offset)
89 {
90 	int r = Offset / 16;
91 	int c = (Offset % 16) / 2;
92 	int result = 0;
93 
94 	if (c < 4) /*Upper double word*/
95 		result = (Array_MP_8822B_MSDIO[r] & (0x10 << c));
96 	else
97 		result = (Array_MP_8822B_MSDIO[r] & (0x01 << (c - 4)));
98 
99 	return (result > 0) ? 0 : 1;
100 }
101