]>
git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blob - drivers/staging/rtl8712/rtl8712_io.c
1 /******************************************************************************
4 * Copyright(c) 2007 - 2010 Realtek Corporation. All rights reserved.
5 * Linux device driver for RTL8192SU
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.
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
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
20 * Modifications for inclusion into the Linux staging tree are
21 * Copyright(c) 2010 Larry Finger. All rights reserved.
23 * Contact information:
24 * WLAN FAE <wlanfae@realtek.com>.
25 * Larry Finger <Larry.Finger@lwfinger.net>
27 ******************************************************************************/
29 #define _RTL8712_IO_C_
31 #include "osdep_service.h"
32 #include "drv_types.h"
33 #include "rtl871x_io.h"
34 #include "osdep_intf.h"
37 u8
r8712_read8(struct _adapter
*adapter
, u32 addr
)
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
);
43 _read8
= pintfhdl
->io_ops
._read8
;
44 return _read8(pintfhdl
, addr
);
47 u16
r8712_read16(struct _adapter
*adapter
, u32 addr
)
49 struct io_queue
*pio_queue
= (struct io_queue
*)adapter
->pio_queue
;
50 struct intf_hdl
*pintfhdl
= &(pio_queue
->intf
);
51 u16 (*_read16
)(struct intf_hdl
*pintfhdl
, u32 addr
);
53 _read16
= pintfhdl
->io_ops
._read16
;
54 return _read16(pintfhdl
, addr
);
57 u32
r8712_read32(struct _adapter
*adapter
, u32 addr
)
59 struct io_queue
*pio_queue
= (struct io_queue
*)adapter
->pio_queue
;
60 struct intf_hdl
*pintfhdl
= &(pio_queue
->intf
);
61 u32 (*_read32
)(struct intf_hdl
*pintfhdl
, u32 addr
);
63 _read32
= pintfhdl
->io_ops
._read32
;
64 return _read32(pintfhdl
, addr
);
67 void r8712_write8(struct _adapter
*adapter
, u32 addr
, u8 val
)
69 struct io_queue
*pio_queue
= (struct io_queue
*)adapter
->pio_queue
;
70 struct intf_hdl
*pintfhdl
= &(pio_queue
->intf
);
71 void (*_write8
)(struct intf_hdl
*pintfhdl
, u32 addr
, u8 val
);
73 _write8
= pintfhdl
->io_ops
._write8
;
74 _write8(pintfhdl
, addr
, val
);
77 void r8712_write16(struct _adapter
*adapter
, u32 addr
, u16 val
)
79 struct io_queue
*pio_queue
= (struct io_queue
*)adapter
->pio_queue
;
80 struct intf_hdl
*pintfhdl
= &(pio_queue
->intf
);
81 void (*_write16
)(struct intf_hdl
*pintfhdl
, u32 addr
, u16 val
);
83 _write16
= pintfhdl
->io_ops
._write16
;
84 _write16(pintfhdl
, addr
, val
);
87 void r8712_write32(struct _adapter
*adapter
, u32 addr
, u32 val
)
89 struct io_queue
*pio_queue
= (struct io_queue
*)adapter
->pio_queue
;
90 struct intf_hdl
*pintfhdl
= (struct intf_hdl
*)(&(pio_queue
->intf
));
92 void (*_write32
)(struct intf_hdl
*pintfhdl
, u32 addr
, u32 val
);
94 _write32
= pintfhdl
->io_ops
._write32
;
95 _write32(pintfhdl
, addr
, val
);
98 void r8712_read_mem(struct _adapter
*adapter
, u32 addr
, u32 cnt
, u8
*pmem
)
100 struct io_queue
*pio_queue
= (struct io_queue
*)adapter
->pio_queue
;
101 struct intf_hdl
*pintfhdl
= &(pio_queue
->intf
);
103 void (*_read_mem
)(struct intf_hdl
*pintfhdl
, u32 addr
, u32 cnt
,
105 if ((adapter
->bDriverStopped
== true) ||
106 (adapter
->bSurpriseRemoved
== true))
108 _read_mem
= pintfhdl
->io_ops
._read_mem
;
109 _read_mem(pintfhdl
, addr
, cnt
, pmem
);
112 void r8712_write_mem(struct _adapter
*adapter
, u32 addr
, u32 cnt
, u8
*pmem
)
114 struct io_queue
*pio_queue
= (struct io_queue
*)adapter
->pio_queue
;
115 struct intf_hdl
*pintfhdl
= &(pio_queue
->intf
);
116 void (*_write_mem
)(struct intf_hdl
*pintfhdl
, u32 addr
, u32 cnt
,
119 _write_mem
= pintfhdl
->io_ops
._write_mem
;
120 _write_mem(pintfhdl
, addr
, cnt
, pmem
);
123 void r8712_read_port(struct _adapter
*adapter
, u32 addr
, u32 cnt
, u8
*pmem
)
125 struct io_queue
*pio_queue
= (struct io_queue
*)adapter
->pio_queue
;
126 struct intf_hdl
*pintfhdl
= &(pio_queue
->intf
);
128 u32 (*_read_port
)(struct intf_hdl
*pintfhdl
, u32 addr
, u32 cnt
,
130 if ((adapter
->bDriverStopped
== true) ||
131 (adapter
->bSurpriseRemoved
== true))
133 _read_port
= pintfhdl
->io_ops
._read_port
;
134 _read_port(pintfhdl
, addr
, cnt
, pmem
);
137 void r8712_write_port(struct _adapter
*adapter
, u32 addr
, u32 cnt
, u8
*pmem
)
139 struct io_queue
*pio_queue
= (struct io_queue
*)adapter
->pio_queue
;
140 struct intf_hdl
*pintfhdl
= &(pio_queue
->intf
);
142 u32 (*_write_port
)(struct intf_hdl
*pintfhdl
, u32 addr
, u32 cnt
,
144 _write_port
= pintfhdl
->io_ops
._write_port
;
145 _write_port(pintfhdl
, addr
, cnt
, pmem
);