hif-ops.h 3.2 KB
Newer Older
K
Kalle Valo 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
/*
 * Copyright (c) 2004-2011 Atheros Communications Inc.
 *
 * Permission to use, copy, modify, and/or distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 */

#ifndef HIF_OPS_H
#define HIF_OPS_H

#include "hif.h"
K
Kalle Valo 已提交
21
#include "debug.h"
K
Kalle Valo 已提交
22 23 24 25

static inline int hif_read_write_sync(struct ath6kl *ar, u32 addr, u8 *buf,
				      u32 len, u32 request)
{
K
Kalle Valo 已提交
26 27 28 29 30
	ath6kl_dbg(ATH6KL_DBG_HIF,
		   "hif %s sync addr 0x%x buf 0x%p len %d request 0x%x\n",
		   (request & HIF_WRITE) ? "write" : "read",
		   addr, buf, len, request);

K
Kalle Valo 已提交
31 32 33 34 35 36 37
	return ar->hif_ops->read_write_sync(ar, addr, buf, len, request);
}

static inline int hif_write_async(struct ath6kl *ar, u32 address, u8 *buffer,
				  u32 length, u32 request,
				  struct htc_packet *packet)
{
K
Kalle Valo 已提交
38 39 40 41
	ath6kl_dbg(ATH6KL_DBG_HIF,
		   "hif write async addr 0x%x buf 0x%p len %d request 0x%x\n",
		   address, buffer, length, request);

K
Kalle Valo 已提交
42 43 44 45 46
	return ar->hif_ops->write_async(ar, address, buffer, length,
					request, packet);
}
static inline void ath6kl_hif_irq_enable(struct ath6kl *ar)
{
K
Kalle Valo 已提交
47 48
	ath6kl_dbg(ATH6KL_DBG_HIF, "hif irq enable\n");

K
Kalle Valo 已提交
49 50 51 52 53
	return ar->hif_ops->irq_enable(ar);
}

static inline void ath6kl_hif_irq_disable(struct ath6kl *ar)
{
K
Kalle Valo 已提交
54 55
	ath6kl_dbg(ATH6KL_DBG_HIF, "hif irq disable\n");

K
Kalle Valo 已提交
56 57 58 59 60 61 62 63 64 65 66 67 68 69
	return ar->hif_ops->irq_disable(ar);
}

static inline struct hif_scatter_req *hif_scatter_req_get(struct ath6kl *ar)
{
	return ar->hif_ops->scatter_req_get(ar);
}

static inline void hif_scatter_req_add(struct ath6kl *ar,
				       struct hif_scatter_req *s_req)
{
	return ar->hif_ops->scatter_req_add(ar, s_req);
}

70
static inline int ath6kl_hif_enable_scatter(struct ath6kl *ar)
K
Kalle Valo 已提交
71
{
72
	return ar->hif_ops->enable_scatter(ar);
K
Kalle Valo 已提交
73 74
}

75 76 77 78 79 80
static inline int ath6kl_hif_scat_req_rw(struct ath6kl *ar,
					 struct hif_scatter_req *scat_req)
{
	return ar->hif_ops->scat_req_rw(ar, scat_req);
}

K
Kalle Valo 已提交
81 82 83 84 85
static inline void ath6kl_hif_cleanup_scatter(struct ath6kl *ar)
{
	return ar->hif_ops->cleanup_scatter(ar);
}

K
Kalle Valo 已提交
86 87
static inline int ath6kl_hif_suspend(struct ath6kl *ar)
{
K
Kalle Valo 已提交
88 89
	ath6kl_dbg(ATH6KL_DBG_HIF, "hif suspend\n");

K
Kalle Valo 已提交
90 91 92
	return ar->hif_ops->suspend(ar);
}

93 94
static inline int ath6kl_hif_resume(struct ath6kl *ar)
{
K
Kalle Valo 已提交
95 96
	ath6kl_dbg(ATH6KL_DBG_HIF, "hif resume\n");

97 98
	return ar->hif_ops->resume(ar);
}
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113

static inline int ath6kl_hif_power_on(struct ath6kl *ar)
{
	ath6kl_dbg(ATH6KL_DBG_HIF, "hif power on\n");

	return ar->hif_ops->power_on(ar);
}

static inline int ath6kl_hif_power_off(struct ath6kl *ar)
{
	ath6kl_dbg(ATH6KL_DBG_HIF, "hif power off\n");

	return ar->hif_ops->power_off(ar);
}

K
Kalle Valo 已提交
114 115 116 117 118 119 120
static inline void ath6kl_hif_stop(struct ath6kl *ar)
{
	ath6kl_dbg(ATH6KL_DBG_HIF, "hif stop\n");

	ar->hif_ops->stop(ar);
}

K
Kalle Valo 已提交
121
#endif