rtl8712_io.c 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  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. #define _RTL8712_IO_C_
  29. #include "osdep_service.h"
  30. #include "drv_types.h"
  31. #include "rtl871x_io.h"
  32. #include "osdep_intf.h"
  33. #include "usb_ops.h"
  34. u8 r8712_read8(struct _adapter *adapter, u32 addr)
  35. {
  36. struct io_queue *pio_queue = adapter->pio_queue;
  37. struct intf_hdl *pintfhdl = &(pio_queue->intf);
  38. u8 (*_read8)(struct intf_hdl *pintfhdl, u32 addr);
  39. _read8 = pintfhdl->io_ops._read8;
  40. return _read8(pintfhdl, addr);
  41. }
  42. u16 r8712_read16(struct _adapter *adapter, u32 addr)
  43. {
  44. struct io_queue *pio_queue = adapter->pio_queue;
  45. struct intf_hdl *pintfhdl = &(pio_queue->intf);
  46. u16 (*_read16)(struct intf_hdl *pintfhdl, u32 addr);
  47. _read16 = pintfhdl->io_ops._read16;
  48. return _read16(pintfhdl, addr);
  49. }
  50. u32 r8712_read32(struct _adapter *adapter, u32 addr)
  51. {
  52. struct io_queue *pio_queue = adapter->pio_queue;
  53. struct intf_hdl *pintfhdl = &(pio_queue->intf);
  54. u32 (*_read32)(struct intf_hdl *pintfhdl, u32 addr);
  55. _read32 = pintfhdl->io_ops._read32;
  56. return _read32(pintfhdl, addr);
  57. }
  58. void r8712_write8(struct _adapter *adapter, u32 addr, u8 val)
  59. {
  60. struct io_queue *pio_queue = adapter->pio_queue;
  61. struct intf_hdl *pintfhdl = &(pio_queue->intf);
  62. void (*_write8)(struct intf_hdl *pintfhdl, u32 addr, u8 val);
  63. _write8 = pintfhdl->io_ops._write8;
  64. _write8(pintfhdl, addr, val);
  65. }
  66. void r8712_write16(struct _adapter *adapter, u32 addr, u16 val)
  67. {
  68. struct io_queue *pio_queue = adapter->pio_queue;
  69. struct intf_hdl *pintfhdl = &(pio_queue->intf);
  70. void (*_write16)(struct intf_hdl *pintfhdl, u32 addr, u16 val);
  71. _write16 = pintfhdl->io_ops._write16;
  72. _write16(pintfhdl, addr, val);
  73. }
  74. void r8712_write32(struct _adapter *adapter, u32 addr, u32 val)
  75. {
  76. struct io_queue *pio_queue = adapter->pio_queue;
  77. struct intf_hdl *pintfhdl = &(pio_queue->intf);
  78. void (*_write32)(struct intf_hdl *pintfhdl, u32 addr, u32 val);
  79. _write32 = pintfhdl->io_ops._write32;
  80. _write32(pintfhdl, addr, val);
  81. }
  82. void r8712_read_mem(struct _adapter *adapter, u32 addr, u32 cnt, u8 *pmem)
  83. {
  84. struct io_queue *pio_queue = adapter->pio_queue;
  85. struct intf_hdl *pintfhdl = &(pio_queue->intf);
  86. void (*_read_mem)(struct intf_hdl *pintfhdl, u32 addr, u32 cnt,
  87. u8 *pmem);
  88. if (adapter->bDriverStopped || adapter->bSurpriseRemoved)
  89. return;
  90. _read_mem = pintfhdl->io_ops._read_mem;
  91. _read_mem(pintfhdl, addr, cnt, pmem);
  92. }
  93. void r8712_write_mem(struct _adapter *adapter, u32 addr, u32 cnt, u8 *pmem)
  94. {
  95. struct io_queue *pio_queue = adapter->pio_queue;
  96. struct intf_hdl *pintfhdl = &(pio_queue->intf);
  97. void (*_write_mem)(struct intf_hdl *pintfhdl, u32 addr, u32 cnt,
  98. u8 *pmem);
  99. _write_mem = pintfhdl->io_ops._write_mem;
  100. _write_mem(pintfhdl, addr, cnt, pmem);
  101. }
  102. void r8712_read_port(struct _adapter *adapter, u32 addr, u32 cnt, u8 *pmem)
  103. {
  104. struct io_queue *pio_queue = adapter->pio_queue;
  105. struct intf_hdl *pintfhdl = &(pio_queue->intf);
  106. u32 (*_read_port)(struct intf_hdl *pintfhdl, u32 addr, u32 cnt,
  107. u8 *pmem);
  108. if (adapter->bDriverStopped || adapter->bSurpriseRemoved)
  109. return;
  110. _read_port = pintfhdl->io_ops._read_port;
  111. _read_port(pintfhdl, addr, cnt, pmem);
  112. }
  113. void r8712_write_port(struct _adapter *adapter, u32 addr, u32 cnt, u8 *pmem)
  114. {
  115. struct io_queue *pio_queue = adapter->pio_queue;
  116. struct intf_hdl *pintfhdl = &(pio_queue->intf);
  117. u32 (*_write_port)(struct intf_hdl *pintfhdl, u32 addr, u32 cnt,
  118. u8 *pmem);
  119. _write_port = pintfhdl->io_ops._write_port;
  120. _write_port(pintfhdl, addr, cnt, pmem);
  121. }