]>
git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/blob - drivers/staging/rtl8188eu/core/rtw_io.c
1 /******************************************************************************
3 * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
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.
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
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
19 ******************************************************************************/
22 The purpose of rtw_io.c
26 b. provides the protocol engine
28 c. provides the software interface between caller and the hardware interface
34 a. USE_ASYNC_IRP: Both sync/async operations are provided.
36 Only sync read/rtw_write_mem operations are provided.
38 jackson@realtek.com.tw
43 #include <osdep_service.h>
44 #include <drv_types.h>
46 #include <osdep_intf.h>
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)
55 u8
_rtw_read8(struct adapter
*adapter
, u32 addr
)
58 struct io_priv
*pio_priv
= &adapter
->iopriv
;
59 struct intf_hdl
*pintfhdl
= &(pio_priv
->intf
);
60 u8 (*_read8
)(struct adapter
*pintfhdl
, u32 addr
);
62 _read8
= pintfhdl
->io_ops
._read8
;
63 r_val
= _read8(adapter
, addr
);
67 u16
_rtw_read16(struct adapter
*adapter
, u32 addr
)
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
;
75 r_val
= _read16(adapter
, addr
);
79 u32
_rtw_read32(struct adapter
*adapter
, u32 addr
)
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
;
87 r_val
= _read32(adapter
, addr
);
91 int rtw_init_io_priv(struct adapter
*padapter
, void (*set_intf_ops
)(struct _io_ops
*pops
))
93 struct io_priv
*piopriv
= &padapter
->iopriv
;
94 struct intf_hdl
*pintf
= &piopriv
->intf
;
96 if (set_intf_ops
== NULL
)
99 piopriv
->padapter
= padapter
;
100 pintf
->padapter
= padapter
;
101 pintf
->pintf_dev
= adapter_to_dvobj(padapter
);
103 set_intf_ops(&pintf
->io_ops
);