18c2ecf20Sopenharmony_ci/*-
28c2ecf20Sopenharmony_ci * Copyright (c) 2002-2007 Sam Leffler, Errno Consulting
38c2ecf20Sopenharmony_ci * All rights reserved.
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * Redistribution and use in source and binary forms, with or without
68c2ecf20Sopenharmony_ci * modification, are permitted provided that the following conditions
78c2ecf20Sopenharmony_ci * are met:
88c2ecf20Sopenharmony_ci * 1. Redistributions of source code must retain the above copyright
98c2ecf20Sopenharmony_ci *    notice, this list of conditions and the following disclaimer,
108c2ecf20Sopenharmony_ci *    without modification.
118c2ecf20Sopenharmony_ci * 2. Redistributions in binary form must reproduce at minimum a disclaimer
128c2ecf20Sopenharmony_ci *    similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any
138c2ecf20Sopenharmony_ci *    redistribution must be conditioned upon including a substantially
148c2ecf20Sopenharmony_ci *    similar Disclaimer requirement for further binary redistribution.
158c2ecf20Sopenharmony_ci * 3. Neither the names of the above-listed copyright holders nor the names
168c2ecf20Sopenharmony_ci *    of any contributors may be used to endorse or promote products derived
178c2ecf20Sopenharmony_ci *    from this software without specific prior written permission.
188c2ecf20Sopenharmony_ci *
198c2ecf20Sopenharmony_ci * Alternatively, this software may be distributed under the terms of the
208c2ecf20Sopenharmony_ci * GNU General Public License ("GPL") version 2 as published by the Free
218c2ecf20Sopenharmony_ci * Software Foundation.
228c2ecf20Sopenharmony_ci *
238c2ecf20Sopenharmony_ci * NO WARRANTY
248c2ecf20Sopenharmony_ci * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
258c2ecf20Sopenharmony_ci * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
268c2ecf20Sopenharmony_ci * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY
278c2ecf20Sopenharmony_ci * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
288c2ecf20Sopenharmony_ci * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY,
298c2ecf20Sopenharmony_ci * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
308c2ecf20Sopenharmony_ci * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
318c2ecf20Sopenharmony_ci * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
328c2ecf20Sopenharmony_ci * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
338c2ecf20Sopenharmony_ci * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
348c2ecf20Sopenharmony_ci * THE POSSIBILITY OF SUCH DAMAGES.
358c2ecf20Sopenharmony_ci *
368c2ecf20Sopenharmony_ci */
378c2ecf20Sopenharmony_ci
388c2ecf20Sopenharmony_ci/*
398c2ecf20Sopenharmony_ci * Definitions for the Atheros Wireless LAN controller driver.
408c2ecf20Sopenharmony_ci */
418c2ecf20Sopenharmony_ci#ifndef _DEV_ATH5K_BASE_H
428c2ecf20Sopenharmony_ci#define _DEV_ATH5K_BASE_H
438c2ecf20Sopenharmony_ci
448c2ecf20Sopenharmony_cistruct ieee80211_vif;
458c2ecf20Sopenharmony_cistruct ieee80211_hw;
468c2ecf20Sopenharmony_cistruct ath5k_hw;
478c2ecf20Sopenharmony_cistruct ath5k_txq;
488c2ecf20Sopenharmony_cistruct ieee80211_channel;
498c2ecf20Sopenharmony_cistruct ath_bus_ops;
508c2ecf20Sopenharmony_cistruct ieee80211_tx_control;
518c2ecf20Sopenharmony_cienum nl80211_iftype;
528c2ecf20Sopenharmony_ci
538c2ecf20Sopenharmony_cienum ath5k_srev_type {
548c2ecf20Sopenharmony_ci	AR5K_VERSION_MAC,
558c2ecf20Sopenharmony_ci	AR5K_VERSION_RAD,
568c2ecf20Sopenharmony_ci};
578c2ecf20Sopenharmony_ci
588c2ecf20Sopenharmony_cistruct ath5k_srev_name {
598c2ecf20Sopenharmony_ci	const char		*sr_name;
608c2ecf20Sopenharmony_ci	enum ath5k_srev_type	sr_type;
618c2ecf20Sopenharmony_ci	u_int			sr_val;
628c2ecf20Sopenharmony_ci};
638c2ecf20Sopenharmony_ci
648c2ecf20Sopenharmony_cistruct ath5k_buf {
658c2ecf20Sopenharmony_ci	struct list_head		list;
668c2ecf20Sopenharmony_ci	struct ath5k_desc		*desc;		/* virtual addr of desc */
678c2ecf20Sopenharmony_ci	dma_addr_t			daddr;		/* physical addr of desc */
688c2ecf20Sopenharmony_ci	struct sk_buff			*skb;		/* skbuff for buf */
698c2ecf20Sopenharmony_ci	dma_addr_t			skbaddr;	/* physical addr of skb data */
708c2ecf20Sopenharmony_ci	struct ieee80211_tx_rate	rates[4];	/* number of multi-rate stages */
718c2ecf20Sopenharmony_ci};
728c2ecf20Sopenharmony_ci
738c2ecf20Sopenharmony_cistruct ath5k_vif {
748c2ecf20Sopenharmony_ci	bool			assoc; /* are we associated or not */
758c2ecf20Sopenharmony_ci	enum nl80211_iftype	opmode;
768c2ecf20Sopenharmony_ci	int			bslot;
778c2ecf20Sopenharmony_ci	struct ath5k_buf	*bbuf; /* beacon buffer */
788c2ecf20Sopenharmony_ci};
798c2ecf20Sopenharmony_ci
808c2ecf20Sopenharmony_cistruct ath5k_vif_iter_data {
818c2ecf20Sopenharmony_ci	const u8	*hw_macaddr;
828c2ecf20Sopenharmony_ci	u8		mask[ETH_ALEN];
838c2ecf20Sopenharmony_ci	u8		active_mac[ETH_ALEN]; /* first active MAC */
848c2ecf20Sopenharmony_ci	bool		need_set_hw_addr;
858c2ecf20Sopenharmony_ci	bool		found_active;
868c2ecf20Sopenharmony_ci	bool		any_assoc;
878c2ecf20Sopenharmony_ci	enum nl80211_iftype opmode;
888c2ecf20Sopenharmony_ci	int n_stas;
898c2ecf20Sopenharmony_ci};
908c2ecf20Sopenharmony_ci
918c2ecf20Sopenharmony_civoid ath5k_vif_iter(void *data, u8 *mac, struct ieee80211_vif *vif);
928c2ecf20Sopenharmony_cibool ath5k_any_vif_assoc(struct ath5k_hw *ah);
938c2ecf20Sopenharmony_ci
948c2ecf20Sopenharmony_ciint ath5k_start(struct ieee80211_hw *hw);
958c2ecf20Sopenharmony_civoid ath5k_stop(struct ieee80211_hw *hw);
968c2ecf20Sopenharmony_ci
978c2ecf20Sopenharmony_civoid ath5k_beacon_update_timers(struct ath5k_hw *ah, u64 bc_tsf);
988c2ecf20Sopenharmony_ciint ath5k_beacon_update(struct ieee80211_hw *hw, struct ieee80211_vif *vif);
998c2ecf20Sopenharmony_civoid ath5k_beacon_config(struct ath5k_hw *ah);
1008c2ecf20Sopenharmony_civoid ath5k_set_beacon_filter(struct ieee80211_hw *hw, bool enable);
1018c2ecf20Sopenharmony_ci
1028c2ecf20Sopenharmony_civoid ath5k_update_bssid_mask_and_opmode(struct ath5k_hw *ah,
1038c2ecf20Sopenharmony_ci					struct ieee80211_vif *vif);
1048c2ecf20Sopenharmony_ciint ath5k_chan_set(struct ath5k_hw *ah, struct cfg80211_chan_def *chandef);
1058c2ecf20Sopenharmony_civoid ath5k_txbuf_free_skb(struct ath5k_hw *ah, struct ath5k_buf *bf);
1068c2ecf20Sopenharmony_civoid ath5k_rxbuf_free_skb(struct ath5k_hw *ah, struct ath5k_buf *bf);
1078c2ecf20Sopenharmony_civoid ath5k_tx_queue(struct ieee80211_hw *hw, struct sk_buff *skb,
1088c2ecf20Sopenharmony_ci		    struct ath5k_txq *txq, struct ieee80211_tx_control *control);
1098c2ecf20Sopenharmony_ci
1108c2ecf20Sopenharmony_ciconst char *ath5k_chip_name(enum ath5k_srev_type type, u_int16_t val);
1118c2ecf20Sopenharmony_ci
1128c2ecf20Sopenharmony_ciint ath5k_init_ah(struct ath5k_hw *ah, const struct ath_bus_ops *bus_ops);
1138c2ecf20Sopenharmony_civoid ath5k_deinit_ah(struct ath5k_hw *ah);
1148c2ecf20Sopenharmony_ci
1158c2ecf20Sopenharmony_ci/* Check whether BSSID mask is supported */
1168c2ecf20Sopenharmony_ci#define ath5k_hw_hasbssidmask(_ah) (ah->ah_version == AR5K_AR5212)
1178c2ecf20Sopenharmony_ci
1188c2ecf20Sopenharmony_ci/* Check whether virtual EOL is supported */
1198c2ecf20Sopenharmony_ci#define ath5k_hw_hasveol(_ah) (ah->ah_version != AR5K_AR5210)
1208c2ecf20Sopenharmony_ci
1218c2ecf20Sopenharmony_ci#endif	/* _DEV_ATH5K_BASE_H */
122