blob: 34adc77ffb30bf852796df3cb7eefdd733ea61de [file] [log] [blame]
Kalle Valobdcd8172011-07-18 00:22:30 +03001/*
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
17#ifndef HIF_OPS_H
18#define HIF_OPS_H
19
20#include "hif.h"
Kalle Valo83973e02011-10-13 15:21:53 +030021#include "debug.h"
Kalle Valobdcd8172011-07-18 00:22:30 +030022
23static inline int hif_read_write_sync(struct ath6kl *ar, u32 addr, u8 *buf,
24 u32 len, u32 request)
25{
Kalle Valo83973e02011-10-13 15:21:53 +030026 ath6kl_dbg(ATH6KL_DBG_HIF,
27 "hif %s sync addr 0x%x buf 0x%p len %d request 0x%x\n",
28 (request & HIF_WRITE) ? "write" : "read",
29 addr, buf, len, request);
30
Kalle Valobdcd8172011-07-18 00:22:30 +030031 return ar->hif_ops->read_write_sync(ar, addr, buf, len, request);
32}
33
34static inline int hif_write_async(struct ath6kl *ar, u32 address, u8 *buffer,
35 u32 length, u32 request,
36 struct htc_packet *packet)
37{
Kalle Valo83973e02011-10-13 15:21:53 +030038 ath6kl_dbg(ATH6KL_DBG_HIF,
39 "hif write async addr 0x%x buf 0x%p len %d request 0x%x\n",
40 address, buffer, length, request);
41
Kalle Valobdcd8172011-07-18 00:22:30 +030042 return ar->hif_ops->write_async(ar, address, buffer, length,
43 request, packet);
44}
45static inline void ath6kl_hif_irq_enable(struct ath6kl *ar)
46{
Kalle Valo83973e02011-10-13 15:21:53 +030047 ath6kl_dbg(ATH6KL_DBG_HIF, "hif irq enable\n");
48
Kalle Valobdcd8172011-07-18 00:22:30 +030049 return ar->hif_ops->irq_enable(ar);
50}
51
52static inline void ath6kl_hif_irq_disable(struct ath6kl *ar)
53{
Kalle Valo83973e02011-10-13 15:21:53 +030054 ath6kl_dbg(ATH6KL_DBG_HIF, "hif irq disable\n");
55
Kalle Valobdcd8172011-07-18 00:22:30 +030056 return ar->hif_ops->irq_disable(ar);
57}
58
59static inline struct hif_scatter_req *hif_scatter_req_get(struct ath6kl *ar)
60{
61 return ar->hif_ops->scatter_req_get(ar);
62}
63
64static inline void hif_scatter_req_add(struct ath6kl *ar,
65 struct hif_scatter_req *s_req)
66{
67 return ar->hif_ops->scatter_req_add(ar, s_req);
68}
69
Vasanthakumar Thiagarajan50745af2011-07-18 14:23:29 +053070static inline int ath6kl_hif_enable_scatter(struct ath6kl *ar)
Kalle Valobdcd8172011-07-18 00:22:30 +030071{
Vasanthakumar Thiagarajan50745af2011-07-18 14:23:29 +053072 return ar->hif_ops->enable_scatter(ar);
Kalle Valobdcd8172011-07-18 00:22:30 +030073}
74
Vasanthakumar Thiagarajanf74a7362011-07-16 20:29:05 +053075static inline int ath6kl_hif_scat_req_rw(struct ath6kl *ar,
76 struct hif_scatter_req *scat_req)
77{
78 return ar->hif_ops->scat_req_rw(ar, scat_req);
79}
80
Kalle Valobdcd8172011-07-18 00:22:30 +030081static inline void ath6kl_hif_cleanup_scatter(struct ath6kl *ar)
82{
83 return ar->hif_ops->cleanup_scatter(ar);
84}
85
Kalle Valoabcb3442011-07-22 08:26:20 +030086static inline int ath6kl_hif_suspend(struct ath6kl *ar)
87{
Kalle Valo83973e02011-10-13 15:21:53 +030088 ath6kl_dbg(ATH6KL_DBG_HIF, "hif suspend\n");
89
Kalle Valoabcb3442011-07-22 08:26:20 +030090 return ar->hif_ops->suspend(ar);
91}
92
Chilam Ngaa6cffc2011-10-05 10:12:52 +030093static inline int ath6kl_hif_resume(struct ath6kl *ar)
94{
Kalle Valo83973e02011-10-13 15:21:53 +030095 ath6kl_dbg(ATH6KL_DBG_HIF, "hif resume\n");
96
Chilam Ngaa6cffc2011-10-05 10:12:52 +030097 return ar->hif_ops->resume(ar);
98}
Kalle Valob2e75692011-10-27 18:48:14 +030099
100static inline int ath6kl_hif_power_on(struct ath6kl *ar)
101{
102 ath6kl_dbg(ATH6KL_DBG_HIF, "hif power on\n");
103
104 return ar->hif_ops->power_on(ar);
105}
106
107static inline int ath6kl_hif_power_off(struct ath6kl *ar)
108{
109 ath6kl_dbg(ATH6KL_DBG_HIF, "hif power off\n");
110
111 return ar->hif_ops->power_off(ar);
112}
113
Kalle Valobdcd8172011-07-18 00:22:30 +0300114#endif