1 /******************************************************************************
2  *
3  * Copyright(c) 2007 - 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 
16 /* #include "Mp_Precomp.h" */
17 /* #include "../odm_precomp.h" */
18 
19 #include <drv_types.h>
20 
21 #include "HalEfuseMask8723B_SDIO.h"
22 /******************************************************************************
23 *                           MSDIO.TXT
24 ******************************************************************************/
25 
26 u1Byte Array_MP_8723B_MSDIO[] = {
27 	0xFF,
28 	0xF3,
29 	0x00,
30 	0x0E,
31 	0x70,
32 	0x00,
33 	0x00,
34 	0x00,
35 	0x00,
36 	0x00,
37 	0x00,
38 	0x07,
39 	0xF3,
40 	0xFF,
41 	0xFF,
42 	0xFF,
43 	0xFF,
44 	0xFF,
45 	0x00,
46 	0x00,
47 	0x80,
48 	0x00,
49 	0x00,
50 	0x00,
51 	0x00,
52 	0x00,
53 	0x00,
54 	0x00,
55 	0x00,
56 	0x00,
57 	0x00,
58 	0x00,
59 
60 };
61 
62 u2Byte
EFUSE_GetArrayLen_MP_8723B_MSDIO(VOID)63 EFUSE_GetArrayLen_MP_8723B_MSDIO(VOID)
64 {
65 	return sizeof(Array_MP_8723B_MSDIO) / sizeof(u1Byte);
66 }
67 
68 VOID
EFUSE_GetMaskArray_MP_8723B_MSDIO(IN OUT pu1Byte Array)69 EFUSE_GetMaskArray_MP_8723B_MSDIO(
70 	IN	OUT pu1Byte Array
71 )
72 {
73 	u2Byte len = EFUSE_GetArrayLen_MP_8723B_MSDIO(), i = 0;
74 
75 	for (i = 0; i < len; ++i)
76 		Array[i] = Array_MP_8723B_MSDIO[i];
77 }
78 BOOLEAN
EFUSE_IsAddressMasked_MP_8723B_MSDIO(IN u2Byte Offset)79 EFUSE_IsAddressMasked_MP_8723B_MSDIO(
80 	IN   u2Byte  Offset
81 )
82 {
83 	int r = Offset / 16;
84 	int c = (Offset % 16) / 2;
85 	int result = 0;
86 
87 	if (c < 4) /* Upper double word */
88 		result = (Array_MP_8723B_MSDIO[r] & (0x10 << c));
89 	else
90 		result = (Array_MP_8723B_MSDIO[r] & (0x01 << (c - 4)));
91 
92 	return (result > 0) ? 0 : 1;
93 }
94