Back to home page

OSCL-LXR

 
 

    


0001 /*
0002  * Copyright (c) 2004-2011 Atheros Communications Inc.
0003  * Copyright (c) 2011 Qualcomm Atheros, Inc.
0004  *
0005  * Permission to use, copy, modify, and/or distribute this software for any
0006  * purpose with or without fee is hereby granted, provided that the above
0007  * copyright notice and this permission notice appear in all copies.
0008  *
0009  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
0010  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
0011  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
0012  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
0013  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
0014  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
0015  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
0016  */
0017 
0018 #ifndef HIF_OPS_H
0019 #define HIF_OPS_H
0020 
0021 #include "hif.h"
0022 #include "debug.h"
0023 
0024 static inline int hif_read_write_sync(struct ath6kl *ar, u32 addr, u8 *buf,
0025                       u32 len, u32 request)
0026 {
0027     ath6kl_dbg(ATH6KL_DBG_HIF,
0028            "hif %s sync addr 0x%x buf 0x%p len %d request 0x%x\n",
0029            (request & HIF_WRITE) ? "write" : "read",
0030            addr, buf, len, request);
0031 
0032     return ar->hif_ops->read_write_sync(ar, addr, buf, len, request);
0033 }
0034 
0035 static inline int hif_write_async(struct ath6kl *ar, u32 address, u8 *buffer,
0036                   u32 length, u32 request,
0037                   struct htc_packet *packet)
0038 {
0039     ath6kl_dbg(ATH6KL_DBG_HIF,
0040            "hif write async addr 0x%x buf 0x%p len %d request 0x%x\n",
0041            address, buffer, length, request);
0042 
0043     return ar->hif_ops->write_async(ar, address, buffer, length,
0044                     request, packet);
0045 }
0046 static inline void ath6kl_hif_irq_enable(struct ath6kl *ar)
0047 {
0048     ath6kl_dbg(ATH6KL_DBG_HIF, "hif irq enable\n");
0049 
0050     return ar->hif_ops->irq_enable(ar);
0051 }
0052 
0053 static inline void ath6kl_hif_irq_disable(struct ath6kl *ar)
0054 {
0055     ath6kl_dbg(ATH6KL_DBG_HIF, "hif irq disable\n");
0056 
0057     return ar->hif_ops->irq_disable(ar);
0058 }
0059 
0060 static inline struct hif_scatter_req *hif_scatter_req_get(struct ath6kl *ar)
0061 {
0062     return ar->hif_ops->scatter_req_get(ar);
0063 }
0064 
0065 static inline void hif_scatter_req_add(struct ath6kl *ar,
0066                        struct hif_scatter_req *s_req)
0067 {
0068     return ar->hif_ops->scatter_req_add(ar, s_req);
0069 }
0070 
0071 static inline int ath6kl_hif_enable_scatter(struct ath6kl *ar)
0072 {
0073     return ar->hif_ops->enable_scatter(ar);
0074 }
0075 
0076 static inline int ath6kl_hif_scat_req_rw(struct ath6kl *ar,
0077                      struct hif_scatter_req *scat_req)
0078 {
0079     return ar->hif_ops->scat_req_rw(ar, scat_req);
0080 }
0081 
0082 static inline void ath6kl_hif_cleanup_scatter(struct ath6kl *ar)
0083 {
0084     return ar->hif_ops->cleanup_scatter(ar);
0085 }
0086 
0087 static inline int ath6kl_hif_suspend(struct ath6kl *ar,
0088                      struct cfg80211_wowlan *wow)
0089 {
0090     ath6kl_dbg(ATH6KL_DBG_HIF, "hif suspend\n");
0091 
0092     return ar->hif_ops->suspend(ar, wow);
0093 }
0094 
0095 /*
0096  * Read from the ATH6KL through its diagnostic window. No cooperation from
0097  * the Target is required for this.
0098  */
0099 static inline int ath6kl_hif_diag_read32(struct ath6kl *ar, u32 address,
0100                      u32 *value)
0101 {
0102     return ar->hif_ops->diag_read32(ar, address, value);
0103 }
0104 
0105 /*
0106  * Write to the ATH6KL through its diagnostic window. No cooperation from
0107  * the Target is required for this.
0108  */
0109 static inline int ath6kl_hif_diag_write32(struct ath6kl *ar, u32 address,
0110                       __le32 value)
0111 {
0112     return ar->hif_ops->diag_write32(ar, address, value);
0113 }
0114 
0115 static inline int ath6kl_hif_bmi_read(struct ath6kl *ar, u8 *buf, u32 len)
0116 {
0117     return ar->hif_ops->bmi_read(ar, buf, len);
0118 }
0119 
0120 static inline int ath6kl_hif_bmi_write(struct ath6kl *ar, u8 *buf, u32 len)
0121 {
0122     return ar->hif_ops->bmi_write(ar, buf, len);
0123 }
0124 
0125 static inline int ath6kl_hif_resume(struct ath6kl *ar)
0126 {
0127     ath6kl_dbg(ATH6KL_DBG_HIF, "hif resume\n");
0128 
0129     return ar->hif_ops->resume(ar);
0130 }
0131 
0132 static inline int ath6kl_hif_power_on(struct ath6kl *ar)
0133 {
0134     ath6kl_dbg(ATH6KL_DBG_HIF, "hif power on\n");
0135 
0136     return ar->hif_ops->power_on(ar);
0137 }
0138 
0139 static inline int ath6kl_hif_power_off(struct ath6kl *ar)
0140 {
0141     ath6kl_dbg(ATH6KL_DBG_HIF, "hif power off\n");
0142 
0143     return ar->hif_ops->power_off(ar);
0144 }
0145 
0146 static inline void ath6kl_hif_stop(struct ath6kl *ar)
0147 {
0148     ath6kl_dbg(ATH6KL_DBG_HIF, "hif stop\n");
0149 
0150     ar->hif_ops->stop(ar);
0151 }
0152 
0153 static inline int ath6kl_hif_pipe_send(struct ath6kl *ar,
0154                        u8 pipe, struct sk_buff *hdr_buf,
0155                        struct sk_buff *buf)
0156 {
0157     ath6kl_dbg(ATH6KL_DBG_HIF, "hif pipe send\n");
0158 
0159     return ar->hif_ops->pipe_send(ar, pipe, hdr_buf, buf);
0160 }
0161 
0162 static inline void ath6kl_hif_pipe_get_default(struct ath6kl *ar,
0163                            u8 *ul_pipe, u8 *dl_pipe)
0164 {
0165     ath6kl_dbg(ATH6KL_DBG_HIF, "hif pipe get default\n");
0166 
0167     ar->hif_ops->pipe_get_default(ar, ul_pipe, dl_pipe);
0168 }
0169 
0170 static inline int ath6kl_hif_pipe_map_service(struct ath6kl *ar,
0171                           u16 service_id, u8 *ul_pipe,
0172                           u8 *dl_pipe)
0173 {
0174     ath6kl_dbg(ATH6KL_DBG_HIF, "hif pipe get default\n");
0175 
0176     return ar->hif_ops->pipe_map_service(ar, service_id, ul_pipe, dl_pipe);
0177 }
0178 
0179 static inline u16 ath6kl_hif_pipe_get_free_queue_number(struct ath6kl *ar,
0180                             u8 pipe)
0181 {
0182     ath6kl_dbg(ATH6KL_DBG_HIF, "hif pipe get free queue number\n");
0183 
0184     return ar->hif_ops->pipe_get_free_queue_number(ar, pipe);
0185 }
0186 
0187 #endif