]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/blob - drivers/staging/rtl8188eu/core/rtw_io.c
staging: rtl8188eu: Remove function _rtw_write8()
[mirror_ubuntu-hirsute-kernel.git] / drivers / staging / rtl8188eu / core / rtw_io.c
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 * 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 /*
21
22 The purpose of rtw_io.c
23
24 a. provides the API
25
26 b. provides the protocol engine
27
28 c. provides the software interface between caller and the hardware interface
29
30
31 Compiler Flag Option:
32
33 USB:
34 a. USE_ASYNC_IRP: Both sync/async operations are provided.
35
36 Only sync read/rtw_write_mem operations are provided.
37
38 jackson@realtek.com.tw
39
40 */
41
42 #define _RTW_IO_C_
43 #include <osdep_service.h>
44 #include <drv_types.h>
45 #include <rtw_io.h>
46 #include <osdep_intf.h>
47 #include <usb_ops.h>
48
49 #define rtw_le16_to_cpu(val) le16_to_cpu(val)
50 #define rtw_le32_to_cpu(val) le32_to_cpu(val)
51 #define rtw_cpu_to_le16(val) cpu_to_le16(val)
52 #define rtw_cpu_to_le32(val) cpu_to_le32(val)
53
54
55 u8 _rtw_read8(struct adapter *adapter, u32 addr)
56 {
57 u8 r_val;
58 struct io_priv *pio_priv = &adapter->iopriv;
59 struct intf_hdl *pintfhdl = &(pio_priv->intf);
60 u8 (*_read8)(struct adapter *pintfhdl, u32 addr);
61
62 _read8 = pintfhdl->io_ops._read8;
63 r_val = _read8(adapter, addr);
64 return r_val;
65 }
66
67 u16 _rtw_read16(struct adapter *adapter, u32 addr)
68 {
69 u16 r_val;
70 struct io_priv *pio_priv = &adapter->iopriv;
71 struct intf_hdl *pintfhdl = &(pio_priv->intf);
72 u16 (*_read16)(struct adapter *pintfhdl, u32 addr);
73 _read16 = pintfhdl->io_ops._read16;
74
75 r_val = _read16(adapter, addr);
76 return r_val;
77 }
78
79 u32 _rtw_read32(struct adapter *adapter, u32 addr)
80 {
81 u32 r_val;
82 struct io_priv *pio_priv = &adapter->iopriv;
83 struct intf_hdl *pintfhdl = &(pio_priv->intf);
84 u32 (*_read32)(struct adapter *pintfhdl, u32 addr);
85 _read32 = pintfhdl->io_ops._read32;
86
87 r_val = _read32(adapter, addr);
88 return r_val;
89 }
90
91 int rtw_init_io_priv(struct adapter *padapter, void (*set_intf_ops)(struct _io_ops *pops))
92 {
93 struct io_priv *piopriv = &padapter->iopriv;
94 struct intf_hdl *pintf = &piopriv->intf;
95
96 if (set_intf_ops == NULL)
97 return _FAIL;
98
99 piopriv->padapter = padapter;
100 pintf->padapter = padapter;
101 pintf->pintf_dev = adapter_to_dvobj(padapter);
102
103 set_intf_ops(&pintf->io_ops);
104
105 return _SUCCESS;
106 }