1 /******************************************************************************
2 *
3 * Copyright(c) 2007 - 2011 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 ******************************************************************************/
15
16 /* */
17 /* include files */
18 /* */
19
20 #include "odm_precomp.h"
21 /* */
22 /* ODM IO Relative API. */
23 /* */
24 #include <usb_ops_linux.h>
25
ODM_Read1Byte(struct dm_odm_t * pDM_Odm,u32 RegAddr)26 u8 ODM_Read1Byte(struct dm_odm_t *pDM_Odm,
27 u32 RegAddr
28 )
29 {
30 struct rtw_adapter *Adapter = pDM_Odm->Adapter;
31
32 return rtl8723au_read8(Adapter, RegAddr);
33 }
34
ODM_Read2Byte(struct dm_odm_t * pDM_Odm,u32 RegAddr)35 u16 ODM_Read2Byte(struct dm_odm_t *pDM_Odm, u32 RegAddr)
36 {
37 struct rtw_adapter *Adapter = pDM_Odm->Adapter;
38
39 return rtl8723au_read16(Adapter, RegAddr);
40 }
41
ODM_Read4Byte(struct dm_odm_t * pDM_Odm,u32 RegAddr)42 u32 ODM_Read4Byte(struct dm_odm_t *pDM_Odm, u32 RegAddr)
43 {
44 struct rtw_adapter *Adapter = pDM_Odm->Adapter;
45
46 return rtl8723au_read32(Adapter, RegAddr);
47 }
48
ODM_Write1Byte(struct dm_odm_t * pDM_Odm,u32 RegAddr,u8 Data)49 void ODM_Write1Byte(struct dm_odm_t *pDM_Odm, u32 RegAddr, u8 Data)
50 {
51 struct rtw_adapter *Adapter = pDM_Odm->Adapter;
52
53 rtl8723au_write8(Adapter, RegAddr, Data);
54 }
55
ODM_Write2Byte(struct dm_odm_t * pDM_Odm,u32 RegAddr,u16 Data)56 void ODM_Write2Byte(struct dm_odm_t *pDM_Odm, u32 RegAddr, u16 Data)
57 {
58 struct rtw_adapter *Adapter = pDM_Odm->Adapter;
59
60 rtl8723au_write16(Adapter, RegAddr, Data);
61 }
62
ODM_Write4Byte(struct dm_odm_t * pDM_Odm,u32 RegAddr,u32 Data)63 void ODM_Write4Byte(struct dm_odm_t *pDM_Odm, u32 RegAddr, u32 Data)
64 {
65 struct rtw_adapter *Adapter = pDM_Odm->Adapter;
66
67 rtl8723au_write32(Adapter, RegAddr, Data);
68 }
69
ODM_SetMACReg(struct dm_odm_t * pDM_Odm,u32 RegAddr,u32 BitMask,u32 Data)70 void ODM_SetMACReg(
71 struct dm_odm_t *pDM_Odm,
72 u32 RegAddr,
73 u32 BitMask,
74 u32 Data
75 )
76 {
77 struct rtw_adapter *Adapter = pDM_Odm->Adapter;
78
79 PHY_SetBBReg(Adapter, RegAddr, BitMask, Data);
80 }
81
ODM_GetMACReg(struct dm_odm_t * pDM_Odm,u32 RegAddr,u32 BitMask)82 u32 ODM_GetMACReg(
83 struct dm_odm_t *pDM_Odm,
84 u32 RegAddr,
85 u32 BitMask
86 )
87 {
88 struct rtw_adapter *Adapter = pDM_Odm->Adapter;
89
90 return PHY_QueryBBReg(Adapter, RegAddr, BitMask);
91 }
92
ODM_SetBBReg(struct dm_odm_t * pDM_Odm,u32 RegAddr,u32 BitMask,u32 Data)93 void ODM_SetBBReg(
94 struct dm_odm_t *pDM_Odm,
95 u32 RegAddr,
96 u32 BitMask,
97 u32 Data
98 )
99 {
100 struct rtw_adapter *Adapter = pDM_Odm->Adapter;
101
102 PHY_SetBBReg(Adapter, RegAddr, BitMask, Data);
103 }
104
ODM_GetBBReg(struct dm_odm_t * pDM_Odm,u32 RegAddr,u32 BitMask)105 u32 ODM_GetBBReg(
106 struct dm_odm_t *pDM_Odm,
107 u32 RegAddr,
108 u32 BitMask
109 )
110 {
111 struct rtw_adapter *Adapter = pDM_Odm->Adapter;
112
113 return PHY_QueryBBReg(Adapter, RegAddr, BitMask);
114 }
115
ODM_SetRFReg(struct dm_odm_t * pDM_Odm,enum RF_RADIO_PATH eRFPath,u32 RegAddr,u32 BitMask,u32 Data)116 void ODM_SetRFReg(
117 struct dm_odm_t *pDM_Odm,
118 enum RF_RADIO_PATH eRFPath,
119 u32 RegAddr,
120 u32 BitMask,
121 u32 Data
122 )
123 {
124 struct rtw_adapter *Adapter = pDM_Odm->Adapter;
125
126 PHY_SetRFReg(Adapter, eRFPath, RegAddr, BitMask, Data);
127 }
128
ODM_GetRFReg(struct dm_odm_t * pDM_Odm,enum RF_RADIO_PATH eRFPath,u32 RegAddr,u32 BitMask)129 u32 ODM_GetRFReg(
130 struct dm_odm_t *pDM_Odm,
131 enum RF_RADIO_PATH eRFPath,
132 u32 RegAddr,
133 u32 BitMask
134 )
135 {
136 struct rtw_adapter *Adapter = pDM_Odm->Adapter;
137
138 return PHY_QueryRFReg(Adapter, eRFPath, RegAddr, BitMask);
139 }
140