staging: r8188eu: Add files for new driver - part 28

This commit adds files include/rtw_mlme.h, include/rtw_mlme_ext.h,
include/rtw_mp.h, include/rtw_mp_ioctl.h, and include/rtw_mp_phy_regdef.h.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Larry Finger 2013-08-21 22:34:10 -05:00 committed by Greg Kroah-Hartman
parent 93dc9cc661
commit 4218e5be86
5 changed files with 3451 additions and 0 deletions

View File

@ -0,0 +1,655 @@
/******************************************************************************
*
* Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
*
*
******************************************************************************/
#ifndef __RTW_MLME_H_
#define __RTW_MLME_H_
#include <osdep_service.h>
#include <mlme_osdep.h>
#include <drv_types.h>
#include <wlan_bssdef.h>
#define MAX_BSS_CNT 128
#define MAX_JOIN_TIMEOUT 6500
/* Increase the scanning timeout because of increasing the SURVEY_TO value. */
#define SCANNING_TIMEOUT 8000
#define SCAN_INTERVAL (30) /* unit:2sec, 30*2=60sec */
#define SCANQUEUE_LIFETIME 20 /* unit:sec */
#define WIFI_NULL_STATE 0x00000000
#define WIFI_ASOC_STATE 0x00000001 /* Under Linked state */
#define WIFI_REASOC_STATE 0x00000002
#define WIFI_SLEEP_STATE 0x00000004
#define WIFI_STATION_STATE 0x00000008
#define WIFI_AP_STATE 0x00000010
#define WIFI_ADHOC_STATE 0x00000020
#define WIFI_ADHOC_MASTER_STATE 0x00000040
#define WIFI_UNDER_LINKING 0x00000080
#define WIFI_UNDER_WPS 0x00000100
#define WIFI_STA_ALIVE_CHK_STATE 0x00000400
#define WIFI_SITE_MONITOR 0x00000800 /* to indicate the station is under site surveying */
#define WIFI_MP_STATE 0x00010000
#define WIFI_MP_CTX_BACKGROUND 0x00020000 /* in continous tx background */
#define WIFI_MP_CTX_ST 0x00040000 /* in continous tx with single-tone */
#define WIFI_MP_CTX_BACKGROUND_PENDING 0x00080000 /* pending in continous tx background due to out of skb */
#define WIFI_MP_CTX_CCK_HW 0x00100000 /* in continous tx */
#define WIFI_MP_CTX_CCK_CS 0x00200000 /* in continous tx with carrier suppression */
#define WIFI_MP_LPBK_STATE 0x00400000
#define _FW_UNDER_LINKING WIFI_UNDER_LINKING
#define _FW_LINKED WIFI_ASOC_STATE
#define _FW_UNDER_SURVEY WIFI_SITE_MONITOR
enum dot11AuthAlgrthmNum {
dot11AuthAlgrthm_Open = 0,
dot11AuthAlgrthm_Shared,
dot11AuthAlgrthm_8021X,
dot11AuthAlgrthm_Auto,
dot11AuthAlgrthm_WAPI,
dot11AuthAlgrthm_MaxNum
};
/* Scan type including active and passive scan. */
enum rt_scan_type {
SCAN_PASSIVE,
SCAN_ACTIVE,
SCAN_MIX,
};
enum SCAN_RESULT_TYPE {
SCAN_RESULT_P2P_ONLY = 0, /* Will return all the P2P devices. */
SCAN_RESULT_ALL = 1, /* Will return all the scanned device,
* include AP. */
SCAN_RESULT_WFD_TYPE = 2 /* Will just return the correct WFD
* device. */
/* If this device is Miracast sink
* device, it will just return all the
* Miracast source devices. */
};
/*
there are several "locks" in mlme_priv,
since mlme_priv is a shared resource between many threads,
like ISR/Call-Back functions, the OID handlers, and even timer functions.
Each _queue has its own locks, already.
Other items are protected by mlme_priv.lock.
To avoid possible dead lock, any thread trying to modifiying mlme_priv
SHALL not lock up more than one lock at a time!
*/
#define traffic_threshold 10
#define traffic_scan_period 500
struct sitesurvey_ctrl {
u64 last_tx_pkts;
uint last_rx_pkts;
int traffic_busy;
struct timer_list sitesurvey_ctrl_timer;
};
struct rt_link_detect {
u32 NumTxOkInPeriod;
u32 NumRxOkInPeriod;
u32 NumRxUnicastOkInPeriod;
bool bBusyTraffic;
bool bTxBusyTraffic;
bool bRxBusyTraffic;
bool bHigherBusyTraffic; /* For interrupt migration purpose. */
bool bHigherBusyRxTraffic; /* We may disable Tx interrupt according
* to Rx traffic. */
bool bHigherBusyTxTraffic; /* We may disable Tx interrupt according
* to Tx traffic. */
};
struct profile_info {
u8 ssidlen;
u8 ssid[ WLAN_SSID_MAXLEN ];
u8 peermac[ ETH_ALEN ];
};
struct tx_invite_req_info {
u8 token;
u8 benable;
u8 go_ssid[ WLAN_SSID_MAXLEN ];
u8 ssidlen;
u8 go_bssid[ ETH_ALEN ];
u8 peer_macaddr[ ETH_ALEN ];
u8 operating_ch; /* This information will be set by using the
* p2p_set op_ch=x */
u8 peer_ch; /* The listen channel for peer P2P device */
};
struct tx_invite_resp_info {
u8 token; /* Used to record the dialog token of p2p invitation
* request frame. */
};
struct tx_provdisc_req_info {
u16 wps_config_method_request; /* Used when sending the
* provisioning request frame*/
u16 peer_channel_num[2]; /* The channel number which the
* receiver stands. */
struct ndis_802_11_ssid ssid;
u8 peerDevAddr[ETH_ALEN]; /* Peer device address */
u8 peerIFAddr[ETH_ALEN]; /* Peer interface address */
u8 benable; /* This provision discovery
* request frame is trigger
* to send or not */
};
/* When peer device issue prov_disc_req first, we should store the following
* information */
/* The UI must know this information to know which config method the
* remote p2p device needs. */
struct rx_provdisc_req_info {
u8 peerDevAddr[ETH_ALEN]; /* Peer device address */
u8 strconfig_method_desc_of_prov_disc_req[4]; /* description
* for the config method located in the provisioning
* discovery request frame. */
};
struct tx_nego_req_info {
u16 peer_channel_num[2]; /* The channel number. */
u8 peerDevAddr[ETH_ALEN]; /* Peer device address */
u8 benable; /* This negotiation request frame is
* trigger to send or not */
};
struct group_id_info {
u8 go_device_addr[ ETH_ALEN ]; /* The GO's device address of
* this P2P group */
u8 ssid[ WLAN_SSID_MAXLEN ]; /* The SSID of this P2P group */
};
struct scan_limit_info {
u8 scan_op_ch_only; /* When this flag is set, the driver
* should only scan the op. channel */
u8 operation_ch[2]; /* Store the op. chan of invitation */
};
struct wifidirect_info {
struct adapter *padapter;
struct timer_list find_phase_timer;
struct timer_list restore_p2p_state_timer;
/* Used to do the scanning. After confirming the peer is availalble,
* the driver transmits the P2P frame to peer. */
struct timer_list pre_tx_scan_timer;
struct timer_list reset_ch_sitesurvey;
struct timer_list reset_ch_sitesurvey2; /* Just for resetting the scan
* limit function by using p2p nego */
struct tx_provdisc_req_info tx_prov_disc_info;
struct rx_provdisc_req_info rx_prov_disc_info;
struct tx_invite_req_info invitereq_info;
/* Store the profile information of persistent group */
struct profile_info profileinfo[P2P_MAX_PERSISTENT_GROUP_NUM];
struct tx_invite_resp_info inviteresp_info;
struct tx_nego_req_info nego_req_info;
/* Store the group id info when doing the group negot handshake. */
struct group_id_info groupid_info;
/* Used for get the limit scan channel from the Invitation procedure */
struct scan_limit_info rx_invitereq_info;
/* Used for get the limit scan chan from the P2P negotiation handshake*/
struct scan_limit_info p2p_info;
enum P2P_ROLE role;
enum P2P_STATE pre_p2p_state;
enum P2P_STATE p2p_state;
/* The device address should be the mac address of this device. */
u8 device_addr[ETH_ALEN];
u8 interface_addr[ETH_ALEN];
u8 social_chan[4];
u8 listen_channel;
u8 operating_channel;
u8 listen_dwell; /* This value should be between 1 and 3 */
u8 support_rate[8];
u8 p2p_wildcard_ssid[P2P_WILDCARD_SSID_LEN];
u8 intent; /* should only include the intent value. */
u8 p2p_peer_interface_addr[ETH_ALEN];
u8 p2p_peer_device_addr[ETH_ALEN];
u8 peer_intent; /* Included the intent value and tie breaker value. */
/* Device name for displaying on searching device screen */
u8 device_name[WPS_MAX_DEVICE_NAME_LEN];
u8 device_name_len;
u8 profileindex; /* Used to point to the index of profileinfo array */
u8 peer_operating_ch;
u8 find_phase_state_exchange_cnt;
/* The device password ID for group negotation */
u16 device_password_id_for_nego;
u8 negotiation_dialog_token;
/* SSID information for group negotitation */
u8 nego_ssid[WLAN_SSID_MAXLEN];
u8 nego_ssidlen;
u8 p2p_group_ssid[WLAN_SSID_MAXLEN];
u8 p2p_group_ssid_len;
/* Flag to know if the persistent function should be supported or not.*/
u8 persistent_supported;
/* In the Sigma test, the Sigma will provide this enable from the
* sta_set_p2p CAPI. */
/* 0: disable */
/* 1: enable */
u8 session_available; /* Flag to set the WFD session available to
* enable or disable "by Sigma" */
/* In the Sigma test, the Sigma will disable the session available
* by using the sta_preset CAPI. */
/* 0: disable */
/* 1: enable */
u8 wfd_tdls_enable; /* Flag to enable or disable the TDLS by WFD Sigma*/
/* 0: disable */
/* 1: enable */
u8 wfd_tdls_weaksec; /* Flag to enable or disable the weak security
* function for TDLS by WFD Sigma */
/* 0: disable */
/* In this case, the driver can't issue the tdsl
* setup request frame. */
/* 1: enable */
/* In this case, the driver can issue the tdls
* setup request frame */
/* even the current security is weak security. */
/* This field will store the WPS value (PIN value or PBC) that UI had
* got from the user. */
enum P2P_WPSINFO ui_got_wps_info;
u16 supported_wps_cm; /* This field describes the WPS config method
* which this driver supported. */
/* The value should be the combination of config
* method defined in page104 of WPS v2.0 spec.*/
/* This field will contain the length of body of P2P Channel List
* attribute of group negotiation response frame. */
uint channel_list_attr_len;
/* This field will contain the body of P2P Channel List attribute of
* group negotitation response frame. */
/* We will use the channel_cnt and channel_list fields when constructing
* the group negotiation confirm frame. */
u8 channel_list_attr[100];
enum P2P_PS_MODE p2p_ps_mode; /* indicate p2p ps mode */
enum P2P_PS_STATE p2p_ps_state; /* indicate p2p ps state */
u8 noa_index; /* Identifies and instance of Notice of Absence timing. */
u8 ctwindow; /* Client traffic window. A period of time in TU after TBTT. */
u8 opp_ps; /* opportunistic power save. */
u8 noa_num; /* number of NoA descriptor in P2P IE. */
u8 noa_count[P2P_MAX_NOA_NUM]; /* Count for owner, Type of client. */
/* Max duration for owner, preferred or min acceptable duration for
* client. */
u32 noa_duration[P2P_MAX_NOA_NUM];
/* Length of interval for owner, preferred or max acceptable interval
* of client. */
u32 noa_interval[P2P_MAX_NOA_NUM];
/* schedule expressed in terms of the lower 4 bytes of the TSF timer. */
u32 noa_start_time[P2P_MAX_NOA_NUM];
};
struct tdls_ss_record { /* signal strength record */
u8 macaddr[ETH_ALEN];
u8 RxPWDBAll;
u8 is_tdls_sta; /* true: direct link sta, false: else */
};
struct tdls_info {
u8 ap_prohibited;
uint setup_state;
u8 sta_cnt;
u8 sta_maximum; /* 1:tdls sta is equal (NUM_STA-1), reach max direct link number; 0: else; */
struct tdls_ss_record ss_record;
u8 macid_index; /* macid entry that is ready to write */
u8 clear_cam; /* cam entry that is trying to clear, using it in direct link teardown */
u8 ch_sensing;
u8 cur_channel;
u8 candidate_ch;
u8 collect_pkt_num[MAX_CHANNEL_NUM];
spinlock_t cmd_lock;
spinlock_t hdl_lock;
u8 watchdog_count;
u8 dev_discovered; /* WFD_TDLS: for sigma test */
u8 enable;
};
struct mlme_priv {
spinlock_t lock;
int fw_state; /* shall we protect this variable? maybe not necessarily... */
u8 bScanInProcess;
u8 to_join; /* flag */
u8 to_roaming; /* roaming trying times */
u8 *nic_hdl;
u8 not_indic_disco;
struct list_head *pscanned;
struct __queue free_bss_pool;
struct __queue scanned_queue;
u8 *free_bss_buf;
u32 num_of_scanned;
struct ndis_802_11_ssid assoc_ssid;
u8 assoc_bssid[6];
struct wlan_network cur_network;
u32 scan_interval;
struct timer_list assoc_timer;
uint assoc_by_bssid;
uint assoc_by_rssi;
struct timer_list scan_to_timer; /* driver itself handles scan_timeout status. */
u32 scan_start_time; /* used to evaluate the time spent in scanning */
struct qos_priv qospriv;
/* Number of non-HT AP/stations */
int num_sta_no_ht;
/* Number of HT AP/stations 20 MHz */
/* int num_sta_ht_20mhz; */
int num_FortyMHzIntolerant;
struct ht_priv htpriv;
struct rt_link_detect LinkDetectInfo;
struct timer_list dynamic_chk_timer; /* dynamic/periodic check timer */
u8 key_mask; /* use for ips to set wep key after ips_leave */
u8 acm_mask; /* for wmm acm mask */
u8 ChannelPlan;
enum rt_scan_type scan_mode; /* active: 1, passive: 0 */
/* u8 probereq_wpsie[MAX_WPS_IE_LEN];added in probe req */
/* int probereq_wpsie_len; */
u8 *wps_probe_req_ie;
u32 wps_probe_req_ie_len;
u8 *assoc_req;
u32 assoc_req_len;
u8 *assoc_rsp;
u32 assoc_rsp_len;
#if defined (CONFIG_88EU_AP_MODE)
/* Number of associated Non-ERP stations (i.e., stations using 802.11b
* in 802.11g BSS) */
int num_sta_non_erp;
/* Number of associated stations that do not support Short Slot Time */
int num_sta_no_short_slot_time;
/* Number of associated stations that do not support Short Preamble */
int num_sta_no_short_preamble;
int olbc; /* Overlapping Legacy BSS Condition */
/* Number of HT assoc sta that do not support greenfield */
int num_sta_ht_no_gf;
/* Number of associated non-HT stations */
/* int num_sta_no_ht; */
/* Number of HT associated stations 20 MHz */
int num_sta_ht_20mhz;
/* Overlapping BSS information */
int olbc_ht;
u16 ht_op_mode;
u8 *wps_beacon_ie;
/* u8 *wps_probe_req_ie; */
u8 *wps_probe_resp_ie;
u8 *wps_assoc_resp_ie;
u32 wps_beacon_ie_len;
u32 wps_probe_resp_ie_len;
u32 wps_assoc_resp_ie_len;
u8 *p2p_beacon_ie;
u8 *p2p_probe_req_ie;
u8 *p2p_probe_resp_ie;
u8 *p2p_go_probe_resp_ie; /* for GO */
u8 *p2p_assoc_req_ie;
u32 p2p_beacon_ie_len;
u32 p2p_probe_req_ie_len;
u32 p2p_probe_resp_ie_len;
u32 p2p_go_probe_resp_ie_len; /* for GO */
u32 p2p_assoc_req_ie_len;
spinlock_t bcn_update_lock;
u8 update_bcn;
#endif /* if defined (CONFIG_88EU_AP_MODE) */
};
#ifdef CONFIG_88EU_AP_MODE
struct hostapd_priv {
struct adapter *padapter;
};
int hostapd_mode_init(struct adapter *padapter);
void hostapd_mode_unload(struct adapter *padapter);
#endif
extern unsigned char WPA_TKIP_CIPHER[4];
extern unsigned char RSN_TKIP_CIPHER[4];
extern unsigned char REALTEK_96B_IE[];
extern unsigned char MCS_rate_2R[16];
extern unsigned char MCS_rate_1R[16];
void rtw_joinbss_event_prehandle(struct adapter *adapter, u8 *pbuf);
void rtw_survey_event_callback(struct adapter *adapter, u8 *pbuf);
void rtw_surveydone_event_callback(struct adapter *adapter, u8 *pbuf);
void rtw_joinbss_event_callback(struct adapter *adapter, u8 *pbuf);
void rtw_stassoc_event_callback(struct adapter *adapter, u8 *pbuf);
void rtw_stadel_event_callback(struct adapter *adapter, u8 *pbuf);
void rtw_atimdone_event_callback(struct adapter *adapter, u8 *pbuf);
void rtw_cpwm_event_callback(struct adapter *adapter, u8 *pbuf);
void indicate_wx_scan_complete_event(struct adapter *padapter);
void rtw_indicate_wx_assoc_event(struct adapter *padapter);
void rtw_indicate_wx_disassoc_event(struct adapter *padapter);
int event_thread(void *context);
void rtw_join_timeout_handler(void *FunctionContext);
void _rtw_scan_timeout_handler(void *FunctionContext);
void rtw_free_network_queue(struct adapter *adapter, u8 isfreeall);
int rtw_init_mlme_priv(struct adapter *adapter);
void rtw_free_mlme_priv (struct mlme_priv *pmlmepriv);
int rtw_select_and_join_from_scanned_queue(struct mlme_priv *pmlmepriv);
int rtw_set_key(struct adapter *adapter, struct security_priv *psecuritypriv,
int keyid, u8 set_tx);
int rtw_set_auth(struct adapter *adapter, struct security_priv *psecuritypriv);
static inline u8 *get_bssid(struct mlme_priv *pmlmepriv)
{ /* if sta_mode:pmlmepriv->cur_network.network.MacAddress=> bssid */
/* if adhoc_mode:pmlmepriv->cur_network.network.MacAddress=> ibss mac address */
return pmlmepriv->cur_network.network.MacAddress;
}
static inline int check_fwstate(struct mlme_priv *pmlmepriv, int state)
{
if (pmlmepriv->fw_state & state)
return true;
return false;
}
static inline int get_fwstate(struct mlme_priv *pmlmepriv)
{
return pmlmepriv->fw_state;
}
/*
* No Limit on the calling context,
* therefore set it to be the critical section...
*
* ### NOTE:#### (!!!!)
* MUST TAKE CARE THAT BEFORE CALLING THIS FUNC, YOU SHOULD HAVE LOCKED pmlmepriv->lock
*/
static inline void set_fwstate(struct mlme_priv *pmlmepriv, int state)
{
pmlmepriv->fw_state |= state;
/* FOR HW integration */
if (_FW_UNDER_SURVEY==state)
pmlmepriv->bScanInProcess = true;
}
static inline void _clr_fwstate_(struct mlme_priv *pmlmepriv, int state)
{
pmlmepriv->fw_state &= ~state;
/* FOR HW integration */
if (_FW_UNDER_SURVEY==state)
pmlmepriv->bScanInProcess = false;
}
/*
* No Limit on the calling context,
* therefore set it to be the critical section...
*/
static inline void clr_fwstate(struct mlme_priv *pmlmepriv, int state)
{
unsigned long irql;
_enter_critical_bh(&pmlmepriv->lock, &irql);
if (check_fwstate(pmlmepriv, state) == true)
pmlmepriv->fw_state ^= state;
_exit_critical_bh(&pmlmepriv->lock, &irql);
}
static inline void clr_fwstate_ex(struct mlme_priv *pmlmepriv, int state)
{
unsigned long irql;
_enter_critical_bh(&pmlmepriv->lock, &irql);
_clr_fwstate_(pmlmepriv, state);
_exit_critical_bh(&pmlmepriv->lock, &irql);
}
static inline void up_scanned_network(struct mlme_priv *pmlmepriv)
{
unsigned long irql;
_enter_critical_bh(&pmlmepriv->lock, &irql);
pmlmepriv->num_of_scanned++;
_exit_critical_bh(&pmlmepriv->lock, &irql);
}
static inline void down_scanned_network(struct mlme_priv *pmlmepriv)
{
unsigned long irql;
_enter_critical_bh(&pmlmepriv->lock, &irql);
pmlmepriv->num_of_scanned--;
_exit_critical_bh(&pmlmepriv->lock, &irql);
}
static inline void set_scanned_network_val(struct mlme_priv *pmlmepriv, int val)
{
unsigned long irql;
_enter_critical_bh(&pmlmepriv->lock, &irql);
pmlmepriv->num_of_scanned = val;
_exit_critical_bh(&pmlmepriv->lock, &irql);
}
u16 rtw_get_capability(struct wlan_bssid_ex *bss);
void rtw_update_scanned_network(struct adapter *adapter,
struct wlan_bssid_ex *target);
void rtw_disconnect_hdl_under_linked(struct adapter *adapter,
struct sta_info *psta, u8 free_assoc);
void rtw_generate_random_ibss(u8 *pibss);
struct wlan_network *rtw_find_network(struct __queue *scanned_queue, u8 *addr);
struct wlan_network *rtw_get_oldest_wlan_network(struct __queue *scanned_queue);
void rtw_free_assoc_resources(struct adapter *adapter, int lock_scanned_queue);
void rtw_indicate_disconnect(struct adapter *adapter);
void rtw_indicate_connect(struct adapter *adapter);
void rtw_indicate_scan_done( struct adapter *padapter, bool aborted);
void rtw_scan_abort(struct adapter *adapter);
int rtw_restruct_sec_ie(struct adapter *adapter, u8 *in_ie, u8 *out_ie,
uint in_len);
int rtw_restruct_wmm_ie(struct adapter *adapter, u8 *in_ie, u8 *out_ie,
uint in_len, uint initial_out_len);
void rtw_init_registrypriv_dev_network(struct adapter *adapter);
void rtw_update_registrypriv_dev_network(struct adapter *adapter);
void rtw_get_encrypt_decrypt_from_registrypriv(struct adapter *adapter);
void _rtw_join_timeout_handler(struct adapter *adapter);
void rtw_scan_timeout_handler(struct adapter *adapter);
void rtw_dynamic_check_timer_handlder(struct adapter *adapter);
#define rtw_is_scan_deny(adapter) false
#define rtw_clear_scan_deny(adapter) do {} while (0)
#define rtw_set_scan_deny_timer_hdl(adapter) do {} while (0)
#define rtw_set_scan_deny(adapter, ms) do {} while (0)
int _rtw_init_mlme_priv(struct adapter *padapter);
void rtw_free_mlme_priv_ie_data(struct mlme_priv *pmlmepriv);
void _rtw_free_mlme_priv(struct mlme_priv *pmlmepriv);
int _rtw_enqueue_network(struct __queue *queue, struct wlan_network *pnetwork);
struct wlan_network *_rtw_dequeue_network(struct __queue *queue);
struct wlan_network *_rtw_alloc_network(struct mlme_priv *pmlmepriv);
void _rtw_free_network(struct mlme_priv *pmlmepriv,
struct wlan_network *pnetwork, u8 isfreeall);
void _rtw_free_network_nolock(struct mlme_priv *pmlmepriv,
struct wlan_network *pnetwork);
struct wlan_network* _rtw_find_network(struct __queue *scanned_queue, u8 *addr);
void _rtw_free_network_queue(struct adapter *padapter, u8 isfreeall);
int rtw_if_up(struct adapter *padapter);
u8 *rtw_get_capability_from_ie(u8 *ie);
u8 *rtw_get_timestampe_from_ie(u8 *ie);
u8 *rtw_get_beacon_interval_from_ie(u8 *ie);
void rtw_joinbss_reset(struct adapter *padapter);
unsigned int rtw_restructure_ht_ie(struct adapter *padapter, u8 *in_ie,
u8 *out_ie, uint in_len, uint *pout_len);
void rtw_update_ht_cap(struct adapter *padapter, u8 *pie, uint ie_len);
void rtw_issue_addbareq_cmd(struct adapter *padapter,
struct xmit_frame *pxmitframe);
int rtw_is_same_ibss(struct adapter *adapter, struct wlan_network *pnetwork);
int is_same_network(struct wlan_bssid_ex *src, struct wlan_bssid_ex *dst);
void rtw_roaming(struct adapter *padapter, struct wlan_network *tgt_network);
void _rtw_roaming(struct adapter *padapter, struct wlan_network *tgt_network);
void rtw_stassoc_hw_rpt(struct adapter *adapter,struct sta_info *psta);
#endif /* __RTL871X_MLME_H_ */

View File

@ -0,0 +1,877 @@
/******************************************************************************
*
* Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
*
*
******************************************************************************/
#ifndef __RTW_MLME_EXT_H_
#define __RTW_MLME_EXT_H_
#include <osdep_service.h>
#include <drv_types.h>
#include <wlan_bssdef.h>
/* Commented by Albert 20101105 */
/* Increase the SURVEY_TO value from 100 to 150 ( 100ms to 150ms ) */
/* The Realtek 8188CE SoftAP will spend around 100ms to send the probe response after receiving the probe request. */
/* So, this driver tried to extend the dwell time for each scanning channel. */
/* This will increase the chance to receive the probe response from SoftAP. */
#define SURVEY_TO (100)
#define REAUTH_TO (300) /* 50) */
#define REASSOC_TO (300) /* 50) */
/* define DISCONNECT_TO (3000) */
#define ADDBA_TO (2000)
#define LINKED_TO (1) /* unit:2 sec, 1x2=2 sec */
#define REAUTH_LIMIT (4)
#define REASSOC_LIMIT (4)
#define READDBA_LIMIT (2)
#define ROAMING_LIMIT 8
#define DYNAMIC_FUNC_DISABLE (0x0)
/* ====== ODM_ABILITY_E ======== */
/* BB ODM section BIT 0-15 */
#define DYNAMIC_BB_DIG BIT(0)
#define DYNAMIC_BB_RA_MASK BIT(1)
#define DYNAMIC_BB_DYNAMIC_TXPWR BIT(2)
#define DYNAMIC_BB_BB_FA_CNT BIT(3)
#define DYNAMIC_BB_RSSI_MONITOR BIT(4)
#define DYNAMIC_BB_CCK_PD BIT(5)
#define DYNAMIC_BB_ANT_DIV BIT(6)
#define DYNAMIC_BB_PWR_SAVE BIT(7)
#define DYNAMIC_BB_PWR_TRA BIT(8)
#define DYNAMIC_BB_RATE_ADAPTIVE BIT(9)
#define DYNAMIC_BB_PATH_DIV BIT(10)
#define DYNAMIC_BB_PSD BIT(11)
/* MAC DM section BIT 16-23 */
#define DYNAMIC_MAC_EDCA_TURBO BIT(16)
#define DYNAMIC_MAC_EARLY_MODE BIT(17)
/* RF ODM section BIT 24-31 */
#define DYNAMIC_RF_TX_PWR_TRACK BIT(24)
#define DYNAMIC_RF_RX_GAIN_TRACK BIT(25)
#define DYNAMIC_RF_CALIBRATION BIT(26)
#define DYNAMIC_ALL_FUNC_ENABLE 0xFFFFFFF
#define _HW_STATE_NOLINK_ 0x00
#define _HW_STATE_ADHOC_ 0x01
#define _HW_STATE_STATION_ 0x02
#define _HW_STATE_AP_ 0x03
#define _1M_RATE_ 0
#define _2M_RATE_ 1
#define _5M_RATE_ 2
#define _11M_RATE_ 3
#define _6M_RATE_ 4
#define _9M_RATE_ 5
#define _12M_RATE_ 6
#define _18M_RATE_ 7
#define _24M_RATE_ 8
#define _36M_RATE_ 9
#define _48M_RATE_ 10
#define _54M_RATE_ 11
extern unsigned char RTW_WPA_OUI[];
extern unsigned char WMM_OUI[];
extern unsigned char WPS_OUI[];
extern unsigned char WFD_OUI[];
extern unsigned char P2P_OUI[];
extern unsigned char WMM_INFO_OUI[];
extern unsigned char WMM_PARA_OUI[];
/* Channel Plan Type. */
/* Note: */
/* We just add new channel plan when the new channel plan is different
* from any of the following channel plan. */
/* If you just wnat to customize the acitions(scan period or join actions)
* about one of the channel plan, */
/* customize them in struct rt_channel_info in the RT_CHANNEL_LIST. */
enum RT_CHANNEL_DOMAIN {
/* old channel plan mapping ===== */
RT_CHANNEL_DOMAIN_FCC = 0x00,
RT_CHANNEL_DOMAIN_IC = 0x01,
RT_CHANNEL_DOMAIN_ETSI = 0x02,
RT_CHANNEL_DOMAIN_SPAIN = 0x03,
RT_CHANNEL_DOMAIN_FRANCE = 0x04,
RT_CHANNEL_DOMAIN_MKK = 0x05,
RT_CHANNEL_DOMAIN_MKK1 = 0x06,
RT_CHANNEL_DOMAIN_ISRAEL = 0x07,
RT_CHANNEL_DOMAIN_TELEC = 0x08,
RT_CHANNEL_DOMAIN_GLOBAL_DOAMIN = 0x09,
RT_CHANNEL_DOMAIN_WORLD_WIDE_13 = 0x0A,
RT_CHANNEL_DOMAIN_TAIWAN = 0x0B,
RT_CHANNEL_DOMAIN_CHINA = 0x0C,
RT_CHANNEL_DOMAIN_SINGAPORE_INDIA_MEXICO = 0x0D,
RT_CHANNEL_DOMAIN_KOREA = 0x0E,
RT_CHANNEL_DOMAIN_TURKEY = 0x0F,
RT_CHANNEL_DOMAIN_JAPAN = 0x10,
RT_CHANNEL_DOMAIN_FCC_NO_DFS = 0x11,
RT_CHANNEL_DOMAIN_JAPAN_NO_DFS = 0x12,
RT_CHANNEL_DOMAIN_WORLD_WIDE_5G = 0x13,
RT_CHANNEL_DOMAIN_TAIWAN_NO_DFS = 0x14,
/* new channel plan mapping, (2GDOMAIN_5GDOMAIN) ===== */
RT_CHANNEL_DOMAIN_WORLD_NULL = 0x20,
RT_CHANNEL_DOMAIN_ETSI1_NULL = 0x21,
RT_CHANNEL_DOMAIN_FCC1_NULL = 0x22,
RT_CHANNEL_DOMAIN_MKK1_NULL = 0x23,
RT_CHANNEL_DOMAIN_ETSI2_NULL = 0x24,
RT_CHANNEL_DOMAIN_FCC1_FCC1 = 0x25,
RT_CHANNEL_DOMAIN_WORLD_ETSI1 = 0x26,
RT_CHANNEL_DOMAIN_MKK1_MKK1 = 0x27,
RT_CHANNEL_DOMAIN_WORLD_KCC1 = 0x28,
RT_CHANNEL_DOMAIN_WORLD_FCC2 = 0x29,
RT_CHANNEL_DOMAIN_WORLD_FCC3 = 0x30,
RT_CHANNEL_DOMAIN_WORLD_FCC4 = 0x31,
RT_CHANNEL_DOMAIN_WORLD_FCC5 = 0x32,
RT_CHANNEL_DOMAIN_WORLD_FCC6 = 0x33,
RT_CHANNEL_DOMAIN_FCC1_FCC7 = 0x34,
RT_CHANNEL_DOMAIN_WORLD_ETSI2 = 0x35,
RT_CHANNEL_DOMAIN_WORLD_ETSI3 = 0x36,
RT_CHANNEL_DOMAIN_MKK1_MKK2 = 0x37,
RT_CHANNEL_DOMAIN_MKK1_MKK3 = 0x38,
RT_CHANNEL_DOMAIN_FCC1_NCC1 = 0x39,
RT_CHANNEL_DOMAIN_FCC1_NCC2 = 0x40,
RT_CHANNEL_DOMAIN_GLOBAL_DOAMIN_2G = 0x41,
/* Add new channel plan above this line=============== */
RT_CHANNEL_DOMAIN_MAX,
RT_CHANNEL_DOMAIN_REALTEK_DEFINE = 0x7F,
};
enum RT_CHANNEL_DOMAIN_2G {
RT_CHANNEL_DOMAIN_2G_WORLD = 0x00, /* Worldwide 13 */
RT_CHANNEL_DOMAIN_2G_ETSI1 = 0x01, /* Europe */
RT_CHANNEL_DOMAIN_2G_FCC1 = 0x02, /* US */
RT_CHANNEL_DOMAIN_2G_MKK1 = 0x03, /* Japan */
RT_CHANNEL_DOMAIN_2G_ETSI2 = 0x04, /* France */
RT_CHANNEL_DOMAIN_2G_NULL = 0x05,
/* Add new channel plan above this line=============== */
RT_CHANNEL_DOMAIN_2G_MAX,
};
#define rtw_is_channel_plan_valid(chplan) \
(chplan < RT_CHANNEL_DOMAIN_MAX || \
chplan == RT_CHANNEL_DOMAIN_REALTEK_DEFINE)
struct rt_channel_plan {
unsigned char Channel[MAX_CHANNEL_NUM];
unsigned char Len;
};
struct rt_channel_plan_2g {
unsigned char Channel[MAX_CHANNEL_NUM_2G];
unsigned char Len;
};
struct rt_channel_plan_map {
unsigned char Index2G;
};
enum Associated_AP {
atherosAP = 0,
broadcomAP = 1,
ciscoAP = 2,
marvellAP = 3,
ralinkAP = 4,
realtekAP = 5,
airgocapAP = 6,
unknownAP = 7,
maxAP,
};
enum HT_IOT_PEER {
HT_IOT_PEER_UNKNOWN = 0,
HT_IOT_PEER_REALTEK = 1,
HT_IOT_PEER_REALTEK_92SE = 2,
HT_IOT_PEER_BROADCOM = 3,
HT_IOT_PEER_RALINK = 4,
HT_IOT_PEER_ATHEROS = 5,
HT_IOT_PEER_CISCO = 6,
HT_IOT_PEER_MERU = 7,
HT_IOT_PEER_MARVELL = 8,
HT_IOT_PEER_REALTEK_SOFTAP = 9,/* peer is RealTek SOFT_AP */
HT_IOT_PEER_SELF_SOFTAP = 10, /* Self is SoftAP */
HT_IOT_PEER_AIRGO = 11,
HT_IOT_PEER_INTEL = 12,
HT_IOT_PEER_RTK_APCLIENT = 13,
HT_IOT_PEER_REALTEK_81XX = 14,
HT_IOT_PEER_REALTEK_WOW = 15,
HT_IOT_PEER_TENDA = 16,
HT_IOT_PEER_MAX = 17
};
enum SCAN_STATE {
SCAN_DISABLE = 0,
SCAN_START = 1,
SCAN_TXNULL = 2,
SCAN_PROCESS = 3,
SCAN_COMPLETE = 4,
SCAN_STATE_MAX,
};
struct mlme_handler {
unsigned int num;
char *str;
unsigned int (*func)(struct adapter *adapt, union recv_frame *frame);
};
struct action_handler {
unsigned int num;
char* str;
unsigned int (*func)(struct adapter *adapt, union recv_frame *frame);
};
struct ss_res {
int state;
int bss_cnt;
int channel_idx;
int scan_mode;
u8 ssid_num;
u8 ch_num;
struct ndis_802_11_ssid ssid[RTW_SSID_SCAN_AMOUNT];
struct rtw_ieee80211_channel ch[RTW_CHANNEL_SCAN_AMOUNT];
};
/* define AP_MODE 0x0C */
/* define STATION_MODE 0x08 */
/* define AD_HOC_MODE 0x04 */
/* define NO_LINK_MODE 0x00 */
#define WIFI_FW_NULL_STATE _HW_STATE_NOLINK_
#define WIFI_FW_STATION_STATE _HW_STATE_STATION_
#define WIFI_FW_AP_STATE _HW_STATE_AP_
#define WIFI_FW_ADHOC_STATE _HW_STATE_ADHOC_
#define WIFI_FW_AUTH_NULL 0x00000100
#define WIFI_FW_AUTH_STATE 0x00000200
#define WIFI_FW_AUTH_SUCCESS 0x00000400
#define WIFI_FW_ASSOC_STATE 0x00002000
#define WIFI_FW_ASSOC_SUCCESS 0x00004000
#define WIFI_FW_LINKING_STATE (WIFI_FW_AUTH_NULL | \
WIFI_FW_AUTH_STATE | \
WIFI_FW_AUTH_SUCCESS | \
WIFI_FW_ASSOC_STATE)
struct FW_Sta_Info {
struct sta_info *psta;
u32 status;
u32 rx_pkt;
u32 retry;
unsigned char SupportedRates[NDIS_802_11_LENGTH_RATES_EX];
};
/*
* Usage:
* When one iface acted as AP mode and the other iface is STA mode and scanning,
* it should switch back to AP's operating channel periodically.
* Parameters info:
* When the driver scanned RTW_SCAN_NUM_OF_CH channels, it would switch back to
* AP's operating channel for
* RTW_STAY_AP_CH_MILLISECOND * SURVEY_TO milliseconds.
* Example:
* For chip supports 2.4G + 5GHz and AP mode is operating in channel 1,
* RTW_SCAN_NUM_OF_CH is 8, RTW_STAY_AP_CH_MS is 3 and SURVEY_TO is 100.
* When it's STA mode gets set_scan command,
* it would
* 1. Doing the scan on channel 1.2.3.4.5.6.7.8
* 2. Back to channel 1 for 300 milliseconds
* 3. Go through doing site survey on channel 9.10.11.36.40.44.48.52
* 4. Back to channel 1 for 300 milliseconds
* 5. ... and so on, till survey done.
*/
struct mlme_ext_info {
u32 state;
u32 reauth_count;
u32 reassoc_count;
u32 link_count;
u32 auth_seq;
u32 auth_algo; /* 802.11 auth, could be open, shared, auto */
u32 authModeToggle;
u32 enc_algo;/* encrypt algorithm; */
u32 key_index; /* this is only valid for legacy wep,
* 0~3 for key id. */
u32 iv;
u8 chg_txt[128];
u16 aid;
u16 bcn_interval;
u16 capability;
u8 assoc_AP_vendor;
u8 slotTime;
u8 preamble_mode;
u8 WMM_enable;
u8 ERP_enable;
u8 ERP_IE;
u8 HT_enable;
u8 HT_caps_enable;
u8 HT_info_enable;
u8 HT_protection;
u8 turboMode_cts2self;
u8 turboMode_rtsen;
u8 SM_PS;
u8 agg_enable_bitmap;
u8 ADDBA_retry_count;
u8 candidate_tid_bitmap;
u8 dialogToken;
/* Accept ADDBA Request */
bool bAcceptAddbaReq;
u8 bwmode_updated;
u8 hidden_ssid_mode;
struct ADDBA_request ADDBA_req;
struct WMM_para_element WMM_param;
struct HT_caps_element HT_caps;
struct HT_info_element HT_info;
struct wlan_bssid_ex network;/* join network or bss_network,
* if in ap mode, it is the same
* as cur_network.network */
struct FW_Sta_Info FW_sta_info[NUM_STA];
};
/* The channel information about this channel including joining,
* scanning, and power constraints. */
struct rt_channel_info {
u8 ChannelNum; /* The channel number. */
enum rt_scan_type ScanType; /* Scan type such as passive
* or active scan. */
u32 rx_count;
};
int rtw_ch_set_search_ch(struct rt_channel_info *ch_set, const u32 ch);
/* P2P_MAX_REG_CLASSES - Maximum number of regulatory classes */
#define P2P_MAX_REG_CLASSES 10
/* P2P_MAX_REG_CLASS_CHANNELS - Maximum number of chan per regulatory class */
#define P2P_MAX_REG_CLASS_CHANNELS 20
/* struct p2p_channels - List of supported channels */
struct p2p_channels {
/* struct p2p_reg_class - Supported regulatory class */
struct p2p_reg_class {
/* reg_class - Regulatory class (IEEE 802.11-2007, Annex J) */
u8 reg_class;
/* channel - Supported channels */
u8 channel[P2P_MAX_REG_CLASS_CHANNELS];
/* channels - Number of channel entries in use */
size_t channels;
} reg_class[P2P_MAX_REG_CLASSES];
/* reg_classes - Number of reg_class entries in use */
size_t reg_classes;
};
struct p2p_oper_class_map {
enum hw_mode {IEEE80211G} mode;
u8 op_class;
u8 min_chan;
u8 max_chan;
u8 inc;
enum {BW20, BW40PLUS, BW40MINUS} bw;
};
struct mlme_ext_priv {
struct adapter *padapter;
u8 mlmeext_init;
ATOMIC_T event_seq;
u16 mgnt_seq;
unsigned char cur_channel;
unsigned char cur_bwmode;
unsigned char cur_ch_offset;/* PRIME_CHNL_OFFSET */
unsigned char cur_wireless_mode; /* NETWORK_TYPE */
unsigned char oper_channel; /* saved chan info when call
* set_channel_bw */
unsigned char oper_bwmode;
unsigned char oper_ch_offset;/* PRIME_CHNL_OFFSET */
unsigned char max_chan_nums;
struct rt_channel_info channel_set[MAX_CHANNEL_NUM];
struct p2p_channels channel_list;
unsigned char basicrate[NumRates];
unsigned char datarate[NumRates];
struct ss_res sitesurvey_res;
struct mlme_ext_info mlmext_info;/* for sta/adhoc mode, including
* current scan/connecting/connected
* related info. For ap mode,
* network includes ap's cap_info*/
struct timer_list survey_timer;
struct timer_list link_timer;
u16 chan_scan_time;
u8 scan_abort;
u8 tx_rate; /* TXRATE when USERATE is set. */
u32 retry; /* retry for issue probereq */
u64 TSFValue;
#ifdef CONFIG_88EU_AP_MODE
unsigned char bstart_bss;
#endif
u8 update_channel_plan_by_ap_done;
/* recv_decache check for Action_public frame */
u8 action_public_dialog_token;
u16 action_public_rxseq;
u8 active_keep_alive_check;
};
int init_mlme_ext_priv(struct adapter *adapter);
int init_hw_mlme_ext(struct adapter *padapter);
void free_mlme_ext_priv (struct mlme_ext_priv *pmlmeext);
extern void init_mlme_ext_timer(struct adapter *padapter);
extern void init_addba_retry_timer(struct adapter *adapt, struct sta_info *sta);
extern struct xmit_frame *alloc_mgtxmitframe(struct xmit_priv *pxmitpriv);
unsigned char networktype_to_raid(unsigned char network_type);
u8 judge_network_type(struct adapter *padapter, unsigned char *rate, int len);
void get_rate_set(struct adapter *padapter, unsigned char *pbssrate, int *len);
void UpdateBrateTbl(struct adapter *padapter, u8 *mBratesOS);
void UpdateBrateTblForSoftAP(u8 *bssrateset, u32 bssratelen);
void Save_DM_Func_Flag(struct adapter *padapter);
void Restore_DM_Func_Flag(struct adapter *padapter);
void Switch_DM_Func(struct adapter *padapter, u32 mode, u8 enable);
void Set_MSR(struct adapter *padapter, u8 type);
u8 rtw_get_oper_ch(struct adapter *adapter);
void rtw_set_oper_ch(struct adapter *adapter, u8 ch);
u8 rtw_get_oper_bw(struct adapter *adapter);
void rtw_set_oper_bw(struct adapter *adapter, u8 bw);
u8 rtw_get_oper_choffset(struct adapter *adapter);
void rtw_set_oper_choffset(struct adapter *adapter, u8 offset);
void set_channel_bwmode(struct adapter *padapter, unsigned char channel,
unsigned char channel_offset, unsigned short bwmode);
void SelectChannel(struct adapter *padapter, unsigned char channel);
void SetBWMode(struct adapter *padapter, unsigned short bwmode,
unsigned char channel_offset);
unsigned int decide_wait_for_beacon_timeout(unsigned int bcn_interval);
void write_cam(struct adapter *padapter, u8 entry, u16 ctrl, u8 *mac, u8 *key);
void clear_cam_entry(struct adapter *padapter, u8 entry);
void invalidate_cam_all(struct adapter *padapter);
void CAM_empty_entry(struct adapter * Adapter, u8 ucIndex);
int allocate_fw_sta_entry(struct adapter *padapter);
void flush_all_cam_entry(struct adapter *padapter);
void site_survey(struct adapter *padapter);
u8 collect_bss_info(struct adapter *padapter, union recv_frame *precv_frame,
struct wlan_bssid_ex *bssid);
void update_network(struct wlan_bssid_ex *dst, struct wlan_bssid_ex *src,
struct adapter *adapter, bool update_ie);
int get_bsstype(unsigned short capability);
u8 *get_my_bssid(struct wlan_bssid_ex *pnetwork);
u16 get_beacon_interval(struct wlan_bssid_ex *bss);
int is_client_associated_to_ap(struct adapter *padapter);
int is_client_associated_to_ibss(struct adapter *padapter);
int is_IBSS_empty(struct adapter *padapter);
unsigned char check_assoc_AP(u8 *pframe, uint len);
int WMM_param_handler(struct adapter *padapter, struct ndis_802_11_var_ie *pIE);
void WMMOnAssocRsp(struct adapter *padapter);
void HT_caps_handler(struct adapter *padapter, struct ndis_802_11_var_ie *pIE);
void HT_info_handler(struct adapter *padapter, struct ndis_802_11_var_ie *pIE);
void HTOnAssocRsp(struct adapter *padapter);
void ERP_IE_handler(struct adapter *padapter, struct ndis_802_11_var_ie *pIE);
void VCS_update(struct adapter *padapter, struct sta_info *psta);
void update_beacon_info(struct adapter *padapter, u8 *pframe, uint len,
struct sta_info *psta);
int rtw_check_bcn_info(struct adapter *Adapter, u8 *pframe, u32 packet_len);
void update_IOT_info(struct adapter *padapter);
void update_capinfo(struct adapter *adapter, u16 updatecap);
void update_wireless_mode(struct adapter *padapter);
void update_tx_basic_rate(struct adapter *padapter, u8 modulation);
void update_bmc_sta_support_rate(struct adapter *padapter, u32 mac_id);
int update_sta_support_rate(struct adapter *padapter, u8 *pvar_ie,
uint var_ie_len, int cam_idx);
/* for sta/adhoc mode */
void update_sta_info(struct adapter *padapter, struct sta_info *psta);
unsigned int update_basic_rate(unsigned char *ptn, unsigned int ptn_sz);
unsigned int update_supported_rate(unsigned char *ptn, unsigned int ptn_sz);
unsigned int update_MSC_rate(struct HT_caps_element *pHT_caps);
void Update_RA_Entry(struct adapter *padapter, u32 mac_id);
void set_sta_rate(struct adapter *padapter, struct sta_info *psta);
unsigned int receive_disconnect(struct adapter *padapter,
unsigned char *macaddr, unsigned short reason);
unsigned char get_highest_rate_idx(u32 mask);
int support_short_GI(struct adapter *padapter, struct HT_caps_element *caps);
unsigned int is_ap_in_tkip(struct adapter *padapter);
unsigned int is_ap_in_wep(struct adapter *padapter);
unsigned int should_forbid_n_rate(struct adapter *padapter);
void report_join_res(struct adapter *padapter, int res);
void report_survey_event(struct adapter *padapter, union recv_frame *precv_frame);
void report_surveydone_event(struct adapter *padapter);
void report_del_sta_event(struct adapter *padapter,
unsigned char *addr, unsigned short reason);
void report_add_sta_event(struct adapter *padapter, unsigned char* addr,
int cam_idx);
void beacon_timing_control(struct adapter *padapter);
extern u8 set_tx_beacon_cmd(struct adapter*padapter);
unsigned int setup_beacon_frame(struct adapter *padapter,
unsigned char *beacon_frame);
void update_mgnt_tx_rate(struct adapter *padapter, u8 rate);
void update_mgntframe_attrib(struct adapter *padapter,
struct pkt_attrib *pattrib);
void dump_mgntframe(struct adapter *padapter, struct xmit_frame *pmgntframe);
s32 dump_mgntframe_and_wait(struct adapter *padapter,
struct xmit_frame *pmgntframe, int timeout_ms);
s32 dump_mgntframe_and_wait_ack(struct adapter *padapter,
struct xmit_frame *pmgntframe);
#ifdef CONFIG_88EU_P2P
void issue_probersp_p2p(struct adapter *padapter, unsigned char *da);
void issue_p2p_provision_request(struct adapter *padapter, u8 *pssid,
u8 ussidlen, u8 *pdev_raddr);
void issue_p2p_GO_request(struct adapter *padapter, u8 *raddr);
void issue_probereq_p2p(struct adapter *padapter, u8 *da);
int issue_probereq_p2p_ex(struct adapter *adapter, u8 *da, int try_cnt,
int wait_ms);
void issue_p2p_invitation_response(struct adapter *padapter, u8 *raddr,
u8 dialogToken, u8 success);
void issue_p2p_invitation_request(struct adapter *padapter, u8* raddr);
#endif /* CONFIG_88EU_P2P */
void issue_beacon(struct adapter *padapter, int timeout_ms);
void issue_probersp(struct adapter *padapter, unsigned char *da,
u8 is_valid_p2p_probereq);
void issue_assocreq(struct adapter *padapter);
void issue_asocrsp(struct adapter *padapter, unsigned short status,
struct sta_info *pstat, int pkt_type);
void issue_auth(struct adapter *padapter, struct sta_info *psta,
unsigned short status);
void issue_probereq(struct adapter *padapter, struct ndis_802_11_ssid *pssid,
u8 *da);
s32 issue_probereq_ex(struct adapter *adapter, struct ndis_802_11_ssid *pssid,
u8* da, int try_cnt, int wait_ms);
int issue_nulldata(struct adapter *padapter, unsigned char *da,
unsigned int power_mode, int try_cnt, int wait_ms);
int issue_qos_nulldata(struct adapter *padapter, unsigned char *da,
u16 tid, int try_cnt, int wait_ms);
int issue_deauth(struct adapter *padapter, unsigned char *da,
unsigned short reason);
int issue_deauth_ex(struct adapter *padapter, u8 *da, unsigned short reason,
int try_cnt, int wait_ms);
void issue_action_spct_ch_switch(struct adapter *padapter, u8 *ra, u8 new_ch,
u8 ch_offset);
void issue_action_BA(struct adapter *padapter, unsigned char *raddr,
unsigned char action, unsigned short status);
unsigned int send_delba(struct adapter *padapter, u8 initiator, u8 *addr);
unsigned int send_beacon(struct adapter *padapter);
void start_clnt_assoc(struct adapter *padapter);
void start_clnt_auth(struct adapter *padapter);
void start_clnt_join(struct adapter *padapter);
void start_create_ibss(struct adapter *padapter);
unsigned int OnAssocReq(struct adapter *padapter,
union recv_frame *precv_frame);
unsigned int OnAssocRsp(struct adapter *padapter,
union recv_frame *precv_frame);
unsigned int OnProbeReq(struct adapter *padapter,
union recv_frame *precv_frame);
unsigned int OnProbeRsp(struct adapter *padapter,
union recv_frame *precv_frame);
unsigned int DoReserved(struct adapter *padapter,
union recv_frame *precv_frame);
unsigned int OnBeacon(struct adapter *padapter,
union recv_frame *precv_frame);
unsigned int OnAtim(struct adapter *padapter,
union recv_frame *precv_frame);
unsigned int OnDisassoc(struct adapter *padapter,
union recv_frame *precv_frame);
unsigned int OnAuth(struct adapter *padapter,
union recv_frame *precv_frame);
unsigned int OnAuthClient(struct adapter *padapter,
union recv_frame *precv_frame);
unsigned int OnDeAuth(struct adapter *padapter,
union recv_frame *precv_frame);
unsigned int OnAction(struct adapter *padapter,
union recv_frame *precv_frame);
unsigned int on_action_spct(struct adapter *padapter,
union recv_frame *precv_frame);
unsigned int OnAction_qos(struct adapter *padapter,
union recv_frame *precv_frame);
unsigned int OnAction_dls(struct adapter *padapter,
union recv_frame *precv_frame);
unsigned int OnAction_back(struct adapter *padapter,
union recv_frame *precv_frame);
unsigned int on_action_public(struct adapter *padapter,
union recv_frame *precv_frame);
unsigned int OnAction_ht(struct adapter *padapter,
union recv_frame *precv_frame);
unsigned int OnAction_wmm(struct adapter *padapter,
union recv_frame *precv_frame);
unsigned int OnAction_p2p(struct adapter *padapter,
union recv_frame *precv_frame);
void mlmeext_joinbss_event_callback(struct adapter *padapter, int join_res);
void mlmeext_sta_del_event_callback(struct adapter *padapter);
void mlmeext_sta_add_event_callback(struct adapter *padapter,
struct sta_info *psta);
void linked_status_chk(struct adapter *padapter);
void survey_timer_hdl (struct adapter *padapter);
void link_timer_hdl (struct adapter *padapter);
void addba_timer_hdl(struct sta_info *psta);
#define set_survey_timer(mlmeext, ms) \
do { \
_set_timer(&(mlmeext)->survey_timer, (ms)); \
} while (0)
#define set_link_timer(mlmeext, ms) \
do { \
_set_timer(&(mlmeext)->link_timer, (ms)); \
} while (0)
int cckrates_included(unsigned char *rate, int ratelen);
int cckratesonly_included(unsigned char *rate, int ratelen);
void process_addba_req(struct adapter *padapter, u8 *paddba_req, u8 *addr);
void update_TSF(struct mlme_ext_priv *pmlmeext, u8 *pframe, uint len);
void correct_TSF(struct adapter *padapter, struct mlme_ext_priv *pmlmeext);
struct cmd_hdl {
uint parmsize;
u8 (*h2cfuns)(struct adapter *padapter, u8 *pbuf);
};
u8 read_macreg_hdl(struct adapter *padapter, u8 *pbuf);
u8 write_macreg_hdl(struct adapter *padapter, u8 *pbuf);
u8 read_bbreg_hdl(struct adapter *padapter, u8 *pbuf);
u8 write_bbreg_hdl(struct adapter *padapter, u8 *pbuf);
u8 read_rfreg_hdl(struct adapter *padapter, u8 *pbuf);
u8 write_rfreg_hdl(struct adapter *padapter, u8 *pbuf);
u8 NULL_hdl(struct adapter *padapter, u8 *pbuf);
u8 join_cmd_hdl(struct adapter *padapter, u8 *pbuf);
u8 disconnect_hdl(struct adapter *padapter, u8 *pbuf);
u8 createbss_hdl(struct adapter *padapter, u8 *pbuf);
u8 setopmode_hdl(struct adapter *padapter, u8 *pbuf);
u8 sitesurvey_cmd_hdl(struct adapter *padapter, u8 *pbuf);
u8 setauth_hdl(struct adapter *padapter, u8 *pbuf);
u8 setkey_hdl(struct adapter *padapter, u8 *pbuf);
u8 set_stakey_hdl(struct adapter *padapter, u8 *pbuf);
u8 set_assocsta_hdl(struct adapter *padapter, u8 *pbuf);
u8 del_assocsta_hdl(struct adapter *padapter, u8 *pbuf);
u8 add_ba_hdl(struct adapter *padapter, unsigned char *pbuf);
u8 mlme_evt_hdl(struct adapter *padapter, unsigned char *pbuf);
u8 h2c_msg_hdl(struct adapter *padapter, unsigned char *pbuf);
u8 tx_beacon_hdl(struct adapter *padapter, unsigned char *pbuf);
u8 set_ch_hdl(struct adapter *padapter, u8 *pbuf);
u8 set_chplan_hdl(struct adapter *padapter, unsigned char *pbuf);
u8 led_blink_hdl(struct adapter *padapter, unsigned char *pbuf);
/* Handling DFS channel switch announcement ie. */
u8 set_csa_hdl(struct adapter *padapter, unsigned char *pbuf);
u8 tdls_hdl(struct adapter *padapter, unsigned char *pbuf);
#define GEN_DRV_CMD_HANDLER(size, cmd) {size, &cmd ## _hdl},
#define GEN_MLME_EXT_HANDLER(size, cmd) {size, cmd},
#ifdef _RTW_CMD_C_
static struct cmd_hdl wlancmds[] = {
GEN_DRV_CMD_HANDLER(0, NULL) /*0*/
GEN_DRV_CMD_HANDLER(0, NULL)
GEN_DRV_CMD_HANDLER(0, NULL)
GEN_DRV_CMD_HANDLER(0, NULL)
GEN_DRV_CMD_HANDLER(0, NULL)
GEN_DRV_CMD_HANDLER(0, NULL)
GEN_MLME_EXT_HANDLER(0, NULL)
GEN_MLME_EXT_HANDLER(0, NULL)
GEN_MLME_EXT_HANDLER(0, NULL)
GEN_MLME_EXT_HANDLER(0, NULL)
GEN_MLME_EXT_HANDLER(0, NULL) /*10*/
GEN_MLME_EXT_HANDLER(0, NULL)
GEN_MLME_EXT_HANDLER(0, NULL)
GEN_MLME_EXT_HANDLER(0, NULL)
GEN_MLME_EXT_HANDLER(sizeof (struct joinbss_parm), join_cmd_hdl) /*14*/
GEN_MLME_EXT_HANDLER(sizeof (struct disconnect_parm), disconnect_hdl)
GEN_MLME_EXT_HANDLER(sizeof (struct createbss_parm), createbss_hdl)
GEN_MLME_EXT_HANDLER(sizeof (struct setopmode_parm), setopmode_hdl)
GEN_MLME_EXT_HANDLER(sizeof (struct sitesurvey_parm),
sitesurvey_cmd_hdl) /*18*/
GEN_MLME_EXT_HANDLER(sizeof (struct setauth_parm), setauth_hdl)
GEN_MLME_EXT_HANDLER(sizeof (struct setkey_parm), setkey_hdl) /*20*/
GEN_MLME_EXT_HANDLER(sizeof (struct set_stakey_parm), set_stakey_hdl)
GEN_MLME_EXT_HANDLER(sizeof (struct set_assocsta_parm), NULL)
GEN_MLME_EXT_HANDLER(sizeof (struct del_assocsta_parm), NULL)
GEN_MLME_EXT_HANDLER(sizeof (struct setstapwrstate_parm), NULL)
GEN_MLME_EXT_HANDLER(sizeof (struct setbasicrate_parm), NULL)
GEN_MLME_EXT_HANDLER(sizeof (struct getbasicrate_parm), NULL)
GEN_MLME_EXT_HANDLER(sizeof (struct setdatarate_parm), NULL)
GEN_MLME_EXT_HANDLER(sizeof (struct getdatarate_parm), NULL)
GEN_MLME_EXT_HANDLER(sizeof (struct setphyinfo_parm), NULL)
GEN_MLME_EXT_HANDLER(sizeof (struct getphyinfo_parm), NULL) /*30*/
GEN_MLME_EXT_HANDLER(sizeof (struct setphy_parm), NULL)
GEN_MLME_EXT_HANDLER(sizeof (struct getphy_parm), NULL)
GEN_MLME_EXT_HANDLER(0, NULL)
GEN_MLME_EXT_HANDLER(0, NULL)
GEN_MLME_EXT_HANDLER(0, NULL)
GEN_MLME_EXT_HANDLER(0, NULL)
GEN_MLME_EXT_HANDLER(0, NULL)
GEN_MLME_EXT_HANDLER(0, NULL)
GEN_MLME_EXT_HANDLER(0, NULL)
GEN_MLME_EXT_HANDLER(0, NULL) /*40*/
GEN_MLME_EXT_HANDLER(0, NULL)
GEN_MLME_EXT_HANDLER(0, NULL)
GEN_MLME_EXT_HANDLER(0, NULL)
GEN_MLME_EXT_HANDLER(0, NULL)
GEN_MLME_EXT_HANDLER(sizeof(struct addBaReq_parm), add_ba_hdl)
GEN_MLME_EXT_HANDLER(sizeof(struct set_ch_parm), set_ch_hdl) /* 46 */
GEN_MLME_EXT_HANDLER(0, NULL)
GEN_MLME_EXT_HANDLER(0, NULL)
GEN_MLME_EXT_HANDLER(0, NULL)
GEN_MLME_EXT_HANDLER(0, NULL) /*50*/
GEN_MLME_EXT_HANDLER(0, NULL)
GEN_MLME_EXT_HANDLER(0, NULL)
GEN_MLME_EXT_HANDLER(0, NULL)
GEN_MLME_EXT_HANDLER(0, NULL)
GEN_MLME_EXT_HANDLER(sizeof(struct Tx_Beacon_param),
tx_beacon_hdl) /*55*/
GEN_MLME_EXT_HANDLER(0, mlme_evt_hdl) /*56*/
GEN_MLME_EXT_HANDLER(0, rtw_drvextra_cmd_hdl) /*57*/
GEN_MLME_EXT_HANDLER(0, h2c_msg_hdl) /*58*/
GEN_MLME_EXT_HANDLER(sizeof(struct SetChannelPlan_param),
set_chplan_hdl) /*59*/
GEN_MLME_EXT_HANDLER(sizeof(struct LedBlink_param),
led_blink_hdl) /*60*/
GEN_MLME_EXT_HANDLER(sizeof(struct SetChannelSwitch_param),
set_csa_hdl) /*61*/
GEN_MLME_EXT_HANDLER(sizeof(struct TDLSoption_param),
tdls_hdl) /*62*/
};
#endif
struct C2HEvent_Header {
#ifdef __LITTLE_ENDIAN
unsigned int len:16;
unsigned int ID:8;
unsigned int seq:8;
#elif defined(__BIG_ENDIAN)
unsigned int seq:8;
unsigned int ID:8;
unsigned int len:16;
#endif
unsigned int rsvd;
};
void rtw_dummy_event_callback(struct adapter *adapter, u8 *pbuf);
void rtw_fwdbg_event_callback(struct adapter *adapter, u8 *pbuf);
enum rtw_c2h_event {
GEN_EVT_CODE(_Read_MACREG) = 0, /*0*/
GEN_EVT_CODE(_Read_BBREG),
GEN_EVT_CODE(_Read_RFREG),
GEN_EVT_CODE(_Read_EEPROM),
GEN_EVT_CODE(_Read_EFUSE),
GEN_EVT_CODE(_Read_CAM), /*5*/
GEN_EVT_CODE(_Get_BasicRate),
GEN_EVT_CODE(_Get_DataRate),
GEN_EVT_CODE(_Survey), /*8*/
GEN_EVT_CODE(_SurveyDone), /*9*/
GEN_EVT_CODE(_JoinBss) , /*10*/
GEN_EVT_CODE(_AddSTA),
GEN_EVT_CODE(_DelSTA),
GEN_EVT_CODE(_AtimDone),
GEN_EVT_CODE(_TX_Report),
GEN_EVT_CODE(_CCX_Report), /*15*/
GEN_EVT_CODE(_DTM_Report),
GEN_EVT_CODE(_TX_Rate_Statistics),
GEN_EVT_CODE(_C2HLBK),
GEN_EVT_CODE(_FWDBG),
GEN_EVT_CODE(_C2HFEEDBACK), /*20*/
GEN_EVT_CODE(_ADDBA),
GEN_EVT_CODE(_C2HBCN),
GEN_EVT_CODE(_ReportPwrState), /* filen: only for PCIE, USB */
GEN_EVT_CODE(_CloseRF), /* filen: only for PCIE,
* work around ASPM */
MAX_C2HEVT
};
#ifdef _RTW_MLME_EXT_C_
static struct fwevent wlanevents[] = {
{0, rtw_dummy_event_callback}, /*0*/
{0, NULL},
{0, NULL},
{0, NULL},
{0, NULL},
{0, NULL},
{0, NULL},
{0, NULL},
{0, &rtw_survey_event_callback}, /*8*/
{sizeof (struct surveydone_event), &rtw_surveydone_event_callback},/*9*/
{0, &rtw_joinbss_event_callback}, /*10*/
{sizeof(struct stassoc_event), &rtw_stassoc_event_callback},
{sizeof(struct stadel_event), &rtw_stadel_event_callback},
{0, &rtw_atimdone_event_callback},
{0, rtw_dummy_event_callback},
{0, NULL}, /*15*/
{0, NULL},
{0, NULL},
{0, NULL},
{0, rtw_fwdbg_event_callback},
{0, NULL}, /*20*/
{0, NULL},
{0, NULL},
{0, &rtw_cpwm_event_callback},
};
#endif/* _RTL_MLME_EXT_C_ */
#endif /* __RTW_MLME_EXT_H_ */

View File

@ -0,0 +1,495 @@
/******************************************************************************
*
* Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
*
*
******************************************************************************/
#ifndef _RTW_MP_H_
#define _RTW_MP_H_
/* 00 - Success */
/* 11 - Error */
#define STATUS_SUCCESS (0x00000000L)
#define STATUS_PENDING (0x00000103L)
#define STATUS_UNSUCCESSFUL (0xC0000001L)
#define STATUS_INSUFFICIENT_RESOURCES (0xC000009AL)
#define STATUS_NOT_SUPPORTED (0xC00000BBL)
#define NDIS_STATUS_SUCCESS ((int)STATUS_SUCCESS)
#define NDIS_STATUS_PENDING ((int)STATUS_PENDING)
#define NDIS_STATUS_NOT_RECOGNIZED ((int)0x00010001L)
#define NDIS_STATUS_NOT_COPIED ((int)0x00010002L)
#define NDIS_STATUS_NOT_ACCEPTED ((int)0x00010003L)
#define NDIS_STATUS_CALL_ACTIVE ((int)0x00010007L)
#define NDIS_STATUS_FAILURE ((int)STATUS_UNSUCCESSFUL)
#define NDIS_STATUS_RESOURCES ((int)STATUS_INSUFFICIENT_RESOURCES)
#define NDIS_STATUS_CLOSING ((int)0xC0010002L)
#define NDIS_STATUS_BAD_VERSION ((int)0xC0010004L)
#define NDIS_STATUS_BAD_CHARACTERISTICS ((int)0xC0010005L)
#define NDIS_STATUS_ADAPTER_NOT_FOUND ((int)0xC0010006L)
#define NDIS_STATUS_OPEN_FAILED ((int)0xC0010007L)
#define NDIS_STATUS_DEVICE_FAILED ((int)0xC0010008L)
#define NDIS_STATUS_MULTICAST_FULL ((int)0xC0010009L)
#define NDIS_STATUS_MULTICAST_EXISTS ((int)0xC001000AL)
#define NDIS_STATUS_MULTICAST_NOT_FOUND ((int)0xC001000BL)
#define NDIS_STATUS_REQUEST_ABORTED ((int)0xC001000CL)
#define NDIS_STATUS_RESET_IN_PROGRESS ((int)0xC001000DL)
#define NDIS_STATUS_CLOSING_INDICATING ((int)0xC001000EL)
#define NDIS_STATUS_NOT_SUPPORTED ((int)STATUS_NOT_SUPPORTED)
#define NDIS_STATUS_INVALID_PACKET ((int)0xC001000FL)
#define NDIS_STATUS_OPEN_LIST_FULL ((int)0xC0010010L)
#define NDIS_STATUS_ADAPTER_NOT_READY ((int)0xC0010011L)
#define NDIS_STATUS_ADAPTER_NOT_OPEN ((int)0xC0010012L)
#define NDIS_STATUS_NOT_INDICATING ((int)0xC0010013L)
#define NDIS_STATUS_INVALID_LENGTH ((int)0xC0010014L)
#define NDIS_STATUS_INVALID_DATA ((int)0xC0010015L)
#define NDIS_STATUS_BUFFER_TOO_SHORT ((int)0xC0010016L)
#define NDIS_STATUS_INVALID_OID ((int)0xC0010017L)
#define NDIS_STATUS_ADAPTER_REMOVED ((int)0xC0010018L)
#define NDIS_STATUS_UNSUPPORTED_MEDIA ((int)0xC0010019L)
#define NDIS_STATUS_GROUP_ADDRESS_IN_USE ((int)0xC001001AL)
#define NDIS_STATUS_FILE_NOT_FOUND ((int)0xC001001BL)
#define NDIS_STATUS_ERROR_READING_FILE ((int)0xC001001CL)
#define NDIS_STATUS_ALREADY_MAPPED ((int)0xC001001DL)
#define NDIS_STATUS_RESOURCE_CONFLICT ((int)0xC001001EL)
#define NDIS_STATUS_NO_CABLE ((int)0xC001001FL)
#define NDIS_STATUS_INVALID_SAP ((int)0xC0010020L)
#define NDIS_STATUS_SAP_IN_USE ((int)0xC0010021L)
#define NDIS_STATUS_INVALID_ADDRESS ((int)0xC0010022L)
#define NDIS_STATUS_VC_NOT_ACTIVATED ((int)0xC0010023L)
#define NDIS_STATUS_DEST_OUT_OF_ORDER ((int)0xC0010024L) /*cause 27*/
#define NDIS_STATUS_VC_NOT_AVAILABLE ((int)0xC0010025L) /*cause 35,45 */
#define NDIS_STATUS_CELLRATE_NOT_AVAILABLE ((int)0xC0010026L) /*cause 37*/
#define NDIS_STATUS_INCOMPATABLE_QOS ((int)0xC0010027L) /*cause 49*/
#define NDIS_STATUS_AAL_PARAMS_UNSUPPORTED ((int)0xC0010028L) /*cause 93*/
#define NDIS_STATUS_NO_ROUTE_TO_DESTINATION ((int)0xC0010029L) /*cause 3 */
enum antenna_path {
ANTENNA_NONE = 0x00,
ANTENNA_D,
ANTENNA_C,
ANTENNA_CD,
ANTENNA_B,
ANTENNA_BD,
ANTENNA_BC,
ANTENNA_BCD,
ANTENNA_A,
ANTENNA_AD,
ANTENNA_AC,
ANTENNA_ACD,
ANTENNA_AB,
ANTENNA_ABD,
ANTENNA_ABC,
ANTENNA_ABCD
};
#define MAX_MP_XMITBUF_SZ 2048
#define NR_MP_XMITFRAME 8
struct mp_xmit_frame {
struct list_head list;
struct pkt_attrib attrib;
struct sk_buff *pkt;
int frame_tag;
struct adapter *padapter;
struct urb *pxmit_urb[8];
/* insert urb, irp, and irpcnt info below... */
u8 *mem_addr;
u32 sz[8];
u8 bpending[8];
int ac_tag[8];
int last[8];
uint irpcnt;
uint fragcnt;
uint mem[(MAX_MP_XMITBUF_SZ >> 2)];
};
struct mp_wiparam {
u32 bcompleted;
u32 act_type;
u32 io_offset;
u32 io_value;
};
typedef void(*wi_act_func)(void *padapter);
struct mp_tx {
u8 stop;
u32 count, sended;
u8 payload;
struct pkt_attrib attrib;
struct tx_desc desc;
u8 *pallocated_buf;
u8 *buf;
u32 buf_size, write_size;
void *PktTxThread;
};
#include <Hal8188EPhyCfg.h>
#define MP_MAX_LINES 1000
#define MP_MAX_LINES_BYTES 256
typedef void (*MPT_WORK_ITEM_HANDLER)(void *Adapter);
struct mpt_context {
/* Indicate if we have started Mass Production Test. */
bool bMassProdTest;
/* Indicate if the driver is unloading or unloaded. */
bool bMptDrvUnload;
struct semaphore MPh2c_Sema;
struct timer_list MPh2c_timeout_timer;
/* Event used to sync H2c for BT control */
bool MptH2cRspEvent;
bool MptBtC2hEvent;
bool bMPh2c_timeout;
/* 8190 PCI does not support NDIS_WORK_ITEM. */
/* Work Item for Mass Production Test. */
/* Event used to sync the case unloading driver and MptWorkItem
* is still in progress. */
/* Indicate a MptWorkItem is scheduled and not yet finished. */
bool bMptWorkItemInProgress;
/* An instance which implements function and context of MptWorkItem. */
MPT_WORK_ITEM_HANDLER CurrMptAct;
/* 1=Start, 0=Stop from UI. */
u32 MptTestStart;
/* _TEST_MODE, defined in MPT_Req2.h */
u32 MptTestItem;
/* Variable needed in each implementation of CurrMptAct. */
u32 MptActType; /* Type of action performed in CurrMptAct. */
/* The Offset of IO operation is depend of MptActType. */
u32 MptIoOffset;
/* The Value of IO operation is depend of MptActType. */
u32 MptIoValue;
/* The RfPath of IO operation is depend of MptActType. */
u32 MptRfPath;
enum wireless_mode MptWirelessModeToSw; /* Wireless mode to switch. */
u8 MptChannelToSw; /* Channel to switch. */
u8 MptInitGainToSet; /* Initial gain to set. */
u32 MptBandWidth; /* bandwidth to switch. */
u32 MptRateIndex; /* rate index. */
/* Register value kept for Single Carrier Tx test. */
u8 btMpCckTxPower;
/* Register value kept for Single Carrier Tx test. */
u8 btMpOfdmTxPower;
/* For MP Tx Power index */
u8 TxPwrLevel[2]; /* rf-A, rf-B */
/* Content of RCR Regsiter for Mass Production Test. */
u32 MptRCR;
/* true if we only receive packets with specific pattern. */
bool bMptFilterPattern;
/* Rx OK count, statistics used in Mass Production Test. */
u32 MptRxOkCnt;
/* Rx CRC32 error count, statistics used in Mass Production Test. */
u32 MptRxCrcErrCnt;
bool bCckContTx; /* true if we are in CCK Continuous Tx test. */
bool bOfdmContTx; /* true if we are in OFDM Continuous Tx test. */
bool bStartContTx; /* true if we have start Continuous Tx test. */
/* true if we are in Single Carrier Tx test. */
bool bSingleCarrier;
/* true if we are in Carrier Suppression Tx Test. */
bool bCarrierSuppression;
/* true if we are in Single Tone Tx test. */
bool bSingleTone;
/* ACK counter asked by K.Y.. */
bool bMptEnableAckCounter;
u32 MptAckCounter;
u8 APK_bound[2]; /* for APK path A/path B */
bool bMptIndexEven;
u8 backup0xc50;
u8 backup0xc58;
u8 backup0xc30;
u8 backup0x52_RF_A;
u8 backup0x52_RF_B;
u8 h2cReqNum;
u8 c2hBuf[20];
u8 btInBuf[100];
u32 mptOutLen;
u8 mptOutBuf[100];
};
enum {
WRITE_REG = 1,
READ_REG,
WRITE_RF,
READ_RF,
MP_START,
MP_STOP,
MP_RATE,
MP_CHANNEL,
MP_BANDWIDTH,
MP_TXPOWER,
MP_ANT_TX,
MP_ANT_RX,
MP_CTX,
MP_QUERY,
MP_ARX,
MP_PSD,
MP_PWRTRK,
MP_THER,
MP_IOCTL,
EFUSE_GET,
EFUSE_SET,
MP_RESET_STATS,
MP_DUMP,
MP_PHYPARA,
MP_SetRFPathSwh,
MP_QueryDrvStats,
MP_SetBT,
CTA_TEST,
MP_NULL,
};
struct mp_priv {
struct adapter *papdater;
/* Testing Flag */
/* 0 for normal type packet, 1 for loopback packet (16bytes TXCMD) */
u32 mode;
u32 prev_fw_state;
/* OID cmd handler */
struct mp_wiparam workparam;
/* Tx Section */
u8 TID;
u32 tx_pktcount;
struct mp_tx tx;
/* Rx Section */
u32 rx_pktcount;
u32 rx_crcerrpktcount;
u32 rx_pktloss;
struct recv_stat rxstat;
/* RF/BB relative */
u8 channel;
u8 bandwidth;
u8 prime_channel_offset;
u8 txpoweridx;
u8 txpoweridx_b;
u8 rateidx;
u32 preamble;
u32 CrystalCap;
u16 antenna_tx;
u16 antenna_rx;
u8 check_mp_pkt;
u8 bSetTxPower;
struct wlan_network mp_network;
unsigned char network_macaddr[ETH_ALEN];
u8 *pallocated_mp_xmitframe_buf;
u8 *pmp_xmtframe_buf;
struct __queue free_mp_xmitqueue;
u32 free_mp_xmitframe_cnt;
struct mpt_context MptCtx;
};
struct iocmd_struct {
u8 cmdclass;
u16 value;
u8 index;
};
struct rf_reg_param {
u32 path;
u32 offset;
u32 value;
};
struct bb_reg_param {
u32 offset;
u32 value;
};
/* */
#define LOWER true
#define RAISE false
/* Hardware Registers */
#define BB_REG_BASE_ADDR 0x800
/* MP variables */
enum mp_mode_{
MP_OFF,
MP_ON,
MP_ERR,
MP_CONTINUOUS_TX,
MP_SINGLE_CARRIER_TX,
MP_CARRIER_SUPPRISSION_TX,
MP_SINGLE_TONE_TX,
MP_PACKET_TX,
MP_PACKET_RX
};
#define MAX_RF_PATH_NUMS RF_PATH_MAX
extern u8 mpdatarate[NumRates];
/* MP set force data rate base on the definition. */
enum mpt_rate_index {
/* CCK rate. */
MPT_RATE_1M, /* 0 */
MPT_RATE_2M,
MPT_RATE_55M,
MPT_RATE_11M, /* 3 */
/* OFDM rate. */
MPT_RATE_6M, /* 4 */
MPT_RATE_9M,
MPT_RATE_12M,
MPT_RATE_18M,
MPT_RATE_24M,
MPT_RATE_36M,
MPT_RATE_48M,
MPT_RATE_54M, /* 11 */
/* HT rate. */
MPT_RATE_MCS0, /* 12 */
MPT_RATE_MCS1,
MPT_RATE_MCS2,
MPT_RATE_MCS3,
MPT_RATE_MCS4,
MPT_RATE_MCS5,
MPT_RATE_MCS6,
MPT_RATE_MCS7, /* 19 */
MPT_RATE_MCS8,
MPT_RATE_MCS9,
MPT_RATE_MCS10,
MPT_RATE_MCS11,
MPT_RATE_MCS12,
MPT_RATE_MCS13,
MPT_RATE_MCS14,
MPT_RATE_MCS15, /* 27 */
MPT_RATE_LAST
};
#define MAX_TX_PWR_INDEX_N_MODE 64 /* 0x3F */
enum power_mode {
POWER_LOW = 0,
POWER_NORMAL
};
#define RX_PKT_BROADCAST 1
#define RX_PKT_DEST_ADDR 2
#define RX_PKT_PHY_MATCH 3
enum encry_ctrl_state {
HW_CONTROL, /* hw encryption& decryption */
SW_CONTROL, /* sw encryption& decryption */
HW_ENCRY_SW_DECRY, /* hw encryption & sw decryption */
SW_ENCRY_HW_DECRY /* sw encryption & hw decryption */
};
s32 init_mp_priv(struct adapter *padapter);
void free_mp_priv(struct mp_priv *pmp_priv);
s32 MPT_InitializeAdapter(struct adapter *padapter, u8 Channel);
void MPT_DeInitAdapter(struct adapter *padapter);
s32 mp_start_test(struct adapter *padapter);
void mp_stop_test(struct adapter *padapter);
u32 _read_rfreg(struct adapter *padapter, u8 rfpath, u32 addr, u32 bitmask);
void _write_rfreg(struct adapter *padapter, u8 rfpath, u32 addr, u32 bitmask, u32 val);
u32 read_macreg(struct adapter *padapter, u32 addr, u32 sz);
void write_macreg(struct adapter *padapter, u32 addr, u32 val, u32 sz);
u32 read_bbreg(struct adapter *padapter, u32 addr, u32 bitmask);
void write_bbreg(struct adapter *padapter, u32 addr, u32 bitmask, u32 val);
u32 read_rfreg(struct adapter *padapter, u8 rfpath, u32 addr);
void write_rfreg(struct adapter *padapter, u8 rfpath, u32 addr, u32 val);
void SetChannel(struct adapter *pAdapter);
void SetBandwidth(struct adapter *pAdapter);
void SetTxPower(struct adapter *pAdapter);
void SetAntennaPathPower(struct adapter *pAdapter);
void SetDataRate(struct adapter *pAdapter);
void SetAntenna(struct adapter *pAdapter);
s32 SetThermalMeter(struct adapter *pAdapter, u8 target_ther);
void GetThermalMeter(struct adapter *pAdapter, u8 *value);
void SetContinuousTx(struct adapter *pAdapter, u8 bStart);
void SetSingleCarrierTx(struct adapter *pAdapter, u8 bStart);
void SetSingleToneTx(struct adapter *pAdapter, u8 bStart);
void SetCarrierSuppressionTx(struct adapter *pAdapter, u8 bStart);
void PhySetTxPowerLevel(struct adapter *pAdapter);
void fill_txdesc_for_mp(struct adapter *padapter, struct tx_desc *ptxdesc);
void SetPacketTx(struct adapter *padapter);
void SetPacketRx(struct adapter *pAdapter, u8 bStartRx);
void ResetPhyRxPktCount(struct adapter *pAdapter);
u32 GetPhyRxPktReceived(struct adapter *pAdapter);
u32 GetPhyRxPktCRC32Error(struct adapter *pAdapter);
s32 SetPowerTracking(struct adapter *padapter, u8 enable);
void GetPowerTracking(struct adapter *padapter, u8 *enable);
u32 mp_query_psd(struct adapter *pAdapter, u8 *data);
void Hal_SetAntenna(struct adapter *pAdapter);
void Hal_SetBandwidth(struct adapter *pAdapter);
void Hal_SetTxPower(struct adapter *pAdapter);
void Hal_SetCarrierSuppressionTx(struct adapter *pAdapter, u8 bStart);
void Hal_SetSingleToneTx(struct adapter *pAdapter, u8 bStart);
void Hal_SetSingleCarrierTx (struct adapter *pAdapter, u8 bStart);
void Hal_SetContinuousTx (struct adapter *pAdapter, u8 bStart);
void Hal_SetBandwidth(struct adapter *pAdapter);
void Hal_SetDataRate(struct adapter *pAdapter);
void Hal_SetChannel(struct adapter *pAdapter);
void Hal_SetAntennaPathPower(struct adapter *pAdapter);
s32 Hal_SetThermalMeter(struct adapter *pAdapter, u8 target_ther);
s32 Hal_SetPowerTracking(struct adapter *padapter, u8 enable);
void Hal_GetPowerTracking(struct adapter *padapter, u8 * enable);
void Hal_GetThermalMeter(struct adapter *pAdapter, u8 *value);
void Hal_mpt_SwitchRfSetting(struct adapter *pAdapter);
void Hal_MPT_CCKTxPowerAdjust(struct adapter * Adapter, bool bInCH14);
void Hal_MPT_CCKTxPowerAdjustbyIndex(struct adapter *pAdapter, bool beven);
void Hal_SetCCKTxPower(struct adapter *pAdapter, u8 * TxPower);
void Hal_SetOFDMTxPower(struct adapter *pAdapter, u8 * TxPower);
void Hal_TriggerRFThermalMeter(struct adapter *pAdapter);
u8 Hal_ReadRFThermalMeter(struct adapter *pAdapter);
void Hal_SetCCKContinuousTx(struct adapter *pAdapter, u8 bStart);
void Hal_SetOFDMContinuousTx(struct adapter *pAdapter, u8 bStart);
void Hal_ProSetCrystalCap (struct adapter *pAdapter , u32 CrystalCapVal);
void _rtw_mp_xmit_priv(struct xmit_priv *pxmitpriv);
void MP_PHY_SetRFPathSwitch(struct adapter *pAdapter ,bool bMain);
#endif /* _RTW_MP_H_ */

View File

@ -0,0 +1,340 @@
/******************************************************************************
*
* Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
*
*
******************************************************************************/
#ifndef _RTW_MP_IOCTL_H_
#define _RTW_MP_IOCTL_H_
#include <drv_types.h>
#include <mp_custom_oid.h>
#include <rtw_ioctl.h>
#include <rtw_ioctl_rtl.h>
#include <rtw_efuse.h>
#include <rtw_mp.h>
/* */
struct cfg_dbg_msg_struct {
u32 DebugLevel;
u32 DebugComponent_H32;
u32 DebugComponent_L32;
};
struct mp_rw_reg {
u32 offset;
u32 width;
u32 value;
};
struct efuse_access_struct {
u16 start_addr;
u16 cnts;
u8 data[0];
};
struct burst_rw_reg {
u32 offset;
u32 len;
u8 Data[256];
};
struct usb_vendor_req {
u8 bRequest;
u16 wValue;
u16 wIndex;
u16 wLength;
u8 u8Dir;/* 0:OUT, 1:IN */
u8 u8InData;
};
struct dr_variable_struct {
u8 offset;
u32 variable;
};
#define _irqlevel_changed_(a, b)
/* oid_rtl_seg_81_80_00 */
int oid_rt_pro_set_data_rate_hdl(struct oid_par_priv *poid_par_priv);
int oid_rt_pro_start_test_hdl(struct oid_par_priv *poid_par_priv);
int oid_rt_pro_stop_test_hdl(struct oid_par_priv *poid_par_priv);
int oid_rt_pro_set_channel_direct_call_hdl(struct oid_par_priv *poid_par_priv);
int oid_rt_pro_set_antenna_bb_hdl(struct oid_par_priv *poid_par_priv);
int oid_rt_pro_set_tx_power_control_hdl(struct oid_par_priv *poid_par_priv);
/* oid_rtl_seg_81_80_20 */
int oid_rt_pro_query_tx_packet_sent_hdl(struct oid_par_priv *poid_par_priv);
int oid_rt_pro_query_rx_packet_received_hdl(struct oid_par_priv *poid_par_priv);
int oid_rt_pro_query_rx_packet_crc32_error_hdl(struct oid_par_priv *par_priv);
int oid_rt_pro_reset_tx_packet_sent_hdl(struct oid_par_priv *poid_par_priv);
int oid_rt_pro_reset_rx_packet_received_hdl(struct oid_par_priv *par_priv);
int oid_rt_pro_set_modulation_hdl(struct oid_par_priv *poid_par_priv);
int oid_rt_pro_set_continuous_tx_hdl(struct oid_par_priv *poid_par_priv);
int oid_rt_pro_set_single_carrier_tx_hdl(struct oid_par_priv *poid_par_priv);
int oid_rt_pro_set_carrier_suppression_tx_hdl(struct oid_par_priv *par_priv);
int oid_rt_pro_set_single_tone_tx_hdl(struct oid_par_priv *poid_par_priv);
/* oid_rtl_seg_81_87 */
int oid_rt_pro_write_bb_reg_hdl(struct oid_par_priv *poid_par_priv);
int oid_rt_pro_read_bb_reg_hdl(struct oid_par_priv *poid_par_priv);
int oid_rt_pro_write_rf_reg_hdl(struct oid_par_priv *poid_par_priv);
int oid_rt_pro_read_rf_reg_hdl(struct oid_par_priv *poid_par_priv);
/* oid_rtl_seg_81_85 */
int oid_rt_wireless_mode_hdl(struct oid_par_priv *poid_par_priv);
/* oid_rtl_seg_87_11_00 */
int oid_rt_pro8711_join_bss_hdl(struct oid_par_priv *poid_par_priv);
int oid_rt_pro_read_register_hdl(struct oid_par_priv *poid_par_priv);
int oid_rt_pro_write_register_hdl(struct oid_par_priv *poid_par_priv);
int oid_rt_pro_burst_read_register_hdl(struct oid_par_priv *poid_par_priv);
int oid_rt_pro_burst_write_register_hdl(struct oid_par_priv *poid_par_priv);
int oid_rt_pro_write_txcmd_hdl(struct oid_par_priv *poid_par_priv);
int oid_rt_pro_read16_eeprom_hdl(struct oid_par_priv *poid_par_priv);
int oid_rt_pro_write16_eeprom_hdl(struct oid_par_priv *poid_par_priv);
int oid_rt_pro8711_wi_poll_hdl(struct oid_par_priv *poid_par_priv);
int oid_rt_pro8711_pkt_loss_hdl(struct oid_par_priv *poid_par_priv);
int oid_rt_rd_attrib_mem_hdl(struct oid_par_priv *poid_par_priv);
int oid_rt_wr_attrib_mem_hdl (struct oid_par_priv *poid_par_priv);
int oid_rt_pro_set_rf_intfs_hdl(struct oid_par_priv *poid_par_priv);
int oid_rt_poll_rx_status_hdl(struct oid_par_priv *poid_par_priv);
/* oid_rtl_seg_87_11_20 */
int oid_rt_pro_cfg_debug_message_hdl(struct oid_par_priv *poid_par_priv);
int oid_rt_pro_set_data_rate_ex_hdl(struct oid_par_priv *poid_par_priv);
int oid_rt_pro_set_basic_rate_hdl(struct oid_par_priv *poid_par_priv);
int oid_rt_pro_read_tssi_hdl(struct oid_par_priv *poid_par_priv);
int oid_rt_pro_set_power_tracking_hdl(struct oid_par_priv *poid_par_priv);
/* oid_rtl_seg_87_11_50 */
int oid_rt_pro_qry_pwrstate_hdl(struct oid_par_priv *poid_par_priv);
int oid_rt_pro_set_pwrstate_hdl(struct oid_par_priv *poid_par_priv);
/* oid_rtl_seg_87_11_F0 */
int oid_rt_pro_h2c_set_rate_table_hdl(struct oid_par_priv *poid_par_priv);
int oid_rt_pro_h2c_get_rate_table_hdl(struct oid_par_priv *poid_par_priv);
/* oid_rtl_seg_87_12_00 */
int oid_rt_pro_encryption_ctrl_hdl(struct oid_par_priv *poid_par_priv);
int oid_rt_pro_add_sta_info_hdl(struct oid_par_priv *poid_par_priv);
int oid_rt_pro_dele_sta_info_hdl(struct oid_par_priv *poid_par_priv);
int oid_rt_pro_query_dr_variable_hdl(struct oid_par_priv *poid_par_priv);
int oid_rt_pro_rx_packet_type_hdl(struct oid_par_priv *poid_par_priv);
int oid_rt_pro_read_efuse_hdl(struct oid_par_priv *poid_par_priv);
int oid_rt_pro_write_efuse_hdl(struct oid_par_priv *poid_par_priv);
int oid_rt_pro_rw_efuse_pgpkt_hdl(struct oid_par_priv *poid_par_priv);
int oid_rt_get_efuse_current_size_hdl(struct oid_par_priv *poid_par_priv);
int oid_rt_pro_efuse_hdl(struct oid_par_priv *poid_par_priv);
int oid_rt_pro_efuse_map_hdl(struct oid_par_priv *poid_par_priv);
int oid_rt_set_bandwidth_hdl(struct oid_par_priv *poid_par_priv);
int oid_rt_set_crystal_cap_hdl(struct oid_par_priv *poid_par_priv);
int oid_rt_set_rx_packet_type_hdl(struct oid_par_priv *poid_par_priv);
int oid_rt_get_efuse_max_size_hdl(struct oid_par_priv *poid_par_priv);
int oid_rt_pro_set_tx_agc_offset_hdl(struct oid_par_priv *poid_par_priv);
int oid_rt_pro_set_pkt_test_mode_hdl(struct oid_par_priv *poid_par_priv);
int oid_rt_get_thermal_meter_hdl(struct oid_par_priv *poid_par_priv);
int oid_rt_reset_phy_rx_packet_count_hdl(struct oid_par_priv *poid_par_priv);
int oid_rt_get_phy_rx_packet_received_hdl(struct oid_par_priv *poid_par_priv);
int oid_rt_get_phy_rx_packet_crc32_error_hdl(struct oid_par_priv *par_priv);
int oid_rt_set_power_down_hdl(struct oid_par_priv *poid_par_priv);
int oid_rt_get_power_mode_hdl(struct oid_par_priv *poid_par_priv);
int oid_rt_pro_trigger_gpio_hdl(struct oid_par_priv *poid_par_priv);
#ifdef _RTW_MP_IOCTL_C_
static const struct oid_obj_priv oid_rtl_seg_81_80_00[] = {
{1, &oid_null_function}, /* 0x00 OID_RT_PRO_RESET_DUT */
{1, &oid_rt_pro_set_data_rate_hdl}, /* 0x01 */
{1, &oid_rt_pro_start_test_hdl}, /* 0x02 */
{1, &oid_rt_pro_stop_test_hdl}, /* 0x03 */
{1, &oid_null_function}, /* 0x04 OID_RT_PRO_SET_PREAMBLE */
{1, &oid_null_function}, /* 0x05 OID_RT_PRO_SET_SCRAMBLER */
{1, &oid_null_function}, /* 0x06 OID_RT_PRO_SET_FILTER_BB */
{1, &oid_null_function},/* 0x07 OID_RT_PRO_SET_MANUAL_DIVERSITY_BB */
{1, &oid_rt_pro_set_channel_direct_call_hdl}, /* 0x08 */
{1, &oid_null_function},/* 0x09 OID_RT_PRO_SET_SLEEP_MODE_DIRECT_CALL */
{1, &oid_null_function},/* 0x0A OID_RT_PRO_SET_WAKE_MODE_DIRECT_CALL */
{1, &oid_rt_pro_set_continuous_tx_hdl}, /* 0x0B OID_RT_PRO_SET_TX_CONTINUOUS_DIRECT_CALL */
{1, &oid_rt_pro_set_single_carrier_tx_hdl},/* 0x0C OID_RT_PRO_SET_SINGLE_CARRIER_TX_CONTINUOUS */
{1, &oid_null_function}, /* 0x0D OID_RT_PRO_SET_TX_ANTENNA_BB */
{1, &oid_rt_pro_set_antenna_bb_hdl}, /* 0x0E */
{1, &oid_null_function}, /* 0x0F OID_RT_PRO_SET_CR_SCRAMBLER */
{1, &oid_null_function}, /* 0x10 OID_RT_PRO_SET_CR_NEW_FILTER */
{1, &oid_rt_pro_set_tx_power_control_hdl},/* 0x11 OID_RT_PRO_SET_TX_POWER_CONTROL */
{1, &oid_null_function}, /* 0x12 OID_RT_PRO_SET_CR_TX_CONFIG */
{1, &oid_null_function}, /* 0x13 OID_RT_PRO_GET_TX_POWER_CONTROL */
{1, &oid_null_function}, /* 0x14 OID_RT_PRO_GET_CR_SIGNAL_QUALITY */
{1, &oid_null_function}, /* 0x15 OID_RT_PRO_SET_CR_SETPOINT */
{1, &oid_null_function}, /* 0x16 OID_RT_PRO_SET_INTEGRATOR */
{1, &oid_null_function}, /* 0x17 OID_RT_PRO_SET_SIGNAL_QUALITY */
{1, &oid_null_function}, /* 0x18 OID_RT_PRO_GET_INTEGRATOR */
{1, &oid_null_function}, /* 0x19 OID_RT_PRO_GET_SIGNAL_QUALITY */
{1, &oid_null_function}, /* 0x1A OID_RT_PRO_QUERY_EEPROM_TYPE */
{1, &oid_null_function}, /* 0x1B OID_RT_PRO_WRITE_MAC_ADDRESS */
{1, &oid_null_function}, /* 0x1C OID_RT_PRO_READ_MAC_ADDRESS */
{1, &oid_null_function}, /* 0x1D OID_RT_PRO_WRITE_CIS_DATA */
{1, &oid_null_function}, /* 0x1E OID_RT_PRO_READ_CIS_DATA */
{1, &oid_null_function} /* 0x1F OID_RT_PRO_WRITE_POWER_CONTROL */
};
static const struct oid_obj_priv oid_rtl_seg_81_80_20[] = {
{1, &oid_null_function}, /* 0x20 OID_RT_PRO_READ_POWER_CONTROL */
{1, &oid_null_function}, /* 0x21 OID_RT_PRO_WRITE_EEPROM */
{1, &oid_null_function}, /* 0x22 OID_RT_PRO_READ_EEPROM */
{1, &oid_rt_pro_reset_tx_packet_sent_hdl}, /* 0x23 */
{1, &oid_rt_pro_query_tx_packet_sent_hdl}, /* 0x24 */
{1, &oid_rt_pro_reset_rx_packet_received_hdl}, /* 0x25 */
{1, &oid_rt_pro_query_rx_packet_received_hdl}, /* 0x26 */
{1, &oid_rt_pro_query_rx_packet_crc32_error_hdl}, /* 0x27 */
{1, &oid_null_function}, /* 0x28 OID_RT_PRO_QUERY_CURRENT_ADDRESS */
{1, &oid_null_function}, /* 0x29 OID_RT_PRO_QUERY_PERMANENT_ADDRESS */
{1, &oid_null_function}, /* 0x2A OID_RT_PRO_SET_PHILIPS_RF_PARAMETERS */
{1, &oid_rt_pro_set_carrier_suppression_tx_hdl},/* 0x2B OID_RT_PRO_SET_CARRIER_SUPPRESSION_TX */
{1, &oid_null_function}, /* 0x2C OID_RT_PRO_RECEIVE_PACKET */
{1, &oid_null_function}, /* 0x2D OID_RT_PRO_WRITE_EEPROM_BYTE */
{1, &oid_null_function}, /* 0x2E OID_RT_PRO_READ_EEPROM_BYTE */
{1, &oid_rt_pro_set_modulation_hdl} /* 0x2F */
};
static const struct oid_obj_priv oid_rtl_seg_81_80_40[] = {
{1, &oid_null_function}, /* 0x40 */
{1, &oid_null_function}, /* 0x41 */
{1, &oid_null_function}, /* 0x42 */
{1, &oid_rt_pro_set_single_tone_tx_hdl}, /* 0x43 */
{1, &oid_null_function}, /* 0x44 */
{1, &oid_null_function} /* 0x45 */
};
static const struct oid_obj_priv oid_rtl_seg_81_80_80[] = {
{1, &oid_null_function}, /* 0x80 OID_RT_DRIVER_OPTION */
{1, &oid_null_function}, /* 0x81 OID_RT_RF_OFF */
{1, &oid_null_function} /* 0x82 OID_RT_AUTH_STATUS */
};
static const struct oid_obj_priv oid_rtl_seg_81_85[] = {
{1, &oid_rt_wireless_mode_hdl} /* 0x00 OID_RT_WIRELESS_MODE */
};
#endif /* _RTL871X_MP_IOCTL_C_ */
struct rwreg_param {
u32 offset;
u32 width;
u32 value;
};
struct bbreg_param {
u32 offset;
u32 phymask;
u32 value;
};
struct txpower_param {
u32 pwr_index;
};
struct datarate_param {
u32 rate_index;
};
struct rfintfs_parm {
u32 rfintfs;
};
struct mp_xmit_parm {
u8 enable;
u32 count;
u16 length;
u8 payload_type;
u8 da[ETH_ALEN];
};
struct mp_xmit_packet {
u32 len;
u32 mem[MAX_MP_XMITBUF_SZ >> 2];
};
struct psmode_param {
u32 ps_mode;
u32 smart_ps;
};
/* for OID_RT_PRO_READ16_EEPROM & OID_RT_PRO_WRITE16_EEPROM */
struct eeprom_rw_param {
u32 offset;
u16 value;
};
struct mp_ioctl_handler {
u32 paramsize;
s32 (*handler)(struct oid_par_priv* poid_par_priv);
u32 oid;
};
struct mp_ioctl_param{
u32 subcode;
u32 len;
u8 data[0];
};
#define GEN_MP_IOCTL_SUBCODE(code) _MP_IOCTL_ ## code ## _CMD_
enum RTL871X_MP_IOCTL_SUBCODE {
GEN_MP_IOCTL_SUBCODE(MP_START), /*0*/
GEN_MP_IOCTL_SUBCODE(MP_STOP),
GEN_MP_IOCTL_SUBCODE(READ_REG),
GEN_MP_IOCTL_SUBCODE(WRITE_REG),
GEN_MP_IOCTL_SUBCODE(READ_BB_REG),
GEN_MP_IOCTL_SUBCODE(WRITE_BB_REG), /*5*/
GEN_MP_IOCTL_SUBCODE(READ_RF_REG),
GEN_MP_IOCTL_SUBCODE(WRITE_RF_REG),
GEN_MP_IOCTL_SUBCODE(SET_CHANNEL),
GEN_MP_IOCTL_SUBCODE(SET_TXPOWER),
GEN_MP_IOCTL_SUBCODE(SET_DATARATE), /*10*/
GEN_MP_IOCTL_SUBCODE(SET_BANDWIDTH),
GEN_MP_IOCTL_SUBCODE(SET_ANTENNA),
GEN_MP_IOCTL_SUBCODE(CNTU_TX),
GEN_MP_IOCTL_SUBCODE(SC_TX),
GEN_MP_IOCTL_SUBCODE(CS_TX), /*15*/
GEN_MP_IOCTL_SUBCODE(ST_TX),
GEN_MP_IOCTL_SUBCODE(IOCTL_XMIT_PACKET),
GEN_MP_IOCTL_SUBCODE(SET_RX_PKT_TYPE),
GEN_MP_IOCTL_SUBCODE(RESET_PHY_RX_PKT_CNT),
GEN_MP_IOCTL_SUBCODE(GET_PHY_RX_PKT_RECV), /*20*/
GEN_MP_IOCTL_SUBCODE(GET_PHY_RX_PKT_ERROR),
GEN_MP_IOCTL_SUBCODE(READ16_EEPROM),
GEN_MP_IOCTL_SUBCODE(WRITE16_EEPROM),
GEN_MP_IOCTL_SUBCODE(EFUSE),
GEN_MP_IOCTL_SUBCODE(EFUSE_MAP), /*25*/
GEN_MP_IOCTL_SUBCODE(GET_EFUSE_MAX_SIZE),
GEN_MP_IOCTL_SUBCODE(GET_EFUSE_CURRENT_SIZE),
GEN_MP_IOCTL_SUBCODE(GET_THERMAL_METER),
GEN_MP_IOCTL_SUBCODE(SET_PTM),
GEN_MP_IOCTL_SUBCODE(SET_POWER_DOWN), /*30*/
GEN_MP_IOCTL_SUBCODE(TRIGGER_GPIO),
GEN_MP_IOCTL_SUBCODE(SET_DM_BT), /*35*/
GEN_MP_IOCTL_SUBCODE(DEL_BA), /*36*/
GEN_MP_IOCTL_SUBCODE(GET_WIFI_STATUS), /*37*/
MAX_MP_IOCTL_SUBCODE,
};
s32 mp_ioctl_xmit_packet_hdl(struct oid_par_priv *poid_par_priv);
#define GEN_HANDLER(sz, hdl, oid) {sz, hdl, oid},
#define EXT_MP_IOCTL_HANDLER(sz, subcode, oid) \
{sz, mp_ioctl_##subcode##_hdl, oid},
#endif

File diff suppressed because it is too large Load Diff