hif-ops.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. /*
  2. * Copyright (c) 2004-2011 Atheros Communications Inc.
  3. *
  4. * Permission to use, copy, modify, and/or distribute this software for any
  5. * purpose with or without fee is hereby granted, provided that the above
  6. * copyright notice and this permission notice appear in all copies.
  7. *
  8. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  9. * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  10. * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  11. * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  12. * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  13. * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  14. * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  15. */
  16. #ifndef HIF_OPS_H
  17. #define HIF_OPS_H
  18. #include "hif.h"
  19. #include "debug.h"
  20. static inline int hif_read_write_sync(struct ath6kl *ar, u32 addr, u8 *buf,
  21. u32 len, u32 request)
  22. {
  23. ath6kl_dbg(ATH6KL_DBG_HIF,
  24. "hif %s sync addr 0x%x buf 0x%p len %d request 0x%x\n",
  25. (request & HIF_WRITE) ? "write" : "read",
  26. addr, buf, len, request);
  27. return ar->hif_ops->read_write_sync(ar, addr, buf, len, request);
  28. }
  29. static inline int hif_write_async(struct ath6kl *ar, u32 address, u8 *buffer,
  30. u32 length, u32 request,
  31. struct htc_packet *packet)
  32. {
  33. ath6kl_dbg(ATH6KL_DBG_HIF,
  34. "hif write async addr 0x%x buf 0x%p len %d request 0x%x\n",
  35. address, buffer, length, request);
  36. return ar->hif_ops->write_async(ar, address, buffer, length,
  37. request, packet);
  38. }
  39. static inline void ath6kl_hif_irq_enable(struct ath6kl *ar)
  40. {
  41. ath6kl_dbg(ATH6KL_DBG_HIF, "hif irq enable\n");
  42. return ar->hif_ops->irq_enable(ar);
  43. }
  44. static inline void ath6kl_hif_irq_disable(struct ath6kl *ar)
  45. {
  46. ath6kl_dbg(ATH6KL_DBG_HIF, "hif irq disable\n");
  47. return ar->hif_ops->irq_disable(ar);
  48. }
  49. static inline struct hif_scatter_req *hif_scatter_req_get(struct ath6kl *ar)
  50. {
  51. return ar->hif_ops->scatter_req_get(ar);
  52. }
  53. static inline void hif_scatter_req_add(struct ath6kl *ar,
  54. struct hif_scatter_req *s_req)
  55. {
  56. return ar->hif_ops->scatter_req_add(ar, s_req);
  57. }
  58. static inline int ath6kl_hif_enable_scatter(struct ath6kl *ar)
  59. {
  60. return ar->hif_ops->enable_scatter(ar);
  61. }
  62. static inline int ath6kl_hif_scat_req_rw(struct ath6kl *ar,
  63. struct hif_scatter_req *scat_req)
  64. {
  65. return ar->hif_ops->scat_req_rw(ar, scat_req);
  66. }
  67. static inline void ath6kl_hif_cleanup_scatter(struct ath6kl *ar)
  68. {
  69. return ar->hif_ops->cleanup_scatter(ar);
  70. }
  71. static inline int ath6kl_hif_suspend(struct ath6kl *ar,
  72. struct cfg80211_wowlan *wow)
  73. {
  74. ath6kl_dbg(ATH6KL_DBG_HIF, "hif suspend\n");
  75. return ar->hif_ops->suspend(ar, wow);
  76. }
  77. /*
  78. * Read from the ATH6KL through its diagnostic window. No cooperation from
  79. * the Target is required for this.
  80. */
  81. static inline int ath6kl_hif_diag_read32(struct ath6kl *ar, u32 address,
  82. u32 *value)
  83. {
  84. return ar->hif_ops->diag_read32(ar, address, value);
  85. }
  86. /*
  87. * Write to the ATH6KL through its diagnostic window. No cooperation from
  88. * the Target is required for this.
  89. */
  90. static inline int ath6kl_hif_diag_write32(struct ath6kl *ar, u32 address,
  91. __le32 value)
  92. {
  93. return ar->hif_ops->diag_write32(ar, address, value);
  94. }
  95. static inline int ath6kl_hif_bmi_read(struct ath6kl *ar, u8 *buf, u32 len)
  96. {
  97. return ar->hif_ops->bmi_read(ar, buf, len);
  98. }
  99. static inline int ath6kl_hif_bmi_write(struct ath6kl *ar, u8 *buf, u32 len)
  100. {
  101. return ar->hif_ops->bmi_write(ar, buf, len);
  102. }
  103. static inline int ath6kl_hif_resume(struct ath6kl *ar)
  104. {
  105. ath6kl_dbg(ATH6KL_DBG_HIF, "hif resume\n");
  106. return ar->hif_ops->resume(ar);
  107. }
  108. static inline int ath6kl_hif_power_on(struct ath6kl *ar)
  109. {
  110. ath6kl_dbg(ATH6KL_DBG_HIF, "hif power on\n");
  111. return ar->hif_ops->power_on(ar);
  112. }
  113. static inline int ath6kl_hif_power_off(struct ath6kl *ar)
  114. {
  115. ath6kl_dbg(ATH6KL_DBG_HIF, "hif power off\n");
  116. return ar->hif_ops->power_off(ar);
  117. }
  118. static inline void ath6kl_hif_stop(struct ath6kl *ar)
  119. {
  120. ath6kl_dbg(ATH6KL_DBG_HIF, "hif stop\n");
  121. ar->hif_ops->stop(ar);
  122. }
  123. #endif