xref: /OK3568_Linux_fs/external/rkwifibt/drivers/rtl8821cs/hal/efuse/rtl8821c/HalEfuseMask8821C_USB.c (revision 4882a59341e53eb6f0b4789bf948001014eff981)
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 #include "HalEfuseMask8821C_USB.h"
21 
22 
23 
24 /******************************************************************************
25 *                           MUSB.TXT
26 ******************************************************************************/
27 
28 u8 Array_MP_8821C_MUSB[] = {
29 		0xFF,
30 		0xF3,
31 		0xEF,
32 		0x9E,
33 		0x70,
34 		0x00,
35 		0x00,
36 		0x00,
37 		0x00,
38 		0x00,
39 		0x00,
40 		0x03,
41 		0xF7,
42 		0x00,
43 		0x00,
44 		0x00,
45 		0xFF,
46 		0xFF,
47 		0xFF,
48 		0xFF,
49 		0xC0,
50 		0x00,
51 		0x00,
52 		0x00,
53 		0x00,
54 		0x00,
55 		0x00,
56 		0x00,
57 		0x00,
58 		0x00,
59 		0x00,
60 		0x00,
61 
62 };
63 
64 u16
EFUSE_GetArrayLen_MP_8821C_MUSB(void)65 EFUSE_GetArrayLen_MP_8821C_MUSB(void)
66 {
67 	return sizeof(Array_MP_8821C_MUSB) / sizeof(u8);
68 }
69 
70 void
EFUSE_GetMaskArray_MP_8821C_MUSB(u8 * Array)71 EFUSE_GetMaskArray_MP_8821C_MUSB(
72 		u8 *Array
73 )
74 {
75 	u16 len = EFUSE_GetArrayLen_MP_8821C_MUSB(), i = 0;
76 
77 	for (i = 0; i < len; ++i)
78 		Array[i] = Array_MP_8821C_MUSB[i];
79 }
80 BOOLEAN
EFUSE_IsAddressMasked_MP_8821C_MUSB(u16 Offset)81 EFUSE_IsAddressMasked_MP_8821C_MUSB(
82 		u16 Offset
83 )
84 {
85 	int r = Offset / 16;
86 	int c = (Offset % 16) / 2;
87 	int result = 0;
88 
89 	if (c < 4) /* Upper double word */
90 		result = (Array_MP_8821C_MUSB[r] & (0x10 << c));
91 	else
92 		result = (Array_MP_8821C_MUSB[r] & (0x01 << (c - 4)));
93 
94 	return (result > 0) ? 0 : 1;
95 }
96