linux/drivers/net/wireless/ath/ath9k/htc.h

/*
 * Copyright (c) 2010-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 HTC_H
#define HTC_H

#include <linux/module.h>
#include <linux/usb.h>
#include <linux/firmware.h>
#include <linux/skbuff.h>
#include <linux/netdevice.h>
#include <linux/etherdevice.h>
#include <linux/leds.h>
#include <linux/slab.h>
#include <net/mac80211.h>

#include "common.h"
#include "htc_hst.h"
#include "hif_usb.h"
#include "wmi.h"

#define ATH_STA_SHORT_CALINTERVAL
#define ATH_AP_SHORT_CALINTERVAL
#define ATH_ANI_POLLINTERVAL
#define ATH_LONG_CALINTERVAL
#define ATH_RESTART_CALINTERVAL

#define ATH_DEFAULT_BMISS_LIMIT
#define TSF_TO_TU(_h, _l)

extern struct ieee80211_ops ath9k_htc_ops;
extern int htc_modparam_nohwcrypt;
#ifdef CONFIG_MAC80211_LEDS
extern int ath9k_htc_led_blink;
#endif

enum htc_phymode {};

enum htc_opmode {};

#define ATH9K_HTC_AMPDU
#define ATH9K_HTC_NORMAL
#define ATH9K_HTC_BEACON
#define ATH9K_HTC_MGMT

#define ATH9K_HTC_TX_CTSONLY
#define ATH9K_HTC_TX_RTSCTS

struct tx_frame_hdr {} __packed;

struct tx_mgmt_hdr {} __packed;

struct tx_beacon_header {} __packed;

#define MAX_TX_AMPDU_SUBFRAMES_9271
#define MAX_TX_AMPDU_SUBFRAMES_7010

struct ath9k_htc_cap_target {} __packed;

struct ath9k_htc_target_vif {} __packed;

struct ath9k_htc_target_sta {} __packed;

struct ath9k_htc_target_aggr {} __packed;

#define ATH_HTC_RATE_MAX

#define WLAN_RC_DS_FLAG
#define WLAN_RC_40_FLAG
#define WLAN_RC_SGI_FLAG
#define WLAN_RC_HT_FLAG
#define ATH_RC_TX_STBC_FLAG

struct ath9k_htc_rateset {};

struct ath9k_htc_rate {} __packed;

struct ath9k_htc_target_rate {};

struct ath9k_htc_target_rate_mask {} __packed;

struct ath9k_htc_target_int_stats {} __packed;

struct ath9k_htc_target_tx_stats {} __packed;

struct ath9k_htc_target_rx_stats {} __packed;

#define ATH9K_HTC_MAX_VIF
#define ATH9K_HTC_MAX_BCN_VIF

#define INC_VIF(_priv, _type)

#define DEC_VIF(_priv, _type)

struct ath9k_htc_vif {};

struct ath9k_vif_iter_data {};

#define ATH9K_HTC_MAX_STA
#define ATH9K_HTC_MAX_TID

enum tid_aggr_state {};

struct ath9k_htc_sta {};

#define ATH9K_HTC_RXBUF
#define HTC_RX_FRAME_HEADER_SIZE

struct ath9k_htc_rxbuf {};

struct ath9k_htc_rx {};

#define ATH9K_HTC_TX_CLEANUP_INTERVAL
#define ATH9K_HTC_TX_TIMEOUT_INTERVAL
#define ATH9K_HTC_TX_RESERVE
#define ATH9K_HTC_TX_TIMEOUT_COUNT
#define ATH9K_HTC_TX_THRESHOLD

#define ATH9K_HTC_OP_TX_QUEUES_STOP
#define ATH9K_HTC_OP_TX_DRAIN

struct ath9k_htc_tx {};

struct ath9k_htc_tx_ctl {};

static inline struct ath9k_htc_tx_ctl *HTC_SKB_CB(struct sk_buff *skb)
{}

#ifdef CONFIG_ATH9K_HTC_DEBUGFS
#define __STAT_SAFE(hif_dev, expr)
#define CAB_STAT_INC(priv)
#define TX_QSTAT_INC(priv, q)

#define TX_STAT_INC(hif_dev, c)
#define TX_STAT_ADD(hif_dev, c, a)
#define RX_STAT_INC(hif_dev, c)
#define RX_STAT_ADD(hif_dev, c, a)

void ath9k_htc_err_stat_rx(struct ath9k_htc_priv *priv,
			   struct ath_rx_status *rs);

struct ath_tx_stats {};

struct ath_skbrx_stats {};

struct ath9k_debug {};

void ath9k_htc_get_et_strings(struct ieee80211_hw *hw,
			      struct ieee80211_vif *vif,
			      u32 sset, u8 *data);
int ath9k_htc_get_et_sset_count(struct ieee80211_hw *hw,
				struct ieee80211_vif *vif, int sset);
void ath9k_htc_get_et_stats(struct ieee80211_hw *hw,
			    struct ieee80211_vif *vif,
			    struct ethtool_stats *stats, u64 *data);
#else

#define TX_STAT_INC
#define TX_STAT_ADD
#define RX_STAT_INC
#define RX_STAT_ADD

#define CAB_STAT_INC
#define TX_QSTAT_INC

static inline void ath9k_htc_err_stat_rx(struct ath9k_htc_priv *priv,
					 struct ath_rx_status *rs)
{
}

#endif /* CONFIG_ATH9K_HTC_DEBUGFS */

#define ATH_LED_PIN_DEF
#define ATH_LED_PIN_9287
#define ATH_LED_PIN_9271
#define ATH_LED_PIN_7010

#define BSTUCK_THRESHOLD

/*
 * Adjust these when the max. no of beaconing interfaces is
 * increased.
 */
#define DEFAULT_SWBA_RESPONSE
#define MIN_SWBA_RESPONSE

struct htc_beacon {};

struct ath_btcoex {};

#ifdef CONFIG_ATH9K_BTCOEX_SUPPORT
void ath9k_htc_init_btcoex(struct ath9k_htc_priv *priv, char *product);
void ath9k_htc_start_btcoex(struct ath9k_htc_priv *priv);
void ath9k_htc_stop_btcoex(struct ath9k_htc_priv *priv);
#else
static inline void ath9k_htc_init_btcoex(struct ath9k_htc_priv *priv, char *product)
{
}
static inline void ath9k_htc_start_btcoex(struct ath9k_htc_priv *priv)
{
}
static inline void ath9k_htc_stop_btcoex(struct ath9k_htc_priv *priv)
{
}
#endif /* CONFIG_ATH9K_BTCOEX_SUPPORT */

#define OP_BT_PRIORITY_DETECTED
#define OP_BT_SCAN
#define OP_TSF_RESET

enum htc_op_flags {};

struct ath9k_htc_priv {};

static inline void ath_read_cachesize(struct ath_common *common, int *csz)
{}

void ath9k_htc_reset(struct ath9k_htc_priv *priv);

void ath9k_htc_assign_bslot(struct ath9k_htc_priv *priv,
			    struct ieee80211_vif *vif);
void ath9k_htc_remove_bslot(struct ath9k_htc_priv *priv,
			    struct ieee80211_vif *vif);
void ath9k_htc_set_tsfadjust(struct ath9k_htc_priv *priv,
			     struct ieee80211_vif *vif);
void ath9k_htc_beaconq_config(struct ath9k_htc_priv *priv);
void ath9k_htc_beacon_config(struct ath9k_htc_priv *priv,
			     struct ieee80211_vif *vif);
void ath9k_htc_beacon_reconfig(struct ath9k_htc_priv *priv);
void ath9k_htc_swba(struct ath9k_htc_priv *priv,
		    struct wmi_event_swba *swba);

void ath9k_htc_rxep(void *priv, struct sk_buff *skb,
		    enum htc_endpoint_id ep_id);
void ath9k_htc_txep(void *priv, struct sk_buff *skb, enum htc_endpoint_id ep_id,
		    bool txok);
void ath9k_htc_beaconep(void *drv_priv, struct sk_buff *skb,
			enum htc_endpoint_id ep_id, bool txok);

int ath9k_htc_update_cap_target(struct ath9k_htc_priv *priv,
				u8 enable_coex);
void ath9k_htc_ani_work(struct work_struct *work);
void ath9k_htc_start_ani(struct ath9k_htc_priv *priv);
void ath9k_htc_stop_ani(struct ath9k_htc_priv *priv);

int ath9k_tx_init(struct ath9k_htc_priv *priv);
int ath9k_htc_tx_start(struct ath9k_htc_priv *priv,
		       struct ieee80211_sta *sta,
		       struct sk_buff *skb, u8 slot, bool is_cab);
void ath9k_tx_cleanup(struct ath9k_htc_priv *priv);
bool ath9k_htc_txq_setup(struct ath9k_htc_priv *priv, int subtype);
int ath9k_htc_cabq_setup(struct ath9k_htc_priv *priv);
int get_hw_qnum(u16 queue, int *hwq_map);
int ath_htc_txq_update(struct ath9k_htc_priv *priv, int qnum,
		       struct ath9k_tx_queue_info *qinfo);
void ath9k_htc_check_stop_queues(struct ath9k_htc_priv *priv);
void ath9k_htc_check_wake_queues(struct ath9k_htc_priv *priv);
int ath9k_htc_tx_get_slot(struct ath9k_htc_priv *priv);
void ath9k_htc_tx_clear_slot(struct ath9k_htc_priv *priv, int slot);
void ath9k_htc_tx_drain(struct ath9k_htc_priv *priv);
void ath9k_htc_txstatus(struct ath9k_htc_priv *priv, void *wmi_event);
void ath9k_tx_failed_tasklet(struct tasklet_struct *t);
void ath9k_htc_tx_cleanup_timer(struct timer_list *t);
bool ath9k_htc_csa_is_finished(struct ath9k_htc_priv *priv);

int ath9k_rx_init(struct ath9k_htc_priv *priv);
void ath9k_rx_cleanup(struct ath9k_htc_priv *priv);
void ath9k_host_rx_init(struct ath9k_htc_priv *priv);
void ath9k_rx_tasklet(struct tasklet_struct *t);
u32 ath9k_htc_calcrxfilter(struct ath9k_htc_priv *priv);

void ath9k_htc_ps_wakeup(struct ath9k_htc_priv *priv);
void ath9k_htc_ps_restore(struct ath9k_htc_priv *priv);
void ath9k_ps_work(struct work_struct *work);
bool ath9k_htc_setpower(struct ath9k_htc_priv *priv,
			enum ath9k_power_mode mode);

void ath9k_start_rfkill_poll(struct ath9k_htc_priv *priv);
void ath9k_htc_rfkill_poll_state(struct ieee80211_hw *hw);

struct base_eep_header *ath9k_htc_get_eeprom_base(struct ath9k_htc_priv *priv);

#ifdef CONFIG_MAC80211_LEDS
void ath9k_configure_leds(struct ath9k_htc_priv *priv);
void ath9k_init_leds(struct ath9k_htc_priv *priv);
void ath9k_deinit_leds(struct ath9k_htc_priv *priv);
void ath9k_led_work(struct work_struct *work);
#else
static inline void ath9k_configure_leds(struct ath9k_htc_priv *priv)
{
}

static inline void ath9k_init_leds(struct ath9k_htc_priv *priv)
{
}

static inline void ath9k_deinit_leds(struct ath9k_htc_priv *priv)
{
}

static inline void ath9k_led_work(struct work_struct *work)
{
}
#endif

int ath9k_htc_probe_device(struct htc_target *htc_handle, struct device *dev,
			   u16 devid, char *product, u32 drv_info);
void ath9k_htc_disconnect_device(struct htc_target *htc_handle, bool hotunplug);
#ifdef CONFIG_PM
void ath9k_htc_suspend(struct htc_target *htc_handle);
int ath9k_htc_resume(struct htc_target *htc_handle);
#endif
#ifdef CONFIG_ATH9K_HTC_DEBUGFS
int ath9k_htc_init_debug(struct ath_hw *ah);
void ath9k_htc_deinit_debug(struct ath9k_htc_priv *priv);
#else
static inline int ath9k_htc_init_debug(struct ath_hw *ah) { return 0; };
static inline void ath9k_htc_deinit_debug(struct ath9k_htc_priv *priv)
{
}
#endif /* CONFIG_ATH9K_HTC_DEBUGFS */

#endif /* HTC_H */