linux/drivers/net/wireless/broadcom/brcm80211/brcmsmac/pub.h

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

#include <linux/bcma/bcma.h>
#include <brcmu_wifi.h>
#include "types.h"
#include "defs.h"

#define BRCMS_NUMRATES

/* phy types */
#define PHY_TYPE_A
#define PHY_TYPE_G
#define PHY_TYPE_N
#define PHY_TYPE_LP
#define PHY_TYPE_SSN
#define PHY_TYPE_LCN
#define PHY_TYPE_LCNXN
#define PHY_TYPE_HT

/* bw */
#define BRCMS_10_MHZ
#define BRCMS_20_MHZ
#define BRCMS_40_MHZ

#define BRCMS_RSSI_MINVAL
#define BRCMS_RSSI_NO_SIGNAL
#define BRCMS_RSSI_VERY_LOW
#define BRCMS_RSSI_LOW
#define BRCMS_RSSI_GOOD
#define BRCMS_RSSI_VERY_GOOD
#define BRCMS_RSSI_EXCELLENT

/* a large TX Power as an init value to factor out of min() calculations,
 * keep low enough to fit in an s8, units are .25 dBm
 */
#define BRCMS_TXPWR_MAX

/* rate related definitions */
#define BRCMS_RATE_FLAG
#define BRCMS_RATE_MASK

/* legacy rx Antenna diversity for SISO rates */
#define ANT_RX_DIV_FORCE_0
#define ANT_RX_DIV_FORCE_1
#define ANT_RX_DIV_START_1
#define ANT_RX_DIV_START_0
#define ANT_RX_DIV_ENABLE
/* default antdiv setting */
#define ANT_RX_DIV_DEF

/* legacy rx Antenna diversity for SISO rates */
/* Tx on antenna 0, "legacy term Main" */
#define ANT_TX_FORCE_0
/* Tx on antenna 1, "legacy term Aux" */
#define ANT_TX_FORCE_1
/* Tx on phy's last good Rx antenna */
#define ANT_TX_LAST_RX
/* driver's default tx antenna setting */
#define ANT_TX_DEF

/* Tx Chain values */
/* def bitmap of txchain */
#define TXCHAIN_DEF
/* default bitmap of tx chains for nphy */
#define TXCHAIN_DEF_NPHY
/* default bitmap of tx chains for nphy */
#define TXCHAIN_DEF_HTPHY
/* def bitmap of rxchain */
#define RXCHAIN_DEF
/* default bitmap of rx chains for nphy */
#define RXCHAIN_DEF_NPHY
/* default bitmap of rx chains for nphy */
#define RXCHAIN_DEF_HTPHY
/* no antenna switch */
#define ANTSWITCH_NONE
/* antenna switch on 4321CB2, 2of3 */
#define ANTSWITCH_TYPE_1
/* antenna switch on 4321MPCI, 2of3 */
#define ANTSWITCH_TYPE_2
/* antenna switch on 4322, 2of3 */
#define ANTSWITCH_TYPE_3

#define RXBUFSZ

#define MAX_STREAMS_SUPPORTED

struct brcm_rateset {};

struct brcms_c_rateset {};

/* All the HT-specific default advertised capabilities (including AMPDU)
 * should be grouped here at one place
 */
#define AMPDU_DEF_MPDU_DENSITY

/* wlc internal bss_info */
struct brcms_bss_info {};

#define MAC80211_PROMISC_BCNS
#define MAC80211_SCAN

/*
 * Public portion of common driver state structure.
 * The wlc handle points at this.
 */
struct brcms_pub {};

enum wlc_par_id {};

/***********************************************
 * Feature-related macros to optimize out code *
 * *********************************************
 */

#define ENAB_1x1
#define ENAB_2x2
#define ENAB_3x3
#define ENAB_4x4
#define SUPPORT_11N
#define SUPPORT_HT

/* WL11N Support */
#define AMPDU_AGG_HOST

/* network protection config */
#define BRCMS_PROT_G_SPEC
#define BRCMS_PROT_G_OVR
#define BRCMS_PROT_G_USER
#define BRCMS_PROT_OVERLAP
#define BRCMS_PROT_N_USER
#define BRCMS_PROT_N_CFG
#define BRCMS_PROT_N_CFG_OVR
#define BRCMS_PROT_N_NONGF
#define BRCMS_PROT_N_NONGF_OVR
#define BRCMS_PROT_N_PAM_OVR
#define BRCMS_PROT_N_OBSS

/*
 * 54g modes (basic bits may still be overridden)
 *
 * GMODE_LEGACY_B
 *	Rateset: 1b, 2b, 5.5, 11
 *	Preamble: Long
 *	Shortslot: Off
 * GMODE_AUTO
 *	Rateset: 1b, 2b, 5.5b, 11b, 18, 24, 36, 54
 *	Extended Rateset: 6, 9, 12, 48
 *	Preamble: Long
 *	Shortslot: Auto
 * GMODE_ONLY
 *	Rateset: 1b, 2b, 5.5b, 11b, 18, 24b, 36, 54
 *	Extended Rateset: 6b, 9, 12b, 48
 *	Preamble: Short required
 *	Shortslot: Auto
 * GMODE_B_DEFERRED
 *	Rateset: 1b, 2b, 5.5b, 11b, 18, 24, 36, 54
 *	Extended Rateset: 6, 9, 12, 48
 *	Preamble: Long
 *	Shortslot: On
 * GMODE_PERFORMANCE
 *	Rateset: 1b, 2b, 5.5b, 6b, 9, 11b, 12b, 18, 24b, 36, 48, 54
 *	Preamble: Short required
 *	Shortslot: On and required
 * GMODE_LRS
 *	Rateset: 1b, 2b, 5.5b, 11b
 *	Extended Rateset: 6, 9, 12, 18, 24, 36, 48, 54
 *	Preamble: Long
 *	Shortslot: Auto
 */
#define GMODE_LEGACY_B
#define GMODE_AUTO
#define GMODE_ONLY
#define GMODE_B_DEFERRED
#define GMODE_PERFORMANCE
#define GMODE_LRS
#define GMODE_MAX

/* MCS values greater than this enable multiple streams */
#define HIGHEST_SINGLE_STREAM_MCS

#define MAXBANDS

/* max number of antenna configurations */
#define ANT_SELCFG_MAX

struct brcms_antselcfg {};

/* common functions for every port */
struct brcms_c_info *brcms_c_attach(struct brcms_info *wl,
				    struct bcma_device *core, uint unit,
				    bool piomode, uint *perr);
uint brcms_c_detach(struct brcms_c_info *wlc);
int brcms_c_up(struct brcms_c_info *wlc);
uint brcms_c_down(struct brcms_c_info *wlc);

bool brcms_c_chipmatch(struct bcma_device *core);
void brcms_c_init(struct brcms_c_info *wlc, bool mute_tx);
void brcms_c_reset(struct brcms_c_info *wlc);

void brcms_c_intrson(struct brcms_c_info *wlc);
u32 brcms_c_intrsoff(struct brcms_c_info *wlc);
void brcms_c_intrsrestore(struct brcms_c_info *wlc, u32 macintmask);
bool brcms_c_intrsupd(struct brcms_c_info *wlc);
bool brcms_c_isr(struct brcms_c_info *wlc);
bool brcms_c_dpc(struct brcms_c_info *wlc, bool bounded);
bool brcms_c_sendpkt_mac80211(struct brcms_c_info *wlc, struct sk_buff *sdu,
			      struct ieee80211_hw *hw);
bool brcms_c_aggregatable(struct brcms_c_info *wlc, u8 tid);
void brcms_c_protection_upd(struct brcms_c_info *wlc, uint idx, int val);
int brcms_c_get_header_len(void);
void brcms_c_set_addrmatch(struct brcms_c_info *wlc, int match_reg_offset,
			   const u8 *addr);
void brcms_c_wme_setparams(struct brcms_c_info *wlc, u16 aci,
			   const struct ieee80211_tx_queue_params *arg,
			   bool suspend);
struct brcms_pub *brcms_c_pub(struct brcms_c_info *wlc);
void brcms_c_ampdu_flush(struct brcms_c_info *wlc, struct ieee80211_sta *sta,
			 u16 tid);
void brcms_c_ampdu_tx_operational(struct brcms_c_info *wlc, u8 tid,
				  uint max_rx_ampdu_bytes);
int brcms_c_module_register(struct brcms_pub *pub, const char *name,
			    struct brcms_info *hdl,
			    int (*down_fn)(void *handle));
int brcms_c_module_unregister(struct brcms_pub *pub, const char *name,
			      struct brcms_info *hdl);
void brcms_c_suspend_mac_and_wait(struct brcms_c_info *wlc);
void brcms_c_enable_mac(struct brcms_c_info *wlc);
void brcms_c_associate_upd(struct brcms_c_info *wlc, bool state);
void brcms_c_scan_start(struct brcms_c_info *wlc);
void brcms_c_scan_stop(struct brcms_c_info *wlc);
int brcms_c_get_curband(struct brcms_c_info *wlc);
int brcms_c_set_channel(struct brcms_c_info *wlc, u16 channel);
int brcms_c_set_rate_limit(struct brcms_c_info *wlc, u16 srl, u16 lrl);
void brcms_c_get_current_rateset(struct brcms_c_info *wlc,
				 struct brcm_rateset *currs);
int brcms_c_set_rateset(struct brcms_c_info *wlc, struct brcm_rateset *rs);
int brcms_c_set_beacon_period(struct brcms_c_info *wlc, u16 period);
u16 brcms_c_get_phy_type(struct brcms_c_info *wlc, int phyidx);
void brcms_c_set_shortslot_override(struct brcms_c_info *wlc,
				    s8 sslot_override);
void brcms_c_set_beacon_listen_interval(struct brcms_c_info *wlc, u8 interval);
u64 brcms_c_tsf_get(struct brcms_c_info *wlc);
void brcms_c_tsf_set(struct brcms_c_info *wlc, u64 tsf);
int brcms_c_set_tx_power(struct brcms_c_info *wlc, int txpwr);
int brcms_c_get_tx_power(struct brcms_c_info *wlc);
bool brcms_c_check_radio_disabled(struct brcms_c_info *wlc);
void brcms_c_mute(struct brcms_c_info *wlc, bool on);
bool brcms_c_tx_flush_completed(struct brcms_c_info *wlc);
void brcms_c_start_station(struct brcms_c_info *wlc, u8 *addr);
void brcms_c_start_ap(struct brcms_c_info *wlc, u8 *addr, const u8 *bssid,
		      u8 *ssid, size_t ssid_len);
void brcms_c_start_adhoc(struct brcms_c_info *wlc, u8 *addr);
void brcms_c_update_beacon(struct brcms_c_info *wlc);
void brcms_c_set_new_beacon(struct brcms_c_info *wlc, struct sk_buff *beacon,
			    u16 tim_offset, u16 dtim_period);
void brcms_c_set_new_probe_resp(struct brcms_c_info *wlc,
				struct sk_buff *probe_resp);
void brcms_c_enable_probe_resp(struct brcms_c_info *wlc, bool enable);
void brcms_c_set_ssid(struct brcms_c_info *wlc, u8 *ssid, size_t ssid_len);

#endif				/* _BRCM_PUB_H_ */