Merge remote-tracking branch 'asoc/fix/sta529' into tmp
[deliverable/linux.git] / drivers / staging / rtl8712 / rtl8712_io.c
CommitLineData
2865d42c
LF
1/******************************************************************************
2 * rtl8712_io.c
3 *
4 * Copyright(c) 2007 - 2010 Realtek Corporation. All rights reserved.
5 * Linux device driver for RTL8192SU
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of version 2 of the GNU General Public License as
9 * published by the Free Software Foundation.
10 *
11 * This program is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 * more details.
15 *
16 * You should have received a copy of the GNU General Public License along with
17 * this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
19 *
20 * Modifications for inclusion into the Linux staging tree are
21 * Copyright(c) 2010 Larry Finger. All rights reserved.
22 *
23 * Contact information:
24 * WLAN FAE <wlanfae@realtek.com>.
25 * Larry Finger <Larry.Finger@lwfinger.net>
26 *
27 ******************************************************************************/
28
29#define _RTL8712_IO_C_
30
31#include "osdep_service.h"
32#include "drv_types.h"
33#include "rtl871x_io.h"
34#include "osdep_intf.h"
35#include "usb_ops.h"
36
37u8 r8712_read8(struct _adapter *adapter, u32 addr)
38{
39 struct io_queue *pio_queue = (struct io_queue *)adapter->pio_queue;
40 struct intf_hdl *pintfhdl = &(pio_queue->intf);
41 u8 (*_read8)(struct intf_hdl *pintfhdl, u32 addr);
42 u8 r_val;
43
44 _read8 = pintfhdl->io_ops._read8;
45 r_val = _read8(pintfhdl, addr);
46 return r_val;
47}
48
49u16 r8712_read16(struct _adapter *adapter, u32 addr)
50{
51 struct io_queue *pio_queue = (struct io_queue *)adapter->pio_queue;
52 struct intf_hdl *pintfhdl = &(pio_queue->intf);
53 u16 (*_read16)(struct intf_hdl *pintfhdl, u32 addr);
54 u16 r_val;
55
56 _read16 = pintfhdl->io_ops._read16;
57 r_val = _read16(pintfhdl, addr);
58 return r_val;
59}
60
61u32 r8712_read32(struct _adapter *adapter, u32 addr)
62{
63 struct io_queue *pio_queue = (struct io_queue *)adapter->pio_queue;
64 struct intf_hdl *pintfhdl = &(pio_queue->intf);
65 u32 (*_read32)(struct intf_hdl *pintfhdl, u32 addr);
66 u32 r_val;
67
68 _read32 = pintfhdl->io_ops._read32;
69 r_val = _read32(pintfhdl, addr);
70 return r_val;
71}
72
73void r8712_write8(struct _adapter *adapter, u32 addr, u8 val)
74{
75 struct io_queue *pio_queue = (struct io_queue *)adapter->pio_queue;
76 struct intf_hdl *pintfhdl = &(pio_queue->intf);
77 void (*_write8)(struct intf_hdl *pintfhdl, u32 addr, u8 val);
78
79 _write8 = pintfhdl->io_ops._write8;
80 _write8(pintfhdl, addr, val);
81}
82
83void r8712_write16(struct _adapter *adapter, u32 addr, u16 val)
84{
85 struct io_queue *pio_queue = (struct io_queue *)adapter->pio_queue;
86 struct intf_hdl *pintfhdl = &(pio_queue->intf);
87
88 void (*_write16)(struct intf_hdl *pintfhdl, u32 addr, u16 val);
89 _write16 = pintfhdl->io_ops._write16;
90 _write16(pintfhdl, addr, val);
91}
92
93void r8712_write32(struct _adapter *adapter, u32 addr, u32 val)
94{
95 struct io_queue *pio_queue = (struct io_queue *)adapter->pio_queue;
96 struct intf_hdl *pintfhdl = (struct intf_hdl *)(&(pio_queue->intf));
97
98 void (*_write32)(struct intf_hdl *pintfhdl, u32 addr, u32 val);
99 _write32 = pintfhdl->io_ops._write32;
100 _write32(pintfhdl, addr, val);
101}
102
103void r8712_read_mem(struct _adapter *adapter, u32 addr, u32 cnt, u8 *pmem)
104{
105 struct io_queue *pio_queue = (struct io_queue *)adapter->pio_queue;
106 struct intf_hdl *pintfhdl = &(pio_queue->intf);
107
108 void (*_read_mem)(struct intf_hdl *pintfhdl, u32 addr, u32 cnt,
109 u8 *pmem);
110 if ((adapter->bDriverStopped == true) ||
111 (adapter->bSurpriseRemoved == true))
112 return;
113 _read_mem = pintfhdl->io_ops._read_mem;
114 _read_mem(pintfhdl, addr, cnt, pmem);
115}
116
117void r8712_write_mem(struct _adapter *adapter, u32 addr, u32 cnt, u8 *pmem)
118{
119 struct io_queue *pio_queue = (struct io_queue *)adapter->pio_queue;
120 struct intf_hdl *pintfhdl = &(pio_queue->intf);
121 void (*_write_mem)(struct intf_hdl *pintfhdl, u32 addr, u32 cnt,
122 u8 *pmem);
123
124 _write_mem = pintfhdl->io_ops._write_mem;
125 _write_mem(pintfhdl, addr, cnt, pmem);
126}
127
128void r8712_read_port(struct _adapter *adapter, u32 addr, u32 cnt, u8 *pmem)
129{
130 struct io_queue *pio_queue = (struct io_queue *)adapter->pio_queue;
131 struct intf_hdl *pintfhdl = &(pio_queue->intf);
132
133 u32 (*_read_port)(struct intf_hdl *pintfhdl, u32 addr, u32 cnt,
134 u8 *pmem);
135 if ((adapter->bDriverStopped == true) ||
136 (adapter->bSurpriseRemoved == true))
137 return;
138 _read_port = pintfhdl->io_ops._read_port;
139 _read_port(pintfhdl, addr, cnt, pmem);
140}
141
142void r8712_write_port(struct _adapter *adapter, u32 addr, u32 cnt, u8 *pmem)
143{
144 struct io_queue *pio_queue = (struct io_queue *)adapter->pio_queue;
145 struct intf_hdl *pintfhdl = &(pio_queue->intf);
146
147 u32 (*_write_port)(struct intf_hdl *pintfhdl, u32 addr, u32 cnt,
148 u8 *pmem);
149 _write_port = pintfhdl->io_ops._write_port;
150 _write_port(pintfhdl, addr, cnt, pmem);
151}
This page took 0.195263 seconds and 5 git commands to generate.