162306a36Sopenharmony_ci/*-
262306a36Sopenharmony_ci * Copyright (c) 2002-2007 Sam Leffler, Errno Consulting
362306a36Sopenharmony_ci * All rights reserved.
462306a36Sopenharmony_ci *
562306a36Sopenharmony_ci * Redistribution and use in source and binary forms, with or without
662306a36Sopenharmony_ci * modification, are permitted provided that the following conditions
762306a36Sopenharmony_ci * are met:
862306a36Sopenharmony_ci * 1. Redistributions of source code must retain the above copyright
962306a36Sopenharmony_ci *    notice, this list of conditions and the following disclaimer,
1062306a36Sopenharmony_ci *    without modification.
1162306a36Sopenharmony_ci * 2. Redistributions in binary form must reproduce at minimum a disclaimer
1262306a36Sopenharmony_ci *    similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any
1362306a36Sopenharmony_ci *    redistribution must be conditioned upon including a substantially
1462306a36Sopenharmony_ci *    similar Disclaimer requirement for further binary redistribution.
1562306a36Sopenharmony_ci * 3. Neither the names of the above-listed copyright holders nor the names
1662306a36Sopenharmony_ci *    of any contributors may be used to endorse or promote products derived
1762306a36Sopenharmony_ci *    from this software without specific prior written permission.
1862306a36Sopenharmony_ci *
1962306a36Sopenharmony_ci * Alternatively, this software may be distributed under the terms of the
2062306a36Sopenharmony_ci * GNU General Public License ("GPL") version 2 as published by the Free
2162306a36Sopenharmony_ci * Software Foundation.
2262306a36Sopenharmony_ci *
2362306a36Sopenharmony_ci * NO WARRANTY
2462306a36Sopenharmony_ci * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
2562306a36Sopenharmony_ci * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
2662306a36Sopenharmony_ci * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY
2762306a36Sopenharmony_ci * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
2862306a36Sopenharmony_ci * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY,
2962306a36Sopenharmony_ci * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
3062306a36Sopenharmony_ci * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
3162306a36Sopenharmony_ci * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
3262306a36Sopenharmony_ci * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
3362306a36Sopenharmony_ci * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
3462306a36Sopenharmony_ci * THE POSSIBILITY OF SUCH DAMAGES.
3562306a36Sopenharmony_ci *
3662306a36Sopenharmony_ci */
3762306a36Sopenharmony_ci
3862306a36Sopenharmony_ci/*
3962306a36Sopenharmony_ci * Definitions for the Atheros Wireless LAN controller driver.
4062306a36Sopenharmony_ci */
4162306a36Sopenharmony_ci#ifndef _DEV_ATH5K_BASE_H
4262306a36Sopenharmony_ci#define _DEV_ATH5K_BASE_H
4362306a36Sopenharmony_ci
4462306a36Sopenharmony_cistruct ieee80211_vif;
4562306a36Sopenharmony_cistruct ieee80211_hw;
4662306a36Sopenharmony_cistruct ath5k_hw;
4762306a36Sopenharmony_cistruct ath5k_txq;
4862306a36Sopenharmony_cistruct ieee80211_channel;
4962306a36Sopenharmony_cistruct ath_bus_ops;
5062306a36Sopenharmony_cistruct ieee80211_tx_control;
5162306a36Sopenharmony_cienum nl80211_iftype;
5262306a36Sopenharmony_ci
5362306a36Sopenharmony_cienum ath5k_srev_type {
5462306a36Sopenharmony_ci	AR5K_VERSION_MAC,
5562306a36Sopenharmony_ci	AR5K_VERSION_RAD,
5662306a36Sopenharmony_ci};
5762306a36Sopenharmony_ci
5862306a36Sopenharmony_cistruct ath5k_srev_name {
5962306a36Sopenharmony_ci	const char		*sr_name;
6062306a36Sopenharmony_ci	enum ath5k_srev_type	sr_type;
6162306a36Sopenharmony_ci	u_int			sr_val;
6262306a36Sopenharmony_ci};
6362306a36Sopenharmony_ci
6462306a36Sopenharmony_cistruct ath5k_buf {
6562306a36Sopenharmony_ci	struct list_head		list;
6662306a36Sopenharmony_ci	struct ath5k_desc		*desc;		/* virtual addr of desc */
6762306a36Sopenharmony_ci	dma_addr_t			daddr;		/* physical addr of desc */
6862306a36Sopenharmony_ci	struct sk_buff			*skb;		/* skbuff for buf */
6962306a36Sopenharmony_ci	dma_addr_t			skbaddr;	/* physical addr of skb data */
7062306a36Sopenharmony_ci	struct ieee80211_tx_rate	rates[4];	/* number of multi-rate stages */
7162306a36Sopenharmony_ci};
7262306a36Sopenharmony_ci
7362306a36Sopenharmony_cistruct ath5k_vif {
7462306a36Sopenharmony_ci	bool			assoc; /* are we associated or not */
7562306a36Sopenharmony_ci	enum nl80211_iftype	opmode;
7662306a36Sopenharmony_ci	int			bslot;
7762306a36Sopenharmony_ci	struct ath5k_buf	*bbuf; /* beacon buffer */
7862306a36Sopenharmony_ci};
7962306a36Sopenharmony_ci
8062306a36Sopenharmony_cistruct ath5k_vif_iter_data {
8162306a36Sopenharmony_ci	const u8	*hw_macaddr;
8262306a36Sopenharmony_ci	u8		mask[ETH_ALEN];
8362306a36Sopenharmony_ci	u8		active_mac[ETH_ALEN]; /* first active MAC */
8462306a36Sopenharmony_ci	bool		need_set_hw_addr;
8562306a36Sopenharmony_ci	bool		found_active;
8662306a36Sopenharmony_ci	bool		any_assoc;
8762306a36Sopenharmony_ci	enum nl80211_iftype opmode;
8862306a36Sopenharmony_ci	int n_stas;
8962306a36Sopenharmony_ci};
9062306a36Sopenharmony_ci
9162306a36Sopenharmony_civoid ath5k_vif_iter(void *data, u8 *mac, struct ieee80211_vif *vif);
9262306a36Sopenharmony_cibool ath5k_any_vif_assoc(struct ath5k_hw *ah);
9362306a36Sopenharmony_ci
9462306a36Sopenharmony_ciint ath5k_start(struct ieee80211_hw *hw);
9562306a36Sopenharmony_civoid ath5k_stop(struct ieee80211_hw *hw);
9662306a36Sopenharmony_ci
9762306a36Sopenharmony_civoid ath5k_beacon_update_timers(struct ath5k_hw *ah, u64 bc_tsf);
9862306a36Sopenharmony_ciint ath5k_beacon_update(struct ieee80211_hw *hw, struct ieee80211_vif *vif);
9962306a36Sopenharmony_civoid ath5k_beacon_config(struct ath5k_hw *ah);
10062306a36Sopenharmony_civoid ath5k_set_beacon_filter(struct ieee80211_hw *hw, bool enable);
10162306a36Sopenharmony_ci
10262306a36Sopenharmony_civoid ath5k_update_bssid_mask_and_opmode(struct ath5k_hw *ah,
10362306a36Sopenharmony_ci					struct ieee80211_vif *vif);
10462306a36Sopenharmony_ciint ath5k_chan_set(struct ath5k_hw *ah, struct cfg80211_chan_def *chandef);
10562306a36Sopenharmony_civoid ath5k_txbuf_free_skb(struct ath5k_hw *ah, struct ath5k_buf *bf);
10662306a36Sopenharmony_civoid ath5k_rxbuf_free_skb(struct ath5k_hw *ah, struct ath5k_buf *bf);
10762306a36Sopenharmony_civoid ath5k_tx_queue(struct ieee80211_hw *hw, struct sk_buff *skb,
10862306a36Sopenharmony_ci		    struct ath5k_txq *txq, struct ieee80211_tx_control *control);
10962306a36Sopenharmony_ci
11062306a36Sopenharmony_ciconst char *ath5k_chip_name(enum ath5k_srev_type type, u_int16_t val);
11162306a36Sopenharmony_ci
11262306a36Sopenharmony_ciint ath5k_init_ah(struct ath5k_hw *ah, const struct ath_bus_ops *bus_ops);
11362306a36Sopenharmony_civoid ath5k_deinit_ah(struct ath5k_hw *ah);
11462306a36Sopenharmony_ci
11562306a36Sopenharmony_ci/* Check whether BSSID mask is supported */
11662306a36Sopenharmony_ci#define ath5k_hw_hasbssidmask(_ah) (ah->ah_version == AR5K_AR5212)
11762306a36Sopenharmony_ci
11862306a36Sopenharmony_ci/* Check whether virtual EOL is supported */
11962306a36Sopenharmony_ci#define ath5k_hw_hasveol(_ah) (ah->ah_version != AR5K_AR5210)
12062306a36Sopenharmony_ci
12162306a36Sopenharmony_ci#endif	/* _DEV_ATH5K_BASE_H */
122