diff --git a/Makefile b/Makefile index 1843d12..360e269 100755 --- a/Makefile +++ b/Makefile @@ -82,7 +82,7 @@ OUTSRC_FILES := hal/odm_debug.o \ hal/odm_HWConfig.o\ hal/odm.o\ hal/HalPhyRf.o - + HAL_COMM_FILES := hal/rtl8188e_xmit.o\ hal/rtl8188e_sreset.o @@ -104,7 +104,7 @@ endif PWRSEQ_FILES := hal/HalPwrSeqCmd.o \ hal/Hal8188EPwrSeq.o -CHIP_FILES += $(HAL_COMM_FILES) $(OUTSRC_FILES) $(PWRSEQ_FILES) +CHIP_FILES += $(HAL_COMM_FILES) $(OUTSRC_FILES) $(PWRSEQ_FILES) HCI_NAME = usb @@ -481,7 +481,7 @@ endif ifeq ($(CONFIG_PLATFORM_SZEBOOK), y) EXTRA_CFLAGS += -DCONFIG_BIG_ENDIAN ARCH:=arm -CROSS_COMPILE:=/opt/crosstool2/bin/armeb-unknown-linux-gnueabi- +CROSS_COMPILE:=/opt/crosstool2/bin/armeb-unknown-linux-gnueabi- KVER:= 2.6.31.6 KSRC:= ../code/linux-2.6.31.6-2020/ endif @@ -654,4 +654,3 @@ clean: $(clean_more) cd hal ; rm -fr *.mod.c *.mod *.o .*.cmd *.ko cd os_dep ; rm -fr *.mod.c *.mod *.o .*.cmd *.ko endif - diff --git a/core/rtw_ap.c b/core/rtw_ap.c index 2f21480..b50bb38 100755 --- a/core/rtw_ap.c +++ b/core/rtw_ap.c @@ -1,2960 +1,2959 @@ -/****************************************************************************** - * - * Copyright(c) 2007 - 2012 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 - * - * - ******************************************************************************/ -#define _RTW_AP_C_ - -#include -#include -#include -#include - - -#ifdef CONFIG_AP_MODE - -extern unsigned char RTW_WPA_OUI[]; -extern unsigned char WMM_OUI[]; -extern unsigned char WPS_OUI[]; -extern unsigned char P2P_OUI[]; -extern unsigned char WFD_OUI[]; - -void init_mlme_ap_info(struct adapter *padapter) -{ - struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; - struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); - struct sta_priv *pstapriv = &padapter->stapriv; - struct wlan_acl_pool *pacl_list = &pstapriv->acl_list; - - - _rtw_spinlock_init(&pmlmepriv->bcn_update_lock); - - //for ACL - _rtw_init_queue(&pacl_list->acl_node_q); - - //pmlmeext->bstart_bss = _FALSE; - - start_ap_mode(padapter); -} - -void free_mlme_ap_info(struct adapter *padapter) -{ - _irqL irqL; - struct sta_info *psta=NULL; - struct sta_priv *pstapriv = &padapter->stapriv; - struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); - struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; - struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); - - //stop_ap_mode(padapter); - - pmlmepriv->update_bcn = _FALSE; - pmlmeext->bstart_bss = _FALSE; - - rtw_sta_flush(padapter); - - pmlmeinfo->state = _HW_STATE_NOLINK_; - - //free_assoc_sta_resources - rtw_free_all_stainfo(padapter); - - //free bc/mc sta_info - psta = rtw_get_bcmc_stainfo(padapter); - _enter_critical_bh(&(pstapriv->sta_hash_lock), &irqL); - rtw_free_stainfo(padapter, psta); - _exit_critical_bh(&(pstapriv->sta_hash_lock), &irqL); - _rtw_spinlock_free(&pmlmepriv->bcn_update_lock); - -} - -static void update_BCNTIM(struct adapter *padapter) -{ - struct sta_priv *pstapriv = &padapter->stapriv; - struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); - struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); - WLAN_BSSID_EX *pnetwork_mlmeext = &(pmlmeinfo->network); - unsigned char *pie = pnetwork_mlmeext->IEs; - - //DBG_871X("%s\n", __FUNCTION__); - - //update TIM IE - //if(pstapriv->tim_bitmap) - if(_TRUE) - { - u8 *p, *dst_ie, *premainder_ie=NULL, *pbackup_remainder_ie=NULL; - u16 tim_bitmap_le; - uint offset, tmp_len, tim_ielen, tim_ie_offset, remainder_ielen; - - tim_bitmap_le = cpu_to_le16(pstapriv->tim_bitmap); - - p = rtw_get_ie(pie + _FIXED_IE_LENGTH_, _TIM_IE_, &tim_ielen, pnetwork_mlmeext->IELength - _FIXED_IE_LENGTH_); - if (p != NULL && tim_ielen>0) - { - tim_ielen += 2; - - premainder_ie = p+tim_ielen; - - tim_ie_offset = (sint)(p -pie); - - remainder_ielen = pnetwork_mlmeext->IELength - tim_ie_offset - tim_ielen; - - //append TIM IE from dst_ie offset - dst_ie = p; - } - else - { - tim_ielen = 0; - - //calucate head_len - offset = _FIXED_IE_LENGTH_; - - /* get ssid_ie len */ - p = rtw_get_ie(pie + _BEACON_IE_OFFSET_, _SSID_IE_, &tmp_len, (pnetwork_mlmeext->IELength - _BEACON_IE_OFFSET_)); - if (p != NULL) - offset += tmp_len+2; - - // get supported rates len - p = rtw_get_ie(pie + _BEACON_IE_OFFSET_, _SUPPORTEDRATES_IE_, &tmp_len, (pnetwork_mlmeext->IELength - _BEACON_IE_OFFSET_)); - if (p != NULL) - { - offset += tmp_len+2; - } - - //DS Parameter Set IE, len=3 - offset += 3; - - premainder_ie = pie + offset; - - remainder_ielen = pnetwork_mlmeext->IELength - offset - tim_ielen; - - //append TIM IE from offset - dst_ie = pie + offset; - - } - - - if(remainder_ielen>0) - { - pbackup_remainder_ie = rtw_malloc(remainder_ielen); - if(pbackup_remainder_ie && premainder_ie) - _rtw_memcpy(pbackup_remainder_ie, premainder_ie, remainder_ielen); - } - - *dst_ie++=_TIM_IE_; - - if((pstapriv->tim_bitmap&0xff00) && (pstapriv->tim_bitmap&0x00fc)) - tim_ielen = 5; - else - tim_ielen = 4; - - *dst_ie++= tim_ielen; - - *dst_ie++=0;//DTIM count - *dst_ie++=1;//DTIM peroid - - if(pstapriv->tim_bitmap&BIT(0))//for bc/mc frames - *dst_ie++ = BIT(0);//bitmap ctrl - else - *dst_ie++ = 0; - - if(tim_ielen==4) - { - *dst_ie++ = *(u8*)&tim_bitmap_le; - } - else if(tim_ielen==5) - { - _rtw_memcpy(dst_ie, &tim_bitmap_le, 2); - dst_ie+=2; - } - - //copy remainder IE - if(pbackup_remainder_ie) - { - _rtw_memcpy(dst_ie, pbackup_remainder_ie, remainder_ielen); - - rtw_mfree(pbackup_remainder_ie, remainder_ielen); - } - - offset = (uint)(dst_ie - pie); - pnetwork_mlmeext->IELength = offset + remainder_ielen; - - } - -#ifndef CONFIG_INTERRUPT_BASED_TXBCN -#if defined(CONFIG_USB_HCI) || defined(CONFIG_SDIO_HCI) || defined(CONFIG_GSPI_HCI) - set_tx_beacon_cmd(padapter); -#endif -#endif //!CONFIG_INTERRUPT_BASED_TXBCN - - -} - -void rtw_add_bcn_ie(struct adapter *padapter, WLAN_BSSID_EX *pnetwork, u8 index, u8 *data, u8 len) -{ - PNDIS_802_11_VARIABLE_IEs pIE; - u8 bmatch = _FALSE; - u8 *pie = pnetwork->IEs; - u8 *p, *dst_ie, *premainder_ie=NULL, *pbackup_remainder_ie=NULL; - u32 i, offset, ielen, ie_offset, remainder_ielen = 0; - - for (i = sizeof(NDIS_802_11_FIXED_IEs); i < pnetwork->IELength;) - { - pIE = (PNDIS_802_11_VARIABLE_IEs)(pnetwork->IEs + i); - - if (pIE->ElementID > index) - { - break; - } - else if(pIE->ElementID == index) // already exist the same IE - { - p = (u8 *)pIE; - ielen = pIE->Length; - bmatch = _TRUE; - break; - } - - p = (u8 *)pIE; - ielen = pIE->Length; - i += (pIE->Length + 2); - } - - if (p != NULL && ielen>0) - { - ielen += 2; - - premainder_ie = p+ielen; - - ie_offset = (sint)(p -pie); - - remainder_ielen = pnetwork->IELength - ie_offset - ielen; - - if(bmatch) - dst_ie = p; - else - dst_ie = (p+ielen); - } - - if(remainder_ielen>0) - { - pbackup_remainder_ie = rtw_malloc(remainder_ielen); - if(pbackup_remainder_ie && premainder_ie) - _rtw_memcpy(pbackup_remainder_ie, premainder_ie, remainder_ielen); - } - - *dst_ie++=index; - *dst_ie++=len; - - _rtw_memcpy(dst_ie, data, len); - dst_ie+=len; - - //copy remainder IE - if(pbackup_remainder_ie) - { - _rtw_memcpy(dst_ie, pbackup_remainder_ie, remainder_ielen); - - rtw_mfree(pbackup_remainder_ie, remainder_ielen); - } - - offset = (uint)(dst_ie - pie); - pnetwork->IELength = offset + remainder_ielen; -} - -void rtw_remove_bcn_ie(struct adapter *padapter, WLAN_BSSID_EX *pnetwork, u8 index) -{ - u8 *p, *dst_ie, *premainder_ie=NULL, *pbackup_remainder_ie=NULL; - uint offset, ielen, ie_offset, remainder_ielen = 0; - u8 *pie = pnetwork->IEs; - - p = rtw_get_ie(pie + _FIXED_IE_LENGTH_, index, &ielen, pnetwork->IELength - _FIXED_IE_LENGTH_); - if (p != NULL && ielen>0) - { - ielen += 2; - - premainder_ie = p+ielen; - - ie_offset = (sint)(p -pie); - - remainder_ielen = pnetwork->IELength - ie_offset - ielen; - - dst_ie = p; - } - else { - return; - } - - if(remainder_ielen>0) - { - pbackup_remainder_ie = rtw_malloc(remainder_ielen); - if(pbackup_remainder_ie && premainder_ie) - _rtw_memcpy(pbackup_remainder_ie, premainder_ie, remainder_ielen); - } - - //copy remainder IE - if(pbackup_remainder_ie) - { - _rtw_memcpy(dst_ie, pbackup_remainder_ie, remainder_ielen); - - rtw_mfree(pbackup_remainder_ie, remainder_ielen); - } - - offset = (uint)(dst_ie - pie); - pnetwork->IELength = offset + remainder_ielen; -} - - -u8 chk_sta_is_alive(struct sta_info *psta); -u8 chk_sta_is_alive(struct sta_info *psta) -{ - u8 ret = _FALSE; - #ifdef DBG_EXPIRATION_CHK - DBG_871X("sta:"MAC_FMT", rssi:%d, rx:"STA_PKTS_FMT", expire_to:%u, %s%ssq_len:%u\n" - , MAC_ARG(psta->hwaddr) - , psta->rssi_stat.UndecoratedSmoothedPWDB - //, STA_RX_PKTS_ARG(psta) - , STA_RX_PKTS_DIFF_ARG(psta) - , psta->expire_to - , psta->state&WIFI_SLEEP_STATE?"PS, ":"" - , psta->state&WIFI_STA_ALIVE_CHK_STATE?"SAC, ":"" - , psta->sleepq_len - ); - #endif - - //if(sta_last_rx_pkts(psta) == sta_rx_pkts(psta)) - if((psta->sta_stats.last_rx_data_pkts + psta->sta_stats.last_rx_ctrl_pkts) == (psta->sta_stats.rx_data_pkts + psta->sta_stats.rx_ctrl_pkts)) - { - #if 0 - if(psta->state&WIFI_SLEEP_STATE) - ret = _TRUE; - #endif - } - else - { - ret = _TRUE; - } - - sta_update_last_rx_pkts(psta); - - return ret; -} - -void expire_timeout_chk(struct adapter *padapter) -{ - _irqL irqL; - _list *phead, *plist; - u8 updated; - struct sta_info *psta=NULL; - struct sta_priv *pstapriv = &padapter->stapriv; - u8 chk_alive_num = 0; - char chk_alive_list[NUM_STA]; - int i; - - _enter_critical_bh(&pstapriv->auth_list_lock, &irqL); - - phead = &pstapriv->auth_list; - plist = get_next(phead); - - //check auth_queue - #ifdef DBG_EXPIRATION_CHK - if (rtw_end_of_queue_search(phead, plist) == _FALSE) { - DBG_871X(FUNC_NDEV_FMT" auth_list, cnt:%u\n" - , FUNC_NDEV_ARG(padapter->pnetdev), pstapriv->auth_list_cnt); - } - #endif - while ((rtw_end_of_queue_search(phead, plist)) == _FALSE) - { - psta = LIST_CONTAINOR(plist, struct sta_info, auth_list); - plist = get_next(plist); - - -#ifdef CONFIG_ATMEL_RC_PATCH - if (_TRUE == _rtw_memcmp((void *)(pstapriv->atmel_rc_pattern), (void *)(psta->hwaddr), ETH_ALEN)) - continue; - if (psta->flag_atmel_rc) - continue; -#endif - if(psta->expire_to>0) - { - psta->expire_to--; - if (psta->expire_to == 0) - { - rtw_list_delete(&psta->auth_list); - pstapriv->auth_list_cnt--; - - DBG_871X("auth expire %02X%02X%02X%02X%02X%02X\n", - psta->hwaddr[0],psta->hwaddr[1],psta->hwaddr[2],psta->hwaddr[3],psta->hwaddr[4],psta->hwaddr[5]); - - _exit_critical_bh(&pstapriv->auth_list_lock, &irqL); - - _enter_critical_bh(&(pstapriv->sta_hash_lock), &irqL); - rtw_free_stainfo(padapter, psta); - _exit_critical_bh(&(pstapriv->sta_hash_lock), &irqL); - - _enter_critical_bh(&pstapriv->auth_list_lock, &irqL); - } - } - - } - - _exit_critical_bh(&pstapriv->auth_list_lock, &irqL); - - psta = NULL; - - - _enter_critical_bh(&pstapriv->asoc_list_lock, &irqL); - - phead = &pstapriv->asoc_list; - plist = get_next(phead); - - //check asoc_queue - #ifdef DBG_EXPIRATION_CHK - if (rtw_end_of_queue_search(phead, plist) == _FALSE) { - DBG_871X(FUNC_NDEV_FMT" asoc_list, cnt:%u\n" - , FUNC_NDEV_ARG(padapter->pnetdev), pstapriv->asoc_list_cnt); - } - #endif - while ((rtw_end_of_queue_search(phead, plist)) == _FALSE) - { - psta = LIST_CONTAINOR(plist, struct sta_info, asoc_list); - plist = get_next(plist); -#ifdef CONFIG_ATMEL_RC_PATCH - DBG_871X("%s:%d psta=%p, %02x,%02x||%02x,%02x \n\n", __func__, __LINE__, - psta,pstapriv->atmel_rc_pattern[0], pstapriv->atmel_rc_pattern[5], psta->hwaddr[0], psta->hwaddr[5]); - if (_TRUE == _rtw_memcmp((void *)pstapriv->atmel_rc_pattern, (void *)(psta->hwaddr), ETH_ALEN)) - continue; - if (psta->flag_atmel_rc) - continue; - DBG_871X("%s: debug line:%d \n", __func__, __LINE__); -#endif - if (chk_sta_is_alive(psta) || !psta->expire_to) { - psta->expire_to = pstapriv->expire_to; - psta->keep_alive_trycnt = 0; - #ifdef CONFIG_TX_MCAST2UNI - psta->under_exist_checking = 0; - #endif // CONFIG_TX_MCAST2UNI - } else { - psta->expire_to--; - } - -#ifndef CONFIG_ACTIVE_KEEP_ALIVE_CHECK -#ifdef CONFIG_TX_MCAST2UNI -#ifdef CONFIG_80211N_HT - if ( (psta->flags & WLAN_STA_HT) && (psta->htpriv.agg_enable_bitmap || psta->under_exist_checking) ) { - // check sta by delba(addba) for 11n STA - // ToDo: use CCX report to check for all STAs - //DBG_871X("asoc check by DELBA/ADDBA! (pstapriv->expire_to=%d s)(psta->expire_to=%d s), [%02x, %d]\n", pstapriv->expire_to*2, psta->expire_to*2, psta->htpriv.agg_enable_bitmap, psta->under_exist_checking); - - if ( psta->expire_to <= (pstapriv->expire_to - 50 ) ) { - DBG_871X("asoc expire by DELBA/ADDBA! (%d s)\n", (pstapriv->expire_to-psta->expire_to)*2); - psta->under_exist_checking = 0; - psta->expire_to = 0; - } else if ( psta->expire_to <= (pstapriv->expire_to - 3) && (psta->under_exist_checking==0)) { - DBG_871X("asoc check by DELBA/ADDBA! (%d s)\n", (pstapriv->expire_to-psta->expire_to)*2); - psta->under_exist_checking = 1; - //tear down TX AMPDU - send_delba(padapter, 1, psta->hwaddr);// // originator - psta->htpriv.agg_enable_bitmap = 0x0;//reset - psta->htpriv.candidate_tid_bitmap = 0x0;//reset - } - } -#endif //CONFIG_80211N_HT -#endif // CONFIG_TX_MCAST2UNI -#endif //CONFIG_ACTIVE_KEEP_ALIVE_CHECK - - if (psta->expire_to <= 0) - { - #ifdef CONFIG_ACTIVE_KEEP_ALIVE_CHECK - struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; - - if (padapter->registrypriv.wifi_spec == 1) - { - psta->expire_to = pstapriv->expire_to; - continue; - } - - if (psta->state & WIFI_SLEEP_STATE) { - if (!(psta->state & WIFI_STA_ALIVE_CHK_STATE)) { - //to check if alive by another methods if staion is at ps mode. - psta->expire_to = pstapriv->expire_to; - psta->state |= WIFI_STA_ALIVE_CHK_STATE; - - //DBG_871X("alive chk, sta:" MAC_FMT " is at ps mode!\n", MAC_ARG(psta->hwaddr)); - - //to update bcn with tim_bitmap for this station - pstapriv->tim_bitmap |= BIT(psta->aid); - update_beacon(padapter, _TIM_IE_, NULL, _FALSE); - - if(!pmlmeext->active_keep_alive_check) - continue; - } - } - - if (pmlmeext->active_keep_alive_check) { - int stainfo_offset; - - stainfo_offset = rtw_stainfo_offset(pstapriv, psta); - if (stainfo_offset_valid(stainfo_offset)) { - chk_alive_list[chk_alive_num++] = stainfo_offset; - } - - continue; - } - #endif /* CONFIG_ACTIVE_KEEP_ALIVE_CHECK */ - - rtw_list_delete(&psta->asoc_list); - pstapriv->asoc_list_cnt--; - - DBG_871X("asoc expire "MAC_FMT", state=0x%x\n", MAC_ARG(psta->hwaddr), psta->state); - updated = ap_free_sta(padapter, psta, _FALSE, WLAN_REASON_DEAUTH_LEAVING); - } - else - { - /* TODO: Aging mechanism to digest frames in sleep_q to avoid running out of xmitframe */ - if (psta->sleepq_len > (NR_XMITFRAME/pstapriv->asoc_list_cnt) - && padapter->xmitpriv.free_xmitframe_cnt < ((NR_XMITFRAME/pstapriv->asoc_list_cnt)/2) - ){ - DBG_871X("%s sta:"MAC_FMT", sleepq_len:%u, free_xmitframe_cnt:%u, asoc_list_cnt:%u, clear sleep_q\n", __func__ - , MAC_ARG(psta->hwaddr) - , psta->sleepq_len, padapter->xmitpriv.free_xmitframe_cnt, pstapriv->asoc_list_cnt); - wakeup_sta_to_xmit(padapter, psta); - } - } - } - - _exit_critical_bh(&pstapriv->asoc_list_lock, &irqL); - -#ifdef CONFIG_ACTIVE_KEEP_ALIVE_CHECK -if (chk_alive_num) { - - u8 backup_oper_channel=0; - struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; - /* switch to correct channel of current network before issue keep-alive frames */ - if (rtw_get_oper_ch(padapter) != pmlmeext->cur_channel) { - backup_oper_channel = rtw_get_oper_ch(padapter); - SelectChannel(padapter, pmlmeext->cur_channel); - } - - /* issue null data to check sta alive*/ - for (i = 0; i < chk_alive_num; i++) { - - int ret = _FAIL; - - psta = rtw_get_stainfo_by_offset(pstapriv, chk_alive_list[i]); -#ifdef CONFIG_ATMEL_RC_PATCH - if (_TRUE == _rtw_memcmp( pstapriv->atmel_rc_pattern, psta->hwaddr, ETH_ALEN)) - continue; - if (psta->flag_atmel_rc) - continue; -#endif - if(!(psta->state &_FW_LINKED)) - continue; - - if (psta->state & WIFI_SLEEP_STATE) - ret = issue_nulldata(padapter, psta->hwaddr, 0, 1, 50); - else - ret = issue_nulldata(padapter, psta->hwaddr, 0, 3, 50); - - psta->keep_alive_trycnt++; - if (ret == _SUCCESS) - { - DBG_871X("asoc check, sta(" MAC_FMT ") is alive\n", MAC_ARG(psta->hwaddr)); - psta->expire_to = pstapriv->expire_to; - psta->keep_alive_trycnt = 0; - continue; - } - else if (psta->keep_alive_trycnt <= 3) - { - DBG_871X("ack check for asoc expire, keep_alive_trycnt=%d\n", psta->keep_alive_trycnt); - psta->expire_to = 1; - continue; - } - - psta->keep_alive_trycnt = 0; - - DBG_871X("asoc expire "MAC_FMT", state=0x%x\n", MAC_ARG(psta->hwaddr), psta->state); - _enter_critical_bh(&pstapriv->asoc_list_lock, &irqL); - if (rtw_is_list_empty(&psta->asoc_list)==_FALSE) { - rtw_list_delete(&psta->asoc_list); - pstapriv->asoc_list_cnt--; - updated = ap_free_sta(padapter, psta, _FALSE, WLAN_REASON_DEAUTH_LEAVING); - } - _exit_critical_bh(&pstapriv->asoc_list_lock, &irqL); - - } - - if (backup_oper_channel>0) /* back to the original operation channel */ - SelectChannel(padapter, backup_oper_channel); -} -#endif /* CONFIG_ACTIVE_KEEP_ALIVE_CHECK */ - - associated_clients_update(padapter, updated); -} - -void add_RATid(struct adapter *padapter, struct sta_info *psta, u8 rssi_level) -{ - int i; - u8 rf_type; - u32 init_rate=0; - unsigned char sta_band = 0, raid, shortGIrate = _FALSE; - unsigned char limit; - unsigned int tx_ra_bitmap=0; - struct ht_priv *psta_ht = NULL; - struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); - WLAN_BSSID_EX *pcur_network = (WLAN_BSSID_EX *)&pmlmepriv->cur_network.network; - -#ifdef CONFIG_80211N_HT - if(psta) - psta_ht = &psta->htpriv; - else - return; -#endif //CONFIG_80211N_HT - - if(!(psta->state & _FW_LINKED)) - return; - - //b/g mode ra_bitmap - for (i=0; ibssrateset); i++) - { - if (psta->bssrateset[i]) - tx_ra_bitmap |= rtw_get_bit_value_from_ieee_value(psta->bssrateset[i]&0x7f); - } -#ifdef CONFIG_80211N_HT - //n mode ra_bitmap - if(psta_ht->ht_option) - { - rtw_hal_get_hwreg(padapter, HW_VAR_RF_TYPE, (u8 *)(&rf_type)); - if(rf_type == RF_2T2R) - limit=16;// 2R - else - limit=8;// 1R - - for (i=0; iht_cap.supp_mcs_set[i/8] & BIT(i%8)) - tx_ra_bitmap |= BIT(i+12); - } - - //max short GI rate - shortGIrate = psta_ht->sgi; - } -#endif //CONFIG_80211N_HT - -#if 0//gtest - if(get_rf_mimo_mode(padapter) == RTL8712_RF_2T2R) - { - //is this a 2r STA? - if((pstat->tx_ra_bitmap & 0x0ff00000) != 0 && !(priv->pshare->has_2r_sta & BIT(pstat->aid))) - { - priv->pshare->has_2r_sta |= BIT(pstat->aid); - if(rtw_read16(padapter, 0x102501f6) != 0xffff) - { - rtw_write16(padapter, 0x102501f6, 0xffff); - reset_1r_sta_RA(priv, 0xffff); - Switch_1SS_Antenna(priv, 3); - } - } - else// bg or 1R STA? - { - if((priv->pmib->dot11BssType.net_work_type & WIRELESS_11N) && pstat->ht_cap_len && priv->pshare->has_2r_sta == 0) - { - if(rtw_read16(padapter, 0x102501f6) != 0x7777) - { // MCS7 SGI - rtw_write16(padapter, 0x102501f6,0x7777); - reset_1r_sta_RA(priv, 0x7777); - Switch_1SS_Antenna(priv, 2); - } - } - } - - } - - if ((pstat->rssi_level < 1) || (pstat->rssi_level > 3)) - { - if (pstat->rssi >= priv->pshare->rf_ft_var.raGoDownUpper) - pstat->rssi_level = 1; - else if ((pstat->rssi >= priv->pshare->rf_ft_var.raGoDown20MLower) || - ((priv->pshare->is_40m_bw) && (pstat->ht_cap_len) && - (pstat->rssi >= priv->pshare->rf_ft_var.raGoDown40MLower) && - (pstat->ht_cap_buf.ht_cap_info & cpu_to_le16(_HTCAP_SUPPORT_CH_WDTH_)))) - pstat->rssi_level = 2; - else - pstat->rssi_level = 3; - } - - // rate adaptive by rssi - if ((priv->pmib->dot11BssType.net_work_type & WIRELESS_11N) && pstat->ht_cap_len) - { - if ((get_rf_mimo_mode(priv) == MIMO_1T2R) || (get_rf_mimo_mode(priv) == MIMO_1T1R)) - { - switch (pstat->rssi_level) { - case 1: - pstat->tx_ra_bitmap &= 0x100f0000; - break; - case 2: - pstat->tx_ra_bitmap &= 0x100ff000; - break; - case 3: - if (priv->pshare->is_40m_bw) - pstat->tx_ra_bitmap &= 0x100ff005; - else - pstat->tx_ra_bitmap &= 0x100ff001; - - break; - } - } - else - { - switch (pstat->rssi_level) { - case 1: - pstat->tx_ra_bitmap &= 0x1f0f0000; - break; - case 2: - pstat->tx_ra_bitmap &= 0x1f0ff000; - break; - case 3: - if (priv->pshare->is_40m_bw) - pstat->tx_ra_bitmap &= 0x000ff005; - else - pstat->tx_ra_bitmap &= 0x000ff001; - - break; - } - - // Don't need to mask high rates due to new rate adaptive parameters - //if (pstat->is_broadcom_sta) // use MCS12 as the highest rate vs. Broadcom sta - // pstat->tx_ra_bitmap &= 0x81ffffff; - - // NIC driver will report not supporting MCS15 and MCS14 in asoc req - //if (pstat->is_rtl8190_sta && !pstat->is_2t_mimo_sta) - // pstat->tx_ra_bitmap &= 0x83ffffff; // if Realtek 1x2 sta, don't use MCS15 and MCS14 - } - } - else if ((priv->pmib->dot11BssType.net_work_type & WIRELESS_11G) && isErpSta(pstat)) - { - switch (pstat->rssi_level) { - case 1: - pstat->tx_ra_bitmap &= 0x00000f00; - break; - case 2: - pstat->tx_ra_bitmap &= 0x00000ff0; - break; - case 3: - pstat->tx_ra_bitmap &= 0x00000ff5; - break; - } - } - else - { - pstat->tx_ra_bitmap &= 0x0000000d; - } - - // disable tx short GI when station cannot rx MCS15(AP is 2T2R) - // disable tx short GI when station cannot rx MCS7 (AP is 1T2R or 1T1R) - // if there is only 1r STA and we are 2T2R, DO NOT mask SGI rate - if ((!(pstat->tx_ra_bitmap & 0x8000000) && (priv->pshare->has_2r_sta > 0) && (get_rf_mimo_mode(padapter) == RTL8712_RF_2T2R)) || - (!(pstat->tx_ra_bitmap & 0x80000) && (get_rf_mimo_mode(padapter) != RTL8712_RF_2T2R))) - { - pstat->tx_ra_bitmap &= ~BIT(28); - } -#endif - - if ( pcur_network->Configuration.DSConfig > 14 ) { - // 5G band - if (tx_ra_bitmap & 0xffff000) - sta_band |= WIRELESS_11_5N ; - - if (tx_ra_bitmap & 0xff0) - sta_band |= WIRELESS_11A; - - } else { - if (tx_ra_bitmap & 0xffff000) - sta_band |= WIRELESS_11_24N; - - if (tx_ra_bitmap & 0xff0) - sta_band |= WIRELESS_11G; - - if (tx_ra_bitmap & 0x0f) - sta_band |= WIRELESS_11B; - } - - psta->wireless_mode = sta_band; - - raid = networktype_to_raid(sta_band); - init_rate = get_highest_rate_idx(tx_ra_bitmap&0x0fffffff)&0x3f; - - if (psta->aid < NUM_STA) - { - u8 arg = 0; - - arg = psta->mac_id&0x1f; - - arg |= BIT(7);//support entry 2~31 - - if (shortGIrate==_TRUE) - arg |= BIT(5); - - tx_ra_bitmap |= ((raid<<28)&0xf0000000); - - DBG_871X("%s=> mac_id:%d , raid:%d , bitmap=0x%x, arg=0x%x\n", - __FUNCTION__ , psta->mac_id, raid ,tx_ra_bitmap, arg); - - //bitmap[0:27] = tx_rate_bitmap - //bitmap[28:31]= Rate Adaptive id - //arg[0:4] = macid - //arg[5] = Short GI - rtw_hal_add_ra_tid(padapter, tx_ra_bitmap, arg, rssi_level); - - - if (shortGIrate==_TRUE) - init_rate |= BIT(6); - - //set ra_id, init_rate - psta->raid = raid; - psta->init_rate = init_rate; - - } - else - { - DBG_871X("station aid %d exceed the max number\n", psta->aid); - } - -} - -void update_bmc_sta(struct adapter *padapter) -{ - _irqL irqL; - u32 init_rate=0; - unsigned char network_type, raid; - int i, supportRateNum = 0; - unsigned int tx_ra_bitmap=0; - struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); - WLAN_BSSID_EX *pcur_network = (WLAN_BSSID_EX *)&pmlmepriv->cur_network.network; - struct sta_info *psta = rtw_get_bcmc_stainfo(padapter); - - if(psta) - { - psta->aid = 0;//default set to 0 - //psta->mac_id = psta->aid+4; - psta->mac_id = psta->aid + 1; - - psta->qos_option = 0; -#ifdef CONFIG_80211N_HT - psta->htpriv.ht_option = _FALSE; -#endif //CONFIG_80211N_HT - - psta->ieee8021x_blocked = 0; - - _rtw_memset((void*)&psta->sta_stats, 0, sizeof(struct stainfo_stats)); - - //psta->dot118021XPrivacy = _NO_PRIVACY_;//!!! remove it, because it has been set before this. - - - - //prepare for add_RATid - supportRateNum = rtw_get_rateset_len((u8*)&pcur_network->SupportedRates); - network_type = rtw_check_network_type((u8*)&pcur_network->SupportedRates, supportRateNum, 1); - - _rtw_memcpy(psta->bssrateset, &pcur_network->SupportedRates, supportRateNum); - psta->bssratelen = supportRateNum; - - //b/g mode ra_bitmap - for (i=0; ibssrateset[i]) - tx_ra_bitmap |= rtw_get_bit_value_from_ieee_value(psta->bssrateset[i]&0x7f); - } - - if ( pcur_network->Configuration.DSConfig > 14 ) { - //force to A mode. 5G doesn't support CCK rates - network_type = WIRELESS_11A; - tx_ra_bitmap = 0x150; // 6, 12, 24 Mbps - } else { - //force to b mode - network_type = WIRELESS_11B; - tx_ra_bitmap = 0xf; - } - - //tx_ra_bitmap = update_basic_rate(pcur_network->SupportedRates, supportRateNum); - - raid = networktype_to_raid(network_type); - init_rate = get_highest_rate_idx(tx_ra_bitmap&0x0fffffff)&0x3f; - - //DBG_871X("Add id %d val %08x to ratr for bmc sta\n", psta->aid, tx_ra_bitmap); - //ap mode - rtw_hal_set_odm_var(padapter, HAL_ODM_STA_INFO, psta, _TRUE); - - //if(pHalData->fw_ractrl == _TRUE) - { - u8 arg = 0; - - arg = psta->mac_id&0x1f; - - arg |= BIT(7); - - //if (shortGIrate==_TRUE) - // arg |= BIT(5); - - tx_ra_bitmap |= ((raid<<28)&0xf0000000); - - DBG_871X("update_bmc_sta, mask=0x%x, arg=0x%x\n", tx_ra_bitmap, arg); - - //bitmap[0:27] = tx_rate_bitmap - //bitmap[28:31]= Rate Adaptive id - //arg[0:4] = macid - //arg[5] = Short GI - rtw_hal_add_ra_tid(padapter, tx_ra_bitmap, arg, 0); - - } - - //set ra_id, init_rate - psta->raid = raid; - psta->init_rate = init_rate; - - rtw_sta_media_status_rpt(padapter, psta, 1); - - _enter_critical_bh(&psta->lock, &irqL); - psta->state = _FW_LINKED; - _exit_critical_bh(&psta->lock, &irqL); - - } - else - { - DBG_871X("add_RATid_bmc_sta error!\n"); - } - -} - -//notes: -//AID: 1~MAX for sta and 0 for bc/mc in ap/adhoc mode -//MAC_ID = AID+1 for sta in ap/adhoc mode -//MAC_ID = 1 for bc/mc for sta/ap/adhoc -//MAC_ID = 0 for bssid for sta/ap/adhoc -//CAM_ID = //0~3 for default key, cmd_id=macid + 3, macid=aid+1; - -void update_sta_info_apmode(struct adapter *padapter, struct sta_info *psta) -{ - _irqL irqL; - struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); - struct security_priv *psecuritypriv = &padapter->securitypriv; - struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); -#ifdef CONFIG_80211N_HT - struct ht_priv *phtpriv_ap = &pmlmepriv->htpriv; - struct ht_priv *phtpriv_sta = &psta->htpriv; -#endif //CONFIG_80211N_HT - //set intf_tag to if1 - //psta->intf_tag = 0; - - //psta->mac_id = psta->aid+4; - psta->mac_id = psta->aid+1; - DBG_871X("%s\n",__FUNCTION__); - - //ap mode - rtw_hal_set_odm_var(padapter,HAL_ODM_STA_INFO,psta,_TRUE); - - if(psecuritypriv->dot11AuthAlgrthm==dot11AuthAlgrthm_8021X) - psta->ieee8021x_blocked = _TRUE; - else - psta->ieee8021x_blocked = _FALSE; - - - //update sta's cap - - //ERP - VCS_update(padapter, psta); -#ifdef CONFIG_80211N_HT - //HT related cap - if(phtpriv_sta->ht_option) - { - //check if sta supports rx ampdu - phtpriv_sta->ampdu_enable = phtpriv_ap->ampdu_enable; - - //check if sta support s Short GI - if((phtpriv_sta->ht_cap.cap_info & phtpriv_ap->ht_cap.cap_info) & cpu_to_le16(IEEE80211_HT_CAP_SGI_20|IEEE80211_HT_CAP_SGI_40)) - { - phtpriv_sta->sgi = _TRUE; - } - - // bwmode - if((phtpriv_sta->ht_cap.cap_info & phtpriv_ap->ht_cap.cap_info) & cpu_to_le16(IEEE80211_HT_CAP_SUP_WIDTH)) - { - //phtpriv_sta->bwmode = HT_CHANNEL_WIDTH_40; - phtpriv_sta->bwmode = pmlmeext->cur_bwmode; - phtpriv_sta->ch_offset = pmlmeext->cur_ch_offset; - - } - - psta->qos_option = _TRUE; - - } - else - { - phtpriv_sta->ampdu_enable = _FALSE; - - phtpriv_sta->sgi = _FALSE; - phtpriv_sta->bwmode = HT_CHANNEL_WIDTH_20; - phtpriv_sta->ch_offset = HAL_PRIME_CHNL_OFFSET_DONT_CARE; - } - - //Rx AMPDU - send_delba(padapter, 0, psta->hwaddr);// recipient - - //TX AMPDU - send_delba(padapter, 1, psta->hwaddr);// // originator - phtpriv_sta->agg_enable_bitmap = 0x0;//reset - phtpriv_sta->candidate_tid_bitmap = 0x0;//reset -#endif //CONFIG_80211N_HT - - //todo: init other variables - - _rtw_memset((void*)&psta->sta_stats, 0, sizeof(struct stainfo_stats)); - - - //add ratid - //add_RATid(padapter, psta);//move to ap_sta_info_defer_update() - - - _enter_critical_bh(&psta->lock, &irqL); - psta->state |= _FW_LINKED; - _exit_critical_bh(&psta->lock, &irqL); - - -} - -static void update_hw_ht_param(struct adapter *padapter) -{ - unsigned char max_AMPDU_len; - unsigned char min_MPDU_spacing; - struct registry_priv *pregpriv = &padapter->registrypriv; - struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; - struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); - - DBG_871X("%s\n", __FUNCTION__); - - - //handle A-MPDU parameter field - /* - AMPDU_para [1:0]:Max AMPDU Len => 0:8k , 1:16k, 2:32k, 3:64k - AMPDU_para [4:2]:Min MPDU Start Spacing - */ - max_AMPDU_len = pmlmeinfo->HT_caps.u.HT_cap_element.AMPDU_para & 0x03; - - min_MPDU_spacing = (pmlmeinfo->HT_caps.u.HT_cap_element.AMPDU_para & 0x1c) >> 2; - - rtw_hal_set_hwreg(padapter, HW_VAR_AMPDU_MIN_SPACE, (u8 *)(&min_MPDU_spacing)); - - rtw_hal_set_hwreg(padapter, HW_VAR_AMPDU_FACTOR, (u8 *)(&max_AMPDU_len)); - - // - // Config SM Power Save setting - // - pmlmeinfo->SM_PS = (pmlmeinfo->HT_caps.u.HT_cap_element.HT_caps_info & 0x0C) >> 2; - if(pmlmeinfo->SM_PS == WLAN_HT_CAP_SM_PS_STATIC) - { - /*u8 i; - //update the MCS rates - for (i = 0; i < 16; i++) - { - pmlmeinfo->HT_caps.HT_cap_element.MCS_rate[i] &= MCS_rate_1R[i]; - }*/ - DBG_871X("%s(): WLAN_HT_CAP_SM_PS_STATIC\n",__FUNCTION__); - } - - // - // Config current HT Protection mode. - // - //pmlmeinfo->HT_protection = pmlmeinfo->HT_info.infos[1] & 0x3; - -} - -static void start_bss_network(struct adapter *padapter, u8 *pbuf) -{ - u8 *p; - u8 val8, cur_channel, cur_bwmode, cur_ch_offset; - u16 bcn_interval; - u32 acparm; - int ie_len; - struct registry_priv *pregpriv = &padapter->registrypriv; - struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); - struct security_priv* psecuritypriv=&(padapter->securitypriv); - WLAN_BSSID_EX *pnetwork = (WLAN_BSSID_EX *)&pmlmepriv->cur_network.network; - struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); - struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); - WLAN_BSSID_EX *pnetwork_mlmeext = &(pmlmeinfo->network); - struct HT_info_element *pht_info=NULL; -#ifdef CONFIG_P2P - struct wifidirect_info *pwdinfo = &(padapter->wdinfo); -#endif //CONFIG_P2P - - //DBG_871X("%s\n", __FUNCTION__); - - bcn_interval = (u16)pnetwork->Configuration.BeaconPeriod; - cur_channel = pnetwork->Configuration.DSConfig; - cur_bwmode = HT_CHANNEL_WIDTH_20;; - cur_ch_offset = HAL_PRIME_CHNL_OFFSET_DONT_CARE; - - - //check if there is wps ie, - //if there is wpsie in beacon, the hostapd will update beacon twice when stating hostapd, - //and at first time the security ie ( RSN/WPA IE) will not include in beacon. - if(NULL == rtw_get_wps_ie(pnetwork->IEs+_FIXED_IE_LENGTH_, pnetwork->IELength-_FIXED_IE_LENGTH_, NULL, NULL)) - { - pmlmeext->bstart_bss = _TRUE; - } - - //todo: update wmm, ht cap - //pmlmeinfo->WMM_enable; - //pmlmeinfo->HT_enable; - if(pmlmepriv->qospriv.qos_option) - pmlmeinfo->WMM_enable = _TRUE; -#ifdef CONFIG_80211N_HT - if(pmlmepriv->htpriv.ht_option) - { - pmlmeinfo->WMM_enable = _TRUE; - pmlmeinfo->HT_enable = _TRUE; - //pmlmeinfo->HT_info_enable = _TRUE; - //pmlmeinfo->HT_caps_enable = _TRUE; - - update_hw_ht_param(padapter); - } -#endif //#CONFIG_80211N_HT - - - if(pmlmepriv->cur_network.join_res != _TRUE) //setting only at first time - { - //WEP Key will be set before this function, do not clear CAM. - if ((psecuritypriv->dot11PrivacyAlgrthm != _WEP40_) && (psecuritypriv->dot11PrivacyAlgrthm != _WEP104_)) - flush_all_cam_entry(padapter); //clear CAM - } - - //set MSR to AP_Mode - Set_MSR(padapter, _HW_STATE_AP_); - - //Set BSSID REG - rtw_hal_set_hwreg(padapter, HW_VAR_BSSID, pnetwork->MacAddress); - - //Set EDCA param reg -#ifdef CONFIG_CONCURRENT_MODE - acparm = 0x005ea42b; -#else - acparm = 0x002F3217; // VO -#endif - rtw_hal_set_hwreg(padapter, HW_VAR_AC_PARAM_VO, (u8 *)(&acparm)); - acparm = 0x005E4317; // VI - rtw_hal_set_hwreg(padapter, HW_VAR_AC_PARAM_VI, (u8 *)(&acparm)); - //acparm = 0x00105320; // BE - acparm = 0x005ea42b; - rtw_hal_set_hwreg(padapter, HW_VAR_AC_PARAM_BE, (u8 *)(&acparm)); - acparm = 0x0000A444; // BK - rtw_hal_set_hwreg(padapter, HW_VAR_AC_PARAM_BK, (u8 *)(&acparm)); - - //Set Security - val8 = (psecuritypriv->dot11AuthAlgrthm == dot11AuthAlgrthm_8021X)? 0xcc: 0xcf; - rtw_hal_set_hwreg(padapter, HW_VAR_SEC_CFG, (u8 *)(&val8)); - - //Beacon Control related register - rtw_hal_set_hwreg(padapter, HW_VAR_BEACON_INTERVAL, (u8 *)(&bcn_interval)); - - - UpdateBrateTbl(padapter, pnetwork->SupportedRates); - rtw_hal_set_hwreg(padapter, HW_VAR_BASIC_RATE, pnetwork->SupportedRates); - - if(pmlmepriv->cur_network.join_res != _TRUE) //setting only at first time - { - //u32 initialgain; - - //initialgain = 0x1e; - - - //disable dynamic functions, such as high power, DIG - //Save_DM_Func_Flag(padapter); - //Switch_DM_Func(padapter, DYNAMIC_FUNC_DISABLE, _FALSE); - -#ifdef CONFIG_CONCURRENT_MODE - if(padapter->adapter_type > PRIMARY_ADAPTER) - { - if(rtw_buddy_adapter_up(padapter)) - { - struct adapter *pbuddy_adapter = padapter->pbuddy_adapter; - - //turn on all dynamic functions on PRIMARY_ADAPTER, dynamic functions only runs at PRIMARY_ADAPTER - Switch_DM_Func(pbuddy_adapter, DYNAMIC_ALL_FUNC_ENABLE, _TRUE); - - //rtw_hal_set_hwreg(pbuddy_adapter, HW_VAR_INITIAL_GAIN, (u8 *)(&initialgain)); - } - } - else -#endif - { - //turn on all dynamic functions - Switch_DM_Func(padapter, DYNAMIC_ALL_FUNC_ENABLE, _TRUE); - - //rtw_hal_set_hwreg(padapter, HW_VAR_INITIAL_GAIN, (u8 *)(&initialgain)); - } - - } -#ifdef CONFIG_80211N_HT - //set channel, bwmode - p = rtw_get_ie((pnetwork->IEs + sizeof(NDIS_802_11_FIXED_IEs)), _HT_ADD_INFO_IE_, &ie_len, (pnetwork->IELength - sizeof(NDIS_802_11_FIXED_IEs))); - if( p && ie_len) - { - pht_info = (struct HT_info_element *)(p+2); - - if ((pregpriv->cbw40_enable) && (pht_info->infos[0] & BIT(2))) - { - //switch to the 40M Hz mode - //pmlmeext->cur_bwmode = HT_CHANNEL_WIDTH_40; - cur_bwmode = HT_CHANNEL_WIDTH_40; - switch (pht_info->infos[0] & 0x3) - { - case 1: - //pmlmeext->cur_ch_offset = HAL_PRIME_CHNL_OFFSET_LOWER; - cur_ch_offset = HAL_PRIME_CHNL_OFFSET_LOWER; - break; - - case 3: - //pmlmeext->cur_ch_offset = HAL_PRIME_CHNL_OFFSET_UPPER; - cur_ch_offset = HAL_PRIME_CHNL_OFFSET_UPPER; - break; - - default: - //pmlmeext->cur_ch_offset = HAL_PRIME_CHNL_OFFSET_DONT_CARE; - cur_ch_offset = HAL_PRIME_CHNL_OFFSET_DONT_CARE; - break; - } - - } - - } -#endif //CONFIG_80211N_HT -#ifdef CONFIG_DUALMAC_CONCURRENT - dc_set_ap_channel_bandwidth(padapter, cur_channel, cur_ch_offset, cur_bwmode); -#else - //TODO: need to judge the phy parameters on concurrent mode for single phy - //set_channel_bwmode(padapter, pmlmeext->cur_channel, pmlmeext->cur_ch_offset, pmlmeext->cur_bwmode); -#ifdef CONFIG_CONCURRENT_MODE - if(!check_buddy_fwstate(padapter, _FW_LINKED|_FW_UNDER_LINKING|_FW_UNDER_SURVEY)) - { - set_channel_bwmode(padapter, cur_channel, cur_ch_offset, cur_bwmode); - } - else if(check_buddy_fwstate(padapter, _FW_LINKED)==_TRUE)//only second adapter can enter AP Mode - { - struct adapter *pbuddy_adapter = padapter->pbuddy_adapter; - struct mlme_ext_priv *pbuddy_mlmeext = &pbuddy_adapter->mlmeextpriv; - - //To sync cur_channel/cur_bwmode/cur_ch_offset with primary adapter - DBG_871X("primary iface is at linked state, sync cur_channel/cur_bwmode/cur_ch_offset\n"); - DBG_871X("primary adapter, CH=%d, BW=%d, offset=%d\n", pbuddy_mlmeext->cur_channel, pbuddy_mlmeext->cur_bwmode, pbuddy_mlmeext->cur_ch_offset); - DBG_871X("second adapter, CH=%d, BW=%d, offset=%d\n", cur_channel, cur_bwmode, cur_ch_offset); - - cur_channel = pbuddy_mlmeext->cur_channel; - if(cur_bwmode == HT_CHANNEL_WIDTH_40) - { - if(pht_info) - pht_info->infos[0] &= ~(BIT(0)|BIT(1)); - - if(pbuddy_mlmeext->cur_bwmode == HT_CHANNEL_WIDTH_40) - { - cur_ch_offset = pbuddy_mlmeext->cur_ch_offset; - - //to update cur_ch_offset value in beacon - if(pht_info) - { - switch(cur_ch_offset) - { - case HAL_PRIME_CHNL_OFFSET_LOWER: - pht_info->infos[0] |= 0x1; - break; - case HAL_PRIME_CHNL_OFFSET_UPPER: - pht_info->infos[0] |= 0x3; - break; - case HAL_PRIME_CHNL_OFFSET_DONT_CARE: - default: - break; - } - } - - } - else if(pbuddy_mlmeext->cur_bwmode == HT_CHANNEL_WIDTH_20) - { - cur_bwmode = HT_CHANNEL_WIDTH_20; - cur_ch_offset = HAL_PRIME_CHNL_OFFSET_DONT_CARE; - - if(cur_channel>0 && cur_channel<5) - { - if(pht_info) - pht_info->infos[0] |= 0x1; - - cur_bwmode = HT_CHANNEL_WIDTH_40; - cur_ch_offset = HAL_PRIME_CHNL_OFFSET_LOWER; - } - - if(cur_channel>7 && cur_channel<(14+1)) - { - if(pht_info) - pht_info->infos[0] |= 0x3; - - cur_bwmode = HT_CHANNEL_WIDTH_40; - cur_ch_offset = HAL_PRIME_CHNL_OFFSET_UPPER; - } - - set_channel_bwmode(padapter, cur_channel, cur_ch_offset, cur_bwmode); - } - - } - - // to update channel value in beacon - pnetwork->Configuration.DSConfig = cur_channel; - p = rtw_get_ie((pnetwork->IEs + sizeof(NDIS_802_11_FIXED_IEs)), _DSSET_IE_, &ie_len, (pnetwork->IELength - sizeof(NDIS_802_11_FIXED_IEs))); - if(p && ie_len>0) - *(p + 2) = cur_channel; - - if(pht_info) - pht_info->primary_channel = cur_channel; - } -#else - set_channel_bwmode(padapter, cur_channel, cur_ch_offset, cur_bwmode); -#endif //CONFIG_CONCURRENT_MODE - - DBG_871X("CH=%d, BW=%d, offset=%d\n", cur_channel, cur_bwmode, cur_ch_offset); - - // - pmlmeext->cur_channel = cur_channel; - pmlmeext->cur_bwmode = cur_bwmode; - pmlmeext->cur_ch_offset = cur_ch_offset; -#endif //CONFIG_DUALMAC_CONCURRENT - pmlmeext->cur_wireless_mode = pmlmepriv->cur_network.network_type; - - //let pnetwork_mlmeext == pnetwork_mlme. - _rtw_memcpy(pnetwork_mlmeext, pnetwork, pnetwork->Length); - - //update cur_wireless_mode - update_wireless_mode(padapter); - - //udpate capability after cur_wireless_mode updated - update_capinfo(padapter, rtw_get_capability((WLAN_BSSID_EX *)pnetwork)); - -#ifdef CONFIG_P2P - _rtw_memcpy(pwdinfo->p2p_group_ssid, pnetwork->Ssid.Ssid, pnetwork->Ssid.SsidLength); - pwdinfo->p2p_group_ssid_len = pnetwork->Ssid.SsidLength; -#endif //CONFIG_P2P - - if(_TRUE == pmlmeext->bstart_bss) - { - update_beacon(padapter, _TIM_IE_, NULL, _FALSE); - -#ifndef CONFIG_INTERRUPT_BASED_TXBCN //other case will tx beacon when bcn interrupt coming in. -#if defined(CONFIG_USB_HCI) || defined(CONFIG_SDIO_HCI) || defined(CONFIG_GSPI_HCI) - //issue beacon frame - if(send_beacon(padapter)==_FAIL) - { - DBG_871X("issue_beacon, fail!\n"); - } -#endif -#endif //!CONFIG_INTERRUPT_BASED_TXBCN - - } - - - //update bc/mc sta_info - update_bmc_sta(padapter); - - //pmlmeext->bstart_bss = _TRUE; - -} - -int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf, int len) -{ - int ret=_SUCCESS; - u8 *p; - u8 *pHT_caps_ie=NULL; - u8 *pHT_info_ie=NULL; - struct sta_info *psta = NULL; - u16 cap, ht_cap=_FALSE; - uint ie_len = 0; - int group_cipher, pairwise_cipher; - u8 channel, network_type, supportRate[NDIS_802_11_LENGTH_RATES_EX]; - int supportRateNum = 0; - u8 OUI1[] = {0x00, 0x50, 0xf2,0x01}; - u8 wps_oui[4]={0x0,0x50,0xf2,0x04}; - u8 WMM_PARA_IE[] = {0x00, 0x50, 0xf2, 0x02, 0x01, 0x01}; - struct registry_priv *pregistrypriv = &padapter->registrypriv; - struct security_priv *psecuritypriv = &padapter->securitypriv; - struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); - WLAN_BSSID_EX *pbss_network = (WLAN_BSSID_EX *)&pmlmepriv->cur_network.network; - struct sta_priv *pstapriv = &padapter->stapriv; - u8 *ie = pbss_network->IEs; - - - /* SSID */ - /* Supported rates */ - /* DS Params */ - /* WLAN_EID_COUNTRY */ - /* ERP Information element */ - /* Extended supported rates */ - /* WPA/WPA2 */ - /* Wi-Fi Wireless Multimedia Extensions */ - /* ht_capab, ht_oper */ - /* WPS IE */ - - DBG_871X("%s, len=%d\n", __FUNCTION__, len); - - if(check_fwstate(pmlmepriv, WIFI_AP_STATE) != _TRUE) - return _FAIL; - - - if(len>MAX_IE_SZ) - return _FAIL; - - pbss_network->IELength = len; - - _rtw_memset(ie, 0, MAX_IE_SZ); - - _rtw_memcpy(ie, pbuf, pbss_network->IELength); - - - if(pbss_network->InfrastructureMode!=Ndis802_11APMode) - return _FAIL; - - pbss_network->Rssi = 0; - - _rtw_memcpy(pbss_network->MacAddress, myid(&(padapter->eeprompriv)), ETH_ALEN); - - //beacon interval - p = rtw_get_beacon_interval_from_ie(ie);//ie + 8; // 8: TimeStamp, 2: Beacon Interval 2:Capability - //pbss_network->Configuration.BeaconPeriod = le16_to_cpu(*(unsigned short*)p); - pbss_network->Configuration.BeaconPeriod = RTW_GET_LE16(p); - - //capability - //cap = *(unsigned short *)rtw_get_capability_from_ie(ie); - //cap = le16_to_cpu(cap); - cap = RTW_GET_LE16(ie); - - //SSID - p = rtw_get_ie(ie + _BEACON_IE_OFFSET_, _SSID_IE_, &ie_len, (pbss_network->IELength -_BEACON_IE_OFFSET_)); - if(p && ie_len>0) - { - _rtw_memset(&pbss_network->Ssid, 0, sizeof(NDIS_802_11_SSID)); - _rtw_memcpy(pbss_network->Ssid.Ssid, (p + 2), ie_len); - pbss_network->Ssid.SsidLength = ie_len; - } - - //chnnel - channel = 0; - pbss_network->Configuration.Length = 0; - p = rtw_get_ie(ie + _BEACON_IE_OFFSET_, _DSSET_IE_, &ie_len, (pbss_network->IELength - _BEACON_IE_OFFSET_)); - if(p && ie_len>0) - channel = *(p + 2); - - pbss_network->Configuration.DSConfig = channel; - - - _rtw_memset(supportRate, 0, NDIS_802_11_LENGTH_RATES_EX); - // get supported rates - p = rtw_get_ie(ie + _BEACON_IE_OFFSET_, _SUPPORTEDRATES_IE_, &ie_len, (pbss_network->IELength - _BEACON_IE_OFFSET_)); - if (p != NULL) - { - _rtw_memcpy(supportRate, p+2, ie_len); - supportRateNum = ie_len; - } - - //get ext_supported rates - p = rtw_get_ie(ie + _BEACON_IE_OFFSET_, _EXT_SUPPORTEDRATES_IE_, &ie_len, pbss_network->IELength - _BEACON_IE_OFFSET_); - if (p != NULL) - { - _rtw_memcpy(supportRate+supportRateNum, p+2, ie_len); - supportRateNum += ie_len; - - } - - network_type = rtw_check_network_type(supportRate, supportRateNum, channel); - - rtw_set_supported_rate(pbss_network->SupportedRates, network_type); - - - //parsing ERP_IE - p = rtw_get_ie(ie + _BEACON_IE_OFFSET_, _ERPINFO_IE_, &ie_len, (pbss_network->IELength - _BEACON_IE_OFFSET_)); - if(p && ie_len>0) - { - ERP_IE_handler(padapter, (PNDIS_802_11_VARIABLE_IEs)p); - } - - //update privacy/security - if (cap & BIT(4)) - pbss_network->Privacy = 1; - else - pbss_network->Privacy = 0; - - psecuritypriv->wpa_psk = 0; - - //wpa2 - group_cipher = 0; pairwise_cipher = 0; - psecuritypriv->wpa2_group_cipher = _NO_PRIVACY_; - psecuritypriv->wpa2_pairwise_cipher = _NO_PRIVACY_; - p = rtw_get_ie(ie + _BEACON_IE_OFFSET_, _RSN_IE_2_, &ie_len, (pbss_network->IELength - _BEACON_IE_OFFSET_)); - if(p && ie_len>0) - { - if(rtw_parse_wpa2_ie(p, ie_len+2, &group_cipher, &pairwise_cipher, NULL) == _SUCCESS) - { - psecuritypriv->dot11AuthAlgrthm= dot11AuthAlgrthm_8021X; - - psecuritypriv->dot8021xalg = 1;//psk, todo:802.1x - psecuritypriv->wpa_psk |= BIT(1); - - psecuritypriv->wpa2_group_cipher = group_cipher; - psecuritypriv->wpa2_pairwise_cipher = pairwise_cipher; -#if 0 - switch(group_cipher) - { - case WPA_CIPHER_NONE: - psecuritypriv->wpa2_group_cipher = _NO_PRIVACY_; - break; - case WPA_CIPHER_WEP40: - psecuritypriv->wpa2_group_cipher = _WEP40_; - break; - case WPA_CIPHER_TKIP: - psecuritypriv->wpa2_group_cipher = _TKIP_; - break; - case WPA_CIPHER_CCMP: - psecuritypriv->wpa2_group_cipher = _AES_; - break; - case WPA_CIPHER_WEP104: - psecuritypriv->wpa2_group_cipher = _WEP104_; - break; - } - - switch(pairwise_cipher) - { - case WPA_CIPHER_NONE: - psecuritypriv->wpa2_pairwise_cipher = _NO_PRIVACY_; - break; - case WPA_CIPHER_WEP40: - psecuritypriv->wpa2_pairwise_cipher = _WEP40_; - break; - case WPA_CIPHER_TKIP: - psecuritypriv->wpa2_pairwise_cipher = _TKIP_; - break; - case WPA_CIPHER_CCMP: - psecuritypriv->wpa2_pairwise_cipher = _AES_; - break; - case WPA_CIPHER_WEP104: - psecuritypriv->wpa2_pairwise_cipher = _WEP104_; - break; - } -#endif - } - - } - - //wpa - ie_len = 0; - group_cipher = 0; pairwise_cipher = 0; - psecuritypriv->wpa_group_cipher = _NO_PRIVACY_; - psecuritypriv->wpa_pairwise_cipher = _NO_PRIVACY_; - for (p = ie + _BEACON_IE_OFFSET_; ;p += (ie_len + 2)) - { - p = rtw_get_ie(p, _SSN_IE_1_, &ie_len, (pbss_network->IELength - _BEACON_IE_OFFSET_ - (ie_len + 2))); - if ((p) && (_rtw_memcmp(p+2, OUI1, 4))) - { - if(rtw_parse_wpa_ie(p, ie_len+2, &group_cipher, &pairwise_cipher, NULL) == _SUCCESS) - { - psecuritypriv->dot11AuthAlgrthm= dot11AuthAlgrthm_8021X; - - psecuritypriv->dot8021xalg = 1;//psk, todo:802.1x - - psecuritypriv->wpa_psk |= BIT(0); - - psecuritypriv->wpa_group_cipher = group_cipher; - psecuritypriv->wpa_pairwise_cipher = pairwise_cipher; - -#if 0 - switch(group_cipher) - { - case WPA_CIPHER_NONE: - psecuritypriv->wpa_group_cipher = _NO_PRIVACY_; - break; - case WPA_CIPHER_WEP40: - psecuritypriv->wpa_group_cipher = _WEP40_; - break; - case WPA_CIPHER_TKIP: - psecuritypriv->wpa_group_cipher = _TKIP_; - break; - case WPA_CIPHER_CCMP: - psecuritypriv->wpa_group_cipher = _AES_; - break; - case WPA_CIPHER_WEP104: - psecuritypriv->wpa_group_cipher = _WEP104_; - break; - } - - switch(pairwise_cipher) - { - case WPA_CIPHER_NONE: - psecuritypriv->wpa_pairwise_cipher = _NO_PRIVACY_; - break; - case WPA_CIPHER_WEP40: - psecuritypriv->wpa_pairwise_cipher = _WEP40_; - break; - case WPA_CIPHER_TKIP: - psecuritypriv->wpa_pairwise_cipher = _TKIP_; - break; - case WPA_CIPHER_CCMP: - psecuritypriv->wpa_pairwise_cipher = _AES_; - break; - case WPA_CIPHER_WEP104: - psecuritypriv->wpa_pairwise_cipher = _WEP104_; - break; - } -#endif - } - - break; - - } - - if ((p == NULL) || (ie_len == 0)) - { - break; - } - - } - - //wmm - ie_len = 0; - pmlmepriv->qospriv.qos_option = 0; - if(pregistrypriv->wmm_enable) - { - for (p = ie + _BEACON_IE_OFFSET_; ;p += (ie_len + 2)) - { - p = rtw_get_ie(p, _VENDOR_SPECIFIC_IE_, &ie_len, (pbss_network->IELength - _BEACON_IE_OFFSET_ - (ie_len + 2))); - if((p) && _rtw_memcmp(p+2, WMM_PARA_IE, 6)) - { - pmlmepriv->qospriv.qos_option = 1; - - *(p+8) |= BIT(7);//QoS Info, support U-APSD - - /* disable all ACM bits since the WMM admission control is not supported */ - *(p + 10) &= ~BIT(4); /* BE */ - *(p + 14) &= ~BIT(4); /* BK */ - *(p + 18) &= ~BIT(4); /* VI */ - *(p + 22) &= ~BIT(4); /* VO */ - - break; - } - - if ((p == NULL) || (ie_len == 0)) - { - break; - } - } - } -#ifdef CONFIG_80211N_HT - //parsing HT_CAP_IE - p = rtw_get_ie(ie + _BEACON_IE_OFFSET_, _HT_CAPABILITY_IE_, &ie_len, (pbss_network->IELength - _BEACON_IE_OFFSET_)); - if(p && ie_len>0) - { - u8 rf_type; - - struct rtw_ieee80211_ht_cap *pht_cap = (struct rtw_ieee80211_ht_cap *)(p+2); - - pHT_caps_ie=p; - - - ht_cap = _TRUE; - network_type |= WIRELESS_11_24N; - - - rtw_hal_get_hwreg(padapter, HW_VAR_RF_TYPE, (u8 *)(&rf_type)); - - if((psecuritypriv->wpa_pairwise_cipher & WPA_CIPHER_CCMP) || - (psecuritypriv->wpa2_pairwise_cipher & WPA_CIPHER_CCMP)) - { - pht_cap->ampdu_params_info |= (IEEE80211_HT_CAP_AMPDU_DENSITY&(0x07<<2)); - } - else - { - pht_cap->ampdu_params_info |= (IEEE80211_HT_CAP_AMPDU_DENSITY&0x00); - } - - pht_cap->ampdu_params_info |= (IEEE80211_HT_CAP_AMPDU_FACTOR & 0x03); //set Max Rx AMPDU size to 64K - - if(rf_type == RF_1T1R) - { - pht_cap->supp_mcs_set[0] = 0xff; - pht_cap->supp_mcs_set[1] = 0x0; - } - - _rtw_memcpy(&pmlmepriv->htpriv.ht_cap, p+2, ie_len); - - } - - //parsing HT_INFO_IE - p = rtw_get_ie(ie + _BEACON_IE_OFFSET_, _HT_ADD_INFO_IE_, &ie_len, (pbss_network->IELength - _BEACON_IE_OFFSET_)); - if(p && ie_len>0) - { - pHT_info_ie=p; - } -#endif //CONFIG_80211N_HT - switch(network_type) - { - case WIRELESS_11B: - pbss_network->NetworkTypeInUse = Ndis802_11DS; - break; - case WIRELESS_11G: - case WIRELESS_11BG: - case WIRELESS_11G_24N: - case WIRELESS_11BG_24N: - pbss_network->NetworkTypeInUse = Ndis802_11OFDM24; - break; - case WIRELESS_11A: - pbss_network->NetworkTypeInUse = Ndis802_11OFDM5; - break; - default : - pbss_network->NetworkTypeInUse = Ndis802_11OFDM24; - break; - } - - pmlmepriv->cur_network.network_type = network_type; - -#ifdef CONFIG_80211N_HT - pmlmepriv->htpriv.ht_option = _FALSE; - - if( (psecuritypriv->wpa2_pairwise_cipher&WPA_CIPHER_TKIP) || - (psecuritypriv->wpa_pairwise_cipher&WPA_CIPHER_TKIP)) - { - //todo: - //ht_cap = _FALSE; - } - - //ht_cap - if(pregistrypriv->ht_enable && ht_cap==_TRUE) - { - pmlmepriv->htpriv.ht_option = _TRUE; - pmlmepriv->qospriv.qos_option = 1; - - if(pregistrypriv->ampdu_enable==1) - { - pmlmepriv->htpriv.ampdu_enable = _TRUE; - } - - HT_caps_handler(padapter, (PNDIS_802_11_VARIABLE_IEs)pHT_caps_ie); - - HT_info_handler(padapter, (PNDIS_802_11_VARIABLE_IEs)pHT_info_ie); - } -#endif - - - pbss_network->Length = get_WLAN_BSSID_EX_sz((WLAN_BSSID_EX *)pbss_network); - - //issue beacon to start bss network - start_bss_network(padapter, (u8*)pbss_network); - - - //alloc sta_info for ap itself - psta = rtw_get_stainfo(&padapter->stapriv, pbss_network->MacAddress); - if(!psta) - { - psta = rtw_alloc_stainfo(&padapter->stapriv, pbss_network->MacAddress); - if (psta == NULL) - { - return _FAIL; - } - } - psta->state |= WIFI_AP_STATE; //Aries, add,fix bug of flush_cam_entry at STOP AP mode , 0724 - rtw_indicate_connect( padapter); - - pmlmepriv->cur_network.join_res = _TRUE;//for check if already set beacon - - //update bc/mc sta_info - //update_bmc_sta(padapter); - - return ret; - -} - -void rtw_set_macaddr_acl(struct adapter *padapter, int mode) -{ - struct sta_priv *pstapriv = &padapter->stapriv; - struct wlan_acl_pool *pacl_list = &pstapriv->acl_list; - - DBG_871X("%s, mode=%d\n", __func__, mode); - - pacl_list->mode = mode; -} - -int rtw_acl_add_sta(struct adapter *padapter, u8 *addr) -{ - _irqL irqL; - _list *plist, *phead; - u8 added = _FALSE; - int i, ret=0; - struct rtw_wlan_acl_node *paclnode; - struct sta_priv *pstapriv = &padapter->stapriv; - struct wlan_acl_pool *pacl_list = &pstapriv->acl_list; - _queue *pacl_node_q =&pacl_list->acl_node_q; - - DBG_871X("%s(acl_num=%d)=" MAC_FMT "\n", __func__, pacl_list->num, MAC_ARG(addr)); - - if((NUM_ACL-1) < pacl_list->num) - return (-1); - - - _enter_critical_bh(&(pacl_node_q->lock), &irqL); - - phead = get_list_head(pacl_node_q); - plist = get_next(phead); - - while ((rtw_end_of_queue_search(phead, plist)) == _FALSE) - { - paclnode = LIST_CONTAINOR(plist, struct rtw_wlan_acl_node, list); - plist = get_next(plist); - - if(_rtw_memcmp(paclnode->addr, addr, ETH_ALEN)) - { - if(paclnode->valid == _TRUE) - { - added = _TRUE; - DBG_871X("%s, sta has been added\n", __func__); - break; - } - } - } - - _exit_critical_bh(&(pacl_node_q->lock), &irqL); - - - if(added == _TRUE) - return ret; - - - _enter_critical_bh(&(pacl_node_q->lock), &irqL); - - for(i=0; i< NUM_ACL; i++) - { - paclnode = &pacl_list->aclnode[i]; - - if(paclnode->valid == _FALSE) - { - _rtw_init_listhead(&paclnode->list); - - _rtw_memcpy(paclnode->addr, addr, ETH_ALEN); - - paclnode->valid = _TRUE; - - rtw_list_insert_tail(&paclnode->list, get_list_head(pacl_node_q)); - - pacl_list->num++; - - break; - } - } - - DBG_871X("%s, acl_num=%d\n", __func__, pacl_list->num); - - _exit_critical_bh(&(pacl_node_q->lock), &irqL); - - return ret; -} - -int rtw_acl_remove_sta(struct adapter *padapter, u8 *addr) -{ - _irqL irqL; - _list *plist, *phead; - int i, ret=0; - struct rtw_wlan_acl_node *paclnode; - struct sta_priv *pstapriv = &padapter->stapriv; - struct wlan_acl_pool *pacl_list = &pstapriv->acl_list; - _queue *pacl_node_q =&pacl_list->acl_node_q; - - DBG_871X("%s(acl_num=%d)=" MAC_FMT "\n", __func__, pacl_list->num, MAC_ARG(addr)); - - _enter_critical_bh(&(pacl_node_q->lock), &irqL); - - phead = get_list_head(pacl_node_q); - plist = get_next(phead); - - while ((rtw_end_of_queue_search(phead, plist)) == _FALSE) - { - paclnode = LIST_CONTAINOR(plist, struct rtw_wlan_acl_node, list); - plist = get_next(plist); - - if(_rtw_memcmp(paclnode->addr, addr, ETH_ALEN)) - { - if(paclnode->valid == _TRUE) - { - paclnode->valid = _FALSE; - - rtw_list_delete(&paclnode->list); - - pacl_list->num--; - } - } - } - - _exit_critical_bh(&(pacl_node_q->lock), &irqL); - - DBG_871X("%s, acl_num=%d\n", __func__, pacl_list->num); - - return ret; - -} - -#ifdef CONFIG_NATIVEAP_MLME - -static void update_bcn_fixed_ie(struct adapter *padapter) -{ - DBG_871X("%s\n", __FUNCTION__); - -} - -static void update_bcn_erpinfo_ie(struct adapter *padapter) -{ - struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); - struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); - struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); - WLAN_BSSID_EX *pnetwork = &(pmlmeinfo->network); - unsigned char *p, *ie = pnetwork->IEs; - u32 len = 0; - - DBG_871X("%s, ERP_enable=%d\n", __FUNCTION__, pmlmeinfo->ERP_enable); - - if(!pmlmeinfo->ERP_enable) - return; - - //parsing ERP_IE - p = rtw_get_ie(ie + _BEACON_IE_OFFSET_, _ERPINFO_IE_, &len, (pnetwork->IELength - _BEACON_IE_OFFSET_)); - if(p && len>0) - { - PNDIS_802_11_VARIABLE_IEs pIE = (PNDIS_802_11_VARIABLE_IEs)p; - - if (pmlmepriv->num_sta_non_erp == 1) - pIE->data[0] |= RTW_ERP_INFO_NON_ERP_PRESENT|RTW_ERP_INFO_USE_PROTECTION; - else - pIE->data[0] &= ~(RTW_ERP_INFO_NON_ERP_PRESENT|RTW_ERP_INFO_USE_PROTECTION); - - if(pmlmepriv->num_sta_no_short_preamble > 0) - pIE->data[0] |= RTW_ERP_INFO_BARKER_PREAMBLE_MODE; - else - pIE->data[0] &= ~(RTW_ERP_INFO_BARKER_PREAMBLE_MODE); - - ERP_IE_handler(padapter, pIE); - } - -} - -static void update_bcn_htcap_ie(struct adapter *padapter) -{ - DBG_871X("%s\n", __FUNCTION__); - -} - -static void update_bcn_htinfo_ie(struct adapter *padapter) -{ - DBG_871X("%s\n", __FUNCTION__); - -} - -static void update_bcn_rsn_ie(struct adapter *padapter) -{ - DBG_871X("%s\n", __FUNCTION__); - -} - -static void update_bcn_wpa_ie(struct adapter *padapter) -{ - DBG_871X("%s\n", __FUNCTION__); - -} - -static void update_bcn_wmm_ie(struct adapter *padapter) -{ - DBG_871X("%s\n", __FUNCTION__); - -} - -static void update_bcn_wps_ie(struct adapter *padapter) -{ - u8 *pwps_ie=NULL, *pwps_ie_src, *premainder_ie, *pbackup_remainder_ie=NULL; - uint wps_ielen=0, wps_offset, remainder_ielen; - struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); - struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); - struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); - WLAN_BSSID_EX *pnetwork = &(pmlmeinfo->network); - unsigned char *ie = pnetwork->IEs; - u32 ielen = pnetwork->IELength; - - - DBG_871X("%s\n", __FUNCTION__); - - pwps_ie = rtw_get_wps_ie(ie+_FIXED_IE_LENGTH_, ielen-_FIXED_IE_LENGTH_, NULL, &wps_ielen); - - if(pwps_ie==NULL || wps_ielen==0) - return; - - wps_offset = (uint)(pwps_ie-ie); - - premainder_ie = pwps_ie + wps_ielen; - - remainder_ielen = ielen - wps_offset - wps_ielen; - - if(remainder_ielen>0) - { - pbackup_remainder_ie = rtw_malloc(remainder_ielen); - if(pbackup_remainder_ie) - _rtw_memcpy(pbackup_remainder_ie, premainder_ie, remainder_ielen); - } - - - pwps_ie_src = pmlmepriv->wps_beacon_ie; - if(pwps_ie_src == NULL) - return; - - - wps_ielen = (uint)pwps_ie_src[1];//to get ie data len - if((wps_offset+wps_ielen+2+remainder_ielen)<=MAX_IE_SZ) - { - _rtw_memcpy(pwps_ie, pwps_ie_src, wps_ielen+2); - pwps_ie += (wps_ielen+2); - - if(pbackup_remainder_ie) - _rtw_memcpy(pwps_ie, pbackup_remainder_ie, remainder_ielen); - - //update IELength - pnetwork->IELength = wps_offset + (wps_ielen+2) + remainder_ielen; - } - - if(pbackup_remainder_ie) - rtw_mfree(pbackup_remainder_ie, remainder_ielen); - -} - -static void update_bcn_p2p_ie(struct adapter *padapter) -{ - -} - -static void update_bcn_vendor_spec_ie(struct adapter *padapter, u8*oui) -{ - DBG_871X("%s\n", __FUNCTION__); - - if(_rtw_memcmp(RTW_WPA_OUI, oui, 4)) - { - update_bcn_wpa_ie(padapter); - } - else if(_rtw_memcmp(WMM_OUI, oui, 4)) - { - update_bcn_wmm_ie(padapter); - } - else if(_rtw_memcmp(WPS_OUI, oui, 4)) - { - update_bcn_wps_ie(padapter); - } - else if(_rtw_memcmp(P2P_OUI, oui, 4)) - { - update_bcn_p2p_ie(padapter); - } - else - { - DBG_871X("unknown OUI type!\n"); - } - - -} - -void update_beacon(struct adapter *padapter, u8 ie_id, u8 *oui, u8 tx) -{ - _irqL irqL; - struct mlme_priv *pmlmepriv; - struct mlme_ext_priv *pmlmeext; - //struct mlme_ext_info *pmlmeinfo; - - //DBG_871X("%s\n", __FUNCTION__); - - if(!padapter) - return; - - pmlmepriv = &(padapter->mlmepriv); - pmlmeext = &(padapter->mlmeextpriv); - //pmlmeinfo = &(pmlmeext->mlmext_info); - - if(_FALSE == pmlmeext->bstart_bss) - return; - - _enter_critical_bh(&pmlmepriv->bcn_update_lock, &irqL); - - switch(ie_id) - { - case 0xFF: - - update_bcn_fixed_ie(padapter);//8: TimeStamp, 2: Beacon Interval 2:Capability - - break; - - case _TIM_IE_: - - update_BCNTIM(padapter); - - break; - - case _ERPINFO_IE_: - - update_bcn_erpinfo_ie(padapter); - - break; - - case _HT_CAPABILITY_IE_: - - update_bcn_htcap_ie(padapter); - - break; - - case _RSN_IE_2_: - - update_bcn_rsn_ie(padapter); - - break; - - case _HT_ADD_INFO_IE_: - - update_bcn_htinfo_ie(padapter); - - break; - - case _VENDOR_SPECIFIC_IE_: - - update_bcn_vendor_spec_ie(padapter, oui); - - break; - - default: - break; - } - - pmlmepriv->update_bcn = _TRUE; - - _exit_critical_bh(&pmlmepriv->bcn_update_lock, &irqL); - -#ifndef CONFIG_INTERRUPT_BASED_TXBCN -#if defined(CONFIG_USB_HCI) || defined(CONFIG_SDIO_HCI) || defined(CONFIG_GSPI_HCI) - if(tx) - { - //send_beacon(padapter);//send_beacon must execute on TSR level - set_tx_beacon_cmd(padapter); - } -#else - { - //PCI will issue beacon when BCN interrupt occurs. - } -#endif -#endif //!CONFIG_INTERRUPT_BASED_TXBCN - -} - -#ifdef CONFIG_80211N_HT - -/* -op_mode -Set to 0 (HT pure) under the followign conditions - - all STAs in the BSS are 20/40 MHz HT in 20/40 MHz BSS or - - all STAs in the BSS are 20 MHz HT in 20 MHz BSS -Set to 1 (HT non-member protection) if there may be non-HT STAs - in both the primary and the secondary channel -Set to 2 if only HT STAs are associated in BSS, - however and at least one 20 MHz HT STA is associated -Set to 3 (HT mixed mode) when one or more non-HT STAs are associated - (currently non-GF HT station is considered as non-HT STA also) -*/ -static int rtw_ht_operation_update(struct adapter *padapter) -{ - u16 cur_op_mode, new_op_mode; - int op_mode_changes = 0; - struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); - struct ht_priv *phtpriv_ap = &pmlmepriv->htpriv; - - if(pmlmepriv->htpriv.ht_option == _TRUE) - return 0; - - //if (!iface->conf->ieee80211n || iface->conf->ht_op_mode_fixed) - // return 0; - - DBG_871X("%s current operation mode=0x%X\n", - __FUNCTION__, pmlmepriv->ht_op_mode); - - if (!(pmlmepriv->ht_op_mode & HT_INFO_OPERATION_MODE_NON_GF_DEVS_PRESENT) - && pmlmepriv->num_sta_ht_no_gf) { - pmlmepriv->ht_op_mode |= - HT_INFO_OPERATION_MODE_NON_GF_DEVS_PRESENT; - op_mode_changes++; - } else if ((pmlmepriv->ht_op_mode & - HT_INFO_OPERATION_MODE_NON_GF_DEVS_PRESENT) && - pmlmepriv->num_sta_ht_no_gf == 0) { - pmlmepriv->ht_op_mode &= - ~HT_INFO_OPERATION_MODE_NON_GF_DEVS_PRESENT; - op_mode_changes++; - } - - if (!(pmlmepriv->ht_op_mode & HT_INFO_OPERATION_MODE_NON_HT_STA_PRESENT) && - (pmlmepriv->num_sta_no_ht || pmlmepriv->olbc_ht)) { - pmlmepriv->ht_op_mode |= HT_INFO_OPERATION_MODE_NON_HT_STA_PRESENT; - op_mode_changes++; - } else if ((pmlmepriv->ht_op_mode & - HT_INFO_OPERATION_MODE_NON_HT_STA_PRESENT) && - (pmlmepriv->num_sta_no_ht == 0 && !pmlmepriv->olbc_ht)) { - pmlmepriv->ht_op_mode &= - ~HT_INFO_OPERATION_MODE_NON_HT_STA_PRESENT; - op_mode_changes++; - } - - /* Note: currently we switch to the MIXED op mode if HT non-greenfield - * station is associated. Probably it's a theoretical case, since - * it looks like all known HT STAs support greenfield. - */ - new_op_mode = 0; - if (pmlmepriv->num_sta_no_ht || - (pmlmepriv->ht_op_mode & HT_INFO_OPERATION_MODE_NON_GF_DEVS_PRESENT)) - new_op_mode = OP_MODE_MIXED; - else if ((phtpriv_ap->ht_cap.cap_info & IEEE80211_HT_CAP_SUP_WIDTH) - && pmlmepriv->num_sta_ht_20mhz) - new_op_mode = OP_MODE_20MHZ_HT_STA_ASSOCED; - else if (pmlmepriv->olbc_ht) - new_op_mode = OP_MODE_MAY_BE_LEGACY_STAS; - else - new_op_mode = OP_MODE_PURE; - - cur_op_mode = pmlmepriv->ht_op_mode & HT_INFO_OPERATION_MODE_OP_MODE_MASK; - if (cur_op_mode != new_op_mode) { - pmlmepriv->ht_op_mode &= ~HT_INFO_OPERATION_MODE_OP_MODE_MASK; - pmlmepriv->ht_op_mode |= new_op_mode; - op_mode_changes++; - } - - DBG_871X("%s new operation mode=0x%X changes=%d\n", - __FUNCTION__, pmlmepriv->ht_op_mode, op_mode_changes); - - return op_mode_changes; - -} - -#endif /* CONFIG_80211N_HT */ - -void associated_clients_update(struct adapter *padapter, u8 updated) -{ - //update associcated stations cap. - if(updated == _TRUE) - { - _irqL irqL; - _list *phead, *plist; - struct sta_info *psta=NULL; - struct sta_priv *pstapriv = &padapter->stapriv; - - _enter_critical_bh(&pstapriv->asoc_list_lock, &irqL); - - phead = &pstapriv->asoc_list; - plist = get_next(phead); - - //check asoc_queue - while ((rtw_end_of_queue_search(phead, plist)) == _FALSE) - { - psta = LIST_CONTAINOR(plist, struct sta_info, asoc_list); - - plist = get_next(plist); - - VCS_update(padapter, psta); - } - - _exit_critical_bh(&pstapriv->asoc_list_lock, &irqL); - - } - -} - -/* called > TSR LEVEL for USB or SDIO Interface*/ -void bss_cap_update_on_sta_join(struct adapter *padapter, struct sta_info *psta) -{ - u8 beacon_updated = _FALSE; - struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); - struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); - - -#if 0 - if (!(psta->capability & WLAN_CAPABILITY_SHORT_PREAMBLE) && - !psta->no_short_preamble_set) { - psta->no_short_preamble_set = 1; - pmlmepriv->num_sta_no_short_preamble++; - if ((pmlmeext->cur_wireless_mode > WIRELESS_11B) && - (pmlmepriv->num_sta_no_short_preamble == 1)) - ieee802_11_set_beacons(hapd->iface); - } -#endif - - - if(!(psta->flags & WLAN_STA_SHORT_PREAMBLE)) - { - if(!psta->no_short_preamble_set) - { - psta->no_short_preamble_set = 1; - - pmlmepriv->num_sta_no_short_preamble++; - - if ((pmlmeext->cur_wireless_mode > WIRELESS_11B) && - (pmlmepriv->num_sta_no_short_preamble == 1)) - { - beacon_updated = _TRUE; - update_beacon(padapter, 0xFF, NULL, _TRUE); - } - - } - } - else - { - if(psta->no_short_preamble_set) - { - psta->no_short_preamble_set = 0; - - pmlmepriv->num_sta_no_short_preamble--; - - if ((pmlmeext->cur_wireless_mode > WIRELESS_11B) && - (pmlmepriv->num_sta_no_short_preamble == 0)) - { - beacon_updated = _TRUE; - update_beacon(padapter, 0xFF, NULL, _TRUE); - } - - } - } - -#if 0 - if (psta->flags & WLAN_STA_NONERP && !psta->nonerp_set) { - psta->nonerp_set = 1; - pmlmepriv->num_sta_non_erp++; - if (pmlmepriv->num_sta_non_erp == 1) - ieee802_11_set_beacons(hapd->iface); - } -#endif - - if(psta->flags & WLAN_STA_NONERP) - { - if(!psta->nonerp_set) - { - psta->nonerp_set = 1; - - pmlmepriv->num_sta_non_erp++; - - if (pmlmepriv->num_sta_non_erp == 1) - { - beacon_updated = _TRUE; - update_beacon(padapter, _ERPINFO_IE_, NULL, _TRUE); - } - } - - } - else - { - if(psta->nonerp_set) - { - psta->nonerp_set = 0; - - pmlmepriv->num_sta_non_erp--; - - if (pmlmepriv->num_sta_non_erp == 0) - { - beacon_updated = _TRUE; - update_beacon(padapter, _ERPINFO_IE_, NULL, _TRUE); - } - } - - } - - -#if 0 - if (!(psta->capability & WLAN_CAPABILITY_SHORT_SLOT) && - !psta->no_short_slot_time_set) { - psta->no_short_slot_time_set = 1; - pmlmepriv->num_sta_no_short_slot_time++; - if ((pmlmeext->cur_wireless_mode > WIRELESS_11B) && - (pmlmepriv->num_sta_no_short_slot_time == 1)) - ieee802_11_set_beacons(hapd->iface); - } -#endif - - if(!(psta->capability & WLAN_CAPABILITY_SHORT_SLOT)) - { - if(!psta->no_short_slot_time_set) - { - psta->no_short_slot_time_set = 1; - - pmlmepriv->num_sta_no_short_slot_time++; - - if ((pmlmeext->cur_wireless_mode > WIRELESS_11B) && - (pmlmepriv->num_sta_no_short_slot_time == 1)) - { - beacon_updated = _TRUE; - update_beacon(padapter, 0xFF, NULL, _TRUE); - } - - } - } - else - { - if(psta->no_short_slot_time_set) - { - psta->no_short_slot_time_set = 0; - - pmlmepriv->num_sta_no_short_slot_time--; - - if ((pmlmeext->cur_wireless_mode > WIRELESS_11B) && - (pmlmepriv->num_sta_no_short_slot_time == 0)) - { - beacon_updated = _TRUE; - update_beacon(padapter, 0xFF, NULL, _TRUE); - } - } - } - -#ifdef CONFIG_80211N_HT - - if (psta->flags & WLAN_STA_HT) - { - u16 ht_capab = le16_to_cpu(psta->htpriv.ht_cap.cap_info); - - DBG_871X("HT: STA " MAC_FMT " HT Capabilities " - "Info: 0x%04x\n", MAC_ARG(psta->hwaddr), ht_capab); - - if (psta->no_ht_set) { - psta->no_ht_set = 0; - pmlmepriv->num_sta_no_ht--; - } - - if ((ht_capab & IEEE80211_HT_CAP_GRN_FLD) == 0) { - if (!psta->no_ht_gf_set) { - psta->no_ht_gf_set = 1; - pmlmepriv->num_sta_ht_no_gf++; - } - DBG_871X("%s STA " MAC_FMT " - no " - "greenfield, num of non-gf stations %d\n", - __FUNCTION__, MAC_ARG(psta->hwaddr), - pmlmepriv->num_sta_ht_no_gf); - } - - if ((ht_capab & IEEE80211_HT_CAP_SUP_WIDTH) == 0) { - if (!psta->ht_20mhz_set) { - psta->ht_20mhz_set = 1; - pmlmepriv->num_sta_ht_20mhz++; - } - DBG_871X("%s STA " MAC_FMT " - 20 MHz HT, " - "num of 20MHz HT STAs %d\n", - __FUNCTION__, MAC_ARG(psta->hwaddr), - pmlmepriv->num_sta_ht_20mhz); - } - - } - else - { - if (!psta->no_ht_set) { - psta->no_ht_set = 1; - pmlmepriv->num_sta_no_ht++; - } - if(pmlmepriv->htpriv.ht_option == _TRUE) { - DBG_871X("%s STA " MAC_FMT - " - no HT, num of non-HT stations %d\n", - __FUNCTION__, MAC_ARG(psta->hwaddr), - pmlmepriv->num_sta_no_ht); - } - } - - if (rtw_ht_operation_update(padapter) > 0) - { - update_beacon(padapter, _HT_CAPABILITY_IE_, NULL, _FALSE); - update_beacon(padapter, _HT_ADD_INFO_IE_, NULL, _TRUE); - } - -#endif /* CONFIG_80211N_HT */ - - //update associcated stations cap. - associated_clients_update(padapter, beacon_updated); - - DBG_871X("%s, updated=%d\n", __func__, beacon_updated); - -} - -u8 bss_cap_update_on_sta_leave(struct adapter *padapter, struct sta_info *psta) -{ - u8 beacon_updated = _FALSE; - struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); - struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); - - if(!psta) - return beacon_updated; - - if (psta->no_short_preamble_set) { - psta->no_short_preamble_set = 0; - pmlmepriv->num_sta_no_short_preamble--; - if (pmlmeext->cur_wireless_mode > WIRELESS_11B - && pmlmepriv->num_sta_no_short_preamble == 0) - { - beacon_updated = _TRUE; - update_beacon(padapter, 0xFF, NULL, _TRUE); - } - } - - if (psta->nonerp_set) { - psta->nonerp_set = 0; - pmlmepriv->num_sta_non_erp--; - if (pmlmepriv->num_sta_non_erp == 0) - { - beacon_updated = _TRUE; - update_beacon(padapter, _ERPINFO_IE_, NULL, _TRUE); - } - } - - if (psta->no_short_slot_time_set) { - psta->no_short_slot_time_set = 0; - pmlmepriv->num_sta_no_short_slot_time--; - if (pmlmeext->cur_wireless_mode > WIRELESS_11B - && pmlmepriv->num_sta_no_short_slot_time == 0) - { - beacon_updated = _TRUE; - update_beacon(padapter, 0xFF, NULL, _TRUE); - } - } - -#ifdef CONFIG_80211N_HT - - if (psta->no_ht_gf_set) { - psta->no_ht_gf_set = 0; - pmlmepriv->num_sta_ht_no_gf--; - } - - if (psta->no_ht_set) { - psta->no_ht_set = 0; - pmlmepriv->num_sta_no_ht--; - } - - if (psta->ht_20mhz_set) { - psta->ht_20mhz_set = 0; - pmlmepriv->num_sta_ht_20mhz--; - } - - if (rtw_ht_operation_update(padapter) > 0) - { - update_beacon(padapter, _HT_CAPABILITY_IE_, NULL, _FALSE); - update_beacon(padapter, _HT_ADD_INFO_IE_, NULL, _TRUE); - } - -#endif /* CONFIG_80211N_HT */ - - //update associcated stations cap. - //associated_clients_update(padapter, beacon_updated); //move it to avoid deadlock - - DBG_871X("%s, updated=%d\n", __func__, beacon_updated); - - return beacon_updated; - -} - -u8 ap_free_sta(struct adapter *padapter, struct sta_info *psta, bool active, u16 reason) -{ - _irqL irqL; - u8 beacon_updated = _FALSE; - struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); - struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); - struct sta_priv *pstapriv = &padapter->stapriv; - - if(!psta) - return beacon_updated; - - if (active == _TRUE) - { -#ifdef CONFIG_80211N_HT - //tear down Rx AMPDU - send_delba(padapter, 0, psta->hwaddr);// recipient - - //tear down TX AMPDU - send_delba(padapter, 1, psta->hwaddr);// // originator - -#endif //CONFIG_80211N_HT - - issue_deauth(padapter, psta->hwaddr, reason); - } - - psta->htpriv.agg_enable_bitmap = 0x0;//reset - psta->htpriv.candidate_tid_bitmap = 0x0;//reset - - - //report_del_sta_event(padapter, psta->hwaddr, reason); - - //clear cam entry / key - //clear_cam_entry(padapter, (psta->mac_id + 3)); - rtw_clearstakey_cmd(padapter, (u8*)psta, (u8)(psta->mac_id + 3), _TRUE); - - - _enter_critical_bh(&psta->lock, &irqL); - psta->state &= ~_FW_LINKED; - _exit_critical_bh(&psta->lock, &irqL); - - #ifdef CONFIG_IOCTL_CFG80211 - if (1) { - #ifdef COMPAT_KERNEL_RELEASE - rtw_cfg80211_indicate_sta_disassoc(padapter, psta->hwaddr, reason); - #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) && !defined(CONFIG_CFG80211_FORCE_COMPATIBLE_2_6_37_UNDER) - rtw_cfg80211_indicate_sta_disassoc(padapter, psta->hwaddr, reason); - #else //(LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) && !defined(CONFIG_CFG80211_FORCE_COMPATIBLE_2_6_37_UNDER) - /* will call rtw_cfg80211_indicate_sta_disassoc() in cmd_thread for old API context */ - #endif //(LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) && !defined(CONFIG_CFG80211_FORCE_COMPATIBLE_2_6_37_UNDER) - } else - #endif //CONFIG_IOCTL_CFG80211 - { - rtw_indicate_sta_disassoc_event(padapter, psta); - } - - report_del_sta_event(padapter, psta->hwaddr, reason); - - beacon_updated = bss_cap_update_on_sta_leave(padapter, psta); - - _enter_critical_bh(&(pstapriv->sta_hash_lock), &irqL); - rtw_free_stainfo(padapter, psta); - _exit_critical_bh(&(pstapriv->sta_hash_lock), &irqL); - - - return beacon_updated; - -} - -int rtw_ap_inform_ch_switch(struct adapter *padapter, u8 new_ch, u8 ch_offset) -{ - _irqL irqL; - _list *phead, *plist; - int ret=0; - struct sta_info *psta = NULL; - struct sta_priv *pstapriv = &padapter->stapriv; - struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; - struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); - u8 bc_addr[ETH_ALEN] = {0xff,0xff,0xff,0xff,0xff,0xff}; - - if((pmlmeinfo->state&0x03) != WIFI_FW_AP_STATE) - return ret; - - DBG_871X(FUNC_NDEV_FMT" with ch:%u, offset:%u\n", - FUNC_NDEV_ARG(padapter->pnetdev), new_ch, ch_offset); - - _enter_critical_bh(&pstapriv->asoc_list_lock, &irqL); - phead = &pstapriv->asoc_list; - plist = get_next(phead); - - /* for each sta in asoc_queue */ - while ((rtw_end_of_queue_search(phead, plist)) == _FALSE) - { - psta = LIST_CONTAINOR(plist, struct sta_info, asoc_list); - plist = get_next(plist); - - issue_action_spct_ch_switch(padapter, psta->hwaddr, new_ch, ch_offset); - psta->expire_to = ((pstapriv->expire_to * 2) > 5) ? 5 : (pstapriv->expire_to * 2); - } - _exit_critical_bh(&pstapriv->asoc_list_lock, &irqL); - - issue_action_spct_ch_switch(padapter, bc_addr, new_ch, ch_offset); - - return ret; -} - -int rtw_sta_flush(struct adapter *padapter) -{ - _irqL irqL; - _list *phead, *plist; - int ret=0; - struct sta_info *psta = NULL; - struct sta_priv *pstapriv = &padapter->stapriv; - struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; - struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); - u8 bc_addr[ETH_ALEN] = {0xff,0xff,0xff,0xff,0xff,0xff}; - u8 chk_alive_num = 0; - char chk_alive_list[NUM_STA]; - int i; - - DBG_871X(FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(padapter->pnetdev)); - - if((pmlmeinfo->state&0x03) != WIFI_FW_AP_STATE) - return ret; - - _enter_critical_bh(&pstapriv->asoc_list_lock, &irqL); - phead = &pstapriv->asoc_list; - plist = get_next(phead); - - while ((rtw_end_of_queue_search(phead, plist)) == _FALSE) { - int stainfo_offset; - - psta = LIST_CONTAINOR(plist, struct sta_info, asoc_list); - plist = get_next(plist); - - /* Remove sta from asoc_list */ - rtw_list_delete(&psta->asoc_list); - pstapriv->asoc_list_cnt--; - - /* Keep sta for ap_free_sta() beyond this asoc_list loop */ - stainfo_offset = rtw_stainfo_offset(pstapriv, psta); - if (stainfo_offset_valid(stainfo_offset)) { - chk_alive_list[chk_alive_num++] = stainfo_offset; - } - } - _exit_critical_bh(&pstapriv->asoc_list_lock, &irqL); - - - /* For each sta in chk_alive_list, call ap_free_sta */ - for (i = 0; i < chk_alive_num; i++) { - psta = rtw_get_stainfo_by_offset(pstapriv, chk_alive_list[i]); - ap_free_sta(padapter, psta, _TRUE, WLAN_REASON_DEAUTH_LEAVING); - } - - issue_deauth(padapter, bc_addr, WLAN_REASON_DEAUTH_LEAVING); - - associated_clients_update(padapter, _TRUE); - - return ret; - -} - -/* called > TSR LEVEL for USB or SDIO Interface*/ -void sta_info_update(struct adapter *padapter, struct sta_info *psta) -{ - int flags = psta->flags; - struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); - - - //update wmm cap. - if(WLAN_STA_WME&flags) - psta->qos_option = 1; - else - psta->qos_option = 0; - - if(pmlmepriv->qospriv.qos_option == 0) - psta->qos_option = 0; - - -#ifdef CONFIG_80211N_HT - //update 802.11n ht cap. - if(WLAN_STA_HT&flags) - { - psta->htpriv.ht_option = _TRUE; - psta->qos_option = 1; - } - else - { - psta->htpriv.ht_option = _FALSE; - } - - if(pmlmepriv->htpriv.ht_option == _FALSE) - psta->htpriv.ht_option = _FALSE; -#endif - - - update_sta_info_apmode(padapter, psta); - - -} - -/* called >= TSR LEVEL for USB or SDIO Interface*/ -void ap_sta_info_defer_update(struct adapter *padapter, struct sta_info *psta) -{ - if(psta->state & _FW_LINKED) - { - //add ratid - add_RATid(padapter, psta, 0);//DM_RATR_STA_INIT - } -} -/* restore hw setting from sw data structures */ -void rtw_ap_restore_network(struct adapter *padapter) -{ - struct mlme_priv *mlmepriv = &padapter->mlmepriv; - struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; - struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); - struct sta_priv * pstapriv = &padapter->stapriv; - struct sta_info *psta; - struct security_priv* psecuritypriv=&(padapter->securitypriv); - _irqL irqL; - _list *phead, *plist; - u8 chk_alive_num = 0; - char chk_alive_list[NUM_STA]; - int i; - - rtw_setopmode_cmd(padapter, Ndis802_11APMode,_FALSE); - - set_channel_bwmode(padapter, pmlmeext->cur_channel, pmlmeext->cur_ch_offset, pmlmeext->cur_bwmode); - - start_bss_network(padapter, (u8*)&mlmepriv->cur_network.network); - - if((padapter->securitypriv.dot11PrivacyAlgrthm == _TKIP_) || - (padapter->securitypriv.dot11PrivacyAlgrthm == _AES_)) - { - /* restore group key, WEP keys is restored in ips_leave() */ - rtw_set_key(padapter, psecuritypriv, psecuritypriv->dot118021XGrpKeyid, 0,_FALSE); - } - - _enter_critical_bh(&pstapriv->asoc_list_lock, &irqL); - - phead = &pstapriv->asoc_list; - plist = get_next(phead); - - while ((rtw_end_of_queue_search(phead, plist)) == _FALSE) { - int stainfo_offset; - - psta = LIST_CONTAINOR(plist, struct sta_info, asoc_list); - plist = get_next(plist); - - stainfo_offset = rtw_stainfo_offset(pstapriv, psta); - if (stainfo_offset_valid(stainfo_offset)) { - chk_alive_list[chk_alive_num++] = stainfo_offset; - } - } - - _exit_critical_bh(&pstapriv->asoc_list_lock, &irqL); - - for (i = 0; i < chk_alive_num; i++) { - psta = rtw_get_stainfo_by_offset(pstapriv, chk_alive_list[i]); - - if (psta == NULL) { - DBG_871X(FUNC_ADPT_FMT" sta_info is null\n", FUNC_ADPT_ARG(padapter)); - } - else if(psta->state &_FW_LINKED) - { - Update_RA_Entry(padapter, psta); - //pairwise key - /* per sta pairwise key and settings */ - if( (padapter->securitypriv.dot11PrivacyAlgrthm == _TKIP_) || - (padapter->securitypriv.dot11PrivacyAlgrthm == _AES_)) - { - rtw_setstakey_cmd(padapter, (unsigned char *)psta, _TRUE,_FALSE); - } - } - } - -} - -void start_ap_mode(struct adapter *padapter) -{ - int i; - struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); - struct sta_priv *pstapriv = &padapter->stapriv; - struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; - struct wlan_acl_pool *pacl_list = &pstapriv->acl_list; - - pmlmepriv->update_bcn = _FALSE; - - //init_mlme_ap_info(padapter); - pmlmeext->bstart_bss = _FALSE; - - pmlmepriv->num_sta_non_erp = 0; - - pmlmepriv->num_sta_no_short_slot_time = 0; - - pmlmepriv->num_sta_no_short_preamble = 0; - - pmlmepriv->num_sta_ht_no_gf = 0; -#ifdef CONFIG_80211N_HT - pmlmepriv->num_sta_no_ht = 0; -#endif //CONFIG_80211N_HT - pmlmepriv->num_sta_ht_20mhz = 0; - - pmlmepriv->olbc = _FALSE; - - pmlmepriv->olbc_ht = _FALSE; - -#ifdef CONFIG_80211N_HT - pmlmepriv->ht_op_mode = 0; -#endif - - for(i=0; ista_aid[i] = NULL; - - pmlmepriv->wps_beacon_ie = NULL; - pmlmepriv->wps_probe_resp_ie = NULL; - pmlmepriv->wps_assoc_resp_ie = NULL; - - pmlmepriv->p2p_beacon_ie = NULL; - pmlmepriv->p2p_probe_resp_ie = NULL; - - - //for ACL - _rtw_init_listhead(&(pacl_list->acl_node_q.queue)); - pacl_list->num = 0; - pacl_list->mode = 0; - for(i = 0; i < NUM_ACL; i++) - { - _rtw_init_listhead(&pacl_list->aclnode[i].list); - pacl_list->aclnode[i].valid = _FALSE; - } - -} - -void stop_ap_mode(struct adapter *padapter) -{ - _irqL irqL; - _list *phead, *plist; - struct rtw_wlan_acl_node *paclnode; - struct sta_info *psta=NULL; - struct sta_priv *pstapriv = &padapter->stapriv; - struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); - struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; - struct wlan_acl_pool *pacl_list = &pstapriv->acl_list; - _queue *pacl_node_q =&pacl_list->acl_node_q; - - pmlmepriv->update_bcn = _FALSE; - pmlmeext->bstart_bss = _FALSE; - //_rtw_spinlock_free(&pmlmepriv->bcn_update_lock); - - //reset and init security priv , this can refine with rtw_reset_securitypriv - _rtw_memset((unsigned char *)&padapter->securitypriv, 0, sizeof (struct security_priv)); - padapter->securitypriv.ndisauthtype = Ndis802_11AuthModeOpen; - padapter->securitypriv.ndisencryptstatus = Ndis802_11WEPDisabled; - - //for ACL - _enter_critical_bh(&(pacl_node_q->lock), &irqL); - phead = get_list_head(pacl_node_q); - plist = get_next(phead); - while ((rtw_end_of_queue_search(phead, plist)) == _FALSE) - { - paclnode = LIST_CONTAINOR(plist, struct rtw_wlan_acl_node, list); - plist = get_next(plist); - - if(paclnode->valid == _TRUE) - { - paclnode->valid = _FALSE; - - rtw_list_delete(&paclnode->list); - - pacl_list->num--; - } - } - _exit_critical_bh(&(pacl_node_q->lock), &irqL); - - DBG_871X("%s, free acl_node_queue, num=%d\n", __func__, pacl_list->num); - - rtw_sta_flush(padapter); - - //free_assoc_sta_resources - rtw_free_all_stainfo(padapter); - - psta = rtw_get_bcmc_stainfo(padapter); - _enter_critical_bh(&(pstapriv->sta_hash_lock), &irqL); - rtw_free_stainfo(padapter, psta); - _exit_critical_bh(&(pstapriv->sta_hash_lock), &irqL); - - rtw_init_bcmc_stainfo(padapter); - - rtw_free_mlme_priv_ie_data(pmlmepriv); - -} - -#endif //CONFIG_NATIVEAP_MLME -#endif //CONFIG_AP_MODE - +/****************************************************************************** + * + * Copyright(c) 2007 - 2012 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 + * + * + ******************************************************************************/ +#define _RTW_AP_C_ + +#include +#include +#include +#include + + +#ifdef CONFIG_AP_MODE + +extern unsigned char RTW_WPA_OUI[]; +extern unsigned char WMM_OUI[]; +extern unsigned char WPS_OUI[]; +extern unsigned char P2P_OUI[]; +extern unsigned char WFD_OUI[]; + +void init_mlme_ap_info(struct adapter *padapter) +{ + struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; + struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); + struct sta_priv *pstapriv = &padapter->stapriv; + struct wlan_acl_pool *pacl_list = &pstapriv->acl_list; + + + _rtw_spinlock_init(&pmlmepriv->bcn_update_lock); + + //for ACL + _rtw_init_queue(&pacl_list->acl_node_q); + + //pmlmeext->bstart_bss = _FALSE; + + start_ap_mode(padapter); +} + +void free_mlme_ap_info(struct adapter *padapter) +{ + _irqL irqL; + struct sta_info *psta=NULL; + struct sta_priv *pstapriv = &padapter->stapriv; + struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); + struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; + struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); + + //stop_ap_mode(padapter); + + pmlmepriv->update_bcn = _FALSE; + pmlmeext->bstart_bss = _FALSE; + + rtw_sta_flush(padapter); + + pmlmeinfo->state = _HW_STATE_NOLINK_; + + //free_assoc_sta_resources + rtw_free_all_stainfo(padapter); + + //free bc/mc sta_info + psta = rtw_get_bcmc_stainfo(padapter); + _enter_critical_bh(&(pstapriv->sta_hash_lock), &irqL); + rtw_free_stainfo(padapter, psta); + _exit_critical_bh(&(pstapriv->sta_hash_lock), &irqL); + _rtw_spinlock_free(&pmlmepriv->bcn_update_lock); + +} + +static void update_BCNTIM(struct adapter *padapter) +{ + struct sta_priv *pstapriv = &padapter->stapriv; + struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); + struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); + WLAN_BSSID_EX *pnetwork_mlmeext = &(pmlmeinfo->network); + unsigned char *pie = pnetwork_mlmeext->IEs; + + //DBG_871X("%s\n", __FUNCTION__); + + //update TIM IE + //if(pstapriv->tim_bitmap) + if(_TRUE) + { + u8 *p, *dst_ie, *premainder_ie=NULL, *pbackup_remainder_ie=NULL; + u16 tim_bitmap_le; + uint offset, tmp_len, tim_ielen, tim_ie_offset, remainder_ielen; + + tim_bitmap_le = cpu_to_le16(pstapriv->tim_bitmap); + + p = rtw_get_ie(pie + _FIXED_IE_LENGTH_, _TIM_IE_, &tim_ielen, pnetwork_mlmeext->IELength - _FIXED_IE_LENGTH_); + if (p != NULL && tim_ielen>0) + { + tim_ielen += 2; + + premainder_ie = p+tim_ielen; + + tim_ie_offset = (sint)(p -pie); + + remainder_ielen = pnetwork_mlmeext->IELength - tim_ie_offset - tim_ielen; + + //append TIM IE from dst_ie offset + dst_ie = p; + } + else + { + tim_ielen = 0; + + //calucate head_len + offset = _FIXED_IE_LENGTH_; + + /* get ssid_ie len */ + p = rtw_get_ie(pie + _BEACON_IE_OFFSET_, _SSID_IE_, &tmp_len, (pnetwork_mlmeext->IELength - _BEACON_IE_OFFSET_)); + if (p != NULL) + offset += tmp_len+2; + + // get supported rates len + p = rtw_get_ie(pie + _BEACON_IE_OFFSET_, _SUPPORTEDRATES_IE_, &tmp_len, (pnetwork_mlmeext->IELength - _BEACON_IE_OFFSET_)); + if (p != NULL) + { + offset += tmp_len+2; + } + + //DS Parameter Set IE, len=3 + offset += 3; + + premainder_ie = pie + offset; + + remainder_ielen = pnetwork_mlmeext->IELength - offset - tim_ielen; + + //append TIM IE from offset + dst_ie = pie + offset; + + } + + + if(remainder_ielen>0) + { + pbackup_remainder_ie = rtw_malloc(remainder_ielen); + if(pbackup_remainder_ie && premainder_ie) + _rtw_memcpy(pbackup_remainder_ie, premainder_ie, remainder_ielen); + } + + *dst_ie++=_TIM_IE_; + + if((pstapriv->tim_bitmap&0xff00) && (pstapriv->tim_bitmap&0x00fc)) + tim_ielen = 5; + else + tim_ielen = 4; + + *dst_ie++= tim_ielen; + + *dst_ie++=0;//DTIM count + *dst_ie++=1;//DTIM peroid + + if(pstapriv->tim_bitmap&BIT(0))//for bc/mc frames + *dst_ie++ = BIT(0);//bitmap ctrl + else + *dst_ie++ = 0; + + if(tim_ielen==4) + { + *dst_ie++ = *(u8*)&tim_bitmap_le; + } + else if(tim_ielen==5) + { + _rtw_memcpy(dst_ie, &tim_bitmap_le, 2); + dst_ie+=2; + } + + //copy remainder IE + if(pbackup_remainder_ie) + { + _rtw_memcpy(dst_ie, pbackup_remainder_ie, remainder_ielen); + + rtw_mfree(pbackup_remainder_ie, remainder_ielen); + } + + offset = (uint)(dst_ie - pie); + pnetwork_mlmeext->IELength = offset + remainder_ielen; + + } + +#ifndef CONFIG_INTERRUPT_BASED_TXBCN +#if defined(CONFIG_USB_HCI) || defined(CONFIG_SDIO_HCI) || defined(CONFIG_GSPI_HCI) + set_tx_beacon_cmd(padapter); +#endif +#endif //!CONFIG_INTERRUPT_BASED_TXBCN + + +} + +void rtw_add_bcn_ie(struct adapter *padapter, WLAN_BSSID_EX *pnetwork, u8 index, u8 *data, u8 len) +{ + PNDIS_802_11_VARIABLE_IEs pIE; + u8 bmatch = _FALSE; + u8 *pie = pnetwork->IEs; + u8 *p, *dst_ie, *premainder_ie=NULL, *pbackup_remainder_ie=NULL; + u32 i, offset, ielen, ie_offset, remainder_ielen = 0; + + for (i = sizeof(NDIS_802_11_FIXED_IEs); i < pnetwork->IELength;) + { + pIE = (PNDIS_802_11_VARIABLE_IEs)(pnetwork->IEs + i); + + if (pIE->ElementID > index) + { + break; + } + else if(pIE->ElementID == index) // already exist the same IE + { + p = (u8 *)pIE; + ielen = pIE->Length; + bmatch = _TRUE; + break; + } + + p = (u8 *)pIE; + ielen = pIE->Length; + i += (pIE->Length + 2); + } + + if (p != NULL && ielen>0) + { + ielen += 2; + + premainder_ie = p+ielen; + + ie_offset = (sint)(p -pie); + + remainder_ielen = pnetwork->IELength - ie_offset - ielen; + + if(bmatch) + dst_ie = p; + else + dst_ie = (p+ielen); + } + + if(remainder_ielen>0) + { + pbackup_remainder_ie = rtw_malloc(remainder_ielen); + if(pbackup_remainder_ie && premainder_ie) + _rtw_memcpy(pbackup_remainder_ie, premainder_ie, remainder_ielen); + } + + *dst_ie++=index; + *dst_ie++=len; + + _rtw_memcpy(dst_ie, data, len); + dst_ie+=len; + + //copy remainder IE + if(pbackup_remainder_ie) + { + _rtw_memcpy(dst_ie, pbackup_remainder_ie, remainder_ielen); + + rtw_mfree(pbackup_remainder_ie, remainder_ielen); + } + + offset = (uint)(dst_ie - pie); + pnetwork->IELength = offset + remainder_ielen; +} + +void rtw_remove_bcn_ie(struct adapter *padapter, WLAN_BSSID_EX *pnetwork, u8 index) +{ + u8 *p, *dst_ie, *premainder_ie=NULL, *pbackup_remainder_ie=NULL; + uint offset, ielen, ie_offset, remainder_ielen = 0; + u8 *pie = pnetwork->IEs; + + p = rtw_get_ie(pie + _FIXED_IE_LENGTH_, index, &ielen, pnetwork->IELength - _FIXED_IE_LENGTH_); + if (p != NULL && ielen>0) + { + ielen += 2; + + premainder_ie = p+ielen; + + ie_offset = (sint)(p -pie); + + remainder_ielen = pnetwork->IELength - ie_offset - ielen; + + dst_ie = p; + } + else { + return; + } + + if(remainder_ielen>0) + { + pbackup_remainder_ie = rtw_malloc(remainder_ielen); + if(pbackup_remainder_ie && premainder_ie) + _rtw_memcpy(pbackup_remainder_ie, premainder_ie, remainder_ielen); + } + + //copy remainder IE + if(pbackup_remainder_ie) + { + _rtw_memcpy(dst_ie, pbackup_remainder_ie, remainder_ielen); + + rtw_mfree(pbackup_remainder_ie, remainder_ielen); + } + + offset = (uint)(dst_ie - pie); + pnetwork->IELength = offset + remainder_ielen; +} + + +u8 chk_sta_is_alive(struct sta_info *psta); +u8 chk_sta_is_alive(struct sta_info *psta) +{ + u8 ret = _FALSE; + #ifdef DBG_EXPIRATION_CHK + DBG_871X("sta:"MAC_FMT", rssi:%d, rx:"STA_PKTS_FMT", expire_to:%u, %s%ssq_len:%u\n" + , MAC_ARG(psta->hwaddr) + , psta->rssi_stat.UndecoratedSmoothedPWDB + //, STA_RX_PKTS_ARG(psta) + , STA_RX_PKTS_DIFF_ARG(psta) + , psta->expire_to + , psta->state&WIFI_SLEEP_STATE?"PS, ":"" + , psta->state&WIFI_STA_ALIVE_CHK_STATE?"SAC, ":"" + , psta->sleepq_len + ); + #endif + + //if(sta_last_rx_pkts(psta) == sta_rx_pkts(psta)) + if((psta->sta_stats.last_rx_data_pkts + psta->sta_stats.last_rx_ctrl_pkts) == (psta->sta_stats.rx_data_pkts + psta->sta_stats.rx_ctrl_pkts)) + { + #if 0 + if(psta->state&WIFI_SLEEP_STATE) + ret = _TRUE; + #endif + } + else + { + ret = _TRUE; + } + + sta_update_last_rx_pkts(psta); + + return ret; +} + +void expire_timeout_chk(struct adapter *padapter) +{ + _irqL irqL; + _list *phead, *plist; + u8 updated; + struct sta_info *psta=NULL; + struct sta_priv *pstapriv = &padapter->stapriv; + u8 chk_alive_num = 0; + char chk_alive_list[NUM_STA]; + int i; + + _enter_critical_bh(&pstapriv->auth_list_lock, &irqL); + + phead = &pstapriv->auth_list; + plist = get_next(phead); + + //check auth_queue + #ifdef DBG_EXPIRATION_CHK + if (rtw_end_of_queue_search(phead, plist) == _FALSE) { + DBG_871X(FUNC_NDEV_FMT" auth_list, cnt:%u\n" + , FUNC_NDEV_ARG(padapter->pnetdev), pstapriv->auth_list_cnt); + } + #endif + while ((rtw_end_of_queue_search(phead, plist)) == _FALSE) + { + psta = LIST_CONTAINOR(plist, struct sta_info, auth_list); + plist = get_next(plist); + + +#ifdef CONFIG_ATMEL_RC_PATCH + if (_TRUE == _rtw_memcmp((void *)(pstapriv->atmel_rc_pattern), (void *)(psta->hwaddr), ETH_ALEN)) + continue; + if (psta->flag_atmel_rc) + continue; +#endif + if(psta->expire_to>0) + { + psta->expire_to--; + if (psta->expire_to == 0) + { + rtw_list_delete(&psta->auth_list); + pstapriv->auth_list_cnt--; + + DBG_871X("auth expire %02X%02X%02X%02X%02X%02X\n", + psta->hwaddr[0],psta->hwaddr[1],psta->hwaddr[2],psta->hwaddr[3],psta->hwaddr[4],psta->hwaddr[5]); + + _exit_critical_bh(&pstapriv->auth_list_lock, &irqL); + + _enter_critical_bh(&(pstapriv->sta_hash_lock), &irqL); + rtw_free_stainfo(padapter, psta); + _exit_critical_bh(&(pstapriv->sta_hash_lock), &irqL); + + _enter_critical_bh(&pstapriv->auth_list_lock, &irqL); + } + } + + } + + _exit_critical_bh(&pstapriv->auth_list_lock, &irqL); + + psta = NULL; + + + _enter_critical_bh(&pstapriv->asoc_list_lock, &irqL); + + phead = &pstapriv->asoc_list; + plist = get_next(phead); + + //check asoc_queue + #ifdef DBG_EXPIRATION_CHK + if (rtw_end_of_queue_search(phead, plist) == _FALSE) { + DBG_871X(FUNC_NDEV_FMT" asoc_list, cnt:%u\n" + , FUNC_NDEV_ARG(padapter->pnetdev), pstapriv->asoc_list_cnt); + } + #endif + while ((rtw_end_of_queue_search(phead, plist)) == _FALSE) + { + psta = LIST_CONTAINOR(plist, struct sta_info, asoc_list); + plist = get_next(plist); +#ifdef CONFIG_ATMEL_RC_PATCH + DBG_871X("%s:%d psta=%p, %02x,%02x||%02x,%02x \n\n", __func__, __LINE__, + psta,pstapriv->atmel_rc_pattern[0], pstapriv->atmel_rc_pattern[5], psta->hwaddr[0], psta->hwaddr[5]); + if (_TRUE == _rtw_memcmp((void *)pstapriv->atmel_rc_pattern, (void *)(psta->hwaddr), ETH_ALEN)) + continue; + if (psta->flag_atmel_rc) + continue; + DBG_871X("%s: debug line:%d \n", __func__, __LINE__); +#endif + if (chk_sta_is_alive(psta) || !psta->expire_to) { + psta->expire_to = pstapriv->expire_to; + psta->keep_alive_trycnt = 0; + #ifdef CONFIG_TX_MCAST2UNI + psta->under_exist_checking = 0; + #endif // CONFIG_TX_MCAST2UNI + } else { + psta->expire_to--; + } + +#ifndef CONFIG_ACTIVE_KEEP_ALIVE_CHECK +#ifdef CONFIG_TX_MCAST2UNI +#ifdef CONFIG_80211N_HT + if ( (psta->flags & WLAN_STA_HT) && (psta->htpriv.agg_enable_bitmap || psta->under_exist_checking) ) { + // check sta by delba(addba) for 11n STA + // ToDo: use CCX report to check for all STAs + //DBG_871X("asoc check by DELBA/ADDBA! (pstapriv->expire_to=%d s)(psta->expire_to=%d s), [%02x, %d]\n", pstapriv->expire_to*2, psta->expire_to*2, psta->htpriv.agg_enable_bitmap, psta->under_exist_checking); + + if ( psta->expire_to <= (pstapriv->expire_to - 50 ) ) { + DBG_871X("asoc expire by DELBA/ADDBA! (%d s)\n", (pstapriv->expire_to-psta->expire_to)*2); + psta->under_exist_checking = 0; + psta->expire_to = 0; + } else if ( psta->expire_to <= (pstapriv->expire_to - 3) && (psta->under_exist_checking==0)) { + DBG_871X("asoc check by DELBA/ADDBA! (%d s)\n", (pstapriv->expire_to-psta->expire_to)*2); + psta->under_exist_checking = 1; + //tear down TX AMPDU + send_delba(padapter, 1, psta->hwaddr);// // originator + psta->htpriv.agg_enable_bitmap = 0x0;//reset + psta->htpriv.candidate_tid_bitmap = 0x0;//reset + } + } +#endif //CONFIG_80211N_HT +#endif // CONFIG_TX_MCAST2UNI +#endif //CONFIG_ACTIVE_KEEP_ALIVE_CHECK + + if (psta->expire_to <= 0) + { + #ifdef CONFIG_ACTIVE_KEEP_ALIVE_CHECK + struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; + + if (padapter->registrypriv.wifi_spec == 1) + { + psta->expire_to = pstapriv->expire_to; + continue; + } + + if (psta->state & WIFI_SLEEP_STATE) { + if (!(psta->state & WIFI_STA_ALIVE_CHK_STATE)) { + //to check if alive by another methods if staion is at ps mode. + psta->expire_to = pstapriv->expire_to; + psta->state |= WIFI_STA_ALIVE_CHK_STATE; + + //DBG_871X("alive chk, sta:" MAC_FMT " is at ps mode!\n", MAC_ARG(psta->hwaddr)); + + //to update bcn with tim_bitmap for this station + pstapriv->tim_bitmap |= BIT(psta->aid); + update_beacon(padapter, _TIM_IE_, NULL, _FALSE); + + if(!pmlmeext->active_keep_alive_check) + continue; + } + } + + if (pmlmeext->active_keep_alive_check) { + int stainfo_offset; + + stainfo_offset = rtw_stainfo_offset(pstapriv, psta); + if (stainfo_offset_valid(stainfo_offset)) { + chk_alive_list[chk_alive_num++] = stainfo_offset; + } + + continue; + } + #endif /* CONFIG_ACTIVE_KEEP_ALIVE_CHECK */ + + rtw_list_delete(&psta->asoc_list); + pstapriv->asoc_list_cnt--; + + DBG_871X("asoc expire "MAC_FMT", state=0x%x\n", MAC_ARG(psta->hwaddr), psta->state); + updated = ap_free_sta(padapter, psta, _FALSE, WLAN_REASON_DEAUTH_LEAVING); + } + else + { + /* TODO: Aging mechanism to digest frames in sleep_q to avoid running out of xmitframe */ + if (psta->sleepq_len > (NR_XMITFRAME/pstapriv->asoc_list_cnt) + && padapter->xmitpriv.free_xmitframe_cnt < ((NR_XMITFRAME/pstapriv->asoc_list_cnt)/2) + ){ + DBG_871X("%s sta:"MAC_FMT", sleepq_len:%u, free_xmitframe_cnt:%u, asoc_list_cnt:%u, clear sleep_q\n", __func__ + , MAC_ARG(psta->hwaddr) + , psta->sleepq_len, padapter->xmitpriv.free_xmitframe_cnt, pstapriv->asoc_list_cnt); + wakeup_sta_to_xmit(padapter, psta); + } + } + } + + _exit_critical_bh(&pstapriv->asoc_list_lock, &irqL); + +#ifdef CONFIG_ACTIVE_KEEP_ALIVE_CHECK +if (chk_alive_num) { + + u8 backup_oper_channel=0; + struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; + /* switch to correct channel of current network before issue keep-alive frames */ + if (rtw_get_oper_ch(padapter) != pmlmeext->cur_channel) { + backup_oper_channel = rtw_get_oper_ch(padapter); + SelectChannel(padapter, pmlmeext->cur_channel); + } + + /* issue null data to check sta alive*/ + for (i = 0; i < chk_alive_num; i++) { + + int ret = _FAIL; + + psta = rtw_get_stainfo_by_offset(pstapriv, chk_alive_list[i]); +#ifdef CONFIG_ATMEL_RC_PATCH + if (_TRUE == _rtw_memcmp( pstapriv->atmel_rc_pattern, psta->hwaddr, ETH_ALEN)) + continue; + if (psta->flag_atmel_rc) + continue; +#endif + if(!(psta->state &_FW_LINKED)) + continue; + + if (psta->state & WIFI_SLEEP_STATE) + ret = issue_nulldata(padapter, psta->hwaddr, 0, 1, 50); + else + ret = issue_nulldata(padapter, psta->hwaddr, 0, 3, 50); + + psta->keep_alive_trycnt++; + if (ret == _SUCCESS) + { + DBG_871X("asoc check, sta(" MAC_FMT ") is alive\n", MAC_ARG(psta->hwaddr)); + psta->expire_to = pstapriv->expire_to; + psta->keep_alive_trycnt = 0; + continue; + } + else if (psta->keep_alive_trycnt <= 3) + { + DBG_871X("ack check for asoc expire, keep_alive_trycnt=%d\n", psta->keep_alive_trycnt); + psta->expire_to = 1; + continue; + } + + psta->keep_alive_trycnt = 0; + + DBG_871X("asoc expire "MAC_FMT", state=0x%x\n", MAC_ARG(psta->hwaddr), psta->state); + _enter_critical_bh(&pstapriv->asoc_list_lock, &irqL); + if (rtw_is_list_empty(&psta->asoc_list)==_FALSE) { + rtw_list_delete(&psta->asoc_list); + pstapriv->asoc_list_cnt--; + updated = ap_free_sta(padapter, psta, _FALSE, WLAN_REASON_DEAUTH_LEAVING); + } + _exit_critical_bh(&pstapriv->asoc_list_lock, &irqL); + + } + + if (backup_oper_channel>0) /* back to the original operation channel */ + SelectChannel(padapter, backup_oper_channel); +} +#endif /* CONFIG_ACTIVE_KEEP_ALIVE_CHECK */ + + associated_clients_update(padapter, updated); +} + +void add_RATid(struct adapter *padapter, struct sta_info *psta, u8 rssi_level) +{ + int i; + u8 rf_type; + u32 init_rate=0; + unsigned char sta_band = 0, raid, shortGIrate = _FALSE; + unsigned char limit; + unsigned int tx_ra_bitmap=0; + struct ht_priv *psta_ht = NULL; + struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); + WLAN_BSSID_EX *pcur_network = (WLAN_BSSID_EX *)&pmlmepriv->cur_network.network; + +#ifdef CONFIG_80211N_HT + if(psta) + psta_ht = &psta->htpriv; + else + return; +#endif //CONFIG_80211N_HT + + if(!(psta->state & _FW_LINKED)) + return; + + //b/g mode ra_bitmap + for (i=0; ibssrateset); i++) + { + if (psta->bssrateset[i]) + tx_ra_bitmap |= rtw_get_bit_value_from_ieee_value(psta->bssrateset[i]&0x7f); + } +#ifdef CONFIG_80211N_HT + //n mode ra_bitmap + if(psta_ht->ht_option) + { + rtw_hal_get_hwreg(padapter, HW_VAR_RF_TYPE, (u8 *)(&rf_type)); + if(rf_type == RF_2T2R) + limit=16;// 2R + else + limit=8;// 1R + + for (i=0; iht_cap.supp_mcs_set[i/8] & BIT(i%8)) + tx_ra_bitmap |= BIT(i+12); + } + + //max short GI rate + shortGIrate = psta_ht->sgi; + } +#endif //CONFIG_80211N_HT + +#if 0//gtest + if(get_rf_mimo_mode(padapter) == RTL8712_RF_2T2R) + { + //is this a 2r STA? + if((pstat->tx_ra_bitmap & 0x0ff00000) != 0 && !(priv->pshare->has_2r_sta & BIT(pstat->aid))) + { + priv->pshare->has_2r_sta |= BIT(pstat->aid); + if(rtw_read16(padapter, 0x102501f6) != 0xffff) + { + rtw_write16(padapter, 0x102501f6, 0xffff); + reset_1r_sta_RA(priv, 0xffff); + Switch_1SS_Antenna(priv, 3); + } + } + else// bg or 1R STA? + { + if((priv->pmib->dot11BssType.net_work_type & WIRELESS_11N) && pstat->ht_cap_len && priv->pshare->has_2r_sta == 0) + { + if(rtw_read16(padapter, 0x102501f6) != 0x7777) + { // MCS7 SGI + rtw_write16(padapter, 0x102501f6,0x7777); + reset_1r_sta_RA(priv, 0x7777); + Switch_1SS_Antenna(priv, 2); + } + } + } + + } + + if ((pstat->rssi_level < 1) || (pstat->rssi_level > 3)) + { + if (pstat->rssi >= priv->pshare->rf_ft_var.raGoDownUpper) + pstat->rssi_level = 1; + else if ((pstat->rssi >= priv->pshare->rf_ft_var.raGoDown20MLower) || + ((priv->pshare->is_40m_bw) && (pstat->ht_cap_len) && + (pstat->rssi >= priv->pshare->rf_ft_var.raGoDown40MLower) && + (pstat->ht_cap_buf.ht_cap_info & cpu_to_le16(_HTCAP_SUPPORT_CH_WDTH_)))) + pstat->rssi_level = 2; + else + pstat->rssi_level = 3; + } + + // rate adaptive by rssi + if ((priv->pmib->dot11BssType.net_work_type & WIRELESS_11N) && pstat->ht_cap_len) + { + if ((get_rf_mimo_mode(priv) == MIMO_1T2R) || (get_rf_mimo_mode(priv) == MIMO_1T1R)) + { + switch (pstat->rssi_level) { + case 1: + pstat->tx_ra_bitmap &= 0x100f0000; + break; + case 2: + pstat->tx_ra_bitmap &= 0x100ff000; + break; + case 3: + if (priv->pshare->is_40m_bw) + pstat->tx_ra_bitmap &= 0x100ff005; + else + pstat->tx_ra_bitmap &= 0x100ff001; + + break; + } + } + else + { + switch (pstat->rssi_level) { + case 1: + pstat->tx_ra_bitmap &= 0x1f0f0000; + break; + case 2: + pstat->tx_ra_bitmap &= 0x1f0ff000; + break; + case 3: + if (priv->pshare->is_40m_bw) + pstat->tx_ra_bitmap &= 0x000ff005; + else + pstat->tx_ra_bitmap &= 0x000ff001; + + break; + } + + // Don't need to mask high rates due to new rate adaptive parameters + //if (pstat->is_broadcom_sta) // use MCS12 as the highest rate vs. Broadcom sta + // pstat->tx_ra_bitmap &= 0x81ffffff; + + // NIC driver will report not supporting MCS15 and MCS14 in asoc req + //if (pstat->is_rtl8190_sta && !pstat->is_2t_mimo_sta) + // pstat->tx_ra_bitmap &= 0x83ffffff; // if Realtek 1x2 sta, don't use MCS15 and MCS14 + } + } + else if ((priv->pmib->dot11BssType.net_work_type & WIRELESS_11G) && isErpSta(pstat)) + { + switch (pstat->rssi_level) { + case 1: + pstat->tx_ra_bitmap &= 0x00000f00; + break; + case 2: + pstat->tx_ra_bitmap &= 0x00000ff0; + break; + case 3: + pstat->tx_ra_bitmap &= 0x00000ff5; + break; + } + } + else + { + pstat->tx_ra_bitmap &= 0x0000000d; + } + + // disable tx short GI when station cannot rx MCS15(AP is 2T2R) + // disable tx short GI when station cannot rx MCS7 (AP is 1T2R or 1T1R) + // if there is only 1r STA and we are 2T2R, DO NOT mask SGI rate + if ((!(pstat->tx_ra_bitmap & 0x8000000) && (priv->pshare->has_2r_sta > 0) && (get_rf_mimo_mode(padapter) == RTL8712_RF_2T2R)) || + (!(pstat->tx_ra_bitmap & 0x80000) && (get_rf_mimo_mode(padapter) != RTL8712_RF_2T2R))) + { + pstat->tx_ra_bitmap &= ~BIT(28); + } +#endif + + if ( pcur_network->Configuration.DSConfig > 14 ) { + // 5G band + if (tx_ra_bitmap & 0xffff000) + sta_band |= WIRELESS_11_5N ; + + if (tx_ra_bitmap & 0xff0) + sta_band |= WIRELESS_11A; + + } else { + if (tx_ra_bitmap & 0xffff000) + sta_band |= WIRELESS_11_24N; + + if (tx_ra_bitmap & 0xff0) + sta_band |= WIRELESS_11G; + + if (tx_ra_bitmap & 0x0f) + sta_band |= WIRELESS_11B; + } + + psta->wireless_mode = sta_band; + + raid = networktype_to_raid(sta_band); + init_rate = get_highest_rate_idx(tx_ra_bitmap&0x0fffffff)&0x3f; + + if (psta->aid < NUM_STA) + { + u8 arg = 0; + + arg = psta->mac_id&0x1f; + + arg |= BIT(7);//support entry 2~31 + + if (shortGIrate==_TRUE) + arg |= BIT(5); + + tx_ra_bitmap |= ((raid<<28)&0xf0000000); + + DBG_871X("%s=> mac_id:%d , raid:%d , bitmap=0x%x, arg=0x%x\n", + __FUNCTION__ , psta->mac_id, raid ,tx_ra_bitmap, arg); + + //bitmap[0:27] = tx_rate_bitmap + //bitmap[28:31]= Rate Adaptive id + //arg[0:4] = macid + //arg[5] = Short GI + rtw_hal_add_ra_tid(padapter, tx_ra_bitmap, arg, rssi_level); + + + if (shortGIrate==_TRUE) + init_rate |= BIT(6); + + //set ra_id, init_rate + psta->raid = raid; + psta->init_rate = init_rate; + + } + else + { + DBG_871X("station aid %d exceed the max number\n", psta->aid); + } + +} + +void update_bmc_sta(struct adapter *padapter) +{ + _irqL irqL; + u32 init_rate=0; + unsigned char network_type, raid; + int i, supportRateNum = 0; + unsigned int tx_ra_bitmap=0; + struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); + WLAN_BSSID_EX *pcur_network = (WLAN_BSSID_EX *)&pmlmepriv->cur_network.network; + struct sta_info *psta = rtw_get_bcmc_stainfo(padapter); + + if(psta) + { + psta->aid = 0;//default set to 0 + //psta->mac_id = psta->aid+4; + psta->mac_id = psta->aid + 1; + + psta->qos_option = 0; +#ifdef CONFIG_80211N_HT + psta->htpriv.ht_option = _FALSE; +#endif //CONFIG_80211N_HT + + psta->ieee8021x_blocked = 0; + + _rtw_memset((void*)&psta->sta_stats, 0, sizeof(struct stainfo_stats)); + + //psta->dot118021XPrivacy = _NO_PRIVACY_;//!!! remove it, because it has been set before this. + + + + //prepare for add_RATid + supportRateNum = rtw_get_rateset_len((u8*)&pcur_network->SupportedRates); + network_type = rtw_check_network_type((u8*)&pcur_network->SupportedRates, supportRateNum, 1); + + _rtw_memcpy(psta->bssrateset, &pcur_network->SupportedRates, supportRateNum); + psta->bssratelen = supportRateNum; + + //b/g mode ra_bitmap + for (i=0; ibssrateset[i]) + tx_ra_bitmap |= rtw_get_bit_value_from_ieee_value(psta->bssrateset[i]&0x7f); + } + + if ( pcur_network->Configuration.DSConfig > 14 ) { + //force to A mode. 5G doesn't support CCK rates + network_type = WIRELESS_11A; + tx_ra_bitmap = 0x150; // 6, 12, 24 Mbps + } else { + //force to b mode + network_type = WIRELESS_11B; + tx_ra_bitmap = 0xf; + } + + //tx_ra_bitmap = update_basic_rate(pcur_network->SupportedRates, supportRateNum); + + raid = networktype_to_raid(network_type); + init_rate = get_highest_rate_idx(tx_ra_bitmap&0x0fffffff)&0x3f; + + //DBG_871X("Add id %d val %08x to ratr for bmc sta\n", psta->aid, tx_ra_bitmap); + //ap mode + rtw_hal_set_odm_var(padapter, HAL_ODM_STA_INFO, psta, _TRUE); + + //if(pHalData->fw_ractrl == _TRUE) + { + u8 arg = 0; + + arg = psta->mac_id&0x1f; + + arg |= BIT(7); + + //if (shortGIrate==_TRUE) + // arg |= BIT(5); + + tx_ra_bitmap |= ((raid<<28)&0xf0000000); + + DBG_871X("update_bmc_sta, mask=0x%x, arg=0x%x\n", tx_ra_bitmap, arg); + + //bitmap[0:27] = tx_rate_bitmap + //bitmap[28:31]= Rate Adaptive id + //arg[0:4] = macid + //arg[5] = Short GI + rtw_hal_add_ra_tid(padapter, tx_ra_bitmap, arg, 0); + + } + + //set ra_id, init_rate + psta->raid = raid; + psta->init_rate = init_rate; + + rtw_sta_media_status_rpt(padapter, psta, 1); + + _enter_critical_bh(&psta->lock, &irqL); + psta->state = _FW_LINKED; + _exit_critical_bh(&psta->lock, &irqL); + + } + else + { + DBG_871X("add_RATid_bmc_sta error!\n"); + } + +} + +//notes: +//AID: 1~MAX for sta and 0 for bc/mc in ap/adhoc mode +//MAC_ID = AID+1 for sta in ap/adhoc mode +//MAC_ID = 1 for bc/mc for sta/ap/adhoc +//MAC_ID = 0 for bssid for sta/ap/adhoc +//CAM_ID = //0~3 for default key, cmd_id=macid + 3, macid=aid+1; + +void update_sta_info_apmode(struct adapter *padapter, struct sta_info *psta) +{ + _irqL irqL; + struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); + struct security_priv *psecuritypriv = &padapter->securitypriv; + struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); +#ifdef CONFIG_80211N_HT + struct ht_priv *phtpriv_ap = &pmlmepriv->htpriv; + struct ht_priv *phtpriv_sta = &psta->htpriv; +#endif //CONFIG_80211N_HT + //set intf_tag to if1 + //psta->intf_tag = 0; + + //psta->mac_id = psta->aid+4; + psta->mac_id = psta->aid+1; + DBG_871X("%s\n",__FUNCTION__); + + //ap mode + rtw_hal_set_odm_var(padapter,HAL_ODM_STA_INFO,psta,_TRUE); + + if(psecuritypriv->dot11AuthAlgrthm==dot11AuthAlgrthm_8021X) + psta->ieee8021x_blocked = _TRUE; + else + psta->ieee8021x_blocked = _FALSE; + + + //update sta's cap + + //ERP + VCS_update(padapter, psta); +#ifdef CONFIG_80211N_HT + //HT related cap + if(phtpriv_sta->ht_option) + { + //check if sta supports rx ampdu + phtpriv_sta->ampdu_enable = phtpriv_ap->ampdu_enable; + + //check if sta support s Short GI + if((phtpriv_sta->ht_cap.cap_info & phtpriv_ap->ht_cap.cap_info) & cpu_to_le16(IEEE80211_HT_CAP_SGI_20|IEEE80211_HT_CAP_SGI_40)) + { + phtpriv_sta->sgi = _TRUE; + } + + // bwmode + if((phtpriv_sta->ht_cap.cap_info & phtpriv_ap->ht_cap.cap_info) & cpu_to_le16(IEEE80211_HT_CAP_SUP_WIDTH)) + { + //phtpriv_sta->bwmode = HT_CHANNEL_WIDTH_40; + phtpriv_sta->bwmode = pmlmeext->cur_bwmode; + phtpriv_sta->ch_offset = pmlmeext->cur_ch_offset; + + } + + psta->qos_option = _TRUE; + + } + else + { + phtpriv_sta->ampdu_enable = _FALSE; + + phtpriv_sta->sgi = _FALSE; + phtpriv_sta->bwmode = HT_CHANNEL_WIDTH_20; + phtpriv_sta->ch_offset = HAL_PRIME_CHNL_OFFSET_DONT_CARE; + } + + //Rx AMPDU + send_delba(padapter, 0, psta->hwaddr);// recipient + + //TX AMPDU + send_delba(padapter, 1, psta->hwaddr);// // originator + phtpriv_sta->agg_enable_bitmap = 0x0;//reset + phtpriv_sta->candidate_tid_bitmap = 0x0;//reset +#endif //CONFIG_80211N_HT + + //todo: init other variables + + _rtw_memset((void*)&psta->sta_stats, 0, sizeof(struct stainfo_stats)); + + + //add ratid + //add_RATid(padapter, psta);//move to ap_sta_info_defer_update() + + + _enter_critical_bh(&psta->lock, &irqL); + psta->state |= _FW_LINKED; + _exit_critical_bh(&psta->lock, &irqL); + + +} + +static void update_hw_ht_param(struct adapter *padapter) +{ + unsigned char max_AMPDU_len; + unsigned char min_MPDU_spacing; + struct registry_priv *pregpriv = &padapter->registrypriv; + struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; + struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); + + DBG_871X("%s\n", __FUNCTION__); + + + //handle A-MPDU parameter field + /* + AMPDU_para [1:0]:Max AMPDU Len => 0:8k , 1:16k, 2:32k, 3:64k + AMPDU_para [4:2]:Min MPDU Start Spacing + */ + max_AMPDU_len = pmlmeinfo->HT_caps.u.HT_cap_element.AMPDU_para & 0x03; + + min_MPDU_spacing = (pmlmeinfo->HT_caps.u.HT_cap_element.AMPDU_para & 0x1c) >> 2; + + rtw_hal_set_hwreg(padapter, HW_VAR_AMPDU_MIN_SPACE, (u8 *)(&min_MPDU_spacing)); + + rtw_hal_set_hwreg(padapter, HW_VAR_AMPDU_FACTOR, (u8 *)(&max_AMPDU_len)); + + // + // Config SM Power Save setting + // + pmlmeinfo->SM_PS = (pmlmeinfo->HT_caps.u.HT_cap_element.HT_caps_info & 0x0C) >> 2; + if(pmlmeinfo->SM_PS == WLAN_HT_CAP_SM_PS_STATIC) + { + /*u8 i; + //update the MCS rates + for (i = 0; i < 16; i++) + { + pmlmeinfo->HT_caps.HT_cap_element.MCS_rate[i] &= MCS_rate_1R[i]; + }*/ + DBG_871X("%s(): WLAN_HT_CAP_SM_PS_STATIC\n",__FUNCTION__); + } + + // + // Config current HT Protection mode. + // + //pmlmeinfo->HT_protection = pmlmeinfo->HT_info.infos[1] & 0x3; + +} + +static void start_bss_network(struct adapter *padapter, u8 *pbuf) +{ + u8 *p; + u8 val8, cur_channel, cur_bwmode, cur_ch_offset; + u16 bcn_interval; + u32 acparm; + int ie_len; + struct registry_priv *pregpriv = &padapter->registrypriv; + struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); + struct security_priv* psecuritypriv=&(padapter->securitypriv); + WLAN_BSSID_EX *pnetwork = (WLAN_BSSID_EX *)&pmlmepriv->cur_network.network; + struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); + struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); + WLAN_BSSID_EX *pnetwork_mlmeext = &(pmlmeinfo->network); + struct HT_info_element *pht_info=NULL; +#ifdef CONFIG_P2P + struct wifidirect_info *pwdinfo = &(padapter->wdinfo); +#endif //CONFIG_P2P + + //DBG_871X("%s\n", __FUNCTION__); + + bcn_interval = (u16)pnetwork->Configuration.BeaconPeriod; + cur_channel = pnetwork->Configuration.DSConfig; + cur_bwmode = HT_CHANNEL_WIDTH_20;; + cur_ch_offset = HAL_PRIME_CHNL_OFFSET_DONT_CARE; + + + //check if there is wps ie, + //if there is wpsie in beacon, the hostapd will update beacon twice when stating hostapd, + //and at first time the security ie ( RSN/WPA IE) will not include in beacon. + if(NULL == rtw_get_wps_ie(pnetwork->IEs+_FIXED_IE_LENGTH_, pnetwork->IELength-_FIXED_IE_LENGTH_, NULL, NULL)) + { + pmlmeext->bstart_bss = _TRUE; + } + + //todo: update wmm, ht cap + //pmlmeinfo->WMM_enable; + //pmlmeinfo->HT_enable; + if(pmlmepriv->qospriv.qos_option) + pmlmeinfo->WMM_enable = _TRUE; +#ifdef CONFIG_80211N_HT + if(pmlmepriv->htpriv.ht_option) + { + pmlmeinfo->WMM_enable = _TRUE; + pmlmeinfo->HT_enable = _TRUE; + //pmlmeinfo->HT_info_enable = _TRUE; + //pmlmeinfo->HT_caps_enable = _TRUE; + + update_hw_ht_param(padapter); + } +#endif //#CONFIG_80211N_HT + + + if(pmlmepriv->cur_network.join_res != _TRUE) //setting only at first time + { + //WEP Key will be set before this function, do not clear CAM. + if ((psecuritypriv->dot11PrivacyAlgrthm != _WEP40_) && (psecuritypriv->dot11PrivacyAlgrthm != _WEP104_)) + flush_all_cam_entry(padapter); //clear CAM + } + + //set MSR to AP_Mode + Set_MSR(padapter, _HW_STATE_AP_); + + //Set BSSID REG + rtw_hal_set_hwreg(padapter, HW_VAR_BSSID, pnetwork->MacAddress); + + //Set EDCA param reg +#ifdef CONFIG_CONCURRENT_MODE + acparm = 0x005ea42b; +#else + acparm = 0x002F3217; // VO +#endif + rtw_hal_set_hwreg(padapter, HW_VAR_AC_PARAM_VO, (u8 *)(&acparm)); + acparm = 0x005E4317; // VI + rtw_hal_set_hwreg(padapter, HW_VAR_AC_PARAM_VI, (u8 *)(&acparm)); + //acparm = 0x00105320; // BE + acparm = 0x005ea42b; + rtw_hal_set_hwreg(padapter, HW_VAR_AC_PARAM_BE, (u8 *)(&acparm)); + acparm = 0x0000A444; // BK + rtw_hal_set_hwreg(padapter, HW_VAR_AC_PARAM_BK, (u8 *)(&acparm)); + + //Set Security + val8 = (psecuritypriv->dot11AuthAlgrthm == dot11AuthAlgrthm_8021X)? 0xcc: 0xcf; + rtw_hal_set_hwreg(padapter, HW_VAR_SEC_CFG, (u8 *)(&val8)); + + //Beacon Control related register + rtw_hal_set_hwreg(padapter, HW_VAR_BEACON_INTERVAL, (u8 *)(&bcn_interval)); + + + UpdateBrateTbl(padapter, pnetwork->SupportedRates); + rtw_hal_set_hwreg(padapter, HW_VAR_BASIC_RATE, pnetwork->SupportedRates); + + if(pmlmepriv->cur_network.join_res != _TRUE) //setting only at first time + { + //u32 initialgain; + + //initialgain = 0x1e; + + + //disable dynamic functions, such as high power, DIG + //Save_DM_Func_Flag(padapter); + //Switch_DM_Func(padapter, DYNAMIC_FUNC_DISABLE, _FALSE); + +#ifdef CONFIG_CONCURRENT_MODE + if(padapter->adapter_type > PRIMARY_ADAPTER) + { + if(rtw_buddy_adapter_up(padapter)) + { + struct adapter *pbuddy_adapter = padapter->pbuddy_adapter; + + //turn on all dynamic functions on PRIMARY_ADAPTER, dynamic functions only runs at PRIMARY_ADAPTER + Switch_DM_Func(pbuddy_adapter, DYNAMIC_ALL_FUNC_ENABLE, _TRUE); + + //rtw_hal_set_hwreg(pbuddy_adapter, HW_VAR_INITIAL_GAIN, (u8 *)(&initialgain)); + } + } + else +#endif + { + //turn on all dynamic functions + Switch_DM_Func(padapter, DYNAMIC_ALL_FUNC_ENABLE, _TRUE); + + //rtw_hal_set_hwreg(padapter, HW_VAR_INITIAL_GAIN, (u8 *)(&initialgain)); + } + + } +#ifdef CONFIG_80211N_HT + //set channel, bwmode + p = rtw_get_ie((pnetwork->IEs + sizeof(NDIS_802_11_FIXED_IEs)), _HT_ADD_INFO_IE_, &ie_len, (pnetwork->IELength - sizeof(NDIS_802_11_FIXED_IEs))); + if( p && ie_len) + { + pht_info = (struct HT_info_element *)(p+2); + + if ((pregpriv->cbw40_enable) && (pht_info->infos[0] & BIT(2))) + { + //switch to the 40M Hz mode + //pmlmeext->cur_bwmode = HT_CHANNEL_WIDTH_40; + cur_bwmode = HT_CHANNEL_WIDTH_40; + switch (pht_info->infos[0] & 0x3) + { + case 1: + //pmlmeext->cur_ch_offset = HAL_PRIME_CHNL_OFFSET_LOWER; + cur_ch_offset = HAL_PRIME_CHNL_OFFSET_LOWER; + break; + + case 3: + //pmlmeext->cur_ch_offset = HAL_PRIME_CHNL_OFFSET_UPPER; + cur_ch_offset = HAL_PRIME_CHNL_OFFSET_UPPER; + break; + + default: + //pmlmeext->cur_ch_offset = HAL_PRIME_CHNL_OFFSET_DONT_CARE; + cur_ch_offset = HAL_PRIME_CHNL_OFFSET_DONT_CARE; + break; + } + + } + + } +#endif //CONFIG_80211N_HT +#ifdef CONFIG_DUALMAC_CONCURRENT + dc_set_ap_channel_bandwidth(padapter, cur_channel, cur_ch_offset, cur_bwmode); +#else + //TODO: need to judge the phy parameters on concurrent mode for single phy + //set_channel_bwmode(padapter, pmlmeext->cur_channel, pmlmeext->cur_ch_offset, pmlmeext->cur_bwmode); +#ifdef CONFIG_CONCURRENT_MODE + if(!check_buddy_fwstate(padapter, _FW_LINKED|_FW_UNDER_LINKING|_FW_UNDER_SURVEY)) + { + set_channel_bwmode(padapter, cur_channel, cur_ch_offset, cur_bwmode); + } + else if(check_buddy_fwstate(padapter, _FW_LINKED)==_TRUE)//only second adapter can enter AP Mode + { + struct adapter *pbuddy_adapter = padapter->pbuddy_adapter; + struct mlme_ext_priv *pbuddy_mlmeext = &pbuddy_adapter->mlmeextpriv; + + //To sync cur_channel/cur_bwmode/cur_ch_offset with primary adapter + DBG_871X("primary iface is at linked state, sync cur_channel/cur_bwmode/cur_ch_offset\n"); + DBG_871X("primary adapter, CH=%d, BW=%d, offset=%d\n", pbuddy_mlmeext->cur_channel, pbuddy_mlmeext->cur_bwmode, pbuddy_mlmeext->cur_ch_offset); + DBG_871X("second adapter, CH=%d, BW=%d, offset=%d\n", cur_channel, cur_bwmode, cur_ch_offset); + + cur_channel = pbuddy_mlmeext->cur_channel; + if(cur_bwmode == HT_CHANNEL_WIDTH_40) + { + if(pht_info) + pht_info->infos[0] &= ~(BIT(0)|BIT(1)); + + if(pbuddy_mlmeext->cur_bwmode == HT_CHANNEL_WIDTH_40) + { + cur_ch_offset = pbuddy_mlmeext->cur_ch_offset; + + //to update cur_ch_offset value in beacon + if(pht_info) + { + switch(cur_ch_offset) + { + case HAL_PRIME_CHNL_OFFSET_LOWER: + pht_info->infos[0] |= 0x1; + break; + case HAL_PRIME_CHNL_OFFSET_UPPER: + pht_info->infos[0] |= 0x3; + break; + case HAL_PRIME_CHNL_OFFSET_DONT_CARE: + default: + break; + } + } + + } + else if(pbuddy_mlmeext->cur_bwmode == HT_CHANNEL_WIDTH_20) + { + cur_bwmode = HT_CHANNEL_WIDTH_20; + cur_ch_offset = HAL_PRIME_CHNL_OFFSET_DONT_CARE; + + if(cur_channel>0 && cur_channel<5) + { + if(pht_info) + pht_info->infos[0] |= 0x1; + + cur_bwmode = HT_CHANNEL_WIDTH_40; + cur_ch_offset = HAL_PRIME_CHNL_OFFSET_LOWER; + } + + if(cur_channel>7 && cur_channel<(14+1)) + { + if(pht_info) + pht_info->infos[0] |= 0x3; + + cur_bwmode = HT_CHANNEL_WIDTH_40; + cur_ch_offset = HAL_PRIME_CHNL_OFFSET_UPPER; + } + + set_channel_bwmode(padapter, cur_channel, cur_ch_offset, cur_bwmode); + } + + } + + // to update channel value in beacon + pnetwork->Configuration.DSConfig = cur_channel; + p = rtw_get_ie((pnetwork->IEs + sizeof(NDIS_802_11_FIXED_IEs)), _DSSET_IE_, &ie_len, (pnetwork->IELength - sizeof(NDIS_802_11_FIXED_IEs))); + if(p && ie_len>0) + *(p + 2) = cur_channel; + + if(pht_info) + pht_info->primary_channel = cur_channel; + } +#else + set_channel_bwmode(padapter, cur_channel, cur_ch_offset, cur_bwmode); +#endif //CONFIG_CONCURRENT_MODE + + DBG_871X("CH=%d, BW=%d, offset=%d\n", cur_channel, cur_bwmode, cur_ch_offset); + + // + pmlmeext->cur_channel = cur_channel; + pmlmeext->cur_bwmode = cur_bwmode; + pmlmeext->cur_ch_offset = cur_ch_offset; +#endif //CONFIG_DUALMAC_CONCURRENT + pmlmeext->cur_wireless_mode = pmlmepriv->cur_network.network_type; + + //let pnetwork_mlmeext == pnetwork_mlme. + _rtw_memcpy(pnetwork_mlmeext, pnetwork, pnetwork->Length); + + //update cur_wireless_mode + update_wireless_mode(padapter); + + //udpate capability after cur_wireless_mode updated + update_capinfo(padapter, rtw_get_capability((WLAN_BSSID_EX *)pnetwork)); + +#ifdef CONFIG_P2P + _rtw_memcpy(pwdinfo->p2p_group_ssid, pnetwork->Ssid.Ssid, pnetwork->Ssid.SsidLength); + pwdinfo->p2p_group_ssid_len = pnetwork->Ssid.SsidLength; +#endif //CONFIG_P2P + + if(_TRUE == pmlmeext->bstart_bss) + { + update_beacon(padapter, _TIM_IE_, NULL, _FALSE); + +#ifndef CONFIG_INTERRUPT_BASED_TXBCN //other case will tx beacon when bcn interrupt coming in. +#if defined(CONFIG_USB_HCI) || defined(CONFIG_SDIO_HCI) || defined(CONFIG_GSPI_HCI) + //issue beacon frame + if(send_beacon(padapter)==_FAIL) + { + DBG_871X("issue_beacon, fail!\n"); + } +#endif +#endif //!CONFIG_INTERRUPT_BASED_TXBCN + + } + + + //update bc/mc sta_info + update_bmc_sta(padapter); + + //pmlmeext->bstart_bss = _TRUE; + +} + +int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf, int len) +{ + int ret=_SUCCESS; + u8 *p; + u8 *pHT_caps_ie=NULL; + u8 *pHT_info_ie=NULL; + struct sta_info *psta = NULL; + u16 cap, ht_cap=_FALSE; + uint ie_len = 0; + int group_cipher, pairwise_cipher; + u8 channel, network_type, supportRate[NDIS_802_11_LENGTH_RATES_EX]; + int supportRateNum = 0; + u8 OUI1[] = {0x00, 0x50, 0xf2,0x01}; + u8 wps_oui[4]={0x0,0x50,0xf2,0x04}; + u8 WMM_PARA_IE[] = {0x00, 0x50, 0xf2, 0x02, 0x01, 0x01}; + struct registry_priv *pregistrypriv = &padapter->registrypriv; + struct security_priv *psecuritypriv = &padapter->securitypriv; + struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); + WLAN_BSSID_EX *pbss_network = (WLAN_BSSID_EX *)&pmlmepriv->cur_network.network; + struct sta_priv *pstapriv = &padapter->stapriv; + u8 *ie = pbss_network->IEs; + + + /* SSID */ + /* Supported rates */ + /* DS Params */ + /* WLAN_EID_COUNTRY */ + /* ERP Information element */ + /* Extended supported rates */ + /* WPA/WPA2 */ + /* Wi-Fi Wireless Multimedia Extensions */ + /* ht_capab, ht_oper */ + /* WPS IE */ + + DBG_871X("%s, len=%d\n", __FUNCTION__, len); + + if(check_fwstate(pmlmepriv, WIFI_AP_STATE) != _TRUE) + return _FAIL; + + + if(len>MAX_IE_SZ) + return _FAIL; + + pbss_network->IELength = len; + + _rtw_memset(ie, 0, MAX_IE_SZ); + + _rtw_memcpy(ie, pbuf, pbss_network->IELength); + + + if(pbss_network->InfrastructureMode!=Ndis802_11APMode) + return _FAIL; + + pbss_network->Rssi = 0; + + _rtw_memcpy(pbss_network->MacAddress, myid(&(padapter->eeprompriv)), ETH_ALEN); + + //beacon interval + p = rtw_get_beacon_interval_from_ie(ie);//ie + 8; // 8: TimeStamp, 2: Beacon Interval 2:Capability + //pbss_network->Configuration.BeaconPeriod = le16_to_cpu(*(unsigned short*)p); + pbss_network->Configuration.BeaconPeriod = RTW_GET_LE16(p); + + //capability + //cap = *(unsigned short *)rtw_get_capability_from_ie(ie); + //cap = le16_to_cpu(cap); + cap = RTW_GET_LE16(ie); + + //SSID + p = rtw_get_ie(ie + _BEACON_IE_OFFSET_, _SSID_IE_, &ie_len, (pbss_network->IELength -_BEACON_IE_OFFSET_)); + if(p && ie_len>0) + { + _rtw_memset(&pbss_network->Ssid, 0, sizeof(NDIS_802_11_SSID)); + _rtw_memcpy(pbss_network->Ssid.Ssid, (p + 2), ie_len); + pbss_network->Ssid.SsidLength = ie_len; + } + + //chnnel + channel = 0; + pbss_network->Configuration.Length = 0; + p = rtw_get_ie(ie + _BEACON_IE_OFFSET_, _DSSET_IE_, &ie_len, (pbss_network->IELength - _BEACON_IE_OFFSET_)); + if(p && ie_len>0) + channel = *(p + 2); + + pbss_network->Configuration.DSConfig = channel; + + + _rtw_memset(supportRate, 0, NDIS_802_11_LENGTH_RATES_EX); + // get supported rates + p = rtw_get_ie(ie + _BEACON_IE_OFFSET_, _SUPPORTEDRATES_IE_, &ie_len, (pbss_network->IELength - _BEACON_IE_OFFSET_)); + if (p != NULL) + { + _rtw_memcpy(supportRate, p+2, ie_len); + supportRateNum = ie_len; + } + + //get ext_supported rates + p = rtw_get_ie(ie + _BEACON_IE_OFFSET_, _EXT_SUPPORTEDRATES_IE_, &ie_len, pbss_network->IELength - _BEACON_IE_OFFSET_); + if (p != NULL) + { + _rtw_memcpy(supportRate+supportRateNum, p+2, ie_len); + supportRateNum += ie_len; + + } + + network_type = rtw_check_network_type(supportRate, supportRateNum, channel); + + rtw_set_supported_rate(pbss_network->SupportedRates, network_type); + + + //parsing ERP_IE + p = rtw_get_ie(ie + _BEACON_IE_OFFSET_, _ERPINFO_IE_, &ie_len, (pbss_network->IELength - _BEACON_IE_OFFSET_)); + if(p && ie_len>0) + { + ERP_IE_handler(padapter, (PNDIS_802_11_VARIABLE_IEs)p); + } + + //update privacy/security + if (cap & BIT(4)) + pbss_network->Privacy = 1; + else + pbss_network->Privacy = 0; + + psecuritypriv->wpa_psk = 0; + + //wpa2 + group_cipher = 0; pairwise_cipher = 0; + psecuritypriv->wpa2_group_cipher = _NO_PRIVACY_; + psecuritypriv->wpa2_pairwise_cipher = _NO_PRIVACY_; + p = rtw_get_ie(ie + _BEACON_IE_OFFSET_, _RSN_IE_2_, &ie_len, (pbss_network->IELength - _BEACON_IE_OFFSET_)); + if(p && ie_len>0) + { + if(rtw_parse_wpa2_ie(p, ie_len+2, &group_cipher, &pairwise_cipher, NULL) == _SUCCESS) + { + psecuritypriv->dot11AuthAlgrthm= dot11AuthAlgrthm_8021X; + + psecuritypriv->dot8021xalg = 1;//psk, todo:802.1x + psecuritypriv->wpa_psk |= BIT(1); + + psecuritypriv->wpa2_group_cipher = group_cipher; + psecuritypriv->wpa2_pairwise_cipher = pairwise_cipher; +#if 0 + switch(group_cipher) + { + case WPA_CIPHER_NONE: + psecuritypriv->wpa2_group_cipher = _NO_PRIVACY_; + break; + case WPA_CIPHER_WEP40: + psecuritypriv->wpa2_group_cipher = _WEP40_; + break; + case WPA_CIPHER_TKIP: + psecuritypriv->wpa2_group_cipher = _TKIP_; + break; + case WPA_CIPHER_CCMP: + psecuritypriv->wpa2_group_cipher = _AES_; + break; + case WPA_CIPHER_WEP104: + psecuritypriv->wpa2_group_cipher = _WEP104_; + break; + } + + switch(pairwise_cipher) + { + case WPA_CIPHER_NONE: + psecuritypriv->wpa2_pairwise_cipher = _NO_PRIVACY_; + break; + case WPA_CIPHER_WEP40: + psecuritypriv->wpa2_pairwise_cipher = _WEP40_; + break; + case WPA_CIPHER_TKIP: + psecuritypriv->wpa2_pairwise_cipher = _TKIP_; + break; + case WPA_CIPHER_CCMP: + psecuritypriv->wpa2_pairwise_cipher = _AES_; + break; + case WPA_CIPHER_WEP104: + psecuritypriv->wpa2_pairwise_cipher = _WEP104_; + break; + } +#endif + } + + } + + //wpa + ie_len = 0; + group_cipher = 0; pairwise_cipher = 0; + psecuritypriv->wpa_group_cipher = _NO_PRIVACY_; + psecuritypriv->wpa_pairwise_cipher = _NO_PRIVACY_; + for (p = ie + _BEACON_IE_OFFSET_; ;p += (ie_len + 2)) + { + p = rtw_get_ie(p, _SSN_IE_1_, &ie_len, (pbss_network->IELength - _BEACON_IE_OFFSET_ - (ie_len + 2))); + if ((p) && (_rtw_memcmp(p+2, OUI1, 4))) + { + if(rtw_parse_wpa_ie(p, ie_len+2, &group_cipher, &pairwise_cipher, NULL) == _SUCCESS) + { + psecuritypriv->dot11AuthAlgrthm= dot11AuthAlgrthm_8021X; + + psecuritypriv->dot8021xalg = 1;//psk, todo:802.1x + + psecuritypriv->wpa_psk |= BIT(0); + + psecuritypriv->wpa_group_cipher = group_cipher; + psecuritypriv->wpa_pairwise_cipher = pairwise_cipher; + +#if 0 + switch(group_cipher) + { + case WPA_CIPHER_NONE: + psecuritypriv->wpa_group_cipher = _NO_PRIVACY_; + break; + case WPA_CIPHER_WEP40: + psecuritypriv->wpa_group_cipher = _WEP40_; + break; + case WPA_CIPHER_TKIP: + psecuritypriv->wpa_group_cipher = _TKIP_; + break; + case WPA_CIPHER_CCMP: + psecuritypriv->wpa_group_cipher = _AES_; + break; + case WPA_CIPHER_WEP104: + psecuritypriv->wpa_group_cipher = _WEP104_; + break; + } + + switch(pairwise_cipher) + { + case WPA_CIPHER_NONE: + psecuritypriv->wpa_pairwise_cipher = _NO_PRIVACY_; + break; + case WPA_CIPHER_WEP40: + psecuritypriv->wpa_pairwise_cipher = _WEP40_; + break; + case WPA_CIPHER_TKIP: + psecuritypriv->wpa_pairwise_cipher = _TKIP_; + break; + case WPA_CIPHER_CCMP: + psecuritypriv->wpa_pairwise_cipher = _AES_; + break; + case WPA_CIPHER_WEP104: + psecuritypriv->wpa_pairwise_cipher = _WEP104_; + break; + } +#endif + } + + break; + + } + + if ((p == NULL) || (ie_len == 0)) + { + break; + } + + } + + //wmm + ie_len = 0; + pmlmepriv->qospriv.qos_option = 0; + if(pregistrypriv->wmm_enable) + { + for (p = ie + _BEACON_IE_OFFSET_; ;p += (ie_len + 2)) + { + p = rtw_get_ie(p, _VENDOR_SPECIFIC_IE_, &ie_len, (pbss_network->IELength - _BEACON_IE_OFFSET_ - (ie_len + 2))); + if((p) && _rtw_memcmp(p+2, WMM_PARA_IE, 6)) + { + pmlmepriv->qospriv.qos_option = 1; + + *(p+8) |= BIT(7);//QoS Info, support U-APSD + + /* disable all ACM bits since the WMM admission control is not supported */ + *(p + 10) &= ~BIT(4); /* BE */ + *(p + 14) &= ~BIT(4); /* BK */ + *(p + 18) &= ~BIT(4); /* VI */ + *(p + 22) &= ~BIT(4); /* VO */ + + break; + } + + if ((p == NULL) || (ie_len == 0)) + { + break; + } + } + } +#ifdef CONFIG_80211N_HT + //parsing HT_CAP_IE + p = rtw_get_ie(ie + _BEACON_IE_OFFSET_, _HT_CAPABILITY_IE_, &ie_len, (pbss_network->IELength - _BEACON_IE_OFFSET_)); + if(p && ie_len>0) + { + u8 rf_type; + + struct rtw_ieee80211_ht_cap *pht_cap = (struct rtw_ieee80211_ht_cap *)(p+2); + + pHT_caps_ie=p; + + + ht_cap = _TRUE; + network_type |= WIRELESS_11_24N; + + + rtw_hal_get_hwreg(padapter, HW_VAR_RF_TYPE, (u8 *)(&rf_type)); + + if((psecuritypriv->wpa_pairwise_cipher & WPA_CIPHER_CCMP) || + (psecuritypriv->wpa2_pairwise_cipher & WPA_CIPHER_CCMP)) + { + pht_cap->ampdu_params_info |= (IEEE80211_HT_CAP_AMPDU_DENSITY&(0x07<<2)); + } + else + { + pht_cap->ampdu_params_info |= (IEEE80211_HT_CAP_AMPDU_DENSITY&0x00); + } + + pht_cap->ampdu_params_info |= (IEEE80211_HT_CAP_AMPDU_FACTOR & 0x03); //set Max Rx AMPDU size to 64K + + if(rf_type == RF_1T1R) + { + pht_cap->supp_mcs_set[0] = 0xff; + pht_cap->supp_mcs_set[1] = 0x0; + } + + _rtw_memcpy(&pmlmepriv->htpriv.ht_cap, p+2, ie_len); + + } + + //parsing HT_INFO_IE + p = rtw_get_ie(ie + _BEACON_IE_OFFSET_, _HT_ADD_INFO_IE_, &ie_len, (pbss_network->IELength - _BEACON_IE_OFFSET_)); + if(p && ie_len>0) + { + pHT_info_ie=p; + } +#endif //CONFIG_80211N_HT + switch(network_type) + { + case WIRELESS_11B: + pbss_network->NetworkTypeInUse = Ndis802_11DS; + break; + case WIRELESS_11G: + case WIRELESS_11BG: + case WIRELESS_11G_24N: + case WIRELESS_11BG_24N: + pbss_network->NetworkTypeInUse = Ndis802_11OFDM24; + break; + case WIRELESS_11A: + pbss_network->NetworkTypeInUse = Ndis802_11OFDM5; + break; + default : + pbss_network->NetworkTypeInUse = Ndis802_11OFDM24; + break; + } + + pmlmepriv->cur_network.network_type = network_type; + +#ifdef CONFIG_80211N_HT + pmlmepriv->htpriv.ht_option = _FALSE; + + if( (psecuritypriv->wpa2_pairwise_cipher&WPA_CIPHER_TKIP) || + (psecuritypriv->wpa_pairwise_cipher&WPA_CIPHER_TKIP)) + { + //todo: + //ht_cap = _FALSE; + } + + //ht_cap + if(pregistrypriv->ht_enable && ht_cap==_TRUE) + { + pmlmepriv->htpriv.ht_option = _TRUE; + pmlmepriv->qospriv.qos_option = 1; + + if(pregistrypriv->ampdu_enable==1) + { + pmlmepriv->htpriv.ampdu_enable = _TRUE; + } + + HT_caps_handler(padapter, (PNDIS_802_11_VARIABLE_IEs)pHT_caps_ie); + + HT_info_handler(padapter, (PNDIS_802_11_VARIABLE_IEs)pHT_info_ie); + } +#endif + + + pbss_network->Length = get_WLAN_BSSID_EX_sz((WLAN_BSSID_EX *)pbss_network); + + //issue beacon to start bss network + start_bss_network(padapter, (u8*)pbss_network); + + + //alloc sta_info for ap itself + psta = rtw_get_stainfo(&padapter->stapriv, pbss_network->MacAddress); + if(!psta) + { + psta = rtw_alloc_stainfo(&padapter->stapriv, pbss_network->MacAddress); + if (psta == NULL) + { + return _FAIL; + } + } + psta->state |= WIFI_AP_STATE; //Aries, add,fix bug of flush_cam_entry at STOP AP mode , 0724 + rtw_indicate_connect( padapter); + + pmlmepriv->cur_network.join_res = _TRUE;//for check if already set beacon + + //update bc/mc sta_info + //update_bmc_sta(padapter); + + return ret; + +} + +void rtw_set_macaddr_acl(struct adapter *padapter, int mode) +{ + struct sta_priv *pstapriv = &padapter->stapriv; + struct wlan_acl_pool *pacl_list = &pstapriv->acl_list; + + DBG_871X("%s, mode=%d\n", __func__, mode); + + pacl_list->mode = mode; +} + +int rtw_acl_add_sta(struct adapter *padapter, u8 *addr) +{ + _irqL irqL; + _list *plist, *phead; + u8 added = _FALSE; + int i, ret=0; + struct rtw_wlan_acl_node *paclnode; + struct sta_priv *pstapriv = &padapter->stapriv; + struct wlan_acl_pool *pacl_list = &pstapriv->acl_list; + _queue *pacl_node_q =&pacl_list->acl_node_q; + + DBG_871X("%s(acl_num=%d)=" MAC_FMT "\n", __func__, pacl_list->num, MAC_ARG(addr)); + + if((NUM_ACL-1) < pacl_list->num) + return (-1); + + + _enter_critical_bh(&(pacl_node_q->lock), &irqL); + + phead = get_list_head(pacl_node_q); + plist = get_next(phead); + + while ((rtw_end_of_queue_search(phead, plist)) == _FALSE) + { + paclnode = LIST_CONTAINOR(plist, struct rtw_wlan_acl_node, list); + plist = get_next(plist); + + if(_rtw_memcmp(paclnode->addr, addr, ETH_ALEN)) + { + if(paclnode->valid == _TRUE) + { + added = _TRUE; + DBG_871X("%s, sta has been added\n", __func__); + break; + } + } + } + + _exit_critical_bh(&(pacl_node_q->lock), &irqL); + + + if(added == _TRUE) + return ret; + + + _enter_critical_bh(&(pacl_node_q->lock), &irqL); + + for(i=0; i< NUM_ACL; i++) + { + paclnode = &pacl_list->aclnode[i]; + + if(paclnode->valid == _FALSE) + { + _rtw_init_listhead(&paclnode->list); + + _rtw_memcpy(paclnode->addr, addr, ETH_ALEN); + + paclnode->valid = _TRUE; + + rtw_list_insert_tail(&paclnode->list, get_list_head(pacl_node_q)); + + pacl_list->num++; + + break; + } + } + + DBG_871X("%s, acl_num=%d\n", __func__, pacl_list->num); + + _exit_critical_bh(&(pacl_node_q->lock), &irqL); + + return ret; +} + +int rtw_acl_remove_sta(struct adapter *padapter, u8 *addr) +{ + _irqL irqL; + _list *plist, *phead; + int i, ret=0; + struct rtw_wlan_acl_node *paclnode; + struct sta_priv *pstapriv = &padapter->stapriv; + struct wlan_acl_pool *pacl_list = &pstapriv->acl_list; + _queue *pacl_node_q =&pacl_list->acl_node_q; + + DBG_871X("%s(acl_num=%d)=" MAC_FMT "\n", __func__, pacl_list->num, MAC_ARG(addr)); + + _enter_critical_bh(&(pacl_node_q->lock), &irqL); + + phead = get_list_head(pacl_node_q); + plist = get_next(phead); + + while ((rtw_end_of_queue_search(phead, plist)) == _FALSE) + { + paclnode = LIST_CONTAINOR(plist, struct rtw_wlan_acl_node, list); + plist = get_next(plist); + + if(_rtw_memcmp(paclnode->addr, addr, ETH_ALEN)) + { + if(paclnode->valid == _TRUE) + { + paclnode->valid = _FALSE; + + rtw_list_delete(&paclnode->list); + + pacl_list->num--; + } + } + } + + _exit_critical_bh(&(pacl_node_q->lock), &irqL); + + DBG_871X("%s, acl_num=%d\n", __func__, pacl_list->num); + + return ret; + +} + +#ifdef CONFIG_NATIVEAP_MLME + +static void update_bcn_fixed_ie(struct adapter *padapter) +{ + DBG_871X("%s\n", __FUNCTION__); + +} + +static void update_bcn_erpinfo_ie(struct adapter *padapter) +{ + struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); + struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); + struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); + WLAN_BSSID_EX *pnetwork = &(pmlmeinfo->network); + unsigned char *p, *ie = pnetwork->IEs; + u32 len = 0; + + DBG_871X("%s, ERP_enable=%d\n", __FUNCTION__, pmlmeinfo->ERP_enable); + + if(!pmlmeinfo->ERP_enable) + return; + + //parsing ERP_IE + p = rtw_get_ie(ie + _BEACON_IE_OFFSET_, _ERPINFO_IE_, &len, (pnetwork->IELength - _BEACON_IE_OFFSET_)); + if(p && len>0) + { + PNDIS_802_11_VARIABLE_IEs pIE = (PNDIS_802_11_VARIABLE_IEs)p; + + if (pmlmepriv->num_sta_non_erp == 1) + pIE->data[0] |= RTW_ERP_INFO_NON_ERP_PRESENT|RTW_ERP_INFO_USE_PROTECTION; + else + pIE->data[0] &= ~(RTW_ERP_INFO_NON_ERP_PRESENT|RTW_ERP_INFO_USE_PROTECTION); + + if(pmlmepriv->num_sta_no_short_preamble > 0) + pIE->data[0] |= RTW_ERP_INFO_BARKER_PREAMBLE_MODE; + else + pIE->data[0] &= ~(RTW_ERP_INFO_BARKER_PREAMBLE_MODE); + + ERP_IE_handler(padapter, pIE); + } + +} + +static void update_bcn_htcap_ie(struct adapter *padapter) +{ + DBG_871X("%s\n", __FUNCTION__); + +} + +static void update_bcn_htinfo_ie(struct adapter *padapter) +{ + DBG_871X("%s\n", __FUNCTION__); + +} + +static void update_bcn_rsn_ie(struct adapter *padapter) +{ + DBG_871X("%s\n", __FUNCTION__); + +} + +static void update_bcn_wpa_ie(struct adapter *padapter) +{ + DBG_871X("%s\n", __FUNCTION__); + +} + +static void update_bcn_wmm_ie(struct adapter *padapter) +{ + DBG_871X("%s\n", __FUNCTION__); + +} + +static void update_bcn_wps_ie(struct adapter *padapter) +{ + u8 *pwps_ie=NULL, *pwps_ie_src, *premainder_ie, *pbackup_remainder_ie=NULL; + uint wps_ielen=0, wps_offset, remainder_ielen; + struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); + struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); + struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); + WLAN_BSSID_EX *pnetwork = &(pmlmeinfo->network); + unsigned char *ie = pnetwork->IEs; + u32 ielen = pnetwork->IELength; + + + DBG_871X("%s\n", __FUNCTION__); + + pwps_ie = rtw_get_wps_ie(ie+_FIXED_IE_LENGTH_, ielen-_FIXED_IE_LENGTH_, NULL, &wps_ielen); + + if(pwps_ie==NULL || wps_ielen==0) + return; + + wps_offset = (uint)(pwps_ie-ie); + + premainder_ie = pwps_ie + wps_ielen; + + remainder_ielen = ielen - wps_offset - wps_ielen; + + if(remainder_ielen>0) + { + pbackup_remainder_ie = rtw_malloc(remainder_ielen); + if(pbackup_remainder_ie) + _rtw_memcpy(pbackup_remainder_ie, premainder_ie, remainder_ielen); + } + + + pwps_ie_src = pmlmepriv->wps_beacon_ie; + if(pwps_ie_src == NULL) + return; + + + wps_ielen = (uint)pwps_ie_src[1];//to get ie data len + if((wps_offset+wps_ielen+2+remainder_ielen)<=MAX_IE_SZ) + { + _rtw_memcpy(pwps_ie, pwps_ie_src, wps_ielen+2); + pwps_ie += (wps_ielen+2); + + if(pbackup_remainder_ie) + _rtw_memcpy(pwps_ie, pbackup_remainder_ie, remainder_ielen); + + //update IELength + pnetwork->IELength = wps_offset + (wps_ielen+2) + remainder_ielen; + } + + if(pbackup_remainder_ie) + rtw_mfree(pbackup_remainder_ie, remainder_ielen); + +} + +static void update_bcn_p2p_ie(struct adapter *padapter) +{ + +} + +static void update_bcn_vendor_spec_ie(struct adapter *padapter, u8*oui) +{ + DBG_871X("%s\n", __FUNCTION__); + + if(_rtw_memcmp(RTW_WPA_OUI, oui, 4)) + { + update_bcn_wpa_ie(padapter); + } + else if(_rtw_memcmp(WMM_OUI, oui, 4)) + { + update_bcn_wmm_ie(padapter); + } + else if(_rtw_memcmp(WPS_OUI, oui, 4)) + { + update_bcn_wps_ie(padapter); + } + else if(_rtw_memcmp(P2P_OUI, oui, 4)) + { + update_bcn_p2p_ie(padapter); + } + else + { + DBG_871X("unknown OUI type!\n"); + } + + +} + +void update_beacon(struct adapter *padapter, u8 ie_id, u8 *oui, u8 tx) +{ + _irqL irqL; + struct mlme_priv *pmlmepriv; + struct mlme_ext_priv *pmlmeext; + //struct mlme_ext_info *pmlmeinfo; + + //DBG_871X("%s\n", __FUNCTION__); + + if(!padapter) + return; + + pmlmepriv = &(padapter->mlmepriv); + pmlmeext = &(padapter->mlmeextpriv); + //pmlmeinfo = &(pmlmeext->mlmext_info); + + if(_FALSE == pmlmeext->bstart_bss) + return; + + _enter_critical_bh(&pmlmepriv->bcn_update_lock, &irqL); + + switch(ie_id) + { + case 0xFF: + + update_bcn_fixed_ie(padapter);//8: TimeStamp, 2: Beacon Interval 2:Capability + + break; + + case _TIM_IE_: + + update_BCNTIM(padapter); + + break; + + case _ERPINFO_IE_: + + update_bcn_erpinfo_ie(padapter); + + break; + + case _HT_CAPABILITY_IE_: + + update_bcn_htcap_ie(padapter); + + break; + + case _RSN_IE_2_: + + update_bcn_rsn_ie(padapter); + + break; + + case _HT_ADD_INFO_IE_: + + update_bcn_htinfo_ie(padapter); + + break; + + case _VENDOR_SPECIFIC_IE_: + + update_bcn_vendor_spec_ie(padapter, oui); + + break; + + default: + break; + } + + pmlmepriv->update_bcn = _TRUE; + + _exit_critical_bh(&pmlmepriv->bcn_update_lock, &irqL); + +#ifndef CONFIG_INTERRUPT_BASED_TXBCN +#if defined(CONFIG_USB_HCI) || defined(CONFIG_SDIO_HCI) || defined(CONFIG_GSPI_HCI) + if(tx) + { + //send_beacon(padapter);//send_beacon must execute on TSR level + set_tx_beacon_cmd(padapter); + } +#else + { + //PCI will issue beacon when BCN interrupt occurs. + } +#endif +#endif //!CONFIG_INTERRUPT_BASED_TXBCN + +} + +#ifdef CONFIG_80211N_HT + +/* +op_mode +Set to 0 (HT pure) under the followign conditions + - all STAs in the BSS are 20/40 MHz HT in 20/40 MHz BSS or + - all STAs in the BSS are 20 MHz HT in 20 MHz BSS +Set to 1 (HT non-member protection) if there may be non-HT STAs + in both the primary and the secondary channel +Set to 2 if only HT STAs are associated in BSS, + however and at least one 20 MHz HT STA is associated +Set to 3 (HT mixed mode) when one or more non-HT STAs are associated + (currently non-GF HT station is considered as non-HT STA also) +*/ +static int rtw_ht_operation_update(struct adapter *padapter) +{ + u16 cur_op_mode, new_op_mode; + int op_mode_changes = 0; + struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); + struct ht_priv *phtpriv_ap = &pmlmepriv->htpriv; + + if(pmlmepriv->htpriv.ht_option == _TRUE) + return 0; + + //if (!iface->conf->ieee80211n || iface->conf->ht_op_mode_fixed) + // return 0; + + DBG_871X("%s current operation mode=0x%X\n", + __FUNCTION__, pmlmepriv->ht_op_mode); + + if (!(pmlmepriv->ht_op_mode & HT_INFO_OPERATION_MODE_NON_GF_DEVS_PRESENT) + && pmlmepriv->num_sta_ht_no_gf) { + pmlmepriv->ht_op_mode |= + HT_INFO_OPERATION_MODE_NON_GF_DEVS_PRESENT; + op_mode_changes++; + } else if ((pmlmepriv->ht_op_mode & + HT_INFO_OPERATION_MODE_NON_GF_DEVS_PRESENT) && + pmlmepriv->num_sta_ht_no_gf == 0) { + pmlmepriv->ht_op_mode &= + ~HT_INFO_OPERATION_MODE_NON_GF_DEVS_PRESENT; + op_mode_changes++; + } + + if (!(pmlmepriv->ht_op_mode & HT_INFO_OPERATION_MODE_NON_HT_STA_PRESENT) && + (pmlmepriv->num_sta_no_ht || pmlmepriv->olbc_ht)) { + pmlmepriv->ht_op_mode |= HT_INFO_OPERATION_MODE_NON_HT_STA_PRESENT; + op_mode_changes++; + } else if ((pmlmepriv->ht_op_mode & + HT_INFO_OPERATION_MODE_NON_HT_STA_PRESENT) && + (pmlmepriv->num_sta_no_ht == 0 && !pmlmepriv->olbc_ht)) { + pmlmepriv->ht_op_mode &= + ~HT_INFO_OPERATION_MODE_NON_HT_STA_PRESENT; + op_mode_changes++; + } + + /* Note: currently we switch to the MIXED op mode if HT non-greenfield + * station is associated. Probably it's a theoretical case, since + * it looks like all known HT STAs support greenfield. + */ + new_op_mode = 0; + if (pmlmepriv->num_sta_no_ht || + (pmlmepriv->ht_op_mode & HT_INFO_OPERATION_MODE_NON_GF_DEVS_PRESENT)) + new_op_mode = OP_MODE_MIXED; + else if ((phtpriv_ap->ht_cap.cap_info & IEEE80211_HT_CAP_SUP_WIDTH) + && pmlmepriv->num_sta_ht_20mhz) + new_op_mode = OP_MODE_20MHZ_HT_STA_ASSOCED; + else if (pmlmepriv->olbc_ht) + new_op_mode = OP_MODE_MAY_BE_LEGACY_STAS; + else + new_op_mode = OP_MODE_PURE; + + cur_op_mode = pmlmepriv->ht_op_mode & HT_INFO_OPERATION_MODE_OP_MODE_MASK; + if (cur_op_mode != new_op_mode) { + pmlmepriv->ht_op_mode &= ~HT_INFO_OPERATION_MODE_OP_MODE_MASK; + pmlmepriv->ht_op_mode |= new_op_mode; + op_mode_changes++; + } + + DBG_871X("%s new operation mode=0x%X changes=%d\n", + __FUNCTION__, pmlmepriv->ht_op_mode, op_mode_changes); + + return op_mode_changes; + +} + +#endif /* CONFIG_80211N_HT */ + +void associated_clients_update(struct adapter *padapter, u8 updated) +{ + //update associcated stations cap. + if(updated == _TRUE) + { + _irqL irqL; + _list *phead, *plist; + struct sta_info *psta=NULL; + struct sta_priv *pstapriv = &padapter->stapriv; + + _enter_critical_bh(&pstapriv->asoc_list_lock, &irqL); + + phead = &pstapriv->asoc_list; + plist = get_next(phead); + + //check asoc_queue + while ((rtw_end_of_queue_search(phead, plist)) == _FALSE) + { + psta = LIST_CONTAINOR(plist, struct sta_info, asoc_list); + + plist = get_next(plist); + + VCS_update(padapter, psta); + } + + _exit_critical_bh(&pstapriv->asoc_list_lock, &irqL); + + } + +} + +/* called > TSR LEVEL for USB or SDIO Interface*/ +void bss_cap_update_on_sta_join(struct adapter *padapter, struct sta_info *psta) +{ + u8 beacon_updated = _FALSE; + struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); + struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); + + +#if 0 + if (!(psta->capability & WLAN_CAPABILITY_SHORT_PREAMBLE) && + !psta->no_short_preamble_set) { + psta->no_short_preamble_set = 1; + pmlmepriv->num_sta_no_short_preamble++; + if ((pmlmeext->cur_wireless_mode > WIRELESS_11B) && + (pmlmepriv->num_sta_no_short_preamble == 1)) + ieee802_11_set_beacons(hapd->iface); + } +#endif + + + if(!(psta->flags & WLAN_STA_SHORT_PREAMBLE)) + { + if(!psta->no_short_preamble_set) + { + psta->no_short_preamble_set = 1; + + pmlmepriv->num_sta_no_short_preamble++; + + if ((pmlmeext->cur_wireless_mode > WIRELESS_11B) && + (pmlmepriv->num_sta_no_short_preamble == 1)) + { + beacon_updated = _TRUE; + update_beacon(padapter, 0xFF, NULL, _TRUE); + } + + } + } + else + { + if(psta->no_short_preamble_set) + { + psta->no_short_preamble_set = 0; + + pmlmepriv->num_sta_no_short_preamble--; + + if ((pmlmeext->cur_wireless_mode > WIRELESS_11B) && + (pmlmepriv->num_sta_no_short_preamble == 0)) + { + beacon_updated = _TRUE; + update_beacon(padapter, 0xFF, NULL, _TRUE); + } + + } + } + +#if 0 + if (psta->flags & WLAN_STA_NONERP && !psta->nonerp_set) { + psta->nonerp_set = 1; + pmlmepriv->num_sta_non_erp++; + if (pmlmepriv->num_sta_non_erp == 1) + ieee802_11_set_beacons(hapd->iface); + } +#endif + + if(psta->flags & WLAN_STA_NONERP) + { + if(!psta->nonerp_set) + { + psta->nonerp_set = 1; + + pmlmepriv->num_sta_non_erp++; + + if (pmlmepriv->num_sta_non_erp == 1) + { + beacon_updated = _TRUE; + update_beacon(padapter, _ERPINFO_IE_, NULL, _TRUE); + } + } + + } + else + { + if(psta->nonerp_set) + { + psta->nonerp_set = 0; + + pmlmepriv->num_sta_non_erp--; + + if (pmlmepriv->num_sta_non_erp == 0) + { + beacon_updated = _TRUE; + update_beacon(padapter, _ERPINFO_IE_, NULL, _TRUE); + } + } + + } + + +#if 0 + if (!(psta->capability & WLAN_CAPABILITY_SHORT_SLOT) && + !psta->no_short_slot_time_set) { + psta->no_short_slot_time_set = 1; + pmlmepriv->num_sta_no_short_slot_time++; + if ((pmlmeext->cur_wireless_mode > WIRELESS_11B) && + (pmlmepriv->num_sta_no_short_slot_time == 1)) + ieee802_11_set_beacons(hapd->iface); + } +#endif + + if(!(psta->capability & WLAN_CAPABILITY_SHORT_SLOT)) + { + if(!psta->no_short_slot_time_set) + { + psta->no_short_slot_time_set = 1; + + pmlmepriv->num_sta_no_short_slot_time++; + + if ((pmlmeext->cur_wireless_mode > WIRELESS_11B) && + (pmlmepriv->num_sta_no_short_slot_time == 1)) + { + beacon_updated = _TRUE; + update_beacon(padapter, 0xFF, NULL, _TRUE); + } + + } + } + else + { + if(psta->no_short_slot_time_set) + { + psta->no_short_slot_time_set = 0; + + pmlmepriv->num_sta_no_short_slot_time--; + + if ((pmlmeext->cur_wireless_mode > WIRELESS_11B) && + (pmlmepriv->num_sta_no_short_slot_time == 0)) + { + beacon_updated = _TRUE; + update_beacon(padapter, 0xFF, NULL, _TRUE); + } + } + } + +#ifdef CONFIG_80211N_HT + + if (psta->flags & WLAN_STA_HT) + { + u16 ht_capab = le16_to_cpu(psta->htpriv.ht_cap.cap_info); + + DBG_871X("HT: STA " MAC_FMT " HT Capabilities " + "Info: 0x%04x\n", MAC_ARG(psta->hwaddr), ht_capab); + + if (psta->no_ht_set) { + psta->no_ht_set = 0; + pmlmepriv->num_sta_no_ht--; + } + + if ((ht_capab & IEEE80211_HT_CAP_GRN_FLD) == 0) { + if (!psta->no_ht_gf_set) { + psta->no_ht_gf_set = 1; + pmlmepriv->num_sta_ht_no_gf++; + } + DBG_871X("%s STA " MAC_FMT " - no " + "greenfield, num of non-gf stations %d\n", + __FUNCTION__, MAC_ARG(psta->hwaddr), + pmlmepriv->num_sta_ht_no_gf); + } + + if ((ht_capab & IEEE80211_HT_CAP_SUP_WIDTH) == 0) { + if (!psta->ht_20mhz_set) { + psta->ht_20mhz_set = 1; + pmlmepriv->num_sta_ht_20mhz++; + } + DBG_871X("%s STA " MAC_FMT " - 20 MHz HT, " + "num of 20MHz HT STAs %d\n", + __FUNCTION__, MAC_ARG(psta->hwaddr), + pmlmepriv->num_sta_ht_20mhz); + } + + } + else + { + if (!psta->no_ht_set) { + psta->no_ht_set = 1; + pmlmepriv->num_sta_no_ht++; + } + if(pmlmepriv->htpriv.ht_option == _TRUE) { + DBG_871X("%s STA " MAC_FMT + " - no HT, num of non-HT stations %d\n", + __FUNCTION__, MAC_ARG(psta->hwaddr), + pmlmepriv->num_sta_no_ht); + } + } + + if (rtw_ht_operation_update(padapter) > 0) + { + update_beacon(padapter, _HT_CAPABILITY_IE_, NULL, _FALSE); + update_beacon(padapter, _HT_ADD_INFO_IE_, NULL, _TRUE); + } + +#endif /* CONFIG_80211N_HT */ + + //update associcated stations cap. + associated_clients_update(padapter, beacon_updated); + + DBG_871X("%s, updated=%d\n", __func__, beacon_updated); + +} + +u8 bss_cap_update_on_sta_leave(struct adapter *padapter, struct sta_info *psta) +{ + u8 beacon_updated = _FALSE; + struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); + struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); + + if(!psta) + return beacon_updated; + + if (psta->no_short_preamble_set) { + psta->no_short_preamble_set = 0; + pmlmepriv->num_sta_no_short_preamble--; + if (pmlmeext->cur_wireless_mode > WIRELESS_11B + && pmlmepriv->num_sta_no_short_preamble == 0) + { + beacon_updated = _TRUE; + update_beacon(padapter, 0xFF, NULL, _TRUE); + } + } + + if (psta->nonerp_set) { + psta->nonerp_set = 0; + pmlmepriv->num_sta_non_erp--; + if (pmlmepriv->num_sta_non_erp == 0) + { + beacon_updated = _TRUE; + update_beacon(padapter, _ERPINFO_IE_, NULL, _TRUE); + } + } + + if (psta->no_short_slot_time_set) { + psta->no_short_slot_time_set = 0; + pmlmepriv->num_sta_no_short_slot_time--; + if (pmlmeext->cur_wireless_mode > WIRELESS_11B + && pmlmepriv->num_sta_no_short_slot_time == 0) + { + beacon_updated = _TRUE; + update_beacon(padapter, 0xFF, NULL, _TRUE); + } + } + +#ifdef CONFIG_80211N_HT + + if (psta->no_ht_gf_set) { + psta->no_ht_gf_set = 0; + pmlmepriv->num_sta_ht_no_gf--; + } + + if (psta->no_ht_set) { + psta->no_ht_set = 0; + pmlmepriv->num_sta_no_ht--; + } + + if (psta->ht_20mhz_set) { + psta->ht_20mhz_set = 0; + pmlmepriv->num_sta_ht_20mhz--; + } + + if (rtw_ht_operation_update(padapter) > 0) + { + update_beacon(padapter, _HT_CAPABILITY_IE_, NULL, _FALSE); + update_beacon(padapter, _HT_ADD_INFO_IE_, NULL, _TRUE); + } + +#endif /* CONFIG_80211N_HT */ + + //update associcated stations cap. + //associated_clients_update(padapter, beacon_updated); //move it to avoid deadlock + + DBG_871X("%s, updated=%d\n", __func__, beacon_updated); + + return beacon_updated; + +} + +u8 ap_free_sta(struct adapter *padapter, struct sta_info *psta, bool active, u16 reason) +{ + _irqL irqL; + u8 beacon_updated = _FALSE; + struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); + struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); + struct sta_priv *pstapriv = &padapter->stapriv; + + if(!psta) + return beacon_updated; + + if (active == _TRUE) + { +#ifdef CONFIG_80211N_HT + //tear down Rx AMPDU + send_delba(padapter, 0, psta->hwaddr);// recipient + + //tear down TX AMPDU + send_delba(padapter, 1, psta->hwaddr);// // originator + +#endif //CONFIG_80211N_HT + + issue_deauth(padapter, psta->hwaddr, reason); + } + + psta->htpriv.agg_enable_bitmap = 0x0;//reset + psta->htpriv.candidate_tid_bitmap = 0x0;//reset + + + //report_del_sta_event(padapter, psta->hwaddr, reason); + + //clear cam entry / key + //clear_cam_entry(padapter, (psta->mac_id + 3)); + rtw_clearstakey_cmd(padapter, (u8*)psta, (u8)(psta->mac_id + 3), _TRUE); + + + _enter_critical_bh(&psta->lock, &irqL); + psta->state &= ~_FW_LINKED; + _exit_critical_bh(&psta->lock, &irqL); + + #ifdef CONFIG_IOCTL_CFG80211 + if (1) { + #ifdef COMPAT_KERNEL_RELEASE + rtw_cfg80211_indicate_sta_disassoc(padapter, psta->hwaddr, reason); + #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) && !defined(CONFIG_CFG80211_FORCE_COMPATIBLE_2_6_37_UNDER) + rtw_cfg80211_indicate_sta_disassoc(padapter, psta->hwaddr, reason); + #else //(LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) && !defined(CONFIG_CFG80211_FORCE_COMPATIBLE_2_6_37_UNDER) + /* will call rtw_cfg80211_indicate_sta_disassoc() in cmd_thread for old API context */ + #endif //(LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) && !defined(CONFIG_CFG80211_FORCE_COMPATIBLE_2_6_37_UNDER) + } else + #endif //CONFIG_IOCTL_CFG80211 + { + rtw_indicate_sta_disassoc_event(padapter, psta); + } + + report_del_sta_event(padapter, psta->hwaddr, reason); + + beacon_updated = bss_cap_update_on_sta_leave(padapter, psta); + + _enter_critical_bh(&(pstapriv->sta_hash_lock), &irqL); + rtw_free_stainfo(padapter, psta); + _exit_critical_bh(&(pstapriv->sta_hash_lock), &irqL); + + + return beacon_updated; + +} + +int rtw_ap_inform_ch_switch(struct adapter *padapter, u8 new_ch, u8 ch_offset) +{ + _irqL irqL; + _list *phead, *plist; + int ret=0; + struct sta_info *psta = NULL; + struct sta_priv *pstapriv = &padapter->stapriv; + struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; + struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); + u8 bc_addr[ETH_ALEN] = {0xff,0xff,0xff,0xff,0xff,0xff}; + + if((pmlmeinfo->state&0x03) != WIFI_FW_AP_STATE) + return ret; + + DBG_871X(FUNC_NDEV_FMT" with ch:%u, offset:%u\n", + FUNC_NDEV_ARG(padapter->pnetdev), new_ch, ch_offset); + + _enter_critical_bh(&pstapriv->asoc_list_lock, &irqL); + phead = &pstapriv->asoc_list; + plist = get_next(phead); + + /* for each sta in asoc_queue */ + while ((rtw_end_of_queue_search(phead, plist)) == _FALSE) + { + psta = LIST_CONTAINOR(plist, struct sta_info, asoc_list); + plist = get_next(plist); + + issue_action_spct_ch_switch(padapter, psta->hwaddr, new_ch, ch_offset); + psta->expire_to = ((pstapriv->expire_to * 2) > 5) ? 5 : (pstapriv->expire_to * 2); + } + _exit_critical_bh(&pstapriv->asoc_list_lock, &irqL); + + issue_action_spct_ch_switch(padapter, bc_addr, new_ch, ch_offset); + + return ret; +} + +int rtw_sta_flush(struct adapter *padapter) +{ + _irqL irqL; + _list *phead, *plist; + int ret=0; + struct sta_info *psta = NULL; + struct sta_priv *pstapriv = &padapter->stapriv; + struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; + struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); + u8 bc_addr[ETH_ALEN] = {0xff,0xff,0xff,0xff,0xff,0xff}; + u8 chk_alive_num = 0; + char chk_alive_list[NUM_STA]; + int i; + + DBG_871X(FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(padapter->pnetdev)); + + if((pmlmeinfo->state&0x03) != WIFI_FW_AP_STATE) + return ret; + + _enter_critical_bh(&pstapriv->asoc_list_lock, &irqL); + phead = &pstapriv->asoc_list; + plist = get_next(phead); + + while ((rtw_end_of_queue_search(phead, plist)) == _FALSE) { + int stainfo_offset; + + psta = LIST_CONTAINOR(plist, struct sta_info, asoc_list); + plist = get_next(plist); + + /* Remove sta from asoc_list */ + rtw_list_delete(&psta->asoc_list); + pstapriv->asoc_list_cnt--; + + /* Keep sta for ap_free_sta() beyond this asoc_list loop */ + stainfo_offset = rtw_stainfo_offset(pstapriv, psta); + if (stainfo_offset_valid(stainfo_offset)) { + chk_alive_list[chk_alive_num++] = stainfo_offset; + } + } + _exit_critical_bh(&pstapriv->asoc_list_lock, &irqL); + + + /* For each sta in chk_alive_list, call ap_free_sta */ + for (i = 0; i < chk_alive_num; i++) { + psta = rtw_get_stainfo_by_offset(pstapriv, chk_alive_list[i]); + ap_free_sta(padapter, psta, _TRUE, WLAN_REASON_DEAUTH_LEAVING); + } + + issue_deauth(padapter, bc_addr, WLAN_REASON_DEAUTH_LEAVING); + + associated_clients_update(padapter, _TRUE); + + return ret; + +} + +/* called > TSR LEVEL for USB or SDIO Interface*/ +void sta_info_update(struct adapter *padapter, struct sta_info *psta) +{ + int flags = psta->flags; + struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); + + + //update wmm cap. + if(WLAN_STA_WME&flags) + psta->qos_option = 1; + else + psta->qos_option = 0; + + if(pmlmepriv->qospriv.qos_option == 0) + psta->qos_option = 0; + + +#ifdef CONFIG_80211N_HT + //update 802.11n ht cap. + if(WLAN_STA_HT&flags) + { + psta->htpriv.ht_option = _TRUE; + psta->qos_option = 1; + } + else + { + psta->htpriv.ht_option = _FALSE; + } + + if(pmlmepriv->htpriv.ht_option == _FALSE) + psta->htpriv.ht_option = _FALSE; +#endif + + + update_sta_info_apmode(padapter, psta); + + +} + +/* called >= TSR LEVEL for USB or SDIO Interface*/ +void ap_sta_info_defer_update(struct adapter *padapter, struct sta_info *psta) +{ + if(psta->state & _FW_LINKED) + { + //add ratid + add_RATid(padapter, psta, 0);//DM_RATR_STA_INIT + } +} +/* restore hw setting from sw data structures */ +void rtw_ap_restore_network(struct adapter *padapter) +{ + struct mlme_priv *mlmepriv = &padapter->mlmepriv; + struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; + struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); + struct sta_priv * pstapriv = &padapter->stapriv; + struct sta_info *psta; + struct security_priv* psecuritypriv=&(padapter->securitypriv); + _irqL irqL; + _list *phead, *plist; + u8 chk_alive_num = 0; + char chk_alive_list[NUM_STA]; + int i; + + rtw_setopmode_cmd(padapter, Ndis802_11APMode,_FALSE); + + set_channel_bwmode(padapter, pmlmeext->cur_channel, pmlmeext->cur_ch_offset, pmlmeext->cur_bwmode); + + start_bss_network(padapter, (u8*)&mlmepriv->cur_network.network); + + if((padapter->securitypriv.dot11PrivacyAlgrthm == _TKIP_) || + (padapter->securitypriv.dot11PrivacyAlgrthm == _AES_)) + { + /* restore group key, WEP keys is restored in ips_leave() */ + rtw_set_key(padapter, psecuritypriv, psecuritypriv->dot118021XGrpKeyid, 0,_FALSE); + } + + _enter_critical_bh(&pstapriv->asoc_list_lock, &irqL); + + phead = &pstapriv->asoc_list; + plist = get_next(phead); + + while ((rtw_end_of_queue_search(phead, plist)) == _FALSE) { + int stainfo_offset; + + psta = LIST_CONTAINOR(plist, struct sta_info, asoc_list); + plist = get_next(plist); + + stainfo_offset = rtw_stainfo_offset(pstapriv, psta); + if (stainfo_offset_valid(stainfo_offset)) { + chk_alive_list[chk_alive_num++] = stainfo_offset; + } + } + + _exit_critical_bh(&pstapriv->asoc_list_lock, &irqL); + + for (i = 0; i < chk_alive_num; i++) { + psta = rtw_get_stainfo_by_offset(pstapriv, chk_alive_list[i]); + + if (psta == NULL) { + DBG_871X(FUNC_ADPT_FMT" sta_info is null\n", FUNC_ADPT_ARG(padapter)); + } + else if(psta->state &_FW_LINKED) + { + Update_RA_Entry(padapter, psta); + //pairwise key + /* per sta pairwise key and settings */ + if( (padapter->securitypriv.dot11PrivacyAlgrthm == _TKIP_) || + (padapter->securitypriv.dot11PrivacyAlgrthm == _AES_)) + { + rtw_setstakey_cmd(padapter, (unsigned char *)psta, _TRUE,_FALSE); + } + } + } + +} + +void start_ap_mode(struct adapter *padapter) +{ + int i; + struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); + struct sta_priv *pstapriv = &padapter->stapriv; + struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; + struct wlan_acl_pool *pacl_list = &pstapriv->acl_list; + + pmlmepriv->update_bcn = _FALSE; + + //init_mlme_ap_info(padapter); + pmlmeext->bstart_bss = _FALSE; + + pmlmepriv->num_sta_non_erp = 0; + + pmlmepriv->num_sta_no_short_slot_time = 0; + + pmlmepriv->num_sta_no_short_preamble = 0; + + pmlmepriv->num_sta_ht_no_gf = 0; +#ifdef CONFIG_80211N_HT + pmlmepriv->num_sta_no_ht = 0; +#endif //CONFIG_80211N_HT + pmlmepriv->num_sta_ht_20mhz = 0; + + pmlmepriv->olbc = _FALSE; + + pmlmepriv->olbc_ht = _FALSE; + +#ifdef CONFIG_80211N_HT + pmlmepriv->ht_op_mode = 0; +#endif + + for(i=0; ista_aid[i] = NULL; + + pmlmepriv->wps_beacon_ie = NULL; + pmlmepriv->wps_probe_resp_ie = NULL; + pmlmepriv->wps_assoc_resp_ie = NULL; + + pmlmepriv->p2p_beacon_ie = NULL; + pmlmepriv->p2p_probe_resp_ie = NULL; + + + //for ACL + _rtw_init_listhead(&(pacl_list->acl_node_q.queue)); + pacl_list->num = 0; + pacl_list->mode = 0; + for(i = 0; i < NUM_ACL; i++) + { + _rtw_init_listhead(&pacl_list->aclnode[i].list); + pacl_list->aclnode[i].valid = _FALSE; + } + +} + +void stop_ap_mode(struct adapter *padapter) +{ + _irqL irqL; + _list *phead, *plist; + struct rtw_wlan_acl_node *paclnode; + struct sta_info *psta=NULL; + struct sta_priv *pstapriv = &padapter->stapriv; + struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); + struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; + struct wlan_acl_pool *pacl_list = &pstapriv->acl_list; + _queue *pacl_node_q =&pacl_list->acl_node_q; + + pmlmepriv->update_bcn = _FALSE; + pmlmeext->bstart_bss = _FALSE; + //_rtw_spinlock_free(&pmlmepriv->bcn_update_lock); + + //reset and init security priv , this can refine with rtw_reset_securitypriv + _rtw_memset((unsigned char *)&padapter->securitypriv, 0, sizeof (struct security_priv)); + padapter->securitypriv.ndisauthtype = Ndis802_11AuthModeOpen; + padapter->securitypriv.ndisencryptstatus = Ndis802_11WEPDisabled; + + //for ACL + _enter_critical_bh(&(pacl_node_q->lock), &irqL); + phead = get_list_head(pacl_node_q); + plist = get_next(phead); + while ((rtw_end_of_queue_search(phead, plist)) == _FALSE) + { + paclnode = LIST_CONTAINOR(plist, struct rtw_wlan_acl_node, list); + plist = get_next(plist); + + if(paclnode->valid == _TRUE) + { + paclnode->valid = _FALSE; + + rtw_list_delete(&paclnode->list); + + pacl_list->num--; + } + } + _exit_critical_bh(&(pacl_node_q->lock), &irqL); + + DBG_871X("%s, free acl_node_queue, num=%d\n", __func__, pacl_list->num); + + rtw_sta_flush(padapter); + + //free_assoc_sta_resources + rtw_free_all_stainfo(padapter); + + psta = rtw_get_bcmc_stainfo(padapter); + _enter_critical_bh(&(pstapriv->sta_hash_lock), &irqL); + rtw_free_stainfo(padapter, psta); + _exit_critical_bh(&(pstapriv->sta_hash_lock), &irqL); + + rtw_init_bcmc_stainfo(padapter); + + rtw_free_mlme_priv_ie_data(pmlmepriv); + +} + +#endif //CONFIG_NATIVEAP_MLME +#endif //CONFIG_AP_MODE diff --git a/core/rtw_br_ext.c b/core/rtw_br_ext.c index 3f7c867..3c59766 100755 --- a/core/rtw_br_ext.c +++ b/core/rtw_br_ext.c @@ -1,7 +1,7 @@ /****************************************************************************** * * 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. @@ -231,10 +231,10 @@ static unsigned char *scan_tlv(unsigned char *data, int len, unsigned char tag, { while (len > 0) { if (*data == tag && *(data+1) == len8b && len >= len8b*8) - return data+2; - - len -= (*(data+1))*8; - data += (*(data+1))*8; + return data+2; + + len -= (*(data+1))*8; + data += (*(data+1))*8; } return NULL; } @@ -244,16 +244,16 @@ static int update_nd_link_layer_addr(unsigned char *data, int len, unsigned char { struct icmp6hdr *icmphdr = (struct icmp6hdr *)data; unsigned char *mac; - - if (icmphdr->icmp6_type == NDISC_ROUTER_SOLICITATION) { + + if (icmphdr->icmp6_type == NDISC_ROUTER_SOLICITATION) { if (len >= 8) { mac = scan_tlv(&data[8], len-8, 1, 1); if (mac) { _DEBUG_INFO("Router Solicitation, replace MAC From: %02x:%02x:%02x:%02x:%02x:%02x, To: %02x:%02x:%02x:%02x:%02x:%02x\n", - mac[0],mac[1],mac[2],mac[3],mac[4],mac[5], + mac[0],mac[1],mac[2],mac[3],mac[4],mac[5], replace_mac[0],replace_mac[1],replace_mac[2],replace_mac[3],replace_mac[4],replace_mac[5]); - memcpy(mac, replace_mac, 6); - return 1; + memcpy(mac, replace_mac, 6); + return 1; } } } @@ -262,55 +262,55 @@ static int update_nd_link_layer_addr(unsigned char *data, int len, unsigned char mac = scan_tlv(&data[16], len-16, 1, 1); if (mac) { _DEBUG_INFO("Router Advertisement, replace MAC From: %02x:%02x:%02x:%02x:%02x:%02x, To: %02x:%02x:%02x:%02x:%02x:%02x\n", - mac[0],mac[1],mac[2],mac[3],mac[4],mac[5], + mac[0],mac[1],mac[2],mac[3],mac[4],mac[5], replace_mac[0],replace_mac[1],replace_mac[2],replace_mac[3],replace_mac[4],replace_mac[5]); - memcpy(mac, replace_mac, 6); - return 1; + memcpy(mac, replace_mac, 6); + return 1; } - } + } } else if (icmphdr->icmp6_type == NDISC_NEIGHBOUR_SOLICITATION) { if (len >= 24) { mac = scan_tlv(&data[24], len-24, 1, 1); - if (mac) { + if (mac) { _DEBUG_INFO("Neighbor Solicitation, replace MAC From: %02x:%02x:%02x:%02x:%02x:%02x, To: %02x:%02x:%02x:%02x:%02x:%02x\n", - mac[0],mac[1],mac[2],mac[3],mac[4],mac[5], + mac[0],mac[1],mac[2],mac[3],mac[4],mac[5], replace_mac[0],replace_mac[1],replace_mac[2],replace_mac[3],replace_mac[4],replace_mac[5]); - memcpy(mac, replace_mac, 6); - return 1; + memcpy(mac, replace_mac, 6); + return 1; } - } + } } else if (icmphdr->icmp6_type == NDISC_NEIGHBOUR_ADVERTISEMENT) { if (len >= 24) { mac = scan_tlv(&data[24], len-24, 2, 1); if (mac) { _DEBUG_INFO("Neighbor Advertisement, replace MAC From: %02x:%02x:%02x:%02x:%02x:%02x, To: %02x:%02x:%02x:%02x:%02x:%02x\n", - mac[0],mac[1],mac[2],mac[3],mac[4],mac[5], + mac[0],mac[1],mac[2],mac[3],mac[4],mac[5], replace_mac[0],replace_mac[1],replace_mac[2],replace_mac[3],replace_mac[4],replace_mac[5]); - memcpy(mac, replace_mac, 6); - return 1; + memcpy(mac, replace_mac, 6); + return 1; } - } + } } else if (icmphdr->icmp6_type == NDISC_REDIRECT) { if (len >= 40) { mac = scan_tlv(&data[40], len-40, 2, 1); - if (mac) { + if (mac) { _DEBUG_INFO("Redirect, replace MAC From: %02x:%02x:%02x:%02x:%02x:%02x, To: %02x:%02x:%02x:%02x:%02x:%02x\n", - mac[0],mac[1],mac[2],mac[3],mac[4],mac[5], + mac[0],mac[1],mac[2],mac[3],mac[4],mac[5], replace_mac[0],replace_mac[1],replace_mac[2],replace_mac[3],replace_mac[4],replace_mac[5]); - memcpy(mac, replace_mac, 6); - return 1; + memcpy(mac, replace_mac, 6); + return 1; } - } - } + } + } return 0; } static void convert_ipv6_mac_to_mc(struct sk_buff *skb) -{ +{ struct ipv6hdr *iph = (struct ipv6hdr *)(skb->data + ETH_HLEN); unsigned char *dst_mac = skb->data; @@ -320,7 +320,7 @@ static void convert_ipv6_mac_to_mc(struct sk_buff *skb) dst_mac[0] = 0x33; dst_mac[1] = 0x33; memcpy(&dst_mac[2], &iph->daddr.s6_addr32[3], 4); - #if defined(__LINUX_2_6__) + #if defined(__LINUX_2_6__) /*modified by qinjunjie,warning:should not remove next line*/ skb->pkt_type = PACKET_MULTICAST; #endif @@ -372,10 +372,10 @@ static __inline__ int __nat25_network_hash(unsigned char *networkAddr) networkAddr[6] ^ networkAddr[7] ^ networkAddr[8] ^ networkAddr[9] ^ networkAddr[10] ^ networkAddr[11] ^ networkAddr[12] ^ networkAddr[13] ^ networkAddr[14] ^ networkAddr[15] ^ networkAddr[16]; - + return x & (NAT25_HASH_SIZE - 1); } -#endif +#endif else { unsigned long x = 0; @@ -441,8 +441,8 @@ static int __nat25_db_network_lookup_and_replace(struct adapter *priv, atomic_inc(&db->use_count); #ifdef CL_IPV6_PASS - DEBUG_INFO("NAT25: Lookup M:%02x%02x%02x%02x%02x%02x N:%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x" - "%02x%02x%02x%02x%02x%02x\n", + DEBUG_INFO("NAT25: Lookup M:%02x%02x%02x%02x%02x%02x N:%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x" + "%02x%02x%02x%02x%02x%02x\n", db->macAddr[0], db->macAddr[1], db->macAddr[2], @@ -466,7 +466,7 @@ static int __nat25_db_network_lookup_and_replace(struct adapter *priv, db->networkAddr[14], db->networkAddr[15], db->networkAddr[16]); -#else +#else DEBUG_INFO("NAT25: Lookup M:%02x%02x%02x%02x%02x%02x N:%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x\n", db->macAddr[0], db->macAddr[1], @@ -633,7 +633,7 @@ void nat25_db_cleanup(struct adapter *priv) int i; _irqL irqL; _enter_critical_bh(&priv->br_ext_lock, &irqL); - + for(i=0; ibr_ext_lock, &irqL); - + //if(!priv->ethBrExtInfo.nat25_disable) { for (i=0; idata[0] & 1) - return 0; + return 0; return -1; case NAT25_INSERT: { DEBUG_INFO("NAT25: Insert IP, SA=%4x:%4x:%4x:%4x:%4x:%4x:%4x:%4x," - " DA=%4x:%4x:%4x:%4x:%4x:%4x:%4x:%4x\n", + " DA=%4x:%4x:%4x:%4x:%4x:%4x:%4x:%4x\n", iph->saddr.s6_addr16[0],iph->saddr.s6_addr16[1],iph->saddr.s6_addr16[2],iph->saddr.s6_addr16[3], iph->saddr.s6_addr16[4],iph->saddr.s6_addr16[5],iph->saddr.s6_addr16[6],iph->saddr.s6_addr16[7], iph->daddr.s6_addr16[0],iph->daddr.s6_addr16[1],iph->daddr.s6_addr16[2],iph->daddr.s6_addr16[3], @@ -1439,10 +1439,10 @@ int nat25_db_handle(struct adapter *priv, struct sk_buff *skb, int method) __nat25_db_network_insert(priv, skb->data+ETH_ALEN, networkAddr); __nat25_db_print(priv); - if (iph->nexthdr == IPPROTO_ICMPV6 && + if (iph->nexthdr == IPPROTO_ICMPV6 && skb->len > (ETH_HLEN + sizeof(*iph) + 4)) { - if (update_nd_link_layer_addr(skb->data + ETH_HLEN + sizeof(*iph), - skb->len - ETH_HLEN - sizeof(*iph), GET_MY_HWADDR(priv))) { + if (update_nd_link_layer_addr(skb->data + ETH_HLEN + sizeof(*iph), + skb->len - ETH_HLEN - sizeof(*iph), GET_MY_HWADDR(priv))) { struct icmp6hdr *hdr = (struct icmp6hdr *)(skb->data + ETH_HLEN + sizeof(*iph)); hdr->icmp6_cksum = 0; hdr->icmp6_cksum = csum_ipv6_magic(&iph->saddr, &iph->daddr, @@ -1450,26 +1450,26 @@ int nat25_db_handle(struct adapter *priv, struct sk_buff *skb, int method) IPPROTO_ICMPV6, csum_partial((__u8 *)hdr, iph->payload_len, 0)); } - } + } } } return 0; case NAT25_LOOKUP: DEBUG_INFO("NAT25: Lookup IP, SA=%4x:%4x:%4x:%4x:%4x:%4x:%4x:%4x," - " DA=%4x:%4x:%4x:%4x:%4x:%4x:%4x:%4x\n", + " DA=%4x:%4x:%4x:%4x:%4x:%4x:%4x:%4x\n", iph->saddr.s6_addr16[0],iph->saddr.s6_addr16[1],iph->saddr.s6_addr16[2],iph->saddr.s6_addr16[3], iph->saddr.s6_addr16[4],iph->saddr.s6_addr16[5],iph->saddr.s6_addr16[6],iph->saddr.s6_addr16[7], iph->daddr.s6_addr16[0],iph->daddr.s6_addr16[1],iph->daddr.s6_addr16[2],iph->daddr.s6_addr16[3], iph->daddr.s6_addr16[4],iph->daddr.s6_addr16[5],iph->daddr.s6_addr16[6],iph->daddr.s6_addr16[7]); - + __nat25_generate_ipv6_network_addr(networkAddr, (unsigned int *)&iph->daddr); if (!__nat25_db_network_lookup_and_replace(priv, skb, networkAddr)) { -#ifdef SUPPORT_RX_UNI2MCAST +#ifdef SUPPORT_RX_UNI2MCAST if (iph->daddr.s6_addr[0] == 0xff) - convert_ipv6_mac_to_mc(skb); -#endif + convert_ipv6_mac_to_mc(skb); +#endif } return 0; @@ -1530,12 +1530,12 @@ int nat25_handle_frame(struct adapter *priv, struct sk_buff *skb) (*((unsigned short *)(skb->data+ETH_ALEN*2)) == __constant_htons(ETH_P_IP)) && !memcmp(priv->scdb_ip, skb->data+ETH_HLEN+16, 4)) { memcpy(skb->data, priv->scdb_mac, ETH_ALEN); - + _exit_critical_bh(&priv->br_ext_lock, &irqL); } else { _exit_critical_bh(&priv->br_ext_lock, &irqL); - + retval = nat25_db_handle(priv, skb, NAT25_LOOKUP); } } @@ -1664,4 +1664,3 @@ void *scdb_findEntry(struct adapter *priv, unsigned char *macAddr, } #endif // CONFIG_BR_EXT - diff --git a/core/rtw_cmd.c b/core/rtw_cmd.c index 06fe82d..47782ba 100755 --- a/core/rtw_cmd.c +++ b/core/rtw_cmd.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Copyright(c) 2007 - 2012 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. @@ -42,47 +42,47 @@ No irqsave is necessary. sint _rtw_init_cmd_priv (struct cmd_priv *pcmdpriv) { sint res=_SUCCESS; - -_func_enter_; + +_func_enter_; _rtw_init_sema(&(pcmdpriv->cmd_queue_sema), 0); //_rtw_init_sema(&(pcmdpriv->cmd_done_sema), 0); _rtw_init_sema(&(pcmdpriv->terminate_cmdthread_sema), 0); - - + + _rtw_init_queue(&(pcmdpriv->cmd_queue)); - + //allocate DMA-able/Non-Page memory for cmd_buf and rsp_buf - + pcmdpriv->cmd_seq = 1; - + pcmdpriv->cmd_allocated_buf = rtw_zmalloc(MAX_CMDSZ + CMDBUFF_ALIGN_SZ); - + if (pcmdpriv->cmd_allocated_buf == NULL){ res= _FAIL; goto exit; } - + pcmdpriv->cmd_buf = pcmdpriv->cmd_allocated_buf + CMDBUFF_ALIGN_SZ - ( (SIZE_PTR)(pcmdpriv->cmd_allocated_buf) & (CMDBUFF_ALIGN_SZ-1)); - + pcmdpriv->rsp_allocated_buf = rtw_zmalloc(MAX_RSPSZ + 4); - + if (pcmdpriv->rsp_allocated_buf == NULL){ res= _FAIL; goto exit; } - + pcmdpriv->rsp_buf = pcmdpriv->rsp_allocated_buf + 4 - ( (SIZE_PTR)(pcmdpriv->rsp_allocated_buf) & 3); pcmdpriv->cmd_issued_cnt = pcmdpriv->cmd_done_cnt = pcmdpriv->rsp_cnt = 0; exit: - -_func_exit_; + +_func_exit_; return res; - -} + +} #ifdef CONFIG_C2H_WK static void c2h_wk_callback(_workitem *work); @@ -91,15 +91,15 @@ sint _rtw_init_evt_priv(struct evt_priv *pevtpriv) { sint res=_SUCCESS; -_func_enter_; +_func_enter_; #ifdef CONFIG_H2CLBK _rtw_init_sema(&(pevtpriv->lbkevt_done), 0); pevtpriv->lbkevt_limit = 0; pevtpriv->lbkevt_num = 0; - pevtpriv->cmdevt_parm = NULL; -#endif - + pevtpriv->cmdevt_parm = NULL; +#endif + //allocate DMA-able/Non-Page memory for cmd_buf and rsp_buf ATOMIC_SET(&pevtpriv->event_seq, 0); pevtpriv->evt_done_cnt = 0; @@ -109,17 +109,17 @@ _func_enter_; _rtw_init_sema(&(pevtpriv->evt_notify), 0); _rtw_init_sema(&(pevtpriv->terminate_evtthread_sema), 0); - pevtpriv->evt_allocated_buf = rtw_zmalloc(MAX_EVTSZ + 4); + pevtpriv->evt_allocated_buf = rtw_zmalloc(MAX_EVTSZ + 4); if (pevtpriv->evt_allocated_buf == NULL){ res= _FAIL; goto exit; } pevtpriv->evt_buf = pevtpriv->evt_allocated_buf + 4 - ((unsigned int)(pevtpriv->evt_allocated_buf) & 3); - - + + #if defined(CONFIG_SDIO_HCI) || defined(CONFIG_GSPI_HCI) - pevtpriv->allocated_c2h_mem = rtw_zmalloc(C2H_MEM_SZ +4); - + pevtpriv->allocated_c2h_mem = rtw_zmalloc(C2H_MEM_SZ +4); + if (pevtpriv->allocated_c2h_mem == NULL){ res= _FAIL; goto exit; @@ -129,7 +129,7 @@ _func_enter_; - ( (u32)(pevtpriv->allocated_c2h_mem) & 3); #ifdef PLATFORM_OS_XP pevtpriv->pc2h_mdl= IoAllocateMdl((u8 *)pevtpriv->c2h_mem, C2H_MEM_SZ , FALSE, FALSE, NULL); - + if(pevtpriv->pc2h_mdl == NULL){ res= _FAIL; goto exit; @@ -140,7 +140,7 @@ _func_enter_; _rtw_init_queue(&(pevtpriv->evt_queue)); -exit: +exit: #endif //end of CONFIG_EVENT_THREAD_MODE @@ -150,7 +150,7 @@ exit: pevtpriv->c2h_queue = rtw_cbuf_alloc(C2H_QUEUE_MAX_LEN+1); #endif -_func_exit_; +_func_exit_; return res; } @@ -187,7 +187,7 @@ _func_enter_; RT_TRACE(_module_rtl871x_cmd_c_,_drv_info_,("-_rtw_free_evt_priv \n")); -_func_exit_; +_func_exit_; } @@ -203,17 +203,17 @@ _func_enter_; if (pcmdpriv->cmd_allocated_buf) rtw_mfree(pcmdpriv->cmd_allocated_buf, MAX_CMDSZ + CMDBUFF_ALIGN_SZ); - + if (pcmdpriv->rsp_allocated_buf) rtw_mfree(pcmdpriv->rsp_allocated_buf, MAX_RSPSZ + 4); } -_func_exit_; +_func_exit_; } /* Calling Context: -rtw_enqueue_cmd can only be called between kernel thread, +rtw_enqueue_cmd can only be called between kernel thread, since only spin_lock is used. ISR/Call-Back functions can't call this sub-function. @@ -230,14 +230,14 @@ _func_enter_; goto exit; //_enter_critical_bh(&queue->lock, &irqL); - _enter_critical(&queue->lock, &irqL); + _enter_critical(&queue->lock, &irqL); rtw_list_insert_tail(&obj->list, &queue->queue); - //_exit_critical_bh(&queue->lock, &irqL); + //_exit_critical_bh(&queue->lock, &irqL); _exit_critical(&queue->lock, &irqL); -exit: +exit: _func_exit_; @@ -264,7 +264,7 @@ _func_enter_; //_exit_critical_bh(&(queue->lock), &irqL); _exit_critical(&queue->lock, &irqL); -_func_exit_; +_func_exit_; return obj; } @@ -272,18 +272,18 @@ _func_exit_; u32 rtw_init_cmd_priv(struct cmd_priv *pcmdpriv) { u32 res; -_func_enter_; +_func_enter_; res = _rtw_init_cmd_priv (pcmdpriv); -_func_exit_; - return res; +_func_exit_; + return res; } u32 rtw_init_evt_priv (struct evt_priv *pevtpriv) { int res; -_func_enter_; +_func_enter_; res = _rtw_init_evt_priv(pevtpriv); -_func_exit_; +_func_exit_; return res; } @@ -292,35 +292,35 @@ void rtw_free_evt_priv (struct evt_priv *pevtpriv) _func_enter_; RT_TRACE(_module_rtl871x_cmd_c_,_drv_info_,("rtw_free_evt_priv\n")); _rtw_free_evt_priv(pevtpriv); -_func_exit_; -} +_func_exit_; +} void rtw_free_cmd_priv (struct cmd_priv *pcmdpriv) { _func_enter_; RT_TRACE(_module_rtl871x_cmd_c_,_drv_info_,("rtw_free_cmd_priv\n")); _rtw_free_cmd_priv(pcmdpriv); -_func_exit_; -} +_func_exit_; +} int rtw_cmd_filter(struct cmd_priv *pcmdpriv, struct cmd_obj *cmd_obj); int rtw_cmd_filter(struct cmd_priv *pcmdpriv, struct cmd_obj *cmd_obj) { u8 bAllow = _FALSE; //set to _TRUE to allow enqueuing cmd when hw_init_completed is _FALSE - + #ifdef SUPPORT_HW_RFOFF_DETECTED //To decide allow or not if( (adapter_to_pwrctl(pcmdpriv->padapter)->bHWPwrPindetect) &&(!pcmdpriv->padapter->registrypriv.usbss_enable) - ) + ) { - if(cmd_obj->cmdcode == GEN_CMD_CODE(_Set_Drv_Extra) ) + if(cmd_obj->cmdcode == GEN_CMD_CODE(_Set_Drv_Extra) ) { - struct drvextra_cmd_parm *pdrvextra_cmd_parm = (struct drvextra_cmd_parm *)cmd_obj->parmbuf; + struct drvextra_cmd_parm *pdrvextra_cmd_parm = (struct drvextra_cmd_parm *)cmd_obj->parmbuf; if(pdrvextra_cmd_parm->ec_id == POWER_SAVING_CTRL_WK_CID) - { + { //DBG_871X("==>enqueue POWER_SAVING_CTRL_WK_CID\n"); - bAllow = _TRUE; + bAllow = _TRUE; } } } @@ -340,7 +340,7 @@ int rtw_cmd_filter(struct cmd_priv *pcmdpriv, struct cmd_obj *cmd_obj) //); return _FAIL; - } + } return _SUCCESS; } @@ -350,9 +350,9 @@ u32 rtw_enqueue_cmd(struct cmd_priv *pcmdpriv, struct cmd_obj *cmd_obj) { int res = _FAIL; struct adapter *padapter = pcmdpriv->padapter; - -_func_enter_; - + +_func_enter_; + if (cmd_obj == NULL) { goto exit; } @@ -363,7 +363,7 @@ _func_enter_; //change pcmdpriv to primary's pcmdpriv if (padapter->adapter_type != PRIMARY_ADAPTER && padapter->pbuddy_adapter) pcmdpriv = &(padapter->pbuddy_adapter->cmdpriv); -#endif +#endif if( _FAIL == (res=rtw_cmd_filter(pcmdpriv, cmd_obj)) ) { rtw_free_cmd_obj(cmd_obj); @@ -374,9 +374,9 @@ _func_enter_; if(res == _SUCCESS) _rtw_up_sema(&pcmdpriv->cmd_queue_sema); - -exit: - + +exit: + _func_exit_; return res; @@ -385,12 +385,12 @@ _func_exit_; struct cmd_obj *rtw_dequeue_cmd(struct cmd_priv *pcmdpriv) { struct cmd_obj *cmd_obj; - -_func_enter_; + +_func_enter_; cmd_obj = _rtw_dequeue_cmd(&pcmdpriv->cmd_queue); - -_func_exit_; + +_func_exit_; return cmd_obj; } @@ -399,7 +399,7 @@ void rtw_cmd_clr_isr(struct cmd_priv *pcmdpriv) _func_enter_; pcmdpriv->cmd_done_cnt++; //_rtw_up_sema(&(pcmdpriv->cmd_done_sema)); -_func_exit_; +_func_exit_; } void rtw_free_cmd_obj(struct cmd_obj *pcmd) @@ -410,21 +410,21 @@ _func_enter_; { //free parmbuf in cmd_obj rtw_mfree((unsigned char*)pcmd->parmbuf, pcmd->cmdsz); - } - + } + if(pcmd->rsp!=NULL) { if(pcmd->rspsz!= 0) { //free rsp in cmd_obj rtw_mfree((unsigned char*)pcmd->rsp, pcmd->rspsz); - } - } + } + } //free cmd_obj rtw_mfree((unsigned char*)pcmd, sizeof(struct cmd_obj)); - -_func_exit_; + +_func_exit_; } @@ -448,7 +448,7 @@ thread_return rtw_cmd_thread(thread_context context) void (*pcmd_callback)(struct adapter *dev, struct cmd_obj *pcmd); struct adapter *padapter = (struct adapter *)context; struct cmd_priv *pcmdpriv = &(padapter->cmdpriv); - + _func_enter_; thread_enter("RTW_CMD_THREAD"); @@ -480,7 +480,7 @@ _func_enter_; DBG_871X_LEVEL(_drv_always_, FUNC_ADPT_FMT" stop_req:%u, break\n", FUNC_ADPT_ARG(padapter), pcmdpriv->stop_req); break; } - + if(rtw_is_list_empty(&(pcmdpriv->cmd_queue.queue))) { //DBG_871X("%s: cmd queue is empty!\n", __func__); @@ -585,7 +585,7 @@ post_process: //DBG_871X("%s: leaving... drop cmdcode:%u\n", __FUNCTION__, pcmd->cmdcode); - rtw_free_cmd_obj(pcmd); + rtw_free_cmd_obj(pcmd); }while(1); _rtw_up_sema(&pcmdpriv->terminate_cmdthread_sema); @@ -603,37 +603,37 @@ u32 rtw_enqueue_evt(struct evt_priv *pevtpriv, struct evt_obj *obj) _irqL irqL; int res; _queue *queue = &pevtpriv->evt_queue; - -_func_enter_; - res = _SUCCESS; +_func_enter_; + + res = _SUCCESS; if (obj == NULL) { res = _FAIL; goto exit; - } + } _enter_critical_bh(&queue->lock, &irqL); rtw_list_insert_tail(&obj->list, &queue->queue); - + _exit_critical_bh(&queue->lock, &irqL); //rtw_evt_notify_isr(pevtpriv); exit: - -_func_exit_; - return res; +_func_exit_; + + return res; } struct evt_obj *rtw_dequeue_evt(_queue *queue) { _irqL irqL; struct evt_obj *pevtobj; - -_func_enter_; + +_func_enter_; _enter_critical_bh(&queue->lock, &irqL); @@ -646,10 +646,10 @@ _func_enter_; } _exit_critical_bh(&queue->lock, &irqL); - -_func_exit_; - return pevtobj; +_func_exit_; + + return pevtobj; } void rtw_free_evt_obj(struct evt_obj *pevtobj) @@ -658,10 +658,10 @@ _func_enter_; if(pevtobj->parmbuf) rtw_mfree((unsigned char*)pevtobj->parmbuf, pevtobj->evtsz); - + rtw_mfree((unsigned char*)pevtobj, sizeof(struct evt_obj)); - -_func_exit_; + +_func_exit_; } void rtw_evt_notify_isr(struct evt_priv *pevtpriv) @@ -669,31 +669,31 @@ void rtw_evt_notify_isr(struct evt_priv *pevtpriv) _func_enter_; pevtpriv->evt_done_cnt++; _rtw_up_sema(&(pevtpriv->evt_notify)); -_func_exit_; +_func_exit_; } #endif /* -u8 rtw_setstandby_cmd(unsigned char *adapter) +u8 rtw_setstandby_cmd(unsigned char *adapter) */ u8 rtw_setstandby_cmd(struct adapter *padapter, uint action) { struct cmd_obj* ph2c; struct usb_suspend_parm* psetusbsuspend; - struct cmd_priv *pcmdpriv=&padapter->cmdpriv; + struct cmd_priv *pcmdpriv=&padapter->cmdpriv; u8 ret = _SUCCESS; - -_func_enter_; + +_func_enter_; ph2c = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj)); if (ph2c == NULL) { ret = _FAIL; goto exit; } - - psetusbsuspend = (struct usb_suspend_parm*)rtw_zmalloc(sizeof(struct usb_suspend_parm)); + + psetusbsuspend = (struct usb_suspend_parm*)rtw_zmalloc(sizeof(struct usb_suspend_parm)); if (psetusbsuspend == NULL) { rtw_mfree((u8 *) ph2c, sizeof(struct cmd_obj)); ret = _FAIL; @@ -704,11 +704,11 @@ _func_enter_; init_h2fwcmd_w_parm_no_rsp(ph2c, psetusbsuspend, GEN_CMD_CODE(_SetUsbSuspend)); - ret = rtw_enqueue_cmd(pcmdpriv, ph2c); - -exit: - -_func_exit_; + ret = rtw_enqueue_cmd(pcmdpriv, ph2c); + +exit: + +_func_exit_; return ret; } @@ -724,7 +724,7 @@ u8 rtw_sitesurvey_cmd(struct adapter *padapter, NDIS_802_11_SSID *ssid, int ssi u8 res = _FAIL; struct cmd_obj *ph2c; struct sitesurvey_parm *psurveyPara; - struct cmd_priv *pcmdpriv = &padapter->cmdpriv; + struct cmd_priv *pcmdpriv = &padapter->cmdpriv; struct mlme_priv *pmlmepriv = &padapter->mlmepriv; #ifdef CONFIG_P2P struct wifidirect_info *pwdinfo= &(padapter->wdinfo); @@ -748,7 +748,7 @@ _func_enter_; if (ph2c == NULL) return _FAIL; - psurveyPara = (struct sitesurvey_parm*)rtw_zmalloc(sizeof(struct sitesurvey_parm)); + psurveyPara = (struct sitesurvey_parm*)rtw_zmalloc(sizeof(struct sitesurvey_parm)); if (psurveyPara == NULL) { rtw_mfree((unsigned char*) ph2c, sizeof(struct cmd_obj)); return _FAIL; @@ -813,7 +813,7 @@ _func_enter_; _clr_fwstate_(pmlmepriv, _FW_UNDER_SURVEY); } -_func_exit_; +_func_exit_; return res; } @@ -825,7 +825,7 @@ u8 rtw_setdatarate_cmd(struct adapter *padapter, u8 *rateset) struct cmd_priv* pcmdpriv = &padapter->cmdpriv; u8 res = _SUCCESS; -_func_enter_; +_func_enter_; ph2c = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj)); if (ph2c == NULL) { @@ -833,7 +833,7 @@ _func_enter_; goto exit; } - pbsetdataratepara = (struct setdatarate_parm*)rtw_zmalloc(sizeof(struct setdatarate_parm)); + pbsetdataratepara = (struct setdatarate_parm*)rtw_zmalloc(sizeof(struct setdatarate_parm)); if (pbsetdataratepara == NULL) { rtw_mfree((u8 *) ph2c, sizeof(struct cmd_obj)); res = _FAIL; @@ -870,7 +870,7 @@ _func_enter_; res= _FAIL; goto exit; } - pssetbasicratepara = (struct setbasicrate_parm*)rtw_zmalloc(sizeof(struct setbasicrate_parm)); + pssetbasicratepara = (struct setbasicrate_parm*)rtw_zmalloc(sizeof(struct setbasicrate_parm)); if (pssetbasicratepara == NULL) { rtw_mfree((u8*) ph2c, sizeof(struct cmd_obj)); @@ -880,19 +880,19 @@ _func_enter_; init_h2fwcmd_w_parm_no_rsp(ph2c, pssetbasicratepara, _SetBasicRate_CMD_); - _rtw_memcpy(pssetbasicratepara->basicrates, rateset, NumRates); + _rtw_memcpy(pssetbasicratepara->basicrates, rateset, NumRates); - res = rtw_enqueue_cmd(pcmdpriv, ph2c); -exit: + res = rtw_enqueue_cmd(pcmdpriv, ph2c); +exit: -_func_exit_; +_func_exit_; return res; } /* -unsigned char rtw_setphy_cmd(unsigned char *adapter) +unsigned char rtw_setphy_cmd(unsigned char *adapter) 1. be called only after rtw_update_registrypriv_dev_network( ~) or mp testing program 2. for AdHoc/Ap mode or mp mode? @@ -902,19 +902,19 @@ u8 rtw_setphy_cmd(struct adapter *padapter, u8 modem, u8 ch) { struct cmd_obj* ph2c; struct setphy_parm* psetphypara; - struct cmd_priv *pcmdpriv=&padapter->cmdpriv; + struct cmd_priv *pcmdpriv=&padapter->cmdpriv; // struct mlme_priv *pmlmepriv = &padapter->mlmepriv; // struct registry_priv* pregistry_priv = &padapter->registrypriv; u8 res=_SUCCESS; -_func_enter_; +_func_enter_; ph2c = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj)); if(ph2c==NULL){ res= _FAIL; goto exit; } - psetphypara = (struct setphy_parm*)rtw_zmalloc(sizeof(struct setphy_parm)); + psetphypara = (struct setphy_parm*)rtw_zmalloc(sizeof(struct setphy_parm)); if(psetphypara==NULL){ rtw_mfree((u8 *) ph2c, sizeof(struct cmd_obj)); @@ -929,17 +929,17 @@ _func_enter_; psetphypara->modem = modem; psetphypara->rfchannel = ch; - res = rtw_enqueue_cmd(pcmdpriv, ph2c); -exit: -_func_exit_; + res = rtw_enqueue_cmd(pcmdpriv, ph2c); +exit: +_func_exit_; return res; } u8 rtw_setbbreg_cmd(struct adapter*padapter, u8 offset, u8 val) -{ +{ struct cmd_obj* ph2c; struct writeBB_parm* pwritebbparm; - struct cmd_priv *pcmdpriv=&padapter->cmdpriv; + struct cmd_priv *pcmdpriv=&padapter->cmdpriv; u8 res=_SUCCESS; _func_enter_; ph2c = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj)); @@ -947,7 +947,7 @@ _func_enter_; res= _FAIL; goto exit; } - pwritebbparm = (struct writeBB_parm*)rtw_zmalloc(sizeof(struct writeBB_parm)); + pwritebbparm = (struct writeBB_parm*)rtw_zmalloc(sizeof(struct writeBB_parm)); if(pwritebbparm==NULL){ rtw_mfree((u8 *) ph2c, sizeof(struct cmd_obj)); @@ -955,31 +955,31 @@ _func_enter_; goto exit; } - init_h2fwcmd_w_parm_no_rsp(ph2c, pwritebbparm, GEN_CMD_CODE(_SetBBReg)); + init_h2fwcmd_w_parm_no_rsp(ph2c, pwritebbparm, GEN_CMD_CODE(_SetBBReg)); pwritebbparm->offset = offset; pwritebbparm->value = val; - res = rtw_enqueue_cmd(pcmdpriv, ph2c); -exit: -_func_exit_; + res = rtw_enqueue_cmd(pcmdpriv, ph2c); +exit: +_func_exit_; return res; } u8 rtw_getbbreg_cmd(struct adapter *padapter, u8 offset, u8 *pval) -{ +{ struct cmd_obj* ph2c; struct readBB_parm* prdbbparm; - struct cmd_priv *pcmdpriv=&padapter->cmdpriv; + struct cmd_priv *pcmdpriv=&padapter->cmdpriv; u8 res=_SUCCESS; - + _func_enter_; ph2c = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj)); if(ph2c==NULL){ res=_FAIL; goto exit; } - prdbbparm = (struct readBB_parm*)rtw_zmalloc(sizeof(struct readBB_parm)); + prdbbparm = (struct readBB_parm*)rtw_zmalloc(sizeof(struct readBB_parm)); if(prdbbparm ==NULL){ rtw_mfree((unsigned char *) ph2c, sizeof(struct cmd_obj)); @@ -992,28 +992,28 @@ _func_enter_; ph2c->cmdsz = sizeof(struct readBB_parm); ph2c->rsp = pval; ph2c->rspsz = sizeof(struct readBB_rsp); - + prdbbparm ->offset = offset; - - res = rtw_enqueue_cmd(pcmdpriv, ph2c); + + res = rtw_enqueue_cmd(pcmdpriv, ph2c); exit: -_func_exit_; +_func_exit_; return res; } u8 rtw_setrfreg_cmd(struct adapter *padapter, u8 offset, u32 val) -{ +{ struct cmd_obj* ph2c; struct writeRF_parm* pwriterfparm; - struct cmd_priv *pcmdpriv=&padapter->cmdpriv; + struct cmd_priv *pcmdpriv=&padapter->cmdpriv; u8 res=_SUCCESS; _func_enter_; ph2c = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj)); if(ph2c==NULL){ - res= _FAIL; + res= _FAIL; goto exit; } - pwriterfparm = (struct writeRF_parm*)rtw_zmalloc(sizeof(struct writeRF_parm)); + pwriterfparm = (struct writeRF_parm*)rtw_zmalloc(sizeof(struct writeRF_parm)); if(pwriterfparm==NULL){ rtw_mfree((u8 *) ph2c, sizeof(struct cmd_obj)); @@ -1021,22 +1021,22 @@ _func_enter_; goto exit; } - init_h2fwcmd_w_parm_no_rsp(ph2c, pwriterfparm, GEN_CMD_CODE(_SetRFReg)); + init_h2fwcmd_w_parm_no_rsp(ph2c, pwriterfparm, GEN_CMD_CODE(_SetRFReg)); pwriterfparm->offset = offset; pwriterfparm->value = val; - res = rtw_enqueue_cmd(pcmdpriv, ph2c); + res = rtw_enqueue_cmd(pcmdpriv, ph2c); exit: -_func_exit_; +_func_exit_; return res; } u8 rtw_getrfreg_cmd(struct adapter *padapter, u8 offset, u8 *pval) -{ +{ struct cmd_obj* ph2c; struct readRF_parm* prdrfparm; - struct cmd_priv *pcmdpriv=&padapter->cmdpriv; + struct cmd_priv *pcmdpriv=&padapter->cmdpriv; u8 res=_SUCCESS; _func_enter_; @@ -1047,7 +1047,7 @@ _func_enter_; goto exit; } - prdrfparm = (struct readRF_parm*)rtw_zmalloc(sizeof(struct readRF_parm)); + prdrfparm = (struct readRF_parm*)rtw_zmalloc(sizeof(struct readRF_parm)); if(prdrfparm ==NULL){ rtw_mfree((u8 *) ph2c, sizeof(struct cmd_obj)); res= _FAIL; @@ -1060,43 +1060,43 @@ _func_enter_; ph2c->cmdsz = sizeof(struct readRF_parm); ph2c->rsp = pval; ph2c->rspsz = sizeof(struct readRF_rsp); - + prdrfparm ->offset = offset; - - res = rtw_enqueue_cmd(pcmdpriv, ph2c); + + res = rtw_enqueue_cmd(pcmdpriv, ph2c); exit: -_func_exit_; +_func_exit_; return res; } void rtw_getbbrfreg_cmdrsp_callback(struct adapter* padapter, struct cmd_obj *pcmd) -{ - _func_enter_; - +{ + _func_enter_; + //rtw_free_cmd_obj(pcmd); rtw_mfree((unsigned char*) pcmd->parmbuf, pcmd->cmdsz); rtw_mfree((unsigned char*) pcmd, sizeof(struct cmd_obj)); - -_func_exit_; + +_func_exit_; } void rtw_readtssi_cmdrsp_callback(struct adapter* padapter, struct cmd_obj *pcmd) { - _func_enter_; + _func_enter_; rtw_mfree((unsigned char*) pcmd->parmbuf, pcmd->cmdsz); rtw_mfree((unsigned char*) pcmd, sizeof(struct cmd_obj)); - + _func_exit_; } u8 rtw_createbss_cmd(struct adapter *padapter) { struct cmd_obj* pcmd; - struct cmd_priv *pcmdpriv=&padapter->cmdpriv; + struct cmd_priv *pcmdpriv=&padapter->cmdpriv; struct mlme_priv *pmlmepriv = &padapter->mlmepriv; WLAN_BSSID_EX *pdev_network = &padapter->registrypriv.dev_network; u8 res=_SUCCESS; @@ -1106,11 +1106,11 @@ _func_enter_; rtw_led_control(padapter, LED_CTL_START_TO_LINK); if (pmlmepriv->assoc_ssid.SsidLength == 0){ - RT_TRACE(_module_rtl871x_cmd_c_,_drv_info_,(" createbss for Any SSid:%s\n",pmlmepriv->assoc_ssid.Ssid)); + RT_TRACE(_module_rtl871x_cmd_c_,_drv_info_,(" createbss for Any SSid:%s\n",pmlmepriv->assoc_ssid.Ssid)); } else { RT_TRACE(_module_rtl871x_cmd_c_,_drv_info_,(" createbss for SSid:%s\n", pmlmepriv->assoc_ssid.Ssid)); } - + pcmd = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj)); if(pcmd==NULL){ res= _FAIL; @@ -1122,15 +1122,15 @@ _func_enter_; pcmd->parmbuf = (unsigned char *)pdev_network; pcmd->cmdsz = get_WLAN_BSSID_EX_sz((WLAN_BSSID_EX*)pdev_network); pcmd->rsp = NULL; - pcmd->rspsz = 0; - - pdev_network->Length = pcmd->cmdsz; + pcmd->rspsz = 0; - res = rtw_enqueue_cmd(pcmdpriv, pcmd); + pdev_network->Length = pcmd->cmdsz; + + res = rtw_enqueue_cmd(pcmdpriv, pcmd); exit: -_func_exit_; +_func_exit_; return res; } @@ -1138,11 +1138,11 @@ _func_exit_; u8 rtw_createbss_cmd_ex(struct adapter *padapter, unsigned char *pbss, unsigned int sz) { struct cmd_obj* pcmd; - struct cmd_priv *pcmdpriv=&padapter->cmdpriv; + struct cmd_priv *pcmdpriv=&padapter->cmdpriv; u8 res=_SUCCESS; - + _func_enter_; - + pcmd = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj)); if(pcmd==NULL){ res= _FAIL; @@ -1159,10 +1159,10 @@ _func_enter_; res = rtw_enqueue_cmd(pcmdpriv, pcmd); exit: - -_func_exit_; - return res; +_func_exit_; + + return res; } u8 rtw_joinbss_cmd(struct adapter *padapter, struct wlan_network* pnetwork) @@ -1199,12 +1199,12 @@ _func_enter_; RT_TRACE(_module_rtl871x_cmd_c_, _drv_err_, ("rtw_joinbss_cmd: memory allocate for cmd_obj fail!!!\n")); goto exit; } - /* // for IEs is pointer - t_len = sizeof (ULONG) + sizeof (NDIS_802_11_MAC_ADDRESS) + 2 + - sizeof (NDIS_802_11_SSID) + sizeof (ULONG) + - sizeof (NDIS_802_11_RSSI) + sizeof (NDIS_802_11_NETWORK_TYPE) + - sizeof (NDIS_802_11_CONFIGURATION) + - sizeof (NDIS_802_11_NETWORK_INFRASTRUCTURE) + + /* // for IEs is pointer + t_len = sizeof (ULONG) + sizeof (NDIS_802_11_MAC_ADDRESS) + 2 + + sizeof (NDIS_802_11_SSID) + sizeof (ULONG) + + sizeof (NDIS_802_11_RSSI) + sizeof (NDIS_802_11_NETWORK_TYPE) + + sizeof (NDIS_802_11_CONFIGURATION) + + sizeof (NDIS_802_11_NETWORK_INFRASTRUCTURE) + sizeof (NDIS_802_11_RATES_EX)+ sizeof(WLAN_PHY_INFO)+ sizeof (ULONG) + MAX_IE_SZ; */ //for IEs is fix buf size @@ -1237,18 +1237,18 @@ _func_enter_; { if(pcmd !=NULL) rtw_mfree((unsigned char *)pcmd, sizeof(struct cmd_obj)); - + res=_FAIL; - + RT_TRACE(_module_rtl871x_cmd_c_, _drv_err_, ("rtw_joinbss_cmd :psecnetwork==NULL!!!\n")); - + goto exit; } _rtw_memset(psecnetwork, 0, t_len); _rtw_memcpy(psecnetwork, &pnetwork->network, get_WLAN_BSSID_EX_sz(&pnetwork->network)); - + auth=&psecuritypriv->authenticator_ie[0]; psecuritypriv->authenticator_ie[0]=(unsigned char)psecnetwork->IELength; @@ -1257,13 +1257,13 @@ _func_enter_; } else { _rtw_memcpy(&psecuritypriv->authenticator_ie[1], &psecnetwork->IEs[12], (256-1)); } - + psecnetwork->IELength = 0; // Added by Albert 2009/02/18 // If the the driver wants to use the bssid to create the connection. // If not, we have to copy the connecting AP's MAC address to it so that // the driver just has the bssid information for PMKIDList searching. - + if ( pmlmepriv->assoc_by_bssid == _FALSE ) { _rtw_memcpy( &pmlmepriv->assoc_bssid[ 0 ], &pnetwork->network.MacAddress[ 0 ], ETH_ALEN ); @@ -1273,23 +1273,23 @@ _func_enter_; pqospriv->qos_option = 0; - - if(pregistrypriv->wmm_enable) - { - u32 tmp_len; - - tmp_len = rtw_restruct_wmm_ie(padapter, &pnetwork->network.IEs[0], &psecnetwork->IEs[0], pnetwork->network.IELength, psecnetwork->IELength); - if (psecnetwork->IELength != tmp_len) + if(pregistrypriv->wmm_enable) + { + u32 tmp_len; + + tmp_len = rtw_restruct_wmm_ie(padapter, &pnetwork->network.IEs[0], &psecnetwork->IEs[0], pnetwork->network.IELength, psecnetwork->IELength); + + if (psecnetwork->IELength != tmp_len) { psecnetwork->IELength = tmp_len; pqospriv->qos_option = 1; //There is WMM IE in this corresp. beacon } - else + else { pqospriv->qos_option = 0;//There is no WMM IE in this corresp. beacon - } - } + } + } #ifdef CONFIG_80211N_HT phtpriv->ht_option = _FALSE; @@ -1303,8 +1303,8 @@ _func_enter_; ( padapter->securitypriv.dot11PrivacyAlgrthm != _TKIP_ )) { //rtw_restructure_ht_ie - rtw_restructure_ht_ie(padapter, &pnetwork->network.IEs[0], &psecnetwork->IEs[0], - pnetwork->network.IELength, &psecnetwork->IELength); + rtw_restructure_ht_ie(padapter, &pnetwork->network.IEs[0], &psecnetwork->IEs[0], + pnetwork->network.IELength, &psecnetwork->IELength); } } @@ -1316,7 +1316,7 @@ _func_enter_; adapter_to_pwrctl(padapter)->smart_ps = 0; else adapter_to_pwrctl(padapter)->smart_ps = padapter->registrypriv.smart_ps; - + DBG_871X("%s: smart_ps=%d\n", __func__, adapter_to_pwrctl(padapter)->smart_ps); #if 0 @@ -1331,7 +1331,7 @@ _func_enter_; _rtw_memcpy(&psecuritypriv->supplicant_ie[1], &psecnetwork->IEs[0], (256-1)); } #endif - + pcmd->cmdsz = get_WLAN_BSSID_EX_sz(psecnetwork);//get cmdsz before endian conversion _rtw_init_listhead(&pcmd->list); @@ -1343,7 +1343,7 @@ _func_enter_; res = rtw_enqueue_cmd(pcmdpriv, pcmd); exit: - + _func_exit_; return res; @@ -1387,7 +1387,7 @@ _func_enter_; exit: -_func_exit_; +_func_exit_; return res; } @@ -1401,21 +1401,21 @@ u8 rtw_setopmode_cmd(struct adapter *padapter, NDIS_802_11_NETWORK_INFRASTRUCTU u8 res=_SUCCESS; _func_enter_; - psetop = (struct setopmode_parm*)rtw_zmalloc(sizeof(struct setopmode_parm)); + psetop = (struct setopmode_parm*)rtw_zmalloc(sizeof(struct setopmode_parm)); - if(psetop==NULL){ + if(psetop==NULL){ res=_FAIL; goto exit; } psetop->mode = (u8)networktype; - + if(enqueue){ - ph2c = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj)); - if(ph2c==NULL){ + ph2c = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj)); + if(ph2c==NULL){ rtw_mfree((u8 *)psetop, sizeof(*psetop)); res= _FAIL; goto exit; - } + } init_h2fwcmd_w_parm_no_rsp(ph2c, psetop, _SetOpMode_CMD_); res = rtw_enqueue_cmd(pcmdpriv, ph2c); @@ -1426,7 +1426,7 @@ _func_enter_; } exit: -_func_exit_; +_func_exit_; return res; } @@ -1435,26 +1435,26 @@ u8 rtw_setstakey_cmd(struct adapter *padapter, u8 *psta, u8 unicast_key, bool en { struct cmd_obj* ph2c; struct set_stakey_parm *psetstakey_para; - struct cmd_priv *pcmdpriv=&padapter->cmdpriv; + struct cmd_priv *pcmdpriv=&padapter->cmdpriv; struct set_stakey_rsp *psetstakey_rsp = NULL; - + struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - struct security_priv *psecuritypriv = &padapter->securitypriv; - struct sta_info* sta = (struct sta_info* )psta; + struct security_priv *psecuritypriv = &padapter->securitypriv; + struct sta_info* sta = (struct sta_info* )psta; u8 res=_SUCCESS; _func_enter_; psetstakey_para = (struct set_stakey_parm*)rtw_zmalloc(sizeof(struct set_stakey_parm)); - if(psetstakey_para==NULL){ + if(psetstakey_para==NULL){ res=_FAIL; goto exit; } - + _rtw_memcpy(psetstakey_para->addr, sta->hwaddr,ETH_ALEN); - + if(check_fwstate(pmlmepriv, WIFI_STATION_STATE)){ -#ifdef CONFIG_TDLS +#ifdef CONFIG_TDLS if(sta->tdls_sta_state&TDLS_LINKED_STATE) psetstakey_para->algorithm=(u8)sta->dot118021XPrivacy; else @@ -1486,9 +1486,9 @@ _func_enter_; rtw_mfree((u8 *) psetstakey_para, sizeof(struct set_stakey_parm)); res= _FAIL; goto exit; - } + } - psetstakey_rsp = (struct set_stakey_rsp*)rtw_zmalloc(sizeof(struct set_stakey_rsp)); + psetstakey_rsp = (struct set_stakey_rsp*)rtw_zmalloc(sizeof(struct set_stakey_rsp)); if(psetstakey_rsp == NULL){ rtw_mfree((u8 *) ph2c, sizeof(struct cmd_obj)); rtw_mfree((u8 *) psetstakey_para, sizeof(struct set_stakey_parm)); @@ -1499,7 +1499,7 @@ _func_enter_; init_h2fwcmd_w_parm_no_rsp(ph2c, psetstakey_para, _SetStaKey_CMD_); ph2c->rsp = (u8 *) psetstakey_rsp; ph2c->rspsz = sizeof(struct set_stakey_rsp); - res = rtw_enqueue_cmd(pcmdpriv, ph2c); + res = rtw_enqueue_cmd(pcmdpriv, ph2c); } else{ set_stakey_hdl(padapter, (u8 *)psetstakey_para); @@ -1507,7 +1507,7 @@ _func_enter_; } exit: -_func_exit_; +_func_exit_; return res; } @@ -1516,11 +1516,11 @@ u8 rtw_clearstakey_cmd(struct adapter *padapter, u8 *psta, u8 entry, u8 enqueue) { struct cmd_obj* ph2c; struct set_stakey_parm *psetstakey_para; - struct cmd_priv *pcmdpriv=&padapter->cmdpriv; - struct set_stakey_rsp *psetstakey_rsp = NULL; + struct cmd_priv *pcmdpriv=&padapter->cmdpriv; + struct set_stakey_rsp *psetstakey_rsp = NULL; struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - struct security_priv *psecuritypriv = &padapter->securitypriv; - struct sta_info* sta = (struct sta_info* )psta; + struct security_priv *psecuritypriv = &padapter->securitypriv; + struct sta_info* sta = (struct sta_info* )psta; u8 res=_SUCCESS; _func_enter_; @@ -1544,7 +1544,7 @@ _func_enter_; goto exit; } - psetstakey_rsp = (struct set_stakey_rsp*)rtw_zmalloc(sizeof(struct set_stakey_rsp)); + psetstakey_rsp = (struct set_stakey_rsp*)rtw_zmalloc(sizeof(struct set_stakey_rsp)); if(psetstakey_rsp == NULL){ rtw_mfree((u8 *) ph2c, sizeof(struct cmd_obj)); rtw_mfree((u8 *) psetstakey_para, sizeof(struct set_stakey_parm)); @@ -1561,14 +1561,14 @@ _func_enter_; psetstakey_para->algorithm = _NO_PRIVACY_; psetstakey_para->id = entry; - - res = rtw_enqueue_cmd(pcmdpriv, ph2c); - + + res = rtw_enqueue_cmd(pcmdpriv, ph2c); + } - + exit: -_func_exit_; +_func_exit_; return res; } @@ -1576,17 +1576,17 @@ _func_exit_; u8 rtw_setrttbl_cmd(struct adapter *padapter, struct setratable_parm *prate_table) { struct cmd_obj* ph2c; - struct setratable_parm * psetrttblparm; - struct cmd_priv *pcmdpriv=&padapter->cmdpriv; + struct setratable_parm * psetrttblparm; + struct cmd_priv *pcmdpriv=&padapter->cmdpriv; u8 res=_SUCCESS; -_func_enter_; +_func_enter_; ph2c = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj)); if(ph2c==NULL){ res= _FAIL; goto exit; } - psetrttblparm = (struct setratable_parm*)rtw_zmalloc(sizeof(struct setratable_parm)); + psetrttblparm = (struct setratable_parm*)rtw_zmalloc(sizeof(struct setratable_parm)); if(psetrttblparm==NULL){ rtw_mfree((unsigned char *) ph2c, sizeof(struct cmd_obj)); @@ -1598,9 +1598,9 @@ _func_enter_; _rtw_memcpy(psetrttblparm,prate_table,sizeof(struct setratable_parm)); - res = rtw_enqueue_cmd(pcmdpriv, ph2c); + res = rtw_enqueue_cmd(pcmdpriv, ph2c); exit: -_func_exit_; +_func_exit_; return res; } @@ -1608,17 +1608,17 @@ _func_exit_; u8 rtw_getrttbl_cmd(struct adapter *padapter, struct getratable_rsp *pval) { struct cmd_obj* ph2c; - struct getratable_parm * pgetrttblparm; - struct cmd_priv *pcmdpriv=&padapter->cmdpriv; + struct getratable_parm * pgetrttblparm; + struct cmd_priv *pcmdpriv=&padapter->cmdpriv; u8 res=_SUCCESS; -_func_enter_; +_func_enter_; ph2c = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj)); if(ph2c==NULL){ res= _FAIL; goto exit; } - pgetrttblparm = (struct getratable_parm*)rtw_zmalloc(sizeof(struct getratable_parm)); + pgetrttblparm = (struct getratable_parm*)rtw_zmalloc(sizeof(struct getratable_parm)); if(pgetrttblparm==NULL){ rtw_mfree((unsigned char *) ph2c, sizeof(struct cmd_obj)); @@ -1634,26 +1634,26 @@ _func_enter_; ph2c->cmdsz = sizeof(struct getratable_parm); ph2c->rsp = (u8*)pval; ph2c->rspsz = sizeof(struct getratable_rsp); - + pgetrttblparm ->rsvd = 0x0; - - res = rtw_enqueue_cmd(pcmdpriv, ph2c); + + res = rtw_enqueue_cmd(pcmdpriv, ph2c); exit: -_func_exit_; +_func_exit_; return res; } u8 rtw_setassocsta_cmd(struct adapter *padapter, u8 *mac_addr) { - struct cmd_priv *pcmdpriv = &padapter->cmdpriv; + struct cmd_priv *pcmdpriv = &padapter->cmdpriv; struct cmd_obj* ph2c; - struct set_assocsta_parm *psetassocsta_para; + struct set_assocsta_parm *psetassocsta_para; struct set_stakey_rsp *psetassocsta_rsp = NULL; u8 res=_SUCCESS; -_func_enter_; +_func_enter_; ph2c = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj)); if(ph2c==NULL){ @@ -1668,7 +1668,7 @@ _func_enter_; goto exit; } - psetassocsta_rsp = (struct set_stakey_rsp*)rtw_zmalloc(sizeof(struct set_assocsta_rsp)); + psetassocsta_rsp = (struct set_stakey_rsp*)rtw_zmalloc(sizeof(struct set_assocsta_rsp)); if(psetassocsta_rsp==NULL){ rtw_mfree((u8 *) ph2c, sizeof(struct cmd_obj)); rtw_mfree((u8 *) psetassocsta_para, sizeof(struct set_assocsta_parm)); @@ -1680,12 +1680,12 @@ _func_enter_; ph2c->rspsz = sizeof(struct set_assocsta_rsp); _rtw_memcpy(psetassocsta_para->addr, mac_addr,ETH_ALEN); - - res = rtw_enqueue_cmd(pcmdpriv, ph2c); + + res = rtw_enqueue_cmd(pcmdpriv, ph2c); exit: -_func_exit_; +_func_exit_; return res; } @@ -1697,16 +1697,16 @@ u8 rtw_addbareq_cmd(struct adapter*padapter, u8 tid, u8 *addr) struct addBaReq_parm *paddbareq_parm; u8 res=_SUCCESS; - -_func_enter_; - ph2c = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj)); +_func_enter_; + + ph2c = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj)); if(ph2c==NULL){ res= _FAIL; goto exit; } - - paddbareq_parm = (struct addBaReq_parm*)rtw_zmalloc(sizeof(struct addBaReq_parm)); + + paddbareq_parm = (struct addBaReq_parm*)rtw_zmalloc(sizeof(struct addBaReq_parm)); if(paddbareq_parm==NULL){ rtw_mfree((unsigned char *)ph2c, sizeof(struct cmd_obj)); res= _FAIL; @@ -1720,11 +1720,11 @@ _func_enter_; //DBG_871X("rtw_addbareq_cmd, tid=%d\n", tid); - //rtw_enqueue_cmd(pcmdpriv, ph2c); + //rtw_enqueue_cmd(pcmdpriv, ph2c); res = rtw_enqueue_cmd(pcmdpriv, ph2c); - + exit: - + _func_exit_; return res; @@ -1733,19 +1733,19 @@ _func_exit_; u8 rtw_reset_securitypriv_cmd(struct adapter*padapter) { struct cmd_obj* ph2c; - struct drvextra_cmd_parm *pdrvextra_cmd_parm; + struct drvextra_cmd_parm *pdrvextra_cmd_parm; struct cmd_priv *pcmdpriv=&padapter->cmdpriv; u8 res=_SUCCESS; - -_func_enter_; - ph2c = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj)); +_func_enter_; + + ph2c = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj)); if(ph2c==NULL){ res= _FAIL; goto exit; } - - pdrvextra_cmd_parm = (struct drvextra_cmd_parm*)rtw_zmalloc(sizeof(struct drvextra_cmd_parm)); + + pdrvextra_cmd_parm = (struct drvextra_cmd_parm*)rtw_zmalloc(sizeof(struct drvextra_cmd_parm)); if(pdrvextra_cmd_parm==NULL){ rtw_mfree((unsigned char *)ph2c, sizeof(struct cmd_obj)); res= _FAIL; @@ -1758,12 +1758,12 @@ _func_enter_; init_h2fwcmd_w_parm_no_rsp(ph2c, pdrvextra_cmd_parm, GEN_CMD_CODE(_Set_Drv_Extra)); - - //rtw_enqueue_cmd(pcmdpriv, ph2c); + + //rtw_enqueue_cmd(pcmdpriv, ph2c); res = rtw_enqueue_cmd(pcmdpriv, ph2c); - + exit: - + _func_exit_; return res; @@ -1773,19 +1773,19 @@ _func_exit_; u8 rtw_free_assoc_resources_cmd(struct adapter*padapter) { struct cmd_obj* ph2c; - struct drvextra_cmd_parm *pdrvextra_cmd_parm; + struct drvextra_cmd_parm *pdrvextra_cmd_parm; struct cmd_priv *pcmdpriv=&padapter->cmdpriv; u8 res=_SUCCESS; - -_func_enter_; - ph2c = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj)); +_func_enter_; + + ph2c = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj)); if(ph2c==NULL){ res= _FAIL; goto exit; } - - pdrvextra_cmd_parm = (struct drvextra_cmd_parm*)rtw_zmalloc(sizeof(struct drvextra_cmd_parm)); + + pdrvextra_cmd_parm = (struct drvextra_cmd_parm*)rtw_zmalloc(sizeof(struct drvextra_cmd_parm)); if(pdrvextra_cmd_parm==NULL){ rtw_mfree((unsigned char *)ph2c, sizeof(struct cmd_obj)); res= _FAIL; @@ -1798,12 +1798,12 @@ _func_enter_; init_h2fwcmd_w_parm_no_rsp(ph2c, pdrvextra_cmd_parm, GEN_CMD_CODE(_Set_Drv_Extra)); - - //rtw_enqueue_cmd(pcmdpriv, ph2c); + + //rtw_enqueue_cmd(pcmdpriv, ph2c); res = rtw_enqueue_cmd(pcmdpriv, ph2c); - + exit: - + _func_exit_; return res; @@ -1813,24 +1813,24 @@ _func_exit_; u8 rtw_dynamic_chk_wk_cmd(struct adapter*padapter) { struct cmd_obj* ph2c; - struct drvextra_cmd_parm *pdrvextra_cmd_parm; + struct drvextra_cmd_parm *pdrvextra_cmd_parm; struct cmd_priv *pcmdpriv=&padapter->cmdpriv; u8 res=_SUCCESS; - -_func_enter_; + +_func_enter_; #ifdef CONFIG_CONCURRENT_MODE if (padapter->adapter_type != PRIMARY_ADAPTER && padapter->pbuddy_adapter) pcmdpriv = &(padapter->pbuddy_adapter->cmdpriv); #endif - ph2c = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj)); + ph2c = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj)); if(ph2c==NULL){ res= _FAIL; goto exit; } - - pdrvextra_cmd_parm = (struct drvextra_cmd_parm*)rtw_zmalloc(sizeof(struct drvextra_cmd_parm)); + + pdrvextra_cmd_parm = (struct drvextra_cmd_parm*)rtw_zmalloc(sizeof(struct drvextra_cmd_parm)); if(pdrvextra_cmd_parm==NULL){ rtw_mfree((unsigned char *)ph2c, sizeof(struct cmd_obj)); res= _FAIL; @@ -1843,12 +1843,12 @@ _func_enter_; init_h2fwcmd_w_parm_no_rsp(ph2c, pdrvextra_cmd_parm, GEN_CMD_CODE(_Set_Drv_Extra)); - - //rtw_enqueue_cmd(pcmdpriv, ph2c); + + //rtw_enqueue_cmd(pcmdpriv, ph2c); res = rtw_enqueue_cmd(pcmdpriv, ph2c); - + exit: - + _func_exit_; return res; @@ -1895,7 +1895,7 @@ _func_enter_; /* no need to enqueue, do the cmd hdl directly and free cmd parameter */ if( H2C_SUCCESS !=set_ch_hdl(padapter, (u8 *)set_ch_parm) ) res = _FAIL; - + rtw_mfree((u8 *)set_ch_parm, sizeof(*set_ch_parm)); } @@ -1905,7 +1905,7 @@ exit: DBG_871X(FUNC_NDEV_FMT" res:%u\n", FUNC_NDEV_ARG(padapter->pnetdev), res); -_func_exit_; +_func_exit_; return res; } @@ -1954,17 +1954,17 @@ _func_enter_; //no need to enqueue, do the cmd hdl directly and free cmd parameter if( H2C_SUCCESS !=set_chplan_hdl(padapter, (unsigned char *)setChannelPlan_param) ) res = _FAIL; - + rtw_mfree((u8 *)setChannelPlan_param, sizeof(struct SetChannelPlan_param)); } //do something based on res... if(res == _SUCCESS) padapter->mlmepriv.ChannelPlan = chplan; - + exit: -_func_exit_; +_func_exit_; return res; } @@ -1980,7 +1980,7 @@ u8 rtw_led_blink_cmd(struct adapter*padapter, PLED_871x pLed) _func_enter_; RT_TRACE(_module_rtl871x_cmd_c_, _drv_notice_, ("+rtw_led_blink_cmd\n")); - + pcmdobj = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj)); if(pcmdobj == NULL){ res=_FAIL; @@ -1995,13 +1995,13 @@ _func_enter_; } ledBlink_param->pLed=pLed; - + init_h2fwcmd_w_parm_no_rsp(pcmdobj, ledBlink_param, GEN_CMD_CODE(_LedBlink)); res = rtw_enqueue_cmd(pcmdpriv, pcmdobj); - + exit: -_func_exit_; +_func_exit_; return res; } @@ -2010,7 +2010,7 @@ u8 rtw_set_csa_cmd(struct adapter*padapter, u8 new_ch_no) { struct cmd_obj* pcmdobj; struct SetChannelSwitch_param*setChannelSwitch_param; - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; + struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct cmd_priv *pcmdpriv = &padapter->cmdpriv; u8 res=_SUCCESS; @@ -2018,7 +2018,7 @@ u8 rtw_set_csa_cmd(struct adapter*padapter, u8 new_ch_no) _func_enter_; RT_TRACE(_module_rtl871x_cmd_c_, _drv_notice_, ("+rtw_set_csa_cmd\n")); - + pcmdobj = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj)); if(pcmdobj == NULL){ res=_FAIL; @@ -2033,13 +2033,13 @@ _func_enter_; } setChannelSwitch_param->new_ch_no=new_ch_no; - + init_h2fwcmd_w_parm_no_rsp(pcmdobj, setChannelSwitch_param, GEN_CMD_CODE(_SetChannelSwitch)); res = rtw_enqueue_cmd(pcmdpriv, pcmdobj); - + exit: -_func_exit_; +_func_exit_; return res; } @@ -2048,7 +2048,7 @@ u8 rtw_tdls_cmd(struct adapter *padapter, u8 *addr, u8 option) { struct cmd_obj* pcmdobj; struct TDLSoption_param *TDLSoption; - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; + struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct cmd_priv *pcmdpriv = &padapter->cmdpriv; u8 res=_SUCCESS; @@ -2073,18 +2073,18 @@ _func_enter_; } _rtw_spinlock(&(padapter->tdlsinfo.cmd_lock)); - _rtw_memcpy(TDLSoption->addr, addr, 6); + _rtw_memcpy(TDLSoption->addr, addr, 6); TDLSoption->option = option; _rtw_spinunlock(&(padapter->tdlsinfo.cmd_lock)); init_h2fwcmd_w_parm_no_rsp(pcmdobj, TDLSoption, GEN_CMD_CODE(_TDLS)); res = rtw_enqueue_cmd(pcmdpriv, pcmdobj); #endif //CONFIG_TDLS - + exit: -_func_exit_; +_func_exit_; return res; } @@ -2093,26 +2093,26 @@ _func_exit_; u8 rtw_event_polling_cmd(struct adapter*padapter) { struct cmd_obj* ph2c; - struct drvextra_cmd_parm *pdrvextra_cmd_parm; + struct drvextra_cmd_parm *pdrvextra_cmd_parm; struct cmd_priv *pcmdpriv=&padapter->cmdpriv; u8 res=_SUCCESS; -_func_enter_; +_func_enter_; #if defined(CONFIG_CONCURRENT_MODE) if (padapter->adapter_type != PRIMARY_ADAPTER) - { + { return _FAIL; } #endif - ph2c = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj)); + ph2c = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj)); if(ph2c==NULL){ res= _FAIL; goto exit; } - - pdrvextra_cmd_parm = (struct drvextra_cmd_parm*)rtw_zmalloc(sizeof(struct drvextra_cmd_parm)); + + pdrvextra_cmd_parm = (struct drvextra_cmd_parm*)rtw_zmalloc(sizeof(struct drvextra_cmd_parm)); if(pdrvextra_cmd_parm==NULL){ rtw_mfree((unsigned char *)ph2c, sizeof(struct cmd_obj)); res= _FAIL; @@ -2125,12 +2125,12 @@ _func_enter_; init_h2fwcmd_w_parm_no_rsp(ph2c, pdrvextra_cmd_parm, GEN_CMD_CODE(_Set_Drv_Extra)); - - //rtw_enqueue_cmd(pcmdpriv, ph2c); + + //rtw_enqueue_cmd(pcmdpriv, ph2c); res = rtw_enqueue_cmd(pcmdpriv, ph2c); - + exit: - + _func_exit_; return res; @@ -2158,7 +2158,7 @@ static void traffic_status_watchdog(struct adapter *padapter) // // Determine if our traffic is busy now // - if((check_fwstate(pmlmepriv, _FW_LINKED)== _TRUE) + if((check_fwstate(pmlmepriv, _FW_LINKED)== _TRUE) /*&& !MgntInitAdapterInProgress(pMgntInfo)*/) { // if we raise bBusyTraffic in last watchdog, using lower threshold. @@ -2188,11 +2188,11 @@ static void traffic_status_watchdog(struct adapter *padapter) } #ifdef CONFIG_FTP_PROTECT - DBG_871X("RX in period:%d, TX in period:%d, ftp_lock_flag:%d\n", + DBG_871X("RX in period:%d, TX in period:%d, ftp_lock_flag:%d\n", pmlmepriv->LinkDetectInfo.NumRxOkInPeriod, pmlmepriv->LinkDetectInfo.NumTxOkInPeriod, pmlmepriv->ftp_lock_flag); - + bPktCount = pmlmepriv->LinkDetectInfo.NumRxOkInPeriod + pmlmepriv->LinkDetectInfo.NumTxOkInPeriod; if (bPktCount > 20 && !pmlmepriv->ftp_lock_flag) { pmlmepriv->ftp_lock_flag = 1; @@ -2280,32 +2280,32 @@ void dynamic_chk_wk_hdl(struct adapter *padapter, u8 *pbuf, int sz); void dynamic_chk_wk_hdl(struct adapter *padapter, u8 *pbuf, int sz) { struct mlme_priv *pmlmepriv; - + padapter = (struct adapter *)pbuf; pmlmepriv = &(padapter->mlmepriv); #ifdef CONFIG_ACTIVE_KEEP_ALIVE_CHECK #ifdef CONFIG_AP_MODE if(check_fwstate(pmlmepriv, WIFI_AP_STATE) == _TRUE) - { + { expire_timeout_chk(padapter); } #endif #endif //CONFIG_ACTIVE_KEEP_ALIVE_CHECK - #ifdef DBG_CONFIG_ERROR_DETECT - rtw_hal_sreset_xmit_status_check(padapter); - #endif + #ifdef DBG_CONFIG_ERROR_DETECT + rtw_hal_sreset_xmit_status_check(padapter); + #endif //if(check_fwstate(pmlmepriv, _FW_UNDER_LINKING|_FW_UNDER_SURVEY)==_FALSE) { - linked_status_chk(padapter); + linked_status_chk(padapter); traffic_status_watchdog(padapter); } rtw_hal_dm_watchdog(padapter); - //check_hw_pbc(padapter, pdrvextra_cmd->pbuf, pdrvextra_cmd->type_size); + //check_hw_pbc(padapter, pdrvextra_cmd->pbuf, pdrvextra_cmd->type_size); #ifdef CONFIG_BT_COEXIST // @@ -2323,7 +2323,7 @@ void lps_ctrl_wk_hdl(struct adapter *padapter, u8 lps_ctrl_type) struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter); struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); u8 mstatus; - + _func_enter_; if((check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) == _TRUE) @@ -2409,7 +2409,7 @@ u8 rtw_lps_ctrl_wk_cmd(struct adapter*padapter, u8 lps_ctrl_type, u8 enqueue) struct cmd_priv *pcmdpriv = &padapter->cmdpriv; //struct pwrctrl_priv *pwrctrlpriv = adapter_to_pwrctl(padapter); u8 res = _SUCCESS; - + _func_enter_; //if(!pwrctrlpriv->bLeisurePs) @@ -2422,13 +2422,13 @@ _func_enter_; if(enqueue) { - ph2c = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj)); + ph2c = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj)); if(ph2c==NULL){ res= _FAIL; goto exit; } - - pdrvextra_cmd_parm = (struct drvextra_cmd_parm*)rtw_zmalloc(sizeof(struct drvextra_cmd_parm)); + + pdrvextra_cmd_parm = (struct drvextra_cmd_parm*)rtw_zmalloc(sizeof(struct drvextra_cmd_parm)); if(pdrvextra_cmd_parm==NULL){ rtw_mfree((unsigned char *)ph2c, sizeof(struct cmd_obj)); res= _FAIL; @@ -2447,9 +2447,9 @@ _func_enter_; { lps_ctrl_wk_hdl(padapter, lps_ctrl_type); } - + exit: - + _func_exit_; return res; @@ -2467,13 +2467,13 @@ void rpt_timer_setting_wk_hdl(struct adapter *padapter, u16 minRptTime) u8 rtw_rpt_timer_cfg_cmd(struct adapter*padapter, u16 minRptTime) { struct cmd_obj *ph2c; - struct drvextra_cmd_parm *pdrvextra_cmd_parm; + struct drvextra_cmd_parm *pdrvextra_cmd_parm; struct cmd_priv *pcmdpriv = &padapter->cmdpriv; u8 res = _SUCCESS; _func_enter_; - ph2c = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj)); + ph2c = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj)); if(ph2c==NULL){ res= _FAIL; goto exit; @@ -2510,9 +2510,9 @@ void antenna_select_wk_hdl(struct adapter *padapter, u8 antenna) u8 rtw_antenna_select_cmd(struct adapter*padapter, u8 antenna,u8 enqueue) { struct cmd_obj *ph2c; - struct drvextra_cmd_parm *pdrvextra_cmd_parm; + struct drvextra_cmd_parm *pdrvextra_cmd_parm; struct cmd_priv *pcmdpriv = &padapter->cmdpriv; - u8 bSupportAntDiv = _FALSE; + u8 bSupportAntDiv = _FALSE; u8 res = _SUCCESS; _func_enter_; @@ -2521,7 +2521,7 @@ _func_enter_; if(_TRUE == enqueue) { - ph2c = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj)); + ph2c = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj)); if(ph2c==NULL){ res= _FAIL; goto exit; @@ -2578,7 +2578,7 @@ u8 p2p_protocol_wk_cmd(struct adapter*padapter, int intCmdType ) struct wifidirect_info *pwdinfo= &(padapter->wdinfo); struct cmd_priv *pcmdpriv = &padapter->cmdpriv; u8 res = _SUCCESS; - + _func_enter_; if(rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) @@ -2586,13 +2586,13 @@ _func_enter_; return res; } - ph2c = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj)); + ph2c = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj)); if(ph2c==NULL){ res= _FAIL; goto exit; } - - pdrvextra_cmd_parm = (struct drvextra_cmd_parm*)rtw_zmalloc(sizeof(struct drvextra_cmd_parm)); + + pdrvextra_cmd_parm = (struct drvextra_cmd_parm*)rtw_zmalloc(sizeof(struct drvextra_cmd_parm)); if(pdrvextra_cmd_parm==NULL){ rtw_mfree((unsigned char *)ph2c, sizeof(struct cmd_obj)); res= _FAIL; @@ -2606,9 +2606,9 @@ _func_enter_; init_h2fwcmd_w_parm_no_rsp(ph2c, pdrvextra_cmd_parm, GEN_CMD_CODE(_Set_Drv_Extra)); res = rtw_enqueue_cmd(pcmdpriv, ph2c); - + exit: - + _func_exit_; return res; @@ -2619,9 +2619,9 @@ _func_exit_; u8 rtw_ps_cmd(struct adapter*padapter) { struct cmd_obj *ppscmd; - struct drvextra_cmd_parm *pdrvextra_cmd_parm; + struct drvextra_cmd_parm *pdrvextra_cmd_parm; struct cmd_priv *pcmdpriv = &padapter->cmdpriv; - + u8 res = _SUCCESS; _func_enter_; @@ -2629,28 +2629,28 @@ _func_enter_; if (padapter->adapter_type != PRIMARY_ADAPTER) goto exit; #endif - - ppscmd = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj)); + + ppscmd = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj)); if(ppscmd==NULL){ res= _FAIL; goto exit; } - - pdrvextra_cmd_parm = (struct drvextra_cmd_parm*)rtw_zmalloc(sizeof(struct drvextra_cmd_parm)); + + pdrvextra_cmd_parm = (struct drvextra_cmd_parm*)rtw_zmalloc(sizeof(struct drvextra_cmd_parm)); if(pdrvextra_cmd_parm==NULL){ rtw_mfree((unsigned char *)ppscmd, sizeof(struct cmd_obj)); res= _FAIL; goto exit; } - pdrvextra_cmd_parm->ec_id = POWER_SAVING_CTRL_WK_CID; + pdrvextra_cmd_parm->ec_id = POWER_SAVING_CTRL_WK_CID; pdrvextra_cmd_parm->pbuf = NULL; init_h2fwcmd_w_parm_no_rsp(ppscmd, pdrvextra_cmd_parm, GEN_CMD_CODE(_Set_Drv_Extra)); res = rtw_enqueue_cmd(pcmdpriv, ppscmd); - + exit: - + _func_exit_; return res; @@ -2670,20 +2670,20 @@ static void rtw_chk_hi_queue_hdl(struct adapter *padapter) return; if(psta_bmc->sleepq_len==0) - { + { u8 val = 0; //while((rtw_read32(padapter, 0x414)&0x00ffff00)!=0) //while((rtw_read32(padapter, 0x414)&0x0000ff00)!=0) - - rtw_hal_get_hwreg(padapter, HW_VAR_CHK_HI_QUEUE_EMPTY, &val); - + + rtw_hal_get_hwreg(padapter, HW_VAR_CHK_HI_QUEUE_EMPTY, &val); + while(_FALSE == val) { rtw_msleep_os(100); cnt++; - + if(cnt>10) break; @@ -2694,32 +2694,32 @@ static void rtw_chk_hi_queue_hdl(struct adapter *padapter) { pstapriv->tim_bitmap &= ~BIT(0); pstapriv->sta_dz_bitmap &= ~BIT(0); - + update_beacon(padapter, _TIM_IE_, NULL, _FALSE); } else //re check again { rtw_chk_hi_queue_cmd(padapter); } - - } - + + } + } u8 rtw_chk_hi_queue_cmd(struct adapter*padapter) { struct cmd_obj *ph2c; - struct drvextra_cmd_parm *pdrvextra_cmd_parm; + struct drvextra_cmd_parm *pdrvextra_cmd_parm; struct cmd_priv *pcmdpriv = &padapter->cmdpriv; u8 res = _SUCCESS; - - ph2c = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj)); + + ph2c = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj)); if(ph2c==NULL){ res= _FAIL; goto exit; } - - pdrvextra_cmd_parm = (struct drvextra_cmd_parm*)rtw_zmalloc(sizeof(struct drvextra_cmd_parm)); + + pdrvextra_cmd_parm = (struct drvextra_cmd_parm*)rtw_zmalloc(sizeof(struct drvextra_cmd_parm)); if(pdrvextra_cmd_parm==NULL){ rtw_mfree((unsigned char *)ph2c, sizeof(struct cmd_obj)); res= _FAIL; @@ -2733,9 +2733,9 @@ u8 rtw_chk_hi_queue_cmd(struct adapter*padapter) init_h2fwcmd_w_parm_no_rsp(ph2c, pdrvextra_cmd_parm, GEN_CMD_CODE(_Set_Drv_Extra)); res = rtw_enqueue_cmd(pcmdpriv, ph2c); - + exit: - + return res; } @@ -2768,9 +2768,9 @@ u8 rtw_c2h_wk_cmd(struct adapter *padapter, u8 *c2h_evt) init_h2fwcmd_w_parm_no_rsp(ph2c, pdrvextra_cmd_parm, GEN_CMD_CODE(_Set_Drv_Extra)); res = rtw_enqueue_cmd(pcmdpriv, ph2c); - + exit: - + return res; } @@ -2783,7 +2783,7 @@ s32 c2h_evt_hdl(struct adapter *adapter, struct c2h_evt_hdr *c2h_evt, c2h_id_fil /* No c2h event in cmd_obj, read c2h event before handling*/ if (c2h_evt_read(adapter, buf) == _SUCCESS) { c2h_evt = (struct c2h_evt_hdr *)buf; - + if (filter && filter(c2h_evt->id) == _FALSE) goto exit; @@ -2828,7 +2828,7 @@ static void c2h_wk_callback(_workitem *work) rtw_mfree((u8*)c2h_evt, 16); continue; } - + if (ccx_id_filter(c2h_evt->id) == _TRUE) { /* Handle CCX report here */ rtw_hal_c2h_handler(adapter, c2h_evt); @@ -2847,7 +2847,7 @@ static void c2h_wk_callback(_workitem *work) void event_polling_hdl(struct adapter *padapter, u8 *pbuf, int sz) { c2h_id_filter ccx_id_filter = rtw_hal_c2h_id_filter_ccx(padapter); - u8 check_c2hcmd, check_ccx; + u8 check_c2hcmd, check_ccx; //check_c2hcmd = rtw_read8(padapter, REG_C2HEVT_CLEAR); //check_ccx= rtw_read8(padapter, REG_C2HEVT_MSG_NORMAL); @@ -2861,8 +2861,8 @@ void event_polling_hdl(struct adapter *padapter, u8 *pbuf, int sz) if (check_c2hcmd != 0xFF) { - c2h_evt_clear(padapter); - } + c2h_evt_clear(padapter); + } else if (ccx_id_filter(check_ccx & 0x0F) == _FALSE) { if ((c2h_evt = (struct c2h_evt_hdr *)rtw_zmalloc(16)) != NULL) { @@ -2875,7 +2875,7 @@ void event_polling_hdl(struct adapter *padapter, u8 *pbuf, int sz) if (rtw_cbuf_push(padapter->evtpriv.c2h_queue, (void*)NULL) != _SUCCESS) DBG_871X("%s rtw_cbuf_push fail\n", __func__); _set_workitem(&padapter->evtpriv.c2h_wk); - } + } } else { @@ -2896,14 +2896,14 @@ u8 rtw_drvextra_cmd_hdl(struct adapter *padapter, unsigned char *pbuf) return H2C_PARAMETERS_ERROR; pdrvextra_cmd = (struct drvextra_cmd_parm*)pbuf; - + switch(pdrvextra_cmd->ec_id) { case DYNAMIC_CHK_WK_CID: dynamic_chk_wk_hdl(padapter, pdrvextra_cmd->pbuf, pdrvextra_cmd->type_size); break; case POWER_SAVING_CTRL_WK_CID: - power_saving_wk_hdl(padapter, pdrvextra_cmd->pbuf, pdrvextra_cmd->type_size); + power_saving_wk_hdl(padapter, pdrvextra_cmd->pbuf, pdrvextra_cmd->type_size); break; #ifdef CONFIG_LPS case LPS_CTRL_WK_CID: @@ -2969,7 +2969,7 @@ u8 rtw_drvextra_cmd_hdl(struct adapter *padapter, unsigned char *pbuf) void rtw_survey_cmd_callback(struct adapter* padapter , struct cmd_obj *pcmd) { - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; + struct mlme_priv *pmlmepriv = &padapter->mlmepriv; _func_enter_; @@ -2982,26 +2982,26 @@ _func_enter_; else if (pcmd->res != H2C_SUCCESS) { _set_timer(&pmlmepriv->scan_to_timer, 1); RT_TRACE(_module_rtl871x_cmd_c_,_drv_err_,("\n ********Error: MgntActrtw_set_802_11_bssid_LIST_SCAN Fail ************\n\n.")); - } + } // free cmd rtw_free_cmd_obj(pcmd); -_func_exit_; +_func_exit_; } void rtw_disassoc_cmd_callback(struct adapter* padapter, struct cmd_obj *pcmd) { _irqL irqL; - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - -_func_enter_; + struct mlme_priv *pmlmepriv = &padapter->mlmepriv; + +_func_enter_; if (pcmd->res != H2C_SUCCESS) { _enter_critical_bh(&pmlmepriv->lock, &irqL); set_fwstate(pmlmepriv, _FW_LINKED); _exit_critical_bh(&pmlmepriv->lock, &irqL); - + RT_TRACE(_module_rtl871x_cmd_c_,_drv_err_,("\n ***Error: disconnect_cmd_callback Fail ***\n.")); goto exit; @@ -3013,18 +3013,18 @@ _func_enter_; // free cmd rtw_free_cmd_obj(pcmd); - + exit: - -_func_exit_; + +_func_exit_; } void rtw_joinbss_cmd_callback(struct adapter* padapter, struct cmd_obj *pcmd) { - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; + struct mlme_priv *pmlmepriv = &padapter->mlmepriv; -_func_enter_; +_func_enter_; if(pcmd->res == H2C_DROPPED) { @@ -3033,75 +3033,75 @@ _func_enter_; _set_timer(&pmlmepriv->assoc_timer, 1); } else if(pcmd->res != H2C_SUCCESS) - { + { RT_TRACE(_module_rtl871x_cmd_c_,_drv_err_,("********Error:rtw_select_and_join_from_scanned_queue Wait Sema Fail ************\n")); - _set_timer(&pmlmepriv->assoc_timer, 1); + _set_timer(&pmlmepriv->assoc_timer, 1); } - + rtw_free_cmd_obj(pcmd); - -_func_exit_; + +_func_exit_; } void rtw_createbss_cmd_callback(struct adapter *padapter, struct cmd_obj *pcmd) -{ +{ _irqL irqL; u8 timer_cancelled; struct sta_info *psta = NULL; - struct wlan_network *pwlan = NULL; - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; + struct wlan_network *pwlan = NULL; + struct mlme_priv *pmlmepriv = &padapter->mlmepriv; WLAN_BSSID_EX *pnetwork = (WLAN_BSSID_EX *)pcmd->parmbuf; struct wlan_network *tgt_network = &(pmlmepriv->cur_network); -_func_enter_; +_func_enter_; if((pcmd->res != H2C_SUCCESS)) - { + { RT_TRACE(_module_rtl871x_cmd_c_,_drv_err_,("\n ********Error: rtw_createbss_cmd_callback Fail ************\n\n.")); - _set_timer(&pmlmepriv->assoc_timer, 1 ); + _set_timer(&pmlmepriv->assoc_timer, 1 ); } - + _cancel_timer(&pmlmepriv->assoc_timer, &timer_cancelled); #ifdef CONFIG_FW_MLMLE //endian_convert pnetwork->Length = le32_to_cpu(pnetwork->Length); - pnetwork->Ssid.SsidLength = le32_to_cpu(pnetwork->Ssid.SsidLength); + pnetwork->Ssid.SsidLength = le32_to_cpu(pnetwork->Ssid.SsidLength); pnetwork->Privacy =le32_to_cpu(pnetwork->Privacy); pnetwork->Rssi = le32_to_cpu(pnetwork->Rssi); - pnetwork->NetworkTypeInUse =le32_to_cpu(pnetwork->NetworkTypeInUse); + pnetwork->NetworkTypeInUse =le32_to_cpu(pnetwork->NetworkTypeInUse); pnetwork->Configuration.ATIMWindow = le32_to_cpu(pnetwork->Configuration.ATIMWindow); //pnetwork->Configuration.BeaconPeriod = le32_to_cpu(pnetwork->Configuration.BeaconPeriod); pnetwork->Configuration.DSConfig =le32_to_cpu(pnetwork->Configuration.DSConfig); pnetwork->Configuration.FHConfig.DwellTime=le32_to_cpu(pnetwork->Configuration.FHConfig.DwellTime); pnetwork->Configuration.FHConfig.HopPattern=le32_to_cpu(pnetwork->Configuration.FHConfig.HopPattern); pnetwork->Configuration.FHConfig.HopSet=le32_to_cpu(pnetwork->Configuration.FHConfig.HopSet); - pnetwork->Configuration.FHConfig.Length=le32_to_cpu(pnetwork->Configuration.FHConfig.Length); + pnetwork->Configuration.FHConfig.Length=le32_to_cpu(pnetwork->Configuration.FHConfig.Length); pnetwork->Configuration.Length = le32_to_cpu(pnetwork->Configuration.Length); pnetwork->InfrastructureMode = le32_to_cpu(pnetwork->InfrastructureMode); pnetwork->IELength = le32_to_cpu(pnetwork->IELength); #endif - + _enter_critical_bh(&pmlmepriv->lock, &irqL); - - + + if(check_fwstate(pmlmepriv, WIFI_AP_STATE) ) { psta = rtw_get_stainfo(&padapter->stapriv, pnetwork->MacAddress); if(!psta) { psta = rtw_alloc_stainfo(&padapter->stapriv, pnetwork->MacAddress); - if (psta == NULL) - { + if (psta == NULL) + { RT_TRACE(_module_rtl871x_cmd_c_,_drv_err_,("\nCan't alloc sta_info when createbss_cmd_callback\n")); goto createbss_cmd_fail ; } - } - + } + rtw_indicate_connect( padapter); } else - { + { _irqL irqL; pwlan = _rtw_alloc_network(pmlmepriv); @@ -3115,20 +3115,20 @@ _func_enter_; _exit_critical_bh(&(pmlmepriv->scanned_queue.lock), &irqL); goto createbss_cmd_fail; } - pwlan->last_scanned = rtw_get_current_time(); - } + pwlan->last_scanned = rtw_get_current_time(); + } else { rtw_list_insert_tail(&(pwlan->list), &pmlmepriv->scanned_queue.queue); } - + pnetwork->Length = get_WLAN_BSSID_EX_sz(pnetwork); _rtw_memcpy(&(pwlan->network), pnetwork, pnetwork->Length); //pwlan->fixed = _TRUE; //rtw_list_insert_tail(&(pwlan->list), &pmlmepriv->scanned_queue.queue); - // copy pdev_network information to pmlmepriv->cur_network + // copy pdev_network information to pmlmepriv->cur_network _rtw_memcpy(&tgt_network->network, pnetwork, (get_WLAN_BSSID_EX_sz(pnetwork))); // reset DSConfig @@ -3136,7 +3136,7 @@ _func_enter_; _clr_fwstate_(pmlmepriv, _FW_UNDER_LINKING); -#if 0 +#if 0 if((pmlmepriv->fw_state) & WIFI_AP_STATE) { psta = rtw_alloc_stainfo(&padapter->stapriv, pnetwork->MacAddress); @@ -3145,26 +3145,26 @@ _func_enter_; RT_TRACE(_module_rtl871x_cmd_c_,_drv_err_,("\nCan't alloc sta_info when createbss_cmd_callback\n")); goto createbss_cmd_fail ; } - + rtw_indicate_connect( padapter); } else { //rtw_indicate_disconnect(dev); - } + } #endif _exit_critical_bh(&(pmlmepriv->scanned_queue.lock), &irqL); // we will set _FW_LINKED when there is one more sat to join us (rtw_stassoc_event_callback) - + } createbss_cmd_fail: - + _exit_critical_bh(&pmlmepriv->lock, &irqL); rtw_free_cmd_obj(pcmd); - -_func_exit_; + +_func_exit_; } @@ -3172,50 +3172,50 @@ _func_exit_; void rtw_setstaKey_cmdrsp_callback(struct adapter* padapter , struct cmd_obj *pcmd) { - + struct sta_priv * pstapriv = &padapter->stapriv; struct set_stakey_rsp* psetstakey_rsp = (struct set_stakey_rsp*) (pcmd->rsp); struct sta_info* psta = rtw_get_stainfo(pstapriv, psetstakey_rsp->addr); -_func_enter_; +_func_enter_; if(psta==NULL) { RT_TRACE(_module_rtl871x_cmd_c_,_drv_err_,("\nERROR: rtw_setstaKey_cmdrsp_callback => can't get sta_info \n\n")); goto exit; } - + //psta->aid = psta->mac_id = psetstakey_rsp->keyid; //CAM_ID(CAM_ENTRY) - -exit: + +exit: rtw_free_cmd_obj(pcmd); - -_func_exit_; + +_func_exit_; } void rtw_setassocsta_cmdrsp_callback(struct adapter* padapter, struct cmd_obj *pcmd) { _irqL irqL; struct sta_priv * pstapriv = &padapter->stapriv; - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; + struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct set_assocsta_parm* passocsta_parm = (struct set_assocsta_parm*)(pcmd->parmbuf); - struct set_assocsta_rsp* passocsta_rsp = (struct set_assocsta_rsp*) (pcmd->rsp); + struct set_assocsta_rsp* passocsta_rsp = (struct set_assocsta_rsp*) (pcmd->rsp); struct sta_info* psta = rtw_get_stainfo(pstapriv, passocsta_parm->addr); -_func_enter_; - +_func_enter_; + if(psta==NULL) { RT_TRACE(_module_rtl871x_cmd_c_,_drv_err_,("\nERROR: setassocsta_cmdrsp_callbac => can't get sta_info \n\n")); goto exit; } - + psta->aid = psta->mac_id = passocsta_rsp->cam_id; _enter_critical_bh(&pmlmepriv->lock, &irqL); - if ((check_fwstate(pmlmepriv, WIFI_MP_STATE) == _TRUE) && (check_fwstate(pmlmepriv, _FW_UNDER_LINKING) == _TRUE)) + if ((check_fwstate(pmlmepriv, WIFI_MP_STATE) == _TRUE) && (check_fwstate(pmlmepriv, _FW_UNDER_LINKING) == _TRUE)) _clr_fwstate_(pmlmepriv, _FW_UNDER_LINKING); set_fwstate(pmlmepriv, _FW_LINKED); @@ -3236,4 +3236,3 @@ _func_enter_; _func_exit_; } - diff --git a/core/rtw_debug.c b/core/rtw_debug.c index fc57c0e..7b33c53 100755 --- a/core/rtw_debug.c +++ b/core/rtw_debug.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Copyright(c) 2007 - 2012 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. @@ -67,11 +67,11 @@ int proc_get_drv_version(char *page, char **start, int *eof, void *data) { struct net_device *dev = data; - + int len = 0; len += snprintf(page + len, count - len, "%s\n", DRIVERVERSION); - + *eof = 1; return len; } @@ -80,7 +80,7 @@ int proc_get_drv_version(char *page, char **start, int proc_get_mstat(char *page, char **start, off_t offset, int count, int *eof, void *data) -{ +{ int len = 0; len += _rtw_mstat_dump(page+len, count-len); @@ -110,9 +110,9 @@ int proc_set_write_reg(struct file *file, const char *buffer, { DBG_871X("argument size is less than 3\n"); return -EFAULT; - } + } - if (buffer && !copy_from_user(tmp, buffer, sizeof(tmp))) { + if (buffer && !copy_from_user(tmp, buffer, sizeof(tmp))) { int num = sscanf(tmp, "%x %x %x", &addr, &val, &len); @@ -124,23 +124,23 @@ int proc_set_write_reg(struct file *file, const char *buffer, switch(len) { case 1: - rtw_write8(padapter, addr, (u8)val); + rtw_write8(padapter, addr, (u8)val); break; case 2: - rtw_write16(padapter, addr, (u16)val); + rtw_write16(padapter, addr, (u16)val); break; case 4: - rtw_write32(padapter, addr, val); + rtw_write32(padapter, addr, val); break; default: DBG_871X("error write length=%d", len); break; - } - + } + } - + return count; - + } static u32 proc_get_read_addr=0xeeeeeeee; @@ -149,21 +149,21 @@ static u32 proc_get_read_len=0x4; int proc_get_read_reg(char *page, char **start, off_t offset, int count, int *eof, void *data) -{ +{ struct net_device *dev = data; - struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); - + struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); + int len = 0; if(proc_get_read_addr==0xeeeeeeee) { *eof = 1; return len; - } + } switch(proc_get_read_len) { - case 1: + case 1: len += snprintf(page + len, count - len, "rtw_read8(0x%x)=0x%x\n", proc_get_read_addr, rtw_read8(padapter, proc_get_read_addr)); break; case 2: @@ -192,9 +192,9 @@ int proc_set_read_reg(struct file *file, const char *buffer, { DBG_871X("argument size is less than 2\n"); return -EFAULT; - } + } - if (buffer && !copy_from_user(tmp, buffer, sizeof(tmp))) { + if (buffer && !copy_from_user(tmp, buffer, sizeof(tmp))) { int num = sscanf(tmp, "%x %x", &addr, &len); @@ -204,10 +204,10 @@ int proc_set_read_reg(struct file *file, const char *buffer, } proc_get_read_addr = addr; - + proc_get_read_len = len; } - + return count; } @@ -219,11 +219,11 @@ int proc_get_fwstate(char *page, char **start, struct net_device *dev = data; struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); - + int len = 0; len += snprintf(page + len, count - len, "fwstate=0x%x\n", get_fwstate(pmlmepriv)); - + *eof = 1; return len; } @@ -233,15 +233,15 @@ int proc_get_sec_info(char *page, char **start, int *eof, void *data) { struct net_device *dev = data; - struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); + struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); struct security_priv *psecuritypriv = &padapter->securitypriv; - + int len = 0; - len += snprintf(page + len, count - len, "auth_alg=0x%x, enc_alg=0x%x, auth_type=0x%x, enc_type=0x%x\n", + len += snprintf(page + len, count - len, "auth_alg=0x%x, enc_alg=0x%x, auth_type=0x%x, enc_type=0x%x\n", psecuritypriv->dot11AuthAlgrthm, psecuritypriv->dot11PrivacyAlgrthm, psecuritypriv->ndisauthtype, psecuritypriv->ndisencryptstatus); - + *eof = 1; return len; } @@ -251,14 +251,14 @@ int proc_get_mlmext_state(char *page, char **start, int *eof, void *data) { struct net_device *dev = data; - struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); + struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); - + int len = 0; len += snprintf(page + len, count - len, "pmlmeinfo->state=0x%x\n", pmlmeinfo->state); - + *eof = 1; return len; } @@ -270,11 +270,11 @@ int proc_get_qos_option(char *page, char **start, struct net_device *dev = data; struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); - + int len = 0; len += snprintf(page + len, count - len, "qos_option=%d\n", pmlmepriv->qospriv.qos_option); - + *eof = 1; return len; @@ -287,7 +287,7 @@ int proc_get_ht_option(char *page, char **start, struct net_device *dev = data; struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); - + int len = 0; #ifdef CONFIG_80211N_HT len += snprintf(page + len, count - len, "ht_option=%d\n", pmlmepriv->htpriv.ht_option); @@ -301,14 +301,14 @@ int proc_get_rf_info(char *page, char **start, int *eof, void *data) { struct net_device *dev = data; - struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); - struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; + struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); + struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; int len = 0; - len += snprintf(page + len, count - len, "cur_ch=%d, cur_bw=%d, cur_ch_offet=%d\n", + len += snprintf(page + len, count - len, "cur_ch=%d, cur_bw=%d, cur_ch_offet=%d\n", pmlmeext->cur_channel, pmlmeext->cur_bwmode, pmlmeext->cur_ch_offset); - - + + *eof = 1; return len; @@ -332,31 +332,31 @@ int proc_get_ap_info(char *page, char **start, { int i; struct recv_reorder_ctrl *preorder_ctrl; - - len += snprintf(page + len, count - len, "SSID=%s\n", cur_network->network.Ssid.Ssid); + + len += snprintf(page + len, count - len, "SSID=%s\n", cur_network->network.Ssid.Ssid); len += snprintf(page + len, count - len, "sta's macaddr:" MAC_FMT "\n", MAC_ARG(psta->hwaddr)); - len += snprintf(page + len, count - len, "cur_channel=%d, cur_bwmode=%d, cur_ch_offset=%d\n", pmlmeext->cur_channel, pmlmeext->cur_bwmode, pmlmeext->cur_ch_offset); + len += snprintf(page + len, count - len, "cur_channel=%d, cur_bwmode=%d, cur_ch_offset=%d\n", pmlmeext->cur_channel, pmlmeext->cur_bwmode, pmlmeext->cur_ch_offset); len += snprintf(page + len, count - len, "rtsen=%d, cts2slef=%d\n", psta->rtsen, psta->cts2self); len += snprintf(page + len, count - len, "state=0x%x, aid=%d, macid=%d, raid=%d\n", psta->state, psta->aid, psta->mac_id, psta->raid); #ifdef CONFIG_80211N_HT - len += snprintf(page + len, count - len, "qos_en=%d, ht_en=%d, init_rate=%d\n", psta->qos_option, psta->htpriv.ht_option, psta->init_rate); - len += snprintf(page + len, count - len, "bwmode=%d, ch_offset=%d, sgi=%d\n", psta->htpriv.bwmode, psta->htpriv.ch_offset, psta->htpriv.sgi); - len += snprintf(page + len, count - len, "ampdu_enable = %d\n", psta->htpriv.ampdu_enable); + len += snprintf(page + len, count - len, "qos_en=%d, ht_en=%d, init_rate=%d\n", psta->qos_option, psta->htpriv.ht_option, psta->init_rate); + len += snprintf(page + len, count - len, "bwmode=%d, ch_offset=%d, sgi=%d\n", psta->htpriv.bwmode, psta->htpriv.ch_offset, psta->htpriv.sgi); + len += snprintf(page + len, count - len, "ampdu_enable = %d\n", psta->htpriv.ampdu_enable); len += snprintf(page + len, count - len, "agg_enable_bitmap=%x, candidate_tid_bitmap=%x\n", psta->htpriv.agg_enable_bitmap, psta->htpriv.candidate_tid_bitmap); #endif //CONFIG_80211N_HT - + for(i=0;i<16;i++) - { + { preorder_ctrl = &psta->recvreorder_ctrl[i]; if(preorder_ctrl->enable) { len += snprintf(page + len, count - len, "tid=%d, indicate_seq=%d\n", i, preorder_ctrl->indicate_seq); } - } - + } + } else - { + { len += snprintf(page + len, count - len, "can't get sta's macaddr, cur_network's macaddr:" MAC_FMT "\n", MAC_ARG(cur_network->network.MacAddress)); } @@ -372,15 +372,15 @@ int proc_get_adapter_state(char *page, char **start, struct net_device *dev = data; struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); int len = 0; - - len += snprintf(page + len, count - len, "bSurpriseRemoved=%d, bDriverStopped=%d\n", + + len += snprintf(page + len, count - len, "bSurpriseRemoved=%d, bDriverStopped=%d\n", padapter->bSurpriseRemoved, padapter->bDriverStopped); *eof = 1; return len; } - + int proc_get_trx_info(char *page, char **start, off_t offset, int count, int *eof, void *data) @@ -392,7 +392,7 @@ int proc_get_trx_info(char *page, char **start, struct recv_priv *precvpriv = &padapter->recvpriv; struct hw_xmit *phwxmit; int len = 0; - + len += snprintf(page + len, count - len, "free_xmitbuf_cnt=%d, free_xmitframe_cnt=%d" ", free_ext_xmitbuf_cnt=%d, free_xframe_ext_cnt=%d" ", free_recvframe_cnt=%d\n", @@ -400,7 +400,7 @@ int proc_get_trx_info(char *page, char **start, pxmitpriv->free_xmit_extbuf_cnt, pxmitpriv->free_xframe_ext_cnt, precvpriv->free_recvframe_cnt); - for(i = 0; i < 4; i++) + for(i = 0; i < 4; i++) { phwxmit = pxmitpriv->hwxmits + i; len += snprintf(page + len, count - len, "%d, hwq.accnt=%d\n", i, phwxmit->accnt); @@ -427,10 +427,10 @@ int proc_get_mac_reg_dump1(char *page, char **start, len += snprintf(page + len, count - len, "\n======= MAC REG =======\n"); for(i=0x0;i<0x300;i+=4) - { + { if(j%4==1) len += snprintf(page + len, count - len,"0x%02x",i); - len += snprintf(page + len, count - len," 0x%08x ",rtw_read32(padapter,i)); - if((j++)%4 == 0) len += snprintf(page + len, count - len,"\n"); + len += snprintf(page + len, count - len," 0x%08x ",rtw_read32(padapter,i)); + if((j++)%4 == 0) len += snprintf(page + len, count - len,"\n"); } *eof = 1; @@ -450,12 +450,12 @@ int proc_get_mac_reg_dump2(char *page, char **start, len += snprintf(page + len, count - len, "\n======= MAC REG =======\n"); memset(page, 0, count); for(i=0x300;i<0x600;i+=4) - { + { if(j%4==1) len += snprintf(page + len, count - len,"0x%02x",i); - len += snprintf(page + len, count - len," 0x%08x ",rtw_read32(padapter,i)); - if((j++)%4 == 0) len += snprintf(page + len, count - len,"\n"); + len += snprintf(page + len, count - len," 0x%08x ",rtw_read32(padapter,i)); + if((j++)%4 == 0) len += snprintf(page + len, count - len,"\n"); } - + *eof = 1; return len; @@ -473,10 +473,10 @@ int proc_get_mac_reg_dump3(char *page, char **start, len += snprintf(page + len, count - len, "\n======= MAC REG =======\n"); for(i=0x600;i<0x800;i+=4) - { + { if(j%4==1) len += snprintf(page + len, count - len,"0x%02x",i); - len += snprintf(page + len, count - len," 0x%08x ",rtw_read32(padapter,i)); - if((j++)%4 == 0) len += snprintf(page + len, count - len,"\n"); + len += snprintf(page + len, count - len," 0x%08x ",rtw_read32(padapter,i)); + if((j++)%4 == 0) len += snprintf(page + len, count - len,"\n"); } *eof = 1; @@ -489,19 +489,19 @@ int proc_get_bb_reg_dump1(char *page, char **start, int *eof, void *data) { struct net_device *dev = data; - struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); + struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); int len = 0; - int i,j=1; + int i,j=1; - len += snprintf(page + len, count - len, "\n======= BB REG =======\n"); + len += snprintf(page + len, count - len, "\n======= BB REG =======\n"); for(i=0x800;i<0xB00;i+=4) { - if(j%4==1) len += snprintf(page + len, count - len,"0x%02x",i); - len += snprintf(page + len, count - len," 0x%08x ",rtw_read32(padapter,i)); - if((j++)%4 == 0) len += snprintf(page + len, count - len,"\n"); + if(j%4==1) len += snprintf(page + len, count - len,"0x%02x",i); + len += snprintf(page + len, count - len," 0x%08x ",rtw_read32(padapter,i)); + if((j++)%4 == 0) len += snprintf(page + len, count - len,"\n"); } *eof = 1; - return len; + return len; } int proc_get_bb_reg_dump2(char *page, char **start, @@ -509,19 +509,19 @@ int proc_get_bb_reg_dump2(char *page, char **start, int *eof, void *data) { struct net_device *dev = data; - struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); + struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); int len = 0; - int i,j=1; + int i,j=1; - len += snprintf(page + len, count - len, "\n======= BB REG =======\n"); + len += snprintf(page + len, count - len, "\n======= BB REG =======\n"); for(i=0xB00;i<0xE00;i+=4) { - if(j%4==1) len += snprintf(page + len, count - len,"0x%02x",i); - len += snprintf(page + len, count - len," 0x%08x ",rtw_read32(padapter,i)); - if((j++)%4 == 0) len += snprintf(page + len, count - len,"\n"); + if(j%4==1) len += snprintf(page + len, count - len,"0x%02x",i); + len += snprintf(page + len, count - len," 0x%08x ",rtw_read32(padapter,i)); + if((j++)%4 == 0) len += snprintf(page + len, count - len,"\n"); } *eof = 1; - return len; + return len; } int proc_get_bb_reg_dump3(char *page, char **start, @@ -529,19 +529,19 @@ int proc_get_bb_reg_dump3(char *page, char **start, int *eof, void *data) { struct net_device *dev = data; - struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); + struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); int len = 0; - int i,j=1; + int i,j=1; - len += snprintf(page + len, count - len, "\n======= BB REG =======\n"); + len += snprintf(page + len, count - len, "\n======= BB REG =======\n"); for(i=0xE00;i<0x1000;i+=4) { - if(j%4==1) len += snprintf(page + len, count - len,"0x%02x",i); - len += snprintf(page + len, count - len," 0x%08x ",rtw_read32(padapter,i)); - if((j++)%4 == 0) len += snprintf(page + len, count - len,"\n"); + if(j%4==1) len += snprintf(page + len, count - len,"0x%02x",i); + len += snprintf(page + len, count - len," 0x%08x ",rtw_read32(padapter,i)); + if((j++)%4 == 0) len += snprintf(page + len, count - len,"\n"); } *eof = 1; - return len; + return len; } int proc_get_rf_reg_dump1(char *page, char **start, @@ -553,21 +553,21 @@ int proc_get_rf_reg_dump1(char *page, char **start, int len = 0; int i,j=1,path; u32 value; - + len += snprintf(page + len, count - len, "\n======= RF REG =======\n"); path = 1; len += snprintf(page + len, count - len, "\nRF_Path(%x)\n",path); for(i=0;i<0xC0;i++) - { + { //value = PHY_QueryRFReg(padapter, (RF90_RADIO_PATH_E)path,i, bMaskDWord); value = rtw_hal_read_rfreg(padapter, path, i, 0xffffffff); if(j%4==1) len += snprintf(page + len, count - len, "0x%02x ",i); len += snprintf(page + len, count - len, " 0x%08x ",value); - if((j++)%4==0) len += snprintf(page + len, count - len, "\n"); + if((j++)%4==0) len += snprintf(page + len, count - len, "\n"); } *eof = 1; - return len; + return len; } @@ -579,21 +579,21 @@ int proc_get_rf_reg_dump2(char *page, char **start, struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); int len = 0; int i,j=1,path; - u32 value; + u32 value; - len += snprintf(page + len, count - len, "\n======= RF REG =======\n"); + len += snprintf(page + len, count - len, "\n======= RF REG =======\n"); path = 1; len += snprintf(page + len, count - len, "\nRF_Path(%x)\n",path); for(i=0xC0;i<0x100;i++) - { + { //value = PHY_QueryRFReg(padapter, (RF90_RADIO_PATH_E)path,i, bMaskDWord); value = rtw_hal_read_rfreg(padapter, path, i, 0xffffffff); if(j%4==1) len += snprintf(page + len, count - len, "0x%02x ",i); len += snprintf(page + len, count - len, " 0x%08x ",value); - if((j++)%4==0) len += snprintf(page + len, count - len, "\n"); + if((j++)%4==0) len += snprintf(page + len, count - len, "\n"); } *eof = 1; - return len; + return len; } @@ -605,22 +605,22 @@ int proc_get_rf_reg_dump3(char *page, char **start, struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); int len = 0; int i,j=1,path; - u32 value; + u32 value; len += snprintf(page + len, count - len, "\n======= RF REG =======\n"); path = 2; len += snprintf(page + len, count - len, "\nRF_Path(%x)\n",path); for(i=0;i<0xC0;i++) - { + { //value = PHY_QueryRFReg(padapter, (RF90_RADIO_PATH_E)path,i, bMaskDWord); value = rtw_hal_read_rfreg(padapter, path, i, 0xffffffff); if(j%4==1) len += snprintf(page + len, count - len, "0x%02x ",i); len += snprintf(page + len, count - len, " 0x%08x ",value); - if((j++)%4==0) len += snprintf(page + len, count - len, "\n"); + if((j++)%4==0) len += snprintf(page + len, count - len, "\n"); } *eof = 1; - return len; + return len; } @@ -638,7 +638,7 @@ int proc_get_rf_reg_dump4(char *page, char **start, path = 2; len += snprintf(page + len, count - len, "\nRF_Path(%x)\n",path); for(i=0xC0;i<0x100;i++) - { + { //value = PHY_QueryRFReg(padapter, (RF90_RADIO_PATH_E)path,i, bMaskDWord); value = rtw_hal_read_rfreg(padapter, path, i, 0xffffffff); if(j%4==1) len += snprintf(page + len, count - len, "0x%02x ",i); @@ -646,11 +646,11 @@ int proc_get_rf_reg_dump4(char *page, char **start, if((j++)%4==0) len += snprintf(page + len, count - len, "\n"); } *eof = 1; - return len; + return len; } - - + + int proc_get_rx_signal(char *page, char **start, off_t offset, int count, int *eof, void *data) @@ -658,7 +658,7 @@ int proc_get_rx_signal(char *page, char **start, struct net_device *dev = data; struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); - + int len = 0; len += snprintf(page + len, count - len, @@ -666,14 +666,14 @@ int proc_get_rx_signal(char *page, char **start, "rxpwdb:%d\n" "signal_strength:%u\n" "signal_qual:%u\n" - "noise:%u\n", + "noise:%u\n", padapter->recvpriv.rssi, padapter->recvpriv.rxpwdb, padapter->recvpriv.signal_strength, padapter->recvpriv.signal_qual, padapter->recvpriv.noise ); - + *eof = 1; return len; } @@ -689,15 +689,15 @@ int proc_set_rx_signal(struct file *file, const char *buffer, if (count < 1) return -EFAULT; - if (buffer && !copy_from_user(tmp, buffer, sizeof(tmp))) { + if (buffer && !copy_from_user(tmp, buffer, sizeof(tmp))) { int num = sscanf(tmp, "%u %u", &is_signal_dbg, &signal_strength); is_signal_dbg = is_signal_dbg==0?0:1; - + if(is_signal_dbg && num!=2) return count; - + signal_strength = signal_strength>100?100:signal_strength; signal_strength = signal_strength<0?0:signal_strength; @@ -708,11 +708,11 @@ int proc_set_rx_signal(struct file *file, const char *buffer, DBG_871X("set %s %u\n", "DBG_SIGNAL_STRENGTH", signal_strength); else DBG_871X("set %s\n", "HW_SIGNAL_STRENGTH"); - + } - + return count; - + } #ifdef CONFIG_80211N_HT @@ -723,9 +723,9 @@ int proc_get_ht_enable(char *page, char **start, struct net_device *dev = data; struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); struct registry_priv *pregpriv = &padapter->registrypriv; - + int len = 0; - + if(pregpriv) len += snprintf(page + len, count - len, "%d\n", @@ -748,7 +748,7 @@ int proc_set_ht_enable(struct file *file, const char *buffer, if (count < 1) return -EFAULT; - if (buffer && !copy_from_user(tmp, buffer, sizeof(tmp))) { + if (buffer && !copy_from_user(tmp, buffer, sizeof(tmp))) { int num = sscanf(tmp, "%d ", &mode); @@ -758,9 +758,9 @@ int proc_set_ht_enable(struct file *file, const char *buffer, printk("ht_enable=%d\n", pregpriv->ht_enable); } } - + return count; - + } int proc_get_cbw40_enable(char *page, char **start, @@ -770,7 +770,7 @@ int proc_get_cbw40_enable(char *page, char **start, struct net_device *dev = data; struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); struct registry_priv *pregpriv = &padapter->registrypriv; - + int len = 0; if(pregpriv) @@ -795,7 +795,7 @@ int proc_set_cbw40_enable(struct file *file, const char *buffer, if (count < 1) return -EFAULT; - if (buffer && !copy_from_user(tmp, buffer, sizeof(tmp))) { + if (buffer && !copy_from_user(tmp, buffer, sizeof(tmp))) { int num = sscanf(tmp, "%d ", &mode); @@ -807,9 +807,9 @@ int proc_set_cbw40_enable(struct file *file, const char *buffer, } } - + return count; - + } int proc_get_ampdu_enable(char *page, char **start, @@ -819,7 +819,7 @@ int proc_get_ampdu_enable(char *page, char **start, struct net_device *dev = data; struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); struct registry_priv *pregpriv = &padapter->registrypriv; - + int len = 0; if(pregpriv) @@ -844,7 +844,7 @@ int proc_set_ampdu_enable(struct file *file, const char *buffer, if (count < 1) return -EFAULT; - if (buffer && !copy_from_user(tmp, buffer, sizeof(tmp))) { + if (buffer && !copy_from_user(tmp, buffer, sizeof(tmp))) { int num = sscanf(tmp, "%d ", &mode); @@ -855,9 +855,9 @@ int proc_set_ampdu_enable(struct file *file, const char *buffer, } } - + return count; - + } #endif //CONFIG_80211N_HT @@ -867,9 +867,9 @@ int proc_get_two_path_rssi(char *page, char **start, { struct net_device *dev = data; struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); - + int len = 0; - + if(padapter) len += snprintf(page + len, count - len, "%d %d\n", @@ -888,7 +888,7 @@ int proc_get_rx_stbc(char *page, char **start, struct net_device *dev = data; struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); struct registry_priv *pregpriv = &padapter->registrypriv; - + int len = 0; if(pregpriv) @@ -913,7 +913,7 @@ int proc_set_rx_stbc(struct file *file, const char *buffer, if (count < 1) return -EFAULT; - if (buffer && !copy_from_user(tmp, buffer, sizeof(tmp))) { + if (buffer && !copy_from_user(tmp, buffer, sizeof(tmp))) { int num = sscanf(tmp, "%d ", &mode); @@ -923,9 +923,9 @@ int proc_set_rx_stbc(struct file *file, const char *buffer, printk("rx_stbc=%d\n", mode); } } - + return count; - + } #endif //CONFIG_80211N_HT @@ -950,9 +950,9 @@ int proc_set_rssi_disp(struct file *file, const char *buffer, { DBG_8192C("argument size is less than 1\n"); return -EFAULT; - } + } - if (buffer && !copy_from_user(tmp, buffer, sizeof(tmp))) { + if (buffer && !copy_from_user(tmp, buffer, sizeof(tmp))) { int num = sscanf(tmp, "%x", &enable); @@ -960,25 +960,25 @@ int proc_set_rssi_disp(struct file *file, const char *buffer, DBG_8192C("invalid set_rssi_disp parameter!\n"); return count; } - + if(enable) - { + { DBG_8192C("Turn On Rx RSSI Display Function\n"); - padapter->bRxRSSIDisplay = enable ; + padapter->bRxRSSIDisplay = enable ; } else { DBG_8192C("Turn Off Rx RSSI Display Function\n"); padapter->bRxRSSIDisplay = 0 ; } - - } - - return count; - -} - + } + + return count; + +} + + #ifdef CONFIG_AP_MODE int proc_get_all_sta_info(char *page, char **start, @@ -993,18 +993,18 @@ int proc_get_all_sta_info(char *page, char **start, int i, j; _list *plist, *phead; struct recv_reorder_ctrl *preorder_ctrl; - int len = 0; - + int len = 0; + len += snprintf(page + len, count - len, "sta_dz_bitmap=0x%x, tim_bitmap=0x%x\n", pstapriv->sta_dz_bitmap, pstapriv->tim_bitmap); - + _enter_critical_bh(&pstapriv->sta_hash_lock, &irqL); for(i=0; i< NUM_STA; i++) { phead = &(pstapriv->sta_hash[i]); plist = get_next(phead); - + while ((rtw_end_of_queue_search(phead, plist)) == _FALSE) { psta = LIST_CONTAINOR(plist, struct sta_info, hash_list); @@ -1017,9 +1017,9 @@ int proc_get_all_sta_info(char *page, char **start, len += snprintf(page + len, count - len, "rtsen=%d, cts2slef=%d\n", psta->rtsen, psta->cts2self); len += snprintf(page + len, count - len, "state=0x%x, aid=%d, macid=%d, raid=%d\n", psta->state, psta->aid, psta->mac_id, psta->raid); #ifdef CONFIG_80211N_HT - len += snprintf(page + len, count - len, "qos_en=%d, ht_en=%d, init_rate=%d\n", psta->qos_option, psta->htpriv.ht_option, psta->init_rate); - len += snprintf(page + len, count - len, "bwmode=%d, ch_offset=%d, sgi=%d\n", psta->htpriv.bwmode, psta->htpriv.ch_offset, psta->htpriv.sgi); - len += snprintf(page + len, count - len, "ampdu_enable = %d\n", psta->htpriv.ampdu_enable); + len += snprintf(page + len, count - len, "qos_en=%d, ht_en=%d, init_rate=%d\n", psta->qos_option, psta->htpriv.ht_option, psta->init_rate); + len += snprintf(page + len, count - len, "bwmode=%d, ch_offset=%d, sgi=%d\n", psta->htpriv.bwmode, psta->htpriv.ch_offset, psta->htpriv.sgi); + len += snprintf(page + len, count - len, "ampdu_enable = %d\n", psta->htpriv.ampdu_enable); len += snprintf(page + len, count - len, "agg_enable_bitmap=%x, candidate_tid_bitmap=%x\n", psta->htpriv.agg_enable_bitmap, psta->htpriv.candidate_tid_bitmap); #endif //CONFIG_80211N_HT len += snprintf(page + len, count - len, "sleepq_len=%d\n", psta->sleepq_len); @@ -1030,30 +1030,30 @@ int proc_get_all_sta_info(char *page, char **start, len += snprintf(page + len, count - len, "wpa2_pairwise_cipher=0x%x\n", psta->wpa2_pairwise_cipher); len += snprintf(page + len, count - len, "qos_info=0x%x\n", psta->qos_info); len += snprintf(page + len, count - len, "dot118021XPrivacy=0x%x\n", psta->dot118021XPrivacy); - + for(j=0;j<16;j++) - { + { preorder_ctrl = &psta->recvreorder_ctrl[j]; if(preorder_ctrl->enable) { len += snprintf(page + len, count - len, "tid=%d, indicate_seq=%d\n", j, preorder_ctrl->indicate_seq); } - } - - } - + } + + } + } - + } - + _exit_critical_bh(&pstapriv->sta_hash_lock, &irqL); *eof = 1; return len; } - -#endif + +#endif #ifdef DBG_MEMORY_LEAK #include @@ -1064,12 +1064,12 @@ int proc_get_malloc_cnt(char *page, char **start, off_t offset, int count, int *eof, void *data) { - + int len = 0; len += snprintf(page + len, count - len, "_malloc_cnt=%d\n", atomic_read(&_malloc_cnt)); len += snprintf(page + len, count - len, "_malloc_size=%d\n", atomic_read(&_malloc_size)); - + *eof = 1; return len; } @@ -1091,8 +1091,8 @@ int proc_get_best_channel(char *page, char **start, index_24G = i; if ( pmlmeext->channel_set[i].ChannelNum == 36) index_5G = i; - } - + } + for (i=0; pmlmeext->channel_set[i].ChannelNum !=0; i++) { // 2.4G if ( pmlmeext->channel_set[i].ChannelNum == 6 ) { @@ -1123,11 +1123,11 @@ int proc_get_best_channel(char *page, char **start, } } #if 1 // debug - len += snprintf(page + len, count - len, "The rx cnt of channel %3d = %d\n", + len += snprintf(page + len, count - len, "The rx cnt of channel %3d = %d\n", pmlmeext->channel_set[i].ChannelNum, pmlmeext->channel_set[i].rx_count); #endif } - + len += snprintf(page + len, count - len, "best_channel_5G = %d\n", best_channel_5G); len += snprintf(page + len, count - len, "best_channel_24G = %d\n", best_channel_24G); @@ -1208,9 +1208,9 @@ int proc_set_btcoex_dbg(struct file *file, const char *buffer, printk("btcoex_dbg=%d\n", BTCoexDbgLevel); } } - + return count; - + } #endif /* CONFIG_BT_COEXIST */ @@ -1221,9 +1221,9 @@ int proc_get_sreset(char *page, char **start, off_t offset, int count, int *eof, struct net_device *dev = data; struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); - + int len = 0; - + *eof = 1; return len; } @@ -1238,7 +1238,7 @@ int proc_set_sreset(struct file *file, const char *buffer, unsigned long count, if (count < 1) return -EFAULT; - if (buffer && !copy_from_user(tmp, buffer, sizeof(tmp))) { + if (buffer && !copy_from_user(tmp, buffer, sizeof(tmp))) { int num = sscanf(tmp, "%d", &trigger_point); @@ -1247,9 +1247,9 @@ int proc_set_sreset(struct file *file, const char *buffer, unsigned long count, else sreset_set_trigger_point(padapter, trigger_point); } - + return count; - + } #endif /* DBG_CONFIG_ERROR_DETECT */ @@ -1362,9 +1362,8 @@ int proc_set_odm_adaptivity(struct file *file, const char *buffer, unsigned long rtw_odm_adaptivity_parm_set(padapter, (s8)TH_L2H_ini, TH_EDCCA_HL_diff, (s8)IGI_Base, (bool)ForceEDCCA, AdapEn_RSSI, IGI_LowerBound); } - + return count; } #endif - diff --git a/core/rtw_eeprom.c b/core/rtw_eeprom.c index e53b614..2af9b6e 100755 --- a/core/rtw_eeprom.c +++ b/core/rtw_eeprom.c @@ -1,7 +1,7 @@ /****************************************************************************** * * 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. @@ -31,7 +31,7 @@ _func_enter_; rtw_udelay_os(CLOCK_RATE); _func_exit_; - + } void down_clk(_adapter * padapter, u16 *x ) @@ -40,7 +40,7 @@ _func_enter_; *x = *x & ~_EESK; rtw_write8(padapter, EE_9346CR, (u8)*x); rtw_udelay_os(CLOCK_RATE); -_func_exit_; +_func_exit_; } void shift_out_bits(_adapter * padapter, u16 data, u16 count) @@ -78,14 +78,14 @@ _func_enter_; } x &= ~_EEDI; rtw_write8(padapter, EE_9346CR, (u8)x); -out: -_func_exit_; +out: +_func_exit_; } u16 shift_in_bits (_adapter * padapter) { u16 x,d=0,i; -_func_enter_; +_func_enter_; if(padapter->bSurpriseRemoved==_TRUE){ RT_TRACE(_module_rtl871x_eeprom_c_,_drv_err_,("padapter->bSurpriseRemoved==_TRUE")); goto out; @@ -111,8 +111,8 @@ _func_enter_; down_clk(padapter, &x); } -out: -_func_exit_; +out: +_func_exit_; return d; } @@ -120,7 +120,7 @@ _func_exit_; void standby(_adapter * padapter ) { u8 x; -_func_enter_; +_func_enter_; x = rtw_read8(padapter, EE_9346CR); x &= ~(_EECS | _EESK); @@ -130,16 +130,16 @@ _func_enter_; x |= _EECS; rtw_write8(padapter, EE_9346CR, x); rtw_udelay_os(CLOCK_RATE); -_func_exit_; +_func_exit_; } u16 wait_eeprom_cmd_done(_adapter* padapter) { - u8 x; + u8 x; u16 i,res=_FALSE; -_func_enter_; +_func_enter_; standby(padapter ); - for (i=0; i<200; i++) + for (i=0; i<200; i++) { x = rtw_read8(padapter, EE_9346CR); if (x & _EEDO){ @@ -148,15 +148,15 @@ _func_enter_; } rtw_udelay_os(CLOCK_RATE); } -exit: -_func_exit_; +exit: +_func_exit_; return res; } void eeprom_clean(_adapter * padapter) { u16 x; -_func_enter_; +_func_enter_; if(padapter->bSurpriseRemoved==_TRUE){ RT_TRACE(_module_rtl871x_eeprom_c_,_drv_err_,("padapter->bSurpriseRemoved==_TRUE")); goto out; @@ -178,15 +178,15 @@ _func_enter_; goto out; } down_clk(padapter, &x); -out: -_func_exit_; +out: +_func_exit_; } void eeprom_write16(_adapter * padapter, u16 reg, u16 data) { u8 x; -_func_enter_; - +_func_enter_; + x = rtw_read8(padapter, EE_9346CR); x &= ~(_EEDI | _EEDO | _EESK | _EEM0); @@ -194,12 +194,12 @@ _func_enter_; rtw_write8(padapter, EE_9346CR, x); shift_out_bits(padapter, EEPROM_EWEN_OPCODE, 5); - + if(padapter->EepromAddressSize==8) //CF+ and SDIO shift_out_bits(padapter, 0, 6); else //USB shift_out_bits(padapter, 0, 4); - + standby( padapter); // Commented out by rcnjko, 2004.0 @@ -208,7 +208,7 @@ _func_enter_; // shift_out_bits(Adapter, EEPROM_ERASE_OPCODE, 3); // shift_out_bits(Adapter, reg, Adapter->EepromAddressSize); // -// if (wait_eeprom_cmd_done(Adapter ) == FALSE) +// if (wait_eeprom_cmd_done(Adapter ) == FALSE) // { // return; // } @@ -227,7 +227,7 @@ _func_enter_; // write the data to the selected EEPROM word. shift_out_bits(padapter, data, 16); - if (wait_eeprom_cmd_done(padapter ) == _FALSE) + if (wait_eeprom_cmd_done(padapter ) == _FALSE) { goto exit; @@ -239,8 +239,8 @@ _func_enter_; shift_out_bits(padapter, reg, 4); eeprom_clean(padapter ); -exit: -_func_exit_; +exit: +_func_exit_; return; } @@ -249,7 +249,7 @@ u16 eeprom_read16(_adapter * padapter, u16 reg) //ReadEEprom u16 x; u16 data=0; -_func_enter_; +_func_enter_; if(padapter->bSurpriseRemoved==_TRUE){ RT_TRACE(_module_rtl871x_eeprom_c_,_drv_err_,("padapter->bSurpriseRemoved==_TRUE")); @@ -276,8 +276,8 @@ _func_enter_; data = shift_in_bits(padapter); eeprom_clean(padapter); -out: -_func_exit_; +out: +_func_exit_; return data; } @@ -285,12 +285,12 @@ _func_exit_; //From even offset -void eeprom_read_sz(_adapter * padapter, u16 reg, u8* data, u32 sz) +void eeprom_read_sz(_adapter * padapter, u16 reg, u8* data, u32 sz) { u16 x, data16; u32 i; -_func_enter_; +_func_enter_; if(padapter->bSurpriseRemoved==_TRUE){ RT_TRACE(_module_rtl871x_eeprom_c_,_drv_err_,("padapter->bSurpriseRemoved==_TRUE")); goto out; @@ -317,12 +317,12 @@ _func_enter_; { data16 = shift_in_bits(padapter); data[i] = data16 & 0xff; - data[i+1] = data16 >>8; + data[i+1] = data16 >>8; } eeprom_clean(padapter); -out: -_func_exit_; +out: +_func_exit_; @@ -334,7 +334,7 @@ u8 eeprom_read(_adapter * padapter, u32 addr_off, u8 sz, u8* rbuf) { u8 quotient, remainder, addr_2align_odd; u16 reg, stmp , i=0, idx = 0; -_func_enter_; +_func_enter_; reg = (u16)(addr_off >> 1); addr_2align_odd = (u8)(addr_off & 0x1); @@ -344,7 +344,7 @@ _func_enter_; rbuf[idx++] = (u8) ((stmp>>8)&0xff); //return hogh-part of the short reg++; sz--; } - + quotient = sz >> 1; remainder = sz & 0x1; @@ -354,13 +354,13 @@ _func_enter_; rbuf[idx++] = (u8) (stmp&0xff); rbuf[idx++] = (u8) ((stmp>>8)&0xff); } - + reg = reg+i; if(remainder){ //end of read at lower part of short : 0,2,4,6,... stmp = eeprom_read16(padapter, reg); - rbuf[idx] = (u8)(stmp & 0xff); + rbuf[idx] = (u8)(stmp & 0xff); } -_func_exit_; +_func_exit_; return _TRUE; } @@ -369,9 +369,8 @@ _func_exit_; VOID read_eeprom_content(_adapter * padapter) { -_func_enter_; +_func_enter_; -_func_exit_; +_func_exit_; } - diff --git a/core/rtw_efuse.c b/core/rtw_efuse.c index c2c48b8..4d0d438 100755 --- a/core/rtw_efuse.c +++ b/core/rtw_efuse.c @@ -1,7 +1,7 @@ /****************************************************************************** * * 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. @@ -77,12 +77,12 @@ BOOLEAN Efuse_Write1ByteToFakeContent( IN struct adapter *pAdapter, IN u16 Offset, - IN u8 Value ); + IN u8 Value ); BOOLEAN Efuse_Write1ByteToFakeContent( IN struct adapter *pAdapter, IN u16 Offset, - IN u8 Value ) + IN u8 Value ) { if(Offset >= EFUSE_MAX_HW_SIZE) { @@ -100,7 +100,7 @@ Efuse_Write1ByteToFakeContent( /*----------------------------------------------------------------------------- * Function: Efuse_PowerSwitch * - * Overview: When we want to enable write operation, we should change to + * Overview: When we want to enable write operation, we should change to * pwr on state. When we stop write, we should switch to 500k mode * and disable LDO 2.5V. * @@ -112,7 +112,7 @@ Efuse_Write1ByteToFakeContent( * * Revised History: * When Who Remark - * 11/17/2008 MHC Create Version 0. + * 11/17/2008 MHC Create Version 0. * *---------------------------------------------------------------------------*/ VOID @@ -122,7 +122,7 @@ Efuse_PowerSwitch( IN u8 PwrState) { pAdapter->HalFunc.EfusePowerSwitch(pAdapter, bWrite, PwrState); -} +} /*----------------------------------------------------------------------------- * Function: efuse_GetCurrentSize @@ -137,7 +137,7 @@ Efuse_PowerSwitch( * * Revised History: * When Who Remark - * 11/16/2008 MHC Create Version 0. + * 11/16/2008 MHC Create Version 0. * *---------------------------------------------------------------------------*/ u16 @@ -179,9 +179,9 @@ Efuse_CalculateWordCnts(IN u8 word_en) VOID ReadEFuseByte( struct adapter *Adapter, - u16 _offset, - u8 *pbuf, - IN BOOLEAN bPseudoTest) + u16 _offset, + u8 *pbuf, + IN BOOLEAN bPseudoTest) { u32 value32; u8 readbyte; @@ -195,14 +195,14 @@ ReadEFuseByte( } //Write Address - rtw_write8(Adapter, EFUSE_CTRL+1, (_offset & 0xff)); + rtw_write8(Adapter, EFUSE_CTRL+1, (_offset & 0xff)); readbyte = rtw_read8(Adapter, EFUSE_CTRL+2); - rtw_write8(Adapter, EFUSE_CTRL+2, ((_offset >> 8) & 0x03) | (readbyte & 0xfc)); + rtw_write8(Adapter, EFUSE_CTRL+2, ((_offset >> 8) & 0x03) | (readbyte & 0xfc)); //Write bit 32 0 - readbyte = rtw_read8(Adapter, EFUSE_CTRL+3); - rtw_write8(Adapter, EFUSE_CTRL+3, (readbyte & 0x7f)); - + readbyte = rtw_read8(Adapter, EFUSE_CTRL+3); + rtw_write8(Adapter, EFUSE_CTRL+3, (readbyte & 0x7f)); + //Check bit 32 read-ready retry = 0; value32 = rtw_read32(Adapter, EFUSE_CTRL); @@ -219,16 +219,16 @@ ReadEFuseByte( // result will always stay on last data we read. rtw_udelay_os(50); value32 = rtw_read32(Adapter, EFUSE_CTRL); - + *pbuf = (u8)(value32 & 0xff); //DBG_871X("ReadEFuseByte _offset:%08u, in %d ms\n",_offset ,rtw_get_passing_time_ms(start)); - + } // // Description: -// 1. Execute E-Fuse read byte operation according as map offset and +// 1. Execute E-Fuse read byte operation according as map offset and // save to E-Fuse table. // 2. Refered from SD1 Richard. // @@ -238,7 +238,7 @@ ReadEFuseByte( // // Created by Roger, 2008.10.21. // -// 2008/12/12 MH 1. Reorganize code flow and reserve bytes. and add description. +// 2008/12/12 MH 1. Reorganize code flow and reserve bytes. and add description. // 2. Add efuse utilization collect. // 2008/12/22 MH Read Efuse must check if we write section 1 data again!!! Sec1 // write addr must be after sec5. @@ -249,8 +249,8 @@ efuse_ReadEFuse( struct adapter *Adapter, u8 efuseType, u16 _offset, - u16 _size_byte, - u8 *pbuf, + u16 _size_byte, + u8 *pbuf, IN BOOLEAN bPseudoTest ); VOID @@ -258,8 +258,8 @@ efuse_ReadEFuse( struct adapter *Adapter, u8 efuseType, u16 _offset, - u16 _size_byte, - u8 *pbuf, + u16 _size_byte, + u8 *pbuf, IN BOOLEAN bPseudoTest ) { @@ -291,12 +291,12 @@ EFUSE_GetEfuseDefinition( * * Revised History: * When Who Remark - * 09/23/2008 MHC Copy from WMAC. + * 09/23/2008 MHC Copy from WMAC. * *---------------------------------------------------------------------------*/ u8 -EFUSE_Read1Byte( - IN struct adapter *Adapter, +EFUSE_Read1Byte( + IN struct adapter *Adapter, IN u16 Address) { u8 data; @@ -310,12 +310,12 @@ EFUSE_Read1Byte( if (Address < contentLen) //E-fuse 512Byte { //Write E-fuse Register address bit0~7 - temp = Address & 0xFF; - rtw_write8(Adapter, EFUSE_CTRL+1, temp); - Bytetemp = rtw_read8(Adapter, EFUSE_CTRL+2); + temp = Address & 0xFF; + rtw_write8(Adapter, EFUSE_CTRL+1, temp); + Bytetemp = rtw_read8(Adapter, EFUSE_CTRL+2); //Write E-fuse Register address bit8~9 - temp = ((Address >> 8) & 0x03) | (Bytetemp & 0xFC); - rtw_write8(Adapter, EFUSE_CTRL+2, temp); + temp = ((Address >> 8) & 0x03) | (Bytetemp & 0xFC); + rtw_write8(Adapter, EFUSE_CTRL+2, temp); //Write 0x30[31]=0 Bytetemp = rtw_read8(Adapter, EFUSE_CTRL+3); @@ -325,7 +325,7 @@ EFUSE_Read1Byte( //Wait Write-ready (0x30[31]=1) Bytetemp = rtw_read8(Adapter, EFUSE_CTRL+3); while(!(Bytetemp & 0x80)) - { + { Bytetemp = rtw_read8(Adapter, EFUSE_CTRL+3); k++; if(k==1000) @@ -339,7 +339,7 @@ EFUSE_Read1Byte( } else return 0xFF; - + }/* EFUSE_Read1Byte */ /*----------------------------------------------------------------------------- @@ -355,18 +355,18 @@ EFUSE_Read1Byte( * * Revised History: * When Who Remark - * 09/23/2008 MHC Copy from WMAC. + * 09/23/2008 MHC Copy from WMAC. * *---------------------------------------------------------------------------*/ -void -EFUSE_Write1Byte( - IN struct adapter *Adapter, +void +EFUSE_Write1Byte( + IN struct adapter *Adapter, IN u16 Address, IN u8 Value); -void -EFUSE_Write1Byte( - IN struct adapter *Adapter, +void +EFUSE_Write1Byte( + IN struct adapter *Adapter, IN u16 Address, IN u8 Value) { @@ -383,13 +383,13 @@ EFUSE_Write1Byte( rtw_write8(Adapter, EFUSE_CTRL, Value); //Write E-fuse Register address bit0~7 - temp = Address & 0xFF; - rtw_write8(Adapter, EFUSE_CTRL+1, temp); - Bytetemp = rtw_read8(Adapter, EFUSE_CTRL+2); - + temp = Address & 0xFF; + rtw_write8(Adapter, EFUSE_CTRL+1, temp); + Bytetemp = rtw_read8(Adapter, EFUSE_CTRL+2); + //Write E-fuse Register address bit8~9 - temp = ((Address >> 8) & 0x03) | (Bytetemp & 0xFC); - rtw_write8(Adapter, EFUSE_CTRL+2, temp); + temp = ((Address >> 8) & 0x03) | (Bytetemp & 0xFC); + rtw_write8(Adapter, EFUSE_CTRL+2, temp); //Write 0x30[31]=1 Bytetemp = rtw_read8(Adapter, EFUSE_CTRL+3); @@ -400,7 +400,7 @@ EFUSE_Write1Byte( Bytetemp = rtw_read8(Adapter, EFUSE_CTRL+3); while(Bytetemp & 0x80) { - Bytetemp = rtw_read8(Adapter, EFUSE_CTRL+3); + Bytetemp = rtw_read8(Adapter, EFUSE_CTRL+3); k++; if(k==100) { @@ -414,7 +414,7 @@ EFUSE_Write1Byte( /* 11/16/2008 MH Read one byte from real Efuse. */ u8 efuse_OneByteRead( - IN struct adapter *pAdapter, + IN struct adapter *pAdapter, IN u16 addr, IN u8 *data, IN BOOLEAN bPseudoTest) @@ -428,35 +428,35 @@ efuse_OneByteRead( return bResult; } // -----------------e-fuse reg ctrl --------------------------------- - //address - rtw_write8(pAdapter, EFUSE_CTRL+1, (u8)(addr&0xff)); - rtw_write8(pAdapter, EFUSE_CTRL+2, ((u8)((addr>>8) &0x03) ) | - (rtw_read8(pAdapter, EFUSE_CTRL+2)&0xFC )); + //address + rtw_write8(pAdapter, EFUSE_CTRL+1, (u8)(addr&0xff)); + rtw_write8(pAdapter, EFUSE_CTRL+2, ((u8)((addr>>8) &0x03) ) | + (rtw_read8(pAdapter, EFUSE_CTRL+2)&0xFC )); - rtw_write8(pAdapter, EFUSE_CTRL+3, 0x72);//read cmd + rtw_write8(pAdapter, EFUSE_CTRL+3, 0x72);//read cmd while(!(0x80 &rtw_read8(pAdapter, EFUSE_CTRL+3))&&(tmpidx<100)) { tmpidx++; } if(tmpidx<100) - { - *data=rtw_read8(pAdapter, EFUSE_CTRL); + { + *data=rtw_read8(pAdapter, EFUSE_CTRL); bResult = _TRUE; } else { - *data = 0xff; + *data = 0xff; bResult = _FALSE; } return bResult; } - + /* 11/16/2008 MH Write one byte to reald Efuse. */ u8 efuse_OneByteWrite( - IN struct adapter *pAdapter, - IN u16 addr, + IN struct adapter *pAdapter, + IN u16 addr, IN u8 data, IN BOOLEAN bPseudoTest) { @@ -472,29 +472,29 @@ efuse_OneByteWrite( //return 0; - // -----------------e-fuse reg ctrl --------------------------------- - //address + // -----------------e-fuse reg ctrl --------------------------------- + //address rtw_write8(pAdapter, EFUSE_CTRL+1, (u8)(addr&0xff)); - rtw_write8(pAdapter, EFUSE_CTRL+2, - (rtw_read8(pAdapter, EFUSE_CTRL+2)&0xFC )|(u8)((addr>>8)&0x03) ); - rtw_write8(pAdapter, EFUSE_CTRL, data);//data + rtw_write8(pAdapter, EFUSE_CTRL+2, + (rtw_read8(pAdapter, EFUSE_CTRL+2)&0xFC )|(u8)((addr>>8)&0x03) ); + rtw_write8(pAdapter, EFUSE_CTRL, data);//data rtw_write8(pAdapter, EFUSE_CTRL+3, 0xF2);//write cmd - + while((0x80 & rtw_read8(pAdapter, EFUSE_CTRL+3)) && (tmpidx<100) ){ tmpidx++; } - + if(tmpidx<100) - { + { bResult = _TRUE; } else - { + { bResult = _FALSE; - } - - return bResult; + } + + return bResult; } int @@ -510,9 +510,9 @@ Efuse_PgPacketRead( IN struct adapter *pAdapter, return ret; } -int -Efuse_PgPacketWrite(IN struct adapter *pAdapter, - IN u8 offset, +int +Efuse_PgPacketWrite(IN struct adapter *pAdapter, + IN u8 offset, IN u8 word_en, IN u8 *data, IN BOOLEAN bPseudoTest) @@ -525,9 +525,9 @@ Efuse_PgPacketWrite(IN struct adapter *pAdapter, } -int -Efuse_PgPacketWrite_BT(IN struct adapter *pAdapter, - IN u8 offset, +int +Efuse_PgPacketWrite_BT(IN struct adapter *pAdapter, + IN u8 offset, IN u8 word_en, IN u8 *data, IN BOOLEAN bPseudoTest) @@ -552,15 +552,15 @@ Efuse_PgPacketWrite_BT(IN struct adapter *pAdapter, * * Revised History: * When Who Remark - * 11/16/2008 MHC Create Version 0. - * 11/21/2008 MHC Fix Write bug when we only enable late word. + * 11/16/2008 MHC Create Version 0. + * 11/21/2008 MHC Fix Write bug when we only enable late word. * *---------------------------------------------------------------------------*/ void efuse_WordEnableDataRead(IN u8 word_en, IN u8 *sourdata, IN u8 *targetdata) -{ +{ if (!(word_en&BIT(0))) { targetdata[0] = sourdata[0]; @@ -587,14 +587,14 @@ efuse_WordEnableDataRead(IN u8 word_en, u8 Efuse_WordEnableDataWrite( IN struct adapter *pAdapter, IN u16 efuse_addr, - IN u8 word_en, + IN u8 word_en, IN u8 *data, IN BOOLEAN bPseudoTest) { u8 ret=0; ret = pAdapter->HalFunc.Efuse_WordEnableDataWrite(pAdapter, efuse_addr, word_en, data, bPseudoTest); - + return ret; } @@ -911,18 +911,18 @@ exit: * * Revised History: * When Who Remark - * 11/11/2008 MHC Create Version 0. + * 11/11/2008 MHC Create Version 0. * *---------------------------------------------------------------------------*/ -VOID +VOID Efuse_ReadAllMap( - IN struct adapter *pAdapter, + IN struct adapter *pAdapter, IN u8 efuseType, IN OUT u8 *Efuse, IN BOOLEAN bPseudoTest); -VOID +VOID Efuse_ReadAllMap( - IN struct adapter *pAdapter, + IN struct adapter *pAdapter, IN u8 efuseType, IN OUT u8 *Efuse, IN BOOLEAN bPseudoTest) @@ -953,7 +953,7 @@ Efuse_ReadAllMap( * * Revised History: * When Who Remark - * 11/12/2008 MHC Create Version 0. + * 11/12/2008 MHC Create Version 0. * *---------------------------------------------------------------------------*/ static VOID @@ -1014,7 +1014,7 @@ efuse_ShadowRead4Byte( * * Revised History: * When Who Remark - * 11/12/2008 MHC Create Version 0. + * 11/12/2008 MHC Create Version 0. * *---------------------------------------------------------------------------*/ #ifdef PLATFORM @@ -1022,13 +1022,13 @@ static VOID efuse_ShadowWrite1Byte( IN struct adapter *pAdapter, IN u16 Offset, - IN u8 Value); + IN u8 Value); #endif //PLATFORM static VOID efuse_ShadowWrite1Byte( IN struct adapter *pAdapter, IN u16 Offset, - IN u8 Value) + IN u8 Value) { EEPROM_EFUSE_PRIV *pEEPROM = GET_EEPROM_EFUSE_PRIV(pAdapter); @@ -1041,7 +1041,7 @@ static VOID efuse_ShadowWrite2Byte( IN struct adapter *pAdapter, IN u16 Offset, - IN u16 Value) + IN u16 Value) { EEPROM_EFUSE_PRIV *pEEPROM = GET_EEPROM_EFUSE_PRIV(pAdapter); @@ -1079,7 +1079,7 @@ efuse_ShadowWrite4Byte( * * Revised History: * When Who Remark - * 11/13/2008 MHC Create Version 0. + * 11/13/2008 MHC Create Version 0. * *---------------------------------------------------------------------------*/ void EFUSE_ShadowMapUpdate( @@ -1098,19 +1098,19 @@ void EFUSE_ShadowMapUpdate( } else { - #ifdef CONFIG_ADAPTOR_INFO_CACHING_FILE + #ifdef CONFIG_ADAPTOR_INFO_CACHING_FILE if(_SUCCESS != retriveAdaptorInfoFile(pAdapter->registrypriv.adaptor_info_caching_file_path, pEEPROM)) { #endif - + Efuse_ReadAllMap(pAdapter, efuseType, pEEPROM->efuse_eeprom_data, bPseudoTest); - + #ifdef CONFIG_ADAPTOR_INFO_CACHING_FILE storeAdaptorInfoFile(pAdapter->registrypriv.adaptor_info_caching_file_path, pEEPROM); } #endif } - //PlatformMoveMemory((PVOID)&pHalData->EfuseMap[EFUSE_MODIFY_MAP][0], + //PlatformMoveMemory((PVOID)&pHalData->EfuseMap[EFUSE_MODIFY_MAP][0], //(PVOID)&pHalData->EfuseMap[EFUSE_INIT_MAP][0], mapLen); }// EFUSE_ShadowMapUpdate @@ -1128,7 +1128,7 @@ void EFUSE_ShadowMapUpdate( * * Revised History: * When Who Remark - * 11/12/2008 MHC Create Version 0. + * 11/12/2008 MHC Create Version 0. * *---------------------------------------------------------------------------*/ void @@ -1144,7 +1144,7 @@ EFUSE_ShadowRead( efuse_ShadowRead2Byte(pAdapter, Offset, (u16 *)Value); else if (Type == 4) efuse_ShadowRead4Byte(pAdapter, Offset, (u32 *)Value); - + } // EFUSE_ShadowRead /*----------------------------------------------------------------------------- @@ -1160,7 +1160,7 @@ EFUSE_ShadowRead( * * Revised History: * When Who Remark - * 11/12/2008 MHC Create Version 0. + * 11/12/2008 MHC Create Version 0. * *---------------------------------------------------------------------------*/ VOID @@ -1202,7 +1202,7 @@ Efuse_InitSomeVar( ) { u8 i; - + _rtw_memset((PVOID)&fakeEfuseContent[0], 0xff, EFUSE_MAX_HW_SIZE); _rtw_memset((PVOID)&fakeEfuseInitMap[0], 0xff, EFUSE_MAX_MAP_LEN); _rtw_memset((PVOID)&fakeEfuseModifiedMap[0], 0xff, EFUSE_MAX_MAP_LEN); @@ -1252,24 +1252,24 @@ int retriveAdaptorInfoFile(char *path, struct eeprom_priv * eeprom_priv) int ret = _SUCCESS; mm_segment_t oldfs; struct file *fp; - + if(path && eeprom_priv) { ret = rtw_retrive_from_file(path, eeprom_priv->efuse_eeprom_data, EEPROM_MAX_SIZE); - + if(ret == EEPROM_MAX_SIZE) ret = _SUCCESS; else ret = _FAIL; #if 0 - if(isAdaptorInfoFileValid()) { + if(isAdaptorInfoFileValid()) { return 0; } else { return _FAIL; } #endif - + } else { DBG_871X("%s NULL pointer\n",__FUNCTION__); ret = _FAIL; diff --git a/core/rtw_ieee80211.c b/core/rtw_ieee80211.c index 33785c5..8b127e0 100755 --- a/core/rtw_ieee80211.c +++ b/core/rtw_ieee80211.c @@ -1,7 +1,7 @@ /****************************************************************************** * * 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. @@ -47,16 +47,16 @@ u8 RSN_CIPHER_SUITE_WRAP[] = { 0x00, 0x0f, 0xac, 3 }; u8 RSN_CIPHER_SUITE_CCMP[] = { 0x00, 0x0f, 0xac, 4 }; u8 RSN_CIPHER_SUITE_WEP104[] = { 0x00, 0x0f, 0xac, 5 }; //----------------------------------------------------------- -// for adhoc-master to generate ie and provide supported-rate to fw +// for adhoc-master to generate ie and provide supported-rate to fw //----------------------------------------------------------- -static u8 WIFI_CCKRATES[] = +static u8 WIFI_CCKRATES[] = {(IEEE80211_CCK_RATE_1MB | IEEE80211_BASIC_RATE_MASK), (IEEE80211_CCK_RATE_2MB | IEEE80211_BASIC_RATE_MASK), (IEEE80211_CCK_RATE_5MB | IEEE80211_BASIC_RATE_MASK), (IEEE80211_CCK_RATE_11MB | IEEE80211_BASIC_RATE_MASK)}; -static u8 WIFI_OFDMRATES[] = +static u8 WIFI_OFDMRATES[] = {(IEEE80211_OFDM_RATE_6MB), (IEEE80211_OFDM_RATE_9MB), (IEEE80211_OFDM_RATE_12MB), @@ -81,17 +81,17 @@ int rtw_get_bit_value_from_ieee_value(u8 val) } uint rtw_is_cckrates_included(u8 *rate) -{ - u32 i = 0; +{ + u32 i = 0; while(rate[i]!=0) - { - if ( (((rate[i]) & 0x7f) == 2) || (((rate[i]) & 0x7f) == 4) || - (((rate[i]) & 0x7f) == 11) || (((rate[i]) & 0x7f) == 22) ) - return _TRUE; + { + if ( (((rate[i]) & 0x7f) == 2) || (((rate[i]) & 0x7f) == 4) || + (((rate[i]) & 0x7f) == 11) || (((rate[i]) & 0x7f) == 22) ) + return _TRUE; i++; } - + return _FALSE; } @@ -105,11 +105,11 @@ uint rtw_is_cckratesonly_included(u8 *rate) if ( (((rate[i]) & 0x7f) != 2) && (((rate[i]) & 0x7f) != 4) && (((rate[i]) & 0x7f) != 11) && (((rate[i]) & 0x7f) != 22) ) - return _FALSE; + return _FALSE; i++; } - + return _TRUE; } @@ -122,17 +122,17 @@ int rtw_check_network_type(unsigned char *rate, int ratelen, int channel) return WIRELESS_INVALID; else return WIRELESS_11A; - } + } else // could be pure B, pure G, or B/G { - if ((rtw_is_cckratesonly_included(rate)) == _TRUE) + if ((rtw_is_cckratesonly_included(rate)) == _TRUE) return WIRELESS_11B; else if((rtw_is_cckrates_included(rate)) == _TRUE) - return WIRELESS_11BG; + return WIRELESS_11BG; else return WIRELESS_11G; } - + } u8 *rtw_set_fixed_ie(unsigned char *pbuf, unsigned int len, unsigned char *source, @@ -146,10 +146,10 @@ u8 *rtw_set_fixed_ie(unsigned char *pbuf, unsigned int len, unsigned char *sourc // rtw_set_ie will update frame length u8 *rtw_set_ie ( - u8 *pbuf, - sint index, + u8 *pbuf, + sint index, uint len, - u8 *source, + u8 *source, uint *frlen //frame length ) { @@ -160,11 +160,11 @@ _func_enter_; if (len > 0) _rtw_memcpy((void *)(pbuf + 2), (void *)source, len); - + *frlen = *frlen + (len + 2); - + return (pbuf + len + 2); -_func_exit_; +_func_exit_; } inline u8 *rtw_set_ie_ch_switch(u8 *buf, u32 *buf_len, u8 ch_switch_mode, @@ -229,7 +229,7 @@ u8 *rtw_get_ie(u8 *pbuf, sint index, sint *len, sint limit) u8 *p; _func_enter_; if (limit < 1){ - _func_exit_; + _func_exit_; return NULL; } @@ -252,7 +252,7 @@ _func_enter_; if (i >= limit) break; } -_func_exit_; +_func_exit_; return NULL; } @@ -291,7 +291,7 @@ u8 *rtw_get_ie_ex(u8 *in_ie, uint in_len, u8 eid, u8 *oui, u8 oui_len, u8 *ie, u if(ie) _rtw_memcpy(ie, &in_ie[cnt], in_ie[cnt+1]+2); - + if(ielen) *ielen = in_ie[cnt+1]+2; @@ -299,10 +299,10 @@ u8 *rtw_get_ie_ex(u8 *in_ie, uint in_len, u8 eid, u8 *oui, u8 oui_len, u8 *ie, u } else { - cnt+=in_ie[cnt+1]+2; //goto next - } + cnt+=in_ie[cnt+1]+2; //goto next + } - } + } return target_ie; } @@ -325,7 +325,7 @@ int rtw_ies_remove_ie(u8 *ies, uint *ies_len, uint offset, u8 eid, u8 *oui, u8 o u32 target_ielen; u8 *start; uint search_len; - + if(!ies || !ies_len || *ies_len <= offset) goto exit; @@ -338,7 +338,7 @@ int rtw_ies_remove_ie(u8 *ies, uint *ies_len, uint offset, u8 eid, u8 *oui, u8 o u8 buf[MAX_IE_SZ] = {0}; u8 *remain_ies = target_ie + target_ielen; uint remain_len = search_len - (remain_ies - start); - + _rtw_memcpy(buf, remain_ies, remain_len); _rtw_memcpy(target_ie, buf, remain_len); *ies_len = *ies_len - target_ielen; @@ -354,25 +354,25 @@ exit: return ret; } -void rtw_set_supported_rate(u8* SupportedRates, uint mode) +void rtw_set_supported_rate(u8* SupportedRates, uint mode) { _func_enter_; _rtw_memset(SupportedRates, 0, NDIS_802_11_LENGTH_RATES_EX); - + switch (mode) { case WIRELESS_11B: _rtw_memcpy(SupportedRates, WIFI_CCKRATES, IEEE80211_CCK_RATE_LEN); break; - + case WIRELESS_11G: case WIRELESS_11A: case WIRELESS_11_5N: case WIRELESS_11A_5N://Todo: no basic rate for ofdm ? _rtw_memcpy(SupportedRates, WIFI_OFDMRATES, IEEE80211_NUM_OFDM_RATESLEN); break; - + case WIRELESS_11BG: case WIRELESS_11G_24N: case WIRELESS_11_24N: @@ -380,64 +380,64 @@ _func_enter_; _rtw_memcpy(SupportedRates, WIFI_CCKRATES, IEEE80211_CCK_RATE_LEN); _rtw_memcpy(SupportedRates + IEEE80211_CCK_RATE_LEN, WIFI_OFDMRATES, IEEE80211_NUM_OFDM_RATESLEN); break; - + } -_func_exit_; +_func_exit_; } uint rtw_get_rateset_len(u8 *rateset) { uint i = 0; -_func_enter_; +_func_enter_; while(1) { if ((rateset[i]) == 0) break; - + if (i > 12) break; - - i++; + + i++; } -_func_exit_; +_func_exit_; return i; } int rtw_generate_ie(struct registry_priv *pregistrypriv) { u8 wireless_mode; - int sz = 0, rateLen; + int sz = 0, rateLen; WLAN_BSSID_EX* pdev_network = &pregistrypriv->dev_network; u8* ie = pdev_network->IEs; - -_func_enter_; + +_func_enter_; //timestamp will be inserted by hardware - sz += 8; + sz += 8; ie += sz; - + //beacon interval : 2bytes *(u16*)ie = cpu_to_le16((u16)pdev_network->Configuration.BeaconPeriod);//BCN_INTERVAL; - sz += 2; + sz += 2; ie += 2; - + //capability info *(u16*)ie = 0; - + *(u16*)ie |= cpu_to_le16(cap_IBSS); if(pregistrypriv->preamble == PREAMBLE_SHORT) *(u16*)ie |= cpu_to_le16(cap_ShortPremble); - + if (pdev_network->Privacy) *(u16*)ie |= cpu_to_le16(cap_Privacy); - + sz += 2; ie += 2; - + //SSID ie = rtw_set_ie(ie, _SSID_IE_, pdev_network->Ssid.SsidLength, pdev_network->Ssid.Ssid, &sz); - + //supported rates if(pregistrypriv->wireless_mode == WIRELESS_11ABGN) { @@ -450,9 +450,9 @@ _func_enter_; { wireless_mode = pregistrypriv->wireless_mode; } - + rtw_set_supported_rate(pdev_network->SupportedRates, wireless_mode) ; - + rateLen = rtw_get_rateset_len(pdev_network->SupportedRates); if (rateLen > 8) @@ -470,17 +470,17 @@ _func_enter_; //IBSS Parameter Set - + ie = rtw_set_ie(ie, _IBSS_PARA_IE_, 2, (u8 *)&(pdev_network->Configuration.ATIMWindow), &sz); if (rateLen > 8) - { + { ie = rtw_set_ie(ie, _EXT_SUPPORTEDRATES_IE_, (rateLen - 8), (pdev_network->SupportedRates + 8), &sz); } - + #ifdef CONFIG_80211N_HT //HT Cap. - if(((pregistrypriv->wireless_mode&WIRELESS_11_5N)||(pregistrypriv->wireless_mode&WIRELESS_11_24N)) + if(((pregistrypriv->wireless_mode&WIRELESS_11_5N)||(pregistrypriv->wireless_mode&WIRELESS_11_24N)) && (pregistrypriv->ht_enable==_TRUE)) { //todo: @@ -505,7 +505,7 @@ unsigned char *rtw_get_wpa_ie(unsigned char *pie, int *wpa_ie_len, int limit) u8 *pbuf = pie; int limit_new = limit; - while(1) + while(1) { pbuf = rtw_get_ie(pbuf, _WPA_IE_ID_, &len, limit_new); @@ -553,7 +553,7 @@ check_next_ie: } unsigned char *rtw_get_wpa2_ie(unsigned char *pie, int *rsn_ie_len, int limit) -{ +{ return rtw_get_ie(pie, _WPA2_IE_ID_,rsn_ie_len, limit); @@ -604,59 +604,59 @@ int rtw_parse_wpa_ie(u8* wpa_ie, int wpa_ie_len, int *group_cipher, int *pairwis return _FAIL; } - + if ((*wpa_ie != _WPA_IE_ID_) || (*(wpa_ie+1) != (u8)(wpa_ie_len - 2)) || (_rtw_memcmp(wpa_ie+2, RTW_WPA_OUI_TYPE, WPA_SELECTOR_LEN) != _TRUE) ) - { + { return _FAIL; } pos = wpa_ie; pos += 8; - left = wpa_ie_len - 8; + left = wpa_ie_len - 8; //group_cipher if (left >= WPA_SELECTOR_LEN) { *group_cipher = rtw_get_wpa_cipher_suite(pos); - + pos += WPA_SELECTOR_LEN; left -= WPA_SELECTOR_LEN; - - } + + } else if (left > 0) { RT_TRACE(_module_rtl871x_mlme_c_,_drv_err_,("%s: ie length mismatch, %u too much", __FUNCTION__, left)); - + return _FAIL; } //pairwise_cipher if (left >= 2) - { - //count = le16_to_cpu(*(u16*)pos); + { + //count = le16_to_cpu(*(u16*)pos); count = RTW_GET_LE16(pos); pos += 2; left -= 2; - + if (count == 0 || left < count * WPA_SELECTOR_LEN) { RT_TRACE(_module_rtl871x_mlme_c_,_drv_err_,("%s: ie count botch (pairwise), " - "count %u left %u", __FUNCTION__, count, left)); + "count %u left %u", __FUNCTION__, count, left)); return _FAIL; } - + for (i = 0; i < count; i++) { *pairwise_cipher |= rtw_get_wpa_cipher_suite(pos); - + pos += WPA_SELECTOR_LEN; left -= WPA_SELECTOR_LEN; } - - } + + } else if (left == 1) { RT_TRACE(_module_rtl871x_mlme_c_,_drv_err_,("%s: ie too short (for key mgmt)", __FUNCTION__)); @@ -672,9 +672,9 @@ int rtw_parse_wpa_ie(u8* wpa_ie, int wpa_ie_len, int *group_cipher, int *pairwis } } } - + return ret; - + } int rtw_parse_wpa2_ie(u8* rsn_ie, int rsn_ie_len, int *group_cipher, int *pairwise_cipher, int *is_8021x) @@ -691,22 +691,22 @@ int rtw_parse_wpa2_ie(u8* rsn_ie, int rsn_ie_len, int *group_cipher, int *pairwi if ((*rsn_ie!= _WPA2_IE_ID_) || (*(rsn_ie+1) != (u8)(rsn_ie_len - 2))) - { + { return _FAIL; } - + pos = rsn_ie; pos += 4; - left = rsn_ie_len - 4; + left = rsn_ie_len - 4; //group_cipher if (left >= RSN_SELECTOR_LEN) { *group_cipher = rtw_get_wpa2_cipher_suite(pos); - + pos += RSN_SELECTOR_LEN; left -= RSN_SELECTOR_LEN; - + } else if (left > 0) { RT_TRACE(_module_rtl871x_mlme_c_,_drv_err_,("%s: ie length mismatch, %u too much", __FUNCTION__, left)); return _FAIL; @@ -714,7 +714,7 @@ int rtw_parse_wpa2_ie(u8* rsn_ie, int rsn_ie_len, int *group_cipher, int *pairwi //pairwise_cipher if (left >= 2) - { + { //count = le16_to_cpu(*(u16*)pos); count = RTW_GET_LE16(pos); pos += 2; @@ -722,23 +722,23 @@ int rtw_parse_wpa2_ie(u8* rsn_ie, int rsn_ie_len, int *group_cipher, int *pairwi if (count == 0 || left < count * RSN_SELECTOR_LEN) { RT_TRACE(_module_rtl871x_mlme_c_,_drv_err_,("%s: ie count botch (pairwise), " - "count %u left %u", __FUNCTION__, count, left)); + "count %u left %u", __FUNCTION__, count, left)); return _FAIL; } - + for (i = 0; i < count; i++) - { + { *pairwise_cipher |= rtw_get_wpa2_cipher_suite(pos); - + pos += RSN_SELECTOR_LEN; left -= RSN_SELECTOR_LEN; } - } + } else if (left == 1) { RT_TRACE(_module_rtl871x_mlme_c_,_drv_err_,("%s: ie too short (for key mgmt)", __FUNCTION__)); - + return _FAIL; } @@ -753,14 +753,14 @@ int rtw_parse_wpa2_ie(u8* rsn_ie, int rsn_ie_len, int *group_cipher, int *pairwi } return ret; - + } #ifdef CONFIG_WAPI_SUPPORT int rtw_get_wapi_ie(u8 *in_ie,uint in_len,u8 *wapi_ie,u16 *wapi_len) { u8 authmode, i; - uint cnt; + uint cnt; u8 wapi_oui1[4]={0x0,0x14,0x72,0x01}; u8 wapi_oui2[4]={0x0,0x14,0x72,0x02}; @@ -772,7 +772,7 @@ _func_enter_; //if(authmode==_WAPI_IE_) if(authmode==_WAPI_IE_ && (_rtw_memcmp(&in_ie[cnt+6], wapi_oui1,4)==_TRUE || - _rtw_memcmp(&in_ie[cnt+6], wapi_oui2,4)==_TRUE)) + _rtw_memcmp(&in_ie[cnt+6], wapi_oui2,4)==_TRUE)) { if (wapi_ie) { _rtw_memcpy(wapi_ie, &in_ie[cnt],in_ie[cnt+1]+2); @@ -804,23 +804,23 @@ int rtw_get_sec_ie(u8 *in_ie,uint in_len,u8 *rsn_ie,u16 *rsn_len,u8 *wpa_ie,u16 { u8 authmode, sec_idx, i; u8 wpa_oui[4]={0x0,0x50,0xf2,0x01}; - uint cnt; - + uint cnt; + _func_enter_; //Search required WPA or WPA2 IE and copy to sec_ie[ ] - + cnt = (_TIMESTAMP_ + _BEACON_ITERVAL_ + _CAPABILITY_); - + sec_idx=0; - + while(cnt found WPS_IE.....\n"); - *wps_ielen = ie_ptr[1]+2; + *wps_ielen = ie_ptr[1]+2; match=_TRUE; - } + } return match; } @@ -941,20 +941,20 @@ u8 *rtw_get_wps_ie(u8 *in_ie, uint in_len, u8 *wps_ie, uint *wps_ielen) if(wps_ie) _rtw_memcpy(wps_ie, &in_ie[cnt], in_ie[cnt+1]+2); - + if(wps_ielen) *wps_ielen = in_ie[cnt+1]+2; - + cnt+=in_ie[cnt+1]+2; break; } else { - cnt+=in_ie[cnt+1]+2; //goto next - } + cnt+=in_ie[cnt+1]+2; //goto next + } - } + } return wpsie_ptr; } @@ -986,33 +986,33 @@ u8 *rtw_get_wps_attr(u8 *wps_ie, uint wps_ielen, u16 target_attr_id ,u8 *buf_att // 6 = 1(Element ID) + 1(Length) + 4(WPS OUI) attr_ptr = wps_ie + 6; //goto first attr - + while(attr_ptr - wps_ie < wps_ielen) { // 4 = 2(Attribute ID) + 2(Length) u16 attr_id = RTW_GET_BE16(attr_ptr); u16 attr_data_len = RTW_GET_BE16(attr_ptr + 2); u16 attr_len = attr_data_len + 4; - + //DBG_871X("%s attr_ptr:%p, id:%u, length:%u\n", __FUNCTION__, attr_ptr, attr_id, attr_data_len); if( attr_id == target_attr_id ) { target_attr_ptr = attr_ptr; - + if(buf_attr) _rtw_memcpy(buf_attr, attr_ptr, attr_len); - + if(len_attr) *len_attr = attr_len; - + break; } else { attr_ptr += attr_len; //goto next - } - - } + } + + } return target_attr_ptr; } @@ -1034,7 +1034,7 @@ u8 *rtw_get_wps_attr_content(u8 *wps_ie, uint wps_ielen, u16 target_attr_id ,u8 if(len_content) *len_content = 0; - + attr_ptr = rtw_get_wps_attr(wps_ie, wps_ielen, target_attr_id, NULL, &attr_len); if(attr_ptr && attr_len) @@ -1145,7 +1145,7 @@ static int rtw_ieee802_11_parse_vendor_specific(u8 *pos, uint elen, } return 0; - + } /** @@ -1178,7 +1178,7 @@ ParseRes rtw_ieee802_11_parse_elems(u8 *start, uint len, DBG_871X("IEEE 802.11 element " "parse failed (id=%d elen=%d " "left=%lu)\n", - id, elen, (unsigned long) left); + id, elen, (unsigned long) left); } return ParseFailed; } @@ -1280,7 +1280,7 @@ ParseRes rtw_ieee802_11_parse_elems(u8 *start, uint len, return ParseFailed; return unknown ? ParseUnknown : ParseOK; - + } static u8 key_char2num(u8 ch); @@ -1317,7 +1317,7 @@ void rtw_macaddr_cfg(u8 *mac_addr) { u8 mac[ETH_ALEN]; if(mac_addr == NULL) return; - + if ( rtw_initmac ) { // Users specify the mac address int jj,kk; @@ -1332,7 +1332,7 @@ void rtw_macaddr_cfg(u8 *mac_addr) { // Use the mac address stored in the Efuse _rtw_memcpy(mac, mac_addr, ETH_ALEN); } - + if (((mac[0]==0xff) &&(mac[1]==0xff) && (mac[2]==0xff) && (mac[3]==0xff) && (mac[4]==0xff) &&(mac[5]==0xff)) || ((mac[0]==0x0) && (mac[1]==0x0) && (mac[2]==0x0) && @@ -1347,7 +1347,7 @@ void rtw_macaddr_cfg(u8 *mac_addr) // use default mac addresss _rtw_memcpy(mac_addr, mac, ETH_ALEN); DBG_871X("MAC Address from efuse error, assign default one !!!\n"); - } + } DBG_871X("rtw_macaddr_cfg MAC Address = "MAC_FMT"\n", MAC_ARG(mac_addr)); } @@ -1477,7 +1477,7 @@ void dump_p2p_ie(u8 *ie, u32 ie_len) { u8 *p2p_ie; uint p2p_ielen; - + p2p_ie = rtw_get_p2p_ie(ie, ie_len, NULL, &p2p_ielen); if(p2p_ie != ie || p2p_ielen == 0) return; @@ -1490,7 +1490,7 @@ void dump_p2p_ie(u8 *ie, u32 ie_len) { DBG_871X("%s ID:%u, LEN:%u\n", __FUNCTION__, id, len); pos+=(3+len); - } + } } u8 *rtw_get_p2p_ie_from_scan_queue(u8 *in_ie, int in_len, u8 *p2p_ie, uint *p2p_ielen, u8 frame_type) @@ -1539,11 +1539,11 @@ u8 *rtw_get_p2p_ie(u8 *in_ie, int in_len, u8 *p2p_ie, uint *p2p_ielen) if ((in_len < 0) || (cnt > MAX_IE_SZ)) { dump_stack(); return NULL; - } + } if( ( eid == _VENDOR_SPECIFIC_IE_ ) && ( _rtw_memcmp( &in_ie[cnt+2], p2p_oui, 4) == _TRUE ) ) { p2p_ie_ptr = in_ie + cnt; - + if ( p2p_ie != NULL ) { _rtw_memcpy( p2p_ie, &in_ie[ cnt ], in_ie[ cnt + 1 ] + 2 ); @@ -1553,17 +1553,17 @@ u8 *rtw_get_p2p_ie(u8 *in_ie, int in_len, u8 *p2p_ie, uint *p2p_ielen) { *p2p_ielen = in_ie[ cnt + 1 ] + 2; } - + return p2p_ie_ptr; break; } else { - cnt += in_ie[ cnt + 1 ] +2; //goto next - } - - } + cnt += in_ie[ cnt + 1 ] +2; //goto next + } + + } return NULL; @@ -1596,33 +1596,33 @@ u8 *rtw_get_p2p_attr(u8 *p2p_ie, uint p2p_ielen, u8 target_attr_id ,u8 *buf_attr // 6 = 1(Element ID) + 1(Length) + 3 (OUI) + 1(OUI Type) attr_ptr = p2p_ie + 6; //goto first attr - + while(attr_ptr - p2p_ie < p2p_ielen) { // 3 = 1(Attribute ID) + 2(Length) u8 attr_id = *attr_ptr; u16 attr_data_len = RTW_GET_LE16(attr_ptr + 1); u16 attr_len = attr_data_len + 3; - + //DBG_871X("%s attr_ptr:%p, id:%u, length:%u\n", __FUNCTION__, attr_ptr, attr_id, attr_data_len); if( attr_id == target_attr_id ) { target_attr_ptr = attr_ptr; - + if(buf_attr) _rtw_memcpy(buf_attr, attr_ptr, attr_len); - + if(len_attr) *len_attr = attr_len; - + break; } else { attr_ptr += attr_len; //goto next - } - - } + } + + } return target_attr_ptr; } @@ -1644,7 +1644,7 @@ u8 *rtw_get_p2p_attr_content(u8 *p2p_ie, uint p2p_ielen, u8 target_attr_id ,u8 * if(len_content) *len_content = 0; - + attr_ptr = rtw_get_p2p_attr(p2p_ie, p2p_ielen, target_attr_id, NULL, &attr_len); if(attr_ptr && attr_len) @@ -1662,19 +1662,19 @@ u8 *rtw_get_p2p_attr_content(u8 *p2p_ie, uint p2p_ielen, u8 target_attr_id ,u8 * } u32 rtw_set_p2p_attr_content(u8 *pbuf, u8 attr_id, u16 attr_len, u8 *pdata_attr) -{ +{ u32 a_len; *pbuf = attr_id; - + //*(u16*)(pbuf + 1) = cpu_to_le16(attr_len); RTW_PUT_LE16(pbuf + 1, attr_len); if(pdata_attr) - _rtw_memcpy(pbuf + 3, pdata_attr, attr_len); - + _rtw_memcpy(pbuf + 3, pdata_attr, attr_len); + a_len = attr_len + 3; - + return a_len; } @@ -1725,8 +1725,8 @@ void rtw_WLAN_BSSID_EX_remove_p2p_attr(WLAN_BSSID_EX *bss_ex, u8 attr_id) u8 *p2p_ie; uint p2p_ielen, p2p_ielen_ori; int cnt; - - if( (p2p_ie=rtw_get_p2p_ie(bss_ex->IEs+_FIXED_IE_LENGTH_, bss_ex->IELength-_FIXED_IE_LENGTH_, NULL, &p2p_ielen_ori)) ) + + if( (p2p_ie=rtw_get_p2p_ie(bss_ex->IEs+_FIXED_IE_LENGTH_, bss_ex->IELength-_FIXED_IE_LENGTH_, NULL, &p2p_ielen_ori)) ) { #if 0 if(rtw_get_p2p_attr(p2p_ie, p2p_ielen_ori, attr_id, NULL, NULL)) { @@ -1737,7 +1737,7 @@ void rtw_WLAN_BSSID_EX_remove_p2p_attr(WLAN_BSSID_EX *bss_ex, u8 attr_id) p2p_ielen=rtw_p2p_attr_remove(p2p_ie, p2p_ielen_ori, attr_id); if(p2p_ielen != p2p_ielen_ori) { - + u8 *next_ie_ori = p2p_ie+p2p_ielen_ori; u8 *next_ie = p2p_ie+p2p_ielen; uint remain_len = bss_ex->IELength-(next_ie_ori-bss_ex->IEs); @@ -1783,7 +1783,7 @@ void dump_wfd_ie(u8 *ie, u32 ie_len) int rtw_get_wfd_ie(u8 *in_ie, int in_len, u8 *wfd_ie, uint *wfd_ielen) { int match; - uint cnt = 0; + uint cnt = 0; u8 eid, wfd_oui[4]={0x50,0x6F,0x9A,0x0A}; @@ -1797,13 +1797,13 @@ int rtw_get_wfd_ie(u8 *in_ie, int in_len, u8 *wfd_ie, uint *wfd_ielen) while(cnt 1 byte for attribute ID field, 2 bytes for length field if(attr_content) _rtw_memcpy( attr_content, &wfd_ie[ cnt + 3 ], attrlen ); - + if(attr_contentlen) *attr_contentlen = attrlen; - + cnt += attrlen + 3; match = _TRUE; @@ -1903,10 +1903,10 @@ int rtw_get_wfd_attr_content(u8 *wfd_ie, uint wfd_ielen, u8 target_attr_id ,u8 * } else { - cnt += attrlen + 3; //goto next - } - - } + cnt += attrlen + 3; //goto next + } + + } return match; @@ -2060,7 +2060,7 @@ void rtw_get_bcn_info(struct wlan_network *pnetwork) u16 rtw_mcs_rate(u8 rf_type, u8 bw_40MHz, u8 short_GI_20, u8 short_GI_40, unsigned char * MCS_rate) { u16 max_rate = 0; - + if(rf_type == RF_1T1R) { if(MCS_rate[0] & BIT(7)) @@ -2181,4 +2181,3 @@ const char *action_public_str(u8 action) action = (action >= ACT_PUBLIC_MAX) ? ACT_PUBLIC_MAX : action; return _action_public_str[action]; } - diff --git a/core/rtw_io.c b/core/rtw_io.c index 656d5c4..05e1099 100755 --- a/core/rtw_io.c +++ b/core/rtw_io.c @@ -71,12 +71,12 @@ jackson@realtek.com.tw #endif #ifdef CONFIG_SDIO_HCI -#define rtw_le16_to_cpu(val) val +#define rtw_le16_to_cpu(val) val #define rtw_le32_to_cpu(val) val #define rtw_cpu_to_le16(val) val #define rtw_cpu_to_le32(val) val #else -#define rtw_le16_to_cpu(val) le16_to_cpu(val) +#define rtw_le16_to_cpu(val) le16_to_cpu(val) #define rtw_le32_to_cpu(val) le32_to_cpu(val) #define rtw_cpu_to_le16(val) cpu_to_le16(val) #define rtw_cpu_to_le32(val) cpu_to_le32(val) @@ -86,7 +86,7 @@ jackson@realtek.com.tw u8 _rtw_read8(struct adapter *adapter, u32 addr) { u8 r_val; - //struct io_queue *pio_queue = (struct io_queue *)adapter->pio_queue; + //struct io_queue *pio_queue = (struct io_queue *)adapter->pio_queue; struct io_priv *pio_priv = &adapter->iopriv; struct intf_hdl *pintfhdl = &(pio_priv->intf); u8 (*_read8)(struct intf_hdl *pintfhdl, u32 addr); @@ -101,10 +101,10 @@ u8 _rtw_read8(struct adapter *adapter, u32 addr) u16 _rtw_read16(struct adapter *adapter, u32 addr) { u16 r_val; - //struct io_queue *pio_queue = (struct io_queue *)adapter->pio_queue; + //struct io_queue *pio_queue = (struct io_queue *)adapter->pio_queue; struct io_priv *pio_priv = &adapter->iopriv; struct intf_hdl *pintfhdl = &(pio_priv->intf); - u16 (*_read16)(struct intf_hdl *pintfhdl, u32 addr); + u16 (*_read16)(struct intf_hdl *pintfhdl, u32 addr); _func_enter_; _read16 = pintfhdl->io_ops._read16; @@ -116,10 +116,10 @@ u16 _rtw_read16(struct adapter *adapter, u32 addr) u32 _rtw_read32(struct adapter *adapter, u32 addr) { u32 r_val; - //struct io_queue *pio_queue = (struct io_queue *)adapter->pio_queue; + //struct io_queue *pio_queue = (struct io_queue *)adapter->pio_queue; struct io_priv *pio_priv = &adapter->iopriv; struct intf_hdl *pintfhdl = &(pio_priv->intf); - u32 (*_read32)(struct intf_hdl *pintfhdl, u32 addr); + u32 (*_read32)(struct intf_hdl *pintfhdl, u32 addr); _func_enter_; _read32 = pintfhdl->io_ops._read32; @@ -131,7 +131,7 @@ u32 _rtw_read32(struct adapter *adapter, u32 addr) int _rtw_write8(struct adapter *adapter, u32 addr, u8 val) { - //struct io_queue *pio_queue = (struct io_queue *)adapter->pio_queue; + //struct io_queue *pio_queue = (struct io_queue *)adapter->pio_queue; struct io_priv *pio_priv = &adapter->iopriv; struct intf_hdl *pintfhdl = &(pio_priv->intf); int (*_write8)(struct intf_hdl *pintfhdl, u32 addr, u8 val); @@ -141,12 +141,12 @@ int _rtw_write8(struct adapter *adapter, u32 addr, u8 val) ret = _write8(pintfhdl, addr, val); _func_exit_; - + return RTW_STATUS_CODE(ret); } int _rtw_write16(struct adapter *adapter, u32 addr, u16 val) { - //struct io_queue *pio_queue = (struct io_queue *)adapter->pio_queue; + //struct io_queue *pio_queue = (struct io_queue *)adapter->pio_queue; struct io_priv *pio_priv = &adapter->iopriv; struct intf_hdl *pintfhdl = &(pio_priv->intf); int (*_write16)(struct intf_hdl *pintfhdl, u32 addr, u16 val); @@ -162,14 +162,14 @@ int _rtw_write16(struct adapter *adapter, u32 addr, u16 val) } int _rtw_write32(struct adapter *adapter, u32 addr, u32 val) { - //struct io_queue *pio_queue = (struct io_queue *)adapter->pio_queue; + //struct io_queue *pio_queue = (struct io_queue *)adapter->pio_queue; struct io_priv *pio_priv = &adapter->iopriv; struct intf_hdl *pintfhdl = &(pio_priv->intf); int (*_write32)(struct intf_hdl *pintfhdl, u32 addr, u32 val); int ret; _func_enter_; _write32 = pintfhdl->io_ops._write32; - + val = rtw_cpu_to_le32(val); ret = _write32(pintfhdl, addr, val); _func_exit_; @@ -179,7 +179,7 @@ int _rtw_write32(struct adapter *adapter, u32 addr, u32 val) int _rtw_writeN(struct adapter *adapter, u32 addr ,u32 length , u8 *pdata) { - //struct io_queue *pio_queue = (struct io_queue *)adapter->pio_queue; + //struct io_queue *pio_queue = (struct io_queue *)adapter->pio_queue; struct io_priv *pio_priv = &adapter->iopriv; struct intf_hdl *pintfhdl = (struct intf_hdl*)(&(pio_priv->intf)); int (*_writeN)(struct intf_hdl *pintfhdl, u32 addr,u32 length, u8 *pdata); @@ -194,7 +194,7 @@ int _rtw_writeN(struct adapter *adapter, u32 addr ,u32 length , u8 *pdata) } int _rtw_write8_async(struct adapter *adapter, u32 addr, u8 val) { - //struct io_queue *pio_queue = (struct io_queue *)adapter->pio_queue; + //struct io_queue *pio_queue = (struct io_queue *)adapter->pio_queue; struct io_priv *pio_priv = &adapter->iopriv; struct intf_hdl *pintfhdl = &(pio_priv->intf); int (*_write8_async)(struct intf_hdl *pintfhdl, u32 addr, u8 val); @@ -209,7 +209,7 @@ int _rtw_write8_async(struct adapter *adapter, u32 addr, u8 val) } int _rtw_write16_async(struct adapter *adapter, u32 addr, u16 val) { - //struct io_queue *pio_queue = (struct io_queue *)adapter->pio_queue; + //struct io_queue *pio_queue = (struct io_queue *)adapter->pio_queue; struct io_priv *pio_priv = &adapter->iopriv; struct intf_hdl *pintfhdl = &(pio_priv->intf); int (*_write16_async)(struct intf_hdl *pintfhdl, u32 addr, u16 val); @@ -224,7 +224,7 @@ int _rtw_write16_async(struct adapter *adapter, u32 addr, u16 val) } int _rtw_write32_async(struct adapter *adapter, u32 addr, u32 val) { - //struct io_queue *pio_queue = (struct io_queue *)adapter->pio_queue; + //struct io_queue *pio_queue = (struct io_queue *)adapter->pio_queue; struct io_priv *pio_priv = &adapter->iopriv; struct intf_hdl *pintfhdl = &(pio_priv->intf); int (*_write32_async)(struct intf_hdl *pintfhdl, u32 addr, u32 val); @@ -241,7 +241,7 @@ int _rtw_write32_async(struct adapter *adapter, u32 addr, u32 val) void _rtw_read_mem(struct adapter *adapter, u32 addr, u32 cnt, u8 *pmem) { void (*_read_mem)(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *pmem); - //struct io_queue *pio_queue = (struct io_queue *)adapter->pio_queue; + //struct io_queue *pio_queue = (struct io_queue *)adapter->pio_queue; struct io_priv *pio_priv = &adapter->iopriv; struct intf_hdl *pintfhdl = &(pio_priv->intf); @@ -249,7 +249,7 @@ void _rtw_read_mem(struct adapter *adapter, u32 addr, u32 cnt, u8 *pmem) if( (adapter->bDriverStopped ==_TRUE) || (adapter->bSurpriseRemoved == _TRUE)) { - RT_TRACE(_module_rtl871x_io_c_, _drv_info_, ("rtw_read_mem:bDriverStopped(%d) OR bSurpriseRemoved(%d)", adapter->bDriverStopped, adapter->bSurpriseRemoved)); + RT_TRACE(_module_rtl871x_io_c_, _drv_info_, ("rtw_read_mem:bDriverStopped(%d) OR bSurpriseRemoved(%d)", adapter->bDriverStopped, adapter->bSurpriseRemoved)); return; } @@ -264,7 +264,7 @@ void _rtw_read_mem(struct adapter *adapter, u32 addr, u32 cnt, u8 *pmem) void _rtw_write_mem(struct adapter *adapter, u32 addr, u32 cnt, u8 *pmem) { void (*_write_mem)(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *pmem); - //struct io_queue *pio_queue = (struct io_queue *)adapter->pio_queue; + //struct io_queue *pio_queue = (struct io_queue *)adapter->pio_queue; struct io_priv *pio_priv = &adapter->iopriv; struct intf_hdl *pintfhdl = &(pio_priv->intf); @@ -281,7 +281,7 @@ void _rtw_write_mem(struct adapter *adapter, u32 addr, u32 cnt, u8 *pmem) void _rtw_read_port(struct adapter *adapter, u32 addr, u32 cnt, u8 *pmem) { u32 (*_read_port)(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *pmem); - //struct io_queue *pio_queue = (struct io_queue *)adapter->pio_queue; + //struct io_queue *pio_queue = (struct io_queue *)adapter->pio_queue; struct io_priv *pio_priv = &adapter->iopriv; struct intf_hdl *pintfhdl = &(pio_priv->intf); @@ -289,7 +289,7 @@ void _rtw_read_port(struct adapter *adapter, u32 addr, u32 cnt, u8 *pmem) if( (adapter->bDriverStopped ==_TRUE) || (adapter->bSurpriseRemoved == _TRUE)) { - RT_TRACE(_module_rtl871x_io_c_, _drv_info_, ("rtw_read_port:bDriverStopped(%d) OR bSurpriseRemoved(%d)", adapter->bDriverStopped, adapter->bSurpriseRemoved)); + RT_TRACE(_module_rtl871x_io_c_, _drv_info_, ("rtw_read_port:bDriverStopped(%d) OR bSurpriseRemoved(%d)", adapter->bDriverStopped, adapter->bSurpriseRemoved)); return; } @@ -317,7 +317,7 @@ void _rtw_read_port_cancel(struct adapter *adapter) u32 _rtw_write_port(struct adapter *adapter, u32 addr, u32 cnt, u8 *pmem) { u32 (*_write_port)(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *pmem); - //struct io_queue *pio_queue = (struct io_queue *)adapter->pio_queue; + //struct io_queue *pio_queue = (struct io_queue *)adapter->pio_queue; struct io_priv *pio_priv = &adapter->iopriv; struct intf_hdl *pintfhdl = &(pio_priv->intf); u32 ret = _SUCCESS; @@ -325,7 +325,7 @@ u32 _rtw_write_port(struct adapter *adapter, u32 addr, u32 cnt, u8 *pmem) _func_enter_; _write_port = pintfhdl->io_ops._write_port; - + ret = _write_port(pintfhdl, addr, cnt, pmem); _func_exit_; @@ -403,19 +403,19 @@ int rtw_inc_and_chk_continual_io_error(struct dvobj_priv *dvobj) */ void rtw_reset_continual_io_error(struct dvobj_priv *dvobj) { - ATOMIC_SET(&dvobj->continual_io_error, 0); + ATOMIC_SET(&dvobj->continual_io_error, 0); } #ifdef DBG_IO u16 read_sniff_ranges[][2] = { //{0x550, 0x551}, -}; +}; u16 write_sniff_ranges[][2] = { //{0x550, 0x551}, //{0x4c, 0x4c}, -}; +}; int read_sniff_num = sizeof(read_sniff_ranges)/sizeof(u16)/2; int write_sniff_num = sizeof(write_sniff_ranges)/sizeof(u16)/2; @@ -427,7 +427,7 @@ bool match_read_sniff_ranges(u16 addr, u16 len) if (addr + len > read_sniff_ranges[i][0] && addr <= read_sniff_ranges[i][1]) return _TRUE; } - + return _FALSE; } @@ -438,7 +438,7 @@ bool match_write_sniff_ranges(u16 addr, u16 len) if (addr + len > write_sniff_ranges[i][0] && addr <= write_sniff_ranges[i][1]) return _TRUE; } - + return _FALSE; } @@ -455,7 +455,7 @@ u8 dbg_rtw_read8(struct adapter *adapter, u32 addr, const char *caller, const in u16 dbg_rtw_read16(struct adapter *adapter, u32 addr, const char *caller, const int line) { u16 val = _rtw_read16(adapter, addr); - + if (match_read_sniff_ranges(addr, 2)) DBG_871X("DBG_IO %s:%d rtw_read16(0x%04x) return 0x%04x\n", caller, line, addr, val); @@ -465,7 +465,7 @@ u16 dbg_rtw_read16(struct adapter *adapter, u32 addr, const char *caller, const u32 dbg_rtw_read32(struct adapter *adapter, u32 addr, const char *caller, const int line) { u32 val = _rtw_read32(adapter, addr); - + if (match_read_sniff_ranges(addr, 4)) DBG_871X("DBG_IO %s:%d rtw_read32(0x%04x) return 0x%08x\n", caller, line, addr, val); @@ -476,21 +476,21 @@ int dbg_rtw_write8(struct adapter *adapter, u32 addr, u8 val, const char *caller { if (match_write_sniff_ranges(addr, 1)) DBG_871X("DBG_IO %s:%d rtw_write8(0x%04x, 0x%02x)\n", caller, line, addr, val); - + return _rtw_write8(adapter, addr, val); } int dbg_rtw_write16(struct adapter *adapter, u32 addr, u16 val, const char *caller, const int line) { if (match_write_sniff_ranges(addr, 2)) DBG_871X("DBG_IO %s:%d rtw_write16(0x%04x, 0x%04x)\n", caller, line, addr, val); - + return _rtw_write16(adapter, addr, val); } int dbg_rtw_write32(struct adapter *adapter, u32 addr, u32 val, const char *caller, const int line) { if (match_write_sniff_ranges(addr, 4)) DBG_871X("DBG_IO %s:%d rtw_write32(0x%04x, 0x%08x)\n", caller, line, addr, val); - + return _rtw_write32(adapter, addr, val); } int dbg_rtw_writeN(struct adapter *adapter, u32 addr ,u32 length , u8 *data, const char *caller, const int line) @@ -501,5 +501,3 @@ int dbg_rtw_writeN(struct adapter *adapter, u32 addr ,u32 length , u8 *data, con return _rtw_writeN(adapter, addr, length, data); } #endif - - diff --git a/core/rtw_ioctl_query.c b/core/rtw_ioctl_query.c index 07c921a..53e6c67 100755 --- a/core/rtw_ioctl_query.c +++ b/core/rtw_ioctl_query.c @@ -1,7 +1,7 @@ /****************************************************************************** * * 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. @@ -24,6 +24,3 @@ #include #include #include - - - diff --git a/core/rtw_ioctl_rtl.c b/core/rtw_ioctl_rtl.c index 216351b..93ac5ec 100755 --- a/core/rtw_ioctl_rtl.c +++ b/core/rtw_ioctl_rtl.c @@ -1,7 +1,7 @@ /****************************************************************************** * * 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. @@ -57,8 +57,8 @@ struct oid_obj_priv oid_rtl_seg_01_01[] = {1, &oid_rt_get_preamble_mode_hdl}, //0x96 {1, &oid_null_function}, //0x97 {1, &oid_rt_get_ap_ip_hdl}, //0x98 - {1, &oid_rt_get_channelplan_hdl}, //0x99 - {1, &oid_rt_set_preamble_mode_hdl}, //0x9A + {1, &oid_rt_get_channelplan_hdl}, //0x99 + {1, &oid_rt_set_preamble_mode_hdl}, //0x9A {1, &oid_rt_set_bcn_intvl_hdl}, //0x9B {1, &oid_null_function}, //0x9C {1, &oid_rt_dedicate_probe_hdl}, //0x9D @@ -73,8 +73,8 @@ struct oid_obj_priv oid_rtl_seg_01_01[] = {1, &oid_null_function}, //0xA6 {1, &oid_rt_get_total_tx_bytes_hdl}, //0xA7 {1, &oid_rt_get_total_rx_bytes_hdl}, //0xA8 - {1, &oid_rt_current_tx_power_level_hdl}, //0xA9 - {1, &oid_rt_get_enc_key_mismatch_count_hdl}, //0xAA + {1, &oid_rt_current_tx_power_level_hdl}, //0xA9 + {1, &oid_rt_get_enc_key_mismatch_count_hdl}, //0xAA {1, &oid_rt_get_enc_key_match_count_hdl}, //0xAB {1, &oid_rt_get_channel_hdl}, //0xAC {1, &oid_rt_set_channelplan_hdl}, //0xAD @@ -89,8 +89,8 @@ struct oid_obj_priv oid_rtl_seg_01_01[] = {1, &oid_null_function}, //0xB6 {1, &oid_null_function}, //0xB7 {1, &oid_null_function}, //0xB8 - {1, &oid_null_function}, //0xB9 - {1, &oid_null_function}, //0xBA + {1, &oid_null_function}, //0xB9 + {1, &oid_null_function}, //0xBA {1, &oid_rt_supported_wireless_mode_hdl}, //0xBB {1, &oid_rt_get_channel_list_hdl}, //0xBC {1, &oid_rt_get_scan_in_progress_hdl}, //0xBD @@ -105,14 +105,14 @@ struct oid_obj_priv oid_rtl_seg_01_01[] = {1, &oid_null_function}, //0xC6 {1, &oid_null_function}, //0xC7 {1, &oid_null_function}, //0xC8 - {1, &oid_null_function}, //0xC9 - {1, &oid_null_function}, //0xCA + {1, &oid_null_function}, //0xC9 + {1, &oid_null_function}, //0xCA {1, &oid_null_function}, //0xCB {1, &oid_null_function}, //0xCC {1, &oid_null_function}, //0xCD {1, &oid_null_function}, //0xCE {1, &oid_null_function}, //0xCF - + }; struct oid_obj_priv oid_rtl_seg_01_03[] = @@ -128,7 +128,7 @@ struct oid_obj_priv oid_rtl_seg_01_03[] = struct oid_obj_priv oid_rtl_seg_01_11[] = { - {1, &oid_null_function}, //0xC0 OID_RT_PRO_RX_FILTER + {1, &oid_null_function}, //0xC0 OID_RT_PRO_RX_FILTER {1, &oid_null_function}, //0xC1 OID_CE_USB_WRITE_REGISTRY {1, &oid_null_function}, //0xC2 OID_CE_USB_READ_REGISTRY {1, &oid_null_function}, //0xC3 OID_RT_PRO_SET_INITIAL_GAIN @@ -136,10 +136,10 @@ struct oid_obj_priv oid_rtl_seg_01_11[] = {1, &oid_null_function}, //0xC5 OID_RT_PRO_SET_BB_RF_SHUTDOWN_MODE {1, &oid_null_function}, //0xC6 OID_RT_PRO_SET_TX_CHARGE_PUMP {1, &oid_null_function}, //0xC7 OID_RT_PRO_SET_RX_CHARGE_PUMP - {1, &oid_rt_pro_rf_write_registry_hdl}, //0xC8 - {1, &oid_rt_pro_rf_read_registry_hdl}, //0xC9 + {1, &oid_rt_pro_rf_write_registry_hdl}, //0xC8 + {1, &oid_rt_pro_rf_read_registry_hdl}, //0xC9 {1, &oid_null_function} //0xCA OID_RT_PRO_QUERY_RF_TYPE - + }; struct oid_obj_priv oid_rtl_seg_03_00[] = @@ -150,11 +150,11 @@ struct oid_obj_priv oid_rtl_seg_03_00[] = {1, &oid_null_function}, //0x03 {1, &oid_rt_set_default_key_id_hdl}, //0x04 - + }; -//************** oid_rtl_seg_01_01 section start ************** +//************** oid_rtl_seg_01_01 section start ************** NDIS_STATUS oid_rt_pro_set_fw_dig_state_hdl(struct oid_par_priv* poid_par_priv) { @@ -162,28 +162,28 @@ NDIS_STATUS oid_rt_pro_set_fw_dig_state_hdl(struct oid_par_priv* poid_par_priv) #if 0 PADAPTER Adapter = (PADAPTER)(poid_par_priv->adapter_context); _irqL oldirql; - + _func_enter_; - - if(poid_par_priv->type_of_oid != SET_OID) + + if(poid_par_priv->type_of_oid != SET_OID) { status = NDIS_STATUS_NOT_ACCEPTED; return status; } - + _irqlevel_changed_(&oldirql,LOWER); if(poid_par_priv->information_buf_len >= sizeof(struct setdig_parm)) { - //DEBUG_ERR(("===> oid_rt_pro_set_fw_dig_state_hdl. type:0x%02x.\n",*((unsigned char*)poid_par_priv->information_buf ))); - if(!rtw_setfwdig_cmd(Adapter,*((unsigned char*)poid_par_priv->information_buf ))) + //DEBUG_ERR(("===> oid_rt_pro_set_fw_dig_state_hdl. type:0x%02x.\n",*((unsigned char*)poid_par_priv->information_buf ))); + if(!rtw_setfwdig_cmd(Adapter,*((unsigned char*)poid_par_priv->information_buf ))) { status = NDIS_STATUS_NOT_ACCEPTED; } - + } else{ status = NDIS_STATUS_NOT_ACCEPTED; - } + } _irqlevel_changed_(&oldirql,RAISE); _func_exit_; #endif @@ -197,29 +197,29 @@ NDIS_STATUS oid_rt_pro_set_fw_ra_state_hdl(struct oid_par_priv* poid_par_priv) #if 0 PADAPTER Adapter = (PADAPTER)(poid_par_priv->adapter_context); _irqL oldirql; - - _func_enter_; - if(poid_par_priv->type_of_oid != SET_OID) + + _func_enter_; + if(poid_par_priv->type_of_oid != SET_OID) { status = NDIS_STATUS_NOT_ACCEPTED; return status; } - + _irqlevel_changed_(&oldirql,LOWER); - + if(poid_par_priv->information_buf_len >= sizeof(struct setra_parm)) { - //DEBUG_ERR(("===> oid_rt_pro_set_fw_ra_state_hdl. type:0x%02x.\n",*((unsigned char*)poid_par_priv->information_buf ))); - if(!rtw_setfwra_cmd(Adapter,*((unsigned char*)poid_par_priv->information_buf ))) + //DEBUG_ERR(("===> oid_rt_pro_set_fw_ra_state_hdl. type:0x%02x.\n",*((unsigned char*)poid_par_priv->information_buf ))); + if(!rtw_setfwra_cmd(Adapter,*((unsigned char*)poid_par_priv->information_buf ))) { status = NDIS_STATUS_NOT_ACCEPTED; } - + } else{ status = NDIS_STATUS_NOT_ACCEPTED; - } + } _irqlevel_changed_(&oldirql,RAISE); _func_exit_; #endif @@ -228,7 +228,7 @@ NDIS_STATUS oid_rt_pro_set_fw_ra_state_hdl(struct oid_par_priv* poid_par_priv) //----------------------------------------------------------------------------- NDIS_STATUS oid_rt_get_signal_quality_hdl(struct oid_par_priv* poid_par_priv) { - NDIS_STATUS status = NDIS_STATUS_SUCCESS; + NDIS_STATUS status = NDIS_STATUS_SUCCESS; PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context); //DEBUG_ERR(("<**********************oid_rt_get_signal_quality_hdl \n")); @@ -236,7 +236,7 @@ NDIS_STATUS oid_rt_get_signal_quality_hdl(struct oid_par_priv* poid_par_priv) { status = NDIS_STATUS_NOT_ACCEPTED; return status; - } + } #if 0 if(pMgntInfo->mAssoc || pMgntInfo->mIbss) @@ -258,19 +258,19 @@ NDIS_STATUS oid_rt_get_signal_quality_hdl(struct oid_par_priv* poid_par_priv) NDIS_STATUS oid_rt_get_small_packet_crc_hdl(struct oid_par_priv* poid_par_priv) { - NDIS_STATUS status = NDIS_STATUS_SUCCESS; + NDIS_STATUS status = NDIS_STATUS_SUCCESS; PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context); if(poid_par_priv->type_of_oid != QUERY_OID) { status = NDIS_STATUS_NOT_ACCEPTED; return status; - } - + } + if(poid_par_priv->information_buf_len >= sizeof(ULONG) ) - { + { *(ULONG *)poid_par_priv->information_buf = padapter->recvpriv.rx_smallpacket_crcerr; - *poid_par_priv->bytes_rw = poid_par_priv->information_buf_len; + *poid_par_priv->bytes_rw = poid_par_priv->information_buf_len; } else { @@ -282,19 +282,19 @@ NDIS_STATUS oid_rt_get_small_packet_crc_hdl(struct oid_par_priv* poid_par_priv) //------------------------------------------------------------------------------ NDIS_STATUS oid_rt_get_middle_packet_crc_hdl(struct oid_par_priv* poid_par_priv) { - NDIS_STATUS status = NDIS_STATUS_SUCCESS; + NDIS_STATUS status = NDIS_STATUS_SUCCESS; PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context); if(poid_par_priv->type_of_oid != QUERY_OID) { status = NDIS_STATUS_NOT_ACCEPTED; return status; - } + } if(poid_par_priv->information_buf_len >= sizeof(ULONG) ) - { + { *(ULONG *)poid_par_priv->information_buf = padapter->recvpriv.rx_middlepacket_crcerr; - *poid_par_priv->bytes_rw = poid_par_priv->information_buf_len; + *poid_par_priv->bytes_rw = poid_par_priv->information_buf_len; } else { @@ -307,19 +307,19 @@ NDIS_STATUS oid_rt_get_middle_packet_crc_hdl(struct oid_par_priv* poid_par_priv) //------------------------------------------------------------------------------ NDIS_STATUS oid_rt_get_large_packet_crc_hdl(struct oid_par_priv* poid_par_priv) { - NDIS_STATUS status = NDIS_STATUS_SUCCESS; + NDIS_STATUS status = NDIS_STATUS_SUCCESS; PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context); if(poid_par_priv->type_of_oid != QUERY_OID) { status = NDIS_STATUS_NOT_ACCEPTED; return status; - } + } if(poid_par_priv->information_buf_len >= sizeof(ULONG) ) - { + { *(ULONG *)poid_par_priv->information_buf = padapter->recvpriv.rx_largepacket_crcerr; - *poid_par_priv->bytes_rw = poid_par_priv->information_buf_len; + *poid_par_priv->bytes_rw = poid_par_priv->information_buf_len; } else { @@ -333,27 +333,27 @@ NDIS_STATUS oid_rt_get_large_packet_crc_hdl(struct oid_par_priv* poid_par_priv) //------------------------------------------------------------------------------ NDIS_STATUS oid_rt_get_tx_retry_hdl(struct oid_par_priv* poid_par_priv) { - NDIS_STATUS status = NDIS_STATUS_SUCCESS; + NDIS_STATUS status = NDIS_STATUS_SUCCESS; PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context); if(poid_par_priv->type_of_oid != QUERY_OID) { status = NDIS_STATUS_NOT_ACCEPTED; return status; - } + } return status; } NDIS_STATUS oid_rt_get_rx_retry_hdl(struct oid_par_priv* poid_par_priv) { - NDIS_STATUS status = NDIS_STATUS_SUCCESS; + NDIS_STATUS status = NDIS_STATUS_SUCCESS; PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context); if(poid_par_priv->type_of_oid != QUERY_OID) { status = NDIS_STATUS_NOT_ACCEPTED; return status; - } + } *poid_par_priv->bytes_rw = poid_par_priv->information_buf_len; return status; } @@ -367,11 +367,11 @@ NDIS_STATUS oid_rt_get_rx_total_packet_hdl(struct oid_par_priv* poid_par_priv) { status = NDIS_STATUS_NOT_ACCEPTED; return status; - } + } if(poid_par_priv->information_buf_len >= sizeof(ULONG) ) - { + { *(u64 *)poid_par_priv->information_buf = padapter->recvpriv.rx_pkts + padapter->recvpriv.rx_drop; - *poid_par_priv->bytes_rw = poid_par_priv->information_buf_len; + *poid_par_priv->bytes_rw = poid_par_priv->information_buf_len; } else { @@ -384,34 +384,34 @@ NDIS_STATUS oid_rt_get_rx_total_packet_hdl(struct oid_par_priv* poid_par_priv) //------------------------------------------------------------------------------ NDIS_STATUS oid_rt_get_tx_beacon_ok_hdl(struct oid_par_priv* poid_par_priv) { - NDIS_STATUS status = NDIS_STATUS_SUCCESS; + NDIS_STATUS status = NDIS_STATUS_SUCCESS; PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context); if(poid_par_priv->type_of_oid != QUERY_OID) { status = NDIS_STATUS_NOT_ACCEPTED; return status; - } + } return status; } NDIS_STATUS oid_rt_get_tx_beacon_err_hdl(struct oid_par_priv* poid_par_priv) { - NDIS_STATUS status = NDIS_STATUS_SUCCESS; + NDIS_STATUS status = NDIS_STATUS_SUCCESS; PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context); if(poid_par_priv->type_of_oid != QUERY_OID) { status = NDIS_STATUS_NOT_ACCEPTED; return status; - } + } return status; } //------------------------------------------------------------------------------ NDIS_STATUS oid_rt_get_rx_icv_err_hdl(struct oid_par_priv* poid_par_priv) { - NDIS_STATUS status = NDIS_STATUS_SUCCESS; + NDIS_STATUS status = NDIS_STATUS_SUCCESS; PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context); if(poid_par_priv->type_of_oid != QUERY_OID) @@ -429,46 +429,46 @@ NDIS_STATUS oid_rt_get_rx_icv_err_hdl(struct oid_par_priv* poid_par_priv) { status = NDIS_STATUS_INVALID_LENGTH ; } - + return status; } //------------------------------------------------------------------------------ NDIS_STATUS oid_rt_set_encryption_algorithm_hdl(struct oid_par_priv* poid_par_priv) { - NDIS_STATUS status = NDIS_STATUS_SUCCESS; + NDIS_STATUS status = NDIS_STATUS_SUCCESS; PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context); if(poid_par_priv->type_of_oid != SET_OID) { status = NDIS_STATUS_NOT_ACCEPTED; return status; - } + } return status; } //------------------------------------------------------------------------------ NDIS_STATUS oid_rt_get_preamble_mode_hdl(struct oid_par_priv* poid_par_priv) { - NDIS_STATUS status = NDIS_STATUS_SUCCESS; + NDIS_STATUS status = NDIS_STATUS_SUCCESS; PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context); - ULONG preamblemode = 0 ; - + ULONG preamblemode = 0 ; + if(poid_par_priv->type_of_oid != QUERY_OID) { status = NDIS_STATUS_NOT_ACCEPTED; return status; - } + } if(poid_par_priv->information_buf_len>= sizeof(ULONG)) - { + { if(padapter->registrypriv.preamble == PREAMBLE_LONG) preamblemode = 0; else if (padapter->registrypriv.preamble == PREAMBLE_AUTO) preamblemode = 1; else if (padapter->registrypriv.preamble == PREAMBLE_SHORT) preamblemode = 2; - - + + *(ULONG *)poid_par_priv->information_buf = preamblemode ; *poid_par_priv->bytes_rw = poid_par_priv->information_buf_len; } @@ -481,29 +481,29 @@ NDIS_STATUS oid_rt_get_preamble_mode_hdl(struct oid_par_priv* poid_par_priv) //------------------------------------------------------------------------------ NDIS_STATUS oid_rt_get_ap_ip_hdl(struct oid_par_priv* poid_par_priv) { - NDIS_STATUS status = NDIS_STATUS_SUCCESS; + NDIS_STATUS status = NDIS_STATUS_SUCCESS; PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context); if(poid_par_priv->type_of_oid != QUERY_OID) { status = NDIS_STATUS_NOT_ACCEPTED; return status; - } + } return status; } NDIS_STATUS oid_rt_get_channelplan_hdl(struct oid_par_priv* poid_par_priv) { - NDIS_STATUS status = NDIS_STATUS_SUCCESS; + NDIS_STATUS status = NDIS_STATUS_SUCCESS; PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context); - struct eeprom_priv* peeprompriv = &padapter->eeprompriv; + struct eeprom_priv* peeprompriv = &padapter->eeprompriv; if(poid_par_priv->type_of_oid != QUERY_OID) { status = NDIS_STATUS_NOT_ACCEPTED; return status; - } + } *poid_par_priv->bytes_rw = poid_par_priv->information_buf_len; *(u16 *)poid_par_priv->information_buf = peeprompriv->channel_plan ; @@ -511,16 +511,16 @@ NDIS_STATUS oid_rt_get_channelplan_hdl(struct oid_par_priv* poid_par_priv) } NDIS_STATUS oid_rt_set_channelplan_hdl(struct oid_par_priv* poid_par_priv) { - NDIS_STATUS status = NDIS_STATUS_SUCCESS; + NDIS_STATUS status = NDIS_STATUS_SUCCESS; PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context); - struct eeprom_priv* peeprompriv = &padapter->eeprompriv; - + struct eeprom_priv* peeprompriv = &padapter->eeprompriv; + if(poid_par_priv->type_of_oid != SET_OID) { status = NDIS_STATUS_NOT_ACCEPTED; return status; - } - + } + peeprompriv->channel_plan = *(u16 *)poid_par_priv->information_buf ; return status; @@ -528,7 +528,7 @@ NDIS_STATUS oid_rt_set_channelplan_hdl(struct oid_par_priv* poid_par_priv) //------------------------------------------------------------------------------ NDIS_STATUS oid_rt_set_preamble_mode_hdl(struct oid_par_priv* poid_par_priv) { - NDIS_STATUS status = NDIS_STATUS_SUCCESS; + NDIS_STATUS status = NDIS_STATUS_SUCCESS; PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context); ULONG preamblemode = 0; if(poid_par_priv->type_of_oid != SET_OID) @@ -536,31 +536,31 @@ NDIS_STATUS oid_rt_set_preamble_mode_hdl(struct oid_par_priv* poid_par_priv) status = NDIS_STATUS_NOT_ACCEPTED; return status; } - + if(poid_par_priv->information_buf_len>= sizeof(ULONG)) - { + { preamblemode = *(ULONG *)poid_par_priv->information_buf ; if( preamblemode == 0) padapter->registrypriv.preamble = PREAMBLE_LONG; else if (preamblemode==1 ) padapter->registrypriv.preamble = PREAMBLE_AUTO; else if ( preamblemode==2 ) - padapter->registrypriv.preamble = PREAMBLE_SHORT; - + padapter->registrypriv.preamble = PREAMBLE_SHORT; + *(ULONG *)poid_par_priv->information_buf = preamblemode ; *poid_par_priv->bytes_rw = poid_par_priv->information_buf_len; } else { status = NDIS_STATUS_INVALID_LENGTH ; - } + } return status; } //------------------------------------------------------------------------------ NDIS_STATUS oid_rt_set_bcn_intvl_hdl(struct oid_par_priv* poid_par_priv) { - NDIS_STATUS status = NDIS_STATUS_SUCCESS; + NDIS_STATUS status = NDIS_STATUS_SUCCESS; PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context); if(poid_par_priv->type_of_oid != SET_OID) @@ -573,7 +573,7 @@ NDIS_STATUS oid_rt_set_bcn_intvl_hdl(struct oid_par_priv* poid_par_priv) } NDIS_STATUS oid_rt_dedicate_probe_hdl(struct oid_par_priv* poid_par_priv) { - NDIS_STATUS status = NDIS_STATUS_SUCCESS; + NDIS_STATUS status = NDIS_STATUS_SUCCESS; PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context); return status; @@ -581,16 +581,16 @@ NDIS_STATUS oid_rt_dedicate_probe_hdl(struct oid_par_priv* poid_par_priv) //------------------------------------------------------------------------------ NDIS_STATUS oid_rt_get_total_tx_bytes_hdl(struct oid_par_priv* poid_par_priv) { - NDIS_STATUS status = NDIS_STATUS_SUCCESS; + NDIS_STATUS status = NDIS_STATUS_SUCCESS; PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context); if(poid_par_priv->type_of_oid != QUERY_OID) { status = NDIS_STATUS_NOT_ACCEPTED; return status; - } + } if(poid_par_priv->information_buf_len>= sizeof(ULONG)) - { + { *(u64 *)poid_par_priv->information_buf = padapter->xmitpriv.tx_bytes; *poid_par_priv->bytes_rw = poid_par_priv->information_buf_len; } @@ -598,7 +598,7 @@ NDIS_STATUS oid_rt_get_total_tx_bytes_hdl(struct oid_par_priv* poid_par_priv) { status = NDIS_STATUS_INVALID_LENGTH ; } - + return status; } @@ -628,40 +628,40 @@ NDIS_STATUS oid_rt_get_total_rx_bytes_hdl(struct oid_par_priv* poid_par_priv) //------------------------------------------------------------------------------ NDIS_STATUS oid_rt_current_tx_power_level_hdl(struct oid_par_priv* poid_par_priv) { - NDIS_STATUS status = NDIS_STATUS_SUCCESS; + NDIS_STATUS status = NDIS_STATUS_SUCCESS; PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context); return status; } NDIS_STATUS oid_rt_get_enc_key_mismatch_count_hdl(struct oid_par_priv* poid_par_priv) { - NDIS_STATUS status = NDIS_STATUS_SUCCESS; + NDIS_STATUS status = NDIS_STATUS_SUCCESS; PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context); if(poid_par_priv->type_of_oid != QUERY_OID) { status = NDIS_STATUS_NOT_ACCEPTED; return status; - } + } return status; } NDIS_STATUS oid_rt_get_enc_key_match_count_hdl(struct oid_par_priv* poid_par_priv) { - NDIS_STATUS status = NDIS_STATUS_SUCCESS; + NDIS_STATUS status = NDIS_STATUS_SUCCESS; PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context); if(poid_par_priv->type_of_oid != QUERY_OID) { status = NDIS_STATUS_NOT_ACCEPTED; return status; - } + } return status; } NDIS_STATUS oid_rt_get_channel_hdl(struct oid_par_priv* poid_par_priv) { - NDIS_STATUS status = NDIS_STATUS_SUCCESS; + NDIS_STATUS status = NDIS_STATUS_SUCCESS; PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context); struct mlme_priv *pmlmepriv = &padapter->mlmepriv; NDIS_802_11_CONFIGURATION *pnic_Config; @@ -673,7 +673,7 @@ NDIS_STATUS oid_rt_get_channel_hdl(struct oid_par_priv* poid_par_priv) { status = NDIS_STATUS_NOT_ACCEPTED; return status; - } + } if ( (check_fwstate(pmlmepriv, _FW_LINKED) == _TRUE) || (check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) == _TRUE)) @@ -683,7 +683,7 @@ NDIS_STATUS oid_rt_get_channel_hdl(struct oid_par_priv* poid_par_priv) channelnum = pnic_Config->DSConfig; *(ULONG *)poid_par_priv->information_buf = channelnum; - + *poid_par_priv->bytes_rw = poid_par_priv->information_buf_len; _func_exit_; @@ -694,79 +694,79 @@ NDIS_STATUS oid_rt_get_channel_hdl(struct oid_par_priv* poid_par_priv) } NDIS_STATUS oid_rt_get_hardware_radio_off_hdl(struct oid_par_priv* poid_par_priv) { - NDIS_STATUS status = NDIS_STATUS_SUCCESS; + NDIS_STATUS status = NDIS_STATUS_SUCCESS; PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context); if(poid_par_priv->type_of_oid != QUERY_OID) { status = NDIS_STATUS_NOT_ACCEPTED; return status; - } + } return status; } NDIS_STATUS oid_rt_get_key_mismatch_hdl(struct oid_par_priv* poid_par_priv) { - NDIS_STATUS status = NDIS_STATUS_SUCCESS; + NDIS_STATUS status = NDIS_STATUS_SUCCESS; PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context); if(poid_par_priv->type_of_oid != QUERY_OID) { status = NDIS_STATUS_NOT_ACCEPTED; return status; - } + } return status; } NDIS_STATUS oid_rt_supported_wireless_mode_hdl(struct oid_par_priv* poid_par_priv) { - NDIS_STATUS status = NDIS_STATUS_SUCCESS; + NDIS_STATUS status = NDIS_STATUS_SUCCESS; PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context); - ULONG ulInfo = 0 ; - //DEBUG_ERR(("<**********************oid_rt_supported_wireless_mode_hdl \n")); + ULONG ulInfo = 0 ; + //DEBUG_ERR(("<**********************oid_rt_supported_wireless_mode_hdl \n")); if(poid_par_priv->type_of_oid != QUERY_OID) { status = NDIS_STATUS_NOT_ACCEPTED; return status; - } + } if(poid_par_priv->information_buf_len >= sizeof(ULONG)){ ulInfo |= 0x0100; //WIRELESS_MODE_B ulInfo |= 0x0200; //WIRELESS_MODE_G ulInfo |= 0x0400; //WIRELESS_MODE_A - *(ULONG *) poid_par_priv->information_buf = ulInfo; - //DEBUG_ERR(("<===oid_rt_supported_wireless_mode %x\n",ulInfo)); + *(ULONG *) poid_par_priv->information_buf = ulInfo; + //DEBUG_ERR(("<===oid_rt_supported_wireless_mode %x\n",ulInfo)); *poid_par_priv->bytes_rw = poid_par_priv->information_buf_len; } else{ status = NDIS_STATUS_INVALID_LENGTH; - } + } return status; } NDIS_STATUS oid_rt_get_channel_list_hdl(struct oid_par_priv* poid_par_priv) { - NDIS_STATUS status = NDIS_STATUS_SUCCESS; + NDIS_STATUS status = NDIS_STATUS_SUCCESS; PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context); if(poid_par_priv->type_of_oid != QUERY_OID) { status = NDIS_STATUS_NOT_ACCEPTED; return status; - } + } return status; } NDIS_STATUS oid_rt_get_scan_in_progress_hdl(struct oid_par_priv* poid_par_priv) { - NDIS_STATUS status = NDIS_STATUS_SUCCESS; + NDIS_STATUS status = NDIS_STATUS_SUCCESS; PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context); if(poid_par_priv->type_of_oid != QUERY_OID) { status = NDIS_STATUS_NOT_ACCEPTED; return status; - } + } return status; } @@ -774,84 +774,84 @@ NDIS_STATUS oid_rt_get_scan_in_progress_hdl(struct oid_par_priv* poid_par_priv) NDIS_STATUS oid_rt_forced_data_rate_hdl(struct oid_par_priv* poid_par_priv) { - NDIS_STATUS status = NDIS_STATUS_SUCCESS; + NDIS_STATUS status = NDIS_STATUS_SUCCESS; PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context); return status; } NDIS_STATUS oid_rt_wireless_mode_for_scan_list_hdl(struct oid_par_priv* poid_par_priv) { - NDIS_STATUS status = NDIS_STATUS_SUCCESS; + NDIS_STATUS status = NDIS_STATUS_SUCCESS; PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context); return status; } NDIS_STATUS oid_rt_get_bss_wireless_mode_hdl(struct oid_par_priv* poid_par_priv) { - NDIS_STATUS status = NDIS_STATUS_SUCCESS; + NDIS_STATUS status = NDIS_STATUS_SUCCESS; PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context); if(poid_par_priv->type_of_oid != QUERY_OID) { status = NDIS_STATUS_NOT_ACCEPTED; return status; - } + } return status; } NDIS_STATUS oid_rt_scan_with_magic_packet_hdl(struct oid_par_priv* poid_par_priv) { - NDIS_STATUS status = NDIS_STATUS_SUCCESS; + NDIS_STATUS status = NDIS_STATUS_SUCCESS; PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context); return status; } -//************** oid_rtl_seg_01_01 section end ************** +//************** oid_rtl_seg_01_01 section end ************** -//************** oid_rtl_seg_01_03 section start ************** +//************** oid_rtl_seg_01_03 section start ************** NDIS_STATUS oid_rt_ap_get_associated_station_list_hdl(struct oid_par_priv* poid_par_priv) { - NDIS_STATUS status = NDIS_STATUS_SUCCESS; + NDIS_STATUS status = NDIS_STATUS_SUCCESS; PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context); if(poid_par_priv->type_of_oid != QUERY_OID) { status = NDIS_STATUS_NOT_ACCEPTED; return status; - } + } return status; } NDIS_STATUS oid_rt_ap_switch_into_ap_mode_hdl(struct oid_par_priv* poid_par_priv) { - NDIS_STATUS status = NDIS_STATUS_SUCCESS; + NDIS_STATUS status = NDIS_STATUS_SUCCESS; PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context); return status; } NDIS_STATUS oid_rt_ap_supported_hdl(struct oid_par_priv* poid_par_priv) { - NDIS_STATUS status = NDIS_STATUS_SUCCESS; + NDIS_STATUS status = NDIS_STATUS_SUCCESS; PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context); return status; } NDIS_STATUS oid_rt_ap_set_passphrase_hdl(struct oid_par_priv* poid_par_priv) { - NDIS_STATUS status = NDIS_STATUS_SUCCESS; + NDIS_STATUS status = NDIS_STATUS_SUCCESS; PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context); if(poid_par_priv->type_of_oid != SET_OID) { status = NDIS_STATUS_NOT_ACCEPTED; return status; - } + } return status; } -//************** oid_rtl_seg_01_03 section end ************** +//************** oid_rtl_seg_01_03 section end ************** //**************** oid_rtl_seg_01_11 section start **************** NDIS_STATUS oid_rt_pro_rf_write_registry_hdl(struct oid_par_priv* poid_par_priv) @@ -866,27 +866,27 @@ NDIS_STATUS oid_rt_pro_rf_write_registry_hdl(struct oid_par_priv* poid_par_priv) status = NDIS_STATUS_NOT_ACCEPTED; return status; } - + _irqlevel_changed_(&oldirql,LOWER); if(poid_par_priv->information_buf_len== (sizeof(unsigned long)*3)) - { + { //RegOffsetValue - The offset of RF register to write. //RegDataWidth - The data width of RF register to write. - //RegDataValue - The value to write. + //RegDataValue - The value to write. //RegOffsetValue = *((unsigned long*)InformationBuffer); - //RegDataWidth = *((unsigned long*)InformationBuffer+1); - //RegDataValue = *((unsigned long*)InformationBuffer+2); - if(!rtw_setrfreg_cmd(Adapter, - *(unsigned char*)poid_par_priv->information_buf, + //RegDataWidth = *((unsigned long*)InformationBuffer+1); + //RegDataValue = *((unsigned long*)InformationBuffer+2); + if(!rtw_setrfreg_cmd(Adapter, + *(unsigned char*)poid_par_priv->information_buf, (unsigned long)(*((unsigned long*)poid_par_priv->information_buf+2)))) { status = NDIS_STATUS_NOT_ACCEPTED; } - + } else{ status = NDIS_STATUS_INVALID_LENGTH; - } + } _irqlevel_changed_(&oldirql,RAISE); _func_exit_; @@ -907,8 +907,8 @@ NDIS_STATUS oid_rt_pro_rf_read_registry_hdl(struct oid_par_priv* poid_par_priv) { status = NDIS_STATUS_NOT_ACCEPTED; return status; - } - + } + _irqlevel_changed_(&oldirql,LOWER); if(poid_par_priv->information_buf_len== (sizeof(unsigned long)*3)) { @@ -922,24 +922,24 @@ NDIS_STATUS oid_rt_pro_rf_read_registry_hdl(struct oid_par_priv* poid_par_priv) Adapter->mppriv.act_in_progress = _TRUE; Adapter->mppriv.workparam.bcompleted= _FALSE; Adapter->mppriv.workparam.act_type = MPT_READ_RF; - Adapter->mppriv.workparam.io_offset = *(unsigned long*)poid_par_priv->information_buf; + Adapter->mppriv.workparam.io_offset = *(unsigned long*)poid_par_priv->information_buf; Adapter->mppriv.workparam.io_value = 0xcccccccc; - + //RegOffsetValue - The offset of RF register to read. //RegDataWidth - The data width of RF register to read. - //RegDataValue - The value to read. + //RegDataValue - The value to read. //RegOffsetValue = *((unsigned long*)InformationBuffer); - //RegDataWidth = *((unsigned long*)InformationBuffer+1); - //RegDataValue = *((unsigned long*)InformationBuffer+2); - if(!rtw_getrfreg_cmd(Adapter, - *(unsigned char*)poid_par_priv->information_buf, + //RegDataWidth = *((unsigned long*)InformationBuffer+1); + //RegDataValue = *((unsigned long*)InformationBuffer+2); + if(!rtw_getrfreg_cmd(Adapter, + *(unsigned char*)poid_par_priv->information_buf, (unsigned char*)&Adapter->mppriv.workparam.io_value)) { status = NDIS_STATUS_NOT_ACCEPTED; } } - - + + } else { status = NDIS_STATUS_INVALID_LENGTH; @@ -950,10 +950,10 @@ NDIS_STATUS oid_rt_pro_rf_read_registry_hdl(struct oid_par_priv* poid_par_priv) return status; } -//**************** oid_rtl_seg_01_11 section end**************** +//**************** oid_rtl_seg_01_11 section end**************** -//************** oid_rtl_seg_03_00 section start ************** +//************** oid_rtl_seg_03_00 section start ************** enum _CONNECT_STATE_{ CHECKINGSTATUS, ASSOCIATED, @@ -969,21 +969,21 @@ NDIS_STATUS oid_rt_get_connect_state_hdl(struct oid_par_priv* poid_par_priv) struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); ULONG ulInfo; - + if(poid_par_priv->type_of_oid != QUERY_OID) { status = NDIS_STATUS_NOT_ACCEPTED; return status; - } + } // nStatus==0 CheckingStatus // nStatus==1 Associated // nStatus==2 AdHocMode // nStatus==3 NotAssociated - + if(check_fwstate(pmlmepriv, _FW_UNDER_LINKING) == _TRUE) ulInfo = CHECKINGSTATUS; - else if(check_fwstate(pmlmepriv, _FW_LINKED) == _TRUE) + else if(check_fwstate(pmlmepriv, _FW_LINKED) == _TRUE) ulInfo = ASSOCIATED; else if(check_fwstate(pmlmepriv, WIFI_ADHOC_STATE)== _TRUE) ulInfo = ADHOCMODE; @@ -1013,7 +1013,7 @@ NDIS_STATUS oid_rt_get_connect_state_hdl(struct oid_par_priv* poid_par_priv) NDIS_STATUS oid_rt_set_default_key_id_hdl(struct oid_par_priv* poid_par_priv) { - NDIS_STATUS status = NDIS_STATUS_SUCCESS; + NDIS_STATUS status = NDIS_STATUS_SUCCESS; PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context); if(poid_par_priv->type_of_oid != SET_OID) @@ -1021,8 +1021,7 @@ NDIS_STATUS oid_rt_set_default_key_id_hdl(struct oid_par_priv* poid_par_priv) status = NDIS_STATUS_NOT_ACCEPTED; return status; } - + return status; } -//************** oid_rtl_seg_03_00 section end ************** - +//************** oid_rtl_seg_03_00 section end ************** diff --git a/core/rtw_ioctl_set.c b/core/rtw_ioctl_set.c index cee20f2..25c5020 100755 --- a/core/rtw_ioctl_set.c +++ b/core/rtw_ioctl_set.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Copyright(c) 2007 - 2012 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. @@ -54,7 +54,7 @@ u8 rtw_validate_bssid(u8 *bssid) if (is_zero_mac_addr(bssid) || is_broadcast_mac_addr(bssid) || is_multicast_mac_addr(bssid) - ) { + ) { ret = _FALSE; } @@ -66,7 +66,7 @@ u8 rtw_validate_ssid(NDIS_802_11_SSID *ssid) u8 i; u8 ret=_TRUE; -_func_enter_; +_func_enter_; if (ssid->SsidLength > 32) { RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_err_, ("ssid length >32\n")); @@ -86,7 +86,7 @@ _func_enter_; } #endif /* CONFIG_VALIDATE_SSID */ -exit: +exit: _func_exit_; @@ -112,7 +112,7 @@ _func_enter_; RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_info_,("\n rtw_do_join: phead = %p; plist = %p \n\n\n", phead, plist)); pmlmepriv->cur_network.join_res = -2; - + set_fwstate(pmlmepriv, _FW_UNDER_LINKING); pmlmepriv->pscanned = plist; @@ -120,13 +120,13 @@ _func_enter_; pmlmepriv->to_join = _TRUE; if(_rtw_queue_empty(queue)== _TRUE) - { + { _exit_critical_bh(&(pmlmepriv->scanned_queue.lock), &irqL); _clr_fwstate_(pmlmepriv, _FW_UNDER_LINKING); - + //when set_ssid/set_bssid for rtw_do_join(), but scanning queue is empty - //we try to issue sitesurvey firstly - + //we try to issue sitesurvey firstly + if (pmlmepriv->LinkDetectInfo.bBusyTraffic ==_FALSE || rtw_to_roaming(padapter) > 0 ) @@ -143,10 +143,10 @@ _func_enter_; pmlmepriv->to_join = _FALSE; ret = _FAIL; } - + goto exit; - } - else + } + else { int select_ret; _exit_critical_bh(&(pmlmepriv->scanned_queue.lock), &irqL); @@ -155,60 +155,60 @@ _func_enter_; pmlmepriv->to_join = _FALSE; _set_timer(&pmlmepriv->assoc_timer, MAX_JOIN_TIMEOUT); } - else + else { if(check_fwstate(pmlmepriv, WIFI_ADHOC_STATE)==_TRUE) { // submit createbss_cmd to change to a ADHOC_MASTER - //pmlmepriv->lock has been acquired by caller... + //pmlmepriv->lock has been acquired by caller... WLAN_BSSID_EX *pdev_network = &(padapter->registrypriv.dev_network); pmlmepriv->fw_state = WIFI_ADHOC_MASTER_STATE; - + pibss = padapter->registrypriv.dev_network.MacAddress; _rtw_memset(&pdev_network->Ssid, 0, sizeof(NDIS_802_11_SSID)); _rtw_memcpy(&pdev_network->Ssid, &pmlmepriv->assoc_ssid, sizeof(NDIS_802_11_SSID)); - + rtw_update_registrypriv_dev_network(padapter); rtw_generate_random_ibss(pibss); - + if(rtw_createbss_cmd(padapter)!=_SUCCESS) { - RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_err_,("***Error=>do_goin: rtw_createbss_cmd status FAIL*** \n ")); + RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_err_,("***Error=>do_goin: rtw_createbss_cmd status FAIL*** \n ")); ret = _FALSE; goto exit; } - pmlmepriv->to_join = _FALSE; + pmlmepriv->to_join = _FALSE; - RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_info_,("***Error=> rtw_select_and_join_from_scanned_queue FAIL under STA_Mode*** \n ")); + RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_info_,("***Error=> rtw_select_and_join_from_scanned_queue FAIL under STA_Mode*** \n ")); - } + } else - { - // can't associate ; reset under-linking + { + // can't associate ; reset under-linking _clr_fwstate_(pmlmepriv, _FW_UNDER_LINKING); -#if 0 +#if 0 if((check_fwstate(pmlmepriv, WIFI_STATION_STATE) == _TRUE)) { if(_rtw_memcmp(pmlmepriv->cur_network.network.Ssid.Ssid, pmlmepriv->assoc_ssid.Ssid, pmlmepriv->assoc_ssid.SsidLength)) - { + { // for funk to do roaming // funk will reconnect, but funk will not sitesurvey before reconnect RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_info_,("for funk to do roaming")); if(pmlmepriv->sitesurveyctrl.traffic_busy==_FALSE) rtw_sitesurvey_cmd(padapter, &pmlmepriv->assoc_ssid, 1, NULL, 0); } - - } + + } #endif //when set_ssid/set_bssid for rtw_do_join(), but there are no desired bss in scanning queue - //we try to issue sitesurvey firstly + //we try to issue sitesurvey firstly if(pmlmepriv->LinkDetectInfo.bBusyTraffic==_FALSE || rtw_to_roaming(padapter) > 0 ) @@ -218,7 +218,7 @@ _func_enter_; pmlmepriv->to_join = _FALSE; RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_err_,("do_join(): site survey return error\n.")); } - } + } else { ret = _FAIL; @@ -229,24 +229,24 @@ _func_enter_; } } - -exit: - -_func_exit_; - return ret; +exit: + +_func_exit_; + + return ret; } u8 rtw_set_802_11_bssid(struct adapter* padapter, u8 *bssid) -{ - _irqL irqL; +{ + _irqL irqL; u8 status=_SUCCESS; u32 cur_time = 0; struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - + _func_enter_; - + DBG_871X_LEVEL(_drv_always_, "set bssid:%pM\n", bssid); if ((bssid[0]==0x00 && bssid[1]==0x00 && bssid[2]==0x00 && bssid[3]==0x00 && bssid[4]==0x00 &&bssid[5]==0x00) || @@ -255,7 +255,7 @@ _func_enter_; status = _FAIL; goto exit; } - + _enter_critical_bh(&pmlmepriv->lock, &irqL); @@ -271,7 +271,7 @@ _func_enter_; RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_info_, ("set_bssid: _FW_LINKED||WIFI_ADHOC_MASTER_STATE\n")); if (_rtw_memcmp(&pmlmepriv->cur_network.network.MacAddress, bssid, ETH_ALEN) == _TRUE) - { + { if (check_fwstate(pmlmepriv, WIFI_STATION_STATE) == _FALSE) goto release_mlme_lock;//it means driver is in WIFI_ADHOC_MASTER_STATE, we needn't create bss again. } else { @@ -289,7 +289,7 @@ _func_enter_; if ((check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) == _TRUE)) { _clr_fwstate_(pmlmepriv, WIFI_ADHOC_MASTER_STATE); set_fwstate(pmlmepriv, WIFI_ADHOC_STATE); - } + } } } @@ -303,7 +303,7 @@ handle_tkip_countermeasure: pmlmepriv->assoc_by_bssid=_TRUE; if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY) == _TRUE) { - pmlmepriv->to_join = _TRUE; + pmlmepriv->to_join = _TRUE; } else { status = rtw_do_join(padapter); @@ -311,29 +311,29 @@ handle_tkip_countermeasure: release_mlme_lock: _exit_critical_bh(&pmlmepriv->lock, &irqL); - + exit: RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_err_, ("rtw_set_802_11_bssid: status=%d\n", status)); - + _func_exit_; return status; } u8 rtw_set_802_11_ssid(struct adapter* padapter, NDIS_802_11_SSID *ssid) -{ +{ _irqL irqL; u8 status = _SUCCESS; u32 cur_time = 0; struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct wlan_network *pnetwork = &pmlmepriv->cur_network; - + _func_enter_; - + DBG_871X_LEVEL(_drv_always_, "set ssid [%s] fw_state=0x%08x\n", - ssid->Ssid, get_fwstate(pmlmepriv)); + ssid->Ssid, get_fwstate(pmlmepriv)); if(padapter->hw_init_completed==_FALSE){ RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_err_, @@ -341,11 +341,11 @@ _func_enter_; status = _FAIL; goto exit; } - + _enter_critical_bh(&pmlmepriv->lock, &irqL); DBG_871X("Set SSID under fw_state=0x%08x\n", get_fwstate(pmlmepriv)); - if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY) == _TRUE) { + if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY) == _TRUE) { goto handle_tkip_countermeasure; } else if (check_fwstate(pmlmepriv, _FW_UNDER_LINKING) == _TRUE) { goto release_mlme_lock; @@ -358,7 +358,7 @@ _func_enter_; if ((pmlmepriv->assoc_ssid.SsidLength == ssid->SsidLength) && (_rtw_memcmp(&pmlmepriv->assoc_ssid.Ssid, ssid->Ssid, ssid->SsidLength) == _TRUE)) - { + { if((check_fwstate(pmlmepriv, WIFI_STATION_STATE) == _FALSE)) { RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_err_, @@ -366,13 +366,13 @@ _func_enter_; get_fwstate(pmlmepriv))); if(rtw_is_same_ibss(padapter, pnetwork) == _FALSE) - { + { //if in WIFI_ADHOC_MASTER_STATE | WIFI_ADHOC_STATE, create bss or rejoin again rtw_disassoc_cmd(padapter, 0, _TRUE); if (check_fwstate(pmlmepriv, _FW_LINKED) == _TRUE) rtw_indicate_disconnect(padapter); - + rtw_free_assoc_resources(padapter, 1); if (check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) == _TRUE) { @@ -401,14 +401,14 @@ _func_enter_; if (check_fwstate(pmlmepriv, _FW_LINKED) == _TRUE) rtw_indicate_disconnect(padapter); - + rtw_free_assoc_resources(padapter, 1); if (check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) == _TRUE) { _clr_fwstate_(pmlmepriv, WIFI_ADHOC_MASTER_STATE); set_fwstate(pmlmepriv, WIFI_ADHOC_STATE); } - } + } } handle_tkip_countermeasure: @@ -426,7 +426,7 @@ handle_tkip_countermeasure: pmlmepriv->assoc_by_bssid=_FALSE; if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY) == _TRUE) { - pmlmepriv->to_join = _TRUE; + pmlmepriv->to_join = _TRUE; } else { status = rtw_do_join(padapter); @@ -438,11 +438,11 @@ release_mlme_lock: exit: RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_err_, ("-rtw_set_802_11_ssid: status=%d\n", status)); - + _func_exit_; return status; - + } u8 rtw_set_802_11_connect(struct adapter* padapter, u8 *bssid, NDIS_802_11_SSID *ssid) @@ -502,7 +502,7 @@ handle_tkip_countermeasure: } if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY) == _TRUE) { - pmlmepriv->to_join = _TRUE; + pmlmepriv->to_join = _TRUE; } else { status = rtw_do_join(padapter); @@ -512,38 +512,38 @@ release_mlme_lock: _exit_critical_bh(&pmlmepriv->lock, &irqL); exit: - + _func_exit_; return status; } -u8 rtw_set_802_11_infrastructure_mode(struct adapter* padapter, +u8 rtw_set_802_11_infrastructure_mode(struct adapter* padapter, NDIS_802_11_NETWORK_INFRASTRUCTURE networktype) { _irqL irqL; struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct wlan_network *cur_network = &pmlmepriv->cur_network; NDIS_802_11_NETWORK_INFRASTRUCTURE* pold_state = &(cur_network->network.InfrastructureMode); - + _func_enter_; RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_notice_, ("+rtw_set_802_11_infrastructure_mode: old=%d new=%d fw_state=0x%08x\n", *pold_state, networktype, get_fwstate(pmlmepriv))); - + if(*pold_state != networktype) { _enter_critical_bh(&pmlmepriv->lock, &irqL); - + RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_info_,(" change mode!")); //DBG_871X("change mode, old_mode=%d, new_mode=%d, fw_state=0x%x\n", *pold_state, networktype, get_fwstate(pmlmepriv)); if(*pold_state==Ndis802_11APMode) - { - //change to other mode from Ndis802_11APMode + { + //change to other mode from Ndis802_11APMode cur_network->join_res = -1; - + #ifdef CONFIG_NATIVEAP_MLME stop_ap_mode(padapter); #endif @@ -559,41 +559,41 @@ _func_enter_; if((*pold_state == Ndis802_11Infrastructure) ||(*pold_state == Ndis802_11IBSS)) { if(check_fwstate(pmlmepriv, _FW_LINKED) == _TRUE) - { + { rtw_indicate_disconnect(padapter); //will clr Linked_state; before this function, we must have chked whether issue dis-assoc_cmd or not } } - + *pold_state = networktype; _clr_fwstate_(pmlmepriv, ~WIFI_NULL_STATE); - + switch(networktype) { case Ndis802_11IBSS: set_fwstate(pmlmepriv, WIFI_ADHOC_STATE); break; - + case Ndis802_11Infrastructure: set_fwstate(pmlmepriv, WIFI_STATION_STATE); break; - + case Ndis802_11APMode: set_fwstate(pmlmepriv, WIFI_AP_STATE); #ifdef CONFIG_NATIVEAP_MLME start_ap_mode(padapter); //rtw_indicate_connect(padapter); -#endif - +#endif + break; case Ndis802_11AutoUnknown: case Ndis802_11InfrastructureMax: - break; + break; } //SecClearAllKeys(adapter); - + //RT_TRACE(COMP_OID_SET, DBG_LOUD, ("set_infrastructure: fw_state:%x after changing mode\n", // get_fwstate(pmlmepriv) )); @@ -623,22 +623,22 @@ _func_enter_; rtw_indicate_disconnect(padapter); //modify for CONFIG_IEEE80211W, none 11w can use it rtw_free_assoc_resources_cmd(padapter); - rtw_pwr_wakeup(padapter); + rtw_pwr_wakeup(padapter); } _exit_critical_bh(&pmlmepriv->lock, &irqL); - + _func_exit_; - return _TRUE; + return _TRUE; } u8 rtw_set_802_11_bssid_list_scan(struct adapter* padapter, NDIS_802_11_SSID *pssid, int ssid_max_num) -{ +{ _irqL irqL; struct mlme_priv *pmlmepriv= &padapter->mlmepriv; u8 res=_TRUE; - + _func_enter_; RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_err_,("+rtw_set_802_11_bssid_list_scan(), fw_state=%x\n", get_fwstate(pmlmepriv))); @@ -652,7 +652,7 @@ _func_enter_; RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_err_,("\n===rtw_set_802_11_bssid_list_scan:hw_init_completed==_FALSE===\n")); goto exit; } - + if ((check_fwstate(pmlmepriv, _FW_UNDER_SURVEY|_FW_UNDER_LINKING) == _TRUE) || (pmlmepriv->LinkDetectInfo.bBusyTraffic == _TRUE)) { @@ -665,55 +665,55 @@ _func_enter_; } else { RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_err_,("\n###pmlmepriv->sitesurveyctrl.traffic_busy==_TRUE\n\n")); } - } else { + } else { if (rtw_is_scan_deny(padapter)) { DBG_871X(FUNC_ADPT_FMT": scan deny\n", FUNC_ADPT_ARG(padapter)); indicate_wx_scan_complete_event(padapter); return _SUCCESS; } - - _enter_critical_bh(&pmlmepriv->lock, &irqL); - + + _enter_critical_bh(&pmlmepriv->lock, &irqL); + res = rtw_sitesurvey_cmd(padapter, pssid, ssid_max_num, NULL, 0); - + _exit_critical_bh(&pmlmepriv->lock, &irqL); } exit: - + _func_exit_; - return res; + return res; } -u8 rtw_set_802_11_authentication_mode(struct adapter* padapter, NDIS_802_11_AUTHENTICATION_MODE authmode) +u8 rtw_set_802_11_authentication_mode(struct adapter* padapter, NDIS_802_11_AUTHENTICATION_MODE authmode) { struct security_priv *psecuritypriv = &padapter->securitypriv; int res; u8 ret; - + _func_enter_; RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_info_,("set_802_11_auth.mode(): mode=%x\n", authmode)); psecuritypriv->ndisauthtype=authmode; - + RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_info_,("rtw_set_802_11_authentication_mode:psecuritypriv->ndisauthtype=%d", psecuritypriv->ndisauthtype)); - + if(psecuritypriv->ndisauthtype>3) psecuritypriv->dot11AuthAlgrthm=dot11AuthAlgrthm_8021X; - + #ifdef CONFIG_WAPI_SUPPORT if(psecuritypriv->ndisauthtype == 6) psecuritypriv->dot11AuthAlgrthm=dot11AuthAlgrthm_WAPI; #endif res=rtw_set_auth(padapter,psecuritypriv); - + if(res==_SUCCESS) ret=_TRUE; else ret=_FALSE; - + _func_exit_; return ret; @@ -739,7 +739,7 @@ _func_enter_; ret=_FALSE; goto exit; } - + switch(wep->KeyLength) { case 5: @@ -755,7 +755,7 @@ _func_enter_; RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_info_,("MgntActrtw_set_802_11_add_wep:wep->KeyLength!=5 or 13\n")); break; } - + RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_info_,("rtw_set_802_11_add_wep:befor memcpy, wep->KeyLength=0x%x wep->KeyIndex=0x%x keyid =%x\n",wep->KeyLength,wep->KeyIndex,keyid)); _rtw_memcpy(&(psecuritypriv->dot11DefKey[keyid].skey[0]),&(wep->KeyMaterial),wep->KeyLength); @@ -772,58 +772,58 @@ _func_enter_; psecuritypriv->dot11DefKey[keyid].skey[12])); res=rtw_set_key(padapter,psecuritypriv, keyid, 1,_TRUE); - + if(res==_FAIL) ret= _FALSE; exit: - + _func_exit_; return ret; - + } u8 rtw_set_802_11_remove_wep(struct adapter* padapter, u32 keyindex){ - + u8 ret=_SUCCESS; - + _func_enter_; if (keyindex >= 0x80000000 || padapter == NULL){ - + ret=_FALSE; goto exit; } - else + else { int res; struct security_priv* psecuritypriv=&(padapter->securitypriv); if( keyindex < 4 ){ - + _rtw_memset(&psecuritypriv->dot11DefKey[keyindex], 0, 16); - + res=rtw_set_key(padapter,psecuritypriv,keyindex, 0,_TRUE); - + psecuritypriv->dot11DefKeylen[keyindex]=0; - + if(res==_FAIL) ret=_FAIL; - + } else - { + { ret=_FAIL; } - + } - -exit: - + +exit: + _func_exit_; return ret; - + } u8 rtw_set_802_11_add_key(struct adapter* padapter, NDIS_802_11_KEY *key){ @@ -834,12 +834,12 @@ u8 rtw_set_802_11_add_key(struct adapter* padapter, NDIS_802_11_KEY *key){ u8 bgroup = _FALSE; u8 bgrouptkey = _FALSE;//can be remove later u8 ret=_SUCCESS; - + _func_enter_; if (((key->KeyIndex & 0x80000000) == 0) && ((key->KeyIndex & 0x40000000) > 0)){ - // It is invalid to clear bit 31 and set bit 30. If the miniport driver encounters this combination, + // It is invalid to clear bit 31 and set bit 30. If the miniport driver encounters this combination, // it must fail the request and return NDIS_STATUS_INVALID_DATA. RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_info_,("rtw_set_802_11_add_key: ((key->KeyIndex & 0x80000000) == 0)[=%d] ",(int)(key->KeyIndex & 0x80000000) == 0)); RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_info_,("rtw_set_802_11_add_key:((key->KeyIndex & 0x40000000) > 0)[=%d]" , (int)(key->KeyIndex & 0x40000000) > 0)); @@ -849,11 +849,11 @@ _func_enter_; } if(key->KeyIndex & 0x40000000) - { + { // Pairwise key RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_err_,("OID_802_11_ADD_KEY: +++++ Pairwise key +++++\n")); - + pbssid=get_bssid(&padapter->mlmepriv); stainfo=rtw_get_stainfo(&padapter->stapriv, pbssid); @@ -873,7 +873,7 @@ _func_enter_; if((stainfo!=NULL)){ RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_err_,("rtw_set_802_11_add_key: (stainfo->dot118021XPrivacy ==%d)!\n", stainfo->dot118021XPrivacy)); } - + if(key->KeyIndex & 0x000000FF){ // The key index is specified in the lower 8 bits by values of zero to 255. // The key index should be set to zero for a Pairwise key, and the driver should fail with @@ -904,7 +904,7 @@ _func_enter_; if((encryptionalgo== _AES_)&& (key->KeyLength != 16)) { // For our supplicant, EAPPkt9x.vxd, cannot differentiate TKIP and AES case. if(key->KeyLength == 32) { - key->KeyLength = 16; + key->KeyLength = 16; } else { ret= _FAIL; goto exit; @@ -927,10 +927,10 @@ _func_enter_; RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_err_,("key index: 0x%8x(0x%8x)\n", key->KeyIndex,(key->KeyIndex&0x3))); RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_err_,("key Length: %d\n", key->KeyLength)); RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_err_,("------------------------------------------\n")); - + } - else - { + else + { // Group key - KeyIndex(BIT30==0) RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_err_,("OID_802_11_ADD_KEY: +++++ Group key +++++\n")); @@ -955,19 +955,19 @@ _func_enter_; RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_err_,("Adapter->securitypriv.dot11PrivacyAlgrthm= %x key->KeyLength=%u \n", padapter->securitypriv.dot11PrivacyAlgrthm,key->KeyLength)); break; } - + encryptionalgo=padapter->securitypriv.dot11PrivacyAlgrthm; - + RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_err_,(" Adapter->securitypriv.dot11PrivacyAlgrthm=%x\n", padapter->securitypriv.dot11PrivacyAlgrthm)); - + } - else + else { encryptionalgo=padapter->securitypriv.dot118021XGrpPrivacy; RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_err_,("( Adapter->securitypriv.dot11PrivacyAlgrthm=%x )encryptionalgo(%x)=padapter->securitypriv.dot118021XGrpPrivacy(%x)keylen=%d\n", padapter->securitypriv.dot11PrivacyAlgrthm,encryptionalgo,padapter->securitypriv.dot118021XGrpPrivacy,key->KeyLength)); } - + if((check_fwstate(&padapter->mlmepriv, WIFI_ADHOC_STATE)==_TRUE) && (IS_MAC_ADDRESS_BROADCAST(key->BSSID) == _FALSE)) { RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_err_,(" IBSS but BSSID is not Broadcast Address.\n")); ret= _FAIL; @@ -982,7 +982,7 @@ _func_enter_; goto exit; } else if(encryptionalgo== _AES_ && (key->KeyLength != 16 && key->KeyLength != 32) ) { - + // Check key length for AES // For NDTEST, we allow keylen=32 in this case. 2005.01.27, by rcnjko. RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_err_,("<=== SetInfo, OID_802_11_ADD_KEY: AES GTK KeyLength:%u != 16 or 32\n", key->KeyLength)); @@ -992,7 +992,7 @@ _func_enter_; // Change the key length for EAPPkt9x.vxd. Added by Annie, 2005-11-03. if((encryptionalgo== _AES_) && (key->KeyLength == 32) ) { - key->KeyLength = 16; + key->KeyLength = 16; RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_err_,("AES key length changed: %u\n", key->KeyLength) ); } @@ -1013,36 +1013,36 @@ _func_enter_; RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_err_,("key index: 0x%8x(0x%8x)\n", key->KeyIndex,(key->KeyIndex&0x3))); RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_err_,("key Length: %d\n", key->KeyLength)) ; RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_err_,("------------------------------------------\n")); - - } + + } // If WEP encryption algorithm, just call rtw_set_802_11_add_wep(). if((padapter->securitypriv.dot11AuthAlgrthm !=dot11AuthAlgrthm_8021X)&&(encryptionalgo== _WEP40_ || encryptionalgo== _WEP104_)) { - u8 ret; - u32 keyindex; + u8 ret; + u32 keyindex; u32 len = FIELD_OFFSET(NDIS_802_11_KEY, KeyMaterial) + key->KeyLength; NDIS_802_11_WEP *wep = &padapter->securitypriv.ndiswep; - + RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_err_,("OID_802_11_ADD_KEY: +++++ WEP key +++++\n")); wep->Length = len; keyindex = key->KeyIndex&0x7fffffff; wep->KeyIndex = keyindex ; wep->KeyLength = key->KeyLength; - + RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_err_,("OID_802_11_ADD_KEY:Before memcpy \n")); - _rtw_memcpy(wep->KeyMaterial, key->KeyMaterial, key->KeyLength); + _rtw_memcpy(wep->KeyMaterial, key->KeyMaterial, key->KeyLength); _rtw_memcpy(&(padapter->securitypriv.dot11DefKey[keyindex].skey[0]), key->KeyMaterial, key->KeyLength); - padapter->securitypriv.dot11DefKeylen[keyindex]=key->KeyLength; + padapter->securitypriv.dot11DefKeylen[keyindex]=key->KeyLength; padapter->securitypriv.dot11PrivacyKeyIndex=keyindex; - + ret = rtw_set_802_11_add_wep(padapter, wep); - + goto exit; - + } if(key->KeyIndex & 0x20000000){ @@ -1051,14 +1051,14 @@ _func_enter_; if(bgroup == _TRUE) { NDIS_802_11_KEY_RSC keysrc=key->KeyRSC & 0x00FFFFFFFFFFFFULL; - _rtw_memcpy(&padapter->securitypriv.dot11Grprxpn, &keysrc, 8); - } - else - { - NDIS_802_11_KEY_RSC keysrc=key->KeyRSC & 0x00FFFFFFFFFFFFULL; - _rtw_memcpy(&padapter->securitypriv.dot11Grptxpn, &keysrc, 8); + _rtw_memcpy(&padapter->securitypriv.dot11Grprxpn, &keysrc, 8); } - + else + { + NDIS_802_11_KEY_RSC keysrc=key->KeyRSC & 0x00FFFFFFFFFFFFULL; + _rtw_memcpy(&padapter->securitypriv.dot11Grptxpn, &keysrc, 8); + } + } // Indicate this key idx is used for TX @@ -1066,26 +1066,26 @@ _func_enter_; if(bgroup == _TRUE) // Group transmit key { int res; - + if(bgrouptkey == _TRUE) - { + { padapter->securitypriv.dot118021XGrpKeyid=(u8)key->KeyIndex; } - + if((key->KeyIndex&0x3) == 0){ ret = _FAIL; goto exit; - } - + } + _rtw_memset(&padapter->securitypriv.dot118021XGrpKey[(u8)((key->KeyIndex) & 0x03)], 0, 16); _rtw_memset(&padapter->securitypriv.dot118021XGrptxmickey[(u8)((key->KeyIndex) & 0x03)], 0, 16); _rtw_memset(&padapter->securitypriv.dot118021XGrprxmickey[(u8)((key->KeyIndex) & 0x03)], 0, 16); - + if((key->KeyIndex & 0x10000000)) { _rtw_memcpy(&padapter->securitypriv.dot118021XGrptxmickey[(u8)((key->KeyIndex) & 0x03)], key->KeyMaterial + 16, 8); _rtw_memcpy(&padapter->securitypriv.dot118021XGrprxmickey[(u8)((key->KeyIndex) & 0x03)], key->KeyMaterial + 24, 8); - + RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_err_,("\n rtw_set_802_11_add_key:rx mic :0x%02x:0x%02x:0x%02x:0x%02x:0x%02x:0x%02x:0x%02x:0x%02x\n", padapter->securitypriv.dot118021XGrprxmickey[(u8)((key->KeyIndex) & 0x03)].skey[0],padapter->securitypriv.dot118021XGrprxmickey[(u8)((key->KeyIndex-1) & 0x03)].skey[1], padapter->securitypriv.dot118021XGrprxmickey[(u8)((key->KeyIndex) & 0x03)].skey[2],padapter->securitypriv.dot118021XGrprxmickey[(u8)((key->KeyIndex-1) & 0x03)].skey[3], @@ -1098,56 +1098,56 @@ _func_enter_; { _rtw_memcpy(&padapter->securitypriv.dot118021XGrptxmickey[(u8)((key->KeyIndex) & 0x03)], key->KeyMaterial + 24, 8); _rtw_memcpy(&padapter->securitypriv.dot118021XGrprxmickey[(u8)((key->KeyIndex) & 0x03)], key->KeyMaterial + 16, 8); - + RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_err_,("\n rtw_set_802_11_add_key:rx mic :0x%02x:0x%02x:0x%02x:0x%02x:0x%02x:0x%02x:0x%02x:0x%02x\n", padapter->securitypriv.dot118021XGrprxmickey[(u8)((key->KeyIndex) & 0x03)].skey[0],padapter->securitypriv.dot118021XGrprxmickey[(u8)((key->KeyIndex-1) & 0x03)].skey[1], padapter->securitypriv.dot118021XGrprxmickey[(u8)((key->KeyIndex) & 0x03)].skey[2],padapter->securitypriv.dot118021XGrprxmickey[(u8)((key->KeyIndex-1) & 0x03)].skey[3], padapter->securitypriv.dot118021XGrprxmickey[(u8)((key->KeyIndex) & 0x03)].skey[4],padapter->securitypriv.dot118021XGrprxmickey[(u8)((key->KeyIndex-1) & 0x03)].skey[5], padapter->securitypriv.dot118021XGrprxmickey[(u8)((key->KeyIndex) & 0x03)].skey[6],padapter->securitypriv.dot118021XGrprxmickey[(u8)((key->KeyIndex-1) & 0x03)].skey[7])); RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_err_,("\n rtw_set_802_11_add_key:set Group mic key!!!!!!!!\n")); - + } //set group key by index _rtw_memcpy(&padapter->securitypriv.dot118021XGrpKey[(u8)((key->KeyIndex) & 0x03)], key->KeyMaterial, key->KeyLength); - + key->KeyIndex=key->KeyIndex & 0x03; - + padapter->securitypriv.binstallGrpkey=_TRUE; - + padapter->securitypriv.bcheck_grpkey=_FALSE; - + RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_err_,("reset group key")); - + res=rtw_set_key(padapter,&padapter->securitypriv, key->KeyIndex, 1,_TRUE); if(res==_FAIL) ret= _FAIL; goto exit; - + } else // Pairwise Key { u8 res; - + pbssid=get_bssid(&padapter->mlmepriv); stainfo=rtw_get_stainfo(&padapter->stapriv , pbssid ); - + if(stainfo!=NULL) - { + { _rtw_memset( &stainfo->dot118021x_UncstKey, 0, 16);// clear keybuffer - + _rtw_memcpy(&stainfo->dot118021x_UncstKey, key->KeyMaterial, 16); - + if(encryptionalgo== _TKIP_) { padapter->securitypriv.busetkipkey=_FALSE; - + //_set_timer(&padapter->securitypriv.tkip_timer, 50); - + RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_err_,("\n ==========_set_timer\n")); - + // if TKIP, save the Receive/Transmit MIC key in KeyMaterial[128-255] if((key->KeyIndex & 0x10000000)){ _rtw_memcpy(&stainfo->dot11tkiptxmickey, key->KeyMaterial + 16, 8); @@ -1158,14 +1158,14 @@ _func_enter_; _rtw_memcpy(&stainfo->dot11tkiprxmickey, key->KeyMaterial + 16, 8); } - + } else if(encryptionalgo == _AES_) - { - + { + } - + //Set key to CAM through H2C command if(bgrouptkey)//never go to here { @@ -1176,30 +1176,30 @@ _func_enter_; res=rtw_setstakey_cmd(padapter, (unsigned char *)stainfo, _TRUE, _TRUE); RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_err_,("\n rtw_set_802_11_add_key:rtw_setstakey_cmd(unicast)\n")); } - + if(res ==_FALSE) ret= _FAIL; - + } } exit: - + _func_exit_; - return ret; + return ret; } u8 rtw_set_802_11_remove_key(struct adapter* padapter, NDIS_802_11_REMOVE_KEY *key){ - + uint encryptionalgo; u8 * pbssid; struct sta_info *stainfo; u8 bgroup = (key->KeyIndex & 0x4000000) > 0 ? _FALSE: _TRUE; u8 keyIndex = (u8)key->KeyIndex & 0x03; u8 ret=_SUCCESS; - + _func_enter_; if ((key->KeyIndex & 0xbffffffc) > 0) { @@ -1212,13 +1212,13 @@ _func_enter_; // clear group key by index //NdisZeroMemory(Adapter->MgntInfo.SecurityInfo.KeyBuf[keyIndex], MAX_WEP_KEY_LEN); //Adapter->MgntInfo.SecurityInfo.KeyLen[keyIndex] = 0; - + _rtw_memset(&padapter->securitypriv.dot118021XGrpKey[keyIndex], 0, 16); - + //! \todo Send a H2C Command to Firmware for removing this Key in CAM Entry. - + } else { - + pbssid=get_bssid(&padapter->mlmepriv); stainfo=rtw_get_stainfo(&padapter->stapriv , pbssid ); if(stainfo !=NULL){ @@ -1226,7 +1226,7 @@ _func_enter_; // clear key by BSSID _rtw_memset(&stainfo->dot118021x_UncstKey, 0, 16); - + //! \todo Send a H2C Command to Firmware for disable this Key in CAM Entry. } @@ -1237,17 +1237,17 @@ _func_enter_; } exit: - + _func_exit_; return _TRUE; - + } /* -* rtw_get_cur_max_rate - +* rtw_get_cur_max_rate - * @adapter: pointer to struct adapter structure -* +* * Return 0 or 100Kbps */ u16 rtw_get_cur_max_rate(struct adapter *adapter) @@ -1265,10 +1265,10 @@ u16 rtw_get_cur_max_rate(struct adapter *adapter) u8 rf_type = 0; u8 bw_40MHz=0, short_GI_20=0, short_GI_40=0; u16 mcs_rate=0; - u32 ht_ielen = 0; + u32 ht_ielen = 0; #endif - if((check_fwstate(pmlmepriv, _FW_LINKED) != _TRUE) + if((check_fwstate(pmlmepriv, _FW_LINKED) != _TRUE) && (check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) != _TRUE)) return 0; @@ -1278,13 +1278,13 @@ u16 rtw_get_cur_max_rate(struct adapter *adapter) if(p && ht_ielen>0) { pht_capie = (struct rtw_ieee80211_ht_cap *)(p+2); - + _rtw_memcpy(&mcs_rate , pht_capie->supp_mcs_set, 2); //bw_40MHz = (pht_capie->cap_info&IEEE80211_HT_CAP_SUP_WIDTH) ? 1:0; //cur_bwmod is updated by beacon, pmlmeinfo is updated by association response bw_40MHz = (pmlmeext->cur_bwmode && (HT_INFO_HT_PARAM_REC_TRANS_CHNL_WIDTH & pmlmeinfo->HT_info.infos[0])) ? 1:0; - + //short_GI = (pht_capie->cap_info&(IEEE80211_HT_CAP_SGI_20|IEEE80211_HT_CAP_SGI_40)) ? 1:0; short_GI_20 = (pmlmeinfo->HT_caps.u.HT_cap_element.HT_caps_info&IEEE80211_HT_CAP_SGI_20) ? 1:0; short_GI_40 = (pmlmeinfo->HT_caps.u.HT_cap_element.HT_caps_info&IEEE80211_HT_CAP_SGI_40) ? 1:0; @@ -1292,13 +1292,13 @@ u16 rtw_get_cur_max_rate(struct adapter *adapter) rtw_hal_get_hwreg(adapter, HW_VAR_RF_TYPE, (u8 *)(&rf_type)); max_rate = rtw_mcs_rate( rf_type, - bw_40MHz & (pregistrypriv->cbw40_enable), + bw_40MHz & (pregistrypriv->cbw40_enable), short_GI_20, short_GI_40, pmlmeinfo->HT_caps.u.HT_cap_element.MCS_rate ); } - } + } else #endif //CONFIG_80211N_HT { @@ -1309,7 +1309,7 @@ u16 rtw_get_cur_max_rate(struct adapter *adapter) max_rate = rate; i++; } - + max_rate = max_rate*10/2; } @@ -1317,27 +1317,27 @@ u16 rtw_get_cur_max_rate(struct adapter *adapter) } /* -* rtw_set_scan_mode - +* rtw_set_scan_mode - * @adapter: pointer to struct adapter structure -* @scan_mode: -* +* @scan_mode: +* * Return _SUCCESS or _FAIL */ int rtw_set_scan_mode(struct adapter *adapter, RT_SCAN_TYPE scan_mode) { if(scan_mode != SCAN_ACTIVE && scan_mode != SCAN_PASSIVE) return _FAIL; - + adapter->mlmepriv.scan_mode = scan_mode; return _SUCCESS; } /* -* rtw_set_channel_plan - +* rtw_set_channel_plan - * @adapter: pointer to struct adapter structure -* @channel_plan: -* +* @channel_plan: +* * Return _SUCCESS or _FAIL */ int rtw_set_channel_plan(struct adapter *adapter, u8 channel_plan) @@ -1350,10 +1350,10 @@ int rtw_set_channel_plan(struct adapter *adapter, u8 channel_plan) } /* -* rtw_set_country - +* rtw_set_country - * @adapter: pointer to struct adapter structure * @country_code: string of country code -* +* * Return _SUCCESS or _FAIL */ int rtw_set_country(struct adapter *adapter, const char *country_code) @@ -1376,7 +1376,6 @@ int rtw_set_country(struct adapter *adapter, const char *country_code) channel_plan = RT_CHANNEL_DOMAIN_GLOBAL_DOAMIN; else DBG_871X("%s unknown country_code:%s\n", __FUNCTION__, country_code); - + return rtw_set_channel_plan(adapter, channel_plan); } - diff --git a/core/rtw_iol.c b/core/rtw_iol.c index f130f59..e0ffb98 100755 --- a/core/rtw_iol.c +++ b/core/rtw_iol.c @@ -1,7 +1,7 @@ /****************************************************************************** * * 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. @@ -34,7 +34,7 @@ struct xmit_frame *rtw_IOL_accquire_xmit_frame(struct adapter *adapter) DBG_871X("%s rtw_alloc_xmitframe return null\n", __FUNCTION__); goto exit; } - + if ((xmitbuf = rtw_alloc_xmitbuf(pxmitpriv)) == NULL) { DBG_871X("%s rtw_alloc_xmitbuf return null\n", __FUNCTION__); @@ -42,7 +42,7 @@ struct xmit_frame *rtw_IOL_accquire_xmit_frame(struct adapter *adapter) xmit_frame=NULL; goto exit; } - + xmit_frame->frame_tag = MGNT_FRAMETAG; xmit_frame->pxmitbuf = xmitbuf; xmit_frame->buf_addr = xmitbuf->pbuf; @@ -50,8 +50,8 @@ struct xmit_frame *rtw_IOL_accquire_xmit_frame(struct adapter *adapter) pattrib = &xmit_frame->attrib; update_mgntframe_attrib(adapter, pattrib); - pattrib->qsel = 0x10;//Beacon - pattrib->subtype = WIFI_BEACON; + pattrib->qsel = 0x10;//Beacon + pattrib->subtype = WIFI_BEACON; pattrib->pktlen = pattrib->last_txcmdsz = 0; #else @@ -93,11 +93,11 @@ int rtw_IOL_append_cmds(struct xmit_frame *xmit_frame, u8 *IOL_cmds, u32 cmd_len pattrib->last_txcmdsz += cmd_len; //DBG_871X("%s ori:%u + cmd_len:%u = %u\n", __FUNCTION__, ori_len, cmd_len, buf_offset+pattrib->pktlen); - + return _SUCCESS; } bool rtw_IOL_applied(struct adapter *adapter) -{ +{ if(1 == adapter->registrypriv.fw_iol) return _TRUE; @@ -137,18 +137,18 @@ int _rtw_IOL_append_WB_cmd(struct xmit_frame *xmit_frame, u16 addr, u8 value, u8 { struct ioreg_cfg cmd = {8,IOREG_CMD_WB_REG,0x0, 0x0,0x0}; - //RTW_PUT_LE16((u8*)&cmd.address, addr); - //RTW_PUT_LE32((u8*)&cmd.value, (u32)value); - cmd.address = cpu_to_le16(addr); + //RTW_PUT_LE16((u8*)&cmd.address, addr); + //RTW_PUT_LE32((u8*)&cmd.value, (u32)value); + cmd.address = cpu_to_le16(addr); cmd.data = cpu_to_le32(value); - + if(mask!=0xFF) { cmd.length = 12; - //RTW_PUT_LE32((u8*)&cmd.mask, (u32)mask); + //RTW_PUT_LE32((u8*)&cmd.mask, (u32)mask); cmd.mask = cpu_to_le32(mask); - } - + } + //DBG_871X("%s addr:0x%04x,value:0x%08x,mask:0x%08x\n", __FUNCTION__, addr,value,mask); return rtw_IOL_append_cmds(xmit_frame, (u8*)&cmd, cmd.length); @@ -158,65 +158,65 @@ int _rtw_IOL_append_WW_cmd(struct xmit_frame *xmit_frame, u16 addr, u16 value, u { struct ioreg_cfg cmd = {8,IOREG_CMD_WW_REG,0x0, 0x0,0x0}; - //RTW_PUT_LE16((u8*)&cmd.address, addr); - //RTW_PUT_LE32((u8*)&cmd.value, (u32)value); - cmd.address = cpu_to_le16(addr); + //RTW_PUT_LE16((u8*)&cmd.address, addr); + //RTW_PUT_LE32((u8*)&cmd.value, (u32)value); + cmd.address = cpu_to_le16(addr); cmd.data = cpu_to_le32(value); - + if(mask!=0xFFFF) { cmd.length = 12; - //RTW_PUT_LE32((u8*)&cmd.mask, (u32)mask); + //RTW_PUT_LE32((u8*)&cmd.mask, (u32)mask); cmd.mask = cpu_to_le32(mask); - } - + } + //DBG_871X("%s addr:0x%04x,value:0x%08x,mask:0x%08x\n", __FUNCTION__, addr,value,mask); return rtw_IOL_append_cmds(xmit_frame, (u8*)&cmd, cmd.length); - + } int _rtw_IOL_append_WD_cmd(struct xmit_frame *xmit_frame, u16 addr, u32 value, u32 mask) { struct ioreg_cfg cmd = {8,IOREG_CMD_WD_REG,0x0, 0x0,0x0}; - //RTW_PUT_LE16((u8*)&cmd.address, addr); - //RTW_PUT_LE32((u8*)&cmd.value, (u32)value); - cmd.address = cpu_to_le16(addr); + //RTW_PUT_LE16((u8*)&cmd.address, addr); + //RTW_PUT_LE32((u8*)&cmd.value, (u32)value); + cmd.address = cpu_to_le16(addr); cmd.data = cpu_to_le32(value); - + if(mask!=0xFFFFFFFF) { cmd.length = 12; - //RTW_PUT_LE32((u8*)&cmd.mask, (u32)mask); + //RTW_PUT_LE32((u8*)&cmd.mask, (u32)mask); cmd.mask = cpu_to_le32(mask); - } - + } + //DBG_871X("%s addr:0x%04x,value:0x%08x,mask:0x%08x\n", __FU2NCTION__, addr,value,mask); return rtw_IOL_append_cmds(xmit_frame, (u8*)&cmd, cmd.length); - + } int _rtw_IOL_append_WRF_cmd(struct xmit_frame *xmit_frame, u8 rf_path, u16 addr, u32 value, u32 mask) { struct ioreg_cfg cmd = {8,IOREG_CMD_W_RF,0x0, 0x0,0x0}; - //RTW_PUT_LE16((u8*)&cmd.address, addr); - //RTW_PUT_LE32((u8*)&cmd.value, (u32)value); - cmd.address = (rf_path<<8) |((addr) &0xFF); + //RTW_PUT_LE16((u8*)&cmd.address, addr); + //RTW_PUT_LE32((u8*)&cmd.value, (u32)value); + cmd.address = (rf_path<<8) |((addr) &0xFF); cmd.data = cpu_to_le32(value); - + if(mask!=0x000FFFFF) { cmd.length = 12; - //RTW_PUT_LE32((u8*)&cmd.mask, (u32)mask); + //RTW_PUT_LE32((u8*)&cmd.mask, (u32)mask); cmd.mask = cpu_to_le32(mask); - } - + } + //DBG_871X("%s rf_path:0x%02x addr:0x%04x,value:0x%08x,mask:0x%08x\n", __FU2NCTION__,rf_path, addr,value,mask); return rtw_IOL_append_cmds(xmit_frame, (u8*)&cmd, cmd.length); - + } @@ -224,8 +224,8 @@ int _rtw_IOL_append_WRF_cmd(struct xmit_frame *xmit_frame, u8 rf_path, u16 addr, int rtw_IOL_append_DELAY_US_cmd(struct xmit_frame *xmit_frame, u16 us) { struct ioreg_cfg cmd = {4,IOREG_CMD_DELAY_US,0x0, 0x0,0x0}; - //RTW_PUT_LE16((u8*)&cmd.address, us); - cmd.address = cpu_to_le16(us); + //RTW_PUT_LE16((u8*)&cmd.address, us); + cmd.address = cpu_to_le16(us); //DBG_871X("%s %u\n", __FUNCTION__, us); return rtw_IOL_append_cmds(xmit_frame, (u8*)&cmd, 4); @@ -235,29 +235,29 @@ int rtw_IOL_append_DELAY_MS_cmd(struct xmit_frame *xmit_frame, u16 ms) { struct ioreg_cfg cmd = {4,IOREG_CMD_DELAY_US,0x0, 0x0,0x0}; - //RTW_PUT_LE16((u8*)&cmd.address, ms); - cmd.address = cpu_to_le16(ms); + //RTW_PUT_LE16((u8*)&cmd.address, ms); + cmd.address = cpu_to_le16(ms); //DBG_871X("%s %u\n", __FUNCTION__, ms); return rtw_IOL_append_cmds(xmit_frame, (u8*)&cmd, 4); } int rtw_IOL_append_END_cmd(struct xmit_frame *xmit_frame) -{ +{ struct ioreg_cfg cmd = {4,IOREG_CMD_END,0xFFFF, 0xFF,0x0}; return rtw_IOL_append_cmds(xmit_frame, (u8*)&cmd, 4); } u8 rtw_IOL_cmd_boundary_handle(struct xmit_frame *pxmit_frame) -{ +{ u8 is_cmd_bndy = _FALSE; if(((pxmit_frame->attrib.pktlen+32)%256) + 8 >= 256){ rtw_IOL_append_END_cmd(pxmit_frame); pxmit_frame->attrib.pktlen = ((((pxmit_frame->attrib.pktlen+32)/256)+1)*256 ); - + //printk("==> %s, pktlen(%d)\n",__FUNCTION__,pxmit_frame->attrib.pktlen); pxmit_frame->attrib.last_txcmdsz = pxmit_frame->attrib.pktlen; - is_cmd_bndy = _TRUE; + is_cmd_bndy = _TRUE; } return is_cmd_bndy; } @@ -266,23 +266,23 @@ void rtw_IOL_cmd_buf_dump(struct adapter *Adapter,int buf_len,u8 *pbuf) { int i; int j=1; - + printk("###### %s ######\n",__FUNCTION__); for(i=0;i< buf_len;i++){ printk("%02x-",*(pbuf+i)); - - if(j%32 ==0) printk("\n");j++; + + if(j%32 ==0) printk("\n");j++; } printk("\n"); - printk("============= ioreg_cmd len = %d =============== \n",buf_len); + printk("============= ioreg_cmd len = %d =============== \n",buf_len); } #else //CONFIG_IOL_NEW_GENERATION int rtw_IOL_append_LLT_cmd(struct xmit_frame *xmit_frame, u8 page_boundary) -{ +{ IOL_CMD cmd = {0x0, IOL_CMD_LLT, 0x0, 0x0}; - + RTW_PUT_BE32((u8*)&cmd.value, (u32)page_boundary); return rtw_IOL_append_cmds(xmit_frame, (u8*)&cmd, 8); @@ -291,7 +291,7 @@ int rtw_IOL_append_LLT_cmd(struct xmit_frame *xmit_frame, u8 page_boundary) int _rtw_IOL_append_WB_cmd(struct xmit_frame *xmit_frame, u16 addr, u8 value) { IOL_CMD cmd = {0x0, IOL_CMD_WB_REG, 0x0, 0x0}; - + RTW_PUT_BE16((u8*)&cmd.address, (u16)addr); RTW_PUT_BE32((u8*)&cmd.value, (u32)value); @@ -301,7 +301,7 @@ int _rtw_IOL_append_WB_cmd(struct xmit_frame *xmit_frame, u16 addr, u8 value) int _rtw_IOL_append_WW_cmd(struct xmit_frame *xmit_frame, u16 addr, u16 value) { IOL_CMD cmd = {0x0, IOL_CMD_WW_REG, 0x0, 0x0}; - + RTW_PUT_BE16((u8*)&cmd.address, (u16)addr); RTW_PUT_BE32((u8*)&cmd.value, (u32)value); @@ -312,7 +312,7 @@ int _rtw_IOL_append_WD_cmd(struct xmit_frame *xmit_frame, u16 addr, u32 value) { IOL_CMD cmd = {0x0, IOL_CMD_WD_REG, 0x0, 0x0}; u8* pos = (u8 *)&cmd; - + RTW_PUT_BE16((u8*)&cmd.address, (u16)addr); RTW_PUT_BE32((u8*)&cmd.value, (u32)value); @@ -348,7 +348,7 @@ int dbg_rtw_IOL_append_WD_cmd(struct xmit_frame *xmit_frame, u16 addr, u32 value int rtw_IOL_append_DELAY_US_cmd(struct xmit_frame *xmit_frame, u16 us) { IOL_CMD cmd = {0x0, IOL_CMD_DELAY_US, 0x0, 0x0}; - + RTW_PUT_BE32((u8*)&cmd.value, (u32)us); //DBG_871X("%s %u\n", __FUNCTION__, us); @@ -359,7 +359,7 @@ int rtw_IOL_append_DELAY_US_cmd(struct xmit_frame *xmit_frame, u16 us) int rtw_IOL_append_DELAY_MS_cmd(struct xmit_frame *xmit_frame, u16 ms) { IOL_CMD cmd = {0x0, IOL_CMD_DELAY_MS, 0x0, 0x0}; - + RTW_PUT_BE32((u8*)&cmd.value, (u32)ms); //DBG_871X("%s %u\n", __FUNCTION__, ms); @@ -368,7 +368,7 @@ int rtw_IOL_append_DELAY_MS_cmd(struct xmit_frame *xmit_frame, u16 ms) } int rtw_IOL_append_END_cmd(struct xmit_frame *xmit_frame) -{ +{ IOL_CMD end_cmd = {0x0, IOL_CMD_END, 0x0, 0x0}; @@ -400,4 +400,3 @@ int rtw_IOL_exec_empty_cmds_sync(struct adapter *adapter, u32 max_wating_ms) #endif //CONFIG_IOL - diff --git a/core/rtw_led.c b/core/rtw_led.c index e301831..1d7b536 100755 --- a/core/rtw_led.c +++ b/core/rtw_led.c @@ -1,2422 +1,2421 @@ -/****************************************************************************** - * - * Copyright(c) 2007 - 2012 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 - * - * - ******************************************************************************/ - -#include - -// -// Description: -// Callback function of LED BlinkTimer, -// it just schedules to corresponding BlinkWorkItem/led_blink_hdl -// -void BlinkTimerCallback(void *data) -{ - PLED_871x pLed = (PLED_871x)data; - struct adapter *padapter = pLed->padapter; - - //DBG_871X("%s\n", __FUNCTION__); - - if( (padapter->bSurpriseRemoved == _TRUE) || ( padapter->bDriverStopped == _TRUE)) - { - //DBG_871X("%s bSurpriseRemoved:%d, bDriverStopped:%d\n", __FUNCTION__, padapter->bSurpriseRemoved, padapter->bDriverStopped); - return; - } - -#if defined(CONFIG_USB_HCI) || defined(CONFIG_SDIO_HCI) - #ifdef CONFIG_LED_HANDLED_BY_CMD_THREAD - rtw_led_blink_cmd(padapter, pLed); - #else - _set_workitem(&(pLed->BlinkWorkItem)); - #endif -#elif defined(CONFIG_PCI_HCI) - BlinkHandler(pLed); -#endif - -} - -#if defined(CONFIG_USB_HCI) || defined(CONFIG_SDIO_HCI) -// -// Description: -// Callback function of LED BlinkWorkItem. -// We dispatch acture LED blink action according to LedStrategy. -// -void BlinkWorkItemCallback(struct work_struct *work) -{ - PLED_871x pLed = container_of(work, LED_871x, BlinkWorkItem); - BlinkHandler(pLed); -} -#endif - -// -// Description: -// Reset status of LED_871x object. -// -void ResetLedStatus(PLED_871x pLed) { - - pLed->CurrLedState = RTW_LED_OFF; // Current LED state. - pLed->bLedOn = _FALSE; // true if LED is ON, false if LED is OFF. - - pLed->bLedBlinkInProgress = _FALSE; // true if it is blinking, false o.w.. - pLed->bLedWPSBlinkInProgress = _FALSE; - - pLed->BlinkTimes = 0; // Number of times to toggle led state for blinking. - pLed->BlinkingLedState = LED_UNKNOWN; // Next state for blinking, either RTW_LED_ON or RTW_LED_OFF are. - -#if defined(CONFIG_USB_HCI) || defined(CONFIG_SDIO_HCI) - pLed->bLedNoLinkBlinkInProgress = _FALSE; - pLed->bLedLinkBlinkInProgress = _FALSE; - pLed->bLedStartToLinkBlinkInProgress = _FALSE; - pLed->bLedScanBlinkInProgress = _FALSE; -#endif -} - - // -// Description: -// Initialize an LED_871x object. -// -void -InitLed871x( - struct adapter *padapter, - PLED_871x pLed, - LED_PIN_871x LedPin - ) -{ - pLed->padapter = padapter; - pLed->LedPin = LedPin; - - ResetLedStatus(pLed); - - _init_timer(&(pLed->BlinkTimer), padapter->pnetdev, BlinkTimerCallback, pLed); - -#if defined(CONFIG_USB_HCI) || defined(CONFIG_SDIO_HCI) - _init_workitem(&(pLed->BlinkWorkItem), BlinkWorkItemCallback, pLed); -#endif -} - - -// -// Description: -// DeInitialize an LED_871x object. -// -void -DeInitLed871x( - PLED_871x pLed - ) -{ -#if defined(CONFIG_USB_HCI) || defined(CONFIG_SDIO_HCI) || defined(CONFIG_GSPI_HCI) - _cancel_workitem_sync(&(pLed->BlinkWorkItem)); -#endif - _cancel_timer_ex(&(pLed->BlinkTimer)); - ResetLedStatus(pLed); -} - - -// -// Description: -// Implementation of LED blinking behavior. -// It toggle off LED and schedule corresponding timer if necessary. -// -#if defined(CONFIG_USB_HCI) || defined(CONFIG_SDIO_HCI) || defined(CONFIG_GSPI_HCI) - -void SwLedOn(struct adapter *padapter, PLED_871x pLed); -void SwLedOff(struct adapter *padapter, PLED_871x pLed); - -#define CONFIG_LED_REMOVE_HAL - -void -SwLedBlink( - PLED_871x pLed - ) -{ - struct adapter *padapter = pLed->padapter; - struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); - u8 bStopBlinking = _FALSE; - - // Change LED according to BlinkingLedState specified. - if( pLed->BlinkingLedState == RTW_LED_ON ) - { - SwLedOn(padapter, pLed); - RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Blinktimes (%d): turn on\n", pLed->BlinkTimes)); - } - else - { - SwLedOff(padapter, pLed); - RT_TRACE(_module_rtl8712_led_c_,_drv_info_,( "Blinktimes (%d): turn off\n", pLed->BlinkTimes)); - } - - // Determine if we shall change LED state again. - pLed->BlinkTimes--; - switch(pLed->CurrLedState) - { - - case LED_BLINK_NORMAL: - if(pLed->BlinkTimes == 0) - { - bStopBlinking = _TRUE; - } - break; - - case LED_BLINK_StartToBlink: - if( check_fwstate(pmlmepriv, _FW_LINKED) && check_fwstate(pmlmepriv, WIFI_STATION_STATE) ) - { - bStopBlinking = _TRUE; - } - if( check_fwstate(pmlmepriv, _FW_LINKED) && - (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE) || check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE)) ) - { - bStopBlinking = _TRUE; - } - else if(pLed->BlinkTimes == 0) - { - bStopBlinking = _TRUE; - } - break; - - case LED_BLINK_WPS: - if( pLed->BlinkTimes == 0 ) - { - bStopBlinking = _TRUE; - } - break; - - - default: - bStopBlinking = _TRUE; - break; - - } - - if(bStopBlinking) - { - //if(adapter_to_pwrctl(padapter)->cpwm >= PS_STATE_S2) - if(0) - { - SwLedOff(padapter, pLed); - } - else if( (check_fwstate(pmlmepriv, _FW_LINKED)== _TRUE) && (pLed->bLedOn == _FALSE)) - { - SwLedOn(padapter, pLed); - } - else if( (check_fwstate(pmlmepriv, _FW_LINKED)== _TRUE) && pLed->bLedOn == _TRUE) - { - SwLedOff(padapter, pLed); - } - - pLed->BlinkTimes = 0; - pLed->bLedBlinkInProgress = _FALSE; - } - else - { - // Assign LED state to toggle. - if( pLed->BlinkingLedState == RTW_LED_ON ) - pLed->BlinkingLedState = RTW_LED_OFF; - else - pLed->BlinkingLedState = RTW_LED_ON; - - // Schedule a timer to toggle LED state. - switch( pLed->CurrLedState ) - { - case LED_BLINK_NORMAL: - _set_timer(&(pLed->BlinkTimer), LED_BLINK_NORMAL_INTERVAL); - break; - - case LED_BLINK_SLOWLY: - case LED_BLINK_StartToBlink: - _set_timer(&(pLed->BlinkTimer), LED_BLINK_SLOWLY_INTERVAL); - break; - - case LED_BLINK_WPS: - { - if( pLed->BlinkingLedState == RTW_LED_ON ) - _set_timer(&(pLed->BlinkTimer), LED_BLINK_LONG_INTERVAL); - else - _set_timer(&(pLed->BlinkTimer), LED_BLINK_LONG_INTERVAL); - } - break; - - default: - _set_timer(&(pLed->BlinkTimer), LED_BLINK_SLOWLY_INTERVAL); - break; - } - } -} - -void -SwLedBlink1( - PLED_871x pLed - ) -{ - struct adapter *padapter = pLed->padapter; -#ifndef CONFIG_LED_REMOVE_HAL - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter); -#endif - struct led_priv *ledpriv = &(padapter->ledpriv); - struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); - PLED_871x pLed1 = &(ledpriv->SwLed1); - u8 bStopBlinking = _FALSE; - -#ifndef CONFIG_LED_REMOVE_HAL - if(pHalData->EEPROMCustomerID == RT_CID_819x_CAMEO) - pLed = &(ledpriv->SwLed1); -#endif - - // Change LED according to BlinkingLedState specified. - if( pLed->BlinkingLedState == RTW_LED_ON ) - { - SwLedOn(padapter, pLed); - RT_TRACE(_module_rtl8712_led_c_,_drv_info_,( "Blinktimes (%d): turn on\n", pLed->BlinkTimes)); - } - else - { - SwLedOff(padapter, pLed); - RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Blinktimes (%d): turn off\n", pLed->BlinkTimes)); - } - -#ifndef CONFIG_LED_REMOVE_HAL - if(pHalData->EEPROMCustomerID == RT_CID_DEFAULT) - { - if(check_fwstate(pmlmepriv, _FW_LINKED)== _TRUE) - { - if(!pLed1->bSWLedCtrl) - { - SwLedOn(padapter, pLed1); - pLed1->bSWLedCtrl = _TRUE; - } - else if(!pLed1->bLedOn) - SwLedOn(padapter, pLed1); - RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Blinktimes (): turn on pLed1\n")); - } - else - { - if(!pLed1->bSWLedCtrl) - { - SwLedOff(padapter, pLed1); - pLed1->bSWLedCtrl = _TRUE; - } - else if(pLed1->bLedOn) - SwLedOff(padapter, pLed1); - RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Blinktimes (): turn off pLed1\n")); - } - } - -#endif - - if(adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on ) - { - SwLedOff(padapter, pLed); - ResetLedStatus(pLed); - return; - } - - switch(pLed->CurrLedState) - { - case LED_BLINK_SLOWLY: - if( pLed->bLedOn ) - pLed->BlinkingLedState = RTW_LED_OFF; - else - pLed->BlinkingLedState = RTW_LED_ON; - _set_timer(&(pLed->BlinkTimer), LED_BLINK_NO_LINK_INTERVAL_ALPHA); - break; - - case LED_BLINK_NORMAL: - if( pLed->bLedOn ) - pLed->BlinkingLedState = RTW_LED_OFF; - else - pLed->BlinkingLedState = RTW_LED_ON; - _set_timer(&(pLed->BlinkTimer), LED_BLINK_LINK_INTERVAL_ALPHA); - break; - - case LED_BLINK_SCAN: - pLed->BlinkTimes--; - if( pLed->BlinkTimes == 0 ) - { - bStopBlinking = _TRUE; - } - - if(bStopBlinking) - { - if(check_fwstate(pmlmepriv, _FW_LINKED)== _TRUE) - { - pLed->bLedLinkBlinkInProgress = _TRUE; - pLed->CurrLedState = LED_BLINK_NORMAL; - if( pLed->bLedOn ) - pLed->BlinkingLedState = RTW_LED_OFF; - else - pLed->BlinkingLedState = RTW_LED_ON; - _set_timer(&(pLed->BlinkTimer), LED_BLINK_LINK_INTERVAL_ALPHA); - RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("CurrLedState %d\n", pLed->CurrLedState)); - - } - else if(check_fwstate(pmlmepriv, _FW_LINKED)== _FALSE) - { - pLed->bLedNoLinkBlinkInProgress = _TRUE; - pLed->CurrLedState = LED_BLINK_SLOWLY; - if( pLed->bLedOn ) - pLed->BlinkingLedState = RTW_LED_OFF; - else - pLed->BlinkingLedState = RTW_LED_ON; - _set_timer(&(pLed->BlinkTimer), LED_BLINK_NO_LINK_INTERVAL_ALPHA); - RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("CurrLedState %d\n", pLed->CurrLedState)); - } - pLed->bLedScanBlinkInProgress = _FALSE; - } - else - { - if( pLed->bLedOn ) - pLed->BlinkingLedState = RTW_LED_OFF; - else - pLed->BlinkingLedState = RTW_LED_ON; - _set_timer(&(pLed->BlinkTimer), LED_BLINK_SCAN_INTERVAL_ALPHA); - } - break; - - case LED_BLINK_TXRX: - pLed->BlinkTimes--; - if( pLed->BlinkTimes == 0 ) - { - bStopBlinking = _TRUE; - } - if(bStopBlinking) - { - if(check_fwstate(pmlmepriv, _FW_LINKED)== _TRUE) - { - pLed->bLedLinkBlinkInProgress = _TRUE; - pLed->CurrLedState = LED_BLINK_NORMAL; - if( pLed->bLedOn ) - pLed->BlinkingLedState = RTW_LED_OFF; - else - pLed->BlinkingLedState = RTW_LED_ON; - _set_timer(&(pLed->BlinkTimer), LED_BLINK_LINK_INTERVAL_ALPHA); - RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("CurrLedState %d\n", pLed->CurrLedState)); - } - else if(check_fwstate(pmlmepriv, _FW_LINKED)== _FALSE) - { - pLed->bLedNoLinkBlinkInProgress = _TRUE; - pLed->CurrLedState = LED_BLINK_SLOWLY; - if( pLed->bLedOn ) - pLed->BlinkingLedState = RTW_LED_OFF; - else - pLed->BlinkingLedState = RTW_LED_ON; - _set_timer(&(pLed->BlinkTimer), LED_BLINK_NO_LINK_INTERVAL_ALPHA); - RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("CurrLedState %d\n", pLed->CurrLedState)); - } - pLed->BlinkTimes = 0; - pLed->bLedBlinkInProgress = _FALSE; - } - else - { - if( pLed->bLedOn ) - pLed->BlinkingLedState = RTW_LED_OFF; - else - pLed->BlinkingLedState = RTW_LED_ON; - _set_timer(&(pLed->BlinkTimer), LED_BLINK_FASTER_INTERVAL_ALPHA); - } - break; - - case LED_BLINK_WPS: - if( pLed->bLedOn ) - pLed->BlinkingLedState = RTW_LED_OFF; - else - pLed->BlinkingLedState = RTW_LED_ON; - _set_timer(&(pLed->BlinkTimer), LED_BLINK_SCAN_INTERVAL_ALPHA); - break; - - case LED_BLINK_WPS_STOP: //WPS success - if(pLed->BlinkingLedState == RTW_LED_ON) - bStopBlinking = _FALSE; - else - bStopBlinking = _TRUE; - - if(bStopBlinking) - { - pLed->bLedLinkBlinkInProgress = _TRUE; - pLed->CurrLedState = LED_BLINK_NORMAL; - if( pLed->bLedOn ) - pLed->BlinkingLedState = RTW_LED_OFF; - else - pLed->BlinkingLedState = RTW_LED_ON; - _set_timer(&(pLed->BlinkTimer), LED_BLINK_LINK_INTERVAL_ALPHA); - RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("CurrLedState %d\n", pLed->CurrLedState)); - - pLed->bLedWPSBlinkInProgress = _FALSE; - } - else - { - pLed->BlinkingLedState = RTW_LED_OFF; - _set_timer(&(pLed->BlinkTimer), LED_BLINK_WPS_SUCESS_INTERVAL_ALPHA); - } - break; - - default: - break; - } - -} - -void -SwLedBlink2( - PLED_871x pLed - ) -{ - struct adapter *padapter = pLed->padapter; - struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); - u8 bStopBlinking = _FALSE; - - // Change LED according to BlinkingLedState specified. - if( pLed->BlinkingLedState == RTW_LED_ON) - { - SwLedOn(padapter, pLed); - RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Blinktimes (%d): turn on\n", pLed->BlinkTimes)); - } - else - { - SwLedOff(padapter, pLed); - RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Blinktimes (%d): turn off\n", pLed->BlinkTimes)); - } - - switch(pLed->CurrLedState) - { - case LED_BLINK_SCAN: - pLed->BlinkTimes--; - if( pLed->BlinkTimes == 0 ) - { - bStopBlinking = _TRUE; - } - - if(bStopBlinking) - { - if( adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on ) - { - SwLedOff(padapter, pLed); - } - else if(check_fwstate(pmlmepriv, _FW_LINKED)== _TRUE) - { - pLed->CurrLedState = RTW_LED_ON; - pLed->BlinkingLedState = RTW_LED_ON; - SwLedOn(padapter, pLed); - RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("stop scan blink CurrLedState %d\n", pLed->CurrLedState)); - - } - else if(check_fwstate(pmlmepriv, _FW_LINKED)== _FALSE) - { - pLed->CurrLedState = RTW_LED_OFF; - pLed->BlinkingLedState = RTW_LED_OFF; - SwLedOff(padapter, pLed); - RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("stop scan blink CurrLedState %d\n", pLed->CurrLedState)); - } - pLed->bLedScanBlinkInProgress = _FALSE; - } - else - { - if( adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on ) - { - SwLedOff(padapter, pLed); - } - else - { - if( pLed->bLedOn ) - pLed->BlinkingLedState = RTW_LED_OFF; - else - pLed->BlinkingLedState = RTW_LED_ON; - _set_timer(&(pLed->BlinkTimer), LED_BLINK_SCAN_INTERVAL_ALPHA); - } - } - break; - - case LED_BLINK_TXRX: - pLed->BlinkTimes--; - if( pLed->BlinkTimes == 0 ) - { - bStopBlinking = _TRUE; - } - if(bStopBlinking) - { - if(adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on ) - { - SwLedOff(padapter, pLed); - } - else if(check_fwstate(pmlmepriv, _FW_LINKED)== _TRUE) - { - pLed->CurrLedState = RTW_LED_ON; - pLed->BlinkingLedState = RTW_LED_ON; - SwLedOn(padapter, pLed); - RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("stop CurrLedState %d\n", pLed->CurrLedState)); - - } - else if(check_fwstate(pmlmepriv, _FW_LINKED)== _FALSE) - { - pLed->CurrLedState = RTW_LED_OFF; - pLed->BlinkingLedState = RTW_LED_OFF; - SwLedOff(padapter, pLed); - RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("stop CurrLedState %d\n", pLed->CurrLedState)); - } - pLed->bLedBlinkInProgress = _FALSE; - } - else - { - if(adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on ) - { - SwLedOff(padapter, pLed); - } - else - { - if( pLed->bLedOn ) - pLed->BlinkingLedState = RTW_LED_OFF; - else - pLed->BlinkingLedState = RTW_LED_ON; - _set_timer(&(pLed->BlinkTimer), LED_BLINK_FASTER_INTERVAL_ALPHA); - } - } - break; - - default: - break; - } - -} - -void -SwLedBlink3( - PLED_871x pLed - ) -{ - struct adapter *padapter = pLed->padapter; - struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); - u8 bStopBlinking = _FALSE; - - // Change LED according to BlinkingLedState specified. - if( pLed->BlinkingLedState == RTW_LED_ON ) - { - SwLedOn(padapter, pLed); - RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Blinktimes (%d): turn on\n", pLed->BlinkTimes)); - } - else - { - if(pLed->CurrLedState != LED_BLINK_WPS_STOP) - SwLedOff(padapter, pLed); - RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Blinktimes (%d): turn off\n", pLed->BlinkTimes)); - } - - switch(pLed->CurrLedState) - { - case LED_BLINK_SCAN: - pLed->BlinkTimes--; - if( pLed->BlinkTimes == 0 ) - { - bStopBlinking = _TRUE; - } - - if(bStopBlinking) - { - if(adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on ) - { - SwLedOff(padapter, pLed); - } - else if(check_fwstate(pmlmepriv, _FW_LINKED)== _TRUE) - { - pLed->CurrLedState = RTW_LED_ON; - pLed->BlinkingLedState = RTW_LED_ON; - if( !pLed->bLedOn ) - SwLedOn(padapter, pLed); - - RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("CurrLedState %d\n", pLed->CurrLedState)); - } - else if(check_fwstate(pmlmepriv, _FW_LINKED)== _FALSE) - { - pLed->CurrLedState = RTW_LED_OFF; - pLed->BlinkingLedState = RTW_LED_OFF; - if( pLed->bLedOn ) - SwLedOff(padapter, pLed); - - RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("CurrLedState %d\n", pLed->CurrLedState)); - } - pLed->bLedScanBlinkInProgress = _FALSE; - } - else - { - if(adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on ) - { - SwLedOff(padapter, pLed); - } - else - { - if( pLed->bLedOn ) - pLed->BlinkingLedState = RTW_LED_OFF; - else - pLed->BlinkingLedState = RTW_LED_ON; - _set_timer(&(pLed->BlinkTimer), LED_BLINK_SCAN_INTERVAL_ALPHA); - } - } - break; - - case LED_BLINK_TXRX: - pLed->BlinkTimes--; - if( pLed->BlinkTimes == 0 ) - { - bStopBlinking = _TRUE; - } - if(bStopBlinking) - { - if(adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on ) - { - SwLedOff(padapter, pLed); - } - else if(check_fwstate(pmlmepriv, _FW_LINKED)== _TRUE) - { - pLed->CurrLedState = RTW_LED_ON; - pLed->BlinkingLedState = RTW_LED_ON; - - if( !pLed->bLedOn ) - SwLedOn(padapter, pLed); - - RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("CurrLedState %d\n", pLed->CurrLedState)); - } - else if(check_fwstate(pmlmepriv, _FW_LINKED)== _FALSE) - { - pLed->CurrLedState = RTW_LED_OFF; - pLed->BlinkingLedState = RTW_LED_OFF; - - if( pLed->bLedOn ) - SwLedOff(padapter, pLed); - - - RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("CurrLedState %d\n", pLed->CurrLedState)); - } - pLed->bLedBlinkInProgress = _FALSE; - } - else - { - if(adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on ) - { - SwLedOff(padapter, pLed); - } - else - { - if( pLed->bLedOn ) - pLed->BlinkingLedState = RTW_LED_OFF; - else - pLed->BlinkingLedState = RTW_LED_ON; - _set_timer(&(pLed->BlinkTimer), LED_BLINK_FASTER_INTERVAL_ALPHA); - } - } - break; - - case LED_BLINK_WPS: - if( pLed->bLedOn ) - pLed->BlinkingLedState = RTW_LED_OFF; - else - pLed->BlinkingLedState = RTW_LED_ON; - _set_timer(&(pLed->BlinkTimer), LED_BLINK_SCAN_INTERVAL_ALPHA); - break; - - case LED_BLINK_WPS_STOP: //WPS success - if(pLed->BlinkingLedState == RTW_LED_ON) - { - pLed->BlinkingLedState = RTW_LED_OFF; - _set_timer(&(pLed->BlinkTimer), LED_BLINK_WPS_SUCESS_INTERVAL_ALPHA); - bStopBlinking = _FALSE; - } - else - { - bStopBlinking = _TRUE; - } - - if(bStopBlinking) - { - if(adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on ) - { - SwLedOff(padapter, pLed); - } - else - { - pLed->CurrLedState = RTW_LED_ON; - pLed->BlinkingLedState = RTW_LED_ON; - SwLedOn(padapter, pLed); - RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("CurrLedState %d\n", pLed->CurrLedState)); - } - pLed->bLedWPSBlinkInProgress = _FALSE; - } - break; - - - default: - break; - } - -} - - -void -SwLedBlink4( - PLED_871x pLed - ) -{ - struct adapter *padapter = pLed->padapter; - struct led_priv *ledpriv = &(padapter->ledpriv); - struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); - PLED_871x pLed1 = &(ledpriv->SwLed1); - u8 bStopBlinking = _FALSE; - - // Change LED according to BlinkingLedState specified. - if( pLed->BlinkingLedState == RTW_LED_ON ) - { - SwLedOn(padapter, pLed); - RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Blinktimes (%d): turn on\n", pLed->BlinkTimes)); - } - else - { - SwLedOff(padapter, pLed); - RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Blinktimes (%d): turn off\n", pLed->BlinkTimes)); - } - - if(!pLed1->bLedWPSBlinkInProgress && pLed1->BlinkingLedState == LED_UNKNOWN) - { - pLed1->BlinkingLedState = RTW_LED_OFF; - pLed1->CurrLedState = RTW_LED_OFF; - SwLedOff(padapter, pLed1); - } - - switch(pLed->CurrLedState) - { - case LED_BLINK_SLOWLY: - if( pLed->bLedOn ) - pLed->BlinkingLedState = RTW_LED_OFF; - else - pLed->BlinkingLedState = RTW_LED_ON; - _set_timer(&(pLed->BlinkTimer), LED_BLINK_NO_LINK_INTERVAL_ALPHA); - break; - - case LED_BLINK_StartToBlink: - if( pLed->bLedOn ) - { - pLed->BlinkingLedState = RTW_LED_OFF; - _set_timer(&(pLed->BlinkTimer), LED_BLINK_SLOWLY_INTERVAL); - } - else - { - pLed->BlinkingLedState = RTW_LED_ON; - _set_timer(&(pLed->BlinkTimer), LED_BLINK_NORMAL_INTERVAL); - } - break; - - case LED_BLINK_SCAN: - pLed->BlinkTimes--; - if( pLed->BlinkTimes == 0 ) - { - bStopBlinking = _FALSE; - } - - if(bStopBlinking) - { - if(adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on && adapter_to_pwrctl(padapter)->rfoff_reason > RF_CHANGE_BY_PS) - { - SwLedOff(padapter, pLed); - } - else - { - pLed->bLedNoLinkBlinkInProgress = _FALSE; - pLed->CurrLedState = LED_BLINK_SLOWLY; - if( pLed->bLedOn ) - pLed->BlinkingLedState = RTW_LED_OFF; - else - pLed->BlinkingLedState = RTW_LED_ON; - _set_timer(&(pLed->BlinkTimer), LED_BLINK_NO_LINK_INTERVAL_ALPHA); - } - pLed->bLedScanBlinkInProgress = _FALSE; - } - else - { - if(adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on && adapter_to_pwrctl(padapter)->rfoff_reason > RF_CHANGE_BY_PS) - { - SwLedOff(padapter, pLed); - } - else - { - if( pLed->bLedOn ) - pLed->BlinkingLedState = RTW_LED_OFF; - else - pLed->BlinkingLedState = RTW_LED_ON; - _set_timer(&(pLed->BlinkTimer), LED_BLINK_SCAN_INTERVAL_ALPHA); - } - } - break; - - case LED_BLINK_TXRX: - pLed->BlinkTimes--; - if( pLed->BlinkTimes == 0 ) - { - bStopBlinking = _TRUE; - } - if(bStopBlinking) - { - if(adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on && adapter_to_pwrctl(padapter)->rfoff_reason > RF_CHANGE_BY_PS) - { - SwLedOff(padapter, pLed); - } - else - { - pLed->bLedNoLinkBlinkInProgress = _TRUE; - pLed->CurrLedState = LED_BLINK_SLOWLY; - if( pLed->bLedOn ) - pLed->BlinkingLedState = RTW_LED_OFF; - else - pLed->BlinkingLedState = RTW_LED_ON; - _set_timer(&(pLed->BlinkTimer), LED_BLINK_NO_LINK_INTERVAL_ALPHA); - } - pLed->bLedBlinkInProgress = _FALSE; - } - else - { - if(adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on && adapter_to_pwrctl(padapter)->rfoff_reason > RF_CHANGE_BY_PS) - { - SwLedOff(padapter, pLed); - } - else - { - if( pLed->bLedOn ) - pLed->BlinkingLedState = RTW_LED_OFF; - else - pLed->BlinkingLedState = RTW_LED_ON; - _set_timer(&(pLed->BlinkTimer), LED_BLINK_FASTER_INTERVAL_ALPHA); - } - } - break; - - case LED_BLINK_WPS: - if( pLed->bLedOn ) - { - pLed->BlinkingLedState = RTW_LED_OFF; - _set_timer(&(pLed->BlinkTimer), LED_BLINK_SLOWLY_INTERVAL); - } - else - { - pLed->BlinkingLedState = RTW_LED_ON; - _set_timer(&(pLed->BlinkTimer), LED_BLINK_NORMAL_INTERVAL); - } - break; - - case LED_BLINK_WPS_STOP: //WPS authentication fail - if( pLed->bLedOn ) - pLed->BlinkingLedState = RTW_LED_OFF; - else - pLed->BlinkingLedState = RTW_LED_ON; - - _set_timer(&(pLed->BlinkTimer), LED_BLINK_NORMAL_INTERVAL); - break; - - case LED_BLINK_WPS_STOP_OVERLAP: //WPS session overlap - pLed->BlinkTimes--; - if(pLed->BlinkTimes == 0) - { - if(pLed->bLedOn) - { - pLed->BlinkTimes = 1; - } - else - { - bStopBlinking = _TRUE; - } - } - - if(bStopBlinking) - { - pLed->BlinkTimes = 10; - pLed->BlinkingLedState = RTW_LED_ON; - _set_timer(&(pLed->BlinkTimer), LED_BLINK_LINK_INTERVAL_ALPHA); - } - else - { - if( pLed->bLedOn ) - pLed->BlinkingLedState = RTW_LED_OFF; - else - pLed->BlinkingLedState = RTW_LED_ON; - - _set_timer(&(pLed->BlinkTimer), LED_BLINK_NORMAL_INTERVAL); - } - break; - - - default: - break; - } - - RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("SwLedBlink4 CurrLedState %d\n", pLed->CurrLedState)); - - -} - -void -SwLedBlink5( - PLED_871x pLed - ) -{ - struct adapter *padapter = pLed->padapter; - struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); - u8 bStopBlinking = _FALSE; - - // Change LED according to BlinkingLedState specified. - if( pLed->BlinkingLedState == RTW_LED_ON ) - { - SwLedOn(padapter, pLed); - RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Blinktimes (%d): turn on\n", pLed->BlinkTimes)); - } - else - { - SwLedOff(padapter, pLed); - RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Blinktimes (%d): turn off\n", pLed->BlinkTimes)); - } - - switch(pLed->CurrLedState) - { - case LED_BLINK_SCAN: - pLed->BlinkTimes--; - if( pLed->BlinkTimes == 0 ) - { - bStopBlinking = _TRUE; - } - - if(bStopBlinking) - { - if(adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on && adapter_to_pwrctl(padapter)->rfoff_reason > RF_CHANGE_BY_PS) - { - pLed->CurrLedState = RTW_LED_OFF; - pLed->BlinkingLedState = RTW_LED_OFF; - if(pLed->bLedOn) - SwLedOff(padapter, pLed); - } - else - { pLed->CurrLedState = RTW_LED_ON; - pLed->BlinkingLedState = RTW_LED_ON; - if(!pLed->bLedOn) - _set_timer(&(pLed->BlinkTimer), LED_BLINK_FASTER_INTERVAL_ALPHA); - } - - pLed->bLedScanBlinkInProgress = _FALSE; - } - else - { - if(adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on && adapter_to_pwrctl(padapter)->rfoff_reason > RF_CHANGE_BY_PS) - { - SwLedOff(padapter, pLed); - } - else - { - if( pLed->bLedOn ) - pLed->BlinkingLedState = RTW_LED_OFF; - else - pLed->BlinkingLedState = RTW_LED_ON; - _set_timer(&(pLed->BlinkTimer), LED_BLINK_SCAN_INTERVAL_ALPHA); - } - } - break; - - - case LED_BLINK_TXRX: - pLed->BlinkTimes--; - if( pLed->BlinkTimes == 0 ) - { - bStopBlinking = _TRUE; - } - - if(bStopBlinking) - { - if(adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on && adapter_to_pwrctl(padapter)->rfoff_reason > RF_CHANGE_BY_PS) - { - pLed->CurrLedState = RTW_LED_OFF; - pLed->BlinkingLedState = RTW_LED_OFF; - if(pLed->bLedOn) - SwLedOff(padapter, pLed); - } - else - { - pLed->CurrLedState = RTW_LED_ON; - pLed->BlinkingLedState = RTW_LED_ON; - if(!pLed->bLedOn) - _set_timer(&(pLed->BlinkTimer), LED_BLINK_FASTER_INTERVAL_ALPHA); - } - - pLed->bLedBlinkInProgress = _FALSE; - } - else - { - if(adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on && adapter_to_pwrctl(padapter)->rfoff_reason > RF_CHANGE_BY_PS) - { - SwLedOff(padapter, pLed); - } - else - { - if( pLed->bLedOn ) - pLed->BlinkingLedState = RTW_LED_OFF; - else - pLed->BlinkingLedState = RTW_LED_ON; - _set_timer(&(pLed->BlinkTimer), LED_BLINK_FASTER_INTERVAL_ALPHA); - } - } - break; - - default: - break; - } - - RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("SwLedBlink5 CurrLedState %d\n", pLed->CurrLedState)); - - -} - -void -SwLedBlink6( - PLED_871x pLed - ) -{ - struct adapter *padapter = pLed->padapter; - struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); - u8 bStopBlinking = _FALSE; - - // Change LED according to BlinkingLedState specified. - if( pLed->BlinkingLedState == RTW_LED_ON ) - { - SwLedOn(padapter, pLed); - RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Blinktimes (%d): turn on\n", pLed->BlinkTimes)); - } - else - { - SwLedOff(padapter, pLed); - RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Blinktimes (%d): turn off\n", pLed->BlinkTimes)); - } - - RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("<==== blink6\n")); -} - -static void -SwLedControlMode0( - struct adapter *padapter, - LED_CTL_MODE LedAction -) -{ - struct led_priv *ledpriv = &(padapter->ledpriv); - PLED_871x pLed = &(ledpriv->SwLed1); - - // Decide led state - switch(LedAction) - { - case LED_CTL_TX: - case LED_CTL_RX: - if( pLed->bLedBlinkInProgress == _FALSE ) - { - pLed->bLedBlinkInProgress = _TRUE; - - pLed->CurrLedState = LED_BLINK_NORMAL; - pLed->BlinkTimes = 2; - - if( pLed->bLedOn ) - pLed->BlinkingLedState = RTW_LED_OFF; - else - pLed->BlinkingLedState = RTW_LED_ON; - _set_timer(&(pLed->BlinkTimer), LED_BLINK_NORMAL_INTERVAL); - } - break; - - case LED_CTL_START_TO_LINK: - if( pLed->bLedBlinkInProgress == _FALSE ) - { - pLed->bLedBlinkInProgress = _TRUE; - - pLed->CurrLedState = LED_BLINK_StartToBlink; - pLed->BlinkTimes = 24; - - if( pLed->bLedOn ) - pLed->BlinkingLedState = RTW_LED_OFF; - else - pLed->BlinkingLedState = RTW_LED_ON; - _set_timer(&(pLed->BlinkTimer), LED_BLINK_SLOWLY_INTERVAL); - } - else - { - pLed->CurrLedState = LED_BLINK_StartToBlink; - } - break; - - case LED_CTL_LINK: - pLed->CurrLedState = RTW_LED_ON; - if( pLed->bLedBlinkInProgress == _FALSE ) - { - SwLedOn(padapter, pLed); - } - break; - - case LED_CTL_NO_LINK: - pLed->CurrLedState = RTW_LED_OFF; - if( pLed->bLedBlinkInProgress == _FALSE ) - { - SwLedOff(padapter, pLed); - } - break; - - case LED_CTL_POWER_OFF: - pLed->CurrLedState = RTW_LED_OFF; - if(pLed->bLedBlinkInProgress) - { - _cancel_timer_ex(&(pLed->BlinkTimer)); - pLed->bLedBlinkInProgress = _FALSE; - } - SwLedOff(padapter, pLed); - break; - - case LED_CTL_START_WPS: - if( pLed->bLedBlinkInProgress == _FALSE || pLed->CurrLedState == RTW_LED_ON) - { - pLed->bLedBlinkInProgress = _TRUE; - - pLed->CurrLedState = LED_BLINK_WPS; - pLed->BlinkTimes = 20; - - if( pLed->bLedOn ) - { - pLed->BlinkingLedState = RTW_LED_OFF; - _set_timer(&(pLed->BlinkTimer), LED_BLINK_LONG_INTERVAL); - } - else - { - pLed->BlinkingLedState = RTW_LED_ON; - _set_timer(&(pLed->BlinkTimer), LED_BLINK_LONG_INTERVAL); - } - } - break; - - case LED_CTL_STOP_WPS: - if(pLed->bLedBlinkInProgress) - { - pLed->CurrLedState = RTW_LED_OFF; - _cancel_timer_ex(&(pLed->BlinkTimer)); - pLed->bLedBlinkInProgress = _FALSE; - } - break; - - - default: - break; - } - - RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Led %d\n", pLed->CurrLedState)); - -} - - //ALPHA, added by chiyoko, 20090106 -static void -SwLedControlMode1( - struct adapter *padapter, - LED_CTL_MODE LedAction -) -{ -#ifndef CONFIG_LED_REMOVE_HAL - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter); -#endif - struct led_priv *ledpriv = &(padapter->ledpriv); - PLED_871x pLed = &(ledpriv->SwLed0); - struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); - -#ifndef CONFIG_LED_REMOVE_HAL - if(pHalData->EEPROMCustomerID == RT_CID_819x_CAMEO) - pLed = &(ledpriv->SwLed1); -#endif - - switch(LedAction) - { - case LED_CTL_POWER_ON: - case LED_CTL_START_TO_LINK: - case LED_CTL_NO_LINK: - if( pLed->bLedNoLinkBlinkInProgress == _FALSE ) - { - if(pLed->CurrLedState == LED_BLINK_SCAN || IS_LED_WPS_BLINKING(pLed)) - { - return; - } - if( pLed->bLedLinkBlinkInProgress == _TRUE ) - { - _cancel_timer_ex(&(pLed->BlinkTimer)); - pLed->bLedLinkBlinkInProgress = _FALSE; - } - if(pLed->bLedBlinkInProgress ==_TRUE) - { - _cancel_timer_ex(&(pLed->BlinkTimer)); - pLed->bLedBlinkInProgress = _FALSE; - } - - pLed->bLedNoLinkBlinkInProgress = _TRUE; - pLed->CurrLedState = LED_BLINK_SLOWLY; - if( pLed->bLedOn ) - pLed->BlinkingLedState = RTW_LED_OFF; - else - pLed->BlinkingLedState = RTW_LED_ON; - _set_timer(&(pLed->BlinkTimer), LED_BLINK_NO_LINK_INTERVAL_ALPHA); - } - break; - - case LED_CTL_LINK: - if( pLed->bLedLinkBlinkInProgress == _FALSE ) - { - if(pLed->CurrLedState == LED_BLINK_SCAN || IS_LED_WPS_BLINKING(pLed)) - { - return; - } - if(pLed->bLedNoLinkBlinkInProgress == _TRUE) - { - _cancel_timer_ex(&(pLed->BlinkTimer)); - pLed->bLedNoLinkBlinkInProgress = _FALSE; - } - if(pLed->bLedBlinkInProgress ==_TRUE) - { - _cancel_timer_ex(&(pLed->BlinkTimer)); - pLed->bLedBlinkInProgress = _FALSE; - } - pLed->bLedLinkBlinkInProgress = _TRUE; - pLed->CurrLedState = LED_BLINK_NORMAL; - if( pLed->bLedOn ) - pLed->BlinkingLedState = RTW_LED_OFF; - else - pLed->BlinkingLedState = RTW_LED_ON; - _set_timer(&(pLed->BlinkTimer), LED_BLINK_LINK_INTERVAL_ALPHA); - } - break; - - case LED_CTL_SITE_SURVEY: - if((pmlmepriv->LinkDetectInfo.bBusyTraffic) && (check_fwstate(pmlmepriv, _FW_LINKED)== _TRUE)) - ; - else if(pLed->bLedScanBlinkInProgress ==_FALSE) - { - if(IS_LED_WPS_BLINKING(pLed)) - return; - - if(pLed->bLedNoLinkBlinkInProgress == _TRUE) - { - _cancel_timer_ex(&(pLed->BlinkTimer)); - pLed->bLedNoLinkBlinkInProgress = _FALSE; - } - if( pLed->bLedLinkBlinkInProgress == _TRUE ) - { - _cancel_timer_ex(&(pLed->BlinkTimer)); - pLed->bLedLinkBlinkInProgress = _FALSE; - } - if(pLed->bLedBlinkInProgress ==_TRUE) - { - _cancel_timer_ex(&(pLed->BlinkTimer)); - pLed->bLedBlinkInProgress = _FALSE; - } - pLed->bLedScanBlinkInProgress = _TRUE; - pLed->CurrLedState = LED_BLINK_SCAN; - pLed->BlinkTimes = 24; - if( pLed->bLedOn ) - pLed->BlinkingLedState = RTW_LED_OFF; - else - pLed->BlinkingLedState = RTW_LED_ON; - _set_timer(&(pLed->BlinkTimer), LED_BLINK_SCAN_INTERVAL_ALPHA); - } - break; - - case LED_CTL_TX: - case LED_CTL_RX: - if(pLed->bLedBlinkInProgress ==_FALSE) - { - if(pLed->CurrLedState == LED_BLINK_SCAN || IS_LED_WPS_BLINKING(pLed)) - { - return; - } - if(pLed->bLedNoLinkBlinkInProgress == _TRUE) - { - _cancel_timer_ex(&(pLed->BlinkTimer)); - pLed->bLedNoLinkBlinkInProgress = _FALSE; - } - if( pLed->bLedLinkBlinkInProgress == _TRUE ) - { - _cancel_timer_ex(&(pLed->BlinkTimer)); - pLed->bLedLinkBlinkInProgress = _FALSE; - } - pLed->bLedBlinkInProgress = _TRUE; - pLed->CurrLedState = LED_BLINK_TXRX; - pLed->BlinkTimes = 2; - if( pLed->bLedOn ) - pLed->BlinkingLedState = RTW_LED_OFF; - else - pLed->BlinkingLedState = RTW_LED_ON; - _set_timer(&(pLed->BlinkTimer), LED_BLINK_FASTER_INTERVAL_ALPHA); - } - break; - - case LED_CTL_START_WPS: //wait until xinpin finish - case LED_CTL_START_WPS_BOTTON: - if(pLed->bLedWPSBlinkInProgress ==_FALSE) - { - if(pLed->bLedNoLinkBlinkInProgress == _TRUE) - { - _cancel_timer_ex(&(pLed->BlinkTimer)); - pLed->bLedNoLinkBlinkInProgress = _FALSE; - } - if( pLed->bLedLinkBlinkInProgress == _TRUE ) - { - _cancel_timer_ex(&(pLed->BlinkTimer)); - pLed->bLedLinkBlinkInProgress = _FALSE; - } - if(pLed->bLedBlinkInProgress ==_TRUE) - { - _cancel_timer_ex(&(pLed->BlinkTimer)); - pLed->bLedBlinkInProgress = _FALSE; - } - if(pLed->bLedScanBlinkInProgress ==_TRUE) - { - _cancel_timer_ex(&(pLed->BlinkTimer)); - pLed->bLedScanBlinkInProgress = _FALSE; - } - pLed->bLedWPSBlinkInProgress = _TRUE; - pLed->CurrLedState = LED_BLINK_WPS; - if( pLed->bLedOn ) - pLed->BlinkingLedState = RTW_LED_OFF; - else - pLed->BlinkingLedState = RTW_LED_ON; - _set_timer(&(pLed->BlinkTimer), LED_BLINK_SCAN_INTERVAL_ALPHA); - } - break; - - - case LED_CTL_STOP_WPS: - if(pLed->bLedNoLinkBlinkInProgress == _TRUE) - { - _cancel_timer_ex(&(pLed->BlinkTimer)); - pLed->bLedNoLinkBlinkInProgress = _FALSE; - } - if( pLed->bLedLinkBlinkInProgress == _TRUE ) - { - _cancel_timer_ex(&(pLed->BlinkTimer)); - pLed->bLedLinkBlinkInProgress = _FALSE; - } - if(pLed->bLedBlinkInProgress ==_TRUE) - { - _cancel_timer_ex(&(pLed->BlinkTimer)); - pLed->bLedBlinkInProgress = _FALSE; - } - if(pLed->bLedScanBlinkInProgress ==_TRUE) - { - _cancel_timer_ex(&(pLed->BlinkTimer)); - pLed->bLedScanBlinkInProgress = _FALSE; - } - if(pLed->bLedWPSBlinkInProgress) - { - _cancel_timer_ex(&(pLed->BlinkTimer)); - } - else - { - pLed->bLedWPSBlinkInProgress = _TRUE; - } - - pLed->CurrLedState = LED_BLINK_WPS_STOP; - if(pLed->bLedOn) - { - pLed->BlinkingLedState = RTW_LED_OFF; - _set_timer(&(pLed->BlinkTimer), LED_BLINK_WPS_SUCESS_INTERVAL_ALPHA); - } - else - { - pLed->BlinkingLedState = RTW_LED_ON; - _set_timer(&(pLed->BlinkTimer), 0); - } - break; - - case LED_CTL_STOP_WPS_FAIL: - if(pLed->bLedWPSBlinkInProgress) - { - _cancel_timer_ex(&(pLed->BlinkTimer)); - pLed->bLedWPSBlinkInProgress = _FALSE; - } - - pLed->bLedNoLinkBlinkInProgress = _TRUE; - pLed->CurrLedState = LED_BLINK_SLOWLY; - if( pLed->bLedOn ) - pLed->BlinkingLedState = RTW_LED_OFF; - else - pLed->BlinkingLedState = RTW_LED_ON; - _set_timer(&(pLed->BlinkTimer), LED_BLINK_NO_LINK_INTERVAL_ALPHA); - break; - - case LED_CTL_POWER_OFF: - pLed->CurrLedState = RTW_LED_OFF; - pLed->BlinkingLedState = RTW_LED_OFF; - if( pLed->bLedNoLinkBlinkInProgress) - { - _cancel_timer_ex(&(pLed->BlinkTimer)); - pLed->bLedNoLinkBlinkInProgress = _FALSE; - } - if( pLed->bLedLinkBlinkInProgress) - { - _cancel_timer_ex(&(pLed->BlinkTimer)); - pLed->bLedLinkBlinkInProgress = _FALSE; - } - if( pLed->bLedBlinkInProgress) - { - _cancel_timer_ex(&(pLed->BlinkTimer)); - pLed->bLedBlinkInProgress = _FALSE; - } - if( pLed->bLedWPSBlinkInProgress ) - { - _cancel_timer_ex(&(pLed->BlinkTimer)); - pLed->bLedWPSBlinkInProgress = _FALSE; - } - if( pLed->bLedScanBlinkInProgress) - { - _cancel_timer_ex(&(pLed->BlinkTimer)); - pLed->bLedScanBlinkInProgress = _FALSE; - } - - SwLedOff(padapter, pLed); - break; - - default: - break; - - } - - RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Led %d\n", pLed->CurrLedState)); -} - - //Arcadyan/Sitecom , added by chiyoko, 20090216 -static void -SwLedControlMode2( - struct adapter *padapter, - LED_CTL_MODE LedAction -) -{ - struct led_priv *ledpriv = &(padapter->ledpriv); - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - PLED_871x pLed = &(ledpriv->SwLed0); - - switch(LedAction) - { - case LED_CTL_SITE_SURVEY: - if(pmlmepriv->LinkDetectInfo.bBusyTraffic) - ; - else if(pLed->bLedScanBlinkInProgress ==_FALSE) - { - if(IS_LED_WPS_BLINKING(pLed)) - return; - - if(pLed->bLedBlinkInProgress ==_TRUE) - { - _cancel_timer_ex(&(pLed->BlinkTimer)); - pLed->bLedBlinkInProgress = _FALSE; - } - pLed->bLedScanBlinkInProgress = _TRUE; - pLed->CurrLedState = LED_BLINK_SCAN; - pLed->BlinkTimes = 24; - if( pLed->bLedOn ) - pLed->BlinkingLedState = RTW_LED_OFF; - else - pLed->BlinkingLedState = RTW_LED_ON; - _set_timer(&(pLed->BlinkTimer), LED_BLINK_SCAN_INTERVAL_ALPHA); - } - break; - - case LED_CTL_TX: - case LED_CTL_RX: - if((pLed->bLedBlinkInProgress ==_FALSE) && (check_fwstate(pmlmepriv, _FW_LINKED)== _TRUE)) - { - if(pLed->CurrLedState == LED_BLINK_SCAN || IS_LED_WPS_BLINKING(pLed)) - { - return; - } - - pLed->bLedBlinkInProgress = _TRUE; - pLed->CurrLedState = LED_BLINK_TXRX; - pLed->BlinkTimes = 2; - if( pLed->bLedOn ) - pLed->BlinkingLedState = RTW_LED_OFF; - else - pLed->BlinkingLedState = RTW_LED_ON; - _set_timer(&(pLed->BlinkTimer), LED_BLINK_FASTER_INTERVAL_ALPHA); - } - break; - - case LED_CTL_LINK: - pLed->CurrLedState = RTW_LED_ON; - pLed->BlinkingLedState = RTW_LED_ON; - if( pLed->bLedBlinkInProgress) - { - _cancel_timer_ex(&(pLed->BlinkTimer)); - pLed->bLedBlinkInProgress = _FALSE; - } - if( pLed->bLedScanBlinkInProgress) - { - _cancel_timer_ex(&(pLed->BlinkTimer)); - pLed->bLedScanBlinkInProgress = _FALSE; - } - - _set_timer(&(pLed->BlinkTimer), 0); - break; - - case LED_CTL_START_WPS: //wait until xinpin finish - case LED_CTL_START_WPS_BOTTON: - if(pLed->bLedWPSBlinkInProgress ==_FALSE) - { - if(pLed->bLedBlinkInProgress ==_TRUE) - { - _cancel_timer_ex(&(pLed->BlinkTimer)); - pLed->bLedBlinkInProgress = _FALSE; - } - if(pLed->bLedScanBlinkInProgress ==_TRUE) - { - _cancel_timer_ex(&(pLed->BlinkTimer)); - pLed->bLedScanBlinkInProgress = _FALSE; - } - pLed->bLedWPSBlinkInProgress = _TRUE; - pLed->CurrLedState = RTW_LED_ON; - pLed->BlinkingLedState = RTW_LED_ON; - _set_timer(&(pLed->BlinkTimer), 0); - } - break; - - case LED_CTL_STOP_WPS: - pLed->bLedWPSBlinkInProgress = _FALSE; - if(adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on) - { - SwLedOff(padapter, pLed); - } - else - { - pLed->CurrLedState = RTW_LED_ON; - pLed->BlinkingLedState = RTW_LED_ON; - _set_timer(&(pLed->BlinkTimer), 0); - RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("CurrLedState %d\n", pLed->CurrLedState)); - } - break; - - case LED_CTL_STOP_WPS_FAIL: - pLed->bLedWPSBlinkInProgress = _FALSE; - if(adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on) - { - SwLedOff(padapter, pLed); - } - else - { - pLed->CurrLedState = RTW_LED_OFF; - pLed->BlinkingLedState = RTW_LED_OFF; - _set_timer(&(pLed->BlinkTimer), 0); - RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("CurrLedState %d\n", pLed->CurrLedState)); - } - break; - - case LED_CTL_START_TO_LINK: - case LED_CTL_NO_LINK: - if(!IS_LED_BLINKING(pLed)) - { - pLed->CurrLedState = RTW_LED_OFF; - pLed->BlinkingLedState = RTW_LED_OFF; - _set_timer(&(pLed->BlinkTimer), 0); - } - break; - - case LED_CTL_POWER_OFF: - pLed->CurrLedState = RTW_LED_OFF; - pLed->BlinkingLedState = RTW_LED_OFF; - if( pLed->bLedBlinkInProgress) - { - _cancel_timer_ex(&(pLed->BlinkTimer)); - pLed->bLedBlinkInProgress = _FALSE; - } - if( pLed->bLedScanBlinkInProgress) - { - _cancel_timer_ex(&(pLed->BlinkTimer)); - pLed->bLedScanBlinkInProgress = _FALSE; - } - if( pLed->bLedWPSBlinkInProgress ) - { - _cancel_timer_ex(&(pLed->BlinkTimer)); - pLed->bLedWPSBlinkInProgress = _FALSE; - } - - _set_timer(&(pLed->BlinkTimer), 0); - break; - - default: - break; - - } - - RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("CurrLedState %d\n", pLed->CurrLedState)); -} - - //COREGA, added by chiyoko, 20090316 - static void - SwLedControlMode3( - struct adapter *padapter, - LED_CTL_MODE LedAction -) -{ - struct led_priv *ledpriv = &(padapter->ledpriv); - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - PLED_871x pLed = &(ledpriv->SwLed0); - - switch(LedAction) - { - case LED_CTL_SITE_SURVEY: - if(pmlmepriv->LinkDetectInfo.bBusyTraffic) - ; - else if(pLed->bLedScanBlinkInProgress ==_FALSE) - { - if(IS_LED_WPS_BLINKING(pLed)) - return; - - if(pLed->bLedBlinkInProgress ==_TRUE) - { - _cancel_timer_ex(&(pLed->BlinkTimer)); - pLed->bLedBlinkInProgress = _FALSE; - } - pLed->bLedScanBlinkInProgress = _TRUE; - pLed->CurrLedState = LED_BLINK_SCAN; - pLed->BlinkTimes = 24; - if( pLed->bLedOn ) - pLed->BlinkingLedState = RTW_LED_OFF; - else - pLed->BlinkingLedState = RTW_LED_ON; - _set_timer(&(pLed->BlinkTimer), LED_BLINK_SCAN_INTERVAL_ALPHA); - } - break; - - case LED_CTL_TX: - case LED_CTL_RX: - if((pLed->bLedBlinkInProgress ==_FALSE) && (check_fwstate(pmlmepriv, _FW_LINKED)== _TRUE)) - { - if(pLed->CurrLedState == LED_BLINK_SCAN || IS_LED_WPS_BLINKING(pLed)) - { - return; - } - - pLed->bLedBlinkInProgress = _TRUE; - pLed->CurrLedState = LED_BLINK_TXRX; - pLed->BlinkTimes = 2; - if( pLed->bLedOn ) - pLed->BlinkingLedState = RTW_LED_OFF; - else - pLed->BlinkingLedState = RTW_LED_ON; - _set_timer(&(pLed->BlinkTimer), LED_BLINK_FASTER_INTERVAL_ALPHA); - } - break; - - case LED_CTL_LINK: - if(IS_LED_WPS_BLINKING(pLed)) - return; - - pLed->CurrLedState = RTW_LED_ON; - pLed->BlinkingLedState = RTW_LED_ON; - if( pLed->bLedBlinkInProgress) - { - _cancel_timer_ex(&(pLed->BlinkTimer)); - pLed->bLedBlinkInProgress = _FALSE; - } - if( pLed->bLedScanBlinkInProgress) - { - _cancel_timer_ex(&(pLed->BlinkTimer)); - pLed->bLedScanBlinkInProgress = _FALSE; - } - - _set_timer(&(pLed->BlinkTimer), 0); - break; - - case LED_CTL_START_WPS: //wait until xinpin finish - case LED_CTL_START_WPS_BOTTON: - if(pLed->bLedWPSBlinkInProgress ==_FALSE) - { - if(pLed->bLedBlinkInProgress ==_TRUE) - { - _cancel_timer_ex(&(pLed->BlinkTimer)); - pLed->bLedBlinkInProgress = _FALSE; - } - if(pLed->bLedScanBlinkInProgress ==_TRUE) - { - _cancel_timer_ex(&(pLed->BlinkTimer)); - pLed->bLedScanBlinkInProgress = _FALSE; - } - pLed->bLedWPSBlinkInProgress = _TRUE; - pLed->CurrLedState = LED_BLINK_WPS; - if( pLed->bLedOn ) - pLed->BlinkingLedState = RTW_LED_OFF; - else - pLed->BlinkingLedState = RTW_LED_ON; - _set_timer(&(pLed->BlinkTimer), LED_BLINK_SCAN_INTERVAL_ALPHA); - } - break; - - case LED_CTL_STOP_WPS: - if(pLed->bLedWPSBlinkInProgress) - { - _cancel_timer_ex(&(pLed->BlinkTimer)); - pLed->bLedWPSBlinkInProgress = _FALSE; - } - else - { - pLed->bLedWPSBlinkInProgress = _TRUE; - } - - pLed->CurrLedState = LED_BLINK_WPS_STOP; - if(pLed->bLedOn) - { - pLed->BlinkingLedState = RTW_LED_OFF; - _set_timer(&(pLed->BlinkTimer), LED_BLINK_WPS_SUCESS_INTERVAL_ALPHA); - } - else - { - pLed->BlinkingLedState = RTW_LED_ON; - _set_timer(&(pLed->BlinkTimer), 0); - } - - break; - - case LED_CTL_STOP_WPS_FAIL: - if(pLed->bLedWPSBlinkInProgress) - { - _cancel_timer_ex(&(pLed->BlinkTimer)); - pLed->bLedWPSBlinkInProgress = _FALSE; - } - - pLed->CurrLedState = RTW_LED_OFF; - pLed->BlinkingLedState = RTW_LED_OFF; - _set_timer(&(pLed->BlinkTimer), 0); - break; - - case LED_CTL_START_TO_LINK: - case LED_CTL_NO_LINK: - if(!IS_LED_BLINKING(pLed)) - { - pLed->CurrLedState = RTW_LED_OFF; - pLed->BlinkingLedState = RTW_LED_OFF; - _set_timer(&(pLed->BlinkTimer), 0); - } - break; - - case LED_CTL_POWER_OFF: - pLed->CurrLedState = RTW_LED_OFF; - pLed->BlinkingLedState = RTW_LED_OFF; - if( pLed->bLedBlinkInProgress) - { - _cancel_timer_ex(&(pLed->BlinkTimer)); - pLed->bLedBlinkInProgress = _FALSE; - } - if( pLed->bLedScanBlinkInProgress) - { - _cancel_timer_ex(&(pLed->BlinkTimer)); - pLed->bLedScanBlinkInProgress = _FALSE; - } - if( pLed->bLedWPSBlinkInProgress ) - { - _cancel_timer_ex(&(pLed->BlinkTimer)); - pLed->bLedWPSBlinkInProgress = _FALSE; - } - - _set_timer(&(pLed->BlinkTimer), 0); - break; - - default: - break; - - } - - RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("CurrLedState %d\n", pLed->CurrLedState)); -} - - - //Edimax-Belkin, added by chiyoko, 20090413 -static void -SwLedControlMode4( - struct adapter *padapter, - LED_CTL_MODE LedAction -) -{ - struct led_priv *ledpriv = &(padapter->ledpriv); - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - PLED_871x pLed = &(ledpriv->SwLed0); - PLED_871x pLed1 = &(ledpriv->SwLed1); - - switch(LedAction) - { - case LED_CTL_START_TO_LINK: - if(pLed1->bLedWPSBlinkInProgress) - { - pLed1->bLedWPSBlinkInProgress = _FALSE; - _cancel_timer_ex(&(pLed1->BlinkTimer)); - - pLed1->BlinkingLedState = RTW_LED_OFF; - pLed1->CurrLedState = RTW_LED_OFF; - - if(pLed1->bLedOn) - _set_timer(&(pLed->BlinkTimer), 0); - } - - if( pLed->bLedStartToLinkBlinkInProgress == _FALSE ) - { - if(pLed->CurrLedState == LED_BLINK_SCAN || IS_LED_WPS_BLINKING(pLed)) - { - return; - } - if(pLed->bLedBlinkInProgress ==_TRUE) - { - _cancel_timer_ex(&(pLed->BlinkTimer)); - pLed->bLedBlinkInProgress = _FALSE; - } - if(pLed->bLedNoLinkBlinkInProgress ==_TRUE) - { - _cancel_timer_ex(&(pLed->BlinkTimer)); - pLed->bLedNoLinkBlinkInProgress = _FALSE; - } - - pLed->bLedStartToLinkBlinkInProgress = _TRUE; - pLed->CurrLedState = LED_BLINK_StartToBlink; - if( pLed->bLedOn ) - { - pLed->BlinkingLedState = RTW_LED_OFF; - _set_timer(&(pLed->BlinkTimer), LED_BLINK_SLOWLY_INTERVAL); - } - else - { - pLed->BlinkingLedState = RTW_LED_ON; - _set_timer(&(pLed->BlinkTimer), LED_BLINK_NORMAL_INTERVAL); - } - } - break; - - case LED_CTL_LINK: - case LED_CTL_NO_LINK: - //LED1 settings - if(LedAction == LED_CTL_LINK) - { - if(pLed1->bLedWPSBlinkInProgress) - { - pLed1->bLedWPSBlinkInProgress = _FALSE; - _cancel_timer_ex(&(pLed1->BlinkTimer)); - - pLed1->BlinkingLedState = RTW_LED_OFF; - pLed1->CurrLedState = RTW_LED_OFF; - - if(pLed1->bLedOn) - _set_timer(&(pLed->BlinkTimer), 0); - } - } - - if( pLed->bLedNoLinkBlinkInProgress == _FALSE ) - { - if(pLed->CurrLedState == LED_BLINK_SCAN || IS_LED_WPS_BLINKING(pLed)) - { - return; - } - if(pLed->bLedBlinkInProgress ==_TRUE) - { - _cancel_timer_ex(&(pLed->BlinkTimer)); - pLed->bLedBlinkInProgress = _FALSE; - } - - pLed->bLedNoLinkBlinkInProgress = _TRUE; - pLed->CurrLedState = LED_BLINK_SLOWLY; - if( pLed->bLedOn ) - pLed->BlinkingLedState = RTW_LED_OFF; - else - pLed->BlinkingLedState = RTW_LED_ON; - _set_timer(&(pLed->BlinkTimer), LED_BLINK_NO_LINK_INTERVAL_ALPHA); - } - break; - - case LED_CTL_SITE_SURVEY: - if((pmlmepriv->LinkDetectInfo.bBusyTraffic) && (check_fwstate(pmlmepriv, _FW_LINKED)== _TRUE)) - ; - else if(pLed->bLedScanBlinkInProgress ==_FALSE) - { - if(IS_LED_WPS_BLINKING(pLed)) - return; - - if(pLed->bLedNoLinkBlinkInProgress == _TRUE) - { - _cancel_timer_ex(&(pLed->BlinkTimer)); - pLed->bLedNoLinkBlinkInProgress = _FALSE; - } - if(pLed->bLedBlinkInProgress ==_TRUE) - { - _cancel_timer_ex(&(pLed->BlinkTimer)); - pLed->bLedBlinkInProgress = _FALSE; - } - pLed->bLedScanBlinkInProgress = _TRUE; - pLed->CurrLedState = LED_BLINK_SCAN; - pLed->BlinkTimes = 24; - if( pLed->bLedOn ) - pLed->BlinkingLedState = RTW_LED_OFF; - else - pLed->BlinkingLedState = RTW_LED_ON; - _set_timer(&(pLed->BlinkTimer), LED_BLINK_SCAN_INTERVAL_ALPHA); - } - break; - - case LED_CTL_TX: - case LED_CTL_RX: - if(pLed->bLedBlinkInProgress ==_FALSE) - { - if(pLed->CurrLedState == LED_BLINK_SCAN || IS_LED_WPS_BLINKING(pLed)) - { - return; - } - if(pLed->bLedNoLinkBlinkInProgress == _TRUE) - { - _cancel_timer_ex(&(pLed->BlinkTimer)); - pLed->bLedNoLinkBlinkInProgress = _FALSE; - } - pLed->bLedBlinkInProgress = _TRUE; - pLed->CurrLedState = LED_BLINK_TXRX; - pLed->BlinkTimes = 2; - if( pLed->bLedOn ) - pLed->BlinkingLedState = RTW_LED_OFF; - else - pLed->BlinkingLedState = RTW_LED_ON; - _set_timer(&(pLed->BlinkTimer), LED_BLINK_FASTER_INTERVAL_ALPHA); - } - break; - - case LED_CTL_START_WPS: //wait until xinpin finish - case LED_CTL_START_WPS_BOTTON: - if(pLed1->bLedWPSBlinkInProgress) - { - pLed1->bLedWPSBlinkInProgress = _FALSE; - _cancel_timer_ex(&(pLed1->BlinkTimer)); - - pLed1->BlinkingLedState = RTW_LED_OFF; - pLed1->CurrLedState = RTW_LED_OFF; - - if(pLed1->bLedOn) - _set_timer(&(pLed->BlinkTimer), 0); - } - - if(pLed->bLedWPSBlinkInProgress ==_FALSE) - { - if(pLed->bLedNoLinkBlinkInProgress == _TRUE) - { - _cancel_timer_ex(&(pLed->BlinkTimer)); - pLed->bLedNoLinkBlinkInProgress = _FALSE; - } - if(pLed->bLedBlinkInProgress ==_TRUE) - { - _cancel_timer_ex(&(pLed->BlinkTimer)); - pLed->bLedBlinkInProgress = _FALSE; - } - if(pLed->bLedScanBlinkInProgress ==_TRUE) - { - _cancel_timer_ex(&(pLed->BlinkTimer)); - pLed->bLedScanBlinkInProgress = _FALSE; - } - pLed->bLedWPSBlinkInProgress = _TRUE; - pLed->CurrLedState = LED_BLINK_WPS; - if( pLed->bLedOn ) - { - pLed->BlinkingLedState = RTW_LED_OFF; - _set_timer(&(pLed->BlinkTimer), LED_BLINK_SLOWLY_INTERVAL); - } - else - { - pLed->BlinkingLedState = RTW_LED_ON; - _set_timer(&(pLed->BlinkTimer), LED_BLINK_NORMAL_INTERVAL); - } - } - break; - - case LED_CTL_STOP_WPS: //WPS connect success - if(pLed->bLedWPSBlinkInProgress) - { - _cancel_timer_ex(&(pLed->BlinkTimer)); - pLed->bLedWPSBlinkInProgress = _FALSE; - } - - pLed->bLedNoLinkBlinkInProgress = _TRUE; - pLed->CurrLedState = LED_BLINK_SLOWLY; - if( pLed->bLedOn ) - pLed->BlinkingLedState = RTW_LED_OFF; - else - pLed->BlinkingLedState = RTW_LED_ON; - _set_timer(&(pLed->BlinkTimer), LED_BLINK_NO_LINK_INTERVAL_ALPHA); - - break; - - case LED_CTL_STOP_WPS_FAIL: //WPS authentication fail - if(pLed->bLedWPSBlinkInProgress) - { - _cancel_timer_ex(&(pLed->BlinkTimer)); - pLed->bLedWPSBlinkInProgress = _FALSE; - } - - pLed->bLedNoLinkBlinkInProgress = _TRUE; - pLed->CurrLedState = LED_BLINK_SLOWLY; - if( pLed->bLedOn ) - pLed->BlinkingLedState = RTW_LED_OFF; - else - pLed->BlinkingLedState = RTW_LED_ON; - _set_timer(&(pLed->BlinkTimer), LED_BLINK_NO_LINK_INTERVAL_ALPHA); - - //LED1 settings - if(pLed1->bLedWPSBlinkInProgress) - _cancel_timer_ex(&(pLed1->BlinkTimer)); - else - pLed1->bLedWPSBlinkInProgress = _TRUE; - - pLed1->CurrLedState = LED_BLINK_WPS_STOP; - if( pLed1->bLedOn ) - pLed1->BlinkingLedState = RTW_LED_OFF; - else - pLed1->BlinkingLedState = RTW_LED_ON; - _set_timer(&(pLed->BlinkTimer), LED_BLINK_NORMAL_INTERVAL); - - break; - - case LED_CTL_STOP_WPS_FAIL_OVERLAP: //WPS session overlap - if(pLed->bLedWPSBlinkInProgress) - { - _cancel_timer_ex(&(pLed->BlinkTimer)); - pLed->bLedWPSBlinkInProgress = _FALSE; - } - - pLed->bLedNoLinkBlinkInProgress = _TRUE; - pLed->CurrLedState = LED_BLINK_SLOWLY; - if( pLed->bLedOn ) - pLed->BlinkingLedState = RTW_LED_OFF; - else - pLed->BlinkingLedState = RTW_LED_ON; - _set_timer(&(pLed->BlinkTimer), LED_BLINK_NO_LINK_INTERVAL_ALPHA); - - //LED1 settings - if(pLed1->bLedWPSBlinkInProgress) - _cancel_timer_ex(&(pLed1->BlinkTimer)); - else - pLed1->bLedWPSBlinkInProgress = _TRUE; - - pLed1->CurrLedState = LED_BLINK_WPS_STOP_OVERLAP; - pLed1->BlinkTimes = 10; - if( pLed1->bLedOn ) - pLed1->BlinkingLedState = RTW_LED_OFF; - else - pLed1->BlinkingLedState = RTW_LED_ON; - _set_timer(&(pLed->BlinkTimer), LED_BLINK_NORMAL_INTERVAL); - - break; - - case LED_CTL_POWER_OFF: - pLed->CurrLedState = RTW_LED_OFF; - pLed->BlinkingLedState = RTW_LED_OFF; - - if( pLed->bLedNoLinkBlinkInProgress) - { - _cancel_timer_ex(&(pLed->BlinkTimer)); - pLed->bLedNoLinkBlinkInProgress = _FALSE; - } - if( pLed->bLedLinkBlinkInProgress) - { - _cancel_timer_ex(&(pLed->BlinkTimer)); - pLed->bLedLinkBlinkInProgress = _FALSE; - } - if( pLed->bLedBlinkInProgress) - { - _cancel_timer_ex(&(pLed->BlinkTimer)); - pLed->bLedBlinkInProgress = _FALSE; - } - if( pLed->bLedWPSBlinkInProgress ) - { - _cancel_timer_ex(&(pLed->BlinkTimer)); - pLed->bLedWPSBlinkInProgress = _FALSE; - } - if( pLed->bLedScanBlinkInProgress) - { - _cancel_timer_ex(&(pLed->BlinkTimer)); - pLed->bLedScanBlinkInProgress = _FALSE; - } - if( pLed->bLedStartToLinkBlinkInProgress) - { - _cancel_timer_ex(&(pLed->BlinkTimer)); - pLed->bLedStartToLinkBlinkInProgress = _FALSE; - } - - if( pLed1->bLedWPSBlinkInProgress ) - { - _cancel_timer_ex(&(pLed1->BlinkTimer)); - pLed1->bLedWPSBlinkInProgress = _FALSE; - } - - pLed1->BlinkingLedState = LED_UNKNOWN; - SwLedOff(padapter, pLed); - SwLedOff(padapter, pLed1); - break; - - default: - break; - - } - - RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Led %d\n", pLed->CurrLedState)); -} - - - - //Sercomm-Belkin, added by chiyoko, 20090415 -static void -SwLedControlMode5( - struct adapter *padapter, - LED_CTL_MODE LedAction -) -{ -#ifndef CONFIG_LED_REMOVE_HAL - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter); -#endif - struct led_priv *ledpriv = &(padapter->ledpriv); - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - PLED_871x pLed = &(ledpriv->SwLed0); - -#ifndef CONFIG_LED_REMOVE_HAL - if(pHalData->EEPROMCustomerID == RT_CID_819x_CAMEO) - pLed = &(ledpriv->SwLed1); -#endif - - switch(LedAction) - { - case LED_CTL_POWER_ON: - case LED_CTL_NO_LINK: - case LED_CTL_LINK: //solid blue - pLed->CurrLedState = RTW_LED_ON; - pLed->BlinkingLedState = RTW_LED_ON; - - _set_timer(&(pLed->BlinkTimer), 0); - break; - - case LED_CTL_SITE_SURVEY: - if((pmlmepriv->LinkDetectInfo.bBusyTraffic) && (check_fwstate(pmlmepriv, _FW_LINKED)== _TRUE)) - ; - else if(pLed->bLedScanBlinkInProgress ==_FALSE) - { - if(pLed->bLedBlinkInProgress ==_TRUE) - { - _cancel_timer_ex(&(pLed->BlinkTimer)); - pLed->bLedBlinkInProgress = _FALSE; - } - pLed->bLedScanBlinkInProgress = _TRUE; - pLed->CurrLedState = LED_BLINK_SCAN; - pLed->BlinkTimes = 24; - if( pLed->bLedOn ) - pLed->BlinkingLedState = RTW_LED_OFF; - else - pLed->BlinkingLedState = RTW_LED_ON; - _set_timer(&(pLed->BlinkTimer), LED_BLINK_SCAN_INTERVAL_ALPHA); - } - break; - - case LED_CTL_TX: - case LED_CTL_RX: - if(pLed->bLedBlinkInProgress ==_FALSE) - { - if(pLed->CurrLedState == LED_BLINK_SCAN) - { - return; - } - pLed->bLedBlinkInProgress = _TRUE; - pLed->CurrLedState = LED_BLINK_TXRX; - pLed->BlinkTimes = 2; - if( pLed->bLedOn ) - pLed->BlinkingLedState = RTW_LED_OFF; - else - pLed->BlinkingLedState = RTW_LED_ON; - _set_timer(&(pLed->BlinkTimer), LED_BLINK_FASTER_INTERVAL_ALPHA); - } - break; - - case LED_CTL_POWER_OFF: - pLed->CurrLedState = RTW_LED_OFF; - pLed->BlinkingLedState = RTW_LED_OFF; - - if( pLed->bLedBlinkInProgress) - { - _cancel_timer_ex(&(pLed->BlinkTimer)); - pLed->bLedBlinkInProgress = _FALSE; - } - - SwLedOff(padapter, pLed); - break; - - default: - break; - - } - - RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Led %d\n", pLed->CurrLedState)); -} - - //WNC-Corega, added by chiyoko, 20090902 -static void -SwLedControlMode6( - struct adapter *padapter, - LED_CTL_MODE LedAction -) -{ - struct led_priv *ledpriv = &(padapter->ledpriv); - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - PLED_871x pLed0 = &(ledpriv->SwLed0); - - switch(LedAction) - { - case LED_CTL_POWER_ON: - case LED_CTL_LINK: - case LED_CTL_NO_LINK: - _cancel_timer_ex(&(pLed0->BlinkTimer)); - pLed0->CurrLedState = RTW_LED_ON; - pLed0->BlinkingLedState = RTW_LED_ON; - _set_timer(&(pLed0->BlinkTimer), 0); - break; - - case LED_CTL_POWER_OFF: - SwLedOff(padapter, pLed0); - break; - - default: - break; - } - - RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("ledcontrol 6 Led %d\n", pLed0->CurrLedState)); -} - -// -// Description: -// Handler function of LED Blinking. -// We dispatch acture LED blink action according to LedStrategy. -// -void BlinkHandler(PLED_871x pLed) -{ - struct adapter *padapter = pLed->padapter; - struct led_priv *ledpriv = &(padapter->ledpriv); - - //DBG_871X("%s (%s:%d)\n",__FUNCTION__, current->comm, current->pid); - - if( (padapter->bSurpriseRemoved == _TRUE) || ( padapter->bDriverStopped == _TRUE)) - { - //DBG_871X("%s bSurpriseRemoved:%d, bDriverStopped:%d\n", __FUNCTION__, padapter->bSurpriseRemoved, padapter->bDriverStopped); - return; - } - - switch(ledpriv->LedStrategy) - { - case SW_LED_MODE0: - SwLedBlink(pLed); - break; - - case SW_LED_MODE1: - SwLedBlink1(pLed); - break; - - case SW_LED_MODE2: - SwLedBlink2(pLed); - break; - - case SW_LED_MODE3: - SwLedBlink3(pLed); - break; - - case SW_LED_MODE4: - SwLedBlink4(pLed); - break; - - case SW_LED_MODE5: - SwLedBlink5(pLed); - break; - - case SW_LED_MODE6: - SwLedBlink6(pLed); - break; - - default: - //RT_TRACE(COMP_LED, DBG_LOUD, ("BlinkWorkItemCallback 0x%x \n", pHalData->LedStrategy)); - //SwLedBlink(pLed); - break; - } -} - -void -LedControl871x( - struct adapter *padapter, - LED_CTL_MODE LedAction - ) -{ - struct led_priv *ledpriv = &(padapter->ledpriv); - - if( (padapter->bSurpriseRemoved == _TRUE) || ( padapter->bDriverStopped == _TRUE) - ||(padapter->hw_init_completed == _FALSE) ) - { - return; - } - - - if( ledpriv->bRegUseLed == _FALSE) - return; - - //if (!priv->up) - // return; - - //if(priv->bInHctTest) - // return; - - if( (adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on && - adapter_to_pwrctl(padapter)->rfoff_reason > RF_CHANGE_BY_PS) && - (LedAction == LED_CTL_TX || LedAction == LED_CTL_RX || - LedAction == LED_CTL_SITE_SURVEY || - LedAction == LED_CTL_LINK || - LedAction == LED_CTL_NO_LINK || - LedAction == LED_CTL_POWER_ON) ) - { - return; - } - - switch(ledpriv->LedStrategy) - { - case SW_LED_MODE0: - //SwLedControlMode0(padapter, LedAction); - break; - - case SW_LED_MODE1: - SwLedControlMode1(padapter, LedAction); - break; - case SW_LED_MODE2: - SwLedControlMode2(padapter, LedAction); - break; - - case SW_LED_MODE3: - SwLedControlMode3(padapter, LedAction); - break; - - case SW_LED_MODE4: - SwLedControlMode4(padapter, LedAction); - break; - - case SW_LED_MODE5: - SwLedControlMode5(padapter, LedAction); - break; - - case SW_LED_MODE6: - SwLedControlMode6(padapter, LedAction); - break; - - default: - break; - } - - RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("LedStrategy:%d, LedAction %d\n", ledpriv->LedStrategy,LedAction)); -} - -#endif - +/****************************************************************************** + * + * Copyright(c) 2007 - 2012 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 + * + * + ******************************************************************************/ + +#include + +// +// Description: +// Callback function of LED BlinkTimer, +// it just schedules to corresponding BlinkWorkItem/led_blink_hdl +// +void BlinkTimerCallback(void *data) +{ + PLED_871x pLed = (PLED_871x)data; + struct adapter *padapter = pLed->padapter; + + //DBG_871X("%s\n", __FUNCTION__); + + if( (padapter->bSurpriseRemoved == _TRUE) || ( padapter->bDriverStopped == _TRUE)) + { + //DBG_871X("%s bSurpriseRemoved:%d, bDriverStopped:%d\n", __FUNCTION__, padapter->bSurpriseRemoved, padapter->bDriverStopped); + return; + } + +#if defined(CONFIG_USB_HCI) || defined(CONFIG_SDIO_HCI) + #ifdef CONFIG_LED_HANDLED_BY_CMD_THREAD + rtw_led_blink_cmd(padapter, pLed); + #else + _set_workitem(&(pLed->BlinkWorkItem)); + #endif +#elif defined(CONFIG_PCI_HCI) + BlinkHandler(pLed); +#endif + +} + +#if defined(CONFIG_USB_HCI) || defined(CONFIG_SDIO_HCI) +// +// Description: +// Callback function of LED BlinkWorkItem. +// We dispatch acture LED blink action according to LedStrategy. +// +void BlinkWorkItemCallback(struct work_struct *work) +{ + PLED_871x pLed = container_of(work, LED_871x, BlinkWorkItem); + BlinkHandler(pLed); +} +#endif + +// +// Description: +// Reset status of LED_871x object. +// +void ResetLedStatus(PLED_871x pLed) { + + pLed->CurrLedState = RTW_LED_OFF; // Current LED state. + pLed->bLedOn = _FALSE; // true if LED is ON, false if LED is OFF. + + pLed->bLedBlinkInProgress = _FALSE; // true if it is blinking, false o.w.. + pLed->bLedWPSBlinkInProgress = _FALSE; + + pLed->BlinkTimes = 0; // Number of times to toggle led state for blinking. + pLed->BlinkingLedState = LED_UNKNOWN; // Next state for blinking, either RTW_LED_ON or RTW_LED_OFF are. + +#if defined(CONFIG_USB_HCI) || defined(CONFIG_SDIO_HCI) + pLed->bLedNoLinkBlinkInProgress = _FALSE; + pLed->bLedLinkBlinkInProgress = _FALSE; + pLed->bLedStartToLinkBlinkInProgress = _FALSE; + pLed->bLedScanBlinkInProgress = _FALSE; +#endif +} + + // +// Description: +// Initialize an LED_871x object. +// +void +InitLed871x( + struct adapter *padapter, + PLED_871x pLed, + LED_PIN_871x LedPin + ) +{ + pLed->padapter = padapter; + pLed->LedPin = LedPin; + + ResetLedStatus(pLed); + + _init_timer(&(pLed->BlinkTimer), padapter->pnetdev, BlinkTimerCallback, pLed); + +#if defined(CONFIG_USB_HCI) || defined(CONFIG_SDIO_HCI) + _init_workitem(&(pLed->BlinkWorkItem), BlinkWorkItemCallback, pLed); +#endif +} + + +// +// Description: +// DeInitialize an LED_871x object. +// +void +DeInitLed871x( + PLED_871x pLed + ) +{ +#if defined(CONFIG_USB_HCI) || defined(CONFIG_SDIO_HCI) || defined(CONFIG_GSPI_HCI) + _cancel_workitem_sync(&(pLed->BlinkWorkItem)); +#endif + _cancel_timer_ex(&(pLed->BlinkTimer)); + ResetLedStatus(pLed); +} + + +// +// Description: +// Implementation of LED blinking behavior. +// It toggle off LED and schedule corresponding timer if necessary. +// +#if defined(CONFIG_USB_HCI) || defined(CONFIG_SDIO_HCI) || defined(CONFIG_GSPI_HCI) + +void SwLedOn(struct adapter *padapter, PLED_871x pLed); +void SwLedOff(struct adapter *padapter, PLED_871x pLed); + +#define CONFIG_LED_REMOVE_HAL + +void +SwLedBlink( + PLED_871x pLed + ) +{ + struct adapter *padapter = pLed->padapter; + struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); + u8 bStopBlinking = _FALSE; + + // Change LED according to BlinkingLedState specified. + if( pLed->BlinkingLedState == RTW_LED_ON ) + { + SwLedOn(padapter, pLed); + RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Blinktimes (%d): turn on\n", pLed->BlinkTimes)); + } + else + { + SwLedOff(padapter, pLed); + RT_TRACE(_module_rtl8712_led_c_,_drv_info_,( "Blinktimes (%d): turn off\n", pLed->BlinkTimes)); + } + + // Determine if we shall change LED state again. + pLed->BlinkTimes--; + switch(pLed->CurrLedState) + { + + case LED_BLINK_NORMAL: + if(pLed->BlinkTimes == 0) + { + bStopBlinking = _TRUE; + } + break; + + case LED_BLINK_StartToBlink: + if( check_fwstate(pmlmepriv, _FW_LINKED) && check_fwstate(pmlmepriv, WIFI_STATION_STATE) ) + { + bStopBlinking = _TRUE; + } + if( check_fwstate(pmlmepriv, _FW_LINKED) && + (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE) || check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE)) ) + { + bStopBlinking = _TRUE; + } + else if(pLed->BlinkTimes == 0) + { + bStopBlinking = _TRUE; + } + break; + + case LED_BLINK_WPS: + if( pLed->BlinkTimes == 0 ) + { + bStopBlinking = _TRUE; + } + break; + + + default: + bStopBlinking = _TRUE; + break; + + } + + if(bStopBlinking) + { + //if(adapter_to_pwrctl(padapter)->cpwm >= PS_STATE_S2) + if(0) + { + SwLedOff(padapter, pLed); + } + else if( (check_fwstate(pmlmepriv, _FW_LINKED)== _TRUE) && (pLed->bLedOn == _FALSE)) + { + SwLedOn(padapter, pLed); + } + else if( (check_fwstate(pmlmepriv, _FW_LINKED)== _TRUE) && pLed->bLedOn == _TRUE) + { + SwLedOff(padapter, pLed); + } + + pLed->BlinkTimes = 0; + pLed->bLedBlinkInProgress = _FALSE; + } + else + { + // Assign LED state to toggle. + if( pLed->BlinkingLedState == RTW_LED_ON ) + pLed->BlinkingLedState = RTW_LED_OFF; + else + pLed->BlinkingLedState = RTW_LED_ON; + + // Schedule a timer to toggle LED state. + switch( pLed->CurrLedState ) + { + case LED_BLINK_NORMAL: + _set_timer(&(pLed->BlinkTimer), LED_BLINK_NORMAL_INTERVAL); + break; + + case LED_BLINK_SLOWLY: + case LED_BLINK_StartToBlink: + _set_timer(&(pLed->BlinkTimer), LED_BLINK_SLOWLY_INTERVAL); + break; + + case LED_BLINK_WPS: + { + if( pLed->BlinkingLedState == RTW_LED_ON ) + _set_timer(&(pLed->BlinkTimer), LED_BLINK_LONG_INTERVAL); + else + _set_timer(&(pLed->BlinkTimer), LED_BLINK_LONG_INTERVAL); + } + break; + + default: + _set_timer(&(pLed->BlinkTimer), LED_BLINK_SLOWLY_INTERVAL); + break; + } + } +} + +void +SwLedBlink1( + PLED_871x pLed + ) +{ + struct adapter *padapter = pLed->padapter; +#ifndef CONFIG_LED_REMOVE_HAL + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter); +#endif + struct led_priv *ledpriv = &(padapter->ledpriv); + struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); + PLED_871x pLed1 = &(ledpriv->SwLed1); + u8 bStopBlinking = _FALSE; + +#ifndef CONFIG_LED_REMOVE_HAL + if(pHalData->EEPROMCustomerID == RT_CID_819x_CAMEO) + pLed = &(ledpriv->SwLed1); +#endif + + // Change LED according to BlinkingLedState specified. + if( pLed->BlinkingLedState == RTW_LED_ON ) + { + SwLedOn(padapter, pLed); + RT_TRACE(_module_rtl8712_led_c_,_drv_info_,( "Blinktimes (%d): turn on\n", pLed->BlinkTimes)); + } + else + { + SwLedOff(padapter, pLed); + RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Blinktimes (%d): turn off\n", pLed->BlinkTimes)); + } + +#ifndef CONFIG_LED_REMOVE_HAL + if(pHalData->EEPROMCustomerID == RT_CID_DEFAULT) + { + if(check_fwstate(pmlmepriv, _FW_LINKED)== _TRUE) + { + if(!pLed1->bSWLedCtrl) + { + SwLedOn(padapter, pLed1); + pLed1->bSWLedCtrl = _TRUE; + } + else if(!pLed1->bLedOn) + SwLedOn(padapter, pLed1); + RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Blinktimes (): turn on pLed1\n")); + } + else + { + if(!pLed1->bSWLedCtrl) + { + SwLedOff(padapter, pLed1); + pLed1->bSWLedCtrl = _TRUE; + } + else if(pLed1->bLedOn) + SwLedOff(padapter, pLed1); + RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Blinktimes (): turn off pLed1\n")); + } + } + +#endif + + if(adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on ) + { + SwLedOff(padapter, pLed); + ResetLedStatus(pLed); + return; + } + + switch(pLed->CurrLedState) + { + case LED_BLINK_SLOWLY: + if( pLed->bLedOn ) + pLed->BlinkingLedState = RTW_LED_OFF; + else + pLed->BlinkingLedState = RTW_LED_ON; + _set_timer(&(pLed->BlinkTimer), LED_BLINK_NO_LINK_INTERVAL_ALPHA); + break; + + case LED_BLINK_NORMAL: + if( pLed->bLedOn ) + pLed->BlinkingLedState = RTW_LED_OFF; + else + pLed->BlinkingLedState = RTW_LED_ON; + _set_timer(&(pLed->BlinkTimer), LED_BLINK_LINK_INTERVAL_ALPHA); + break; + + case LED_BLINK_SCAN: + pLed->BlinkTimes--; + if( pLed->BlinkTimes == 0 ) + { + bStopBlinking = _TRUE; + } + + if(bStopBlinking) + { + if(check_fwstate(pmlmepriv, _FW_LINKED)== _TRUE) + { + pLed->bLedLinkBlinkInProgress = _TRUE; + pLed->CurrLedState = LED_BLINK_NORMAL; + if( pLed->bLedOn ) + pLed->BlinkingLedState = RTW_LED_OFF; + else + pLed->BlinkingLedState = RTW_LED_ON; + _set_timer(&(pLed->BlinkTimer), LED_BLINK_LINK_INTERVAL_ALPHA); + RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("CurrLedState %d\n", pLed->CurrLedState)); + + } + else if(check_fwstate(pmlmepriv, _FW_LINKED)== _FALSE) + { + pLed->bLedNoLinkBlinkInProgress = _TRUE; + pLed->CurrLedState = LED_BLINK_SLOWLY; + if( pLed->bLedOn ) + pLed->BlinkingLedState = RTW_LED_OFF; + else + pLed->BlinkingLedState = RTW_LED_ON; + _set_timer(&(pLed->BlinkTimer), LED_BLINK_NO_LINK_INTERVAL_ALPHA); + RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("CurrLedState %d\n", pLed->CurrLedState)); + } + pLed->bLedScanBlinkInProgress = _FALSE; + } + else + { + if( pLed->bLedOn ) + pLed->BlinkingLedState = RTW_LED_OFF; + else + pLed->BlinkingLedState = RTW_LED_ON; + _set_timer(&(pLed->BlinkTimer), LED_BLINK_SCAN_INTERVAL_ALPHA); + } + break; + + case LED_BLINK_TXRX: + pLed->BlinkTimes--; + if( pLed->BlinkTimes == 0 ) + { + bStopBlinking = _TRUE; + } + if(bStopBlinking) + { + if(check_fwstate(pmlmepriv, _FW_LINKED)== _TRUE) + { + pLed->bLedLinkBlinkInProgress = _TRUE; + pLed->CurrLedState = LED_BLINK_NORMAL; + if( pLed->bLedOn ) + pLed->BlinkingLedState = RTW_LED_OFF; + else + pLed->BlinkingLedState = RTW_LED_ON; + _set_timer(&(pLed->BlinkTimer), LED_BLINK_LINK_INTERVAL_ALPHA); + RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("CurrLedState %d\n", pLed->CurrLedState)); + } + else if(check_fwstate(pmlmepriv, _FW_LINKED)== _FALSE) + { + pLed->bLedNoLinkBlinkInProgress = _TRUE; + pLed->CurrLedState = LED_BLINK_SLOWLY; + if( pLed->bLedOn ) + pLed->BlinkingLedState = RTW_LED_OFF; + else + pLed->BlinkingLedState = RTW_LED_ON; + _set_timer(&(pLed->BlinkTimer), LED_BLINK_NO_LINK_INTERVAL_ALPHA); + RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("CurrLedState %d\n", pLed->CurrLedState)); + } + pLed->BlinkTimes = 0; + pLed->bLedBlinkInProgress = _FALSE; + } + else + { + if( pLed->bLedOn ) + pLed->BlinkingLedState = RTW_LED_OFF; + else + pLed->BlinkingLedState = RTW_LED_ON; + _set_timer(&(pLed->BlinkTimer), LED_BLINK_FASTER_INTERVAL_ALPHA); + } + break; + + case LED_BLINK_WPS: + if( pLed->bLedOn ) + pLed->BlinkingLedState = RTW_LED_OFF; + else + pLed->BlinkingLedState = RTW_LED_ON; + _set_timer(&(pLed->BlinkTimer), LED_BLINK_SCAN_INTERVAL_ALPHA); + break; + + case LED_BLINK_WPS_STOP: //WPS success + if(pLed->BlinkingLedState == RTW_LED_ON) + bStopBlinking = _FALSE; + else + bStopBlinking = _TRUE; + + if(bStopBlinking) + { + pLed->bLedLinkBlinkInProgress = _TRUE; + pLed->CurrLedState = LED_BLINK_NORMAL; + if( pLed->bLedOn ) + pLed->BlinkingLedState = RTW_LED_OFF; + else + pLed->BlinkingLedState = RTW_LED_ON; + _set_timer(&(pLed->BlinkTimer), LED_BLINK_LINK_INTERVAL_ALPHA); + RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("CurrLedState %d\n", pLed->CurrLedState)); + + pLed->bLedWPSBlinkInProgress = _FALSE; + } + else + { + pLed->BlinkingLedState = RTW_LED_OFF; + _set_timer(&(pLed->BlinkTimer), LED_BLINK_WPS_SUCESS_INTERVAL_ALPHA); + } + break; + + default: + break; + } + +} + +void +SwLedBlink2( + PLED_871x pLed + ) +{ + struct adapter *padapter = pLed->padapter; + struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); + u8 bStopBlinking = _FALSE; + + // Change LED according to BlinkingLedState specified. + if( pLed->BlinkingLedState == RTW_LED_ON) + { + SwLedOn(padapter, pLed); + RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Blinktimes (%d): turn on\n", pLed->BlinkTimes)); + } + else + { + SwLedOff(padapter, pLed); + RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Blinktimes (%d): turn off\n", pLed->BlinkTimes)); + } + + switch(pLed->CurrLedState) + { + case LED_BLINK_SCAN: + pLed->BlinkTimes--; + if( pLed->BlinkTimes == 0 ) + { + bStopBlinking = _TRUE; + } + + if(bStopBlinking) + { + if( adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on ) + { + SwLedOff(padapter, pLed); + } + else if(check_fwstate(pmlmepriv, _FW_LINKED)== _TRUE) + { + pLed->CurrLedState = RTW_LED_ON; + pLed->BlinkingLedState = RTW_LED_ON; + SwLedOn(padapter, pLed); + RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("stop scan blink CurrLedState %d\n", pLed->CurrLedState)); + + } + else if(check_fwstate(pmlmepriv, _FW_LINKED)== _FALSE) + { + pLed->CurrLedState = RTW_LED_OFF; + pLed->BlinkingLedState = RTW_LED_OFF; + SwLedOff(padapter, pLed); + RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("stop scan blink CurrLedState %d\n", pLed->CurrLedState)); + } + pLed->bLedScanBlinkInProgress = _FALSE; + } + else + { + if( adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on ) + { + SwLedOff(padapter, pLed); + } + else + { + if( pLed->bLedOn ) + pLed->BlinkingLedState = RTW_LED_OFF; + else + pLed->BlinkingLedState = RTW_LED_ON; + _set_timer(&(pLed->BlinkTimer), LED_BLINK_SCAN_INTERVAL_ALPHA); + } + } + break; + + case LED_BLINK_TXRX: + pLed->BlinkTimes--; + if( pLed->BlinkTimes == 0 ) + { + bStopBlinking = _TRUE; + } + if(bStopBlinking) + { + if(adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on ) + { + SwLedOff(padapter, pLed); + } + else if(check_fwstate(pmlmepriv, _FW_LINKED)== _TRUE) + { + pLed->CurrLedState = RTW_LED_ON; + pLed->BlinkingLedState = RTW_LED_ON; + SwLedOn(padapter, pLed); + RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("stop CurrLedState %d\n", pLed->CurrLedState)); + + } + else if(check_fwstate(pmlmepriv, _FW_LINKED)== _FALSE) + { + pLed->CurrLedState = RTW_LED_OFF; + pLed->BlinkingLedState = RTW_LED_OFF; + SwLedOff(padapter, pLed); + RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("stop CurrLedState %d\n", pLed->CurrLedState)); + } + pLed->bLedBlinkInProgress = _FALSE; + } + else + { + if(adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on ) + { + SwLedOff(padapter, pLed); + } + else + { + if( pLed->bLedOn ) + pLed->BlinkingLedState = RTW_LED_OFF; + else + pLed->BlinkingLedState = RTW_LED_ON; + _set_timer(&(pLed->BlinkTimer), LED_BLINK_FASTER_INTERVAL_ALPHA); + } + } + break; + + default: + break; + } + +} + +void +SwLedBlink3( + PLED_871x pLed + ) +{ + struct adapter *padapter = pLed->padapter; + struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); + u8 bStopBlinking = _FALSE; + + // Change LED according to BlinkingLedState specified. + if( pLed->BlinkingLedState == RTW_LED_ON ) + { + SwLedOn(padapter, pLed); + RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Blinktimes (%d): turn on\n", pLed->BlinkTimes)); + } + else + { + if(pLed->CurrLedState != LED_BLINK_WPS_STOP) + SwLedOff(padapter, pLed); + RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Blinktimes (%d): turn off\n", pLed->BlinkTimes)); + } + + switch(pLed->CurrLedState) + { + case LED_BLINK_SCAN: + pLed->BlinkTimes--; + if( pLed->BlinkTimes == 0 ) + { + bStopBlinking = _TRUE; + } + + if(bStopBlinking) + { + if(adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on ) + { + SwLedOff(padapter, pLed); + } + else if(check_fwstate(pmlmepriv, _FW_LINKED)== _TRUE) + { + pLed->CurrLedState = RTW_LED_ON; + pLed->BlinkingLedState = RTW_LED_ON; + if( !pLed->bLedOn ) + SwLedOn(padapter, pLed); + + RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("CurrLedState %d\n", pLed->CurrLedState)); + } + else if(check_fwstate(pmlmepriv, _FW_LINKED)== _FALSE) + { + pLed->CurrLedState = RTW_LED_OFF; + pLed->BlinkingLedState = RTW_LED_OFF; + if( pLed->bLedOn ) + SwLedOff(padapter, pLed); + + RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("CurrLedState %d\n", pLed->CurrLedState)); + } + pLed->bLedScanBlinkInProgress = _FALSE; + } + else + { + if(adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on ) + { + SwLedOff(padapter, pLed); + } + else + { + if( pLed->bLedOn ) + pLed->BlinkingLedState = RTW_LED_OFF; + else + pLed->BlinkingLedState = RTW_LED_ON; + _set_timer(&(pLed->BlinkTimer), LED_BLINK_SCAN_INTERVAL_ALPHA); + } + } + break; + + case LED_BLINK_TXRX: + pLed->BlinkTimes--; + if( pLed->BlinkTimes == 0 ) + { + bStopBlinking = _TRUE; + } + if(bStopBlinking) + { + if(adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on ) + { + SwLedOff(padapter, pLed); + } + else if(check_fwstate(pmlmepriv, _FW_LINKED)== _TRUE) + { + pLed->CurrLedState = RTW_LED_ON; + pLed->BlinkingLedState = RTW_LED_ON; + + if( !pLed->bLedOn ) + SwLedOn(padapter, pLed); + + RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("CurrLedState %d\n", pLed->CurrLedState)); + } + else if(check_fwstate(pmlmepriv, _FW_LINKED)== _FALSE) + { + pLed->CurrLedState = RTW_LED_OFF; + pLed->BlinkingLedState = RTW_LED_OFF; + + if( pLed->bLedOn ) + SwLedOff(padapter, pLed); + + + RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("CurrLedState %d\n", pLed->CurrLedState)); + } + pLed->bLedBlinkInProgress = _FALSE; + } + else + { + if(adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on ) + { + SwLedOff(padapter, pLed); + } + else + { + if( pLed->bLedOn ) + pLed->BlinkingLedState = RTW_LED_OFF; + else + pLed->BlinkingLedState = RTW_LED_ON; + _set_timer(&(pLed->BlinkTimer), LED_BLINK_FASTER_INTERVAL_ALPHA); + } + } + break; + + case LED_BLINK_WPS: + if( pLed->bLedOn ) + pLed->BlinkingLedState = RTW_LED_OFF; + else + pLed->BlinkingLedState = RTW_LED_ON; + _set_timer(&(pLed->BlinkTimer), LED_BLINK_SCAN_INTERVAL_ALPHA); + break; + + case LED_BLINK_WPS_STOP: //WPS success + if(pLed->BlinkingLedState == RTW_LED_ON) + { + pLed->BlinkingLedState = RTW_LED_OFF; + _set_timer(&(pLed->BlinkTimer), LED_BLINK_WPS_SUCESS_INTERVAL_ALPHA); + bStopBlinking = _FALSE; + } + else + { + bStopBlinking = _TRUE; + } + + if(bStopBlinking) + { + if(adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on ) + { + SwLedOff(padapter, pLed); + } + else + { + pLed->CurrLedState = RTW_LED_ON; + pLed->BlinkingLedState = RTW_LED_ON; + SwLedOn(padapter, pLed); + RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("CurrLedState %d\n", pLed->CurrLedState)); + } + pLed->bLedWPSBlinkInProgress = _FALSE; + } + break; + + + default: + break; + } + +} + + +void +SwLedBlink4( + PLED_871x pLed + ) +{ + struct adapter *padapter = pLed->padapter; + struct led_priv *ledpriv = &(padapter->ledpriv); + struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); + PLED_871x pLed1 = &(ledpriv->SwLed1); + u8 bStopBlinking = _FALSE; + + // Change LED according to BlinkingLedState specified. + if( pLed->BlinkingLedState == RTW_LED_ON ) + { + SwLedOn(padapter, pLed); + RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Blinktimes (%d): turn on\n", pLed->BlinkTimes)); + } + else + { + SwLedOff(padapter, pLed); + RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Blinktimes (%d): turn off\n", pLed->BlinkTimes)); + } + + if(!pLed1->bLedWPSBlinkInProgress && pLed1->BlinkingLedState == LED_UNKNOWN) + { + pLed1->BlinkingLedState = RTW_LED_OFF; + pLed1->CurrLedState = RTW_LED_OFF; + SwLedOff(padapter, pLed1); + } + + switch(pLed->CurrLedState) + { + case LED_BLINK_SLOWLY: + if( pLed->bLedOn ) + pLed->BlinkingLedState = RTW_LED_OFF; + else + pLed->BlinkingLedState = RTW_LED_ON; + _set_timer(&(pLed->BlinkTimer), LED_BLINK_NO_LINK_INTERVAL_ALPHA); + break; + + case LED_BLINK_StartToBlink: + if( pLed->bLedOn ) + { + pLed->BlinkingLedState = RTW_LED_OFF; + _set_timer(&(pLed->BlinkTimer), LED_BLINK_SLOWLY_INTERVAL); + } + else + { + pLed->BlinkingLedState = RTW_LED_ON; + _set_timer(&(pLed->BlinkTimer), LED_BLINK_NORMAL_INTERVAL); + } + break; + + case LED_BLINK_SCAN: + pLed->BlinkTimes--; + if( pLed->BlinkTimes == 0 ) + { + bStopBlinking = _FALSE; + } + + if(bStopBlinking) + { + if(adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on && adapter_to_pwrctl(padapter)->rfoff_reason > RF_CHANGE_BY_PS) + { + SwLedOff(padapter, pLed); + } + else + { + pLed->bLedNoLinkBlinkInProgress = _FALSE; + pLed->CurrLedState = LED_BLINK_SLOWLY; + if( pLed->bLedOn ) + pLed->BlinkingLedState = RTW_LED_OFF; + else + pLed->BlinkingLedState = RTW_LED_ON; + _set_timer(&(pLed->BlinkTimer), LED_BLINK_NO_LINK_INTERVAL_ALPHA); + } + pLed->bLedScanBlinkInProgress = _FALSE; + } + else + { + if(adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on && adapter_to_pwrctl(padapter)->rfoff_reason > RF_CHANGE_BY_PS) + { + SwLedOff(padapter, pLed); + } + else + { + if( pLed->bLedOn ) + pLed->BlinkingLedState = RTW_LED_OFF; + else + pLed->BlinkingLedState = RTW_LED_ON; + _set_timer(&(pLed->BlinkTimer), LED_BLINK_SCAN_INTERVAL_ALPHA); + } + } + break; + + case LED_BLINK_TXRX: + pLed->BlinkTimes--; + if( pLed->BlinkTimes == 0 ) + { + bStopBlinking = _TRUE; + } + if(bStopBlinking) + { + if(adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on && adapter_to_pwrctl(padapter)->rfoff_reason > RF_CHANGE_BY_PS) + { + SwLedOff(padapter, pLed); + } + else + { + pLed->bLedNoLinkBlinkInProgress = _TRUE; + pLed->CurrLedState = LED_BLINK_SLOWLY; + if( pLed->bLedOn ) + pLed->BlinkingLedState = RTW_LED_OFF; + else + pLed->BlinkingLedState = RTW_LED_ON; + _set_timer(&(pLed->BlinkTimer), LED_BLINK_NO_LINK_INTERVAL_ALPHA); + } + pLed->bLedBlinkInProgress = _FALSE; + } + else + { + if(adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on && adapter_to_pwrctl(padapter)->rfoff_reason > RF_CHANGE_BY_PS) + { + SwLedOff(padapter, pLed); + } + else + { + if( pLed->bLedOn ) + pLed->BlinkingLedState = RTW_LED_OFF; + else + pLed->BlinkingLedState = RTW_LED_ON; + _set_timer(&(pLed->BlinkTimer), LED_BLINK_FASTER_INTERVAL_ALPHA); + } + } + break; + + case LED_BLINK_WPS: + if( pLed->bLedOn ) + { + pLed->BlinkingLedState = RTW_LED_OFF; + _set_timer(&(pLed->BlinkTimer), LED_BLINK_SLOWLY_INTERVAL); + } + else + { + pLed->BlinkingLedState = RTW_LED_ON; + _set_timer(&(pLed->BlinkTimer), LED_BLINK_NORMAL_INTERVAL); + } + break; + + case LED_BLINK_WPS_STOP: //WPS authentication fail + if( pLed->bLedOn ) + pLed->BlinkingLedState = RTW_LED_OFF; + else + pLed->BlinkingLedState = RTW_LED_ON; + + _set_timer(&(pLed->BlinkTimer), LED_BLINK_NORMAL_INTERVAL); + break; + + case LED_BLINK_WPS_STOP_OVERLAP: //WPS session overlap + pLed->BlinkTimes--; + if(pLed->BlinkTimes == 0) + { + if(pLed->bLedOn) + { + pLed->BlinkTimes = 1; + } + else + { + bStopBlinking = _TRUE; + } + } + + if(bStopBlinking) + { + pLed->BlinkTimes = 10; + pLed->BlinkingLedState = RTW_LED_ON; + _set_timer(&(pLed->BlinkTimer), LED_BLINK_LINK_INTERVAL_ALPHA); + } + else + { + if( pLed->bLedOn ) + pLed->BlinkingLedState = RTW_LED_OFF; + else + pLed->BlinkingLedState = RTW_LED_ON; + + _set_timer(&(pLed->BlinkTimer), LED_BLINK_NORMAL_INTERVAL); + } + break; + + + default: + break; + } + + RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("SwLedBlink4 CurrLedState %d\n", pLed->CurrLedState)); + + +} + +void +SwLedBlink5( + PLED_871x pLed + ) +{ + struct adapter *padapter = pLed->padapter; + struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); + u8 bStopBlinking = _FALSE; + + // Change LED according to BlinkingLedState specified. + if( pLed->BlinkingLedState == RTW_LED_ON ) + { + SwLedOn(padapter, pLed); + RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Blinktimes (%d): turn on\n", pLed->BlinkTimes)); + } + else + { + SwLedOff(padapter, pLed); + RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Blinktimes (%d): turn off\n", pLed->BlinkTimes)); + } + + switch(pLed->CurrLedState) + { + case LED_BLINK_SCAN: + pLed->BlinkTimes--; + if( pLed->BlinkTimes == 0 ) + { + bStopBlinking = _TRUE; + } + + if(bStopBlinking) + { + if(adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on && adapter_to_pwrctl(padapter)->rfoff_reason > RF_CHANGE_BY_PS) + { + pLed->CurrLedState = RTW_LED_OFF; + pLed->BlinkingLedState = RTW_LED_OFF; + if(pLed->bLedOn) + SwLedOff(padapter, pLed); + } + else + { pLed->CurrLedState = RTW_LED_ON; + pLed->BlinkingLedState = RTW_LED_ON; + if(!pLed->bLedOn) + _set_timer(&(pLed->BlinkTimer), LED_BLINK_FASTER_INTERVAL_ALPHA); + } + + pLed->bLedScanBlinkInProgress = _FALSE; + } + else + { + if(adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on && adapter_to_pwrctl(padapter)->rfoff_reason > RF_CHANGE_BY_PS) + { + SwLedOff(padapter, pLed); + } + else + { + if( pLed->bLedOn ) + pLed->BlinkingLedState = RTW_LED_OFF; + else + pLed->BlinkingLedState = RTW_LED_ON; + _set_timer(&(pLed->BlinkTimer), LED_BLINK_SCAN_INTERVAL_ALPHA); + } + } + break; + + + case LED_BLINK_TXRX: + pLed->BlinkTimes--; + if( pLed->BlinkTimes == 0 ) + { + bStopBlinking = _TRUE; + } + + if(bStopBlinking) + { + if(adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on && adapter_to_pwrctl(padapter)->rfoff_reason > RF_CHANGE_BY_PS) + { + pLed->CurrLedState = RTW_LED_OFF; + pLed->BlinkingLedState = RTW_LED_OFF; + if(pLed->bLedOn) + SwLedOff(padapter, pLed); + } + else + { + pLed->CurrLedState = RTW_LED_ON; + pLed->BlinkingLedState = RTW_LED_ON; + if(!pLed->bLedOn) + _set_timer(&(pLed->BlinkTimer), LED_BLINK_FASTER_INTERVAL_ALPHA); + } + + pLed->bLedBlinkInProgress = _FALSE; + } + else + { + if(adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on && adapter_to_pwrctl(padapter)->rfoff_reason > RF_CHANGE_BY_PS) + { + SwLedOff(padapter, pLed); + } + else + { + if( pLed->bLedOn ) + pLed->BlinkingLedState = RTW_LED_OFF; + else + pLed->BlinkingLedState = RTW_LED_ON; + _set_timer(&(pLed->BlinkTimer), LED_BLINK_FASTER_INTERVAL_ALPHA); + } + } + break; + + default: + break; + } + + RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("SwLedBlink5 CurrLedState %d\n", pLed->CurrLedState)); + + +} + +void +SwLedBlink6( + PLED_871x pLed + ) +{ + struct adapter *padapter = pLed->padapter; + struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); + u8 bStopBlinking = _FALSE; + + // Change LED according to BlinkingLedState specified. + if( pLed->BlinkingLedState == RTW_LED_ON ) + { + SwLedOn(padapter, pLed); + RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Blinktimes (%d): turn on\n", pLed->BlinkTimes)); + } + else + { + SwLedOff(padapter, pLed); + RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Blinktimes (%d): turn off\n", pLed->BlinkTimes)); + } + + RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("<==== blink6\n")); +} + +static void +SwLedControlMode0( + struct adapter *padapter, + LED_CTL_MODE LedAction +) +{ + struct led_priv *ledpriv = &(padapter->ledpriv); + PLED_871x pLed = &(ledpriv->SwLed1); + + // Decide led state + switch(LedAction) + { + case LED_CTL_TX: + case LED_CTL_RX: + if( pLed->bLedBlinkInProgress == _FALSE ) + { + pLed->bLedBlinkInProgress = _TRUE; + + pLed->CurrLedState = LED_BLINK_NORMAL; + pLed->BlinkTimes = 2; + + if( pLed->bLedOn ) + pLed->BlinkingLedState = RTW_LED_OFF; + else + pLed->BlinkingLedState = RTW_LED_ON; + _set_timer(&(pLed->BlinkTimer), LED_BLINK_NORMAL_INTERVAL); + } + break; + + case LED_CTL_START_TO_LINK: + if( pLed->bLedBlinkInProgress == _FALSE ) + { + pLed->bLedBlinkInProgress = _TRUE; + + pLed->CurrLedState = LED_BLINK_StartToBlink; + pLed->BlinkTimes = 24; + + if( pLed->bLedOn ) + pLed->BlinkingLedState = RTW_LED_OFF; + else + pLed->BlinkingLedState = RTW_LED_ON; + _set_timer(&(pLed->BlinkTimer), LED_BLINK_SLOWLY_INTERVAL); + } + else + { + pLed->CurrLedState = LED_BLINK_StartToBlink; + } + break; + + case LED_CTL_LINK: + pLed->CurrLedState = RTW_LED_ON; + if( pLed->bLedBlinkInProgress == _FALSE ) + { + SwLedOn(padapter, pLed); + } + break; + + case LED_CTL_NO_LINK: + pLed->CurrLedState = RTW_LED_OFF; + if( pLed->bLedBlinkInProgress == _FALSE ) + { + SwLedOff(padapter, pLed); + } + break; + + case LED_CTL_POWER_OFF: + pLed->CurrLedState = RTW_LED_OFF; + if(pLed->bLedBlinkInProgress) + { + _cancel_timer_ex(&(pLed->BlinkTimer)); + pLed->bLedBlinkInProgress = _FALSE; + } + SwLedOff(padapter, pLed); + break; + + case LED_CTL_START_WPS: + if( pLed->bLedBlinkInProgress == _FALSE || pLed->CurrLedState == RTW_LED_ON) + { + pLed->bLedBlinkInProgress = _TRUE; + + pLed->CurrLedState = LED_BLINK_WPS; + pLed->BlinkTimes = 20; + + if( pLed->bLedOn ) + { + pLed->BlinkingLedState = RTW_LED_OFF; + _set_timer(&(pLed->BlinkTimer), LED_BLINK_LONG_INTERVAL); + } + else + { + pLed->BlinkingLedState = RTW_LED_ON; + _set_timer(&(pLed->BlinkTimer), LED_BLINK_LONG_INTERVAL); + } + } + break; + + case LED_CTL_STOP_WPS: + if(pLed->bLedBlinkInProgress) + { + pLed->CurrLedState = RTW_LED_OFF; + _cancel_timer_ex(&(pLed->BlinkTimer)); + pLed->bLedBlinkInProgress = _FALSE; + } + break; + + + default: + break; + } + + RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Led %d\n", pLed->CurrLedState)); + +} + + //ALPHA, added by chiyoko, 20090106 +static void +SwLedControlMode1( + struct adapter *padapter, + LED_CTL_MODE LedAction +) +{ +#ifndef CONFIG_LED_REMOVE_HAL + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter); +#endif + struct led_priv *ledpriv = &(padapter->ledpriv); + PLED_871x pLed = &(ledpriv->SwLed0); + struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); + +#ifndef CONFIG_LED_REMOVE_HAL + if(pHalData->EEPROMCustomerID == RT_CID_819x_CAMEO) + pLed = &(ledpriv->SwLed1); +#endif + + switch(LedAction) + { + case LED_CTL_POWER_ON: + case LED_CTL_START_TO_LINK: + case LED_CTL_NO_LINK: + if( pLed->bLedNoLinkBlinkInProgress == _FALSE ) + { + if(pLed->CurrLedState == LED_BLINK_SCAN || IS_LED_WPS_BLINKING(pLed)) + { + return; + } + if( pLed->bLedLinkBlinkInProgress == _TRUE ) + { + _cancel_timer_ex(&(pLed->BlinkTimer)); + pLed->bLedLinkBlinkInProgress = _FALSE; + } + if(pLed->bLedBlinkInProgress ==_TRUE) + { + _cancel_timer_ex(&(pLed->BlinkTimer)); + pLed->bLedBlinkInProgress = _FALSE; + } + + pLed->bLedNoLinkBlinkInProgress = _TRUE; + pLed->CurrLedState = LED_BLINK_SLOWLY; + if( pLed->bLedOn ) + pLed->BlinkingLedState = RTW_LED_OFF; + else + pLed->BlinkingLedState = RTW_LED_ON; + _set_timer(&(pLed->BlinkTimer), LED_BLINK_NO_LINK_INTERVAL_ALPHA); + } + break; + + case LED_CTL_LINK: + if( pLed->bLedLinkBlinkInProgress == _FALSE ) + { + if(pLed->CurrLedState == LED_BLINK_SCAN || IS_LED_WPS_BLINKING(pLed)) + { + return; + } + if(pLed->bLedNoLinkBlinkInProgress == _TRUE) + { + _cancel_timer_ex(&(pLed->BlinkTimer)); + pLed->bLedNoLinkBlinkInProgress = _FALSE; + } + if(pLed->bLedBlinkInProgress ==_TRUE) + { + _cancel_timer_ex(&(pLed->BlinkTimer)); + pLed->bLedBlinkInProgress = _FALSE; + } + pLed->bLedLinkBlinkInProgress = _TRUE; + pLed->CurrLedState = LED_BLINK_NORMAL; + if( pLed->bLedOn ) + pLed->BlinkingLedState = RTW_LED_OFF; + else + pLed->BlinkingLedState = RTW_LED_ON; + _set_timer(&(pLed->BlinkTimer), LED_BLINK_LINK_INTERVAL_ALPHA); + } + break; + + case LED_CTL_SITE_SURVEY: + if((pmlmepriv->LinkDetectInfo.bBusyTraffic) && (check_fwstate(pmlmepriv, _FW_LINKED)== _TRUE)) + ; + else if(pLed->bLedScanBlinkInProgress ==_FALSE) + { + if(IS_LED_WPS_BLINKING(pLed)) + return; + + if(pLed->bLedNoLinkBlinkInProgress == _TRUE) + { + _cancel_timer_ex(&(pLed->BlinkTimer)); + pLed->bLedNoLinkBlinkInProgress = _FALSE; + } + if( pLed->bLedLinkBlinkInProgress == _TRUE ) + { + _cancel_timer_ex(&(pLed->BlinkTimer)); + pLed->bLedLinkBlinkInProgress = _FALSE; + } + if(pLed->bLedBlinkInProgress ==_TRUE) + { + _cancel_timer_ex(&(pLed->BlinkTimer)); + pLed->bLedBlinkInProgress = _FALSE; + } + pLed->bLedScanBlinkInProgress = _TRUE; + pLed->CurrLedState = LED_BLINK_SCAN; + pLed->BlinkTimes = 24; + if( pLed->bLedOn ) + pLed->BlinkingLedState = RTW_LED_OFF; + else + pLed->BlinkingLedState = RTW_LED_ON; + _set_timer(&(pLed->BlinkTimer), LED_BLINK_SCAN_INTERVAL_ALPHA); + } + break; + + case LED_CTL_TX: + case LED_CTL_RX: + if(pLed->bLedBlinkInProgress ==_FALSE) + { + if(pLed->CurrLedState == LED_BLINK_SCAN || IS_LED_WPS_BLINKING(pLed)) + { + return; + } + if(pLed->bLedNoLinkBlinkInProgress == _TRUE) + { + _cancel_timer_ex(&(pLed->BlinkTimer)); + pLed->bLedNoLinkBlinkInProgress = _FALSE; + } + if( pLed->bLedLinkBlinkInProgress == _TRUE ) + { + _cancel_timer_ex(&(pLed->BlinkTimer)); + pLed->bLedLinkBlinkInProgress = _FALSE; + } + pLed->bLedBlinkInProgress = _TRUE; + pLed->CurrLedState = LED_BLINK_TXRX; + pLed->BlinkTimes = 2; + if( pLed->bLedOn ) + pLed->BlinkingLedState = RTW_LED_OFF; + else + pLed->BlinkingLedState = RTW_LED_ON; + _set_timer(&(pLed->BlinkTimer), LED_BLINK_FASTER_INTERVAL_ALPHA); + } + break; + + case LED_CTL_START_WPS: //wait until xinpin finish + case LED_CTL_START_WPS_BOTTON: + if(pLed->bLedWPSBlinkInProgress ==_FALSE) + { + if(pLed->bLedNoLinkBlinkInProgress == _TRUE) + { + _cancel_timer_ex(&(pLed->BlinkTimer)); + pLed->bLedNoLinkBlinkInProgress = _FALSE; + } + if( pLed->bLedLinkBlinkInProgress == _TRUE ) + { + _cancel_timer_ex(&(pLed->BlinkTimer)); + pLed->bLedLinkBlinkInProgress = _FALSE; + } + if(pLed->bLedBlinkInProgress ==_TRUE) + { + _cancel_timer_ex(&(pLed->BlinkTimer)); + pLed->bLedBlinkInProgress = _FALSE; + } + if(pLed->bLedScanBlinkInProgress ==_TRUE) + { + _cancel_timer_ex(&(pLed->BlinkTimer)); + pLed->bLedScanBlinkInProgress = _FALSE; + } + pLed->bLedWPSBlinkInProgress = _TRUE; + pLed->CurrLedState = LED_BLINK_WPS; + if( pLed->bLedOn ) + pLed->BlinkingLedState = RTW_LED_OFF; + else + pLed->BlinkingLedState = RTW_LED_ON; + _set_timer(&(pLed->BlinkTimer), LED_BLINK_SCAN_INTERVAL_ALPHA); + } + break; + + + case LED_CTL_STOP_WPS: + if(pLed->bLedNoLinkBlinkInProgress == _TRUE) + { + _cancel_timer_ex(&(pLed->BlinkTimer)); + pLed->bLedNoLinkBlinkInProgress = _FALSE; + } + if( pLed->bLedLinkBlinkInProgress == _TRUE ) + { + _cancel_timer_ex(&(pLed->BlinkTimer)); + pLed->bLedLinkBlinkInProgress = _FALSE; + } + if(pLed->bLedBlinkInProgress ==_TRUE) + { + _cancel_timer_ex(&(pLed->BlinkTimer)); + pLed->bLedBlinkInProgress = _FALSE; + } + if(pLed->bLedScanBlinkInProgress ==_TRUE) + { + _cancel_timer_ex(&(pLed->BlinkTimer)); + pLed->bLedScanBlinkInProgress = _FALSE; + } + if(pLed->bLedWPSBlinkInProgress) + { + _cancel_timer_ex(&(pLed->BlinkTimer)); + } + else + { + pLed->bLedWPSBlinkInProgress = _TRUE; + } + + pLed->CurrLedState = LED_BLINK_WPS_STOP; + if(pLed->bLedOn) + { + pLed->BlinkingLedState = RTW_LED_OFF; + _set_timer(&(pLed->BlinkTimer), LED_BLINK_WPS_SUCESS_INTERVAL_ALPHA); + } + else + { + pLed->BlinkingLedState = RTW_LED_ON; + _set_timer(&(pLed->BlinkTimer), 0); + } + break; + + case LED_CTL_STOP_WPS_FAIL: + if(pLed->bLedWPSBlinkInProgress) + { + _cancel_timer_ex(&(pLed->BlinkTimer)); + pLed->bLedWPSBlinkInProgress = _FALSE; + } + + pLed->bLedNoLinkBlinkInProgress = _TRUE; + pLed->CurrLedState = LED_BLINK_SLOWLY; + if( pLed->bLedOn ) + pLed->BlinkingLedState = RTW_LED_OFF; + else + pLed->BlinkingLedState = RTW_LED_ON; + _set_timer(&(pLed->BlinkTimer), LED_BLINK_NO_LINK_INTERVAL_ALPHA); + break; + + case LED_CTL_POWER_OFF: + pLed->CurrLedState = RTW_LED_OFF; + pLed->BlinkingLedState = RTW_LED_OFF; + if( pLed->bLedNoLinkBlinkInProgress) + { + _cancel_timer_ex(&(pLed->BlinkTimer)); + pLed->bLedNoLinkBlinkInProgress = _FALSE; + } + if( pLed->bLedLinkBlinkInProgress) + { + _cancel_timer_ex(&(pLed->BlinkTimer)); + pLed->bLedLinkBlinkInProgress = _FALSE; + } + if( pLed->bLedBlinkInProgress) + { + _cancel_timer_ex(&(pLed->BlinkTimer)); + pLed->bLedBlinkInProgress = _FALSE; + } + if( pLed->bLedWPSBlinkInProgress ) + { + _cancel_timer_ex(&(pLed->BlinkTimer)); + pLed->bLedWPSBlinkInProgress = _FALSE; + } + if( pLed->bLedScanBlinkInProgress) + { + _cancel_timer_ex(&(pLed->BlinkTimer)); + pLed->bLedScanBlinkInProgress = _FALSE; + } + + SwLedOff(padapter, pLed); + break; + + default: + break; + + } + + RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Led %d\n", pLed->CurrLedState)); +} + + //Arcadyan/Sitecom , added by chiyoko, 20090216 +static void +SwLedControlMode2( + struct adapter *padapter, + LED_CTL_MODE LedAction +) +{ + struct led_priv *ledpriv = &(padapter->ledpriv); + struct mlme_priv *pmlmepriv = &padapter->mlmepriv; + PLED_871x pLed = &(ledpriv->SwLed0); + + switch(LedAction) + { + case LED_CTL_SITE_SURVEY: + if(pmlmepriv->LinkDetectInfo.bBusyTraffic) + ; + else if(pLed->bLedScanBlinkInProgress ==_FALSE) + { + if(IS_LED_WPS_BLINKING(pLed)) + return; + + if(pLed->bLedBlinkInProgress ==_TRUE) + { + _cancel_timer_ex(&(pLed->BlinkTimer)); + pLed->bLedBlinkInProgress = _FALSE; + } + pLed->bLedScanBlinkInProgress = _TRUE; + pLed->CurrLedState = LED_BLINK_SCAN; + pLed->BlinkTimes = 24; + if( pLed->bLedOn ) + pLed->BlinkingLedState = RTW_LED_OFF; + else + pLed->BlinkingLedState = RTW_LED_ON; + _set_timer(&(pLed->BlinkTimer), LED_BLINK_SCAN_INTERVAL_ALPHA); + } + break; + + case LED_CTL_TX: + case LED_CTL_RX: + if((pLed->bLedBlinkInProgress ==_FALSE) && (check_fwstate(pmlmepriv, _FW_LINKED)== _TRUE)) + { + if(pLed->CurrLedState == LED_BLINK_SCAN || IS_LED_WPS_BLINKING(pLed)) + { + return; + } + + pLed->bLedBlinkInProgress = _TRUE; + pLed->CurrLedState = LED_BLINK_TXRX; + pLed->BlinkTimes = 2; + if( pLed->bLedOn ) + pLed->BlinkingLedState = RTW_LED_OFF; + else + pLed->BlinkingLedState = RTW_LED_ON; + _set_timer(&(pLed->BlinkTimer), LED_BLINK_FASTER_INTERVAL_ALPHA); + } + break; + + case LED_CTL_LINK: + pLed->CurrLedState = RTW_LED_ON; + pLed->BlinkingLedState = RTW_LED_ON; + if( pLed->bLedBlinkInProgress) + { + _cancel_timer_ex(&(pLed->BlinkTimer)); + pLed->bLedBlinkInProgress = _FALSE; + } + if( pLed->bLedScanBlinkInProgress) + { + _cancel_timer_ex(&(pLed->BlinkTimer)); + pLed->bLedScanBlinkInProgress = _FALSE; + } + + _set_timer(&(pLed->BlinkTimer), 0); + break; + + case LED_CTL_START_WPS: //wait until xinpin finish + case LED_CTL_START_WPS_BOTTON: + if(pLed->bLedWPSBlinkInProgress ==_FALSE) + { + if(pLed->bLedBlinkInProgress ==_TRUE) + { + _cancel_timer_ex(&(pLed->BlinkTimer)); + pLed->bLedBlinkInProgress = _FALSE; + } + if(pLed->bLedScanBlinkInProgress ==_TRUE) + { + _cancel_timer_ex(&(pLed->BlinkTimer)); + pLed->bLedScanBlinkInProgress = _FALSE; + } + pLed->bLedWPSBlinkInProgress = _TRUE; + pLed->CurrLedState = RTW_LED_ON; + pLed->BlinkingLedState = RTW_LED_ON; + _set_timer(&(pLed->BlinkTimer), 0); + } + break; + + case LED_CTL_STOP_WPS: + pLed->bLedWPSBlinkInProgress = _FALSE; + if(adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on) + { + SwLedOff(padapter, pLed); + } + else + { + pLed->CurrLedState = RTW_LED_ON; + pLed->BlinkingLedState = RTW_LED_ON; + _set_timer(&(pLed->BlinkTimer), 0); + RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("CurrLedState %d\n", pLed->CurrLedState)); + } + break; + + case LED_CTL_STOP_WPS_FAIL: + pLed->bLedWPSBlinkInProgress = _FALSE; + if(adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on) + { + SwLedOff(padapter, pLed); + } + else + { + pLed->CurrLedState = RTW_LED_OFF; + pLed->BlinkingLedState = RTW_LED_OFF; + _set_timer(&(pLed->BlinkTimer), 0); + RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("CurrLedState %d\n", pLed->CurrLedState)); + } + break; + + case LED_CTL_START_TO_LINK: + case LED_CTL_NO_LINK: + if(!IS_LED_BLINKING(pLed)) + { + pLed->CurrLedState = RTW_LED_OFF; + pLed->BlinkingLedState = RTW_LED_OFF; + _set_timer(&(pLed->BlinkTimer), 0); + } + break; + + case LED_CTL_POWER_OFF: + pLed->CurrLedState = RTW_LED_OFF; + pLed->BlinkingLedState = RTW_LED_OFF; + if( pLed->bLedBlinkInProgress) + { + _cancel_timer_ex(&(pLed->BlinkTimer)); + pLed->bLedBlinkInProgress = _FALSE; + } + if( pLed->bLedScanBlinkInProgress) + { + _cancel_timer_ex(&(pLed->BlinkTimer)); + pLed->bLedScanBlinkInProgress = _FALSE; + } + if( pLed->bLedWPSBlinkInProgress ) + { + _cancel_timer_ex(&(pLed->BlinkTimer)); + pLed->bLedWPSBlinkInProgress = _FALSE; + } + + _set_timer(&(pLed->BlinkTimer), 0); + break; + + default: + break; + + } + + RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("CurrLedState %d\n", pLed->CurrLedState)); +} + + //COREGA, added by chiyoko, 20090316 + static void + SwLedControlMode3( + struct adapter *padapter, + LED_CTL_MODE LedAction +) +{ + struct led_priv *ledpriv = &(padapter->ledpriv); + struct mlme_priv *pmlmepriv = &padapter->mlmepriv; + PLED_871x pLed = &(ledpriv->SwLed0); + + switch(LedAction) + { + case LED_CTL_SITE_SURVEY: + if(pmlmepriv->LinkDetectInfo.bBusyTraffic) + ; + else if(pLed->bLedScanBlinkInProgress ==_FALSE) + { + if(IS_LED_WPS_BLINKING(pLed)) + return; + + if(pLed->bLedBlinkInProgress ==_TRUE) + { + _cancel_timer_ex(&(pLed->BlinkTimer)); + pLed->bLedBlinkInProgress = _FALSE; + } + pLed->bLedScanBlinkInProgress = _TRUE; + pLed->CurrLedState = LED_BLINK_SCAN; + pLed->BlinkTimes = 24; + if( pLed->bLedOn ) + pLed->BlinkingLedState = RTW_LED_OFF; + else + pLed->BlinkingLedState = RTW_LED_ON; + _set_timer(&(pLed->BlinkTimer), LED_BLINK_SCAN_INTERVAL_ALPHA); + } + break; + + case LED_CTL_TX: + case LED_CTL_RX: + if((pLed->bLedBlinkInProgress ==_FALSE) && (check_fwstate(pmlmepriv, _FW_LINKED)== _TRUE)) + { + if(pLed->CurrLedState == LED_BLINK_SCAN || IS_LED_WPS_BLINKING(pLed)) + { + return; + } + + pLed->bLedBlinkInProgress = _TRUE; + pLed->CurrLedState = LED_BLINK_TXRX; + pLed->BlinkTimes = 2; + if( pLed->bLedOn ) + pLed->BlinkingLedState = RTW_LED_OFF; + else + pLed->BlinkingLedState = RTW_LED_ON; + _set_timer(&(pLed->BlinkTimer), LED_BLINK_FASTER_INTERVAL_ALPHA); + } + break; + + case LED_CTL_LINK: + if(IS_LED_WPS_BLINKING(pLed)) + return; + + pLed->CurrLedState = RTW_LED_ON; + pLed->BlinkingLedState = RTW_LED_ON; + if( pLed->bLedBlinkInProgress) + { + _cancel_timer_ex(&(pLed->BlinkTimer)); + pLed->bLedBlinkInProgress = _FALSE; + } + if( pLed->bLedScanBlinkInProgress) + { + _cancel_timer_ex(&(pLed->BlinkTimer)); + pLed->bLedScanBlinkInProgress = _FALSE; + } + + _set_timer(&(pLed->BlinkTimer), 0); + break; + + case LED_CTL_START_WPS: //wait until xinpin finish + case LED_CTL_START_WPS_BOTTON: + if(pLed->bLedWPSBlinkInProgress ==_FALSE) + { + if(pLed->bLedBlinkInProgress ==_TRUE) + { + _cancel_timer_ex(&(pLed->BlinkTimer)); + pLed->bLedBlinkInProgress = _FALSE; + } + if(pLed->bLedScanBlinkInProgress ==_TRUE) + { + _cancel_timer_ex(&(pLed->BlinkTimer)); + pLed->bLedScanBlinkInProgress = _FALSE; + } + pLed->bLedWPSBlinkInProgress = _TRUE; + pLed->CurrLedState = LED_BLINK_WPS; + if( pLed->bLedOn ) + pLed->BlinkingLedState = RTW_LED_OFF; + else + pLed->BlinkingLedState = RTW_LED_ON; + _set_timer(&(pLed->BlinkTimer), LED_BLINK_SCAN_INTERVAL_ALPHA); + } + break; + + case LED_CTL_STOP_WPS: + if(pLed->bLedWPSBlinkInProgress) + { + _cancel_timer_ex(&(pLed->BlinkTimer)); + pLed->bLedWPSBlinkInProgress = _FALSE; + } + else + { + pLed->bLedWPSBlinkInProgress = _TRUE; + } + + pLed->CurrLedState = LED_BLINK_WPS_STOP; + if(pLed->bLedOn) + { + pLed->BlinkingLedState = RTW_LED_OFF; + _set_timer(&(pLed->BlinkTimer), LED_BLINK_WPS_SUCESS_INTERVAL_ALPHA); + } + else + { + pLed->BlinkingLedState = RTW_LED_ON; + _set_timer(&(pLed->BlinkTimer), 0); + } + + break; + + case LED_CTL_STOP_WPS_FAIL: + if(pLed->bLedWPSBlinkInProgress) + { + _cancel_timer_ex(&(pLed->BlinkTimer)); + pLed->bLedWPSBlinkInProgress = _FALSE; + } + + pLed->CurrLedState = RTW_LED_OFF; + pLed->BlinkingLedState = RTW_LED_OFF; + _set_timer(&(pLed->BlinkTimer), 0); + break; + + case LED_CTL_START_TO_LINK: + case LED_CTL_NO_LINK: + if(!IS_LED_BLINKING(pLed)) + { + pLed->CurrLedState = RTW_LED_OFF; + pLed->BlinkingLedState = RTW_LED_OFF; + _set_timer(&(pLed->BlinkTimer), 0); + } + break; + + case LED_CTL_POWER_OFF: + pLed->CurrLedState = RTW_LED_OFF; + pLed->BlinkingLedState = RTW_LED_OFF; + if( pLed->bLedBlinkInProgress) + { + _cancel_timer_ex(&(pLed->BlinkTimer)); + pLed->bLedBlinkInProgress = _FALSE; + } + if( pLed->bLedScanBlinkInProgress) + { + _cancel_timer_ex(&(pLed->BlinkTimer)); + pLed->bLedScanBlinkInProgress = _FALSE; + } + if( pLed->bLedWPSBlinkInProgress ) + { + _cancel_timer_ex(&(pLed->BlinkTimer)); + pLed->bLedWPSBlinkInProgress = _FALSE; + } + + _set_timer(&(pLed->BlinkTimer), 0); + break; + + default: + break; + + } + + RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("CurrLedState %d\n", pLed->CurrLedState)); +} + + + //Edimax-Belkin, added by chiyoko, 20090413 +static void +SwLedControlMode4( + struct adapter *padapter, + LED_CTL_MODE LedAction +) +{ + struct led_priv *ledpriv = &(padapter->ledpriv); + struct mlme_priv *pmlmepriv = &padapter->mlmepriv; + PLED_871x pLed = &(ledpriv->SwLed0); + PLED_871x pLed1 = &(ledpriv->SwLed1); + + switch(LedAction) + { + case LED_CTL_START_TO_LINK: + if(pLed1->bLedWPSBlinkInProgress) + { + pLed1->bLedWPSBlinkInProgress = _FALSE; + _cancel_timer_ex(&(pLed1->BlinkTimer)); + + pLed1->BlinkingLedState = RTW_LED_OFF; + pLed1->CurrLedState = RTW_LED_OFF; + + if(pLed1->bLedOn) + _set_timer(&(pLed->BlinkTimer), 0); + } + + if( pLed->bLedStartToLinkBlinkInProgress == _FALSE ) + { + if(pLed->CurrLedState == LED_BLINK_SCAN || IS_LED_WPS_BLINKING(pLed)) + { + return; + } + if(pLed->bLedBlinkInProgress ==_TRUE) + { + _cancel_timer_ex(&(pLed->BlinkTimer)); + pLed->bLedBlinkInProgress = _FALSE; + } + if(pLed->bLedNoLinkBlinkInProgress ==_TRUE) + { + _cancel_timer_ex(&(pLed->BlinkTimer)); + pLed->bLedNoLinkBlinkInProgress = _FALSE; + } + + pLed->bLedStartToLinkBlinkInProgress = _TRUE; + pLed->CurrLedState = LED_BLINK_StartToBlink; + if( pLed->bLedOn ) + { + pLed->BlinkingLedState = RTW_LED_OFF; + _set_timer(&(pLed->BlinkTimer), LED_BLINK_SLOWLY_INTERVAL); + } + else + { + pLed->BlinkingLedState = RTW_LED_ON; + _set_timer(&(pLed->BlinkTimer), LED_BLINK_NORMAL_INTERVAL); + } + } + break; + + case LED_CTL_LINK: + case LED_CTL_NO_LINK: + //LED1 settings + if(LedAction == LED_CTL_LINK) + { + if(pLed1->bLedWPSBlinkInProgress) + { + pLed1->bLedWPSBlinkInProgress = _FALSE; + _cancel_timer_ex(&(pLed1->BlinkTimer)); + + pLed1->BlinkingLedState = RTW_LED_OFF; + pLed1->CurrLedState = RTW_LED_OFF; + + if(pLed1->bLedOn) + _set_timer(&(pLed->BlinkTimer), 0); + } + } + + if( pLed->bLedNoLinkBlinkInProgress == _FALSE ) + { + if(pLed->CurrLedState == LED_BLINK_SCAN || IS_LED_WPS_BLINKING(pLed)) + { + return; + } + if(pLed->bLedBlinkInProgress ==_TRUE) + { + _cancel_timer_ex(&(pLed->BlinkTimer)); + pLed->bLedBlinkInProgress = _FALSE; + } + + pLed->bLedNoLinkBlinkInProgress = _TRUE; + pLed->CurrLedState = LED_BLINK_SLOWLY; + if( pLed->bLedOn ) + pLed->BlinkingLedState = RTW_LED_OFF; + else + pLed->BlinkingLedState = RTW_LED_ON; + _set_timer(&(pLed->BlinkTimer), LED_BLINK_NO_LINK_INTERVAL_ALPHA); + } + break; + + case LED_CTL_SITE_SURVEY: + if((pmlmepriv->LinkDetectInfo.bBusyTraffic) && (check_fwstate(pmlmepriv, _FW_LINKED)== _TRUE)) + ; + else if(pLed->bLedScanBlinkInProgress ==_FALSE) + { + if(IS_LED_WPS_BLINKING(pLed)) + return; + + if(pLed->bLedNoLinkBlinkInProgress == _TRUE) + { + _cancel_timer_ex(&(pLed->BlinkTimer)); + pLed->bLedNoLinkBlinkInProgress = _FALSE; + } + if(pLed->bLedBlinkInProgress ==_TRUE) + { + _cancel_timer_ex(&(pLed->BlinkTimer)); + pLed->bLedBlinkInProgress = _FALSE; + } + pLed->bLedScanBlinkInProgress = _TRUE; + pLed->CurrLedState = LED_BLINK_SCAN; + pLed->BlinkTimes = 24; + if( pLed->bLedOn ) + pLed->BlinkingLedState = RTW_LED_OFF; + else + pLed->BlinkingLedState = RTW_LED_ON; + _set_timer(&(pLed->BlinkTimer), LED_BLINK_SCAN_INTERVAL_ALPHA); + } + break; + + case LED_CTL_TX: + case LED_CTL_RX: + if(pLed->bLedBlinkInProgress ==_FALSE) + { + if(pLed->CurrLedState == LED_BLINK_SCAN || IS_LED_WPS_BLINKING(pLed)) + { + return; + } + if(pLed->bLedNoLinkBlinkInProgress == _TRUE) + { + _cancel_timer_ex(&(pLed->BlinkTimer)); + pLed->bLedNoLinkBlinkInProgress = _FALSE; + } + pLed->bLedBlinkInProgress = _TRUE; + pLed->CurrLedState = LED_BLINK_TXRX; + pLed->BlinkTimes = 2; + if( pLed->bLedOn ) + pLed->BlinkingLedState = RTW_LED_OFF; + else + pLed->BlinkingLedState = RTW_LED_ON; + _set_timer(&(pLed->BlinkTimer), LED_BLINK_FASTER_INTERVAL_ALPHA); + } + break; + + case LED_CTL_START_WPS: //wait until xinpin finish + case LED_CTL_START_WPS_BOTTON: + if(pLed1->bLedWPSBlinkInProgress) + { + pLed1->bLedWPSBlinkInProgress = _FALSE; + _cancel_timer_ex(&(pLed1->BlinkTimer)); + + pLed1->BlinkingLedState = RTW_LED_OFF; + pLed1->CurrLedState = RTW_LED_OFF; + + if(pLed1->bLedOn) + _set_timer(&(pLed->BlinkTimer), 0); + } + + if(pLed->bLedWPSBlinkInProgress ==_FALSE) + { + if(pLed->bLedNoLinkBlinkInProgress == _TRUE) + { + _cancel_timer_ex(&(pLed->BlinkTimer)); + pLed->bLedNoLinkBlinkInProgress = _FALSE; + } + if(pLed->bLedBlinkInProgress ==_TRUE) + { + _cancel_timer_ex(&(pLed->BlinkTimer)); + pLed->bLedBlinkInProgress = _FALSE; + } + if(pLed->bLedScanBlinkInProgress ==_TRUE) + { + _cancel_timer_ex(&(pLed->BlinkTimer)); + pLed->bLedScanBlinkInProgress = _FALSE; + } + pLed->bLedWPSBlinkInProgress = _TRUE; + pLed->CurrLedState = LED_BLINK_WPS; + if( pLed->bLedOn ) + { + pLed->BlinkingLedState = RTW_LED_OFF; + _set_timer(&(pLed->BlinkTimer), LED_BLINK_SLOWLY_INTERVAL); + } + else + { + pLed->BlinkingLedState = RTW_LED_ON; + _set_timer(&(pLed->BlinkTimer), LED_BLINK_NORMAL_INTERVAL); + } + } + break; + + case LED_CTL_STOP_WPS: //WPS connect success + if(pLed->bLedWPSBlinkInProgress) + { + _cancel_timer_ex(&(pLed->BlinkTimer)); + pLed->bLedWPSBlinkInProgress = _FALSE; + } + + pLed->bLedNoLinkBlinkInProgress = _TRUE; + pLed->CurrLedState = LED_BLINK_SLOWLY; + if( pLed->bLedOn ) + pLed->BlinkingLedState = RTW_LED_OFF; + else + pLed->BlinkingLedState = RTW_LED_ON; + _set_timer(&(pLed->BlinkTimer), LED_BLINK_NO_LINK_INTERVAL_ALPHA); + + break; + + case LED_CTL_STOP_WPS_FAIL: //WPS authentication fail + if(pLed->bLedWPSBlinkInProgress) + { + _cancel_timer_ex(&(pLed->BlinkTimer)); + pLed->bLedWPSBlinkInProgress = _FALSE; + } + + pLed->bLedNoLinkBlinkInProgress = _TRUE; + pLed->CurrLedState = LED_BLINK_SLOWLY; + if( pLed->bLedOn ) + pLed->BlinkingLedState = RTW_LED_OFF; + else + pLed->BlinkingLedState = RTW_LED_ON; + _set_timer(&(pLed->BlinkTimer), LED_BLINK_NO_LINK_INTERVAL_ALPHA); + + //LED1 settings + if(pLed1->bLedWPSBlinkInProgress) + _cancel_timer_ex(&(pLed1->BlinkTimer)); + else + pLed1->bLedWPSBlinkInProgress = _TRUE; + + pLed1->CurrLedState = LED_BLINK_WPS_STOP; + if( pLed1->bLedOn ) + pLed1->BlinkingLedState = RTW_LED_OFF; + else + pLed1->BlinkingLedState = RTW_LED_ON; + _set_timer(&(pLed->BlinkTimer), LED_BLINK_NORMAL_INTERVAL); + + break; + + case LED_CTL_STOP_WPS_FAIL_OVERLAP: //WPS session overlap + if(pLed->bLedWPSBlinkInProgress) + { + _cancel_timer_ex(&(pLed->BlinkTimer)); + pLed->bLedWPSBlinkInProgress = _FALSE; + } + + pLed->bLedNoLinkBlinkInProgress = _TRUE; + pLed->CurrLedState = LED_BLINK_SLOWLY; + if( pLed->bLedOn ) + pLed->BlinkingLedState = RTW_LED_OFF; + else + pLed->BlinkingLedState = RTW_LED_ON; + _set_timer(&(pLed->BlinkTimer), LED_BLINK_NO_LINK_INTERVAL_ALPHA); + + //LED1 settings + if(pLed1->bLedWPSBlinkInProgress) + _cancel_timer_ex(&(pLed1->BlinkTimer)); + else + pLed1->bLedWPSBlinkInProgress = _TRUE; + + pLed1->CurrLedState = LED_BLINK_WPS_STOP_OVERLAP; + pLed1->BlinkTimes = 10; + if( pLed1->bLedOn ) + pLed1->BlinkingLedState = RTW_LED_OFF; + else + pLed1->BlinkingLedState = RTW_LED_ON; + _set_timer(&(pLed->BlinkTimer), LED_BLINK_NORMAL_INTERVAL); + + break; + + case LED_CTL_POWER_OFF: + pLed->CurrLedState = RTW_LED_OFF; + pLed->BlinkingLedState = RTW_LED_OFF; + + if( pLed->bLedNoLinkBlinkInProgress) + { + _cancel_timer_ex(&(pLed->BlinkTimer)); + pLed->bLedNoLinkBlinkInProgress = _FALSE; + } + if( pLed->bLedLinkBlinkInProgress) + { + _cancel_timer_ex(&(pLed->BlinkTimer)); + pLed->bLedLinkBlinkInProgress = _FALSE; + } + if( pLed->bLedBlinkInProgress) + { + _cancel_timer_ex(&(pLed->BlinkTimer)); + pLed->bLedBlinkInProgress = _FALSE; + } + if( pLed->bLedWPSBlinkInProgress ) + { + _cancel_timer_ex(&(pLed->BlinkTimer)); + pLed->bLedWPSBlinkInProgress = _FALSE; + } + if( pLed->bLedScanBlinkInProgress) + { + _cancel_timer_ex(&(pLed->BlinkTimer)); + pLed->bLedScanBlinkInProgress = _FALSE; + } + if( pLed->bLedStartToLinkBlinkInProgress) + { + _cancel_timer_ex(&(pLed->BlinkTimer)); + pLed->bLedStartToLinkBlinkInProgress = _FALSE; + } + + if( pLed1->bLedWPSBlinkInProgress ) + { + _cancel_timer_ex(&(pLed1->BlinkTimer)); + pLed1->bLedWPSBlinkInProgress = _FALSE; + } + + pLed1->BlinkingLedState = LED_UNKNOWN; + SwLedOff(padapter, pLed); + SwLedOff(padapter, pLed1); + break; + + default: + break; + + } + + RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Led %d\n", pLed->CurrLedState)); +} + + + + //Sercomm-Belkin, added by chiyoko, 20090415 +static void +SwLedControlMode5( + struct adapter *padapter, + LED_CTL_MODE LedAction +) +{ +#ifndef CONFIG_LED_REMOVE_HAL + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter); +#endif + struct led_priv *ledpriv = &(padapter->ledpriv); + struct mlme_priv *pmlmepriv = &padapter->mlmepriv; + PLED_871x pLed = &(ledpriv->SwLed0); + +#ifndef CONFIG_LED_REMOVE_HAL + if(pHalData->EEPROMCustomerID == RT_CID_819x_CAMEO) + pLed = &(ledpriv->SwLed1); +#endif + + switch(LedAction) + { + case LED_CTL_POWER_ON: + case LED_CTL_NO_LINK: + case LED_CTL_LINK: //solid blue + pLed->CurrLedState = RTW_LED_ON; + pLed->BlinkingLedState = RTW_LED_ON; + + _set_timer(&(pLed->BlinkTimer), 0); + break; + + case LED_CTL_SITE_SURVEY: + if((pmlmepriv->LinkDetectInfo.bBusyTraffic) && (check_fwstate(pmlmepriv, _FW_LINKED)== _TRUE)) + ; + else if(pLed->bLedScanBlinkInProgress ==_FALSE) + { + if(pLed->bLedBlinkInProgress ==_TRUE) + { + _cancel_timer_ex(&(pLed->BlinkTimer)); + pLed->bLedBlinkInProgress = _FALSE; + } + pLed->bLedScanBlinkInProgress = _TRUE; + pLed->CurrLedState = LED_BLINK_SCAN; + pLed->BlinkTimes = 24; + if( pLed->bLedOn ) + pLed->BlinkingLedState = RTW_LED_OFF; + else + pLed->BlinkingLedState = RTW_LED_ON; + _set_timer(&(pLed->BlinkTimer), LED_BLINK_SCAN_INTERVAL_ALPHA); + } + break; + + case LED_CTL_TX: + case LED_CTL_RX: + if(pLed->bLedBlinkInProgress ==_FALSE) + { + if(pLed->CurrLedState == LED_BLINK_SCAN) + { + return; + } + pLed->bLedBlinkInProgress = _TRUE; + pLed->CurrLedState = LED_BLINK_TXRX; + pLed->BlinkTimes = 2; + if( pLed->bLedOn ) + pLed->BlinkingLedState = RTW_LED_OFF; + else + pLed->BlinkingLedState = RTW_LED_ON; + _set_timer(&(pLed->BlinkTimer), LED_BLINK_FASTER_INTERVAL_ALPHA); + } + break; + + case LED_CTL_POWER_OFF: + pLed->CurrLedState = RTW_LED_OFF; + pLed->BlinkingLedState = RTW_LED_OFF; + + if( pLed->bLedBlinkInProgress) + { + _cancel_timer_ex(&(pLed->BlinkTimer)); + pLed->bLedBlinkInProgress = _FALSE; + } + + SwLedOff(padapter, pLed); + break; + + default: + break; + + } + + RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Led %d\n", pLed->CurrLedState)); +} + + //WNC-Corega, added by chiyoko, 20090902 +static void +SwLedControlMode6( + struct adapter *padapter, + LED_CTL_MODE LedAction +) +{ + struct led_priv *ledpriv = &(padapter->ledpriv); + struct mlme_priv *pmlmepriv = &padapter->mlmepriv; + PLED_871x pLed0 = &(ledpriv->SwLed0); + + switch(LedAction) + { + case LED_CTL_POWER_ON: + case LED_CTL_LINK: + case LED_CTL_NO_LINK: + _cancel_timer_ex(&(pLed0->BlinkTimer)); + pLed0->CurrLedState = RTW_LED_ON; + pLed0->BlinkingLedState = RTW_LED_ON; + _set_timer(&(pLed0->BlinkTimer), 0); + break; + + case LED_CTL_POWER_OFF: + SwLedOff(padapter, pLed0); + break; + + default: + break; + } + + RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("ledcontrol 6 Led %d\n", pLed0->CurrLedState)); +} + +// +// Description: +// Handler function of LED Blinking. +// We dispatch acture LED blink action according to LedStrategy. +// +void BlinkHandler(PLED_871x pLed) +{ + struct adapter *padapter = pLed->padapter; + struct led_priv *ledpriv = &(padapter->ledpriv); + + //DBG_871X("%s (%s:%d)\n",__FUNCTION__, current->comm, current->pid); + + if( (padapter->bSurpriseRemoved == _TRUE) || ( padapter->bDriverStopped == _TRUE)) + { + //DBG_871X("%s bSurpriseRemoved:%d, bDriverStopped:%d\n", __FUNCTION__, padapter->bSurpriseRemoved, padapter->bDriverStopped); + return; + } + + switch(ledpriv->LedStrategy) + { + case SW_LED_MODE0: + SwLedBlink(pLed); + break; + + case SW_LED_MODE1: + SwLedBlink1(pLed); + break; + + case SW_LED_MODE2: + SwLedBlink2(pLed); + break; + + case SW_LED_MODE3: + SwLedBlink3(pLed); + break; + + case SW_LED_MODE4: + SwLedBlink4(pLed); + break; + + case SW_LED_MODE5: + SwLedBlink5(pLed); + break; + + case SW_LED_MODE6: + SwLedBlink6(pLed); + break; + + default: + //RT_TRACE(COMP_LED, DBG_LOUD, ("BlinkWorkItemCallback 0x%x \n", pHalData->LedStrategy)); + //SwLedBlink(pLed); + break; + } +} + +void +LedControl871x( + struct adapter *padapter, + LED_CTL_MODE LedAction + ) +{ + struct led_priv *ledpriv = &(padapter->ledpriv); + + if( (padapter->bSurpriseRemoved == _TRUE) || ( padapter->bDriverStopped == _TRUE) + ||(padapter->hw_init_completed == _FALSE) ) + { + return; + } + + + if( ledpriv->bRegUseLed == _FALSE) + return; + + //if (!priv->up) + // return; + + //if(priv->bInHctTest) + // return; + + if( (adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on && + adapter_to_pwrctl(padapter)->rfoff_reason > RF_CHANGE_BY_PS) && + (LedAction == LED_CTL_TX || LedAction == LED_CTL_RX || + LedAction == LED_CTL_SITE_SURVEY || + LedAction == LED_CTL_LINK || + LedAction == LED_CTL_NO_LINK || + LedAction == LED_CTL_POWER_ON) ) + { + return; + } + + switch(ledpriv->LedStrategy) + { + case SW_LED_MODE0: + //SwLedControlMode0(padapter, LedAction); + break; + + case SW_LED_MODE1: + SwLedControlMode1(padapter, LedAction); + break; + case SW_LED_MODE2: + SwLedControlMode2(padapter, LedAction); + break; + + case SW_LED_MODE3: + SwLedControlMode3(padapter, LedAction); + break; + + case SW_LED_MODE4: + SwLedControlMode4(padapter, LedAction); + break; + + case SW_LED_MODE5: + SwLedControlMode5(padapter, LedAction); + break; + + case SW_LED_MODE6: + SwLedControlMode6(padapter, LedAction); + break; + + default: + break; + } + + RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("LedStrategy:%d, LedAction %d\n", ledpriv->LedStrategy,LedAction)); +} + +#endif diff --git a/core/rtw_mlme.c b/core/rtw_mlme.c index 51efdbe..6fb137b 100755 --- a/core/rtw_mlme.c +++ b/core/rtw_mlme.c @@ -1,7 +1,7 @@ /****************************************************************************** * * 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. @@ -63,26 +63,26 @@ _func_enter_; pmlmepriv->cur_network.network.InfrastructureMode = Ndis802_11AutoUnknown; pmlmepriv->scan_mode=SCAN_ACTIVE;// 1: active, 0: pasive. Maybe someday we should rename this varable to "active_mode" (Jeff) - _rtw_spinlock_init(&(pmlmepriv->lock)); + _rtw_spinlock_init(&(pmlmepriv->lock)); _rtw_init_queue(&(pmlmepriv->free_bss_pool)); _rtw_init_queue(&(pmlmepriv->scanned_queue)); set_scanned_network_val(pmlmepriv, 0); - + _rtw_memset(&pmlmepriv->assoc_ssid,0,sizeof(NDIS_802_11_SSID)); pbuf = rtw_zvmalloc(MAX_BSS_CNT * (sizeof(struct wlan_network))); - + if (pbuf == NULL){ res=_FAIL; goto exit; } pmlmepriv->free_bss_buf = pbuf; - + pnetwork = (struct wlan_network *)pbuf; - + for(i = 0; i < MAX_BSS_CNT; i++) - { + { _rtw_init_listhead(&(pnetwork->list)); rtw_list_insert_tail(&(pnetwork->list), &(pmlmepriv->free_bss_pool.queue)); @@ -105,7 +105,7 @@ exit: _func_exit_; return res; -} +} void rtw_mfree_mlme_priv_lock (struct mlme_priv *pmlmepriv); void rtw_mfree_mlme_priv_lock (struct mlme_priv *pmlmepriv) @@ -118,11 +118,11 @@ void rtw_mfree_mlme_priv_lock (struct mlme_priv *pmlmepriv) static void rtw_free_mlme_ie_data(u8 **ppie, u32 *plen) { if(*ppie) - { + { rtw_mfree(*ppie, *plen); *plen = 0; *ppie=NULL; - } + } } void rtw_free_mlme_priv_ie_data(struct mlme_priv *pmlmepriv) @@ -134,7 +134,7 @@ void rtw_free_mlme_priv_ie_data(struct mlme_priv *pmlmepriv) rtw_free_mlme_ie_data(&pmlmepriv->wps_probe_req_ie, &pmlmepriv->wps_probe_req_ie_len); rtw_free_mlme_ie_data(&pmlmepriv->wps_probe_resp_ie, &pmlmepriv->wps_probe_resp_ie_len); rtw_free_mlme_ie_data(&pmlmepriv->wps_assoc_resp_ie, &pmlmepriv->wps_assoc_resp_ie_len); - + rtw_free_mlme_ie_data(&pmlmepriv->p2p_beacon_ie, &pmlmepriv->p2p_beacon_ie_len); rtw_free_mlme_ie_data(&pmlmepriv->p2p_probe_req_ie, &pmlmepriv->p2p_probe_req_ie_len); rtw_free_mlme_ie_data(&pmlmepriv->p2p_probe_resp_ie, &pmlmepriv->p2p_probe_resp_ie_len); @@ -142,7 +142,7 @@ void rtw_free_mlme_priv_ie_data(struct mlme_priv *pmlmepriv) rtw_free_mlme_ie_data(&pmlmepriv->p2p_assoc_req_ie, &pmlmepriv->p2p_assoc_req_ie_len); #endif -#if defined(CONFIG_WFD) && defined(CONFIG_IOCTL_CFG80211) +#if defined(CONFIG_WFD) && defined(CONFIG_IOCTL_CFG80211) rtw_free_mlme_ie_data(&pmlmepriv->wfd_beacon_ie, &pmlmepriv->wfd_beacon_ie_len); rtw_free_mlme_ie_data(&pmlmepriv->wfd_probe_req_ie, &pmlmepriv->wfd_probe_req_ie_len); rtw_free_mlme_ie_data(&pmlmepriv->wfd_probe_resp_ie, &pmlmepriv->wfd_probe_resp_ie_len); @@ -165,27 +165,27 @@ _func_enter_; rtw_vmfree(pmlmepriv->free_bss_buf, MAX_BSS_CNT * sizeof(struct wlan_network)); } } -_func_exit_; +_func_exit_; } sint _rtw_enqueue_network(_queue *queue, struct wlan_network *pnetwork) { _irqL irqL; -_func_enter_; +_func_enter_; if (pnetwork == NULL) goto exit; - + _enter_critical_bh(&queue->lock, &irqL); rtw_list_insert_tail(&pnetwork->list, &queue->queue); _exit_critical_bh(&queue->lock, &irqL); -exit: +exit: -_func_exit_; +_func_exit_; return _SUCCESS; } @@ -196,24 +196,24 @@ struct wlan_network *_rtw_dequeue_network(_queue *queue) struct wlan_network *pnetwork; -_func_enter_; +_func_enter_; _enter_critical_bh(&queue->lock, &irqL); if (_rtw_queue_empty(queue) == _TRUE) pnetwork = NULL; - + else { pnetwork = LIST_CONTAINOR(get_next(&queue->queue), struct wlan_network, list); - + rtw_list_delete(&(pnetwork->list)); } - + _exit_critical_bh(&queue->lock, &irqL); -_func_exit_; +_func_exit_; return pnetwork; } @@ -221,49 +221,49 @@ _func_exit_; struct wlan_network *_rtw_alloc_network(struct mlme_priv *pmlmepriv )//(_queue *free_queue) { _irqL irqL; - struct wlan_network *pnetwork; + struct wlan_network *pnetwork; _queue *free_queue = &pmlmepriv->free_bss_pool; _list* plist = NULL; - -_func_enter_; + +_func_enter_; _enter_critical_bh(&free_queue->lock, &irqL); - + if (_rtw_queue_empty(free_queue) == _TRUE) { pnetwork=NULL; goto exit; } plist = get_next(&(free_queue->queue)); - + pnetwork = LIST_CONTAINOR(plist , struct wlan_network, list); - + rtw_list_delete(&pnetwork->list); - + RT_TRACE(_module_rtl871x_mlme_c_, _drv_info_, ("_rtw_alloc_network: ptr=%p\n", plist)); pnetwork->network_type = 0; pnetwork->fixed = _FALSE; pnetwork->last_scanned = rtw_get_current_time(); - pnetwork->aid=0; + pnetwork->aid=0; pnetwork->join_res=0; pmlmepriv->num_of_scanned ++; - + exit: _exit_critical_bh(&free_queue->lock, &irqL); -_func_exit_; +_func_exit_; - return pnetwork; + return pnetwork; } void _rtw_free_network(struct mlme_priv *pmlmepriv ,struct wlan_network *pnetwork, u8 isfreeall) { u32 curr_time, delta_time; u32 lifetime = SCANQUEUE_LIFETIME; - _irqL irqL; + _irqL irqL; _queue *free_queue = &(pmlmepriv->free_bss_pool); - -_func_enter_; + +_func_enter_; if (pnetwork == NULL) goto exit; @@ -271,35 +271,35 @@ _func_enter_; if (pnetwork->fixed == _TRUE) goto exit; - curr_time = rtw_get_current_time(); + curr_time = rtw_get_current_time(); - if ( (check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE)==_TRUE ) || + if ( (check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE)==_TRUE ) || (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE)==_TRUE ) ) lifetime = 1; if (!isfreeall) { - delta_time = (curr_time -pnetwork->last_scanned)/HZ; + delta_time = (curr_time -pnetwork->last_scanned)/HZ; if (delta_time < lifetime)// unit:sec goto exit; } _enter_critical_bh(&free_queue->lock, &irqL); - + rtw_list_delete(&(pnetwork->list)); rtw_list_insert_tail(&(pnetwork->list),&(free_queue->queue)); - + pmlmepriv->num_of_scanned --; - + //DBG_871X("_rtw_free_network:SSID=%s\n", pnetwork->network.Ssid.Ssid); - + _exit_critical_bh(&free_queue->lock, &irqL); - -exit: - -_func_exit_; + +exit: + +_func_exit_; } @@ -308,7 +308,7 @@ void _rtw_free_network_nolock(struct mlme_priv *pmlmepriv, struct wlan_network * _queue *free_queue = &(pmlmepriv->free_bss_pool); -_func_enter_; +_func_enter_; if (pnetwork == NULL) goto exit; @@ -317,18 +317,18 @@ _func_enter_; goto exit; //_enter_critical(&free_queue->lock, &irqL); - + rtw_list_delete(&(pnetwork->list)); rtw_list_insert_tail(&(pnetwork->list), get_list_head(free_queue)); - - pmlmepriv->num_of_scanned --; - - //_exit_critical(&free_queue->lock, &irqL); - -exit: -_func_exit_; + pmlmepriv->num_of_scanned --; + + //_exit_critical(&free_queue->lock, &irqL); + +exit: + +_func_exit_; } @@ -345,26 +345,26 @@ struct wlan_network *_rtw_find_network(_queue *scanned_queue, u8 *addr) _list *phead, *plist; struct wlan_network *pnetwork = NULL; u8 zero_addr[ETH_ALEN] = {0,0,0,0,0,0}; - -_func_enter_; + +_func_enter_; if(_rtw_memcmp(zero_addr, addr, ETH_ALEN)){ pnetwork=NULL; goto exit; } - + //_enter_critical_bh(&scanned_queue->lock, &irqL); - + phead = get_list_head(scanned_queue); plist = get_next(phead); - + while (plist != phead) { pnetwork = LIST_CONTAINOR(plist, struct wlan_network ,list); if (_rtw_memcmp(addr, pnetwork->network.MacAddress, ETH_ALEN) == _TRUE) break; - + plist = get_next(plist); } @@ -372,13 +372,13 @@ _func_enter_; pnetwork = NULL; //_exit_critical_bh(&scanned_queue->lock, &irqL); - -exit: - -_func_exit_; + +exit: + +_func_exit_; return pnetwork; - + } @@ -390,8 +390,8 @@ void _rtw_free_network_queue(struct adapter *padapter, u8 isfreeall) struct mlme_priv* pmlmepriv = &padapter->mlmepriv; _queue *scanned_queue = &pmlmepriv->scanned_queue; -_func_enter_; - +_func_enter_; + _enter_critical_bh(&scanned_queue->lock, &irqL); @@ -406,12 +406,12 @@ _func_enter_; plist = get_next(plist); _rtw_free_network(pmlmepriv,pnetwork, isfreeall); - + } _exit_critical_bh(&scanned_queue->lock, &irqL); - -_func_exit_; + +_func_exit_; } @@ -421,16 +421,16 @@ _func_exit_; sint rtw_if_up(struct adapter *padapter) { sint res; -_func_enter_; +_func_enter_; if( padapter->bDriverStopped || padapter->bSurpriseRemoved || - (check_fwstate(&padapter->mlmepriv, _FW_LINKED)== _FALSE)){ - RT_TRACE(_module_rtl871x_mlme_c_, _drv_info_, ("rtw_if_up:bDriverStopped(%d) OR bSurpriseRemoved(%d)", padapter->bDriverStopped, padapter->bSurpriseRemoved)); + (check_fwstate(&padapter->mlmepriv, _FW_LINKED)== _FALSE)){ + RT_TRACE(_module_rtl871x_mlme_c_, _drv_info_, ("rtw_if_up:bDriverStopped(%d) OR bSurpriseRemoved(%d)", padapter->bDriverStopped, padapter->bSurpriseRemoved)); res=_FALSE; } else res= _TRUE; - + _func_exit_; return res; } @@ -460,31 +460,31 @@ u8 *rtw_get_capability_from_ie(u8 *ie) u16 rtw_get_capability(WLAN_BSSID_EX *bss) { u16 val; -_func_enter_; +_func_enter_; - _rtw_memcpy((u8 *)&val, rtw_get_capability_from_ie(bss->IEs), 2); + _rtw_memcpy((u8 *)&val, rtw_get_capability_from_ie(bss->IEs), 2); -_func_exit_; +_func_exit_; return le16_to_cpu(val); } u8 *rtw_get_timestampe_from_ie(u8 *ie) { - return (ie + 0); + return (ie + 0); } u8 *rtw_get_beacon_interval_from_ie(u8 *ie) { - return (ie + 8); + return (ie + 8); } int rtw_init_mlme_priv (struct adapter *padapter)//(struct mlme_priv *pmlmepriv) { int res; -_func_enter_; +_func_enter_; res = _rtw_init_mlme_priv(padapter);// (pmlmepriv); -_func_exit_; +_func_exit_; return res; } @@ -493,16 +493,16 @@ void rtw_free_mlme_priv (struct mlme_priv *pmlmepriv) _func_enter_; RT_TRACE(_module_rtl871x_mlme_c_,_drv_err_,("rtw_free_mlme_priv\n")); _rtw_free_mlme_priv (pmlmepriv); -_func_exit_; +_func_exit_; } int rtw_enqueue_network(_queue *queue, struct wlan_network *pnetwork); int rtw_enqueue_network(_queue *queue, struct wlan_network *pnetwork) { int res; -_func_enter_; +_func_enter_; res = _rtw_enqueue_network(queue, pnetwork); -_func_exit_; +_func_exit_; return res; } @@ -510,9 +510,9 @@ _func_exit_; static struct wlan_network *rtw_dequeue_network(_queue *queue) { struct wlan_network *pnetwork; -_func_enter_; +_func_enter_; pnetwork = _rtw_dequeue_network(queue); -_func_exit_; +_func_exit_; return pnetwork; } @@ -520,36 +520,36 @@ struct wlan_network *rtw_alloc_network(struct mlme_priv *pmlmepriv ); struct wlan_network *rtw_alloc_network(struct mlme_priv *pmlmepriv )//(_queue *free_queue) { struct wlan_network *pnetwork; -_func_enter_; +_func_enter_; pnetwork = _rtw_alloc_network(pmlmepriv); -_func_exit_; +_func_exit_; return pnetwork; } void rtw_free_network(struct mlme_priv *pmlmepriv, struct wlan_network *pnetwork, u8 is_freeall); void rtw_free_network(struct mlme_priv *pmlmepriv, struct wlan_network *pnetwork, u8 is_freeall)//(struct wlan_network *pnetwork, _queue *free_queue) { -_func_enter_; +_func_enter_; RT_TRACE(_module_rtl871x_mlme_c_,_drv_err_,("rtw_free_network==> ssid = %s \n\n" , pnetwork->network.Ssid.Ssid)); _rtw_free_network(pmlmepriv, pnetwork, is_freeall); -_func_exit_; +_func_exit_; } void rtw_free_network_nolock(struct mlme_priv *pmlmepriv, struct wlan_network *pnetwork ); void rtw_free_network_nolock(struct mlme_priv *pmlmepriv, struct wlan_network *pnetwork ) { -_func_enter_; +_func_enter_; //RT_TRACE(_module_rtl871x_mlme_c_,_drv_err_,("rtw_free_network==> ssid = %s \n\n" , pnetwork->network.Ssid.Ssid)); _rtw_free_network_nolock(pmlmepriv, pnetwork); -_func_exit_; +_func_exit_; } void rtw_free_network_queue(struct adapter* dev, u8 isfreeall) { -_func_enter_; +_func_enter_; _rtw_free_network_queue(dev, isfreeall); -_func_exit_; +_func_exit_; } /* @@ -583,9 +583,9 @@ int rtw_is_same_ibss(struct adapter *adapter, struct wlan_network *pnetwork) { ret=_TRUE; } - + return ret; - + } inline int is_same_ess(WLAN_BSSID_EX *a, WLAN_BSSID_EX *b); @@ -593,24 +593,24 @@ inline int is_same_ess(WLAN_BSSID_EX *a, WLAN_BSSID_EX *b) { //RT_TRACE(_module_rtl871x_mlme_c_,_drv_err_,("(%s,%d)(%s,%d)\n", // a->Ssid.Ssid,a->Ssid.SsidLength,b->Ssid.Ssid,b->Ssid.SsidLength)); - return (a->Ssid.SsidLength == b->Ssid.SsidLength) + return (a->Ssid.SsidLength == b->Ssid.SsidLength) && _rtw_memcmp(a->Ssid.Ssid, b->Ssid.Ssid, a->Ssid.SsidLength)==_TRUE; } int is_same_network(WLAN_BSSID_EX *src, WLAN_BSSID_EX *dst, u8 feature) { u16 s_cap, d_cap; - -_func_enter_; + +_func_enter_; #ifdef PLATFORM_OS_XP - if ( ((uint)dst) <= 0x7fffffff || - ((uint)src) <= 0x7fffffff || - ((uint)&s_cap) <= 0x7fffffff || - ((uint)&d_cap) <= 0x7fffffff) + if ( ((uint)dst) <= 0x7fffffff || + ((uint)src) <= 0x7fffffff || + ((uint)&s_cap) <= 0x7fffffff || + ((uint)&d_cap) <= 0x7fffffff) { RT_TRACE(_module_rtl871x_mlme_c_,_drv_err_,("\n@@@@ error address of dst\n")); - + KeBugCheckEx(0x87110000, (ULONG_PTR)dst, (ULONG_PTR)src,(ULONG_PTR)&s_cap, (ULONG_PTR)&d_cap); return _FALSE; @@ -621,11 +621,11 @@ _func_enter_; _rtw_memcpy((u8 *)&s_cap, rtw_get_capability_from_ie(src->IEs), 2); _rtw_memcpy((u8 *)&d_cap, rtw_get_capability_from_ie(dst->IEs), 2); - + s_cap = le16_to_cpu(s_cap); d_cap = le16_to_cpu(d_cap); - -_func_exit_; + +_func_exit_; #ifdef CONFIG_P2P if ((feature == 1) && // 1: P2P supported @@ -639,44 +639,44 @@ _func_exit_; // (src->Configuration.DSConfig == dst->Configuration.DSConfig) && ( (_rtw_memcmp(src->MacAddress, dst->MacAddress, ETH_ALEN)) == _TRUE) && ( (_rtw_memcmp(src->Ssid.Ssid, dst->Ssid.Ssid, src->Ssid.SsidLength)) == _TRUE) && - ((s_cap & WLAN_CAPABILITY_IBSS) == + ((s_cap & WLAN_CAPABILITY_IBSS) == (d_cap & WLAN_CAPABILITY_IBSS)) && - ((s_cap & WLAN_CAPABILITY_BSS) == + ((s_cap & WLAN_CAPABILITY_BSS) == (d_cap & WLAN_CAPABILITY_BSS))); - + } struct wlan_network * rtw_get_oldest_wlan_network(_queue *scanned_queue) { _list *plist, *phead; - + struct wlan_network *pwlan = NULL; struct wlan_network *oldest = NULL; -_func_enter_; +_func_enter_; phead = get_list_head(scanned_queue); - + plist = get_next(phead); while(1) { - + if (rtw_end_of_queue_search(phead,plist)== _TRUE) break; - + pwlan= LIST_CONTAINOR(plist, struct wlan_network, list); if(pwlan->fixed!=_TRUE) - { + { if (oldest == NULL ||time_after(oldest->last_scanned, pwlan->last_scanned)) oldest = pwlan; } - + plist = get_next(plist); } -_func_exit_; +_func_exit_; return oldest; - + } void update_network(WLAN_BSSID_EX *dst, WLAN_BSSID_EX *src, @@ -694,7 +694,7 @@ void update_network(WLAN_BSSID_EX *dst, WLAN_BSSID_EX *src, u8 sq_final; long rssi_final; -_func_enter_; +_func_enter_; #ifdef CONFIG_ANTENNA_DIVERSITY rtw_hal_antdiv_rssi_compared(padapter, dst, src); //this will update src.Rssi, need consider again @@ -733,7 +733,7 @@ _func_enter_; sq_final = dst->PhyInfo.SignalQuality; rssi_final = dst->Rssi; } - + } if (update_ie) { @@ -758,7 +758,7 @@ _func_enter_; // DBG_871X("update_network: rssi=0x%lx dst->Rssi=%d ,dst->Rssi=0x%lx , src->Rssi=0x%lx",(dst->Rssi+src->Rssi)/2,dst->Rssi,dst->Rssi,src->Rssi); if (check_fwstate(&padapter->mlmepriv, _FW_LINKED) && is_same_network(&(padapter->mlmepriv.cur_network.network), src, 0)) { - + //DBG_871X("b:ssid=%s update_network: src->rssi=0x%d padapter->recvpriv.ui_rssi=%d\n",src->Ssid.Ssid,src->Rssi,padapter->recvpriv.signal); if(padapter->recvpriv.signal_qual_data.total_num++ >= PHY_LINKQUALITY_SLID_WIN_MAX) { @@ -766,9 +766,9 @@ _func_enter_; last_evm = padapter->recvpriv.signal_qual_data.elements[padapter->recvpriv.signal_qual_data.index]; padapter->recvpriv.signal_qual_data.total_val -= last_evm; } - padapter->recvpriv.signal_qual_data.total_val += query_rx_pwr_percentage(src->Rssi); + padapter->recvpriv.signal_qual_data.total_val += query_rx_pwr_percentage(src->Rssi); - padapter->recvpriv.signal_qual_data.elements[padapter->recvpriv.signal_qual_data.index++] = query_rx_pwr_percentage(src->Rssi); + padapter->recvpriv.signal_qual_data.elements[padapter->recvpriv.signal_qual_data.index++] = query_rx_pwr_percentage(src->Rssi); if(padapter->recvpriv.signal_qual_data.index >= PHY_LINKQUALITY_SLID_WIN_MAX) padapter->recvpriv.signal_qual_data.index = 0; @@ -783,24 +783,24 @@ _func_enter_; else{ // DBG_871X("ELSE:ssid=%s update_network: src->rssi=0x%d dst->rssi=%d\n",src->Ssid.Ssid,src->Rssi,dst->Rssi); src->Rssi=(src->Rssi +dst->Rssi)/2;//dBM - } + } // DBG_871X("a:update_network: src->rssi=0x%d padapter->recvpriv.ui_rssi=%d\n",src->Rssi,padapter->recvpriv.signal); #endif -_func_exit_; +_func_exit_; } static void update_current_network(struct adapter *adapter, WLAN_BSSID_EX *pnetwork) { struct mlme_priv *pmlmepriv = &(adapter->mlmepriv); - -_func_enter_; + +_func_enter_; #ifdef PLATFORM_OS_XP if ((unsigned long)(&(pmlmepriv->cur_network.network)) < 0x7ffffff) - { + { KeBugCheckEx(0x87111c1c, (ULONG_PTR)(&(pmlmepriv->cur_network.network)), 0, 0,0); } #endif @@ -812,12 +812,12 @@ _func_enter_; //if(pmlmepriv->cur_network.network.IELength<= pnetwork->IELength) { update_network(&(pmlmepriv->cur_network.network), pnetwork,adapter, _TRUE); - rtw_update_protection(adapter, (pmlmepriv->cur_network.network.IEs) + sizeof (NDIS_802_11_FIXED_IEs), + rtw_update_protection(adapter, (pmlmepriv->cur_network.network.IEs) + sizeof (NDIS_802_11_FIXED_IEs), pmlmepriv->cur_network.network.IELength); } } -_func_exit_; +_func_exit_; } @@ -868,7 +868,7 @@ _func_enter_; } if (is_same_network(&(pnetwork->network), target, feature)) { - target_find = 1; + target_find = 1; break; } @@ -879,13 +879,13 @@ _func_enter_; plist = get_next(plist); } - - + + /* If we didn't find a match, then get a new network slot to initialize * with this beacon's information */ //if (rtw_end_of_queue_search(phead,plist)== _TRUE) { if (!target_find) { - + if (_rtw_queue_empty(&(pmlmepriv->free_bss_pool)) == _TRUE) { /* If there are no more slots, expire the oldest */ //list_del_init(&oldest->list); @@ -901,8 +901,8 @@ _func_enter_; pnetwork->fixed = _FALSE; pnetwork->last_scanned = rtw_get_current_time(); - pnetwork->network_type = 0; - pnetwork->aid=0; + pnetwork->network_type = 0; + pnetwork->aid=0; pnetwork->join_res=0; /* bss info not receving from the right channel */ @@ -914,7 +914,7 @@ _func_enter_; pnetwork = rtw_alloc_network(pmlmepriv); // will update scan_time - if(pnetwork==NULL){ + if(pnetwork==NULL){ RT_TRACE(_module_rtl871x_mlme_c_,_drv_err_,("\n\n\nsomething wrong here\n\n\n")); goto exit; } @@ -933,13 +933,13 @@ _func_enter_; if (pnetwork->network.PhyInfo.SignalQuality == 101) pnetwork->network.PhyInfo.SignalQuality = 0; - rtw_list_insert_tail(&(pnetwork->list),&(queue->queue)); + rtw_list_insert_tail(&(pnetwork->list),&(queue->queue)); } } else { /* we have an entry and we are going to update it. But this entry may - * be already expired. In this case we do the same as we found a new + * be already expired. In this case we do the same as we found a new * net and call the new_net handler */ bool update_ie = _TRUE; @@ -973,21 +973,21 @@ void rtw_add_network(struct adapter *adapter, WLAN_BSSID_EX *pnetwork) struct mlme_priv *pmlmepriv = &(((struct adapter *)adapter)->mlmepriv); //_queue *queue = &(pmlmepriv->scanned_queue); -_func_enter_; +_func_enter_; //_enter_critical_bh(&queue->lock, &irqL); #if defined(CONFIG_P2P) && defined(CONFIG_P2P_REMOVE_GROUP_INFO) rtw_WLAN_BSSID_EX_remove_p2p_attr(pnetwork, P2P_ATTR_GROUP_INFO); #endif - + update_current_network(adapter, pnetwork); - + rtw_update_scanned_network(adapter, pnetwork); //_exit_critical_bh(&queue->lock, &irqL); - -_func_exit_; + +_func_exit_; } //select the desired network based on the capability of the (i)bss. @@ -1008,7 +1008,7 @@ int rtw_is_desired_network(struct adapter *adapter, struct wlan_network *pnetwor uint wps_ielen; int bselected = _TRUE; - + desired_encmode = psecuritypriv->ndisencryptstatus; privacy = pnetwork->network.Privacy; @@ -1019,9 +1019,9 @@ int rtw_is_desired_network(struct adapter *adapter, struct wlan_network *pnetwor return _TRUE; } else - { + { return _FALSE; - } + } } if (adapter->registrypriv.wifi_spec == 1) //for correct flow of 8021X to do.... { @@ -1040,19 +1040,19 @@ int rtw_is_desired_network(struct adapter *adapter, struct wlan_network *pnetwor } } } - - if ((desired_encmode != Ndis802_11EncryptionDisabled) && (privacy == 0)) { + + if ((desired_encmode != Ndis802_11EncryptionDisabled) && (privacy == 0)) { DBG_871X("desired_encmode: %d, privacy: %d\n", desired_encmode, privacy); bselected = _FALSE; - } + } if(check_fwstate(pmlmepriv, WIFI_ADHOC_STATE) == _TRUE) { if(pnetwork->network.InfrastructureMode != pmlmepriv->cur_network.network.InfrastructureMode) bselected = _FALSE; - } - + } + return bselected; } @@ -1061,10 +1061,10 @@ int rtw_is_desired_network(struct adapter *adapter, struct wlan_network *pnetwor void rtw_atimdone_event_callback(struct adapter *adapter , u8 *pbuf) { -_func_enter_; - RT_TRACE(_module_rtl871x_mlme_c_,_drv_err_,("receive atimdone_evet\n")); -_func_exit_; - return; +_func_enter_; + RT_TRACE(_module_rtl871x_mlme_c_,_drv_err_,("receive atimdone_evet\n")); +_func_exit_; + return; } @@ -1075,7 +1075,7 @@ void rtw_survey_event_callback(struct adapter *adapter, u8 *pbuf) WLAN_BSSID_EX *pnetwork; struct mlme_priv *pmlmepriv = &(adapter->mlmepriv); -_func_enter_; +_func_enter_; pnetwork = (WLAN_BSSID_EX *)pbuf; @@ -1099,14 +1099,14 @@ _func_enter_; { struct wlan_network* ibss_wlan = NULL; _irqL irqL; - + _rtw_memcpy(pmlmepriv->cur_network.network.IEs, pnetwork->IEs, 8); _enter_critical_bh(&(pmlmepriv->scanned_queue.lock), &irqL); ibss_wlan = rtw_find_network(&pmlmepriv->scanned_queue, pnetwork->MacAddress); if(ibss_wlan) { - _rtw_memcpy(ibss_wlan->network.IEs , pnetwork->IEs, 8); - _exit_critical_bh(&(pmlmepriv->scanned_queue.lock), &irqL); + _rtw_memcpy(ibss_wlan->network.IEs , pnetwork->IEs, 8); + _exit_critical_bh(&(pmlmepriv->scanned_queue.lock), &irqL); goto exit; } _exit_critical_bh(&(pmlmepriv->scanned_queue.lock), &irqL); @@ -1115,21 +1115,21 @@ _func_enter_; // lock pmlmepriv->lock when you accessing network_q if ((check_fwstate(pmlmepriv, _FW_UNDER_LINKING)) == _FALSE) - { - if( pnetwork->Ssid.Ssid[0] == 0 ) + { + if( pnetwork->Ssid.Ssid[0] == 0 ) { pnetwork->Ssid.SsidLength = 0; - } + } rtw_add_network(adapter, pnetwork); } -exit: - +exit: + _exit_critical_bh(&pmlmepriv->lock, &irqL); -_func_exit_; +_func_exit_; - return; + return; } @@ -1139,14 +1139,14 @@ void rtw_surveydone_event_callback(struct adapter *adapter, u8 *pbuf) _irqL irqL; u8 timer_cancelled = _FALSE; struct mlme_priv *pmlmepriv = &(adapter->mlmepriv); - -#ifdef CONFIG_MLME_EXT + +#ifdef CONFIG_MLME_EXT mlmeext_surveydone_event_callback(adapter); #endif -_func_enter_; +_func_enter_; _enter_critical_bh(&pmlmepriv->lock, &irqL); if(pmlmepriv->wps_probe_req_ie) @@ -1154,23 +1154,23 @@ _func_enter_; u32 free_len = pmlmepriv->wps_probe_req_ie_len; pmlmepriv->wps_probe_req_ie_len = 0; rtw_mfree(pmlmepriv->wps_probe_req_ie, free_len); - pmlmepriv->wps_probe_req_ie = NULL; + pmlmepriv->wps_probe_req_ie = NULL; } - + RT_TRACE(_module_rtl871x_mlme_c_,_drv_info_,("rtw_surveydone_event_callback: fw_state:%x\n\n", get_fwstate(pmlmepriv))); - + if (check_fwstate(pmlmepriv,_FW_UNDER_SURVEY)) { //u8 timer_cancelled; timer_cancelled = _TRUE; //_cancel_timer(&pmlmepriv->scan_to_timer, &timer_cancelled); - + _clr_fwstate_(pmlmepriv, _FW_UNDER_SURVEY); } else { - - RT_TRACE(_module_rtl871x_mlme_c_,_drv_err_,("nic status =%x, survey done event comes too late!\n", get_fwstate(pmlmepriv))); + + RT_TRACE(_module_rtl871x_mlme_c_,_drv_err_,("nic status =%x, survey done event comes too late!\n", get_fwstate(pmlmepriv))); } _exit_critical_bh(&pmlmepriv->lock, &irqL); @@ -1190,38 +1190,38 @@ _func_enter_; { if(check_fwstate(pmlmepriv, _FW_LINKED)==_FALSE) { - set_fwstate(pmlmepriv, _FW_UNDER_LINKING); - - if(rtw_select_and_join_from_scanned_queue(pmlmepriv)==_SUCCESS) - { - _set_timer(&pmlmepriv->assoc_timer, MAX_JOIN_TIMEOUT ); - } - else - { - WLAN_BSSID_EX *pdev_network = &(adapter->registrypriv.dev_network); + set_fwstate(pmlmepriv, _FW_UNDER_LINKING); + + if(rtw_select_and_join_from_scanned_queue(pmlmepriv)==_SUCCESS) + { + _set_timer(&pmlmepriv->assoc_timer, MAX_JOIN_TIMEOUT ); + } + else + { + WLAN_BSSID_EX *pdev_network = &(adapter->registrypriv.dev_network); u8 *pibss = adapter->registrypriv.dev_network.MacAddress; //pmlmepriv->fw_state ^= _FW_UNDER_SURVEY;//because don't set assoc_timer _clr_fwstate_(pmlmepriv, _FW_UNDER_SURVEY); RT_TRACE(_module_rtl871x_mlme_c_,_drv_err_,("switching to adhoc master\n")); - + _rtw_memset(&pdev_network->Ssid, 0, sizeof(NDIS_802_11_SSID)); _rtw_memcpy(&pdev_network->Ssid, &pmlmepriv->assoc_ssid, sizeof(NDIS_802_11_SSID)); - + rtw_update_registrypriv_dev_network(adapter); rtw_generate_random_ibss(pibss); - pmlmepriv->fw_state = WIFI_ADHOC_MASTER_STATE; - + pmlmepriv->fw_state = WIFI_ADHOC_MASTER_STATE; + if(rtw_createbss_cmd(adapter)!=_SUCCESS) { - RT_TRACE(_module_rtl871x_mlme_c_,_drv_err_,("Error=>rtw_createbss_cmd status FAIL\n")); - } + RT_TRACE(_module_rtl871x_mlme_c_,_drv_err_,("Error=>rtw_createbss_cmd status FAIL\n")); + } - pmlmepriv->to_join = _FALSE; - } - } + pmlmepriv->to_join = _FALSE; + } + } } else { @@ -1230,7 +1230,7 @@ _func_enter_; pmlmepriv->to_join = _FALSE; if(_SUCCESS == (s_ret=rtw_select_and_join_from_scanned_queue(pmlmepriv))) { - _set_timer(&pmlmepriv->assoc_timer, MAX_JOIN_TIMEOUT); + _set_timer(&pmlmepriv->assoc_timer, MAX_JOIN_TIMEOUT); } else if(s_ret == 2)//there is no need to wait for join { @@ -1282,7 +1282,7 @@ _func_enter_; #endif // CONFIG_P2P_PS rtw_os_xmit_schedule(adapter); -#ifdef CONFIG_CONCURRENT_MODE +#ifdef CONFIG_CONCURRENT_MODE rtw_os_xmit_schedule(adapter->pbuddy_adapter); #endif #ifdef CONFIG_DUALMAC_CONCURRENT @@ -1295,9 +1295,9 @@ _func_enter_; #ifdef DBG_CONFIG_ERROR_DETECT { - struct mlme_ext_priv *pmlmeext = &adapter->mlmeextpriv; + struct mlme_ext_priv *pmlmeext = &adapter->mlmeextpriv; if(pmlmeext->sitesurvey_res.bss_cnt == 0){ - //rtw_hal_sreset_reset(adapter); + //rtw_hal_sreset_reset(adapter); } } #endif @@ -1306,7 +1306,7 @@ _func_enter_; rtw_cfg80211_surveydone_event_callback(adapter); #endif //CONFIG_IOCTL_CFG80211 -_func_exit_; +_func_exit_; } @@ -1326,9 +1326,9 @@ static void free_scanqueue(struct mlme_priv *pmlmepriv) _queue *free_queue = &pmlmepriv->free_bss_pool; _queue *scan_queue = &pmlmepriv->scanned_queue; _list *plist, *phead, *ptemp; - -_func_enter_; - + +_func_enter_; + RT_TRACE(_module_rtl871x_mlme_c_, _drv_notice_, ("+free_scanqueue\n")); _enter_critical_bh(&scan_queue->lock, &irqL0); _enter_critical_bh(&free_queue->lock, &irqL); @@ -1344,13 +1344,13 @@ _func_enter_; plist =ptemp; pmlmepriv->num_of_scanned --; } - + _exit_critical_bh(&free_queue->lock, &irqL); _exit_critical_bh(&scan_queue->lock, &irqL0); - + _func_exit_; } - + /* *rtw_free_assoc_resources: the caller has to lock pmlmepriv->lock */ @@ -1358,14 +1358,14 @@ void rtw_free_assoc_resources(struct adapter *adapter, int lock_scanned_queue) { _irqL irqL; struct wlan_network* pwlan = NULL; - struct mlme_priv *pmlmepriv = &adapter->mlmepriv; - struct sta_priv *pstapriv = &adapter->stapriv; + struct mlme_priv *pmlmepriv = &adapter->mlmepriv; + struct sta_priv *pstapriv = &adapter->stapriv; struct wlan_network *tgt_network = &pmlmepriv->cur_network; - + #ifdef CONFIG_TDLS struct tdls_info *ptdlsinfo = &adapter->tdlsinfo; #endif //CONFIG_TDLS -_func_enter_; +_func_enter_; RT_TRACE(_module_rtl871x_mlme_c_, _drv_notice_, ("+rtw_free_assoc_resources\n")); RT_TRACE(_module_rtl871x_mlme_c_, _drv_info_, ("tgt_network->network.MacAddress="MAC_FMT" ssid=%s\n", @@ -1374,7 +1374,7 @@ _func_enter_; if(check_fwstate( pmlmepriv, WIFI_STATION_STATE|WIFI_AP_STATE)) { struct sta_info* psta; - + psta = rtw_get_stainfo(&adapter->stapriv, tgt_network->network.MacAddress); #ifdef CONFIG_TDLS @@ -1393,28 +1393,28 @@ _func_enter_; } _exit_critical_bh(&(pstapriv->sta_hash_lock), &irqL); - + } if(check_fwstate( pmlmepriv, WIFI_ADHOC_STATE|WIFI_ADHOC_MASTER_STATE|WIFI_AP_STATE)) { struct sta_info* psta; - + rtw_free_all_stainfo(adapter); psta = rtw_get_bcmc_stainfo(adapter); - _enter_critical_bh(&(pstapriv->sta_hash_lock), &irqL); + _enter_critical_bh(&(pstapriv->sta_hash_lock), &irqL); rtw_free_stainfo(adapter, psta); - _exit_critical_bh(&(pstapriv->sta_hash_lock), &irqL); + _exit_critical_bh(&(pstapriv->sta_hash_lock), &irqL); - rtw_init_bcmc_stainfo(adapter); + rtw_init_bcmc_stainfo(adapter); } if(lock_scanned_queue) _enter_critical_bh(&(pmlmepriv->scanned_queue.lock), &irqL); - + pwlan = rtw_find_network(&pmlmepriv->scanned_queue, tgt_network->network.MacAddress); - if(pwlan) + if(pwlan) { pwlan->fixed = _FALSE; #ifdef CONFIG_P2P @@ -1443,7 +1443,7 @@ _func_enter_; //rtw_clear_scan_deny(adapter); } #endif //CONFIG_P2P - } + } else { RT_TRACE(_module_rtl871x_mlme_c_,_drv_err_,("rtw_free_assoc_resources : pwlan== NULL \n\n")); @@ -1453,16 +1453,16 @@ _func_enter_; if((check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) && (adapter->stapriv.asoc_sta_count== 1)) /*||check_fwstate(pmlmepriv, WIFI_STATION_STATE)*/) { - rtw_free_network_nolock(pmlmepriv, pwlan); + rtw_free_network_nolock(pmlmepriv, pwlan); } if(lock_scanned_queue) _exit_critical_bh(&(pmlmepriv->scanned_queue.lock), &irqL); - + adapter->securitypriv.key_mask = 0; -_func_exit_; - +_func_exit_; + } /* @@ -1472,14 +1472,14 @@ void rtw_indicate_connect(struct adapter *padapter) { struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct xmit_priv *pxmitpriv = &padapter->xmitpriv; - + _func_enter_; RT_TRACE(_module_rtl871x_mlme_c_, _drv_err_, ("+rtw_indicate_connect\n")); - + pmlmepriv->to_join = _FALSE; - if(!check_fwstate(&padapter->mlmepriv, _FW_LINKED)) + if(!check_fwstate(&padapter->mlmepriv, _FW_LINKED)) { #ifdef CONFIG_SW_ANTENNA_DIVERSITY @@ -1490,7 +1490,7 @@ _func_enter_; rtw_led_control(padapter, LED_CTL_LINK); - + #ifdef CONFIG_DRVEXT_MODULE if(padapter->drvextpriv.enable_wpa) { @@ -1517,7 +1517,7 @@ _func_enter_; rtw_set_scan_deny(padapter, 3000); RT_TRACE(_module_rtl871x_mlme_c_, _drv_err_, ("-rtw_indicate_connect: fw_state=0x%08x\n", get_fwstate(pmlmepriv))); - + _func_exit_; } @@ -1528,15 +1528,15 @@ _func_exit_; */ void rtw_indicate_disconnect( struct adapter *padapter ) { - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; + struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); WLAN_BSSID_EX *cur_network = &(pmlmeinfo->network); struct sta_info *psta; struct sta_priv *pstapriv = &padapter->stapriv; -_func_enter_; - +_func_enter_; + RT_TRACE(_module_rtl871x_mlme_c_, _drv_err_, ("+rtw_indicate_disconnect\n")); _clr_fwstate_(pmlmepriv, _FW_UNDER_LINKING|WIFI_UNDER_WPS); @@ -1559,7 +1559,7 @@ _func_enter_; } #endif - if(check_fwstate(&padapter->mlmepriv, _FW_LINKED) + if(check_fwstate(&padapter->mlmepriv, _FW_LINKED) || (rtw_to_roaming(padapter) <= 0) ) { @@ -1584,7 +1584,7 @@ _func_enter_; rtw_lps_ctrl_wk_cmd(padapter, LPS_CTRL_DISCONNECT, 1); #endif -_func_exit_; +_func_exit_; } inline void rtw_indicate_scan_done( struct adapter *padapter, bool aborted) @@ -1629,7 +1629,7 @@ static struct sta_info *rtw_joinbss_update_stainfo(struct adapter *padapter, str int i; struct sta_info *bmc_sta, *psta=NULL; struct recv_reorder_ctrl *preorder_ctrl; - struct sta_priv *pstapriv = &padapter->stapriv; + struct sta_priv *pstapriv = &padapter->stapriv; psta = rtw_get_stainfo(pstapriv, pnetwork->network.MacAddress); if(psta==NULL) { @@ -1639,9 +1639,9 @@ static struct sta_info *rtw_joinbss_update_stainfo(struct adapter *padapter, str if(psta) //update ptarget_sta { DBG_871X("%s\n", __FUNCTION__); - + psta->aid = pnetwork->join_res; -#ifdef CONFIG_CONCURRENT_MODE +#ifdef CONFIG_CONCURRENT_MODE if(PRIMARY_ADAPTER == padapter->adapter_type) psta->mac_id=0; @@ -1649,31 +1649,31 @@ static struct sta_info *rtw_joinbss_update_stainfo(struct adapter *padapter, str psta->mac_id=2; #else psta->mac_id=0; -#endif +#endif //sta mode rtw_hal_set_odm_var(padapter,HAL_ODM_STA_INFO,psta,_TRUE); //security related if(padapter->securitypriv.dot11AuthAlgrthm== dot11AuthAlgrthm_8021X) - { + { padapter->securitypriv.binstallGrpkey=_FALSE; - padapter->securitypriv.busetkipkey=_FALSE; + padapter->securitypriv.busetkipkey=_FALSE; padapter->securitypriv.bgrpkey_handshake=_FALSE; psta->ieee8021x_blocked=_TRUE; psta->dot118021XPrivacy=padapter->securitypriv.dot11PrivacyAlgrthm; - + _rtw_memset((u8 *)&psta->dot118021x_UncstKey, 0, sizeof (union Keytype)); - + _rtw_memset((u8 *)&psta->dot11tkiprxmickey, 0, sizeof (union Keytype)); _rtw_memset((u8 *)&psta->dot11tkiptxmickey, 0, sizeof (union Keytype)); - + _rtw_memset((u8 *)&psta->dot11txpn, 0, sizeof (union pn48)); #ifdef CONFIG_IEEE80211W _rtw_memset((u8 *)&psta->dot11wtxpn, 0, sizeof (union pn48)); #endif //CONFIG_IEEE80211W - _rtw_memset((u8 *)&psta->dot11rxpn, 0, sizeof (union pn48)); + _rtw_memset((u8 *)&psta->dot11rxpn, 0, sizeof (union pn48)); } // Commented by Albert 2012/07/21 @@ -1703,7 +1703,7 @@ static struct sta_info *rtw_joinbss_update_stainfo(struct adapter *padapter, str preorder_ctrl->wsize_b = 64;//max_ampdu_sz;//ex. 32(kbytes) -> wsize_b=32 } - + bmc_sta = rtw_get_bcmc_stainfo(padapter); if(bmc_sta) { @@ -1722,29 +1722,29 @@ static struct sta_info *rtw_joinbss_update_stainfo(struct adapter *padapter, str } } - + //misc. update_sta_info(padapter, psta); - + } - + return psta; - + } //pnetwork : returns from rtw_joinbss_event_callback //ptarget_wlan: found from scanned_queue static void rtw_joinbss_update_network(struct adapter *padapter, struct wlan_network *ptarget_wlan, struct wlan_network *pnetwork) { - struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); + struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); struct wlan_network *cur_network = &(pmlmepriv->cur_network); DBG_871X("%s\n", __FUNCTION__); - + RT_TRACE(_module_rtl871x_mlme_c_,_drv_info_,("\nfw_state:%x, BSSID:"MAC_FMT"\n" ,get_fwstate(pmlmepriv), MAC_ARG(pnetwork->network.MacAddress))); - + // why not use ptarget_wlan?? _rtw_memcpy(&cur_network->network, &pnetwork->network, pnetwork->network.Length); // some IEs in pnetwork is wrong, so we should use ptarget_wlan IEs @@ -1753,7 +1753,7 @@ static void rtw_joinbss_update_network(struct adapter *padapter, struct wlan_net cur_network->aid = pnetwork->join_res; - + #ifdef CONFIG_NEW_SIGNAL_STAT_PROCESS rtw_set_signal_stat_timer(&padapter->recvpriv); #endif @@ -1773,19 +1773,19 @@ static void rtw_joinbss_update_network(struct adapter *padapter, struct wlan_net #ifdef CONFIG_NEW_SIGNAL_STAT_PROCESS rtw_set_signal_stat_timer(&padapter->recvpriv); #endif - + //update fw_state //will clr _FW_UNDER_LINKING here indirectly switch(pnetwork->network.InfrastructureMode) - { - case Ndis802_11Infrastructure: - + { + case Ndis802_11Infrastructure: + if(pmlmepriv->fw_state&WIFI_UNDER_WPS) pmlmepriv->fw_state = WIFI_STATION_STATE|WIFI_UNDER_WPS; else pmlmepriv->fw_state = WIFI_STATION_STATE; - + break; - case Ndis802_11IBSS: + case Ndis802_11IBSS: pmlmepriv->fw_state = WIFI_ADHOC_STATE; break; default: @@ -1794,10 +1794,10 @@ static void rtw_joinbss_update_network(struct adapter *padapter, struct wlan_net break; } - rtw_update_protection(padapter, (cur_network->network.IEs) + sizeof (NDIS_802_11_FIXED_IEs), + rtw_update_protection(padapter, (cur_network->network.IEs) + sizeof (NDIS_802_11_FIXED_IEs), (cur_network->network.IELength)); - -#ifdef CONFIG_80211N_HT + +#ifdef CONFIG_80211N_HT rtw_update_ht_cap(padapter, cur_network->network.IEs, cur_network->network.IELength); #endif @@ -1807,7 +1807,7 @@ static void rtw_joinbss_update_network(struct adapter *padapter, struct wlan_net //Notes: the fucntion could be > passive_level (the same context as Rx tasklet) //pnetwork : returns from rtw_joinbss_event_callback //ptarget_wlan: found from scanned_queue -//if join_res > 0, for (fw_state==WIFI_STATION_STATE), we check if "ptarget_sta" & "ptarget_wlan" exist. +//if join_res > 0, for (fw_state==WIFI_STATION_STATE), we check if "ptarget_sta" & "ptarget_wlan" exist. //if join_res > 0, for (fw_state==WIFI_ADHOC_STATE), we only check if "ptarget_wlan" exist. //if join_res > 0, update "cur_network->network" from "pnetwork->network" if (ptarget_wlan !=NULL). // @@ -1818,29 +1818,29 @@ void rtw_joinbss_event_prehandle(struct adapter *adapter, u8 *pbuf) static u8 retry=0; u8 timer_cancelled; struct sta_info *ptarget_sta= NULL, *pcur_sta = NULL; - struct sta_priv *pstapriv = &adapter->stapriv; + struct sta_priv *pstapriv = &adapter->stapriv; struct mlme_priv *pmlmepriv = &(adapter->mlmepriv); - struct wlan_network *pnetwork = (struct wlan_network *)pbuf; - struct wlan_network *cur_network = &(pmlmepriv->cur_network); + struct wlan_network *pnetwork = (struct wlan_network *)pbuf; + struct wlan_network *cur_network = &(pmlmepriv->cur_network); struct wlan_network *pcur_wlan = NULL, *ptarget_wlan = NULL; - unsigned int the_same_macaddr = _FALSE; + unsigned int the_same_macaddr = _FALSE; -_func_enter_; +_func_enter_; RT_TRACE(_module_rtl871x_mlme_c_,_drv_info_,("joinbss event call back received with res=%d\n", pnetwork->join_res)); rtw_get_encrypt_decrypt_from_registrypriv(adapter); - + if (pmlmepriv->assoc_ssid.SsidLength == 0) { - RT_TRACE(_module_rtl871x_mlme_c_,_drv_err_,("@@@@@ joinbss event call back for Any SSid\n")); + RT_TRACE(_module_rtl871x_mlme_c_,_drv_err_,("@@@@@ joinbss event call back for Any SSid\n")); } else { RT_TRACE(_module_rtl871x_mlme_c_,_drv_err_,("@@@@@ rtw_joinbss_event_callback for SSid:%s\n", pmlmepriv->assoc_ssid.Ssid)); } - + the_same_macaddr = _rtw_memcmp(pnetwork->network.MacAddress, cur_network->network.MacAddress, ETH_ALEN); pnetwork->network.Length = get_WLAN_BSSID_EX_sz(&pnetwork->network); @@ -1849,9 +1849,9 @@ _func_enter_; RT_TRACE(_module_rtl871x_mlme_c_,_drv_err_,("\n\n ***joinbss_evt_callback return a wrong bss ***\n\n")); goto ignore_joinbss_callback; } - + _enter_critical_bh(&pmlmepriv->lock, &irqL); - + RT_TRACE(_module_rtl871x_mlme_c_,_drv_info_,("\n rtw_joinbss_event_callback !! _enter_critical \n")); if(pnetwork->join_res > 0) @@ -1865,7 +1865,7 @@ _func_enter_; { if(the_same_macaddr == _TRUE) { - ptarget_wlan = rtw_find_network(&pmlmepriv->scanned_queue, cur_network->network.MacAddress); + ptarget_wlan = rtw_find_network(&pmlmepriv->scanned_queue, cur_network->network.MacAddress); } else { @@ -1881,7 +1881,7 @@ _func_enter_; ptarget_wlan = rtw_find_network(&pmlmepriv->scanned_queue, pnetwork->network.MacAddress); if(check_fwstate(pmlmepriv, WIFI_STATION_STATE) == _TRUE){ - if(ptarget_wlan) ptarget_wlan->fixed = _TRUE; + if(ptarget_wlan) ptarget_wlan->fixed = _TRUE; } } @@ -1890,26 +1890,26 @@ _func_enter_; { ptarget_wlan = rtw_find_network(&pmlmepriv->scanned_queue, pnetwork->network.MacAddress); if(check_fwstate(pmlmepriv, WIFI_STATION_STATE) == _TRUE){ - if(ptarget_wlan) ptarget_wlan->fixed = _TRUE; + if(ptarget_wlan) ptarget_wlan->fixed = _TRUE; } } - - //s2. update cur_network + + //s2. update cur_network if(ptarget_wlan) - { + { rtw_joinbss_update_network(adapter, ptarget_wlan, pnetwork); } else - { + { RT_TRACE(_module_rtl871x_mlme_c_,_drv_err_,("Can't find ptarget_wlan when joinbss_event callback\n")); _exit_critical_bh(&(pmlmepriv->scanned_queue.lock), &irqL); goto ignore_joinbss_callback; } - - - //s3. find ptarget_sta & update ptarget_sta after update cur_network only for station mode + + + //s3. find ptarget_sta & update ptarget_sta after update cur_network only for station mode if(check_fwstate(pmlmepriv, WIFI_STATION_STATE) == _TRUE) - { + { ptarget_sta = rtw_joinbss_update_stainfo(adapter, pnetwork); if(ptarget_sta==NULL) { @@ -1919,7 +1919,7 @@ _func_enter_; } } - //s4. indicate connect + //s4. indicate connect if(check_fwstate(pmlmepriv, WIFI_STATION_STATE) == _TRUE) { pmlmepriv->cur_network_scanned = ptarget_wlan; @@ -1931,40 +1931,40 @@ _func_enter_; RT_TRACE(_module_rtl871x_mlme_c_,_drv_info_,("adhoc mode, fw_state:%x", get_fwstate(pmlmepriv))); } - - //s5. Cancle assoc_timer + + //s5. Cancle assoc_timer _cancel_timer(&pmlmepriv->assoc_timer, &timer_cancelled); - - RT_TRACE(_module_rtl871x_mlme_c_,_drv_info_,("Cancle assoc_timer \n")); - + + RT_TRACE(_module_rtl871x_mlme_c_,_drv_info_,("Cancle assoc_timer \n")); + } else { - RT_TRACE(_module_rtl871x_mlme_c_,_drv_err_,("rtw_joinbss_event_callback err: fw_state:%x", get_fwstate(pmlmepriv))); + RT_TRACE(_module_rtl871x_mlme_c_,_drv_err_,("rtw_joinbss_event_callback err: fw_state:%x", get_fwstate(pmlmepriv))); _exit_critical_bh(&(pmlmepriv->scanned_queue.lock), &irqL); goto ignore_joinbss_callback; } - - _exit_critical_bh(&(pmlmepriv->scanned_queue.lock), &irqL); - + + _exit_critical_bh(&(pmlmepriv->scanned_queue.lock), &irqL); + } - else if(pnetwork->join_res == -4) + else if(pnetwork->join_res == -4) { rtw_reset_securitypriv(adapter); - _set_timer(&pmlmepriv->assoc_timer, 1); + _set_timer(&pmlmepriv->assoc_timer, 1); //rtw_free_assoc_resources(adapter, 1); if((check_fwstate(pmlmepriv, _FW_UNDER_LINKING)) == _TRUE) - { + { RT_TRACE(_module_rtl871x_mlme_c_,_drv_err_,("fail! clear _FW_UNDER_LINKING ^^^fw_state=%x\n", get_fwstate(pmlmepriv))); _clr_fwstate_(pmlmepriv, _FW_UNDER_LINKING); - } - + } + } else //if join_res < 0 (join fails), then try again { - + #ifdef REJOIN res = _FAIL; if(retry < 2) { @@ -1982,18 +1982,18 @@ _func_enter_; { _clr_fwstate_(pmlmepriv, _FW_UNDER_LINKING); rtw_indicate_connect(adapter); - } + } else { RT_TRACE(_module_rtl871x_mlme_c_,_drv_err_,("Set Assoc_Timer = 1; can't find match ssid in scanned_q \n")); #endif - + _set_timer(&pmlmepriv->assoc_timer, 1); //rtw_free_assoc_resources(adapter, 1); _clr_fwstate_(pmlmepriv, _FW_UNDER_LINKING); - + #ifdef REJOIN - retry = 0; + retry = 0; } #endif } @@ -2001,12 +2001,12 @@ _func_enter_; ignore_joinbss_callback: _exit_critical_bh(&pmlmepriv->lock, &irqL); - _func_exit_; + _func_exit_; } void rtw_joinbss_event_callback(struct adapter *adapter, u8 *pbuf) { - struct wlan_network *pnetwork = (struct wlan_network *)pbuf; + struct wlan_network *pnetwork = (struct wlan_network *)pbuf; _func_enter_; @@ -2014,9 +2014,9 @@ _func_enter_; rtw_os_xmit_schedule(adapter); -#ifdef CONFIG_CONCURRENT_MODE +#ifdef CONFIG_CONCURRENT_MODE rtw_os_xmit_schedule(adapter->pbuddy_adapter); -#endif +#endif #ifdef CONFIG_DUALMAC_CONCURRENT dc_resume_xmit(adapter); @@ -2028,15 +2028,15 @@ _func_exit_; u8 search_max_mac_id(struct adapter *padapter) { u8 mac_id, aid; -#if (RATE_ADAPTIVE_SUPPORT==1) //for 88E RA +#if (RATE_ADAPTIVE_SUPPORT==1) //for 88E RA struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); struct sta_priv *pstapriv = &padapter->stapriv; -#if defined (CONFIG_AP_MODE) && defined (CONFIG_NATIVEAP_MLME) - if(check_fwstate(pmlmepriv, WIFI_AP_STATE)){ - +#if defined (CONFIG_AP_MODE) && defined (CONFIG_NATIVEAP_MLME) + if(check_fwstate(pmlmepriv, WIFI_AP_STATE)){ + for (aid = (pstapriv->max_num_sta); aid > 0; aid--) { if (pstapriv->sta_aid[aid-1] != NULL) @@ -2047,7 +2047,7 @@ u8 search_max_mac_id(struct adapter *padapter) { if (pstapriv->sta_aid[mac_id] != NULL) break; - } + } */ mac_id = aid + 1; } @@ -2062,10 +2062,10 @@ u8 search_max_mac_id(struct adapter *padapter) } } } -#endif +#endif return mac_id; -} +} //FOR STA, AP ,AD-HOC mode void rtw_sta_media_status_rpt(struct adapter *adapter,struct sta_info *psta, u32 mstatus) @@ -2074,96 +2074,96 @@ void rtw_sta_media_status_rpt(struct adapter *adapter,struct sta_info *psta, u32 if(psta==NULL) return; - #if (RATE_ADAPTIVE_SUPPORT==1) //for 88E RA + #if (RATE_ADAPTIVE_SUPPORT==1) //for 88E RA { - u8 macid = search_max_mac_id(adapter); + u8 macid = search_max_mac_id(adapter); rtw_hal_set_hwreg(adapter,HW_VAR_TX_RPT_MAX_MACID, (u8*)&macid); } #endif - media_status_rpt = (u16)((psta->mac_id<<8)|mstatus); // MACID|OPMODE:1 connect - rtw_hal_set_hwreg(adapter,HW_VAR_H2C_MEDIA_STATUS_RPT,(u8 *)&media_status_rpt); + media_status_rpt = (u16)((psta->mac_id<<8)|mstatus); // MACID|OPMODE:1 connect + rtw_hal_set_hwreg(adapter,HW_VAR_H2C_MEDIA_STATUS_RPT,(u8 *)&media_status_rpt); } void rtw_stassoc_event_callback(struct adapter *adapter, u8 *pbuf) { - _irqL irqL; + _irqL irqL; struct sta_info *psta; struct mlme_priv *pmlmepriv = &(adapter->mlmepriv); struct stassoc_event *pstassoc = (struct stassoc_event*)pbuf; - struct wlan_network *cur_network = &(pmlmepriv->cur_network); + struct wlan_network *cur_network = &(pmlmepriv->cur_network); struct wlan_network *ptarget_wlan = NULL; - -_func_enter_; - + +_func_enter_; + if(rtw_access_ctrl(adapter, pstassoc->macaddr) == _FALSE) return; #if defined (CONFIG_AP_MODE) && defined (CONFIG_NATIVEAP_MLME) if(check_fwstate(pmlmepriv, WIFI_AP_STATE)) { - psta = rtw_get_stainfo(&adapter->stapriv, pstassoc->macaddr); + psta = rtw_get_stainfo(&adapter->stapriv, pstassoc->macaddr); if(psta) { u8 *passoc_req = NULL; u32 assoc_req_len = 0; - + rtw_sta_media_status_rpt(adapter, psta, 1); - + #ifndef CONFIG_AUTO_AP_MODE ap_sta_info_defer_update(adapter, psta); - //report to upper layer + //report to upper layer DBG_871X("indicate_sta_assoc_event to upper layer - hostapd\n"); #ifdef CONFIG_IOCTL_CFG80211 _enter_critical_bh(&psta->lock, &irqL); if(psta->passoc_req && psta->assoc_req_len>0) - { + { passoc_req = rtw_zmalloc(psta->assoc_req_len); if(passoc_req) { assoc_req_len = psta->assoc_req_len; _rtw_memcpy(passoc_req, psta->passoc_req, assoc_req_len); - + rtw_mfree(psta->passoc_req , psta->assoc_req_len); psta->passoc_req = NULL; psta->assoc_req_len = 0; } - } + } _exit_critical_bh(&psta->lock, &irqL); if(passoc_req && assoc_req_len>0) { rtw_cfg80211_indicate_sta_assoc(adapter, passoc_req, assoc_req_len); - + rtw_mfree(passoc_req, assoc_req_len); - } -#else //!CONFIG_IOCTL_CFG80211 + } +#else //!CONFIG_IOCTL_CFG80211 rtw_indicate_sta_assoc_event(adapter, psta); #endif //!CONFIG_IOCTL_CFG80211 #endif //!CONFIG_AUTO_AP_MODE - } + } goto exit; - } + } #endif //defined (CONFIG_AP_MODE) && defined (CONFIG_NATIVEAP_MLME) //for AD-HOC mode - psta = rtw_get_stainfo(&adapter->stapriv, pstassoc->macaddr); + psta = rtw_get_stainfo(&adapter->stapriv, pstassoc->macaddr); if( psta != NULL) { - //the sta have been in sta_info_queue => do nothing - + //the sta have been in sta_info_queue => do nothing + RT_TRACE(_module_rtl871x_mlme_c_,_drv_err_,("Error: rtw_stassoc_event_callback: sta has been in sta_hash_queue \n")); - + goto exit; //(between drv has received this event before and fw have not yet to set key to CAM_ENTRY) } - psta = rtw_alloc_stainfo(&adapter->stapriv, pstassoc->macaddr); + psta = rtw_alloc_stainfo(&adapter->stapriv, pstassoc->macaddr); if (psta == NULL) { RT_TRACE(_module_rtl871x_mlme_c_,_drv_err_,("Can't alloc sta_info when rtw_stassoc_event_callback\n")); goto exit; - } - + } + //to do : init sta_info variable psta->qos_option = 0; psta->mac_id = (uint)pstassoc->cam_id; @@ -2173,16 +2173,16 @@ _func_enter_; rtw_hal_set_odm_var(adapter,HAL_ODM_STA_INFO,psta,_TRUE); rtw_sta_media_status_rpt(adapter, psta, 1); - + if(adapter->securitypriv.dot11AuthAlgrthm==dot11AuthAlgrthm_8021X) psta->dot118021XPrivacy = adapter->securitypriv.dot11PrivacyAlgrthm; - - psta->ieee8021x_blocked = _FALSE; - + + psta->ieee8021x_blocked = _FALSE; + _enter_critical_bh(&pmlmepriv->lock, &irqL); - if ( (check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE)==_TRUE ) || + if ( (check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE)==_TRUE ) || (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE)==_TRUE ) ) { if(adapter->stapriv.asoc_sta_count== 2) @@ -2202,8 +2202,8 @@ _func_enter_; mlmeext_sta_add_event_callback(adapter, psta); exit: - -_func_exit_; + +_func_exit_; } @@ -2216,12 +2216,12 @@ void rtw_stadel_event_callback(struct adapter *adapter, u8 *pbuf) WLAN_BSSID_EX *pdev_network=NULL; u8* pibss = NULL; struct mlme_priv *pmlmepriv = &(adapter->mlmepriv); - struct stadel_event *pstadel = (struct stadel_event*)pbuf; - struct sta_priv *pstapriv = &adapter->stapriv; + struct stadel_event *pstadel = (struct stadel_event*)pbuf; + struct sta_priv *pstapriv = &adapter->stapriv; struct wlan_network *tgt_network = &(pmlmepriv->cur_network); - -_func_enter_; - + +_func_enter_; + psta = rtw_get_stainfo(&adapter->stapriv, pstadel->macaddr); if(psta) mac_id = psta->mac_id; @@ -2235,7 +2235,7 @@ _func_enter_; media_status = (mac_id<<8)|0; // MACID|OPMODE:0 means disconnect //for STA,AP,ADHOC mode, report disconnect stauts to FW rtw_hal_set_hwreg(adapter, HW_VAR_H2C_MEDIA_STATUS_RPT, (u8 *)&media_status); - } + } if(check_fwstate(pmlmepriv, WIFI_AP_STATE)) { @@ -2258,8 +2258,8 @@ _func_enter_; if(check_fwstate(pmlmepriv, WIFI_STATION_STATE) ) { #ifdef CONFIG_LAYER2_ROAMING - if(adapter->registrypriv.wifi_spec==1) - rtw_set_roaming(adapter, 0); /* don't roam */ + if(adapter->registrypriv.wifi_spec==1) + rtw_set_roaming(adapter, 0); /* don't roam */ else if (rtw_to_roaming(adapter) > 0) pmlmepriv->to_roaming--; /* this stadel_event is caused by roaming, decrease to_roaming */ else if (rtw_to_roaming(adapter) == 0) @@ -2277,8 +2277,8 @@ _func_enter_; rtw_indicate_disconnect(adapter); _enter_critical_bh(&(pmlmepriv->scanned_queue.lock), &irqL); // remove the network entry in scanned_queue - pwlan = rtw_find_network(&pmlmepriv->scanned_queue, tgt_network->network.MacAddress); - if (pwlan) { + pwlan = rtw_find_network(&pmlmepriv->scanned_queue, tgt_network->network.MacAddress); + if (pwlan) { pwlan->fixed = _FALSE; rtw_free_network_nolock(pmlmepriv, pwlan); } @@ -2294,40 +2294,40 @@ _func_enter_; } - if ( check_fwstate(pmlmepriv,WIFI_ADHOC_MASTER_STATE) || + if ( check_fwstate(pmlmepriv,WIFI_ADHOC_MASTER_STATE) || check_fwstate(pmlmepriv,WIFI_ADHOC_STATE)) { - + _enter_critical_bh(&(pstapriv->sta_hash_lock), &irqL); rtw_free_stainfo(adapter, psta); _exit_critical_bh(&(pstapriv->sta_hash_lock), &irqL); - + if(adapter->stapriv.asoc_sta_count== 1) //a sta + bc/mc_stainfo (not Ibss_stainfo) - { + { //rtw_indicate_disconnect(adapter);//removed@20091105 _enter_critical_bh(&(pmlmepriv->scanned_queue.lock), &irqL); //free old ibss network //pwlan = rtw_find_network(&pmlmepriv->scanned_queue, pstadel->macaddr); pwlan = rtw_find_network(&pmlmepriv->scanned_queue, tgt_network->network.MacAddress); - if(pwlan) + if(pwlan) { pwlan->fixed = _FALSE; - rtw_free_network_nolock(pmlmepriv, pwlan); + rtw_free_network_nolock(pmlmepriv, pwlan); } _exit_critical_bh(&(pmlmepriv->scanned_queue.lock), &irqL); //re-create ibss - pdev_network = &(adapter->registrypriv.dev_network); + pdev_network = &(adapter->registrypriv.dev_network); pibss = adapter->registrypriv.dev_network.MacAddress; _rtw_memcpy(pdev_network, &tgt_network->network, get_WLAN_BSSID_EX_sz(&tgt_network->network)); - + _rtw_memset(&pdev_network->Ssid, 0, sizeof(NDIS_802_11_SSID)); _rtw_memcpy(&pdev_network->Ssid, &pmlmepriv->assoc_ssid, sizeof(NDIS_802_11_SSID)); - - rtw_update_registrypriv_dev_network(adapter); + + rtw_update_registrypriv_dev_network(adapter); rtw_generate_random_ibss(pibss); - + if(check_fwstate(pmlmepriv,WIFI_ADHOC_STATE)) { set_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE); @@ -2337,18 +2337,18 @@ _func_enter_; if(rtw_createbss_cmd(adapter)!=_SUCCESS) { - RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_err_,("***Error=>stadel_event_callback: rtw_createbss_cmd status FAIL*** \n ")); + RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_err_,("***Error=>stadel_event_callback: rtw_createbss_cmd status FAIL*** \n ")); } - + } - + } - + _exit_critical_bh(&pmlmepriv->lock, &irqL2); - -_func_exit_; + +_func_exit_; } @@ -2389,15 +2389,15 @@ void _rtw_join_timeout_handler (struct adapter *adapter) _rtw_up_sema(&pmlmepriv->assoc_terminate); return; } -#endif +#endif -_func_enter_; +_func_enter_; DBG_871X("%s, fw_state=%x\n", __FUNCTION__, get_fwstate(pmlmepriv)); - + if(adapter->bDriverStopped ||adapter->bSurpriseRemoved) return; - + _enter_critical_bh(&pmlmepriv->lock, &irqL); #ifdef CONFIG_LAYER2_ROAMING @@ -2425,8 +2425,8 @@ _func_enter_; break; } } - - } else + + } else #endif { rtw_indicate_disconnect(adapter); @@ -2437,15 +2437,15 @@ _func_enter_; rtw_cfg80211_indicate_disconnect(adapter); #endif //CONFIG_IOCTL_CFG80211 - } + } _exit_critical_bh(&pmlmepriv->lock, &irqL); - -#ifdef CONFIG_DRVEXT_MODULE_WSC - drvext_assoc_fail_indicate(&adapter->drvextpriv); -#endif - + +#ifdef CONFIG_DRVEXT_MODULE_WSC + drvext_assoc_fail_indicate(&adapter->drvextpriv); +#endif + _func_exit_; } @@ -2455,14 +2455,14 @@ _func_exit_; * @adapter: pointer to struct adapter structure */ void rtw_scan_timeout_handler (struct adapter *adapter) -{ +{ _irqL irqL; struct mlme_priv *pmlmepriv = &adapter->mlmepriv; - + DBG_871X(FUNC_ADPT_FMT" fw_state=%x\n", FUNC_ADPT_ARG(adapter), get_fwstate(pmlmepriv)); _enter_critical_bh(&pmlmepriv->lock, &irqL); - + _clr_fwstate_(pmlmepriv, _FW_UNDER_SURVEY); _exit_critical_bh(&pmlmepriv->lock, &irqL); @@ -2482,13 +2482,13 @@ static void rtw_auto_scan_handler(struct adapter *padapter) pmlmepriv->scan_interval--; if(pmlmepriv->scan_interval==0) { -/* - if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY|_FW_UNDER_LINKING) == _TRUE) +/* + if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY|_FW_UNDER_LINKING) == _TRUE) { DBG_871X("exit %s when _FW_UNDER_SURVEY|_FW_UNDER_LINKING -> \n", __FUNCTION__); return; } - + if(pmlmepriv->sitesurveyctrl.traffic_busy == _TRUE) { DBG_871X("%s exit cause traffic_busy(%x)\n",__FUNCTION__, pmlmepriv->sitesurveyctrl.traffic_busy); @@ -2501,7 +2501,7 @@ static void rtw_auto_scan_handler(struct adapter *padapter) { if ((check_buddy_fwstate(padapter, _FW_UNDER_SURVEY|_FW_UNDER_LINKING) == _TRUE) || (padapter->pbuddy_adapter->mlmepriv.LinkDetectInfo.bBusyTraffic == _TRUE)) - { + { DBG_871X("%s, but buddy_intf is under scanning or linking or BusyTraffic\n", __FUNCTION__); return; } @@ -2510,12 +2510,12 @@ static void rtw_auto_scan_handler(struct adapter *padapter) DBG_871X("%s\n", __FUNCTION__); - rtw_set_802_11_bssid_list_scan(padapter, NULL, 0); - + rtw_set_802_11_bssid_list_scan(padapter, NULL, 0); + pmlmepriv->scan_interval = SCAN_INTERVAL;// 30*2 sec = 60sec - + } - + } } @@ -2526,13 +2526,13 @@ void rtw_dynamic_check_timer_handlder(struct adapter *adapter) struct mlme_priv *pmlmepriv = &adapter->mlmepriv; #endif //CONFIG_AP_MODE struct registry_priv *pregistrypriv = &adapter->registrypriv; -#ifdef CONFIG_CONCURRENT_MODE - struct adapter *pbuddy_adapter = adapter->pbuddy_adapter; +#ifdef CONFIG_CONCURRENT_MODE + struct adapter *pbuddy_adapter = adapter->pbuddy_adapter; #endif if(!adapter) - return; -#if defined(CONFIG_CHECK_BT_HANG) && defined(CONFIG_BT_COEXIST) + return; +#if defined(CONFIG_CHECK_BT_HANG) && defined(CONFIG_BT_COEXIST) if(adapter->HalFunc.hal_checke_bt_hang) { #ifdef CONFIG_CONCURRENT_MODE @@ -2547,34 +2547,34 @@ void rtw_dynamic_check_timer_handlder(struct adapter *adapter) if ((adapter->bDriverStopped == _TRUE)||(adapter->bSurpriseRemoved== _TRUE)) return; - + #ifdef CONFIG_CONCURRENT_MODE if(pbuddy_adapter) { if(adapter->net_closed == _TRUE && pbuddy_adapter->net_closed == _TRUE) { return; - } + } } else #endif //CONFIG_CONCURRENT_MODE if(adapter->net_closed == _TRUE) { return; - } + } rtw_dynamic_chk_wk_cmd(adapter); if(pregistrypriv->wifi_spec==1) - { + { #ifdef CONFIG_P2P struct wifidirect_info *pwdinfo = &adapter->wdinfo; if(rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) -#endif +#endif { //auto site survey rtw_auto_scan_handler(adapter); - } + } } #ifndef CONFIG_ACTIVE_KEEP_ALIVE_CHECK @@ -2582,7 +2582,7 @@ void rtw_dynamic_check_timer_handlder(struct adapter *adapter) if(check_fwstate(pmlmepriv, WIFI_AP_STATE) == _TRUE) { expire_timeout_chk(adapter); - } + } #endif #endif //!CONFIG_ACTIVE_KEEP_ALIVE_CHECK @@ -2592,8 +2592,8 @@ void rtw_dynamic_check_timer_handlder(struct adapter *adapter) rcu_read_lock(); #endif // (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 35)) -#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 35)) - if( adapter->pnetdev->br_port +#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 35)) + if( adapter->pnetdev->br_port #else // (LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 35)) if( rcu_dereference(adapter->pnetdev->rx_handler_data) #endif // (LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 35)) @@ -2606,7 +2606,7 @@ void rtw_dynamic_check_timer_handlder(struct adapter *adapter) if (adapter->pppoe_connection_in_progress > 0) { adapter->pppoe_connection_in_progress--; } - + // due to rtw_dynamic_check_timer_handlder() is called every 2 seconds if (adapter->pppoe_connection_in_progress > 0) { adapter->pppoe_connection_in_progress--; @@ -2618,7 +2618,7 @@ void rtw_dynamic_check_timer_handlder(struct adapter *adapter) #endif // (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 35)) #endif // CONFIG_BR_EXT - + } @@ -2653,24 +2653,24 @@ void rtw_set_scan_deny(struct adapter *adapter, u32 ms) DBG_871X(FUNC_ADPT_FMT"\n", FUNC_ADPT_ARG(adapter)); ATOMIC_SET(&mlmepriv->set_scan_deny, 1); _set_timer(&mlmepriv->set_scan_deny_timer, ms); - + #ifdef CONFIG_CONCURRENT_MODE if (!adapter->pbuddy_adapter) return; if (0) DBG_871X(FUNC_ADPT_FMT"\n", FUNC_ADPT_ARG(adapter->pbuddy_adapter)); - b_mlmepriv = &adapter->pbuddy_adapter->mlmepriv; + b_mlmepriv = &adapter->pbuddy_adapter->mlmepriv; ATOMIC_SET(&b_mlmepriv->set_scan_deny, 1); - _set_timer(&b_mlmepriv->set_scan_deny_timer, ms); + _set_timer(&b_mlmepriv->set_scan_deny_timer, ms); #endif - + } #endif #ifdef CONFIG_DETECT_C2H_BY_POLLING void rtw_event_polling_timer_hdl(struct adapter *adapter) -{ +{ rtw_event_polling_cmd(adapter); } #endif @@ -2718,7 +2718,7 @@ static int rtw_check_join_candidate(struct mlme_priv *pmlmepriv goto exit; } #endif - + if(*candidate == NULL ||(*candidate)->network.Rssinetwork.Rssi ) { *candidate = competitor; @@ -2762,16 +2762,16 @@ int rtw_select_and_join_from_scanned_queue(struct mlme_priv *pmlmepriv ) _irqL irqL; int ret; _list *phead; - struct adapter *adapter; + struct adapter *adapter; _queue *queue = &(pmlmepriv->scanned_queue); struct wlan_network *pnetwork = NULL; struct wlan_network *candidate = NULL; - u8 bSupportAntDiv = _FALSE; + u8 bSupportAntDiv = _FALSE; _func_enter_; _enter_critical_bh(&(pmlmepriv->scanned_queue.lock), &irqL); - phead = get_list_head(queue); + phead = get_list_head(queue); adapter = (struct adapter *)pmlmepriv->nic_hdl; pmlmepriv->pscanned = get_next( phead ); @@ -2784,7 +2784,7 @@ _func_enter_; ret = _FAIL; goto exit; } - + pmlmepriv->pscanned = get_next(pmlmepriv->pscanned); #if 0 @@ -2792,8 +2792,8 @@ _func_enter_; #endif rtw_check_join_candidate(pmlmepriv, &candidate, pnetwork); - - } + + } if(candidate == NULL) { DBG_871X("%s: return _FAIL(candidate == NULL)\n", __FUNCTION__); @@ -2807,9 +2807,9 @@ _func_enter_; candidate->network.Ssid.Ssid, MAC_ARG(candidate->network.MacAddress), candidate->network.Configuration.DSConfig); } - - // check for situation of _FW_LINKED + + // check for situation of _FW_LINKED if (check_fwstate(pmlmepriv, _FW_LINKED) == _TRUE) { DBG_871X("%s: _FW_LINKED while ask_for_joinbss!!!\n", __FUNCTION__); @@ -2820,7 +2820,7 @@ _func_enter_; DBG_871X("%s: _FW_LINKED and is same network, it needn't join again\n", __FUNCTION__); rtw_indicate_connect(adapter);//rtw_indicate_connect again - + ret = 2; goto exit; } @@ -2832,13 +2832,13 @@ _func_enter_; rtw_free_assoc_resources(adapter, 0); } } - + #ifdef CONFIG_ANTENNA_DIVERSITY rtw_hal_get_def_var(adapter, HAL_DEF_IS_SUPPORT_ANT_DIV, &(bSupportAntDiv)); - if(_TRUE == bSupportAntDiv) + if(_TRUE == bSupportAntDiv) { u8 CurrentAntenna; - rtw_hal_get_def_var(adapter, HAL_DEF_CURRENT_ANTENNA, &(CurrentAntenna)); + rtw_hal_get_def_var(adapter, HAL_DEF_CURRENT_ANTENNA, &(CurrentAntenna)); DBG_871X("#### Opt_Ant_(%s) , cur_Ant(%s)\n", (2==candidate->network.PhyInfo.Optimum_antenna)?"A":"B", (2==CurrentAntenna)?"A":"B" @@ -2847,7 +2847,7 @@ _func_enter_; #endif set_fwstate(pmlmepriv, _FW_UNDER_LINKING); ret = rtw_joinbss_cmd(adapter, candidate); - + exit: _exit_critical_bh(&(pmlmepriv->scanned_queue.lock), &irqL); @@ -2859,18 +2859,18 @@ _func_exit_; sint rtw_set_auth(struct adapter * adapter,struct security_priv *psecuritypriv) { struct cmd_obj* pcmd; - struct setauth_parm *psetauthparm; + struct setauth_parm *psetauthparm; struct cmd_priv *pcmdpriv=&(adapter->cmdpriv); sint res=_SUCCESS; - -_func_enter_; + +_func_enter_; pcmd = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj)); if(pcmd==NULL){ res= _FAIL; //try again goto exit; } - + psetauthparm=(struct setauth_parm*)rtw_zmalloc(sizeof(struct setauth_parm)); if(psetauthparm==NULL){ rtw_mfree((unsigned char *)pcmd, sizeof(struct cmd_obj)); @@ -2880,10 +2880,10 @@ _func_enter_; _rtw_memset(psetauthparm, 0, sizeof(struct setauth_parm)); psetauthparm->mode=(unsigned char)psecuritypriv->dot11AuthAlgrthm; - + pcmd->cmdcode = _SetAuth_CMD_; - pcmd->parmbuf = (unsigned char *)psetauthparm; - pcmd->cmdsz = (sizeof(struct setauth_parm)); + pcmd->parmbuf = (unsigned char *)psetauthparm; + pcmd->cmdsz = (sizeof(struct setauth_parm)); pcmd->rsp = NULL; pcmd->rspsz = 0; @@ -2911,20 +2911,20 @@ sint rtw_set_key(struct adapter * adapter,struct security_priv *psecuritypriv,si struct cmd_priv *pcmdpriv = &(adapter->cmdpriv); struct mlme_priv *pmlmepriv = &(adapter->mlmepriv); sint res=_SUCCESS; - + _func_enter_; psetkeyparm=(struct setkey_parm*)rtw_zmalloc(sizeof(struct setkey_parm)); - if(psetkeyparm==NULL){ + if(psetkeyparm==NULL){ res= _FAIL; goto exit; } _rtw_memset(psetkeyparm, 0, sizeof(struct setkey_parm)); - if(psecuritypriv->dot11AuthAlgrthm ==dot11AuthAlgrthm_8021X){ - psetkeyparm->algorithm=(unsigned char)psecuritypriv->dot118021XGrpPrivacy; + if(psecuritypriv->dot11AuthAlgrthm ==dot11AuthAlgrthm_8021X){ + psetkeyparm->algorithm=(unsigned char)psecuritypriv->dot118021XGrpPrivacy; RT_TRACE(_module_rtl871x_mlme_c_,_drv_err_,("\n rtw_set_key: psetkeyparm->algorithm=(unsigned char)psecuritypriv->dot118021XGrpPrivacy=%d \n", psetkeyparm->algorithm)); - } + } else{ psetkeyparm->algorithm=(u8)psecuritypriv->dot11PrivacyAlgrthm; RT_TRACE(_module_rtl871x_mlme_c_,_drv_err_,("\n rtw_set_key: psetkeyparm->algorithm=(u8)psecuritypriv->dot11PrivacyAlgrthm=%d \n", psetkeyparm->algorithm)); @@ -2939,7 +2939,7 @@ _func_enter_; RT_TRACE(_module_rtl871x_mlme_c_,_drv_err_,("\n rtw_set_key: psetkeyparm->algorithm=%d psetkeyparm->keyid=(u8)keyid=%d \n",psetkeyparm->algorithm, keyid)); switch(psetkeyparm->algorithm){ - + case _WEP40_: keylen=5; _rtw_memcpy(&(psetkeyparm->key[0]), &(psecuritypriv->dot11DefKey[keyid].skey[0]), keylen); @@ -2954,7 +2954,7 @@ _func_enter_; psetkeyparm->grpkey=1; break; case _AES_: - keylen=16; + keylen=16; _rtw_memcpy(&psetkeyparm->key, &psecuritypriv->dot118021XGrpKey[keyid], keylen); psetkeyparm->grpkey=1; break; @@ -2964,8 +2964,8 @@ _func_enter_; rtw_mfree((unsigned char *)psetkeyparm, sizeof(struct setkey_parm)); goto exit; } - - + + if(enqueue){ pcmd = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj)); if(pcmd==NULL){ @@ -2973,10 +2973,10 @@ _func_enter_; res= _FAIL; //try again goto exit; } - + pcmd->cmdcode = _SetKey_CMD_; - pcmd->parmbuf = (u8 *)psetkeyparm; - pcmd->cmdsz = (sizeof(struct setkey_parm)); + pcmd->parmbuf = (u8 *)psetkeyparm; + pcmd->cmdsz = (sizeof(struct setkey_parm)); pcmd->rsp = NULL; pcmd->rspsz = 0; @@ -3006,8 +3006,8 @@ int rtw_restruct_wmm_ie(struct adapter *adapter, u8 *in_ie, u8 *out_ie, uint in_ i = 12; //after the fixed IE while(i=0 :if there is pre-auth key, and return the entry id // // @@ -3059,30 +3059,30 @@ static int SecIsInPMKIDList(struct adapter *Adapter, u8 *bssid) do { - if( ( psecuritypriv->PMKIDList[i].bUsed ) && + if( ( psecuritypriv->PMKIDList[i].bUsed ) && ( _rtw_memcmp( psecuritypriv->PMKIDList[i].Bssid, bssid, ETH_ALEN ) == _TRUE ) ) { break; } else - { + { i++; //continue; } - + }while(isecuritypriv; - if(ie[13]<=20){ - // The RSN IE didn't include the PMK ID, append the PMK information + if(ie[13]<=20){ + // The RSN IE didn't include the PMK ID, append the PMK information ie[ie_len]=1; ie_len++; ie[ie_len]=0; //PMKID count = 0x0100 ie_len++; _rtw_memcpy( &ie[ie_len], &psecuritypriv->PMKIDList[iEntry].PMKID, 16); - + ie_len+=16; ie[13]+=18;//PMKID length = 2+16 } return (ie_len); - + } sint rtw_restruct_sec_ie(struct adapter *adapter,u8 *in_ie, u8 *out_ie, uint in_len) { u8 authmode, securitytype, match; u8 sec_ie[255], uncst_oui[4], bkup_ie[255]; u8 wpa_oui[4]={0x0, 0x50, 0xf2, 0x01}; - uint ielength, cnt, remove_cnt; + uint ielength, cnt, remove_cnt; int iEntry; struct mlme_priv *pmlmepriv = &adapter->mlmepriv; struct security_priv *psecuritypriv=&adapter->securitypriv; - uint ndisauthmode=psecuritypriv->ndisauthtype; + uint ndisauthmode=psecuritypriv->ndisauthtype; uint ndissecuritytype = psecuritypriv->ndisencryptstatus; - + _func_enter_; RT_TRACE(_module_rtl871x_mlme_c_, _drv_notice_, ("+rtw_restruct_sec_ie: ndisauthmode=%d ndissecuritytype=%d\n", ndisauthmode, ndissecuritytype)); - + //copy fixed ie only _rtw_memcpy(out_ie, in_ie,12); ielength=12; @@ -3142,12 +3142,12 @@ _func_enter_; if(check_fwstate(pmlmepriv, WIFI_UNDER_WPS)) { _rtw_memcpy(out_ie+ielength, psecuritypriv->wps_ie, psecuritypriv->wps_ie_len); - + ielength += psecuritypriv->wps_ie_len; } else if((authmode==_WPA_IE_ID_)||(authmode==_WPA2_IE_ID_)) - { - //copy RSN or SSN + { + //copy RSN or SSN _rtw_memcpy(&out_ie[ielength], &psecuritypriv->supplicant_ie[0], psecuritypriv->supplicant_ie[1]+2); /* debug for CONFIG_IEEE80211W { @@ -3159,9 +3159,9 @@ _func_enter_; }*/ ielength+=psecuritypriv->supplicant_ie[1]+2; rtw_report_sec_ie(adapter, authmode, psecuritypriv->supplicant_ie); - + #ifdef CONFIG_DRVEXT_MODULE - drvext_report_sec_ie(&adapter->drvextpriv, authmode, sec_ie); + drvext_report_sec_ie(&adapter->drvextpriv, authmode, sec_ie); #endif } @@ -3179,8 +3179,8 @@ _func_enter_; } _func_exit_; - - return ielength; + + return ielength; } void rtw_init_registrypriv_dev_network( struct adapter* adapter) @@ -3189,29 +3189,29 @@ void rtw_init_registrypriv_dev_network( struct adapter* adapter) struct eeprom_priv* peepriv = &adapter->eeprompriv; WLAN_BSSID_EX *pdev_network = &pregistrypriv->dev_network; u8 *myhwaddr = myid(peepriv); - + _func_enter_; _rtw_memcpy(pdev_network->MacAddress, myhwaddr, ETH_ALEN); _rtw_memcpy(&pdev_network->Ssid, &pregistrypriv->ssid, sizeof(NDIS_802_11_SSID)); - + pdev_network->Configuration.Length=sizeof(NDIS_802_11_CONFIGURATION); - pdev_network->Configuration.BeaconPeriod = 100; + pdev_network->Configuration.BeaconPeriod = 100; pdev_network->Configuration.FHConfig.Length = 0; pdev_network->Configuration.FHConfig.HopPattern = 0; pdev_network->Configuration.FHConfig.HopSet = 0; pdev_network->Configuration.FHConfig.DwellTime = 0; - - -_func_exit_; - + + +_func_exit_; + } -void rtw_update_registrypriv_dev_network(struct adapter* adapter) +void rtw_update_registrypriv_dev_network(struct adapter* adapter) { int sz=0; - struct registry_priv* pregistrypriv = &adapter->registrypriv; + struct registry_priv* pregistrypriv = &adapter->registrypriv; WLAN_BSSID_EX *pdev_network = &pregistrypriv->dev_network; struct security_priv* psecuritypriv = &adapter->securitypriv; struct wlan_network *cur_network = &adapter->mlmepriv.cur_network; @@ -3225,9 +3225,9 @@ _func_enter_; pxmitpriv->vcs_type = pregistrypriv->vcs_type; //pxmitpriv->rts_thresh = pregistrypriv->rts_thresh; pxmitpriv->frag_len = pregistrypriv->frag_thresh; - + adapter->qospriv.qos_option = pregistrypriv->wmm_enable; -#endif +#endif pdev_network->Privacy = (psecuritypriv->dot11PrivacyAlgrthm > 0 ? 1 : 0) ; // adhoc no 802.1x @@ -3237,7 +3237,7 @@ _func_enter_; { case WIRELESS_11B: pdev_network->NetworkTypeInUse = (Ndis802_11DS); - break; + break; case WIRELESS_11G: case WIRELESS_11BG: case WIRELESS_11_24N: @@ -3259,9 +3259,9 @@ _func_enter_; // TODO break; } - + pdev_network->Configuration.DSConfig = (pregistrypriv->channel); - RT_TRACE(_module_rtl871x_mlme_c_,_drv_info_,("pregistrypriv->channel=%d, pdev_network->Configuration.DSConfig=0x%x\n", pregistrypriv->channel, pdev_network->Configuration.DSConfig)); + RT_TRACE(_module_rtl871x_mlme_c_,_drv_info_,("pregistrypriv->channel=%d, pdev_network->Configuration.DSConfig=0x%x\n", pregistrypriv->channel, pdev_network->Configuration.DSConfig)); if(cur_network->network.InfrastructureMode == Ndis802_11IBSS) pdev_network->Configuration.ATIMWindow = (0); @@ -3280,8 +3280,8 @@ _func_enter_; //notes: translate IELength & Length after assign the Length to cmdsz in createbss_cmd(); //pdev_network->IELength = cpu_to_le32(sz); - -_func_exit_; + +_func_exit_; } @@ -3290,22 +3290,22 @@ void rtw_get_encrypt_decrypt_from_registrypriv(struct adapter* adapter) _func_enter_; -_func_exit_; - +_func_exit_; + } -//the fucntion is at passive_level +//the fucntion is at passive_level void rtw_joinbss_reset(struct adapter *padapter) { u8 threshold; struct mlme_priv *pmlmepriv = &padapter->mlmepriv; -#ifdef CONFIG_80211N_HT +#ifdef CONFIG_80211N_HT struct ht_priv *phtpriv = &pmlmepriv->htpriv; #endif //todo: if you want to do something io/reg/hw setting before join_bss, please add code here - + @@ -3322,7 +3322,7 @@ void rtw_joinbss_reset(struct adapter *padapter) // TH=0 => means that validate usb rx aggregation, use init value. if(phtpriv->ht_option) { - if(padapter->registrypriv.wifi_spec==1) + if(padapter->registrypriv.wifi_spec==1) threshold = 1; else threshold = 0; @@ -3335,14 +3335,14 @@ void rtw_joinbss_reset(struct adapter *padapter) } #endif -#endif +#endif } #ifdef CONFIG_80211N_HT -//the fucntion is >= passive_level +//the fucntion is >= passive_level unsigned int rtw_restructure_ht_ie(struct adapter *padapter, u8 *in_ie, u8 *out_ie, uint in_len, uint *pout_len) { u32 ielen, out_len; @@ -3351,7 +3351,7 @@ unsigned int rtw_restructure_ht_ie(struct adapter *padapter, u8 *in_ie, u8 *out_ struct rtw_ieee80211_ht_cap ht_capie; unsigned char WMM_IE[] = {0x00, 0x50, 0xf2, 0x02, 0x00, 0x01, 0x00}; struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - struct qos_priv *pqospriv= &pmlmepriv->qospriv; + struct qos_priv *pqospriv= &pmlmepriv->qospriv; struct ht_priv *phtpriv = &pmlmepriv->htpriv; @@ -3364,7 +3364,7 @@ unsigned int rtw_restructure_ht_ie(struct adapter *padapter, u8 *in_ie, u8 *out_ if(pqospriv->qos_option == 0) { out_len = *pout_len; - pframe = rtw_set_ie(out_ie+out_len, _VENDOR_SPECIFIC_IE_, + pframe = rtw_set_ie(out_ie+out_len, _VENDOR_SPECIFIC_IE_, _WMM_IE_Length_, WMM_IE, pout_len); pqospriv->qos_option = 1; @@ -3387,14 +3387,14 @@ unsigned int rtw_restructure_ht_ie(struct adapter *padapter, u8 *in_ie, u8 *out_ rtw_hal_get_def_var(padapter, HW_VAR_MAX_RX_AMPDU_FACTOR, &max_rx_ampdu_factor); ht_capie.ampdu_params_info = (max_rx_ampdu_factor&0x03); - + if(padapter->securitypriv.dot11PrivacyAlgrthm == _AES_ ) ht_capie.ampdu_params_info |= (IEEE80211_HT_CAP_AMPDU_DENSITY&(0x07<<2)); else - ht_capie.ampdu_params_info |= (IEEE80211_HT_CAP_AMPDU_DENSITY&0x00); + ht_capie.ampdu_params_info |= (IEEE80211_HT_CAP_AMPDU_DENSITY&0x00); - - pframe = rtw_set_ie(out_ie+out_len, _HT_CAPABILITY_IE_, + + pframe = rtw_set_ie(out_ie+out_len, _HT_CAPABILITY_IE_, sizeof(struct rtw_ieee80211_ht_cap), (unsigned char*)&ht_capie, pout_len); phtpriv->ht_option = _TRUE; @@ -3407,17 +3407,17 @@ unsigned int rtw_restructure_ht_ie(struct adapter *padapter, u8 *in_ie, u8 *out_ } } - + return (phtpriv->ht_option); - + } //the fucntion is > passive_level (in critical_section) void rtw_update_ht_cap(struct adapter *padapter, u8 *pie, uint ie_len) -{ +{ u8 *p, max_ampdu_sz; - int len; - //struct sta_info *bmc_sta, *psta; + int len; + //struct sta_info *bmc_sta, *psta; struct rtw_ieee80211_ht_cap *pht_capie; struct ieee80211_ht_addt_info *pht_addtinfo; //struct recv_reorder_ctrl *preorder_ctrl; @@ -3427,8 +3427,8 @@ void rtw_update_ht_cap(struct adapter *padapter, u8 *pie, uint ie_len) struct registry_priv *pregistrypriv = &padapter->registrypriv; //struct wlan_network *pcur_network = &(pmlmepriv->cur_network);; struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; - struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); - + struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); + if(!phtpriv->ht_option) return; @@ -3455,25 +3455,25 @@ void rtw_update_ht_cap(struct adapter *padapter, u8 *pie, uint ie_len) phtpriv->ampdu_enable = _TRUE; } - - //check Max Rx A-MPDU Size + + //check Max Rx A-MPDU Size len = 0; p = rtw_get_ie(pie+sizeof (NDIS_802_11_FIXED_IEs), _HT_CAPABILITY_IE_, &len, ie_len-sizeof (NDIS_802_11_FIXED_IEs)); - if(p && len>0) + if(p && len>0) { pht_capie = (struct rtw_ieee80211_ht_cap *)(p+2); max_ampdu_sz = (pht_capie->ampdu_params_info & IEEE80211_HT_CAP_AMPDU_FACTOR); max_ampdu_sz = 1 << (max_ampdu_sz+3); // max_ampdu_sz (kbytes); - + //DBG_871X("rtw_update_ht_cap(): max_ampdu_sz=%d\n", max_ampdu_sz); phtpriv->rx_ampdu_maxlen = max_ampdu_sz; - + } len=0; p = rtw_get_ie(pie+sizeof (NDIS_802_11_FIXED_IEs), _HT_ADD_INFO_IE_, &len, ie_len-sizeof (NDIS_802_11_FIXED_IEs)); - if(p && len>0) + if(p && len>0) { pht_addtinfo = (struct ieee80211_ht_addt_info *)(p+2); //todo: @@ -3482,7 +3482,7 @@ void rtw_update_ht_cap(struct adapter *padapter, u8 *pie, uint ie_len) //update cur_bwmode & cur_ch_offset if ((pregistrypriv->cbw40_enable) && - (pmlmeinfo->HT_caps.u.HT_cap_element.HT_caps_info & BIT(1)) && + (pmlmeinfo->HT_caps.u.HT_cap_element.HT_caps_info & BIT(1)) && (pmlmeinfo->HT_info.infos[0] & BIT(2))) { int i; @@ -3523,15 +3523,15 @@ void rtw_update_ht_cap(struct adapter *padapter, u8 *pie, uint ie_len) case HT_EXTCHNL_OFFSET_UPPER: pmlmeext->cur_ch_offset = HAL_PRIME_CHNL_OFFSET_LOWER; break; - + case HT_EXTCHNL_OFFSET_LOWER: pmlmeext->cur_ch_offset = HAL_PRIME_CHNL_OFFSET_UPPER; break; - + default: pmlmeext->cur_ch_offset = HAL_PRIME_CHNL_OFFSET_DONT_CARE; break; - } + } } // @@ -3554,8 +3554,8 @@ void rtw_update_ht_cap(struct adapter *padapter, u8 *pie, uint ie_len) // pmlmeinfo->HT_protection = pmlmeinfo->HT_info.infos[1] & 0x3; - - + + #if 0 //move to rtw_update_sta_info_client() //for A-MPDU Rx reordering buffer control for bmc_sta & sta_info //if A-MPDU Rx is enabled, reseting rx_ordering_ctrl wstart_b(indicate_seq) to default value=0xffff @@ -3595,7 +3595,7 @@ void rtw_update_ht_cap(struct adapter *padapter, u8 *pie, uint ie_len) preorder_ctrl->wsize_b = 64;//max_ampdu_sz;//ex. 32(kbytes) -> wsize_b=32 } } -#endif +#endif } @@ -3609,9 +3609,9 @@ void rtw_issue_addbareq_cmd(struct adapter *padapter, struct xmit_frame *pxmitfr s32 bmcst = IS_MCAST(pattrib->ra); //if(bmcst || (padapter->mlmepriv.LinkDetectInfo.bTxBusyTraffic == _FALSE)) - if(bmcst || (padapter->mlmepriv.LinkDetectInfo.NumTxOkInPeriod<100)) + if(bmcst || (padapter->mlmepriv.LinkDetectInfo.NumTxOkInPeriod<100)) return; - + priority = pattrib->priority; if (pattrib->psta) @@ -3620,8 +3620,8 @@ void rtw_issue_addbareq_cmd(struct adapter *padapter, struct xmit_frame *pxmitfr { DBG_871X("%s, call rtw_get_stainfo()\n", __func__); psta = rtw_get_stainfo(&padapter->stapriv, pattrib->ra); - } - + } + if(psta==NULL) { DBG_871X("%s, psta==NUL\n", __func__); @@ -3632,12 +3632,12 @@ void rtw_issue_addbareq_cmd(struct adapter *padapter, struct xmit_frame *pxmitfr { DBG_871X("%s, psta->state(0x%x) != _FW_LINKED\n", __func__, psta->state); return; - } + } phtpriv = &psta->htpriv; - if((phtpriv->ht_option==_TRUE) && (phtpriv->ampdu_enable==_TRUE)) + if((phtpriv->ht_option==_TRUE) && (phtpriv->ampdu_enable==_TRUE)) { issued = (phtpriv->agg_enable_bitmap>>priority)&0x1; issued |= (phtpriv->candidate_tid_bitmap>>priority)&0x1; @@ -3649,7 +3649,7 @@ void rtw_issue_addbareq_cmd(struct adapter *padapter, struct xmit_frame *pxmitfr rtw_addbareq_cmd(padapter,(u8) priority, pattrib->ra); } } - + } #endif @@ -3687,7 +3687,7 @@ void _rtw_roaming(struct adapter *padapter, struct wlan_network *tgt_network) pnetwork = tgt_network; else pnetwork = &pmlmepriv->cur_network; - + if(0 < rtw_to_roaming(padapter)) { DBG_871X("roaming from %s("MAC_FMT"), length:%d\n", pnetwork->network.Ssid.Ssid, MAC_ARG(pnetwork->network.MacAddress), @@ -3706,7 +3706,7 @@ void _rtw_roaming(struct adapter *padapter, struct wlan_network *tgt_network) } else { DBG_871X("roaming do_join return %d\n", do_join_r); pmlmepriv->to_roaming--; - + if(0< rtw_to_roaming(padapter)) { continue; } else { @@ -3717,7 +3717,7 @@ void _rtw_roaming(struct adapter *padapter, struct wlan_network *tgt_network) } } } - + } #endif @@ -3739,9 +3739,9 @@ sint rtw_linked_check(struct adapter *padapter) #ifdef CONFIG_CONCURRENT_MODE sint rtw_buddy_adapter_up(struct adapter *padapter) -{ +{ sint res = _FALSE; - + if(padapter == NULL) return res; @@ -3752,30 +3752,30 @@ sint rtw_buddy_adapter_up(struct adapter *padapter) } else if( (padapter->pbuddy_adapter->bDriverStopped) || (padapter->pbuddy_adapter->bSurpriseRemoved) || (padapter->pbuddy_adapter->bup == _FALSE) || (padapter->pbuddy_adapter->hw_init_completed == _FALSE)) - { + { res = _FALSE; } else { res = _TRUE; - } + } - return res; + return res; } sint check_buddy_fwstate(struct adapter *padapter, sint state) { if(padapter == NULL) - return _FALSE; - + return _FALSE; + if(padapter->pbuddy_adapter == NULL) - return _FALSE; - - if ((state == WIFI_FW_NULL_STATE) && + return _FALSE; + + if ((state == WIFI_FW_NULL_STATE) && (padapter->pbuddy_adapter->mlmepriv.fw_state == WIFI_FW_NULL_STATE)) - return _TRUE; - + return _TRUE; + if (padapter->pbuddy_adapter->mlmepriv.fw_state & state) return _TRUE; @@ -3785,13 +3785,12 @@ sint check_buddy_fwstate(struct adapter *padapter, sint state) u8 rtw_get_buddy_bBusyTraffic(struct adapter *padapter) { if(padapter == NULL) - return _FALSE; - + return _FALSE; + if(padapter->pbuddy_adapter == NULL) - return _FALSE; - + return _FALSE; + return padapter->pbuddy_adapter->mlmepriv.LinkDetectInfo.bBusyTraffic; } #endif //CONFIG_CONCURRENT_MODE - diff --git a/core/rtw_mlme_ext.c b/core/rtw_mlme_ext.c index 6c388e4..e86ba5e 100755 --- a/core/rtw_mlme_ext.c +++ b/core/rtw_mlme_ext.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Copyright(c) 2007 - 2012 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. @@ -96,8 +96,8 @@ static struct action_handler OnAction_tbl[]={ //add for CONFIG_IEEE80211W {RTW_WLAN_CATEGORY_UNPROTECTED_WNM, "ACTION_UNPROTECTED_WNM", &DoReserved}, {RTW_WLAN_CATEGORY_SELF_PROTECTED, "ACTION_SELF_PROTECTED", &DoReserved}, - {RTW_WLAN_CATEGORY_WMM, "ACTION_WMM", &OnAction_wmm}, - {RTW_WLAN_CATEGORY_P2P, "ACTION_P2P", &OnAction_p2p}, + {RTW_WLAN_CATEGORY_WMM, "ACTION_WMM", &OnAction_wmm}, + {RTW_WLAN_CATEGORY_P2P, "ACTION_P2P", &OnAction_p2p}, }; @@ -267,7 +267,7 @@ static RT_CHANNEL_PLAN_MAP RTW_CHANNEL_PLAN_MAP_REALTEK_DEFINE = {0x03,0x02}; // * Search the @param channel_num in given @param channel_set * @ch_set: the given channel set * @ch: the given channel number - * + * * return the index of channel_num in channel_set, -1 if not found */ int rtw_ch_set_search_ch(RT_CHANNEL_INFO *ch_set, const u32 ch) @@ -277,7 +277,7 @@ int rtw_ch_set_search_ch(RT_CHANNEL_INFO *ch_set, const u32 ch) if(ch == ch_set[i].ChannelNum) break; } - + if(i >= ch_set[i].ChannelNum) return -1; return i; @@ -480,7 +480,7 @@ static u8 init_channel_set(struct adapter* padapter, u8 ChannelPlan, RT_CHANNEL_ if(channel_set[chanset_size].ChannelNum >= 1 && channel_set[chanset_size].ChannelNum <= 11) channel_set[chanset_size].ScanType = SCAN_ACTIVE; else if((channel_set[chanset_size].ChannelNum >= 12 && channel_set[chanset_size].ChannelNum <= 14)) - channel_set[chanset_size].ScanType = SCAN_PASSIVE; + channel_set[chanset_size].ScanType = SCAN_PASSIVE; } else if(RT_CHANNEL_DOMAIN_WORLD_WIDE_13 == ChannelPlan || RT_CHANNEL_DOMAIN_WORLD_WIDE_5G == ChannelPlan || @@ -506,7 +506,7 @@ static u8 init_channel_set(struct adapter* padapter, u8 ChannelPlan, RT_CHANNEL_ { #ifdef CONFIG_DFS channel_set[chanset_size].ChannelNum = RTW_ChannelPlan5G[Index5G].Channel[index]; - if ( channel_set[chanset_size].ChannelNum <= 48 + if ( channel_set[chanset_size].ChannelNum <= 48 || channel_set[chanset_size].ChannelNum >= 149 ) { if(RT_CHANNEL_DOMAIN_WORLD_WIDE_5G == ChannelPlan)//passive scan for all 5G channels @@ -520,7 +520,7 @@ static u8 init_channel_set(struct adapter* padapter, u8 ChannelPlan, RT_CHANNEL_ } chanset_size++; #else /* CONFIG_DFS */ - if ( RTW_ChannelPlan5G[Index5G].Channel[index] <= 48 + if ( RTW_ChannelPlan5G[Index5G].Channel[index] <= 48 || RTW_ChannelPlan5G[Index5G].Channel[index] >= 149 ) { channel_set[chanset_size].ChannelNum = RTW_ChannelPlan5G[Index5G].Channel[index]; if(RT_CHANNEL_DOMAIN_WORLD_WIDE_5G == ChannelPlan)//passive scan for all 5G channels @@ -554,26 +554,26 @@ int init_mlme_ext_priv(struct adapter* padapter) init_mlme_ext_priv_value(padapter); pmlmeinfo->bAcceptAddbaReq = pregistrypriv->bAcceptAddbaReq; - + init_mlme_ext_timer(padapter); #ifdef CONFIG_AP_MODE - init_mlme_ap_info(padapter); + init_mlme_ap_info(padapter); #endif pmlmeext->max_chan_nums = init_channel_set(padapter, pmlmepriv->ChannelPlan,pmlmeext->channel_set); init_channel_list(padapter, pmlmeext->channel_set, pmlmeext->max_chan_nums, &pmlmeext->channel_list); - + pmlmeext->chan_scan_time = SURVEY_TO; pmlmeext->mlmeext_init = _TRUE; -#ifdef CONFIG_ACTIVE_KEEP_ALIVE_CHECK +#ifdef CONFIG_ACTIVE_KEEP_ALIVE_CHECK pmlmeext->active_keep_alive_check = _TRUE; #endif -#ifdef DBG_FIXED_CHAN - pmlmeext->fixed_chan = 0xFF; +#ifdef DBG_FIXED_CHAN + pmlmeext->fixed_chan = 0xFF; #endif return res; @@ -596,46 +596,46 @@ void free_mlme_ext_priv (struct mlme_ext_priv *pmlmeext) } static u8 cmp_pkt_chnl_diff(struct adapter *padapter,u8* pframe,uint packet_len) -{ // if the channel is same, return 0. else return channel differential +{ // if the channel is same, return 0. else return channel differential uint len; - u8 channel; - u8 *p; - p = rtw_get_ie(pframe + WLAN_HDR_A3_LEN + _BEACON_IE_OFFSET_, _DSSET_IE_, &len, packet_len - _BEACON_IE_OFFSET_); - if (p) - { - channel = *(p + 2); - if(padapter->mlmeextpriv.cur_channel >= channel) - { - return (padapter->mlmeextpriv.cur_channel - channel); - } - else - { - return (channel-padapter->mlmeextpriv.cur_channel); - } - } + u8 channel; + u8 *p; + p = rtw_get_ie(pframe + WLAN_HDR_A3_LEN + _BEACON_IE_OFFSET_, _DSSET_IE_, &len, packet_len - _BEACON_IE_OFFSET_); + if (p) + { + channel = *(p + 2); + if(padapter->mlmeextpriv.cur_channel >= channel) + { + return (padapter->mlmeextpriv.cur_channel - channel); + } + else + { + return (channel-padapter->mlmeextpriv.cur_channel); + } + } else - { - return 0; + { + return 0; } } static void _mgt_dispatcher(struct adapter *padapter, struct mlme_handler *ptable, union recv_frame *precv_frame) { u8 bc_addr[ETH_ALEN] = {0xff,0xff,0xff,0xff,0xff,0xff}; - u8 *pframe = precv_frame->u.hdr.rx_data; + u8 *pframe = precv_frame->u.hdr.rx_data; if(ptable->func) { - //receive the frames that ra(a1) is my address or ra(a1) is bc address. + //receive the frames that ra(a1) is my address or ra(a1) is bc address. if (!_rtw_memcmp(GetAddr1Ptr(pframe), myid(&padapter->eeprompriv), ETH_ALEN) && - !_rtw_memcmp(GetAddr1Ptr(pframe), bc_addr, ETH_ALEN)) + !_rtw_memcmp(GetAddr1Ptr(pframe), bc_addr, ETH_ALEN)) { return; } - + ptable->func(padapter, precv_frame); } - + } void mgt_dispatcher(struct adapter *padapter, union recv_frame *precv_frame) @@ -723,7 +723,7 @@ void mgt_dispatcher(struct adapter *padapter, union recv_frame *precv_frame) #endif #ifdef CONFIG_AP_MODE - switch (GetFrameSubType(pframe)) + switch (GetFrameSubType(pframe)) { case WIFI_AUTH: if(check_fwstate(pmlmepriv, WIFI_AP_STATE) == _TRUE) @@ -733,17 +733,17 @@ void mgt_dispatcher(struct adapter *padapter, union recv_frame *precv_frame) //pass through case WIFI_ASSOCREQ: case WIFI_REASSOCREQ: - _mgt_dispatcher(padapter, ptable, precv_frame); -#ifdef CONFIG_HOSTAPD_MLME + _mgt_dispatcher(padapter, ptable, precv_frame); +#ifdef CONFIG_HOSTAPD_MLME if(check_fwstate(pmlmepriv, WIFI_AP_STATE) == _TRUE) rtw_hostapd_mlme_rx(padapter, precv_frame); -#endif +#endif break; case WIFI_PROBEREQ: if(check_fwstate(pmlmepriv, WIFI_AP_STATE) == _TRUE) { -#ifdef CONFIG_HOSTAPD_MLME - rtw_hostapd_mlme_rx(padapter, precv_frame); +#ifdef CONFIG_HOSTAPD_MLME + rtw_hostapd_mlme_rx(padapter, precv_frame); #else _mgt_dispatcher(padapter, ptable, precv_frame); #endif @@ -751,23 +751,23 @@ void mgt_dispatcher(struct adapter *padapter, union recv_frame *precv_frame) else _mgt_dispatcher(padapter, ptable, precv_frame); break; - case WIFI_BEACON: + case WIFI_BEACON: _mgt_dispatcher(padapter, ptable, precv_frame); break; case WIFI_ACTION: //if(check_fwstate(pmlmepriv, WIFI_AP_STATE) == _TRUE) - _mgt_dispatcher(padapter, ptable, precv_frame); + _mgt_dispatcher(padapter, ptable, precv_frame); break; default: - _mgt_dispatcher(padapter, ptable, precv_frame); + _mgt_dispatcher(padapter, ptable, precv_frame); if(check_fwstate(pmlmepriv, WIFI_AP_STATE) == _TRUE) - rtw_hostapd_mlme_rx(padapter, precv_frame); + rtw_hostapd_mlme_rx(padapter, precv_frame); break; } #else _mgt_dispatcher(padapter, ptable, precv_frame); - + #endif } @@ -792,7 +792,7 @@ static u32 p2p_listen_state_process(struct adapter *padapter, unsigned char *da) wdev_to_priv(padapter->rtw_wdev)->p2p_enabled, padapter->mlmepriv.wps_probe_resp_ie, padapter->mlmepriv.p2p_probe_resp_ie); - DBG_871X("is_ro_ch:%d, op_ch:%d, p2p_listen_channel:%d\n", + DBG_871X("is_ro_ch:%d, op_ch:%d, p2p_listen_channel:%d\n", padapter->cfg80211_wdinfo.is_ro_ch, rtw_get_oper_ch(padapter), padapter->wdinfo.listen_channel); @@ -813,7 +813,7 @@ static u32 p2p_listen_state_process(struct adapter *padapter, unsigned char *da) if (response == _TRUE) issue_probersp_p2p( padapter, da); - + return _SUCCESS; } #endif //CONFIG_P2P @@ -832,7 +832,7 @@ unsigned int OnProbeReq(struct adapter *padapter, union recv_frame *precv_frame) struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); - WLAN_BSSID_EX *cur = &(pmlmeinfo->network); + WLAN_BSSID_EX *cur = &(pmlmeinfo->network); u8 *pframe = precv_frame->u.hdr.rx_data; uint len = precv_frame->u.hdr.len; u8 is_valid_p2p_probereq = _FALSE; @@ -850,9 +850,9 @@ unsigned int OnProbeReq(struct adapter *padapter, union recv_frame *precv_frame) struct wifidirect_info *pwdinfo = &(padapter->wdinfo); struct rx_pkt_attrib *pattrib = &precv_frame->u.hdr.attrib; u8 wifi_test_chk_rate = 1; - - if ( !rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE) && - !rtw_p2p_chk_state(pwdinfo, P2P_STATE_IDLE) && + + if ( !rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE) && + !rtw_p2p_chk_state(pwdinfo, P2P_STATE_IDLE) && !rtw_p2p_chk_role(pwdinfo, P2P_ROLE_CLIENT) && !rtw_p2p_chk_state(pwdinfo, P2P_STATE_FIND_PHASE_SEARCH) && !rtw_p2p_chk_state(pwdinfo, P2P_STATE_SCAN) @@ -883,10 +883,10 @@ unsigned int OnProbeReq(struct adapter *padapter, union recv_frame *precv_frame) #ifndef CONFIG_IOCTL_CFG80211 // FIXME report_survey_event(padapter, precv_frame); -#endif +#endif p2p_listen_state_process( padapter, get_sa(pframe)); - return _SUCCESS; + return _SUCCESS; } if(rtw_p2p_chk_role(pwdinfo, P2P_ROLE_GO)) @@ -905,7 +905,7 @@ _continue: return _SUCCESS; } - if(check_fwstate(pmlmepriv, _FW_LINKED) == _FALSE && + if(check_fwstate(pmlmepriv, _FW_LINKED) == _FALSE && check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE|WIFI_AP_STATE)==_FALSE) { return _SUCCESS; @@ -920,7 +920,7 @@ _continue: pframe + WLAN_HDR_A3_LEN + _PROBEREQ_IE_OFFSET_, len - WLAN_HDR_A3_LEN - _PROBEREQ_IE_OFFSET_, NULL, &wps_ielen))) { - + target_ie = rtw_get_wps_attr_content( wps_ie, wps_ielen, WPS_ATTR_MANUFACTURER, NULL, &target_ielen); } if ((target_ie && (target_ielen == 4)) && (_TRUE ==_rtw_memcmp((void *)target_ie, "Ozmo",4 ))) { @@ -938,13 +938,13 @@ _continue: //don't process probe req return _SUCCESS; } -#endif +#endif p = rtw_get_ie(pframe + WLAN_HDR_A3_LEN + _PROBEREQ_IE_OFFSET_, _SSID_IE_, (int *)&ielen, len - WLAN_HDR_A3_LEN - _PROBEREQ_IE_OFFSET_); - //check (wildcard) SSID + //check (wildcard) SSID if (p != NULL) { if(is_valid_p2p_probereq == _TRUE) @@ -961,11 +961,11 @@ _continue: _issue_probersp: - if(((check_fwstate(pmlmepriv, _FW_LINKED) == _TRUE && + if(((check_fwstate(pmlmepriv, _FW_LINKED) == _TRUE && pmlmepriv->cur_network.join_res == _TRUE)) || check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE)) { //DBG_871X("+issue_probersp during ap mode\n"); - issue_probersp(padapter, get_sa(pframe), is_valid_p2p_probereq); + issue_probersp(padapter, get_sa(pframe), is_valid_p2p_probereq); } } @@ -997,7 +997,7 @@ unsigned int OnProbeRsp(struct adapter *padapter, union recv_frame *precv_frame) { pwdinfo->tx_prov_disc_info.benable = _FALSE; issue_p2p_provision_request( padapter, - pwdinfo->tx_prov_disc_info.ssid.Ssid, + pwdinfo->tx_prov_disc_info.ssid.Ssid, pwdinfo->tx_prov_disc_info.ssid.SsidLength, pwdinfo->tx_prov_disc_info.peerDevAddr ); } @@ -1005,11 +1005,11 @@ unsigned int OnProbeRsp(struct adapter *padapter, union recv_frame *precv_frame) { pwdinfo->tx_prov_disc_info.benable = _FALSE; issue_p2p_provision_request( padapter, - NULL, + NULL, 0, pwdinfo->tx_prov_disc_info.peerDevAddr ); } - } + } } return _SUCCESS; } @@ -1042,9 +1042,9 @@ unsigned int OnProbeRsp(struct adapter *padapter, union recv_frame *precv_frame) if (pmlmeext->sitesurvey_res.state == SCAN_PROCESS) { - report_survey_event(padapter, precv_frame); + report_survey_event(padapter, precv_frame); #ifdef CONFIG_CONCURRENT_MODE - report_survey_event(padapter->pbuddy_adapter, precv_frame); + report_survey_event(padapter->pbuddy_adapter, precv_frame); #endif //CONFIG_CONCURRENT_MODE #ifdef CONFIG_DUALMAC_CONCURRENT dc_report_survey_event(padapter, precv_frame); @@ -1064,9 +1064,9 @@ unsigned int OnProbeRsp(struct adapter *padapter, union recv_frame *precv_frame) } } #endif - + return _SUCCESS; - + } unsigned int OnBeacon(struct adapter *padapter, union recv_frame *precv_frame) @@ -1090,9 +1090,9 @@ unsigned int OnBeacon(struct adapter *padapter, union recv_frame *precv_frame) { if ((*(p + 1 + ielen) == 0x2D) && (*(p + 2 + ielen) != 0x2D)) { - /* Invalid value 0x2D is detected in Extended Supported Rates (ESR) IE. Try to fix the IE length to avoid failed Beacon parsing. */ - DBG_871X("[WIFIDBG] Error in ESR IE is detected in Beacon of BSSID:"MAC_FMT". Fix the length of ESR IE to avoid failed Beacon parsing.\n", MAC_ARG(GetAddr3Ptr(pframe))); - *(p + 1) = ielen - 1; + /* Invalid value 0x2D is detected in Extended Supported Rates (ESR) IE. Try to fix the IE length to avoid failed Beacon parsing. */ + DBG_871X("[WIFIDBG] Error in ESR IE is detected in Beacon of BSSID:"MAC_FMT". Fix the length of ESR IE to avoid failed Beacon parsing.\n", MAC_ARG(GetAddr3Ptr(pframe))); + *(p + 1) = ielen - 1; } } #endif @@ -1101,7 +1101,7 @@ unsigned int OnBeacon(struct adapter *padapter, union recv_frame *precv_frame) { report_survey_event(padapter, precv_frame); #ifdef CONFIG_CONCURRENT_MODE - report_survey_event(padapter->pbuddy_adapter, precv_frame); + report_survey_event(padapter->pbuddy_adapter, precv_frame); #endif #ifdef CONFIG_DUALMAC_CONCURRENT @@ -1126,7 +1126,7 @@ unsigned int OnBeacon(struct adapter *padapter, union recv_frame *precv_frame) } //check the vendor of the assoc AP - pmlmeinfo->assoc_AP_vendor = check_assoc_AP(pframe+sizeof(struct rtw_ieee80211_hdr_3addr), len-sizeof(struct rtw_ieee80211_hdr_3addr)); + pmlmeinfo->assoc_AP_vendor = check_assoc_AP(pframe+sizeof(struct rtw_ieee80211_hdr_3addr), len-sizeof(struct rtw_ieee80211_hdr_3addr)); //update TSF Value update_TSF(pmlmeext, pframe, len); @@ -1141,16 +1141,16 @@ unsigned int OnBeacon(struct adapter *padapter, union recv_frame *precv_frame) { if ((psta = rtw_get_stainfo(pstapriv, GetAddr2Ptr(pframe))) != NULL) { - #ifdef CONFIG_PATCH_JOIN_WRONG_CHANNEL + #ifdef CONFIG_PATCH_JOIN_WRONG_CHANNEL //Merge from 8712 FW code - if (cmp_pkt_chnl_diff(padapter,pframe,len) != 0) - { // join wrong channel, deauth and reconnect + if (cmp_pkt_chnl_diff(padapter,pframe,len) != 0) + { // join wrong channel, deauth and reconnect issue_deauth(padapter, (&(pmlmeinfo->network))->MacAddress, WLAN_REASON_DEAUTH_LEAVING); - report_del_sta_event(padapter,(&(pmlmeinfo->network))->MacAddress, WLAN_REASON_JOIN_WRONG_CHANNEL); - pmlmeinfo->state &= (~WIFI_FW_ASSOC_SUCCESS); + report_del_sta_event(padapter,(&(pmlmeinfo->network))->MacAddress, WLAN_REASON_JOIN_WRONG_CHANNEL); + pmlmeinfo->state &= (~WIFI_FW_ASSOC_SUCCESS); return _SUCCESS; - } + } #endif //CONFIG_PATCH_JOIN_WRONG_CHANNEL ret = rtw_check_bcn_info(padapter, pframe, len); @@ -1166,7 +1166,7 @@ unsigned int OnBeacon(struct adapter *padapter, union recv_frame *precv_frame) //DBG_871X("update_bcn_info\n"); update_beacon_info(padapter, pframe, len, psta); } - + #ifdef CONFIG_DFS process_csa_ie(padapter, pframe, len); //channel switch announcement #endif //CONFIG_DFS @@ -1212,7 +1212,7 @@ unsigned int OnBeacon(struct adapter *padapter, union recv_frame *precv_frame) } //update TSF Value - update_TSF(pmlmeext, pframe, len); + update_TSF(pmlmeext, pframe, len); //report sta add event report_add_sta_event(padapter, GetAddr2Ptr(pframe), cam_idx); @@ -1230,21 +1230,21 @@ unsigned int OnAuth(struct adapter *padapter, union recv_frame *precv_frame) { #ifdef CONFIG_AP_MODE _irqL irqL; - unsigned int auth_mode, seq, ie_len; - unsigned char *sa, *p; + unsigned int auth_mode, seq, ie_len; + unsigned char *sa, *p; u16 algorithm; int status; - static struct sta_info stat; - struct sta_info *pstat=NULL; + static struct sta_info stat; + struct sta_info *pstat=NULL; struct sta_priv *pstapriv = &padapter->stapriv; struct security_priv *psecuritypriv = &padapter->securitypriv; struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); - u8 *pframe = precv_frame->u.hdr.rx_data; + u8 *pframe = precv_frame->u.hdr.rx_data; uint len = precv_frame->u.hdr.len; - -#ifdef CONFIG_CONCURRENT_MODE + +#ifdef CONFIG_CONCURRENT_MODE if(((pmlmeinfo->state&0x03) == WIFI_FW_AP_STATE) && check_buddy_fwstate(padapter, _FW_UNDER_LINKING|_FW_UNDER_SURVEY)) { @@ -1257,9 +1257,9 @@ unsigned int OnAuth(struct adapter *padapter, union recv_frame *precv_frame) return _FAIL; DBG_871X("+OnAuth\n"); - + sa = GetAddr2Ptr(pframe); - + auth_mode = psecuritypriv->dot11AuthAlgrthm; seq = le16_to_cpu(*(__le16*)((SIZE_PTR)pframe + WLAN_HDR_A3_LEN + 2)); algorithm = le16_to_cpu(*(__le16*)((SIZE_PTR)pframe + WLAN_HDR_A3_LEN)); @@ -1273,19 +1273,19 @@ unsigned int OnAuth(struct adapter *padapter, union recv_frame *precv_frame) if ((algorithm > 0 && auth_mode == 0) || // rx a shared-key auth but shared not enabled (algorithm == 0 && auth_mode == 1) ) // rx a open-system auth but shared-key is enabled - { + { DBG_871X("auth rejected due to bad alg [alg=%d, auth_mib=%d] %02X%02X%02X%02X%02X%02X\n", algorithm, auth_mode, sa[0], sa[1], sa[2], sa[3], sa[4], sa[5]); - + status = _STATS_NO_SUPP_ALG_; - + goto auth_fail; } - + if(rtw_access_ctrl(padapter, sa) == _FALSE) { status = _STATS_UNABLE_HANDLE_STA_; goto auth_fail; - } + } pstat = rtw_get_stainfo(pstapriv, sa); if (pstat == NULL) @@ -1299,18 +1299,18 @@ unsigned int OnAuth(struct adapter *padapter, union recv_frame *precv_frame) status = _STATS_UNABLE_HANDLE_STA_; goto auth_fail; } - + pstat->state = WIFI_FW_AUTH_NULL; pstat->auth_seq = 0; - + //pstat->flags = 0; //pstat->capability = 0; } else - { + { _enter_critical_bh(&pstapriv->asoc_list_lock, &irqL); if(rtw_is_list_empty(&pstat->asoc_list)==_FALSE) - { + { rtw_list_delete(&pstat->asoc_list); pstapriv->asoc_list_cnt--; if (pstat->expire_to > 0) @@ -1319,18 +1319,18 @@ unsigned int OnAuth(struct adapter *padapter, union recv_frame *precv_frame) } } _exit_critical_bh(&pstapriv->asoc_list_lock, &irqL); - + if (seq==1) { - //TODO: STA re_auth and auth timeout + //TODO: STA re_auth and auth timeout } } _enter_critical_bh(&pstapriv->auth_list_lock, &irqL); if (rtw_is_list_empty(&pstat->auth_list)) - { + { rtw_list_insert_tail(&pstat->auth_list, &pstapriv->auth_list); pstapriv->auth_list_cnt++; - } + } _exit_critical_bh(&pstapriv->auth_list_lock, &irqL); if (pstat->auth_seq == 0) @@ -1366,9 +1366,9 @@ unsigned int OnAuth(struct adapter *padapter, union recv_frame *precv_frame) if (seq == 1) { //prepare for the challenging txt... - + //get_random_bytes((void *)pstat->chg_txt, 128);//TODO: - + pstat->state &= ~WIFI_FW_AUTH_NULL; pstat->state |= WIFI_FW_AUTH_STATE; pstat->authalg = algorithm; @@ -1378,7 +1378,7 @@ unsigned int OnAuth(struct adapter *padapter, union recv_frame *precv_frame) { //checking for challenging txt... DBG_871X("checking for challenging txt...\n"); - + p = rtw_get_ie(pframe + WLAN_HDR_A3_LEN + 4 + _AUTH_IE_OFFSET_ , _CHLGETXT_IE_, (int *)&ie_len, len - WLAN_HDR_A3_LEN - _AUTH_IE_OFFSET_ - 4); @@ -1388,7 +1388,7 @@ unsigned int OnAuth(struct adapter *padapter, union recv_frame *precv_frame) status = _STATS_CHALLENGE_FAIL_; goto auth_fail; } - + if (_rtw_memcmp((void *)(p + 2), pstat->chg_txt, 128)) { pstat->state &= (~WIFI_FW_AUTH_STATE); @@ -1414,8 +1414,8 @@ unsigned int OnAuth(struct adapter *padapter, union recv_frame *precv_frame) // Now, we are going to issue_auth... - pstat->auth_seq = seq + 1; - + pstat->auth_seq = seq + 1; + #ifdef CONFIG_NATIVEAP_MLME issue_auth(padapter, pstat, (unsigned short)(_STATS_SUCCESSFUL_)); #endif @@ -1423,21 +1423,21 @@ unsigned int OnAuth(struct adapter *padapter, union recv_frame *precv_frame) if (pstat->state & WIFI_FW_AUTH_SUCCESS) pstat->auth_seq = 0; - + return _SUCCESS; auth_fail: if(pstat) rtw_free_stainfo(padapter , pstat); - + pstat = &stat; _rtw_memset((char *)pstat, '\0', sizeof(stat)); pstat->auth_seq = 2; - _rtw_memcpy(pstat->hwaddr, sa, 6); - + _rtw_memcpy(pstat->hwaddr, sa, 6); + #ifdef CONFIG_NATIVEAP_MLME - issue_auth(padapter, pstat, (unsigned short)status); + issue_auth(padapter, pstat, (unsigned short)status); #endif #endif @@ -1466,9 +1466,9 @@ unsigned int OnAuthClient(struct adapter *padapter, union recv_frame *precv_fram offset = (GetPrivacy(pframe))? 4: 0; - algthm = le16_to_cpu(*(__le16 *)((SIZE_PTR)pframe + WLAN_HDR_A3_LEN + offset)); - seq = le16_to_cpu(*(__le16 *)((SIZE_PTR)pframe + WLAN_HDR_A3_LEN + offset + 2)); - status = le16_to_cpu(*(__le16 *)((SIZE_PTR)pframe + WLAN_HDR_A3_LEN + offset + 4)); + algthm = le16_to_cpu(*(__le16 *)((SIZE_PTR)pframe + WLAN_HDR_A3_LEN + offset)); + seq = le16_to_cpu(*(__le16 *)((SIZE_PTR)pframe + WLAN_HDR_A3_LEN + offset + 2)); + status = le16_to_cpu(*(__le16 *)((SIZE_PTR)pframe + WLAN_HDR_A3_LEN + offset + 4)); if (status != 0) { @@ -1481,7 +1481,7 @@ unsigned int OnAuthClient(struct adapter *padapter, union recv_frame *precv_fram pmlmeinfo->auth_algo = dot11AuthAlgrthm_Shared; //pmlmeinfo->reauth_count = 0; } - + set_link_timer(pmlmeext, 1); goto authclnt_fail; } @@ -1551,7 +1551,7 @@ unsigned int OnAssocReq(struct adapter *padapter, union recv_frame *precv_frame) #ifdef CONFIG_AP_MODE _irqL irqL; u16 capab_info, listen_interval; - struct rtw_ieee802_11_elems elems; + struct rtw_ieee802_11_elems elems; struct sta_info *pstat; unsigned char reassoc, *p, *pos, *wpa_ie; unsigned char WMM_IE[] = {0x00, 0x50, 0xf2, 0x02, 0x00, 0x01}; @@ -1559,12 +1559,12 @@ unsigned int OnAssocReq(struct adapter *padapter, union recv_frame *precv_frame) unsigned char supportRate[16]; int supportRateNum; unsigned short status = _STATS_SUCCESSFUL_; - unsigned short frame_type, ie_offset=0; + unsigned short frame_type, ie_offset=0; struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct security_priv *psecuritypriv = &padapter->securitypriv; struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; - struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); - WLAN_BSSID_EX *cur = &(pmlmeinfo->network); + struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); + WLAN_BSSID_EX *cur = &(pmlmeinfo->network); struct sta_priv *pstapriv = &padapter->stapriv; u8 *pframe = precv_frame->u.hdr.rx_data; uint pkt_len = precv_frame->u.hdr.len; @@ -1590,26 +1590,26 @@ unsigned int OnAssocReq(struct adapter *padapter, union recv_frame *precv_frame) if((pmlmeinfo->state&0x03) != WIFI_FW_AP_STATE) return _FAIL; - + frame_type = GetFrameSubType(pframe); if (frame_type == WIFI_ASSOCREQ) { reassoc = 0; ie_offset = _ASOCREQ_IE_OFFSET_; - } + } else // WIFI_REASSOCREQ { reassoc = 1; ie_offset = _REASOCREQ_IE_OFFSET_; } - + if (pkt_len < IEEE80211_3ADDR_LEN + ie_offset) { DBG_871X("handle_assoc(reassoc=%d) - too short payload (len=%lu)" "\n", reassoc, (unsigned long)pkt_len); return _FAIL; } - + pstat = rtw_get_stainfo(pstapriv, GetAddr2Ptr(pframe)); if (pstat == (struct sta_info *)NULL) { @@ -1618,13 +1618,13 @@ unsigned int OnAssocReq(struct adapter *padapter, union recv_frame *precv_frame) } capab_info = RTW_GET_LE16(pframe + WLAN_HDR_A3_LEN); - //capab_info = le16_to_cpu(*(unsigned short *)(pframe + WLAN_HDR_A3_LEN)); + //capab_info = le16_to_cpu(*(unsigned short *)(pframe + WLAN_HDR_A3_LEN)); //listen_interval = le16_to_cpu(*(unsigned short *)(pframe + WLAN_HDR_A3_LEN+2)); listen_interval = RTW_GET_LE16(pframe + WLAN_HDR_A3_LEN+2); left = pkt_len - (IEEE80211_3ADDR_LEN + ie_offset); pos = pframe + (IEEE80211_3ADDR_LEN + ie_offset); - + DBG_871X("%s\n", __FUNCTION__); @@ -1639,7 +1639,7 @@ unsigned int OnAssocReq(struct adapter *padapter, union recv_frame *precv_frame) else { pstat->state &= (~WIFI_FW_ASSOC_SUCCESS); - pstat->state |= WIFI_FW_ASSOC_STATE; + pstat->state |= WIFI_FW_ASSOC_STATE; } } else @@ -1668,7 +1668,7 @@ unsigned int OnAssocReq(struct adapter *padapter, union recv_frame *precv_frame) resp = WLAN_STATUS_ASSOC_DENIED_LISTEN_INT_TOO_LARGE; goto fail; } - + pstat->listen_interval = listen_interval; #endif @@ -1677,7 +1677,7 @@ unsigned int OnAssocReq(struct adapter *padapter, union recv_frame *precv_frame) !elems.ssid) { DBG_871X("STA " MAC_FMT " sent invalid association request\n", MAC_ARG(pstat->hwaddr)); - status = _STATS_FAILURE_; + status = _STATS_FAILURE_; goto OnAssocReqFail; } @@ -1688,7 +1688,7 @@ unsigned int OnAssocReq(struct adapter *padapter, union recv_frame *precv_frame) pkt_len - WLAN_HDR_A3_LEN - ie_offset); if (p == NULL) { - status = _STATS_FAILURE_; + status = _STATS_FAILURE_; } if (ie_len == 0) // broadcast ssid, however it is not allowed in assocreq @@ -1713,7 +1713,7 @@ unsigned int OnAssocReq(struct adapter *padapter, union recv_frame *precv_frame) // use our own rate set as statoin used //_rtw_memcpy(supportRate, AP_BSSRATE, AP_BSSRATE_LEN); //supportRateNum = AP_BSSRATE_LEN; - + status = _STATS_FAILURE_; goto OnAssocReqFail; } @@ -1724,26 +1724,26 @@ unsigned int OnAssocReq(struct adapter *padapter, union recv_frame *precv_frame) p = rtw_get_ie(pframe + WLAN_HDR_A3_LEN + ie_offset, _EXT_SUPPORTEDRATES_IE_ , &ie_len, pkt_len - WLAN_HDR_A3_LEN - ie_offset); if (p != NULL) { - + if(supportRateNum<=sizeof(supportRate)) { _rtw_memcpy(supportRate+supportRateNum, p+2, ie_len); supportRateNum += ie_len; - } + } } } //todo: mask supportRate between AP & STA -> move to update raid //get_matched_rate(pmlmeext, supportRate, &supportRateNum, 0); - //update station supportRate + //update station supportRate pstat->bssratelen = supportRateNum; _rtw_memcpy(pstat->bssrateset, supportRate, supportRateNum); UpdateBrateTblForSoftAP(pstat->bssrateset, pstat->bssratelen); //check RSN/WPA/WPS pstat->dot8021xalg = 0; - pstat->wpa_psk = 0; + pstat->wpa_psk = 0; pstat->wpa_group_cipher = 0; pstat->wpa2_group_cipher = 0; pstat->wpa_pairwise_cipher = 0; @@ -1751,19 +1751,19 @@ unsigned int OnAssocReq(struct adapter *padapter, union recv_frame *precv_frame) _rtw_memset(pstat->wpa_ie, 0, sizeof(pstat->wpa_ie)); if((psecuritypriv->wpa_psk & BIT(1)) && elems.rsn_ie) { - int group_cipher=0, pairwise_cipher=0; - + int group_cipher=0, pairwise_cipher=0; + wpa_ie = elems.rsn_ie; wpa_ie_len = elems.rsn_ie_len; if(rtw_parse_wpa2_ie(wpa_ie-2, wpa_ie_len+2, &group_cipher, &pairwise_cipher, NULL) == _SUCCESS) { - pstat->dot8021xalg = 1;//psk, todo:802.1x + pstat->dot8021xalg = 1;//psk, todo:802.1x pstat->wpa_psk |= BIT(1); - pstat->wpa2_group_cipher = group_cipher&psecuritypriv->wpa2_group_cipher; + pstat->wpa2_group_cipher = group_cipher&psecuritypriv->wpa2_group_cipher; pstat->wpa2_pairwise_cipher = pairwise_cipher&psecuritypriv->wpa2_pairwise_cipher; - + if(!pstat->wpa2_group_cipher) status = WLAN_STATUS_GROUP_CIPHER_NOT_VALID; @@ -1773,35 +1773,35 @@ unsigned int OnAssocReq(struct adapter *padapter, union recv_frame *precv_frame) else { status = WLAN_STATUS_INVALID_IE; - } - + } + } else if ((psecuritypriv->wpa_psk & BIT(0)) && elems.wpa_ie) { - int group_cipher=0, pairwise_cipher=0; - + int group_cipher=0, pairwise_cipher=0; + wpa_ie = elems.wpa_ie; wpa_ie_len = elems.wpa_ie_len; if(rtw_parse_wpa_ie(wpa_ie-2, wpa_ie_len+2, &group_cipher, &pairwise_cipher, NULL) == _SUCCESS) { - pstat->dot8021xalg = 1;//psk, todo:802.1x + pstat->dot8021xalg = 1;//psk, todo:802.1x pstat->wpa_psk |= BIT(0); - pstat->wpa_group_cipher = group_cipher&psecuritypriv->wpa_group_cipher; + pstat->wpa_group_cipher = group_cipher&psecuritypriv->wpa_group_cipher; pstat->wpa_pairwise_cipher = pairwise_cipher&psecuritypriv->wpa_pairwise_cipher; - + if(!pstat->wpa_group_cipher) status = WLAN_STATUS_GROUP_CIPHER_NOT_VALID; if(!pstat->wpa_pairwise_cipher) status = WLAN_STATUS_PAIRWISE_CIPHER_NOT_VALID; - + } else { status = WLAN_STATUS_INVALID_IE; } - + } else { wpa_ie = NULL; wpa_ie_len = 0; @@ -1831,26 +1831,26 @@ unsigned int OnAssocReq(struct adapter *padapter, union recv_frame *precv_frame) // AP support WPA/RSN, and sta is going to do WPS, but AP is not ready // that the selected registrar of AP is _FLASE - if((psecuritypriv->wpa_psk >0) + if((psecuritypriv->wpa_psk >0) && (pstat->flags & (WLAN_STA_WPS|WLAN_STA_MAYBE_WPS))) { if(pmlmepriv->wps_beacon_ie) - { + { u8 selected_registrar = 0; - + rtw_get_wps_attr_content(pmlmepriv->wps_beacon_ie, pmlmepriv->wps_beacon_ie_len, WPS_ATTR_SELECTED_REGISTRAR , &selected_registrar, NULL); if(!selected_registrar) - { + { DBG_871X("selected_registrar is _FALSE , or AP is not ready to do WPS\n"); - + status = _STATS_UNABLE_HANDLE_STA_; - + goto OnAssocReqFail; - } - } + } + } } - + } else { @@ -1859,10 +1859,10 @@ unsigned int OnAssocReq(struct adapter *padapter, union recv_frame *precv_frame) if(psecuritypriv->wpa_psk == 0) { DBG_871X("STA " MAC_FMT ": WPA/RSN IE in association " - "request, but AP don't support WPA/RSN\n", MAC_ARG(pstat->hwaddr)); - + "request, but AP don't support WPA/RSN\n", MAC_ARG(pstat->hwaddr)); + status = WLAN_STATUS_INVALID_IE; - + goto OnAssocReqFail; } @@ -1879,10 +1879,10 @@ unsigned int OnAssocReq(struct adapter *padapter, union recv_frame *precv_frame) copy_len = ((wpa_ie_len+2) > sizeof(pstat->wpa_ie)) ? (sizeof(pstat->wpa_ie)):(wpa_ie_len+2); } - + if(copy_len>0) _rtw_memcpy(pstat->wpa_ie, wpa_ie-2, copy_len); - + } @@ -1895,51 +1895,51 @@ unsigned int OnAssocReq(struct adapter *padapter, union recv_frame *precv_frame) pstat->uapsd_vi = 0; pstat->uapsd_be = 0; pstat->uapsd_bk = 0; - if (pmlmepriv->qospriv.qos_option) + if (pmlmepriv->qospriv.qos_option) { p = pframe + WLAN_HDR_A3_LEN + ie_offset; ie_len = 0; - for (;;) + for (;;) { p = rtw_get_ie(p, _VENDOR_SPECIFIC_IE_, &ie_len, pkt_len - WLAN_HDR_A3_LEN - ie_offset); if (p != NULL) { if (_rtw_memcmp(p+2, WMM_IE, 6)) { pstat->flags |= WLAN_STA_WME; - - pstat->qos_option = 1; + + pstat->qos_option = 1; pstat->qos_info = *(p+8); - + pstat->max_sp_len = (pstat->qos_info>>5)&0x3; if((pstat->qos_info&0xf) !=0xf) pstat->has_legacy_ac = _TRUE; else pstat->has_legacy_ac = _FALSE; - + if(pstat->qos_info&0xf) { if(pstat->qos_info&BIT(0)) pstat->uapsd_vo = BIT(0)|BIT(1); else pstat->uapsd_vo = 0; - + if(pstat->qos_info&BIT(1)) pstat->uapsd_vi = BIT(0)|BIT(1); else pstat->uapsd_vi = 0; - + if(pstat->qos_info&BIT(2)) pstat->uapsd_bk = BIT(0)|BIT(1); else pstat->uapsd_bk = 0; - - if(pstat->qos_info&BIT(3)) + + if(pstat->qos_info&BIT(3)) pstat->uapsd_be = BIT(0)|BIT(1); else pstat->uapsd_be = 0; - + } - + break; } } @@ -1954,32 +1954,32 @@ unsigned int OnAssocReq(struct adapter *padapter, union recv_frame *precv_frame) #ifdef CONFIG_80211N_HT /* save HT capabilities in the sta object */ _rtw_memset(&pstat->htpriv.ht_cap, 0, sizeof(struct rtw_ieee80211_ht_cap)); - if (elems.ht_capabilities && elems.ht_capabilities_len >= sizeof(struct rtw_ieee80211_ht_cap)) + if (elems.ht_capabilities && elems.ht_capabilities_len >= sizeof(struct rtw_ieee80211_ht_cap)) { pstat->flags |= WLAN_STA_HT; - + pstat->flags |= WLAN_STA_WME; - - _rtw_memcpy(&pstat->htpriv.ht_cap, elems.ht_capabilities, sizeof(struct rtw_ieee80211_ht_cap)); - + + _rtw_memcpy(&pstat->htpriv.ht_cap, elems.ht_capabilities, sizeof(struct rtw_ieee80211_ht_cap)); + } else pstat->flags &= ~WLAN_STA_HT; - + if((pmlmepriv->htpriv.ht_option == _FALSE) && (pstat->flags&WLAN_STA_HT)) { status = _STATS_FAILURE_; goto OnAssocReqFail; } - + if ((pstat->flags & WLAN_STA_HT) && ((pstat->wpa2_pairwise_cipher&WPA_CIPHER_TKIP) || (pstat->wpa_pairwise_cipher&WPA_CIPHER_TKIP))) - { + { DBG_871X("HT: " MAC_FMT " tried to " "use TKIP with HT association\n", MAC_ARG(pstat->hwaddr)); - + //status = WLAN_STATUS_CIPHER_REJECTED_PER_POLICY; //goto OnAssocReqFail; } @@ -1987,7 +1987,7 @@ unsigned int OnAssocReq(struct adapter *padapter, union recv_frame *precv_frame) // //if (hapd->iface->current_mode->mode == HOSTAPD_MODE_IEEE80211G)//? - pstat->flags |= WLAN_STA_NONERP; + pstat->flags |= WLAN_STA_NONERP; for (i = 0; i < pstat->bssratelen; i++) { if ((pstat->bssrateset[i] & 0x7f) > 22) { pstat->flags &= ~WLAN_STA_NONERP; @@ -2000,15 +2000,15 @@ unsigned int OnAssocReq(struct adapter *padapter, union recv_frame *precv_frame) else pstat->flags &= ~WLAN_STA_SHORT_PREAMBLE; - - + + if (status != _STATS_SUCCESSFUL_) goto OnAssocReqFail; #ifdef CONFIG_P2P pstat->is_p2p_device = _FALSE; if(rtw_p2p_chk_role(pwdinfo, P2P_ROLE_GO)) - { + { if( (p2pie=rtw_get_p2p_ie(pframe + WLAN_HDR_A3_LEN + ie_offset , pkt_len - WLAN_HDR_A3_LEN - ie_offset , NULL, &p2pielen))) { pstat->is_p2p_device = _TRUE; @@ -2044,7 +2044,7 @@ unsigned int OnAssocReq(struct adapter *padapter, union recv_frame *precv_frame) // identify if this is ralink sta // Customer proprietary IE - + /* get a unique AID */ if (pstat->aid > 0) { @@ -2053,29 +2053,29 @@ unsigned int OnAssocReq(struct adapter *padapter, union recv_frame *precv_frame) for (pstat->aid = 1; pstat->aid <= NUM_STA; pstat->aid++) if (pstapriv->sta_aid[pstat->aid - 1] == NULL) break; - + //if (pstat->aid > NUM_STA) { if (pstat->aid > pstapriv->max_num_sta) { - + pstat->aid = 0; - + DBG_871X(" no room for more AIDs\n"); status = WLAN_STATUS_AP_UNABLE_TO_HANDLE_NEW_STA; - + goto OnAssocReqFail; - - + + } else { pstapriv->sta_aid[pstat->aid - 1] = pstat; DBG_871X("allocate new AID = (%d)\n", pstat->aid); - } + } } - pstat->state &= (~WIFI_FW_ASSOC_STATE); + pstat->state &= (~WIFI_FW_ASSOC_STATE); pstat->state |= WIFI_FW_ASSOC_SUCCESS; - + _enter_critical_bh(&pstapriv->auth_list_lock, &irqL); if (!rtw_is_list_empty(&pstat->auth_list)) { @@ -2084,7 +2084,7 @@ unsigned int OnAssocReq(struct adapter *padapter, union recv_frame *precv_frame) } _exit_critical_bh(&pstapriv->auth_list_lock, &irqL); - _enter_critical_bh(&pstapriv->asoc_list_lock, &irqL); + _enter_critical_bh(&pstapriv->asoc_list_lock, &irqL); if (rtw_is_list_empty(&pstat->asoc_list)) { pstat->expire_to = pstapriv->expire_to; @@ -2093,7 +2093,7 @@ unsigned int OnAssocReq(struct adapter *padapter, union recv_frame *precv_frame) } _exit_critical_bh(&pstapriv->asoc_list_lock, &irqL); - // now the station is qualified to join our BSS... + // now the station is qualified to join our BSS... if(pstat && (pstat->state & WIFI_FW_ASSOC_SUCCESS) && (_STATS_SUCCESSFUL_==status)) { #ifdef CONFIG_NATIVEAP_MLME @@ -2122,12 +2122,12 @@ unsigned int OnAssocReq(struct adapter *padapter, union recv_frame *precv_frame) _rtw_memcpy(pstat->passoc_req, pframe, pkt_len); pstat->assoc_req_len = pkt_len; } - _exit_critical_bh(&pstat->lock, &irqL); + _exit_critical_bh(&pstat->lock, &irqL); #endif //CONFIG_IOCTL_CFG80211 //.3-(1) report sta add event report_add_sta_event(padapter, pstat->hwaddr, pstat->aid); - + #endif //CONFIG_NATIVEAP_MLME } @@ -2139,7 +2139,7 @@ asoc_class2_error: issue_deauth(padapter, (void *)GetAddr2Ptr(pframe), status); #endif - return _FAIL; + return _FAIL; OnAssocReqFail: @@ -2155,7 +2155,7 @@ OnAssocReqFail: #endif /* CONFIG_AP_MODE */ - return _FAIL; + return _FAIL; } @@ -2168,13 +2168,13 @@ unsigned int OnAssocRsp(struct adapter *padapter, union recv_frame *precv_frame) struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); - //WLAN_BSSID_EX *cur_network = &(pmlmeinfo->network); + //WLAN_BSSID_EX *cur_network = &(pmlmeinfo->network); u8 *pframe = precv_frame->u.hdr.rx_data; uint pkt_len = precv_frame->u.hdr.len; PNDIS_802_11_VARIABLE_IEs pWapiIE = NULL; DBG_871X("%s\n", __FUNCTION__); - + //check A1 matches or not if (!_rtw_memcmp(myid(&(padapter->eeprompriv)), get_da(pframe), ETH_ALEN)) return _SUCCESS; @@ -2225,7 +2225,7 @@ unsigned int OnAssocRsp(struct adapter *padapter, union recv_frame *precv_frame) DBG_871X( "[%s] Found WFD IE\n", __FUNCTION__ ); WFD_info_handler( padapter, pIE ); } -#endif +#endif break; #ifdef CONFIG_WAPI_SUPPORT @@ -2303,26 +2303,26 @@ unsigned int OnDeAuth(struct adapter *padapter, union recv_frame *precv_frame) #ifdef CONFIG_AP_MODE if(check_fwstate(pmlmepriv, WIFI_AP_STATE) == _TRUE) - { + { _irqL irqL; struct sta_info *psta; struct sta_priv *pstapriv = &padapter->stapriv; - - //_enter_critical_bh(&(pstapriv->sta_hash_lock), &irqL); + + //_enter_critical_bh(&(pstapriv->sta_hash_lock), &irqL); //rtw_free_stainfo(padapter, psta); - //_exit_critical_bh(&(pstapriv->sta_hash_lock), &irqL); + //_exit_critical_bh(&(pstapriv->sta_hash_lock), &irqL); DBG_871X_LEVEL(_drv_always_, "ap recv deauth reason code(%d) sta:%pM\n", - reason, GetAddr2Ptr(pframe)); + reason, GetAddr2Ptr(pframe)); - psta = rtw_get_stainfo(pstapriv, GetAddr2Ptr(pframe)); + psta = rtw_get_stainfo(pstapriv, GetAddr2Ptr(pframe)); if(psta) { u8 updated; - + _enter_critical_bh(&pstapriv->asoc_list_lock, &irqL); if(rtw_is_list_empty(&psta->asoc_list)==_FALSE) - { + { rtw_list_delete(&psta->asoc_list); pstapriv->asoc_list_cnt--; updated = ap_free_sta(padapter, psta, _FALSE, reason); @@ -2332,7 +2332,7 @@ unsigned int OnDeAuth(struct adapter *padapter, union recv_frame *precv_frame) associated_clients_update(padapter, updated); } - + return _SUCCESS; } @@ -2342,7 +2342,7 @@ unsigned int OnDeAuth(struct adapter *padapter, union recv_frame *precv_frame) int ignore_received_deauth = 0; // Commented by Albert 20130604 - // Before sending the auth frame to start the STA/GC mode connection with AP/GO, + // Before sending the auth frame to start the STA/GC mode connection with AP/GO, // we will send the deauth first. // However, the Win8.1 with BRCM Wi-Fi will send the deauth with reason code 6 to us after receieving our deauth. // Added the following code to avoid this case. @@ -2359,13 +2359,13 @@ unsigned int OnDeAuth(struct adapter *padapter, union recv_frame *precv_frame) } DBG_871X_LEVEL(_drv_always_, "sta recv deauth reason code(%d) sta:%pM, ignore = %d\n", - reason, GetAddr3Ptr(pframe), ignore_received_deauth); - + reason, GetAddr3Ptr(pframe), ignore_received_deauth); + if ( 0 == ignore_received_deauth ) { receive_disconnect(padapter, GetAddr3Ptr(pframe) ,reason); } - } + } pmlmepriv->LinkDetectInfo.bBusyTraffic = _FALSE; return _SUCCESS; @@ -2398,30 +2398,30 @@ unsigned int OnDisassoc(struct adapter *padapter, union recv_frame *precv_frame) DBG_871X("%s Reason code(%d)\n", __FUNCTION__,reason); #ifdef CONFIG_AP_MODE - if(check_fwstate(pmlmepriv, WIFI_AP_STATE) == _TRUE) { + if(check_fwstate(pmlmepriv, WIFI_AP_STATE) == _TRUE) { _irqL irqL; struct sta_info *psta; struct sta_priv *pstapriv = &padapter->stapriv; - - //_enter_critical_bh(&(pstapriv->sta_hash_lock), &irqL); + + //_enter_critical_bh(&(pstapriv->sta_hash_lock), &irqL); //rtw_free_stainfo(padapter, psta); - //_exit_critical_bh(&(pstapriv->sta_hash_lock), &irqL); + //_exit_critical_bh(&(pstapriv->sta_hash_lock), &irqL); DBG_871X_LEVEL(_drv_always_, "ap recv disassoc reason code(%d) sta:%pM\n", reason, GetAddr2Ptr(pframe)); - psta = rtw_get_stainfo(pstapriv, GetAddr2Ptr(pframe)); + psta = rtw_get_stainfo(pstapriv, GetAddr2Ptr(pframe)); if(psta) { u8 updated; - + _enter_critical_bh(&pstapriv->asoc_list_lock, &irqL); if(rtw_is_list_empty(&psta->asoc_list)==_FALSE) { rtw_list_delete(&psta->asoc_list); pstapriv->asoc_list_cnt--; updated = ap_free_sta(padapter, psta, _FALSE, reason); - + } _exit_critical_bh(&pstapriv->asoc_list_lock, &irqL); @@ -2435,9 +2435,9 @@ unsigned int OnDisassoc(struct adapter *padapter, union recv_frame *precv_frame) { DBG_871X_LEVEL(_drv_always_, "ap recv disassoc reason code(%d) sta:%pM\n", reason, GetAddr3Ptr(pframe)); - + receive_disconnect(padapter, GetAddr3Ptr(pframe), reason); - } + } pmlmepriv->LinkDetectInfo.bBusyTraffic = _FALSE; return _SUCCESS; @@ -2456,12 +2456,12 @@ static unsigned int on_action_spct_ch_switch(struct adapter *padapter, struct st struct mlme_ext_info *pmlmeinfo = &(mlmeext->mlmext_info); if (!(pmlmeinfo->state & WIFI_FW_ASSOC_SUCCESS)) { - ret = _SUCCESS; + ret = _SUCCESS; goto exit; } if ((pmlmeinfo->state & 0x03) == WIFI_FW_STATION_STATE) { - + int ch_switch_mode = -1, ch = -1, ch_switch_cnt = -1; int ch_offset = -1; u8 bwmode; @@ -2573,7 +2573,7 @@ unsigned int OnAction_back(struct adapter *padapter, union recv_frame *precv_fra u8 *pframe = precv_frame->u.hdr.rx_data; struct sta_priv *pstapriv = &padapter->stapriv; #ifdef CONFIG_80211N_HT - //check RA matches or not + //check RA matches or not if (!_rtw_memcmp(myid(&(padapter->eeprompriv)), GetAddr1Ptr(pframe), ETH_ALEN))//for if1, sta/ap mode return _SUCCESS; @@ -2584,7 +2584,7 @@ unsigned int OnAction_back(struct adapter *padapter, union recv_frame *precv_fra */ DBG_871X("%s\n", __FUNCTION__); - if((pmlmeinfo->state&0x03) != WIFI_FW_AP_STATE) + if((pmlmeinfo->state&0x03) != WIFI_FW_AP_STATE) if (!(pmlmeinfo->state & WIFI_FW_ASSOC_SUCCESS)) return _SUCCESS; @@ -2600,7 +2600,7 @@ unsigned int OnAction_back(struct adapter *padapter, union recv_frame *precv_fra if (category == RTW_WLAN_CATEGORY_BACK)// representing Block Ack { #ifdef CONFIG_TDLS - if((psta->tdls_sta_state & TDLS_LINKED_STATE) && + if((psta->tdls_sta_state & TDLS_LINKED_STATE) && (psta->htpriv.ht_option==_TRUE) && (psta->htpriv.ampdu_enable==_TRUE) ) { @@ -2622,7 +2622,7 @@ unsigned int OnAction_back(struct adapter *padapter, union recv_frame *precv_fra _rtw_memcpy(&(pmlmeinfo->ADDBA_req), &(frame_body[2]), sizeof(struct ADDBA_request)); //process_addba_req(padapter, (u8*)&(pmlmeinfo->ADDBA_req), GetAddr3Ptr(pframe)); process_addba_req(padapter, (u8*)&(pmlmeinfo->ADDBA_req), addr); - + if(pmlmeinfo->bAcceptAddbaReq == _TRUE) { issue_action_BA(padapter, addr, RTW_WLAN_ACTION_ADDBA_RESP, 0); } else { @@ -2630,7 +2630,7 @@ unsigned int OnAction_back(struct adapter *padapter, union recv_frame *precv_fra RTW_WLAN_ACTION_ADDBA_RESP, 37);//reject ADDBA Req } - + break; case RTW_WLAN_ACTION_ADDBA_RESP: //ADDBA response @@ -2640,14 +2640,14 @@ unsigned int OnAction_back(struct adapter *padapter, union recv_frame *precv_fra tid = ((frame_body[5] >> 2) & 0x7); if (status == 0) - { //successful + { //successful DBG_871X("agg_enable for TID=%d\n", tid); - psta->htpriv.agg_enable_bitmap |= 1 << tid; - psta->htpriv.candidate_tid_bitmap &= ~BIT(tid); + psta->htpriv.agg_enable_bitmap |= 1 << tid; + psta->htpriv.candidate_tid_bitmap &= ~BIT(tid); } else - { - psta->htpriv.agg_enable_bitmap &= ~BIT(tid); + { + psta->htpriv.agg_enable_bitmap &= ~BIT(tid); } //DBG_871X("marc: ADDBA RSP: %x\n", pmlmeinfo->agg_enable_bitmap); @@ -2658,14 +2658,14 @@ unsigned int OnAction_back(struct adapter *padapter, union recv_frame *precv_fra { psta->htpriv.agg_enable_bitmap &= ~(1 << ((frame_body[3] >> 4) & 0xf)); psta->htpriv.candidate_tid_bitmap &= ~(1 << ((frame_body[3] >> 4) & 0xf)); - + //reason_code = frame_body[4] | (frame_body[5] << 8); reason_code = RTW_GET_LE16(&frame_body[4]); } else if((frame_body[3] & BIT(3)) == BIT(3)) - { + { tid = (frame_body[3] >> 4) & 0x0F; - + preorder_ctrl = &psta->recvreorder_ctrl[tid]; preorder_ctrl->enable = _FALSE; preorder_ctrl->indicate_seq = 0xffff; @@ -2674,7 +2674,7 @@ unsigned int OnAction_back(struct adapter *padapter, union recv_frame *precv_fra preorder_ctrl->indicate_seq); #endif } - + DBG_871X("%s(): DELBA: %x(%x)\n", __FUNCTION__,pmlmeinfo->agg_enable_bitmap, reason_code); //todo: how to notify the host while receiving DELETE BA break; @@ -2706,8 +2706,8 @@ static void get_channel_cnt_24g_5gl_5gh( struct mlme_ext_priv *pmlmeext, u8* p2 *p24g_cnt = 0; *p5gl_cnt = 0; - *p5gh_cnt = 0; - + *p5gh_cnt = 0; + for( i = 0; i < pmlmeext->max_chan_nums; i++ ) { if ( pmlmeext->channel_set[ i ].ChannelNum <= 14 ) @@ -2739,8 +2739,8 @@ void issue_p2p_GO_request(struct adapter *padapter, u8* raddr) u16 len_channellist_attr = 0; #ifdef CONFIG_WFD u32 wfdielen = 0; -#endif //CONFIG_WFD - +#endif //CONFIG_WFD + struct xmit_frame *pmgntframe; struct pkt_attrib *pattrib; unsigned char *pframe; @@ -2784,11 +2784,11 @@ void issue_p2p_GO_request(struct adapter *padapter, u8* raddr) pframe = rtw_set_fixed_ie(pframe, 1, &(category), &(pattrib->pktlen)); pframe = rtw_set_fixed_ie(pframe, 1, &(action), &(pattrib->pktlen)); pframe = rtw_set_fixed_ie(pframe, 4, (unsigned char *) &(p2poui), &(pattrib->pktlen)); - pframe = rtw_set_fixed_ie(pframe, 1, &(oui_subtype), &(pattrib->pktlen)); + pframe = rtw_set_fixed_ie(pframe, 1, &(oui_subtype), &(pattrib->pktlen)); pwdinfo->negotiation_dialog_token = 1; // Initialize the dialog value pframe = rtw_set_fixed_ie(pframe, 1, &pwdinfo->negotiation_dialog_token, &(pattrib->pktlen)); - + // WPS Section wpsielen = 0; @@ -2919,17 +2919,17 @@ void issue_p2p_GO_request(struct adapter *padapter, u8* raddr) // Country String p2pie[ p2pielen++ ] = 'X'; p2pie[ p2pielen++ ] = 'X'; - + // The third byte should be set to 0x04. // Described in the "Operating Channel Attribute" section. p2pie[ p2pielen++ ] = 0x04; // Operating Class p2pie[ p2pielen++ ] = 0x51; // Copy from SD7 - + // Channel Number p2pie[ p2pielen++ ] = pwdinfo->listen_channel; // listening channel number - + // Extended Listen Timing ATTR // Type: @@ -2994,7 +2994,7 @@ void issue_p2p_GO_request(struct adapter *padapter, u8* raddr) // Country String p2pie[ p2pielen++ ] = 'X'; p2pie[ p2pielen++ ] = 'X'; - + // The third byte should be set to 0x04. // Described in the "Operating Channel Attribute" section. p2pie[ p2pielen++ ] = 0x04; @@ -3004,7 +3004,7 @@ void issue_p2p_GO_request(struct adapter *padapter, u8* raddr) #ifdef CONFIG_CONCURRENT_MODE if ( check_buddy_fwstate(padapter, _FW_LINKED ) ) { - struct adapter *pbuddy_adapter = padapter->pbuddy_adapter; + struct adapter *pbuddy_adapter = padapter->pbuddy_adapter; struct mlme_ext_priv *pbuddy_mlmeext = &pbuddy_adapter->mlmeextpriv; // Operating Class @@ -3070,7 +3070,7 @@ void issue_p2p_GO_request(struct adapter *padapter, u8* raddr) p2pie[ p2pielen++ ] = P2P_ATTR_DEVICE_INFO; // Length: - // 21 -> P2P Device Address (6bytes) + Config Methods (2bytes) + Primary Device Type (8bytes) + // 21 -> P2P Device Address (6bytes) + Config Methods (2bytes) + Primary Device Type (8bytes) // + NumofSecondDevType (1byte) + WPS Device Name ID field (2bytes) + WPS Device Name Len field (2bytes) *(__le16*) ( p2pie + p2pielen ) = cpu_to_le16( 21 + pwdinfo->device_name_len ); p2pielen += 2; @@ -3114,8 +3114,8 @@ void issue_p2p_GO_request(struct adapter *padapter, u8* raddr) // Value: _rtw_memcpy( p2pie + p2pielen, pwdinfo->device_name , pwdinfo->device_name_len ); - p2pielen += pwdinfo->device_name_len; - + p2pielen += pwdinfo->device_name_len; + // Operating Channel // Type: @@ -3129,7 +3129,7 @@ void issue_p2p_GO_request(struct adapter *padapter, u8* raddr) // Country String p2pie[ p2pielen++ ] = 'X'; p2pie[ p2pielen++ ] = 'X'; - + // The third byte should be set to 0x04. // Described in the "Operating Channel Attribute" section. p2pie[ p2pielen++ ] = 0x04; @@ -3154,7 +3154,7 @@ void issue_p2p_GO_request(struct adapter *padapter, u8* raddr) // Channel Number p2pie[ p2pielen++ ] = pwdinfo->operating_channel; // operating channel number - pframe = rtw_set_ie(pframe, _VENDOR_SPECIFIC_IE_, p2pielen, (unsigned char *) p2pie, &pattrib->pktlen ); + pframe = rtw_set_ie(pframe, _VENDOR_SPECIFIC_IE_, p2pielen, (unsigned char *) p2pie, &pattrib->pktlen ); #ifdef CONFIG_WFD wfdielen = build_nego_req_wfd_ie(pwdinfo, pframe); @@ -3185,7 +3185,7 @@ static void issue_p2p_GO_response(struct adapter *padapter, u8* raddr, u8* frame uint wps_devicepassword_id_len = 0; u8 channel_cnt_24g = 0, channel_cnt_5gl = 0, channel_cnt_5gh; u16 len_channellist_attr = 0; - __be16 be_tmp; + __be16 be_tmp; struct xmit_frame *pmgntframe; struct pkt_attrib *pattrib; unsigned char *pframe; @@ -3232,7 +3232,7 @@ static void issue_p2p_GO_response(struct adapter *padapter, u8* raddr, u8* frame pframe = rtw_set_fixed_ie(pframe, 1, &(category), &(pattrib->pktlen)); pframe = rtw_set_fixed_ie(pframe, 1, &(action), &(pattrib->pktlen)); pframe = rtw_set_fixed_ie(pframe, 4, (unsigned char *) &(p2poui), &(pattrib->pktlen)); - pframe = rtw_set_fixed_ie(pframe, 1, &(oui_subtype), &(pattrib->pktlen)); + pframe = rtw_set_fixed_ie(pframe, 1, &(oui_subtype), &(pattrib->pktlen)); pwdinfo->negotiation_dialog_token = frame_body[7]; // The Dialog Token of provisioning discovery request frame. pframe = rtw_set_fixed_ie(pframe, 1, &(pwdinfo->negotiation_dialog_token), &(pattrib->pktlen)); @@ -3299,11 +3299,11 @@ static void issue_p2p_GO_response(struct adapter *padapter, u8* raddr, u8* frame } else if ( wps_devicepassword_id == WPS_DPID_REGISTRAR_SPEC ) { - _rtw_memcpy( pwdinfo->rx_prov_disc_info.strconfig_method_desc_of_prov_disc_req, "pad", 3 ); + _rtw_memcpy( pwdinfo->rx_prov_disc_info.strconfig_method_desc_of_prov_disc_req, "pad", 3 ); } else { - _rtw_memcpy( pwdinfo->rx_prov_disc_info.strconfig_method_desc_of_prov_disc_req, "pbc", 3 ); + _rtw_memcpy( pwdinfo->rx_prov_disc_info.strconfig_method_desc_of_prov_disc_req, "pbc", 3 ); } } @@ -3344,7 +3344,7 @@ static void issue_p2p_GO_response(struct adapter *padapter, u8* raddr, u8* frame // Value: p2pie[ p2pielen++ ] = result; - + // P2P Capability // Type: p2pie[ p2pielen++ ] = P2P_ATTR_CAPABILITY; @@ -3368,7 +3368,7 @@ static void issue_p2p_GO_response(struct adapter *padapter, u8* raddr, u8* frame // Be group owner or meet the error case p2pie[ p2pielen++ ] = DMP_P2P_DEVCAP_SUPPORT; } - + // Group Capability Bitmap, 1 byte if ( pwdinfo->persistent_supported ) { @@ -3424,7 +3424,7 @@ static void issue_p2p_GO_response(struct adapter *padapter, u8* raddr, u8* frame // Country String p2pie[ p2pielen++ ] = 'X'; p2pie[ p2pielen++ ] = 'X'; - + // The third byte should be set to 0x04. // Described in the "Operating Channel Attribute" section. p2pie[ p2pielen++ ] = 0x04; @@ -3445,11 +3445,11 @@ static void issue_p2p_GO_response(struct adapter *padapter, u8* raddr, u8* frame // Operating Class p2pie[ p2pielen++ ] = 0x7c; } - + // Channel Number p2pie[ p2pielen++ ] = pwdinfo->operating_channel; // operating channel number - // Intended P2P Interface Address + // Intended P2P Interface Address // Type: p2pie[ p2pielen++ ] = P2P_ATTR_INTENTED_IF_ADDR; @@ -3492,7 +3492,7 @@ static void issue_p2p_GO_response(struct adapter *padapter, u8* raddr, u8* frame // Country String p2pie[ p2pielen++ ] = 'X'; p2pie[ p2pielen++ ] = 'X'; - + // The third byte should be set to 0x04. // Described in the "Operating Channel Attribute" section. p2pie[ p2pielen++ ] = 0x04; @@ -3502,7 +3502,7 @@ static void issue_p2p_GO_response(struct adapter *padapter, u8* raddr, u8* frame #ifdef CONFIG_CONCURRENT_MODE if ( check_buddy_fwstate(padapter, _FW_LINKED ) ) { - struct adapter *pbuddy_adapter = padapter->pbuddy_adapter; + struct adapter *pbuddy_adapter = padapter->pbuddy_adapter; struct mlme_ext_priv *pbuddy_mlmeext = &pbuddy_adapter->mlmeextpriv; // Operating Class @@ -3563,13 +3563,13 @@ static void issue_p2p_GO_response(struct adapter *padapter, u8* raddr, u8* frame } #endif // CONFIG_CONCURRENT_MODE - + // Device Info // Type: p2pie[ p2pielen++ ] = P2P_ATTR_DEVICE_INFO; // Length: - // 21 -> P2P Device Address (6bytes) + Config Methods (2bytes) + Primary Device Type (8bytes) + // 21 -> P2P Device Address (6bytes) + Config Methods (2bytes) + Primary Device Type (8bytes) // + NumofSecondDevType (1byte) + WPS Device Name ID field (2bytes) + WPS Device Name Len field (2bytes) *(__le16*) ( p2pie + p2pielen ) = cpu_to_le16( 21 + pwdinfo->device_name_len ); p2pielen += 2; @@ -3613,8 +3613,8 @@ static void issue_p2p_GO_response(struct adapter *padapter, u8* raddr, u8* frame // Value: _rtw_memcpy( p2pie + p2pielen, pwdinfo->device_name , pwdinfo->device_name_len ); - p2pielen += pwdinfo->device_name_len; - + p2pielen += pwdinfo->device_name_len; + if ( rtw_p2p_chk_role(pwdinfo, P2P_ROLE_GO) ) { // Group ID Attribute @@ -3633,11 +3633,11 @@ static void issue_p2p_GO_response(struct adapter *padapter, u8* raddr, u8* frame // SSID _rtw_memcpy( p2pie + p2pielen, pwdinfo->nego_ssid, pwdinfo->nego_ssidlen ); p2pielen += pwdinfo->nego_ssidlen; - + } - - pframe = rtw_set_ie(pframe, _VENDOR_SPECIFIC_IE_, p2pielen, (unsigned char *) p2pie, &pattrib->pktlen ); - + + pframe = rtw_set_ie(pframe, _VENDOR_SPECIFIC_IE_, p2pielen, (unsigned char *) p2pie, &pattrib->pktlen ); + #ifdef CONFIG_WFD wfdielen = build_nego_resp_wfd_ie(pwdinfo, pframe); pframe += wfdielen; @@ -3661,7 +3661,7 @@ static void issue_p2p_GO_confirm(struct adapter *padapter, u8* raddr, u8 result) u8 oui_subtype = P2P_GO_NEGO_CONF; u8 wpsie[ 255 ] = { 0x00 }, p2pie[ 255 ] = { 0x00 }; u8 wpsielen = 0, p2pielen = 0; - + struct xmit_frame *pmgntframe; struct pkt_attrib *pattrib; unsigned char *pframe; @@ -3707,10 +3707,10 @@ static void issue_p2p_GO_confirm(struct adapter *padapter, u8* raddr, u8 result) pframe = rtw_set_fixed_ie(pframe, 1, &(category), &(pattrib->pktlen)); pframe = rtw_set_fixed_ie(pframe, 1, &(action), &(pattrib->pktlen)); pframe = rtw_set_fixed_ie(pframe, 4, (unsigned char *) &(p2poui), &(pattrib->pktlen)); - pframe = rtw_set_fixed_ie(pframe, 1, &(oui_subtype), &(pattrib->pktlen)); + pframe = rtw_set_fixed_ie(pframe, 1, &(oui_subtype), &(pattrib->pktlen)); pframe = rtw_set_fixed_ie(pframe, 1, &(pwdinfo->negotiation_dialog_token), &(pattrib->pktlen)); - + // P2P IE Section. @@ -3751,7 +3751,7 @@ static void issue_p2p_GO_confirm(struct adapter *padapter, u8* raddr, u8 result) // Value: // Device Capability Bitmap, 1 byte p2pie[ p2pielen++ ] = DMP_P2P_DEVCAP_SUPPORT; - + // Group Capability Bitmap, 1 byte if ( pwdinfo->persistent_supported ) { @@ -3775,7 +3775,7 @@ static void issue_p2p_GO_confirm(struct adapter *padapter, u8* raddr, u8 result) // Country String p2pie[ p2pielen++ ] = 'X'; p2pie[ p2pielen++ ] = 'X'; - + // The third byte should be set to 0x04. // Described in the "Operating Channel Attribute" section. p2pie[ p2pielen++ ] = 0x04; @@ -3798,7 +3798,7 @@ static void issue_p2p_GO_confirm(struct adapter *padapter, u8* raddr, u8 result) // Operating Class p2pie[ p2pielen++ ] = 0x7c; } - + p2pie[ p2pielen++ ] = pwdinfo->peer_operating_ch; } else @@ -3818,7 +3818,7 @@ static void issue_p2p_GO_confirm(struct adapter *padapter, u8* raddr, u8 result) // Operating Class p2pie[ p2pielen++ ] = 0x7c; } - + // Channel Number p2pie[ p2pielen++ ] = pwdinfo->operating_channel; // Use the listen channel as the operating channel } @@ -3834,7 +3834,7 @@ static void issue_p2p_GO_confirm(struct adapter *padapter, u8* raddr, u8 result) // Country String p2pie[ p2pielen++ ] = 'X'; p2pie[ p2pielen++ ] = 'X'; - + // The third byte should be set to 0x04. // Described in the "Operating Channel Attribute" section. p2pie[ p2pielen++ ] = 0x04; @@ -3877,7 +3877,7 @@ static void issue_p2p_GO_confirm(struct adapter *padapter, u8* raddr, u8 result) // Operating Class p2pie[ p2pielen++ ] = 0x7c; } - + // Channel Number p2pie[ p2pielen++ ] = 1; p2pie[ p2pielen++ ] = pwdinfo->operating_channel; // Use the listen channel as the operating channel @@ -3902,9 +3902,9 @@ static void issue_p2p_GO_confirm(struct adapter *padapter, u8* raddr, u8 result) _rtw_memcpy( p2pie + p2pielen, pwdinfo->nego_ssid, pwdinfo->nego_ssidlen ); p2pielen += pwdinfo->nego_ssidlen; } - + pframe = rtw_set_ie(pframe, _VENDOR_SPECIFIC_IE_, p2pielen, (unsigned char *) p2pie, &pattrib->pktlen ); - + #ifdef CONFIG_WFD wfdielen = build_nego_confirm_wfd_ie(pwdinfo, pframe); pframe += wfdielen; @@ -3930,7 +3930,7 @@ void issue_p2p_invitation_request(struct adapter *padapter, u8* raddr ) u8 p2pielen = 0, i; u8 dialogToken = 3; u8 channel_cnt_24g = 0, channel_cnt_5gl = 0, channel_cnt_5gh = 0; - u16 len_channellist_attr = 0; + u16 len_channellist_attr = 0; #ifdef CONFIG_WFD u32 wfdielen = 0; #endif //CONFIG_WFD @@ -3981,7 +3981,7 @@ void issue_p2p_invitation_request(struct adapter *padapter, u8* raddr ) pframe = rtw_set_fixed_ie(pframe, 1, &(category), &(pattrib->pktlen)); pframe = rtw_set_fixed_ie(pframe, 1, &(action), &(pattrib->pktlen)); pframe = rtw_set_fixed_ie(pframe, 4, (unsigned char *) &(p2poui), &(pattrib->pktlen)); - pframe = rtw_set_fixed_ie(pframe, 1, &(oui_subtype), &(pattrib->pktlen)); + pframe = rtw_set_fixed_ie(pframe, 1, &(oui_subtype), &(pattrib->pktlen)); pframe = rtw_set_fixed_ie(pframe, 1, &(dialogToken), &(pattrib->pktlen)); // P2P IE Section. @@ -4039,7 +4039,7 @@ void issue_p2p_invitation_request(struct adapter *padapter, u8* raddr ) // Country String p2pie[ p2pielen++ ] = 'X'; p2pie[ p2pielen++ ] = 'X'; - + // The third byte should be set to 0x04. // Described in the "Operating Channel Attribute" section. p2pie[ p2pielen++ ] = 0x04; @@ -4051,7 +4051,7 @@ void issue_p2p_invitation_request(struct adapter *padapter, u8* raddr ) p2pie[ p2pielen++ ] = 0x73; else p2pie[ p2pielen++ ] = 0x7c; - + // Channel Number p2pie[ p2pielen++ ] = pwdinfo->invitereq_info.operating_ch; // operating channel number @@ -4075,7 +4075,7 @@ void issue_p2p_invitation_request(struct adapter *padapter, u8* raddr ) // Type: p2pie[ p2pielen++ ] = P2P_ATTR_CH_LIST; - + // Length: // Country String(3) // + ( Operating Class (1) + Number of Channels(1) ) * Operation Classes (?) @@ -4104,7 +4104,7 @@ void issue_p2p_invitation_request(struct adapter *padapter, u8* raddr ) // Country String p2pie[ p2pielen++ ] = 'X'; p2pie[ p2pielen++ ] = 'X'; - + // The third byte should be set to 0x04. // Described in the "Operating Channel Attribute" section. p2pie[ p2pielen++ ] = 0x04; @@ -4113,7 +4113,7 @@ void issue_p2p_invitation_request(struct adapter *padapter, u8* raddr ) #ifdef CONFIG_CONCURRENT_MODE if ( check_buddy_fwstate(padapter, _FW_LINKED ) ) { - struct adapter *pbuddy_adapter = padapter->pbuddy_adapter; + struct adapter *pbuddy_adapter = padapter->pbuddy_adapter; struct mlme_ext_priv *pbuddy_mlmeext = &pbuddy_adapter->mlmeextpriv; // Operating Class @@ -4191,18 +4191,18 @@ void issue_p2p_invitation_request(struct adapter *padapter, u8* raddr ) // SSID _rtw_memcpy( p2pie + p2pielen, pwdinfo->invitereq_info.go_ssid, pwdinfo->invitereq_info.ssidlen ); p2pielen += pwdinfo->invitereq_info.ssidlen; - + // Device Info // Type: p2pie[ p2pielen++ ] = P2P_ATTR_DEVICE_INFO; // Length: - // 21 -> P2P Device Address (6bytes) + Config Methods (2bytes) + Primary Device Type (8bytes) + // 21 -> P2P Device Address (6bytes) + Config Methods (2bytes) + Primary Device Type (8bytes) // + NumofSecondDevType (1byte) + WPS Device Name ID field (2bytes) + WPS Device Name Len field (2bytes) *(__le16*) ( p2pie + p2pielen ) = cpu_to_le16( 21 + pwdinfo->device_name_len ); p2pielen += 2; - + // Value: // P2P Device Address _rtw_memcpy( p2pie + p2pielen, myid( &padapter->eeprompriv ), ETH_ALEN ); @@ -4241,14 +4241,14 @@ void issue_p2p_invitation_request(struct adapter *padapter, u8* raddr ) // Value: _rtw_memcpy( p2pie + p2pielen, pwdinfo->device_name, pwdinfo->device_name_len ); p2pielen += pwdinfo->device_name_len; - - pframe = rtw_set_ie(pframe, _VENDOR_SPECIFIC_IE_, p2pielen, (unsigned char *) p2pie, &pattrib->pktlen ); + + pframe = rtw_set_ie(pframe, _VENDOR_SPECIFIC_IE_, p2pielen, (unsigned char *) p2pie, &pattrib->pktlen ); #ifdef CONFIG_WFD wfdielen = build_invitation_req_wfd_ie(pwdinfo, pframe); pframe += wfdielen; pattrib->pktlen += wfdielen; -#endif //CONFIG_WFD +#endif //CONFIG_WFD pattrib->last_txcmdsz = pattrib->pktlen; @@ -4274,11 +4274,11 @@ void issue_p2p_invitation_response(struct adapter *padapter, u8* raddr, u8 dialo struct wifidirect_info *pbuddy_wdinfo = &pbuddy_adapter->wdinfo; struct mlme_priv *pbuddy_mlmepriv = &pbuddy_adapter->mlmepriv; struct mlme_ext_priv *pbuddy_mlmeext = &pbuddy_adapter->mlmeextpriv; -#endif +#endif #ifdef CONFIG_WFD u32 wfdielen = 0; #endif //CONFIG_WFD - + struct xmit_frame *pmgntframe; struct pkt_attrib *pattrib; unsigned char *pframe; @@ -4321,7 +4321,7 @@ void issue_p2p_invitation_response(struct adapter *padapter, u8* raddr, u8 dialo pframe = rtw_set_fixed_ie(pframe, 1, &(category), &(pattrib->pktlen)); pframe = rtw_set_fixed_ie(pframe, 1, &(action), &(pattrib->pktlen)); pframe = rtw_set_fixed_ie(pframe, 4, (unsigned char *) &(p2poui), &(pattrib->pktlen)); - pframe = rtw_set_fixed_ie(pframe, 1, &(oui_subtype), &(pattrib->pktlen)); + pframe = rtw_set_fixed_ie(pframe, 1, &(oui_subtype), &(pattrib->pktlen)); pframe = rtw_set_fixed_ie(pframe, 1, &(dialogToken), &(pattrib->pktlen)); // P2P IE Section. @@ -4357,7 +4357,7 @@ void issue_p2p_invitation_response(struct adapter *padapter, u8* raddr, u8 dialo // If the UI found the corresponding profile, the WiFi driver sends the P2P Invitation Req // to NB to rebuild the persistent group. p2pie[ p2pielen++ ] = status_code; - + // Configuration Timeout // Type: p2pie[ p2pielen++ ] = P2P_ATTR_CONF_TIMEOUT; @@ -4391,17 +4391,17 @@ void issue_p2p_invitation_response(struct adapter *padapter, u8* raddr, u8 dialo // Country String p2pie[ p2pielen++ ] = 'X'; p2pie[ p2pielen++ ] = 'X'; - + // The third byte should be set to 0x04. // Described in the "Operating Channel Attribute" section. p2pie[ p2pielen++ ] = 0x04; // Operating Class p2pie[ p2pielen++ ] = 0x51; // Copy from SD7 - + // Channel Number p2pie[ p2pielen++ ] = pwdinfo->operating_channel; // operating channel number - + // P2P Group BSSID // Type: @@ -4459,7 +4459,7 @@ void issue_p2p_invitation_response(struct adapter *padapter, u8* raddr, u8 dialo #ifdef CONFIG_CONCURRENT_MODE if ( check_buddy_fwstate(padapter, _FW_LINKED ) ) { - struct adapter *pbuddy_adapter = padapter->pbuddy_adapter; + struct adapter *pbuddy_adapter = padapter->pbuddy_adapter; struct mlme_ext_priv *pbuddy_mlmeext = &pbuddy_adapter->mlmeextpriv; // Operating Class @@ -4520,9 +4520,9 @@ void issue_p2p_invitation_response(struct adapter *padapter, u8* raddr, u8 dialo } #endif // CONFIG_CONCURRENT_MODE } - - pframe = rtw_set_ie(pframe, _VENDOR_SPECIFIC_IE_, p2pielen, (unsigned char *) p2pie, &pattrib->pktlen ); - + + pframe = rtw_set_ie(pframe, _VENDOR_SPECIFIC_IE_, p2pielen, (unsigned char *) p2pie, &pattrib->pktlen ); + #ifdef CONFIG_WFD wfdielen = build_invitation_resp_wfd_ie(pwdinfo, pframe); pframe += wfdielen; @@ -4549,8 +4549,8 @@ void issue_p2p_provision_request(struct adapter *padapter, u8* pssid, u8 ussidle u32 p2pielen = 0; #ifdef CONFIG_WFD u32 wfdielen = 0; -#endif //CONFIG_WFD - +#endif //CONFIG_WFD + struct xmit_frame *pmgntframe; struct pkt_attrib *pattrib; unsigned char *pframe; @@ -4594,8 +4594,8 @@ void issue_p2p_provision_request(struct adapter *padapter, u8* pssid, u8 ussidle pframe = rtw_set_fixed_ie(pframe, 1, &(category), &(pattrib->pktlen)); pframe = rtw_set_fixed_ie(pframe, 1, &(action), &(pattrib->pktlen)); pframe = rtw_set_fixed_ie(pframe, 4, (unsigned char *) &(p2poui), &(pattrib->pktlen)); - pframe = rtw_set_fixed_ie(pframe, 1, &(oui_subtype), &(pattrib->pktlen)); - pframe = rtw_set_fixed_ie(pframe, 1, &(dialogToken), &(pattrib->pktlen)); + pframe = rtw_set_fixed_ie(pframe, 1, &(oui_subtype), &(pattrib->pktlen)); + pframe = rtw_set_fixed_ie(pframe, 1, &(dialogToken), &(pattrib->pktlen)); p2pielen = build_prov_disc_request_p2p_ie( pwdinfo, pframe, pssid, ussidlen, pdev_raddr ); @@ -4655,12 +4655,12 @@ static u8 is_matched_in_profilelist( u8* peermacaddr, struct profile_info* profi u8 i, match_result = 0; DBG_871X( "[%s] peermac = %.2X %.2X %.2X %.2X %.2X %.2X\n", __FUNCTION__, - peermacaddr[0], peermacaddr[1],peermacaddr[2],peermacaddr[3],peermacaddr[4],peermacaddr[5]); - + peermacaddr[0], peermacaddr[1],peermacaddr[2],peermacaddr[3],peermacaddr[4],peermacaddr[5]); + for( i = 0; i < P2P_MAX_PERSISTENT_GROUP_NUM; i++, profileinfo++ ) { DBG_871X( "[%s] profileinfo_mac = %.2X %.2X %.2X %.2X %.2X %.2X\n", __FUNCTION__, - profileinfo->peermac[0], profileinfo->peermac[1],profileinfo->peermac[2],profileinfo->peermac[3],profileinfo->peermac[4],profileinfo->peermac[5]); + profileinfo->peermac[0], profileinfo->peermac[1],profileinfo->peermac[2],profileinfo->peermac[3],profileinfo->peermac[4],profileinfo->peermac[5]); if ( _rtw_memcmp( peermacaddr, profileinfo->peermac, ETH_ALEN ) ) { match_result = 1; @@ -4668,7 +4668,7 @@ static u8 is_matched_in_profilelist( u8* peermacaddr, struct profile_info* profi break; } } - + return (match_result ); } @@ -4678,13 +4678,13 @@ void issue_probersp_p2p(struct adapter *padapter, unsigned char *da) struct pkt_attrib *pattrib; unsigned char *pframe; struct rtw_ieee80211_hdr *pwlanhdr; - __le16 *fctrl; + __le16 *fctrl; unsigned char *mac; struct xmit_priv *pxmitpriv = &(padapter->xmitpriv); struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); - //WLAN_BSSID_EX *cur_network = &(pmlmeinfo->network); + //WLAN_BSSID_EX *cur_network = &(pmlmeinfo->network); u16 beacon_interval = 100; u16 capInfo = 0; struct wifidirect_info *pwdinfo = &(padapter->wdinfo); @@ -4698,35 +4698,35 @@ void issue_probersp_p2p(struct adapter *padapter, unsigned char *da) #endif //CONFIG_INTEL_WIDI //DBG_871X("%s\n", __FUNCTION__); - + if ((pmgntframe = alloc_mgtxmitframe(pxmitpriv)) == NULL) { return; } - + //update attribute pattrib = &pmgntframe->attrib; - update_mgntframe_attrib(padapter, pattrib); - + update_mgntframe_attrib(padapter, pattrib); + _rtw_memset(pmgntframe->buf_addr, 0, WLANHDR_OFFSET + TXDESC_OFFSET); - + pframe = (u8 *)(pmgntframe->buf_addr) + TXDESC_OFFSET; - pwlanhdr = (struct rtw_ieee80211_hdr *)pframe; - + pwlanhdr = (struct rtw_ieee80211_hdr *)pframe; + mac = myid(&(padapter->eeprompriv)); - + fctrl = &(pwlanhdr->frame_ctl); *(fctrl) = 0; _rtw_memcpy(pwlanhdr->addr1, da, ETH_ALEN); _rtw_memcpy(pwlanhdr->addr2, mac, ETH_ALEN); - - // Use the device address for BSSID field. + + // Use the device address for BSSID field. _rtw_memcpy(pwlanhdr->addr3, mac, ETH_ALEN); SetSeqNum(pwlanhdr, pmlmeext->mgnt_seq); pmlmeext->mgnt_seq++; SetFrameSubType(fctrl, WIFI_PROBERSP); - + pattrib->hdrlen = sizeof(struct rtw_ieee80211_hdr_3addr); pattrib->pktlen = pattrib->hdrlen; pframe += pattrib->hdrlen; @@ -4736,7 +4736,7 @@ void issue_probersp_p2p(struct adapter *padapter, unsigned char *da) pattrib->pktlen += 8; // beacon interval: 2 bytes - _rtw_memcpy(pframe, (unsigned char *) &beacon_interval, 2); + _rtw_memcpy(pframe, (unsigned char *) &beacon_interval, 2); pframe += 2; pattrib->pktlen += 2; @@ -4744,7 +4744,7 @@ void issue_probersp_p2p(struct adapter *padapter, unsigned char *da) // ESS and IBSS bits must be 0 (defined in the 3.1.2.1.1 of WiFi Direct Spec) capInfo |= cap_ShortPremble; capInfo |= cap_ShortSlot; - + _rtw_memcpy(pframe, (unsigned char *) &capInfo, 2); pframe += 2; pattrib->pktlen += 2; @@ -4777,7 +4777,7 @@ void issue_probersp_p2p(struct adapter *padapter, unsigned char *da) } } else -#endif //CONFIG_IOCTL_CFG80211 +#endif //CONFIG_IOCTL_CFG80211 { // Todo: WPS IE @@ -4804,7 +4804,7 @@ void issue_probersp_p2p(struct adapter *padapter, unsigned char *da) #ifdef CONFIG_INTEL_WIDI // Commented by Kurt // Appended WiDi info. only if we did issued_probereq_widi(), and then we saved ven. ext. in pmlmepriv->sa_ext. - if( _rtw_memcmp(pmlmepriv->sa_ext, zero_array_check, L2SDTA_SERVICE_VE_LEN) == _FALSE + if( _rtw_memcmp(pmlmepriv->sa_ext, zero_array_check, L2SDTA_SERVICE_VE_LEN) == _FALSE || pmlmepriv->num_p2p_sdt != 0 ) { //Sec dev type @@ -4898,7 +4898,7 @@ void issue_probersp_p2p(struct adapter *padapter, unsigned char *da) // Length: *(__be16*) ( wpsie + wpsielen ) = cpu_to_be16( 0x0006 ); - wpsielen += 2; + wpsielen += 2; // Value: _rtw_memcpy( wpsie + wpsielen, "8192CU", 6 ); @@ -4979,10 +4979,10 @@ void issue_probersp_p2p(struct adapter *padapter, unsigned char *da) // Value: *(__be16*) ( wpsie + wpsielen ) = cpu_to_be16( pwdinfo->supported_wps_cm ); wpsielen += 2; - + pframe = rtw_set_ie(pframe, _VENDOR_SPECIFIC_IE_, wpsielen, (unsigned char *) wpsie, &pattrib->pktlen ); - + p2pielen = build_probe_resp_p2p_ie(pwdinfo, pframe); pframe += p2pielen; @@ -5004,16 +5004,16 @@ void issue_probersp_p2p(struct adapter *padapter, unsigned char *da) //WFD IE _rtw_memcpy(pframe, pmlmepriv->wfd_probe_resp_ie, pmlmepriv->wfd_probe_resp_ie_len); pattrib->pktlen += pmlmepriv->wfd_probe_resp_ie_len; - pframe += pmlmepriv->wfd_probe_resp_ie_len; + pframe += pmlmepriv->wfd_probe_resp_ie_len; } #endif //CONFIG_IOCTL_CFG80211 -#endif //CONFIG_WFD +#endif //CONFIG_WFD pattrib->last_txcmdsz = pattrib->pktlen; - + dump_mgntframe(padapter, pmgntframe); - + return; } @@ -5033,15 +5033,15 @@ static int _issue_probereq_p2p(struct adapter *padapter, u8 *da, int wait_ack) struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); int bssrate_len = 0; u8 bc_addr[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; - struct wifidirect_info *pwdinfo = &(padapter->wdinfo); + struct wifidirect_info *pwdinfo = &(padapter->wdinfo); u8 wpsie[255] = { 0x00 }, p2pie[ 255 ] = { 0x00 }; u16 wpsielen = 0, p2pielen = 0; #ifdef CONFIG_WFD u32 wfdielen = 0; #endif //CONFIG_WFD - + struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); - + if ((pmgntframe = alloc_mgtxmitframe(pxmitpriv)) == NULL) { @@ -5221,10 +5221,10 @@ static int _issue_probereq_p2p(struct adapter *padapter, u8 *da, int wait_ack) // Value: *(__be16*) ( wpsie + wpsielen ) = cpu_to_be16( WPS_DPID_REGISTRAR_SPEC ); // Registrar-specified - wpsielen += 2; + wpsielen += 2; pframe = rtw_set_ie(pframe, _VENDOR_SPECIFIC_IE_, wpsielen, (unsigned char *) wpsie, &pattrib->pktlen ); - + // P2P OUI p2pielen = 0; p2pie[ p2pielen++ ] = 0x50; @@ -5251,7 +5251,7 @@ static int _issue_probereq_p2p(struct adapter *padapter, u8 *da, int wait_ack) // Value: // Device Capability Bitmap, 1 byte p2pie[ p2pielen++ ] = DMP_P2P_DEVCAP_SUPPORT; - + // Group Capability Bitmap, 1 byte if ( pwdinfo->persistent_supported ) p2pie[ p2pielen++ ] = P2P_GRPCAP_PERSISTENT_GROUP | DMP_P2P_GRPCAP_SUPPORT; @@ -5270,17 +5270,17 @@ static int _issue_probereq_p2p(struct adapter *padapter, u8 *da, int wait_ack) // Country String p2pie[ p2pielen++ ] = 'X'; p2pie[ p2pielen++ ] = 'X'; - + // The third byte should be set to 0x04. // Described in the "Operating Channel Attribute" section. p2pie[ p2pielen++ ] = 0x04; // Operating Class p2pie[ p2pielen++ ] = 0x51; // Copy from SD7 - + // Channel Number p2pie[ p2pielen++ ] = pwdinfo->listen_channel; // listen channel - + // Extended Listen Timing // Type: @@ -5313,20 +5313,20 @@ static int _issue_probereq_p2p(struct adapter *padapter, u8 *da, int wait_ack) // Country String p2pie[ p2pielen++ ] = 'X'; p2pie[ p2pielen++ ] = 'X'; - + // The third byte should be set to 0x04. // Described in the "Operating Channel Attribute" section. p2pie[ p2pielen++ ] = 0x04; // Operating Class p2pie[ p2pielen++ ] = 0x51; // Copy from SD7 - + // Channel Number p2pie[ p2pielen++ ] = pwdinfo->operating_channel; // operating channel number - - } - pframe = rtw_set_ie(pframe, _VENDOR_SPECIFIC_IE_, p2pielen, (unsigned char *) p2pie, &pattrib->pktlen ); + } + + pframe = rtw_set_ie(pframe, _VENDOR_SPECIFIC_IE_, p2pielen, (unsigned char *) p2pie, &pattrib->pktlen ); if( pmlmepriv->wps_probe_req_ie != NULL ) { @@ -5347,12 +5347,12 @@ static int _issue_probereq_p2p(struct adapter *padapter, u8 *da, int wait_ack) pattrib->pktlen += wfdielen; } #ifdef CONFIG_IOCTL_CFG80211 - else if (pmlmepriv->wfd_probe_req_ie != NULL && pmlmepriv->wfd_probe_req_ie_len>0) + else if (pmlmepriv->wfd_probe_req_ie != NULL && pmlmepriv->wfd_probe_req_ie_len>0) { //WFD IE _rtw_memcpy(pframe, pmlmepriv->wfd_probe_req_ie, pmlmepriv->wfd_probe_req_ie_len); pattrib->pktlen += pmlmepriv->wfd_probe_req_ie_len; - pframe += pmlmepriv->wfd_probe_req_ie_len; + pframe += pmlmepriv->wfd_probe_req_ie_len; } #endif //CONFIG_IOCTL_CFG80211 #endif //CONFIG_WFD @@ -5427,7 +5427,7 @@ static s32 rtw_action_public_decache(union recv_frame *recv_frame, s32 token) u8 *frame = recv_frame->u.hdr.rx_data; u16 seq_ctrl = ( (recv_frame->u.hdr.attrib.seq_num&0xffff) << 4) | (recv_frame->u.hdr.attrib.frag_num & 0xf); - + if (GetRetry(frame)) { if (token >= 0) { if ((seq_ctrl == mlmeext->action_public_rxseq) @@ -5445,9 +5445,9 @@ static s32 rtw_action_public_decache(union recv_frame *recv_frame, s32 token) } } } - + mlmeext->action_public_rxseq = seq_ctrl; - + if (token >= 0) mlmeext->action_public_dialog_token = token; @@ -5477,7 +5477,7 @@ static unsigned int on_action_public_p2p(union recv_frame *precv_frame) if (rtw_action_public_decache(precv_frame, dialogToken) == _FAIL) return _FAIL; - + #ifdef CONFIG_P2P _cancel_timer_ex( &pwdinfo->reset_ch_sitesurvey ); #ifdef CONFIG_IOCTL_CFG80211 @@ -5513,8 +5513,8 @@ static unsigned int on_action_public_p2p(union recv_frame *precv_frame) _cancel_timer_ex( &pwdinfo->restore_p2p_state_timer ); // Restore the previous p2p state rtw_p2p_set_state(pwdinfo, rtw_p2p_pre_state(pwdinfo)); - DBG_871X( "[%s] Restore the previous p2p state to %d\n", __FUNCTION__, rtw_p2p_state(pwdinfo) ); - } + DBG_871X( "[%s] Restore the previous p2p state to %d\n", __FUNCTION__, rtw_p2p_state(pwdinfo) ); + } #ifdef CONFIG_CONCURRENT_MODE if ( check_buddy_fwstate(padapter, _FW_LINKED ) ) { @@ -5551,7 +5551,7 @@ static unsigned int on_action_public_p2p(union recv_frame *precv_frame) #else // CONFIG_CONCURRENT_MODE _set_timer( &pwdinfo->restore_p2p_state_timer, 5000 ); #endif // CONFIG_CONCURRENT_MODE - break; + break; } case P2P_GO_NEGO_RESP: { @@ -5592,7 +5592,7 @@ static unsigned int on_action_public_p2p(union recv_frame *precv_frame) { DBG_871X( "[%s] Skipped GO Nego Resp Frame (p2p_state != P2P_STATE_GONEGO_ING)\n", __FUNCTION__); } - + break; } case P2P_GO_NEGO_CONF: @@ -5619,7 +5619,7 @@ static unsigned int on_action_public_p2p(union recv_frame *precv_frame) { // Added by Albert 2010/10/05 // Received the P2P Invite Request frame. - + DBG_871X( "[%s] Got invite request frame!\n", __FUNCTION__ ); if ( (p2p_ie=rtw_get_p2p_ie( frame_body + _PUBLIC_ACTION_IE_OFFSET_, len - _PUBLIC_ACTION_IE_OFFSET_, NULL, &p2p_ielen)) ) { @@ -5639,7 +5639,7 @@ static unsigned int on_action_public_p2p(union recv_frame *precv_frame) DBG_871X( "[%s] Malloc p2p ie fail\n", __FUNCTION__); goto exit; } - _rtw_memset(merged_p2pie, 0x00, merged_p2p_ielen); + _rtw_memset(merged_p2pie, 0x00, merged_p2p_ielen); merged_p2p_ielen = rtw_p2p_merge_ies(frame_body + _PUBLIC_ACTION_IE_OFFSET_, len - _PUBLIC_ACTION_IE_OFFSET_, merged_p2pie); @@ -5660,12 +5660,12 @@ static unsigned int on_action_public_p2p(union recv_frame *precv_frame) pwdinfo->p2p_peer_interface_addr[0], pwdinfo->p2p_peer_interface_addr[1], pwdinfo->p2p_peer_interface_addr[2], pwdinfo->p2p_peer_interface_addr[3], pwdinfo->p2p_peer_interface_addr[4], pwdinfo->p2p_peer_interface_addr[5] ); - } + } if ( invitation_flag & P2P_INVITATION_FLAGS_PERSISTENT ) { // Re-invoke the persistent group. - + _rtw_memset( &group_id, 0x00, sizeof( struct group_id_info ) ); rtw_get_p2p_attr_content( merged_p2pie, merged_p2p_ielen, P2P_ATTR_GROUP_ID, ( u8* ) &group_id, &attr_contentlen); if ( attr_contentlen ) @@ -5718,7 +5718,7 @@ static unsigned int on_action_public_p2p(union recv_frame *precv_frame) rtw_p2p_set_state(pwdinfo, P2P_STATE_RECV_INVITE_REQ_MATCH ); rtw_p2p_set_role( pwdinfo, P2P_ROLE_CLIENT ); status_code = P2P_STATUS_SUCCESS; - } + } } else { @@ -5736,7 +5736,7 @@ static unsigned int on_action_public_p2p(union recv_frame *precv_frame) { DBG_871X( "[%s] P2P Group ID Attribute NOT FOUND!\n", __FUNCTION__ ); status_code = P2P_STATUS_FAIL_INFO_UNAVAILABLE; - } + } } else { @@ -5760,7 +5760,7 @@ static unsigned int on_action_public_p2p(union recv_frame *precv_frame) // The peer device address should be the destination address for the provisioning discovery request. // Then, this Wi-Fi device should use the iwpriv command to get the peer interface address. // The peer interface address should be the address for WPS mac address - _rtw_memcpy( pwdinfo->p2p_peer_device_addr, group_id.go_device_addr , ETH_ALEN ); + _rtw_memcpy( pwdinfo->p2p_peer_device_addr, group_id.go_device_addr , ETH_ALEN ); rtw_p2p_set_role( pwdinfo, P2P_ROLE_CLIENT ); rtw_p2p_set_state(pwdinfo, P2P_STATE_RECV_INVITE_REQ_JOIN ); status_code = P2P_STATUS_SUCCESS; @@ -5777,7 +5777,7 @@ static unsigned int on_action_public_p2p(union recv_frame *precv_frame) { DBG_871X( "[%s] P2P Invitation Flags Attribute NOT FOUND!\n", __FUNCTION__ ); status_code = P2P_STATUS_FAIL_INFO_UNAVAILABLE; - } + } DBG_871X( "[%s] status_code = %d\n", __FUNCTION__, status_code ); @@ -5799,13 +5799,13 @@ static unsigned int on_action_public_p2p(union recv_frame *precv_frame) { u8 attr_content = 0x00; u32 attr_contentlen = 0; - + DBG_871X( "[%s] Got invite response frame!\n", __FUNCTION__ ); _cancel_timer_ex( &pwdinfo->restore_p2p_state_timer ); if ( (p2p_ie=rtw_get_p2p_ie( frame_body + _PUBLIC_ACTION_IE_OFFSET_, len - _PUBLIC_ACTION_IE_OFFSET_, NULL, &p2p_ielen)) ) { rtw_get_p2p_attr_content(p2p_ie, p2p_ielen, P2P_ATTR_STATUS, &attr_content, &attr_contentlen); - + if ( attr_contentlen == 1 ) { DBG_871X( "[%s] Status = %d\n", __FUNCTION__, attr_content ); @@ -5868,7 +5868,7 @@ static unsigned int on_action_public_p2p(union recv_frame *precv_frame) //Add the following statement to avoid receiving duplicate prov disc req. such that pre_p2p_state would be covered. if(!rtw_p2p_chk_state(pwdinfo, P2P_STATE_RX_PROVISION_DIS_REQ)) rtw_p2p_set_pre_state(pwdinfo, rtw_p2p_state(pwdinfo)); - + rtw_p2p_set_state(pwdinfo, P2P_STATE_RX_PROVISION_DIS_REQ); _set_timer( &pwdinfo->restore_p2p_state_timer, P2P_PROVISION_TIMEOUT ); #ifdef CONFIG_INTEL_WIDI @@ -5943,7 +5943,7 @@ static unsigned int on_action_public_default(union recv_frame *precv_frame, u8 a #endif ret = _SUCCESS; - + exit: return ret; } @@ -5991,9 +5991,9 @@ unsigned int OnAction_sa_query(struct adapter *padapter, union recv_frame *precv struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); unsigned short tid; //Baron - + DBG_871X("OnAction_sa_query\n"); - + switch (pframe[WLAN_HDR_A3_LEN+1]) { case 0: //SA Query req @@ -6016,8 +6016,8 @@ unsigned int OnAction_sa_query(struct adapter *padapter, union recv_frame *precv for(pp=0;pp< pattrib->pkt_len; pp++) printk(" %02x ", pframe[pp]); printk("\n"); - } - + } + return _SUCCESS; } #endif //CONFIG_IEEE80211W @@ -6035,10 +6035,10 @@ unsigned int OnAction_p2p(struct adapter *padapter, union recv_frame *precv_fram u8 *pframe = precv_frame->u.hdr.rx_data; uint len = precv_frame->u.hdr.len; struct wifidirect_info *pwdinfo = &( padapter->wdinfo ); - + DBG_871X("%s\n", __FUNCTION__); - + //check RA matches or not if (!_rtw_memcmp(myid(&(padapter->eeprompriv)), GetAddr1Ptr(pframe), ETH_ALEN))//for if1, sta/ap mode return _SUCCESS; @@ -6068,26 +6068,26 @@ unsigned int OnAction_p2p(struct adapter *padapter, union recv_frame *precv_fram switch(OUI_Subtype) { case P2P_NOTICE_OF_ABSENCE: - + break; - + case P2P_PRESENCE_REQUEST: - process_p2p_presence_req(pwdinfo, pframe, len); - + process_p2p_presence_req(pwdinfo, pframe, len); + break; - + case P2P_PRESENCE_RESPONSE: - + break; - + case P2P_GO_DISC_REQUEST: - + break; - + default: break; - + } } #endif //CONFIG_P2P @@ -6102,19 +6102,19 @@ unsigned int OnAction(struct adapter *padapter, union recv_frame *precv_frame) unsigned char category; struct action_handler *ptable; unsigned char *frame_body; - u8 *pframe = precv_frame->u.hdr.rx_data; + u8 *pframe = precv_frame->u.hdr.rx_data; frame_body = (unsigned char *)(pframe + sizeof(struct rtw_ieee80211_hdr_3addr)); - + category = frame_body[0]; - - for(i = 0; i < sizeof(OnAction_tbl)/sizeof(struct action_handler); i++) + + for(i = 0; i < sizeof(OnAction_tbl)/sizeof(struct action_handler); i++) { ptable = &OnAction_tbl[i]; - + if(category == ptable->num) ptable->func(padapter, precv_frame); - + } return _SUCCESS; @@ -6236,7 +6236,7 @@ s32 dump_mgntframe_and_wait(struct adapter *padapter, struct xmit_frame *pmgntfr { s32 ret = _FAIL; _irqL irqL; - struct xmit_priv *pxmitpriv = &padapter->xmitpriv; + struct xmit_priv *pxmitpriv = &padapter->xmitpriv; struct xmit_buf *pxmitbuf = pmgntframe->pxmitbuf; struct submit_ctx sctx; @@ -6273,14 +6273,14 @@ s32 dump_mgntframe_and_wait_ack(struct adapter *padapter, struct xmit_frame *pmg if (padapter->pbuddy_adapter && !padapter->isprimary) pxmitpriv = &(padapter->pbuddy_adapter->xmitpriv); #endif - + if(padapter->bSurpriseRemoved == _TRUE || padapter->bDriverStopped == _TRUE) { rtw_free_xmitbuf(&padapter->xmitpriv, pmgntframe->pxmitbuf); rtw_free_xmitframe(&padapter->xmitpriv, pmgntframe); return -1; - } + } _enter_critical_mutex(&pxmitpriv->ack_tx_mutex, NULL); pxmitpriv->ack_tx = _TRUE; @@ -6298,7 +6298,7 @@ s32 dump_mgntframe_and_wait_ack(struct adapter *padapter, struct xmit_frame *pmg dump_mgntframe(padapter, pmgntframe); rtw_msleep_os(50); return _SUCCESS; -#endif //!CONFIG_XMIT_ACK +#endif //!CONFIG_XMIT_ACK } static int update_hidden_ssid(u8 *ies, u32 ies_len, u8 hidden_ssid_mode) @@ -6306,11 +6306,11 @@ static int update_hidden_ssid(u8 *ies, u32 ies_len, u8 hidden_ssid_mode) u8 *ssid_ie; sint ssid_len_ori; int len_diff = 0; - + ssid_ie = rtw_get_ie(ies, WLAN_EID_SSID, &ssid_len_ori, ies_len); //DBG_871X("%s hidden_ssid_mode:%u, ssid_ie:%p, ssid_len_ori:%d\n", __FUNCTION__, hidden_ssid_mode, ssid_ie, ssid_len_ori); - + if(ssid_ie && ssid_len_ori>0) { switch(hidden_ssid_mode) @@ -6319,15 +6319,15 @@ static int update_hidden_ssid(u8 *ies, u32 ies_len, u8 hidden_ssid_mode) { u8 *next_ie = ssid_ie + 2 + ssid_len_ori; u32 remain_len = 0; - + remain_len = ies_len -(next_ie-ies); - - ssid_ie[1] = 0; + + ssid_ie[1] = 0; _rtw_memcpy(ssid_ie+2, next_ie, remain_len); len_diff -= ssid_len_ori; - + break; - } + } case 2: _rtw_memset(&ssid_ie[2], 0, ssid_len_ori); break; @@ -6354,7 +6354,7 @@ void issue_beacon(struct adapter *padapter, int timeout_ms) #endif //#if defined (CONFIG_AP_MODE) && defined (CONFIG_NATIVEAP_MLME) struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); - WLAN_BSSID_EX *cur_network = &(pmlmeinfo->network); + WLAN_BSSID_EX *cur_network = &(pmlmeinfo->network); u8 bc_addr[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; #ifdef CONFIG_P2P struct wifidirect_info *pwdinfo = &(padapter->wdinfo); @@ -6376,16 +6376,16 @@ void issue_beacon(struct adapter *padapter, int timeout_ms) pattrib = &pmgntframe->attrib; update_mgntframe_attrib(padapter, pattrib); pattrib->qsel = 0x10; - + _rtw_memset(pmgntframe->buf_addr, 0, WLANHDR_OFFSET + TXDESC_OFFSET); - + pframe = (u8 *)(pmgntframe->buf_addr) + TXDESC_OFFSET; - pwlanhdr = (struct rtw_ieee80211_hdr *)pframe; - - + pwlanhdr = (struct rtw_ieee80211_hdr *)pframe; + + fctrl = &(pwlanhdr->frame_ctl); *(fctrl) = 0; - + _rtw_memcpy(pwlanhdr->addr1, bc_addr, ETH_ALEN); _rtw_memcpy(pwlanhdr->addr2, myid(&(padapter->eeprompriv)), ETH_ALEN); _rtw_memcpy(pwlanhdr->addr3, get_my_bssid(cur_network), ETH_ALEN); @@ -6393,24 +6393,24 @@ void issue_beacon(struct adapter *padapter, int timeout_ms) SetSeqNum(pwlanhdr, 0/*pmlmeext->mgnt_seq*/); //pmlmeext->mgnt_seq++; SetFrameSubType(pframe, WIFI_BEACON); - - pframe += sizeof(struct rtw_ieee80211_hdr_3addr); + + pframe += sizeof(struct rtw_ieee80211_hdr_3addr); pattrib->pktlen = sizeof (struct rtw_ieee80211_hdr_3addr); - + if( (pmlmeinfo->state&0x03) == WIFI_FW_AP_STATE) { //DBG_871X("ie len=%d\n", cur_network->IELength); #ifdef CONFIG_P2P // for P2P : Primary Device Type & Device Name u32 wpsielen=0, insert_len=0; - u8 *wpsie=NULL; + u8 *wpsie=NULL; wpsie = rtw_get_wps_ie(cur_network->IEs+_FIXED_IE_LENGTH_, cur_network->IELength-_FIXED_IE_LENGTH_, NULL, &wpsielen); - + if(rtw_p2p_chk_role(pwdinfo, P2P_ROLE_GO) && wpsie && wpsielen>0) { uint wps_offset, remainder_ielen; u8 *premainder_ie, *pframe_wscie; - + wps_offset = (uint)(wpsie - cur_network->IEs); premainder_ie = wpsie + wpsielen; @@ -6432,7 +6432,7 @@ void issue_beacon(struct adapter *padapter, int timeout_ms) //copy remainder_ie to pframe _rtw_memcpy(pframe, premainder_ie, remainder_ielen); - pframe += remainder_ielen; + pframe += remainder_ielen; pattrib->pktlen += remainder_ielen; } else @@ -6446,8 +6446,8 @@ void issue_beacon(struct adapter *padapter, int timeout_ms) #endif //CONFIG_IOCTL_CFG80211 { pframe_wscie = pframe + wps_offset; - _rtw_memcpy(pframe, cur_network->IEs, wps_offset+wpsielen); - pframe += (wps_offset + wpsielen); + _rtw_memcpy(pframe, cur_network->IEs, wps_offset+wpsielen); + pframe += (wps_offset + wpsielen); pattrib->pktlen += (wps_offset + wpsielen); //now pframe is end of wsc ie, insert Primary Device Type & Device Name @@ -6455,11 +6455,11 @@ void issue_beacon(struct adapter *padapter, int timeout_ms) // Type: *(__be16*) ( pframe + insert_len) = cpu_to_be16( WPS_ATTR_PRIMARY_DEV_TYPE ); insert_len += 2; - + // Length: *(__be16*) ( pframe + insert_len ) = cpu_to_be16( 0x0008 ); insert_len += 2; - + // Value: // Category ID *(__be16*) ( pframe + insert_len ) = cpu_to_be16( WPS_PDT_CID_MULIT_MEDIA ); @@ -6497,7 +6497,7 @@ void issue_beacon(struct adapter *padapter, int timeout_ms) //copy remainder_ie to pframe _rtw_memcpy(pframe, premainder_ie, remainder_ielen); - pframe += remainder_ielen; + pframe += remainder_ielen; pattrib->pktlen += remainder_ielen; } } @@ -6538,7 +6538,7 @@ void issue_beacon(struct adapter *padapter, int timeout_ms) if(wdev_to_priv(padapter->rtw_wdev)->p2p_enabled && pwdinfo->driver_interface == DRIVER_CFG80211 ) { len = pmlmepriv->p2p_beacon_ie_len; - if(pmlmepriv->p2p_beacon_ie && len>0) + if(pmlmepriv->p2p_beacon_ie && len>0) _rtw_memcpy(pframe, pmlmepriv->p2p_beacon_ie, len); } else @@ -6558,14 +6558,14 @@ void issue_beacon(struct adapter *padapter, int timeout_ms) } #ifdef CONFIG_IOCTL_CFG80211 else - { + { len = 0; if(pmlmepriv->wfd_beacon_ie && pmlmepriv->wfd_beacon_ie_len>0) { len = pmlmepriv->wfd_beacon_ie_len; - _rtw_memcpy(pframe, pmlmepriv->wfd_beacon_ie, len); + _rtw_memcpy(pframe, pmlmepriv->wfd_beacon_ie, len); } - } + } #endif //CONFIG_IOCTL_CFG80211 pframe += len; pattrib->pktlen += len; @@ -6585,7 +6585,7 @@ void issue_beacon(struct adapter *padapter, int timeout_ms) // beacon interval: 2 bytes - _rtw_memcpy(pframe, (unsigned char *)(rtw_get_beacon_interval_from_ie(cur_network->IEs)), 2); + _rtw_memcpy(pframe, (unsigned char *)(rtw_get_beacon_interval_from_ie(cur_network->IEs)), 2); pframe += 2; pattrib->pktlen += 2; @@ -6618,7 +6618,7 @@ void issue_beacon(struct adapter *padapter, int timeout_ms) //ERP IE pframe = rtw_set_ie(pframe, _ERPINFO_IE_, 1, &erpinfo, &pattrib->pktlen); - } + } // EXTERNDED SUPPORTED RATE @@ -6634,8 +6634,8 @@ _issue_bcn: #if defined (CONFIG_AP_MODE) && defined (CONFIG_NATIVEAP_MLME) pmlmepriv->update_bcn = _FALSE; - - _exit_critical_bh(&pmlmepriv->bcn_update_lock, &irqL); + + _exit_critical_bh(&pmlmepriv->bcn_update_lock, &irqL); #endif //#if defined (CONFIG_AP_MODE) && defined (CONFIG_NATIVEAP_MLME) if ((pattrib->pktlen + TXDESC_SIZE) > 512) @@ -6643,7 +6643,7 @@ _issue_bcn: DBG_871X("beacon frame too large\n"); return; } - + pattrib->last_txcmdsz = pattrib->pktlen; //DBG_871X("issue bcn_sz=%d\n", pattrib->last_txcmdsz); @@ -6660,7 +6660,7 @@ void issue_probersp(struct adapter *padapter, unsigned char *da, u8 is_valid_p2p struct pkt_attrib *pattrib; unsigned char *pframe; struct rtw_ieee80211_hdr *pwlanhdr; - __le16 *fctrl; + __le16 *fctrl; unsigned char *mac, *bssid; struct xmit_priv *pxmitpriv = &(padapter->xmitpriv); #if defined (CONFIG_AP_MODE) && defined (CONFIG_NATIVEAP_MLME) @@ -6670,7 +6670,7 @@ void issue_probersp(struct adapter *padapter, unsigned char *da, u8 is_valid_p2p #endif //#if defined (CONFIG_AP_MODE) && defined (CONFIG_NATIVEAP_MLME) struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); - WLAN_BSSID_EX *cur_network = &(pmlmeinfo->network); + WLAN_BSSID_EX *cur_network = &(pmlmeinfo->network); unsigned int rate_len; #ifdef CONFIG_P2P struct wifidirect_info *pwdinfo = &(padapter->wdinfo); @@ -6690,16 +6690,16 @@ void issue_probersp(struct adapter *padapter, unsigned char *da, u8 is_valid_p2p //update attribute pattrib = &pmgntframe->attrib; - update_mgntframe_attrib(padapter, pattrib); - + update_mgntframe_attrib(padapter, pattrib); + _rtw_memset(pmgntframe->buf_addr, 0, WLANHDR_OFFSET + TXDESC_OFFSET); - + pframe = (u8 *)(pmgntframe->buf_addr) + TXDESC_OFFSET; - pwlanhdr = (struct rtw_ieee80211_hdr *)pframe; - + pwlanhdr = (struct rtw_ieee80211_hdr *)pframe; + mac = myid(&(padapter->eeprompriv)); bssid = cur_network->MacAddress; - + fctrl = &(pwlanhdr->frame_ctl); *(fctrl) = 0; _rtw_memcpy(pwlanhdr->addr1, da, ETH_ALEN); @@ -6709,7 +6709,7 @@ void issue_probersp(struct adapter *padapter, unsigned char *da, u8 is_valid_p2p SetSeqNum(pwlanhdr, pmlmeext->mgnt_seq); pmlmeext->mgnt_seq++; SetFrameSubType(fctrl, WIFI_PROBERSP); - + pattrib->hdrlen = sizeof(struct rtw_ieee80211_hdr_3addr); pattrib->pktlen = pattrib->hdrlen; pframe += pattrib->hdrlen; @@ -6717,41 +6717,41 @@ void issue_probersp(struct adapter *padapter, unsigned char *da, u8 is_valid_p2p if(cur_network->IELength>MAX_IE_SZ) return; - + #if defined (CONFIG_AP_MODE) && defined (CONFIG_NATIVEAP_MLME) if( (pmlmeinfo->state&0x03) == WIFI_FW_AP_STATE) { pwps_ie = rtw_get_wps_ie(cur_network->IEs+_FIXED_IE_LENGTH_, cur_network->IELength-_FIXED_IE_LENGTH_, NULL, &wps_ielen); - + //inerset & update wps_probe_resp_ie if((pmlmepriv->wps_probe_resp_ie!=NULL) && pwps_ie && (wps_ielen>0)) { uint wps_offset, remainder_ielen; - u8 *premainder_ie; - + u8 *premainder_ie; + wps_offset = (uint)(pwps_ie - cur_network->IEs); premainder_ie = pwps_ie + wps_ielen; remainder_ielen = cur_network->IELength - wps_offset - wps_ielen; - _rtw_memcpy(pframe, cur_network->IEs, wps_offset); - pframe += wps_offset; - pattrib->pktlen += wps_offset; + _rtw_memcpy(pframe, cur_network->IEs, wps_offset); + pframe += wps_offset; + pattrib->pktlen += wps_offset; wps_ielen = (uint)pmlmepriv->wps_probe_resp_ie[1];//to get ie data len if((wps_offset+wps_ielen+2)<=MAX_IE_SZ) { _rtw_memcpy(pframe, pmlmepriv->wps_probe_resp_ie, wps_ielen+2); - pframe += wps_ielen+2; - pattrib->pktlen += wps_ielen+2; + pframe += wps_ielen+2; + pattrib->pktlen += wps_ielen+2; } if((wps_offset+wps_ielen+2+remainder_ielen)<=MAX_IE_SZ) { _rtw_memcpy(pframe, premainder_ie, remainder_ielen); - pframe += remainder_ielen; - pattrib->pktlen += remainder_ielen; + pframe += remainder_ielen; + pattrib->pktlen += remainder_ielen; } } else @@ -6794,18 +6794,18 @@ void issue_probersp(struct adapter *padapter, unsigned char *da, u8 is_valid_p2p pattrib->pktlen += ssid_ielen_diff; } } - } - else -#endif + } + else +#endif { - + //timestamp will be inserted by hardware pframe += 8; pattrib->pktlen += 8; // beacon interval: 2 bytes - _rtw_memcpy(pframe, (unsigned char *)(rtw_get_beacon_interval_from_ie(cur_network->IEs)), 2); + _rtw_memcpy(pframe, (unsigned char *)(rtw_get_beacon_interval_from_ie(cur_network->IEs)), 2); pframe += 2; pattrib->pktlen += 2; @@ -6842,7 +6842,7 @@ void issue_probersp(struct adapter *padapter, unsigned char *da, u8 is_valid_p2p pframe = rtw_set_ie(pframe, _ERPINFO_IE_, 1, &erpinfo, &pattrib->pktlen); } - + // EXTERNDED SUPPORTED RATE if (rate_len > 8) { @@ -6852,7 +6852,7 @@ void issue_probersp(struct adapter *padapter, unsigned char *da, u8 is_valid_p2p //todo:HT for adhoc - } + } #ifdef CONFIG_P2P if(rtw_p2p_chk_role(pwdinfo, P2P_ROLE_GO) /*&& is_valid_p2p_probereq*/) @@ -6874,7 +6874,7 @@ void issue_probersp(struct adapter *padapter, unsigned char *da, u8 is_valid_p2p pframe += len; pattrib->pktlen += len; - + #ifdef CONFIG_WFD #ifdef CONFIG_IOCTL_CFG80211 if(_TRUE == pwdinfo->wfd_info->wfd_enable) @@ -6884,15 +6884,15 @@ void issue_probersp(struct adapter *padapter, unsigned char *da, u8 is_valid_p2p } #ifdef CONFIG_IOCTL_CFG80211 else - { + { len = 0; if(pmlmepriv->wfd_probe_resp_ie && pmlmepriv->wfd_probe_resp_ie_len>0) { len = pmlmepriv->wfd_probe_resp_ie_len; - _rtw_memcpy(pframe, pmlmepriv->wfd_probe_resp_ie, len); - } + _rtw_memcpy(pframe, pmlmepriv->wfd_probe_resp_ie, len); + } } -#endif //CONFIG_IOCTL_CFG80211 +#endif //CONFIG_IOCTL_CFG80211 pframe += len; pattrib->pktlen += len; #endif //CONFIG_WFD @@ -6902,10 +6902,10 @@ void issue_probersp(struct adapter *padapter, unsigned char *da, u8 is_valid_p2p pattrib->last_txcmdsz = pattrib->pktlen; - + dump_mgntframe(padapter, pmgntframe); - + return; } @@ -6995,8 +6995,8 @@ static int _issue_probereq(struct adapter *padapter, NDIS_802_11_SSID *pssid, u8 _rtw_memcpy(pframe, pmlmepriv->probereq_wpsie, pmlmepriv->probereq_wpsie_len); pframe += pmlmepriv->probereq_wpsie_len; pattrib->pktlen += pmlmepriv->probereq_wpsie_len; - //pmlmepriv->probereq_wpsie_len = 0 ;//reset to zero - } + //pmlmepriv->probereq_wpsie_len = 0 ;//reset to zero + } #else //add wps_ie for wps2.0 if(pmlmepriv->wps_probe_req_ie_len>0 && pmlmepriv->wps_probe_req_ie) @@ -7004,8 +7004,8 @@ static int _issue_probereq(struct adapter *padapter, NDIS_802_11_SSID *pssid, u8 _rtw_memcpy(pframe, pmlmepriv->wps_probe_req_ie, pmlmepriv->wps_probe_req_ie_len); pframe += pmlmepriv->wps_probe_req_ie_len; pattrib->pktlen += pmlmepriv->wps_probe_req_ie_len; - //pmlmepriv->wps_probe_req_ie_len = 0 ;//reset to zero - } + //pmlmepriv->wps_probe_req_ie_len = 0 ;//reset to zero + } #endif pattrib->last_txcmdsz = pattrib->pktlen; @@ -7114,12 +7114,12 @@ void issue_auth(struct adapter *padapter, struct sta_info *psta, unsigned short { #ifdef CONFIG_NATIVEAP_MLME - _rtw_memcpy(pwlanhdr->addr1, psta->hwaddr, ETH_ALEN); + _rtw_memcpy(pwlanhdr->addr1, psta->hwaddr, ETH_ALEN); _rtw_memcpy(pwlanhdr->addr2, myid(&(padapter->eeprompriv)), ETH_ALEN); _rtw_memcpy(pwlanhdr->addr3, myid(&(padapter->eeprompriv)), ETH_ALEN); - - // setting auth algo number + + // setting auth algo number val16 = cpu_to_le16((u16)psta->authalg); if(status != _STATS_SUCCESSFUL_) @@ -7140,19 +7140,19 @@ void issue_auth(struct adapter *padapter, struct sta_info *psta, unsigned short // added challenging text... if ((psta->auth_seq == 2) && (psta->state & WIFI_FW_AUTH_STATE) && (use_shared_key==1)) - pframe = rtw_set_ie(pframe, _CHLGETXT_IE_, 128, psta->chg_txt, &(pattrib->pktlen)); + pframe = rtw_set_ie(pframe, _CHLGETXT_IE_, 128, psta->chg_txt, &(pattrib->pktlen)); #endif - } else { + } else { _rtw_memcpy(pwlanhdr->addr1, get_my_bssid(&pmlmeinfo->network), ETH_ALEN); _rtw_memcpy(pwlanhdr->addr2, myid(&padapter->eeprompriv), ETH_ALEN); _rtw_memcpy(pwlanhdr->addr3, get_my_bssid(&pmlmeinfo->network), ETH_ALEN); - - // setting auth algo number + + // setting auth algo number val16 = cpu_to_le16((pmlmeinfo->auth_algo == dot11AuthAlgrthm_Shared)? 1: 0);// 0:OPEN System, 1:Shared key if (val16) use_shared_key = 1; //DBG_871X("%s auth_algo= %s auth_seq=%d\n",__FUNCTION__,(pmlmeinfo->auth_algo==0)?"OPEN":"SHARED",pmlmeinfo->auth_seq); - + //setting IV for auth seq #3 if ((pmlmeinfo->auth_seq == 3) && (pmlmeinfo->state & WIFI_FW_AUTH_STATE) && (use_shared_key==1)) { @@ -7164,12 +7164,12 @@ void issue_auth(struct adapter *padapter, struct sta_info *psta, unsigned short } pframe = rtw_set_fixed_ie(pframe, _AUTH_ALGM_NUM_, (unsigned char *)&val16, &(pattrib->pktlen)); - + // setting auth seq number val16 = cpu_to_le16(pmlmeinfo->auth_seq); pframe = rtw_set_fixed_ie(pframe, _AUTH_SEQ_NUM_, (unsigned char *)&val16, &(pattrib->pktlen)); - + // setting status code... val16 = cpu_to_le16(status); pframe = rtw_set_fixed_ie(pframe, _STATUS_CODE_, (unsigned char *)&val16, &(pattrib->pktlen)); @@ -7179,14 +7179,14 @@ void issue_auth(struct adapter *padapter, struct sta_info *psta, unsigned short pframe = rtw_set_ie(pframe, _CHLGETXT_IE_, 128, pmlmeinfo->chg_txt, &(pattrib->pktlen)); SetPrivacy(fctrl); - - pattrib->hdrlen = sizeof(struct rtw_ieee80211_hdr_3addr); - + + pattrib->hdrlen = sizeof(struct rtw_ieee80211_hdr_3addr); + pattrib->encrypt = _WEP40_; pattrib->icv_len = 4; - - pattrib->pktlen += pattrib->icv_len; + + pattrib->pktlen += pattrib->icv_len; } } @@ -7206,15 +7206,15 @@ void issue_asocrsp(struct adapter *padapter, unsigned short status, struct sta_i struct rtw_ieee80211_hdr *pwlanhdr; struct pkt_attrib *pattrib; unsigned char *pbuf, *pframe; - __le16 val; + __le16 val; __le16 *fctrl; __le16 le_status; struct xmit_priv *pxmitpriv = &(padapter->xmitpriv); struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; - struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); + struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); WLAN_BSSID_EX *pnetwork = &(pmlmeinfo->network); - u8 *ie = pnetwork->IEs; + u8 *ie = pnetwork->IEs; #ifdef CONFIG_P2P struct wifidirect_info *pwdinfo = &(padapter->wdinfo); #ifdef CONFIG_WFD @@ -7251,7 +7251,7 @@ void issue_asocrsp(struct adapter *padapter, unsigned short status, struct sta_i SetSeqNum(pwlanhdr, pmlmeext->mgnt_seq); pmlmeext->mgnt_seq++; if ((pkt_type == WIFI_ASSOCRSP) || (pkt_type == WIFI_REASSOCRSP)) - SetFrameSubType(pwlanhdr, pkt_type); + SetFrameSubType(pwlanhdr, pkt_type); else return; @@ -7266,7 +7266,7 @@ void issue_asocrsp(struct adapter *padapter, unsigned short status, struct sta_i le_status = cpu_to_le16(status); pframe = rtw_set_fixed_ie(pframe , _STATUS_CODE_ , (unsigned char *)&le_status, &(pattrib->pktlen)); - + val = cpu_to_le16(pstat->aid | BIT(14) | BIT(15)); pframe = rtw_set_fixed_ie(pframe, _ASOC_ID_ , (unsigned char *)&val, &(pattrib->pktlen)); @@ -7280,7 +7280,7 @@ void issue_asocrsp(struct adapter *padapter, unsigned short status, struct sta_i #ifdef CONFIG_80211N_HT if ((pstat->flags & WLAN_STA_HT) && (pmlmepriv->htpriv.ht_option)) { uint ie_len=0; - + //FILL HT CAP INFO IE //p = hostapd_eid_ht_capabilities_info(hapd, p); pbuf = rtw_get_ie(ie + _BEACON_IE_OFFSET_, _HT_CAPABILITY_IE_, &ie_len, (pnetwork->IELength - _BEACON_IE_OFFSET_)); @@ -7298,25 +7298,25 @@ void issue_asocrsp(struct adapter *padapter, unsigned short status, struct sta_i pframe += (ie_len+2); pattrib->pktlen +=(ie_len+2); } - - } + + } #endif //FILL WMM IE if ((pstat->flags & WLAN_STA_WME) && (pmlmepriv->qospriv.qos_option)) { uint ie_len=0; - unsigned char WMM_PARA_IE[] = {0x00, 0x50, 0xf2, 0x02, 0x01, 0x01}; - - for (pbuf = ie + _BEACON_IE_OFFSET_; ;pbuf+= (ie_len + 2)) { - pbuf = rtw_get_ie(pbuf, _VENDOR_SPECIFIC_IE_, &ie_len, (pnetwork->IELength - _BEACON_IE_OFFSET_ - (ie_len + 2))); - if(pbuf && _rtw_memcmp(pbuf+2, WMM_PARA_IE, 6)) { + unsigned char WMM_PARA_IE[] = {0x00, 0x50, 0xf2, 0x02, 0x01, 0x01}; + + for (pbuf = ie + _BEACON_IE_OFFSET_; ;pbuf+= (ie_len + 2)) { + pbuf = rtw_get_ie(pbuf, _VENDOR_SPECIFIC_IE_, &ie_len, (pnetwork->IELength - _BEACON_IE_OFFSET_ - (ie_len + 2))); + if(pbuf && _rtw_memcmp(pbuf+2, WMM_PARA_IE, 6)) { _rtw_memcpy(pframe, pbuf, ie_len+2); pframe += (ie_len+2); pattrib->pktlen +=(ie_len+2); - - break; + + break; } - + if ((pbuf == NULL) || (ie_len == 0)) break; } @@ -7328,7 +7328,7 @@ void issue_asocrsp(struct adapter *padapter, unsigned short status, struct sta_i //add WPS IE ie for wps 2.0 if(pmlmepriv->wps_assoc_resp_ie && pmlmepriv->wps_assoc_resp_ie_len>0) { _rtw_memcpy(pframe, pmlmepriv->wps_assoc_resp_ie, pmlmepriv->wps_assoc_resp_ie_len); - + pframe += pmlmepriv->wps_assoc_resp_ie_len; pattrib->pktlen += pmlmepriv->wps_assoc_resp_ie_len; } @@ -7346,9 +7346,9 @@ void issue_asocrsp(struct adapter *padapter, unsigned short status, struct sta_i } #ifdef CONFIG_WFD if(rtw_p2p_chk_role(pwdinfo, P2P_ROLE_GO) -#ifdef CONFIG_IOCTL_CFG80211 +#ifdef CONFIG_IOCTL_CFG80211 && (_TRUE == pwdinfo->wfd_info->wfd_enable) -#endif //CONFIG_IOCTL_CFG80211 +#endif //CONFIG_IOCTL_CFG80211 ) { wfdielen = build_assoc_resp_wfd_ie(pwdinfo, pframe); @@ -7359,9 +7359,9 @@ void issue_asocrsp(struct adapter *padapter, unsigned short status, struct sta_i #endif //CONFIG_P2P pattrib->last_txcmdsz = pattrib->pktlen; - + dump_mgntframe(padapter, pmgntframe); - + #endif } @@ -7386,7 +7386,7 @@ void issue_assocreq(struct adapter *padapter) #ifdef CONFIG_P2P struct wifidirect_info *pwdinfo = &(padapter->wdinfo); u8 p2pie[ 255 ] = { 0x00 }; - u16 p2pielen = 0; + u16 p2pielen = 0; #ifdef CONFIG_WFD u32 wfdielen = 0; #endif //CONFIG_WFD @@ -7450,13 +7450,13 @@ void issue_assocreq(struct adapter *padapter) #if 1 // Check if the AP's supported rates are also supported by STA. get_rate_set(padapter, sta_bssrate, &sta_bssrate_len); //DBG_871X("sta_bssrate_len=%d\n", sta_bssrate_len); - - if(pmlmeext->cur_channel == 14)// for JAPAN, channel 14 can only uses B Mode(CCK) + + if(pmlmeext->cur_channel == 14)// for JAPAN, channel 14 can only uses B Mode(CCK) { sta_bssrate_len = 4; } - + //for (i = 0; i < sta_bssrate_len; i++) { // DBG_871X("sta_bssrate[%d]=%02X\n", i, sta_bssrate[i]); //} @@ -7465,16 +7465,16 @@ void issue_assocreq(struct adapter *padapter) if (pmlmeinfo->network.SupportedRates[i] == 0) break; DBG_871X("network.SupportedRates[%d]=%02X\n", i, pmlmeinfo->network.SupportedRates[i]); } - + for (i = 0; i < NDIS_802_11_LENGTH_RATES_EX; i++) { if (pmlmeinfo->network.SupportedRates[i] == 0) break; - + // Check if the AP's supported rates are also supported by STA. for (j=0; j < sta_bssrate_len; j++) { // Avoid the proprietary data rate (22Mbps) of Handlink WSG-4000 AP - if ( (pmlmeinfo->network.SupportedRates[i]|IEEE80211_BASIC_RATE_MASK) + if ( (pmlmeinfo->network.SupportedRates[i]|IEEE80211_BASIC_RATE_MASK) == (sta_bssrate[j]|IEEE80211_BASIC_RATE_MASK)) { //DBG_871X("match i = %d, j=%d\n", i, j); break; @@ -7482,7 +7482,7 @@ void issue_assocreq(struct adapter *padapter) //DBG_871X("not match: %02X != %02X\n", (pmlmeinfo->network.SupportedRates[i]|IEEE80211_BASIC_RATE_MASK), (sta_bssrate[j]|IEEE80211_BASIC_RATE_MASK)); } } - + if (j == sta_bssrate_len) { // the rate is not supported by STA DBG_871X("%s(): the rate[%d]=%02X is not supported by STA!\n",__FUNCTION__, i, pmlmeinfo->network.SupportedRates[i]); @@ -7491,7 +7491,7 @@ void issue_assocreq(struct adapter *padapter) bssrate[index++] = pmlmeinfo->network.SupportedRates[i]; } } - + bssrate_len = index; DBG_871X("bssrate_len = %d\n", bssrate_len); @@ -7551,13 +7551,13 @@ void issue_assocreq(struct adapter *padapter) case RF_1T1R: if(pregpriv->rx_stbc) pmlmeinfo->HT_caps.u.HT_cap_element.HT_caps_info |= cpu_to_le16(0x0100);//RX STBC One spatial stream - + _rtw_memcpy(pmlmeinfo->HT_caps.u.HT_cap_element.MCS_rate, MCS_rate_1R, 16); break; case RF_2T2R: case RF_1T2R: default: - if((pregpriv->rx_stbc == 0x3) ||//enable for 2.4/5 GHz + if((pregpriv->rx_stbc == 0x3) ||//enable for 2.4/5 GHz ((pmlmeext->cur_wireless_mode & WIRELESS_11_24N) && (pregpriv->rx_stbc == 0x1)) || //enable for 2.4GHz ((pmlmeext->cur_wireless_mode & WIRELESS_11_5N) && (pregpriv->rx_stbc == 0x2)) || //enable for 5GHz (pregpriv->wifi_spec==1)) { @@ -7578,7 +7578,7 @@ void issue_assocreq(struct adapter *padapter) { if(pregpriv->rx_stbc) pmlmeinfo->HT_caps.u.HT_cap_element.HT_caps_info |= cpu_to_le16(0x0100);//RX STBC One spatial stream - + _rtw_memcpy(pmlmeinfo->HT_caps.u.HT_cap_element.MCS_rate, MCS_rate_1R, 16); } #endif @@ -7658,9 +7658,9 @@ void issue_assocreq(struct adapter *padapter) { if(!rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE) && !rtw_p2p_chk_state(pwdinfo, P2P_STATE_IDLE)) { - // Should add the P2P IE in the association request frame. + // Should add the P2P IE in the association request frame. // P2P OUI - + p2pielen = 0; p2pie[ p2pielen++ ] = 0x50; p2pie[ p2pielen++ ] = 0x6F; @@ -7715,7 +7715,7 @@ void issue_assocreq(struct adapter *padapter) p2pie[ p2pielen++ ] = P2P_ATTR_DEVICE_INFO; // Length: - // 21 -> P2P Device Address (6bytes) + Config Methods (2bytes) + Primary Device Type (8bytes) + // 21 -> P2P Device Address (6bytes) + Config Methods (2bytes) + Primary Device Type (8bytes) // + NumofSecondDevType (1byte) + WPS Device Name ID field (2bytes) + WPS Device Name Len field (2bytes) *(__le16*) ( p2pie + p2pielen ) = cpu_to_le16( 21 + pwdinfo->device_name_len ); p2pielen += 2; @@ -7767,24 +7767,24 @@ void issue_assocreq(struct adapter *padapter) // Value: _rtw_memcpy( p2pie + p2pielen, pwdinfo->device_name, pwdinfo->device_name_len ); p2pielen += pwdinfo->device_name_len; - + // P2P Interface // Type: p2pie[ p2pielen++ ] = P2P_ATTR_INTERFACE; - + // Length: *(__le16*) ( p2pie + p2pielen ) = cpu_to_le16( 0x000D ); p2pielen += 2; - + // Value: _rtw_memcpy( p2pie + p2pielen, pwdinfo->device_addr, ETH_ALEN ); // P2P Device Address p2pielen += ETH_ALEN; p2pie[ p2pielen++ ] = 1; // P2P Interface Address Count - + _rtw_memcpy( p2pie + p2pielen, pwdinfo->device_addr, ETH_ALEN ); // P2P Interface Address List p2pielen += ETH_ALEN; - + pframe = rtw_set_ie(pframe, _VENDOR_SPECIFIC_IE_, p2pielen, (unsigned char *) p2pie, &pattrib->pktlen ); #ifdef CONFIG_WFD @@ -7807,15 +7807,15 @@ void issue_assocreq(struct adapter *padapter) pattrib->pktlen += wfdielen; } #ifdef CONFIG_IOCTL_CFG80211 - else if (pmlmepriv->wfd_assoc_req_ie != NULL && pmlmepriv->wfd_assoc_req_ie_len>0) + else if (pmlmepriv->wfd_assoc_req_ie != NULL && pmlmepriv->wfd_assoc_req_ie_len>0) { //WFD IE _rtw_memcpy(pframe, pmlmepriv->wfd_assoc_req_ie, pmlmepriv->wfd_assoc_req_ie_len); pattrib->pktlen += pmlmepriv->wfd_assoc_req_ie_len; - pframe += pmlmepriv->wfd_assoc_req_ie_len; + pframe += pmlmepriv->wfd_assoc_req_ie_len; } #endif //CONFIG_IOCTL_CFG80211 -#endif //CONFIG_WFD +#endif //CONFIG_WFD pattrib->last_txcmdsz = pattrib->pktlen; dump_mgntframe(padapter, pmgntframe); @@ -7879,7 +7879,7 @@ static int _issue_nulldata(struct adapter *padapter, unsigned char *da, unsigned { SetToDs(fctrl); } - + if (power_mode) { SetPwrMgt(fctrl); @@ -7970,7 +7970,7 @@ static int _issue_qos_nulldata(struct adapter *padapter, unsigned char *da, u16 struct pkt_attrib *pattrib; unsigned char *pframe; struct rtw_ieee80211_hdr *pwlanhdr; - __le16 *fctrl; + __le16 *fctrl; unsigned short *qc; struct xmit_priv *pxmitpriv = &(padapter->xmitpriv); struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); @@ -8014,7 +8014,7 @@ static int _issue_qos_nulldata(struct adapter *padapter, unsigned char *da, u16 SetMData(fctrl); qc = (unsigned short *)(pframe + pattrib->hdrlen - 2); - + SetPriority(qc, tid); SetEOSP(qc, pattrib->eosp); @@ -8033,7 +8033,7 @@ static int _issue_qos_nulldata(struct adapter *padapter, unsigned char *da, u16 pattrib->pktlen = sizeof(struct rtw_ieee80211_hdr_3addr_qos); pattrib->last_txcmdsz = pattrib->pktlen; - + if(wait_ack) { ret = dump_mgntframe_and_wait_ack(padapter, pmgntframe); @@ -8061,7 +8061,7 @@ int issue_qos_nulldata(struct adapter *padapter, unsigned char *da, u16 tid, int /* da == NULL, assum it's null data for sta to ap*/ if (da == NULL) da = get_my_bssid(&(pmlmeinfo->network)); - + do { ret = _issue_qos_nulldata(padapter, da, tid, wait_ms>0?_TRUE:_FALSE); @@ -8219,7 +8219,7 @@ exit: } void issue_action_spct_ch_switch(struct adapter *padapter, u8 *ra, u8 new_ch, u8 ch_offset) -{ +{ _irqL irqL; _list *plist, *phead; struct xmit_frame *pmgntframe; @@ -8297,7 +8297,7 @@ void issue_action_SA_Query(struct adapter *padapter, unsigned char *raddr, unsig struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); struct sta_info *psta; struct sta_priv *pstapriv = &padapter->stapriv; - struct registry_priv *pregpriv = &padapter->registrypriv; + struct registry_priv *pregpriv = &padapter->registrypriv; DBG_871X("%s\n", __FUNCTION__); @@ -8381,7 +8381,7 @@ static void issue_action_BA(struct adapter *padapter, unsigned char *raddr, struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); struct sta_info *psta; struct sta_priv *pstapriv = &padapter->stapriv; - struct registry_priv *pregpriv = &padapter->registrypriv; + struct registry_priv *pregpriv = &padapter->registrypriv; #ifdef CONFIG_BT_COEXIST u8 tendaAPMac[] = {0xC8, 0x3A, 0x35}; #endif @@ -8460,12 +8460,12 @@ static void issue_action_BA(struct adapter *padapter, unsigned char *raddr, start_seq = (psta->sta_xmitpriv.txseq_tid[status & 0x07]&0xfff) + 1; DBG_871X("BA_starting_seqctrl = %d for TID=%d\n", start_seq, status & 0x07); - + psta->BA_starting_seqctrl[status & 0x07] = start_seq; - + BA_starting_seqctrl = start_seq << 4; } - + le_tmp = cpu_to_le16(BA_starting_seqctrl); pframe = rtw_set_fixed_ie(pframe, 2, (unsigned char *)(&(le_tmp)), &(pattrib->pktlen)); break; @@ -8483,7 +8483,7 @@ static void issue_action_BA(struct adapter *padapter, unsigned char *raddr, else if(MAX_AMPDU_FACTOR_8K == max_rx_ampdu_factor) BA_para_set = ((le16_to_cpu(pmlmeinfo->ADDBA_req.BA_para_set) & 0x3f) | 0x0200); //8 buffer size else - BA_para_set = ((le16_to_cpu(pmlmeinfo->ADDBA_req.BA_para_set) & 0x3f) | 0x1000); //64 buffer size + BA_para_set = ((le16_to_cpu(pmlmeinfo->ADDBA_req.BA_para_set) & 0x3f) | 0x1000); //64 buffer size #ifdef CONFIG_BT_COEXIST if ((BT_1Ant(padapter) == _TRUE) && @@ -8501,13 +8501,13 @@ static void issue_action_BA(struct adapter *padapter, unsigned char *raddr, le_tmp = cpu_to_le16(BA_para_set | BIT(0)); else //auto le_tmp = cpu_to_le16(BA_para_set); - + pframe = rtw_set_fixed_ie(pframe, 2, (unsigned char *)(&(le_tmp)), &(pattrib->pktlen)); pframe = rtw_set_fixed_ie(pframe, 2, (unsigned char *)(&(pmlmeinfo->ADDBA_req.BA_timeout_value)), &(pattrib->pktlen)); break; case 2://DELBA BA_para_set = (status & 0x1F) << 3; - le_tmp = cpu_to_le16(BA_para_set); + le_tmp = cpu_to_le16(BA_para_set); pframe = rtw_set_fixed_ie(pframe, 2, (unsigned char *)(&(le_tmp)), &(pattrib->pktlen)); reason_code = 37;//Requested from peer STA as it does not want to use the mechanism @@ -8526,7 +8526,7 @@ static void issue_action_BA(struct adapter *padapter, unsigned char *raddr, } static void issue_action_BSSCoexistPacket(struct adapter *padapter) -{ +{ _irqL irqL; _list *plist, *phead; unsigned char category, action; @@ -8543,13 +8543,13 @@ static void issue_action_BSSCoexistPacket(struct adapter *padapter) _queue *queue = &(pmlmepriv->scanned_queue); u8 InfoContent[16] = {0}; u8 ICS[8][15]; -#ifdef CONFIG_80211N_HT +#ifdef CONFIG_80211N_HT if((pmlmepriv->num_FortyMHzIntolerant==0) || (pmlmepriv->num_sta_no_ht==0)) return; if(_TRUE == pmlmeinfo->bwmode_updated) return; - + DBG_871X("%s\n", __FUNCTION__); @@ -8593,36 +8593,36 @@ static void issue_action_BSSCoexistPacket(struct adapter *padapter) if(pmlmepriv->num_FortyMHzIntolerant>0) { u8 iedata=0; - + iedata |= BIT(2);//20 MHz BSS Width Request pframe = rtw_set_ie(pframe, EID_BSSCoexistence, 1, &iedata, &(pattrib->pktlen)); - + } - + // _rtw_memset(ICS, 0, sizeof(ICS)); if(pmlmepriv->num_sta_no_ht>0) - { + { int i; - + _enter_critical_bh(&(pmlmepriv->scanned_queue.lock), &irqL); phead = get_list_head(queue); plist = get_next(phead); - + while(1) { int len; u8 *p; WLAN_BSSID_EX *pbss_network; - - if (rtw_end_of_queue_search(phead,plist)== _TRUE) - break; - pnetwork = LIST_CONTAINOR(plist, struct wlan_network, list); - + if (rtw_end_of_queue_search(phead,plist)== _TRUE) + break; + + pnetwork = LIST_CONTAINOR(plist, struct wlan_network, list); + plist = get_next(plist); pbss_network = (WLAN_BSSID_EX *)&pnetwork->network; @@ -8632,14 +8632,14 @@ static void issue_action_BSSCoexistPacket(struct adapter *padapter) { if((pbss_network->Configuration.DSConfig<=0) || (pbss_network->Configuration.DSConfig>14)) continue; - + ICS[0][pbss_network->Configuration.DSConfig]=1; - + if(ICS[0][0] == 0) - ICS[0][0] = 1; - } - - } + ICS[0][0] = 1; + } + + } _exit_critical_bh(&(pmlmepriv->scanned_queue.lock), &irqL); @@ -8649,11 +8649,11 @@ static void issue_action_BSSCoexistPacket(struct adapter *padapter) if(ICS[i][0] == 1) { int j, k = 0; - - InfoContent[k] = i; + + InfoContent[k] = i; //SET_BSS_INTOLERANT_ELE_REG_CLASS(InfoContent,i); k++; - + for(j=1;j<=14;j++) { if(ICS[i][j]==1) @@ -8663,19 +8663,19 @@ static void issue_action_BSSCoexistPacket(struct adapter *padapter) InfoContent[k] = j; //channel number //SET_BSS_INTOLERANT_ELE_CHANNEL(InfoContent+k, j); k++; - } - } - } + } + } + } pframe = rtw_set_ie(pframe, EID_BSSIntolerantChlReport, k, InfoContent, &(pattrib->pktlen)); - + } - + } - + } - + pattrib->last_txcmdsz = pattrib->pktlen; @@ -8692,16 +8692,16 @@ unsigned int send_delba(struct adapter *padapter, u8 initiator, u8 *addr) struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); u16 tid; - if((pmlmeinfo->state&0x03) != WIFI_FW_AP_STATE) + if((pmlmeinfo->state&0x03) != WIFI_FW_AP_STATE) if (!(pmlmeinfo->state & WIFI_FW_ASSOC_SUCCESS)) return _SUCCESS; - + psta = rtw_get_stainfo(pstapriv, addr); if(psta==NULL) return _SUCCESS; //DBG_871X("%s:%s\n", __FUNCTION__, (initiator==0)?"RX_DIR":"TX_DIR"); - + if(initiator==0) // recipient { for(tid = 0;tidrecvreorder_ctrl[tid].indicate_seq); #endif - } + } } } else if(initiator == 1)// originator @@ -8733,14 +8733,14 @@ unsigned int send_delba(struct adapter *padapter, u8 initiator, u8 *addr) (((tid <<1) |initiator)&0x1F)); psta->htpriv.agg_enable_bitmap &= ~BIT(tid); psta->htpriv.candidate_tid_bitmap &= ~BIT(tid); - - } + + } } #endif //CONFIG_80211N_HT } - + return _SUCCESS; - + } unsigned int send_beacon(struct adapter *padapter) @@ -8753,7 +8753,7 @@ unsigned int send_beacon(struct adapter *padapter) //struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); //struct adapter *pbuddy_adapter = padapter->pbuddy_adapter; //struct mlme_priv *pbuddy_mlmepriv = &(pbuddy_adapter->mlmepriv); -//#endif +//#endif #ifdef CONFIG_PCI_HCI @@ -8785,7 +8785,7 @@ unsigned int send_beacon(struct adapter *padapter) return _FAIL; } - + if(_FALSE == bxmitok) { DBG_871X("%s fail! %u ms\n", __FUNCTION__, rtw_get_passing_time_ms(start)); @@ -8799,7 +8799,7 @@ unsigned int send_beacon(struct adapter *padapter) DBG_871X("%s success, issue:%d, poll:%d, %u ms\n", __FUNCTION__, issue, poll, rtw_get_passing_time_ms(start)); //else // DBG_871X("%s success, issue:%d, poll:%d, %u ms\n", __FUNCTION__, issue, poll, rtw_get_passing_time_ms(start)); - + return _SUCCESS; } @@ -8817,7 +8817,7 @@ BOOLEAN IsLegal5GChannel( IN struct adapter * Adapter, IN u8 channel) { - + int i=0; u8 Channel_5G[45] = {36,38,40,42,44,46,48,50,52,54,56,58, 60,62,64,100,102,104,106,108,110,112,114,116,118,120,122, @@ -8846,13 +8846,13 @@ void site_survey(struct adapter *padapter) #endif //CONFIG_STA_MODE_SCAN_UNDER_AP_MODE struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); - struct adapter *pbuddy_adapter = padapter->pbuddy_adapter; + struct adapter *pbuddy_adapter = padapter->pbuddy_adapter; struct mlme_ext_priv *pbuddy_mlmeext = &pbuddy_adapter->mlmeextpriv; #endif //CONFIG_CONCURRENT_MODE struct wifidirect_info *pwdinfo= &(padapter->wdinfo); static unsigned char prev_survey_channel = 0; - static unsigned int p2p_scan_count = 0; + static unsigned int p2p_scan_count = 0; if ( ( pwdinfo->rx_invitereq_info.scan_op_ch_only ) || ( pwdinfo->p2p_info.scan_op_ch_only ) ) { @@ -8896,7 +8896,7 @@ void site_survey(struct adapter *padapter) , pwdinfo->find_phase_state_exchange_cnt, pmlmeext->sitesurvey_res.channel_idx , rtw_get_passing_time_ms(padapter->mlmepriv.scan_start_time) , ScanType?'A':'P', pmlmeext->sitesurvey_res.scan_mode?'A':'P' - , pmlmeext->sitesurvey_res.ssid[0].SsidLength?'S':' ' + , pmlmeext->sitesurvey_res.ssid[0].SsidLength?'S':' ' ); #ifdef DBG_FIXED_CHAN DBG_871X(FUNC_ADPT_FMT" fixed_chan:%u\n", pmlmeext->fixed_chan); @@ -8919,7 +8919,7 @@ void site_survey(struct adapter *padapter) survey_channel = pbuddy_mlmeext->cur_channel; stay_buddy_ch = 1; } - else + else { if( pmlmeinfo->scan_cnt == 0 ) stay_buddy_ch = 2; @@ -8933,7 +8933,7 @@ void site_survey(struct adapter *padapter) #ifdef DBG_FIXED_CHAN if(pmlmeext->fixed_chan !=0xff) set_channel_bwmode(padapter, pmlmeext->fixed_chan, HAL_PRIME_CHNL_OFFSET_DONT_CARE, HT_CHANNEL_WIDTH_20); - else + else #endif set_channel_bwmode(padapter, survey_channel, HAL_PRIME_CHNL_OFFSET_DONT_CARE, HT_CHANNEL_WIDTH_20); } @@ -8942,7 +8942,7 @@ void site_survey(struct adapter *padapter) #ifdef DBG_FIXED_CHAN if(pmlmeext->fixed_chan!=0xff) SelectChannel(padapter, pmlmeext->fixed_chan); - else + else #endif SelectChannel(padapter, survey_channel); } @@ -8969,7 +8969,7 @@ void site_survey(struct adapter *padapter) if(ScanType == SCAN_ACTIVE) //obey the channel plan setting... { #ifdef CONFIG_P2P - if(rtw_p2p_chk_state(pwdinfo, P2P_STATE_SCAN) || + if(rtw_p2p_chk_state(pwdinfo, P2P_STATE_SCAN) || rtw_p2p_chk_state(pwdinfo, P2P_STATE_FIND_PHASE_SEARCH) ) { @@ -9000,14 +9000,14 @@ void site_survey(struct adapter *padapter) } #ifdef CONFIG_ATMEL_RC_PATCH #ifdef CONFIG_P2P - if( !rtw_p2p_chk_state(pwdinfo, P2P_STATE_SCAN) && + if( !rtw_p2p_chk_state(pwdinfo, P2P_STATE_SCAN) && !rtw_p2p_chk_state(pwdinfo, P2P_STATE_FIND_PHASE_SEARCH) ) #endif//CONFIG_P2P { - if(ScanType == SCAN_ACTIVE){ + if(ScanType == SCAN_ACTIVE){ if( check_fwstate(pmlmepriv, _FW_LINKED) == _TRUE){ - if(survey_channel == pmlmeext->cur_channel ) + if(survey_channel == pmlmeext->cur_channel ) set_survey_timer(pmlmeext, 200); else set_survey_timer(pmlmeext, 20); @@ -9064,10 +9064,10 @@ void site_survey(struct adapter *padapter) cur_channel = pmlmeext->cur_channel; cur_bwmode = pmlmeext->cur_bwmode; cur_ch_offset = pmlmeext->cur_ch_offset; - } + } #endif - + #ifdef CONFIG_P2P if(rtw_p2p_chk_state(pwdinfo, P2P_STATE_SCAN) || rtw_p2p_chk_state(pwdinfo, P2P_STATE_FIND_PHASE_SEARCH)) { @@ -9090,11 +9090,11 @@ void site_survey(struct adapter *padapter) pmlmeext->sitesurvey_res.state = SCAN_DISABLE; initialgain = 0xff; //restore RX GAIN - rtw_hal_set_hwreg(padapter, HW_VAR_INITIAL_GAIN, (u8 *)(&initialgain)); + rtw_hal_set_hwreg(padapter, HW_VAR_INITIAL_GAIN, (u8 *)(&initialgain)); //turn on dynamic functions Restore_DM_Func_Flag(padapter); //Switch_DM_Func(padapter, DYNAMIC_FUNC_DIG|DYNAMIC_FUNC_HP|DYNAMIC_FUNC_SS, _TRUE); - + _set_timer( &pwdinfo->find_phase_timer, ( u32 ) ( ( u32 ) ( pwdinfo->listen_dwell ) * 100 ) ); } else @@ -9110,10 +9110,10 @@ void site_survey(struct adapter *padapter) // For SW antenna diversity before link, it needs to switch to another antenna and scan again. // It compares the scan result and select beter one to do connection. if(rtw_hal_antdiv_before_linked(padapter)) - { + { pmlmeext->sitesurvey_res.bss_cnt = 0; pmlmeext->sitesurvey_res.channel_idx = -1; - pmlmeext->chan_scan_time = SURVEY_TO /2; + pmlmeext->chan_scan_time = SURVEY_TO /2; set_survey_timer(pmlmeext, pmlmeext->chan_scan_time); return; } @@ -9129,7 +9129,7 @@ void site_survey(struct adapter *padapter) { _set_timer( &pwdinfo->ap_p2p_switch_timer, 500 ); } - } + } rtw_p2p_set_state(pwdinfo, rtw_p2p_pre_state(pwdinfo)); #else rtw_p2p_set_state(pwdinfo, rtw_p2p_pre_state(pwdinfo)); @@ -9137,7 +9137,7 @@ void site_survey(struct adapter *padapter) } rtw_p2p_findphase_ex_set(pwdinfo, P2P_FINDPHASE_EX_NONE); #endif //CONFIG_P2P - + pmlmeext->sitesurvey_res.state = SCAN_COMPLETE; //switch back to the original channel @@ -9175,7 +9175,7 @@ void site_survey(struct adapter *padapter) Set_MSR(padapter, (pmlmeinfo->state & 0x3)); initialgain = 0xff; //restore RX GAIN - rtw_hal_set_hwreg(padapter, HW_VAR_INITIAL_GAIN, (u8 *)(&initialgain)); + rtw_hal_set_hwreg(padapter, HW_VAR_INITIAL_GAIN, (u8 *)(&initialgain)); //turn on dynamic functions Restore_DM_Func_Flag(padapter); //Switch_DM_Func(padapter, DYNAMIC_ALL_FUNC_ENABLE, _TRUE); @@ -9183,22 +9183,22 @@ void site_survey(struct adapter *padapter) if (is_client_associated_to_ap(padapter) == _TRUE) { issue_nulldata(padapter, NULL, 0, 3, 500); - + #ifdef CONFIG_CONCURRENT_MODE if(is_client_associated_to_ap(padapter->pbuddy_adapter) == _TRUE) { DBG_871X("adapter is surveydone(buddy_adapter is linked), issue nulldata(pwrbit=0)\n"); - + issue_nulldata(padapter->pbuddy_adapter, NULL, 0, 3, 500); } -#endif +#endif } #ifdef CONFIG_CONCURRENT_MODE else if(is_client_associated_to_ap(padapter->pbuddy_adapter) == _TRUE) { issue_nulldata(padapter->pbuddy_adapter, NULL, 0, 3, 500); } -#endif +#endif val8 = 0; //survey done rtw_hal_set_hwreg(padapter, HW_VAR_MLME_SITESURVEY, (u8 *)(&val8)); @@ -9223,7 +9223,7 @@ void site_survey(struct adapter *padapter) DBG_871X("survey done, current CH=%d, BW=%d, offset=%d\n", cur_channel, cur_bwmode, cur_ch_offset); DBG_871X("restart pbuddy_adapter's beacon\n"); - + update_beacon(padapter->pbuddy_adapter, 0, NULL, _TRUE); } #endif @@ -9245,7 +9245,7 @@ u8 collect_bss_info(struct adapter *padapter, union recv_frame *precv_frame, WLA u32 packet_len = precv_frame->u.hdr.len; u8 ie_offset; __le32 le_tmp; - struct registry_priv *pregistrypriv = &padapter->registrypriv; + struct registry_priv *pregistrypriv = &padapter->registrypriv; struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); @@ -9277,7 +9277,7 @@ u8 collect_bss_info(struct adapter *padapter, union recv_frame *precv_frame, WLA ie_offset = _FIXED_IE_LENGTH_; } } - + bssid->Length = sizeof(WLAN_BSSID_EX) - MAX_IE_SZ + len; //below is to copy the information element @@ -9287,7 +9287,7 @@ u8 collect_bss_info(struct adapter *padapter, union recv_frame *precv_frame, WLA //get the signal strength //bssid->Rssi = precv_frame->u.hdr.attrib.SignalStrength; // 0-100 index. bssid->Rssi = precv_frame->u.hdr.attrib.phy_info.RecvSignalPower; // in dBM.raw data - bssid->PhyInfo.SignalQuality = precv_frame->u.hdr.attrib.phy_info.SignalQuality;//in percentage + bssid->PhyInfo.SignalQuality = precv_frame->u.hdr.attrib.phy_info.SignalQuality;//in percentage bssid->PhyInfo.SignalStrength = precv_frame->u.hdr.attrib.phy_info.SignalStrength;//in percentage #ifdef CONFIG_ANTENNA_DIVERSITY //rtw_hal_get_hwreg(padapter, HW_VAR_CURRENT_ANTENNA, (u8 *)(&bssid->PhyInfo.Optimum_antenna)); @@ -9430,21 +9430,21 @@ u8 collect_bss_info(struct adapter *padapter, union recv_frame *precv_frame, WLA //20/40 BSS Coexistence check if((pregistrypriv->wifi_spec==1) && (_FALSE == pmlmeinfo->bwmode_updated)) - { + { struct mlme_priv *pmlmepriv = &padapter->mlmepriv; #ifdef CONFIG_80211N_HT p = rtw_get_ie(bssid->IEs + ie_offset, _HT_CAPABILITY_IE_, &len, bssid->IELength - ie_offset); if (p && len > 0) { struct HT_caps_element *pHT_caps; pHT_caps = (struct HT_caps_element *)(p + 2); - + if(le16_to_cpu(pHT_caps->u.HT_cap_element.HT_caps_info) & BIT(14)) pmlmepriv->num_FortyMHzIntolerant++; } else { pmlmepriv->num_sta_no_ht++; } #endif //CONFIG_80211N_HT - + } #ifdef CONFIG_INTEL_WIDI @@ -9587,7 +9587,7 @@ void start_clnt_join(struct adapter* padapter) _enter_critical_bh(&(padapter->mlmepriv.scanned_queue.lock), &irqL); for (pos = get_next(head);!rtw_end_of_queue_search(head, pos); pos = get_next(pos)) { - + scanned = LIST_CONTAINOR(pos, struct wlan_network, list); if(scanned==NULL) rtw_warn_on(1); @@ -9601,7 +9601,7 @@ void start_clnt_join(struct adapter* padapter) break; } } - + _exit_critical_bh(&(padapter->mlmepriv.scanned_queue.lock), &irqL); if (scanned == NULL || rtw_end_of_queue_search(head, pos) || has_p2p_ie == _FALSE) @@ -9613,29 +9613,29 @@ void start_clnt_join(struct adapter* padapter) //here wait for receiving the beacon to start auth //and enable a timer beacon_timeout = decide_wait_for_beacon_timeout(pmlmeinfo->bcn_interval); - set_link_timer(pmlmeext, beacon_timeout); - _set_timer( &padapter->mlmepriv.assoc_timer, + set_link_timer(pmlmeext, beacon_timeout); + _set_timer( &padapter->mlmepriv.assoc_timer, (REAUTH_TO * REAUTH_LIMIT) + (REASSOC_TO*REASSOC_LIMIT) +beacon_timeout); - + pmlmeinfo->state = WIFI_FW_AUTH_NULL | WIFI_FW_STATION_STATE; - + {//only for STA mode u16 media_status; u8 mac_id = 0; - #ifdef CONFIG_CONCURRENT_MODE + #ifdef CONFIG_CONCURRENT_MODE if(PRIMARY_ADAPTER == padapter->adapter_type) mac_id=0; else - mac_id=2; - #endif - media_status = (mac_id<<8)|1; // MACID|OPMODE:1 connect - rtw_hal_set_hwreg(padapter,HW_VAR_H2C_MEDIA_STATUS_RPT,(u8 *)&media_status); - } + mac_id=2; + #endif + media_status = (mac_id<<8)|1; // MACID|OPMODE:1 connect + rtw_hal_set_hwreg(padapter,HW_VAR_H2C_MEDIA_STATUS_RPT,(u8 *)&media_status); + } } else if (caps&cap_IBSS) //adhoc client { -#ifdef CONFIG_DUALMAC_CONCURRENT +#ifdef CONFIG_DUALMAC_CONCURRENT if(dc_handle_join_request(padapter) == _FAIL) { DBG_871X("dc_handle_join_request for Ad-hoc fail !!!\n"); @@ -9985,7 +9985,7 @@ static void process_80211d(struct adapter *padapter, WLAN_BSSID_EX *bssid) //5G Bnad 2, 3 (DFS) doesn't change to active scan if(channel >= 52 && channel <= 144) break; - + chplan_new[i].ScanType = SCAN_ACTIVE; RT_TRACE(_module_rtl871x_mlme_c_, _drv_notice_, ("%s: change channel %d scan type from passive to active\n", @@ -10021,7 +10021,7 @@ void report_survey_event(struct adapter *padapter, union recv_frame *precv_frame pmlmeext = &padapter->mlmeextpriv; pcmdpriv = &padapter->cmdpriv; - + if ((pcmd_obj = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj))) == NULL) { @@ -10156,14 +10156,14 @@ void report_join_res(struct adapter *padapter, int res) pjoinbss_evt = (struct joinbss_event*)(pevtcmd + sizeof(struct C2HEvent_Header)); _rtw_memcpy((unsigned char *)(&(pjoinbss_evt->network.network)), &(pmlmeinfo->network), sizeof(WLAN_BSSID_EX)); - pjoinbss_evt->network.join_res = pjoinbss_evt->network.aid = res; + pjoinbss_evt->network.join_res = pjoinbss_evt->network.aid = res; DBG_871X("report_join_res(%d)\n", res); - - + + rtw_joinbss_event_prehandle(padapter, (u8 *)&pjoinbss_evt->network); - - + + rtw_enqueue_cmd(pcmdpriv, pcmd_obj); return; @@ -10215,7 +10215,7 @@ void report_del_sta_event(struct adapter *padapter, unsigned char* MacAddr, unsi psta = rtw_get_stainfo(&padapter->stapriv, MacAddr); if(psta) - mac_id = (int)psta->mac_id; + mac_id = (int)psta->mac_id; else mac_id = (-1); @@ -10304,7 +10304,7 @@ void update_sta_info(struct adapter *padapter, struct sta_info *psta) psta->htpriv.sgi = _TRUE; psta->qos_option = _TRUE; - + } else #endif //CONFIG_80211N_HT @@ -10313,7 +10313,7 @@ void update_sta_info(struct adapter *padapter, struct sta_info *psta) psta->htpriv.ht_option = _FALSE; psta->htpriv.ampdu_enable = _FALSE; - + psta->htpriv.sgi = _FALSE; #endif //CONFIG_80211N_HT psta->qos_option = _FALSE; @@ -10322,7 +10322,7 @@ void update_sta_info(struct adapter *padapter, struct sta_info *psta) #ifdef CONFIG_80211N_HT psta->htpriv.bwmode = pmlmeext->cur_bwmode; psta->htpriv.ch_offset = pmlmeext->cur_ch_offset; - + psta->htpriv.agg_enable_bitmap = 0x0;//reset psta->htpriv.candidate_tid_bitmap = 0x0;//reset #endif //CONFIG_80211N_HT @@ -10330,7 +10330,7 @@ void update_sta_info(struct adapter *padapter, struct sta_info *psta) //QoS if(pmlmepriv->qospriv.qos_option) psta->qos_option = _TRUE; - + psta->state = _FW_LINKED; @@ -10341,13 +10341,13 @@ void mlmeext_joinbss_event_callback(struct adapter *padapter, int join_res) struct sta_info *psta, *psta_bmc; struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); - WLAN_BSSID_EX *cur_network = &(pmlmeinfo->network); + WLAN_BSSID_EX *cur_network = &(pmlmeinfo->network); struct sta_priv *pstapriv = &padapter->stapriv; u8 join_type; u16 media_status; psta = rtw_get_stainfo(pstapriv, cur_network->MacAddress); - + if(join_res < 0) { join_type = 1; @@ -10357,9 +10357,9 @@ void mlmeext_joinbss_event_callback(struct adapter *padapter, int join_res) //restore to initial setting. update_tx_basic_rate(padapter, padapter->registrypriv.wireless_mode); - if (psta){//only for STA mode - media_status = (psta->mac_id<<8)|0; // MACID|OPMODE:1 connect - rtw_hal_set_hwreg(padapter,HW_VAR_H2C_MEDIA_STATUS_RPT,(u8 *)&media_status); + if (psta){//only for STA mode + media_status = (psta->mac_id<<8)|0; // MACID|OPMODE:1 connect + rtw_hal_set_hwreg(padapter,HW_VAR_H2C_MEDIA_STATUS_RPT,(u8 *)&media_status); } goto exit_mlmeext_joinbss_event_callback; @@ -10406,7 +10406,7 @@ void mlmeext_joinbss_event_callback(struct adapter *padapter, int join_res) set_channel_bwmode(padapter, pmlmeext->cur_channel, pmlmeext->cur_ch_offset, pmlmeext->cur_bwmode); #endif - + if (psta) //only for infra. mode { pmlmeinfo->FW_sta_info[psta->mac_id].psta = psta; @@ -10414,10 +10414,10 @@ void mlmeext_joinbss_event_callback(struct adapter *padapter, int join_res) //DBG_871X("set_sta_rate\n"); psta->wireless_mode = pmlmeext->cur_wireless_mode; - + //set per sta rate after updating HT cap. set_sta_rate(padapter, psta); - + rtw_sta_media_status_rpt(padapter, psta, 1); } @@ -10428,7 +10428,7 @@ void mlmeext_joinbss_event_callback(struct adapter *padapter, int join_res) { // correcting TSF correct_TSF(padapter, pmlmeext); - + //set_link_timer(pmlmeext, DISCONNECT_TO); } @@ -10466,7 +10466,7 @@ void mlmeext_sta_add_event_callback(struct adapter *padapter, struct sta_info *p else//adhoc client { //update TSF Value - //update_TSF(pmlmeext, pframe, len); + //update_TSF(pmlmeext, pframe, len); // correcting TSF correct_TSF(padapter, pmlmeext); @@ -10482,7 +10482,7 @@ void mlmeext_sta_add_event_callback(struct adapter *padapter, struct sta_info *p } pmlmeinfo->state |= WIFI_FW_ASSOC_SUCCESS; - + } join_type = 2; @@ -10528,7 +10528,7 @@ void mlmeext_sta_del_event_callback(struct adapter *padapter) //SelectChannel(padapter, pmlmeext->cur_channel, pmlmeext->cur_ch_offset); set_channel_bwmode(padapter, pmlmeext->cur_channel, pmlmeext->cur_ch_offset, pmlmeext->cur_bwmode); - + #ifdef CONFIG_CONCURRENT_MODE } #endif //CONFIG_CONCURRENT_MODE @@ -10562,7 +10562,7 @@ void _linked_rx_signal_strehgth_display(struct adapter *padapter) #if 0 DBG_871X("============ linked status check ===================\n"); DBG_871X("pathA Rx SNRdb:%d, pathB Rx SNRdb:%d\n",padapter->recvpriv.RxSNRdB[0], padapter->recvpriv.RxSNRdB[1]); - DBG_871X("pathA Rx PWDB:%d\n",padapter->recvpriv.rxpwdb); + DBG_871X("pathA Rx PWDB:%d\n",padapter->recvpriv.rxpwdb); rtw_hal_get_def_var(padapter, HAL_DEF_UNDERCORATEDSMOOTHEDPWDB, &UndecoratedSmoothedPWDB); DBG_871X("UndecoratedSmoothedPWDB:%d\n",UndecoratedSmoothedPWDB); DBG_871X("Rx RSSI:%d\n",padapter->recvpriv.rssi); @@ -10572,7 +10572,7 @@ void _linked_rx_signal_strehgth_display(struct adapter *padapter) { DBG_871X("bw mode: %d, channel: %d\n", padapter->mlmeextpriv.cur_bwmode, padapter->mlmeextpriv.cur_channel ); DBG_871X("received bytes = %d\n", (u32) (padapter->recvpriv.rx_bytes - padapter->recvpriv.last_rx_bytes ) ); - } + } DBG_871X("============ linked status check ===================\n"); #endif if((pmlmeinfo->state&0x03) == WIFI_FW_STATION_STATE) @@ -10581,10 +10581,10 @@ void _linked_rx_signal_strehgth_display(struct adapter *padapter) } else if((pmlmeinfo->state&0x03) == _HW_STATE_AP_) { - mac_id=2; + mac_id=2; } - - rtw_hal_get_def_var(padapter, HW_DEF_RA_INFO_DUMP,&mac_id); + + rtw_hal_get_def_var(padapter, HW_DEF_RA_INFO_DUMP,&mac_id); #if 0 DBG_871X("============ RX GAIN / FALSE ALARM ===================\n"); DBG_871X(" DIG PATH-A(0x%02x), PATH-B(0x%02x)\n",rtw_read8(padapter,0xc50),rtw_read8(padapter,0xc58)); @@ -10595,7 +10595,7 @@ void _linked_rx_signal_strehgth_display(struct adapter *padapter) #endif - //rtw_hal_get_def_var(padapter, HAL_DEF_UNDERCORATEDSMOOTHEDPWDB, &UndecoratedSmoothedPWDB); + //rtw_hal_get_def_var(padapter, HAL_DEF_UNDERCORATEDSMOOTHEDPWDB, &UndecoratedSmoothedPWDB); //DBG_871X("UndecoratedSmoothedPWDB:%d\n",UndecoratedSmoothedPWDB); } @@ -10656,7 +10656,7 @@ void linked_status_chk(struct adapter *padapter) if(padapter->bRxRSSIDisplay) _linked_rx_signal_strehgth_display(padapter); - #ifdef DBG_CONFIG_ERROR_DETECT + #ifdef DBG_CONFIG_ERROR_DETECT rtw_hal_sreset_linked_status_check(padapter); #endif @@ -10689,7 +10689,7 @@ void linked_status_chk(struct adapter *padapter) #ifdef CONFIG_P2P is_p2p_enable = !rtw_p2p_chk_state(&padapter->wdinfo, P2P_STATE_NONE); #endif - + if (chk_ap_is_alive(padapter, psta) == _FALSE) rx_chk = _FAIL; @@ -10791,7 +10791,7 @@ void linked_status_chk(struct adapter *padapter) report_del_sta_event(padapter, psta->hwaddr , 65535// indicate disconnect caused by no rx ); - } + } } else { @@ -10812,7 +10812,7 @@ void survey_timer_hdl(struct adapter *padapter) struct cmd_obj *ph2c; struct sitesurvey_parm *psurveyPara; struct cmd_priv *pcmdpriv=&padapter->cmdpriv; - struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; + struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; #ifdef CONFIG_P2P struct wifidirect_info *pwdinfo= &(padapter->wdinfo); #endif @@ -10904,7 +10904,7 @@ void link_timer_hdl(struct adapter *padapter) // pmlmeinfo->reauth_count = 0; //} } - + DBG_871X("link_timer_hdl: auth timeout and try again\n"); pmlmeinfo->auth_seq = 1; issue_auth(padapter, NULL, 0); @@ -10997,14 +10997,14 @@ void addba_timer_hdl(struct sta_info *psta) if(!psta) return; - + phtpriv = &psta->htpriv; - if((phtpriv->ht_option==_TRUE) && (phtpriv->ampdu_enable==_TRUE)) + if((phtpriv->ht_option==_TRUE) && (phtpriv->ampdu_enable==_TRUE)) { if(phtpriv->candidate_tid_bitmap) phtpriv->candidate_tid_bitmap=0x0; - + } #endif //CONFIG_80211N_HT } @@ -11022,7 +11022,7 @@ void sa_query_timer_hdl(struct adapter *padapter) { rtw_disassoc_cmd(padapter, 0, _TRUE); rtw_indicate_disconnect(padapter); - rtw_free_assoc_resources(padapter, 1); + rtw_free_assoc_resources(padapter, 1); } _exit_critical_bh(&pmlmepriv->lock, &irqL); @@ -11053,7 +11053,7 @@ u8 setopmode_hdl(struct adapter *padapter, u8 *pbuf) else if(psetop->mode == Ndis802_11Infrastructure) { pmlmeinfo->state &= ~(BIT(0)|BIT(1));// clear state - pmlmeinfo->state |= WIFI_FW_STATION_STATE;//set to STATION_STATE + pmlmeinfo->state |= WIFI_FW_STATION_STATE;//set to STATION_STATE type = _HW_STATE_STATION_; } else if(psetop->mode == Ndis802_11IBSS) @@ -11069,7 +11069,7 @@ u8 setopmode_hdl(struct adapter *padapter, u8 *pbuf) //Set_NETYPE0_MSR(padapter, type); return H2C_SUCCESS; - + } u8 createbss_hdl(struct adapter *padapter, u8 *pbuf) @@ -11080,16 +11080,16 @@ u8 createbss_hdl(struct adapter *padapter, u8 *pbuf) struct joinbss_parm *pparm = (struct joinbss_parm *)pbuf; //u32 initialgain; - + if(pparm->network.InfrastructureMode == Ndis802_11APMode) { #ifdef CONFIG_AP_MODE - + if(pmlmeinfo->state == WIFI_FW_AP_STATE) - { + { //todo: - return H2C_SUCCESS; - } + return H2C_SUCCESS; + } #endif } @@ -11097,9 +11097,9 @@ u8 createbss_hdl(struct adapter *padapter, u8 *pbuf) if(pparm->network.InfrastructureMode == Ndis802_11IBSS) { rtw_joinbss_reset(padapter); - + pmlmeext->cur_bwmode = HT_CHANNEL_WIDTH_20; - pmlmeext->cur_ch_offset= HAL_PRIME_CHNL_OFFSET_DONT_CARE; + pmlmeext->cur_ch_offset= HAL_PRIME_CHNL_OFFSET_DONT_CARE; pmlmeinfo->ERP_enable = 0; pmlmeinfo->WMM_enable = 0; pmlmeinfo->HT_enable = 0; @@ -11116,23 +11116,23 @@ u8 createbss_hdl(struct adapter *padapter, u8 *pbuf) //initialgain = 0x1E; //rtw_hal_set_hwreg(padapter, HW_VAR_INITIAL_GAIN, (u8 *)(&initialgain)); - //cancel link timer + //cancel link timer _cancel_timer_ex(&pmlmeext->link_timer); //clear CAM - flush_all_cam_entry(padapter); + flush_all_cam_entry(padapter); - _rtw_memcpy(pnetwork, pbuf, FIELD_OFFSET(WLAN_BSSID_EX, IELength)); + _rtw_memcpy(pnetwork, pbuf, FIELD_OFFSET(WLAN_BSSID_EX, IELength)); pnetwork->IELength = ((WLAN_BSSID_EX *)pbuf)->IELength; if(pnetwork->IELength>MAX_IE_SZ)//Check pbuf->IELength return H2C_PARAMETERS_ERROR; _rtw_memcpy(pnetwork->IEs, ((WLAN_BSSID_EX *)pbuf)->IEs, pnetwork->IELength); - + start_create_ibss(padapter); - } + } return H2C_SUCCESS; @@ -11163,16 +11163,16 @@ u8 join_cmd_hdl(struct adapter *padapter, u8 *pbuf) } pmlmeinfo->state = WIFI_FW_NULL_STATE; - + //clear CAM - flush_all_cam_entry(padapter); - + flush_all_cam_entry(padapter); + _cancel_timer_ex(&pmlmeext->link_timer); - - //set MSR to nolink -> infra. mode + + //set MSR to nolink -> infra. mode //Set_MSR(padapter, _HW_STATE_NOLINK_); - Set_MSR(padapter, _HW_STATE_STATION_); - + Set_MSR(padapter, _HW_STATE_STATION_); + rtw_hal_set_hwreg(padapter, HW_VAR_MLME_DISCONNECT, NULL); } @@ -11186,9 +11186,9 @@ u8 join_cmd_hdl(struct adapter *padapter, u8 *pbuf) #endif rtw_joinbss_reset(padapter); - + pmlmeext->cur_bwmode = HT_CHANNEL_WIDTH_20; - pmlmeext->cur_ch_offset= HAL_PRIME_CHNL_OFFSET_DONT_CARE; + pmlmeext->cur_ch_offset= HAL_PRIME_CHNL_OFFSET_DONT_CARE; pmlmeinfo->ERP_enable = 0; pmlmeinfo->WMM_enable = 0; pmlmeinfo->HT_enable = 0; @@ -11199,13 +11199,13 @@ u8 join_cmd_hdl(struct adapter *padapter, u8 *pbuf) pmlmeinfo->bwmode_updated = _FALSE; //pmlmeinfo->assoc_AP_vendor = HT_IOT_PEER_MAX; - _rtw_memcpy(pnetwork, pbuf, FIELD_OFFSET(WLAN_BSSID_EX, IELength)); + _rtw_memcpy(pnetwork, pbuf, FIELD_OFFSET(WLAN_BSSID_EX, IELength)); pnetwork->IELength = ((WLAN_BSSID_EX *)pbuf)->IELength; - + if(pnetwork->IELength>MAX_IE_SZ)//Check pbuf->IELength - return H2C_PARAMETERS_ERROR; - - _rtw_memcpy(pnetwork->IEs, ((WLAN_BSSID_EX *)pbuf)->IEs, pnetwork->IELength); + return H2C_PARAMETERS_ERROR; + + _rtw_memcpy(pnetwork->IEs, ((WLAN_BSSID_EX *)pbuf)->IEs, pnetwork->IELength); pmlmeext->cur_channel = (u8)pnetwork->Configuration.DSConfig; pmlmeinfo->bcn_interval = get_beacon_interval(pnetwork); @@ -11234,13 +11234,13 @@ u8 join_cmd_hdl(struct adapter *padapter, u8 *pbuf) #ifdef CONFIG_80211N_HT pmlmeinfo->HT_info_enable = 1; - //spec case only for cisco's ap because cisco's ap issue assoc rsp using mcs rate @40MHz or @20MHz + //spec case only for cisco's ap because cisco's ap issue assoc rsp using mcs rate @40MHz or @20MHz //#if !defined(CONFIG_CONCURRENT_MODE) && !defined(CONFIG_DUALMAC_CONCURRENT) // if(pmlmeinfo->assoc_AP_vendor == ciscoAP) //#endif - { + { struct HT_info_element *pht_info = (struct HT_info_element *)(pIE->data); - + if ((pregpriv->cbw40_enable) && (pht_info->infos[0] & BIT(2))) { //switch to the 40M Hz mode according to the AP @@ -11250,11 +11250,11 @@ u8 join_cmd_hdl(struct adapter *padapter, u8 *pbuf) case 1: pmlmeext->cur_ch_offset = HAL_PRIME_CHNL_OFFSET_LOWER; break; - + case 3: pmlmeext->cur_ch_offset = HAL_PRIME_CHNL_OFFSET_UPPER; break; - + default: pmlmeext->cur_bwmode = HT_CHANNEL_WIDTH_20; pmlmeext->cur_ch_offset = HAL_PRIME_CHNL_OFFSET_DONT_CARE; @@ -11284,7 +11284,7 @@ u8 join_cmd_hdl(struct adapter *padapter, u8 *pbuf) rtw_hal_set_hwreg(padapter, HW_VAR_AC_PARAM_BE, (u8 *)(&acparm)); acparm = 0x0000A549; // BK rtw_hal_set_hwreg(padapter, HW_VAR_AC_PARAM_BK, (u8 *)(&acparm)); - + // for WiFi test, mixed mode with intel STA under bg mode throughput issue if (padapter->mlmepriv.htpriv.ht_option == _FALSE){ acparm = 0x00004320; @@ -11329,13 +11329,13 @@ u8 join_cmd_hdl(struct adapter *padapter, u8 *pbuf) set_channel_bwmode(padapter, ch, offset, bw); - //cancel link timer + //cancel link timer _cancel_timer_ex(&pmlmeext->link_timer); - + start_clnt_join(padapter); - + return H2C_SUCCESS; - + } u8 disconnect_hdl(struct adapter *padapter, unsigned char *pbuf) @@ -11354,7 +11354,7 @@ u8 disconnect_hdl(struct adapter *padapter, unsigned char *pbuf) //set_opmode_cmd(padapter, infra_client_with_mlme); //pmlmeinfo->state = WIFI_FW_NULL_STATE; - + rtw_hal_set_hwreg(padapter, HW_VAR_MLME_DISCONNECT, NULL); rtw_hal_set_hwreg(padapter, HW_VAR_BSSID, null_addr); @@ -11378,7 +11378,7 @@ u8 disconnect_hdl(struct adapter *padapter, unsigned char *pbuf) #ifdef CONFIG_DUALMAC_CONCURRENT dc_set_channel_bwmode_disconnect(padapter); #else -#ifdef CONFIG_CONCURRENT_MODE +#ifdef CONFIG_CONCURRENT_MODE if((check_buddy_fwstate(padapter, _FW_LINKED)) != _TRUE) { #endif //CONFIG_CONCURRENT_MODE @@ -11393,12 +11393,12 @@ u8 disconnect_hdl(struct adapter *padapter, unsigned char *pbuf) #endif //CONFIG_DUALMAC_CONCURRENT flush_all_cam_entry(padapter); - + _cancel_timer_ex(&pmlmeext->link_timer); rtw_free_uc_swdec_pending_queue(padapter); - - return H2C_SUCCESS; + + return H2C_SUCCESS; } static int rtw_scan_ch_decision(struct adapter *padapter, struct rtw_ieee80211_channel *out, @@ -11422,21 +11422,21 @@ static int rtw_scan_ch_decision(struct adapter *padapter, struct rtw_ieee80211_c ) { _rtw_memcpy(&out[j], &in[i], sizeof(struct rtw_ieee80211_channel)); - + if(pmlmeext->channel_set[set_idx].ScanType == SCAN_PASSIVE) out[j].flags |= RTW_IEEE80211_CHAN_PASSIVE_SCAN; - + j++; } if(j>=out_num) break; } - + /* if out is empty, use channel_set as default */ if(j == 0) { for (i=0;imax_chan_nums;i++) { out[i].hw_value = pmlmeext->channel_set[i].ChannelNum; - + if(pmlmeext->channel_set[i].ScanType == SCAN_PASSIVE) out[i].flags |= RTW_IEEE80211_CHAN_PASSIVE_SCAN; @@ -11446,7 +11446,7 @@ static int rtw_scan_ch_decision(struct adapter *padapter, struct rtw_ieee80211_c if (padapter->setband == GHZ_24) { // 2.4G for (i=0; i < j ; i++) { - if (out[i].hw_value > 35) + if (out[i].hw_value > 35) _rtw_memset(&out[i], 0 , sizeof(struct rtw_ieee80211_channel)); else scan_ch_num++; @@ -11480,11 +11480,11 @@ u8 sitesurvey_cmd_hdl(struct adapter *padapter, u8 *pbuf) if (pmlmeext->sitesurvey_res.state == SCAN_DISABLE) { -#ifdef CONFIG_CONCURRENT_MODE +#ifdef CONFIG_CONCURRENT_MODE //for first time sitesurvey_cmd - rtw_hal_set_hwreg(padapter, HW_VAR_CHECK_TXBUF, 0); + rtw_hal_set_hwreg(padapter, HW_VAR_CHECK_TXBUF, 0); #endif //CONFIG_CONCURRENT_MODE - + pmlmeext->sitesurvey_res.state = SCAN_START; pmlmeext->sitesurvey_res.bss_cnt = 0; pmlmeext->sitesurvey_res.channel_idx = 0; @@ -11525,7 +11525,7 @@ u8 sitesurvey_cmd_hdl(struct adapter *padapter, u8 *pbuf) if(is_client_associated_to_ap(padapter->pbuddy_adapter) == _TRUE) { DBG_871X("adapter is scanning(buddy_adapter is linked), issue nulldata(pwrbit=1)\n"); - + issue_nulldata(padapter->pbuddy_adapter, NULL, 1, 3, 500); } #endif @@ -11545,9 +11545,9 @@ u8 sitesurvey_cmd_hdl(struct adapter *padapter, u8 *pbuf) issue_nulldata(padapter->pbuddy_adapter, NULL, 1, 3, 500); - bdelayscan = _TRUE; + bdelayscan = _TRUE; } -#endif +#endif if(bdelayscan) { //delay 50ms to protect nulldata(1). @@ -11561,7 +11561,7 @@ u8 sitesurvey_cmd_hdl(struct adapter *padapter, u8 *pbuf) #ifdef CONFIG_FIND_BEST_CHANNEL #if 0 for (i=0; pmlmeext->channel_set[i].ChannelNum !=0; i++) { - pmlmeext->channel_set[i].rx_count = 0; + pmlmeext->channel_set[i].rx_count = 0; } #endif #endif /* CONFIG_FIND_BEST_CHANNEL */ @@ -11584,7 +11584,7 @@ u8 sitesurvey_cmd_hdl(struct adapter *padapter, u8 *pbuf) initialgain = 0x1e; rtw_hal_set_hwreg(padapter, HW_VAR_INITIAL_GAIN, (u8 *)(&initialgain)); - + //set MSR to no link state Set_MSR(padapter, _HW_STATE_NOLINK_); @@ -11597,7 +11597,7 @@ u8 sitesurvey_cmd_hdl(struct adapter *padapter, u8 *pbuf) site_survey(padapter); return H2C_SUCCESS; - + } u8 setauth_hdl(struct adapter *padapter, unsigned char *pbuf) @@ -11605,13 +11605,13 @@ u8 setauth_hdl(struct adapter *padapter, unsigned char *pbuf) struct setauth_parm *pparm = (struct setauth_parm *)pbuf; struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); - + if (pparm->mode < 4) { pmlmeinfo->auth_algo = pparm->mode; } - return H2C_SUCCESS; + return H2C_SUCCESS; } u8 setkey_hdl(struct adapter *padapter, u8 *pbuf) @@ -11625,14 +11625,14 @@ u8 setkey_hdl(struct adapter *padapter, u8 *pbuf) //main tx key for wep. if(pparm->set_tx) pmlmeinfo->key_index = pparm->keyid; - + //write cam - ctrl = BIT(15) | ((pparm->algorithm) << 2) | pparm->keyid; + ctrl = BIT(15) | ((pparm->algorithm) << 2) | pparm->keyid; DBG_871X_LEVEL(_drv_always_, "set group key to hw: alg:%d(WEP40-1 WEP104-5 TKIP-2 AES-4) " "keyid:%d\n", pparm->algorithm, pparm->keyid); write_cam(padapter, pparm->keyid, ctrl, null_sta, pparm->key); - + //allow multicast packets to driver padapter->HalFunc.SetHwRegHandler(padapter, HW_VAR_ON_RCR_AM, null_addr); @@ -11654,7 +11654,7 @@ u8 set_stakey_hdl(struct adapter *padapter, u8 *pbuf) //cam_entry: //0~3 for default key - + //for concurrent mode (ap+sta): //default key is disable, using sw encrypt/decrypt //cam_entry = 4 //for sta mode (macid=0) @@ -11670,7 +11670,7 @@ u8 set_stakey_hdl(struct adapter *padapter, u8 *pbuf) { struct sta_priv *pstapriv = &padapter->stapriv; struct sta_info *psta; - + psta = rtw_get_stainfo(pstapriv, pmlmeinfo->network.MacAddress); if(psta && psta->mac_id==2) @@ -11681,7 +11681,7 @@ u8 set_stakey_hdl(struct adapter *padapter, u8 *pbuf) { cam_id = 4; } -/* +/* if(padapter->iface_type > PRIMARY_IFACE) { cam_id = 5; @@ -11690,17 +11690,17 @@ u8 set_stakey_hdl(struct adapter *padapter, u8 *pbuf) { cam_id = 4; } -*/ - } +*/ + } #else cam_id = 4; #endif DBG_871X_LEVEL(_drv_always_, "set pairwise key to hw: alg:%d(WEP40-1 WEP104-5 TKIP-2 AES-4) camid:%d\n", - pparm->algorithm, cam_id); + pparm->algorithm, cam_id); if((pmlmeinfo->state&0x03) == WIFI_FW_AP_STATE) { - + struct sta_info *psta; struct sta_priv *pstapriv = &padapter->stapriv; @@ -11709,10 +11709,10 @@ u8 set_stakey_hdl(struct adapter *padapter, u8 *pbuf) clear_cam_entry(padapter, pparm->id); return H2C_SUCCESS_RSP; } - + psta = rtw_get_stainfo(pstapriv, pparm->addr); if(psta) - { + { ctrl = (BIT(15) | ((pparm->algorithm) << 2)); DBG_871X("r871x_set_stakey_hdl(): enc_algorithm=%d\n", pparm->algorithm); @@ -11721,37 +11721,37 @@ u8 set_stakey_hdl(struct adapter *padapter, u8 *pbuf) { DBG_871X("r871x_set_stakey_hdl():set_stakey failed, mac_id(aid)=%d\n", psta->mac_id); return H2C_REJECTED; - } - + } + cam_id = (psta->mac_id + 3);//0~3 for default key, cmd_id=macid + 3, macid=aid+1; - DBG_871X("Write CAM, mac_addr=%x:%x:%x:%x:%x:%x, cam_entry=%d\n", pparm->addr[0], + DBG_871X("Write CAM, mac_addr=%x:%x:%x:%x:%x:%x, cam_entry=%d\n", pparm->addr[0], pparm->addr[1], pparm->addr[2], pparm->addr[3], pparm->addr[4], pparm->addr[5], cam_id); write_cam(padapter, cam_id, ctrl, pparm->addr, pparm->key); - + return H2C_SUCCESS_RSP; - + } else { DBG_871X("r871x_set_stakey_hdl(): sta has been free\n"); return H2C_REJECTED; } - + } //below for sta mode - + if(pparm->algorithm == _NO_PRIVACY_) // clear cam entry { clear_cam_entry(padapter, pparm->id); return H2C_SUCCESS; } - - ctrl = BIT(15) | ((pparm->algorithm) << 2); - + + ctrl = BIT(15) | ((pparm->algorithm) << 2); + #ifdef CONFIG_TDLS if(ptdlsinfo->clear_cam!=0){ clear_cam_entry(padapter, ptdlsinfo->clear_cam); @@ -11765,74 +11765,74 @@ u8 set_stakey_hdl(struct adapter *padapter, u8 *pbuf) write_cam(padapter, psta->mac_id, ctrl, pparm->addr, pparm->key); } else -#endif //CONFIG_TDLS +#endif //CONFIG_TDLS write_cam(padapter, cam_id, ctrl, pparm->addr, pparm->key); pmlmeinfo->enc_algo = pparm->algorithm; - + return H2C_SUCCESS; } u8 add_ba_hdl(struct adapter *padapter, unsigned char *pbuf) { - struct addBaReq_parm *pparm = (struct addBaReq_parm *)pbuf; + struct addBaReq_parm *pparm = (struct addBaReq_parm *)pbuf; struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); struct sta_info *psta = rtw_get_stainfo(&padapter->stapriv, pparm->addr); - + if(!psta) - return H2C_SUCCESS; - + return H2C_SUCCESS; + #ifdef CONFIG_80211N_HT if (((pmlmeinfo->state & WIFI_FW_ASSOC_SUCCESS) && (pmlmeinfo->HT_enable)) || ((pmlmeinfo->state&0x03) == WIFI_FW_AP_STATE)) { //pmlmeinfo->ADDBA_retry_count = 0; - //pmlmeinfo->candidate_tid_bitmap |= (0x1 << pparm->tid); + //pmlmeinfo->candidate_tid_bitmap |= (0x1 << pparm->tid); //psta->htpriv.candidate_tid_bitmap |= BIT(pparm->tid); issue_action_BA(padapter, pparm->addr, RTW_WLAN_ACTION_ADDBA_REQ, - pparm->tid); + pparm->tid); //_set_timer(&pmlmeext->ADDBA_timer, ADDBA_TO); _set_timer(&psta->addba_retry_timer, ADDBA_TO); } #ifdef CONFIG_TDLS - else if((psta->tdls_sta_state & TDLS_LINKED_STATE)&& - (psta->htpriv.ht_option==_TRUE) && + else if((psta->tdls_sta_state & TDLS_LINKED_STATE)&& + (psta->htpriv.ht_option==_TRUE) && (psta->htpriv.ampdu_enable==_TRUE) ) { issue_action_BA(padapter, pparm->addr, RTW_WLAN_ACTION_ADDBA_REQ, - pparm->tid); + pparm->tid); //_set_timer(&pmlmeext->ADDBA_timer, ADDBA_TO); _set_timer(&psta->addba_retry_timer, ADDBA_TO); } #endif //CONFIG else - { - psta->htpriv.candidate_tid_bitmap &= ~BIT(pparm->tid); + { + psta->htpriv.candidate_tid_bitmap &= ~BIT(pparm->tid); } #endif //CONFIG_80211N_HT - return H2C_SUCCESS; + return H2C_SUCCESS; } u8 set_tx_beacon_cmd(struct adapter* padapter) { struct cmd_obj *ph2c; - struct Tx_Beacon_param *ptxBeacon_parm; + struct Tx_Beacon_param *ptxBeacon_parm; struct cmd_priv *pcmdpriv = &(padapter->cmdpriv); struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); u8 res = _SUCCESS; int len_diff = 0; - -_func_enter_; - + +_func_enter_; + if ((ph2c = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj))) == NULL) { res= _FAIL; goto exit; } - + if ((ptxBeacon_parm = (struct Tx_Beacon_param *)rtw_zmalloc(sizeof(struct Tx_Beacon_param))) == NULL) { rtw_mfree((unsigned char *)ph2c, sizeof(struct cmd_obj)); @@ -11841,21 +11841,21 @@ _func_enter_; } _rtw_memcpy(&(ptxBeacon_parm->network), &(pmlmeinfo->network), sizeof(WLAN_BSSID_EX)); - + len_diff = update_hidden_ssid( ptxBeacon_parm->network.IEs+_BEACON_IE_OFFSET_ , ptxBeacon_parm->network.IELength-_BEACON_IE_OFFSET_ , pmlmeinfo->hidden_ssid_mode ); ptxBeacon_parm->network.IELength += len_diff; - + init_h2fwcmd_w_parm_no_rsp(ph2c, ptxBeacon_parm, GEN_CMD_CODE(_TX_Beacon)); res = rtw_enqueue_cmd(pcmdpriv, ph2c); - + exit: - + _func_exit_; return res; @@ -11866,7 +11866,7 @@ u8 mlme_evt_hdl(struct adapter *padapter, unsigned char *pbuf) { u8 evt_code, evt_seq; u16 evt_sz; - uint *peventbuf; + uint *peventbuf; void (*event_callback)(struct adapter *dev, u8 *pbuf); struct evt_priv *pevt_priv = &(padapter->evtpriv); @@ -11874,14 +11874,14 @@ u8 mlme_evt_hdl(struct adapter *padapter, unsigned char *pbuf) evt_sz = (u16)(*peventbuf&0xffff); evt_seq = (u8)((*peventbuf>>24)&0x7f); evt_code = (u8)((*peventbuf>>16)&0xff); - - + + #ifdef CHECK_EVENT_SEQ - // checking event sequence... + // checking event sequence... if (evt_seq != (ATOMIC_READ(&pevt_priv->event_seq) & 0x7f) ) { RT_TRACE(_module_rtl871x_cmd_c_,_drv_info_,("Evetn Seq Error! %d vs %d\n", (evt_seq & 0x7f), (ATOMIC_READ(&pevt_priv->event_seq) & 0x7f))); - + pevt_priv->event_seq = (evt_seq+1)&0x7f; goto _abort_event_; @@ -11895,21 +11895,21 @@ u8 mlme_evt_hdl(struct adapter *padapter, unsigned char *pbuf) goto _abort_event_; } - // checking if event size match the event parm size - if ((wlanevents[evt_code].parmsize != 0) && + // checking if event size match the event parm size + if ((wlanevents[evt_code].parmsize != 0) && (wlanevents[evt_code].parmsize != evt_sz)) { - - RT_TRACE(_module_rtl871x_cmd_c_,_drv_err_,("\nEvent(%d) Parm Size mismatch (%d vs %d)!\n", + + RT_TRACE(_module_rtl871x_cmd_c_,_drv_err_,("\nEvent(%d) Parm Size mismatch (%d vs %d)!\n", evt_code, wlanevents[evt_code].parmsize, evt_sz)); - goto _abort_event_; - + goto _abort_event_; + } ATOMIC_INC(&pevt_priv->event_seq); peventbuf += 2; - + if(peventbuf) { event_callback = wlanevents[evt_code].event_callback; @@ -11923,7 +11923,7 @@ _abort_event_: return H2C_SUCCESS; - + } u8 h2c_msg_hdl(struct adapter *padapter, unsigned char *pbuf) @@ -11942,22 +11942,22 @@ u8 tx_beacon_hdl(struct adapter *padapter, unsigned char *pbuf) return H2C_PARAMETERS_ERROR; } #ifdef CONFIG_AP_MODE - else //tx bc/mc frames after update TIM - { + else //tx bc/mc frames after update TIM + { _irqL irqL; struct sta_info *psta_bmc; _list *xmitframe_plist, *xmitframe_phead; struct xmit_frame *pxmitframe=NULL; struct xmit_priv *pxmitpriv = &padapter->xmitpriv; struct sta_priv *pstapriv = &padapter->stapriv; - + //for BC/MC Frames psta_bmc = rtw_get_bcmc_stainfo(padapter); if(!psta_bmc) return H2C_SUCCESS; - + if((pstapriv->tim_bitmap&BIT(0)) && (psta_bmc->sleepq_len>0)) - { + { #ifndef CONFIG_PCI_HCI rtw_msleep_os(10);// 10ms, ATIM(HIQ) Windows #endif @@ -11968,7 +11968,7 @@ u8 tx_beacon_hdl(struct adapter *padapter, unsigned char *pbuf) xmitframe_plist = get_next(xmitframe_phead); while ((rtw_end_of_queue_search(xmitframe_phead, xmitframe_plist)) == _FALSE) - { + { pxmitframe = LIST_CONTAINOR(xmitframe_plist, struct xmit_frame, list); xmitframe_plist = get_next(xmitframe_plist); @@ -11988,7 +11988,7 @@ u8 tx_beacon_hdl(struct adapter *padapter, unsigned char *pbuf) #if 0 _exit_critical_bh(&psta_bmc->sleep_q.lock, &irqL); if(rtw_hal_xmit(padapter, pxmitframe) == _TRUE) - { + { rtw_os_xmit_complete(padapter, pxmitframe); } _enter_critical_bh(&psta_bmc->sleep_q.lock, &irqL); @@ -11996,11 +11996,11 @@ u8 tx_beacon_hdl(struct adapter *padapter, unsigned char *pbuf) #endif rtw_hal_xmitframe_enqueue(padapter, pxmitframe); - //pstapriv->tim_bitmap &= ~BIT(0); - - } - - //_exit_critical_bh(&psta_bmc->sleep_q.lock, &irqL); + //pstapriv->tim_bitmap &= ~BIT(0); + + } + + //_exit_critical_bh(&psta_bmc->sleep_q.lock, &irqL); _exit_critical_bh(&pxmitpriv->lock, &irqL); //#if defined(CONFIG_PCI_HCI) || defined(CONFIG_SDIO_HCI) || defined(CONFIG_GSPI_HCI) @@ -12014,7 +12014,7 @@ u8 tx_beacon_hdl(struct adapter *padapter, unsigned char *pbuf) #endif return H2C_SUCCESS; - + } #ifdef CONFIG_DUALMAC_CONCURRENT @@ -12022,7 +12022,7 @@ void dc_SelectChannel(struct adapter *padapter, unsigned char channel) { struct adapter *ptarget_adapter; - if( (padapter->pbuddy_adapter != NULL) && + if( (padapter->pbuddy_adapter != NULL) && (padapter->DualMacConcurrent == _TRUE) && (padapter->adapter_type == SECONDARY_ADAPTER)) { @@ -12045,7 +12045,7 @@ void dc_SetBWMode(struct adapter *padapter, unsigned short bwmode, unsigned char { struct adapter *ptarget_adapter; - if( (padapter->pbuddy_adapter != NULL) && + if( (padapter->pbuddy_adapter != NULL) && (padapter->DualMacConcurrent == _TRUE) && (padapter->adapter_type == SECONDARY_ADAPTER)) { @@ -12122,7 +12122,7 @@ void dc_set_channel_bwmode_disconnect(struct adapter *padapter) struct adapter *pbuddy_adapter = padapter->pbuddy_adapter; struct mlme_priv *pbuddy_mlmepriv = NULL; - if(pbuddy_adapter != NULL && + if(pbuddy_adapter != NULL && padapter->DualMacConcurrent == _TRUE) { pbuddy_mlmepriv = &(pbuddy_adapter->mlmepriv); @@ -12150,12 +12150,12 @@ u8 dc_handle_join_request(struct adapter *padapter, u8 *ch, u8 *bw, u8 *offset) struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); WLAN_BSSID_EX *pnetwork = (WLAN_BSSID_EX*)(&(pmlmeinfo->network)); - struct adapter *pbuddy_adapter = padapter->pbuddy_adapter; + struct adapter *pbuddy_adapter = padapter->pbuddy_adapter; struct mlme_ext_priv *pbuddy_mlmeext = NULL; struct mlme_priv *pbuddy_mlmepriv = NULL; u8 ret = _SUCCESS; - if(pbuddy_adapter != NULL && + if(pbuddy_adapter != NULL && padapter->DualMacConcurrent == _TRUE) { pbuddy_mlmeext = &pbuddy_adapter->mlmeextpriv; @@ -12225,14 +12225,14 @@ void dc_handle_join_done(struct adapter *padapter, u8 join_res) u8 change_band = _FALSE; - if(pbuddy_adapter != NULL && + if(pbuddy_adapter != NULL && padapter->DualMacConcurrent == _TRUE) { pbuddy_mlmepriv = &(pbuddy_adapter->mlmepriv); pbuddy_mlmeext = &pbuddy_adapter->mlmeextpriv; pbuddy_mlmeinfo = &(pbuddy_mlmeext->mlmext_info); pbuddy_network_mlmeext = &(pbuddy_mlmeinfo->network); - + if(((pbuddy_mlmeinfo->state&0x03) == WIFI_FW_AP_STATE) && check_fwstate(pbuddy_mlmepriv, _FW_LINKED)) { @@ -12253,7 +12253,7 @@ void dc_handle_join_done(struct adapter *padapter, u8 join_res) //sync channel/bwmode/ch_offset with another adapter pbuddy_mlmeext->cur_channel = pmlmeext->cur_channel; - + if(pbuddy_mlmeext->cur_bwmode == HT_CHANNEL_WIDTH_40) { p = rtw_get_ie((pbuddy_network_mlmeext->IEs + sizeof(NDIS_802_11_FIXED_IEs)), _HT_ADD_INFO_IE_, &ie_len, (pbuddy_network_mlmeext->IELength - sizeof(NDIS_802_11_FIXED_IEs))); @@ -12261,8 +12261,8 @@ void dc_handle_join_done(struct adapter *padapter, u8 join_res) { pht_info = (struct HT_info_element *)(p+2); pht_info->infos[0] &= ~(BIT(0)|BIT(1)); //no secondary channel is present - } - + } + if(pmlmeext->cur_bwmode == HT_CHANNEL_WIDTH_40) { pbuddy_mlmeext->cur_ch_offset = pmlmeext->cur_ch_offset; @@ -12278,9 +12278,9 @@ void dc_handle_join_done(struct adapter *padapter, u8 join_res) case HAL_PRIME_CHNL_OFFSET_UPPER: pht_info->infos[0] |= 0x3; break; - case HAL_PRIME_CHNL_OFFSET_DONT_CARE: - default: - break; + case HAL_PRIME_CHNL_OFFSET_DONT_CARE: + default: + break; } } } @@ -12349,7 +12349,7 @@ void dc_handle_join_done(struct adapter *padapter, u8 join_res) { set_channel_bwmode(padapter, pbuddy_mlmeext->cur_channel, pbuddy_mlmeext->cur_ch_offset, pbuddy_mlmeext->cur_bwmode); } - + issue_nulldata(pbuddy_adapter, NULL, 0, 0, 0); } } @@ -12360,7 +12360,7 @@ sint dc_check_fwstate(_adapter *padapter, sint fw_state) struct adapter *pbuddy_adapter = padapter->pbuddy_adapter; struct mlme_priv *pbuddy_mlmepriv = NULL; - if(padapter->pbuddy_adapter != NULL && + if(padapter->pbuddy_adapter != NULL && padapter->DualMacConcurrent == _TRUE) { @@ -12376,17 +12376,17 @@ u8 dc_handle_site_survey(struct adapter *padapter) { struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); - struct adapter *pbuddy_adapter = padapter->pbuddy_adapter; + struct adapter *pbuddy_adapter = padapter->pbuddy_adapter; // only mac0 can do scan request, help issue nulldata(1) for mac1 - if(pbuddy_adapter != NULL && + if(pbuddy_adapter != NULL && padapter->DualMacConcurrent == _TRUE) { if (is_client_associated_to_ap(pbuddy_adapter) == _TRUE) { pmlmeext->sitesurvey_res.state = SCAN_TXNULL; - - issue_nulldata(pbuddy_adapter, NULL, 1, 2, 0); + + issue_nulldata(pbuddy_adapter, NULL, 1, 2, 0); return _TRUE; } @@ -12397,10 +12397,10 @@ u8 dc_handle_site_survey(struct adapter *padapter) void dc_report_survey_event(struct adapter *padapter, union recv_frame *precv_frame) { - if(padapter->pbuddy_adapter != NULL && + if(padapter->pbuddy_adapter != NULL && padapter->DualMacConcurrent == _TRUE) { - report_survey_event(padapter->pbuddy_adapter, precv_frame); + report_survey_event(padapter->pbuddy_adapter, precv_frame); } } @@ -12416,7 +12416,7 @@ void dc_set_channel_bwmode_survey_done(struct adapter *padapter) u8 cur_bwmode; u8 cur_ch_offset; - if(pbuddy_adapter != NULL && + if(pbuddy_adapter != NULL && padapter->DualMacConcurrent == _TRUE) { pbuddy_mlmepriv = &(pbuddy_adapter->mlmepriv); @@ -12450,7 +12450,7 @@ void dc_set_channel_bwmode_survey_done(struct adapter *padapter) if (is_client_associated_to_ap(pbuddy_adapter) == _TRUE) { - //issue null data + //issue null data issue_nulldata(pbuddy_adapter, NULL, 0, 0, 0); } @@ -12461,7 +12461,7 @@ void dc_set_channel_bwmode_survey_done(struct adapter *padapter) DBG_871X("survey done, current CH=%d, BW=%d, offset=%d\n", cur_channel, cur_bwmode, cur_ch_offset); DBG_871X("restart pbuddy_adapter's beacon\n"); - + update_beacon(pbuddy_adapter, 0, NULL, _TRUE); } } @@ -12475,7 +12475,7 @@ void dc_set_ap_channel_bandwidth(struct adapter *padapter, u8 channel, u8 channe { u8 *p; u8 val8, cur_channel, cur_bwmode, cur_ch_offset, change_band; - int ie_len; + int ie_len; struct registry_priv *pregpriv = &padapter->registrypriv; struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); WLAN_BSSID_EX *pnetwork = (WLAN_BSSID_EX *)&pmlmepriv->cur_network.network; @@ -12499,12 +12499,12 @@ void dc_set_ap_channel_bandwidth(struct adapter *padapter, u8 channel, u8 channe pht_info = (struct HT_info_element *)(p+2); } - if(pbuddy_adapter != NULL && + if(pbuddy_adapter != NULL && padapter->DualMacConcurrent == _TRUE) { pbuddy_mlmepriv = &(pbuddy_adapter->mlmepriv); pbuddy_mlmeext = &pbuddy_adapter->mlmeextpriv; - + if(!check_fwstate(pbuddy_mlmepriv, _FW_LINKED|_FW_UNDER_LINKING|_FW_UNDER_SURVEY)) { set_channel_bwmode(padapter, cur_channel, cur_ch_offset, cur_bwmode); @@ -12515,7 +12515,7 @@ void dc_set_ap_channel_bandwidth(struct adapter *padapter, u8 channel, u8 channe DBG_871X("Another iface is at linked state, sync cur_channel/cur_bwmode/cur_ch_offset\n"); DBG_871X("Another adapter, CH=%d, BW=%d, offset=%d\n", pbuddy_mlmeext->cur_channel, pbuddy_mlmeext->cur_bwmode, pbuddy_mlmeext->cur_ch_offset); DBG_871X("Current adapter, CH=%d, BW=%d, offset=%d\n", cur_channel, cur_bwmode, cur_ch_offset); - + cur_channel = pbuddy_mlmeext->cur_channel; if(cur_bwmode == HT_CHANNEL_WIDTH_40) { @@ -12528,7 +12528,7 @@ void dc_set_ap_channel_bandwidth(struct adapter *padapter, u8 channel, u8 channe //to update cur_ch_offset value in beacon if(pht_info) - { + { switch(cur_ch_offset) { case HAL_PRIME_CHNL_OFFSET_LOWER: @@ -12538,8 +12538,8 @@ void dc_set_ap_channel_bandwidth(struct adapter *padapter, u8 channel, u8 channe pht_info->infos[0] |= 0x3; break; case HAL_PRIME_CHNL_OFFSET_DONT_CARE: - default: - break; + default: + break; } } } @@ -12551,7 +12551,7 @@ void dc_set_ap_channel_bandwidth(struct adapter *padapter, u8 channel, u8 channe if(cur_channel>0 && cur_channel<5) { if(pht_info) - pht_info->infos[0] |= 0x1; + pht_info->infos[0] |= 0x1; cur_bwmode = HT_CHANNEL_WIDTH_40; cur_ch_offset = HAL_PRIME_CHNL_OFFSET_LOWER; @@ -12571,7 +12571,7 @@ void dc_set_ap_channel_bandwidth(struct adapter *padapter, u8 channel, u8 channe } // to update channel value in beacon - pnetwork->Configuration.DSConfig = cur_channel; + pnetwork->Configuration.DSConfig = cur_channel; p = rtw_get_ie((pnetwork->IEs + sizeof(NDIS_802_11_FIXED_IEs)), _DSSET_IE_, &ie_len, (pnetwork->IELength - sizeof(NDIS_802_11_FIXED_IEs))); if(p && ie_len>0) *(p + 2) = cur_channel; @@ -12606,8 +12606,8 @@ void dc_set_ap_channel_bandwidth(struct adapter *padapter, u8 channel, u8 channe void dc_resume_xmit(_adapter *padapter) { struct adapter *pbuddy_adapter = padapter->pbuddy_adapter; - - if(pbuddy_adapter != NULL && + + if(pbuddy_adapter != NULL && padapter->DualMacConcurrent == _TRUE) { DBG_871X("dc_resume_xmit, resume pbuddy_adapter Tx\n"); @@ -12620,7 +12620,7 @@ u8 dc_check_xmit(struct adapter *padapter) struct adapter *pbuddy_adapter = padapter->pbuddy_adapter; struct mlme_priv *pbuddy_mlmepriv = NULL; - if(pbuddy_adapter != NULL && + if(pbuddy_adapter != NULL && padapter->DualMacConcurrent == _TRUE) { pbuddy_mlmepriv = &(pbuddy_adapter->mlmepriv); @@ -12643,28 +12643,28 @@ sint check_buddy_mlmeinfo_state(struct adapter *padapter, u32 state) struct mlme_ext_info *pbuddy_mlmeinfo; if(padapter == NULL) - return _FALSE; - + return _FALSE; + pbuddy_adapter = padapter->pbuddy_adapter; if(pbuddy_adapter == NULL) - return _FALSE; + return _FALSE; pbuddy_mlmeext = &pbuddy_adapter->mlmeextpriv; pbuddy_mlmeinfo = &(pbuddy_mlmeext->mlmext_info); - + if((pbuddy_mlmeinfo->state&0x03) == state) - return _TRUE; + return _TRUE; return _FALSE; - + } void concurrent_chk_joinbss_done(struct adapter *padapter, int join_res) { struct mlme_ext_priv *pmlmeext; - struct mlme_ext_info *pmlmeinfo; + struct mlme_ext_info *pmlmeinfo; struct adapter *pbuddy_adapter; struct mlme_priv *pbuddy_mlmepriv; struct mlme_ext_priv *pbuddy_mlmeext; @@ -12694,14 +12694,14 @@ void concurrent_chk_joinbss_done(struct adapter *padapter, int join_res) DBG_871X("after join,primary adapter, CH=%d, BW=%d, offset=%d\n" , pmlmeext->cur_channel, pmlmeext->cur_bwmode, pmlmeext->cur_ch_offset); - + if(join_res >= 0) { u8 *p; int ie_len; struct HT_info_element *pht_info=NULL; - + //sync channel/bwmode/ch_offset with primary adapter pbuddy_mlmeext->cur_channel = pmlmeext->cur_channel; if(pbuddy_mlmeext->cur_bwmode == HT_CHANNEL_WIDTH_40) @@ -12712,7 +12712,7 @@ void concurrent_chk_joinbss_done(struct adapter *padapter, int join_res) pht_info = (struct HT_info_element *)(p+2); pht_info->infos[0] &= ~(BIT(0)|BIT(1)); //no secondary channel is present } - + if(pmlmeext->cur_bwmode == HT_CHANNEL_WIDTH_40) { pbuddy_mlmeext->cur_ch_offset = pmlmeext->cur_ch_offset; @@ -12728,20 +12728,20 @@ void concurrent_chk_joinbss_done(struct adapter *padapter, int join_res) case HAL_PRIME_CHNL_OFFSET_UPPER: pht_info->infos[0] |= 0x3; break; - case HAL_PRIME_CHNL_OFFSET_DONT_CARE: - default: - break; + case HAL_PRIME_CHNL_OFFSET_DONT_CARE: + default: + break; } - - } - + + } + } else if(pmlmeext->cur_bwmode == HT_CHANNEL_WIDTH_20) { if(pmlmeext->cur_channel>=1 && pmlmeext->cur_channel<=4) { if(pht_info) - pht_info->infos[0] |= HT_INFO_HT_PARAM_SECONDARY_CHNL_ABOVE; + pht_info->infos[0] |= HT_INFO_HT_PARAM_SECONDARY_CHNL_ABOVE; pbuddy_mlmeext->cur_bwmode = HT_CHANNEL_WIDTH_40; pbuddy_mlmeext->cur_ch_offset = HAL_PRIME_CHNL_OFFSET_LOWER; @@ -12750,9 +12750,9 @@ void concurrent_chk_joinbss_done(struct adapter *padapter, int join_res) { if(pht_info) pht_info->infos[0] |= HT_INFO_HT_PARAM_SECONDARY_CHNL_BELOW; - + pbuddy_mlmeext->cur_bwmode = HT_CHANNEL_WIDTH_40; - pbuddy_mlmeext->cur_ch_offset = HAL_PRIME_CHNL_OFFSET_UPPER; + pbuddy_mlmeext->cur_ch_offset = HAL_PRIME_CHNL_OFFSET_UPPER; } else { @@ -12771,7 +12771,7 @@ void concurrent_chk_joinbss_done(struct adapter *padapter, int join_res) case 157: { if(pht_info) - pht_info->infos[0] |= HT_INFO_HT_PARAM_SECONDARY_CHNL_ABOVE; + pht_info->infos[0] |= HT_INFO_HT_PARAM_SECONDARY_CHNL_ABOVE; pbuddy_mlmeext->cur_bwmode = HT_CHANNEL_WIDTH_40; pbuddy_mlmeext->cur_ch_offset = HAL_PRIME_CHNL_OFFSET_LOWER; break; @@ -12790,7 +12790,7 @@ void concurrent_chk_joinbss_done(struct adapter *padapter, int join_res) { if(pht_info) pht_info->infos[0] |= HT_INFO_HT_PARAM_SECONDARY_CHNL_BELOW; - + pbuddy_mlmeext->cur_bwmode = HT_CHANNEL_WIDTH_40; pbuddy_mlmeext->cur_ch_offset = HAL_PRIME_CHNL_OFFSET_UPPER; break; @@ -12800,16 +12800,16 @@ void concurrent_chk_joinbss_done(struct adapter *padapter, int join_res) pht_info->infos[0] &= ~HT_INFO_HT_PARAM_SECONDARY_CHNL_BELOW; pbuddy_mlmeext->cur_bwmode = HT_CHANNEL_WIDTH_20; pbuddy_mlmeext->cur_ch_offset = HAL_PRIME_CHNL_OFFSET_DONT_CARE; - break; + break; } - + } } set_channel_bwmode(padapter, pbuddy_mlmeext->cur_channel, pbuddy_mlmeext->cur_ch_offset, pbuddy_mlmeext->cur_bwmode); - + } else { @@ -12818,7 +12818,7 @@ void concurrent_chk_joinbss_done(struct adapter *padapter, int join_res) // to update channel value in beacon - pbuddy_network_mlmeext->Configuration.DSConfig = pmlmeext->cur_channel; + pbuddy_network_mlmeext->Configuration.DSConfig = pmlmeext->cur_channel; p = rtw_get_ie((pbuddy_network_mlmeext->IEs + sizeof(NDIS_802_11_FIXED_IEs)), _DSSET_IE_, &ie_len, (pbuddy_network_mlmeext->IELength - sizeof(NDIS_802_11_FIXED_IEs))); if(p && ie_len>0) *(p + 2) = pmlmeext->cur_channel; @@ -12829,7 +12829,7 @@ void concurrent_chk_joinbss_done(struct adapter *padapter, int join_res) pht_info = (struct HT_info_element *)(p+2); pht_info->primary_channel = pmlmeext->cur_channel; } - + } else { @@ -12840,20 +12840,20 @@ void concurrent_chk_joinbss_done(struct adapter *padapter, int join_res) DBG_871X("after join, second adapter, CH=%d, BW=%d, offset=%d\n", pbuddy_mlmeext->cur_channel, pbuddy_mlmeext->cur_bwmode, pbuddy_mlmeext->cur_ch_offset); DBG_871X("update pbuddy_adapter's beacon\n"); - + update_beacon(pbuddy_adapter, 0, NULL, _TRUE); } else if(((pbuddy_mlmeinfo->state&0x03) == WIFI_FW_STATION_STATE) && check_fwstate(pbuddy_mlmepriv, _FW_LINKED)) - { + { if(join_res >= 0) - { + { pbuddy_mlmeext->cur_channel = pmlmeext->cur_channel; if(pbuddy_mlmeext->cur_bwmode == HT_CHANNEL_WIDTH_40) - set_channel_bwmode(padapter, pbuddy_mlmeext->cur_channel, pbuddy_mlmeext->cur_ch_offset, pbuddy_mlmeext->cur_bwmode); + set_channel_bwmode(padapter, pbuddy_mlmeext->cur_channel, pbuddy_mlmeext->cur_ch_offset, pbuddy_mlmeext->cur_bwmode); else if(pmlmeext->cur_bwmode == HT_CHANNEL_WIDTH_40) - set_channel_bwmode(padapter, pmlmeext->cur_channel, pmlmeext->cur_ch_offset, pmlmeext->cur_bwmode); + set_channel_bwmode(padapter, pmlmeext->cur_channel, pmlmeext->cur_ch_offset, pmlmeext->cur_bwmode); else set_channel_bwmode(padapter, pmlmeext->cur_channel, HAL_PRIME_CHNL_OFFSET_DONT_CARE, HT_CHANNEL_WIDTH_20); } @@ -12861,13 +12861,13 @@ void concurrent_chk_joinbss_done(struct adapter *padapter, int join_res) { // switch back to original channel/bwmode/ch_offset; set_channel_bwmode(padapter, pbuddy_mlmeext->cur_channel, pbuddy_mlmeext->cur_ch_offset, pbuddy_mlmeext->cur_bwmode); - } + } } else { set_channel_bwmode(padapter, pmlmeext->cur_channel, pmlmeext->cur_ch_offset, pmlmeext->cur_bwmode); } - + } #endif //CONFIG_CONCURRENT_MODE @@ -12890,7 +12890,7 @@ int rtw_chk_start_clnt_join(struct adapter *padapter, u8 *ch, u8 *bw, u8 *offset goto exit; } - pbuddy_adapter = padapter->pbuddy_adapter; + pbuddy_adapter = padapter->pbuddy_adapter; pbuddy_mlmeext = &pbuddy_adapter->mlmeextpriv; pbuddy_pmlmeinfo = &(pbuddy_mlmeext->mlmext_info); pbuddy_mlmepriv = &(pbuddy_adapter->mlmepriv); @@ -12977,7 +12977,7 @@ int rtw_chk_start_clnt_join(struct adapter *padapter, u8 *ch, u8 *bw, u8 *offset rtw_indicate_disconnect(pbuddy_adapter); rtw_free_assoc_resources(pbuddy_adapter, 1); } - } + } exit: #endif /* CONFIG_CONCURRENT_MODE */ @@ -13074,7 +13074,7 @@ u8 set_ch_hdl(struct adapter *padapter, u8 *pbuf) set_channel_bwmode(padapter, set_ch_parm->ch, set_ch_parm->ch_offset, set_ch_parm->bw); - return H2C_SUCCESS; + return H2C_SUCCESS; } u8 set_chplan_hdl(struct adapter *padapter, unsigned char *pbuf) @@ -13089,9 +13089,9 @@ u8 set_chplan_hdl(struct adapter *padapter, unsigned char *pbuf) setChannelPlan_param = (struct SetChannelPlan_param *)pbuf; pmlmeext->max_chan_nums = init_channel_set(padapter, setChannelPlan_param->channel_plan, pmlmeext->channel_set); - init_channel_list(padapter, pmlmeext->channel_set, pmlmeext->max_chan_nums, &pmlmeext->channel_list); + init_channel_list(padapter, pmlmeext->channel_set, pmlmeext->max_chan_nums, &pmlmeext->channel_list); - return H2C_SUCCESS; + return H2C_SUCCESS; } u8 led_blink_hdl(struct adapter *padapter, unsigned char *pbuf) @@ -13107,7 +13107,7 @@ u8 led_blink_hdl(struct adapter *padapter, unsigned char *pbuf) BlinkHandler(ledBlink_param->pLed); #endif - return H2C_SUCCESS; + return H2C_SUCCESS; } u8 set_csa_hdl(struct adapter *padapter, unsigned char *pbuf) @@ -13142,7 +13142,7 @@ u8 set_csa_hdl(struct adapter *padapter, unsigned char *pbuf) DBG_871X("Switched to DFS band (ch %02x) again!!\n", new_ch_no); } - return H2C_SUCCESS; + return H2C_SUCCESS; #else return H2C_REJECTED; #endif //CONFIG_DFS @@ -13189,7 +13189,7 @@ u8 tdls_hdl(struct adapter *padapter, unsigned char *pbuf) //_enter_critical_bh(&(ptdlsinfo->hdl_lock), &irqL); DBG_871X("[%s] option:%d\n", __FUNCTION__, option); - + switch(option){ case TDLS_WRCR: //As long as TDLS handshake success, we should set RCR_CBSSID_DATA bit to 0 @@ -13208,8 +13208,8 @@ u8 tdls_hdl(struct adapter *padapter, unsigned char *pbuf) _cancel_timer_ex(&ptdls_sta->base_ch_timer); _cancel_timer_ex(&ptdls_sta->off_ch_timer); SelectChannel(padapter, pmlmeext->cur_channel); - ptdls_sta->tdls_sta_state &= ~(TDLS_CH_SWITCH_ON_STATE | - TDLS_PEER_AT_OFF_STATE | + ptdls_sta->tdls_sta_state &= ~(TDLS_CH_SWITCH_ON_STATE | + TDLS_PEER_AT_OFF_STATE | TDLS_AT_OFF_CH_STATE); DBG_871X("go back to base channel\n "); issue_nulldata(padapter, NULL, 0, 0, 0); @@ -13276,8 +13276,8 @@ u8 tdls_hdl(struct adapter *padapter, unsigned char *pbuf) _cancel_timer_ex(&ptdls_sta->base_ch_timer); _cancel_timer_ex(&ptdls_sta->off_ch_timer); SelectChannel(padapter, pmlmeext->cur_channel); - ptdls_sta->tdls_sta_state &= ~(TDLS_CH_SWITCH_ON_STATE | - TDLS_PEER_AT_OFF_STATE | + ptdls_sta->tdls_sta_state &= ~(TDLS_CH_SWITCH_ON_STATE | + TDLS_PEER_AT_OFF_STATE | TDLS_AT_OFF_CH_STATE); DBG_871X("go back to base channel\n "); issue_nulldata(padapter, NULL, 0, 0, 0); @@ -13298,7 +13298,7 @@ u8 tdls_hdl(struct adapter *padapter, unsigned char *pbuf) if((ptdls_sta->tdls_sta_state & TDLS_PEER_AT_OFF_STATE) != TDLS_PEER_AT_OFF_STATE){ issue_nulldata_to_TDLS_peer_STA(padapter, ptdls_sta, 0); } - _set_timer(&ptdls_sta->base_ch_timer, TDLS_STAY_TIME); + _set_timer(&ptdls_sta->base_ch_timer, TDLS_STAY_TIME); break; case TDLS_RS_RCR: rtw_hal_set_hwreg(padapter, HW_VAR_TDLS_RS_RCR, 0); @@ -13313,7 +13313,7 @@ u8 tdls_hdl(struct adapter *padapter, unsigned char *pbuf) case TDLS_FREE_STA: free_tdls_sta(padapter, ptdls_sta); break; - + } //_exit_critical_bh(&(ptdlsinfo->hdl_lock), &irqL); @@ -13324,4 +13324,3 @@ u8 tdls_hdl(struct adapter *padapter, unsigned char *pbuf) #endif //CONFIG_TDLS } - diff --git a/core/rtw_mp_ioctl.c b/core/rtw_mp_ioctl.c index 0ed5944..6314596 100755 --- a/core/rtw_mp_ioctl.c +++ b/core/rtw_mp_ioctl.c @@ -1,7 +1,7 @@ /****************************************************************************** * * 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. @@ -176,7 +176,7 @@ _func_enter_; path, offset, value)); _irqlevel_changed_(&oldirql, LOWER); - write_rfreg(Adapter, path, offset, value); + write_rfreg(Adapter, path, offset, value); _irqlevel_changed_(&oldirql, RAISE); _func_exit_; @@ -828,7 +828,7 @@ NDIS_STATUS oid_rt_pro_set_single_tone_tx_hdl(struct oid_par_priv *poid_par_priv #ifdef PLATFORM_OS_XP _irqL oldirql; #endif - u32 bStartTest; + u32 bStartTest; NDIS_STATUS status = NDIS_STATUS_SUCCESS; PADAPTER Adapter = (PADAPTER)(poid_par_priv->adapter_context); @@ -924,7 +924,7 @@ NDIS_STATUS oid_rt_pro_read_register_hdl(struct oid_par_priv *poid_par_priv) #ifdef PLATFORM_OS_XP _irqL oldirql; #endif - pRW_Reg RegRWStruct; + pRW_Reg RegRWStruct; u32 offset, width; NDIS_STATUS status = NDIS_STATUS_SUCCESS; PADAPTER Adapter = (PADAPTER)(poid_par_priv->adapter_context); @@ -976,7 +976,7 @@ NDIS_STATUS oid_rt_pro_write_register_hdl(struct oid_par_priv *poid_par_priv) #ifdef PLATFORM_OS_XP _irqL oldirql; #endif - pRW_Reg RegRWStruct; + pRW_Reg RegRWStruct; u32 offset, width, value; NDIS_STATUS status = NDIS_STATUS_SUCCESS; PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context); @@ -1125,7 +1125,7 @@ _func_enter_; TxCmd_Info=(TX_CMD_Desc*)poid_par_priv->information_buf; RT_TRACE(_module_mp_, _drv_info_, ("WRITE_TXCMD:Addr=%.8X\n", TxCmd_Info->offset)); - RT_TRACE(_module_mp_, _drv_info_, ("WRITE_TXCMD:1.)%.8X\n", (ULONG)TxCmd_Info->TxCMD.value[0])); + RT_TRACE(_module_mp_, _drv_info_, ("WRITE_TXCMD:1.)%.8X\n", (ULONG)TxCmd_Info->TxCMD.value[0])); RT_TRACE(_module_mp_, _drv_info_, ("WRITE_TXCMD:2.)%.8X\n", (ULONG)TxCmd_Info->TxCMD.value[1])); RT_TRACE(_module_mp_, _drv_info_, (("WRITE_TXCMD:3.)%.8X\n", (ULONG)TxCmd_Info->TxCMD.value[2])); RT_TRACE(_module_mp_, _drv_info_, ("WRITE_TXCMD:4.)%.8X\n", (ULONG)TxCmd_Info->TxCMD.value[3])); @@ -1929,7 +1929,7 @@ NDIS_STATUS oid_rt_pro_add_sta_info_hdl(struct oid_par_priv *poid_par_priv) NDIS_STATUS status = NDIS_STATUS_SUCCESS; struct sta_info *psta = NULL; - UCHAR *macaddr; + UCHAR *macaddr; if (poid_par_priv->type_of_oid != SET_OID) @@ -2693,7 +2693,7 @@ NDIS_STATUS oid_rt_pro_set_tx_agc_offset_hdl(struct oid_par_priv *poid_par_priv) #endif NDIS_STATUS status = NDIS_STATUS_SUCCESS; - u32 txagc; + u32 txagc; _func_enter_; @@ -2728,7 +2728,7 @@ NDIS_STATUS oid_rt_pro_set_pkt_test_mode_hdl(struct oid_par_priv *poid_par_priv) struct mlme_priv *pmlmepriv = &Adapter->mlmepriv; struct mp_priv *pmppriv = &Adapter->mppriv; - u32 type; + u32 type; _func_enter_; @@ -2944,4 +2944,3 @@ _func_exit_; return 0; #endif } - diff --git a/core/rtw_odm.c b/core/rtw_odm.c index fae9127..ecfd6ae 100755 --- a/core/rtw_odm.c +++ b/core/rtw_odm.c @@ -203,4 +203,3 @@ void rtw_odm_adaptivity_parm_set(struct adapter *adapter, s8 TH_L2H_ini, s8 TH_E odm->AdapEn_RSSI = AdapEn_RSSI; odm->IGI_LowerBound = IGI_LowerBound; } - diff --git a/core/rtw_p2p.c b/core/rtw_p2p.c index 4d4f032..bffdb66 100755 --- a/core/rtw_p2p.c +++ b/core/rtw_p2p.c @@ -1,7 +1,7 @@ /****************************************************************************** * * 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. @@ -68,19 +68,19 @@ static u32 go_add_group_info_attr(struct wifidirect_info *pwdinfo, u8 *pbuf) plist = get_next(phead); //look up sta asoc_queue - while ((rtw_end_of_queue_search(phead, plist)) == _FALSE) - { + while ((rtw_end_of_queue_search(phead, plist)) == _FALSE) + { psta = LIST_CONTAINOR(plist, struct sta_info, asoc_list); - + plist = get_next(plist); - + if(psta->is_p2p_device) { tmplen = 0; - + pcur++; - + //P2P device address _rtw_memcpy(pcur, psta->dev_addr, ETH_ALEN); pcur += ETH_ALEN; @@ -104,7 +104,7 @@ static u32 go_add_group_info_attr(struct wifidirect_info *pwdinfo, u8 *pbuf) _rtw_memcpy(pcur, psta->secdev_types_list, psta->num_of_secdev_type*8); pcur += psta->num_of_secdev_type*8; - + if(psta->dev_name_len>0) { //*(u16*)(pcur) = cpu_to_be16( WPS_ATTR_DEVICE_NAME ); @@ -121,17 +121,17 @@ static u32 go_add_group_info_attr(struct wifidirect_info *pwdinfo, u8 *pbuf) tmplen = (u8)(pcur-pstart); - + *pstart = (tmplen-1); attr_len += tmplen; //pstart += tmplen; pstart = pcur; - + } - - + + } _exit_critical_bh(&pstapriv->asoc_list_lock, &irqL); @@ -155,8 +155,8 @@ static void issue_group_disc_req(struct wifidirect_info *pwdinfo, u8 *da) unsigned short *fctrl; struct adapter *padapter = pwdinfo->padapter; struct xmit_priv *pxmitpriv = &(padapter->xmitpriv); - struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); - unsigned char category = RTW_WLAN_CATEGORY_P2P;//P2P action frame + struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); + unsigned char category = RTW_WLAN_CATEGORY_P2P;//P2P action frame u32 p2poui = cpu_to_be32(P2POUI); u8 oui_subtype = P2P_GO_DISC_REQUEST; u8 dialogToken=0; @@ -192,10 +192,10 @@ static void issue_group_disc_req(struct wifidirect_info *pwdinfo, u8 *da) pattrib->pktlen = sizeof(struct rtw_ieee80211_hdr_3addr); //Build P2P action frame header - pframe = rtw_set_fixed_ie(pframe, 1, &(category), &(pattrib->pktlen)); + pframe = rtw_set_fixed_ie(pframe, 1, &(category), &(pattrib->pktlen)); pframe = rtw_set_fixed_ie(pframe, 4, (unsigned char *) &(p2poui), &(pattrib->pktlen)); - pframe = rtw_set_fixed_ie(pframe, 1, &(oui_subtype), &(pattrib->pktlen)); - pframe = rtw_set_fixed_ie(pframe, 1, &(dialogToken), &(pattrib->pktlen)); + pframe = rtw_set_fixed_ie(pframe, 1, &(oui_subtype), &(pattrib->pktlen)); + pframe = rtw_set_fixed_ie(pframe, 1, &(dialogToken), &(pattrib->pktlen)); //there is no IE in this P2P action frame @@ -206,7 +206,7 @@ static void issue_group_disc_req(struct wifidirect_info *pwdinfo, u8 *da) } static void issue_p2p_devdisc_resp(struct wifidirect_info *pwdinfo, u8 *da, u8 status, u8 dialogToken) -{ +{ struct xmit_frame *pmgntframe; struct pkt_attrib *pattrib; unsigned char *pframe; @@ -214,16 +214,16 @@ static void issue_p2p_devdisc_resp(struct wifidirect_info *pwdinfo, u8 *da, u8 s unsigned short *fctrl; struct adapter *padapter = pwdinfo->padapter; struct xmit_priv *pxmitpriv = &(padapter->xmitpriv); - struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); + struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); unsigned char category = RTW_WLAN_CATEGORY_PUBLIC; u8 action = P2P_PUB_ACTION_ACTION; u32 p2poui = cpu_to_be32(P2POUI); u8 oui_subtype = P2P_DEVDISC_RESP; u8 p2pie[8] = { 0x00 }; - u32 p2pielen = 0; + u32 p2pielen = 0; DBG_871X("[%s]\n", __FUNCTION__); - + if ((pmgntframe = alloc_mgtxmitframe(pxmitpriv)) == NULL) { return; @@ -256,8 +256,8 @@ static void issue_p2p_devdisc_resp(struct wifidirect_info *pwdinfo, u8 *da, u8 s pframe = rtw_set_fixed_ie(pframe, 1, &(category), &(pattrib->pktlen)); pframe = rtw_set_fixed_ie(pframe, 1, &(action), &(pattrib->pktlen)); pframe = rtw_set_fixed_ie(pframe, 4, (unsigned char *) &(p2poui), &(pattrib->pktlen)); - pframe = rtw_set_fixed_ie(pframe, 1, &(oui_subtype), &(pattrib->pktlen)); - pframe = rtw_set_fixed_ie(pframe, 1, &(dialogToken), &(pattrib->pktlen)); + pframe = rtw_set_fixed_ie(pframe, 1, &(oui_subtype), &(pattrib->pktlen)); + pframe = rtw_set_fixed_ie(pframe, 1, &(dialogToken), &(pattrib->pktlen)); //Build P2P IE @@ -270,8 +270,8 @@ static void issue_p2p_devdisc_resp(struct wifidirect_info *pwdinfo, u8 *da, u8 s // P2P_ATTR_STATUS p2pielen += rtw_set_p2p_attr_content(&p2pie[p2pielen], P2P_ATTR_STATUS, 1, &status); - - pframe = rtw_set_ie(pframe, _VENDOR_SPECIFIC_IE_, p2pielen, p2pie, &pattrib->pktlen); + + pframe = rtw_set_ie(pframe, _VENDOR_SPECIFIC_IE_, p2pielen, p2pie, &pattrib->pktlen); pattrib->last_txcmdsz = pattrib->pktlen; @@ -291,8 +291,8 @@ static void issue_p2p_provision_resp(struct wifidirect_info *pwdinfo, u8* raddr, u8 wpsielen = 0; #ifdef CONFIG_WFD u32 wfdielen = 0; -#endif //CONFIG_WFD - +#endif //CONFIG_WFD + struct xmit_frame *pmgntframe; struct pkt_attrib *pattrib; unsigned char *pframe; @@ -334,8 +334,8 @@ static void issue_p2p_provision_resp(struct wifidirect_info *pwdinfo, u8* raddr, pframe = rtw_set_fixed_ie(pframe, 1, &(category), &(pattrib->pktlen)); pframe = rtw_set_fixed_ie(pframe, 1, &(action), &(pattrib->pktlen)); pframe = rtw_set_fixed_ie(pframe, 4, (unsigned char *) &(p2poui), &(pattrib->pktlen)); - pframe = rtw_set_fixed_ie(pframe, 1, &(oui_subtype), &(pattrib->pktlen)); - pframe = rtw_set_fixed_ie(pframe, 1, &(dialogToken), &(pattrib->pktlen)); + pframe = rtw_set_fixed_ie(pframe, 1, &(oui_subtype), &(pattrib->pktlen)); + pframe = rtw_set_fixed_ie(pframe, 1, &(dialogToken), &(pattrib->pktlen)); wpsielen = 0; // WPS OUI @@ -373,7 +373,7 @@ static void issue_p2p_provision_resp(struct wifidirect_info *pwdinfo, u8* raddr, RTW_PUT_BE16(wpsie + wpsielen, config_method); wpsielen += 2; - pframe = rtw_set_ie(pframe, _VENDOR_SPECIFIC_IE_, wpsielen, (unsigned char *) wpsie, &pattrib->pktlen ); + pframe = rtw_set_ie(pframe, _VENDOR_SPECIFIC_IE_, wpsielen, (unsigned char *) wpsie, &pattrib->pktlen ); #ifdef CONFIG_WFD wfdielen = build_provdisc_resp_wfd_ie(pwdinfo, pframe); @@ -398,10 +398,10 @@ static void issue_p2p_presence_resp(struct wifidirect_info *pwdinfo, u8 *da, u8 unsigned short *fctrl; struct adapter *padapter = pwdinfo->padapter; struct xmit_priv *pxmitpriv = &(padapter->xmitpriv); - struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); - unsigned char category = RTW_WLAN_CATEGORY_P2P;//P2P action frame + struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); + unsigned char category = RTW_WLAN_CATEGORY_P2P;//P2P action frame u32 p2poui = cpu_to_be32(P2POUI); - u8 oui_subtype = P2P_PRESENCE_RESPONSE; + u8 oui_subtype = P2P_PRESENCE_RESPONSE; u8 p2pie[ MAX_P2P_IE_LEN] = { 0x00 }; u8 noa_attr_content[32] = { 0x00 }; u32 p2pielen = 0; @@ -437,10 +437,10 @@ static void issue_p2p_presence_resp(struct wifidirect_info *pwdinfo, u8 *da, u8 pattrib->pktlen = sizeof(struct rtw_ieee80211_hdr_3addr); //Build P2P action frame header - pframe = rtw_set_fixed_ie(pframe, 1, &(category), &(pattrib->pktlen)); + pframe = rtw_set_fixed_ie(pframe, 1, &(category), &(pattrib->pktlen)); pframe = rtw_set_fixed_ie(pframe, 4, (unsigned char *) &(p2poui), &(pattrib->pktlen)); - pframe = rtw_set_fixed_ie(pframe, 1, &(oui_subtype), &(pattrib->pktlen)); - pframe = rtw_set_fixed_ie(pframe, 1, &(dialogToken), &(pattrib->pktlen)); + pframe = rtw_set_fixed_ie(pframe, 1, &(oui_subtype), &(pattrib->pktlen)); + pframe = rtw_set_fixed_ie(pframe, 1, &(dialogToken), &(pattrib->pktlen)); //Add P2P IE header @@ -451,22 +451,22 @@ static void issue_p2p_presence_resp(struct wifidirect_info *pwdinfo, u8 *da, u8 p2pie[ p2pielen++ ] = 0x9A; p2pie[ p2pielen++ ] = 0x09; // WFA P2P v1.0 - //Add Status attribute in P2P IE + //Add Status attribute in P2P IE p2pielen += rtw_set_p2p_attr_content(&p2pie[p2pielen], P2P_ATTR_STATUS, 1, &status); //Add NoA attribute in P2P IE noa_attr_content[0] = 0x1;//index noa_attr_content[1] = 0x0;//CTWindow and OppPS Parameters - + //todo: Notice of Absence Descriptor(s) - + p2pielen += rtw_set_p2p_attr_content(&p2pie[p2pielen], P2P_ATTR_NOA, 2, noa_attr_content); pframe = rtw_set_ie(pframe, _VENDOR_SPECIFIC_IE_, p2pielen, p2pie, &(pattrib->pktlen)); - + pattrib->last_txcmdsz = pattrib->pktlen; dump_mgntframe(padapter, pmgntframe); @@ -478,7 +478,7 @@ u32 build_beacon_p2p_ie(struct wifidirect_info *pwdinfo, u8 *pbuf) u8 p2pie[ MAX_P2P_IE_LEN] = { 0x00 }; u16 capability=0; u32 len=0, p2pielen = 0; - + // P2P OUI p2pielen = 0; @@ -491,7 +491,7 @@ u32 build_beacon_p2p_ie(struct wifidirect_info *pwdinfo, u8 *pbuf) // According to the P2P Specification, the beacon frame should contain 3 P2P attributes // 1. P2P Capability // 2. P2P Device ID - // 3. Notice of Absence ( NOA ) + // 3. Notice of Absence ( NOA ) // P2P Capability ATTR // Type: @@ -499,8 +499,8 @@ u32 build_beacon_p2p_ie(struct wifidirect_info *pwdinfo, u8 *pbuf) // Value: // Device Capability Bitmap, 1 byte // Be able to participate in additional P2P Groups and - // support the P2P Invitation Procedure - // Group Capability Bitmap, 1 byte + // support the P2P Invitation Procedure + // Group Capability Bitmap, 1 byte capability = P2P_DEVCAP_INVITATION_PROC|P2P_DEVCAP_CLIENT_DISCOVERABILITY; capability |= ((P2P_GRPCAP_GO | P2P_GRPCAP_INTRABSS) << 8); if(rtw_p2p_chk_state(pwdinfo, P2P_STATE_PROVISIONING_ING)) @@ -510,24 +510,24 @@ u32 build_beacon_p2p_ie(struct wifidirect_info *pwdinfo, u8 *pbuf) p2pielen += rtw_set_p2p_attr_content(&p2pie[p2pielen], P2P_ATTR_CAPABILITY, 2, (u8*)&capability); - + // P2P Device ID ATTR p2pielen += rtw_set_p2p_attr_content(&p2pie[p2pielen], P2P_ATTR_DEVICE_ID, ETH_ALEN, pwdinfo->device_addr); - + // Notice of Absence ATTR - // Type: + // Type: // Length: // Value: - + //go_add_noa_attr(pwdinfo); - - + + pbuf = rtw_set_ie(pbuf, _VENDOR_SPECIFIC_IE_, p2pielen, (unsigned char *) p2pie, &len); - - + + return len; - + } #ifdef CONFIG_WFD @@ -570,7 +570,7 @@ u32 build_beacon_wfd_ie(struct wifidirect_info *pwdinfo, u8 *pbuf) if ( is_any_client_associated( pwdinfo->padapter ) ) { // WFD primary sink + WiFi Direct mode + WSD (WFD Service Discovery) - RTW_PUT_BE16(wfdie + wfdielen, pwfd_info->wfd_device_type | WFD_DEVINFO_WSD ); + RTW_PUT_BE16(wfdie + wfdielen, pwfd_info->wfd_device_type | WFD_DEVINFO_WSD ); } else { @@ -584,7 +584,7 @@ u32 build_beacon_wfd_ie(struct wifidirect_info *pwdinfo, u8 *pbuf) // WFD primary sink + available for WFD session + WiFi Direct mode + WSD ( WFD Service Discovery ) RTW_PUT_BE16(wfdie + wfdielen, pwfd_info->wfd_device_type | WFD_DEVINFO_SESSION_AVAIL | WFD_DEVINFO_WSD ); } - + wfdielen += 2; // Value2: @@ -645,7 +645,7 @@ u32 build_beacon_wfd_ie(struct wifidirect_info *pwdinfo, u8 *pbuf) pbuf = rtw_set_ie(pbuf, _VENDOR_SPECIFIC_IE_, wfdielen, (unsigned char *) wfdie, &len); return len; - + } u32 build_probe_req_wfd_ie(struct wifidirect_info *pwdinfo, u8 *pbuf) @@ -684,17 +684,17 @@ u32 build_probe_req_wfd_ie(struct wifidirect_info *pwdinfo, u8 *pbuf) if ( 1 == pwdinfo->wfd_tdls_enable ) { - // WFD primary sink + available for WFD session + WiFi TDLS mode + WSC ( WFD Service Discovery ) - RTW_PUT_BE16(wfdie + wfdielen, pwfd_info->wfd_device_type | - WFD_DEVINFO_SESSION_AVAIL | + // WFD primary sink + available for WFD session + WiFi TDLS mode + WSC ( WFD Service Discovery ) + RTW_PUT_BE16(wfdie + wfdielen, pwfd_info->wfd_device_type | + WFD_DEVINFO_SESSION_AVAIL | WFD_DEVINFO_WSD | WFD_DEVINFO_PC_TDLS ); } else { - // WFD primary sink + available for WFD session + WiFi Direct mode + WSC ( WFD Service Discovery ) + // WFD primary sink + available for WFD session + WiFi Direct mode + WSC ( WFD Service Discovery ) RTW_PUT_BE16(wfdie + wfdielen, pwfd_info->wfd_device_type | - WFD_DEVINFO_SESSION_AVAIL | + WFD_DEVINFO_SESSION_AVAIL | WFD_DEVINFO_WSD ); } @@ -758,7 +758,7 @@ u32 build_probe_req_wfd_ie(struct wifidirect_info *pwdinfo, u8 *pbuf) pbuf = rtw_set_ie(pbuf, _VENDOR_SPECIFIC_IE_, wfdielen, (unsigned char *) wfdie, &len); return len; - + } u32 build_probe_resp_wfd_ie(struct wifidirect_info *pwdinfo, u8 *pbuf, u8 tunneled) @@ -796,7 +796,7 @@ u32 build_probe_resp_wfd_ie(struct wifidirect_info *pwdinfo, u8 *pbuf, u8 tunnel // Value1: // WFD device information // WFD primary sink + available for WFD session + WiFi Direct mode - + if ( _TRUE == pwdinfo->session_available ) { if ( P2P_ROLE_GO == pwdinfo->role ) @@ -812,7 +812,7 @@ u32 build_probe_resp_wfd_ie(struct wifidirect_info *pwdinfo, u8 *pbuf, u8 tunnel { // WiFi Direct mode + WSD ( WFD Service Discovery ) RTW_PUT_BE16(wfdie + wfdielen, pwfd_info->wfd_device_type | WFD_DEVINFO_WSD | WFD_DEVINFO_HDCP_SUPPORT); - } + } } else { @@ -825,7 +825,7 @@ u32 build_probe_resp_wfd_ie(struct wifidirect_info *pwdinfo, u8 *pbuf, u8 tunnel { // available for WFD session + WiFi Direct mode + WSD ( WFD Service Discovery ) RTW_PUT_BE16(wfdie + wfdielen, pwfd_info->wfd_device_type | WFD_DEVINFO_SESSION_AVAIL | WFD_DEVINFO_WSD | WFD_DEVINFO_HDCP_SUPPORT); - } + } } } else @@ -953,14 +953,14 @@ u32 build_probe_resp_wfd_ie(struct wifidirect_info *pwdinfo, u8 *pbuf, u8 tunnel pbuf = rtw_set_ie(pbuf, _VENDOR_SPECIFIC_IE_, wfdielen, (unsigned char *) wfdie, &len); return len; - + } u32 build_assoc_req_wfd_ie(struct wifidirect_info *pwdinfo, u8 *pbuf) { u8 wfdie[ MAX_WFD_IE_LEN] = { 0x00 }; u32 len=0, wfdielen = 0; - struct adapter *padapter = NULL; + struct adapter *padapter = NULL; struct mlme_priv *pmlmepriv = NULL; struct wifi_display_info *pwfd_info = NULL; @@ -973,7 +973,7 @@ u32 build_assoc_req_wfd_ie(struct wifidirect_info *pwdinfo, u8 *pbuf) padapter = pwdinfo->padapter; pmlmepriv = &padapter->mlmepriv; pwfd_info = padapter->wdinfo.wfd_info; - + wfdielen = 0; wfdie[ wfdielen++ ] = 0x50; wfdie[ wfdielen++ ] = 0x6F; @@ -1060,7 +1060,7 @@ u32 build_assoc_req_wfd_ie(struct wifidirect_info *pwdinfo, u8 *pbuf) pbuf = rtw_set_ie(pbuf, _VENDOR_SPECIFIC_IE_, wfdielen, (unsigned char *) wfdie, &len); return len; - + } u32 build_assoc_resp_wfd_ie(struct wifidirect_info *pwdinfo, u8 *pbuf) @@ -1158,7 +1158,7 @@ u32 build_assoc_resp_wfd_ie(struct wifidirect_info *pwdinfo, u8 *pbuf) pbuf = rtw_set_ie(pbuf, _VENDOR_SPECIFIC_IE_, wfdielen, (unsigned char *) wfdie, &len); return len; - + } u32 build_nego_req_wfd_ie(struct wifidirect_info *pwdinfo, u8 *pbuf) @@ -1256,7 +1256,7 @@ u32 build_nego_req_wfd_ie(struct wifidirect_info *pwdinfo, u8 *pbuf) pbuf = rtw_set_ie(pbuf, _VENDOR_SPECIFIC_IE_, wfdielen, (unsigned char *) wfdie, &len); return len; - + } u32 build_nego_resp_wfd_ie(struct wifidirect_info *pwdinfo, u8 *pbuf) @@ -1355,7 +1355,7 @@ u32 build_nego_resp_wfd_ie(struct wifidirect_info *pwdinfo, u8 *pbuf) pbuf = rtw_set_ie(pbuf, _VENDOR_SPECIFIC_IE_, wfdielen, (unsigned char *) wfdie, &len); return len; - + } u32 build_nego_confirm_wfd_ie(struct wifidirect_info *pwdinfo, u8 *pbuf) @@ -1454,7 +1454,7 @@ u32 build_nego_confirm_wfd_ie(struct wifidirect_info *pwdinfo, u8 *pbuf) pbuf = rtw_set_ie(pbuf, _VENDOR_SPECIFIC_IE_, wfdielen, (unsigned char *) wfdie, &len); return len; - + } u32 build_invitation_req_wfd_ie(struct wifidirect_info *pwdinfo, u8 *pbuf) @@ -1567,7 +1567,7 @@ u32 build_invitation_req_wfd_ie(struct wifidirect_info *pwdinfo, u8 *pbuf) pbuf = rtw_set_ie(pbuf, _VENDOR_SPECIFIC_IE_, wfdielen, (unsigned char *) wfdie, &len); return len; - + } u32 build_invitation_resp_wfd_ie(struct wifidirect_info *pwdinfo, u8 *pbuf) @@ -1680,7 +1680,7 @@ u32 build_invitation_resp_wfd_ie(struct wifidirect_info *pwdinfo, u8 *pbuf) pbuf = rtw_set_ie(pbuf, _VENDOR_SPECIFIC_IE_, wfdielen, (unsigned char *) wfdie, &len); return len; - + } u32 build_provdisc_req_wfd_ie(struct wifidirect_info *pwdinfo, u8 *pbuf) @@ -1779,7 +1779,7 @@ u32 build_provdisc_req_wfd_ie(struct wifidirect_info *pwdinfo, u8 *pbuf) pbuf = rtw_set_ie(pbuf, _VENDOR_SPECIFIC_IE_, wfdielen, (unsigned char *) wfdie, &len); return len; - + } u32 build_provdisc_resp_wfd_ie(struct wifidirect_info *pwdinfo, u8 *pbuf) @@ -1877,7 +1877,7 @@ u32 build_provdisc_resp_wfd_ie(struct wifidirect_info *pwdinfo, u8 *pbuf) pbuf = rtw_set_ie(pbuf, _VENDOR_SPECIFIC_IE_, wfdielen, (unsigned char *) wfdie, &len); return len; - + } @@ -1886,7 +1886,7 @@ u32 build_provdisc_resp_wfd_ie(struct wifidirect_info *pwdinfo, u8 *pbuf) u32 build_probe_resp_p2p_ie(struct wifidirect_info *pwdinfo, u8 *pbuf) { u8 p2pie[ MAX_P2P_IE_LEN] = { 0x00 }; - u32 len=0, p2pielen = 0; + u32 len=0, p2pielen = 0; #ifdef CONFIG_INTEL_WIDI struct mlme_priv *pmlmepriv = &(pwdinfo->padapter->mlmepriv); u8 zero_array_check[L2SDTA_SERVICE_VE_LEN] = { 0x00 }; @@ -1929,7 +1929,7 @@ u32 build_probe_resp_p2p_ie(struct wifidirect_info *pwdinfo, u8 *pbuf) // Value: // Device Capability Bitmap, 1 byte p2pie[ p2pielen++ ] = DMP_P2P_DEVCAP_SUPPORT; - + // Group Capability Bitmap, 1 byte if(rtw_p2p_chk_role(pwdinfo, P2P_ROLE_GO)) { @@ -1971,20 +1971,20 @@ u32 build_probe_resp_p2p_ie(struct wifidirect_info *pwdinfo, u8 *pbuf) // Notice of Absence ATTR - // Type: + // Type: // Length: // Value: if(rtw_p2p_chk_role(pwdinfo, P2P_ROLE_GO)) { //go_add_noa_attr(pwdinfo); - } + } // Device Info ATTR // Type: p2pie[ p2pielen++ ] = P2P_ATTR_DEVICE_INFO; // Length: - // 21 -> P2P Device Address (6bytes) + Config Methods (2bytes) + Primary Device Type (8bytes) + // 21 -> P2P Device Address (6bytes) + Config Methods (2bytes) + Primary Device Type (8bytes) // + NumofSecondDevType (1byte) + WPS Device Name ID field (2bytes) + WPS Device Name Len field (2bytes) //*(u16*) ( p2pie + p2pielen ) = cpu_to_le16( 21 + pwdinfo->device_name_len ); #ifdef CONFIG_INTEL_WIDI @@ -2056,7 +2056,7 @@ u32 build_probe_resp_p2p_ie(struct wifidirect_info *pwdinfo, u8 *pbuf) if( widi_version == 35 ) { p2pie[ p2pielen++ ] = 0x01; - + RTW_PUT_BE16(p2pie + p2pielen, WPS_PDT_CID_DISPLAYS); p2pielen += 2; @@ -2109,18 +2109,18 @@ u32 build_probe_resp_p2p_ie(struct wifidirect_info *pwdinfo, u8 *pbuf) p2pielen += go_add_group_info_attr(pwdinfo, p2pie + p2pielen); } - + pbuf = rtw_set_ie(pbuf, _VENDOR_SPECIFIC_IE_, p2pielen, (unsigned char *) p2pie, &len); - + return len; - + } u32 build_prov_disc_request_p2p_ie(struct wifidirect_info *pwdinfo, u8 *pbuf, u8* pssid, u8 ussidlen, u8* pdev_raddr ) { u8 p2pie[ MAX_P2P_IE_LEN] = { 0x00 }; - u32 len=0, p2pielen = 0; + u32 len=0, p2pielen = 0; // P2P OUI p2pielen = 0; @@ -2147,7 +2147,7 @@ u32 build_prov_disc_request_p2p_ie(struct wifidirect_info *pwdinfo, u8 *pbuf, u8 // Value: // Device Capability Bitmap, 1 byte p2pie[ p2pielen++ ] = DMP_P2P_DEVCAP_SUPPORT; - + // Group Capability Bitmap, 1 byte if ( pwdinfo->persistent_supported ) p2pie[ p2pielen++ ] = P2P_GRPCAP_PERSISTENT_GROUP | DMP_P2P_GRPCAP_SUPPORT; @@ -2160,7 +2160,7 @@ u32 build_prov_disc_request_p2p_ie(struct wifidirect_info *pwdinfo, u8 *pbuf, u8 p2pie[ p2pielen++ ] = P2P_ATTR_DEVICE_INFO; // Length: - // 21 -> P2P Device Address (6bytes) + Config Methods (2bytes) + Primary Device Type (8bytes) + // 21 -> P2P Device Address (6bytes) + Config Methods (2bytes) + Primary Device Type (8bytes) // + NumofSecondDevType (1byte) + WPS Device Name ID field (2bytes) + WPS Device Name Len field (2bytes) //*(u16*) ( p2pie + p2pielen ) = cpu_to_le16( 21 + pwdinfo->device_name_len ); RTW_PUT_LE16(p2pie + p2pielen, 21 + pwdinfo->device_name_len); @@ -2224,7 +2224,7 @@ u32 build_prov_disc_request_p2p_ie(struct wifidirect_info *pwdinfo, u8 *pbuf, u8 { // Added by Albert 2011/05/19 // In this case, the pdev_raddr is the device address of the group owner. - + // P2P Group ID ATTR // Type: p2pie[ p2pielen++ ] = P2P_ATTR_GROUP_ID; @@ -2240,21 +2240,21 @@ u32 build_prov_disc_request_p2p_ie(struct wifidirect_info *pwdinfo, u8 *pbuf, u8 _rtw_memcpy( p2pie + p2pielen, pssid, ussidlen ); p2pielen += ussidlen; - + } pbuf = rtw_set_ie(pbuf, _VENDOR_SPECIFIC_IE_, p2pielen, (unsigned char *) p2pie, &len); - + return len; - + } u32 build_assoc_resp_p2p_ie(struct wifidirect_info *pwdinfo, u8 *pbuf, u8 status_code) { u8 p2pie[ MAX_P2P_IE_LEN] = { 0x00 }; - u32 len=0, p2pielen = 0; + u32 len=0, p2pielen = 0; // P2P OUI p2pielen = 0; @@ -2279,20 +2279,20 @@ u32 build_assoc_resp_p2p_ie(struct wifidirect_info *pwdinfo, u8 *pbuf, u8 status pbuf = rtw_set_ie(pbuf, _VENDOR_SPECIFIC_IE_, p2pielen, (unsigned char *) p2pie, &len); - + return len; - + } u32 build_deauth_p2p_ie(struct wifidirect_info *pwdinfo, u8 *pbuf) { u32 len=0; - + return len; } u32 process_probe_req_p2p_ie(struct wifidirect_info *pwdinfo, u8 *pframe, uint len) -{ +{ u8 *p; u32 ret=_FALSE; u8 *p2pie; @@ -2340,7 +2340,7 @@ u32 process_probe_req_p2p_ie(struct wifidirect_info *pwdinfo, u8 *pframe, uint l // 6. Device ID attribute in P2P IE. (Todo) p = rtw_get_ie(pframe + WLAN_HDR_A3_LEN + _PROBEREQ_IE_OFFSET_, _SSID_IE_, (int *)&ssid_len, - len - WLAN_HDR_A3_LEN - _PROBEREQ_IE_OFFSET_); + len - WLAN_HDR_A3_LEN - _PROBEREQ_IE_OFFSET_); ssid_len &= 0xff; // Just last 1 byte is valid for ssid len of the probe request if(rtw_p2p_chk_role(pwdinfo, P2P_ROLE_DEVICE) || rtw_p2p_chk_role(pwdinfo, P2P_ROLE_GO)) @@ -2353,7 +2353,7 @@ u32 process_probe_req_p2p_ie(struct wifidirect_info *pwdinfo, u8 *pframe, uint l //Check Requested Device Type attributes in WSC IE. //Check Device ID attribute in P2P IE - ret = _TRUE; + ret = _TRUE; } else if ( (p != NULL) && ( ssid_len == 0 ) ) { @@ -2364,12 +2364,12 @@ u32 process_probe_req_p2p_ie(struct wifidirect_info *pwdinfo, u8 *pframe, uint l { //non -p2p device } - - } - + } + + return ret; - + } u32 process_assoc_req_p2p_ie(struct wifidirect_info *pwdinfo, u8 *pframe, uint len, struct sta_info *psta) @@ -2391,12 +2391,12 @@ u32 process_assoc_req_p2p_ie(struct wifidirect_info *pwdinfo, u8 *pframe, uint l if (frame_type == WIFI_ASSOCREQ) { ie_offset = _ASOCREQ_IE_OFFSET_; - } + } else // WIFI_REASSOCREQ { ie_offset = _REASOCREQ_IE_OFFSET_; } - + ies = pframe + WLAN_HDR_A3_LEN + ie_offset; ies_len = len - WLAN_HDR_A3_LEN - ie_offset; @@ -2411,7 +2411,7 @@ u32 process_assoc_req_p2p_ie(struct wifidirect_info *pwdinfo, u8 *pframe, uint l { DBG_8192C( "[%s] P2P IE Found!!\n", __FUNCTION__ ); } - + while ( p2p_ie ) { //Check P2P Capability ATTR @@ -2423,22 +2423,22 @@ u32 process_assoc_req_p2p_ie(struct wifidirect_info *pwdinfo, u8 *pframe, uint l } //Check Extended Listen Timing ATTR - + //Check P2P Device Info ATTR if(rtw_get_p2p_attr_content(p2p_ie, p2p_ielen, P2P_ATTR_DEVICE_INFO, NULL, (uint*)&attr_contentlen)) { - DBG_8192C( "[%s] Got P2P DEVICE INFO Attr!!\n", __FUNCTION__ ); + DBG_8192C( "[%s] Got P2P DEVICE INFO Attr!!\n", __FUNCTION__ ); pattr_content = pbuf = rtw_zmalloc(attr_contentlen); if(pattr_content) { u8 num_of_secdev_type; u16 dev_name_len; - - + + rtw_get_p2p_attr_content(p2p_ie, p2p_ielen, P2P_ATTR_DEVICE_INFO , pattr_content, (uint*)&attr_contentlen); - _rtw_memcpy(psta->dev_addr, pattr_content, ETH_ALEN);//P2P Device Address + _rtw_memcpy(psta->dev_addr, pattr_content, ETH_ALEN);//P2P Device Address pattr_content += ETH_ALEN; @@ -2467,7 +2467,7 @@ u32 process_assoc_req_p2p_ie(struct wifidirect_info *pwdinfo, u8 *pframe, uint l len = (sizeof(psta->secdev_types_list)<(num_of_secdev_type*8)) ? (sizeof(psta->secdev_types_list)) : (num_of_secdev_type*8); _rtw_memcpy(psta->secdev_types_list, pattr_content, len); - + pattr_content += (num_of_secdev_type*8); } @@ -2475,7 +2475,7 @@ u32 process_assoc_req_p2p_ie(struct wifidirect_info *pwdinfo, u8 *pframe, uint l //dev_name_len = attr_contentlen - ETH_ALEN - 2 - 8 - 1 - (num_of_secdev_type*8); psta->dev_name_len=0; if(WPS_ATTR_DEVICE_NAME == be16_to_cpu(*(u16*)pattr_content)) - { + { dev_name_len = be16_to_cpu(*(u16*)(pattr_content+2)); psta->dev_name_len = (sizeof(psta->dev_name)dev_name):dev_name_len; @@ -2491,7 +2491,7 @@ u32 process_assoc_req_p2p_ie(struct wifidirect_info *pwdinfo, u8 *pframe, uint l //Get the next P2P IE p2p_ie = rtw_get_p2p_ie(p2p_ie+p2p_ielen, ies_len -(p2p_ie -ies + p2p_ielen), NULL, &p2p_ielen); - + } return status_code; @@ -2506,39 +2506,39 @@ u32 process_p2p_devdisc_req(struct wifidirect_info *pwdinfo, u8 *pframe, uint le struct adapter *padapter = pwdinfo->padapter; struct sta_priv *pstapriv = &padapter->stapriv; u8 *p2p_ie; - u32 p2p_ielen = 0; - + u32 p2p_ielen = 0; + frame_body = (unsigned char *)(pframe + sizeof(struct rtw_ieee80211_hdr_3addr)); dialogToken = frame_body[7]; status = P2P_STATUS_FAIL_UNKNOWN_P2PGROUP; - + if ( (p2p_ie=rtw_get_p2p_ie( frame_body + _PUBLIC_ACTION_IE_OFFSET_, len - _PUBLIC_ACTION_IE_OFFSET_, NULL, &p2p_ielen)) ) { u8 groupid[ 38 ] = { 0x00 }; - u8 dev_addr[ETH_ALEN] = { 0x00 }; + u8 dev_addr[ETH_ALEN] = { 0x00 }; u32 attr_contentlen = 0; if(rtw_get_p2p_attr_content(p2p_ie, p2p_ielen, P2P_ATTR_GROUP_ID, groupid, &attr_contentlen)) { - if(_rtw_memcmp(pwdinfo->device_addr, groupid, ETH_ALEN) && + if(_rtw_memcmp(pwdinfo->device_addr, groupid, ETH_ALEN) && _rtw_memcmp(pwdinfo->p2p_group_ssid, groupid+ETH_ALEN, pwdinfo->p2p_group_ssid_len)) { attr_contentlen=0; if(rtw_get_p2p_attr_content(p2p_ie, p2p_ielen, P2P_ATTR_DEVICE_ID, dev_addr, &attr_contentlen)) { _irqL irqL; - _list *phead, *plist; + _list *phead, *plist; _enter_critical_bh(&pstapriv->asoc_list_lock, &irqL); phead = &pstapriv->asoc_list; plist = get_next(phead); //look up sta asoc_queue - while ((rtw_end_of_queue_search(phead, plist)) == _FALSE) - { + while ((rtw_end_of_queue_search(phead, plist)) == _FALSE) + { psta = LIST_CONTAINOR(plist, struct sta_info, asoc_list); - + plist = get_next(plist); if(psta->is_p2p_device && (psta->dev_cap&P2P_DEVCAP_CLIENT_DISCOVERABILITY) && @@ -2549,19 +2549,19 @@ u32 process_p2p_devdisc_req(struct wifidirect_info *pwdinfo, u8 *pframe, uint le //issue GO Discoverability Request issue_group_disc_req(pwdinfo, psta->hwaddr); //_enter_critical_bh(&pstapriv->asoc_list_lock, &irqL); - + status = P2P_STATUS_SUCCESS; - + break; } else { status = P2P_STATUS_FAIL_INFO_UNAVAILABLE; } - - } + + } _exit_critical_bh(&pstapriv->asoc_list_lock, &irqL); - + } else { @@ -2573,18 +2573,18 @@ u32 process_p2p_devdisc_req(struct wifidirect_info *pwdinfo, u8 *pframe, uint le { status = P2P_STATUS_FAIL_INVALID_PARAM; } - - } - + + } + } - + //issue Device Discoverability Response issue_p2p_devdisc_resp(pwdinfo, GetAddr2Ptr(pframe), status, dialogToken); - - + + return (status==P2P_STATUS_SUCCESS) ? _TRUE:_FALSE; - + } u32 process_p2p_devdisc_resp(struct wifidirect_info *pwdinfo, u8 *pframe, uint len) @@ -2598,7 +2598,7 @@ u8 process_p2p_provdisc_req(struct wifidirect_info *pwdinfo, u8 *pframe, uint l u8 *wpsie; uint wps_ielen = 0, attr_contentlen = 0; u16 uconfig_method = 0; - + frame_body = (pframe + sizeof(struct rtw_ieee80211_hdr_3addr)); @@ -2635,9 +2635,9 @@ u8 process_p2p_provdisc_req(struct wifidirect_info *pwdinfo, u8 *pframe, uint l } DBG_871X( "[%s] config method = %s\n", __FUNCTION__, pwdinfo->rx_prov_disc_info.strconfig_method_desc_of_prov_disc_req ); return _TRUE; - + } - + u8 process_p2p_provdisc_resp(struct wifidirect_info *pwdinfo, u8 *pframe) { @@ -2721,7 +2721,7 @@ u8 process_p2p_group_negotation_req( struct wifidirect_info *pwdinfo, u8 *pframe u32 wfd_ielen = 0; #ifdef CONFIG_TDLS struct tdls_info *ptdlsinfo = &padapter->tdlsinfo; -#endif // CONFIG_TDLS +#endif // CONFIG_TDLS #endif // CONFIG_WFD #ifdef CONFIG_CONCURRENT_MODE struct adapter *pbuddy_adapter = pwdinfo->padapter->pbuddy_adapter; @@ -2746,11 +2746,11 @@ u8 process_p2p_group_negotation_req( struct wifidirect_info *pwdinfo, u8 *pframe } else if ( wps_devicepassword_id == WPS_DPID_REGISTRAR_SPEC ) { - _rtw_memcpy( pwdinfo->rx_prov_disc_info.strconfig_method_desc_of_prov_disc_req, "pad", 3 ); + _rtw_memcpy( pwdinfo->rx_prov_disc_info.strconfig_method_desc_of_prov_disc_req, "pad", 3 ); } else { - _rtw_memcpy( pwdinfo->rx_prov_disc_info.strconfig_method_desc_of_prov_disc_req, "pbc", 3 ); + _rtw_memcpy( pwdinfo->rx_prov_disc_info.strconfig_method_desc_of_prov_disc_req, "pbc", 3 ); } } } @@ -2771,7 +2771,7 @@ u8 process_p2p_group_negotation_req( struct wifidirect_info *pwdinfo, u8 *pframe ies = pframe + _PUBLIC_ACTION_IE_OFFSET_; ies_len = len - _PUBLIC_ACTION_IE_OFFSET_; - + p2p_ie = rtw_get_p2p_ie( ies, ies_len, NULL, &p2p_ielen ); if ( !p2p_ie ) @@ -2780,7 +2780,7 @@ u8 process_p2p_group_negotation_req( struct wifidirect_info *pwdinfo, u8 *pframe result = P2P_STATUS_FAIL_INCOMPATIBLE_PARAM; rtw_p2p_set_state(pwdinfo, P2P_STATE_GONEGO_FAIL); } - + while ( p2p_ie ) { u8 attr_content = 0x00; @@ -2799,7 +2799,7 @@ u8 process_p2p_group_negotation_req( struct wifidirect_info *pwdinfo, u8 *pframe if(rtw_get_p2p_attr_content(p2p_ie, p2p_ielen, P2P_ATTR_CAPABILITY, (u8*)&cap_attr, (uint*)&attr_contentlen) ) { cap_attr = le16_to_cpu(cap_attr); - + #if defined(CONFIG_WFD) && defined(CONFIG_TDLS) if(!(cap_attr & P2P_GRPCAP_INTRABSS) ) ptdlsinfo->ap_prohibited = _TRUE; @@ -2829,7 +2829,7 @@ u8 process_p2p_group_negotation_req( struct wifidirect_info *pwdinfo, u8 *pframe { rtw_p2p_set_role(pwdinfo, P2P_ROLE_GO); } - } + } } else if ( pwdinfo->intent > ( pwdinfo->peer_intent >> 1 ) ) { @@ -2844,11 +2844,11 @@ u8 process_p2p_group_negotation_req( struct wifidirect_info *pwdinfo, u8 *pframe { // Store the group id information. _rtw_memcpy( pwdinfo->groupid_info.go_device_addr, pwdinfo->device_addr, ETH_ALEN ); - _rtw_memcpy( pwdinfo->groupid_info.ssid, pwdinfo->nego_ssid, pwdinfo->nego_ssidlen ); + _rtw_memcpy( pwdinfo->groupid_info.ssid, pwdinfo->nego_ssid, pwdinfo->nego_ssidlen ); } } - + attr_contentlen = 0; if ( rtw_get_p2p_attr_content( p2p_ie, p2p_ielen, P2P_ATTR_INTENTED_IF_ADDR, pwdinfo->p2p_peer_interface_addr, &attr_contentlen ) ) { @@ -2873,7 +2873,7 @@ u8 process_p2p_group_negotation_req( struct wifidirect_info *pwdinfo, u8 *pframe if(rtw_p2p_chk_role(pwdinfo, P2P_ROLE_GO)) { - if ( !rtw_p2p_is_channel_list_ok( pwdinfo->operating_channel, + if ( !rtw_p2p_is_channel_list_ok( pwdinfo->operating_channel, ch_list_inclusioned, ch_num_inclusioned) ) { #ifdef CONFIG_CONCURRENT_MODE @@ -2891,11 +2891,11 @@ u8 process_p2p_group_negotation_req( struct wifidirect_info *pwdinfo, u8 *pframe attr_contentlen = 0; if ( rtw_get_p2p_attr_content(p2p_ie, p2p_ielen, P2P_ATTR_OPERATING_CH, operatingch_info, &attr_contentlen) ) - { + { peer_operating_ch = operatingch_info[4]; } - if ( rtw_p2p_is_channel_list_ok( peer_operating_ch, + if ( rtw_p2p_is_channel_list_ok( peer_operating_ch, ch_list_inclusioned, ch_num_inclusioned) ) { /** @@ -2919,7 +2919,7 @@ u8 process_p2p_group_negotation_req( struct wifidirect_info *pwdinfo, u8 *pframe //Get the next P2P IE p2p_ie = rtw_get_p2p_ie(p2p_ie+p2p_ielen, ies_len -(p2p_ie -ies + p2p_ielen), NULL, &p2p_ielen); } - + #ifdef CONFIG_WFD // Added by Albert 20110823 // Try to get the TCP port information when receiving the negotiation request. @@ -2954,14 +2954,14 @@ u8 process_p2p_group_negotation_resp( struct wifidirect_info *pwdinfo, u8 *pfram u32 wfd_ielen = 0; #ifdef CONFIG_TDLS struct tdls_info *ptdlsinfo = &padapter->tdlsinfo; -#endif // CONFIG_TDLS +#endif // CONFIG_TDLS #endif // CONFIG_WFD ies = pframe + _PUBLIC_ACTION_IE_OFFSET_; ies_len = len - _PUBLIC_ACTION_IE_OFFSET_; // Be able to know which one is the P2P GO and which one is P2P client. - + if ( rtw_get_wps_ie( ies, ies_len, NULL, &wps_ielen) ) { @@ -3010,7 +3010,7 @@ u8 process_p2p_group_negotation_resp( struct wifidirect_info *pwdinfo, u8 *pfram rtw_get_p2p_attr_content(p2p_ie, p2p_ielen, P2P_ATTR_STATUS, &attr_content, &attr_contentlen); if ( attr_contentlen == 1 ) - { + { DBG_871X( "[%s] Status = %d\n", __FUNCTION__, attr_content ); if ( attr_content == P2P_STATUS_SUCCESS ) { @@ -3038,7 +3038,7 @@ u8 process_p2p_group_negotation_resp( struct wifidirect_info *pwdinfo, u8 *pfram _rtw_memset( pwdinfo->p2p_peer_interface_addr, 0x00, ETH_ALEN ); } } - + // Try to get the peer's intent and tie breaker value. attr_content = 0x00; attr_contentlen = 0; @@ -3068,7 +3068,7 @@ u8 process_p2p_group_negotation_resp( struct wifidirect_info *pwdinfo, u8 *pfram { rtw_p2p_set_role(pwdinfo, P2P_ROLE_GO); } - } + } } else if ( pwdinfo->intent > ( pwdinfo->peer_intent >> 1 ) ) { @@ -3088,19 +3088,19 @@ u8 process_p2p_group_negotation_resp( struct wifidirect_info *pwdinfo, u8 *pfram // Store the group id information. _rtw_memcpy( pwdinfo->groupid_info.go_device_addr, pwdinfo->device_addr, ETH_ALEN ); _rtw_memcpy( pwdinfo->groupid_info.ssid, pwdinfo->nego_ssid, pwdinfo->nego_ssidlen ); - + } } - + // Try to get the operation channel information - + attr_contentlen = 0; if ( rtw_get_p2p_attr_content(p2p_ie, p2p_ielen, P2P_ATTR_OPERATING_CH, operatingch_info, &attr_contentlen)) { DBG_871X( "[%s] Peer's operating channel = %d\n", __FUNCTION__, operatingch_info[4] ); pwdinfo->peer_operating_ch = operatingch_info[4]; } - + // Try to get the channel list information if ( rtw_get_p2p_attr_content(p2p_ie, p2p_ielen, P2P_ATTR_CH_LIST, pwdinfo->channel_list_attr, &pwdinfo->channel_list_attr_len ) ) { @@ -3119,7 +3119,7 @@ u8 process_p2p_group_negotation_resp( struct wifidirect_info *pwdinfo, u8 *pfram if(rtw_p2p_chk_role(pwdinfo, P2P_ROLE_GO)) { - if ( !rtw_p2p_is_channel_list_ok( pwdinfo->operating_channel, + if ( !rtw_p2p_is_channel_list_ok( pwdinfo->operating_channel, ch_list_inclusioned, ch_num_inclusioned) ) { #ifdef CONFIG_CONCURRENT_MODE @@ -3137,11 +3137,11 @@ u8 process_p2p_group_negotation_resp( struct wifidirect_info *pwdinfo, u8 *pfram attr_contentlen = 0; if ( rtw_get_p2p_attr_content(p2p_ie, p2p_ielen, P2P_ATTR_OPERATING_CH, operatingch_info, &attr_contentlen) ) - { + { peer_operating_ch = operatingch_info[4]; } - if ( rtw_p2p_is_channel_list_ok( peer_operating_ch, + if ( rtw_p2p_is_channel_list_ok( peer_operating_ch, ch_list_inclusioned, ch_num_inclusioned) ) { /** @@ -3175,11 +3175,11 @@ u8 process_p2p_group_negotation_resp( struct wifidirect_info *pwdinfo, u8 *pfram _rtw_memcpy( pwdinfo->groupid_info.go_device_addr, &groupid[0], ETH_ALEN ); _rtw_memcpy( pwdinfo->groupid_info.ssid, &groupid[6], attr_contentlen - ETH_ALEN ); } - + //Get the next P2P IE p2p_ie = rtw_get_p2p_ie(p2p_ie+p2p_ielen, ies_len -(p2p_ie -ies + p2p_ielen), NULL, &p2p_ielen); } - + } #ifdef CONFIG_WFD @@ -3231,7 +3231,7 @@ u8 process_p2p_group_negotation_confirm( struct wifidirect_info *pwdinfo, u8 *pf if ( attr_content == P2P_STATUS_SUCCESS ) { u8 bcancelled = 0; - + _cancel_timer( &pwdinfo->restore_p2p_state_timer, &bcancelled ); // Commented by Albert 20100911 @@ -3257,15 +3257,15 @@ u8 process_p2p_group_negotation_confirm( struct wifidirect_info *pwdinfo, u8 *pf { rtw_p2p_set_role(pwdinfo, P2P_ROLE_GO); } - } - + } + #ifdef CONFIG_CONCURRENT_MODE if ( check_buddy_fwstate(pwdinfo->padapter , _FW_LINKED ) ) { // Switch back to the AP channel soon. _set_timer( &pwdinfo->ap_p2p_switch_timer, 100 ); } -#endif +#endif } else { @@ -3282,19 +3282,19 @@ u8 process_p2p_group_negotation_confirm( struct wifidirect_info *pwdinfo, u8 *pf { DBG_871X( "[%s] Ssid = %s, ssidlen = %zu\n", __FUNCTION__, &groupid[ETH_ALEN], strlen(&groupid[ETH_ALEN]) ); _rtw_memcpy( pwdinfo->groupid_info.go_device_addr, &groupid[0], ETH_ALEN ); - _rtw_memcpy( pwdinfo->groupid_info.ssid, &groupid[6], attr_contentlen - ETH_ALEN ); + _rtw_memcpy( pwdinfo->groupid_info.ssid, &groupid[6], attr_contentlen - ETH_ALEN ); } attr_contentlen = 0; if ( rtw_get_p2p_attr_content(p2p_ie, p2p_ielen, P2P_ATTR_OPERATING_CH, operatingch_info, &attr_contentlen) ) - { + { DBG_871X( "[%s] Peer's operating channel = %d\n", __FUNCTION__, operatingch_info[4] ); pwdinfo->peer_operating_ch = operatingch_info[4]; } //Get the next P2P IE p2p_ie = rtw_get_p2p_ie(p2p_ie+p2p_ielen, ies_len -(p2p_ie -ies + p2p_ielen), NULL, &p2p_ielen); - + } return( result ); @@ -3302,10 +3302,10 @@ u8 process_p2p_group_negotation_confirm( struct wifidirect_info *pwdinfo, u8 *pf u8 process_p2p_presence_req(struct wifidirect_info *pwdinfo, u8 *pframe, uint len) { - u8 *frame_body; + u8 *frame_body; u8 dialogToken=0; u8 status = P2P_STATUS_SUCCESS; - + frame_body = (unsigned char *)(pframe + sizeof(struct rtw_ieee80211_hdr_3addr)); dialogToken = frame_body[6]; @@ -3321,7 +3321,7 @@ void find_phase_handler( struct adapter* padapter ) { struct wifidirect_info *pwdinfo = &padapter->wdinfo; struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - NDIS_802_11_SSID ssid; + NDIS_802_11_SSID ssid; _irqL irqL; u8 _status = 0; @@ -3332,7 +3332,7 @@ _func_enter_; ssid.SsidLength = P2P_WILDCARD_SSID_LEN; rtw_p2p_set_state(pwdinfo, P2P_STATE_FIND_PHASE_SEARCH); - + _enter_critical_bh(&pmlmepriv->lock, &irqL); _status = rtw_sitesurvey_cmd(padapter, &ssid, 1, NULL, 0); _exit_critical_bh(&pmlmepriv->lock, &irqL); @@ -3360,19 +3360,19 @@ _func_enter_; { struct adapter *pbuddy_adapter = padapter->pbuddy_adapter; struct mlme_priv *pbuddy_mlmepriv = &pbuddy_adapter->mlmepriv; - struct mlme_ext_priv *pbuddy_mlmeext = &pbuddy_adapter->mlmeextpriv; - + struct mlme_ext_priv *pbuddy_mlmeext = &pbuddy_adapter->mlmeextpriv; + if(rtw_p2p_chk_state(pwdinfo, P2P_STATE_TX_PROVISION_DIS_REQ) || rtw_p2p_chk_state(pwdinfo, P2P_STATE_RX_PROVISION_DIS_RSP)) { set_channel_bwmode(padapter, pbuddy_mlmeext->cur_channel, pbuddy_mlmeext->cur_ch_offset, pbuddy_mlmeext->cur_bwmode); - + issue_nulldata(pbuddy_adapter, NULL, 0, 3, 500); } } #endif rtw_p2p_set_state(pwdinfo, rtw_p2p_pre_state(pwdinfo)); - + if(rtw_p2p_chk_role(pwdinfo, P2P_ROLE_DEVICE)) { #ifdef CONFIG_CONCURRENT_MODE @@ -3393,10 +3393,10 @@ void pre_tx_invitereq_handler( struct adapter* padapter ) _func_enter_; set_channel_bwmode(padapter, pwdinfo->invitereq_info.peer_ch, HAL_PRIME_CHNL_OFFSET_DONT_CARE, HT_CHANNEL_WIDTH_20); - padapter->HalFunc.SetHwRegHandler(padapter, HW_VAR_MLME_SITESURVEY, (u8 *)(&val8)); + padapter->HalFunc.SetHwRegHandler(padapter, HW_VAR_MLME_SITESURVEY, (u8 *)(&val8)); issue_probereq_p2p(padapter, NULL); _set_timer( &pwdinfo->pre_tx_scan_timer, P2P_TX_PRESCAN_TIMEOUT ); - + _func_exit_; } @@ -3410,7 +3410,7 @@ _func_enter_; rtw_hal_set_hwreg(padapter, HW_VAR_MLME_SITESURVEY, (u8 *)(&val8)); issue_probereq_p2p(padapter, NULL); _set_timer( &pwdinfo->pre_tx_scan_timer, P2P_TX_PRESCAN_TIMEOUT ); - + _func_exit_; } @@ -3421,10 +3421,10 @@ void pre_tx_negoreq_handler( struct adapter* padapter ) _func_enter_; set_channel_bwmode(padapter, pwdinfo->nego_req_info.peer_channel_num[0], HAL_PRIME_CHNL_OFFSET_DONT_CARE, HT_CHANNEL_WIDTH_20); - rtw_hal_set_hwreg(padapter, HW_VAR_MLME_SITESURVEY, (u8 *)(&val8)); + rtw_hal_set_hwreg(padapter, HW_VAR_MLME_SITESURVEY, (u8 *)(&val8)); issue_probereq_p2p(padapter, NULL); _set_timer( &pwdinfo->pre_tx_scan_timer, P2P_TX_PRESCAN_TIMEOUT ); - + _func_exit_; } @@ -3441,7 +3441,7 @@ _func_enter_; if ( check_buddy_fwstate(padapter, _FW_LINKED ) ) { - struct adapter *pbuddy_adapter = padapter->pbuddy_adapter; + struct adapter *pbuddy_adapter = padapter->pbuddy_adapter; struct mlme_ext_priv *pbuddy_mlmeext = &pbuddy_adapter->mlmeextpriv; pwdinfo->operating_channel = pbuddy_mlmeext->cur_channel; @@ -3451,7 +3451,7 @@ _func_enter_; DBG_871X("%s, switch ch back to buddy's cur_channel=%d\n", __func__, pbuddy_mlmeext->cur_channel); set_channel_bwmode(padapter, pbuddy_mlmeext->cur_channel, pbuddy_mlmeext->cur_ch_offset, pbuddy_mlmeext->cur_bwmode); - + issue_nulldata(pbuddy_adapter, NULL, 0, 3, 500); } else if( pwdinfo->driver_interface == DRIVER_WEXT ) @@ -3479,7 +3479,7 @@ _func_enter_; _set_timer( &pwdinfo->ap_p2p_switch_timer, pwdinfo->ext_listen_period ); } } - else if ( rtw_p2p_chk_state(pwdinfo, P2P_STATE_LISTEN) || + else if ( rtw_p2p_chk_state(pwdinfo, P2P_STATE_LISTEN) || rtw_p2p_chk_state(pwdinfo, P2P_STATE_GONEGO_FAIL) || ( rtw_p2p_chk_state(pwdinfo, P2P_STATE_GONEGO_ING) && pwdinfo->nego_req_info.benable == _FALSE ) || rtw_p2p_chk_state(pwdinfo, P2P_STATE_RX_PROVISION_DIS_REQ) ) @@ -3526,7 +3526,7 @@ _func_enter_; rtw_hal_set_hwreg(padapter, HW_VAR_MLME_SITESURVEY, (u8 *)(&val8)); issue_probereq_p2p(padapter, NULL); _set_timer( &pwdinfo->pre_tx_scan_timer, P2P_TX_PRESCAN_TIMEOUT ); - } + } else if(rtw_p2p_chk_state(pwdinfo, P2P_STATE_TX_INVITE_REQ ) && pwdinfo->invitereq_info.benable == _TRUE) { /* @@ -3541,7 +3541,7 @@ _func_enter_; } else { - set_channel_bwmode( padapter, pwdinfo->listen_channel, HAL_PRIME_CHNL_OFFSET_DONT_CARE, HT_CHANNEL_WIDTH_20); + set_channel_bwmode( padapter, pwdinfo->listen_channel, HAL_PRIME_CHNL_OFFSET_DONT_CARE, HT_CHANNEL_WIDTH_20); } _func_exit_; @@ -3590,8 +3590,8 @@ _func_enter_; DBG_871X("cfg80211_remain_on_channel_expired\n"); - rtw_cfg80211_remain_on_channel_expired(padapter, - pcfg80211_wdinfo->remain_on_ch_cookie, + rtw_cfg80211_remain_on_channel_expired(padapter, + pcfg80211_wdinfo->remain_on_ch_cookie, &pcfg80211_wdinfo->remain_on_ch_channel, pcfg80211_wdinfo->remain_on_ch_type, GFP_KERNEL); @@ -3604,7 +3604,7 @@ static void ro_ch_timer_process (void *FunctionContext) struct rtw_wdev_priv *pwdev_priv = wdev_to_priv(adapter->rtw_wdev); //printk("%s \n", __FUNCTION__); - + #ifdef CONFIG_CONCURRENT_MODE ATOMIC_SET(&pwdev_priv->ro_ch_to, 1); #endif @@ -3664,7 +3664,7 @@ static void rtw_change_p2pie_ch_list(struct adapter *padapter, const u8 *frame_b u8 *pattr_temp = pattr + 3 ; attr_contentlen -= 3; - + while (attr_contentlen>0) { num_of_ch = *(pattr_temp+1); @@ -3773,19 +3773,19 @@ static void rtw_cfg80211_adjust_p2pie_channel(_adapter *padapter, const u8 *fram #ifdef CONFIG_CONCURRENT_MODE u8 *ies, *p2p_ie; u32 ies_len, p2p_ielen; - struct adapter *pbuddy_adapter = padapter->pbuddy_adapter; + struct adapter *pbuddy_adapter = padapter->pbuddy_adapter; struct mlme_ext_priv *pbuddy_mlmeext = &pbuddy_adapter->mlmeextpriv; ies = (u8*)(frame_body + _PUBLIC_ACTION_IE_OFFSET_); ies_len = len - _PUBLIC_ACTION_IE_OFFSET_; - + p2p_ie = rtw_get_p2p_ie( ies, ies_len, NULL, &p2p_ielen ); while ( p2p_ie ) - { + { u32 attr_contentlen = 0; u8 *pattr = NULL; - + //Check P2P_ATTR_CH_LIST if((pattr=rtw_get_p2p_attr_content(p2p_ie, p2p_ielen, P2P_ATTR_CH_LIST, NULL, (uint*)&attr_contentlen))!=NULL) { @@ -3794,17 +3794,17 @@ static void rtw_cfg80211_adjust_p2pie_channel(_adapter *padapter, const u8 *fram u8 *pattr_temp = pattr + 3 ; attr_contentlen -= 3; - + while(attr_contentlen>0) - { + { num_of_ch = *(pattr_temp+1); - + for(i=0; icur_channel;//forcing to the same channel pattr_temp += (2+num_of_ch); attr_contentlen -= (2+num_of_ch); - } + } } //Check P2P_ATTR_OPERATING_CH @@ -3812,12 +3812,12 @@ static void rtw_cfg80211_adjust_p2pie_channel(_adapter *padapter, const u8 *fram pattr = NULL; if((pattr = rtw_get_p2p_attr_content(p2p_ie, p2p_ielen, P2P_ATTR_OPERATING_CH, NULL, (uint*)&attr_contentlen))!=NULL) { - *(pattr+4) = pbuddy_mlmeext->cur_channel;//forcing to the same channel + *(pattr+4) = pbuddy_mlmeext->cur_channel;//forcing to the same channel } //Get the next P2P IE p2p_ie = rtw_get_p2p_ie(p2p_ie+p2p_ielen, ies_len -(p2p_ie -ies + p2p_ielen), NULL, &p2p_ielen); - + } #endif @@ -3830,8 +3830,8 @@ void rtw_append_wfd_ie(struct adapter *padapter, u8 *buf, u32* len) u8 category, action, OUI_Subtype, dialogToken=0; u32 wfdielen = 0; struct rtw_wdev_priv *pwdev_priv = wdev_to_priv(padapter->rtw_wdev); - - frame_body = (unsigned char *)(buf + sizeof(struct rtw_ieee80211_hdr_3addr)); + + frame_body = (unsigned char *)(buf + sizeof(struct rtw_ieee80211_hdr_3addr)); category = frame_body[0]; if(category == RTW_WLAN_CATEGORY_PUBLIC) @@ -3894,12 +3894,12 @@ void rtw_append_wfd_ie(struct adapter *padapter, u8 *buf, u32* len) } default: - break; + break; } } - - } + + } else if(category == RTW_WLAN_CATEGORY_P2P) { OUI_Subtype = frame_body[5]; @@ -3914,26 +3914,26 @@ void rtw_append_wfd_ie(struct adapter *padapter, u8 *buf, u32* len) { case P2P_NOTICE_OF_ABSENCE: - break; + break; case P2P_PRESENCE_REQUEST: - break; + break; case P2P_PRESENCE_RESPONSE: - break; + break; case P2P_GO_DISC_REQUEST: - break; + break; default: - break; - } + break; + } - } - else + } + else { DBG_871X("%s, action frame category=%d\n", __func__, category); - //is_p2p_frame = (-1); + //is_p2p_frame = (-1); } return; @@ -3960,7 +3960,7 @@ u8 *dump_p2p_attr_ch_list(u8 *p2p_ie, uint p2p_ielen, u8 *buf, u32 buf_len) while (attr_contentlen>0) { num_of_ch = *(pattr_temp+1); - + for(i=0; iprovdisc_req_issued = _FALSE; - + if( (p2p_ie=rtw_get_p2p_ie( frame_body + _PUBLIC_ACTION_IE_OFFSET_, frame_body_len - _PUBLIC_ACTION_IE_OFFSET_, NULL, &p2p_ielen))) - { + { if(rtw_get_p2p_attr_content( p2p_ie, p2p_ielen, P2P_ATTR_GROUP_ID, NULL, &contentlen)) { @@ -4317,22 +4317,22 @@ int rtw_p2p_check_frames(struct adapter *padapter, const u8 *buf, u32 len, u8 tx #endif //CONFIG_DEBUG_CFG80211 pwdev_priv->provdisc_req_issued = _TRUE;//case: p2p_devices connection before Nego req. } - - } - } - } + + } + } + } break; case P2P_PROVISION_DISC_RESP: DBG_871X("RTW_%s:P2P_PROVISION_DISC_RESP, dialogToken=%d\n", (tx==_TRUE)?"Tx":"Rx", dialogToken); break; default: DBG_871X("RTW_%s:OUI_Subtype=%d, dialogToken=%d\n", (tx==_TRUE)?"Tx":"Rx", OUI_Subtype, dialogToken); - break; + break; } } - - } + + } else if(category == RTW_WLAN_CATEGORY_P2P) { OUI_Subtype = frame_body[5]; @@ -4349,22 +4349,22 @@ int rtw_p2p_check_frames(struct adapter *padapter, const u8 *buf, u32 len, u8 tx { case P2P_NOTICE_OF_ABSENCE: DBG_871X("RTW_%s:P2P_NOTICE_OF_ABSENCE, dialogToken=%d\n", (tx==_TRUE)?"TX":"RX", dialogToken); - break; + break; case P2P_PRESENCE_REQUEST: DBG_871X("RTW_%s:P2P_PRESENCE_REQUEST, dialogToken=%d\n", (tx==_TRUE)?"TX":"RX", dialogToken); - break; + break; case P2P_PRESENCE_RESPONSE: DBG_871X("RTW_%s:P2P_PRESENCE_RESPONSE, dialogToken=%d\n", (tx==_TRUE)?"TX":"RX", dialogToken); - break; + break; case P2P_GO_DISC_REQUEST: DBG_871X("RTW_%s:P2P_GO_DISC_REQUEST, dialogToken=%d\n", (tx==_TRUE)?"TX":"RX", dialogToken); - break; + break; default: DBG_871X("RTW_%s:OUI_Subtype=%d, dialogToken=%d\n", (tx==_TRUE)?"TX":"RX", OUI_Subtype, dialogToken); - break; - } + break; + } - } + } else { DBG_871X("RTW_%s:action frame category=%d\n", (tx==_TRUE)?"TX":"RX", category); @@ -4378,15 +4378,15 @@ void rtw_init_cfg80211_wifidirect_info( struct adapter* padapter) struct cfg80211_wifidirect_info *pcfg80211_wdinfo = &padapter->cfg80211_wdinfo; _rtw_memset(pcfg80211_wdinfo, 0x00, sizeof(struct cfg80211_wifidirect_info) ); - + _init_timer( &pcfg80211_wdinfo->remain_on_ch_timer, padapter->pnetdev, ro_ch_timer_process, padapter ); } -#endif //CONFIG_IOCTL_CFG80211 +#endif //CONFIG_IOCTL_CFG80211 void p2p_protocol_wk_hdl(struct adapter *padapter, int intCmdType) { struct wifidirect_info *pwdinfo= &(padapter->wdinfo); - + _func_enter_; switch(intCmdType) @@ -4428,7 +4428,7 @@ _func_enter_; { pre_tx_invitereq_handler( padapter ); } -#else +#else pre_tx_invitereq_handler( padapter ); #endif break; @@ -4444,7 +4444,7 @@ _func_enter_; { pre_tx_negoreq_handler( padapter ); } -#else +#else pre_tx_negoreq_handler( padapter ); #endif break; @@ -4455,7 +4455,7 @@ _func_enter_; { p2p_concurrent_handler( padapter ); break; - } + } #endif #endif #ifdef CONFIG_IOCTL_CFG80211 @@ -4463,11 +4463,11 @@ _func_enter_; { ro_ch_handler( padapter ); break; - } -#endif //CONFIG_IOCTL_CFG80211 + } +#endif //CONFIG_IOCTL_CFG80211 } - + _func_exit_; } @@ -4480,7 +4480,7 @@ void process_p2p_ps_ie(struct adapter *padapter, u8 *IEs, u32 IELength) u32 p2p_ielen = 0; u8 noa_attr[MAX_P2P_IE_LEN] = { 0x00 };// NoA length should be n*(13) + 2 u32 attr_contentlen = 0; - + struct wifidirect_info *pwdinfo = &( padapter->wdinfo ); u8 find_p2p = _FALSE, find_p2p_ps = _FALSE; u8 noa_offset, noa_num, noa_index; @@ -4492,17 +4492,17 @@ _func_enter_; return; } #ifdef CONFIG_CONCURRENT_MODE - if(padapter->iface_type != IFACE_PORT0) + if(padapter->iface_type != IFACE_PORT0) return; #endif if(IELength <= _BEACON_IE_OFFSET_) return; - + ies = IEs + _BEACON_IE_OFFSET_; ies_len = IELength - _BEACON_IE_OFFSET_; p2p_ie = rtw_get_p2p_ie( ies, ies_len, NULL, &p2p_ielen); - + while(p2p_ie) { find_p2p = _TRUE; @@ -4587,7 +4587,7 @@ void p2p_ps_wk_hdl(struct adapter *padapter, u8 p2p_ps_state) { struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter); struct wifidirect_info *pwdinfo= &(padapter->wdinfo); - + _func_enter_; // Pre action for p2p state @@ -4595,7 +4595,7 @@ _func_enter_; { case P2P_PS_DISABLE: pwdinfo->p2p_ps_state = p2p_ps_state; - + rtw_hal_set_hwreg(padapter, HW_VAR_H2C_FW_P2P_PS_OFFLOAD, (u8 *)(&p2p_ps_state)); pwdinfo->noa_index = 0; @@ -4615,7 +4615,7 @@ _func_enter_; case P2P_PS_ENABLE: if (pwdinfo->p2p_ps_mode > P2P_PS_NONE) { pwdinfo->p2p_ps_state = p2p_ps_state; - + if( pwdinfo->ctwindow > 0 ) { if(pwrpriv->smart_ps != 0) @@ -4650,12 +4650,12 @@ u8 p2p_ps_wk_cmd(struct adapter*padapter, u8 p2p_ps_state, u8 enqueue) struct wifidirect_info *pwdinfo= &(padapter->wdinfo); struct cmd_priv *pcmdpriv = &padapter->cmdpriv; u8 res = _SUCCESS; - + _func_enter_; - if ( rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE) + if ( rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE) #ifdef CONFIG_CONCURRENT_MODE - || (padapter->iface_type != IFACE_PORT0) + || (padapter->iface_type != IFACE_PORT0) #endif ) { @@ -4664,13 +4664,13 @@ _func_enter_; if(enqueue) { - ph2c = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj)); + ph2c = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj)); if(ph2c==NULL){ res= _FAIL; goto exit; } - - pdrvextra_cmd_parm = (struct drvextra_cmd_parm*)rtw_zmalloc(sizeof(struct drvextra_cmd_parm)); + + pdrvextra_cmd_parm = (struct drvextra_cmd_parm*)rtw_zmalloc(sizeof(struct drvextra_cmd_parm)); if(pdrvextra_cmd_parm==NULL){ rtw_mfree((unsigned char *)ph2c, sizeof(struct cmd_obj)); res= _FAIL; @@ -4689,9 +4689,9 @@ _func_enter_; { p2p_ps_wk_hdl(padapter, p2p_ps_state); } - + exit: - + _func_exit_; return res; @@ -4714,7 +4714,7 @@ static void reset_ch_sitesurvey_timer_process (void *FunctionContext) pwdinfo->rx_invitereq_info.operation_ch[1] = 0; pwdinfo->rx_invitereq_info.operation_ch[2] = 0; pwdinfo->rx_invitereq_info.operation_ch[3] = 0; -#endif //P2P_OP_CHECK_SOCIAL_CH +#endif //P2P_OP_CHECK_SOCIAL_CH pwdinfo->rx_invitereq_info.scan_op_ch_only = 0; } @@ -4743,14 +4743,14 @@ static void restore_p2p_state_timer_process (void *FunctionContext) struct wifidirect_info *pwdinfo = &adapter->wdinfo; if(rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) - return; - + return; + p2p_protocol_wk_cmd( adapter, P2P_RESTORE_STATE_WK ); } static void pre_tx_scan_timer_process (void *FunctionContext) { - struct adapter *adapter = (struct adapter *) FunctionContext; + struct adapter *adapter = (struct adapter *) FunctionContext; struct wifidirect_info *pwdinfo = &adapter->wdinfo; _irqL irqL; struct mlme_priv *pmlmepriv = &adapter->mlmepriv; @@ -4758,7 +4758,7 @@ static void pre_tx_scan_timer_process (void *FunctionContext) if(rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) return; - + _enter_critical_bh(&pmlmepriv->lock, &irqL); @@ -4766,7 +4766,7 @@ static void pre_tx_scan_timer_process (void *FunctionContext) { if ( _TRUE == pwdinfo->tx_prov_disc_info.benable ) // the provision discovery request frame is trigger to send or not { - p2p_protocol_wk_cmd( adapter, P2P_PRE_TX_PROVDISC_PROCESS_WK ); + p2p_protocol_wk_cmd( adapter, P2P_PRE_TX_PROVDISC_PROCESS_WK ); //issue_probereq_p2p(adapter, NULL); //_set_timer( &pwdinfo->pre_tx_scan_timer, P2P_TX_PRESCAN_TIMEOUT ); } @@ -4789,7 +4789,7 @@ static void pre_tx_scan_timer_process (void *FunctionContext) { DBG_8192C( "[%s] p2p_state is %d, ignore!!\n", __FUNCTION__, rtw_p2p_state(pwdinfo) ); } - + _exit_critical_bh(&pmlmepriv->lock, &irqL); } @@ -4811,7 +4811,7 @@ void ap_p2p_switch_timer_process (void *FunctionContext) { struct adapter *adapter = (struct adapter *)FunctionContext; struct wifidirect_info *pwdinfo = &adapter->wdinfo; -#ifdef CONFIG_IOCTL_CFG80211 +#ifdef CONFIG_IOCTL_CFG80211 struct rtw_wdev_priv *pwdev_priv = wdev_to_priv(adapter->rtw_wdev); #endif @@ -4850,7 +4850,7 @@ int rtw_init_wifi_display_info(struct adapter* padapter) pwfd_info->wfd_device_type = WFD_DEVINFO_PSINK; pwfd_info->scan_result_type = SCAN_RESULT_P2P_ONLY; - // Used in P2P + // Used in P2P pwfd_info->peer_session_avail = _TRUE; pwfd_info->wfd_pc = _FALSE; @@ -4907,7 +4907,7 @@ void init_wifidirect_info( struct adapter* padapter, enum P2P_ROLE role) pwdinfo = &padapter->wdinfo; pwdinfo->padapter = padapter; - + // 1, 6, 11 are the social channel defined in the WiFi Direct specification. pwdinfo->social_chan[0] = 1; pwdinfo->social_chan[1] = 6; @@ -4921,7 +4921,7 @@ void init_wifidirect_info( struct adapter* padapter, enum P2P_ROLE role) pbuddy_mlmeext = &pbuddy_adapter->mlmeextpriv; } - if ( ( check_buddy_fwstate(padapter, _FW_LINKED ) == _TRUE ) && + if ( ( check_buddy_fwstate(padapter, _FW_LINKED ) == _TRUE ) && ( ( pbuddy_mlmeext->cur_channel == 1) || ( pbuddy_mlmeext->cur_channel == 6 ) || ( pbuddy_mlmeext->cur_channel == 11 ) ) ) { @@ -4958,7 +4958,7 @@ void init_wifidirect_info( struct adapter* padapter, enum P2P_ROLE role) rtw_p2p_set_state(pwdinfo, P2P_STATE_GONEGO_OK); pwdinfo->intent = 1; rtw_p2p_set_pre_state(pwdinfo, P2P_STATE_GONEGO_OK); - } + } else if (role == P2P_ROLE_GO) { rtw_p2p_set_role(pwdinfo, P2P_ROLE_GO); @@ -4967,7 +4967,7 @@ void init_wifidirect_info( struct adapter* padapter, enum P2P_ROLE role) rtw_p2p_set_pre_state(pwdinfo, P2P_STATE_GONEGO_OK); } -// Use the OFDM rate in the P2P probe response frame. ( 6(B), 9(B), 12, 18, 24, 36, 48, 54 ) +// Use the OFDM rate in the P2P probe response frame. ( 6(B), 9(B), 12, 18, 24, 36, 48, 54 ) pwdinfo->support_rate[0] = 0x8c; // 6(B) pwdinfo->support_rate[1] = 0x92; // 9(B) pwdinfo->support_rate[2] = 0x18; // 12 @@ -4984,7 +4984,7 @@ void init_wifidirect_info( struct adapter* padapter, enum P2P_ROLE role) _rtw_memset( &pwdinfo->invitereq_info, 0x00, sizeof( struct tx_invite_req_info ) ); pwdinfo->invitereq_info.token = 3; // Token used for P2P invitation request frame. - + _rtw_memset( &pwdinfo->inviteresp_info, 0x00, sizeof( struct tx_invite_resp_info ) ); pwdinfo->inviteresp_info.token = 0; @@ -5161,7 +5161,7 @@ void dbg_rtw_p2p_set_state(struct wifidirect_info *wdinfo, enum P2P_STATE state, void dbg_rtw_p2p_set_pre_state(struct wifidirect_info *wdinfo, enum P2P_STATE state, const char *caller, int line) { if(_rtw_p2p_pre_state(wdinfo) != state) { - enum P2P_STATE old_state = _rtw_p2p_pre_state(wdinfo); + enum P2P_STATE old_state = _rtw_p2p_pre_state(wdinfo); _rtw_p2p_set_pre_state(wdinfo, state); DBG_871X("[CONFIG_DBG_P2P]%s:%d set_pre_state from %s to %s\n", caller, line , rtw_p2p_state_txt(old_state), rtw_p2p_state_txt(_rtw_p2p_pre_state(wdinfo)) @@ -5183,7 +5183,7 @@ void dbg_rtw_p2p_restore_state(struct wifidirect_info *wdinfo, const char *calle } else { DBG_871X("[CONFIG_DBG_P2P]%s:%d restore no pre state, cur state %s\n", caller, line , p2p_state_str[wdinfo->p2p_state] - ); + ); } } #endif @@ -5240,12 +5240,12 @@ int rtw_p2p_enable(struct adapter *padapter, enum P2P_ROLE role) //Enable P2P function init_wifidirect_info(padapter, role); - + rtw_hal_set_odm_var(padapter,HAL_ODM_P2P_STATE,NULL,_TRUE); #ifdef CONFIG_WFD rtw_hal_set_odm_var(padapter,HAL_ODM_WIFI_DISPLAY_STATE,NULL,_TRUE); #endif - + } else if (role == P2P_ROLE_DISABLE) { @@ -5274,7 +5274,7 @@ int rtw_p2p_enable(struct adapter *padapter, enum P2P_ROLE role) _cancel_timer_ex( &pwdinfo->reset_ch_sitesurvey2); reset_ch_sitesurvey_timer_process( padapter ); reset_ch_sitesurvey_timer_process2( padapter ); - #ifdef CONFIG_CONCURRENT_MODE + #ifdef CONFIG_CONCURRENT_MODE _cancel_timer_ex( &pwdinfo->ap_p2p_switch_timer); #endif rtw_p2p_set_state(pwdinfo, P2P_STATE_NONE); @@ -5303,10 +5303,9 @@ int rtw_p2p_enable(struct adapter *padapter, enum P2P_ROLE role) #endif //CONFIG_IOCTL_CFG80211 } - -exit: + +exit: return ret; } #endif //CONFIG_P2P - diff --git a/core/rtw_pwrctrl.c b/core/rtw_pwrctrl.c index d801273..1cb80d3 100755 --- a/core/rtw_pwrctrl.c +++ b/core/rtw_pwrctrl.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Copyright(c) 2007 - 2012 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. @@ -35,34 +35,34 @@ void _ips_enter(struct adapter * padapter) struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter); if (padapter->hw_init_completed == _FALSE) { - DBG_871X("%s: hw_init_completed: %d\n", + DBG_871X("%s: hw_init_completed: %d\n", __func__, padapter->hw_init_completed); return; } - pwrpriv->bips_processing = _TRUE; + pwrpriv->bips_processing = _TRUE; // syn ips_mode with request pwrpriv->ips_mode = pwrpriv->ips_mode_req; - - pwrpriv->ips_enter_cnts++; + + pwrpriv->ips_enter_cnts++; DBG_871X("==>ips_enter cnts:%d\n",pwrpriv->ips_enter_cnts); #ifdef CONFIG_BT_COEXIST BTDM_TurnOffBtCoexistBeforeEnterIPS(padapter); #endif if(rf_off == pwrpriv->change_rfpwrstate ) - { + { pwrpriv->bpower_saving = _TRUE; DBG_871X_LEVEL(_drv_always_, "nolinked power save enter\n"); if(pwrpriv->ips_mode == IPS_LEVEL_2) pwrpriv->bkeepfwalive = _TRUE; - + rtw_ips_pwr_down(padapter); pwrpriv->rf_pwrstate = rf_off; - } - pwrpriv->bips_processing = _FALSE; - + } + pwrpriv->bips_processing = _FALSE; + } void ips_enter(struct adapter * padapter) @@ -90,7 +90,7 @@ int _ips_leave(struct adapter * padapter) pwrpriv->rf_pwrstate = rf_on; } DBG_871X_LEVEL(_drv_always_, "nolinked power save leave\n"); - + DBG_871X("==> ips_leave.....LED(0x%08x)...\n",rtw_read32(padapter,0x4c)); pwrpriv->bips_processing = _FALSE; @@ -115,7 +115,7 @@ int ips_leave(struct adapter * padapter) #endif /* CONFIG_IPS */ #ifdef CONFIG_AUTOSUSPEND -extern void autosuspend_enter(struct adapter* padapter); +extern void autosuspend_enter(struct adapter* padapter); extern int autoresume_enter(struct adapter* padapter); #endif @@ -184,15 +184,15 @@ bool rtw_pwr_unassociated_idle(struct adapter *adapter) if(adapter->proximity.proxim_on==_TRUE){ return; } -#endif +#endif if (pxmit_priv->free_xmitbuf_cnt != NR_XMITBUFF || pxmit_priv->free_xmit_extbuf_cnt != NR_XMIT_EXTBUFF) { DBG_871X_LEVEL(_drv_always_, "There are some pkts to transmit\n"); - DBG_871X_LEVEL(_drv_info_, "free_xmitbuf_cnt: %d, free_xmit_extbuf_cnt: %d\n", - pxmit_priv->free_xmitbuf_cnt, pxmit_priv->free_xmit_extbuf_cnt); + DBG_871X_LEVEL(_drv_info_, "free_xmitbuf_cnt: %d, free_xmit_extbuf_cnt: %d\n", + pxmit_priv->free_xmitbuf_cnt, pxmit_priv->free_xmit_extbuf_cnt); goto exit; - } + } ret = _TRUE; @@ -216,9 +216,9 @@ void rtw_ps_processor(struct adapter*padapter) #ifdef SUPPORT_HW_RFOFF_DETECTED if(pwrpriv->bips_processing == _TRUE) goto exit; - - //DBG_871X("==> fw report state(0x%x)\n",rtw_read8(padapter,0x1ca)); - if(pwrpriv->bHWPwrPindetect) + + //DBG_871X("==> fw report state(0x%x)\n",rtw_read8(padapter,0x1ca)); + if(pwrpriv->bHWPwrPindetect) { #ifdef CONFIG_AUTOSUSPEND if(padapter->registrypriv.usbss_enable) @@ -235,14 +235,14 @@ void rtw_ps_processor(struct adapter*padapter) if(rfpwrstate == rf_off) { pwrpriv->change_rfpwrstate = rf_off; - - pwrpriv->bkeepfwalive = _TRUE; - pwrpriv->brfoffbyhw = _TRUE; - - autosuspend_enter(padapter); + + pwrpriv->bkeepfwalive = _TRUE; + pwrpriv->brfoffbyhw = _TRUE; + + autosuspend_enter(padapter); } } - } + } } else #endif //CONFIG_AUTOSUSPEND @@ -253,21 +253,21 @@ void rtw_ps_processor(struct adapter*padapter) if(rfpwrstate!= pwrpriv->rf_pwrstate) { if(rfpwrstate == rf_off) - { - pwrpriv->change_rfpwrstate = rf_off; + { + pwrpriv->change_rfpwrstate = rf_off; pwrpriv->brfoffbyhw = _TRUE; padapter->bCardDisableWOHSM = _TRUE; - rtw_hw_suspend(padapter ); + rtw_hw_suspend(padapter ); } else { pwrpriv->change_rfpwrstate = rf_on; - rtw_hw_resume(padapter ); + rtw_hw_resume(padapter ); } DBG_871X("current rf_pwrstate(%s)\n",(pwrpriv->rf_pwrstate == rf_off)?"rf_off":"rf_on"); } } - pwrpriv->pwr_state_check_cnts ++; + pwrpriv->pwr_state_check_cnts ++; } #endif //SUPPORT_HW_RFOFF_DETECTED @@ -287,9 +287,9 @@ void rtw_ps_processor(struct adapter*padapter) #ifdef CONFIG_AUTOSUSPEND if(padapter->registrypriv.usbss_enable) { - if(pwrpriv->bHWPwrPindetect) + if(pwrpriv->bHWPwrPindetect) pwrpriv->bkeepfwalive = _TRUE; - + if(padapter->net_closed == _TRUE) pwrpriv->ps_flag = _TRUE; @@ -301,12 +301,12 @@ void rtw_ps_processor(struct adapter*padapter) padapter->bCardDisableWOHSM = _TRUE; DBG_871X("<==%s .pwrpriv->bInternalAutoSuspend)(%x) call autosuspend_enter\n",__FUNCTION__,pwrpriv->bInternalAutoSuspend); autosuspend_enter(padapter); - } + } #else padapter->bCardDisableWOHSM = _TRUE; autosuspend_enter(padapter); #endif //if defined (CONFIG_BT_COEXIST)&& defined (CONFIG_AUTOSUSPEND) - } + } else if(pwrpriv->bHWPwrPindetect) { } @@ -318,7 +318,7 @@ void rtw_ps_processor(struct adapter*padapter) #endif //defined (CONFIG_BT_COEXIST)&& defined (CONFIG_AUTOSUSPEND) #ifdef CONFIG_IPS - ips_enter(padapter); + ips_enter(padapter); #endif } } @@ -420,7 +420,7 @@ _func_enter_; //cpwm_orig = rtw_read8(padapter, SDIO_LOCAL_BASE | SDIO_REG_HCPWM1); rtw_hal_get_hwreg(padapter, HW_VAR_GET_CPWM, (u8 *)(&cpwm_orig)); } -#endif +#endif #if defined(CONFIG_LPS_RPWM_TIMER) && !defined(CONFIG_DETECT_CPWM_BY_POLLING) if (rpwm & PS_ACK) @@ -446,7 +446,7 @@ _func_enter_; //polling cpwm do{ rtw_mdelay_os(1); - + //cpwm_now = rtw_read8(padapter, SDIO_LOCAL_BASE | SDIO_REG_HCPWM1); rtw_hal_get_hwreg(padapter, HW_VAR_GET_CPWM, (u8 *)(&cpwm_now)); if ((cpwm_orig ^ cpwm_now) & 0x80) @@ -490,11 +490,11 @@ u8 PS_RDY_CHECK(struct adapter * padapter) return _FALSE; #endif - curr_time = rtw_get_current_time(); + curr_time = rtw_get_current_time(); delta_time = curr_time -pwrpriv->DelayLPSLastTimeStamp; if(delta_time < LPS_DELAY_TIME) - { + { return _FALSE; } @@ -515,7 +515,7 @@ u8 PS_RDY_CHECK(struct adapter * padapter) #ifdef CONFIG_IOCTL_CFG80211 if (!rtw_cfg80211_pwr_mgmt(padapter)) return _FALSE; -#endif +#endif return _TRUE; } @@ -740,11 +740,11 @@ _func_enter_; struct mlme_priv *b_pmlmepriv = &(buddy->mlmepriv); #ifdef CONFIG_P2P struct wifidirect_info *b_pwdinfo = &(buddy->wdinfo); - #ifdef CONFIG_IOCTL_CFG80211 + #ifdef CONFIG_IOCTL_CFG80211 struct cfg80211_wifidirect_info *b_pcfg80211_wdinfo = &buddy->cfg80211_wdinfo; #endif #endif - + if (check_fwstate(b_pmlmepriv, WIFI_ASOC_STATE|WIFI_SITE_MONITOR) || check_fwstate(b_pmlmepriv, WIFI_UNDER_LINKING|WIFI_UNDER_WPS) || check_fwstate(b_pmlmepriv, WIFI_AP_STATE) @@ -767,7 +767,7 @@ _func_enter_; if (_TRUE == pwrpriv->bLeisurePs) { // Idle for a while if we connect to AP a while ago. - if(pwrpriv->LpsIdleCount >= 2) // 4 Sec + if(pwrpriv->LpsIdleCount >= 2) // 4 Sec { if(pwrpriv->pwr_mode == PS_MODE_ACTIVE) { @@ -828,7 +828,7 @@ _func_exit_; // // Description: Leave all power save mode: LPS, FwLPS, IPS if needed. -// Move code to function by tynli. 2010.03.26. +// Move code to function by tynli. 2010.03.26. // void LeaveAllPowerSaveMode(IN struct adapter *Adapter) { @@ -854,7 +854,7 @@ _func_enter_; #ifdef CONFIG_LPS_LCLK LPS_Leave_check(Adapter); -#endif +#endif } else { @@ -876,12 +876,12 @@ _func_enter_; #ifdef CONFIG_IPS if(_FALSE == ips_leave(Adapter)) { - DBG_871X("======> ips_leave fail.............\n"); + DBG_871X("======> ips_leave fail.............\n"); } #endif #endif //CONFIG_PLATFORM_SPRD - } - } + } + } } _func_exit_; @@ -903,7 +903,7 @@ _func_enter_; start_time = rtw_get_current_time(); rtw_yield_os(); - + while(1) { _enter_pwrlock(&pwrpriv->lock); @@ -1091,13 +1091,13 @@ __inline static void unregister_task_alive(struct pwrctrl_priv *pwrctrl, u32 tag /* * Caller: rtw_xmit_thread - * + * * Check if the fw_pwrstate is okay for xmit. * If not (cpwm is less than S3), then the sub-routine - * will raise the cpwm to be greater than or equal to S3. + * will raise the cpwm to be greater than or equal to S3. * * Calling Context: Passive - * + * * Return Value: * _SUCCESS rtw_xmit_thread can write fifo/txcmd afterwards. * _FAIL rtw_xmit_thread can not do anything. @@ -1152,7 +1152,7 @@ _func_enter_; _func_exit_; - return res; + return res; } /* @@ -1435,7 +1435,7 @@ _func_enter_; #ifdef CONFIG_AUTOSUSPEND #ifdef SUPPORT_HW_RFOFF_DETECTED - pwrctrlpriv->pwr_state_check_interval = (pwrctrlpriv->bHWPwrPindetect) ?1000:2000; + pwrctrlpriv->pwr_state_check_interval = (pwrctrlpriv->bHWPwrPindetect) ?1000:2000; #endif #endif @@ -1443,7 +1443,7 @@ _func_enter_; //pwrctrlpriv->FWCtrlPSMode =padapter->registrypriv.power_mgnt;// PS_MODE_MIN; if (padapter->registrypriv.mp_mode == 1) pwrctrlpriv->power_mgnt =PS_MODE_ACTIVE ; - else + else pwrctrlpriv->power_mgnt =padapter->registrypriv.power_mgnt;// PS_MODE_MIN; pwrctrlpriv->bLeisurePs = (PS_MODE_ACTIVE != pwrctrlpriv->power_mgnt)?_TRUE:_FALSE; @@ -1497,7 +1497,7 @@ void rtw_free_pwrctrl_priv(struct adapter *adapter) #if defined(CONFIG_CONCURRENT_MODE) if (adapter->adapter_type != PRIMARY_ADAPTER) return; -#endif +#endif _func_enter_; @@ -1505,7 +1505,7 @@ _func_enter_; #ifdef CONFIG_RESUME_IN_WORKQUEUE - if (pwrctrlpriv->rtw_workqueue) { + if (pwrctrlpriv->rtw_workqueue) { flush_workqueue(pwrctrlpriv->rtw_workqueue); destroy_workqueue(pwrctrlpriv->rtw_workqueue); } @@ -1536,16 +1536,16 @@ static void resume_workitem_callback(struct work_struct *work) #if defined(CONFIG_USB_HCI) || defined(CONFIG_SDIO_HCI) || defined(CONFIG_GSPI_HCI) rtw_resume_process(adapter); #endif - + } void rtw_resume_in_workqueue(struct pwrctrl_priv *pwrpriv) { // accquire system's suspend lock preventing from falliing asleep while resume in workqueue rtw_lock_suspend(); - + #if 1 - queue_work(pwrpriv->rtw_workqueue, &pwrpriv->resume_work); + queue_work(pwrpriv->rtw_workqueue, &pwrpriv->resume_work); #else _set_workitem(&pwrpriv->resume_work); #endif @@ -1604,7 +1604,7 @@ void rtw_register_early_suspend(struct pwrctrl_priv *pwrpriv) pwrpriv->early_suspend.level = EARLY_SUSPEND_LEVEL_BLANK_SCREEN - 20; pwrpriv->early_suspend.suspend = rtw_early_suspend; pwrpriv->early_suspend.resume = rtw_late_resume; - register_early_suspend(&pwrpriv->early_suspend); + register_early_suspend(&pwrpriv->early_suspend); } void rtw_unregister_early_suspend(struct pwrctrl_priv *pwrpriv) @@ -1613,7 +1613,7 @@ void rtw_unregister_early_suspend(struct pwrctrl_priv *pwrpriv) rtw_set_do_late_resume(pwrpriv, _FALSE); - if (pwrpriv->early_suspend.suspend) + if (pwrpriv->early_suspend.suspend) unregister_early_suspend(&pwrpriv->early_suspend); pwrpriv->early_suspend.suspend = NULL; @@ -1656,7 +1656,7 @@ void rtw_register_early_suspend(struct pwrctrl_priv *pwrpriv) pwrpriv->early_suspend.level = ANDROID_EARLY_SUSPEND_LEVEL_BLANK_SCREEN - 20; pwrpriv->early_suspend.suspend = rtw_early_suspend; pwrpriv->early_suspend.resume = rtw_late_resume; - android_register_early_suspend(&pwrpriv->early_suspend); + android_register_early_suspend(&pwrpriv->early_suspend); } void rtw_unregister_early_suspend(struct pwrctrl_priv *pwrpriv) @@ -1665,7 +1665,7 @@ void rtw_unregister_early_suspend(struct pwrctrl_priv *pwrpriv) rtw_set_do_late_resume(pwrpriv, _FALSE); - if (pwrpriv->early_suspend.suspend) + if (pwrpriv->early_suspend.suspend) android_unregister_early_suspend(&pwrpriv->early_suspend); pwrpriv->early_suspend.suspend = NULL; @@ -1677,7 +1677,7 @@ u8 rtw_interface_ps_func(struct adapter *padapter,HAL_INTF_PS_FUNC efunc_id,u8* { u8 bResult = _TRUE; rtw_hal_intf_ps_func(padapter,efunc_id,val); - + return bResult; } @@ -1698,7 +1698,7 @@ inline void rtw_set_ips_deny(struct adapter *padapter, u32 ms) int _rtw_pwr_wakeup(struct adapter *padapter, u32 ips_deffer_ms, const char *caller) { struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter); - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; + struct mlme_priv *pmlmepriv = &padapter->mlmepriv; int ret = _SUCCESS; u32 start = rtw_get_current_time(); @@ -1740,7 +1740,7 @@ int _rtw_pwr_wakeup(struct adapter *padapter, u32 ips_deffer_ms, const char *cal if (pwrpriv->bInternalAutoSuspend == _FALSE && pwrpriv->bInSuspend) { DBG_871X("%s wait bInSuspend...\n", __func__); - while (pwrpriv->bInSuspend + while (pwrpriv->bInSuspend && ((rtw_get_passing_time_ms(start) <= 3000 && !rtw_is_do_late_resume(pwrpriv)) || (rtw_get_passing_time_ms(start) <= 500 && rtw_is_do_late_resume(pwrpriv))) ) { @@ -1770,12 +1770,12 @@ int _rtw_pwr_wakeup(struct adapter *padapter, u32 ips_deffer_ms, const char *cal #if defined (CONFIG_BT_COEXIST)&& defined (CONFIG_AUTOSUSPEND) if(_TRUE==pwrpriv->bInternalAutoSuspend){ if(0==pwrpriv->autopm_cnt){ - #if (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,33)) - if (usb_autopm_get_interface(adapter_to_dvobj(padapter)->pusbintf) < 0) + #if (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,33)) + if (usb_autopm_get_interface(adapter_to_dvobj(padapter)->pusbintf) < 0) { DBG_871X( "can't get autopm: \n"); - } - #elif (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,20)) + } + #elif (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,20)) usb_autopm_disable(adapter_to_dvobj(padapter)->pusbintf); #else usb_autoresume_device(adapter_to_dvobj(padapter)->pusbdev, 1); @@ -1788,10 +1788,10 @@ int _rtw_pwr_wakeup(struct adapter *padapter, u32 ips_deffer_ms, const char *cal #if defined (CONFIG_BT_COEXIST)&& defined (CONFIG_AUTOSUSPEND) } #endif //#if defined (CONFIG_BT_COEXIST)&& defined (CONFIG_AUTOSUSPEND) - } + } if(rf_off == pwrpriv->rf_pwrstate ) - { + { #ifdef CONFIG_USB_HCI #ifdef CONFIG_AUTOSUSPEND if(pwrpriv->brfoffbyhw==_TRUE) @@ -1808,7 +1808,7 @@ int _rtw_pwr_wakeup(struct adapter *padapter, u32 ips_deffer_ms, const char *cal DBG_8192C("======> autoresume fail.............\n"); ret = _FAIL; goto exit; - } + } } else #endif @@ -1833,9 +1833,9 @@ int _rtw_pwr_wakeup(struct adapter *padapter, u32 ips_deffer_ms, const char *cal ){ DBG_8192C("%s: bDriverStopped=%d, bup=%d, hw_init_completed=%u\n" , caller - , padapter->bDriverStopped - , padapter->bup - , padapter->hw_init_completed); + , padapter->bDriverStopped + , padapter->bup + , padapter->hw_init_completed); ret= _FALSE; goto exit; } @@ -1849,9 +1849,9 @@ exit: int rtw_pm_set_lps(struct adapter *padapter, u8 mode) { - int ret = 0; + int ret = 0; struct pwrctrl_priv *pwrctrlpriv = adapter_to_pwrctl(padapter); - + if ( mode < PS_MODE_NUM ) { if(pwrctrlpriv->power_mgnt !=mode) @@ -1884,7 +1884,7 @@ int rtw_pm_set_ips(struct adapter *padapter, u8 mode) rtw_ips_mode_req(pwrctrlpriv, mode); DBG_871X("%s %s\n", __FUNCTION__, mode == IPS_NORMAL?"IPS_NORMAL":"IPS_LEVEL_2"); return 0; - } + } else if(mode ==IPS_NONE){ rtw_ips_mode_req(pwrctrlpriv, mode); DBG_871X("%s %s\n", __FUNCTION__, "IPS_NONE"); @@ -1896,5 +1896,3 @@ int rtw_pm_set_ips(struct adapter *padapter, u8 mode) } return 0; } - - diff --git a/core/rtw_recv.c b/core/rtw_recv.c index 6ab794b..cf40a7a 100755 --- a/core/rtw_recv.c +++ b/core/rtw_recv.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Copyright(c) 2007 - 2012 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. @@ -88,7 +88,7 @@ _func_enter_; rtw_os_recv_resource_init(precvpriv, padapter); precvpriv->pallocated_frame_buf = rtw_zvmalloc(NR_RECVFRAME * sizeof(union recv_frame) + RXFRAME_ALIGN_SZ); - + if(precvpriv->pallocated_frame_buf==NULL){ res= _FAIL; goto exit; @@ -148,7 +148,7 @@ void rtw_mfree_recv_priv_lock(struct recv_priv *precvpriv); void rtw_mfree_recv_priv_lock(struct recv_priv *precvpriv) { _rtw_spinlock_free(&precvpriv->lock); -#ifdef CONFIG_RECV_THREAD_MODE +#ifdef CONFIG_RECV_THREAD_MODE _rtw_free_sema(&precvpriv->recv_sema); _rtw_free_sema(&precvpriv->terminate_recvthread_sema); #endif @@ -225,7 +225,7 @@ union recv_frame *rtw_alloc_recvframe (_queue *pfree_recv_queue) { _irqL irqL; union recv_frame *precvframe; - + _enter_critical_bh(&pfree_recv_queue->lock, &irqL); precvframe = _rtw_alloc_recvframe(pfree_recv_queue); @@ -257,8 +257,8 @@ _func_enter_; padapter = padapter->pbuddy_adapter;//get primary_padapter precvpriv = &padapter->recvpriv; pfree_recv_queue = &precvpriv->free_recv_queue; - precvframe->u.hdr.adapter = padapter; - } + precvframe->u.hdr.adapter = padapter; + } #endif @@ -324,7 +324,7 @@ sint rtw_enqueue_recvframe(union recv_frame *precvframe, _queue *queue) { sint ret; _irqL irqL; - + //_spinlock(&pfree_recv_queue->lock); _enter_critical_bh(&queue->lock, &irqL); ret = _rtw_enqueue_recvframe(precvframe, queue); @@ -354,7 +354,7 @@ using spinlock to protect void rtw_free_recvframe_queue(_queue *pframequeue, _queue *pfree_recv_queue) { - union recv_frame *precvframe; + union recv_frame *precvframe; _list *plist, *phead; _func_enter_; @@ -412,7 +412,7 @@ sint rtw_enqueue_recvbuf_to_head(struct recv_buf *precvbuf, _queue *queue) sint rtw_enqueue_recvbuf(struct recv_buf *precvbuf, _queue *queue) { - _irqL irqL; + _irqL irqL; #ifdef CONFIG_SDIO_HCI _enter_critical_bh(&queue->lock, &irqL); #else @@ -422,27 +422,27 @@ sint rtw_enqueue_recvbuf(struct recv_buf *precvbuf, _queue *queue) rtw_list_delete(&precvbuf->list); rtw_list_insert_tail(&precvbuf->list, get_list_head(queue)); -#ifdef CONFIG_SDIO_HCI +#ifdef CONFIG_SDIO_HCI _exit_critical_bh(&queue->lock, &irqL); #else _exit_critical_ex(&queue->lock, &irqL); #endif/*#ifdef CONFIG_SDIO_HCI*/ return _SUCCESS; - + } struct recv_buf *rtw_dequeue_recvbuf (_queue *queue) { _irqL irqL; struct recv_buf *precvbuf; - _list *plist, *phead; + _list *plist, *phead; #ifdef CONFIG_SDIO_HCI _enter_critical_bh(&queue->lock, &irqL); #else _enter_critical_ex(&queue->lock, &irqL); #endif/*#ifdef CONFIG_SDIO_HCI*/ - + if(_rtw_queue_empty(queue) == _TRUE) { precvbuf = NULL; @@ -456,7 +456,7 @@ struct recv_buf *rtw_dequeue_recvbuf (_queue *queue) precvbuf = LIST_CONTAINOR(plist, struct recv_buf, list); rtw_list_delete(&precvbuf->list); - + } #ifdef CONFIG_SDIO_HCI @@ -481,7 +481,7 @@ sint recvframe_chkmic(struct adapter *adapter, union recv_frame *precvframe){ //u8 *iv,rxdata_key_idx=0; struct sta_info *stainfo; struct rx_pkt_attrib *prxattrib=&precvframe->u.hdr.attrib; - struct security_priv *psecuritypriv=&adapter->securitypriv; + struct security_priv *psecuritypriv=&adapter->securitypriv; struct mlme_ext_priv *pmlmeext = &adapter->mlmeextpriv; struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); @@ -504,11 +504,11 @@ _func_enter_; //iv = precvframe->u.hdr.rx_data+prxattrib->hdrlen; //rxdata_key_idx =( ((iv[3])>>6)&0x3) ; mickey=&psecuritypriv->dot118021XGrprxmickey[prxattrib->key_index].skey[0]; - + RT_TRACE(_module_rtl871x_recv_c_,_drv_info_,("\n recvframe_chkmic: bcmc key \n")); //DBG_871X("\n recvframe_chkmic: bcmc key psecuritypriv->dot118021XGrpKeyid(%d),pmlmeinfo->key_index(%d) ,recv key_id(%d)\n", // psecuritypriv->dot118021XGrpKeyid,pmlmeinfo->key_index,rxdata_key_idx); - + if(psecuritypriv->binstallGrpkey==_FALSE) { res=_FAIL; @@ -573,7 +573,7 @@ _func_enter_; // cannot compare with psecuritypriv->dot118021XGrpKeyid also cause timing issue if((IS_MCAST(prxattrib->ra)==_TRUE) && (prxattrib->key_index != pmlmeinfo->key_index )) brpt_micerror = _FALSE; - + if((prxattrib->bdecrypted ==_TRUE)&& (brpt_micerror == _TRUE)) { rtw_handle_tkip_mic_err(adapter,(u8)IS_MCAST(prxattrib->ra)); @@ -642,13 +642,13 @@ _func_enter_; case _WEP104_: prxattrib->key_index = psecuritypriv->dot11PrivacyKeyIndex; break; - case _TKIP_: - case _AES_: + case _TKIP_: + case _AES_: default: prxattrib->key_index = psecuritypriv->dot118021XGrpKeyid; break; - } - } + } + } } if((prxattrib->encrypt>0) && ((prxattrib->bdecrypted==0) ||(psecuritypriv->sw_decrypt==_TRUE))) @@ -656,7 +656,7 @@ _func_enter_; #ifdef CONFIG_CONCURRENT_MODE if(!IS_MCAST(prxattrib->ra))//bc/mc packets use sw decryption for concurrent mode -#endif +#endif psecuritypriv->hw_decrypted=_FALSE; #ifdef DBG_RX_DECRYPTOR @@ -718,12 +718,12 @@ _func_enter_; , prxattrib->bdecrypted ,prxattrib->encrypt, psecuritypriv->hw_decrypted); #endif } - + if(res == _FAIL) { - rtw_free_recvframe(return_packet,&padapter->recvpriv.free_recv_queue); + rtw_free_recvframe(return_packet,&padapter->recvpriv.free_recv_queue); return_packet = NULL; - + } else{ prxattrib->bdecrypted = _TRUE; @@ -746,7 +746,7 @@ union recv_frame * portctrl(struct adapter *adapter,union recv_frame * precv_fra struct sta_priv *pstapriv ; union recv_frame *prtnframe; u16 ether_type=0; - u16 eapol_type = 0x888e;//for Funia BD's WPA issue + u16 eapol_type = 0x888e;//for Funia BD's WPA issue struct rx_pkt_attrib *pattrib; _func_enter_; @@ -911,13 +911,13 @@ void process_pwrbit_data(struct adapter *padapter, union recv_frame *precv_frame void process_wmmps_data(struct adapter *padapter, union recv_frame *precv_frame); void process_wmmps_data(struct adapter *padapter, union recv_frame *precv_frame) { -#ifdef CONFIG_AP_MODE +#ifdef CONFIG_AP_MODE struct rx_pkt_attrib *pattrib = &precv_frame->u.hdr.attrib; struct sta_priv *pstapriv = &padapter->stapriv; struct sta_info *psta=NULL; psta = rtw_get_stainfo(pstapriv, pattrib->src); - + if(!psta) return; #ifdef CONFIG_TDLS @@ -930,15 +930,15 @@ void process_wmmps_data(struct adapter *padapter, union recv_frame *precv_frame) if(!(psta->qos_info&0xf)) return; - + #ifdef CONFIG_TDLS } -#endif //CONFIG_TDLS +#endif //CONFIG_TDLS if(psta->state&WIFI_SLEEP_STATE) { - u8 wmmps_ac=0; - + u8 wmmps_ac=0; + switch(pattrib->priority) { case 1: @@ -957,7 +957,7 @@ void process_wmmps_data(struct adapter *padapter, union recv_frame *precv_frame) case 3: default: wmmps_ac = psta->uapsd_be&BIT(1); - break; + break; } if(wmmps_ac) @@ -973,11 +973,11 @@ void process_wmmps_data(struct adapter *padapter, union recv_frame *precv_frame) issue_qos_nulldata(padapter, psta->hwaddr, (u16)pattrib->priority, 0, 0); } } - + } - -#endif + +#endif } @@ -994,11 +994,11 @@ sint OnTDLS(struct adapter *adapter, union recv_frame *precv_frame) struct tdls_info *ptdlsinfo = &(adapter->tdlsinfo); //point to action field - paction+=pattrib->hdrlen - + pattrib->iv_len - + SNAP_SIZE - + ETH_TYPE_LEN - + PAYLOAD_TYPE_LEN + paction+=pattrib->hdrlen + + pattrib->iv_len + + SNAP_SIZE + + ETH_TYPE_LEN + + PAYLOAD_TYPE_LEN + category_field; if(ptdlsinfo->enable == 0) @@ -1008,14 +1008,14 @@ sint OnTDLS(struct adapter *adapter, union recv_frame *precv_frame) ret = _FAIL; return ret; } - + switch(*paction){ case TDLS_SETUP_REQUEST: DBG_871X("recv tdls setup request frame\n"); ret=On_TDLS_Setup_Req(adapter, precv_frame); break; case TDLS_SETUP_RESPONSE: - DBG_871X("recv tdls setup response frame\n"); + DBG_871X("recv tdls setup response frame\n"); ret=On_TDLS_Setup_Rsp(adapter, precv_frame); break; case TDLS_SETUP_CONFIRM: @@ -1042,7 +1042,7 @@ sint OnTDLS(struct adapter *adapter, union recv_frame *precv_frame) DBG_871X("recv tdls channel switch response frame\n"); ret=On_TDLS_Ch_Switch_Rsp(adapter, precv_frame); break; -#ifdef CONFIG_WFD +#ifdef CONFIG_WFD case 0x50: //First byte of WFA OUI if( _rtw_memcmp(WFA_OUI, (paction), 3) ) { @@ -1070,7 +1070,7 @@ sint OnTDLS(struct adapter *adapter, union recv_frame *precv_frame) exit: return ret; - + } #endif @@ -1121,14 +1121,14 @@ sint sta2sta_data_frame( u8 *ptr = precv_frame->u.hdr.rx_data; sint ret = _SUCCESS; struct rx_pkt_attrib *pattrib = & precv_frame->u.hdr.attrib; - struct sta_priv *pstapriv = &adapter->stapriv; + struct sta_priv *pstapriv = &adapter->stapriv; struct mlme_priv *pmlmepriv = &adapter->mlmepriv; u8 *mybssid = get_bssid(pmlmepriv); u8 *myhwaddr = myid(&adapter->eeprompriv); u8 * sta_addr = NULL; sint bmcast = IS_MCAST(pattrib->dst); -#ifdef CONFIG_TDLS +#ifdef CONFIG_TDLS struct tdls_info *ptdlsinfo = &adapter->tdlsinfo; struct sta_info *ptdls_sta=NULL; u8 *psnap_type=ptr+pattrib->hdrlen + pattrib->iv_len+SNAP_SIZE; @@ -1241,12 +1241,12 @@ _func_enter_; ret= OnTDLS(adapter, precv_frame); goto exit; } - + } sta_addr = pattrib->src; - - } + + } else #endif //CONFIG_TDLS { @@ -1335,7 +1335,7 @@ sint ap2sta_data_frame( u8 *ptr = precv_frame->u.hdr.rx_data; struct rx_pkt_attrib *pattrib = & precv_frame->u.hdr.attrib; sint ret = _SUCCESS; - struct sta_priv *pstapriv = &adapter->stapriv; + struct sta_priv *pstapriv = &adapter->stapriv; struct mlme_priv *pmlmepriv = &adapter->mlmepriv; u8 *mybssid = get_bssid(pmlmepriv); u8 *myhwaddr = myid(&adapter->eeprompriv); @@ -1344,7 +1344,7 @@ sint ap2sta_data_frame( _func_enter_; if ((check_fwstate(pmlmepriv, WIFI_STATION_STATE) == _TRUE) - && (check_fwstate(pmlmepriv, _FW_LINKED) == _TRUE + && (check_fwstate(pmlmepriv, _FW_LINKED) == _TRUE || check_fwstate(pmlmepriv, _FW_UNDER_LINKING) == _TRUE ) ) { @@ -1355,7 +1355,7 @@ _func_enter_; #ifdef DBG_RX_DROP_FRAME DBG_871X("DBG_RX_DROP_FRAME %s SA="MAC_FMT", myhwaddr="MAC_FMT"\n", __FUNCTION__, MAC_ARG(pattrib->src), MAC_ARG(myhwaddr)); - #endif + #endif ret= _FAIL; goto exit; } @@ -1461,11 +1461,11 @@ _func_enter_; if (*psta == NULL) { DBG_871X("issue_deauth to the ap=" MAC_FMT " for the reason(7)\n", MAC_ARG(pattrib->bssid)); - + issue_deauth(adapter, pattrib->bssid, WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA); } - } - + } + ret = _FAIL; #ifdef DBG_RX_DROP_FRAME DBG_871X("DBG_RX_DROP_FRAME %s fw_state:0x%x\n", __FUNCTION__, get_fwstate(pmlmepriv)); @@ -1491,9 +1491,9 @@ sint sta2ap_data_frame( { u8 *ptr = precv_frame->u.hdr.rx_data; struct rx_pkt_attrib *pattrib = & precv_frame->u.hdr.attrib; - struct sta_priv *pstapriv = &adapter->stapriv; + struct sta_priv *pstapriv = &adapter->stapriv; struct mlme_priv *pmlmepriv = &adapter->mlmepriv; - unsigned char *mybssid = get_bssid(pmlmepriv); + unsigned char *mybssid = get_bssid(pmlmepriv); sint ret=_SUCCESS; _func_enter_; @@ -1560,11 +1560,11 @@ sint validate_recv_ctrl_frame(struct adapter *padapter, union recv_frame *precv_ struct sta_priv *pstapriv = &padapter->stapriv; u8 *pframe = precv_frame->u.hdr.rx_data; //uint len = precv_frame->u.hdr.len; - + //DBG_871X("+validate_recv_ctrl_frame\n"); if (GetFrameType(pframe) != WIFI_CTRL_TYPE) - { + { return _FAIL; } @@ -1578,12 +1578,12 @@ sint validate_recv_ctrl_frame(struct adapter *padapter, union recv_frame *precv_ if(GetFrameSubType(pframe) == WIFI_PSPOLL) { u16 aid; - u8 wmmps_ac=0; + u8 wmmps_ac=0; struct sta_info *psta=NULL; - + aid = GetAid(pframe); psta = rtw_get_stainfo(pstapriv, GetAddr2Ptr(pframe)); - + if((psta==NULL) || (psta->aid!=aid)) { return _FAIL; @@ -1610,26 +1610,26 @@ sint validate_recv_ctrl_frame(struct adapter *padapter, union recv_frame *precv_ case 3: default: wmmps_ac = psta->uapsd_be&BIT(0); - break; + break; } if(wmmps_ac) return _FAIL; if(psta->state & WIFI_STA_ALIVE_CHK_STATE) - { + { DBG_871X("%s alive check-rx ps-poll\n", __func__); psta->expire_to = pstapriv->expire_to; psta->state ^= WIFI_STA_ALIVE_CHK_STATE; - } + } if((psta->state&WIFI_SLEEP_STATE) && (pstapriv->sta_dz_bitmap&BIT(psta->aid))) { - _irqL irqL; + _irqL irqL; _list *xmitframe_plist, *xmitframe_phead; struct xmit_frame *pxmitframe=NULL; struct xmit_priv *pxmitpriv = &padapter->xmitpriv; - + //_enter_critical_bh(&psta->sleep_q.lock, &irqL); _enter_critical_bh(&pxmitpriv->lock, &irqL); @@ -1637,7 +1637,7 @@ sint validate_recv_ctrl_frame(struct adapter *padapter, union recv_frame *precv_ xmitframe_plist = get_next(xmitframe_phead); if ((rtw_end_of_queue_search(xmitframe_phead, xmitframe_plist)) == _FALSE) - { + { pxmitframe = LIST_CONTAINOR(xmitframe_plist, struct xmit_frame, list); xmitframe_plist = get_next(xmitframe_plist); @@ -1656,12 +1656,12 @@ sint validate_recv_ctrl_frame(struct adapter *padapter, union recv_frame *precv_ //DBG_871X("handling ps-poll, q_len=%d, tim=%x\n", psta->sleepq_len, pstapriv->tim_bitmap); #if 0 - _exit_critical_bh(&psta->sleep_q.lock, &irqL); + _exit_critical_bh(&psta->sleep_q.lock, &irqL); if(rtw_hal_xmit(padapter, pxmitframe) == _TRUE) - { + { rtw_os_xmit_complete(padapter, pxmitframe); } - _enter_critical_bh(&psta->sleep_q.lock, &irqL); + _enter_critical_bh(&psta->sleep_q.lock, &irqL); #endif rtw_hal_xmitframe_enqueue(padapter, pxmitframe); @@ -1672,19 +1672,19 @@ sint validate_recv_ctrl_frame(struct adapter *padapter, union recv_frame *precv_ //DBG_871X("after handling ps-poll, tim=%x\n", pstapriv->tim_bitmap); //upate BCN for TIM IE - //update_BCNTIM(padapter); + //update_BCNTIM(padapter); update_beacon(padapter, _TIM_IE_, NULL, _FALSE); } - + //_exit_critical_bh(&psta->sleep_q.lock, &irqL); _exit_critical_bh(&pxmitpriv->lock, &irqL); - + } else { //_exit_critical_bh(&psta->sleep_q.lock, &irqL); _exit_critical_bh(&pxmitpriv->lock, &irqL); - + //DBG_871X("no buffered packets to xmit\n"); if(pstapriv->tim_bitmap&BIT(psta->aid)) { @@ -1698,22 +1698,22 @@ sint validate_recv_ctrl_frame(struct adapter *padapter, union recv_frame *precv_ else { DBG_871X("error!psta->sleepq_len=%d\n", psta->sleepq_len); - psta->sleepq_len=0; + psta->sleepq_len=0; } - - pstapriv->tim_bitmap &= ~BIT(psta->aid); + + pstapriv->tim_bitmap &= ~BIT(psta->aid); //upate BCN for TIM IE //update_BCNTIM(padapter); update_beacon(padapter, _TIM_IE_, NULL, _FALSE); } - - } - + + } + } - + } - + #endif return _FAIL; @@ -1764,7 +1764,7 @@ sint validate_recv_mgnt_frame(struct adapter *padapter, union recv_frame *precv_ else if (is_broadcast_mac_addr(GetAddr1Ptr(precv_frame->u.hdr.rx_data)) || is_multicast_mac_addr(GetAddr1Ptr(precv_frame->u.hdr.rx_data))) psta->sta_stats.rx_probersp_bm_pkts++; - else + else psta->sta_stats.rx_probersp_uo_pkts++; } } @@ -1776,7 +1776,7 @@ sint validate_recv_mgnt_frame(struct adapter *padapter, union recv_frame *precv_ struct rx_pkt_attrib * pattrib=&precv_frame->u.hdr.attrib; struct recv_stat* prxstat=( struct recv_stat * ) precv_frame->u.hdr.rx_head ; u8 * pda,*psa,*pbssid,*ptr; - ptr=precv_frame->u.hdr.rx_data; + ptr=precv_frame->u.hdr.rx_data; pda = get_da(ptr); psa = get_sa(ptr); pbssid = get_hdr_bssid(ptr); @@ -1813,7 +1813,7 @@ sint validate_recv_mgnt_frame(struct adapter *padapter, union recv_frame *precv_ default: break; - } + } pattrib->priority=0; pattrib->hdrlen = pattrib->to_fr_ds==3 ? 30 : 24; @@ -1834,8 +1834,8 @@ sint validate_recv_data_frame(struct adapter *adapter, union recv_frame *precv_f struct sta_info *psta = NULL; u8 *ptr = precv_frame->u.hdr.rx_data; struct rx_pkt_attrib *pattrib = & precv_frame->u.hdr.attrib; - struct sta_priv *pstapriv = &adapter->stapriv; - struct security_priv *psecuritypriv = &adapter->securitypriv; + struct sta_priv *pstapriv = &adapter->stapriv; + struct security_priv *psecuritypriv = &adapter->securitypriv; sint ret = _SUCCESS; #ifdef CONFIG_TDLS struct tdls_info *ptdlsinfo = &adapter->tdlsinfo; @@ -1912,11 +1912,11 @@ _func_enter_; ret= _FAIL; goto exit; } - + //psta->rssi = prxcmd->rssi; //psta->signal_quality= prxcmd->sq; precv_frame->u.hdr.psta = psta; - + pattrib->amsdu=0; pattrib->ack_policy = 0; @@ -2005,22 +2005,22 @@ static sint validate_80211w_mgmt(struct adapter *adapter, union recv_frame *prec u8 *ptr = precv_frame->u.hdr.rx_data; u8 type; u8 subtype; - + type = GetFrameType(ptr); subtype = GetFrameSubType(ptr); //bit(7)~bit(2) - + //only support station mode - if(check_fwstate(pmlmepriv, WIFI_STATION_STATE) && check_fwstate(pmlmepriv, _FW_LINKED) + if(check_fwstate(pmlmepriv, WIFI_STATION_STATE) && check_fwstate(pmlmepriv, _FW_LINKED) && adapter->securitypriv.binstallBIPkey == _TRUE) { //unicast management frame decrypt - if(pattrib->privacy && !(IS_MCAST(GetAddr1Ptr(ptr))) && + if(pattrib->privacy && !(IS_MCAST(GetAddr1Ptr(ptr))) && (subtype == WIFI_DEAUTH || subtype == WIFI_DISASSOC || subtype == WIFI_ACTION)) { u8 *ppp, *mgmt_DATA; u32 data_len=0; ppp = GetAddr2Ptr(ptr); - + pattrib->bdecrypted = 0; pattrib->encrypt = _AES_; pattrib->hdrlen = sizeof(struct rtw_ieee80211_hdr_3addr); @@ -2044,7 +2044,7 @@ static sint validate_80211w_mgmt(struct adapter *adapter, union recv_frame *prec printk(" %02x ", ptr[pp]); printk("\n"); }*/ - + precv_frame = decryptor(adapter, precv_frame); //save actual management data frame body _rtw_memcpy(mgmt_DATA, ptr+pattrib->hdrlen+pattrib->iv_len, data_len); @@ -2111,10 +2111,10 @@ static sint validate_80211w_mgmt(struct adapter *adapter, union recv_frame *prec } } return _SUCCESS; - + validate_80211w_fail: return _FAIL; - + } #endif //CONFIG_IEEE80211W @@ -2210,7 +2210,7 @@ _func_enter_; if(bDumpRxPkt ==1){//dump all rx packets int i; DBG_871X("############################# \n"); - + for(i=0; i<64;i=i+8) DBG_871X("%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X:\n", *(ptr+i), *(ptr+i+1), *(ptr+i+2) ,*(ptr+i+3) ,*(ptr+i+4),*(ptr+i+5), *(ptr+i+6), *(ptr+i+7)); @@ -2231,7 +2231,7 @@ _func_enter_; if(type== WIFI_DATA_TYPE){ int i; DBG_871X("############################# \n"); - + for(i=0; i<64;i=i+8) DBG_871X("%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X:\n", *(ptr+i), *(ptr+i+1), *(ptr+i+2) ,*(ptr+i+3) ,*(ptr+i+4),*(ptr+i+5), *(ptr+i+6), *(ptr+i+7)); @@ -2250,7 +2250,7 @@ _func_enter_; break; } #endif //CONFIG_IEEE80211W - + retval = validate_recv_mgnt_frame(adapter, precv_frame); if (retval == _FAIL) { @@ -2272,7 +2272,7 @@ _func_enter_; external_len = 2; else external_len= 0; - + wai_pkt = rtw_wapi_is_wai_packet(adapter,ptr); phdr->bIsWaiPacket = wai_pkt; @@ -2337,7 +2337,7 @@ sint wlanhdr_to_ethhdr ( union recv_frame *precvframe) u8 bsnaphdr; u8 *psnap_type; struct ieee80211_snap_hdr *psnap; - + sint ret=_SUCCESS; struct adapter *adapter =precvframe->u.hdr.adapter; struct mlme_priv *pmlmepriv = &adapter->mlmepriv; @@ -2348,7 +2348,7 @@ sint wlanhdr_to_ethhdr ( union recv_frame *precvframe) _func_enter_; if(pattrib->encrypt){ - recvframe_pull_tail(precvframe, pattrib->icv_len); + recvframe_pull_tail(precvframe, pattrib->icv_len); } psnap=(struct ieee80211_snap_hdr *)(ptr+pattrib->hdrlen + pattrib->iv_len); @@ -2356,7 +2356,7 @@ _func_enter_; /* convert hdr + possible LLC headers into Ethernet header */ //eth_type = (psnap_type[0] << 8) | psnap_type[1]; if((_rtw_memcmp(psnap, rtw_rfc1042_header, SNAP_SIZE) && - (_rtw_memcmp(psnap_type, SNAP_ETH_TYPE_IPX, 2) == _FALSE) && + (_rtw_memcmp(psnap_type, SNAP_ETH_TYPE_IPX, 2) == _FALSE) && (_rtw_memcmp(psnap_type, SNAP_ETH_TYPE_APPLETALK_AARP, 2)==_FALSE) )|| //eth_type != ETH_P_AARP && eth_type != ETH_P_IPX) || _rtw_memcmp(psnap, rtw_bridge_tunnel_header, SNAP_SIZE)){ @@ -2377,9 +2377,9 @@ _func_enter_; eth_type= ntohs((unsigned short )eth_type); //pattrib->ether_type pattrib->eth_type = eth_type; - if ((check_fwstate(pmlmepriv, WIFI_MP_STATE) == _TRUE)) + if ((check_fwstate(pmlmepriv, WIFI_MP_STATE) == _TRUE)) { - ptr += rmv_len ; + ptr += rmv_len ; *ptr = 0x87; *(ptr+1) = 0x12; @@ -2401,7 +2401,7 @@ _func_enter_; _rtw_memcpy(ptr+12, &len, 2); } -_func_exit_; +_func_exit_; return ret; } @@ -2431,7 +2431,7 @@ _func_enter_; if (psnap->dsap==0xaa && psnap->ssap==0xaa && psnap->ctrl==0x03) { if (_rtw_memcmp(psnap->oui, oui_rfc1042, WLAN_IEEE_OUI_LEN)) - bsnaphdr=_TRUE;//wlan_pkt_format = WLAN_PKT_FORMAT_SNAP_RFC1042; + bsnaphdr=_TRUE;//wlan_pkt_format = WLAN_PKT_FORMAT_SNAP_RFC1042; else if (_rtw_memcmp(psnap->oui, SNAP_HDR_APPLETALK_DDP, WLAN_IEEE_OUI_LEN) && _rtw_memcmp(psnap_type, SNAP_ETH_TYPE_APPLETALK_DDP, 2) ) bsnaphdr=_TRUE; //wlan_pkt_format = WLAN_PKT_FORMAT_APPLETALK; @@ -2819,7 +2819,7 @@ int amsdu_to_msdu(struct adapter *padapter, union recv_frame *prframe); int amsdu_to_msdu(struct adapter *padapter, union recv_frame *prframe) { int a_len, padding_len; - u16 eth_type, nSubframe_Length; + u16 eth_type, nSubframe_Length; u8 nr_subframes, i; unsigned char *pdata; struct rx_pkt_attrib *pattrib; @@ -2833,7 +2833,7 @@ int amsdu_to_msdu(struct adapter *padapter, union recv_frame *prframe) pattrib = &prframe->u.hdr.attrib; recvframe_pull(prframe, prframe->u.hdr.attrib.hdrlen); - + if(prframe->u.hdr.attrib.iv_len >0) { recvframe_pull(prframe, prframe->u.hdr.attrib.iv_len); @@ -2844,7 +2844,7 @@ int amsdu_to_msdu(struct adapter *padapter, union recv_frame *prframe) pdata = prframe->u.hdr.rx_data; while(a_len > ETH_HLEN) { - + /* Offset 12 denote 2 mac address */ #ifdef ENDIAN_FREE //nSubframe_Length = ntohs(*((u16*)(pdata + 12))); @@ -2921,7 +2921,7 @@ int amsdu_to_msdu(struct adapter *padapter, union recv_frame *prframe) #ifdef ENDIAN_FREE //eth_type = ntohs(*(u16*)&sub_skb->data[6]); eth_type = RTW_GET_BE16(&sub_skb->data[6]); -#else // ENDIAN_FREE +#else // ENDIAN_FREE eth_type = (sub_skb->data[6] << 8) | sub_skb->data[7]; #endif // ENDIAN_FREE if (sub_skb->len >= 8 && @@ -2966,14 +2966,14 @@ int amsdu_to_msdu(struct adapter *padapter, union recv_frame *prframe) //priv->ext_stats.rx_data_drops++; //DEBUG_ERR("RX DROP: nat25_handle_frame fail!\n"); //return FAIL; - + #if 1 // bypass this frame to upper layer!! #else rtw_skb_free(sub_skb); continue; #endif - } + } } #endif // CONFIG_BR_EXT @@ -2998,7 +2998,7 @@ exit: prframe->u.hdr.len=0; rtw_free_recvframe(prframe, pfree_recv_queue);//free this recv_frame - + return ret; } @@ -3028,7 +3028,7 @@ int check_indicate_seq(struct recv_reorder_ctrl *preorder_ctrl, u16 seq_num) //DbgPrint("CheckRxTsIndicateSeq(): Packet Drop! IndicateSeq: %d, NewSeq: %d\n", precvpriv->indicate_seq, seq_num); #ifdef DBG_RX_DROP_FRAME - DBG_871X("%s IndicateSeq: %d > NewSeq: %d\n", __FUNCTION__, + DBG_871X("%s IndicateSeq: %d > NewSeq: %d\n", __FUNCTION__, preorder_ctrl->indicate_seq, seq_num); #endif @@ -3151,7 +3151,7 @@ int recv_indicatepkts_in_order(struct adapter *padapter, struct recv_reorder_ctr //_enter_critical_ex(&ppending_recvframe_queue->lock, &irql); //_rtw_spinlock_ex(&ppending_recvframe_queue->lock); - phead = get_list_head(ppending_recvframe_queue); + phead = get_list_head(ppending_recvframe_queue); plist = get_next(phead); #if 0 @@ -3169,10 +3169,10 @@ int recv_indicatepkts_in_order(struct adapter *padapter, struct recv_reorder_ctr //_rtw_spinunlock_ex(&ppending_recvframe_queue->lock); return _TRUE; } - + prframe = LIST_CONTAINOR(plist, union recv_frame, u); - pattrib = &prframe->u.hdr.attrib; - preorder_ctrl->indicate_seq = pattrib->seq_num; + pattrib = &prframe->u.hdr.attrib; + preorder_ctrl->indicate_seq = pattrib->seq_num; #ifdef DBG_RX_SEQ DBG_871X("DBG_RX_SEQ %s:%d IndicateSeq: %d, NewSeq: %d\n", __FUNCTION__, __LINE__, preorder_ctrl->indicate_seq, pattrib->seq_num); @@ -3183,7 +3183,7 @@ int recv_indicatepkts_in_order(struct adapter *padapter, struct recv_reorder_ctr // Check if there is any packet need indicate. while(!rtw_is_list_empty(phead)) { - + prframe = LIST_CONTAINOR(plist, union recv_frame, u); pattrib = &prframe->u.hdr.attrib; @@ -3245,9 +3245,9 @@ int recv_indicatepkts_in_order(struct adapter *padapter, struct recv_reorder_ctr if ((padapter->bDriverStopped == _FALSE) && (padapter->bSurpriseRemoved == _FALSE)) { - + rtw_recv_indicatepkt(padapter, prframe);//indicate this recv_frame - + } } else if(pattrib->amsdu==1) @@ -3329,34 +3329,34 @@ int recv_indicatepkt_reorder(struct adapter *padapter, union recv_frame *prframe return _SUCCESS; } - + #ifdef DBG_RX_DROP_FRAME DBG_871X("DBG_RX_DROP_FRAME %s pattrib->qos !=1\n", __FUNCTION__); #endif - + return _FAIL; - + } if (preorder_ctrl->enable == _FALSE) { - //indicate this recv_frame + //indicate this recv_frame preorder_ctrl->indicate_seq = pattrib->seq_num; #ifdef DBG_RX_SEQ DBG_871X("DBG_RX_SEQ %s:%d IndicateSeq: %d, NewSeq: %d\n", __FUNCTION__, __LINE__, preorder_ctrl->indicate_seq, pattrib->seq_num); #endif - - rtw_recv_indicatepkt(padapter, prframe); - + + rtw_recv_indicatepkt(padapter, prframe); + preorder_ctrl->indicate_seq = (preorder_ctrl->indicate_seq + 1)%4096; #ifdef DBG_RX_SEQ DBG_871X("DBG_RX_SEQ %s:%d IndicateSeq: %d, NewSeq: %d\n", __FUNCTION__, __LINE__, preorder_ctrl->indicate_seq, pattrib->seq_num); #endif - - return _SUCCESS; - } + + return _SUCCESS; + } #ifndef CONFIG_RECV_REORDERING_CTRL //indicate this recv_frame @@ -3415,11 +3415,11 @@ int recv_indicatepkt_reorder(struct adapter *padapter, union recv_frame *prframe #ifdef DBG_RX_DROP_FRAME DBG_871X("DBG_RX_DROP_FRAME %s check_indicate_seq fail\n", __FUNCTION__); #endif -#if 0 +#if 0 rtw_recv_indicatepkt(padapter, prframe); _exit_critical_bh(&ppending_recvframe_queue->lock, &irql); - + goto _success_exit; #else goto _err_exit; @@ -3494,7 +3494,7 @@ void rtw_reordering_ctrl_timeout_handler(void *pcontext) if(recv_indicatepkts_in_order(padapter, preorder_ctrl, _TRUE)==_TRUE) { - _set_timer(&preorder_ctrl->reordering_ctrl_timer, REORDER_WAIT_TIME); + _set_timer(&preorder_ctrl->reordering_ctrl_timer, REORDER_WAIT_TIME); } _exit_critical_bh(&ppending_recvframe_queue->lock, &irql); @@ -3518,7 +3518,7 @@ int process_recv_indicatepkts(struct adapter *padapter, union recv_frame *prfram #ifdef CONFIG_TDLS if( (phtpriv->ht_option==_TRUE) || - ((psta->tdls_sta_state & TDLS_LINKED_STATE) && + ((psta->tdls_sta_state & TDLS_LINKED_STATE) && (psta->htpriv.ht_option==_TRUE) && (psta->htpriv.ampdu_enable==_TRUE))) //B/G/N Mode #else @@ -3532,7 +3532,7 @@ int process_recv_indicatepkts(struct adapter *padapter, union recv_frame *prfram #ifdef DBG_RX_DROP_FRAME DBG_871X("DBG_RX_DROP_FRAME %s recv_indicatepkt_reorder error!\n", __FUNCTION__); #endif - + if ((padapter->bDriverStopped == _FALSE) && (padapter->bSurpriseRemoved == _FALSE)) { @@ -3605,7 +3605,7 @@ int recv_func_posthandle(struct adapter *padapter, union recv_frame *prframe) struct rx_pkt_attrib *pattrib = &prframe->u.hdr.attrib; struct recv_priv *precvpriv = &padapter->recvpriv; _queue *pfree_recv_queue = &padapter->recvpriv.free_recv_queue; - + #ifdef CONFIG_TDLS u8 *psnap_type, *pcategory; @@ -3661,7 +3661,7 @@ int recv_func_posthandle(struct adapter *padapter, union recv_frame *prframe) #ifdef DBG_RX_DROP_FRAME DBG_871X("DBG_RX_DROP_FRAME %s recvframe_chk_defrag: drop pkt\n", __FUNCTION__); #endif - goto _recv_data_drop; + goto _recv_data_drop; } prframe=portctrl(padapter, prframe); @@ -3717,7 +3717,7 @@ int recv_func_posthandle(struct adapter *padapter, union recv_frame *prframe) //indicate this recv_frame ret = rtw_recv_indicatepkt(padapter, prframe); if (ret != _SUCCESS) - { + { #ifdef DBG_RX_DROP_FRAME DBG_871X("DBG_RX_DROP_FRAME %s rtw_recv_indicatepkt fail!\n", __FUNCTION__); #endif @@ -3796,7 +3796,7 @@ int recv_func(struct adapter *padapter, union recv_frame *rframe) ret = recv_func_prehandle(padapter, rframe); if(ret == _SUCCESS) { - + /* check if need to enqueue into uc_swdec_pending_queue*/ if (check_fwstate(mlmepriv, WIFI_STATION_STATE) && !IS_MCAST(prxattrib->ra) && prxattrib->encrypt>0 && @@ -3864,7 +3864,7 @@ _func_exit_; void rtw_signal_stat_timer_hdl(RTW_TIMER_HDL_ARGS){ struct adapter *adapter = (struct adapter *)FunctionContext; struct recv_priv *recvpriv = &adapter->recvpriv; - + u32 tmp_s, tmp_q; u8 avg_signal_strength = 0; u8 avg_signal_qual = 0; @@ -3884,7 +3884,7 @@ void rtw_signal_stat_timer_hdl(RTW_TIMER_HDL_ARGS){ // after avg_vals are accquired, we can re-stat the signal values recvpriv->signal_strength_data.update_req = 1; } - + if(recvpriv->signal_qual_data.update_req == 0) {// update_req is clear, means we got rx avg_signal_qual = recvpriv->signal_qual_data.avg_val; num_signal_qual = recvpriv->signal_qual_data.total_num; @@ -3905,7 +3905,7 @@ void rtw_signal_stat_timer_hdl(RTW_TIMER_HDL_ARGS){ if(check_fwstate(&adapter->mlmepriv, _FW_UNDER_SURVEY) == _TRUE || check_fwstate(&adapter->mlmepriv, _FW_LINKED) == _FALSE - ) { + ) { goto set_timer; } @@ -3952,9 +3952,6 @@ void rtw_signal_stat_timer_hdl(RTW_TIMER_HDL_ARGS){ set_timer: rtw_set_signal_stat_timer(recvpriv); - + } #endif //CONFIG_NEW_SIGNAL_STAT_PROCESS - - - diff --git a/core/rtw_rf.c b/core/rtw_rf.c index 7ae8635..52234bd 100755 --- a/core/rtw_rf.c +++ b/core/rtw_rf.c @@ -1,7 +1,7 @@ /****************************************************************************** * * 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. @@ -92,4 +92,3 @@ u32 rtw_freq2ch(u32 freq) return ch; } - diff --git a/core/rtw_security.c b/core/rtw_security.c index 10e12b1..a0b7db0 100755 --- a/core/rtw_security.c +++ b/core/rtw_security.c @@ -1,7 +1,7 @@ /****************************************************************************** * * 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. @@ -26,7 +26,7 @@ #include -//=====WEP related===== +//=====WEP related===== #define CRC32_POLY 0x04c11db7 @@ -38,7 +38,7 @@ struct arc4context }; -static void arcfour_init(struct arc4context *parc4ctx, u8 * key,u32 key_len) +static void arcfour_init(struct arc4context *parc4ctx, u8 * key,u32 key_len) { u32 t, u; u32 keyindex; @@ -63,7 +63,7 @@ _func_enter_; if (++keyindex >= key_len) keyindex = 0; } -_func_exit_; +_func_exit_; } static u32 arcfour_byte( struct arc4context *parc4ctx) { @@ -81,21 +81,21 @@ _func_enter_; parc4ctx->y = y; state[y] = (u8)sx; state[x] = (u8)sy; -_func_exit_; +_func_exit_; return state[(sx + sy) & 0xff]; } - - -static void arcfour_encrypt( struct arc4context *parc4ctx, + + +static void arcfour_encrypt( struct arc4context *parc4ctx, u8 * dest, - u8 * src, + u8 * src, u32 len) { u32 i; -_func_enter_; +_func_enter_; for (i = 0; i < len; i++) dest[i] = src[i] ^ (unsigned char)arcfour_byte(parc4ctx); -_func_exit_; +_func_exit_; } static sint bcrc32initialized = 0; @@ -109,8 +109,8 @@ static u8 crc32_reverseBit( u8 data) static void crc32_init(void) { -_func_enter_; - if (bcrc32initialized == 1) +_func_enter_; + if (bcrc32initialized == 1) goto exit; else{ sint i, j; @@ -120,7 +120,7 @@ _func_enter_; c = 0x12340000; - for (i = 0; i < 256; ++i) + for (i = 0; i < 256; ++i) { k = crc32_reverseBit((u8)i); for (c = ((u32)k) << 24, j = 8; j > 0; --j){ @@ -135,24 +135,24 @@ _func_enter_; } bcrc32initialized= 1; } -exit: -_func_exit_; +exit: +_func_exit_; } static u32 getcrc32(u8 *buf, sint len) { u8 *p; u32 crc; -_func_enter_; +_func_enter_; if (bcrc32initialized == 0) crc32_init(); crc = 0xffffffff; /* preload shift register, per CRC-32 spec */ - for (p = buf; len > 0; ++p, --len) + for (p = buf; len > 0; ++p, --len) { crc = crc32_table[ (crc ^ *p) & 0xff] ^ (crc >> 8); } -_func_exit_; +_func_exit_; return ~crc; /* transmit complement, per CRC-32 spec */ } @@ -162,7 +162,7 @@ _func_exit_; */ void rtw_wep_encrypt(struct adapter *padapter, u8 *pxmitframe) { // exclude ICV - + unsigned char crc[4]; struct arc4context mycontext; @@ -173,18 +173,18 @@ void rtw_wep_encrypt(struct adapter *padapter, u8 *pxmitframe) u8 wepkey[16]; u8 hw_hdr_offset=0; struct pkt_attrib *pattrib = &((struct xmit_frame*)pxmitframe)->attrib; - struct security_priv *psecuritypriv=&padapter->securitypriv; + struct security_priv *psecuritypriv=&padapter->securitypriv; struct xmit_priv *pxmitpriv=&padapter->xmitpriv; - -_func_enter_; - +_func_enter_; + + if(((struct xmit_frame*)pxmitframe)->buf_addr==NULL) return; #ifdef CONFIG_USB_TX_AGGREGATION hw_hdr_offset = TXDESC_SIZE + - (((struct xmit_frame*)pxmitframe)->pkt_offset * PACKET_OFFSET_SZ); + (((struct xmit_frame*)pxmitframe)->pkt_offset * PACKET_OFFSET_SZ); #else #ifdef CONFIG_TX_EARLY_MODE hw_hdr_offset = TXDESC_OFFSET+EARLY_MODE_INFO_SIZE; @@ -194,7 +194,7 @@ _func_enter_; #endif pframe = ((struct xmit_frame*)pxmitframe)->buf_addr + hw_hdr_offset; - + //start to encrypt each fragment if((pattrib->encrypt==_WEP40_)||(pattrib->encrypt==_WEP104_)) { @@ -209,9 +209,9 @@ _func_enter_; if((curfragnum+1)==pattrib->nr_frags) { //the last fragment - + length=pattrib->last_txcmdsz-pattrib->hdrlen-pattrib->iv_len- pattrib->icv_len; - + *((u32 *)crc)=cpu_to_le32(getcrc32(payload,length)); arcfour_init(&mycontext, wepkey,3+keylength); @@ -226,36 +226,36 @@ _func_enter_; arcfour_init(&mycontext, wepkey,3+keylength); arcfour_encrypt(&mycontext, payload, payload, length); arcfour_encrypt(&mycontext, payload+length, crc, 4); - + pframe+=pxmitpriv->frag_len; pframe=(u8 *)RND4((SIZE_PTR)(pframe)); } - - } - + + } + } - -_func_exit_; + +_func_exit_; } void rtw_wep_decrypt(struct adapter *padapter, u8 *precvframe) -{ +{ // exclude ICV u8 crc[4]; struct arc4context mycontext; - sint length; + sint length; u32 keylength; u8 *pframe, *payload,*iv,wepkey[16]; u8 keyindex; struct rx_pkt_attrib *prxattrib = &(((union recv_frame*)precvframe)->u.hdr.attrib); - struct security_priv *psecuritypriv=&padapter->securitypriv; + struct security_priv *psecuritypriv=&padapter->securitypriv; -_func_enter_; +_func_enter_; pframe=(unsigned char *)((union recv_frame*)precvframe)->u.hdr.rx_data; - + //start to decrypt recvframe if((prxattrib->encrypt==_WEP40_)||(prxattrib->encrypt==_WEP104_)) { @@ -269,41 +269,41 @@ _func_enter_; length= ((union recv_frame *)precvframe)->u.hdr.len-prxattrib->hdrlen-prxattrib->iv_len; payload=pframe+prxattrib->iv_len+prxattrib->hdrlen; - + //decrypt payload include icv arcfour_init(&mycontext, wepkey,3+keylength); arcfour_encrypt(&mycontext, payload, payload, length); - + //calculate icv and compare the icv *((u32 *)crc)=le32_to_cpu(getcrc32(payload,length-4)); - + if(crc[3]!=payload[length-1] || crc[2]!=payload[length-2] || crc[1]!=payload[length-3] || crc[0]!=payload[length-4]) { RT_TRACE(_module_rtl871x_security_c_,_drv_err_,("rtw_wep_decrypt:icv error crc[3](%x)!=payload[length-1](%x) || crc[2](%x)!=payload[length-2](%x) || crc[1](%x)!=payload[length-3](%x) || crc[0](%x)!=payload[length-4](%x)\n", crc[3],payload[length-1],crc[2],payload[length-2],crc[1],payload[length-3],crc[0],payload[length-4])); - } - + } + } - -_func_exit_; + +_func_exit_; return; - + } -//3 =====TKIP related===== +//3 =====TKIP related===== static u32 secmicgetuint32( u8 * p ) // Convert from Byte[] to Us4Byte32 in a portable way { s32 i; u32 res = 0; -_func_enter_; +_func_enter_; for( i=0; i<4; i++ ) { res |= ((u32)(*p++)) << (8*i); } -_func_exit_; +_func_exit_; return res; } @@ -311,40 +311,40 @@ static void secmicputuint32( u8 * p, u32 val ) // Convert from Us4Byte32 to Byte[] in a portable way { long i; -_func_enter_; +_func_enter_; for( i=0; i<4; i++ ) { *p++ = (u8) (val & 0xff); val >>= 8; } -_func_exit_; +_func_exit_; } static void secmicclear(struct mic_data *pmicdata) { // Reset the state to the empty message. -_func_enter_; +_func_enter_; pmicdata->L = pmicdata->K0; pmicdata->R = pmicdata->K1; pmicdata->nBytesInM = 0; pmicdata->M = 0; -_func_exit_; +_func_exit_; } void rtw_secmicsetkey(struct mic_data *pmicdata, u8 * key ) { // Set the key -_func_enter_; +_func_enter_; pmicdata->K0 = secmicgetuint32( key ); pmicdata->K1 = secmicgetuint32( key + 4 ); // and reset the message secmicclear(pmicdata); -_func_exit_; +_func_exit_; } void rtw_secmicappendbyte(struct mic_data *pmicdata, u8 b ) { -_func_enter_; +_func_enter_; // Append the byte to our word-sized buffer pmicdata->M |= ((unsigned long)b) << (8*pmicdata->nBytesInM); pmicdata->nBytesInM++; @@ -364,24 +364,24 @@ _func_enter_; pmicdata->M = 0; pmicdata->nBytesInM = 0; } -_func_exit_; +_func_exit_; } void rtw_secmicappend(struct mic_data *pmicdata, u8 * src, u32 nbytes ) { -_func_enter_; +_func_enter_; // This is simple while( nbytes > 0 ) { rtw_secmicappendbyte(pmicdata, *src++ ); nbytes--; } -_func_exit_; +_func_exit_; } void rtw_secgetmic(struct mic_data *pmicdata, u8 * dst ) { -_func_enter_; +_func_enter_; // Append the minimum padding rtw_secmicappendbyte(pmicdata, 0x5a ); rtw_secmicappendbyte(pmicdata, 0 ); @@ -398,7 +398,7 @@ _func_enter_; secmicputuint32( dst+4, pmicdata->R ); // Reset to the empty message. secmicclear(pmicdata); -_func_exit_; +_func_exit_; } @@ -407,18 +407,18 @@ void rtw_seccalctkipmic(u8 * key,u8 *header,u8 *data,u32 data_len,u8 *mic_code, struct mic_data micdata; u8 priority[4]={0x0,0x0,0x0,0x0}; -_func_enter_; +_func_enter_; rtw_secmicsetkey(&micdata, key); priority[0]=pri; - + /* Michael MIC pseudo header: DA, SA, 3 x 0, Priority */ if(header[1]&1){ //ToDS==1 rtw_secmicappend(&micdata, &header[16], 6); //DA if(header[1]&2) //From Ds==1 rtw_secmicappend(&micdata, &header[24], 6); else - rtw_secmicappend(&micdata, &header[10], 6); - } + rtw_secmicappend(&micdata, &header[10], 6); + } else{ //ToDS==0 rtw_secmicappend(&micdata, &header[4], 6); //DA if(header[1]&2) //From Ds==1 @@ -429,11 +429,11 @@ _func_enter_; } rtw_secmicappend(&micdata, &priority[0], 4); - + rtw_secmicappend(&micdata, data, data_len); rtw_secgetmic(&micdata,mic_code); -_func_exit_; +_func_exit_; } @@ -497,7 +497,7 @@ static const unsigned short Sbox1[2][256]= /* Sbox for hash (can be in ROM 0x038F,0x59F8,0x0980,0x1A17,0x65DA,0xD731,0x84C6,0xD0B8, 0x82C3,0x29B0,0x5A77,0x1E11,0x7BCB,0xA8FC,0x6DD6,0x2C3A, }, - + { /* second half of table is unsigned char-reversed version of first! */ 0xA5C6,0x84F8,0x99EE,0x8DF6,0x0DFF,0xBDD6,0xB1DE,0x5491, @@ -534,7 +534,7 @@ static const unsigned short Sbox1[2][256]= /* Sbox for hash (can be in ROM 0xC382,0xB029,0x775A,0x111E,0xCB7B,0xFCA8,0xD66D,0x3A2C, } }; - + /* ********************************************************************** * Routine: Phase 1 -- generate P1K, given TA, TK, IV32 @@ -567,7 +567,7 @@ _func_enter_; /* size on the 80-bit block P1K[], using the 128-bit key TK[] */ for (i=0; i < PHASE1_LOOP_CNT ;i++) { /* Each add operation here is mod 2**16 */ - p1k[0] += _S_(p1k[4] ^ TK16((i&1)+0)); + p1k[0] += _S_(p1k[4] ^ TK16((i&1)+0)); p1k[1] += _S_(p1k[0] ^ TK16((i&1)+2)); p1k[2] += _S_(p1k[1] ^ TK16((i&1)+4)); p1k[3] += _S_(p1k[2] ^ TK16((i&1)+6)); @@ -576,7 +576,7 @@ _func_enter_; } _func_exit_; } - + /* ********************************************************************** @@ -635,7 +635,7 @@ _func_enter_; rc4key[1] =(Hi8(iv16) | 0x20) & 0x7F; /* Help avoid weak (FMS) keys */ rc4key[2] = Lo8(iv16); rc4key[3] = Lo8((PPK[5] ^ TK16(0)) >> 1); - + /* Copy 96 bits of PPK[0..5] to RC4KEY[4..15] (little-endian) */ for (i=0;i<6;i++) @@ -643,7 +643,7 @@ _func_enter_; rc4key[4+2*i] = Lo8(PPK[i]); rc4key[5+2*i] = Hi8(PPK[i]); } -_func_exit_; +_func_exit_; } @@ -657,14 +657,14 @@ u32 rtw_tkip_encrypt(struct adapter *padapter, u8 *pxmitframe) u8 crc[4]; u8 hw_hdr_offset = 0; struct arc4context mycontext; - sint curfragnum,length; + sint curfragnum,length; u32 prwskeylen; u8 *pframe, *payload,*iv,*prwskey; union pn48 dot11txpn; struct sta_info *stainfo; struct pkt_attrib *pattrib = &((struct xmit_frame *)pxmitframe)->attrib; - struct security_priv *psecuritypriv=&padapter->securitypriv; + struct security_priv *psecuritypriv=&padapter->securitypriv; struct xmit_priv *pxmitpriv=&padapter->xmitpriv; u32 res=_SUCCESS; _func_enter_; @@ -674,7 +674,7 @@ _func_enter_; #ifdef CONFIG_USB_TX_AGGREGATION hw_hdr_offset = TXDESC_SIZE + - (((struct xmit_frame*)pxmitframe)->pkt_offset * PACKET_OFFSET_SZ); + (((struct xmit_frame*)pxmitframe)->pkt_offset * PACKET_OFFSET_SZ); #else #ifdef CONFIG_TX_EARLY_MODE hw_hdr_offset = TXDESC_OFFSET+EARLY_MODE_INFO_SIZE; @@ -695,8 +695,8 @@ _func_enter_; { DBG_871X("%s, call rtw_get_stainfo()\n", __func__); stainfo=rtw_get_stainfo(&padapter->stapriv ,&pattrib->ra[0] ); - } - + } + if (stainfo!=NULL){ if(!(stainfo->state &_FW_LINKED)) @@ -704,7 +704,7 @@ _func_enter_; DBG_871X("%s, psta->state(0x%x) != _FW_LINKED\n", __func__, stainfo->state); return _FAIL; } - + RT_TRACE(_module_rtl871x_security_c_,_drv_err_,("rtw_tkip_encrypt: stainfo!=NULL!!!\n")); if(IS_MCAST(pattrib->ra)) @@ -721,7 +721,7 @@ _func_enter_; for(curfragnum=0;curfragnumnr_frags;curfragnum++){ iv=pframe+pattrib->hdrlen; payload=pframe+pattrib->iv_len+pattrib->hdrlen; - + GET_TKIP_PN(iv, dot11txpn); pnl=(u16)(dot11txpn.val); @@ -729,7 +729,7 @@ _func_enter_; phase1((u16 *)&ttkey[0],prwskey,&pattrib->ta[0],pnh); - phase2(&rc4key[0],prwskey,(u16 *)&ttkey[0],pnl); + phase2(&rc4key[0],prwskey,(u16 *)&ttkey[0],pnl); if((curfragnum+1)==pattrib->nr_frags){ //4 the last fragment length=pattrib->last_txcmdsz-pattrib->hdrlen-pattrib->iv_len- pattrib->icv_len; @@ -747,7 +747,7 @@ _func_enter_; arcfour_init(&mycontext,rc4key,16); arcfour_encrypt(&mycontext, payload, payload, length); arcfour_encrypt(&mycontext, payload+length, crc, 4); - + pframe+=pxmitpriv->frag_len; pframe=(u8 *)RND4((SIZE_PTR)(pframe)); @@ -761,11 +761,11 @@ _func_enter_; DBG_871X("%s, psta==NUL\n", __func__); res=_FAIL; } - + } -_func_exit_; +_func_exit_; return res; - + } @@ -778,21 +778,21 @@ u32 rtw_tkip_decrypt(struct adapter *padapter, u8 *precvframe) u8 ttkey[16]; u8 crc[4]; struct arc4context mycontext; - sint length; + sint length; u32 prwskeylen; u8 *pframe, *payload,*iv,*prwskey; union pn48 dot11txpn; struct sta_info *stainfo; struct rx_pkt_attrib *prxattrib = &((union recv_frame *)precvframe)->u.hdr.attrib; - struct security_priv *psecuritypriv=&padapter->securitypriv; + struct security_priv *psecuritypriv=&padapter->securitypriv; // struct recv_priv *precvpriv=&padapter->recvpriv; u32 res=_SUCCESS; _func_enter_; pframe=(unsigned char *)((union recv_frame*)precvframe)->u.hdr.rx_data; - + //4 start to decrypt recvframe if(prxattrib->encrypt==_TKIP_){ @@ -848,21 +848,21 @@ _func_enter_; prwskey=&stainfo->dot118021x_UncstKey.skey[0]; prwskeylen=16; } - + iv=pframe+prxattrib->hdrlen; payload=pframe+prxattrib->iv_len+prxattrib->hdrlen; length= ((union recv_frame *)precvframe)->u.hdr.len-prxattrib->hdrlen-prxattrib->iv_len; - + GET_TKIP_PN(iv, dot11txpn); pnl=(u16)(dot11txpn.val); pnh=(u32)(dot11txpn.val>>16); phase1((u16 *)&ttkey[0],prwskey,&prxattrib->ta[0],pnh); - phase2(&rc4key[0],prwskey,(unsigned short *)&ttkey[0],pnl); + phase2(&rc4key[0],prwskey,(unsigned short *)&ttkey[0],pnl); //4 decrypt payload include icv - + arcfour_init(&mycontext, rc4key,16); arcfour_encrypt(&mycontext, payload, payload, length); @@ -874,19 +874,19 @@ _func_enter_; crc[3],payload[length-1],crc[2],payload[length-2],crc[1],payload[length-3],crc[0],payload[length-4])); res=_FAIL; } - - + + } else{ RT_TRACE(_module_rtl871x_security_c_,_drv_err_,("rtw_tkip_decrypt: stainfo==NULL!!!\n")); res=_FAIL; } - + } -_func_exit_; +_func_exit_; exit: return res; - + } @@ -989,24 +989,24 @@ static void aes128k128d(u8 *key, u8 *data, u8 *ciphertext); static void xor_128(u8 *a, u8 *b, u8 *out) { sint i; -_func_enter_; +_func_enter_; for (i=0;i<16; i++) { out[i] = a[i] ^ b[i]; } -_func_exit_; +_func_exit_; } static void xor_32(u8 *a, u8 *b, u8 *out) { sint i; -_func_enter_; +_func_enter_; for (i=0;i<4; i++) { out[i] = a[i] ^ b[i]; } -_func_exit_; +_func_exit_; } @@ -1025,7 +1025,7 @@ static void next_key(u8 *key, sint round) 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x36, 0x36 }; -_func_enter_; +_func_enter_; sbox_key[0] = sbox(key[13]); sbox_key[1] = sbox(key[14]); sbox_key[2] = sbox(key[15]); @@ -1039,25 +1039,25 @@ _func_enter_; xor_32(&key[4], &key[0], &key[4]); xor_32(&key[8], &key[4], &key[8]); xor_32(&key[12], &key[8], &key[12]); -_func_exit_; +_func_exit_; } static void byte_sub(u8 *in, u8 *out) { sint i; -_func_enter_; +_func_enter_; for (i=0; i< 16; i++) { out[i] = sbox(in[i]); } -_func_exit_; +_func_exit_; } static void shift_row(u8 *in, u8 *out) { -_func_enter_; +_func_enter_; out[0] = in[0]; out[1] = in[5]; out[2] = in[10]; @@ -1074,7 +1074,7 @@ _func_enter_; out[13] = in[1]; out[14] = in[6]; out[15] = in[11]; -_func_exit_; +_func_exit_; } @@ -1089,7 +1089,7 @@ static void mix_column(u8 *in, u8 *out) u8 rotr[4]; u8 temp[4]; u8 tempb[4]; -_func_enter_; +_func_enter_; for (i=0 ; i<4; i++) { if ((in[i] & 0x80)== 0x80) @@ -1137,7 +1137,7 @@ _func_enter_; xor_32(add1bf7, rotr, temp); xor_32(swap_halfs, rotl,tempb); xor_32(temp, tempb, out); -_func_exit_; +_func_exit_; } @@ -1148,7 +1148,7 @@ static void aes128k128d(u8 *key, u8 *data, u8 *ciphertext) u8 intermediatea[16]; u8 intermediateb[16]; u8 round_key[16]; -_func_enter_; +_func_enter_; for(i=0; i<16; i++) round_key[i] = key[i]; for (round = 0; round < 11; round++) @@ -1176,7 +1176,7 @@ _func_enter_; next_key(round_key, round); } } -_func_exit_; +_func_exit_; } @@ -1197,7 +1197,7 @@ static void construct_mic_iv( ) { sint i; -_func_enter_; +_func_enter_; mic_iv[0] = 0x59; if (qc_exists && a4_exists) mic_iv[1] = mpdu[30] & 0x0f; /* QoS_TC */ if (qc_exists && !a4_exists) mic_iv[1] = mpdu[24] & 0x0f; /* mute bits 7-4 */ @@ -1218,7 +1218,7 @@ _func_enter_; #endif mic_iv[14] = (unsigned char) (payload_length / 256); mic_iv[15] = (unsigned char) (payload_length % 256); -_func_exit_; +_func_exit_; } @@ -1235,7 +1235,7 @@ static void construct_mic_header1( uint frtype// add for CONFIG_IEEE80211W, none 11w also can use ) { -_func_enter_; +_func_enter_; mic_header1[0] = (u8)((header_length - 2) / 256); mic_header1[1] = (u8)((header_length - 2) % 256); #ifdef CONFIG_IEEE80211W @@ -1245,7 +1245,7 @@ _func_enter_; else #endif //CONFIG_IEEE80211W mic_header1[2] = mpdu[0] & 0xcf; /* Mute CF poll & CF ack bits */ - + mic_header1[3] = mpdu[1] & 0xc7; /* Mute retry, more data and pwr mgt bits */ mic_header1[4] = mpdu[4]; /* A1 */ mic_header1[5] = mpdu[5]; @@ -1259,7 +1259,7 @@ _func_enter_; mic_header1[13] = mpdu[13]; mic_header1[14] = mpdu[14]; mic_header1[15] = mpdu[15]; -_func_exit_; +_func_exit_; } @@ -1276,7 +1276,7 @@ static void construct_mic_header2( ) { sint i; -_func_enter_; +_func_enter_; for (i = 0; i<16; i++) mic_header2[i]=0x00; mic_header2[0] = mpdu[16]; /* A3 */ @@ -1311,7 +1311,7 @@ _func_enter_; mic_header2[15] = mpdu[31] & 0x00; } -_func_exit_; +_func_exit_; } @@ -1333,14 +1333,14 @@ static void construct_ctr_preload( ) { sint i = 0; -_func_enter_; +_func_enter_; for (i=0; i<16; i++) ctr_preload[i] = 0x00; i = 0; - + ctr_preload[0] = 0x01; /* flag */ - if (qc_exists && a4_exists) + if (qc_exists && a4_exists) ctr_preload[1] = mpdu[30] & 0x0f; /* QoC_Control */ - if (qc_exists && !a4_exists) + if (qc_exists && !a4_exists) ctr_preload[1] = mpdu[24] & 0x0f; #ifdef CONFIG_IEEE80211W //802.11w management frame should set management bit(4) @@ -1358,7 +1358,7 @@ _func_enter_; #endif ctr_preload[14] = (unsigned char) (c / 256); /* Ctr */ ctr_preload[15] = (unsigned char) (c % 256); -_func_exit_; +_func_exit_; } @@ -1369,12 +1369,12 @@ _func_exit_; static void bitwise_xor(u8 *ina, u8 *inb, u8 *out) { sint i; -_func_enter_; +_func_enter_; for (i=0; i<16; i++) { out[i] = ina[i] ^ inb[i]; } -_func_exit_; +_func_exit_; } @@ -1399,8 +1399,8 @@ static sint aes_cipher(u8 *key, uint hdrlen, // uint offset = 0; uint frtype = GetFrameType(pframe); uint frsubtype = GetFrameSubType(pframe); - -_func_enter_; + +_func_enter_; frsubtype=frsubtype>>4; @@ -1424,7 +1424,7 @@ _func_enter_; { qc_exists = 1; if(hdrlen != WLAN_HDR_A3_QOS_LEN){ - + hdrlen += 2; } } @@ -1436,7 +1436,7 @@ _func_enter_; (frsubtype == 0x0b))) { if(hdrlen != WLAN_HDR_A3_QOS_LEN){ - + hdrlen += 2; } qc_exists = 1; @@ -1450,7 +1450,7 @@ _func_enter_; pn_vector[3]=pframe[hdrlen+5]; pn_vector[4]=pframe[hdrlen+6]; pn_vector[5]=pframe[hdrlen+7]; - + construct_mic_iv( mic_iv, qc_exists, @@ -1513,7 +1513,7 @@ _func_enter_; /* Insert MIC into payload */ for (j = 0; j < 8; j++) - pframe[payload_index+j] = mic[j]; //message[payload_index+j] = mic[j]; + pframe[payload_index+j] = mic[j]; //message[payload_index+j] = mic[j]; payload_index = hdrlen + 8; for (i=0; i< num_blocks; i++) @@ -1571,7 +1571,7 @@ _func_enter_; aes128k128d(key, ctr_preload, aes_out); bitwise_xor(aes_out, padded_buffer, chain_buffer); for (j=0; j<8;j++) pframe[payload_index++] = chain_buffer[j];//for (j=0; j<8;j++) message[payload_index++] = chain_buffer[j]; -_func_exit_; +_func_exit_; return _SUCCESS; } @@ -1583,22 +1583,22 @@ u32 rtw_aes_encrypt(struct adapter *padapter, u8 *pxmitframe) { // exclude ICV - /*static*/ + /*static*/ // unsigned char message[MAX_MSG_SIZE]; - /* Intermediate Buffers */ - sint curfragnum,length; + /* Intermediate Buffers */ + sint curfragnum,length; u32 prwskeylen; u8 *pframe,*prwskey; //, *payload,*iv u8 hw_hdr_offset = 0; struct sta_info *stainfo; struct pkt_attrib *pattrib = &((struct xmit_frame *)pxmitframe)->attrib; - struct security_priv *psecuritypriv=&padapter->securitypriv; + struct security_priv *psecuritypriv=&padapter->securitypriv; struct xmit_priv *pxmitpriv=&padapter->xmitpriv; // uint offset = 0; u32 res=_SUCCESS; -_func_enter_; +_func_enter_; if(((struct xmit_frame*)pxmitframe)->buf_addr==NULL) return _FAIL; @@ -1611,7 +1611,7 @@ _func_enter_; hw_hdr_offset = TXDESC_OFFSET+EARLY_MODE_INFO_SIZE; #else hw_hdr_offset = TXDESC_OFFSET; - #endif + #endif #endif pframe = ((struct xmit_frame*)pxmitframe)->buf_addr + hw_hdr_offset; @@ -1628,7 +1628,7 @@ _func_enter_; DBG_871X("%s, call rtw_get_stainfo()\n", __func__); stainfo=rtw_get_stainfo(&padapter->stapriv ,&pattrib->ra[0] ); } - + if (stainfo!=NULL){ if(!(stainfo->state &_FW_LINKED)) @@ -1636,7 +1636,7 @@ _func_enter_; DBG_871X("%s, psta->state(0x%x) != _FW_LINKED\n", __func__, stainfo->state); return _FAIL; } - + RT_TRACE(_module_rtl871x_security_c_,_drv_err_,("rtw_aes_encrypt: stainfo!=NULL!!!\n")); if(IS_MCAST(pattrib->ra)) @@ -1661,17 +1661,17 @@ _func_enter_; #endif //CONFIG_TDLS prwskeylen=16; - + for(curfragnum=0;curfragnumnr_frags;curfragnum++){ - + if((curfragnum+1)==pattrib->nr_frags){ //4 the last fragment length=pattrib->last_txcmdsz-pattrib->hdrlen-pattrib->iv_len- pattrib->icv_len; - + aes_cipher(prwskey,pattrib->hdrlen,pframe, length); } else{ length=pxmitpriv->frag_len-pattrib->hdrlen-pattrib->iv_len-pattrib->icv_len ; - + aes_cipher(prwskey,pattrib->hdrlen,pframe, length); pframe+=pxmitpriv->frag_len; pframe=(u8*)RND4((SIZE_PTR)(pframe)); @@ -1686,7 +1686,7 @@ _func_enter_; DBG_871X("%s, psta==NUL\n", __func__); res=_FAIL; } - + } @@ -1718,7 +1718,7 @@ static sint aes_decipher(u8 *key, uint hdrlen, // uint offset = 0; uint frtype = GetFrameType(pframe); uint frsubtype = GetFrameSubType(pframe); -_func_enter_; +_func_enter_; frsubtype=frsubtype>>4; @@ -1755,7 +1755,7 @@ _func_enter_; { qc_exists = 1; if(hdrlen != WLAN_HDR_A3_QOS_LEN){ - + hdrlen += 2; } }//only for data packet . add for CONFIG_IEEE80211W, none 11w also can use @@ -1766,7 +1766,7 @@ _func_enter_; (frsubtype == 0x0b))) { if(hdrlen != WLAN_HDR_A3_QOS_LEN){ - + hdrlen += 2; } qc_exists = 1; @@ -1778,7 +1778,7 @@ _func_enter_; // now, decrypt pframe with hdrlen offset and plen long payload_index = hdrlen + 8; // 8 is for extiv - + for (i=0; i< num_blocks; i++) { construct_ctr_preload( @@ -1819,7 +1819,7 @@ _func_enter_; for (j=0; ju.hdr.attrib; - struct security_priv *psecuritypriv=&padapter->securitypriv; + struct security_priv *psecuritypriv=&padapter->securitypriv; // struct recv_priv *precvpriv=&padapter->recvpriv; u32 res=_SUCCESS; -_func_enter_; +_func_enter_; pframe=(unsigned char *)((union recv_frame*)precvframe)->u.hdr.rx_data; //4 start to encrypt each fragment if((prxattrib->encrypt==_AES_)){ @@ -2002,7 +2002,7 @@ _func_enter_; static u32 no_gkey_bc_cnt = 0; static u32 no_gkey_mc_cnt = 0; - //in concurrent we should use sw descrypt in group key, so we remove this message + //in concurrent we should use sw descrypt in group key, so we remove this message //DBG_871X("rx bc/mc packets, to perform sw rtw_aes_decrypt\n"); //prwskey = psecuritypriv->dot118021XGrpKey[psecuritypriv->dot118021XGrpKeyid].skey; if(psecuritypriv->binstallGrpkey==_FALSE) @@ -2051,7 +2051,7 @@ _func_enter_; { prwskey=&stainfo->dot118021x_UncstKey.skey[0]; } - + length= ((union recv_frame *)precvframe)->u.hdr.len-prxattrib->hdrlen-prxattrib->iv_len; /*// add for CONFIG_IEEE80211W, debug if(0) @@ -2084,9 +2084,9 @@ _func_enter_; RT_TRACE(_module_rtl871x_security_c_,_drv_err_,("rtw_aes_encrypt: stainfo==NULL!!!\n")); res=_FAIL; } - + } -_func_exit_; +_func_exit_; exit: return res; } @@ -2104,7 +2104,7 @@ u32 rtw_BIP_verify(struct adapter *padapter, u8 *precvframe) struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; ori_len = pattrib->pkt_len-WLAN_HDR_A3_LEN+BIP_AAD_SIZE; BIP_AAD = rtw_zmalloc(ori_len); - + if(BIP_AAD == NULL) { DBG_871X("BIP AAD allocate fail\n"); @@ -2142,7 +2142,7 @@ u32 rtw_BIP_verify(struct adapter *padapter, u8 *precvframe) } //clear the MIC field of MME to zero _rtw_memset(p+2+len-8, 0, 8); - + //conscruct AAD, copy frame control field _rtw_memcpy(BIP_AAD, &pwlanhdr->frame_ctl, 2); ClearRetry(BIP_AAD); @@ -2150,11 +2150,11 @@ u32 rtw_BIP_verify(struct adapter *padapter, u8 *precvframe) ClearMData(BIP_AAD); //conscruct AAD, copy address 1 to address 3 _rtw_memcpy(BIP_AAD+2, pwlanhdr->addr1, 18); - + if(omac1_aes_128(padapter->securitypriv.dot11wBIPKey[padapter->securitypriv.dot11wBIPKeyid].skey , BIP_AAD, ori_len, mic)) goto BIP_exit; - + /*//management packet content { int pp; @@ -2182,7 +2182,7 @@ u32 rtw_BIP_verify(struct adapter *padapter, u8 *precvframe) } else DBG_871X("BIP MIC error!\n"); - + } else res = RTW_RX_HANDLED; @@ -2213,7 +2213,7 @@ static int sha256_compress(struct sha256_state *md, unsigned char *buf) for (i = 16; i < 64; i++) { W[i] = Gamma1(W[i - 2]) + W[i - 7] + Gamma0(W[i - 15]) + W[i - 16]; - } + } /* Compress */ #define RND(a,b,c,d,e,f,g,h,i) \ @@ -2224,7 +2224,7 @@ static int sha256_compress(struct sha256_state *md, unsigned char *buf) for (i = 0; i < 64; ++i) { RND(S[0], S[1], S[2], S[3], S[4], S[5], S[6], S[7], i); - t = S[7]; S[7] = S[6]; S[6] = S[5]; S[5] = S[4]; + t = S[7]; S[7] = S[6]; S[6] = S[5]; S[5] = S[4]; S[4] = S[3]; S[3] = S[2]; S[2] = S[1]; S[1] = S[0]; S[0] = t; } @@ -2945,7 +2945,7 @@ void wpa_tdls_generate_tpk(struct adapter *padapter, struct sta_info *psta) } _rtw_memcpy(data + 2 * ETH_ALEN, get_bssid(pmlmepriv), ETH_ALEN); - sha256_prf(key_input, SHA256_MAC_LEN, "TDLS PMK", data, sizeof(data), (u8 *) &psta->tpk, sizeof(psta->tpk)); + sha256_prf(key_input, SHA256_MAC_LEN, "TDLS PMK", data, sizeof(data), (u8 *) &psta->tpk, sizeof(psta->tpk)); } @@ -2961,7 +2961,7 @@ void wpa_tdls_generate_tpk(struct adapter *padapter, struct sta_info *psta) * * Calculate MIC for TDLS frame. */ -int wpa_tdls_ftie_mic(u8 *kck, u8 trans_seq, +int wpa_tdls_ftie_mic(u8 *kck, u8 trans_seq, u8 *lnkid, u8 *rsnie, u8 *timeoutie, u8 *ftie, u8 *mic) { @@ -3001,7 +3001,7 @@ int wpa_tdls_ftie_mic(u8 *kck, u8 trans_seq, _ftie = (struct wpa_tdls_ftie *) pos; _rtw_memset(_ftie->mic, 0, TDLS_MIC_LEN); pos += 2 + ftie[1]; - + ret = omac1_aes_128(kck, buf, pos - buf, mic); rtw_mfree(buf, len); return ret; @@ -3021,7 +3021,7 @@ int tdls_verify_mic(u8 *kck, u8 trans_seq, timeoutie == NULL || ftie == NULL){ return 0; } - + len = 2 * ETH_ALEN + 1 + 2 + 18 + 2 + *(rsnie+1) + 2 + *(timeoutie+1) + 2 + *(ftie+1); buf = rtw_zmalloc(len); @@ -3076,15 +3076,15 @@ void rtw_use_tkipkey_handler(void *FunctionContext) struct adapter *padapter = (struct adapter *)FunctionContext; -_func_enter_; +_func_enter_; RT_TRACE(_module_rtl871x_security_c_,_drv_err_,("^^^rtw_use_tkipkey_handler ^^^\n")); - + padapter->securitypriv.busetkipkey=_TRUE; RT_TRACE(_module_rtl871x_security_c_,_drv_err_,("^^^rtw_use_tkipkey_handler padapter->securitypriv.busetkipkey=%d^^^\n",padapter->securitypriv.busetkipkey)); -_func_exit_; +_func_exit_; } @@ -3127,4 +3127,3 @@ u8 rtw_handle_tkip_countermeasure(struct adapter* adapter, const char *caller) return status; } - diff --git a/core/rtw_sreset.c b/core/rtw_sreset.c index 2c0492b..ccac742 100755 --- a/core/rtw_sreset.c +++ b/core/rtw_sreset.c @@ -1,356 +1,355 @@ -/****************************************************************************** - * - * Copyright(c) 2007 - 2012 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 - * - * - ******************************************************************************/ - -#include - -void sreset_init_value(struct adapter *padapter) -{ -#if defined(DBG_CONFIG_ERROR_DETECT) - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter); - struct sreset_priv *psrtpriv = &pHalData->srestpriv; - - _rtw_mutex_init(&psrtpriv->silentreset_mutex); - psrtpriv->silent_reset_inprogress = _FALSE; - psrtpriv->Wifi_Error_Status = WIFI_STATUS_SUCCESS; - psrtpriv->last_tx_time =0; - psrtpriv->last_tx_complete_time =0; -#endif -} -void sreset_reset_value(struct adapter *padapter) -{ -#if defined(DBG_CONFIG_ERROR_DETECT) - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter); - struct sreset_priv *psrtpriv = &pHalData->srestpriv; - - //psrtpriv->silent_reset_inprogress = _FALSE; - psrtpriv->Wifi_Error_Status = WIFI_STATUS_SUCCESS; - psrtpriv->last_tx_time =0; - psrtpriv->last_tx_complete_time =0; -#endif -} - -u8 sreset_get_wifi_status(struct adapter *padapter) -{ -#if defined(DBG_CONFIG_ERROR_DETECT) - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter); - struct sreset_priv *psrtpriv = &pHalData->srestpriv; - - u8 status = WIFI_STATUS_SUCCESS; - u32 val32 = 0; - _irqL irqL; - if(psrtpriv->silent_reset_inprogress == _TRUE) - { - return status; - } - val32 =rtw_read32(padapter,REG_TXDMA_STATUS); - if(val32==0xeaeaeaea){ - psrtpriv->Wifi_Error_Status = WIFI_IF_NOT_EXIST; - } - else if(val32!=0){ - DBG_8192C("txdmastatu(%x)\n",val32); - psrtpriv->Wifi_Error_Status = WIFI_MAC_TXDMA_ERROR; - } - - if(WIFI_STATUS_SUCCESS !=psrtpriv->Wifi_Error_Status) - { - DBG_8192C("==>%s error_status(0x%x) \n",__FUNCTION__,psrtpriv->Wifi_Error_Status); - status = (psrtpriv->Wifi_Error_Status &( ~(USB_READ_PORT_FAIL|USB_WRITE_PORT_FAIL))); - } - DBG_8192C("==> %s wifi_status(0x%x)\n",__FUNCTION__,status); - - //status restore - psrtpriv->Wifi_Error_Status = WIFI_STATUS_SUCCESS; - - return status; -#else - return WIFI_STATUS_SUCCESS; -#endif -} - -void sreset_set_wifi_error_status(struct adapter *padapter, u32 status) -{ -#if defined(DBG_CONFIG_ERROR_DETECT) - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter); - pHalData->srestpriv.Wifi_Error_Status = status; -#endif -} - -void sreset_set_trigger_point(struct adapter *padapter, s32 tgp) -{ -#if defined(DBG_CONFIG_ERROR_DETECT) - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter); - pHalData->srestpriv.dbg_trigger_point = tgp; -#endif -} - -bool sreset_inprogress(struct adapter *padapter) -{ -#if defined(DBG_CONFIG_ERROR_RESET) - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter); - return pHalData->srestpriv.silent_reset_inprogress; -#else - return _FALSE; -#endif -} - -void sreset_restore_security_station(struct adapter *padapter) -{ - u8 EntryId = 0; - struct mlme_priv *mlmepriv = &padapter->mlmepriv; - struct sta_priv * pstapriv = &padapter->stapriv; - struct sta_info *psta; - struct security_priv* psecuritypriv=&(padapter->securitypriv); - struct mlme_ext_info *pmlmeinfo = &padapter->mlmeextpriv.mlmext_info; - - { - u8 val8; - - if (pmlmeinfo->auth_algo == dot11AuthAlgrthm_8021X) { - val8 = 0xcc; - #ifdef CONFIG_WAPI_SUPPORT - } else if (padapter->wapiInfo.bWapiEnable && pmlmeinfo->auth_algo == dot11AuthAlgrthm_WAPI) { - //Disable TxUseDefaultKey, RxUseDefaultKey, RxBroadcastUseDefaultKey. - val8 = 0x4c; - #endif - } else { - val8 = 0xcf; - } - rtw_hal_set_hwreg(padapter, HW_VAR_SEC_CFG, (u8 *)(&val8)); - } - - #if 0 - if ( ( padapter->securitypriv.dot11PrivacyAlgrthm == _WEP40_ ) || - ( padapter->securitypriv.dot11PrivacyAlgrthm == _WEP104_ )) - { - - for(EntryId=0; EntryId<4; EntryId++) - { - if(EntryId == psecuritypriv->dot11PrivacyKeyIndex) - rtw_set_key(padapter,&padapter->securitypriv, EntryId, 1,_FALSE); - else - rtw_set_key(padapter,&padapter->securitypriv, EntryId, 0,_FALSE); - } - - } - else - #endif - if((padapter->securitypriv.dot11PrivacyAlgrthm == _TKIP_) || - (padapter->securitypriv.dot11PrivacyAlgrthm == _AES_)) - { - psta = rtw_get_stainfo(pstapriv, get_bssid(mlmepriv)); - if (psta == NULL) { - //DEBUG_ERR( ("Set wpa_set_encryption: Obtain Sta_info fail \n")); - } - else - { - //pairwise key - rtw_setstakey_cmd(padapter, (unsigned char *)psta, _TRUE,_FALSE); - //group key - rtw_set_key(padapter,&padapter->securitypriv,padapter->securitypriv.dot118021XGrpKeyid, 0,_FALSE); - } - } -} - -void sreset_restore_network_station(struct adapter *padapter) -{ - struct mlme_priv *mlmepriv = &padapter->mlmepriv; - struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; - struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); - - #if 0 - { - //======================================================= - // reset related register of Beacon control - - //set MSR to nolink - Set_MSR(padapter, _HW_STATE_NOLINK_); - // reject all data frame - rtw_write16(padapter, REG_RXFLTMAP2,0x00); - //reset TSF - rtw_write8(padapter, REG_DUAL_TSF_RST, (BIT(0)|BIT(1))); - - // disable update TSF - SetBcnCtrlReg(padapter, BIT(4), 0); - - //======================================================= - } - #endif - - rtw_setopmode_cmd(padapter, Ndis802_11Infrastructure,_FALSE); - - { - u8 threshold; - #ifdef CONFIG_USB_HCI - // TH=1 => means that invalidate usb rx aggregation - // TH=0 => means that validate usb rx aggregation, use init value. - if(mlmepriv->htpriv.ht_option) { - if(padapter->registrypriv.wifi_spec==1) - threshold = 1; - else - threshold = 0; - rtw_hal_set_hwreg(padapter, HW_VAR_RXDMA_AGG_PG_TH, (u8 *)(&threshold)); - } else { - threshold = 1; - rtw_hal_set_hwreg(padapter, HW_VAR_RXDMA_AGG_PG_TH, (u8 *)(&threshold)); - } - #endif - } - - set_channel_bwmode(padapter, pmlmeext->cur_channel, pmlmeext->cur_ch_offset, pmlmeext->cur_bwmode); - - //disable dynamic functions, such as high power, DIG - //Switch_DM_Func(padapter, DYNAMIC_FUNC_DISABLE, _FALSE); - - rtw_hal_set_hwreg(padapter, HW_VAR_BSSID, pmlmeinfo->network.MacAddress); - - { - u8 join_type = 0; - rtw_hal_set_hwreg(padapter, HW_VAR_MLME_JOIN, (u8 *)(&join_type)); - } - - Set_MSR(padapter, (pmlmeinfo->state & 0x3)); - - mlmeext_joinbss_event_callback(padapter, 1); - //restore Sequence No. - rtw_write8(padapter,0x4dc,padapter->xmitpriv.nqos_ssn); - - sreset_restore_security_station(padapter); -} - - -void sreset_restore_network_status(struct adapter *padapter) -{ - struct mlme_priv *mlmepriv = &padapter->mlmepriv; - struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; - struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); - - if (check_fwstate(mlmepriv, WIFI_STATION_STATE)) { - DBG_871X(FUNC_ADPT_FMT" fwstate:0x%08x - WIFI_STATION_STATE\n", FUNC_ADPT_ARG(padapter), get_fwstate(mlmepriv)); - sreset_restore_network_station(padapter); - } else if (check_fwstate(mlmepriv, WIFI_AP_STATE)) { - DBG_871X(FUNC_ADPT_FMT" fwstate:0x%08x - WIFI_AP_STATE\n", FUNC_ADPT_ARG(padapter), get_fwstate(mlmepriv)); - rtw_ap_restore_network(padapter); - } else if (check_fwstate(mlmepriv, WIFI_ADHOC_STATE)) { - DBG_871X(FUNC_ADPT_FMT" fwstate:0x%08x - WIFI_ADHOC_STATE\n", FUNC_ADPT_ARG(padapter), get_fwstate(mlmepriv)); - } else { - DBG_871X(FUNC_ADPT_FMT" fwstate:0x%08x - ???\n", FUNC_ADPT_ARG(padapter), get_fwstate(mlmepriv)); - } -} - -void sreset_stop_adapter(struct adapter *padapter) -{ - struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); - struct xmit_priv *pxmitpriv = &padapter->xmitpriv; - - if (padapter == NULL) - return; - - DBG_871X(FUNC_ADPT_FMT"\n", FUNC_ADPT_ARG(padapter)); - - if (!rtw_netif_queue_stopped(padapter->pnetdev)) - rtw_netif_stop_queue(padapter->pnetdev); - - rtw_cancel_all_timer(padapter); - - /* TODO: OS and HCI independent */ - #if defined(CONFIG_USB_HCI) - tasklet_kill(&pxmitpriv->xmit_tasklet); - #endif - - if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY)) - rtw_scan_abort(padapter); - - if (check_fwstate(pmlmepriv, _FW_UNDER_LINKING)) - { - rtw_set_roaming(padapter, 0); - _rtw_join_timeout_handler(padapter); - } - -} - -void sreset_start_adapter(struct adapter *padapter) -{ - struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); - struct xmit_priv *pxmitpriv = &padapter->xmitpriv; - - if (padapter == NULL) - return; - - DBG_871X(FUNC_ADPT_FMT"\n", FUNC_ADPT_ARG(padapter)); - - if (check_fwstate(pmlmepriv, _FW_LINKED)) { - sreset_restore_network_status(padapter); - } - - /* TODO: OS and HCI independent */ - #if defined(CONFIG_USB_HCI) - tasklet_hi_schedule(&pxmitpriv->xmit_tasklet); - #endif - - _set_timer(&padapter->mlmepriv.dynamic_chk_timer, 2000); - - if (rtw_netif_queue_stopped(padapter->pnetdev)) - rtw_netif_wake_queue(padapter->pnetdev); - -} - -void sreset_reset(struct adapter *padapter) -{ -#ifdef DBG_CONFIG_ERROR_RESET - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter); - struct sreset_priv *psrtpriv = &pHalData->srestpriv; - struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter); - struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); - struct xmit_priv *pxmitpriv = &padapter->xmitpriv; - _irqL irqL; - u32 start = rtw_get_current_time(); - - DBG_871X("%s\n", __FUNCTION__); - - psrtpriv->Wifi_Error_Status = WIFI_STATUS_SUCCESS; - - _enter_pwrlock(&pwrpriv->lock); - - psrtpriv->silent_reset_inprogress = _TRUE; - pwrpriv->change_rfpwrstate = rf_off; - - sreset_stop_adapter(padapter); - #ifdef CONFIG_CONCURRENT_MODE - sreset_stop_adapter(padapter->pbuddy_adapter); - #endif - - #ifdef CONFIG_IPS - _ips_enter(padapter); - _ips_leave(padapter); - #endif - - sreset_start_adapter(padapter); - #ifdef CONFIG_CONCURRENT_MODE - sreset_start_adapter(padapter->pbuddy_adapter); - #endif - - psrtpriv->silent_reset_inprogress = _FALSE; - - _exit_pwrlock(&pwrpriv->lock); - - DBG_871X("%s done in %d ms\n", __FUNCTION__, rtw_get_passing_time_ms(start)); -#endif -} - +/****************************************************************************** + * + * Copyright(c) 2007 - 2012 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 + * + * + ******************************************************************************/ + +#include + +void sreset_init_value(struct adapter *padapter) +{ +#if defined(DBG_CONFIG_ERROR_DETECT) + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter); + struct sreset_priv *psrtpriv = &pHalData->srestpriv; + + _rtw_mutex_init(&psrtpriv->silentreset_mutex); + psrtpriv->silent_reset_inprogress = _FALSE; + psrtpriv->Wifi_Error_Status = WIFI_STATUS_SUCCESS; + psrtpriv->last_tx_time =0; + psrtpriv->last_tx_complete_time =0; +#endif +} +void sreset_reset_value(struct adapter *padapter) +{ +#if defined(DBG_CONFIG_ERROR_DETECT) + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter); + struct sreset_priv *psrtpriv = &pHalData->srestpriv; + + //psrtpriv->silent_reset_inprogress = _FALSE; + psrtpriv->Wifi_Error_Status = WIFI_STATUS_SUCCESS; + psrtpriv->last_tx_time =0; + psrtpriv->last_tx_complete_time =0; +#endif +} + +u8 sreset_get_wifi_status(struct adapter *padapter) +{ +#if defined(DBG_CONFIG_ERROR_DETECT) + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter); + struct sreset_priv *psrtpriv = &pHalData->srestpriv; + + u8 status = WIFI_STATUS_SUCCESS; + u32 val32 = 0; + _irqL irqL; + if(psrtpriv->silent_reset_inprogress == _TRUE) + { + return status; + } + val32 =rtw_read32(padapter,REG_TXDMA_STATUS); + if(val32==0xeaeaeaea){ + psrtpriv->Wifi_Error_Status = WIFI_IF_NOT_EXIST; + } + else if(val32!=0){ + DBG_8192C("txdmastatu(%x)\n",val32); + psrtpriv->Wifi_Error_Status = WIFI_MAC_TXDMA_ERROR; + } + + if(WIFI_STATUS_SUCCESS !=psrtpriv->Wifi_Error_Status) + { + DBG_8192C("==>%s error_status(0x%x) \n",__FUNCTION__,psrtpriv->Wifi_Error_Status); + status = (psrtpriv->Wifi_Error_Status &( ~(USB_READ_PORT_FAIL|USB_WRITE_PORT_FAIL))); + } + DBG_8192C("==> %s wifi_status(0x%x)\n",__FUNCTION__,status); + + //status restore + psrtpriv->Wifi_Error_Status = WIFI_STATUS_SUCCESS; + + return status; +#else + return WIFI_STATUS_SUCCESS; +#endif +} + +void sreset_set_wifi_error_status(struct adapter *padapter, u32 status) +{ +#if defined(DBG_CONFIG_ERROR_DETECT) + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter); + pHalData->srestpriv.Wifi_Error_Status = status; +#endif +} + +void sreset_set_trigger_point(struct adapter *padapter, s32 tgp) +{ +#if defined(DBG_CONFIG_ERROR_DETECT) + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter); + pHalData->srestpriv.dbg_trigger_point = tgp; +#endif +} + +bool sreset_inprogress(struct adapter *padapter) +{ +#if defined(DBG_CONFIG_ERROR_RESET) + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter); + return pHalData->srestpriv.silent_reset_inprogress; +#else + return _FALSE; +#endif +} + +void sreset_restore_security_station(struct adapter *padapter) +{ + u8 EntryId = 0; + struct mlme_priv *mlmepriv = &padapter->mlmepriv; + struct sta_priv * pstapriv = &padapter->stapriv; + struct sta_info *psta; + struct security_priv* psecuritypriv=&(padapter->securitypriv); + struct mlme_ext_info *pmlmeinfo = &padapter->mlmeextpriv.mlmext_info; + + { + u8 val8; + + if (pmlmeinfo->auth_algo == dot11AuthAlgrthm_8021X) { + val8 = 0xcc; + #ifdef CONFIG_WAPI_SUPPORT + } else if (padapter->wapiInfo.bWapiEnable && pmlmeinfo->auth_algo == dot11AuthAlgrthm_WAPI) { + //Disable TxUseDefaultKey, RxUseDefaultKey, RxBroadcastUseDefaultKey. + val8 = 0x4c; + #endif + } else { + val8 = 0xcf; + } + rtw_hal_set_hwreg(padapter, HW_VAR_SEC_CFG, (u8 *)(&val8)); + } + + #if 0 + if ( ( padapter->securitypriv.dot11PrivacyAlgrthm == _WEP40_ ) || + ( padapter->securitypriv.dot11PrivacyAlgrthm == _WEP104_ )) + { + + for(EntryId=0; EntryId<4; EntryId++) + { + if(EntryId == psecuritypriv->dot11PrivacyKeyIndex) + rtw_set_key(padapter,&padapter->securitypriv, EntryId, 1,_FALSE); + else + rtw_set_key(padapter,&padapter->securitypriv, EntryId, 0,_FALSE); + } + + } + else + #endif + if((padapter->securitypriv.dot11PrivacyAlgrthm == _TKIP_) || + (padapter->securitypriv.dot11PrivacyAlgrthm == _AES_)) + { + psta = rtw_get_stainfo(pstapriv, get_bssid(mlmepriv)); + if (psta == NULL) { + //DEBUG_ERR( ("Set wpa_set_encryption: Obtain Sta_info fail \n")); + } + else + { + //pairwise key + rtw_setstakey_cmd(padapter, (unsigned char *)psta, _TRUE,_FALSE); + //group key + rtw_set_key(padapter,&padapter->securitypriv,padapter->securitypriv.dot118021XGrpKeyid, 0,_FALSE); + } + } +} + +void sreset_restore_network_station(struct adapter *padapter) +{ + struct mlme_priv *mlmepriv = &padapter->mlmepriv; + struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; + struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); + + #if 0 + { + //======================================================= + // reset related register of Beacon control + + //set MSR to nolink + Set_MSR(padapter, _HW_STATE_NOLINK_); + // reject all data frame + rtw_write16(padapter, REG_RXFLTMAP2,0x00); + //reset TSF + rtw_write8(padapter, REG_DUAL_TSF_RST, (BIT(0)|BIT(1))); + + // disable update TSF + SetBcnCtrlReg(padapter, BIT(4), 0); + + //======================================================= + } + #endif + + rtw_setopmode_cmd(padapter, Ndis802_11Infrastructure,_FALSE); + + { + u8 threshold; + #ifdef CONFIG_USB_HCI + // TH=1 => means that invalidate usb rx aggregation + // TH=0 => means that validate usb rx aggregation, use init value. + if(mlmepriv->htpriv.ht_option) { + if(padapter->registrypriv.wifi_spec==1) + threshold = 1; + else + threshold = 0; + rtw_hal_set_hwreg(padapter, HW_VAR_RXDMA_AGG_PG_TH, (u8 *)(&threshold)); + } else { + threshold = 1; + rtw_hal_set_hwreg(padapter, HW_VAR_RXDMA_AGG_PG_TH, (u8 *)(&threshold)); + } + #endif + } + + set_channel_bwmode(padapter, pmlmeext->cur_channel, pmlmeext->cur_ch_offset, pmlmeext->cur_bwmode); + + //disable dynamic functions, such as high power, DIG + //Switch_DM_Func(padapter, DYNAMIC_FUNC_DISABLE, _FALSE); + + rtw_hal_set_hwreg(padapter, HW_VAR_BSSID, pmlmeinfo->network.MacAddress); + + { + u8 join_type = 0; + rtw_hal_set_hwreg(padapter, HW_VAR_MLME_JOIN, (u8 *)(&join_type)); + } + + Set_MSR(padapter, (pmlmeinfo->state & 0x3)); + + mlmeext_joinbss_event_callback(padapter, 1); + //restore Sequence No. + rtw_write8(padapter,0x4dc,padapter->xmitpriv.nqos_ssn); + + sreset_restore_security_station(padapter); +} + + +void sreset_restore_network_status(struct adapter *padapter) +{ + struct mlme_priv *mlmepriv = &padapter->mlmepriv; + struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; + struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); + + if (check_fwstate(mlmepriv, WIFI_STATION_STATE)) { + DBG_871X(FUNC_ADPT_FMT" fwstate:0x%08x - WIFI_STATION_STATE\n", FUNC_ADPT_ARG(padapter), get_fwstate(mlmepriv)); + sreset_restore_network_station(padapter); + } else if (check_fwstate(mlmepriv, WIFI_AP_STATE)) { + DBG_871X(FUNC_ADPT_FMT" fwstate:0x%08x - WIFI_AP_STATE\n", FUNC_ADPT_ARG(padapter), get_fwstate(mlmepriv)); + rtw_ap_restore_network(padapter); + } else if (check_fwstate(mlmepriv, WIFI_ADHOC_STATE)) { + DBG_871X(FUNC_ADPT_FMT" fwstate:0x%08x - WIFI_ADHOC_STATE\n", FUNC_ADPT_ARG(padapter), get_fwstate(mlmepriv)); + } else { + DBG_871X(FUNC_ADPT_FMT" fwstate:0x%08x - ???\n", FUNC_ADPT_ARG(padapter), get_fwstate(mlmepriv)); + } +} + +void sreset_stop_adapter(struct adapter *padapter) +{ + struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); + struct xmit_priv *pxmitpriv = &padapter->xmitpriv; + + if (padapter == NULL) + return; + + DBG_871X(FUNC_ADPT_FMT"\n", FUNC_ADPT_ARG(padapter)); + + if (!rtw_netif_queue_stopped(padapter->pnetdev)) + rtw_netif_stop_queue(padapter->pnetdev); + + rtw_cancel_all_timer(padapter); + + /* TODO: OS and HCI independent */ + #if defined(CONFIG_USB_HCI) + tasklet_kill(&pxmitpriv->xmit_tasklet); + #endif + + if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY)) + rtw_scan_abort(padapter); + + if (check_fwstate(pmlmepriv, _FW_UNDER_LINKING)) + { + rtw_set_roaming(padapter, 0); + _rtw_join_timeout_handler(padapter); + } + +} + +void sreset_start_adapter(struct adapter *padapter) +{ + struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); + struct xmit_priv *pxmitpriv = &padapter->xmitpriv; + + if (padapter == NULL) + return; + + DBG_871X(FUNC_ADPT_FMT"\n", FUNC_ADPT_ARG(padapter)); + + if (check_fwstate(pmlmepriv, _FW_LINKED)) { + sreset_restore_network_status(padapter); + } + + /* TODO: OS and HCI independent */ + #if defined(CONFIG_USB_HCI) + tasklet_hi_schedule(&pxmitpriv->xmit_tasklet); + #endif + + _set_timer(&padapter->mlmepriv.dynamic_chk_timer, 2000); + + if (rtw_netif_queue_stopped(padapter->pnetdev)) + rtw_netif_wake_queue(padapter->pnetdev); + +} + +void sreset_reset(struct adapter *padapter) +{ +#ifdef DBG_CONFIG_ERROR_RESET + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter); + struct sreset_priv *psrtpriv = &pHalData->srestpriv; + struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter); + struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); + struct xmit_priv *pxmitpriv = &padapter->xmitpriv; + _irqL irqL; + u32 start = rtw_get_current_time(); + + DBG_871X("%s\n", __FUNCTION__); + + psrtpriv->Wifi_Error_Status = WIFI_STATUS_SUCCESS; + + _enter_pwrlock(&pwrpriv->lock); + + psrtpriv->silent_reset_inprogress = _TRUE; + pwrpriv->change_rfpwrstate = rf_off; + + sreset_stop_adapter(padapter); + #ifdef CONFIG_CONCURRENT_MODE + sreset_stop_adapter(padapter->pbuddy_adapter); + #endif + + #ifdef CONFIG_IPS + _ips_enter(padapter); + _ips_leave(padapter); + #endif + + sreset_start_adapter(padapter); + #ifdef CONFIG_CONCURRENT_MODE + sreset_start_adapter(padapter->pbuddy_adapter); + #endif + + psrtpriv->silent_reset_inprogress = _FALSE; + + _exit_pwrlock(&pwrpriv->lock); + + DBG_871X("%s done in %d ms\n", __FUNCTION__, rtw_get_passing_time_ms(start)); +#endif +} diff --git a/core/rtw_sta_mgt.c b/core/rtw_sta_mgt.c index b5f060d..c0afe88 100755 --- a/core/rtw_sta_mgt.c +++ b/core/rtw_sta_mgt.c @@ -1,7 +1,7 @@ /****************************************************************************** * * 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. @@ -42,24 +42,24 @@ _func_enter_; _rtw_init_listhead(&psta->hash_list); //_rtw_init_listhead(&psta->asoc_list); //_rtw_init_listhead(&psta->sleep_list); - //_rtw_init_listhead(&psta->wakeup_list); + //_rtw_init_listhead(&psta->wakeup_list); _rtw_init_queue(&psta->sleep_q); psta->sleepq_len = 0; _rtw_init_sta_xmit_priv(&psta->sta_xmitpriv); _rtw_init_sta_recv_priv(&psta->sta_recvpriv); - + #ifdef CONFIG_AP_MODE _rtw_init_listhead(&psta->asoc_list); _rtw_init_listhead(&psta->auth_list); - + psta->expire_to = 0; - + psta->flags = 0; - + psta->capability = 0; psta->bpairwise_key_installed = _FALSE; @@ -72,28 +72,28 @@ _func_enter_; psta->no_ht_gf_set = 0; psta->no_ht_set = 0; psta->ht_20mhz_set = 0; -#endif +#endif #ifdef CONFIG_TX_MCAST2UNI psta->under_exist_checking = 0; #endif // CONFIG_TX_MCAST2UNI - + psta->keep_alive_trycnt = 0; -#endif // CONFIG_AP_MODE +#endif // CONFIG_AP_MODE -#ifdef DBG_TRX_STA_PKTS +#ifdef DBG_TRX_STA_PKTS psta->tx_be_cnt = 0; psta->tx_bk_cnt = 0; psta->tx_vi_cnt = 0; psta->tx_vo_cnt = 0; - + psta->rx_be_cnt = 0; psta->rx_bk_cnt = 0; psta->rx_vi_cnt = 0; psta->rx_vo_cnt = 0; -#endif -_func_exit_; +#endif +_func_exit_; } @@ -102,20 +102,20 @@ u32 _rtw_init_sta_priv(struct sta_priv *pstapriv) struct sta_info *psta; s32 i; -_func_enter_; +_func_enter_; pstapriv->pallocated_stainfo_buf = rtw_zvmalloc (sizeof(struct sta_info) * NUM_STA+ 4); - + if(!pstapriv->pallocated_stainfo_buf) return _FAIL; - pstapriv->pstainfo_buf = pstapriv->pallocated_stainfo_buf + 4 - + pstapriv->pstainfo_buf = pstapriv->pallocated_stainfo_buf + 4 - ((SIZE_PTR)(pstapriv->pallocated_stainfo_buf ) & 3); _rtw_init_queue(&pstapriv->free_sta_queue); _rtw_spinlock_init(&pstapriv->sta_hash_lock); - + //_rtw_init_queue(&pstapriv->asoc_q); pstapriv->asoc_sta_count = 0; _rtw_init_queue(&pstapriv->sleep_q); @@ -123,7 +123,7 @@ _func_enter_; psta = (struct sta_info *)(pstapriv->pstainfo_buf); - + for(i = 0; i < NUM_STA; i++) { _rtw_init_stainfo(psta); @@ -135,7 +135,7 @@ _func_enter_; psta++; } - + #ifdef CONFIG_AP_MODE @@ -149,7 +149,7 @@ _func_enter_; pstapriv->asoc_list_cnt = 0; pstapriv->auth_list_cnt = 0; - pstapriv->auth_to = 3; // 3*2 = 6 sec + pstapriv->auth_to = 3; // 3*2 = 6 sec pstapriv->assoc_to = 3; //pstapriv->expire_to = 900;// 900*2 = 1800 sec = 30 min, expire after no any traffic. //pstapriv->expire_to = 30;// 30*2 = 60 sec = 1 min, expire after no any traffic. @@ -157,18 +157,18 @@ _func_enter_; pstapriv->expire_to = 3; // 3*2 = 6 sec #else pstapriv->expire_to = 60;// 60*2 = 120 sec = 2 min, expire after no any traffic. -#endif +#endif #ifdef CONFIG_ATMEL_RC_PATCH _rtw_memset( pstapriv->atmel_rc_pattern, 0, ETH_ALEN); -#endif - pstapriv->max_num_sta = NUM_STA; - #endif - -_func_exit_; + pstapriv->max_num_sta = NUM_STA; + +#endif + +_func_exit_; return _SUCCESS; - + } inline int rtw_stainfo_offset(struct sta_priv *stapriv, struct sta_info *sta) @@ -200,12 +200,12 @@ _func_enter_; _rtw_spinlock_free(&(psta_xmitpriv->bk_q.sta_pending.lock)); _rtw_spinlock_free(&(psta_xmitpriv->vi_q.sta_pending.lock)); _rtw_spinlock_free(&(psta_xmitpriv->vo_q.sta_pending.lock)); -_func_exit_; +_func_exit_; } static void _rtw_free_sta_recv_priv_lock(struct sta_recv_priv *psta_recvpriv) { -_func_enter_; +_func_enter_; _rtw_spinlock_free(&psta_recvpriv->lock); @@ -225,8 +225,8 @@ _func_enter_; _rtw_free_sta_xmit_priv_lock(&psta->sta_xmitpriv); _rtw_free_sta_recv_priv_lock(&psta->sta_recvpriv); - -_func_exit_; + +_func_exit_; } @@ -237,14 +237,14 @@ void rtw_mfree_all_stainfo(struct sta_priv *pstapriv ) _irqL irqL; _list *plist, *phead; struct sta_info *psta = NULL; - -_func_enter_; + +_func_enter_; _enter_critical_bh(&pstapriv->sta_hash_lock, &irqL); phead = get_list_head(&pstapriv->free_sta_queue); plist = get_next(phead); - + while ((rtw_end_of_queue_search(phead, plist)) == _FALSE) { psta = LIST_CONTAINOR(plist, struct sta_info ,list); @@ -252,10 +252,10 @@ _func_enter_; rtw_mfree_stainfo(psta); } - + _exit_critical_bh(&pstapriv->sta_hash_lock, &irqL); -_func_exit_; +_func_exit_; } @@ -284,53 +284,53 @@ void rtw_mfree_sta_priv_lock(struct sta_priv *pstapriv) u32 _rtw_free_sta_priv(struct sta_priv *pstapriv) { - _irqL irqL; + _irqL irqL; _list *phead, *plist; struct sta_info *psta = NULL; struct recv_reorder_ctrl *preorder_ctrl; - int index; + int index; _func_enter_; if(pstapriv){ - /* delete all reordering_ctrl_timer */ + /* delete all reordering_ctrl_timer */ _enter_critical_bh(&pstapriv->sta_hash_lock, &irqL); for(index = 0; index < NUM_STA; index++) { phead = &(pstapriv->sta_hash[index]); plist = get_next(phead); - + while ((rtw_end_of_queue_search(phead, plist)) == _FALSE) { - int i; + int i; psta = LIST_CONTAINOR(plist, struct sta_info ,hash_list); plist = get_next(plist); for(i=0; i < 16 ; i++) { preorder_ctrl = &psta->recvreorder_ctrl[i]; - _cancel_timer_ex(&preorder_ctrl->reordering_ctrl_timer); + _cancel_timer_ex(&preorder_ctrl->reordering_ctrl_timer); } } } _exit_critical_bh(&pstapriv->sta_hash_lock, &irqL); /*===============================*/ - + rtw_mfree_sta_priv_lock(pstapriv); if(pstapriv->pallocated_stainfo_buf) { rtw_vmfree(pstapriv->pallocated_stainfo_buf, sizeof(struct sta_info)*NUM_STA+4); } } - + _func_exit_; return _SUCCESS; } //struct sta_info *rtw_alloc_stainfo(_queue *pfree_sta_queue, unsigned char *hwaddr) -struct sta_info *rtw_alloc_stainfo(struct sta_priv *pstapriv, u8 *hwaddr) -{ +struct sta_info *rtw_alloc_stainfo(struct sta_priv *pstapriv, u8 *hwaddr) +{ _irqL irqL, irqL2; uint tmp_aid; s32 index; @@ -340,11 +340,11 @@ struct sta_info *rtw_alloc_stainfo(struct sta_priv *pstapriv, u8 *hwaddr) struct recv_reorder_ctrl *preorder_ctrl; int i = 0; u16 wRxSeqInitialValue = 0xffff; - -_func_enter_; + +_func_enter_; pfree_sta_queue = &pstapriv->free_sta_queue; - + //_enter_critical_bh(&(pfree_sta_queue->lock), &irqL); _enter_critical_bh(&(pstapriv->sta_hash_lock), &irqL2); @@ -357,13 +357,13 @@ _func_enter_; else { psta = LIST_CONTAINOR(get_next(&pfree_sta_queue->queue), struct sta_info, list); - + rtw_list_delete(&(psta->list)); //_exit_critical_bh(&(pfree_sta_queue->lock), &irqL); - - tmp_aid = psta->aid; - + + tmp_aid = psta->aid; + _rtw_init_stainfo(psta); psta->padapter = pstapriv->padapter; @@ -376,7 +376,7 @@ _func_enter_; if(index >= NUM_STA){ RT_TRACE(_module_rtl871x_sta_mgt_c_,_drv_err_,("ERROR=> rtw_alloc_stainfo: index >= NUM_STA")); - psta= NULL; + psta= NULL; goto exit; } phash_list = &(pstapriv->sta_hash[index]); @@ -399,7 +399,7 @@ _func_enter_; _rtw_memcpy( &psta->sta_recvpriv.rxcache.tid_rxseq[ i ], &wRxSeqInitialValue, 2 ); } - RT_TRACE(_module_rtl871x_sta_mgt_c_,_drv_info_,("alloc number_%d stainfo with hwaddr = %x %x %x %x %x %x \n", + RT_TRACE(_module_rtl871x_sta_mgt_c_,_drv_info_,("alloc number_%d stainfo with hwaddr = %x %x %x %x %x %x \n", pstapriv->asoc_sta_count , hwaddr[0], hwaddr[1], hwaddr[2],hwaddr[3],hwaddr[4],hwaddr[5])); init_addba_retry_timer(pstapriv->padapter, psta); @@ -420,15 +420,15 @@ _func_enter_; preorder_ctrl = &psta->recvreorder_ctrl[i]; preorder_ctrl->padapter = pstapriv->padapter; - + preorder_ctrl->enable = _FALSE; - + preorder_ctrl->indicate_seq = 0xffff; #ifdef DBG_RX_SEQ DBG_871X("DBG_RX_SEQ %s:%d IndicateSeq: %d\n", __FUNCTION__, __LINE__, preorder_ctrl->indicate_seq); #endif - preorder_ctrl->wend_b= 0xffff; + preorder_ctrl->wend_b= 0xffff; //preorder_ctrl->wsize_b = (NR_RECVBUFF-2); preorder_ctrl->wsize_b = 64;//64; @@ -447,7 +447,7 @@ _func_enter_; /* init for the sequence number of received management frame */ psta->RxMgmtFrameSeqNum = 0xffff; } - + exit: _exit_critical_bh(&(pstapriv->sta_hash_lock), &irqL2); @@ -462,7 +462,7 @@ _func_exit_; // using pstapriv->sta_hash_lock to protect u32 rtw_free_stainfo(struct adapter *padapter , struct sta_info *psta) -{ +{ int i; _irqL irqL0; _queue *pfree_sta_queue; @@ -473,8 +473,8 @@ u32 rtw_free_stainfo(struct adapter *padapter , struct sta_info *psta) struct hw_xmit *phwxmit; -_func_enter_; - +_func_enter_; + if (psta == NULL) goto exit; @@ -487,16 +487,16 @@ _func_enter_; pstaxmitpriv = &psta->sta_xmitpriv; - + //rtw_list_delete(&psta->sleep_list); - + //rtw_list_delete(&psta->wakeup_list); - + _enter_critical_bh(&pxmitpriv->lock, &irqL0); - + rtw_free_xmitframe_queue(pxmitpriv, &psta->sleep_q); psta->sleepq_len = 0; - + //vo //_enter_critical_bh(&(pxmitpriv->vo_pending.lock), &irqL0); rtw_free_xmitframe_queue( pxmitpriv, &pstaxmitpriv->vo_q.sta_pending); @@ -523,7 +523,7 @@ _func_enter_; phwxmit->accnt -= pstaxmitpriv->be_q.qcnt; pstaxmitpriv->be_q.qcnt = 0; //_exit_critical_bh(&(pxmitpriv->be_pending.lock), &irqL0); - + //bk //_enter_critical_bh(&(pxmitpriv->bk_pending.lock), &irqL0); rtw_free_xmitframe_queue( pxmitpriv, &pstaxmitpriv->bk_q.sta_pending); @@ -532,14 +532,14 @@ _func_enter_; phwxmit->accnt -= pstaxmitpriv->bk_q.qcnt; pstaxmitpriv->bk_q.qcnt = 0; //_exit_critical_bh(&(pxmitpriv->bk_pending.lock), &irqL0); - + _exit_critical_bh(&pxmitpriv->lock, &irqL0); - + rtw_list_delete(&psta->hash_list); RT_TRACE(_module_rtl871x_sta_mgt_c_,_drv_err_,("\n free number_%d stainfo with hwaddr = 0x%.2x 0x%.2x 0x%.2x 0x%.2x 0x%.2x 0x%.2x \n",pstapriv->asoc_sta_count , psta->hwaddr[0], psta->hwaddr[1], psta->hwaddr[2],psta->hwaddr[3],psta->hwaddr[4],psta->hwaddr[5])); pstapriv->asoc_sta_count --; - - + + // re-init sta_info; 20061114 // will be init in alloc_stainfo //_rtw_init_sta_xmit_priv(&psta->sta_xmitpriv); //_rtw_init_sta_recv_priv(&psta->sta_recvpriv); @@ -563,42 +563,42 @@ _func_enter_; union recv_frame *prframe; _queue *ppending_recvframe_queue; _queue *pfree_recv_queue = &padapter->recvpriv.free_recv_queue; - - preorder_ctrl = &psta->recvreorder_ctrl[i]; - - _cancel_timer_ex(&preorder_ctrl->reordering_ctrl_timer); - + preorder_ctrl = &psta->recvreorder_ctrl[i]; + + _cancel_timer_ex(&preorder_ctrl->reordering_ctrl_timer); + + ppending_recvframe_queue = &preorder_ctrl->pending_recvframe_queue; _enter_critical_bh(&ppending_recvframe_queue->lock, &irqL); - phead = get_list_head(ppending_recvframe_queue); + phead = get_list_head(ppending_recvframe_queue); plist = get_next(phead); - + while(!rtw_is_list_empty(phead)) - { + { prframe = LIST_CONTAINOR(plist, union recv_frame, u); - + plist = get_next(plist); - + rtw_list_delete(&(prframe->u.hdr.list)); rtw_free_recvframe(prframe, pfree_recv_queue); } _exit_critical_bh(&ppending_recvframe_queue->lock, &irqL); - + } if (!(psta->state & WIFI_AP_STATE)) rtw_hal_set_odm_var(padapter, HAL_ODM_STA_INFO, psta, _FALSE); - + #ifdef CONFIG_AP_MODE /* _enter_critical_bh(&pstapriv->asoc_list_lock, &irqL0); - rtw_list_delete(&psta->asoc_list); + rtw_list_delete(&psta->asoc_list); _exit_critical_bh(&pstapriv->asoc_list_lock, &irqL0); */ _enter_critical_bh(&pstapriv->auth_list_lock, &irqL0); @@ -607,7 +607,7 @@ _func_enter_; pstapriv->auth_list_cnt--; } _exit_critical_bh(&pstapriv->auth_list_lock, &irqL0); - + psta->expire_to = 0; #ifdef CONFIG_ATMEL_RC_PATCH psta->flag_atmel_rc = 0; @@ -624,9 +624,9 @@ _func_enter_; psta->has_legacy_ac = 0; #ifdef CONFIG_NATIVEAP_MLME - + pstapriv->sta_dz_bitmap &=~BIT(psta->aid); - pstapriv->tim_bitmap &=~BIT(psta->aid); + pstapriv->tim_bitmap &=~BIT(psta->aid); //rtw_indicate_sta_disassoc_event(padapter, psta); @@ -634,15 +634,15 @@ _func_enter_; { pstapriv->sta_aid[psta->aid - 1] = NULL; psta->aid = 0; - } - -#endif // CONFIG_NATIVEAP_MLME + } + +#endif // CONFIG_NATIVEAP_MLME #ifdef CONFIG_TX_MCAST2UNI psta->under_exist_checking = 0; #endif // CONFIG_TX_MCAST2UNI -#endif // CONFIG_AP_MODE +#endif // CONFIG_AP_MODE _rtw_spinlock_free(&psta->lock); @@ -651,11 +651,11 @@ _func_enter_; //_exit_critical_bh(&(pfree_sta_queue->lock), &irqL0); exit: - -_func_exit_; + +_func_exit_; return _SUCCESS; - + } // free all stainfo which in sta_hash[all] @@ -667,8 +667,8 @@ void rtw_free_all_stainfo(struct adapter *padapter) struct sta_info *psta = NULL; struct sta_priv *pstapriv = &padapter->stapriv; struct sta_info* pbcmc_stainfo =rtw_get_bcmc_stainfo( padapter); - -_func_enter_; + +_func_enter_; if(pstapriv->asoc_sta_count==1) goto exit; @@ -679,24 +679,24 @@ _func_enter_; { phead = &(pstapriv->sta_hash[index]); plist = get_next(phead); - + while ((rtw_end_of_queue_search(phead, plist)) == _FALSE) { psta = LIST_CONTAINOR(plist, struct sta_info ,hash_list); plist = get_next(plist); - if(pbcmc_stainfo!=psta) + if(pbcmc_stainfo!=psta) rtw_free_stainfo(padapter , psta); - + } } - + _exit_critical_bh(&pstapriv->sta_hash_lock, &irqL); - -exit: - -_func_exit_; + +exit: + +_func_exit_; } @@ -709,7 +709,7 @@ struct sta_info *rtw_get_stainfo(struct sta_priv *pstapriv, u8 *hwaddr) _list *plist, *phead; struct sta_info *psta = NULL; - + u32 index; u8 *addr; @@ -720,7 +720,7 @@ _func_enter_; if(hwaddr==NULL) return NULL; - + if(IS_MCAST(hwaddr)) { addr = bc_addr; @@ -733,17 +733,17 @@ _func_enter_; index = wifi_mac_hash(addr); _enter_critical_bh(&pstapriv->sta_hash_lock, &irqL); - + phead = &(pstapriv->sta_hash[index]); plist = get_next(phead); while ((rtw_end_of_queue_search(phead, plist)) == _FALSE) { - + psta = LIST_CONTAINOR(plist, struct sta_info, hash_list); - - if ((_rtw_memcmp(psta->hwaddr, addr, ETH_ALEN))== _TRUE) + + if ((_rtw_memcmp(psta->hwaddr, addr, ETH_ALEN))== _TRUE) { // if found the matched address break; } @@ -752,26 +752,26 @@ _func_enter_; } _exit_critical_bh(&pstapriv->sta_hash_lock, &irqL); -_func_exit_; +_func_exit_; return psta; - + } u32 rtw_init_bcmc_stainfo(struct adapter* padapter) { - struct sta_info *psta; + struct sta_info *psta; struct tx_servq *ptxservq; u32 res=_SUCCESS; NDIS_802_11_MAC_ADDRESS bcast_addr= {0xff,0xff,0xff,0xff,0xff,0xff}; - + struct sta_priv *pstapriv = &padapter->stapriv; - //_queue *pstapending = &padapter->xmitpriv.bm_pending; - + //_queue *pstapending = &padapter->xmitpriv.bm_pending; + _func_enter_; psta = rtw_alloc_stainfo(pstapriv, bcast_addr); - + if(psta==NULL){ res=_FAIL; RT_TRACE(_module_rtl871x_sta_mgt_c_,_drv_err_,("rtw_alloc_stainfo fail")); @@ -791,9 +791,9 @@ _func_enter_; _exit_critical(&pstapending->lock, &irqL0); */ - + exit: -_func_exit_; +_func_exit_; return _SUCCESS; } @@ -801,12 +801,12 @@ _func_exit_; struct sta_info* rtw_get_bcmc_stainfo(struct adapter* padapter) { - struct sta_info *psta; - struct sta_priv *pstapriv = &padapter->stapriv; + struct sta_info *psta; + struct sta_priv *pstapriv = &padapter->stapriv; u8 bc_addr[ETH_ALEN] = {0xff,0xff,0xff,0xff,0xff,0xff}; _func_enter_; psta = rtw_get_stainfo(pstapriv, bc_addr); -_func_exit_; +_func_exit_; return psta; } @@ -822,10 +822,10 @@ u8 rtw_access_ctrl(struct adapter *padapter, u8 *mac_addr) struct sta_priv *pstapriv = &padapter->stapriv; struct wlan_acl_pool *pacl_list = &pstapriv->acl_list; _queue *pacl_node_q =&pacl_list->acl_node_q; - + _enter_critical_bh(&(pacl_node_q->lock), &irqL); phead = get_list_head(pacl_node_q); - plist = get_next(phead); + plist = get_next(phead); while ((rtw_end_of_queue_search(phead, plist)) == _FALSE) { paclnode = LIST_CONTAINOR(plist, struct rtw_wlan_acl_node, list); @@ -838,15 +838,15 @@ u8 rtw_access_ctrl(struct adapter *padapter, u8 *mac_addr) match = _TRUE; break; } - } - } + } + } _exit_critical_bh(&(pacl_node_q->lock), &irqL); - + if(pacl_list->mode == 1)//accept unless in deny list { res = (match == _TRUE) ? _FALSE:_TRUE; - } + } else if(pacl_list->mode == 2)//deny unless in accept list { res = (match == _TRUE) ? _TRUE:_FALSE; @@ -854,11 +854,10 @@ u8 rtw_access_ctrl(struct adapter *padapter, u8 *mac_addr) else { res = _TRUE; - } - + } + #endif return res; } - diff --git a/core/rtw_tdls.c b/core/rtw_tdls.c index f7ca24a..320d9ea 100755 --- a/core/rtw_tdls.c +++ b/core/rtw_tdls.c @@ -1,2941 +1,2940 @@ -/****************************************************************************** - * - * 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 - * - * - ******************************************************************************/ -#define _RTW_TDLS_C_ - -#include -#include -#include -#include - -#ifdef CONFIG_TDLS -extern unsigned char MCS_rate_2R[16]; -extern unsigned char MCS_rate_1R[16]; -extern void process_wmmps_data(_adapter *padapter, union recv_frame *precv_frame); -extern s32 rtw_dump_xframe(_adapter *padapter, struct xmit_frame *pxmitframe); - -void rtw_reset_tdls_info(_adapter* padapter) -{ - struct tdls_info *ptdlsinfo = &padapter->tdlsinfo; - - ptdlsinfo->ap_prohibited = _FALSE; - ptdlsinfo->setup_state = TDLS_STATE_NONE; - ptdlsinfo->sta_cnt = 0; - ptdlsinfo->sta_maximum = _FALSE; - ptdlsinfo->macid_index= 6; - ptdlsinfo->clear_cam= 0; - ptdlsinfo->ch_sensing = 0; - ptdlsinfo->cur_channel = 0; - ptdlsinfo->candidate_ch = 1; //when inplement channel switching, default candidate channel is 1 - ptdlsinfo->watchdog_count = 0; - ptdlsinfo->dev_discovered = 0; - -#ifdef CONFIG_WFD - ptdlsinfo->wfd_info = &padapter->wfd_info; -#endif //CONFIG_WFD -} - -int rtw_init_tdls_info(_adapter* padapter) -{ - int res = _SUCCESS; - struct tdls_info *ptdlsinfo = &padapter->tdlsinfo; - - ptdlsinfo->enable = 1; - rtw_reset_tdls_info(padapter); - - _rtw_spinlock_init(&ptdlsinfo->cmd_lock); - _rtw_spinlock_init(&ptdlsinfo->hdl_lock); - - return res; - -} - -void rtw_free_tdls_info(struct tdls_info *ptdlsinfo) -{ - _rtw_spinlock_free(&ptdlsinfo->cmd_lock); - _rtw_spinlock_free(&ptdlsinfo->hdl_lock); - - _rtw_memset(ptdlsinfo, 0, sizeof(struct tdls_info) ); - -} - -void issue_nulldata_to_TDLS_peer_STA(_adapter *padapter, struct sta_info *ptdls_sta, unsigned int power_mode) -{ - struct xmit_frame *pmgntframe; - struct pkt_attrib *pattrib; - unsigned char *pframe; - struct rtw_ieee80211_hdr *pwlanhdr; - unsigned short *fctrl; - struct xmit_priv *pxmitpriv = &(padapter->xmitpriv); - struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); - struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); - - if ((pmgntframe = alloc_mgtxmitframe(pxmitpriv)) == NULL) - { - return; - } - - //update attribute - pattrib = &pmgntframe->attrib; - update_mgntframe_attrib(padapter, pattrib); - - _rtw_memset(pmgntframe->buf_addr, 0, WLANHDR_OFFSET + TXDESC_OFFSET); - - pframe = (u8 *)(pmgntframe->buf_addr) + TXDESC_OFFSET; - pwlanhdr = (struct rtw_ieee80211_hdr *)pframe; - - fctrl = &(pwlanhdr->frame_ctl); - *(fctrl) = 0; -// SetToDs(fctrl); - if (power_mode) - { - SetPwrMgt(fctrl); - } - - _rtw_memcpy(pwlanhdr->addr1, ptdls_sta->hwaddr, ETH_ALEN); - _rtw_memcpy(pwlanhdr->addr2, myid(&(padapter->eeprompriv)), ETH_ALEN); - _rtw_memcpy(pwlanhdr->addr3, get_my_bssid(&(pmlmeinfo->network)), ETH_ALEN); - - ptdls_sta->sta_xmitpriv.txseq_tid[pattrib->priority]++; - ptdls_sta->sta_xmitpriv.txseq_tid[pattrib->priority] &= 0xFFF; - pattrib->seqnum = ptdls_sta->sta_xmitpriv.txseq_tid[pattrib->priority]; - SetSeqNum(pwlanhdr, pattrib->seqnum); - - SetFrameSubType(pframe, WIFI_DATA_NULL); - - pframe += sizeof(struct rtw_ieee80211_hdr_3addr); - pattrib->pktlen = sizeof(struct rtw_ieee80211_hdr_3addr); - - pattrib->last_txcmdsz = pattrib->pktlen; - dump_mgntframe(padapter, pmgntframe); - - return; -} - -s32 update_tdls_attrib(_adapter *padapter, struct pkt_attrib *pattrib) -{ - - struct sta_info *psta = NULL; - struct sta_priv *pstapriv = &padapter->stapriv; - struct security_priv *psecuritypriv = &padapter->securitypriv; - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - struct qos_priv *pqospriv= &pmlmepriv->qospriv; - - s32 res=_SUCCESS; - sint bmcast; - - bmcast = IS_MCAST(pattrib->ra); - - psta = rtw_get_stainfo(pstapriv, pattrib->ra); - if (psta == NULL) { - res =_FAIL; - goto exit; - } - - pattrib->mac_id = psta->mac_id; - - pattrib->psta = psta; - - pattrib->ack_policy = 0; - // get ether_hdr_len - pattrib->pkt_hdrlen = ETH_HLEN;//(pattrib->ether_type == 0x8100) ? (14 + 4 ): 14; //vlan tag - - if (pqospriv->qos_option && psta->qos_option) { - pattrib->priority = 1; //tdls management frame should be AC_BK - pattrib->hdrlen = WLAN_HDR_A3_QOS_LEN; - pattrib->subtype = WIFI_QOS_DATA_TYPE; - } else { - pattrib->hdrlen = WLAN_HDR_A3_LEN; - pattrib->subtype = WIFI_DATA_TYPE; - pattrib->priority = 0; - } - - if (psta->ieee8021x_blocked == _TRUE) - { - pattrib->encrypt = 0; - } - else - { - GET_ENCRY_ALGO(psecuritypriv, psta, pattrib->encrypt, bmcast); - - switch(psecuritypriv->dot11AuthAlgrthm) - { - case dot11AuthAlgrthm_Open: - case dot11AuthAlgrthm_Shared: - case dot11AuthAlgrthm_Auto: - pattrib->key_idx = (u8)psecuritypriv->dot11PrivacyKeyIndex; - break; - case dot11AuthAlgrthm_8021X: - pattrib->key_idx = 0; - break; - default: - pattrib->key_idx = 0; - break; - } - } - - switch (pattrib->encrypt) - { - case _WEP40_: - case _WEP104_: - pattrib->iv_len = 4; - pattrib->icv_len = 4; - break; - case _TKIP_: - pattrib->iv_len = 8; - pattrib->icv_len = 4; - if(padapter->securitypriv.busetkipkey==_FAIL) - { - res =_FAIL; - goto exit; - } - break; - case _AES_: - pattrib->iv_len = 8; - pattrib->icv_len = 8; - break; - default: - pattrib->iv_len = 0; - pattrib->icv_len = 0; - break; - } - - if (pattrib->encrypt && - ((padapter->securitypriv.sw_encrypt == _TRUE) || (psecuritypriv->hw_decrypted == _FALSE))) - { - pattrib->bswenc = _TRUE; - } else { - pattrib->bswenc = _FALSE; - } - - //qos_en, ht_en, init rate, ,bw, ch_offset, sgi - pattrib->qos_en = psta->qos_option; - pattrib->ht_en = psta->htpriv.ht_option; - pattrib->raid = psta->raid; - pattrib->bwmode = psta->htpriv.bwmode; - pattrib->ch_offset = psta->htpriv.ch_offset; - pattrib->sgi= psta->htpriv.sgi; - pattrib->ampdu_en = _FALSE; - - //if(pattrib->ht_en && psta->htpriv.ampdu_enable) - //{ - // if(psta->htpriv.agg_enable_bitmap & BIT(pattrib->priority)) - // pattrib->ampdu_en = _TRUE; - //} - -exit: - - return res; -} - -void free_tdls_sta(_adapter *padapter, struct sta_info *ptdls_sta) -{ - struct tdls_info *ptdlsinfo = &padapter->tdlsinfo; - struct sta_priv *pstapriv = &padapter->stapriv; - _irqL irqL; - - //free peer sta_info - _enter_critical_bh(&(pstapriv->sta_hash_lock), &irqL); - if(ptdlsinfo->sta_cnt != 0) - ptdlsinfo->sta_cnt--; - _exit_critical_bh(&(pstapriv->sta_hash_lock), &irqL); - if( ptdlsinfo->sta_cnt < (NUM_STA - 2) ) // -2: AP + BC/MC sta - { - ptdlsinfo->sta_maximum = _FALSE; - _rtw_memset( &ptdlsinfo->ss_record, 0x00, sizeof(struct tdls_ss_record) ); - } - //ready to clear cam - if(ptdls_sta->mac_id!=0){ - ptdlsinfo->clear_cam=ptdls_sta->mac_id; - rtw_setstakey_cmd(padapter, (u8 *)ptdls_sta, _TRUE, _TRUE); - } - - if(ptdlsinfo->sta_cnt==0){ - rtw_tdls_cmd(padapter, myid(&(padapter->eeprompriv)), TDLS_RS_RCR); - ptdlsinfo->setup_state=TDLS_STATE_NONE; - } - else - DBG_871X("Remain tdls sta:%02x\n", ptdlsinfo->sta_cnt); - - rtw_free_stainfo(padapter, ptdls_sta); - -} - -// cam entry will be the same as mac_id -void rtw_tdls_set_mac_id(struct tdls_info *ptdlsinfo, struct sta_info *ptdls_sta) -{ - if(ptdls_sta->mac_id==0) - { - ptdls_sta->mac_id = ptdlsinfo->macid_index; - if( (++ptdlsinfo->macid_index) > (NUM_STA -2) ) - ptdlsinfo->macid_index= TDLS_INI_MACID_ENTRY; - } -} - -//TDLS encryption(if needed) will always be CCMP -void rtw_tdls_set_key(_adapter *adapter, struct rx_pkt_attrib *prx_pkt_attrib, struct sta_info *ptdls_sta) -{ - if(prx_pkt_attrib->encrypt) - { - ptdls_sta->dot118021XPrivacy=_AES_; - rtw_setstakey_cmd(adapter, (u8*)ptdls_sta, _TRUE, _TRUE); - } -} - -void rtw_tdls_process_ht_cap(_adapter *adapter, struct sta_info *ptdls_sta, u8 *data, u8 Length) -{ - /* save HT capabilities in the sta object */ - _rtw_memset(&ptdls_sta->htpriv.ht_cap, 0, sizeof(struct rtw_ieee80211_ht_cap)); - if (data && Length >= sizeof(struct rtw_ieee80211_ht_cap) ) - { - ptdls_sta->flags |= WLAN_STA_HT; - - ptdls_sta->flags |= WLAN_STA_WME; - - _rtw_memcpy(&ptdls_sta->htpriv.ht_cap, data, sizeof(struct rtw_ieee80211_ht_cap)); - - } else - ptdls_sta->flags &= ~WLAN_STA_HT; - - if(ptdls_sta->flags & WLAN_STA_HT) - { - if(adapter->registrypriv.ht_enable == _TRUE) - { - ptdls_sta->htpriv.ht_option = _TRUE; - } - else - { - ptdls_sta->htpriv.ht_option = _FALSE; - ptdls_sta->stat_code = _STATS_FAILURE_; - } - } - - //HT related cap - if(ptdls_sta->htpriv.ht_option) - { - //check if sta supports rx ampdu - if(adapter->registrypriv.ampdu_enable==1) - ptdls_sta->htpriv.ampdu_enable = _TRUE; - - //check if sta support s Short GI - if(ptdls_sta->htpriv.ht_cap.cap_info & cpu_to_le16(IEEE80211_HT_CAP_SGI_20|IEEE80211_HT_CAP_SGI_40)) - { - ptdls_sta->htpriv.sgi = _TRUE; - } - - // bwmode would still followed AP's setting - if(ptdls_sta->htpriv.ht_cap.cap_info & cpu_to_le16(IEEE80211_HT_CAP_SUP_WIDTH)) - { - ptdls_sta->htpriv.bwmode = adapter->mlmeextpriv.cur_bwmode; - ptdls_sta->htpriv.ch_offset = adapter->mlmeextpriv.cur_ch_offset; - } - } -} - -u8 *rtw_tdls_set_ht_cap(_adapter *padapter, u8 *pframe, struct pkt_attrib *pattrib) -{ - struct rtw_ieee80211_ht_cap ht_capie; - u8 rf_type; - - //HT capabilities - _rtw_memset(&ht_capie, 0, sizeof(struct rtw_ieee80211_ht_cap)); - - ht_capie.cap_info = IEEE80211_HT_CAP_SUP_WIDTH |IEEE80211_HT_CAP_SGI_20 |IEEE80211_HT_CAP_SM_PS | - IEEE80211_HT_CAP_SGI_40 | IEEE80211_HT_CAP_TX_STBC |IEEE80211_HT_CAP_DSSSCCK40; - - { - u32 rx_packet_offset, max_recvbuf_sz; - padapter->HalFunc.GetHalDefVarHandler(padapter, HAL_DEF_RX_PACKET_OFFSET, &rx_packet_offset); - padapter->HalFunc.GetHalDefVarHandler(padapter, HAL_DEF_MAX_RECVBUF_SZ, &max_recvbuf_sz); - if(max_recvbuf_sz-rx_packet_offset>(8191-256)) - ht_capie.cap_info = ht_capie.cap_info |IEEE80211_HT_CAP_MAX_AMSDU; - } - - ht_capie.ampdu_params_info = (IEEE80211_HT_CAP_AMPDU_FACTOR&0x03); - - padapter->HalFunc.GetHwRegHandler(padapter, HW_VAR_RF_TYPE, (u8 *)(&rf_type)); - switch(rf_type) - { - case RF_1T1R: - ht_capie.cap_info |= 0x0100;//RX STBC One spatial stream - _rtw_memcpy(ht_capie.supp_mcs_set, MCS_rate_1R, 16); - break; - - case RF_2T2R: - case RF_1T2R: - default: - ht_capie.cap_info|= 0x0200;//RX STBC two spatial stream - _rtw_memcpy(ht_capie.supp_mcs_set, MCS_rate_2R, 16); - break; - } - - return(rtw_set_ie(pframe, _HT_CAPABILITY_IE_, - sizeof(struct rtw_ieee80211_ht_cap), (unsigned char*)&ht_capie, &(pattrib->pktlen))); -} - -u8 *rtw_tdls_set_sup_ch(struct mlme_ext_priv *pmlmeext, u8 *pframe, struct pkt_attrib *pattrib) -{ - u8 sup_ch[ 30 * 2 ] = { 0x00 }, sup_ch_idx = 0, idx_5g = 2; //For supported channel - do{ - if( pmlmeext->channel_set[sup_ch_idx].ChannelNum <= 14 ) - { - sup_ch[0] = 1; //First channel number - sup_ch[1] = pmlmeext->channel_set[sup_ch_idx].ChannelNum; //Number of channel - } - else - { - sup_ch[idx_5g++] = pmlmeext->channel_set[sup_ch_idx].ChannelNum; - sup_ch[idx_5g++] = 1; - } - - sup_ch_idx++; - } - while( pmlmeext->channel_set[sup_ch_idx].ChannelNum != 0 ); - return(rtw_set_ie(pframe, _SUPPORTED_CH_IE_, idx_5g, sup_ch, &(pattrib->pktlen))); -} - -#ifdef CONFIG_WFD -void rtw_tdls_process_wfd_ie(struct tdls_info *ptdlsinfo, u8 *ptr, u8 length) -{ - u8 wfd_ie[ 128 ] = { 0x00 }; - u32 wfd_ielen = 0; - u32 wfd_offset = 0; - // Try to get the TCP port information when receiving the negotiation response. - // - - wfd_offset = 0; - wfd_offset = rtw_get_wfd_ie( ptr + wfd_offset, length - wfd_offset, wfd_ie, &wfd_ielen ); - while( wfd_offset ) - { - u8 attr_content[ 10 ] = { 0x00 }; - u32 attr_contentlen = 0; - int i; - - DBG_871X( "[%s] WFD IE Found!!\n", __FUNCTION__ ); - rtw_get_wfd_attr_content( wfd_ie, wfd_ielen, WFD_ATTR_DEVICE_INFO, attr_content, &attr_contentlen); - if ( attr_contentlen ) - { - ptdlsinfo->wfd_info->peer_rtsp_ctrlport = RTW_GET_BE16( attr_content + 2 ); - DBG_871X( "[%s] Peer PORT NUM = %d\n", __FUNCTION__, ptdlsinfo->wfd_info->peer_rtsp_ctrlport ); - } - - _rtw_memset( attr_content, 0x00, 10); - attr_contentlen = 0; - rtw_get_wfd_attr_content( wfd_ie, wfd_ielen, WFD_ATTR_LOCAL_IP_ADDR, attr_content, &attr_contentlen); - if ( attr_contentlen ) - { - _rtw_memcpy(ptdlsinfo->wfd_info->peer_ip_address, ( attr_content + 1 ), 4); - DBG_871X( "[%s] Peer IP = %02u.%02u.%02u.%02u \n", __FUNCTION__, - ptdlsinfo->wfd_info->peer_ip_address[0], ptdlsinfo->wfd_info->peer_ip_address[1], - ptdlsinfo->wfd_info->peer_ip_address[2], ptdlsinfo->wfd_info->peer_ip_address[3] - ); - } - wfd_offset = rtw_get_wfd_ie( ptr + wfd_offset, length - wfd_offset, wfd_ie, &wfd_ielen ); - } -} - -void issue_tunneled_probe_req(_adapter *padapter) -{ - struct xmit_frame *pmgntframe; - struct pkt_attrib *pattrib; - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - struct xmit_priv *pxmitpriv = &(padapter->xmitpriv); - u8 baddr[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; - - DBG_871X("[%s]\n", __FUNCTION__); - - if ((pmgntframe = alloc_mgtxmitframe(pxmitpriv)) == NULL) - { - return; - } - - //update attribute - pattrib = &pmgntframe->attrib; - - pmgntframe->frame_tag = DATA_FRAMETAG; - pattrib->ether_type = 0x890d; - pattrib->pctrl =0; - - _rtw_memcpy(pattrib->dst, baddr, ETH_ALEN); - - _rtw_memcpy(pattrib->src, myid(&(padapter->eeprompriv)), ETH_ALEN); - - _rtw_memcpy(pattrib->ra, get_bssid(pmlmepriv), ETH_ALEN); - _rtw_memcpy(pattrib->ta, pattrib->src, ETH_ALEN); - - update_tdls_attrib(padapter, pattrib); - pattrib->qsel=pattrib->priority; - if (rtw_xmit_tdls_coalesce(padapter, pmgntframe, TUNNELED_PROBE_REQ) != _SUCCESS) { - rtw_free_xmitbuf(pxmitpriv, pmgntframe->pxmitbuf); - rtw_free_xmitframe(pxmitpriv, pmgntframe); - goto exit; - } - rtw_dump_xframe(padapter, pmgntframe); - -exit: - - return; -} - -void issue_tunneled_probe_rsp(_adapter *padapter, union recv_frame *precv_frame) -{ - struct xmit_frame *pmgntframe; - struct pkt_attrib *pattrib; - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - struct xmit_priv *pxmitpriv = &(padapter->xmitpriv); - struct rx_pkt_attrib *rx_pkt_pattrib = &precv_frame->u.hdr.attrib; - - DBG_871X("[%s]\n", __FUNCTION__); - - if ((pmgntframe = alloc_mgtxmitframe(pxmitpriv)) == NULL) - { - return; - } - - //update attribute - pattrib = &pmgntframe->attrib; - - pmgntframe->frame_tag = DATA_FRAMETAG; - pattrib->ether_type = 0x890d; - pattrib->pctrl =0; - - _rtw_memcpy(pattrib->dst, rx_pkt_pattrib->src, ETH_ALEN); - - _rtw_memcpy(pattrib->src, myid(&(padapter->eeprompriv)), ETH_ALEN); - - _rtw_memcpy(pattrib->ra, get_bssid(pmlmepriv), ETH_ALEN); - _rtw_memcpy(pattrib->ta, pattrib->src, ETH_ALEN); - - update_tdls_attrib(padapter, pattrib); - pattrib->qsel=pattrib->priority; - if (rtw_xmit_tdls_coalesce(padapter, pmgntframe, TUNNELED_PROBE_RSP) != _SUCCESS) { - rtw_free_xmitbuf(pxmitpriv, pmgntframe->pxmitbuf); - rtw_free_xmitframe(pxmitpriv, pmgntframe); - goto exit; - } - rtw_dump_xframe(padapter, pmgntframe); - -exit: - - return; -} -#endif //CONFIG_WFD - -void issue_tdls_setup_req(_adapter *padapter, u8 *mac_addr) -{ - struct tdls_info *ptdlsinfo = &padapter->tdlsinfo; - struct xmit_frame *pmgntframe; - struct pkt_attrib *pattrib; - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - struct xmit_priv *pxmitpriv = &(padapter->xmitpriv); - struct sta_priv *pstapriv = &padapter->stapriv; - struct sta_info *ptdls_sta= NULL; - _irqL irqL; - static u8 dialogtoken = 0; - u32 timeout_interval= TPK_RESEND_COUNT * 1000; //retry timer should set at least 301 sec, using TPK_count counting 301 times. - - if(ptdlsinfo->ap_prohibited == _TRUE) - goto exit; - - if ((pmgntframe = alloc_mgtxmitframe(pxmitpriv)) == NULL) - { - return; - } - - //update attribute - pattrib = &pmgntframe->attrib; - - pmgntframe->frame_tag = DATA_FRAMETAG; - pattrib->ether_type = 0x890d; - pattrib->pctrl =0; - - _rtw_memcpy(pattrib->dst, mac_addr, ETH_ALEN); - _rtw_memcpy(pattrib->src, myid(&(padapter->eeprompriv)), ETH_ALEN); - - _rtw_memcpy(pattrib->ra, get_bssid(pmlmepriv), ETH_ALEN); - _rtw_memcpy(pattrib->ta, pattrib->src, ETH_ALEN); - - update_tdls_attrib(padapter, pattrib); - - //init peer sta_info - ptdls_sta = rtw_get_stainfo(pstapriv, mac_addr); - if(ptdls_sta==NULL) - { - ptdls_sta = rtw_alloc_stainfo(pstapriv, mac_addr); - if(ptdls_sta) - { - _enter_critical_bh(&(pstapriv->sta_hash_lock), &irqL); - if(!(ptdls_sta->tdls_sta_state & TDLS_LINKED_STATE)) - ptdlsinfo->sta_cnt++; - _exit_critical_bh(&(pstapriv->sta_hash_lock), &irqL); - if( ptdlsinfo->sta_cnt == (NUM_STA - 2) ) // -2: AP + BC/MC sta - { - ptdlsinfo->sta_maximum = _TRUE; - } - } - else - { - rtw_free_xmitbuf(pxmitpriv,pmgntframe->pxmitbuf); - rtw_free_xmitframe(pxmitpriv, pmgntframe); - goto exit; - } - } - - if(ptdls_sta){ - ptdls_sta->tdls_sta_state |= TDLS_RESPONDER_STATE; - //for tdls; ptdls_sta->aid is used to fill dialogtoken - ptdls_sta->dialog = dialogtoken; - dialogtoken = (dialogtoken+1)%256; - ptdls_sta->TDLS_PeerKey_Lifetime = timeout_interval; - _set_timer( &ptdls_sta->handshake_timer, TDLS_HANDSHAKE_TIME ); - } - - pattrib->qsel=pattrib->priority; - if(rtw_xmit_tdls_coalesce(padapter, pmgntframe, TDLS_SETUP_REQUEST) !=_SUCCESS ){ - rtw_free_xmitbuf(pxmitpriv,pmgntframe->pxmitbuf); - rtw_free_xmitframe(pxmitpriv, pmgntframe); - goto exit; - } - rtw_dump_xframe(padapter, pmgntframe); - -exit: - - return; -} - -void issue_tdls_teardown(_adapter *padapter, u8 *mac_addr) -{ - struct xmit_frame *pmgntframe; - struct pkt_attrib *pattrib; - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - struct xmit_priv *pxmitpriv = &(padapter->xmitpriv); - struct sta_priv *pstapriv = &padapter->stapriv; - struct sta_info *ptdls_sta=NULL; - _irqL irqL; - - ptdls_sta = rtw_get_stainfo(pstapriv, mac_addr); - if(ptdls_sta==NULL){ - DBG_871X("issue tdls teardown unsuccessful\n"); - return; - }else{ - ptdls_sta->tdls_sta_state=TDLS_STATE_NONE; - } - - if ((pmgntframe = alloc_mgtxmitframe(pxmitpriv)) == NULL) - { - return; - } - - //update attribute - pattrib = &pmgntframe->attrib; - - pmgntframe->frame_tag = DATA_FRAMETAG; - pattrib->ether_type = 0x890d; - pattrib->pctrl =0; - - _rtw_memcpy(pattrib->dst, mac_addr, ETH_ALEN); - _rtw_memcpy(pattrib->src, myid(&(padapter->eeprompriv)), ETH_ALEN); - - _rtw_memcpy(pattrib->ra, get_bssid(pmlmepriv), ETH_ALEN); - _rtw_memcpy(pattrib->ta, pattrib->src, ETH_ALEN); - - update_tdls_attrib(padapter, pattrib); - pattrib->qsel=pattrib->priority; - if (rtw_xmit_tdls_coalesce(padapter, pmgntframe, TDLS_TEARDOWN) != _SUCCESS) { - rtw_free_xmitbuf(pxmitpriv, pmgntframe->pxmitbuf); - rtw_free_xmitframe(pxmitpriv, pmgntframe); - goto exit; - } - rtw_dump_xframe(padapter, pmgntframe); - - if(ptdls_sta->tdls_sta_state & TDLS_CH_SWITCH_ON_STATE){ - rtw_tdls_cmd(padapter, ptdls_sta->hwaddr, TDLS_CS_OFF); - } - - if( ptdls_sta->timer_flag == 1 ) - { - _enter_critical_bh(&(padapter->tdlsinfo.hdl_lock), &irqL); - ptdls_sta->timer_flag = 2; - _exit_critical_bh(&(padapter->tdlsinfo.hdl_lock), &irqL); - } - else - rtw_tdls_cmd(padapter, mac_addr, TDLS_FREE_STA ); - - -exit: - - return; -} - -void issue_tdls_dis_req(_adapter *padapter, u8 *mac_addr) -{ - struct xmit_frame *pmgntframe; - struct pkt_attrib *pattrib; - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - struct xmit_priv *pxmitpriv = &(padapter->xmitpriv); - u8 baddr[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; - - if ((pmgntframe = alloc_mgtxmitframe(pxmitpriv)) == NULL) - { - return; - } - - //update attribute - pattrib = &pmgntframe->attrib; - - pmgntframe->frame_tag = DATA_FRAMETAG; - pattrib->ether_type = 0x890d; - pattrib->pctrl =0; - - if(mac_addr == NULL) - _rtw_memcpy(pattrib->dst, baddr, ETH_ALEN); - else - _rtw_memcpy(pattrib->dst, mac_addr, ETH_ALEN); - - _rtw_memcpy(pattrib->src, myid(&(padapter->eeprompriv)), ETH_ALEN); - - _rtw_memcpy(pattrib->ra, get_bssid(pmlmepriv), ETH_ALEN); - _rtw_memcpy(pattrib->ta, pattrib->src, ETH_ALEN); - - update_tdls_attrib(padapter, pattrib); - pattrib->qsel=pattrib->priority; - if (rtw_xmit_tdls_coalesce(padapter, pmgntframe, TDLS_DISCOVERY_REQUEST) != _SUCCESS) { - rtw_free_xmitbuf(pxmitpriv, pmgntframe->pxmitbuf); - rtw_free_xmitframe(pxmitpriv, pmgntframe); - goto exit; - } - rtw_dump_xframe(padapter, pmgntframe); - DBG_871X("issue tdls dis req\n"); - -exit: - - return; -} - -void issue_tdls_setup_rsp(_adapter *padapter, union recv_frame *precv_frame) -{ - struct xmit_frame *pmgntframe; - struct pkt_attrib *pattrib; - struct xmit_priv *pxmitpriv = &(padapter->xmitpriv); - struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); - struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); - struct rx_pkt_attrib *rx_pkt_pattrib = &precv_frame->u.hdr.attrib; - _irqL irqL; - - if ((pmgntframe = alloc_mgtxmitframe(pxmitpriv)) == NULL) - { - return; - } - - //update attribute - pattrib = &pmgntframe->attrib; - - pmgntframe->frame_tag = DATA_FRAMETAG; - pattrib->ether_type = 0x890d; - pattrib->pctrl =0; - - _rtw_memcpy(pattrib->dst, rx_pkt_pattrib->src, ETH_ALEN); - _rtw_memcpy(pattrib->src, myid(&(padapter->eeprompriv)), ETH_ALEN); - - _rtw_memcpy(pattrib->ra, rx_pkt_pattrib->bssid, ETH_ALEN); - _rtw_memcpy(pattrib->ta, pattrib->src, ETH_ALEN); - - update_tdls_attrib(padapter, pattrib); - pattrib->qsel=pattrib->priority; - if (rtw_xmit_tdls_coalesce(padapter, pmgntframe, TDLS_SETUP_RESPONSE) != _SUCCESS) { - rtw_free_xmitbuf(pxmitpriv, pmgntframe->pxmitbuf); - rtw_free_xmitframe(pxmitpriv, pmgntframe); - goto exit; - } - rtw_dump_xframe(padapter, pmgntframe); - -exit: - - return; - -} - -void issue_tdls_setup_cfm(_adapter *padapter, union recv_frame *precv_frame) -{ - struct tdls_info *ptdlsinfo = &padapter->tdlsinfo; - struct xmit_frame *pmgntframe; - struct pkt_attrib *pattrib; - struct xmit_priv *pxmitpriv = &(padapter->xmitpriv); - struct sta_info *ptdls_sta=NULL; - _irqL irqL; - - struct rx_pkt_attrib *rx_pkt_pattrib = & precv_frame->u.hdr.attrib; - - if ((pmgntframe = alloc_mgtxmitframe(pxmitpriv)) == NULL) - { - return; - } - - //update attribute - pattrib = &pmgntframe->attrib; - - pmgntframe->frame_tag = DATA_FRAMETAG; - pattrib->ether_type = 0x890d; - pattrib->pctrl =0; - - _rtw_memcpy(pattrib->dst, rx_pkt_pattrib->src, ETH_ALEN); - _rtw_memcpy(pattrib->src, myid(&(padapter->eeprompriv)), ETH_ALEN); - - _rtw_memcpy(pattrib->ra, rx_pkt_pattrib->bssid, ETH_ALEN); - _rtw_memcpy(pattrib->ta, pattrib->src, ETH_ALEN); - - update_tdls_attrib(padapter, pattrib); - pattrib->qsel=pattrib->priority; - if (rtw_xmit_tdls_coalesce(padapter, pmgntframe, TDLS_SETUP_CONFIRM) != _SUCCESS) { - rtw_free_xmitbuf(pxmitpriv, pmgntframe->pxmitbuf); - rtw_free_xmitframe(pxmitpriv, pmgntframe); - goto exit; - } - - rtw_dump_xframe(padapter, pmgntframe); - -exit: - - return; - -} - -//TDLS Discovery Response frame is a management action frame -void issue_tdls_dis_rsp(_adapter *padapter, union recv_frame *precv_frame, u8 dialog) -{ - struct xmit_frame *pmgntframe; - struct pkt_attrib *pattrib; - unsigned char *pframe; - struct rtw_ieee80211_hdr *pwlanhdr; - unsigned short *fctrl; - struct xmit_priv *pxmitpriv = &(padapter->xmitpriv); - struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); - - struct rx_pkt_attrib *rx_pkt_pattrib = &precv_frame->u.hdr.attrib; - - if ((pmgntframe = alloc_mgtxmitframe(pxmitpriv)) == NULL) - { - return; - } - - //update attribute - pattrib = &pmgntframe->attrib; - update_mgntframe_attrib(padapter, pattrib); - - _rtw_memset(pmgntframe->buf_addr, 0, WLANHDR_OFFSET + TXDESC_OFFSET); - - pframe = (u8 *)(pmgntframe->buf_addr) + TXDESC_OFFSET; - pwlanhdr = (struct rtw_ieee80211_hdr *)pframe; - - fctrl = &(pwlanhdr->frame_ctl); - *(fctrl) = 0; - - // unicast probe request frame - _rtw_memcpy(pwlanhdr->addr1, rx_pkt_pattrib->src, ETH_ALEN); - _rtw_memcpy(pattrib->dst, pwlanhdr->addr1, ETH_ALEN); - - _rtw_memcpy(pwlanhdr->addr2, myid(&(padapter->eeprompriv)), ETH_ALEN); - _rtw_memcpy(pattrib->src, pwlanhdr->addr2, ETH_ALEN); - - _rtw_memcpy(pwlanhdr->addr3, rx_pkt_pattrib->bssid, ETH_ALEN); - _rtw_memcpy(pattrib->ra, pwlanhdr->addr3, ETH_ALEN); - - SetSeqNum(pwlanhdr, pmlmeext->mgnt_seq); - pmlmeext->mgnt_seq++; - SetFrameSubType(pframe, WIFI_ACTION); - - pframe += sizeof (struct rtw_ieee80211_hdr_3addr); - pattrib->pktlen = sizeof (struct rtw_ieee80211_hdr_3addr); - - rtw_build_tdls_dis_rsp_ies(padapter, pmgntframe, pframe, dialog); - - pattrib->nr_frags = 1; - pattrib->last_txcmdsz = pattrib->pktlen; - - dump_mgntframe(padapter, pmgntframe); - - return; -} - -void issue_tdls_peer_traffic_indication(_adapter *padapter, struct sta_info *ptdls_sta) -{ - struct xmit_frame *pmgntframe; - struct pkt_attrib *pattrib; - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - struct xmit_priv *pxmitpriv = &(padapter->xmitpriv); - - static u8 dialogtoken=0; - - if ((pmgntframe = alloc_mgtxmitframe(pxmitpriv)) == NULL) - { - return; - } - - //update attribute - pattrib = &pmgntframe->attrib; - - pmgntframe->frame_tag = DATA_FRAMETAG; - pattrib->ether_type = 0x890d; - pattrib->pctrl =0; - - _rtw_memcpy(pattrib->dst, ptdls_sta->hwaddr, ETH_ALEN); - _rtw_memcpy(pattrib->src, myid(&(padapter->eeprompriv)), ETH_ALEN); - - _rtw_memcpy(pattrib->ra, get_bssid(pmlmepriv), ETH_ALEN); - _rtw_memcpy(pattrib->ta, pattrib->src, ETH_ALEN); - - //for tdls; pattrib->nr_frags is used to fill dialogtoken - ptdls_sta->dialog = dialogtoken; - dialogtoken = (dialogtoken+1)%256; - //PTI frame's priority should be AC_VO - pattrib->priority = 7; - - update_tdls_attrib(padapter, pattrib); - pattrib->qsel=pattrib->priority; - if (rtw_xmit_tdls_coalesce(padapter, pmgntframe, TDLS_PEER_TRAFFIC_INDICATION) != _SUCCESS) { - rtw_free_xmitbuf(pxmitpriv, pmgntframe->pxmitbuf); - rtw_free_xmitframe(pxmitpriv, pmgntframe); - goto exit; - } - rtw_dump_xframe(padapter, pmgntframe); - -exit: - - return; -} - -void issue_tdls_ch_switch_req(_adapter *padapter, u8 *mac_addr) -{ - struct xmit_frame *pmgntframe; - struct pkt_attrib *pattrib; - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - struct xmit_priv *pxmitpriv = &(padapter->xmitpriv); - - if ((pmgntframe = alloc_mgtxmitframe(pxmitpriv)) == NULL) - { - return; - } - - //update attribute - pattrib = &pmgntframe->attrib; - - pmgntframe->frame_tag = DATA_FRAMETAG; - pattrib->ether_type = 0x890d; - pattrib->pctrl =0; - - _rtw_memcpy(pattrib->dst, mac_addr, ETH_ALEN); - _rtw_memcpy(pattrib->src, myid(&(padapter->eeprompriv)), ETH_ALEN); - - _rtw_memcpy(pattrib->ra, get_bssid(pmlmepriv), ETH_ALEN); - _rtw_memcpy(pattrib->ta, pattrib->src, ETH_ALEN); - - update_tdls_attrib(padapter, pattrib); - - pattrib->qsel=pattrib->priority; - if(rtw_xmit_tdls_coalesce(padapter, pmgntframe, TDLS_CHANNEL_SWITCH_REQUEST) !=_SUCCESS ){ - rtw_free_xmitbuf(pxmitpriv,pmgntframe->pxmitbuf); - rtw_free_xmitframe(pxmitpriv, pmgntframe); - goto exit; - } - rtw_dump_xframe(padapter, pmgntframe); - -exit: - - return; -} - -void issue_tdls_ch_switch_rsp(_adapter *padapter, u8 *mac_addr) -{ - struct xmit_frame *pmgntframe; - struct pkt_attrib *pattrib; - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - struct xmit_priv *pxmitpriv = &(padapter->xmitpriv); - - _irqL irqL; - - if ((pmgntframe = alloc_mgtxmitframe(pxmitpriv)) == NULL) - { - return; - } - - //update attribute - pattrib = &pmgntframe->attrib; - - pmgntframe->frame_tag = DATA_FRAMETAG; - pattrib->ether_type = 0x890d; - pattrib->pctrl =0; - - _rtw_memcpy(pattrib->dst, mac_addr, ETH_ALEN); - _rtw_memcpy(pattrib->src, myid(&(padapter->eeprompriv)), ETH_ALEN); - - _rtw_memcpy(pattrib->ra, get_bssid(pmlmepriv), ETH_ALEN); - _rtw_memcpy(pattrib->ta, pattrib->src, ETH_ALEN); - - update_tdls_attrib(padapter, pattrib); - - pattrib->qsel=pattrib->priority; -/* - _enter_critical_bh(&pxmitpriv->lock, &irqL); - if(xmitframe_enqueue_for_tdls_sleeping_sta(padapter, pmgntframe)==_TRUE){ - _exit_critical_bh(&pxmitpriv->lock, &irqL); - return _FALSE; - } -*/ - if(rtw_xmit_tdls_coalesce(padapter, pmgntframe, TDLS_CHANNEL_SWITCH_RESPONSE) !=_SUCCESS ){ - rtw_free_xmitbuf(pxmitpriv,pmgntframe->pxmitbuf); - rtw_free_xmitframe(pxmitpriv, pmgntframe); - goto exit; - } - rtw_dump_xframe(padapter, pmgntframe); - -exit: - - return; -} - -sint On_TDLS_Dis_Rsp(_adapter *adapter, union recv_frame *precv_frame) -{ - struct sta_info *ptdls_sta = NULL, *psta = rtw_get_stainfo(&(adapter->stapriv), get_bssid(&(adapter->mlmepriv))); - struct recv_priv *precvpriv = &(adapter->recvpriv); - u8 *ptr = precv_frame->u.hdr.rx_data, *psa; - struct rx_pkt_attrib *pattrib = &(precv_frame->u.hdr.attrib); - struct tdls_info *ptdlsinfo = &(adapter->tdlsinfo); - u8 empty_addr[ETH_ALEN] = { 0x00 }; - int UndecoratedSmoothedPWDB; - - - //WFDTDLS: for sigma test, not to setup direct link automatically - ptdlsinfo->dev_discovered = 1; - -#ifdef CONFIG_TDLS_AUTOSETUP - psa = get_sa(ptr); - ptdls_sta = rtw_get_stainfo(&(adapter->stapriv), psa); - - if(ptdls_sta != NULL) - { - ptdls_sta->tdls_sta_state |= TDLS_ALIVE_STATE; - - //Record the tdls sta with lowest signal strength - if( (ptdlsinfo->sta_maximum == _TRUE) && (ptdls_sta->alive_count >= 1) ) - { - if( _rtw_memcmp(ptdlsinfo->ss_record.macaddr, empty_addr, ETH_ALEN) ) - { - _rtw_memcpy(ptdlsinfo->ss_record.macaddr, psa, ETH_ALEN); - ptdlsinfo->ss_record.RxPWDBAll = pattrib->RxPWDBAll; - } - else - { - if( ptdlsinfo->ss_record.RxPWDBAll < pattrib->RxPWDBAll ) - { - _rtw_memcpy(ptdlsinfo->ss_record.macaddr, psa, ETH_ALEN); - ptdlsinfo->ss_record.RxPWDBAll = pattrib->RxPWDBAll; - } - } - } - - } - else - { - if( ptdlsinfo->sta_maximum == _TRUE) - { - if( _rtw_memcmp( ptdlsinfo->ss_record.macaddr, empty_addr, ETH_ALEN ) ) - { - //All traffics are busy, do not set up another direct link. - return _FAIL; - } - else - { - if( pattrib->RxPWDBAll > ptdlsinfo->ss_record.RxPWDBAll ) - { - issue_tdls_teardown(adapter, ptdlsinfo->ss_record.macaddr); - } - else - { - return _FAIL; - } - } - } - - adapter->HalFunc.GetHalDefVarHandler(adapter, HAL_DEF_UNDERCORATEDSMOOTHEDPWDB, &UndecoratedSmoothedPWDB); - - if( pattrib->RxPWDBAll + TDLS_SIGNAL_THRESH >= UndecoratedSmoothedPWDB); - { - DBG_871X("pattrib->RxPWDBAll=%d, pdmpriv->UndecoratedSmoothedPWDB=%d\n", pattrib->RxPWDBAll, UndecoratedSmoothedPWDB); - issue_tdls_setup_req(adapter, psa); - } - } -#endif //CONFIG_TDLS_AUTOSETUP - - return _SUCCESS; -} - -sint On_TDLS_Setup_Req(_adapter *adapter, union recv_frame *precv_frame) -{ - struct tdls_info *ptdlsinfo = &adapter->tdlsinfo; - u8 *psa, *pmyid; - struct sta_info *ptdls_sta= NULL; - struct sta_priv *pstapriv = &adapter->stapriv; - u8 *ptr = precv_frame->u.hdr.rx_data; - struct mlme_priv *pmlmepriv = &(adapter->mlmepriv); - struct security_priv *psecuritypriv = &adapter->securitypriv; - _irqL irqL; - struct rx_pkt_attrib *prx_pkt_attrib = &precv_frame->u.hdr.attrib; - u8 *prsnie, *ppairwise_cipher; - u8 i, k, pairwise_count; - u8 ccmp_have=0, rsnie_have=0; - u16 j; - u8 SNonce[32]; - u32 *timeout_interval; - sint parsing_length; //frame body length, without icv_len - PNDIS_802_11_VARIABLE_IEs pIE; - u8 FIXED_IE = 5; - unsigned char supportRate[16]; - int supportRateNum = 0; - - psa = get_sa(ptr); - ptdls_sta = rtw_get_stainfo(pstapriv, psa); - - pmyid=myid(&(adapter->eeprompriv)); - ptr +=prx_pkt_attrib->hdrlen + prx_pkt_attrib->iv_len+LLC_HEADER_SIZE+TYPE_LENGTH_FIELD_SIZE+1; - parsing_length= ((union recv_frame *)precv_frame)->u.hdr.len - -prx_pkt_attrib->hdrlen - -prx_pkt_attrib->iv_len - -prx_pkt_attrib->icv_len - -LLC_HEADER_SIZE - -ETH_TYPE_LEN - -PAYLOAD_TYPE_LEN - -FIXED_IE; - - if(ptdlsinfo->ap_prohibited == _TRUE) - { - goto exit; - } - - if(ptdls_sta==NULL){ - ptdls_sta = rtw_alloc_stainfo(pstapriv, psa); - }else{ - if(ptdls_sta->tdls_sta_state & TDLS_LINKED_STATE){ - //If the direct link is already set up - //Process as re-setup after tear down - DBG_871X("re-setup a direct link\n"); - } - //already receiving TDLS setup request - else if(ptdls_sta->tdls_sta_state & TDLS_INITIATOR_STATE){ - DBG_871X("receive duplicated TDLS setup request frame in handshaking\n"); - goto exit; - } - //When receiving and sending setup_req to the same link at the same time, STA with higher MAC_addr would be initiator - //following is to check out MAC_addr - else if(ptdls_sta->tdls_sta_state & TDLS_RESPONDER_STATE){ - DBG_871X("receive setup_req after sending setup_req\n"); - for (i=0;i<6;i++){ - if(*(pmyid+i)==*(psa+i)){ - } - else if(*(pmyid+i)>*(psa+i)){ - goto exit; - }else if(*(pmyid+i)<*(psa+i)){ - ptdls_sta->tdls_sta_state=TDLS_INITIATOR_STATE; - break; - } - } - } - } - - if(ptdls_sta) - { - ptdls_sta->dialog = *(ptr+2); //copy dialog token - ptdls_sta->stat_code = 0; - - //parsing information element - for(j=FIXED_IE; jElementID) - { - case _SUPPORTEDRATES_IE_: - _rtw_memcpy(supportRate, pIE->data, pIE->Length); - supportRateNum = pIE->Length; - break; - case _COUNTRY_IE_: - break; - case _EXT_SUPPORTEDRATES_IE_: - if(supportRateNum<=sizeof(supportRate)) - { - _rtw_memcpy(supportRate+supportRateNum, pIE->data, pIE->Length); - supportRateNum += pIE->Length; - } - break; - case _SUPPORTED_CH_IE_: - break; - case _RSN_IE_2_: - rsnie_have=1; - if(prx_pkt_attrib->encrypt){ - prsnie=(u8*)pIE; - //check whether initiator STA has CCMP pairwise_cipher. - ppairwise_cipher=prsnie+10; - _rtw_memcpy(&pairwise_count, (u16*)(ppairwise_cipher-2), 1); - for(k=0;kstat_code=72; - } - } - break; - case _EXT_CAP_IE_: - break; - case _VENDOR_SPECIFIC_IE_: - break; - case _FTIE_: - if(prx_pkt_attrib->encrypt) - _rtw_memcpy(SNonce, (ptr+j+52), 32); - break; - case _TIMEOUT_ITVL_IE_: - if(prx_pkt_attrib->encrypt) - timeout_interval = (u32 *)(ptr+j+3); - break; - case _RIC_Descriptor_IE_: - break; - case _HT_CAPABILITY_IE_: - rtw_tdls_process_ht_cap(adapter, ptdls_sta, pIE->data, pIE->Length); - break; - case EID_BSSCoexistence: - break; - case _LINK_ID_IE_: - if(_rtw_memcmp(get_bssid(pmlmepriv), pIE->data, 6) == _FALSE) - { - //not in the same BSS - ptdls_sta->stat_code=7; - } - break; - default: - break; - } - - j += (pIE->Length + 2); - - } - - //update station supportRate - ptdls_sta->bssratelen = supportRateNum; - _rtw_memcpy(ptdls_sta->bssrateset, supportRate, supportRateNum); - - //check status code - //if responder STA has/hasn't security on AP, but request hasn't/has RSNIE, it should reject - if(ptdls_sta->stat_code == 0 ) - { - if(rsnie_have && (prx_pkt_attrib->encrypt==0)){ - //security disabled - ptdls_sta->stat_code = 5; - }else if(rsnie_have==0 && (prx_pkt_attrib->encrypt)){ - //request haven't RSNIE - ptdls_sta->stat_code = 38; - } - -#ifdef CONFIG_WFD - //WFD test plan version 0.18.2 test item 5.1.5 - //SoUT does not use TDLS if AP uses weak security - if ( adapter->wdinfo.wfd_tdls_enable ) - { - if(rsnie_have && (prx_pkt_attrib->encrypt != _AES_)) - { - ptdls_sta->stat_code = 5; - } - } -#endif //CONFIG_WFD - } - - ptdls_sta->tdls_sta_state|= TDLS_INITIATOR_STATE; - if(prx_pkt_attrib->encrypt){ - _rtw_memcpy(ptdls_sta->SNonce, SNonce, 32); - _rtw_memcpy(&(ptdls_sta->TDLS_PeerKey_Lifetime), timeout_interval, 4); - } - _enter_critical_bh(&(pstapriv->sta_hash_lock), &irqL); - if(!(ptdls_sta->tdls_sta_state & TDLS_LINKED_STATE)) - ptdlsinfo->sta_cnt++; - _exit_critical_bh(&(pstapriv->sta_hash_lock), &irqL); - if( ptdlsinfo->sta_cnt == (NUM_STA - 2) ) // -2: AP + BC/MC sta - { - ptdlsinfo->sta_maximum = _TRUE; - } - -#ifdef CONFIG_WFD - rtw_tdls_process_wfd_ie(ptdlsinfo, ptr + FIXED_IE, parsing_length - FIXED_IE); -#endif // CONFIG_WFD - - } - else - { - goto exit; - } - - issue_tdls_setup_rsp(adapter, precv_frame); - - if(ptdls_sta->stat_code==0) - { - _set_timer( &ptdls_sta->handshake_timer, TDLS_HANDSHAKE_TIME); - } - else //status code!=0 ; setup unsuccess - { - free_tdls_sta(adapter, ptdls_sta); - } - -exit: - - return _FAIL; -} - -sint On_TDLS_Setup_Rsp(_adapter *adapter, union recv_frame *precv_frame) -{ - struct tdls_info *ptdlsinfo = &adapter->tdlsinfo; - struct sta_info *ptdls_sta= NULL; - struct sta_priv *pstapriv = &adapter->stapriv; - u8 *ptr = precv_frame->u.hdr.rx_data; - _irqL irqL; - struct rx_pkt_attrib *prx_pkt_attrib = &precv_frame->u.hdr.attrib; - u8 *psa; - u16 stat_code; - sint parsing_length; //frame body length, without icv_len - PNDIS_802_11_VARIABLE_IEs pIE; - u8 FIXED_IE =7; - u8 *pftie, *ptimeout_ie, *plinkid_ie, *prsnie, *pftie_mic, *ppairwise_cipher; - u16 pairwise_count, j, k; - u8 verify_ccmp=0; - unsigned char supportRate[16]; - int supportRateNum = 0; - - psa = get_sa(ptr); - ptdls_sta = rtw_get_stainfo(pstapriv, psa); - - if ( NULL == ptdls_sta ) - { - return _FAIL; - } - - ptr +=prx_pkt_attrib->hdrlen + prx_pkt_attrib->iv_len+LLC_HEADER_SIZE+TYPE_LENGTH_FIELD_SIZE+1; - parsing_length= ((union recv_frame *)precv_frame)->u.hdr.len - -prx_pkt_attrib->hdrlen - -prx_pkt_attrib->iv_len - -prx_pkt_attrib->icv_len - -LLC_HEADER_SIZE - -TYPE_LENGTH_FIELD_SIZE - -1 - -FIXED_IE; - - _rtw_memcpy(&stat_code, ptr+2, 2); - - if(stat_code!=0) - { - DBG_871X( "[%s] status_code = %d, free_tdls_sta\n", __FUNCTION__, stat_code ); - free_tdls_sta(adapter, ptdls_sta); - return _FAIL; - } - - stat_code = 0; - - //parsing information element - for(j=FIXED_IE; jElementID) - { - case _SUPPORTEDRATES_IE_: - _rtw_memcpy(supportRate, pIE->data, pIE->Length); - supportRateNum = pIE->Length; - break; - case _COUNTRY_IE_: - break; - case _EXT_SUPPORTEDRATES_IE_: - if(supportRateNum<=sizeof(supportRate)) - { - _rtw_memcpy(supportRate+supportRateNum, pIE->data, pIE->Length); - supportRateNum += pIE->Length; - } - break; - case _SUPPORTED_CH_IE_: - break; - case _RSN_IE_2_: - prsnie=(u8*)pIE; - //check whether responder STA has CCMP pairwise_cipher. - ppairwise_cipher=prsnie+10; - _rtw_memcpy(&pairwise_count, (u16*)(ppairwise_cipher-2), 2); - for(k=0;kANonce, (ptr+j+20), 32); - break; - case _TIMEOUT_ITVL_IE_: - ptimeout_ie=(u8*)pIE; - break; - case _RIC_Descriptor_IE_: - break; - case _HT_CAPABILITY_IE_: - rtw_tdls_process_ht_cap(adapter, ptdls_sta, pIE->data, pIE->Length); - break; - case EID_BSSCoexistence: - break; - case _LINK_ID_IE_: - plinkid_ie=(u8*)pIE; - break; - default: - break; - } - - j += (pIE->Length + 2); - - } - - //update station supportRate - ptdls_sta->bssratelen = supportRateNum; - _rtw_memcpy(ptdls_sta->bssrateset, supportRate, supportRateNum); - -#ifdef CONFIG_WFD - rtw_tdls_process_wfd_ie(ptdlsinfo, ptr + FIXED_IE, parsing_length - FIXED_IE); -#endif // CONFIG_WFD - - if(stat_code != 0) - { - ptdls_sta->stat_code = stat_code; - } - else - { - if(prx_pkt_attrib->encrypt) - { - if(verify_ccmp==1) - { - wpa_tdls_generate_tpk(adapter, ptdls_sta); - ptdls_sta->stat_code=0; - if(tdls_verify_mic(ptdls_sta->tpk.kck, 2, plinkid_ie, prsnie, ptimeout_ie, pftie)==0) //0: Invalid, 1: valid - { - free_tdls_sta(adapter, ptdls_sta); - return _FAIL; - } - } - else - { - ptdls_sta->stat_code=72; //invalide contents of RSNIE - } - - }else{ - ptdls_sta->stat_code=0; - } - } - - DBG_871X("issue_tdls_setup_cfm\n"); - issue_tdls_setup_cfm(adapter, precv_frame); - - if(ptdls_sta->stat_code==0) - { - ptdlsinfo->setup_state = TDLS_LINKED_STATE; - - if( ptdls_sta->tdls_sta_state & TDLS_RESPONDER_STATE ) - { - ptdls_sta->tdls_sta_state |= TDLS_LINKED_STATE; - _cancel_timer_ex( &ptdls_sta->handshake_timer); -#ifdef CONFIG_TDLS_AUTOCHECKALIVE - _set_timer( &ptdls_sta->alive_timer1, TDLS_ALIVE_TIMER_PH1); -#endif //CONFIG_TDLS_AUTOSETUP - } - - rtw_tdls_set_mac_id(ptdlsinfo, ptdls_sta); - rtw_tdls_set_key(adapter, prx_pkt_attrib, ptdls_sta); - - rtw_tdls_cmd(adapter, ptdls_sta->hwaddr, TDLS_WRCR); - - } - else //status code!=0 ; setup unsuccessful - { - free_tdls_sta(adapter, ptdls_sta); - } - - return _FAIL; - -} - -sint On_TDLS_Setup_Cfm(_adapter *adapter, union recv_frame *precv_frame) -{ - struct tdls_info *ptdlsinfo = &adapter->tdlsinfo; - struct sta_info *ptdls_sta= NULL; - struct sta_priv *pstapriv = &adapter->stapriv; - u8 *ptr = precv_frame->u.hdr.rx_data; - _irqL irqL; - struct rx_pkt_attrib *prx_pkt_attrib = &precv_frame->u.hdr.attrib; - u8 *psa; - u16 stat_code; - sint parsing_length; - PNDIS_802_11_VARIABLE_IEs pIE; - u8 FIXED_IE =5; - u8 *pftie, *ptimeout_ie, *plinkid_ie, *prsnie, *pftie_mic, *ppairwise_cipher; - u16 j, pairwise_count; - - psa = get_sa(ptr); - ptdls_sta = rtw_get_stainfo(pstapriv, psa); - - ptr +=prx_pkt_attrib->hdrlen + prx_pkt_attrib->iv_len+LLC_HEADER_SIZE+TYPE_LENGTH_FIELD_SIZE+1; - parsing_length= ((union recv_frame *)precv_frame)->u.hdr.len - -prx_pkt_attrib->hdrlen - -prx_pkt_attrib->iv_len - -prx_pkt_attrib->icv_len - -LLC_HEADER_SIZE - -ETH_TYPE_LEN - -PAYLOAD_TYPE_LEN - -FIXED_IE; - _rtw_memcpy(&stat_code, ptr+2, 2); - - if(stat_code!=0){ - DBG_871X( "[%s] stat_code = %d\n, free_tdls_sta", __FUNCTION__, stat_code ); - free_tdls_sta(adapter, ptdls_sta); - return _FAIL; - } - - if(prx_pkt_attrib->encrypt){ - //parsing information element - for(j=FIXED_IE; jElementID) - { - case _RSN_IE_2_: - prsnie=(u8*)pIE; - break; - case _VENDOR_SPECIFIC_IE_: - break; - case _FTIE_: - pftie=(u8*)pIE; - break; - case _TIMEOUT_ITVL_IE_: - ptimeout_ie=(u8*)pIE; - break; - case _HT_EXTRA_INFO_IE_: - break; - case _LINK_ID_IE_: - plinkid_ie=(u8*)pIE; - break; - default: - break; - } - - j += (pIE->Length + 2); - - } - - //verify mic in FTIE MIC field - if(tdls_verify_mic(ptdls_sta->tpk.kck, 3, plinkid_ie, prsnie, ptimeout_ie, pftie)==0){ //0: Invalid, 1: Valid - free_tdls_sta(adapter, ptdls_sta); - return _FAIL; - } - - } - - ptdlsinfo->setup_state = TDLS_LINKED_STATE; - if( ptdls_sta->tdls_sta_state & TDLS_INITIATOR_STATE ) - { - ptdls_sta->tdls_sta_state|=TDLS_LINKED_STATE; - _cancel_timer_ex( &ptdls_sta->handshake_timer); -#ifdef CONFIG_TDLS_AUTOCHECKALIVE - _set_timer( &ptdls_sta->alive_timer1, TDLS_ALIVE_TIMER_PH1); -#endif //CONFIG_TDLS_AUTOCHECKALIVE - } - - rtw_tdls_set_mac_id(ptdlsinfo, ptdls_sta); - rtw_tdls_set_key(adapter, prx_pkt_attrib, ptdls_sta); - - rtw_tdls_cmd(adapter, ptdls_sta->hwaddr, TDLS_WRCR); - - return _FAIL; - -} - -sint On_TDLS_Dis_Req(_adapter *adapter, union recv_frame *precv_frame) -{ - struct rx_pkt_attrib *prx_pkt_attrib = &precv_frame->u.hdr.attrib; - struct sta_priv *pstapriv = &adapter->stapriv; - struct sta_info *psta_ap; - u8 *ptr = precv_frame->u.hdr.rx_data; - sint parsing_length; //frame body length, without icv_len - PNDIS_802_11_VARIABLE_IEs pIE; - u8 FIXED_IE = 3, *dst, *pdialog = NULL; - u16 j; - - ptr +=prx_pkt_attrib->hdrlen + prx_pkt_attrib->iv_len + LLC_HEADER_SIZE+TYPE_LENGTH_FIELD_SIZE + 1; - pdialog=ptr+2; - - parsing_length= ((union recv_frame *)precv_frame)->u.hdr.len - -prx_pkt_attrib->hdrlen - -prx_pkt_attrib->iv_len - -prx_pkt_attrib->icv_len - -LLC_HEADER_SIZE - -TYPE_LENGTH_FIELD_SIZE - -1 - -FIXED_IE; - - //parsing information element - for(j=FIXED_IE; jElementID) - { - case _LINK_ID_IE_: - psta_ap = rtw_get_stainfo(pstapriv, pIE->data); - if(psta_ap == NULL) - { - goto exit; - } - dst = pIE->data + 12; - if( (MacAddr_isBcst(dst) == _FALSE) && (_rtw_memcmp(myid(&(adapter->eeprompriv)), dst, 6) == _FALSE) ) - { - goto exit; - } - break; - default: - break; - } - - j += (pIE->Length + 2); - - } - - //check frame contents - - issue_tdls_dis_rsp(adapter, precv_frame, *(pdialog) ); - -exit: - - return _FAIL; - -} - -sint On_TDLS_Teardown(_adapter *adapter, union recv_frame *precv_frame) -{ - u8 *psa; - u8 *ptr = precv_frame->u.hdr.rx_data; - struct rx_pkt_attrib *prx_pkt_attrib = &precv_frame->u.hdr.attrib; - struct mlme_ext_priv *pmlmeext = &(adapter->mlmeextpriv); - struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); - struct sta_priv *pstapriv = &adapter->stapriv; - struct sta_info *ptdls_sta= NULL; - _irqL irqL; - - psa = get_sa(ptr); - - ptdls_sta = rtw_get_stainfo(pstapriv, psa); - if(ptdls_sta!=NULL){ - if(ptdls_sta->tdls_sta_state & TDLS_CH_SWITCH_ON_STATE){ - rtw_tdls_cmd(adapter, ptdls_sta->hwaddr, TDLS_CS_OFF); - } - free_tdls_sta(adapter, ptdls_sta); - } - - return _FAIL; - -} - -u8 TDLS_check_ch_state(uint state){ - if( (state & TDLS_CH_SWITCH_ON_STATE) && - (state & TDLS_AT_OFF_CH_STATE) && - (state & TDLS_PEER_AT_OFF_STATE) ){ - - if(state & TDLS_PEER_SLEEP_STATE) - return 2; //U-APSD + ch. switch - else - return 1; //ch. switch - }else - return 0; -} - -//we process buffered data for 1. U-APSD, 2. ch. switch, 3. U-APSD + ch. switch here -sint On_TDLS_Peer_Traffic_Rsp(_adapter *adapter, union recv_frame *precv_frame) -{ - struct tdls_info *ptdlsinfo = &adapter->tdlsinfo; - struct mlme_ext_priv *pmlmeext = &adapter->mlmeextpriv; - struct rx_pkt_attrib *pattrib = & precv_frame->u.hdr.attrib; - struct sta_priv *pstapriv = &adapter->stapriv; - //get peer sta infomation - struct sta_info *ptdls_sta = rtw_get_stainfo(pstapriv, pattrib->src); - u8 wmmps_ac=0, state=TDLS_check_ch_state(ptdls_sta->tdls_sta_state); - int i; - - ptdls_sta->sta_stats.rx_data_pkts++; - - //receive peer traffic response frame, sleeping STA wakes up - //ptdls_sta->tdls_sta_state &= ~(TDLS_PEER_SLEEP_STATE); - process_wmmps_data( adapter, precv_frame); - - // if noticed peer STA wakes up by receiving peer traffic response - // and we want to do channel swtiching, then we will transmit channel switch request first - if(ptdls_sta->tdls_sta_state & TDLS_APSD_CHSW_STATE){ - issue_tdls_ch_switch_req(adapter, pattrib->src); - ptdls_sta->tdls_sta_state &= ~(TDLS_APSD_CHSW_STATE); - return _FAIL; - } - - //check 4-AC queue bit - if(ptdls_sta->uapsd_vo || ptdls_sta->uapsd_vi || ptdls_sta->uapsd_be || ptdls_sta->uapsd_bk) - wmmps_ac=1; - - //if it's a direct link and have buffered frame - if(ptdls_sta->tdls_sta_state & TDLS_LINKED_STATE){ - if(wmmps_ac && state) - { - _irqL irqL; - _list *xmitframe_plist, *xmitframe_phead; - struct xmit_frame *pxmitframe=NULL; - - _enter_critical_bh(&ptdls_sta->sleep_q.lock, &irqL); - - xmitframe_phead = get_list_head(&ptdls_sta->sleep_q); - xmitframe_plist = get_next(xmitframe_phead); - - //transmit buffered frames - while ((rtw_end_of_queue_search(xmitframe_phead, xmitframe_plist)) == _FALSE) - { - pxmitframe = LIST_CONTAINOR(xmitframe_plist, struct xmit_frame, list); - xmitframe_plist = get_next(xmitframe_plist); - rtw_list_delete(&pxmitframe->list); - - ptdls_sta->sleepq_len--; - if(ptdls_sta->sleepq_len>0){ - pxmitframe->attrib.mdata = 1; - pxmitframe->attrib.eosp = 0; - }else{ - pxmitframe->attrib.mdata = 0; - pxmitframe->attrib.eosp = 1; - } - //pxmitframe->attrib.triggered = 1; //maybe doesn't need in TDLS - if(adapter->HalFunc.hal_xmit(adapter, pxmitframe) == _TRUE) - { - rtw_os_xmit_complete(adapter, pxmitframe); - } - - } - - if(ptdls_sta->sleepq_len==0) - { - DBG_871X("no buffered packets for tdls to xmit\n"); - //on U-APSD + CH. switch state, when there is no buffered date to xmit, - // we should go back to base channel - if(state==2){ - rtw_tdls_cmd(adapter, ptdls_sta->hwaddr, TDLS_CS_OFF); - }else if(ptdls_sta->tdls_sta_state&TDLS_SW_OFF_STATE){ - ptdls_sta->tdls_sta_state &= ~(TDLS_SW_OFF_STATE); - ptdlsinfo->candidate_ch= pmlmeext->cur_channel; - issue_tdls_ch_switch_req(adapter, pattrib->src); - DBG_871X("issue tdls ch switch req back to base channel\n"); - } - - } - else - { - DBG_871X("error!psta->sleepq_len=%d\n", ptdls_sta->sleepq_len); - ptdls_sta->sleepq_len=0; - } - - _exit_critical_bh(&ptdls_sta->sleep_q.lock, &irqL); - - } - - } - - return _FAIL; -} - -sint On_TDLS_Ch_Switch_Req(_adapter *adapter, union recv_frame *precv_frame) -{ - struct sta_info *ptdls_sta= NULL; - struct sta_priv *pstapriv = &adapter->stapriv; - u8 *ptr = precv_frame->u.hdr.rx_data; - struct rx_pkt_attrib *prx_pkt_attrib = &precv_frame->u.hdr.attrib; - u8 *psa; - sint parsing_length; - PNDIS_802_11_VARIABLE_IEs pIE; - u8 FIXED_IE =3; - u16 j; - struct mlme_ext_priv *pmlmeext = &adapter->mlmeextpriv; - - psa = get_sa(ptr); - ptdls_sta = rtw_get_stainfo(pstapriv, psa); - - ptr +=prx_pkt_attrib->hdrlen + prx_pkt_attrib->iv_len+LLC_HEADER_SIZE+TYPE_LENGTH_FIELD_SIZE+1; - parsing_length= ((union recv_frame *)precv_frame)->u.hdr.len - -prx_pkt_attrib->hdrlen - -prx_pkt_attrib->iv_len - -prx_pkt_attrib->icv_len - -LLC_HEADER_SIZE - -ETH_TYPE_LEN - -PAYLOAD_TYPE_LEN - -FIXED_IE; - - ptdls_sta->off_ch = *(ptr+2); - - //parsing information element - for(j=FIXED_IE; jElementID) - { - case _COUNTRY_IE_: - break; - case _CH_SWTICH_ANNOUNCE_: - break; - case _LINK_ID_IE_: - break; - case _CH_SWITCH_TIMING_: - _rtw_memcpy(&ptdls_sta->ch_switch_time, pIE->data, 2); - _rtw_memcpy(&ptdls_sta->ch_switch_timeout, pIE->data+2, 2); - default: - break; - } - - j += (pIE->Length + 2); - - } - - //todo: check status - ptdls_sta->stat_code=0; - ptdls_sta->tdls_sta_state |= TDLS_CH_SWITCH_ON_STATE; - - issue_nulldata(adapter, NULL, 1, 0, 0); - - issue_tdls_ch_switch_rsp(adapter, psa); - - DBG_871X("issue tdls channel switch response\n"); - - if((ptdls_sta->tdls_sta_state & TDLS_CH_SWITCH_ON_STATE) && ptdls_sta->off_ch==pmlmeext->cur_channel){ - DBG_871X("back to base channel %x\n", pmlmeext->cur_channel); - ptdls_sta->option=7; - rtw_tdls_cmd(adapter, ptdls_sta->hwaddr, TDLS_BASE_CH); - }else{ - ptdls_sta->option=6; - rtw_tdls_cmd(adapter, ptdls_sta->hwaddr, TDLS_OFF_CH); - } - return _FAIL; -} - -sint On_TDLS_Ch_Switch_Rsp(_adapter *adapter, union recv_frame *precv_frame) -{ - struct sta_info *ptdls_sta= NULL; - struct sta_priv *pstapriv = &adapter->stapriv; - u8 *ptr = precv_frame->u.hdr.rx_data; - struct rx_pkt_attrib *prx_pkt_attrib = &precv_frame->u.hdr.attrib; - u8 *psa; - sint parsing_length; - PNDIS_802_11_VARIABLE_IEs pIE; - u8 FIXED_IE =4; - u16 stat_code, j, switch_time, switch_timeout; - struct mlme_ext_priv *pmlmeext = &adapter->mlmeextpriv; - - psa = get_sa(ptr); - ptdls_sta = rtw_get_stainfo(pstapriv, psa); - - //if channel switch is running and receiving Unsolicited TDLS Channel Switch Response, - //it will go back to base channel and terminate this channel switch procedure - if(ptdls_sta->tdls_sta_state & TDLS_CH_SWITCH_ON_STATE ){ - if(pmlmeext->cur_channel==ptdls_sta->off_ch){ - DBG_871X("back to base channel %x\n", pmlmeext->cur_channel); - ptdls_sta->option=7; - rtw_tdls_cmd(adapter, ptdls_sta->hwaddr, TDLS_OFF_CH); - }else{ - DBG_871X("receive unsolicited channel switch response \n"); - rtw_tdls_cmd(adapter, ptdls_sta->hwaddr, TDLS_CS_OFF); - } - return _FAIL; - } - - //avoiding duplicated or unconditional ch. switch. rsp - if((ptdls_sta->tdls_sta_state & TDLS_CH_SW_INITIATOR_STATE) != TDLS_CH_SW_INITIATOR_STATE) - return _FAIL; - - ptr +=prx_pkt_attrib->hdrlen + prx_pkt_attrib->iv_len+LLC_HEADER_SIZE+TYPE_LENGTH_FIELD_SIZE+1; - parsing_length= ((union recv_frame *)precv_frame)->u.hdr.len - -prx_pkt_attrib->hdrlen - -prx_pkt_attrib->iv_len - -prx_pkt_attrib->icv_len - -LLC_HEADER_SIZE - -ETH_TYPE_LEN - -PAYLOAD_TYPE_LEN - -FIXED_IE; - - _rtw_memcpy(&stat_code, ptr+2, 2); - - if(stat_code!=0){ - return _FAIL; - } - - //parsing information element - for(j=FIXED_IE; jElementID) - { - case _LINK_ID_IE_: - break; - case _CH_SWITCH_TIMING_: - _rtw_memcpy(&switch_time, pIE->data, 2); - if(switch_time > ptdls_sta->ch_switch_time) - _rtw_memcpy(&ptdls_sta->ch_switch_time, &switch_time, 2); - - _rtw_memcpy(&switch_timeout, pIE->data+2, 2); - if(switch_timeout > ptdls_sta->ch_switch_timeout) - _rtw_memcpy(&ptdls_sta->ch_switch_timeout, &switch_timeout, 2); - - default: - break; - } - - j += (pIE->Length + 2); - - } - - ptdls_sta->tdls_sta_state &= ~(TDLS_CH_SW_INITIATOR_STATE); - ptdls_sta->tdls_sta_state |=TDLS_CH_SWITCH_ON_STATE; - - //goto set_channel_workitem_callback() - ptdls_sta->option=6; - rtw_tdls_cmd(adapter, ptdls_sta->hwaddr, TDLS_OFF_CH); - - return _FAIL; -} - -#ifdef CONFIG_WFD -void wfd_ie_tdls(_adapter * padapter, u8 *pframe, u32 *pktlen ) -{ - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - struct wifi_display_info *pwfd_info = padapter->tdlsinfo.wfd_info; - u8 wfdie[ MAX_WFD_IE_LEN] = { 0x00 }; - u32 wfdielen = 0; - - // WFD OUI - wfdielen = 0; - wfdie[ wfdielen++ ] = 0x50; - wfdie[ wfdielen++ ] = 0x6F; - wfdie[ wfdielen++ ] = 0x9A; - wfdie[ wfdielen++ ] = 0x0A; // WFA WFD v1.0 - - // Commented by Albert 20110825 - // According to the WFD Specification, the negotiation request frame should contain 3 WFD attributes - // 1. WFD Device Information - // 2. Associated BSSID ( Optional ) - // 3. Local IP Adress ( Optional ) - - // WFD Device Information ATTR - // Type: - wfdie[ wfdielen++ ] = WFD_ATTR_DEVICE_INFO; - - // Length: - // Note: In the WFD specification, the size of length field is 2. - RTW_PUT_BE16(wfdie + wfdielen, 0x0006); - wfdielen += 2; - - // Value1: - // WFD device information - // available for WFD session + Preferred TDLS + WSD ( WFD Service Discovery ) - RTW_PUT_BE16(wfdie + wfdielen, pwfd_info->wfd_device_type | WFD_DEVINFO_SESSION_AVAIL - | WFD_DEVINFO_PC_TDLS | WFD_DEVINFO_WSD); - wfdielen += 2; - - // Value2: - // Session Management Control Port - // Default TCP port for RTSP messages is 554 - RTW_PUT_BE16(wfdie + wfdielen, pwfd_info->rtsp_ctrlport ); - wfdielen += 2; - - // Value3: - // WFD Device Maximum Throughput - // 300Mbps is the maximum throughput - RTW_PUT_BE16(wfdie + wfdielen, 300); - wfdielen += 2; - - // Associated BSSID ATTR - // Type: - wfdie[ wfdielen++ ] = WFD_ATTR_ASSOC_BSSID; - - // Length: - // Note: In the WFD specification, the size of length field is 2. - RTW_PUT_BE16(wfdie + wfdielen, 0x0006); - wfdielen += 2; - - // Value: - // Associated BSSID - if ( check_fwstate( pmlmepriv, _FW_LINKED) == _TRUE ) - { - _rtw_memcpy( wfdie + wfdielen, &pmlmepriv->assoc_bssid[ 0 ], ETH_ALEN ); - } - else - { - _rtw_memset( wfdie + wfdielen, 0x00, ETH_ALEN ); - } - - // Local IP Address ATTR - wfdie[ wfdielen++ ] = WFD_ATTR_LOCAL_IP_ADDR; - - // Length: - // Note: In the WFD specification, the size of length field is 2. - RTW_PUT_BE16(wfdie + wfdielen, 0x0005); - wfdielen += 2; - - // Version: - // 0x01: Version1;IPv4 - wfdie[ wfdielen++ ] = 0x01; - - // IPv4 Address - _rtw_memcpy( wfdie + wfdielen, pwfd_info->ip_address, 4 ); - wfdielen += 4; - - pframe = rtw_set_ie(pframe, _VENDOR_SPECIFIC_IE_, wfdielen, (unsigned char *) wfdie, pktlen); - -} -#endif //CONFIG_WFD - -void rtw_build_tdls_setup_req_ies(_adapter * padapter, struct xmit_frame * pxmitframe, u8 *pframe) -{ - struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; - struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info; - struct pkt_attrib *pattrib = &pxmitframe->attrib; - struct registry_priv *pregistrypriv = &padapter->registrypriv; - struct sta_info *ptdls_sta=rtw_get_stainfo( (&padapter->stapriv) , pattrib->dst); - - u8 payload_type = 0x02; - u8 category = RTW_WLAN_CATEGORY_TDLS; - u8 action = TDLS_SETUP_REQUEST; - u8 bssrate[NDIS_802_11_LENGTH_RATES_EX]; //Use NDIS_802_11_LENGTH_RATES_EX in order to call func.rtw_set_supported_rate - int bssrate_len = 0, i = 0 ; - u8 more_supportedrates = 0; - unsigned int ie_len; - u8 *p; - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - u8 link_id_addr[18] = {0}; - u8 iedata=0; - u8 sup_ch[ 30 * 2 ] = {0x00 }, sup_ch_idx = 0, idx_5g = 2; //For supported channel - u8 timeout_itvl[5]; //set timeout interval to maximum value - u32 time; - - //SNonce - if(pattrib->encrypt){ - for(i=0;i<8;i++){ - time=rtw_get_current_time(); - _rtw_memcpy(&ptdls_sta->SNonce[4*i], (u8 *)&time, 4); - } - } - - //payload type - pframe = rtw_set_fixed_ie(pframe, 1, &(payload_type), &(pattrib->pktlen)); - //category, action, dialog token - pframe = rtw_set_fixed_ie(pframe, 1, &(category), &(pattrib->pktlen)); - pframe = rtw_set_fixed_ie(pframe, 1, &(action), &(pattrib->pktlen)); - pframe = rtw_set_fixed_ie(pframe, 1, &(ptdls_sta->dialog), &(pattrib->pktlen)); - - //capability - _rtw_memcpy(pframe, rtw_get_capability_from_ie(pmlmeinfo->network.IEs), 2); - - if(pattrib->encrypt) - *pframe =*pframe | BIT(4); - pframe += 2; - pattrib->pktlen += 2; - - //supported rates - rtw_set_supported_rate(bssrate, WIRELESS_11BG_24N); - bssrate_len = IEEE80211_CCK_RATE_LEN + IEEE80211_NUM_OFDM_RATESLEN; - - if (bssrate_len > 8) - { - pframe = rtw_set_ie(pframe, _SUPPORTEDRATES_IE_ , 8, bssrate, &(pattrib->pktlen)); - more_supportedrates = 1; - } - else - { - pframe = rtw_set_ie(pframe, _SUPPORTEDRATES_IE_ , bssrate_len , bssrate, &(pattrib->pktlen)); - } - - //country(optional) - //extended supported rates - if(more_supportedrates==1){ - pframe = rtw_set_ie(pframe, _EXT_SUPPORTEDRATES_IE_ , (bssrate_len - 8), (bssrate + 8), &(pattrib->pktlen)); - } - - //supported channels - pframe = rtw_tdls_set_sup_ch(pmlmeext, pframe, pattrib); - - // SRC IE - pframe = rtw_set_ie( pframe, _SRC_IE_, 16, TDLS_SRC, &(pattrib->pktlen)); - - //RSNIE - if(pattrib->encrypt) - pframe = rtw_set_ie(pframe, _RSN_IE_2_, 20, TDLS_RSNIE, &(pattrib->pktlen)); - - //extended capabilities - pframe = rtw_set_ie(pframe, _EXT_CAP_IE_ , 5, TDLS_EXT_CAPIE, &(pattrib->pktlen)); - - //QoS capability(WMM_IE) - pframe = rtw_set_ie(pframe, _VENDOR_SPECIFIC_IE_, 7, TDLS_WMMIE, &(pattrib->pktlen)); - - - if(pattrib->encrypt){ - //FTIE - _rtw_memset(pframe, 0, 84); //All fields except SNonce shall be set to 0 - _rtw_memset(pframe, _FTIE_, 1); //version - _rtw_memset((pframe+1), 82, 1); //length - _rtw_memcpy((pframe+52), ptdls_sta->SNonce, 32); - pframe += 84; - pattrib->pktlen += 84; - - //Timeout interval - timeout_itvl[0]=0x02; - _rtw_memcpy(timeout_itvl+1, (u8 *)(&ptdls_sta->TDLS_PeerKey_Lifetime), 4); - pframe = rtw_set_ie(pframe, _TIMEOUT_ITVL_IE_, 5, timeout_itvl, &(pattrib->pktlen)); - } - - //Sup_reg_classes(optional) - //HT capabilities - pframe = rtw_tdls_set_ht_cap(padapter, pframe, pattrib); - - //20/40 BSS coexistence - if(pmlmepriv->num_FortyMHzIntolerant>0) - iedata |= BIT(2);//20 MHz BSS Width Request - pframe = rtw_set_ie(pframe, EID_BSSCoexistence, 1, &iedata, &(pattrib->pktlen)); - - //Link identifier - _rtw_memcpy(link_id_addr, pattrib->ra, 6); - _rtw_memcpy((link_id_addr+6), pattrib->src, 6); - _rtw_memcpy((link_id_addr+12), pattrib->dst, 6); - pframe = rtw_set_ie(pframe, _LINK_ID_IE_, 18, link_id_addr, &(pattrib->pktlen)); - -#ifdef CONFIG_WFD - wfd_ie_tdls( padapter, pframe, &(pattrib->pktlen) ); -#endif //CONFIG_WFD - -} - -void rtw_build_tdls_setup_rsp_ies(_adapter * padapter, struct xmit_frame * pxmitframe, u8 *pframe) -{ - struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); - struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); - struct pkt_attrib *pattrib = &pxmitframe->attrib; - struct sta_info *ptdls_sta; - struct registry_priv *pregistrypriv = &padapter->registrypriv; - - u8 payload_type = 0x02; - unsigned char category = RTW_WLAN_CATEGORY_TDLS; - unsigned char action = TDLS_SETUP_RESPONSE; - unsigned char bssrate[NDIS_802_11_LENGTH_RATES_EX]; - int bssrate_len = 0; - u8 more_supportedrates = 0; - unsigned int ie_len; - unsigned char *p; - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - u8 link_id_addr[18] = {0}; - u8 iedata=0; - u8 timeout_itvl[5]; //setup response timeout interval will copy from request - u8 ANonce[32]; //maybe it can put in ontdls_req - u8 k; //for random ANonce - u8 *pftie, *ptimeout_ie, *plinkid_ie, *prsnie, *pftie_mic; - u32 time; - - ptdls_sta = rtw_get_stainfo( &(padapter->stapriv) , pattrib->dst); - - if(ptdls_sta == NULL ) - { - DBG_871X("[%s] %d\n", __FUNCTION__, __LINE__); - return; - } - - if(pattrib->encrypt){ - for(k=0;k<8;k++){ - time=rtw_get_current_time(); - _rtw_memcpy(&ptdls_sta->ANonce[4*k], (u8*)&time, 4); - } - } - - //payload type - pframe = rtw_set_fixed_ie(pframe, 1, &(payload_type), &(pattrib->pktlen)); - //category, action, status code - pframe = rtw_set_fixed_ie(pframe, 1, &(category), &(pattrib->pktlen)); - pframe = rtw_set_fixed_ie(pframe, 1, &(action), &(pattrib->pktlen)); - pframe = rtw_set_fixed_ie(pframe, 2, (u8 *)&ptdls_sta->stat_code, &(pattrib->pktlen)); - - if(ptdls_sta->stat_code!=0) //invalid setup request - { - DBG_871X("ptdls_sta->stat_code:%04x \n", ptdls_sta->stat_code); - return; - } - - //dialog token - pframe = rtw_set_fixed_ie(pframe, 1, &(ptdls_sta->dialog), &(pattrib->pktlen)); - - //capability - _rtw_memcpy(pframe, rtw_get_capability_from_ie(pmlmeinfo->network.IEs), 2); - - if(pattrib->encrypt ) - *pframe =*pframe | BIT(4); - pframe += 2; - pattrib->pktlen += 2; - - //supported rates - rtw_set_supported_rate(bssrate, WIRELESS_11BG_24N); - bssrate_len = IEEE80211_CCK_RATE_LEN + IEEE80211_NUM_OFDM_RATESLEN; - - if (bssrate_len > 8) - { - pframe = rtw_set_ie(pframe, _SUPPORTEDRATES_IE_ , 8, bssrate, &(pattrib->pktlen)); - more_supportedrates = 1; - } - else - { - pframe = rtw_set_ie(pframe, _SUPPORTEDRATES_IE_ , bssrate_len , bssrate, &(pattrib->pktlen)); - } - - //country(optional) - //extended supported rates - if(more_supportedrates==1){ - pframe = rtw_set_ie(pframe, _EXT_SUPPORTEDRATES_IE_ , (bssrate_len - 8), (bssrate + 8), &(pattrib->pktlen)); - } - - //supported channels - pframe = rtw_tdls_set_sup_ch(pmlmeext, pframe, pattrib); - - // SRC IE - pframe = rtw_set_ie(pframe, _SRC_IE_ , 16, TDLS_SRC, &(pattrib->pktlen)); - - //RSNIE - if(pattrib->encrypt){ - prsnie = pframe; - pframe = rtw_set_ie(pframe, _RSN_IE_2_, 20, TDLS_RSNIE, &(pattrib->pktlen)); - } - - //extended capabilities - pframe = rtw_set_ie(pframe, _EXT_CAP_IE_ , 5, TDLS_EXT_CAPIE, &(pattrib->pktlen)); - - //QoS capability(WMM_IE) - pframe = rtw_set_ie(pframe, _VENDOR_SPECIFIC_IE_, 7, TDLS_WMMIE, &(pattrib->pktlen)); - - if(pattrib->encrypt){ - wpa_tdls_generate_tpk(padapter, ptdls_sta); - - //FTIE - pftie = pframe; - pftie_mic = pframe+4; - _rtw_memset(pframe, 0, 84); //All fields except SNonce shall be set to 0 - _rtw_memset(pframe, _FTIE_, 1); //version - _rtw_memset((pframe+1), 82, 1); //length - _rtw_memcpy((pframe+20), ptdls_sta->ANonce, 32); - _rtw_memcpy((pframe+52), ptdls_sta->SNonce, 32); - pframe += 84; - pattrib->pktlen += 84; - - //Timeout interval - ptimeout_ie = pframe; - timeout_itvl[0]=0x02; - _rtw_memcpy(timeout_itvl+1, (u8 *)(&ptdls_sta->TDLS_PeerKey_Lifetime), 4); - pframe = rtw_set_ie(pframe, _TIMEOUT_ITVL_IE_, 5, timeout_itvl, &(pattrib->pktlen)); - } - - //Sup_reg_classes(optional) - //HT capabilities - pframe = rtw_tdls_set_ht_cap(padapter, pframe, pattrib); - - //20/40 BSS coexistence - if(pmlmepriv->num_FortyMHzIntolerant>0) - iedata |= BIT(2);//20 MHz BSS Width Request - pframe = rtw_set_ie(pframe, EID_BSSCoexistence, 1, &iedata, &(pattrib->pktlen)); - - //Link identifier - plinkid_ie = pframe; - _rtw_memcpy(link_id_addr, pattrib->ra, 6); - _rtw_memcpy((link_id_addr+6), pattrib->dst, 6); - _rtw_memcpy((link_id_addr+12), pattrib->src, 6); - pframe = rtw_set_ie(pframe, _LINK_ID_IE_, 18, link_id_addr, &(pattrib->pktlen)); - - //fill FTIE mic - if(pattrib->encrypt) - wpa_tdls_ftie_mic(ptdls_sta->tpk.kck, 2, plinkid_ie, prsnie, ptimeout_ie, pftie, pftie_mic); - -#ifdef CONFIG_WFD - wfd_ie_tdls( padapter, pframe, &(pattrib->pktlen) ); -#endif //CONFIG_WFD - -} - -void rtw_build_tdls_setup_cfm_ies(_adapter * padapter, struct xmit_frame * pxmitframe, u8 *pframe) -{ - - struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); - struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); - struct pkt_attrib *pattrib = &pxmitframe->attrib; - struct sta_info *ptdls_sta=rtw_get_stainfo( (&padapter->stapriv) , pattrib->dst); - - u8 payload_type = 0x02; - unsigned char category = RTW_WLAN_CATEGORY_TDLS; - unsigned char action = TDLS_SETUP_CONFIRM; - u8 more_supportedrates = 0; - unsigned int ie_len; - unsigned char *p; - u8 timeout_itvl[5]; //set timeout interval to maximum value - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - u8 link_id_addr[18] = {0}; - u8 *pftie, *ptimeout_ie, *plinkid_ie, *prsnie, *pftie_mic; - - //payload type - pframe = rtw_set_fixed_ie(pframe, 1, &(payload_type), &(pattrib->pktlen)); - //category, action, status code, dialog token - pframe = rtw_set_fixed_ie(pframe, 1, &(category), &(pattrib->pktlen)); - pframe = rtw_set_fixed_ie(pframe, 1, &(action), &(pattrib->pktlen)); - pframe = rtw_set_fixed_ie(pframe, 2, (u8 *)&ptdls_sta->stat_code, &(pattrib->pktlen)); - pframe = rtw_set_fixed_ie(pframe, 1, &(ptdls_sta->dialog), &(pattrib->pktlen)); - - if(ptdls_sta->stat_code!=0) //invalid setup request - return; - - //RSNIE - if(pattrib->encrypt){ - prsnie = pframe; - pframe = rtw_set_ie(pframe, _RSN_IE_2_, 20, TDLS_RSNIE, &(pattrib->pktlen)); - } - - //EDCA param set; WMM param ele. - if(pattrib->encrypt){ - //FTIE - pftie = pframe; - pftie_mic = pframe+4; - _rtw_memset(pframe, 0, 84); //All fields except SNonce shall be set to 0 - _rtw_memset(pframe, _FTIE_, 1); //version - _rtw_memset((pframe+1), 82, 1); //length - _rtw_memcpy((pframe+20), ptdls_sta->ANonce, 32); - _rtw_memcpy((pframe+52), ptdls_sta->SNonce, 32); - pframe += 84; - pattrib->pktlen += 84; - - //Timeout interval - ptimeout_ie = pframe; - timeout_itvl[0]=0x02; - _rtw_memcpy(timeout_itvl+1, (u8 *)(&ptdls_sta->TDLS_PeerKey_Lifetime), 4); - ptdls_sta->TPK_count=0; - _set_timer(&ptdls_sta->TPK_timer, ptdls_sta->TDLS_PeerKey_Lifetime/TPK_RESEND_COUNT); - pframe = rtw_set_ie(pframe, _TIMEOUT_ITVL_IE_, 5, timeout_itvl, &(pattrib->pktlen)); - } - - //HT operation; todo - //Link identifier - plinkid_ie = pframe; - _rtw_memcpy(link_id_addr, pattrib->ra, 6); - _rtw_memcpy((link_id_addr+6), pattrib->src, 6); - _rtw_memcpy((link_id_addr+12), pattrib->dst, 6); - pframe = rtw_set_ie(pframe, _LINK_ID_IE_, 18, link_id_addr, &(pattrib->pktlen)); - - //fill FTIE mic - if(pattrib->encrypt) - wpa_tdls_ftie_mic(ptdls_sta->tpk.kck, 3, plinkid_ie, prsnie, ptimeout_ie, pftie, pftie_mic); - -} - -void rtw_build_tdls_teardown_ies(_adapter * padapter, struct xmit_frame * pxmitframe, u8 *pframe) -{ - - struct pkt_attrib *pattrib = &pxmitframe->attrib; - u8 payload_type = 0x02; - unsigned char category = RTW_WLAN_CATEGORY_TDLS; - unsigned char action = TDLS_TEARDOWN; - u8 link_id_addr[18] = {0}; - - struct sta_info *ptdls_sta = rtw_get_stainfo( &(padapter->stapriv) , pattrib->dst); - struct sta_priv *pstapriv = &padapter->stapriv; - - //payload type - pframe = rtw_set_fixed_ie(pframe, 1, &(payload_type), &(pattrib->pktlen)); - //category, action, reason code - pframe = rtw_set_fixed_ie(pframe, 1, &(category), &(pattrib->pktlen)); - pframe = rtw_set_fixed_ie(pframe, 1, &(action), &(pattrib->pktlen)); - pframe = rtw_set_fixed_ie(pframe, 1, (u8 *)&ptdls_sta->stat_code, &(pattrib->pktlen)); - - //Link identifier - if(ptdls_sta->tdls_sta_state & TDLS_INITIATOR_STATE){ - _rtw_memcpy(link_id_addr, pattrib->ra, 6); - _rtw_memcpy((link_id_addr+6), pattrib->src, 6); - _rtw_memcpy((link_id_addr+12), pattrib->dst, 6); - }else if(ptdls_sta->tdls_sta_state & TDLS_RESPONDER_STATE){ - _rtw_memcpy(link_id_addr, pattrib->ra, 6); - _rtw_memcpy((link_id_addr+6), pattrib->dst, 6); - _rtw_memcpy((link_id_addr+12), pattrib->src, 6); - } - pframe = rtw_set_ie(pframe, _LINK_ID_IE_, 18, link_id_addr, &(pattrib->pktlen)); - -} - -void rtw_build_tdls_dis_req_ies(_adapter * padapter, struct xmit_frame * pxmitframe, u8 *pframe) -{ - - struct pkt_attrib *pattrib = &pxmitframe->attrib; - u8 payload_type = 0x02; - u8 category = RTW_WLAN_CATEGORY_TDLS; - u8 action = TDLS_DISCOVERY_REQUEST; - u8 link_id_addr[18] = {0}; - static u8 dialogtoken=0; - - //payload type - pframe = rtw_set_fixed_ie(pframe, 1, &(payload_type), &(pattrib->pktlen)); - //category, action, reason code - pframe = rtw_set_fixed_ie(pframe, 1, &(category), &(pattrib->pktlen)); - pframe = rtw_set_fixed_ie(pframe, 1, &(action), &(pattrib->pktlen)); - pframe = rtw_set_fixed_ie(pframe, 1, &(dialogtoken), &(pattrib->pktlen)); - dialogtoken = (dialogtoken+1)%256; - - //Link identifier - _rtw_memcpy(link_id_addr, pattrib->ra, 6); - _rtw_memcpy((link_id_addr+6), pattrib->src, 6); - _rtw_memcpy((link_id_addr+12), pattrib->dst, 6); - pframe = rtw_set_ie(pframe, _LINK_ID_IE_, 18, link_id_addr, &(pattrib->pktlen)); - -} - -void rtw_build_tdls_dis_rsp_ies(_adapter * padapter, struct xmit_frame * pxmitframe, u8 *pframe, u8 dialog) -{ - struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; - struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info; - struct pkt_attrib *pattrib = &pxmitframe->attrib; - struct registry_priv *pregistrypriv = &padapter->registrypriv; - - u8 category = RTW_WLAN_CATEGORY_PUBLIC; - u8 action = TDLS_DISCOVERY_RESPONSE; - u8 bssrate[NDIS_802_11_LENGTH_RATES_EX]; - int bssrate_len = 0; - u8 more_supportedrates = 0; - u8 *p; - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - u8 link_id_addr[18] = {0}; - u8 iedata=0; - u8 timeout_itvl[5]; //set timeout interval to maximum value - u32 timeout_interval= TPK_RESEND_COUNT * 1000; - - //category, action, dialog token - pframe = rtw_set_fixed_ie(pframe, 1, &(category), &(pattrib->pktlen)); - pframe = rtw_set_fixed_ie(pframe, 1, &(action), &(pattrib->pktlen)); - pframe = rtw_set_fixed_ie(pframe, 1, &(dialog), &(pattrib->pktlen)); - - //capability - _rtw_memcpy(pframe, rtw_get_capability_from_ie(pmlmeinfo->network.IEs), 2); - - if(pattrib->encrypt) - *pframe =*pframe | BIT(4); - pframe += 2; - pattrib->pktlen += 2; - - //supported rates - rtw_set_supported_rate(bssrate, WIRELESS_11BG_24N); - bssrate_len = IEEE80211_CCK_RATE_LEN + IEEE80211_NUM_OFDM_RATESLEN; - - if (bssrate_len > 8) - { - pframe = rtw_set_ie(pframe, _SUPPORTEDRATES_IE_ , 8, bssrate, &(pattrib->pktlen)); - more_supportedrates = 1; - } - else - { - pframe = rtw_set_ie(pframe, _SUPPORTEDRATES_IE_ , bssrate_len , bssrate, &(pattrib->pktlen)); - } - - //extended supported rates - if(more_supportedrates==1){ - pframe = rtw_set_ie(pframe, _EXT_SUPPORTEDRATES_IE_ , (bssrate_len - 8), (bssrate + 8), &(pattrib->pktlen)); - } - - //supported channels - pframe = rtw_tdls_set_sup_ch(pmlmeext, pframe, pattrib); - - //RSNIE - if(pattrib->encrypt) - pframe = rtw_set_ie(pframe, _RSN_IE_2_, 20, TDLS_RSNIE, &(pattrib->pktlen)); - - //extended capability - pframe = rtw_set_ie(pframe, _EXT_CAP_IE_ , 5, TDLS_EXT_CAPIE, &(pattrib->pktlen)); - - if(pattrib->encrypt){ - //FTIE - _rtw_memset(pframe, 0, 84); //All fields shall be set to 0 - _rtw_memset(pframe, _FTIE_, 1); //version - _rtw_memset((pframe+1), 82, 1); //length - pframe += 84; - pattrib->pktlen += 84; - - //Timeout interval - timeout_itvl[0]=0x02; - _rtw_memcpy(timeout_itvl+1, &timeout_interval, 4); - pframe = rtw_set_ie(pframe, _TIMEOUT_ITVL_IE_, 5, timeout_itvl, &(pattrib->pktlen)); - } - - //Sup_reg_classes(optional) - //HT capabilities - pframe = rtw_tdls_set_ht_cap(padapter, pframe, pattrib); - - //20/40 BSS coexistence - if(pmlmepriv->num_FortyMHzIntolerant>0) - iedata |= BIT(2);//20 MHz BSS Width Request - pframe = rtw_set_ie(pframe, EID_BSSCoexistence, 1, &iedata, &(pattrib->pktlen)); - - //Link identifier - _rtw_memcpy(link_id_addr, pattrib->ra, 6); - _rtw_memcpy((link_id_addr+6), pattrib->dst, 6); - _rtw_memcpy((link_id_addr+12), pattrib->src, 6); - pframe = rtw_set_ie(pframe, _LINK_ID_IE_, 18, link_id_addr, &(pattrib->pktlen)); - -} - -void rtw_build_tdls_peer_traffic_indication_ies(_adapter * padapter, struct xmit_frame * pxmitframe, u8 *pframe) -{ - - struct pkt_attrib *pattrib = &pxmitframe->attrib; - u8 payload_type = 0x02; - unsigned char category = RTW_WLAN_CATEGORY_TDLS; - unsigned char action = TDLS_PEER_TRAFFIC_INDICATION; - - u8 link_id_addr[18] = {0}; - u8 AC_queue=0; - struct sta_priv *pstapriv = &padapter->stapriv; - struct sta_info *ptdls_sta = rtw_get_stainfo(pstapriv, pattrib->dst); - - //payload type - pframe = rtw_set_fixed_ie(pframe, 1, &(payload_type), &(pattrib->pktlen)); - //category, action, reason code - pframe = rtw_set_fixed_ie(pframe, 1, &(category), &(pattrib->pktlen)); - pframe = rtw_set_fixed_ie(pframe, 1, &(action), &(pattrib->pktlen)); - pframe = rtw_set_fixed_ie(pframe, 1, &(ptdls_sta->dialog), &(pattrib->pktlen)); - - //Link identifier - _rtw_memcpy(link_id_addr, pattrib->ra, 6); - _rtw_memcpy((link_id_addr+6), pattrib->src, 6); - _rtw_memcpy((link_id_addr+12), pattrib->dst, 6); - pframe = rtw_set_ie(pframe, _LINK_ID_IE_, 18, link_id_addr, &(pattrib->pktlen)); - - //PTI control - //PU buffer status - if(ptdls_sta->uapsd_bk&BIT(1)) - AC_queue=BIT(0); - if(ptdls_sta->uapsd_be&BIT(1)) - AC_queue=BIT(1); - if(ptdls_sta->uapsd_vi&BIT(1)) - AC_queue=BIT(2); - if(ptdls_sta->uapsd_vo&BIT(1)) - AC_queue=BIT(3); - pframe = rtw_set_ie(pframe, _PTI_BUFFER_STATUS_, 1, &AC_queue, &(pattrib->pktlen)); - -} - -void rtw_build_tdls_ch_switch_req_ies(_adapter * padapter, struct xmit_frame * pxmitframe, u8 *pframe) -{ - - struct pkt_attrib *pattrib = &pxmitframe->attrib; - struct tdls_info *ptdlsinfo = &padapter->tdlsinfo; - u8 payload_type = 0x02; - unsigned char category = RTW_WLAN_CATEGORY_TDLS; - unsigned char action = TDLS_CHANNEL_SWITCH_REQUEST; - u8 link_id_addr[18] = {0}; - struct sta_priv *pstapriv = &padapter->stapriv; - struct sta_info *ptdls_sta = rtw_get_stainfo(pstapriv, pattrib->dst); - u8 ch_switch_timing[4] = {0}; - u16 switch_time= CH_SWITCH_TIME, switch_timeout=CH_SWITCH_TIMEOUT; - - //payload type - pframe = rtw_set_fixed_ie(pframe, 1, &(payload_type), &(pattrib->pktlen)); - //category, action, target_ch - pframe = rtw_set_fixed_ie(pframe, 1, &(category), &(pattrib->pktlen)); - pframe = rtw_set_fixed_ie(pframe, 1, &(action), &(pattrib->pktlen)); - pframe = rtw_set_fixed_ie(pframe, 1, &(ptdlsinfo->candidate_ch), &(pattrib->pktlen)); - - //Link identifier - _rtw_memcpy(link_id_addr, pattrib->ra, 6); - _rtw_memcpy((link_id_addr+6), pattrib->src, 6); - _rtw_memcpy((link_id_addr+12), pattrib->dst, 6); - pframe = rtw_set_ie(pframe, _LINK_ID_IE_, 18, link_id_addr, &(pattrib->pktlen)); - - //ch switch timing - _rtw_memcpy(ch_switch_timing, &switch_time, 2); - _rtw_memcpy(ch_switch_timing+2, &switch_timeout, 2); - pframe = rtw_set_ie(pframe, _CH_SWITCH_TIMING_, 4, ch_switch_timing, &(pattrib->pktlen)); - - //update ch switch attrib to sta_info - ptdls_sta->off_ch=ptdlsinfo->candidate_ch; - ptdls_sta->ch_switch_time=switch_time; - ptdls_sta->ch_switch_timeout=switch_timeout; - -} - -void rtw_build_tdls_ch_switch_rsp_ies(_adapter * padapter, struct xmit_frame * pxmitframe, u8 *pframe) -{ - - struct pkt_attrib *pattrib = &pxmitframe->attrib; - u8 payload_type = 0x02; - unsigned char category = RTW_WLAN_CATEGORY_TDLS; - unsigned char action = TDLS_CHANNEL_SWITCH_RESPONSE; - u8 link_id_addr[18] = {0}; - struct sta_priv *pstapriv = &padapter->stapriv; - struct sta_info *ptdls_sta = rtw_get_stainfo(pstapriv, pattrib->dst); - struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; - struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info; - u8 ch_switch_timing[4] = {0}; - - //payload type - pframe = rtw_set_fixed_ie(pframe, 1, &(payload_type), &(pattrib->pktlen)); - //category, action, status_code - pframe = rtw_set_fixed_ie(pframe, 1, &(category), &(pattrib->pktlen)); - pframe = rtw_set_fixed_ie(pframe, 1, &(action), &(pattrib->pktlen)); - pframe = rtw_set_fixed_ie(pframe, 2, (u8 *)&ptdls_sta->stat_code, &(pattrib->pktlen)); - - //Link identifier - _rtw_memcpy(link_id_addr, pattrib->ra, 6); - _rtw_memcpy((link_id_addr+6), pattrib->src, 6); - _rtw_memcpy((link_id_addr+12), pattrib->dst, 6); - pframe = rtw_set_ie(pframe, _LINK_ID_IE_, 18, link_id_addr, &(pattrib->pktlen)); - - //ch switch timing - _rtw_memcpy(ch_switch_timing, &ptdls_sta->ch_switch_time, 2); - _rtw_memcpy(ch_switch_timing+2, &ptdls_sta->ch_switch_timeout, 2); - pframe = rtw_set_ie(pframe, _CH_SWITCH_TIMING_, 4, ch_switch_timing, &(pattrib->pktlen)); - -} - -#ifdef CONFIG_WFD -void rtw_build_tunneled_probe_req_ies(_adapter * padapter, struct xmit_frame * pxmitframe, u8 *pframe) -{ - - struct pkt_attrib *pattrib = &pxmitframe->attrib; - struct wifidirect_info *pwdinfo = &padapter->wdinfo; - struct wifidirect_info *pbuddy_wdinfo = &padapter->pbuddy_adapter->wdinfo; - u8 payload_type = 0x02; - u8 category = RTW_WLAN_CATEGORY_P2P; - u8 WFA_OUI[3] = { 0x50, 0x6f, 0x9a}; - u8 probe_req = 4; - u8 wfdielen = 0; - - //payload type - pframe = rtw_set_fixed_ie(pframe, 1, &(payload_type), &(pattrib->pktlen)); - //category, OUI, frame_body_type - pframe = rtw_set_fixed_ie(pframe, 1, &(category), &(pattrib->pktlen)); - pframe = rtw_set_fixed_ie(pframe, 3, WFA_OUI, &(pattrib->pktlen)); - pframe = rtw_set_fixed_ie(pframe, 1, &(probe_req), &(pattrib->pktlen)); - - if(!rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) - { - wfdielen = build_probe_req_wfd_ie(pwdinfo, pframe); - pframe += wfdielen; - pattrib->pktlen += wfdielen; - } - else if(!rtw_p2p_chk_state(pbuddy_wdinfo, P2P_STATE_NONE)) - { - wfdielen = build_probe_req_wfd_ie(pbuddy_wdinfo, pframe); - pframe += wfdielen; - pattrib->pktlen += wfdielen; - } - -} - -void rtw_build_tunneled_probe_rsp_ies(_adapter * padapter, struct xmit_frame * pxmitframe, u8 *pframe) -{ - - struct pkt_attrib *pattrib = &pxmitframe->attrib; - struct wifidirect_info *pwdinfo = &padapter->wdinfo; - struct wifidirect_info *pbuddy_wdinfo = &padapter->pbuddy_adapter->wdinfo; - u8 payload_type = 0x02; - u8 category = RTW_WLAN_CATEGORY_P2P; - u8 WFA_OUI[3] = { 0x50, 0x6f, 0x9a}; - u8 probe_rsp = 5; - u8 wfdielen = 0; - - //payload type - pframe = rtw_set_fixed_ie(pframe, 1, &(payload_type), &(pattrib->pktlen)); - //category, OUI, frame_body_type - pframe = rtw_set_fixed_ie(pframe, 1, &(category), &(pattrib->pktlen)); - pframe = rtw_set_fixed_ie(pframe, 3, WFA_OUI, &(pattrib->pktlen)); - pframe = rtw_set_fixed_ie(pframe, 1, &(probe_rsp), &(pattrib->pktlen)); - - if(!rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) - { - wfdielen = build_probe_resp_wfd_ie(pwdinfo, pframe, 1); - pframe += wfdielen; - pattrib->pktlen += wfdielen; - } - else if(!rtw_p2p_chk_state(pbuddy_wdinfo, P2P_STATE_NONE)) - { - wfdielen = build_probe_resp_wfd_ie(pbuddy_wdinfo, pframe, 1); - pframe += wfdielen; - pattrib->pktlen += wfdielen; - } - -} -#endif //CONFIG_WFD - -void _TPK_timer_hdl(void *FunctionContext) -{ - struct sta_info *ptdls_sta = (struct sta_info *)FunctionContext; - - ptdls_sta->TPK_count++; - //TPK_timer set 1000 as default - //retry timer should set at least 301 sec. - if(ptdls_sta->TPK_count==TPK_RESEND_COUNT){ - ptdls_sta->TPK_count=0; - issue_tdls_setup_req(ptdls_sta->padapter, ptdls_sta->hwaddr); - } - - _set_timer(&ptdls_sta->TPK_timer, ptdls_sta->TDLS_PeerKey_Lifetime/TPK_RESEND_COUNT); -} - -void init_TPK_timer(_adapter *padapter, struct sta_info *psta) -{ - psta->padapter=padapter; - - _init_timer(&psta->TPK_timer, padapter->pnetdev, _TPK_timer_hdl, psta); -} - -// TDLS_DONE_CH_SEN: channel sensing and report candidate channel -// TDLS_OFF_CH: first time set channel to off channel -// TDLS_BASE_CH: when go back to the channel linked with AP, send null data to peer STA as an indication -void _ch_switch_timer_hdl(void *FunctionContext) -{ - - struct sta_info *ptdls_sta = (struct sta_info *)FunctionContext; - _adapter *padapter = ptdls_sta->padapter; - - if( ptdls_sta->option == TDLS_DONE_CH_SEN ){ - rtw_tdls_cmd(padapter, ptdls_sta->hwaddr, TDLS_DONE_CH_SEN); - }else if( ptdls_sta->option == TDLS_OFF_CH ){ - issue_nulldata_to_TDLS_peer_STA(ptdls_sta->padapter, ptdls_sta, 0); - _set_timer(&ptdls_sta->base_ch_timer, 500); - }else if( ptdls_sta->option == TDLS_BASE_CH){ - issue_nulldata_to_TDLS_peer_STA(ptdls_sta->padapter, ptdls_sta, 0); - } -} - -void init_ch_switch_timer(_adapter *padapter, struct sta_info *psta) -{ - psta->padapter=padapter; - _init_timer(&psta->option_timer, padapter->pnetdev, _ch_switch_timer_hdl, psta); -} - -void _base_ch_timer_hdl(void *FunctionContext) -{ - struct sta_info *ptdls_sta = (struct sta_info *)FunctionContext; - rtw_tdls_cmd(ptdls_sta->padapter, ptdls_sta->hwaddr, TDLS_P_OFF_CH); -} - -void init_base_ch_timer(_adapter *padapter, struct sta_info *psta) -{ - psta->padapter=padapter; - _init_timer(&psta->base_ch_timer, padapter->pnetdev, _base_ch_timer_hdl, psta); -} - -void _off_ch_timer_hdl(void *FunctionContext) -{ - struct sta_info *ptdls_sta = (struct sta_info *)FunctionContext; - rtw_tdls_cmd(ptdls_sta->padapter, ptdls_sta->hwaddr, TDLS_P_BASE_CH ); -} - -void init_off_ch_timer(_adapter *padapter, struct sta_info *psta) -{ - psta->padapter=padapter; - _init_timer(&psta->off_ch_timer, padapter->pnetdev, _off_ch_timer_hdl, psta); -} - -void _tdls_handshake_timer_hdl(void *FunctionContext) -{ - struct sta_info *ptdls_sta = (struct sta_info *)FunctionContext; - - if(ptdls_sta != NULL) - { - if( !(ptdls_sta->tdls_sta_state & TDLS_LINKED_STATE) ) - { - DBG_871X("tdls handshake time out\n"); - free_tdls_sta(ptdls_sta->padapter, ptdls_sta); - } - } -} - -void init_handshake_timer(_adapter *padapter, struct sta_info *psta) -{ - psta->padapter=padapter; - _init_timer(&psta->handshake_timer, padapter->pnetdev, _tdls_handshake_timer_hdl, psta); -} - -//Check tdls peer sta alive. -void _tdls_alive_timer_phase1_hdl(void *FunctionContext) -{ - _irqL irqL; - struct sta_info *ptdls_sta = (struct sta_info *)FunctionContext; - _adapter *padapter = ptdls_sta->padapter; - struct tdls_info *ptdlsinfo = &padapter->tdlsinfo; - - _enter_critical_bh(&ptdlsinfo->hdl_lock, &irqL); - ptdls_sta->timer_flag = 1; - _exit_critical_bh(&ptdlsinfo->hdl_lock, &irqL); - - ptdls_sta->tdls_sta_state &= (~TDLS_ALIVE_STATE); - - DBG_871X("issue_tdls_dis_req to check alive\n"); - issue_tdls_dis_req( padapter, ptdls_sta->hwaddr); - rtw_tdls_cmd(padapter, ptdls_sta->hwaddr, TDLS_CKALV_PH1); - sta_update_last_rx_pkts(ptdls_sta); - - if ( ptdls_sta->timer_flag == 2 ) - rtw_tdls_cmd(padapter, ptdls_sta->hwaddr, TDLS_FREE_STA); - else - { - _enter_critical_bh(&ptdlsinfo->hdl_lock, &irqL); - ptdls_sta->timer_flag = 0; - _exit_critical_bh(&ptdlsinfo->hdl_lock, &irqL); - } - -} - -void _tdls_alive_timer_phase2_hdl(void *FunctionContext) -{ - _irqL irqL; - struct sta_info *ptdls_sta = (struct sta_info *)FunctionContext; - _adapter *padapter = ptdls_sta->padapter; - struct tdls_info *ptdlsinfo = &padapter->tdlsinfo; - - _enter_critical_bh(&(ptdlsinfo->hdl_lock), &irqL); - ptdls_sta->timer_flag = 1; - _exit_critical_bh(&ptdlsinfo->hdl_lock, &irqL); - - if( (ptdls_sta->tdls_sta_state & TDLS_ALIVE_STATE) && - (sta_last_rx_pkts(ptdls_sta) + 3 <= sta_rx_pkts(ptdls_sta)) ) - { - DBG_871X("TDLS STA ALIVE, ptdls_sta->sta_stats.last_rx_pkts:%llu, ptdls_sta->sta_stats.rx_pkts:%llu\n", - sta_last_rx_pkts(ptdls_sta), sta_rx_pkts(ptdls_sta)); - - ptdls_sta->alive_count = 0; - rtw_tdls_cmd(padapter, ptdls_sta->hwaddr, TDLS_CKALV_PH2); - } - else - { - if( !(ptdls_sta->tdls_sta_state & TDLS_ALIVE_STATE) ) - DBG_871X("TDLS STA TOO FAR\n"); - if( !(sta_last_rx_pkts(ptdls_sta) + 3 <= sta_rx_pkts(ptdls_sta))) - DBG_871X("TDLS LINK WITH LOW TRAFFIC, ptdls_sta->sta_stats.last_rx_pkts:%llu, ptdls_sta->sta_stats.rx_pkts:%llu\n", - sta_last_rx_pkts(ptdls_sta), sta_rx_pkts(ptdls_sta)); - - ptdls_sta->alive_count++; - if( ptdls_sta->alive_count == TDLS_ALIVE_COUNT ) - { - ptdls_sta->stat_code = _RSON_TDLS_TEAR_TOOFAR_; - issue_tdls_teardown(padapter, ptdls_sta->hwaddr); - } - else - { - rtw_tdls_cmd(padapter, ptdls_sta->hwaddr, TDLS_CKALV_PH2); - } - } - - if ( ptdls_sta->timer_flag == 2 ) - rtw_tdls_cmd(padapter, ptdls_sta->hwaddr, TDLS_FREE_STA); - else - { - _enter_critical_bh(&(ptdlsinfo->hdl_lock), &irqL); - ptdls_sta->timer_flag = 0; - _exit_critical_bh(&ptdlsinfo->hdl_lock, &irqL); -} - -} - -void init_tdls_alive_timer(_adapter *padapter, struct sta_info *psta) -{ - psta->padapter=padapter; - _init_timer(&psta->alive_timer1, padapter->pnetdev, _tdls_alive_timer_phase1_hdl, psta); - _init_timer(&psta->alive_timer2, padapter->pnetdev, _tdls_alive_timer_phase2_hdl, psta); -} - -int update_sgi_tdls(_adapter *padapter, struct sta_info *psta) -{ - struct ht_priv *psta_ht = NULL; - psta_ht = &psta->htpriv; - - if(psta_ht->ht_option) - { - return psta_ht->sgi; - } - else - return _FALSE; -} - -u32 update_mask_tdls(_adapter *padapter, struct sta_info *psta) -{ - int i; - u8 rf_type, id; - unsigned char sta_band = 0; - unsigned char limit; - unsigned int tx_ra_bitmap=0; - struct ht_priv *psta_ht = NULL; - struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); - WLAN_BSSID_EX *pcur_network = (WLAN_BSSID_EX *)&pmlmepriv->cur_network.network; - - psta_ht = &psta->htpriv; - //b/g mode ra_bitmap - for (i=0; ibssrateset); i++) - { - if (psta->bssrateset[i]) - tx_ra_bitmap |= rtw_get_bit_value_from_ieee_value(psta->bssrateset[i]&0x7f); - } - - //n mode ra_bitmap - if(psta_ht->ht_option) - { - padapter->HalFunc.GetHwRegHandler(padapter, HW_VAR_RF_TYPE, (u8 *)(&rf_type)); - if(rf_type == RF_2T2R) - limit=16;// 2R - else - limit=8;// 1R - - for (i=0; iht_cap.supp_mcs_set[i/8] & BIT(i%8)) - tx_ra_bitmap |= BIT(i+12); - } - } - - if ( pcur_network->Configuration.DSConfig > 14 ) { - // 5G band - if (tx_ra_bitmap & 0xffff000) - sta_band |= WIRELESS_11_5N | WIRELESS_11A; - else - sta_band |= WIRELESS_11A; - } else { - if (tx_ra_bitmap & 0xffff000) - sta_band |= WIRELESS_11_24N | WIRELESS_11G | WIRELESS_11B; - else if (tx_ra_bitmap & 0xff0) - sta_band |= WIRELESS_11G |WIRELESS_11B; - else - sta_band |= WIRELESS_11B; - } - - id = networktype_to_raid(sta_band); - tx_ra_bitmap |= ((id<<28)&0xf0000000); - return tx_ra_bitmap; -} - -#endif //CONFIG_TDLS - +/****************************************************************************** + * + * 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 + * + * + ******************************************************************************/ +#define _RTW_TDLS_C_ + +#include +#include +#include +#include + +#ifdef CONFIG_TDLS +extern unsigned char MCS_rate_2R[16]; +extern unsigned char MCS_rate_1R[16]; +extern void process_wmmps_data(_adapter *padapter, union recv_frame *precv_frame); +extern s32 rtw_dump_xframe(_adapter *padapter, struct xmit_frame *pxmitframe); + +void rtw_reset_tdls_info(_adapter* padapter) +{ + struct tdls_info *ptdlsinfo = &padapter->tdlsinfo; + + ptdlsinfo->ap_prohibited = _FALSE; + ptdlsinfo->setup_state = TDLS_STATE_NONE; + ptdlsinfo->sta_cnt = 0; + ptdlsinfo->sta_maximum = _FALSE; + ptdlsinfo->macid_index= 6; + ptdlsinfo->clear_cam= 0; + ptdlsinfo->ch_sensing = 0; + ptdlsinfo->cur_channel = 0; + ptdlsinfo->candidate_ch = 1; //when inplement channel switching, default candidate channel is 1 + ptdlsinfo->watchdog_count = 0; + ptdlsinfo->dev_discovered = 0; + +#ifdef CONFIG_WFD + ptdlsinfo->wfd_info = &padapter->wfd_info; +#endif //CONFIG_WFD +} + +int rtw_init_tdls_info(_adapter* padapter) +{ + int res = _SUCCESS; + struct tdls_info *ptdlsinfo = &padapter->tdlsinfo; + + ptdlsinfo->enable = 1; + rtw_reset_tdls_info(padapter); + + _rtw_spinlock_init(&ptdlsinfo->cmd_lock); + _rtw_spinlock_init(&ptdlsinfo->hdl_lock); + + return res; + +} + +void rtw_free_tdls_info(struct tdls_info *ptdlsinfo) +{ + _rtw_spinlock_free(&ptdlsinfo->cmd_lock); + _rtw_spinlock_free(&ptdlsinfo->hdl_lock); + + _rtw_memset(ptdlsinfo, 0, sizeof(struct tdls_info) ); + +} + +void issue_nulldata_to_TDLS_peer_STA(_adapter *padapter, struct sta_info *ptdls_sta, unsigned int power_mode) +{ + struct xmit_frame *pmgntframe; + struct pkt_attrib *pattrib; + unsigned char *pframe; + struct rtw_ieee80211_hdr *pwlanhdr; + unsigned short *fctrl; + struct xmit_priv *pxmitpriv = &(padapter->xmitpriv); + struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); + struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); + + if ((pmgntframe = alloc_mgtxmitframe(pxmitpriv)) == NULL) + { + return; + } + + //update attribute + pattrib = &pmgntframe->attrib; + update_mgntframe_attrib(padapter, pattrib); + + _rtw_memset(pmgntframe->buf_addr, 0, WLANHDR_OFFSET + TXDESC_OFFSET); + + pframe = (u8 *)(pmgntframe->buf_addr) + TXDESC_OFFSET; + pwlanhdr = (struct rtw_ieee80211_hdr *)pframe; + + fctrl = &(pwlanhdr->frame_ctl); + *(fctrl) = 0; +// SetToDs(fctrl); + if (power_mode) + { + SetPwrMgt(fctrl); + } + + _rtw_memcpy(pwlanhdr->addr1, ptdls_sta->hwaddr, ETH_ALEN); + _rtw_memcpy(pwlanhdr->addr2, myid(&(padapter->eeprompriv)), ETH_ALEN); + _rtw_memcpy(pwlanhdr->addr3, get_my_bssid(&(pmlmeinfo->network)), ETH_ALEN); + + ptdls_sta->sta_xmitpriv.txseq_tid[pattrib->priority]++; + ptdls_sta->sta_xmitpriv.txseq_tid[pattrib->priority] &= 0xFFF; + pattrib->seqnum = ptdls_sta->sta_xmitpriv.txseq_tid[pattrib->priority]; + SetSeqNum(pwlanhdr, pattrib->seqnum); + + SetFrameSubType(pframe, WIFI_DATA_NULL); + + pframe += sizeof(struct rtw_ieee80211_hdr_3addr); + pattrib->pktlen = sizeof(struct rtw_ieee80211_hdr_3addr); + + pattrib->last_txcmdsz = pattrib->pktlen; + dump_mgntframe(padapter, pmgntframe); + + return; +} + +s32 update_tdls_attrib(_adapter *padapter, struct pkt_attrib *pattrib) +{ + + struct sta_info *psta = NULL; + struct sta_priv *pstapriv = &padapter->stapriv; + struct security_priv *psecuritypriv = &padapter->securitypriv; + struct mlme_priv *pmlmepriv = &padapter->mlmepriv; + struct qos_priv *pqospriv= &pmlmepriv->qospriv; + + s32 res=_SUCCESS; + sint bmcast; + + bmcast = IS_MCAST(pattrib->ra); + + psta = rtw_get_stainfo(pstapriv, pattrib->ra); + if (psta == NULL) { + res =_FAIL; + goto exit; + } + + pattrib->mac_id = psta->mac_id; + + pattrib->psta = psta; + + pattrib->ack_policy = 0; + // get ether_hdr_len + pattrib->pkt_hdrlen = ETH_HLEN;//(pattrib->ether_type == 0x8100) ? (14 + 4 ): 14; //vlan tag + + if (pqospriv->qos_option && psta->qos_option) { + pattrib->priority = 1; //tdls management frame should be AC_BK + pattrib->hdrlen = WLAN_HDR_A3_QOS_LEN; + pattrib->subtype = WIFI_QOS_DATA_TYPE; + } else { + pattrib->hdrlen = WLAN_HDR_A3_LEN; + pattrib->subtype = WIFI_DATA_TYPE; + pattrib->priority = 0; + } + + if (psta->ieee8021x_blocked == _TRUE) + { + pattrib->encrypt = 0; + } + else + { + GET_ENCRY_ALGO(psecuritypriv, psta, pattrib->encrypt, bmcast); + + switch(psecuritypriv->dot11AuthAlgrthm) + { + case dot11AuthAlgrthm_Open: + case dot11AuthAlgrthm_Shared: + case dot11AuthAlgrthm_Auto: + pattrib->key_idx = (u8)psecuritypriv->dot11PrivacyKeyIndex; + break; + case dot11AuthAlgrthm_8021X: + pattrib->key_idx = 0; + break; + default: + pattrib->key_idx = 0; + break; + } + } + + switch (pattrib->encrypt) + { + case _WEP40_: + case _WEP104_: + pattrib->iv_len = 4; + pattrib->icv_len = 4; + break; + case _TKIP_: + pattrib->iv_len = 8; + pattrib->icv_len = 4; + if(padapter->securitypriv.busetkipkey==_FAIL) + { + res =_FAIL; + goto exit; + } + break; + case _AES_: + pattrib->iv_len = 8; + pattrib->icv_len = 8; + break; + default: + pattrib->iv_len = 0; + pattrib->icv_len = 0; + break; + } + + if (pattrib->encrypt && + ((padapter->securitypriv.sw_encrypt == _TRUE) || (psecuritypriv->hw_decrypted == _FALSE))) + { + pattrib->bswenc = _TRUE; + } else { + pattrib->bswenc = _FALSE; + } + + //qos_en, ht_en, init rate, ,bw, ch_offset, sgi + pattrib->qos_en = psta->qos_option; + pattrib->ht_en = psta->htpriv.ht_option; + pattrib->raid = psta->raid; + pattrib->bwmode = psta->htpriv.bwmode; + pattrib->ch_offset = psta->htpriv.ch_offset; + pattrib->sgi= psta->htpriv.sgi; + pattrib->ampdu_en = _FALSE; + + //if(pattrib->ht_en && psta->htpriv.ampdu_enable) + //{ + // if(psta->htpriv.agg_enable_bitmap & BIT(pattrib->priority)) + // pattrib->ampdu_en = _TRUE; + //} + +exit: + + return res; +} + +void free_tdls_sta(_adapter *padapter, struct sta_info *ptdls_sta) +{ + struct tdls_info *ptdlsinfo = &padapter->tdlsinfo; + struct sta_priv *pstapriv = &padapter->stapriv; + _irqL irqL; + + //free peer sta_info + _enter_critical_bh(&(pstapriv->sta_hash_lock), &irqL); + if(ptdlsinfo->sta_cnt != 0) + ptdlsinfo->sta_cnt--; + _exit_critical_bh(&(pstapriv->sta_hash_lock), &irqL); + if( ptdlsinfo->sta_cnt < (NUM_STA - 2) ) // -2: AP + BC/MC sta + { + ptdlsinfo->sta_maximum = _FALSE; + _rtw_memset( &ptdlsinfo->ss_record, 0x00, sizeof(struct tdls_ss_record) ); + } + //ready to clear cam + if(ptdls_sta->mac_id!=0){ + ptdlsinfo->clear_cam=ptdls_sta->mac_id; + rtw_setstakey_cmd(padapter, (u8 *)ptdls_sta, _TRUE, _TRUE); + } + + if(ptdlsinfo->sta_cnt==0){ + rtw_tdls_cmd(padapter, myid(&(padapter->eeprompriv)), TDLS_RS_RCR); + ptdlsinfo->setup_state=TDLS_STATE_NONE; + } + else + DBG_871X("Remain tdls sta:%02x\n", ptdlsinfo->sta_cnt); + + rtw_free_stainfo(padapter, ptdls_sta); + +} + +// cam entry will be the same as mac_id +void rtw_tdls_set_mac_id(struct tdls_info *ptdlsinfo, struct sta_info *ptdls_sta) +{ + if(ptdls_sta->mac_id==0) + { + ptdls_sta->mac_id = ptdlsinfo->macid_index; + if( (++ptdlsinfo->macid_index) > (NUM_STA -2) ) + ptdlsinfo->macid_index= TDLS_INI_MACID_ENTRY; + } +} + +//TDLS encryption(if needed) will always be CCMP +void rtw_tdls_set_key(_adapter *adapter, struct rx_pkt_attrib *prx_pkt_attrib, struct sta_info *ptdls_sta) +{ + if(prx_pkt_attrib->encrypt) + { + ptdls_sta->dot118021XPrivacy=_AES_; + rtw_setstakey_cmd(adapter, (u8*)ptdls_sta, _TRUE, _TRUE); + } +} + +void rtw_tdls_process_ht_cap(_adapter *adapter, struct sta_info *ptdls_sta, u8 *data, u8 Length) +{ + /* save HT capabilities in the sta object */ + _rtw_memset(&ptdls_sta->htpriv.ht_cap, 0, sizeof(struct rtw_ieee80211_ht_cap)); + if (data && Length >= sizeof(struct rtw_ieee80211_ht_cap) ) + { + ptdls_sta->flags |= WLAN_STA_HT; + + ptdls_sta->flags |= WLAN_STA_WME; + + _rtw_memcpy(&ptdls_sta->htpriv.ht_cap, data, sizeof(struct rtw_ieee80211_ht_cap)); + + } else + ptdls_sta->flags &= ~WLAN_STA_HT; + + if(ptdls_sta->flags & WLAN_STA_HT) + { + if(adapter->registrypriv.ht_enable == _TRUE) + { + ptdls_sta->htpriv.ht_option = _TRUE; + } + else + { + ptdls_sta->htpriv.ht_option = _FALSE; + ptdls_sta->stat_code = _STATS_FAILURE_; + } + } + + //HT related cap + if(ptdls_sta->htpriv.ht_option) + { + //check if sta supports rx ampdu + if(adapter->registrypriv.ampdu_enable==1) + ptdls_sta->htpriv.ampdu_enable = _TRUE; + + //check if sta support s Short GI + if(ptdls_sta->htpriv.ht_cap.cap_info & cpu_to_le16(IEEE80211_HT_CAP_SGI_20|IEEE80211_HT_CAP_SGI_40)) + { + ptdls_sta->htpriv.sgi = _TRUE; + } + + // bwmode would still followed AP's setting + if(ptdls_sta->htpriv.ht_cap.cap_info & cpu_to_le16(IEEE80211_HT_CAP_SUP_WIDTH)) + { + ptdls_sta->htpriv.bwmode = adapter->mlmeextpriv.cur_bwmode; + ptdls_sta->htpriv.ch_offset = adapter->mlmeextpriv.cur_ch_offset; + } + } +} + +u8 *rtw_tdls_set_ht_cap(_adapter *padapter, u8 *pframe, struct pkt_attrib *pattrib) +{ + struct rtw_ieee80211_ht_cap ht_capie; + u8 rf_type; + + //HT capabilities + _rtw_memset(&ht_capie, 0, sizeof(struct rtw_ieee80211_ht_cap)); + + ht_capie.cap_info = IEEE80211_HT_CAP_SUP_WIDTH |IEEE80211_HT_CAP_SGI_20 |IEEE80211_HT_CAP_SM_PS | + IEEE80211_HT_CAP_SGI_40 | IEEE80211_HT_CAP_TX_STBC |IEEE80211_HT_CAP_DSSSCCK40; + + { + u32 rx_packet_offset, max_recvbuf_sz; + padapter->HalFunc.GetHalDefVarHandler(padapter, HAL_DEF_RX_PACKET_OFFSET, &rx_packet_offset); + padapter->HalFunc.GetHalDefVarHandler(padapter, HAL_DEF_MAX_RECVBUF_SZ, &max_recvbuf_sz); + if(max_recvbuf_sz-rx_packet_offset>(8191-256)) + ht_capie.cap_info = ht_capie.cap_info |IEEE80211_HT_CAP_MAX_AMSDU; + } + + ht_capie.ampdu_params_info = (IEEE80211_HT_CAP_AMPDU_FACTOR&0x03); + + padapter->HalFunc.GetHwRegHandler(padapter, HW_VAR_RF_TYPE, (u8 *)(&rf_type)); + switch(rf_type) + { + case RF_1T1R: + ht_capie.cap_info |= 0x0100;//RX STBC One spatial stream + _rtw_memcpy(ht_capie.supp_mcs_set, MCS_rate_1R, 16); + break; + + case RF_2T2R: + case RF_1T2R: + default: + ht_capie.cap_info|= 0x0200;//RX STBC two spatial stream + _rtw_memcpy(ht_capie.supp_mcs_set, MCS_rate_2R, 16); + break; + } + + return(rtw_set_ie(pframe, _HT_CAPABILITY_IE_, + sizeof(struct rtw_ieee80211_ht_cap), (unsigned char*)&ht_capie, &(pattrib->pktlen))); +} + +u8 *rtw_tdls_set_sup_ch(struct mlme_ext_priv *pmlmeext, u8 *pframe, struct pkt_attrib *pattrib) +{ + u8 sup_ch[ 30 * 2 ] = { 0x00 }, sup_ch_idx = 0, idx_5g = 2; //For supported channel + do{ + if( pmlmeext->channel_set[sup_ch_idx].ChannelNum <= 14 ) + { + sup_ch[0] = 1; //First channel number + sup_ch[1] = pmlmeext->channel_set[sup_ch_idx].ChannelNum; //Number of channel + } + else + { + sup_ch[idx_5g++] = pmlmeext->channel_set[sup_ch_idx].ChannelNum; + sup_ch[idx_5g++] = 1; + } + + sup_ch_idx++; + } + while( pmlmeext->channel_set[sup_ch_idx].ChannelNum != 0 ); + return(rtw_set_ie(pframe, _SUPPORTED_CH_IE_, idx_5g, sup_ch, &(pattrib->pktlen))); +} + +#ifdef CONFIG_WFD +void rtw_tdls_process_wfd_ie(struct tdls_info *ptdlsinfo, u8 *ptr, u8 length) +{ + u8 wfd_ie[ 128 ] = { 0x00 }; + u32 wfd_ielen = 0; + u32 wfd_offset = 0; + // Try to get the TCP port information when receiving the negotiation response. + // + + wfd_offset = 0; + wfd_offset = rtw_get_wfd_ie( ptr + wfd_offset, length - wfd_offset, wfd_ie, &wfd_ielen ); + while( wfd_offset ) + { + u8 attr_content[ 10 ] = { 0x00 }; + u32 attr_contentlen = 0; + int i; + + DBG_871X( "[%s] WFD IE Found!!\n", __FUNCTION__ ); + rtw_get_wfd_attr_content( wfd_ie, wfd_ielen, WFD_ATTR_DEVICE_INFO, attr_content, &attr_contentlen); + if ( attr_contentlen ) + { + ptdlsinfo->wfd_info->peer_rtsp_ctrlport = RTW_GET_BE16( attr_content + 2 ); + DBG_871X( "[%s] Peer PORT NUM = %d\n", __FUNCTION__, ptdlsinfo->wfd_info->peer_rtsp_ctrlport ); + } + + _rtw_memset( attr_content, 0x00, 10); + attr_contentlen = 0; + rtw_get_wfd_attr_content( wfd_ie, wfd_ielen, WFD_ATTR_LOCAL_IP_ADDR, attr_content, &attr_contentlen); + if ( attr_contentlen ) + { + _rtw_memcpy(ptdlsinfo->wfd_info->peer_ip_address, ( attr_content + 1 ), 4); + DBG_871X( "[%s] Peer IP = %02u.%02u.%02u.%02u \n", __FUNCTION__, + ptdlsinfo->wfd_info->peer_ip_address[0], ptdlsinfo->wfd_info->peer_ip_address[1], + ptdlsinfo->wfd_info->peer_ip_address[2], ptdlsinfo->wfd_info->peer_ip_address[3] + ); + } + wfd_offset = rtw_get_wfd_ie( ptr + wfd_offset, length - wfd_offset, wfd_ie, &wfd_ielen ); + } +} + +void issue_tunneled_probe_req(_adapter *padapter) +{ + struct xmit_frame *pmgntframe; + struct pkt_attrib *pattrib; + struct mlme_priv *pmlmepriv = &padapter->mlmepriv; + struct xmit_priv *pxmitpriv = &(padapter->xmitpriv); + u8 baddr[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; + + DBG_871X("[%s]\n", __FUNCTION__); + + if ((pmgntframe = alloc_mgtxmitframe(pxmitpriv)) == NULL) + { + return; + } + + //update attribute + pattrib = &pmgntframe->attrib; + + pmgntframe->frame_tag = DATA_FRAMETAG; + pattrib->ether_type = 0x890d; + pattrib->pctrl =0; + + _rtw_memcpy(pattrib->dst, baddr, ETH_ALEN); + + _rtw_memcpy(pattrib->src, myid(&(padapter->eeprompriv)), ETH_ALEN); + + _rtw_memcpy(pattrib->ra, get_bssid(pmlmepriv), ETH_ALEN); + _rtw_memcpy(pattrib->ta, pattrib->src, ETH_ALEN); + + update_tdls_attrib(padapter, pattrib); + pattrib->qsel=pattrib->priority; + if (rtw_xmit_tdls_coalesce(padapter, pmgntframe, TUNNELED_PROBE_REQ) != _SUCCESS) { + rtw_free_xmitbuf(pxmitpriv, pmgntframe->pxmitbuf); + rtw_free_xmitframe(pxmitpriv, pmgntframe); + goto exit; + } + rtw_dump_xframe(padapter, pmgntframe); + +exit: + + return; +} + +void issue_tunneled_probe_rsp(_adapter *padapter, union recv_frame *precv_frame) +{ + struct xmit_frame *pmgntframe; + struct pkt_attrib *pattrib; + struct mlme_priv *pmlmepriv = &padapter->mlmepriv; + struct xmit_priv *pxmitpriv = &(padapter->xmitpriv); + struct rx_pkt_attrib *rx_pkt_pattrib = &precv_frame->u.hdr.attrib; + + DBG_871X("[%s]\n", __FUNCTION__); + + if ((pmgntframe = alloc_mgtxmitframe(pxmitpriv)) == NULL) + { + return; + } + + //update attribute + pattrib = &pmgntframe->attrib; + + pmgntframe->frame_tag = DATA_FRAMETAG; + pattrib->ether_type = 0x890d; + pattrib->pctrl =0; + + _rtw_memcpy(pattrib->dst, rx_pkt_pattrib->src, ETH_ALEN); + + _rtw_memcpy(pattrib->src, myid(&(padapter->eeprompriv)), ETH_ALEN); + + _rtw_memcpy(pattrib->ra, get_bssid(pmlmepriv), ETH_ALEN); + _rtw_memcpy(pattrib->ta, pattrib->src, ETH_ALEN); + + update_tdls_attrib(padapter, pattrib); + pattrib->qsel=pattrib->priority; + if (rtw_xmit_tdls_coalesce(padapter, pmgntframe, TUNNELED_PROBE_RSP) != _SUCCESS) { + rtw_free_xmitbuf(pxmitpriv, pmgntframe->pxmitbuf); + rtw_free_xmitframe(pxmitpriv, pmgntframe); + goto exit; + } + rtw_dump_xframe(padapter, pmgntframe); + +exit: + + return; +} +#endif //CONFIG_WFD + +void issue_tdls_setup_req(_adapter *padapter, u8 *mac_addr) +{ + struct tdls_info *ptdlsinfo = &padapter->tdlsinfo; + struct xmit_frame *pmgntframe; + struct pkt_attrib *pattrib; + struct mlme_priv *pmlmepriv = &padapter->mlmepriv; + struct xmit_priv *pxmitpriv = &(padapter->xmitpriv); + struct sta_priv *pstapriv = &padapter->stapriv; + struct sta_info *ptdls_sta= NULL; + _irqL irqL; + static u8 dialogtoken = 0; + u32 timeout_interval= TPK_RESEND_COUNT * 1000; //retry timer should set at least 301 sec, using TPK_count counting 301 times. + + if(ptdlsinfo->ap_prohibited == _TRUE) + goto exit; + + if ((pmgntframe = alloc_mgtxmitframe(pxmitpriv)) == NULL) + { + return; + } + + //update attribute + pattrib = &pmgntframe->attrib; + + pmgntframe->frame_tag = DATA_FRAMETAG; + pattrib->ether_type = 0x890d; + pattrib->pctrl =0; + + _rtw_memcpy(pattrib->dst, mac_addr, ETH_ALEN); + _rtw_memcpy(pattrib->src, myid(&(padapter->eeprompriv)), ETH_ALEN); + + _rtw_memcpy(pattrib->ra, get_bssid(pmlmepriv), ETH_ALEN); + _rtw_memcpy(pattrib->ta, pattrib->src, ETH_ALEN); + + update_tdls_attrib(padapter, pattrib); + + //init peer sta_info + ptdls_sta = rtw_get_stainfo(pstapriv, mac_addr); + if(ptdls_sta==NULL) + { + ptdls_sta = rtw_alloc_stainfo(pstapriv, mac_addr); + if(ptdls_sta) + { + _enter_critical_bh(&(pstapriv->sta_hash_lock), &irqL); + if(!(ptdls_sta->tdls_sta_state & TDLS_LINKED_STATE)) + ptdlsinfo->sta_cnt++; + _exit_critical_bh(&(pstapriv->sta_hash_lock), &irqL); + if( ptdlsinfo->sta_cnt == (NUM_STA - 2) ) // -2: AP + BC/MC sta + { + ptdlsinfo->sta_maximum = _TRUE; + } + } + else + { + rtw_free_xmitbuf(pxmitpriv,pmgntframe->pxmitbuf); + rtw_free_xmitframe(pxmitpriv, pmgntframe); + goto exit; + } + } + + if(ptdls_sta){ + ptdls_sta->tdls_sta_state |= TDLS_RESPONDER_STATE; + //for tdls; ptdls_sta->aid is used to fill dialogtoken + ptdls_sta->dialog = dialogtoken; + dialogtoken = (dialogtoken+1)%256; + ptdls_sta->TDLS_PeerKey_Lifetime = timeout_interval; + _set_timer( &ptdls_sta->handshake_timer, TDLS_HANDSHAKE_TIME ); + } + + pattrib->qsel=pattrib->priority; + if(rtw_xmit_tdls_coalesce(padapter, pmgntframe, TDLS_SETUP_REQUEST) !=_SUCCESS ){ + rtw_free_xmitbuf(pxmitpriv,pmgntframe->pxmitbuf); + rtw_free_xmitframe(pxmitpriv, pmgntframe); + goto exit; + } + rtw_dump_xframe(padapter, pmgntframe); + +exit: + + return; +} + +void issue_tdls_teardown(_adapter *padapter, u8 *mac_addr) +{ + struct xmit_frame *pmgntframe; + struct pkt_attrib *pattrib; + struct mlme_priv *pmlmepriv = &padapter->mlmepriv; + struct xmit_priv *pxmitpriv = &(padapter->xmitpriv); + struct sta_priv *pstapriv = &padapter->stapriv; + struct sta_info *ptdls_sta=NULL; + _irqL irqL; + + ptdls_sta = rtw_get_stainfo(pstapriv, mac_addr); + if(ptdls_sta==NULL){ + DBG_871X("issue tdls teardown unsuccessful\n"); + return; + }else{ + ptdls_sta->tdls_sta_state=TDLS_STATE_NONE; + } + + if ((pmgntframe = alloc_mgtxmitframe(pxmitpriv)) == NULL) + { + return; + } + + //update attribute + pattrib = &pmgntframe->attrib; + + pmgntframe->frame_tag = DATA_FRAMETAG; + pattrib->ether_type = 0x890d; + pattrib->pctrl =0; + + _rtw_memcpy(pattrib->dst, mac_addr, ETH_ALEN); + _rtw_memcpy(pattrib->src, myid(&(padapter->eeprompriv)), ETH_ALEN); + + _rtw_memcpy(pattrib->ra, get_bssid(pmlmepriv), ETH_ALEN); + _rtw_memcpy(pattrib->ta, pattrib->src, ETH_ALEN); + + update_tdls_attrib(padapter, pattrib); + pattrib->qsel=pattrib->priority; + if (rtw_xmit_tdls_coalesce(padapter, pmgntframe, TDLS_TEARDOWN) != _SUCCESS) { + rtw_free_xmitbuf(pxmitpriv, pmgntframe->pxmitbuf); + rtw_free_xmitframe(pxmitpriv, pmgntframe); + goto exit; + } + rtw_dump_xframe(padapter, pmgntframe); + + if(ptdls_sta->tdls_sta_state & TDLS_CH_SWITCH_ON_STATE){ + rtw_tdls_cmd(padapter, ptdls_sta->hwaddr, TDLS_CS_OFF); + } + + if( ptdls_sta->timer_flag == 1 ) + { + _enter_critical_bh(&(padapter->tdlsinfo.hdl_lock), &irqL); + ptdls_sta->timer_flag = 2; + _exit_critical_bh(&(padapter->tdlsinfo.hdl_lock), &irqL); + } + else + rtw_tdls_cmd(padapter, mac_addr, TDLS_FREE_STA ); + + +exit: + + return; +} + +void issue_tdls_dis_req(_adapter *padapter, u8 *mac_addr) +{ + struct xmit_frame *pmgntframe; + struct pkt_attrib *pattrib; + struct mlme_priv *pmlmepriv = &padapter->mlmepriv; + struct xmit_priv *pxmitpriv = &(padapter->xmitpriv); + u8 baddr[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; + + if ((pmgntframe = alloc_mgtxmitframe(pxmitpriv)) == NULL) + { + return; + } + + //update attribute + pattrib = &pmgntframe->attrib; + + pmgntframe->frame_tag = DATA_FRAMETAG; + pattrib->ether_type = 0x890d; + pattrib->pctrl =0; + + if(mac_addr == NULL) + _rtw_memcpy(pattrib->dst, baddr, ETH_ALEN); + else + _rtw_memcpy(pattrib->dst, mac_addr, ETH_ALEN); + + _rtw_memcpy(pattrib->src, myid(&(padapter->eeprompriv)), ETH_ALEN); + + _rtw_memcpy(pattrib->ra, get_bssid(pmlmepriv), ETH_ALEN); + _rtw_memcpy(pattrib->ta, pattrib->src, ETH_ALEN); + + update_tdls_attrib(padapter, pattrib); + pattrib->qsel=pattrib->priority; + if (rtw_xmit_tdls_coalesce(padapter, pmgntframe, TDLS_DISCOVERY_REQUEST) != _SUCCESS) { + rtw_free_xmitbuf(pxmitpriv, pmgntframe->pxmitbuf); + rtw_free_xmitframe(pxmitpriv, pmgntframe); + goto exit; + } + rtw_dump_xframe(padapter, pmgntframe); + DBG_871X("issue tdls dis req\n"); + +exit: + + return; +} + +void issue_tdls_setup_rsp(_adapter *padapter, union recv_frame *precv_frame) +{ + struct xmit_frame *pmgntframe; + struct pkt_attrib *pattrib; + struct xmit_priv *pxmitpriv = &(padapter->xmitpriv); + struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); + struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); + struct rx_pkt_attrib *rx_pkt_pattrib = &precv_frame->u.hdr.attrib; + _irqL irqL; + + if ((pmgntframe = alloc_mgtxmitframe(pxmitpriv)) == NULL) + { + return; + } + + //update attribute + pattrib = &pmgntframe->attrib; + + pmgntframe->frame_tag = DATA_FRAMETAG; + pattrib->ether_type = 0x890d; + pattrib->pctrl =0; + + _rtw_memcpy(pattrib->dst, rx_pkt_pattrib->src, ETH_ALEN); + _rtw_memcpy(pattrib->src, myid(&(padapter->eeprompriv)), ETH_ALEN); + + _rtw_memcpy(pattrib->ra, rx_pkt_pattrib->bssid, ETH_ALEN); + _rtw_memcpy(pattrib->ta, pattrib->src, ETH_ALEN); + + update_tdls_attrib(padapter, pattrib); + pattrib->qsel=pattrib->priority; + if (rtw_xmit_tdls_coalesce(padapter, pmgntframe, TDLS_SETUP_RESPONSE) != _SUCCESS) { + rtw_free_xmitbuf(pxmitpriv, pmgntframe->pxmitbuf); + rtw_free_xmitframe(pxmitpriv, pmgntframe); + goto exit; + } + rtw_dump_xframe(padapter, pmgntframe); + +exit: + + return; + +} + +void issue_tdls_setup_cfm(_adapter *padapter, union recv_frame *precv_frame) +{ + struct tdls_info *ptdlsinfo = &padapter->tdlsinfo; + struct xmit_frame *pmgntframe; + struct pkt_attrib *pattrib; + struct xmit_priv *pxmitpriv = &(padapter->xmitpriv); + struct sta_info *ptdls_sta=NULL; + _irqL irqL; + + struct rx_pkt_attrib *rx_pkt_pattrib = & precv_frame->u.hdr.attrib; + + if ((pmgntframe = alloc_mgtxmitframe(pxmitpriv)) == NULL) + { + return; + } + + //update attribute + pattrib = &pmgntframe->attrib; + + pmgntframe->frame_tag = DATA_FRAMETAG; + pattrib->ether_type = 0x890d; + pattrib->pctrl =0; + + _rtw_memcpy(pattrib->dst, rx_pkt_pattrib->src, ETH_ALEN); + _rtw_memcpy(pattrib->src, myid(&(padapter->eeprompriv)), ETH_ALEN); + + _rtw_memcpy(pattrib->ra, rx_pkt_pattrib->bssid, ETH_ALEN); + _rtw_memcpy(pattrib->ta, pattrib->src, ETH_ALEN); + + update_tdls_attrib(padapter, pattrib); + pattrib->qsel=pattrib->priority; + if (rtw_xmit_tdls_coalesce(padapter, pmgntframe, TDLS_SETUP_CONFIRM) != _SUCCESS) { + rtw_free_xmitbuf(pxmitpriv, pmgntframe->pxmitbuf); + rtw_free_xmitframe(pxmitpriv, pmgntframe); + goto exit; + } + + rtw_dump_xframe(padapter, pmgntframe); + +exit: + + return; + +} + +//TDLS Discovery Response frame is a management action frame +void issue_tdls_dis_rsp(_adapter *padapter, union recv_frame *precv_frame, u8 dialog) +{ + struct xmit_frame *pmgntframe; + struct pkt_attrib *pattrib; + unsigned char *pframe; + struct rtw_ieee80211_hdr *pwlanhdr; + unsigned short *fctrl; + struct xmit_priv *pxmitpriv = &(padapter->xmitpriv); + struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); + + struct rx_pkt_attrib *rx_pkt_pattrib = &precv_frame->u.hdr.attrib; + + if ((pmgntframe = alloc_mgtxmitframe(pxmitpriv)) == NULL) + { + return; + } + + //update attribute + pattrib = &pmgntframe->attrib; + update_mgntframe_attrib(padapter, pattrib); + + _rtw_memset(pmgntframe->buf_addr, 0, WLANHDR_OFFSET + TXDESC_OFFSET); + + pframe = (u8 *)(pmgntframe->buf_addr) + TXDESC_OFFSET; + pwlanhdr = (struct rtw_ieee80211_hdr *)pframe; + + fctrl = &(pwlanhdr->frame_ctl); + *(fctrl) = 0; + + // unicast probe request frame + _rtw_memcpy(pwlanhdr->addr1, rx_pkt_pattrib->src, ETH_ALEN); + _rtw_memcpy(pattrib->dst, pwlanhdr->addr1, ETH_ALEN); + + _rtw_memcpy(pwlanhdr->addr2, myid(&(padapter->eeprompriv)), ETH_ALEN); + _rtw_memcpy(pattrib->src, pwlanhdr->addr2, ETH_ALEN); + + _rtw_memcpy(pwlanhdr->addr3, rx_pkt_pattrib->bssid, ETH_ALEN); + _rtw_memcpy(pattrib->ra, pwlanhdr->addr3, ETH_ALEN); + + SetSeqNum(pwlanhdr, pmlmeext->mgnt_seq); + pmlmeext->mgnt_seq++; + SetFrameSubType(pframe, WIFI_ACTION); + + pframe += sizeof (struct rtw_ieee80211_hdr_3addr); + pattrib->pktlen = sizeof (struct rtw_ieee80211_hdr_3addr); + + rtw_build_tdls_dis_rsp_ies(padapter, pmgntframe, pframe, dialog); + + pattrib->nr_frags = 1; + pattrib->last_txcmdsz = pattrib->pktlen; + + dump_mgntframe(padapter, pmgntframe); + + return; +} + +void issue_tdls_peer_traffic_indication(_adapter *padapter, struct sta_info *ptdls_sta) +{ + struct xmit_frame *pmgntframe; + struct pkt_attrib *pattrib; + struct mlme_priv *pmlmepriv = &padapter->mlmepriv; + struct xmit_priv *pxmitpriv = &(padapter->xmitpriv); + + static u8 dialogtoken=0; + + if ((pmgntframe = alloc_mgtxmitframe(pxmitpriv)) == NULL) + { + return; + } + + //update attribute + pattrib = &pmgntframe->attrib; + + pmgntframe->frame_tag = DATA_FRAMETAG; + pattrib->ether_type = 0x890d; + pattrib->pctrl =0; + + _rtw_memcpy(pattrib->dst, ptdls_sta->hwaddr, ETH_ALEN); + _rtw_memcpy(pattrib->src, myid(&(padapter->eeprompriv)), ETH_ALEN); + + _rtw_memcpy(pattrib->ra, get_bssid(pmlmepriv), ETH_ALEN); + _rtw_memcpy(pattrib->ta, pattrib->src, ETH_ALEN); + + //for tdls; pattrib->nr_frags is used to fill dialogtoken + ptdls_sta->dialog = dialogtoken; + dialogtoken = (dialogtoken+1)%256; + //PTI frame's priority should be AC_VO + pattrib->priority = 7; + + update_tdls_attrib(padapter, pattrib); + pattrib->qsel=pattrib->priority; + if (rtw_xmit_tdls_coalesce(padapter, pmgntframe, TDLS_PEER_TRAFFIC_INDICATION) != _SUCCESS) { + rtw_free_xmitbuf(pxmitpriv, pmgntframe->pxmitbuf); + rtw_free_xmitframe(pxmitpriv, pmgntframe); + goto exit; + } + rtw_dump_xframe(padapter, pmgntframe); + +exit: + + return; +} + +void issue_tdls_ch_switch_req(_adapter *padapter, u8 *mac_addr) +{ + struct xmit_frame *pmgntframe; + struct pkt_attrib *pattrib; + struct mlme_priv *pmlmepriv = &padapter->mlmepriv; + struct xmit_priv *pxmitpriv = &(padapter->xmitpriv); + + if ((pmgntframe = alloc_mgtxmitframe(pxmitpriv)) == NULL) + { + return; + } + + //update attribute + pattrib = &pmgntframe->attrib; + + pmgntframe->frame_tag = DATA_FRAMETAG; + pattrib->ether_type = 0x890d; + pattrib->pctrl =0; + + _rtw_memcpy(pattrib->dst, mac_addr, ETH_ALEN); + _rtw_memcpy(pattrib->src, myid(&(padapter->eeprompriv)), ETH_ALEN); + + _rtw_memcpy(pattrib->ra, get_bssid(pmlmepriv), ETH_ALEN); + _rtw_memcpy(pattrib->ta, pattrib->src, ETH_ALEN); + + update_tdls_attrib(padapter, pattrib); + + pattrib->qsel=pattrib->priority; + if(rtw_xmit_tdls_coalesce(padapter, pmgntframe, TDLS_CHANNEL_SWITCH_REQUEST) !=_SUCCESS ){ + rtw_free_xmitbuf(pxmitpriv,pmgntframe->pxmitbuf); + rtw_free_xmitframe(pxmitpriv, pmgntframe); + goto exit; + } + rtw_dump_xframe(padapter, pmgntframe); + +exit: + + return; +} + +void issue_tdls_ch_switch_rsp(_adapter *padapter, u8 *mac_addr) +{ + struct xmit_frame *pmgntframe; + struct pkt_attrib *pattrib; + struct mlme_priv *pmlmepriv = &padapter->mlmepriv; + struct xmit_priv *pxmitpriv = &(padapter->xmitpriv); + + _irqL irqL; + + if ((pmgntframe = alloc_mgtxmitframe(pxmitpriv)) == NULL) + { + return; + } + + //update attribute + pattrib = &pmgntframe->attrib; + + pmgntframe->frame_tag = DATA_FRAMETAG; + pattrib->ether_type = 0x890d; + pattrib->pctrl =0; + + _rtw_memcpy(pattrib->dst, mac_addr, ETH_ALEN); + _rtw_memcpy(pattrib->src, myid(&(padapter->eeprompriv)), ETH_ALEN); + + _rtw_memcpy(pattrib->ra, get_bssid(pmlmepriv), ETH_ALEN); + _rtw_memcpy(pattrib->ta, pattrib->src, ETH_ALEN); + + update_tdls_attrib(padapter, pattrib); + + pattrib->qsel=pattrib->priority; +/* + _enter_critical_bh(&pxmitpriv->lock, &irqL); + if(xmitframe_enqueue_for_tdls_sleeping_sta(padapter, pmgntframe)==_TRUE){ + _exit_critical_bh(&pxmitpriv->lock, &irqL); + return _FALSE; + } +*/ + if(rtw_xmit_tdls_coalesce(padapter, pmgntframe, TDLS_CHANNEL_SWITCH_RESPONSE) !=_SUCCESS ){ + rtw_free_xmitbuf(pxmitpriv,pmgntframe->pxmitbuf); + rtw_free_xmitframe(pxmitpriv, pmgntframe); + goto exit; + } + rtw_dump_xframe(padapter, pmgntframe); + +exit: + + return; +} + +sint On_TDLS_Dis_Rsp(_adapter *adapter, union recv_frame *precv_frame) +{ + struct sta_info *ptdls_sta = NULL, *psta = rtw_get_stainfo(&(adapter->stapriv), get_bssid(&(adapter->mlmepriv))); + struct recv_priv *precvpriv = &(adapter->recvpriv); + u8 *ptr = precv_frame->u.hdr.rx_data, *psa; + struct rx_pkt_attrib *pattrib = &(precv_frame->u.hdr.attrib); + struct tdls_info *ptdlsinfo = &(adapter->tdlsinfo); + u8 empty_addr[ETH_ALEN] = { 0x00 }; + int UndecoratedSmoothedPWDB; + + + //WFDTDLS: for sigma test, not to setup direct link automatically + ptdlsinfo->dev_discovered = 1; + +#ifdef CONFIG_TDLS_AUTOSETUP + psa = get_sa(ptr); + ptdls_sta = rtw_get_stainfo(&(adapter->stapriv), psa); + + if(ptdls_sta != NULL) + { + ptdls_sta->tdls_sta_state |= TDLS_ALIVE_STATE; + + //Record the tdls sta with lowest signal strength + if( (ptdlsinfo->sta_maximum == _TRUE) && (ptdls_sta->alive_count >= 1) ) + { + if( _rtw_memcmp(ptdlsinfo->ss_record.macaddr, empty_addr, ETH_ALEN) ) + { + _rtw_memcpy(ptdlsinfo->ss_record.macaddr, psa, ETH_ALEN); + ptdlsinfo->ss_record.RxPWDBAll = pattrib->RxPWDBAll; + } + else + { + if( ptdlsinfo->ss_record.RxPWDBAll < pattrib->RxPWDBAll ) + { + _rtw_memcpy(ptdlsinfo->ss_record.macaddr, psa, ETH_ALEN); + ptdlsinfo->ss_record.RxPWDBAll = pattrib->RxPWDBAll; + } + } + } + + } + else + { + if( ptdlsinfo->sta_maximum == _TRUE) + { + if( _rtw_memcmp( ptdlsinfo->ss_record.macaddr, empty_addr, ETH_ALEN ) ) + { + //All traffics are busy, do not set up another direct link. + return _FAIL; + } + else + { + if( pattrib->RxPWDBAll > ptdlsinfo->ss_record.RxPWDBAll ) + { + issue_tdls_teardown(adapter, ptdlsinfo->ss_record.macaddr); + } + else + { + return _FAIL; + } + } + } + + adapter->HalFunc.GetHalDefVarHandler(adapter, HAL_DEF_UNDERCORATEDSMOOTHEDPWDB, &UndecoratedSmoothedPWDB); + + if( pattrib->RxPWDBAll + TDLS_SIGNAL_THRESH >= UndecoratedSmoothedPWDB); + { + DBG_871X("pattrib->RxPWDBAll=%d, pdmpriv->UndecoratedSmoothedPWDB=%d\n", pattrib->RxPWDBAll, UndecoratedSmoothedPWDB); + issue_tdls_setup_req(adapter, psa); + } + } +#endif //CONFIG_TDLS_AUTOSETUP + + return _SUCCESS; +} + +sint On_TDLS_Setup_Req(_adapter *adapter, union recv_frame *precv_frame) +{ + struct tdls_info *ptdlsinfo = &adapter->tdlsinfo; + u8 *psa, *pmyid; + struct sta_info *ptdls_sta= NULL; + struct sta_priv *pstapriv = &adapter->stapriv; + u8 *ptr = precv_frame->u.hdr.rx_data; + struct mlme_priv *pmlmepriv = &(adapter->mlmepriv); + struct security_priv *psecuritypriv = &adapter->securitypriv; + _irqL irqL; + struct rx_pkt_attrib *prx_pkt_attrib = &precv_frame->u.hdr.attrib; + u8 *prsnie, *ppairwise_cipher; + u8 i, k, pairwise_count; + u8 ccmp_have=0, rsnie_have=0; + u16 j; + u8 SNonce[32]; + u32 *timeout_interval; + sint parsing_length; //frame body length, without icv_len + PNDIS_802_11_VARIABLE_IEs pIE; + u8 FIXED_IE = 5; + unsigned char supportRate[16]; + int supportRateNum = 0; + + psa = get_sa(ptr); + ptdls_sta = rtw_get_stainfo(pstapriv, psa); + + pmyid=myid(&(adapter->eeprompriv)); + ptr +=prx_pkt_attrib->hdrlen + prx_pkt_attrib->iv_len+LLC_HEADER_SIZE+TYPE_LENGTH_FIELD_SIZE+1; + parsing_length= ((union recv_frame *)precv_frame)->u.hdr.len + -prx_pkt_attrib->hdrlen + -prx_pkt_attrib->iv_len + -prx_pkt_attrib->icv_len + -LLC_HEADER_SIZE + -ETH_TYPE_LEN + -PAYLOAD_TYPE_LEN + -FIXED_IE; + + if(ptdlsinfo->ap_prohibited == _TRUE) + { + goto exit; + } + + if(ptdls_sta==NULL){ + ptdls_sta = rtw_alloc_stainfo(pstapriv, psa); + }else{ + if(ptdls_sta->tdls_sta_state & TDLS_LINKED_STATE){ + //If the direct link is already set up + //Process as re-setup after tear down + DBG_871X("re-setup a direct link\n"); + } + //already receiving TDLS setup request + else if(ptdls_sta->tdls_sta_state & TDLS_INITIATOR_STATE){ + DBG_871X("receive duplicated TDLS setup request frame in handshaking\n"); + goto exit; + } + //When receiving and sending setup_req to the same link at the same time, STA with higher MAC_addr would be initiator + //following is to check out MAC_addr + else if(ptdls_sta->tdls_sta_state & TDLS_RESPONDER_STATE){ + DBG_871X("receive setup_req after sending setup_req\n"); + for (i=0;i<6;i++){ + if(*(pmyid+i)==*(psa+i)){ + } + else if(*(pmyid+i)>*(psa+i)){ + goto exit; + }else if(*(pmyid+i)<*(psa+i)){ + ptdls_sta->tdls_sta_state=TDLS_INITIATOR_STATE; + break; + } + } + } + } + + if(ptdls_sta) + { + ptdls_sta->dialog = *(ptr+2); //copy dialog token + ptdls_sta->stat_code = 0; + + //parsing information element + for(j=FIXED_IE; jElementID) + { + case _SUPPORTEDRATES_IE_: + _rtw_memcpy(supportRate, pIE->data, pIE->Length); + supportRateNum = pIE->Length; + break; + case _COUNTRY_IE_: + break; + case _EXT_SUPPORTEDRATES_IE_: + if(supportRateNum<=sizeof(supportRate)) + { + _rtw_memcpy(supportRate+supportRateNum, pIE->data, pIE->Length); + supportRateNum += pIE->Length; + } + break; + case _SUPPORTED_CH_IE_: + break; + case _RSN_IE_2_: + rsnie_have=1; + if(prx_pkt_attrib->encrypt){ + prsnie=(u8*)pIE; + //check whether initiator STA has CCMP pairwise_cipher. + ppairwise_cipher=prsnie+10; + _rtw_memcpy(&pairwise_count, (u16*)(ppairwise_cipher-2), 1); + for(k=0;kstat_code=72; + } + } + break; + case _EXT_CAP_IE_: + break; + case _VENDOR_SPECIFIC_IE_: + break; + case _FTIE_: + if(prx_pkt_attrib->encrypt) + _rtw_memcpy(SNonce, (ptr+j+52), 32); + break; + case _TIMEOUT_ITVL_IE_: + if(prx_pkt_attrib->encrypt) + timeout_interval = (u32 *)(ptr+j+3); + break; + case _RIC_Descriptor_IE_: + break; + case _HT_CAPABILITY_IE_: + rtw_tdls_process_ht_cap(adapter, ptdls_sta, pIE->data, pIE->Length); + break; + case EID_BSSCoexistence: + break; + case _LINK_ID_IE_: + if(_rtw_memcmp(get_bssid(pmlmepriv), pIE->data, 6) == _FALSE) + { + //not in the same BSS + ptdls_sta->stat_code=7; + } + break; + default: + break; + } + + j += (pIE->Length + 2); + + } + + //update station supportRate + ptdls_sta->bssratelen = supportRateNum; + _rtw_memcpy(ptdls_sta->bssrateset, supportRate, supportRateNum); + + //check status code + //if responder STA has/hasn't security on AP, but request hasn't/has RSNIE, it should reject + if(ptdls_sta->stat_code == 0 ) + { + if(rsnie_have && (prx_pkt_attrib->encrypt==0)){ + //security disabled + ptdls_sta->stat_code = 5; + }else if(rsnie_have==0 && (prx_pkt_attrib->encrypt)){ + //request haven't RSNIE + ptdls_sta->stat_code = 38; + } + +#ifdef CONFIG_WFD + //WFD test plan version 0.18.2 test item 5.1.5 + //SoUT does not use TDLS if AP uses weak security + if ( adapter->wdinfo.wfd_tdls_enable ) + { + if(rsnie_have && (prx_pkt_attrib->encrypt != _AES_)) + { + ptdls_sta->stat_code = 5; + } + } +#endif //CONFIG_WFD + } + + ptdls_sta->tdls_sta_state|= TDLS_INITIATOR_STATE; + if(prx_pkt_attrib->encrypt){ + _rtw_memcpy(ptdls_sta->SNonce, SNonce, 32); + _rtw_memcpy(&(ptdls_sta->TDLS_PeerKey_Lifetime), timeout_interval, 4); + } + _enter_critical_bh(&(pstapriv->sta_hash_lock), &irqL); + if(!(ptdls_sta->tdls_sta_state & TDLS_LINKED_STATE)) + ptdlsinfo->sta_cnt++; + _exit_critical_bh(&(pstapriv->sta_hash_lock), &irqL); + if( ptdlsinfo->sta_cnt == (NUM_STA - 2) ) // -2: AP + BC/MC sta + { + ptdlsinfo->sta_maximum = _TRUE; + } + +#ifdef CONFIG_WFD + rtw_tdls_process_wfd_ie(ptdlsinfo, ptr + FIXED_IE, parsing_length - FIXED_IE); +#endif // CONFIG_WFD + + } + else + { + goto exit; + } + + issue_tdls_setup_rsp(adapter, precv_frame); + + if(ptdls_sta->stat_code==0) + { + _set_timer( &ptdls_sta->handshake_timer, TDLS_HANDSHAKE_TIME); + } + else //status code!=0 ; setup unsuccess + { + free_tdls_sta(adapter, ptdls_sta); + } + +exit: + + return _FAIL; +} + +sint On_TDLS_Setup_Rsp(_adapter *adapter, union recv_frame *precv_frame) +{ + struct tdls_info *ptdlsinfo = &adapter->tdlsinfo; + struct sta_info *ptdls_sta= NULL; + struct sta_priv *pstapriv = &adapter->stapriv; + u8 *ptr = precv_frame->u.hdr.rx_data; + _irqL irqL; + struct rx_pkt_attrib *prx_pkt_attrib = &precv_frame->u.hdr.attrib; + u8 *psa; + u16 stat_code; + sint parsing_length; //frame body length, without icv_len + PNDIS_802_11_VARIABLE_IEs pIE; + u8 FIXED_IE =7; + u8 *pftie, *ptimeout_ie, *plinkid_ie, *prsnie, *pftie_mic, *ppairwise_cipher; + u16 pairwise_count, j, k; + u8 verify_ccmp=0; + unsigned char supportRate[16]; + int supportRateNum = 0; + + psa = get_sa(ptr); + ptdls_sta = rtw_get_stainfo(pstapriv, psa); + + if ( NULL == ptdls_sta ) + { + return _FAIL; + } + + ptr +=prx_pkt_attrib->hdrlen + prx_pkt_attrib->iv_len+LLC_HEADER_SIZE+TYPE_LENGTH_FIELD_SIZE+1; + parsing_length= ((union recv_frame *)precv_frame)->u.hdr.len + -prx_pkt_attrib->hdrlen + -prx_pkt_attrib->iv_len + -prx_pkt_attrib->icv_len + -LLC_HEADER_SIZE + -TYPE_LENGTH_FIELD_SIZE + -1 + -FIXED_IE; + + _rtw_memcpy(&stat_code, ptr+2, 2); + + if(stat_code!=0) + { + DBG_871X( "[%s] status_code = %d, free_tdls_sta\n", __FUNCTION__, stat_code ); + free_tdls_sta(adapter, ptdls_sta); + return _FAIL; + } + + stat_code = 0; + + //parsing information element + for(j=FIXED_IE; jElementID) + { + case _SUPPORTEDRATES_IE_: + _rtw_memcpy(supportRate, pIE->data, pIE->Length); + supportRateNum = pIE->Length; + break; + case _COUNTRY_IE_: + break; + case _EXT_SUPPORTEDRATES_IE_: + if(supportRateNum<=sizeof(supportRate)) + { + _rtw_memcpy(supportRate+supportRateNum, pIE->data, pIE->Length); + supportRateNum += pIE->Length; + } + break; + case _SUPPORTED_CH_IE_: + break; + case _RSN_IE_2_: + prsnie=(u8*)pIE; + //check whether responder STA has CCMP pairwise_cipher. + ppairwise_cipher=prsnie+10; + _rtw_memcpy(&pairwise_count, (u16*)(ppairwise_cipher-2), 2); + for(k=0;kANonce, (ptr+j+20), 32); + break; + case _TIMEOUT_ITVL_IE_: + ptimeout_ie=(u8*)pIE; + break; + case _RIC_Descriptor_IE_: + break; + case _HT_CAPABILITY_IE_: + rtw_tdls_process_ht_cap(adapter, ptdls_sta, pIE->data, pIE->Length); + break; + case EID_BSSCoexistence: + break; + case _LINK_ID_IE_: + plinkid_ie=(u8*)pIE; + break; + default: + break; + } + + j += (pIE->Length + 2); + + } + + //update station supportRate + ptdls_sta->bssratelen = supportRateNum; + _rtw_memcpy(ptdls_sta->bssrateset, supportRate, supportRateNum); + +#ifdef CONFIG_WFD + rtw_tdls_process_wfd_ie(ptdlsinfo, ptr + FIXED_IE, parsing_length - FIXED_IE); +#endif // CONFIG_WFD + + if(stat_code != 0) + { + ptdls_sta->stat_code = stat_code; + } + else + { + if(prx_pkt_attrib->encrypt) + { + if(verify_ccmp==1) + { + wpa_tdls_generate_tpk(adapter, ptdls_sta); + ptdls_sta->stat_code=0; + if(tdls_verify_mic(ptdls_sta->tpk.kck, 2, plinkid_ie, prsnie, ptimeout_ie, pftie)==0) //0: Invalid, 1: valid + { + free_tdls_sta(adapter, ptdls_sta); + return _FAIL; + } + } + else + { + ptdls_sta->stat_code=72; //invalide contents of RSNIE + } + + }else{ + ptdls_sta->stat_code=0; + } + } + + DBG_871X("issue_tdls_setup_cfm\n"); + issue_tdls_setup_cfm(adapter, precv_frame); + + if(ptdls_sta->stat_code==0) + { + ptdlsinfo->setup_state = TDLS_LINKED_STATE; + + if( ptdls_sta->tdls_sta_state & TDLS_RESPONDER_STATE ) + { + ptdls_sta->tdls_sta_state |= TDLS_LINKED_STATE; + _cancel_timer_ex( &ptdls_sta->handshake_timer); +#ifdef CONFIG_TDLS_AUTOCHECKALIVE + _set_timer( &ptdls_sta->alive_timer1, TDLS_ALIVE_TIMER_PH1); +#endif //CONFIG_TDLS_AUTOSETUP + } + + rtw_tdls_set_mac_id(ptdlsinfo, ptdls_sta); + rtw_tdls_set_key(adapter, prx_pkt_attrib, ptdls_sta); + + rtw_tdls_cmd(adapter, ptdls_sta->hwaddr, TDLS_WRCR); + + } + else //status code!=0 ; setup unsuccessful + { + free_tdls_sta(adapter, ptdls_sta); + } + + return _FAIL; + +} + +sint On_TDLS_Setup_Cfm(_adapter *adapter, union recv_frame *precv_frame) +{ + struct tdls_info *ptdlsinfo = &adapter->tdlsinfo; + struct sta_info *ptdls_sta= NULL; + struct sta_priv *pstapriv = &adapter->stapriv; + u8 *ptr = precv_frame->u.hdr.rx_data; + _irqL irqL; + struct rx_pkt_attrib *prx_pkt_attrib = &precv_frame->u.hdr.attrib; + u8 *psa; + u16 stat_code; + sint parsing_length; + PNDIS_802_11_VARIABLE_IEs pIE; + u8 FIXED_IE =5; + u8 *pftie, *ptimeout_ie, *plinkid_ie, *prsnie, *pftie_mic, *ppairwise_cipher; + u16 j, pairwise_count; + + psa = get_sa(ptr); + ptdls_sta = rtw_get_stainfo(pstapriv, psa); + + ptr +=prx_pkt_attrib->hdrlen + prx_pkt_attrib->iv_len+LLC_HEADER_SIZE+TYPE_LENGTH_FIELD_SIZE+1; + parsing_length= ((union recv_frame *)precv_frame)->u.hdr.len + -prx_pkt_attrib->hdrlen + -prx_pkt_attrib->iv_len + -prx_pkt_attrib->icv_len + -LLC_HEADER_SIZE + -ETH_TYPE_LEN + -PAYLOAD_TYPE_LEN + -FIXED_IE; + _rtw_memcpy(&stat_code, ptr+2, 2); + + if(stat_code!=0){ + DBG_871X( "[%s] stat_code = %d\n, free_tdls_sta", __FUNCTION__, stat_code ); + free_tdls_sta(adapter, ptdls_sta); + return _FAIL; + } + + if(prx_pkt_attrib->encrypt){ + //parsing information element + for(j=FIXED_IE; jElementID) + { + case _RSN_IE_2_: + prsnie=(u8*)pIE; + break; + case _VENDOR_SPECIFIC_IE_: + break; + case _FTIE_: + pftie=(u8*)pIE; + break; + case _TIMEOUT_ITVL_IE_: + ptimeout_ie=(u8*)pIE; + break; + case _HT_EXTRA_INFO_IE_: + break; + case _LINK_ID_IE_: + plinkid_ie=(u8*)pIE; + break; + default: + break; + } + + j += (pIE->Length + 2); + + } + + //verify mic in FTIE MIC field + if(tdls_verify_mic(ptdls_sta->tpk.kck, 3, plinkid_ie, prsnie, ptimeout_ie, pftie)==0){ //0: Invalid, 1: Valid + free_tdls_sta(adapter, ptdls_sta); + return _FAIL; + } + + } + + ptdlsinfo->setup_state = TDLS_LINKED_STATE; + if( ptdls_sta->tdls_sta_state & TDLS_INITIATOR_STATE ) + { + ptdls_sta->tdls_sta_state|=TDLS_LINKED_STATE; + _cancel_timer_ex( &ptdls_sta->handshake_timer); +#ifdef CONFIG_TDLS_AUTOCHECKALIVE + _set_timer( &ptdls_sta->alive_timer1, TDLS_ALIVE_TIMER_PH1); +#endif //CONFIG_TDLS_AUTOCHECKALIVE + } + + rtw_tdls_set_mac_id(ptdlsinfo, ptdls_sta); + rtw_tdls_set_key(adapter, prx_pkt_attrib, ptdls_sta); + + rtw_tdls_cmd(adapter, ptdls_sta->hwaddr, TDLS_WRCR); + + return _FAIL; + +} + +sint On_TDLS_Dis_Req(_adapter *adapter, union recv_frame *precv_frame) +{ + struct rx_pkt_attrib *prx_pkt_attrib = &precv_frame->u.hdr.attrib; + struct sta_priv *pstapriv = &adapter->stapriv; + struct sta_info *psta_ap; + u8 *ptr = precv_frame->u.hdr.rx_data; + sint parsing_length; //frame body length, without icv_len + PNDIS_802_11_VARIABLE_IEs pIE; + u8 FIXED_IE = 3, *dst, *pdialog = NULL; + u16 j; + + ptr +=prx_pkt_attrib->hdrlen + prx_pkt_attrib->iv_len + LLC_HEADER_SIZE+TYPE_LENGTH_FIELD_SIZE + 1; + pdialog=ptr+2; + + parsing_length= ((union recv_frame *)precv_frame)->u.hdr.len + -prx_pkt_attrib->hdrlen + -prx_pkt_attrib->iv_len + -prx_pkt_attrib->icv_len + -LLC_HEADER_SIZE + -TYPE_LENGTH_FIELD_SIZE + -1 + -FIXED_IE; + + //parsing information element + for(j=FIXED_IE; jElementID) + { + case _LINK_ID_IE_: + psta_ap = rtw_get_stainfo(pstapriv, pIE->data); + if(psta_ap == NULL) + { + goto exit; + } + dst = pIE->data + 12; + if( (MacAddr_isBcst(dst) == _FALSE) && (_rtw_memcmp(myid(&(adapter->eeprompriv)), dst, 6) == _FALSE) ) + { + goto exit; + } + break; + default: + break; + } + + j += (pIE->Length + 2); + + } + + //check frame contents + + issue_tdls_dis_rsp(adapter, precv_frame, *(pdialog) ); + +exit: + + return _FAIL; + +} + +sint On_TDLS_Teardown(_adapter *adapter, union recv_frame *precv_frame) +{ + u8 *psa; + u8 *ptr = precv_frame->u.hdr.rx_data; + struct rx_pkt_attrib *prx_pkt_attrib = &precv_frame->u.hdr.attrib; + struct mlme_ext_priv *pmlmeext = &(adapter->mlmeextpriv); + struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); + struct sta_priv *pstapriv = &adapter->stapriv; + struct sta_info *ptdls_sta= NULL; + _irqL irqL; + + psa = get_sa(ptr); + + ptdls_sta = rtw_get_stainfo(pstapriv, psa); + if(ptdls_sta!=NULL){ + if(ptdls_sta->tdls_sta_state & TDLS_CH_SWITCH_ON_STATE){ + rtw_tdls_cmd(adapter, ptdls_sta->hwaddr, TDLS_CS_OFF); + } + free_tdls_sta(adapter, ptdls_sta); + } + + return _FAIL; + +} + +u8 TDLS_check_ch_state(uint state){ + if( (state & TDLS_CH_SWITCH_ON_STATE) && + (state & TDLS_AT_OFF_CH_STATE) && + (state & TDLS_PEER_AT_OFF_STATE) ){ + + if(state & TDLS_PEER_SLEEP_STATE) + return 2; //U-APSD + ch. switch + else + return 1; //ch. switch + }else + return 0; +} + +//we process buffered data for 1. U-APSD, 2. ch. switch, 3. U-APSD + ch. switch here +sint On_TDLS_Peer_Traffic_Rsp(_adapter *adapter, union recv_frame *precv_frame) +{ + struct tdls_info *ptdlsinfo = &adapter->tdlsinfo; + struct mlme_ext_priv *pmlmeext = &adapter->mlmeextpriv; + struct rx_pkt_attrib *pattrib = & precv_frame->u.hdr.attrib; + struct sta_priv *pstapriv = &adapter->stapriv; + //get peer sta infomation + struct sta_info *ptdls_sta = rtw_get_stainfo(pstapriv, pattrib->src); + u8 wmmps_ac=0, state=TDLS_check_ch_state(ptdls_sta->tdls_sta_state); + int i; + + ptdls_sta->sta_stats.rx_data_pkts++; + + //receive peer traffic response frame, sleeping STA wakes up + //ptdls_sta->tdls_sta_state &= ~(TDLS_PEER_SLEEP_STATE); + process_wmmps_data( adapter, precv_frame); + + // if noticed peer STA wakes up by receiving peer traffic response + // and we want to do channel swtiching, then we will transmit channel switch request first + if(ptdls_sta->tdls_sta_state & TDLS_APSD_CHSW_STATE){ + issue_tdls_ch_switch_req(adapter, pattrib->src); + ptdls_sta->tdls_sta_state &= ~(TDLS_APSD_CHSW_STATE); + return _FAIL; + } + + //check 4-AC queue bit + if(ptdls_sta->uapsd_vo || ptdls_sta->uapsd_vi || ptdls_sta->uapsd_be || ptdls_sta->uapsd_bk) + wmmps_ac=1; + + //if it's a direct link and have buffered frame + if(ptdls_sta->tdls_sta_state & TDLS_LINKED_STATE){ + if(wmmps_ac && state) + { + _irqL irqL; + _list *xmitframe_plist, *xmitframe_phead; + struct xmit_frame *pxmitframe=NULL; + + _enter_critical_bh(&ptdls_sta->sleep_q.lock, &irqL); + + xmitframe_phead = get_list_head(&ptdls_sta->sleep_q); + xmitframe_plist = get_next(xmitframe_phead); + + //transmit buffered frames + while ((rtw_end_of_queue_search(xmitframe_phead, xmitframe_plist)) == _FALSE) + { + pxmitframe = LIST_CONTAINOR(xmitframe_plist, struct xmit_frame, list); + xmitframe_plist = get_next(xmitframe_plist); + rtw_list_delete(&pxmitframe->list); + + ptdls_sta->sleepq_len--; + if(ptdls_sta->sleepq_len>0){ + pxmitframe->attrib.mdata = 1; + pxmitframe->attrib.eosp = 0; + }else{ + pxmitframe->attrib.mdata = 0; + pxmitframe->attrib.eosp = 1; + } + //pxmitframe->attrib.triggered = 1; //maybe doesn't need in TDLS + if(adapter->HalFunc.hal_xmit(adapter, pxmitframe) == _TRUE) + { + rtw_os_xmit_complete(adapter, pxmitframe); + } + + } + + if(ptdls_sta->sleepq_len==0) + { + DBG_871X("no buffered packets for tdls to xmit\n"); + //on U-APSD + CH. switch state, when there is no buffered date to xmit, + // we should go back to base channel + if(state==2){ + rtw_tdls_cmd(adapter, ptdls_sta->hwaddr, TDLS_CS_OFF); + }else if(ptdls_sta->tdls_sta_state&TDLS_SW_OFF_STATE){ + ptdls_sta->tdls_sta_state &= ~(TDLS_SW_OFF_STATE); + ptdlsinfo->candidate_ch= pmlmeext->cur_channel; + issue_tdls_ch_switch_req(adapter, pattrib->src); + DBG_871X("issue tdls ch switch req back to base channel\n"); + } + + } + else + { + DBG_871X("error!psta->sleepq_len=%d\n", ptdls_sta->sleepq_len); + ptdls_sta->sleepq_len=0; + } + + _exit_critical_bh(&ptdls_sta->sleep_q.lock, &irqL); + + } + + } + + return _FAIL; +} + +sint On_TDLS_Ch_Switch_Req(_adapter *adapter, union recv_frame *precv_frame) +{ + struct sta_info *ptdls_sta= NULL; + struct sta_priv *pstapriv = &adapter->stapriv; + u8 *ptr = precv_frame->u.hdr.rx_data; + struct rx_pkt_attrib *prx_pkt_attrib = &precv_frame->u.hdr.attrib; + u8 *psa; + sint parsing_length; + PNDIS_802_11_VARIABLE_IEs pIE; + u8 FIXED_IE =3; + u16 j; + struct mlme_ext_priv *pmlmeext = &adapter->mlmeextpriv; + + psa = get_sa(ptr); + ptdls_sta = rtw_get_stainfo(pstapriv, psa); + + ptr +=prx_pkt_attrib->hdrlen + prx_pkt_attrib->iv_len+LLC_HEADER_SIZE+TYPE_LENGTH_FIELD_SIZE+1; + parsing_length= ((union recv_frame *)precv_frame)->u.hdr.len + -prx_pkt_attrib->hdrlen + -prx_pkt_attrib->iv_len + -prx_pkt_attrib->icv_len + -LLC_HEADER_SIZE + -ETH_TYPE_LEN + -PAYLOAD_TYPE_LEN + -FIXED_IE; + + ptdls_sta->off_ch = *(ptr+2); + + //parsing information element + for(j=FIXED_IE; jElementID) + { + case _COUNTRY_IE_: + break; + case _CH_SWTICH_ANNOUNCE_: + break; + case _LINK_ID_IE_: + break; + case _CH_SWITCH_TIMING_: + _rtw_memcpy(&ptdls_sta->ch_switch_time, pIE->data, 2); + _rtw_memcpy(&ptdls_sta->ch_switch_timeout, pIE->data+2, 2); + default: + break; + } + + j += (pIE->Length + 2); + + } + + //todo: check status + ptdls_sta->stat_code=0; + ptdls_sta->tdls_sta_state |= TDLS_CH_SWITCH_ON_STATE; + + issue_nulldata(adapter, NULL, 1, 0, 0); + + issue_tdls_ch_switch_rsp(adapter, psa); + + DBG_871X("issue tdls channel switch response\n"); + + if((ptdls_sta->tdls_sta_state & TDLS_CH_SWITCH_ON_STATE) && ptdls_sta->off_ch==pmlmeext->cur_channel){ + DBG_871X("back to base channel %x\n", pmlmeext->cur_channel); + ptdls_sta->option=7; + rtw_tdls_cmd(adapter, ptdls_sta->hwaddr, TDLS_BASE_CH); + }else{ + ptdls_sta->option=6; + rtw_tdls_cmd(adapter, ptdls_sta->hwaddr, TDLS_OFF_CH); + } + return _FAIL; +} + +sint On_TDLS_Ch_Switch_Rsp(_adapter *adapter, union recv_frame *precv_frame) +{ + struct sta_info *ptdls_sta= NULL; + struct sta_priv *pstapriv = &adapter->stapriv; + u8 *ptr = precv_frame->u.hdr.rx_data; + struct rx_pkt_attrib *prx_pkt_attrib = &precv_frame->u.hdr.attrib; + u8 *psa; + sint parsing_length; + PNDIS_802_11_VARIABLE_IEs pIE; + u8 FIXED_IE =4; + u16 stat_code, j, switch_time, switch_timeout; + struct mlme_ext_priv *pmlmeext = &adapter->mlmeextpriv; + + psa = get_sa(ptr); + ptdls_sta = rtw_get_stainfo(pstapriv, psa); + + //if channel switch is running and receiving Unsolicited TDLS Channel Switch Response, + //it will go back to base channel and terminate this channel switch procedure + if(ptdls_sta->tdls_sta_state & TDLS_CH_SWITCH_ON_STATE ){ + if(pmlmeext->cur_channel==ptdls_sta->off_ch){ + DBG_871X("back to base channel %x\n", pmlmeext->cur_channel); + ptdls_sta->option=7; + rtw_tdls_cmd(adapter, ptdls_sta->hwaddr, TDLS_OFF_CH); + }else{ + DBG_871X("receive unsolicited channel switch response \n"); + rtw_tdls_cmd(adapter, ptdls_sta->hwaddr, TDLS_CS_OFF); + } + return _FAIL; + } + + //avoiding duplicated or unconditional ch. switch. rsp + if((ptdls_sta->tdls_sta_state & TDLS_CH_SW_INITIATOR_STATE) != TDLS_CH_SW_INITIATOR_STATE) + return _FAIL; + + ptr +=prx_pkt_attrib->hdrlen + prx_pkt_attrib->iv_len+LLC_HEADER_SIZE+TYPE_LENGTH_FIELD_SIZE+1; + parsing_length= ((union recv_frame *)precv_frame)->u.hdr.len + -prx_pkt_attrib->hdrlen + -prx_pkt_attrib->iv_len + -prx_pkt_attrib->icv_len + -LLC_HEADER_SIZE + -ETH_TYPE_LEN + -PAYLOAD_TYPE_LEN + -FIXED_IE; + + _rtw_memcpy(&stat_code, ptr+2, 2); + + if(stat_code!=0){ + return _FAIL; + } + + //parsing information element + for(j=FIXED_IE; jElementID) + { + case _LINK_ID_IE_: + break; + case _CH_SWITCH_TIMING_: + _rtw_memcpy(&switch_time, pIE->data, 2); + if(switch_time > ptdls_sta->ch_switch_time) + _rtw_memcpy(&ptdls_sta->ch_switch_time, &switch_time, 2); + + _rtw_memcpy(&switch_timeout, pIE->data+2, 2); + if(switch_timeout > ptdls_sta->ch_switch_timeout) + _rtw_memcpy(&ptdls_sta->ch_switch_timeout, &switch_timeout, 2); + + default: + break; + } + + j += (pIE->Length + 2); + + } + + ptdls_sta->tdls_sta_state &= ~(TDLS_CH_SW_INITIATOR_STATE); + ptdls_sta->tdls_sta_state |=TDLS_CH_SWITCH_ON_STATE; + + //goto set_channel_workitem_callback() + ptdls_sta->option=6; + rtw_tdls_cmd(adapter, ptdls_sta->hwaddr, TDLS_OFF_CH); + + return _FAIL; +} + +#ifdef CONFIG_WFD +void wfd_ie_tdls(_adapter * padapter, u8 *pframe, u32 *pktlen ) +{ + struct mlme_priv *pmlmepriv = &padapter->mlmepriv; + struct wifi_display_info *pwfd_info = padapter->tdlsinfo.wfd_info; + u8 wfdie[ MAX_WFD_IE_LEN] = { 0x00 }; + u32 wfdielen = 0; + + // WFD OUI + wfdielen = 0; + wfdie[ wfdielen++ ] = 0x50; + wfdie[ wfdielen++ ] = 0x6F; + wfdie[ wfdielen++ ] = 0x9A; + wfdie[ wfdielen++ ] = 0x0A; // WFA WFD v1.0 + + // Commented by Albert 20110825 + // According to the WFD Specification, the negotiation request frame should contain 3 WFD attributes + // 1. WFD Device Information + // 2. Associated BSSID ( Optional ) + // 3. Local IP Adress ( Optional ) + + // WFD Device Information ATTR + // Type: + wfdie[ wfdielen++ ] = WFD_ATTR_DEVICE_INFO; + + // Length: + // Note: In the WFD specification, the size of length field is 2. + RTW_PUT_BE16(wfdie + wfdielen, 0x0006); + wfdielen += 2; + + // Value1: + // WFD device information + // available for WFD session + Preferred TDLS + WSD ( WFD Service Discovery ) + RTW_PUT_BE16(wfdie + wfdielen, pwfd_info->wfd_device_type | WFD_DEVINFO_SESSION_AVAIL + | WFD_DEVINFO_PC_TDLS | WFD_DEVINFO_WSD); + wfdielen += 2; + + // Value2: + // Session Management Control Port + // Default TCP port for RTSP messages is 554 + RTW_PUT_BE16(wfdie + wfdielen, pwfd_info->rtsp_ctrlport ); + wfdielen += 2; + + // Value3: + // WFD Device Maximum Throughput + // 300Mbps is the maximum throughput + RTW_PUT_BE16(wfdie + wfdielen, 300); + wfdielen += 2; + + // Associated BSSID ATTR + // Type: + wfdie[ wfdielen++ ] = WFD_ATTR_ASSOC_BSSID; + + // Length: + // Note: In the WFD specification, the size of length field is 2. + RTW_PUT_BE16(wfdie + wfdielen, 0x0006); + wfdielen += 2; + + // Value: + // Associated BSSID + if ( check_fwstate( pmlmepriv, _FW_LINKED) == _TRUE ) + { + _rtw_memcpy( wfdie + wfdielen, &pmlmepriv->assoc_bssid[ 0 ], ETH_ALEN ); + } + else + { + _rtw_memset( wfdie + wfdielen, 0x00, ETH_ALEN ); + } + + // Local IP Address ATTR + wfdie[ wfdielen++ ] = WFD_ATTR_LOCAL_IP_ADDR; + + // Length: + // Note: In the WFD specification, the size of length field is 2. + RTW_PUT_BE16(wfdie + wfdielen, 0x0005); + wfdielen += 2; + + // Version: + // 0x01: Version1;IPv4 + wfdie[ wfdielen++ ] = 0x01; + + // IPv4 Address + _rtw_memcpy( wfdie + wfdielen, pwfd_info->ip_address, 4 ); + wfdielen += 4; + + pframe = rtw_set_ie(pframe, _VENDOR_SPECIFIC_IE_, wfdielen, (unsigned char *) wfdie, pktlen); + +} +#endif //CONFIG_WFD + +void rtw_build_tdls_setup_req_ies(_adapter * padapter, struct xmit_frame * pxmitframe, u8 *pframe) +{ + struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; + struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info; + struct pkt_attrib *pattrib = &pxmitframe->attrib; + struct registry_priv *pregistrypriv = &padapter->registrypriv; + struct sta_info *ptdls_sta=rtw_get_stainfo( (&padapter->stapriv) , pattrib->dst); + + u8 payload_type = 0x02; + u8 category = RTW_WLAN_CATEGORY_TDLS; + u8 action = TDLS_SETUP_REQUEST; + u8 bssrate[NDIS_802_11_LENGTH_RATES_EX]; //Use NDIS_802_11_LENGTH_RATES_EX in order to call func.rtw_set_supported_rate + int bssrate_len = 0, i = 0 ; + u8 more_supportedrates = 0; + unsigned int ie_len; + u8 *p; + struct mlme_priv *pmlmepriv = &padapter->mlmepriv; + u8 link_id_addr[18] = {0}; + u8 iedata=0; + u8 sup_ch[ 30 * 2 ] = {0x00 }, sup_ch_idx = 0, idx_5g = 2; //For supported channel + u8 timeout_itvl[5]; //set timeout interval to maximum value + u32 time; + + //SNonce + if(pattrib->encrypt){ + for(i=0;i<8;i++){ + time=rtw_get_current_time(); + _rtw_memcpy(&ptdls_sta->SNonce[4*i], (u8 *)&time, 4); + } + } + + //payload type + pframe = rtw_set_fixed_ie(pframe, 1, &(payload_type), &(pattrib->pktlen)); + //category, action, dialog token + pframe = rtw_set_fixed_ie(pframe, 1, &(category), &(pattrib->pktlen)); + pframe = rtw_set_fixed_ie(pframe, 1, &(action), &(pattrib->pktlen)); + pframe = rtw_set_fixed_ie(pframe, 1, &(ptdls_sta->dialog), &(pattrib->pktlen)); + + //capability + _rtw_memcpy(pframe, rtw_get_capability_from_ie(pmlmeinfo->network.IEs), 2); + + if(pattrib->encrypt) + *pframe =*pframe | BIT(4); + pframe += 2; + pattrib->pktlen += 2; + + //supported rates + rtw_set_supported_rate(bssrate, WIRELESS_11BG_24N); + bssrate_len = IEEE80211_CCK_RATE_LEN + IEEE80211_NUM_OFDM_RATESLEN; + + if (bssrate_len > 8) + { + pframe = rtw_set_ie(pframe, _SUPPORTEDRATES_IE_ , 8, bssrate, &(pattrib->pktlen)); + more_supportedrates = 1; + } + else + { + pframe = rtw_set_ie(pframe, _SUPPORTEDRATES_IE_ , bssrate_len , bssrate, &(pattrib->pktlen)); + } + + //country(optional) + //extended supported rates + if(more_supportedrates==1){ + pframe = rtw_set_ie(pframe, _EXT_SUPPORTEDRATES_IE_ , (bssrate_len - 8), (bssrate + 8), &(pattrib->pktlen)); + } + + //supported channels + pframe = rtw_tdls_set_sup_ch(pmlmeext, pframe, pattrib); + + // SRC IE + pframe = rtw_set_ie( pframe, _SRC_IE_, 16, TDLS_SRC, &(pattrib->pktlen)); + + //RSNIE + if(pattrib->encrypt) + pframe = rtw_set_ie(pframe, _RSN_IE_2_, 20, TDLS_RSNIE, &(pattrib->pktlen)); + + //extended capabilities + pframe = rtw_set_ie(pframe, _EXT_CAP_IE_ , 5, TDLS_EXT_CAPIE, &(pattrib->pktlen)); + + //QoS capability(WMM_IE) + pframe = rtw_set_ie(pframe, _VENDOR_SPECIFIC_IE_, 7, TDLS_WMMIE, &(pattrib->pktlen)); + + + if(pattrib->encrypt){ + //FTIE + _rtw_memset(pframe, 0, 84); //All fields except SNonce shall be set to 0 + _rtw_memset(pframe, _FTIE_, 1); //version + _rtw_memset((pframe+1), 82, 1); //length + _rtw_memcpy((pframe+52), ptdls_sta->SNonce, 32); + pframe += 84; + pattrib->pktlen += 84; + + //Timeout interval + timeout_itvl[0]=0x02; + _rtw_memcpy(timeout_itvl+1, (u8 *)(&ptdls_sta->TDLS_PeerKey_Lifetime), 4); + pframe = rtw_set_ie(pframe, _TIMEOUT_ITVL_IE_, 5, timeout_itvl, &(pattrib->pktlen)); + } + + //Sup_reg_classes(optional) + //HT capabilities + pframe = rtw_tdls_set_ht_cap(padapter, pframe, pattrib); + + //20/40 BSS coexistence + if(pmlmepriv->num_FortyMHzIntolerant>0) + iedata |= BIT(2);//20 MHz BSS Width Request + pframe = rtw_set_ie(pframe, EID_BSSCoexistence, 1, &iedata, &(pattrib->pktlen)); + + //Link identifier + _rtw_memcpy(link_id_addr, pattrib->ra, 6); + _rtw_memcpy((link_id_addr+6), pattrib->src, 6); + _rtw_memcpy((link_id_addr+12), pattrib->dst, 6); + pframe = rtw_set_ie(pframe, _LINK_ID_IE_, 18, link_id_addr, &(pattrib->pktlen)); + +#ifdef CONFIG_WFD + wfd_ie_tdls( padapter, pframe, &(pattrib->pktlen) ); +#endif //CONFIG_WFD + +} + +void rtw_build_tdls_setup_rsp_ies(_adapter * padapter, struct xmit_frame * pxmitframe, u8 *pframe) +{ + struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); + struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); + struct pkt_attrib *pattrib = &pxmitframe->attrib; + struct sta_info *ptdls_sta; + struct registry_priv *pregistrypriv = &padapter->registrypriv; + + u8 payload_type = 0x02; + unsigned char category = RTW_WLAN_CATEGORY_TDLS; + unsigned char action = TDLS_SETUP_RESPONSE; + unsigned char bssrate[NDIS_802_11_LENGTH_RATES_EX]; + int bssrate_len = 0; + u8 more_supportedrates = 0; + unsigned int ie_len; + unsigned char *p; + struct mlme_priv *pmlmepriv = &padapter->mlmepriv; + u8 link_id_addr[18] = {0}; + u8 iedata=0; + u8 timeout_itvl[5]; //setup response timeout interval will copy from request + u8 ANonce[32]; //maybe it can put in ontdls_req + u8 k; //for random ANonce + u8 *pftie, *ptimeout_ie, *plinkid_ie, *prsnie, *pftie_mic; + u32 time; + + ptdls_sta = rtw_get_stainfo( &(padapter->stapriv) , pattrib->dst); + + if(ptdls_sta == NULL ) + { + DBG_871X("[%s] %d\n", __FUNCTION__, __LINE__); + return; + } + + if(pattrib->encrypt){ + for(k=0;k<8;k++){ + time=rtw_get_current_time(); + _rtw_memcpy(&ptdls_sta->ANonce[4*k], (u8*)&time, 4); + } + } + + //payload type + pframe = rtw_set_fixed_ie(pframe, 1, &(payload_type), &(pattrib->pktlen)); + //category, action, status code + pframe = rtw_set_fixed_ie(pframe, 1, &(category), &(pattrib->pktlen)); + pframe = rtw_set_fixed_ie(pframe, 1, &(action), &(pattrib->pktlen)); + pframe = rtw_set_fixed_ie(pframe, 2, (u8 *)&ptdls_sta->stat_code, &(pattrib->pktlen)); + + if(ptdls_sta->stat_code!=0) //invalid setup request + { + DBG_871X("ptdls_sta->stat_code:%04x \n", ptdls_sta->stat_code); + return; + } + + //dialog token + pframe = rtw_set_fixed_ie(pframe, 1, &(ptdls_sta->dialog), &(pattrib->pktlen)); + + //capability + _rtw_memcpy(pframe, rtw_get_capability_from_ie(pmlmeinfo->network.IEs), 2); + + if(pattrib->encrypt ) + *pframe =*pframe | BIT(4); + pframe += 2; + pattrib->pktlen += 2; + + //supported rates + rtw_set_supported_rate(bssrate, WIRELESS_11BG_24N); + bssrate_len = IEEE80211_CCK_RATE_LEN + IEEE80211_NUM_OFDM_RATESLEN; + + if (bssrate_len > 8) + { + pframe = rtw_set_ie(pframe, _SUPPORTEDRATES_IE_ , 8, bssrate, &(pattrib->pktlen)); + more_supportedrates = 1; + } + else + { + pframe = rtw_set_ie(pframe, _SUPPORTEDRATES_IE_ , bssrate_len , bssrate, &(pattrib->pktlen)); + } + + //country(optional) + //extended supported rates + if(more_supportedrates==1){ + pframe = rtw_set_ie(pframe, _EXT_SUPPORTEDRATES_IE_ , (bssrate_len - 8), (bssrate + 8), &(pattrib->pktlen)); + } + + //supported channels + pframe = rtw_tdls_set_sup_ch(pmlmeext, pframe, pattrib); + + // SRC IE + pframe = rtw_set_ie(pframe, _SRC_IE_ , 16, TDLS_SRC, &(pattrib->pktlen)); + + //RSNIE + if(pattrib->encrypt){ + prsnie = pframe; + pframe = rtw_set_ie(pframe, _RSN_IE_2_, 20, TDLS_RSNIE, &(pattrib->pktlen)); + } + + //extended capabilities + pframe = rtw_set_ie(pframe, _EXT_CAP_IE_ , 5, TDLS_EXT_CAPIE, &(pattrib->pktlen)); + + //QoS capability(WMM_IE) + pframe = rtw_set_ie(pframe, _VENDOR_SPECIFIC_IE_, 7, TDLS_WMMIE, &(pattrib->pktlen)); + + if(pattrib->encrypt){ + wpa_tdls_generate_tpk(padapter, ptdls_sta); + + //FTIE + pftie = pframe; + pftie_mic = pframe+4; + _rtw_memset(pframe, 0, 84); //All fields except SNonce shall be set to 0 + _rtw_memset(pframe, _FTIE_, 1); //version + _rtw_memset((pframe+1), 82, 1); //length + _rtw_memcpy((pframe+20), ptdls_sta->ANonce, 32); + _rtw_memcpy((pframe+52), ptdls_sta->SNonce, 32); + pframe += 84; + pattrib->pktlen += 84; + + //Timeout interval + ptimeout_ie = pframe; + timeout_itvl[0]=0x02; + _rtw_memcpy(timeout_itvl+1, (u8 *)(&ptdls_sta->TDLS_PeerKey_Lifetime), 4); + pframe = rtw_set_ie(pframe, _TIMEOUT_ITVL_IE_, 5, timeout_itvl, &(pattrib->pktlen)); + } + + //Sup_reg_classes(optional) + //HT capabilities + pframe = rtw_tdls_set_ht_cap(padapter, pframe, pattrib); + + //20/40 BSS coexistence + if(pmlmepriv->num_FortyMHzIntolerant>0) + iedata |= BIT(2);//20 MHz BSS Width Request + pframe = rtw_set_ie(pframe, EID_BSSCoexistence, 1, &iedata, &(pattrib->pktlen)); + + //Link identifier + plinkid_ie = pframe; + _rtw_memcpy(link_id_addr, pattrib->ra, 6); + _rtw_memcpy((link_id_addr+6), pattrib->dst, 6); + _rtw_memcpy((link_id_addr+12), pattrib->src, 6); + pframe = rtw_set_ie(pframe, _LINK_ID_IE_, 18, link_id_addr, &(pattrib->pktlen)); + + //fill FTIE mic + if(pattrib->encrypt) + wpa_tdls_ftie_mic(ptdls_sta->tpk.kck, 2, plinkid_ie, prsnie, ptimeout_ie, pftie, pftie_mic); + +#ifdef CONFIG_WFD + wfd_ie_tdls( padapter, pframe, &(pattrib->pktlen) ); +#endif //CONFIG_WFD + +} + +void rtw_build_tdls_setup_cfm_ies(_adapter * padapter, struct xmit_frame * pxmitframe, u8 *pframe) +{ + + struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); + struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); + struct pkt_attrib *pattrib = &pxmitframe->attrib; + struct sta_info *ptdls_sta=rtw_get_stainfo( (&padapter->stapriv) , pattrib->dst); + + u8 payload_type = 0x02; + unsigned char category = RTW_WLAN_CATEGORY_TDLS; + unsigned char action = TDLS_SETUP_CONFIRM; + u8 more_supportedrates = 0; + unsigned int ie_len; + unsigned char *p; + u8 timeout_itvl[5]; //set timeout interval to maximum value + struct mlme_priv *pmlmepriv = &padapter->mlmepriv; + u8 link_id_addr[18] = {0}; + u8 *pftie, *ptimeout_ie, *plinkid_ie, *prsnie, *pftie_mic; + + //payload type + pframe = rtw_set_fixed_ie(pframe, 1, &(payload_type), &(pattrib->pktlen)); + //category, action, status code, dialog token + pframe = rtw_set_fixed_ie(pframe, 1, &(category), &(pattrib->pktlen)); + pframe = rtw_set_fixed_ie(pframe, 1, &(action), &(pattrib->pktlen)); + pframe = rtw_set_fixed_ie(pframe, 2, (u8 *)&ptdls_sta->stat_code, &(pattrib->pktlen)); + pframe = rtw_set_fixed_ie(pframe, 1, &(ptdls_sta->dialog), &(pattrib->pktlen)); + + if(ptdls_sta->stat_code!=0) //invalid setup request + return; + + //RSNIE + if(pattrib->encrypt){ + prsnie = pframe; + pframe = rtw_set_ie(pframe, _RSN_IE_2_, 20, TDLS_RSNIE, &(pattrib->pktlen)); + } + + //EDCA param set; WMM param ele. + if(pattrib->encrypt){ + //FTIE + pftie = pframe; + pftie_mic = pframe+4; + _rtw_memset(pframe, 0, 84); //All fields except SNonce shall be set to 0 + _rtw_memset(pframe, _FTIE_, 1); //version + _rtw_memset((pframe+1), 82, 1); //length + _rtw_memcpy((pframe+20), ptdls_sta->ANonce, 32); + _rtw_memcpy((pframe+52), ptdls_sta->SNonce, 32); + pframe += 84; + pattrib->pktlen += 84; + + //Timeout interval + ptimeout_ie = pframe; + timeout_itvl[0]=0x02; + _rtw_memcpy(timeout_itvl+1, (u8 *)(&ptdls_sta->TDLS_PeerKey_Lifetime), 4); + ptdls_sta->TPK_count=0; + _set_timer(&ptdls_sta->TPK_timer, ptdls_sta->TDLS_PeerKey_Lifetime/TPK_RESEND_COUNT); + pframe = rtw_set_ie(pframe, _TIMEOUT_ITVL_IE_, 5, timeout_itvl, &(pattrib->pktlen)); + } + + //HT operation; todo + //Link identifier + plinkid_ie = pframe; + _rtw_memcpy(link_id_addr, pattrib->ra, 6); + _rtw_memcpy((link_id_addr+6), pattrib->src, 6); + _rtw_memcpy((link_id_addr+12), pattrib->dst, 6); + pframe = rtw_set_ie(pframe, _LINK_ID_IE_, 18, link_id_addr, &(pattrib->pktlen)); + + //fill FTIE mic + if(pattrib->encrypt) + wpa_tdls_ftie_mic(ptdls_sta->tpk.kck, 3, plinkid_ie, prsnie, ptimeout_ie, pftie, pftie_mic); + +} + +void rtw_build_tdls_teardown_ies(_adapter * padapter, struct xmit_frame * pxmitframe, u8 *pframe) +{ + + struct pkt_attrib *pattrib = &pxmitframe->attrib; + u8 payload_type = 0x02; + unsigned char category = RTW_WLAN_CATEGORY_TDLS; + unsigned char action = TDLS_TEARDOWN; + u8 link_id_addr[18] = {0}; + + struct sta_info *ptdls_sta = rtw_get_stainfo( &(padapter->stapriv) , pattrib->dst); + struct sta_priv *pstapriv = &padapter->stapriv; + + //payload type + pframe = rtw_set_fixed_ie(pframe, 1, &(payload_type), &(pattrib->pktlen)); + //category, action, reason code + pframe = rtw_set_fixed_ie(pframe, 1, &(category), &(pattrib->pktlen)); + pframe = rtw_set_fixed_ie(pframe, 1, &(action), &(pattrib->pktlen)); + pframe = rtw_set_fixed_ie(pframe, 1, (u8 *)&ptdls_sta->stat_code, &(pattrib->pktlen)); + + //Link identifier + if(ptdls_sta->tdls_sta_state & TDLS_INITIATOR_STATE){ + _rtw_memcpy(link_id_addr, pattrib->ra, 6); + _rtw_memcpy((link_id_addr+6), pattrib->src, 6); + _rtw_memcpy((link_id_addr+12), pattrib->dst, 6); + }else if(ptdls_sta->tdls_sta_state & TDLS_RESPONDER_STATE){ + _rtw_memcpy(link_id_addr, pattrib->ra, 6); + _rtw_memcpy((link_id_addr+6), pattrib->dst, 6); + _rtw_memcpy((link_id_addr+12), pattrib->src, 6); + } + pframe = rtw_set_ie(pframe, _LINK_ID_IE_, 18, link_id_addr, &(pattrib->pktlen)); + +} + +void rtw_build_tdls_dis_req_ies(_adapter * padapter, struct xmit_frame * pxmitframe, u8 *pframe) +{ + + struct pkt_attrib *pattrib = &pxmitframe->attrib; + u8 payload_type = 0x02; + u8 category = RTW_WLAN_CATEGORY_TDLS; + u8 action = TDLS_DISCOVERY_REQUEST; + u8 link_id_addr[18] = {0}; + static u8 dialogtoken=0; + + //payload type + pframe = rtw_set_fixed_ie(pframe, 1, &(payload_type), &(pattrib->pktlen)); + //category, action, reason code + pframe = rtw_set_fixed_ie(pframe, 1, &(category), &(pattrib->pktlen)); + pframe = rtw_set_fixed_ie(pframe, 1, &(action), &(pattrib->pktlen)); + pframe = rtw_set_fixed_ie(pframe, 1, &(dialogtoken), &(pattrib->pktlen)); + dialogtoken = (dialogtoken+1)%256; + + //Link identifier + _rtw_memcpy(link_id_addr, pattrib->ra, 6); + _rtw_memcpy((link_id_addr+6), pattrib->src, 6); + _rtw_memcpy((link_id_addr+12), pattrib->dst, 6); + pframe = rtw_set_ie(pframe, _LINK_ID_IE_, 18, link_id_addr, &(pattrib->pktlen)); + +} + +void rtw_build_tdls_dis_rsp_ies(_adapter * padapter, struct xmit_frame * pxmitframe, u8 *pframe, u8 dialog) +{ + struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; + struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info; + struct pkt_attrib *pattrib = &pxmitframe->attrib; + struct registry_priv *pregistrypriv = &padapter->registrypriv; + + u8 category = RTW_WLAN_CATEGORY_PUBLIC; + u8 action = TDLS_DISCOVERY_RESPONSE; + u8 bssrate[NDIS_802_11_LENGTH_RATES_EX]; + int bssrate_len = 0; + u8 more_supportedrates = 0; + u8 *p; + struct mlme_priv *pmlmepriv = &padapter->mlmepriv; + u8 link_id_addr[18] = {0}; + u8 iedata=0; + u8 timeout_itvl[5]; //set timeout interval to maximum value + u32 timeout_interval= TPK_RESEND_COUNT * 1000; + + //category, action, dialog token + pframe = rtw_set_fixed_ie(pframe, 1, &(category), &(pattrib->pktlen)); + pframe = rtw_set_fixed_ie(pframe, 1, &(action), &(pattrib->pktlen)); + pframe = rtw_set_fixed_ie(pframe, 1, &(dialog), &(pattrib->pktlen)); + + //capability + _rtw_memcpy(pframe, rtw_get_capability_from_ie(pmlmeinfo->network.IEs), 2); + + if(pattrib->encrypt) + *pframe =*pframe | BIT(4); + pframe += 2; + pattrib->pktlen += 2; + + //supported rates + rtw_set_supported_rate(bssrate, WIRELESS_11BG_24N); + bssrate_len = IEEE80211_CCK_RATE_LEN + IEEE80211_NUM_OFDM_RATESLEN; + + if (bssrate_len > 8) + { + pframe = rtw_set_ie(pframe, _SUPPORTEDRATES_IE_ , 8, bssrate, &(pattrib->pktlen)); + more_supportedrates = 1; + } + else + { + pframe = rtw_set_ie(pframe, _SUPPORTEDRATES_IE_ , bssrate_len , bssrate, &(pattrib->pktlen)); + } + + //extended supported rates + if(more_supportedrates==1){ + pframe = rtw_set_ie(pframe, _EXT_SUPPORTEDRATES_IE_ , (bssrate_len - 8), (bssrate + 8), &(pattrib->pktlen)); + } + + //supported channels + pframe = rtw_tdls_set_sup_ch(pmlmeext, pframe, pattrib); + + //RSNIE + if(pattrib->encrypt) + pframe = rtw_set_ie(pframe, _RSN_IE_2_, 20, TDLS_RSNIE, &(pattrib->pktlen)); + + //extended capability + pframe = rtw_set_ie(pframe, _EXT_CAP_IE_ , 5, TDLS_EXT_CAPIE, &(pattrib->pktlen)); + + if(pattrib->encrypt){ + //FTIE + _rtw_memset(pframe, 0, 84); //All fields shall be set to 0 + _rtw_memset(pframe, _FTIE_, 1); //version + _rtw_memset((pframe+1), 82, 1); //length + pframe += 84; + pattrib->pktlen += 84; + + //Timeout interval + timeout_itvl[0]=0x02; + _rtw_memcpy(timeout_itvl+1, &timeout_interval, 4); + pframe = rtw_set_ie(pframe, _TIMEOUT_ITVL_IE_, 5, timeout_itvl, &(pattrib->pktlen)); + } + + //Sup_reg_classes(optional) + //HT capabilities + pframe = rtw_tdls_set_ht_cap(padapter, pframe, pattrib); + + //20/40 BSS coexistence + if(pmlmepriv->num_FortyMHzIntolerant>0) + iedata |= BIT(2);//20 MHz BSS Width Request + pframe = rtw_set_ie(pframe, EID_BSSCoexistence, 1, &iedata, &(pattrib->pktlen)); + + //Link identifier + _rtw_memcpy(link_id_addr, pattrib->ra, 6); + _rtw_memcpy((link_id_addr+6), pattrib->dst, 6); + _rtw_memcpy((link_id_addr+12), pattrib->src, 6); + pframe = rtw_set_ie(pframe, _LINK_ID_IE_, 18, link_id_addr, &(pattrib->pktlen)); + +} + +void rtw_build_tdls_peer_traffic_indication_ies(_adapter * padapter, struct xmit_frame * pxmitframe, u8 *pframe) +{ + + struct pkt_attrib *pattrib = &pxmitframe->attrib; + u8 payload_type = 0x02; + unsigned char category = RTW_WLAN_CATEGORY_TDLS; + unsigned char action = TDLS_PEER_TRAFFIC_INDICATION; + + u8 link_id_addr[18] = {0}; + u8 AC_queue=0; + struct sta_priv *pstapriv = &padapter->stapriv; + struct sta_info *ptdls_sta = rtw_get_stainfo(pstapriv, pattrib->dst); + + //payload type + pframe = rtw_set_fixed_ie(pframe, 1, &(payload_type), &(pattrib->pktlen)); + //category, action, reason code + pframe = rtw_set_fixed_ie(pframe, 1, &(category), &(pattrib->pktlen)); + pframe = rtw_set_fixed_ie(pframe, 1, &(action), &(pattrib->pktlen)); + pframe = rtw_set_fixed_ie(pframe, 1, &(ptdls_sta->dialog), &(pattrib->pktlen)); + + //Link identifier + _rtw_memcpy(link_id_addr, pattrib->ra, 6); + _rtw_memcpy((link_id_addr+6), pattrib->src, 6); + _rtw_memcpy((link_id_addr+12), pattrib->dst, 6); + pframe = rtw_set_ie(pframe, _LINK_ID_IE_, 18, link_id_addr, &(pattrib->pktlen)); + + //PTI control + //PU buffer status + if(ptdls_sta->uapsd_bk&BIT(1)) + AC_queue=BIT(0); + if(ptdls_sta->uapsd_be&BIT(1)) + AC_queue=BIT(1); + if(ptdls_sta->uapsd_vi&BIT(1)) + AC_queue=BIT(2); + if(ptdls_sta->uapsd_vo&BIT(1)) + AC_queue=BIT(3); + pframe = rtw_set_ie(pframe, _PTI_BUFFER_STATUS_, 1, &AC_queue, &(pattrib->pktlen)); + +} + +void rtw_build_tdls_ch_switch_req_ies(_adapter * padapter, struct xmit_frame * pxmitframe, u8 *pframe) +{ + + struct pkt_attrib *pattrib = &pxmitframe->attrib; + struct tdls_info *ptdlsinfo = &padapter->tdlsinfo; + u8 payload_type = 0x02; + unsigned char category = RTW_WLAN_CATEGORY_TDLS; + unsigned char action = TDLS_CHANNEL_SWITCH_REQUEST; + u8 link_id_addr[18] = {0}; + struct sta_priv *pstapriv = &padapter->stapriv; + struct sta_info *ptdls_sta = rtw_get_stainfo(pstapriv, pattrib->dst); + u8 ch_switch_timing[4] = {0}; + u16 switch_time= CH_SWITCH_TIME, switch_timeout=CH_SWITCH_TIMEOUT; + + //payload type + pframe = rtw_set_fixed_ie(pframe, 1, &(payload_type), &(pattrib->pktlen)); + //category, action, target_ch + pframe = rtw_set_fixed_ie(pframe, 1, &(category), &(pattrib->pktlen)); + pframe = rtw_set_fixed_ie(pframe, 1, &(action), &(pattrib->pktlen)); + pframe = rtw_set_fixed_ie(pframe, 1, &(ptdlsinfo->candidate_ch), &(pattrib->pktlen)); + + //Link identifier + _rtw_memcpy(link_id_addr, pattrib->ra, 6); + _rtw_memcpy((link_id_addr+6), pattrib->src, 6); + _rtw_memcpy((link_id_addr+12), pattrib->dst, 6); + pframe = rtw_set_ie(pframe, _LINK_ID_IE_, 18, link_id_addr, &(pattrib->pktlen)); + + //ch switch timing + _rtw_memcpy(ch_switch_timing, &switch_time, 2); + _rtw_memcpy(ch_switch_timing+2, &switch_timeout, 2); + pframe = rtw_set_ie(pframe, _CH_SWITCH_TIMING_, 4, ch_switch_timing, &(pattrib->pktlen)); + + //update ch switch attrib to sta_info + ptdls_sta->off_ch=ptdlsinfo->candidate_ch; + ptdls_sta->ch_switch_time=switch_time; + ptdls_sta->ch_switch_timeout=switch_timeout; + +} + +void rtw_build_tdls_ch_switch_rsp_ies(_adapter * padapter, struct xmit_frame * pxmitframe, u8 *pframe) +{ + + struct pkt_attrib *pattrib = &pxmitframe->attrib; + u8 payload_type = 0x02; + unsigned char category = RTW_WLAN_CATEGORY_TDLS; + unsigned char action = TDLS_CHANNEL_SWITCH_RESPONSE; + u8 link_id_addr[18] = {0}; + struct sta_priv *pstapriv = &padapter->stapriv; + struct sta_info *ptdls_sta = rtw_get_stainfo(pstapriv, pattrib->dst); + struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; + struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info; + u8 ch_switch_timing[4] = {0}; + + //payload type + pframe = rtw_set_fixed_ie(pframe, 1, &(payload_type), &(pattrib->pktlen)); + //category, action, status_code + pframe = rtw_set_fixed_ie(pframe, 1, &(category), &(pattrib->pktlen)); + pframe = rtw_set_fixed_ie(pframe, 1, &(action), &(pattrib->pktlen)); + pframe = rtw_set_fixed_ie(pframe, 2, (u8 *)&ptdls_sta->stat_code, &(pattrib->pktlen)); + + //Link identifier + _rtw_memcpy(link_id_addr, pattrib->ra, 6); + _rtw_memcpy((link_id_addr+6), pattrib->src, 6); + _rtw_memcpy((link_id_addr+12), pattrib->dst, 6); + pframe = rtw_set_ie(pframe, _LINK_ID_IE_, 18, link_id_addr, &(pattrib->pktlen)); + + //ch switch timing + _rtw_memcpy(ch_switch_timing, &ptdls_sta->ch_switch_time, 2); + _rtw_memcpy(ch_switch_timing+2, &ptdls_sta->ch_switch_timeout, 2); + pframe = rtw_set_ie(pframe, _CH_SWITCH_TIMING_, 4, ch_switch_timing, &(pattrib->pktlen)); + +} + +#ifdef CONFIG_WFD +void rtw_build_tunneled_probe_req_ies(_adapter * padapter, struct xmit_frame * pxmitframe, u8 *pframe) +{ + + struct pkt_attrib *pattrib = &pxmitframe->attrib; + struct wifidirect_info *pwdinfo = &padapter->wdinfo; + struct wifidirect_info *pbuddy_wdinfo = &padapter->pbuddy_adapter->wdinfo; + u8 payload_type = 0x02; + u8 category = RTW_WLAN_CATEGORY_P2P; + u8 WFA_OUI[3] = { 0x50, 0x6f, 0x9a}; + u8 probe_req = 4; + u8 wfdielen = 0; + + //payload type + pframe = rtw_set_fixed_ie(pframe, 1, &(payload_type), &(pattrib->pktlen)); + //category, OUI, frame_body_type + pframe = rtw_set_fixed_ie(pframe, 1, &(category), &(pattrib->pktlen)); + pframe = rtw_set_fixed_ie(pframe, 3, WFA_OUI, &(pattrib->pktlen)); + pframe = rtw_set_fixed_ie(pframe, 1, &(probe_req), &(pattrib->pktlen)); + + if(!rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) + { + wfdielen = build_probe_req_wfd_ie(pwdinfo, pframe); + pframe += wfdielen; + pattrib->pktlen += wfdielen; + } + else if(!rtw_p2p_chk_state(pbuddy_wdinfo, P2P_STATE_NONE)) + { + wfdielen = build_probe_req_wfd_ie(pbuddy_wdinfo, pframe); + pframe += wfdielen; + pattrib->pktlen += wfdielen; + } + +} + +void rtw_build_tunneled_probe_rsp_ies(_adapter * padapter, struct xmit_frame * pxmitframe, u8 *pframe) +{ + + struct pkt_attrib *pattrib = &pxmitframe->attrib; + struct wifidirect_info *pwdinfo = &padapter->wdinfo; + struct wifidirect_info *pbuddy_wdinfo = &padapter->pbuddy_adapter->wdinfo; + u8 payload_type = 0x02; + u8 category = RTW_WLAN_CATEGORY_P2P; + u8 WFA_OUI[3] = { 0x50, 0x6f, 0x9a}; + u8 probe_rsp = 5; + u8 wfdielen = 0; + + //payload type + pframe = rtw_set_fixed_ie(pframe, 1, &(payload_type), &(pattrib->pktlen)); + //category, OUI, frame_body_type + pframe = rtw_set_fixed_ie(pframe, 1, &(category), &(pattrib->pktlen)); + pframe = rtw_set_fixed_ie(pframe, 3, WFA_OUI, &(pattrib->pktlen)); + pframe = rtw_set_fixed_ie(pframe, 1, &(probe_rsp), &(pattrib->pktlen)); + + if(!rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) + { + wfdielen = build_probe_resp_wfd_ie(pwdinfo, pframe, 1); + pframe += wfdielen; + pattrib->pktlen += wfdielen; + } + else if(!rtw_p2p_chk_state(pbuddy_wdinfo, P2P_STATE_NONE)) + { + wfdielen = build_probe_resp_wfd_ie(pbuddy_wdinfo, pframe, 1); + pframe += wfdielen; + pattrib->pktlen += wfdielen; + } + +} +#endif //CONFIG_WFD + +void _TPK_timer_hdl(void *FunctionContext) +{ + struct sta_info *ptdls_sta = (struct sta_info *)FunctionContext; + + ptdls_sta->TPK_count++; + //TPK_timer set 1000 as default + //retry timer should set at least 301 sec. + if(ptdls_sta->TPK_count==TPK_RESEND_COUNT){ + ptdls_sta->TPK_count=0; + issue_tdls_setup_req(ptdls_sta->padapter, ptdls_sta->hwaddr); + } + + _set_timer(&ptdls_sta->TPK_timer, ptdls_sta->TDLS_PeerKey_Lifetime/TPK_RESEND_COUNT); +} + +void init_TPK_timer(_adapter *padapter, struct sta_info *psta) +{ + psta->padapter=padapter; + + _init_timer(&psta->TPK_timer, padapter->pnetdev, _TPK_timer_hdl, psta); +} + +// TDLS_DONE_CH_SEN: channel sensing and report candidate channel +// TDLS_OFF_CH: first time set channel to off channel +// TDLS_BASE_CH: when go back to the channel linked with AP, send null data to peer STA as an indication +void _ch_switch_timer_hdl(void *FunctionContext) +{ + + struct sta_info *ptdls_sta = (struct sta_info *)FunctionContext; + _adapter *padapter = ptdls_sta->padapter; + + if( ptdls_sta->option == TDLS_DONE_CH_SEN ){ + rtw_tdls_cmd(padapter, ptdls_sta->hwaddr, TDLS_DONE_CH_SEN); + }else if( ptdls_sta->option == TDLS_OFF_CH ){ + issue_nulldata_to_TDLS_peer_STA(ptdls_sta->padapter, ptdls_sta, 0); + _set_timer(&ptdls_sta->base_ch_timer, 500); + }else if( ptdls_sta->option == TDLS_BASE_CH){ + issue_nulldata_to_TDLS_peer_STA(ptdls_sta->padapter, ptdls_sta, 0); + } +} + +void init_ch_switch_timer(_adapter *padapter, struct sta_info *psta) +{ + psta->padapter=padapter; + _init_timer(&psta->option_timer, padapter->pnetdev, _ch_switch_timer_hdl, psta); +} + +void _base_ch_timer_hdl(void *FunctionContext) +{ + struct sta_info *ptdls_sta = (struct sta_info *)FunctionContext; + rtw_tdls_cmd(ptdls_sta->padapter, ptdls_sta->hwaddr, TDLS_P_OFF_CH); +} + +void init_base_ch_timer(_adapter *padapter, struct sta_info *psta) +{ + psta->padapter=padapter; + _init_timer(&psta->base_ch_timer, padapter->pnetdev, _base_ch_timer_hdl, psta); +} + +void _off_ch_timer_hdl(void *FunctionContext) +{ + struct sta_info *ptdls_sta = (struct sta_info *)FunctionContext; + rtw_tdls_cmd(ptdls_sta->padapter, ptdls_sta->hwaddr, TDLS_P_BASE_CH ); +} + +void init_off_ch_timer(_adapter *padapter, struct sta_info *psta) +{ + psta->padapter=padapter; + _init_timer(&psta->off_ch_timer, padapter->pnetdev, _off_ch_timer_hdl, psta); +} + +void _tdls_handshake_timer_hdl(void *FunctionContext) +{ + struct sta_info *ptdls_sta = (struct sta_info *)FunctionContext; + + if(ptdls_sta != NULL) + { + if( !(ptdls_sta->tdls_sta_state & TDLS_LINKED_STATE) ) + { + DBG_871X("tdls handshake time out\n"); + free_tdls_sta(ptdls_sta->padapter, ptdls_sta); + } + } +} + +void init_handshake_timer(_adapter *padapter, struct sta_info *psta) +{ + psta->padapter=padapter; + _init_timer(&psta->handshake_timer, padapter->pnetdev, _tdls_handshake_timer_hdl, psta); +} + +//Check tdls peer sta alive. +void _tdls_alive_timer_phase1_hdl(void *FunctionContext) +{ + _irqL irqL; + struct sta_info *ptdls_sta = (struct sta_info *)FunctionContext; + _adapter *padapter = ptdls_sta->padapter; + struct tdls_info *ptdlsinfo = &padapter->tdlsinfo; + + _enter_critical_bh(&ptdlsinfo->hdl_lock, &irqL); + ptdls_sta->timer_flag = 1; + _exit_critical_bh(&ptdlsinfo->hdl_lock, &irqL); + + ptdls_sta->tdls_sta_state &= (~TDLS_ALIVE_STATE); + + DBG_871X("issue_tdls_dis_req to check alive\n"); + issue_tdls_dis_req( padapter, ptdls_sta->hwaddr); + rtw_tdls_cmd(padapter, ptdls_sta->hwaddr, TDLS_CKALV_PH1); + sta_update_last_rx_pkts(ptdls_sta); + + if ( ptdls_sta->timer_flag == 2 ) + rtw_tdls_cmd(padapter, ptdls_sta->hwaddr, TDLS_FREE_STA); + else + { + _enter_critical_bh(&ptdlsinfo->hdl_lock, &irqL); + ptdls_sta->timer_flag = 0; + _exit_critical_bh(&ptdlsinfo->hdl_lock, &irqL); + } + +} + +void _tdls_alive_timer_phase2_hdl(void *FunctionContext) +{ + _irqL irqL; + struct sta_info *ptdls_sta = (struct sta_info *)FunctionContext; + _adapter *padapter = ptdls_sta->padapter; + struct tdls_info *ptdlsinfo = &padapter->tdlsinfo; + + _enter_critical_bh(&(ptdlsinfo->hdl_lock), &irqL); + ptdls_sta->timer_flag = 1; + _exit_critical_bh(&ptdlsinfo->hdl_lock, &irqL); + + if( (ptdls_sta->tdls_sta_state & TDLS_ALIVE_STATE) && + (sta_last_rx_pkts(ptdls_sta) + 3 <= sta_rx_pkts(ptdls_sta)) ) + { + DBG_871X("TDLS STA ALIVE, ptdls_sta->sta_stats.last_rx_pkts:%llu, ptdls_sta->sta_stats.rx_pkts:%llu\n", + sta_last_rx_pkts(ptdls_sta), sta_rx_pkts(ptdls_sta)); + + ptdls_sta->alive_count = 0; + rtw_tdls_cmd(padapter, ptdls_sta->hwaddr, TDLS_CKALV_PH2); + } + else + { + if( !(ptdls_sta->tdls_sta_state & TDLS_ALIVE_STATE) ) + DBG_871X("TDLS STA TOO FAR\n"); + if( !(sta_last_rx_pkts(ptdls_sta) + 3 <= sta_rx_pkts(ptdls_sta))) + DBG_871X("TDLS LINK WITH LOW TRAFFIC, ptdls_sta->sta_stats.last_rx_pkts:%llu, ptdls_sta->sta_stats.rx_pkts:%llu\n", + sta_last_rx_pkts(ptdls_sta), sta_rx_pkts(ptdls_sta)); + + ptdls_sta->alive_count++; + if( ptdls_sta->alive_count == TDLS_ALIVE_COUNT ) + { + ptdls_sta->stat_code = _RSON_TDLS_TEAR_TOOFAR_; + issue_tdls_teardown(padapter, ptdls_sta->hwaddr); + } + else + { + rtw_tdls_cmd(padapter, ptdls_sta->hwaddr, TDLS_CKALV_PH2); + } + } + + if ( ptdls_sta->timer_flag == 2 ) + rtw_tdls_cmd(padapter, ptdls_sta->hwaddr, TDLS_FREE_STA); + else + { + _enter_critical_bh(&(ptdlsinfo->hdl_lock), &irqL); + ptdls_sta->timer_flag = 0; + _exit_critical_bh(&ptdlsinfo->hdl_lock, &irqL); +} + +} + +void init_tdls_alive_timer(_adapter *padapter, struct sta_info *psta) +{ + psta->padapter=padapter; + _init_timer(&psta->alive_timer1, padapter->pnetdev, _tdls_alive_timer_phase1_hdl, psta); + _init_timer(&psta->alive_timer2, padapter->pnetdev, _tdls_alive_timer_phase2_hdl, psta); +} + +int update_sgi_tdls(_adapter *padapter, struct sta_info *psta) +{ + struct ht_priv *psta_ht = NULL; + psta_ht = &psta->htpriv; + + if(psta_ht->ht_option) + { + return psta_ht->sgi; + } + else + return _FALSE; +} + +u32 update_mask_tdls(_adapter *padapter, struct sta_info *psta) +{ + int i; + u8 rf_type, id; + unsigned char sta_band = 0; + unsigned char limit; + unsigned int tx_ra_bitmap=0; + struct ht_priv *psta_ht = NULL; + struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); + WLAN_BSSID_EX *pcur_network = (WLAN_BSSID_EX *)&pmlmepriv->cur_network.network; + + psta_ht = &psta->htpriv; + //b/g mode ra_bitmap + for (i=0; ibssrateset); i++) + { + if (psta->bssrateset[i]) + tx_ra_bitmap |= rtw_get_bit_value_from_ieee_value(psta->bssrateset[i]&0x7f); + } + + //n mode ra_bitmap + if(psta_ht->ht_option) + { + padapter->HalFunc.GetHwRegHandler(padapter, HW_VAR_RF_TYPE, (u8 *)(&rf_type)); + if(rf_type == RF_2T2R) + limit=16;// 2R + else + limit=8;// 1R + + for (i=0; iht_cap.supp_mcs_set[i/8] & BIT(i%8)) + tx_ra_bitmap |= BIT(i+12); + } + } + + if ( pcur_network->Configuration.DSConfig > 14 ) { + // 5G band + if (tx_ra_bitmap & 0xffff000) + sta_band |= WIRELESS_11_5N | WIRELESS_11A; + else + sta_band |= WIRELESS_11A; + } else { + if (tx_ra_bitmap & 0xffff000) + sta_band |= WIRELESS_11_24N | WIRELESS_11G | WIRELESS_11B; + else if (tx_ra_bitmap & 0xff0) + sta_band |= WIRELESS_11G |WIRELESS_11B; + else + sta_band |= WIRELESS_11B; + } + + id = networktype_to_raid(sta_band); + tx_ra_bitmap |= ((id<<28)&0xf0000000); + return tx_ra_bitmap; +} + +#endif //CONFIG_TDLS diff --git a/core/rtw_wlan_util.c b/core/rtw_wlan_util.c index 7f8d7c8..8a5676b 100755 --- a/core/rtw_wlan_util.c +++ b/core/rtw_wlan_util.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Copyright(c) 2007 - 2012 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. @@ -72,12 +72,12 @@ static u8 rtw_basic_rate_mix[7] = { int cckrates_included(unsigned char *rate, int ratelen) { int i; - + for(i = 0; i < ratelen; i++) { if ( (((rate[i]) & 0x7f) == 2) || (((rate[i]) & 0x7f) == 4) || (((rate[i]) & 0x7f) == 11) || (((rate[i]) & 0x7f) == 22) ) - return _TRUE; + return _TRUE; } return _FALSE; @@ -87,14 +87,14 @@ int cckrates_included(unsigned char *rate, int ratelen) int cckratesonly_included(unsigned char *rate, int ratelen) { int i; - + for(i = 0; i < ratelen; i++) { if ( (((rate[i]) & 0x7f) != 2) && (((rate[i]) & 0x7f) != 4) && (((rate[i]) & 0x7f) != 11) && (((rate[i]) & 0x7f) != 22) ) - return _FALSE; + return _FALSE; } - + return _TRUE; } @@ -127,12 +127,12 @@ unsigned char networktype_to_raid(unsigned char network_type) break; default: raid = RATR_INX_WIRELESS_GB; - break; + break; } return raid; - + } u8 judge_network_type(struct adapter *padapter, unsigned char *rate, int ratelen) @@ -140,7 +140,7 @@ u8 judge_network_type(struct adapter *padapter, unsigned char *rate, int ratelen u8 network_type = 0; struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); - + if(pmlmeext->cur_channel > 14) { @@ -148,7 +148,7 @@ u8 judge_network_type(struct adapter *padapter, unsigned char *rate, int ratelen { network_type = WIRELESS_11_5N; } - + network_type |= WIRELESS_11A; } else @@ -171,8 +171,8 @@ u8 judge_network_type(struct adapter *padapter, unsigned char *rate, int ratelen network_type |= WIRELESS_11G; } } - - return network_type; + + return network_type; } unsigned char ratetbl_val_2wifirate(unsigned char rate); @@ -180,7 +180,7 @@ unsigned char ratetbl_val_2wifirate(unsigned char rate) { unsigned char val = 0; - switch (rate & 0x7f) + switch (rate & 0x7f) { case 0: val = IEEE80211_CCK_RATE_1MB; @@ -197,7 +197,7 @@ unsigned char ratetbl_val_2wifirate(unsigned char rate) case 3: val = IEEE80211_CCK_RATE_11MB; break; - + case 4: val = IEEE80211_OFDM_RATE_6MB; break; @@ -209,7 +209,7 @@ unsigned char ratetbl_val_2wifirate(unsigned char rate) case 6: val = IEEE80211_OFDM_RATE_12MB; break; - + case 7: val = IEEE80211_OFDM_RATE_18MB; break; @@ -217,7 +217,7 @@ unsigned char ratetbl_val_2wifirate(unsigned char rate) case 8: val = IEEE80211_OFDM_RATE_24MB; break; - + case 9: val = IEEE80211_OFDM_RATE_36MB; break; @@ -225,7 +225,7 @@ unsigned char ratetbl_val_2wifirate(unsigned char rate) case 10: val = IEEE80211_OFDM_RATE_48MB; break; - + case 11: val = IEEE80211_OFDM_RATE_54MB; break; @@ -242,7 +242,7 @@ int is_basicrate(struct adapter *padapter, unsigned char rate) int i; unsigned char val; struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; - + for(i = 0; i < NumRates; i++) { val = pmlmeext->basicrate[i]; @@ -255,7 +255,7 @@ int is_basicrate(struct adapter *padapter, unsigned char rate) } } } - + return _FALSE; } @@ -275,10 +275,10 @@ unsigned int ratetbl2rateset(struct adapter *padapter, unsigned char *rateset) { case 0xff: return len; - + case 0xfe: continue; - + default: rate = ratetbl_val_2wifirate(rate); @@ -286,7 +286,7 @@ unsigned int ratetbl2rateset(struct adapter *padapter, unsigned char *rateset) { rate |= IEEE80211_BASIC_RATE_MASK; } - + rateset[len] = rate; len++; break; @@ -445,7 +445,7 @@ inline u32 rtw_get_on_cur_ch_time(struct adapter *adapter) void SelectChannel(struct adapter *padapter, unsigned char channel) { - struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; + struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; #ifdef CONFIG_DUALMAC_CONCURRENT //saved channel info @@ -454,14 +454,14 @@ void SelectChannel(struct adapter *padapter, unsigned char channel) #else //CONFIG_DUALMAC_CONCURRENT _enter_critical_mutex(&(adapter_to_dvobj(padapter)->setch_mutex), NULL); - + //saved channel info rtw_set_oper_ch(padapter, channel); rtw_hal_set_chan(padapter, channel); - + _exit_critical_mutex(&(adapter_to_dvobj(padapter)->setch_mutex), NULL); - + #endif // CONFIG_DUALMAC_CONCURRENT } @@ -504,7 +504,7 @@ void set_channel_bwmode(struct adapter *padapter, unsigned char channel, unsigne //SelectChannel(padapter, channel); center_ch = channel; } - else + else { //switch to the proper channel if (channel_offset == HAL_PRIME_CHNL_OFFSET_LOWER) @@ -517,7 +517,7 @@ void set_channel_bwmode(struct adapter *padapter, unsigned char channel, unsigne //SelectChannel(padapter, channel - 2); center_ch = channel - 2; } - } + } //set Channel #ifdef CONFIG_DUALMAC_CONCURRENT @@ -529,7 +529,7 @@ void set_channel_bwmode(struct adapter *padapter, unsigned char channel, unsigne #else //CONFIG_DUALMAC_CONCURRENT _enter_critical_mutex(&(adapter_to_dvobj(padapter)->setch_mutex), NULL); - + //saved channel/bw info rtw_set_oper_ch(padapter, channel); rtw_set_oper_bw(padapter, bwmode); @@ -541,9 +541,9 @@ void set_channel_bwmode(struct adapter *padapter, unsigned char channel, unsigne #endif // CONFIG_DUALMAC_CONCURRENT - + SetBWMode(padapter, bwmode, channel_offset); - + } int get_bsstype(unsigned short capability) @@ -558,13 +558,13 @@ int get_bsstype(unsigned short capability) } else { - return 0; + return 0; } } __inline u8 *get_my_bssid(WLAN_BSSID_EX *pnetwork) -{ - return (pnetwork->MacAddress); +{ + return (pnetwork->MacAddress); } u16 get_beacon_interval(WLAN_BSSID_EX *bss) @@ -572,7 +572,7 @@ u16 get_beacon_interval(WLAN_BSSID_EX *bss) __le16 le_val; memcpy(&le_val, rtw_get_beacon_interval_from_ie(bss->IEs), 2); - return le16_to_cpu(le_val); + return le16_to_cpu(le_val); } int is_client_associated_to_ap(struct adapter *padapter) @@ -585,7 +585,7 @@ int is_client_associated_to_ap(struct adapter *padapter) pmlmeext = &padapter->mlmeextpriv; pmlmeinfo = &(pmlmeext->mlmext_info); - + if ((pmlmeinfo->state & WIFI_FW_ASSOC_SUCCESS) && ((pmlmeinfo->state&0x03) == WIFI_FW_STATION_STATE)) { return _TRUE; @@ -600,7 +600,7 @@ int is_client_associated_to_ibss(struct adapter *padapter) { struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); - + if ((pmlmeinfo->state & WIFI_FW_ASSOC_SUCCESS) && ((pmlmeinfo->state&0x03) == WIFI_FW_ADHOC_STATE)) { return _TRUE; @@ -616,7 +616,7 @@ int is_IBSS_empty(struct adapter *padapter) unsigned int i; struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); - + for (i = IBSS_START_MAC_ID; i < NUM_STA; i++) { if (pmlmeinfo->FW_sta_info[i].status == 1) @@ -624,9 +624,9 @@ int is_IBSS_empty(struct adapter *padapter) return _FAIL; } } - + return _TRUE; - + } unsigned int decide_wait_for_beacon_timeout(unsigned int bcn_interval) @@ -634,11 +634,11 @@ unsigned int decide_wait_for_beacon_timeout(unsigned int bcn_interval) if ((bcn_interval << 2) < WAIT_FOR_BCN_TO_MIN) { return WAIT_FOR_BCN_TO_MIN; - } + } else if ((bcn_interval << 2) > WAIT_FOR_BCN_TO_MAX) { return WAIT_FOR_BCN_TO_MAX; - } + } else { return ((bcn_interval << 2)); @@ -646,8 +646,8 @@ unsigned int decide_wait_for_beacon_timeout(unsigned int bcn_interval) } void CAM_empty_entry( - struct adapter * Adapter, - u8 ucIndex + struct adapter * Adapter, + u8 ucIndex ) { rtw_hal_set_hwreg(Adapter, HW_VAR_CAM_EMPTY_ENTRY, (u8 *)(&ucIndex)); @@ -668,9 +668,9 @@ static u32 _ReadCAM(struct adapter *padapter ,u32 addr) if(0 == (rtw_read32(padapter,REG_CAMCMD) & CAM_POLLINIG)){ break; } - }while(count++ < 100); + }while(count++ < 100); - return rtw_read32(padapter,REG_CAMREAD); + return rtw_read32(padapter,REG_CAMREAD); } #endif void read_cam(struct adapter *padapter ,u8 entry) @@ -681,7 +681,7 @@ void read_cam(struct adapter *padapter ,u8 entry) DBG_8192C("********* DUMP CAM Entry_#%02d***************\n",entry); for (j = 0; j < 6; j++) - { + { //cmd = _ReadCAM(padapter ,addr+j); //HW_VAR_CAM_READ cam_val[1]=addr+j; @@ -702,48 +702,48 @@ void write_cam(struct adapter *padapter, u8 entry, u16 ctrl, u8 *mac, u8 *key) addr = entry << 3; for (j = 5; j >= 0; j--) - { + { switch (j) { case 0: val = (ctrl | (mac[0] << 16) | (mac[1] << 24) ); break; - + case 1: val = (mac[2] | ( mac[3] << 8) | (mac[4] << 16) | (mac[5] << 24)); break; - + default: i = (j - 2) << 2; val = (key[i] | (key[i+1] << 8) | (key[i+2] << 16) | (key[i+3] << 24)); break; - + } cam_val[0] = val; cam_val[1] = addr + (unsigned int)j; rtw_hal_set_hwreg(padapter, HW_VAR_CAM_WRITE, (u8 *)cam_val); - + //rtw_write32(padapter, WCAMI, val); - + //cmd = CAM_POLLINIG | CAM_WRITE | (addr + j); //rtw_write32(padapter, RWCAM, cmd); - + //DBG_871X("%s=> cam write: %x, %x\n",__FUNCTION__, cmd, val); - + } } void clear_cam_entry(struct adapter *padapter, u8 entry) -{ +{ #if 0 u32 addr, val=0; u32 cam_val[2]; addr = entry << 3; - + cam_val[0] = val; cam_val[1] = addr + (unsigned int)0; @@ -772,7 +772,7 @@ int allocate_fw_sta_entry(struct adapter *padapter) unsigned int mac_id; struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); - + for (mac_id = IBSS_START_MAC_ID; mac_id < NUM_STA; mac_id++) { if (pmlmeinfo->FW_sta_info[mac_id].status == 0) @@ -782,7 +782,7 @@ int allocate_fw_sta_entry(struct adapter *padapter) break; } } - + return mac_id; } @@ -795,10 +795,10 @@ void flush_all_cam_entry(struct adapter *padapter) struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); - //if(check_buddy_mlmeinfo_state(padapter, _HW_STATE_NOLINK_)) + //if(check_buddy_mlmeinfo_state(padapter, _HW_STATE_NOLINK_)) if(check_buddy_fwstate(padapter, _FW_LINKED) == _FALSE) { - rtw_hal_set_hwreg(padapter, HW_VAR_CAM_INVALID_ALL, 0); + rtw_hal_set_hwreg(padapter, HW_VAR_CAM_INVALID_ALL, 0); } else { @@ -811,7 +811,7 @@ void flush_all_cam_entry(struct adapter *padapter) psta = rtw_get_stainfo(pstapriv, pmlmeinfo->network.MacAddress); if(psta) { if(psta->state & WIFI_AP_STATE) - {} //clear cam when ap free per sta_info + {} //clear cam when ap free per sta_info else { if(psta->mac_id==2) cam_id = 5; @@ -824,17 +824,17 @@ void flush_all_cam_entry(struct adapter *padapter) } else if(check_fwstate(pmlmepriv, WIFI_AP_STATE) == _TRUE) { - //clear cam when ap free per sta_info - } + //clear cam when ap free per sta_info + } } #else //CONFIG_CONCURRENT_MODE - rtw_hal_set_hwreg(padapter, HW_VAR_CAM_INVALID_ALL, NULL); + rtw_hal_set_hwreg(padapter, HW_VAR_CAM_INVALID_ALL, NULL); #endif //CONFIG_CONCURRENT_MODE _rtw_memset((u8 *)(pmlmeinfo->FW_sta_info), 0, sizeof(pmlmeinfo->FW_sta_info)); - + } #if defined(CONFIG_P2P) && defined(CONFIG_WFD) @@ -844,7 +844,7 @@ int WFD_info_handler(struct adapter *padapter, PNDIS_802_11_VARIABLE_IEs pIE) struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); - struct wifidirect_info *pwdinfo; + struct wifidirect_info *pwdinfo; u8 wfd_ie[ 128 ] = { 0x00 }; u32 wfd_ielen = 0; @@ -854,7 +854,7 @@ int WFD_info_handler(struct adapter *padapter, PNDIS_802_11_VARIABLE_IEs pIE) { u8 attr_content[ 10 ] = { 0x00 }; u32 attr_contentlen = 0; - + DBG_871X( "[%s] Found WFD IE\n", __FUNCTION__ ); rtw_get_wfd_attr_content( wfd_ie, wfd_ielen, WFD_ATTR_DEVICE_INFO, attr_content, &attr_contentlen); if ( attr_contentlen ) @@ -862,7 +862,7 @@ int WFD_info_handler(struct adapter *padapter, PNDIS_802_11_VARIABLE_IEs pIE) pwdinfo->wfd_info->peer_rtsp_ctrlport = RTW_GET_BE16( attr_content + 2 ); DBG_8192C( "[%s] Peer PORT NUM = %d\n", __FUNCTION__, pwdinfo->wfd_info->peer_rtsp_ctrlport ); return( _TRUE ); - } + } } else { @@ -878,13 +878,13 @@ int WMM_param_handler(struct adapter *padapter, PNDIS_802_11_VARIABLE_IEs pIE) //struct registry_priv *pregpriv = &padapter->registrypriv; struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; - struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); - + struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); + if(pmlmepriv->qospriv.qos_option==0) { pmlmeinfo->WMM_enable = 0; return _FAIL; - } + } pmlmeinfo->WMM_enable = 1; _rtw_memcpy(&(pmlmeinfo->WMM_param), (pIE->data + 6), sizeof(struct WMM_para_element)); @@ -909,7 +909,7 @@ int WMM_param_handler(struct adapter *padapter, PNDIS_802_11_VARIABLE_IEs pIE) pmlmeinfo->WMM_enable = 0; return _FAIL; }*/ - + } void WMMOnAssocRsp(struct adapter *padapter) @@ -937,7 +937,7 @@ void WMMOnAssocRsp(struct adapter *padapter) else aSifsTime = 16; - for (i = 0; i < 4; i++) + for (i = 0; i < 4; i++) { ACI = (pmlmeinfo->WMM_param.ac_param[i].ACI_AIFSN >> 5) & 0x03; ACM = (pmlmeinfo->WMM_param.ac_param[i].ACI_AIFSN >> 4) & 0x01; @@ -975,7 +975,7 @@ void WMMOnAssocRsp(struct adapter *padapter) rtw_hal_set_hwreg(padapter, HW_VAR_AC_PARAM_VO, (u8 *)(&acParm)); acm_mask |= (ACM? BIT(3):0); edca[XMIT_VO_QUEUE] = acParm; - break; + break; } DBG_871X("WMM(%x): %x, %x\n", ACI, ACM, acParm); @@ -1008,7 +1008,7 @@ void WMMOnAssocRsp(struct adapter *padapter) if((edca[j] >> 16) > (edca[i] >> 16)) change_inx = _TRUE; } - + if(change_inx) { tmp = edca[i]; @@ -1030,7 +1030,7 @@ void WMMOnAssocRsp(struct adapter *padapter) DBG_871X("wmm_para_seq(%d): %d\n", i, pxmitpriv->wmm_para_seq[i]); } - return; + return; } static void bwmode_update_check(struct adapter *padapter, PNDIS_802_11_VARIABLE_IEs pIE) @@ -1052,7 +1052,7 @@ static void bwmode_update_check(struct adapter *padapter, PNDIS_802_11_VARIABLE_ if(pIE->Length > sizeof(struct HT_info_element)) return; - + pHT_info = (struct HT_info_element *)pIE->data; if((pHT_info->infos[0] & BIT(2)) && pregistrypriv->cbw40_enable ) @@ -1064,11 +1064,11 @@ static void bwmode_update_check(struct adapter *padapter, PNDIS_802_11_VARIABLE_ case 1: new_ch_offset = HAL_PRIME_CHNL_OFFSET_LOWER; break; - + case 3: new_ch_offset = HAL_PRIME_CHNL_OFFSET_UPPER; break; - + default: new_bwmode = HT_CHANNEL_WIDTH_20; new_ch_offset = HAL_PRIME_CHNL_OFFSET_DONT_CARE; @@ -1079,13 +1079,13 @@ static void bwmode_update_check(struct adapter *padapter, PNDIS_802_11_VARIABLE_ { new_bwmode = HT_CHANNEL_WIDTH_20; new_ch_offset = HAL_PRIME_CHNL_OFFSET_DONT_CARE; - } + } + - if((new_bwmode!= pmlmeext->cur_bwmode) || (new_ch_offset!=pmlmeext->cur_ch_offset)) { pmlmeinfo->bwmode_updated = _TRUE; - + pmlmeext->cur_bwmode = new_bwmode; pmlmeext->cur_ch_offset = new_ch_offset; @@ -1096,40 +1096,40 @@ static void bwmode_update_check(struct adapter *padapter, PNDIS_802_11_VARIABLE_ { pmlmeinfo->bwmode_updated = _FALSE; } - + if(_TRUE == pmlmeinfo->bwmode_updated) { struct sta_info *psta; - WLAN_BSSID_EX *cur_network = &(pmlmeinfo->network); + WLAN_BSSID_EX *cur_network = &(pmlmeinfo->network); struct sta_priv *pstapriv = &padapter->stapriv; - + //set_channel_bwmode(padapter, pmlmeext->cur_channel, pmlmeext->cur_ch_offset, pmlmeext->cur_bwmode); - + //update ap's stainfo psta = rtw_get_stainfo(pstapriv, cur_network->MacAddress); if(psta) { struct ht_priv *phtpriv_sta = &psta->htpriv; - + if(phtpriv_sta->ht_option) - { - // bwmode + { + // bwmode phtpriv_sta->bwmode = pmlmeext->cur_bwmode; - phtpriv_sta->ch_offset = pmlmeext->cur_ch_offset; + phtpriv_sta->ch_offset = pmlmeext->cur_ch_offset; } else { phtpriv_sta->bwmode = HT_CHANNEL_WIDTH_20; phtpriv_sta->ch_offset = HAL_PRIME_CHNL_OFFSET_DONT_CARE; } - + } //pmlmeinfo->bwmode_updated = _FALSE;//bwmode_updated done, reset it! - - } + + } #endif //CONFIG_80211N_HT } @@ -1141,16 +1141,16 @@ void HT_caps_handler(struct adapter *padapter, PNDIS_802_11_VARIABLE_IEs pIE) u8 max_AMPDU_len, min_MPDU_spacing; struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; + struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct ht_priv *phtpriv = &pmlmepriv->htpriv; - struct registry_priv *pregistrypriv = &padapter->registrypriv; - + struct registry_priv *pregistrypriv = &padapter->registrypriv; + if(pIE==NULL) return; - + if(phtpriv->ht_option == _FALSE) return; pmlmeinfo->HT_caps_enable = 1; - + for (i = 0; i < (pIE->Length); i++) { if (i != 2) @@ -1170,7 +1170,7 @@ void HT_caps_handler(struct adapter *padapter, PNDIS_802_11_VARIABLE_IEs pIE) { max_AMPDU_len = (pmlmeinfo->HT_caps.u.HT_cap_element.AMPDU_para & 0x3); } - + if ((pmlmeinfo->HT_caps.u.HT_cap_element.AMPDU_para & 0x1c) > (pIE->data[i] & 0x1c)) { min_MPDU_spacing = (pmlmeinfo->HT_caps.u.HT_cap_element.AMPDU_para & 0x1c); @@ -1186,7 +1186,7 @@ void HT_caps_handler(struct adapter *padapter, PNDIS_802_11_VARIABLE_IEs pIE) // Commented by Albert 2010/07/12 // Have to handle the endian issue after copying. - // HT_ext_caps didn't be used yet. + // HT_ext_caps didn't be used yet. pmlmeinfo->HT_caps.u.HT_cap_element.HT_caps_info = le16_to_cpu( pmlmeinfo->HT_caps.u.HT_cap_element.HT_caps_info ); pmlmeinfo->HT_caps.u.HT_cap_element.HT_ext_caps = le16_to_cpu( pmlmeinfo->HT_caps.u.HT_cap_element.HT_ext_caps ); @@ -1225,7 +1225,7 @@ void HT_info_handler(struct adapter *padapter, PNDIS_802_11_VARIABLE_IEs pIE) #ifdef CONFIG_80211N_HT struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; + struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct ht_priv *phtpriv = &pmlmepriv->htpriv; if(pIE==NULL) return; @@ -1235,7 +1235,7 @@ void HT_info_handler(struct adapter *padapter, PNDIS_802_11_VARIABLE_IEs pIE) if(pIE->Length > sizeof(struct HT_info_element)) return; - + pmlmeinfo->HT_info_enable = 1; _rtw_memcpy(&(pmlmeinfo->HT_info), pIE->data, pIE->Length); #endif //CONFIG_80211N_HT @@ -1249,7 +1249,7 @@ void HTOnAssocRsp(struct adapter *padapter) //struct registry_priv *pregpriv = &padapter->registrypriv; struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); - + DBG_871X("%s\n", __FUNCTION__); if ((pmlmeinfo->HT_info_enable) && (pmlmeinfo->HT_caps_enable)) @@ -1262,15 +1262,15 @@ void HTOnAssocRsp(struct adapter *padapter) //set_channel_bwmode(padapter, pmlmeext->cur_channel, pmlmeext->cur_ch_offset, pmlmeext->cur_bwmode); return; } - + //handle A-MPDU parameter field - /* + /* AMPDU_para [1:0]:Max AMPDU Len => 0:8k , 1:16k, 2:32k, 3:64k - AMPDU_para [4:2]:Min MPDU Start Spacing + AMPDU_para [4:2]:Min MPDU Start Spacing */ - max_AMPDU_len = pmlmeinfo->HT_caps.u.HT_cap_element.AMPDU_para & 0x03; - - min_MPDU_spacing = (pmlmeinfo->HT_caps.u.HT_cap_element.AMPDU_para & 0x1c) >> 2; + max_AMPDU_len = pmlmeinfo->HT_caps.u.HT_cap_element.AMPDU_para & 0x03; + + min_MPDU_spacing = (pmlmeinfo->HT_caps.u.HT_cap_element.AMPDU_para & 0x1c) >> 2; rtw_hal_set_hwreg(padapter, HW_VAR_AMPDU_MIN_SPACE, (u8 *)(&min_MPDU_spacing)); @@ -1278,7 +1278,7 @@ void HTOnAssocRsp(struct adapter *padapter) #if 0 //move to rtw_update_ht_cap() if ((pregpriv->cbw40_enable) && - (pmlmeinfo->HT_caps.u.HT_cap_element.HT_caps_info & BIT(1)) && + (pmlmeinfo->HT_caps.u.HT_cap_element.HT_caps_info & BIT(1)) && (pmlmeinfo->HT_info.infos[0] & BIT(2))) { //switch to the 40M Hz mode accoring to the AP @@ -1288,16 +1288,16 @@ void HTOnAssocRsp(struct adapter *padapter) case HT_EXTCHNL_OFFSET_UPPER: pmlmeext->cur_ch_offset = HAL_PRIME_CHNL_OFFSET_LOWER; break; - + case HT_EXTCHNL_OFFSET_LOWER: pmlmeext->cur_ch_offset = HAL_PRIME_CHNL_OFFSET_UPPER; break; - + default: pmlmeext->cur_ch_offset = HAL_PRIME_CHNL_OFFSET_DONT_CARE; break; } - + //SelectChannel(padapter, pmlmeext->cur_channel, pmlmeext->cur_ch_offset); } #endif @@ -1325,7 +1325,7 @@ void HTOnAssocRsp(struct adapter *padapter) // pmlmeinfo->HT_protection = pmlmeinfo->HT_info.infos[1] & 0x3; #endif - + } void ERP_IE_handler(struct adapter *padapter, PNDIS_802_11_VARIABLE_IEs pIE) @@ -1335,7 +1335,7 @@ void ERP_IE_handler(struct adapter *padapter, PNDIS_802_11_VARIABLE_IEs pIE) if(pIE->Length>1) return; - + pmlmeinfo->ERP_enable = 1; _rtw_memcpy(&(pmlmeinfo->ERP_IE), pIE->data, pIE->Length); } @@ -1352,7 +1352,7 @@ void VCS_update(struct adapter *padapter, struct sta_info *psta) psta->rtsen = 0; psta->cts2self = 0; break; - + case 1: //on if (pregpriv->vcs_type == 1) /* 1:RTS/CTS 2:CTS to self */ { @@ -1365,7 +1365,7 @@ void VCS_update(struct adapter *padapter, struct sta_info *psta) psta->cts2self = 1; } break; - + case 2: //auto default: if ((pmlmeinfo->ERP_enable) && (pmlmeinfo->ERP_IE & BIT(1))) @@ -1385,7 +1385,7 @@ void VCS_update(struct adapter *padapter, struct sta_info *psta) { psta->rtsen = 0; psta->cts2self = 0; - } + } break; } } @@ -1427,7 +1427,7 @@ int rtw_check_bcn_info(struct adapter *Adapter, u8 *pframe, u32 packet_len) struct HT_info_element *pht_info = NULL; struct rtw_ieee80211_ht_cap *pht_cap = NULL; u32 bcn_channel; - unsigned short ht_cap_info; + unsigned short ht_cap_info; unsigned char ht_info_infos_0; if (is_client_associated_to_ap(Adapter) == _FALSE) @@ -1479,15 +1479,15 @@ int rtw_check_bcn_info(struct adapter *Adapter, u8 *pframe, u32 packet_len) if (ht_cap_info != cur_network->BcnInfo.ht_cap_info || ((ht_info_infos_0&0x03) != (cur_network->BcnInfo.ht_info_infos_0&0x03))) { DBG_871X("%s bcn now: ht_cap_info:%x ht_info_infos_0:%x\n", __func__, - ht_cap_info, ht_info_infos_0); + ht_cap_info, ht_info_infos_0); DBG_871X("%s bcn link: ht_cap_info:%x ht_info_infos_0:%x\n", __func__, - cur_network->BcnInfo.ht_cap_info, cur_network->BcnInfo.ht_info_infos_0); + cur_network->BcnInfo.ht_cap_info, cur_network->BcnInfo.ht_info_infos_0); DBG_871X("%s bw mode change, disconnect\n", __func__); - { + { //bcn_info_update cur_network->BcnInfo.ht_cap_info = ht_cap_info; cur_network->BcnInfo.ht_info_infos_0 = ht_info_infos_0; - //to do : need to check that whether modify related register of BB or not + //to do : need to check that whether modify related register of BB or not } //goto _mismatch; } @@ -1622,31 +1622,31 @@ void update_beacon_info(struct adapter *padapter, u8 *pframe, uint pkt_len, stru unsigned int i; unsigned int len; PNDIS_802_11_VARIABLE_IEs pIE; - + #ifdef CONFIG_TDLS struct tdls_info *ptdlsinfo = &padapter->tdlsinfo; u8 tdls_prohibited[] = { 0x00, 0x00, 0x00, 0x00, 0x10 }; //bit(38): TDLS_prohibited #endif //CONFIG_TDLS - + len = pkt_len - (_BEACON_IE_OFFSET_ + WLAN_HDR_A3_LEN); for (i = 0; i < len;) { pIE = (PNDIS_802_11_VARIABLE_IEs)(pframe + (_BEACON_IE_OFFSET_ + WLAN_HDR_A3_LEN) + i); - + switch (pIE->ElementID) { -#if 0 - case _VENDOR_SPECIFIC_IE_: - //todo: to update WMM paramter set while receiving beacon +#if 0 + case _VENDOR_SPECIFIC_IE_: + //todo: to update WMM paramter set while receiving beacon if (_rtw_memcmp(pIE->data, WMM_PARA_OUI, 6)) //WMM { (WMM_param_handler(padapter, pIE))? WMMOnAssocRsp(padapter): 0; - } + } break; #endif - case _HT_EXTRA_INFO_IE_: //HT info + case _HT_EXTRA_INFO_IE_: //HT info //HT_info_handler(padapter, pIE); bwmode_update_check(padapter, pIE); break; @@ -1665,7 +1665,7 @@ void update_beacon_info(struct adapter *padapter, u8 *pframe, uint pkt_len, stru default: break; } - + i += (pIE->Length + 2); } } @@ -1676,14 +1676,14 @@ void process_csa_ie(struct adapter *padapter, u8 *pframe, uint pkt_len) unsigned int i; unsigned int len; PNDIS_802_11_VARIABLE_IEs pIE; - u8 new_ch_no = 0; - + u8 new_ch_no = 0; + len = pkt_len - (_BEACON_IE_OFFSET_ + WLAN_HDR_A3_LEN); for (i = 0; i < len;) { pIE = (PNDIS_802_11_VARIABLE_IEs)(pframe + (_BEACON_IE_OFFSET_ + WLAN_HDR_A3_LEN) + i); - + switch (pIE->ElementID) { case _CH_SWTICH_ANNOUNCE_: @@ -1694,7 +1694,7 @@ void process_csa_ie(struct adapter *padapter, u8 *pframe, uint pkt_len) default: break; } - + i += (pIE->Length + 2); } } @@ -1706,43 +1706,43 @@ unsigned int is_ap_in_tkip(struct adapter *padapter) PNDIS_802_11_VARIABLE_IEs pIE; struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); - WLAN_BSSID_EX *cur_network = &(pmlmeinfo->network); + WLAN_BSSID_EX *cur_network = &(pmlmeinfo->network); if (rtw_get_capability((WLAN_BSSID_EX *)cur_network) & WLAN_CAPABILITY_PRIVACY) { for (i = sizeof(NDIS_802_11_FIXED_IEs); i < pmlmeinfo->network.IELength;) { pIE = (PNDIS_802_11_VARIABLE_IEs)(pmlmeinfo->network.IEs + i); - + switch (pIE->ElementID) { case _VENDOR_SPECIFIC_IE_: - if ((_rtw_memcmp(pIE->data, RTW_WPA_OUI, 4)) && (_rtw_memcmp((pIE->data + 12), WPA_TKIP_CIPHER, 4))) + if ((_rtw_memcmp(pIE->data, RTW_WPA_OUI, 4)) && (_rtw_memcmp((pIE->data + 12), WPA_TKIP_CIPHER, 4))) { return _TRUE; } break; - + case _RSN_IE_2_: - if (_rtw_memcmp((pIE->data + 8), RSN_TKIP_CIPHER, 4)) + if (_rtw_memcmp((pIE->data + 8), RSN_TKIP_CIPHER, 4)) { return _TRUE; } - + default: break; } - + i += (pIE->Length + 2); } - + return _FALSE; } else { return _FALSE; } - + } unsigned int should_forbid_n_rate(struct adapter * padapter) @@ -1795,7 +1795,7 @@ unsigned int is_ap_in_wep(struct adapter *padapter) PNDIS_802_11_VARIABLE_IEs pIE; struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); - WLAN_BSSID_EX *cur_network = &(pmlmeinfo->network); + WLAN_BSSID_EX *cur_network = &(pmlmeinfo->network); if (rtw_get_capability((WLAN_BSSID_EX *)cur_network) & WLAN_CAPABILITY_PRIVACY) { @@ -1835,7 +1835,7 @@ int wifirate2_ratetbl_inx(unsigned char rate) int inx = 0; rate = rate & 0x7f; - switch (rate) + switch (rate) { case 54*2: inx = 11; @@ -1852,7 +1852,7 @@ int wifirate2_ratetbl_inx(unsigned char rate) case 24*2: inx = 8; break; - + case 18*2: inx = 7; break; @@ -1864,7 +1864,7 @@ int wifirate2_ratetbl_inx(unsigned char rate) case 9*2: inx = 5; break; - + case 6*2: inx = 4; break; @@ -1879,22 +1879,22 @@ int wifirate2_ratetbl_inx(unsigned char rate) case 2*2: inx = 1; break; - + case 1*2: inx = 0; break; } - return inx; + return inx; } unsigned int update_basic_rate(unsigned char *ptn, unsigned int ptn_sz) { unsigned int i, num_of_rate; unsigned int mask = 0; - + num_of_rate = (ptn_sz > NumRates)? NumRates: ptn_sz; - + for (i = 0; i < num_of_rate; i++) { if ((*(ptn + i)) & 0x80) @@ -1909,9 +1909,9 @@ unsigned int update_supported_rate(unsigned char *ptn, unsigned int ptn_sz) { unsigned int i, num_of_rate; unsigned int mask = 0; - + num_of_rate = (ptn_sz > NumRates)? NumRates: ptn_sz; - + for (i = 0; i < num_of_rate; i++) { mask |= 0x1 << wifirate2_ratetbl_inx(*(ptn + i)); @@ -1923,9 +1923,9 @@ unsigned int update_supported_rate(unsigned char *ptn, unsigned int ptn_sz) unsigned int update_MSC_rate(struct HT_caps_element *pHT_caps) { unsigned int mask = 0; - + mask = ((pHT_caps->u.HT_cap_element.MCS_rate[0] << 12) | (pHT_caps->u.HT_cap_element.MCS_rate[1] << 20)); - + return mask; } @@ -1934,15 +1934,15 @@ int support_short_GI(struct adapter *padapter, struct HT_caps_element *pHT_caps) unsigned char bit_offset; struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); - + if (!(pmlmeinfo->HT_enable)) return _FAIL; - + if ((pmlmeinfo->assoc_AP_vendor == HT_IOT_PEER_RALINK)) return _FAIL; - + bit_offset = (pmlmeext->cur_bwmode & HT_CHANNEL_WIDTH_40)? 6: 5; - + if (pHT_caps->u.HT_cap_element.HT_caps_info & (0x1 << bit_offset)) { return _SUCCESS; @@ -1950,7 +1950,7 @@ int support_short_GI(struct adapter *padapter, struct HT_caps_element *pHT_caps) else { return _FAIL; - } + } } unsigned char get_highest_rate_idx(u32 mask) @@ -1974,9 +1974,9 @@ unsigned char get_highest_mcs_rate(struct HT_caps_element *pHT_caps); unsigned char get_highest_mcs_rate(struct HT_caps_element *pHT_caps) { int i, mcs_rate; - + mcs_rate = (pHT_caps->u.HT_cap_element.MCS_rate[0] | (pHT_caps->u.HT_cap_element.MCS_rate[1] << 8)); - + for (i = 15; i >= 0; i--) { if (mcs_rate & (0x1 << i)) @@ -1984,7 +1984,7 @@ unsigned char get_highest_mcs_rate(struct HT_caps_element *pHT_caps) break; } } - + return i; } @@ -2001,7 +2001,7 @@ void enable_rate_adaptive(struct adapter *padapter, struct sta_info *psta) void set_sta_rate(struct adapter *padapter, struct sta_info *psta) { - //rate adaptive + //rate adaptive enable_rate_adaptive(padapter, psta); } @@ -2053,7 +2053,7 @@ unsigned char check_assoc_AP(u8 *pframe, uint len) for (i = sizeof(NDIS_802_11_FIXED_IEs); i < len;) { pIE = (PNDIS_802_11_VARIABLE_IEs)(pframe + i); - + switch (pIE->ElementID) { case _VENDOR_SPECIFIC_IE_: @@ -2112,14 +2112,14 @@ unsigned char check_assoc_AP(u8 *pframe, uint len) { break; } - + default: break; } - + i += (pIE->Length + 2); } - + if (ralink_vendor_flag && !epigram_vendor_flag) { DBG_871X("link to Ralink AP\n"); return HT_IOT_PEER_RALINK; @@ -2136,32 +2136,32 @@ void update_IOT_info(struct adapter *padapter) { struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); - + switch (pmlmeinfo->assoc_AP_vendor) { case HT_IOT_PEER_MARVELL: pmlmeinfo->turboMode_cts2self = 1; pmlmeinfo->turboMode_rtsen = 0; break; - + case HT_IOT_PEER_RALINK: pmlmeinfo->turboMode_cts2self = 0; pmlmeinfo->turboMode_rtsen = 1; - //disable high power + //disable high power Switch_DM_Func(padapter, (~DYNAMIC_BB_DYNAMIC_TXPWR), _FALSE); break; case HT_IOT_PEER_REALTEK: //rtw_write16(padapter, 0x4cc, 0xffff); //rtw_write16(padapter, 0x546, 0x01c0); - //disable high power + //disable high power Switch_DM_Func(padapter, (~DYNAMIC_BB_DYNAMIC_TXPWR), _FALSE); break; default: pmlmeinfo->turboMode_cts2self = 0; pmlmeinfo->turboMode_rtsen = 1; - break; + break; } - + } void update_capinfo(struct adapter *Adapter, u16 updateCap) @@ -2174,7 +2174,7 @@ void update_capinfo(struct adapter *Adapter, u16 updateCap) // Mark to update preamble value forever, 2008.03.18 by lanhsin //if( pMgntInfo->RegPreambleMode == PREAMBLE_AUTO ) { - + if(updateCap & cShortPreamble) { // Short Preamble if(pmlmeinfo->preamble_mode != PREAMBLE_SHORT) // PREAMBLE_LONG or PREAMBLE_AUTO @@ -2228,8 +2228,8 @@ void update_capinfo(struct adapter *Adapter, u16 updateCap) //B Mode pmlmeinfo->slotTime = NON_SHORT_SLOT_TIME; } - } - + } + rtw_hal_set_hwreg( Adapter, HW_VAR_SLOT_TIME, &pmlmeinfo->slotTime ); } @@ -2240,7 +2240,7 @@ void update_wireless_mode(struct adapter *padapter) u32 SIFS_Timer; struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); - WLAN_BSSID_EX *cur_network = &(pmlmeinfo->network); + WLAN_BSSID_EX *cur_network = &(pmlmeinfo->network); unsigned char *rate = cur_network->SupportedRates; ratelen = rtw_get_rateset_len(cur_network->SupportedRates); @@ -2265,7 +2265,7 @@ void update_wireless_mode(struct adapter *padapter) { network_type = WIRELESS_11_24N; } - + if ((cckratesonly_included(rate, ratelen)) == _TRUE) { network_type |= WIRELESS_11B; @@ -2288,10 +2288,10 @@ void update_wireless_mode(struct adapter *padapter) else SIFS_Timer = 0x0e0e;//pHalData->SifsTime; //OFDM */ - + SIFS_Timer = 0x0a0a0808; //0x0808 -> for CCK, 0x0a0a -> for OFDM //change this value if having IOT issues. - + padapter->HalFunc.SetHwRegHandler( padapter, HW_VAR_RESP_SIFS, (u8 *)&SIFS_Timer); if (pmlmeext->cur_wireless_mode & WIRELESS_11B) @@ -2311,21 +2311,21 @@ void fire_write_MAC_cmd(struct adapter *padapter, unsigned int addr, unsigned in if ((ph2c = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj))) == NULL) { return; - } + } - if ((pwriteMacPara = (struct reg_rw_parm*)rtw_malloc(sizeof(struct reg_rw_parm))) == NULL) - { + if ((pwriteMacPara = (struct reg_rw_parm*)rtw_malloc(sizeof(struct reg_rw_parm))) == NULL) + { rtw_mfree((unsigned char *)ph2c, sizeof(struct cmd_obj)); return; } - + pwriteMacPara->rw = 1; pwriteMacPara->addr = addr; pwriteMacPara->value = value; - + init_h2fwcmd_w_parm_no_rsp(ph2c, pwriteMacPara, GEN_CMD_CODE(_Write_MACREG)); rtw_enqueue_cmd(pcmdpriv, ph2c); -#endif +#endif } void update_bmc_sta_support_rate(struct adapter *padapter, u32 mac_id) @@ -2351,16 +2351,16 @@ int update_sta_support_rate(struct adapter *padapter, u8* pvar_ie, uint var_ie_l int supportRateNum = 0; struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); - + pIE = (PNDIS_802_11_VARIABLE_IEs)rtw_get_ie(pvar_ie, _SUPPORTEDRATES_IE_, &ie_len, var_ie_len); if (pIE == NULL) { return _FAIL; } - + _rtw_memcpy(pmlmeinfo->FW_sta_info[cam_idx].SupportedRates, pIE->data, ie_len); supportRateNum = ie_len; - + pIE = (PNDIS_802_11_VARIABLE_IEs)rtw_get_ie(pvar_ie, _EXT_SUPPORTEDRATES_IE_, &ie_len, var_ie_len); if (pIE) { @@ -2368,15 +2368,15 @@ int update_sta_support_rate(struct adapter *padapter, u8* pvar_ie, uint var_ie_l } return _SUCCESS; - + } void process_addba_req(struct adapter *padapter, u8 *paddba_req, u8 *addr) { struct sta_info *psta; - u16 tid, start_seq, param; + u16 tid, start_seq, param; struct recv_reorder_ctrl *preorder_ctrl; - struct sta_priv *pstapriv = &padapter->stapriv; + struct sta_priv *pstapriv = &padapter->stapriv; struct ADDBA_request *preq = (struct ADDBA_request*)paddba_req; struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); @@ -2386,10 +2386,10 @@ void process_addba_req(struct adapter *padapter, u8 *paddba_req, u8 *addr) if(psta) { start_seq = le16_to_cpu(preq->BA_starting_seqctrl) >> 4; - + param = le16_to_cpu(preq->BA_para_set); tid = (param>>2)&0x0f; - + preorder_ctrl = &psta->recvreorder_ctrl[tid]; #ifdef CONFIG_UPDATE_INDICATE_SEQ_WHILE_PROCESS_ADDBA_REQ @@ -2401,22 +2401,22 @@ void process_addba_req(struct adapter *padapter, u8 *paddba_req, u8 *addr) #else preorder_ctrl->indicate_seq = 0xffff; #endif - + preorder_ctrl->enable =(pmlmeinfo->bAcceptAddbaReq == _TRUE)? _TRUE :_FALSE; } } void update_TSF(struct mlme_ext_priv *pmlmeext, u8 *pframe, uint len) -{ +{ u8* pIE; u32 *pbuf; - + pIE = pframe + sizeof(struct rtw_ieee80211_hdr_3addr); pbuf = (u32*)pIE; pmlmeext->TSFValue = le32_to_cpu(*(pbuf+1)); - + pmlmeext->TSFValue = pmlmeext->TSFValue << 32; pmlmeext->TSFValue |= le32_to_cpu(*pbuf); @@ -2437,32 +2437,32 @@ unsigned int setup_beacon_frame(struct adapter *padapter, unsigned char *beacon_ { unsigned short ATIMWindow; unsigned char *pframe; - struct tx_desc *ptxdesc; - struct rtw_ieee80211_hdr *pwlanhdr; + struct tx_desc *ptxdesc; + struct rtw_ieee80211_hdr *pwlanhdr; unsigned short *fctrl; unsigned int rate_len, len = 0; struct xmit_priv *pxmitpriv = &(padapter->xmitpriv); struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); - WLAN_BSSID_EX *cur_network = &(pmlmeinfo->network); + WLAN_BSSID_EX *cur_network = &(pmlmeinfo->network); u8 bc_addr[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; - + _rtw_memset(beacon_frame, 0, 256); - + pframe = beacon_frame + TXDESC_SIZE; - - pwlanhdr = (struct rtw_ieee80211_hdr *)pframe; - + + pwlanhdr = (struct rtw_ieee80211_hdr *)pframe; + fctrl = &(pwlanhdr->frame_ctl); *(fctrl) = 0; - + _rtw_memcpy(pwlanhdr->addr1, bc_addr, ETH_ALEN); _rtw_memcpy(pwlanhdr->addr2, myid(&(padapter->eeprompriv)), ETH_ALEN); _rtw_memcpy(pwlanhdr->addr3, get_my_bssid(cur_network), ETH_ALEN); - + SetFrameSubType(pframe, WIFI_BEACON); - - pframe += sizeof(struct rtw_ieee80211_hdr_3addr); + + pframe += sizeof(struct rtw_ieee80211_hdr_3addr); len = sizeof(struct rtw_ieee80211_hdr_3addr); //timestamp will be inserted by hardware @@ -2470,7 +2470,7 @@ unsigned int setup_beacon_frame(struct adapter *padapter, unsigned char *beacon_ len += 8; // beacon interval: 2 bytes - _rtw_memcpy(pframe, (unsigned char *)(rtw_get_beacon_interval_from_ie(cur_network->IEs)), 2); + _rtw_memcpy(pframe, (unsigned char *)(rtw_get_beacon_interval_from_ie(cur_network->IEs)), 2); pframe += 2; len += 2; @@ -2497,7 +2497,7 @@ unsigned int setup_beacon_frame(struct adapter *padapter, unsigned char *beacon_ pframe = rtw_set_ie(pframe, _IBSS_PARA_IE_, 2, (unsigned char *)(&ATIMWindow), &len); //todo: ERP IE - + // EXTERNDED SUPPORTED RATE if (rate_len > 8) { @@ -2512,24 +2512,24 @@ unsigned int setup_beacon_frame(struct adapter *padapter, unsigned char *beacon_ //fill the tx descriptor ptxdesc = (struct tx_desc *)beacon_frame; - - //offset 0 - ptxdesc->txdw0 |= cpu_to_le32(len & 0x0000ffff); + + //offset 0 + ptxdesc->txdw0 |= cpu_to_le32(len & 0x0000ffff); ptxdesc->txdw0 |= cpu_to_le32(((TXDESC_SIZE + OFFSET_SZ) << OFFSET_SHT) & 0x00ff0000); //default = 32 bytes for TX Desc - - //offset 4 + + //offset 4 ptxdesc->txdw1 |= cpu_to_le32((0x10 << QSEL_SHT) & 0x00001f00); - - //offset 8 + + //offset 8 ptxdesc->txdw2 |= cpu_to_le32(BMC); ptxdesc->txdw2 |= cpu_to_le32(BK); - //offset 16 + //offset 16 ptxdesc->txdw4 = 0x80000000; - + //offset 20 - ptxdesc->txdw5 = 0x00000000; //1M - + ptxdesc->txdw5 = 0x00000000; //1M + return (len + TXDESC_SIZE); } #endif @@ -2551,7 +2551,7 @@ int rtw_handle_dualmac(struct adapter *adapter, bool init) goto exit; } #endif - + if (pbuddy_padapter == NULL) { pbuddy_padapter = adapter; DBG_871X("%s(): pbuddy_padapter == NULL, Set pbuddy_padapter\n",__FUNCTION__); @@ -2590,7 +2590,7 @@ void rtw_get_current_ip_address(struct adapter *padapter, u8 *pcurrentip) struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); struct in_device *my_ip_ptr = padapter->pnetdev->ip_ptr; u8 ipaddress[4]; - + if ( (pmlmeinfo->state & WIFI_FW_LINKING_STATE) ) { if ( my_ip_ptr != NULL ) { struct in_ifaddr *my_ifa_list = my_ip_ptr->ifa_list ; @@ -2599,7 +2599,7 @@ void rtw_get_current_ip_address(struct adapter *padapter, u8 *pcurrentip) ipaddress[1] = (my_ifa_list->ifa_address >> 8) & 0xFF; ipaddress[2] = (my_ifa_list->ifa_address >> 16) & 0xFF; ipaddress[3] = my_ifa_list->ifa_address >> 24; - DBG_871X("%s: %d.%d.%d.%d ==========\n", __func__, + DBG_871X("%s: %d.%d.%d.%d ==========\n", __func__, ipaddress[0], ipaddress[1], ipaddress[2], ipaddress[3]); _rtw_memcpy(pcurrentip, ipaddress, 4); } @@ -2613,9 +2613,9 @@ void rtw_get_sec_iv(struct adapter *padapter, u8*pcur_dot11txpn, u8 *StaAddr) _rtw_memset(pcur_dot11txpn, 0, 8); if(NULL == StaAddr) - return; + return; psta = rtw_get_stainfo(&padapter->stapriv, StaAddr); - DBG_871X("%s(): StaAddr: %2.2x:%2.2x:%2.2x:%2.2x:%2.2x:%2.2x\n", + DBG_871X("%s(): StaAddr: %2.2x:%2.2x:%2.2x:%2.2x:%2.2x:%2.2x\n", __func__, StaAddr[0], StaAddr[1], StaAddr[2], StaAddr[3], StaAddr[4], StaAddr[5]); if(psta) diff --git a/core/rtw_xmit.c b/core/rtw_xmit.c index 4bd7b36..c183649 100755 --- a/core/rtw_xmit.c +++ b/core/rtw_xmit.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Copyright(c) 2007 - 2012 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. @@ -42,19 +42,19 @@ _func_enter_; _rtw_init_listhead(&ptxservq->tx_pending); _rtw_init_queue(&ptxservq->sta_pending); ptxservq->qcnt = 0; -_func_exit_; +_func_exit_; } void _rtw_init_sta_xmit_priv(struct sta_xmit_priv *psta_xmitpriv) -{ - +{ + _func_enter_; _rtw_memset((unsigned char *)psta_xmitpriv, 0, sizeof (struct sta_xmit_priv)); _rtw_spinlock_init(&psta_xmitpriv->lock); - + //for(i = 0 ; i < MAX_NUMBLKS; i++) // _init_txservq(&(psta_xmitpriv->blk_q[i])); @@ -64,8 +64,8 @@ _func_enter_; _init_txservq(&psta_xmitpriv->vo_q); _rtw_init_listhead(&psta_xmitpriv->legacy_dz); _rtw_init_listhead(&psta_xmitpriv->apsd); - -_func_exit_; + +_func_exit_; } @@ -74,29 +74,29 @@ s32 _rtw_init_xmit_priv(struct xmit_priv *pxmitpriv, struct adapter *padapter) int i; struct xmit_buf *pxmitbuf; struct xmit_frame *pxframe; - sint res=_SUCCESS; + sint res=_SUCCESS; u32 max_xmit_extbuf_size = MAX_XMIT_EXTBUF_SZ; u32 num_xmit_extbuf = NR_XMIT_EXTBUFF; -_func_enter_; +_func_enter_; // We don't need to memset padapter->XXX to zero, because adapter is allocated by rtw_zvmalloc(). //_rtw_memset((unsigned char *)pxmitpriv, 0, sizeof(struct xmit_priv)); - + _rtw_spinlock_init(&pxmitpriv->lock); _rtw_spinlock_init(&pxmitpriv->lock_sctx); _rtw_init_sema(&pxmitpriv->xmit_sema, 0); _rtw_init_sema(&pxmitpriv->terminate_xmitthread_sema, 0); - /* + /* Please insert all the queue initializaiton using _rtw_init_queue below */ pxmitpriv->adapter = padapter; - + //for(i = 0 ; i < MAX_NUMBLKS; i++) // _rtw_init_queue(&pxmitpriv->blk_strms[i]); - + _rtw_init_queue(&pxmitpriv->be_pending); _rtw_init_queue(&pxmitpriv->bk_pending); _rtw_init_queue(&pxmitpriv->vi_pending); @@ -108,17 +108,17 @@ _func_enter_; _rtw_init_queue(&pxmitpriv->free_xmit_queue); - /* - Please allocate memory with the sz = (struct xmit_frame) * NR_XMITFRAME, + /* + Please allocate memory with the sz = (struct xmit_frame) * NR_XMITFRAME, and initialize free_xmit_frame below. Please also apply free_txobj to link_up all the xmit_frames... */ pxmitpriv->pallocated_frame_buf = rtw_zvmalloc(NR_XMITFRAME * sizeof(struct xmit_frame) + 4); - + if (pxmitpriv->pallocated_frame_buf == NULL){ pxmitpriv->pxmit_frame_buf =NULL; - RT_TRACE(_module_rtl871x_xmit_c_,_drv_err_,("alloc xmit_frame fail!\n")); + RT_TRACE(_module_rtl871x_xmit_c_,_drv_err_,("alloc xmit_frame fail!\n")); res= _FAIL; goto exit; } @@ -135,11 +135,11 @@ _func_enter_; pxframe->padapter = padapter; pxframe->frame_tag = NULL_FRAMETAG; - pxframe->pkt = NULL; + pxframe->pkt = NULL; pxframe->buf_addr = NULL; pxframe->pxmitbuf = NULL; - + rtw_list_insert_tail(&(pxframe->list), &(pxmitpriv->free_xmit_queue.queue)); pxframe++; @@ -155,7 +155,7 @@ _func_enter_; _rtw_init_queue(&pxmitpriv->pending_xmitbuf_queue); pxmitpriv->pallocated_xmitbuf = rtw_zvmalloc(NR_XMITBUFF * sizeof(struct xmit_buf) + 4); - + if (pxmitpriv->pallocated_xmitbuf == NULL){ RT_TRACE(_module_rtl871x_xmit_c_,_drv_err_,("alloc xmit_buf fail!\n")); res= _FAIL; @@ -211,19 +211,19 @@ _func_enter_; #endif pxmitbuf++; - + } pxmitpriv->free_xmitbuf_cnt = NR_XMITBUFF; /* init xframe_ext queue, the same count as extbuf */ _rtw_init_queue(&pxmitpriv->free_xframe_ext_queue); - + pxmitpriv->xframe_ext_alloc_addr = rtw_zvmalloc(num_xmit_extbuf * sizeof(struct xmit_frame) + 4); - + if (pxmitpriv->xframe_ext_alloc_addr == NULL){ pxmitpriv->xframe_ext = NULL; - RT_TRACE(_module_rtl871x_xmit_c_,_drv_err_,("alloc xframe_ext fail!\n")); + RT_TRACE(_module_rtl871x_xmit_c_,_drv_err_,("alloc xframe_ext fail!\n")); res= _FAIL; goto exit; } @@ -236,13 +236,13 @@ _func_enter_; pxframe->padapter = padapter; pxframe->frame_tag = NULL_FRAMETAG; - pxframe->pkt = NULL; + pxframe->pkt = NULL; pxframe->buf_addr = NULL; pxframe->pxmitbuf = NULL; - + pxframe->ext_tag = 1; - + rtw_list_insert_tail(&(pxframe->list), &(pxmitpriv->free_xframe_ext_queue.queue)); pxframe++; @@ -253,7 +253,7 @@ _func_enter_; _rtw_init_queue(&pxmitpriv->free_xmit_extbuf_queue); pxmitpriv->pallocated_xmit_extbuf = rtw_zvmalloc(num_xmit_extbuf * sizeof(struct xmit_buf) + 4); - + if (pxmitpriv->pallocated_xmit_extbuf == NULL){ RT_TRACE(_module_rtl871x_xmit_c_,_drv_err_,("alloc xmit_extbuf fail!\n")); res= _FAIL; @@ -281,13 +281,13 @@ _func_enter_; } pxmitbuf->pbuf = (u8 *)N_BYTE_ALIGMENT((SIZE_PTR)(pxmitbuf->pallocated_buf), 4); -*/ +*/ if((res=rtw_os_xmit_resource_alloc(padapter, pxmitbuf,max_xmit_extbuf_size + XMITBUF_ALIGN_SZ)) == _FAIL) { res= _FAIL; goto exit; } - + #if defined(CONFIG_SDIO_HCI) || defined(CONFIG_GSPI_HCI) pxmitbuf->phead = pxmitbuf->pbuf; pxmitbuf->pend = pxmitbuf->pbuf + max_xmit_extbuf_size; @@ -300,7 +300,7 @@ _func_enter_; pxmitbuf->no=i; #endif pxmitbuf++; - + } pxmitpriv->free_xmit_extbuf_cnt = num_xmit_extbuf; @@ -329,14 +329,14 @@ _func_enter_; #ifdef CONFIG_XMIT_ACK pxmitpriv->ack_tx = _FALSE; _rtw_mutex_init(&pxmitpriv->ack_tx_mutex); - rtw_sctx_init(&pxmitpriv->ack_tx_ops, 0); + rtw_sctx_init(&pxmitpriv->ack_tx_ops, 0); #endif rtw_hal_init_xmit_priv(padapter); exit: -_func_exit_; +_func_exit_; return res; } @@ -371,37 +371,37 @@ void _rtw_free_xmit_priv (struct xmit_priv *pxmitpriv) struct xmit_buf *pxmitbuf = (struct xmit_buf *)pxmitpriv->pxmitbuf; u32 max_xmit_extbuf_size = MAX_XMIT_EXTBUF_SZ; u32 num_xmit_extbuf = NR_XMIT_EXTBUFF; - - _func_enter_; + + _func_enter_; rtw_hal_free_xmit_priv(padapter); - + rtw_mfree_xmit_priv_lock(pxmitpriv); - - if(pxmitpriv->pxmit_frame_buf==NULL) + + if(pxmitpriv->pxmit_frame_buf==NULL) goto out; - + for(i=0; ipallocated_buf) // rtw_mfree(pxmitbuf->pallocated_buf, MAX_XMITBUF_SZ + XMITBUF_ALIGN_SZ); - + pxmitbuf++; } if(pxmitpriv->pallocated_frame_buf) { rtw_vmfree(pxmitpriv->pallocated_frame_buf, NR_XMITFRAME * sizeof(struct xmit_frame) + 4); } - + if(pxmitpriv->pallocated_xmitbuf) { rtw_vmfree(pxmitpriv->pallocated_xmitbuf, NR_XMITBUFF * sizeof(struct xmit_buf) + 4); @@ -428,7 +428,7 @@ void _rtw_free_xmit_priv (struct xmit_priv *pxmitpriv) //if(pxmitbuf->pallocated_buf) // rtw_mfree(pxmitbuf->pallocated_buf, max_xmit_extbuf_size); - + pxmitbuf++; } @@ -438,13 +438,13 @@ void _rtw_free_xmit_priv (struct xmit_priv *pxmitpriv) rtw_free_hwxmits(padapter); -#ifdef CONFIG_XMIT_ACK - _rtw_mutex_free(&pxmitpriv->ack_tx_mutex); -#endif +#ifdef CONFIG_XMIT_ACK + _rtw_mutex_free(&pxmitpriv->ack_tx_mutex); +#endif -out: +out: -_func_exit_; +_func_exit_; } @@ -533,8 +533,8 @@ static void update_attrib_vcs_info(struct adapter *padapter, struct xmit_frame * { pattrib->vcs_mode = CTS_TO_SELF; break; - } - + } + //check ERP protection if(psta->rtsen || psta->cts2self) @@ -583,20 +583,20 @@ static void update_attrib_vcs_info(struct adapter *padapter, struct xmit_frame * static void update_attrib_phy_info(struct pkt_attrib *pattrib, struct sta_info *psta) { - /*if(psta->rtsen) - pattrib->vcs_mode = RTS_CTS; - else if(psta->cts2self) - pattrib->vcs_mode = CTS_TO_SELF; + /*if(psta->rtsen) + pattrib->vcs_mode = RTS_CTS; + else if(psta->cts2self) + pattrib->vcs_mode = CTS_TO_SELF; else pattrib->vcs_mode = NONE_VCS;*/ - + pattrib->mdata = 0; pattrib->eosp = 0; pattrib->triggered=0; - + //qos_en, ht_en, init rate, ,bw, ch_offset, sgi pattrib->qos_en = psta->qos_option; - + pattrib->raid = psta->raid; #ifdef CONFIG_80211N_HT pattrib->ht_en = psta->htpriv.ht_option; @@ -609,7 +609,7 @@ static void update_attrib_phy_info(struct pkt_attrib *pattrib, struct sta_info * //{ // if(psta->htpriv.agg_enable_bitmap & BIT(pattrib->priority)) // pattrib->ampdu_en = _TRUE; - //} + //} pattrib->retry_ctrl = _FALSE; @@ -719,7 +719,7 @@ static s32 update_attrib(struct adapter *padapter, _pkt *pkt, struct pkt_attrib if (ETH_P_IP == pattrib->ether_type) { - // The following is for DHCP and ARP packet, we use cck1M to tx these packets and let LPS awake some time + // The following is for DHCP and ARP packet, we use cck1M to tx these packets and let LPS awake some time // to prevent DHCP protocol fail u8 tmp[24]; _rtw_pktfile_read(&pktfile, &tmp[0], 24); @@ -732,14 +732,14 @@ static s32 update_attrib(struct adapter *padapter, _pkt *pkt, struct pkt_attrib // 67 : UDP BOOTP server RT_TRACE(_module_rtl871x_xmit_c_,_drv_err_,("======================update_attrib: get DHCP Packet \n")); // Use low rate to send DHCP packet. - //if(pMgntInfo->IOTAction & HT_IOT_ACT_WA_IOT_Broadcom) + //if(pMgntInfo->IOTAction & HT_IOT_ACT_WA_IOT_Broadcom) //{ // tcb_desc->DataRate = MgntQuery_TxRateExcludeCCKRates(ieee);//0xc;//ofdm 6m // tcb_desc->bTxDisableRateFallBack = false; //} //else - // pTcb->DataRate = Adapter->MgntInfo.LowestBasicRate; - //RTPRINT(FDM, WA_IOT, ("DHCP TranslateHeader(), pTcb->DataRate = 0x%x\n", pTcb->DataRate)); + // pTcb->DataRate = Adapter->MgntInfo.LowestBasicRate; + //RTPRINT(FDM, WA_IOT, ("DHCP TranslateHeader(), pTcb->DataRate = 0x%x\n", pTcb->DataRate)); pattrib->dhcp_pkt = 1; } } @@ -766,7 +766,7 @@ static s32 update_attrib(struct adapter *padapter, _pkt *pkt, struct pkt_attrib #endif bmcast = IS_MCAST(pattrib->ra); - + // get sta_info if (bmcast) { psta = rtw_get_bcmc_stainfo(padapter); @@ -809,9 +809,9 @@ static s32 update_attrib(struct adapter *padapter, _pkt *pkt, struct pkt_attrib pattrib->pkt_hdrlen = ETH_HLEN;//(pattrib->ether_type == 0x8100) ? (14 + 4 ): 14; //vlan tag pattrib->hdrlen = WLAN_HDR_A3_LEN; - pattrib->subtype = WIFI_DATA_TYPE; + pattrib->subtype = WIFI_DATA_TYPE; pattrib->priority = 0; - + if (check_fwstate(pmlmepriv, WIFI_AP_STATE|WIFI_ADHOC_STATE|WIFI_ADHOC_MASTER_STATE)) { if(psta->qos_option) @@ -861,12 +861,12 @@ static s32 update_attrib(struct adapter *padapter, _pkt *pkt, struct pkt_attrib { case dot11AuthAlgrthm_Open: case dot11AuthAlgrthm_Shared: - case dot11AuthAlgrthm_Auto: + case dot11AuthAlgrthm_Auto: pattrib->key_idx = (u8)psecuritypriv->dot11PrivacyKeyIndex; break; case dot11AuthAlgrthm_8021X: - if(bmcast) - pattrib->key_idx = (u8)psecuritypriv->dot118021XGrpKeyid; + if(bmcast) + pattrib->key_idx = (u8)psecuritypriv->dot118021XGrpKeyid; else pattrib->key_idx = 0; break; @@ -874,8 +874,8 @@ static s32 update_attrib(struct adapter *padapter, _pkt *pkt, struct pkt_attrib pattrib->key_idx = 0; break; } - - + + } switch (pattrib->encrypt) @@ -889,7 +889,7 @@ static s32 update_attrib(struct adapter *padapter, _pkt *pkt, struct pkt_attrib case _TKIP_: pattrib->iv_len = 8; pattrib->icv_len = 4; - + if(padapter->securitypriv.busetkipkey==_FAIL) { RT_TRACE(_module_rtl871x_xmit_c_,_drv_err_,("\npadapter->securitypriv.busetkipkey(%d)==_FAIL drop packet\n", padapter->securitypriv.busetkipkey)); @@ -899,14 +899,14 @@ static s32 update_attrib(struct adapter *padapter, _pkt *pkt, struct pkt_attrib res =_FAIL; goto exit; } - - break; + + break; case _AES_: RT_TRACE(_module_rtl871x_xmit_c_,_drv_info_,("pattrib->encrypt=%d (_AES_)\n",pattrib->encrypt)); pattrib->iv_len = 8; pattrib->icv_len = 8; break; - + #ifdef CONFIG_WAPI_SUPPORT case _SMS4_: pattrib->iv_len = 18; @@ -960,13 +960,13 @@ _func_exit_; } static s32 xmitframe_addmic(struct adapter *padapter, struct xmit_frame *pxmitframe){ - sint curfragnum,length; + sint curfragnum,length; u8 *pframe, *payload,mic[8]; struct mic_data micdata; struct sta_info *stainfo; - struct qos_priv *pqospriv= &(padapter->mlmepriv.qospriv); + struct qos_priv *pqospriv= &(padapter->mlmepriv.qospriv); struct pkt_attrib *pattrib = &pxmitframe->attrib; - struct security_priv *psecuritypriv=&padapter->securitypriv; + struct security_priv *psecuritypriv=&padapter->securitypriv; struct xmit_priv *pxmitpriv=&padapter->xmitpriv; u8 priority[4]={0x0,0x0,0x0,0x0}; u8 hw_hdr_offset = 0; @@ -980,8 +980,8 @@ static s32 xmitframe_addmic(struct adapter *padapter, struct xmit_frame *pxmitfr { DBG_871X("%s, call rtw_get_stainfo()\n", __func__); stainfo=rtw_get_stainfo(&padapter->stapriv ,&pattrib->ra[0]); - } - + } + if(stainfo==NULL) { DBG_871X("%s, psta==NUL\n", __func__); @@ -997,30 +997,30 @@ static s32 xmitframe_addmic(struct adapter *padapter, struct xmit_frame *pxmitfr _func_enter_; #ifdef CONFIG_USB_TX_AGGREGATION - hw_hdr_offset = TXDESC_SIZE + (pxmitframe->pkt_offset * PACKET_OFFSET_SZ);; + hw_hdr_offset = TXDESC_SIZE + (pxmitframe->pkt_offset * PACKET_OFFSET_SZ);; #else #ifdef CONFIG_TX_EARLY_MODE hw_hdr_offset = TXDESC_OFFSET+ EARLY_MODE_INFO_SIZE; #else hw_hdr_offset = TXDESC_OFFSET; #endif -#endif - - if(pattrib->encrypt ==_TKIP_)//if(psecuritypriv->dot11PrivacyAlgrthm==_TKIP_PRIVACY_) +#endif + + if(pattrib->encrypt ==_TKIP_)//if(psecuritypriv->dot11PrivacyAlgrthm==_TKIP_PRIVACY_) { //encode mic code if(stainfo!= NULL){ u8 null_key[16]={0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0}; pframe = pxmitframe->buf_addr + hw_hdr_offset; - + if(bmcst) { if(_rtw_memcmp(psecuritypriv->dot118021XGrptxmickey[psecuritypriv->dot118021XGrpKeyid].skey, null_key, 16)==_TRUE){ //DbgPrint("\nxmitframe_addmic:stainfo->dot11tkiptxmickey==0\n"); //rtw_msleep_os(10); return _FAIL; - } + } //start to calculate the mic code rtw_secmicsetkey(&micdata, psecuritypriv->dot118021XGrptxmickey[psecuritypriv->dot118021XGrpKeyid].skey); } @@ -1034,14 +1034,14 @@ _func_enter_; //start to calculate the mic code rtw_secmicsetkey(&micdata, &stainfo->dot11tkiptxmickey.skey[0]); } - + if(pframe[1]&1){ //ToDS==1 rtw_secmicappend(&micdata, &pframe[16], 6); //DA if(pframe[1]&2) //From Ds==1 rtw_secmicappend(&micdata, &pframe[24], 6); else - rtw_secmicappend(&micdata, &pframe[10], 6); - } + rtw_secmicappend(&micdata, &pframe[10], 6); + } else{ //ToDS==0 rtw_secmicappend(&micdata, &pframe[4], 6); //DA if(pframe[1]&2) //From Ds==1 @@ -1055,9 +1055,9 @@ _func_enter_; if(pattrib->qos_en) priority[0]=(u8)pxmitframe->attrib.priority; - + rtw_secmicappend(&micdata, &priority[0], 4); - + payload=pframe; for(curfragnum=0;curfragnumnr_frags;curfragnum++){ @@ -1089,7 +1089,7 @@ _func_enter_; _rtw_memcpy(payload, &(mic[0]),8); pattrib->last_txcmdsz+=8; - + RT_TRACE(_module_rtl871x_xmit_c_,_drv_info_,("\n ========last pkt========\n")); payload=payload-pattrib->last_txcmdsz+8; for(curfragnum=0;curfragnumlast_txcmdsz;curfragnum=curfragnum+8) @@ -1101,7 +1101,7 @@ _func_enter_; RT_TRACE(_module_rtl871x_xmit_c_,_drv_err_,("xmitframe_addmic: rtw_get_stainfo==NULL!!!\n")); } } - + _func_exit_; return _SUCCESS; @@ -1110,11 +1110,11 @@ _func_exit_; static s32 xmitframe_swencrypt(struct adapter *padapter, struct xmit_frame *pxmitframe){ struct pkt_attrib *pattrib = &pxmitframe->attrib; - //struct security_priv *psecuritypriv=&padapter->securitypriv; - + //struct security_priv *psecuritypriv=&padapter->securitypriv; + _func_enter_; - //if((psecuritypriv->sw_encrypt)||(pattrib->bswenc)) + //if((psecuritypriv->sw_encrypt)||(pattrib->bswenc)) if(pattrib->bswenc) { //DBG_871X("start xmitframe_swencrypt\n"); @@ -1157,7 +1157,7 @@ s32 rtw_make_wlanhdr (struct adapter *padapter , u8 *hdr, struct pkt_attrib *pat u8 qos_option = _FALSE; #ifdef CONFIG_TDLS struct tdls_info *ptdlsinfo = &padapter->tdlsinfo; - struct sta_priv *pstapriv = &padapter->stapriv; + struct sta_priv *pstapriv = &padapter->stapriv; struct sta_info *ptdls_sta=NULL, *psta_backup=NULL; u8 direct_link=0; #endif //CONFIG_TDLS @@ -1214,20 +1214,20 @@ _func_enter_; }else{ // 1.Data transfer to AP // 2.Arp pkt will relayed by AP - SetToDs(fctrl); + SetToDs(fctrl); _rtw_memcpy(pwlanhdr->addr1, get_bssid(pmlmepriv), ETH_ALEN); _rtw_memcpy(pwlanhdr->addr2, pattrib->src, ETH_ALEN); _rtw_memcpy(pwlanhdr->addr3, pattrib->dst, ETH_ALEN); - } + } }else #endif //CONFIG_TDLS { //Data transfer to AP - SetToDs(fctrl); + SetToDs(fctrl); _rtw_memcpy(pwlanhdr->addr1, get_bssid(pmlmepriv), ETH_ALEN); _rtw_memcpy(pwlanhdr->addr2, pattrib->src, ETH_ALEN); _rtw_memcpy(pwlanhdr->addr3, pattrib->dst, ETH_ALEN); - } + } if (pqospriv->qos_option) qos_option = _TRUE; @@ -1240,7 +1240,7 @@ _func_enter_; _rtw_memcpy(pwlanhdr->addr2, get_bssid(pmlmepriv), ETH_ALEN); _rtw_memcpy(pwlanhdr->addr3, pattrib->src, ETH_ALEN); - if(psta->qos_option) + if(psta->qos_option) qos_option = _TRUE; } else if ((check_fwstate(pmlmepriv, WIFI_ADHOC_STATE) == _TRUE) || @@ -1249,7 +1249,7 @@ _func_enter_; _rtw_memcpy(pwlanhdr->addr2, pattrib->src, ETH_ALEN); _rtw_memcpy(pwlanhdr->addr3, get_bssid(pmlmepriv), ETH_ALEN); - if(psta->qos_option) + if(psta->qos_option) qos_option = _TRUE; } else { @@ -1306,11 +1306,11 @@ _func_enter_; //re-check if enable ampdu by BA_starting_seqctrl if(pattrib->ampdu_en == _TRUE) - { + { u16 tx_seq; tx_seq = psta->BA_starting_seqctrl[pattrib->priority & 0x0f]; - + //check BA_starting_seqctrl if(SN_LESS(pattrib->seqnum, tx_seq)) { @@ -1318,9 +1318,9 @@ _func_enter_; pattrib->ampdu_en = _FALSE;//AGG BK } else if(SN_EQUAL(pattrib->seqnum, tx_seq)) - { + { psta->BA_starting_seqctrl[pattrib->priority & 0x0f] = (tx_seq+1)&0xfff; - + pattrib->ampdu_en = _TRUE;//AGG EN } else @@ -1343,7 +1343,7 @@ _func_enter_; //qos_en, ht_en, init rate, ,bw, ch_offset, sgi //pattrib->qos_en = ptdls_sta->qos_option; - + pattrib->raid = ptdls_sta->raid; #ifdef CONFIG_80211N_HT pattrib->bwmode = ptdls_sta->htpriv.bwmode; @@ -1359,7 +1359,7 @@ _func_enter_; } } - + } else { @@ -1377,14 +1377,14 @@ s32 rtw_txframes_pending(struct adapter *padapter) { struct xmit_priv *pxmitpriv = &padapter->xmitpriv; - return ((_rtw_queue_empty(&pxmitpriv->be_pending) == _FALSE) || - (_rtw_queue_empty(&pxmitpriv->bk_pending) == _FALSE) || + return ((_rtw_queue_empty(&pxmitpriv->be_pending) == _FALSE) || + (_rtw_queue_empty(&pxmitpriv->bk_pending) == _FALSE) || (_rtw_queue_empty(&pxmitpriv->vi_pending) == _FALSE) || (_rtw_queue_empty(&pxmitpriv->vo_pending) == _FALSE)); } s32 rtw_txframes_sta_ac_pending(struct adapter *padapter, struct pkt_attrib *pattrib) -{ +{ struct sta_info *psta; struct tx_servq *ptxservq; int priority = pattrib->priority; @@ -1397,7 +1397,7 @@ s32 rtw_txframes_sta_ac_pending(struct adapter *padapter, struct pkt_attrib *pat { DBG_871X("%s, call rtw_get_stainfo()\n", __func__); psta=rtw_get_stainfo(&padapter->stapriv ,&pattrib->ra[0]); - } + } if(psta==NULL) { @@ -1410,30 +1410,30 @@ s32 rtw_txframes_sta_ac_pending(struct adapter *padapter, struct pkt_attrib *pat DBG_871X("%s, psta->state(0x%x) != _FW_LINKED\n", __func__, psta->state); return 0; } - - switch(priority) + + switch(priority) { case 1: case 2: - ptxservq = &(psta->sta_xmitpriv.bk_q); + ptxservq = &(psta->sta_xmitpriv.bk_q); break; case 4: case 5: - ptxservq = &(psta->sta_xmitpriv.vi_q); + ptxservq = &(psta->sta_xmitpriv.vi_q); break; case 6: case 7: - ptxservq = &(psta->sta_xmitpriv.vo_q); + ptxservq = &(psta->sta_xmitpriv.vo_q); break; case 0: case 3: default: - ptxservq = &(psta->sta_xmitpriv.be_q); + ptxservq = &(psta->sta_xmitpriv.be_q); break; - - } - return ptxservq->qcnt; + } + + return ptxservq->qcnt; } #ifdef CONFIG_TDLS @@ -1457,7 +1457,7 @@ int rtw_build_tdls_ies(struct adapter * padapter, struct xmit_frame * pxmitframe break; case TDLS_DISCOVERY_REQUEST: rtw_build_tdls_dis_req_ies(padapter, pxmitframe, pframe); - break; + break; case TDLS_PEER_TRAFFIC_INDICATION: rtw_build_tdls_peer_traffic_indication_ies(padapter, pxmitframe, pframe); break; @@ -1467,7 +1467,7 @@ int rtw_build_tdls_ies(struct adapter * padapter, struct xmit_frame * pxmitframe case TDLS_CHANNEL_SWITCH_RESPONSE: rtw_build_tdls_ch_switch_rsp_ies(padapter, pxmitframe, pframe); break; -#ifdef CONFIG_WFD +#ifdef CONFIG_WFD case TUNNELED_PROBE_REQ: rtw_build_tunneled_probe_req_ies(padapter, pxmitframe, pframe); break; @@ -1489,7 +1489,7 @@ s32 rtw_make_tdls_wlanhdr (struct adapter *padapter , u8 *hdr, struct pkt_attrib struct rtw_ieee80211_hdr *pwlanhdr = (struct rtw_ieee80211_hdr *)hdr; struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct qos_priv *pqospriv = &pmlmepriv->qospriv; - struct sta_priv *pstapriv = &padapter->stapriv; + struct sta_priv *pstapriv = &padapter->stapriv; struct sta_info *psta=NULL, *ptdls_sta=NULL; u8 tdls_seq=0, baddr[ETH_ALEN] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; @@ -1511,7 +1511,7 @@ _func_enter_; case TDLS_PEER_PSM_REQUEST: //directly to peer STA or via AP case TUNNELED_PROBE_REQ: case TUNNELED_PROBE_RSP: - SetToDs(fctrl); + SetToDs(fctrl); _rtw_memcpy(pwlanhdr->addr1, get_bssid(pmlmepriv), ETH_ALEN); _rtw_memcpy(pwlanhdr->addr2, pattrib->src, ETH_ALEN); _rtw_memcpy(pwlanhdr->addr3, pattrib->dst, ETH_ALEN); @@ -1528,7 +1528,7 @@ _func_enter_; case TDLS_DISCOVERY_REQUEST: //unicast: directly to peer sta, Bcast: via AP if(_rtw_memcmp(pattrib->dst, baddr, ETH_ALEN) ) { - SetToDs(fctrl); + SetToDs(fctrl); _rtw_memcpy(pwlanhdr->addr1, get_bssid(pmlmepriv), ETH_ALEN); _rtw_memcpy(pwlanhdr->addr2, pattrib->src, ETH_ALEN); _rtw_memcpy(pwlanhdr->addr3, pattrib->dst, ETH_ALEN); @@ -1555,7 +1555,7 @@ _func_enter_; } psta = pattrib->psta; - + // 1. update seq_num per link by sta_info // 2. rewrite encrypt to _AES_, also rewrite iv_len, icv_len if(tdls_seq==1){ @@ -1603,12 +1603,12 @@ s32 rtw_xmit_tdls_coalesce(struct adapter * padapter, struct xmit_frame * pxmitf u8 *pbuf_start; s32 bmcst = IS_MCAST(pattrib->ra); s32 res = _SUCCESS; - + _func_enter_; if (pattrib->psta) { psta = pattrib->psta; - } else { + } else { if(bmcst) { psta = rtw_get_bcmc_stainfo(padapter); } else { @@ -1642,14 +1642,14 @@ _func_enter_; { case _WEP40_: case _WEP104_: - WEP_IV(pattrib->iv, psta->dot11txpn, pattrib->key_idx); + WEP_IV(pattrib->iv, psta->dot11txpn, pattrib->key_idx); break; - case _TKIP_: + case _TKIP_: if(bmcst) TKIP_IV(pattrib->iv, psta->dot11txpn, pattrib->key_idx); else TKIP_IV(pattrib->iv, psta->dot11txpn, 0); - break; + break; case _AES_: if(bmcst) AES_IV(pattrib->iv, psta->dot11txpn, pattrib->key_idx); @@ -1674,26 +1674,26 @@ _func_enter_; if ((pattrib->icv_len >0 )&& (pattrib->bswenc)) { pframe += pattrib->pktlen; - _rtw_memcpy(pframe, pattrib->icv, pattrib->icv_len); + _rtw_memcpy(pframe, pattrib->icv, pattrib->icv_len); pframe += pattrib->icv_len; } pattrib->nr_frags = 1; - pattrib->last_txcmdsz = pattrib->hdrlen + pattrib->iv_len + llc_sz + + pattrib->last_txcmdsz = pattrib->hdrlen + pattrib->iv_len + llc_sz + ((pattrib->bswenc) ? pattrib->icv_len : 0) + pattrib->pktlen; - + if (xmitframe_addmic(padapter, pxmitframe) == _FAIL) { goto exit; } xmitframe_swencrypt(padapter, pxmitframe); - + update_attrib_vcs_info(padapter, pxmitframe); - -exit: - -_func_exit_; + +exit: + +_func_exit_; return res; } @@ -1725,7 +1725,7 @@ This sub-routine will perform all the following: 3. append sta's iv/ext-iv 4. append LLC 5. move frag chunk from pframe to pxmitframe->mem -6. apply sw-encrypt, if necessary. +6. apply sw-encrypt, if necessary. */ s32 rtw_xmitframe_coalesce(struct adapter *padapter, _pkt *pkt, struct xmit_frame *pxmitframe) @@ -1757,14 +1757,14 @@ _func_enter_; { psta = pattrib->psta; } else - { + { DBG_871X("%s, call rtw_get_stainfo()\n", __func__); psta = rtw_get_stainfo(&padapter->stapriv, pattrib->ra); } if(psta==NULL) { - + DBG_871X("%s, psta==NUL\n", __func__); return _FAIL; } @@ -1782,7 +1782,7 @@ _func_enter_; } pbuf_start = pxmitframe->buf_addr; - + #ifdef CONFIG_USB_TX_AGGREGATION hw_hdr_offset = TXDESC_SIZE + (pxmitframe->pkt_offset * PACKET_OFFSET_SZ); #else @@ -1835,14 +1835,14 @@ _func_enter_; { case _WEP40_: case _WEP104_: - WEP_IV(pattrib->iv, psta->dot11txpn, pattrib->key_idx); + WEP_IV(pattrib->iv, psta->dot11txpn, pattrib->key_idx); break; - case _TKIP_: + case _TKIP_: if(bmcst) TKIP_IV(pattrib->iv, psta->dot11txpn, pattrib->key_idx); else TKIP_IV(pattrib->iv, psta->dot11txpn, 0); - break; + break; case _AES_: if(bmcst) AES_IV(pattrib->iv, psta->dot11txpn, pattrib->key_idx); @@ -1889,7 +1889,7 @@ _func_enter_; pframe += mem_sz; if ((pattrib->icv_len >0 )&& (pattrib->bswenc)) { - _rtw_memcpy(pframe, pattrib->icv, pattrib->icv_len); + _rtw_memcpy(pframe, pattrib->icv, pattrib->icv_len); pframe += pattrib->icv_len; } @@ -1899,9 +1899,9 @@ _func_enter_; { pattrib->nr_frags = frg_inx; - pattrib->last_txcmdsz = pattrib->hdrlen + pattrib->iv_len + ((pattrib->nr_frags==1)? llc_sz:0) + + pattrib->last_txcmdsz = pattrib->hdrlen + pattrib->iv_len + ((pattrib->nr_frags==1)? llc_sz:0) + ((pattrib->bswenc) ? pattrib->icv_len : 0) + mem_sz; - + ClearMFrag(mem_start); break; @@ -1912,8 +1912,8 @@ _func_enter_; addr = (SIZE_PTR)(pframe); mem_start = (unsigned char *)RND4(addr) + hw_hdr_offset; - _rtw_memcpy(mem_start, pbuf_start + hw_hdr_offset, pattrib->hdrlen); - + _rtw_memcpy(mem_start, pbuf_start + hw_hdr_offset, pattrib->hdrlen); + } if (xmitframe_addmic(padapter, pxmitframe) == _FAIL) @@ -1931,9 +1931,9 @@ _func_enter_; else pattrib->vcs_mode = NONE_VCS; -exit: - -_func_exit_; +exit: + +_func_exit_; return res; } @@ -1955,32 +1955,32 @@ s32 rtw_mgmt_xmitframe_coalesce(struct adapter *padapter, _pkt *pkt, struct xmit s32 res = _FAIL; u8 *BIP_AAD; u8 *MGMT_body=NULL; - + struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct rtw_ieee80211_hdr *pwlanhdr; u8 MME[_MME_IE_LENGTH_]; - + _irqL irqL; u32 ori_len; mem_start = pframe = (u8 *)(pxmitframe->buf_addr) + TXDESC_OFFSET; pwlanhdr = (struct rtw_ieee80211_hdr *)pframe; tmp_buf = BIP_AAD; - + _func_enter_; ori_len = BIP_AAD_SIZE+pattrib->pktlen; tmp_buf = BIP_AAD = rtw_zmalloc(ori_len); subtype = GetFrameSubType(pframe); //bit(7)~bit(2) - + if(BIP_AAD == NULL) return _FAIL; - + _enter_critical_bh(&padapter->security_key_mutex, &irqL); - + //only support station mode if(!check_fwstate(pmlmepriv, WIFI_STATION_STATE) || !check_fwstate(pmlmepriv, _FW_LINKED)) goto xmitframe_coalesce_success; - + //IGTK key is not install, it may not support 802.11w if(padapter->securitypriv.binstallBIPkey != _TRUE) { @@ -1992,29 +1992,29 @@ _func_enter_; { int frame_body_len; u8 mic[16]; - + _rtw_memset(MME, 0, 18); - + //other types doesn't need the BIP if(GetFrameSubType(pframe) != WIFI_DEAUTH && GetFrameSubType(pframe) != WIFI_DISASSOC) goto xmitframe_coalesce_fail; - + MGMT_body = pframe + sizeof(struct rtw_ieee80211_hdr_3addr); pframe += pattrib->pktlen; - + //octent 0 and 1 is key index ,BIP keyid is 4 or 5, LSB only need octent 0 MME[0]=padapter->securitypriv.dot11wBIPKeyid; //copy packet number _rtw_memcpy(&MME[2], &pmlmeext->mgnt_80211w_IPN, 6); //increase the packet number pmlmeext->mgnt_80211w_IPN++; - + //add MME IE with MIC all zero, MME string doesn't include element id and length pframe = rtw_set_ie(pframe, _MME_IE_ , 16 , MME, &(pattrib->pktlen)); pattrib->last_txcmdsz = pattrib->pktlen; // total frame length - header length frame_body_len = pattrib->pktlen - sizeof(struct rtw_ieee80211_hdr_3addr); - + //conscruct AAD, copy frame control field _rtw_memcpy(BIP_AAD, &pwlanhdr->frame_ctl, 2); ClearRetry(BIP_AAD); @@ -2036,7 +2036,7 @@ _func_enter_; if(omac1_aes_128(padapter->securitypriv.dot11wBIPKey[padapter->securitypriv.dot11wBIPKeyid].skey , BIP_AAD, BIP_AAD_SIZE+frame_body_len, mic)) goto xmitframe_coalesce_fail; - + /*//dump calculated mic result { int i; @@ -2068,23 +2068,23 @@ _func_enter_; { psta = rtw_get_stainfo(&padapter->stapriv, pattrib->ra); } - + if(psta==NULL) { - + DBG_871X("%s, psta==NUL\n", __func__); goto xmitframe_coalesce_fail; } - + if(!(psta->state & _FW_LINKED) || pxmitframe->buf_addr==NULL) { DBG_871X("%s, not _FW_LINKED or addr null\n", __func__); goto xmitframe_coalesce_fail; } - + //DBG_871X("%s, action frame category=%d \n", __func__, pframe[WLAN_HDR_A3_LEN]); //according 802.11-2012 standard, these five types are not robust types - if(subtype == WIFI_ACTION && + if(subtype == WIFI_ACTION && (pframe[WLAN_HDR_A3_LEN] == RTW_WLAN_CATEGORY_PUBLIC || pframe[WLAN_HDR_A3_LEN] == RTW_WLAN_CATEGORY_HT || pframe[WLAN_HDR_A3_LEN] == RTW_WLAN_CATEGORY_UNPROTECTED_WNM || @@ -2099,17 +2099,17 @@ _func_enter_; printk(" %02x ", pframe[i]); printk("=======\n"); }*/ - + //bakeup original management packet _rtw_memcpy(tmp_buf, pframe, pattrib->pktlen); //move to data portion pframe += pattrib->hdrlen; - + //802.11w unicast management packet must be _AES_ pattrib->iv_len = 8; //it's MIC of AES pattrib->icv_len = 8; - + switch(pattrib->encrypt) { case _AES_: @@ -2136,16 +2136,16 @@ _func_enter_; //printk(" %02x ", mem_start[i]); printk("@@@@@@@@@@@@@\n"); }*/ - + if ((pattrib->icv_len >0 )&& (pattrib->bswenc)) { - _rtw_memcpy(pframe, pattrib->icv, pattrib->icv_len); + _rtw_memcpy(pframe, pattrib->icv, pattrib->icv_len); pframe += pattrib->icv_len; } //add 8 bytes MIC pattrib->pktlen += pattrib->icv_len; //set final tx command size pattrib->last_txcmdsz = pattrib->pktlen; - + //set protected bit must be beofre SW encrypt SetPrivacy(mem_start); /*//dump management packet include AES header @@ -2166,7 +2166,7 @@ xmitframe_coalesce_success: rtw_mfree(BIP_AAD, ori_len); _func_exit_; return _SUCCESS; - + xmitframe_coalesce_fail: _exit_critical_bh(&padapter->security_key_mutex, &irqL); rtw_mfree(BIP_AAD, ori_len); @@ -2199,7 +2199,7 @@ _func_enter_; oui = P802_1H_OUI; else oui = RFC1042_OUI; - + snap->oui[0] = oui[0]; snap->oui[1] = oui[1]; snap->oui[2] = oui[2]; @@ -2219,18 +2219,18 @@ void rtw_update_protection(struct adapter *padapter, u8 *ie, uint ie_len) sint erp_len; struct xmit_priv *pxmitpriv = &padapter->xmitpriv; struct registry_priv *pregistrypriv = &padapter->registrypriv; - + _func_enter_; - + switch(pxmitpriv->vcs_setting) { case DISABLE_VCS: pxmitpriv->vcs = NONE_VCS; break; - + case ENABLE_VCS: break; - + case AUTO_VCS: default: perp = rtw_get_ie(ie, _ERPINFO_IE_, &erp_len, ie_len); @@ -2252,8 +2252,8 @@ _func_enter_; pxmitpriv->vcs = NONE_VCS; } - break; - + break; + } _func_exit_; @@ -2320,8 +2320,8 @@ _func_enter_; #ifdef DBG_XMIT_BUF_EXT DBG_871X("DBG_XMIT_BUF_EXT ALLOC no=%d, free_xmit_extbuf_cnt=%d\n",pxmitbuf->no, pxmitpriv->free_xmit_extbuf_cnt); #endif - - + + pxmitbuf->priv_data = NULL; //pxmitbuf->ext_tag = _TRUE; @@ -2374,7 +2374,7 @@ _func_enter_; _func_exit_; return _SUCCESS; -} +} struct xmit_buf *rtw_alloc_xmitbuf(struct xmit_priv *pxmitpriv) { @@ -2468,7 +2468,7 @@ _func_enter_; { _enter_critical(&pfree_xmitbuf_queue->lock, &irqL); - rtw_list_delete(&pxmitbuf->list); + rtw_list_delete(&pxmitbuf->list); rtw_list_insert_tail(&(pxmitbuf->list), get_list_head(pfree_xmitbuf_queue)); @@ -2480,10 +2480,10 @@ _func_enter_; _exit_critical(&pfree_xmitbuf_queue->lock, &irqL); } -_func_exit_; +_func_exit_; - return _SUCCESS; -} + return _SUCCESS; +} void rtw_init_xmitframe(struct xmit_frame *pxframe) { @@ -2534,7 +2534,7 @@ struct xmit_frame *rtw_alloc_xmitframe(struct xmit_priv *pxmitpriv)//(_queue *pf { /* Please remember to use all the osdep_service api, - and lock/unlock or _enter/_exit critical to protect + and lock/unlock or _enter/_exit critical to protect pfree_xmit_queue */ @@ -2611,10 +2611,10 @@ struct xmit_frame *rtw_alloc_xmitframe_once(struct xmit_priv *pxmitpriv) u8 *alloc_addr; alloc_addr = rtw_zmalloc(sizeof(struct xmit_frame) + 4); - + if (alloc_addr == NULL) goto exit; - + pxframe = (struct xmit_frame *)N_BYTE_ALIGMENT((SIZE_PTR)(alloc_addr), 4); pxframe->alloc_addr = alloc_addr; @@ -2635,13 +2635,13 @@ exit: } s32 rtw_free_xmitframe(struct xmit_priv *pxmitpriv, struct xmit_frame *pxmitframe) -{ +{ _irqL irqL; _queue *queue; struct adapter *padapter = pxmitpriv->adapter; _pkt *pndis_pkt = NULL; -_func_enter_; +_func_enter_; if (pxmitframe == NULL) { RT_TRACE(_module_rtl871x_xmit_c_, _drv_err_, ("======rtw_free_xmitframe():pxmitframe==NULL!!!!!!!!!!\n")); @@ -2668,7 +2668,7 @@ _func_enter_; _enter_critical_bh(&queue->lock, &irqL); - rtw_list_delete(&pxmitframe->list); + rtw_list_delete(&pxmitframe->list); rtw_list_insert_tail(&pxmitframe->list, get_list_head(queue)); if (pxmitframe->ext_tag == 0) { pxmitpriv->free_xmitframe_cnt++; @@ -2697,24 +2697,24 @@ void rtw_free_xmitframe_queue(struct xmit_priv *pxmitpriv, _queue *pframequeue) { _irqL irqL; _list *plist, *phead; - struct xmit_frame *pxmitframe; + struct xmit_frame *pxmitframe; -_func_enter_; +_func_enter_; _enter_critical_bh(&(pframequeue->lock), &irqL); phead = get_list_head(pframequeue); plist = get_next(phead); - + while (rtw_end_of_queue_search(phead, plist) == _FALSE) { - + pxmitframe = LIST_CONTAINOR(plist, struct xmit_frame, list); - plist = get_next(plist); - + plist = get_next(plist); + rtw_free_xmitframe(pxmitpriv,pxmitframe); - + } _exit_critical_bh(&(pframequeue->lock), &irqL); @@ -2768,7 +2768,7 @@ static struct xmit_frame *dequeue_one_xmitframe(struct xmit_priv *pxmitpriv, str //ptxservq->qcnt--; - break; + break; pxmitframe = NULL; @@ -2806,8 +2806,8 @@ _func_enter_; inx[flags] = 0; inx[0] = flags; } -#endif - +#endif + #if defined(CONFIG_USB_HCI) || defined(CONFIG_SDIO_HCI) for(j=0; j<4; j++) inx[j] = pxmitpriv->wmm_para_seq[j]; @@ -2816,7 +2816,7 @@ _func_enter_; _enter_critical_bh(&pxmitpriv->lock, &irqL0); - for(i = 0; i < entry; i++) + for(i = 0; i < entry; i++) { phwxmit = phwxmit_i + inx[i]; @@ -2867,10 +2867,10 @@ _func_exit_; struct tx_servq *rtw_get_sta_pending(struct adapter *padapter, struct sta_info *psta, sint up, u8 *ac) { struct tx_servq *ptxservq=NULL; - -_func_enter_; - switch (up) +_func_enter_; + + switch (up) { case 1: case 2: @@ -2890,7 +2890,7 @@ _func_enter_; case 7: ptxservq = &(psta->sta_xmitpriv.vo_q); *(ac) = 0; - RT_TRACE(_module_rtl871x_xmit_c_,_drv_info_,("rtw_get_sta_pending : VO \n")); + RT_TRACE(_module_rtl871x_xmit_c_,_drv_info_,("rtw_get_sta_pending : VO \n")); break; case 0: @@ -2898,14 +2898,14 @@ _func_enter_; default: ptxservq = &(psta->sta_xmitpriv.be_q); *(ac) = 2; - RT_TRACE(_module_rtl871x_xmit_c_,_drv_info_,("rtw_get_sta_pending : BE \n")); + RT_TRACE(_module_rtl871x_xmit_c_,_drv_info_,("rtw_get_sta_pending : BE \n")); break; - + } _func_exit_; - return ptxservq; + return ptxservq; } /* @@ -2926,7 +2926,7 @@ s32 rtw_xmit_classifier(struct adapter *padapter, struct xmit_frame *pxmitframe) _func_enter_; if (pattrib->psta) { - psta = pattrib->psta; + psta = pattrib->psta; } else { DBG_871X("%s, call rtw_get_stainfo()\n", __func__); psta = rtw_get_stainfo(pstapriv, pattrib->ra); @@ -2977,8 +2977,8 @@ void rtw_alloc_hwxmits(struct adapter *padapter) pxmitpriv->hwxmit_entry = HWXMIT_ENTRY; - pxmitpriv->hwxmits = (struct hw_xmit *)rtw_zmalloc(sizeof (struct hw_xmit) * pxmitpriv->hwxmit_entry); - + pxmitpriv->hwxmits = (struct hw_xmit *)rtw_zmalloc(sizeof (struct hw_xmit) * pxmitpriv->hwxmit_entry); + hwxmits = pxmitpriv->hwxmits; if(pxmitpriv->hwxmit_entry == 5) @@ -2986,7 +2986,7 @@ void rtw_alloc_hwxmits(struct adapter *padapter) //pxmitpriv->bmc_txqueue.head = 0; //hwxmits[0] .phwtxqueue = &pxmitpriv->bmc_txqueue; hwxmits[0] .sta_queue = &pxmitpriv->bm_pending; - + //pxmitpriv->vo_txqueue.head = 0; //hwxmits[1] .phwtxqueue = &pxmitpriv->vo_txqueue; hwxmits[1] .sta_queue = &pxmitpriv->vo_pending; @@ -2994,16 +2994,16 @@ void rtw_alloc_hwxmits(struct adapter *padapter) //pxmitpriv->vi_txqueue.head = 0; //hwxmits[2] .phwtxqueue = &pxmitpriv->vi_txqueue; hwxmits[2] .sta_queue = &pxmitpriv->vi_pending; - + //pxmitpriv->bk_txqueue.head = 0; //hwxmits[3] .phwtxqueue = &pxmitpriv->bk_txqueue; hwxmits[3] .sta_queue = &pxmitpriv->bk_pending; - //pxmitpriv->be_txqueue.head = 0; + //pxmitpriv->be_txqueue.head = 0; //hwxmits[4] .phwtxqueue = &pxmitpriv->be_txqueue; hwxmits[4] .sta_queue = &pxmitpriv->be_pending; - - } + + } else if(pxmitpriv->hwxmit_entry == 4) { @@ -3018,17 +3018,17 @@ void rtw_alloc_hwxmits(struct adapter *padapter) //pxmitpriv->be_txqueue.head = 0; //hwxmits[2] .phwtxqueue = &pxmitpriv->be_txqueue; hwxmits[2] .sta_queue = &pxmitpriv->be_pending; - + //pxmitpriv->bk_txqueue.head = 0; //hwxmits[3] .phwtxqueue = &pxmitpriv->bk_txqueue; hwxmits[3] .sta_queue = &pxmitpriv->bk_pending; } else { - + } - + } @@ -3045,15 +3045,15 @@ void rtw_free_hwxmits(struct adapter *padapter) void rtw_init_hwxmits(struct hw_xmit *phwxmit, sint entry) { sint i; -_func_enter_; +_func_enter_; for(i = 0; i < entry; i++, phwxmit++) { //_rtw_spinlock_init(&phwxmit->xmit_lock); - //_rtw_init_listhead(&phwxmit->pending); + //_rtw_init_listhead(&phwxmit->pending); //phwxmit->txcmdcnt = 0; phwxmit->accnt = 0; } -_func_exit_; +_func_exit_; } #ifdef CONFIG_BR_EXT @@ -3090,7 +3090,7 @@ int rtw_br_client_tx(struct adapter *padapter, struct sk_buff **pskb) _exit_critical_bh(&padapter->br_ext_lock, &irqL); } else - //if (!priv->pmib->ethBrExtInfo.nat25_disable) + //if (!priv->pmib->ethBrExtInfo.nat25_disable) { // if (priv->dev->br_port && // !memcmp(skb->data+MACADDRLEN, priv->br_mac, MACADDRLEN)) { @@ -3110,7 +3110,7 @@ int rtw_br_client_tx(struct adapter *padapter, struct sk_buff **pskb) if (*((unsigned short *)(skb->data+MACADDRLEN*2)) == __constant_htons(ETH_P_IP)) { if (memcmp(padapter->scdb_mac, skb->data+MACADDRLEN, MACADDRLEN)) { void *scdb_findEntry(struct adapter *priv, unsigned char *macAddr, unsigned char *ipAddr); - + if ((padapter->scdb_entry = (struct nat25_network_db_entry *)scdb_findEntry(padapter, skb->data+MACADDRLEN, skb->data+WLAN_ETHHDR_LEN+12)) != NULL) { memcpy(padapter->scdb_mac, skb->data+MACADDRLEN, MACADDRLEN); @@ -3166,19 +3166,19 @@ int rtw_br_client_tx(struct adapter *padapter, struct sk_buff **pskb) if (skb_is_nonlinear(skb)) DEBUG_ERR("%s(): skb_is_nonlinear!!\n", __FUNCTION__); - + #if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 18)) res = skb_linearize(skb, GFP_ATOMIC); #else // (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 18)) res = skb_linearize(skb); #endif // (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 18)) - if (res < 0) { + if (res < 0) { DEBUG_ERR("TX DROP: skb_linearize fail!\n"); //goto free_and_stop; return -1; } - + res = nat25_db_handle(padapter, skb, NAT25_INSERT); if (res < 0) { if (res == -2) { @@ -3207,12 +3207,12 @@ int rtw_br_client_tx(struct adapter *padapter, struct sk_buff **pskb) *((unsigned short *)(skb->data+MACADDRLEN*2+2)) = vlan_hdr; } } -#if 0 +#if 0 else{ if (*((unsigned short *)(skb->data+MACADDRLEN*2)) == __constant_htons(ETH_P_8021Q)) { is_vlan_tag = 1; } - + if(is_vlan_tag){ if(ICMPV6_MCAST_MAC(skb->data) && ICMPV6_PROTO1A_VALN(skb->data)){ memcpy(skb->data+MACADDRLEN, GET_MY_HWADDR(padapter), MACADDRLEN); @@ -3222,7 +3222,7 @@ int rtw_br_client_tx(struct adapter *padapter, struct sk_buff **pskb) if(ICMPV6_MCAST_MAC(skb->data) && ICMPV6_PROTO1A(skb->data)){ memcpy(skb->data+MACADDRLEN, GET_MY_HWADDR(padapter), MACADDRLEN); } - } + } } #endif // 0 @@ -3242,22 +3242,22 @@ int rtw_br_client_tx(struct adapter *padapter, struct sk_buff **pskb) u32 rtw_get_ff_hwaddr(struct xmit_frame *pxmitframe) { u32 addr; - struct pkt_attrib *pattrib = &pxmitframe->attrib; - + struct pkt_attrib *pattrib = &pxmitframe->attrib; + switch(pattrib->qsel) { case 0: case 3: addr = BE_QUEUE_INX; - break; + break; case 1: case 2: addr = BK_QUEUE_INX; - break; + break; case 4: case 5: addr = VI_QUEUE_INX; - break; + break; case 6: case 7: addr = VO_QUEUE_INX; @@ -3271,8 +3271,8 @@ u32 rtw_get_ff_hwaddr(struct xmit_frame *pxmitframe) case 0x12: default: addr = MGT_QUEUE_INX; - break; - + break; + } return addr; @@ -3282,15 +3282,15 @@ u32 rtw_get_ff_hwaddr(struct xmit_frame *pxmitframe) static void do_queue_select(struct adapter *padapter, struct pkt_attrib *pattrib) { u8 qsel; - + qsel = pattrib->priority; RT_TRACE(_module_rtl871x_xmit_c_,_drv_info_,("### do_queue_select priority=%d ,qsel = %d\n",pattrib->priority ,qsel)); -#ifdef CONFIG_CONCURRENT_MODE +#ifdef CONFIG_CONCURRENT_MODE // if (check_fwstate(&padapter->mlmepriv, WIFI_AP_STATE) == _TRUE) // qsel = 7;// #endif - + pattrib->qsel = qsel; } @@ -3354,7 +3354,7 @@ s32 rtw_xmit(struct adapter *padapter, _pkt **ppkt) rtw_free_xmitframe(pxmitpriv, pxmitframe); return -1; } - } + } #endif // CONFIG_BR_EXT @@ -3389,7 +3389,7 @@ s32 rtw_xmit(struct adapter *padapter, _pkt **ppkt) if(xmitframe_enqueue_for_sleeping_sta(padapter, pxmitframe) == _TRUE) { _exit_critical_bh(&pxmitpriv->lock, &irqL0); - return 1; + return 1; } _exit_critical_bh(&pxmitpriv->lock, &irqL0); #endif @@ -3411,7 +3411,7 @@ sint xmitframe_enqueue_for_tdls_sleeping_sta(struct adapter *padapter, struct xm struct pkt_attrib *pattrib = &pxmitframe->attrib; struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); int i; - + ptdls_sta=rtw_get_stainfo(pstapriv, pattrib->dst); if(ptdls_sta==NULL){ return ret; @@ -3423,16 +3423,16 @@ sint xmitframe_enqueue_for_tdls_sleeping_sta(struct adapter *padapter, struct xm return ret; } - _enter_critical_bh(&ptdls_sta->sleep_q.lock, &irqL); - + _enter_critical_bh(&ptdls_sta->sleep_q.lock, &irqL); + if(ptdls_sta->state&WIFI_SLEEP_STATE) { rtw_list_delete(&pxmitframe->list); - - //_enter_critical_bh(&psta->sleep_q.lock, &irqL); - + + //_enter_critical_bh(&psta->sleep_q.lock, &irqL); + rtw_list_insert_tail(&pxmitframe->list, get_list_head(&ptdls_sta->sleep_q)); - + ptdls_sta->sleepq_len++; ptdls_sta->sleepq_ac_len++; @@ -3467,11 +3467,11 @@ sint xmitframe_enqueue_for_tdls_sleeping_sta(struct adapter *padapter, struct xm } - _exit_critical_bh(&ptdls_sta->sleep_q.lock, &irqL); + _exit_critical_bh(&ptdls_sta->sleep_q.lock, &irqL); } return ret; - + } #endif //CONFIG_TDLS @@ -3529,7 +3529,7 @@ sint xmitframe_enqueue_for_sleeping_sta(struct adapter *padapter, struct xmit_fr if(bmcst) pattrib->qsel = 0x11;//HIQ - + return ret; } @@ -3537,54 +3537,54 @@ sint xmitframe_enqueue_for_sleeping_sta(struct adapter *padapter, struct xmit_fr if(bmcst) { - _enter_critical_bh(&psta->sleep_q.lock, &irqL); - + _enter_critical_bh(&psta->sleep_q.lock, &irqL); + if(pstapriv->sta_dz_bitmap)//if anyone sta is in ps mode { //pattrib->qsel = 0x11;//HIQ - + rtw_list_delete(&pxmitframe->list); - - //_enter_critical_bh(&psta->sleep_q.lock, &irqL); - + + //_enter_critical_bh(&psta->sleep_q.lock, &irqL); + rtw_list_insert_tail(&pxmitframe->list, get_list_head(&psta->sleep_q)); - + psta->sleepq_len++; pstapriv->tim_bitmap |= BIT(0);// pstapriv->sta_dz_bitmap |= BIT(0); - + //DBG_871X("enqueue, sq_len=%d, tim=%x\n", psta->sleepq_len, pstapriv->tim_bitmap); update_beacon(padapter, _TIM_IE_, NULL, _FALSE);//tx bc/mc packets after upate bcn - - //_exit_critical_bh(&psta->sleep_q.lock, &irqL); - - ret = _TRUE; - - } - - _exit_critical_bh(&psta->sleep_q.lock, &irqL); - - return ret; - - } - - _enter_critical_bh(&psta->sleep_q.lock, &irqL); - + //_exit_critical_bh(&psta->sleep_q.lock, &irqL); + + ret = _TRUE; + + } + + _exit_critical_bh(&psta->sleep_q.lock, &irqL); + + return ret; + + } + + + _enter_critical_bh(&psta->sleep_q.lock, &irqL); + if(psta->state&WIFI_SLEEP_STATE) { u8 wmmps_ac=0; - - if(pstapriv->sta_dz_bitmap&BIT(psta->aid)) - { + + if(pstapriv->sta_dz_bitmap&BIT(psta->aid)) + { rtw_list_delete(&pxmitframe->list); - - //_enter_critical_bh(&psta->sleep_q.lock, &irqL); - + + //_enter_critical_bh(&psta->sleep_q.lock, &irqL); + rtw_list_insert_tail(&pxmitframe->list, get_list_head(&psta->sleep_q)); - + psta->sleepq_len++; switch(pattrib->priority) @@ -3625,12 +3625,12 @@ sint xmitframe_enqueue_for_sleeping_sta(struct adapter *padapter, struct xmit_fr } } - //_exit_critical_bh(&psta->sleep_q.lock, &irqL); + //_exit_critical_bh(&psta->sleep_q.lock, &irqL); //if(psta->sleepq_len > (NR_XMITFRAME>>3)) //{ // wakeup_sta_to_xmit(padapter, psta); - //} + //} ret = _TRUE; @@ -3638,10 +3638,10 @@ sint xmitframe_enqueue_for_sleeping_sta(struct adapter *padapter, struct xmit_fr } - _exit_critical_bh(&psta->sleep_q.lock, &irqL); + _exit_critical_bh(&psta->sleep_q.lock, &irqL); return ret; - + } static void dequeue_xmitframes_to_sleeping_queue(struct adapter *padapter, struct sta_info *psta, _queue *pframequeue) @@ -3651,19 +3651,19 @@ static void dequeue_xmitframes_to_sleeping_queue(struct adapter *padapter, struc u8 ac_index; struct tx_servq *ptxservq; struct pkt_attrib *pattrib; - struct xmit_frame *pxmitframe; + struct xmit_frame *pxmitframe; struct hw_xmit *phwxmits = padapter->xmitpriv.hwxmits; - + phead = get_list_head(pframequeue); plist = get_next(phead); - + while (rtw_end_of_queue_search(phead, plist) == _FALSE) - { + { pxmitframe = LIST_CONTAINOR(plist, struct xmit_frame, list); - plist = get_next(plist); - - ret = xmitframe_enqueue_for_sleeping_sta(padapter, pxmitframe); + plist = get_next(plist); + + ret = xmitframe_enqueue_for_sleeping_sta(padapter, pxmitframe); if(_TRUE == ret) { @@ -3678,35 +3678,35 @@ static void dequeue_xmitframes_to_sleeping_queue(struct adapter *padapter, struc { //DBG_871X("xmitframe_enqueue_for_sleeping_sta return _FALSE\n"); } - + } - + } void stop_sta_xmit(struct adapter *padapter, struct sta_info *psta) -{ - _irqL irqL0; +{ + _irqL irqL0; struct sta_info *psta_bmc; struct sta_xmit_priv *pstaxmitpriv; - struct sta_priv *pstapriv = &padapter->stapriv; - struct xmit_priv *pxmitpriv = &padapter->xmitpriv; - + struct sta_priv *pstapriv = &padapter->stapriv; + struct xmit_priv *pxmitpriv = &padapter->xmitpriv; + pstaxmitpriv = &psta->sta_xmitpriv; //for BC/MC Frames psta_bmc = rtw_get_bcmc_stainfo(padapter); - - + + _enter_critical_bh(&pxmitpriv->lock, &irqL0); psta->state |= WIFI_SLEEP_STATE; - + #ifdef CONFIG_TDLS if( !(psta->tdls_sta_state & TDLS_LINKED_STATE) ) #endif //CONFIG_TDLS pstapriv->sta_dz_bitmap |= BIT(psta->aid); - - + + dequeue_xmitframes_to_sleeping_queue(padapter, psta, &pstaxmitpriv->vo_q.sta_pending); rtw_list_delete(&(pstaxmitpriv->vo_q.tx_pending)); @@ -3718,7 +3718,7 @@ void stop_sta_xmit(struct adapter *padapter, struct sta_info *psta) dequeue_xmitframes_to_sleeping_queue(padapter, psta, &pstaxmitpriv->be_q.sta_pending); rtw_list_delete(&(pstaxmitpriv->be_q.tx_pending)); - + dequeue_xmitframes_to_sleeping_queue(padapter, psta, &pstaxmitpriv->bk_q.sta_pending); rtw_list_delete(&(pstaxmitpriv->bk_q.tx_pending)); @@ -3735,20 +3735,20 @@ void stop_sta_xmit(struct adapter *padapter, struct sta_info *psta) pstaxmitpriv = &psta_bmc->sta_xmitpriv; dequeue_xmitframes_to_sleeping_queue(padapter, psta_bmc, &pstaxmitpriv->be_q.sta_pending); rtw_list_delete(&(pstaxmitpriv->be_q.tx_pending)); - -#ifdef CONFIG_TDLS + +#ifdef CONFIG_TDLS } } -#endif //CONFIG_TDLS +#endif //CONFIG_TDLS _exit_critical_bh(&pxmitpriv->lock, &irqL0); - -} + +} void wakeup_sta_to_xmit(struct adapter *padapter, struct sta_info *psta) -{ - _irqL irqL; +{ + _irqL irqL; u8 update_mask=0, wmmps_ac=0; struct sta_info *psta_bmc; _list *xmitframe_plist, *xmitframe_phead; @@ -3757,7 +3757,7 @@ void wakeup_sta_to_xmit(struct adapter *padapter, struct sta_info *psta) struct xmit_priv *pxmitpriv = &padapter->xmitpriv; psta_bmc = rtw_get_bcmc_stainfo(padapter); - + //_enter_critical_bh(&psta->sleep_q.lock, &irqL); _enter_critical_bh(&pxmitpriv->lock, &irqL); @@ -3766,10 +3766,10 @@ void wakeup_sta_to_xmit(struct adapter *padapter, struct sta_info *psta) xmitframe_plist = get_next(xmitframe_phead); while ((rtw_end_of_queue_search(xmitframe_phead, xmitframe_plist)) == _FALSE) - { + { pxmitframe = LIST_CONTAINOR(xmitframe_plist, struct xmit_frame, list); - xmitframe_plist = get_next(xmitframe_plist); + xmitframe_plist = get_next(xmitframe_plist); rtw_list_delete(&pxmitframe->list); @@ -3791,7 +3791,7 @@ void wakeup_sta_to_xmit(struct adapter *padapter, struct sta_info *psta) case 3: default: wmmps_ac = psta->uapsd_be&BIT(1); - break; + break; } psta->sleepq_len--; @@ -3814,22 +3814,22 @@ void wakeup_sta_to_xmit(struct adapter *padapter, struct sta_info *psta) pxmitframe->attrib.eosp = 1; } } - + pxmitframe->attrib.triggered = 1; /* - _exit_critical_bh(&psta->sleep_q.lock, &irqL); + _exit_critical_bh(&psta->sleep_q.lock, &irqL); if(rtw_hal_xmit(padapter, pxmitframe) == _TRUE) - { + { rtw_os_xmit_complete(padapter, pxmitframe); - } + } _enter_critical_bh(&psta->sleep_q.lock, &irqL); */ rtw_hal_xmitframe_enqueue(padapter, pxmitframe); - - } - + + } + //for BC/MC Frames if(!psta_bmc) goto _exit; @@ -3840,7 +3840,7 @@ void wakeup_sta_to_xmit(struct adapter *padapter, struct sta_info *psta) xmitframe_plist = get_next(xmitframe_phead); while ((rtw_end_of_queue_search(xmitframe_phead, xmitframe_plist)) == _FALSE) - { + { pxmitframe = LIST_CONTAINOR(xmitframe_plist, struct xmit_frame, list); xmitframe_plist = get_next(xmitframe_plist); @@ -3852,22 +3852,22 @@ void wakeup_sta_to_xmit(struct adapter *padapter, struct sta_info *psta) pxmitframe->attrib.mdata = 1; else pxmitframe->attrib.mdata = 0; - + pxmitframe->attrib.triggered = 1; /* - _exit_critical_bh(&psta_bmc->sleep_q.lock, &irqL); + _exit_critical_bh(&psta_bmc->sleep_q.lock, &irqL); if(rtw_hal_xmit(padapter, pxmitframe) == _TRUE) - { + { rtw_os_xmit_complete(padapter, pxmitframe); } - _enter_critical_bh(&psta_bmc->sleep_q.lock, &irqL); + _enter_critical_bh(&psta_bmc->sleep_q.lock, &irqL); */ rtw_hal_xmitframe_enqueue(padapter, pxmitframe); - } - + } + if(psta_bmc->sleepq_len==0) { pstapriv->tim_bitmap &= ~BIT(0); @@ -3877,9 +3877,9 @@ void wakeup_sta_to_xmit(struct adapter *padapter, struct sta_info *psta) //upate BCN for TIM IE //update_BCNTIM(padapter); update_mask |= BIT(1); - } - - } + } + + } if(psta->sleepq_len==0) { @@ -3913,16 +3913,16 @@ void wakeup_sta_to_xmit(struct adapter *padapter, struct sta_info *psta) _exit: - //_exit_critical_bh(&psta_bmc->sleep_q.lock, &irqL); + //_exit_critical_bh(&psta_bmc->sleep_q.lock, &irqL); _exit_critical_bh(&pxmitpriv->lock, &irqL); - + if(update_mask) { //update_BCNTIM(padapter); //printk("%s => call update_beacon\n",__FUNCTION__); update_beacon(padapter, _TIM_IE_, NULL, _FALSE); - } - + } + } void xmit_delivery_enabled_frames(struct adapter *padapter, struct sta_info *psta) @@ -3942,7 +3942,7 @@ void xmit_delivery_enabled_frames(struct adapter *padapter, struct sta_info *pst xmitframe_plist = get_next(xmitframe_phead); while ((rtw_end_of_queue_search(xmitframe_phead, xmitframe_plist)) == _FALSE) - { + { pxmitframe = LIST_CONTAINOR(xmitframe_plist, struct xmit_frame, list); xmitframe_plist = get_next(xmitframe_plist); @@ -3965,9 +3965,9 @@ void xmit_delivery_enabled_frames(struct adapter *padapter, struct sta_info *pst case 3: default: wmmps_ac = psta->uapsd_be&BIT(1); - break; + break; } - + if(!wmmps_ac) continue; @@ -3991,7 +3991,7 @@ void xmit_delivery_enabled_frames(struct adapter *padapter, struct sta_info *pst /* if(rtw_hal_xmit(padapter, pxmitframe) == _TRUE) - { + { rtw_os_xmit_complete(padapter, pxmitframe); } */ @@ -4015,10 +4015,10 @@ void xmit_delivery_enabled_frames(struct adapter *padapter, struct sta_info *pst update_beacon(padapter, _TIM_IE_, NULL, _FALSE); //update_mask = BIT(0); } - - } - - //_exit_critical_bh(&psta->sleep_q.lock, &irqL); + + } + + //_exit_critical_bh(&psta->sleep_q.lock, &irqL); _exit_critical_bh(&pxmitpriv->lock, &irqL); } @@ -4084,9 +4084,9 @@ struct xmit_buf* dequeue_pending_xmitbuf_under_survey( { _irqL irql; struct xmit_buf *pxmitbuf; -#ifdef CONFIG_USB_HCI +#ifdef CONFIG_USB_HCI struct xmit_frame *pxmitframe; -#endif +#endif _queue *pqueue; @@ -4105,7 +4105,7 @@ struct xmit_buf* dequeue_pending_xmitbuf_under_survey( do { plist = get_next(plist); if (plist == phead) break; - + pxmitbuf = LIST_CONTAINOR(plist, struct xmit_buf, list); #ifdef CONFIG_USB_HCI @@ -4184,14 +4184,14 @@ void rtw_sctx_init(struct submit_ctx *sctx, int timeout_ms) int rtw_sctx_wait(struct submit_ctx *sctx) { int ret = _FAIL; - unsigned long expire; + unsigned long expire; int status = 0; expire= sctx->timeout_ms ? msecs_to_jiffies(sctx->timeout_ms) : MAX_SCHEDULE_TIMEOUT; if (!wait_for_completion_timeout(&sctx->done, expire)) { /* timeout, do something?? */ status = RTW_SCTX_DONE_TIMEOUT; - DBG_871X("%s timeout\n", __func__); + DBG_871X("%s timeout\n", __func__); } else { status = sctx->status; } @@ -4271,7 +4271,7 @@ int rtw_ack_tx_polling(struct xmit_priv *pxmitpriv, u32 timeout_ms) pack_tx_ops->status = RTW_SCTX_DONE_DEV_REMOVE; break; } - + rtw_msleep_os(10); } while (rtw_get_passing_time_ms(pack_tx_ops->submit_time) < timeout_ms); @@ -4312,12 +4312,12 @@ int rtw_ack_tx_wait(struct xmit_priv *pxmitpriv, u32 timeout_ms) rtw_hal_get_hwreg(adapter, HW_VAR_C2HEVT_CLEAR, (u8 *)(&check_c2hcmd)); rtw_hal_get_hwreg(adapter, HW_VAR_C2HEVT_MSG_NORMAL, (u8 *)(&check_ccx)); - + if (check_c2hcmd != 0) { if (check_c2hcmd != 0xFF) { - c2h_evt_clear(adapter); + c2h_evt_clear(adapter); } else if (ccx_id_filter(check_ccx & 0x0F) == _TRUE) { @@ -4334,7 +4334,7 @@ int rtw_ack_tx_wait(struct xmit_priv *pxmitpriv, u32 timeout_ms) break; } } - } + } } while (rtw_get_passing_time_ms(pack_tx_ops->submit_time) < timeout_ms); if (pack_tx_ops->status == RTW_SCTX_SUBMITTED) { @@ -4364,7 +4364,7 @@ int rtw_ack_tx_wait(struct xmit_priv *pxmitpriv, u32 timeout_ms) void rtw_ack_tx_done(struct xmit_priv *pxmitpriv, int status) { struct submit_ctx *pack_tx_ops = &pxmitpriv->ack_tx_ops; - + if (pxmitpriv->ack_tx) { rtw_sctx_done_err(&pack_tx_ops, status); } else { @@ -4372,4 +4372,3 @@ void rtw_ack_tx_done(struct xmit_priv *pxmitpriv, int status) } } #endif //CONFIG_XMIT_ACK - diff --git a/hal/Hal8188EFWImg_CE.c b/hal/Hal8188EFWImg_CE.c index cd309f4..8443ad5 100755 --- a/hal/Hal8188EFWImg_CE.c +++ b/hal/Hal8188EFWImg_CE.c @@ -1,892 +1,892 @@ -/****************************************************************************** -* -* 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 -* -* -******************************************************************************/ -#include "odm_precomp.h" - -const u8 Rtl8188EFwImgArray[Rtl8188EFWImgArrayLength] = { -0xE1, 0x88, 0x10, 0x00, 0x0B, 0x00, 0x01, 0x00, 0x01, 0x21, 0x11, 0x27, 0x30, 0x36, 0x00, 0x00, -0x2D, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x02, 0x45, 0x4E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0xC1, 0x6F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0xA1, 0xE6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x56, 0xF7, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0xC2, 0xAF, 0x80, 0xFE, 0x32, 0x12, 0x42, 0x04, 0x85, 0xD0, 0x0B, 0x75, 0xD0, 0x08, 0xAA, 0xE0, -0xC2, 0x8C, 0xE5, 0x8A, 0x24, 0x67, 0xF5, 0x8A, 0xE5, 0x8C, 0x34, 0x79, 0xF5, 0x8C, 0xD2, 0x8C, -0xEC, 0x24, 0x89, 0xF8, 0xE6, 0xBC, 0x03, 0x02, 0x74, 0xFF, 0xC3, 0x95, 0x81, 0xB4, 0x40, 0x00, -0x40, 0xCE, 0x79, 0x04, 0x78, 0x80, 0x16, 0xE6, 0x08, 0x70, 0x0B, 0xC2, 0xAF, 0xE6, 0x30, 0xE1, -0x03, 0x44, 0x18, 0xF6, 0xD2, 0xAF, 0x08, 0xD9, 0xED, 0xEA, 0x8B, 0xD0, 0x22, 0xE5, 0x0C, 0xFF, -0x23, 0x24, 0x81, 0xF8, 0x0F, 0x08, 0x08, 0xBF, 0x04, 0x04, 0x7F, 0x00, 0x78, 0x81, 0xE6, 0x30, -0xE4, 0xF2, 0x00, 0xE5, 0x0C, 0xC3, 0x9F, 0x50, 0x20, 0x05, 0x0C, 0x74, 0x88, 0x25, 0x0C, 0xF8, -0xE6, 0xFD, 0xA6, 0x81, 0x08, 0xE6, 0xAE, 0x0C, 0xBE, 0x03, 0x02, 0x74, 0xFF, 0xCD, 0xF8, 0xE8, -0x6D, 0x60, 0xE0, 0x08, 0xE6, 0xC0, 0xE0, 0x80, 0xF6, 0xE5, 0x0C, 0xD3, 0x9F, 0x40, 0x27, 0xE5, -0x0C, 0x24, 0x89, 0xF8, 0xE6, 0xAE, 0x0C, 0xBE, 0x03, 0x02, 0x74, 0xFF, 0xFD, 0x18, 0xE6, 0xCD, -0xF8, 0xE5, 0x81, 0x6D, 0x60, 0x06, 0xD0, 0xE0, 0xF6, 0x18, 0x80, 0xF5, 0xE5, 0x0C, 0x24, 0x88, -0xC8, 0xF6, 0x15, 0x0C, 0x80, 0xD3, 0xE5, 0x0C, 0x23, 0x24, 0x81, 0xF8, 0x7F, 0x04, 0xC2, 0xAF, -0xE6, 0x30, 0xE0, 0x03, 0x10, 0xE2, 0x0C, 0x7F, 0x00, 0x30, 0xE1, 0x07, 0x30, 0xE3, 0x04, 0x7F, -0x08, 0x54, 0xF4, 0x54, 0x7C, 0xC6, 0xD2, 0xAF, 0x54, 0x80, 0x42, 0x07, 0x22, 0x78, 0x88, 0xA6, -0x81, 0x74, 0x03, 0x60, 0x06, 0xFF, 0x08, 0x76, 0xFF, 0xDF, 0xFB, 0x7F, 0x04, 0xE4, 0x78, 0x80, -0xF6, 0x08, 0xF6, 0x08, 0xDF, 0xFA, 0x78, 0x81, 0x76, 0x30, 0x90, 0x45, 0xDE, 0x74, 0x01, 0x93, -0xC0, 0xE0, 0xE4, 0x93, 0xC0, 0xE0, 0x43, 0x89, 0x01, 0x75, 0x8A, 0x60, 0x75, 0x8C, 0x79, 0xD2, -0x8C, 0xD2, 0xAF, 0x22, 0x03, 0xEF, 0xD3, 0x94, 0x03, 0x40, 0x03, 0x7F, 0xFF, 0x22, 0x74, 0x81, -0x2F, 0x2F, 0xF8, 0xE6, 0x20, 0xE5, 0xF4, 0xC2, 0xAF, 0xE6, 0x44, 0x30, 0xF6, 0xD2, 0xAF, 0xAE, -0x0C, 0xEE, 0xC3, 0x9F, 0x50, 0x21, 0x0E, 0x74, 0x88, 0x2E, 0xF8, 0xE6, 0xF9, 0x08, 0xE6, 0x18, -0xBE, 0x03, 0x02, 0x74, 0xFF, 0xFD, 0xED, 0x69, 0x60, 0x09, 0x09, 0xE7, 0x19, 0x19, 0xF7, 0x09, -0x09, 0x80, 0xF3, 0x16, 0x16, 0x80, 0xDA, 0xEE, 0xD3, 0x9F, 0x40, 0x04, 0x05, 0x81, 0x05, 0x81, -0xEE, 0xD3, 0x9F, 0x40, 0x22, 0x74, 0x88, 0x2E, 0xF8, 0x08, 0xE6, 0xF9, 0xEE, 0xB5, 0x0C, 0x02, -0xA9, 0x81, 0x18, 0x06, 0x06, 0xE6, 0xFD, 0xED, 0x69, 0x60, 0x09, 0x19, 0x19, 0xE7, 0x09, 0x09, -0xF7, 0x19, 0x80, 0xF3, 0x1E, 0x80, 0xD9, 0xEF, 0x24, 0x88, 0xF8, 0xE6, 0x04, 0xF8, 0xEF, 0x2F, -0x04, 0x90, 0x45, 0xDE, 0x93, 0xF6, 0x08, 0xEF, 0x2F, 0x93, 0xF6, 0x7F, 0x00, 0x22, 0xEF, 0xD3, -0x94, 0x03, 0x40, 0x03, 0x7F, 0xFF, 0x22, 0xEF, 0x23, 0x24, 0x81, 0xF8, 0xE6, 0x30, 0xE5, 0xF4, -0xC2, 0xAF, 0xE6, 0x54, 0x8C, 0xF6, 0xD2, 0xAF, 0xE5, 0x0C, 0xB5, 0x07, 0x0A, 0x74, 0x88, 0x2F, -0xF8, 0xE6, 0xF5, 0x81, 0x02, 0x42, 0x4D, 0x50, 0x2E, 0x74, 0x89, 0x2F, 0xF8, 0xE6, 0xBF, 0x03, -0x02, 0x74, 0xFF, 0xFD, 0x18, 0xE6, 0xF9, 0x74, 0x88, 0x2F, 0xF8, 0xFB, 0xE6, 0xFC, 0xE9, 0x6C, -0x60, 0x08, 0xA8, 0x05, 0xE7, 0xF6, 0x1D, 0x19, 0x80, 0xF4, 0xA8, 0x03, 0xA6, 0x05, 0x1F, 0xE5, -0x0C, 0xB5, 0x07, 0xE3, 0x7F, 0x00, 0x22, 0x74, 0x89, 0x2F, 0xF8, 0xE6, 0xFD, 0x18, 0x86, 0x01, -0x0F, 0x74, 0x88, 0x2F, 0xF8, 0xA6, 0x01, 0x08, 0x86, 0x04, 0xE5, 0x0C, 0xB5, 0x07, 0x02, 0xAC, -0x81, 0xED, 0x6C, 0x60, 0x08, 0x0D, 0x09, 0xA8, 0x05, 0xE6, 0xF7, 0x80, 0xF4, 0xE5, 0x0C, 0xB5, -0x07, 0xDE, 0x89, 0x81, 0x7F, 0x00, 0x22, 0xEF, 0xD3, 0x94, 0x03, 0x40, 0x03, 0x7F, 0xFF, 0x22, -0xEF, 0x23, 0x24, 0x81, 0xF8, 0xC2, 0xAF, 0xE6, 0x30, 0xE5, 0x05, 0x30, 0xE0, 0x02, 0xD2, 0xE4, -0xD2, 0xE2, 0xC6, 0xD2, 0xAF, 0x7F, 0x00, 0x30, 0xE2, 0x01, 0x0F, 0x02, 0x42, 0x4C, 0x8F, 0xF0, -0xE4, 0xFF, 0xFE, 0xE5, 0x0C, 0x23, 0x24, 0x80, 0xF8, 0xC2, 0xA9, 0x30, 0xF7, 0x0D, 0x7F, 0x08, -0xE6, 0x60, 0x0B, 0x2D, 0xF6, 0x60, 0x30, 0x50, 0x2E, 0x80, 0x07, 0x30, 0xF1, 0x06, 0xED, 0xF6, -0x60, 0x25, 0x7E, 0x02, 0x08, 0x30, 0xF0, 0x10, 0xC2, 0xAF, 0xE6, 0x10, 0xE7, 0x23, 0x0E, 0x30, -0xE2, 0x0C, 0xD2, 0xAF, 0x7F, 0x04, 0x80, 0x12, 0xC2, 0xAF, 0xE6, 0x10, 0xE7, 0x13, 0x54, 0xEC, -0x4E, 0xF6, 0xD2, 0xAF, 0x02, 0x42, 0x4D, 0x7F, 0x08, 0x08, 0xEF, 0x44, 0x83, 0xF4, 0xC2, 0xAF, -0x56, 0xC6, 0xD2, 0xAF, 0x54, 0x80, 0x4F, 0xFF, 0x22, 0xC5, 0xF0, 0xF8, 0xA3, 0xE0, 0x28, 0xF0, -0xC5, 0xF0, 0xF8, 0xE5, 0x82, 0x15, 0x82, 0x70, 0x02, 0x15, 0x83, 0xE0, 0x38, 0xF0, 0x22, 0xEF, -0x5B, 0xFF, 0xEE, 0x5A, 0xFE, 0xED, 0x59, 0xFD, 0xEC, 0x58, 0xFC, 0x22, 0xEF, 0x4B, 0xFF, 0xEE, -0x4A, 0xFE, 0xED, 0x49, 0xFD, 0xEC, 0x48, 0xFC, 0x22, 0xE0, 0xFC, 0xA3, 0xE0, 0xFD, 0xA3, 0xE0, -0xFE, 0xA3, 0xE0, 0xFF, 0x22, 0xE2, 0xFC, 0x08, 0xE2, 0xFD, 0x08, 0xE2, 0xFE, 0x08, 0xE2, 0xFF, -0x22, 0xE2, 0xFB, 0x08, 0xE2, 0xF9, 0x08, 0xE2, 0xFA, 0x08, 0xE2, 0xCB, 0xF8, 0x22, 0xEC, 0xF2, -0x08, 0xED, 0xF2, 0x08, 0xEE, 0xF2, 0x08, 0xEF, 0xF2, 0x22, 0xA4, 0x25, 0x82, 0xF5, 0x82, 0xE5, -0xF0, 0x35, 0x83, 0xF5, 0x83, 0x22, 0xE0, 0xFB, 0xA3, 0xE0, 0xFA, 0xA3, 0xE0, 0xF9, 0x22, 0xEB, -0xF0, 0xA3, 0xEA, 0xF0, 0xA3, 0xE9, 0xF0, 0x22, 0xD0, 0x83, 0xD0, 0x82, 0xF8, 0xE4, 0x93, 0x70, -0x12, 0x74, 0x01, 0x93, 0x70, 0x0D, 0xA3, 0xA3, 0x93, 0xF8, 0x74, 0x01, 0x93, 0xF5, 0x82, 0x88, -0x83, 0xE4, 0x73, 0x74, 0x02, 0x93, 0x68, 0x60, 0xEF, 0xA3, 0xA3, 0xA3, 0x80, 0xDF, 0x02, 0x45, -0x8C, 0x02, 0x42, 0xDD, 0xE4, 0x93, 0xA3, 0xF8, 0xE4, 0x93, 0xA3, 0x40, 0x03, 0xF6, 0x80, 0x01, -0xF2, 0x08, 0xDF, 0xF4, 0x80, 0x29, 0xE4, 0x93, 0xA3, 0xF8, 0x54, 0x07, 0x24, 0x0C, 0xC8, 0xC3, -0x33, 0xC4, 0x54, 0x0F, 0x44, 0x20, 0xC8, 0x83, 0x40, 0x04, 0xF4, 0x56, 0x80, 0x01, 0x46, 0xF6, -0xDF, 0xE4, 0x80, 0x0B, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x90, 0x45, 0xD1, 0xE4, -0x7E, 0x01, 0x93, 0x60, 0xBC, 0xA3, 0xFF, 0x54, 0x3F, 0x30, 0xE5, 0x09, 0x54, 0x1F, 0xFE, 0xE4, -0x93, 0xA3, 0x60, 0x01, 0x0E, 0xCF, 0x54, 0xC0, 0x25, 0xE0, 0x60, 0xA8, 0x40, 0xB8, 0xE4, 0x93, -0xA3, 0xFA, 0xE4, 0x93, 0xA3, 0xF8, 0xE4, 0x93, 0xA3, 0xC8, 0xC5, 0x82, 0xC8, 0xCA, 0xC5, 0x83, -0xCA, 0xF0, 0xA3, 0xC8, 0xC5, 0x82, 0xC8, 0xCA, 0xC5, 0x83, 0xCA, 0xDF, 0xE9, 0xDE, 0xE7, 0x80, -0xBE, 0x00, 0x41, 0x82, 0x09, 0x00, 0x41, 0x82, 0x0A, 0x00, 0x41, 0x82, 0x17, 0x00, 0x59, 0xE2, -0x5C, 0x24, 0x5E, 0x5D, 0x5F, 0xA1, 0xC0, 0xE0, 0xC0, 0xF0, 0xC0, 0x83, 0xC0, 0x82, 0xC0, 0xD0, -0x75, 0xD0, 0x00, 0xC0, 0x00, 0xC0, 0x01, 0xC0, 0x02, 0xC0, 0x03, 0xC0, 0x04, 0xC0, 0x05, 0xC0, -0x06, 0xC0, 0x07, 0x90, 0x01, 0xC4, 0x74, 0xE6, 0xF0, 0x74, 0x45, 0xA3, 0xF0, 0xD1, 0x35, 0x74, -0xE6, 0x04, 0x90, 0x01, 0xC4, 0xF0, 0x74, 0x45, 0xA3, 0xF0, 0xD0, 0x07, 0xD0, 0x06, 0xD0, 0x05, -0xD0, 0x04, 0xD0, 0x03, 0xD0, 0x02, 0xD0, 0x01, 0xD0, 0x00, 0xD0, 0xD0, 0xD0, 0x82, 0xD0, 0x83, -0xD0, 0xF0, 0xD0, 0xE0, 0x32, 0x90, 0x00, 0x54, 0xE0, 0x55, 0x35, 0xF5, 0x39, 0xA3, 0xE0, 0x55, -0x36, 0xF5, 0x3A, 0xA3, 0xE0, 0x55, 0x37, 0xF5, 0x3B, 0xA3, 0xE0, 0x55, 0x38, 0xF5, 0x3C, 0xAD, -0x39, 0x7F, 0x54, 0x12, 0x32, 0x1E, 0xAD, 0x3A, 0x7F, 0x55, 0x12, 0x32, 0x1E, 0xAD, 0x3B, 0x7F, -0x56, 0x12, 0x32, 0x1E, 0xAD, 0x3C, 0x7F, 0x57, 0x12, 0x32, 0x1E, 0x53, 0x91, 0xEF, 0x22, 0xC0, -0xE0, 0xC0, 0xF0, 0xC0, 0x83, 0xC0, 0x82, 0xC0, 0xD0, 0x75, 0xD0, 0x00, 0xC0, 0x00, 0xC0, 0x01, -0xC0, 0x02, 0xC0, 0x03, 0xC0, 0x04, 0xC0, 0x05, 0xC0, 0x06, 0xC0, 0x07, 0x90, 0x01, 0xC4, 0x74, -0x6F, 0xF0, 0x74, 0x46, 0xA3, 0xF0, 0x12, 0x6C, 0x78, 0xE5, 0x41, 0x30, 0xE4, 0x04, 0x7F, 0x02, -0x91, 0x27, 0xE5, 0x41, 0x30, 0xE6, 0x03, 0x12, 0x6C, 0xD5, 0xE5, 0x43, 0x30, 0xE0, 0x03, 0x12, -0x51, 0xC2, 0xE5, 0x43, 0x30, 0xE1, 0x03, 0x12, 0x4D, 0x0C, 0xE5, 0x43, 0x30, 0xE2, 0x03, 0x12, -0x4C, 0xC1, 0xE5, 0x43, 0x30, 0xE3, 0x03, 0x12, 0x6C, 0xE2, 0xE5, 0x43, 0x30, 0xE4, 0x03, 0x12, -0x6D, 0x04, 0xE5, 0x43, 0x30, 0xE5, 0x03, 0x12, 0x6D, 0x33, 0xE5, 0x43, 0x30, 0xE6, 0x02, 0xF1, -0x0F, 0xE5, 0x44, 0x30, 0xE1, 0x03, 0x12, 0x51, 0x7F, 0x74, 0x6F, 0x04, 0x90, 0x01, 0xC4, 0xF0, -0x74, 0x46, 0xA3, 0xF0, 0xD0, 0x07, 0xD0, 0x06, 0xD0, 0x05, 0xD0, 0x04, 0xD0, 0x03, 0xD0, 0x02, -0xD0, 0x01, 0xD0, 0x00, 0xD0, 0xD0, 0xD0, 0x82, 0xD0, 0x83, 0xD0, 0xF0, 0xD0, 0xE0, 0x32, 0x90, -0x80, 0xDE, 0xE0, 0xB4, 0x01, 0x13, 0x90, 0x81, 0x27, 0xE0, 0x60, 0x0D, 0x90, 0x81, 0x2B, 0xE0, -0x54, 0xFE, 0xF0, 0x54, 0x07, 0x70, 0x02, 0xF1, 0x2A, 0x22, 0x90, 0x81, 0x1F, 0xE0, 0x90, 0x81, -0x29, 0x30, 0xE0, 0x05, 0xE0, 0xFF, 0x02, 0x74, 0x8F, 0xE0, 0xFF, 0x7D, 0x01, 0xD3, 0x10, 0xAF, -0x01, 0xC3, 0xC0, 0xD0, 0x90, 0x82, 0x13, 0xED, 0xF0, 0x90, 0x81, 0x2A, 0xE0, 0x90, 0x82, 0x14, -0xF0, 0x90, 0x81, 0x24, 0xE0, 0xFE, 0xC4, 0x13, 0x13, 0x54, 0x03, 0x30, 0xE0, 0x03, 0x02, 0x48, -0xA0, 0xEE, 0xC4, 0x13, 0x13, 0x13, 0x54, 0x01, 0x30, 0xE0, 0x03, 0x02, 0x48, 0xA0, 0x90, 0x82, -0x14, 0xE0, 0xFE, 0x6F, 0x70, 0x03, 0x02, 0x48, 0xA0, 0xEF, 0x70, 0x03, 0x02, 0x48, 0x17, 0x24, -0xFE, 0x70, 0x03, 0x02, 0x48, 0x50, 0x24, 0xFE, 0x60, 0x51, 0x24, 0xFC, 0x70, 0x03, 0x02, 0x48, -0x8B, 0x24, 0xFC, 0x60, 0x03, 0x02, 0x48, 0xA0, 0xEE, 0xB4, 0x0E, 0x03, 0x12, 0x49, 0x5E, 0x90, -0x82, 0x14, 0xE0, 0x70, 0x05, 0x7F, 0x01, 0x12, 0x49, 0x93, 0x90, 0x82, 0x14, 0xE0, 0xB4, 0x06, -0x03, 0x12, 0x49, 0x34, 0x90, 0x82, 0x14, 0xE0, 0xB4, 0x04, 0x0F, 0x90, 0x82, 0x13, 0xE0, 0xFF, -0x60, 0x05, 0x12, 0x73, 0x75, 0x80, 0x03, 0x12, 0x66, 0x26, 0x90, 0x82, 0x14, 0xE0, 0x64, 0x08, -0x60, 0x03, 0x02, 0x48, 0xA0, 0x12, 0x73, 0xD3, 0x02, 0x48, 0xA0, 0x90, 0x82, 0x14, 0xE0, 0x70, -0x05, 0x7F, 0x01, 0x12, 0x49, 0x93, 0x90, 0x82, 0x14, 0xE0, 0xB4, 0x06, 0x03, 0x12, 0x49, 0x34, -0x90, 0x82, 0x14, 0xE0, 0xB4, 0x0E, 0x09, 0x12, 0x48, 0xA5, 0xBF, 0x01, 0x03, 0x12, 0x49, 0x5E, -0x90, 0x82, 0x14, 0xE0, 0x64, 0x0C, 0x60, 0x02, 0x01, 0xA0, 0x11, 0xA5, 0xEF, 0x64, 0x01, 0x60, -0x02, 0x01, 0xA0, 0x11, 0xFA, 0x01, 0xA0, 0x90, 0x82, 0x14, 0xE0, 0xB4, 0x0E, 0x07, 0x11, 0xA5, -0xBF, 0x01, 0x02, 0x31, 0x5E, 0x90, 0x82, 0x14, 0xE0, 0xB4, 0x06, 0x02, 0x31, 0x34, 0x90, 0x82, -0x14, 0xE0, 0xB4, 0x0C, 0x07, 0x11, 0xA5, 0xBF, 0x01, 0x02, 0x11, 0xFA, 0x90, 0x82, 0x14, 0xE0, -0x64, 0x04, 0x70, 0x5C, 0x12, 0x72, 0xF5, 0xEF, 0x64, 0x01, 0x70, 0x54, 0x31, 0xBE, 0x80, 0x50, -0x90, 0x82, 0x14, 0xE0, 0xB4, 0x0E, 0x07, 0x11, 0xA5, 0xBF, 0x01, 0x02, 0x31, 0x5E, 0x90, 0x82, -0x14, 0xE0, 0xB4, 0x06, 0x02, 0x31, 0x34, 0x90, 0x82, 0x14, 0xE0, 0xB4, 0x0C, 0x07, 0x11, 0xA5, -0xBF, 0x01, 0x02, 0x11, 0xFA, 0x90, 0x82, 0x14, 0xE0, 0x70, 0x04, 0x7F, 0x01, 0x31, 0x93, 0x90, -0x82, 0x14, 0xE0, 0xB4, 0x04, 0x1A, 0x12, 0x73, 0xBB, 0x80, 0x15, 0x90, 0x82, 0x14, 0xE0, 0xB4, -0x0C, 0x0E, 0x90, 0x81, 0x25, 0xE0, 0xFF, 0x13, 0x13, 0x54, 0x3F, 0x30, 0xE0, 0x02, 0x31, 0xB1, -0xD0, 0xD0, 0x92, 0xAF, 0x22, 0xD1, 0xAB, 0xEF, 0x64, 0x01, 0x60, 0x08, 0x90, 0x01, 0xB8, 0x74, -0x01, 0xF0, 0x80, 0x3D, 0x90, 0x81, 0x24, 0xE0, 0xFF, 0x13, 0x13, 0x13, 0x54, 0x1F, 0x30, 0xE0, -0x08, 0x90, 0x01, 0xB8, 0x74, 0x02, 0xF0, 0x80, 0x28, 0xEF, 0xC4, 0x54, 0x0F, 0x30, 0xE0, 0x08, -0x90, 0x01, 0xB8, 0x74, 0x04, 0xF0, 0x80, 0x19, 0x90, 0x81, 0x29, 0xE0, 0xD3, 0x94, 0x04, 0x40, -0x08, 0x90, 0x01, 0xB8, 0x74, 0x08, 0xF0, 0x80, 0x08, 0x90, 0x01, 0xB8, 0xE4, 0xF0, 0x7F, 0x01, -0x22, 0x90, 0x01, 0xB9, 0x74, 0x02, 0xF0, 0x7F, 0x00, 0x22, 0x90, 0x80, 0xDE, 0xE0, 0x64, 0x01, -0x70, 0x31, 0x90, 0x81, 0x25, 0xE0, 0x54, 0xFD, 0xF0, 0x90, 0x05, 0x22, 0x74, 0x6F, 0xF0, 0x7F, -0x01, 0xF1, 0x0D, 0xBF, 0x01, 0x12, 0x90, 0x81, 0x24, 0xE0, 0x44, 0x80, 0xF0, 0x90, 0x81, 0x2A, -0x74, 0x0E, 0xF0, 0x90, 0x81, 0x23, 0xF0, 0x22, 0x90, 0x01, 0xB9, 0x74, 0x01, 0xF0, 0x90, 0x01, -0xB8, 0x04, 0xF0, 0x22, 0x90, 0x81, 0x25, 0xE0, 0x90, 0x06, 0x04, 0x20, 0xE0, 0x0C, 0xE0, 0x44, -0x40, 0xF0, 0x90, 0x81, 0x2A, 0x74, 0x04, 0xF0, 0x80, 0x0E, 0xE0, 0x54, 0x7F, 0xF0, 0x90, 0x81, -0x2A, 0x74, 0x0C, 0xF0, 0x90, 0x81, 0x23, 0xF0, 0x90, 0x05, 0x22, 0xE4, 0xF0, 0x22, 0x90, 0x81, -0x25, 0xE0, 0xC3, 0x13, 0x20, 0xE0, 0x08, 0x90, 0x81, 0x2A, 0x74, 0x0C, 0xF0, 0x80, 0x1E, 0x90, -0x06, 0x04, 0xE0, 0x44, 0x40, 0xF0, 0xE0, 0x44, 0x80, 0xF0, 0x90, 0x81, 0x2A, 0x74, 0x04, 0xF0, -0x90, 0x05, 0x27, 0xE0, 0x44, 0x80, 0xF0, 0x90, 0x81, 0x23, 0x74, 0x04, 0xF0, 0x90, 0x05, 0x22, -0xE4, 0xF0, 0x22, 0x90, 0x82, 0x15, 0xEF, 0xF0, 0x12, 0x54, 0x65, 0x90, 0x82, 0x15, 0xE0, 0x60, -0x05, 0x90, 0x05, 0x22, 0xE4, 0xF0, 0x90, 0x81, 0x2A, 0x74, 0x04, 0xF0, 0x90, 0x81, 0x23, 0xF0, -0x22, 0x31, 0xE3, 0x90, 0x81, 0x2A, 0x74, 0x08, 0xF0, 0x90, 0x81, 0x23, 0xF0, 0x22, 0x90, 0x05, -0x22, 0x74, 0xFF, 0xF0, 0xF1, 0x3A, 0x90, 0x01, 0x37, 0x74, 0x02, 0xF0, 0xFD, 0x7F, 0x03, 0x51, -0x57, 0x31, 0xE3, 0xE4, 0x90, 0x81, 0x2A, 0xF0, 0x90, 0x81, 0x23, 0xF0, 0x22, 0x90, 0x05, 0x22, -0x74, 0xFF, 0xF0, 0xF1, 0x3A, 0x90, 0x85, 0xBB, 0x12, 0x20, 0xDA, 0xCC, 0xF0, 0x00, 0xC0, 0x7F, -0x8C, 0x7E, 0x08, 0x12, 0x2E, 0xA2, 0x90, 0x85, 0xBB, 0x12, 0x20, 0xDA, 0x00, 0x00, 0x00, 0x14, -0x7F, 0x70, 0x7E, 0x0E, 0x12, 0x2E, 0xA2, 0x90, 0x81, 0xF9, 0x12, 0x20, 0xDA, 0x00, 0x00, 0x00, -0x00, 0xE4, 0xFD, 0xFF, 0x12, 0x55, 0x1C, 0x7F, 0x7C, 0x7E, 0x08, 0x12, 0x2D, 0x5C, 0xEC, 0x44, -0x80, 0xFC, 0x90, 0x82, 0x05, 0x12, 0x20, 0xCE, 0x90, 0x82, 0x05, 0x12, 0x44, 0xD9, 0x90, 0x85, -0xBB, 0x12, 0x20, 0xCE, 0x7F, 0x7C, 0x7E, 0x08, 0x12, 0x2E, 0xA2, 0x90, 0x01, 0x00, 0x74, 0x3F, -0xF0, 0xA3, 0xE0, 0x54, 0xFD, 0xF0, 0x90, 0x05, 0x53, 0xE0, 0x44, 0x20, 0xF0, 0x22, 0x90, 0x01, -0x34, 0x74, 0x40, 0xF0, 0xFD, 0xE4, 0xFF, 0x74, 0x3D, 0x2F, 0xF8, 0xE6, 0x4D, 0xFE, 0xF6, 0x74, -0x30, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x01, 0xF5, 0x83, 0xEE, 0xF0, 0x22, 0xD3, 0x10, 0xAF, 0x01, -0xC3, 0xC0, 0xD0, 0xE4, 0x90, 0x81, 0xCB, 0xF0, 0x12, 0x1F, 0xA4, 0xFF, 0x54, 0x01, 0xFE, 0x90, -0x81, 0x1F, 0xE0, 0x54, 0xFE, 0x4E, 0xFE, 0xF0, 0xEF, 0x54, 0x02, 0xFF, 0xEE, 0x54, 0xFD, 0x4F, -0xFF, 0xF0, 0x12, 0x1F, 0xA4, 0xFE, 0x54, 0x04, 0xFD, 0xEF, 0x54, 0xFB, 0x4D, 0xFF, 0x90, 0x81, -0x1F, 0xF0, 0xEE, 0x54, 0x08, 0xFE, 0xEF, 0x54, 0xF7, 0x4E, 0xFF, 0xF0, 0x12, 0x1F, 0xA4, 0xFE, -0x54, 0x10, 0xFD, 0xEF, 0x54, 0xEF, 0x4D, 0xFF, 0x90, 0x81, 0x1F, 0xF0, 0xEE, 0x54, 0x20, 0xFE, -0xEF, 0x54, 0xDF, 0x4E, 0xF0, 0x12, 0x1F, 0xA4, 0xC3, 0x13, 0x20, 0xE0, 0x02, 0x61, 0x5E, 0x90, -0x81, 0x1F, 0xE0, 0xFF, 0x30, 0xE0, 0x6D, 0x90, 0x81, 0xCB, 0x74, 0x21, 0xF0, 0xEF, 0x13, 0x13, -0x54, 0x3F, 0x30, 0xE0, 0x0B, 0x51, 0x4E, 0x90, 0x81, 0xCB, 0xE0, 0x44, 0x08, 0xF0, 0x80, 0x0C, -0xE4, 0x90, 0x81, 0x20, 0xF0, 0xA3, 0xF0, 0x7D, 0x40, 0xFF, 0x91, 0x26, 0x90, 0x81, 0x1F, 0xE0, -0xFD, 0x13, 0x13, 0x13, 0x54, 0x1F, 0x30, 0xE0, 0x07, 0x90, 0x81, 0xCB, 0xE0, 0x44, 0x12, 0xF0, -0xED, 0xC4, 0x54, 0x0F, 0x30, 0xE0, 0x07, 0x90, 0x81, 0xCB, 0xE0, 0x44, 0x14, 0xF0, 0x90, 0x81, -0x1F, 0xE0, 0xC4, 0x13, 0x54, 0x07, 0x30, 0xE0, 0x07, 0x90, 0x81, 0xCB, 0xE0, 0x44, 0x80, 0xF0, -0x90, 0x81, 0xCB, 0xE0, 0x90, 0x05, 0x27, 0xF0, 0x90, 0x81, 0x22, 0xE0, 0x60, 0x02, 0x81, 0x17, -0x7F, 0x01, 0x80, 0x15, 0x90, 0x81, 0xCB, 0x74, 0x01, 0xF0, 0x90, 0x05, 0x27, 0xF0, 0x90, 0x81, -0x22, 0xE0, 0x64, 0x04, 0x60, 0x02, 0x81, 0x17, 0xFF, 0x12, 0x53, 0x0E, 0x81, 0x17, 0x90, 0x81, -0x1F, 0xE0, 0xFF, 0x20, 0xE0, 0x02, 0x61, 0xE7, 0x90, 0x81, 0xCB, 0x74, 0x31, 0xF0, 0xEF, 0x13, -0x13, 0x54, 0x3F, 0x30, 0xE0, 0x0B, 0x51, 0x4E, 0x90, 0x81, 0xCB, 0xE0, 0x44, 0x08, 0xF0, 0x80, -0x06, 0x7D, 0x40, 0xE4, 0xFF, 0x91, 0x26, 0x90, 0x81, 0x1F, 0xE0, 0xFD, 0x13, 0x13, 0x13, 0x54, -0x1F, 0x30, 0xE0, 0x07, 0x90, 0x81, 0xCB, 0xE0, 0x44, 0x02, 0xF0, 0xED, 0xC4, 0x54, 0x0F, 0x30, -0xE0, 0x07, 0x90, 0x81, 0xCB, 0xE0, 0x44, 0x04, 0xF0, 0x90, 0x81, 0xCB, 0xE0, 0x90, 0x05, 0x27, -0xF0, 0x90, 0x81, 0x23, 0xE0, 0x64, 0x02, 0x70, 0x1D, 0xFD, 0x7F, 0x04, 0x12, 0x47, 0x3D, 0x12, -0x51, 0x73, 0xBF, 0x01, 0x09, 0x90, 0x81, 0x29, 0xE0, 0xFF, 0x7D, 0x01, 0x80, 0x03, 0xE4, 0xFD, -0xFF, 0x12, 0x47, 0x3D, 0x80, 0x41, 0x90, 0x81, 0x2A, 0xE0, 0x90, 0x81, 0x23, 0xF0, 0x90, 0x05, -0x27, 0xE0, 0x44, 0x40, 0xF0, 0x80, 0x30, 0x90, 0x81, 0xCB, 0x74, 0x01, 0xF0, 0x90, 0x05, 0x27, -0xF0, 0x90, 0x81, 0x23, 0xE0, 0xB4, 0x02, 0x06, 0x7D, 0x01, 0x7F, 0x04, 0x80, 0x0B, 0x90, 0x81, -0x23, 0xE0, 0xB4, 0x08, 0x07, 0x7D, 0x01, 0x7F, 0x0C, 0x12, 0x47, 0x3D, 0xD1, 0x34, 0x90, 0x81, -0x29, 0x12, 0x47, 0x39, 0x12, 0x5A, 0xA7, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x7D, 0x02, 0x7F, 0x02, -0x91, 0x26, 0x7D, 0x01, 0x7F, 0x02, 0x74, 0x3D, 0x2F, 0xF8, 0xE6, 0xFE, 0xED, 0xF4, 0x5E, 0xFE, -0xF6, 0x74, 0x30, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x01, 0xF5, 0x83, 0xEE, 0xF0, 0x22, 0xEF, 0x70, -0x37, 0x7D, 0x78, 0x7F, 0x02, 0x91, 0x26, 0x7D, 0x02, 0x7F, 0x03, 0x91, 0x26, 0x7D, 0xC8, 0x7F, -0x02, 0x12, 0x71, 0x8F, 0x90, 0x01, 0x57, 0xE4, 0xF0, 0x90, 0x01, 0x3C, 0x74, 0x02, 0xF0, 0x7D, -0x01, 0x7F, 0x0C, 0x12, 0x47, 0x3D, 0x90, 0x81, 0x24, 0xE0, 0x54, 0xF7, 0xF0, 0x54, 0xEF, 0xF0, -0x90, 0x06, 0x0A, 0xE0, 0x54, 0xF8, 0xF0, 0x22, 0x90, 0x01, 0x36, 0x74, 0x78, 0xF0, 0xA3, 0x74, -0x02, 0xF0, 0x7D, 0x78, 0xFF, 0x51, 0x57, 0x7D, 0x02, 0x7F, 0x03, 0x51, 0x57, 0x90, 0x06, 0x0A, -0xE0, 0x44, 0x07, 0xF0, 0x90, 0x81, 0x32, 0xA3, 0xE0, 0x90, 0x05, 0x58, 0xF0, 0x90, 0x80, 0xDE, -0xE0, 0xB4, 0x01, 0x15, 0x90, 0x81, 0x25, 0xE0, 0x54, 0xFB, 0xF0, 0x90, 0x81, 0x2A, 0xE0, 0x20, -0xE2, 0x0E, 0x7D, 0x01, 0x7F, 0x04, 0x02, 0x47, 0x3D, 0x90, 0x81, 0x25, 0xE0, 0x44, 0x04, 0xF0, -0x22, 0x90, 0x81, 0x1F, 0xE0, 0xFF, 0x30, 0xE0, 0x08, 0x90, 0x81, 0x23, 0xE0, 0x64, 0x02, 0x60, -0x3A, 0x90, 0x81, 0x27, 0xE0, 0x70, 0x04, 0xEF, 0x30, 0xE0, 0x0A, 0x90, 0x81, 0x2A, 0xE0, 0x64, -0x02, 0x60, 0x28, 0xB1, 0x83, 0x90, 0x81, 0x25, 0xE0, 0x13, 0x13, 0x13, 0x54, 0x1F, 0x30, 0xE0, -0x14, 0x90, 0x81, 0x2D, 0xE0, 0xFF, 0xA3, 0xE0, 0x6F, 0x70, 0x0A, 0xF1, 0xCD, 0x91, 0x1C, 0x90, -0x81, 0x2E, 0xE0, 0x14, 0xF0, 0x90, 0x01, 0xE6, 0xE0, 0x04, 0xF0, 0x22, 0x90, 0x81, 0x1F, 0xE0, -0x30, 0xE0, 0x06, 0x90, 0x81, 0x21, 0x74, 0x01, 0xF0, 0x90, 0x81, 0x27, 0xE0, 0x60, 0x45, 0x90, -0x81, 0x25, 0xE0, 0xFF, 0x13, 0x13, 0x13, 0x54, 0x1F, 0x30, 0xE0, 0x12, 0x90, 0x01, 0x3B, 0xE0, -0x30, 0xE4, 0x0B, 0x91, 0x1C, 0x90, 0x81, 0x2D, 0xE0, 0x14, 0x90, 0x05, 0x73, 0xF0, 0x90, 0x82, -0x0B, 0xE4, 0x75, 0xF0, 0x01, 0x12, 0x44, 0xA9, 0xC3, 0x90, 0x82, 0x0C, 0xE0, 0x94, 0x80, 0x90, -0x82, 0x0B, 0xE0, 0x64, 0x80, 0x94, 0x80, 0x40, 0x0B, 0x90, 0x01, 0x98, 0xE0, 0x54, 0xFE, 0xF0, -0xE0, 0x44, 0x01, 0xF0, 0x12, 0x75, 0xF8, 0xD1, 0xD6, 0x90, 0x81, 0x3F, 0xE0, 0x30, 0xE0, 0x0C, -0xE4, 0xF5, 0x1D, 0xA3, 0xF1, 0xFB, 0x90, 0x01, 0x57, 0x74, 0x05, 0xF0, 0x90, 0x01, 0xBE, 0xE0, -0x04, 0xF0, 0x22, 0x90, 0x80, 0xDE, 0xE0, 0x64, 0x01, 0x60, 0x02, 0xC1, 0x23, 0x90, 0x81, 0x27, -0xE0, 0x70, 0x02, 0xC1, 0x23, 0x90, 0x81, 0x26, 0xE0, 0xC4, 0x54, 0x0F, 0x64, 0x01, 0x70, 0x22, -0x90, 0x06, 0xAB, 0xE0, 0x90, 0x81, 0x2E, 0xF0, 0x90, 0x06, 0xAA, 0xE0, 0x90, 0x81, 0x2D, 0xF0, -0xA3, 0xE0, 0xFF, 0x70, 0x08, 0x90, 0x81, 0x2D, 0xE0, 0xFE, 0xFF, 0x80, 0x00, 0x90, 0x81, 0x2E, -0xEF, 0xF0, 0x90, 0x81, 0x25, 0xE0, 0x44, 0x04, 0xF0, 0xE4, 0x90, 0x81, 0x30, 0xF0, 0x90, 0x81, -0x32, 0xA3, 0xE0, 0x90, 0x05, 0x58, 0xF0, 0x90, 0x01, 0x57, 0xE4, 0xF0, 0x90, 0x01, 0x3C, 0x74, -0x02, 0xF0, 0x90, 0x81, 0x2B, 0xE0, 0x54, 0xFD, 0xF0, 0x54, 0xEF, 0xF0, 0x90, 0x81, 0x26, 0xE0, -0xFF, 0xC4, 0x54, 0x0F, 0x24, 0xFD, 0x50, 0x02, 0x80, 0x0F, 0x90, 0x81, 0x1F, 0xE0, 0x30, 0xE0, -0x05, 0x12, 0x6D, 0xF2, 0x80, 0x03, 0x12, 0x6E, 0xC9, 0x90, 0x81, 0x25, 0xE0, 0x13, 0x13, 0x13, -0x54, 0x1F, 0x30, 0xE0, 0x0E, 0x90, 0x81, 0x2D, 0xE0, 0xFF, 0xA3, 0xE0, 0xB5, 0x07, 0x04, 0xF1, -0xCD, 0x91, 0x22, 0x90, 0x81, 0x1F, 0xE0, 0xC3, 0x13, 0x20, 0xE0, 0x07, 0x90, 0x81, 0x25, 0xE0, -0x44, 0x04, 0xF0, 0x22, 0xD1, 0xAB, 0xEF, 0x70, 0x02, 0xD1, 0x3C, 0x22, 0x90, 0x81, 0x27, 0xE0, -0x64, 0x01, 0x70, 0x66, 0x90, 0x81, 0x26, 0xE0, 0x54, 0x0F, 0x60, 0x51, 0x90, 0x81, 0x2A, 0xE0, -0x70, 0x03, 0xFF, 0x31, 0x93, 0x90, 0x81, 0x2A, 0xE0, 0x64, 0x0C, 0x60, 0x03, 0x12, 0x66, 0x26, -0x90, 0x01, 0x5B, 0xE4, 0xF0, 0x90, 0x01, 0x3C, 0x74, 0x04, 0xF0, 0xD1, 0xAB, 0xEF, 0x64, 0x01, -0x60, 0x38, 0xE4, 0xF5, 0x1D, 0x90, 0x81, 0x3A, 0xE0, 0xC3, 0x13, 0x54, 0x7F, 0xF5, 0x1E, 0xE4, -0xFB, 0xFD, 0x7F, 0x58, 0x7E, 0x01, 0x12, 0x50, 0x05, 0x90, 0x01, 0x5B, 0x74, 0x05, 0xF0, 0x90, -0x06, 0x92, 0x74, 0x01, 0xF0, 0x90, 0x81, 0x24, 0xE0, 0x44, 0x08, 0xF0, 0x22, 0x90, 0x81, 0x2A, -0xE0, 0x70, 0x07, 0x7D, 0x01, 0x7F, 0x04, 0x12, 0x47, 0x3D, 0x22, 0x90, 0x04, 0x1A, 0xE0, 0xF4, -0x60, 0x03, 0x7F, 0x00, 0x22, 0x90, 0x04, 0x1B, 0xE0, 0x54, 0x07, 0x64, 0x07, 0x7F, 0x01, 0x60, -0x02, 0x7F, 0x00, 0x22, 0x12, 0x50, 0x60, 0x90, 0x81, 0x2D, 0xE0, 0x14, 0x90, 0x05, 0x73, 0xF0, -0x7D, 0x02, 0x7F, 0x02, 0x51, 0x57, 0x90, 0x81, 0x42, 0xE0, 0x30, 0xE0, 0x2D, 0x90, 0x80, 0xDE, -0xE0, 0xB4, 0x01, 0x26, 0x90, 0x82, 0x17, 0xE0, 0x04, 0xF0, 0xE0, 0xB4, 0x0A, 0x0B, 0x90, 0x81, -0x44, 0xE0, 0x04, 0xF0, 0xE4, 0x90, 0x82, 0x17, 0xF0, 0x90, 0x81, 0x44, 0xE0, 0xFF, 0x90, 0x81, -0x43, 0xE0, 0xB5, 0x07, 0x05, 0xE4, 0xA3, 0xF0, 0xF1, 0x0B, 0x22, 0xE4, 0xFF, 0x8F, 0x53, 0x90, -0x04, 0x1D, 0xE0, 0x60, 0x19, 0x90, 0x05, 0x22, 0xE0, 0xF5, 0x56, 0x74, 0xFF, 0xF0, 0xF1, 0x3A, -0xBF, 0x01, 0x03, 0x12, 0x74, 0xFB, 0x90, 0x05, 0x22, 0xE5, 0x56, 0xF0, 0x80, 0x03, 0x12, 0x74, -0xFB, 0x90, 0x04, 0x1F, 0x74, 0x20, 0xF0, 0x7F, 0x01, 0x22, 0xE4, 0x90, 0x82, 0x0F, 0xF0, 0xA3, -0xF0, 0x90, 0x05, 0xF8, 0xE0, 0x70, 0x0F, 0xA3, 0xE0, 0x70, 0x0B, 0xA3, 0xE0, 0x70, 0x07, 0xA3, -0xE0, 0x70, 0x03, 0x7F, 0x01, 0x22, 0xD3, 0x90, 0x82, 0x10, 0xE0, 0x94, 0xE8, 0x90, 0x82, 0x0F, -0xE0, 0x94, 0x03, 0x40, 0x0A, 0x90, 0x01, 0xC0, 0xE0, 0x44, 0x20, 0xF0, 0x7F, 0x00, 0x22, 0x7F, -0x32, 0x7E, 0x00, 0x12, 0x32, 0xAA, 0x90, 0x82, 0x0F, 0xE4, 0x75, 0xF0, 0x01, 0x12, 0x44, 0xA9, -0x80, 0xBF, 0x74, 0x1F, 0x2D, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x54, 0x3F, 0xF0, -0xEF, 0x60, 0x1D, 0x74, 0x21, 0x2D, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x44, 0x10, -0xF0, 0x74, 0x1F, 0x2D, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x44, 0x80, 0xF0, 0x22, -0x74, 0x21, 0x2D, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x54, 0xEF, 0xF0, 0x74, 0x1F, -0x2D, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x44, 0x40, 0xF0, 0x22, 0xEF, 0x14, 0x90, -0x05, 0x73, 0xF0, 0x90, 0x01, 0x3F, 0x74, 0x10, 0xF0, 0xFD, 0x7F, 0x03, 0x74, 0x45, 0x2F, 0xF8, -0xE6, 0x4D, 0xFE, 0xF6, 0x74, 0x38, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x01, 0xF5, 0x83, 0xEE, 0xF0, -0x22, 0xE0, 0x44, 0x02, 0xF0, 0xE4, 0xF5, 0x1D, 0x90, 0x81, 0x39, 0xE0, 0xF5, 0x1E, 0xE4, 0xFB, -0xFD, 0x7F, 0x54, 0x7E, 0x01, 0x8E, 0x19, 0x8F, 0x1A, 0xE5, 0x1E, 0x54, 0x07, 0xC4, 0x33, 0x54, -0xE0, 0x85, 0x19, 0x83, 0x85, 0x1A, 0x82, 0xF0, 0xE5, 0x1D, 0x54, 0x07, 0xC4, 0x33, 0x54, 0xE0, -0xFF, 0xE5, 0x1E, 0x13, 0x13, 0x13, 0x54, 0x1F, 0x4F, 0xA3, 0xF0, 0xEB, 0x54, 0x07, 0xC4, 0x33, -0x54, 0xE0, 0xFF, 0xE5, 0x1D, 0x13, 0x13, 0x13, 0x54, 0x1F, 0x4F, 0x85, 0x1A, 0x82, 0x85, 0x19, -0x83, 0xA3, 0xA3, 0xF0, 0xBD, 0x01, 0x0C, 0x85, 0x1A, 0x82, 0x8E, 0x83, 0xA3, 0xA3, 0xA3, 0x74, -0x03, 0xF0, 0x22, 0x85, 0x1A, 0x82, 0x85, 0x19, 0x83, 0xA3, 0xA3, 0xA3, 0x74, 0x01, 0xF0, 0x22, -0xE4, 0x90, 0x81, 0x4D, 0xF0, 0x90, 0x81, 0x27, 0xE0, 0x60, 0x58, 0x90, 0x80, 0xDE, 0xE0, 0x64, -0x01, 0x70, 0x50, 0x90, 0x81, 0x4D, 0x04, 0xF0, 0xE4, 0x90, 0x81, 0x2E, 0xF0, 0x90, 0x81, 0x1F, -0xE0, 0x30, 0xE0, 0x15, 0x90, 0x81, 0x23, 0xE0, 0xB4, 0x02, 0x05, 0xE4, 0x90, 0x81, 0x4D, 0xF0, -0x31, 0x73, 0xEF, 0x70, 0x04, 0x90, 0x81, 0x4D, 0xF0, 0x90, 0x81, 0x4D, 0xE0, 0x60, 0x24, 0x90, -0x81, 0x2B, 0xE0, 0x44, 0x10, 0xF0, 0xE4, 0xF5, 0x1D, 0x90, 0x81, 0x2F, 0x12, 0x4F, 0xFB, 0x90, -0x01, 0x57, 0x74, 0x05, 0xF0, 0x90, 0x81, 0x2A, 0xE0, 0x20, 0xE2, 0x07, 0x7D, 0x01, 0x7F, 0x04, -0x12, 0x47, 0x3D, 0x22, 0xE4, 0x90, 0x81, 0x4C, 0xF0, 0x90, 0x81, 0x27, 0xE0, 0x70, 0x02, 0x21, -0x72, 0x90, 0x80, 0xDE, 0xE0, 0x64, 0x01, 0x60, 0x02, 0x21, 0x72, 0x90, 0x81, 0x26, 0xE0, 0xFF, -0xC4, 0x54, 0x0F, 0x60, 0x22, 0x24, 0xFE, 0x60, 0x03, 0x04, 0x70, 0x21, 0x90, 0x81, 0x2E, 0xE0, -0x14, 0xF0, 0xE0, 0xFF, 0x60, 0x06, 0x90, 0x81, 0x30, 0xE0, 0x60, 0x11, 0xEF, 0x70, 0x08, 0x90, -0x81, 0x2D, 0xE0, 0xA3, 0xF0, 0x80, 0x00, 0x90, 0x81, 0x4C, 0x74, 0x01, 0xF0, 0x90, 0x81, 0x1F, -0xE0, 0x30, 0xE0, 0x15, 0x90, 0x81, 0x23, 0xE0, 0xB4, 0x02, 0x05, 0xE4, 0x90, 0x81, 0x4C, 0xF0, -0x31, 0x73, 0xEF, 0x70, 0x04, 0x90, 0x81, 0x4C, 0xF0, 0x90, 0x81, 0x4C, 0xE0, 0x60, 0x43, 0x90, -0x81, 0x2B, 0xE0, 0x44, 0x10, 0xF0, 0x90, 0x81, 0x30, 0xE0, 0x60, 0x03, 0xB4, 0x01, 0x09, 0xE4, -0xF5, 0x1D, 0x90, 0x81, 0x30, 0xE0, 0x80, 0x0D, 0xE4, 0xF5, 0x1D, 0x90, 0x81, 0x30, 0xE0, 0x75, -0xF0, 0x03, 0xA4, 0x24, 0xFE, 0xFF, 0x90, 0x81, 0x2F, 0xE0, 0x2F, 0x12, 0x4F, 0xFC, 0x90, 0x01, -0x57, 0x74, 0x05, 0xF0, 0x90, 0x81, 0x2A, 0xE0, 0x20, 0xE2, 0x07, 0x7D, 0x01, 0x7F, 0x04, 0x12, -0x47, 0x3D, 0x22, 0x90, 0x05, 0x43, 0xE0, 0x7F, 0x00, 0x30, 0xE7, 0x02, 0x7F, 0x01, 0x22, 0x90, -0x81, 0x27, 0xE0, 0x70, 0x07, 0x90, 0x81, 0x1F, 0xE0, 0x30, 0xE0, 0x11, 0x90, 0x81, 0x1F, 0xE0, -0x30, 0xE0, 0x07, 0x31, 0x73, 0xBF, 0x01, 0x05, 0x41, 0x5B, 0x12, 0x4E, 0x3C, 0x22, 0xD3, 0x10, -0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0x81, 0x1E, 0xE0, 0xB4, 0x01, 0x04, 0x7F, 0x04, 0x80, 0x0B, -0x31, 0x73, 0xBF, 0x01, 0x04, 0x7F, 0x01, 0x80, 0x02, 0x7F, 0x02, 0x71, 0x0E, 0xD0, 0xD0, 0x92, -0xAF, 0x22, 0x90, 0x81, 0x4B, 0xE0, 0x60, 0x0F, 0xE4, 0xF0, 0x90, 0x05, 0x53, 0xE0, 0x44, 0x02, -0xF0, 0x90, 0x05, 0xFC, 0xE0, 0x04, 0xF0, 0x90, 0x81, 0x1F, 0xE0, 0x30, 0xE0, 0x10, 0xA3, 0x74, -0x01, 0xF0, 0x90, 0x81, 0x1F, 0xE0, 0xFF, 0xC3, 0x13, 0x30, 0xE0, 0x02, 0x31, 0x9E, 0x11, 0xC4, -0x90, 0x81, 0x3F, 0xE0, 0x30, 0xE0, 0x07, 0x91, 0x65, 0x90, 0x05, 0x22, 0xE4, 0xF0, 0x22, 0x90, -0x81, 0x1F, 0xE0, 0xFF, 0x30, 0xE0, 0x3D, 0x90, 0x81, 0x23, 0xE0, 0x7E, 0x00, 0xB4, 0x02, 0x02, -0x7E, 0x01, 0x90, 0x81, 0x22, 0xE0, 0x7D, 0x00, 0xB4, 0x04, 0x02, 0x7D, 0x01, 0xED, 0x4E, 0x70, -0x23, 0xEF, 0xC3, 0x13, 0x30, 0xE0, 0x02, 0x21, 0x9E, 0x51, 0x45, 0x90, 0x81, 0x23, 0xE0, 0xB4, -0x08, 0x06, 0xE4, 0xFD, 0x7F, 0x0C, 0x80, 0x09, 0x90, 0x81, 0x23, 0xE0, 0x70, 0x06, 0xFD, 0x7F, -0x04, 0x12, 0x47, 0x3D, 0x22, 0x90, 0x81, 0x1E, 0xE0, 0xB4, 0x01, 0x0F, 0x90, 0x81, 0x23, 0xE0, -0x64, 0x02, 0x60, 0x07, 0x7D, 0x01, 0x7F, 0x02, 0x12, 0x47, 0x3D, 0x90, 0x81, 0x27, 0xE0, 0x64, -0x02, 0x60, 0x14, 0x90, 0x81, 0x26, 0xE0, 0x54, 0x0F, 0x60, 0x0C, 0x12, 0x4E, 0xAB, 0xEF, 0x70, -0x06, 0xFD, 0x7F, 0x0C, 0x12, 0x47, 0x3D, 0x22, 0x90, 0x81, 0x1F, 0xE0, 0xFF, 0x30, 0xE0, 0x3F, -0x90, 0x81, 0x23, 0xE0, 0x7E, 0x00, 0xB4, 0x02, 0x02, 0x7E, 0x01, 0x90, 0x81, 0x22, 0xE0, 0x7D, -0x00, 0xB4, 0x04, 0x02, 0x7D, 0x01, 0xED, 0x4E, 0x70, 0x25, 0xEF, 0xC3, 0x13, 0x30, 0xE0, 0x02, -0x21, 0x9E, 0x12, 0x74, 0xAC, 0x90, 0x81, 0x23, 0xE0, 0xB4, 0x0C, 0x06, 0xE4, 0xFD, 0x7F, 0x08, -0x80, 0x0A, 0x90, 0x81, 0x23, 0xE0, 0xB4, 0x04, 0x06, 0xE4, 0xFD, 0xFF, 0x12, 0x47, 0x3D, 0x22, -0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0x81, 0xCB, 0x12, 0x45, 0x1F, 0x12, 0x1F, 0xA4, -0xFF, 0x90, 0x81, 0x1E, 0xF0, 0xBF, 0x01, 0x12, 0x90, 0x81, 0xCB, 0x12, 0x45, 0x16, 0x90, 0x00, -0x01, 0x12, 0x1F, 0xBD, 0x64, 0x01, 0x60, 0x21, 0x80, 0x1D, 0x90, 0x81, 0xCB, 0x12, 0x45, 0x16, -0x90, 0x00, 0x01, 0x12, 0x1F, 0xBD, 0x64, 0x01, 0x60, 0x0F, 0x90, 0x81, 0x1F, 0xE0, 0x20, 0xE0, -0x06, 0xE4, 0xFF, 0x71, 0x0E, 0x80, 0x02, 0x31, 0x9E, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0xD3, 0x10, -0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0x81, 0x22, 0xE0, 0x90, 0x82, 0x16, 0xF0, 0x6F, 0x70, 0x02, -0x81, 0x04, 0xEF, 0x14, 0x60, 0x3E, 0x14, 0x60, 0x62, 0x14, 0x70, 0x02, 0x61, 0xB8, 0x14, 0x70, -0x02, 0x61, 0xDF, 0x24, 0x04, 0x60, 0x02, 0x81, 0x04, 0x90, 0x82, 0x16, 0xE0, 0xFF, 0xB4, 0x04, -0x04, 0x91, 0x41, 0x81, 0x04, 0xEF, 0xB4, 0x02, 0x04, 0x91, 0x50, 0x81, 0x04, 0x90, 0x82, 0x16, -0xE0, 0xFF, 0xB4, 0x03, 0x04, 0x91, 0x54, 0x81, 0x04, 0xEF, 0x64, 0x01, 0x60, 0x02, 0x81, 0x04, -0x91, 0x43, 0x81, 0x04, 0x90, 0x82, 0x16, 0xE0, 0xFF, 0xB4, 0x04, 0x04, 0x91, 0xF3, 0x81, 0x04, -0xEF, 0xB4, 0x02, 0x04, 0x91, 0x58, 0x81, 0x04, 0x90, 0x82, 0x16, 0xE0, 0xFF, 0xB4, 0x03, 0x04, -0x91, 0xE8, 0x81, 0x04, 0xEF, 0x70, 0x7D, 0x91, 0x2B, 0x80, 0x79, 0x90, 0x82, 0x16, 0xE0, 0xB4, -0x04, 0x05, 0x12, 0x74, 0x60, 0x80, 0x6D, 0x90, 0x82, 0x16, 0xE0, 0xB4, 0x01, 0x04, 0x91, 0x21, -0x80, 0x62, 0x90, 0x82, 0x16, 0xE0, 0xB4, 0x03, 0x05, 0x12, 0x74, 0x71, 0x80, 0x56, 0x90, 0x82, -0x16, 0xE0, 0x70, 0x50, 0x91, 0x1F, 0x80, 0x4C, 0x90, 0x82, 0x16, 0xE0, 0xFF, 0xB4, 0x04, 0x05, -0x12, 0x74, 0x4C, 0x80, 0x3F, 0xEF, 0xB4, 0x01, 0x04, 0x91, 0x34, 0x80, 0x37, 0xEF, 0xB4, 0x02, -0x04, 0x91, 0xDF, 0x80, 0x2F, 0x90, 0x82, 0x16, 0xE0, 0x70, 0x29, 0x91, 0x32, 0x80, 0x25, 0x90, -0x82, 0x16, 0xE0, 0xFF, 0xB4, 0x03, 0x05, 0x12, 0x74, 0x7B, 0x80, 0x18, 0xEF, 0xB4, 0x01, 0x04, -0x91, 0x0B, 0x80, 0x10, 0xEF, 0xB4, 0x02, 0x04, 0xB1, 0x06, 0x80, 0x08, 0x90, 0x82, 0x16, 0xE0, -0x70, 0x02, 0x91, 0x09, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x91, 0x2B, 0x90, 0x05, 0x22, 0x74, 0x6F, -0xF0, 0x90, 0x05, 0x27, 0xE0, 0x54, 0xBF, 0xF0, 0x90, 0x81, 0x22, 0x74, 0x04, 0xF0, 0x22, 0x91, -0x2B, 0x12, 0x49, 0xDD, 0x90, 0x81, 0x22, 0x74, 0x02, 0xF0, 0x22, 0x90, 0x81, 0x22, 0x74, 0x01, -0xF0, 0x22, 0x91, 0x2B, 0x90, 0x05, 0x22, 0x74, 0xFF, 0xF0, 0x90, 0x81, 0x22, 0x74, 0x03, 0xF0, -0x22, 0x91, 0xF3, 0x90, 0x05, 0x27, 0xE0, 0x54, 0xBF, 0xF0, 0xE4, 0x90, 0x81, 0x22, 0xF0, 0x22, -0x91, 0x58, 0x80, 0xEF, 0x91, 0xE8, 0x80, 0xEB, 0x91, 0x65, 0x90, 0x05, 0x22, 0xE4, 0xF0, 0x90, -0x81, 0x22, 0x04, 0xF0, 0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0x01, 0x01, 0xE0, -0x44, 0x02, 0xF0, 0x90, 0x01, 0x00, 0x74, 0xFF, 0xF0, 0x90, 0x06, 0xB7, 0x74, 0x09, 0xF0, 0x90, -0x06, 0xB4, 0x74, 0x86, 0xF0, 0x7F, 0x7C, 0x7E, 0x08, 0x12, 0x2D, 0x5C, 0xEC, 0x54, 0x7F, 0xFC, -0x90, 0x82, 0x01, 0x12, 0x20, 0xCE, 0x90, 0x82, 0x01, 0x12, 0x44, 0xD9, 0x90, 0x85, 0xBB, 0x12, -0x20, 0xCE, 0x7F, 0x7C, 0x7E, 0x08, 0x12, 0x2E, 0xA2, 0x90, 0x85, 0xBB, 0x12, 0x20, 0xDA, 0xCC, -0xC0, 0x00, 0xC0, 0x7F, 0x8C, 0x7E, 0x08, 0x12, 0x2E, 0xA2, 0x90, 0x85, 0xBB, 0x12, 0x20, 0xDA, -0x00, 0xC0, 0x00, 0x14, 0x7F, 0x70, 0x7E, 0x0E, 0x12, 0x2E, 0xA2, 0x90, 0x81, 0xF9, 0x12, 0x20, -0xDA, 0x00, 0x03, 0x3E, 0x60, 0xE4, 0xFD, 0xFF, 0xB1, 0x1C, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x91, -0x65, 0x90, 0x81, 0x22, 0x74, 0x03, 0xF0, 0x22, 0x90, 0x05, 0x22, 0xE4, 0xF0, 0x90, 0x81, 0x22, -0x04, 0xF0, 0x22, 0x90, 0x05, 0x22, 0xE4, 0xF0, 0x90, 0x05, 0x27, 0xE0, 0x44, 0x40, 0xF0, 0x90, -0x81, 0x22, 0x74, 0x01, 0xF0, 0x22, 0x91, 0x65, 0x90, 0x05, 0x22, 0x74, 0x6F, 0xF0, 0x90, 0x05, -0x27, 0xE0, 0x54, 0xBF, 0xF0, 0x90, 0x81, 0x22, 0x74, 0x04, 0xF0, 0x22, 0xD3, 0x10, 0xAF, 0x01, -0xC3, 0xC0, 0xD0, 0xC0, 0x07, 0xC0, 0x05, 0x90, 0x81, 0xF9, 0x12, 0x44, 0xD9, 0x90, 0x81, 0xE5, -0x12, 0x20, 0xCE, 0xD0, 0x05, 0xD0, 0x07, 0x12, 0x60, 0xF5, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x90, -0x81, 0xC8, 0x12, 0x45, 0x1F, 0xEF, 0x12, 0x45, 0x28, 0x55, 0x71, 0x00, 0x55, 0x7A, 0x01, 0x55, -0x83, 0x02, 0x55, 0x8B, 0x03, 0x55, 0x94, 0x04, 0x55, 0x9C, 0x20, 0x55, 0xA4, 0x21, 0x55, 0xAD, -0x23, 0x55, 0xB5, 0x24, 0x55, 0xBE, 0x25, 0x55, 0xC7, 0x26, 0x55, 0xCF, 0xC0, 0x00, 0x00, 0x55, -0xD8, 0x90, 0x81, 0xC8, 0x12, 0x45, 0x16, 0x02, 0x6A, 0xB0, 0x90, 0x81, 0xC8, 0x12, 0x45, 0x16, -0x02, 0x65, 0x81, 0x90, 0x81, 0xC8, 0x12, 0x45, 0x16, 0x41, 0xC0, 0x90, 0x81, 0xC8, 0x12, 0x45, -0x16, 0x02, 0x75, 0xD8, 0x90, 0x81, 0xC8, 0x12, 0x45, 0x16, 0x80, 0x44, 0x90, 0x81, 0xC8, 0x12, -0x45, 0x16, 0xC1, 0x4B, 0x90, 0x81, 0xC8, 0x12, 0x45, 0x16, 0x02, 0x6A, 0xF8, 0x90, 0x81, 0xC8, -0x12, 0x45, 0x16, 0xE1, 0xE1, 0x90, 0x81, 0xC8, 0x12, 0x45, 0x16, 0x02, 0x4A, 0x6C, 0x90, 0x81, -0xC8, 0x12, 0x45, 0x16, 0x02, 0x6B, 0x3E, 0x90, 0x81, 0xC8, 0x12, 0x45, 0x16, 0x80, 0x3E, 0x90, -0x81, 0xC8, 0x12, 0x45, 0x16, 0x02, 0x6B, 0x4E, 0x90, 0x01, 0xC0, 0xE0, 0x44, 0x01, 0xF0, 0x22, -0x12, 0x5A, 0x4B, 0x12, 0x1F, 0xA4, 0xFF, 0x54, 0x01, 0xFE, 0x90, 0x81, 0x45, 0xE0, 0x54, 0xFE, -0x4E, 0xF0, 0xEF, 0xC3, 0x13, 0x30, 0xE0, 0x14, 0x90, 0x00, 0x01, 0x12, 0x1F, 0xBD, 0x90, 0x81, -0x46, 0xF0, 0x90, 0x00, 0x02, 0x12, 0x1F, 0xBD, 0x90, 0x81, 0x47, 0xF0, 0x22, 0x12, 0x1F, 0xA4, -0xFF, 0x54, 0x01, 0xFE, 0x90, 0x81, 0x3F, 0xE0, 0x54, 0xFE, 0x4E, 0xF0, 0x90, 0x00, 0x01, 0x12, -0x1F, 0xBD, 0xFE, 0x90, 0x05, 0x54, 0xE0, 0xC3, 0x9E, 0x90, 0x81, 0x40, 0xF0, 0xEF, 0x20, 0xE0, -0x07, 0x91, 0x65, 0x90, 0x05, 0x22, 0xE4, 0xF0, 0x90, 0x81, 0x3F, 0xE0, 0x54, 0x01, 0x90, 0x01, -0xBC, 0xF0, 0x90, 0x81, 0x40, 0xE0, 0x90, 0x01, 0xBD, 0xF0, 0x22, 0x12, 0x1F, 0xA4, 0xFF, 0x54, -0x7F, 0x90, 0x81, 0x27, 0xF0, 0xEF, 0xC4, 0x13, 0x13, 0x13, 0x54, 0x01, 0xA3, 0xF0, 0x90, 0x00, -0x01, 0x12, 0x1F, 0xBD, 0xFF, 0x54, 0xF0, 0xC4, 0x54, 0x0F, 0xFE, 0x90, 0x81, 0x26, 0xE0, 0x54, -0xF0, 0x4E, 0xF0, 0x90, 0x00, 0x03, 0x12, 0x1F, 0xBD, 0x54, 0x01, 0x25, 0xE0, 0xFE, 0x90, 0x81, -0x24, 0xE0, 0x54, 0xFD, 0x4E, 0xF0, 0xEF, 0x54, 0x0F, 0xC4, 0x54, 0xF0, 0xFF, 0x90, 0x81, 0x26, -0xE0, 0x54, 0x0F, 0x4F, 0xF0, 0x90, 0x00, 0x04, 0x12, 0x1F, 0xBD, 0x90, 0x81, 0x29, 0xF0, 0xD1, -0xC6, 0x90, 0x01, 0xB9, 0x74, 0x01, 0xF0, 0x90, 0x01, 0xB8, 0xF0, 0x90, 0x81, 0x27, 0xE0, 0x90, -0x01, 0xBA, 0xF0, 0x90, 0x81, 0x29, 0xE0, 0x90, 0x01, 0xBB, 0xF0, 0x90, 0x81, 0x26, 0xE0, 0x54, -0x0F, 0x90, 0x01, 0xBE, 0xF0, 0x22, 0x90, 0x81, 0xCB, 0x12, 0x45, 0x1F, 0x12, 0x72, 0xB3, 0x90, -0x81, 0x27, 0xE0, 0xFF, 0x12, 0x4C, 0x3E, 0x90, 0x81, 0x27, 0xE0, 0x60, 0x19, 0x90, 0x81, 0xCB, -0x12, 0x45, 0x16, 0x90, 0x00, 0x01, 0x12, 0x1F, 0xBD, 0x54, 0x0F, 0xFF, 0x90, 0x00, 0x02, 0x12, -0x1F, 0xBD, 0xFD, 0x12, 0x72, 0xC4, 0x22, 0xC0, 0xE0, 0xC0, 0xF0, 0xC0, 0x83, 0xC0, 0x82, 0xC0, -0xD0, 0x75, 0xD0, 0x00, 0xC0, 0x00, 0xC0, 0x01, 0xC0, 0x02, 0xC0, 0x03, 0xC0, 0x04, 0xC0, 0x05, -0xC0, 0x06, 0xC0, 0x07, 0x90, 0x01, 0xC4, 0x74, 0xF7, 0xF0, 0x74, 0x56, 0xA3, 0xF0, 0x12, 0x6C, -0xA5, 0xE5, 0x49, 0x30, 0xE1, 0x03, 0x12, 0x6F, 0x79, 0xE5, 0x49, 0x30, 0xE2, 0x02, 0xF1, 0xA5, -0xE5, 0x49, 0x30, 0xE3, 0x03, 0x12, 0x6F, 0x8D, 0xE5, 0x4A, 0x30, 0xE0, 0x03, 0x12, 0x6F, 0xC9, -0xE5, 0x4A, 0x30, 0xE4, 0x03, 0x12, 0x70, 0x22, 0xE5, 0x4B, 0x30, 0xE1, 0x02, 0x51, 0x78, 0xE5, -0x4B, 0x30, 0xE0, 0x02, 0x31, 0xFF, 0xE5, 0x4B, 0x30, 0xE3, 0x02, 0xF1, 0xE0, 0xE5, 0x4C, 0x30, -0xE1, 0x05, 0x7F, 0x03, 0x12, 0x44, 0x27, 0xE5, 0x4C, 0x30, 0xE4, 0x03, 0x12, 0x4E, 0xC4, 0xE5, -0x4C, 0x30, 0xE5, 0x03, 0x12, 0x70, 0x38, 0xE5, 0x4C, 0x30, 0xE6, 0x03, 0x12, 0x70, 0xCE, 0x74, -0xF7, 0x04, 0x90, 0x01, 0xC4, 0xF0, 0x74, 0x56, 0xA3, 0xF0, 0xD0, 0x07, 0xD0, 0x06, 0xD0, 0x05, -0xD0, 0x04, 0xD0, 0x03, 0xD0, 0x02, 0xD0, 0x01, 0xD0, 0x00, 0xD0, 0xD0, 0xD0, 0x82, 0xD0, 0x83, -0xD0, 0xF0, 0xD0, 0xE0, 0x32, 0x90, 0x81, 0x27, 0xE0, 0x60, 0x34, 0x90, 0x06, 0x92, 0xE0, 0x30, -0xE0, 0x23, 0xE4, 0xF5, 0x1D, 0x90, 0x81, 0x3A, 0xE0, 0xC3, 0x13, 0x54, 0x7F, 0xF5, 0x1E, 0xE4, -0xFB, 0xFD, 0x7F, 0x58, 0x7E, 0x01, 0x11, 0x05, 0x90, 0x01, 0x5B, 0x74, 0x05, 0xF0, 0x90, 0x06, -0x92, 0x74, 0x01, 0xF0, 0x22, 0x90, 0x81, 0x24, 0xE0, 0x54, 0xF7, 0xF0, 0x12, 0x47, 0x2A, 0x22, -0x22, 0x12, 0x1F, 0xA4, 0x90, 0x81, 0x31, 0xF0, 0x22, 0x90, 0x01, 0xC8, 0xE4, 0xF0, 0xA3, 0xF0, -0xA3, 0xF0, 0x7B, 0x01, 0x7A, 0x81, 0x79, 0x51, 0x7F, 0xFF, 0xFE, 0x12, 0x2B, 0x27, 0xBF, 0x01, -0x09, 0x90, 0x81, 0x51, 0xE0, 0x64, 0x03, 0x60, 0x03, 0x22, 0x01, 0xAB, 0xE4, 0x90, 0x81, 0x56, -0xF0, 0x90, 0x81, 0x56, 0xE0, 0xFF, 0xC3, 0x94, 0x02, 0x40, 0x02, 0x01, 0xE6, 0xC3, 0x74, 0xFE, -0x9F, 0xFF, 0xE4, 0x94, 0x00, 0xFE, 0x7B, 0x01, 0x7A, 0x81, 0x79, 0x52, 0x12, 0x2B, 0x27, 0xEF, -0x64, 0x01, 0x70, 0x77, 0x90, 0x81, 0x52, 0xE0, 0xFF, 0x54, 0xC0, 0xFE, 0x60, 0x05, 0xEF, 0x54, -0x0C, 0x70, 0x16, 0x90, 0x81, 0x52, 0xE0, 0xFF, 0x54, 0x30, 0x60, 0x67, 0xEF, 0x54, 0x03, 0x60, -0x62, 0x90, 0x81, 0x53, 0x74, 0x01, 0xF0, 0x80, 0x05, 0xE4, 0x90, 0x81, 0x53, 0xF0, 0x90, 0x81, -0x53, 0xE0, 0x90, 0x81, 0x52, 0x70, 0x16, 0xE0, 0xFF, 0xEE, 0x13, 0x13, 0x54, 0x3F, 0x90, 0x81, -0x54, 0xF0, 0xEF, 0x54, 0x0C, 0x13, 0x13, 0x54, 0x3F, 0xA3, 0xF0, 0x80, 0x0D, 0xE0, 0xFE, 0x54, -0x30, 0x90, 0x81, 0x54, 0xF0, 0xEE, 0x54, 0x03, 0xA3, 0xF0, 0x90, 0x81, 0x54, 0xE0, 0x64, 0x30, -0x70, 0x54, 0xA3, 0xE0, 0x64, 0x02, 0x70, 0x4E, 0x90, 0x00, 0xF5, 0xE0, 0x54, 0x40, 0x90, 0x81, -0x57, 0xF0, 0xE0, 0x70, 0x41, 0xA3, 0x74, 0x02, 0xF0, 0x80, 0x10, 0x90, 0x81, 0x58, 0x74, 0x01, -0xF0, 0x80, 0x08, 0x90, 0x81, 0x56, 0xE0, 0x04, 0xF0, 0x01, 0x11, 0x90, 0x01, 0xC4, 0x74, 0xE9, -0xF0, 0x74, 0x57, 0xA3, 0xF0, 0x90, 0x81, 0x58, 0xE0, 0x90, 0x01, 0xC8, 0xF0, 0x90, 0x81, 0x52, -0xE0, 0x90, 0x01, 0xC9, 0xF0, 0x90, 0x81, 0x53, 0xE0, 0x90, 0x01, 0xCA, 0xF0, 0xE4, 0xFD, 0x7F, -0x1F, 0x12, 0x32, 0x1E, 0x80, 0xD5, 0x22, 0x90, 0x00, 0xF7, 0xE0, 0x20, 0xE7, 0x09, 0xE0, 0x7F, -0x01, 0x20, 0xE6, 0x0C, 0x7F, 0x02, 0x22, 0x90, 0x00, 0xF7, 0xE0, 0x30, 0xE6, 0x02, 0x7F, 0x03, -0x22, 0x11, 0xE7, 0x90, 0x80, 0x3C, 0xEF, 0xF0, 0x31, 0x13, 0x90, 0x01, 0x64, 0x74, 0x01, 0xF0, -0x02, 0x2D, 0xA7, 0x31, 0x81, 0x31, 0xB1, 0x31, 0x40, 0x31, 0x5F, 0xE4, 0xF5, 0x35, 0xF5, 0x36, -0xF5, 0x37, 0xF5, 0x38, 0xAD, 0x35, 0x7F, 0x50, 0x12, 0x32, 0x1E, 0xAD, 0x36, 0x7F, 0x51, 0x12, -0x32, 0x1E, 0xAD, 0x37, 0x7F, 0x52, 0x12, 0x32, 0x1E, 0xAD, 0x38, 0x7F, 0x53, 0x02, 0x32, 0x1E, -0x75, 0x3D, 0x10, 0xE4, 0xF5, 0x3E, 0x75, 0x3F, 0x07, 0x75, 0x40, 0x02, 0x90, 0x01, 0x30, 0xE5, -0x3D, 0xF0, 0xA3, 0xE5, 0x3E, 0xF0, 0xA3, 0xE5, 0x3F, 0xF0, 0xA3, 0xE5, 0x40, 0xF0, 0x22, 0x75, -0x45, 0x0E, 0x75, 0x46, 0x01, 0x43, 0x46, 0x10, 0x75, 0x47, 0x03, 0x75, 0x48, 0x62, 0x90, 0x01, -0x38, 0xE5, 0x45, 0xF0, 0xA3, 0xE5, 0x46, 0xF0, 0xA3, 0xE5, 0x47, 0xF0, 0xA3, 0xE5, 0x48, 0xF0, -0x22, 0x90, 0x01, 0x30, 0xE4, 0xF0, 0xA3, 0xF0, 0xA3, 0xF0, 0xA3, 0xF0, 0x90, 0x01, 0x38, 0xF0, -0xA3, 0xF0, 0xA3, 0xF0, 0xA3, 0xF0, 0xFD, 0x7F, 0x50, 0x12, 0x32, 0x1E, 0xE4, 0xFD, 0x7F, 0x51, -0x12, 0x32, 0x1E, 0xE4, 0xFD, 0x7F, 0x52, 0x12, 0x32, 0x1E, 0xE4, 0xFD, 0x7F, 0x53, 0x02, 0x32, -0x1E, 0x90, 0x01, 0x34, 0x74, 0xFF, 0xF0, 0xA3, 0xF0, 0xA3, 0xF0, 0xA3, 0xF0, 0x90, 0x01, 0x3C, -0xF0, 0xA3, 0xF0, 0xA3, 0xF0, 0xA3, 0xF0, 0xFD, 0x7F, 0x54, 0x12, 0x32, 0x1E, 0x7D, 0xFF, 0x7F, -0x55, 0x12, 0x32, 0x1E, 0x7D, 0xFF, 0x7F, 0x56, 0x12, 0x32, 0x1E, 0x7D, 0xFF, 0x7F, 0x57, 0x02, -0x32, 0x1E, 0x90, 0x00, 0x80, 0xE0, 0x44, 0x80, 0xFD, 0x7F, 0x80, 0x12, 0x32, 0x1E, 0x90, 0xFD, -0x00, 0xE0, 0x54, 0xBF, 0xF0, 0x12, 0x57, 0xE9, 0x51, 0x77, 0x12, 0x32, 0x77, 0x51, 0xC9, 0x51, -0x5E, 0x7F, 0x01, 0x12, 0x43, 0x15, 0x90, 0x81, 0x41, 0x74, 0x02, 0xF0, 0xFF, 0x12, 0x43, 0x15, -0x90, 0x81, 0x41, 0xE0, 0x04, 0xF0, 0x7F, 0x03, 0x12, 0x43, 0x15, 0x90, 0x81, 0x41, 0xE0, 0x04, -0xF0, 0x31, 0x01, 0x51, 0x3F, 0x90, 0x00, 0x80, 0xE0, 0x44, 0x40, 0xFD, 0x7F, 0x80, 0x12, 0x32, -0x1E, 0x75, 0x20, 0xFF, 0x51, 0x68, 0x51, 0xF9, 0x51, 0x7F, 0xE4, 0xFF, 0x02, 0x43, 0x9E, 0x51, -0x62, 0x51, 0x6F, 0x51, 0xA7, 0x71, 0x4F, 0x51, 0x8A, 0x51, 0x95, 0x90, 0x81, 0x45, 0xE0, 0x54, -0xFE, 0xF0, 0xA3, 0x74, 0x03, 0xF0, 0xA3, 0xF0, 0xE4, 0xA3, 0xF0, 0xA3, 0xF0, 0x22, 0xE4, 0xF5, -0x4D, 0x22, 0xE4, 0x90, 0x80, 0xDE, 0xF0, 0x22, 0x75, 0xE8, 0x03, 0x75, 0xA8, 0x84, 0x22, 0xE4, -0x90, 0x80, 0xD8, 0xF0, 0xA3, 0xF0, 0x22, 0x90, 0x01, 0x94, 0xE0, 0x44, 0x01, 0xF0, 0x22, 0x90, -0x01, 0xE4, 0x74, 0x0B, 0xF0, 0xA3, 0x74, 0x01, 0xF0, 0x22, 0x90, 0x81, 0x3F, 0xE0, 0x54, 0xFE, -0xF0, 0xE4, 0xA3, 0xF0, 0x22, 0x90, 0x81, 0x42, 0xE0, 0x54, 0xFE, 0xF0, 0x54, 0x7F, 0xF0, 0xA3, -0x74, 0x0A, 0xF0, 0xE4, 0xA3, 0xF0, 0x22, 0x90, 0x81, 0x1F, 0xE0, 0x54, 0xFE, 0xF0, 0x54, 0xFD, -0xF0, 0x54, 0xFB, 0xF0, 0x54, 0xF7, 0xF0, 0x54, 0xEF, 0xF0, 0x54, 0xDF, 0xF0, 0xE4, 0xA3, 0xF0, -0xA3, 0xF0, 0xA3, 0xF0, 0xA3, 0x74, 0x0C, 0xF0, 0x22, 0x90, 0x01, 0x01, 0xE0, 0x44, 0x04, 0xF0, -0x90, 0x01, 0x9C, 0x74, 0x7E, 0xF0, 0xA3, 0x74, 0x92, 0xF0, 0xA3, 0x74, 0xA0, 0xF0, 0xA3, 0x74, -0x24, 0xF0, 0x90, 0x01, 0x9B, 0x74, 0x49, 0xF0, 0x90, 0x01, 0x9A, 0x74, 0xE0, 0xF0, 0x90, 0x01, -0x99, 0xE4, 0xF0, 0x90, 0x01, 0x98, 0x04, 0xF0, 0x22, 0xE4, 0x90, 0x81, 0x51, 0xF0, 0xA3, 0xF0, -0x90, 0x01, 0x98, 0xE0, 0x7F, 0x00, 0x30, 0xE4, 0x02, 0x7F, 0x01, 0xEF, 0x64, 0x01, 0x60, 0x3E, -0xC3, 0x90, 0x81, 0x52, 0xE0, 0x94, 0x88, 0x90, 0x81, 0x51, 0xE0, 0x94, 0x13, 0x40, 0x08, 0x90, -0x01, 0xC1, 0xE0, 0x44, 0x10, 0xF0, 0x22, 0x90, 0x81, 0x51, 0xE4, 0x75, 0xF0, 0x01, 0x12, 0x44, -0xA9, 0x7F, 0x14, 0x7E, 0x00, 0x12, 0x32, 0xAA, 0xD3, 0x90, 0x81, 0x52, 0xE0, 0x94, 0x32, 0x90, -0x81, 0x51, 0xE0, 0x94, 0x00, 0x40, 0xB9, 0x90, 0x01, 0xC6, 0xE0, 0x30, 0xE3, 0xB2, 0x22, 0xE4, -0x90, 0x81, 0x27, 0xF0, 0xA3, 0xF0, 0x90, 0x81, 0x26, 0xE0, 0x54, 0x0F, 0xF0, 0x54, 0xF0, 0xF0, -0x90, 0x81, 0x24, 0xE0, 0x54, 0xFD, 0xF0, 0x54, 0xF7, 0xF0, 0x54, 0xEF, 0xF0, 0x90, 0x81, 0x2D, -0x74, 0x01, 0xF0, 0xA3, 0xF0, 0x90, 0x81, 0x24, 0xE0, 0x54, 0xFB, 0xF0, 0xA3, 0xE0, 0x54, 0xFB, -0xF0, 0xE4, 0x90, 0x81, 0x30, 0xF0, 0x90, 0x81, 0x2F, 0x74, 0x07, 0xF0, 0x90, 0x81, 0x32, 0xE4, -0xF0, 0xA3, 0x74, 0x02, 0xF0, 0xE4, 0x90, 0x81, 0x2B, 0xF0, 0x90, 0x81, 0x24, 0xE0, 0x54, 0xFE, -0xF0, 0x90, 0x81, 0x29, 0x74, 0x0C, 0xF0, 0x90, 0x81, 0x24, 0xE0, 0x54, 0xDF, 0xF0, 0x90, 0x81, -0x2A, 0x74, 0x0C, 0xF0, 0x90, 0x81, 0x24, 0xE0, 0x54, 0xBF, 0xF0, 0x54, 0x7F, 0xF0, 0xA3, 0xE0, -0x54, 0xFE, 0xF0, 0x54, 0xFD, 0xF0, 0x54, 0xF7, 0xF0, 0x90, 0x81, 0x34, 0x12, 0x20, 0xDA, 0x00, -0x00, 0x00, 0x00, 0x90, 0x80, 0x3C, 0xE0, 0xB4, 0x01, 0x08, 0x90, 0x81, 0x31, 0x74, 0x99, 0xF0, -0x80, 0x12, 0x90, 0x80, 0x3C, 0xE0, 0x90, 0x81, 0x31, 0xB4, 0x03, 0x05, 0x74, 0x90, 0xF0, 0x80, -0x03, 0x74, 0x40, 0xF0, 0x90, 0x81, 0x38, 0x74, 0x01, 0xF0, 0xA3, 0x74, 0x05, 0xF0, 0xA3, 0xE0, -0x54, 0x01, 0x44, 0x28, 0xF0, 0xA3, 0x74, 0x05, 0xF0, 0xE4, 0xA3, 0xF0, 0xA3, 0xE0, 0x54, 0xFD, -0xF0, 0x54, 0xFB, 0xF0, 0x54, 0xF7, 0xF0, 0x54, 0xEF, 0xF0, 0x54, 0xDF, 0xF0, 0x54, 0xBF, 0xF0, -0xE4, 0xA3, 0xF0, 0x22, 0xE4, 0x90, 0x81, 0x59, 0xF0, 0x90, 0x81, 0x59, 0xE0, 0x64, 0x01, 0xF0, -0x24, 0x24, 0x90, 0x01, 0xC4, 0xF0, 0x74, 0x5C, 0xA3, 0xF0, 0x90, 0x81, 0x2A, 0xE0, 0xFF, 0x90, -0x81, 0x29, 0xE0, 0x6F, 0x60, 0x03, 0x12, 0x47, 0x2A, 0xD1, 0x08, 0xBF, 0x01, 0x02, 0x91, 0x5F, -0xB1, 0xF2, 0x12, 0x32, 0x9E, 0xBF, 0x01, 0x02, 0xB1, 0x67, 0x12, 0x42, 0x4D, 0x80, 0xCA, 0xD3, -0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0x81, 0x24, 0xE0, 0x30, 0xE0, 0x24, 0x90, 0x81, 0x1F, -0xE0, 0xFF, 0x30, 0xE0, 0x1A, 0xC3, 0x13, 0x30, 0xE0, 0x07, 0xB1, 0xFB, 0xBF, 0x01, 0x12, 0x80, -0x0A, 0x90, 0x81, 0x23, 0xE0, 0xFF, 0x60, 0x03, 0xB4, 0x08, 0x06, 0x91, 0x96, 0x80, 0x02, 0x91, -0xA6, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0xB1, 0x22, 0x91, -0xBA, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x90, 0x81, 0x2A, 0xE0, 0x70, 0x0D, 0xD1, 0x2F, 0xBF, 0x01, -0x08, 0x91, 0x96, 0x90, 0x01, 0xE5, 0xE0, 0x04, 0xF0, 0x22, 0xB1, 0xF3, 0x90, 0x00, 0x08, 0xE0, -0x54, 0xEF, 0xFD, 0x7F, 0x08, 0x12, 0x32, 0x1E, 0xE4, 0xFF, 0x8F, 0x50, 0xE4, 0x90, 0x81, 0x5A, -0xF0, 0xA3, 0xF0, 0x90, 0x01, 0x09, 0xE0, 0x7F, 0x00, 0x30, 0xE7, 0x02, 0x7F, 0x01, 0xEF, 0x65, -0x50, 0x60, 0x3E, 0xC3, 0x90, 0x81, 0x5B, 0xE0, 0x94, 0x88, 0x90, 0x81, 0x5A, 0xE0, 0x94, 0x13, -0x40, 0x08, 0x90, 0x01, 0xC0, 0xE0, 0x44, 0x10, 0xF0, 0x22, 0x90, 0x81, 0x5A, 0xE4, 0x75, 0xF0, -0x01, 0x12, 0x44, 0xA9, 0x7F, 0x14, 0x7E, 0x00, 0x12, 0x32, 0xAA, 0xD3, 0x90, 0x81, 0x5B, 0xE0, -0x94, 0x32, 0x90, 0x81, 0x5A, 0xE0, 0x94, 0x00, 0x40, 0xB9, 0x90, 0x01, 0xC6, 0xE0, 0x30, 0xE0, -0xB2, 0x22, 0x90, 0x81, 0x31, 0xE0, 0xFD, 0x7F, 0x93, 0x12, 0x32, 0x1E, 0x90, 0x81, 0x28, 0xE0, -0x60, 0x12, 0x90, 0x01, 0x2F, 0xE0, 0x30, 0xE7, 0x05, 0x74, 0x10, 0xF0, 0x80, 0x06, 0x90, 0x01, -0x2F, 0x74, 0x90, 0xF0, 0x90, 0x00, 0x08, 0xE0, 0x44, 0x10, 0xFD, 0x7F, 0x08, 0x12, 0x32, 0x1E, -0x7F, 0x01, 0x91, 0xCA, 0x90, 0x00, 0x90, 0xE0, 0x44, 0x01, 0xFD, 0x7F, 0x90, 0x12, 0x32, 0x1E, -0x7F, 0x14, 0x7E, 0x00, 0x02, 0x32, 0xAA, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x12, 0x2D, -0xA7, 0xE4, 0xF5, 0x52, 0x12, 0x32, 0x9E, 0xEF, 0x60, 0x73, 0x63, 0x52, 0x01, 0xE5, 0x52, 0x24, -0x67, 0x90, 0x01, 0xC4, 0xF0, 0x74, 0x5D, 0xA3, 0xF0, 0x90, 0x00, 0x88, 0xE0, 0xF5, 0x50, 0xF5, -0x51, 0x54, 0x0F, 0x60, 0xDF, 0xE5, 0x50, 0x30, 0xE0, 0x0B, 0x20, 0xE4, 0x03, 0x12, 0x29, 0xC5, -0x53, 0x51, 0xEE, 0x80, 0x3F, 0xE5, 0x50, 0x30, 0xE1, 0x16, 0x20, 0xE5, 0x0E, 0x12, 0x11, 0xBD, -0xEF, 0x70, 0x03, 0x43, 0x51, 0x20, 0x90, 0x01, 0x06, 0xE4, 0xF0, 0x53, 0x51, 0xFD, 0x80, 0x24, -0xE5, 0x50, 0x30, 0xE2, 0x0B, 0x20, 0xE6, 0x03, 0x12, 0x67, 0x06, 0x53, 0x51, 0xFB, 0x80, 0x14, -0xE5, 0x50, 0x30, 0xE3, 0x0F, 0x20, 0xE7, 0x09, 0x12, 0x61, 0x6E, 0xEF, 0x70, 0x03, 0x43, 0x51, -0x80, 0x53, 0x51, 0xF7, 0xAD, 0x51, 0x7F, 0x88, 0x12, 0x32, 0x1E, 0x80, 0x87, 0xD0, 0xD0, 0x92, -0xAF, 0x22, 0x22, 0x90, 0x00, 0x90, 0xE0, 0x20, 0xE0, 0xF9, 0x22, 0x90, 0x81, 0x22, 0xE0, 0x64, -0x02, 0x7F, 0x01, 0x60, 0x02, 0x7F, 0x00, 0x22, 0x7F, 0x02, 0x90, 0x81, 0x41, 0xE0, 0xFE, 0xEF, -0xC3, 0x9E, 0x50, 0x18, 0xEF, 0x25, 0xE0, 0x24, 0x81, 0xF8, 0xE6, 0x30, 0xE4, 0x0B, 0x90, 0x01, -0xB8, 0x74, 0x08, 0xF0, 0xA3, 0xF0, 0x7F, 0x00, 0x22, 0x0F, 0x80, 0xDE, 0x7F, 0x01, 0x22, 0x90, -0x02, 0x87, 0xE0, 0x60, 0x08, 0x90, 0x01, 0xB8, 0x74, 0x01, 0xF0, 0x80, 0x17, 0x90, 0x02, 0x86, -0xE0, 0x20, 0xE1, 0x08, 0x90, 0x01, 0xB8, 0x74, 0x04, 0xF0, 0x80, 0x08, 0x90, 0x01, 0xB8, 0xE4, -0xF0, 0x7F, 0x01, 0x22, 0x90, 0x01, 0xB9, 0x74, 0x08, 0xF0, 0x7F, 0x00, 0x22, 0xE4, 0xFB, 0xFA, -0xFD, 0x7F, 0x01, 0x12, 0x44, 0x4E, 0x90, 0x81, 0xBD, 0xEF, 0xF0, 0x60, 0xF0, 0xD1, 0x71, 0x80, -0xEC, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0x01, 0xCC, 0xE0, 0x54, 0x0F, 0x90, 0x81, -0xBE, 0xF0, 0x90, 0x81, 0xBE, 0xE0, 0xFD, 0x70, 0x02, 0xE1, 0x9C, 0x90, 0x82, 0x09, 0xE0, 0xFF, -0x74, 0x01, 0x7E, 0x00, 0xA8, 0x07, 0x08, 0x80, 0x05, 0xC3, 0x33, 0xCE, 0x33, 0xCE, 0xD8, 0xF9, -0xFF, 0xEF, 0x5D, 0x70, 0x02, 0xE1, 0x95, 0x90, 0x82, 0x09, 0xE0, 0x75, 0xF0, 0x04, 0x90, 0x01, -0xD0, 0x12, 0x45, 0x0A, 0xE0, 0x90, 0x81, 0xBF, 0xF0, 0x75, 0x13, 0x01, 0x75, 0x14, 0x81, 0x75, -0x15, 0xBF, 0x75, 0x16, 0x01, 0x7B, 0x01, 0x7A, 0x81, 0x79, 0xC0, 0x12, 0x2B, 0xED, 0x90, 0x82, -0x09, 0xE0, 0x75, 0xF0, 0x04, 0x90, 0x01, 0xD1, 0x12, 0x45, 0x0A, 0xE0, 0x90, 0x81, 0xC1, 0xF0, -0x90, 0x82, 0x09, 0xE0, 0x75, 0xF0, 0x04, 0x90, 0x01, 0xD2, 0x12, 0x45, 0x0A, 0xE0, 0x90, 0x81, -0xC2, 0xF0, 0x90, 0x82, 0x09, 0xE0, 0x75, 0xF0, 0x04, 0x90, 0x01, 0xD3, 0x12, 0x45, 0x0A, 0xE0, -0x90, 0x81, 0xC3, 0xF0, 0x90, 0x82, 0x09, 0xE0, 0x75, 0xF0, 0x04, 0x90, 0x01, 0xF0, 0x12, 0x45, -0x0A, 0xE0, 0x90, 0x81, 0xC4, 0xF0, 0x90, 0x82, 0x09, 0xE0, 0x75, 0xF0, 0x04, 0x90, 0x01, 0xF1, -0x12, 0x45, 0x0A, 0xE0, 0x90, 0x81, 0xC5, 0xF0, 0x90, 0x82, 0x09, 0xE0, 0x75, 0xF0, 0x04, 0x90, -0x01, 0xF2, 0x12, 0x45, 0x0A, 0xE0, 0x90, 0x81, 0xC6, 0xF0, 0x90, 0x82, 0x09, 0xE0, 0x75, 0xF0, -0x04, 0x90, 0x01, 0xF3, 0x12, 0x45, 0x0A, 0xE0, 0x90, 0x81, 0xC7, 0xF0, 0x90, 0x81, 0xBE, 0xE0, -0xFF, 0x90, 0x82, 0x09, 0xE0, 0xFE, 0x74, 0x01, 0xA8, 0x06, 0x08, 0x80, 0x02, 0xC3, 0x33, 0xD8, -0xFC, 0xF4, 0x5F, 0x90, 0x81, 0xBE, 0xF0, 0x90, 0x82, 0x09, 0xE0, 0xFF, 0x74, 0x01, 0xA8, 0x07, -0x08, 0x80, 0x02, 0xC3, 0x33, 0xD8, 0xFC, 0x90, 0x01, 0xCC, 0xF0, 0x90, 0x81, 0xC0, 0xE0, 0xFF, -0x7B, 0x01, 0x7A, 0x81, 0x79, 0xC1, 0x12, 0x55, 0x3F, 0x90, 0x82, 0x09, 0xE0, 0x04, 0xF0, 0xE0, -0x54, 0x03, 0xF0, 0xC1, 0x82, 0x90, 0x01, 0xC0, 0xE0, 0x44, 0x02, 0xF0, 0xD0, 0xD0, 0x92, 0xAF, -0x22, 0xE4, 0xFB, 0xFA, 0xFD, 0x7F, 0x01, 0x12, 0x44, 0x4E, 0x90, 0x81, 0xD0, 0xEF, 0xF0, 0x60, -0xF0, 0x12, 0x6C, 0x19, 0x80, 0xEB, 0x90, 0x81, 0xD4, 0xEF, 0xF0, 0xA3, 0xED, 0xF0, 0xA3, 0x12, -0x20, 0xDA, 0x00, 0x00, 0x00, 0x00, 0xE4, 0x90, 0x81, 0xE2, 0xF0, 0x7F, 0x24, 0x7E, 0x08, 0x12, -0x2D, 0x5C, 0x90, 0x81, 0xDA, 0x12, 0x20, 0xCE, 0x90, 0x81, 0xD4, 0xE0, 0xFB, 0x70, 0x08, 0x90, -0x81, 0xDA, 0x12, 0x44, 0xD9, 0x80, 0x16, 0xEB, 0x75, 0xF0, 0x08, 0xA4, 0x24, 0x62, 0xF5, 0x82, -0xE4, 0x34, 0x87, 0xF5, 0x83, 0xE0, 0xFE, 0xA3, 0xE0, 0xFF, 0x12, 0x2D, 0x5C, 0x90, 0x81, 0xDE, -0x12, 0x20, 0xCE, 0x90, 0x81, 0xD5, 0xE0, 0xFF, 0xE4, 0xFC, 0xFD, 0xFE, 0x78, 0x17, 0x12, 0x20, -0xBB, 0xA8, 0x04, 0xA9, 0x05, 0xAA, 0x06, 0xAB, 0x07, 0x90, 0x81, 0xDE, 0x12, 0x44, 0xD9, 0xED, -0x54, 0x7F, 0xFD, 0xEC, 0x54, 0x80, 0xFC, 0x12, 0x44, 0xCC, 0xEC, 0x44, 0x80, 0xFC, 0x90, 0x81, -0xDE, 0x12, 0x20, 0xCE, 0x90, 0x81, 0xDA, 0x12, 0x44, 0xD9, 0xEC, 0x54, 0x7F, 0xFC, 0x90, 0x85, -0xBB, 0x12, 0x20, 0xCE, 0x7F, 0x24, 0x7E, 0x08, 0x12, 0x2E, 0xA2, 0x90, 0x81, 0xD4, 0xE0, 0x75, -0xF0, 0x08, 0xA4, 0x24, 0x62, 0xF5, 0x82, 0xE4, 0x34, 0x87, 0xF5, 0x83, 0xE0, 0xFE, 0xA3, 0xE0, -0xFF, 0xC0, 0x06, 0xC0, 0x07, 0x90, 0x81, 0xDE, 0x12, 0x44, 0xD9, 0x90, 0x85, 0xBB, 0x12, 0x20, -0xCE, 0xD0, 0x07, 0xD0, 0x06, 0x12, 0x2E, 0xA2, 0x90, 0x81, 0xDA, 0x12, 0x44, 0xD9, 0xEC, 0x44, -0x80, 0xFC, 0x90, 0x85, 0xBB, 0x12, 0x20, 0xCE, 0x7F, 0x24, 0x7E, 0x08, 0x12, 0x2E, 0xA2, 0x90, -0x81, 0xD4, 0xE0, 0x70, 0x04, 0x7F, 0x20, 0x80, 0x09, 0x90, 0x81, 0xD4, 0xE0, 0xB4, 0x01, 0x16, -0x7F, 0x28, 0x7E, 0x08, 0x12, 0x2D, 0x5C, 0x78, 0x08, 0x12, 0x20, 0xA8, 0xEF, 0x54, 0x01, 0xFF, -0xE4, 0x90, 0x81, 0xE2, 0xEF, 0xF0, 0x90, 0x81, 0xE2, 0xE0, 0x90, 0x81, 0xD4, 0x60, 0x0E, 0xE0, -0x75, 0xF0, 0x08, 0xA4, 0x24, 0x66, 0xF5, 0x82, 0xE4, 0x34, 0x87, 0x80, 0x0C, 0xE0, 0x75, 0xF0, -0x08, 0xA4, 0x24, 0x64, 0xF5, 0x82, 0xE4, 0x34, 0x87, 0xF5, 0x83, 0xE0, 0xFE, 0xA3, 0xE0, 0xFF, -0x12, 0x2D, 0x5C, 0xED, 0x54, 0x0F, 0xFD, 0xE4, 0xFC, 0x90, 0x81, 0xD6, 0x12, 0x20, 0xCE, 0x90, -0x81, 0xD6, 0x02, 0x44, 0xD9, 0x90, 0x81, 0xE3, 0xEF, 0xF0, 0xAB, 0x05, 0x90, 0x81, 0xE9, 0x12, -0x20, 0xDA, 0x00, 0x00, 0x00, 0x00, 0xAF, 0x03, 0xE4, 0xFC, 0xFD, 0xFE, 0x78, 0x14, 0x12, 0x20, -0xBB, 0xA8, 0x04, 0xA9, 0x05, 0xAA, 0x06, 0xAB, 0x07, 0x90, 0x81, 0xE5, 0x12, 0x44, 0xD9, 0xED, -0x54, 0x0F, 0xFD, 0xE4, 0xFC, 0x12, 0x44, 0xCC, 0xEC, 0x54, 0x0F, 0xFC, 0x90, 0x81, 0xE9, 0x12, -0x20, 0xCE, 0x90, 0x81, 0xE3, 0xE0, 0x75, 0xF0, 0x08, 0xA4, 0x24, 0x60, 0xF5, 0x82, 0xE4, 0x34, -0x87, 0xF5, 0x83, 0xE0, 0xFE, 0xA3, 0xE0, 0xFF, 0xC0, 0x06, 0xC0, 0x07, 0x90, 0x81, 0xE9, 0x12, -0x44, 0xD9, 0x90, 0x85, 0xBB, 0x12, 0x20, 0xCE, 0xD0, 0x07, 0xD0, 0x06, 0x02, 0x2E, 0xA2, 0xD3, -0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x12, 0x5F, 0xB6, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x78, 0x10, -0x74, 0x01, 0xF2, 0x90, 0x02, 0x09, 0xE0, 0x78, 0x00, 0xF2, 0x08, 0x74, 0x20, 0xF2, 0x18, 0xE2, -0xFF, 0x30, 0xE0, 0x05, 0x08, 0xE2, 0x24, 0x80, 0xF2, 0xEF, 0xC3, 0x13, 0x90, 0xFD, 0x10, 0xF0, -0x78, 0x01, 0xE2, 0x24, 0x00, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x78, 0x03, 0xF2, -0x64, 0x04, 0x60, 0x0D, 0xE2, 0xFF, 0x64, 0x08, 0x60, 0x07, 0xEF, 0x64, 0x0C, 0x60, 0x02, 0x61, -0xDE, 0xE4, 0x78, 0x02, 0xF2, 0x78, 0x03, 0xE2, 0xFF, 0x18, 0xE2, 0xC3, 0x9F, 0x50, 0x2D, 0xE2, -0xFD, 0x18, 0xE2, 0x2D, 0x90, 0x81, 0x5A, 0xF0, 0xE0, 0xFF, 0x24, 0x00, 0xF5, 0x82, 0xE4, 0x34, -0xFC, 0xF5, 0x83, 0xE0, 0xFE, 0x74, 0x04, 0x2D, 0xF8, 0xEE, 0xF2, 0xEF, 0xB4, 0xFF, 0x06, 0x90, -0xFD, 0x10, 0xE0, 0x04, 0xF0, 0x78, 0x02, 0xE2, 0x04, 0xF2, 0x80, 0xC9, 0x78, 0x04, 0xE2, 0x78, -0x12, 0xF2, 0xFF, 0x78, 0x05, 0xE2, 0x78, 0x11, 0xF2, 0x78, 0x06, 0xE2, 0x78, 0x13, 0xF2, 0x78, -0x07, 0xE2, 0x78, 0x14, 0xF2, 0x78, 0x08, 0xE2, 0x78, 0x33, 0xF2, 0x78, 0x09, 0xE2, 0x78, 0x34, -0xF2, 0x78, 0x0A, 0xE2, 0x78, 0x35, 0xF2, 0x78, 0x0B, 0xE2, 0x78, 0x36, 0xF2, 0x78, 0x0C, 0xE2, -0x78, 0x37, 0xF2, 0x78, 0x0D, 0xE2, 0x78, 0x38, 0xF2, 0x78, 0x0E, 0xE2, 0x78, 0x39, 0xF2, 0x78, -0x0F, 0xE2, 0x78, 0x3A, 0xF2, 0xE4, 0x78, 0x15, 0xF2, 0xEF, 0x24, 0xF8, 0x60, 0x75, 0x24, 0xFC, -0x60, 0x6C, 0x24, 0x08, 0x60, 0x02, 0x61, 0xC0, 0x78, 0x11, 0xE2, 0xB4, 0x01, 0x05, 0x12, 0x29, -0xC5, 0x61, 0xC5, 0x78, 0x11, 0xE2, 0xB4, 0x02, 0x05, 0x12, 0x11, 0xBD, 0x61, 0xC5, 0x78, 0x11, -0xE2, 0xB4, 0x03, 0x04, 0xF1, 0x06, 0x61, 0xC5, 0x78, 0x11, 0xE2, 0xB4, 0x10, 0x17, 0x78, 0x14, -0xE2, 0xFE, 0x18, 0xE2, 0xFD, 0xED, 0xFF, 0x78, 0x16, 0xEE, 0xF2, 0xFE, 0x08, 0xEF, 0xF2, 0xFF, -0x12, 0x32, 0xAA, 0x61, 0xC5, 0x78, 0x11, 0xE2, 0xB4, 0x11, 0x17, 0x78, 0x14, 0xE2, 0xFE, 0x18, -0xE2, 0xFD, 0xED, 0xFF, 0x78, 0x16, 0xEE, 0xF2, 0xFE, 0x08, 0xEF, 0xF2, 0xFF, 0x12, 0x32, 0x06, -0x61, 0xC5, 0x78, 0x11, 0xE2, 0xF4, 0x60, 0x02, 0x61, 0xC5, 0x18, 0xF2, 0x61, 0xC5, 0x78, 0x15, -0x74, 0x01, 0xF2, 0x78, 0x11, 0xE2, 0x64, 0x07, 0x60, 0x02, 0x61, 0xAA, 0x78, 0x34, 0xE2, 0xFF, -0xE4, 0xFC, 0xFD, 0xFE, 0x78, 0x08, 0x12, 0x20, 0xBB, 0xC0, 0x04, 0xA9, 0x05, 0xAA, 0x06, 0xAB, -0x07, 0x78, 0x33, 0xE2, 0xFF, 0xE4, 0xFC, 0xFD, 0xFE, 0xD0, 0x00, 0x12, 0x44, 0xCC, 0xC0, 0x04, -0xC0, 0x05, 0xC0, 0x06, 0xC0, 0x07, 0x78, 0x35, 0xE2, 0xFF, 0xE4, 0xFC, 0xFD, 0xFE, 0x78, 0x10, -0x12, 0x20, 0xBB, 0xD0, 0x03, 0xD0, 0x02, 0xD0, 0x01, 0xD0, 0x00, 0x12, 0x44, 0xCC, 0x78, 0x18, -0x12, 0x44, 0xFE, 0x78, 0x15, 0xE2, 0x70, 0x02, 0x61, 0x93, 0x18, 0xE2, 0xFF, 0x18, 0xE2, 0xFD, -0x31, 0x5F, 0x78, 0x1C, 0x12, 0x44, 0xFE, 0x78, 0x38, 0xE2, 0xFF, 0xE4, 0xFC, 0xFD, 0xFE, 0x78, -0x08, 0x12, 0x20, 0xBB, 0xC0, 0x04, 0xA9, 0x05, 0xAA, 0x06, 0xAB, 0x07, 0x78, 0x37, 0xE2, 0xFF, -0xE4, 0xFC, 0xFD, 0xFE, 0xD0, 0x00, 0x12, 0x44, 0xCC, 0xC0, 0x04, 0xC0, 0x05, 0xC0, 0x06, 0xC0, -0x07, 0x78, 0x39, 0xE2, 0xFF, 0xE4, 0xFC, 0xFD, 0xFE, 0x78, 0x10, 0x12, 0x20, 0xBB, 0xD0, 0x03, -0xD0, 0x02, 0xD0, 0x01, 0xD0, 0x00, 0x12, 0x44, 0xCC, 0x78, 0x20, 0x12, 0x44, 0xFE, 0x78, 0x20, -0x12, 0x44, 0xE5, 0x12, 0x20, 0x9B, 0x78, 0x1C, 0x12, 0x44, 0xF1, 0x12, 0x44, 0xBF, 0xC0, 0x04, -0xC0, 0x05, 0xC0, 0x06, 0xC0, 0x07, 0x78, 0x18, 0x12, 0x44, 0xE5, 0x78, 0x20, 0x12, 0x44, 0xF1, -0x12, 0x44, 0xBF, 0xD0, 0x03, 0xD0, 0x02, 0xD0, 0x01, 0xD0, 0x00, 0x12, 0x44, 0xCC, 0x78, 0x18, -0x12, 0x44, 0xFE, 0x78, 0x18, 0x12, 0x44, 0xE5, 0x90, 0x81, 0xF9, 0x12, 0x20, 0xCE, 0x78, 0x13, -0xE2, 0xFD, 0x08, 0xE2, 0xFF, 0x12, 0x55, 0x1C, 0x80, 0x1B, 0x78, 0x13, 0xE2, 0xFF, 0x08, 0xE2, -0xFD, 0x78, 0x11, 0xE2, 0xFB, 0x78, 0x15, 0xE2, 0x90, 0x81, 0xBC, 0xF0, 0x71, 0xE1, 0x80, 0x05, -0x78, 0x10, 0x74, 0x02, 0xF2, 0x78, 0x10, 0xE2, 0xFF, 0xC3, 0x94, 0x02, 0x50, 0x10, 0xEF, 0x60, -0x0A, 0x78, 0x02, 0xE2, 0xFF, 0x18, 0xE2, 0x2F, 0xF2, 0x21, 0x90, 0x7F, 0x01, 0x22, 0x7F, 0x00, -0x22, 0xAC, 0x07, 0xED, 0xAD, 0x04, 0x78, 0x24, 0xF2, 0xED, 0x08, 0xF2, 0xEB, 0xB4, 0x04, 0x07, -0x78, 0x27, 0x74, 0x01, 0xF2, 0x80, 0x0E, 0xEB, 0x78, 0x27, 0xB4, 0x05, 0x05, 0x74, 0x02, 0xF2, -0x80, 0x03, 0x74, 0x04, 0xF2, 0xD3, 0x78, 0x25, 0xE2, 0x94, 0xFF, 0x18, 0xE2, 0x94, 0x00, 0x50, -0x63, 0xE4, 0x78, 0x26, 0xF2, 0x78, 0x27, 0xE2, 0xFF, 0x18, 0xE2, 0xFE, 0xC3, 0x9F, 0x40, 0x02, -0xA1, 0x7F, 0x74, 0x33, 0x2E, 0xF8, 0xE2, 0x78, 0x28, 0xF2, 0x90, 0x81, 0xBC, 0xE0, 0x60, 0x2D, -0x74, 0x37, 0x2E, 0xF8, 0xE2, 0x78, 0x32, 0xF2, 0xEE, 0xFF, 0x78, 0x25, 0xE2, 0x2F, 0xFF, 0x18, -0xE2, 0x34, 0x00, 0x8F, 0x82, 0xF5, 0x83, 0xE0, 0x78, 0x29, 0xF2, 0x78, 0x32, 0xE2, 0xFF, 0xF4, -0xFE, 0x78, 0x29, 0xE2, 0x5E, 0xFE, 0x18, 0xE2, 0xFD, 0xEF, 0x5D, 0x4E, 0xF2, 0x78, 0x24, 0x08, -0xE2, 0xFF, 0x08, 0xE2, 0x2F, 0xFF, 0x78, 0x28, 0xE2, 0xFD, 0x12, 0x32, 0x1E, 0x78, 0x26, 0xE2, -0x04, 0xF2, 0x80, 0xA1, 0xD3, 0x78, 0x25, 0xE2, 0x94, 0xFF, 0x18, 0xE2, 0x94, 0x07, 0x50, 0x69, -0xE4, 0x78, 0x26, 0xF2, 0x78, 0x27, 0xE2, 0xFF, 0x18, 0xE2, 0xFE, 0xC3, 0x9F, 0x40, 0x02, 0xA1, -0x7F, 0x74, 0x33, 0x2E, 0xF8, 0xE2, 0x78, 0x28, 0xF2, 0x90, 0x81, 0xBC, 0xE0, 0x60, 0x2D, 0x78, -0x26, 0xE2, 0xFF, 0xFD, 0x18, 0xE2, 0x2D, 0xFD, 0x18, 0xE2, 0x34, 0x00, 0x8D, 0x82, 0xF5, 0x83, -0xE0, 0x78, 0x29, 0xF2, 0x74, 0x37, 0x2F, 0xF8, 0xE2, 0x78, 0x32, 0xF2, 0xE2, 0xFF, 0xF4, 0xFE, -0x78, 0x29, 0xE2, 0x5E, 0xFE, 0x18, 0xE2, 0xFD, 0xEF, 0x5D, 0x4E, 0xF2, 0x78, 0x28, 0xE2, 0xFF, -0x78, 0x26, 0xE2, 0xFD, 0x18, 0xE2, 0x2D, 0xFD, 0x18, 0xE2, 0x34, 0x00, 0x8D, 0x82, 0xF5, 0x83, -0xEF, 0xF0, 0x78, 0x26, 0xE2, 0x04, 0xF2, 0x80, 0x9B, 0x90, 0x81, 0xBC, 0xE0, 0x60, 0x0F, 0x78, -0x24, 0xE2, 0xFE, 0x08, 0xE2, 0xFF, 0x12, 0x2D, 0x5C, 0x78, 0x2E, 0x12, 0x44, 0xFE, 0xE4, 0x78, -0x26, 0xF2, 0x78, 0x27, 0xE2, 0xFF, 0x18, 0xE2, 0xFE, 0xC3, 0x9F, 0x50, 0x5D, 0x74, 0x33, 0x2E, -0xF8, 0xE2, 0x78, 0x28, 0xF2, 0x90, 0x81, 0xBC, 0xE0, 0x60, 0x2B, 0x78, 0x2E, 0x12, 0x44, 0xE5, -0x78, 0x26, 0xE2, 0xFB, 0x75, 0xF0, 0x08, 0xA4, 0xF9, 0xF8, 0x12, 0x20, 0xA8, 0x78, 0x29, 0xEF, -0xF2, 0x74, 0x37, 0x2B, 0xF8, 0xE2, 0x78, 0x32, 0xF2, 0xE2, 0xFE, 0xF4, 0x5F, 0xFF, 0x78, 0x28, -0xE2, 0xFD, 0xEE, 0x5D, 0x4F, 0xF2, 0x78, 0x28, 0xE2, 0xFF, 0x78, 0x26, 0xE2, 0xFD, 0xC3, 0x74, -0x03, 0x9D, 0xFD, 0xE4, 0x94, 0x00, 0xFC, 0x7B, 0xFE, 0x74, 0x2A, 0x2D, 0xF9, 0x74, 0x80, 0x3C, -0xFA, 0xEF, 0x12, 0x1F, 0xEA, 0xE2, 0x04, 0xF2, 0x80, 0x98, 0x78, 0x2A, 0x12, 0x44, 0xE5, 0x90, -0x85, 0xBB, 0x12, 0x20, 0xCE, 0x78, 0x24, 0xE2, 0xFE, 0x08, 0xE2, 0xFF, 0x12, 0x2E, 0xA2, 0x22, -0x22, 0x90, 0x81, 0xCB, 0x12, 0x45, 0x1F, 0x90, 0x00, 0x01, 0x12, 0x1F, 0xBD, 0xFF, 0xFE, 0x12, -0x1F, 0xA4, 0xFD, 0xC3, 0x13, 0x30, 0xE0, 0x12, 0x90, 0x81, 0xCB, 0x12, 0x45, 0x16, 0x90, 0x00, -0x02, 0x12, 0x1F, 0xBD, 0x90, 0x81, 0xCF, 0xF0, 0x80, 0x05, 0x90, 0x81, 0xCF, 0xEF, 0xF0, 0x90, -0x81, 0xCE, 0xEE, 0xF0, 0x90, 0x81, 0xCF, 0xE0, 0xFE, 0x90, 0x81, 0xCE, 0xE0, 0xFF, 0xD3, 0x9E, -0x50, 0x38, 0x90, 0x81, 0xCB, 0x12, 0x45, 0x16, 0x12, 0x1F, 0xA4, 0x54, 0x01, 0xFE, 0x74, 0xDE, -0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x80, 0xF5, 0x83, 0xEE, 0xF0, 0x74, 0xDE, 0x2F, 0xF5, 0x82, 0xE4, -0x34, 0x80, 0xF5, 0x83, 0xE0, 0x70, 0x04, 0xD1, 0x25, 0x80, 0x07, 0x90, 0x81, 0xCE, 0xE0, 0xFF, -0xB1, 0x80, 0x90, 0x81, 0xCE, 0xE0, 0x04, 0xF0, 0x80, 0xBA, 0x90, 0x80, 0xDE, 0xE0, 0x70, 0x24, -0x90, 0x81, 0x2A, 0xE0, 0x70, 0x04, 0xFF, 0x12, 0x49, 0x93, 0x90, 0x81, 0x2A, 0xE0, 0x64, 0x0C, -0x60, 0x02, 0xD1, 0x26, 0x90, 0x81, 0x24, 0xE0, 0x54, 0xF7, 0xF0, 0x54, 0xEF, 0xF0, 0x54, 0xBF, -0xF0, 0x54, 0x7F, 0xF0, 0x22, 0x22, 0x90, 0x06, 0x04, 0xE0, 0x54, 0x7F, 0xF0, 0x90, 0x05, 0x22, -0xE4, 0xF0, 0x90, 0x81, 0x2A, 0x74, 0x0C, 0xF0, 0x22, 0x90, 0x81, 0xED, 0xEF, 0xF0, 0xA3, 0xED, -0xF0, 0xAD, 0x03, 0xAC, 0x02, 0xE4, 0x90, 0x81, 0xF5, 0xF0, 0xA3, 0xF0, 0x90, 0x01, 0xC4, 0x74, -0x39, 0xF0, 0x74, 0x66, 0xA3, 0xF0, 0xEC, 0x54, 0x3F, 0xFC, 0x90, 0x01, 0x40, 0xED, 0xF0, 0xAE, -0x04, 0xEE, 0xA3, 0xF0, 0x90, 0x81, 0xED, 0xE0, 0x24, 0x81, 0x60, 0x34, 0x24, 0xDA, 0x60, 0x1C, -0x24, 0x3C, 0x70, 0x41, 0x90, 0x81, 0xEE, 0xE0, 0xC4, 0x33, 0x33, 0x33, 0x54, 0x80, 0x90, 0x81, -0xF2, 0xF0, 0xA3, 0x74, 0x69, 0xF0, 0xA3, 0x74, 0x80, 0xF0, 0x80, 0x2C, 0x90, 0x81, 0xEE, 0xE0, -0x54, 0x01, 0x90, 0x81, 0xF2, 0xF0, 0xA3, 0x74, 0xA5, 0xF0, 0xA3, 0x74, 0x01, 0xF0, 0x80, 0x18, -0x90, 0x81, 0xEE, 0xE0, 0xC4, 0x54, 0x10, 0x90, 0x81, 0xF2, 0xF0, 0xA3, 0x74, 0x7F, 0xF0, 0xA3, -0x74, 0x10, 0xF0, 0x80, 0x03, 0x7F, 0x00, 0x22, 0x90, 0x81, 0xF3, 0xE0, 0x90, 0x01, 0x06, 0xF0, -0x90, 0x81, 0xF2, 0xE0, 0x60, 0x0E, 0x90, 0x01, 0x42, 0xF0, 0x90, 0x81, 0xF1, 0xE0, 0x90, 0x01, -0x43, 0xF0, 0x80, 0x0D, 0x90, 0x01, 0x43, 0xE4, 0xF0, 0x90, 0x81, 0xF2, 0xE0, 0x90, 0x01, 0x42, -0xF0, 0x90, 0x81, 0xF4, 0xE0, 0xFF, 0x90, 0x01, 0x42, 0xE0, 0x5F, 0xFF, 0x90, 0x81, 0xF2, 0xE0, -0x6F, 0x60, 0xEE, 0x74, 0x39, 0x04, 0x90, 0x01, 0xC4, 0xF0, 0x74, 0x66, 0xA3, 0xF0, 0x90, 0x01, -0x43, 0xE4, 0xF0, 0x7F, 0x01, 0x22, 0xE4, 0x90, 0x81, 0x6A, 0xF0, 0x90, 0x87, 0x5F, 0xE0, 0x90, -0x81, 0x69, 0xF0, 0xE4, 0x90, 0x81, 0x76, 0xF0, 0x90, 0x81, 0x66, 0xF0, 0x90, 0x81, 0x66, 0xE0, -0xFF, 0xC3, 0x94, 0x40, 0x50, 0x15, 0x74, 0x79, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x81, 0xF5, 0x83, -0x74, 0xFF, 0xF0, 0x90, 0x81, 0x66, 0xE0, 0x04, 0xF0, 0x80, 0xE1, 0xE4, 0x90, 0x81, 0x66, 0xF0, -0x90, 0x81, 0x69, 0xE0, 0xFF, 0x90, 0x81, 0x66, 0xE0, 0xFE, 0xC3, 0x9F, 0x40, 0x03, 0x02, 0x68, -0x12, 0x74, 0xDF, 0x2E, 0xF9, 0xE4, 0x34, 0x86, 0x75, 0x13, 0x01, 0xF5, 0x14, 0x89, 0x15, 0x75, -0x16, 0x0A, 0x7B, 0x01, 0x7A, 0x81, 0x79, 0x5B, 0x12, 0x2B, 0xED, 0x90, 0x81, 0x5C, 0xE0, 0xFF, -0x12, 0x2F, 0x27, 0xEF, 0x04, 0x90, 0x81, 0x76, 0xF0, 0x90, 0x81, 0x5B, 0xE0, 0xFF, 0xA3, 0xE0, -0xFD, 0x12, 0x31, 0xEA, 0xEF, 0x24, 0xC8, 0x90, 0x81, 0x78, 0xF0, 0x75, 0xF0, 0x08, 0xA4, 0xF0, -0x90, 0x81, 0x5C, 0xE0, 0x54, 0x0F, 0x90, 0x81, 0x77, 0xF0, 0xE4, 0x90, 0x81, 0x65, 0xF0, 0x90, -0x81, 0x67, 0xF0, 0x90, 0x81, 0x67, 0xE0, 0xFF, 0xC3, 0x94, 0x04, 0x50, 0x57, 0x90, 0x81, 0x77, -0xE0, 0xFE, 0xA8, 0x07, 0x08, 0x80, 0x02, 0xC3, 0x13, 0xD8, 0xFC, 0x20, 0xE0, 0x3E, 0x90, 0x81, -0x67, 0xE0, 0x25, 0xE0, 0xFF, 0x90, 0x81, 0x78, 0xE0, 0x2F, 0x24, 0x79, 0xF9, 0xE4, 0x34, 0x81, -0xFA, 0x7B, 0x01, 0xC0, 0x03, 0xC0, 0x01, 0x90, 0x81, 0x65, 0xE0, 0x75, 0xF0, 0x02, 0xA4, 0x24, -0x5D, 0xF9, 0x74, 0x81, 0x35, 0xF0, 0x8B, 0x13, 0xF5, 0x14, 0x89, 0x15, 0x75, 0x16, 0x02, 0xD0, -0x01, 0xD0, 0x03, 0x12, 0x2B, 0xED, 0x90, 0x81, 0x65, 0xE0, 0x04, 0xF0, 0x90, 0x81, 0x67, 0xE0, -0x04, 0xF0, 0x80, 0x9F, 0x90, 0x81, 0x76, 0xE0, 0xFF, 0x90, 0x81, 0x66, 0xE0, 0x2F, 0xF0, 0x02, -0x67, 0x40, 0xE4, 0x90, 0x81, 0x6A, 0xF0, 0x90, 0x81, 0x6A, 0xE0, 0xC3, 0x94, 0x40, 0x40, 0x02, -0x41, 0xAF, 0xE0, 0xFF, 0x24, 0x79, 0xF5, 0x82, 0xE4, 0x34, 0x81, 0xF5, 0x83, 0xE0, 0x90, 0x81, -0x6C, 0xF0, 0xE0, 0xFE, 0x54, 0xF0, 0xC4, 0x54, 0x0F, 0xFD, 0x90, 0x81, 0x6B, 0xF0, 0xEE, 0x54, -0x0F, 0xFE, 0xA3, 0xF0, 0x74, 0x7A, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x81, 0xF5, 0x83, 0xE0, 0x90, -0x81, 0x6D, 0xF0, 0xFC, 0xEE, 0xFE, 0xEC, 0xFB, 0xEB, 0xFF, 0x90, 0x81, 0x72, 0xEE, 0xF0, 0xA3, -0xEF, 0xF0, 0xED, 0x12, 0x45, 0x28, 0x68, 0x8B, 0x00, 0x68, 0xC2, 0x01, 0x69, 0x73, 0x02, 0x6A, -0xA0, 0x03, 0x69, 0x8E, 0x04, 0x69, 0xAF, 0x05, 0x69, 0xAF, 0x06, 0x69, 0xAF, 0x07, 0x69, 0xAF, -0x08, 0x6A, 0x33, 0x09, 0x6A, 0x69, 0x0A, 0x00, 0x00, 0x6A, 0xAF, 0x90, 0x81, 0x6A, 0xE0, 0xFD, -0x24, 0x7C, 0xF5, 0x82, 0xE4, 0x34, 0x81, 0xF5, 0x83, 0xE0, 0xFE, 0x74, 0x7B, 0x2D, 0xF5, 0x82, -0xE4, 0x34, 0x81, 0xF5, 0x83, 0xE0, 0xFD, 0xED, 0xFF, 0x90, 0x81, 0x74, 0xEE, 0xF0, 0xFC, 0xA3, -0xEF, 0xF0, 0x90, 0x81, 0x6D, 0xE0, 0xFF, 0x12, 0x2F, 0x96, 0x90, 0x81, 0x68, 0x74, 0x02, 0xF0, -0x41, 0xA0, 0x90, 0x81, 0x6A, 0xE0, 0x24, 0x7C, 0xF5, 0x82, 0xE4, 0x34, 0x81, 0xF5, 0x83, 0xE0, -0xFF, 0xE4, 0xFC, 0xFD, 0xFE, 0x78, 0x08, 0x12, 0x20, 0xBB, 0xA8, 0x04, 0xA9, 0x05, 0xAA, 0x06, -0xAB, 0x07, 0x90, 0x81, 0x6A, 0xE0, 0x24, 0x7B, 0xF5, 0x82, 0xE4, 0x34, 0x81, 0xF5, 0x83, 0xE0, -0xFF, 0xE4, 0xFC, 0xFD, 0xFE, 0x12, 0x44, 0xCC, 0xC0, 0x04, 0xC0, 0x05, 0xC0, 0x06, 0xC0, 0x07, -0x90, 0x81, 0x6A, 0xE0, 0x24, 0x7D, 0xF5, 0x82, 0xE4, 0x34, 0x81, 0xF5, 0x83, 0xE0, 0xFF, 0xE4, -0xFC, 0xFD, 0xFE, 0x78, 0x10, 0x12, 0x20, 0xBB, 0xD0, 0x03, 0xD0, 0x02, 0xD0, 0x01, 0xD0, 0x00, -0x12, 0x44, 0xCC, 0xC0, 0x04, 0xC0, 0x05, 0xC0, 0x06, 0xC0, 0x07, 0x90, 0x81, 0x6A, 0xE0, 0x24, -0x7E, 0xF5, 0x82, 0xE4, 0x34, 0x81, 0xF5, 0x83, 0xE0, 0xFF, 0xE4, 0xFC, 0xFD, 0xFE, 0x78, 0x18, -0x12, 0x20, 0xBB, 0xD0, 0x03, 0xD0, 0x02, 0xD0, 0x01, 0xD0, 0x00, 0x12, 0x44, 0xCC, 0x90, 0x81, -0x6E, 0x12, 0x20, 0xCE, 0x90, 0x81, 0x6E, 0x12, 0x44, 0xD9, 0x90, 0x85, 0x96, 0x12, 0x20, 0xCE, -0x90, 0x81, 0x72, 0xE0, 0xFE, 0xA3, 0xE0, 0xFF, 0x12, 0x2E, 0xE4, 0x90, 0x81, 0x68, 0x74, 0x04, -0xF0, 0x41, 0xA0, 0x90, 0x81, 0x6D, 0xE0, 0xFD, 0x90, 0x81, 0x6A, 0xE0, 0x24, 0x7B, 0xF5, 0x82, -0xE4, 0x34, 0x81, 0xF5, 0x83, 0xE0, 0xFB, 0xE4, 0xFF, 0x12, 0x30, 0xC7, 0x80, 0x19, 0x90, 0x81, -0x6D, 0xE0, 0xFD, 0x90, 0x81, 0x6A, 0xE0, 0x24, 0x7B, 0xF5, 0x82, 0xE4, 0x34, 0x81, 0xF5, 0x83, -0xE0, 0xFB, 0xE4, 0xFF, 0x12, 0x30, 0x6A, 0x90, 0x81, 0x68, 0x74, 0x01, 0xF0, 0x41, 0xA0, 0x90, -0x81, 0x68, 0x74, 0x02, 0xF0, 0x90, 0x81, 0x6A, 0xE0, 0x24, 0x7C, 0xF5, 0x82, 0xE4, 0x34, 0x81, -0xF5, 0x83, 0xE0, 0xFF, 0xE4, 0xFC, 0xFD, 0xFE, 0x78, 0x08, 0x12, 0x20, 0xBB, 0xA8, 0x04, 0xA9, -0x05, 0xAA, 0x06, 0xAB, 0x07, 0x90, 0x81, 0x6A, 0xE0, 0x24, 0x7B, 0xF5, 0x82, 0xE4, 0x34, 0x81, -0xF5, 0x83, 0xE0, 0xFF, 0xE4, 0xFC, 0xFD, 0xFE, 0x12, 0x44, 0xCC, 0xC0, 0x04, 0xC0, 0x05, 0xC0, -0x06, 0xC0, 0x07, 0x90, 0x81, 0x6C, 0xE0, 0xFF, 0xE4, 0xFC, 0xFD, 0xFE, 0x78, 0x10, 0x12, 0x20, -0xBB, 0xD0, 0x03, 0xD0, 0x02, 0xD0, 0x01, 0xD0, 0x00, 0x12, 0x44, 0xCC, 0x90, 0x81, 0x6E, 0x12, -0x20, 0xCE, 0x90, 0x81, 0x6B, 0xE0, 0x24, 0xFB, 0xFF, 0xC0, 0x07, 0x90, 0x81, 0x6E, 0x12, 0x44, -0xD9, 0x90, 0x81, 0xF9, 0x12, 0x20, 0xCE, 0x90, 0x81, 0x6D, 0xE0, 0xFD, 0xD0, 0x07, 0x12, 0x55, -0x1C, 0x80, 0x6D, 0x90, 0x81, 0x68, 0x74, 0x01, 0xF0, 0x90, 0x81, 0x6A, 0xE0, 0x24, 0x7B, 0xF9, -0xE4, 0x34, 0x81, 0x75, 0x13, 0x01, 0xF5, 0x14, 0x89, 0x15, 0x75, 0x16, 0x01, 0x7B, 0xFE, 0x7A, -0x80, 0x79, 0x33, 0x12, 0x2B, 0xED, 0x90, 0x81, 0x6D, 0xE0, 0xFF, 0x90, 0x81, 0x6C, 0xE0, 0xFD, -0xE4, 0x90, 0x81, 0xBC, 0xF0, 0x7B, 0x04, 0x80, 0x34, 0x90, 0x81, 0x68, 0x74, 0x04, 0xF0, 0x90, -0x81, 0x6A, 0xE0, 0x24, 0x7B, 0xF9, 0xE4, 0x34, 0x81, 0x75, 0x13, 0x01, 0xF5, 0x14, 0x89, 0x15, -0x75, 0x16, 0x04, 0x7B, 0xFE, 0x7A, 0x80, 0x79, 0x33, 0x12, 0x2B, 0xED, 0x90, 0x81, 0x6D, 0xE0, -0xFF, 0x90, 0x81, 0x6C, 0xE0, 0xFD, 0xE4, 0x90, 0x81, 0xBC, 0xF0, 0x7B, 0x06, 0x12, 0x63, 0xE1, -0x90, 0x81, 0x68, 0xE0, 0x24, 0x02, 0xFF, 0x90, 0x81, 0x6A, 0xE0, 0x2F, 0xF0, 0x01, 0x17, 0x22, -0x90, 0x02, 0x09, 0xE0, 0xFD, 0x12, 0x1F, 0xA4, 0xFE, 0xAF, 0x05, 0xED, 0x2E, 0x90, 0x80, 0x3D, -0xF0, 0x90, 0x00, 0x01, 0x12, 0x1F, 0xBD, 0xFF, 0xED, 0x2F, 0x90, 0x80, 0x3E, 0xF0, 0x90, 0x00, -0x02, 0x12, 0x1F, 0xBD, 0xFF, 0xED, 0x2F, 0x90, 0x80, 0x3F, 0xF0, 0x90, 0x00, 0x03, 0x12, 0x1F, -0xBD, 0xFF, 0xED, 0x2F, 0x90, 0x80, 0x40, 0xF0, 0x90, 0x00, 0x04, 0x12, 0x1F, 0xBD, 0xFF, 0xAE, -0x05, 0xED, 0x2F, 0x90, 0x80, 0x41, 0xF0, 0x22, 0x90, 0x00, 0x02, 0x12, 0x1F, 0xBD, 0xFF, 0x30, -0xE0, 0x26, 0x12, 0x1F, 0xA4, 0x90, 0x81, 0x38, 0xF0, 0x90, 0x00, 0x01, 0x12, 0x1F, 0xBD, 0x90, -0x81, 0x39, 0xF0, 0xEF, 0x54, 0xFE, 0xFF, 0xA3, 0xE0, 0x54, 0x01, 0x4F, 0xF0, 0x90, 0x00, 0x03, -0x12, 0x1F, 0xBD, 0x90, 0x81, 0x3B, 0xF0, 0x22, 0x90, 0x81, 0x38, 0x74, 0x01, 0xF0, 0xA3, 0x74, -0x05, 0xF0, 0xA3, 0xE0, 0x54, 0x01, 0x44, 0x28, 0xF0, 0xA3, 0x74, 0x05, 0xF0, 0x22, 0x12, 0x1F, -0xA4, 0x90, 0x81, 0x3E, 0xF0, 0x90, 0x81, 0x3E, 0xE0, 0x90, 0x01, 0xE7, 0xF0, 0x22, 0x12, 0x1F, -0xA4, 0x90, 0x81, 0x4A, 0xF0, 0x90, 0x00, 0x01, 0x12, 0x1F, 0xBD, 0x90, 0x81, 0x4B, 0xF0, 0x22, -0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0x81, 0xFD, 0xEE, 0xF0, 0xA3, 0xEF, 0xF0, 0xE4, -0xA3, 0xF0, 0xA3, 0xF0, 0x90, 0x81, 0xFD, 0xE0, 0xFE, 0xA3, 0xE0, 0xF5, 0x82, 0x8E, 0x83, 0xE0, -0x60, 0x2D, 0xC3, 0x90, 0x82, 0x00, 0xE0, 0x94, 0xE8, 0x90, 0x81, 0xFF, 0xE0, 0x94, 0x03, 0x40, -0x0B, 0x90, 0x01, 0xC0, 0xE0, 0x44, 0x80, 0xF0, 0x7F, 0x00, 0x80, 0x15, 0x90, 0x81, 0xFF, 0xE4, -0x75, 0xF0, 0x01, 0x12, 0x44, 0xA9, 0x7F, 0x0A, 0x7E, 0x00, 0x12, 0x32, 0xAA, 0x80, 0xC5, 0x7F, -0x01, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0x81, 0xD1, -0x12, 0x45, 0x1F, 0x90, 0x82, 0x0A, 0xE0, 0xFF, 0x04, 0xF0, 0x90, 0x00, 0x01, 0xEF, 0x12, 0x1F, -0xFC, 0x7F, 0xAF, 0x7E, 0x01, 0x71, 0x60, 0xEF, 0x60, 0x3A, 0x90, 0x81, 0xD1, 0x12, 0x45, 0x16, -0x8B, 0x13, 0x8A, 0x14, 0x89, 0x15, 0x90, 0x00, 0x0E, 0x12, 0x1F, 0xBD, 0x24, 0x02, 0xF5, 0x16, -0x7B, 0x01, 0x7A, 0x01, 0x79, 0xA0, 0x12, 0x2B, 0xED, 0x90, 0x81, 0xD1, 0x12, 0x45, 0x16, 0x90, -0x00, 0x0E, 0x12, 0x1F, 0xBD, 0x90, 0x01, 0xAE, 0xF0, 0xA3, 0x74, 0xFF, 0xF0, 0x90, 0x01, 0xCB, -0xE0, 0x64, 0x80, 0xF0, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, -0xE4, 0xFF, 0x90, 0x80, 0xD9, 0xE0, 0xFE, 0x90, 0x80, 0xD8, 0xE0, 0xFD, 0xB5, 0x06, 0x04, 0x7E, -0x01, 0x80, 0x02, 0x7E, 0x00, 0xEE, 0x64, 0x01, 0x60, 0x32, 0x90, 0x01, 0xAF, 0xE0, 0x70, 0x13, -0xED, 0x75, 0xF0, 0x0F, 0xA4, 0x24, 0x42, 0xF9, 0x74, 0x80, 0x35, 0xF0, 0xFA, 0x7B, 0x01, 0x71, -0xB6, 0x7F, 0x01, 0xEF, 0x60, 0x16, 0x90, 0x80, 0xD8, 0xE0, 0x04, 0xF0, 0xE0, 0x7F, 0x00, 0xB4, -0x0A, 0x02, 0x7F, 0x01, 0xEF, 0x60, 0x05, 0xE4, 0x90, 0x80, 0xD8, 0xF0, 0xD0, 0xD0, 0x92, 0xAF, -0x22, 0x8F, 0x0D, 0x22, 0x8F, 0x0E, 0x22, 0x22, 0x90, 0x01, 0x34, 0xE0, 0x55, 0x3D, 0xF5, 0x41, -0xA3, 0xE0, 0x55, 0x3E, 0xF5, 0x42, 0xA3, 0xE0, 0x55, 0x3F, 0xF5, 0x43, 0xA3, 0xE0, 0x55, 0x40, -0xF5, 0x44, 0x90, 0x01, 0x34, 0xE5, 0x41, 0xF0, 0xA3, 0xE5, 0x42, 0xF0, 0xA3, 0xE5, 0x43, 0xF0, -0xA3, 0xE5, 0x44, 0xF0, 0x22, 0x90, 0x01, 0x3C, 0xE0, 0x55, 0x45, 0xF5, 0x49, 0xA3, 0xE0, 0x55, -0x46, 0xF5, 0x4A, 0xA3, 0xE0, 0x55, 0x47, 0xF5, 0x4B, 0xA3, 0xE0, 0x55, 0x48, 0xF5, 0x4C, 0x90, -0x01, 0x3C, 0xE5, 0x49, 0xF0, 0xA3, 0xE5, 0x4A, 0xF0, 0xA3, 0xE5, 0x4B, 0xF0, 0xA3, 0xE5, 0x4C, -0xF0, 0x53, 0x91, 0xDF, 0x22, 0x90, 0x81, 0x1F, 0xE0, 0x30, 0xE0, 0x05, 0xE4, 0xA3, 0xF0, 0xA3, -0xF0, 0x22, 0x90, 0x80, 0xDE, 0xE0, 0x64, 0x01, 0x70, 0x19, 0x90, 0x81, 0x27, 0xE0, 0x60, 0x13, -0x90, 0x01, 0x57, 0xE4, 0xF0, 0x90, 0x01, 0x3C, 0x74, 0x02, 0x12, 0x4F, 0xF4, 0x90, 0x01, 0x57, -0x74, 0x05, 0xF0, 0x22, 0x90, 0x80, 0xDE, 0xE0, 0x64, 0x01, 0x70, 0x26, 0x90, 0x81, 0x27, 0xE0, -0x60, 0x20, 0x90, 0x01, 0x57, 0xE4, 0xF0, 0x90, 0x01, 0x3C, 0x74, 0x02, 0xF0, 0x90, 0x81, 0x24, -0xE0, 0x54, 0xFB, 0xF0, 0x90, 0x81, 0x2B, 0xE0, 0x54, 0xFD, 0xF0, 0x54, 0x07, 0x70, 0x03, 0x12, -0x47, 0x2A, 0x22, 0x90, 0x80, 0xDE, 0xE0, 0xB4, 0x01, 0x14, 0x90, 0x81, 0x27, 0xE0, 0x60, 0x0E, -0x90, 0x81, 0x26, 0xE0, 0x54, 0x0F, 0x64, 0x02, 0x60, 0x02, 0x80, 0x03, 0xD1, 0x7F, 0x22, 0x90, -0x04, 0x1D, 0xE0, 0x70, 0x13, 0x90, 0x80, 0x3E, 0xE0, 0xFF, 0xE4, 0xFD, 0xB1, 0x69, 0x8E, 0x4E, -0x8F, 0x4F, 0x90, 0x04, 0x1F, 0x74, 0x20, 0xF0, 0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, -0x90, 0x82, 0x0E, 0xED, 0xF0, 0x90, 0x82, 0x0D, 0xEF, 0xF0, 0xE4, 0xFD, 0xFC, 0xF1, 0x37, 0x7C, -0x00, 0xAD, 0x07, 0x90, 0x82, 0x0D, 0xE0, 0x90, 0x04, 0x25, 0xF0, 0x90, 0x82, 0x0E, 0xE0, 0x60, -0x0E, 0x74, 0x0F, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x44, 0x80, 0xF0, 0xAF, -0x05, 0x74, 0x08, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE4, 0xF0, 0x74, 0x09, 0x2F, -0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x54, 0xF0, 0xF0, 0x74, 0x21, 0x2D, 0xF5, 0x82, -0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x54, 0xF7, 0xF0, 0xAE, 0x04, 0xAF, 0x05, 0xD0, 0xD0, 0x92, -0xAF, 0x22, 0x8F, 0x4E, 0xF1, 0x4B, 0xBF, 0x01, 0x18, 0x90, 0x80, 0x40, 0xE0, 0xFF, 0x7D, 0x01, -0xB1, 0x69, 0xAD, 0x07, 0xAC, 0x06, 0xAF, 0x4E, 0x12, 0x4F, 0x82, 0x90, 0x04, 0x1F, 0x74, 0x20, -0xF0, 0x22, 0x90, 0x06, 0xA9, 0xE0, 0x90, 0x81, 0x4C, 0xF0, 0xE0, 0xFD, 0x54, 0xC0, 0x70, 0x09, -0x90, 0x81, 0x2B, 0xE0, 0x54, 0xFE, 0xF0, 0x80, 0x72, 0xED, 0x30, 0xE6, 0x4B, 0x90, 0x81, 0x27, -0xE0, 0x64, 0x02, 0x70, 0x2A, 0x90, 0x81, 0x24, 0xE0, 0xFF, 0xC3, 0x13, 0x20, 0xE0, 0x09, 0x90, -0x81, 0x2B, 0xE0, 0x44, 0x01, 0xF0, 0x80, 0x28, 0x90, 0x81, 0x26, 0xE0, 0x54, 0x0F, 0x64, 0x01, -0x70, 0x2D, 0x90, 0x81, 0x2B, 0xE0, 0x44, 0x04, 0xF0, 0x7F, 0x01, 0xB1, 0xD2, 0x80, 0x20, 0x90, -0x81, 0x2B, 0xE0, 0x44, 0x01, 0xF0, 0x90, 0x81, 0x26, 0xE0, 0x54, 0x0F, 0x64, 0x02, 0x60, 0x04, -0xB1, 0x4F, 0x80, 0x0B, 0xD1, 0x7F, 0x80, 0x07, 0x90, 0x81, 0x2B, 0xE0, 0x54, 0xFE, 0xF0, 0x90, -0x81, 0x4C, 0xE0, 0x90, 0x81, 0x2B, 0x30, 0xE7, 0x11, 0x12, 0x4F, 0xF1, 0x90, 0x01, 0x57, 0x74, -0x05, 0xF0, 0x90, 0x81, 0x24, 0xE0, 0x44, 0x04, 0xF0, 0x22, 0xE0, 0x54, 0xFD, 0xF0, 0x22, 0x90, -0x01, 0x5F, 0xE4, 0xF0, 0x90, 0x01, 0x3C, 0x74, 0x08, 0xF0, 0xE4, 0xF5, 0x1D, 0x90, 0x81, 0x3A, -0xE0, 0xC3, 0x13, 0x54, 0x7F, 0xF5, 0x1E, 0xE4, 0xFB, 0xFD, 0x7F, 0x5C, 0x7E, 0x01, 0x12, 0x50, -0x05, 0x90, 0x01, 0x5F, 0x74, 0x05, 0xF0, 0x90, 0x06, 0x92, 0x74, 0x02, 0xF0, 0x90, 0x81, 0x24, -0xE0, 0x44, 0x10, 0xF0, 0x90, 0x81, 0x2A, 0xE0, 0x64, 0x0C, 0x60, 0x0C, 0xE4, 0xFD, 0x7F, 0x0C, -0x12, 0x47, 0x3D, 0xE4, 0xFF, 0x12, 0x4F, 0x0D, 0x22, 0xE4, 0x90, 0x81, 0x4C, 0xF0, 0x90, 0x06, -0xA9, 0xE0, 0x90, 0x81, 0x4C, 0xF0, 0xE0, 0x54, 0xC0, 0x70, 0x0D, 0x90, 0x81, 0x2B, 0xE0, 0x54, -0xFE, 0xF0, 0x54, 0xFD, 0xF0, 0x02, 0x47, 0x2A, 0x90, 0x81, 0x4C, 0xE0, 0x30, 0xE6, 0x21, 0x90, -0x81, 0x27, 0xE0, 0x64, 0x01, 0x70, 0x20, 0x90, 0x81, 0x2B, 0xE0, 0x44, 0x01, 0xF0, 0x90, 0x81, -0x26, 0xE0, 0x54, 0x0F, 0x64, 0x02, 0x60, 0x04, 0xB1, 0x4F, 0x80, 0x0B, 0xD1, 0x7F, 0x80, 0x07, -0x90, 0x81, 0x2B, 0xE0, 0x54, 0xFE, 0xF0, 0x90, 0x81, 0x4C, 0xE0, 0x90, 0x81, 0x2B, 0x30, 0xE7, -0x11, 0x12, 0x4F, 0xF1, 0x90, 0x01, 0x57, 0x74, 0x05, 0xF0, 0x90, 0x81, 0x24, 0xE0, 0x44, 0x04, -0xF0, 0x22, 0xE0, 0x54, 0xFD, 0xF0, 0x22, 0xE4, 0xFE, 0xEF, 0xC3, 0x13, 0xFD, 0xEF, 0x30, 0xE0, -0x02, 0x7E, 0x80, 0x90, 0xFD, 0x10, 0xED, 0xF0, 0xAF, 0x06, 0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, -0xC0, 0xD0, 0x90, 0x04, 0x1D, 0xE0, 0x60, 0x1A, 0x90, 0x05, 0x22, 0xE0, 0x54, 0x90, 0x60, 0x07, -0x90, 0x01, 0xC0, 0xE0, 0x44, 0x08, 0xF0, 0x90, 0x01, 0xC6, 0xE0, 0x30, 0xE1, 0xE4, 0x7F, 0x00, -0x80, 0x02, 0x7F, 0x01, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x90, 0x81, 0x27, 0xE0, 0x60, 0x03, 0x12, -0x73, 0xE1, 0x90, 0x81, 0x3F, 0xE0, 0x30, 0xE0, 0x03, 0x12, 0x49, 0xDD, 0x22, 0x90, 0x81, 0x27, -0xE0, 0x60, 0x35, 0x90, 0x06, 0x92, 0xE0, 0x30, 0xE1, 0x24, 0xE4, 0xF5, 0x1D, 0x90, 0x81, 0x3A, -0xE0, 0xC3, 0x13, 0x54, 0x7F, 0xF5, 0x1E, 0xE4, 0xFB, 0xFD, 0x7F, 0x5C, 0x7E, 0x01, 0x12, 0x50, -0x05, 0x90, 0x01, 0x5F, 0x74, 0x05, 0xF0, 0x90, 0x06, 0x92, 0x74, 0x02, 0xF0, 0x22, 0x90, 0x81, -0x24, 0xE0, 0x54, 0xEF, 0xF0, 0x12, 0x47, 0x2A, 0x22, 0x12, 0x71, 0x48, 0x90, 0x81, 0x4D, 0xEF, -0xF0, 0x90, 0x81, 0x24, 0x30, 0xE0, 0x06, 0xE0, 0x44, 0x01, 0xF0, 0x80, 0x04, 0xE0, 0x54, 0xFE, -0xF0, 0x90, 0x81, 0x4D, 0xE0, 0x30, 0xE6, 0x11, 0x90, 0x01, 0x2F, 0xE0, 0x30, 0xE7, 0x04, 0xE4, -0xF0, 0x80, 0x06, 0x90, 0x01, 0x2F, 0x74, 0x80, 0xF0, 0x90, 0x81, 0x24, 0xE0, 0x30, 0xE0, 0x1A, -0x90, 0x81, 0x32, 0xE4, 0xF0, 0xA3, 0x74, 0x07, 0xF0, 0x90, 0x81, 0x32, 0xA3, 0xE0, 0x90, 0x05, -0x58, 0xF0, 0x90, 0x04, 0xEC, 0xE0, 0x54, 0xDD, 0xF0, 0x22, 0x90, 0x04, 0xEC, 0xE0, 0x44, 0x22, -0xF0, 0x22, 0x90, 0x81, 0x4A, 0xE0, 0x60, 0x0F, 0xE4, 0xF0, 0x90, 0x05, 0x53, 0xE0, 0x44, 0x01, -0xF0, 0x90, 0x05, 0xFD, 0xE0, 0x04, 0xF0, 0x22, 0x90, 0x81, 0x24, 0xE0, 0xFF, 0xC4, 0x13, 0x13, -0x54, 0x03, 0x30, 0xE0, 0x27, 0xEF, 0x54, 0xBF, 0xF0, 0x90, 0x04, 0xE0, 0xE0, 0x90, 0x81, 0x25, -0x30, 0xE0, 0x06, 0xE0, 0x44, 0x01, 0xF0, 0x80, 0x10, 0xE0, 0x54, 0xFE, 0xF0, 0x90, 0x01, 0xB9, -0x74, 0x01, 0xF0, 0x90, 0x01, 0xB8, 0x74, 0x04, 0xF0, 0x12, 0x47, 0x2A, 0xE4, 0xFF, 0x90, 0x81, -0x45, 0xE0, 0x30, 0xE0, 0x48, 0x90, 0x81, 0x49, 0xE0, 0xFD, 0x60, 0x41, 0x74, 0x01, 0x7E, 0x00, -0xA8, 0x07, 0x08, 0x80, 0x05, 0xC3, 0x33, 0xCE, 0x33, 0xCE, 0xD8, 0xF9, 0xFF, 0x90, 0x04, 0xE0, -0xE0, 0xFB, 0xEF, 0x5B, 0x60, 0x06, 0xE4, 0x90, 0x81, 0x49, 0xF0, 0x22, 0x90, 0x81, 0x47, 0xE0, -0xD3, 0x9D, 0x50, 0x10, 0x90, 0x01, 0xC7, 0x74, 0x10, 0xF0, 0x11, 0xBE, 0x90, 0x81, 0x45, 0xE0, -0x54, 0xFE, 0xF0, 0x22, 0x12, 0x4F, 0x0B, 0x90, 0x81, 0x49, 0xE0, 0x04, 0xF0, 0x22, 0x90, 0x80, -0x3C, 0xE0, 0x64, 0x02, 0x60, 0x07, 0x90, 0x06, 0x90, 0xE0, 0x44, 0x01, 0xF0, 0x22, 0x90, 0x81, -0x24, 0xE0, 0xFF, 0xC4, 0x13, 0x13, 0x13, 0x54, 0x01, 0x30, 0xE0, 0x2C, 0xEF, 0x54, 0x7F, 0xF0, -0x90, 0x04, 0xE0, 0xE0, 0x90, 0x81, 0x25, 0x30, 0xE1, 0x06, 0xE0, 0x44, 0x02, 0xF0, 0x80, 0x0F, -0xE0, 0x54, 0xFD, 0xF0, 0x90, 0x01, 0xB9, 0x74, 0x01, 0xF0, 0x90, 0x01, 0xB8, 0x04, 0xF0, 0x90, -0x81, 0x27, 0xE0, 0x60, 0x03, 0x12, 0x47, 0x2A, 0x7F, 0x01, 0x01, 0x6E, 0xC3, 0xEE, 0x94, 0x01, -0x40, 0x0A, 0x0D, 0xED, 0x13, 0x90, 0xFD, 0x10, 0xF0, 0xE4, 0x2F, 0xFF, 0x22, 0xC3, 0xEE, 0x94, -0x01, 0x40, 0x24, 0x90, 0xFD, 0x11, 0xE0, 0x6D, 0x70, 0x1A, 0x90, 0x01, 0x17, 0xE0, 0xB5, 0x05, -0x0D, 0x90, 0x01, 0xE4, 0x74, 0x77, 0xF0, 0x90, 0xFD, 0x11, 0xE4, 0xF0, 0x80, 0x06, 0xED, 0x04, -0x90, 0xFD, 0x11, 0xF0, 0xE4, 0x2F, 0xFF, 0x22, 0xE4, 0x90, 0x81, 0x4E, 0xF0, 0xA3, 0xF0, 0xA3, -0xF0, 0x90, 0x00, 0x83, 0xE0, 0x90, 0x81, 0x4E, 0xF0, 0x90, 0x00, 0x83, 0xE0, 0xFE, 0x90, 0x81, -0x4E, 0xE0, 0xFF, 0xB5, 0x06, 0x01, 0x22, 0xC3, 0x90, 0x81, 0x50, 0xE0, 0x94, 0x64, 0x90, 0x81, -0x4F, 0xE0, 0x94, 0x00, 0x40, 0x0D, 0x90, 0x01, 0xC0, 0xE0, 0x44, 0x40, 0xF0, 0x90, 0x81, 0x4E, -0xE0, 0xFF, 0x22, 0x90, 0x81, 0x4F, 0xE4, 0x75, 0xF0, 0x01, 0x12, 0x44, 0xA9, 0x80, 0xC2, 0x74, -0x45, 0x2F, 0xF8, 0xE6, 0xFE, 0xED, 0xF4, 0x5E, 0xFE, 0xF6, 0x74, 0x38, 0x2F, 0xF5, 0x82, 0xE4, -0x34, 0x01, 0xF5, 0x83, 0xEE, 0xF0, 0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0x82, -0x12, 0xED, 0xF0, 0x90, 0x82, 0x11, 0xEF, 0xF0, 0xD3, 0x94, 0x07, 0x50, 0x70, 0xE0, 0xFF, 0x74, -0x01, 0xA8, 0x07, 0x08, 0x80, 0x02, 0xC3, 0x33, 0xD8, 0xFC, 0xF4, 0xFF, 0x90, 0x00, 0x47, 0xE0, -0x5F, 0xFD, 0x7F, 0x47, 0x12, 0x32, 0x1E, 0x90, 0x82, 0x11, 0xE0, 0xFF, 0x74, 0x01, 0xA8, 0x07, -0x08, 0x80, 0x02, 0xC3, 0x33, 0xD8, 0xFC, 0xFF, 0x90, 0x00, 0x46, 0xE0, 0x4F, 0xFD, 0x7F, 0x46, -0x12, 0x32, 0x1E, 0x90, 0x82, 0x12, 0xE0, 0x60, 0x18, 0x90, 0x82, 0x11, 0xE0, 0xFF, 0x74, 0x01, -0xA8, 0x07, 0x08, 0x80, 0x02, 0xC3, 0x33, 0xD8, 0xFC, 0xFF, 0x90, 0x00, 0x45, 0xE0, 0x4F, 0x80, -0x17, 0x90, 0x82, 0x11, 0xE0, 0xFF, 0x74, 0x01, 0xA8, 0x07, 0x08, 0x80, 0x02, 0xC3, 0x33, 0xD8, -0xFC, 0xF4, 0xFF, 0x90, 0x00, 0x45, 0xE0, 0x5F, 0xFD, 0x7F, 0x45, 0x80, 0x7E, 0x90, 0x82, 0x11, -0xE0, 0x24, 0xF8, 0xF0, 0xE0, 0x24, 0x04, 0xFF, 0x74, 0x01, 0xA8, 0x07, 0x08, 0x80, 0x02, 0xC3, -0x33, 0xD8, 0xFC, 0xF4, 0xFF, 0x90, 0x00, 0x43, 0xE0, 0x5F, 0xFD, 0x7F, 0x43, 0x12, 0x32, 0x1E, -0x90, 0x82, 0x11, 0xE0, 0xFF, 0x74, 0x01, 0xA8, 0x07, 0x08, 0x80, 0x02, 0xC3, 0x33, 0xD8, 0xFC, -0xFF, 0x90, 0x00, 0x43, 0xE0, 0x4F, 0xFD, 0x7F, 0x43, 0x12, 0x32, 0x1E, 0x90, 0x82, 0x12, 0xE0, -0x60, 0x1D, 0x90, 0x82, 0x11, 0xE0, 0x24, 0x04, 0xFF, 0x74, 0x01, 0xA8, 0x07, 0x08, 0x80, 0x02, -0xC3, 0x33, 0xD8, 0xFC, 0xFF, 0x90, 0x00, 0x42, 0xE0, 0x4F, 0xFD, 0x7F, 0x42, 0x80, 0x1C, 0x90, -0x82, 0x11, 0xE0, 0x24, 0x04, 0xFF, 0x74, 0x01, 0xA8, 0x07, 0x08, 0x80, 0x02, 0xC3, 0x33, 0xD8, -0xFC, 0xF4, 0xFF, 0x90, 0x00, 0x42, 0xE0, 0x5F, 0xFD, 0x7F, 0x42, 0x12, 0x32, 0x1E, 0xD0, 0xD0, -0x92, 0xAF, 0x22, 0x90, 0x81, 0x24, 0xE0, 0x54, 0xFB, 0xF0, 0xE4, 0x90, 0x81, 0x30, 0xF0, 0x90, -0x81, 0x2B, 0xF0, 0x22, 0xEF, 0x24, 0xFE, 0x60, 0x0C, 0x04, 0x70, 0x28, 0x90, 0x81, 0x2D, 0x74, -0x01, 0xF0, 0xA3, 0xF0, 0x22, 0xED, 0x70, 0x0A, 0x90, 0x81, 0x3B, 0xE0, 0x90, 0x81, 0x2D, 0xF0, -0x80, 0x05, 0x90, 0x81, 0x2D, 0xED, 0xF0, 0x90, 0x81, 0x2D, 0xE0, 0xA3, 0xF0, 0x90, 0x81, 0x25, -0xE0, 0x44, 0x08, 0xF0, 0x22, 0x12, 0x4E, 0xAB, 0xEF, 0x64, 0x01, 0x60, 0x08, 0x90, 0x01, 0xB8, -0x74, 0x01, 0xF0, 0x80, 0x67, 0x90, 0x81, 0x2B, 0xE0, 0xFF, 0x54, 0x03, 0x60, 0x08, 0x90, 0x01, -0xB8, 0x74, 0x02, 0xF0, 0x80, 0x56, 0x90, 0x81, 0x29, 0xE0, 0xFE, 0xE4, 0xC3, 0x9E, 0x50, 0x08, -0x90, 0x01, 0xB8, 0x74, 0x04, 0xF0, 0x80, 0x44, 0xEF, 0x30, 0xE2, 0x08, 0x90, 0x01, 0xB8, 0x74, -0x08, 0xF0, 0x80, 0x38, 0x90, 0x81, 0x2B, 0xE0, 0x30, 0xE4, 0x08, 0x90, 0x01, 0xB8, 0x74, 0x10, -0xF0, 0x80, 0x29, 0x90, 0x81, 0x25, 0xE0, 0x13, 0x13, 0x54, 0x3F, 0x20, 0xE0, 0x08, 0x90, 0x01, -0xB8, 0x74, 0x20, 0xF0, 0x80, 0x16, 0x90, 0x81, 0x3E, 0xE0, 0x60, 0x08, 0x90, 0x01, 0xB8, 0x74, -0x80, 0xF0, 0x80, 0x08, 0x90, 0x01, 0xB8, 0xE4, 0xF0, 0x7F, 0x01, 0x22, 0x90, 0x01, 0xB9, 0x74, -0x04, 0xF0, 0x7F, 0x00, 0x22, 0xEF, 0x60, 0x42, 0x90, 0x80, 0xDE, 0xE0, 0x64, 0x01, 0x70, 0x3A, -0x90, 0x81, 0x25, 0xE0, 0x54, 0xFE, 0xF0, 0x90, 0x05, 0x22, 0x74, 0x0F, 0xF0, 0x90, 0x06, 0x04, -0xE0, 0x54, 0xBF, 0xF0, 0xE4, 0xFF, 0x12, 0x4F, 0x0D, 0xBF, 0x01, 0x12, 0x90, 0x81, 0x24, 0xE0, -0x44, 0x40, 0xF0, 0x90, 0x81, 0x2A, 0x74, 0x06, 0xF0, 0x90, 0x81, 0x23, 0xF0, 0x22, 0x90, 0x01, -0xB9, 0x74, 0x01, 0xF0, 0x90, 0x01, 0xB8, 0x74, 0x08, 0xF0, 0x22, 0x90, 0x05, 0x22, 0x74, 0x6F, -0xF0, 0x90, 0x05, 0x27, 0xE0, 0x54, 0xBF, 0xF0, 0x90, 0x81, 0x2A, 0x74, 0x02, 0xF0, 0x90, 0x81, -0x23, 0xF0, 0x22, 0x12, 0x54, 0x65, 0x90, 0x81, 0x2A, 0x74, 0x0C, 0xF0, 0x90, 0x81, 0x23, 0xF0, -0x22, 0x90, 0x81, 0x24, 0xE0, 0xFF, 0x13, 0x13, 0x54, 0x3F, 0x30, 0xE0, 0x11, 0xEF, 0x54, 0xFB, -0xF0, 0x90, 0x81, 0x2B, 0xE0, 0x54, 0xFD, 0xF0, 0x54, 0x07, 0x70, 0x42, 0x80, 0x3D, 0x90, 0x81, -0x30, 0xE0, 0x04, 0xF0, 0x90, 0x81, 0x2B, 0xE0, 0x54, 0xEF, 0xF0, 0x90, 0x81, 0x30, 0xE0, 0xFF, -0xB4, 0x01, 0x02, 0x80, 0x04, 0xEF, 0xB4, 0x02, 0x06, 0x90, 0x05, 0x58, 0xE0, 0x04, 0xF0, 0x90, -0x81, 0x38, 0xE0, 0xFF, 0x90, 0x81, 0x30, 0xE0, 0xD3, 0x9F, 0x40, 0x0F, 0x90, 0x80, 0xDE, 0xE0, -0xB4, 0x01, 0x0B, 0x90, 0x81, 0x25, 0xE0, 0x54, 0xFB, 0xF0, 0x22, 0x12, 0x47, 0x2A, 0x22, 0x22, -0x90, 0x05, 0x2B, 0xE0, 0x7F, 0x00, 0x30, 0xE7, 0x02, 0x7F, 0x01, 0x22, 0x90, 0x05, 0x22, 0x74, -0xFF, 0xF0, 0x90, 0x05, 0x27, 0xE0, 0x44, 0x40, 0xF0, 0x90, 0x81, 0x22, 0x74, 0x03, 0xF0, 0x22, -0x90, 0x05, 0x27, 0xE0, 0x44, 0x40, 0xF0, 0x12, 0x49, 0xDD, 0x90, 0x81, 0x22, 0x74, 0x02, 0xF0, -0x22, 0x12, 0x49, 0xE3, 0x90, 0x81, 0x22, 0x74, 0x02, 0xF0, 0x22, 0x90, 0x05, 0x22, 0x74, 0x6F, -0xF0, 0x90, 0x05, 0x27, 0xE0, 0x54, 0xBF, 0xF0, 0x90, 0x81, 0x22, 0x74, 0x04, 0xF0, 0x22, 0xAE, -0x07, 0x12, 0x51, 0x73, 0xBF, 0x01, 0x12, 0x90, 0x81, 0x23, 0xE0, 0x64, 0x02, 0x60, 0x0A, 0xAF, -0x06, 0x7D, 0x01, 0x12, 0x47, 0x3D, 0x7F, 0x01, 0x22, 0x7F, 0x00, 0x22, 0x90, 0x01, 0x57, 0xE0, -0x60, 0x48, 0xE4, 0xF0, 0x90, 0x01, 0x3C, 0x74, 0x02, 0xF0, 0x90, 0x81, 0x24, 0xE0, 0xFF, 0x13, -0x13, 0x54, 0x3F, 0x30, 0xE0, 0x0C, 0xEF, 0x54, 0xFB, 0xF0, 0x90, 0x81, 0x2B, 0xE0, 0x54, 0xFD, -0xF0, 0x22, 0x90, 0x81, 0x30, 0xE0, 0x04, 0xF0, 0x90, 0x81, 0x2B, 0xE0, 0x54, 0xEF, 0xF0, 0x90, -0x81, 0x38, 0xE0, 0xFF, 0x90, 0x81, 0x30, 0xE0, 0xD3, 0x9F, 0x40, 0x0E, 0x90, 0x80, 0xDE, 0xE0, -0xB4, 0x01, 0x07, 0x90, 0x81, 0x25, 0xE0, 0x54, 0xFB, 0xF0, 0x22, 0x90, 0x80, 0x3F, 0xE0, 0xFF, -0x7D, 0x01, 0x12, 0x6D, 0x69, 0x8E, 0x54, 0x8F, 0x55, 0xAD, 0x55, 0xAC, 0x54, 0xAF, 0x53, 0x12, -0x4F, 0x82, 0xAF, 0x55, 0xAE, 0x54, 0x90, 0x04, 0x80, 0xE0, 0x54, 0x0F, 0xFD, 0xAC, 0x07, 0x74, -0x11, 0x2C, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x44, 0x01, 0xF0, 0x74, 0x11, 0x2C, -0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x54, 0xFB, 0xF0, 0xAC, 0x07, 0x74, 0x16, 0x2C, -0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x44, 0xFA, 0xF0, 0x74, 0x15, 0x2C, 0xF5, 0x82, -0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x44, 0x1F, 0xF0, 0xAC, 0x07, 0x74, 0x06, 0x2C, 0xF5, 0x82, -0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x44, 0x0F, 0xF0, 0x90, 0x04, 0x53, 0xE4, 0xF0, 0x90, 0x04, -0x52, 0xF0, 0x90, 0x04, 0x51, 0x74, 0xFF, 0xF0, 0x90, 0x04, 0x50, 0x74, 0xFD, 0xF0, 0x74, 0x14, -0x2C, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x54, 0xC0, 0x4D, 0xFD, 0x74, 0x14, 0x2F, -0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xED, 0xF0, 0x22, 0xAB, 0x07, 0xAA, 0x06, 0xED, 0x2B, -0xFB, 0xE4, 0x3A, 0xFA, 0xC3, 0x90, 0x80, 0xDB, 0xE0, 0x9B, 0x90, 0x80, 0xDA, 0xE0, 0x9A, 0x50, -0x13, 0xA3, 0xE0, 0x24, 0x01, 0xFF, 0x90, 0x80, 0xDA, 0xE0, 0x34, 0x00, 0xFE, 0xC3, 0xEB, 0x9F, -0xFB, 0xEA, 0x9E, 0xFA, 0xEA, 0x90, 0xFD, 0x11, 0xF0, 0xAF, 0x03, 0x74, 0x00, 0x2F, 0xF5, 0x82, -0xE4, 0x34, 0xFB, 0xF5, 0x83, 0xE0, 0xFF, 0x22, 0x12, 0x1F, 0xA4, 0xFF, 0x54, 0x01, 0xFE, 0x90, -0x81, 0x42, 0xE0, 0x54, 0xFE, 0x4E, 0xF0, 0xEF, 0xC3, 0x13, 0x30, 0xE0, 0x0A, 0x90, 0x00, 0x01, -0x12, 0x1F, 0xBD, 0x90, 0x81, 0x43, 0xF0, 0x22, 0x90, 0x81, 0x45, 0xE0, 0x30, 0xE0, 0x2D, 0x90, -0x81, 0x48, 0xE0, 0x04, 0xF0, 0xE0, 0xFF, 0x90, 0x81, 0x46, 0xE0, 0xB5, 0x07, 0x1E, 0x90, 0x06, -0x92, 0xE0, 0x54, 0x1C, 0x70, 0x0B, 0x12, 0x4F, 0x0B, 0x90, 0x81, 0x49, 0xE0, 0x04, 0xF0, 0x80, -0x06, 0x90, 0x06, 0x92, 0x74, 0x1C, 0xF0, 0xE4, 0x90, 0x81, 0x48, 0xF0, 0x22, 0x00, 0xBB, 0x8E, -}; +/****************************************************************************** +* +* 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 +* +* +******************************************************************************/ +#include "odm_precomp.h" + +const u8 Rtl8188EFwImgArray[Rtl8188EFWImgArrayLength] = { +0xE1, 0x88, 0x10, 0x00, 0x0B, 0x00, 0x01, 0x00, 0x01, 0x21, 0x11, 0x27, 0x30, 0x36, 0x00, 0x00, +0x2D, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x02, 0x45, 0x4E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0xC1, 0x6F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0xA1, 0xE6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x56, 0xF7, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0xC2, 0xAF, 0x80, 0xFE, 0x32, 0x12, 0x42, 0x04, 0x85, 0xD0, 0x0B, 0x75, 0xD0, 0x08, 0xAA, 0xE0, +0xC2, 0x8C, 0xE5, 0x8A, 0x24, 0x67, 0xF5, 0x8A, 0xE5, 0x8C, 0x34, 0x79, 0xF5, 0x8C, 0xD2, 0x8C, +0xEC, 0x24, 0x89, 0xF8, 0xE6, 0xBC, 0x03, 0x02, 0x74, 0xFF, 0xC3, 0x95, 0x81, 0xB4, 0x40, 0x00, +0x40, 0xCE, 0x79, 0x04, 0x78, 0x80, 0x16, 0xE6, 0x08, 0x70, 0x0B, 0xC2, 0xAF, 0xE6, 0x30, 0xE1, +0x03, 0x44, 0x18, 0xF6, 0xD2, 0xAF, 0x08, 0xD9, 0xED, 0xEA, 0x8B, 0xD0, 0x22, 0xE5, 0x0C, 0xFF, +0x23, 0x24, 0x81, 0xF8, 0x0F, 0x08, 0x08, 0xBF, 0x04, 0x04, 0x7F, 0x00, 0x78, 0x81, 0xE6, 0x30, +0xE4, 0xF2, 0x00, 0xE5, 0x0C, 0xC3, 0x9F, 0x50, 0x20, 0x05, 0x0C, 0x74, 0x88, 0x25, 0x0C, 0xF8, +0xE6, 0xFD, 0xA6, 0x81, 0x08, 0xE6, 0xAE, 0x0C, 0xBE, 0x03, 0x02, 0x74, 0xFF, 0xCD, 0xF8, 0xE8, +0x6D, 0x60, 0xE0, 0x08, 0xE6, 0xC0, 0xE0, 0x80, 0xF6, 0xE5, 0x0C, 0xD3, 0x9F, 0x40, 0x27, 0xE5, +0x0C, 0x24, 0x89, 0xF8, 0xE6, 0xAE, 0x0C, 0xBE, 0x03, 0x02, 0x74, 0xFF, 0xFD, 0x18, 0xE6, 0xCD, +0xF8, 0xE5, 0x81, 0x6D, 0x60, 0x06, 0xD0, 0xE0, 0xF6, 0x18, 0x80, 0xF5, 0xE5, 0x0C, 0x24, 0x88, +0xC8, 0xF6, 0x15, 0x0C, 0x80, 0xD3, 0xE5, 0x0C, 0x23, 0x24, 0x81, 0xF8, 0x7F, 0x04, 0xC2, 0xAF, +0xE6, 0x30, 0xE0, 0x03, 0x10, 0xE2, 0x0C, 0x7F, 0x00, 0x30, 0xE1, 0x07, 0x30, 0xE3, 0x04, 0x7F, +0x08, 0x54, 0xF4, 0x54, 0x7C, 0xC6, 0xD2, 0xAF, 0x54, 0x80, 0x42, 0x07, 0x22, 0x78, 0x88, 0xA6, +0x81, 0x74, 0x03, 0x60, 0x06, 0xFF, 0x08, 0x76, 0xFF, 0xDF, 0xFB, 0x7F, 0x04, 0xE4, 0x78, 0x80, +0xF6, 0x08, 0xF6, 0x08, 0xDF, 0xFA, 0x78, 0x81, 0x76, 0x30, 0x90, 0x45, 0xDE, 0x74, 0x01, 0x93, +0xC0, 0xE0, 0xE4, 0x93, 0xC0, 0xE0, 0x43, 0x89, 0x01, 0x75, 0x8A, 0x60, 0x75, 0x8C, 0x79, 0xD2, +0x8C, 0xD2, 0xAF, 0x22, 0x03, 0xEF, 0xD3, 0x94, 0x03, 0x40, 0x03, 0x7F, 0xFF, 0x22, 0x74, 0x81, +0x2F, 0x2F, 0xF8, 0xE6, 0x20, 0xE5, 0xF4, 0xC2, 0xAF, 0xE6, 0x44, 0x30, 0xF6, 0xD2, 0xAF, 0xAE, +0x0C, 0xEE, 0xC3, 0x9F, 0x50, 0x21, 0x0E, 0x74, 0x88, 0x2E, 0xF8, 0xE6, 0xF9, 0x08, 0xE6, 0x18, +0xBE, 0x03, 0x02, 0x74, 0xFF, 0xFD, 0xED, 0x69, 0x60, 0x09, 0x09, 0xE7, 0x19, 0x19, 0xF7, 0x09, +0x09, 0x80, 0xF3, 0x16, 0x16, 0x80, 0xDA, 0xEE, 0xD3, 0x9F, 0x40, 0x04, 0x05, 0x81, 0x05, 0x81, +0xEE, 0xD3, 0x9F, 0x40, 0x22, 0x74, 0x88, 0x2E, 0xF8, 0x08, 0xE6, 0xF9, 0xEE, 0xB5, 0x0C, 0x02, +0xA9, 0x81, 0x18, 0x06, 0x06, 0xE6, 0xFD, 0xED, 0x69, 0x60, 0x09, 0x19, 0x19, 0xE7, 0x09, 0x09, +0xF7, 0x19, 0x80, 0xF3, 0x1E, 0x80, 0xD9, 0xEF, 0x24, 0x88, 0xF8, 0xE6, 0x04, 0xF8, 0xEF, 0x2F, +0x04, 0x90, 0x45, 0xDE, 0x93, 0xF6, 0x08, 0xEF, 0x2F, 0x93, 0xF6, 0x7F, 0x00, 0x22, 0xEF, 0xD3, +0x94, 0x03, 0x40, 0x03, 0x7F, 0xFF, 0x22, 0xEF, 0x23, 0x24, 0x81, 0xF8, 0xE6, 0x30, 0xE5, 0xF4, +0xC2, 0xAF, 0xE6, 0x54, 0x8C, 0xF6, 0xD2, 0xAF, 0xE5, 0x0C, 0xB5, 0x07, 0x0A, 0x74, 0x88, 0x2F, +0xF8, 0xE6, 0xF5, 0x81, 0x02, 0x42, 0x4D, 0x50, 0x2E, 0x74, 0x89, 0x2F, 0xF8, 0xE6, 0xBF, 0x03, +0x02, 0x74, 0xFF, 0xFD, 0x18, 0xE6, 0xF9, 0x74, 0x88, 0x2F, 0xF8, 0xFB, 0xE6, 0xFC, 0xE9, 0x6C, +0x60, 0x08, 0xA8, 0x05, 0xE7, 0xF6, 0x1D, 0x19, 0x80, 0xF4, 0xA8, 0x03, 0xA6, 0x05, 0x1F, 0xE5, +0x0C, 0xB5, 0x07, 0xE3, 0x7F, 0x00, 0x22, 0x74, 0x89, 0x2F, 0xF8, 0xE6, 0xFD, 0x18, 0x86, 0x01, +0x0F, 0x74, 0x88, 0x2F, 0xF8, 0xA6, 0x01, 0x08, 0x86, 0x04, 0xE5, 0x0C, 0xB5, 0x07, 0x02, 0xAC, +0x81, 0xED, 0x6C, 0x60, 0x08, 0x0D, 0x09, 0xA8, 0x05, 0xE6, 0xF7, 0x80, 0xF4, 0xE5, 0x0C, 0xB5, +0x07, 0xDE, 0x89, 0x81, 0x7F, 0x00, 0x22, 0xEF, 0xD3, 0x94, 0x03, 0x40, 0x03, 0x7F, 0xFF, 0x22, +0xEF, 0x23, 0x24, 0x81, 0xF8, 0xC2, 0xAF, 0xE6, 0x30, 0xE5, 0x05, 0x30, 0xE0, 0x02, 0xD2, 0xE4, +0xD2, 0xE2, 0xC6, 0xD2, 0xAF, 0x7F, 0x00, 0x30, 0xE2, 0x01, 0x0F, 0x02, 0x42, 0x4C, 0x8F, 0xF0, +0xE4, 0xFF, 0xFE, 0xE5, 0x0C, 0x23, 0x24, 0x80, 0xF8, 0xC2, 0xA9, 0x30, 0xF7, 0x0D, 0x7F, 0x08, +0xE6, 0x60, 0x0B, 0x2D, 0xF6, 0x60, 0x30, 0x50, 0x2E, 0x80, 0x07, 0x30, 0xF1, 0x06, 0xED, 0xF6, +0x60, 0x25, 0x7E, 0x02, 0x08, 0x30, 0xF0, 0x10, 0xC2, 0xAF, 0xE6, 0x10, 0xE7, 0x23, 0x0E, 0x30, +0xE2, 0x0C, 0xD2, 0xAF, 0x7F, 0x04, 0x80, 0x12, 0xC2, 0xAF, 0xE6, 0x10, 0xE7, 0x13, 0x54, 0xEC, +0x4E, 0xF6, 0xD2, 0xAF, 0x02, 0x42, 0x4D, 0x7F, 0x08, 0x08, 0xEF, 0x44, 0x83, 0xF4, 0xC2, 0xAF, +0x56, 0xC6, 0xD2, 0xAF, 0x54, 0x80, 0x4F, 0xFF, 0x22, 0xC5, 0xF0, 0xF8, 0xA3, 0xE0, 0x28, 0xF0, +0xC5, 0xF0, 0xF8, 0xE5, 0x82, 0x15, 0x82, 0x70, 0x02, 0x15, 0x83, 0xE0, 0x38, 0xF0, 0x22, 0xEF, +0x5B, 0xFF, 0xEE, 0x5A, 0xFE, 0xED, 0x59, 0xFD, 0xEC, 0x58, 0xFC, 0x22, 0xEF, 0x4B, 0xFF, 0xEE, +0x4A, 0xFE, 0xED, 0x49, 0xFD, 0xEC, 0x48, 0xFC, 0x22, 0xE0, 0xFC, 0xA3, 0xE0, 0xFD, 0xA3, 0xE0, +0xFE, 0xA3, 0xE0, 0xFF, 0x22, 0xE2, 0xFC, 0x08, 0xE2, 0xFD, 0x08, 0xE2, 0xFE, 0x08, 0xE2, 0xFF, +0x22, 0xE2, 0xFB, 0x08, 0xE2, 0xF9, 0x08, 0xE2, 0xFA, 0x08, 0xE2, 0xCB, 0xF8, 0x22, 0xEC, 0xF2, +0x08, 0xED, 0xF2, 0x08, 0xEE, 0xF2, 0x08, 0xEF, 0xF2, 0x22, 0xA4, 0x25, 0x82, 0xF5, 0x82, 0xE5, +0xF0, 0x35, 0x83, 0xF5, 0x83, 0x22, 0xE0, 0xFB, 0xA3, 0xE0, 0xFA, 0xA3, 0xE0, 0xF9, 0x22, 0xEB, +0xF0, 0xA3, 0xEA, 0xF0, 0xA3, 0xE9, 0xF0, 0x22, 0xD0, 0x83, 0xD0, 0x82, 0xF8, 0xE4, 0x93, 0x70, +0x12, 0x74, 0x01, 0x93, 0x70, 0x0D, 0xA3, 0xA3, 0x93, 0xF8, 0x74, 0x01, 0x93, 0xF5, 0x82, 0x88, +0x83, 0xE4, 0x73, 0x74, 0x02, 0x93, 0x68, 0x60, 0xEF, 0xA3, 0xA3, 0xA3, 0x80, 0xDF, 0x02, 0x45, +0x8C, 0x02, 0x42, 0xDD, 0xE4, 0x93, 0xA3, 0xF8, 0xE4, 0x93, 0xA3, 0x40, 0x03, 0xF6, 0x80, 0x01, +0xF2, 0x08, 0xDF, 0xF4, 0x80, 0x29, 0xE4, 0x93, 0xA3, 0xF8, 0x54, 0x07, 0x24, 0x0C, 0xC8, 0xC3, +0x33, 0xC4, 0x54, 0x0F, 0x44, 0x20, 0xC8, 0x83, 0x40, 0x04, 0xF4, 0x56, 0x80, 0x01, 0x46, 0xF6, +0xDF, 0xE4, 0x80, 0x0B, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x90, 0x45, 0xD1, 0xE4, +0x7E, 0x01, 0x93, 0x60, 0xBC, 0xA3, 0xFF, 0x54, 0x3F, 0x30, 0xE5, 0x09, 0x54, 0x1F, 0xFE, 0xE4, +0x93, 0xA3, 0x60, 0x01, 0x0E, 0xCF, 0x54, 0xC0, 0x25, 0xE0, 0x60, 0xA8, 0x40, 0xB8, 0xE4, 0x93, +0xA3, 0xFA, 0xE4, 0x93, 0xA3, 0xF8, 0xE4, 0x93, 0xA3, 0xC8, 0xC5, 0x82, 0xC8, 0xCA, 0xC5, 0x83, +0xCA, 0xF0, 0xA3, 0xC8, 0xC5, 0x82, 0xC8, 0xCA, 0xC5, 0x83, 0xCA, 0xDF, 0xE9, 0xDE, 0xE7, 0x80, +0xBE, 0x00, 0x41, 0x82, 0x09, 0x00, 0x41, 0x82, 0x0A, 0x00, 0x41, 0x82, 0x17, 0x00, 0x59, 0xE2, +0x5C, 0x24, 0x5E, 0x5D, 0x5F, 0xA1, 0xC0, 0xE0, 0xC0, 0xF0, 0xC0, 0x83, 0xC0, 0x82, 0xC0, 0xD0, +0x75, 0xD0, 0x00, 0xC0, 0x00, 0xC0, 0x01, 0xC0, 0x02, 0xC0, 0x03, 0xC0, 0x04, 0xC0, 0x05, 0xC0, +0x06, 0xC0, 0x07, 0x90, 0x01, 0xC4, 0x74, 0xE6, 0xF0, 0x74, 0x45, 0xA3, 0xF0, 0xD1, 0x35, 0x74, +0xE6, 0x04, 0x90, 0x01, 0xC4, 0xF0, 0x74, 0x45, 0xA3, 0xF0, 0xD0, 0x07, 0xD0, 0x06, 0xD0, 0x05, +0xD0, 0x04, 0xD0, 0x03, 0xD0, 0x02, 0xD0, 0x01, 0xD0, 0x00, 0xD0, 0xD0, 0xD0, 0x82, 0xD0, 0x83, +0xD0, 0xF0, 0xD0, 0xE0, 0x32, 0x90, 0x00, 0x54, 0xE0, 0x55, 0x35, 0xF5, 0x39, 0xA3, 0xE0, 0x55, +0x36, 0xF5, 0x3A, 0xA3, 0xE0, 0x55, 0x37, 0xF5, 0x3B, 0xA3, 0xE0, 0x55, 0x38, 0xF5, 0x3C, 0xAD, +0x39, 0x7F, 0x54, 0x12, 0x32, 0x1E, 0xAD, 0x3A, 0x7F, 0x55, 0x12, 0x32, 0x1E, 0xAD, 0x3B, 0x7F, +0x56, 0x12, 0x32, 0x1E, 0xAD, 0x3C, 0x7F, 0x57, 0x12, 0x32, 0x1E, 0x53, 0x91, 0xEF, 0x22, 0xC0, +0xE0, 0xC0, 0xF0, 0xC0, 0x83, 0xC0, 0x82, 0xC0, 0xD0, 0x75, 0xD0, 0x00, 0xC0, 0x00, 0xC0, 0x01, +0xC0, 0x02, 0xC0, 0x03, 0xC0, 0x04, 0xC0, 0x05, 0xC0, 0x06, 0xC0, 0x07, 0x90, 0x01, 0xC4, 0x74, +0x6F, 0xF0, 0x74, 0x46, 0xA3, 0xF0, 0x12, 0x6C, 0x78, 0xE5, 0x41, 0x30, 0xE4, 0x04, 0x7F, 0x02, +0x91, 0x27, 0xE5, 0x41, 0x30, 0xE6, 0x03, 0x12, 0x6C, 0xD5, 0xE5, 0x43, 0x30, 0xE0, 0x03, 0x12, +0x51, 0xC2, 0xE5, 0x43, 0x30, 0xE1, 0x03, 0x12, 0x4D, 0x0C, 0xE5, 0x43, 0x30, 0xE2, 0x03, 0x12, +0x4C, 0xC1, 0xE5, 0x43, 0x30, 0xE3, 0x03, 0x12, 0x6C, 0xE2, 0xE5, 0x43, 0x30, 0xE4, 0x03, 0x12, +0x6D, 0x04, 0xE5, 0x43, 0x30, 0xE5, 0x03, 0x12, 0x6D, 0x33, 0xE5, 0x43, 0x30, 0xE6, 0x02, 0xF1, +0x0F, 0xE5, 0x44, 0x30, 0xE1, 0x03, 0x12, 0x51, 0x7F, 0x74, 0x6F, 0x04, 0x90, 0x01, 0xC4, 0xF0, +0x74, 0x46, 0xA3, 0xF0, 0xD0, 0x07, 0xD0, 0x06, 0xD0, 0x05, 0xD0, 0x04, 0xD0, 0x03, 0xD0, 0x02, +0xD0, 0x01, 0xD0, 0x00, 0xD0, 0xD0, 0xD0, 0x82, 0xD0, 0x83, 0xD0, 0xF0, 0xD0, 0xE0, 0x32, 0x90, +0x80, 0xDE, 0xE0, 0xB4, 0x01, 0x13, 0x90, 0x81, 0x27, 0xE0, 0x60, 0x0D, 0x90, 0x81, 0x2B, 0xE0, +0x54, 0xFE, 0xF0, 0x54, 0x07, 0x70, 0x02, 0xF1, 0x2A, 0x22, 0x90, 0x81, 0x1F, 0xE0, 0x90, 0x81, +0x29, 0x30, 0xE0, 0x05, 0xE0, 0xFF, 0x02, 0x74, 0x8F, 0xE0, 0xFF, 0x7D, 0x01, 0xD3, 0x10, 0xAF, +0x01, 0xC3, 0xC0, 0xD0, 0x90, 0x82, 0x13, 0xED, 0xF0, 0x90, 0x81, 0x2A, 0xE0, 0x90, 0x82, 0x14, +0xF0, 0x90, 0x81, 0x24, 0xE0, 0xFE, 0xC4, 0x13, 0x13, 0x54, 0x03, 0x30, 0xE0, 0x03, 0x02, 0x48, +0xA0, 0xEE, 0xC4, 0x13, 0x13, 0x13, 0x54, 0x01, 0x30, 0xE0, 0x03, 0x02, 0x48, 0xA0, 0x90, 0x82, +0x14, 0xE0, 0xFE, 0x6F, 0x70, 0x03, 0x02, 0x48, 0xA0, 0xEF, 0x70, 0x03, 0x02, 0x48, 0x17, 0x24, +0xFE, 0x70, 0x03, 0x02, 0x48, 0x50, 0x24, 0xFE, 0x60, 0x51, 0x24, 0xFC, 0x70, 0x03, 0x02, 0x48, +0x8B, 0x24, 0xFC, 0x60, 0x03, 0x02, 0x48, 0xA0, 0xEE, 0xB4, 0x0E, 0x03, 0x12, 0x49, 0x5E, 0x90, +0x82, 0x14, 0xE0, 0x70, 0x05, 0x7F, 0x01, 0x12, 0x49, 0x93, 0x90, 0x82, 0x14, 0xE0, 0xB4, 0x06, +0x03, 0x12, 0x49, 0x34, 0x90, 0x82, 0x14, 0xE0, 0xB4, 0x04, 0x0F, 0x90, 0x82, 0x13, 0xE0, 0xFF, +0x60, 0x05, 0x12, 0x73, 0x75, 0x80, 0x03, 0x12, 0x66, 0x26, 0x90, 0x82, 0x14, 0xE0, 0x64, 0x08, +0x60, 0x03, 0x02, 0x48, 0xA0, 0x12, 0x73, 0xD3, 0x02, 0x48, 0xA0, 0x90, 0x82, 0x14, 0xE0, 0x70, +0x05, 0x7F, 0x01, 0x12, 0x49, 0x93, 0x90, 0x82, 0x14, 0xE0, 0xB4, 0x06, 0x03, 0x12, 0x49, 0x34, +0x90, 0x82, 0x14, 0xE0, 0xB4, 0x0E, 0x09, 0x12, 0x48, 0xA5, 0xBF, 0x01, 0x03, 0x12, 0x49, 0x5E, +0x90, 0x82, 0x14, 0xE0, 0x64, 0x0C, 0x60, 0x02, 0x01, 0xA0, 0x11, 0xA5, 0xEF, 0x64, 0x01, 0x60, +0x02, 0x01, 0xA0, 0x11, 0xFA, 0x01, 0xA0, 0x90, 0x82, 0x14, 0xE0, 0xB4, 0x0E, 0x07, 0x11, 0xA5, +0xBF, 0x01, 0x02, 0x31, 0x5E, 0x90, 0x82, 0x14, 0xE0, 0xB4, 0x06, 0x02, 0x31, 0x34, 0x90, 0x82, +0x14, 0xE0, 0xB4, 0x0C, 0x07, 0x11, 0xA5, 0xBF, 0x01, 0x02, 0x11, 0xFA, 0x90, 0x82, 0x14, 0xE0, +0x64, 0x04, 0x70, 0x5C, 0x12, 0x72, 0xF5, 0xEF, 0x64, 0x01, 0x70, 0x54, 0x31, 0xBE, 0x80, 0x50, +0x90, 0x82, 0x14, 0xE0, 0xB4, 0x0E, 0x07, 0x11, 0xA5, 0xBF, 0x01, 0x02, 0x31, 0x5E, 0x90, 0x82, +0x14, 0xE0, 0xB4, 0x06, 0x02, 0x31, 0x34, 0x90, 0x82, 0x14, 0xE0, 0xB4, 0x0C, 0x07, 0x11, 0xA5, +0xBF, 0x01, 0x02, 0x11, 0xFA, 0x90, 0x82, 0x14, 0xE0, 0x70, 0x04, 0x7F, 0x01, 0x31, 0x93, 0x90, +0x82, 0x14, 0xE0, 0xB4, 0x04, 0x1A, 0x12, 0x73, 0xBB, 0x80, 0x15, 0x90, 0x82, 0x14, 0xE0, 0xB4, +0x0C, 0x0E, 0x90, 0x81, 0x25, 0xE0, 0xFF, 0x13, 0x13, 0x54, 0x3F, 0x30, 0xE0, 0x02, 0x31, 0xB1, +0xD0, 0xD0, 0x92, 0xAF, 0x22, 0xD1, 0xAB, 0xEF, 0x64, 0x01, 0x60, 0x08, 0x90, 0x01, 0xB8, 0x74, +0x01, 0xF0, 0x80, 0x3D, 0x90, 0x81, 0x24, 0xE0, 0xFF, 0x13, 0x13, 0x13, 0x54, 0x1F, 0x30, 0xE0, +0x08, 0x90, 0x01, 0xB8, 0x74, 0x02, 0xF0, 0x80, 0x28, 0xEF, 0xC4, 0x54, 0x0F, 0x30, 0xE0, 0x08, +0x90, 0x01, 0xB8, 0x74, 0x04, 0xF0, 0x80, 0x19, 0x90, 0x81, 0x29, 0xE0, 0xD3, 0x94, 0x04, 0x40, +0x08, 0x90, 0x01, 0xB8, 0x74, 0x08, 0xF0, 0x80, 0x08, 0x90, 0x01, 0xB8, 0xE4, 0xF0, 0x7F, 0x01, +0x22, 0x90, 0x01, 0xB9, 0x74, 0x02, 0xF0, 0x7F, 0x00, 0x22, 0x90, 0x80, 0xDE, 0xE0, 0x64, 0x01, +0x70, 0x31, 0x90, 0x81, 0x25, 0xE0, 0x54, 0xFD, 0xF0, 0x90, 0x05, 0x22, 0x74, 0x6F, 0xF0, 0x7F, +0x01, 0xF1, 0x0D, 0xBF, 0x01, 0x12, 0x90, 0x81, 0x24, 0xE0, 0x44, 0x80, 0xF0, 0x90, 0x81, 0x2A, +0x74, 0x0E, 0xF0, 0x90, 0x81, 0x23, 0xF0, 0x22, 0x90, 0x01, 0xB9, 0x74, 0x01, 0xF0, 0x90, 0x01, +0xB8, 0x04, 0xF0, 0x22, 0x90, 0x81, 0x25, 0xE0, 0x90, 0x06, 0x04, 0x20, 0xE0, 0x0C, 0xE0, 0x44, +0x40, 0xF0, 0x90, 0x81, 0x2A, 0x74, 0x04, 0xF0, 0x80, 0x0E, 0xE0, 0x54, 0x7F, 0xF0, 0x90, 0x81, +0x2A, 0x74, 0x0C, 0xF0, 0x90, 0x81, 0x23, 0xF0, 0x90, 0x05, 0x22, 0xE4, 0xF0, 0x22, 0x90, 0x81, +0x25, 0xE0, 0xC3, 0x13, 0x20, 0xE0, 0x08, 0x90, 0x81, 0x2A, 0x74, 0x0C, 0xF0, 0x80, 0x1E, 0x90, +0x06, 0x04, 0xE0, 0x44, 0x40, 0xF0, 0xE0, 0x44, 0x80, 0xF0, 0x90, 0x81, 0x2A, 0x74, 0x04, 0xF0, +0x90, 0x05, 0x27, 0xE0, 0x44, 0x80, 0xF0, 0x90, 0x81, 0x23, 0x74, 0x04, 0xF0, 0x90, 0x05, 0x22, +0xE4, 0xF0, 0x22, 0x90, 0x82, 0x15, 0xEF, 0xF0, 0x12, 0x54, 0x65, 0x90, 0x82, 0x15, 0xE0, 0x60, +0x05, 0x90, 0x05, 0x22, 0xE4, 0xF0, 0x90, 0x81, 0x2A, 0x74, 0x04, 0xF0, 0x90, 0x81, 0x23, 0xF0, +0x22, 0x31, 0xE3, 0x90, 0x81, 0x2A, 0x74, 0x08, 0xF0, 0x90, 0x81, 0x23, 0xF0, 0x22, 0x90, 0x05, +0x22, 0x74, 0xFF, 0xF0, 0xF1, 0x3A, 0x90, 0x01, 0x37, 0x74, 0x02, 0xF0, 0xFD, 0x7F, 0x03, 0x51, +0x57, 0x31, 0xE3, 0xE4, 0x90, 0x81, 0x2A, 0xF0, 0x90, 0x81, 0x23, 0xF0, 0x22, 0x90, 0x05, 0x22, +0x74, 0xFF, 0xF0, 0xF1, 0x3A, 0x90, 0x85, 0xBB, 0x12, 0x20, 0xDA, 0xCC, 0xF0, 0x00, 0xC0, 0x7F, +0x8C, 0x7E, 0x08, 0x12, 0x2E, 0xA2, 0x90, 0x85, 0xBB, 0x12, 0x20, 0xDA, 0x00, 0x00, 0x00, 0x14, +0x7F, 0x70, 0x7E, 0x0E, 0x12, 0x2E, 0xA2, 0x90, 0x81, 0xF9, 0x12, 0x20, 0xDA, 0x00, 0x00, 0x00, +0x00, 0xE4, 0xFD, 0xFF, 0x12, 0x55, 0x1C, 0x7F, 0x7C, 0x7E, 0x08, 0x12, 0x2D, 0x5C, 0xEC, 0x44, +0x80, 0xFC, 0x90, 0x82, 0x05, 0x12, 0x20, 0xCE, 0x90, 0x82, 0x05, 0x12, 0x44, 0xD9, 0x90, 0x85, +0xBB, 0x12, 0x20, 0xCE, 0x7F, 0x7C, 0x7E, 0x08, 0x12, 0x2E, 0xA2, 0x90, 0x01, 0x00, 0x74, 0x3F, +0xF0, 0xA3, 0xE0, 0x54, 0xFD, 0xF0, 0x90, 0x05, 0x53, 0xE0, 0x44, 0x20, 0xF0, 0x22, 0x90, 0x01, +0x34, 0x74, 0x40, 0xF0, 0xFD, 0xE4, 0xFF, 0x74, 0x3D, 0x2F, 0xF8, 0xE6, 0x4D, 0xFE, 0xF6, 0x74, +0x30, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x01, 0xF5, 0x83, 0xEE, 0xF0, 0x22, 0xD3, 0x10, 0xAF, 0x01, +0xC3, 0xC0, 0xD0, 0xE4, 0x90, 0x81, 0xCB, 0xF0, 0x12, 0x1F, 0xA4, 0xFF, 0x54, 0x01, 0xFE, 0x90, +0x81, 0x1F, 0xE0, 0x54, 0xFE, 0x4E, 0xFE, 0xF0, 0xEF, 0x54, 0x02, 0xFF, 0xEE, 0x54, 0xFD, 0x4F, +0xFF, 0xF0, 0x12, 0x1F, 0xA4, 0xFE, 0x54, 0x04, 0xFD, 0xEF, 0x54, 0xFB, 0x4D, 0xFF, 0x90, 0x81, +0x1F, 0xF0, 0xEE, 0x54, 0x08, 0xFE, 0xEF, 0x54, 0xF7, 0x4E, 0xFF, 0xF0, 0x12, 0x1F, 0xA4, 0xFE, +0x54, 0x10, 0xFD, 0xEF, 0x54, 0xEF, 0x4D, 0xFF, 0x90, 0x81, 0x1F, 0xF0, 0xEE, 0x54, 0x20, 0xFE, +0xEF, 0x54, 0xDF, 0x4E, 0xF0, 0x12, 0x1F, 0xA4, 0xC3, 0x13, 0x20, 0xE0, 0x02, 0x61, 0x5E, 0x90, +0x81, 0x1F, 0xE0, 0xFF, 0x30, 0xE0, 0x6D, 0x90, 0x81, 0xCB, 0x74, 0x21, 0xF0, 0xEF, 0x13, 0x13, +0x54, 0x3F, 0x30, 0xE0, 0x0B, 0x51, 0x4E, 0x90, 0x81, 0xCB, 0xE0, 0x44, 0x08, 0xF0, 0x80, 0x0C, +0xE4, 0x90, 0x81, 0x20, 0xF0, 0xA3, 0xF0, 0x7D, 0x40, 0xFF, 0x91, 0x26, 0x90, 0x81, 0x1F, 0xE0, +0xFD, 0x13, 0x13, 0x13, 0x54, 0x1F, 0x30, 0xE0, 0x07, 0x90, 0x81, 0xCB, 0xE0, 0x44, 0x12, 0xF0, +0xED, 0xC4, 0x54, 0x0F, 0x30, 0xE0, 0x07, 0x90, 0x81, 0xCB, 0xE0, 0x44, 0x14, 0xF0, 0x90, 0x81, +0x1F, 0xE0, 0xC4, 0x13, 0x54, 0x07, 0x30, 0xE0, 0x07, 0x90, 0x81, 0xCB, 0xE0, 0x44, 0x80, 0xF0, +0x90, 0x81, 0xCB, 0xE0, 0x90, 0x05, 0x27, 0xF0, 0x90, 0x81, 0x22, 0xE0, 0x60, 0x02, 0x81, 0x17, +0x7F, 0x01, 0x80, 0x15, 0x90, 0x81, 0xCB, 0x74, 0x01, 0xF0, 0x90, 0x05, 0x27, 0xF0, 0x90, 0x81, +0x22, 0xE0, 0x64, 0x04, 0x60, 0x02, 0x81, 0x17, 0xFF, 0x12, 0x53, 0x0E, 0x81, 0x17, 0x90, 0x81, +0x1F, 0xE0, 0xFF, 0x20, 0xE0, 0x02, 0x61, 0xE7, 0x90, 0x81, 0xCB, 0x74, 0x31, 0xF0, 0xEF, 0x13, +0x13, 0x54, 0x3F, 0x30, 0xE0, 0x0B, 0x51, 0x4E, 0x90, 0x81, 0xCB, 0xE0, 0x44, 0x08, 0xF0, 0x80, +0x06, 0x7D, 0x40, 0xE4, 0xFF, 0x91, 0x26, 0x90, 0x81, 0x1F, 0xE0, 0xFD, 0x13, 0x13, 0x13, 0x54, +0x1F, 0x30, 0xE0, 0x07, 0x90, 0x81, 0xCB, 0xE0, 0x44, 0x02, 0xF0, 0xED, 0xC4, 0x54, 0x0F, 0x30, +0xE0, 0x07, 0x90, 0x81, 0xCB, 0xE0, 0x44, 0x04, 0xF0, 0x90, 0x81, 0xCB, 0xE0, 0x90, 0x05, 0x27, +0xF0, 0x90, 0x81, 0x23, 0xE0, 0x64, 0x02, 0x70, 0x1D, 0xFD, 0x7F, 0x04, 0x12, 0x47, 0x3D, 0x12, +0x51, 0x73, 0xBF, 0x01, 0x09, 0x90, 0x81, 0x29, 0xE0, 0xFF, 0x7D, 0x01, 0x80, 0x03, 0xE4, 0xFD, +0xFF, 0x12, 0x47, 0x3D, 0x80, 0x41, 0x90, 0x81, 0x2A, 0xE0, 0x90, 0x81, 0x23, 0xF0, 0x90, 0x05, +0x27, 0xE0, 0x44, 0x40, 0xF0, 0x80, 0x30, 0x90, 0x81, 0xCB, 0x74, 0x01, 0xF0, 0x90, 0x05, 0x27, +0xF0, 0x90, 0x81, 0x23, 0xE0, 0xB4, 0x02, 0x06, 0x7D, 0x01, 0x7F, 0x04, 0x80, 0x0B, 0x90, 0x81, +0x23, 0xE0, 0xB4, 0x08, 0x07, 0x7D, 0x01, 0x7F, 0x0C, 0x12, 0x47, 0x3D, 0xD1, 0x34, 0x90, 0x81, +0x29, 0x12, 0x47, 0x39, 0x12, 0x5A, 0xA7, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x7D, 0x02, 0x7F, 0x02, +0x91, 0x26, 0x7D, 0x01, 0x7F, 0x02, 0x74, 0x3D, 0x2F, 0xF8, 0xE6, 0xFE, 0xED, 0xF4, 0x5E, 0xFE, +0xF6, 0x74, 0x30, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x01, 0xF5, 0x83, 0xEE, 0xF0, 0x22, 0xEF, 0x70, +0x37, 0x7D, 0x78, 0x7F, 0x02, 0x91, 0x26, 0x7D, 0x02, 0x7F, 0x03, 0x91, 0x26, 0x7D, 0xC8, 0x7F, +0x02, 0x12, 0x71, 0x8F, 0x90, 0x01, 0x57, 0xE4, 0xF0, 0x90, 0x01, 0x3C, 0x74, 0x02, 0xF0, 0x7D, +0x01, 0x7F, 0x0C, 0x12, 0x47, 0x3D, 0x90, 0x81, 0x24, 0xE0, 0x54, 0xF7, 0xF0, 0x54, 0xEF, 0xF0, +0x90, 0x06, 0x0A, 0xE0, 0x54, 0xF8, 0xF0, 0x22, 0x90, 0x01, 0x36, 0x74, 0x78, 0xF0, 0xA3, 0x74, +0x02, 0xF0, 0x7D, 0x78, 0xFF, 0x51, 0x57, 0x7D, 0x02, 0x7F, 0x03, 0x51, 0x57, 0x90, 0x06, 0x0A, +0xE0, 0x44, 0x07, 0xF0, 0x90, 0x81, 0x32, 0xA3, 0xE0, 0x90, 0x05, 0x58, 0xF0, 0x90, 0x80, 0xDE, +0xE0, 0xB4, 0x01, 0x15, 0x90, 0x81, 0x25, 0xE0, 0x54, 0xFB, 0xF0, 0x90, 0x81, 0x2A, 0xE0, 0x20, +0xE2, 0x0E, 0x7D, 0x01, 0x7F, 0x04, 0x02, 0x47, 0x3D, 0x90, 0x81, 0x25, 0xE0, 0x44, 0x04, 0xF0, +0x22, 0x90, 0x81, 0x1F, 0xE0, 0xFF, 0x30, 0xE0, 0x08, 0x90, 0x81, 0x23, 0xE0, 0x64, 0x02, 0x60, +0x3A, 0x90, 0x81, 0x27, 0xE0, 0x70, 0x04, 0xEF, 0x30, 0xE0, 0x0A, 0x90, 0x81, 0x2A, 0xE0, 0x64, +0x02, 0x60, 0x28, 0xB1, 0x83, 0x90, 0x81, 0x25, 0xE0, 0x13, 0x13, 0x13, 0x54, 0x1F, 0x30, 0xE0, +0x14, 0x90, 0x81, 0x2D, 0xE0, 0xFF, 0xA3, 0xE0, 0x6F, 0x70, 0x0A, 0xF1, 0xCD, 0x91, 0x1C, 0x90, +0x81, 0x2E, 0xE0, 0x14, 0xF0, 0x90, 0x01, 0xE6, 0xE0, 0x04, 0xF0, 0x22, 0x90, 0x81, 0x1F, 0xE0, +0x30, 0xE0, 0x06, 0x90, 0x81, 0x21, 0x74, 0x01, 0xF0, 0x90, 0x81, 0x27, 0xE0, 0x60, 0x45, 0x90, +0x81, 0x25, 0xE0, 0xFF, 0x13, 0x13, 0x13, 0x54, 0x1F, 0x30, 0xE0, 0x12, 0x90, 0x01, 0x3B, 0xE0, +0x30, 0xE4, 0x0B, 0x91, 0x1C, 0x90, 0x81, 0x2D, 0xE0, 0x14, 0x90, 0x05, 0x73, 0xF0, 0x90, 0x82, +0x0B, 0xE4, 0x75, 0xF0, 0x01, 0x12, 0x44, 0xA9, 0xC3, 0x90, 0x82, 0x0C, 0xE0, 0x94, 0x80, 0x90, +0x82, 0x0B, 0xE0, 0x64, 0x80, 0x94, 0x80, 0x40, 0x0B, 0x90, 0x01, 0x98, 0xE0, 0x54, 0xFE, 0xF0, +0xE0, 0x44, 0x01, 0xF0, 0x12, 0x75, 0xF8, 0xD1, 0xD6, 0x90, 0x81, 0x3F, 0xE0, 0x30, 0xE0, 0x0C, +0xE4, 0xF5, 0x1D, 0xA3, 0xF1, 0xFB, 0x90, 0x01, 0x57, 0x74, 0x05, 0xF0, 0x90, 0x01, 0xBE, 0xE0, +0x04, 0xF0, 0x22, 0x90, 0x80, 0xDE, 0xE0, 0x64, 0x01, 0x60, 0x02, 0xC1, 0x23, 0x90, 0x81, 0x27, +0xE0, 0x70, 0x02, 0xC1, 0x23, 0x90, 0x81, 0x26, 0xE0, 0xC4, 0x54, 0x0F, 0x64, 0x01, 0x70, 0x22, +0x90, 0x06, 0xAB, 0xE0, 0x90, 0x81, 0x2E, 0xF0, 0x90, 0x06, 0xAA, 0xE0, 0x90, 0x81, 0x2D, 0xF0, +0xA3, 0xE0, 0xFF, 0x70, 0x08, 0x90, 0x81, 0x2D, 0xE0, 0xFE, 0xFF, 0x80, 0x00, 0x90, 0x81, 0x2E, +0xEF, 0xF0, 0x90, 0x81, 0x25, 0xE0, 0x44, 0x04, 0xF0, 0xE4, 0x90, 0x81, 0x30, 0xF0, 0x90, 0x81, +0x32, 0xA3, 0xE0, 0x90, 0x05, 0x58, 0xF0, 0x90, 0x01, 0x57, 0xE4, 0xF0, 0x90, 0x01, 0x3C, 0x74, +0x02, 0xF0, 0x90, 0x81, 0x2B, 0xE0, 0x54, 0xFD, 0xF0, 0x54, 0xEF, 0xF0, 0x90, 0x81, 0x26, 0xE0, +0xFF, 0xC4, 0x54, 0x0F, 0x24, 0xFD, 0x50, 0x02, 0x80, 0x0F, 0x90, 0x81, 0x1F, 0xE0, 0x30, 0xE0, +0x05, 0x12, 0x6D, 0xF2, 0x80, 0x03, 0x12, 0x6E, 0xC9, 0x90, 0x81, 0x25, 0xE0, 0x13, 0x13, 0x13, +0x54, 0x1F, 0x30, 0xE0, 0x0E, 0x90, 0x81, 0x2D, 0xE0, 0xFF, 0xA3, 0xE0, 0xB5, 0x07, 0x04, 0xF1, +0xCD, 0x91, 0x22, 0x90, 0x81, 0x1F, 0xE0, 0xC3, 0x13, 0x20, 0xE0, 0x07, 0x90, 0x81, 0x25, 0xE0, +0x44, 0x04, 0xF0, 0x22, 0xD1, 0xAB, 0xEF, 0x70, 0x02, 0xD1, 0x3C, 0x22, 0x90, 0x81, 0x27, 0xE0, +0x64, 0x01, 0x70, 0x66, 0x90, 0x81, 0x26, 0xE0, 0x54, 0x0F, 0x60, 0x51, 0x90, 0x81, 0x2A, 0xE0, +0x70, 0x03, 0xFF, 0x31, 0x93, 0x90, 0x81, 0x2A, 0xE0, 0x64, 0x0C, 0x60, 0x03, 0x12, 0x66, 0x26, +0x90, 0x01, 0x5B, 0xE4, 0xF0, 0x90, 0x01, 0x3C, 0x74, 0x04, 0xF0, 0xD1, 0xAB, 0xEF, 0x64, 0x01, +0x60, 0x38, 0xE4, 0xF5, 0x1D, 0x90, 0x81, 0x3A, 0xE0, 0xC3, 0x13, 0x54, 0x7F, 0xF5, 0x1E, 0xE4, +0xFB, 0xFD, 0x7F, 0x58, 0x7E, 0x01, 0x12, 0x50, 0x05, 0x90, 0x01, 0x5B, 0x74, 0x05, 0xF0, 0x90, +0x06, 0x92, 0x74, 0x01, 0xF0, 0x90, 0x81, 0x24, 0xE0, 0x44, 0x08, 0xF0, 0x22, 0x90, 0x81, 0x2A, +0xE0, 0x70, 0x07, 0x7D, 0x01, 0x7F, 0x04, 0x12, 0x47, 0x3D, 0x22, 0x90, 0x04, 0x1A, 0xE0, 0xF4, +0x60, 0x03, 0x7F, 0x00, 0x22, 0x90, 0x04, 0x1B, 0xE0, 0x54, 0x07, 0x64, 0x07, 0x7F, 0x01, 0x60, +0x02, 0x7F, 0x00, 0x22, 0x12, 0x50, 0x60, 0x90, 0x81, 0x2D, 0xE0, 0x14, 0x90, 0x05, 0x73, 0xF0, +0x7D, 0x02, 0x7F, 0x02, 0x51, 0x57, 0x90, 0x81, 0x42, 0xE0, 0x30, 0xE0, 0x2D, 0x90, 0x80, 0xDE, +0xE0, 0xB4, 0x01, 0x26, 0x90, 0x82, 0x17, 0xE0, 0x04, 0xF0, 0xE0, 0xB4, 0x0A, 0x0B, 0x90, 0x81, +0x44, 0xE0, 0x04, 0xF0, 0xE4, 0x90, 0x82, 0x17, 0xF0, 0x90, 0x81, 0x44, 0xE0, 0xFF, 0x90, 0x81, +0x43, 0xE0, 0xB5, 0x07, 0x05, 0xE4, 0xA3, 0xF0, 0xF1, 0x0B, 0x22, 0xE4, 0xFF, 0x8F, 0x53, 0x90, +0x04, 0x1D, 0xE0, 0x60, 0x19, 0x90, 0x05, 0x22, 0xE0, 0xF5, 0x56, 0x74, 0xFF, 0xF0, 0xF1, 0x3A, +0xBF, 0x01, 0x03, 0x12, 0x74, 0xFB, 0x90, 0x05, 0x22, 0xE5, 0x56, 0xF0, 0x80, 0x03, 0x12, 0x74, +0xFB, 0x90, 0x04, 0x1F, 0x74, 0x20, 0xF0, 0x7F, 0x01, 0x22, 0xE4, 0x90, 0x82, 0x0F, 0xF0, 0xA3, +0xF0, 0x90, 0x05, 0xF8, 0xE0, 0x70, 0x0F, 0xA3, 0xE0, 0x70, 0x0B, 0xA3, 0xE0, 0x70, 0x07, 0xA3, +0xE0, 0x70, 0x03, 0x7F, 0x01, 0x22, 0xD3, 0x90, 0x82, 0x10, 0xE0, 0x94, 0xE8, 0x90, 0x82, 0x0F, +0xE0, 0x94, 0x03, 0x40, 0x0A, 0x90, 0x01, 0xC0, 0xE0, 0x44, 0x20, 0xF0, 0x7F, 0x00, 0x22, 0x7F, +0x32, 0x7E, 0x00, 0x12, 0x32, 0xAA, 0x90, 0x82, 0x0F, 0xE4, 0x75, 0xF0, 0x01, 0x12, 0x44, 0xA9, +0x80, 0xBF, 0x74, 0x1F, 0x2D, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x54, 0x3F, 0xF0, +0xEF, 0x60, 0x1D, 0x74, 0x21, 0x2D, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x44, 0x10, +0xF0, 0x74, 0x1F, 0x2D, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x44, 0x80, 0xF0, 0x22, +0x74, 0x21, 0x2D, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x54, 0xEF, 0xF0, 0x74, 0x1F, +0x2D, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x44, 0x40, 0xF0, 0x22, 0xEF, 0x14, 0x90, +0x05, 0x73, 0xF0, 0x90, 0x01, 0x3F, 0x74, 0x10, 0xF0, 0xFD, 0x7F, 0x03, 0x74, 0x45, 0x2F, 0xF8, +0xE6, 0x4D, 0xFE, 0xF6, 0x74, 0x38, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x01, 0xF5, 0x83, 0xEE, 0xF0, +0x22, 0xE0, 0x44, 0x02, 0xF0, 0xE4, 0xF5, 0x1D, 0x90, 0x81, 0x39, 0xE0, 0xF5, 0x1E, 0xE4, 0xFB, +0xFD, 0x7F, 0x54, 0x7E, 0x01, 0x8E, 0x19, 0x8F, 0x1A, 0xE5, 0x1E, 0x54, 0x07, 0xC4, 0x33, 0x54, +0xE0, 0x85, 0x19, 0x83, 0x85, 0x1A, 0x82, 0xF0, 0xE5, 0x1D, 0x54, 0x07, 0xC4, 0x33, 0x54, 0xE0, +0xFF, 0xE5, 0x1E, 0x13, 0x13, 0x13, 0x54, 0x1F, 0x4F, 0xA3, 0xF0, 0xEB, 0x54, 0x07, 0xC4, 0x33, +0x54, 0xE0, 0xFF, 0xE5, 0x1D, 0x13, 0x13, 0x13, 0x54, 0x1F, 0x4F, 0x85, 0x1A, 0x82, 0x85, 0x19, +0x83, 0xA3, 0xA3, 0xF0, 0xBD, 0x01, 0x0C, 0x85, 0x1A, 0x82, 0x8E, 0x83, 0xA3, 0xA3, 0xA3, 0x74, +0x03, 0xF0, 0x22, 0x85, 0x1A, 0x82, 0x85, 0x19, 0x83, 0xA3, 0xA3, 0xA3, 0x74, 0x01, 0xF0, 0x22, +0xE4, 0x90, 0x81, 0x4D, 0xF0, 0x90, 0x81, 0x27, 0xE0, 0x60, 0x58, 0x90, 0x80, 0xDE, 0xE0, 0x64, +0x01, 0x70, 0x50, 0x90, 0x81, 0x4D, 0x04, 0xF0, 0xE4, 0x90, 0x81, 0x2E, 0xF0, 0x90, 0x81, 0x1F, +0xE0, 0x30, 0xE0, 0x15, 0x90, 0x81, 0x23, 0xE0, 0xB4, 0x02, 0x05, 0xE4, 0x90, 0x81, 0x4D, 0xF0, +0x31, 0x73, 0xEF, 0x70, 0x04, 0x90, 0x81, 0x4D, 0xF0, 0x90, 0x81, 0x4D, 0xE0, 0x60, 0x24, 0x90, +0x81, 0x2B, 0xE0, 0x44, 0x10, 0xF0, 0xE4, 0xF5, 0x1D, 0x90, 0x81, 0x2F, 0x12, 0x4F, 0xFB, 0x90, +0x01, 0x57, 0x74, 0x05, 0xF0, 0x90, 0x81, 0x2A, 0xE0, 0x20, 0xE2, 0x07, 0x7D, 0x01, 0x7F, 0x04, +0x12, 0x47, 0x3D, 0x22, 0xE4, 0x90, 0x81, 0x4C, 0xF0, 0x90, 0x81, 0x27, 0xE0, 0x70, 0x02, 0x21, +0x72, 0x90, 0x80, 0xDE, 0xE0, 0x64, 0x01, 0x60, 0x02, 0x21, 0x72, 0x90, 0x81, 0x26, 0xE0, 0xFF, +0xC4, 0x54, 0x0F, 0x60, 0x22, 0x24, 0xFE, 0x60, 0x03, 0x04, 0x70, 0x21, 0x90, 0x81, 0x2E, 0xE0, +0x14, 0xF0, 0xE0, 0xFF, 0x60, 0x06, 0x90, 0x81, 0x30, 0xE0, 0x60, 0x11, 0xEF, 0x70, 0x08, 0x90, +0x81, 0x2D, 0xE0, 0xA3, 0xF0, 0x80, 0x00, 0x90, 0x81, 0x4C, 0x74, 0x01, 0xF0, 0x90, 0x81, 0x1F, +0xE0, 0x30, 0xE0, 0x15, 0x90, 0x81, 0x23, 0xE0, 0xB4, 0x02, 0x05, 0xE4, 0x90, 0x81, 0x4C, 0xF0, +0x31, 0x73, 0xEF, 0x70, 0x04, 0x90, 0x81, 0x4C, 0xF0, 0x90, 0x81, 0x4C, 0xE0, 0x60, 0x43, 0x90, +0x81, 0x2B, 0xE0, 0x44, 0x10, 0xF0, 0x90, 0x81, 0x30, 0xE0, 0x60, 0x03, 0xB4, 0x01, 0x09, 0xE4, +0xF5, 0x1D, 0x90, 0x81, 0x30, 0xE0, 0x80, 0x0D, 0xE4, 0xF5, 0x1D, 0x90, 0x81, 0x30, 0xE0, 0x75, +0xF0, 0x03, 0xA4, 0x24, 0xFE, 0xFF, 0x90, 0x81, 0x2F, 0xE0, 0x2F, 0x12, 0x4F, 0xFC, 0x90, 0x01, +0x57, 0x74, 0x05, 0xF0, 0x90, 0x81, 0x2A, 0xE0, 0x20, 0xE2, 0x07, 0x7D, 0x01, 0x7F, 0x04, 0x12, +0x47, 0x3D, 0x22, 0x90, 0x05, 0x43, 0xE0, 0x7F, 0x00, 0x30, 0xE7, 0x02, 0x7F, 0x01, 0x22, 0x90, +0x81, 0x27, 0xE0, 0x70, 0x07, 0x90, 0x81, 0x1F, 0xE0, 0x30, 0xE0, 0x11, 0x90, 0x81, 0x1F, 0xE0, +0x30, 0xE0, 0x07, 0x31, 0x73, 0xBF, 0x01, 0x05, 0x41, 0x5B, 0x12, 0x4E, 0x3C, 0x22, 0xD3, 0x10, +0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0x81, 0x1E, 0xE0, 0xB4, 0x01, 0x04, 0x7F, 0x04, 0x80, 0x0B, +0x31, 0x73, 0xBF, 0x01, 0x04, 0x7F, 0x01, 0x80, 0x02, 0x7F, 0x02, 0x71, 0x0E, 0xD0, 0xD0, 0x92, +0xAF, 0x22, 0x90, 0x81, 0x4B, 0xE0, 0x60, 0x0F, 0xE4, 0xF0, 0x90, 0x05, 0x53, 0xE0, 0x44, 0x02, +0xF0, 0x90, 0x05, 0xFC, 0xE0, 0x04, 0xF0, 0x90, 0x81, 0x1F, 0xE0, 0x30, 0xE0, 0x10, 0xA3, 0x74, +0x01, 0xF0, 0x90, 0x81, 0x1F, 0xE0, 0xFF, 0xC3, 0x13, 0x30, 0xE0, 0x02, 0x31, 0x9E, 0x11, 0xC4, +0x90, 0x81, 0x3F, 0xE0, 0x30, 0xE0, 0x07, 0x91, 0x65, 0x90, 0x05, 0x22, 0xE4, 0xF0, 0x22, 0x90, +0x81, 0x1F, 0xE0, 0xFF, 0x30, 0xE0, 0x3D, 0x90, 0x81, 0x23, 0xE0, 0x7E, 0x00, 0xB4, 0x02, 0x02, +0x7E, 0x01, 0x90, 0x81, 0x22, 0xE0, 0x7D, 0x00, 0xB4, 0x04, 0x02, 0x7D, 0x01, 0xED, 0x4E, 0x70, +0x23, 0xEF, 0xC3, 0x13, 0x30, 0xE0, 0x02, 0x21, 0x9E, 0x51, 0x45, 0x90, 0x81, 0x23, 0xE0, 0xB4, +0x08, 0x06, 0xE4, 0xFD, 0x7F, 0x0C, 0x80, 0x09, 0x90, 0x81, 0x23, 0xE0, 0x70, 0x06, 0xFD, 0x7F, +0x04, 0x12, 0x47, 0x3D, 0x22, 0x90, 0x81, 0x1E, 0xE0, 0xB4, 0x01, 0x0F, 0x90, 0x81, 0x23, 0xE0, +0x64, 0x02, 0x60, 0x07, 0x7D, 0x01, 0x7F, 0x02, 0x12, 0x47, 0x3D, 0x90, 0x81, 0x27, 0xE0, 0x64, +0x02, 0x60, 0x14, 0x90, 0x81, 0x26, 0xE0, 0x54, 0x0F, 0x60, 0x0C, 0x12, 0x4E, 0xAB, 0xEF, 0x70, +0x06, 0xFD, 0x7F, 0x0C, 0x12, 0x47, 0x3D, 0x22, 0x90, 0x81, 0x1F, 0xE0, 0xFF, 0x30, 0xE0, 0x3F, +0x90, 0x81, 0x23, 0xE0, 0x7E, 0x00, 0xB4, 0x02, 0x02, 0x7E, 0x01, 0x90, 0x81, 0x22, 0xE0, 0x7D, +0x00, 0xB4, 0x04, 0x02, 0x7D, 0x01, 0xED, 0x4E, 0x70, 0x25, 0xEF, 0xC3, 0x13, 0x30, 0xE0, 0x02, +0x21, 0x9E, 0x12, 0x74, 0xAC, 0x90, 0x81, 0x23, 0xE0, 0xB4, 0x0C, 0x06, 0xE4, 0xFD, 0x7F, 0x08, +0x80, 0x0A, 0x90, 0x81, 0x23, 0xE0, 0xB4, 0x04, 0x06, 0xE4, 0xFD, 0xFF, 0x12, 0x47, 0x3D, 0x22, +0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0x81, 0xCB, 0x12, 0x45, 0x1F, 0x12, 0x1F, 0xA4, +0xFF, 0x90, 0x81, 0x1E, 0xF0, 0xBF, 0x01, 0x12, 0x90, 0x81, 0xCB, 0x12, 0x45, 0x16, 0x90, 0x00, +0x01, 0x12, 0x1F, 0xBD, 0x64, 0x01, 0x60, 0x21, 0x80, 0x1D, 0x90, 0x81, 0xCB, 0x12, 0x45, 0x16, +0x90, 0x00, 0x01, 0x12, 0x1F, 0xBD, 0x64, 0x01, 0x60, 0x0F, 0x90, 0x81, 0x1F, 0xE0, 0x20, 0xE0, +0x06, 0xE4, 0xFF, 0x71, 0x0E, 0x80, 0x02, 0x31, 0x9E, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0xD3, 0x10, +0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0x81, 0x22, 0xE0, 0x90, 0x82, 0x16, 0xF0, 0x6F, 0x70, 0x02, +0x81, 0x04, 0xEF, 0x14, 0x60, 0x3E, 0x14, 0x60, 0x62, 0x14, 0x70, 0x02, 0x61, 0xB8, 0x14, 0x70, +0x02, 0x61, 0xDF, 0x24, 0x04, 0x60, 0x02, 0x81, 0x04, 0x90, 0x82, 0x16, 0xE0, 0xFF, 0xB4, 0x04, +0x04, 0x91, 0x41, 0x81, 0x04, 0xEF, 0xB4, 0x02, 0x04, 0x91, 0x50, 0x81, 0x04, 0x90, 0x82, 0x16, +0xE0, 0xFF, 0xB4, 0x03, 0x04, 0x91, 0x54, 0x81, 0x04, 0xEF, 0x64, 0x01, 0x60, 0x02, 0x81, 0x04, +0x91, 0x43, 0x81, 0x04, 0x90, 0x82, 0x16, 0xE0, 0xFF, 0xB4, 0x04, 0x04, 0x91, 0xF3, 0x81, 0x04, +0xEF, 0xB4, 0x02, 0x04, 0x91, 0x58, 0x81, 0x04, 0x90, 0x82, 0x16, 0xE0, 0xFF, 0xB4, 0x03, 0x04, +0x91, 0xE8, 0x81, 0x04, 0xEF, 0x70, 0x7D, 0x91, 0x2B, 0x80, 0x79, 0x90, 0x82, 0x16, 0xE0, 0xB4, +0x04, 0x05, 0x12, 0x74, 0x60, 0x80, 0x6D, 0x90, 0x82, 0x16, 0xE0, 0xB4, 0x01, 0x04, 0x91, 0x21, +0x80, 0x62, 0x90, 0x82, 0x16, 0xE0, 0xB4, 0x03, 0x05, 0x12, 0x74, 0x71, 0x80, 0x56, 0x90, 0x82, +0x16, 0xE0, 0x70, 0x50, 0x91, 0x1F, 0x80, 0x4C, 0x90, 0x82, 0x16, 0xE0, 0xFF, 0xB4, 0x04, 0x05, +0x12, 0x74, 0x4C, 0x80, 0x3F, 0xEF, 0xB4, 0x01, 0x04, 0x91, 0x34, 0x80, 0x37, 0xEF, 0xB4, 0x02, +0x04, 0x91, 0xDF, 0x80, 0x2F, 0x90, 0x82, 0x16, 0xE0, 0x70, 0x29, 0x91, 0x32, 0x80, 0x25, 0x90, +0x82, 0x16, 0xE0, 0xFF, 0xB4, 0x03, 0x05, 0x12, 0x74, 0x7B, 0x80, 0x18, 0xEF, 0xB4, 0x01, 0x04, +0x91, 0x0B, 0x80, 0x10, 0xEF, 0xB4, 0x02, 0x04, 0xB1, 0x06, 0x80, 0x08, 0x90, 0x82, 0x16, 0xE0, +0x70, 0x02, 0x91, 0x09, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x91, 0x2B, 0x90, 0x05, 0x22, 0x74, 0x6F, +0xF0, 0x90, 0x05, 0x27, 0xE0, 0x54, 0xBF, 0xF0, 0x90, 0x81, 0x22, 0x74, 0x04, 0xF0, 0x22, 0x91, +0x2B, 0x12, 0x49, 0xDD, 0x90, 0x81, 0x22, 0x74, 0x02, 0xF0, 0x22, 0x90, 0x81, 0x22, 0x74, 0x01, +0xF0, 0x22, 0x91, 0x2B, 0x90, 0x05, 0x22, 0x74, 0xFF, 0xF0, 0x90, 0x81, 0x22, 0x74, 0x03, 0xF0, +0x22, 0x91, 0xF3, 0x90, 0x05, 0x27, 0xE0, 0x54, 0xBF, 0xF0, 0xE4, 0x90, 0x81, 0x22, 0xF0, 0x22, +0x91, 0x58, 0x80, 0xEF, 0x91, 0xE8, 0x80, 0xEB, 0x91, 0x65, 0x90, 0x05, 0x22, 0xE4, 0xF0, 0x90, +0x81, 0x22, 0x04, 0xF0, 0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0x01, 0x01, 0xE0, +0x44, 0x02, 0xF0, 0x90, 0x01, 0x00, 0x74, 0xFF, 0xF0, 0x90, 0x06, 0xB7, 0x74, 0x09, 0xF0, 0x90, +0x06, 0xB4, 0x74, 0x86, 0xF0, 0x7F, 0x7C, 0x7E, 0x08, 0x12, 0x2D, 0x5C, 0xEC, 0x54, 0x7F, 0xFC, +0x90, 0x82, 0x01, 0x12, 0x20, 0xCE, 0x90, 0x82, 0x01, 0x12, 0x44, 0xD9, 0x90, 0x85, 0xBB, 0x12, +0x20, 0xCE, 0x7F, 0x7C, 0x7E, 0x08, 0x12, 0x2E, 0xA2, 0x90, 0x85, 0xBB, 0x12, 0x20, 0xDA, 0xCC, +0xC0, 0x00, 0xC0, 0x7F, 0x8C, 0x7E, 0x08, 0x12, 0x2E, 0xA2, 0x90, 0x85, 0xBB, 0x12, 0x20, 0xDA, +0x00, 0xC0, 0x00, 0x14, 0x7F, 0x70, 0x7E, 0x0E, 0x12, 0x2E, 0xA2, 0x90, 0x81, 0xF9, 0x12, 0x20, +0xDA, 0x00, 0x03, 0x3E, 0x60, 0xE4, 0xFD, 0xFF, 0xB1, 0x1C, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x91, +0x65, 0x90, 0x81, 0x22, 0x74, 0x03, 0xF0, 0x22, 0x90, 0x05, 0x22, 0xE4, 0xF0, 0x90, 0x81, 0x22, +0x04, 0xF0, 0x22, 0x90, 0x05, 0x22, 0xE4, 0xF0, 0x90, 0x05, 0x27, 0xE0, 0x44, 0x40, 0xF0, 0x90, +0x81, 0x22, 0x74, 0x01, 0xF0, 0x22, 0x91, 0x65, 0x90, 0x05, 0x22, 0x74, 0x6F, 0xF0, 0x90, 0x05, +0x27, 0xE0, 0x54, 0xBF, 0xF0, 0x90, 0x81, 0x22, 0x74, 0x04, 0xF0, 0x22, 0xD3, 0x10, 0xAF, 0x01, +0xC3, 0xC0, 0xD0, 0xC0, 0x07, 0xC0, 0x05, 0x90, 0x81, 0xF9, 0x12, 0x44, 0xD9, 0x90, 0x81, 0xE5, +0x12, 0x20, 0xCE, 0xD0, 0x05, 0xD0, 0x07, 0x12, 0x60, 0xF5, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x90, +0x81, 0xC8, 0x12, 0x45, 0x1F, 0xEF, 0x12, 0x45, 0x28, 0x55, 0x71, 0x00, 0x55, 0x7A, 0x01, 0x55, +0x83, 0x02, 0x55, 0x8B, 0x03, 0x55, 0x94, 0x04, 0x55, 0x9C, 0x20, 0x55, 0xA4, 0x21, 0x55, 0xAD, +0x23, 0x55, 0xB5, 0x24, 0x55, 0xBE, 0x25, 0x55, 0xC7, 0x26, 0x55, 0xCF, 0xC0, 0x00, 0x00, 0x55, +0xD8, 0x90, 0x81, 0xC8, 0x12, 0x45, 0x16, 0x02, 0x6A, 0xB0, 0x90, 0x81, 0xC8, 0x12, 0x45, 0x16, +0x02, 0x65, 0x81, 0x90, 0x81, 0xC8, 0x12, 0x45, 0x16, 0x41, 0xC0, 0x90, 0x81, 0xC8, 0x12, 0x45, +0x16, 0x02, 0x75, 0xD8, 0x90, 0x81, 0xC8, 0x12, 0x45, 0x16, 0x80, 0x44, 0x90, 0x81, 0xC8, 0x12, +0x45, 0x16, 0xC1, 0x4B, 0x90, 0x81, 0xC8, 0x12, 0x45, 0x16, 0x02, 0x6A, 0xF8, 0x90, 0x81, 0xC8, +0x12, 0x45, 0x16, 0xE1, 0xE1, 0x90, 0x81, 0xC8, 0x12, 0x45, 0x16, 0x02, 0x4A, 0x6C, 0x90, 0x81, +0xC8, 0x12, 0x45, 0x16, 0x02, 0x6B, 0x3E, 0x90, 0x81, 0xC8, 0x12, 0x45, 0x16, 0x80, 0x3E, 0x90, +0x81, 0xC8, 0x12, 0x45, 0x16, 0x02, 0x6B, 0x4E, 0x90, 0x01, 0xC0, 0xE0, 0x44, 0x01, 0xF0, 0x22, +0x12, 0x5A, 0x4B, 0x12, 0x1F, 0xA4, 0xFF, 0x54, 0x01, 0xFE, 0x90, 0x81, 0x45, 0xE0, 0x54, 0xFE, +0x4E, 0xF0, 0xEF, 0xC3, 0x13, 0x30, 0xE0, 0x14, 0x90, 0x00, 0x01, 0x12, 0x1F, 0xBD, 0x90, 0x81, +0x46, 0xF0, 0x90, 0x00, 0x02, 0x12, 0x1F, 0xBD, 0x90, 0x81, 0x47, 0xF0, 0x22, 0x12, 0x1F, 0xA4, +0xFF, 0x54, 0x01, 0xFE, 0x90, 0x81, 0x3F, 0xE0, 0x54, 0xFE, 0x4E, 0xF0, 0x90, 0x00, 0x01, 0x12, +0x1F, 0xBD, 0xFE, 0x90, 0x05, 0x54, 0xE0, 0xC3, 0x9E, 0x90, 0x81, 0x40, 0xF0, 0xEF, 0x20, 0xE0, +0x07, 0x91, 0x65, 0x90, 0x05, 0x22, 0xE4, 0xF0, 0x90, 0x81, 0x3F, 0xE0, 0x54, 0x01, 0x90, 0x01, +0xBC, 0xF0, 0x90, 0x81, 0x40, 0xE0, 0x90, 0x01, 0xBD, 0xF0, 0x22, 0x12, 0x1F, 0xA4, 0xFF, 0x54, +0x7F, 0x90, 0x81, 0x27, 0xF0, 0xEF, 0xC4, 0x13, 0x13, 0x13, 0x54, 0x01, 0xA3, 0xF0, 0x90, 0x00, +0x01, 0x12, 0x1F, 0xBD, 0xFF, 0x54, 0xF0, 0xC4, 0x54, 0x0F, 0xFE, 0x90, 0x81, 0x26, 0xE0, 0x54, +0xF0, 0x4E, 0xF0, 0x90, 0x00, 0x03, 0x12, 0x1F, 0xBD, 0x54, 0x01, 0x25, 0xE0, 0xFE, 0x90, 0x81, +0x24, 0xE0, 0x54, 0xFD, 0x4E, 0xF0, 0xEF, 0x54, 0x0F, 0xC4, 0x54, 0xF0, 0xFF, 0x90, 0x81, 0x26, +0xE0, 0x54, 0x0F, 0x4F, 0xF0, 0x90, 0x00, 0x04, 0x12, 0x1F, 0xBD, 0x90, 0x81, 0x29, 0xF0, 0xD1, +0xC6, 0x90, 0x01, 0xB9, 0x74, 0x01, 0xF0, 0x90, 0x01, 0xB8, 0xF0, 0x90, 0x81, 0x27, 0xE0, 0x90, +0x01, 0xBA, 0xF0, 0x90, 0x81, 0x29, 0xE0, 0x90, 0x01, 0xBB, 0xF0, 0x90, 0x81, 0x26, 0xE0, 0x54, +0x0F, 0x90, 0x01, 0xBE, 0xF0, 0x22, 0x90, 0x81, 0xCB, 0x12, 0x45, 0x1F, 0x12, 0x72, 0xB3, 0x90, +0x81, 0x27, 0xE0, 0xFF, 0x12, 0x4C, 0x3E, 0x90, 0x81, 0x27, 0xE0, 0x60, 0x19, 0x90, 0x81, 0xCB, +0x12, 0x45, 0x16, 0x90, 0x00, 0x01, 0x12, 0x1F, 0xBD, 0x54, 0x0F, 0xFF, 0x90, 0x00, 0x02, 0x12, +0x1F, 0xBD, 0xFD, 0x12, 0x72, 0xC4, 0x22, 0xC0, 0xE0, 0xC0, 0xF0, 0xC0, 0x83, 0xC0, 0x82, 0xC0, +0xD0, 0x75, 0xD0, 0x00, 0xC0, 0x00, 0xC0, 0x01, 0xC0, 0x02, 0xC0, 0x03, 0xC0, 0x04, 0xC0, 0x05, +0xC0, 0x06, 0xC0, 0x07, 0x90, 0x01, 0xC4, 0x74, 0xF7, 0xF0, 0x74, 0x56, 0xA3, 0xF0, 0x12, 0x6C, +0xA5, 0xE5, 0x49, 0x30, 0xE1, 0x03, 0x12, 0x6F, 0x79, 0xE5, 0x49, 0x30, 0xE2, 0x02, 0xF1, 0xA5, +0xE5, 0x49, 0x30, 0xE3, 0x03, 0x12, 0x6F, 0x8D, 0xE5, 0x4A, 0x30, 0xE0, 0x03, 0x12, 0x6F, 0xC9, +0xE5, 0x4A, 0x30, 0xE4, 0x03, 0x12, 0x70, 0x22, 0xE5, 0x4B, 0x30, 0xE1, 0x02, 0x51, 0x78, 0xE5, +0x4B, 0x30, 0xE0, 0x02, 0x31, 0xFF, 0xE5, 0x4B, 0x30, 0xE3, 0x02, 0xF1, 0xE0, 0xE5, 0x4C, 0x30, +0xE1, 0x05, 0x7F, 0x03, 0x12, 0x44, 0x27, 0xE5, 0x4C, 0x30, 0xE4, 0x03, 0x12, 0x4E, 0xC4, 0xE5, +0x4C, 0x30, 0xE5, 0x03, 0x12, 0x70, 0x38, 0xE5, 0x4C, 0x30, 0xE6, 0x03, 0x12, 0x70, 0xCE, 0x74, +0xF7, 0x04, 0x90, 0x01, 0xC4, 0xF0, 0x74, 0x56, 0xA3, 0xF0, 0xD0, 0x07, 0xD0, 0x06, 0xD0, 0x05, +0xD0, 0x04, 0xD0, 0x03, 0xD0, 0x02, 0xD0, 0x01, 0xD0, 0x00, 0xD0, 0xD0, 0xD0, 0x82, 0xD0, 0x83, +0xD0, 0xF0, 0xD0, 0xE0, 0x32, 0x90, 0x81, 0x27, 0xE0, 0x60, 0x34, 0x90, 0x06, 0x92, 0xE0, 0x30, +0xE0, 0x23, 0xE4, 0xF5, 0x1D, 0x90, 0x81, 0x3A, 0xE0, 0xC3, 0x13, 0x54, 0x7F, 0xF5, 0x1E, 0xE4, +0xFB, 0xFD, 0x7F, 0x58, 0x7E, 0x01, 0x11, 0x05, 0x90, 0x01, 0x5B, 0x74, 0x05, 0xF0, 0x90, 0x06, +0x92, 0x74, 0x01, 0xF0, 0x22, 0x90, 0x81, 0x24, 0xE0, 0x54, 0xF7, 0xF0, 0x12, 0x47, 0x2A, 0x22, +0x22, 0x12, 0x1F, 0xA4, 0x90, 0x81, 0x31, 0xF0, 0x22, 0x90, 0x01, 0xC8, 0xE4, 0xF0, 0xA3, 0xF0, +0xA3, 0xF0, 0x7B, 0x01, 0x7A, 0x81, 0x79, 0x51, 0x7F, 0xFF, 0xFE, 0x12, 0x2B, 0x27, 0xBF, 0x01, +0x09, 0x90, 0x81, 0x51, 0xE0, 0x64, 0x03, 0x60, 0x03, 0x22, 0x01, 0xAB, 0xE4, 0x90, 0x81, 0x56, +0xF0, 0x90, 0x81, 0x56, 0xE0, 0xFF, 0xC3, 0x94, 0x02, 0x40, 0x02, 0x01, 0xE6, 0xC3, 0x74, 0xFE, +0x9F, 0xFF, 0xE4, 0x94, 0x00, 0xFE, 0x7B, 0x01, 0x7A, 0x81, 0x79, 0x52, 0x12, 0x2B, 0x27, 0xEF, +0x64, 0x01, 0x70, 0x77, 0x90, 0x81, 0x52, 0xE0, 0xFF, 0x54, 0xC0, 0xFE, 0x60, 0x05, 0xEF, 0x54, +0x0C, 0x70, 0x16, 0x90, 0x81, 0x52, 0xE0, 0xFF, 0x54, 0x30, 0x60, 0x67, 0xEF, 0x54, 0x03, 0x60, +0x62, 0x90, 0x81, 0x53, 0x74, 0x01, 0xF0, 0x80, 0x05, 0xE4, 0x90, 0x81, 0x53, 0xF0, 0x90, 0x81, +0x53, 0xE0, 0x90, 0x81, 0x52, 0x70, 0x16, 0xE0, 0xFF, 0xEE, 0x13, 0x13, 0x54, 0x3F, 0x90, 0x81, +0x54, 0xF0, 0xEF, 0x54, 0x0C, 0x13, 0x13, 0x54, 0x3F, 0xA3, 0xF0, 0x80, 0x0D, 0xE0, 0xFE, 0x54, +0x30, 0x90, 0x81, 0x54, 0xF0, 0xEE, 0x54, 0x03, 0xA3, 0xF0, 0x90, 0x81, 0x54, 0xE0, 0x64, 0x30, +0x70, 0x54, 0xA3, 0xE0, 0x64, 0x02, 0x70, 0x4E, 0x90, 0x00, 0xF5, 0xE0, 0x54, 0x40, 0x90, 0x81, +0x57, 0xF0, 0xE0, 0x70, 0x41, 0xA3, 0x74, 0x02, 0xF0, 0x80, 0x10, 0x90, 0x81, 0x58, 0x74, 0x01, +0xF0, 0x80, 0x08, 0x90, 0x81, 0x56, 0xE0, 0x04, 0xF0, 0x01, 0x11, 0x90, 0x01, 0xC4, 0x74, 0xE9, +0xF0, 0x74, 0x57, 0xA3, 0xF0, 0x90, 0x81, 0x58, 0xE0, 0x90, 0x01, 0xC8, 0xF0, 0x90, 0x81, 0x52, +0xE0, 0x90, 0x01, 0xC9, 0xF0, 0x90, 0x81, 0x53, 0xE0, 0x90, 0x01, 0xCA, 0xF0, 0xE4, 0xFD, 0x7F, +0x1F, 0x12, 0x32, 0x1E, 0x80, 0xD5, 0x22, 0x90, 0x00, 0xF7, 0xE0, 0x20, 0xE7, 0x09, 0xE0, 0x7F, +0x01, 0x20, 0xE6, 0x0C, 0x7F, 0x02, 0x22, 0x90, 0x00, 0xF7, 0xE0, 0x30, 0xE6, 0x02, 0x7F, 0x03, +0x22, 0x11, 0xE7, 0x90, 0x80, 0x3C, 0xEF, 0xF0, 0x31, 0x13, 0x90, 0x01, 0x64, 0x74, 0x01, 0xF0, +0x02, 0x2D, 0xA7, 0x31, 0x81, 0x31, 0xB1, 0x31, 0x40, 0x31, 0x5F, 0xE4, 0xF5, 0x35, 0xF5, 0x36, +0xF5, 0x37, 0xF5, 0x38, 0xAD, 0x35, 0x7F, 0x50, 0x12, 0x32, 0x1E, 0xAD, 0x36, 0x7F, 0x51, 0x12, +0x32, 0x1E, 0xAD, 0x37, 0x7F, 0x52, 0x12, 0x32, 0x1E, 0xAD, 0x38, 0x7F, 0x53, 0x02, 0x32, 0x1E, +0x75, 0x3D, 0x10, 0xE4, 0xF5, 0x3E, 0x75, 0x3F, 0x07, 0x75, 0x40, 0x02, 0x90, 0x01, 0x30, 0xE5, +0x3D, 0xF0, 0xA3, 0xE5, 0x3E, 0xF0, 0xA3, 0xE5, 0x3F, 0xF0, 0xA3, 0xE5, 0x40, 0xF0, 0x22, 0x75, +0x45, 0x0E, 0x75, 0x46, 0x01, 0x43, 0x46, 0x10, 0x75, 0x47, 0x03, 0x75, 0x48, 0x62, 0x90, 0x01, +0x38, 0xE5, 0x45, 0xF0, 0xA3, 0xE5, 0x46, 0xF0, 0xA3, 0xE5, 0x47, 0xF0, 0xA3, 0xE5, 0x48, 0xF0, +0x22, 0x90, 0x01, 0x30, 0xE4, 0xF0, 0xA3, 0xF0, 0xA3, 0xF0, 0xA3, 0xF0, 0x90, 0x01, 0x38, 0xF0, +0xA3, 0xF0, 0xA3, 0xF0, 0xA3, 0xF0, 0xFD, 0x7F, 0x50, 0x12, 0x32, 0x1E, 0xE4, 0xFD, 0x7F, 0x51, +0x12, 0x32, 0x1E, 0xE4, 0xFD, 0x7F, 0x52, 0x12, 0x32, 0x1E, 0xE4, 0xFD, 0x7F, 0x53, 0x02, 0x32, +0x1E, 0x90, 0x01, 0x34, 0x74, 0xFF, 0xF0, 0xA3, 0xF0, 0xA3, 0xF0, 0xA3, 0xF0, 0x90, 0x01, 0x3C, +0xF0, 0xA3, 0xF0, 0xA3, 0xF0, 0xA3, 0xF0, 0xFD, 0x7F, 0x54, 0x12, 0x32, 0x1E, 0x7D, 0xFF, 0x7F, +0x55, 0x12, 0x32, 0x1E, 0x7D, 0xFF, 0x7F, 0x56, 0x12, 0x32, 0x1E, 0x7D, 0xFF, 0x7F, 0x57, 0x02, +0x32, 0x1E, 0x90, 0x00, 0x80, 0xE0, 0x44, 0x80, 0xFD, 0x7F, 0x80, 0x12, 0x32, 0x1E, 0x90, 0xFD, +0x00, 0xE0, 0x54, 0xBF, 0xF0, 0x12, 0x57, 0xE9, 0x51, 0x77, 0x12, 0x32, 0x77, 0x51, 0xC9, 0x51, +0x5E, 0x7F, 0x01, 0x12, 0x43, 0x15, 0x90, 0x81, 0x41, 0x74, 0x02, 0xF0, 0xFF, 0x12, 0x43, 0x15, +0x90, 0x81, 0x41, 0xE0, 0x04, 0xF0, 0x7F, 0x03, 0x12, 0x43, 0x15, 0x90, 0x81, 0x41, 0xE0, 0x04, +0xF0, 0x31, 0x01, 0x51, 0x3F, 0x90, 0x00, 0x80, 0xE0, 0x44, 0x40, 0xFD, 0x7F, 0x80, 0x12, 0x32, +0x1E, 0x75, 0x20, 0xFF, 0x51, 0x68, 0x51, 0xF9, 0x51, 0x7F, 0xE4, 0xFF, 0x02, 0x43, 0x9E, 0x51, +0x62, 0x51, 0x6F, 0x51, 0xA7, 0x71, 0x4F, 0x51, 0x8A, 0x51, 0x95, 0x90, 0x81, 0x45, 0xE0, 0x54, +0xFE, 0xF0, 0xA3, 0x74, 0x03, 0xF0, 0xA3, 0xF0, 0xE4, 0xA3, 0xF0, 0xA3, 0xF0, 0x22, 0xE4, 0xF5, +0x4D, 0x22, 0xE4, 0x90, 0x80, 0xDE, 0xF0, 0x22, 0x75, 0xE8, 0x03, 0x75, 0xA8, 0x84, 0x22, 0xE4, +0x90, 0x80, 0xD8, 0xF0, 0xA3, 0xF0, 0x22, 0x90, 0x01, 0x94, 0xE0, 0x44, 0x01, 0xF0, 0x22, 0x90, +0x01, 0xE4, 0x74, 0x0B, 0xF0, 0xA3, 0x74, 0x01, 0xF0, 0x22, 0x90, 0x81, 0x3F, 0xE0, 0x54, 0xFE, +0xF0, 0xE4, 0xA3, 0xF0, 0x22, 0x90, 0x81, 0x42, 0xE0, 0x54, 0xFE, 0xF0, 0x54, 0x7F, 0xF0, 0xA3, +0x74, 0x0A, 0xF0, 0xE4, 0xA3, 0xF0, 0x22, 0x90, 0x81, 0x1F, 0xE0, 0x54, 0xFE, 0xF0, 0x54, 0xFD, +0xF0, 0x54, 0xFB, 0xF0, 0x54, 0xF7, 0xF0, 0x54, 0xEF, 0xF0, 0x54, 0xDF, 0xF0, 0xE4, 0xA3, 0xF0, +0xA3, 0xF0, 0xA3, 0xF0, 0xA3, 0x74, 0x0C, 0xF0, 0x22, 0x90, 0x01, 0x01, 0xE0, 0x44, 0x04, 0xF0, +0x90, 0x01, 0x9C, 0x74, 0x7E, 0xF0, 0xA3, 0x74, 0x92, 0xF0, 0xA3, 0x74, 0xA0, 0xF0, 0xA3, 0x74, +0x24, 0xF0, 0x90, 0x01, 0x9B, 0x74, 0x49, 0xF0, 0x90, 0x01, 0x9A, 0x74, 0xE0, 0xF0, 0x90, 0x01, +0x99, 0xE4, 0xF0, 0x90, 0x01, 0x98, 0x04, 0xF0, 0x22, 0xE4, 0x90, 0x81, 0x51, 0xF0, 0xA3, 0xF0, +0x90, 0x01, 0x98, 0xE0, 0x7F, 0x00, 0x30, 0xE4, 0x02, 0x7F, 0x01, 0xEF, 0x64, 0x01, 0x60, 0x3E, +0xC3, 0x90, 0x81, 0x52, 0xE0, 0x94, 0x88, 0x90, 0x81, 0x51, 0xE0, 0x94, 0x13, 0x40, 0x08, 0x90, +0x01, 0xC1, 0xE0, 0x44, 0x10, 0xF0, 0x22, 0x90, 0x81, 0x51, 0xE4, 0x75, 0xF0, 0x01, 0x12, 0x44, +0xA9, 0x7F, 0x14, 0x7E, 0x00, 0x12, 0x32, 0xAA, 0xD3, 0x90, 0x81, 0x52, 0xE0, 0x94, 0x32, 0x90, +0x81, 0x51, 0xE0, 0x94, 0x00, 0x40, 0xB9, 0x90, 0x01, 0xC6, 0xE0, 0x30, 0xE3, 0xB2, 0x22, 0xE4, +0x90, 0x81, 0x27, 0xF0, 0xA3, 0xF0, 0x90, 0x81, 0x26, 0xE0, 0x54, 0x0F, 0xF0, 0x54, 0xF0, 0xF0, +0x90, 0x81, 0x24, 0xE0, 0x54, 0xFD, 0xF0, 0x54, 0xF7, 0xF0, 0x54, 0xEF, 0xF0, 0x90, 0x81, 0x2D, +0x74, 0x01, 0xF0, 0xA3, 0xF0, 0x90, 0x81, 0x24, 0xE0, 0x54, 0xFB, 0xF0, 0xA3, 0xE0, 0x54, 0xFB, +0xF0, 0xE4, 0x90, 0x81, 0x30, 0xF0, 0x90, 0x81, 0x2F, 0x74, 0x07, 0xF0, 0x90, 0x81, 0x32, 0xE4, +0xF0, 0xA3, 0x74, 0x02, 0xF0, 0xE4, 0x90, 0x81, 0x2B, 0xF0, 0x90, 0x81, 0x24, 0xE0, 0x54, 0xFE, +0xF0, 0x90, 0x81, 0x29, 0x74, 0x0C, 0xF0, 0x90, 0x81, 0x24, 0xE0, 0x54, 0xDF, 0xF0, 0x90, 0x81, +0x2A, 0x74, 0x0C, 0xF0, 0x90, 0x81, 0x24, 0xE0, 0x54, 0xBF, 0xF0, 0x54, 0x7F, 0xF0, 0xA3, 0xE0, +0x54, 0xFE, 0xF0, 0x54, 0xFD, 0xF0, 0x54, 0xF7, 0xF0, 0x90, 0x81, 0x34, 0x12, 0x20, 0xDA, 0x00, +0x00, 0x00, 0x00, 0x90, 0x80, 0x3C, 0xE0, 0xB4, 0x01, 0x08, 0x90, 0x81, 0x31, 0x74, 0x99, 0xF0, +0x80, 0x12, 0x90, 0x80, 0x3C, 0xE0, 0x90, 0x81, 0x31, 0xB4, 0x03, 0x05, 0x74, 0x90, 0xF0, 0x80, +0x03, 0x74, 0x40, 0xF0, 0x90, 0x81, 0x38, 0x74, 0x01, 0xF0, 0xA3, 0x74, 0x05, 0xF0, 0xA3, 0xE0, +0x54, 0x01, 0x44, 0x28, 0xF0, 0xA3, 0x74, 0x05, 0xF0, 0xE4, 0xA3, 0xF0, 0xA3, 0xE0, 0x54, 0xFD, +0xF0, 0x54, 0xFB, 0xF0, 0x54, 0xF7, 0xF0, 0x54, 0xEF, 0xF0, 0x54, 0xDF, 0xF0, 0x54, 0xBF, 0xF0, +0xE4, 0xA3, 0xF0, 0x22, 0xE4, 0x90, 0x81, 0x59, 0xF0, 0x90, 0x81, 0x59, 0xE0, 0x64, 0x01, 0xF0, +0x24, 0x24, 0x90, 0x01, 0xC4, 0xF0, 0x74, 0x5C, 0xA3, 0xF0, 0x90, 0x81, 0x2A, 0xE0, 0xFF, 0x90, +0x81, 0x29, 0xE0, 0x6F, 0x60, 0x03, 0x12, 0x47, 0x2A, 0xD1, 0x08, 0xBF, 0x01, 0x02, 0x91, 0x5F, +0xB1, 0xF2, 0x12, 0x32, 0x9E, 0xBF, 0x01, 0x02, 0xB1, 0x67, 0x12, 0x42, 0x4D, 0x80, 0xCA, 0xD3, +0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0x81, 0x24, 0xE0, 0x30, 0xE0, 0x24, 0x90, 0x81, 0x1F, +0xE0, 0xFF, 0x30, 0xE0, 0x1A, 0xC3, 0x13, 0x30, 0xE0, 0x07, 0xB1, 0xFB, 0xBF, 0x01, 0x12, 0x80, +0x0A, 0x90, 0x81, 0x23, 0xE0, 0xFF, 0x60, 0x03, 0xB4, 0x08, 0x06, 0x91, 0x96, 0x80, 0x02, 0x91, +0xA6, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0xB1, 0x22, 0x91, +0xBA, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x90, 0x81, 0x2A, 0xE0, 0x70, 0x0D, 0xD1, 0x2F, 0xBF, 0x01, +0x08, 0x91, 0x96, 0x90, 0x01, 0xE5, 0xE0, 0x04, 0xF0, 0x22, 0xB1, 0xF3, 0x90, 0x00, 0x08, 0xE0, +0x54, 0xEF, 0xFD, 0x7F, 0x08, 0x12, 0x32, 0x1E, 0xE4, 0xFF, 0x8F, 0x50, 0xE4, 0x90, 0x81, 0x5A, +0xF0, 0xA3, 0xF0, 0x90, 0x01, 0x09, 0xE0, 0x7F, 0x00, 0x30, 0xE7, 0x02, 0x7F, 0x01, 0xEF, 0x65, +0x50, 0x60, 0x3E, 0xC3, 0x90, 0x81, 0x5B, 0xE0, 0x94, 0x88, 0x90, 0x81, 0x5A, 0xE0, 0x94, 0x13, +0x40, 0x08, 0x90, 0x01, 0xC0, 0xE0, 0x44, 0x10, 0xF0, 0x22, 0x90, 0x81, 0x5A, 0xE4, 0x75, 0xF0, +0x01, 0x12, 0x44, 0xA9, 0x7F, 0x14, 0x7E, 0x00, 0x12, 0x32, 0xAA, 0xD3, 0x90, 0x81, 0x5B, 0xE0, +0x94, 0x32, 0x90, 0x81, 0x5A, 0xE0, 0x94, 0x00, 0x40, 0xB9, 0x90, 0x01, 0xC6, 0xE0, 0x30, 0xE0, +0xB2, 0x22, 0x90, 0x81, 0x31, 0xE0, 0xFD, 0x7F, 0x93, 0x12, 0x32, 0x1E, 0x90, 0x81, 0x28, 0xE0, +0x60, 0x12, 0x90, 0x01, 0x2F, 0xE0, 0x30, 0xE7, 0x05, 0x74, 0x10, 0xF0, 0x80, 0x06, 0x90, 0x01, +0x2F, 0x74, 0x90, 0xF0, 0x90, 0x00, 0x08, 0xE0, 0x44, 0x10, 0xFD, 0x7F, 0x08, 0x12, 0x32, 0x1E, +0x7F, 0x01, 0x91, 0xCA, 0x90, 0x00, 0x90, 0xE0, 0x44, 0x01, 0xFD, 0x7F, 0x90, 0x12, 0x32, 0x1E, +0x7F, 0x14, 0x7E, 0x00, 0x02, 0x32, 0xAA, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x12, 0x2D, +0xA7, 0xE4, 0xF5, 0x52, 0x12, 0x32, 0x9E, 0xEF, 0x60, 0x73, 0x63, 0x52, 0x01, 0xE5, 0x52, 0x24, +0x67, 0x90, 0x01, 0xC4, 0xF0, 0x74, 0x5D, 0xA3, 0xF0, 0x90, 0x00, 0x88, 0xE0, 0xF5, 0x50, 0xF5, +0x51, 0x54, 0x0F, 0x60, 0xDF, 0xE5, 0x50, 0x30, 0xE0, 0x0B, 0x20, 0xE4, 0x03, 0x12, 0x29, 0xC5, +0x53, 0x51, 0xEE, 0x80, 0x3F, 0xE5, 0x50, 0x30, 0xE1, 0x16, 0x20, 0xE5, 0x0E, 0x12, 0x11, 0xBD, +0xEF, 0x70, 0x03, 0x43, 0x51, 0x20, 0x90, 0x01, 0x06, 0xE4, 0xF0, 0x53, 0x51, 0xFD, 0x80, 0x24, +0xE5, 0x50, 0x30, 0xE2, 0x0B, 0x20, 0xE6, 0x03, 0x12, 0x67, 0x06, 0x53, 0x51, 0xFB, 0x80, 0x14, +0xE5, 0x50, 0x30, 0xE3, 0x0F, 0x20, 0xE7, 0x09, 0x12, 0x61, 0x6E, 0xEF, 0x70, 0x03, 0x43, 0x51, +0x80, 0x53, 0x51, 0xF7, 0xAD, 0x51, 0x7F, 0x88, 0x12, 0x32, 0x1E, 0x80, 0x87, 0xD0, 0xD0, 0x92, +0xAF, 0x22, 0x22, 0x90, 0x00, 0x90, 0xE0, 0x20, 0xE0, 0xF9, 0x22, 0x90, 0x81, 0x22, 0xE0, 0x64, +0x02, 0x7F, 0x01, 0x60, 0x02, 0x7F, 0x00, 0x22, 0x7F, 0x02, 0x90, 0x81, 0x41, 0xE0, 0xFE, 0xEF, +0xC3, 0x9E, 0x50, 0x18, 0xEF, 0x25, 0xE0, 0x24, 0x81, 0xF8, 0xE6, 0x30, 0xE4, 0x0B, 0x90, 0x01, +0xB8, 0x74, 0x08, 0xF0, 0xA3, 0xF0, 0x7F, 0x00, 0x22, 0x0F, 0x80, 0xDE, 0x7F, 0x01, 0x22, 0x90, +0x02, 0x87, 0xE0, 0x60, 0x08, 0x90, 0x01, 0xB8, 0x74, 0x01, 0xF0, 0x80, 0x17, 0x90, 0x02, 0x86, +0xE0, 0x20, 0xE1, 0x08, 0x90, 0x01, 0xB8, 0x74, 0x04, 0xF0, 0x80, 0x08, 0x90, 0x01, 0xB8, 0xE4, +0xF0, 0x7F, 0x01, 0x22, 0x90, 0x01, 0xB9, 0x74, 0x08, 0xF0, 0x7F, 0x00, 0x22, 0xE4, 0xFB, 0xFA, +0xFD, 0x7F, 0x01, 0x12, 0x44, 0x4E, 0x90, 0x81, 0xBD, 0xEF, 0xF0, 0x60, 0xF0, 0xD1, 0x71, 0x80, +0xEC, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0x01, 0xCC, 0xE0, 0x54, 0x0F, 0x90, 0x81, +0xBE, 0xF0, 0x90, 0x81, 0xBE, 0xE0, 0xFD, 0x70, 0x02, 0xE1, 0x9C, 0x90, 0x82, 0x09, 0xE0, 0xFF, +0x74, 0x01, 0x7E, 0x00, 0xA8, 0x07, 0x08, 0x80, 0x05, 0xC3, 0x33, 0xCE, 0x33, 0xCE, 0xD8, 0xF9, +0xFF, 0xEF, 0x5D, 0x70, 0x02, 0xE1, 0x95, 0x90, 0x82, 0x09, 0xE0, 0x75, 0xF0, 0x04, 0x90, 0x01, +0xD0, 0x12, 0x45, 0x0A, 0xE0, 0x90, 0x81, 0xBF, 0xF0, 0x75, 0x13, 0x01, 0x75, 0x14, 0x81, 0x75, +0x15, 0xBF, 0x75, 0x16, 0x01, 0x7B, 0x01, 0x7A, 0x81, 0x79, 0xC0, 0x12, 0x2B, 0xED, 0x90, 0x82, +0x09, 0xE0, 0x75, 0xF0, 0x04, 0x90, 0x01, 0xD1, 0x12, 0x45, 0x0A, 0xE0, 0x90, 0x81, 0xC1, 0xF0, +0x90, 0x82, 0x09, 0xE0, 0x75, 0xF0, 0x04, 0x90, 0x01, 0xD2, 0x12, 0x45, 0x0A, 0xE0, 0x90, 0x81, +0xC2, 0xF0, 0x90, 0x82, 0x09, 0xE0, 0x75, 0xF0, 0x04, 0x90, 0x01, 0xD3, 0x12, 0x45, 0x0A, 0xE0, +0x90, 0x81, 0xC3, 0xF0, 0x90, 0x82, 0x09, 0xE0, 0x75, 0xF0, 0x04, 0x90, 0x01, 0xF0, 0x12, 0x45, +0x0A, 0xE0, 0x90, 0x81, 0xC4, 0xF0, 0x90, 0x82, 0x09, 0xE0, 0x75, 0xF0, 0x04, 0x90, 0x01, 0xF1, +0x12, 0x45, 0x0A, 0xE0, 0x90, 0x81, 0xC5, 0xF0, 0x90, 0x82, 0x09, 0xE0, 0x75, 0xF0, 0x04, 0x90, +0x01, 0xF2, 0x12, 0x45, 0x0A, 0xE0, 0x90, 0x81, 0xC6, 0xF0, 0x90, 0x82, 0x09, 0xE0, 0x75, 0xF0, +0x04, 0x90, 0x01, 0xF3, 0x12, 0x45, 0x0A, 0xE0, 0x90, 0x81, 0xC7, 0xF0, 0x90, 0x81, 0xBE, 0xE0, +0xFF, 0x90, 0x82, 0x09, 0xE0, 0xFE, 0x74, 0x01, 0xA8, 0x06, 0x08, 0x80, 0x02, 0xC3, 0x33, 0xD8, +0xFC, 0xF4, 0x5F, 0x90, 0x81, 0xBE, 0xF0, 0x90, 0x82, 0x09, 0xE0, 0xFF, 0x74, 0x01, 0xA8, 0x07, +0x08, 0x80, 0x02, 0xC3, 0x33, 0xD8, 0xFC, 0x90, 0x01, 0xCC, 0xF0, 0x90, 0x81, 0xC0, 0xE0, 0xFF, +0x7B, 0x01, 0x7A, 0x81, 0x79, 0xC1, 0x12, 0x55, 0x3F, 0x90, 0x82, 0x09, 0xE0, 0x04, 0xF0, 0xE0, +0x54, 0x03, 0xF0, 0xC1, 0x82, 0x90, 0x01, 0xC0, 0xE0, 0x44, 0x02, 0xF0, 0xD0, 0xD0, 0x92, 0xAF, +0x22, 0xE4, 0xFB, 0xFA, 0xFD, 0x7F, 0x01, 0x12, 0x44, 0x4E, 0x90, 0x81, 0xD0, 0xEF, 0xF0, 0x60, +0xF0, 0x12, 0x6C, 0x19, 0x80, 0xEB, 0x90, 0x81, 0xD4, 0xEF, 0xF0, 0xA3, 0xED, 0xF0, 0xA3, 0x12, +0x20, 0xDA, 0x00, 0x00, 0x00, 0x00, 0xE4, 0x90, 0x81, 0xE2, 0xF0, 0x7F, 0x24, 0x7E, 0x08, 0x12, +0x2D, 0x5C, 0x90, 0x81, 0xDA, 0x12, 0x20, 0xCE, 0x90, 0x81, 0xD4, 0xE0, 0xFB, 0x70, 0x08, 0x90, +0x81, 0xDA, 0x12, 0x44, 0xD9, 0x80, 0x16, 0xEB, 0x75, 0xF0, 0x08, 0xA4, 0x24, 0x62, 0xF5, 0x82, +0xE4, 0x34, 0x87, 0xF5, 0x83, 0xE0, 0xFE, 0xA3, 0xE0, 0xFF, 0x12, 0x2D, 0x5C, 0x90, 0x81, 0xDE, +0x12, 0x20, 0xCE, 0x90, 0x81, 0xD5, 0xE0, 0xFF, 0xE4, 0xFC, 0xFD, 0xFE, 0x78, 0x17, 0x12, 0x20, +0xBB, 0xA8, 0x04, 0xA9, 0x05, 0xAA, 0x06, 0xAB, 0x07, 0x90, 0x81, 0xDE, 0x12, 0x44, 0xD9, 0xED, +0x54, 0x7F, 0xFD, 0xEC, 0x54, 0x80, 0xFC, 0x12, 0x44, 0xCC, 0xEC, 0x44, 0x80, 0xFC, 0x90, 0x81, +0xDE, 0x12, 0x20, 0xCE, 0x90, 0x81, 0xDA, 0x12, 0x44, 0xD9, 0xEC, 0x54, 0x7F, 0xFC, 0x90, 0x85, +0xBB, 0x12, 0x20, 0xCE, 0x7F, 0x24, 0x7E, 0x08, 0x12, 0x2E, 0xA2, 0x90, 0x81, 0xD4, 0xE0, 0x75, +0xF0, 0x08, 0xA4, 0x24, 0x62, 0xF5, 0x82, 0xE4, 0x34, 0x87, 0xF5, 0x83, 0xE0, 0xFE, 0xA3, 0xE0, +0xFF, 0xC0, 0x06, 0xC0, 0x07, 0x90, 0x81, 0xDE, 0x12, 0x44, 0xD9, 0x90, 0x85, 0xBB, 0x12, 0x20, +0xCE, 0xD0, 0x07, 0xD0, 0x06, 0x12, 0x2E, 0xA2, 0x90, 0x81, 0xDA, 0x12, 0x44, 0xD9, 0xEC, 0x44, +0x80, 0xFC, 0x90, 0x85, 0xBB, 0x12, 0x20, 0xCE, 0x7F, 0x24, 0x7E, 0x08, 0x12, 0x2E, 0xA2, 0x90, +0x81, 0xD4, 0xE0, 0x70, 0x04, 0x7F, 0x20, 0x80, 0x09, 0x90, 0x81, 0xD4, 0xE0, 0xB4, 0x01, 0x16, +0x7F, 0x28, 0x7E, 0x08, 0x12, 0x2D, 0x5C, 0x78, 0x08, 0x12, 0x20, 0xA8, 0xEF, 0x54, 0x01, 0xFF, +0xE4, 0x90, 0x81, 0xE2, 0xEF, 0xF0, 0x90, 0x81, 0xE2, 0xE0, 0x90, 0x81, 0xD4, 0x60, 0x0E, 0xE0, +0x75, 0xF0, 0x08, 0xA4, 0x24, 0x66, 0xF5, 0x82, 0xE4, 0x34, 0x87, 0x80, 0x0C, 0xE0, 0x75, 0xF0, +0x08, 0xA4, 0x24, 0x64, 0xF5, 0x82, 0xE4, 0x34, 0x87, 0xF5, 0x83, 0xE0, 0xFE, 0xA3, 0xE0, 0xFF, +0x12, 0x2D, 0x5C, 0xED, 0x54, 0x0F, 0xFD, 0xE4, 0xFC, 0x90, 0x81, 0xD6, 0x12, 0x20, 0xCE, 0x90, +0x81, 0xD6, 0x02, 0x44, 0xD9, 0x90, 0x81, 0xE3, 0xEF, 0xF0, 0xAB, 0x05, 0x90, 0x81, 0xE9, 0x12, +0x20, 0xDA, 0x00, 0x00, 0x00, 0x00, 0xAF, 0x03, 0xE4, 0xFC, 0xFD, 0xFE, 0x78, 0x14, 0x12, 0x20, +0xBB, 0xA8, 0x04, 0xA9, 0x05, 0xAA, 0x06, 0xAB, 0x07, 0x90, 0x81, 0xE5, 0x12, 0x44, 0xD9, 0xED, +0x54, 0x0F, 0xFD, 0xE4, 0xFC, 0x12, 0x44, 0xCC, 0xEC, 0x54, 0x0F, 0xFC, 0x90, 0x81, 0xE9, 0x12, +0x20, 0xCE, 0x90, 0x81, 0xE3, 0xE0, 0x75, 0xF0, 0x08, 0xA4, 0x24, 0x60, 0xF5, 0x82, 0xE4, 0x34, +0x87, 0xF5, 0x83, 0xE0, 0xFE, 0xA3, 0xE0, 0xFF, 0xC0, 0x06, 0xC0, 0x07, 0x90, 0x81, 0xE9, 0x12, +0x44, 0xD9, 0x90, 0x85, 0xBB, 0x12, 0x20, 0xCE, 0xD0, 0x07, 0xD0, 0x06, 0x02, 0x2E, 0xA2, 0xD3, +0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x12, 0x5F, 0xB6, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x78, 0x10, +0x74, 0x01, 0xF2, 0x90, 0x02, 0x09, 0xE0, 0x78, 0x00, 0xF2, 0x08, 0x74, 0x20, 0xF2, 0x18, 0xE2, +0xFF, 0x30, 0xE0, 0x05, 0x08, 0xE2, 0x24, 0x80, 0xF2, 0xEF, 0xC3, 0x13, 0x90, 0xFD, 0x10, 0xF0, +0x78, 0x01, 0xE2, 0x24, 0x00, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x78, 0x03, 0xF2, +0x64, 0x04, 0x60, 0x0D, 0xE2, 0xFF, 0x64, 0x08, 0x60, 0x07, 0xEF, 0x64, 0x0C, 0x60, 0x02, 0x61, +0xDE, 0xE4, 0x78, 0x02, 0xF2, 0x78, 0x03, 0xE2, 0xFF, 0x18, 0xE2, 0xC3, 0x9F, 0x50, 0x2D, 0xE2, +0xFD, 0x18, 0xE2, 0x2D, 0x90, 0x81, 0x5A, 0xF0, 0xE0, 0xFF, 0x24, 0x00, 0xF5, 0x82, 0xE4, 0x34, +0xFC, 0xF5, 0x83, 0xE0, 0xFE, 0x74, 0x04, 0x2D, 0xF8, 0xEE, 0xF2, 0xEF, 0xB4, 0xFF, 0x06, 0x90, +0xFD, 0x10, 0xE0, 0x04, 0xF0, 0x78, 0x02, 0xE2, 0x04, 0xF2, 0x80, 0xC9, 0x78, 0x04, 0xE2, 0x78, +0x12, 0xF2, 0xFF, 0x78, 0x05, 0xE2, 0x78, 0x11, 0xF2, 0x78, 0x06, 0xE2, 0x78, 0x13, 0xF2, 0x78, +0x07, 0xE2, 0x78, 0x14, 0xF2, 0x78, 0x08, 0xE2, 0x78, 0x33, 0xF2, 0x78, 0x09, 0xE2, 0x78, 0x34, +0xF2, 0x78, 0x0A, 0xE2, 0x78, 0x35, 0xF2, 0x78, 0x0B, 0xE2, 0x78, 0x36, 0xF2, 0x78, 0x0C, 0xE2, +0x78, 0x37, 0xF2, 0x78, 0x0D, 0xE2, 0x78, 0x38, 0xF2, 0x78, 0x0E, 0xE2, 0x78, 0x39, 0xF2, 0x78, +0x0F, 0xE2, 0x78, 0x3A, 0xF2, 0xE4, 0x78, 0x15, 0xF2, 0xEF, 0x24, 0xF8, 0x60, 0x75, 0x24, 0xFC, +0x60, 0x6C, 0x24, 0x08, 0x60, 0x02, 0x61, 0xC0, 0x78, 0x11, 0xE2, 0xB4, 0x01, 0x05, 0x12, 0x29, +0xC5, 0x61, 0xC5, 0x78, 0x11, 0xE2, 0xB4, 0x02, 0x05, 0x12, 0x11, 0xBD, 0x61, 0xC5, 0x78, 0x11, +0xE2, 0xB4, 0x03, 0x04, 0xF1, 0x06, 0x61, 0xC5, 0x78, 0x11, 0xE2, 0xB4, 0x10, 0x17, 0x78, 0x14, +0xE2, 0xFE, 0x18, 0xE2, 0xFD, 0xED, 0xFF, 0x78, 0x16, 0xEE, 0xF2, 0xFE, 0x08, 0xEF, 0xF2, 0xFF, +0x12, 0x32, 0xAA, 0x61, 0xC5, 0x78, 0x11, 0xE2, 0xB4, 0x11, 0x17, 0x78, 0x14, 0xE2, 0xFE, 0x18, +0xE2, 0xFD, 0xED, 0xFF, 0x78, 0x16, 0xEE, 0xF2, 0xFE, 0x08, 0xEF, 0xF2, 0xFF, 0x12, 0x32, 0x06, +0x61, 0xC5, 0x78, 0x11, 0xE2, 0xF4, 0x60, 0x02, 0x61, 0xC5, 0x18, 0xF2, 0x61, 0xC5, 0x78, 0x15, +0x74, 0x01, 0xF2, 0x78, 0x11, 0xE2, 0x64, 0x07, 0x60, 0x02, 0x61, 0xAA, 0x78, 0x34, 0xE2, 0xFF, +0xE4, 0xFC, 0xFD, 0xFE, 0x78, 0x08, 0x12, 0x20, 0xBB, 0xC0, 0x04, 0xA9, 0x05, 0xAA, 0x06, 0xAB, +0x07, 0x78, 0x33, 0xE2, 0xFF, 0xE4, 0xFC, 0xFD, 0xFE, 0xD0, 0x00, 0x12, 0x44, 0xCC, 0xC0, 0x04, +0xC0, 0x05, 0xC0, 0x06, 0xC0, 0x07, 0x78, 0x35, 0xE2, 0xFF, 0xE4, 0xFC, 0xFD, 0xFE, 0x78, 0x10, +0x12, 0x20, 0xBB, 0xD0, 0x03, 0xD0, 0x02, 0xD0, 0x01, 0xD0, 0x00, 0x12, 0x44, 0xCC, 0x78, 0x18, +0x12, 0x44, 0xFE, 0x78, 0x15, 0xE2, 0x70, 0x02, 0x61, 0x93, 0x18, 0xE2, 0xFF, 0x18, 0xE2, 0xFD, +0x31, 0x5F, 0x78, 0x1C, 0x12, 0x44, 0xFE, 0x78, 0x38, 0xE2, 0xFF, 0xE4, 0xFC, 0xFD, 0xFE, 0x78, +0x08, 0x12, 0x20, 0xBB, 0xC0, 0x04, 0xA9, 0x05, 0xAA, 0x06, 0xAB, 0x07, 0x78, 0x37, 0xE2, 0xFF, +0xE4, 0xFC, 0xFD, 0xFE, 0xD0, 0x00, 0x12, 0x44, 0xCC, 0xC0, 0x04, 0xC0, 0x05, 0xC0, 0x06, 0xC0, +0x07, 0x78, 0x39, 0xE2, 0xFF, 0xE4, 0xFC, 0xFD, 0xFE, 0x78, 0x10, 0x12, 0x20, 0xBB, 0xD0, 0x03, +0xD0, 0x02, 0xD0, 0x01, 0xD0, 0x00, 0x12, 0x44, 0xCC, 0x78, 0x20, 0x12, 0x44, 0xFE, 0x78, 0x20, +0x12, 0x44, 0xE5, 0x12, 0x20, 0x9B, 0x78, 0x1C, 0x12, 0x44, 0xF1, 0x12, 0x44, 0xBF, 0xC0, 0x04, +0xC0, 0x05, 0xC0, 0x06, 0xC0, 0x07, 0x78, 0x18, 0x12, 0x44, 0xE5, 0x78, 0x20, 0x12, 0x44, 0xF1, +0x12, 0x44, 0xBF, 0xD0, 0x03, 0xD0, 0x02, 0xD0, 0x01, 0xD0, 0x00, 0x12, 0x44, 0xCC, 0x78, 0x18, +0x12, 0x44, 0xFE, 0x78, 0x18, 0x12, 0x44, 0xE5, 0x90, 0x81, 0xF9, 0x12, 0x20, 0xCE, 0x78, 0x13, +0xE2, 0xFD, 0x08, 0xE2, 0xFF, 0x12, 0x55, 0x1C, 0x80, 0x1B, 0x78, 0x13, 0xE2, 0xFF, 0x08, 0xE2, +0xFD, 0x78, 0x11, 0xE2, 0xFB, 0x78, 0x15, 0xE2, 0x90, 0x81, 0xBC, 0xF0, 0x71, 0xE1, 0x80, 0x05, +0x78, 0x10, 0x74, 0x02, 0xF2, 0x78, 0x10, 0xE2, 0xFF, 0xC3, 0x94, 0x02, 0x50, 0x10, 0xEF, 0x60, +0x0A, 0x78, 0x02, 0xE2, 0xFF, 0x18, 0xE2, 0x2F, 0xF2, 0x21, 0x90, 0x7F, 0x01, 0x22, 0x7F, 0x00, +0x22, 0xAC, 0x07, 0xED, 0xAD, 0x04, 0x78, 0x24, 0xF2, 0xED, 0x08, 0xF2, 0xEB, 0xB4, 0x04, 0x07, +0x78, 0x27, 0x74, 0x01, 0xF2, 0x80, 0x0E, 0xEB, 0x78, 0x27, 0xB4, 0x05, 0x05, 0x74, 0x02, 0xF2, +0x80, 0x03, 0x74, 0x04, 0xF2, 0xD3, 0x78, 0x25, 0xE2, 0x94, 0xFF, 0x18, 0xE2, 0x94, 0x00, 0x50, +0x63, 0xE4, 0x78, 0x26, 0xF2, 0x78, 0x27, 0xE2, 0xFF, 0x18, 0xE2, 0xFE, 0xC3, 0x9F, 0x40, 0x02, +0xA1, 0x7F, 0x74, 0x33, 0x2E, 0xF8, 0xE2, 0x78, 0x28, 0xF2, 0x90, 0x81, 0xBC, 0xE0, 0x60, 0x2D, +0x74, 0x37, 0x2E, 0xF8, 0xE2, 0x78, 0x32, 0xF2, 0xEE, 0xFF, 0x78, 0x25, 0xE2, 0x2F, 0xFF, 0x18, +0xE2, 0x34, 0x00, 0x8F, 0x82, 0xF5, 0x83, 0xE0, 0x78, 0x29, 0xF2, 0x78, 0x32, 0xE2, 0xFF, 0xF4, +0xFE, 0x78, 0x29, 0xE2, 0x5E, 0xFE, 0x18, 0xE2, 0xFD, 0xEF, 0x5D, 0x4E, 0xF2, 0x78, 0x24, 0x08, +0xE2, 0xFF, 0x08, 0xE2, 0x2F, 0xFF, 0x78, 0x28, 0xE2, 0xFD, 0x12, 0x32, 0x1E, 0x78, 0x26, 0xE2, +0x04, 0xF2, 0x80, 0xA1, 0xD3, 0x78, 0x25, 0xE2, 0x94, 0xFF, 0x18, 0xE2, 0x94, 0x07, 0x50, 0x69, +0xE4, 0x78, 0x26, 0xF2, 0x78, 0x27, 0xE2, 0xFF, 0x18, 0xE2, 0xFE, 0xC3, 0x9F, 0x40, 0x02, 0xA1, +0x7F, 0x74, 0x33, 0x2E, 0xF8, 0xE2, 0x78, 0x28, 0xF2, 0x90, 0x81, 0xBC, 0xE0, 0x60, 0x2D, 0x78, +0x26, 0xE2, 0xFF, 0xFD, 0x18, 0xE2, 0x2D, 0xFD, 0x18, 0xE2, 0x34, 0x00, 0x8D, 0x82, 0xF5, 0x83, +0xE0, 0x78, 0x29, 0xF2, 0x74, 0x37, 0x2F, 0xF8, 0xE2, 0x78, 0x32, 0xF2, 0xE2, 0xFF, 0xF4, 0xFE, +0x78, 0x29, 0xE2, 0x5E, 0xFE, 0x18, 0xE2, 0xFD, 0xEF, 0x5D, 0x4E, 0xF2, 0x78, 0x28, 0xE2, 0xFF, +0x78, 0x26, 0xE2, 0xFD, 0x18, 0xE2, 0x2D, 0xFD, 0x18, 0xE2, 0x34, 0x00, 0x8D, 0x82, 0xF5, 0x83, +0xEF, 0xF0, 0x78, 0x26, 0xE2, 0x04, 0xF2, 0x80, 0x9B, 0x90, 0x81, 0xBC, 0xE0, 0x60, 0x0F, 0x78, +0x24, 0xE2, 0xFE, 0x08, 0xE2, 0xFF, 0x12, 0x2D, 0x5C, 0x78, 0x2E, 0x12, 0x44, 0xFE, 0xE4, 0x78, +0x26, 0xF2, 0x78, 0x27, 0xE2, 0xFF, 0x18, 0xE2, 0xFE, 0xC3, 0x9F, 0x50, 0x5D, 0x74, 0x33, 0x2E, +0xF8, 0xE2, 0x78, 0x28, 0xF2, 0x90, 0x81, 0xBC, 0xE0, 0x60, 0x2B, 0x78, 0x2E, 0x12, 0x44, 0xE5, +0x78, 0x26, 0xE2, 0xFB, 0x75, 0xF0, 0x08, 0xA4, 0xF9, 0xF8, 0x12, 0x20, 0xA8, 0x78, 0x29, 0xEF, +0xF2, 0x74, 0x37, 0x2B, 0xF8, 0xE2, 0x78, 0x32, 0xF2, 0xE2, 0xFE, 0xF4, 0x5F, 0xFF, 0x78, 0x28, +0xE2, 0xFD, 0xEE, 0x5D, 0x4F, 0xF2, 0x78, 0x28, 0xE2, 0xFF, 0x78, 0x26, 0xE2, 0xFD, 0xC3, 0x74, +0x03, 0x9D, 0xFD, 0xE4, 0x94, 0x00, 0xFC, 0x7B, 0xFE, 0x74, 0x2A, 0x2D, 0xF9, 0x74, 0x80, 0x3C, +0xFA, 0xEF, 0x12, 0x1F, 0xEA, 0xE2, 0x04, 0xF2, 0x80, 0x98, 0x78, 0x2A, 0x12, 0x44, 0xE5, 0x90, +0x85, 0xBB, 0x12, 0x20, 0xCE, 0x78, 0x24, 0xE2, 0xFE, 0x08, 0xE2, 0xFF, 0x12, 0x2E, 0xA2, 0x22, +0x22, 0x90, 0x81, 0xCB, 0x12, 0x45, 0x1F, 0x90, 0x00, 0x01, 0x12, 0x1F, 0xBD, 0xFF, 0xFE, 0x12, +0x1F, 0xA4, 0xFD, 0xC3, 0x13, 0x30, 0xE0, 0x12, 0x90, 0x81, 0xCB, 0x12, 0x45, 0x16, 0x90, 0x00, +0x02, 0x12, 0x1F, 0xBD, 0x90, 0x81, 0xCF, 0xF0, 0x80, 0x05, 0x90, 0x81, 0xCF, 0xEF, 0xF0, 0x90, +0x81, 0xCE, 0xEE, 0xF0, 0x90, 0x81, 0xCF, 0xE0, 0xFE, 0x90, 0x81, 0xCE, 0xE0, 0xFF, 0xD3, 0x9E, +0x50, 0x38, 0x90, 0x81, 0xCB, 0x12, 0x45, 0x16, 0x12, 0x1F, 0xA4, 0x54, 0x01, 0xFE, 0x74, 0xDE, +0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x80, 0xF5, 0x83, 0xEE, 0xF0, 0x74, 0xDE, 0x2F, 0xF5, 0x82, 0xE4, +0x34, 0x80, 0xF5, 0x83, 0xE0, 0x70, 0x04, 0xD1, 0x25, 0x80, 0x07, 0x90, 0x81, 0xCE, 0xE0, 0xFF, +0xB1, 0x80, 0x90, 0x81, 0xCE, 0xE0, 0x04, 0xF0, 0x80, 0xBA, 0x90, 0x80, 0xDE, 0xE0, 0x70, 0x24, +0x90, 0x81, 0x2A, 0xE0, 0x70, 0x04, 0xFF, 0x12, 0x49, 0x93, 0x90, 0x81, 0x2A, 0xE0, 0x64, 0x0C, +0x60, 0x02, 0xD1, 0x26, 0x90, 0x81, 0x24, 0xE0, 0x54, 0xF7, 0xF0, 0x54, 0xEF, 0xF0, 0x54, 0xBF, +0xF0, 0x54, 0x7F, 0xF0, 0x22, 0x22, 0x90, 0x06, 0x04, 0xE0, 0x54, 0x7F, 0xF0, 0x90, 0x05, 0x22, +0xE4, 0xF0, 0x90, 0x81, 0x2A, 0x74, 0x0C, 0xF0, 0x22, 0x90, 0x81, 0xED, 0xEF, 0xF0, 0xA3, 0xED, +0xF0, 0xAD, 0x03, 0xAC, 0x02, 0xE4, 0x90, 0x81, 0xF5, 0xF0, 0xA3, 0xF0, 0x90, 0x01, 0xC4, 0x74, +0x39, 0xF0, 0x74, 0x66, 0xA3, 0xF0, 0xEC, 0x54, 0x3F, 0xFC, 0x90, 0x01, 0x40, 0xED, 0xF0, 0xAE, +0x04, 0xEE, 0xA3, 0xF0, 0x90, 0x81, 0xED, 0xE0, 0x24, 0x81, 0x60, 0x34, 0x24, 0xDA, 0x60, 0x1C, +0x24, 0x3C, 0x70, 0x41, 0x90, 0x81, 0xEE, 0xE0, 0xC4, 0x33, 0x33, 0x33, 0x54, 0x80, 0x90, 0x81, +0xF2, 0xF0, 0xA3, 0x74, 0x69, 0xF0, 0xA3, 0x74, 0x80, 0xF0, 0x80, 0x2C, 0x90, 0x81, 0xEE, 0xE0, +0x54, 0x01, 0x90, 0x81, 0xF2, 0xF0, 0xA3, 0x74, 0xA5, 0xF0, 0xA3, 0x74, 0x01, 0xF0, 0x80, 0x18, +0x90, 0x81, 0xEE, 0xE0, 0xC4, 0x54, 0x10, 0x90, 0x81, 0xF2, 0xF0, 0xA3, 0x74, 0x7F, 0xF0, 0xA3, +0x74, 0x10, 0xF0, 0x80, 0x03, 0x7F, 0x00, 0x22, 0x90, 0x81, 0xF3, 0xE0, 0x90, 0x01, 0x06, 0xF0, +0x90, 0x81, 0xF2, 0xE0, 0x60, 0x0E, 0x90, 0x01, 0x42, 0xF0, 0x90, 0x81, 0xF1, 0xE0, 0x90, 0x01, +0x43, 0xF0, 0x80, 0x0D, 0x90, 0x01, 0x43, 0xE4, 0xF0, 0x90, 0x81, 0xF2, 0xE0, 0x90, 0x01, 0x42, +0xF0, 0x90, 0x81, 0xF4, 0xE0, 0xFF, 0x90, 0x01, 0x42, 0xE0, 0x5F, 0xFF, 0x90, 0x81, 0xF2, 0xE0, +0x6F, 0x60, 0xEE, 0x74, 0x39, 0x04, 0x90, 0x01, 0xC4, 0xF0, 0x74, 0x66, 0xA3, 0xF0, 0x90, 0x01, +0x43, 0xE4, 0xF0, 0x7F, 0x01, 0x22, 0xE4, 0x90, 0x81, 0x6A, 0xF0, 0x90, 0x87, 0x5F, 0xE0, 0x90, +0x81, 0x69, 0xF0, 0xE4, 0x90, 0x81, 0x76, 0xF0, 0x90, 0x81, 0x66, 0xF0, 0x90, 0x81, 0x66, 0xE0, +0xFF, 0xC3, 0x94, 0x40, 0x50, 0x15, 0x74, 0x79, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x81, 0xF5, 0x83, +0x74, 0xFF, 0xF0, 0x90, 0x81, 0x66, 0xE0, 0x04, 0xF0, 0x80, 0xE1, 0xE4, 0x90, 0x81, 0x66, 0xF0, +0x90, 0x81, 0x69, 0xE0, 0xFF, 0x90, 0x81, 0x66, 0xE0, 0xFE, 0xC3, 0x9F, 0x40, 0x03, 0x02, 0x68, +0x12, 0x74, 0xDF, 0x2E, 0xF9, 0xE4, 0x34, 0x86, 0x75, 0x13, 0x01, 0xF5, 0x14, 0x89, 0x15, 0x75, +0x16, 0x0A, 0x7B, 0x01, 0x7A, 0x81, 0x79, 0x5B, 0x12, 0x2B, 0xED, 0x90, 0x81, 0x5C, 0xE0, 0xFF, +0x12, 0x2F, 0x27, 0xEF, 0x04, 0x90, 0x81, 0x76, 0xF0, 0x90, 0x81, 0x5B, 0xE0, 0xFF, 0xA3, 0xE0, +0xFD, 0x12, 0x31, 0xEA, 0xEF, 0x24, 0xC8, 0x90, 0x81, 0x78, 0xF0, 0x75, 0xF0, 0x08, 0xA4, 0xF0, +0x90, 0x81, 0x5C, 0xE0, 0x54, 0x0F, 0x90, 0x81, 0x77, 0xF0, 0xE4, 0x90, 0x81, 0x65, 0xF0, 0x90, +0x81, 0x67, 0xF0, 0x90, 0x81, 0x67, 0xE0, 0xFF, 0xC3, 0x94, 0x04, 0x50, 0x57, 0x90, 0x81, 0x77, +0xE0, 0xFE, 0xA8, 0x07, 0x08, 0x80, 0x02, 0xC3, 0x13, 0xD8, 0xFC, 0x20, 0xE0, 0x3E, 0x90, 0x81, +0x67, 0xE0, 0x25, 0xE0, 0xFF, 0x90, 0x81, 0x78, 0xE0, 0x2F, 0x24, 0x79, 0xF9, 0xE4, 0x34, 0x81, +0xFA, 0x7B, 0x01, 0xC0, 0x03, 0xC0, 0x01, 0x90, 0x81, 0x65, 0xE0, 0x75, 0xF0, 0x02, 0xA4, 0x24, +0x5D, 0xF9, 0x74, 0x81, 0x35, 0xF0, 0x8B, 0x13, 0xF5, 0x14, 0x89, 0x15, 0x75, 0x16, 0x02, 0xD0, +0x01, 0xD0, 0x03, 0x12, 0x2B, 0xED, 0x90, 0x81, 0x65, 0xE0, 0x04, 0xF0, 0x90, 0x81, 0x67, 0xE0, +0x04, 0xF0, 0x80, 0x9F, 0x90, 0x81, 0x76, 0xE0, 0xFF, 0x90, 0x81, 0x66, 0xE0, 0x2F, 0xF0, 0x02, +0x67, 0x40, 0xE4, 0x90, 0x81, 0x6A, 0xF0, 0x90, 0x81, 0x6A, 0xE0, 0xC3, 0x94, 0x40, 0x40, 0x02, +0x41, 0xAF, 0xE0, 0xFF, 0x24, 0x79, 0xF5, 0x82, 0xE4, 0x34, 0x81, 0xF5, 0x83, 0xE0, 0x90, 0x81, +0x6C, 0xF0, 0xE0, 0xFE, 0x54, 0xF0, 0xC4, 0x54, 0x0F, 0xFD, 0x90, 0x81, 0x6B, 0xF0, 0xEE, 0x54, +0x0F, 0xFE, 0xA3, 0xF0, 0x74, 0x7A, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x81, 0xF5, 0x83, 0xE0, 0x90, +0x81, 0x6D, 0xF0, 0xFC, 0xEE, 0xFE, 0xEC, 0xFB, 0xEB, 0xFF, 0x90, 0x81, 0x72, 0xEE, 0xF0, 0xA3, +0xEF, 0xF0, 0xED, 0x12, 0x45, 0x28, 0x68, 0x8B, 0x00, 0x68, 0xC2, 0x01, 0x69, 0x73, 0x02, 0x6A, +0xA0, 0x03, 0x69, 0x8E, 0x04, 0x69, 0xAF, 0x05, 0x69, 0xAF, 0x06, 0x69, 0xAF, 0x07, 0x69, 0xAF, +0x08, 0x6A, 0x33, 0x09, 0x6A, 0x69, 0x0A, 0x00, 0x00, 0x6A, 0xAF, 0x90, 0x81, 0x6A, 0xE0, 0xFD, +0x24, 0x7C, 0xF5, 0x82, 0xE4, 0x34, 0x81, 0xF5, 0x83, 0xE0, 0xFE, 0x74, 0x7B, 0x2D, 0xF5, 0x82, +0xE4, 0x34, 0x81, 0xF5, 0x83, 0xE0, 0xFD, 0xED, 0xFF, 0x90, 0x81, 0x74, 0xEE, 0xF0, 0xFC, 0xA3, +0xEF, 0xF0, 0x90, 0x81, 0x6D, 0xE0, 0xFF, 0x12, 0x2F, 0x96, 0x90, 0x81, 0x68, 0x74, 0x02, 0xF0, +0x41, 0xA0, 0x90, 0x81, 0x6A, 0xE0, 0x24, 0x7C, 0xF5, 0x82, 0xE4, 0x34, 0x81, 0xF5, 0x83, 0xE0, +0xFF, 0xE4, 0xFC, 0xFD, 0xFE, 0x78, 0x08, 0x12, 0x20, 0xBB, 0xA8, 0x04, 0xA9, 0x05, 0xAA, 0x06, +0xAB, 0x07, 0x90, 0x81, 0x6A, 0xE0, 0x24, 0x7B, 0xF5, 0x82, 0xE4, 0x34, 0x81, 0xF5, 0x83, 0xE0, +0xFF, 0xE4, 0xFC, 0xFD, 0xFE, 0x12, 0x44, 0xCC, 0xC0, 0x04, 0xC0, 0x05, 0xC0, 0x06, 0xC0, 0x07, +0x90, 0x81, 0x6A, 0xE0, 0x24, 0x7D, 0xF5, 0x82, 0xE4, 0x34, 0x81, 0xF5, 0x83, 0xE0, 0xFF, 0xE4, +0xFC, 0xFD, 0xFE, 0x78, 0x10, 0x12, 0x20, 0xBB, 0xD0, 0x03, 0xD0, 0x02, 0xD0, 0x01, 0xD0, 0x00, +0x12, 0x44, 0xCC, 0xC0, 0x04, 0xC0, 0x05, 0xC0, 0x06, 0xC0, 0x07, 0x90, 0x81, 0x6A, 0xE0, 0x24, +0x7E, 0xF5, 0x82, 0xE4, 0x34, 0x81, 0xF5, 0x83, 0xE0, 0xFF, 0xE4, 0xFC, 0xFD, 0xFE, 0x78, 0x18, +0x12, 0x20, 0xBB, 0xD0, 0x03, 0xD0, 0x02, 0xD0, 0x01, 0xD0, 0x00, 0x12, 0x44, 0xCC, 0x90, 0x81, +0x6E, 0x12, 0x20, 0xCE, 0x90, 0x81, 0x6E, 0x12, 0x44, 0xD9, 0x90, 0x85, 0x96, 0x12, 0x20, 0xCE, +0x90, 0x81, 0x72, 0xE0, 0xFE, 0xA3, 0xE0, 0xFF, 0x12, 0x2E, 0xE4, 0x90, 0x81, 0x68, 0x74, 0x04, +0xF0, 0x41, 0xA0, 0x90, 0x81, 0x6D, 0xE0, 0xFD, 0x90, 0x81, 0x6A, 0xE0, 0x24, 0x7B, 0xF5, 0x82, +0xE4, 0x34, 0x81, 0xF5, 0x83, 0xE0, 0xFB, 0xE4, 0xFF, 0x12, 0x30, 0xC7, 0x80, 0x19, 0x90, 0x81, +0x6D, 0xE0, 0xFD, 0x90, 0x81, 0x6A, 0xE0, 0x24, 0x7B, 0xF5, 0x82, 0xE4, 0x34, 0x81, 0xF5, 0x83, +0xE0, 0xFB, 0xE4, 0xFF, 0x12, 0x30, 0x6A, 0x90, 0x81, 0x68, 0x74, 0x01, 0xF0, 0x41, 0xA0, 0x90, +0x81, 0x68, 0x74, 0x02, 0xF0, 0x90, 0x81, 0x6A, 0xE0, 0x24, 0x7C, 0xF5, 0x82, 0xE4, 0x34, 0x81, +0xF5, 0x83, 0xE0, 0xFF, 0xE4, 0xFC, 0xFD, 0xFE, 0x78, 0x08, 0x12, 0x20, 0xBB, 0xA8, 0x04, 0xA9, +0x05, 0xAA, 0x06, 0xAB, 0x07, 0x90, 0x81, 0x6A, 0xE0, 0x24, 0x7B, 0xF5, 0x82, 0xE4, 0x34, 0x81, +0xF5, 0x83, 0xE0, 0xFF, 0xE4, 0xFC, 0xFD, 0xFE, 0x12, 0x44, 0xCC, 0xC0, 0x04, 0xC0, 0x05, 0xC0, +0x06, 0xC0, 0x07, 0x90, 0x81, 0x6C, 0xE0, 0xFF, 0xE4, 0xFC, 0xFD, 0xFE, 0x78, 0x10, 0x12, 0x20, +0xBB, 0xD0, 0x03, 0xD0, 0x02, 0xD0, 0x01, 0xD0, 0x00, 0x12, 0x44, 0xCC, 0x90, 0x81, 0x6E, 0x12, +0x20, 0xCE, 0x90, 0x81, 0x6B, 0xE0, 0x24, 0xFB, 0xFF, 0xC0, 0x07, 0x90, 0x81, 0x6E, 0x12, 0x44, +0xD9, 0x90, 0x81, 0xF9, 0x12, 0x20, 0xCE, 0x90, 0x81, 0x6D, 0xE0, 0xFD, 0xD0, 0x07, 0x12, 0x55, +0x1C, 0x80, 0x6D, 0x90, 0x81, 0x68, 0x74, 0x01, 0xF0, 0x90, 0x81, 0x6A, 0xE0, 0x24, 0x7B, 0xF9, +0xE4, 0x34, 0x81, 0x75, 0x13, 0x01, 0xF5, 0x14, 0x89, 0x15, 0x75, 0x16, 0x01, 0x7B, 0xFE, 0x7A, +0x80, 0x79, 0x33, 0x12, 0x2B, 0xED, 0x90, 0x81, 0x6D, 0xE0, 0xFF, 0x90, 0x81, 0x6C, 0xE0, 0xFD, +0xE4, 0x90, 0x81, 0xBC, 0xF0, 0x7B, 0x04, 0x80, 0x34, 0x90, 0x81, 0x68, 0x74, 0x04, 0xF0, 0x90, +0x81, 0x6A, 0xE0, 0x24, 0x7B, 0xF9, 0xE4, 0x34, 0x81, 0x75, 0x13, 0x01, 0xF5, 0x14, 0x89, 0x15, +0x75, 0x16, 0x04, 0x7B, 0xFE, 0x7A, 0x80, 0x79, 0x33, 0x12, 0x2B, 0xED, 0x90, 0x81, 0x6D, 0xE0, +0xFF, 0x90, 0x81, 0x6C, 0xE0, 0xFD, 0xE4, 0x90, 0x81, 0xBC, 0xF0, 0x7B, 0x06, 0x12, 0x63, 0xE1, +0x90, 0x81, 0x68, 0xE0, 0x24, 0x02, 0xFF, 0x90, 0x81, 0x6A, 0xE0, 0x2F, 0xF0, 0x01, 0x17, 0x22, +0x90, 0x02, 0x09, 0xE0, 0xFD, 0x12, 0x1F, 0xA4, 0xFE, 0xAF, 0x05, 0xED, 0x2E, 0x90, 0x80, 0x3D, +0xF0, 0x90, 0x00, 0x01, 0x12, 0x1F, 0xBD, 0xFF, 0xED, 0x2F, 0x90, 0x80, 0x3E, 0xF0, 0x90, 0x00, +0x02, 0x12, 0x1F, 0xBD, 0xFF, 0xED, 0x2F, 0x90, 0x80, 0x3F, 0xF0, 0x90, 0x00, 0x03, 0x12, 0x1F, +0xBD, 0xFF, 0xED, 0x2F, 0x90, 0x80, 0x40, 0xF0, 0x90, 0x00, 0x04, 0x12, 0x1F, 0xBD, 0xFF, 0xAE, +0x05, 0xED, 0x2F, 0x90, 0x80, 0x41, 0xF0, 0x22, 0x90, 0x00, 0x02, 0x12, 0x1F, 0xBD, 0xFF, 0x30, +0xE0, 0x26, 0x12, 0x1F, 0xA4, 0x90, 0x81, 0x38, 0xF0, 0x90, 0x00, 0x01, 0x12, 0x1F, 0xBD, 0x90, +0x81, 0x39, 0xF0, 0xEF, 0x54, 0xFE, 0xFF, 0xA3, 0xE0, 0x54, 0x01, 0x4F, 0xF0, 0x90, 0x00, 0x03, +0x12, 0x1F, 0xBD, 0x90, 0x81, 0x3B, 0xF0, 0x22, 0x90, 0x81, 0x38, 0x74, 0x01, 0xF0, 0xA3, 0x74, +0x05, 0xF0, 0xA3, 0xE0, 0x54, 0x01, 0x44, 0x28, 0xF0, 0xA3, 0x74, 0x05, 0xF0, 0x22, 0x12, 0x1F, +0xA4, 0x90, 0x81, 0x3E, 0xF0, 0x90, 0x81, 0x3E, 0xE0, 0x90, 0x01, 0xE7, 0xF0, 0x22, 0x12, 0x1F, +0xA4, 0x90, 0x81, 0x4A, 0xF0, 0x90, 0x00, 0x01, 0x12, 0x1F, 0xBD, 0x90, 0x81, 0x4B, 0xF0, 0x22, +0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0x81, 0xFD, 0xEE, 0xF0, 0xA3, 0xEF, 0xF0, 0xE4, +0xA3, 0xF0, 0xA3, 0xF0, 0x90, 0x81, 0xFD, 0xE0, 0xFE, 0xA3, 0xE0, 0xF5, 0x82, 0x8E, 0x83, 0xE0, +0x60, 0x2D, 0xC3, 0x90, 0x82, 0x00, 0xE0, 0x94, 0xE8, 0x90, 0x81, 0xFF, 0xE0, 0x94, 0x03, 0x40, +0x0B, 0x90, 0x01, 0xC0, 0xE0, 0x44, 0x80, 0xF0, 0x7F, 0x00, 0x80, 0x15, 0x90, 0x81, 0xFF, 0xE4, +0x75, 0xF0, 0x01, 0x12, 0x44, 0xA9, 0x7F, 0x0A, 0x7E, 0x00, 0x12, 0x32, 0xAA, 0x80, 0xC5, 0x7F, +0x01, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0x81, 0xD1, +0x12, 0x45, 0x1F, 0x90, 0x82, 0x0A, 0xE0, 0xFF, 0x04, 0xF0, 0x90, 0x00, 0x01, 0xEF, 0x12, 0x1F, +0xFC, 0x7F, 0xAF, 0x7E, 0x01, 0x71, 0x60, 0xEF, 0x60, 0x3A, 0x90, 0x81, 0xD1, 0x12, 0x45, 0x16, +0x8B, 0x13, 0x8A, 0x14, 0x89, 0x15, 0x90, 0x00, 0x0E, 0x12, 0x1F, 0xBD, 0x24, 0x02, 0xF5, 0x16, +0x7B, 0x01, 0x7A, 0x01, 0x79, 0xA0, 0x12, 0x2B, 0xED, 0x90, 0x81, 0xD1, 0x12, 0x45, 0x16, 0x90, +0x00, 0x0E, 0x12, 0x1F, 0xBD, 0x90, 0x01, 0xAE, 0xF0, 0xA3, 0x74, 0xFF, 0xF0, 0x90, 0x01, 0xCB, +0xE0, 0x64, 0x80, 0xF0, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, +0xE4, 0xFF, 0x90, 0x80, 0xD9, 0xE0, 0xFE, 0x90, 0x80, 0xD8, 0xE0, 0xFD, 0xB5, 0x06, 0x04, 0x7E, +0x01, 0x80, 0x02, 0x7E, 0x00, 0xEE, 0x64, 0x01, 0x60, 0x32, 0x90, 0x01, 0xAF, 0xE0, 0x70, 0x13, +0xED, 0x75, 0xF0, 0x0F, 0xA4, 0x24, 0x42, 0xF9, 0x74, 0x80, 0x35, 0xF0, 0xFA, 0x7B, 0x01, 0x71, +0xB6, 0x7F, 0x01, 0xEF, 0x60, 0x16, 0x90, 0x80, 0xD8, 0xE0, 0x04, 0xF0, 0xE0, 0x7F, 0x00, 0xB4, +0x0A, 0x02, 0x7F, 0x01, 0xEF, 0x60, 0x05, 0xE4, 0x90, 0x80, 0xD8, 0xF0, 0xD0, 0xD0, 0x92, 0xAF, +0x22, 0x8F, 0x0D, 0x22, 0x8F, 0x0E, 0x22, 0x22, 0x90, 0x01, 0x34, 0xE0, 0x55, 0x3D, 0xF5, 0x41, +0xA3, 0xE0, 0x55, 0x3E, 0xF5, 0x42, 0xA3, 0xE0, 0x55, 0x3F, 0xF5, 0x43, 0xA3, 0xE0, 0x55, 0x40, +0xF5, 0x44, 0x90, 0x01, 0x34, 0xE5, 0x41, 0xF0, 0xA3, 0xE5, 0x42, 0xF0, 0xA3, 0xE5, 0x43, 0xF0, +0xA3, 0xE5, 0x44, 0xF0, 0x22, 0x90, 0x01, 0x3C, 0xE0, 0x55, 0x45, 0xF5, 0x49, 0xA3, 0xE0, 0x55, +0x46, 0xF5, 0x4A, 0xA3, 0xE0, 0x55, 0x47, 0xF5, 0x4B, 0xA3, 0xE0, 0x55, 0x48, 0xF5, 0x4C, 0x90, +0x01, 0x3C, 0xE5, 0x49, 0xF0, 0xA3, 0xE5, 0x4A, 0xF0, 0xA3, 0xE5, 0x4B, 0xF0, 0xA3, 0xE5, 0x4C, +0xF0, 0x53, 0x91, 0xDF, 0x22, 0x90, 0x81, 0x1F, 0xE0, 0x30, 0xE0, 0x05, 0xE4, 0xA3, 0xF0, 0xA3, +0xF0, 0x22, 0x90, 0x80, 0xDE, 0xE0, 0x64, 0x01, 0x70, 0x19, 0x90, 0x81, 0x27, 0xE0, 0x60, 0x13, +0x90, 0x01, 0x57, 0xE4, 0xF0, 0x90, 0x01, 0x3C, 0x74, 0x02, 0x12, 0x4F, 0xF4, 0x90, 0x01, 0x57, +0x74, 0x05, 0xF0, 0x22, 0x90, 0x80, 0xDE, 0xE0, 0x64, 0x01, 0x70, 0x26, 0x90, 0x81, 0x27, 0xE0, +0x60, 0x20, 0x90, 0x01, 0x57, 0xE4, 0xF0, 0x90, 0x01, 0x3C, 0x74, 0x02, 0xF0, 0x90, 0x81, 0x24, +0xE0, 0x54, 0xFB, 0xF0, 0x90, 0x81, 0x2B, 0xE0, 0x54, 0xFD, 0xF0, 0x54, 0x07, 0x70, 0x03, 0x12, +0x47, 0x2A, 0x22, 0x90, 0x80, 0xDE, 0xE0, 0xB4, 0x01, 0x14, 0x90, 0x81, 0x27, 0xE0, 0x60, 0x0E, +0x90, 0x81, 0x26, 0xE0, 0x54, 0x0F, 0x64, 0x02, 0x60, 0x02, 0x80, 0x03, 0xD1, 0x7F, 0x22, 0x90, +0x04, 0x1D, 0xE0, 0x70, 0x13, 0x90, 0x80, 0x3E, 0xE0, 0xFF, 0xE4, 0xFD, 0xB1, 0x69, 0x8E, 0x4E, +0x8F, 0x4F, 0x90, 0x04, 0x1F, 0x74, 0x20, 0xF0, 0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, +0x90, 0x82, 0x0E, 0xED, 0xF0, 0x90, 0x82, 0x0D, 0xEF, 0xF0, 0xE4, 0xFD, 0xFC, 0xF1, 0x37, 0x7C, +0x00, 0xAD, 0x07, 0x90, 0x82, 0x0D, 0xE0, 0x90, 0x04, 0x25, 0xF0, 0x90, 0x82, 0x0E, 0xE0, 0x60, +0x0E, 0x74, 0x0F, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x44, 0x80, 0xF0, 0xAF, +0x05, 0x74, 0x08, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE4, 0xF0, 0x74, 0x09, 0x2F, +0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x54, 0xF0, 0xF0, 0x74, 0x21, 0x2D, 0xF5, 0x82, +0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x54, 0xF7, 0xF0, 0xAE, 0x04, 0xAF, 0x05, 0xD0, 0xD0, 0x92, +0xAF, 0x22, 0x8F, 0x4E, 0xF1, 0x4B, 0xBF, 0x01, 0x18, 0x90, 0x80, 0x40, 0xE0, 0xFF, 0x7D, 0x01, +0xB1, 0x69, 0xAD, 0x07, 0xAC, 0x06, 0xAF, 0x4E, 0x12, 0x4F, 0x82, 0x90, 0x04, 0x1F, 0x74, 0x20, +0xF0, 0x22, 0x90, 0x06, 0xA9, 0xE0, 0x90, 0x81, 0x4C, 0xF0, 0xE0, 0xFD, 0x54, 0xC0, 0x70, 0x09, +0x90, 0x81, 0x2B, 0xE0, 0x54, 0xFE, 0xF0, 0x80, 0x72, 0xED, 0x30, 0xE6, 0x4B, 0x90, 0x81, 0x27, +0xE0, 0x64, 0x02, 0x70, 0x2A, 0x90, 0x81, 0x24, 0xE0, 0xFF, 0xC3, 0x13, 0x20, 0xE0, 0x09, 0x90, +0x81, 0x2B, 0xE0, 0x44, 0x01, 0xF0, 0x80, 0x28, 0x90, 0x81, 0x26, 0xE0, 0x54, 0x0F, 0x64, 0x01, +0x70, 0x2D, 0x90, 0x81, 0x2B, 0xE0, 0x44, 0x04, 0xF0, 0x7F, 0x01, 0xB1, 0xD2, 0x80, 0x20, 0x90, +0x81, 0x2B, 0xE0, 0x44, 0x01, 0xF0, 0x90, 0x81, 0x26, 0xE0, 0x54, 0x0F, 0x64, 0x02, 0x60, 0x04, +0xB1, 0x4F, 0x80, 0x0B, 0xD1, 0x7F, 0x80, 0x07, 0x90, 0x81, 0x2B, 0xE0, 0x54, 0xFE, 0xF0, 0x90, +0x81, 0x4C, 0xE0, 0x90, 0x81, 0x2B, 0x30, 0xE7, 0x11, 0x12, 0x4F, 0xF1, 0x90, 0x01, 0x57, 0x74, +0x05, 0xF0, 0x90, 0x81, 0x24, 0xE0, 0x44, 0x04, 0xF0, 0x22, 0xE0, 0x54, 0xFD, 0xF0, 0x22, 0x90, +0x01, 0x5F, 0xE4, 0xF0, 0x90, 0x01, 0x3C, 0x74, 0x08, 0xF0, 0xE4, 0xF5, 0x1D, 0x90, 0x81, 0x3A, +0xE0, 0xC3, 0x13, 0x54, 0x7F, 0xF5, 0x1E, 0xE4, 0xFB, 0xFD, 0x7F, 0x5C, 0x7E, 0x01, 0x12, 0x50, +0x05, 0x90, 0x01, 0x5F, 0x74, 0x05, 0xF0, 0x90, 0x06, 0x92, 0x74, 0x02, 0xF0, 0x90, 0x81, 0x24, +0xE0, 0x44, 0x10, 0xF0, 0x90, 0x81, 0x2A, 0xE0, 0x64, 0x0C, 0x60, 0x0C, 0xE4, 0xFD, 0x7F, 0x0C, +0x12, 0x47, 0x3D, 0xE4, 0xFF, 0x12, 0x4F, 0x0D, 0x22, 0xE4, 0x90, 0x81, 0x4C, 0xF0, 0x90, 0x06, +0xA9, 0xE0, 0x90, 0x81, 0x4C, 0xF0, 0xE0, 0x54, 0xC0, 0x70, 0x0D, 0x90, 0x81, 0x2B, 0xE0, 0x54, +0xFE, 0xF0, 0x54, 0xFD, 0xF0, 0x02, 0x47, 0x2A, 0x90, 0x81, 0x4C, 0xE0, 0x30, 0xE6, 0x21, 0x90, +0x81, 0x27, 0xE0, 0x64, 0x01, 0x70, 0x20, 0x90, 0x81, 0x2B, 0xE0, 0x44, 0x01, 0xF0, 0x90, 0x81, +0x26, 0xE0, 0x54, 0x0F, 0x64, 0x02, 0x60, 0x04, 0xB1, 0x4F, 0x80, 0x0B, 0xD1, 0x7F, 0x80, 0x07, +0x90, 0x81, 0x2B, 0xE0, 0x54, 0xFE, 0xF0, 0x90, 0x81, 0x4C, 0xE0, 0x90, 0x81, 0x2B, 0x30, 0xE7, +0x11, 0x12, 0x4F, 0xF1, 0x90, 0x01, 0x57, 0x74, 0x05, 0xF0, 0x90, 0x81, 0x24, 0xE0, 0x44, 0x04, +0xF0, 0x22, 0xE0, 0x54, 0xFD, 0xF0, 0x22, 0xE4, 0xFE, 0xEF, 0xC3, 0x13, 0xFD, 0xEF, 0x30, 0xE0, +0x02, 0x7E, 0x80, 0x90, 0xFD, 0x10, 0xED, 0xF0, 0xAF, 0x06, 0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, +0xC0, 0xD0, 0x90, 0x04, 0x1D, 0xE0, 0x60, 0x1A, 0x90, 0x05, 0x22, 0xE0, 0x54, 0x90, 0x60, 0x07, +0x90, 0x01, 0xC0, 0xE0, 0x44, 0x08, 0xF0, 0x90, 0x01, 0xC6, 0xE0, 0x30, 0xE1, 0xE4, 0x7F, 0x00, +0x80, 0x02, 0x7F, 0x01, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x90, 0x81, 0x27, 0xE0, 0x60, 0x03, 0x12, +0x73, 0xE1, 0x90, 0x81, 0x3F, 0xE0, 0x30, 0xE0, 0x03, 0x12, 0x49, 0xDD, 0x22, 0x90, 0x81, 0x27, +0xE0, 0x60, 0x35, 0x90, 0x06, 0x92, 0xE0, 0x30, 0xE1, 0x24, 0xE4, 0xF5, 0x1D, 0x90, 0x81, 0x3A, +0xE0, 0xC3, 0x13, 0x54, 0x7F, 0xF5, 0x1E, 0xE4, 0xFB, 0xFD, 0x7F, 0x5C, 0x7E, 0x01, 0x12, 0x50, +0x05, 0x90, 0x01, 0x5F, 0x74, 0x05, 0xF0, 0x90, 0x06, 0x92, 0x74, 0x02, 0xF0, 0x22, 0x90, 0x81, +0x24, 0xE0, 0x54, 0xEF, 0xF0, 0x12, 0x47, 0x2A, 0x22, 0x12, 0x71, 0x48, 0x90, 0x81, 0x4D, 0xEF, +0xF0, 0x90, 0x81, 0x24, 0x30, 0xE0, 0x06, 0xE0, 0x44, 0x01, 0xF0, 0x80, 0x04, 0xE0, 0x54, 0xFE, +0xF0, 0x90, 0x81, 0x4D, 0xE0, 0x30, 0xE6, 0x11, 0x90, 0x01, 0x2F, 0xE0, 0x30, 0xE7, 0x04, 0xE4, +0xF0, 0x80, 0x06, 0x90, 0x01, 0x2F, 0x74, 0x80, 0xF0, 0x90, 0x81, 0x24, 0xE0, 0x30, 0xE0, 0x1A, +0x90, 0x81, 0x32, 0xE4, 0xF0, 0xA3, 0x74, 0x07, 0xF0, 0x90, 0x81, 0x32, 0xA3, 0xE0, 0x90, 0x05, +0x58, 0xF0, 0x90, 0x04, 0xEC, 0xE0, 0x54, 0xDD, 0xF0, 0x22, 0x90, 0x04, 0xEC, 0xE0, 0x44, 0x22, +0xF0, 0x22, 0x90, 0x81, 0x4A, 0xE0, 0x60, 0x0F, 0xE4, 0xF0, 0x90, 0x05, 0x53, 0xE0, 0x44, 0x01, +0xF0, 0x90, 0x05, 0xFD, 0xE0, 0x04, 0xF0, 0x22, 0x90, 0x81, 0x24, 0xE0, 0xFF, 0xC4, 0x13, 0x13, +0x54, 0x03, 0x30, 0xE0, 0x27, 0xEF, 0x54, 0xBF, 0xF0, 0x90, 0x04, 0xE0, 0xE0, 0x90, 0x81, 0x25, +0x30, 0xE0, 0x06, 0xE0, 0x44, 0x01, 0xF0, 0x80, 0x10, 0xE0, 0x54, 0xFE, 0xF0, 0x90, 0x01, 0xB9, +0x74, 0x01, 0xF0, 0x90, 0x01, 0xB8, 0x74, 0x04, 0xF0, 0x12, 0x47, 0x2A, 0xE4, 0xFF, 0x90, 0x81, +0x45, 0xE0, 0x30, 0xE0, 0x48, 0x90, 0x81, 0x49, 0xE0, 0xFD, 0x60, 0x41, 0x74, 0x01, 0x7E, 0x00, +0xA8, 0x07, 0x08, 0x80, 0x05, 0xC3, 0x33, 0xCE, 0x33, 0xCE, 0xD8, 0xF9, 0xFF, 0x90, 0x04, 0xE0, +0xE0, 0xFB, 0xEF, 0x5B, 0x60, 0x06, 0xE4, 0x90, 0x81, 0x49, 0xF0, 0x22, 0x90, 0x81, 0x47, 0xE0, +0xD3, 0x9D, 0x50, 0x10, 0x90, 0x01, 0xC7, 0x74, 0x10, 0xF0, 0x11, 0xBE, 0x90, 0x81, 0x45, 0xE0, +0x54, 0xFE, 0xF0, 0x22, 0x12, 0x4F, 0x0B, 0x90, 0x81, 0x49, 0xE0, 0x04, 0xF0, 0x22, 0x90, 0x80, +0x3C, 0xE0, 0x64, 0x02, 0x60, 0x07, 0x90, 0x06, 0x90, 0xE0, 0x44, 0x01, 0xF0, 0x22, 0x90, 0x81, +0x24, 0xE0, 0xFF, 0xC4, 0x13, 0x13, 0x13, 0x54, 0x01, 0x30, 0xE0, 0x2C, 0xEF, 0x54, 0x7F, 0xF0, +0x90, 0x04, 0xE0, 0xE0, 0x90, 0x81, 0x25, 0x30, 0xE1, 0x06, 0xE0, 0x44, 0x02, 0xF0, 0x80, 0x0F, +0xE0, 0x54, 0xFD, 0xF0, 0x90, 0x01, 0xB9, 0x74, 0x01, 0xF0, 0x90, 0x01, 0xB8, 0x04, 0xF0, 0x90, +0x81, 0x27, 0xE0, 0x60, 0x03, 0x12, 0x47, 0x2A, 0x7F, 0x01, 0x01, 0x6E, 0xC3, 0xEE, 0x94, 0x01, +0x40, 0x0A, 0x0D, 0xED, 0x13, 0x90, 0xFD, 0x10, 0xF0, 0xE4, 0x2F, 0xFF, 0x22, 0xC3, 0xEE, 0x94, +0x01, 0x40, 0x24, 0x90, 0xFD, 0x11, 0xE0, 0x6D, 0x70, 0x1A, 0x90, 0x01, 0x17, 0xE0, 0xB5, 0x05, +0x0D, 0x90, 0x01, 0xE4, 0x74, 0x77, 0xF0, 0x90, 0xFD, 0x11, 0xE4, 0xF0, 0x80, 0x06, 0xED, 0x04, +0x90, 0xFD, 0x11, 0xF0, 0xE4, 0x2F, 0xFF, 0x22, 0xE4, 0x90, 0x81, 0x4E, 0xF0, 0xA3, 0xF0, 0xA3, +0xF0, 0x90, 0x00, 0x83, 0xE0, 0x90, 0x81, 0x4E, 0xF0, 0x90, 0x00, 0x83, 0xE0, 0xFE, 0x90, 0x81, +0x4E, 0xE0, 0xFF, 0xB5, 0x06, 0x01, 0x22, 0xC3, 0x90, 0x81, 0x50, 0xE0, 0x94, 0x64, 0x90, 0x81, +0x4F, 0xE0, 0x94, 0x00, 0x40, 0x0D, 0x90, 0x01, 0xC0, 0xE0, 0x44, 0x40, 0xF0, 0x90, 0x81, 0x4E, +0xE0, 0xFF, 0x22, 0x90, 0x81, 0x4F, 0xE4, 0x75, 0xF0, 0x01, 0x12, 0x44, 0xA9, 0x80, 0xC2, 0x74, +0x45, 0x2F, 0xF8, 0xE6, 0xFE, 0xED, 0xF4, 0x5E, 0xFE, 0xF6, 0x74, 0x38, 0x2F, 0xF5, 0x82, 0xE4, +0x34, 0x01, 0xF5, 0x83, 0xEE, 0xF0, 0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0x82, +0x12, 0xED, 0xF0, 0x90, 0x82, 0x11, 0xEF, 0xF0, 0xD3, 0x94, 0x07, 0x50, 0x70, 0xE0, 0xFF, 0x74, +0x01, 0xA8, 0x07, 0x08, 0x80, 0x02, 0xC3, 0x33, 0xD8, 0xFC, 0xF4, 0xFF, 0x90, 0x00, 0x47, 0xE0, +0x5F, 0xFD, 0x7F, 0x47, 0x12, 0x32, 0x1E, 0x90, 0x82, 0x11, 0xE0, 0xFF, 0x74, 0x01, 0xA8, 0x07, +0x08, 0x80, 0x02, 0xC3, 0x33, 0xD8, 0xFC, 0xFF, 0x90, 0x00, 0x46, 0xE0, 0x4F, 0xFD, 0x7F, 0x46, +0x12, 0x32, 0x1E, 0x90, 0x82, 0x12, 0xE0, 0x60, 0x18, 0x90, 0x82, 0x11, 0xE0, 0xFF, 0x74, 0x01, +0xA8, 0x07, 0x08, 0x80, 0x02, 0xC3, 0x33, 0xD8, 0xFC, 0xFF, 0x90, 0x00, 0x45, 0xE0, 0x4F, 0x80, +0x17, 0x90, 0x82, 0x11, 0xE0, 0xFF, 0x74, 0x01, 0xA8, 0x07, 0x08, 0x80, 0x02, 0xC3, 0x33, 0xD8, +0xFC, 0xF4, 0xFF, 0x90, 0x00, 0x45, 0xE0, 0x5F, 0xFD, 0x7F, 0x45, 0x80, 0x7E, 0x90, 0x82, 0x11, +0xE0, 0x24, 0xF8, 0xF0, 0xE0, 0x24, 0x04, 0xFF, 0x74, 0x01, 0xA8, 0x07, 0x08, 0x80, 0x02, 0xC3, +0x33, 0xD8, 0xFC, 0xF4, 0xFF, 0x90, 0x00, 0x43, 0xE0, 0x5F, 0xFD, 0x7F, 0x43, 0x12, 0x32, 0x1E, +0x90, 0x82, 0x11, 0xE0, 0xFF, 0x74, 0x01, 0xA8, 0x07, 0x08, 0x80, 0x02, 0xC3, 0x33, 0xD8, 0xFC, +0xFF, 0x90, 0x00, 0x43, 0xE0, 0x4F, 0xFD, 0x7F, 0x43, 0x12, 0x32, 0x1E, 0x90, 0x82, 0x12, 0xE0, +0x60, 0x1D, 0x90, 0x82, 0x11, 0xE0, 0x24, 0x04, 0xFF, 0x74, 0x01, 0xA8, 0x07, 0x08, 0x80, 0x02, +0xC3, 0x33, 0xD8, 0xFC, 0xFF, 0x90, 0x00, 0x42, 0xE0, 0x4F, 0xFD, 0x7F, 0x42, 0x80, 0x1C, 0x90, +0x82, 0x11, 0xE0, 0x24, 0x04, 0xFF, 0x74, 0x01, 0xA8, 0x07, 0x08, 0x80, 0x02, 0xC3, 0x33, 0xD8, +0xFC, 0xF4, 0xFF, 0x90, 0x00, 0x42, 0xE0, 0x5F, 0xFD, 0x7F, 0x42, 0x12, 0x32, 0x1E, 0xD0, 0xD0, +0x92, 0xAF, 0x22, 0x90, 0x81, 0x24, 0xE0, 0x54, 0xFB, 0xF0, 0xE4, 0x90, 0x81, 0x30, 0xF0, 0x90, +0x81, 0x2B, 0xF0, 0x22, 0xEF, 0x24, 0xFE, 0x60, 0x0C, 0x04, 0x70, 0x28, 0x90, 0x81, 0x2D, 0x74, +0x01, 0xF0, 0xA3, 0xF0, 0x22, 0xED, 0x70, 0x0A, 0x90, 0x81, 0x3B, 0xE0, 0x90, 0x81, 0x2D, 0xF0, +0x80, 0x05, 0x90, 0x81, 0x2D, 0xED, 0xF0, 0x90, 0x81, 0x2D, 0xE0, 0xA3, 0xF0, 0x90, 0x81, 0x25, +0xE0, 0x44, 0x08, 0xF0, 0x22, 0x12, 0x4E, 0xAB, 0xEF, 0x64, 0x01, 0x60, 0x08, 0x90, 0x01, 0xB8, +0x74, 0x01, 0xF0, 0x80, 0x67, 0x90, 0x81, 0x2B, 0xE0, 0xFF, 0x54, 0x03, 0x60, 0x08, 0x90, 0x01, +0xB8, 0x74, 0x02, 0xF0, 0x80, 0x56, 0x90, 0x81, 0x29, 0xE0, 0xFE, 0xE4, 0xC3, 0x9E, 0x50, 0x08, +0x90, 0x01, 0xB8, 0x74, 0x04, 0xF0, 0x80, 0x44, 0xEF, 0x30, 0xE2, 0x08, 0x90, 0x01, 0xB8, 0x74, +0x08, 0xF0, 0x80, 0x38, 0x90, 0x81, 0x2B, 0xE0, 0x30, 0xE4, 0x08, 0x90, 0x01, 0xB8, 0x74, 0x10, +0xF0, 0x80, 0x29, 0x90, 0x81, 0x25, 0xE0, 0x13, 0x13, 0x54, 0x3F, 0x20, 0xE0, 0x08, 0x90, 0x01, +0xB8, 0x74, 0x20, 0xF0, 0x80, 0x16, 0x90, 0x81, 0x3E, 0xE0, 0x60, 0x08, 0x90, 0x01, 0xB8, 0x74, +0x80, 0xF0, 0x80, 0x08, 0x90, 0x01, 0xB8, 0xE4, 0xF0, 0x7F, 0x01, 0x22, 0x90, 0x01, 0xB9, 0x74, +0x04, 0xF0, 0x7F, 0x00, 0x22, 0xEF, 0x60, 0x42, 0x90, 0x80, 0xDE, 0xE0, 0x64, 0x01, 0x70, 0x3A, +0x90, 0x81, 0x25, 0xE0, 0x54, 0xFE, 0xF0, 0x90, 0x05, 0x22, 0x74, 0x0F, 0xF0, 0x90, 0x06, 0x04, +0xE0, 0x54, 0xBF, 0xF0, 0xE4, 0xFF, 0x12, 0x4F, 0x0D, 0xBF, 0x01, 0x12, 0x90, 0x81, 0x24, 0xE0, +0x44, 0x40, 0xF0, 0x90, 0x81, 0x2A, 0x74, 0x06, 0xF0, 0x90, 0x81, 0x23, 0xF0, 0x22, 0x90, 0x01, +0xB9, 0x74, 0x01, 0xF0, 0x90, 0x01, 0xB8, 0x74, 0x08, 0xF0, 0x22, 0x90, 0x05, 0x22, 0x74, 0x6F, +0xF0, 0x90, 0x05, 0x27, 0xE0, 0x54, 0xBF, 0xF0, 0x90, 0x81, 0x2A, 0x74, 0x02, 0xF0, 0x90, 0x81, +0x23, 0xF0, 0x22, 0x12, 0x54, 0x65, 0x90, 0x81, 0x2A, 0x74, 0x0C, 0xF0, 0x90, 0x81, 0x23, 0xF0, +0x22, 0x90, 0x81, 0x24, 0xE0, 0xFF, 0x13, 0x13, 0x54, 0x3F, 0x30, 0xE0, 0x11, 0xEF, 0x54, 0xFB, +0xF0, 0x90, 0x81, 0x2B, 0xE0, 0x54, 0xFD, 0xF0, 0x54, 0x07, 0x70, 0x42, 0x80, 0x3D, 0x90, 0x81, +0x30, 0xE0, 0x04, 0xF0, 0x90, 0x81, 0x2B, 0xE0, 0x54, 0xEF, 0xF0, 0x90, 0x81, 0x30, 0xE0, 0xFF, +0xB4, 0x01, 0x02, 0x80, 0x04, 0xEF, 0xB4, 0x02, 0x06, 0x90, 0x05, 0x58, 0xE0, 0x04, 0xF0, 0x90, +0x81, 0x38, 0xE0, 0xFF, 0x90, 0x81, 0x30, 0xE0, 0xD3, 0x9F, 0x40, 0x0F, 0x90, 0x80, 0xDE, 0xE0, +0xB4, 0x01, 0x0B, 0x90, 0x81, 0x25, 0xE0, 0x54, 0xFB, 0xF0, 0x22, 0x12, 0x47, 0x2A, 0x22, 0x22, +0x90, 0x05, 0x2B, 0xE0, 0x7F, 0x00, 0x30, 0xE7, 0x02, 0x7F, 0x01, 0x22, 0x90, 0x05, 0x22, 0x74, +0xFF, 0xF0, 0x90, 0x05, 0x27, 0xE0, 0x44, 0x40, 0xF0, 0x90, 0x81, 0x22, 0x74, 0x03, 0xF0, 0x22, +0x90, 0x05, 0x27, 0xE0, 0x44, 0x40, 0xF0, 0x12, 0x49, 0xDD, 0x90, 0x81, 0x22, 0x74, 0x02, 0xF0, +0x22, 0x12, 0x49, 0xE3, 0x90, 0x81, 0x22, 0x74, 0x02, 0xF0, 0x22, 0x90, 0x05, 0x22, 0x74, 0x6F, +0xF0, 0x90, 0x05, 0x27, 0xE0, 0x54, 0xBF, 0xF0, 0x90, 0x81, 0x22, 0x74, 0x04, 0xF0, 0x22, 0xAE, +0x07, 0x12, 0x51, 0x73, 0xBF, 0x01, 0x12, 0x90, 0x81, 0x23, 0xE0, 0x64, 0x02, 0x60, 0x0A, 0xAF, +0x06, 0x7D, 0x01, 0x12, 0x47, 0x3D, 0x7F, 0x01, 0x22, 0x7F, 0x00, 0x22, 0x90, 0x01, 0x57, 0xE0, +0x60, 0x48, 0xE4, 0xF0, 0x90, 0x01, 0x3C, 0x74, 0x02, 0xF0, 0x90, 0x81, 0x24, 0xE0, 0xFF, 0x13, +0x13, 0x54, 0x3F, 0x30, 0xE0, 0x0C, 0xEF, 0x54, 0xFB, 0xF0, 0x90, 0x81, 0x2B, 0xE0, 0x54, 0xFD, +0xF0, 0x22, 0x90, 0x81, 0x30, 0xE0, 0x04, 0xF0, 0x90, 0x81, 0x2B, 0xE0, 0x54, 0xEF, 0xF0, 0x90, +0x81, 0x38, 0xE0, 0xFF, 0x90, 0x81, 0x30, 0xE0, 0xD3, 0x9F, 0x40, 0x0E, 0x90, 0x80, 0xDE, 0xE0, +0xB4, 0x01, 0x07, 0x90, 0x81, 0x25, 0xE0, 0x54, 0xFB, 0xF0, 0x22, 0x90, 0x80, 0x3F, 0xE0, 0xFF, +0x7D, 0x01, 0x12, 0x6D, 0x69, 0x8E, 0x54, 0x8F, 0x55, 0xAD, 0x55, 0xAC, 0x54, 0xAF, 0x53, 0x12, +0x4F, 0x82, 0xAF, 0x55, 0xAE, 0x54, 0x90, 0x04, 0x80, 0xE0, 0x54, 0x0F, 0xFD, 0xAC, 0x07, 0x74, +0x11, 0x2C, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x44, 0x01, 0xF0, 0x74, 0x11, 0x2C, +0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x54, 0xFB, 0xF0, 0xAC, 0x07, 0x74, 0x16, 0x2C, +0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x44, 0xFA, 0xF0, 0x74, 0x15, 0x2C, 0xF5, 0x82, +0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x44, 0x1F, 0xF0, 0xAC, 0x07, 0x74, 0x06, 0x2C, 0xF5, 0x82, +0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x44, 0x0F, 0xF0, 0x90, 0x04, 0x53, 0xE4, 0xF0, 0x90, 0x04, +0x52, 0xF0, 0x90, 0x04, 0x51, 0x74, 0xFF, 0xF0, 0x90, 0x04, 0x50, 0x74, 0xFD, 0xF0, 0x74, 0x14, +0x2C, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x54, 0xC0, 0x4D, 0xFD, 0x74, 0x14, 0x2F, +0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xED, 0xF0, 0x22, 0xAB, 0x07, 0xAA, 0x06, 0xED, 0x2B, +0xFB, 0xE4, 0x3A, 0xFA, 0xC3, 0x90, 0x80, 0xDB, 0xE0, 0x9B, 0x90, 0x80, 0xDA, 0xE0, 0x9A, 0x50, +0x13, 0xA3, 0xE0, 0x24, 0x01, 0xFF, 0x90, 0x80, 0xDA, 0xE0, 0x34, 0x00, 0xFE, 0xC3, 0xEB, 0x9F, +0xFB, 0xEA, 0x9E, 0xFA, 0xEA, 0x90, 0xFD, 0x11, 0xF0, 0xAF, 0x03, 0x74, 0x00, 0x2F, 0xF5, 0x82, +0xE4, 0x34, 0xFB, 0xF5, 0x83, 0xE0, 0xFF, 0x22, 0x12, 0x1F, 0xA4, 0xFF, 0x54, 0x01, 0xFE, 0x90, +0x81, 0x42, 0xE0, 0x54, 0xFE, 0x4E, 0xF0, 0xEF, 0xC3, 0x13, 0x30, 0xE0, 0x0A, 0x90, 0x00, 0x01, +0x12, 0x1F, 0xBD, 0x90, 0x81, 0x43, 0xF0, 0x22, 0x90, 0x81, 0x45, 0xE0, 0x30, 0xE0, 0x2D, 0x90, +0x81, 0x48, 0xE0, 0x04, 0xF0, 0xE0, 0xFF, 0x90, 0x81, 0x46, 0xE0, 0xB5, 0x07, 0x1E, 0x90, 0x06, +0x92, 0xE0, 0x54, 0x1C, 0x70, 0x0B, 0x12, 0x4F, 0x0B, 0x90, 0x81, 0x49, 0xE0, 0x04, 0xF0, 0x80, +0x06, 0x90, 0x06, 0x92, 0x74, 0x1C, 0xF0, 0xE4, 0x90, 0x81, 0x48, 0xF0, 0x22, 0x00, 0xBB, 0x8E, +}; diff --git a/hal/Hal8188EPwrSeq.c b/hal/Hal8188EPwrSeq.c index c38c25a..06b9813 100755 --- a/hal/Hal8188EPwrSeq.c +++ b/hal/Hal8188EPwrSeq.c @@ -1,97 +1,96 @@ -/****************************************************************************** - * - * 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 - * - * - ******************************************************************************/ - -#include "Hal8188EPwrSeq.h" -#include - -/* - drivers should parse below arrays and do the corresponding actions -*/ -//3 Power on Array -WLAN_PWR_CFG rtl8188E_power_on_flow[RTL8188E_TRANS_CARDEMU_TO_ACT_STEPS+RTL8188E_TRANS_END_STEPS]= -{ - RTL8188E_TRANS_CARDEMU_TO_ACT - RTL8188E_TRANS_END -}; - -//3Radio off Array -WLAN_PWR_CFG rtl8188E_radio_off_flow[RTL8188E_TRANS_ACT_TO_CARDEMU_STEPS+RTL8188E_TRANS_END_STEPS]= -{ - RTL8188E_TRANS_ACT_TO_CARDEMU - RTL8188E_TRANS_END -}; - -//3Card Disable Array -WLAN_PWR_CFG rtl8188E_card_disable_flow[RTL8188E_TRANS_ACT_TO_CARDEMU_STEPS+RTL8188E_TRANS_CARDEMU_TO_PDN_STEPS+RTL8188E_TRANS_END_STEPS]= -{ - RTL8188E_TRANS_ACT_TO_CARDEMU - RTL8188E_TRANS_CARDEMU_TO_CARDDIS - RTL8188E_TRANS_END -}; - -//3 Card Enable Array -WLAN_PWR_CFG rtl8188E_card_enable_flow[RTL8188E_TRANS_ACT_TO_CARDEMU_STEPS+RTL8188E_TRANS_CARDEMU_TO_PDN_STEPS+RTL8188E_TRANS_END_STEPS]= -{ - RTL8188E_TRANS_CARDDIS_TO_CARDEMU - RTL8188E_TRANS_CARDEMU_TO_ACT - RTL8188E_TRANS_END -}; - -//3Suspend Array -WLAN_PWR_CFG rtl8188E_suspend_flow[RTL8188E_TRANS_ACT_TO_CARDEMU_STEPS+RTL8188E_TRANS_CARDEMU_TO_SUS_STEPS+RTL8188E_TRANS_END_STEPS]= -{ - RTL8188E_TRANS_ACT_TO_CARDEMU - RTL8188E_TRANS_CARDEMU_TO_SUS - RTL8188E_TRANS_END -}; - -//3 Resume Array -WLAN_PWR_CFG rtl8188E_resume_flow[RTL8188E_TRANS_ACT_TO_CARDEMU_STEPS+RTL8188E_TRANS_CARDEMU_TO_SUS_STEPS+RTL8188E_TRANS_END_STEPS]= -{ - RTL8188E_TRANS_SUS_TO_CARDEMU - RTL8188E_TRANS_CARDEMU_TO_ACT - RTL8188E_TRANS_END -}; - - -//3HWPDN Array -WLAN_PWR_CFG rtl8188E_hwpdn_flow[RTL8188E_TRANS_ACT_TO_CARDEMU_STEPS+RTL8188E_TRANS_CARDEMU_TO_PDN_STEPS+RTL8188E_TRANS_END_STEPS]= -{ - RTL8188E_TRANS_ACT_TO_CARDEMU - RTL8188E_TRANS_CARDEMU_TO_PDN - RTL8188E_TRANS_END -}; - -//3 Enter LPS -WLAN_PWR_CFG rtl8188E_enter_lps_flow[RTL8188E_TRANS_ACT_TO_LPS_STEPS+RTL8188E_TRANS_END_STEPS]= -{ - //FW behavior - RTL8188E_TRANS_ACT_TO_LPS - RTL8188E_TRANS_END -}; - -//3 Leave LPS -WLAN_PWR_CFG rtl8188E_leave_lps_flow[RTL8188E_TRANS_LPS_TO_ACT_STEPS+RTL8188E_TRANS_END_STEPS]= -{ - //FW behavior - RTL8188E_TRANS_LPS_TO_ACT - RTL8188E_TRANS_END -}; - +/****************************************************************************** + * + * 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 + * + * + ******************************************************************************/ + +#include "Hal8188EPwrSeq.h" +#include + +/* + drivers should parse below arrays and do the corresponding actions +*/ +//3 Power on Array +WLAN_PWR_CFG rtl8188E_power_on_flow[RTL8188E_TRANS_CARDEMU_TO_ACT_STEPS+RTL8188E_TRANS_END_STEPS]= +{ + RTL8188E_TRANS_CARDEMU_TO_ACT + RTL8188E_TRANS_END +}; + +//3Radio off Array +WLAN_PWR_CFG rtl8188E_radio_off_flow[RTL8188E_TRANS_ACT_TO_CARDEMU_STEPS+RTL8188E_TRANS_END_STEPS]= +{ + RTL8188E_TRANS_ACT_TO_CARDEMU + RTL8188E_TRANS_END +}; + +//3Card Disable Array +WLAN_PWR_CFG rtl8188E_card_disable_flow[RTL8188E_TRANS_ACT_TO_CARDEMU_STEPS+RTL8188E_TRANS_CARDEMU_TO_PDN_STEPS+RTL8188E_TRANS_END_STEPS]= +{ + RTL8188E_TRANS_ACT_TO_CARDEMU + RTL8188E_TRANS_CARDEMU_TO_CARDDIS + RTL8188E_TRANS_END +}; + +//3 Card Enable Array +WLAN_PWR_CFG rtl8188E_card_enable_flow[RTL8188E_TRANS_ACT_TO_CARDEMU_STEPS+RTL8188E_TRANS_CARDEMU_TO_PDN_STEPS+RTL8188E_TRANS_END_STEPS]= +{ + RTL8188E_TRANS_CARDDIS_TO_CARDEMU + RTL8188E_TRANS_CARDEMU_TO_ACT + RTL8188E_TRANS_END +}; + +//3Suspend Array +WLAN_PWR_CFG rtl8188E_suspend_flow[RTL8188E_TRANS_ACT_TO_CARDEMU_STEPS+RTL8188E_TRANS_CARDEMU_TO_SUS_STEPS+RTL8188E_TRANS_END_STEPS]= +{ + RTL8188E_TRANS_ACT_TO_CARDEMU + RTL8188E_TRANS_CARDEMU_TO_SUS + RTL8188E_TRANS_END +}; + +//3 Resume Array +WLAN_PWR_CFG rtl8188E_resume_flow[RTL8188E_TRANS_ACT_TO_CARDEMU_STEPS+RTL8188E_TRANS_CARDEMU_TO_SUS_STEPS+RTL8188E_TRANS_END_STEPS]= +{ + RTL8188E_TRANS_SUS_TO_CARDEMU + RTL8188E_TRANS_CARDEMU_TO_ACT + RTL8188E_TRANS_END +}; + + +//3HWPDN Array +WLAN_PWR_CFG rtl8188E_hwpdn_flow[RTL8188E_TRANS_ACT_TO_CARDEMU_STEPS+RTL8188E_TRANS_CARDEMU_TO_PDN_STEPS+RTL8188E_TRANS_END_STEPS]= +{ + RTL8188E_TRANS_ACT_TO_CARDEMU + RTL8188E_TRANS_CARDEMU_TO_PDN + RTL8188E_TRANS_END +}; + +//3 Enter LPS +WLAN_PWR_CFG rtl8188E_enter_lps_flow[RTL8188E_TRANS_ACT_TO_LPS_STEPS+RTL8188E_TRANS_END_STEPS]= +{ + //FW behavior + RTL8188E_TRANS_ACT_TO_LPS + RTL8188E_TRANS_END +}; + +//3 Leave LPS +WLAN_PWR_CFG rtl8188E_leave_lps_flow[RTL8188E_TRANS_LPS_TO_ACT_STEPS+RTL8188E_TRANS_END_STEPS]= +{ + //FW behavior + RTL8188E_TRANS_LPS_TO_ACT + RTL8188E_TRANS_END +}; diff --git a/hal/Hal8188ERateAdaptive.c b/hal/Hal8188ERateAdaptive.c index 11a1ead..cb3fd29 100755 --- a/hal/Hal8188ERateAdaptive.c +++ b/hal/Hal8188ERateAdaptive.c @@ -3,19 +3,19 @@ Copyright (c) Realtek Semiconductor Corp. All rights reserved. Module Name: RateAdaptive.c - + Abstract: Implement Rate Adaptive functions for common operations. - + Major Change History: When Who What - ---------- --------------- ------------------------------- - 2011-08-12 Page Create. + ---------- --------------- ------------------------------- + 2011-08-12 Page Create. --*/ #include "odm_precomp.h" -//#if( DM_ODM_SUPPORT_TYPE == ODM_MP) +//#if( DM_ODM_SUPPORT_TYPE == ODM_MP) //#include "Mp_Precomp.h" //#endif @@ -64,26 +64,26 @@ static u1Byte PT_PENALTY[RETRYSIZE+1]={34,31,30,24,0,32}; #if 0 static u1Byte RETRY_PENALTY_IDX[2][RATESIZE] = {{4,4,4,5,4,4,5,7,7,7,8,0x0a, // SS>TH 4,4,4,4,6,0x0a,0x0b,0x0d, - 5,5,7,7,8,0x0b,0x0d,0x0f}, // 0329 R01 + 5,5,7,7,8,0x0b,0x0d,0x0f}, // 0329 R01 {4,4,4,5,7,7,9,9,0x0c,0x0e,0x10,0x12, // SSTH +#if (DM_ODM_SUPPORT_TYPE & ODM_AP) +static u1Byte RETRY_PENALTY_IDX[2][RATESIZE] = {{4,4,4,5,4,4,5,7,7,7,8,0x0a, // SS>TH 4,4,4,4,6,0x0a,0x0b,0x0d, - 5,5,7,7,8,0x0b,0x0d,0x0f}, // 0329 R01 + 5,5,7,7,8,0x0b,0x0d,0x0f}, // 0329 R01 {0x0a,0x0a,0x0a,0x0a,0x0c,0x0c,0x0e,0x10,0x11,0x12,0x12,0x13, // SSTH +static u1Byte RETRY_PENALTY_UP_IDX[RATESIZE] = {0x10,0x10,0x10,0x10,0x11,0x11,0x12,0x12,0x12,0x13,0x13,0x14, // SS>TH 0x13,0x13,0x14,0x14,0x15,0x15,0x15,0x15, - 0x11,0x11,0x12,0x13,0x13,0x13,0x14,0x15}; + 0x11,0x11,0x12,0x13,0x13,0x13,0x14,0x15}; -static u1Byte RSSI_THRESHOLD[RATESIZE] = {0,0,0,0, +static u1Byte RSSI_THRESHOLD[RATESIZE] = {0,0,0,0, 0,0,0,0,0,0x24,0x26,0x2a, 0x13,0x15,0x17,0x18,0x1a,0x1c,0x1d,0x1f, 0,0,0,0x1f,0x23,0x28,0x2a,0x2c}; @@ -92,21 +92,21 @@ static u1Byte RSSI_THRESHOLD[RATESIZE] = {0,0,0,0, // wilson modify static u1Byte RETRY_PENALTY_IDX[2][RATESIZE] = {{4,4,4,5,4,4,5,7,7,7,8,0x0a, // SS>TH 4,4,4,4,6,0x0a,0x0b,0x0d, - 5,5,7,7,8,0x0b,0x0d,0x0f}, // 0329 R01 + 5,5,7,7,8,0x0b,0x0d,0x0f}, // 0329 R01 {0x0a,0x0a,0x0b,0x0c,0x0a,0x0a,0x0b,0x0c,0x0d,0x10,0x13,0x14, // SSTH 0x0f,0x10,0x10,0x12,0x12,0x13,0x14,0x15, - 0x11,0x11,0x12,0x13,0x13,0x13,0x14,0x15}; + 0x11,0x11,0x12,0x13,0x13,0x13,0x14,0x15}; static u1Byte RSSI_THRESHOLD[RATESIZE] = {0,0,0,0, 0,0,0,0,0,0x24,0x26,0x2a, 0x18,0x1a,0x1d,0x1f,0x21,0x27,0x29,0x2a, 0,0,0,0x1f,0x23,0x28,0x2a,0x2c}; -#endif +#endif /*static u1Byte RSSI_THRESHOLD[RATESIZE] = {0,0,0,0, 0,0,0,0,0,0x24,0x26,0x2a, @@ -116,7 +116,7 @@ static u2Byte N_THRESHOLD_HIGH[RATESIZE] = {4,4,8,16, 24,36,48,72,96,144,192,216, 60,80,100,160,240,400,560,640, 300,320,480,720,1000,1200,1600,2000}; -static u2Byte N_THRESHOLD_LOW[RATESIZE] = {2,2,4,8, +static u2Byte N_THRESHOLD_LOW[RATESIZE] = {2,2,4,8, 12,18,24,36,48,72,96,108, 30,40,50,80,120,200,280,320, 150,160,240,360,500,600,800,1000}; @@ -128,7 +128,7 @@ static u1Byte TRYING_NECESSARY[RATESIZE] = {2,2,2,2, static u1Byte POOL_RETRY_TH[RATESIZE] = {30,30,30,30, 30,30,25,25,20,15,15,10, 30,25,25,20,15,10,10,10, - 30,25,25,20,15,10,10,10}; + 30,25,25,20,15,10,10,10}; #endif static u1Byte DROPING_NECESSARY[RATESIZE] = {1,1,1,1, @@ -153,18 +153,18 @@ static u4Byte INIT_RATE_FALLBACK_TABLE[16]={0x0f8ff015, // 0: 40M BGN mode 0, // 13: 0, // 14: 0, // 15: - + }; static u1Byte PendingForRateUpFail[5]={2,10,24,40,60}; static u2Byte DynamicTxRPTTiming[6]={0x186a, 0x30d4, 0x493e, 0x61a8, 0x7a12 ,0x927c}; // 200ms-1200ms // End Rate adaptive parameters -static void +static void odm_SetTxRPTTiming_8188E( IN PDM_ODM_T pDM_Odm, - IN PODM_RA_INFO_T pRaInfo, - IN u1Byte extend + IN PODM_RA_INFO_T pRaInfo, + IN u1Byte extend ) { u1Byte idx = 0; @@ -185,14 +185,14 @@ odm_SetTxRPTTiming_8188E( idx-=1; } pRaInfo->RptTime=DynamicTxRPTTiming[idx]; - + ODM_RT_TRACE(pDM_Odm,ODM_COMP_RATE_ADAPTIVE, ODM_DBG_LOUD, ("pRaInfo->RptTime=0x%x\n", pRaInfo->RptTime)); } -static int +static int odm_RateDown_8188E( IN PDM_ODM_T pDM_Odm, - IN PODM_RA_INFO_T pRaInfo + IN PODM_RA_INFO_T pRaInfo ) { u1Byte RateID, LowestRate, HighestRate; @@ -208,8 +208,8 @@ odm_RateDown_8188E( LowestRate = pRaInfo->LowestRate; HighestRate = pRaInfo->HighestRate; - ODM_RT_TRACE(pDM_Odm,ODM_COMP_RATE_ADAPTIVE, ODM_DBG_TRACE, - (" RateID=%d LowestRate=%d HighestRate=%d RateSGI=%d\n", + ODM_RT_TRACE(pDM_Odm,ODM_COMP_RATE_ADAPTIVE, ODM_DBG_TRACE, + (" RateID=%d LowestRate=%d HighestRate=%d RateSGI=%d\n", RateID, LowestRate, HighestRate, pRaInfo->RateSGI)); if (RateID > HighestRate) { @@ -229,7 +229,7 @@ odm_RateDown_8188E( { RateID=i; goto RateDownFinish; - + } } } @@ -252,7 +252,7 @@ RateDownFinish: if(pRaInfo->RAPendingCounter>=4) pRaInfo->RAPendingCounter=4; - + pRaInfo->DecisionRate=RateID; odm_SetTxRPTTiming_8188E(pDM_Odm,pRaInfo, 2); ODM_RT_TRACE(pDM_Odm,ODM_COMP_RATE_ADAPTIVE, ODM_DBG_LOUD, ("Rate down, RPT Timing default\n")); @@ -262,10 +262,10 @@ RateDownFinish: return 0; } -static int +static int odm_RateUp_8188E( IN PDM_ODM_T pDM_Odm, - IN PODM_RA_INFO_T pRaInfo + IN PODM_RA_INFO_T pRaInfo ) { u1Byte RateID, HighestRate; @@ -279,20 +279,20 @@ odm_RateUp_8188E( } RateID = pRaInfo->PreRate; HighestRate = pRaInfo->HighestRate; - ODM_RT_TRACE(pDM_Odm,ODM_COMP_RATE_ADAPTIVE, ODM_DBG_TRACE, - (" RateID=%d HighestRate=%d\n", + ODM_RT_TRACE(pDM_Odm,ODM_COMP_RATE_ADAPTIVE, ODM_DBG_TRACE, + (" RateID=%d HighestRate=%d\n", RateID, HighestRate)); if (pRaInfo->RAWaitingCounter==1){ pRaInfo->RAWaitingCounter=0; pRaInfo->RAPendingCounter=0; - } + } else if (pRaInfo->RAWaitingCounter>1){ pRaInfo->PreRssiStaRA=pRaInfo->RssiStaRA; goto RateUpfinish; } odm_SetTxRPTTiming_8188E(pDM_Odm,pRaInfo, 0); ODM_RT_TRACE(pDM_Odm,ODM_COMP_RATE_ADAPTIVE, ODM_DBG_LOUD, ("odm_RateUp_8188E():Decrease RPT Timing\n")); - + if (RateID < HighestRate) { for (i=RateID+1; i<=HighestRate; i++) @@ -314,7 +314,7 @@ odm_RateUp_8188E( else //if((sta_info_ra->Decision_rate) > (sta_info_ra->Highest_rate)) { RateID = HighestRate; - + } RateUpfinish: //if(pRaInfo->RAWaitingCounter==10) @@ -337,18 +337,18 @@ static void odm_ResetRaCounter_8188E( IN PODM_RA_INFO_T pRaInfo){ pRaInfo->NscDown=(N_THRESHOLD_HIGH[RateID]+N_THRESHOLD_LOW[RateID])>>1; } -static void +static void odm_RateDecision_8188E( IN PDM_ODM_T pDM_Odm, - IN PODM_RA_INFO_T pRaInfo + IN PODM_RA_INFO_T pRaInfo ) { u1Byte RateID = 0, RtyPtID = 0, PenaltyID1 = 0, PenaltyID2 = 0; //u4Byte pool_retry; static u1Byte DynamicTxRPTTimingCounter=0; - + ODM_RT_TRACE(pDM_Odm,ODM_COMP_RATE_ADAPTIVE, ODM_DBG_TRACE, ("=====>odm_RateDecision_8188E() \n")); - + if (pRaInfo->Active && (pRaInfo->TOTAL > 0)) // STA used and data packet exits { if ( (pRaInfo->RssiStaRA<(pRaInfo->PreRssiStaRA-3))|| (pRaInfo->RssiStaRA>(pRaInfo->PreRssiStaRA+3))){ @@ -358,15 +358,15 @@ odm_RateDecision_8188E( // Start RA decision if (pRaInfo->PreRate > pRaInfo->HighestRate) RateID = pRaInfo->HighestRate; - else + else RateID = pRaInfo->PreRate; if (pRaInfo->RssiStaRA > RSSI_THRESHOLD[RateID]) RtyPtID=0; else RtyPtID=1; PenaltyID1 = RETRY_PENALTY_IDX[RtyPtID][RateID]; //TODO by page - - ODM_RT_TRACE(pDM_Odm,ODM_COMP_RATE_ADAPTIVE, ODM_DBG_TRACE, + + ODM_RT_TRACE(pDM_Odm,ODM_COMP_RATE_ADAPTIVE, ODM_DBG_TRACE, (" NscDown init is %d\n", pRaInfo->NscDown)); //pool_retry=pRaInfo->RTY[2]+pRaInfo->RTY[3]+pRaInfo->RTY[4]+pRaInfo->DROP; pRaInfo->NscDown += pRaInfo->RTY[0] * RETRY_PENALTY[PenaltyID1][0]; @@ -374,33 +374,33 @@ odm_RateDecision_8188E( pRaInfo->NscDown += pRaInfo->RTY[2] * RETRY_PENALTY[PenaltyID1][2]; pRaInfo->NscDown += pRaInfo->RTY[3] * RETRY_PENALTY[PenaltyID1][3]; pRaInfo->NscDown += pRaInfo->RTY[4] * RETRY_PENALTY[PenaltyID1][4]; - ODM_RT_TRACE(pDM_Odm,ODM_COMP_RATE_ADAPTIVE, ODM_DBG_TRACE, - (" NscDown is %d, total*penalty[5] is %d\n", + ODM_RT_TRACE(pDM_Odm,ODM_COMP_RATE_ADAPTIVE, ODM_DBG_TRACE, + (" NscDown is %d, total*penalty[5] is %d\n", pRaInfo->NscDown, (pRaInfo->TOTAL * RETRY_PENALTY[PenaltyID1][5]))); if (pRaInfo->NscDown > (pRaInfo->TOTAL * RETRY_PENALTY[PenaltyID1][5])) pRaInfo->NscDown -= pRaInfo->TOTAL * RETRY_PENALTY[PenaltyID1][5]; else pRaInfo->NscDown=0; - + // rate up PenaltyID2 = RETRY_PENALTY_UP_IDX[RateID]; - ODM_RT_TRACE(pDM_Odm,ODM_COMP_RATE_ADAPTIVE, ODM_DBG_TRACE, + ODM_RT_TRACE(pDM_Odm,ODM_COMP_RATE_ADAPTIVE, ODM_DBG_TRACE, (" NscUp init is %d\n", pRaInfo->NscUp)); pRaInfo->NscUp += pRaInfo->RTY[0] * RETRY_PENALTY[PenaltyID2][0]; pRaInfo->NscUp += pRaInfo->RTY[1] * RETRY_PENALTY[PenaltyID2][1]; pRaInfo->NscUp += pRaInfo->RTY[2] * RETRY_PENALTY[PenaltyID2][2]; pRaInfo->NscUp += pRaInfo->RTY[3] * RETRY_PENALTY[PenaltyID2][3]; pRaInfo->NscUp += pRaInfo->RTY[4] * RETRY_PENALTY[PenaltyID2][4]; - ODM_RT_TRACE(pDM_Odm,ODM_COMP_RATE_ADAPTIVE, ODM_DBG_TRACE, - ("NscUp is %d, total*up[5] is %d\n", + ODM_RT_TRACE(pDM_Odm,ODM_COMP_RATE_ADAPTIVE, ODM_DBG_TRACE, + ("NscUp is %d, total*up[5] is %d\n", pRaInfo->NscUp, (pRaInfo->TOTAL * RETRY_PENALTY[PenaltyID2][5]))); if (pRaInfo->NscUp > (pRaInfo->TOTAL * RETRY_PENALTY[PenaltyID2][5])) pRaInfo->NscUp -= pRaInfo->TOTAL * RETRY_PENALTY[PenaltyID2][5]; else pRaInfo->NscUp = 0; - - ODM_RT_TRACE(pDM_Odm,ODM_COMP_RATE_ADAPTIVE|ODM_COMP_INIT, ODM_DBG_LOUD, - (" RssiStaRa= %d RtyPtID=%d PenaltyID1=0x%x PenaltyID2=0x%x RateID=%d NscDown=%d NscUp=%d SGI=%d\n", + + ODM_RT_TRACE(pDM_Odm,ODM_COMP_RATE_ADAPTIVE|ODM_COMP_INIT, ODM_DBG_LOUD, + (" RssiStaRa= %d RtyPtID=%d PenaltyID1=0x%x PenaltyID2=0x%x RateID=%d NscDown=%d NscUp=%d SGI=%d\n", pRaInfo->RssiStaRA,RtyPtID, PenaltyID1,PenaltyID2, RateID, pRaInfo->NscDown, pRaInfo->NscUp, pRaInfo->RateSGI)); if ((pRaInfo->NscDown < N_THRESHOLD_LOW[RateID]) ||(pRaInfo->DROP>DROPING_NECESSARY[RateID])) odm_RateDown_8188E(pDM_Odm,pRaInfo); @@ -410,8 +410,8 @@ odm_RateDecision_8188E( if(pRaInfo->DecisionRate > pRaInfo->HighestRate) pRaInfo->DecisionRate = pRaInfo->HighestRate; - - if ((pRaInfo->DecisionRate)==(pRaInfo->PreRate)) + + if ((pRaInfo->DecisionRate)==(pRaInfo->PreRate)) DynamicTxRPTTimingCounter+=1; else DynamicTxRPTTimingCounter=0; @@ -429,10 +429,10 @@ odm_RateDecision_8188E( ODM_RT_TRACE(pDM_Odm,ODM_COMP_RATE_ADAPTIVE, ODM_DBG_TRACE, ("<=====odm_RateDecision_8188E() \n")); } -static int +static int odm_ARFBRefresh_8188E( - IN PDM_ODM_T pDM_Odm, - IN PODM_RA_INFO_T pRaInfo + IN PDM_ODM_T pDM_Odm, + IN PODM_RA_INFO_T pRaInfo ) { // Wilson 2011/10/26 u4Byte MaskFromReg; @@ -460,7 +460,7 @@ odm_ARFBRefresh_8188E( case RATR_INX_WIRELESS_B: pRaInfo->RAUseRate=(pRaInfo->RateMask)&0x0000000d; break; - case 12: + case 12: MaskFromReg=ODM_Read4Byte(pDM_Odm, REG_ARFR0); pRaInfo->RAUseRate=(pRaInfo->RateMask)&MaskFromReg; break; @@ -476,7 +476,7 @@ odm_ARFBRefresh_8188E( MaskFromReg=ODM_Read4Byte(pDM_Odm, REG_ARFR3); pRaInfo->RAUseRate=(pRaInfo->RateMask)&MaskFromReg; break; - + default: pRaInfo->RAUseRate=(pRaInfo->RateMask); break; @@ -508,7 +508,7 @@ odm_ARFBRefresh_8188E( else{ pRaInfo->LowestRate=0; } - + #if POWER_TRAINING_ACTIVE == 1 if (pRaInfo->HighestRate >0x13) pRaInfo->PTModeSS=3; @@ -518,41 +518,41 @@ odm_ARFBRefresh_8188E( pRaInfo->PTModeSS=1; else pRaInfo->PTModeSS=0; - ODM_RT_TRACE(pDM_Odm,ODM_COMP_RATE_ADAPTIVE, ODM_DBG_LOUD, + ODM_RT_TRACE(pDM_Odm,ODM_COMP_RATE_ADAPTIVE, ODM_DBG_LOUD, ("ODM_ARFBRefresh_8188E(): PTModeSS=%d\n", pRaInfo->PTModeSS)); - + #endif if(pRaInfo->DecisionRate > pRaInfo->HighestRate) pRaInfo->DecisionRate = pRaInfo->HighestRate; - - ODM_RT_TRACE(pDM_Odm,ODM_COMP_RATE_ADAPTIVE, ODM_DBG_LOUD, - ("ODM_ARFBRefresh_8188E(): RateID=%d RateMask=%8.8x RAUseRate=%8.8x HighestRate=%d,DecisionRate=%d \n", + + ODM_RT_TRACE(pDM_Odm,ODM_COMP_RATE_ADAPTIVE, ODM_DBG_LOUD, + ("ODM_ARFBRefresh_8188E(): RateID=%d RateMask=%8.8x RAUseRate=%8.8x HighestRate=%d,DecisionRate=%d \n", pRaInfo->RateID, pRaInfo->RateMask, pRaInfo->RAUseRate, pRaInfo->HighestRate,pRaInfo->DecisionRate)); return 0; } #if POWER_TRAINING_ACTIVE == 1 -static void +static void odm_PTTryState_8188E( - IN PODM_RA_INFO_T pRaInfo + IN PODM_RA_INFO_T pRaInfo ) { pRaInfo->PTTryState=0; switch (pRaInfo->PTModeSS) { - case 3: - if (pRaInfo->DecisionRate>=0x19) + case 3: + if (pRaInfo->DecisionRate>=0x19) pRaInfo->PTTryState=1; break; case 2: if (pRaInfo->DecisionRate>=0x11) pRaInfo->PTTryState=1; - break; + break; case 1: if (pRaInfo->DecisionRate>=0x0a) pRaInfo->PTTryState=1; - break; + break; case 0: if (pRaInfo->DecisionRate>=0x03) pRaInfo->PTTryState=1; @@ -579,7 +579,7 @@ odm_PTTryState_8188E( pRaInfo->PTPreRssi=pRaInfo->RssiStaRA; pRaInfo->PTStopCount=0; - + } else{ pRaInfo->RAstage=0; @@ -593,9 +593,9 @@ odm_PTTryState_8188E( pRaInfo->PTPreRate=pRaInfo->DecisionRate; } -static void +static void odm_PTDecision_8188E( - IN PODM_RA_INFO_T pRaInfo + IN PODM_RA_INFO_T pRaInfo ) { u1Byte stage_BUF; @@ -604,7 +604,7 @@ odm_PTDecision_8188E( u4Byte numsc; u4Byte num_total; u1Byte stage_id; - + stage_BUF=pRaInfo->PTStage; numsc = 0; num_total= pRaInfo->TOTAL* PT_PENALTY[5]; @@ -621,7 +621,7 @@ odm_PTDecision_8188E( stage_id=temp_stage-j; else stage_id=0; - + pRaInfo->PTSmoothFactor=(pRaInfo->PTSmoothFactor>>1) + (pRaInfo->PTSmoothFactor>>2) + stage_id*16+2; if (pRaInfo->PTSmoothFactor>192) pRaInfo->PTSmoothFactor=192; @@ -639,31 +639,31 @@ odm_PTDecision_8188E( static VOID odm_RATxRPTTimerSetting( IN PDM_ODM_T pDM_Odm, - IN u2Byte minRptTime + IN u2Byte minRptTime ) { ODM_RT_TRACE(pDM_Odm,ODM_COMP_RATE_ADAPTIVE, ODM_DBG_TRACE,(" =====>odm_RATxRPTTimerSetting()\n")); - - + + if(pDM_Odm->CurrminRptTime != minRptTime){ - ODM_RT_TRACE(pDM_Odm,ODM_COMP_RATE_ADAPTIVE, ODM_DBG_LOUD, + ODM_RT_TRACE(pDM_Odm,ODM_COMP_RATE_ADAPTIVE, ODM_DBG_LOUD, (" CurrminRptTime =0x%04x minRptTime=0x%04x\n", pDM_Odm->CurrminRptTime, minRptTime)); #if(DM_ODM_SUPPORT_TYPE & (ODM_MP|ODM_AP)) - ODM_RA_Set_TxRPT_Time(pDM_Odm,minRptTime); + ODM_RA_Set_TxRPT_Time(pDM_Odm,minRptTime); #else rtw_rpt_timer_cfg_cmd(pDM_Odm->Adapter,minRptTime); - #endif + #endif pDM_Odm->CurrminRptTime = minRptTime; } ODM_RT_TRACE(pDM_Odm,ODM_COMP_RATE_ADAPTIVE, ODM_DBG_TRACE,(" <=====odm_RATxRPTTimerSetting()\n")); } - + VOID ODM_RASupport_Init( IN PDM_ODM_T pDM_Odm ) -{ +{ ODM_RT_TRACE(pDM_Odm,ODM_COMP_RATE_ADAPTIVE, ODM_DBG_LOUD, ("=====>ODM_RASupport_Init()\n")); // 2012/02/14 MH Be noticed, the init must be after IC type is recognized!!!!! @@ -674,10 +674,10 @@ ODM_RASupport_Init( -int +int ODM_RAInfo_Init( - IN PDM_ODM_T pDM_Odm, - IN u1Byte MacID + IN PDM_ODM_T pDM_Odm, + IN u1Byte MacID ) { PODM_RA_INFO_T pRaInfo = &pDM_Odm->RAInfo[MacID]; @@ -685,7 +685,7 @@ ODM_RAInfo_Init( u1Byte WirelessMode=0xFF; //invalid value u1Byte max_rate_idx = 0x13; //MCS7 if(pDM_Odm->pWirelessMode!=NULL){ - WirelessMode=*(pDM_Odm->pWirelessMode); + WirelessMode=*(pDM_Odm->pWirelessMode); } if(WirelessMode != 0xFF ){ @@ -696,19 +696,19 @@ ODM_RAInfo_Init( else if(WirelessMode & ODM_WM_B) max_rate_idx = 0x03; } - + //printk("%s ==>WirelessMode:0x%08x ,max_raid_idx:0x%02x\n ",__FUNCTION__,WirelessMode,max_rate_idx); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_RATE_ADAPTIVE, ODM_DBG_LOUD, - ("ODM_RAInfo_Init(): WirelessMode:0x%08x ,max_raid_idx:0x%02x \n", + ODM_RT_TRACE(pDM_Odm,ODM_COMP_RATE_ADAPTIVE, ODM_DBG_LOUD, + ("ODM_RAInfo_Init(): WirelessMode:0x%08x ,max_raid_idx:0x%02x \n", WirelessMode,max_rate_idx)); - + pRaInfo->DecisionRate = max_rate_idx; pRaInfo->PreRate = max_rate_idx; pRaInfo->HighestRate=max_rate_idx; - #else - pRaInfo->DecisionRate = 0x13; - pRaInfo->PreRate = 0x13; - pRaInfo->HighestRate= 0x13; + #else + pRaInfo->DecisionRate = 0x13; + pRaInfo->PreRate = 0x13; + pRaInfo->HighestRate= 0x13; #endif pRaInfo->LowestRate=0; pRaInfo->RateID=0; @@ -746,7 +746,7 @@ ODM_RAInfo_Init( return 0; } -int +int ODM_RAInfo_Init_all( IN PDM_ODM_T pDM_Odm ) @@ -765,21 +765,21 @@ ODM_RAInfo_Init_all( u1Byte ODM_RA_GetShortGI_8188E( - IN PDM_ODM_T pDM_Odm, - IN u1Byte MacID + IN PDM_ODM_T pDM_Odm, + IN u1Byte MacID ) { if((NULL == pDM_Odm) || (MacID >= ASSOCIATE_ENTRY_NUM)) return 0; - ODM_RT_TRACE(pDM_Odm,ODM_COMP_RATE_ADAPTIVE, ODM_DBG_TRACE, + ODM_RT_TRACE(pDM_Odm,ODM_COMP_RATE_ADAPTIVE, ODM_DBG_TRACE, ("MacID=%d SGI=%d\n", MacID, pDM_Odm->RAInfo[MacID].RateSGI)); return pDM_Odm->RAInfo[MacID].RateSGI; } -u1Byte +u1Byte ODM_RA_GetDecisionRate_8188E( - IN PDM_ODM_T pDM_Odm, - IN u1Byte MacID + IN PDM_ODM_T pDM_Odm, + IN u1Byte MacID ) { u1Byte DecisionRate = 0; @@ -787,43 +787,43 @@ ODM_RA_GetDecisionRate_8188E( if((NULL == pDM_Odm) || (MacID >= ASSOCIATE_ENTRY_NUM)) return 0; DecisionRate = (pDM_Odm->RAInfo[MacID].DecisionRate); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_RATE_ADAPTIVE, ODM_DBG_TRACE, + ODM_RT_TRACE(pDM_Odm,ODM_COMP_RATE_ADAPTIVE, ODM_DBG_TRACE, (" MacID=%d DecisionRate=0x%x\n", MacID, DecisionRate)); return DecisionRate; } u1Byte ODM_RA_GetHwPwrStatus_8188E( - IN PDM_ODM_T pDM_Odm, - IN u1Byte MacID + IN PDM_ODM_T pDM_Odm, + IN u1Byte MacID ) { u1Byte PTStage = 5; if((NULL == pDM_Odm) || (MacID >= ASSOCIATE_ENTRY_NUM)) return 0; PTStage = (pDM_Odm->RAInfo[MacID].PTStage); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_RATE_ADAPTIVE, ODM_DBG_TRACE, + ODM_RT_TRACE(pDM_Odm,ODM_COMP_RATE_ADAPTIVE, ODM_DBG_TRACE, ("MacID=%d PTStage=0x%x\n", MacID, PTStage)); return PTStage; } -VOID +VOID ODM_RA_UpdateRateInfo_8188E( IN PDM_ODM_T pDM_Odm, IN u1Byte MacID, - IN u1Byte RateID, + IN u1Byte RateID, IN u4Byte RateMask, IN u1Byte SGIEnable ) { PODM_RA_INFO_T pRaInfo = NULL; - ODM_RT_TRACE(pDM_Odm,ODM_COMP_RATE_ADAPTIVE, ODM_DBG_LOUD, - ("MacID=%d RateID=0x%x RateMask=0x%x SGIEnable=%d\n", + ODM_RT_TRACE(pDM_Odm,ODM_COMP_RATE_ADAPTIVE, ODM_DBG_LOUD, + ("MacID=%d RateID=0x%x RateMask=0x%x SGIEnable=%d\n", MacID, RateID, RateMask, SGIEnable)); if((NULL == pDM_Odm) || (MacID >= ASSOCIATE_ENTRY_NUM)) return; - + pRaInfo = &(pDM_Odm->RAInfo[MacID]); pRaInfo->RateID = RateID; pRaInfo->RateMask = RateMask; @@ -831,16 +831,16 @@ ODM_RA_UpdateRateInfo_8188E( odm_ARFBRefresh_8188E(pDM_Odm, pRaInfo); } -VOID +VOID ODM_RA_SetRSSI_8188E( - IN PDM_ODM_T pDM_Odm, - IN u1Byte MacID, - IN u1Byte Rssi + IN PDM_ODM_T pDM_Odm, + IN u1Byte MacID, + IN u1Byte Rssi ) { PODM_RA_INFO_T pRaInfo = NULL; - ODM_RT_TRACE(pDM_Odm,ODM_COMP_RATE_ADAPTIVE, ODM_DBG_TRACE, + ODM_RT_TRACE(pDM_Odm,ODM_COMP_RATE_ADAPTIVE, ODM_DBG_TRACE, (" MacID=%d Rssi=%d\n", MacID, Rssi)); if((NULL == pDM_Odm) || (MacID >= ASSOCIATE_ENTRY_NUM)) return; @@ -849,10 +849,10 @@ ODM_RA_SetRSSI_8188E( pRaInfo->RssiStaRA = Rssi; } -VOID +VOID ODM_RA_Set_TxRPT_Time( IN PDM_ODM_T pDM_Odm, - IN u2Byte minRptTime + IN u2Byte minRptTime ) { #if(DM_ODM_SUPPORT_TYPE & (ODM_AP)) @@ -863,7 +863,7 @@ ODM_RA_Set_TxRPT_Time( VOID -ODM_RA_TxRPT2Handle_8188E( +ODM_RA_TxRPT2Handle_8188E( IN PDM_ODM_T pDM_Odm, IN pu1Byte TxRPT_Buf, IN u2Byte TxRPT_Len, @@ -875,11 +875,11 @@ ODM_RA_TxRPT2Handle_8188E( u1Byte MacId = 0; pu1Byte pBuffer = NULL; u4Byte valid = 0, ItemNum = 0; - u2Byte minRptTime = 0x927c; + u2Byte minRptTime = 0x927c; ODM_RT_TRACE(pDM_Odm,ODM_COMP_RATE_ADAPTIVE, ODM_DBG_LOUD, ("=====>ODM_RA_TxRPT2Handle_8188E(): valid0=%d valid1=%d BufferLength=%d\n", MacIDValidEntry0, MacIDValidEntry1, TxRPT_Len)); - + ItemNum = TxRPT_Len >> 3; pBuffer = TxRPT_Buf; @@ -921,8 +921,8 @@ ODM_RA_TxRPT2Handle_8188E( pRAInfo->DROP; if(pRAInfo->TOTAL != 0) { - ODM_RT_TRACE(pDM_Odm,ODM_COMP_RATE_ADAPTIVE, ODM_DBG_LOUD, - ("macid=%d Total=%d R0=%d R1=%d R2=%d R3=%d R4=%d D0=%d valid0=%x valid1=%x\n", + ODM_RT_TRACE(pDM_Odm,ODM_COMP_RATE_ADAPTIVE, ODM_DBG_LOUD, + ("macid=%d Total=%d R0=%d R1=%d R2=%d R3=%d R4=%d D0=%d valid0=%x valid1=%x\n", MacId, pRAInfo->TOTAL, pRAInfo->RTY[0], @@ -964,11 +964,11 @@ ODM_RA_TxRPT2Handle_8188E( #ifdef DETECT_STA_EXISTANCE void RTL8188E_DetectSTAExistance(PDM_ODM_T pDM_Odm, PODM_RA_INFO_T pRAInfo, int MacID); RTL8188E_DetectSTAExistance(pDM_Odm, pRAInfo, MacId); -#endif +#endif #endif - ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_LOUD, - ("macid=%d R0=%d R1=%d R2=%d R3=%d R4=%d drop=%d valid0=%x RateID=%d SGI=%d\n", + ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_LOUD, + ("macid=%d R0=%d R1=%d R2=%d R3=%d R4=%d drop=%d valid0=%x RateID=%d SGI=%d\n", MacId, pRAInfo->RTY[0], pRAInfo->RTY[1], @@ -985,14 +985,14 @@ ODM_RA_TxRPT2Handle_8188E( } if(minRptTime > pRAInfo->RptTime) - minRptTime = pRAInfo->RptTime; + minRptTime = pRAInfo->RptTime; pBuffer += TX_RPT2_ITEM_SIZE; MacId++; }while(MacId < ItemNum); - + odm_RATxRPTTimerSetting(pDM_Odm,minRptTime); - + ODM_RT_TRACE(pDM_Odm,ODM_COMP_RATE_ADAPTIVE, ODM_DBG_LOUD, ("<===== ODM_RA_TxRPT2Handle_8188E()\n")); } @@ -1002,7 +1002,7 @@ ODM_RA_TxRPT2Handle_8188E( static VOID odm_RATxRPTTimerSetting( IN PDM_ODM_T pDM_Odm, - IN u2Byte minRptTime + IN u2Byte minRptTime ) { return; @@ -1011,22 +1011,22 @@ odm_RATxRPTTimerSetting( VOID ODM_RASupport_Init( - IN PDM_ODM_T pDM_Odm + IN PDM_ODM_T pDM_Odm ) { return; } -int +int ODM_RAInfo_Init( - IN PDM_ODM_T pDM_Odm, - IN u1Byte MacID + IN PDM_ODM_T pDM_Odm, + IN u1Byte MacID ) { return 0; } -int +int ODM_RAInfo_Init_all( IN PDM_ODM_T pDM_Odm ) @@ -1034,37 +1034,37 @@ ODM_RAInfo_Init_all( return 0; } -u1Byte +u1Byte ODM_RA_GetShortGI_8188E( - IN PDM_ODM_T pDM_Odm, - IN u1Byte MacID + IN PDM_ODM_T pDM_Odm, + IN u1Byte MacID ) { return 0; } -u1Byte +u1Byte ODM_RA_GetDecisionRate_8188E( - IN PDM_ODM_T pDM_Odm, - IN u1Byte MacID + IN PDM_ODM_T pDM_Odm, + IN u1Byte MacID ) { return 0; } u1Byte ODM_RA_GetHwPwrStatus_8188E( - IN PDM_ODM_T pDM_Odm, - IN u1Byte MacID + IN PDM_ODM_T pDM_Odm, + IN u1Byte MacID ) { return 0; } -VOID +VOID ODM_RA_UpdateRateInfo_8188E( IN PDM_ODM_T pDM_Odm, IN u1Byte MacID, - IN u1Byte RateID, + IN u1Byte RateID, IN u4Byte RateMask, IN u1Byte SGIEnable ) @@ -1072,27 +1072,27 @@ ODM_RA_UpdateRateInfo_8188E( return; } -VOID +VOID ODM_RA_SetRSSI_8188E( - IN PDM_ODM_T pDM_Odm, - IN u1Byte MacID, - IN u1Byte Rssi - ) -{ - return; -} - -VOID -ODM_RA_Set_TxRPT_Time( IN PDM_ODM_T pDM_Odm, - IN u2Byte minRptTime + IN u1Byte MacID, + IN u1Byte Rssi ) { return; } VOID -ODM_RA_TxRPT2Handle_8188E( +ODM_RA_Set_TxRPT_Time( + IN PDM_ODM_T pDM_Odm, + IN u2Byte minRptTime + ) +{ + return; +} + +VOID +ODM_RA_TxRPT2Handle_8188E( IN PDM_ODM_T pDM_Odm, IN pu1Byte TxRPT_Buf, IN u2Byte TxRPT_Len, @@ -1102,7 +1102,6 @@ ODM_RA_TxRPT2Handle_8188E( { return; } - + #endif - diff --git a/hal/HalHWImg8188E_BB.c b/hal/HalHWImg8188E_BB.c index f6d559f..ec2e62b 100755 --- a/hal/HalHWImg8188E_BB.c +++ b/hal/HalHWImg8188E_BB.c @@ -1,1448 +1,1447 @@ -/****************************************************************************** -* -* 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 -* -* -******************************************************************************/ - -#include "odm_precomp.h" - -#ifdef CONFIG_IOL_IOREG_CFG -#include -#endif - -#if (RTL8188E_SUPPORT == 1) -static BOOLEAN -CheckCondition( - const u4Byte Condition, - const u4Byte Hex - ) -{ - u4Byte _board = (Hex & 0x000000FF); - u4Byte _interface = (Hex & 0x0000FF00) >> 8; - u4Byte _platform = (Hex & 0x00FF0000) >> 16; - u4Byte cond = Condition; - - if ( Condition == 0xCDCDCDCD ) - return TRUE; - - cond = Condition & 0x000000FF; - if ( (_board != cond) && (cond != 0xFF) ) - return FALSE; - - cond = Condition & 0x0000FF00; - cond = cond >> 8; - if ( ((_interface & cond) == 0) && (cond != 0x07) ) - return FALSE; - - cond = Condition & 0x00FF0000; - cond = cond >> 16; - if ( ((_platform & cond) == 0) && (cond != 0x0F) ) - return FALSE; - return TRUE; -} - - -/****************************************************************************** -* AGC_TAB_1T.TXT -******************************************************************************/ - -u4Byte Array_AGC_TAB_1T_8188E[] = { -0xFF0F0718, 0xABCD, - 0xC78, 0xF7000001, - 0xC78, 0xF6010001, - 0xC78, 0xF5020001, - 0xC78, 0xF4030001, - 0xC78, 0xF3040001, - 0xC78, 0xF2050001, - 0xC78, 0xF1060001, - 0xC78, 0xF0070001, - 0xC78, 0xEF080001, - 0xC78, 0xEE090001, - 0xC78, 0xED0A0001, - 0xC78, 0xEC0B0001, - 0xC78, 0xEB0C0001, - 0xC78, 0xEA0D0001, - 0xC78, 0xE90E0001, - 0xC78, 0xE80F0001, - 0xC78, 0xE7100001, - 0xC78, 0xE6110001, - 0xC78, 0xE5120001, - 0xC78, 0xE4130001, - 0xC78, 0xE3140001, - 0xC78, 0xE2150001, - 0xC78, 0xE1160001, - 0xC78, 0x89170001, - 0xC78, 0x88180001, - 0xC78, 0x87190001, - 0xC78, 0x861A0001, - 0xC78, 0x851B0001, - 0xC78, 0x841C0001, - 0xC78, 0x831D0001, - 0xC78, 0x821E0001, - 0xC78, 0x811F0001, - 0xC78, 0x6B200001, - 0xC78, 0x6A210001, - 0xC78, 0x69220001, - 0xC78, 0x68230001, - 0xC78, 0x67240001, - 0xC78, 0x66250001, - 0xC78, 0x65260001, - 0xC78, 0x64270001, - 0xC78, 0x63280001, - 0xC78, 0x62290001, - 0xC78, 0x612A0001, - 0xC78, 0x462B0001, - 0xC78, 0x452C0001, - 0xC78, 0x442D0001, - 0xC78, 0x432E0001, - 0xC78, 0x422F0001, - 0xC78, 0x41300001, - 0xC78, 0x40310001, - 0xC78, 0x40320001, - 0xC78, 0x40330001, - 0xC78, 0x40340001, - 0xC78, 0x40350001, - 0xC78, 0x40360001, - 0xC78, 0x40370001, - 0xC78, 0x40380001, - 0xC78, 0x40390001, - 0xC78, 0x403A0001, - 0xC78, 0x403B0001, - 0xC78, 0x403C0001, - 0xC78, 0x403D0001, - 0xC78, 0x403E0001, - 0xC78, 0x403F0001, - 0xCDCDCDCD, 0xCDCD, - 0xC78, 0xFB000001, - 0xC78, 0xFB010001, - 0xC78, 0xFB020001, - 0xC78, 0xFB030001, - 0xC78, 0xFB040001, - 0xC78, 0xFB050001, - 0xC78, 0xFA060001, - 0xC78, 0xF9070001, - 0xC78, 0xF8080001, - 0xC78, 0xF7090001, - 0xC78, 0xF60A0001, - 0xC78, 0xF50B0001, - 0xC78, 0xF40C0001, - 0xC78, 0xF30D0001, - 0xC78, 0xF20E0001, - 0xC78, 0xF10F0001, - 0xC78, 0xF0100001, - 0xC78, 0xEF110001, - 0xC78, 0xEE120001, - 0xC78, 0xED130001, - 0xC78, 0xEC140001, - 0xC78, 0xEB150001, - 0xC78, 0xEA160001, - 0xC78, 0xE9170001, - 0xC78, 0xE8180001, - 0xC78, 0xE7190001, - 0xC78, 0xE61A0001, - 0xC78, 0xE51B0001, - 0xC78, 0xE41C0001, - 0xC78, 0xE31D0001, - 0xC78, 0xE21E0001, - 0xC78, 0xE11F0001, - 0xC78, 0x8A200001, - 0xC78, 0x89210001, - 0xC78, 0x88220001, - 0xC78, 0x87230001, - 0xC78, 0x86240001, - 0xC78, 0x85250001, - 0xC78, 0x84260001, - 0xC78, 0x83270001, - 0xC78, 0x82280001, - 0xC78, 0x6B290001, - 0xC78, 0x6A2A0001, - 0xC78, 0x692B0001, - 0xC78, 0x682C0001, - 0xC78, 0x672D0001, - 0xC78, 0x662E0001, - 0xC78, 0x652F0001, - 0xC78, 0x64300001, - 0xC78, 0x63310001, - 0xC78, 0x62320001, - 0xC78, 0x61330001, - 0xC78, 0x46340001, - 0xC78, 0x45350001, - 0xC78, 0x44360001, - 0xC78, 0x43370001, - 0xC78, 0x42380001, - 0xC78, 0x41390001, - 0xC78, 0x403A0001, - 0xC78, 0x403B0001, - 0xC78, 0x403C0001, - 0xC78, 0x403D0001, - 0xC78, 0x403E0001, - 0xC78, 0x403F0001, - 0xFF0F0718, 0xDEAD, - 0xFF0F0718, 0xABCD, - 0xC78, 0xFB400001, - 0xC78, 0xFA410001, - 0xC78, 0xF9420001, - 0xC78, 0xF8430001, - 0xC78, 0xF7440001, - 0xC78, 0xF6450001, - 0xC78, 0xF5460001, - 0xC78, 0xF4470001, - 0xC78, 0xF3480001, - 0xC78, 0xF2490001, - 0xC78, 0xF14A0001, - 0xC78, 0xF04B0001, - 0xC78, 0xEF4C0001, - 0xC78, 0xEE4D0001, - 0xC78, 0xED4E0001, - 0xC78, 0xEC4F0001, - 0xC78, 0xEB500001, - 0xC78, 0xEA510001, - 0xC78, 0xE9520001, - 0xC78, 0xE8530001, - 0xC78, 0xE7540001, - 0xC78, 0xE6550001, - 0xC78, 0xE5560001, - 0xC78, 0xE4570001, - 0xC78, 0xE3580001, - 0xC78, 0xE2590001, - 0xC78, 0xC35A0001, - 0xC78, 0xC25B0001, - 0xC78, 0xC15C0001, - 0xC78, 0x8B5D0001, - 0xC78, 0x8A5E0001, - 0xC78, 0x895F0001, - 0xC78, 0x88600001, - 0xC78, 0x87610001, - 0xC78, 0x86620001, - 0xC78, 0x85630001, - 0xC78, 0x84640001, - 0xC78, 0x67650001, - 0xC78, 0x66660001, - 0xC78, 0x65670001, - 0xC78, 0x64680001, - 0xC78, 0x63690001, - 0xC78, 0x626A0001, - 0xC78, 0x616B0001, - 0xC78, 0x606C0001, - 0xC78, 0x466D0001, - 0xC78, 0x456E0001, - 0xC78, 0x446F0001, - 0xC78, 0x43700001, - 0xC78, 0x42710001, - 0xC78, 0x41720001, - 0xC78, 0x40730001, - 0xC78, 0x40740001, - 0xC78, 0x40750001, - 0xC78, 0x40760001, - 0xC78, 0x40770001, - 0xC78, 0x40780001, - 0xC78, 0x40790001, - 0xC78, 0x407A0001, - 0xC78, 0x407B0001, - 0xC78, 0x407C0001, - 0xC78, 0x407D0001, - 0xC78, 0x407E0001, - 0xC78, 0x407F0001, - 0xCDCDCDCD, 0xCDCD, - 0xC78, 0xFB400001, - 0xC78, 0xFB410001, - 0xC78, 0xFB420001, - 0xC78, 0xFB430001, - 0xC78, 0xFB440001, - 0xC78, 0xFB450001, - 0xC78, 0xFB460001, - 0xC78, 0xFB470001, - 0xC78, 0xFB480001, - 0xC78, 0xFA490001, - 0xC78, 0xF94A0001, - 0xC78, 0xF84B0001, - 0xC78, 0xF74C0001, - 0xC78, 0xF64D0001, - 0xC78, 0xF54E0001, - 0xC78, 0xF44F0001, - 0xC78, 0xF3500001, - 0xC78, 0xF2510001, - 0xC78, 0xF1520001, - 0xC78, 0xF0530001, - 0xC78, 0xEF540001, - 0xC78, 0xEE550001, - 0xC78, 0xED560001, - 0xC78, 0xEC570001, - 0xC78, 0xEB580001, - 0xC78, 0xEA590001, - 0xC78, 0xE95A0001, - 0xC78, 0xE85B0001, - 0xC78, 0xE75C0001, - 0xC78, 0xE65D0001, - 0xC78, 0xE55E0001, - 0xC78, 0xE45F0001, - 0xC78, 0xE3600001, - 0xC78, 0xE2610001, - 0xC78, 0xC3620001, - 0xC78, 0xC2630001, - 0xC78, 0xC1640001, - 0xC78, 0x8B650001, - 0xC78, 0x8A660001, - 0xC78, 0x89670001, - 0xC78, 0x88680001, - 0xC78, 0x87690001, - 0xC78, 0x866A0001, - 0xC78, 0x856B0001, - 0xC78, 0x846C0001, - 0xC78, 0x676D0001, - 0xC78, 0x666E0001, - 0xC78, 0x656F0001, - 0xC78, 0x64700001, - 0xC78, 0x63710001, - 0xC78, 0x62720001, - 0xC78, 0x61730001, - 0xC78, 0x60740001, - 0xC78, 0x46750001, - 0xC78, 0x45760001, - 0xC78, 0x44770001, - 0xC78, 0x43780001, - 0xC78, 0x42790001, - 0xC78, 0x417A0001, - 0xC78, 0x407B0001, - 0xC78, 0x407C0001, - 0xC78, 0x407D0001, - 0xC78, 0x407E0001, - 0xC78, 0x407F0001, - 0xFF0F0718, 0xDEAD, - 0xC50, 0x69553422, - 0xC50, 0x69553420, - -}; - -HAL_STATUS -ODM_ReadAndConfig_AGC_TAB_1T_8188E( - IN PDM_ODM_T pDM_Odm - ) -{ - #define READ_NEXT_PAIR(v1, v2, i) do { i += 2; v1 = Array[i]; v2 = Array[i+1]; } while(0) - - u4Byte hex = 0; - u4Byte i = 0; - u2Byte count = 0; - pu4Byte ptr_array = NULL; - u1Byte platform = pDM_Odm->SupportPlatform; - u1Byte interfaceValue = pDM_Odm->SupportInterface; - u1Byte board = pDM_Odm->BoardType; - u4Byte ArrayLen = sizeof(Array_AGC_TAB_1T_8188E)/sizeof(u4Byte); - pu4Byte Array = Array_AGC_TAB_1T_8188E; - BOOLEAN biol = FALSE; -#ifdef CONFIG_IOL_IOREG_CFG - PADAPTER Adapter = pDM_Odm->Adapter; - struct xmit_frame *pxmit_frame; - u8 bndy_cnt=1; -#endif//#ifdef CONFIG_IOL_IOREG_CFG - HAL_STATUS rst =HAL_STATUS_SUCCESS; - - hex += board; - hex += interfaceValue << 8; - hex += platform << 16; - hex += 0xFF000000; -#ifdef CONFIG_IOL_IOREG_CFG - biol = rtw_IOL_applied(Adapter); - - if(biol){ - if((pxmit_frame= rtw_IOL_accquire_xmit_frame(Adapter)) == NULL){ - printk("rtw_IOL_accquire_xmit_frame failed\n"); - return HAL_STATUS_FAILURE; - } - } -#endif//#ifdef CONFIG_IOL_IOREG_CFG - - for (i = 0; i < ArrayLen; i += 2 ) - { - u4Byte v1 = Array[i]; - u4Byte v2 = Array[i+1]; - - // This (offset, data) pair meets the condition. - if ( v1 < 0xCDCDCDCD ) - { - #ifdef CONFIG_IOL_IOREG_CFG - if(biol){ - if(rtw_IOL_cmd_boundary_handle(pxmit_frame)) - bndy_cnt++; - rtw_IOL_append_WD_cmd(pxmit_frame,(u2Byte)v1, v2,bMaskDWord); - } - else - #endif //#ifdef CONFIG_IOL_IOREG_CFG - { - odm_ConfigBB_AGC_8188E(pDM_Odm, v1, bMaskDWord, v2); - } - continue; - } - else - { // This line is the start line of branch. - if ( !CheckCondition(Array[i], hex) ) - { // Discard the following (offset, data) pairs. - READ_NEXT_PAIR(v1, v2, i); - while ( v2 != 0xDEAD && - v2 != 0xCDEF && - v2 != 0xCDCD && i < ArrayLen -2) - { - READ_NEXT_PAIR(v1, v2, i); - } - i -= 2; // prevent from for-loop += 2 - } - else // Configure matched pairs and skip to end of if-else. - { - READ_NEXT_PAIR(v1, v2, i); - while ( v2 != 0xDEAD && - v2 != 0xCDEF && - v2 != 0xCDCD && i < ArrayLen -2) - { - #ifdef CONFIG_IOL_IOREG_CFG - if(biol){ - if(rtw_IOL_cmd_boundary_handle(pxmit_frame)) - bndy_cnt++; - rtw_IOL_append_WD_cmd(pxmit_frame,(u2Byte)v1, v2,bMaskDWord); - } - else - #endif //#ifdef CONFIG_IOL_IOREG_CFG - { - odm_ConfigBB_AGC_8188E(pDM_Odm, v1, bMaskDWord, v2); - } - READ_NEXT_PAIR(v1, v2, i); - } - - while (v2 != 0xDEAD && i < ArrayLen -2) - { - READ_NEXT_PAIR(v1, v2, i); - } - - } - } - } -#ifdef CONFIG_IOL_IOREG_CFG - if(biol){ - //printk("==> %s, pktlen = %d,bndy_cnt = %d\n",__FUNCTION__,pxmit_frame->attrib.pktlen+4+32,bndy_cnt); - if(rtw_IOL_exec_cmds_sync(pDM_Odm->Adapter, pxmit_frame, 1000, bndy_cnt)) - { - #ifdef CONFIG_IOL_IOREG_CFG_DBG - printk("~~~ %s Success !!! \n",__FUNCTION__); - { - //dump data from TX packet buffer - rtw_IOL_cmd_tx_pkt_buf_dump(pDM_Odm->Adapter,pxmit_frame->attrib.pktlen+32); - } - #endif //CONFIG_IOL_IOREG_CFG_DBG - - } - else{ - printk("~~~ %s IOL_exec_cmds Failed !!! \n",__FUNCTION__); - #ifdef CONFIG_IOL_IOREG_CFG_DBG - { - //dump data from TX packet buffer - rtw_IOL_cmd_tx_pkt_buf_dump(pDM_Odm->Adapter,pxmit_frame->attrib.pktlen+32); - } - #endif //CONFIG_IOL_IOREG_CFG_DBG - - rst = HAL_STATUS_FAILURE; - } - } -#endif //#ifdef CONFIG_IOL_IOREG_CFG - return rst; -} - -/****************************************************************************** -* AGC_TAB_1T_ICUT.TXT -******************************************************************************/ - -u4Byte Array_MP_8188E_AGC_TAB_1T_ICUT[] = { - 0xC78, 0xFB000001, - 0xC78, 0xFB010001, - 0xC78, 0xFB020001, - 0xC78, 0xFB030001, - 0xC78, 0xFB040001, - 0xC78, 0xFA050001, - 0xC78, 0xF9060001, - 0xC78, 0xF8070001, - 0xC78, 0xF7080001, - 0xC78, 0xF6090001, - 0xC78, 0xF50A0001, - 0xC78, 0xF40B0001, - 0xC78, 0xF30C0001, - 0xC78, 0xF20D0001, - 0xC78, 0xF10E0001, - 0xC78, 0xF00F0001, - 0xC78, 0xEF100001, - 0xC78, 0xEE110001, - 0xC78, 0xED120001, - 0xC78, 0xEC130001, - 0xC78, 0xEB140001, - 0xC78, 0xEA150001, - 0xC78, 0xE9160001, - 0xC78, 0xE8170001, - 0xC78, 0xE7180001, - 0xC78, 0xE6190001, - 0xC78, 0xE51A0001, - 0xC78, 0xE41B0001, - 0xC78, 0xC71C0001, - 0xC78, 0xC61D0001, - 0xC78, 0xC51E0001, - 0xC78, 0xC41F0001, - 0xC78, 0xC3200001, - 0xC78, 0xC2210001, - 0xC78, 0x88220001, - 0xC78, 0x87230001, - 0xC78, 0x86240001, - 0xC78, 0x85250001, - 0xC78, 0x84260001, - 0xC78, 0x83270001, - 0xC78, 0x82280001, - 0xC78, 0x81290001, - 0xC78, 0x242A0001, - 0xC78, 0x232B0001, - 0xC78, 0x222C0001, - 0xC78, 0x672D0001, - 0xC78, 0x662E0001, - 0xC78, 0x652F0001, - 0xC78, 0x64300001, - 0xC78, 0x63310001, - 0xC78, 0x62320001, - 0xC78, 0x61330001, - 0xC78, 0x60340001, - 0xC78, 0x4A350001, - 0xC78, 0x49360001, - 0xC78, 0x48370001, - 0xC78, 0x47380001, - 0xC78, 0x46390001, - 0xC78, 0x453A0001, - 0xC78, 0x443B0001, - 0xC78, 0x433C0001, - 0xC78, 0x423D0001, - 0xC78, 0x413E0001, - 0xC78, 0x403F0001, - 0xC78, 0xFB400001, - 0xC78, 0xFB410001, - 0xC78, 0xFB420001, - 0xC78, 0xFB430001, - 0xC78, 0xFB440001, - 0xC78, 0xFB450001, - 0xC78, 0xFB460001, - 0xC78, 0xFB470001, - 0xC78, 0xFA480001, - 0xC78, 0xF9490001, - 0xC78, 0xF84A0001, - 0xC78, 0xF74B0001, - 0xC78, 0xF64C0001, - 0xC78, 0xF54D0001, - 0xC78, 0xF44E0001, - 0xC78, 0xF34F0001, - 0xC78, 0xF2500001, - 0xC78, 0xF1510001, - 0xC78, 0xF0520001, - 0xC78, 0xEF530001, - 0xC78, 0xEE540001, - 0xC78, 0xED550001, - 0xC78, 0xEC560001, - 0xC78, 0xEB570001, - 0xC78, 0xEA580001, - 0xC78, 0xE9590001, - 0xC78, 0xE85A0001, - 0xC78, 0xE75B0001, - 0xC78, 0xE65C0001, - 0xC78, 0xE55D0001, - 0xC78, 0xC65E0001, - 0xC78, 0xC55F0001, - 0xC78, 0xC4600001, - 0xC78, 0xC3610001, - 0xC78, 0xC2620001, - 0xC78, 0xC1630001, - 0xC78, 0xC0640001, - 0xC78, 0xA3650001, - 0xC78, 0xA2660001, - 0xC78, 0xA1670001, - 0xC78, 0x88680001, - 0xC78, 0x87690001, - 0xC78, 0x866A0001, - 0xC78, 0x856B0001, - 0xC78, 0x846C0001, - 0xC78, 0x836D0001, - 0xC78, 0x826E0001, - 0xC78, 0x666F0001, - 0xC78, 0x65700001, - 0xC78, 0x64710001, - 0xC78, 0x63720001, - 0xC78, 0x62730001, - 0xC78, 0x61740001, - 0xC78, 0x48750001, - 0xC78, 0x47760001, - 0xC78, 0x46770001, - 0xC78, 0x45780001, - 0xC78, 0x44790001, - 0xC78, 0x437A0001, - 0xC78, 0x427B0001, - 0xC78, 0x417C0001, - 0xC78, 0x407D0001, - 0xC78, 0x407E0001, - 0xC78, 0x407F0001, - 0xC50, 0x69553422, - 0xC50, 0x69553420, - -}; - -void -ODM_ReadAndConfig_AGC_TAB_1T_ICUT_8188E( - IN PDM_ODM_T pDM_Odm - ) -{ - #define READ_NEXT_PAIR(v1, v2, i) do { i += 2; v1 = Array[i]; v2 = Array[i+1]; } while(0) - - u4Byte hex = 0; - u4Byte i = 0; - u2Byte count = 0; - pu4Byte ptr_array = NULL; - u1Byte platform = pDM_Odm->SupportPlatform; - u1Byte _interface = pDM_Odm->SupportInterface; - u1Byte board = pDM_Odm->BoardType; - u4Byte ArrayLen = sizeof(Array_MP_8188E_AGC_TAB_1T_ICUT)/sizeof(u4Byte); - pu4Byte Array = Array_MP_8188E_AGC_TAB_1T_ICUT; - - - hex += board; - hex += _interface << 8; - hex += platform << 16; - hex += 0xFF000000; - ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_TRACE, ("===> ODM_ReadAndConfig_MP_8188E_AGC_TAB_1T_ICUT, hex = 0x%X\n", hex)); - - for (i = 0; i < ArrayLen; i += 2 ) - { - u4Byte v1 = Array[i]; - u4Byte v2 = Array[i+1]; - - // This (offset, data) pair meets the condition. - if ( v1 < 0xCDCDCDCD ) - { - odm_ConfigBB_AGC_8188E(pDM_Odm, v1, bMaskDWord, v2); - continue; - } - else - { // This line is the start line of branch. - if ( !CheckCondition(Array[i], hex) ) - { // Discard the following (offset, data) pairs. - READ_NEXT_PAIR(v1, v2, i); - while (v2 != 0xDEAD && - v2 != 0xCDEF && - v2 != 0xCDCD && i < ArrayLen -2) - { - READ_NEXT_PAIR(v1, v2, i); - } - i -= 2; // prevent from for-loop += 2 - } - else // Configure matched pairs and skip to end of if-else. - { - READ_NEXT_PAIR(v1, v2, i); - while (v2 != 0xDEAD && - v2 != 0xCDEF && - v2 != 0xCDCD && i < ArrayLen -2) - { - odm_ConfigBB_AGC_8188E(pDM_Odm, v1, bMaskDWord, v2); - READ_NEXT_PAIR(v1, v2, i); - } - - while (v2 != 0xDEAD && i < ArrayLen -2) - { - READ_NEXT_PAIR(v1, v2, i); - } - - } - } - } - -} - -/****************************************************************************** -* PHY_REG_1T.TXT -******************************************************************************/ - -u4Byte Array_PHY_REG_1T_8188E[] = { - 0x800, 0x80040000, - 0x804, 0x00000003, - 0x808, 0x0000FC00, - 0x80C, 0x0000000A, - 0x810, 0x10001331, - 0x814, 0x020C3D10, - 0x818, 0x02200385, - 0x81C, 0x00000000, - 0x820, 0x01000100, - 0x824, 0x00390204, - 0x828, 0x00000000, - 0x82C, 0x00000000, - 0x830, 0x00000000, - 0x834, 0x00000000, - 0x838, 0x00000000, - 0x83C, 0x00000000, - 0x840, 0x00010000, - 0x844, 0x00000000, - 0x848, 0x00000000, - 0x84C, 0x00000000, - 0x850, 0x00000000, - 0x854, 0x00000000, - 0x858, 0x569A11A9, - 0x85C, 0x01000014, - 0x860, 0x66F60110, - 0x864, 0x061F0649, - 0x868, 0x00000000, - 0x86C, 0x27272700, - 0xFF0F0718, 0xABCD, - 0x870, 0x07000300, - 0xCDCDCDCD, 0xCDCD, - 0x870, 0x07000760, - 0xFF0F0718, 0xDEAD, - 0x874, 0x25004000, - 0x878, 0x00000808, - 0x87C, 0x00000000, - 0x880, 0xB0000C1C, - 0x884, 0x00000001, - 0x888, 0x00000000, - 0x88C, 0xCCC000C0, - 0x890, 0x00000800, - 0x894, 0xFFFFFFFE, - 0x898, 0x40302010, - 0x89C, 0x00706050, - 0x900, 0x00000000, - 0x904, 0x00000023, - 0x908, 0x00000000, - 0x90C, 0x81121111, - 0x910, 0x00000002, - 0x914, 0x00000201, - 0xA00, 0x00D047C8, - 0xA04, 0x80FF000C, - 0xA08, 0x8C838300, - 0xA0C, 0x2E7F120F, - 0xA10, 0x9500BB78, - 0xA14, 0x1114D028, - 0xA18, 0x00881117, - 0xA1C, 0x89140F00, - 0xFF0F0718, 0xABCD, - 0xA20, 0x13130000, - 0xA24, 0x060A0D10, - 0xA28, 0x00000103, - 0xCDCDCDCD, 0xCDCD, - 0xA20, 0x1A1B0000, - 0xA24, 0x090E1317, - 0xA28, 0x00000204, - 0xFF0F0718, 0xDEAD, - 0xA2C, 0x00D30000, - 0xA70, 0x101FBF00, - 0xA74, 0x00000007, - 0xA78, 0x00000900, - 0xA7C, 0x225B0606, - 0xA80, 0x218075B1, - 0xFF0F0718, 0xABCD, - 0xB2C, 0x00000000, - 0xCDCDCDCD, 0xCDCD, - 0xB2C, 0x80000000, - 0xFF0F0718, 0xDEAD, - 0xC00, 0x48071D40, - 0xC04, 0x03A05611, - 0xC08, 0x000000E4, - 0xC0C, 0x6C6C6C6C, - 0xC10, 0x08800000, - 0xC14, 0x40000100, - 0xC18, 0x08800000, - 0xC1C, 0x40000100, - 0xC20, 0x00000000, - 0xC24, 0x00000000, - 0xC28, 0x00000000, - 0xC2C, 0x00000000, - 0xC30, 0x69E9AC47, - 0xC34, 0x469652AF, - 0xC38, 0x49795994, - 0xC3C, 0x0A97971C, - 0xC40, 0x1F7C403F, - 0xC44, 0x000100B7, - 0xC48, 0xEC020107, - 0xC4C, 0x007F037F, - 0xC50, 0x69553420, - 0xC54, 0x43BC0094, - 0xC58, 0x00013169, - 0xC5C, 0x00250492, - 0xC60, 0x00000000, - 0xC64, 0x7112848B, - 0xC68, 0x47C00BFF, - 0xC6C, 0x00000036, - 0xC70, 0x2C7F000D, - 0xC74, 0x020610DB, - 0xC78, 0x0000001F, - 0xC7C, 0x00B91612, - 0xFF0F0718, 0xABCD, - 0xC80, 0x2D4000B5, - 0xCDCDCDCD, 0xCDCD, - 0xC80, 0x390000E4, - 0xFF0F0718, 0xDEAD, - 0xC84, 0x20F60000, - 0xC88, 0x40000100, - 0xC8C, 0x20200000, - 0xC90, 0x00091521, - 0xC94, 0x00000000, - 0xC98, 0x00121820, - 0xC9C, 0x00007F7F, - 0xCA0, 0x00000000, - 0xCA4, 0x000300A0, - 0xCA8, 0x00000000, - 0xCAC, 0x00000000, - 0xCB0, 0x00000000, - 0xCB4, 0x00000000, - 0xCB8, 0x00000000, - 0xCBC, 0x28000000, - 0xCC0, 0x00000000, - 0xCC4, 0x00000000, - 0xCC8, 0x00000000, - 0xCCC, 0x00000000, - 0xCD0, 0x00000000, - 0xCD4, 0x00000000, - 0xCD8, 0x64B22427, - 0xCDC, 0x00766932, - 0xCE0, 0x00222222, - 0xCE4, 0x00000000, - 0xCE8, 0x37644302, - 0xCEC, 0x2F97D40C, - 0xD00, 0x00000740, - 0xD04, 0x00020401, - 0xD08, 0x0000907F, - 0xD0C, 0x20010201, - 0xD10, 0xA0633333, - 0xD14, 0x3333BC43, - 0xD18, 0x7A8F5B6F, - 0xD2C, 0xCC979975, - 0xD30, 0x00000000, - 0xD34, 0x80608000, - 0xD38, 0x00000000, - 0xD3C, 0x00127353, - 0xD40, 0x00000000, - 0xD44, 0x00000000, - 0xD48, 0x00000000, - 0xD4C, 0x00000000, - 0xD50, 0x6437140A, - 0xD54, 0x00000000, - 0xD58, 0x00000282, - 0xD5C, 0x30032064, - 0xD60, 0x4653DE68, - 0xD64, 0x04518A3C, - 0xD68, 0x00002101, - 0xD6C, 0x2A201C16, - 0xD70, 0x1812362E, - 0xD74, 0x322C2220, - 0xD78, 0x000E3C24, - 0xE00, 0x2D2D2D2D, - 0xE04, 0x2D2D2D2D, - 0xE08, 0x0390272D, - 0xE10, 0x2D2D2D2D, - 0xE14, 0x2D2D2D2D, - 0xE18, 0x2D2D2D2D, - 0xE1C, 0x2D2D2D2D, - 0xE28, 0x00000000, - 0xE30, 0x1000DC1F, - 0xE34, 0x10008C1F, - 0xE38, 0x02140102, - 0xE3C, 0x681604C2, - 0xE40, 0x01007C00, - 0xE44, 0x01004800, - 0xE48, 0xFB000000, - 0xE4C, 0x000028D1, - 0xE50, 0x1000DC1F, - 0xE54, 0x10008C1F, - 0xE58, 0x02140102, - 0xE5C, 0x28160D05, - 0xE60, 0x00000008, - 0xE68, 0x001B25A4, - 0xE6C, 0x00C00014, - 0xE70, 0x00C00014, - 0xE74, 0x01000014, - 0xE78, 0x01000014, - 0xE7C, 0x01000014, - 0xE80, 0x01000014, - 0xE84, 0x00C00014, - 0xE88, 0x01000014, - 0xE8C, 0x00C00014, - 0xED0, 0x00C00014, - 0xED4, 0x00C00014, - 0xED8, 0x00C00014, - 0xEDC, 0x00000014, - 0xEE0, 0x00000014, - 0xFF0F0718, 0xABCD, - 0xEE8, 0x32555448, - 0xCDCDCDCD, 0xCDCD, - 0xEE8, 0x21555448, - 0xFF0F0718, 0xDEAD, - 0xEEC, 0x01C00014, - 0xF14, 0x00000003, - 0xF4C, 0x00000000, - 0xF00, 0x00000300, -}; - - -HAL_STATUS -ODM_ReadAndConfig_PHY_REG_1T_8188E( - IN PDM_ODM_T pDM_Odm - ) -{ - #define READ_NEXT_PAIR(v1, v2, i) do { i += 2; v1 = Array[i]; v2 = Array[i+1]; } while(0) - - u4Byte hex = 0; - u4Byte i = 0; - u2Byte count = 0; - pu4Byte ptr_array = NULL; - u1Byte platform = pDM_Odm->SupportPlatform; - u1Byte interfaceValue = pDM_Odm->SupportInterface; - u1Byte board = pDM_Odm->BoardType; - u4Byte ArrayLen = sizeof(Array_PHY_REG_1T_8188E)/sizeof(u4Byte); - pu4Byte Array = Array_PHY_REG_1T_8188E; - BOOLEAN biol = FALSE; -#ifdef CONFIG_IOL_IOREG_CFG - PADAPTER Adapter = pDM_Odm->Adapter; - struct xmit_frame *pxmit_frame; - u8 bndy_cnt=1; - #ifdef CONFIG_IOL_IOREG_CFG_DBG - struct cmd_cmp cmpdata[ArrayLen]; - u4Byte cmpdata_idx=0; - #endif -#endif//#ifdef CONFIG_IOL_IOREG_CFG - HAL_STATUS rst =HAL_STATUS_SUCCESS; - hex += board; - hex += interfaceValue << 8; - hex += platform << 16; - hex += 0xFF000000; -#ifdef CONFIG_IOL_IOREG_CFG - biol = rtw_IOL_applied(Adapter); - - if(biol){ - if((pxmit_frame=rtw_IOL_accquire_xmit_frame(Adapter)) == NULL) - { - printk("rtw_IOL_accquire_xmit_frame failed\n"); - return HAL_STATUS_FAILURE; - } - } -#endif//#ifdef CONFIG_IOL_IOREG_CFG - - for (i = 0; i < ArrayLen; i += 2 ) - { - u4Byte v1 = Array[i]; - u4Byte v2 = Array[i+1]; - - - // This (offset, data) pair meets the condition. - if ( v1 < 0xCDCDCDCD ) - { - #ifdef CONFIG_IOL_IOREG_CFG - if(biol){ - if(rtw_IOL_cmd_boundary_handle(pxmit_frame)) - bndy_cnt++; - - - if (v1 == 0xfe){ - rtw_IOL_append_DELAY_MS_cmd(pxmit_frame,50); - } - else if (v1 == 0xfd){ - rtw_IOL_append_DELAY_MS_cmd(pxmit_frame,5); - } - else if (v1 == 0xfc){ - rtw_IOL_append_DELAY_MS_cmd(pxmit_frame,1); - } - else if (v1 == 0xfb){ - rtw_IOL_append_DELAY_US_cmd(pxmit_frame,50); - } - else if (v1 == 0xfa){ - rtw_IOL_append_DELAY_US_cmd(pxmit_frame, 5); - } - else if (v1 == 0xf9){ - rtw_IOL_append_DELAY_US_cmd(pxmit_frame,1); - } - else{ - if (v1 == 0xa24) - pDM_Odm->RFCalibrateInfo.RegA24 = v2; - - rtw_IOL_append_WD_cmd(pxmit_frame,(u2Byte)v1, v2,bMaskDWord); - #ifdef CONFIG_IOL_IOREG_CFG_DBG - cmpdata[cmpdata_idx].addr = v1; - cmpdata[cmpdata_idx].value= v2; - cmpdata_idx++; - #endif - } - } - else - #endif //#ifdef CONFIG_IOL_IOREG_CFG - { - odm_ConfigBB_PHY_8188E(pDM_Odm, v1, bMaskDWord, v2); - } - continue; - } - else - { // This line is the start line of branch. - if ( !CheckCondition(Array[i], hex) ) - { // Discard the following (offset, data) pairs. - READ_NEXT_PAIR(v1, v2, i); - while (v2 != 0xDEAD && - v2 != 0xCDEF && - v2 != 0xCDCD && i < ArrayLen -2) - { - READ_NEXT_PAIR(v1, v2, i); - } - i -= 2; // prevent from for-loop += 2 - } - else // Configure matched pairs and skip to end of if-else. - { - READ_NEXT_PAIR(v1, v2, i); - while (v2 != 0xDEAD && - v2 != 0xCDEF && - v2 != 0xCDCD && i < ArrayLen -2) - { - #ifdef CONFIG_IOL_IOREG_CFG - if(biol){ - if(rtw_IOL_cmd_boundary_handle(pxmit_frame)) - bndy_cnt++; - if (v1 == 0xfe){ - rtw_IOL_append_DELAY_MS_cmd(pxmit_frame,50); - } - else if (v1 == 0xfd){ - rtw_IOL_append_DELAY_MS_cmd(pxmit_frame,5); - } - else if (v1 == 0xfc){ - rtw_IOL_append_DELAY_MS_cmd(pxmit_frame,1); - } - else if (v1 == 0xfb){ - rtw_IOL_append_DELAY_US_cmd(pxmit_frame,50); - } - else if (v1 == 0xfa){ - rtw_IOL_append_DELAY_US_cmd(pxmit_frame,5); - } - else if (v1 == 0xf9){ - rtw_IOL_append_DELAY_US_cmd(pxmit_frame,1); - } - else{ - if (v1 == 0xa24) - pDM_Odm->RFCalibrateInfo.RegA24 = v2; - - rtw_IOL_append_WD_cmd(pxmit_frame,(u2Byte)v1, v2,bMaskDWord); - #ifdef CONFIG_IOL_IOREG_CFG_DBG - cmpdata[cmpdata_idx].addr = v1; - cmpdata[cmpdata_idx].value= v2; - cmpdata_idx++; - #endif - } - } - else - #endif //#ifdef CONFIG_IOL_IOREG_CFG - { - odm_ConfigBB_PHY_8188E(pDM_Odm, v1, bMaskDWord, v2); - } - READ_NEXT_PAIR(v1, v2, i); - } - - while (v2 != 0xDEAD && i < ArrayLen -2) - { - READ_NEXT_PAIR(v1, v2, i); - } - - } - } - } -#ifdef CONFIG_IOL_IOREG_CFG - if(biol){ - //printk("==> %s, pktlen = %d,bndy_cnt = %d\n",__FUNCTION__,pxmit_frame->attrib.pktlen+4+32,bndy_cnt); - if(rtw_IOL_exec_cmds_sync(pDM_Odm->Adapter, pxmit_frame, 1000, bndy_cnt)) - { - #ifdef CONFIG_IOL_IOREG_CFG_DBG - printk("~~~ %s IOL_exec_cmds Success !!! \n",__FUNCTION__); - { - u4Byte idx; - u4Byte cdata; - printk(" %s data compare => array_len:%d \n",__FUNCTION__,cmpdata_idx); - printk("### %s data compared !!###\n",__FUNCTION__); - for(idx=0;idx< cmpdata_idx;idx++) - { - cdata = ODM_Read4Byte(pDM_Odm, cmpdata[idx].addr); - if(cdata != cmpdata[idx].value){ - printk(" addr:0x%04x, data:(0x%02x : 0x%02x) \n", - cmpdata[idx].addr,cmpdata[idx].value,cdata); - rst = HAL_STATUS_FAILURE; - } - } - printk("### %s data compared !!###\n",__FUNCTION__); - //if(rst == HAL_STATUS_FAILURE) - {//dump data from TX packet buffer - rtw_IOL_cmd_tx_pkt_buf_dump(pDM_Odm->Adapter,pxmit_frame->attrib.pktlen+32); - } - - } - #endif //CONFIG_IOL_IOREG_CFG_DBG - - } - else{ - rst = HAL_STATUS_FAILURE; - printk("~~~ IOL Config %s Failed !!! \n",__FUNCTION__); - #ifdef CONFIG_IOL_IOREG_CFG_DBG - { - //dump data from TX packet buffer - rtw_IOL_cmd_tx_pkt_buf_dump(pDM_Odm->Adapter,pxmit_frame->attrib.pktlen+32); - } - #endif //CONFIG_IOL_IOREG_CFG_DBG - } - } -#endif //#ifdef CONFIG_IOL_IOREG_CFG - return rst; -} -/****************************************************************************** -* PHY_REG_1T_ICUT.TXT -******************************************************************************/ - -u4Byte Array_MP_8188E_PHY_REG_1T_ICUT[] = { - 0x800, 0x80040000, - 0x804, 0x00000003, - 0x808, 0x0000FC00, - 0x80C, 0x0000000A, - 0x810, 0x10001331, - 0x814, 0x020C3D10, - 0x818, 0x02200385, - 0x81C, 0x00000000, - 0x820, 0x01000100, - 0x824, 0x00390204, - 0x828, 0x00000000, - 0x82C, 0x00000000, - 0x830, 0x00000000, - 0x834, 0x00000000, - 0x838, 0x00000000, - 0x83C, 0x00000000, - 0x840, 0x00010000, - 0x844, 0x00000000, - 0x848, 0x00000000, - 0x84C, 0x00000000, - 0x850, 0x00000000, - 0x854, 0x00000000, - 0x858, 0x569A11A9, - 0x85C, 0x01000014, - 0x860, 0x66F60110, - 0x864, 0x061F0649, - 0x868, 0x00000000, - 0x86C, 0x27272700, - 0x870, 0x07000760, - 0x874, 0x25004000, - 0x878, 0x00000808, - 0x87C, 0x00000000, - 0x880, 0xB0000C1C, - 0x884, 0x00000001, - 0x888, 0x00000000, - 0x88C, 0xCCC000C0, - 0x890, 0x00000800, - 0x894, 0xFFFFFFFE, - 0x898, 0x40302010, - 0x89C, 0x00706050, - 0x900, 0x00000000, - 0x904, 0x00000023, - 0x908, 0x00000000, - 0x90C, 0x81121111, - 0x910, 0x00000002, - 0x914, 0x00000201, - 0xA00, 0x00D047C8, - 0xA04, 0x80FF000C, - 0xA08, 0x8C838300, - 0xA0C, 0x2E7F120F, - 0xA10, 0x9500BB78, - 0xA14, 0x1114D028, - 0xA18, 0x00881117, - 0xA1C, 0x89140F00, - 0xA20, 0x1A1B0000, - 0xA24, 0x090E1317, - 0xA28, 0x00000204, - 0xA2C, 0x00D30000, - 0xA70, 0x101FBF00, - 0xA74, 0x00000007, - 0xA78, 0x00000900, - 0xA7C, 0x225B0606, - 0xA80, 0x218075B1, - 0xB2C, 0x80000000, - 0xC00, 0x48071D40, - 0xC04, 0x03A05611, - 0xC08, 0x000000E4, - 0xC0C, 0x6C6C6C6C, - 0xC10, 0x08800000, - 0xC14, 0x40000100, - 0xC18, 0x08800000, - 0xC1C, 0x40000100, - 0xC20, 0x00000000, - 0xC24, 0x00000000, - 0xC28, 0x00000000, - 0xC2C, 0x00000000, - 0xC30, 0x69E9AC47, - 0xC34, 0x469652AF, - 0xC38, 0x49795994, - 0xC3C, 0x0A97971C, - 0xC40, 0x1F7C403F, - 0xC44, 0x000100B7, - 0xC48, 0xEC020107, - 0xC4C, 0x007F037F, - 0xC50, 0x69553420, - 0xC54, 0x43BC0094, - 0xC58, 0x00013159, - 0xC5C, 0x00250492, - 0xC60, 0x00000000, - 0xC64, 0x7112848B, - 0xC68, 0x47C00BFF, - 0xC6C, 0x00000036, - 0xC70, 0x2C7F000D, - 0xC74, 0x028610DB, - 0xC78, 0x0000001F, - 0xC7C, 0x00B91612, - 0xC80, 0x390000E4, - 0xC84, 0x20F60000, - 0xC88, 0x40000100, - 0xC8C, 0x20200000, - 0xC90, 0x00091521, - 0xC94, 0x00000000, - 0xC98, 0x00121820, - 0xC9C, 0x00007F7F, - 0xCA0, 0x00000000, - 0xCA4, 0x000300A0, - 0xCA8, 0xFFFF0000, - 0xCAC, 0x00000000, - 0xCB0, 0x00000000, - 0xCB4, 0x00000000, - 0xCB8, 0x00000000, - 0xCBC, 0x28000000, - 0xCC0, 0x00000000, - 0xCC4, 0x00000000, - 0xCC8, 0x00000000, - 0xCCC, 0x00000000, - 0xCD0, 0x00000000, - 0xCD4, 0x00000000, - 0xCD8, 0x64B22427, - 0xCDC, 0x00766932, - 0xCE0, 0x00222222, - 0xCE4, 0x00000000, - 0xCE8, 0x37644302, - 0xCEC, 0x2F97D40C, - 0xD00, 0x00000740, - 0xD04, 0x00020401, - 0xD08, 0x0000907F, - 0xD0C, 0x20010201, - 0xD10, 0xA0633333, - 0xD14, 0x3333BC43, - 0xD18, 0x7A8F5B6F, - 0xD2C, 0xCC979975, - 0xD30, 0x00000000, - 0xD34, 0x80608000, - 0xD38, 0x00000000, - 0xD3C, 0x00127353, - 0xD40, 0x00000000, - 0xD44, 0x00000000, - 0xD48, 0x00000000, - 0xD4C, 0x00000000, - 0xD50, 0x6437140A, - 0xD54, 0x00000000, - 0xD58, 0x00000282, - 0xD5C, 0x30032064, - 0xD60, 0x4653DE68, - 0xD64, 0x04518A3C, - 0xD68, 0x00002101, - 0xD6C, 0x2A201C16, - 0xD70, 0x1812362E, - 0xD74, 0x322C2220, - 0xD78, 0x000E3C24, - 0xE00, 0x2D2D2D2D, - 0xE04, 0x2D2D2D2D, - 0xE08, 0x0390272D, - 0xE10, 0x2D2D2D2D, - 0xE14, 0x2D2D2D2D, - 0xE18, 0x2D2D2D2D, - 0xE1C, 0x2D2D2D2D, - 0xE28, 0x00000000, - 0xE30, 0x1000DC1F, - 0xE34, 0x10008C1F, - 0xE38, 0x02140102, - 0xE3C, 0x681604C2, - 0xE40, 0x01007C00, - 0xE44, 0x01004800, - 0xE48, 0xFB000000, - 0xE4C, 0x000028D1, - 0xE50, 0x1000DC1F, - 0xE54, 0x10008C1F, - 0xE58, 0x02140102, - 0xE5C, 0x28160D05, - 0xE60, 0x00000008, - 0xE68, 0x001B25A4, - 0xE6C, 0x00C00014, - 0xE70, 0x00C00014, - 0xE74, 0x01000014, - 0xE78, 0x01000014, - 0xE7C, 0x01000014, - 0xE80, 0x01000014, - 0xE84, 0x00C00014, - 0xE88, 0x01000014, - 0xE8C, 0x00C00014, - 0xED0, 0x00C00014, - 0xED4, 0x00C00014, - 0xED8, 0x00C00014, - 0xEDC, 0x00000014, - 0xEE0, 0x00000014, - 0xEEC, 0x01C00014, - 0xF14, 0x00000003, - 0xF4C, 0x00000000, - 0xF00, 0x00000300, - -}; - -void -ODM_ReadAndConfig_PHY_REG_1T_ICUT_8188E( - IN PDM_ODM_T pDM_Odm - ) -{ - #define READ_NEXT_PAIR(v1, v2, i) do { i += 2; v1 = Array[i]; v2 = Array[i+1]; } while(0) - - u4Byte hex = 0; - u4Byte i = 0; - u2Byte count = 0; - pu4Byte ptr_array = NULL; - u1Byte platform = pDM_Odm->SupportPlatform; - u1Byte _interface = pDM_Odm->SupportInterface; - u1Byte board = pDM_Odm->BoardType; - u4Byte ArrayLen = sizeof(Array_MP_8188E_PHY_REG_1T_ICUT)/sizeof(u4Byte); - pu4Byte Array = Array_MP_8188E_PHY_REG_1T_ICUT; - - - hex += board; - hex += _interface << 8; - hex += platform << 16; - hex += 0xFF000000; - ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_TRACE, ("===> ODM_ReadAndConfig_MP_8188E_PHY_REG_1T_ICUT, hex = 0x%X\n", hex)); - - for (i = 0; i < ArrayLen; i += 2 ) - { - u4Byte v1 = Array[i]; - u4Byte v2 = Array[i+1]; - - // This (offset, data) pair meets the condition. - if ( v1 < 0xCDCDCDCD ) - { - odm_ConfigBB_PHY_8188E(pDM_Odm, v1, bMaskDWord, v2); - continue; - } - else - { // This line is the start line of branch. - if ( !CheckCondition(Array[i], hex) ) - { // Discard the following (offset, data) pairs. - READ_NEXT_PAIR(v1, v2, i); - while (v2 != 0xDEAD && - v2 != 0xCDEF && - v2 != 0xCDCD && i < ArrayLen -2) - { - READ_NEXT_PAIR(v1, v2, i); - } - i -= 2; // prevent from for-loop += 2 - } - else // Configure matched pairs and skip to end of if-else. - { - READ_NEXT_PAIR(v1, v2, i); - while (v2 != 0xDEAD && - v2 != 0xCDEF && - v2 != 0xCDCD && i < ArrayLen -2) - { - odm_ConfigBB_PHY_8188E(pDM_Odm, v1, bMaskDWord, v2); - READ_NEXT_PAIR(v1, v2, i); - } - - while (v2 != 0xDEAD && i < ArrayLen -2) - { - READ_NEXT_PAIR(v1, v2, i); - } - - } - } - } - -} - - -/****************************************************************************** -* PHY_REG_PG.TXT -******************************************************************************/ - -u4Byte Array_PHY_REG_PG_8188E[] = { - 0, 0, 0, 0x00000e08, 0x0000ff00, 0x00004000, - 0, 0, 0, 0x0000086c, 0xffffff00, 0x34363800, - 0, 0, 0, 0x00000e00, 0xffffffff, 0x42444646, - 0, 0, 0, 0x00000e04, 0xffffffff, 0x30343840, - 0, 0, 0, 0x00000e10, 0xffffffff, 0x38404244, - 0, 0, 0, 0x00000e14, 0xffffffff, 0x26303436 - -}; - -void -ODM_ReadAndConfig_PHY_REG_PG_8188E( - IN PDM_ODM_T pDM_Odm - ) -{ - u4Byte hex = 0; - u4Byte i = 0; - u2Byte count = 0; - pu4Byte ptr_array = NULL; - u1Byte platform = pDM_Odm->SupportPlatform; - u1Byte interfaceValue = pDM_Odm->SupportInterface; - u1Byte board = pDM_Odm->BoardType; - u4Byte ArrayLen = sizeof(Array_PHY_REG_PG_8188E)/sizeof(u4Byte); - pu4Byte Array = Array_PHY_REG_PG_8188E; - BOOLEAN biol = FALSE; - - hex += board; - hex += interfaceValue << 8; - hex += platform << 16; - hex += 0xFF000000; - for (i = 0; i < ArrayLen; i += 6 ) - { - u4Byte v1 = Array[i]; - u4Byte v2 = Array[i+1]; - u4Byte v3 = Array[i+2]; - u4Byte v4 = Array[i+3]; - u4Byte v5 = Array[i+4]; - u4Byte v6 = Array[i+5]; - - // this line is a line of pure_body - if ( v1 < 0xCDCDCDCD ) - { - - odm_ConfigBB_PHY_REG_PG_8188E(pDM_Odm, v1, v2, v3); - - continue; - } - else - { // this line is the start of branch - if ( !CheckCondition(Array[i], hex) ) - { // don't need the hw_body - i += 2; // skip the pair of expression - v1 = Array[i]; - v2 = Array[i+1]; - v3 = Array[i+2]; - while (v2 != 0xDEAD) - { - i += 3; - v1 = Array[i]; - v2 = Array[i+1]; - v3 = Array[i+1]; - } - } - } - } - -} - - - -#endif // end of HWIMG_SUPPORT - +/****************************************************************************** +* +* 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 +* +* +******************************************************************************/ + +#include "odm_precomp.h" + +#ifdef CONFIG_IOL_IOREG_CFG +#include +#endif + +#if (RTL8188E_SUPPORT == 1) +static BOOLEAN +CheckCondition( + const u4Byte Condition, + const u4Byte Hex + ) +{ + u4Byte _board = (Hex & 0x000000FF); + u4Byte _interface = (Hex & 0x0000FF00) >> 8; + u4Byte _platform = (Hex & 0x00FF0000) >> 16; + u4Byte cond = Condition; + + if ( Condition == 0xCDCDCDCD ) + return TRUE; + + cond = Condition & 0x000000FF; + if ( (_board != cond) && (cond != 0xFF) ) + return FALSE; + + cond = Condition & 0x0000FF00; + cond = cond >> 8; + if ( ((_interface & cond) == 0) && (cond != 0x07) ) + return FALSE; + + cond = Condition & 0x00FF0000; + cond = cond >> 16; + if ( ((_platform & cond) == 0) && (cond != 0x0F) ) + return FALSE; + return TRUE; +} + + +/****************************************************************************** +* AGC_TAB_1T.TXT +******************************************************************************/ + +u4Byte Array_AGC_TAB_1T_8188E[] = { +0xFF0F0718, 0xABCD, + 0xC78, 0xF7000001, + 0xC78, 0xF6010001, + 0xC78, 0xF5020001, + 0xC78, 0xF4030001, + 0xC78, 0xF3040001, + 0xC78, 0xF2050001, + 0xC78, 0xF1060001, + 0xC78, 0xF0070001, + 0xC78, 0xEF080001, + 0xC78, 0xEE090001, + 0xC78, 0xED0A0001, + 0xC78, 0xEC0B0001, + 0xC78, 0xEB0C0001, + 0xC78, 0xEA0D0001, + 0xC78, 0xE90E0001, + 0xC78, 0xE80F0001, + 0xC78, 0xE7100001, + 0xC78, 0xE6110001, + 0xC78, 0xE5120001, + 0xC78, 0xE4130001, + 0xC78, 0xE3140001, + 0xC78, 0xE2150001, + 0xC78, 0xE1160001, + 0xC78, 0x89170001, + 0xC78, 0x88180001, + 0xC78, 0x87190001, + 0xC78, 0x861A0001, + 0xC78, 0x851B0001, + 0xC78, 0x841C0001, + 0xC78, 0x831D0001, + 0xC78, 0x821E0001, + 0xC78, 0x811F0001, + 0xC78, 0x6B200001, + 0xC78, 0x6A210001, + 0xC78, 0x69220001, + 0xC78, 0x68230001, + 0xC78, 0x67240001, + 0xC78, 0x66250001, + 0xC78, 0x65260001, + 0xC78, 0x64270001, + 0xC78, 0x63280001, + 0xC78, 0x62290001, + 0xC78, 0x612A0001, + 0xC78, 0x462B0001, + 0xC78, 0x452C0001, + 0xC78, 0x442D0001, + 0xC78, 0x432E0001, + 0xC78, 0x422F0001, + 0xC78, 0x41300001, + 0xC78, 0x40310001, + 0xC78, 0x40320001, + 0xC78, 0x40330001, + 0xC78, 0x40340001, + 0xC78, 0x40350001, + 0xC78, 0x40360001, + 0xC78, 0x40370001, + 0xC78, 0x40380001, + 0xC78, 0x40390001, + 0xC78, 0x403A0001, + 0xC78, 0x403B0001, + 0xC78, 0x403C0001, + 0xC78, 0x403D0001, + 0xC78, 0x403E0001, + 0xC78, 0x403F0001, + 0xCDCDCDCD, 0xCDCD, + 0xC78, 0xFB000001, + 0xC78, 0xFB010001, + 0xC78, 0xFB020001, + 0xC78, 0xFB030001, + 0xC78, 0xFB040001, + 0xC78, 0xFB050001, + 0xC78, 0xFA060001, + 0xC78, 0xF9070001, + 0xC78, 0xF8080001, + 0xC78, 0xF7090001, + 0xC78, 0xF60A0001, + 0xC78, 0xF50B0001, + 0xC78, 0xF40C0001, + 0xC78, 0xF30D0001, + 0xC78, 0xF20E0001, + 0xC78, 0xF10F0001, + 0xC78, 0xF0100001, + 0xC78, 0xEF110001, + 0xC78, 0xEE120001, + 0xC78, 0xED130001, + 0xC78, 0xEC140001, + 0xC78, 0xEB150001, + 0xC78, 0xEA160001, + 0xC78, 0xE9170001, + 0xC78, 0xE8180001, + 0xC78, 0xE7190001, + 0xC78, 0xE61A0001, + 0xC78, 0xE51B0001, + 0xC78, 0xE41C0001, + 0xC78, 0xE31D0001, + 0xC78, 0xE21E0001, + 0xC78, 0xE11F0001, + 0xC78, 0x8A200001, + 0xC78, 0x89210001, + 0xC78, 0x88220001, + 0xC78, 0x87230001, + 0xC78, 0x86240001, + 0xC78, 0x85250001, + 0xC78, 0x84260001, + 0xC78, 0x83270001, + 0xC78, 0x82280001, + 0xC78, 0x6B290001, + 0xC78, 0x6A2A0001, + 0xC78, 0x692B0001, + 0xC78, 0x682C0001, + 0xC78, 0x672D0001, + 0xC78, 0x662E0001, + 0xC78, 0x652F0001, + 0xC78, 0x64300001, + 0xC78, 0x63310001, + 0xC78, 0x62320001, + 0xC78, 0x61330001, + 0xC78, 0x46340001, + 0xC78, 0x45350001, + 0xC78, 0x44360001, + 0xC78, 0x43370001, + 0xC78, 0x42380001, + 0xC78, 0x41390001, + 0xC78, 0x403A0001, + 0xC78, 0x403B0001, + 0xC78, 0x403C0001, + 0xC78, 0x403D0001, + 0xC78, 0x403E0001, + 0xC78, 0x403F0001, + 0xFF0F0718, 0xDEAD, + 0xFF0F0718, 0xABCD, + 0xC78, 0xFB400001, + 0xC78, 0xFA410001, + 0xC78, 0xF9420001, + 0xC78, 0xF8430001, + 0xC78, 0xF7440001, + 0xC78, 0xF6450001, + 0xC78, 0xF5460001, + 0xC78, 0xF4470001, + 0xC78, 0xF3480001, + 0xC78, 0xF2490001, + 0xC78, 0xF14A0001, + 0xC78, 0xF04B0001, + 0xC78, 0xEF4C0001, + 0xC78, 0xEE4D0001, + 0xC78, 0xED4E0001, + 0xC78, 0xEC4F0001, + 0xC78, 0xEB500001, + 0xC78, 0xEA510001, + 0xC78, 0xE9520001, + 0xC78, 0xE8530001, + 0xC78, 0xE7540001, + 0xC78, 0xE6550001, + 0xC78, 0xE5560001, + 0xC78, 0xE4570001, + 0xC78, 0xE3580001, + 0xC78, 0xE2590001, + 0xC78, 0xC35A0001, + 0xC78, 0xC25B0001, + 0xC78, 0xC15C0001, + 0xC78, 0x8B5D0001, + 0xC78, 0x8A5E0001, + 0xC78, 0x895F0001, + 0xC78, 0x88600001, + 0xC78, 0x87610001, + 0xC78, 0x86620001, + 0xC78, 0x85630001, + 0xC78, 0x84640001, + 0xC78, 0x67650001, + 0xC78, 0x66660001, + 0xC78, 0x65670001, + 0xC78, 0x64680001, + 0xC78, 0x63690001, + 0xC78, 0x626A0001, + 0xC78, 0x616B0001, + 0xC78, 0x606C0001, + 0xC78, 0x466D0001, + 0xC78, 0x456E0001, + 0xC78, 0x446F0001, + 0xC78, 0x43700001, + 0xC78, 0x42710001, + 0xC78, 0x41720001, + 0xC78, 0x40730001, + 0xC78, 0x40740001, + 0xC78, 0x40750001, + 0xC78, 0x40760001, + 0xC78, 0x40770001, + 0xC78, 0x40780001, + 0xC78, 0x40790001, + 0xC78, 0x407A0001, + 0xC78, 0x407B0001, + 0xC78, 0x407C0001, + 0xC78, 0x407D0001, + 0xC78, 0x407E0001, + 0xC78, 0x407F0001, + 0xCDCDCDCD, 0xCDCD, + 0xC78, 0xFB400001, + 0xC78, 0xFB410001, + 0xC78, 0xFB420001, + 0xC78, 0xFB430001, + 0xC78, 0xFB440001, + 0xC78, 0xFB450001, + 0xC78, 0xFB460001, + 0xC78, 0xFB470001, + 0xC78, 0xFB480001, + 0xC78, 0xFA490001, + 0xC78, 0xF94A0001, + 0xC78, 0xF84B0001, + 0xC78, 0xF74C0001, + 0xC78, 0xF64D0001, + 0xC78, 0xF54E0001, + 0xC78, 0xF44F0001, + 0xC78, 0xF3500001, + 0xC78, 0xF2510001, + 0xC78, 0xF1520001, + 0xC78, 0xF0530001, + 0xC78, 0xEF540001, + 0xC78, 0xEE550001, + 0xC78, 0xED560001, + 0xC78, 0xEC570001, + 0xC78, 0xEB580001, + 0xC78, 0xEA590001, + 0xC78, 0xE95A0001, + 0xC78, 0xE85B0001, + 0xC78, 0xE75C0001, + 0xC78, 0xE65D0001, + 0xC78, 0xE55E0001, + 0xC78, 0xE45F0001, + 0xC78, 0xE3600001, + 0xC78, 0xE2610001, + 0xC78, 0xC3620001, + 0xC78, 0xC2630001, + 0xC78, 0xC1640001, + 0xC78, 0x8B650001, + 0xC78, 0x8A660001, + 0xC78, 0x89670001, + 0xC78, 0x88680001, + 0xC78, 0x87690001, + 0xC78, 0x866A0001, + 0xC78, 0x856B0001, + 0xC78, 0x846C0001, + 0xC78, 0x676D0001, + 0xC78, 0x666E0001, + 0xC78, 0x656F0001, + 0xC78, 0x64700001, + 0xC78, 0x63710001, + 0xC78, 0x62720001, + 0xC78, 0x61730001, + 0xC78, 0x60740001, + 0xC78, 0x46750001, + 0xC78, 0x45760001, + 0xC78, 0x44770001, + 0xC78, 0x43780001, + 0xC78, 0x42790001, + 0xC78, 0x417A0001, + 0xC78, 0x407B0001, + 0xC78, 0x407C0001, + 0xC78, 0x407D0001, + 0xC78, 0x407E0001, + 0xC78, 0x407F0001, + 0xFF0F0718, 0xDEAD, + 0xC50, 0x69553422, + 0xC50, 0x69553420, + +}; + +HAL_STATUS +ODM_ReadAndConfig_AGC_TAB_1T_8188E( + IN PDM_ODM_T pDM_Odm + ) +{ + #define READ_NEXT_PAIR(v1, v2, i) do { i += 2; v1 = Array[i]; v2 = Array[i+1]; } while(0) + + u4Byte hex = 0; + u4Byte i = 0; + u2Byte count = 0; + pu4Byte ptr_array = NULL; + u1Byte platform = pDM_Odm->SupportPlatform; + u1Byte interfaceValue = pDM_Odm->SupportInterface; + u1Byte board = pDM_Odm->BoardType; + u4Byte ArrayLen = sizeof(Array_AGC_TAB_1T_8188E)/sizeof(u4Byte); + pu4Byte Array = Array_AGC_TAB_1T_8188E; + BOOLEAN biol = FALSE; +#ifdef CONFIG_IOL_IOREG_CFG + PADAPTER Adapter = pDM_Odm->Adapter; + struct xmit_frame *pxmit_frame; + u8 bndy_cnt=1; +#endif//#ifdef CONFIG_IOL_IOREG_CFG + HAL_STATUS rst =HAL_STATUS_SUCCESS; + + hex += board; + hex += interfaceValue << 8; + hex += platform << 16; + hex += 0xFF000000; +#ifdef CONFIG_IOL_IOREG_CFG + biol = rtw_IOL_applied(Adapter); + + if(biol){ + if((pxmit_frame= rtw_IOL_accquire_xmit_frame(Adapter)) == NULL){ + printk("rtw_IOL_accquire_xmit_frame failed\n"); + return HAL_STATUS_FAILURE; + } + } +#endif//#ifdef CONFIG_IOL_IOREG_CFG + + for (i = 0; i < ArrayLen; i += 2 ) + { + u4Byte v1 = Array[i]; + u4Byte v2 = Array[i+1]; + + // This (offset, data) pair meets the condition. + if ( v1 < 0xCDCDCDCD ) + { + #ifdef CONFIG_IOL_IOREG_CFG + if(biol){ + if(rtw_IOL_cmd_boundary_handle(pxmit_frame)) + bndy_cnt++; + rtw_IOL_append_WD_cmd(pxmit_frame,(u2Byte)v1, v2,bMaskDWord); + } + else + #endif //#ifdef CONFIG_IOL_IOREG_CFG + { + odm_ConfigBB_AGC_8188E(pDM_Odm, v1, bMaskDWord, v2); + } + continue; + } + else + { // This line is the start line of branch. + if ( !CheckCondition(Array[i], hex) ) + { // Discard the following (offset, data) pairs. + READ_NEXT_PAIR(v1, v2, i); + while ( v2 != 0xDEAD && + v2 != 0xCDEF && + v2 != 0xCDCD && i < ArrayLen -2) + { + READ_NEXT_PAIR(v1, v2, i); + } + i -= 2; // prevent from for-loop += 2 + } + else // Configure matched pairs and skip to end of if-else. + { + READ_NEXT_PAIR(v1, v2, i); + while ( v2 != 0xDEAD && + v2 != 0xCDEF && + v2 != 0xCDCD && i < ArrayLen -2) + { + #ifdef CONFIG_IOL_IOREG_CFG + if(biol){ + if(rtw_IOL_cmd_boundary_handle(pxmit_frame)) + bndy_cnt++; + rtw_IOL_append_WD_cmd(pxmit_frame,(u2Byte)v1, v2,bMaskDWord); + } + else + #endif //#ifdef CONFIG_IOL_IOREG_CFG + { + odm_ConfigBB_AGC_8188E(pDM_Odm, v1, bMaskDWord, v2); + } + READ_NEXT_PAIR(v1, v2, i); + } + + while (v2 != 0xDEAD && i < ArrayLen -2) + { + READ_NEXT_PAIR(v1, v2, i); + } + + } + } + } +#ifdef CONFIG_IOL_IOREG_CFG + if(biol){ + //printk("==> %s, pktlen = %d,bndy_cnt = %d\n",__FUNCTION__,pxmit_frame->attrib.pktlen+4+32,bndy_cnt); + if(rtw_IOL_exec_cmds_sync(pDM_Odm->Adapter, pxmit_frame, 1000, bndy_cnt)) + { + #ifdef CONFIG_IOL_IOREG_CFG_DBG + printk("~~~ %s Success !!! \n",__FUNCTION__); + { + //dump data from TX packet buffer + rtw_IOL_cmd_tx_pkt_buf_dump(pDM_Odm->Adapter,pxmit_frame->attrib.pktlen+32); + } + #endif //CONFIG_IOL_IOREG_CFG_DBG + + } + else{ + printk("~~~ %s IOL_exec_cmds Failed !!! \n",__FUNCTION__); + #ifdef CONFIG_IOL_IOREG_CFG_DBG + { + //dump data from TX packet buffer + rtw_IOL_cmd_tx_pkt_buf_dump(pDM_Odm->Adapter,pxmit_frame->attrib.pktlen+32); + } + #endif //CONFIG_IOL_IOREG_CFG_DBG + + rst = HAL_STATUS_FAILURE; + } + } +#endif //#ifdef CONFIG_IOL_IOREG_CFG + return rst; +} + +/****************************************************************************** +* AGC_TAB_1T_ICUT.TXT +******************************************************************************/ + +u4Byte Array_MP_8188E_AGC_TAB_1T_ICUT[] = { + 0xC78, 0xFB000001, + 0xC78, 0xFB010001, + 0xC78, 0xFB020001, + 0xC78, 0xFB030001, + 0xC78, 0xFB040001, + 0xC78, 0xFA050001, + 0xC78, 0xF9060001, + 0xC78, 0xF8070001, + 0xC78, 0xF7080001, + 0xC78, 0xF6090001, + 0xC78, 0xF50A0001, + 0xC78, 0xF40B0001, + 0xC78, 0xF30C0001, + 0xC78, 0xF20D0001, + 0xC78, 0xF10E0001, + 0xC78, 0xF00F0001, + 0xC78, 0xEF100001, + 0xC78, 0xEE110001, + 0xC78, 0xED120001, + 0xC78, 0xEC130001, + 0xC78, 0xEB140001, + 0xC78, 0xEA150001, + 0xC78, 0xE9160001, + 0xC78, 0xE8170001, + 0xC78, 0xE7180001, + 0xC78, 0xE6190001, + 0xC78, 0xE51A0001, + 0xC78, 0xE41B0001, + 0xC78, 0xC71C0001, + 0xC78, 0xC61D0001, + 0xC78, 0xC51E0001, + 0xC78, 0xC41F0001, + 0xC78, 0xC3200001, + 0xC78, 0xC2210001, + 0xC78, 0x88220001, + 0xC78, 0x87230001, + 0xC78, 0x86240001, + 0xC78, 0x85250001, + 0xC78, 0x84260001, + 0xC78, 0x83270001, + 0xC78, 0x82280001, + 0xC78, 0x81290001, + 0xC78, 0x242A0001, + 0xC78, 0x232B0001, + 0xC78, 0x222C0001, + 0xC78, 0x672D0001, + 0xC78, 0x662E0001, + 0xC78, 0x652F0001, + 0xC78, 0x64300001, + 0xC78, 0x63310001, + 0xC78, 0x62320001, + 0xC78, 0x61330001, + 0xC78, 0x60340001, + 0xC78, 0x4A350001, + 0xC78, 0x49360001, + 0xC78, 0x48370001, + 0xC78, 0x47380001, + 0xC78, 0x46390001, + 0xC78, 0x453A0001, + 0xC78, 0x443B0001, + 0xC78, 0x433C0001, + 0xC78, 0x423D0001, + 0xC78, 0x413E0001, + 0xC78, 0x403F0001, + 0xC78, 0xFB400001, + 0xC78, 0xFB410001, + 0xC78, 0xFB420001, + 0xC78, 0xFB430001, + 0xC78, 0xFB440001, + 0xC78, 0xFB450001, + 0xC78, 0xFB460001, + 0xC78, 0xFB470001, + 0xC78, 0xFA480001, + 0xC78, 0xF9490001, + 0xC78, 0xF84A0001, + 0xC78, 0xF74B0001, + 0xC78, 0xF64C0001, + 0xC78, 0xF54D0001, + 0xC78, 0xF44E0001, + 0xC78, 0xF34F0001, + 0xC78, 0xF2500001, + 0xC78, 0xF1510001, + 0xC78, 0xF0520001, + 0xC78, 0xEF530001, + 0xC78, 0xEE540001, + 0xC78, 0xED550001, + 0xC78, 0xEC560001, + 0xC78, 0xEB570001, + 0xC78, 0xEA580001, + 0xC78, 0xE9590001, + 0xC78, 0xE85A0001, + 0xC78, 0xE75B0001, + 0xC78, 0xE65C0001, + 0xC78, 0xE55D0001, + 0xC78, 0xC65E0001, + 0xC78, 0xC55F0001, + 0xC78, 0xC4600001, + 0xC78, 0xC3610001, + 0xC78, 0xC2620001, + 0xC78, 0xC1630001, + 0xC78, 0xC0640001, + 0xC78, 0xA3650001, + 0xC78, 0xA2660001, + 0xC78, 0xA1670001, + 0xC78, 0x88680001, + 0xC78, 0x87690001, + 0xC78, 0x866A0001, + 0xC78, 0x856B0001, + 0xC78, 0x846C0001, + 0xC78, 0x836D0001, + 0xC78, 0x826E0001, + 0xC78, 0x666F0001, + 0xC78, 0x65700001, + 0xC78, 0x64710001, + 0xC78, 0x63720001, + 0xC78, 0x62730001, + 0xC78, 0x61740001, + 0xC78, 0x48750001, + 0xC78, 0x47760001, + 0xC78, 0x46770001, + 0xC78, 0x45780001, + 0xC78, 0x44790001, + 0xC78, 0x437A0001, + 0xC78, 0x427B0001, + 0xC78, 0x417C0001, + 0xC78, 0x407D0001, + 0xC78, 0x407E0001, + 0xC78, 0x407F0001, + 0xC50, 0x69553422, + 0xC50, 0x69553420, + +}; + +void +ODM_ReadAndConfig_AGC_TAB_1T_ICUT_8188E( + IN PDM_ODM_T pDM_Odm + ) +{ + #define READ_NEXT_PAIR(v1, v2, i) do { i += 2; v1 = Array[i]; v2 = Array[i+1]; } while(0) + + u4Byte hex = 0; + u4Byte i = 0; + u2Byte count = 0; + pu4Byte ptr_array = NULL; + u1Byte platform = pDM_Odm->SupportPlatform; + u1Byte _interface = pDM_Odm->SupportInterface; + u1Byte board = pDM_Odm->BoardType; + u4Byte ArrayLen = sizeof(Array_MP_8188E_AGC_TAB_1T_ICUT)/sizeof(u4Byte); + pu4Byte Array = Array_MP_8188E_AGC_TAB_1T_ICUT; + + + hex += board; + hex += _interface << 8; + hex += platform << 16; + hex += 0xFF000000; + ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_TRACE, ("===> ODM_ReadAndConfig_MP_8188E_AGC_TAB_1T_ICUT, hex = 0x%X\n", hex)); + + for (i = 0; i < ArrayLen; i += 2 ) + { + u4Byte v1 = Array[i]; + u4Byte v2 = Array[i+1]; + + // This (offset, data) pair meets the condition. + if ( v1 < 0xCDCDCDCD ) + { + odm_ConfigBB_AGC_8188E(pDM_Odm, v1, bMaskDWord, v2); + continue; + } + else + { // This line is the start line of branch. + if ( !CheckCondition(Array[i], hex) ) + { // Discard the following (offset, data) pairs. + READ_NEXT_PAIR(v1, v2, i); + while (v2 != 0xDEAD && + v2 != 0xCDEF && + v2 != 0xCDCD && i < ArrayLen -2) + { + READ_NEXT_PAIR(v1, v2, i); + } + i -= 2; // prevent from for-loop += 2 + } + else // Configure matched pairs and skip to end of if-else. + { + READ_NEXT_PAIR(v1, v2, i); + while (v2 != 0xDEAD && + v2 != 0xCDEF && + v2 != 0xCDCD && i < ArrayLen -2) + { + odm_ConfigBB_AGC_8188E(pDM_Odm, v1, bMaskDWord, v2); + READ_NEXT_PAIR(v1, v2, i); + } + + while (v2 != 0xDEAD && i < ArrayLen -2) + { + READ_NEXT_PAIR(v1, v2, i); + } + + } + } + } + +} + +/****************************************************************************** +* PHY_REG_1T.TXT +******************************************************************************/ + +u4Byte Array_PHY_REG_1T_8188E[] = { + 0x800, 0x80040000, + 0x804, 0x00000003, + 0x808, 0x0000FC00, + 0x80C, 0x0000000A, + 0x810, 0x10001331, + 0x814, 0x020C3D10, + 0x818, 0x02200385, + 0x81C, 0x00000000, + 0x820, 0x01000100, + 0x824, 0x00390204, + 0x828, 0x00000000, + 0x82C, 0x00000000, + 0x830, 0x00000000, + 0x834, 0x00000000, + 0x838, 0x00000000, + 0x83C, 0x00000000, + 0x840, 0x00010000, + 0x844, 0x00000000, + 0x848, 0x00000000, + 0x84C, 0x00000000, + 0x850, 0x00000000, + 0x854, 0x00000000, + 0x858, 0x569A11A9, + 0x85C, 0x01000014, + 0x860, 0x66F60110, + 0x864, 0x061F0649, + 0x868, 0x00000000, + 0x86C, 0x27272700, + 0xFF0F0718, 0xABCD, + 0x870, 0x07000300, + 0xCDCDCDCD, 0xCDCD, + 0x870, 0x07000760, + 0xFF0F0718, 0xDEAD, + 0x874, 0x25004000, + 0x878, 0x00000808, + 0x87C, 0x00000000, + 0x880, 0xB0000C1C, + 0x884, 0x00000001, + 0x888, 0x00000000, + 0x88C, 0xCCC000C0, + 0x890, 0x00000800, + 0x894, 0xFFFFFFFE, + 0x898, 0x40302010, + 0x89C, 0x00706050, + 0x900, 0x00000000, + 0x904, 0x00000023, + 0x908, 0x00000000, + 0x90C, 0x81121111, + 0x910, 0x00000002, + 0x914, 0x00000201, + 0xA00, 0x00D047C8, + 0xA04, 0x80FF000C, + 0xA08, 0x8C838300, + 0xA0C, 0x2E7F120F, + 0xA10, 0x9500BB78, + 0xA14, 0x1114D028, + 0xA18, 0x00881117, + 0xA1C, 0x89140F00, + 0xFF0F0718, 0xABCD, + 0xA20, 0x13130000, + 0xA24, 0x060A0D10, + 0xA28, 0x00000103, + 0xCDCDCDCD, 0xCDCD, + 0xA20, 0x1A1B0000, + 0xA24, 0x090E1317, + 0xA28, 0x00000204, + 0xFF0F0718, 0xDEAD, + 0xA2C, 0x00D30000, + 0xA70, 0x101FBF00, + 0xA74, 0x00000007, + 0xA78, 0x00000900, + 0xA7C, 0x225B0606, + 0xA80, 0x218075B1, + 0xFF0F0718, 0xABCD, + 0xB2C, 0x00000000, + 0xCDCDCDCD, 0xCDCD, + 0xB2C, 0x80000000, + 0xFF0F0718, 0xDEAD, + 0xC00, 0x48071D40, + 0xC04, 0x03A05611, + 0xC08, 0x000000E4, + 0xC0C, 0x6C6C6C6C, + 0xC10, 0x08800000, + 0xC14, 0x40000100, + 0xC18, 0x08800000, + 0xC1C, 0x40000100, + 0xC20, 0x00000000, + 0xC24, 0x00000000, + 0xC28, 0x00000000, + 0xC2C, 0x00000000, + 0xC30, 0x69E9AC47, + 0xC34, 0x469652AF, + 0xC38, 0x49795994, + 0xC3C, 0x0A97971C, + 0xC40, 0x1F7C403F, + 0xC44, 0x000100B7, + 0xC48, 0xEC020107, + 0xC4C, 0x007F037F, + 0xC50, 0x69553420, + 0xC54, 0x43BC0094, + 0xC58, 0x00013169, + 0xC5C, 0x00250492, + 0xC60, 0x00000000, + 0xC64, 0x7112848B, + 0xC68, 0x47C00BFF, + 0xC6C, 0x00000036, + 0xC70, 0x2C7F000D, + 0xC74, 0x020610DB, + 0xC78, 0x0000001F, + 0xC7C, 0x00B91612, + 0xFF0F0718, 0xABCD, + 0xC80, 0x2D4000B5, + 0xCDCDCDCD, 0xCDCD, + 0xC80, 0x390000E4, + 0xFF0F0718, 0xDEAD, + 0xC84, 0x20F60000, + 0xC88, 0x40000100, + 0xC8C, 0x20200000, + 0xC90, 0x00091521, + 0xC94, 0x00000000, + 0xC98, 0x00121820, + 0xC9C, 0x00007F7F, + 0xCA0, 0x00000000, + 0xCA4, 0x000300A0, + 0xCA8, 0x00000000, + 0xCAC, 0x00000000, + 0xCB0, 0x00000000, + 0xCB4, 0x00000000, + 0xCB8, 0x00000000, + 0xCBC, 0x28000000, + 0xCC0, 0x00000000, + 0xCC4, 0x00000000, + 0xCC8, 0x00000000, + 0xCCC, 0x00000000, + 0xCD0, 0x00000000, + 0xCD4, 0x00000000, + 0xCD8, 0x64B22427, + 0xCDC, 0x00766932, + 0xCE0, 0x00222222, + 0xCE4, 0x00000000, + 0xCE8, 0x37644302, + 0xCEC, 0x2F97D40C, + 0xD00, 0x00000740, + 0xD04, 0x00020401, + 0xD08, 0x0000907F, + 0xD0C, 0x20010201, + 0xD10, 0xA0633333, + 0xD14, 0x3333BC43, + 0xD18, 0x7A8F5B6F, + 0xD2C, 0xCC979975, + 0xD30, 0x00000000, + 0xD34, 0x80608000, + 0xD38, 0x00000000, + 0xD3C, 0x00127353, + 0xD40, 0x00000000, + 0xD44, 0x00000000, + 0xD48, 0x00000000, + 0xD4C, 0x00000000, + 0xD50, 0x6437140A, + 0xD54, 0x00000000, + 0xD58, 0x00000282, + 0xD5C, 0x30032064, + 0xD60, 0x4653DE68, + 0xD64, 0x04518A3C, + 0xD68, 0x00002101, + 0xD6C, 0x2A201C16, + 0xD70, 0x1812362E, + 0xD74, 0x322C2220, + 0xD78, 0x000E3C24, + 0xE00, 0x2D2D2D2D, + 0xE04, 0x2D2D2D2D, + 0xE08, 0x0390272D, + 0xE10, 0x2D2D2D2D, + 0xE14, 0x2D2D2D2D, + 0xE18, 0x2D2D2D2D, + 0xE1C, 0x2D2D2D2D, + 0xE28, 0x00000000, + 0xE30, 0x1000DC1F, + 0xE34, 0x10008C1F, + 0xE38, 0x02140102, + 0xE3C, 0x681604C2, + 0xE40, 0x01007C00, + 0xE44, 0x01004800, + 0xE48, 0xFB000000, + 0xE4C, 0x000028D1, + 0xE50, 0x1000DC1F, + 0xE54, 0x10008C1F, + 0xE58, 0x02140102, + 0xE5C, 0x28160D05, + 0xE60, 0x00000008, + 0xE68, 0x001B25A4, + 0xE6C, 0x00C00014, + 0xE70, 0x00C00014, + 0xE74, 0x01000014, + 0xE78, 0x01000014, + 0xE7C, 0x01000014, + 0xE80, 0x01000014, + 0xE84, 0x00C00014, + 0xE88, 0x01000014, + 0xE8C, 0x00C00014, + 0xED0, 0x00C00014, + 0xED4, 0x00C00014, + 0xED8, 0x00C00014, + 0xEDC, 0x00000014, + 0xEE0, 0x00000014, + 0xFF0F0718, 0xABCD, + 0xEE8, 0x32555448, + 0xCDCDCDCD, 0xCDCD, + 0xEE8, 0x21555448, + 0xFF0F0718, 0xDEAD, + 0xEEC, 0x01C00014, + 0xF14, 0x00000003, + 0xF4C, 0x00000000, + 0xF00, 0x00000300, +}; + + +HAL_STATUS +ODM_ReadAndConfig_PHY_REG_1T_8188E( + IN PDM_ODM_T pDM_Odm + ) +{ + #define READ_NEXT_PAIR(v1, v2, i) do { i += 2; v1 = Array[i]; v2 = Array[i+1]; } while(0) + + u4Byte hex = 0; + u4Byte i = 0; + u2Byte count = 0; + pu4Byte ptr_array = NULL; + u1Byte platform = pDM_Odm->SupportPlatform; + u1Byte interfaceValue = pDM_Odm->SupportInterface; + u1Byte board = pDM_Odm->BoardType; + u4Byte ArrayLen = sizeof(Array_PHY_REG_1T_8188E)/sizeof(u4Byte); + pu4Byte Array = Array_PHY_REG_1T_8188E; + BOOLEAN biol = FALSE; +#ifdef CONFIG_IOL_IOREG_CFG + PADAPTER Adapter = pDM_Odm->Adapter; + struct xmit_frame *pxmit_frame; + u8 bndy_cnt=1; + #ifdef CONFIG_IOL_IOREG_CFG_DBG + struct cmd_cmp cmpdata[ArrayLen]; + u4Byte cmpdata_idx=0; + #endif +#endif//#ifdef CONFIG_IOL_IOREG_CFG + HAL_STATUS rst =HAL_STATUS_SUCCESS; + hex += board; + hex += interfaceValue << 8; + hex += platform << 16; + hex += 0xFF000000; +#ifdef CONFIG_IOL_IOREG_CFG + biol = rtw_IOL_applied(Adapter); + + if(biol){ + if((pxmit_frame=rtw_IOL_accquire_xmit_frame(Adapter)) == NULL) + { + printk("rtw_IOL_accquire_xmit_frame failed\n"); + return HAL_STATUS_FAILURE; + } + } +#endif//#ifdef CONFIG_IOL_IOREG_CFG + + for (i = 0; i < ArrayLen; i += 2 ) + { + u4Byte v1 = Array[i]; + u4Byte v2 = Array[i+1]; + + + // This (offset, data) pair meets the condition. + if ( v1 < 0xCDCDCDCD ) + { + #ifdef CONFIG_IOL_IOREG_CFG + if(biol){ + if(rtw_IOL_cmd_boundary_handle(pxmit_frame)) + bndy_cnt++; + + + if (v1 == 0xfe){ + rtw_IOL_append_DELAY_MS_cmd(pxmit_frame,50); + } + else if (v1 == 0xfd){ + rtw_IOL_append_DELAY_MS_cmd(pxmit_frame,5); + } + else if (v1 == 0xfc){ + rtw_IOL_append_DELAY_MS_cmd(pxmit_frame,1); + } + else if (v1 == 0xfb){ + rtw_IOL_append_DELAY_US_cmd(pxmit_frame,50); + } + else if (v1 == 0xfa){ + rtw_IOL_append_DELAY_US_cmd(pxmit_frame, 5); + } + else if (v1 == 0xf9){ + rtw_IOL_append_DELAY_US_cmd(pxmit_frame,1); + } + else{ + if (v1 == 0xa24) + pDM_Odm->RFCalibrateInfo.RegA24 = v2; + + rtw_IOL_append_WD_cmd(pxmit_frame,(u2Byte)v1, v2,bMaskDWord); + #ifdef CONFIG_IOL_IOREG_CFG_DBG + cmpdata[cmpdata_idx].addr = v1; + cmpdata[cmpdata_idx].value= v2; + cmpdata_idx++; + #endif + } + } + else + #endif //#ifdef CONFIG_IOL_IOREG_CFG + { + odm_ConfigBB_PHY_8188E(pDM_Odm, v1, bMaskDWord, v2); + } + continue; + } + else + { // This line is the start line of branch. + if ( !CheckCondition(Array[i], hex) ) + { // Discard the following (offset, data) pairs. + READ_NEXT_PAIR(v1, v2, i); + while (v2 != 0xDEAD && + v2 != 0xCDEF && + v2 != 0xCDCD && i < ArrayLen -2) + { + READ_NEXT_PAIR(v1, v2, i); + } + i -= 2; // prevent from for-loop += 2 + } + else // Configure matched pairs and skip to end of if-else. + { + READ_NEXT_PAIR(v1, v2, i); + while (v2 != 0xDEAD && + v2 != 0xCDEF && + v2 != 0xCDCD && i < ArrayLen -2) + { + #ifdef CONFIG_IOL_IOREG_CFG + if(biol){ + if(rtw_IOL_cmd_boundary_handle(pxmit_frame)) + bndy_cnt++; + if (v1 == 0xfe){ + rtw_IOL_append_DELAY_MS_cmd(pxmit_frame,50); + } + else if (v1 == 0xfd){ + rtw_IOL_append_DELAY_MS_cmd(pxmit_frame,5); + } + else if (v1 == 0xfc){ + rtw_IOL_append_DELAY_MS_cmd(pxmit_frame,1); + } + else if (v1 == 0xfb){ + rtw_IOL_append_DELAY_US_cmd(pxmit_frame,50); + } + else if (v1 == 0xfa){ + rtw_IOL_append_DELAY_US_cmd(pxmit_frame,5); + } + else if (v1 == 0xf9){ + rtw_IOL_append_DELAY_US_cmd(pxmit_frame,1); + } + else{ + if (v1 == 0xa24) + pDM_Odm->RFCalibrateInfo.RegA24 = v2; + + rtw_IOL_append_WD_cmd(pxmit_frame,(u2Byte)v1, v2,bMaskDWord); + #ifdef CONFIG_IOL_IOREG_CFG_DBG + cmpdata[cmpdata_idx].addr = v1; + cmpdata[cmpdata_idx].value= v2; + cmpdata_idx++; + #endif + } + } + else + #endif //#ifdef CONFIG_IOL_IOREG_CFG + { + odm_ConfigBB_PHY_8188E(pDM_Odm, v1, bMaskDWord, v2); + } + READ_NEXT_PAIR(v1, v2, i); + } + + while (v2 != 0xDEAD && i < ArrayLen -2) + { + READ_NEXT_PAIR(v1, v2, i); + } + + } + } + } +#ifdef CONFIG_IOL_IOREG_CFG + if(biol){ + //printk("==> %s, pktlen = %d,bndy_cnt = %d\n",__FUNCTION__,pxmit_frame->attrib.pktlen+4+32,bndy_cnt); + if(rtw_IOL_exec_cmds_sync(pDM_Odm->Adapter, pxmit_frame, 1000, bndy_cnt)) + { + #ifdef CONFIG_IOL_IOREG_CFG_DBG + printk("~~~ %s IOL_exec_cmds Success !!! \n",__FUNCTION__); + { + u4Byte idx; + u4Byte cdata; + printk(" %s data compare => array_len:%d \n",__FUNCTION__,cmpdata_idx); + printk("### %s data compared !!###\n",__FUNCTION__); + for(idx=0;idx< cmpdata_idx;idx++) + { + cdata = ODM_Read4Byte(pDM_Odm, cmpdata[idx].addr); + if(cdata != cmpdata[idx].value){ + printk(" addr:0x%04x, data:(0x%02x : 0x%02x) \n", + cmpdata[idx].addr,cmpdata[idx].value,cdata); + rst = HAL_STATUS_FAILURE; + } + } + printk("### %s data compared !!###\n",__FUNCTION__); + //if(rst == HAL_STATUS_FAILURE) + {//dump data from TX packet buffer + rtw_IOL_cmd_tx_pkt_buf_dump(pDM_Odm->Adapter,pxmit_frame->attrib.pktlen+32); + } + + } + #endif //CONFIG_IOL_IOREG_CFG_DBG + + } + else{ + rst = HAL_STATUS_FAILURE; + printk("~~~ IOL Config %s Failed !!! \n",__FUNCTION__); + #ifdef CONFIG_IOL_IOREG_CFG_DBG + { + //dump data from TX packet buffer + rtw_IOL_cmd_tx_pkt_buf_dump(pDM_Odm->Adapter,pxmit_frame->attrib.pktlen+32); + } + #endif //CONFIG_IOL_IOREG_CFG_DBG + } + } +#endif //#ifdef CONFIG_IOL_IOREG_CFG + return rst; +} +/****************************************************************************** +* PHY_REG_1T_ICUT.TXT +******************************************************************************/ + +u4Byte Array_MP_8188E_PHY_REG_1T_ICUT[] = { + 0x800, 0x80040000, + 0x804, 0x00000003, + 0x808, 0x0000FC00, + 0x80C, 0x0000000A, + 0x810, 0x10001331, + 0x814, 0x020C3D10, + 0x818, 0x02200385, + 0x81C, 0x00000000, + 0x820, 0x01000100, + 0x824, 0x00390204, + 0x828, 0x00000000, + 0x82C, 0x00000000, + 0x830, 0x00000000, + 0x834, 0x00000000, + 0x838, 0x00000000, + 0x83C, 0x00000000, + 0x840, 0x00010000, + 0x844, 0x00000000, + 0x848, 0x00000000, + 0x84C, 0x00000000, + 0x850, 0x00000000, + 0x854, 0x00000000, + 0x858, 0x569A11A9, + 0x85C, 0x01000014, + 0x860, 0x66F60110, + 0x864, 0x061F0649, + 0x868, 0x00000000, + 0x86C, 0x27272700, + 0x870, 0x07000760, + 0x874, 0x25004000, + 0x878, 0x00000808, + 0x87C, 0x00000000, + 0x880, 0xB0000C1C, + 0x884, 0x00000001, + 0x888, 0x00000000, + 0x88C, 0xCCC000C0, + 0x890, 0x00000800, + 0x894, 0xFFFFFFFE, + 0x898, 0x40302010, + 0x89C, 0x00706050, + 0x900, 0x00000000, + 0x904, 0x00000023, + 0x908, 0x00000000, + 0x90C, 0x81121111, + 0x910, 0x00000002, + 0x914, 0x00000201, + 0xA00, 0x00D047C8, + 0xA04, 0x80FF000C, + 0xA08, 0x8C838300, + 0xA0C, 0x2E7F120F, + 0xA10, 0x9500BB78, + 0xA14, 0x1114D028, + 0xA18, 0x00881117, + 0xA1C, 0x89140F00, + 0xA20, 0x1A1B0000, + 0xA24, 0x090E1317, + 0xA28, 0x00000204, + 0xA2C, 0x00D30000, + 0xA70, 0x101FBF00, + 0xA74, 0x00000007, + 0xA78, 0x00000900, + 0xA7C, 0x225B0606, + 0xA80, 0x218075B1, + 0xB2C, 0x80000000, + 0xC00, 0x48071D40, + 0xC04, 0x03A05611, + 0xC08, 0x000000E4, + 0xC0C, 0x6C6C6C6C, + 0xC10, 0x08800000, + 0xC14, 0x40000100, + 0xC18, 0x08800000, + 0xC1C, 0x40000100, + 0xC20, 0x00000000, + 0xC24, 0x00000000, + 0xC28, 0x00000000, + 0xC2C, 0x00000000, + 0xC30, 0x69E9AC47, + 0xC34, 0x469652AF, + 0xC38, 0x49795994, + 0xC3C, 0x0A97971C, + 0xC40, 0x1F7C403F, + 0xC44, 0x000100B7, + 0xC48, 0xEC020107, + 0xC4C, 0x007F037F, + 0xC50, 0x69553420, + 0xC54, 0x43BC0094, + 0xC58, 0x00013159, + 0xC5C, 0x00250492, + 0xC60, 0x00000000, + 0xC64, 0x7112848B, + 0xC68, 0x47C00BFF, + 0xC6C, 0x00000036, + 0xC70, 0x2C7F000D, + 0xC74, 0x028610DB, + 0xC78, 0x0000001F, + 0xC7C, 0x00B91612, + 0xC80, 0x390000E4, + 0xC84, 0x20F60000, + 0xC88, 0x40000100, + 0xC8C, 0x20200000, + 0xC90, 0x00091521, + 0xC94, 0x00000000, + 0xC98, 0x00121820, + 0xC9C, 0x00007F7F, + 0xCA0, 0x00000000, + 0xCA4, 0x000300A0, + 0xCA8, 0xFFFF0000, + 0xCAC, 0x00000000, + 0xCB0, 0x00000000, + 0xCB4, 0x00000000, + 0xCB8, 0x00000000, + 0xCBC, 0x28000000, + 0xCC0, 0x00000000, + 0xCC4, 0x00000000, + 0xCC8, 0x00000000, + 0xCCC, 0x00000000, + 0xCD0, 0x00000000, + 0xCD4, 0x00000000, + 0xCD8, 0x64B22427, + 0xCDC, 0x00766932, + 0xCE0, 0x00222222, + 0xCE4, 0x00000000, + 0xCE8, 0x37644302, + 0xCEC, 0x2F97D40C, + 0xD00, 0x00000740, + 0xD04, 0x00020401, + 0xD08, 0x0000907F, + 0xD0C, 0x20010201, + 0xD10, 0xA0633333, + 0xD14, 0x3333BC43, + 0xD18, 0x7A8F5B6F, + 0xD2C, 0xCC979975, + 0xD30, 0x00000000, + 0xD34, 0x80608000, + 0xD38, 0x00000000, + 0xD3C, 0x00127353, + 0xD40, 0x00000000, + 0xD44, 0x00000000, + 0xD48, 0x00000000, + 0xD4C, 0x00000000, + 0xD50, 0x6437140A, + 0xD54, 0x00000000, + 0xD58, 0x00000282, + 0xD5C, 0x30032064, + 0xD60, 0x4653DE68, + 0xD64, 0x04518A3C, + 0xD68, 0x00002101, + 0xD6C, 0x2A201C16, + 0xD70, 0x1812362E, + 0xD74, 0x322C2220, + 0xD78, 0x000E3C24, + 0xE00, 0x2D2D2D2D, + 0xE04, 0x2D2D2D2D, + 0xE08, 0x0390272D, + 0xE10, 0x2D2D2D2D, + 0xE14, 0x2D2D2D2D, + 0xE18, 0x2D2D2D2D, + 0xE1C, 0x2D2D2D2D, + 0xE28, 0x00000000, + 0xE30, 0x1000DC1F, + 0xE34, 0x10008C1F, + 0xE38, 0x02140102, + 0xE3C, 0x681604C2, + 0xE40, 0x01007C00, + 0xE44, 0x01004800, + 0xE48, 0xFB000000, + 0xE4C, 0x000028D1, + 0xE50, 0x1000DC1F, + 0xE54, 0x10008C1F, + 0xE58, 0x02140102, + 0xE5C, 0x28160D05, + 0xE60, 0x00000008, + 0xE68, 0x001B25A4, + 0xE6C, 0x00C00014, + 0xE70, 0x00C00014, + 0xE74, 0x01000014, + 0xE78, 0x01000014, + 0xE7C, 0x01000014, + 0xE80, 0x01000014, + 0xE84, 0x00C00014, + 0xE88, 0x01000014, + 0xE8C, 0x00C00014, + 0xED0, 0x00C00014, + 0xED4, 0x00C00014, + 0xED8, 0x00C00014, + 0xEDC, 0x00000014, + 0xEE0, 0x00000014, + 0xEEC, 0x01C00014, + 0xF14, 0x00000003, + 0xF4C, 0x00000000, + 0xF00, 0x00000300, + +}; + +void +ODM_ReadAndConfig_PHY_REG_1T_ICUT_8188E( + IN PDM_ODM_T pDM_Odm + ) +{ + #define READ_NEXT_PAIR(v1, v2, i) do { i += 2; v1 = Array[i]; v2 = Array[i+1]; } while(0) + + u4Byte hex = 0; + u4Byte i = 0; + u2Byte count = 0; + pu4Byte ptr_array = NULL; + u1Byte platform = pDM_Odm->SupportPlatform; + u1Byte _interface = pDM_Odm->SupportInterface; + u1Byte board = pDM_Odm->BoardType; + u4Byte ArrayLen = sizeof(Array_MP_8188E_PHY_REG_1T_ICUT)/sizeof(u4Byte); + pu4Byte Array = Array_MP_8188E_PHY_REG_1T_ICUT; + + + hex += board; + hex += _interface << 8; + hex += platform << 16; + hex += 0xFF000000; + ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_TRACE, ("===> ODM_ReadAndConfig_MP_8188E_PHY_REG_1T_ICUT, hex = 0x%X\n", hex)); + + for (i = 0; i < ArrayLen; i += 2 ) + { + u4Byte v1 = Array[i]; + u4Byte v2 = Array[i+1]; + + // This (offset, data) pair meets the condition. + if ( v1 < 0xCDCDCDCD ) + { + odm_ConfigBB_PHY_8188E(pDM_Odm, v1, bMaskDWord, v2); + continue; + } + else + { // This line is the start line of branch. + if ( !CheckCondition(Array[i], hex) ) + { // Discard the following (offset, data) pairs. + READ_NEXT_PAIR(v1, v2, i); + while (v2 != 0xDEAD && + v2 != 0xCDEF && + v2 != 0xCDCD && i < ArrayLen -2) + { + READ_NEXT_PAIR(v1, v2, i); + } + i -= 2; // prevent from for-loop += 2 + } + else // Configure matched pairs and skip to end of if-else. + { + READ_NEXT_PAIR(v1, v2, i); + while (v2 != 0xDEAD && + v2 != 0xCDEF && + v2 != 0xCDCD && i < ArrayLen -2) + { + odm_ConfigBB_PHY_8188E(pDM_Odm, v1, bMaskDWord, v2); + READ_NEXT_PAIR(v1, v2, i); + } + + while (v2 != 0xDEAD && i < ArrayLen -2) + { + READ_NEXT_PAIR(v1, v2, i); + } + + } + } + } + +} + + +/****************************************************************************** +* PHY_REG_PG.TXT +******************************************************************************/ + +u4Byte Array_PHY_REG_PG_8188E[] = { + 0, 0, 0, 0x00000e08, 0x0000ff00, 0x00004000, + 0, 0, 0, 0x0000086c, 0xffffff00, 0x34363800, + 0, 0, 0, 0x00000e00, 0xffffffff, 0x42444646, + 0, 0, 0, 0x00000e04, 0xffffffff, 0x30343840, + 0, 0, 0, 0x00000e10, 0xffffffff, 0x38404244, + 0, 0, 0, 0x00000e14, 0xffffffff, 0x26303436 + +}; + +void +ODM_ReadAndConfig_PHY_REG_PG_8188E( + IN PDM_ODM_T pDM_Odm + ) +{ + u4Byte hex = 0; + u4Byte i = 0; + u2Byte count = 0; + pu4Byte ptr_array = NULL; + u1Byte platform = pDM_Odm->SupportPlatform; + u1Byte interfaceValue = pDM_Odm->SupportInterface; + u1Byte board = pDM_Odm->BoardType; + u4Byte ArrayLen = sizeof(Array_PHY_REG_PG_8188E)/sizeof(u4Byte); + pu4Byte Array = Array_PHY_REG_PG_8188E; + BOOLEAN biol = FALSE; + + hex += board; + hex += interfaceValue << 8; + hex += platform << 16; + hex += 0xFF000000; + for (i = 0; i < ArrayLen; i += 6 ) + { + u4Byte v1 = Array[i]; + u4Byte v2 = Array[i+1]; + u4Byte v3 = Array[i+2]; + u4Byte v4 = Array[i+3]; + u4Byte v5 = Array[i+4]; + u4Byte v6 = Array[i+5]; + + // this line is a line of pure_body + if ( v1 < 0xCDCDCDCD ) + { + + odm_ConfigBB_PHY_REG_PG_8188E(pDM_Odm, v1, v2, v3); + + continue; + } + else + { // this line is the start of branch + if ( !CheckCondition(Array[i], hex) ) + { // don't need the hw_body + i += 2; // skip the pair of expression + v1 = Array[i]; + v2 = Array[i+1]; + v3 = Array[i+2]; + while (v2 != 0xDEAD) + { + i += 3; + v1 = Array[i]; + v2 = Array[i+1]; + v3 = Array[i+1]; + } + } + } + } + +} + + + +#endif // end of HWIMG_SUPPORT diff --git a/hal/HalHWImg8188E_FW.c b/hal/HalHWImg8188E_FW.c index 9b3134b..6566156 100755 --- a/hal/HalHWImg8188E_FW.c +++ b/hal/HalHWImg8188E_FW.c @@ -1,1034 +1,1033 @@ -/****************************************************************************** -* -* 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 -* -* -******************************************************************************/ -#if 0 -#include "Mp_Precomp.h" -#endif -#include "../odm_precomp.h" - -#if (RTL8188E_SUPPORT == 1) -#if(DM_ODM_SUPPORT_TYPE & (ODM_AP)) - - -u1Byte Array_8188E_FW_AP[] = { - -}; -u4Byte ArrayLength_8188E_FW_AP = 0; - - -void -ODM_ReadFirmware_8188E_FW_AP( - IN PDM_ODM_T pDM_Odm, - OUT u1Byte *pFirmware, - OUT u4Byte *pFirmwareSize -) -{ - ODM_MoveMemory(pDM_Odm, pFirmware, Array_8188E_FW_AP, ArrayLength_8188E_FW_AP); - *pFirmwareSize = ArrayLength_8188E_FW_AP; -} - - -#else - -#if 0 -u1Byte Array_8188E_FW_NIC[] = { - -}; -u4Byte ArrayLength_8188E_FW_NIC = 0; - - -void -ODM_ReadFirmware_8188E_FW_NIC( - IN PDM_ODM_T pDM_Odm, - OUT u1Byte *pFirmware, - OUT u4Byte *pFirmwareSize -) -{ - ODM_MoveMemory(pDM_Odm, pFirmware, Array_8188E_FW_NIC, ArrayLength_8188E_FW_NIC); - *pFirmwareSize = ArrayLength_8188E_FW_NIC; -} -#endif - -const u8 Array_8188E_FW_WoWLAN[] = { -0xE1, 0x88, 0x30, 0x00, 0x0D, 0x00, 0x00, 0x00, 0x06, 0x27, 0x15, 0x23, 0xC8, 0x3A, 0x00, 0x00, -0x6E, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x02, 0x46, 0xD5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0xE1, 0xF8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0xE1, 0x6F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x4F, 0xE9, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0xE7, 0x09, 0xF6, 0x08, 0xDF, 0xFA, 0x80, 0x46, 0xE7, 0x09, 0xF2, 0x08, 0xDF, 0xFA, 0x80, 0x3E, -0x88, 0x82, 0x8C, 0x83, 0xE7, 0x09, 0xF0, 0xA3, 0xDF, 0xFA, 0x80, 0x32, 0xE3, 0x09, 0xF6, 0x08, -0xDF, 0xFA, 0x80, 0x78, 0xE3, 0x09, 0xF2, 0x08, 0xDF, 0xFA, 0x80, 0x70, 0x88, 0x82, 0x8C, 0x83, -0xE3, 0x09, 0xF0, 0xA3, 0xDF, 0xFA, 0x80, 0x64, 0x89, 0x82, 0x8A, 0x83, 0xE0, 0xA3, 0xF6, 0x08, -0xDF, 0xFA, 0x80, 0x58, 0x89, 0x82, 0x8A, 0x83, 0xE0, 0xA3, 0xF2, 0x08, 0xDF, 0xFA, 0x80, 0x4C, -0x80, 0xD2, 0x80, 0xFA, 0x80, 0xC6, 0x80, 0xD4, 0x80, 0x69, 0x80, 0xF2, 0x80, 0x33, 0x80, 0x10, -0x80, 0xA6, 0x80, 0xEA, 0x80, 0x9A, 0x80, 0xA8, 0x80, 0xDA, 0x80, 0xE2, 0x80, 0xCA, 0x80, 0x33, -0x89, 0x82, 0x8A, 0x83, 0xEC, 0xFA, 0xE4, 0x93, 0xA3, 0xC8, 0xC5, 0x82, 0xC8, 0xCC, 0xC5, 0x83, -0xCC, 0xF0, 0xA3, 0xC8, 0xC5, 0x82, 0xC8, 0xCC, 0xC5, 0x83, 0xCC, 0xDF, 0xE9, 0xDE, 0xE7, 0x80, -0x0D, 0x89, 0x82, 0x8A, 0x83, 0xE4, 0x93, 0xA3, 0xF6, 0x08, 0xDF, 0xF9, 0xEC, 0xFA, 0xA9, 0xF0, -0xED, 0xFB, 0x22, 0x89, 0x82, 0x8A, 0x83, 0xEC, 0xFA, 0xE0, 0xA3, 0xC8, 0xC5, 0x82, 0xC8, 0xCC, -0xC5, 0x83, 0xCC, 0xF0, 0xA3, 0xC8, 0xC5, 0x82, 0xC8, 0xCC, 0xC5, 0x83, 0xCC, 0xDF, 0xEA, 0xDE, -0xE8, 0x80, 0xDB, 0x89, 0x82, 0x8A, 0x83, 0xE4, 0x93, 0xA3, 0xF2, 0x08, 0xDF, 0xF9, 0x80, 0xCC, -0x88, 0xF0, 0xEF, 0x60, 0x01, 0x0E, 0x4E, 0x60, 0xC3, 0x88, 0xF0, 0xED, 0x24, 0x02, 0xB4, 0x04, -0x00, 0x50, 0xB9, 0xF5, 0x82, 0xEB, 0x24, 0x02, 0xB4, 0x04, 0x00, 0x50, 0xAF, 0x23, 0x23, 0x45, -0x82, 0x23, 0x90, 0x41, 0x50, 0x73, 0xC5, 0xF0, 0xF8, 0xA3, 0xE0, 0x28, 0xF0, 0xC5, 0xF0, 0xF8, -0xE5, 0x82, 0x15, 0x82, 0x70, 0x02, 0x15, 0x83, 0xE0, 0x38, 0xF0, 0x22, 0xEF, 0x5B, 0xFF, 0xEE, -0x5A, 0xFE, 0xED, 0x59, 0xFD, 0xEC, 0x58, 0xFC, 0x22, 0xEF, 0x4B, 0xFF, 0xEE, 0x4A, 0xFE, 0xED, -0x49, 0xFD, 0xEC, 0x48, 0xFC, 0x22, 0xE0, 0xFC, 0xA3, 0xE0, 0xFD, 0xA3, 0xE0, 0xFE, 0xA3, 0xE0, -0xFF, 0x22, 0xE0, 0xF8, 0xA3, 0xE0, 0xF9, 0xA3, 0xE0, 0xFA, 0xA3, 0xE0, 0xFB, 0x22, 0xA4, 0x25, -0x82, 0xF5, 0x82, 0xE5, 0xF0, 0x35, 0x83, 0xF5, 0x83, 0x22, 0xE0, 0xFB, 0xA3, 0xE0, 0xFA, 0xA3, -0xE0, 0xF9, 0x22, 0xEB, 0xF0, 0xA3, 0xEA, 0xF0, 0xA3, 0xE9, 0xF0, 0x22, 0xD0, 0x83, 0xD0, 0x82, -0xF8, 0xE4, 0x93, 0x70, 0x12, 0x74, 0x01, 0x93, 0x70, 0x0D, 0xA3, 0xA3, 0x93, 0xF8, 0x74, 0x01, -0x93, 0xF5, 0x82, 0x88, 0x83, 0xE4, 0x73, 0x74, 0x02, 0x93, 0x68, 0x60, 0xEF, 0xA3, 0xA3, 0xA3, -0x80, 0xDF, 0xE3, 0xF5, 0xF0, 0x09, 0xE2, 0x08, 0xB5, 0xF0, 0x6B, 0xDF, 0xF5, 0x80, 0x67, 0xE3, -0xF5, 0xF0, 0x09, 0xE6, 0x08, 0xB5, 0xF0, 0x5E, 0xDF, 0xF5, 0x80, 0x5A, 0x87, 0xF0, 0x09, 0xE6, -0x08, 0xB5, 0xF0, 0x52, 0xDF, 0xF6, 0x80, 0x4E, 0x87, 0xF0, 0x09, 0xE2, 0x08, 0xB5, 0xF0, 0x46, -0xDF, 0xF6, 0x80, 0x42, 0x88, 0x82, 0x8C, 0x83, 0x87, 0xF0, 0x09, 0xE0, 0xA3, 0xB5, 0xF0, 0x36, -0xDF, 0xF6, 0x80, 0x32, 0x88, 0x82, 0x8C, 0x83, 0x87, 0xF0, 0x09, 0xE4, 0x93, 0xA3, 0xB5, 0xF0, -0x25, 0xDF, 0xF5, 0x80, 0x21, 0x88, 0x82, 0x8C, 0x83, 0xE3, 0xF5, 0xF0, 0x09, 0xE0, 0xA3, 0xB5, -0xF0, 0x14, 0xDF, 0xF5, 0x80, 0x10, 0x88, 0x82, 0x8C, 0x83, 0xE3, 0xF5, 0xF0, 0x09, 0xE4, 0x93, -0xA3, 0xB5, 0xF0, 0x02, 0xDF, 0xF4, 0x02, 0x43, 0xB1, 0x80, 0x87, 0x80, 0xE9, 0x80, 0x90, 0x80, -0xD4, 0x80, 0x3E, 0x80, 0x15, 0x80, 0x6E, 0x80, 0x7E, 0x80, 0x9D, 0x80, 0xB7, 0x80, 0x8D, 0x80, -0xA3, 0x80, 0x51, 0x80, 0x74, 0x80, 0x3C, 0x02, 0x43, 0xBD, 0x89, 0x82, 0x8A, 0x83, 0xEC, 0xFA, -0xE4, 0x93, 0xF5, 0xF0, 0xA3, 0xC8, 0xC5, 0x82, 0xC8, 0xCC, 0xC5, 0x83, 0xCC, 0xE4, 0x93, 0xA3, -0xC8, 0xC5, 0x82, 0xC8, 0xCC, 0xC5, 0x83, 0xCC, 0xB5, 0xF0, 0x76, 0xDF, 0xE3, 0xDE, 0xE1, 0x80, -0x70, 0x89, 0x82, 0x8A, 0x83, 0xE4, 0x93, 0xF5, 0xF0, 0xA3, 0xE2, 0x08, 0xB5, 0xF0, 0x62, 0xDF, -0xF4, 0x80, 0x5E, 0x89, 0x82, 0x8A, 0x83, 0xE0, 0xF5, 0xF0, 0xA3, 0xE6, 0x08, 0xB5, 0xF0, 0x51, -0xDF, 0xF5, 0x80, 0x4D, 0x89, 0x82, 0x8A, 0x83, 0xE0, 0xF5, 0xF0, 0xA3, 0xE2, 0x08, 0xB5, 0xF0, -0x40, 0xDF, 0xF5, 0x80, 0x3C, 0x89, 0x82, 0x8A, 0x83, 0xE4, 0x93, 0xF5, 0xF0, 0xA3, 0xE6, 0x08, -0xB5, 0xF0, 0x2E, 0xDF, 0xF4, 0x80, 0x2A, 0x80, 0x02, 0x80, 0x57, 0x89, 0x82, 0x8A, 0x83, 0xEC, -0xFA, 0xE4, 0x93, 0xF5, 0xF0, 0xA3, 0xC8, 0xC5, 0x82, 0xC8, 0xCC, 0xC5, 0x83, 0xCC, 0xE0, 0xA3, -0xC8, 0xC5, 0x82, 0xC8, 0xCC, 0xC5, 0x83, 0xCC, 0xB5, 0xF0, 0x06, 0xDF, 0xE4, 0xDE, 0xE2, 0x80, -0x00, 0x7F, 0xFF, 0xB5, 0xF0, 0x02, 0x0F, 0x22, 0x40, 0x02, 0x7F, 0x01, 0x22, 0x89, 0x82, 0x8A, -0x83, 0xEC, 0xFA, 0xE0, 0xF5, 0xF0, 0xA3, 0xC8, 0xC5, 0x82, 0xC8, 0xCC, 0xC5, 0x83, 0xCC, 0xE0, -0xA3, 0xC8, 0xC5, 0x82, 0xC8, 0xCC, 0xC5, 0x83, 0xCC, 0xB5, 0xF0, 0xD5, 0xDF, 0xE5, 0xDE, 0xE3, -0x80, 0xCF, 0x89, 0x82, 0x8A, 0x83, 0xEC, 0xFA, 0xE0, 0xF5, 0xF0, 0xA3, 0xC8, 0xC5, 0x82, 0xC8, -0xCC, 0xC5, 0x83, 0xCC, 0xE4, 0x93, 0xA3, 0xC8, 0xC5, 0x82, 0xC8, 0xCC, 0xC5, 0x83, 0xCC, 0xB5, -0xF0, 0xAF, 0xDF, 0xE4, 0xDE, 0xE2, 0x80, 0xA9, 0x88, 0xF0, 0xEF, 0x60, 0x01, 0x0E, 0x4E, 0x60, -0xAB, 0xED, 0x24, 0x02, 0xB4, 0x04, 0x00, 0x50, 0x98, 0xF5, 0x82, 0xEB, 0x24, 0x02, 0xB4, 0x04, -0x00, 0x50, 0x8E, 0x23, 0x23, 0x45, 0x82, 0x23, 0x90, 0x42, 0xF9, 0x73, 0xC2, 0xAF, 0x80, 0xFE, -0x32, 0x12, 0x44, 0x30, 0x85, 0xD0, 0x0B, 0x75, 0xD0, 0x08, 0xAA, 0xE0, 0xC2, 0x8C, 0xE5, 0x8A, -0x24, 0x67, 0xF5, 0x8A, 0xE5, 0x8C, 0x34, 0x79, 0xF5, 0x8C, 0xD2, 0x8C, 0xEC, 0x24, 0x87, 0xF8, -0xE6, 0xBC, 0x02, 0x02, 0x74, 0xFF, 0xC3, 0x95, 0x81, 0xB4, 0x40, 0x00, 0x40, 0xCE, 0x79, 0x03, -0x78, 0x80, 0x16, 0xE6, 0x08, 0x70, 0x0B, 0xC2, 0xAF, 0xE6, 0x30, 0xE1, 0x03, 0x44, 0x18, 0xF6, -0xD2, 0xAF, 0x08, 0xD9, 0xED, 0xEA, 0x8B, 0xD0, 0x22, 0xE5, 0x0C, 0xFF, 0x23, 0x24, 0x81, 0xF8, -0x0F, 0x08, 0x08, 0xBF, 0x03, 0x04, 0x7F, 0x00, 0x78, 0x81, 0xE6, 0x30, 0xE4, 0xF2, 0x00, 0xE5, -0x0C, 0xC3, 0x9F, 0x50, 0x20, 0x05, 0x0C, 0x74, 0x86, 0x25, 0x0C, 0xF8, 0xE6, 0xFD, 0xA6, 0x81, -0x08, 0xE6, 0xAE, 0x0C, 0xBE, 0x02, 0x02, 0x74, 0xFF, 0xCD, 0xF8, 0xE8, 0x6D, 0x60, 0xE0, 0x08, -0xE6, 0xC0, 0xE0, 0x80, 0xF6, 0xE5, 0x0C, 0xD3, 0x9F, 0x40, 0x27, 0xE5, 0x0C, 0x24, 0x87, 0xF8, -0xE6, 0xAE, 0x0C, 0xBE, 0x02, 0x02, 0x74, 0xFF, 0xFD, 0x18, 0xE6, 0xCD, 0xF8, 0xE5, 0x81, 0x6D, -0x60, 0x06, 0xD0, 0xE0, 0xF6, 0x18, 0x80, 0xF5, 0xE5, 0x0C, 0x24, 0x86, 0xC8, 0xF6, 0x15, 0x0C, -0x80, 0xD3, 0xE5, 0x0C, 0x23, 0x24, 0x81, 0xF8, 0x7F, 0x04, 0xC2, 0xAF, 0xE6, 0x30, 0xE0, 0x03, -0x10, 0xE2, 0x0C, 0x7F, 0x00, 0x30, 0xE1, 0x07, 0x30, 0xE3, 0x04, 0x7F, 0x08, 0x54, 0xF4, 0x54, -0x7C, 0xC6, 0xD2, 0xAF, 0x54, 0x80, 0x42, 0x07, 0x22, 0x78, 0x86, 0xA6, 0x81, 0x74, 0x02, 0x60, -0x06, 0xFF, 0x08, 0x76, 0xFF, 0xDF, 0xFB, 0x7F, 0x03, 0xE4, 0x78, 0x80, 0xF6, 0x08, 0xF6, 0x08, -0xDF, 0xFA, 0x78, 0x81, 0x76, 0x30, 0x90, 0x47, 0x69, 0x74, 0x01, 0x93, 0xC0, 0xE0, 0xE4, 0x93, -0xC0, 0xE0, 0x43, 0x89, 0x01, 0x75, 0x8A, 0x60, 0x75, 0x8C, 0x79, 0xD2, 0x8C, 0xD2, 0xAF, 0x22, -0x02, 0xEF, 0xD3, 0x94, 0x02, 0x40, 0x03, 0x7F, 0xFF, 0x22, 0x74, 0x81, 0x2F, 0x2F, 0xF8, 0xE6, -0x20, 0xE5, 0xF4, 0xC2, 0xAF, 0xE6, 0x44, 0x30, 0xF6, 0xD2, 0xAF, 0xAE, 0x0C, 0xEE, 0xC3, 0x9F, -0x50, 0x21, 0x0E, 0x74, 0x86, 0x2E, 0xF8, 0xE6, 0xF9, 0x08, 0xE6, 0x18, 0xBE, 0x02, 0x02, 0x74, -0xFF, 0xFD, 0xED, 0x69, 0x60, 0x09, 0x09, 0xE7, 0x19, 0x19, 0xF7, 0x09, 0x09, 0x80, 0xF3, 0x16, -0x16, 0x80, 0xDA, 0xEE, 0xD3, 0x9F, 0x40, 0x04, 0x05, 0x81, 0x05, 0x81, 0xEE, 0xD3, 0x9F, 0x40, -0x22, 0x74, 0x86, 0x2E, 0xF8, 0x08, 0xE6, 0xF9, 0xEE, 0xB5, 0x0C, 0x02, 0xA9, 0x81, 0x18, 0x06, -0x06, 0xE6, 0xFD, 0xED, 0x69, 0x60, 0x09, 0x19, 0x19, 0xE7, 0x09, 0x09, 0xF7, 0x19, 0x80, 0xF3, -0x1E, 0x80, 0xD9, 0xEF, 0x24, 0x86, 0xF8, 0xE6, 0x04, 0xF8, 0xEF, 0x2F, 0x04, 0x90, 0x47, 0x69, -0x93, 0xF6, 0x08, 0xEF, 0x2F, 0x93, 0xF6, 0x7F, 0x00, 0x22, 0xEF, 0xD3, 0x94, 0x02, 0x40, 0x03, -0x7F, 0xFF, 0x22, 0xEF, 0x23, 0x24, 0x81, 0xF8, 0xE6, 0x30, 0xE5, 0xF4, 0xC2, 0xAF, 0xE6, 0x54, -0x8C, 0xF6, 0xD2, 0xAF, 0xE5, 0x0C, 0xB5, 0x07, 0x0A, 0x74, 0x86, 0x2F, 0xF8, 0xE6, 0xF5, 0x81, -0x02, 0x44, 0x79, 0x50, 0x2E, 0x74, 0x87, 0x2F, 0xF8, 0xE6, 0xBF, 0x02, 0x02, 0x74, 0xFF, 0xFD, -0x18, 0xE6, 0xF9, 0x74, 0x86, 0x2F, 0xF8, 0xFB, 0xE6, 0xFC, 0xE9, 0x6C, 0x60, 0x08, 0xA8, 0x05, -0xE7, 0xF6, 0x1D, 0x19, 0x80, 0xF4, 0xA8, 0x03, 0xA6, 0x05, 0x1F, 0xE5, 0x0C, 0xB5, 0x07, 0xE3, -0x7F, 0x00, 0x22, 0x74, 0x87, 0x2F, 0xF8, 0xE6, 0xFD, 0x18, 0x86, 0x01, 0x0F, 0x74, 0x86, 0x2F, -0xF8, 0xA6, 0x01, 0x08, 0x86, 0x04, 0xE5, 0x0C, 0xB5, 0x07, 0x02, 0xAC, 0x81, 0xED, 0x6C, 0x60, -0x08, 0x0D, 0x09, 0xA8, 0x05, 0xE6, 0xF7, 0x80, 0xF4, 0xE5, 0x0C, 0xB5, 0x07, 0xDE, 0x89, 0x81, -0x7F, 0x00, 0x22, 0xEF, 0xD3, 0x94, 0x02, 0x40, 0x03, 0x7F, 0xFF, 0x22, 0xEF, 0x23, 0x24, 0x81, -0xF8, 0xC2, 0xAF, 0xE6, 0x30, 0xE5, 0x05, 0x30, 0xE0, 0x02, 0xD2, 0xE4, 0xD2, 0xE2, 0xC6, 0xD2, -0xAF, 0x7F, 0x00, 0x30, 0xE2, 0x01, 0x0F, 0x02, 0x44, 0x78, 0x8F, 0xF0, 0xE4, 0xFF, 0xFE, 0xE5, -0x0C, 0x23, 0x24, 0x80, 0xF8, 0xC2, 0xA9, 0x30, 0xF7, 0x0D, 0x7F, 0x08, 0xE6, 0x60, 0x0B, 0x2D, -0xF6, 0x60, 0x30, 0x50, 0x2E, 0x80, 0x07, 0x30, 0xF1, 0x06, 0xED, 0xF6, 0x60, 0x25, 0x7E, 0x02, -0x08, 0x30, 0xF0, 0x10, 0xC2, 0xAF, 0xE6, 0x10, 0xE7, 0x23, 0x0E, 0x30, 0xE2, 0x0C, 0xD2, 0xAF, -0x7F, 0x04, 0x80, 0x12, 0xC2, 0xAF, 0xE6, 0x10, 0xE7, 0x13, 0x54, 0xEC, 0x4E, 0xF6, 0xD2, 0xAF, -0x02, 0x44, 0x79, 0x7F, 0x08, 0x08, 0xEF, 0x44, 0x83, 0xF4, 0xC2, 0xAF, 0x56, 0xC6, 0xD2, 0xAF, -0x54, 0x80, 0x4F, 0xFF, 0x22, 0x02, 0x47, 0x13, 0x02, 0x45, 0x09, 0xE4, 0x93, 0xA3, 0xF8, 0xE4, -0x93, 0xA3, 0x40, 0x03, 0xF6, 0x80, 0x01, 0xF2, 0x08, 0xDF, 0xF4, 0x80, 0x29, 0xE4, 0x93, 0xA3, -0xF8, 0x54, 0x07, 0x24, 0x0C, 0xC8, 0xC3, 0x33, 0xC4, 0x54, 0x0F, 0x44, 0x20, 0xC8, 0x83, 0x40, -0x04, 0xF4, 0x56, 0x80, 0x01, 0x46, 0xF6, 0xDF, 0xE4, 0x80, 0x0B, 0x01, 0x02, 0x04, 0x08, 0x10, -0x20, 0x40, 0x80, 0x90, 0x47, 0x58, 0xE4, 0x7E, 0x01, 0x93, 0x60, 0xBC, 0xA3, 0xFF, 0x54, 0x3F, -0x30, 0xE5, 0x09, 0x54, 0x1F, 0xFE, 0xE4, 0x93, 0xA3, 0x60, 0x01, 0x0E, 0xCF, 0x54, 0xC0, 0x25, -0xE0, 0x60, 0xA8, 0x40, 0xB8, 0xE4, 0x93, 0xA3, 0xFA, 0xE4, 0x93, 0xA3, 0xF8, 0xE4, 0x93, 0xA3, -0xC8, 0xC5, 0x82, 0xC8, 0xCA, 0xC5, 0x83, 0xCA, 0xF0, 0xA3, 0xC8, 0xC5, 0x82, 0xC8, 0xCA, 0xC5, -0x83, 0xCA, 0xDF, 0xE9, 0xDE, 0xE7, 0x80, 0xBE, 0x00, 0x41, 0x83, 0x23, 0x00, 0x41, 0x83, 0x24, -0x00, 0x41, 0x83, 0x37, 0x00, 0x41, 0x83, 0x38, 0x00, 0x59, 0x22, 0x5F, 0xE0, 0x63, 0x3F, 0xC0, -0xE0, 0xC0, 0xF0, 0xC0, 0x83, 0xC0, 0x82, 0xC0, 0xD0, 0x75, 0xD0, 0x00, 0xC0, 0x00, 0xC0, 0x01, -0xC0, 0x02, 0xC0, 0x03, 0xC0, 0x04, 0xC0, 0x05, 0xC0, 0x06, 0xC0, 0x07, 0x90, 0x01, 0xC4, 0x74, -0x6F, 0xF0, 0x74, 0x47, 0xA3, 0xF0, 0xF1, 0xBE, 0x74, 0x6F, 0x04, 0x90, 0x01, 0xC4, 0xF0, 0x74, -0x47, 0xA3, 0xF0, 0xD0, 0x07, 0xD0, 0x06, 0xD0, 0x05, 0xD0, 0x04, 0xD0, 0x03, 0xD0, 0x02, 0xD0, -0x01, 0xD0, 0x00, 0xD0, 0xD0, 0xD0, 0x82, 0xD0, 0x83, 0xD0, 0xF0, 0xD0, 0xE0, 0x32, 0x90, 0x00, -0x54, 0xE0, 0x55, 0x35, 0xF5, 0x39, 0xA3, 0xE0, 0x55, 0x36, 0xF5, 0x3A, 0xA3, 0xE0, 0x55, 0x37, -0xF5, 0x3B, 0xA3, 0xE0, 0x55, 0x38, 0xF5, 0x3C, 0xAD, 0x39, 0x7F, 0x54, 0x12, 0x32, 0x1E, 0xAD, -0x3A, 0x7F, 0x55, 0x12, 0x32, 0x1E, 0xAD, 0x3B, 0x7F, 0x56, 0x12, 0x32, 0x1E, 0xAD, 0x3C, 0x7F, -0x57, 0x12, 0x32, 0x1E, 0x53, 0x91, 0xEF, 0x22, 0xC0, 0xE0, 0xC0, 0xF0, 0xC0, 0x83, 0xC0, 0x82, -0xC0, 0xD0, 0x75, 0xD0, 0x00, 0xC0, 0x00, 0xC0, 0x01, 0xC0, 0x02, 0xC0, 0x03, 0xC0, 0x04, 0xC0, -0x05, 0xC0, 0x06, 0xC0, 0x07, 0x90, 0x01, 0xC4, 0x74, 0xF8, 0xF0, 0x74, 0x47, 0xA3, 0xF0, 0x12, -0x6E, 0x11, 0xE5, 0x41, 0x30, 0xE3, 0x02, 0x71, 0x8D, 0xE5, 0x41, 0x30, 0xE4, 0x02, 0x71, 0x66, -0xE5, 0x43, 0x30, 0xE0, 0x02, 0x11, 0x90, 0xE5, 0x43, 0x30, 0xE1, 0x03, 0x12, 0x5B, 0x66, 0xE5, -0x43, 0x30, 0xE2, 0x03, 0x12, 0x5A, 0xAD, 0xE5, 0x43, 0x30, 0xE3, 0x02, 0xF1, 0x53, 0xE5, 0x43, -0x30, 0xE4, 0x02, 0xF1, 0x97, 0xE5, 0x43, 0x30, 0xE5, 0x02, 0x91, 0x36, 0xE5, 0x43, 0x30, 0xE6, -0x02, 0xF1, 0x38, 0xE5, 0x44, 0x30, 0xE1, 0x02, 0x71, 0x7A, 0x74, 0xF8, 0x04, 0x90, 0x01, 0xC4, -0xF0, 0x74, 0x47, 0xA3, 0xF0, 0xD0, 0x07, 0xD0, 0x06, 0xD0, 0x05, 0xD0, 0x04, 0xD0, 0x03, 0xD0, -0x02, 0xD0, 0x01, 0xD0, 0x00, 0xD0, 0xD0, 0xD0, 0x82, 0xD0, 0x83, 0xD0, 0xF0, 0xD0, 0xE0, 0x32, -0xE4, 0xFF, 0x90, 0x81, 0x3B, 0xE0, 0x60, 0x77, 0x90, 0x80, 0xF7, 0xE0, 0x64, 0x01, 0x70, 0x6F, -0x90, 0x81, 0x3A, 0xE0, 0xC4, 0x54, 0x0F, 0x60, 0x24, 0x24, 0xFE, 0x60, 0x03, 0x04, 0x70, 0x1F, -0x90, 0x81, 0x42, 0xE0, 0x14, 0xF0, 0xE0, 0xFE, 0x60, 0x06, 0x90, 0x81, 0x44, 0xE0, 0x60, 0x0F, -0xEE, 0x70, 0x06, 0x90, 0x81, 0x41, 0xE0, 0xA3, 0xF0, 0x7F, 0x01, 0x80, 0x02, 0x7F, 0x01, 0xEF, -0x60, 0x3D, 0x90, 0x81, 0x3F, 0xE0, 0x44, 0x10, 0xF0, 0x90, 0x81, 0x44, 0xE0, 0x60, 0x03, 0xB4, -0x01, 0x09, 0xE4, 0xF5, 0x1D, 0x90, 0x81, 0x44, 0xE0, 0x80, 0x0D, 0xE4, 0xF5, 0x1D, 0x90, 0x81, -0x44, 0xE0, 0x75, 0xF0, 0x03, 0xA4, 0x24, 0xFE, 0xFF, 0x90, 0x81, 0x43, 0xE0, 0x2F, 0xD1, 0xD4, -0x90, 0x01, 0x57, 0x74, 0x05, 0xF0, 0x90, 0x81, 0x3E, 0xE0, 0x20, 0xE2, 0x02, 0x31, 0x10, 0x22, -0x7D, 0x01, 0x7F, 0x04, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0x83, 0x36, 0xED, 0xF0, -0x90, 0x81, 0x38, 0xE0, 0xFE, 0xC4, 0x13, 0x13, 0x54, 0x03, 0x30, 0xE0, 0x02, 0x41, 0x5D, 0xEE, -0xC4, 0x13, 0x13, 0x13, 0x54, 0x01, 0x30, 0xE0, 0x02, 0x41, 0x5D, 0x90, 0x81, 0x3E, 0xE0, 0xFE, -0x6F, 0x70, 0x02, 0x41, 0x5D, 0xEF, 0x70, 0x02, 0x21, 0xD4, 0x24, 0xFE, 0x70, 0x02, 0x41, 0x0E, -0x24, 0xFE, 0x60, 0x48, 0x24, 0xFC, 0x70, 0x02, 0x41, 0x48, 0x24, 0xFC, 0x60, 0x02, 0x41, 0x5D, -0xEE, 0xB4, 0x0E, 0x02, 0x51, 0xCE, 0x90, 0x81, 0x3E, 0xE0, 0x70, 0x04, 0x7F, 0x01, 0x51, 0xF6, -0x90, 0x81, 0x3E, 0xE0, 0xB4, 0x06, 0x02, 0x51, 0xA8, 0x90, 0x81, 0x3E, 0xE0, 0xB4, 0x04, 0x0E, -0x90, 0x83, 0x36, 0xE0, 0xFF, 0x60, 0x05, 0x12, 0x72, 0x2D, 0x80, 0x02, 0xF1, 0xD6, 0x90, 0x81, -0x3E, 0xE0, 0x64, 0x08, 0x60, 0x02, 0x41, 0x5D, 0x71, 0x99, 0x41, 0x5D, 0x90, 0x81, 0x3E, 0xE0, -0x70, 0x04, 0x7F, 0x01, 0x51, 0xF6, 0x90, 0x81, 0x3E, 0xE0, 0xB4, 0x06, 0x02, 0x51, 0xA8, 0x90, -0x81, 0x3E, 0xE0, 0xB4, 0x0E, 0x07, 0x51, 0x62, 0xBF, 0x01, 0x02, 0x51, 0xCE, 0x90, 0x81, 0x3E, -0xE0, 0x64, 0x0C, 0x60, 0x02, 0x41, 0x5D, 0x51, 0x62, 0xEF, 0x64, 0x01, 0x60, 0x02, 0x41, 0x5D, -0x71, 0x0F, 0x41, 0x5D, 0x90, 0x81, 0x3E, 0xE0, 0xB4, 0x0E, 0x07, 0x51, 0x62, 0xBF, 0x01, 0x02, -0x51, 0xCE, 0x90, 0x81, 0x3E, 0xE0, 0xB4, 0x06, 0x02, 0x51, 0xA8, 0x90, 0x81, 0x3E, 0xE0, 0xB4, -0x0C, 0x07, 0x51, 0x62, 0xBF, 0x01, 0x02, 0x71, 0x0F, 0x90, 0x81, 0x3E, 0xE0, 0x64, 0x04, 0x70, -0x5C, 0x12, 0x71, 0x7D, 0xEF, 0x64, 0x01, 0x70, 0x54, 0x12, 0x50, 0xD7, 0x80, 0x4F, 0x90, 0x81, -0x3E, 0xE0, 0xB4, 0x0E, 0x07, 0x51, 0x62, 0xBF, 0x01, 0x02, 0x51, 0xCE, 0x90, 0x81, 0x3E, 0xE0, -0xB4, 0x06, 0x02, 0x51, 0xA8, 0x90, 0x81, 0x3E, 0xE0, 0xB4, 0x0C, 0x07, 0x51, 0x62, 0xBF, 0x01, -0x02, 0x71, 0x0F, 0x90, 0x81, 0x3E, 0xE0, 0x70, 0x04, 0x7F, 0x01, 0x51, 0xF6, 0x90, 0x81, 0x3E, -0xE0, 0xB4, 0x04, 0x19, 0xF1, 0xC9, 0x80, 0x15, 0x90, 0x81, 0x3E, 0xE0, 0xB4, 0x0C, 0x0E, 0x90, -0x81, 0x39, 0xE0, 0xFF, 0x13, 0x13, 0x54, 0x3F, 0x30, 0xE0, 0x02, 0x71, 0x83, 0xD0, 0xD0, 0x92, -0xAF, 0x22, 0x12, 0x71, 0x64, 0xEF, 0x64, 0x01, 0x60, 0x08, 0x90, 0x01, 0xB8, 0x74, 0x01, 0xF0, -0x80, 0x2D, 0x90, 0x81, 0x38, 0xE0, 0x13, 0x13, 0x13, 0x54, 0x1F, 0x30, 0xE0, 0x08, 0x90, 0x01, -0xB8, 0x74, 0x02, 0xF0, 0x80, 0x19, 0x90, 0x81, 0x3D, 0xE0, 0xD3, 0x94, 0x04, 0x40, 0x08, 0x90, -0x01, 0xB8, 0x74, 0x08, 0xF0, 0x80, 0x08, 0x90, 0x01, 0xB8, 0xE4, 0xF0, 0x7F, 0x01, 0x22, 0x90, -0x01, 0xB9, 0x74, 0x02, 0xF0, 0x7F, 0x00, 0x22, 0x90, 0x81, 0x39, 0xE0, 0x90, 0x06, 0x04, 0x20, -0xE0, 0x0C, 0xE0, 0x44, 0x40, 0xF0, 0x90, 0x81, 0x3E, 0x74, 0x04, 0xF0, 0x80, 0x0A, 0xE0, 0x54, -0x7F, 0xF0, 0x90, 0x81, 0x3E, 0x74, 0x0C, 0xF0, 0x90, 0x05, 0x22, 0xE4, 0xF0, 0x22, 0x90, 0x81, -0x39, 0xE0, 0xC3, 0x13, 0x20, 0xE0, 0x08, 0x90, 0x81, 0x3E, 0x74, 0x0C, 0xF0, 0x80, 0x11, 0x90, -0x06, 0x04, 0xE0, 0x44, 0x40, 0xF0, 0xE0, 0x44, 0x80, 0xF0, 0x90, 0x81, 0x3E, 0x74, 0x04, 0xF0, -0x90, 0x05, 0x22, 0xE4, 0xF0, 0x22, 0x90, 0x83, 0x35, 0xEF, 0xF0, 0x71, 0xA7, 0x90, 0x83, 0x35, -0xE0, 0x60, 0x05, 0x90, 0x05, 0x22, 0xE4, 0xF0, 0x90, 0x81, 0x3E, 0x74, 0x04, 0xF0, 0x22, 0x90, -0x80, 0xF7, 0xE0, 0x64, 0x01, 0x70, 0x2D, 0x90, 0x81, 0x39, 0xE0, 0x54, 0xFD, 0xF0, 0x90, 0x05, -0x22, 0x74, 0x6F, 0xF0, 0x7F, 0x01, 0x91, 0x52, 0xBF, 0x01, 0x0E, 0x90, 0x81, 0x38, 0xE0, 0x44, -0x80, 0xF0, 0x90, 0x81, 0x3E, 0x74, 0x0E, 0xF0, 0x22, 0x90, 0x01, 0xB9, 0x74, 0x01, 0xF0, 0x90, -0x01, 0xB8, 0x04, 0xF0, 0x22, 0x90, 0x81, 0x3B, 0xE0, 0x64, 0x01, 0x70, 0x18, 0x90, 0x81, 0x3A, -0xE0, 0x54, 0x0F, 0x60, 0x08, 0xE4, 0xFD, 0x7F, 0x0C, 0x31, 0x14, 0x81, 0x8E, 0x90, 0x81, 0x3E, -0xE0, 0x70, 0x02, 0x31, 0x10, 0x22, 0x12, 0x6B, 0x60, 0x7F, 0x02, 0x8F, 0x1F, 0x7F, 0x02, 0x12, -0x46, 0x53, 0x90, 0x80, 0x01, 0xE0, 0x45, 0x1F, 0xF0, 0x22, 0x90, 0x81, 0x3B, 0xE0, 0x60, 0x02, -0x71, 0x45, 0x22, 0x12, 0x5C, 0xFE, 0x90, 0x81, 0x3E, 0x74, 0x08, 0xF0, 0x22, 0x90, 0x81, 0x53, -0xE0, 0x30, 0xE0, 0x04, 0x7F, 0x10, 0x71, 0x6B, 0x22, 0x71, 0xA7, 0x90, 0x05, 0x22, 0xE4, 0xF0, -0x90, 0x81, 0x3E, 0x74, 0x0C, 0xF0, 0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0x01, -0x01, 0xE0, 0x44, 0x02, 0xF0, 0x90, 0x01, 0x00, 0x74, 0xFF, 0xF0, 0x90, 0x06, 0xB7, 0x74, 0x09, -0xF0, 0x90, 0x06, 0xB4, 0x74, 0x86, 0xF0, 0x7F, 0x7C, 0x7E, 0x08, 0x12, 0x2D, 0x5C, 0xEC, 0x54, -0x7F, 0xFC, 0x90, 0x83, 0x11, 0x12, 0x20, 0xCE, 0x90, 0x83, 0x11, 0x12, 0x42, 0x26, 0x90, 0x85, -0xBB, 0x12, 0x20, 0xCE, 0x7F, 0x7C, 0x7E, 0x08, 0x12, 0x2E, 0xA2, 0x90, 0x85, 0xBB, 0x12, 0x20, -0xDA, 0xCC, 0xC0, 0x00, 0xC0, 0x7F, 0x8C, 0x7E, 0x08, 0x12, 0x2E, 0xA2, 0x90, 0x85, 0xBB, 0x12, -0x20, 0xDA, 0x00, 0xC0, 0x00, 0x14, 0x7F, 0x70, 0x7E, 0x0E, 0x12, 0x2E, 0xA2, 0x90, 0x83, 0x03, -0x12, 0x20, 0xDA, 0x00, 0x03, 0x3E, 0x60, 0xE4, 0xFD, 0xFF, 0xF1, 0x74, 0xD0, 0xD0, 0x92, 0xAF, -0x22, 0x91, 0x8E, 0x90, 0x81, 0x3E, 0xE0, 0x64, 0x0C, 0x60, 0x0A, 0xE4, 0xFD, 0x7F, 0x0C, 0x31, -0x14, 0xE4, 0xFF, 0x91, 0x52, 0x22, 0x90, 0x80, 0xF7, 0xE0, 0xB4, 0x01, 0x14, 0x90, 0x81, 0x3B, -0xE0, 0x60, 0x0E, 0x90, 0x81, 0x3A, 0xE0, 0x54, 0x0F, 0x64, 0x02, 0x60, 0x02, 0xC1, 0xB2, 0x91, -0x21, 0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x8F, 0x4E, 0x90, 0x04, 0x1D, 0xE0, 0x60, -0x1E, 0x90, 0x05, 0x22, 0xE0, 0xF5, 0x51, 0x74, 0xFF, 0xF0, 0x12, 0x6F, 0xBF, 0xBF, 0x01, 0x07, -0xAF, 0x4E, 0x12, 0x73, 0x0F, 0xB1, 0x1A, 0x90, 0x05, 0x22, 0xE5, 0x51, 0xF0, 0x80, 0x02, 0xB1, -0x1A, 0x90, 0x04, 0x1F, 0x74, 0x20, 0xF0, 0x7F, 0x01, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x90, 0x81, -0x38, 0xE0, 0x13, 0x13, 0x13, 0x54, 0x1F, 0x30, 0xE0, 0x05, 0x90, 0x01, 0x5B, 0xE4, 0xF0, 0x90, -0x06, 0x92, 0x74, 0x02, 0xF0, 0x90, 0x01, 0x3C, 0x74, 0x04, 0xF0, 0xE4, 0xF5, 0x1D, 0x90, 0x81, -0x4E, 0xE0, 0xC3, 0x13, 0x54, 0x7F, 0xF5, 0x1E, 0xE4, 0xFB, 0xFD, 0x7F, 0x58, 0x7E, 0x01, 0xD1, -0xDD, 0x90, 0x01, 0x5B, 0x74, 0x05, 0xF0, 0x90, 0x81, 0x38, 0xE0, 0x44, 0x08, 0xF0, 0x22, 0x74, -0x1F, 0x2D, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x54, 0x3F, 0xF0, 0xEF, 0x60, 0x1D, -0x74, 0x21, 0x2D, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x44, 0x10, 0xF0, 0x74, 0x1F, -0x2D, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x44, 0x80, 0xF0, 0x22, 0x74, 0x21, 0x2D, -0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x54, 0xEF, 0xF0, 0x74, 0x1F, 0x2D, 0xF5, 0x82, -0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x44, 0x40, 0xF0, 0x22, 0x90, 0x80, 0x08, 0xE0, 0xFF, 0x7D, -0x01, 0xB1, 0xB7, 0x8E, 0x4F, 0x8F, 0x50, 0xAD, 0x50, 0xAC, 0x4F, 0xAF, 0x4E, 0x91, 0xCF, 0xAF, -0x50, 0xAE, 0x4F, 0x90, 0x04, 0x80, 0xE0, 0x54, 0x0F, 0xFD, 0xAC, 0x07, 0x74, 0x11, 0x2C, 0xF5, -0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x44, 0x01, 0xF0, 0x74, 0x11, 0x2C, 0xF5, 0x82, 0xE4, -0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x54, 0xFB, 0xF0, 0xAC, 0x07, 0x74, 0x16, 0x2C, 0xF5, 0x82, 0xE4, -0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x44, 0xFA, 0xF0, 0x74, 0x15, 0x2C, 0xF5, 0x82, 0xE4, 0x34, 0xFC, -0xF5, 0x83, 0xE0, 0x44, 0x1F, 0xF0, 0xAC, 0x07, 0x74, 0x06, 0x2C, 0xF5, 0x82, 0xE4, 0x34, 0xFC, -0xF5, 0x83, 0xE0, 0x44, 0x0F, 0xF0, 0x90, 0x04, 0x53, 0xE4, 0xF0, 0x90, 0x04, 0x52, 0xF0, 0x90, -0x04, 0x51, 0x74, 0xFF, 0xF0, 0x90, 0x04, 0x50, 0x74, 0xFD, 0xF0, 0x74, 0x14, 0x2C, 0xF5, 0x82, -0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x54, 0xC0, 0x4D, 0xFD, 0x74, 0x14, 0x2F, 0xF5, 0x82, 0xE4, -0x34, 0xFC, 0xF5, 0x83, 0xED, 0xF0, 0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0x83, -0x28, 0xED, 0xF0, 0x90, 0x83, 0x27, 0xEF, 0xF0, 0xE4, 0xFD, 0xFC, 0x12, 0x5E, 0x61, 0x7C, 0x00, -0xAD, 0x07, 0x90, 0x83, 0x27, 0xE0, 0x90, 0x04, 0x25, 0xF0, 0x90, 0x83, 0x28, 0xE0, 0x60, 0x0E, -0x74, 0x0F, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x44, 0x80, 0xF0, 0xAF, 0x05, -0x74, 0x08, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE4, 0xF0, 0x74, 0x09, 0x2F, 0xF5, -0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x54, 0xF0, 0xF0, 0x74, 0x21, 0x2D, 0xF5, 0x82, 0xE4, -0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x54, 0xF7, 0xF0, 0xAE, 0x04, 0xAF, 0x05, 0xD0, 0xD0, 0x92, 0xAF, -0x22, 0x90, 0x81, 0x3B, 0xE0, 0x60, 0x12, 0x90, 0x06, 0x92, 0xE0, 0x30, 0xE1, 0x02, 0x81, 0x8E, -0x90, 0x81, 0x38, 0xE0, 0x54, 0xF7, 0xF0, 0xD1, 0x3A, 0x22, 0x90, 0x81, 0x3D, 0xE0, 0xFF, 0x7D, -0x01, 0x21, 0x14, 0xE4, 0x90, 0x82, 0x71, 0xF0, 0x90, 0x06, 0xA9, 0xE0, 0x90, 0x82, 0x71, 0xF0, -0xE0, 0x54, 0xC0, 0x70, 0x0C, 0x90, 0x81, 0x3F, 0xE0, 0x54, 0xFE, 0xF0, 0x54, 0xFD, 0xF0, 0x80, -0xD9, 0x90, 0x82, 0x71, 0xE0, 0x30, 0xE6, 0x21, 0x90, 0x81, 0x3B, 0xE0, 0x64, 0x01, 0x70, 0x20, -0x90, 0x81, 0x3F, 0xE0, 0x44, 0x01, 0xF0, 0x90, 0x81, 0x3A, 0xE0, 0x54, 0x0F, 0x64, 0x02, 0x60, -0x04, 0xD1, 0xB2, 0x80, 0x0B, 0x91, 0x21, 0x80, 0x07, 0x90, 0x81, 0x3F, 0xE0, 0x54, 0xFE, 0xF0, -0x90, 0x82, 0x71, 0xE0, 0x90, 0x81, 0x3F, 0x30, 0xE7, 0x13, 0xE0, 0x44, 0x02, 0xD1, 0xCC, 0x90, -0x01, 0x57, 0x74, 0x05, 0xF0, 0x90, 0x81, 0x38, 0xE0, 0x44, 0x04, 0xF0, 0x22, 0xE0, 0x54, 0xFD, -0xF0, 0x22, 0x90, 0x04, 0x1D, 0xE0, 0x70, 0x13, 0x90, 0x80, 0x07, 0xE0, 0xFF, 0xE4, 0xFD, 0xB1, -0xB7, 0x8E, 0x0D, 0x8F, 0x0E, 0x90, 0x04, 0x1F, 0x74, 0x20, 0xF0, 0x22, 0xF0, 0xE4, 0xF5, 0x1D, -0x90, 0x81, 0x4D, 0xE0, 0xF5, 0x1E, 0xE4, 0xFB, 0xFD, 0x7F, 0x54, 0x7E, 0x01, 0x8E, 0x19, 0x8F, -0x1A, 0xE5, 0x1E, 0x54, 0x07, 0xC4, 0x33, 0x54, 0xE0, 0x85, 0x19, 0x83, 0x85, 0x1A, 0x82, 0xF0, -0xE5, 0x1D, 0x54, 0x07, 0xC4, 0x33, 0x54, 0xE0, 0xFF, 0xE5, 0x1E, 0x13, 0x13, 0x13, 0x54, 0x1F, -0x4F, 0xA3, 0xF0, 0xEB, 0x54, 0x07, 0xC4, 0x33, 0x54, 0xE0, 0xFF, 0xE5, 0x1D, 0x13, 0x13, 0x13, -0x54, 0x1F, 0x4F, 0x85, 0x1A, 0x82, 0x85, 0x19, 0x83, 0xA3, 0xA3, 0xF0, 0xBD, 0x01, 0x0C, 0x85, -0x1A, 0x82, 0x8E, 0x83, 0xA3, 0xA3, 0xA3, 0x74, 0x03, 0xF0, 0x22, 0x85, 0x1A, 0x82, 0x85, 0x19, -0x83, 0xA3, 0xA3, 0xA3, 0x74, 0x01, 0xF0, 0x22, 0x90, 0x80, 0xF7, 0xE0, 0xB4, 0x01, 0x13, 0x90, -0x81, 0x3B, 0xE0, 0x60, 0x0D, 0x90, 0x81, 0x3F, 0xE0, 0x54, 0xFE, 0xF0, 0x54, 0x07, 0x70, 0x02, -0xD1, 0x3A, 0x22, 0x90, 0x80, 0xF7, 0xE0, 0x64, 0x01, 0x70, 0x18, 0x90, 0x81, 0x3B, 0xE0, 0x60, -0x12, 0x90, 0x01, 0x57, 0xE4, 0xF0, 0x90, 0x01, 0x3C, 0x74, 0x02, 0xD1, 0xCC, 0x90, 0x01, 0x57, -0x74, 0x05, 0xF0, 0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0xC0, 0x07, 0xC0, 0x05, 0x90, -0x83, 0x03, 0x12, 0x42, 0x26, 0x90, 0x82, 0xF1, 0x12, 0x20, 0xCE, 0xD0, 0x05, 0xD0, 0x07, 0x12, -0x69, 0x1D, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x90, 0x80, 0xF7, 0xE0, 0x64, 0x01, 0x70, 0x25, 0x90, -0x81, 0x3B, 0xE0, 0x60, 0x1F, 0x90, 0x01, 0x57, 0xE4, 0xF0, 0x90, 0x01, 0x3C, 0x74, 0x02, 0xF0, -0x90, 0x81, 0x38, 0xE0, 0x54, 0xFB, 0xF0, 0x90, 0x81, 0x3F, 0xE0, 0x54, 0xFD, 0xF0, 0x54, 0x07, -0x70, 0x02, 0xD1, 0x3A, 0x22, 0xE4, 0xFF, 0x81, 0x52, 0x90, 0x05, 0x22, 0x74, 0x6F, 0xF0, 0x90, -0x81, 0x3E, 0x74, 0x02, 0xF0, 0x22, 0x90, 0x06, 0x04, 0xE0, 0x54, 0x7F, 0xF0, 0x90, 0x05, 0x22, -0xE4, 0xF0, 0x90, 0x81, 0x3E, 0x74, 0x0C, 0xF0, 0x22, 0xC0, 0xE0, 0xC0, 0xF0, 0xC0, 0x83, 0xC0, -0x82, 0xC0, 0xD0, 0x75, 0xD0, 0x00, 0xC0, 0x00, 0xC0, 0x01, 0xC0, 0x02, 0xC0, 0x03, 0xC0, 0x04, -0xC0, 0x05, 0xC0, 0x06, 0xC0, 0x07, 0x90, 0x01, 0xC4, 0x74, 0xE9, 0xF0, 0x74, 0x4F, 0xA3, 0xF0, -0x12, 0x6E, 0x3E, 0xE5, 0x49, 0x30, 0xE1, 0x02, 0x11, 0x70, 0xE5, 0x49, 0x30, 0xE2, 0x03, 0x12, -0x4E, 0x21, 0xE5, 0x4A, 0x30, 0xE0, 0x03, 0x12, 0x6E, 0x7D, 0xE5, 0x4C, 0x30, 0xE1, 0x05, 0x7F, -0x04, 0x12, 0x4B, 0x6B, 0xE5, 0x4C, 0x30, 0xE4, 0x02, 0x11, 0x7A, 0xE5, 0x4C, 0x30, 0xE5, 0x02, -0x11, 0xF4, 0xE5, 0x4C, 0x30, 0xE6, 0x03, 0x12, 0x6F, 0x1C, 0x74, 0xE9, 0x04, 0x90, 0x01, 0xC4, -0xF0, 0x74, 0x4F, 0xA3, 0xF0, 0xD0, 0x07, 0xD0, 0x06, 0xD0, 0x05, 0xD0, 0x04, 0xD0, 0x03, 0xD0, -0x02, 0xD0, 0x01, 0xD0, 0x00, 0xD0, 0xD0, 0xD0, 0x82, 0xD0, 0x83, 0xD0, 0xF0, 0xD0, 0xE0, 0x32, -0x90, 0x81, 0x3B, 0xE0, 0x60, 0x03, 0x12, 0x72, 0xB1, 0x22, 0x12, 0x72, 0x7B, 0x90, 0x81, 0x41, -0xE0, 0x14, 0x90, 0x05, 0x73, 0xF0, 0x7D, 0x02, 0x7F, 0x02, 0x11, 0xC2, 0x90, 0x82, 0x65, 0xE0, -0x30, 0xE0, 0x2E, 0x90, 0x80, 0xF7, 0xE0, 0xB4, 0x01, 0x27, 0x90, 0x83, 0x37, 0xE0, 0x04, 0xF0, -0xE0, 0xB4, 0x0A, 0x0B, 0x90, 0x82, 0x67, 0xE0, 0x04, 0xF0, 0xE4, 0x90, 0x83, 0x37, 0xF0, 0x90, -0x82, 0x67, 0xE0, 0xFF, 0x90, 0x82, 0x66, 0xE0, 0xB5, 0x07, 0x06, 0xE4, 0xA3, 0xF0, 0x12, 0x4F, -0xC5, 0x22, 0x74, 0x3D, 0x2F, 0xF8, 0xE6, 0x4D, 0xFE, 0xF6, 0x74, 0x30, 0x2F, 0xF5, 0x82, 0xE4, -0x34, 0x01, 0xF5, 0x83, 0xEE, 0xF0, 0x22, 0x90, 0x05, 0x22, 0x74, 0xFF, 0xF0, 0x12, 0x6F, 0xBF, -0x90, 0x01, 0x37, 0x74, 0x02, 0xF0, 0xFD, 0x7F, 0x03, 0x11, 0xC2, 0x12, 0x5D, 0x04, 0xE4, 0x90, -0x81, 0x3E, 0xF0, 0x22, 0x90, 0x81, 0x38, 0xE0, 0xFF, 0xC4, 0x13, 0x13, 0x54, 0x03, 0x30, 0xE0, -0x27, 0xEF, 0x54, 0xBF, 0xF0, 0x90, 0x04, 0xE0, 0xE0, 0x90, 0x81, 0x39, 0x30, 0xE0, 0x06, 0xE0, -0x44, 0x01, 0xF0, 0x80, 0x10, 0xE0, 0x54, 0xFE, 0xF0, 0x90, 0x01, 0xB9, 0x74, 0x01, 0xF0, 0x90, -0x01, 0xB8, 0x74, 0x04, 0xF0, 0x12, 0x4E, 0x3A, 0xE4, 0xFF, 0x90, 0x82, 0x68, 0xE0, 0x30, 0xE0, -0x48, 0x90, 0x82, 0x6C, 0xE0, 0xFD, 0x60, 0x41, 0x74, 0x01, 0x7E, 0x00, 0xA8, 0x07, 0x08, 0x80, -0x05, 0xC3, 0x33, 0xCE, 0x33, 0xCE, 0xD8, 0xF9, 0xFF, 0x90, 0x04, 0xE0, 0xE0, 0xFB, 0xEF, 0x5B, -0x60, 0x06, 0xE4, 0x90, 0x82, 0x6C, 0xF0, 0x22, 0x90, 0x82, 0x6A, 0xE0, 0xD3, 0x9D, 0x50, 0x10, -0x90, 0x01, 0xC7, 0x74, 0x10, 0xF0, 0x31, 0x7A, 0x90, 0x82, 0x68, 0xE0, 0x54, 0xFE, 0xF0, 0x22, -0x12, 0x4F, 0xC5, 0x90, 0x82, 0x6C, 0xE0, 0x04, 0xF0, 0x22, 0x90, 0x80, 0x05, 0xE0, 0xB4, 0x02, -0x16, 0x90, 0x81, 0x55, 0xE0, 0xFF, 0xC4, 0x13, 0x13, 0x13, 0x54, 0x01, 0x30, 0xE0, 0x0F, 0x90, -0x01, 0x4D, 0xE0, 0x64, 0x80, 0xF0, 0x22, 0x90, 0x06, 0x90, 0xE0, 0x44, 0x01, 0xF0, 0x90, 0x82, -0x6F, 0xE0, 0x75, 0xF0, 0x20, 0xA4, 0xFF, 0x90, 0x83, 0x19, 0xE5, 0xF0, 0xF0, 0xA3, 0xEF, 0xF0, -0x90, 0x82, 0x70, 0xE0, 0x75, 0xF0, 0x08, 0xA4, 0xAE, 0xF0, 0x90, 0x83, 0x1B, 0xF0, 0xEE, 0xA3, -0xF0, 0x90, 0x82, 0x6E, 0xE0, 0xFE, 0xC4, 0x13, 0x13, 0x13, 0x54, 0x01, 0x30, 0xE0, 0x77, 0xEE, -0x54, 0x0F, 0xFF, 0xEE, 0xC4, 0x13, 0x13, 0x54, 0x03, 0x7D, 0x00, 0x20, 0xE0, 0x02, 0x7D, 0x01, -0x51, 0x47, 0x90, 0x82, 0x6E, 0xE0, 0xFE, 0x54, 0x0F, 0xFF, 0xEE, 0xC4, 0x13, 0x13, 0x54, 0x01, -0xFD, 0x51, 0x47, 0x90, 0x82, 0x6E, 0xE0, 0xC4, 0x13, 0x54, 0x07, 0x30, 0xE0, 0x22, 0x90, 0x83, -0x19, 0xE0, 0xFE, 0xA3, 0xE0, 0xFF, 0x12, 0x32, 0xAA, 0x90, 0x82, 0x6E, 0xE0, 0xFE, 0x54, 0x0F, -0xFF, 0xEE, 0xC4, 0x13, 0x13, 0x54, 0x03, 0x7D, 0x00, 0x20, 0xE0, 0x02, 0x7D, 0x01, 0x51, 0x47, -0x90, 0x82, 0x6E, 0xE0, 0xC4, 0x54, 0x0F, 0x30, 0xE0, 0x1C, 0x90, 0x83, 0x1C, 0xE0, 0xF5, 0x1D, -0x90, 0x83, 0x1B, 0xE0, 0xF5, 0x1E, 0xE4, 0xFB, 0xFD, 0x7F, 0x58, 0x7E, 0x01, 0x12, 0x4E, 0xDD, -0x90, 0x01, 0x5B, 0x74, 0x05, 0xF0, 0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0x83, -0x2C, 0xED, 0xF0, 0x90, 0x83, 0x2B, 0xEF, 0xF0, 0xD3, 0x94, 0x07, 0x50, 0x70, 0xE0, 0xFF, 0x74, -0x01, 0xA8, 0x07, 0x08, 0x80, 0x02, 0xC3, 0x33, 0xD8, 0xFC, 0xF4, 0xFF, 0x90, 0x00, 0x47, 0xE0, -0x5F, 0xFD, 0x7F, 0x47, 0x12, 0x32, 0x1E, 0x90, 0x83, 0x2B, 0xE0, 0xFF, 0x74, 0x01, 0xA8, 0x07, -0x08, 0x80, 0x02, 0xC3, 0x33, 0xD8, 0xFC, 0xFF, 0x90, 0x00, 0x46, 0xE0, 0x4F, 0xFD, 0x7F, 0x46, -0x12, 0x32, 0x1E, 0x90, 0x83, 0x2C, 0xE0, 0x60, 0x18, 0x90, 0x83, 0x2B, 0xE0, 0xFF, 0x74, 0x01, -0xA8, 0x07, 0x08, 0x80, 0x02, 0xC3, 0x33, 0xD8, 0xFC, 0xFF, 0x90, 0x00, 0x45, 0xE0, 0x4F, 0x80, -0x17, 0x90, 0x83, 0x2B, 0xE0, 0xFF, 0x74, 0x01, 0xA8, 0x07, 0x08, 0x80, 0x02, 0xC3, 0x33, 0xD8, -0xFC, 0xF4, 0xFF, 0x90, 0x00, 0x45, 0xE0, 0x5F, 0xFD, 0x7F, 0x45, 0x80, 0x7E, 0x90, 0x83, 0x2B, -0xE0, 0x24, 0xF8, 0xF0, 0xE0, 0x24, 0x04, 0xFF, 0x74, 0x01, 0xA8, 0x07, 0x08, 0x80, 0x02, 0xC3, -0x33, 0xD8, 0xFC, 0xF4, 0xFF, 0x90, 0x00, 0x43, 0xE0, 0x5F, 0xFD, 0x7F, 0x43, 0x12, 0x32, 0x1E, -0x90, 0x83, 0x2B, 0xE0, 0xFF, 0x74, 0x01, 0xA8, 0x07, 0x08, 0x80, 0x02, 0xC3, 0x33, 0xD8, 0xFC, -0xFF, 0x90, 0x00, 0x43, 0xE0, 0x4F, 0xFD, 0x7F, 0x43, 0x12, 0x32, 0x1E, 0x90, 0x83, 0x2C, 0xE0, -0x60, 0x1D, 0x90, 0x83, 0x2B, 0xE0, 0x24, 0x04, 0xFF, 0x74, 0x01, 0xA8, 0x07, 0x08, 0x80, 0x02, -0xC3, 0x33, 0xD8, 0xFC, 0xFF, 0x90, 0x00, 0x42, 0xE0, 0x4F, 0xFD, 0x7F, 0x42, 0x80, 0x1C, 0x90, -0x83, 0x2B, 0xE0, 0x24, 0x04, 0xFF, 0x74, 0x01, 0xA8, 0x07, 0x08, 0x80, 0x02, 0xC3, 0x33, 0xD8, -0xFC, 0xF4, 0xFF, 0x90, 0x00, 0x42, 0xE0, 0x5F, 0xFD, 0x7F, 0x42, 0x12, 0x32, 0x1E, 0xD0, 0xD0, -0x92, 0xAF, 0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0x82, 0x82, 0x74, 0x08, 0xF0, -0xE4, 0xA3, 0xF0, 0xA3, 0xF0, 0xA3, 0xF0, 0xA3, 0xF0, 0x90, 0x82, 0x89, 0xF0, 0xA3, 0xF0, 0x90, -0x01, 0x1F, 0xE0, 0xFE, 0x90, 0x01, 0x1E, 0xE0, 0x7C, 0x00, 0x24, 0x00, 0xFF, 0xEC, 0x3E, 0x90, -0x82, 0x7B, 0xF0, 0xA3, 0xEF, 0xF0, 0x90, 0x02, 0x82, 0xE0, 0x90, 0x82, 0x81, 0xF0, 0x90, 0x81, -0x53, 0xE0, 0x20, 0xE0, 0x02, 0xA1, 0xBD, 0x90, 0x81, 0x58, 0xE0, 0x20, 0xE0, 0x07, 0x90, 0x01, -0x3F, 0xE0, 0x30, 0xE2, 0x17, 0x90, 0x80, 0x05, 0xE0, 0xB4, 0x01, 0x0E, 0x90, 0xFD, 0x01, 0xE0, -0x20, 0xE6, 0x07, 0x90, 0xFD, 0x00, 0xE0, 0x44, 0x10, 0xF0, 0x31, 0x7A, 0xE4, 0x90, 0x82, 0x80, -0xF0, 0x90, 0x82, 0x81, 0xE0, 0xFF, 0x90, 0x82, 0x80, 0xE0, 0xC3, 0x9F, 0x40, 0x02, 0xA1, 0xBD, -0x90, 0x82, 0x7B, 0xE0, 0xFC, 0xA3, 0xE0, 0xFD, 0xEC, 0xFF, 0x90, 0xFD, 0x11, 0xF0, 0xAE, 0x05, -0xAB, 0x06, 0x90, 0x82, 0x84, 0xEF, 0xF0, 0x74, 0x02, 0x2B, 0xF5, 0x82, 0xE4, 0x34, 0xFB, 0xF5, -0x83, 0xE0, 0x54, 0x0F, 0x33, 0x33, 0x33, 0x54, 0xF8, 0xFF, 0x74, 0x03, 0x2B, 0xF5, 0x82, 0xE4, -0x34, 0xFB, 0xF5, 0x83, 0xE0, 0x54, 0x03, 0xFE, 0xEF, 0x24, 0x18, 0x2E, 0x90, 0x82, 0x89, 0xF0, -0xE0, 0xFF, 0x2B, 0xFA, 0x7E, 0x00, 0x90, 0x82, 0x7B, 0xE0, 0xFC, 0xA3, 0xE0, 0x2F, 0xFF, 0xEE, -0x3C, 0xA3, 0xF0, 0xA3, 0xEF, 0xF0, 0x74, 0x00, 0x2A, 0xF5, 0x82, 0xE4, 0x34, 0xFB, 0xF5, 0x83, -0xE0, 0xFF, 0x54, 0xFC, 0x90, 0x82, 0x7F, 0xF0, 0x74, 0x04, 0x2A, 0xF5, 0x82, 0xE4, 0x34, 0xFB, -0x12, 0x5E, 0x8E, 0x90, 0x82, 0x83, 0xEF, 0xF0, 0x74, 0x01, 0x2B, 0xF5, 0x82, 0xE4, 0x34, 0xFB, -0xF5, 0x83, 0xE0, 0xFE, 0x74, 0x00, 0x2B, 0xF5, 0x82, 0xE4, 0x34, 0xFB, 0xF5, 0x83, 0xE0, 0x7C, -0x00, 0x24, 0x00, 0xFF, 0xEC, 0x3E, 0x54, 0x3F, 0xFE, 0x90, 0x82, 0x85, 0xF0, 0xA3, 0xEF, 0xF0, -0x90, 0x82, 0x89, 0xE0, 0x2F, 0xFF, 0xEC, 0x3E, 0xFE, 0x12, 0x73, 0x6E, 0x74, 0x0F, 0x2B, 0xF5, -0x82, 0xE4, 0x34, 0xFB, 0xF5, 0x83, 0xE0, 0xFD, 0x90, 0x82, 0x7B, 0xEE, 0x8F, 0xF0, 0x12, 0x41, -0xF6, 0x90, 0x80, 0xF5, 0xE0, 0xFE, 0xA3, 0xE0, 0xFF, 0x90, 0x82, 0x7B, 0xE0, 0xF8, 0xA3, 0xE0, -0xD3, 0x9F, 0xE8, 0x9E, 0x40, 0x26, 0x90, 0x82, 0x7B, 0xE0, 0xFE, 0xA3, 0xE0, 0xFF, 0x90, 0x80, -0xF5, 0xE0, 0xF8, 0xA3, 0xE0, 0x24, 0x01, 0xF5, 0x82, 0xE4, 0x38, 0xF5, 0x83, 0xC3, 0xEF, 0x95, -0x82, 0xFF, 0xEE, 0x95, 0x83, 0x90, 0x82, 0x7B, 0xF0, 0xA3, 0xEF, 0xF0, 0xED, 0x30, 0xE7, 0x06, -0x90, 0x01, 0xC7, 0x74, 0x21, 0xF0, 0xED, 0x30, 0xE6, 0x06, 0x90, 0x01, 0xC7, 0x74, 0x22, 0xF0, -0xED, 0x30, 0xE5, 0x06, 0x90, 0x01, 0xC7, 0x74, 0x23, 0xF0, 0x90, 0x82, 0x7F, 0xE0, 0x24, 0x40, -0x60, 0x04, 0x24, 0x20, 0x70, 0x20, 0x90, 0x81, 0x54, 0xE0, 0xFF, 0xC4, 0x13, 0x13, 0x13, 0x54, -0x01, 0x30, 0xE0, 0x64, 0xAF, 0x02, 0x12, 0x75, 0xD9, 0xEF, 0x60, 0x5C, 0x90, 0x82, 0x7F, 0xE0, -0xFF, 0x12, 0x75, 0xC2, 0x80, 0x52, 0x90, 0x82, 0x7D, 0xE0, 0xFE, 0xA3, 0xE0, 0xFF, 0x90, 0x82, -0x83, 0xE0, 0xFD, 0x90, 0x82, 0x82, 0xE0, 0xFB, 0x90, 0x82, 0x84, 0xE0, 0x90, 0x82, 0x8F, 0xF0, -0xB1, 0xC2, 0x90, 0x81, 0x53, 0xE0, 0xC3, 0x13, 0x30, 0xE0, 0x10, 0x90, 0x82, 0x7D, 0xE0, 0xFE, -0xA3, 0xE0, 0xFF, 0x90, 0x82, 0x83, 0xE0, 0xFD, 0x12, 0x76, 0x14, 0x90, 0x81, 0x53, 0xE0, 0xFF, -0xC4, 0x13, 0x13, 0x13, 0x54, 0x01, 0x30, 0xE0, 0x0F, 0x90, 0x82, 0x7D, 0xE0, 0xFE, 0xA3, 0xE0, -0xFF, 0x90, 0x82, 0x83, 0xE0, 0xFD, 0xD1, 0x9D, 0x90, 0x81, 0x58, 0xE0, 0x20, 0xE0, 0x07, 0x90, -0x01, 0x3F, 0xE0, 0x30, 0xE2, 0x02, 0x31, 0x7A, 0x12, 0x75, 0x9C, 0xEF, 0x64, 0x01, 0x70, 0x3D, -0xF1, 0xD8, 0x90, 0x82, 0x8A, 0xEF, 0xF0, 0x64, 0x01, 0x60, 0x25, 0x90, 0x81, 0x58, 0xE0, 0x44, -0x01, 0xF0, 0x90, 0x82, 0x8A, 0xE0, 0xFF, 0xB4, 0x02, 0x08, 0x90, 0x01, 0xC7, 0x74, 0x42, 0xF0, -0x80, 0x0A, 0xEF, 0xB4, 0x04, 0x06, 0x90, 0x01, 0xC7, 0x74, 0x43, 0xF0, 0x31, 0x7A, 0x80, 0x0D, -0x90, 0x82, 0x7B, 0xF1, 0xC5, 0x90, 0x82, 0x80, 0xE0, 0x04, 0xF0, 0x61, 0xC1, 0xD0, 0xD0, 0x92, -0xAF, 0x22, 0x90, 0x82, 0x8D, 0xED, 0xF0, 0xA3, 0xEB, 0xF0, 0x90, 0x82, 0x8B, 0xEE, 0xF0, 0xA3, -0xEF, 0xF0, 0xE4, 0xFD, 0xD1, 0x5F, 0xEF, 0x54, 0x0C, 0x64, 0x08, 0x70, 0x6F, 0x90, 0x82, 0x8B, -0xE0, 0xFE, 0xA3, 0xE0, 0xFF, 0xA3, 0xE0, 0x24, 0x06, 0xFD, 0xD1, 0x5F, 0xEF, 0x64, 0x88, 0x70, -0x5B, 0x90, 0x82, 0x8B, 0xE0, 0xFE, 0xA3, 0xE0, 0xFF, 0xA3, 0xE0, 0x24, 0x07, 0xFD, 0xD1, 0x5F, -0xEF, 0x64, 0x8E, 0x70, 0x47, 0x90, 0x82, 0x8B, 0xE0, 0xFE, 0xA3, 0xE0, 0xFF, 0x90, 0x82, 0x8E, -0xE0, 0xFD, 0x90, 0x82, 0x8D, 0xE0, 0x2D, 0x04, 0xFD, 0xD1, 0x5F, 0xEF, 0x64, 0x03, 0x70, 0x2C, -0x90, 0x82, 0x8B, 0xE0, 0xFE, 0xA3, 0xE0, 0xFF, 0x90, 0x82, 0x8E, 0xE0, 0xFD, 0x90, 0x82, 0x8D, -0xE0, 0x2D, 0x24, 0x06, 0xFD, 0xD1, 0x5F, 0xEF, 0x90, 0x01, 0xC7, 0x30, 0xE3, 0x04, 0x74, 0x01, -0x80, 0x02, 0x74, 0x02, 0xF0, 0x90, 0x81, 0x58, 0xE0, 0x44, 0x01, 0xF0, 0x22, 0xFD, 0x90, 0x82, -0x8B, 0xE0, 0x34, 0x00, 0xFC, 0x7E, 0x00, 0xED, 0x2F, 0xFF, 0xEE, 0x3C, 0xFE, 0xE4, 0xFD, 0xAB, -0x07, 0xAA, 0x06, 0xED, 0x2B, 0xFB, 0xE4, 0x3A, 0xFA, 0xC3, 0x90, 0x80, 0xF6, 0xE0, 0x9B, 0x90, -0x80, 0xF5, 0xE0, 0x9A, 0x50, 0x13, 0xA3, 0xE0, 0x24, 0x01, 0xFF, 0x90, 0x80, 0xF5, 0xE0, 0x34, -0x00, 0xFE, 0xC3, 0xEB, 0x9F, 0xFB, 0xEA, 0x9E, 0xFA, 0xEA, 0x90, 0xFD, 0x11, 0xF0, 0xAF, 0x03, -0x74, 0x00, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0xFB, 0xF5, 0x83, 0xE0, 0xFF, 0x22, 0x90, 0x82, 0x8B, -0xEE, 0xF0, 0xA3, 0xEF, 0xF0, 0xA3, 0xED, 0xF0, 0x78, 0x8E, 0x7C, 0x82, 0x7D, 0x01, 0x7B, 0xFF, -0x7A, 0x40, 0x79, 0xCE, 0x7E, 0x00, 0x7F, 0x06, 0x12, 0x41, 0xD0, 0x78, 0x95, 0x7C, 0x82, 0x7D, -0x01, 0x7B, 0xFF, 0x7A, 0x40, 0x79, 0xD4, 0x7E, 0x00, 0x7F, 0x04, 0x12, 0x41, 0xD0, 0xE4, 0x90, -0x82, 0x94, 0xF0, 0x90, 0x82, 0x94, 0xE0, 0xFF, 0xC3, 0x94, 0x06, 0x50, 0x1F, 0x90, 0x82, 0x8C, -0xE0, 0x24, 0x04, 0xD1, 0x4D, 0x90, 0x82, 0x94, 0xE0, 0x24, 0x8E, 0xF5, 0x82, 0xE4, 0x34, 0x82, -0xF5, 0x83, 0xEF, 0xF0, 0x90, 0x82, 0x94, 0xE0, 0x04, 0xF0, 0x80, 0xD7, 0xE4, 0x90, 0x82, 0x94, -0xF0, 0x90, 0x82, 0x94, 0xE0, 0xFF, 0xC3, 0x94, 0x04, 0x50, 0x2E, 0x90, 0x82, 0x8D, 0xE0, 0xFD, -0x90, 0x82, 0x8C, 0xE0, 0x2D, 0xFD, 0x90, 0x82, 0x8B, 0xE0, 0x34, 0x00, 0xCD, 0x24, 0x18, 0xCD, -0xD1, 0x52, 0x90, 0x82, 0x94, 0xE0, 0x24, 0x95, 0xF5, 0x82, 0xE4, 0x34, 0x82, 0xF5, 0x83, 0xEF, -0xF0, 0x90, 0x82, 0x94, 0xE0, 0x04, 0xF0, 0x80, 0xC8, 0x78, 0x8E, 0x7C, 0x82, 0x7D, 0x01, 0x7B, -0x01, 0x7A, 0x81, 0x79, 0x59, 0x7E, 0x00, 0x7F, 0x06, 0x12, 0x44, 0x08, 0xEF, 0x70, 0x75, 0x90, -0x82, 0x8B, 0xE0, 0xFE, 0xA3, 0xE0, 0xFF, 0xE4, 0xFD, 0xD1, 0x5F, 0xEF, 0x54, 0x0C, 0x64, 0x08, -0x70, 0x62, 0x90, 0x82, 0x8D, 0xE0, 0xFF, 0x90, 0x82, 0x8C, 0xE0, 0x2F, 0xFF, 0x90, 0x82, 0x8B, -0xE0, 0x34, 0x00, 0xCF, 0x24, 0x06, 0xCF, 0x34, 0x00, 0xFE, 0xE4, 0xFD, 0xD1, 0x5F, 0xEF, 0x64, -0x08, 0x70, 0x41, 0x90, 0x82, 0x8D, 0xE0, 0xFF, 0x90, 0x82, 0x8C, 0xE0, 0x2F, 0xFF, 0x90, 0x82, -0x8B, 0xE0, 0x34, 0x00, 0xCF, 0x24, 0x07, 0xCF, 0x34, 0x00, 0xFE, 0xE4, 0xFD, 0xD1, 0x5F, 0xEF, -0x70, 0x22, 0x78, 0x95, 0x7C, 0x82, 0x7D, 0x01, 0x7B, 0x01, 0x7A, 0x81, 0x79, 0x6C, 0xFE, 0x7F, -0x04, 0x12, 0x44, 0x08, 0xEF, 0x70, 0x0D, 0x90, 0x01, 0xC7, 0x74, 0x22, 0xF0, 0x90, 0x81, 0x58, -0xE0, 0x44, 0x01, 0xF0, 0x22, 0xE0, 0xFE, 0xA3, 0xE0, 0xFF, 0x90, 0x02, 0x84, 0xEF, 0xF0, 0xEE, -0xA3, 0xF0, 0xA3, 0xE0, 0x44, 0x01, 0xF0, 0x22, 0x90, 0x02, 0x86, 0xE0, 0x20, 0xE2, 0x03, 0x7F, -0x04, 0x22, 0x90, 0x02, 0x86, 0xE0, 0x7F, 0x01, 0x20, 0xE1, 0x02, 0x7F, 0x02, 0x22, 0x90, 0x00, -0xF7, 0xE0, 0x20, 0xE7, 0x09, 0xE0, 0x7F, 0x01, 0x20, 0xE6, 0x0C, 0x7F, 0x02, 0x22, 0x90, 0x00, -0xF7, 0xE0, 0x30, 0xE6, 0x02, 0x7F, 0x03, 0x22, 0x12, 0x57, 0xEE, 0x90, 0x80, 0x05, 0xEF, 0xF0, -0x11, 0x1B, 0x90, 0x01, 0x64, 0x74, 0x01, 0xF0, 0x02, 0x2D, 0xA7, 0x11, 0x86, 0x11, 0xB6, 0x11, -0x48, 0x11, 0x67, 0xE4, 0xF5, 0x35, 0xF5, 0x36, 0xF5, 0x37, 0xF5, 0x38, 0xAD, 0x35, 0x7F, 0x50, -0x12, 0x32, 0x1E, 0xAD, 0x36, 0x7F, 0x51, 0x12, 0x32, 0x1E, 0xAD, 0x37, 0x7F, 0x52, 0x12, 0x32, -0x1E, 0xAD, 0x38, 0x7F, 0x53, 0x02, 0x32, 0x1E, 0x75, 0x3D, 0x10, 0xE4, 0xF5, 0x3E, 0x75, 0x3F, -0x07, 0x75, 0x40, 0x02, 0x90, 0x01, 0x30, 0xE5, 0x3D, 0xF0, 0xA3, 0xE5, 0x3E, 0xF0, 0xA3, 0xE5, -0x3F, 0xF0, 0xA3, 0xE5, 0x40, 0xF0, 0x22, 0x75, 0x45, 0x06, 0x75, 0x46, 0x01, 0x75, 0x47, 0x03, -0x75, 0x48, 0x62, 0x90, 0x01, 0x38, 0xE5, 0x45, 0xF0, 0xA3, 0xE5, 0x46, 0xF0, 0xA3, 0xE5, 0x47, -0xF0, 0xA3, 0xE5, 0x48, 0xF0, 0x22, 0x90, 0x01, 0x30, 0xE4, 0xF0, 0xA3, 0xF0, 0xA3, 0xF0, 0xA3, -0xF0, 0x90, 0x01, 0x38, 0xF0, 0xA3, 0xF0, 0xA3, 0xF0, 0xA3, 0xF0, 0xFD, 0x7F, 0x50, 0x12, 0x32, -0x1E, 0xE4, 0xFD, 0x7F, 0x51, 0x12, 0x32, 0x1E, 0xE4, 0xFD, 0x7F, 0x52, 0x12, 0x32, 0x1E, 0xE4, -0xFD, 0x7F, 0x53, 0x02, 0x32, 0x1E, 0x90, 0x01, 0x34, 0x74, 0xFF, 0xF0, 0xA3, 0xF0, 0xA3, 0xF0, -0xA3, 0xF0, 0x90, 0x01, 0x3C, 0xF0, 0xA3, 0xF0, 0xA3, 0xF0, 0xA3, 0xF0, 0xFD, 0x7F, 0x54, 0x12, -0x32, 0x1E, 0x7D, 0xFF, 0x7F, 0x55, 0x12, 0x32, 0x1E, 0x7D, 0xFF, 0x7F, 0x56, 0x12, 0x32, 0x1E, -0x7D, 0xFF, 0x7F, 0x57, 0x02, 0x32, 0x1E, 0x90, 0x01, 0xCF, 0xE0, 0x90, 0x83, 0x34, 0xF0, 0xE0, -0xFF, 0x30, 0xE0, 0x07, 0x90, 0x01, 0xCF, 0xE0, 0x54, 0xFE, 0xF0, 0xEF, 0x30, 0xE5, 0x22, 0x90, -0x01, 0xCF, 0xE0, 0x54, 0xDF, 0xF0, 0x90, 0x01, 0x34, 0x74, 0x20, 0xF0, 0xE4, 0xF5, 0xA8, 0xF5, -0xE8, 0x11, 0x86, 0x90, 0x00, 0x03, 0xE0, 0x54, 0xFB, 0xFD, 0x7F, 0x03, 0x12, 0x32, 0x1E, 0x80, -0xFE, 0x22, 0x90, 0x00, 0x80, 0xE0, 0x44, 0x80, 0xFD, 0x7F, 0x80, 0x12, 0x32, 0x1E, 0x90, 0xFD, -0x00, 0xE0, 0x54, 0xBF, 0xF0, 0xF1, 0xC5, 0x12, 0x32, 0x77, 0xF1, 0x8C, 0xF1, 0xB9, 0x7F, 0x01, -0x12, 0x45, 0x41, 0x90, 0x82, 0x64, 0x74, 0x02, 0xF0, 0xFF, 0x12, 0x45, 0x41, 0x90, 0x82, 0x64, -0xE0, 0x04, 0xF0, 0x11, 0x08, 0x31, 0x71, 0x90, 0x00, 0x80, 0xE0, 0x44, 0x40, 0xFD, 0x7F, 0x80, -0x12, 0x32, 0x1E, 0x75, 0x20, 0xFF, 0xF1, 0xA1, 0xF1, 0xA8, 0xF1, 0xAF, 0xE4, 0xFF, 0x02, 0x45, -0xCA, 0xF1, 0x8F, 0xF1, 0xD2, 0x12, 0x70, 0x81, 0x31, 0x94, 0x12, 0x73, 0x5C, 0x12, 0x65, 0x97, -0x90, 0x82, 0x6E, 0xE0, 0x54, 0x7F, 0xF0, 0x54, 0xBF, 0xF0, 0x54, 0xDF, 0xF0, 0x54, 0xF0, 0xF0, -0xE4, 0xA3, 0xF0, 0x22, 0x90, 0x81, 0x53, 0xE0, 0x54, 0xFE, 0xF0, 0x90, 0x81, 0x58, 0xE0, 0x54, -0xFE, 0xF0, 0xE4, 0x90, 0x81, 0x65, 0xF0, 0xA3, 0xF0, 0xA3, 0xF0, 0xA3, 0xF0, 0xA3, 0xF0, 0xA3, -0xF0, 0xA3, 0xF0, 0x90, 0x06, 0x90, 0xE0, 0x44, 0x20, 0xF0, 0x90, 0x81, 0x54, 0xE0, 0x54, 0xFE, -0xF0, 0x54, 0xFD, 0xF0, 0x54, 0xFB, 0xF0, 0x54, 0xF7, 0xF0, 0x54, 0xEF, 0xF0, 0x54, 0xDF, 0xF0, -0x54, 0xBF, 0xF0, 0x54, 0x7F, 0xF0, 0xA3, 0xE0, 0x54, 0x80, 0xF0, 0xE4, 0xA3, 0xF0, 0xA3, 0xE0, -0x54, 0xFE, 0xF0, 0x90, 0x81, 0x55, 0xE0, 0x54, 0x7F, 0xF0, 0x90, 0x81, 0x57, 0xE0, 0x54, 0xFD, -0xF0, 0x22, 0xEF, 0x60, 0x57, 0x90, 0x04, 0xEC, 0xE0, 0x54, 0xDD, 0xF0, 0x90, 0x82, 0x57, 0xE0, -0xFF, 0x60, 0x02, 0x51, 0x6D, 0x90, 0x01, 0xC7, 0xE4, 0xF0, 0x90, 0x01, 0x17, 0xE0, 0xFE, 0x90, -0x01, 0x16, 0xE0, 0x7C, 0x00, 0x24, 0x00, 0xFF, 0xEC, 0x3E, 0x90, 0x80, 0xF5, 0xF0, 0xA3, 0xEF, -0xF0, 0x90, 0x06, 0x09, 0xE0, 0x54, 0xFE, 0xF0, 0x91, 0xFE, 0x90, 0x02, 0x86, 0xE0, 0x44, 0x04, -0xF0, 0x91, 0xC3, 0xF1, 0x8D, 0x12, 0x4B, 0xA7, 0x90, 0x05, 0x22, 0xE4, 0xF0, 0x12, 0x78, 0xB3, -0x90, 0x01, 0x34, 0x74, 0x08, 0xF0, 0xFD, 0xE4, 0xFF, 0x02, 0x50, 0xC2, 0x90, 0x04, 0xEC, 0xE0, -0x44, 0x22, 0xF0, 0x7D, 0x08, 0xE4, 0xFF, 0x51, 0x95, 0x90, 0x06, 0x90, 0xE0, 0x54, 0xF0, 0xF0, -0x90, 0x02, 0x86, 0xE0, 0x54, 0xFB, 0xF0, 0x91, 0x70, 0xF1, 0x8E, 0x21, 0x94, 0xD1, 0x61, 0x7E, -0x00, 0x74, 0x00, 0x2F, 0xF9, 0xE4, 0x34, 0xFC, 0x75, 0x13, 0x01, 0xF5, 0x14, 0x89, 0x15, 0x75, -0x16, 0x08, 0x7B, 0x01, 0x7A, 0x81, 0x79, 0x71, 0x02, 0x2B, 0xED, 0x7D, 0x02, 0x7F, 0x02, 0x51, -0x95, 0x7D, 0x01, 0x7F, 0x02, 0x74, 0x3D, 0x2F, 0xF8, 0xE6, 0xFE, 0xED, 0xF4, 0x5E, 0xFE, 0xF6, -0x74, 0x30, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x01, 0xF5, 0x83, 0xEE, 0xF0, 0x22, 0x90, 0x82, 0x6D, -0xE0, 0x04, 0xF0, 0x90, 0x81, 0x3E, 0xE0, 0x64, 0x02, 0x60, 0x28, 0x71, 0xB7, 0x90, 0x81, 0x39, -0xE0, 0x13, 0x13, 0x13, 0x54, 0x1F, 0x30, 0xE0, 0x14, 0x90, 0x81, 0x41, 0xE0, 0xFF, 0xA3, 0xE0, -0x6F, 0x70, 0x0A, 0x91, 0x4C, 0x51, 0x8B, 0x90, 0x81, 0x42, 0xE0, 0x14, 0xF0, 0x90, 0x01, 0xE6, -0xE0, 0x04, 0xF0, 0x22, 0xEF, 0x70, 0x34, 0x7D, 0x78, 0x7F, 0x02, 0x51, 0x95, 0x7D, 0x02, 0x7F, -0x03, 0x51, 0x95, 0x7D, 0xC8, 0x7F, 0x02, 0x12, 0x70, 0x07, 0x90, 0x01, 0x57, 0xE4, 0xF0, 0x90, -0x01, 0x3C, 0x74, 0x02, 0xF0, 0x7D, 0x01, 0x7F, 0x0C, 0x12, 0x49, 0x14, 0x90, 0x81, 0x38, 0xE0, -0x54, 0xF7, 0xF0, 0x90, 0x06, 0x0A, 0xE0, 0x54, 0xF8, 0xF0, 0x22, 0x90, 0x01, 0x36, 0x74, 0x78, -0xF0, 0xA3, 0x74, 0x02, 0xF0, 0x7D, 0x78, 0xFF, 0x12, 0x50, 0xC2, 0x7D, 0x02, 0x7F, 0x03, 0x12, -0x50, 0xC2, 0x90, 0x06, 0x0A, 0xE0, 0x44, 0x07, 0xF0, 0x90, 0x81, 0x46, 0xA3, 0xE0, 0x90, 0x05, -0x58, 0xF0, 0x90, 0x80, 0xF7, 0xE0, 0xB4, 0x01, 0x15, 0x90, 0x81, 0x39, 0xE0, 0x54, 0xFB, 0xF0, -0x90, 0x81, 0x3E, 0xE0, 0x20, 0xE2, 0x0E, 0x7D, 0x01, 0x7F, 0x04, 0x02, 0x49, 0x14, 0x90, 0x81, -0x39, 0xE0, 0x44, 0x04, 0xF0, 0x22, 0x90, 0x81, 0x3B, 0xE0, 0x60, 0x45, 0x90, 0x81, 0x39, 0xE0, -0xFF, 0x13, 0x13, 0x13, 0x54, 0x1F, 0x30, 0xE0, 0x12, 0x90, 0x01, 0x3B, 0xE0, 0x30, 0xE4, 0x0B, -0x51, 0x8B, 0x90, 0x81, 0x41, 0xE0, 0x14, 0x90, 0x05, 0x73, 0xF0, 0x90, 0x83, 0x25, 0xE4, 0x75, -0xF0, 0x01, 0x12, 0x41, 0xF6, 0xC3, 0x90, 0x83, 0x26, 0xE0, 0x94, 0x80, 0x90, 0x83, 0x25, 0xE0, -0x64, 0x80, 0x94, 0x80, 0x40, 0x0B, 0x90, 0x01, 0x98, 0xE0, 0x54, 0xFE, 0xF0, 0xE0, 0x44, 0x01, -0xF0, 0x12, 0x78, 0xEB, 0x02, 0x50, 0x8C, 0x90, 0x80, 0xF7, 0xE0, 0x64, 0x01, 0x60, 0x02, 0x81, -0x4B, 0x90, 0x81, 0x3B, 0xE0, 0x70, 0x02, 0x81, 0x4B, 0x90, 0x81, 0x3A, 0xE0, 0xC4, 0x54, 0x0F, -0x64, 0x01, 0x70, 0x22, 0x90, 0x06, 0xAB, 0xE0, 0x90, 0x81, 0x42, 0xF0, 0x90, 0x06, 0xAA, 0xE0, -0x90, 0x81, 0x41, 0xF0, 0xA3, 0xE0, 0xFF, 0x70, 0x08, 0x90, 0x81, 0x41, 0xE0, 0xFE, 0xFF, 0x80, -0x00, 0x90, 0x81, 0x42, 0xEF, 0xF0, 0x90, 0x81, 0x39, 0xE0, 0x44, 0x04, 0xF0, 0xE4, 0x90, 0x81, -0x44, 0xF0, 0x90, 0x81, 0x46, 0xA3, 0xE0, 0x90, 0x05, 0x58, 0xF0, 0x90, 0x01, 0x57, 0xE4, 0xF0, -0x90, 0x01, 0x3C, 0x74, 0x02, 0xF0, 0x90, 0x81, 0x3F, 0xE0, 0x54, 0xFD, 0xF0, 0x54, 0xEF, 0xF0, -0x90, 0x81, 0x3A, 0xE0, 0xFF, 0xC4, 0x54, 0x0F, 0x24, 0xFD, 0x50, 0x02, 0x80, 0x03, 0x12, 0x4E, -0x43, 0x90, 0x81, 0x39, 0xE0, 0x13, 0x13, 0x13, 0x54, 0x1F, 0x30, 0xE0, 0x0E, 0x90, 0x81, 0x41, -0xE0, 0xFF, 0xA3, 0xE0, 0xB5, 0x07, 0x04, 0x91, 0x4C, 0x51, 0x91, 0x22, 0xEF, 0x14, 0x90, 0x05, -0x73, 0xF0, 0x90, 0x01, 0x3F, 0x74, 0x10, 0xF0, 0xFD, 0x7F, 0x03, 0x74, 0x45, 0x2F, 0xF8, 0xE6, -0x4D, 0xFE, 0xF6, 0x74, 0x38, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x01, 0xF5, 0x83, 0xEE, 0xF0, 0x22, -0x31, 0xBA, 0x90, 0x01, 0x3F, 0x74, 0x04, 0xF0, 0x90, 0x80, 0x05, 0xE0, 0xFF, 0xB4, 0x01, 0x07, -0x90, 0xFD, 0x00, 0xE0, 0x54, 0xEF, 0xF0, 0xEF, 0xB4, 0x01, 0x07, 0x90, 0xFE, 0x10, 0xE0, 0x54, -0xFB, 0xF0, 0x22, 0x90, 0x82, 0x7E, 0x12, 0x42, 0x53, 0x12, 0x71, 0x53, 0x90, 0x81, 0x3B, 0xE0, -0xFF, 0x51, 0xE4, 0x90, 0x81, 0x3B, 0xE0, 0x60, 0x19, 0x90, 0x82, 0x7E, 0x12, 0x42, 0x4A, 0x90, -0x00, 0x01, 0x12, 0x1F, 0xBD, 0x54, 0x0F, 0xFF, 0x90, 0x00, 0x02, 0x12, 0x1F, 0xBD, 0xFD, 0x12, -0x71, 0xFC, 0x22, 0x12, 0x57, 0xD8, 0xAD, 0x07, 0xEF, 0x64, 0x01, 0x60, 0x20, 0x90, 0x81, 0x58, -0xE0, 0x44, 0x01, 0xF0, 0xED, 0xB4, 0x02, 0x08, 0x90, 0x01, 0xC7, 0x74, 0x40, 0xF0, 0x80, 0x0A, -0xED, 0xB4, 0x04, 0x06, 0x90, 0x01, 0xC7, 0x74, 0x41, 0xF0, 0x02, 0x51, 0x7A, 0x12, 0x73, 0x97, -0x90, 0x02, 0x87, 0xE0, 0x70, 0xF7, 0x90, 0x06, 0x90, 0xE0, 0x44, 0x02, 0xF0, 0x22, 0x90, 0x05, -0x22, 0x74, 0xFF, 0xF0, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x12, 0x6F, 0xBF, 0x90, 0x85, -0xBB, 0x12, 0x20, 0xDA, 0xCC, 0xF0, 0x00, 0xC0, 0x7F, 0x8C, 0x7E, 0x08, 0x12, 0x2E, 0xA2, 0x90, -0x85, 0xBB, 0x12, 0x20, 0xDA, 0x00, 0x00, 0x00, 0x14, 0x7F, 0x70, 0x7E, 0x0E, 0x12, 0x2E, 0xA2, -0x90, 0x83, 0x03, 0x12, 0x20, 0xDA, 0x00, 0x00, 0x00, 0x00, 0xE4, 0xFD, 0xFF, 0x12, 0x4F, 0x74, -0x7F, 0x7C, 0x7E, 0x08, 0x12, 0x2D, 0x5C, 0xEC, 0x44, 0x80, 0xFC, 0x90, 0x83, 0x15, 0x12, 0x20, -0xCE, 0x90, 0x83, 0x15, 0x12, 0x42, 0x26, 0x90, 0x85, 0xBB, 0x12, 0x20, 0xCE, 0x7F, 0x7C, 0x7E, -0x08, 0x12, 0x2E, 0xA2, 0x90, 0x01, 0x00, 0x74, 0x3F, 0xF0, 0xA3, 0xE0, 0x54, 0xFD, 0xF0, 0x90, -0x05, 0x53, 0xE0, 0x44, 0x20, 0xF0, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, -0xC0, 0xD0, 0x12, 0x1F, 0xA4, 0xFF, 0x54, 0x01, 0xFE, 0x90, 0x81, 0x53, 0xE0, 0x54, 0xFE, 0x4E, -0xFE, 0xF0, 0xEF, 0x54, 0x02, 0xFF, 0xEE, 0x54, 0xFD, 0x4F, 0xFF, 0xF0, 0x12, 0x1F, 0xA4, 0xFE, -0x54, 0x04, 0xFD, 0xEF, 0x54, 0xFB, 0x4D, 0xFF, 0x90, 0x81, 0x53, 0xF0, 0xEE, 0x54, 0x08, 0xFE, -0xEF, 0x54, 0xF7, 0x4E, 0xFF, 0xF0, 0x12, 0x1F, 0xA4, 0xFE, 0x54, 0x10, 0xFD, 0xEF, 0x54, 0xEF, -0x4D, 0xFF, 0x90, 0x81, 0x53, 0xF0, 0xEE, 0x54, 0x20, 0xFE, 0xEF, 0x54, 0xDF, 0x4E, 0xFF, 0xF0, -0x12, 0x1F, 0xA4, 0xFE, 0x54, 0x40, 0xFD, 0xEF, 0x54, 0xBF, 0x4D, 0xFF, 0x90, 0x81, 0x53, 0xF0, -0xEE, 0x54, 0x80, 0xFE, 0xEF, 0x54, 0x7F, 0x4E, 0xF0, 0x90, 0x01, 0x17, 0xE0, 0xFE, 0x90, 0x01, -0x16, 0xE0, 0x7C, 0x00, 0x24, 0x00, 0xFF, 0xEC, 0x3E, 0x90, 0x80, 0xF5, 0xF0, 0xA3, 0xEF, 0xF0, -0x90, 0x81, 0x53, 0xE0, 0xC3, 0x13, 0x54, 0x01, 0xFF, 0xD1, 0x2E, 0x90, 0x81, 0x53, 0xE0, 0x13, -0x13, 0x54, 0x01, 0xFF, 0xF1, 0x95, 0x90, 0x81, 0x53, 0xE0, 0xC4, 0x54, 0x01, 0xFF, 0xF1, 0x9B, -0x90, 0x81, 0x53, 0xE0, 0x54, 0x01, 0xFF, 0x31, 0xF2, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0xEF, 0x60, -0x07, 0x90, 0x82, 0x58, 0xE0, 0xFF, 0xD1, 0x39, 0x22, 0xD1, 0x61, 0x7E, 0x00, 0x90, 0x83, 0x2F, -0xD1, 0x75, 0x90, 0x83, 0x2F, 0xA3, 0xE0, 0x2F, 0x24, 0x36, 0xF9, 0xE4, 0x34, 0xFC, 0x75, 0x13, -0x01, 0xF5, 0x14, 0x89, 0x15, 0x75, 0x16, 0x04, 0x7B, 0x01, 0x7A, 0x81, 0x79, 0x6C, 0x02, 0x2B, -0xED, 0xE4, 0xFE, 0xEF, 0xC3, 0x13, 0xFD, 0xEF, 0x30, 0xE0, 0x02, 0x7E, 0x80, 0x90, 0xFD, 0x10, -0xED, 0xF0, 0xAF, 0x06, 0x22, 0xEE, 0xF0, 0xA3, 0xEF, 0xF0, 0xFE, 0x24, 0x20, 0xF5, 0x82, 0xE4, -0x34, 0xFC, 0xF5, 0x83, 0xE0, 0xFF, 0x74, 0x24, 0x2E, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, -0xE0, 0xFD, 0xE4, 0xFE, 0xEF, 0x30, 0xE7, 0x04, 0x7C, 0x02, 0x80, 0x02, 0xE4, 0xFC, 0xAF, 0x05, -0xF1, 0x4D, 0xAE, 0x07, 0xEC, 0x24, 0x18, 0x2E, 0xFF, 0x22, 0x90, 0x83, 0x0A, 0xED, 0xF0, 0x90, -0x83, 0x07, 0x12, 0x42, 0x53, 0xE4, 0x90, 0x83, 0x0B, 0xF0, 0xA3, 0xF0, 0x12, 0x1F, 0xA4, 0xFF, -0x90, 0x00, 0x04, 0x12, 0x1F, 0xBD, 0xFD, 0xD1, 0x92, 0x90, 0x83, 0x0B, 0xEF, 0xF0, 0x90, 0x83, -0x07, 0x12, 0x42, 0x4A, 0x90, 0x00, 0x04, 0x12, 0x1F, 0xBD, 0xFF, 0xF1, 0x4D, 0x90, 0x83, 0x0C, -0xEF, 0xF0, 0x90, 0x81, 0x70, 0xE0, 0x24, 0xFE, 0x60, 0x1E, 0x24, 0xFE, 0x60, 0x1A, 0x14, 0x60, -0x07, 0x14, 0x60, 0x04, 0x24, 0x05, 0x70, 0x54, 0x7B, 0x01, 0x7A, 0x81, 0x79, 0x71, 0x90, 0x83, -0x0A, 0xE0, 0xFD, 0x12, 0x7A, 0x4B, 0x80, 0x16, 0x7B, 0x01, 0x7A, 0x81, 0x79, 0x71, 0x90, 0x83, -0x0A, 0xE0, 0xFD, 0x90, 0x81, 0x70, 0xE0, 0x90, 0x82, 0xE5, 0xF0, 0x12, 0x79, 0x29, 0x90, 0x83, -0x0C, 0xE0, 0xFF, 0x90, 0x83, 0x07, 0x12, 0x42, 0x4A, 0x90, 0x83, 0x0B, 0xE0, 0x7C, 0x00, 0x29, -0xF9, 0xEC, 0x3A, 0xFA, 0xC3, 0xE9, 0x9F, 0xF9, 0xEA, 0x94, 0x00, 0xFA, 0x75, 0x13, 0x01, 0x75, -0x14, 0x81, 0x75, 0x15, 0x71, 0xA3, 0xE0, 0xF5, 0x16, 0x12, 0x2B, 0xED, 0x22, 0xD3, 0x10, 0xAF, -0x01, 0xC3, 0xC0, 0xD0, 0xEF, 0x20, 0xE0, 0x05, 0x90, 0x82, 0x55, 0x80, 0x03, 0x90, 0x82, 0x56, -0xE0, 0x90, 0x81, 0x70, 0xF0, 0x90, 0x81, 0x70, 0xE0, 0x14, 0x60, 0x13, 0x14, 0x60, 0x14, 0x24, -0xFE, 0x60, 0x10, 0x14, 0x60, 0x09, 0x14, 0x60, 0x06, 0x24, 0x06, 0xE4, 0xFE, 0x80, 0x06, 0x7E, -0x04, 0x80, 0x02, 0x7E, 0x08, 0xAF, 0x06, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x22, 0x22, 0x22, 0xE4, -0x90, 0x80, 0xF7, 0xF0, 0x22, 0x90, 0x82, 0x7E, 0xEF, 0xF0, 0x22, 0x90, 0x82, 0x7E, 0xEF, 0xF0, -0x22, 0x75, 0xE8, 0x03, 0x75, 0xA8, 0x84, 0x22, 0x90, 0x01, 0xC7, 0x74, 0x05, 0xF0, 0x22, 0x90, -0x01, 0xE4, 0x74, 0x0D, 0xF0, 0xA3, 0xE4, 0xF0, 0x22, 0xE4, 0x90, 0x80, 0x01, 0xF0, 0xA3, 0xF0, -0xA3, 0xF0, 0xA3, 0xF0, 0x22, 0x90, 0x01, 0x94, 0xE0, 0x44, 0x01, 0xF0, 0x90, 0x01, 0xC7, 0xE4, -0xF0, 0x22, 0xE4, 0x90, 0x80, 0xF3, 0xF0, 0xA3, 0xF0, 0x90, 0x80, 0x5B, 0xF0, 0xA3, 0xF0, 0x22, -0xE4, 0x90, 0x82, 0x76, 0xF0, 0x90, 0x82, 0x76, 0xE0, 0x64, 0x01, 0xF0, 0x24, 0xE0, 0x90, 0x01, -0xC4, 0xF0, 0x74, 0x5F, 0xA3, 0xF0, 0x90, 0x81, 0x3B, 0xE0, 0x60, 0x0F, 0x90, 0x81, 0x3E, 0xE0, -0xFF, 0x90, 0x81, 0x3D, 0xE0, 0x6F, 0x60, 0x03, 0x12, 0x4E, 0x3A, 0xC2, 0xAF, 0x51, 0xC6, 0xBF, -0x01, 0x02, 0x31, 0xDF, 0xD2, 0xAF, 0x11, 0x1D, 0x12, 0x44, 0x79, 0x80, 0xC8, 0xD3, 0x10, 0xAF, -0x01, 0xC3, 0xC0, 0xD0, 0x90, 0x00, 0x8F, 0xE0, 0x20, 0xE6, 0x02, 0x21, 0xAF, 0x90, 0x00, 0x8C, -0xE0, 0x90, 0x82, 0x77, 0xF0, 0x90, 0x00, 0x8D, 0xE0, 0x90, 0x82, 0x78, 0xF0, 0x90, 0x00, 0x8E, -0xE0, 0x90, 0x82, 0x79, 0xF0, 0x90, 0x82, 0x78, 0xE0, 0x24, 0xF1, 0x70, 0x02, 0x21, 0x0E, 0x24, -0x07, 0x60, 0x02, 0x21, 0xA1, 0x90, 0x81, 0x3B, 0xE0, 0xFB, 0xE4, 0xFD, 0xFF, 0x31, 0xB7, 0x90, -0x81, 0x3A, 0xE0, 0x54, 0x0F, 0xFB, 0x0D, 0x31, 0xB7, 0x90, 0x81, 0x3D, 0x31, 0xB4, 0x90, 0x81, -0x3E, 0xE0, 0xFB, 0x0D, 0x31, 0xB7, 0x90, 0x82, 0x77, 0xE0, 0x24, 0xF7, 0xF5, 0x82, 0xE4, 0x34, -0x80, 0xF5, 0x83, 0xE0, 0xFB, 0xE4, 0xFD, 0x0F, 0x31, 0xB7, 0x90, 0x81, 0x38, 0xE0, 0x54, 0x01, -0xFB, 0x0D, 0x31, 0xB7, 0x90, 0x81, 0x38, 0xE0, 0xC4, 0x13, 0x13, 0x54, 0x01, 0xFB, 0x0D, 0x7F, -0x01, 0x31, 0xB7, 0x90, 0x81, 0x38, 0xE0, 0xC4, 0x13, 0x13, 0x13, 0x54, 0x01, 0xFB, 0x0D, 0x7F, -0x01, 0x31, 0xB7, 0x90, 0x80, 0x03, 0xE0, 0xFB, 0xE4, 0xFD, 0x0F, 0x31, 0xB7, 0x90, 0x80, 0x04, -0xE0, 0xFB, 0x0D, 0x31, 0xB7, 0x90, 0x81, 0x42, 0xE0, 0xFB, 0x0D, 0x31, 0xB7, 0x90, 0x81, 0x41, -0xE0, 0xFB, 0x0D, 0x31, 0xB7, 0x90, 0x81, 0x3A, 0xE0, 0xC4, 0x54, 0x0F, 0xFB, 0xE4, 0xFD, 0x7F, -0x03, 0x31, 0xB7, 0x90, 0x81, 0x39, 0xE0, 0x13, 0x13, 0x54, 0x01, 0xFB, 0x0D, 0x7F, 0x03, 0x31, -0xB7, 0x90, 0x81, 0x39, 0xE0, 0x13, 0x13, 0x13, 0x54, 0x01, 0xFB, 0x0D, 0x7F, 0x03, 0x31, 0xB7, -0x90, 0x81, 0x38, 0xE0, 0x13, 0x13, 0x54, 0x01, 0xFB, 0x0D, 0x7F, 0x03, 0x21, 0x9F, 0x90, 0x81, -0x53, 0xE0, 0x54, 0x01, 0xFB, 0xE4, 0xFD, 0xFF, 0x31, 0xB7, 0x90, 0x81, 0x54, 0xE0, 0xC4, 0x13, -0x13, 0x13, 0x54, 0x01, 0xFB, 0x0D, 0xE4, 0xFF, 0x31, 0xB7, 0x90, 0x81, 0x54, 0xE0, 0xC4, 0x54, -0x01, 0xFB, 0x0D, 0xE4, 0xFF, 0x31, 0xB7, 0x90, 0x81, 0x58, 0xE0, 0x54, 0x01, 0xFB, 0x0D, 0x31, -0xB7, 0x90, 0x81, 0x65, 0xE0, 0xFB, 0xE4, 0xFD, 0x0F, 0x31, 0xB7, 0x90, 0x81, 0x66, 0xE0, 0xFB, -0x0D, 0x31, 0xB7, 0x90, 0x81, 0x67, 0xE0, 0xFB, 0x0D, 0x31, 0xB7, 0x90, 0x81, 0x68, 0xE0, 0xFB, -0x0D, 0x31, 0xB7, 0x90, 0x81, 0x69, 0xE0, 0xFB, 0xE4, 0xFD, 0x0F, 0x31, 0xB7, 0x90, 0x81, 0x6A, -0xE0, 0xFB, 0x0D, 0x31, 0xB7, 0x90, 0x81, 0x6B, 0xE0, 0xFB, 0x0D, 0x31, 0xB7, 0x90, 0x82, 0x5A, -0xE0, 0xFB, 0x0D, 0x31, 0xB7, 0x90, 0x80, 0x07, 0xE0, 0xFB, 0xE4, 0xFD, 0x0F, 0x31, 0xB7, 0x90, -0x80, 0x08, 0xE0, 0xFB, 0x0D, 0x31, 0xB7, 0x90, 0x82, 0x58, 0x31, 0xB4, 0xE4, 0xFB, 0x0D, 0x31, -0xB7, 0x90, 0x00, 0x8F, 0xE0, 0x30, 0xE0, 0x07, 0xE4, 0xFD, 0x7F, 0x8D, 0x12, 0x32, 0x1E, 0xD0, -0xD0, 0x92, 0xAF, 0x22, 0xE0, 0xFB, 0x0D, 0xEF, 0x70, 0x04, 0x74, 0xF0, 0x80, 0x16, 0xEF, 0xB4, -0x01, 0x04, 0x74, 0xF4, 0x80, 0x0E, 0xEF, 0xB4, 0x02, 0x04, 0x74, 0xF8, 0x80, 0x06, 0xEF, 0xB4, -0x03, 0x0C, 0x74, 0xFC, 0x2D, 0xF5, 0x82, 0xE4, 0x34, 0x02, 0xF5, 0x83, 0xEB, 0xF0, 0x22, 0x90, -0x81, 0x38, 0xE0, 0x30, 0xE0, 0x02, 0x31, 0xE9, 0x22, 0x90, 0x81, 0x3E, 0xE0, 0xFF, 0x60, 0x03, -0xB4, 0x08, 0x0D, 0x51, 0xED, 0xBF, 0x01, 0x08, 0x51, 0x01, 0x90, 0x01, 0xE5, 0xE0, 0x04, 0xF0, -0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x51, 0x79, 0x51, 0x11, 0xD0, 0xD0, 0x92, 0xAF, -0x22, 0x51, 0xBE, 0x90, 0x00, 0x08, 0xE0, 0x54, 0xEF, 0xFD, 0x7F, 0x08, 0x12, 0x32, 0x1E, 0xE4, -0xFF, 0x8F, 0x0F, 0xE4, 0x90, 0x82, 0x77, 0xF0, 0xA3, 0xF0, 0x90, 0x01, 0x09, 0xE0, 0x7F, 0x00, -0x30, 0xE7, 0x02, 0x7F, 0x01, 0xEF, 0x65, 0x0F, 0x60, 0x3E, 0xC3, 0x90, 0x82, 0x78, 0xE0, 0x94, -0x88, 0x90, 0x82, 0x77, 0xE0, 0x94, 0x13, 0x40, 0x08, 0x90, 0x01, 0xC0, 0xE0, 0x44, 0x10, 0xF0, -0x22, 0x90, 0x82, 0x77, 0xE4, 0x75, 0xF0, 0x01, 0x12, 0x41, 0xF6, 0x7F, 0x14, 0x7E, 0x00, 0x12, -0x32, 0xAA, 0xD3, 0x90, 0x82, 0x78, 0xE0, 0x94, 0x32, 0x90, 0x82, 0x77, 0xE0, 0x94, 0x00, 0x40, -0xB9, 0x90, 0x01, 0xC6, 0xE0, 0x30, 0xE0, 0xB2, 0x22, 0x90, 0x81, 0x45, 0xE0, 0xFD, 0x7F, 0x93, -0x12, 0x32, 0x1E, 0x90, 0x81, 0x3C, 0xE0, 0x60, 0x12, 0x90, 0x01, 0x2F, 0xE0, 0x30, 0xE7, 0x05, -0x74, 0x10, 0xF0, 0x80, 0x06, 0x90, 0x01, 0x2F, 0x74, 0x90, 0xF0, 0x90, 0x00, 0x08, 0xE0, 0x44, -0x10, 0xFD, 0x7F, 0x08, 0x12, 0x32, 0x1E, 0x7F, 0x01, 0x51, 0x21, 0x90, 0x00, 0x90, 0xE0, 0x44, -0x01, 0xFD, 0x7F, 0x90, 0x12, 0x32, 0x1E, 0x7F, 0x14, 0x7E, 0x00, 0x02, 0x32, 0xAA, 0x90, 0x00, -0x90, 0xE0, 0x20, 0xE0, 0xF9, 0x22, 0x7F, 0x02, 0x90, 0x82, 0x64, 0xE0, 0xFE, 0xEF, 0xC3, 0x9E, -0x50, 0x18, 0xEF, 0x25, 0xE0, 0x24, 0x81, 0xF8, 0xE6, 0x30, 0xE4, 0x0B, 0x90, 0x01, 0xB8, 0x74, -0x08, 0xF0, 0xA3, 0xF0, 0x7F, 0x00, 0x22, 0x0F, 0x80, 0xDE, 0x7F, 0x01, 0x22, 0x90, 0x02, 0x87, -0xE0, 0x60, 0x08, 0x90, 0x01, 0xB8, 0x74, 0x01, 0xF0, 0x80, 0x3B, 0x90, 0x81, 0x53, 0xE0, 0x30, -0xE0, 0x0E, 0x90, 0x02, 0x82, 0xE0, 0x60, 0x08, 0x90, 0x01, 0xB8, 0x74, 0x02, 0xF0, 0x80, 0x26, -0x90, 0x81, 0x58, 0xE0, 0x30, 0xE0, 0x08, 0x90, 0x01, 0xB8, 0x74, 0x08, 0xF0, 0x80, 0x17, 0x90, -0x02, 0x86, 0xE0, 0x20, 0xE1, 0x08, 0x90, 0x01, 0xB8, 0x74, 0x04, 0xF0, 0x80, 0x08, 0x90, 0x01, -0xB8, 0xE4, 0xF0, 0x7F, 0x01, 0x22, 0x90, 0x01, 0xB9, 0x74, 0x08, 0xF0, 0x7F, 0x00, 0x22, 0xE4, -0xFB, 0xFA, 0xFD, 0x7F, 0x01, 0x12, 0x46, 0x7A, 0x90, 0x82, 0x7A, 0xEF, 0xF0, 0x60, 0xF0, 0x90, -0x80, 0x01, 0xE0, 0xFF, 0x60, 0xE9, 0xC2, 0xAF, 0x30, 0xE1, 0x05, 0x54, 0xFD, 0xF0, 0x71, 0x8C, -0xD2, 0xAF, 0xC2, 0xAF, 0x90, 0x80, 0x01, 0xE0, 0xFF, 0x30, 0xE2, 0x05, 0x54, 0xFB, 0xF0, 0xD1, -0x5B, 0xD2, 0xAF, 0xC2, 0xAF, 0x90, 0x80, 0x01, 0xE0, 0xFF, 0x30, 0xE4, 0x0B, 0x54, 0xEF, 0xF0, -0xD1, 0x1E, 0xBF, 0x01, 0x03, 0x12, 0x53, 0x53, 0xD2, 0xAF, 0x80, 0xC3, 0xD3, 0x10, 0xAF, 0x01, -0xC3, 0xC0, 0xD0, 0x90, 0x80, 0x5C, 0xE0, 0xFF, 0x90, 0x80, 0x5B, 0xE0, 0xB5, 0x07, 0x04, 0x7F, -0x01, 0x80, 0x02, 0x7F, 0x00, 0xEF, 0x70, 0x43, 0x90, 0x80, 0x5B, 0xE0, 0xFE, 0x75, 0xF0, 0x08, -0x90, 0x80, 0x0B, 0x12, 0x42, 0x3E, 0xE0, 0xFD, 0xEE, 0x75, 0xF0, 0x08, 0xA4, 0x24, 0x0C, 0xF9, -0x74, 0x80, 0x35, 0xF0, 0xFA, 0x7B, 0x01, 0xAF, 0x05, 0x71, 0xF0, 0x90, 0x80, 0x5B, 0xE0, 0x04, -0xF0, 0xE0, 0x7F, 0x00, 0xB4, 0x0A, 0x02, 0x7F, 0x01, 0xEF, 0x60, 0x05, 0xE4, 0x90, 0x80, 0x5B, -0xF0, 0x12, 0x6B, 0x60, 0x90, 0x80, 0x01, 0xE0, 0x44, 0x02, 0xF0, 0xD0, 0xD0, 0x92, 0xAF, 0x22, -0x90, 0x82, 0x7B, 0x12, 0x42, 0x53, 0xEF, 0x12, 0x42, 0x5C, 0x64, 0x2B, 0x00, 0x64, 0x33, 0x01, -0x64, 0x3B, 0x02, 0x64, 0x43, 0x03, 0x64, 0x4B, 0x04, 0x64, 0x53, 0x13, 0x64, 0x5C, 0x20, 0x64, -0x65, 0x21, 0x64, 0x6D, 0x23, 0x64, 0x75, 0x25, 0x64, 0x86, 0x80, 0x64, 0x7D, 0x81, 0x64, 0x8F, -0x82, 0x64, 0x97, 0x83, 0x64, 0x9F, 0x84, 0x00, 0x00, 0x64, 0xA7, 0x90, 0x82, 0x7B, 0x12, 0x42, -0x4A, 0xC1, 0xDF, 0x90, 0x82, 0x7B, 0x12, 0x42, 0x4A, 0x81, 0xDB, 0x90, 0x82, 0x7B, 0x12, 0x42, -0x4A, 0xA1, 0xE6, 0x90, 0x82, 0x7B, 0x12, 0x42, 0x4A, 0xA1, 0xC6, 0x90, 0x82, 0x7B, 0x12, 0x42, -0x4A, 0x80, 0x5C, 0x90, 0x82, 0x7B, 0x12, 0x42, 0x4A, 0x02, 0x6A, 0x66, 0x90, 0x82, 0x7B, 0x12, -0x42, 0x4A, 0x02, 0x6A, 0xD4, 0x90, 0x82, 0x7B, 0x12, 0x42, 0x4A, 0xC1, 0x99, 0x90, 0x82, 0x7B, -0x12, 0x42, 0x4A, 0xA1, 0x7F, 0x90, 0x82, 0x7B, 0x12, 0x42, 0x4A, 0xA1, 0x87, 0x90, 0x82, 0x7B, -0x12, 0x42, 0x4A, 0x02, 0x5D, 0x7B, 0x90, 0x82, 0x7B, 0x12, 0x42, 0x4A, 0x02, 0x74, 0x90, 0x90, -0x82, 0x7B, 0x12, 0x42, 0x4A, 0xA1, 0xAC, 0x90, 0x82, 0x7B, 0x12, 0x42, 0x4A, 0xE1, 0x27, 0x90, -0x82, 0x7B, 0x12, 0x42, 0x4A, 0xE1, 0x7C, 0x90, 0x01, 0xC0, 0xE0, 0x44, 0x01, 0xF0, 0x22, 0xB1, -0x97, 0x12, 0x1F, 0xA4, 0xFF, 0x54, 0x01, 0xFE, 0x90, 0x82, 0x68, 0xE0, 0x54, 0xFE, 0x4E, 0xF0, -0xEF, 0xC3, 0x13, 0x30, 0xE0, 0x14, 0x90, 0x00, 0x01, 0x12, 0x1F, 0xBD, 0x90, 0x82, 0x69, 0xF0, -0x90, 0x00, 0x02, 0x12, 0x1F, 0xBD, 0x90, 0x82, 0x6A, 0xF0, 0x22, 0x90, 0x82, 0x7E, 0x12, 0x42, -0x53, 0x90, 0x00, 0x01, 0x12, 0x1F, 0xBD, 0xFF, 0xFE, 0x12, 0x1F, 0xA4, 0xFD, 0xC3, 0x13, 0x30, -0xE0, 0x12, 0x90, 0x82, 0x7E, 0x12, 0x42, 0x4A, 0x90, 0x00, 0x02, 0x12, 0x1F, 0xBD, 0x90, 0x82, -0x82, 0xF0, 0x80, 0x05, 0x90, 0x82, 0x82, 0xEF, 0xF0, 0x90, 0x82, 0x81, 0xEE, 0xF0, 0x90, 0x82, -0x82, 0xE0, 0xFE, 0x90, 0x82, 0x81, 0xE0, 0xFF, 0xD3, 0x9E, 0x50, 0x38, 0x90, 0x82, 0x7E, 0x12, -0x42, 0x4A, 0x12, 0x1F, 0xA4, 0x54, 0x01, 0xFE, 0x74, 0xF7, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x80, -0xF5, 0x83, 0xEE, 0xF0, 0x74, 0xF7, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x80, 0xF5, 0x83, 0xE0, 0x70, -0x04, 0xB1, 0x7E, 0x80, 0x07, 0x90, 0x82, 0x81, 0xE0, 0xFF, 0xB1, 0x7D, 0x90, 0x82, 0x81, 0xE0, -0x04, 0xF0, 0x80, 0xBA, 0x90, 0x80, 0xF7, 0xE0, 0x70, 0x22, 0x90, 0x81, 0x3E, 0xE0, 0x70, 0x04, -0xFF, 0x12, 0x4A, 0xF6, 0x90, 0x81, 0x3E, 0xE0, 0x64, 0x0C, 0x60, 0x03, 0x12, 0x4F, 0xD6, 0x90, -0x81, 0x38, 0xE0, 0x54, 0xF7, 0xF0, 0x54, 0xBF, 0xF0, 0x54, 0x7F, 0xF0, 0x22, 0x22, 0x22, 0x12, -0x1F, 0xA4, 0x90, 0x81, 0x45, 0xF0, 0x22, 0x12, 0x1F, 0xA4, 0x90, 0x81, 0x52, 0xF0, 0x90, 0x81, -0x52, 0xE0, 0x90, 0x01, 0xE7, 0xF0, 0x22, 0x90, 0x82, 0x68, 0xE0, 0x54, 0xFE, 0xF0, 0xA3, 0x74, -0x03, 0xF0, 0xA3, 0xF0, 0xE4, 0xA3, 0xF0, 0xA3, 0xF0, 0xA3, 0xF0, 0x22, 0x90, 0x02, 0x09, 0xE0, -0x90, 0x82, 0x7E, 0xF0, 0x12, 0x1F, 0xA4, 0x90, 0x82, 0x55, 0xF0, 0x90, 0x00, 0x01, 0x12, 0x1F, -0xBD, 0x90, 0x82, 0x56, 0xF0, 0x22, 0x12, 0x1F, 0xA4, 0xFF, 0x54, 0x01, 0xFE, 0x90, 0x82, 0x65, -0xE0, 0x54, 0xFE, 0x4E, 0xF0, 0xEF, 0xC3, 0x13, 0x30, 0xE0, 0x0A, 0x90, 0x00, 0x01, 0x12, 0x1F, -0xBD, 0x90, 0x82, 0x66, 0xF0, 0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x12, 0x1F, 0xA4, -0xFF, 0x90, 0x81, 0x37, 0xF0, 0xBF, 0x01, 0x12, 0x90, 0x00, 0x01, 0x12, 0x1F, 0xBD, 0x64, 0x01, -0x60, 0x17, 0x90, 0x05, 0x22, 0x74, 0x6F, 0xF0, 0x80, 0x0F, 0x90, 0x00, 0x01, 0x12, 0x1F, 0xBD, -0x64, 0x01, 0x60, 0x05, 0x90, 0x05, 0x22, 0xE4, 0xF0, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0xE4, 0x90, -0x83, 0x2D, 0xF0, 0xA3, 0xF0, 0x90, 0x02, 0x86, 0xE0, 0x20, 0xE1, 0x2C, 0xC3, 0x90, 0x83, 0x2E, -0xE0, 0x94, 0xD0, 0x90, 0x83, 0x2D, 0xE0, 0x94, 0x07, 0x40, 0x0A, 0x90, 0x01, 0xC1, 0xE0, 0x44, -0x04, 0xF0, 0x7F, 0x00, 0x22, 0x90, 0x83, 0x2D, 0xE4, 0x75, 0xF0, 0x01, 0x12, 0x41, 0xF6, 0x7F, -0x0A, 0x7E, 0x00, 0x12, 0x32, 0xAA, 0x80, 0xCD, 0x7F, 0x01, 0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, -0xC0, 0xD0, 0xE4, 0xFF, 0x90, 0x80, 0xF4, 0xE0, 0xFE, 0x90, 0x80, 0xF3, 0xE0, 0xB5, 0x06, 0x04, -0x7E, 0x01, 0x80, 0x02, 0x7E, 0x00, 0xEE, 0x64, 0x01, 0x60, 0x19, 0xEF, 0x60, 0x16, 0x90, 0x80, -0xF3, 0xE0, 0x04, 0xF0, 0xE0, 0x7F, 0x00, 0xB4, 0x0A, 0x02, 0x7F, 0x01, 0xEF, 0x60, 0x05, 0xE4, -0x90, 0x80, 0xF3, 0xF0, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x90, 0x00, 0x02, 0x12, 0x1F, 0xBD, 0xFF, -0x30, 0xE0, 0x26, 0x12, 0x1F, 0xA4, 0x90, 0x81, 0x4C, 0xF0, 0x90, 0x00, 0x01, 0x12, 0x1F, 0xBD, -0x90, 0x81, 0x4D, 0xF0, 0xEF, 0x54, 0xFE, 0xFF, 0xA3, 0xE0, 0x54, 0x01, 0x4F, 0xF0, 0x90, 0x00, -0x03, 0x12, 0x1F, 0xBD, 0x90, 0x81, 0x4F, 0xF0, 0x22, 0x90, 0x81, 0x4C, 0x74, 0x01, 0xF0, 0xA3, -0x74, 0x05, 0xF0, 0xA3, 0xE0, 0x54, 0x01, 0x44, 0x28, 0xF0, 0xA3, 0x74, 0x05, 0xF0, 0x22, 0x90, -0x02, 0x09, 0xE0, 0xFD, 0x12, 0x1F, 0xA4, 0xFE, 0xAF, 0x05, 0xED, 0x2E, 0x90, 0x80, 0x06, 0xF0, -0x90, 0x00, 0x01, 0x12, 0x1F, 0xBD, 0xFF, 0xED, 0x2F, 0x90, 0x80, 0x07, 0xF0, 0x90, 0x00, 0x02, -0x12, 0x1F, 0xBD, 0xFF, 0xED, 0x2F, 0x90, 0x80, 0x08, 0xF0, 0x90, 0x00, 0x03, 0x12, 0x1F, 0xBD, -0xFF, 0xED, 0x2F, 0x90, 0x80, 0x09, 0xF0, 0x90, 0x00, 0x04, 0x12, 0x1F, 0xBD, 0xFF, 0xAE, 0x05, -0xED, 0x2F, 0x90, 0x80, 0x0A, 0xF0, 0x22, 0x90, 0x02, 0x09, 0xE0, 0xFD, 0x12, 0x1F, 0xA4, 0xFE, -0xAF, 0x05, 0xED, 0x2E, 0x90, 0x82, 0x57, 0xF0, 0x90, 0x00, 0x01, 0x12, 0x1F, 0xBD, 0xFF, 0xED, -0x2F, 0x90, 0x82, 0x58, 0xF0, 0x90, 0x00, 0x02, 0x12, 0x1F, 0xBD, 0xFF, 0xED, 0x2F, 0x90, 0x82, -0x59, 0xF0, 0x90, 0x00, 0x03, 0x12, 0x1F, 0xBD, 0xFF, 0xED, 0x2F, 0x90, 0x82, 0x5A, 0xF0, 0x90, -0x00, 0x04, 0x12, 0x1F, 0xBD, 0xFF, 0xED, 0x2F, 0x90, 0x82, 0x5B, 0xF0, 0x90, 0x00, 0x05, 0x12, -0x1F, 0xBD, 0xFF, 0xAE, 0x05, 0xED, 0x2F, 0x90, 0x82, 0x5C, 0xF0, 0x22, 0x90, 0x02, 0x09, 0xE0, -0xFD, 0x12, 0x1F, 0xA4, 0xFE, 0xAF, 0x05, 0xED, 0x2E, 0x90, 0x82, 0x5D, 0xF0, 0x90, 0x00, 0x01, -0x12, 0x1F, 0xBD, 0xFF, 0xED, 0x2F, 0x90, 0x82, 0x5E, 0xF0, 0x90, 0x00, 0x02, 0x12, 0x1F, 0xBD, -0xFF, 0xED, 0x2F, 0x90, 0x82, 0x5F, 0xF0, 0x90, 0x00, 0x03, 0x12, 0x1F, 0xBD, 0xFF, 0xED, 0x2F, -0x90, 0x82, 0x60, 0xF0, 0x90, 0x00, 0x04, 0x12, 0x1F, 0xBD, 0xFF, 0xED, 0x2F, 0x90, 0x82, 0x61, -0xF0, 0x90, 0x00, 0x05, 0x12, 0x1F, 0xBD, 0xFF, 0xED, 0x2F, 0x90, 0x82, 0x62, 0xF0, 0x90, 0x00, -0x06, 0x12, 0x1F, 0xBD, 0xFF, 0xAE, 0x05, 0xED, 0x2F, 0x90, 0x82, 0x63, 0xF0, 0x22, 0x90, 0x82, -0xD2, 0xEF, 0xF0, 0xA3, 0xED, 0xF0, 0xA3, 0x12, 0x20, 0xDA, 0x00, 0x00, 0x00, 0x00, 0xE4, 0x90, -0x82, 0xE0, 0xF0, 0x7F, 0x24, 0x7E, 0x08, 0x12, 0x2D, 0x5C, 0x90, 0x82, 0xD8, 0x12, 0x20, 0xCE, -0x90, 0x82, 0xD2, 0xE0, 0xFB, 0x70, 0x08, 0x90, 0x82, 0xD8, 0x12, 0x42, 0x26, 0x80, 0x16, 0xEB, -0x75, 0xF0, 0x08, 0xA4, 0x24, 0x62, 0xF5, 0x82, 0xE4, 0x34, 0x87, 0xF5, 0x83, 0xE0, 0xFE, 0xA3, -0xE0, 0xFF, 0x12, 0x2D, 0x5C, 0x90, 0x82, 0xDC, 0x12, 0x20, 0xCE, 0x90, 0x82, 0xD3, 0xE0, 0xFF, -0xE4, 0xFC, 0xFD, 0xFE, 0x78, 0x17, 0x12, 0x20, 0xBB, 0xA8, 0x04, 0xA9, 0x05, 0xAA, 0x06, 0xAB, -0x07, 0x90, 0x82, 0xDC, 0x12, 0x42, 0x26, 0xED, 0x54, 0x7F, 0xFD, 0xEC, 0x54, 0x80, 0xFC, 0x12, -0x42, 0x19, 0xEC, 0x44, 0x80, 0xFC, 0x90, 0x82, 0xDC, 0x12, 0x20, 0xCE, 0x90, 0x82, 0xD8, 0x12, -0x42, 0x26, 0xEC, 0x54, 0x7F, 0xFC, 0x90, 0x85, 0xBB, 0x12, 0x20, 0xCE, 0x7F, 0x24, 0x7E, 0x08, -0x12, 0x2E, 0xA2, 0x90, 0x82, 0xD2, 0xE0, 0x75, 0xF0, 0x08, 0xA4, 0x24, 0x62, 0xF5, 0x82, 0xE4, -0x34, 0x87, 0xF5, 0x83, 0xE0, 0xFE, 0xA3, 0xE0, 0xFF, 0xC0, 0x06, 0xC0, 0x07, 0x90, 0x82, 0xDC, -0x12, 0x42, 0x26, 0x90, 0x85, 0xBB, 0x12, 0x20, 0xCE, 0xD0, 0x07, 0xD0, 0x06, 0x12, 0x2E, 0xA2, -0x90, 0x82, 0xD8, 0x12, 0x42, 0x26, 0xEC, 0x44, 0x80, 0xFC, 0x90, 0x85, 0xBB, 0x12, 0x20, 0xCE, -0x7F, 0x24, 0x7E, 0x08, 0x12, 0x2E, 0xA2, 0x90, 0x82, 0xD2, 0xE0, 0x70, 0x04, 0x7F, 0x20, 0x80, -0x09, 0x90, 0x82, 0xD2, 0xE0, 0xB4, 0x01, 0x16, 0x7F, 0x28, 0x7E, 0x08, 0x12, 0x2D, 0x5C, 0x78, -0x08, 0x12, 0x20, 0xA8, 0xEF, 0x54, 0x01, 0xFF, 0xE4, 0x90, 0x82, 0xE0, 0xEF, 0xF0, 0x90, 0x82, -0xE0, 0xE0, 0x90, 0x82, 0xD2, 0x60, 0x0E, 0xE0, 0x75, 0xF0, 0x08, 0xA4, 0x24, 0x66, 0xF5, 0x82, -0xE4, 0x34, 0x87, 0x80, 0x0C, 0xE0, 0x75, 0xF0, 0x08, 0xA4, 0x24, 0x64, 0xF5, 0x82, 0xE4, 0x34, -0x87, 0xF5, 0x83, 0xE0, 0xFE, 0xA3, 0xE0, 0xFF, 0x12, 0x2D, 0x5C, 0xED, 0x54, 0x0F, 0xFD, 0xE4, -0xFC, 0x90, 0x82, 0xD4, 0x12, 0x20, 0xCE, 0x90, 0x82, 0xD4, 0x02, 0x42, 0x26, 0x90, 0x82, 0xEF, -0xEF, 0xF0, 0xAB, 0x05, 0x90, 0x82, 0xF5, 0x12, 0x20, 0xDA, 0x00, 0x00, 0x00, 0x00, 0xAF, 0x03, -0xE4, 0xFC, 0xFD, 0xFE, 0x78, 0x14, 0x12, 0x20, 0xBB, 0xA8, 0x04, 0xA9, 0x05, 0xAA, 0x06, 0xAB, -0x07, 0x90, 0x82, 0xF1, 0x12, 0x42, 0x26, 0xED, 0x54, 0x0F, 0xFD, 0xE4, 0xFC, 0x12, 0x42, 0x19, -0xEC, 0x54, 0x0F, 0xFC, 0x90, 0x82, 0xF5, 0x12, 0x20, 0xCE, 0x90, 0x82, 0xEF, 0xE0, 0x75, 0xF0, -0x08, 0xA4, 0x24, 0x60, 0xF5, 0x82, 0xE4, 0x34, 0x87, 0xF5, 0x83, 0xE0, 0xFE, 0xA3, 0xE0, 0xFF, -0xC0, 0x06, 0xC0, 0x07, 0x90, 0x82, 0xF5, 0x12, 0x42, 0x26, 0x90, 0x85, 0xBB, 0x12, 0x20, 0xCE, -0xD0, 0x07, 0xD0, 0x06, 0x02, 0x2E, 0xA2, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x12, 0x67, -0xDE, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x90, 0x82, 0xAE, 0xEC, 0xF0, 0xA3, 0xED, 0xF0, 0x90, 0x82, -0xAD, 0xEF, 0xF0, 0xA3, 0xA3, 0xE0, 0xFD, 0x31, 0x87, 0x90, 0x82, 0xB8, 0x12, 0x20, 0xCE, 0x90, -0x82, 0xB0, 0x12, 0x42, 0x26, 0x12, 0x20, 0x9B, 0x90, 0x82, 0xB8, 0x12, 0x42, 0x32, 0x12, 0x42, -0x0C, 0xC0, 0x04, 0xC0, 0x05, 0xC0, 0x06, 0xC0, 0x07, 0x90, 0x82, 0xB0, 0x12, 0x42, 0x26, 0x90, -0x82, 0xB4, 0x12, 0x42, 0x32, 0x12, 0x42, 0x0C, 0xD0, 0x03, 0xD0, 0x02, 0xD0, 0x01, 0xD0, 0x00, -0x12, 0x42, 0x19, 0x90, 0x82, 0xBC, 0x12, 0x20, 0xCE, 0x90, 0x82, 0xAE, 0xA3, 0xE0, 0xFD, 0xC0, -0x05, 0x90, 0x82, 0xBC, 0x12, 0x42, 0x26, 0x90, 0x85, 0x96, 0x12, 0x20, 0xCE, 0x90, 0x82, 0xAD, -0xE0, 0xFF, 0xD0, 0x05, 0x02, 0x31, 0x4D, 0x90, 0x83, 0x1D, 0x12, 0x42, 0x53, 0xE4, 0xFF, 0x90, -0x83, 0x1D, 0x12, 0x42, 0x4A, 0x8F, 0x82, 0x75, 0x83, 0x00, 0x12, 0x1F, 0xBD, 0xFE, 0x74, 0xF0, -0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x02, 0xF5, 0x83, 0xEE, 0xF0, 0x0F, 0xEF, 0xB4, 0x10, 0xE0, 0x22, -0x90, 0x83, 0x31, 0xEF, 0xF0, 0x7F, 0x02, 0x12, 0x46, 0x53, 0x90, 0x80, 0x01, 0xE0, 0xFF, 0x90, -0x83, 0x31, 0xE0, 0xFE, 0xEF, 0x4E, 0x90, 0x80, 0x01, 0xF0, 0x22, 0x90, 0x83, 0x32, 0xEF, 0xF0, -0x7F, 0x02, 0x12, 0x46, 0x53, 0x90, 0x80, 0x02, 0xE0, 0xFF, 0x90, 0x83, 0x32, 0xE0, 0xFE, 0xEF, -0x4E, 0x90, 0x80, 0x02, 0xF0, 0x22, 0x12, 0x1F, 0xA4, 0xFF, 0x54, 0x80, 0xFE, 0x90, 0x82, 0x6E, -0xE0, 0x54, 0x7F, 0x4E, 0xFE, 0xF0, 0xEF, 0x54, 0x40, 0xFF, 0xEE, 0x54, 0xBF, 0x4F, 0xFF, 0xF0, -0x12, 0x1F, 0xA4, 0xFE, 0x54, 0x20, 0xFD, 0xEF, 0x54, 0xDF, 0x4D, 0xFF, 0x90, 0x82, 0x6E, 0xF0, -0xEE, 0x54, 0x10, 0xFE, 0xEF, 0x54, 0xEF, 0x4E, 0xFF, 0xF0, 0x12, 0x1F, 0xA4, 0x54, 0x0F, 0xFE, -0xEF, 0x54, 0xF0, 0x4E, 0x90, 0x82, 0x6E, 0xF0, 0x90, 0x00, 0x01, 0x12, 0x1F, 0xBD, 0x90, 0x82, -0x6F, 0xF0, 0x90, 0x00, 0x02, 0x12, 0x1F, 0xBD, 0x90, 0x82, 0x70, 0xF0, 0x90, 0x82, 0x6E, 0xE0, -0xFE, 0x54, 0x0F, 0xFF, 0xEE, 0xC4, 0x13, 0x13, 0x54, 0x03, 0x7D, 0x00, 0x20, 0xE0, 0x02, 0x7D, -0x01, 0x02, 0x52, 0x47, 0x12, 0x1F, 0xA4, 0xFF, 0x54, 0x7F, 0x90, 0x81, 0x3B, 0xF0, 0xEF, 0xC4, -0x13, 0x13, 0x13, 0x54, 0x01, 0xA3, 0xF0, 0x90, 0x00, 0x01, 0x12, 0x1F, 0xBD, 0xFF, 0x54, 0xF0, -0xC4, 0x54, 0x0F, 0xFE, 0x90, 0x81, 0x3A, 0xE0, 0x54, 0xF0, 0x4E, 0xF0, 0x90, 0x00, 0x03, 0x12, -0x1F, 0xBD, 0x54, 0x01, 0x25, 0xE0, 0xFE, 0x90, 0x81, 0x38, 0xE0, 0x54, 0xFD, 0x4E, 0xF0, 0x90, -0x81, 0x53, 0xE0, 0x30, 0xE0, 0x09, 0x90, 0x81, 0x3A, 0xE0, 0x54, 0x0F, 0xF0, 0x80, 0x0F, 0xEF, -0x54, 0x0F, 0xC4, 0x54, 0xF0, 0xFF, 0x90, 0x81, 0x3A, 0xE0, 0x54, 0x0F, 0x4F, 0xF0, 0x90, 0x00, -0x04, 0x12, 0x1F, 0xBD, 0x90, 0x81, 0x3D, 0xF0, 0x12, 0x5C, 0x93, 0x90, 0x01, 0xB9, 0x74, 0x01, -0xF0, 0x90, 0x01, 0xB8, 0xF0, 0x90, 0x81, 0x3B, 0xE0, 0x90, 0x01, 0xBA, 0xF0, 0x90, 0x81, 0x3D, -0xE0, 0x90, 0x01, 0xBB, 0xF0, 0x90, 0x81, 0x3A, 0xE0, 0x54, 0x0F, 0x90, 0x01, 0xBE, 0xF0, 0x22, -0x90, 0x01, 0xCC, 0xE0, 0x54, 0x0F, 0x90, 0x83, 0x33, 0xF0, 0x90, 0x83, 0x33, 0xE0, 0xFD, 0x70, -0x02, 0x81, 0xED, 0x90, 0x80, 0x5B, 0xE0, 0xFF, 0x70, 0x06, 0xA3, 0xE0, 0x64, 0x09, 0x60, 0x0A, -0xEF, 0x14, 0xFF, 0x90, 0x80, 0x5C, 0xE0, 0xB5, 0x07, 0x04, 0x7F, 0x01, 0x80, 0x02, 0x7F, 0x00, -0xEF, 0x60, 0x08, 0x90, 0x01, 0xC1, 0xE0, 0x44, 0x01, 0xF0, 0x22, 0x90, 0x83, 0x23, 0xE0, 0xFF, -0x74, 0x01, 0x7E, 0x00, 0xA8, 0x07, 0x08, 0x80, 0x05, 0xC3, 0x33, 0xCE, 0x33, 0xCE, 0xD8, 0xF9, -0xFF, 0xEF, 0x5D, 0x70, 0x02, 0x81, 0xE6, 0x90, 0x83, 0x23, 0xE0, 0x75, 0xF0, 0x04, 0x90, 0x01, -0xD0, 0x12, 0x42, 0x3E, 0xE0, 0xFF, 0x90, 0x80, 0x5C, 0xE0, 0xFE, 0x75, 0xF0, 0x08, 0x90, 0x80, -0x0B, 0x12, 0x42, 0x3E, 0xEF, 0xF0, 0x90, 0x83, 0x23, 0xE0, 0x75, 0xF0, 0x04, 0x90, 0x01, 0xD1, -0x12, 0x42, 0x3E, 0xE0, 0xFF, 0x75, 0xF0, 0x08, 0xEE, 0x90, 0x80, 0x0C, 0x12, 0x42, 0x3E, 0xEF, -0xF0, 0x90, 0x83, 0x23, 0xE0, 0x75, 0xF0, 0x04, 0x90, 0x01, 0xD2, 0x12, 0x42, 0x3E, 0xE0, 0xFF, -0x75, 0xF0, 0x08, 0xEE, 0x90, 0x80, 0x0D, 0x12, 0x42, 0x3E, 0xEF, 0xF0, 0x90, 0x83, 0x23, 0xE0, -0x75, 0xF0, 0x04, 0x90, 0x01, 0xD3, 0x12, 0x42, 0x3E, 0xE0, 0xFF, 0x75, 0xF0, 0x08, 0xEE, 0x90, -0x80, 0x0E, 0x12, 0x42, 0x3E, 0xEF, 0xF0, 0x90, 0x83, 0x23, 0xE0, 0x75, 0xF0, 0x04, 0x90, 0x01, -0xF0, 0x12, 0x42, 0x3E, 0xE0, 0xFF, 0x75, 0xF0, 0x08, 0xEE, 0x90, 0x80, 0x0F, 0x12, 0x42, 0x3E, -0xEF, 0xF0, 0x90, 0x83, 0x23, 0xE0, 0x75, 0xF0, 0x04, 0x90, 0x01, 0xF1, 0x12, 0x42, 0x3E, 0xE0, -0xFF, 0x75, 0xF0, 0x08, 0xEE, 0x90, 0x80, 0x10, 0x12, 0x42, 0x3E, 0xEF, 0xF0, 0x90, 0x83, 0x23, -0xE0, 0x75, 0xF0, 0x04, 0x90, 0x01, 0xF2, 0x12, 0x42, 0x3E, 0xE0, 0xFF, 0x75, 0xF0, 0x08, 0xEE, -0x90, 0x80, 0x11, 0x12, 0x42, 0x3E, 0xEF, 0xF0, 0x90, 0x83, 0x23, 0xE0, 0x75, 0xF0, 0x04, 0x90, -0x01, 0xF3, 0x12, 0x42, 0x3E, 0xE0, 0xFF, 0x75, 0xF0, 0x08, 0xEE, 0x90, 0x80, 0x12, 0x12, 0x42, -0x3E, 0xEF, 0xF0, 0x90, 0x83, 0x33, 0xE0, 0xFF, 0x90, 0x83, 0x23, 0xE0, 0xFE, 0x74, 0x01, 0xA8, -0x06, 0x08, 0x80, 0x02, 0xC3, 0x33, 0xD8, 0xFC, 0xF4, 0x5F, 0x90, 0x83, 0x33, 0xF0, 0x90, 0x83, -0x23, 0xE0, 0xFF, 0x74, 0x01, 0xA8, 0x07, 0x08, 0x80, 0x02, 0xC3, 0x33, 0xD8, 0xFC, 0x90, 0x01, -0xCC, 0xF0, 0x90, 0x83, 0x23, 0xE0, 0x04, 0xF0, 0xE0, 0x54, 0x03, 0xF0, 0x90, 0x80, 0x5C, 0xE0, -0x04, 0xF0, 0xE0, 0x7F, 0x00, 0xB4, 0x0A, 0x02, 0x7F, 0x01, 0xEF, 0x70, 0x02, 0x61, 0x6A, 0xE4, -0x90, 0x80, 0x5C, 0xF0, 0x61, 0x6A, 0x90, 0x01, 0xC0, 0xE0, 0x44, 0x02, 0xF0, 0x22, 0xD3, 0x10, -0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0x83, 0x0D, 0xEE, 0xF0, 0xA3, 0xEF, 0xF0, 0xE4, 0xA3, 0xF0, -0xA3, 0xF0, 0x90, 0x83, 0x0D, 0xE0, 0xFE, 0xA3, 0xE0, 0xF5, 0x82, 0x8E, 0x83, 0xE0, 0x60, 0x2D, -0xC3, 0x90, 0x83, 0x10, 0xE0, 0x94, 0xE8, 0x90, 0x83, 0x0F, 0xE0, 0x94, 0x03, 0x40, 0x0B, 0x90, -0x01, 0xC0, 0xE0, 0x44, 0x80, 0xF0, 0x7F, 0x00, 0x80, 0x15, 0x90, 0x83, 0x0F, 0xE4, 0x75, 0xF0, -0x01, 0x12, 0x41, 0xF6, 0x7F, 0x0A, 0x7E, 0x00, 0x12, 0x32, 0xAA, 0x80, 0xC5, 0x7F, 0x01, 0xD0, -0xD0, 0x92, 0xAF, 0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0x83, 0x20, 0x12, 0x42, -0x53, 0x90, 0x83, 0x24, 0xE0, 0xFF, 0x04, 0xF0, 0x90, 0x00, 0x01, 0xEF, 0x12, 0x1F, 0xFC, 0x7F, -0xAF, 0x7E, 0x01, 0x91, 0xEE, 0xEF, 0x60, 0x3A, 0x90, 0x83, 0x20, 0x12, 0x42, 0x4A, 0x8B, 0x13, -0x8A, 0x14, 0x89, 0x15, 0x90, 0x00, 0x0E, 0x12, 0x1F, 0xBD, 0x24, 0x02, 0xF5, 0x16, 0x7B, 0x01, -0x7A, 0x01, 0x79, 0xA0, 0x12, 0x2B, 0xED, 0x90, 0x83, 0x20, 0x12, 0x42, 0x4A, 0x90, 0x00, 0x0E, -0x12, 0x1F, 0xBD, 0x90, 0x01, 0xAE, 0xF0, 0xA3, 0x74, 0xFF, 0xF0, 0x90, 0x01, 0xCB, 0xE0, 0x64, -0x80, 0xF0, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0x80, -0xF3, 0xE0, 0xFF, 0x70, 0x06, 0xA3, 0xE0, 0x64, 0x09, 0x60, 0x0A, 0xEF, 0x14, 0xFF, 0x90, 0x80, -0xF4, 0xE0, 0xB5, 0x07, 0x04, 0x7F, 0x01, 0x80, 0x02, 0x7F, 0x00, 0xEF, 0x60, 0x09, 0x90, 0x01, -0xC1, 0xE0, 0x44, 0x02, 0xF0, 0x80, 0x35, 0xC0, 0x01, 0x90, 0x80, 0xF4, 0xE0, 0x75, 0xF0, 0x0F, -0xA4, 0x24, 0x5D, 0xF9, 0x74, 0x80, 0x35, 0xF0, 0xA8, 0x01, 0xFC, 0x7D, 0x01, 0xD0, 0x01, 0x7E, -0x00, 0x7F, 0x0F, 0x12, 0x41, 0xD0, 0x90, 0x80, 0xF4, 0xE0, 0x04, 0xF0, 0xE0, 0x7F, 0x00, 0xB4, -0x0A, 0x02, 0x7F, 0x01, 0xEF, 0x60, 0x05, 0xE4, 0x90, 0x80, 0xF4, 0xF0, 0xD0, 0xD0, 0x92, 0xAF, -0x22, 0x90, 0x01, 0x34, 0xE0, 0x55, 0x3D, 0xF5, 0x41, 0xA3, 0xE0, 0x55, 0x3E, 0xF5, 0x42, 0xA3, -0xE0, 0x55, 0x3F, 0xF5, 0x43, 0xA3, 0xE0, 0x55, 0x40, 0xF5, 0x44, 0x90, 0x01, 0x34, 0xE5, 0x41, -0xF0, 0xA3, 0xE5, 0x42, 0xF0, 0xA3, 0xE5, 0x43, 0xF0, 0xA3, 0xE5, 0x44, 0xF0, 0x22, 0x90, 0x01, -0x3C, 0xE0, 0x55, 0x45, 0xF5, 0x49, 0xA3, 0xE0, 0x55, 0x46, 0xF5, 0x4A, 0xA3, 0xE0, 0x55, 0x47, -0xF5, 0x4B, 0xA3, 0xE0, 0x55, 0x48, 0xF5, 0x4C, 0x90, 0x01, 0x3C, 0xE5, 0x49, 0xF0, 0xA3, 0xE5, -0x4A, 0xF0, 0xA3, 0xE5, 0x4B, 0xF0, 0xA3, 0xE5, 0x4C, 0xF0, 0x53, 0x91, 0xDF, 0x22, 0x8F, 0x52, -0x7F, 0x02, 0x12, 0x46, 0x53, 0x90, 0x80, 0x02, 0xE0, 0x45, 0x52, 0xF0, 0x22, 0xD1, 0xD5, 0x90, -0x82, 0x72, 0xEF, 0xF0, 0x90, 0x81, 0x38, 0x30, 0xE0, 0x06, 0xE0, 0x44, 0x01, 0xF0, 0x80, 0x04, -0xE0, 0x54, 0xFE, 0xF0, 0x90, 0x82, 0x72, 0xE0, 0x30, 0xE6, 0x11, 0x90, 0x01, 0x2F, 0xE0, 0x30, -0xE7, 0x04, 0xE4, 0xF0, 0x80, 0x06, 0x90, 0x01, 0x2F, 0x74, 0x80, 0xF0, 0x90, 0x81, 0x38, 0xE0, -0x30, 0xE0, 0x1A, 0x90, 0x81, 0x46, 0xE4, 0xF0, 0xA3, 0x74, 0x07, 0xF0, 0x90, 0x81, 0x46, 0xA3, -0xE0, 0x90, 0x05, 0x58, 0xF0, 0x90, 0x04, 0xEC, 0xE0, 0x54, 0xDD, 0xF0, 0x22, 0x90, 0x04, 0xEC, -0xE0, 0x44, 0x22, 0xF0, 0x22, 0xE4, 0x90, 0x82, 0x73, 0xF0, 0xA3, 0xF0, 0xA3, 0xF0, 0x90, 0x00, -0x83, 0xE0, 0x90, 0x82, 0x73, 0xF0, 0x90, 0x00, 0x83, 0xE0, 0xFE, 0x90, 0x82, 0x73, 0xE0, 0xFF, -0xB5, 0x06, 0x01, 0x22, 0xC3, 0x90, 0x82, 0x75, 0xE0, 0x94, 0x64, 0x90, 0x82, 0x74, 0xE0, 0x94, -0x00, 0x40, 0x0D, 0x90, 0x01, 0xC0, 0xE0, 0x44, 0x40, 0xF0, 0x90, 0x82, 0x73, 0xE0, 0xFF, 0x22, -0x90, 0x82, 0x74, 0xE4, 0x75, 0xF0, 0x01, 0x12, 0x41, 0xF6, 0x80, 0xC2, 0x90, 0x81, 0x38, 0xE0, -0xFF, 0xC4, 0x13, 0x13, 0x13, 0x54, 0x01, 0x30, 0xE0, 0x2C, 0xEF, 0x54, 0x7F, 0xF0, 0x90, 0x04, -0xE0, 0xE0, 0x90, 0x81, 0x39, 0x30, 0xE1, 0x06, 0xE0, 0x44, 0x02, 0xF0, 0x80, 0x0F, 0xE0, 0x54, -0xFD, 0xF0, 0x90, 0x01, 0xB9, 0x74, 0x01, 0xF0, 0x90, 0x01, 0xB8, 0x04, 0xF0, 0x90, 0x81, 0x3B, -0xE0, 0x60, 0x03, 0x12, 0x4E, 0x3A, 0x7F, 0x01, 0x02, 0x51, 0x2A, 0xD3, 0x10, 0xAF, 0x01, 0xC3, -0xC0, 0xD0, 0x90, 0x04, 0x1D, 0xE0, 0x60, 0x1A, 0x90, 0x05, 0x22, 0xE0, 0x54, 0x90, 0x60, 0x07, -0x90, 0x01, 0xC0, 0xE0, 0x44, 0x08, 0xF0, 0x90, 0x01, 0xC6, 0xE0, 0x30, 0xE1, 0xE4, 0x7F, 0x00, -0x80, 0x02, 0x7F, 0x01, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0xC3, 0xEE, 0x94, 0x01, 0x40, 0x0A, 0x0D, -0xED, 0x13, 0x90, 0xFD, 0x10, 0xF0, 0xE4, 0x2F, 0xFF, 0x22, 0xC3, 0xEE, 0x94, 0x01, 0x40, 0x1E, -0x90, 0xFD, 0x11, 0xE0, 0xB5, 0x05, 0x14, 0x90, 0x01, 0x17, 0xE0, 0xB5, 0x05, 0x07, 0x90, 0xFD, -0x11, 0xE4, 0xF0, 0x80, 0x06, 0xED, 0x04, 0x90, 0xFD, 0x11, 0xF0, 0xE4, 0x2F, 0xFF, 0x22, 0xE4, -0x90, 0x83, 0x29, 0xF0, 0xA3, 0xF0, 0x90, 0x05, 0xF8, 0xE0, 0x70, 0x0F, 0xA3, 0xE0, 0x70, 0x0B, -0xA3, 0xE0, 0x70, 0x07, 0xA3, 0xE0, 0x70, 0x03, 0x7F, 0x01, 0x22, 0xD3, 0x90, 0x83, 0x2A, 0xE0, -0x94, 0xE8, 0x90, 0x83, 0x29, 0xE0, 0x94, 0x03, 0x40, 0x0A, 0x90, 0x01, 0xC0, 0xE0, 0x44, 0x20, -0xF0, 0x7F, 0x00, 0x22, 0x7F, 0x32, 0x7E, 0x00, 0x12, 0x32, 0xAA, 0x90, 0x83, 0x29, 0xE4, 0x75, -0xF0, 0x01, 0x12, 0x41, 0xF6, 0x80, 0xBF, 0x74, 0x45, 0x2F, 0xF8, 0xE6, 0xFE, 0xED, 0xF4, 0x5E, -0xFE, 0xF6, 0x74, 0x38, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x01, 0xF5, 0x83, 0xEE, 0xF0, 0x22, 0x90, -0x82, 0xC0, 0xEE, 0xF0, 0xA3, 0xEF, 0xF0, 0x12, 0x2D, 0x5C, 0x90, 0x82, 0xCA, 0x12, 0x20, 0xCE, -0x90, 0x82, 0xC2, 0x12, 0x42, 0x26, 0x12, 0x20, 0x9B, 0x90, 0x82, 0xCA, 0x12, 0x42, 0x32, 0x12, -0x42, 0x0C, 0xC0, 0x04, 0xC0, 0x05, 0xC0, 0x06, 0xC0, 0x07, 0x90, 0x82, 0xC2, 0x12, 0x42, 0x26, -0x90, 0x82, 0xC6, 0x12, 0x42, 0x32, 0x12, 0x42, 0x0C, 0xD0, 0x03, 0xD0, 0x02, 0xD0, 0x01, 0xD0, -0x00, 0x12, 0x42, 0x19, 0x90, 0x82, 0xCE, 0x12, 0x20, 0xCE, 0x90, 0x82, 0xCE, 0x12, 0x42, 0x26, -0x90, 0x85, 0xBB, 0x12, 0x20, 0xCE, 0x90, 0x82, 0xC0, 0xE0, 0xFE, 0xA3, 0xE0, 0xFF, 0x02, 0x2E, -0xA2, 0xE4, 0x90, 0x81, 0x3B, 0xF0, 0xA3, 0xF0, 0x90, 0x81, 0x3A, 0xE0, 0x54, 0x0F, 0xF0, 0x54, -0xF0, 0xF0, 0x90, 0x81, 0x38, 0xE0, 0x54, 0xFD, 0xF0, 0x54, 0xF7, 0xF0, 0x90, 0x81, 0x41, 0x74, -0x01, 0xF0, 0xA3, 0xF0, 0x90, 0x81, 0x38, 0xE0, 0x54, 0xFB, 0xF0, 0xA3, 0xE0, 0x54, 0xFB, 0xF0, -0xE4, 0x90, 0x81, 0x44, 0xF0, 0x90, 0x81, 0x43, 0x74, 0x07, 0xF0, 0x90, 0x81, 0x46, 0xE4, 0xF0, -0xA3, 0x74, 0x02, 0xF0, 0xE4, 0x90, 0x81, 0x3F, 0xF0, 0x90, 0x81, 0x38, 0xE0, 0x54, 0xFE, 0xF0, -0x90, 0x81, 0x3D, 0x74, 0x0C, 0xF0, 0x90, 0x81, 0x38, 0xE0, 0x54, 0xDF, 0xF0, 0x90, 0x81, 0x3E, -0x74, 0x0C, 0xF0, 0x90, 0x81, 0x38, 0xE0, 0x54, 0xBF, 0xF0, 0x54, 0x7F, 0xF0, 0xA3, 0xE0, 0x54, -0xFE, 0xF0, 0x54, 0xFD, 0xF0, 0x54, 0xF7, 0xF0, 0x90, 0x81, 0x48, 0x12, 0x20, 0xDA, 0x00, 0x00, -0x00, 0x00, 0x90, 0x80, 0x05, 0xE0, 0xB4, 0x01, 0x08, 0x90, 0x81, 0x45, 0x74, 0x99, 0xF0, 0x80, -0x12, 0x90, 0x80, 0x05, 0xE0, 0x90, 0x81, 0x45, 0xB4, 0x03, 0x05, 0x74, 0x90, 0xF0, 0x80, 0x03, -0x74, 0x40, 0xF0, 0x90, 0x81, 0x4C, 0x74, 0x01, 0xF0, 0xA3, 0x74, 0x05, 0xF0, 0xA3, 0xE0, 0x54, -0x01, 0x44, 0x28, 0xF0, 0xA3, 0x74, 0x05, 0xF0, 0xE4, 0xA3, 0xF0, 0xA3, 0xE0, 0x54, 0xFD, 0xF0, -0x54, 0xFB, 0xF0, 0x54, 0xF7, 0xF0, 0x54, 0xEF, 0xF0, 0x54, 0xDF, 0xF0, 0x54, 0xBF, 0xF0, 0xE4, -0xA3, 0xF0, 0x22, 0x90, 0x81, 0x38, 0xE0, 0x54, 0xFB, 0xF0, 0xE4, 0x90, 0x81, 0x44, 0xF0, 0x90, -0x81, 0x3F, 0xF0, 0x22, 0x90, 0x04, 0x1A, 0xE0, 0xF4, 0x60, 0x03, 0x7F, 0x00, 0x22, 0x90, 0x04, -0x1B, 0xE0, 0x54, 0x07, 0x64, 0x07, 0x7F, 0x01, 0x60, 0x02, 0x7F, 0x00, 0x22, 0x31, 0x64, 0xEF, -0x64, 0x01, 0x60, 0x08, 0x90, 0x01, 0xB8, 0x74, 0x01, 0xF0, 0x80, 0x67, 0x90, 0x81, 0x3F, 0xE0, -0xFF, 0x54, 0x03, 0x60, 0x08, 0x90, 0x01, 0xB8, 0x74, 0x02, 0xF0, 0x80, 0x56, 0x90, 0x81, 0x3D, -0xE0, 0xFE, 0xE4, 0xC3, 0x9E, 0x50, 0x08, 0x90, 0x01, 0xB8, 0x74, 0x04, 0xF0, 0x80, 0x44, 0xEF, -0x30, 0xE2, 0x08, 0x90, 0x01, 0xB8, 0x74, 0x08, 0xF0, 0x80, 0x38, 0x90, 0x81, 0x3F, 0xE0, 0x30, -0xE4, 0x08, 0x90, 0x01, 0xB8, 0x74, 0x10, 0xF0, 0x80, 0x29, 0x90, 0x81, 0x39, 0xE0, 0x13, 0x13, -0x54, 0x3F, 0x20, 0xE0, 0x08, 0x90, 0x01, 0xB8, 0x74, 0x20, 0xF0, 0x80, 0x16, 0x90, 0x81, 0x52, -0xE0, 0x60, 0x08, 0x90, 0x01, 0xB8, 0x74, 0x80, 0xF0, 0x80, 0x08, 0x90, 0x01, 0xB8, 0xE4, 0xF0, -0x7F, 0x01, 0x22, 0x90, 0x01, 0xB9, 0x74, 0x04, 0xF0, 0x7F, 0x00, 0x22, 0xEF, 0x24, 0xFE, 0x60, -0x0C, 0x04, 0x70, 0x28, 0x90, 0x81, 0x41, 0x74, 0x01, 0xF0, 0xA3, 0xF0, 0x22, 0xED, 0x70, 0x0A, -0x90, 0x81, 0x4F, 0xE0, 0x90, 0x81, 0x41, 0xF0, 0x80, 0x05, 0x90, 0x81, 0x41, 0xED, 0xF0, 0x90, -0x81, 0x41, 0xE0, 0xA3, 0xF0, 0x90, 0x81, 0x39, 0xE0, 0x44, 0x08, 0xF0, 0x22, 0xEF, 0x60, 0x3E, -0x90, 0x80, 0xF7, 0xE0, 0x64, 0x01, 0x70, 0x36, 0x90, 0x81, 0x39, 0xE0, 0x54, 0xFE, 0xF0, 0x90, -0x05, 0x22, 0x74, 0x0F, 0xF0, 0x90, 0x06, 0x04, 0xE0, 0x54, 0xBF, 0xF0, 0xE4, 0xFF, 0x12, 0x4C, -0x52, 0xBF, 0x01, 0x0E, 0x90, 0x81, 0x38, 0xE0, 0x44, 0x40, 0xF0, 0x90, 0x81, 0x3E, 0x74, 0x06, -0xF0, 0x22, 0x90, 0x01, 0xB9, 0x74, 0x01, 0xF0, 0x90, 0x01, 0xB8, 0x74, 0x08, 0xF0, 0x22, 0x90, -0x05, 0x22, 0xE4, 0xF0, 0x90, 0x81, 0x3E, 0x74, 0x04, 0xF0, 0x22, 0x90, 0x81, 0x3B, 0xE0, 0x60, -0x2F, 0x90, 0x80, 0xF7, 0xE0, 0x64, 0x01, 0x70, 0x27, 0x90, 0x81, 0x42, 0xF0, 0x04, 0x60, 0x20, -0x90, 0x81, 0x3F, 0xE0, 0x44, 0x10, 0xF0, 0xE4, 0xF5, 0x1D, 0x90, 0x81, 0x43, 0x12, 0x4E, 0xD3, -0x90, 0x01, 0x57, 0x74, 0x05, 0xF0, 0x90, 0x81, 0x3E, 0xE0, 0x20, 0xE2, 0x03, 0x12, 0x49, 0x10, -0x22, 0x90, 0x81, 0x38, 0xE0, 0xFF, 0x13, 0x13, 0x54, 0x3F, 0x30, 0xE0, 0x11, 0xEF, 0x54, 0xFB, -0xF0, 0x90, 0x81, 0x3F, 0xE0, 0x54, 0xFD, 0xF0, 0x54, 0x07, 0x70, 0x42, 0x80, 0x3D, 0x90, 0x81, -0x44, 0xE0, 0x04, 0xF0, 0x90, 0x81, 0x3F, 0xE0, 0x54, 0xEF, 0xF0, 0x90, 0x81, 0x44, 0xE0, 0xFF, -0xB4, 0x01, 0x02, 0x80, 0x04, 0xEF, 0xB4, 0x02, 0x06, 0x90, 0x05, 0x58, 0xE0, 0x04, 0xF0, 0x90, -0x81, 0x4C, 0xE0, 0xFF, 0x90, 0x81, 0x44, 0xE0, 0xD3, 0x9F, 0x40, 0x0F, 0x90, 0x80, 0xF7, 0xE0, -0xB4, 0x01, 0x0B, 0x90, 0x81, 0x39, 0xE0, 0x54, 0xFB, 0xF0, 0x22, 0x12, 0x4E, 0x3A, 0x22, 0x90, -0x80, 0x08, 0xE0, 0xFE, 0x90, 0x04, 0x1C, 0xE0, 0x6E, 0x70, 0x40, 0x90, 0x81, 0x3E, 0xE0, 0xFE, -0xB4, 0x0E, 0x18, 0xEF, 0x70, 0x35, 0x90, 0x81, 0x38, 0xE0, 0x54, 0x7F, 0xF0, 0x90, 0x06, 0x04, -0xE0, 0x54, 0x7F, 0xF0, 0x90, 0x81, 0x3E, 0x74, 0x0C, 0xF0, 0x22, 0xEE, 0x64, 0x06, 0x70, 0x1B, -0xEF, 0x60, 0x18, 0x90, 0x81, 0x38, 0xE0, 0x54, 0xBF, 0xF0, 0x90, 0x06, 0x04, 0xE0, 0x44, 0x40, -0xF0, 0xE0, 0x44, 0x80, 0xF0, 0x90, 0x81, 0x3E, 0x74, 0x04, 0xF0, 0x22, 0x90, 0x82, 0x65, 0xE0, -0x54, 0xFE, 0xF0, 0x54, 0x7F, 0xF0, 0xA3, 0x74, 0x0A, 0xF0, 0xE4, 0xA3, 0xF0, 0x22, 0x7D, 0x7F, -0xEF, 0x5D, 0xC3, 0x60, 0x14, 0x74, 0xFF, 0x9D, 0xFD, 0x74, 0xFF, 0x94, 0x00, 0x5E, 0xFE, 0xED, -0x5F, 0x24, 0x80, 0xFF, 0xE4, 0x3E, 0xFE, 0x80, 0x0D, 0x74, 0xFF, 0x9D, 0xFD, 0x74, 0xFF, 0x94, -0x00, 0x5E, 0xFE, 0xED, 0x5F, 0xFF, 0x22, 0x90, 0x01, 0x1F, 0xE0, 0xFE, 0x90, 0x01, 0x1E, 0xE0, -0x7C, 0x00, 0x24, 0x00, 0xFF, 0xEC, 0x3E, 0x90, 0x82, 0x7E, 0xF0, 0xA3, 0xEF, 0xF0, 0x90, 0x02, -0x87, 0xE0, 0x90, 0x82, 0x82, 0xF0, 0x90, 0x81, 0x53, 0xE0, 0x20, 0xE0, 0x02, 0x81, 0x8F, 0x90, -0x82, 0x82, 0xE0, 0xFF, 0xEC, 0xC3, 0x9F, 0x40, 0x02, 0x81, 0x8F, 0x90, 0x82, 0x7E, 0xE0, 0xFA, -0xA3, 0xE0, 0xFB, 0xEA, 0x90, 0xFD, 0x11, 0xF0, 0xAF, 0x03, 0xAD, 0x07, 0x74, 0x02, 0x2D, 0xF5, -0x82, 0xE4, 0x34, 0xFB, 0xF5, 0x83, 0xE0, 0x54, 0x0F, 0x33, 0x33, 0x33, 0x54, 0xF8, 0xF9, 0x74, -0x01, 0x2D, 0xF5, 0x82, 0xE4, 0x34, 0xFB, 0xF5, 0x83, 0xE0, 0xFE, 0x74, 0x00, 0x2D, 0xF5, 0x82, -0xE4, 0x34, 0xFB, 0xF5, 0x83, 0xE0, 0x7A, 0x00, 0x24, 0x00, 0xFF, 0xEA, 0x3E, 0x54, 0x3F, 0x90, -0x82, 0x80, 0xF0, 0xA3, 0xEF, 0xF0, 0x74, 0x03, 0x2D, 0xF5, 0x82, 0xE4, 0x34, 0xFB, 0xF5, 0x83, -0xE0, 0x54, 0x03, 0xFF, 0x7E, 0x00, 0xAD, 0x01, 0xED, 0x24, 0x18, 0xFB, 0xEA, 0x33, 0xCB, 0x2F, -0xFF, 0xEE, 0x3B, 0x90, 0x82, 0x80, 0x8F, 0xF0, 0x12, 0x41, 0xF6, 0x90, 0x82, 0x80, 0xE0, 0xFE, -0xA3, 0xE0, 0xFF, 0x71, 0x6E, 0x90, 0x82, 0x80, 0xEE, 0xF0, 0xA3, 0xEF, 0xF0, 0x90, 0x82, 0x7E, -0xEE, 0x8F, 0xF0, 0x12, 0x41, 0xF6, 0x90, 0x80, 0xF5, 0xE0, 0xFE, 0xA3, 0xE0, 0xFF, 0xD3, 0x90, -0x82, 0x7F, 0xE0, 0x9F, 0x90, 0x82, 0x7E, 0xE0, 0x9E, 0x40, 0x1B, 0x90, 0x80, 0xF6, 0xE0, 0x24, -0x01, 0xFF, 0x90, 0x80, 0xF5, 0xE0, 0x34, 0x00, 0xFE, 0xC3, 0x90, 0x82, 0x7F, 0xE0, 0x9F, 0xF0, -0x90, 0x82, 0x7E, 0xE0, 0x9E, 0xF0, 0x90, 0x82, 0x7E, 0x12, 0x57, 0xC5, 0x0C, 0x61, 0xBF, 0x22, -0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x12, 0x1F, 0xA4, 0xFC, 0x20, 0xE0, 0x05, 0x12, 0x5C, -0x70, 0xA1, 0x97, 0x12, 0x1F, 0xA4, 0xFF, 0x54, 0x01, 0xFE, 0x90, 0x81, 0x54, 0xE0, 0x54, 0xFE, -0x4E, 0xFE, 0xF0, 0xEF, 0x54, 0x02, 0xFF, 0xEE, 0x54, 0xFD, 0x4F, 0xFF, 0xF0, 0x12, 0x1F, 0xA4, -0xFE, 0x54, 0x04, 0xFD, 0xEF, 0x54, 0xFB, 0x4D, 0xFF, 0x90, 0x81, 0x54, 0xF0, 0xEE, 0x54, 0x08, -0xFE, 0xEF, 0x54, 0xF7, 0x4E, 0xFF, 0xF0, 0x12, 0x1F, 0xA4, 0xFE, 0x54, 0x10, 0xFD, 0xEF, 0x54, -0xEF, 0x4D, 0xFF, 0x90, 0x81, 0x54, 0xF0, 0xEE, 0x54, 0x20, 0xFE, 0xEF, 0x54, 0xDF, 0x4E, 0xFF, -0xF0, 0x12, 0x1F, 0xA4, 0xFE, 0x54, 0x40, 0xFD, 0xEF, 0x54, 0xBF, 0x4D, 0xFF, 0x90, 0x81, 0x54, -0xF0, 0xEE, 0x54, 0x80, 0xFE, 0xEF, 0x54, 0x7F, 0x4E, 0xF0, 0x90, 0x00, 0x01, 0x12, 0x1F, 0xBD, -0xFD, 0x54, 0x80, 0xFF, 0x90, 0x81, 0x55, 0xE0, 0x54, 0x7F, 0x4F, 0xF0, 0xEC, 0x13, 0x13, 0x54, -0x3F, 0x30, 0xE0, 0x07, 0x90, 0x06, 0x90, 0xE0, 0x44, 0x04, 0xF0, 0x12, 0x1F, 0xA4, 0x13, 0x13, -0x13, 0x54, 0x1F, 0x30, 0xE0, 0x07, 0x90, 0x06, 0x90, 0xE0, 0x44, 0x08, 0xF0, 0x90, 0x80, 0x05, -0xE0, 0x64, 0x02, 0x70, 0x44, 0x90, 0x81, 0x55, 0xE0, 0xFF, 0xC4, 0x13, 0x13, 0x13, 0x54, 0x01, -0x20, 0xE0, 0x36, 0xED, 0x54, 0x7F, 0xFE, 0xEF, 0x54, 0x80, 0x4E, 0x90, 0x81, 0x55, 0xF0, 0x90, -0x00, 0x02, 0x12, 0x1F, 0xBD, 0x90, 0x81, 0x56, 0xF0, 0x90, 0x81, 0x54, 0xE0, 0xC4, 0x13, 0x54, -0x07, 0x30, 0xE0, 0x09, 0xA3, 0xE0, 0x54, 0x7F, 0xFF, 0xE4, 0xFD, 0x80, 0x09, 0x90, 0x81, 0x55, -0xE0, 0x54, 0x7F, 0xFF, 0x7D, 0x01, 0x12, 0x52, 0x47, 0x90, 0x80, 0x05, 0xE0, 0xB4, 0x01, 0x07, -0x90, 0xFE, 0x10, 0xE0, 0x44, 0x04, 0xF0, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x90, 0x81, 0x58, 0xE0, -0xFF, 0x20, 0xE0, 0x07, 0x90, 0x01, 0x3F, 0xE0, 0x30, 0xE2, 0x14, 0xEF, 0x44, 0x01, 0x90, 0x81, -0x58, 0xF0, 0x90, 0x81, 0x54, 0xE0, 0xC4, 0x54, 0x0F, 0x20, 0xE0, 0x03, 0x7F, 0x00, 0x22, 0x7F, -0x01, 0x22, 0xEF, 0x90, 0x01, 0xC7, 0xB4, 0xA0, 0x05, 0x74, 0x04, 0xF0, 0x80, 0x03, 0x74, 0x08, -0xF0, 0x90, 0x81, 0x58, 0xE0, 0x44, 0x01, 0xF0, 0x22, 0xE4, 0xFE, 0xEF, 0x2E, 0x24, 0x04, 0xF5, -0x82, 0xE4, 0x34, 0xFB, 0xF5, 0x83, 0xE0, 0xFD, 0x74, 0x8B, 0x2E, 0xF5, 0x82, 0xE4, 0x34, 0x82, -0xF5, 0x83, 0xED, 0xF0, 0x0E, 0xEE, 0xB4, 0x06, 0xE2, 0x78, 0x59, 0x7C, 0x81, 0x7D, 0x01, 0x7B, -0x01, 0x7A, 0x82, 0x79, 0x8B, 0x7E, 0x00, 0x7F, 0x06, 0x12, 0x44, 0x08, 0xEF, 0x7F, 0x00, 0x70, -0x02, 0x7F, 0x01, 0x22, 0x90, 0x82, 0x8B, 0xEE, 0xF0, 0xA3, 0xEF, 0xF0, 0xA3, 0xED, 0xF0, 0x78, -0x94, 0x7C, 0x82, 0x7D, 0x01, 0x7B, 0xFF, 0x7A, 0x40, 0x79, 0xC0, 0x7E, 0x00, 0x7F, 0x06, 0x12, -0x41, 0xD0, 0x78, 0x9A, 0x7C, 0x82, 0x7D, 0x01, 0x7B, 0xFF, 0x7A, 0x40, 0x79, 0xC6, 0x7E, 0x00, -0x7F, 0x04, 0x12, 0x41, 0xD0, 0x78, 0x9E, 0x7C, 0x82, 0x7D, 0x01, 0x7B, 0xFF, 0x7A, 0x40, 0x79, -0xCA, 0x7E, 0x00, 0x7F, 0x04, 0x12, 0x41, 0xD0, 0x90, 0x82, 0x8D, 0xE0, 0xFF, 0x90, 0x82, 0x8C, -0xE0, 0x2F, 0xFF, 0x90, 0x82, 0x8B, 0xE0, 0x34, 0x00, 0xCF, 0x24, 0x06, 0xCF, 0x34, 0x00, 0xFE, -0xE4, 0xFD, 0x12, 0x56, 0x5F, 0xEF, 0x64, 0x08, 0x60, 0x02, 0xE1, 0xD9, 0x90, 0x82, 0x8D, 0xE0, -0xFF, 0x90, 0x82, 0x8C, 0xE0, 0x2F, 0xFF, 0x90, 0x82, 0x8B, 0xE0, 0x34, 0x00, 0xCF, 0x24, 0x07, -0xCF, 0x34, 0x00, 0xFE, 0xE4, 0xFD, 0x12, 0x56, 0x5F, 0xEF, 0x64, 0x06, 0x60, 0x02, 0xE1, 0xD9, -0x90, 0x82, 0xA2, 0xF0, 0x90, 0x82, 0xA2, 0xE0, 0xFF, 0xC3, 0x94, 0x06, 0x50, 0x20, 0x90, 0x82, -0x8C, 0xE0, 0x24, 0x0A, 0x12, 0x56, 0x4D, 0x90, 0x82, 0xA2, 0xE0, 0x24, 0x8E, 0xF5, 0x82, 0xE4, -0x34, 0x82, 0xF5, 0x83, 0xEF, 0xF0, 0x90, 0x82, 0xA2, 0xE0, 0x04, 0xF0, 0x80, 0xD6, 0xE4, 0x90, -0x82, 0xA2, 0xF0, 0x90, 0x82, 0xA2, 0xE0, 0xFF, 0xC3, 0x94, 0x06, 0x50, 0x2F, 0x90, 0x82, 0x8D, -0xE0, 0xFD, 0x90, 0x82, 0x8C, 0xE0, 0x2D, 0xFD, 0x90, 0x82, 0x8B, 0xE0, 0x34, 0x00, 0xCD, 0x24, -0x10, 0xCD, 0x12, 0x56, 0x52, 0x90, 0x82, 0xA2, 0xE0, 0x24, 0x94, 0xF5, 0x82, 0xE4, 0x34, 0x82, -0xF5, 0x83, 0xEF, 0xF0, 0x90, 0x82, 0xA2, 0xE0, 0x04, 0xF0, 0x80, 0xC7, 0xE4, 0x90, 0x82, 0xA2, -0xF0, 0x90, 0x82, 0xA2, 0xE0, 0xFF, 0xC3, 0x94, 0x04, 0x50, 0x2F, 0x90, 0x82, 0x8D, 0xE0, 0xFD, -0x90, 0x82, 0x8C, 0xE0, 0x2D, 0xFD, 0x90, 0x82, 0x8B, 0xE0, 0x34, 0x00, 0xCD, 0x24, 0x16, 0xCD, -0x12, 0x56, 0x52, 0x90, 0x82, 0xA2, 0xE0, 0x24, 0x9A, 0xF5, 0x82, 0xE4, 0x34, 0x82, 0xF5, 0x83, -0xEF, 0xF0, 0x90, 0x82, 0xA2, 0xE0, 0x04, 0xF0, 0x80, 0xC7, 0x78, 0x8E, 0x7C, 0x82, 0x7D, 0x01, -0x7B, 0x01, 0x7A, 0x81, 0x79, 0x5F, 0x7E, 0x00, 0x7F, 0x06, 0x12, 0x44, 0x08, 0xEF, 0x70, 0x79, -0x90, 0x82, 0xA2, 0xF0, 0x90, 0x82, 0xA2, 0xE0, 0xFF, 0xC3, 0x94, 0x04, 0x50, 0x2F, 0x90, 0x82, -0x8D, 0xE0, 0xFD, 0x90, 0x82, 0x8C, 0xE0, 0x2D, 0xFD, 0x90, 0x82, 0x8B, 0xE0, 0x34, 0x00, 0xCD, -0x24, 0x20, 0xCD, 0x12, 0x56, 0x52, 0x90, 0x82, 0xA2, 0xE0, 0x24, 0x9E, 0xF5, 0x82, 0xE4, 0x34, -0x82, 0xF5, 0x83, 0xEF, 0xF0, 0x90, 0x82, 0xA2, 0xE0, 0x04, 0xF0, 0x80, 0xC7, 0x78, 0x9E, 0x7C, -0x82, 0x7D, 0x01, 0x7B, 0x01, 0x7A, 0x81, 0x79, 0x6C, 0x7E, 0x00, 0x7F, 0x04, 0x12, 0x44, 0x08, -0xEF, 0x90, 0x06, 0x30, 0x70, 0x1D, 0xE0, 0x44, 0x01, 0x54, 0xDF, 0xF0, 0x7B, 0x01, 0x7A, 0x82, -0x79, 0x94, 0x90, 0x82, 0xA6, 0x12, 0x42, 0x53, 0xE4, 0x90, 0x82, 0xA9, 0xF0, 0x7A, 0x82, 0x79, -0x9A, 0x80, 0x07, 0xE0, 0x44, 0x21, 0x54, 0xEF, 0xF0, 0x22, 0x90, 0x82, 0xA3, 0x12, 0x42, 0x53, -0x90, 0x82, 0x58, 0xE0, 0xFF, 0x7D, 0x01, 0x12, 0x4D, 0xB7, 0x90, 0x82, 0xAA, 0x12, 0x5E, 0x75, -0x90, 0x82, 0xAC, 0xEF, 0xF0, 0x90, 0x82, 0xAA, 0xA3, 0xE0, 0x24, 0x20, 0xF9, 0xE4, 0x34, 0xFC, -0xFA, 0x7B, 0x01, 0x90, 0x82, 0xA9, 0xE0, 0xFD, 0x12, 0x5E, 0xAA, 0x90, 0x82, 0xAA, 0xA3, 0xE0, -0x24, 0x30, 0xF9, 0xE4, 0x34, 0xFC, 0xFA, 0x7B, 0x01, 0xC0, 0x03, 0xC0, 0x02, 0xC0, 0x01, 0x90, -0x82, 0xA6, 0x12, 0x42, 0x4A, 0x8B, 0x13, 0x8A, 0x14, 0x89, 0x15, 0x75, 0x16, 0x06, 0xD0, 0x01, -0xD0, 0x02, 0xD0, 0x03, 0x12, 0x2B, 0xED, 0x90, 0x82, 0xAA, 0xA3, 0xE0, 0xFF, 0xA3, 0xE0, 0x2F, -0x24, 0x3A, 0xF9, 0xE4, 0x34, 0xFC, 0xFA, 0x7B, 0x01, 0xC0, 0x03, 0xC0, 0x02, 0xC0, 0x01, 0x90, -0x82, 0xA6, 0x12, 0x42, 0x4A, 0x8B, 0x13, 0x8A, 0x14, 0x89, 0x15, 0x75, 0x16, 0x06, 0xD0, 0x01, -0xD0, 0x02, 0xD0, 0x03, 0x12, 0x2B, 0xED, 0x90, 0x82, 0xAA, 0xA3, 0xE0, 0xFF, 0xA3, 0xE0, 0x2F, -0x24, 0x40, 0xF9, 0xE4, 0x34, 0xFC, 0xFA, 0x7B, 0x01, 0xC0, 0x03, 0xC0, 0x02, 0xC0, 0x01, 0x90, -0x82, 0xA3, 0x12, 0x42, 0x4A, 0x8B, 0x13, 0x8A, 0x14, 0x89, 0x15, 0x75, 0x16, 0x04, 0xD0, 0x01, -0xD0, 0x02, 0xD0, 0x03, 0x12, 0x2B, 0xED, 0x90, 0x06, 0x30, 0xE0, 0x44, 0x10, 0xF0, 0x12, 0x6F, -0x5B, 0xBF, 0x01, 0x0E, 0x90, 0x82, 0x58, 0xE0, 0x90, 0x04, 0x25, 0xF0, 0x90, 0x04, 0x1F, 0x74, -0x20, 0xF0, 0x22, 0xE4, 0xFF, 0x74, 0x18, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x06, 0xF5, 0x83, 0xE0, -0xFE, 0x74, 0x5F, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x81, 0xF5, 0x83, 0xEE, 0xF0, 0x74, 0x10, 0x2F, -0xF5, 0x82, 0xE4, 0x34, 0x06, 0xF5, 0x83, 0xE0, 0xFE, 0x74, 0x59, 0x2F, 0xF5, 0x82, 0xE4, 0x34, -0x81, 0xF5, 0x83, 0xEE, 0xF0, 0x0F, 0xEF, 0xB4, 0x06, 0xCB, 0x22, 0x90, 0x82, 0x68, 0xE0, 0x30, -0xE0, 0x36, 0x90, 0x82, 0x6B, 0xE0, 0x04, 0xF0, 0xE0, 0xFF, 0x90, 0x82, 0x69, 0xE0, 0x6F, 0x70, -0x27, 0x90, 0x06, 0x92, 0xE0, 0x20, 0xE2, 0x11, 0x90, 0x82, 0x6D, 0xE0, 0x70, 0x0B, 0x12, 0x4F, -0xC5, 0x90, 0x82, 0x6C, 0xE0, 0x04, 0xF0, 0x80, 0x06, 0x90, 0x06, 0x92, 0x74, 0x04, 0xF0, 0xE4, -0x90, 0x82, 0x6B, 0xF0, 0x90, 0x82, 0x6D, 0xF0, 0x22, 0x90, 0x82, 0xE1, 0x12, 0x42, 0x53, 0x12, -0x1F, 0xA4, 0x90, 0x82, 0xE6, 0xF0, 0x90, 0x00, 0x01, 0x12, 0x1F, 0xBD, 0x90, 0x82, 0xE7, 0xF0, -0x90, 0x00, 0x04, 0x12, 0x1F, 0xBD, 0x90, 0x82, 0xE8, 0xF0, 0x90, 0x00, 0x05, 0x12, 0x1F, 0xBD, -0x90, 0x82, 0xE9, 0xF0, 0x90, 0x00, 0x06, 0x12, 0x1F, 0xBD, 0x90, 0x82, 0xEA, 0xF0, 0x90, 0x00, -0x07, 0x12, 0x1F, 0xBD, 0x90, 0x82, 0xEB, 0xF0, 0x90, 0x00, 0x03, 0x12, 0x1F, 0xBD, 0x90, 0x82, -0xEE, 0xF0, 0xED, 0x70, 0x31, 0xFF, 0x74, 0xE6, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x82, 0xF5, 0x83, -0xE0, 0xB4, 0xFF, 0x0E, 0x74, 0xE6, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x82, 0xF5, 0x83, 0xE4, 0xF0, -0x80, 0x0F, 0x74, 0xE6, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x82, 0xF5, 0x83, 0xE0, 0x04, 0xF0, 0x80, -0x05, 0x0F, 0xEF, 0xB4, 0x06, 0xD0, 0x90, 0x82, 0xE5, 0xE0, 0xFF, 0xB4, 0x04, 0x25, 0xA3, 0xE0, -0xFE, 0x90, 0x82, 0xE1, 0x12, 0x42, 0x4A, 0xEE, 0x12, 0x1F, 0xEA, 0x90, 0x82, 0xE7, 0xE0, 0xFE, -0x90, 0x82, 0xE1, 0x12, 0x42, 0x4A, 0x90, 0x00, 0x01, 0xEE, 0x12, 0x1F, 0xFC, 0x90, 0x00, 0x02, -0xE4, 0x80, 0x30, 0xEF, 0xB4, 0x02, 0x2F, 0x90, 0x82, 0xE7, 0xE0, 0xFF, 0x90, 0x82, 0xE1, 0x12, -0x42, 0x4A, 0xEF, 0x12, 0x1F, 0xEA, 0x90, 0x82, 0xE7, 0xE0, 0x44, 0x20, 0x54, 0x7F, 0xFF, 0x90, -0x82, 0xE1, 0x12, 0x42, 0x4A, 0x90, 0x00, 0x01, 0xEF, 0x12, 0x1F, 0xFC, 0x90, 0x82, 0xE6, 0xE0, -0x90, 0x00, 0x02, 0x12, 0x1F, 0xFC, 0x90, 0x82, 0xE1, 0x12, 0x42, 0x4A, 0xE9, 0x24, 0x03, 0xF9, -0xE4, 0x3A, 0xFA, 0x12, 0x1F, 0xA4, 0x44, 0x20, 0x12, 0x1F, 0xEA, 0x90, 0x82, 0xE8, 0xE0, 0xFF, -0x90, 0x82, 0xE1, 0x12, 0x42, 0x4A, 0x90, 0x00, 0x04, 0xEF, 0x12, 0x1F, 0xFC, 0x90, 0x82, 0xE9, -0xE0, 0x90, 0x00, 0x05, 0x12, 0x1F, 0xFC, 0x90, 0x82, 0xEA, 0xE0, 0x90, 0x00, 0x06, 0x12, 0x1F, -0xFC, 0x90, 0x82, 0xEB, 0xE0, 0x90, 0x00, 0x07, 0x02, 0x1F, 0xFC, 0x90, 0x82, 0xFC, 0xED, 0xF0, -0x90, 0x82, 0xF9, 0x12, 0x42, 0x53, 0x90, 0x00, 0x03, 0x12, 0x1F, 0xBD, 0x90, 0x83, 0x00, 0xF0, -0x90, 0x82, 0xF9, 0x12, 0x42, 0x4A, 0x8B, 0x13, 0x8A, 0x14, 0x89, 0x15, 0x75, 0x16, 0x03, 0x7B, -0x01, 0x7A, 0x82, 0x79, 0xFD, 0x12, 0x2B, 0xED, 0x90, 0x82, 0xFC, 0xE0, 0x70, 0x46, 0xFF, 0x74, -0xFD, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x82, 0xF5, 0x83, 0xE0, 0xB4, 0xFF, 0x0E, 0x74, 0xFD, 0x2F, -0xF5, 0x82, 0xE4, 0x34, 0x82, 0xF5, 0x83, 0xE4, 0xF0, 0x80, 0x0F, 0x74, 0xFD, 0x2F, 0xF5, 0x82, -0xE4, 0x34, 0x82, 0xF5, 0x83, 0xE0, 0x04, 0xF0, 0x80, 0x05, 0x0F, 0xEF, 0xB4, 0x03, 0xD0, 0x75, -0x13, 0x01, 0x75, 0x14, 0x82, 0x75, 0x15, 0xFD, 0x75, 0x16, 0x03, 0x90, 0x82, 0xF9, 0x12, 0x42, -0x4A, 0x12, 0x2B, 0xED, 0x22, 0x00, 0xDB, 0x90, -}; -#if 0 -u4Byte ArrayLength_8188E_FW_WoWLAN = 15554; - - -void -ODM_ReadFirmware_8188E_FW_WoWLAN( - IN PDM_ODM_T pDM_Odm, - OUT u1Byte *pFirmware, - OUT u4Byte *pFirmwareSize -) -{ - ODM_MoveMemory(pDM_Odm, pFirmware, Array_8188E_FW_WoWLAN, ArrayLength_8188E_FW_WoWLAN); - *pFirmwareSize = ArrayLength_8188E_FW_WoWLAN; -} - -#endif - -#endif // end of DM_ODM_SUPPORT_TYPE & (ODM_AP) - - -#endif // end of HWIMG_SUPPORT - +/****************************************************************************** +* +* 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 +* +* +******************************************************************************/ +#if 0 +#include "Mp_Precomp.h" +#endif +#include "../odm_precomp.h" + +#if (RTL8188E_SUPPORT == 1) +#if(DM_ODM_SUPPORT_TYPE & (ODM_AP)) + + +u1Byte Array_8188E_FW_AP[] = { + +}; +u4Byte ArrayLength_8188E_FW_AP = 0; + + +void +ODM_ReadFirmware_8188E_FW_AP( + IN PDM_ODM_T pDM_Odm, + OUT u1Byte *pFirmware, + OUT u4Byte *pFirmwareSize +) +{ + ODM_MoveMemory(pDM_Odm, pFirmware, Array_8188E_FW_AP, ArrayLength_8188E_FW_AP); + *pFirmwareSize = ArrayLength_8188E_FW_AP; +} + + +#else + +#if 0 +u1Byte Array_8188E_FW_NIC[] = { + +}; +u4Byte ArrayLength_8188E_FW_NIC = 0; + + +void +ODM_ReadFirmware_8188E_FW_NIC( + IN PDM_ODM_T pDM_Odm, + OUT u1Byte *pFirmware, + OUT u4Byte *pFirmwareSize +) +{ + ODM_MoveMemory(pDM_Odm, pFirmware, Array_8188E_FW_NIC, ArrayLength_8188E_FW_NIC); + *pFirmwareSize = ArrayLength_8188E_FW_NIC; +} +#endif + +const u8 Array_8188E_FW_WoWLAN[] = { +0xE1, 0x88, 0x30, 0x00, 0x0D, 0x00, 0x00, 0x00, 0x06, 0x27, 0x15, 0x23, 0xC8, 0x3A, 0x00, 0x00, +0x6E, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x02, 0x46, 0xD5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0xE1, 0xF8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0xE1, 0x6F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x4F, 0xE9, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0xE7, 0x09, 0xF6, 0x08, 0xDF, 0xFA, 0x80, 0x46, 0xE7, 0x09, 0xF2, 0x08, 0xDF, 0xFA, 0x80, 0x3E, +0x88, 0x82, 0x8C, 0x83, 0xE7, 0x09, 0xF0, 0xA3, 0xDF, 0xFA, 0x80, 0x32, 0xE3, 0x09, 0xF6, 0x08, +0xDF, 0xFA, 0x80, 0x78, 0xE3, 0x09, 0xF2, 0x08, 0xDF, 0xFA, 0x80, 0x70, 0x88, 0x82, 0x8C, 0x83, +0xE3, 0x09, 0xF0, 0xA3, 0xDF, 0xFA, 0x80, 0x64, 0x89, 0x82, 0x8A, 0x83, 0xE0, 0xA3, 0xF6, 0x08, +0xDF, 0xFA, 0x80, 0x58, 0x89, 0x82, 0x8A, 0x83, 0xE0, 0xA3, 0xF2, 0x08, 0xDF, 0xFA, 0x80, 0x4C, +0x80, 0xD2, 0x80, 0xFA, 0x80, 0xC6, 0x80, 0xD4, 0x80, 0x69, 0x80, 0xF2, 0x80, 0x33, 0x80, 0x10, +0x80, 0xA6, 0x80, 0xEA, 0x80, 0x9A, 0x80, 0xA8, 0x80, 0xDA, 0x80, 0xE2, 0x80, 0xCA, 0x80, 0x33, +0x89, 0x82, 0x8A, 0x83, 0xEC, 0xFA, 0xE4, 0x93, 0xA3, 0xC8, 0xC5, 0x82, 0xC8, 0xCC, 0xC5, 0x83, +0xCC, 0xF0, 0xA3, 0xC8, 0xC5, 0x82, 0xC8, 0xCC, 0xC5, 0x83, 0xCC, 0xDF, 0xE9, 0xDE, 0xE7, 0x80, +0x0D, 0x89, 0x82, 0x8A, 0x83, 0xE4, 0x93, 0xA3, 0xF6, 0x08, 0xDF, 0xF9, 0xEC, 0xFA, 0xA9, 0xF0, +0xED, 0xFB, 0x22, 0x89, 0x82, 0x8A, 0x83, 0xEC, 0xFA, 0xE0, 0xA3, 0xC8, 0xC5, 0x82, 0xC8, 0xCC, +0xC5, 0x83, 0xCC, 0xF0, 0xA3, 0xC8, 0xC5, 0x82, 0xC8, 0xCC, 0xC5, 0x83, 0xCC, 0xDF, 0xEA, 0xDE, +0xE8, 0x80, 0xDB, 0x89, 0x82, 0x8A, 0x83, 0xE4, 0x93, 0xA3, 0xF2, 0x08, 0xDF, 0xF9, 0x80, 0xCC, +0x88, 0xF0, 0xEF, 0x60, 0x01, 0x0E, 0x4E, 0x60, 0xC3, 0x88, 0xF0, 0xED, 0x24, 0x02, 0xB4, 0x04, +0x00, 0x50, 0xB9, 0xF5, 0x82, 0xEB, 0x24, 0x02, 0xB4, 0x04, 0x00, 0x50, 0xAF, 0x23, 0x23, 0x45, +0x82, 0x23, 0x90, 0x41, 0x50, 0x73, 0xC5, 0xF0, 0xF8, 0xA3, 0xE0, 0x28, 0xF0, 0xC5, 0xF0, 0xF8, +0xE5, 0x82, 0x15, 0x82, 0x70, 0x02, 0x15, 0x83, 0xE0, 0x38, 0xF0, 0x22, 0xEF, 0x5B, 0xFF, 0xEE, +0x5A, 0xFE, 0xED, 0x59, 0xFD, 0xEC, 0x58, 0xFC, 0x22, 0xEF, 0x4B, 0xFF, 0xEE, 0x4A, 0xFE, 0xED, +0x49, 0xFD, 0xEC, 0x48, 0xFC, 0x22, 0xE0, 0xFC, 0xA3, 0xE0, 0xFD, 0xA3, 0xE0, 0xFE, 0xA3, 0xE0, +0xFF, 0x22, 0xE0, 0xF8, 0xA3, 0xE0, 0xF9, 0xA3, 0xE0, 0xFA, 0xA3, 0xE0, 0xFB, 0x22, 0xA4, 0x25, +0x82, 0xF5, 0x82, 0xE5, 0xF0, 0x35, 0x83, 0xF5, 0x83, 0x22, 0xE0, 0xFB, 0xA3, 0xE0, 0xFA, 0xA3, +0xE0, 0xF9, 0x22, 0xEB, 0xF0, 0xA3, 0xEA, 0xF0, 0xA3, 0xE9, 0xF0, 0x22, 0xD0, 0x83, 0xD0, 0x82, +0xF8, 0xE4, 0x93, 0x70, 0x12, 0x74, 0x01, 0x93, 0x70, 0x0D, 0xA3, 0xA3, 0x93, 0xF8, 0x74, 0x01, +0x93, 0xF5, 0x82, 0x88, 0x83, 0xE4, 0x73, 0x74, 0x02, 0x93, 0x68, 0x60, 0xEF, 0xA3, 0xA3, 0xA3, +0x80, 0xDF, 0xE3, 0xF5, 0xF0, 0x09, 0xE2, 0x08, 0xB5, 0xF0, 0x6B, 0xDF, 0xF5, 0x80, 0x67, 0xE3, +0xF5, 0xF0, 0x09, 0xE6, 0x08, 0xB5, 0xF0, 0x5E, 0xDF, 0xF5, 0x80, 0x5A, 0x87, 0xF0, 0x09, 0xE6, +0x08, 0xB5, 0xF0, 0x52, 0xDF, 0xF6, 0x80, 0x4E, 0x87, 0xF0, 0x09, 0xE2, 0x08, 0xB5, 0xF0, 0x46, +0xDF, 0xF6, 0x80, 0x42, 0x88, 0x82, 0x8C, 0x83, 0x87, 0xF0, 0x09, 0xE0, 0xA3, 0xB5, 0xF0, 0x36, +0xDF, 0xF6, 0x80, 0x32, 0x88, 0x82, 0x8C, 0x83, 0x87, 0xF0, 0x09, 0xE4, 0x93, 0xA3, 0xB5, 0xF0, +0x25, 0xDF, 0xF5, 0x80, 0x21, 0x88, 0x82, 0x8C, 0x83, 0xE3, 0xF5, 0xF0, 0x09, 0xE0, 0xA3, 0xB5, +0xF0, 0x14, 0xDF, 0xF5, 0x80, 0x10, 0x88, 0x82, 0x8C, 0x83, 0xE3, 0xF5, 0xF0, 0x09, 0xE4, 0x93, +0xA3, 0xB5, 0xF0, 0x02, 0xDF, 0xF4, 0x02, 0x43, 0xB1, 0x80, 0x87, 0x80, 0xE9, 0x80, 0x90, 0x80, +0xD4, 0x80, 0x3E, 0x80, 0x15, 0x80, 0x6E, 0x80, 0x7E, 0x80, 0x9D, 0x80, 0xB7, 0x80, 0x8D, 0x80, +0xA3, 0x80, 0x51, 0x80, 0x74, 0x80, 0x3C, 0x02, 0x43, 0xBD, 0x89, 0x82, 0x8A, 0x83, 0xEC, 0xFA, +0xE4, 0x93, 0xF5, 0xF0, 0xA3, 0xC8, 0xC5, 0x82, 0xC8, 0xCC, 0xC5, 0x83, 0xCC, 0xE4, 0x93, 0xA3, +0xC8, 0xC5, 0x82, 0xC8, 0xCC, 0xC5, 0x83, 0xCC, 0xB5, 0xF0, 0x76, 0xDF, 0xE3, 0xDE, 0xE1, 0x80, +0x70, 0x89, 0x82, 0x8A, 0x83, 0xE4, 0x93, 0xF5, 0xF0, 0xA3, 0xE2, 0x08, 0xB5, 0xF0, 0x62, 0xDF, +0xF4, 0x80, 0x5E, 0x89, 0x82, 0x8A, 0x83, 0xE0, 0xF5, 0xF0, 0xA3, 0xE6, 0x08, 0xB5, 0xF0, 0x51, +0xDF, 0xF5, 0x80, 0x4D, 0x89, 0x82, 0x8A, 0x83, 0xE0, 0xF5, 0xF0, 0xA3, 0xE2, 0x08, 0xB5, 0xF0, +0x40, 0xDF, 0xF5, 0x80, 0x3C, 0x89, 0x82, 0x8A, 0x83, 0xE4, 0x93, 0xF5, 0xF0, 0xA3, 0xE6, 0x08, +0xB5, 0xF0, 0x2E, 0xDF, 0xF4, 0x80, 0x2A, 0x80, 0x02, 0x80, 0x57, 0x89, 0x82, 0x8A, 0x83, 0xEC, +0xFA, 0xE4, 0x93, 0xF5, 0xF0, 0xA3, 0xC8, 0xC5, 0x82, 0xC8, 0xCC, 0xC5, 0x83, 0xCC, 0xE0, 0xA3, +0xC8, 0xC5, 0x82, 0xC8, 0xCC, 0xC5, 0x83, 0xCC, 0xB5, 0xF0, 0x06, 0xDF, 0xE4, 0xDE, 0xE2, 0x80, +0x00, 0x7F, 0xFF, 0xB5, 0xF0, 0x02, 0x0F, 0x22, 0x40, 0x02, 0x7F, 0x01, 0x22, 0x89, 0x82, 0x8A, +0x83, 0xEC, 0xFA, 0xE0, 0xF5, 0xF0, 0xA3, 0xC8, 0xC5, 0x82, 0xC8, 0xCC, 0xC5, 0x83, 0xCC, 0xE0, +0xA3, 0xC8, 0xC5, 0x82, 0xC8, 0xCC, 0xC5, 0x83, 0xCC, 0xB5, 0xF0, 0xD5, 0xDF, 0xE5, 0xDE, 0xE3, +0x80, 0xCF, 0x89, 0x82, 0x8A, 0x83, 0xEC, 0xFA, 0xE0, 0xF5, 0xF0, 0xA3, 0xC8, 0xC5, 0x82, 0xC8, +0xCC, 0xC5, 0x83, 0xCC, 0xE4, 0x93, 0xA3, 0xC8, 0xC5, 0x82, 0xC8, 0xCC, 0xC5, 0x83, 0xCC, 0xB5, +0xF0, 0xAF, 0xDF, 0xE4, 0xDE, 0xE2, 0x80, 0xA9, 0x88, 0xF0, 0xEF, 0x60, 0x01, 0x0E, 0x4E, 0x60, +0xAB, 0xED, 0x24, 0x02, 0xB4, 0x04, 0x00, 0x50, 0x98, 0xF5, 0x82, 0xEB, 0x24, 0x02, 0xB4, 0x04, +0x00, 0x50, 0x8E, 0x23, 0x23, 0x45, 0x82, 0x23, 0x90, 0x42, 0xF9, 0x73, 0xC2, 0xAF, 0x80, 0xFE, +0x32, 0x12, 0x44, 0x30, 0x85, 0xD0, 0x0B, 0x75, 0xD0, 0x08, 0xAA, 0xE0, 0xC2, 0x8C, 0xE5, 0x8A, +0x24, 0x67, 0xF5, 0x8A, 0xE5, 0x8C, 0x34, 0x79, 0xF5, 0x8C, 0xD2, 0x8C, 0xEC, 0x24, 0x87, 0xF8, +0xE6, 0xBC, 0x02, 0x02, 0x74, 0xFF, 0xC3, 0x95, 0x81, 0xB4, 0x40, 0x00, 0x40, 0xCE, 0x79, 0x03, +0x78, 0x80, 0x16, 0xE6, 0x08, 0x70, 0x0B, 0xC2, 0xAF, 0xE6, 0x30, 0xE1, 0x03, 0x44, 0x18, 0xF6, +0xD2, 0xAF, 0x08, 0xD9, 0xED, 0xEA, 0x8B, 0xD0, 0x22, 0xE5, 0x0C, 0xFF, 0x23, 0x24, 0x81, 0xF8, +0x0F, 0x08, 0x08, 0xBF, 0x03, 0x04, 0x7F, 0x00, 0x78, 0x81, 0xE6, 0x30, 0xE4, 0xF2, 0x00, 0xE5, +0x0C, 0xC3, 0x9F, 0x50, 0x20, 0x05, 0x0C, 0x74, 0x86, 0x25, 0x0C, 0xF8, 0xE6, 0xFD, 0xA6, 0x81, +0x08, 0xE6, 0xAE, 0x0C, 0xBE, 0x02, 0x02, 0x74, 0xFF, 0xCD, 0xF8, 0xE8, 0x6D, 0x60, 0xE0, 0x08, +0xE6, 0xC0, 0xE0, 0x80, 0xF6, 0xE5, 0x0C, 0xD3, 0x9F, 0x40, 0x27, 0xE5, 0x0C, 0x24, 0x87, 0xF8, +0xE6, 0xAE, 0x0C, 0xBE, 0x02, 0x02, 0x74, 0xFF, 0xFD, 0x18, 0xE6, 0xCD, 0xF8, 0xE5, 0x81, 0x6D, +0x60, 0x06, 0xD0, 0xE0, 0xF6, 0x18, 0x80, 0xF5, 0xE5, 0x0C, 0x24, 0x86, 0xC8, 0xF6, 0x15, 0x0C, +0x80, 0xD3, 0xE5, 0x0C, 0x23, 0x24, 0x81, 0xF8, 0x7F, 0x04, 0xC2, 0xAF, 0xE6, 0x30, 0xE0, 0x03, +0x10, 0xE2, 0x0C, 0x7F, 0x00, 0x30, 0xE1, 0x07, 0x30, 0xE3, 0x04, 0x7F, 0x08, 0x54, 0xF4, 0x54, +0x7C, 0xC6, 0xD2, 0xAF, 0x54, 0x80, 0x42, 0x07, 0x22, 0x78, 0x86, 0xA6, 0x81, 0x74, 0x02, 0x60, +0x06, 0xFF, 0x08, 0x76, 0xFF, 0xDF, 0xFB, 0x7F, 0x03, 0xE4, 0x78, 0x80, 0xF6, 0x08, 0xF6, 0x08, +0xDF, 0xFA, 0x78, 0x81, 0x76, 0x30, 0x90, 0x47, 0x69, 0x74, 0x01, 0x93, 0xC0, 0xE0, 0xE4, 0x93, +0xC0, 0xE0, 0x43, 0x89, 0x01, 0x75, 0x8A, 0x60, 0x75, 0x8C, 0x79, 0xD2, 0x8C, 0xD2, 0xAF, 0x22, +0x02, 0xEF, 0xD3, 0x94, 0x02, 0x40, 0x03, 0x7F, 0xFF, 0x22, 0x74, 0x81, 0x2F, 0x2F, 0xF8, 0xE6, +0x20, 0xE5, 0xF4, 0xC2, 0xAF, 0xE6, 0x44, 0x30, 0xF6, 0xD2, 0xAF, 0xAE, 0x0C, 0xEE, 0xC3, 0x9F, +0x50, 0x21, 0x0E, 0x74, 0x86, 0x2E, 0xF8, 0xE6, 0xF9, 0x08, 0xE6, 0x18, 0xBE, 0x02, 0x02, 0x74, +0xFF, 0xFD, 0xED, 0x69, 0x60, 0x09, 0x09, 0xE7, 0x19, 0x19, 0xF7, 0x09, 0x09, 0x80, 0xF3, 0x16, +0x16, 0x80, 0xDA, 0xEE, 0xD3, 0x9F, 0x40, 0x04, 0x05, 0x81, 0x05, 0x81, 0xEE, 0xD3, 0x9F, 0x40, +0x22, 0x74, 0x86, 0x2E, 0xF8, 0x08, 0xE6, 0xF9, 0xEE, 0xB5, 0x0C, 0x02, 0xA9, 0x81, 0x18, 0x06, +0x06, 0xE6, 0xFD, 0xED, 0x69, 0x60, 0x09, 0x19, 0x19, 0xE7, 0x09, 0x09, 0xF7, 0x19, 0x80, 0xF3, +0x1E, 0x80, 0xD9, 0xEF, 0x24, 0x86, 0xF8, 0xE6, 0x04, 0xF8, 0xEF, 0x2F, 0x04, 0x90, 0x47, 0x69, +0x93, 0xF6, 0x08, 0xEF, 0x2F, 0x93, 0xF6, 0x7F, 0x00, 0x22, 0xEF, 0xD3, 0x94, 0x02, 0x40, 0x03, +0x7F, 0xFF, 0x22, 0xEF, 0x23, 0x24, 0x81, 0xF8, 0xE6, 0x30, 0xE5, 0xF4, 0xC2, 0xAF, 0xE6, 0x54, +0x8C, 0xF6, 0xD2, 0xAF, 0xE5, 0x0C, 0xB5, 0x07, 0x0A, 0x74, 0x86, 0x2F, 0xF8, 0xE6, 0xF5, 0x81, +0x02, 0x44, 0x79, 0x50, 0x2E, 0x74, 0x87, 0x2F, 0xF8, 0xE6, 0xBF, 0x02, 0x02, 0x74, 0xFF, 0xFD, +0x18, 0xE6, 0xF9, 0x74, 0x86, 0x2F, 0xF8, 0xFB, 0xE6, 0xFC, 0xE9, 0x6C, 0x60, 0x08, 0xA8, 0x05, +0xE7, 0xF6, 0x1D, 0x19, 0x80, 0xF4, 0xA8, 0x03, 0xA6, 0x05, 0x1F, 0xE5, 0x0C, 0xB5, 0x07, 0xE3, +0x7F, 0x00, 0x22, 0x74, 0x87, 0x2F, 0xF8, 0xE6, 0xFD, 0x18, 0x86, 0x01, 0x0F, 0x74, 0x86, 0x2F, +0xF8, 0xA6, 0x01, 0x08, 0x86, 0x04, 0xE5, 0x0C, 0xB5, 0x07, 0x02, 0xAC, 0x81, 0xED, 0x6C, 0x60, +0x08, 0x0D, 0x09, 0xA8, 0x05, 0xE6, 0xF7, 0x80, 0xF4, 0xE5, 0x0C, 0xB5, 0x07, 0xDE, 0x89, 0x81, +0x7F, 0x00, 0x22, 0xEF, 0xD3, 0x94, 0x02, 0x40, 0x03, 0x7F, 0xFF, 0x22, 0xEF, 0x23, 0x24, 0x81, +0xF8, 0xC2, 0xAF, 0xE6, 0x30, 0xE5, 0x05, 0x30, 0xE0, 0x02, 0xD2, 0xE4, 0xD2, 0xE2, 0xC6, 0xD2, +0xAF, 0x7F, 0x00, 0x30, 0xE2, 0x01, 0x0F, 0x02, 0x44, 0x78, 0x8F, 0xF0, 0xE4, 0xFF, 0xFE, 0xE5, +0x0C, 0x23, 0x24, 0x80, 0xF8, 0xC2, 0xA9, 0x30, 0xF7, 0x0D, 0x7F, 0x08, 0xE6, 0x60, 0x0B, 0x2D, +0xF6, 0x60, 0x30, 0x50, 0x2E, 0x80, 0x07, 0x30, 0xF1, 0x06, 0xED, 0xF6, 0x60, 0x25, 0x7E, 0x02, +0x08, 0x30, 0xF0, 0x10, 0xC2, 0xAF, 0xE6, 0x10, 0xE7, 0x23, 0x0E, 0x30, 0xE2, 0x0C, 0xD2, 0xAF, +0x7F, 0x04, 0x80, 0x12, 0xC2, 0xAF, 0xE6, 0x10, 0xE7, 0x13, 0x54, 0xEC, 0x4E, 0xF6, 0xD2, 0xAF, +0x02, 0x44, 0x79, 0x7F, 0x08, 0x08, 0xEF, 0x44, 0x83, 0xF4, 0xC2, 0xAF, 0x56, 0xC6, 0xD2, 0xAF, +0x54, 0x80, 0x4F, 0xFF, 0x22, 0x02, 0x47, 0x13, 0x02, 0x45, 0x09, 0xE4, 0x93, 0xA3, 0xF8, 0xE4, +0x93, 0xA3, 0x40, 0x03, 0xF6, 0x80, 0x01, 0xF2, 0x08, 0xDF, 0xF4, 0x80, 0x29, 0xE4, 0x93, 0xA3, +0xF8, 0x54, 0x07, 0x24, 0x0C, 0xC8, 0xC3, 0x33, 0xC4, 0x54, 0x0F, 0x44, 0x20, 0xC8, 0x83, 0x40, +0x04, 0xF4, 0x56, 0x80, 0x01, 0x46, 0xF6, 0xDF, 0xE4, 0x80, 0x0B, 0x01, 0x02, 0x04, 0x08, 0x10, +0x20, 0x40, 0x80, 0x90, 0x47, 0x58, 0xE4, 0x7E, 0x01, 0x93, 0x60, 0xBC, 0xA3, 0xFF, 0x54, 0x3F, +0x30, 0xE5, 0x09, 0x54, 0x1F, 0xFE, 0xE4, 0x93, 0xA3, 0x60, 0x01, 0x0E, 0xCF, 0x54, 0xC0, 0x25, +0xE0, 0x60, 0xA8, 0x40, 0xB8, 0xE4, 0x93, 0xA3, 0xFA, 0xE4, 0x93, 0xA3, 0xF8, 0xE4, 0x93, 0xA3, +0xC8, 0xC5, 0x82, 0xC8, 0xCA, 0xC5, 0x83, 0xCA, 0xF0, 0xA3, 0xC8, 0xC5, 0x82, 0xC8, 0xCA, 0xC5, +0x83, 0xCA, 0xDF, 0xE9, 0xDE, 0xE7, 0x80, 0xBE, 0x00, 0x41, 0x83, 0x23, 0x00, 0x41, 0x83, 0x24, +0x00, 0x41, 0x83, 0x37, 0x00, 0x41, 0x83, 0x38, 0x00, 0x59, 0x22, 0x5F, 0xE0, 0x63, 0x3F, 0xC0, +0xE0, 0xC0, 0xF0, 0xC0, 0x83, 0xC0, 0x82, 0xC0, 0xD0, 0x75, 0xD0, 0x00, 0xC0, 0x00, 0xC0, 0x01, +0xC0, 0x02, 0xC0, 0x03, 0xC0, 0x04, 0xC0, 0x05, 0xC0, 0x06, 0xC0, 0x07, 0x90, 0x01, 0xC4, 0x74, +0x6F, 0xF0, 0x74, 0x47, 0xA3, 0xF0, 0xF1, 0xBE, 0x74, 0x6F, 0x04, 0x90, 0x01, 0xC4, 0xF0, 0x74, +0x47, 0xA3, 0xF0, 0xD0, 0x07, 0xD0, 0x06, 0xD0, 0x05, 0xD0, 0x04, 0xD0, 0x03, 0xD0, 0x02, 0xD0, +0x01, 0xD0, 0x00, 0xD0, 0xD0, 0xD0, 0x82, 0xD0, 0x83, 0xD0, 0xF0, 0xD0, 0xE0, 0x32, 0x90, 0x00, +0x54, 0xE0, 0x55, 0x35, 0xF5, 0x39, 0xA3, 0xE0, 0x55, 0x36, 0xF5, 0x3A, 0xA3, 0xE0, 0x55, 0x37, +0xF5, 0x3B, 0xA3, 0xE0, 0x55, 0x38, 0xF5, 0x3C, 0xAD, 0x39, 0x7F, 0x54, 0x12, 0x32, 0x1E, 0xAD, +0x3A, 0x7F, 0x55, 0x12, 0x32, 0x1E, 0xAD, 0x3B, 0x7F, 0x56, 0x12, 0x32, 0x1E, 0xAD, 0x3C, 0x7F, +0x57, 0x12, 0x32, 0x1E, 0x53, 0x91, 0xEF, 0x22, 0xC0, 0xE0, 0xC0, 0xF0, 0xC0, 0x83, 0xC0, 0x82, +0xC0, 0xD0, 0x75, 0xD0, 0x00, 0xC0, 0x00, 0xC0, 0x01, 0xC0, 0x02, 0xC0, 0x03, 0xC0, 0x04, 0xC0, +0x05, 0xC0, 0x06, 0xC0, 0x07, 0x90, 0x01, 0xC4, 0x74, 0xF8, 0xF0, 0x74, 0x47, 0xA3, 0xF0, 0x12, +0x6E, 0x11, 0xE5, 0x41, 0x30, 0xE3, 0x02, 0x71, 0x8D, 0xE5, 0x41, 0x30, 0xE4, 0x02, 0x71, 0x66, +0xE5, 0x43, 0x30, 0xE0, 0x02, 0x11, 0x90, 0xE5, 0x43, 0x30, 0xE1, 0x03, 0x12, 0x5B, 0x66, 0xE5, +0x43, 0x30, 0xE2, 0x03, 0x12, 0x5A, 0xAD, 0xE5, 0x43, 0x30, 0xE3, 0x02, 0xF1, 0x53, 0xE5, 0x43, +0x30, 0xE4, 0x02, 0xF1, 0x97, 0xE5, 0x43, 0x30, 0xE5, 0x02, 0x91, 0x36, 0xE5, 0x43, 0x30, 0xE6, +0x02, 0xF1, 0x38, 0xE5, 0x44, 0x30, 0xE1, 0x02, 0x71, 0x7A, 0x74, 0xF8, 0x04, 0x90, 0x01, 0xC4, +0xF0, 0x74, 0x47, 0xA3, 0xF0, 0xD0, 0x07, 0xD0, 0x06, 0xD0, 0x05, 0xD0, 0x04, 0xD0, 0x03, 0xD0, +0x02, 0xD0, 0x01, 0xD0, 0x00, 0xD0, 0xD0, 0xD0, 0x82, 0xD0, 0x83, 0xD0, 0xF0, 0xD0, 0xE0, 0x32, +0xE4, 0xFF, 0x90, 0x81, 0x3B, 0xE0, 0x60, 0x77, 0x90, 0x80, 0xF7, 0xE0, 0x64, 0x01, 0x70, 0x6F, +0x90, 0x81, 0x3A, 0xE0, 0xC4, 0x54, 0x0F, 0x60, 0x24, 0x24, 0xFE, 0x60, 0x03, 0x04, 0x70, 0x1F, +0x90, 0x81, 0x42, 0xE0, 0x14, 0xF0, 0xE0, 0xFE, 0x60, 0x06, 0x90, 0x81, 0x44, 0xE0, 0x60, 0x0F, +0xEE, 0x70, 0x06, 0x90, 0x81, 0x41, 0xE0, 0xA3, 0xF0, 0x7F, 0x01, 0x80, 0x02, 0x7F, 0x01, 0xEF, +0x60, 0x3D, 0x90, 0x81, 0x3F, 0xE0, 0x44, 0x10, 0xF0, 0x90, 0x81, 0x44, 0xE0, 0x60, 0x03, 0xB4, +0x01, 0x09, 0xE4, 0xF5, 0x1D, 0x90, 0x81, 0x44, 0xE0, 0x80, 0x0D, 0xE4, 0xF5, 0x1D, 0x90, 0x81, +0x44, 0xE0, 0x75, 0xF0, 0x03, 0xA4, 0x24, 0xFE, 0xFF, 0x90, 0x81, 0x43, 0xE0, 0x2F, 0xD1, 0xD4, +0x90, 0x01, 0x57, 0x74, 0x05, 0xF0, 0x90, 0x81, 0x3E, 0xE0, 0x20, 0xE2, 0x02, 0x31, 0x10, 0x22, +0x7D, 0x01, 0x7F, 0x04, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0x83, 0x36, 0xED, 0xF0, +0x90, 0x81, 0x38, 0xE0, 0xFE, 0xC4, 0x13, 0x13, 0x54, 0x03, 0x30, 0xE0, 0x02, 0x41, 0x5D, 0xEE, +0xC4, 0x13, 0x13, 0x13, 0x54, 0x01, 0x30, 0xE0, 0x02, 0x41, 0x5D, 0x90, 0x81, 0x3E, 0xE0, 0xFE, +0x6F, 0x70, 0x02, 0x41, 0x5D, 0xEF, 0x70, 0x02, 0x21, 0xD4, 0x24, 0xFE, 0x70, 0x02, 0x41, 0x0E, +0x24, 0xFE, 0x60, 0x48, 0x24, 0xFC, 0x70, 0x02, 0x41, 0x48, 0x24, 0xFC, 0x60, 0x02, 0x41, 0x5D, +0xEE, 0xB4, 0x0E, 0x02, 0x51, 0xCE, 0x90, 0x81, 0x3E, 0xE0, 0x70, 0x04, 0x7F, 0x01, 0x51, 0xF6, +0x90, 0x81, 0x3E, 0xE0, 0xB4, 0x06, 0x02, 0x51, 0xA8, 0x90, 0x81, 0x3E, 0xE0, 0xB4, 0x04, 0x0E, +0x90, 0x83, 0x36, 0xE0, 0xFF, 0x60, 0x05, 0x12, 0x72, 0x2D, 0x80, 0x02, 0xF1, 0xD6, 0x90, 0x81, +0x3E, 0xE0, 0x64, 0x08, 0x60, 0x02, 0x41, 0x5D, 0x71, 0x99, 0x41, 0x5D, 0x90, 0x81, 0x3E, 0xE0, +0x70, 0x04, 0x7F, 0x01, 0x51, 0xF6, 0x90, 0x81, 0x3E, 0xE0, 0xB4, 0x06, 0x02, 0x51, 0xA8, 0x90, +0x81, 0x3E, 0xE0, 0xB4, 0x0E, 0x07, 0x51, 0x62, 0xBF, 0x01, 0x02, 0x51, 0xCE, 0x90, 0x81, 0x3E, +0xE0, 0x64, 0x0C, 0x60, 0x02, 0x41, 0x5D, 0x51, 0x62, 0xEF, 0x64, 0x01, 0x60, 0x02, 0x41, 0x5D, +0x71, 0x0F, 0x41, 0x5D, 0x90, 0x81, 0x3E, 0xE0, 0xB4, 0x0E, 0x07, 0x51, 0x62, 0xBF, 0x01, 0x02, +0x51, 0xCE, 0x90, 0x81, 0x3E, 0xE0, 0xB4, 0x06, 0x02, 0x51, 0xA8, 0x90, 0x81, 0x3E, 0xE0, 0xB4, +0x0C, 0x07, 0x51, 0x62, 0xBF, 0x01, 0x02, 0x71, 0x0F, 0x90, 0x81, 0x3E, 0xE0, 0x64, 0x04, 0x70, +0x5C, 0x12, 0x71, 0x7D, 0xEF, 0x64, 0x01, 0x70, 0x54, 0x12, 0x50, 0xD7, 0x80, 0x4F, 0x90, 0x81, +0x3E, 0xE0, 0xB4, 0x0E, 0x07, 0x51, 0x62, 0xBF, 0x01, 0x02, 0x51, 0xCE, 0x90, 0x81, 0x3E, 0xE0, +0xB4, 0x06, 0x02, 0x51, 0xA8, 0x90, 0x81, 0x3E, 0xE0, 0xB4, 0x0C, 0x07, 0x51, 0x62, 0xBF, 0x01, +0x02, 0x71, 0x0F, 0x90, 0x81, 0x3E, 0xE0, 0x70, 0x04, 0x7F, 0x01, 0x51, 0xF6, 0x90, 0x81, 0x3E, +0xE0, 0xB4, 0x04, 0x19, 0xF1, 0xC9, 0x80, 0x15, 0x90, 0x81, 0x3E, 0xE0, 0xB4, 0x0C, 0x0E, 0x90, +0x81, 0x39, 0xE0, 0xFF, 0x13, 0x13, 0x54, 0x3F, 0x30, 0xE0, 0x02, 0x71, 0x83, 0xD0, 0xD0, 0x92, +0xAF, 0x22, 0x12, 0x71, 0x64, 0xEF, 0x64, 0x01, 0x60, 0x08, 0x90, 0x01, 0xB8, 0x74, 0x01, 0xF0, +0x80, 0x2D, 0x90, 0x81, 0x38, 0xE0, 0x13, 0x13, 0x13, 0x54, 0x1F, 0x30, 0xE0, 0x08, 0x90, 0x01, +0xB8, 0x74, 0x02, 0xF0, 0x80, 0x19, 0x90, 0x81, 0x3D, 0xE0, 0xD3, 0x94, 0x04, 0x40, 0x08, 0x90, +0x01, 0xB8, 0x74, 0x08, 0xF0, 0x80, 0x08, 0x90, 0x01, 0xB8, 0xE4, 0xF0, 0x7F, 0x01, 0x22, 0x90, +0x01, 0xB9, 0x74, 0x02, 0xF0, 0x7F, 0x00, 0x22, 0x90, 0x81, 0x39, 0xE0, 0x90, 0x06, 0x04, 0x20, +0xE0, 0x0C, 0xE0, 0x44, 0x40, 0xF0, 0x90, 0x81, 0x3E, 0x74, 0x04, 0xF0, 0x80, 0x0A, 0xE0, 0x54, +0x7F, 0xF0, 0x90, 0x81, 0x3E, 0x74, 0x0C, 0xF0, 0x90, 0x05, 0x22, 0xE4, 0xF0, 0x22, 0x90, 0x81, +0x39, 0xE0, 0xC3, 0x13, 0x20, 0xE0, 0x08, 0x90, 0x81, 0x3E, 0x74, 0x0C, 0xF0, 0x80, 0x11, 0x90, +0x06, 0x04, 0xE0, 0x44, 0x40, 0xF0, 0xE0, 0x44, 0x80, 0xF0, 0x90, 0x81, 0x3E, 0x74, 0x04, 0xF0, +0x90, 0x05, 0x22, 0xE4, 0xF0, 0x22, 0x90, 0x83, 0x35, 0xEF, 0xF0, 0x71, 0xA7, 0x90, 0x83, 0x35, +0xE0, 0x60, 0x05, 0x90, 0x05, 0x22, 0xE4, 0xF0, 0x90, 0x81, 0x3E, 0x74, 0x04, 0xF0, 0x22, 0x90, +0x80, 0xF7, 0xE0, 0x64, 0x01, 0x70, 0x2D, 0x90, 0x81, 0x39, 0xE0, 0x54, 0xFD, 0xF0, 0x90, 0x05, +0x22, 0x74, 0x6F, 0xF0, 0x7F, 0x01, 0x91, 0x52, 0xBF, 0x01, 0x0E, 0x90, 0x81, 0x38, 0xE0, 0x44, +0x80, 0xF0, 0x90, 0x81, 0x3E, 0x74, 0x0E, 0xF0, 0x22, 0x90, 0x01, 0xB9, 0x74, 0x01, 0xF0, 0x90, +0x01, 0xB8, 0x04, 0xF0, 0x22, 0x90, 0x81, 0x3B, 0xE0, 0x64, 0x01, 0x70, 0x18, 0x90, 0x81, 0x3A, +0xE0, 0x54, 0x0F, 0x60, 0x08, 0xE4, 0xFD, 0x7F, 0x0C, 0x31, 0x14, 0x81, 0x8E, 0x90, 0x81, 0x3E, +0xE0, 0x70, 0x02, 0x31, 0x10, 0x22, 0x12, 0x6B, 0x60, 0x7F, 0x02, 0x8F, 0x1F, 0x7F, 0x02, 0x12, +0x46, 0x53, 0x90, 0x80, 0x01, 0xE0, 0x45, 0x1F, 0xF0, 0x22, 0x90, 0x81, 0x3B, 0xE0, 0x60, 0x02, +0x71, 0x45, 0x22, 0x12, 0x5C, 0xFE, 0x90, 0x81, 0x3E, 0x74, 0x08, 0xF0, 0x22, 0x90, 0x81, 0x53, +0xE0, 0x30, 0xE0, 0x04, 0x7F, 0x10, 0x71, 0x6B, 0x22, 0x71, 0xA7, 0x90, 0x05, 0x22, 0xE4, 0xF0, +0x90, 0x81, 0x3E, 0x74, 0x0C, 0xF0, 0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0x01, +0x01, 0xE0, 0x44, 0x02, 0xF0, 0x90, 0x01, 0x00, 0x74, 0xFF, 0xF0, 0x90, 0x06, 0xB7, 0x74, 0x09, +0xF0, 0x90, 0x06, 0xB4, 0x74, 0x86, 0xF0, 0x7F, 0x7C, 0x7E, 0x08, 0x12, 0x2D, 0x5C, 0xEC, 0x54, +0x7F, 0xFC, 0x90, 0x83, 0x11, 0x12, 0x20, 0xCE, 0x90, 0x83, 0x11, 0x12, 0x42, 0x26, 0x90, 0x85, +0xBB, 0x12, 0x20, 0xCE, 0x7F, 0x7C, 0x7E, 0x08, 0x12, 0x2E, 0xA2, 0x90, 0x85, 0xBB, 0x12, 0x20, +0xDA, 0xCC, 0xC0, 0x00, 0xC0, 0x7F, 0x8C, 0x7E, 0x08, 0x12, 0x2E, 0xA2, 0x90, 0x85, 0xBB, 0x12, +0x20, 0xDA, 0x00, 0xC0, 0x00, 0x14, 0x7F, 0x70, 0x7E, 0x0E, 0x12, 0x2E, 0xA2, 0x90, 0x83, 0x03, +0x12, 0x20, 0xDA, 0x00, 0x03, 0x3E, 0x60, 0xE4, 0xFD, 0xFF, 0xF1, 0x74, 0xD0, 0xD0, 0x92, 0xAF, +0x22, 0x91, 0x8E, 0x90, 0x81, 0x3E, 0xE0, 0x64, 0x0C, 0x60, 0x0A, 0xE4, 0xFD, 0x7F, 0x0C, 0x31, +0x14, 0xE4, 0xFF, 0x91, 0x52, 0x22, 0x90, 0x80, 0xF7, 0xE0, 0xB4, 0x01, 0x14, 0x90, 0x81, 0x3B, +0xE0, 0x60, 0x0E, 0x90, 0x81, 0x3A, 0xE0, 0x54, 0x0F, 0x64, 0x02, 0x60, 0x02, 0xC1, 0xB2, 0x91, +0x21, 0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x8F, 0x4E, 0x90, 0x04, 0x1D, 0xE0, 0x60, +0x1E, 0x90, 0x05, 0x22, 0xE0, 0xF5, 0x51, 0x74, 0xFF, 0xF0, 0x12, 0x6F, 0xBF, 0xBF, 0x01, 0x07, +0xAF, 0x4E, 0x12, 0x73, 0x0F, 0xB1, 0x1A, 0x90, 0x05, 0x22, 0xE5, 0x51, 0xF0, 0x80, 0x02, 0xB1, +0x1A, 0x90, 0x04, 0x1F, 0x74, 0x20, 0xF0, 0x7F, 0x01, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x90, 0x81, +0x38, 0xE0, 0x13, 0x13, 0x13, 0x54, 0x1F, 0x30, 0xE0, 0x05, 0x90, 0x01, 0x5B, 0xE4, 0xF0, 0x90, +0x06, 0x92, 0x74, 0x02, 0xF0, 0x90, 0x01, 0x3C, 0x74, 0x04, 0xF0, 0xE4, 0xF5, 0x1D, 0x90, 0x81, +0x4E, 0xE0, 0xC3, 0x13, 0x54, 0x7F, 0xF5, 0x1E, 0xE4, 0xFB, 0xFD, 0x7F, 0x58, 0x7E, 0x01, 0xD1, +0xDD, 0x90, 0x01, 0x5B, 0x74, 0x05, 0xF0, 0x90, 0x81, 0x38, 0xE0, 0x44, 0x08, 0xF0, 0x22, 0x74, +0x1F, 0x2D, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x54, 0x3F, 0xF0, 0xEF, 0x60, 0x1D, +0x74, 0x21, 0x2D, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x44, 0x10, 0xF0, 0x74, 0x1F, +0x2D, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x44, 0x80, 0xF0, 0x22, 0x74, 0x21, 0x2D, +0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x54, 0xEF, 0xF0, 0x74, 0x1F, 0x2D, 0xF5, 0x82, +0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x44, 0x40, 0xF0, 0x22, 0x90, 0x80, 0x08, 0xE0, 0xFF, 0x7D, +0x01, 0xB1, 0xB7, 0x8E, 0x4F, 0x8F, 0x50, 0xAD, 0x50, 0xAC, 0x4F, 0xAF, 0x4E, 0x91, 0xCF, 0xAF, +0x50, 0xAE, 0x4F, 0x90, 0x04, 0x80, 0xE0, 0x54, 0x0F, 0xFD, 0xAC, 0x07, 0x74, 0x11, 0x2C, 0xF5, +0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x44, 0x01, 0xF0, 0x74, 0x11, 0x2C, 0xF5, 0x82, 0xE4, +0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x54, 0xFB, 0xF0, 0xAC, 0x07, 0x74, 0x16, 0x2C, 0xF5, 0x82, 0xE4, +0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x44, 0xFA, 0xF0, 0x74, 0x15, 0x2C, 0xF5, 0x82, 0xE4, 0x34, 0xFC, +0xF5, 0x83, 0xE0, 0x44, 0x1F, 0xF0, 0xAC, 0x07, 0x74, 0x06, 0x2C, 0xF5, 0x82, 0xE4, 0x34, 0xFC, +0xF5, 0x83, 0xE0, 0x44, 0x0F, 0xF0, 0x90, 0x04, 0x53, 0xE4, 0xF0, 0x90, 0x04, 0x52, 0xF0, 0x90, +0x04, 0x51, 0x74, 0xFF, 0xF0, 0x90, 0x04, 0x50, 0x74, 0xFD, 0xF0, 0x74, 0x14, 0x2C, 0xF5, 0x82, +0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x54, 0xC0, 0x4D, 0xFD, 0x74, 0x14, 0x2F, 0xF5, 0x82, 0xE4, +0x34, 0xFC, 0xF5, 0x83, 0xED, 0xF0, 0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0x83, +0x28, 0xED, 0xF0, 0x90, 0x83, 0x27, 0xEF, 0xF0, 0xE4, 0xFD, 0xFC, 0x12, 0x5E, 0x61, 0x7C, 0x00, +0xAD, 0x07, 0x90, 0x83, 0x27, 0xE0, 0x90, 0x04, 0x25, 0xF0, 0x90, 0x83, 0x28, 0xE0, 0x60, 0x0E, +0x74, 0x0F, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x44, 0x80, 0xF0, 0xAF, 0x05, +0x74, 0x08, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE4, 0xF0, 0x74, 0x09, 0x2F, 0xF5, +0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x54, 0xF0, 0xF0, 0x74, 0x21, 0x2D, 0xF5, 0x82, 0xE4, +0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x54, 0xF7, 0xF0, 0xAE, 0x04, 0xAF, 0x05, 0xD0, 0xD0, 0x92, 0xAF, +0x22, 0x90, 0x81, 0x3B, 0xE0, 0x60, 0x12, 0x90, 0x06, 0x92, 0xE0, 0x30, 0xE1, 0x02, 0x81, 0x8E, +0x90, 0x81, 0x38, 0xE0, 0x54, 0xF7, 0xF0, 0xD1, 0x3A, 0x22, 0x90, 0x81, 0x3D, 0xE0, 0xFF, 0x7D, +0x01, 0x21, 0x14, 0xE4, 0x90, 0x82, 0x71, 0xF0, 0x90, 0x06, 0xA9, 0xE0, 0x90, 0x82, 0x71, 0xF0, +0xE0, 0x54, 0xC0, 0x70, 0x0C, 0x90, 0x81, 0x3F, 0xE0, 0x54, 0xFE, 0xF0, 0x54, 0xFD, 0xF0, 0x80, +0xD9, 0x90, 0x82, 0x71, 0xE0, 0x30, 0xE6, 0x21, 0x90, 0x81, 0x3B, 0xE0, 0x64, 0x01, 0x70, 0x20, +0x90, 0x81, 0x3F, 0xE0, 0x44, 0x01, 0xF0, 0x90, 0x81, 0x3A, 0xE0, 0x54, 0x0F, 0x64, 0x02, 0x60, +0x04, 0xD1, 0xB2, 0x80, 0x0B, 0x91, 0x21, 0x80, 0x07, 0x90, 0x81, 0x3F, 0xE0, 0x54, 0xFE, 0xF0, +0x90, 0x82, 0x71, 0xE0, 0x90, 0x81, 0x3F, 0x30, 0xE7, 0x13, 0xE0, 0x44, 0x02, 0xD1, 0xCC, 0x90, +0x01, 0x57, 0x74, 0x05, 0xF0, 0x90, 0x81, 0x38, 0xE0, 0x44, 0x04, 0xF0, 0x22, 0xE0, 0x54, 0xFD, +0xF0, 0x22, 0x90, 0x04, 0x1D, 0xE0, 0x70, 0x13, 0x90, 0x80, 0x07, 0xE0, 0xFF, 0xE4, 0xFD, 0xB1, +0xB7, 0x8E, 0x0D, 0x8F, 0x0E, 0x90, 0x04, 0x1F, 0x74, 0x20, 0xF0, 0x22, 0xF0, 0xE4, 0xF5, 0x1D, +0x90, 0x81, 0x4D, 0xE0, 0xF5, 0x1E, 0xE4, 0xFB, 0xFD, 0x7F, 0x54, 0x7E, 0x01, 0x8E, 0x19, 0x8F, +0x1A, 0xE5, 0x1E, 0x54, 0x07, 0xC4, 0x33, 0x54, 0xE0, 0x85, 0x19, 0x83, 0x85, 0x1A, 0x82, 0xF0, +0xE5, 0x1D, 0x54, 0x07, 0xC4, 0x33, 0x54, 0xE0, 0xFF, 0xE5, 0x1E, 0x13, 0x13, 0x13, 0x54, 0x1F, +0x4F, 0xA3, 0xF0, 0xEB, 0x54, 0x07, 0xC4, 0x33, 0x54, 0xE0, 0xFF, 0xE5, 0x1D, 0x13, 0x13, 0x13, +0x54, 0x1F, 0x4F, 0x85, 0x1A, 0x82, 0x85, 0x19, 0x83, 0xA3, 0xA3, 0xF0, 0xBD, 0x01, 0x0C, 0x85, +0x1A, 0x82, 0x8E, 0x83, 0xA3, 0xA3, 0xA3, 0x74, 0x03, 0xF0, 0x22, 0x85, 0x1A, 0x82, 0x85, 0x19, +0x83, 0xA3, 0xA3, 0xA3, 0x74, 0x01, 0xF0, 0x22, 0x90, 0x80, 0xF7, 0xE0, 0xB4, 0x01, 0x13, 0x90, +0x81, 0x3B, 0xE0, 0x60, 0x0D, 0x90, 0x81, 0x3F, 0xE0, 0x54, 0xFE, 0xF0, 0x54, 0x07, 0x70, 0x02, +0xD1, 0x3A, 0x22, 0x90, 0x80, 0xF7, 0xE0, 0x64, 0x01, 0x70, 0x18, 0x90, 0x81, 0x3B, 0xE0, 0x60, +0x12, 0x90, 0x01, 0x57, 0xE4, 0xF0, 0x90, 0x01, 0x3C, 0x74, 0x02, 0xD1, 0xCC, 0x90, 0x01, 0x57, +0x74, 0x05, 0xF0, 0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0xC0, 0x07, 0xC0, 0x05, 0x90, +0x83, 0x03, 0x12, 0x42, 0x26, 0x90, 0x82, 0xF1, 0x12, 0x20, 0xCE, 0xD0, 0x05, 0xD0, 0x07, 0x12, +0x69, 0x1D, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x90, 0x80, 0xF7, 0xE0, 0x64, 0x01, 0x70, 0x25, 0x90, +0x81, 0x3B, 0xE0, 0x60, 0x1F, 0x90, 0x01, 0x57, 0xE4, 0xF0, 0x90, 0x01, 0x3C, 0x74, 0x02, 0xF0, +0x90, 0x81, 0x38, 0xE0, 0x54, 0xFB, 0xF0, 0x90, 0x81, 0x3F, 0xE0, 0x54, 0xFD, 0xF0, 0x54, 0x07, +0x70, 0x02, 0xD1, 0x3A, 0x22, 0xE4, 0xFF, 0x81, 0x52, 0x90, 0x05, 0x22, 0x74, 0x6F, 0xF0, 0x90, +0x81, 0x3E, 0x74, 0x02, 0xF0, 0x22, 0x90, 0x06, 0x04, 0xE0, 0x54, 0x7F, 0xF0, 0x90, 0x05, 0x22, +0xE4, 0xF0, 0x90, 0x81, 0x3E, 0x74, 0x0C, 0xF0, 0x22, 0xC0, 0xE0, 0xC0, 0xF0, 0xC0, 0x83, 0xC0, +0x82, 0xC0, 0xD0, 0x75, 0xD0, 0x00, 0xC0, 0x00, 0xC0, 0x01, 0xC0, 0x02, 0xC0, 0x03, 0xC0, 0x04, +0xC0, 0x05, 0xC0, 0x06, 0xC0, 0x07, 0x90, 0x01, 0xC4, 0x74, 0xE9, 0xF0, 0x74, 0x4F, 0xA3, 0xF0, +0x12, 0x6E, 0x3E, 0xE5, 0x49, 0x30, 0xE1, 0x02, 0x11, 0x70, 0xE5, 0x49, 0x30, 0xE2, 0x03, 0x12, +0x4E, 0x21, 0xE5, 0x4A, 0x30, 0xE0, 0x03, 0x12, 0x6E, 0x7D, 0xE5, 0x4C, 0x30, 0xE1, 0x05, 0x7F, +0x04, 0x12, 0x4B, 0x6B, 0xE5, 0x4C, 0x30, 0xE4, 0x02, 0x11, 0x7A, 0xE5, 0x4C, 0x30, 0xE5, 0x02, +0x11, 0xF4, 0xE5, 0x4C, 0x30, 0xE6, 0x03, 0x12, 0x6F, 0x1C, 0x74, 0xE9, 0x04, 0x90, 0x01, 0xC4, +0xF0, 0x74, 0x4F, 0xA3, 0xF0, 0xD0, 0x07, 0xD0, 0x06, 0xD0, 0x05, 0xD0, 0x04, 0xD0, 0x03, 0xD0, +0x02, 0xD0, 0x01, 0xD0, 0x00, 0xD0, 0xD0, 0xD0, 0x82, 0xD0, 0x83, 0xD0, 0xF0, 0xD0, 0xE0, 0x32, +0x90, 0x81, 0x3B, 0xE0, 0x60, 0x03, 0x12, 0x72, 0xB1, 0x22, 0x12, 0x72, 0x7B, 0x90, 0x81, 0x41, +0xE0, 0x14, 0x90, 0x05, 0x73, 0xF0, 0x7D, 0x02, 0x7F, 0x02, 0x11, 0xC2, 0x90, 0x82, 0x65, 0xE0, +0x30, 0xE0, 0x2E, 0x90, 0x80, 0xF7, 0xE0, 0xB4, 0x01, 0x27, 0x90, 0x83, 0x37, 0xE0, 0x04, 0xF0, +0xE0, 0xB4, 0x0A, 0x0B, 0x90, 0x82, 0x67, 0xE0, 0x04, 0xF0, 0xE4, 0x90, 0x83, 0x37, 0xF0, 0x90, +0x82, 0x67, 0xE0, 0xFF, 0x90, 0x82, 0x66, 0xE0, 0xB5, 0x07, 0x06, 0xE4, 0xA3, 0xF0, 0x12, 0x4F, +0xC5, 0x22, 0x74, 0x3D, 0x2F, 0xF8, 0xE6, 0x4D, 0xFE, 0xF6, 0x74, 0x30, 0x2F, 0xF5, 0x82, 0xE4, +0x34, 0x01, 0xF5, 0x83, 0xEE, 0xF0, 0x22, 0x90, 0x05, 0x22, 0x74, 0xFF, 0xF0, 0x12, 0x6F, 0xBF, +0x90, 0x01, 0x37, 0x74, 0x02, 0xF0, 0xFD, 0x7F, 0x03, 0x11, 0xC2, 0x12, 0x5D, 0x04, 0xE4, 0x90, +0x81, 0x3E, 0xF0, 0x22, 0x90, 0x81, 0x38, 0xE0, 0xFF, 0xC4, 0x13, 0x13, 0x54, 0x03, 0x30, 0xE0, +0x27, 0xEF, 0x54, 0xBF, 0xF0, 0x90, 0x04, 0xE0, 0xE0, 0x90, 0x81, 0x39, 0x30, 0xE0, 0x06, 0xE0, +0x44, 0x01, 0xF0, 0x80, 0x10, 0xE0, 0x54, 0xFE, 0xF0, 0x90, 0x01, 0xB9, 0x74, 0x01, 0xF0, 0x90, +0x01, 0xB8, 0x74, 0x04, 0xF0, 0x12, 0x4E, 0x3A, 0xE4, 0xFF, 0x90, 0x82, 0x68, 0xE0, 0x30, 0xE0, +0x48, 0x90, 0x82, 0x6C, 0xE0, 0xFD, 0x60, 0x41, 0x74, 0x01, 0x7E, 0x00, 0xA8, 0x07, 0x08, 0x80, +0x05, 0xC3, 0x33, 0xCE, 0x33, 0xCE, 0xD8, 0xF9, 0xFF, 0x90, 0x04, 0xE0, 0xE0, 0xFB, 0xEF, 0x5B, +0x60, 0x06, 0xE4, 0x90, 0x82, 0x6C, 0xF0, 0x22, 0x90, 0x82, 0x6A, 0xE0, 0xD3, 0x9D, 0x50, 0x10, +0x90, 0x01, 0xC7, 0x74, 0x10, 0xF0, 0x31, 0x7A, 0x90, 0x82, 0x68, 0xE0, 0x54, 0xFE, 0xF0, 0x22, +0x12, 0x4F, 0xC5, 0x90, 0x82, 0x6C, 0xE0, 0x04, 0xF0, 0x22, 0x90, 0x80, 0x05, 0xE0, 0xB4, 0x02, +0x16, 0x90, 0x81, 0x55, 0xE0, 0xFF, 0xC4, 0x13, 0x13, 0x13, 0x54, 0x01, 0x30, 0xE0, 0x0F, 0x90, +0x01, 0x4D, 0xE0, 0x64, 0x80, 0xF0, 0x22, 0x90, 0x06, 0x90, 0xE0, 0x44, 0x01, 0xF0, 0x90, 0x82, +0x6F, 0xE0, 0x75, 0xF0, 0x20, 0xA4, 0xFF, 0x90, 0x83, 0x19, 0xE5, 0xF0, 0xF0, 0xA3, 0xEF, 0xF0, +0x90, 0x82, 0x70, 0xE0, 0x75, 0xF0, 0x08, 0xA4, 0xAE, 0xF0, 0x90, 0x83, 0x1B, 0xF0, 0xEE, 0xA3, +0xF0, 0x90, 0x82, 0x6E, 0xE0, 0xFE, 0xC4, 0x13, 0x13, 0x13, 0x54, 0x01, 0x30, 0xE0, 0x77, 0xEE, +0x54, 0x0F, 0xFF, 0xEE, 0xC4, 0x13, 0x13, 0x54, 0x03, 0x7D, 0x00, 0x20, 0xE0, 0x02, 0x7D, 0x01, +0x51, 0x47, 0x90, 0x82, 0x6E, 0xE0, 0xFE, 0x54, 0x0F, 0xFF, 0xEE, 0xC4, 0x13, 0x13, 0x54, 0x01, +0xFD, 0x51, 0x47, 0x90, 0x82, 0x6E, 0xE0, 0xC4, 0x13, 0x54, 0x07, 0x30, 0xE0, 0x22, 0x90, 0x83, +0x19, 0xE0, 0xFE, 0xA3, 0xE0, 0xFF, 0x12, 0x32, 0xAA, 0x90, 0x82, 0x6E, 0xE0, 0xFE, 0x54, 0x0F, +0xFF, 0xEE, 0xC4, 0x13, 0x13, 0x54, 0x03, 0x7D, 0x00, 0x20, 0xE0, 0x02, 0x7D, 0x01, 0x51, 0x47, +0x90, 0x82, 0x6E, 0xE0, 0xC4, 0x54, 0x0F, 0x30, 0xE0, 0x1C, 0x90, 0x83, 0x1C, 0xE0, 0xF5, 0x1D, +0x90, 0x83, 0x1B, 0xE0, 0xF5, 0x1E, 0xE4, 0xFB, 0xFD, 0x7F, 0x58, 0x7E, 0x01, 0x12, 0x4E, 0xDD, +0x90, 0x01, 0x5B, 0x74, 0x05, 0xF0, 0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0x83, +0x2C, 0xED, 0xF0, 0x90, 0x83, 0x2B, 0xEF, 0xF0, 0xD3, 0x94, 0x07, 0x50, 0x70, 0xE0, 0xFF, 0x74, +0x01, 0xA8, 0x07, 0x08, 0x80, 0x02, 0xC3, 0x33, 0xD8, 0xFC, 0xF4, 0xFF, 0x90, 0x00, 0x47, 0xE0, +0x5F, 0xFD, 0x7F, 0x47, 0x12, 0x32, 0x1E, 0x90, 0x83, 0x2B, 0xE0, 0xFF, 0x74, 0x01, 0xA8, 0x07, +0x08, 0x80, 0x02, 0xC3, 0x33, 0xD8, 0xFC, 0xFF, 0x90, 0x00, 0x46, 0xE0, 0x4F, 0xFD, 0x7F, 0x46, +0x12, 0x32, 0x1E, 0x90, 0x83, 0x2C, 0xE0, 0x60, 0x18, 0x90, 0x83, 0x2B, 0xE0, 0xFF, 0x74, 0x01, +0xA8, 0x07, 0x08, 0x80, 0x02, 0xC3, 0x33, 0xD8, 0xFC, 0xFF, 0x90, 0x00, 0x45, 0xE0, 0x4F, 0x80, +0x17, 0x90, 0x83, 0x2B, 0xE0, 0xFF, 0x74, 0x01, 0xA8, 0x07, 0x08, 0x80, 0x02, 0xC3, 0x33, 0xD8, +0xFC, 0xF4, 0xFF, 0x90, 0x00, 0x45, 0xE0, 0x5F, 0xFD, 0x7F, 0x45, 0x80, 0x7E, 0x90, 0x83, 0x2B, +0xE0, 0x24, 0xF8, 0xF0, 0xE0, 0x24, 0x04, 0xFF, 0x74, 0x01, 0xA8, 0x07, 0x08, 0x80, 0x02, 0xC3, +0x33, 0xD8, 0xFC, 0xF4, 0xFF, 0x90, 0x00, 0x43, 0xE0, 0x5F, 0xFD, 0x7F, 0x43, 0x12, 0x32, 0x1E, +0x90, 0x83, 0x2B, 0xE0, 0xFF, 0x74, 0x01, 0xA8, 0x07, 0x08, 0x80, 0x02, 0xC3, 0x33, 0xD8, 0xFC, +0xFF, 0x90, 0x00, 0x43, 0xE0, 0x4F, 0xFD, 0x7F, 0x43, 0x12, 0x32, 0x1E, 0x90, 0x83, 0x2C, 0xE0, +0x60, 0x1D, 0x90, 0x83, 0x2B, 0xE0, 0x24, 0x04, 0xFF, 0x74, 0x01, 0xA8, 0x07, 0x08, 0x80, 0x02, +0xC3, 0x33, 0xD8, 0xFC, 0xFF, 0x90, 0x00, 0x42, 0xE0, 0x4F, 0xFD, 0x7F, 0x42, 0x80, 0x1C, 0x90, +0x83, 0x2B, 0xE0, 0x24, 0x04, 0xFF, 0x74, 0x01, 0xA8, 0x07, 0x08, 0x80, 0x02, 0xC3, 0x33, 0xD8, +0xFC, 0xF4, 0xFF, 0x90, 0x00, 0x42, 0xE0, 0x5F, 0xFD, 0x7F, 0x42, 0x12, 0x32, 0x1E, 0xD0, 0xD0, +0x92, 0xAF, 0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0x82, 0x82, 0x74, 0x08, 0xF0, +0xE4, 0xA3, 0xF0, 0xA3, 0xF0, 0xA3, 0xF0, 0xA3, 0xF0, 0x90, 0x82, 0x89, 0xF0, 0xA3, 0xF0, 0x90, +0x01, 0x1F, 0xE0, 0xFE, 0x90, 0x01, 0x1E, 0xE0, 0x7C, 0x00, 0x24, 0x00, 0xFF, 0xEC, 0x3E, 0x90, +0x82, 0x7B, 0xF0, 0xA3, 0xEF, 0xF0, 0x90, 0x02, 0x82, 0xE0, 0x90, 0x82, 0x81, 0xF0, 0x90, 0x81, +0x53, 0xE0, 0x20, 0xE0, 0x02, 0xA1, 0xBD, 0x90, 0x81, 0x58, 0xE0, 0x20, 0xE0, 0x07, 0x90, 0x01, +0x3F, 0xE0, 0x30, 0xE2, 0x17, 0x90, 0x80, 0x05, 0xE0, 0xB4, 0x01, 0x0E, 0x90, 0xFD, 0x01, 0xE0, +0x20, 0xE6, 0x07, 0x90, 0xFD, 0x00, 0xE0, 0x44, 0x10, 0xF0, 0x31, 0x7A, 0xE4, 0x90, 0x82, 0x80, +0xF0, 0x90, 0x82, 0x81, 0xE0, 0xFF, 0x90, 0x82, 0x80, 0xE0, 0xC3, 0x9F, 0x40, 0x02, 0xA1, 0xBD, +0x90, 0x82, 0x7B, 0xE0, 0xFC, 0xA3, 0xE0, 0xFD, 0xEC, 0xFF, 0x90, 0xFD, 0x11, 0xF0, 0xAE, 0x05, +0xAB, 0x06, 0x90, 0x82, 0x84, 0xEF, 0xF0, 0x74, 0x02, 0x2B, 0xF5, 0x82, 0xE4, 0x34, 0xFB, 0xF5, +0x83, 0xE0, 0x54, 0x0F, 0x33, 0x33, 0x33, 0x54, 0xF8, 0xFF, 0x74, 0x03, 0x2B, 0xF5, 0x82, 0xE4, +0x34, 0xFB, 0xF5, 0x83, 0xE0, 0x54, 0x03, 0xFE, 0xEF, 0x24, 0x18, 0x2E, 0x90, 0x82, 0x89, 0xF0, +0xE0, 0xFF, 0x2B, 0xFA, 0x7E, 0x00, 0x90, 0x82, 0x7B, 0xE0, 0xFC, 0xA3, 0xE0, 0x2F, 0xFF, 0xEE, +0x3C, 0xA3, 0xF0, 0xA3, 0xEF, 0xF0, 0x74, 0x00, 0x2A, 0xF5, 0x82, 0xE4, 0x34, 0xFB, 0xF5, 0x83, +0xE0, 0xFF, 0x54, 0xFC, 0x90, 0x82, 0x7F, 0xF0, 0x74, 0x04, 0x2A, 0xF5, 0x82, 0xE4, 0x34, 0xFB, +0x12, 0x5E, 0x8E, 0x90, 0x82, 0x83, 0xEF, 0xF0, 0x74, 0x01, 0x2B, 0xF5, 0x82, 0xE4, 0x34, 0xFB, +0xF5, 0x83, 0xE0, 0xFE, 0x74, 0x00, 0x2B, 0xF5, 0x82, 0xE4, 0x34, 0xFB, 0xF5, 0x83, 0xE0, 0x7C, +0x00, 0x24, 0x00, 0xFF, 0xEC, 0x3E, 0x54, 0x3F, 0xFE, 0x90, 0x82, 0x85, 0xF0, 0xA3, 0xEF, 0xF0, +0x90, 0x82, 0x89, 0xE0, 0x2F, 0xFF, 0xEC, 0x3E, 0xFE, 0x12, 0x73, 0x6E, 0x74, 0x0F, 0x2B, 0xF5, +0x82, 0xE4, 0x34, 0xFB, 0xF5, 0x83, 0xE0, 0xFD, 0x90, 0x82, 0x7B, 0xEE, 0x8F, 0xF0, 0x12, 0x41, +0xF6, 0x90, 0x80, 0xF5, 0xE0, 0xFE, 0xA3, 0xE0, 0xFF, 0x90, 0x82, 0x7B, 0xE0, 0xF8, 0xA3, 0xE0, +0xD3, 0x9F, 0xE8, 0x9E, 0x40, 0x26, 0x90, 0x82, 0x7B, 0xE0, 0xFE, 0xA3, 0xE0, 0xFF, 0x90, 0x80, +0xF5, 0xE0, 0xF8, 0xA3, 0xE0, 0x24, 0x01, 0xF5, 0x82, 0xE4, 0x38, 0xF5, 0x83, 0xC3, 0xEF, 0x95, +0x82, 0xFF, 0xEE, 0x95, 0x83, 0x90, 0x82, 0x7B, 0xF0, 0xA3, 0xEF, 0xF0, 0xED, 0x30, 0xE7, 0x06, +0x90, 0x01, 0xC7, 0x74, 0x21, 0xF0, 0xED, 0x30, 0xE6, 0x06, 0x90, 0x01, 0xC7, 0x74, 0x22, 0xF0, +0xED, 0x30, 0xE5, 0x06, 0x90, 0x01, 0xC7, 0x74, 0x23, 0xF0, 0x90, 0x82, 0x7F, 0xE0, 0x24, 0x40, +0x60, 0x04, 0x24, 0x20, 0x70, 0x20, 0x90, 0x81, 0x54, 0xE0, 0xFF, 0xC4, 0x13, 0x13, 0x13, 0x54, +0x01, 0x30, 0xE0, 0x64, 0xAF, 0x02, 0x12, 0x75, 0xD9, 0xEF, 0x60, 0x5C, 0x90, 0x82, 0x7F, 0xE0, +0xFF, 0x12, 0x75, 0xC2, 0x80, 0x52, 0x90, 0x82, 0x7D, 0xE0, 0xFE, 0xA3, 0xE0, 0xFF, 0x90, 0x82, +0x83, 0xE0, 0xFD, 0x90, 0x82, 0x82, 0xE0, 0xFB, 0x90, 0x82, 0x84, 0xE0, 0x90, 0x82, 0x8F, 0xF0, +0xB1, 0xC2, 0x90, 0x81, 0x53, 0xE0, 0xC3, 0x13, 0x30, 0xE0, 0x10, 0x90, 0x82, 0x7D, 0xE0, 0xFE, +0xA3, 0xE0, 0xFF, 0x90, 0x82, 0x83, 0xE0, 0xFD, 0x12, 0x76, 0x14, 0x90, 0x81, 0x53, 0xE0, 0xFF, +0xC4, 0x13, 0x13, 0x13, 0x54, 0x01, 0x30, 0xE0, 0x0F, 0x90, 0x82, 0x7D, 0xE0, 0xFE, 0xA3, 0xE0, +0xFF, 0x90, 0x82, 0x83, 0xE0, 0xFD, 0xD1, 0x9D, 0x90, 0x81, 0x58, 0xE0, 0x20, 0xE0, 0x07, 0x90, +0x01, 0x3F, 0xE0, 0x30, 0xE2, 0x02, 0x31, 0x7A, 0x12, 0x75, 0x9C, 0xEF, 0x64, 0x01, 0x70, 0x3D, +0xF1, 0xD8, 0x90, 0x82, 0x8A, 0xEF, 0xF0, 0x64, 0x01, 0x60, 0x25, 0x90, 0x81, 0x58, 0xE0, 0x44, +0x01, 0xF0, 0x90, 0x82, 0x8A, 0xE0, 0xFF, 0xB4, 0x02, 0x08, 0x90, 0x01, 0xC7, 0x74, 0x42, 0xF0, +0x80, 0x0A, 0xEF, 0xB4, 0x04, 0x06, 0x90, 0x01, 0xC7, 0x74, 0x43, 0xF0, 0x31, 0x7A, 0x80, 0x0D, +0x90, 0x82, 0x7B, 0xF1, 0xC5, 0x90, 0x82, 0x80, 0xE0, 0x04, 0xF0, 0x61, 0xC1, 0xD0, 0xD0, 0x92, +0xAF, 0x22, 0x90, 0x82, 0x8D, 0xED, 0xF0, 0xA3, 0xEB, 0xF0, 0x90, 0x82, 0x8B, 0xEE, 0xF0, 0xA3, +0xEF, 0xF0, 0xE4, 0xFD, 0xD1, 0x5F, 0xEF, 0x54, 0x0C, 0x64, 0x08, 0x70, 0x6F, 0x90, 0x82, 0x8B, +0xE0, 0xFE, 0xA3, 0xE0, 0xFF, 0xA3, 0xE0, 0x24, 0x06, 0xFD, 0xD1, 0x5F, 0xEF, 0x64, 0x88, 0x70, +0x5B, 0x90, 0x82, 0x8B, 0xE0, 0xFE, 0xA3, 0xE0, 0xFF, 0xA3, 0xE0, 0x24, 0x07, 0xFD, 0xD1, 0x5F, +0xEF, 0x64, 0x8E, 0x70, 0x47, 0x90, 0x82, 0x8B, 0xE0, 0xFE, 0xA3, 0xE0, 0xFF, 0x90, 0x82, 0x8E, +0xE0, 0xFD, 0x90, 0x82, 0x8D, 0xE0, 0x2D, 0x04, 0xFD, 0xD1, 0x5F, 0xEF, 0x64, 0x03, 0x70, 0x2C, +0x90, 0x82, 0x8B, 0xE0, 0xFE, 0xA3, 0xE0, 0xFF, 0x90, 0x82, 0x8E, 0xE0, 0xFD, 0x90, 0x82, 0x8D, +0xE0, 0x2D, 0x24, 0x06, 0xFD, 0xD1, 0x5F, 0xEF, 0x90, 0x01, 0xC7, 0x30, 0xE3, 0x04, 0x74, 0x01, +0x80, 0x02, 0x74, 0x02, 0xF0, 0x90, 0x81, 0x58, 0xE0, 0x44, 0x01, 0xF0, 0x22, 0xFD, 0x90, 0x82, +0x8B, 0xE0, 0x34, 0x00, 0xFC, 0x7E, 0x00, 0xED, 0x2F, 0xFF, 0xEE, 0x3C, 0xFE, 0xE4, 0xFD, 0xAB, +0x07, 0xAA, 0x06, 0xED, 0x2B, 0xFB, 0xE4, 0x3A, 0xFA, 0xC3, 0x90, 0x80, 0xF6, 0xE0, 0x9B, 0x90, +0x80, 0xF5, 0xE0, 0x9A, 0x50, 0x13, 0xA3, 0xE0, 0x24, 0x01, 0xFF, 0x90, 0x80, 0xF5, 0xE0, 0x34, +0x00, 0xFE, 0xC3, 0xEB, 0x9F, 0xFB, 0xEA, 0x9E, 0xFA, 0xEA, 0x90, 0xFD, 0x11, 0xF0, 0xAF, 0x03, +0x74, 0x00, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0xFB, 0xF5, 0x83, 0xE0, 0xFF, 0x22, 0x90, 0x82, 0x8B, +0xEE, 0xF0, 0xA3, 0xEF, 0xF0, 0xA3, 0xED, 0xF0, 0x78, 0x8E, 0x7C, 0x82, 0x7D, 0x01, 0x7B, 0xFF, +0x7A, 0x40, 0x79, 0xCE, 0x7E, 0x00, 0x7F, 0x06, 0x12, 0x41, 0xD0, 0x78, 0x95, 0x7C, 0x82, 0x7D, +0x01, 0x7B, 0xFF, 0x7A, 0x40, 0x79, 0xD4, 0x7E, 0x00, 0x7F, 0x04, 0x12, 0x41, 0xD0, 0xE4, 0x90, +0x82, 0x94, 0xF0, 0x90, 0x82, 0x94, 0xE0, 0xFF, 0xC3, 0x94, 0x06, 0x50, 0x1F, 0x90, 0x82, 0x8C, +0xE0, 0x24, 0x04, 0xD1, 0x4D, 0x90, 0x82, 0x94, 0xE0, 0x24, 0x8E, 0xF5, 0x82, 0xE4, 0x34, 0x82, +0xF5, 0x83, 0xEF, 0xF0, 0x90, 0x82, 0x94, 0xE0, 0x04, 0xF0, 0x80, 0xD7, 0xE4, 0x90, 0x82, 0x94, +0xF0, 0x90, 0x82, 0x94, 0xE0, 0xFF, 0xC3, 0x94, 0x04, 0x50, 0x2E, 0x90, 0x82, 0x8D, 0xE0, 0xFD, +0x90, 0x82, 0x8C, 0xE0, 0x2D, 0xFD, 0x90, 0x82, 0x8B, 0xE0, 0x34, 0x00, 0xCD, 0x24, 0x18, 0xCD, +0xD1, 0x52, 0x90, 0x82, 0x94, 0xE0, 0x24, 0x95, 0xF5, 0x82, 0xE4, 0x34, 0x82, 0xF5, 0x83, 0xEF, +0xF0, 0x90, 0x82, 0x94, 0xE0, 0x04, 0xF0, 0x80, 0xC8, 0x78, 0x8E, 0x7C, 0x82, 0x7D, 0x01, 0x7B, +0x01, 0x7A, 0x81, 0x79, 0x59, 0x7E, 0x00, 0x7F, 0x06, 0x12, 0x44, 0x08, 0xEF, 0x70, 0x75, 0x90, +0x82, 0x8B, 0xE0, 0xFE, 0xA3, 0xE0, 0xFF, 0xE4, 0xFD, 0xD1, 0x5F, 0xEF, 0x54, 0x0C, 0x64, 0x08, +0x70, 0x62, 0x90, 0x82, 0x8D, 0xE0, 0xFF, 0x90, 0x82, 0x8C, 0xE0, 0x2F, 0xFF, 0x90, 0x82, 0x8B, +0xE0, 0x34, 0x00, 0xCF, 0x24, 0x06, 0xCF, 0x34, 0x00, 0xFE, 0xE4, 0xFD, 0xD1, 0x5F, 0xEF, 0x64, +0x08, 0x70, 0x41, 0x90, 0x82, 0x8D, 0xE0, 0xFF, 0x90, 0x82, 0x8C, 0xE0, 0x2F, 0xFF, 0x90, 0x82, +0x8B, 0xE0, 0x34, 0x00, 0xCF, 0x24, 0x07, 0xCF, 0x34, 0x00, 0xFE, 0xE4, 0xFD, 0xD1, 0x5F, 0xEF, +0x70, 0x22, 0x78, 0x95, 0x7C, 0x82, 0x7D, 0x01, 0x7B, 0x01, 0x7A, 0x81, 0x79, 0x6C, 0xFE, 0x7F, +0x04, 0x12, 0x44, 0x08, 0xEF, 0x70, 0x0D, 0x90, 0x01, 0xC7, 0x74, 0x22, 0xF0, 0x90, 0x81, 0x58, +0xE0, 0x44, 0x01, 0xF0, 0x22, 0xE0, 0xFE, 0xA3, 0xE0, 0xFF, 0x90, 0x02, 0x84, 0xEF, 0xF0, 0xEE, +0xA3, 0xF0, 0xA3, 0xE0, 0x44, 0x01, 0xF0, 0x22, 0x90, 0x02, 0x86, 0xE0, 0x20, 0xE2, 0x03, 0x7F, +0x04, 0x22, 0x90, 0x02, 0x86, 0xE0, 0x7F, 0x01, 0x20, 0xE1, 0x02, 0x7F, 0x02, 0x22, 0x90, 0x00, +0xF7, 0xE0, 0x20, 0xE7, 0x09, 0xE0, 0x7F, 0x01, 0x20, 0xE6, 0x0C, 0x7F, 0x02, 0x22, 0x90, 0x00, +0xF7, 0xE0, 0x30, 0xE6, 0x02, 0x7F, 0x03, 0x22, 0x12, 0x57, 0xEE, 0x90, 0x80, 0x05, 0xEF, 0xF0, +0x11, 0x1B, 0x90, 0x01, 0x64, 0x74, 0x01, 0xF0, 0x02, 0x2D, 0xA7, 0x11, 0x86, 0x11, 0xB6, 0x11, +0x48, 0x11, 0x67, 0xE4, 0xF5, 0x35, 0xF5, 0x36, 0xF5, 0x37, 0xF5, 0x38, 0xAD, 0x35, 0x7F, 0x50, +0x12, 0x32, 0x1E, 0xAD, 0x36, 0x7F, 0x51, 0x12, 0x32, 0x1E, 0xAD, 0x37, 0x7F, 0x52, 0x12, 0x32, +0x1E, 0xAD, 0x38, 0x7F, 0x53, 0x02, 0x32, 0x1E, 0x75, 0x3D, 0x10, 0xE4, 0xF5, 0x3E, 0x75, 0x3F, +0x07, 0x75, 0x40, 0x02, 0x90, 0x01, 0x30, 0xE5, 0x3D, 0xF0, 0xA3, 0xE5, 0x3E, 0xF0, 0xA3, 0xE5, +0x3F, 0xF0, 0xA3, 0xE5, 0x40, 0xF0, 0x22, 0x75, 0x45, 0x06, 0x75, 0x46, 0x01, 0x75, 0x47, 0x03, +0x75, 0x48, 0x62, 0x90, 0x01, 0x38, 0xE5, 0x45, 0xF0, 0xA3, 0xE5, 0x46, 0xF0, 0xA3, 0xE5, 0x47, +0xF0, 0xA3, 0xE5, 0x48, 0xF0, 0x22, 0x90, 0x01, 0x30, 0xE4, 0xF0, 0xA3, 0xF0, 0xA3, 0xF0, 0xA3, +0xF0, 0x90, 0x01, 0x38, 0xF0, 0xA3, 0xF0, 0xA3, 0xF0, 0xA3, 0xF0, 0xFD, 0x7F, 0x50, 0x12, 0x32, +0x1E, 0xE4, 0xFD, 0x7F, 0x51, 0x12, 0x32, 0x1E, 0xE4, 0xFD, 0x7F, 0x52, 0x12, 0x32, 0x1E, 0xE4, +0xFD, 0x7F, 0x53, 0x02, 0x32, 0x1E, 0x90, 0x01, 0x34, 0x74, 0xFF, 0xF0, 0xA3, 0xF0, 0xA3, 0xF0, +0xA3, 0xF0, 0x90, 0x01, 0x3C, 0xF0, 0xA3, 0xF0, 0xA3, 0xF0, 0xA3, 0xF0, 0xFD, 0x7F, 0x54, 0x12, +0x32, 0x1E, 0x7D, 0xFF, 0x7F, 0x55, 0x12, 0x32, 0x1E, 0x7D, 0xFF, 0x7F, 0x56, 0x12, 0x32, 0x1E, +0x7D, 0xFF, 0x7F, 0x57, 0x02, 0x32, 0x1E, 0x90, 0x01, 0xCF, 0xE0, 0x90, 0x83, 0x34, 0xF0, 0xE0, +0xFF, 0x30, 0xE0, 0x07, 0x90, 0x01, 0xCF, 0xE0, 0x54, 0xFE, 0xF0, 0xEF, 0x30, 0xE5, 0x22, 0x90, +0x01, 0xCF, 0xE0, 0x54, 0xDF, 0xF0, 0x90, 0x01, 0x34, 0x74, 0x20, 0xF0, 0xE4, 0xF5, 0xA8, 0xF5, +0xE8, 0x11, 0x86, 0x90, 0x00, 0x03, 0xE0, 0x54, 0xFB, 0xFD, 0x7F, 0x03, 0x12, 0x32, 0x1E, 0x80, +0xFE, 0x22, 0x90, 0x00, 0x80, 0xE0, 0x44, 0x80, 0xFD, 0x7F, 0x80, 0x12, 0x32, 0x1E, 0x90, 0xFD, +0x00, 0xE0, 0x54, 0xBF, 0xF0, 0xF1, 0xC5, 0x12, 0x32, 0x77, 0xF1, 0x8C, 0xF1, 0xB9, 0x7F, 0x01, +0x12, 0x45, 0x41, 0x90, 0x82, 0x64, 0x74, 0x02, 0xF0, 0xFF, 0x12, 0x45, 0x41, 0x90, 0x82, 0x64, +0xE0, 0x04, 0xF0, 0x11, 0x08, 0x31, 0x71, 0x90, 0x00, 0x80, 0xE0, 0x44, 0x40, 0xFD, 0x7F, 0x80, +0x12, 0x32, 0x1E, 0x75, 0x20, 0xFF, 0xF1, 0xA1, 0xF1, 0xA8, 0xF1, 0xAF, 0xE4, 0xFF, 0x02, 0x45, +0xCA, 0xF1, 0x8F, 0xF1, 0xD2, 0x12, 0x70, 0x81, 0x31, 0x94, 0x12, 0x73, 0x5C, 0x12, 0x65, 0x97, +0x90, 0x82, 0x6E, 0xE0, 0x54, 0x7F, 0xF0, 0x54, 0xBF, 0xF0, 0x54, 0xDF, 0xF0, 0x54, 0xF0, 0xF0, +0xE4, 0xA3, 0xF0, 0x22, 0x90, 0x81, 0x53, 0xE0, 0x54, 0xFE, 0xF0, 0x90, 0x81, 0x58, 0xE0, 0x54, +0xFE, 0xF0, 0xE4, 0x90, 0x81, 0x65, 0xF0, 0xA3, 0xF0, 0xA3, 0xF0, 0xA3, 0xF0, 0xA3, 0xF0, 0xA3, +0xF0, 0xA3, 0xF0, 0x90, 0x06, 0x90, 0xE0, 0x44, 0x20, 0xF0, 0x90, 0x81, 0x54, 0xE0, 0x54, 0xFE, +0xF0, 0x54, 0xFD, 0xF0, 0x54, 0xFB, 0xF0, 0x54, 0xF7, 0xF0, 0x54, 0xEF, 0xF0, 0x54, 0xDF, 0xF0, +0x54, 0xBF, 0xF0, 0x54, 0x7F, 0xF0, 0xA3, 0xE0, 0x54, 0x80, 0xF0, 0xE4, 0xA3, 0xF0, 0xA3, 0xE0, +0x54, 0xFE, 0xF0, 0x90, 0x81, 0x55, 0xE0, 0x54, 0x7F, 0xF0, 0x90, 0x81, 0x57, 0xE0, 0x54, 0xFD, +0xF0, 0x22, 0xEF, 0x60, 0x57, 0x90, 0x04, 0xEC, 0xE0, 0x54, 0xDD, 0xF0, 0x90, 0x82, 0x57, 0xE0, +0xFF, 0x60, 0x02, 0x51, 0x6D, 0x90, 0x01, 0xC7, 0xE4, 0xF0, 0x90, 0x01, 0x17, 0xE0, 0xFE, 0x90, +0x01, 0x16, 0xE0, 0x7C, 0x00, 0x24, 0x00, 0xFF, 0xEC, 0x3E, 0x90, 0x80, 0xF5, 0xF0, 0xA3, 0xEF, +0xF0, 0x90, 0x06, 0x09, 0xE0, 0x54, 0xFE, 0xF0, 0x91, 0xFE, 0x90, 0x02, 0x86, 0xE0, 0x44, 0x04, +0xF0, 0x91, 0xC3, 0xF1, 0x8D, 0x12, 0x4B, 0xA7, 0x90, 0x05, 0x22, 0xE4, 0xF0, 0x12, 0x78, 0xB3, +0x90, 0x01, 0x34, 0x74, 0x08, 0xF0, 0xFD, 0xE4, 0xFF, 0x02, 0x50, 0xC2, 0x90, 0x04, 0xEC, 0xE0, +0x44, 0x22, 0xF0, 0x7D, 0x08, 0xE4, 0xFF, 0x51, 0x95, 0x90, 0x06, 0x90, 0xE0, 0x54, 0xF0, 0xF0, +0x90, 0x02, 0x86, 0xE0, 0x54, 0xFB, 0xF0, 0x91, 0x70, 0xF1, 0x8E, 0x21, 0x94, 0xD1, 0x61, 0x7E, +0x00, 0x74, 0x00, 0x2F, 0xF9, 0xE4, 0x34, 0xFC, 0x75, 0x13, 0x01, 0xF5, 0x14, 0x89, 0x15, 0x75, +0x16, 0x08, 0x7B, 0x01, 0x7A, 0x81, 0x79, 0x71, 0x02, 0x2B, 0xED, 0x7D, 0x02, 0x7F, 0x02, 0x51, +0x95, 0x7D, 0x01, 0x7F, 0x02, 0x74, 0x3D, 0x2F, 0xF8, 0xE6, 0xFE, 0xED, 0xF4, 0x5E, 0xFE, 0xF6, +0x74, 0x30, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x01, 0xF5, 0x83, 0xEE, 0xF0, 0x22, 0x90, 0x82, 0x6D, +0xE0, 0x04, 0xF0, 0x90, 0x81, 0x3E, 0xE0, 0x64, 0x02, 0x60, 0x28, 0x71, 0xB7, 0x90, 0x81, 0x39, +0xE0, 0x13, 0x13, 0x13, 0x54, 0x1F, 0x30, 0xE0, 0x14, 0x90, 0x81, 0x41, 0xE0, 0xFF, 0xA3, 0xE0, +0x6F, 0x70, 0x0A, 0x91, 0x4C, 0x51, 0x8B, 0x90, 0x81, 0x42, 0xE0, 0x14, 0xF0, 0x90, 0x01, 0xE6, +0xE0, 0x04, 0xF0, 0x22, 0xEF, 0x70, 0x34, 0x7D, 0x78, 0x7F, 0x02, 0x51, 0x95, 0x7D, 0x02, 0x7F, +0x03, 0x51, 0x95, 0x7D, 0xC8, 0x7F, 0x02, 0x12, 0x70, 0x07, 0x90, 0x01, 0x57, 0xE4, 0xF0, 0x90, +0x01, 0x3C, 0x74, 0x02, 0xF0, 0x7D, 0x01, 0x7F, 0x0C, 0x12, 0x49, 0x14, 0x90, 0x81, 0x38, 0xE0, +0x54, 0xF7, 0xF0, 0x90, 0x06, 0x0A, 0xE0, 0x54, 0xF8, 0xF0, 0x22, 0x90, 0x01, 0x36, 0x74, 0x78, +0xF0, 0xA3, 0x74, 0x02, 0xF0, 0x7D, 0x78, 0xFF, 0x12, 0x50, 0xC2, 0x7D, 0x02, 0x7F, 0x03, 0x12, +0x50, 0xC2, 0x90, 0x06, 0x0A, 0xE0, 0x44, 0x07, 0xF0, 0x90, 0x81, 0x46, 0xA3, 0xE0, 0x90, 0x05, +0x58, 0xF0, 0x90, 0x80, 0xF7, 0xE0, 0xB4, 0x01, 0x15, 0x90, 0x81, 0x39, 0xE0, 0x54, 0xFB, 0xF0, +0x90, 0x81, 0x3E, 0xE0, 0x20, 0xE2, 0x0E, 0x7D, 0x01, 0x7F, 0x04, 0x02, 0x49, 0x14, 0x90, 0x81, +0x39, 0xE0, 0x44, 0x04, 0xF0, 0x22, 0x90, 0x81, 0x3B, 0xE0, 0x60, 0x45, 0x90, 0x81, 0x39, 0xE0, +0xFF, 0x13, 0x13, 0x13, 0x54, 0x1F, 0x30, 0xE0, 0x12, 0x90, 0x01, 0x3B, 0xE0, 0x30, 0xE4, 0x0B, +0x51, 0x8B, 0x90, 0x81, 0x41, 0xE0, 0x14, 0x90, 0x05, 0x73, 0xF0, 0x90, 0x83, 0x25, 0xE4, 0x75, +0xF0, 0x01, 0x12, 0x41, 0xF6, 0xC3, 0x90, 0x83, 0x26, 0xE0, 0x94, 0x80, 0x90, 0x83, 0x25, 0xE0, +0x64, 0x80, 0x94, 0x80, 0x40, 0x0B, 0x90, 0x01, 0x98, 0xE0, 0x54, 0xFE, 0xF0, 0xE0, 0x44, 0x01, +0xF0, 0x12, 0x78, 0xEB, 0x02, 0x50, 0x8C, 0x90, 0x80, 0xF7, 0xE0, 0x64, 0x01, 0x60, 0x02, 0x81, +0x4B, 0x90, 0x81, 0x3B, 0xE0, 0x70, 0x02, 0x81, 0x4B, 0x90, 0x81, 0x3A, 0xE0, 0xC4, 0x54, 0x0F, +0x64, 0x01, 0x70, 0x22, 0x90, 0x06, 0xAB, 0xE0, 0x90, 0x81, 0x42, 0xF0, 0x90, 0x06, 0xAA, 0xE0, +0x90, 0x81, 0x41, 0xF0, 0xA3, 0xE0, 0xFF, 0x70, 0x08, 0x90, 0x81, 0x41, 0xE0, 0xFE, 0xFF, 0x80, +0x00, 0x90, 0x81, 0x42, 0xEF, 0xF0, 0x90, 0x81, 0x39, 0xE0, 0x44, 0x04, 0xF0, 0xE4, 0x90, 0x81, +0x44, 0xF0, 0x90, 0x81, 0x46, 0xA3, 0xE0, 0x90, 0x05, 0x58, 0xF0, 0x90, 0x01, 0x57, 0xE4, 0xF0, +0x90, 0x01, 0x3C, 0x74, 0x02, 0xF0, 0x90, 0x81, 0x3F, 0xE0, 0x54, 0xFD, 0xF0, 0x54, 0xEF, 0xF0, +0x90, 0x81, 0x3A, 0xE0, 0xFF, 0xC4, 0x54, 0x0F, 0x24, 0xFD, 0x50, 0x02, 0x80, 0x03, 0x12, 0x4E, +0x43, 0x90, 0x81, 0x39, 0xE0, 0x13, 0x13, 0x13, 0x54, 0x1F, 0x30, 0xE0, 0x0E, 0x90, 0x81, 0x41, +0xE0, 0xFF, 0xA3, 0xE0, 0xB5, 0x07, 0x04, 0x91, 0x4C, 0x51, 0x91, 0x22, 0xEF, 0x14, 0x90, 0x05, +0x73, 0xF0, 0x90, 0x01, 0x3F, 0x74, 0x10, 0xF0, 0xFD, 0x7F, 0x03, 0x74, 0x45, 0x2F, 0xF8, 0xE6, +0x4D, 0xFE, 0xF6, 0x74, 0x38, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x01, 0xF5, 0x83, 0xEE, 0xF0, 0x22, +0x31, 0xBA, 0x90, 0x01, 0x3F, 0x74, 0x04, 0xF0, 0x90, 0x80, 0x05, 0xE0, 0xFF, 0xB4, 0x01, 0x07, +0x90, 0xFD, 0x00, 0xE0, 0x54, 0xEF, 0xF0, 0xEF, 0xB4, 0x01, 0x07, 0x90, 0xFE, 0x10, 0xE0, 0x54, +0xFB, 0xF0, 0x22, 0x90, 0x82, 0x7E, 0x12, 0x42, 0x53, 0x12, 0x71, 0x53, 0x90, 0x81, 0x3B, 0xE0, +0xFF, 0x51, 0xE4, 0x90, 0x81, 0x3B, 0xE0, 0x60, 0x19, 0x90, 0x82, 0x7E, 0x12, 0x42, 0x4A, 0x90, +0x00, 0x01, 0x12, 0x1F, 0xBD, 0x54, 0x0F, 0xFF, 0x90, 0x00, 0x02, 0x12, 0x1F, 0xBD, 0xFD, 0x12, +0x71, 0xFC, 0x22, 0x12, 0x57, 0xD8, 0xAD, 0x07, 0xEF, 0x64, 0x01, 0x60, 0x20, 0x90, 0x81, 0x58, +0xE0, 0x44, 0x01, 0xF0, 0xED, 0xB4, 0x02, 0x08, 0x90, 0x01, 0xC7, 0x74, 0x40, 0xF0, 0x80, 0x0A, +0xED, 0xB4, 0x04, 0x06, 0x90, 0x01, 0xC7, 0x74, 0x41, 0xF0, 0x02, 0x51, 0x7A, 0x12, 0x73, 0x97, +0x90, 0x02, 0x87, 0xE0, 0x70, 0xF7, 0x90, 0x06, 0x90, 0xE0, 0x44, 0x02, 0xF0, 0x22, 0x90, 0x05, +0x22, 0x74, 0xFF, 0xF0, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x12, 0x6F, 0xBF, 0x90, 0x85, +0xBB, 0x12, 0x20, 0xDA, 0xCC, 0xF0, 0x00, 0xC0, 0x7F, 0x8C, 0x7E, 0x08, 0x12, 0x2E, 0xA2, 0x90, +0x85, 0xBB, 0x12, 0x20, 0xDA, 0x00, 0x00, 0x00, 0x14, 0x7F, 0x70, 0x7E, 0x0E, 0x12, 0x2E, 0xA2, +0x90, 0x83, 0x03, 0x12, 0x20, 0xDA, 0x00, 0x00, 0x00, 0x00, 0xE4, 0xFD, 0xFF, 0x12, 0x4F, 0x74, +0x7F, 0x7C, 0x7E, 0x08, 0x12, 0x2D, 0x5C, 0xEC, 0x44, 0x80, 0xFC, 0x90, 0x83, 0x15, 0x12, 0x20, +0xCE, 0x90, 0x83, 0x15, 0x12, 0x42, 0x26, 0x90, 0x85, 0xBB, 0x12, 0x20, 0xCE, 0x7F, 0x7C, 0x7E, +0x08, 0x12, 0x2E, 0xA2, 0x90, 0x01, 0x00, 0x74, 0x3F, 0xF0, 0xA3, 0xE0, 0x54, 0xFD, 0xF0, 0x90, +0x05, 0x53, 0xE0, 0x44, 0x20, 0xF0, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, +0xC0, 0xD0, 0x12, 0x1F, 0xA4, 0xFF, 0x54, 0x01, 0xFE, 0x90, 0x81, 0x53, 0xE0, 0x54, 0xFE, 0x4E, +0xFE, 0xF0, 0xEF, 0x54, 0x02, 0xFF, 0xEE, 0x54, 0xFD, 0x4F, 0xFF, 0xF0, 0x12, 0x1F, 0xA4, 0xFE, +0x54, 0x04, 0xFD, 0xEF, 0x54, 0xFB, 0x4D, 0xFF, 0x90, 0x81, 0x53, 0xF0, 0xEE, 0x54, 0x08, 0xFE, +0xEF, 0x54, 0xF7, 0x4E, 0xFF, 0xF0, 0x12, 0x1F, 0xA4, 0xFE, 0x54, 0x10, 0xFD, 0xEF, 0x54, 0xEF, +0x4D, 0xFF, 0x90, 0x81, 0x53, 0xF0, 0xEE, 0x54, 0x20, 0xFE, 0xEF, 0x54, 0xDF, 0x4E, 0xFF, 0xF0, +0x12, 0x1F, 0xA4, 0xFE, 0x54, 0x40, 0xFD, 0xEF, 0x54, 0xBF, 0x4D, 0xFF, 0x90, 0x81, 0x53, 0xF0, +0xEE, 0x54, 0x80, 0xFE, 0xEF, 0x54, 0x7F, 0x4E, 0xF0, 0x90, 0x01, 0x17, 0xE0, 0xFE, 0x90, 0x01, +0x16, 0xE0, 0x7C, 0x00, 0x24, 0x00, 0xFF, 0xEC, 0x3E, 0x90, 0x80, 0xF5, 0xF0, 0xA3, 0xEF, 0xF0, +0x90, 0x81, 0x53, 0xE0, 0xC3, 0x13, 0x54, 0x01, 0xFF, 0xD1, 0x2E, 0x90, 0x81, 0x53, 0xE0, 0x13, +0x13, 0x54, 0x01, 0xFF, 0xF1, 0x95, 0x90, 0x81, 0x53, 0xE0, 0xC4, 0x54, 0x01, 0xFF, 0xF1, 0x9B, +0x90, 0x81, 0x53, 0xE0, 0x54, 0x01, 0xFF, 0x31, 0xF2, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0xEF, 0x60, +0x07, 0x90, 0x82, 0x58, 0xE0, 0xFF, 0xD1, 0x39, 0x22, 0xD1, 0x61, 0x7E, 0x00, 0x90, 0x83, 0x2F, +0xD1, 0x75, 0x90, 0x83, 0x2F, 0xA3, 0xE0, 0x2F, 0x24, 0x36, 0xF9, 0xE4, 0x34, 0xFC, 0x75, 0x13, +0x01, 0xF5, 0x14, 0x89, 0x15, 0x75, 0x16, 0x04, 0x7B, 0x01, 0x7A, 0x81, 0x79, 0x6C, 0x02, 0x2B, +0xED, 0xE4, 0xFE, 0xEF, 0xC3, 0x13, 0xFD, 0xEF, 0x30, 0xE0, 0x02, 0x7E, 0x80, 0x90, 0xFD, 0x10, +0xED, 0xF0, 0xAF, 0x06, 0x22, 0xEE, 0xF0, 0xA3, 0xEF, 0xF0, 0xFE, 0x24, 0x20, 0xF5, 0x82, 0xE4, +0x34, 0xFC, 0xF5, 0x83, 0xE0, 0xFF, 0x74, 0x24, 0x2E, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, +0xE0, 0xFD, 0xE4, 0xFE, 0xEF, 0x30, 0xE7, 0x04, 0x7C, 0x02, 0x80, 0x02, 0xE4, 0xFC, 0xAF, 0x05, +0xF1, 0x4D, 0xAE, 0x07, 0xEC, 0x24, 0x18, 0x2E, 0xFF, 0x22, 0x90, 0x83, 0x0A, 0xED, 0xF0, 0x90, +0x83, 0x07, 0x12, 0x42, 0x53, 0xE4, 0x90, 0x83, 0x0B, 0xF0, 0xA3, 0xF0, 0x12, 0x1F, 0xA4, 0xFF, +0x90, 0x00, 0x04, 0x12, 0x1F, 0xBD, 0xFD, 0xD1, 0x92, 0x90, 0x83, 0x0B, 0xEF, 0xF0, 0x90, 0x83, +0x07, 0x12, 0x42, 0x4A, 0x90, 0x00, 0x04, 0x12, 0x1F, 0xBD, 0xFF, 0xF1, 0x4D, 0x90, 0x83, 0x0C, +0xEF, 0xF0, 0x90, 0x81, 0x70, 0xE0, 0x24, 0xFE, 0x60, 0x1E, 0x24, 0xFE, 0x60, 0x1A, 0x14, 0x60, +0x07, 0x14, 0x60, 0x04, 0x24, 0x05, 0x70, 0x54, 0x7B, 0x01, 0x7A, 0x81, 0x79, 0x71, 0x90, 0x83, +0x0A, 0xE0, 0xFD, 0x12, 0x7A, 0x4B, 0x80, 0x16, 0x7B, 0x01, 0x7A, 0x81, 0x79, 0x71, 0x90, 0x83, +0x0A, 0xE0, 0xFD, 0x90, 0x81, 0x70, 0xE0, 0x90, 0x82, 0xE5, 0xF0, 0x12, 0x79, 0x29, 0x90, 0x83, +0x0C, 0xE0, 0xFF, 0x90, 0x83, 0x07, 0x12, 0x42, 0x4A, 0x90, 0x83, 0x0B, 0xE0, 0x7C, 0x00, 0x29, +0xF9, 0xEC, 0x3A, 0xFA, 0xC3, 0xE9, 0x9F, 0xF9, 0xEA, 0x94, 0x00, 0xFA, 0x75, 0x13, 0x01, 0x75, +0x14, 0x81, 0x75, 0x15, 0x71, 0xA3, 0xE0, 0xF5, 0x16, 0x12, 0x2B, 0xED, 0x22, 0xD3, 0x10, 0xAF, +0x01, 0xC3, 0xC0, 0xD0, 0xEF, 0x20, 0xE0, 0x05, 0x90, 0x82, 0x55, 0x80, 0x03, 0x90, 0x82, 0x56, +0xE0, 0x90, 0x81, 0x70, 0xF0, 0x90, 0x81, 0x70, 0xE0, 0x14, 0x60, 0x13, 0x14, 0x60, 0x14, 0x24, +0xFE, 0x60, 0x10, 0x14, 0x60, 0x09, 0x14, 0x60, 0x06, 0x24, 0x06, 0xE4, 0xFE, 0x80, 0x06, 0x7E, +0x04, 0x80, 0x02, 0x7E, 0x08, 0xAF, 0x06, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x22, 0x22, 0x22, 0xE4, +0x90, 0x80, 0xF7, 0xF0, 0x22, 0x90, 0x82, 0x7E, 0xEF, 0xF0, 0x22, 0x90, 0x82, 0x7E, 0xEF, 0xF0, +0x22, 0x75, 0xE8, 0x03, 0x75, 0xA8, 0x84, 0x22, 0x90, 0x01, 0xC7, 0x74, 0x05, 0xF0, 0x22, 0x90, +0x01, 0xE4, 0x74, 0x0D, 0xF0, 0xA3, 0xE4, 0xF0, 0x22, 0xE4, 0x90, 0x80, 0x01, 0xF0, 0xA3, 0xF0, +0xA3, 0xF0, 0xA3, 0xF0, 0x22, 0x90, 0x01, 0x94, 0xE0, 0x44, 0x01, 0xF0, 0x90, 0x01, 0xC7, 0xE4, +0xF0, 0x22, 0xE4, 0x90, 0x80, 0xF3, 0xF0, 0xA3, 0xF0, 0x90, 0x80, 0x5B, 0xF0, 0xA3, 0xF0, 0x22, +0xE4, 0x90, 0x82, 0x76, 0xF0, 0x90, 0x82, 0x76, 0xE0, 0x64, 0x01, 0xF0, 0x24, 0xE0, 0x90, 0x01, +0xC4, 0xF0, 0x74, 0x5F, 0xA3, 0xF0, 0x90, 0x81, 0x3B, 0xE0, 0x60, 0x0F, 0x90, 0x81, 0x3E, 0xE0, +0xFF, 0x90, 0x81, 0x3D, 0xE0, 0x6F, 0x60, 0x03, 0x12, 0x4E, 0x3A, 0xC2, 0xAF, 0x51, 0xC6, 0xBF, +0x01, 0x02, 0x31, 0xDF, 0xD2, 0xAF, 0x11, 0x1D, 0x12, 0x44, 0x79, 0x80, 0xC8, 0xD3, 0x10, 0xAF, +0x01, 0xC3, 0xC0, 0xD0, 0x90, 0x00, 0x8F, 0xE0, 0x20, 0xE6, 0x02, 0x21, 0xAF, 0x90, 0x00, 0x8C, +0xE0, 0x90, 0x82, 0x77, 0xF0, 0x90, 0x00, 0x8D, 0xE0, 0x90, 0x82, 0x78, 0xF0, 0x90, 0x00, 0x8E, +0xE0, 0x90, 0x82, 0x79, 0xF0, 0x90, 0x82, 0x78, 0xE0, 0x24, 0xF1, 0x70, 0x02, 0x21, 0x0E, 0x24, +0x07, 0x60, 0x02, 0x21, 0xA1, 0x90, 0x81, 0x3B, 0xE0, 0xFB, 0xE4, 0xFD, 0xFF, 0x31, 0xB7, 0x90, +0x81, 0x3A, 0xE0, 0x54, 0x0F, 0xFB, 0x0D, 0x31, 0xB7, 0x90, 0x81, 0x3D, 0x31, 0xB4, 0x90, 0x81, +0x3E, 0xE0, 0xFB, 0x0D, 0x31, 0xB7, 0x90, 0x82, 0x77, 0xE0, 0x24, 0xF7, 0xF5, 0x82, 0xE4, 0x34, +0x80, 0xF5, 0x83, 0xE0, 0xFB, 0xE4, 0xFD, 0x0F, 0x31, 0xB7, 0x90, 0x81, 0x38, 0xE0, 0x54, 0x01, +0xFB, 0x0D, 0x31, 0xB7, 0x90, 0x81, 0x38, 0xE0, 0xC4, 0x13, 0x13, 0x54, 0x01, 0xFB, 0x0D, 0x7F, +0x01, 0x31, 0xB7, 0x90, 0x81, 0x38, 0xE0, 0xC4, 0x13, 0x13, 0x13, 0x54, 0x01, 0xFB, 0x0D, 0x7F, +0x01, 0x31, 0xB7, 0x90, 0x80, 0x03, 0xE0, 0xFB, 0xE4, 0xFD, 0x0F, 0x31, 0xB7, 0x90, 0x80, 0x04, +0xE0, 0xFB, 0x0D, 0x31, 0xB7, 0x90, 0x81, 0x42, 0xE0, 0xFB, 0x0D, 0x31, 0xB7, 0x90, 0x81, 0x41, +0xE0, 0xFB, 0x0D, 0x31, 0xB7, 0x90, 0x81, 0x3A, 0xE0, 0xC4, 0x54, 0x0F, 0xFB, 0xE4, 0xFD, 0x7F, +0x03, 0x31, 0xB7, 0x90, 0x81, 0x39, 0xE0, 0x13, 0x13, 0x54, 0x01, 0xFB, 0x0D, 0x7F, 0x03, 0x31, +0xB7, 0x90, 0x81, 0x39, 0xE0, 0x13, 0x13, 0x13, 0x54, 0x01, 0xFB, 0x0D, 0x7F, 0x03, 0x31, 0xB7, +0x90, 0x81, 0x38, 0xE0, 0x13, 0x13, 0x54, 0x01, 0xFB, 0x0D, 0x7F, 0x03, 0x21, 0x9F, 0x90, 0x81, +0x53, 0xE0, 0x54, 0x01, 0xFB, 0xE4, 0xFD, 0xFF, 0x31, 0xB7, 0x90, 0x81, 0x54, 0xE0, 0xC4, 0x13, +0x13, 0x13, 0x54, 0x01, 0xFB, 0x0D, 0xE4, 0xFF, 0x31, 0xB7, 0x90, 0x81, 0x54, 0xE0, 0xC4, 0x54, +0x01, 0xFB, 0x0D, 0xE4, 0xFF, 0x31, 0xB7, 0x90, 0x81, 0x58, 0xE0, 0x54, 0x01, 0xFB, 0x0D, 0x31, +0xB7, 0x90, 0x81, 0x65, 0xE0, 0xFB, 0xE4, 0xFD, 0x0F, 0x31, 0xB7, 0x90, 0x81, 0x66, 0xE0, 0xFB, +0x0D, 0x31, 0xB7, 0x90, 0x81, 0x67, 0xE0, 0xFB, 0x0D, 0x31, 0xB7, 0x90, 0x81, 0x68, 0xE0, 0xFB, +0x0D, 0x31, 0xB7, 0x90, 0x81, 0x69, 0xE0, 0xFB, 0xE4, 0xFD, 0x0F, 0x31, 0xB7, 0x90, 0x81, 0x6A, +0xE0, 0xFB, 0x0D, 0x31, 0xB7, 0x90, 0x81, 0x6B, 0xE0, 0xFB, 0x0D, 0x31, 0xB7, 0x90, 0x82, 0x5A, +0xE0, 0xFB, 0x0D, 0x31, 0xB7, 0x90, 0x80, 0x07, 0xE0, 0xFB, 0xE4, 0xFD, 0x0F, 0x31, 0xB7, 0x90, +0x80, 0x08, 0xE0, 0xFB, 0x0D, 0x31, 0xB7, 0x90, 0x82, 0x58, 0x31, 0xB4, 0xE4, 0xFB, 0x0D, 0x31, +0xB7, 0x90, 0x00, 0x8F, 0xE0, 0x30, 0xE0, 0x07, 0xE4, 0xFD, 0x7F, 0x8D, 0x12, 0x32, 0x1E, 0xD0, +0xD0, 0x92, 0xAF, 0x22, 0xE0, 0xFB, 0x0D, 0xEF, 0x70, 0x04, 0x74, 0xF0, 0x80, 0x16, 0xEF, 0xB4, +0x01, 0x04, 0x74, 0xF4, 0x80, 0x0E, 0xEF, 0xB4, 0x02, 0x04, 0x74, 0xF8, 0x80, 0x06, 0xEF, 0xB4, +0x03, 0x0C, 0x74, 0xFC, 0x2D, 0xF5, 0x82, 0xE4, 0x34, 0x02, 0xF5, 0x83, 0xEB, 0xF0, 0x22, 0x90, +0x81, 0x38, 0xE0, 0x30, 0xE0, 0x02, 0x31, 0xE9, 0x22, 0x90, 0x81, 0x3E, 0xE0, 0xFF, 0x60, 0x03, +0xB4, 0x08, 0x0D, 0x51, 0xED, 0xBF, 0x01, 0x08, 0x51, 0x01, 0x90, 0x01, 0xE5, 0xE0, 0x04, 0xF0, +0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x51, 0x79, 0x51, 0x11, 0xD0, 0xD0, 0x92, 0xAF, +0x22, 0x51, 0xBE, 0x90, 0x00, 0x08, 0xE0, 0x54, 0xEF, 0xFD, 0x7F, 0x08, 0x12, 0x32, 0x1E, 0xE4, +0xFF, 0x8F, 0x0F, 0xE4, 0x90, 0x82, 0x77, 0xF0, 0xA3, 0xF0, 0x90, 0x01, 0x09, 0xE0, 0x7F, 0x00, +0x30, 0xE7, 0x02, 0x7F, 0x01, 0xEF, 0x65, 0x0F, 0x60, 0x3E, 0xC3, 0x90, 0x82, 0x78, 0xE0, 0x94, +0x88, 0x90, 0x82, 0x77, 0xE0, 0x94, 0x13, 0x40, 0x08, 0x90, 0x01, 0xC0, 0xE0, 0x44, 0x10, 0xF0, +0x22, 0x90, 0x82, 0x77, 0xE4, 0x75, 0xF0, 0x01, 0x12, 0x41, 0xF6, 0x7F, 0x14, 0x7E, 0x00, 0x12, +0x32, 0xAA, 0xD3, 0x90, 0x82, 0x78, 0xE0, 0x94, 0x32, 0x90, 0x82, 0x77, 0xE0, 0x94, 0x00, 0x40, +0xB9, 0x90, 0x01, 0xC6, 0xE0, 0x30, 0xE0, 0xB2, 0x22, 0x90, 0x81, 0x45, 0xE0, 0xFD, 0x7F, 0x93, +0x12, 0x32, 0x1E, 0x90, 0x81, 0x3C, 0xE0, 0x60, 0x12, 0x90, 0x01, 0x2F, 0xE0, 0x30, 0xE7, 0x05, +0x74, 0x10, 0xF0, 0x80, 0x06, 0x90, 0x01, 0x2F, 0x74, 0x90, 0xF0, 0x90, 0x00, 0x08, 0xE0, 0x44, +0x10, 0xFD, 0x7F, 0x08, 0x12, 0x32, 0x1E, 0x7F, 0x01, 0x51, 0x21, 0x90, 0x00, 0x90, 0xE0, 0x44, +0x01, 0xFD, 0x7F, 0x90, 0x12, 0x32, 0x1E, 0x7F, 0x14, 0x7E, 0x00, 0x02, 0x32, 0xAA, 0x90, 0x00, +0x90, 0xE0, 0x20, 0xE0, 0xF9, 0x22, 0x7F, 0x02, 0x90, 0x82, 0x64, 0xE0, 0xFE, 0xEF, 0xC3, 0x9E, +0x50, 0x18, 0xEF, 0x25, 0xE0, 0x24, 0x81, 0xF8, 0xE6, 0x30, 0xE4, 0x0B, 0x90, 0x01, 0xB8, 0x74, +0x08, 0xF0, 0xA3, 0xF0, 0x7F, 0x00, 0x22, 0x0F, 0x80, 0xDE, 0x7F, 0x01, 0x22, 0x90, 0x02, 0x87, +0xE0, 0x60, 0x08, 0x90, 0x01, 0xB8, 0x74, 0x01, 0xF0, 0x80, 0x3B, 0x90, 0x81, 0x53, 0xE0, 0x30, +0xE0, 0x0E, 0x90, 0x02, 0x82, 0xE0, 0x60, 0x08, 0x90, 0x01, 0xB8, 0x74, 0x02, 0xF0, 0x80, 0x26, +0x90, 0x81, 0x58, 0xE0, 0x30, 0xE0, 0x08, 0x90, 0x01, 0xB8, 0x74, 0x08, 0xF0, 0x80, 0x17, 0x90, +0x02, 0x86, 0xE0, 0x20, 0xE1, 0x08, 0x90, 0x01, 0xB8, 0x74, 0x04, 0xF0, 0x80, 0x08, 0x90, 0x01, +0xB8, 0xE4, 0xF0, 0x7F, 0x01, 0x22, 0x90, 0x01, 0xB9, 0x74, 0x08, 0xF0, 0x7F, 0x00, 0x22, 0xE4, +0xFB, 0xFA, 0xFD, 0x7F, 0x01, 0x12, 0x46, 0x7A, 0x90, 0x82, 0x7A, 0xEF, 0xF0, 0x60, 0xF0, 0x90, +0x80, 0x01, 0xE0, 0xFF, 0x60, 0xE9, 0xC2, 0xAF, 0x30, 0xE1, 0x05, 0x54, 0xFD, 0xF0, 0x71, 0x8C, +0xD2, 0xAF, 0xC2, 0xAF, 0x90, 0x80, 0x01, 0xE0, 0xFF, 0x30, 0xE2, 0x05, 0x54, 0xFB, 0xF0, 0xD1, +0x5B, 0xD2, 0xAF, 0xC2, 0xAF, 0x90, 0x80, 0x01, 0xE0, 0xFF, 0x30, 0xE4, 0x0B, 0x54, 0xEF, 0xF0, +0xD1, 0x1E, 0xBF, 0x01, 0x03, 0x12, 0x53, 0x53, 0xD2, 0xAF, 0x80, 0xC3, 0xD3, 0x10, 0xAF, 0x01, +0xC3, 0xC0, 0xD0, 0x90, 0x80, 0x5C, 0xE0, 0xFF, 0x90, 0x80, 0x5B, 0xE0, 0xB5, 0x07, 0x04, 0x7F, +0x01, 0x80, 0x02, 0x7F, 0x00, 0xEF, 0x70, 0x43, 0x90, 0x80, 0x5B, 0xE0, 0xFE, 0x75, 0xF0, 0x08, +0x90, 0x80, 0x0B, 0x12, 0x42, 0x3E, 0xE0, 0xFD, 0xEE, 0x75, 0xF0, 0x08, 0xA4, 0x24, 0x0C, 0xF9, +0x74, 0x80, 0x35, 0xF0, 0xFA, 0x7B, 0x01, 0xAF, 0x05, 0x71, 0xF0, 0x90, 0x80, 0x5B, 0xE0, 0x04, +0xF0, 0xE0, 0x7F, 0x00, 0xB4, 0x0A, 0x02, 0x7F, 0x01, 0xEF, 0x60, 0x05, 0xE4, 0x90, 0x80, 0x5B, +0xF0, 0x12, 0x6B, 0x60, 0x90, 0x80, 0x01, 0xE0, 0x44, 0x02, 0xF0, 0xD0, 0xD0, 0x92, 0xAF, 0x22, +0x90, 0x82, 0x7B, 0x12, 0x42, 0x53, 0xEF, 0x12, 0x42, 0x5C, 0x64, 0x2B, 0x00, 0x64, 0x33, 0x01, +0x64, 0x3B, 0x02, 0x64, 0x43, 0x03, 0x64, 0x4B, 0x04, 0x64, 0x53, 0x13, 0x64, 0x5C, 0x20, 0x64, +0x65, 0x21, 0x64, 0x6D, 0x23, 0x64, 0x75, 0x25, 0x64, 0x86, 0x80, 0x64, 0x7D, 0x81, 0x64, 0x8F, +0x82, 0x64, 0x97, 0x83, 0x64, 0x9F, 0x84, 0x00, 0x00, 0x64, 0xA7, 0x90, 0x82, 0x7B, 0x12, 0x42, +0x4A, 0xC1, 0xDF, 0x90, 0x82, 0x7B, 0x12, 0x42, 0x4A, 0x81, 0xDB, 0x90, 0x82, 0x7B, 0x12, 0x42, +0x4A, 0xA1, 0xE6, 0x90, 0x82, 0x7B, 0x12, 0x42, 0x4A, 0xA1, 0xC6, 0x90, 0x82, 0x7B, 0x12, 0x42, +0x4A, 0x80, 0x5C, 0x90, 0x82, 0x7B, 0x12, 0x42, 0x4A, 0x02, 0x6A, 0x66, 0x90, 0x82, 0x7B, 0x12, +0x42, 0x4A, 0x02, 0x6A, 0xD4, 0x90, 0x82, 0x7B, 0x12, 0x42, 0x4A, 0xC1, 0x99, 0x90, 0x82, 0x7B, +0x12, 0x42, 0x4A, 0xA1, 0x7F, 0x90, 0x82, 0x7B, 0x12, 0x42, 0x4A, 0xA1, 0x87, 0x90, 0x82, 0x7B, +0x12, 0x42, 0x4A, 0x02, 0x5D, 0x7B, 0x90, 0x82, 0x7B, 0x12, 0x42, 0x4A, 0x02, 0x74, 0x90, 0x90, +0x82, 0x7B, 0x12, 0x42, 0x4A, 0xA1, 0xAC, 0x90, 0x82, 0x7B, 0x12, 0x42, 0x4A, 0xE1, 0x27, 0x90, +0x82, 0x7B, 0x12, 0x42, 0x4A, 0xE1, 0x7C, 0x90, 0x01, 0xC0, 0xE0, 0x44, 0x01, 0xF0, 0x22, 0xB1, +0x97, 0x12, 0x1F, 0xA4, 0xFF, 0x54, 0x01, 0xFE, 0x90, 0x82, 0x68, 0xE0, 0x54, 0xFE, 0x4E, 0xF0, +0xEF, 0xC3, 0x13, 0x30, 0xE0, 0x14, 0x90, 0x00, 0x01, 0x12, 0x1F, 0xBD, 0x90, 0x82, 0x69, 0xF0, +0x90, 0x00, 0x02, 0x12, 0x1F, 0xBD, 0x90, 0x82, 0x6A, 0xF0, 0x22, 0x90, 0x82, 0x7E, 0x12, 0x42, +0x53, 0x90, 0x00, 0x01, 0x12, 0x1F, 0xBD, 0xFF, 0xFE, 0x12, 0x1F, 0xA4, 0xFD, 0xC3, 0x13, 0x30, +0xE0, 0x12, 0x90, 0x82, 0x7E, 0x12, 0x42, 0x4A, 0x90, 0x00, 0x02, 0x12, 0x1F, 0xBD, 0x90, 0x82, +0x82, 0xF0, 0x80, 0x05, 0x90, 0x82, 0x82, 0xEF, 0xF0, 0x90, 0x82, 0x81, 0xEE, 0xF0, 0x90, 0x82, +0x82, 0xE0, 0xFE, 0x90, 0x82, 0x81, 0xE0, 0xFF, 0xD3, 0x9E, 0x50, 0x38, 0x90, 0x82, 0x7E, 0x12, +0x42, 0x4A, 0x12, 0x1F, 0xA4, 0x54, 0x01, 0xFE, 0x74, 0xF7, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x80, +0xF5, 0x83, 0xEE, 0xF0, 0x74, 0xF7, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x80, 0xF5, 0x83, 0xE0, 0x70, +0x04, 0xB1, 0x7E, 0x80, 0x07, 0x90, 0x82, 0x81, 0xE0, 0xFF, 0xB1, 0x7D, 0x90, 0x82, 0x81, 0xE0, +0x04, 0xF0, 0x80, 0xBA, 0x90, 0x80, 0xF7, 0xE0, 0x70, 0x22, 0x90, 0x81, 0x3E, 0xE0, 0x70, 0x04, +0xFF, 0x12, 0x4A, 0xF6, 0x90, 0x81, 0x3E, 0xE0, 0x64, 0x0C, 0x60, 0x03, 0x12, 0x4F, 0xD6, 0x90, +0x81, 0x38, 0xE0, 0x54, 0xF7, 0xF0, 0x54, 0xBF, 0xF0, 0x54, 0x7F, 0xF0, 0x22, 0x22, 0x22, 0x12, +0x1F, 0xA4, 0x90, 0x81, 0x45, 0xF0, 0x22, 0x12, 0x1F, 0xA4, 0x90, 0x81, 0x52, 0xF0, 0x90, 0x81, +0x52, 0xE0, 0x90, 0x01, 0xE7, 0xF0, 0x22, 0x90, 0x82, 0x68, 0xE0, 0x54, 0xFE, 0xF0, 0xA3, 0x74, +0x03, 0xF0, 0xA3, 0xF0, 0xE4, 0xA3, 0xF0, 0xA3, 0xF0, 0xA3, 0xF0, 0x22, 0x90, 0x02, 0x09, 0xE0, +0x90, 0x82, 0x7E, 0xF0, 0x12, 0x1F, 0xA4, 0x90, 0x82, 0x55, 0xF0, 0x90, 0x00, 0x01, 0x12, 0x1F, +0xBD, 0x90, 0x82, 0x56, 0xF0, 0x22, 0x12, 0x1F, 0xA4, 0xFF, 0x54, 0x01, 0xFE, 0x90, 0x82, 0x65, +0xE0, 0x54, 0xFE, 0x4E, 0xF0, 0xEF, 0xC3, 0x13, 0x30, 0xE0, 0x0A, 0x90, 0x00, 0x01, 0x12, 0x1F, +0xBD, 0x90, 0x82, 0x66, 0xF0, 0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x12, 0x1F, 0xA4, +0xFF, 0x90, 0x81, 0x37, 0xF0, 0xBF, 0x01, 0x12, 0x90, 0x00, 0x01, 0x12, 0x1F, 0xBD, 0x64, 0x01, +0x60, 0x17, 0x90, 0x05, 0x22, 0x74, 0x6F, 0xF0, 0x80, 0x0F, 0x90, 0x00, 0x01, 0x12, 0x1F, 0xBD, +0x64, 0x01, 0x60, 0x05, 0x90, 0x05, 0x22, 0xE4, 0xF0, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0xE4, 0x90, +0x83, 0x2D, 0xF0, 0xA3, 0xF0, 0x90, 0x02, 0x86, 0xE0, 0x20, 0xE1, 0x2C, 0xC3, 0x90, 0x83, 0x2E, +0xE0, 0x94, 0xD0, 0x90, 0x83, 0x2D, 0xE0, 0x94, 0x07, 0x40, 0x0A, 0x90, 0x01, 0xC1, 0xE0, 0x44, +0x04, 0xF0, 0x7F, 0x00, 0x22, 0x90, 0x83, 0x2D, 0xE4, 0x75, 0xF0, 0x01, 0x12, 0x41, 0xF6, 0x7F, +0x0A, 0x7E, 0x00, 0x12, 0x32, 0xAA, 0x80, 0xCD, 0x7F, 0x01, 0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, +0xC0, 0xD0, 0xE4, 0xFF, 0x90, 0x80, 0xF4, 0xE0, 0xFE, 0x90, 0x80, 0xF3, 0xE0, 0xB5, 0x06, 0x04, +0x7E, 0x01, 0x80, 0x02, 0x7E, 0x00, 0xEE, 0x64, 0x01, 0x60, 0x19, 0xEF, 0x60, 0x16, 0x90, 0x80, +0xF3, 0xE0, 0x04, 0xF0, 0xE0, 0x7F, 0x00, 0xB4, 0x0A, 0x02, 0x7F, 0x01, 0xEF, 0x60, 0x05, 0xE4, +0x90, 0x80, 0xF3, 0xF0, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x90, 0x00, 0x02, 0x12, 0x1F, 0xBD, 0xFF, +0x30, 0xE0, 0x26, 0x12, 0x1F, 0xA4, 0x90, 0x81, 0x4C, 0xF0, 0x90, 0x00, 0x01, 0x12, 0x1F, 0xBD, +0x90, 0x81, 0x4D, 0xF0, 0xEF, 0x54, 0xFE, 0xFF, 0xA3, 0xE0, 0x54, 0x01, 0x4F, 0xF0, 0x90, 0x00, +0x03, 0x12, 0x1F, 0xBD, 0x90, 0x81, 0x4F, 0xF0, 0x22, 0x90, 0x81, 0x4C, 0x74, 0x01, 0xF0, 0xA3, +0x74, 0x05, 0xF0, 0xA3, 0xE0, 0x54, 0x01, 0x44, 0x28, 0xF0, 0xA3, 0x74, 0x05, 0xF0, 0x22, 0x90, +0x02, 0x09, 0xE0, 0xFD, 0x12, 0x1F, 0xA4, 0xFE, 0xAF, 0x05, 0xED, 0x2E, 0x90, 0x80, 0x06, 0xF0, +0x90, 0x00, 0x01, 0x12, 0x1F, 0xBD, 0xFF, 0xED, 0x2F, 0x90, 0x80, 0x07, 0xF0, 0x90, 0x00, 0x02, +0x12, 0x1F, 0xBD, 0xFF, 0xED, 0x2F, 0x90, 0x80, 0x08, 0xF0, 0x90, 0x00, 0x03, 0x12, 0x1F, 0xBD, +0xFF, 0xED, 0x2F, 0x90, 0x80, 0x09, 0xF0, 0x90, 0x00, 0x04, 0x12, 0x1F, 0xBD, 0xFF, 0xAE, 0x05, +0xED, 0x2F, 0x90, 0x80, 0x0A, 0xF0, 0x22, 0x90, 0x02, 0x09, 0xE0, 0xFD, 0x12, 0x1F, 0xA4, 0xFE, +0xAF, 0x05, 0xED, 0x2E, 0x90, 0x82, 0x57, 0xF0, 0x90, 0x00, 0x01, 0x12, 0x1F, 0xBD, 0xFF, 0xED, +0x2F, 0x90, 0x82, 0x58, 0xF0, 0x90, 0x00, 0x02, 0x12, 0x1F, 0xBD, 0xFF, 0xED, 0x2F, 0x90, 0x82, +0x59, 0xF0, 0x90, 0x00, 0x03, 0x12, 0x1F, 0xBD, 0xFF, 0xED, 0x2F, 0x90, 0x82, 0x5A, 0xF0, 0x90, +0x00, 0x04, 0x12, 0x1F, 0xBD, 0xFF, 0xED, 0x2F, 0x90, 0x82, 0x5B, 0xF0, 0x90, 0x00, 0x05, 0x12, +0x1F, 0xBD, 0xFF, 0xAE, 0x05, 0xED, 0x2F, 0x90, 0x82, 0x5C, 0xF0, 0x22, 0x90, 0x02, 0x09, 0xE0, +0xFD, 0x12, 0x1F, 0xA4, 0xFE, 0xAF, 0x05, 0xED, 0x2E, 0x90, 0x82, 0x5D, 0xF0, 0x90, 0x00, 0x01, +0x12, 0x1F, 0xBD, 0xFF, 0xED, 0x2F, 0x90, 0x82, 0x5E, 0xF0, 0x90, 0x00, 0x02, 0x12, 0x1F, 0xBD, +0xFF, 0xED, 0x2F, 0x90, 0x82, 0x5F, 0xF0, 0x90, 0x00, 0x03, 0x12, 0x1F, 0xBD, 0xFF, 0xED, 0x2F, +0x90, 0x82, 0x60, 0xF0, 0x90, 0x00, 0x04, 0x12, 0x1F, 0xBD, 0xFF, 0xED, 0x2F, 0x90, 0x82, 0x61, +0xF0, 0x90, 0x00, 0x05, 0x12, 0x1F, 0xBD, 0xFF, 0xED, 0x2F, 0x90, 0x82, 0x62, 0xF0, 0x90, 0x00, +0x06, 0x12, 0x1F, 0xBD, 0xFF, 0xAE, 0x05, 0xED, 0x2F, 0x90, 0x82, 0x63, 0xF0, 0x22, 0x90, 0x82, +0xD2, 0xEF, 0xF0, 0xA3, 0xED, 0xF0, 0xA3, 0x12, 0x20, 0xDA, 0x00, 0x00, 0x00, 0x00, 0xE4, 0x90, +0x82, 0xE0, 0xF0, 0x7F, 0x24, 0x7E, 0x08, 0x12, 0x2D, 0x5C, 0x90, 0x82, 0xD8, 0x12, 0x20, 0xCE, +0x90, 0x82, 0xD2, 0xE0, 0xFB, 0x70, 0x08, 0x90, 0x82, 0xD8, 0x12, 0x42, 0x26, 0x80, 0x16, 0xEB, +0x75, 0xF0, 0x08, 0xA4, 0x24, 0x62, 0xF5, 0x82, 0xE4, 0x34, 0x87, 0xF5, 0x83, 0xE0, 0xFE, 0xA3, +0xE0, 0xFF, 0x12, 0x2D, 0x5C, 0x90, 0x82, 0xDC, 0x12, 0x20, 0xCE, 0x90, 0x82, 0xD3, 0xE0, 0xFF, +0xE4, 0xFC, 0xFD, 0xFE, 0x78, 0x17, 0x12, 0x20, 0xBB, 0xA8, 0x04, 0xA9, 0x05, 0xAA, 0x06, 0xAB, +0x07, 0x90, 0x82, 0xDC, 0x12, 0x42, 0x26, 0xED, 0x54, 0x7F, 0xFD, 0xEC, 0x54, 0x80, 0xFC, 0x12, +0x42, 0x19, 0xEC, 0x44, 0x80, 0xFC, 0x90, 0x82, 0xDC, 0x12, 0x20, 0xCE, 0x90, 0x82, 0xD8, 0x12, +0x42, 0x26, 0xEC, 0x54, 0x7F, 0xFC, 0x90, 0x85, 0xBB, 0x12, 0x20, 0xCE, 0x7F, 0x24, 0x7E, 0x08, +0x12, 0x2E, 0xA2, 0x90, 0x82, 0xD2, 0xE0, 0x75, 0xF0, 0x08, 0xA4, 0x24, 0x62, 0xF5, 0x82, 0xE4, +0x34, 0x87, 0xF5, 0x83, 0xE0, 0xFE, 0xA3, 0xE0, 0xFF, 0xC0, 0x06, 0xC0, 0x07, 0x90, 0x82, 0xDC, +0x12, 0x42, 0x26, 0x90, 0x85, 0xBB, 0x12, 0x20, 0xCE, 0xD0, 0x07, 0xD0, 0x06, 0x12, 0x2E, 0xA2, +0x90, 0x82, 0xD8, 0x12, 0x42, 0x26, 0xEC, 0x44, 0x80, 0xFC, 0x90, 0x85, 0xBB, 0x12, 0x20, 0xCE, +0x7F, 0x24, 0x7E, 0x08, 0x12, 0x2E, 0xA2, 0x90, 0x82, 0xD2, 0xE0, 0x70, 0x04, 0x7F, 0x20, 0x80, +0x09, 0x90, 0x82, 0xD2, 0xE0, 0xB4, 0x01, 0x16, 0x7F, 0x28, 0x7E, 0x08, 0x12, 0x2D, 0x5C, 0x78, +0x08, 0x12, 0x20, 0xA8, 0xEF, 0x54, 0x01, 0xFF, 0xE4, 0x90, 0x82, 0xE0, 0xEF, 0xF0, 0x90, 0x82, +0xE0, 0xE0, 0x90, 0x82, 0xD2, 0x60, 0x0E, 0xE0, 0x75, 0xF0, 0x08, 0xA4, 0x24, 0x66, 0xF5, 0x82, +0xE4, 0x34, 0x87, 0x80, 0x0C, 0xE0, 0x75, 0xF0, 0x08, 0xA4, 0x24, 0x64, 0xF5, 0x82, 0xE4, 0x34, +0x87, 0xF5, 0x83, 0xE0, 0xFE, 0xA3, 0xE0, 0xFF, 0x12, 0x2D, 0x5C, 0xED, 0x54, 0x0F, 0xFD, 0xE4, +0xFC, 0x90, 0x82, 0xD4, 0x12, 0x20, 0xCE, 0x90, 0x82, 0xD4, 0x02, 0x42, 0x26, 0x90, 0x82, 0xEF, +0xEF, 0xF0, 0xAB, 0x05, 0x90, 0x82, 0xF5, 0x12, 0x20, 0xDA, 0x00, 0x00, 0x00, 0x00, 0xAF, 0x03, +0xE4, 0xFC, 0xFD, 0xFE, 0x78, 0x14, 0x12, 0x20, 0xBB, 0xA8, 0x04, 0xA9, 0x05, 0xAA, 0x06, 0xAB, +0x07, 0x90, 0x82, 0xF1, 0x12, 0x42, 0x26, 0xED, 0x54, 0x0F, 0xFD, 0xE4, 0xFC, 0x12, 0x42, 0x19, +0xEC, 0x54, 0x0F, 0xFC, 0x90, 0x82, 0xF5, 0x12, 0x20, 0xCE, 0x90, 0x82, 0xEF, 0xE0, 0x75, 0xF0, +0x08, 0xA4, 0x24, 0x60, 0xF5, 0x82, 0xE4, 0x34, 0x87, 0xF5, 0x83, 0xE0, 0xFE, 0xA3, 0xE0, 0xFF, +0xC0, 0x06, 0xC0, 0x07, 0x90, 0x82, 0xF5, 0x12, 0x42, 0x26, 0x90, 0x85, 0xBB, 0x12, 0x20, 0xCE, +0xD0, 0x07, 0xD0, 0x06, 0x02, 0x2E, 0xA2, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x12, 0x67, +0xDE, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x90, 0x82, 0xAE, 0xEC, 0xF0, 0xA3, 0xED, 0xF0, 0x90, 0x82, +0xAD, 0xEF, 0xF0, 0xA3, 0xA3, 0xE0, 0xFD, 0x31, 0x87, 0x90, 0x82, 0xB8, 0x12, 0x20, 0xCE, 0x90, +0x82, 0xB0, 0x12, 0x42, 0x26, 0x12, 0x20, 0x9B, 0x90, 0x82, 0xB8, 0x12, 0x42, 0x32, 0x12, 0x42, +0x0C, 0xC0, 0x04, 0xC0, 0x05, 0xC0, 0x06, 0xC0, 0x07, 0x90, 0x82, 0xB0, 0x12, 0x42, 0x26, 0x90, +0x82, 0xB4, 0x12, 0x42, 0x32, 0x12, 0x42, 0x0C, 0xD0, 0x03, 0xD0, 0x02, 0xD0, 0x01, 0xD0, 0x00, +0x12, 0x42, 0x19, 0x90, 0x82, 0xBC, 0x12, 0x20, 0xCE, 0x90, 0x82, 0xAE, 0xA3, 0xE0, 0xFD, 0xC0, +0x05, 0x90, 0x82, 0xBC, 0x12, 0x42, 0x26, 0x90, 0x85, 0x96, 0x12, 0x20, 0xCE, 0x90, 0x82, 0xAD, +0xE0, 0xFF, 0xD0, 0x05, 0x02, 0x31, 0x4D, 0x90, 0x83, 0x1D, 0x12, 0x42, 0x53, 0xE4, 0xFF, 0x90, +0x83, 0x1D, 0x12, 0x42, 0x4A, 0x8F, 0x82, 0x75, 0x83, 0x00, 0x12, 0x1F, 0xBD, 0xFE, 0x74, 0xF0, +0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x02, 0xF5, 0x83, 0xEE, 0xF0, 0x0F, 0xEF, 0xB4, 0x10, 0xE0, 0x22, +0x90, 0x83, 0x31, 0xEF, 0xF0, 0x7F, 0x02, 0x12, 0x46, 0x53, 0x90, 0x80, 0x01, 0xE0, 0xFF, 0x90, +0x83, 0x31, 0xE0, 0xFE, 0xEF, 0x4E, 0x90, 0x80, 0x01, 0xF0, 0x22, 0x90, 0x83, 0x32, 0xEF, 0xF0, +0x7F, 0x02, 0x12, 0x46, 0x53, 0x90, 0x80, 0x02, 0xE0, 0xFF, 0x90, 0x83, 0x32, 0xE0, 0xFE, 0xEF, +0x4E, 0x90, 0x80, 0x02, 0xF0, 0x22, 0x12, 0x1F, 0xA4, 0xFF, 0x54, 0x80, 0xFE, 0x90, 0x82, 0x6E, +0xE0, 0x54, 0x7F, 0x4E, 0xFE, 0xF0, 0xEF, 0x54, 0x40, 0xFF, 0xEE, 0x54, 0xBF, 0x4F, 0xFF, 0xF0, +0x12, 0x1F, 0xA4, 0xFE, 0x54, 0x20, 0xFD, 0xEF, 0x54, 0xDF, 0x4D, 0xFF, 0x90, 0x82, 0x6E, 0xF0, +0xEE, 0x54, 0x10, 0xFE, 0xEF, 0x54, 0xEF, 0x4E, 0xFF, 0xF0, 0x12, 0x1F, 0xA4, 0x54, 0x0F, 0xFE, +0xEF, 0x54, 0xF0, 0x4E, 0x90, 0x82, 0x6E, 0xF0, 0x90, 0x00, 0x01, 0x12, 0x1F, 0xBD, 0x90, 0x82, +0x6F, 0xF0, 0x90, 0x00, 0x02, 0x12, 0x1F, 0xBD, 0x90, 0x82, 0x70, 0xF0, 0x90, 0x82, 0x6E, 0xE0, +0xFE, 0x54, 0x0F, 0xFF, 0xEE, 0xC4, 0x13, 0x13, 0x54, 0x03, 0x7D, 0x00, 0x20, 0xE0, 0x02, 0x7D, +0x01, 0x02, 0x52, 0x47, 0x12, 0x1F, 0xA4, 0xFF, 0x54, 0x7F, 0x90, 0x81, 0x3B, 0xF0, 0xEF, 0xC4, +0x13, 0x13, 0x13, 0x54, 0x01, 0xA3, 0xF0, 0x90, 0x00, 0x01, 0x12, 0x1F, 0xBD, 0xFF, 0x54, 0xF0, +0xC4, 0x54, 0x0F, 0xFE, 0x90, 0x81, 0x3A, 0xE0, 0x54, 0xF0, 0x4E, 0xF0, 0x90, 0x00, 0x03, 0x12, +0x1F, 0xBD, 0x54, 0x01, 0x25, 0xE0, 0xFE, 0x90, 0x81, 0x38, 0xE0, 0x54, 0xFD, 0x4E, 0xF0, 0x90, +0x81, 0x53, 0xE0, 0x30, 0xE0, 0x09, 0x90, 0x81, 0x3A, 0xE0, 0x54, 0x0F, 0xF0, 0x80, 0x0F, 0xEF, +0x54, 0x0F, 0xC4, 0x54, 0xF0, 0xFF, 0x90, 0x81, 0x3A, 0xE0, 0x54, 0x0F, 0x4F, 0xF0, 0x90, 0x00, +0x04, 0x12, 0x1F, 0xBD, 0x90, 0x81, 0x3D, 0xF0, 0x12, 0x5C, 0x93, 0x90, 0x01, 0xB9, 0x74, 0x01, +0xF0, 0x90, 0x01, 0xB8, 0xF0, 0x90, 0x81, 0x3B, 0xE0, 0x90, 0x01, 0xBA, 0xF0, 0x90, 0x81, 0x3D, +0xE0, 0x90, 0x01, 0xBB, 0xF0, 0x90, 0x81, 0x3A, 0xE0, 0x54, 0x0F, 0x90, 0x01, 0xBE, 0xF0, 0x22, +0x90, 0x01, 0xCC, 0xE0, 0x54, 0x0F, 0x90, 0x83, 0x33, 0xF0, 0x90, 0x83, 0x33, 0xE0, 0xFD, 0x70, +0x02, 0x81, 0xED, 0x90, 0x80, 0x5B, 0xE0, 0xFF, 0x70, 0x06, 0xA3, 0xE0, 0x64, 0x09, 0x60, 0x0A, +0xEF, 0x14, 0xFF, 0x90, 0x80, 0x5C, 0xE0, 0xB5, 0x07, 0x04, 0x7F, 0x01, 0x80, 0x02, 0x7F, 0x00, +0xEF, 0x60, 0x08, 0x90, 0x01, 0xC1, 0xE0, 0x44, 0x01, 0xF0, 0x22, 0x90, 0x83, 0x23, 0xE0, 0xFF, +0x74, 0x01, 0x7E, 0x00, 0xA8, 0x07, 0x08, 0x80, 0x05, 0xC3, 0x33, 0xCE, 0x33, 0xCE, 0xD8, 0xF9, +0xFF, 0xEF, 0x5D, 0x70, 0x02, 0x81, 0xE6, 0x90, 0x83, 0x23, 0xE0, 0x75, 0xF0, 0x04, 0x90, 0x01, +0xD0, 0x12, 0x42, 0x3E, 0xE0, 0xFF, 0x90, 0x80, 0x5C, 0xE0, 0xFE, 0x75, 0xF0, 0x08, 0x90, 0x80, +0x0B, 0x12, 0x42, 0x3E, 0xEF, 0xF0, 0x90, 0x83, 0x23, 0xE0, 0x75, 0xF0, 0x04, 0x90, 0x01, 0xD1, +0x12, 0x42, 0x3E, 0xE0, 0xFF, 0x75, 0xF0, 0x08, 0xEE, 0x90, 0x80, 0x0C, 0x12, 0x42, 0x3E, 0xEF, +0xF0, 0x90, 0x83, 0x23, 0xE0, 0x75, 0xF0, 0x04, 0x90, 0x01, 0xD2, 0x12, 0x42, 0x3E, 0xE0, 0xFF, +0x75, 0xF0, 0x08, 0xEE, 0x90, 0x80, 0x0D, 0x12, 0x42, 0x3E, 0xEF, 0xF0, 0x90, 0x83, 0x23, 0xE0, +0x75, 0xF0, 0x04, 0x90, 0x01, 0xD3, 0x12, 0x42, 0x3E, 0xE0, 0xFF, 0x75, 0xF0, 0x08, 0xEE, 0x90, +0x80, 0x0E, 0x12, 0x42, 0x3E, 0xEF, 0xF0, 0x90, 0x83, 0x23, 0xE0, 0x75, 0xF0, 0x04, 0x90, 0x01, +0xF0, 0x12, 0x42, 0x3E, 0xE0, 0xFF, 0x75, 0xF0, 0x08, 0xEE, 0x90, 0x80, 0x0F, 0x12, 0x42, 0x3E, +0xEF, 0xF0, 0x90, 0x83, 0x23, 0xE0, 0x75, 0xF0, 0x04, 0x90, 0x01, 0xF1, 0x12, 0x42, 0x3E, 0xE0, +0xFF, 0x75, 0xF0, 0x08, 0xEE, 0x90, 0x80, 0x10, 0x12, 0x42, 0x3E, 0xEF, 0xF0, 0x90, 0x83, 0x23, +0xE0, 0x75, 0xF0, 0x04, 0x90, 0x01, 0xF2, 0x12, 0x42, 0x3E, 0xE0, 0xFF, 0x75, 0xF0, 0x08, 0xEE, +0x90, 0x80, 0x11, 0x12, 0x42, 0x3E, 0xEF, 0xF0, 0x90, 0x83, 0x23, 0xE0, 0x75, 0xF0, 0x04, 0x90, +0x01, 0xF3, 0x12, 0x42, 0x3E, 0xE0, 0xFF, 0x75, 0xF0, 0x08, 0xEE, 0x90, 0x80, 0x12, 0x12, 0x42, +0x3E, 0xEF, 0xF0, 0x90, 0x83, 0x33, 0xE0, 0xFF, 0x90, 0x83, 0x23, 0xE0, 0xFE, 0x74, 0x01, 0xA8, +0x06, 0x08, 0x80, 0x02, 0xC3, 0x33, 0xD8, 0xFC, 0xF4, 0x5F, 0x90, 0x83, 0x33, 0xF0, 0x90, 0x83, +0x23, 0xE0, 0xFF, 0x74, 0x01, 0xA8, 0x07, 0x08, 0x80, 0x02, 0xC3, 0x33, 0xD8, 0xFC, 0x90, 0x01, +0xCC, 0xF0, 0x90, 0x83, 0x23, 0xE0, 0x04, 0xF0, 0xE0, 0x54, 0x03, 0xF0, 0x90, 0x80, 0x5C, 0xE0, +0x04, 0xF0, 0xE0, 0x7F, 0x00, 0xB4, 0x0A, 0x02, 0x7F, 0x01, 0xEF, 0x70, 0x02, 0x61, 0x6A, 0xE4, +0x90, 0x80, 0x5C, 0xF0, 0x61, 0x6A, 0x90, 0x01, 0xC0, 0xE0, 0x44, 0x02, 0xF0, 0x22, 0xD3, 0x10, +0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0x83, 0x0D, 0xEE, 0xF0, 0xA3, 0xEF, 0xF0, 0xE4, 0xA3, 0xF0, +0xA3, 0xF0, 0x90, 0x83, 0x0D, 0xE0, 0xFE, 0xA3, 0xE0, 0xF5, 0x82, 0x8E, 0x83, 0xE0, 0x60, 0x2D, +0xC3, 0x90, 0x83, 0x10, 0xE0, 0x94, 0xE8, 0x90, 0x83, 0x0F, 0xE0, 0x94, 0x03, 0x40, 0x0B, 0x90, +0x01, 0xC0, 0xE0, 0x44, 0x80, 0xF0, 0x7F, 0x00, 0x80, 0x15, 0x90, 0x83, 0x0F, 0xE4, 0x75, 0xF0, +0x01, 0x12, 0x41, 0xF6, 0x7F, 0x0A, 0x7E, 0x00, 0x12, 0x32, 0xAA, 0x80, 0xC5, 0x7F, 0x01, 0xD0, +0xD0, 0x92, 0xAF, 0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0x83, 0x20, 0x12, 0x42, +0x53, 0x90, 0x83, 0x24, 0xE0, 0xFF, 0x04, 0xF0, 0x90, 0x00, 0x01, 0xEF, 0x12, 0x1F, 0xFC, 0x7F, +0xAF, 0x7E, 0x01, 0x91, 0xEE, 0xEF, 0x60, 0x3A, 0x90, 0x83, 0x20, 0x12, 0x42, 0x4A, 0x8B, 0x13, +0x8A, 0x14, 0x89, 0x15, 0x90, 0x00, 0x0E, 0x12, 0x1F, 0xBD, 0x24, 0x02, 0xF5, 0x16, 0x7B, 0x01, +0x7A, 0x01, 0x79, 0xA0, 0x12, 0x2B, 0xED, 0x90, 0x83, 0x20, 0x12, 0x42, 0x4A, 0x90, 0x00, 0x0E, +0x12, 0x1F, 0xBD, 0x90, 0x01, 0xAE, 0xF0, 0xA3, 0x74, 0xFF, 0xF0, 0x90, 0x01, 0xCB, 0xE0, 0x64, +0x80, 0xF0, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0x80, +0xF3, 0xE0, 0xFF, 0x70, 0x06, 0xA3, 0xE0, 0x64, 0x09, 0x60, 0x0A, 0xEF, 0x14, 0xFF, 0x90, 0x80, +0xF4, 0xE0, 0xB5, 0x07, 0x04, 0x7F, 0x01, 0x80, 0x02, 0x7F, 0x00, 0xEF, 0x60, 0x09, 0x90, 0x01, +0xC1, 0xE0, 0x44, 0x02, 0xF0, 0x80, 0x35, 0xC0, 0x01, 0x90, 0x80, 0xF4, 0xE0, 0x75, 0xF0, 0x0F, +0xA4, 0x24, 0x5D, 0xF9, 0x74, 0x80, 0x35, 0xF0, 0xA8, 0x01, 0xFC, 0x7D, 0x01, 0xD0, 0x01, 0x7E, +0x00, 0x7F, 0x0F, 0x12, 0x41, 0xD0, 0x90, 0x80, 0xF4, 0xE0, 0x04, 0xF0, 0xE0, 0x7F, 0x00, 0xB4, +0x0A, 0x02, 0x7F, 0x01, 0xEF, 0x60, 0x05, 0xE4, 0x90, 0x80, 0xF4, 0xF0, 0xD0, 0xD0, 0x92, 0xAF, +0x22, 0x90, 0x01, 0x34, 0xE0, 0x55, 0x3D, 0xF5, 0x41, 0xA3, 0xE0, 0x55, 0x3E, 0xF5, 0x42, 0xA3, +0xE0, 0x55, 0x3F, 0xF5, 0x43, 0xA3, 0xE0, 0x55, 0x40, 0xF5, 0x44, 0x90, 0x01, 0x34, 0xE5, 0x41, +0xF0, 0xA3, 0xE5, 0x42, 0xF0, 0xA3, 0xE5, 0x43, 0xF0, 0xA3, 0xE5, 0x44, 0xF0, 0x22, 0x90, 0x01, +0x3C, 0xE0, 0x55, 0x45, 0xF5, 0x49, 0xA3, 0xE0, 0x55, 0x46, 0xF5, 0x4A, 0xA3, 0xE0, 0x55, 0x47, +0xF5, 0x4B, 0xA3, 0xE0, 0x55, 0x48, 0xF5, 0x4C, 0x90, 0x01, 0x3C, 0xE5, 0x49, 0xF0, 0xA3, 0xE5, +0x4A, 0xF0, 0xA3, 0xE5, 0x4B, 0xF0, 0xA3, 0xE5, 0x4C, 0xF0, 0x53, 0x91, 0xDF, 0x22, 0x8F, 0x52, +0x7F, 0x02, 0x12, 0x46, 0x53, 0x90, 0x80, 0x02, 0xE0, 0x45, 0x52, 0xF0, 0x22, 0xD1, 0xD5, 0x90, +0x82, 0x72, 0xEF, 0xF0, 0x90, 0x81, 0x38, 0x30, 0xE0, 0x06, 0xE0, 0x44, 0x01, 0xF0, 0x80, 0x04, +0xE0, 0x54, 0xFE, 0xF0, 0x90, 0x82, 0x72, 0xE0, 0x30, 0xE6, 0x11, 0x90, 0x01, 0x2F, 0xE0, 0x30, +0xE7, 0x04, 0xE4, 0xF0, 0x80, 0x06, 0x90, 0x01, 0x2F, 0x74, 0x80, 0xF0, 0x90, 0x81, 0x38, 0xE0, +0x30, 0xE0, 0x1A, 0x90, 0x81, 0x46, 0xE4, 0xF0, 0xA3, 0x74, 0x07, 0xF0, 0x90, 0x81, 0x46, 0xA3, +0xE0, 0x90, 0x05, 0x58, 0xF0, 0x90, 0x04, 0xEC, 0xE0, 0x54, 0xDD, 0xF0, 0x22, 0x90, 0x04, 0xEC, +0xE0, 0x44, 0x22, 0xF0, 0x22, 0xE4, 0x90, 0x82, 0x73, 0xF0, 0xA3, 0xF0, 0xA3, 0xF0, 0x90, 0x00, +0x83, 0xE0, 0x90, 0x82, 0x73, 0xF0, 0x90, 0x00, 0x83, 0xE0, 0xFE, 0x90, 0x82, 0x73, 0xE0, 0xFF, +0xB5, 0x06, 0x01, 0x22, 0xC3, 0x90, 0x82, 0x75, 0xE0, 0x94, 0x64, 0x90, 0x82, 0x74, 0xE0, 0x94, +0x00, 0x40, 0x0D, 0x90, 0x01, 0xC0, 0xE0, 0x44, 0x40, 0xF0, 0x90, 0x82, 0x73, 0xE0, 0xFF, 0x22, +0x90, 0x82, 0x74, 0xE4, 0x75, 0xF0, 0x01, 0x12, 0x41, 0xF6, 0x80, 0xC2, 0x90, 0x81, 0x38, 0xE0, +0xFF, 0xC4, 0x13, 0x13, 0x13, 0x54, 0x01, 0x30, 0xE0, 0x2C, 0xEF, 0x54, 0x7F, 0xF0, 0x90, 0x04, +0xE0, 0xE0, 0x90, 0x81, 0x39, 0x30, 0xE1, 0x06, 0xE0, 0x44, 0x02, 0xF0, 0x80, 0x0F, 0xE0, 0x54, +0xFD, 0xF0, 0x90, 0x01, 0xB9, 0x74, 0x01, 0xF0, 0x90, 0x01, 0xB8, 0x04, 0xF0, 0x90, 0x81, 0x3B, +0xE0, 0x60, 0x03, 0x12, 0x4E, 0x3A, 0x7F, 0x01, 0x02, 0x51, 0x2A, 0xD3, 0x10, 0xAF, 0x01, 0xC3, +0xC0, 0xD0, 0x90, 0x04, 0x1D, 0xE0, 0x60, 0x1A, 0x90, 0x05, 0x22, 0xE0, 0x54, 0x90, 0x60, 0x07, +0x90, 0x01, 0xC0, 0xE0, 0x44, 0x08, 0xF0, 0x90, 0x01, 0xC6, 0xE0, 0x30, 0xE1, 0xE4, 0x7F, 0x00, +0x80, 0x02, 0x7F, 0x01, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0xC3, 0xEE, 0x94, 0x01, 0x40, 0x0A, 0x0D, +0xED, 0x13, 0x90, 0xFD, 0x10, 0xF0, 0xE4, 0x2F, 0xFF, 0x22, 0xC3, 0xEE, 0x94, 0x01, 0x40, 0x1E, +0x90, 0xFD, 0x11, 0xE0, 0xB5, 0x05, 0x14, 0x90, 0x01, 0x17, 0xE0, 0xB5, 0x05, 0x07, 0x90, 0xFD, +0x11, 0xE4, 0xF0, 0x80, 0x06, 0xED, 0x04, 0x90, 0xFD, 0x11, 0xF0, 0xE4, 0x2F, 0xFF, 0x22, 0xE4, +0x90, 0x83, 0x29, 0xF0, 0xA3, 0xF0, 0x90, 0x05, 0xF8, 0xE0, 0x70, 0x0F, 0xA3, 0xE0, 0x70, 0x0B, +0xA3, 0xE0, 0x70, 0x07, 0xA3, 0xE0, 0x70, 0x03, 0x7F, 0x01, 0x22, 0xD3, 0x90, 0x83, 0x2A, 0xE0, +0x94, 0xE8, 0x90, 0x83, 0x29, 0xE0, 0x94, 0x03, 0x40, 0x0A, 0x90, 0x01, 0xC0, 0xE0, 0x44, 0x20, +0xF0, 0x7F, 0x00, 0x22, 0x7F, 0x32, 0x7E, 0x00, 0x12, 0x32, 0xAA, 0x90, 0x83, 0x29, 0xE4, 0x75, +0xF0, 0x01, 0x12, 0x41, 0xF6, 0x80, 0xBF, 0x74, 0x45, 0x2F, 0xF8, 0xE6, 0xFE, 0xED, 0xF4, 0x5E, +0xFE, 0xF6, 0x74, 0x38, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x01, 0xF5, 0x83, 0xEE, 0xF0, 0x22, 0x90, +0x82, 0xC0, 0xEE, 0xF0, 0xA3, 0xEF, 0xF0, 0x12, 0x2D, 0x5C, 0x90, 0x82, 0xCA, 0x12, 0x20, 0xCE, +0x90, 0x82, 0xC2, 0x12, 0x42, 0x26, 0x12, 0x20, 0x9B, 0x90, 0x82, 0xCA, 0x12, 0x42, 0x32, 0x12, +0x42, 0x0C, 0xC0, 0x04, 0xC0, 0x05, 0xC0, 0x06, 0xC0, 0x07, 0x90, 0x82, 0xC2, 0x12, 0x42, 0x26, +0x90, 0x82, 0xC6, 0x12, 0x42, 0x32, 0x12, 0x42, 0x0C, 0xD0, 0x03, 0xD0, 0x02, 0xD0, 0x01, 0xD0, +0x00, 0x12, 0x42, 0x19, 0x90, 0x82, 0xCE, 0x12, 0x20, 0xCE, 0x90, 0x82, 0xCE, 0x12, 0x42, 0x26, +0x90, 0x85, 0xBB, 0x12, 0x20, 0xCE, 0x90, 0x82, 0xC0, 0xE0, 0xFE, 0xA3, 0xE0, 0xFF, 0x02, 0x2E, +0xA2, 0xE4, 0x90, 0x81, 0x3B, 0xF0, 0xA3, 0xF0, 0x90, 0x81, 0x3A, 0xE0, 0x54, 0x0F, 0xF0, 0x54, +0xF0, 0xF0, 0x90, 0x81, 0x38, 0xE0, 0x54, 0xFD, 0xF0, 0x54, 0xF7, 0xF0, 0x90, 0x81, 0x41, 0x74, +0x01, 0xF0, 0xA3, 0xF0, 0x90, 0x81, 0x38, 0xE0, 0x54, 0xFB, 0xF0, 0xA3, 0xE0, 0x54, 0xFB, 0xF0, +0xE4, 0x90, 0x81, 0x44, 0xF0, 0x90, 0x81, 0x43, 0x74, 0x07, 0xF0, 0x90, 0x81, 0x46, 0xE4, 0xF0, +0xA3, 0x74, 0x02, 0xF0, 0xE4, 0x90, 0x81, 0x3F, 0xF0, 0x90, 0x81, 0x38, 0xE0, 0x54, 0xFE, 0xF0, +0x90, 0x81, 0x3D, 0x74, 0x0C, 0xF0, 0x90, 0x81, 0x38, 0xE0, 0x54, 0xDF, 0xF0, 0x90, 0x81, 0x3E, +0x74, 0x0C, 0xF0, 0x90, 0x81, 0x38, 0xE0, 0x54, 0xBF, 0xF0, 0x54, 0x7F, 0xF0, 0xA3, 0xE0, 0x54, +0xFE, 0xF0, 0x54, 0xFD, 0xF0, 0x54, 0xF7, 0xF0, 0x90, 0x81, 0x48, 0x12, 0x20, 0xDA, 0x00, 0x00, +0x00, 0x00, 0x90, 0x80, 0x05, 0xE0, 0xB4, 0x01, 0x08, 0x90, 0x81, 0x45, 0x74, 0x99, 0xF0, 0x80, +0x12, 0x90, 0x80, 0x05, 0xE0, 0x90, 0x81, 0x45, 0xB4, 0x03, 0x05, 0x74, 0x90, 0xF0, 0x80, 0x03, +0x74, 0x40, 0xF0, 0x90, 0x81, 0x4C, 0x74, 0x01, 0xF0, 0xA3, 0x74, 0x05, 0xF0, 0xA3, 0xE0, 0x54, +0x01, 0x44, 0x28, 0xF0, 0xA3, 0x74, 0x05, 0xF0, 0xE4, 0xA3, 0xF0, 0xA3, 0xE0, 0x54, 0xFD, 0xF0, +0x54, 0xFB, 0xF0, 0x54, 0xF7, 0xF0, 0x54, 0xEF, 0xF0, 0x54, 0xDF, 0xF0, 0x54, 0xBF, 0xF0, 0xE4, +0xA3, 0xF0, 0x22, 0x90, 0x81, 0x38, 0xE0, 0x54, 0xFB, 0xF0, 0xE4, 0x90, 0x81, 0x44, 0xF0, 0x90, +0x81, 0x3F, 0xF0, 0x22, 0x90, 0x04, 0x1A, 0xE0, 0xF4, 0x60, 0x03, 0x7F, 0x00, 0x22, 0x90, 0x04, +0x1B, 0xE0, 0x54, 0x07, 0x64, 0x07, 0x7F, 0x01, 0x60, 0x02, 0x7F, 0x00, 0x22, 0x31, 0x64, 0xEF, +0x64, 0x01, 0x60, 0x08, 0x90, 0x01, 0xB8, 0x74, 0x01, 0xF0, 0x80, 0x67, 0x90, 0x81, 0x3F, 0xE0, +0xFF, 0x54, 0x03, 0x60, 0x08, 0x90, 0x01, 0xB8, 0x74, 0x02, 0xF0, 0x80, 0x56, 0x90, 0x81, 0x3D, +0xE0, 0xFE, 0xE4, 0xC3, 0x9E, 0x50, 0x08, 0x90, 0x01, 0xB8, 0x74, 0x04, 0xF0, 0x80, 0x44, 0xEF, +0x30, 0xE2, 0x08, 0x90, 0x01, 0xB8, 0x74, 0x08, 0xF0, 0x80, 0x38, 0x90, 0x81, 0x3F, 0xE0, 0x30, +0xE4, 0x08, 0x90, 0x01, 0xB8, 0x74, 0x10, 0xF0, 0x80, 0x29, 0x90, 0x81, 0x39, 0xE0, 0x13, 0x13, +0x54, 0x3F, 0x20, 0xE0, 0x08, 0x90, 0x01, 0xB8, 0x74, 0x20, 0xF0, 0x80, 0x16, 0x90, 0x81, 0x52, +0xE0, 0x60, 0x08, 0x90, 0x01, 0xB8, 0x74, 0x80, 0xF0, 0x80, 0x08, 0x90, 0x01, 0xB8, 0xE4, 0xF0, +0x7F, 0x01, 0x22, 0x90, 0x01, 0xB9, 0x74, 0x04, 0xF0, 0x7F, 0x00, 0x22, 0xEF, 0x24, 0xFE, 0x60, +0x0C, 0x04, 0x70, 0x28, 0x90, 0x81, 0x41, 0x74, 0x01, 0xF0, 0xA3, 0xF0, 0x22, 0xED, 0x70, 0x0A, +0x90, 0x81, 0x4F, 0xE0, 0x90, 0x81, 0x41, 0xF0, 0x80, 0x05, 0x90, 0x81, 0x41, 0xED, 0xF0, 0x90, +0x81, 0x41, 0xE0, 0xA3, 0xF0, 0x90, 0x81, 0x39, 0xE0, 0x44, 0x08, 0xF0, 0x22, 0xEF, 0x60, 0x3E, +0x90, 0x80, 0xF7, 0xE0, 0x64, 0x01, 0x70, 0x36, 0x90, 0x81, 0x39, 0xE0, 0x54, 0xFE, 0xF0, 0x90, +0x05, 0x22, 0x74, 0x0F, 0xF0, 0x90, 0x06, 0x04, 0xE0, 0x54, 0xBF, 0xF0, 0xE4, 0xFF, 0x12, 0x4C, +0x52, 0xBF, 0x01, 0x0E, 0x90, 0x81, 0x38, 0xE0, 0x44, 0x40, 0xF0, 0x90, 0x81, 0x3E, 0x74, 0x06, +0xF0, 0x22, 0x90, 0x01, 0xB9, 0x74, 0x01, 0xF0, 0x90, 0x01, 0xB8, 0x74, 0x08, 0xF0, 0x22, 0x90, +0x05, 0x22, 0xE4, 0xF0, 0x90, 0x81, 0x3E, 0x74, 0x04, 0xF0, 0x22, 0x90, 0x81, 0x3B, 0xE0, 0x60, +0x2F, 0x90, 0x80, 0xF7, 0xE0, 0x64, 0x01, 0x70, 0x27, 0x90, 0x81, 0x42, 0xF0, 0x04, 0x60, 0x20, +0x90, 0x81, 0x3F, 0xE0, 0x44, 0x10, 0xF0, 0xE4, 0xF5, 0x1D, 0x90, 0x81, 0x43, 0x12, 0x4E, 0xD3, +0x90, 0x01, 0x57, 0x74, 0x05, 0xF0, 0x90, 0x81, 0x3E, 0xE0, 0x20, 0xE2, 0x03, 0x12, 0x49, 0x10, +0x22, 0x90, 0x81, 0x38, 0xE0, 0xFF, 0x13, 0x13, 0x54, 0x3F, 0x30, 0xE0, 0x11, 0xEF, 0x54, 0xFB, +0xF0, 0x90, 0x81, 0x3F, 0xE0, 0x54, 0xFD, 0xF0, 0x54, 0x07, 0x70, 0x42, 0x80, 0x3D, 0x90, 0x81, +0x44, 0xE0, 0x04, 0xF0, 0x90, 0x81, 0x3F, 0xE0, 0x54, 0xEF, 0xF0, 0x90, 0x81, 0x44, 0xE0, 0xFF, +0xB4, 0x01, 0x02, 0x80, 0x04, 0xEF, 0xB4, 0x02, 0x06, 0x90, 0x05, 0x58, 0xE0, 0x04, 0xF0, 0x90, +0x81, 0x4C, 0xE0, 0xFF, 0x90, 0x81, 0x44, 0xE0, 0xD3, 0x9F, 0x40, 0x0F, 0x90, 0x80, 0xF7, 0xE0, +0xB4, 0x01, 0x0B, 0x90, 0x81, 0x39, 0xE0, 0x54, 0xFB, 0xF0, 0x22, 0x12, 0x4E, 0x3A, 0x22, 0x90, +0x80, 0x08, 0xE0, 0xFE, 0x90, 0x04, 0x1C, 0xE0, 0x6E, 0x70, 0x40, 0x90, 0x81, 0x3E, 0xE0, 0xFE, +0xB4, 0x0E, 0x18, 0xEF, 0x70, 0x35, 0x90, 0x81, 0x38, 0xE0, 0x54, 0x7F, 0xF0, 0x90, 0x06, 0x04, +0xE0, 0x54, 0x7F, 0xF0, 0x90, 0x81, 0x3E, 0x74, 0x0C, 0xF0, 0x22, 0xEE, 0x64, 0x06, 0x70, 0x1B, +0xEF, 0x60, 0x18, 0x90, 0x81, 0x38, 0xE0, 0x54, 0xBF, 0xF0, 0x90, 0x06, 0x04, 0xE0, 0x44, 0x40, +0xF0, 0xE0, 0x44, 0x80, 0xF0, 0x90, 0x81, 0x3E, 0x74, 0x04, 0xF0, 0x22, 0x90, 0x82, 0x65, 0xE0, +0x54, 0xFE, 0xF0, 0x54, 0x7F, 0xF0, 0xA3, 0x74, 0x0A, 0xF0, 0xE4, 0xA3, 0xF0, 0x22, 0x7D, 0x7F, +0xEF, 0x5D, 0xC3, 0x60, 0x14, 0x74, 0xFF, 0x9D, 0xFD, 0x74, 0xFF, 0x94, 0x00, 0x5E, 0xFE, 0xED, +0x5F, 0x24, 0x80, 0xFF, 0xE4, 0x3E, 0xFE, 0x80, 0x0D, 0x74, 0xFF, 0x9D, 0xFD, 0x74, 0xFF, 0x94, +0x00, 0x5E, 0xFE, 0xED, 0x5F, 0xFF, 0x22, 0x90, 0x01, 0x1F, 0xE0, 0xFE, 0x90, 0x01, 0x1E, 0xE0, +0x7C, 0x00, 0x24, 0x00, 0xFF, 0xEC, 0x3E, 0x90, 0x82, 0x7E, 0xF0, 0xA3, 0xEF, 0xF0, 0x90, 0x02, +0x87, 0xE0, 0x90, 0x82, 0x82, 0xF0, 0x90, 0x81, 0x53, 0xE0, 0x20, 0xE0, 0x02, 0x81, 0x8F, 0x90, +0x82, 0x82, 0xE0, 0xFF, 0xEC, 0xC3, 0x9F, 0x40, 0x02, 0x81, 0x8F, 0x90, 0x82, 0x7E, 0xE0, 0xFA, +0xA3, 0xE0, 0xFB, 0xEA, 0x90, 0xFD, 0x11, 0xF0, 0xAF, 0x03, 0xAD, 0x07, 0x74, 0x02, 0x2D, 0xF5, +0x82, 0xE4, 0x34, 0xFB, 0xF5, 0x83, 0xE0, 0x54, 0x0F, 0x33, 0x33, 0x33, 0x54, 0xF8, 0xF9, 0x74, +0x01, 0x2D, 0xF5, 0x82, 0xE4, 0x34, 0xFB, 0xF5, 0x83, 0xE0, 0xFE, 0x74, 0x00, 0x2D, 0xF5, 0x82, +0xE4, 0x34, 0xFB, 0xF5, 0x83, 0xE0, 0x7A, 0x00, 0x24, 0x00, 0xFF, 0xEA, 0x3E, 0x54, 0x3F, 0x90, +0x82, 0x80, 0xF0, 0xA3, 0xEF, 0xF0, 0x74, 0x03, 0x2D, 0xF5, 0x82, 0xE4, 0x34, 0xFB, 0xF5, 0x83, +0xE0, 0x54, 0x03, 0xFF, 0x7E, 0x00, 0xAD, 0x01, 0xED, 0x24, 0x18, 0xFB, 0xEA, 0x33, 0xCB, 0x2F, +0xFF, 0xEE, 0x3B, 0x90, 0x82, 0x80, 0x8F, 0xF0, 0x12, 0x41, 0xF6, 0x90, 0x82, 0x80, 0xE0, 0xFE, +0xA3, 0xE0, 0xFF, 0x71, 0x6E, 0x90, 0x82, 0x80, 0xEE, 0xF0, 0xA3, 0xEF, 0xF0, 0x90, 0x82, 0x7E, +0xEE, 0x8F, 0xF0, 0x12, 0x41, 0xF6, 0x90, 0x80, 0xF5, 0xE0, 0xFE, 0xA3, 0xE0, 0xFF, 0xD3, 0x90, +0x82, 0x7F, 0xE0, 0x9F, 0x90, 0x82, 0x7E, 0xE0, 0x9E, 0x40, 0x1B, 0x90, 0x80, 0xF6, 0xE0, 0x24, +0x01, 0xFF, 0x90, 0x80, 0xF5, 0xE0, 0x34, 0x00, 0xFE, 0xC3, 0x90, 0x82, 0x7F, 0xE0, 0x9F, 0xF0, +0x90, 0x82, 0x7E, 0xE0, 0x9E, 0xF0, 0x90, 0x82, 0x7E, 0x12, 0x57, 0xC5, 0x0C, 0x61, 0xBF, 0x22, +0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x12, 0x1F, 0xA4, 0xFC, 0x20, 0xE0, 0x05, 0x12, 0x5C, +0x70, 0xA1, 0x97, 0x12, 0x1F, 0xA4, 0xFF, 0x54, 0x01, 0xFE, 0x90, 0x81, 0x54, 0xE0, 0x54, 0xFE, +0x4E, 0xFE, 0xF0, 0xEF, 0x54, 0x02, 0xFF, 0xEE, 0x54, 0xFD, 0x4F, 0xFF, 0xF0, 0x12, 0x1F, 0xA4, +0xFE, 0x54, 0x04, 0xFD, 0xEF, 0x54, 0xFB, 0x4D, 0xFF, 0x90, 0x81, 0x54, 0xF0, 0xEE, 0x54, 0x08, +0xFE, 0xEF, 0x54, 0xF7, 0x4E, 0xFF, 0xF0, 0x12, 0x1F, 0xA4, 0xFE, 0x54, 0x10, 0xFD, 0xEF, 0x54, +0xEF, 0x4D, 0xFF, 0x90, 0x81, 0x54, 0xF0, 0xEE, 0x54, 0x20, 0xFE, 0xEF, 0x54, 0xDF, 0x4E, 0xFF, +0xF0, 0x12, 0x1F, 0xA4, 0xFE, 0x54, 0x40, 0xFD, 0xEF, 0x54, 0xBF, 0x4D, 0xFF, 0x90, 0x81, 0x54, +0xF0, 0xEE, 0x54, 0x80, 0xFE, 0xEF, 0x54, 0x7F, 0x4E, 0xF0, 0x90, 0x00, 0x01, 0x12, 0x1F, 0xBD, +0xFD, 0x54, 0x80, 0xFF, 0x90, 0x81, 0x55, 0xE0, 0x54, 0x7F, 0x4F, 0xF0, 0xEC, 0x13, 0x13, 0x54, +0x3F, 0x30, 0xE0, 0x07, 0x90, 0x06, 0x90, 0xE0, 0x44, 0x04, 0xF0, 0x12, 0x1F, 0xA4, 0x13, 0x13, +0x13, 0x54, 0x1F, 0x30, 0xE0, 0x07, 0x90, 0x06, 0x90, 0xE0, 0x44, 0x08, 0xF0, 0x90, 0x80, 0x05, +0xE0, 0x64, 0x02, 0x70, 0x44, 0x90, 0x81, 0x55, 0xE0, 0xFF, 0xC4, 0x13, 0x13, 0x13, 0x54, 0x01, +0x20, 0xE0, 0x36, 0xED, 0x54, 0x7F, 0xFE, 0xEF, 0x54, 0x80, 0x4E, 0x90, 0x81, 0x55, 0xF0, 0x90, +0x00, 0x02, 0x12, 0x1F, 0xBD, 0x90, 0x81, 0x56, 0xF0, 0x90, 0x81, 0x54, 0xE0, 0xC4, 0x13, 0x54, +0x07, 0x30, 0xE0, 0x09, 0xA3, 0xE0, 0x54, 0x7F, 0xFF, 0xE4, 0xFD, 0x80, 0x09, 0x90, 0x81, 0x55, +0xE0, 0x54, 0x7F, 0xFF, 0x7D, 0x01, 0x12, 0x52, 0x47, 0x90, 0x80, 0x05, 0xE0, 0xB4, 0x01, 0x07, +0x90, 0xFE, 0x10, 0xE0, 0x44, 0x04, 0xF0, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x90, 0x81, 0x58, 0xE0, +0xFF, 0x20, 0xE0, 0x07, 0x90, 0x01, 0x3F, 0xE0, 0x30, 0xE2, 0x14, 0xEF, 0x44, 0x01, 0x90, 0x81, +0x58, 0xF0, 0x90, 0x81, 0x54, 0xE0, 0xC4, 0x54, 0x0F, 0x20, 0xE0, 0x03, 0x7F, 0x00, 0x22, 0x7F, +0x01, 0x22, 0xEF, 0x90, 0x01, 0xC7, 0xB4, 0xA0, 0x05, 0x74, 0x04, 0xF0, 0x80, 0x03, 0x74, 0x08, +0xF0, 0x90, 0x81, 0x58, 0xE0, 0x44, 0x01, 0xF0, 0x22, 0xE4, 0xFE, 0xEF, 0x2E, 0x24, 0x04, 0xF5, +0x82, 0xE4, 0x34, 0xFB, 0xF5, 0x83, 0xE0, 0xFD, 0x74, 0x8B, 0x2E, 0xF5, 0x82, 0xE4, 0x34, 0x82, +0xF5, 0x83, 0xED, 0xF0, 0x0E, 0xEE, 0xB4, 0x06, 0xE2, 0x78, 0x59, 0x7C, 0x81, 0x7D, 0x01, 0x7B, +0x01, 0x7A, 0x82, 0x79, 0x8B, 0x7E, 0x00, 0x7F, 0x06, 0x12, 0x44, 0x08, 0xEF, 0x7F, 0x00, 0x70, +0x02, 0x7F, 0x01, 0x22, 0x90, 0x82, 0x8B, 0xEE, 0xF0, 0xA3, 0xEF, 0xF0, 0xA3, 0xED, 0xF0, 0x78, +0x94, 0x7C, 0x82, 0x7D, 0x01, 0x7B, 0xFF, 0x7A, 0x40, 0x79, 0xC0, 0x7E, 0x00, 0x7F, 0x06, 0x12, +0x41, 0xD0, 0x78, 0x9A, 0x7C, 0x82, 0x7D, 0x01, 0x7B, 0xFF, 0x7A, 0x40, 0x79, 0xC6, 0x7E, 0x00, +0x7F, 0x04, 0x12, 0x41, 0xD0, 0x78, 0x9E, 0x7C, 0x82, 0x7D, 0x01, 0x7B, 0xFF, 0x7A, 0x40, 0x79, +0xCA, 0x7E, 0x00, 0x7F, 0x04, 0x12, 0x41, 0xD0, 0x90, 0x82, 0x8D, 0xE0, 0xFF, 0x90, 0x82, 0x8C, +0xE0, 0x2F, 0xFF, 0x90, 0x82, 0x8B, 0xE0, 0x34, 0x00, 0xCF, 0x24, 0x06, 0xCF, 0x34, 0x00, 0xFE, +0xE4, 0xFD, 0x12, 0x56, 0x5F, 0xEF, 0x64, 0x08, 0x60, 0x02, 0xE1, 0xD9, 0x90, 0x82, 0x8D, 0xE0, +0xFF, 0x90, 0x82, 0x8C, 0xE0, 0x2F, 0xFF, 0x90, 0x82, 0x8B, 0xE0, 0x34, 0x00, 0xCF, 0x24, 0x07, +0xCF, 0x34, 0x00, 0xFE, 0xE4, 0xFD, 0x12, 0x56, 0x5F, 0xEF, 0x64, 0x06, 0x60, 0x02, 0xE1, 0xD9, +0x90, 0x82, 0xA2, 0xF0, 0x90, 0x82, 0xA2, 0xE0, 0xFF, 0xC3, 0x94, 0x06, 0x50, 0x20, 0x90, 0x82, +0x8C, 0xE0, 0x24, 0x0A, 0x12, 0x56, 0x4D, 0x90, 0x82, 0xA2, 0xE0, 0x24, 0x8E, 0xF5, 0x82, 0xE4, +0x34, 0x82, 0xF5, 0x83, 0xEF, 0xF0, 0x90, 0x82, 0xA2, 0xE0, 0x04, 0xF0, 0x80, 0xD6, 0xE4, 0x90, +0x82, 0xA2, 0xF0, 0x90, 0x82, 0xA2, 0xE0, 0xFF, 0xC3, 0x94, 0x06, 0x50, 0x2F, 0x90, 0x82, 0x8D, +0xE0, 0xFD, 0x90, 0x82, 0x8C, 0xE0, 0x2D, 0xFD, 0x90, 0x82, 0x8B, 0xE0, 0x34, 0x00, 0xCD, 0x24, +0x10, 0xCD, 0x12, 0x56, 0x52, 0x90, 0x82, 0xA2, 0xE0, 0x24, 0x94, 0xF5, 0x82, 0xE4, 0x34, 0x82, +0xF5, 0x83, 0xEF, 0xF0, 0x90, 0x82, 0xA2, 0xE0, 0x04, 0xF0, 0x80, 0xC7, 0xE4, 0x90, 0x82, 0xA2, +0xF0, 0x90, 0x82, 0xA2, 0xE0, 0xFF, 0xC3, 0x94, 0x04, 0x50, 0x2F, 0x90, 0x82, 0x8D, 0xE0, 0xFD, +0x90, 0x82, 0x8C, 0xE0, 0x2D, 0xFD, 0x90, 0x82, 0x8B, 0xE0, 0x34, 0x00, 0xCD, 0x24, 0x16, 0xCD, +0x12, 0x56, 0x52, 0x90, 0x82, 0xA2, 0xE0, 0x24, 0x9A, 0xF5, 0x82, 0xE4, 0x34, 0x82, 0xF5, 0x83, +0xEF, 0xF0, 0x90, 0x82, 0xA2, 0xE0, 0x04, 0xF0, 0x80, 0xC7, 0x78, 0x8E, 0x7C, 0x82, 0x7D, 0x01, +0x7B, 0x01, 0x7A, 0x81, 0x79, 0x5F, 0x7E, 0x00, 0x7F, 0x06, 0x12, 0x44, 0x08, 0xEF, 0x70, 0x79, +0x90, 0x82, 0xA2, 0xF0, 0x90, 0x82, 0xA2, 0xE0, 0xFF, 0xC3, 0x94, 0x04, 0x50, 0x2F, 0x90, 0x82, +0x8D, 0xE0, 0xFD, 0x90, 0x82, 0x8C, 0xE0, 0x2D, 0xFD, 0x90, 0x82, 0x8B, 0xE0, 0x34, 0x00, 0xCD, +0x24, 0x20, 0xCD, 0x12, 0x56, 0x52, 0x90, 0x82, 0xA2, 0xE0, 0x24, 0x9E, 0xF5, 0x82, 0xE4, 0x34, +0x82, 0xF5, 0x83, 0xEF, 0xF0, 0x90, 0x82, 0xA2, 0xE0, 0x04, 0xF0, 0x80, 0xC7, 0x78, 0x9E, 0x7C, +0x82, 0x7D, 0x01, 0x7B, 0x01, 0x7A, 0x81, 0x79, 0x6C, 0x7E, 0x00, 0x7F, 0x04, 0x12, 0x44, 0x08, +0xEF, 0x90, 0x06, 0x30, 0x70, 0x1D, 0xE0, 0x44, 0x01, 0x54, 0xDF, 0xF0, 0x7B, 0x01, 0x7A, 0x82, +0x79, 0x94, 0x90, 0x82, 0xA6, 0x12, 0x42, 0x53, 0xE4, 0x90, 0x82, 0xA9, 0xF0, 0x7A, 0x82, 0x79, +0x9A, 0x80, 0x07, 0xE0, 0x44, 0x21, 0x54, 0xEF, 0xF0, 0x22, 0x90, 0x82, 0xA3, 0x12, 0x42, 0x53, +0x90, 0x82, 0x58, 0xE0, 0xFF, 0x7D, 0x01, 0x12, 0x4D, 0xB7, 0x90, 0x82, 0xAA, 0x12, 0x5E, 0x75, +0x90, 0x82, 0xAC, 0xEF, 0xF0, 0x90, 0x82, 0xAA, 0xA3, 0xE0, 0x24, 0x20, 0xF9, 0xE4, 0x34, 0xFC, +0xFA, 0x7B, 0x01, 0x90, 0x82, 0xA9, 0xE0, 0xFD, 0x12, 0x5E, 0xAA, 0x90, 0x82, 0xAA, 0xA3, 0xE0, +0x24, 0x30, 0xF9, 0xE4, 0x34, 0xFC, 0xFA, 0x7B, 0x01, 0xC0, 0x03, 0xC0, 0x02, 0xC0, 0x01, 0x90, +0x82, 0xA6, 0x12, 0x42, 0x4A, 0x8B, 0x13, 0x8A, 0x14, 0x89, 0x15, 0x75, 0x16, 0x06, 0xD0, 0x01, +0xD0, 0x02, 0xD0, 0x03, 0x12, 0x2B, 0xED, 0x90, 0x82, 0xAA, 0xA3, 0xE0, 0xFF, 0xA3, 0xE0, 0x2F, +0x24, 0x3A, 0xF9, 0xE4, 0x34, 0xFC, 0xFA, 0x7B, 0x01, 0xC0, 0x03, 0xC0, 0x02, 0xC0, 0x01, 0x90, +0x82, 0xA6, 0x12, 0x42, 0x4A, 0x8B, 0x13, 0x8A, 0x14, 0x89, 0x15, 0x75, 0x16, 0x06, 0xD0, 0x01, +0xD0, 0x02, 0xD0, 0x03, 0x12, 0x2B, 0xED, 0x90, 0x82, 0xAA, 0xA3, 0xE0, 0xFF, 0xA3, 0xE0, 0x2F, +0x24, 0x40, 0xF9, 0xE4, 0x34, 0xFC, 0xFA, 0x7B, 0x01, 0xC0, 0x03, 0xC0, 0x02, 0xC0, 0x01, 0x90, +0x82, 0xA3, 0x12, 0x42, 0x4A, 0x8B, 0x13, 0x8A, 0x14, 0x89, 0x15, 0x75, 0x16, 0x04, 0xD0, 0x01, +0xD0, 0x02, 0xD0, 0x03, 0x12, 0x2B, 0xED, 0x90, 0x06, 0x30, 0xE0, 0x44, 0x10, 0xF0, 0x12, 0x6F, +0x5B, 0xBF, 0x01, 0x0E, 0x90, 0x82, 0x58, 0xE0, 0x90, 0x04, 0x25, 0xF0, 0x90, 0x04, 0x1F, 0x74, +0x20, 0xF0, 0x22, 0xE4, 0xFF, 0x74, 0x18, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x06, 0xF5, 0x83, 0xE0, +0xFE, 0x74, 0x5F, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x81, 0xF5, 0x83, 0xEE, 0xF0, 0x74, 0x10, 0x2F, +0xF5, 0x82, 0xE4, 0x34, 0x06, 0xF5, 0x83, 0xE0, 0xFE, 0x74, 0x59, 0x2F, 0xF5, 0x82, 0xE4, 0x34, +0x81, 0xF5, 0x83, 0xEE, 0xF0, 0x0F, 0xEF, 0xB4, 0x06, 0xCB, 0x22, 0x90, 0x82, 0x68, 0xE0, 0x30, +0xE0, 0x36, 0x90, 0x82, 0x6B, 0xE0, 0x04, 0xF0, 0xE0, 0xFF, 0x90, 0x82, 0x69, 0xE0, 0x6F, 0x70, +0x27, 0x90, 0x06, 0x92, 0xE0, 0x20, 0xE2, 0x11, 0x90, 0x82, 0x6D, 0xE0, 0x70, 0x0B, 0x12, 0x4F, +0xC5, 0x90, 0x82, 0x6C, 0xE0, 0x04, 0xF0, 0x80, 0x06, 0x90, 0x06, 0x92, 0x74, 0x04, 0xF0, 0xE4, +0x90, 0x82, 0x6B, 0xF0, 0x90, 0x82, 0x6D, 0xF0, 0x22, 0x90, 0x82, 0xE1, 0x12, 0x42, 0x53, 0x12, +0x1F, 0xA4, 0x90, 0x82, 0xE6, 0xF0, 0x90, 0x00, 0x01, 0x12, 0x1F, 0xBD, 0x90, 0x82, 0xE7, 0xF0, +0x90, 0x00, 0x04, 0x12, 0x1F, 0xBD, 0x90, 0x82, 0xE8, 0xF0, 0x90, 0x00, 0x05, 0x12, 0x1F, 0xBD, +0x90, 0x82, 0xE9, 0xF0, 0x90, 0x00, 0x06, 0x12, 0x1F, 0xBD, 0x90, 0x82, 0xEA, 0xF0, 0x90, 0x00, +0x07, 0x12, 0x1F, 0xBD, 0x90, 0x82, 0xEB, 0xF0, 0x90, 0x00, 0x03, 0x12, 0x1F, 0xBD, 0x90, 0x82, +0xEE, 0xF0, 0xED, 0x70, 0x31, 0xFF, 0x74, 0xE6, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x82, 0xF5, 0x83, +0xE0, 0xB4, 0xFF, 0x0E, 0x74, 0xE6, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x82, 0xF5, 0x83, 0xE4, 0xF0, +0x80, 0x0F, 0x74, 0xE6, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x82, 0xF5, 0x83, 0xE0, 0x04, 0xF0, 0x80, +0x05, 0x0F, 0xEF, 0xB4, 0x06, 0xD0, 0x90, 0x82, 0xE5, 0xE0, 0xFF, 0xB4, 0x04, 0x25, 0xA3, 0xE0, +0xFE, 0x90, 0x82, 0xE1, 0x12, 0x42, 0x4A, 0xEE, 0x12, 0x1F, 0xEA, 0x90, 0x82, 0xE7, 0xE0, 0xFE, +0x90, 0x82, 0xE1, 0x12, 0x42, 0x4A, 0x90, 0x00, 0x01, 0xEE, 0x12, 0x1F, 0xFC, 0x90, 0x00, 0x02, +0xE4, 0x80, 0x30, 0xEF, 0xB4, 0x02, 0x2F, 0x90, 0x82, 0xE7, 0xE0, 0xFF, 0x90, 0x82, 0xE1, 0x12, +0x42, 0x4A, 0xEF, 0x12, 0x1F, 0xEA, 0x90, 0x82, 0xE7, 0xE0, 0x44, 0x20, 0x54, 0x7F, 0xFF, 0x90, +0x82, 0xE1, 0x12, 0x42, 0x4A, 0x90, 0x00, 0x01, 0xEF, 0x12, 0x1F, 0xFC, 0x90, 0x82, 0xE6, 0xE0, +0x90, 0x00, 0x02, 0x12, 0x1F, 0xFC, 0x90, 0x82, 0xE1, 0x12, 0x42, 0x4A, 0xE9, 0x24, 0x03, 0xF9, +0xE4, 0x3A, 0xFA, 0x12, 0x1F, 0xA4, 0x44, 0x20, 0x12, 0x1F, 0xEA, 0x90, 0x82, 0xE8, 0xE0, 0xFF, +0x90, 0x82, 0xE1, 0x12, 0x42, 0x4A, 0x90, 0x00, 0x04, 0xEF, 0x12, 0x1F, 0xFC, 0x90, 0x82, 0xE9, +0xE0, 0x90, 0x00, 0x05, 0x12, 0x1F, 0xFC, 0x90, 0x82, 0xEA, 0xE0, 0x90, 0x00, 0x06, 0x12, 0x1F, +0xFC, 0x90, 0x82, 0xEB, 0xE0, 0x90, 0x00, 0x07, 0x02, 0x1F, 0xFC, 0x90, 0x82, 0xFC, 0xED, 0xF0, +0x90, 0x82, 0xF9, 0x12, 0x42, 0x53, 0x90, 0x00, 0x03, 0x12, 0x1F, 0xBD, 0x90, 0x83, 0x00, 0xF0, +0x90, 0x82, 0xF9, 0x12, 0x42, 0x4A, 0x8B, 0x13, 0x8A, 0x14, 0x89, 0x15, 0x75, 0x16, 0x03, 0x7B, +0x01, 0x7A, 0x82, 0x79, 0xFD, 0x12, 0x2B, 0xED, 0x90, 0x82, 0xFC, 0xE0, 0x70, 0x46, 0xFF, 0x74, +0xFD, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x82, 0xF5, 0x83, 0xE0, 0xB4, 0xFF, 0x0E, 0x74, 0xFD, 0x2F, +0xF5, 0x82, 0xE4, 0x34, 0x82, 0xF5, 0x83, 0xE4, 0xF0, 0x80, 0x0F, 0x74, 0xFD, 0x2F, 0xF5, 0x82, +0xE4, 0x34, 0x82, 0xF5, 0x83, 0xE0, 0x04, 0xF0, 0x80, 0x05, 0x0F, 0xEF, 0xB4, 0x03, 0xD0, 0x75, +0x13, 0x01, 0x75, 0x14, 0x82, 0x75, 0x15, 0xFD, 0x75, 0x16, 0x03, 0x90, 0x82, 0xF9, 0x12, 0x42, +0x4A, 0x12, 0x2B, 0xED, 0x22, 0x00, 0xDB, 0x90, +}; +#if 0 +u4Byte ArrayLength_8188E_FW_WoWLAN = 15554; + + +void +ODM_ReadFirmware_8188E_FW_WoWLAN( + IN PDM_ODM_T pDM_Odm, + OUT u1Byte *pFirmware, + OUT u4Byte *pFirmwareSize +) +{ + ODM_MoveMemory(pDM_Odm, pFirmware, Array_8188E_FW_WoWLAN, ArrayLength_8188E_FW_WoWLAN); + *pFirmwareSize = ArrayLength_8188E_FW_WoWLAN; +} + +#endif + +#endif // end of DM_ODM_SUPPORT_TYPE & (ODM_AP) + + +#endif // end of HWIMG_SUPPORT diff --git a/hal/HalHWImg8188E_MAC.c b/hal/HalHWImg8188E_MAC.c index 4a60c63..7c5c99c 100755 --- a/hal/HalHWImg8188E_MAC.c +++ b/hal/HalHWImg8188E_MAC.c @@ -1,502 +1,501 @@ -/****************************************************************************** -* -* 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 -* -* -******************************************************************************/ - -#include "odm_precomp.h" -#ifdef CONFIG_IOL_IOREG_CFG -#include -#endif -#if (RTL8188E_SUPPORT == 1) -static BOOLEAN -CheckCondition( - const u4Byte Condition, - const u4Byte Hex - ) -{ - u4Byte _board = (Hex & 0x000000FF); - u4Byte _interface = (Hex & 0x0000FF00) >> 8; - u4Byte _platform = (Hex & 0x00FF0000) >> 16; - u4Byte cond = Condition; - - if ( Condition == 0xCDCDCDCD ) - return TRUE; - - cond = Condition & 0x000000FF; - if ( (_board != cond) && (cond != 0xFF) ) - return FALSE; - - cond = Condition & 0x0000FF00; - cond = cond >> 8; - if ( ((_interface & cond) == 0) && (cond != 0x07) ) - return FALSE; - - cond = Condition & 0x00FF0000; - cond = cond >> 16; - if ( ((_platform & cond) == 0) && (cond != 0x0F) ) - return FALSE; - return TRUE; -} - - -/****************************************************************************** -* MAC_REG.TXT -******************************************************************************/ - -u4Byte Array_MAC_REG_8188E[] = { - 0x026, 0x00000041, - 0x027, 0x00000035, - 0xFF0F0718, 0xABCD, - 0x040, 0x0000000C, - 0xCDCDCDCD, 0xCDCD, - 0x040, 0x00000000, - 0xFF0F0718, 0xDEAD, - 0x428, 0x0000000A, - 0x429, 0x00000010, - 0x430, 0x00000000, - 0x431, 0x00000001, - 0x432, 0x00000002, - 0x433, 0x00000004, - 0x434, 0x00000005, - 0x435, 0x00000006, - 0x436, 0x00000007, - 0x437, 0x00000008, - 0x438, 0x00000000, - 0x439, 0x00000000, - 0x43A, 0x00000001, - 0x43B, 0x00000002, - 0x43C, 0x00000004, - 0x43D, 0x00000005, - 0x43E, 0x00000006, - 0x43F, 0x00000007, - 0x440, 0x0000005D, - 0x441, 0x00000001, - 0x442, 0x00000000, - 0x444, 0x00000015, - 0x445, 0x000000F0, - 0x446, 0x0000000F, - 0x447, 0x00000000, - 0x458, 0x00000041, - 0x459, 0x000000A8, - 0x45A, 0x00000072, - 0x45B, 0x000000B9, - 0x460, 0x00000066, - 0x461, 0x00000066, - 0x480, 0x00000008, - 0x4C8, 0x000000FF, - 0x4C9, 0x00000008, - 0x4CC, 0x000000FF, - 0x4CD, 0x000000FF, - 0x4CE, 0x00000001, - 0x4D3, 0x00000001, - 0x500, 0x00000026, - 0x501, 0x000000A2, - 0x502, 0x0000002F, - 0x503, 0x00000000, - 0x504, 0x00000028, - 0x505, 0x000000A3, - 0x506, 0x0000005E, - 0x507, 0x00000000, - 0x508, 0x0000002B, - 0x509, 0x000000A4, - 0x50A, 0x0000005E, - 0x50B, 0x00000000, - 0x50C, 0x0000004F, - 0x50D, 0x000000A4, - 0x50E, 0x00000000, - 0x50F, 0x00000000, - 0x512, 0x0000001C, - 0x514, 0x0000000A, - 0x516, 0x0000000A, - 0x525, 0x0000004F, - 0x550, 0x00000010, - 0x551, 0x00000010, - 0x559, 0x00000002, - 0x55D, 0x000000FF, - 0x605, 0x00000030, - 0x608, 0x0000000E, - 0x609, 0x0000002A, - 0x620, 0x000000FF, - 0x621, 0x000000FF, - 0x622, 0x000000FF, - 0x623, 0x000000FF, - 0x624, 0x000000FF, - 0x625, 0x000000FF, - 0x626, 0x000000FF, - 0x627, 0x000000FF, - 0x652, 0x00000020, - 0x63C, 0x0000000A, - 0x63D, 0x0000000A, - 0x63E, 0x0000000E, - 0x63F, 0x0000000E, - 0x640, 0x00000040, - 0x66E, 0x00000005, - 0x700, 0x00000021, - 0x701, 0x00000043, - 0x702, 0x00000065, - 0x703, 0x00000087, - 0x708, 0x00000021, - 0x709, 0x00000043, - 0x70A, 0x00000065, - 0x70B, 0x00000087, -}; - -HAL_STATUS -ODM_ReadAndConfig_MAC_REG_8188E( - IN PDM_ODM_T pDM_Odm - ) -{ - #define READ_NEXT_PAIR(v1, v2, i) do { i += 2; v1 = Array[i]; v2 = Array[i+1]; } while(0) - - u4Byte hex = 0; - u4Byte i = 0; - u2Byte count = 0; - pu4Byte ptr_array = NULL; - u1Byte platform = pDM_Odm->SupportPlatform; - u1Byte interfaceValue = pDM_Odm->SupportInterface; - u1Byte board = pDM_Odm->BoardType; - u4Byte ArrayLen = sizeof(Array_MAC_REG_8188E)/sizeof(u4Byte); - pu4Byte Array = Array_MAC_REG_8188E; - BOOLEAN biol = FALSE; - -#ifdef CONFIG_IOL_IOREG_CFG - PADAPTER Adapter = pDM_Odm->Adapter; - struct xmit_frame *pxmit_frame; - u8 bndy_cnt = 1; - #ifdef CONFIG_IOL_IOREG_CFG_DBG - struct cmd_cmp cmpdata[ArrayLen]; - u4Byte cmpdata_idx=0; - #endif -#endif //CONFIG_IOL_IOREG_CFG - HAL_STATUS rst =HAL_STATUS_SUCCESS; - hex += board; - hex += interfaceValue << 8; - hex += platform << 16; - hex += 0xFF000000; - -#ifdef CONFIG_IOL_IOREG_CFG - biol = rtw_IOL_applied(Adapter); - - if(biol){ - if((pxmit_frame=rtw_IOL_accquire_xmit_frame(Adapter)) == NULL) - { - printk("rtw_IOL_accquire_xmit_frame failed\n"); - return HAL_STATUS_FAILURE; - } - } - -#endif //CONFIG_IOL_IOREG_CFG - - for (i = 0; i < ArrayLen; i += 2 ) - { - u4Byte v1 = Array[i]; - u4Byte v2 = Array[i+1]; - - // This (offset, data) pair meets the condition. - if ( v1 < 0xCDCDCDCD ) - { - #ifdef CONFIG_IOL_IOREG_CFG - - if(biol){ - - if(rtw_IOL_cmd_boundary_handle(pxmit_frame)) - bndy_cnt++; - rtw_IOL_append_WB_cmd(pxmit_frame,(u2Byte)v1, (u1Byte)v2,0xFF); - #ifdef CONFIG_IOL_IOREG_CFG_DBG - cmpdata[cmpdata_idx].addr = v1; - cmpdata[cmpdata_idx].value= v2; - cmpdata_idx++; - #endif - } - else - #endif //endif CONFIG_IOL_IOREG_CFG - { - odm_ConfigMAC_8188E(pDM_Odm, v1, (u1Byte)v2); - } - continue; - } - else - { // This line is the start line of branch. - if ( !CheckCondition(Array[i], hex) ) - { // Discard the following (offset, data) pairs. - READ_NEXT_PAIR(v1, v2, i); - while ( v2 != 0xDEAD && - v2 != 0xCDEF && - v2 != 0xCDCD && i < ArrayLen -2) - { - READ_NEXT_PAIR(v1, v2, i); - } - i -= 2; // prevent from for-loop += 2 - } - else // Configure matched pairs and skip to end of if-else. - { - READ_NEXT_PAIR(v1, v2, i); - while ( v2 != 0xDEAD && - v2 != 0xCDEF && - v2 != 0xCDCD && i < ArrayLen -2) - { - #ifdef CONFIG_IOL_IOREG_CFG - if(biol){ - if(rtw_IOL_cmd_boundary_handle(pxmit_frame)) - bndy_cnt++; - rtw_IOL_append_WB_cmd(pxmit_frame,(u2Byte)v1, (u1Byte)v2,0xFF); - #ifdef CONFIG_IOL_IOREG_CFG_DBG - cmpdata[cmpdata_idx].addr = v1; - cmpdata[cmpdata_idx].value= v2; - cmpdata_idx++; - #endif - } - else - #endif //#ifdef CONFIG_IOL_IOREG_CFG - { - odm_ConfigMAC_8188E(pDM_Odm, v1, (u1Byte)v2); - } - - READ_NEXT_PAIR(v1, v2, i); - } - - while (v2 != 0xDEAD && i < ArrayLen -2) - { - READ_NEXT_PAIR(v1, v2, i); - } - - } - } - } - -#ifdef CONFIG_IOL_IOREG_CFG - if(biol){ - //printk("==> %s, pktlen = %d,bndy_cnt = %d\n",__FUNCTION__,pxmit_frame->attrib.pktlen+4+32,bndy_cnt); - - if(rtw_IOL_exec_cmds_sync(pDM_Odm->Adapter, pxmit_frame, 1000, bndy_cnt)) - { - #ifdef CONFIG_IOL_IOREG_CFG_DBG - printk("~~~ IOL Config MAC Success !!! \n"); - //compare writed data - { - u4Byte idx; - u1Byte cdata; - // HAL_STATUS_FAILURE; - printk(" MAC data compare => array_len:%d \n",cmpdata_idx); - for(idx=0;idx< cmpdata_idx;idx++) - { - cdata = ODM_Read1Byte(pDM_Odm, cmpdata[idx].addr); - if(cdata != cmpdata[idx].value){ - printk("### MAC data compared failed !! addr:0x%04x, data:(0x%02x : 0x%02x) ###\n", - cmpdata[idx].addr,cmpdata[idx].value,cdata); - //rst = HAL_STATUS_FAILURE; - } - } - - - //dump data from TX packet buffer - //if(rst == HAL_STATUS_FAILURE) - { - rtw_IOL_cmd_tx_pkt_buf_dump(pDM_Odm->Adapter,pxmit_frame->attrib.pktlen+32); - } - - } - #endif //CONFIG_IOL_IOREG_CFG_DBG - - } - else{ - printk("~~~ MAC IOL_exec_cmds Failed !!! \n"); - #ifdef CONFIG_IOL_IOREG_CFG_DBG - { - //dump data from TX packet buffer - rtw_IOL_cmd_tx_pkt_buf_dump(pDM_Odm->Adapter,pxmit_frame->attrib.pktlen+32); - } - #endif //CONFIG_IOL_IOREG_CFG_DBG - rst = HAL_STATUS_FAILURE; - } - - } -#endif //#ifdef CONFIG_IOL_IOREG_CFG - return rst; -} - -/****************************************************************************** -* MAC_REG_ICUT.TXT -******************************************************************************/ - -u4Byte Array_MP_8188E_MAC_REG_ICUT[] = { - 0x026, 0x00000041, - 0x027, 0x00000035, - 0x428, 0x0000000A, - 0x429, 0x00000010, - 0x430, 0x00000000, - 0x431, 0x00000001, - 0x432, 0x00000002, - 0x433, 0x00000004, - 0x434, 0x00000005, - 0x435, 0x00000006, - 0x436, 0x00000007, - 0x437, 0x00000008, - 0x438, 0x00000000, - 0x439, 0x00000000, - 0x43A, 0x00000001, - 0x43B, 0x00000002, - 0x43C, 0x00000004, - 0x43D, 0x00000005, - 0x43E, 0x00000006, - 0x43F, 0x00000007, - 0x440, 0x0000005D, - 0x441, 0x00000001, - 0x442, 0x00000000, - 0x444, 0x00000015, - 0x445, 0x000000F0, - 0x446, 0x0000000F, - 0x447, 0x00000000, - 0x458, 0x00000041, - 0x459, 0x000000A8, - 0x45A, 0x00000072, - 0x45B, 0x000000B9, - 0x460, 0x00000066, - 0x461, 0x00000066, - 0x480, 0x00000008, - 0x4C8, 0x000000FF, - 0x4C9, 0x00000008, - 0x4CC, 0x000000FF, - 0x4CD, 0x000000FF, - 0x4CE, 0x00000001, - 0x4D3, 0x00000001, - 0x500, 0x00000026, - 0x501, 0x000000A2, - 0x502, 0x0000002F, - 0x503, 0x00000000, - 0x504, 0x00000028, - 0x505, 0x000000A3, - 0x506, 0x0000005E, - 0x507, 0x00000000, - 0x508, 0x0000002B, - 0x509, 0x000000A4, - 0x50A, 0x0000005E, - 0x50B, 0x00000000, - 0x50C, 0x0000004F, - 0x50D, 0x000000A4, - 0x50E, 0x00000000, - 0x50F, 0x00000000, - 0x512, 0x0000001C, - 0x514, 0x0000000A, - 0x516, 0x0000000A, - 0x525, 0x0000004F, - 0x550, 0x00000010, - 0x551, 0x00000010, - 0x559, 0x00000002, - 0x55D, 0x000000FF, - 0x605, 0x00000030, - 0x608, 0x0000000E, - 0x609, 0x0000002A, - 0x620, 0x000000FF, - 0x621, 0x000000FF, - 0x622, 0x000000FF, - 0x623, 0x000000FF, - 0x624, 0x000000FF, - 0x625, 0x000000FF, - 0x626, 0x000000FF, - 0x627, 0x000000FF, - 0x652, 0x00000020, - 0x63C, 0x0000000A, - 0x63D, 0x0000000A, - 0x63E, 0x0000000E, - 0x63F, 0x0000000E, - 0x640, 0x00000040, - 0x66E, 0x00000005, - 0x700, 0x00000021, - 0x701, 0x00000043, - 0x702, 0x00000065, - 0x703, 0x00000087, - 0x708, 0x00000021, - 0x709, 0x00000043, - 0x70A, 0x00000065, - 0x70B, 0x00000087, - -}; - -void -ODM_ReadAndConfig_MAC_REG_ICUT_8188E( - IN PDM_ODM_T pDM_Odm - ) -{ - #define READ_NEXT_PAIR(v1, v2, i) do { i += 2; v1 = Array[i]; v2 = Array[i+1]; } while(0) - - u4Byte hex = 0; - u4Byte i = 0; - u2Byte count = 0; - pu4Byte ptr_array = NULL; - u1Byte platform = pDM_Odm->SupportPlatform; - u1Byte _interface = pDM_Odm->SupportInterface; - u1Byte board = pDM_Odm->BoardType; - u4Byte ArrayLen = sizeof(Array_MP_8188E_MAC_REG_ICUT)/sizeof(u4Byte); - pu4Byte Array = Array_MP_8188E_MAC_REG_ICUT; - - - hex += board; - hex += _interface << 8; - hex += platform << 16; - hex += 0xFF000000; - ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_TRACE, ("===> ODM_ReadAndConfig_MP_8188E_MAC_REG_ICUT, hex = 0x%X\n", hex)); - - for (i = 0; i < ArrayLen; i += 2 ) - { - u4Byte v1 = Array[i]; - u4Byte v2 = Array[i+1]; - - // This (offset, data) pair meets the condition. - if ( v1 < 0xCDCDCDCD ) - { - odm_ConfigMAC_8188E(pDM_Odm, v1, (u1Byte)v2); - continue; - } - else - { // This line is the start line of branch. - if ( !CheckCondition(Array[i], hex) ) - { // Discard the following (offset, data) pairs. - READ_NEXT_PAIR(v1, v2, i); - while (v2 != 0xDEAD && - v2 != 0xCDEF && - v2 != 0xCDCD && i < ArrayLen -2) - { - READ_NEXT_PAIR(v1, v2, i); - } - i -= 2; // prevent from for-loop += 2 - } - else // Configure matched pairs and skip to end of if-else. - { - READ_NEXT_PAIR(v1, v2, i); - while (v2 != 0xDEAD && - v2 != 0xCDEF && - v2 != 0xCDCD && i < ArrayLen -2) - { - odm_ConfigMAC_8188E(pDM_Odm, v1, (u1Byte)v2); - READ_NEXT_PAIR(v1, v2, i); - } - - while (v2 != 0xDEAD && i < ArrayLen -2) - { - READ_NEXT_PAIR(v1, v2, i); - } - - } - } - } - -} - -#endif // end of HWIMG_SUPPORT - +/****************************************************************************** +* +* 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 +* +* +******************************************************************************/ + +#include "odm_precomp.h" +#ifdef CONFIG_IOL_IOREG_CFG +#include +#endif +#if (RTL8188E_SUPPORT == 1) +static BOOLEAN +CheckCondition( + const u4Byte Condition, + const u4Byte Hex + ) +{ + u4Byte _board = (Hex & 0x000000FF); + u4Byte _interface = (Hex & 0x0000FF00) >> 8; + u4Byte _platform = (Hex & 0x00FF0000) >> 16; + u4Byte cond = Condition; + + if ( Condition == 0xCDCDCDCD ) + return TRUE; + + cond = Condition & 0x000000FF; + if ( (_board != cond) && (cond != 0xFF) ) + return FALSE; + + cond = Condition & 0x0000FF00; + cond = cond >> 8; + if ( ((_interface & cond) == 0) && (cond != 0x07) ) + return FALSE; + + cond = Condition & 0x00FF0000; + cond = cond >> 16; + if ( ((_platform & cond) == 0) && (cond != 0x0F) ) + return FALSE; + return TRUE; +} + + +/****************************************************************************** +* MAC_REG.TXT +******************************************************************************/ + +u4Byte Array_MAC_REG_8188E[] = { + 0x026, 0x00000041, + 0x027, 0x00000035, + 0xFF0F0718, 0xABCD, + 0x040, 0x0000000C, + 0xCDCDCDCD, 0xCDCD, + 0x040, 0x00000000, + 0xFF0F0718, 0xDEAD, + 0x428, 0x0000000A, + 0x429, 0x00000010, + 0x430, 0x00000000, + 0x431, 0x00000001, + 0x432, 0x00000002, + 0x433, 0x00000004, + 0x434, 0x00000005, + 0x435, 0x00000006, + 0x436, 0x00000007, + 0x437, 0x00000008, + 0x438, 0x00000000, + 0x439, 0x00000000, + 0x43A, 0x00000001, + 0x43B, 0x00000002, + 0x43C, 0x00000004, + 0x43D, 0x00000005, + 0x43E, 0x00000006, + 0x43F, 0x00000007, + 0x440, 0x0000005D, + 0x441, 0x00000001, + 0x442, 0x00000000, + 0x444, 0x00000015, + 0x445, 0x000000F0, + 0x446, 0x0000000F, + 0x447, 0x00000000, + 0x458, 0x00000041, + 0x459, 0x000000A8, + 0x45A, 0x00000072, + 0x45B, 0x000000B9, + 0x460, 0x00000066, + 0x461, 0x00000066, + 0x480, 0x00000008, + 0x4C8, 0x000000FF, + 0x4C9, 0x00000008, + 0x4CC, 0x000000FF, + 0x4CD, 0x000000FF, + 0x4CE, 0x00000001, + 0x4D3, 0x00000001, + 0x500, 0x00000026, + 0x501, 0x000000A2, + 0x502, 0x0000002F, + 0x503, 0x00000000, + 0x504, 0x00000028, + 0x505, 0x000000A3, + 0x506, 0x0000005E, + 0x507, 0x00000000, + 0x508, 0x0000002B, + 0x509, 0x000000A4, + 0x50A, 0x0000005E, + 0x50B, 0x00000000, + 0x50C, 0x0000004F, + 0x50D, 0x000000A4, + 0x50E, 0x00000000, + 0x50F, 0x00000000, + 0x512, 0x0000001C, + 0x514, 0x0000000A, + 0x516, 0x0000000A, + 0x525, 0x0000004F, + 0x550, 0x00000010, + 0x551, 0x00000010, + 0x559, 0x00000002, + 0x55D, 0x000000FF, + 0x605, 0x00000030, + 0x608, 0x0000000E, + 0x609, 0x0000002A, + 0x620, 0x000000FF, + 0x621, 0x000000FF, + 0x622, 0x000000FF, + 0x623, 0x000000FF, + 0x624, 0x000000FF, + 0x625, 0x000000FF, + 0x626, 0x000000FF, + 0x627, 0x000000FF, + 0x652, 0x00000020, + 0x63C, 0x0000000A, + 0x63D, 0x0000000A, + 0x63E, 0x0000000E, + 0x63F, 0x0000000E, + 0x640, 0x00000040, + 0x66E, 0x00000005, + 0x700, 0x00000021, + 0x701, 0x00000043, + 0x702, 0x00000065, + 0x703, 0x00000087, + 0x708, 0x00000021, + 0x709, 0x00000043, + 0x70A, 0x00000065, + 0x70B, 0x00000087, +}; + +HAL_STATUS +ODM_ReadAndConfig_MAC_REG_8188E( + IN PDM_ODM_T pDM_Odm + ) +{ + #define READ_NEXT_PAIR(v1, v2, i) do { i += 2; v1 = Array[i]; v2 = Array[i+1]; } while(0) + + u4Byte hex = 0; + u4Byte i = 0; + u2Byte count = 0; + pu4Byte ptr_array = NULL; + u1Byte platform = pDM_Odm->SupportPlatform; + u1Byte interfaceValue = pDM_Odm->SupportInterface; + u1Byte board = pDM_Odm->BoardType; + u4Byte ArrayLen = sizeof(Array_MAC_REG_8188E)/sizeof(u4Byte); + pu4Byte Array = Array_MAC_REG_8188E; + BOOLEAN biol = FALSE; + +#ifdef CONFIG_IOL_IOREG_CFG + PADAPTER Adapter = pDM_Odm->Adapter; + struct xmit_frame *pxmit_frame; + u8 bndy_cnt = 1; + #ifdef CONFIG_IOL_IOREG_CFG_DBG + struct cmd_cmp cmpdata[ArrayLen]; + u4Byte cmpdata_idx=0; + #endif +#endif //CONFIG_IOL_IOREG_CFG + HAL_STATUS rst =HAL_STATUS_SUCCESS; + hex += board; + hex += interfaceValue << 8; + hex += platform << 16; + hex += 0xFF000000; + +#ifdef CONFIG_IOL_IOREG_CFG + biol = rtw_IOL_applied(Adapter); + + if(biol){ + if((pxmit_frame=rtw_IOL_accquire_xmit_frame(Adapter)) == NULL) + { + printk("rtw_IOL_accquire_xmit_frame failed\n"); + return HAL_STATUS_FAILURE; + } + } + +#endif //CONFIG_IOL_IOREG_CFG + + for (i = 0; i < ArrayLen; i += 2 ) + { + u4Byte v1 = Array[i]; + u4Byte v2 = Array[i+1]; + + // This (offset, data) pair meets the condition. + if ( v1 < 0xCDCDCDCD ) + { + #ifdef CONFIG_IOL_IOREG_CFG + + if(biol){ + + if(rtw_IOL_cmd_boundary_handle(pxmit_frame)) + bndy_cnt++; + rtw_IOL_append_WB_cmd(pxmit_frame,(u2Byte)v1, (u1Byte)v2,0xFF); + #ifdef CONFIG_IOL_IOREG_CFG_DBG + cmpdata[cmpdata_idx].addr = v1; + cmpdata[cmpdata_idx].value= v2; + cmpdata_idx++; + #endif + } + else + #endif //endif CONFIG_IOL_IOREG_CFG + { + odm_ConfigMAC_8188E(pDM_Odm, v1, (u1Byte)v2); + } + continue; + } + else + { // This line is the start line of branch. + if ( !CheckCondition(Array[i], hex) ) + { // Discard the following (offset, data) pairs. + READ_NEXT_PAIR(v1, v2, i); + while ( v2 != 0xDEAD && + v2 != 0xCDEF && + v2 != 0xCDCD && i < ArrayLen -2) + { + READ_NEXT_PAIR(v1, v2, i); + } + i -= 2; // prevent from for-loop += 2 + } + else // Configure matched pairs and skip to end of if-else. + { + READ_NEXT_PAIR(v1, v2, i); + while ( v2 != 0xDEAD && + v2 != 0xCDEF && + v2 != 0xCDCD && i < ArrayLen -2) + { + #ifdef CONFIG_IOL_IOREG_CFG + if(biol){ + if(rtw_IOL_cmd_boundary_handle(pxmit_frame)) + bndy_cnt++; + rtw_IOL_append_WB_cmd(pxmit_frame,(u2Byte)v1, (u1Byte)v2,0xFF); + #ifdef CONFIG_IOL_IOREG_CFG_DBG + cmpdata[cmpdata_idx].addr = v1; + cmpdata[cmpdata_idx].value= v2; + cmpdata_idx++; + #endif + } + else + #endif //#ifdef CONFIG_IOL_IOREG_CFG + { + odm_ConfigMAC_8188E(pDM_Odm, v1, (u1Byte)v2); + } + + READ_NEXT_PAIR(v1, v2, i); + } + + while (v2 != 0xDEAD && i < ArrayLen -2) + { + READ_NEXT_PAIR(v1, v2, i); + } + + } + } + } + +#ifdef CONFIG_IOL_IOREG_CFG + if(biol){ + //printk("==> %s, pktlen = %d,bndy_cnt = %d\n",__FUNCTION__,pxmit_frame->attrib.pktlen+4+32,bndy_cnt); + + if(rtw_IOL_exec_cmds_sync(pDM_Odm->Adapter, pxmit_frame, 1000, bndy_cnt)) + { + #ifdef CONFIG_IOL_IOREG_CFG_DBG + printk("~~~ IOL Config MAC Success !!! \n"); + //compare writed data + { + u4Byte idx; + u1Byte cdata; + // HAL_STATUS_FAILURE; + printk(" MAC data compare => array_len:%d \n",cmpdata_idx); + for(idx=0;idx< cmpdata_idx;idx++) + { + cdata = ODM_Read1Byte(pDM_Odm, cmpdata[idx].addr); + if(cdata != cmpdata[idx].value){ + printk("### MAC data compared failed !! addr:0x%04x, data:(0x%02x : 0x%02x) ###\n", + cmpdata[idx].addr,cmpdata[idx].value,cdata); + //rst = HAL_STATUS_FAILURE; + } + } + + + //dump data from TX packet buffer + //if(rst == HAL_STATUS_FAILURE) + { + rtw_IOL_cmd_tx_pkt_buf_dump(pDM_Odm->Adapter,pxmit_frame->attrib.pktlen+32); + } + + } + #endif //CONFIG_IOL_IOREG_CFG_DBG + + } + else{ + printk("~~~ MAC IOL_exec_cmds Failed !!! \n"); + #ifdef CONFIG_IOL_IOREG_CFG_DBG + { + //dump data from TX packet buffer + rtw_IOL_cmd_tx_pkt_buf_dump(pDM_Odm->Adapter,pxmit_frame->attrib.pktlen+32); + } + #endif //CONFIG_IOL_IOREG_CFG_DBG + rst = HAL_STATUS_FAILURE; + } + + } +#endif //#ifdef CONFIG_IOL_IOREG_CFG + return rst; +} + +/****************************************************************************** +* MAC_REG_ICUT.TXT +******************************************************************************/ + +u4Byte Array_MP_8188E_MAC_REG_ICUT[] = { + 0x026, 0x00000041, + 0x027, 0x00000035, + 0x428, 0x0000000A, + 0x429, 0x00000010, + 0x430, 0x00000000, + 0x431, 0x00000001, + 0x432, 0x00000002, + 0x433, 0x00000004, + 0x434, 0x00000005, + 0x435, 0x00000006, + 0x436, 0x00000007, + 0x437, 0x00000008, + 0x438, 0x00000000, + 0x439, 0x00000000, + 0x43A, 0x00000001, + 0x43B, 0x00000002, + 0x43C, 0x00000004, + 0x43D, 0x00000005, + 0x43E, 0x00000006, + 0x43F, 0x00000007, + 0x440, 0x0000005D, + 0x441, 0x00000001, + 0x442, 0x00000000, + 0x444, 0x00000015, + 0x445, 0x000000F0, + 0x446, 0x0000000F, + 0x447, 0x00000000, + 0x458, 0x00000041, + 0x459, 0x000000A8, + 0x45A, 0x00000072, + 0x45B, 0x000000B9, + 0x460, 0x00000066, + 0x461, 0x00000066, + 0x480, 0x00000008, + 0x4C8, 0x000000FF, + 0x4C9, 0x00000008, + 0x4CC, 0x000000FF, + 0x4CD, 0x000000FF, + 0x4CE, 0x00000001, + 0x4D3, 0x00000001, + 0x500, 0x00000026, + 0x501, 0x000000A2, + 0x502, 0x0000002F, + 0x503, 0x00000000, + 0x504, 0x00000028, + 0x505, 0x000000A3, + 0x506, 0x0000005E, + 0x507, 0x00000000, + 0x508, 0x0000002B, + 0x509, 0x000000A4, + 0x50A, 0x0000005E, + 0x50B, 0x00000000, + 0x50C, 0x0000004F, + 0x50D, 0x000000A4, + 0x50E, 0x00000000, + 0x50F, 0x00000000, + 0x512, 0x0000001C, + 0x514, 0x0000000A, + 0x516, 0x0000000A, + 0x525, 0x0000004F, + 0x550, 0x00000010, + 0x551, 0x00000010, + 0x559, 0x00000002, + 0x55D, 0x000000FF, + 0x605, 0x00000030, + 0x608, 0x0000000E, + 0x609, 0x0000002A, + 0x620, 0x000000FF, + 0x621, 0x000000FF, + 0x622, 0x000000FF, + 0x623, 0x000000FF, + 0x624, 0x000000FF, + 0x625, 0x000000FF, + 0x626, 0x000000FF, + 0x627, 0x000000FF, + 0x652, 0x00000020, + 0x63C, 0x0000000A, + 0x63D, 0x0000000A, + 0x63E, 0x0000000E, + 0x63F, 0x0000000E, + 0x640, 0x00000040, + 0x66E, 0x00000005, + 0x700, 0x00000021, + 0x701, 0x00000043, + 0x702, 0x00000065, + 0x703, 0x00000087, + 0x708, 0x00000021, + 0x709, 0x00000043, + 0x70A, 0x00000065, + 0x70B, 0x00000087, + +}; + +void +ODM_ReadAndConfig_MAC_REG_ICUT_8188E( + IN PDM_ODM_T pDM_Odm + ) +{ + #define READ_NEXT_PAIR(v1, v2, i) do { i += 2; v1 = Array[i]; v2 = Array[i+1]; } while(0) + + u4Byte hex = 0; + u4Byte i = 0; + u2Byte count = 0; + pu4Byte ptr_array = NULL; + u1Byte platform = pDM_Odm->SupportPlatform; + u1Byte _interface = pDM_Odm->SupportInterface; + u1Byte board = pDM_Odm->BoardType; + u4Byte ArrayLen = sizeof(Array_MP_8188E_MAC_REG_ICUT)/sizeof(u4Byte); + pu4Byte Array = Array_MP_8188E_MAC_REG_ICUT; + + + hex += board; + hex += _interface << 8; + hex += platform << 16; + hex += 0xFF000000; + ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_TRACE, ("===> ODM_ReadAndConfig_MP_8188E_MAC_REG_ICUT, hex = 0x%X\n", hex)); + + for (i = 0; i < ArrayLen; i += 2 ) + { + u4Byte v1 = Array[i]; + u4Byte v2 = Array[i+1]; + + // This (offset, data) pair meets the condition. + if ( v1 < 0xCDCDCDCD ) + { + odm_ConfigMAC_8188E(pDM_Odm, v1, (u1Byte)v2); + continue; + } + else + { // This line is the start line of branch. + if ( !CheckCondition(Array[i], hex) ) + { // Discard the following (offset, data) pairs. + READ_NEXT_PAIR(v1, v2, i); + while (v2 != 0xDEAD && + v2 != 0xCDEF && + v2 != 0xCDCD && i < ArrayLen -2) + { + READ_NEXT_PAIR(v1, v2, i); + } + i -= 2; // prevent from for-loop += 2 + } + else // Configure matched pairs and skip to end of if-else. + { + READ_NEXT_PAIR(v1, v2, i); + while (v2 != 0xDEAD && + v2 != 0xCDEF && + v2 != 0xCDCD && i < ArrayLen -2) + { + odm_ConfigMAC_8188E(pDM_Odm, v1, (u1Byte)v2); + READ_NEXT_PAIR(v1, v2, i); + } + + while (v2 != 0xDEAD && i < ArrayLen -2) + { + READ_NEXT_PAIR(v1, v2, i); + } + + } + } + } + +} + +#endif // end of HWIMG_SUPPORT diff --git a/hal/HalHWImg8188E_RF.c b/hal/HalHWImg8188E_RF.c index 8b91daa..5bff850 100755 --- a/hal/HalHWImg8188E_RF.c +++ b/hal/HalHWImg8188E_RF.c @@ -1,569 +1,568 @@ -/****************************************************************************** -* -* 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 -* -* -******************************************************************************/ - -#include "odm_precomp.h" - -#ifdef CONFIG_IOL_IOREG_CFG -#include -#endif - -#if (RTL8188E_SUPPORT == 1) -static BOOLEAN -CheckCondition( - const u4Byte Condition, - const u4Byte Hex - ) -{ - u4Byte _board = (Hex & 0x000000FF); - u4Byte _interface = (Hex & 0x0000FF00) >> 8; - u4Byte _platform = (Hex & 0x00FF0000) >> 16; - u4Byte cond = Condition; - - if ( Condition == 0xCDCDCDCD ) - return TRUE; - - cond = Condition & 0x000000FF; - if ( (_board != cond) && (cond != 0xFF) ) - return FALSE; - - cond = Condition & 0x0000FF00; - cond = cond >> 8; - if ( ((_interface & cond) == 0) && (cond != 0x07) ) - return FALSE; - - cond = Condition & 0x00FF0000; - cond = cond >> 16; - if ( ((_platform & cond) == 0) && (cond != 0x0F) ) - return FALSE; - return TRUE; -} - - -/****************************************************************************** -* RadioA_1T.TXT -******************************************************************************/ - -u4Byte Array_RadioA_1T_8188E[] = { - 0x000, 0x00030000, - 0x008, 0x00084000, - 0x018, 0x00000407, - 0x019, 0x00000012, - 0x01E, 0x00080009, - 0x01F, 0x00000880, - 0x02F, 0x0001A060, - 0x03F, 0x00000000, - 0x042, 0x000060C0, - 0x057, 0x000D0000, - 0x058, 0x000BE180, - 0x067, 0x00001552, - 0x083, 0x00000000, - 0x0B0, 0x000FF8FC, - 0x0B1, 0x00054400, - 0x0B2, 0x000CCC19, - 0x0B4, 0x00043003, - 0x0B6, 0x0004953E, - 0x0B7, 0x0001C718, - 0x0B8, 0x000060FF, - 0x0B9, 0x00080001, - 0x0BA, 0x00040000, - 0x0BB, 0x00000400, - 0x0BF, 0x000C0000, - 0x0C2, 0x00002400, - 0x0C3, 0x00000009, - 0x0C4, 0x00040C91, - 0x0C5, 0x00099999, - 0x0C6, 0x000000A3, - 0x0C7, 0x00088820, - 0x0C8, 0x00076C06, - 0x0C9, 0x00000000, - 0x0CA, 0x00080000, - 0x0DF, 0x00000180, - 0x0EF, 0x000001A0, - 0x051, 0x0006B27D, - 0xFF0F0400, 0xABCD, - 0x052, 0x0007E4DD, - 0xCDCDCDCD, 0xCDCD, - 0x052, 0x0007E49D, - 0xFF0F0400, 0xDEAD, - 0x053, 0x00000073, - 0x056, 0x00051FF3, - 0x035, 0x00000086, - 0x035, 0x00000186, - 0x035, 0x00000286, - 0x036, 0x00001C25, - 0x036, 0x00009C25, - 0x036, 0x00011C25, - 0x036, 0x00019C25, - 0x0B6, 0x00048538, - 0x018, 0x00000C07, - 0x05A, 0x0004BD00, - 0x019, 0x000739D0, - 0xFF0F0718, 0xABCD, - 0x034, 0x0000A093, - 0x034, 0x0000908F, - 0x034, 0x0000808C, - 0x034, 0x0000704F, - 0x034, 0x0000604C, - 0x034, 0x00005049, - 0x034, 0x0000400C, - 0x034, 0x00003009, - 0x034, 0x00002006, - 0x034, 0x00001003, - 0x034, 0x00000000, - 0xCDCDCDCD, 0xCDCD, - 0x034, 0x0000ADF3, - 0x034, 0x00009DF0, - 0x034, 0x00008DED, - 0x034, 0x00007DEA, - 0x034, 0x00006DE7, - 0x034, 0x000054EE, - 0x034, 0x000044EB, - 0x034, 0x000034E8, - 0x034, 0x0000246B, - 0x034, 0x00001468, - 0x034, 0x0000006D, - 0xFF0F0718, 0xDEAD, - 0x000, 0x00030159, - 0x084, 0x00068200, - 0x086, 0x000000CE, - 0x087, 0x00048A00, - 0x08E, 0x00065540, - 0x08F, 0x00088000, - 0x0EF, 0x000020A0, - 0x03B, 0x000F02B0, - 0x03B, 0x000EF7B0, - 0x03B, 0x000D4FB0, - 0x03B, 0x000CF060, - 0x03B, 0x000B0090, - 0x03B, 0x000A0080, - 0x03B, 0x00090080, - 0x03B, 0x0008F780, - 0x03B, 0x000722B0, - 0x03B, 0x0006F7B0, - 0x03B, 0x00054FB0, - 0x03B, 0x0004F060, - 0x03B, 0x00030090, - 0x03B, 0x00020080, - 0x03B, 0x00010080, - 0x03B, 0x0000F780, - 0x0EF, 0x000000A0, - 0x000, 0x00010159, - 0x018, 0x0000F407, - 0xFFE, 0x00000000, - 0xFFE, 0x00000000, - 0x01F, 0x00080003, - 0xFFE, 0x00000000, - 0xFFE, 0x00000000, - 0x01E, 0x00000001, - 0x01F, 0x00080000, - 0x000, 0x00033E60, - -}; - -HAL_STATUS -ODM_ReadAndConfig_RadioA_1T_8188E( - IN PDM_ODM_T pDM_Odm - ) -{ - #define READ_NEXT_PAIR(v1, v2, i) do { i += 2; v1 = Array[i]; v2 = Array[i+1]; } while(0) - - u4Byte hex = 0; - u4Byte i = 0; - u2Byte count = 0; - pu4Byte ptr_array = NULL; - u1Byte platform = pDM_Odm->SupportPlatform; - u1Byte interfaceValue = pDM_Odm->SupportInterface; - u1Byte board = pDM_Odm->BoardType; - u4Byte ArrayLen = sizeof(Array_RadioA_1T_8188E)/sizeof(u4Byte); - pu4Byte Array = Array_RadioA_1T_8188E; - BOOLEAN biol = FALSE; -#ifdef CONFIG_IOL_IOREG_CFG - PADAPTER Adapter = pDM_Odm->Adapter; - struct xmit_frame *pxmit_frame; - u8 bndy_cnt = 1; - #ifdef CONFIG_IOL_IOREG_CFG_DBG - struct cmd_cmp cmpdata[ArrayLen]; - u4Byte cmpdata_idx=0; - #endif -#endif//#ifdef CONFIG_IOL_IOREG_CFG - HAL_STATUS rst =HAL_STATUS_SUCCESS; - - hex += board; - hex += interfaceValue << 8; - hex += platform << 16; - hex += 0xFF000000; -#ifdef CONFIG_IOL_IOREG_CFG - biol = rtw_IOL_applied(Adapter); - - if(biol){ - if((pxmit_frame=rtw_IOL_accquire_xmit_frame(Adapter)) == NULL) - { - printk("rtw_IOL_accquire_xmit_frame failed\n"); - return HAL_STATUS_FAILURE; - } - } -#endif//#ifdef CONFIG_IOL_IOREG_CFG - - for (i = 0; i < ArrayLen; i += 2 ) - { - u4Byte v1 = Array[i]; - u4Byte v2 = Array[i+1]; - - // This (offset, data) pair meets the condition. - if ( v1 < 0xCDCDCDCD ) - { - #ifdef CONFIG_IOL_IOREG_CFG - if(biol){ - if(rtw_IOL_cmd_boundary_handle(pxmit_frame)) - bndy_cnt++; - - if(v1 == 0xffe) - { - rtw_IOL_append_DELAY_MS_cmd(pxmit_frame,50); - } - else if (v1 == 0xfd){ - rtw_IOL_append_DELAY_MS_cmd(pxmit_frame,5); - } - else if (v1 == 0xfc){ - rtw_IOL_append_DELAY_MS_cmd(pxmit_frame,1); - } - else if (v1 == 0xfb){ - rtw_IOL_append_DELAY_US_cmd(pxmit_frame,50); - } - else if (v1 == 0xfa){ - rtw_IOL_append_DELAY_US_cmd(pxmit_frame,5); - } - else if (v1 == 0xf9){ - rtw_IOL_append_DELAY_US_cmd(pxmit_frame,1); - } - else{ - rtw_IOL_append_WRF_cmd(pxmit_frame, ODM_RF_PATH_A,(u2Byte)v1, v2,bRFRegOffsetMask) ; - #ifdef CONFIG_IOL_IOREG_CFG_DBG - cmpdata[cmpdata_idx].addr = v1; - cmpdata[cmpdata_idx].value= v2; - cmpdata_idx++; - #endif - } - - } - else - #endif //#ifdef CONFIG_IOL_IOREG_CFG - { - odm_ConfigRF_RadioA_8188E(pDM_Odm, v1, v2); - } - continue; - } - else - { // This line is the start line of branch. - if ( !CheckCondition(Array[i], hex) ) - { // Discard the following (offset, data) pairs. - READ_NEXT_PAIR(v1, v2, i); - while (v2 != 0xDEAD && - v2 != 0xCDEF && - v2 != 0xCDCD && i < ArrayLen -2) - { - READ_NEXT_PAIR(v1, v2, i); - } - i -= 2; // prevent from for-loop += 2 - } - else // Configure matched pairs and skip to end of if-else. - { - READ_NEXT_PAIR(v1, v2, i); - while (v2 != 0xDEAD && - v2 != 0xCDEF && - v2 != 0xCDCD && i < ArrayLen -2) - { - #ifdef CONFIG_IOL_IOREG_CFG - if(biol){ - if(rtw_IOL_cmd_boundary_handle(pxmit_frame)) - bndy_cnt++; - - if(v1 == 0xffe) - { - rtw_IOL_append_DELAY_MS_cmd(pxmit_frame,50); - } - else if (v1 == 0xfd){ - rtw_IOL_append_DELAY_MS_cmd(pxmit_frame,5); - } - else if (v1 == 0xfc){ - rtw_IOL_append_DELAY_MS_cmd(pxmit_frame,1); - } - else if (v1 == 0xfb){ - rtw_IOL_append_DELAY_US_cmd(pxmit_frame,50); - } - else if (v1 == 0xfa){ - rtw_IOL_append_DELAY_US_cmd(pxmit_frame,5); - } - else if (v1 == 0xf9){ - rtw_IOL_append_DELAY_US_cmd(pxmit_frame,1); - } - else{ - rtw_IOL_append_WRF_cmd(pxmit_frame, ODM_RF_PATH_A,(u2Byte)v1, v2,bRFRegOffsetMask) ; - #ifdef CONFIG_IOL_IOREG_CFG_DBG - cmpdata[cmpdata_idx].addr = v1; - cmpdata[cmpdata_idx].value= v2; - cmpdata_idx++; - #endif - - } - - } - else - #endif //#ifdef CONFIG_IOL_IOREG_CFG - { - odm_ConfigRF_RadioA_8188E(pDM_Odm, v1, v2); - } - READ_NEXT_PAIR(v1, v2, i); - } - - while (v2 != 0xDEAD && i < ArrayLen -2) - { - READ_NEXT_PAIR(v1, v2, i); - } - - } - } - } -#ifdef CONFIG_IOL_IOREG_CFG - if(biol){ - //printk("==> %s, pktlen = %d,bndy_cnt = %d\n",__FUNCTION__,pxmit_frame->attrib.pktlen+4+32,bndy_cnt); - if(rtw_IOL_exec_cmds_sync(pDM_Odm->Adapter, pxmit_frame, 1000, bndy_cnt)) - { - #ifdef CONFIG_IOL_IOREG_CFG_DBG - printk("~~~ %s Success !!! \n",__FUNCTION__); - { - u4Byte idx; - u4Byte cdata; - printk(" %s data compare => array_len:%d \n",__FUNCTION__,cmpdata_idx); - printk("### %s data compared !!###\n",__FUNCTION__); - for(idx=0;idx< cmpdata_idx;idx++) - { - cdata = ODM_GetRFReg(pDM_Odm, ODM_RF_PATH_A,cmpdata[idx].addr,bRFRegOffsetMask); - if(cdata != cmpdata[idx].value){ - printk("addr:0x%04x, data:(0x%02x : 0x%02x) \n", - cmpdata[idx].addr,cmpdata[idx].value,cdata); - rst = HAL_STATUS_FAILURE; - } - } - printk("### %s data compared !!###\n",__FUNCTION__); - //if(rst == HAL_STATUS_FAILURE) - {//dump data from TX packet buffer - rtw_IOL_cmd_tx_pkt_buf_dump(pDM_Odm->Adapter,pxmit_frame->attrib.pktlen+32); - } - } - #endif //CONFIG_IOL_IOREG_CFG_DBG - - } - else{ - rst = HAL_STATUS_FAILURE; - printk("~~~ IOL Config %s Failed !!! \n",__FUNCTION__); - #ifdef CONFIG_IOL_IOREG_CFG_DBG - { - //dump data from TX packet buffer - rtw_IOL_cmd_tx_pkt_buf_dump(pDM_Odm->Adapter,pxmit_frame->attrib.pktlen+32); - } - #endif //CONFIG_IOL_IOREG_CFG_DBG - } - } - - -#endif //#ifdef CONFIG_IOL_IOREG_CFG - return rst; -} -/****************************************************************************** -* RadioA_1T_ICUT.TXT -******************************************************************************/ - -u4Byte Array_MP_8188E_RadioA_1T_ICUT[] = { - 0x000, 0x00030000, - 0x008, 0x00084000, - 0x018, 0x00000407, - 0x019, 0x00000012, - 0x01E, 0x00080009, - 0x01F, 0x00000880, - 0x02F, 0x0001A060, - 0x03F, 0x00000000, - 0x042, 0x000060C0, - 0x057, 0x000D0000, - 0x058, 0x000BE180, - 0x067, 0x00001552, - 0x083, 0x00000000, - 0x0B0, 0x000FF8FC, - 0x0B1, 0x00054400, - 0x0B2, 0x000CCC19, - 0x0B4, 0x00043003, - 0x0B6, 0x0004953E, - 0x0B7, 0x0001C718, - 0x0B8, 0x000060FF, - 0x0B9, 0x00080001, - 0x0BA, 0x00040000, - 0x0BB, 0x00000400, - 0x0BF, 0x000C0000, - 0x0C2, 0x00002400, - 0x0C3, 0x00000009, - 0x0C4, 0x00040C91, - 0x0C5, 0x00099999, - 0x0C6, 0x000000A3, - 0x0C7, 0x00088820, - 0x0C8, 0x00076C06, - 0x0C9, 0x00000000, - 0x0CA, 0x00080000, - 0x0DF, 0x00000180, - 0x0EF, 0x000001A0, - 0x051, 0x0006B27D, - 0xFF0F0400, 0xABCD, - 0x052, 0x0007E4DD, - 0xCDCDCDCD, 0xCDCD, - 0x052, 0x0007E49D, - 0xFF0F0400, 0xDEAD, - 0x053, 0x00000073, - 0x056, 0x00051FF3, - 0x035, 0x00000086, - 0x035, 0x00000186, - 0x035, 0x00000286, - 0x036, 0x00001C25, - 0x036, 0x00009C25, - 0x036, 0x00011C25, - 0x036, 0x00019C25, - 0x0B6, 0x00048538, - 0x018, 0x00000C07, - 0x05A, 0x0004BD00, - 0x019, 0x000739D0, - 0x034, 0x0000ADF3, - 0x034, 0x00009DF0, - 0x034, 0x00008DED, - 0x034, 0x00007DEA, - 0x034, 0x00006DE7, - 0x034, 0x000054EE, - 0x034, 0x000044EB, - 0x034, 0x000034E8, - 0x034, 0x0000246B, - 0x034, 0x00001468, - 0x034, 0x0000006D, - 0x000, 0x00030159, - 0x084, 0x00068200, - 0x086, 0x000000CE, - 0x087, 0x00048A00, - 0x08E, 0x00065540, - 0x08F, 0x00088000, - 0x0EF, 0x000020A0, - 0x03B, 0x000F02B0, - 0x03B, 0x000EF7B0, - 0x03B, 0x000D4FB0, - 0x03B, 0x000CF060, - 0x03B, 0x000B0090, - 0x03B, 0x000A0080, - 0x03B, 0x00090080, - 0x03B, 0x0008F780, - 0x03B, 0x000722B0, - 0x03B, 0x0006F7B0, - 0x03B, 0x00054FB0, - 0x03B, 0x0004F060, - 0x03B, 0x00030090, - 0x03B, 0x00020080, - 0x03B, 0x00010080, - 0x03B, 0x0000F780, - 0x0EF, 0x000000A0, - 0x000, 0x00010159, - 0x018, 0x0000F407, - 0xFFE, 0x00000000, - 0xFFE, 0x00000000, - 0x01F, 0x00080003, - 0xFFE, 0x00000000, - 0xFFE, 0x00000000, - 0x01E, 0x00000001, - 0x01F, 0x00080000, - 0x000, 0x00033E60, - -}; - -void -ODM_ReadAndConfig_RadioA_1T_ICUT_8188E( - IN PDM_ODM_T pDM_Odm - ) -{ - #define READ_NEXT_PAIR(v1, v2, i) do { i += 2; v1 = Array[i]; v2 = Array[i+1]; } while(0) - - u4Byte hex = 0; - u4Byte i = 0; - u2Byte count = 0; - pu4Byte ptr_array = NULL; - u1Byte platform = pDM_Odm->SupportPlatform; - u1Byte _interface = pDM_Odm->SupportInterface; - u1Byte board = pDM_Odm->BoardType; - u4Byte ArrayLen = sizeof(Array_MP_8188E_RadioA_1T_ICUT)/sizeof(u4Byte); - pu4Byte Array = Array_MP_8188E_RadioA_1T_ICUT; - - - hex += board; - hex += _interface << 8; - hex += platform << 16; - hex += 0xFF000000; - ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_TRACE, ("===> ODM_ReadAndConfig_MP_8188E_RadioA_1T_ICUT, hex = 0x%X\n", hex)); - - for (i = 0; i < ArrayLen; i += 2 ) - { - u4Byte v1 = Array[i]; - u4Byte v2 = Array[i+1]; - - // This (offset, data) pair meets the condition. - if ( v1 < 0xCDCDCDCD ) - { - odm_ConfigRF_RadioA_8188E(pDM_Odm, v1, v2); - continue; - } - else - { // This line is the start line of branch. - if ( !CheckCondition(Array[i], hex) ) - { // Discard the following (offset, data) pairs. - READ_NEXT_PAIR(v1, v2, i); - while (v2 != 0xDEAD && - v2 != 0xCDEF && - v2 != 0xCDCD && i < ArrayLen -2) - { - READ_NEXT_PAIR(v1, v2, i); - } - i -= 2; // prevent from for-loop += 2 - } - else // Configure matched pairs and skip to end of if-else. - { - READ_NEXT_PAIR(v1, v2, i); - while (v2 != 0xDEAD && - v2 != 0xCDEF && - v2 != 0xCDCD && i < ArrayLen -2) - { - odm_ConfigRF_RadioA_8188E(pDM_Odm, v1, v2); - READ_NEXT_PAIR(v1, v2, i); - } - - while (v2 != 0xDEAD && i < ArrayLen -2) - { - READ_NEXT_PAIR(v1, v2, i); - } - - } - } - } - -} - - -#endif // end of HWIMG_SUPPORT - +/****************************************************************************** +* +* 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 +* +* +******************************************************************************/ + +#include "odm_precomp.h" + +#ifdef CONFIG_IOL_IOREG_CFG +#include +#endif + +#if (RTL8188E_SUPPORT == 1) +static BOOLEAN +CheckCondition( + const u4Byte Condition, + const u4Byte Hex + ) +{ + u4Byte _board = (Hex & 0x000000FF); + u4Byte _interface = (Hex & 0x0000FF00) >> 8; + u4Byte _platform = (Hex & 0x00FF0000) >> 16; + u4Byte cond = Condition; + + if ( Condition == 0xCDCDCDCD ) + return TRUE; + + cond = Condition & 0x000000FF; + if ( (_board != cond) && (cond != 0xFF) ) + return FALSE; + + cond = Condition & 0x0000FF00; + cond = cond >> 8; + if ( ((_interface & cond) == 0) && (cond != 0x07) ) + return FALSE; + + cond = Condition & 0x00FF0000; + cond = cond >> 16; + if ( ((_platform & cond) == 0) && (cond != 0x0F) ) + return FALSE; + return TRUE; +} + + +/****************************************************************************** +* RadioA_1T.TXT +******************************************************************************/ + +u4Byte Array_RadioA_1T_8188E[] = { + 0x000, 0x00030000, + 0x008, 0x00084000, + 0x018, 0x00000407, + 0x019, 0x00000012, + 0x01E, 0x00080009, + 0x01F, 0x00000880, + 0x02F, 0x0001A060, + 0x03F, 0x00000000, + 0x042, 0x000060C0, + 0x057, 0x000D0000, + 0x058, 0x000BE180, + 0x067, 0x00001552, + 0x083, 0x00000000, + 0x0B0, 0x000FF8FC, + 0x0B1, 0x00054400, + 0x0B2, 0x000CCC19, + 0x0B4, 0x00043003, + 0x0B6, 0x0004953E, + 0x0B7, 0x0001C718, + 0x0B8, 0x000060FF, + 0x0B9, 0x00080001, + 0x0BA, 0x00040000, + 0x0BB, 0x00000400, + 0x0BF, 0x000C0000, + 0x0C2, 0x00002400, + 0x0C3, 0x00000009, + 0x0C4, 0x00040C91, + 0x0C5, 0x00099999, + 0x0C6, 0x000000A3, + 0x0C7, 0x00088820, + 0x0C8, 0x00076C06, + 0x0C9, 0x00000000, + 0x0CA, 0x00080000, + 0x0DF, 0x00000180, + 0x0EF, 0x000001A0, + 0x051, 0x0006B27D, + 0xFF0F0400, 0xABCD, + 0x052, 0x0007E4DD, + 0xCDCDCDCD, 0xCDCD, + 0x052, 0x0007E49D, + 0xFF0F0400, 0xDEAD, + 0x053, 0x00000073, + 0x056, 0x00051FF3, + 0x035, 0x00000086, + 0x035, 0x00000186, + 0x035, 0x00000286, + 0x036, 0x00001C25, + 0x036, 0x00009C25, + 0x036, 0x00011C25, + 0x036, 0x00019C25, + 0x0B6, 0x00048538, + 0x018, 0x00000C07, + 0x05A, 0x0004BD00, + 0x019, 0x000739D0, + 0xFF0F0718, 0xABCD, + 0x034, 0x0000A093, + 0x034, 0x0000908F, + 0x034, 0x0000808C, + 0x034, 0x0000704F, + 0x034, 0x0000604C, + 0x034, 0x00005049, + 0x034, 0x0000400C, + 0x034, 0x00003009, + 0x034, 0x00002006, + 0x034, 0x00001003, + 0x034, 0x00000000, + 0xCDCDCDCD, 0xCDCD, + 0x034, 0x0000ADF3, + 0x034, 0x00009DF0, + 0x034, 0x00008DED, + 0x034, 0x00007DEA, + 0x034, 0x00006DE7, + 0x034, 0x000054EE, + 0x034, 0x000044EB, + 0x034, 0x000034E8, + 0x034, 0x0000246B, + 0x034, 0x00001468, + 0x034, 0x0000006D, + 0xFF0F0718, 0xDEAD, + 0x000, 0x00030159, + 0x084, 0x00068200, + 0x086, 0x000000CE, + 0x087, 0x00048A00, + 0x08E, 0x00065540, + 0x08F, 0x00088000, + 0x0EF, 0x000020A0, + 0x03B, 0x000F02B0, + 0x03B, 0x000EF7B0, + 0x03B, 0x000D4FB0, + 0x03B, 0x000CF060, + 0x03B, 0x000B0090, + 0x03B, 0x000A0080, + 0x03B, 0x00090080, + 0x03B, 0x0008F780, + 0x03B, 0x000722B0, + 0x03B, 0x0006F7B0, + 0x03B, 0x00054FB0, + 0x03B, 0x0004F060, + 0x03B, 0x00030090, + 0x03B, 0x00020080, + 0x03B, 0x00010080, + 0x03B, 0x0000F780, + 0x0EF, 0x000000A0, + 0x000, 0x00010159, + 0x018, 0x0000F407, + 0xFFE, 0x00000000, + 0xFFE, 0x00000000, + 0x01F, 0x00080003, + 0xFFE, 0x00000000, + 0xFFE, 0x00000000, + 0x01E, 0x00000001, + 0x01F, 0x00080000, + 0x000, 0x00033E60, + +}; + +HAL_STATUS +ODM_ReadAndConfig_RadioA_1T_8188E( + IN PDM_ODM_T pDM_Odm + ) +{ + #define READ_NEXT_PAIR(v1, v2, i) do { i += 2; v1 = Array[i]; v2 = Array[i+1]; } while(0) + + u4Byte hex = 0; + u4Byte i = 0; + u2Byte count = 0; + pu4Byte ptr_array = NULL; + u1Byte platform = pDM_Odm->SupportPlatform; + u1Byte interfaceValue = pDM_Odm->SupportInterface; + u1Byte board = pDM_Odm->BoardType; + u4Byte ArrayLen = sizeof(Array_RadioA_1T_8188E)/sizeof(u4Byte); + pu4Byte Array = Array_RadioA_1T_8188E; + BOOLEAN biol = FALSE; +#ifdef CONFIG_IOL_IOREG_CFG + PADAPTER Adapter = pDM_Odm->Adapter; + struct xmit_frame *pxmit_frame; + u8 bndy_cnt = 1; + #ifdef CONFIG_IOL_IOREG_CFG_DBG + struct cmd_cmp cmpdata[ArrayLen]; + u4Byte cmpdata_idx=0; + #endif +#endif//#ifdef CONFIG_IOL_IOREG_CFG + HAL_STATUS rst =HAL_STATUS_SUCCESS; + + hex += board; + hex += interfaceValue << 8; + hex += platform << 16; + hex += 0xFF000000; +#ifdef CONFIG_IOL_IOREG_CFG + biol = rtw_IOL_applied(Adapter); + + if(biol){ + if((pxmit_frame=rtw_IOL_accquire_xmit_frame(Adapter)) == NULL) + { + printk("rtw_IOL_accquire_xmit_frame failed\n"); + return HAL_STATUS_FAILURE; + } + } +#endif//#ifdef CONFIG_IOL_IOREG_CFG + + for (i = 0; i < ArrayLen; i += 2 ) + { + u4Byte v1 = Array[i]; + u4Byte v2 = Array[i+1]; + + // This (offset, data) pair meets the condition. + if ( v1 < 0xCDCDCDCD ) + { + #ifdef CONFIG_IOL_IOREG_CFG + if(biol){ + if(rtw_IOL_cmd_boundary_handle(pxmit_frame)) + bndy_cnt++; + + if(v1 == 0xffe) + { + rtw_IOL_append_DELAY_MS_cmd(pxmit_frame,50); + } + else if (v1 == 0xfd){ + rtw_IOL_append_DELAY_MS_cmd(pxmit_frame,5); + } + else if (v1 == 0xfc){ + rtw_IOL_append_DELAY_MS_cmd(pxmit_frame,1); + } + else if (v1 == 0xfb){ + rtw_IOL_append_DELAY_US_cmd(pxmit_frame,50); + } + else if (v1 == 0xfa){ + rtw_IOL_append_DELAY_US_cmd(pxmit_frame,5); + } + else if (v1 == 0xf9){ + rtw_IOL_append_DELAY_US_cmd(pxmit_frame,1); + } + else{ + rtw_IOL_append_WRF_cmd(pxmit_frame, ODM_RF_PATH_A,(u2Byte)v1, v2,bRFRegOffsetMask) ; + #ifdef CONFIG_IOL_IOREG_CFG_DBG + cmpdata[cmpdata_idx].addr = v1; + cmpdata[cmpdata_idx].value= v2; + cmpdata_idx++; + #endif + } + + } + else + #endif //#ifdef CONFIG_IOL_IOREG_CFG + { + odm_ConfigRF_RadioA_8188E(pDM_Odm, v1, v2); + } + continue; + } + else + { // This line is the start line of branch. + if ( !CheckCondition(Array[i], hex) ) + { // Discard the following (offset, data) pairs. + READ_NEXT_PAIR(v1, v2, i); + while (v2 != 0xDEAD && + v2 != 0xCDEF && + v2 != 0xCDCD && i < ArrayLen -2) + { + READ_NEXT_PAIR(v1, v2, i); + } + i -= 2; // prevent from for-loop += 2 + } + else // Configure matched pairs and skip to end of if-else. + { + READ_NEXT_PAIR(v1, v2, i); + while (v2 != 0xDEAD && + v2 != 0xCDEF && + v2 != 0xCDCD && i < ArrayLen -2) + { + #ifdef CONFIG_IOL_IOREG_CFG + if(biol){ + if(rtw_IOL_cmd_boundary_handle(pxmit_frame)) + bndy_cnt++; + + if(v1 == 0xffe) + { + rtw_IOL_append_DELAY_MS_cmd(pxmit_frame,50); + } + else if (v1 == 0xfd){ + rtw_IOL_append_DELAY_MS_cmd(pxmit_frame,5); + } + else if (v1 == 0xfc){ + rtw_IOL_append_DELAY_MS_cmd(pxmit_frame,1); + } + else if (v1 == 0xfb){ + rtw_IOL_append_DELAY_US_cmd(pxmit_frame,50); + } + else if (v1 == 0xfa){ + rtw_IOL_append_DELAY_US_cmd(pxmit_frame,5); + } + else if (v1 == 0xf9){ + rtw_IOL_append_DELAY_US_cmd(pxmit_frame,1); + } + else{ + rtw_IOL_append_WRF_cmd(pxmit_frame, ODM_RF_PATH_A,(u2Byte)v1, v2,bRFRegOffsetMask) ; + #ifdef CONFIG_IOL_IOREG_CFG_DBG + cmpdata[cmpdata_idx].addr = v1; + cmpdata[cmpdata_idx].value= v2; + cmpdata_idx++; + #endif + + } + + } + else + #endif //#ifdef CONFIG_IOL_IOREG_CFG + { + odm_ConfigRF_RadioA_8188E(pDM_Odm, v1, v2); + } + READ_NEXT_PAIR(v1, v2, i); + } + + while (v2 != 0xDEAD && i < ArrayLen -2) + { + READ_NEXT_PAIR(v1, v2, i); + } + + } + } + } +#ifdef CONFIG_IOL_IOREG_CFG + if(biol){ + //printk("==> %s, pktlen = %d,bndy_cnt = %d\n",__FUNCTION__,pxmit_frame->attrib.pktlen+4+32,bndy_cnt); + if(rtw_IOL_exec_cmds_sync(pDM_Odm->Adapter, pxmit_frame, 1000, bndy_cnt)) + { + #ifdef CONFIG_IOL_IOREG_CFG_DBG + printk("~~~ %s Success !!! \n",__FUNCTION__); + { + u4Byte idx; + u4Byte cdata; + printk(" %s data compare => array_len:%d \n",__FUNCTION__,cmpdata_idx); + printk("### %s data compared !!###\n",__FUNCTION__); + for(idx=0;idx< cmpdata_idx;idx++) + { + cdata = ODM_GetRFReg(pDM_Odm, ODM_RF_PATH_A,cmpdata[idx].addr,bRFRegOffsetMask); + if(cdata != cmpdata[idx].value){ + printk("addr:0x%04x, data:(0x%02x : 0x%02x) \n", + cmpdata[idx].addr,cmpdata[idx].value,cdata); + rst = HAL_STATUS_FAILURE; + } + } + printk("### %s data compared !!###\n",__FUNCTION__); + //if(rst == HAL_STATUS_FAILURE) + {//dump data from TX packet buffer + rtw_IOL_cmd_tx_pkt_buf_dump(pDM_Odm->Adapter,pxmit_frame->attrib.pktlen+32); + } + } + #endif //CONFIG_IOL_IOREG_CFG_DBG + + } + else{ + rst = HAL_STATUS_FAILURE; + printk("~~~ IOL Config %s Failed !!! \n",__FUNCTION__); + #ifdef CONFIG_IOL_IOREG_CFG_DBG + { + //dump data from TX packet buffer + rtw_IOL_cmd_tx_pkt_buf_dump(pDM_Odm->Adapter,pxmit_frame->attrib.pktlen+32); + } + #endif //CONFIG_IOL_IOREG_CFG_DBG + } + } + + +#endif //#ifdef CONFIG_IOL_IOREG_CFG + return rst; +} +/****************************************************************************** +* RadioA_1T_ICUT.TXT +******************************************************************************/ + +u4Byte Array_MP_8188E_RadioA_1T_ICUT[] = { + 0x000, 0x00030000, + 0x008, 0x00084000, + 0x018, 0x00000407, + 0x019, 0x00000012, + 0x01E, 0x00080009, + 0x01F, 0x00000880, + 0x02F, 0x0001A060, + 0x03F, 0x00000000, + 0x042, 0x000060C0, + 0x057, 0x000D0000, + 0x058, 0x000BE180, + 0x067, 0x00001552, + 0x083, 0x00000000, + 0x0B0, 0x000FF8FC, + 0x0B1, 0x00054400, + 0x0B2, 0x000CCC19, + 0x0B4, 0x00043003, + 0x0B6, 0x0004953E, + 0x0B7, 0x0001C718, + 0x0B8, 0x000060FF, + 0x0B9, 0x00080001, + 0x0BA, 0x00040000, + 0x0BB, 0x00000400, + 0x0BF, 0x000C0000, + 0x0C2, 0x00002400, + 0x0C3, 0x00000009, + 0x0C4, 0x00040C91, + 0x0C5, 0x00099999, + 0x0C6, 0x000000A3, + 0x0C7, 0x00088820, + 0x0C8, 0x00076C06, + 0x0C9, 0x00000000, + 0x0CA, 0x00080000, + 0x0DF, 0x00000180, + 0x0EF, 0x000001A0, + 0x051, 0x0006B27D, + 0xFF0F0400, 0xABCD, + 0x052, 0x0007E4DD, + 0xCDCDCDCD, 0xCDCD, + 0x052, 0x0007E49D, + 0xFF0F0400, 0xDEAD, + 0x053, 0x00000073, + 0x056, 0x00051FF3, + 0x035, 0x00000086, + 0x035, 0x00000186, + 0x035, 0x00000286, + 0x036, 0x00001C25, + 0x036, 0x00009C25, + 0x036, 0x00011C25, + 0x036, 0x00019C25, + 0x0B6, 0x00048538, + 0x018, 0x00000C07, + 0x05A, 0x0004BD00, + 0x019, 0x000739D0, + 0x034, 0x0000ADF3, + 0x034, 0x00009DF0, + 0x034, 0x00008DED, + 0x034, 0x00007DEA, + 0x034, 0x00006DE7, + 0x034, 0x000054EE, + 0x034, 0x000044EB, + 0x034, 0x000034E8, + 0x034, 0x0000246B, + 0x034, 0x00001468, + 0x034, 0x0000006D, + 0x000, 0x00030159, + 0x084, 0x00068200, + 0x086, 0x000000CE, + 0x087, 0x00048A00, + 0x08E, 0x00065540, + 0x08F, 0x00088000, + 0x0EF, 0x000020A0, + 0x03B, 0x000F02B0, + 0x03B, 0x000EF7B0, + 0x03B, 0x000D4FB0, + 0x03B, 0x000CF060, + 0x03B, 0x000B0090, + 0x03B, 0x000A0080, + 0x03B, 0x00090080, + 0x03B, 0x0008F780, + 0x03B, 0x000722B0, + 0x03B, 0x0006F7B0, + 0x03B, 0x00054FB0, + 0x03B, 0x0004F060, + 0x03B, 0x00030090, + 0x03B, 0x00020080, + 0x03B, 0x00010080, + 0x03B, 0x0000F780, + 0x0EF, 0x000000A0, + 0x000, 0x00010159, + 0x018, 0x0000F407, + 0xFFE, 0x00000000, + 0xFFE, 0x00000000, + 0x01F, 0x00080003, + 0xFFE, 0x00000000, + 0xFFE, 0x00000000, + 0x01E, 0x00000001, + 0x01F, 0x00080000, + 0x000, 0x00033E60, + +}; + +void +ODM_ReadAndConfig_RadioA_1T_ICUT_8188E( + IN PDM_ODM_T pDM_Odm + ) +{ + #define READ_NEXT_PAIR(v1, v2, i) do { i += 2; v1 = Array[i]; v2 = Array[i+1]; } while(0) + + u4Byte hex = 0; + u4Byte i = 0; + u2Byte count = 0; + pu4Byte ptr_array = NULL; + u1Byte platform = pDM_Odm->SupportPlatform; + u1Byte _interface = pDM_Odm->SupportInterface; + u1Byte board = pDM_Odm->BoardType; + u4Byte ArrayLen = sizeof(Array_MP_8188E_RadioA_1T_ICUT)/sizeof(u4Byte); + pu4Byte Array = Array_MP_8188E_RadioA_1T_ICUT; + + + hex += board; + hex += _interface << 8; + hex += platform << 16; + hex += 0xFF000000; + ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_TRACE, ("===> ODM_ReadAndConfig_MP_8188E_RadioA_1T_ICUT, hex = 0x%X\n", hex)); + + for (i = 0; i < ArrayLen; i += 2 ) + { + u4Byte v1 = Array[i]; + u4Byte v2 = Array[i+1]; + + // This (offset, data) pair meets the condition. + if ( v1 < 0xCDCDCDCD ) + { + odm_ConfigRF_RadioA_8188E(pDM_Odm, v1, v2); + continue; + } + else + { // This line is the start line of branch. + if ( !CheckCondition(Array[i], hex) ) + { // Discard the following (offset, data) pairs. + READ_NEXT_PAIR(v1, v2, i); + while (v2 != 0xDEAD && + v2 != 0xCDEF && + v2 != 0xCDCD && i < ArrayLen -2) + { + READ_NEXT_PAIR(v1, v2, i); + } + i -= 2; // prevent from for-loop += 2 + } + else // Configure matched pairs and skip to end of if-else. + { + READ_NEXT_PAIR(v1, v2, i); + while (v2 != 0xDEAD && + v2 != 0xCDEF && + v2 != 0xCDCD && i < ArrayLen -2) + { + odm_ConfigRF_RadioA_8188E(pDM_Odm, v1, v2); + READ_NEXT_PAIR(v1, v2, i); + } + + while (v2 != 0xDEAD && i < ArrayLen -2) + { + READ_NEXT_PAIR(v1, v2, i); + } + + } + } + } + +} + + +#endif // end of HWIMG_SUPPORT diff --git a/hal/HalPhyRf.c b/hal/HalPhyRf.c index b23f1ec..1c37fbb 100755 --- a/hal/HalPhyRf.c +++ b/hal/HalPhyRf.c @@ -17,9 +17,9 @@ * * ******************************************************************************/ - + #include "odm_precomp.h" - + #if(DM_ODM_SUPPORT_TYPE & ODM_MP) #include "Mp_Precomp.h" @@ -62,12 +62,12 @@ phy_PathA_IQK_8192C( else { PHY_SetBBReg(pAdapter, rTx_IQK_Tone_A, bMaskDWord, 0x10008c22); - PHY_SetBBReg(pAdapter, rRx_IQK_Tone_A, bMaskDWord, 0x10008c22); + PHY_SetBBReg(pAdapter, rRx_IQK_Tone_A, bMaskDWord, 0x10008c22); } PHY_SetBBReg(pAdapter, rTx_IQK_PI_A, bMaskDWord, 0x82140102); - PHY_SetBBReg(pAdapter, rRx_IQK_PI_A, bMaskDWord, configPathB ? 0x28160202 : + PHY_SetBBReg(pAdapter, rRx_IQK_PI_A, bMaskDWord, configPathB ? 0x28160202 : IS_81xxC_VENDOR_UMC_B_CUT(pHalData->VersionID)?0x28160202:0x28160502); //path-B IQK setting @@ -93,7 +93,7 @@ phy_PathA_IQK_8192C( RTPRINT(FINIT, INIT_IQK, ("One shot, path A LOK & IQK!\n")); PHY_SetBBReg(pAdapter, rIQK_AGC_Pts, bMaskDWord, 0xf9000000); PHY_SetBBReg(pAdapter, rIQK_AGC_Pts, bMaskDWord, 0xf8000000); - + // delay x ms RTPRINT(FINIT, INIT_IQK, ("Delay %d ms for One shot, path A LOK & IQK.\n", IQK_DELAY_TIME)); PlatformStallExecution(IQK_DELAY_TIME*1000); @@ -108,7 +108,7 @@ phy_PathA_IQK_8192C( regEA4= PHY_QueryBBReg(pAdapter, rRx_Power_Before_IQK_A_2, bMaskDWord); RTPRINT(FINIT, INIT_IQK, ("0xea4 = 0x%x\n", regEA4)); - if(!(regEAC & BIT28) && + if(!(regEAC & BIT28) && (((regE94 & 0x03FF0000)>>16) != 0x142) && (((regE9C & 0x03FF0000)>>16) != 0x42) ) result |= 0x01; @@ -121,7 +121,7 @@ phy_PathA_IQK_8192C( result |= 0x02; else RTPRINT(FINIT, INIT_IQK, ("Path A Rx IQK fail!!\n")); - + return result; @@ -170,7 +170,7 @@ phy_PathB_IQK_8192C( result |= 0x02; else RTPRINT(FINIT, INIT_IQK, ("Path B Rx IQK fail!!\n")); - + return result; @@ -179,7 +179,7 @@ phy_PathB_IQK_8192C( VOID phy_PathAFillIQKMatrix( IN struct adapter *pAdapter, - IN BOOLEAN bIQKOK, + IN BOOLEAN bIQKOK, IN s4Byte result[][8], IN u1Byte final_candidate, IN BOOLEAN bTxOnly @@ -187,8 +187,8 @@ phy_PathAFillIQKMatrix( { u4Byte Oldval_0, X, TX0_A, reg; s4Byte Y, TX0_C; - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter); - + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter); + RTPRINT(FINIT, INIT_IQK, ("Path A IQ Calibration %s !\n",(bIQKOK)?"Success":"Failed")); if(final_candidate == 0xFF) @@ -200,7 +200,7 @@ phy_PathAFillIQKMatrix( X = result[final_candidate][0]; if ((X & 0x00000200) != 0) - X = X | 0xFFFFFC00; + X = X | 0xFFFFFC00; TX0_A = (X * Oldval_0) >> 8; RTPRINT(FINIT, INIT_IQK, ("X = 0x%x, TX0_A = 0x%x, Oldval_0 0x%x\n", X, TX0_A, Oldval_0)); PHY_SetBBReg(pAdapter, rOFDM0_XATxIQImbalance, 0x3FF, TX0_A); @@ -208,15 +208,15 @@ phy_PathAFillIQKMatrix( PHY_SetBBReg(pAdapter, rOFDM0_ECCAThreshold, BIT24, ((X* Oldval_0>>7) & 0x1)); else PHY_SetBBReg(pAdapter, rOFDM0_ECCAThreshold, BIT(31), ((X* Oldval_0>>7) & 0x1)); - + Y = result[final_candidate][1]; if ((Y & 0x00000200) != 0) - Y = Y | 0xFFFFFC00; + Y = Y | 0xFFFFFC00; //path B IQK result + 3 if(pAdapter->interfaceIndex == 1 && pHalData->CurrentBandType92D == BAND_ON_5G) Y += 3; - + TX0_C = (Y * Oldval_0) >> 8; RTPRINT(FINIT, INIT_IQK, ("Y = 0x%x, TX = 0x%x\n", Y, TX0_C)); PHY_SetBBReg(pAdapter, rOFDM0_XCTxAFE, 0xF0000000, ((TX0_C&0x3C0)>>6)); @@ -228,13 +228,13 @@ phy_PathAFillIQKMatrix( if(bTxOnly) { - RTPRINT(FINIT, INIT_IQK, ("phy_PathAFillIQKMatrix only Tx OK\n")); + RTPRINT(FINIT, INIT_IQK, ("phy_PathAFillIQKMatrix only Tx OK\n")); return; } reg = result[final_candidate][2]; PHY_SetBBReg(pAdapter, rOFDM0_XARxIQImbalance, 0x3FF, reg); - + reg = result[final_candidate][3] & 0x3F; PHY_SetBBReg(pAdapter, rOFDM0_XARxIQImbalance, 0xFC00, reg); @@ -246,7 +246,7 @@ phy_PathAFillIQKMatrix( VOID phy_PathBFillIQKMatrix( IN struct adapter *pAdapter, - IN BOOLEAN bIQKOK, + IN BOOLEAN bIQKOK, IN s4Byte result[][8], IN u1Byte final_candidate, IN BOOLEAN bTxOnly //do Tx only @@ -254,8 +254,8 @@ phy_PathBFillIQKMatrix( { u4Byte Oldval_1, X, TX1_A, reg; s4Byte Y, TX1_C; - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter); - + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter); + RTPRINT(FINIT, INIT_IQK, ("Path B IQ Calibration %s !\n",(bIQKOK)?"Success":"Failed")); if(final_candidate == 0xFF) @@ -267,19 +267,19 @@ phy_PathBFillIQKMatrix( X = result[final_candidate][4]; if ((X & 0x00000200) != 0) - X = X | 0xFFFFFC00; + X = X | 0xFFFFFC00; TX1_A = (X * Oldval_1) >> 8; RTPRINT(FINIT, INIT_IQK, ("X = 0x%x, TX1_A = 0x%x\n", X, TX1_A)); PHY_SetBBReg(pAdapter, rOFDM0_XBTxIQImbalance, 0x3FF, TX1_A); if(IS_HARDWARE_TYPE_8192D(pAdapter)) - PHY_SetBBReg(pAdapter, rOFDM0_ECCAThreshold, BIT28, ((X* Oldval_1>>7) & 0x1)); + PHY_SetBBReg(pAdapter, rOFDM0_ECCAThreshold, BIT28, ((X* Oldval_1>>7) & 0x1)); else PHY_SetBBReg(pAdapter, rOFDM0_ECCAThreshold, BIT(27), ((X* Oldval_1>>7) & 0x1)); Y = result[final_candidate][5]; if ((Y & 0x00000200) != 0) - Y = Y | 0xFFFFFC00; - if(pHalData->CurrentBandType92D == BAND_ON_5G) + Y = Y | 0xFFFFFC00; + if(pHalData->CurrentBandType92D == BAND_ON_5G) Y += 3; //temp modify for preformance TX1_C = (Y * Oldval_1) >> 8; RTPRINT(FINIT, INIT_IQK, ("Y = 0x%x, TX1_C = 0x%x\n", Y, TX1_C)); @@ -295,7 +295,7 @@ phy_PathBFillIQKMatrix( reg = result[final_candidate][6]; PHY_SetBBReg(pAdapter, rOFDM0_XBRxIQImbalance, 0x3FF, reg); - + reg = result[final_candidate][7] & 0x3F; PHY_SetBBReg(pAdapter, rOFDM0_XBRxIQImbalance, 0xFC00, reg); @@ -305,26 +305,26 @@ phy_PathBFillIQKMatrix( } -BOOLEAN +BOOLEAN phy_SimularityCompare_92C( IN struct adapter *pAdapter, - IN s4Byte result[][8], + IN s4Byte result[][8], IN u1Byte c1, IN u1Byte c2 ) { u4Byte i, j, diff, SimularityBitMap, bound = 0; - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter); + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter); u1Byte final_candidate[2] = {0xFF, 0xFF}; //for path A and path B BOOLEAN bResult = TRUE, is2T = IS_92C_SERIAL( pHalData->VersionID); - + if(is2T) bound = 8; else bound = 4; SimularityBitMap = 0; - + for( i = 0; i < bound; i++ ) { diff = (result[c1][i] > result[c2][i]) ? (result[c1][i] - result[c2][i]) : (result[c2][i] - result[c1][i]); @@ -337,13 +337,13 @@ phy_SimularityCompare_92C( else if (result[c2][i]+result[c2][i+1] == 0) final_candidate[(i/4)] = c1; else - SimularityBitMap = SimularityBitMap|(1< do IQK again */ -BOOLEAN +BOOLEAN phy_SimularityCompare( IN struct adapter *pAdapter, - IN s4Byte result[][8], + IN s4Byte result[][8], IN u1Byte c1, IN u1Byte c2 ) -{ +{ if(IS_HARDWARE_TYPE_8192D(pAdapter)) return phy_SimularityCompare_92D(pAdapter, result, c1, c2); else - return phy_SimularityCompare_92C(pAdapter, result, c1, c2); + return phy_SimularityCompare_92C(pAdapter, result, c1, c2); } -VOID +VOID phy_IQCalibrate_8192C( IN struct adapter *pAdapter, - IN s4Byte result[][8], + IN s4Byte result[][8], IN u1Byte t, IN BOOLEAN is2T ) @@ -403,34 +403,34 @@ phy_IQCalibrate_8192C( HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter); u4Byte i; u1Byte PathAOK, PathBOK; - u4Byte ADDA_REG[IQK_ADDA_REG_NUM] = { - rFPGA0_XCD_SwitchControl, rBlue_Tooth, - rRx_Wait_CCA, rTx_CCK_RFON, - rTx_CCK_BBON, rTx_OFDM_RFON, - rTx_OFDM_BBON, rTx_To_Rx, - rTx_To_Tx, rRx_CCK, - rRx_OFDM, rRx_Wait_RIFS, - rRx_TO_Rx, rStandby, - rSleep, rPMPD_ANAEN }; + u4Byte ADDA_REG[IQK_ADDA_REG_NUM] = { + rFPGA0_XCD_SwitchControl, rBlue_Tooth, + rRx_Wait_CCA, rTx_CCK_RFON, + rTx_CCK_BBON, rTx_OFDM_RFON, + rTx_OFDM_BBON, rTx_To_Rx, + rTx_To_Tx, rRx_CCK, + rRx_OFDM, rRx_Wait_RIFS, + rRx_TO_Rx, rStandby, + rSleep, rPMPD_ANAEN }; u4Byte IQK_MAC_REG[IQK_MAC_REG_NUM] = { - REG_TXPAUSE, REG_BCN_CTRL, + REG_TXPAUSE, REG_BCN_CTRL, REG_BCN_CTRL_1, REG_GPIO_MUXCFG}; - - //since 92C & 92D have the different define in IQK_BB_REG + + //since 92C & 92D have the different define in IQK_BB_REG u4Byte IQK_BB_REG_92C[IQK_BB_REG_NUM] = { - rOFDM0_TRxPathEnable, rOFDM0_TRMuxPar, + rOFDM0_TRxPathEnable, rOFDM0_TRMuxPar, rFPGA0_XCD_RFInterfaceSW, rConfig_AntA, rConfig_AntB, - rFPGA0_XAB_RFInterfaceSW, rFPGA0_XA_RFInterfaceOE, - rFPGA0_XB_RFInterfaceOE, rFPGA0_RFMOD - }; + rFPGA0_XAB_RFInterfaceSW, rFPGA0_XA_RFInterfaceOE, + rFPGA0_XB_RFInterfaceOE, rFPGA0_RFMOD + }; u4Byte IQK_BB_REG_92D[IQK_BB_REG_NUM_92D] = { //for normal - rFPGA0_XAB_RFInterfaceSW, rFPGA0_XA_RFInterfaceOE, + rFPGA0_XAB_RFInterfaceSW, rFPGA0_XA_RFInterfaceOE, rFPGA0_XB_RFInterfaceOE, rOFDM0_TRMuxPar, - rFPGA0_XCD_RFInterfaceSW, rOFDM0_TRxPathEnable, + rFPGA0_XCD_RFInterfaceSW, rOFDM0_TRxPathEnable, rFPGA0_RFMOD, rFPGA0_AnalogParameter4, - rOFDM0_XAAGCCore1, rOFDM0_XBAGCCore1 - }; + rOFDM0_XAAGCCore1, rOFDM0_XBAGCCore1 + }; u4Byte retryCount; #if MP_DRIVER if (pAdapter->registrypriv.mp_mode == 1) @@ -441,79 +441,79 @@ phy_IQCalibrate_8192C( //Neil Chen--2011--05--19-- - //3 Path Div + //3 Path Div u1Byte rfPathSwitch=0x0; - // Note: IQ calibration must be performed after loading - // PHY_REG.txt , and radio_a, radio_b.txt - + // Note: IQ calibration must be performed after loading + // PHY_REG.txt , and radio_a, radio_b.txt + u4Byte bbvalue; if(t==0) { - bbvalue = PHY_QueryBBReg(pAdapter, rFPGA0_RFMOD, bMaskDWord); + bbvalue = PHY_QueryBBReg(pAdapter, rFPGA0_RFMOD, bMaskDWord); RTPRINT(FINIT, INIT_IQK, ("phy_IQCalibrate_8192C()==>0x%08x\n",bbvalue)); RTPRINT(FINIT, INIT_IQK, ("IQ Calibration for %s\n", (is2T ? "2T2R" : "1T1R"))); - - // Save ADDA parameters, turn Path A ADDA on - phy_SaveADDARegisters(pAdapter, ADDA_REG, pHalData->ADDA_backup, IQK_ADDA_REG_NUM); + + // Save ADDA parameters, turn Path A ADDA on + phy_SaveADDARegisters(pAdapter, ADDA_REG, pHalData->ADDA_backup, IQK_ADDA_REG_NUM); phy_SaveMACRegisters(pAdapter, IQK_MAC_REG, pHalData->IQK_MAC_backup); if(IS_HARDWARE_TYPE_8192D(pAdapter)) - phy_SaveADDARegisters(pAdapter, IQK_BB_REG_92D, pHalData->IQK_BB_backup, IQK_BB_REG_NUM_92D); + phy_SaveADDARegisters(pAdapter, IQK_BB_REG_92D, pHalData->IQK_BB_backup, IQK_BB_REG_NUM_92D); else - phy_SaveADDARegisters(pAdapter, IQK_BB_REG_92C, pHalData->IQK_BB_backup, IQK_BB_REG_NUM); + phy_SaveADDARegisters(pAdapter, IQK_BB_REG_92C, pHalData->IQK_BB_backup, IQK_BB_REG_NUM); } - - phy_PathADDAOn(pAdapter, ADDA_REG, TRUE, is2T); - - + phy_PathADDAOn(pAdapter, ADDA_REG, TRUE, is2T); + + + if(IS_HARDWARE_TYPE_8192D(pAdapter)){ //============================== - //3 Path Diversity - ////Neil Chen--2011--05--20 + //3 Path Diversity + ////Neil Chen--2011--05--20 rfPathSwitch =(u1Byte) (PHY_QueryBBReg(pAdapter, 0xB30, bMaskDWord)>>27); //rfPathSwitch = (u1Byte) DataB30; rfPathSwitch = rfPathSwitch&(0x01); - + if(rfPathSwitch) // Path Div On { phy_PathADDAOn(pAdapter, ADDA_REG, TRUE, is2T); //DbgPrint("=STEP= change ADDA Path from B to A Path\n"); - } + } else { - phy_PathADDAOn(pAdapter, ADDA_REG, FALSE, is2T); + phy_PathADDAOn(pAdapter, ADDA_REG, FALSE, is2T); } //3 end - //===================================== - + //===================================== + PHY_SetBBReg(pAdapter, rPdp_AntA, bMaskDWord, 0x01017038); } - + if(t==0) { pHalData->bRfPiEnable = (u1Byte)PHY_QueryBBReg(pAdapter, rFPGA0_XA_HSSIParameter1, BIT(8)); } - + if(!pHalData->bRfPiEnable){ // Switch BB to PI mode to do IQ Calibration. phy_PIModeSwitch(pAdapter, TRUE); } - - PHY_SetBBReg(pAdapter, rFPGA0_RFMOD, BIT24, 0x00); + + PHY_SetBBReg(pAdapter, rFPGA0_RFMOD, BIT24, 0x00); PHY_SetBBReg(pAdapter, rOFDM0_TRxPathEnable, bMaskDWord, 0x03a05600); PHY_SetBBReg(pAdapter, rOFDM0_TRMuxPar, bMaskDWord, 0x000800e4); PHY_SetBBReg(pAdapter, rFPGA0_XCD_RFInterfaceSW, bMaskDWord, 0x22204000); if(IS_HARDWARE_TYPE_8192D(pAdapter)) - PHY_SetBBReg(pAdapter, rFPGA0_AnalogParameter4, 0xf00000, 0x0f); + PHY_SetBBReg(pAdapter, rFPGA0_AnalogParameter4, 0xf00000, 0x0f); else { PHY_SetBBReg(pAdapter, rFPGA0_XAB_RFInterfaceSW, BIT10, 0x01); - PHY_SetBBReg(pAdapter, rFPGA0_XAB_RFInterfaceSW, BIT26, 0x01); + PHY_SetBBReg(pAdapter, rFPGA0_XAB_RFInterfaceSW, BIT26, 0x01); PHY_SetBBReg(pAdapter, rFPGA0_XA_RFInterfaceOE, BIT10, 0x00); - PHY_SetBBReg(pAdapter, rFPGA0_XB_RFInterfaceOE, BIT10, 0x00); + PHY_SetBBReg(pAdapter, rFPGA0_XB_RFInterfaceOE, BIT10, 0x00); } if(is2T) @@ -528,7 +528,7 @@ phy_IQCalibrate_8192C( if(IS_HARDWARE_TYPE_8192D(pAdapter)) { PHY_SetBBReg(pAdapter, rConfig_AntA, bMaskDWord, 0x0f600000); - + if(is2T) { PHY_SetBBReg(pAdapter, rConfig_AntB, bMaskDWord, 0x0f600000); @@ -538,14 +538,14 @@ phy_IQCalibrate_8192C( { //Page B init PHY_SetBBReg(pAdapter, rConfig_AntA, bMaskDWord, 0x00080000); - + if(is2T) { PHY_SetBBReg(pAdapter, rConfig_AntB, bMaskDWord, 0x00080000); } } // IQ calibration setting - RTPRINT(FINIT, INIT_IQK, ("IQK setting!\n")); + RTPRINT(FINIT, INIT_IQK, ("IQK setting!\n")); PHY_SetBBReg(pAdapter, rFPGA0_IQK, bMaskDWord, 0x80800000); PHY_SetBBReg(pAdapter, rTx_IQK, bMaskDWord, 0x01007c00); PHY_SetBBReg(pAdapter, rRx_IQK, bMaskDWord, 0x01004800); @@ -563,14 +563,14 @@ phy_IQCalibrate_8192C( else if (i == (retryCount-1) && PathAOK == 0x01) //Tx IQK OK { RTPRINT(FINIT, INIT_IQK, ("Path A IQK Only Tx Success!!\n")); - + result[t][0] = (PHY_QueryBBReg(pAdapter, rTx_Power_Before_IQK_A, bMaskDWord)&0x3FF0000)>>16; - result[t][1] = (PHY_QueryBBReg(pAdapter, rTx_Power_After_IQK_A, bMaskDWord)&0x3FF0000)>>16; + result[t][1] = (PHY_QueryBBReg(pAdapter, rTx_Power_After_IQK_A, bMaskDWord)&0x3FF0000)>>16; } } - if(0x00 == PathAOK){ - RTPRINT(FINIT, INIT_IQK, ("Path A IQK failed!!\n")); + if(0x00 == PathAOK){ + RTPRINT(FINIT, INIT_IQK, ("Path A IQK failed!!\n")); } if(is2T){ @@ -593,12 +593,12 @@ phy_IQCalibrate_8192C( { RTPRINT(FINIT, INIT_IQK, ("Path B Only Tx IQK Success!!\n")); result[t][4] = (PHY_QueryBBReg(pAdapter, rTx_Power_Before_IQK_B, bMaskDWord)&0x3FF0000)>>16; - result[t][5] = (PHY_QueryBBReg(pAdapter, rTx_Power_After_IQK_B, bMaskDWord)&0x3FF0000)>>16; + result[t][5] = (PHY_QueryBBReg(pAdapter, rTx_Power_After_IQK_B, bMaskDWord)&0x3FF0000)>>16; } } - if(0x00 == PathBOK){ - RTPRINT(FINIT, INIT_IQK, ("Path B IQK failed!!\n")); + if(0x00 == PathBOK){ + RTPRINT(FINIT, INIT_IQK, ("Path B IQK failed!!\n")); } } @@ -613,23 +613,23 @@ phy_IQCalibrate_8192C( phy_PIModeSwitch(pAdapter, FALSE); } - // Reload ADDA power saving parameters - phy_ReloadADDARegisters(pAdapter, ADDA_REG, pHalData->ADDA_backup, IQK_ADDA_REG_NUM); + // Reload ADDA power saving parameters + phy_ReloadADDARegisters(pAdapter, ADDA_REG, pHalData->ADDA_backup, IQK_ADDA_REG_NUM); // Reload MAC parameters phy_ReloadMACRegisters(pAdapter, IQK_MAC_REG, pHalData->IQK_MAC_backup); - - // Reload BB parameters - if(IS_HARDWARE_TYPE_8192D(pAdapter)) - { + + // Reload BB parameters + if(IS_HARDWARE_TYPE_8192D(pAdapter)) + { if(is2T) - phy_ReloadADDARegisters(pAdapter, IQK_BB_REG_92D, pHalData->IQK_BB_backup, IQK_BB_REG_NUM_92D); + phy_ReloadADDARegisters(pAdapter, IQK_BB_REG_92D, pHalData->IQK_BB_backup, IQK_BB_REG_NUM_92D); else - phy_ReloadADDARegisters(pAdapter, IQK_BB_REG_92D, pHalData->IQK_BB_backup, IQK_BB_REG_NUM_92D -1); - } + phy_ReloadADDARegisters(pAdapter, IQK_BB_REG_92D, pHalData->IQK_BB_backup, IQK_BB_REG_NUM_92D -1); + } else - phy_ReloadADDARegisters(pAdapter, IQK_BB_REG_92C, pHalData->IQK_BB_backup, IQK_BB_REG_NUM); - + phy_ReloadADDARegisters(pAdapter, IQK_BB_REG_92C, pHalData->IQK_BB_backup, IQK_BB_REG_NUM); + if(!IS_HARDWARE_TYPE_8192D(pAdapter)) { // Restore RX initial gain @@ -639,16 +639,16 @@ phy_IQCalibrate_8192C( } } //load 0xe30 IQC default value - PHY_SetBBReg(pAdapter, rTx_IQK_Tone_A, bMaskDWord, 0x01008c00); - PHY_SetBBReg(pAdapter, rRx_IQK_Tone_A, bMaskDWord, 0x01008c00); - + PHY_SetBBReg(pAdapter, rTx_IQK_Tone_A, bMaskDWord, 0x01008c00); + PHY_SetBBReg(pAdapter, rRx_IQK_Tone_A, bMaskDWord, 0x01008c00); + } RTPRINT(FINIT, INIT_IQK, ("phy_IQCalibrate_8192C() <==\n")); - + } -VOID +VOID phy_LCCalibrate92C( IN struct adapter *pAdapter, IN BOOLEAN is2T @@ -674,7 +674,7 @@ phy_LCCalibrate92C( //Path-B if(is2T) - RF_Bmode = PHY_QueryRFReg(pAdapter, RF_PATH_B, RF_AC, bMask12Bits); + RF_Bmode = PHY_QueryRFReg(pAdapter, RF_PATH_B, RF_AC, bMask12Bits); //2. Set RF mode = standby mode //Path-A @@ -682,37 +682,37 @@ phy_LCCalibrate92C( //Path-B if(is2T) - PHY_SetRFReg(pAdapter, RF_PATH_B, RF_AC, bMask12Bits, (RF_Bmode&0x8FFFF)|0x10000); + PHY_SetRFReg(pAdapter, RF_PATH_B, RF_AC, bMask12Bits, (RF_Bmode&0x8FFFF)|0x10000); } - + //3. Read RF reg18 LC_Cal = PHY_QueryRFReg(pAdapter, RF_PATH_A, RF_CHNLBW, bMask12Bits); - + //4. Set LC calibration begin bit15 PHY_SetRFReg(pAdapter, RF_PATH_A, RF_CHNLBW, bMask12Bits, LC_Cal|0x08000); - delay_ms(100); + delay_ms(100); //Restore original situation - if((tmpReg&0x70) != 0) //Deal with contisuous TX case - { + if((tmpReg&0x70) != 0) //Deal with contisuous TX case + { //Path-A PlatformEFIOWrite1Byte(pAdapter, 0xd03, tmpReg); PHY_SetRFReg(pAdapter, RF_PATH_A, RF_AC, bMask12Bits, RF_Amode); - + //Path-B if(is2T) PHY_SetRFReg(pAdapter, RF_PATH_B, RF_AC, bMask12Bits, RF_Bmode); } else // Deal with Packet TX case { - PlatformEFIOWrite1Byte(pAdapter, REG_TXPAUSE, 0x00); + PlatformEFIOWrite1Byte(pAdapter, REG_TXPAUSE, 0x00); } } -VOID +VOID phy_LCCalibrate( IN struct adapter *pAdapter, IN BOOLEAN is2T @@ -739,57 +739,57 @@ phy_LCCalibrate( #define APK_CURVE_REG_NUM 4 #define PATH_NUM 2 -VOID +VOID phy_APCalibrate_8192C( IN struct adapter *pAdapter, - IN s1Byte delta, + IN s1Byte delta, IN BOOLEAN is2T ) { HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter); - u4Byte regD[PATH_NUM]; + u4Byte regD[PATH_NUM]; u4Byte tmpReg, index, offset, i, apkbound; u1Byte path, pathbound = PATH_NUM; u4Byte BB_backup[APK_BB_REG_NUM]; - u4Byte BB_REG[APK_BB_REG_NUM] = { - rFPGA1_TxBlock, rOFDM0_TRxPathEnable, - rFPGA0_RFMOD, rOFDM0_TRMuxPar, - rFPGA0_XCD_RFInterfaceSW, rFPGA0_XAB_RFInterfaceSW, - rFPGA0_XA_RFInterfaceOE, rFPGA0_XB_RFInterfaceOE }; - u4Byte BB_AP_MODE[APK_BB_REG_NUM] = { - 0x00000020, 0x00a05430, 0x02040000, + u4Byte BB_REG[APK_BB_REG_NUM] = { + rFPGA1_TxBlock, rOFDM0_TRxPathEnable, + rFPGA0_RFMOD, rOFDM0_TRMuxPar, + rFPGA0_XCD_RFInterfaceSW, rFPGA0_XAB_RFInterfaceSW, + rFPGA0_XA_RFInterfaceOE, rFPGA0_XB_RFInterfaceOE }; + u4Byte BB_AP_MODE[APK_BB_REG_NUM] = { + 0x00000020, 0x00a05430, 0x02040000, 0x000800e4, 0x00204000 }; - u4Byte BB_normal_AP_MODE[APK_BB_REG_NUM] = { - 0x00000020, 0x00a05430, 0x02040000, - 0x000800e4, 0x22204000 }; + u4Byte BB_normal_AP_MODE[APK_BB_REG_NUM] = { + 0x00000020, 0x00a05430, 0x02040000, + 0x000800e4, 0x22204000 }; u4Byte AFE_backup[IQK_ADDA_REG_NUM]; - u4Byte AFE_REG[IQK_ADDA_REG_NUM] = { - rFPGA0_XCD_SwitchControl, rBlue_Tooth, - rRx_Wait_CCA, rTx_CCK_RFON, - rTx_CCK_BBON, rTx_OFDM_RFON, - rTx_OFDM_BBON, rTx_To_Rx, - rTx_To_Tx, rRx_CCK, - rRx_OFDM, rRx_Wait_RIFS, - rRx_TO_Rx, rStandby, - rSleep, rPMPD_ANAEN }; + u4Byte AFE_REG[IQK_ADDA_REG_NUM] = { + rFPGA0_XCD_SwitchControl, rBlue_Tooth, + rRx_Wait_CCA, rTx_CCK_RFON, + rTx_CCK_BBON, rTx_OFDM_RFON, + rTx_OFDM_BBON, rTx_To_Rx, + rTx_To_Tx, rRx_CCK, + rRx_OFDM, rRx_Wait_RIFS, + rRx_TO_Rx, rStandby, + rSleep, rPMPD_ANAEN }; u4Byte MAC_backup[IQK_MAC_REG_NUM]; u4Byte MAC_REG[IQK_MAC_REG_NUM] = { - REG_TXPAUSE, REG_BCN_CTRL, + REG_TXPAUSE, REG_BCN_CTRL, REG_BCN_CTRL_1, REG_GPIO_MUXCFG}; u4Byte APK_RF_init_value[PATH_NUM][APK_BB_REG_NUM] = { {0x0852c, 0x1852c, 0x5852c, 0x1852c, 0x5852c}, {0x2852e, 0x0852e, 0x3852e, 0x0852e, 0x0852e} - }; + }; u4Byte APK_normal_RF_init_value[PATH_NUM][APK_BB_REG_NUM] = { {0x0852c, 0x0a52c, 0x3a52c, 0x5a52c, 0x5a52c}, //path settings equal to path b settings {0x0852c, 0x0a52c, 0x5a52c, 0x5a52c, 0x5a52c} }; - + u4Byte APK_RF_value_0[PATH_NUM][APK_BB_REG_NUM] = { {0x52019, 0x52014, 0x52013, 0x5200f, 0x5208d}, {0x5201a, 0x52019, 0x52016, 0x52033, 0x52050} @@ -799,10 +799,10 @@ phy_APCalibrate_8192C( {0x52019, 0x52017, 0x52010, 0x5200d, 0x5206a}, //path settings equal to path b settings {0x52019, 0x52017, 0x52010, 0x5200d, 0x5206a} }; -#if 0 +#if 0 u4Byte APK_RF_value_A[PATH_NUM][APK_BB_REG_NUM] = { - {0x1adb0, 0x1adb0, 0x1ada0, 0x1ad90, 0x1ad80}, - {0x00fb0, 0x00fb0, 0x00fa0, 0x00f90, 0x00f80} + {0x1adb0, 0x1adb0, 0x1ada0, 0x1ad90, 0x1ad80}, + {0x00fb0, 0x00fb0, 0x00fa0, 0x00f90, 0x00f80} }; #endif u4Byte AFE_on_off[PATH_NUM] = { @@ -813,21 +813,21 @@ phy_APCalibrate_8192C( u4Byte APK_normal_offset[PATH_NUM] = { rConfig_Pmpd_AntA, rConfig_Pmpd_AntB}; - + u4Byte APK_value[PATH_NUM] = { - 0x92fc0000, 0x12fc0000}; + 0x92fc0000, 0x12fc0000}; u4Byte APK_normal_value[PATH_NUM] = { - 0x92680000, 0x12680000}; + 0x92680000, 0x12680000}; s1Byte APK_delta_mapping[APK_BB_REG_NUM][13] = { {-4, -3, -2, -2, -1, -1, 0, 1, 2, 3, 4, 5, 6}, - {-4, -3, -2, -2, -1, -1, 0, 1, 2, 3, 4, 5, 6}, + {-4, -3, -2, -2, -1, -1, 0, 1, 2, 3, 4, 5, 6}, {-6, -4, -2, -2, -1, -1, 0, 1, 2, 3, 4, 5, 6}, {-1, -1, -1, -1, -1, -1, 0, 1, 2, 3, 4, 5, 6}, {-11, -9, -7, -5, -3, -1, 0, 0, 0, 0, 0, 0, 0} }; - + u4Byte APK_normal_setting_value_1[13] = { 0x01017018, 0xf7ed8f84, 0x1b1a1816, 0x2522201e, 0x322e2b28, 0x433f3a36, 0x5b544e49, 0x7b726a62, 0xa69a8f84, 0xdfcfc0b3, @@ -840,7 +840,7 @@ phy_APCalibrate_8192C( 0x0017001b, 0x00110014, 0x000c000f, 0x0009000b, 0x00070008, 0x00050006 }; - + u4Byte APK_result[PATH_NUM][APK_BB_REG_NUM]; //val_1_1a, val_1_2a, val_2a, val_3a, val_4a // u4Byte AP_curve[PATH_NUM][APK_CURVE_REG_NUM]; @@ -849,10 +849,10 @@ phy_APCalibrate_8192C( #if MP_DRIVER == 1 if (pAdapter->registrypriv.mp_mode == 1) { - PMPT_CONTEXT pMptCtx = &(pAdapter->MptCtx); + PMPT_CONTEXT pMptCtx = &(pAdapter->MptCtx); pMptCtx->APK_bound[0] = 45; - pMptCtx->APK_bound[1] = 52; + pMptCtx->APK_bound[1] = 52; } #endif @@ -890,21 +890,21 @@ if (pAdapter->registrypriv.mp_mode == 1) APK_RF_value_0[path][index] = APK_normal_RF_value_0[path][index]; } BB_AP_MODE[index] = BB_normal_AP_MODE[index]; - } + } apkbound = 6; - + //save BB default value for(index = 0; index < APK_BB_REG_NUM ; index++) { - if(index == 0) //skip - continue; + if(index == 0) //skip + continue; BB_backup[index] = PHY_QueryBBReg(pAdapter, BB_REG[index], bMaskDWord); } - - //save MAC default value + + //save MAC default value phy_SaveMACRegisters(pAdapter, MAC_REG, MAC_backup); - + //save AFE default value phy_SaveADDARegisters(pAdapter, AFE_REG, AFE_backup, IQK_ADDA_REG_NUM); @@ -916,131 +916,131 @@ if (pAdapter->registrypriv.mp_mode == 1) { //path A APK //load APK setting - //path-A + //path-A offset = rPdp_AntA; - for(index = 0; index < 11; index ++) + for(index = 0; index < 11; index ++) { PHY_SetBBReg(pAdapter, offset, bMaskDWord, APK_normal_setting_value_1[index]); - RTPRINT(FINIT, INIT_IQK, ("phy_APCalibrate_8192C() offset 0x%x value 0x%x\n", offset, PHY_QueryBBReg(pAdapter, offset, bMaskDWord))); - + RTPRINT(FINIT, INIT_IQK, ("phy_APCalibrate_8192C() offset 0x%x value 0x%x\n", offset, PHY_QueryBBReg(pAdapter, offset, bMaskDWord))); + offset += 0x04; } - + PHY_SetBBReg(pAdapter, rConfig_Pmpd_AntB, bMaskDWord, 0x12680000); - + offset = rConfig_AntA; - for(; index < 13; index ++) + for(; index < 13; index ++) { PHY_SetBBReg(pAdapter, offset, bMaskDWord, APK_normal_setting_value_1[index]); - RTPRINT(FINIT, INIT_IQK, ("phy_APCalibrate_8192C() offset 0x%x value 0x%x\n", offset, PHY_QueryBBReg(pAdapter, offset, bMaskDWord))); - + RTPRINT(FINIT, INIT_IQK, ("phy_APCalibrate_8192C() offset 0x%x value 0x%x\n", offset, PHY_QueryBBReg(pAdapter, offset, bMaskDWord))); + offset += 0x04; - } - + } + //page-B1 PHY_SetBBReg(pAdapter, rFPGA0_IQK, bMaskDWord, 0x40000000); - + //path A offset = rPdp_AntA; for(index = 0; index < 16; index++) { - PHY_SetBBReg(pAdapter, offset, bMaskDWord, APK_normal_setting_value_2[index]); - RTPRINT(FINIT, INIT_IQK, ("phy_APCalibrate_8192C() offset 0x%x value 0x%x\n", offset, PHY_QueryBBReg(pAdapter, offset, bMaskDWord))); - + PHY_SetBBReg(pAdapter, offset, bMaskDWord, APK_normal_setting_value_2[index]); + RTPRINT(FINIT, INIT_IQK, ("phy_APCalibrate_8192C() offset 0x%x value 0x%x\n", offset, PHY_QueryBBReg(pAdapter, offset, bMaskDWord))); + offset += 0x04; - } - PHY_SetBBReg(pAdapter, rFPGA0_IQK, bMaskDWord, 0x00000000); + } + PHY_SetBBReg(pAdapter, rFPGA0_IQK, bMaskDWord, 0x00000000); } else if(path == RF_PATH_B) { //path B APK //load APK setting - //path-B + //path-B offset = rPdp_AntB; - for(index = 0; index < 10; index ++) + for(index = 0; index < 10; index ++) { PHY_SetBBReg(pAdapter, offset, bMaskDWord, APK_normal_setting_value_1[index]); - RTPRINT(FINIT, INIT_IQK, ("phy_APCalibrate_8192C() offset 0x%x value 0x%x\n", offset, PHY_QueryBBReg(pAdapter, offset, bMaskDWord))); - + RTPRINT(FINIT, INIT_IQK, ("phy_APCalibrate_8192C() offset 0x%x value 0x%x\n", offset, PHY_QueryBBReg(pAdapter, offset, bMaskDWord))); + offset += 0x04; } PHY_SetBBReg(pAdapter, rConfig_Pmpd_AntA, bMaskDWord, 0x12680000); - + PHY_SetBBReg(pAdapter, rConfig_Pmpd_AntB, bMaskDWord, 0x12680000); - + offset = rConfig_AntA; index = 11; - for(; index < 13; index ++) //offset 0xb68, 0xb6c + for(; index < 13; index ++) //offset 0xb68, 0xb6c { PHY_SetBBReg(pAdapter, offset, bMaskDWord, APK_normal_setting_value_1[index]); - RTPRINT(FINIT, INIT_IQK, ("phy_APCalibrate_8192C() offset 0x%x value 0x%x\n", offset, PHY_QueryBBReg(pAdapter, offset, bMaskDWord))); - + RTPRINT(FINIT, INIT_IQK, ("phy_APCalibrate_8192C() offset 0x%x value 0x%x\n", offset, PHY_QueryBBReg(pAdapter, offset, bMaskDWord))); + offset += 0x04; - } - + } + //page-B1 PHY_SetBBReg(pAdapter, rFPGA0_IQK, bMaskDWord, 0x40000000); - + //path B offset = 0xb60; for(index = 0; index < 16; index++) { - PHY_SetBBReg(pAdapter, offset, bMaskDWord, APK_normal_setting_value_2[index]); - RTPRINT(FINIT, INIT_IQK, ("phy_APCalibrate_8192C() offset 0x%x value 0x%x\n", offset, PHY_QueryBBReg(pAdapter, offset, bMaskDWord))); - + PHY_SetBBReg(pAdapter, offset, bMaskDWord, APK_normal_setting_value_2[index]); + RTPRINT(FINIT, INIT_IQK, ("phy_APCalibrate_8192C() offset 0x%x value 0x%x\n", offset, PHY_QueryBBReg(pAdapter, offset, bMaskDWord))); + offset += 0x04; - } - PHY_SetBBReg(pAdapter, rFPGA0_IQK, bMaskDWord, 0x00000000); + } + PHY_SetBBReg(pAdapter, rFPGA0_IQK, bMaskDWord, 0x00000000); } - + //save RF default value regD[path] = PHY_QueryRFReg(pAdapter, path, RF_TXBIAS_A, bRFRegOffsetMask); - + //Path A AFE all on, path B AFE All off or vise versa for(index = 0; index < IQK_ADDA_REG_NUM ; index++) PHY_SetBBReg(pAdapter, AFE_REG[index], bMaskDWord, AFE_on_off[path]); - RTPRINT(FINIT, INIT_IQK, ("phy_APCalibrate_8192C() offset 0xe70 %x\n", PHY_QueryBBReg(pAdapter, rRx_Wait_CCA, bMaskDWord))); + RTPRINT(FINIT, INIT_IQK, ("phy_APCalibrate_8192C() offset 0xe70 %x\n", PHY_QueryBBReg(pAdapter, rRx_Wait_CCA, bMaskDWord))); //BB to AP mode if(path == 0) - { + { for(index = 0; index < APK_BB_REG_NUM ; index++) { - if(index == 0) //skip - continue; + if(index == 0) //skip + continue; else if (index < 5) PHY_SetBBReg(pAdapter, BB_REG[index], bMaskDWord, BB_AP_MODE[index]); else if (BB_REG[index] == 0x870) PHY_SetBBReg(pAdapter, BB_REG[index], bMaskDWord, BB_backup[index]|BIT10|BIT26); else - PHY_SetBBReg(pAdapter, BB_REG[index], BIT10, 0x0); + PHY_SetBBReg(pAdapter, BB_REG[index], BIT10, 0x0); } - PHY_SetBBReg(pAdapter, rTx_IQK_Tone_A, bMaskDWord, 0x01008c00); - PHY_SetBBReg(pAdapter, rRx_IQK_Tone_A, bMaskDWord, 0x01008c00); + PHY_SetBBReg(pAdapter, rTx_IQK_Tone_A, bMaskDWord, 0x01008c00); + PHY_SetBBReg(pAdapter, rRx_IQK_Tone_A, bMaskDWord, 0x01008c00); } else //path B { - PHY_SetBBReg(pAdapter, rTx_IQK_Tone_B, bMaskDWord, 0x01008c00); - PHY_SetBBReg(pAdapter, rRx_IQK_Tone_B, bMaskDWord, 0x01008c00); - + PHY_SetBBReg(pAdapter, rTx_IQK_Tone_B, bMaskDWord, 0x01008c00); + PHY_SetBBReg(pAdapter, rRx_IQK_Tone_B, bMaskDWord, 0x01008c00); + } - RTPRINT(FINIT, INIT_IQK, ("phy_APCalibrate_8192C() offset 0x800 %x\n", PHY_QueryBBReg(pAdapter, 0x800, bMaskDWord))); + RTPRINT(FINIT, INIT_IQK, ("phy_APCalibrate_8192C() offset 0x800 %x\n", PHY_QueryBBReg(pAdapter, 0x800, bMaskDWord))); //MAC settings phy_MACSettingCalibration(pAdapter, MAC_REG, MAC_backup); - + if(path == RF_PATH_A) //Path B to standby mode { - PHY_SetRFReg(pAdapter, RF_PATH_B, RF_AC, bRFRegOffsetMask, 0x10000); + PHY_SetRFReg(pAdapter, RF_PATH_B, RF_AC, bRFRegOffsetMask, 0x10000); } else //Path A to standby mode { - PHY_SetRFReg(pAdapter, RF_PATH_A, RF_AC, bRFRegOffsetMask, 0x10000); - PHY_SetRFReg(pAdapter, RF_PATH_A, RF_MODE1, bRFRegOffsetMask, 0x1000f); - PHY_SetRFReg(pAdapter, RF_PATH_A, RF_MODE2, bRFRegOffsetMask, 0x20103); + PHY_SetRFReg(pAdapter, RF_PATH_A, RF_AC, bRFRegOffsetMask, 0x10000); + PHY_SetRFReg(pAdapter, RF_PATH_A, RF_MODE1, bRFRegOffsetMask, 0x1000f); + PHY_SetRFReg(pAdapter, RF_PATH_A, RF_MODE2, bRFRegOffsetMask, 0x20103); } delta_offset = ((delta+14)/2); @@ -1048,15 +1048,15 @@ if (pAdapter->registrypriv.mp_mode == 1) delta_offset = 0; else if (delta_offset > 12) delta_offset = 12; - + //AP calibration for(index = 0; index < APK_BB_REG_NUM; index++) { if(index != 1) //only DO PA11+PAD01001, AP RF setting continue; - + tmpReg = APK_RF_init_value[path][index]; -#if 1 +#if 1 if(!pHalData->bAPKThermalMeterIgnore) { BB_offset = (tmpReg & 0xF0000) >> 16; @@ -1067,11 +1067,11 @@ if (pAdapter->registrypriv.mp_mode == 1) } delta_V = APK_delta_mapping[index][delta_offset]; - + BB_offset += delta_V; - RTPRINT(FINIT, INIT_IQK, ("phy_APCalibrate_8192C() APK index %d tmpReg 0x%x delta_V %d delta_offset %d\n", index, tmpReg, delta_V, delta_offset)); - + RTPRINT(FINIT, INIT_IQK, ("phy_APCalibrate_8192C() APK index %d tmpReg 0x%x delta_V %d delta_offset %d\n", index, tmpReg, delta_V, delta_offset)); + if(BB_offset < 0) { tmpReg = tmpReg & (~BIT15); @@ -1089,23 +1089,23 @@ if (pAdapter->registrypriv.mp_mode == 1) if(IS_81xxC_VENDOR_UMC_B_CUT(pHalData->VersionID)) PHY_SetRFReg(pAdapter, path, RF_IPA_A, bRFRegOffsetMask, 0x894ae); else -#endif +#endif PHY_SetRFReg(pAdapter, path, RF_IPA_A, bRFRegOffsetMask, 0x8992e); - RTPRINT(FINIT, INIT_IQK, ("phy_APCalibrate_8192C() offset 0xc %x\n", PHY_QueryRFReg(pAdapter, path, RF_IPA_A, bRFRegOffsetMask))); + RTPRINT(FINIT, INIT_IQK, ("phy_APCalibrate_8192C() offset 0xc %x\n", PHY_QueryRFReg(pAdapter, path, RF_IPA_A, bRFRegOffsetMask))); PHY_SetRFReg(pAdapter, path, RF_AC, bRFRegOffsetMask, APK_RF_value_0[path][index]); - RTPRINT(FINIT, INIT_IQK, ("phy_APCalibrate_8192C() offset 0x0 %x\n", PHY_QueryRFReg(pAdapter, path, RF_AC, bRFRegOffsetMask))); + RTPRINT(FINIT, INIT_IQK, ("phy_APCalibrate_8192C() offset 0x0 %x\n", PHY_QueryRFReg(pAdapter, path, RF_AC, bRFRegOffsetMask))); PHY_SetRFReg(pAdapter, path, RF_TXBIAS_A, bRFRegOffsetMask, tmpReg); - RTPRINT(FINIT, INIT_IQK, ("phy_APCalibrate_8192C() offset 0xd %x\n", PHY_QueryRFReg(pAdapter, path, RF_TXBIAS_A, bRFRegOffsetMask))); - - // PA11+PAD01111, one shot + RTPRINT(FINIT, INIT_IQK, ("phy_APCalibrate_8192C() offset 0xd %x\n", PHY_QueryRFReg(pAdapter, path, RF_TXBIAS_A, bRFRegOffsetMask))); + + // PA11+PAD01111, one shot i = 0; do { PHY_SetBBReg(pAdapter, rFPGA0_IQK, bMaskDWord, 0x80000000); { - PHY_SetBBReg(pAdapter, APK_offset[path], bMaskDWord, APK_value[0]); + PHY_SetBBReg(pAdapter, APK_offset[path], bMaskDWord, APK_value[0]); RTPRINT(FINIT, INIT_IQK, ("phy_APCalibrate_8192C() offset 0x%x value 0x%x\n", APK_offset[path], PHY_QueryBBReg(pAdapter, APK_offset[path], bMaskDWord))); - delay_ms(3); + delay_ms(3); PHY_SetBBReg(pAdapter, APK_offset[path], bMaskDWord, APK_value[1]); RTPRINT(FINIT, INIT_IQK, ("phy_APCalibrate_8192C() offset 0x%x value 0x%x\n", APK_offset[path], PHY_QueryBBReg(pAdapter, APK_offset[path], bMaskDWord))); @@ -1117,8 +1117,8 @@ if (pAdapter->registrypriv.mp_mode == 1) tmpReg = PHY_QueryBBReg(pAdapter, rAPK, 0x03E00000); else tmpReg = PHY_QueryBBReg(pAdapter, rAPK, 0xF8000000); - RTPRINT(FINIT, INIT_IQK, ("phy_APCalibrate_8192C() offset 0xbd8[25:21] %x\n", tmpReg)); - + RTPRINT(FINIT, INIT_IQK, ("phy_APCalibrate_8192C() offset 0xbd8[25:21] %x\n", tmpReg)); + i++; } @@ -1128,15 +1128,15 @@ if (pAdapter->registrypriv.mp_mode == 1) } } - //reload MAC default value + //reload MAC default value phy_ReloadMACRegisters(pAdapter, MAC_REG, MAC_backup); - - //reload BB default value + + //reload BB default value for(index = 0; index < APK_BB_REG_NUM ; index++) { - if(index == 0) //skip - continue; + if(index == 0) //skip + continue; PHY_SetBBReg(pAdapter, BB_REG[index], bMaskDWord, BB_backup[index]); } @@ -1149,33 +1149,33 @@ if (pAdapter->registrypriv.mp_mode == 1) PHY_SetRFReg(pAdapter, path, RF_TXBIAS_A, bRFRegOffsetMask, regD[path]); if(path == RF_PATH_B) { - PHY_SetRFReg(pAdapter, RF_PATH_A, RF_MODE1, bRFRegOffsetMask, 0x1000f); - PHY_SetRFReg(pAdapter, RF_PATH_A, RF_MODE2, bRFRegOffsetMask, 0x20101); + PHY_SetRFReg(pAdapter, RF_PATH_A, RF_MODE1, bRFRegOffsetMask, 0x1000f); + PHY_SetRFReg(pAdapter, RF_PATH_A, RF_MODE2, bRFRegOffsetMask, 0x20101); } //note no index == 0 if (APK_result[path][1] > 6) APK_result[path][1] = 6; - RTPRINT(FINIT, INIT_IQK, ("apk path %d result %d 0x%x \t", path, 1, APK_result[path][1])); + RTPRINT(FINIT, INIT_IQK, ("apk path %d result %d 0x%x \t", path, 1, APK_result[path][1])); } RTPRINT(FINIT, INIT_IQK, ("\n")); - + for(path = 0; path < pathbound; path++) { - PHY_SetRFReg(pAdapter, path, RF_BS_PA_APSET_G1_G4, bRFRegOffsetMask, + PHY_SetRFReg(pAdapter, path, RF_BS_PA_APSET_G1_G4, bRFRegOffsetMask, ((APK_result[path][1] << 15) | (APK_result[path][1] << 10) | (APK_result[path][1] << 5) | APK_result[path][1])); if(path == RF_PATH_A) - PHY_SetRFReg(pAdapter, path, RF_BS_PA_APSET_G5_G8, bRFRegOffsetMask, - ((APK_result[path][1] << 15) | (APK_result[path][1] << 10) | (0x00 << 5) | 0x05)); + PHY_SetRFReg(pAdapter, path, RF_BS_PA_APSET_G5_G8, bRFRegOffsetMask, + ((APK_result[path][1] << 15) | (APK_result[path][1] << 10) | (0x00 << 5) | 0x05)); else - PHY_SetRFReg(pAdapter, path, RF_BS_PA_APSET_G5_G8, bRFRegOffsetMask, - ((APK_result[path][1] << 15) | (APK_result[path][1] << 10) | (0x02 << 5) | 0x05)); + PHY_SetRFReg(pAdapter, path, RF_BS_PA_APSET_G5_G8, bRFRegOffsetMask, + ((APK_result[path][1] << 15) | (APK_result[path][1] << 10) | (0x02 << 5) | 0x05)); - if(!IS_HARDWARE_TYPE_8723A(pAdapter)) - PHY_SetRFReg(pAdapter, path, RF_BS_PA_APSET_G9_G11, bRFRegOffsetMask, - ((0x08 << 15) | (0x08 << 10) | (0x08 << 5) | 0x08)); + if(!IS_HARDWARE_TYPE_8723A(pAdapter)) + PHY_SetRFReg(pAdapter, path, RF_BS_PA_APSET_G9_G11, bRFRegOffsetMask, + ((0x08 << 15) | (0x08 << 10) | (0x08 << 5) | 0x08)); } pHalData->bAPKdone = TRUE; @@ -1187,7 +1187,7 @@ if (pAdapter->registrypriv.mp_mode == 1) VOID PHY_IQCalibrate_8192C( IN struct adapter *pAdapter, - IN BOOLEAN bReCovery + IN BOOLEAN bReCovery ) { HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter); @@ -1195,27 +1195,27 @@ PHY_IQCalibrate_8192C( u1Byte i, final_candidate, Indexforchannel; BOOLEAN bPathAOK, bPathBOK; s4Byte RegE94, RegE9C, RegEA4, RegEAC, RegEB4, RegEBC, RegEC4, RegECC, RegTmp = 0; - BOOLEAN is12simular, is13simular, is23simular; - BOOLEAN bStartContTx = FALSE, bSingleTone = FALSE, bCarrierSuppression = FALSE; + BOOLEAN is12simular, is13simular, is23simular; + BOOLEAN bStartContTx = FALSE, bSingleTone = FALSE, bCarrierSuppression = FALSE; u4Byte IQK_BB_REG_92C[IQK_BB_REG_NUM] = { - rOFDM0_XARxIQImbalance, rOFDM0_XBRxIQImbalance, - rOFDM0_ECCAThreshold, rOFDM0_AGCRSSITable, - rOFDM0_XATxIQImbalance, rOFDM0_XBTxIQImbalance, - rOFDM0_XCTxAFE, rOFDM0_XDTxAFE, + rOFDM0_XARxIQImbalance, rOFDM0_XBRxIQImbalance, + rOFDM0_ECCAThreshold, rOFDM0_AGCRSSITable, + rOFDM0_XATxIQImbalance, rOFDM0_XBTxIQImbalance, + rOFDM0_XCTxAFE, rOFDM0_XDTxAFE, rOFDM0_RxIQExtAnta}; if (ODM_CheckPowerStatus(pAdapter) == FALSE) return; - -#if MP_DRIVER == 1 + +#if MP_DRIVER == 1 if (pAdapter->registrypriv.mp_mode == 1) { bStartContTx = pAdapter->MptCtx.bStartContTx; bSingleTone = pAdapter->MptCtx.bSingleTone; - bCarrierSuppression = pAdapter->MptCtx.bCarrierSuppression; + bCarrierSuppression = pAdapter->MptCtx.bCarrierSuppression; } #endif - + //ignore IQK when continuous Tx if(bStartContTx || bSingleTone || bCarrierSuppression) return; @@ -1231,7 +1231,7 @@ if (pAdapter->registrypriv.mp_mode == 1) if(bReCovery) { phy_ReloadADDARegisters(pAdapter, IQK_BB_REG_92C, pHalData->IQK_BB_backup_recover, 9); - return; + return; } } @@ -1260,15 +1260,15 @@ if (pAdapter->registrypriv.mp_mode == 1) // if(IS_HARDWARE_TYPE_8192C(pAdapter) || IS_HARDWARE_TYPE_8723A(pAdapter)) if(!IS_HARDWARE_TYPE_8192D(pAdapter)) { - if(IS_92C_SERIAL( pHalData->VersionID)) + if(IS_92C_SERIAL( pHalData->VersionID)) { - phy_IQCalibrate_8192C(pAdapter, result, i, TRUE); - } - else + phy_IQCalibrate_8192C(pAdapter, result, i, TRUE); + } + else { - // For 88C 1T1R - phy_IQCalibrate_8192C(pAdapter, result, i, FALSE); - } + // For 88C 1T1R + phy_IQCalibrate_8192C(pAdapter, result, i, FALSE); + } } else/* if(IS_HARDWARE_TYPE_8192D(pAdapter))*/ { @@ -1284,7 +1284,7 @@ if (pAdapter->registrypriv.mp_mode == 1) phy_IQCalibrate_8192C(pAdapter, result, i, FALSE); } } - + if(i == 1) { is12simular = phy_SimularityCompare(pAdapter, result, 0, 1); @@ -1294,16 +1294,16 @@ if (pAdapter->registrypriv.mp_mode == 1) break; } } - + if(i == 2) { is13simular = phy_SimularityCompare(pAdapter, result, 0, 2); if(is13simular) { - final_candidate = 0; + final_candidate = 0; break; } - + is23simular = phy_SimularityCompare(pAdapter, result, 1, 2); if(is23simular) final_candidate = 1; @@ -1313,7 +1313,7 @@ if (pAdapter->registrypriv.mp_mode == 1) RegTmp += result[3][i]; if(RegTmp != 0) - final_candidate = 3; + final_candidate = 3; else final_candidate = 0xFF; } @@ -1334,7 +1334,7 @@ if (pAdapter->registrypriv.mp_mode == 1) RegECC = result[i][7]; RTPRINT(FINIT, INIT_IQK, ("IQK: RegE94=%x RegE9C=%x RegEA4=%x RegEAC=%x RegEB4=%x RegEBC=%x RegEC4=%x RegECC=%x\n ", RegE94, RegE9C, RegEA4, RegEAC, RegEB4, RegEBC, RegEC4, RegECC)); } - + if(final_candidate != 0xff) { pHalData->RegE94 = RegE94 = result[final_candidate][0]; @@ -1354,36 +1354,36 @@ if (pAdapter->registrypriv.mp_mode == 1) RegE94 = RegEB4 = pHalData->RegE94 = pHalData->RegEB4 = 0x100; //X default value RegE9C = RegEBC = pHalData->RegE9C = pHalData->RegEBC = 0x0; //Y default value } - + if((RegE94 != 0)/*&&(RegEA4 != 0)*/) { if(pHalData->CurrentBandType92D == BAND_ON_5G) - phy_PathAFillIQKMatrix_5G_Normal(pAdapter, bPathAOK, result, final_candidate, (RegEA4 == 0)); - else + phy_PathAFillIQKMatrix_5G_Normal(pAdapter, bPathAOK, result, final_candidate, (RegEA4 == 0)); + else phy_PathAFillIQKMatrix(pAdapter, bPathAOK, result, final_candidate, (RegEA4 == 0)); } - + if (IS_92C_SERIAL(pHalData->VersionID) || IS_92D_SINGLEPHY(pHalData->VersionID)) { if((RegEB4 != 0)/*&&(RegEC4 != 0)*/) { - if(pHalData->CurrentBandType92D == BAND_ON_5G) + if(pHalData->CurrentBandType92D == BAND_ON_5G) phy_PathBFillIQKMatrix_5G_Normal(pAdapter, bPathBOK, result, final_candidate, (RegEC4 == 0)); else phy_PathBFillIQKMatrix(pAdapter, bPathBOK, result, final_candidate, (RegEC4 == 0)); } } - + if(IS_HARDWARE_TYPE_8192D(pAdapter) && final_candidate != 0xFF) { Indexforchannel = GetRightChnlPlaceforIQK(pHalData->CurrentChannel); - + for(i = 0; i < IQK_Matrix_REG_NUM; i++) - pHalData->IQKMatrixRegSetting[Indexforchannel].Value[0][i] = + pHalData->IQKMatrixRegSetting[Indexforchannel].Value[0][i] = result[final_candidate][i]; - - pHalData->IQKMatrixRegSetting[Indexforchannel].bIQKDone = TRUE; + + pHalData->IQKMatrixRegSetting[Indexforchannel].bIQKDone = TRUE; RTPRINT(FINIT, INIT_IQK, ("\nIQK OK Indexforchannel %d.\n", Indexforchannel)); } @@ -1400,13 +1400,13 @@ PHY_LCCalibrate_8192C( ) { HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter); - BOOLEAN bStartContTx = FALSE, bSingleTone = FALSE, bCarrierSuppression = FALSE; + BOOLEAN bStartContTx = FALSE, bSingleTone = FALSE, bCarrierSuppression = FALSE; PMGNT_INFO pMgntInfo=&pAdapter->MgntInfo; PMGNT_INFO pMgntInfoBuddyAdapter; u4Byte timeout = 2000, timecount = 0; struct adapter *BuddyAdapter = pAdapter->BuddyAdapter; -#if MP_DRIVER == 1 +#if MP_DRIVER == 1 if (pAdapter->registrypriv.mp_mode == 1) { bStartContTx = pAdapter->MptCtx.bStartContTx; @@ -1439,12 +1439,12 @@ if (pAdapter->registrypriv.mp_mode == 1) { delay_ms(50); timecount += 50; - } - + } + pHalData->bLCKInProgress = TRUE; RTPRINT(FINIT, INIT_IQK, ("LCK:Start!!!interface %d currentband %x delay %d ms\n", pAdapter->interfaceIndex, pHalData->CurrentBandType92D, timecount)); - + //if(IS_92C_SERIAL(pHalData->VersionID) || IS_92D_SINGLEPHY(pHalData->VersionID)) if(IS_2T2R(pHalData->VersionID)) { @@ -1458,14 +1458,14 @@ if (pAdapter->registrypriv.mp_mode == 1) pHalData->bLCKInProgress = FALSE; RTPRINT(FINIT, INIT_IQK, ("LCK:Finish!!!interface %d\n", pAdapter->interfaceIndex)); - + } VOID PHY_APCalibrate_8192C( IN struct adapter *pAdapter, - IN s1Byte delta + IN s1Byte delta ) { HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter); @@ -1482,7 +1482,7 @@ PHY_APCalibrate_8192C( #if FOR_BRAZIL_PRETEST != 1 if(pHalData->bAPKdone) -#endif +#endif return; if(IS_92C_SERIAL( pHalData->VersionID)){ @@ -1504,7 +1504,7 @@ PHY_APCalibrate_8192C( VOID ODM_ResetIQKResult( - IN PDM_ODM_T pDM_Odm + IN PDM_ODM_T pDM_Odm ) { u1Byte i; @@ -1520,18 +1520,18 @@ ODM_ResetIQKResult( for(i = 0; i < IQK_Matrix_Settings_NUM; i++) { { - pDM_Odm->RFCalibrateInfo.IQKMatrixRegSetting[i].Value[0][0] = - pDM_Odm->RFCalibrateInfo.IQKMatrixRegSetting[i].Value[0][2] = - pDM_Odm->RFCalibrateInfo.IQKMatrixRegSetting[i].Value[0][4] = + pDM_Odm->RFCalibrateInfo.IQKMatrixRegSetting[i].Value[0][0] = + pDM_Odm->RFCalibrateInfo.IQKMatrixRegSetting[i].Value[0][2] = + pDM_Odm->RFCalibrateInfo.IQKMatrixRegSetting[i].Value[0][4] = pDM_Odm->RFCalibrateInfo.IQKMatrixRegSetting[i].Value[0][6] = 0x100; - pDM_Odm->RFCalibrateInfo.IQKMatrixRegSetting[i].Value[0][1] = - pDM_Odm->RFCalibrateInfo.IQKMatrixRegSetting[i].Value[0][3] = - pDM_Odm->RFCalibrateInfo.IQKMatrixRegSetting[i].Value[0][5] = + pDM_Odm->RFCalibrateInfo.IQKMatrixRegSetting[i].Value[0][1] = + pDM_Odm->RFCalibrateInfo.IQKMatrixRegSetting[i].Value[0][3] = + pDM_Odm->RFCalibrateInfo.IQKMatrixRegSetting[i].Value[0][5] = pDM_Odm->RFCalibrateInfo.IQKMatrixRegSetting[i].Value[0][7] = 0x0; pDM_Odm->RFCalibrateInfo.IQKMatrixRegSetting[i].bIQKDone = FALSE; - + } } @@ -1539,11 +1539,11 @@ ODM_ResetIQKResult( #if !(DM_ODM_SUPPORT_TYPE & ODM_AP) u1Byte ODM_GetRightChnlPlaceforIQK(u1Byte chnl) { - u1Byte channel_all[ODM_TARGET_CHNL_NUM_2G_5G] = + u1Byte channel_all[ODM_TARGET_CHNL_NUM_2G_5G] = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,36,38,40,42,44,46,48,50,52,54,56,58,60,62,64,100,102,104,106,108,110,112,114,116,118,120,122,124,126,128,130,132,134,136,138,140,149,151,153,155,157,159,161,163,165}; u1Byte place = chnl; - + if(chnl > 14) { for(place = 14; place= _size)\ - _offset = _size-1;\ - } while(0) - -//3============================================================ -//3 Tx Power Tracking -//3============================================================ -void setIqkMatrix( - PDM_ODM_T pDM_Odm, - u1Byte OFDM_index, - u1Byte RFPath, - s4Byte IqkResult_X, - s4Byte IqkResult_Y - ) -{ - s4Byte ele_A=0, ele_D, ele_C=0, TempCCk, value32; - - //printk("%s==> OFDM_index:%d \n",__FUNCTION__,OFDM_index); - - //if(OFDM_index> OFDM_TABLE_SIZE_92D) - //{ - //printk("%s==> OFDM_index> 43\n",__FUNCTION__); - //} - ele_D = (OFDMSwingTable[OFDM_index] & 0xFFC00000)>>22; - - //new element A = element D x X - if((IqkResult_X != 0) && (*(pDM_Odm->pBandType) == ODM_BAND_2_4G)) - { - if ((IqkResult_X & 0x00000200) != 0) //consider minus - IqkResult_X = IqkResult_X | 0xFFFFFC00; - ele_A = ((IqkResult_X * ele_D)>>8)&0x000003FF; - - //new element C = element D x Y - if ((IqkResult_Y & 0x00000200) != 0) - IqkResult_Y = IqkResult_Y | 0xFFFFFC00; - ele_C = ((IqkResult_Y * ele_D)>>8)&0x000003FF; - - if (RFPath == RF_PATH_A) - switch (RFPath) - { - case RF_PATH_A: - //wirte new elements A, C, D to regC80 and regC94, element B is always 0 - value32 = (ele_D<<22)|((ele_C&0x3F)<<16)|ele_A; - ODM_SetBBReg(pDM_Odm, rOFDM0_XATxIQImbalance, bMaskDWord, value32); - - value32 = (ele_C&0x000003C0)>>6; - ODM_SetBBReg(pDM_Odm, rOFDM0_XCTxAFE, bMaskH4Bits, value32); - - value32 = ((IqkResult_X * ele_D)>>7)&0x01; - ODM_SetBBReg(pDM_Odm, rOFDM0_ECCAThreshold, BIT24, value32); - break; - case RF_PATH_B: - //wirte new elements A, C, D to regC88 and regC9C, element B is always 0 - value32=(ele_D<<22)|((ele_C&0x3F)<<16) |ele_A; - ODM_SetBBReg(pDM_Odm, rOFDM0_XBTxIQImbalance, bMaskDWord, value32); - - value32 = (ele_C&0x000003C0)>>6; - ODM_SetBBReg(pDM_Odm, rOFDM0_XDTxAFE, bMaskH4Bits, value32); - - value32 = ((IqkResult_X * ele_D)>>7)&0x01; - ODM_SetBBReg(pDM_Odm, rOFDM0_ECCAThreshold, BIT28, value32); - - break; - default: - break; - } - } - else - { - switch (RFPath) - { - case RF_PATH_A: - ODM_SetBBReg(pDM_Odm, rOFDM0_XATxIQImbalance, bMaskDWord, OFDMSwingTable[OFDM_index]); - ODM_SetBBReg(pDM_Odm, rOFDM0_XCTxAFE, bMaskH4Bits, 0x00); - ODM_SetBBReg(pDM_Odm, rOFDM0_ECCAThreshold, BIT24, 0x00); - break; - - case RF_PATH_B: - ODM_SetBBReg(pDM_Odm, rOFDM0_XBTxIQImbalance, bMaskDWord, OFDMSwingTable[OFDM_index]); - ODM_SetBBReg(pDM_Odm, rOFDM0_XDTxAFE, bMaskH4Bits, 0x00); - ODM_SetBBReg(pDM_Odm, rOFDM0_ECCAThreshold, BIT28, 0x00); - break; - - default: - break; - } - } - - ODM_RT_TRACE(pDM_Odm,ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ("TxPwrTracking path B: X = 0x%x, Y = 0x%x ele_A = 0x%x ele_C = 0x%x ele_D = 0x%x 0xeb4 = 0x%x 0xebc = 0x%x\n", - (u4Byte)IqkResult_X, (u4Byte)IqkResult_Y, (u4Byte)ele_A, (u4Byte)ele_C, (u4Byte)ele_D, (u4Byte)IqkResult_X, (u4Byte)IqkResult_Y)); -} - - -void doIQK( - PDM_ODM_T pDM_Odm, - u1Byte DeltaThermalIndex, - u1Byte ThermalValue, - u1Byte Threshold - ) -{ -#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) - struct adapter * Adapter = pDM_Odm->Adapter; - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); -#endif - - ODM_ResetIQKResult(pDM_Odm); - -#if(DM_ODM_SUPPORT_TYPE & ODM_MP) -#if (DEV_BUS_TYPE == RT_PCI_INTERFACE) -#if USE_WORKITEM - PlatformAcquireMutex(&pHalData->mxChnlBwControl); -#else - PlatformAcquireSpinLock(Adapter, RT_CHANNEL_AND_BANDWIDTH_SPINLOCK); -#endif -#elif((DEV_BUS_TYPE == RT_USB_INTERFACE) || (DEV_BUS_TYPE == RT_SDIO_INTERFACE)) - PlatformAcquireMutex(&pHalData->mxChnlBwControl); -#endif -#endif - - - pDM_Odm->RFCalibrateInfo.ThermalValue_IQK= ThermalValue; - PHY_IQCalibrate_8188E(Adapter, FALSE); - - -#if(DM_ODM_SUPPORT_TYPE & ODM_MP) -#if (DEV_BUS_TYPE == RT_PCI_INTERFACE) -#if USE_WORKITEM - PlatformReleaseMutex(&pHalData->mxChnlBwControl); -#else - PlatformReleaseSpinLock(Adapter, RT_CHANNEL_AND_BANDWIDTH_SPINLOCK); -#endif -#elif((DEV_BUS_TYPE == RT_USB_INTERFACE) || (DEV_BUS_TYPE == RT_SDIO_INTERFACE)) - PlatformReleaseMutex(&pHalData->mxChnlBwControl); -#endif -#endif -} - -/*----------------------------------------------------------------------------- - * Function: ODM_TxPwrTrackAdjust88E() - * - * Overview: 88E we can not write 0xc80/c94/c4c/ 0xa2x. Instead of write TX agc. - * No matter OFDM & CCK use the same method. - * - * Input: NONE - * - * Output: NONE - * - * Return: NONE - * - * Revised History: - * When Who Remark - * 04/23/2012 MHC Create Version 0. - * 04/23/2012 MHC Adjust TX agc directly not throughput BB digital. - * - *---------------------------------------------------------------------------*/ -VOID -ODM_TxPwrTrackAdjust88E( - PDM_ODM_T pDM_Odm, - u1Byte Type, // 0 = OFDM, 1 = CCK - pu1Byte pDirection, // 1 = +(increase) 2 = -(decrease) - pu4Byte pOutWriteVal // Tx tracking CCK/OFDM BB swing index adjust - ) -{ - u1Byte pwr_value = 0; - // - // Tx power tracking BB swing table. - // The base index = 12. +((12-n)/2)dB 13~?? = decrease tx pwr by -((n-12)/2)dB - // - if (Type == 0) // For OFDM afjust - { - ODM_RT_TRACE(pDM_Odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, - ("BbSwingIdxOfdm = %d BbSwingFlagOfdm=%d\n", pDM_Odm->BbSwingIdxOfdm, pDM_Odm->BbSwingFlagOfdm)); - - //printk("BbSwingIdxOfdm = %d BbSwingFlagOfdm=%d\n", pDM_Odm->BbSwingIdxOfdm, pDM_Odm->BbSwingFlagOfdm); - if (pDM_Odm->BbSwingIdxOfdm <= pDM_Odm->BbSwingIdxOfdmBase) - { - *pDirection = 1; - pwr_value = (pDM_Odm->BbSwingIdxOfdmBase - pDM_Odm->BbSwingIdxOfdm); - } - else - { - *pDirection = 2; - pwr_value = (pDM_Odm->BbSwingIdxOfdm - pDM_Odm->BbSwingIdxOfdmBase); - } - - ODM_RT_TRACE(pDM_Odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, - ("BbSwingIdxOfdm = %d BbSwingIdxOfdmBase=%d\n", pDM_Odm->BbSwingIdxOfdm, pDM_Odm->BbSwingIdxOfdmBase)); - //printk("BbSwingIdxOfdm = %d BbSwingIdxOfdmBase=%d pwr_value=%d\n", pDM_Odm->BbSwingIdxOfdm, pDM_Odm->BbSwingIdxOfdmBase,pwr_value); - - } - else if (Type == 1) // For CCK adjust. - { - ODM_RT_TRACE(pDM_Odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, - ("pDM_Odm->BbSwingIdxCck = %d pDM_Odm->BbSwingIdxCckBase = %d\n", pDM_Odm->BbSwingIdxCck, pDM_Odm->BbSwingIdxCckBase)); - - //printk("pDM_Odm->BbSwingIdxCck = %d pDM_Odm->BbSwingIdxCckBase = %d\n", pDM_Odm->BbSwingIdxCck, pDM_Odm->BbSwingIdxCckBase); - if (pDM_Odm->BbSwingIdxCck <= pDM_Odm->BbSwingIdxCckBase) - { - *pDirection = 1; - pwr_value = (pDM_Odm->BbSwingIdxCckBase - pDM_Odm->BbSwingIdxCck); - } - else - { - *pDirection = 2; - pwr_value = (pDM_Odm->BbSwingIdxCck - pDM_Odm->BbSwingIdxCckBase); - } - //printk("pDM_Odm->BbSwingIdxCck = %d pDM_Odm->BbSwingIdxCckBase = %d pwr_value:%d\n", pDM_Odm->BbSwingIdxCck, pDM_Odm->BbSwingIdxCckBase,pwr_value); - } - - // - // 2012/04/25 MH According to Ed/Luke.Lees estimate for EVM the max tx power tracking - // need to be less than 6 power index for 88E. - // - if (pwr_value >= ODM_TXPWRTRACK_MAX_IDX_88E && *pDirection == 1) - pwr_value = ODM_TXPWRTRACK_MAX_IDX_88E; - - *pOutWriteVal = pwr_value | (pwr_value<<8) | (pwr_value<<16) | (pwr_value<<24); - -} // ODM_TxPwrTrackAdjust88E - - -/*----------------------------------------------------------------------------- - * Function: odm_TxPwrTrackSetPwr88E() - * - * Overview: 88E change all channel tx power accordign to flag. - * OFDM & CCK are all different. - * - * Input: NONE - * - * Output: NONE - * - * Return: NONE - * - * Revised History: - * When Who Remark - * 04/23/2012 MHC Create Version 0. - * - *---------------------------------------------------------------------------*/ -VOID -odm_TxPwrTrackSetPwr88E( - PDM_ODM_T pDM_Odm, - PWRTRACK_METHOD Method, - u1Byte RFPath, - u1Byte ChannelMappedIndex - ) -{ - if (Method == TXAGC) - { - u1Byte cckPowerLevel[MAX_TX_COUNT], ofdmPowerLevel[MAX_TX_COUNT]; - u1Byte BW20PowerLevel[MAX_TX_COUNT], BW40PowerLevel[MAX_TX_COUNT]; - u1Byte rf = 0; - u4Byte pwr = 0, TxAGC = 0; - struct adapter *Adapter = pDM_Odm->Adapter; - //printk("odm_TxPwrTrackSetPwr88E CH=%d, modify TXAGC \n", *(pDM_Odm->pChannel)); - ODM_RT_TRACE(pDM_Odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ("odm_TxPwrTrackSetPwr88E CH=%d\n", *(pDM_Odm->pChannel))); -#if (DM_ODM_SUPPORT_TYPE & (ODM_MP|ODM_CE )) - - //#if (MP_DRIVER != 1) - if ( *(pDM_Odm->mp_mode) != 1){ - PHY_SetTxPowerLevel8188E(pDM_Odm->Adapter, *pDM_Odm->pChannel); - } - else - //#else - { - pwr = PHY_QueryBBReg(Adapter, rTxAGC_A_Rate18_06, 0xFF); - pwr += (pDM_Odm->BbSwingIdxCck - pDM_Odm->BbSwingIdxCckBase); - PHY_SetBBReg(Adapter, rTxAGC_A_CCK1_Mcs32, bMaskByte1, pwr); - TxAGC = (pwr<<16)|(pwr<<8)|(pwr); - PHY_SetBBReg(Adapter, rTxAGC_B_CCK11_A_CCK2_11, 0xffffff00, TxAGC); - DBG_871X("ODM_TxPwrTrackSetPwr88E: CCK Tx-rf(A) Power = 0x%x\n", TxAGC); - - pwr = PHY_QueryBBReg(Adapter, rTxAGC_A_Rate18_06, 0xFF); - pwr += (pDM_Odm->BbSwingIdxOfdm - pDM_Odm->BbSwingIdxOfdmBase); - TxAGC |= ((pwr<<24)|(pwr<<16)|(pwr<<8)|pwr); - PHY_SetBBReg(Adapter, rTxAGC_A_Rate18_06, bMaskDWord, TxAGC); - PHY_SetBBReg(Adapter, rTxAGC_A_Rate54_24, bMaskDWord, TxAGC); - PHY_SetBBReg(Adapter, rTxAGC_A_Mcs03_Mcs00, bMaskDWord, TxAGC); - PHY_SetBBReg(Adapter, rTxAGC_A_Mcs07_Mcs04, bMaskDWord, TxAGC); - PHY_SetBBReg(Adapter, rTxAGC_A_Mcs11_Mcs08, bMaskDWord, TxAGC); - PHY_SetBBReg(Adapter, rTxAGC_A_Mcs15_Mcs12, bMaskDWord, TxAGC); - DBG_871X("ODM_TxPwrTrackSetPwr88E: OFDM Tx-rf(A) Power = 0x%x\n", TxAGC); - } - //#endif - -#endif -#if (DM_ODM_SUPPORT_TYPE & ODM_AP) - PHY_RF6052SetCCKTxPower(pDM_Odm->priv, *(pDM_Odm->pChannel)); - PHY_RF6052SetOFDMTxPower(pDM_Odm->priv, *(pDM_Odm->pChannel)); -#endif - - } - else if (Method == BBSWING) - { - //printk("odm_TxPwrTrackSetPwr88E CH=%d, modify BBSWING BbSwingIdxCck:%d \n", *(pDM_Odm->pChannel),pDM_Odm->BbSwingIdxCck); - // Adjust BB swing by CCK filter coefficient - //if(!pDM_Odm->RFCalibrateInfo.bCCKinCH14) - if(* (pDM_Odm->pChannel) < 14) - { - ODM_Write1Byte(pDM_Odm, 0xa22, CCKSwingTable_Ch1_Ch13[pDM_Odm->BbSwingIdxCck][0]); - ODM_Write1Byte(pDM_Odm, 0xa23, CCKSwingTable_Ch1_Ch13[pDM_Odm->BbSwingIdxCck][1]); - ODM_Write1Byte(pDM_Odm, 0xa24, CCKSwingTable_Ch1_Ch13[pDM_Odm->BbSwingIdxCck][2]); - ODM_Write1Byte(pDM_Odm, 0xa25, CCKSwingTable_Ch1_Ch13[pDM_Odm->BbSwingIdxCck][3]); - ODM_Write1Byte(pDM_Odm, 0xa26, CCKSwingTable_Ch1_Ch13[pDM_Odm->BbSwingIdxCck][4]); - ODM_Write1Byte(pDM_Odm, 0xa27, CCKSwingTable_Ch1_Ch13[pDM_Odm->BbSwingIdxCck][5]); - ODM_Write1Byte(pDM_Odm, 0xa28, CCKSwingTable_Ch1_Ch13[pDM_Odm->BbSwingIdxCck][6]); - ODM_Write1Byte(pDM_Odm, 0xa29, CCKSwingTable_Ch1_Ch13[pDM_Odm->BbSwingIdxCck][7]); - } - else - { - ODM_Write1Byte(pDM_Odm, 0xa22, CCKSwingTable_Ch14[pDM_Odm->BbSwingIdxCck][0]); - ODM_Write1Byte(pDM_Odm, 0xa23, CCKSwingTable_Ch14[pDM_Odm->BbSwingIdxCck][1]); - ODM_Write1Byte(pDM_Odm, 0xa24, CCKSwingTable_Ch14[pDM_Odm->BbSwingIdxCck][2]); - ODM_Write1Byte(pDM_Odm, 0xa25, CCKSwingTable_Ch14[pDM_Odm->BbSwingIdxCck][3]); - ODM_Write1Byte(pDM_Odm, 0xa26, CCKSwingTable_Ch14[pDM_Odm->BbSwingIdxCck][4]); - ODM_Write1Byte(pDM_Odm, 0xa27, CCKSwingTable_Ch14[pDM_Odm->BbSwingIdxCck][5]); - ODM_Write1Byte(pDM_Odm, 0xa28, CCKSwingTable_Ch14[pDM_Odm->BbSwingIdxCck][6]); - ODM_Write1Byte(pDM_Odm, 0xa29, CCKSwingTable_Ch14[pDM_Odm->BbSwingIdxCck][7]); - } - - // Adjust BB swing by OFDM IQ matrix - if (RFPath == RF_PATH_A) - { - setIqkMatrix(pDM_Odm, pDM_Odm->BbSwingIdxOfdm, RF_PATH_A, - pDM_Odm->RFCalibrateInfo.IQKMatrixRegSetting[ChannelMappedIndex].Value[0][0], - pDM_Odm->RFCalibrateInfo.IQKMatrixRegSetting[ChannelMappedIndex].Value[0][1]); - } - /* - else if (RFPath == RF_PATH_B) - { - setIqkMatrix(pDM_Odm, pDM_Odm->BbSwingIdxOfdm[RF_PATH_B], RF_PATH_B, - pDM_Odm->RFCalibrateInfo.IQKMatrixRegSetting[ChannelMappedIndex].Value[0][4], - pDM_Odm->RFCalibrateInfo.IQKMatrixRegSetting[ChannelMappedIndex].Value[0][5]); - }*/ - } - else - { - return; - } -} // odm_TxPwrTrackSetPwr88E - - -VOID -odm_TXPowerTrackingCallback_ThermalMeter_8188E( -#if (DM_ODM_SUPPORT_TYPE & ODM_AP) - IN PDM_ODM_T pDM_Odm -#else - IN struct adapter *Adapter -#endif - ) -{ - -#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); - //PMGNT_INFO pMgntInfo = &Adapter->MgntInfo; -#endif - - u1Byte ThermalValue = 0, delta, delta_LCK, delta_IQK, offset; - u1Byte ThermalValue_AVG_count = 0; - u4Byte ThermalValue_AVG = 0; - s4Byte ele_A=0, ele_D, TempCCk, X, value32; - s4Byte Y, ele_C=0; - s1Byte OFDM_index[2], CCK_index=0, OFDM_index_old[2]={0,0}, CCK_index_old=0, index; - s1Byte deltaPowerIndex = 0; - u4Byte i = 0, j = 0; - BOOLEAN is2T = FALSE; - BOOLEAN bInteralPA = FALSE; - - u1Byte OFDM_min_index = 6, rf = (is2T) ? 2 : 1; //OFDM BB Swing should be less than +3.0dB, which is required by Arthur - u1Byte Indexforchannel = 0;/*GetRightChnlPlaceforIQK(pHalData->CurrentChannel)*/ - enum _POWER_DEC_INC { POWER_DEC, POWER_INC }; - #if (DM_ODM_SUPPORT_TYPE == ODM_CE) - PDM_ODM_T pDM_Odm = &pHalData->odmpriv; - struct dm_priv *pdmpriv = &pHalData->dmpriv; - #endif - #if (DM_ODM_SUPPORT_TYPE == ODM_MP) - PDM_ODM_T pDM_Odm = &pHalData->DM_OutSrc; - #endif - - //4 0.1 The following TWO tables decide the final index of OFDM/CCK swing table. - s1Byte deltaSwingTableIdx[2][index_mapping_NUM_88E] = { - // {{Power decreasing(lower temperature)}, {Power increasing(higher temperature)}} - {0,0,2,3,4,4,5,6,7,7,8,9,10,10,11}, {0,0,-1,-2,-3,-4,-4,-4,-4,-5,-7,-8,-9,-9,-10} - }; - u1Byte thermalThreshold[2][index_mapping_NUM_88E]={ - // {{Power decreasing(lower temperature)}, {Power increasing(higher temperature)}} - {0,2,4,6,8,10,12,14,16,18,20,22,24,26,27}, {0,2,4,6,8,10,12,14,16,18,20,22,25,25,25} - }; - - //4 0.1 Initilization ( 7 steps in total ) - - pDM_Odm->RFCalibrateInfo.TXPowerTrackingCallbackCnt++; //cosa add for debug - pDM_Odm->RFCalibrateInfo.bTXPowerTrackingInit = TRUE; - -#if (MP_DRIVER == 1) -#if (DM_ODM_SUPPORT_TYPE == ODM_MP) - pDM_Odm->RFCalibrateInfo.TxPowerTrackControl = pHalData->TxPowerTrackControl; // We should keep updating the control variable according to HalData. -#endif - // RFCalibrateInfo.RegA24 will be initialized when ODM HW configuring, but MP configures with para files. - pDM_Odm->RFCalibrateInfo.RegA24 = 0x090e1317; -#endif - - ODM_RT_TRACE(pDM_Odm,ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,("===>odm_TXPowerTrackingCallback_ThermalMeter_8188E, pDM_Odm->BbSwingIdxCckBase: %d, pDM_Odm->BbSwingIdxOfdmBase: %d \n", pDM_Odm->BbSwingIdxCckBase, pDM_Odm->BbSwingIdxOfdmBase)); - ThermalValue = (u1Byte)ODM_GetRFReg(pDM_Odm, RF_PATH_A, RF_T_METER_88E, 0xfc00); //0x42: RF Reg[15:10] 88E - if( ! ThermalValue || ! pDM_Odm->RFCalibrateInfo.TxPowerTrackControl) - return; - - //4 3. Initialize ThermalValues of RFCalibrateInfo - - if( ! pDM_Odm->RFCalibrateInfo.ThermalValue) - { - pDM_Odm->RFCalibrateInfo.ThermalValue_LCK = ThermalValue; - pDM_Odm->RFCalibrateInfo.ThermalValue_IQK = ThermalValue; - } - - if(pDM_Odm->RFCalibrateInfo.bReloadtxpowerindex) - { - ODM_RT_TRACE(pDM_Odm,ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,("reload ofdm index for band switch\n")); - } - - //4 4. Calculate average thermal meter - - pDM_Odm->RFCalibrateInfo.ThermalValue_AVG[pDM_Odm->RFCalibrateInfo.ThermalValue_AVG_index] = ThermalValue; - pDM_Odm->RFCalibrateInfo.ThermalValue_AVG_index++; - if(pDM_Odm->RFCalibrateInfo.ThermalValue_AVG_index == AVG_THERMAL_NUM_88E) - pDM_Odm->RFCalibrateInfo.ThermalValue_AVG_index = 0; - - for(i = 0; i < AVG_THERMAL_NUM_88E; i++) - { - if(pDM_Odm->RFCalibrateInfo.ThermalValue_AVG[i]) - { - ThermalValue_AVG += pDM_Odm->RFCalibrateInfo.ThermalValue_AVG[i]; - ThermalValue_AVG_count++; - } - } - - if(ThermalValue_AVG_count) - { - ThermalValue = (u1Byte)(ThermalValue_AVG / ThermalValue_AVG_count); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,("AVG Thermal Meter = 0x%x \n", ThermalValue)); - } - - //4 5. Calculate delta, delta_LCK, delta_IQK. - - delta = (ThermalValue > pDM_Odm->RFCalibrateInfo.ThermalValue)?(ThermalValue - pDM_Odm->RFCalibrateInfo.ThermalValue):(pDM_Odm->RFCalibrateInfo.ThermalValue - ThermalValue); - delta_LCK = (ThermalValue > pDM_Odm->RFCalibrateInfo.ThermalValue_LCK)?(ThermalValue - pDM_Odm->RFCalibrateInfo.ThermalValue_LCK):(pDM_Odm->RFCalibrateInfo.ThermalValue_LCK - ThermalValue); - delta_IQK = (ThermalValue > pDM_Odm->RFCalibrateInfo.ThermalValue_IQK)?(ThermalValue - pDM_Odm->RFCalibrateInfo.ThermalValue_IQK):(pDM_Odm->RFCalibrateInfo.ThermalValue_IQK - ThermalValue); - - //4 6. If necessary, do LCK. - - //if((delta_LCK > pHalData->Delta_LCK) && (pHalData->Delta_LCK != 0)) - if ((delta_LCK >= 8)) // Delta temperature is equal to or larger than 20 centigrade. - { - pDM_Odm->RFCalibrateInfo.ThermalValue_LCK = ThermalValue; -#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) - PHY_LCCalibrate_8188E(Adapter); -#else - PHY_LCCalibrate_8188E(pDM_Odm); -#endif - } - - //3 7. If necessary, move the index of swing table to adjust Tx power. - - if (delta > 0 && pDM_Odm->RFCalibrateInfo.TxPowerTrackControl) - { -#if (DM_ODM_SUPPORT_TYPE & (ODM_MP|ODM_CE)) - delta = ThermalValue > pHalData->EEPROMThermalMeter?(ThermalValue - pHalData->EEPROMThermalMeter):(pHalData->EEPROMThermalMeter - ThermalValue); -#else - delta = (ThermalValue > pDM_Odm->priv->pmib->dot11RFEntry.ther)?(ThermalValue - pDM_Odm->priv->pmib->dot11RFEntry.ther):(pDM_Odm->priv->pmib->dot11RFEntry.ther - ThermalValue); -#endif - - - //4 7.1 The Final Power Index = BaseIndex + PowerIndexOffset - -#if (DM_ODM_SUPPORT_TYPE & (ODM_MP|ODM_CE)) - if(ThermalValue > pHalData->EEPROMThermalMeter) { -#else - if(ThermalValue > pDM_Odm->priv->pmib->dot11RFEntry.ther) { -#endif - CALCULATE_SWINGTALBE_OFFSET(offset, POWER_INC, index_mapping_NUM_88E, delta); - pDM_Odm->RFCalibrateInfo.DeltaPowerIndexLast = pDM_Odm->RFCalibrateInfo.DeltaPowerIndex; - pDM_Odm->RFCalibrateInfo.DeltaPowerIndex = -1 * deltaSwingTableIdx[POWER_INC][offset]; - - } else { - - CALCULATE_SWINGTALBE_OFFSET(offset, POWER_DEC, index_mapping_NUM_88E, delta); - pDM_Odm->RFCalibrateInfo.DeltaPowerIndexLast = pDM_Odm->RFCalibrateInfo.DeltaPowerIndex; - pDM_Odm->RFCalibrateInfo.DeltaPowerIndex = -1 * deltaSwingTableIdx[POWER_DEC][offset]; - } - - if (pDM_Odm->RFCalibrateInfo.DeltaPowerIndex == pDM_Odm->RFCalibrateInfo.DeltaPowerIndexLast) - pDM_Odm->RFCalibrateInfo.PowerIndexOffset = 0; - else - pDM_Odm->RFCalibrateInfo.PowerIndexOffset = pDM_Odm->RFCalibrateInfo.DeltaPowerIndex - pDM_Odm->RFCalibrateInfo.DeltaPowerIndexLast; - - for(i = 0; i < rf; i++) - pDM_Odm->RFCalibrateInfo.OFDM_index[i] = pDM_Odm->BbSwingIdxOfdmBase + pDM_Odm->RFCalibrateInfo.PowerIndexOffset; - pDM_Odm->RFCalibrateInfo.CCK_index = pDM_Odm->BbSwingIdxCckBase + pDM_Odm->RFCalibrateInfo.PowerIndexOffset; - - pDM_Odm->BbSwingIdxCck = pDM_Odm->RFCalibrateInfo.CCK_index; - pDM_Odm->BbSwingIdxOfdm = pDM_Odm->RFCalibrateInfo.OFDM_index[RF_PATH_A]; - - ODM_RT_TRACE(pDM_Odm,ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,("The 'CCK' final index(%d) = BaseIndex(%d) + PowerIndexOffset(%d)\n", pDM_Odm->BbSwingIdxCck, pDM_Odm->BbSwingIdxCckBase, pDM_Odm->RFCalibrateInfo.PowerIndexOffset)); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,("The 'OFDM' final index(%d) = BaseIndex(%d) + PowerIndexOffset(%d)\n", pDM_Odm->BbSwingIdxOfdm, pDM_Odm->BbSwingIdxOfdmBase, pDM_Odm->RFCalibrateInfo.PowerIndexOffset)); - - //4 7.1 Handle boundary conditions of index. - - - for(i = 0; i < rf; i++) - { - if(pDM_Odm->RFCalibrateInfo.OFDM_index[i] > OFDM_TABLE_SIZE_92D-1) - { - pDM_Odm->RFCalibrateInfo.OFDM_index[i] = OFDM_TABLE_SIZE_92D-1; - } - else if (pDM_Odm->RFCalibrateInfo.OFDM_index[i] < OFDM_min_index) - { - pDM_Odm->RFCalibrateInfo.OFDM_index[i] = OFDM_min_index; - } - } - - if(pDM_Odm->RFCalibrateInfo.CCK_index > CCK_TABLE_SIZE-1) - pDM_Odm->RFCalibrateInfo.CCK_index = CCK_TABLE_SIZE-1; - else if (pDM_Odm->RFCalibrateInfo.CCK_index < 0) - pDM_Odm->RFCalibrateInfo.CCK_index = 0; - } - else - { - ODM_RT_TRACE(pDM_Odm,ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, - ("The thermal meter is unchanged or TxPowerTracking OFF: ThermalValue: %d , pDM_Odm->RFCalibrateInfo.ThermalValue: %d)\n", ThermalValue, pDM_Odm->RFCalibrateInfo.ThermalValue)); - pDM_Odm->RFCalibrateInfo.PowerIndexOffset = 0; - } - ODM_RT_TRACE(pDM_Odm,ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, - ("TxPowerTracking: [CCK] Swing Current Index: %d, Swing Base Index: %d\n", pDM_Odm->RFCalibrateInfo.CCK_index, pDM_Odm->BbSwingIdxCckBase)); - - ODM_RT_TRACE(pDM_Odm,ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, - ("TxPowerTracking: [OFDM] Swing Current Index: %d, Swing Base Index: %d\n", pDM_Odm->RFCalibrateInfo.OFDM_index[RF_PATH_A], pDM_Odm->BbSwingIdxOfdmBase)); - - if (pDM_Odm->RFCalibrateInfo.PowerIndexOffset != 0 && pDM_Odm->RFCalibrateInfo.TxPowerTrackControl) - { - //4 7.2 Configure the Swing Table to adjust Tx Power. - - pDM_Odm->RFCalibrateInfo.bTxPowerChanged = TRUE; // Always TRUE after Tx Power is adjusted by power tracking. - // - // 2012/04/23 MH According to Luke's suggestion, we can not write BB digital - // to increase TX power. Otherwise, EVM will be bad. - // - // 2012/04/25 MH Add for tx power tracking to set tx power in tx agc for 88E. - if (ThermalValue > pDM_Odm->RFCalibrateInfo.ThermalValue) - { - ODM_RT_TRACE(pDM_Odm,ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, - ("Temperature Increasing: delta_pi: %d , delta_t: %d, Now_t: %d, EFUSE_t: %d, Last_t: %d\n", - pDM_Odm->RFCalibrateInfo.PowerIndexOffset, delta, ThermalValue, pHalData->EEPROMThermalMeter, pDM_Odm->RFCalibrateInfo.ThermalValue)); - } - else if (ThermalValue < pDM_Odm->RFCalibrateInfo.ThermalValue)// Low temperature - { - ODM_RT_TRACE(pDM_Odm,ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, - ("Temperature Decreasing: delta_pi: %d , delta_t: %d, Now_t: %d, EFUSE_t: %d, Last_t: %d\n", - pDM_Odm->RFCalibrateInfo.PowerIndexOffset, delta, ThermalValue, pHalData->EEPROMThermalMeter, pDM_Odm->RFCalibrateInfo.ThermalValue)); - } - - if (ThermalValue > pHalData->EEPROMThermalMeter) - { - ODM_RT_TRACE(pDM_Odm,ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,("Temperature(%d) hugher than PG value(%d), increases the power by TxAGC\n", ThermalValue, pHalData->EEPROMThermalMeter)); - odm_TxPwrTrackSetPwr88E(pDM_Odm, TXAGC, 0, 0); - } - else - { - ODM_RT_TRACE(pDM_Odm,ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,("Temperature(%d) lower than PG value(%d), increases the power by TxAGC\n", ThermalValue, pHalData->EEPROMThermalMeter)); - odm_TxPwrTrackSetPwr88E(pDM_Odm, BBSWING, RF_PATH_A, Indexforchannel); - //if(is2T) - // odm_TxPwrTrackSetPwr88E(pDM_Odm, BBSWING, RF_PATH_B, Indexforchannel); - } - - pDM_Odm->BbSwingIdxCckBase = pDM_Odm->BbSwingIdxCck; - pDM_Odm->BbSwingIdxOfdmBase = pDM_Odm->BbSwingIdxOfdm; - pDM_Odm->RFCalibrateInfo.ThermalValue = ThermalValue; - - } - -#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) - // if((delta_IQK > pHalData->Delta_IQK) && (pHalData->Delta_IQK != 0)) - if ((delta_IQK >= 8)){ // Delta temperature is equal to or larger than 20 centigrade. - //printk("delta_IQK(%d) >=8 do_IQK\n",delta_IQK); - doIQK(pDM_Odm, delta_IQK, ThermalValue, 8); - } -#endif - - ODM_RT_TRACE(pDM_Odm,ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,("<===dm_TXPowerTrackingCallback_ThermalMeter_8188E\n")); - - pDM_Odm->RFCalibrateInfo.TXPowercount = 0; -} - - - - - - -//1 7. IQK -#define MAX_TOLERANCE 5 -#define IQK_DELAY_TIME 1 //ms - -u1Byte //bit0 = 1 => Tx OK, bit1 = 1 => Rx OK -phy_PathA_IQK_8188E( -#if (DM_ODM_SUPPORT_TYPE & ODM_AP) - IN PDM_ODM_T pDM_Odm, -#else - IN struct adapter *pAdapter, -#endif - IN BOOLEAN configPathB - ) -{ - u4Byte regEAC, regE94, regE9C, regEA4; - u1Byte result = 0x00; -#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter); - #if (DM_ODM_SUPPORT_TYPE == ODM_CE) - PDM_ODM_T pDM_Odm = &pHalData->odmpriv; - #endif - #if (DM_ODM_SUPPORT_TYPE == ODM_MP) - PDM_ODM_T pDM_Odm = &pHalData->DM_OutSrc; - #endif -#endif - ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Path A IQK!\n")); - - //1 Tx IQK - //path-A IQK setting - ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Path-A IQK setting!\n")); - ODM_SetBBReg(pDM_Odm, rTx_IQK_Tone_A, bMaskDWord, 0x10008c1c); - ODM_SetBBReg(pDM_Odm, rRx_IQK_Tone_A, bMaskDWord, 0x30008c1c); - ODM_SetBBReg(pDM_Odm, rTx_IQK_PI_A, bMaskDWord, 0x8214032a); - ODM_SetBBReg(pDM_Odm, rRx_IQK_PI_A, bMaskDWord, 0x28160000); - - //LO calibration setting - ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("LO calibration setting!\n")); - ODM_SetBBReg(pDM_Odm, rIQK_AGC_Rsp, bMaskDWord, 0x00462911); - - //One shot, path A LOK & IQK - ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("One shot, path A LOK & IQK!\n")); - ODM_SetBBReg(pDM_Odm, rIQK_AGC_Pts, bMaskDWord, 0xf9000000); - ODM_SetBBReg(pDM_Odm, rIQK_AGC_Pts, bMaskDWord, 0xf8000000); - - // delay x ms - ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Delay %d ms for One shot, path A LOK & IQK.\n", IQK_DELAY_TIME_88E)); - //PlatformStallExecution(IQK_DELAY_TIME_88E*1000); - ODM_delay_ms(IQK_DELAY_TIME_88E); - - // Check failed - regEAC = ODM_GetBBReg(pDM_Odm, rRx_Power_After_IQK_A_2, bMaskDWord); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("0xeac = 0x%x\n", regEAC)); - regE94 = ODM_GetBBReg(pDM_Odm, rTx_Power_Before_IQK_A, bMaskDWord); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("0xe94 = 0x%x\n", regE94)); - regE9C= ODM_GetBBReg(pDM_Odm, rTx_Power_After_IQK_A, bMaskDWord); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("0xe9c = 0x%x\n", regE9C)); - regEA4= ODM_GetBBReg(pDM_Odm, rRx_Power_Before_IQK_A_2, bMaskDWord); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("0xea4 = 0x%x\n", regEA4)); - - if(!(regEAC & BIT28) && - (((regE94 & 0x03FF0000)>>16) != 0x142) && - (((regE9C & 0x03FF0000)>>16) != 0x42) ) - result |= 0x01; - else //if Tx not OK, ignore Rx - return result; - -#if 0 - if(!(regEAC & BIT27) && //if Tx is OK, check whether Rx is OK - (((regEA4 & 0x03FF0000)>>16) != 0x132) && - (((regEAC & 0x03FF0000)>>16) != 0x36)) - result |= 0x02; - else - RTPRINT(FINIT, INIT_IQK, ("Path A Rx IQK fail!!\n")); -#endif - - return result; - - - } - -u1Byte //bit0 = 1 => Tx OK, bit1 = 1 => Rx OK -phy_PathA_RxIQK( -#if (DM_ODM_SUPPORT_TYPE & ODM_AP) - IN PDM_ODM_T pDM_Odm, -#else - IN struct adapter *pAdapter, -#endif - IN BOOLEAN configPathB - ) -{ - u4Byte regEAC, regE94, regE9C, regEA4, u4tmp; - u1Byte result = 0x00; -#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter); - #if (DM_ODM_SUPPORT_TYPE == ODM_CE) - PDM_ODM_T pDM_Odm = &pHalData->odmpriv; - #endif - #if (DM_ODM_SUPPORT_TYPE == ODM_MP) - PDM_ODM_T pDM_Odm = &pHalData->DM_OutSrc; - #endif -#endif - ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Path A Rx IQK!\n")); - - //1 Get TXIMR setting - //modify RXIQK mode table - ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Path-A Rx IQK modify RXIQK mode table!\n")); - ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, bMaskDWord, 0x00000000); - ODM_SetRFReg(pDM_Odm, RF_PATH_A, RF_WE_LUT, bRFRegOffsetMask, 0x800a0 ); - ODM_SetRFReg(pDM_Odm, RF_PATH_A, RF_RCK_OS, bRFRegOffsetMask, 0x30000 ); - ODM_SetRFReg(pDM_Odm, RF_PATH_A, RF_TXPA_G1, bRFRegOffsetMask, 0x0000f ); - ODM_SetRFReg(pDM_Odm, RF_PATH_A, RF_TXPA_G2, bRFRegOffsetMask, 0xf117B ); - - //PA,PAD off - ODM_SetRFReg(pDM_Odm, RF_PATH_A, 0xdf, bRFRegOffsetMask, 0x980 ); - ODM_SetRFReg(pDM_Odm, RF_PATH_A, 0x56, bRFRegOffsetMask, 0x51000 ); - - ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, bMaskDWord, 0x80800000); - - //IQK setting - ODM_SetBBReg(pDM_Odm, rTx_IQK, bMaskDWord, 0x01007c00); - ODM_SetBBReg(pDM_Odm, rRx_IQK, bMaskDWord, 0x81004800); - - //path-A IQK setting - ODM_SetBBReg(pDM_Odm, rTx_IQK_Tone_A, bMaskDWord, 0x10008c1c); - ODM_SetBBReg(pDM_Odm, rRx_IQK_Tone_A, bMaskDWord, 0x30008c1c); - ODM_SetBBReg(pDM_Odm, rTx_IQK_PI_A, bMaskDWord, 0x82160c1f); - ODM_SetBBReg(pDM_Odm, rRx_IQK_PI_A, bMaskDWord, 0x28160000); - - //LO calibration setting - ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("LO calibration setting!\n")); - ODM_SetBBReg(pDM_Odm, rIQK_AGC_Rsp, bMaskDWord, 0x0046a911); - - //One shot, path A LOK & IQK - ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("One shot, path A LOK & IQK!\n")); - ODM_SetBBReg(pDM_Odm, rIQK_AGC_Pts, bMaskDWord, 0xf9000000); - ODM_SetBBReg(pDM_Odm, rIQK_AGC_Pts, bMaskDWord, 0xf8000000); - - // delay x ms - ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Delay %d ms for One shot, path A LOK & IQK.\n", IQK_DELAY_TIME_88E)); - //PlatformStallExecution(IQK_DELAY_TIME_88E*1000); - ODM_delay_ms(IQK_DELAY_TIME_88E); - - - // Check failed - regEAC = ODM_GetBBReg(pDM_Odm, rRx_Power_After_IQK_A_2, bMaskDWord); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("0xeac = 0x%x\n", regEAC)); - regE94 = ODM_GetBBReg(pDM_Odm, rTx_Power_Before_IQK_A, bMaskDWord); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("0xe94 = 0x%x\n", regE94)); - regE9C= ODM_GetBBReg(pDM_Odm, rTx_Power_After_IQK_A, bMaskDWord); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("0xe9c = 0x%x\n", regE9C)); - - if(!(regEAC & BIT28) && - (((regE94 & 0x03FF0000)>>16) != 0x142) && - (((regE9C & 0x03FF0000)>>16) != 0x42) ) - { - result |= 0x01; - } - else - { - //reload RF 0xdf - ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, bMaskDWord, 0x00000000); - ODM_SetRFReg(pDM_Odm, RF_PATH_A, 0xdf, bRFRegOffsetMask, 0x180 );//if Tx not OK, ignore Rx - return result; - } - - u4tmp = 0x80007C00 | (regE94&0x3FF0000) | ((regE9C&0x3FF0000) >> 16); - ODM_SetBBReg(pDM_Odm, rTx_IQK, bMaskDWord, u4tmp); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("0xe40 = 0x%x u4tmp = 0x%x \n", ODM_GetBBReg(pDM_Odm, rTx_IQK, bMaskDWord), u4tmp)); - - - //1 RX IQK - //modify RXIQK mode table - ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Path-A Rx IQK modify RXIQK mode table 2!\n")); - ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, bMaskDWord, 0x00000000); - ODM_SetRFReg(pDM_Odm, RF_PATH_A, RF_WE_LUT, bRFRegOffsetMask, 0x800a0 ); - ODM_SetRFReg(pDM_Odm, RF_PATH_A, RF_RCK_OS, bRFRegOffsetMask, 0x30000 ); - ODM_SetRFReg(pDM_Odm, RF_PATH_A, RF_TXPA_G1, bRFRegOffsetMask, 0x0000f ); - ODM_SetRFReg(pDM_Odm, RF_PATH_A, RF_TXPA_G2, bRFRegOffsetMask, 0xf7ffa ); - ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, bMaskDWord, 0x80800000); - - //IQK setting - ODM_SetBBReg(pDM_Odm, rRx_IQK, bMaskDWord, 0x01004800); - - //path-A IQK setting - ODM_SetBBReg(pDM_Odm, rTx_IQK_Tone_A, bMaskDWord, 0x38008c1c); - ODM_SetBBReg(pDM_Odm, rRx_IQK_Tone_A, bMaskDWord, 0x18008c1c); - ODM_SetBBReg(pDM_Odm, rTx_IQK_PI_A, bMaskDWord, 0x82160c05); - ODM_SetBBReg(pDM_Odm, rRx_IQK_PI_A, bMaskDWord, 0x28160c1f); - - //LO calibration setting - ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("LO calibration setting!\n")); - ODM_SetBBReg(pDM_Odm, rIQK_AGC_Rsp, bMaskDWord, 0x0046a911); - - //One shot, path A LOK & IQK - ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("One shot, path A LOK & IQK!\n")); - ODM_SetBBReg(pDM_Odm, rIQK_AGC_Pts, bMaskDWord, 0xf9000000); - ODM_SetBBReg(pDM_Odm, rIQK_AGC_Pts, bMaskDWord, 0xf8000000); - - // delay x ms - ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Delay %d ms for One shot, path A LOK & IQK.\n", IQK_DELAY_TIME_88E)); - //PlatformStallExecution(IQK_DELAY_TIME_88E*1000); - ODM_delay_ms(IQK_DELAY_TIME_88E); - - - // Check failed - regEAC = ODM_GetBBReg(pDM_Odm, rRx_Power_After_IQK_A_2, bMaskDWord); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("0xeac = 0x%x\n", regEAC)); - regE94 = ODM_GetBBReg(pDM_Odm, rTx_Power_Before_IQK_A, bMaskDWord); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("0xe94 = 0x%x\n", regE94)); - regE9C= ODM_GetBBReg(pDM_Odm, rTx_Power_After_IQK_A, bMaskDWord); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("0xe9c = 0x%x\n", regE9C)); - regEA4= ODM_GetBBReg(pDM_Odm, rRx_Power_Before_IQK_A_2, bMaskDWord); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("0xea4 = 0x%x\n", regEA4)); - - //reload RF 0xdf - ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, bMaskDWord, 0x00000000); - ODM_SetRFReg(pDM_Odm, RF_PATH_A, 0xdf, bRFRegOffsetMask, 0x180 ); - -#if 0 - if(!(regEAC & BIT28) && - (((regE94 & 0x03FF0000)>>16) != 0x142) && - (((regE9C & 0x03FF0000)>>16) != 0x42) ) - result |= 0x01; - else //if Tx not OK, ignore Rx - return result; -#endif - - if(!(regEAC & BIT27) && //if Tx is OK, check whether Rx is OK - (((regEA4 & 0x03FF0000)>>16) != 0x132) && - (((regEAC & 0x03FF0000)>>16) != 0x36)) - result |= 0x02; - else - ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Path A Rx IQK fail!!\n")); - - return result; - - - - -} - -u1Byte //bit0 = 1 => Tx OK, bit1 = 1 => Rx OK -phy_PathB_IQK_8188E( -#if (DM_ODM_SUPPORT_TYPE & ODM_AP) - IN PDM_ODM_T pDM_Odm -#else - IN struct adapter *pAdapter -#endif - ) -{ - u4Byte regEAC, regEB4, regEBC, regEC4, regECC; - u1Byte result = 0x00; -#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter); - #if (DM_ODM_SUPPORT_TYPE == ODM_CE) - PDM_ODM_T pDM_Odm = &pHalData->odmpriv; - #endif - #if (DM_ODM_SUPPORT_TYPE == ODM_MP) - PDM_ODM_T pDM_Odm = &pHalData->DM_OutSrc; - #endif -#endif - ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Path B IQK!\n")); - - //One shot, path B LOK & IQK - ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("One shot, path A LOK & IQK!\n")); - ODM_SetBBReg(pDM_Odm, rIQK_AGC_Cont, bMaskDWord, 0x00000002); - ODM_SetBBReg(pDM_Odm, rIQK_AGC_Cont, bMaskDWord, 0x00000000); - - // delay x ms - ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Delay %d ms for One shot, path B LOK & IQK.\n", IQK_DELAY_TIME_88E)); - //PlatformStallExecution(IQK_DELAY_TIME_88E*1000); - ODM_delay_ms(IQK_DELAY_TIME_88E); - - // Check failed - regEAC = ODM_GetBBReg(pDM_Odm, rRx_Power_After_IQK_A_2, bMaskDWord); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("0xeac = 0x%x\n", regEAC)); - regEB4 = ODM_GetBBReg(pDM_Odm, rTx_Power_Before_IQK_B, bMaskDWord); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("0xeb4 = 0x%x\n", regEB4)); - regEBC= ODM_GetBBReg(pDM_Odm, rTx_Power_After_IQK_B, bMaskDWord); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("0xebc = 0x%x\n", regEBC)); - regEC4= ODM_GetBBReg(pDM_Odm, rRx_Power_Before_IQK_B_2, bMaskDWord); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("0xec4 = 0x%x\n", regEC4)); - regECC= ODM_GetBBReg(pDM_Odm, rRx_Power_After_IQK_B_2, bMaskDWord); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("0xecc = 0x%x\n", regECC)); - - if(!(regEAC & BIT31) && - (((regEB4 & 0x03FF0000)>>16) != 0x142) && - (((regEBC & 0x03FF0000)>>16) != 0x42)) - result |= 0x01; - else - return result; - - if(!(regEAC & BIT30) && - (((regEC4 & 0x03FF0000)>>16) != 0x132) && - (((regECC & 0x03FF0000)>>16) != 0x36)) - result |= 0x02; - else - ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Path B Rx IQK fail!!\n")); - - - return result; - -} - -VOID -_PHY_PathAFillIQKMatrix( -#if (DM_ODM_SUPPORT_TYPE & ODM_AP) - IN PDM_ODM_T pDM_Odm, -#else - IN struct adapter *pAdapter, -#endif - IN BOOLEAN bIQKOK, - IN s4Byte result[][8], - IN u1Byte final_candidate, - IN BOOLEAN bTxOnly - ) -{ - u4Byte Oldval_0, X, TX0_A, reg; - s4Byte Y, TX0_C; -#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter); - #if (DM_ODM_SUPPORT_TYPE == ODM_CE) - PDM_ODM_T pDM_Odm = &pHalData->odmpriv; - #endif - #if (DM_ODM_SUPPORT_TYPE == ODM_MP) - PDM_ODM_T pDM_Odm = &pHalData->DM_OutSrc; - #endif -#endif - ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Path A IQ Calibration %s !\n",(bIQKOK)?"Success":"Failed")); - - if(final_candidate == 0xFF) - return; - - else if(bIQKOK) - { - Oldval_0 = (ODM_GetBBReg(pDM_Odm, rOFDM0_XATxIQImbalance, bMaskDWord) >> 22) & 0x3FF; - - X = result[final_candidate][0]; - if ((X & 0x00000200) != 0) - X = X | 0xFFFFFC00; - TX0_A = (X * Oldval_0) >> 8; - ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("X = 0x%x, TX0_A = 0x%x, Oldval_0 0x%x\n", X, TX0_A, Oldval_0)); - ODM_SetBBReg(pDM_Odm, rOFDM0_XATxIQImbalance, 0x3FF, TX0_A); - - ODM_SetBBReg(pDM_Odm, rOFDM0_ECCAThreshold, BIT(31), ((X* Oldval_0>>7) & 0x1)); - - Y = result[final_candidate][1]; - if ((Y & 0x00000200) != 0) - Y = Y | 0xFFFFFC00; - - - TX0_C = (Y * Oldval_0) >> 8; - ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Y = 0x%x, TX = 0x%x\n", Y, TX0_C)); - ODM_SetBBReg(pDM_Odm, rOFDM0_XCTxAFE, 0xF0000000, ((TX0_C&0x3C0)>>6)); - ODM_SetBBReg(pDM_Odm, rOFDM0_XATxIQImbalance, 0x003F0000, (TX0_C&0x3F)); - - ODM_SetBBReg(pDM_Odm, rOFDM0_ECCAThreshold, BIT(29), ((Y* Oldval_0>>7) & 0x1)); - - if(bTxOnly) - { - ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("_PHY_PathAFillIQKMatrix only Tx OK\n")); - return; - } - - reg = result[final_candidate][2]; -#if (DM_ODM_SUPPORT_TYPE==ODM_AP) - if( RTL_ABS(reg ,0x100) >= 16) - reg = 0x100; -#endif - ODM_SetBBReg(pDM_Odm, rOFDM0_XARxIQImbalance, 0x3FF, reg); - - reg = result[final_candidate][3] & 0x3F; - ODM_SetBBReg(pDM_Odm, rOFDM0_XARxIQImbalance, 0xFC00, reg); - - reg = (result[final_candidate][3] >> 6) & 0xF; - ODM_SetBBReg(pDM_Odm, rOFDM0_RxIQExtAnta, 0xF0000000, reg); - } -} - -VOID -_PHY_PathBFillIQKMatrix( -#if (DM_ODM_SUPPORT_TYPE & ODM_AP) - IN PDM_ODM_T pDM_Odm, -#else - IN struct adapter *pAdapter, -#endif - IN BOOLEAN bIQKOK, - IN s4Byte result[][8], - IN u1Byte final_candidate, - IN BOOLEAN bTxOnly //do Tx only - ) -{ - u4Byte Oldval_1, X, TX1_A, reg; - s4Byte Y, TX1_C; -#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter); - #if (DM_ODM_SUPPORT_TYPE == ODM_CE) - PDM_ODM_T pDM_Odm = &pHalData->odmpriv; - #endif - #if (DM_ODM_SUPPORT_TYPE == ODM_MP) - PDM_ODM_T pDM_Odm = &pHalData->DM_OutSrc; - #endif -#endif - ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Path B IQ Calibration %s !\n",(bIQKOK)?"Success":"Failed")); - - if(final_candidate == 0xFF) - return; - - else if(bIQKOK) - { - Oldval_1 = (ODM_GetBBReg(pDM_Odm, rOFDM0_XBTxIQImbalance, bMaskDWord) >> 22) & 0x3FF; - - X = result[final_candidate][4]; - if ((X & 0x00000200) != 0) - X = X | 0xFFFFFC00; - TX1_A = (X * Oldval_1) >> 8; - ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("X = 0x%x, TX1_A = 0x%x\n", X, TX1_A)); - ODM_SetBBReg(pDM_Odm, rOFDM0_XBTxIQImbalance, 0x3FF, TX1_A); - - ODM_SetBBReg(pDM_Odm, rOFDM0_ECCAThreshold, BIT(27), ((X* Oldval_1>>7) & 0x1)); - - Y = result[final_candidate][5]; - if ((Y & 0x00000200) != 0) - Y = Y | 0xFFFFFC00; - - TX1_C = (Y * Oldval_1) >> 8; - ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Y = 0x%x, TX1_C = 0x%x\n", Y, TX1_C)); - ODM_SetBBReg(pDM_Odm, rOFDM0_XDTxAFE, 0xF0000000, ((TX1_C&0x3C0)>>6)); - ODM_SetBBReg(pDM_Odm, rOFDM0_XBTxIQImbalance, 0x003F0000, (TX1_C&0x3F)); - - ODM_SetBBReg(pDM_Odm, rOFDM0_ECCAThreshold, BIT(25), ((Y* Oldval_1>>7) & 0x1)); - - if(bTxOnly) - return; - - reg = result[final_candidate][6]; - ODM_SetBBReg(pDM_Odm, rOFDM0_XBRxIQImbalance, 0x3FF, reg); - - reg = result[final_candidate][7] & 0x3F; - ODM_SetBBReg(pDM_Odm, rOFDM0_XBRxIQImbalance, 0xFC00, reg); - - reg = (result[final_candidate][7] >> 6) & 0xF; - ODM_SetBBReg(pDM_Odm, rOFDM0_AGCRSSITable, 0x0000F000, reg); - } -} - -// -// 2011/07/26 MH Add an API for testing IQK fail case. -// -// MP Already declare in odm.c -#if !(DM_ODM_SUPPORT_TYPE & ODM_MP) -BOOLEAN -ODM_CheckPowerStatus( - IN struct adapter * Adapter) -{ -/* - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); - PDM_ODM_T pDM_Odm = &pHalData->DM_OutSrc; - RT_RF_POWER_STATE rtState; - PMGNT_INFO pMgntInfo = &(Adapter->MgntInfo); - - // 2011/07/27 MH We are not testing ready~~!! We may fail to get correct value when init sequence. - if (pMgntInfo->init_adpt_in_progress == TRUE) - { - ODM_RT_TRACE(pDM_Odm,COMP_INIT, DBG_LOUD, ("ODM_CheckPowerStatus Return TRUE, due to initadapter")); - return TRUE; - } - - // - // 2011/07/19 MH We can not execute tx pwoer tracking/ LLC calibrate or IQK. - // - Adapter->HalFunc.GetHwRegHandler(Adapter, HW_VAR_RF_STATE, (pu1Byte)(&rtState)); - if(Adapter->bDriverStopped || Adapter->bDriverIsGoingToPnpSetPowerSleep || rtState == eRfOff) - { - ODM_RT_TRACE(pDM_Odm,COMP_INIT, DBG_LOUD, ("ODM_CheckPowerStatus Return FALSE, due to %d/%d/%d\n", - Adapter->bDriverStopped, Adapter->bDriverIsGoingToPnpSetPowerSleep, rtState)); - return FALSE; - } -*/ - return TRUE; -} -#endif - -VOID -_PHY_SaveADDARegisters( -#if (DM_ODM_SUPPORT_TYPE & ODM_AP) - IN PDM_ODM_T pDM_Odm, -#else - IN struct adapter *pAdapter, -#endif - IN pu4Byte ADDAReg, - IN pu4Byte ADDABackup, - IN u4Byte RegisterNum - ) -{ - u4Byte i; -#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter); - #if (DM_ODM_SUPPORT_TYPE == ODM_CE) - PDM_ODM_T pDM_Odm = &pHalData->odmpriv; - #endif - #if (DM_ODM_SUPPORT_TYPE == ODM_MP) - PDM_ODM_T pDM_Odm = &pHalData->DM_OutSrc; - #endif - - if (ODM_CheckPowerStatus(pAdapter) == FALSE) - return; -#endif - - ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Save ADDA parameters.\n")); - for( i = 0 ; i < RegisterNum ; i++){ - ADDABackup[i] = ODM_GetBBReg(pDM_Odm, ADDAReg[i], bMaskDWord); - } -} - - -VOID -_PHY_SaveMACRegisters( -#if (DM_ODM_SUPPORT_TYPE & ODM_AP) - IN PDM_ODM_T pDM_Odm, -#else - IN struct adapter *pAdapter, -#endif - IN pu4Byte MACReg, - IN pu4Byte MACBackup - ) -{ - u4Byte i; -#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter); - #if (DM_ODM_SUPPORT_TYPE == ODM_CE) - PDM_ODM_T pDM_Odm = &pHalData->odmpriv; - #endif - #if (DM_ODM_SUPPORT_TYPE == ODM_MP) - PDM_ODM_T pDM_Odm = &pHalData->DM_OutSrc; - #endif -#endif - ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Save MAC parameters.\n")); - for( i = 0 ; i < (IQK_MAC_REG_NUM - 1); i++){ - MACBackup[i] = ODM_Read1Byte(pDM_Odm, MACReg[i]); - } - MACBackup[i] = ODM_Read4Byte(pDM_Odm, MACReg[i]); - -} - - -VOID -_PHY_ReloadADDARegisters( -#if (DM_ODM_SUPPORT_TYPE & ODM_AP) - IN PDM_ODM_T pDM_Odm, -#else - IN struct adapter *pAdapter, -#endif - IN pu4Byte ADDAReg, - IN pu4Byte ADDABackup, - IN u4Byte RegiesterNum - ) -{ - u4Byte i; -#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter); - #if (DM_ODM_SUPPORT_TYPE == ODM_CE) - PDM_ODM_T pDM_Odm = &pHalData->odmpriv; - #endif - #if (DM_ODM_SUPPORT_TYPE == ODM_MP) - PDM_ODM_T pDM_Odm = &pHalData->DM_OutSrc; - #endif -#endif - - ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Reload ADDA power saving parameters !\n")); - for(i = 0 ; i < RegiesterNum; i++) - { - ODM_SetBBReg(pDM_Odm, ADDAReg[i], bMaskDWord, ADDABackup[i]); - } -} - -VOID -_PHY_ReloadMACRegisters( -#if (DM_ODM_SUPPORT_TYPE & ODM_AP) - IN PDM_ODM_T pDM_Odm, -#else - IN struct adapter *pAdapter, -#endif - IN pu4Byte MACReg, - IN pu4Byte MACBackup - ) -{ - u4Byte i; -#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter); - #if (DM_ODM_SUPPORT_TYPE == ODM_CE) - PDM_ODM_T pDM_Odm = &pHalData->odmpriv; - #endif - #if (DM_ODM_SUPPORT_TYPE == ODM_MP) - PDM_ODM_T pDM_Odm = &pHalData->DM_OutSrc; - #endif -#endif - ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Reload MAC parameters !\n")); - for(i = 0 ; i < (IQK_MAC_REG_NUM - 1); i++){ - ODM_Write1Byte(pDM_Odm, MACReg[i], (u1Byte)MACBackup[i]); - } - ODM_Write4Byte(pDM_Odm, MACReg[i], MACBackup[i]); -} - - -VOID -_PHY_PathADDAOn( -#if (DM_ODM_SUPPORT_TYPE & ODM_AP) - IN PDM_ODM_T pDM_Odm, -#else - IN struct adapter *pAdapter, -#endif - IN pu4Byte ADDAReg, - IN BOOLEAN isPathAOn, - IN BOOLEAN is2T - ) -{ - u4Byte pathOn; - u4Byte i; -#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter); - #if (DM_ODM_SUPPORT_TYPE == ODM_CE) - PDM_ODM_T pDM_Odm = &pHalData->odmpriv; - #endif - #if (DM_ODM_SUPPORT_TYPE == ODM_MP) - PDM_ODM_T pDM_Odm = &pHalData->DM_OutSrc; - #endif -#endif - ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("ADDA ON.\n")); - - pathOn = isPathAOn ? 0x04db25a4 : 0x0b1b25a4; - if(FALSE == is2T){ - pathOn = 0x0bdb25a0; - ODM_SetBBReg(pDM_Odm, ADDAReg[0], bMaskDWord, 0x0b1b25a0); - } - else{ - ODM_SetBBReg(pDM_Odm,ADDAReg[0], bMaskDWord, pathOn); - } - - for( i = 1 ; i < IQK_ADDA_REG_NUM ; i++){ - ODM_SetBBReg(pDM_Odm,ADDAReg[i], bMaskDWord, pathOn); - } - -} - -VOID -_PHY_MACSettingCalibration( -#if (DM_ODM_SUPPORT_TYPE & ODM_AP) - IN PDM_ODM_T pDM_Odm, -#else - IN struct adapter *pAdapter, -#endif - IN pu4Byte MACReg, - IN pu4Byte MACBackup - ) -{ - u4Byte i = 0; -#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter); - #if (DM_ODM_SUPPORT_TYPE == ODM_CE) - PDM_ODM_T pDM_Odm = &pHalData->odmpriv; - #endif - #if (DM_ODM_SUPPORT_TYPE == ODM_MP) - PDM_ODM_T pDM_Odm = &pHalData->DM_OutSrc; - #endif -#endif - ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("MAC settings for Calibration.\n")); - - ODM_Write1Byte(pDM_Odm, MACReg[i], 0x3F); - - for(i = 1 ; i < (IQK_MAC_REG_NUM - 1); i++){ - ODM_Write1Byte(pDM_Odm, MACReg[i], (u1Byte)(MACBackup[i]&(~BIT3))); - } - ODM_Write1Byte(pDM_Odm, MACReg[i], (u1Byte)(MACBackup[i]&(~BIT5))); - -} - -VOID -_PHY_PathAStandBy( -#if (DM_ODM_SUPPORT_TYPE & ODM_AP) - IN PDM_ODM_T pDM_Odm -#else - IN struct adapter *pAdapter -#endif - ) -{ -#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter); - #if (DM_ODM_SUPPORT_TYPE == ODM_CE) - PDM_ODM_T pDM_Odm = &pHalData->odmpriv; - #endif - #if (DM_ODM_SUPPORT_TYPE == ODM_MP) - PDM_ODM_T pDM_Odm = &pHalData->DM_OutSrc; - #endif -#endif - ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Path-A standby mode!\n")); - - ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, bMaskDWord, 0x0); - ODM_SetBBReg(pDM_Odm, 0x840, bMaskDWord, 0x00010000); - ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, bMaskDWord, 0x80800000); -} - -VOID -_PHY_PIModeSwitch( -#if (DM_ODM_SUPPORT_TYPE & ODM_AP) - IN PDM_ODM_T pDM_Odm, -#else - IN struct adapter *pAdapter, -#endif - IN BOOLEAN PIMode - ) -{ - u4Byte mode; -#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter); - #if (DM_ODM_SUPPORT_TYPE == ODM_CE) - PDM_ODM_T pDM_Odm = &pHalData->odmpriv; - #endif - #if (DM_ODM_SUPPORT_TYPE == ODM_MP) - PDM_ODM_T pDM_Odm = &pHalData->DM_OutSrc; - #endif -#endif - ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("BB Switch to %s mode!\n", (PIMode ? "PI" : "SI"))); - - mode = PIMode ? 0x01000100 : 0x01000000; - ODM_SetBBReg(pDM_Odm, rFPGA0_XA_HSSIParameter1, bMaskDWord, mode); - ODM_SetBBReg(pDM_Odm, rFPGA0_XB_HSSIParameter1, bMaskDWord, mode); -} - -BOOLEAN -phy_SimularityCompare_8188E( -#if (DM_ODM_SUPPORT_TYPE & ODM_AP) - IN PDM_ODM_T pDM_Odm, -#else - IN struct adapter *pAdapter, -#endif - IN s4Byte result[][8], - IN u1Byte c1, - IN u1Byte c2 - ) -{ - u4Byte i, j, diff, SimularityBitMap, bound = 0; -#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter); - #if (DM_ODM_SUPPORT_TYPE == ODM_CE) - PDM_ODM_T pDM_Odm = &pHalData->odmpriv; - #endif - #if (DM_ODM_SUPPORT_TYPE == ODM_MP) - PDM_ODM_T pDM_Odm = &pHalData->DM_OutSrc; - #endif -#endif - u1Byte final_candidate[2] = {0xFF, 0xFF}; //for path A and path B - BOOLEAN bResult = TRUE; - BOOLEAN is2T; - s4Byte tmp1 = 0,tmp2 = 0; - - if( (pDM_Odm->RFType ==ODM_2T2R )||(pDM_Odm->RFType ==ODM_2T3R )||(pDM_Odm->RFType ==ODM_2T4R )) - is2T = TRUE; - else - is2T = FALSE; - - if(is2T) - bound = 8; - else - bound = 4; - - - - ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("===> IQK:phy_SimularityCompare_8188E c1 %d c2 %d!!!\n", c1, c2)); - - - SimularityBitMap = 0; - - for( i = 0; i < bound; i++ ) - { -// diff = (result[c1][i] > result[c2][i]) ? (result[c1][i] - result[c2][i]) : (result[c2][i] - result[c1][i]); - if((i==1) || (i==3) || (i==5) || (i==7)) - { - if((result[c1][i]& 0x00000200) != 0) - tmp1 = result[c1][i] | 0xFFFFFC00; - else - tmp1 = result[c1][i]; - - if((result[c2][i]& 0x00000200) != 0) - tmp2 = result[c2][i] | 0xFFFFFC00; - else - tmp2 = result[c2][i]; - } - else - { - tmp1 = result[c1][i]; - tmp2 = result[c2][i]; - } - - diff = (tmp1 > tmp2) ? (tmp1 - tmp2) : (tmp2 - tmp1); - - if (diff > MAX_TOLERANCE) - { - ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("IQK:phy_SimularityCompare_8188E differnece overflow index %d compare1 0x%x compare2 0x%x!!!\n", i, result[c1][i], result[c2][i])); - - if((i == 2 || i == 6) && !SimularityBitMap) - { - if(result[c1][i]+result[c1][i+1] == 0) - final_candidate[(i/4)] = c2; - else if (result[c2][i]+result[c2][i+1] == 0) - final_candidate[(i/4)] = c1; - else - SimularityBitMap = SimularityBitMap|(1<odmpriv; - #endif - #if (DM_ODM_SUPPORT_TYPE == ODM_MP) - PDM_ODM_T pDM_Odm = &pHalData->DM_OutSrc; - #endif -#endif - u4Byte i; - u1Byte PathAOK, PathBOK; - u4Byte ADDA_REG[IQK_ADDA_REG_NUM] = { - rFPGA0_XCD_SwitchControl, rBlue_Tooth, - rRx_Wait_CCA, rTx_CCK_RFON, - rTx_CCK_BBON, rTx_OFDM_RFON, - rTx_OFDM_BBON, rTx_To_Rx, - rTx_To_Tx, rRx_CCK, - rRx_OFDM, rRx_Wait_RIFS, - rRx_TO_Rx, rStandby, - rSleep, rPMPD_ANAEN }; - u4Byte IQK_MAC_REG[IQK_MAC_REG_NUM] = { - REG_TXPAUSE, REG_BCN_CTRL, - REG_BCN_CTRL_1, REG_GPIO_MUXCFG}; - - //since 92C & 92D have the different define in IQK_BB_REG - u4Byte IQK_BB_REG_92C[IQK_BB_REG_NUM] = { - rOFDM0_TRxPathEnable, rOFDM0_TRMuxPar, - rFPGA0_XCD_RFInterfaceSW, rConfig_AntA, rConfig_AntB, - rFPGA0_XAB_RFInterfaceSW, rFPGA0_XA_RFInterfaceOE, - rFPGA0_XB_RFInterfaceOE, rFPGA0_RFMOD - }; - -#if (DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL)) - u4Byte retryCount = 2; -#else -#if MP_DRIVER - u4Byte retryCount = 9; -#else - u4Byte retryCount = 2; -#endif -#endif -if ( *(pDM_Odm->mp_mode) == 1) - retryCount = 9; -else - retryCount = 2; - // Note: IQ calibration must be performed after loading - // PHY_REG.txt , and radio_a, radio_b.txt - - //u4Byte bbvalue; - -#if (DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL)) -#ifdef MP_TEST - if(pDM_Odm->priv->pshare->rf_ft_var.mp_specific) - retryCount = 9; -#endif -#endif - - - if(t==0) - { -// bbvalue = ODM_GetBBReg(pDM_Odm, rFPGA0_RFMOD, bMaskDWord); -// RTPRINT(FINIT, INIT_IQK, ("phy_IQCalibrate_8188E()==>0x%08x\n",bbvalue)); - - ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("IQ Calibration for %s for %d times\n", (is2T ? "2T2R" : "1T1R"), t)); - - // Save ADDA parameters, turn Path A ADDA on -#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) - _PHY_SaveADDARegisters(pAdapter, ADDA_REG, pDM_Odm->RFCalibrateInfo.ADDA_backup, IQK_ADDA_REG_NUM); - _PHY_SaveMACRegisters(pAdapter, IQK_MAC_REG, pDM_Odm->RFCalibrateInfo.IQK_MAC_backup); - _PHY_SaveADDARegisters(pAdapter, IQK_BB_REG_92C, pDM_Odm->RFCalibrateInfo.IQK_BB_backup, IQK_BB_REG_NUM); -#else - _PHY_SaveADDARegisters(pDM_Odm, ADDA_REG, pDM_Odm->RFCalibrateInfo.ADDA_backup, IQK_ADDA_REG_NUM); - _PHY_SaveMACRegisters(pDM_Odm, IQK_MAC_REG, pDM_Odm->RFCalibrateInfo.IQK_MAC_backup); - _PHY_SaveADDARegisters(pDM_Odm, IQK_BB_REG_92C, pDM_Odm->RFCalibrateInfo.IQK_BB_backup, IQK_BB_REG_NUM); -#endif - } - ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("IQ Calibration for %s for %d times\n", (is2T ? "2T2R" : "1T1R"), t)); - -#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) - - _PHY_PathADDAOn(pAdapter, ADDA_REG, TRUE, is2T); -#else - _PHY_PathADDAOn(pDM_Odm, ADDA_REG, TRUE, is2T); -#endif - - - if(t==0) - { - pDM_Odm->RFCalibrateInfo.bRfPiEnable = (u1Byte)ODM_GetBBReg(pDM_Odm, rFPGA0_XA_HSSIParameter1, BIT(8)); - } - - if(!pDM_Odm->RFCalibrateInfo.bRfPiEnable){ - // Switch BB to PI mode to do IQ Calibration. -#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) - _PHY_PIModeSwitch(pAdapter, TRUE); -#else - _PHY_PIModeSwitch(pDM_Odm, TRUE); -#endif - } - - //BB setting - ODM_SetBBReg(pDM_Odm, rFPGA0_RFMOD, BIT24, 0x00); - ODM_SetBBReg(pDM_Odm, rOFDM0_TRxPathEnable, bMaskDWord, 0x03a05600); - ODM_SetBBReg(pDM_Odm, rOFDM0_TRMuxPar, bMaskDWord, 0x000800e4); - ODM_SetBBReg(pDM_Odm, rFPGA0_XCD_RFInterfaceSW, bMaskDWord, 0x22204000); - - - ODM_SetBBReg(pDM_Odm, rFPGA0_XAB_RFInterfaceSW, BIT10, 0x01); - ODM_SetBBReg(pDM_Odm, rFPGA0_XAB_RFInterfaceSW, BIT26, 0x01); - ODM_SetBBReg(pDM_Odm, rFPGA0_XA_RFInterfaceOE, BIT10, 0x00); - ODM_SetBBReg(pDM_Odm, rFPGA0_XB_RFInterfaceOE, BIT10, 0x00); - - - if(is2T) - { - ODM_SetBBReg(pDM_Odm, rFPGA0_XA_LSSIParameter, bMaskDWord, 0x00010000); - ODM_SetBBReg(pDM_Odm, rFPGA0_XB_LSSIParameter, bMaskDWord, 0x00010000); - } - - //MAC settings -#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) - _PHY_MACSettingCalibration(pAdapter, IQK_MAC_REG, pDM_Odm->RFCalibrateInfo.IQK_MAC_backup); -#else - _PHY_MACSettingCalibration(pDM_Odm, IQK_MAC_REG, pDM_Odm->RFCalibrateInfo.IQK_MAC_backup); -#endif - - - //Page B init - //AP or IQK - ODM_SetBBReg(pDM_Odm, rConfig_AntA, bMaskDWord, 0x0f600000); - - if(is2T) - { - ODM_SetBBReg(pDM_Odm, rConfig_AntB, bMaskDWord, 0x0f600000); - } - - // IQ calibration setting - ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("IQK setting!\n")); - ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, bMaskDWord, 0x80800000); - ODM_SetBBReg(pDM_Odm, rTx_IQK, bMaskDWord, 0x01007c00); - ODM_SetBBReg(pDM_Odm, rRx_IQK, bMaskDWord, 0x81004800); - - for(i = 0 ; i < retryCount ; i++){ -#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) - PathAOK = phy_PathA_IQK_8188E(pAdapter, is2T); -#else - PathAOK = phy_PathA_IQK_8188E(pDM_Odm, is2T); -#endif -// if(PathAOK == 0x03){ - if(PathAOK == 0x01){ - ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Path A Tx IQK Success!!\n")); - result[t][0] = (ODM_GetBBReg(pDM_Odm, rTx_Power_Before_IQK_A, bMaskDWord)&0x3FF0000)>>16; - result[t][1] = (ODM_GetBBReg(pDM_Odm, rTx_Power_After_IQK_A, bMaskDWord)&0x3FF0000)>>16; - break; - } -#if 0 - else if (i == (retryCount-1) && PathAOK == 0x01) //Tx IQK OK - { - RTPRINT(FINIT, INIT_IQK, ("Path A IQK Only Tx Success!!\n")); - - result[t][0] = (ODM_GetBBReg(pDM_Odm, rTx_Power_Before_IQK_A, bMaskDWord)&0x3FF0000)>>16; - result[t][1] = (ODM_GetBBReg(pDM_Odm, rTx_Power_After_IQK_A, bMaskDWord)&0x3FF0000)>>16; - } -#endif - } - - for(i = 0 ; i < retryCount ; i++){ -#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) - PathAOK = phy_PathA_RxIQK(pAdapter, is2T); -#else - PathAOK = phy_PathA_RxIQK(pDM_Odm, is2T); -#endif - if(PathAOK == 0x03){ - ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Path A Rx IQK Success!!\n")); -// result[t][0] = (ODM_GetBBReg(pDM_Odm, rTx_Power_Before_IQK_A, bMaskDWord)&0x3FF0000)>>16; -// result[t][1] = (ODM_GetBBReg(pDM_Odm, rTx_Power_After_IQK_A, bMaskDWord)&0x3FF0000)>>16; - result[t][2] = (ODM_GetBBReg(pDM_Odm, rRx_Power_Before_IQK_A_2, bMaskDWord)&0x3FF0000)>>16; - result[t][3] = (ODM_GetBBReg(pDM_Odm, rRx_Power_After_IQK_A_2, bMaskDWord)&0x3FF0000)>>16; - break; - } - else - { - ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Path A Rx IQK Fail!!\n")); - } - } - - if(0x00 == PathAOK){ - ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Path A IQK failed!!\n")); - } - - if(is2T){ -#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) - _PHY_PathAStandBy(pAdapter); - - // Turn Path B ADDA on - _PHY_PathADDAOn(pAdapter, ADDA_REG, FALSE, is2T); -#else - _PHY_PathAStandBy(pDM_Odm); - - // Turn Path B ADDA on - _PHY_PathADDAOn(pDM_Odm, ADDA_REG, FALSE, is2T); -#endif - - for(i = 0 ; i < retryCount ; i++){ -#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) - PathBOK = phy_PathB_IQK_8188E(pAdapter); -#else - PathBOK = phy_PathB_IQK_8188E(pDM_Odm); -#endif - if(PathBOK == 0x03){ - ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Path B IQK Success!!\n")); - result[t][4] = (ODM_GetBBReg(pDM_Odm, rTx_Power_Before_IQK_B, bMaskDWord)&0x3FF0000)>>16; - result[t][5] = (ODM_GetBBReg(pDM_Odm, rTx_Power_After_IQK_B, bMaskDWord)&0x3FF0000)>>16; - result[t][6] = (ODM_GetBBReg(pDM_Odm, rRx_Power_Before_IQK_B_2, bMaskDWord)&0x3FF0000)>>16; - result[t][7] = (ODM_GetBBReg(pDM_Odm, rRx_Power_After_IQK_B_2, bMaskDWord)&0x3FF0000)>>16; - break; - } - else if (i == (retryCount - 1) && PathBOK == 0x01) //Tx IQK OK - { - ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Path B Only Tx IQK Success!!\n")); - result[t][4] = (ODM_GetBBReg(pDM_Odm, rTx_Power_Before_IQK_B, bMaskDWord)&0x3FF0000)>>16; - result[t][5] = (ODM_GetBBReg(pDM_Odm, rTx_Power_After_IQK_B, bMaskDWord)&0x3FF0000)>>16; - } - } - - if(0x00 == PathBOK){ - ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Path B IQK failed!!\n")); - } - } - - //Back to BB mode, load original value - ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("IQK:Back to BB mode, load original value!\n")); - ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, bMaskDWord, 0); - - if(t!=0) - { - if(!pDM_Odm->RFCalibrateInfo.bRfPiEnable){ - // Switch back BB to SI mode after finish IQ Calibration. -#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) - _PHY_PIModeSwitch(pAdapter, FALSE); -#else - _PHY_PIModeSwitch(pDM_Odm, FALSE); -#endif - } -#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) - - // Reload ADDA power saving parameters - _PHY_ReloadADDARegisters(pAdapter, ADDA_REG, pDM_Odm->RFCalibrateInfo.ADDA_backup, IQK_ADDA_REG_NUM); - - // Reload MAC parameters - _PHY_ReloadMACRegisters(pAdapter, IQK_MAC_REG, pDM_Odm->RFCalibrateInfo.IQK_MAC_backup); - - _PHY_ReloadADDARegisters(pAdapter, IQK_BB_REG_92C, pDM_Odm->RFCalibrateInfo.IQK_BB_backup, IQK_BB_REG_NUM); -#else - // Reload ADDA power saving parameters - _PHY_ReloadADDARegisters(pDM_Odm, ADDA_REG, pDM_Odm->RFCalibrateInfo.ADDA_backup, IQK_ADDA_REG_NUM); - - // Reload MAC parameters - _PHY_ReloadMACRegisters(pDM_Odm, IQK_MAC_REG, pDM_Odm->RFCalibrateInfo.IQK_MAC_backup); - - _PHY_ReloadADDARegisters(pDM_Odm, IQK_BB_REG_92C, pDM_Odm->RFCalibrateInfo.IQK_BB_backup, IQK_BB_REG_NUM); -#endif - - - // Restore RX initial gain - ODM_SetBBReg(pDM_Odm, rFPGA0_XA_LSSIParameter, bMaskDWord, 0x00032ed3); - if(is2T){ - ODM_SetBBReg(pDM_Odm, rFPGA0_XB_LSSIParameter, bMaskDWord, 0x00032ed3); - } - - //load 0xe30 IQC default value - ODM_SetBBReg(pDM_Odm, rTx_IQK_Tone_A, bMaskDWord, 0x01008c00); - ODM_SetBBReg(pDM_Odm, rRx_IQK_Tone_A, bMaskDWord, 0x01008c00); - - - } - ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("phy_IQCalibrate_8188E() <==\n")); - -} - - -VOID -phy_LCCalibrate_8188E( -#if (DM_ODM_SUPPORT_TYPE & ODM_AP) - IN PDM_ODM_T pDM_Odm, -#else - IN struct adapter *pAdapter, -#endif - IN BOOLEAN is2T - ) -{ - u1Byte tmpReg; - u4Byte RF_Amode=0, RF_Bmode=0, LC_Cal; -#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter); - #if (DM_ODM_SUPPORT_TYPE == ODM_CE) - PDM_ODM_T pDM_Odm = &pHalData->odmpriv; - #endif - #if (DM_ODM_SUPPORT_TYPE == ODM_MP) - PDM_ODM_T pDM_Odm = &pHalData->DM_OutSrc; - #endif -#endif - //Check continuous TX and Packet TX - tmpReg = ODM_Read1Byte(pDM_Odm, 0xd03); - - if((tmpReg&0x70) != 0) //Deal with contisuous TX case - ODM_Write1Byte(pDM_Odm, 0xd03, tmpReg&0x8F); //disable all continuous TX - else // Deal with Packet TX case - ODM_Write1Byte(pDM_Odm, REG_TXPAUSE, 0xFF); // block all queues - - if((tmpReg&0x70) != 0) - { - //1. Read original RF mode - //Path-A -#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) - RF_Amode = PHY_QueryRFReg(pAdapter, RF_PATH_A, RF_AC, bMask12Bits); - - //Path-B - if(is2T) - RF_Bmode = PHY_QueryRFReg(pAdapter, RF_PATH_B, RF_AC, bMask12Bits); -#else - RF_Amode = ODM_GetRFReg(pDM_Odm, RF_PATH_A, RF_AC, bMask12Bits); - - //Path-B - if(is2T) - RF_Bmode = ODM_GetRFReg(pDM_Odm, RF_PATH_B, RF_AC, bMask12Bits); -#endif - - //2. Set RF mode = standby mode - //Path-A - ODM_SetRFReg(pDM_Odm, RF_PATH_A, RF_AC, bMask12Bits, (RF_Amode&0x8FFFF)|0x10000); - - //Path-B - if(is2T) - ODM_SetRFReg(pDM_Odm, RF_PATH_B, RF_AC, bMask12Bits, (RF_Bmode&0x8FFFF)|0x10000); - } - - //3. Read RF reg18 -#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) - LC_Cal = PHY_QueryRFReg(pAdapter, RF_PATH_A, RF_CHNLBW, bMask12Bits); -#else - LC_Cal = ODM_GetRFReg(pDM_Odm, RF_PATH_A, RF_CHNLBW, bMask12Bits); -#endif - - //4. Set LC calibration begin bit15 - ODM_SetRFReg(pDM_Odm, RF_PATH_A, RF_CHNLBW, bMask12Bits, LC_Cal|0x08000); - - ODM_sleep_ms(100); - - - //Restore original situation - if((tmpReg&0x70) != 0) //Deal with contisuous TX case - { - //Path-A - ODM_Write1Byte(pDM_Odm, 0xd03, tmpReg); - ODM_SetRFReg(pDM_Odm, RF_PATH_A, RF_AC, bMask12Bits, RF_Amode); - - //Path-B - if(is2T) - ODM_SetRFReg(pDM_Odm, RF_PATH_B, RF_AC, bMask12Bits, RF_Bmode); - } - else // Deal with Packet TX case - { - ODM_Write1Byte(pDM_Odm, REG_TXPAUSE, 0x00); - } -} - -//Analog Pre-distortion calibration -#define APK_BB_REG_NUM 8 -#define APK_CURVE_REG_NUM 4 -#define PATH_NUM 2 - -VOID -phy_APCalibrate_8188E( -#if (DM_ODM_SUPPORT_TYPE & ODM_AP) - IN PDM_ODM_T pDM_Odm, -#else - IN struct adapter *pAdapter, -#endif - IN s1Byte delta, - IN BOOLEAN is2T - ) -{ -#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter); - #if (DM_ODM_SUPPORT_TYPE == ODM_CE) - PDM_ODM_T pDM_Odm = &pHalData->odmpriv; - #endif - #if (DM_ODM_SUPPORT_TYPE == ODM_MP) - PDM_ODM_T pDM_Odm = &pHalData->DM_OutSrc; - #endif -#endif - u4Byte regD[PATH_NUM]; - u4Byte tmpReg, index, offset, apkbound; - u1Byte path, i, pathbound = PATH_NUM; - u4Byte BB_backup[APK_BB_REG_NUM]; - u4Byte BB_REG[APK_BB_REG_NUM] = { - rFPGA1_TxBlock, rOFDM0_TRxPathEnable, - rFPGA0_RFMOD, rOFDM0_TRMuxPar, - rFPGA0_XCD_RFInterfaceSW, rFPGA0_XAB_RFInterfaceSW, - rFPGA0_XA_RFInterfaceOE, rFPGA0_XB_RFInterfaceOE }; - u4Byte BB_AP_MODE[APK_BB_REG_NUM] = { - 0x00000020, 0x00a05430, 0x02040000, - 0x000800e4, 0x00204000 }; - u4Byte BB_normal_AP_MODE[APK_BB_REG_NUM] = { - 0x00000020, 0x00a05430, 0x02040000, - 0x000800e4, 0x22204000 }; - - u4Byte AFE_backup[IQK_ADDA_REG_NUM]; - u4Byte AFE_REG[IQK_ADDA_REG_NUM] = { - rFPGA0_XCD_SwitchControl, rBlue_Tooth, - rRx_Wait_CCA, rTx_CCK_RFON, - rTx_CCK_BBON, rTx_OFDM_RFON, - rTx_OFDM_BBON, rTx_To_Rx, - rTx_To_Tx, rRx_CCK, - rRx_OFDM, rRx_Wait_RIFS, - rRx_TO_Rx, rStandby, - rSleep, rPMPD_ANAEN }; - - u4Byte MAC_backup[IQK_MAC_REG_NUM]; - u4Byte MAC_REG[IQK_MAC_REG_NUM] = { - REG_TXPAUSE, REG_BCN_CTRL, - REG_BCN_CTRL_1, REG_GPIO_MUXCFG}; - - u4Byte APK_RF_init_value[PATH_NUM][APK_BB_REG_NUM] = { - {0x0852c, 0x1852c, 0x5852c, 0x1852c, 0x5852c}, - {0x2852e, 0x0852e, 0x3852e, 0x0852e, 0x0852e} - }; - - u4Byte APK_normal_RF_init_value[PATH_NUM][APK_BB_REG_NUM] = { - {0x0852c, 0x0a52c, 0x3a52c, 0x5a52c, 0x5a52c}, //path settings equal to path b settings - {0x0852c, 0x0a52c, 0x5a52c, 0x5a52c, 0x5a52c} - }; - - u4Byte APK_RF_value_0[PATH_NUM][APK_BB_REG_NUM] = { - {0x52019, 0x52014, 0x52013, 0x5200f, 0x5208d}, - {0x5201a, 0x52019, 0x52016, 0x52033, 0x52050} - }; - - u4Byte APK_normal_RF_value_0[PATH_NUM][APK_BB_REG_NUM] = { - {0x52019, 0x52017, 0x52010, 0x5200d, 0x5206a}, //path settings equal to path b settings - {0x52019, 0x52017, 0x52010, 0x5200d, 0x5206a} - }; - - u4Byte AFE_on_off[PATH_NUM] = { - 0x04db25a4, 0x0b1b25a4}; //path A on path B off / path A off path B on - - u4Byte APK_offset[PATH_NUM] = { - rConfig_AntA, rConfig_AntB}; - - u4Byte APK_normal_offset[PATH_NUM] = { - rConfig_Pmpd_AntA, rConfig_Pmpd_AntB}; - - u4Byte APK_value[PATH_NUM] = { - 0x92fc0000, 0x12fc0000}; - - u4Byte APK_normal_value[PATH_NUM] = { - 0x92680000, 0x12680000}; - - s1Byte APK_delta_mapping[APK_BB_REG_NUM][13] = { - {-4, -3, -2, -2, -1, -1, 0, 1, 2, 3, 4, 5, 6}, - {-4, -3, -2, -2, -1, -1, 0, 1, 2, 3, 4, 5, 6}, - {-6, -4, -2, -2, -1, -1, 0, 1, 2, 3, 4, 5, 6}, - {-1, -1, -1, -1, -1, -1, 0, 1, 2, 3, 4, 5, 6}, - {-11, -9, -7, -5, -3, -1, 0, 0, 0, 0, 0, 0, 0} - }; - - u4Byte APK_normal_setting_value_1[13] = { - 0x01017018, 0xf7ed8f84, 0x1b1a1816, 0x2522201e, 0x322e2b28, - 0x433f3a36, 0x5b544e49, 0x7b726a62, 0xa69a8f84, 0xdfcfc0b3, - 0x12680000, 0x00880000, 0x00880000 - }; - - u4Byte APK_normal_setting_value_2[16] = { - 0x01c7021d, 0x01670183, 0x01000123, 0x00bf00e2, 0x008d00a3, - 0x0068007b, 0x004d0059, 0x003a0042, 0x002b0031, 0x001f0025, - 0x0017001b, 0x00110014, 0x000c000f, 0x0009000b, 0x00070008, - 0x00050006 - }; - - u4Byte APK_result[PATH_NUM][APK_BB_REG_NUM]; //val_1_1a, val_1_2a, val_2a, val_3a, val_4a -// u4Byte AP_curve[PATH_NUM][APK_CURVE_REG_NUM]; - - s4Byte BB_offset, delta_V, delta_offset; - -#if MP_DRIVER == 1 -if ( *(pDM_Odm->mp_mode) == 1) -{ -#if (DM_ODM_SUPPORT_TYPE == ODM_CE) - PMPT_CONTEXT pMptCtx = &(pAdapter->mppriv.MptCtx); -#else - PMPT_CONTEXT pMptCtx = &(pAdapter->MptCtx); -#endif - pMptCtx->APK_bound[0] = 45; - pMptCtx->APK_bound[1] = 52; -} -#endif - - ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("==>phy_APCalibrate_8188E() delta %d\n", delta)); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("AP Calibration for %s\n", (is2T ? "2T2R" : "1T1R"))); - if(!is2T) - pathbound = 1; - - //2 FOR NORMAL CHIP SETTINGS - -// Temporarily do not allow normal driver to do the following settings because these offset -// and value will cause RF internal PA to be unpredictably disabled by HW, such that RF Tx signal -// will disappear after disable/enable card many times on 88CU. RF SD and DD have not find the -// root cause, so we remove these actions temporarily. Added by tynli and SD3 Allen. 2010.05.31. -//#if MP_DRIVER != 1 -if (*(pDM_Odm->mp_mode) != 1) - return; -//#endif - //settings adjust for normal chip - for(index = 0; index < PATH_NUM; index ++) - { - APK_offset[index] = APK_normal_offset[index]; - APK_value[index] = APK_normal_value[index]; - AFE_on_off[index] = 0x6fdb25a4; - } - - for(index = 0; index < APK_BB_REG_NUM; index ++) - { - for(path = 0; path < pathbound; path++) - { - APK_RF_init_value[path][index] = APK_normal_RF_init_value[path][index]; - APK_RF_value_0[path][index] = APK_normal_RF_value_0[path][index]; - } - BB_AP_MODE[index] = BB_normal_AP_MODE[index]; - } - - apkbound = 6; - - //save BB default value - for(index = 0; index < APK_BB_REG_NUM ; index++) - { - if(index == 0) //skip - continue; - BB_backup[index] = ODM_GetBBReg(pDM_Odm, BB_REG[index], bMaskDWord); - } - - //save MAC default value -#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) - _PHY_SaveMACRegisters(pAdapter, MAC_REG, MAC_backup); - - //save AFE default value - _PHY_SaveADDARegisters(pAdapter, AFE_REG, AFE_backup, IQK_ADDA_REG_NUM); -#else - _PHY_SaveMACRegisters(pDM_Odm, MAC_REG, MAC_backup); - - //save AFE default value - _PHY_SaveADDARegisters(pDM_Odm, AFE_REG, AFE_backup, IQK_ADDA_REG_NUM); -#endif - - for(path = 0; path < pathbound; path++) - { - - - if(path == RF_PATH_A) - { - //path A APK - //load APK setting - //path-A - offset = rPdp_AntA; - for(index = 0; index < 11; index ++) - { - ODM_SetBBReg(pDM_Odm, offset, bMaskDWord, APK_normal_setting_value_1[index]); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("phy_APCalibrate_8188E() offset 0x%x value 0x%x\n", offset, ODM_GetBBReg(pDM_Odm, offset, bMaskDWord))); - - offset += 0x04; - } - - ODM_SetBBReg(pDM_Odm, rConfig_Pmpd_AntB, bMaskDWord, 0x12680000); - - offset = rConfig_AntA; - for(; index < 13; index ++) - { - ODM_SetBBReg(pDM_Odm, offset, bMaskDWord, APK_normal_setting_value_1[index]); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("phy_APCalibrate_8188E() offset 0x%x value 0x%x\n", offset, ODM_GetBBReg(pDM_Odm, offset, bMaskDWord))); - - offset += 0x04; - } - - //page-B1 - ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, bMaskDWord, 0x40000000); - - //path A - offset = rPdp_AntA; - for(index = 0; index < 16; index++) - { - ODM_SetBBReg(pDM_Odm, offset, bMaskDWord, APK_normal_setting_value_2[index]); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("phy_APCalibrate_8188E() offset 0x%x value 0x%x\n", offset, ODM_GetBBReg(pDM_Odm, offset, bMaskDWord))); - - offset += 0x04; - } - ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, bMaskDWord, 0x00000000); - } - else if(path == RF_PATH_B) - { - //path B APK - //load APK setting - //path-B - offset = rPdp_AntB; - for(index = 0; index < 10; index ++) - { - ODM_SetBBReg(pDM_Odm, offset, bMaskDWord, APK_normal_setting_value_1[index]); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("phy_APCalibrate_8188E() offset 0x%x value 0x%x\n", offset, ODM_GetBBReg(pDM_Odm, offset, bMaskDWord))); - - offset += 0x04; - } - ODM_SetBBReg(pDM_Odm, rConfig_Pmpd_AntA, bMaskDWord, 0x12680000); -#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) - PHY_SetBBReg(pAdapter, rConfig_Pmpd_AntB, bMaskDWord, 0x12680000); -#else - PHY_SetBBReg(pDM_Odm, rConfig_Pmpd_AntB, bMaskDWord, 0x12680000); -#endif - - offset = rConfig_AntA; - index = 11; - for(; index < 13; index ++) //offset 0xb68, 0xb6c - { - ODM_SetBBReg(pDM_Odm, offset, bMaskDWord, APK_normal_setting_value_1[index]); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("phy_APCalibrate_8188E() offset 0x%x value 0x%x\n", offset, ODM_GetBBReg(pDM_Odm, offset, bMaskDWord))); - - offset += 0x04; - } - - //page-B1 - ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, bMaskDWord, 0x40000000); - - //path B - offset = 0xb60; - for(index = 0; index < 16; index++) - { - ODM_SetBBReg(pDM_Odm, offset, bMaskDWord, APK_normal_setting_value_2[index]); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("phy_APCalibrate_8188E() offset 0x%x value 0x%x\n", offset, ODM_GetBBReg(pDM_Odm, offset, bMaskDWord))); - - offset += 0x04; - } - ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, bMaskDWord, 0); - } - - //save RF default value -#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) - regD[path] = PHY_QueryRFReg(pAdapter, path, RF_TXBIAS_A, bMaskDWord); -#else - regD[path] = ODM_GetRFReg(pDM_Odm, path, RF_TXBIAS_A, bMaskDWord); -#endif - - //Path A AFE all on, path B AFE All off or vise versa - for(index = 0; index < IQK_ADDA_REG_NUM ; index++) - ODM_SetBBReg(pDM_Odm, AFE_REG[index], bMaskDWord, AFE_on_off[path]); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("phy_APCalibrate_8188E() offset 0xe70 %x\n", ODM_GetBBReg(pDM_Odm, rRx_Wait_CCA, bMaskDWord))); - - //BB to AP mode - if(path == 0) - { - for(index = 0; index < APK_BB_REG_NUM ; index++) - { - - if(index == 0) //skip - continue; - else if (index < 5) - ODM_SetBBReg(pDM_Odm, BB_REG[index], bMaskDWord, BB_AP_MODE[index]); - else if (BB_REG[index] == 0x870) - ODM_SetBBReg(pDM_Odm, BB_REG[index], bMaskDWord, BB_backup[index]|BIT10|BIT26); - else - ODM_SetBBReg(pDM_Odm, BB_REG[index], BIT10, 0x0); - } - - ODM_SetBBReg(pDM_Odm, rTx_IQK_Tone_A, bMaskDWord, 0x01008c00); - ODM_SetBBReg(pDM_Odm, rRx_IQK_Tone_A, bMaskDWord, 0x01008c00); - } - else //path B - { - ODM_SetBBReg(pDM_Odm, rTx_IQK_Tone_B, bMaskDWord, 0x01008c00); - ODM_SetBBReg(pDM_Odm, rRx_IQK_Tone_B, bMaskDWord, 0x01008c00); - - } - - ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("phy_APCalibrate_8188E() offset 0x800 %x\n", ODM_GetBBReg(pDM_Odm, 0x800, bMaskDWord))); - - //MAC settings -#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) - _PHY_MACSettingCalibration(pAdapter, MAC_REG, MAC_backup); -#else - _PHY_MACSettingCalibration(pDM_Odm, MAC_REG, MAC_backup); -#endif - - if(path == RF_PATH_A) //Path B to standby mode - { - ODM_SetRFReg(pDM_Odm, RF_PATH_B, RF_AC, bMaskDWord, 0x10000); - } - else //Path A to standby mode - { - ODM_SetRFReg(pDM_Odm, RF_PATH_A, RF_AC, bMaskDWord, 0x10000); - ODM_SetRFReg(pDM_Odm, RF_PATH_A, RF_MODE1, bMaskDWord, 0x1000f); - ODM_SetRFReg(pDM_Odm, RF_PATH_A, RF_MODE2, bMaskDWord, 0x20103); - } - - delta_offset = ((delta+14)/2); - if(delta_offset < 0) - delta_offset = 0; - else if (delta_offset > 12) - delta_offset = 12; - - //AP calibration - for(index = 0; index < APK_BB_REG_NUM; index++) - { - if(index != 1) //only DO PA11+PAD01001, AP RF setting - continue; - - tmpReg = APK_RF_init_value[path][index]; -#if 1 - if(!pDM_Odm->RFCalibrateInfo.bAPKThermalMeterIgnore) - { - BB_offset = (tmpReg & 0xF0000) >> 16; - - if(!(tmpReg & BIT15)) //sign bit 0 - { - BB_offset = -BB_offset; - } - - delta_V = APK_delta_mapping[index][delta_offset]; - - BB_offset += delta_V; - - ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("phy_APCalibrate_8188E() APK index %d tmpReg 0x%x delta_V %d delta_offset %d\n", index, tmpReg, delta_V, delta_offset)); - - if(BB_offset < 0) - { - tmpReg = tmpReg & (~BIT15); - BB_offset = -BB_offset; - } - else - { - tmpReg = tmpReg | BIT15; - } - tmpReg = (tmpReg & 0xFFF0FFFF) | (BB_offset << 16); - } -#endif - - ODM_SetRFReg(pDM_Odm, path, RF_IPA_A, bMaskDWord, 0x8992e); -#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) - ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("phy_APCalibrate_8188E() offset 0xc %x\n", PHY_QueryRFReg(pAdapter, path, RF_IPA_A, bMaskDWord))); - ODM_SetRFReg(pDM_Odm, path, RF_AC, bMaskDWord, APK_RF_value_0[path][index]); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("phy_APCalibrate_8188E() offset 0x0 %x\n", PHY_QueryRFReg(pAdapter, path, RF_AC, bMaskDWord))); - ODM_SetRFReg(pDM_Odm, path, RF_TXBIAS_A, bMaskDWord, tmpReg); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("phy_APCalibrate_8188E() offset 0xd %x\n", PHY_QueryRFReg(pAdapter, path, RF_TXBIAS_A, bMaskDWord))); -#else - ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("phy_APCalibrate_8188E() offset 0xc %x\n", ODM_GetRFReg(pDM_Odm, path, RF_IPA_A, bMaskDWord))); - ODM_SetRFReg(pDM_Odm, path, RF_AC, bMaskDWord, APK_RF_value_0[path][index]); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("phy_APCalibrate_8188E() offset 0x0 %x\n", ODM_GetRFReg(pDM_Odm, path, RF_AC, bMaskDWord))); - ODM_SetRFReg(pDM_Odm, path, RF_TXBIAS_A, bMaskDWord, tmpReg); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("phy_APCalibrate_8188E() offset 0xd %x\n", ODM_GetRFReg(pDM_Odm, path, RF_TXBIAS_A, bMaskDWord))); -#endif - - // PA11+PAD01111, one shot - i = 0; - do - { - ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, bMaskDWord, 0x80000000); - { - ODM_SetBBReg(pDM_Odm, APK_offset[path], bMaskDWord, APK_value[0]); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("phy_APCalibrate_8188E() offset 0x%x value 0x%x\n", APK_offset[path], ODM_GetBBReg(pDM_Odm, APK_offset[path], bMaskDWord))); - ODM_delay_ms(3); - ODM_SetBBReg(pDM_Odm, APK_offset[path], bMaskDWord, APK_value[1]); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("phy_APCalibrate_8188E() offset 0x%x value 0x%x\n", APK_offset[path], ODM_GetBBReg(pDM_Odm, APK_offset[path], bMaskDWord))); - - ODM_delay_ms(20); - } - ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, bMaskDWord, 0x00000000); - - if(path == RF_PATH_A) - tmpReg = ODM_GetBBReg(pDM_Odm, rAPK, 0x03E00000); - else - tmpReg = ODM_GetBBReg(pDM_Odm, rAPK, 0xF8000000); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("phy_APCalibrate_8188E() offset 0xbd8[25:21] %x\n", tmpReg)); - - - i++; - } - while(tmpReg > apkbound && i < 4); - - APK_result[path][index] = tmpReg; - } - } - - //reload MAC default value -#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) - _PHY_ReloadMACRegisters(pAdapter, MAC_REG, MAC_backup); -#else - _PHY_ReloadMACRegisters(pDM_Odm, MAC_REG, MAC_backup); -#endif - - //reload BB default value - for(index = 0; index < APK_BB_REG_NUM ; index++) - { - - if(index == 0) //skip - continue; - ODM_SetBBReg(pDM_Odm, BB_REG[index], bMaskDWord, BB_backup[index]); - } - - //reload AFE default value -#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) - _PHY_ReloadADDARegisters(pAdapter, AFE_REG, AFE_backup, IQK_ADDA_REG_NUM); -#else - _PHY_ReloadADDARegisters(pDM_Odm, AFE_REG, AFE_backup, IQK_ADDA_REG_NUM); -#endif - - //reload RF path default value - for(path = 0; path < pathbound; path++) - { - ODM_SetRFReg(pDM_Odm, path, 0xd, bMaskDWord, regD[path]); - if(path == RF_PATH_B) - { - ODM_SetRFReg(pDM_Odm, RF_PATH_A, RF_MODE1, bMaskDWord, 0x1000f); - ODM_SetRFReg(pDM_Odm, RF_PATH_A, RF_MODE2, bMaskDWord, 0x20101); - } - - //note no index == 0 - if (APK_result[path][1] > 6) - APK_result[path][1] = 6; - ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("apk path %d result %d 0x%x \t", path, 1, APK_result[path][1])); - } - - ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("\n")); - - - for(path = 0; path < pathbound; path++) - { - ODM_SetRFReg(pDM_Odm, path, 0x3, bMaskDWord, - ((APK_result[path][1] << 15) | (APK_result[path][1] << 10) | (APK_result[path][1] << 5) | APK_result[path][1])); - if(path == RF_PATH_A) - ODM_SetRFReg(pDM_Odm, path, 0x4, bMaskDWord, - ((APK_result[path][1] << 15) | (APK_result[path][1] << 10) | (0x00 << 5) | 0x05)); - else - ODM_SetRFReg(pDM_Odm, path, 0x4, bMaskDWord, - ((APK_result[path][1] << 15) | (APK_result[path][1] << 10) | (0x02 << 5) | 0x05)); -#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) - if(!IS_HARDWARE_TYPE_8723A(pAdapter)) - ODM_SetRFReg(pDM_Odm, path, RF_BS_PA_APSET_G9_G11, bMaskDWord, - ((0x08 << 15) | (0x08 << 10) | (0x08 << 5) | 0x08)); -#endif - } - - pDM_Odm->RFCalibrateInfo.bAPKdone = TRUE; - - ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("<==phy_APCalibrate_8188E()\n")); -} - - - -#define DP_BB_REG_NUM 7 -#define DP_RF_REG_NUM 1 -#define DP_RETRY_LIMIT 10 -#define DP_PATH_NUM 2 -#define DP_DPK_NUM 3 -#define DP_DPK_VALUE_NUM 2 - - - - - -VOID -PHY_IQCalibrate_8188E( -#if (DM_ODM_SUPPORT_TYPE & ODM_AP) - IN PDM_ODM_T pDM_Odm, -#else - IN struct adapter *pAdapter, -#endif - IN BOOLEAN bReCovery - ) -{ -#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter); - - #if (DM_ODM_SUPPORT_TYPE == ODM_MP) - PDM_ODM_T pDM_Odm = &pHalData->DM_OutSrc; - #else // (DM_ODM_SUPPORT_TYPE == ODM_CE) - PDM_ODM_T pDM_Odm = &pHalData->odmpriv; - #endif - - #if (MP_DRIVER == 1) - #if (DM_ODM_SUPPORT_TYPE == ODM_MP) - PMPT_CONTEXT pMptCtx = &(pAdapter->MptCtx); - #else// (DM_ODM_SUPPORT_TYPE == ODM_CE) - PMPT_CONTEXT pMptCtx = &(pAdapter->mppriv.MptCtx); - #endif - #endif//(MP_DRIVER == 1) -#endif - - s4Byte result[4][8]; //last is final result - u1Byte i, final_candidate, Indexforchannel; - u1Byte channelToIQK = 7; - BOOLEAN bPathAOK, bPathBOK; - s4Byte RegE94, RegE9C, RegEA4, RegEAC, RegEB4, RegEBC, RegEC4, RegECC, RegTmp = 0; - BOOLEAN is12simular, is13simular, is23simular; - BOOLEAN bStartContTx = FALSE, bSingleTone = FALSE, bCarrierSuppression = FALSE; - u4Byte IQK_BB_REG_92C[IQK_BB_REG_NUM] = { - rOFDM0_XARxIQImbalance, rOFDM0_XBRxIQImbalance, - rOFDM0_ECCAThreshold, rOFDM0_AGCRSSITable, - rOFDM0_XATxIQImbalance, rOFDM0_XBTxIQImbalance, - rOFDM0_XCTxAFE, rOFDM0_XDTxAFE, - rOFDM0_RxIQExtAnta}; - BOOLEAN is2T; - - is2T = (pDM_Odm->RFType == ODM_2T2R)?TRUE:FALSE; -#if (DM_ODM_SUPPORT_TYPE & (ODM_MP|ODM_CE) ) - if (ODM_CheckPowerStatus(pAdapter) == FALSE) - return; -#else - prtl8192cd_priv priv = pDM_Odm->priv; - -#ifdef MP_TEST - if(priv->pshare->rf_ft_var.mp_specific) - { - if((OPMODE & WIFI_MP_CTX_PACKET) || (OPMODE & WIFI_MP_CTX_ST)) - return; - } -#endif - - if(priv->pshare->IQK_88E_done) - bReCovery= 1; - priv->pshare->IQK_88E_done = 1; - -#endif - -#if (DM_ODM_SUPPORT_TYPE == ODM_CE) - if(!(pDM_Odm->SupportAbility & ODM_RF_CALIBRATION)) - { - return; - } -#endif - -#if MP_DRIVER == 1 -if (*(pDM_Odm->mp_mode) == 1) -{ - bStartContTx = pMptCtx->bStartContTx; - bSingleTone = pMptCtx->bSingleTone; - bCarrierSuppression = pMptCtx->bCarrierSuppression; -} -#endif - - // 20120213 Turn on when continuous Tx to pass lab testing. (required by Edlu) - if(bSingleTone || bCarrierSuppression) - return; - -#if DISABLE_BB_RF - return; -#endif - -#if (DM_ODM_SUPPORT_TYPE & (ODM_CE|ODM_AP)) - if(bReCovery) -#else//for ODM_MP - if(bReCovery && (!pAdapter->bInHctTest)) //YJ,add for PowerTest,120405 -#endif - { - ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_LOUD, ("PHY_IQCalibrate_8188E: Return due to bReCovery!\n")); -#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) - _PHY_ReloadADDARegisters(pAdapter, IQK_BB_REG_92C, pDM_Odm->RFCalibrateInfo.IQK_BB_backup_recover, 9); -#else - _PHY_ReloadADDARegisters(pDM_Odm, IQK_BB_REG_92C, pDM_Odm->RFCalibrateInfo.IQK_BB_backup_recover, 9); -#endif - return; - } - ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("IQK:Start!!!\n")); - -#if 0//Suggested by Edlu,120413 - - // IQK on channel 7, should switch back when completed. - //originChannel = pHalData->CurrentChannel; - originChannel = *(pDM_Odm->pChannel); - -#if (DM_ODM_SUPPORT_TYPE == ODM_MP) - pAdapter->HalFunc.SwChnlByTimerHandler(pAdapter, channelToIQK); -#elif (DM_ODM_SUPPORT_TYPE == ODM_CE) - pAdapter->HalFunc.set_channel_handler(pAdapter, channelToIQK); -#endif - -#endif - - for(i = 0; i < 8; i++) - { - result[0][i] = 0; - result[1][i] = 0; - result[2][i] = 0; - if((i==0) ||(i==2) || (i==4) || (i==6)) - result[3][i] = 0x100; - else - result[3][i] = 0; - } - final_candidate = 0xff; - bPathAOK = FALSE; - bPathBOK = FALSE; - is12simular = FALSE; - is23simular = FALSE; - is13simular = FALSE; - - - //ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("IQK !!!interface %d currentband %d ishardwareD %d \n", pDM_Odm->interfaceIndex, pHalData->CurrentBandType92D, IS_HARDWARE_TYPE_8192D(pAdapter))); -// RT_TRACE(COMP_INIT,DBG_LOUD,("Acquire Mutex in IQCalibrate \n")); - for (i=0; i<3; i++) - { - -#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) - phy_IQCalibrate_8188E(pAdapter, result, i, is2T); -#else - phy_IQCalibrate_8188E(pDM_Odm, result, i, is2T); -#endif - - - if(i == 1) - { -#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) - is12simular = phy_SimularityCompare_8188E(pAdapter, result, 0, 1); -#else - is12simular = phy_SimularityCompare_8188E(pDM_Odm, result, 0, 1); -#endif - if(is12simular) - { - final_candidate = 0; - ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("IQK: is12simular final_candidate is %x\n",final_candidate)); - break; - } - } - - if(i == 2) - { -#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) - is13simular = phy_SimularityCompare_8188E(pAdapter, result, 0, 2); -#else - is13simular = phy_SimularityCompare_8188E(pDM_Odm, result, 0, 2); -#endif - if(is13simular) - { - final_candidate = 0; - ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("IQK: is13simular final_candidate is %x\n",final_candidate)); - - break; - } -#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) - is23simular = phy_SimularityCompare_8188E(pAdapter, result, 1, 2); -#else - is23simular = phy_SimularityCompare_8188E(pDM_Odm, result, 1, 2); -#endif - if(is23simular) - { - final_candidate = 1; - ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("IQK: is23simular final_candidate is %x\n",final_candidate)); - } - else - { - /* - for(i = 0; i < 8; i++) - RegTmp += result[3][i]; - - if(RegTmp != 0) - final_candidate = 3; - else - final_candidate = 0xFF; - */ - final_candidate = 3; - } - } - } -// RT_TRACE(COMP_INIT,DBG_LOUD,("Release Mutex in IQCalibrate \n")); - - for (i=0; i<4; i++) - { - RegE94 = result[i][0]; - RegE9C = result[i][1]; - RegEA4 = result[i][2]; - RegEAC = result[i][3]; - RegEB4 = result[i][4]; - RegEBC = result[i][5]; - RegEC4 = result[i][6]; - RegECC = result[i][7]; - ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("IQK: RegE94=%x RegE9C=%x RegEA4=%x RegEAC=%x RegEB4=%x RegEBC=%x RegEC4=%x RegECC=%x\n ", RegE94, RegE9C, RegEA4, RegEAC, RegEB4, RegEBC, RegEC4, RegECC)); - } - - if(final_candidate != 0xff) - { - pDM_Odm->RFCalibrateInfo.RegE94 = RegE94 = result[final_candidate][0]; - pDM_Odm->RFCalibrateInfo.RegE9C = RegE9C = result[final_candidate][1]; - RegEA4 = result[final_candidate][2]; - RegEAC = result[final_candidate][3]; - pDM_Odm->RFCalibrateInfo.RegEB4 = RegEB4 = result[final_candidate][4]; - pDM_Odm->RFCalibrateInfo.RegEBC = RegEBC = result[final_candidate][5]; - RegEC4 = result[final_candidate][6]; - RegECC = result[final_candidate][7]; - ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("IQK: final_candidate is %x\n",final_candidate)); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("IQK: RegE94=%x RegE9C=%x RegEA4=%x RegEAC=%x RegEB4=%x RegEBC=%x RegEC4=%x RegECC=%x\n ", RegE94, RegE9C, RegEA4, RegEAC, RegEB4, RegEBC, RegEC4, RegECC)); - bPathAOK = bPathBOK = TRUE; - } - else - { - ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("IQK: FAIL use default value\n")); - - pDM_Odm->RFCalibrateInfo.RegE94 = pDM_Odm->RFCalibrateInfo.RegEB4 = 0x100; //X default value - pDM_Odm->RFCalibrateInfo.RegE9C = pDM_Odm->RFCalibrateInfo.RegEBC = 0x0; //Y default value - } - - if((RegE94 != 0)/*&&(RegEA4 != 0)*/) - { -#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) - _PHY_PathAFillIQKMatrix(pAdapter, bPathAOK, result, final_candidate, (RegEA4 == 0)); -#else - _PHY_PathAFillIQKMatrix(pDM_Odm, bPathAOK, result, final_candidate, (RegEA4 == 0)); -#endif - } - -#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) - if (is2T) - { - if((RegEB4 != 0)/*&&(RegEC4 != 0)*/) - { - _PHY_PathBFillIQKMatrix(pAdapter, bPathBOK, result, final_candidate, (RegEC4 == 0)); - } - } -#endif - -#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) - Indexforchannel = ODM_GetRightChnlPlaceforIQK(pHalData->CurrentChannel); -#else - Indexforchannel = 0; -#endif - -//To Fix BSOD when final_candidate is 0xff -//by sherry 20120321 - if(final_candidate < 4) - { - for(i = 0; i < IQK_Matrix_REG_NUM; i++) - pDM_Odm->RFCalibrateInfo.IQKMatrixRegSetting[Indexforchannel].Value[0][i] = result[final_candidate][i]; - pDM_Odm->RFCalibrateInfo.IQKMatrixRegSetting[Indexforchannel].bIQKDone = TRUE; - } - //RTPRINT(FINIT, INIT_IQK, ("\nIQK OK Indexforchannel %d.\n", Indexforchannel)); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("\nIQK OK Indexforchannel %d.\n", Indexforchannel)); -#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) - - _PHY_SaveADDARegisters(pAdapter, IQK_BB_REG_92C, pDM_Odm->RFCalibrateInfo.IQK_BB_backup_recover, 9); -#else - _PHY_SaveADDARegisters(pDM_Odm, IQK_BB_REG_92C, pDM_Odm->RFCalibrateInfo.IQK_BB_backup_recover, IQK_BB_REG_NUM); -#endif - - ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("IQK finished\n")); -#if 0 //Suggested by Edlu,120413 - - #if (DM_ODM_SUPPORT_TYPE == ODM_MP) - pAdapter->HalFunc.SwChnlByTimerHandler(pAdapter, originChannel); - #elif (DM_ODM_SUPPORT_TYPE == ODM_CE) - pAdapter->HalFunc.set_channel_handler(pAdapter, originChannel); - #endif - -#endif - -} - - -VOID -PHY_LCCalibrate_8188E( -#if (DM_ODM_SUPPORT_TYPE & ODM_AP) - IN PDM_ODM_T pDM_Odm -#else - IN struct adapter *pAdapter -#endif - ) -{ - BOOLEAN bStartContTx = FALSE, bSingleTone = FALSE, bCarrierSuppression = FALSE; - u4Byte timeout = 2000, timecount = 0; - -#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter); - - #if (DM_ODM_SUPPORT_TYPE == ODM_MP) - PDM_ODM_T pDM_Odm = &pHalData->DM_OutSrc; - #else // (DM_ODM_SUPPORT_TYPE == ODM_CE) - PDM_ODM_T pDM_Odm = &pHalData->odmpriv; - #endif - - #if (MP_DRIVER == 1) - #if (DM_ODM_SUPPORT_TYPE == ODM_MP) - PMPT_CONTEXT pMptCtx = &(pAdapter->MptCtx); - #else// (DM_ODM_SUPPORT_TYPE == ODM_CE) - PMPT_CONTEXT pMptCtx = &(pAdapter->mppriv.MptCtx); - #endif - #endif//(MP_DRIVER == 1) -#endif - - - - -#if MP_DRIVER == 1 -if (*(pDM_Odm->mp_mode) == 1) -{ - bStartContTx = pMptCtx->bStartContTx; - bSingleTone = pMptCtx->bSingleTone; - bCarrierSuppression = pMptCtx->bCarrierSuppression; -} -#endif - - -#if DISABLE_BB_RF - return; -#endif - -#if (DM_ODM_SUPPORT_TYPE == ODM_CE) - if(!(pDM_Odm->SupportAbility & ODM_RF_CALIBRATION)) - { - return; - } -#endif - // 20120213 Turn on when continuous Tx to pass lab testing. (required by Edlu) - if(bSingleTone || bCarrierSuppression) - return; - - while(*(pDM_Odm->pbScanInProcess) && timecount < timeout) - { - ODM_delay_ms(50); - timecount += 50; - } - - pDM_Odm->RFCalibrateInfo.bLCKInProgress = TRUE; - - //ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("LCK:Start!!!interface %d currentband %x delay %d ms\n", pDM_Odm->interfaceIndex, pHalData->CurrentBandType92D, timecount)); -#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) - - if(pDM_Odm->RFType == ODM_2T2R) - { - phy_LCCalibrate_8188E(pAdapter, TRUE); - } - else -#endif - { - // For 88C 1T1R -#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) - phy_LCCalibrate_8188E(pAdapter, FALSE); -#else - phy_LCCalibrate_8188E(pDM_Odm, FALSE); -#endif - } - - pDM_Odm->RFCalibrateInfo.bLCKInProgress = FALSE; - - ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("LCK:Finish!!!interface %d\n", pDM_Odm->InterfaceIndex)); - -} - -VOID -PHY_APCalibrate_8188E( -#if (DM_ODM_SUPPORT_TYPE & ODM_AP) - IN PDM_ODM_T pDM_Odm, -#else - IN struct adapter *pAdapter, -#endif - IN s1Byte delta - ) -{ -#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter); - #if (DM_ODM_SUPPORT_TYPE == ODM_CE) - PDM_ODM_T pDM_Odm = &pHalData->odmpriv; - #endif - #if (DM_ODM_SUPPORT_TYPE == ODM_MP) - PDM_ODM_T pDM_Odm = &pHalData->DM_OutSrc; - #endif -#endif -#if DISABLE_BB_RF - return; -#endif - - return; -#if (DM_ODM_SUPPORT_TYPE == ODM_CE) - if(!(pDM_Odm->SupportAbility & ODM_RF_CALIBRATION)) - { - return; - } -#endif - -#if FOR_BRAZIL_PRETEST != 1 - if(pDM_Odm->RFCalibrateInfo.bAPKdone) -#endif - return; - -#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) - if(pDM_Odm->RFType == ODM_2T2R){ - phy_APCalibrate_8188E(pAdapter, delta, TRUE); - } - else -#endif - { - // For 88C 1T1R -#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) - phy_APCalibrate_8188E(pAdapter, delta, FALSE); -#else - phy_APCalibrate_8188E(pDM_Odm, delta, FALSE); -#endif - } -} -VOID phy_SetRFPathSwitch_8188E( -#if (DM_ODM_SUPPORT_TYPE & ODM_AP) - IN PDM_ODM_T pDM_Odm, -#else - IN struct adapter *pAdapter, -#endif - IN BOOLEAN bMain, - IN BOOLEAN is2T - ) -{ -#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter); - #if (DM_ODM_SUPPORT_TYPE == ODM_CE) - PDM_ODM_T pDM_Odm = &pHalData->odmpriv; - #elif (DM_ODM_SUPPORT_TYPE == ODM_MP) - PDM_ODM_T pDM_Odm = &pHalData->DM_OutSrc; - #endif - - #if (DM_ODM_SUPPORT_TYPE == ODM_MP) - if(!pAdapter->bHWInitReady) - #elif (DM_ODM_SUPPORT_TYPE == ODM_CE) - if(pAdapter->hw_init_completed == _FALSE) - #endif - { - u1Byte u1bTmp; - u1bTmp = ODM_Read1Byte(pDM_Odm, REG_LEDCFG2) | BIT7; - ODM_Write1Byte(pDM_Odm, REG_LEDCFG2, u1bTmp); - //ODM_SetBBReg(pDM_Odm, REG_LEDCFG0, BIT23, 0x01); - ODM_SetBBReg(pDM_Odm, rFPGA0_XAB_RFParameter, BIT13, 0x01); - } - -#endif - - if(is2T) //92C - { - if(bMain) - ODM_SetBBReg(pDM_Odm, rFPGA0_XB_RFInterfaceOE, BIT5|BIT6, 0x1); //92C_Path_A - else - ODM_SetBBReg(pDM_Odm, rFPGA0_XB_RFInterfaceOE, BIT5|BIT6, 0x2); //BT - } - else //88C - { - - if(bMain) - ODM_SetBBReg(pDM_Odm, rFPGA0_XA_RFInterfaceOE, BIT8|BIT9, 0x2); //Main - else - ODM_SetBBReg(pDM_Odm, rFPGA0_XA_RFInterfaceOE, BIT8|BIT9, 0x1); //Aux - } -} -VOID PHY_SetRFPathSwitch_8188E( -#if (DM_ODM_SUPPORT_TYPE & ODM_AP) - IN PDM_ODM_T pDM_Odm, -#else - IN struct adapter *pAdapter, -#endif - IN BOOLEAN bMain - ) -{ -#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter); - #if (DM_ODM_SUPPORT_TYPE == ODM_CE) - PDM_ODM_T pDM_Odm = &pHalData->odmpriv; - #endif - #if (DM_ODM_SUPPORT_TYPE == ODM_MP) - PDM_ODM_T pDM_Odm = &pHalData->DM_OutSrc; - #endif -#endif - - -#if DISABLE_BB_RF - return; -#endif - -#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) - if(pDM_Odm->RFType == ODM_2T2R) - { - phy_SetRFPathSwitch_8188E(pAdapter, bMain, TRUE); - } - else -#endif - { - // For 88C 1T1R -#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) - phy_SetRFPathSwitch_8188E(pAdapter, bMain, FALSE); -#else - phy_SetRFPathSwitch_8188E(pDM_Odm, bMain, FALSE); -#endif - } -} - -#if (DM_ODM_SUPPORT_TYPE == ODM_MP) -//digital predistortion -VOID -phy_DigitalPredistortion( -#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) - IN struct adapter *pAdapter, -#else - IN PDM_ODM_T pDM_Odm, -#endif - IN BOOLEAN is2T - ) -{ -} - -VOID -PHY_DigitalPredistortion_8188E( -#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) - IN struct adapter *pAdapter -#else - IN PDM_ODM_T pDM_Odm -#endif - ) -{ -#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter); - #if (DM_ODM_SUPPORT_TYPE == ODM_CE) - PDM_ODM_T pDM_Odm = &pHalData->odmpriv; - #endif - #if (DM_ODM_SUPPORT_TYPE == ODM_MP) - PDM_ODM_T pDM_Odm = &pHalData->DM_OutSrc; - #endif -#endif -#if DISABLE_BB_RF - return; -#endif - - return; - - if(pDM_Odm->RFCalibrateInfo.bDPdone) - return; -#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) - - if(pDM_Odm->RFType == ODM_2T2R){ - phy_DigitalPredistortion(pAdapter, TRUE); - } - else -#endif - { - // For 88C 1T1R - phy_DigitalPredistortion(pAdapter, FALSE); - } -} - - - -//return value TRUE => Main; FALSE => Aux - -BOOLEAN phy_QueryRFPathSwitch_8188E( -#if (DM_ODM_SUPPORT_TYPE & ODM_AP) - IN PDM_ODM_T pDM_Odm, -#else - IN struct adapter *pAdapter, -#endif - IN BOOLEAN is2T - ) -{ -#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter); - #if (DM_ODM_SUPPORT_TYPE == ODM_CE) - PDM_ODM_T pDM_Odm = &pHalData->odmpriv; - #endif - #if (DM_ODM_SUPPORT_TYPE == ODM_MP) - PDM_ODM_T pDM_Odm = &pHalData->DM_OutSrc; - #endif -#endif - if(!pAdapter->bHWInitReady) - { - u1Byte u1bTmp; - u1bTmp = ODM_Read1Byte(pDM_Odm, REG_LEDCFG2) | BIT7; - ODM_Write1Byte(pDM_Odm, REG_LEDCFG2, u1bTmp); - //ODM_SetBBReg(pDM_Odm, REG_LEDCFG0, BIT23, 0x01); - ODM_SetBBReg(pDM_Odm, rFPGA0_XAB_RFParameter, BIT13, 0x01); - } - - if(is2T) // - { - if(ODM_GetBBReg(pDM_Odm, rFPGA0_XB_RFInterfaceOE, BIT5|BIT6) == 0x01) - return TRUE; - else - return FALSE; - } - else - { - if(ODM_GetBBReg(pDM_Odm, rFPGA0_XA_RFInterfaceOE, BIT8|BIT9) == 0x02) - return TRUE; - else - return FALSE; - } -} - - - -//return value TRUE => Main; FALSE => Aux -BOOLEAN PHY_QueryRFPathSwitch_8188E( -#if (DM_ODM_SUPPORT_TYPE & ODM_AP) - IN PDM_ODM_T pDM_Odm -#else - IN struct adapter *pAdapter -#endif - ) -{ -#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter); - #if (DM_ODM_SUPPORT_TYPE == ODM_CE) - PDM_ODM_T pDM_Odm = &pHalData->odmpriv; - #endif - #if (DM_ODM_SUPPORT_TYPE == ODM_MP) - PDM_ODM_T pDM_Odm = &pHalData->DM_OutSrc; - #endif -#endif - - -#if DISABLE_BB_RF - return TRUE; -#endif -#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) - - //if(IS_92C_SERIAL( pHalData->VersionID)){ - if(pDM_Odm->RFType == ODM_2T2R){ - return phy_QueryRFPathSwitch_8188E(pAdapter, TRUE); - } - else -#endif - { - // For 88C 1T1R -#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) - return phy_QueryRFPathSwitch_8188E(pAdapter, FALSE); -#else - return phy_QueryRFPathSwitch_8188E(pDM_Odm, FALSE); -#endif - } -} -#endif + +/****************************************************************************** + * + * 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 + * + * + ******************************************************************************/ + +#include "odm_precomp.h" + + + +/*---------------------------Define Local Constant---------------------------*/ +// 2010/04/25 MH Define the max tx power tracking tx agc power. +#define ODM_TXPWRTRACK_MAX_IDX_88E 6 + +#define CALCULATE_SWINGTALBE_OFFSET(_offset, _direction, _size, _deltaThermal) \ + do {\ + for(_offset = 0; _offset < _size; _offset++)\ + {\ + if(_deltaThermal < thermalThreshold[_direction][_offset])\ + {\ + if(_offset != 0)\ + _offset--;\ + break;\ + }\ + } \ + if(_offset >= _size)\ + _offset = _size-1;\ + } while(0) + +//3============================================================ +//3 Tx Power Tracking +//3============================================================ +void setIqkMatrix( + PDM_ODM_T pDM_Odm, + u1Byte OFDM_index, + u1Byte RFPath, + s4Byte IqkResult_X, + s4Byte IqkResult_Y + ) +{ + s4Byte ele_A=0, ele_D, ele_C=0, TempCCk, value32; + + //printk("%s==> OFDM_index:%d \n",__FUNCTION__,OFDM_index); + + //if(OFDM_index> OFDM_TABLE_SIZE_92D) + //{ + //printk("%s==> OFDM_index> 43\n",__FUNCTION__); + //} + ele_D = (OFDMSwingTable[OFDM_index] & 0xFFC00000)>>22; + + //new element A = element D x X + if((IqkResult_X != 0) && (*(pDM_Odm->pBandType) == ODM_BAND_2_4G)) + { + if ((IqkResult_X & 0x00000200) != 0) //consider minus + IqkResult_X = IqkResult_X | 0xFFFFFC00; + ele_A = ((IqkResult_X * ele_D)>>8)&0x000003FF; + + //new element C = element D x Y + if ((IqkResult_Y & 0x00000200) != 0) + IqkResult_Y = IqkResult_Y | 0xFFFFFC00; + ele_C = ((IqkResult_Y * ele_D)>>8)&0x000003FF; + + if (RFPath == RF_PATH_A) + switch (RFPath) + { + case RF_PATH_A: + //wirte new elements A, C, D to regC80 and regC94, element B is always 0 + value32 = (ele_D<<22)|((ele_C&0x3F)<<16)|ele_A; + ODM_SetBBReg(pDM_Odm, rOFDM0_XATxIQImbalance, bMaskDWord, value32); + + value32 = (ele_C&0x000003C0)>>6; + ODM_SetBBReg(pDM_Odm, rOFDM0_XCTxAFE, bMaskH4Bits, value32); + + value32 = ((IqkResult_X * ele_D)>>7)&0x01; + ODM_SetBBReg(pDM_Odm, rOFDM0_ECCAThreshold, BIT24, value32); + break; + case RF_PATH_B: + //wirte new elements A, C, D to regC88 and regC9C, element B is always 0 + value32=(ele_D<<22)|((ele_C&0x3F)<<16) |ele_A; + ODM_SetBBReg(pDM_Odm, rOFDM0_XBTxIQImbalance, bMaskDWord, value32); + + value32 = (ele_C&0x000003C0)>>6; + ODM_SetBBReg(pDM_Odm, rOFDM0_XDTxAFE, bMaskH4Bits, value32); + + value32 = ((IqkResult_X * ele_D)>>7)&0x01; + ODM_SetBBReg(pDM_Odm, rOFDM0_ECCAThreshold, BIT28, value32); + + break; + default: + break; + } + } + else + { + switch (RFPath) + { + case RF_PATH_A: + ODM_SetBBReg(pDM_Odm, rOFDM0_XATxIQImbalance, bMaskDWord, OFDMSwingTable[OFDM_index]); + ODM_SetBBReg(pDM_Odm, rOFDM0_XCTxAFE, bMaskH4Bits, 0x00); + ODM_SetBBReg(pDM_Odm, rOFDM0_ECCAThreshold, BIT24, 0x00); + break; + + case RF_PATH_B: + ODM_SetBBReg(pDM_Odm, rOFDM0_XBTxIQImbalance, bMaskDWord, OFDMSwingTable[OFDM_index]); + ODM_SetBBReg(pDM_Odm, rOFDM0_XDTxAFE, bMaskH4Bits, 0x00); + ODM_SetBBReg(pDM_Odm, rOFDM0_ECCAThreshold, BIT28, 0x00); + break; + + default: + break; + } + } + + ODM_RT_TRACE(pDM_Odm,ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ("TxPwrTracking path B: X = 0x%x, Y = 0x%x ele_A = 0x%x ele_C = 0x%x ele_D = 0x%x 0xeb4 = 0x%x 0xebc = 0x%x\n", + (u4Byte)IqkResult_X, (u4Byte)IqkResult_Y, (u4Byte)ele_A, (u4Byte)ele_C, (u4Byte)ele_D, (u4Byte)IqkResult_X, (u4Byte)IqkResult_Y)); +} + + +void doIQK( + PDM_ODM_T pDM_Odm, + u1Byte DeltaThermalIndex, + u1Byte ThermalValue, + u1Byte Threshold + ) +{ +#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) + struct adapter * Adapter = pDM_Odm->Adapter; + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); +#endif + + ODM_ResetIQKResult(pDM_Odm); + +#if(DM_ODM_SUPPORT_TYPE & ODM_MP) +#if (DEV_BUS_TYPE == RT_PCI_INTERFACE) +#if USE_WORKITEM + PlatformAcquireMutex(&pHalData->mxChnlBwControl); +#else + PlatformAcquireSpinLock(Adapter, RT_CHANNEL_AND_BANDWIDTH_SPINLOCK); +#endif +#elif((DEV_BUS_TYPE == RT_USB_INTERFACE) || (DEV_BUS_TYPE == RT_SDIO_INTERFACE)) + PlatformAcquireMutex(&pHalData->mxChnlBwControl); +#endif +#endif + + + pDM_Odm->RFCalibrateInfo.ThermalValue_IQK= ThermalValue; + PHY_IQCalibrate_8188E(Adapter, FALSE); + + +#if(DM_ODM_SUPPORT_TYPE & ODM_MP) +#if (DEV_BUS_TYPE == RT_PCI_INTERFACE) +#if USE_WORKITEM + PlatformReleaseMutex(&pHalData->mxChnlBwControl); +#else + PlatformReleaseSpinLock(Adapter, RT_CHANNEL_AND_BANDWIDTH_SPINLOCK); +#endif +#elif((DEV_BUS_TYPE == RT_USB_INTERFACE) || (DEV_BUS_TYPE == RT_SDIO_INTERFACE)) + PlatformReleaseMutex(&pHalData->mxChnlBwControl); +#endif +#endif +} + +/*----------------------------------------------------------------------------- + * Function: ODM_TxPwrTrackAdjust88E() + * + * Overview: 88E we can not write 0xc80/c94/c4c/ 0xa2x. Instead of write TX agc. + * No matter OFDM & CCK use the same method. + * + * Input: NONE + * + * Output: NONE + * + * Return: NONE + * + * Revised History: + * When Who Remark + * 04/23/2012 MHC Create Version 0. + * 04/23/2012 MHC Adjust TX agc directly not throughput BB digital. + * + *---------------------------------------------------------------------------*/ +VOID +ODM_TxPwrTrackAdjust88E( + PDM_ODM_T pDM_Odm, + u1Byte Type, // 0 = OFDM, 1 = CCK + pu1Byte pDirection, // 1 = +(increase) 2 = -(decrease) + pu4Byte pOutWriteVal // Tx tracking CCK/OFDM BB swing index adjust + ) +{ + u1Byte pwr_value = 0; + // + // Tx power tracking BB swing table. + // The base index = 12. +((12-n)/2)dB 13~?? = decrease tx pwr by -((n-12)/2)dB + // + if (Type == 0) // For OFDM afjust + { + ODM_RT_TRACE(pDM_Odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, + ("BbSwingIdxOfdm = %d BbSwingFlagOfdm=%d\n", pDM_Odm->BbSwingIdxOfdm, pDM_Odm->BbSwingFlagOfdm)); + + //printk("BbSwingIdxOfdm = %d BbSwingFlagOfdm=%d\n", pDM_Odm->BbSwingIdxOfdm, pDM_Odm->BbSwingFlagOfdm); + if (pDM_Odm->BbSwingIdxOfdm <= pDM_Odm->BbSwingIdxOfdmBase) + { + *pDirection = 1; + pwr_value = (pDM_Odm->BbSwingIdxOfdmBase - pDM_Odm->BbSwingIdxOfdm); + } + else + { + *pDirection = 2; + pwr_value = (pDM_Odm->BbSwingIdxOfdm - pDM_Odm->BbSwingIdxOfdmBase); + } + + ODM_RT_TRACE(pDM_Odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, + ("BbSwingIdxOfdm = %d BbSwingIdxOfdmBase=%d\n", pDM_Odm->BbSwingIdxOfdm, pDM_Odm->BbSwingIdxOfdmBase)); + //printk("BbSwingIdxOfdm = %d BbSwingIdxOfdmBase=%d pwr_value=%d\n", pDM_Odm->BbSwingIdxOfdm, pDM_Odm->BbSwingIdxOfdmBase,pwr_value); + + } + else if (Type == 1) // For CCK adjust. + { + ODM_RT_TRACE(pDM_Odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, + ("pDM_Odm->BbSwingIdxCck = %d pDM_Odm->BbSwingIdxCckBase = %d\n", pDM_Odm->BbSwingIdxCck, pDM_Odm->BbSwingIdxCckBase)); + + //printk("pDM_Odm->BbSwingIdxCck = %d pDM_Odm->BbSwingIdxCckBase = %d\n", pDM_Odm->BbSwingIdxCck, pDM_Odm->BbSwingIdxCckBase); + if (pDM_Odm->BbSwingIdxCck <= pDM_Odm->BbSwingIdxCckBase) + { + *pDirection = 1; + pwr_value = (pDM_Odm->BbSwingIdxCckBase - pDM_Odm->BbSwingIdxCck); + } + else + { + *pDirection = 2; + pwr_value = (pDM_Odm->BbSwingIdxCck - pDM_Odm->BbSwingIdxCckBase); + } + //printk("pDM_Odm->BbSwingIdxCck = %d pDM_Odm->BbSwingIdxCckBase = %d pwr_value:%d\n", pDM_Odm->BbSwingIdxCck, pDM_Odm->BbSwingIdxCckBase,pwr_value); + } + + // + // 2012/04/25 MH According to Ed/Luke.Lees estimate for EVM the max tx power tracking + // need to be less than 6 power index for 88E. + // + if (pwr_value >= ODM_TXPWRTRACK_MAX_IDX_88E && *pDirection == 1) + pwr_value = ODM_TXPWRTRACK_MAX_IDX_88E; + + *pOutWriteVal = pwr_value | (pwr_value<<8) | (pwr_value<<16) | (pwr_value<<24); + +} // ODM_TxPwrTrackAdjust88E + + +/*----------------------------------------------------------------------------- + * Function: odm_TxPwrTrackSetPwr88E() + * + * Overview: 88E change all channel tx power accordign to flag. + * OFDM & CCK are all different. + * + * Input: NONE + * + * Output: NONE + * + * Return: NONE + * + * Revised History: + * When Who Remark + * 04/23/2012 MHC Create Version 0. + * + *---------------------------------------------------------------------------*/ +VOID +odm_TxPwrTrackSetPwr88E( + PDM_ODM_T pDM_Odm, + PWRTRACK_METHOD Method, + u1Byte RFPath, + u1Byte ChannelMappedIndex + ) +{ + if (Method == TXAGC) + { + u1Byte cckPowerLevel[MAX_TX_COUNT], ofdmPowerLevel[MAX_TX_COUNT]; + u1Byte BW20PowerLevel[MAX_TX_COUNT], BW40PowerLevel[MAX_TX_COUNT]; + u1Byte rf = 0; + u4Byte pwr = 0, TxAGC = 0; + struct adapter *Adapter = pDM_Odm->Adapter; + //printk("odm_TxPwrTrackSetPwr88E CH=%d, modify TXAGC \n", *(pDM_Odm->pChannel)); + ODM_RT_TRACE(pDM_Odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ("odm_TxPwrTrackSetPwr88E CH=%d\n", *(pDM_Odm->pChannel))); +#if (DM_ODM_SUPPORT_TYPE & (ODM_MP|ODM_CE )) + + //#if (MP_DRIVER != 1) + if ( *(pDM_Odm->mp_mode) != 1){ + PHY_SetTxPowerLevel8188E(pDM_Odm->Adapter, *pDM_Odm->pChannel); + } + else + //#else + { + pwr = PHY_QueryBBReg(Adapter, rTxAGC_A_Rate18_06, 0xFF); + pwr += (pDM_Odm->BbSwingIdxCck - pDM_Odm->BbSwingIdxCckBase); + PHY_SetBBReg(Adapter, rTxAGC_A_CCK1_Mcs32, bMaskByte1, pwr); + TxAGC = (pwr<<16)|(pwr<<8)|(pwr); + PHY_SetBBReg(Adapter, rTxAGC_B_CCK11_A_CCK2_11, 0xffffff00, TxAGC); + DBG_871X("ODM_TxPwrTrackSetPwr88E: CCK Tx-rf(A) Power = 0x%x\n", TxAGC); + + pwr = PHY_QueryBBReg(Adapter, rTxAGC_A_Rate18_06, 0xFF); + pwr += (pDM_Odm->BbSwingIdxOfdm - pDM_Odm->BbSwingIdxOfdmBase); + TxAGC |= ((pwr<<24)|(pwr<<16)|(pwr<<8)|pwr); + PHY_SetBBReg(Adapter, rTxAGC_A_Rate18_06, bMaskDWord, TxAGC); + PHY_SetBBReg(Adapter, rTxAGC_A_Rate54_24, bMaskDWord, TxAGC); + PHY_SetBBReg(Adapter, rTxAGC_A_Mcs03_Mcs00, bMaskDWord, TxAGC); + PHY_SetBBReg(Adapter, rTxAGC_A_Mcs07_Mcs04, bMaskDWord, TxAGC); + PHY_SetBBReg(Adapter, rTxAGC_A_Mcs11_Mcs08, bMaskDWord, TxAGC); + PHY_SetBBReg(Adapter, rTxAGC_A_Mcs15_Mcs12, bMaskDWord, TxAGC); + DBG_871X("ODM_TxPwrTrackSetPwr88E: OFDM Tx-rf(A) Power = 0x%x\n", TxAGC); + } + //#endif + +#endif +#if (DM_ODM_SUPPORT_TYPE & ODM_AP) + PHY_RF6052SetCCKTxPower(pDM_Odm->priv, *(pDM_Odm->pChannel)); + PHY_RF6052SetOFDMTxPower(pDM_Odm->priv, *(pDM_Odm->pChannel)); +#endif + + } + else if (Method == BBSWING) + { + //printk("odm_TxPwrTrackSetPwr88E CH=%d, modify BBSWING BbSwingIdxCck:%d \n", *(pDM_Odm->pChannel),pDM_Odm->BbSwingIdxCck); + // Adjust BB swing by CCK filter coefficient + //if(!pDM_Odm->RFCalibrateInfo.bCCKinCH14) + if(* (pDM_Odm->pChannel) < 14) + { + ODM_Write1Byte(pDM_Odm, 0xa22, CCKSwingTable_Ch1_Ch13[pDM_Odm->BbSwingIdxCck][0]); + ODM_Write1Byte(pDM_Odm, 0xa23, CCKSwingTable_Ch1_Ch13[pDM_Odm->BbSwingIdxCck][1]); + ODM_Write1Byte(pDM_Odm, 0xa24, CCKSwingTable_Ch1_Ch13[pDM_Odm->BbSwingIdxCck][2]); + ODM_Write1Byte(pDM_Odm, 0xa25, CCKSwingTable_Ch1_Ch13[pDM_Odm->BbSwingIdxCck][3]); + ODM_Write1Byte(pDM_Odm, 0xa26, CCKSwingTable_Ch1_Ch13[pDM_Odm->BbSwingIdxCck][4]); + ODM_Write1Byte(pDM_Odm, 0xa27, CCKSwingTable_Ch1_Ch13[pDM_Odm->BbSwingIdxCck][5]); + ODM_Write1Byte(pDM_Odm, 0xa28, CCKSwingTable_Ch1_Ch13[pDM_Odm->BbSwingIdxCck][6]); + ODM_Write1Byte(pDM_Odm, 0xa29, CCKSwingTable_Ch1_Ch13[pDM_Odm->BbSwingIdxCck][7]); + } + else + { + ODM_Write1Byte(pDM_Odm, 0xa22, CCKSwingTable_Ch14[pDM_Odm->BbSwingIdxCck][0]); + ODM_Write1Byte(pDM_Odm, 0xa23, CCKSwingTable_Ch14[pDM_Odm->BbSwingIdxCck][1]); + ODM_Write1Byte(pDM_Odm, 0xa24, CCKSwingTable_Ch14[pDM_Odm->BbSwingIdxCck][2]); + ODM_Write1Byte(pDM_Odm, 0xa25, CCKSwingTable_Ch14[pDM_Odm->BbSwingIdxCck][3]); + ODM_Write1Byte(pDM_Odm, 0xa26, CCKSwingTable_Ch14[pDM_Odm->BbSwingIdxCck][4]); + ODM_Write1Byte(pDM_Odm, 0xa27, CCKSwingTable_Ch14[pDM_Odm->BbSwingIdxCck][5]); + ODM_Write1Byte(pDM_Odm, 0xa28, CCKSwingTable_Ch14[pDM_Odm->BbSwingIdxCck][6]); + ODM_Write1Byte(pDM_Odm, 0xa29, CCKSwingTable_Ch14[pDM_Odm->BbSwingIdxCck][7]); + } + + // Adjust BB swing by OFDM IQ matrix + if (RFPath == RF_PATH_A) + { + setIqkMatrix(pDM_Odm, pDM_Odm->BbSwingIdxOfdm, RF_PATH_A, + pDM_Odm->RFCalibrateInfo.IQKMatrixRegSetting[ChannelMappedIndex].Value[0][0], + pDM_Odm->RFCalibrateInfo.IQKMatrixRegSetting[ChannelMappedIndex].Value[0][1]); + } + /* + else if (RFPath == RF_PATH_B) + { + setIqkMatrix(pDM_Odm, pDM_Odm->BbSwingIdxOfdm[RF_PATH_B], RF_PATH_B, + pDM_Odm->RFCalibrateInfo.IQKMatrixRegSetting[ChannelMappedIndex].Value[0][4], + pDM_Odm->RFCalibrateInfo.IQKMatrixRegSetting[ChannelMappedIndex].Value[0][5]); + }*/ + } + else + { + return; + } +} // odm_TxPwrTrackSetPwr88E + + +VOID +odm_TXPowerTrackingCallback_ThermalMeter_8188E( +#if (DM_ODM_SUPPORT_TYPE & ODM_AP) + IN PDM_ODM_T pDM_Odm +#else + IN struct adapter *Adapter +#endif + ) +{ + +#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); + //PMGNT_INFO pMgntInfo = &Adapter->MgntInfo; +#endif + + u1Byte ThermalValue = 0, delta, delta_LCK, delta_IQK, offset; + u1Byte ThermalValue_AVG_count = 0; + u4Byte ThermalValue_AVG = 0; + s4Byte ele_A=0, ele_D, TempCCk, X, value32; + s4Byte Y, ele_C=0; + s1Byte OFDM_index[2], CCK_index=0, OFDM_index_old[2]={0,0}, CCK_index_old=0, index; + s1Byte deltaPowerIndex = 0; + u4Byte i = 0, j = 0; + BOOLEAN is2T = FALSE; + BOOLEAN bInteralPA = FALSE; + + u1Byte OFDM_min_index = 6, rf = (is2T) ? 2 : 1; //OFDM BB Swing should be less than +3.0dB, which is required by Arthur + u1Byte Indexforchannel = 0;/*GetRightChnlPlaceforIQK(pHalData->CurrentChannel)*/ + enum _POWER_DEC_INC { POWER_DEC, POWER_INC }; + #if (DM_ODM_SUPPORT_TYPE == ODM_CE) + PDM_ODM_T pDM_Odm = &pHalData->odmpriv; + struct dm_priv *pdmpriv = &pHalData->dmpriv; + #endif + #if (DM_ODM_SUPPORT_TYPE == ODM_MP) + PDM_ODM_T pDM_Odm = &pHalData->DM_OutSrc; + #endif + + //4 0.1 The following TWO tables decide the final index of OFDM/CCK swing table. + s1Byte deltaSwingTableIdx[2][index_mapping_NUM_88E] = { + // {{Power decreasing(lower temperature)}, {Power increasing(higher temperature)}} + {0,0,2,3,4,4,5,6,7,7,8,9,10,10,11}, {0,0,-1,-2,-3,-4,-4,-4,-4,-5,-7,-8,-9,-9,-10} + }; + u1Byte thermalThreshold[2][index_mapping_NUM_88E]={ + // {{Power decreasing(lower temperature)}, {Power increasing(higher temperature)}} + {0,2,4,6,8,10,12,14,16,18,20,22,24,26,27}, {0,2,4,6,8,10,12,14,16,18,20,22,25,25,25} + }; + + //4 0.1 Initilization ( 7 steps in total ) + + pDM_Odm->RFCalibrateInfo.TXPowerTrackingCallbackCnt++; //cosa add for debug + pDM_Odm->RFCalibrateInfo.bTXPowerTrackingInit = TRUE; + +#if (MP_DRIVER == 1) +#if (DM_ODM_SUPPORT_TYPE == ODM_MP) + pDM_Odm->RFCalibrateInfo.TxPowerTrackControl = pHalData->TxPowerTrackControl; // We should keep updating the control variable according to HalData. +#endif + // RFCalibrateInfo.RegA24 will be initialized when ODM HW configuring, but MP configures with para files. + pDM_Odm->RFCalibrateInfo.RegA24 = 0x090e1317; +#endif + + ODM_RT_TRACE(pDM_Odm,ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,("===>odm_TXPowerTrackingCallback_ThermalMeter_8188E, pDM_Odm->BbSwingIdxCckBase: %d, pDM_Odm->BbSwingIdxOfdmBase: %d \n", pDM_Odm->BbSwingIdxCckBase, pDM_Odm->BbSwingIdxOfdmBase)); + ThermalValue = (u1Byte)ODM_GetRFReg(pDM_Odm, RF_PATH_A, RF_T_METER_88E, 0xfc00); //0x42: RF Reg[15:10] 88E + if( ! ThermalValue || ! pDM_Odm->RFCalibrateInfo.TxPowerTrackControl) + return; + + //4 3. Initialize ThermalValues of RFCalibrateInfo + + if( ! pDM_Odm->RFCalibrateInfo.ThermalValue) + { + pDM_Odm->RFCalibrateInfo.ThermalValue_LCK = ThermalValue; + pDM_Odm->RFCalibrateInfo.ThermalValue_IQK = ThermalValue; + } + + if(pDM_Odm->RFCalibrateInfo.bReloadtxpowerindex) + { + ODM_RT_TRACE(pDM_Odm,ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,("reload ofdm index for band switch\n")); + } + + //4 4. Calculate average thermal meter + + pDM_Odm->RFCalibrateInfo.ThermalValue_AVG[pDM_Odm->RFCalibrateInfo.ThermalValue_AVG_index] = ThermalValue; + pDM_Odm->RFCalibrateInfo.ThermalValue_AVG_index++; + if(pDM_Odm->RFCalibrateInfo.ThermalValue_AVG_index == AVG_THERMAL_NUM_88E) + pDM_Odm->RFCalibrateInfo.ThermalValue_AVG_index = 0; + + for(i = 0; i < AVG_THERMAL_NUM_88E; i++) + { + if(pDM_Odm->RFCalibrateInfo.ThermalValue_AVG[i]) + { + ThermalValue_AVG += pDM_Odm->RFCalibrateInfo.ThermalValue_AVG[i]; + ThermalValue_AVG_count++; + } + } + + if(ThermalValue_AVG_count) + { + ThermalValue = (u1Byte)(ThermalValue_AVG / ThermalValue_AVG_count); + ODM_RT_TRACE(pDM_Odm,ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,("AVG Thermal Meter = 0x%x \n", ThermalValue)); + } + + //4 5. Calculate delta, delta_LCK, delta_IQK. + + delta = (ThermalValue > pDM_Odm->RFCalibrateInfo.ThermalValue)?(ThermalValue - pDM_Odm->RFCalibrateInfo.ThermalValue):(pDM_Odm->RFCalibrateInfo.ThermalValue - ThermalValue); + delta_LCK = (ThermalValue > pDM_Odm->RFCalibrateInfo.ThermalValue_LCK)?(ThermalValue - pDM_Odm->RFCalibrateInfo.ThermalValue_LCK):(pDM_Odm->RFCalibrateInfo.ThermalValue_LCK - ThermalValue); + delta_IQK = (ThermalValue > pDM_Odm->RFCalibrateInfo.ThermalValue_IQK)?(ThermalValue - pDM_Odm->RFCalibrateInfo.ThermalValue_IQK):(pDM_Odm->RFCalibrateInfo.ThermalValue_IQK - ThermalValue); + + //4 6. If necessary, do LCK. + + //if((delta_LCK > pHalData->Delta_LCK) && (pHalData->Delta_LCK != 0)) + if ((delta_LCK >= 8)) // Delta temperature is equal to or larger than 20 centigrade. + { + pDM_Odm->RFCalibrateInfo.ThermalValue_LCK = ThermalValue; +#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) + PHY_LCCalibrate_8188E(Adapter); +#else + PHY_LCCalibrate_8188E(pDM_Odm); +#endif + } + + //3 7. If necessary, move the index of swing table to adjust Tx power. + + if (delta > 0 && pDM_Odm->RFCalibrateInfo.TxPowerTrackControl) + { +#if (DM_ODM_SUPPORT_TYPE & (ODM_MP|ODM_CE)) + delta = ThermalValue > pHalData->EEPROMThermalMeter?(ThermalValue - pHalData->EEPROMThermalMeter):(pHalData->EEPROMThermalMeter - ThermalValue); +#else + delta = (ThermalValue > pDM_Odm->priv->pmib->dot11RFEntry.ther)?(ThermalValue - pDM_Odm->priv->pmib->dot11RFEntry.ther):(pDM_Odm->priv->pmib->dot11RFEntry.ther - ThermalValue); +#endif + + + //4 7.1 The Final Power Index = BaseIndex + PowerIndexOffset + +#if (DM_ODM_SUPPORT_TYPE & (ODM_MP|ODM_CE)) + if(ThermalValue > pHalData->EEPROMThermalMeter) { +#else + if(ThermalValue > pDM_Odm->priv->pmib->dot11RFEntry.ther) { +#endif + CALCULATE_SWINGTALBE_OFFSET(offset, POWER_INC, index_mapping_NUM_88E, delta); + pDM_Odm->RFCalibrateInfo.DeltaPowerIndexLast = pDM_Odm->RFCalibrateInfo.DeltaPowerIndex; + pDM_Odm->RFCalibrateInfo.DeltaPowerIndex = -1 * deltaSwingTableIdx[POWER_INC][offset]; + + } else { + + CALCULATE_SWINGTALBE_OFFSET(offset, POWER_DEC, index_mapping_NUM_88E, delta); + pDM_Odm->RFCalibrateInfo.DeltaPowerIndexLast = pDM_Odm->RFCalibrateInfo.DeltaPowerIndex; + pDM_Odm->RFCalibrateInfo.DeltaPowerIndex = -1 * deltaSwingTableIdx[POWER_DEC][offset]; + } + + if (pDM_Odm->RFCalibrateInfo.DeltaPowerIndex == pDM_Odm->RFCalibrateInfo.DeltaPowerIndexLast) + pDM_Odm->RFCalibrateInfo.PowerIndexOffset = 0; + else + pDM_Odm->RFCalibrateInfo.PowerIndexOffset = pDM_Odm->RFCalibrateInfo.DeltaPowerIndex - pDM_Odm->RFCalibrateInfo.DeltaPowerIndexLast; + + for(i = 0; i < rf; i++) + pDM_Odm->RFCalibrateInfo.OFDM_index[i] = pDM_Odm->BbSwingIdxOfdmBase + pDM_Odm->RFCalibrateInfo.PowerIndexOffset; + pDM_Odm->RFCalibrateInfo.CCK_index = pDM_Odm->BbSwingIdxCckBase + pDM_Odm->RFCalibrateInfo.PowerIndexOffset; + + pDM_Odm->BbSwingIdxCck = pDM_Odm->RFCalibrateInfo.CCK_index; + pDM_Odm->BbSwingIdxOfdm = pDM_Odm->RFCalibrateInfo.OFDM_index[RF_PATH_A]; + + ODM_RT_TRACE(pDM_Odm,ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,("The 'CCK' final index(%d) = BaseIndex(%d) + PowerIndexOffset(%d)\n", pDM_Odm->BbSwingIdxCck, pDM_Odm->BbSwingIdxCckBase, pDM_Odm->RFCalibrateInfo.PowerIndexOffset)); + ODM_RT_TRACE(pDM_Odm,ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,("The 'OFDM' final index(%d) = BaseIndex(%d) + PowerIndexOffset(%d)\n", pDM_Odm->BbSwingIdxOfdm, pDM_Odm->BbSwingIdxOfdmBase, pDM_Odm->RFCalibrateInfo.PowerIndexOffset)); + + //4 7.1 Handle boundary conditions of index. + + + for(i = 0; i < rf; i++) + { + if(pDM_Odm->RFCalibrateInfo.OFDM_index[i] > OFDM_TABLE_SIZE_92D-1) + { + pDM_Odm->RFCalibrateInfo.OFDM_index[i] = OFDM_TABLE_SIZE_92D-1; + } + else if (pDM_Odm->RFCalibrateInfo.OFDM_index[i] < OFDM_min_index) + { + pDM_Odm->RFCalibrateInfo.OFDM_index[i] = OFDM_min_index; + } + } + + if(pDM_Odm->RFCalibrateInfo.CCK_index > CCK_TABLE_SIZE-1) + pDM_Odm->RFCalibrateInfo.CCK_index = CCK_TABLE_SIZE-1; + else if (pDM_Odm->RFCalibrateInfo.CCK_index < 0) + pDM_Odm->RFCalibrateInfo.CCK_index = 0; + } + else + { + ODM_RT_TRACE(pDM_Odm,ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, + ("The thermal meter is unchanged or TxPowerTracking OFF: ThermalValue: %d , pDM_Odm->RFCalibrateInfo.ThermalValue: %d)\n", ThermalValue, pDM_Odm->RFCalibrateInfo.ThermalValue)); + pDM_Odm->RFCalibrateInfo.PowerIndexOffset = 0; + } + ODM_RT_TRACE(pDM_Odm,ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, + ("TxPowerTracking: [CCK] Swing Current Index: %d, Swing Base Index: %d\n", pDM_Odm->RFCalibrateInfo.CCK_index, pDM_Odm->BbSwingIdxCckBase)); + + ODM_RT_TRACE(pDM_Odm,ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, + ("TxPowerTracking: [OFDM] Swing Current Index: %d, Swing Base Index: %d\n", pDM_Odm->RFCalibrateInfo.OFDM_index[RF_PATH_A], pDM_Odm->BbSwingIdxOfdmBase)); + + if (pDM_Odm->RFCalibrateInfo.PowerIndexOffset != 0 && pDM_Odm->RFCalibrateInfo.TxPowerTrackControl) + { + //4 7.2 Configure the Swing Table to adjust Tx Power. + + pDM_Odm->RFCalibrateInfo.bTxPowerChanged = TRUE; // Always TRUE after Tx Power is adjusted by power tracking. + // + // 2012/04/23 MH According to Luke's suggestion, we can not write BB digital + // to increase TX power. Otherwise, EVM will be bad. + // + // 2012/04/25 MH Add for tx power tracking to set tx power in tx agc for 88E. + if (ThermalValue > pDM_Odm->RFCalibrateInfo.ThermalValue) + { + ODM_RT_TRACE(pDM_Odm,ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, + ("Temperature Increasing: delta_pi: %d , delta_t: %d, Now_t: %d, EFUSE_t: %d, Last_t: %d\n", + pDM_Odm->RFCalibrateInfo.PowerIndexOffset, delta, ThermalValue, pHalData->EEPROMThermalMeter, pDM_Odm->RFCalibrateInfo.ThermalValue)); + } + else if (ThermalValue < pDM_Odm->RFCalibrateInfo.ThermalValue)// Low temperature + { + ODM_RT_TRACE(pDM_Odm,ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, + ("Temperature Decreasing: delta_pi: %d , delta_t: %d, Now_t: %d, EFUSE_t: %d, Last_t: %d\n", + pDM_Odm->RFCalibrateInfo.PowerIndexOffset, delta, ThermalValue, pHalData->EEPROMThermalMeter, pDM_Odm->RFCalibrateInfo.ThermalValue)); + } + + if (ThermalValue > pHalData->EEPROMThermalMeter) + { + ODM_RT_TRACE(pDM_Odm,ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,("Temperature(%d) hugher than PG value(%d), increases the power by TxAGC\n", ThermalValue, pHalData->EEPROMThermalMeter)); + odm_TxPwrTrackSetPwr88E(pDM_Odm, TXAGC, 0, 0); + } + else + { + ODM_RT_TRACE(pDM_Odm,ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,("Temperature(%d) lower than PG value(%d), increases the power by TxAGC\n", ThermalValue, pHalData->EEPROMThermalMeter)); + odm_TxPwrTrackSetPwr88E(pDM_Odm, BBSWING, RF_PATH_A, Indexforchannel); + //if(is2T) + // odm_TxPwrTrackSetPwr88E(pDM_Odm, BBSWING, RF_PATH_B, Indexforchannel); + } + + pDM_Odm->BbSwingIdxCckBase = pDM_Odm->BbSwingIdxCck; + pDM_Odm->BbSwingIdxOfdmBase = pDM_Odm->BbSwingIdxOfdm; + pDM_Odm->RFCalibrateInfo.ThermalValue = ThermalValue; + + } + +#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) + // if((delta_IQK > pHalData->Delta_IQK) && (pHalData->Delta_IQK != 0)) + if ((delta_IQK >= 8)){ // Delta temperature is equal to or larger than 20 centigrade. + //printk("delta_IQK(%d) >=8 do_IQK\n",delta_IQK); + doIQK(pDM_Odm, delta_IQK, ThermalValue, 8); + } +#endif + + ODM_RT_TRACE(pDM_Odm,ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,("<===dm_TXPowerTrackingCallback_ThermalMeter_8188E\n")); + + pDM_Odm->RFCalibrateInfo.TXPowercount = 0; +} + + + + + + +//1 7. IQK +#define MAX_TOLERANCE 5 +#define IQK_DELAY_TIME 1 //ms + +u1Byte //bit0 = 1 => Tx OK, bit1 = 1 => Rx OK +phy_PathA_IQK_8188E( +#if (DM_ODM_SUPPORT_TYPE & ODM_AP) + IN PDM_ODM_T pDM_Odm, +#else + IN struct adapter *pAdapter, +#endif + IN BOOLEAN configPathB + ) +{ + u4Byte regEAC, regE94, regE9C, regEA4; + u1Byte result = 0x00; +#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter); + #if (DM_ODM_SUPPORT_TYPE == ODM_CE) + PDM_ODM_T pDM_Odm = &pHalData->odmpriv; + #endif + #if (DM_ODM_SUPPORT_TYPE == ODM_MP) + PDM_ODM_T pDM_Odm = &pHalData->DM_OutSrc; + #endif +#endif + ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Path A IQK!\n")); + + //1 Tx IQK + //path-A IQK setting + ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Path-A IQK setting!\n")); + ODM_SetBBReg(pDM_Odm, rTx_IQK_Tone_A, bMaskDWord, 0x10008c1c); + ODM_SetBBReg(pDM_Odm, rRx_IQK_Tone_A, bMaskDWord, 0x30008c1c); + ODM_SetBBReg(pDM_Odm, rTx_IQK_PI_A, bMaskDWord, 0x8214032a); + ODM_SetBBReg(pDM_Odm, rRx_IQK_PI_A, bMaskDWord, 0x28160000); + + //LO calibration setting + ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("LO calibration setting!\n")); + ODM_SetBBReg(pDM_Odm, rIQK_AGC_Rsp, bMaskDWord, 0x00462911); + + //One shot, path A LOK & IQK + ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("One shot, path A LOK & IQK!\n")); + ODM_SetBBReg(pDM_Odm, rIQK_AGC_Pts, bMaskDWord, 0xf9000000); + ODM_SetBBReg(pDM_Odm, rIQK_AGC_Pts, bMaskDWord, 0xf8000000); + + // delay x ms + ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Delay %d ms for One shot, path A LOK & IQK.\n", IQK_DELAY_TIME_88E)); + //PlatformStallExecution(IQK_DELAY_TIME_88E*1000); + ODM_delay_ms(IQK_DELAY_TIME_88E); + + // Check failed + regEAC = ODM_GetBBReg(pDM_Odm, rRx_Power_After_IQK_A_2, bMaskDWord); + ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("0xeac = 0x%x\n", regEAC)); + regE94 = ODM_GetBBReg(pDM_Odm, rTx_Power_Before_IQK_A, bMaskDWord); + ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("0xe94 = 0x%x\n", regE94)); + regE9C= ODM_GetBBReg(pDM_Odm, rTx_Power_After_IQK_A, bMaskDWord); + ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("0xe9c = 0x%x\n", regE9C)); + regEA4= ODM_GetBBReg(pDM_Odm, rRx_Power_Before_IQK_A_2, bMaskDWord); + ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("0xea4 = 0x%x\n", regEA4)); + + if(!(regEAC & BIT28) && + (((regE94 & 0x03FF0000)>>16) != 0x142) && + (((regE9C & 0x03FF0000)>>16) != 0x42) ) + result |= 0x01; + else //if Tx not OK, ignore Rx + return result; + +#if 0 + if(!(regEAC & BIT27) && //if Tx is OK, check whether Rx is OK + (((regEA4 & 0x03FF0000)>>16) != 0x132) && + (((regEAC & 0x03FF0000)>>16) != 0x36)) + result |= 0x02; + else + RTPRINT(FINIT, INIT_IQK, ("Path A Rx IQK fail!!\n")); +#endif + + return result; + + + } + +u1Byte //bit0 = 1 => Tx OK, bit1 = 1 => Rx OK +phy_PathA_RxIQK( +#if (DM_ODM_SUPPORT_TYPE & ODM_AP) + IN PDM_ODM_T pDM_Odm, +#else + IN struct adapter *pAdapter, +#endif + IN BOOLEAN configPathB + ) +{ + u4Byte regEAC, regE94, regE9C, regEA4, u4tmp; + u1Byte result = 0x00; +#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter); + #if (DM_ODM_SUPPORT_TYPE == ODM_CE) + PDM_ODM_T pDM_Odm = &pHalData->odmpriv; + #endif + #if (DM_ODM_SUPPORT_TYPE == ODM_MP) + PDM_ODM_T pDM_Odm = &pHalData->DM_OutSrc; + #endif +#endif + ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Path A Rx IQK!\n")); + + //1 Get TXIMR setting + //modify RXIQK mode table + ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Path-A Rx IQK modify RXIQK mode table!\n")); + ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, bMaskDWord, 0x00000000); + ODM_SetRFReg(pDM_Odm, RF_PATH_A, RF_WE_LUT, bRFRegOffsetMask, 0x800a0 ); + ODM_SetRFReg(pDM_Odm, RF_PATH_A, RF_RCK_OS, bRFRegOffsetMask, 0x30000 ); + ODM_SetRFReg(pDM_Odm, RF_PATH_A, RF_TXPA_G1, bRFRegOffsetMask, 0x0000f ); + ODM_SetRFReg(pDM_Odm, RF_PATH_A, RF_TXPA_G2, bRFRegOffsetMask, 0xf117B ); + + //PA,PAD off + ODM_SetRFReg(pDM_Odm, RF_PATH_A, 0xdf, bRFRegOffsetMask, 0x980 ); + ODM_SetRFReg(pDM_Odm, RF_PATH_A, 0x56, bRFRegOffsetMask, 0x51000 ); + + ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, bMaskDWord, 0x80800000); + + //IQK setting + ODM_SetBBReg(pDM_Odm, rTx_IQK, bMaskDWord, 0x01007c00); + ODM_SetBBReg(pDM_Odm, rRx_IQK, bMaskDWord, 0x81004800); + + //path-A IQK setting + ODM_SetBBReg(pDM_Odm, rTx_IQK_Tone_A, bMaskDWord, 0x10008c1c); + ODM_SetBBReg(pDM_Odm, rRx_IQK_Tone_A, bMaskDWord, 0x30008c1c); + ODM_SetBBReg(pDM_Odm, rTx_IQK_PI_A, bMaskDWord, 0x82160c1f); + ODM_SetBBReg(pDM_Odm, rRx_IQK_PI_A, bMaskDWord, 0x28160000); + + //LO calibration setting + ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("LO calibration setting!\n")); + ODM_SetBBReg(pDM_Odm, rIQK_AGC_Rsp, bMaskDWord, 0x0046a911); + + //One shot, path A LOK & IQK + ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("One shot, path A LOK & IQK!\n")); + ODM_SetBBReg(pDM_Odm, rIQK_AGC_Pts, bMaskDWord, 0xf9000000); + ODM_SetBBReg(pDM_Odm, rIQK_AGC_Pts, bMaskDWord, 0xf8000000); + + // delay x ms + ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Delay %d ms for One shot, path A LOK & IQK.\n", IQK_DELAY_TIME_88E)); + //PlatformStallExecution(IQK_DELAY_TIME_88E*1000); + ODM_delay_ms(IQK_DELAY_TIME_88E); + + + // Check failed + regEAC = ODM_GetBBReg(pDM_Odm, rRx_Power_After_IQK_A_2, bMaskDWord); + ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("0xeac = 0x%x\n", regEAC)); + regE94 = ODM_GetBBReg(pDM_Odm, rTx_Power_Before_IQK_A, bMaskDWord); + ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("0xe94 = 0x%x\n", regE94)); + regE9C= ODM_GetBBReg(pDM_Odm, rTx_Power_After_IQK_A, bMaskDWord); + ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("0xe9c = 0x%x\n", regE9C)); + + if(!(regEAC & BIT28) && + (((regE94 & 0x03FF0000)>>16) != 0x142) && + (((regE9C & 0x03FF0000)>>16) != 0x42) ) + { + result |= 0x01; + } + else + { + //reload RF 0xdf + ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, bMaskDWord, 0x00000000); + ODM_SetRFReg(pDM_Odm, RF_PATH_A, 0xdf, bRFRegOffsetMask, 0x180 );//if Tx not OK, ignore Rx + return result; + } + + u4tmp = 0x80007C00 | (regE94&0x3FF0000) | ((regE9C&0x3FF0000) >> 16); + ODM_SetBBReg(pDM_Odm, rTx_IQK, bMaskDWord, u4tmp); + ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("0xe40 = 0x%x u4tmp = 0x%x \n", ODM_GetBBReg(pDM_Odm, rTx_IQK, bMaskDWord), u4tmp)); + + + //1 RX IQK + //modify RXIQK mode table + ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Path-A Rx IQK modify RXIQK mode table 2!\n")); + ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, bMaskDWord, 0x00000000); + ODM_SetRFReg(pDM_Odm, RF_PATH_A, RF_WE_LUT, bRFRegOffsetMask, 0x800a0 ); + ODM_SetRFReg(pDM_Odm, RF_PATH_A, RF_RCK_OS, bRFRegOffsetMask, 0x30000 ); + ODM_SetRFReg(pDM_Odm, RF_PATH_A, RF_TXPA_G1, bRFRegOffsetMask, 0x0000f ); + ODM_SetRFReg(pDM_Odm, RF_PATH_A, RF_TXPA_G2, bRFRegOffsetMask, 0xf7ffa ); + ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, bMaskDWord, 0x80800000); + + //IQK setting + ODM_SetBBReg(pDM_Odm, rRx_IQK, bMaskDWord, 0x01004800); + + //path-A IQK setting + ODM_SetBBReg(pDM_Odm, rTx_IQK_Tone_A, bMaskDWord, 0x38008c1c); + ODM_SetBBReg(pDM_Odm, rRx_IQK_Tone_A, bMaskDWord, 0x18008c1c); + ODM_SetBBReg(pDM_Odm, rTx_IQK_PI_A, bMaskDWord, 0x82160c05); + ODM_SetBBReg(pDM_Odm, rRx_IQK_PI_A, bMaskDWord, 0x28160c1f); + + //LO calibration setting + ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("LO calibration setting!\n")); + ODM_SetBBReg(pDM_Odm, rIQK_AGC_Rsp, bMaskDWord, 0x0046a911); + + //One shot, path A LOK & IQK + ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("One shot, path A LOK & IQK!\n")); + ODM_SetBBReg(pDM_Odm, rIQK_AGC_Pts, bMaskDWord, 0xf9000000); + ODM_SetBBReg(pDM_Odm, rIQK_AGC_Pts, bMaskDWord, 0xf8000000); + + // delay x ms + ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Delay %d ms for One shot, path A LOK & IQK.\n", IQK_DELAY_TIME_88E)); + //PlatformStallExecution(IQK_DELAY_TIME_88E*1000); + ODM_delay_ms(IQK_DELAY_TIME_88E); + + + // Check failed + regEAC = ODM_GetBBReg(pDM_Odm, rRx_Power_After_IQK_A_2, bMaskDWord); + ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("0xeac = 0x%x\n", regEAC)); + regE94 = ODM_GetBBReg(pDM_Odm, rTx_Power_Before_IQK_A, bMaskDWord); + ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("0xe94 = 0x%x\n", regE94)); + regE9C= ODM_GetBBReg(pDM_Odm, rTx_Power_After_IQK_A, bMaskDWord); + ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("0xe9c = 0x%x\n", regE9C)); + regEA4= ODM_GetBBReg(pDM_Odm, rRx_Power_Before_IQK_A_2, bMaskDWord); + ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("0xea4 = 0x%x\n", regEA4)); + + //reload RF 0xdf + ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, bMaskDWord, 0x00000000); + ODM_SetRFReg(pDM_Odm, RF_PATH_A, 0xdf, bRFRegOffsetMask, 0x180 ); + +#if 0 + if(!(regEAC & BIT28) && + (((regE94 & 0x03FF0000)>>16) != 0x142) && + (((regE9C & 0x03FF0000)>>16) != 0x42) ) + result |= 0x01; + else //if Tx not OK, ignore Rx + return result; +#endif + + if(!(regEAC & BIT27) && //if Tx is OK, check whether Rx is OK + (((regEA4 & 0x03FF0000)>>16) != 0x132) && + (((regEAC & 0x03FF0000)>>16) != 0x36)) + result |= 0x02; + else + ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Path A Rx IQK fail!!\n")); + + return result; + + + + +} + +u1Byte //bit0 = 1 => Tx OK, bit1 = 1 => Rx OK +phy_PathB_IQK_8188E( +#if (DM_ODM_SUPPORT_TYPE & ODM_AP) + IN PDM_ODM_T pDM_Odm +#else + IN struct adapter *pAdapter +#endif + ) +{ + u4Byte regEAC, regEB4, regEBC, regEC4, regECC; + u1Byte result = 0x00; +#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter); + #if (DM_ODM_SUPPORT_TYPE == ODM_CE) + PDM_ODM_T pDM_Odm = &pHalData->odmpriv; + #endif + #if (DM_ODM_SUPPORT_TYPE == ODM_MP) + PDM_ODM_T pDM_Odm = &pHalData->DM_OutSrc; + #endif +#endif + ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Path B IQK!\n")); + + //One shot, path B LOK & IQK + ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("One shot, path A LOK & IQK!\n")); + ODM_SetBBReg(pDM_Odm, rIQK_AGC_Cont, bMaskDWord, 0x00000002); + ODM_SetBBReg(pDM_Odm, rIQK_AGC_Cont, bMaskDWord, 0x00000000); + + // delay x ms + ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Delay %d ms for One shot, path B LOK & IQK.\n", IQK_DELAY_TIME_88E)); + //PlatformStallExecution(IQK_DELAY_TIME_88E*1000); + ODM_delay_ms(IQK_DELAY_TIME_88E); + + // Check failed + regEAC = ODM_GetBBReg(pDM_Odm, rRx_Power_After_IQK_A_2, bMaskDWord); + ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("0xeac = 0x%x\n", regEAC)); + regEB4 = ODM_GetBBReg(pDM_Odm, rTx_Power_Before_IQK_B, bMaskDWord); + ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("0xeb4 = 0x%x\n", regEB4)); + regEBC= ODM_GetBBReg(pDM_Odm, rTx_Power_After_IQK_B, bMaskDWord); + ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("0xebc = 0x%x\n", regEBC)); + regEC4= ODM_GetBBReg(pDM_Odm, rRx_Power_Before_IQK_B_2, bMaskDWord); + ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("0xec4 = 0x%x\n", regEC4)); + regECC= ODM_GetBBReg(pDM_Odm, rRx_Power_After_IQK_B_2, bMaskDWord); + ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("0xecc = 0x%x\n", regECC)); + + if(!(regEAC & BIT31) && + (((regEB4 & 0x03FF0000)>>16) != 0x142) && + (((regEBC & 0x03FF0000)>>16) != 0x42)) + result |= 0x01; + else + return result; + + if(!(regEAC & BIT30) && + (((regEC4 & 0x03FF0000)>>16) != 0x132) && + (((regECC & 0x03FF0000)>>16) != 0x36)) + result |= 0x02; + else + ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Path B Rx IQK fail!!\n")); + + + return result; + +} + +VOID +_PHY_PathAFillIQKMatrix( +#if (DM_ODM_SUPPORT_TYPE & ODM_AP) + IN PDM_ODM_T pDM_Odm, +#else + IN struct adapter *pAdapter, +#endif + IN BOOLEAN bIQKOK, + IN s4Byte result[][8], + IN u1Byte final_candidate, + IN BOOLEAN bTxOnly + ) +{ + u4Byte Oldval_0, X, TX0_A, reg; + s4Byte Y, TX0_C; +#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter); + #if (DM_ODM_SUPPORT_TYPE == ODM_CE) + PDM_ODM_T pDM_Odm = &pHalData->odmpriv; + #endif + #if (DM_ODM_SUPPORT_TYPE == ODM_MP) + PDM_ODM_T pDM_Odm = &pHalData->DM_OutSrc; + #endif +#endif + ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Path A IQ Calibration %s !\n",(bIQKOK)?"Success":"Failed")); + + if(final_candidate == 0xFF) + return; + + else if(bIQKOK) + { + Oldval_0 = (ODM_GetBBReg(pDM_Odm, rOFDM0_XATxIQImbalance, bMaskDWord) >> 22) & 0x3FF; + + X = result[final_candidate][0]; + if ((X & 0x00000200) != 0) + X = X | 0xFFFFFC00; + TX0_A = (X * Oldval_0) >> 8; + ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("X = 0x%x, TX0_A = 0x%x, Oldval_0 0x%x\n", X, TX0_A, Oldval_0)); + ODM_SetBBReg(pDM_Odm, rOFDM0_XATxIQImbalance, 0x3FF, TX0_A); + + ODM_SetBBReg(pDM_Odm, rOFDM0_ECCAThreshold, BIT(31), ((X* Oldval_0>>7) & 0x1)); + + Y = result[final_candidate][1]; + if ((Y & 0x00000200) != 0) + Y = Y | 0xFFFFFC00; + + + TX0_C = (Y * Oldval_0) >> 8; + ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Y = 0x%x, TX = 0x%x\n", Y, TX0_C)); + ODM_SetBBReg(pDM_Odm, rOFDM0_XCTxAFE, 0xF0000000, ((TX0_C&0x3C0)>>6)); + ODM_SetBBReg(pDM_Odm, rOFDM0_XATxIQImbalance, 0x003F0000, (TX0_C&0x3F)); + + ODM_SetBBReg(pDM_Odm, rOFDM0_ECCAThreshold, BIT(29), ((Y* Oldval_0>>7) & 0x1)); + + if(bTxOnly) + { + ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("_PHY_PathAFillIQKMatrix only Tx OK\n")); + return; + } + + reg = result[final_candidate][2]; +#if (DM_ODM_SUPPORT_TYPE==ODM_AP) + if( RTL_ABS(reg ,0x100) >= 16) + reg = 0x100; +#endif + ODM_SetBBReg(pDM_Odm, rOFDM0_XARxIQImbalance, 0x3FF, reg); + + reg = result[final_candidate][3] & 0x3F; + ODM_SetBBReg(pDM_Odm, rOFDM0_XARxIQImbalance, 0xFC00, reg); + + reg = (result[final_candidate][3] >> 6) & 0xF; + ODM_SetBBReg(pDM_Odm, rOFDM0_RxIQExtAnta, 0xF0000000, reg); + } +} + +VOID +_PHY_PathBFillIQKMatrix( +#if (DM_ODM_SUPPORT_TYPE & ODM_AP) + IN PDM_ODM_T pDM_Odm, +#else + IN struct adapter *pAdapter, +#endif + IN BOOLEAN bIQKOK, + IN s4Byte result[][8], + IN u1Byte final_candidate, + IN BOOLEAN bTxOnly //do Tx only + ) +{ + u4Byte Oldval_1, X, TX1_A, reg; + s4Byte Y, TX1_C; +#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter); + #if (DM_ODM_SUPPORT_TYPE == ODM_CE) + PDM_ODM_T pDM_Odm = &pHalData->odmpriv; + #endif + #if (DM_ODM_SUPPORT_TYPE == ODM_MP) + PDM_ODM_T pDM_Odm = &pHalData->DM_OutSrc; + #endif +#endif + ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Path B IQ Calibration %s !\n",(bIQKOK)?"Success":"Failed")); + + if(final_candidate == 0xFF) + return; + + else if(bIQKOK) + { + Oldval_1 = (ODM_GetBBReg(pDM_Odm, rOFDM0_XBTxIQImbalance, bMaskDWord) >> 22) & 0x3FF; + + X = result[final_candidate][4]; + if ((X & 0x00000200) != 0) + X = X | 0xFFFFFC00; + TX1_A = (X * Oldval_1) >> 8; + ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("X = 0x%x, TX1_A = 0x%x\n", X, TX1_A)); + ODM_SetBBReg(pDM_Odm, rOFDM0_XBTxIQImbalance, 0x3FF, TX1_A); + + ODM_SetBBReg(pDM_Odm, rOFDM0_ECCAThreshold, BIT(27), ((X* Oldval_1>>7) & 0x1)); + + Y = result[final_candidate][5]; + if ((Y & 0x00000200) != 0) + Y = Y | 0xFFFFFC00; + + TX1_C = (Y * Oldval_1) >> 8; + ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Y = 0x%x, TX1_C = 0x%x\n", Y, TX1_C)); + ODM_SetBBReg(pDM_Odm, rOFDM0_XDTxAFE, 0xF0000000, ((TX1_C&0x3C0)>>6)); + ODM_SetBBReg(pDM_Odm, rOFDM0_XBTxIQImbalance, 0x003F0000, (TX1_C&0x3F)); + + ODM_SetBBReg(pDM_Odm, rOFDM0_ECCAThreshold, BIT(25), ((Y* Oldval_1>>7) & 0x1)); + + if(bTxOnly) + return; + + reg = result[final_candidate][6]; + ODM_SetBBReg(pDM_Odm, rOFDM0_XBRxIQImbalance, 0x3FF, reg); + + reg = result[final_candidate][7] & 0x3F; + ODM_SetBBReg(pDM_Odm, rOFDM0_XBRxIQImbalance, 0xFC00, reg); + + reg = (result[final_candidate][7] >> 6) & 0xF; + ODM_SetBBReg(pDM_Odm, rOFDM0_AGCRSSITable, 0x0000F000, reg); + } +} + +// +// 2011/07/26 MH Add an API for testing IQK fail case. +// +// MP Already declare in odm.c +#if !(DM_ODM_SUPPORT_TYPE & ODM_MP) +BOOLEAN +ODM_CheckPowerStatus( + IN struct adapter * Adapter) +{ +/* + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); + PDM_ODM_T pDM_Odm = &pHalData->DM_OutSrc; + RT_RF_POWER_STATE rtState; + PMGNT_INFO pMgntInfo = &(Adapter->MgntInfo); + + // 2011/07/27 MH We are not testing ready~~!! We may fail to get correct value when init sequence. + if (pMgntInfo->init_adpt_in_progress == TRUE) + { + ODM_RT_TRACE(pDM_Odm,COMP_INIT, DBG_LOUD, ("ODM_CheckPowerStatus Return TRUE, due to initadapter")); + return TRUE; + } + + // + // 2011/07/19 MH We can not execute tx pwoer tracking/ LLC calibrate or IQK. + // + Adapter->HalFunc.GetHwRegHandler(Adapter, HW_VAR_RF_STATE, (pu1Byte)(&rtState)); + if(Adapter->bDriverStopped || Adapter->bDriverIsGoingToPnpSetPowerSleep || rtState == eRfOff) + { + ODM_RT_TRACE(pDM_Odm,COMP_INIT, DBG_LOUD, ("ODM_CheckPowerStatus Return FALSE, due to %d/%d/%d\n", + Adapter->bDriverStopped, Adapter->bDriverIsGoingToPnpSetPowerSleep, rtState)); + return FALSE; + } +*/ + return TRUE; +} +#endif + +VOID +_PHY_SaveADDARegisters( +#if (DM_ODM_SUPPORT_TYPE & ODM_AP) + IN PDM_ODM_T pDM_Odm, +#else + IN struct adapter *pAdapter, +#endif + IN pu4Byte ADDAReg, + IN pu4Byte ADDABackup, + IN u4Byte RegisterNum + ) +{ + u4Byte i; +#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter); + #if (DM_ODM_SUPPORT_TYPE == ODM_CE) + PDM_ODM_T pDM_Odm = &pHalData->odmpriv; + #endif + #if (DM_ODM_SUPPORT_TYPE == ODM_MP) + PDM_ODM_T pDM_Odm = &pHalData->DM_OutSrc; + #endif + + if (ODM_CheckPowerStatus(pAdapter) == FALSE) + return; +#endif + + ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Save ADDA parameters.\n")); + for( i = 0 ; i < RegisterNum ; i++){ + ADDABackup[i] = ODM_GetBBReg(pDM_Odm, ADDAReg[i], bMaskDWord); + } +} + + +VOID +_PHY_SaveMACRegisters( +#if (DM_ODM_SUPPORT_TYPE & ODM_AP) + IN PDM_ODM_T pDM_Odm, +#else + IN struct adapter *pAdapter, +#endif + IN pu4Byte MACReg, + IN pu4Byte MACBackup + ) +{ + u4Byte i; +#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter); + #if (DM_ODM_SUPPORT_TYPE == ODM_CE) + PDM_ODM_T pDM_Odm = &pHalData->odmpriv; + #endif + #if (DM_ODM_SUPPORT_TYPE == ODM_MP) + PDM_ODM_T pDM_Odm = &pHalData->DM_OutSrc; + #endif +#endif + ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Save MAC parameters.\n")); + for( i = 0 ; i < (IQK_MAC_REG_NUM - 1); i++){ + MACBackup[i] = ODM_Read1Byte(pDM_Odm, MACReg[i]); + } + MACBackup[i] = ODM_Read4Byte(pDM_Odm, MACReg[i]); + +} + + +VOID +_PHY_ReloadADDARegisters( +#if (DM_ODM_SUPPORT_TYPE & ODM_AP) + IN PDM_ODM_T pDM_Odm, +#else + IN struct adapter *pAdapter, +#endif + IN pu4Byte ADDAReg, + IN pu4Byte ADDABackup, + IN u4Byte RegiesterNum + ) +{ + u4Byte i; +#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter); + #if (DM_ODM_SUPPORT_TYPE == ODM_CE) + PDM_ODM_T pDM_Odm = &pHalData->odmpriv; + #endif + #if (DM_ODM_SUPPORT_TYPE == ODM_MP) + PDM_ODM_T pDM_Odm = &pHalData->DM_OutSrc; + #endif +#endif + + ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Reload ADDA power saving parameters !\n")); + for(i = 0 ; i < RegiesterNum; i++) + { + ODM_SetBBReg(pDM_Odm, ADDAReg[i], bMaskDWord, ADDABackup[i]); + } +} + +VOID +_PHY_ReloadMACRegisters( +#if (DM_ODM_SUPPORT_TYPE & ODM_AP) + IN PDM_ODM_T pDM_Odm, +#else + IN struct adapter *pAdapter, +#endif + IN pu4Byte MACReg, + IN pu4Byte MACBackup + ) +{ + u4Byte i; +#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter); + #if (DM_ODM_SUPPORT_TYPE == ODM_CE) + PDM_ODM_T pDM_Odm = &pHalData->odmpriv; + #endif + #if (DM_ODM_SUPPORT_TYPE == ODM_MP) + PDM_ODM_T pDM_Odm = &pHalData->DM_OutSrc; + #endif +#endif + ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Reload MAC parameters !\n")); + for(i = 0 ; i < (IQK_MAC_REG_NUM - 1); i++){ + ODM_Write1Byte(pDM_Odm, MACReg[i], (u1Byte)MACBackup[i]); + } + ODM_Write4Byte(pDM_Odm, MACReg[i], MACBackup[i]); +} + + +VOID +_PHY_PathADDAOn( +#if (DM_ODM_SUPPORT_TYPE & ODM_AP) + IN PDM_ODM_T pDM_Odm, +#else + IN struct adapter *pAdapter, +#endif + IN pu4Byte ADDAReg, + IN BOOLEAN isPathAOn, + IN BOOLEAN is2T + ) +{ + u4Byte pathOn; + u4Byte i; +#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter); + #if (DM_ODM_SUPPORT_TYPE == ODM_CE) + PDM_ODM_T pDM_Odm = &pHalData->odmpriv; + #endif + #if (DM_ODM_SUPPORT_TYPE == ODM_MP) + PDM_ODM_T pDM_Odm = &pHalData->DM_OutSrc; + #endif +#endif + ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("ADDA ON.\n")); + + pathOn = isPathAOn ? 0x04db25a4 : 0x0b1b25a4; + if(FALSE == is2T){ + pathOn = 0x0bdb25a0; + ODM_SetBBReg(pDM_Odm, ADDAReg[0], bMaskDWord, 0x0b1b25a0); + } + else{ + ODM_SetBBReg(pDM_Odm,ADDAReg[0], bMaskDWord, pathOn); + } + + for( i = 1 ; i < IQK_ADDA_REG_NUM ; i++){ + ODM_SetBBReg(pDM_Odm,ADDAReg[i], bMaskDWord, pathOn); + } + +} + +VOID +_PHY_MACSettingCalibration( +#if (DM_ODM_SUPPORT_TYPE & ODM_AP) + IN PDM_ODM_T pDM_Odm, +#else + IN struct adapter *pAdapter, +#endif + IN pu4Byte MACReg, + IN pu4Byte MACBackup + ) +{ + u4Byte i = 0; +#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter); + #if (DM_ODM_SUPPORT_TYPE == ODM_CE) + PDM_ODM_T pDM_Odm = &pHalData->odmpriv; + #endif + #if (DM_ODM_SUPPORT_TYPE == ODM_MP) + PDM_ODM_T pDM_Odm = &pHalData->DM_OutSrc; + #endif +#endif + ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("MAC settings for Calibration.\n")); + + ODM_Write1Byte(pDM_Odm, MACReg[i], 0x3F); + + for(i = 1 ; i < (IQK_MAC_REG_NUM - 1); i++){ + ODM_Write1Byte(pDM_Odm, MACReg[i], (u1Byte)(MACBackup[i]&(~BIT3))); + } + ODM_Write1Byte(pDM_Odm, MACReg[i], (u1Byte)(MACBackup[i]&(~BIT5))); + +} + +VOID +_PHY_PathAStandBy( +#if (DM_ODM_SUPPORT_TYPE & ODM_AP) + IN PDM_ODM_T pDM_Odm +#else + IN struct adapter *pAdapter +#endif + ) +{ +#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter); + #if (DM_ODM_SUPPORT_TYPE == ODM_CE) + PDM_ODM_T pDM_Odm = &pHalData->odmpriv; + #endif + #if (DM_ODM_SUPPORT_TYPE == ODM_MP) + PDM_ODM_T pDM_Odm = &pHalData->DM_OutSrc; + #endif +#endif + ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Path-A standby mode!\n")); + + ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, bMaskDWord, 0x0); + ODM_SetBBReg(pDM_Odm, 0x840, bMaskDWord, 0x00010000); + ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, bMaskDWord, 0x80800000); +} + +VOID +_PHY_PIModeSwitch( +#if (DM_ODM_SUPPORT_TYPE & ODM_AP) + IN PDM_ODM_T pDM_Odm, +#else + IN struct adapter *pAdapter, +#endif + IN BOOLEAN PIMode + ) +{ + u4Byte mode; +#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter); + #if (DM_ODM_SUPPORT_TYPE == ODM_CE) + PDM_ODM_T pDM_Odm = &pHalData->odmpriv; + #endif + #if (DM_ODM_SUPPORT_TYPE == ODM_MP) + PDM_ODM_T pDM_Odm = &pHalData->DM_OutSrc; + #endif +#endif + ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("BB Switch to %s mode!\n", (PIMode ? "PI" : "SI"))); + + mode = PIMode ? 0x01000100 : 0x01000000; + ODM_SetBBReg(pDM_Odm, rFPGA0_XA_HSSIParameter1, bMaskDWord, mode); + ODM_SetBBReg(pDM_Odm, rFPGA0_XB_HSSIParameter1, bMaskDWord, mode); +} + +BOOLEAN +phy_SimularityCompare_8188E( +#if (DM_ODM_SUPPORT_TYPE & ODM_AP) + IN PDM_ODM_T pDM_Odm, +#else + IN struct adapter *pAdapter, +#endif + IN s4Byte result[][8], + IN u1Byte c1, + IN u1Byte c2 + ) +{ + u4Byte i, j, diff, SimularityBitMap, bound = 0; +#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter); + #if (DM_ODM_SUPPORT_TYPE == ODM_CE) + PDM_ODM_T pDM_Odm = &pHalData->odmpriv; + #endif + #if (DM_ODM_SUPPORT_TYPE == ODM_MP) + PDM_ODM_T pDM_Odm = &pHalData->DM_OutSrc; + #endif +#endif + u1Byte final_candidate[2] = {0xFF, 0xFF}; //for path A and path B + BOOLEAN bResult = TRUE; + BOOLEAN is2T; + s4Byte tmp1 = 0,tmp2 = 0; + + if( (pDM_Odm->RFType ==ODM_2T2R )||(pDM_Odm->RFType ==ODM_2T3R )||(pDM_Odm->RFType ==ODM_2T4R )) + is2T = TRUE; + else + is2T = FALSE; + + if(is2T) + bound = 8; + else + bound = 4; + + + + ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("===> IQK:phy_SimularityCompare_8188E c1 %d c2 %d!!!\n", c1, c2)); + + + SimularityBitMap = 0; + + for( i = 0; i < bound; i++ ) + { +// diff = (result[c1][i] > result[c2][i]) ? (result[c1][i] - result[c2][i]) : (result[c2][i] - result[c1][i]); + if((i==1) || (i==3) || (i==5) || (i==7)) + { + if((result[c1][i]& 0x00000200) != 0) + tmp1 = result[c1][i] | 0xFFFFFC00; + else + tmp1 = result[c1][i]; + + if((result[c2][i]& 0x00000200) != 0) + tmp2 = result[c2][i] | 0xFFFFFC00; + else + tmp2 = result[c2][i]; + } + else + { + tmp1 = result[c1][i]; + tmp2 = result[c2][i]; + } + + diff = (tmp1 > tmp2) ? (tmp1 - tmp2) : (tmp2 - tmp1); + + if (diff > MAX_TOLERANCE) + { + ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("IQK:phy_SimularityCompare_8188E differnece overflow index %d compare1 0x%x compare2 0x%x!!!\n", i, result[c1][i], result[c2][i])); + + if((i == 2 || i == 6) && !SimularityBitMap) + { + if(result[c1][i]+result[c1][i+1] == 0) + final_candidate[(i/4)] = c2; + else if (result[c2][i]+result[c2][i+1] == 0) + final_candidate[(i/4)] = c1; + else + SimularityBitMap = SimularityBitMap|(1<odmpriv; + #endif + #if (DM_ODM_SUPPORT_TYPE == ODM_MP) + PDM_ODM_T pDM_Odm = &pHalData->DM_OutSrc; + #endif +#endif + u4Byte i; + u1Byte PathAOK, PathBOK; + u4Byte ADDA_REG[IQK_ADDA_REG_NUM] = { + rFPGA0_XCD_SwitchControl, rBlue_Tooth, + rRx_Wait_CCA, rTx_CCK_RFON, + rTx_CCK_BBON, rTx_OFDM_RFON, + rTx_OFDM_BBON, rTx_To_Rx, + rTx_To_Tx, rRx_CCK, + rRx_OFDM, rRx_Wait_RIFS, + rRx_TO_Rx, rStandby, + rSleep, rPMPD_ANAEN }; + u4Byte IQK_MAC_REG[IQK_MAC_REG_NUM] = { + REG_TXPAUSE, REG_BCN_CTRL, + REG_BCN_CTRL_1, REG_GPIO_MUXCFG}; + + //since 92C & 92D have the different define in IQK_BB_REG + u4Byte IQK_BB_REG_92C[IQK_BB_REG_NUM] = { + rOFDM0_TRxPathEnable, rOFDM0_TRMuxPar, + rFPGA0_XCD_RFInterfaceSW, rConfig_AntA, rConfig_AntB, + rFPGA0_XAB_RFInterfaceSW, rFPGA0_XA_RFInterfaceOE, + rFPGA0_XB_RFInterfaceOE, rFPGA0_RFMOD + }; + +#if (DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL)) + u4Byte retryCount = 2; +#else +#if MP_DRIVER + u4Byte retryCount = 9; +#else + u4Byte retryCount = 2; +#endif +#endif +if ( *(pDM_Odm->mp_mode) == 1) + retryCount = 9; +else + retryCount = 2; + // Note: IQ calibration must be performed after loading + // PHY_REG.txt , and radio_a, radio_b.txt + + //u4Byte bbvalue; + +#if (DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL)) +#ifdef MP_TEST + if(pDM_Odm->priv->pshare->rf_ft_var.mp_specific) + retryCount = 9; +#endif +#endif + + + if(t==0) + { +// bbvalue = ODM_GetBBReg(pDM_Odm, rFPGA0_RFMOD, bMaskDWord); +// RTPRINT(FINIT, INIT_IQK, ("phy_IQCalibrate_8188E()==>0x%08x\n",bbvalue)); + + ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("IQ Calibration for %s for %d times\n", (is2T ? "2T2R" : "1T1R"), t)); + + // Save ADDA parameters, turn Path A ADDA on +#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) + _PHY_SaveADDARegisters(pAdapter, ADDA_REG, pDM_Odm->RFCalibrateInfo.ADDA_backup, IQK_ADDA_REG_NUM); + _PHY_SaveMACRegisters(pAdapter, IQK_MAC_REG, pDM_Odm->RFCalibrateInfo.IQK_MAC_backup); + _PHY_SaveADDARegisters(pAdapter, IQK_BB_REG_92C, pDM_Odm->RFCalibrateInfo.IQK_BB_backup, IQK_BB_REG_NUM); +#else + _PHY_SaveADDARegisters(pDM_Odm, ADDA_REG, pDM_Odm->RFCalibrateInfo.ADDA_backup, IQK_ADDA_REG_NUM); + _PHY_SaveMACRegisters(pDM_Odm, IQK_MAC_REG, pDM_Odm->RFCalibrateInfo.IQK_MAC_backup); + _PHY_SaveADDARegisters(pDM_Odm, IQK_BB_REG_92C, pDM_Odm->RFCalibrateInfo.IQK_BB_backup, IQK_BB_REG_NUM); +#endif + } + ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("IQ Calibration for %s for %d times\n", (is2T ? "2T2R" : "1T1R"), t)); + +#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) + + _PHY_PathADDAOn(pAdapter, ADDA_REG, TRUE, is2T); +#else + _PHY_PathADDAOn(pDM_Odm, ADDA_REG, TRUE, is2T); +#endif + + + if(t==0) + { + pDM_Odm->RFCalibrateInfo.bRfPiEnable = (u1Byte)ODM_GetBBReg(pDM_Odm, rFPGA0_XA_HSSIParameter1, BIT(8)); + } + + if(!pDM_Odm->RFCalibrateInfo.bRfPiEnable){ + // Switch BB to PI mode to do IQ Calibration. +#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) + _PHY_PIModeSwitch(pAdapter, TRUE); +#else + _PHY_PIModeSwitch(pDM_Odm, TRUE); +#endif + } + + //BB setting + ODM_SetBBReg(pDM_Odm, rFPGA0_RFMOD, BIT24, 0x00); + ODM_SetBBReg(pDM_Odm, rOFDM0_TRxPathEnable, bMaskDWord, 0x03a05600); + ODM_SetBBReg(pDM_Odm, rOFDM0_TRMuxPar, bMaskDWord, 0x000800e4); + ODM_SetBBReg(pDM_Odm, rFPGA0_XCD_RFInterfaceSW, bMaskDWord, 0x22204000); + + + ODM_SetBBReg(pDM_Odm, rFPGA0_XAB_RFInterfaceSW, BIT10, 0x01); + ODM_SetBBReg(pDM_Odm, rFPGA0_XAB_RFInterfaceSW, BIT26, 0x01); + ODM_SetBBReg(pDM_Odm, rFPGA0_XA_RFInterfaceOE, BIT10, 0x00); + ODM_SetBBReg(pDM_Odm, rFPGA0_XB_RFInterfaceOE, BIT10, 0x00); + + + if(is2T) + { + ODM_SetBBReg(pDM_Odm, rFPGA0_XA_LSSIParameter, bMaskDWord, 0x00010000); + ODM_SetBBReg(pDM_Odm, rFPGA0_XB_LSSIParameter, bMaskDWord, 0x00010000); + } + + //MAC settings +#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) + _PHY_MACSettingCalibration(pAdapter, IQK_MAC_REG, pDM_Odm->RFCalibrateInfo.IQK_MAC_backup); +#else + _PHY_MACSettingCalibration(pDM_Odm, IQK_MAC_REG, pDM_Odm->RFCalibrateInfo.IQK_MAC_backup); +#endif + + + //Page B init + //AP or IQK + ODM_SetBBReg(pDM_Odm, rConfig_AntA, bMaskDWord, 0x0f600000); + + if(is2T) + { + ODM_SetBBReg(pDM_Odm, rConfig_AntB, bMaskDWord, 0x0f600000); + } + + // IQ calibration setting + ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("IQK setting!\n")); + ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, bMaskDWord, 0x80800000); + ODM_SetBBReg(pDM_Odm, rTx_IQK, bMaskDWord, 0x01007c00); + ODM_SetBBReg(pDM_Odm, rRx_IQK, bMaskDWord, 0x81004800); + + for(i = 0 ; i < retryCount ; i++){ +#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) + PathAOK = phy_PathA_IQK_8188E(pAdapter, is2T); +#else + PathAOK = phy_PathA_IQK_8188E(pDM_Odm, is2T); +#endif +// if(PathAOK == 0x03){ + if(PathAOK == 0x01){ + ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Path A Tx IQK Success!!\n")); + result[t][0] = (ODM_GetBBReg(pDM_Odm, rTx_Power_Before_IQK_A, bMaskDWord)&0x3FF0000)>>16; + result[t][1] = (ODM_GetBBReg(pDM_Odm, rTx_Power_After_IQK_A, bMaskDWord)&0x3FF0000)>>16; + break; + } +#if 0 + else if (i == (retryCount-1) && PathAOK == 0x01) //Tx IQK OK + { + RTPRINT(FINIT, INIT_IQK, ("Path A IQK Only Tx Success!!\n")); + + result[t][0] = (ODM_GetBBReg(pDM_Odm, rTx_Power_Before_IQK_A, bMaskDWord)&0x3FF0000)>>16; + result[t][1] = (ODM_GetBBReg(pDM_Odm, rTx_Power_After_IQK_A, bMaskDWord)&0x3FF0000)>>16; + } +#endif + } + + for(i = 0 ; i < retryCount ; i++){ +#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) + PathAOK = phy_PathA_RxIQK(pAdapter, is2T); +#else + PathAOK = phy_PathA_RxIQK(pDM_Odm, is2T); +#endif + if(PathAOK == 0x03){ + ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Path A Rx IQK Success!!\n")); +// result[t][0] = (ODM_GetBBReg(pDM_Odm, rTx_Power_Before_IQK_A, bMaskDWord)&0x3FF0000)>>16; +// result[t][1] = (ODM_GetBBReg(pDM_Odm, rTx_Power_After_IQK_A, bMaskDWord)&0x3FF0000)>>16; + result[t][2] = (ODM_GetBBReg(pDM_Odm, rRx_Power_Before_IQK_A_2, bMaskDWord)&0x3FF0000)>>16; + result[t][3] = (ODM_GetBBReg(pDM_Odm, rRx_Power_After_IQK_A_2, bMaskDWord)&0x3FF0000)>>16; + break; + } + else + { + ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Path A Rx IQK Fail!!\n")); + } + } + + if(0x00 == PathAOK){ + ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Path A IQK failed!!\n")); + } + + if(is2T){ +#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) + _PHY_PathAStandBy(pAdapter); + + // Turn Path B ADDA on + _PHY_PathADDAOn(pAdapter, ADDA_REG, FALSE, is2T); +#else + _PHY_PathAStandBy(pDM_Odm); + + // Turn Path B ADDA on + _PHY_PathADDAOn(pDM_Odm, ADDA_REG, FALSE, is2T); +#endif + + for(i = 0 ; i < retryCount ; i++){ +#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) + PathBOK = phy_PathB_IQK_8188E(pAdapter); +#else + PathBOK = phy_PathB_IQK_8188E(pDM_Odm); +#endif + if(PathBOK == 0x03){ + ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Path B IQK Success!!\n")); + result[t][4] = (ODM_GetBBReg(pDM_Odm, rTx_Power_Before_IQK_B, bMaskDWord)&0x3FF0000)>>16; + result[t][5] = (ODM_GetBBReg(pDM_Odm, rTx_Power_After_IQK_B, bMaskDWord)&0x3FF0000)>>16; + result[t][6] = (ODM_GetBBReg(pDM_Odm, rRx_Power_Before_IQK_B_2, bMaskDWord)&0x3FF0000)>>16; + result[t][7] = (ODM_GetBBReg(pDM_Odm, rRx_Power_After_IQK_B_2, bMaskDWord)&0x3FF0000)>>16; + break; + } + else if (i == (retryCount - 1) && PathBOK == 0x01) //Tx IQK OK + { + ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Path B Only Tx IQK Success!!\n")); + result[t][4] = (ODM_GetBBReg(pDM_Odm, rTx_Power_Before_IQK_B, bMaskDWord)&0x3FF0000)>>16; + result[t][5] = (ODM_GetBBReg(pDM_Odm, rTx_Power_After_IQK_B, bMaskDWord)&0x3FF0000)>>16; + } + } + + if(0x00 == PathBOK){ + ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Path B IQK failed!!\n")); + } + } + + //Back to BB mode, load original value + ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("IQK:Back to BB mode, load original value!\n")); + ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, bMaskDWord, 0); + + if(t!=0) + { + if(!pDM_Odm->RFCalibrateInfo.bRfPiEnable){ + // Switch back BB to SI mode after finish IQ Calibration. +#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) + _PHY_PIModeSwitch(pAdapter, FALSE); +#else + _PHY_PIModeSwitch(pDM_Odm, FALSE); +#endif + } +#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) + + // Reload ADDA power saving parameters + _PHY_ReloadADDARegisters(pAdapter, ADDA_REG, pDM_Odm->RFCalibrateInfo.ADDA_backup, IQK_ADDA_REG_NUM); + + // Reload MAC parameters + _PHY_ReloadMACRegisters(pAdapter, IQK_MAC_REG, pDM_Odm->RFCalibrateInfo.IQK_MAC_backup); + + _PHY_ReloadADDARegisters(pAdapter, IQK_BB_REG_92C, pDM_Odm->RFCalibrateInfo.IQK_BB_backup, IQK_BB_REG_NUM); +#else + // Reload ADDA power saving parameters + _PHY_ReloadADDARegisters(pDM_Odm, ADDA_REG, pDM_Odm->RFCalibrateInfo.ADDA_backup, IQK_ADDA_REG_NUM); + + // Reload MAC parameters + _PHY_ReloadMACRegisters(pDM_Odm, IQK_MAC_REG, pDM_Odm->RFCalibrateInfo.IQK_MAC_backup); + + _PHY_ReloadADDARegisters(pDM_Odm, IQK_BB_REG_92C, pDM_Odm->RFCalibrateInfo.IQK_BB_backup, IQK_BB_REG_NUM); +#endif + + + // Restore RX initial gain + ODM_SetBBReg(pDM_Odm, rFPGA0_XA_LSSIParameter, bMaskDWord, 0x00032ed3); + if(is2T){ + ODM_SetBBReg(pDM_Odm, rFPGA0_XB_LSSIParameter, bMaskDWord, 0x00032ed3); + } + + //load 0xe30 IQC default value + ODM_SetBBReg(pDM_Odm, rTx_IQK_Tone_A, bMaskDWord, 0x01008c00); + ODM_SetBBReg(pDM_Odm, rRx_IQK_Tone_A, bMaskDWord, 0x01008c00); + + + } + ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("phy_IQCalibrate_8188E() <==\n")); + +} + + +VOID +phy_LCCalibrate_8188E( +#if (DM_ODM_SUPPORT_TYPE & ODM_AP) + IN PDM_ODM_T pDM_Odm, +#else + IN struct adapter *pAdapter, +#endif + IN BOOLEAN is2T + ) +{ + u1Byte tmpReg; + u4Byte RF_Amode=0, RF_Bmode=0, LC_Cal; +#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter); + #if (DM_ODM_SUPPORT_TYPE == ODM_CE) + PDM_ODM_T pDM_Odm = &pHalData->odmpriv; + #endif + #if (DM_ODM_SUPPORT_TYPE == ODM_MP) + PDM_ODM_T pDM_Odm = &pHalData->DM_OutSrc; + #endif +#endif + //Check continuous TX and Packet TX + tmpReg = ODM_Read1Byte(pDM_Odm, 0xd03); + + if((tmpReg&0x70) != 0) //Deal with contisuous TX case + ODM_Write1Byte(pDM_Odm, 0xd03, tmpReg&0x8F); //disable all continuous TX + else // Deal with Packet TX case + ODM_Write1Byte(pDM_Odm, REG_TXPAUSE, 0xFF); // block all queues + + if((tmpReg&0x70) != 0) + { + //1. Read original RF mode + //Path-A +#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) + RF_Amode = PHY_QueryRFReg(pAdapter, RF_PATH_A, RF_AC, bMask12Bits); + + //Path-B + if(is2T) + RF_Bmode = PHY_QueryRFReg(pAdapter, RF_PATH_B, RF_AC, bMask12Bits); +#else + RF_Amode = ODM_GetRFReg(pDM_Odm, RF_PATH_A, RF_AC, bMask12Bits); + + //Path-B + if(is2T) + RF_Bmode = ODM_GetRFReg(pDM_Odm, RF_PATH_B, RF_AC, bMask12Bits); +#endif + + //2. Set RF mode = standby mode + //Path-A + ODM_SetRFReg(pDM_Odm, RF_PATH_A, RF_AC, bMask12Bits, (RF_Amode&0x8FFFF)|0x10000); + + //Path-B + if(is2T) + ODM_SetRFReg(pDM_Odm, RF_PATH_B, RF_AC, bMask12Bits, (RF_Bmode&0x8FFFF)|0x10000); + } + + //3. Read RF reg18 +#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) + LC_Cal = PHY_QueryRFReg(pAdapter, RF_PATH_A, RF_CHNLBW, bMask12Bits); +#else + LC_Cal = ODM_GetRFReg(pDM_Odm, RF_PATH_A, RF_CHNLBW, bMask12Bits); +#endif + + //4. Set LC calibration begin bit15 + ODM_SetRFReg(pDM_Odm, RF_PATH_A, RF_CHNLBW, bMask12Bits, LC_Cal|0x08000); + + ODM_sleep_ms(100); + + + //Restore original situation + if((tmpReg&0x70) != 0) //Deal with contisuous TX case + { + //Path-A + ODM_Write1Byte(pDM_Odm, 0xd03, tmpReg); + ODM_SetRFReg(pDM_Odm, RF_PATH_A, RF_AC, bMask12Bits, RF_Amode); + + //Path-B + if(is2T) + ODM_SetRFReg(pDM_Odm, RF_PATH_B, RF_AC, bMask12Bits, RF_Bmode); + } + else // Deal with Packet TX case + { + ODM_Write1Byte(pDM_Odm, REG_TXPAUSE, 0x00); + } +} + +//Analog Pre-distortion calibration +#define APK_BB_REG_NUM 8 +#define APK_CURVE_REG_NUM 4 +#define PATH_NUM 2 + +VOID +phy_APCalibrate_8188E( +#if (DM_ODM_SUPPORT_TYPE & ODM_AP) + IN PDM_ODM_T pDM_Odm, +#else + IN struct adapter *pAdapter, +#endif + IN s1Byte delta, + IN BOOLEAN is2T + ) +{ +#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter); + #if (DM_ODM_SUPPORT_TYPE == ODM_CE) + PDM_ODM_T pDM_Odm = &pHalData->odmpriv; + #endif + #if (DM_ODM_SUPPORT_TYPE == ODM_MP) + PDM_ODM_T pDM_Odm = &pHalData->DM_OutSrc; + #endif +#endif + u4Byte regD[PATH_NUM]; + u4Byte tmpReg, index, offset, apkbound; + u1Byte path, i, pathbound = PATH_NUM; + u4Byte BB_backup[APK_BB_REG_NUM]; + u4Byte BB_REG[APK_BB_REG_NUM] = { + rFPGA1_TxBlock, rOFDM0_TRxPathEnable, + rFPGA0_RFMOD, rOFDM0_TRMuxPar, + rFPGA0_XCD_RFInterfaceSW, rFPGA0_XAB_RFInterfaceSW, + rFPGA0_XA_RFInterfaceOE, rFPGA0_XB_RFInterfaceOE }; + u4Byte BB_AP_MODE[APK_BB_REG_NUM] = { + 0x00000020, 0x00a05430, 0x02040000, + 0x000800e4, 0x00204000 }; + u4Byte BB_normal_AP_MODE[APK_BB_REG_NUM] = { + 0x00000020, 0x00a05430, 0x02040000, + 0x000800e4, 0x22204000 }; + + u4Byte AFE_backup[IQK_ADDA_REG_NUM]; + u4Byte AFE_REG[IQK_ADDA_REG_NUM] = { + rFPGA0_XCD_SwitchControl, rBlue_Tooth, + rRx_Wait_CCA, rTx_CCK_RFON, + rTx_CCK_BBON, rTx_OFDM_RFON, + rTx_OFDM_BBON, rTx_To_Rx, + rTx_To_Tx, rRx_CCK, + rRx_OFDM, rRx_Wait_RIFS, + rRx_TO_Rx, rStandby, + rSleep, rPMPD_ANAEN }; + + u4Byte MAC_backup[IQK_MAC_REG_NUM]; + u4Byte MAC_REG[IQK_MAC_REG_NUM] = { + REG_TXPAUSE, REG_BCN_CTRL, + REG_BCN_CTRL_1, REG_GPIO_MUXCFG}; + + u4Byte APK_RF_init_value[PATH_NUM][APK_BB_REG_NUM] = { + {0x0852c, 0x1852c, 0x5852c, 0x1852c, 0x5852c}, + {0x2852e, 0x0852e, 0x3852e, 0x0852e, 0x0852e} + }; + + u4Byte APK_normal_RF_init_value[PATH_NUM][APK_BB_REG_NUM] = { + {0x0852c, 0x0a52c, 0x3a52c, 0x5a52c, 0x5a52c}, //path settings equal to path b settings + {0x0852c, 0x0a52c, 0x5a52c, 0x5a52c, 0x5a52c} + }; + + u4Byte APK_RF_value_0[PATH_NUM][APK_BB_REG_NUM] = { + {0x52019, 0x52014, 0x52013, 0x5200f, 0x5208d}, + {0x5201a, 0x52019, 0x52016, 0x52033, 0x52050} + }; + + u4Byte APK_normal_RF_value_0[PATH_NUM][APK_BB_REG_NUM] = { + {0x52019, 0x52017, 0x52010, 0x5200d, 0x5206a}, //path settings equal to path b settings + {0x52019, 0x52017, 0x52010, 0x5200d, 0x5206a} + }; + + u4Byte AFE_on_off[PATH_NUM] = { + 0x04db25a4, 0x0b1b25a4}; //path A on path B off / path A off path B on + + u4Byte APK_offset[PATH_NUM] = { + rConfig_AntA, rConfig_AntB}; + + u4Byte APK_normal_offset[PATH_NUM] = { + rConfig_Pmpd_AntA, rConfig_Pmpd_AntB}; + + u4Byte APK_value[PATH_NUM] = { + 0x92fc0000, 0x12fc0000}; + + u4Byte APK_normal_value[PATH_NUM] = { + 0x92680000, 0x12680000}; + + s1Byte APK_delta_mapping[APK_BB_REG_NUM][13] = { + {-4, -3, -2, -2, -1, -1, 0, 1, 2, 3, 4, 5, 6}, + {-4, -3, -2, -2, -1, -1, 0, 1, 2, 3, 4, 5, 6}, + {-6, -4, -2, -2, -1, -1, 0, 1, 2, 3, 4, 5, 6}, + {-1, -1, -1, -1, -1, -1, 0, 1, 2, 3, 4, 5, 6}, + {-11, -9, -7, -5, -3, -1, 0, 0, 0, 0, 0, 0, 0} + }; + + u4Byte APK_normal_setting_value_1[13] = { + 0x01017018, 0xf7ed8f84, 0x1b1a1816, 0x2522201e, 0x322e2b28, + 0x433f3a36, 0x5b544e49, 0x7b726a62, 0xa69a8f84, 0xdfcfc0b3, + 0x12680000, 0x00880000, 0x00880000 + }; + + u4Byte APK_normal_setting_value_2[16] = { + 0x01c7021d, 0x01670183, 0x01000123, 0x00bf00e2, 0x008d00a3, + 0x0068007b, 0x004d0059, 0x003a0042, 0x002b0031, 0x001f0025, + 0x0017001b, 0x00110014, 0x000c000f, 0x0009000b, 0x00070008, + 0x00050006 + }; + + u4Byte APK_result[PATH_NUM][APK_BB_REG_NUM]; //val_1_1a, val_1_2a, val_2a, val_3a, val_4a +// u4Byte AP_curve[PATH_NUM][APK_CURVE_REG_NUM]; + + s4Byte BB_offset, delta_V, delta_offset; + +#if MP_DRIVER == 1 +if ( *(pDM_Odm->mp_mode) == 1) +{ +#if (DM_ODM_SUPPORT_TYPE == ODM_CE) + PMPT_CONTEXT pMptCtx = &(pAdapter->mppriv.MptCtx); +#else + PMPT_CONTEXT pMptCtx = &(pAdapter->MptCtx); +#endif + pMptCtx->APK_bound[0] = 45; + pMptCtx->APK_bound[1] = 52; +} +#endif + + ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("==>phy_APCalibrate_8188E() delta %d\n", delta)); + ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("AP Calibration for %s\n", (is2T ? "2T2R" : "1T1R"))); + if(!is2T) + pathbound = 1; + + //2 FOR NORMAL CHIP SETTINGS + +// Temporarily do not allow normal driver to do the following settings because these offset +// and value will cause RF internal PA to be unpredictably disabled by HW, such that RF Tx signal +// will disappear after disable/enable card many times on 88CU. RF SD and DD have not find the +// root cause, so we remove these actions temporarily. Added by tynli and SD3 Allen. 2010.05.31. +//#if MP_DRIVER != 1 +if (*(pDM_Odm->mp_mode) != 1) + return; +//#endif + //settings adjust for normal chip + for(index = 0; index < PATH_NUM; index ++) + { + APK_offset[index] = APK_normal_offset[index]; + APK_value[index] = APK_normal_value[index]; + AFE_on_off[index] = 0x6fdb25a4; + } + + for(index = 0; index < APK_BB_REG_NUM; index ++) + { + for(path = 0; path < pathbound; path++) + { + APK_RF_init_value[path][index] = APK_normal_RF_init_value[path][index]; + APK_RF_value_0[path][index] = APK_normal_RF_value_0[path][index]; + } + BB_AP_MODE[index] = BB_normal_AP_MODE[index]; + } + + apkbound = 6; + + //save BB default value + for(index = 0; index < APK_BB_REG_NUM ; index++) + { + if(index == 0) //skip + continue; + BB_backup[index] = ODM_GetBBReg(pDM_Odm, BB_REG[index], bMaskDWord); + } + + //save MAC default value +#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) + _PHY_SaveMACRegisters(pAdapter, MAC_REG, MAC_backup); + + //save AFE default value + _PHY_SaveADDARegisters(pAdapter, AFE_REG, AFE_backup, IQK_ADDA_REG_NUM); +#else + _PHY_SaveMACRegisters(pDM_Odm, MAC_REG, MAC_backup); + + //save AFE default value + _PHY_SaveADDARegisters(pDM_Odm, AFE_REG, AFE_backup, IQK_ADDA_REG_NUM); +#endif + + for(path = 0; path < pathbound; path++) + { + + + if(path == RF_PATH_A) + { + //path A APK + //load APK setting + //path-A + offset = rPdp_AntA; + for(index = 0; index < 11; index ++) + { + ODM_SetBBReg(pDM_Odm, offset, bMaskDWord, APK_normal_setting_value_1[index]); + ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("phy_APCalibrate_8188E() offset 0x%x value 0x%x\n", offset, ODM_GetBBReg(pDM_Odm, offset, bMaskDWord))); + + offset += 0x04; + } + + ODM_SetBBReg(pDM_Odm, rConfig_Pmpd_AntB, bMaskDWord, 0x12680000); + + offset = rConfig_AntA; + for(; index < 13; index ++) + { + ODM_SetBBReg(pDM_Odm, offset, bMaskDWord, APK_normal_setting_value_1[index]); + ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("phy_APCalibrate_8188E() offset 0x%x value 0x%x\n", offset, ODM_GetBBReg(pDM_Odm, offset, bMaskDWord))); + + offset += 0x04; + } + + //page-B1 + ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, bMaskDWord, 0x40000000); + + //path A + offset = rPdp_AntA; + for(index = 0; index < 16; index++) + { + ODM_SetBBReg(pDM_Odm, offset, bMaskDWord, APK_normal_setting_value_2[index]); + ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("phy_APCalibrate_8188E() offset 0x%x value 0x%x\n", offset, ODM_GetBBReg(pDM_Odm, offset, bMaskDWord))); + + offset += 0x04; + } + ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, bMaskDWord, 0x00000000); + } + else if(path == RF_PATH_B) + { + //path B APK + //load APK setting + //path-B + offset = rPdp_AntB; + for(index = 0; index < 10; index ++) + { + ODM_SetBBReg(pDM_Odm, offset, bMaskDWord, APK_normal_setting_value_1[index]); + ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("phy_APCalibrate_8188E() offset 0x%x value 0x%x\n", offset, ODM_GetBBReg(pDM_Odm, offset, bMaskDWord))); + + offset += 0x04; + } + ODM_SetBBReg(pDM_Odm, rConfig_Pmpd_AntA, bMaskDWord, 0x12680000); +#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) + PHY_SetBBReg(pAdapter, rConfig_Pmpd_AntB, bMaskDWord, 0x12680000); +#else + PHY_SetBBReg(pDM_Odm, rConfig_Pmpd_AntB, bMaskDWord, 0x12680000); +#endif + + offset = rConfig_AntA; + index = 11; + for(; index < 13; index ++) //offset 0xb68, 0xb6c + { + ODM_SetBBReg(pDM_Odm, offset, bMaskDWord, APK_normal_setting_value_1[index]); + ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("phy_APCalibrate_8188E() offset 0x%x value 0x%x\n", offset, ODM_GetBBReg(pDM_Odm, offset, bMaskDWord))); + + offset += 0x04; + } + + //page-B1 + ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, bMaskDWord, 0x40000000); + + //path B + offset = 0xb60; + for(index = 0; index < 16; index++) + { + ODM_SetBBReg(pDM_Odm, offset, bMaskDWord, APK_normal_setting_value_2[index]); + ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("phy_APCalibrate_8188E() offset 0x%x value 0x%x\n", offset, ODM_GetBBReg(pDM_Odm, offset, bMaskDWord))); + + offset += 0x04; + } + ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, bMaskDWord, 0); + } + + //save RF default value +#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) + regD[path] = PHY_QueryRFReg(pAdapter, path, RF_TXBIAS_A, bMaskDWord); +#else + regD[path] = ODM_GetRFReg(pDM_Odm, path, RF_TXBIAS_A, bMaskDWord); +#endif + + //Path A AFE all on, path B AFE All off or vise versa + for(index = 0; index < IQK_ADDA_REG_NUM ; index++) + ODM_SetBBReg(pDM_Odm, AFE_REG[index], bMaskDWord, AFE_on_off[path]); + ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("phy_APCalibrate_8188E() offset 0xe70 %x\n", ODM_GetBBReg(pDM_Odm, rRx_Wait_CCA, bMaskDWord))); + + //BB to AP mode + if(path == 0) + { + for(index = 0; index < APK_BB_REG_NUM ; index++) + { + + if(index == 0) //skip + continue; + else if (index < 5) + ODM_SetBBReg(pDM_Odm, BB_REG[index], bMaskDWord, BB_AP_MODE[index]); + else if (BB_REG[index] == 0x870) + ODM_SetBBReg(pDM_Odm, BB_REG[index], bMaskDWord, BB_backup[index]|BIT10|BIT26); + else + ODM_SetBBReg(pDM_Odm, BB_REG[index], BIT10, 0x0); + } + + ODM_SetBBReg(pDM_Odm, rTx_IQK_Tone_A, bMaskDWord, 0x01008c00); + ODM_SetBBReg(pDM_Odm, rRx_IQK_Tone_A, bMaskDWord, 0x01008c00); + } + else //path B + { + ODM_SetBBReg(pDM_Odm, rTx_IQK_Tone_B, bMaskDWord, 0x01008c00); + ODM_SetBBReg(pDM_Odm, rRx_IQK_Tone_B, bMaskDWord, 0x01008c00); + + } + + ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("phy_APCalibrate_8188E() offset 0x800 %x\n", ODM_GetBBReg(pDM_Odm, 0x800, bMaskDWord))); + + //MAC settings +#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) + _PHY_MACSettingCalibration(pAdapter, MAC_REG, MAC_backup); +#else + _PHY_MACSettingCalibration(pDM_Odm, MAC_REG, MAC_backup); +#endif + + if(path == RF_PATH_A) //Path B to standby mode + { + ODM_SetRFReg(pDM_Odm, RF_PATH_B, RF_AC, bMaskDWord, 0x10000); + } + else //Path A to standby mode + { + ODM_SetRFReg(pDM_Odm, RF_PATH_A, RF_AC, bMaskDWord, 0x10000); + ODM_SetRFReg(pDM_Odm, RF_PATH_A, RF_MODE1, bMaskDWord, 0x1000f); + ODM_SetRFReg(pDM_Odm, RF_PATH_A, RF_MODE2, bMaskDWord, 0x20103); + } + + delta_offset = ((delta+14)/2); + if(delta_offset < 0) + delta_offset = 0; + else if (delta_offset > 12) + delta_offset = 12; + + //AP calibration + for(index = 0; index < APK_BB_REG_NUM; index++) + { + if(index != 1) //only DO PA11+PAD01001, AP RF setting + continue; + + tmpReg = APK_RF_init_value[path][index]; +#if 1 + if(!pDM_Odm->RFCalibrateInfo.bAPKThermalMeterIgnore) + { + BB_offset = (tmpReg & 0xF0000) >> 16; + + if(!(tmpReg & BIT15)) //sign bit 0 + { + BB_offset = -BB_offset; + } + + delta_V = APK_delta_mapping[index][delta_offset]; + + BB_offset += delta_V; + + ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("phy_APCalibrate_8188E() APK index %d tmpReg 0x%x delta_V %d delta_offset %d\n", index, tmpReg, delta_V, delta_offset)); + + if(BB_offset < 0) + { + tmpReg = tmpReg & (~BIT15); + BB_offset = -BB_offset; + } + else + { + tmpReg = tmpReg | BIT15; + } + tmpReg = (tmpReg & 0xFFF0FFFF) | (BB_offset << 16); + } +#endif + + ODM_SetRFReg(pDM_Odm, path, RF_IPA_A, bMaskDWord, 0x8992e); +#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) + ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("phy_APCalibrate_8188E() offset 0xc %x\n", PHY_QueryRFReg(pAdapter, path, RF_IPA_A, bMaskDWord))); + ODM_SetRFReg(pDM_Odm, path, RF_AC, bMaskDWord, APK_RF_value_0[path][index]); + ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("phy_APCalibrate_8188E() offset 0x0 %x\n", PHY_QueryRFReg(pAdapter, path, RF_AC, bMaskDWord))); + ODM_SetRFReg(pDM_Odm, path, RF_TXBIAS_A, bMaskDWord, tmpReg); + ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("phy_APCalibrate_8188E() offset 0xd %x\n", PHY_QueryRFReg(pAdapter, path, RF_TXBIAS_A, bMaskDWord))); +#else + ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("phy_APCalibrate_8188E() offset 0xc %x\n", ODM_GetRFReg(pDM_Odm, path, RF_IPA_A, bMaskDWord))); + ODM_SetRFReg(pDM_Odm, path, RF_AC, bMaskDWord, APK_RF_value_0[path][index]); + ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("phy_APCalibrate_8188E() offset 0x0 %x\n", ODM_GetRFReg(pDM_Odm, path, RF_AC, bMaskDWord))); + ODM_SetRFReg(pDM_Odm, path, RF_TXBIAS_A, bMaskDWord, tmpReg); + ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("phy_APCalibrate_8188E() offset 0xd %x\n", ODM_GetRFReg(pDM_Odm, path, RF_TXBIAS_A, bMaskDWord))); +#endif + + // PA11+PAD01111, one shot + i = 0; + do + { + ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, bMaskDWord, 0x80000000); + { + ODM_SetBBReg(pDM_Odm, APK_offset[path], bMaskDWord, APK_value[0]); + ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("phy_APCalibrate_8188E() offset 0x%x value 0x%x\n", APK_offset[path], ODM_GetBBReg(pDM_Odm, APK_offset[path], bMaskDWord))); + ODM_delay_ms(3); + ODM_SetBBReg(pDM_Odm, APK_offset[path], bMaskDWord, APK_value[1]); + ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("phy_APCalibrate_8188E() offset 0x%x value 0x%x\n", APK_offset[path], ODM_GetBBReg(pDM_Odm, APK_offset[path], bMaskDWord))); + + ODM_delay_ms(20); + } + ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, bMaskDWord, 0x00000000); + + if(path == RF_PATH_A) + tmpReg = ODM_GetBBReg(pDM_Odm, rAPK, 0x03E00000); + else + tmpReg = ODM_GetBBReg(pDM_Odm, rAPK, 0xF8000000); + ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("phy_APCalibrate_8188E() offset 0xbd8[25:21] %x\n", tmpReg)); + + + i++; + } + while(tmpReg > apkbound && i < 4); + + APK_result[path][index] = tmpReg; + } + } + + //reload MAC default value +#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) + _PHY_ReloadMACRegisters(pAdapter, MAC_REG, MAC_backup); +#else + _PHY_ReloadMACRegisters(pDM_Odm, MAC_REG, MAC_backup); +#endif + + //reload BB default value + for(index = 0; index < APK_BB_REG_NUM ; index++) + { + + if(index == 0) //skip + continue; + ODM_SetBBReg(pDM_Odm, BB_REG[index], bMaskDWord, BB_backup[index]); + } + + //reload AFE default value +#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) + _PHY_ReloadADDARegisters(pAdapter, AFE_REG, AFE_backup, IQK_ADDA_REG_NUM); +#else + _PHY_ReloadADDARegisters(pDM_Odm, AFE_REG, AFE_backup, IQK_ADDA_REG_NUM); +#endif + + //reload RF path default value + for(path = 0; path < pathbound; path++) + { + ODM_SetRFReg(pDM_Odm, path, 0xd, bMaskDWord, regD[path]); + if(path == RF_PATH_B) + { + ODM_SetRFReg(pDM_Odm, RF_PATH_A, RF_MODE1, bMaskDWord, 0x1000f); + ODM_SetRFReg(pDM_Odm, RF_PATH_A, RF_MODE2, bMaskDWord, 0x20101); + } + + //note no index == 0 + if (APK_result[path][1] > 6) + APK_result[path][1] = 6; + ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("apk path %d result %d 0x%x \t", path, 1, APK_result[path][1])); + } + + ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("\n")); + + + for(path = 0; path < pathbound; path++) + { + ODM_SetRFReg(pDM_Odm, path, 0x3, bMaskDWord, + ((APK_result[path][1] << 15) | (APK_result[path][1] << 10) | (APK_result[path][1] << 5) | APK_result[path][1])); + if(path == RF_PATH_A) + ODM_SetRFReg(pDM_Odm, path, 0x4, bMaskDWord, + ((APK_result[path][1] << 15) | (APK_result[path][1] << 10) | (0x00 << 5) | 0x05)); + else + ODM_SetRFReg(pDM_Odm, path, 0x4, bMaskDWord, + ((APK_result[path][1] << 15) | (APK_result[path][1] << 10) | (0x02 << 5) | 0x05)); +#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) + if(!IS_HARDWARE_TYPE_8723A(pAdapter)) + ODM_SetRFReg(pDM_Odm, path, RF_BS_PA_APSET_G9_G11, bMaskDWord, + ((0x08 << 15) | (0x08 << 10) | (0x08 << 5) | 0x08)); +#endif + } + + pDM_Odm->RFCalibrateInfo.bAPKdone = TRUE; + + ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("<==phy_APCalibrate_8188E()\n")); +} + + + +#define DP_BB_REG_NUM 7 +#define DP_RF_REG_NUM 1 +#define DP_RETRY_LIMIT 10 +#define DP_PATH_NUM 2 +#define DP_DPK_NUM 3 +#define DP_DPK_VALUE_NUM 2 + + + + + +VOID +PHY_IQCalibrate_8188E( +#if (DM_ODM_SUPPORT_TYPE & ODM_AP) + IN PDM_ODM_T pDM_Odm, +#else + IN struct adapter *pAdapter, +#endif + IN BOOLEAN bReCovery + ) +{ +#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter); + + #if (DM_ODM_SUPPORT_TYPE == ODM_MP) + PDM_ODM_T pDM_Odm = &pHalData->DM_OutSrc; + #else // (DM_ODM_SUPPORT_TYPE == ODM_CE) + PDM_ODM_T pDM_Odm = &pHalData->odmpriv; + #endif + + #if (MP_DRIVER == 1) + #if (DM_ODM_SUPPORT_TYPE == ODM_MP) + PMPT_CONTEXT pMptCtx = &(pAdapter->MptCtx); + #else// (DM_ODM_SUPPORT_TYPE == ODM_CE) + PMPT_CONTEXT pMptCtx = &(pAdapter->mppriv.MptCtx); + #endif + #endif//(MP_DRIVER == 1) +#endif + + s4Byte result[4][8]; //last is final result + u1Byte i, final_candidate, Indexforchannel; + u1Byte channelToIQK = 7; + BOOLEAN bPathAOK, bPathBOK; + s4Byte RegE94, RegE9C, RegEA4, RegEAC, RegEB4, RegEBC, RegEC4, RegECC, RegTmp = 0; + BOOLEAN is12simular, is13simular, is23simular; + BOOLEAN bStartContTx = FALSE, bSingleTone = FALSE, bCarrierSuppression = FALSE; + u4Byte IQK_BB_REG_92C[IQK_BB_REG_NUM] = { + rOFDM0_XARxIQImbalance, rOFDM0_XBRxIQImbalance, + rOFDM0_ECCAThreshold, rOFDM0_AGCRSSITable, + rOFDM0_XATxIQImbalance, rOFDM0_XBTxIQImbalance, + rOFDM0_XCTxAFE, rOFDM0_XDTxAFE, + rOFDM0_RxIQExtAnta}; + BOOLEAN is2T; + + is2T = (pDM_Odm->RFType == ODM_2T2R)?TRUE:FALSE; +#if (DM_ODM_SUPPORT_TYPE & (ODM_MP|ODM_CE) ) + if (ODM_CheckPowerStatus(pAdapter) == FALSE) + return; +#else + prtl8192cd_priv priv = pDM_Odm->priv; + +#ifdef MP_TEST + if(priv->pshare->rf_ft_var.mp_specific) + { + if((OPMODE & WIFI_MP_CTX_PACKET) || (OPMODE & WIFI_MP_CTX_ST)) + return; + } +#endif + + if(priv->pshare->IQK_88E_done) + bReCovery= 1; + priv->pshare->IQK_88E_done = 1; + +#endif + +#if (DM_ODM_SUPPORT_TYPE == ODM_CE) + if(!(pDM_Odm->SupportAbility & ODM_RF_CALIBRATION)) + { + return; + } +#endif + +#if MP_DRIVER == 1 +if (*(pDM_Odm->mp_mode) == 1) +{ + bStartContTx = pMptCtx->bStartContTx; + bSingleTone = pMptCtx->bSingleTone; + bCarrierSuppression = pMptCtx->bCarrierSuppression; +} +#endif + + // 20120213 Turn on when continuous Tx to pass lab testing. (required by Edlu) + if(bSingleTone || bCarrierSuppression) + return; + +#if DISABLE_BB_RF + return; +#endif + +#if (DM_ODM_SUPPORT_TYPE & (ODM_CE|ODM_AP)) + if(bReCovery) +#else//for ODM_MP + if(bReCovery && (!pAdapter->bInHctTest)) //YJ,add for PowerTest,120405 +#endif + { + ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_LOUD, ("PHY_IQCalibrate_8188E: Return due to bReCovery!\n")); +#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) + _PHY_ReloadADDARegisters(pAdapter, IQK_BB_REG_92C, pDM_Odm->RFCalibrateInfo.IQK_BB_backup_recover, 9); +#else + _PHY_ReloadADDARegisters(pDM_Odm, IQK_BB_REG_92C, pDM_Odm->RFCalibrateInfo.IQK_BB_backup_recover, 9); +#endif + return; + } + ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("IQK:Start!!!\n")); + +#if 0//Suggested by Edlu,120413 + + // IQK on channel 7, should switch back when completed. + //originChannel = pHalData->CurrentChannel; + originChannel = *(pDM_Odm->pChannel); + +#if (DM_ODM_SUPPORT_TYPE == ODM_MP) + pAdapter->HalFunc.SwChnlByTimerHandler(pAdapter, channelToIQK); +#elif (DM_ODM_SUPPORT_TYPE == ODM_CE) + pAdapter->HalFunc.set_channel_handler(pAdapter, channelToIQK); +#endif + +#endif + + for(i = 0; i < 8; i++) + { + result[0][i] = 0; + result[1][i] = 0; + result[2][i] = 0; + if((i==0) ||(i==2) || (i==4) || (i==6)) + result[3][i] = 0x100; + else + result[3][i] = 0; + } + final_candidate = 0xff; + bPathAOK = FALSE; + bPathBOK = FALSE; + is12simular = FALSE; + is23simular = FALSE; + is13simular = FALSE; + + + //ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("IQK !!!interface %d currentband %d ishardwareD %d \n", pDM_Odm->interfaceIndex, pHalData->CurrentBandType92D, IS_HARDWARE_TYPE_8192D(pAdapter))); +// RT_TRACE(COMP_INIT,DBG_LOUD,("Acquire Mutex in IQCalibrate \n")); + for (i=0; i<3; i++) + { + +#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) + phy_IQCalibrate_8188E(pAdapter, result, i, is2T); +#else + phy_IQCalibrate_8188E(pDM_Odm, result, i, is2T); +#endif + + + if(i == 1) + { +#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) + is12simular = phy_SimularityCompare_8188E(pAdapter, result, 0, 1); +#else + is12simular = phy_SimularityCompare_8188E(pDM_Odm, result, 0, 1); +#endif + if(is12simular) + { + final_candidate = 0; + ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("IQK: is12simular final_candidate is %x\n",final_candidate)); + break; + } + } + + if(i == 2) + { +#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) + is13simular = phy_SimularityCompare_8188E(pAdapter, result, 0, 2); +#else + is13simular = phy_SimularityCompare_8188E(pDM_Odm, result, 0, 2); +#endif + if(is13simular) + { + final_candidate = 0; + ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("IQK: is13simular final_candidate is %x\n",final_candidate)); + + break; + } +#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) + is23simular = phy_SimularityCompare_8188E(pAdapter, result, 1, 2); +#else + is23simular = phy_SimularityCompare_8188E(pDM_Odm, result, 1, 2); +#endif + if(is23simular) + { + final_candidate = 1; + ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("IQK: is23simular final_candidate is %x\n",final_candidate)); + } + else + { + /* + for(i = 0; i < 8; i++) + RegTmp += result[3][i]; + + if(RegTmp != 0) + final_candidate = 3; + else + final_candidate = 0xFF; + */ + final_candidate = 3; + } + } + } +// RT_TRACE(COMP_INIT,DBG_LOUD,("Release Mutex in IQCalibrate \n")); + + for (i=0; i<4; i++) + { + RegE94 = result[i][0]; + RegE9C = result[i][1]; + RegEA4 = result[i][2]; + RegEAC = result[i][3]; + RegEB4 = result[i][4]; + RegEBC = result[i][5]; + RegEC4 = result[i][6]; + RegECC = result[i][7]; + ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("IQK: RegE94=%x RegE9C=%x RegEA4=%x RegEAC=%x RegEB4=%x RegEBC=%x RegEC4=%x RegECC=%x\n ", RegE94, RegE9C, RegEA4, RegEAC, RegEB4, RegEBC, RegEC4, RegECC)); + } + + if(final_candidate != 0xff) + { + pDM_Odm->RFCalibrateInfo.RegE94 = RegE94 = result[final_candidate][0]; + pDM_Odm->RFCalibrateInfo.RegE9C = RegE9C = result[final_candidate][1]; + RegEA4 = result[final_candidate][2]; + RegEAC = result[final_candidate][3]; + pDM_Odm->RFCalibrateInfo.RegEB4 = RegEB4 = result[final_candidate][4]; + pDM_Odm->RFCalibrateInfo.RegEBC = RegEBC = result[final_candidate][5]; + RegEC4 = result[final_candidate][6]; + RegECC = result[final_candidate][7]; + ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("IQK: final_candidate is %x\n",final_candidate)); + ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("IQK: RegE94=%x RegE9C=%x RegEA4=%x RegEAC=%x RegEB4=%x RegEBC=%x RegEC4=%x RegECC=%x\n ", RegE94, RegE9C, RegEA4, RegEAC, RegEB4, RegEBC, RegEC4, RegECC)); + bPathAOK = bPathBOK = TRUE; + } + else + { + ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("IQK: FAIL use default value\n")); + + pDM_Odm->RFCalibrateInfo.RegE94 = pDM_Odm->RFCalibrateInfo.RegEB4 = 0x100; //X default value + pDM_Odm->RFCalibrateInfo.RegE9C = pDM_Odm->RFCalibrateInfo.RegEBC = 0x0; //Y default value + } + + if((RegE94 != 0)/*&&(RegEA4 != 0)*/) + { +#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) + _PHY_PathAFillIQKMatrix(pAdapter, bPathAOK, result, final_candidate, (RegEA4 == 0)); +#else + _PHY_PathAFillIQKMatrix(pDM_Odm, bPathAOK, result, final_candidate, (RegEA4 == 0)); +#endif + } + +#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) + if (is2T) + { + if((RegEB4 != 0)/*&&(RegEC4 != 0)*/) + { + _PHY_PathBFillIQKMatrix(pAdapter, bPathBOK, result, final_candidate, (RegEC4 == 0)); + } + } +#endif + +#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) + Indexforchannel = ODM_GetRightChnlPlaceforIQK(pHalData->CurrentChannel); +#else + Indexforchannel = 0; +#endif + +//To Fix BSOD when final_candidate is 0xff +//by sherry 20120321 + if(final_candidate < 4) + { + for(i = 0; i < IQK_Matrix_REG_NUM; i++) + pDM_Odm->RFCalibrateInfo.IQKMatrixRegSetting[Indexforchannel].Value[0][i] = result[final_candidate][i]; + pDM_Odm->RFCalibrateInfo.IQKMatrixRegSetting[Indexforchannel].bIQKDone = TRUE; + } + //RTPRINT(FINIT, INIT_IQK, ("\nIQK OK Indexforchannel %d.\n", Indexforchannel)); + ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("\nIQK OK Indexforchannel %d.\n", Indexforchannel)); +#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) + + _PHY_SaveADDARegisters(pAdapter, IQK_BB_REG_92C, pDM_Odm->RFCalibrateInfo.IQK_BB_backup_recover, 9); +#else + _PHY_SaveADDARegisters(pDM_Odm, IQK_BB_REG_92C, pDM_Odm->RFCalibrateInfo.IQK_BB_backup_recover, IQK_BB_REG_NUM); +#endif + + ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("IQK finished\n")); +#if 0 //Suggested by Edlu,120413 + + #if (DM_ODM_SUPPORT_TYPE == ODM_MP) + pAdapter->HalFunc.SwChnlByTimerHandler(pAdapter, originChannel); + #elif (DM_ODM_SUPPORT_TYPE == ODM_CE) + pAdapter->HalFunc.set_channel_handler(pAdapter, originChannel); + #endif + +#endif + +} + + +VOID +PHY_LCCalibrate_8188E( +#if (DM_ODM_SUPPORT_TYPE & ODM_AP) + IN PDM_ODM_T pDM_Odm +#else + IN struct adapter *pAdapter +#endif + ) +{ + BOOLEAN bStartContTx = FALSE, bSingleTone = FALSE, bCarrierSuppression = FALSE; + u4Byte timeout = 2000, timecount = 0; + +#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter); + + #if (DM_ODM_SUPPORT_TYPE == ODM_MP) + PDM_ODM_T pDM_Odm = &pHalData->DM_OutSrc; + #else // (DM_ODM_SUPPORT_TYPE == ODM_CE) + PDM_ODM_T pDM_Odm = &pHalData->odmpriv; + #endif + + #if (MP_DRIVER == 1) + #if (DM_ODM_SUPPORT_TYPE == ODM_MP) + PMPT_CONTEXT pMptCtx = &(pAdapter->MptCtx); + #else// (DM_ODM_SUPPORT_TYPE == ODM_CE) + PMPT_CONTEXT pMptCtx = &(pAdapter->mppriv.MptCtx); + #endif + #endif//(MP_DRIVER == 1) +#endif + + + + +#if MP_DRIVER == 1 +if (*(pDM_Odm->mp_mode) == 1) +{ + bStartContTx = pMptCtx->bStartContTx; + bSingleTone = pMptCtx->bSingleTone; + bCarrierSuppression = pMptCtx->bCarrierSuppression; +} +#endif + + +#if DISABLE_BB_RF + return; +#endif + +#if (DM_ODM_SUPPORT_TYPE == ODM_CE) + if(!(pDM_Odm->SupportAbility & ODM_RF_CALIBRATION)) + { + return; + } +#endif + // 20120213 Turn on when continuous Tx to pass lab testing. (required by Edlu) + if(bSingleTone || bCarrierSuppression) + return; + + while(*(pDM_Odm->pbScanInProcess) && timecount < timeout) + { + ODM_delay_ms(50); + timecount += 50; + } + + pDM_Odm->RFCalibrateInfo.bLCKInProgress = TRUE; + + //ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("LCK:Start!!!interface %d currentband %x delay %d ms\n", pDM_Odm->interfaceIndex, pHalData->CurrentBandType92D, timecount)); +#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) + + if(pDM_Odm->RFType == ODM_2T2R) + { + phy_LCCalibrate_8188E(pAdapter, TRUE); + } + else +#endif + { + // For 88C 1T1R +#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) + phy_LCCalibrate_8188E(pAdapter, FALSE); +#else + phy_LCCalibrate_8188E(pDM_Odm, FALSE); +#endif + } + + pDM_Odm->RFCalibrateInfo.bLCKInProgress = FALSE; + + ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("LCK:Finish!!!interface %d\n", pDM_Odm->InterfaceIndex)); + +} + +VOID +PHY_APCalibrate_8188E( +#if (DM_ODM_SUPPORT_TYPE & ODM_AP) + IN PDM_ODM_T pDM_Odm, +#else + IN struct adapter *pAdapter, +#endif + IN s1Byte delta + ) +{ +#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter); + #if (DM_ODM_SUPPORT_TYPE == ODM_CE) + PDM_ODM_T pDM_Odm = &pHalData->odmpriv; + #endif + #if (DM_ODM_SUPPORT_TYPE == ODM_MP) + PDM_ODM_T pDM_Odm = &pHalData->DM_OutSrc; + #endif +#endif +#if DISABLE_BB_RF + return; +#endif + + return; +#if (DM_ODM_SUPPORT_TYPE == ODM_CE) + if(!(pDM_Odm->SupportAbility & ODM_RF_CALIBRATION)) + { + return; + } +#endif + +#if FOR_BRAZIL_PRETEST != 1 + if(pDM_Odm->RFCalibrateInfo.bAPKdone) +#endif + return; + +#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) + if(pDM_Odm->RFType == ODM_2T2R){ + phy_APCalibrate_8188E(pAdapter, delta, TRUE); + } + else +#endif + { + // For 88C 1T1R +#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) + phy_APCalibrate_8188E(pAdapter, delta, FALSE); +#else + phy_APCalibrate_8188E(pDM_Odm, delta, FALSE); +#endif + } +} +VOID phy_SetRFPathSwitch_8188E( +#if (DM_ODM_SUPPORT_TYPE & ODM_AP) + IN PDM_ODM_T pDM_Odm, +#else + IN struct adapter *pAdapter, +#endif + IN BOOLEAN bMain, + IN BOOLEAN is2T + ) +{ +#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter); + #if (DM_ODM_SUPPORT_TYPE == ODM_CE) + PDM_ODM_T pDM_Odm = &pHalData->odmpriv; + #elif (DM_ODM_SUPPORT_TYPE == ODM_MP) + PDM_ODM_T pDM_Odm = &pHalData->DM_OutSrc; + #endif + + #if (DM_ODM_SUPPORT_TYPE == ODM_MP) + if(!pAdapter->bHWInitReady) + #elif (DM_ODM_SUPPORT_TYPE == ODM_CE) + if(pAdapter->hw_init_completed == _FALSE) + #endif + { + u1Byte u1bTmp; + u1bTmp = ODM_Read1Byte(pDM_Odm, REG_LEDCFG2) | BIT7; + ODM_Write1Byte(pDM_Odm, REG_LEDCFG2, u1bTmp); + //ODM_SetBBReg(pDM_Odm, REG_LEDCFG0, BIT23, 0x01); + ODM_SetBBReg(pDM_Odm, rFPGA0_XAB_RFParameter, BIT13, 0x01); + } + +#endif + + if(is2T) //92C + { + if(bMain) + ODM_SetBBReg(pDM_Odm, rFPGA0_XB_RFInterfaceOE, BIT5|BIT6, 0x1); //92C_Path_A + else + ODM_SetBBReg(pDM_Odm, rFPGA0_XB_RFInterfaceOE, BIT5|BIT6, 0x2); //BT + } + else //88C + { + + if(bMain) + ODM_SetBBReg(pDM_Odm, rFPGA0_XA_RFInterfaceOE, BIT8|BIT9, 0x2); //Main + else + ODM_SetBBReg(pDM_Odm, rFPGA0_XA_RFInterfaceOE, BIT8|BIT9, 0x1); //Aux + } +} +VOID PHY_SetRFPathSwitch_8188E( +#if (DM_ODM_SUPPORT_TYPE & ODM_AP) + IN PDM_ODM_T pDM_Odm, +#else + IN struct adapter *pAdapter, +#endif + IN BOOLEAN bMain + ) +{ +#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter); + #if (DM_ODM_SUPPORT_TYPE == ODM_CE) + PDM_ODM_T pDM_Odm = &pHalData->odmpriv; + #endif + #if (DM_ODM_SUPPORT_TYPE == ODM_MP) + PDM_ODM_T pDM_Odm = &pHalData->DM_OutSrc; + #endif +#endif + + +#if DISABLE_BB_RF + return; +#endif + +#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) + if(pDM_Odm->RFType == ODM_2T2R) + { + phy_SetRFPathSwitch_8188E(pAdapter, bMain, TRUE); + } + else +#endif + { + // For 88C 1T1R +#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) + phy_SetRFPathSwitch_8188E(pAdapter, bMain, FALSE); +#else + phy_SetRFPathSwitch_8188E(pDM_Odm, bMain, FALSE); +#endif + } +} + +#if (DM_ODM_SUPPORT_TYPE == ODM_MP) +//digital predistortion +VOID +phy_DigitalPredistortion( +#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) + IN struct adapter *pAdapter, +#else + IN PDM_ODM_T pDM_Odm, +#endif + IN BOOLEAN is2T + ) +{ +} + +VOID +PHY_DigitalPredistortion_8188E( +#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) + IN struct adapter *pAdapter +#else + IN PDM_ODM_T pDM_Odm +#endif + ) +{ +#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter); + #if (DM_ODM_SUPPORT_TYPE == ODM_CE) + PDM_ODM_T pDM_Odm = &pHalData->odmpriv; + #endif + #if (DM_ODM_SUPPORT_TYPE == ODM_MP) + PDM_ODM_T pDM_Odm = &pHalData->DM_OutSrc; + #endif +#endif +#if DISABLE_BB_RF + return; +#endif + + return; + + if(pDM_Odm->RFCalibrateInfo.bDPdone) + return; +#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) + + if(pDM_Odm->RFType == ODM_2T2R){ + phy_DigitalPredistortion(pAdapter, TRUE); + } + else +#endif + { + // For 88C 1T1R + phy_DigitalPredistortion(pAdapter, FALSE); + } +} + + + +//return value TRUE => Main; FALSE => Aux + +BOOLEAN phy_QueryRFPathSwitch_8188E( +#if (DM_ODM_SUPPORT_TYPE & ODM_AP) + IN PDM_ODM_T pDM_Odm, +#else + IN struct adapter *pAdapter, +#endif + IN BOOLEAN is2T + ) +{ +#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter); + #if (DM_ODM_SUPPORT_TYPE == ODM_CE) + PDM_ODM_T pDM_Odm = &pHalData->odmpriv; + #endif + #if (DM_ODM_SUPPORT_TYPE == ODM_MP) + PDM_ODM_T pDM_Odm = &pHalData->DM_OutSrc; + #endif +#endif + if(!pAdapter->bHWInitReady) + { + u1Byte u1bTmp; + u1bTmp = ODM_Read1Byte(pDM_Odm, REG_LEDCFG2) | BIT7; + ODM_Write1Byte(pDM_Odm, REG_LEDCFG2, u1bTmp); + //ODM_SetBBReg(pDM_Odm, REG_LEDCFG0, BIT23, 0x01); + ODM_SetBBReg(pDM_Odm, rFPGA0_XAB_RFParameter, BIT13, 0x01); + } + + if(is2T) // + { + if(ODM_GetBBReg(pDM_Odm, rFPGA0_XB_RFInterfaceOE, BIT5|BIT6) == 0x01) + return TRUE; + else + return FALSE; + } + else + { + if(ODM_GetBBReg(pDM_Odm, rFPGA0_XA_RFInterfaceOE, BIT8|BIT9) == 0x02) + return TRUE; + else + return FALSE; + } +} + + + +//return value TRUE => Main; FALSE => Aux +BOOLEAN PHY_QueryRFPathSwitch_8188E( +#if (DM_ODM_SUPPORT_TYPE & ODM_AP) + IN PDM_ODM_T pDM_Odm +#else + IN struct adapter *pAdapter +#endif + ) +{ +#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter); + #if (DM_ODM_SUPPORT_TYPE == ODM_CE) + PDM_ODM_T pDM_Odm = &pHalData->odmpriv; + #endif + #if (DM_ODM_SUPPORT_TYPE == ODM_MP) + PDM_ODM_T pDM_Odm = &pHalData->DM_OutSrc; + #endif +#endif + + +#if DISABLE_BB_RF + return TRUE; +#endif +#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) + + //if(IS_92C_SERIAL( pHalData->VersionID)){ + if(pDM_Odm->RFType == ODM_2T2R){ + return phy_QueryRFPathSwitch_8188E(pAdapter, TRUE); + } + else +#endif + { + // For 88C 1T1R +#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) + return phy_QueryRFPathSwitch_8188E(pAdapter, FALSE); +#else + return phy_QueryRFPathSwitch_8188E(pDM_Odm, FALSE); +#endif + } +} +#endif diff --git a/hal/HalPwrSeqCmd.c b/hal/HalPwrSeqCmd.c index 6a27c7f..e7d6067 100755 --- a/hal/HalPwrSeqCmd.c +++ b/hal/HalPwrSeqCmd.c @@ -1,187 +1,185 @@ -/****************************************************************************** - * - * 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 - * - * - ******************************************************************************/ -/*++ -Copyright (c) Realtek Semiconductor Corp. All rights reserved. - -Module Name: - HalPwrSeqCmd.c - -Abstract: - Implement HW Power sequence configuration CMD handling routine for Realtek devices. - -Major Change History: - When Who What - ---------- --------------- ------------------------------- - 2011-10-26 Lucas Modify to be compatible with SD4-CE driver. - 2011-07-07 Roger Create. - ---*/ -#include -#ifdef CONFIG_SDIO_HCI -#include -#elif defined(CONFIG_GSPI_HCI) -#include -#endif - -// -// Description: -// This routine deal with the Power Configuration CMDs parsing for RTL8723/RTL8188E Series IC. -// -// Assumption: -// We should follow specific format which was released from HW SD. -// -// 2011.07.07, added by Roger. -// -u8 HalPwrSeqCmdParsing( - struct adapter * padapter, - u8 CutVersion, - u8 FabVersion, - u8 InterfaceType, - WLAN_PWR_CFG PwrSeqCmd[]) -{ - WLAN_PWR_CFG PwrCfgCmd = {0}; - u8 bPollingBit = _FALSE; - u32 AryIdx = 0; - u8 value = 0; - u32 offset = 0; - u32 pollingCount = 0; // polling autoload done. - u32 maxPollingCnt = 5000; - - do { - PwrCfgCmd = PwrSeqCmd[AryIdx]; - - RT_TRACE(_module_hal_init_c_ , _drv_info_, - ("HalPwrSeqCmdParsing: offset(%#x) cut_msk(%#x) fab_msk(%#x) interface_msk(%#x) base(%#x) cmd(%#x) msk(%#x) value(%#x)\n", - GET_PWR_CFG_OFFSET(PwrCfgCmd), - GET_PWR_CFG_CUT_MASK(PwrCfgCmd), - GET_PWR_CFG_FAB_MASK(PwrCfgCmd), - GET_PWR_CFG_INTF_MASK(PwrCfgCmd), - GET_PWR_CFG_BASE(PwrCfgCmd), - GET_PWR_CFG_CMD(PwrCfgCmd), - GET_PWR_CFG_MASK(PwrCfgCmd), - GET_PWR_CFG_VALUE(PwrCfgCmd))); - - //2 Only Handle the command whose FAB, CUT, and Interface are matched - if ((GET_PWR_CFG_FAB_MASK(PwrCfgCmd) & FabVersion) && - (GET_PWR_CFG_CUT_MASK(PwrCfgCmd) & CutVersion) && - (GET_PWR_CFG_INTF_MASK(PwrCfgCmd) & InterfaceType)) - { - switch (GET_PWR_CFG_CMD(PwrCfgCmd)) - { - case PWR_CMD_READ: - RT_TRACE(_module_hal_init_c_ , _drv_info_, ("HalPwrSeqCmdParsing: PWR_CMD_READ\n")); - break; - - case PWR_CMD_WRITE: - RT_TRACE(_module_hal_init_c_ , _drv_info_, ("HalPwrSeqCmdParsing: PWR_CMD_WRITE\n")); - offset = GET_PWR_CFG_OFFSET(PwrCfgCmd); - -#ifdef CONFIG_SDIO_HCI - // - // We should deal with interface specific address mapping for some interfaces, e.g., SDIO interface - // 2011.07.07. - // - if (GET_PWR_CFG_BASE(PwrCfgCmd) == PWR_BASEADDR_SDIO) - { - // Read Back SDIO Local value - value = SdioLocalCmd52Read1Byte(padapter, offset); - - value &= ~(GET_PWR_CFG_MASK(PwrCfgCmd)); - value |= (GET_PWR_CFG_VALUE(PwrCfgCmd) & GET_PWR_CFG_MASK(PwrCfgCmd)); - - // Write Back SDIO Local value - SdioLocalCmd52Write1Byte(padapter, offset, value); - } - else -#endif - { -#ifdef CONFIG_GSPI_HCI - if (GET_PWR_CFG_BASE(PwrCfgCmd) == PWR_BASEADDR_SDIO) - offset = SPI_LOCAL_OFFSET | offset; -#endif - // Read the value from system register - value = rtw_read8(padapter, offset); - - value &= ~(GET_PWR_CFG_MASK(PwrCfgCmd)); - value |= (GET_PWR_CFG_VALUE(PwrCfgCmd) & GET_PWR_CFG_MASK(PwrCfgCmd)); - - // Write the value back to sytem register - rtw_write8(padapter, offset, value); - } - break; - - case PWR_CMD_POLLING: - RT_TRACE(_module_hal_init_c_ , _drv_info_, ("HalPwrSeqCmdParsing: PWR_CMD_POLLING\n")); - - bPollingBit = _FALSE; - offset = GET_PWR_CFG_OFFSET(PwrCfgCmd); -#ifdef CONFIG_GSPI_HCI - if (GET_PWR_CFG_BASE(PwrCfgCmd) == PWR_BASEADDR_SDIO) - offset = SPI_LOCAL_OFFSET | offset; -#endif - do { -#ifdef CONFIG_SDIO_HCI - if (GET_PWR_CFG_BASE(PwrCfgCmd) == PWR_BASEADDR_SDIO) - value = SdioLocalCmd52Read1Byte(padapter, offset); - else -#endif - value = rtw_read8(padapter, offset); - - value &= GET_PWR_CFG_MASK(PwrCfgCmd); - if (value == (GET_PWR_CFG_VALUE(PwrCfgCmd) & GET_PWR_CFG_MASK(PwrCfgCmd))) - bPollingBit = _TRUE; - else - rtw_udelay_os(10); - - if (pollingCount++ > maxPollingCnt) { - DBG_871X("Fail to polling Offset[%#x]\n", offset); - return _FALSE; - } - } while (!bPollingBit); - - break; - - case PWR_CMD_DELAY: - RT_TRACE(_module_hal_init_c_ , _drv_info_, ("HalPwrSeqCmdParsing: PWR_CMD_DELAY\n")); - if (GET_PWR_CFG_VALUE(PwrCfgCmd) == PWRSEQ_DELAY_US) - rtw_udelay_os(GET_PWR_CFG_OFFSET(PwrCfgCmd)); - else - rtw_udelay_os(GET_PWR_CFG_OFFSET(PwrCfgCmd)*1000); - break; - - case PWR_CMD_END: - // When this command is parsed, end the process - RT_TRACE(_module_hal_init_c_ , _drv_info_, ("HalPwrSeqCmdParsing: PWR_CMD_END\n")); - return _TRUE; - break; - - default: - RT_TRACE(_module_hal_init_c_ , _drv_err_, ("HalPwrSeqCmdParsing: Unknown CMD!!\n")); - break; - } - } - - AryIdx++;//Add Array Index - }while(1); - - return _TRUE; -} - - +/****************************************************************************** + * + * 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 + * + * + ******************************************************************************/ +/*++ +Copyright (c) Realtek Semiconductor Corp. All rights reserved. + +Module Name: + HalPwrSeqCmd.c + +Abstract: + Implement HW Power sequence configuration CMD handling routine for Realtek devices. + +Major Change History: + When Who What + ---------- --------------- ------------------------------- + 2011-10-26 Lucas Modify to be compatible with SD4-CE driver. + 2011-07-07 Roger Create. + +--*/ +#include +#ifdef CONFIG_SDIO_HCI +#include +#elif defined(CONFIG_GSPI_HCI) +#include +#endif + +// +// Description: +// This routine deal with the Power Configuration CMDs parsing for RTL8723/RTL8188E Series IC. +// +// Assumption: +// We should follow specific format which was released from HW SD. +// +// 2011.07.07, added by Roger. +// +u8 HalPwrSeqCmdParsing( + struct adapter * padapter, + u8 CutVersion, + u8 FabVersion, + u8 InterfaceType, + WLAN_PWR_CFG PwrSeqCmd[]) +{ + WLAN_PWR_CFG PwrCfgCmd = {0}; + u8 bPollingBit = _FALSE; + u32 AryIdx = 0; + u8 value = 0; + u32 offset = 0; + u32 pollingCount = 0; // polling autoload done. + u32 maxPollingCnt = 5000; + + do { + PwrCfgCmd = PwrSeqCmd[AryIdx]; + + RT_TRACE(_module_hal_init_c_ , _drv_info_, + ("HalPwrSeqCmdParsing: offset(%#x) cut_msk(%#x) fab_msk(%#x) interface_msk(%#x) base(%#x) cmd(%#x) msk(%#x) value(%#x)\n", + GET_PWR_CFG_OFFSET(PwrCfgCmd), + GET_PWR_CFG_CUT_MASK(PwrCfgCmd), + GET_PWR_CFG_FAB_MASK(PwrCfgCmd), + GET_PWR_CFG_INTF_MASK(PwrCfgCmd), + GET_PWR_CFG_BASE(PwrCfgCmd), + GET_PWR_CFG_CMD(PwrCfgCmd), + GET_PWR_CFG_MASK(PwrCfgCmd), + GET_PWR_CFG_VALUE(PwrCfgCmd))); + + //2 Only Handle the command whose FAB, CUT, and Interface are matched + if ((GET_PWR_CFG_FAB_MASK(PwrCfgCmd) & FabVersion) && + (GET_PWR_CFG_CUT_MASK(PwrCfgCmd) & CutVersion) && + (GET_PWR_CFG_INTF_MASK(PwrCfgCmd) & InterfaceType)) + { + switch (GET_PWR_CFG_CMD(PwrCfgCmd)) + { + case PWR_CMD_READ: + RT_TRACE(_module_hal_init_c_ , _drv_info_, ("HalPwrSeqCmdParsing: PWR_CMD_READ\n")); + break; + + case PWR_CMD_WRITE: + RT_TRACE(_module_hal_init_c_ , _drv_info_, ("HalPwrSeqCmdParsing: PWR_CMD_WRITE\n")); + offset = GET_PWR_CFG_OFFSET(PwrCfgCmd); + +#ifdef CONFIG_SDIO_HCI + // + // We should deal with interface specific address mapping for some interfaces, e.g., SDIO interface + // 2011.07.07. + // + if (GET_PWR_CFG_BASE(PwrCfgCmd) == PWR_BASEADDR_SDIO) + { + // Read Back SDIO Local value + value = SdioLocalCmd52Read1Byte(padapter, offset); + + value &= ~(GET_PWR_CFG_MASK(PwrCfgCmd)); + value |= (GET_PWR_CFG_VALUE(PwrCfgCmd) & GET_PWR_CFG_MASK(PwrCfgCmd)); + + // Write Back SDIO Local value + SdioLocalCmd52Write1Byte(padapter, offset, value); + } + else +#endif + { +#ifdef CONFIG_GSPI_HCI + if (GET_PWR_CFG_BASE(PwrCfgCmd) == PWR_BASEADDR_SDIO) + offset = SPI_LOCAL_OFFSET | offset; +#endif + // Read the value from system register + value = rtw_read8(padapter, offset); + + value &= ~(GET_PWR_CFG_MASK(PwrCfgCmd)); + value |= (GET_PWR_CFG_VALUE(PwrCfgCmd) & GET_PWR_CFG_MASK(PwrCfgCmd)); + + // Write the value back to sytem register + rtw_write8(padapter, offset, value); + } + break; + + case PWR_CMD_POLLING: + RT_TRACE(_module_hal_init_c_ , _drv_info_, ("HalPwrSeqCmdParsing: PWR_CMD_POLLING\n")); + + bPollingBit = _FALSE; + offset = GET_PWR_CFG_OFFSET(PwrCfgCmd); +#ifdef CONFIG_GSPI_HCI + if (GET_PWR_CFG_BASE(PwrCfgCmd) == PWR_BASEADDR_SDIO) + offset = SPI_LOCAL_OFFSET | offset; +#endif + do { +#ifdef CONFIG_SDIO_HCI + if (GET_PWR_CFG_BASE(PwrCfgCmd) == PWR_BASEADDR_SDIO) + value = SdioLocalCmd52Read1Byte(padapter, offset); + else +#endif + value = rtw_read8(padapter, offset); + + value &= GET_PWR_CFG_MASK(PwrCfgCmd); + if (value == (GET_PWR_CFG_VALUE(PwrCfgCmd) & GET_PWR_CFG_MASK(PwrCfgCmd))) + bPollingBit = _TRUE; + else + rtw_udelay_os(10); + + if (pollingCount++ > maxPollingCnt) { + DBG_871X("Fail to polling Offset[%#x]\n", offset); + return _FALSE; + } + } while (!bPollingBit); + + break; + + case PWR_CMD_DELAY: + RT_TRACE(_module_hal_init_c_ , _drv_info_, ("HalPwrSeqCmdParsing: PWR_CMD_DELAY\n")); + if (GET_PWR_CFG_VALUE(PwrCfgCmd) == PWRSEQ_DELAY_US) + rtw_udelay_os(GET_PWR_CFG_OFFSET(PwrCfgCmd)); + else + rtw_udelay_os(GET_PWR_CFG_OFFSET(PwrCfgCmd)*1000); + break; + + case PWR_CMD_END: + // When this command is parsed, end the process + RT_TRACE(_module_hal_init_c_ , _drv_info_, ("HalPwrSeqCmdParsing: PWR_CMD_END\n")); + return _TRUE; + break; + + default: + RT_TRACE(_module_hal_init_c_ , _drv_err_, ("HalPwrSeqCmdParsing: Unknown CMD!!\n")); + break; + } + } + + AryIdx++;//Add Array Index + }while(1); + + return _TRUE; +} diff --git a/hal/hal_com.c b/hal/hal_com.c index 00839ec..261ba37 100755 --- a/hal/hal_com.c +++ b/hal/hal_com.c @@ -1,7 +1,7 @@ /****************************************************************************** * * 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. @@ -107,7 +107,7 @@ hal_com_get_channel_plan( u8 MRateToHwRate(u8 rate) { u8 ret = DESC_RATE1M; - + switch(rate) { // CCK and OFDM non-HT rates @@ -151,9 +151,9 @@ void HalSetBrateCfg( { is_brate = mBratesOS[i] & IEEE80211_BASIC_RATE_MASK; brate = mBratesOS[i] & 0x7f; - + if( is_brate ) - { + { switch(brate) { case IEEE80211_CCK_RATE_1MB: *pBrateCfg |= RATE_1M; break; @@ -184,7 +184,7 @@ _OneOutPipeMapping( pdvobjpriv->Queue2Pipe[1] = pdvobjpriv->RtOutPipe[0];//VI pdvobjpriv->Queue2Pipe[2] = pdvobjpriv->RtOutPipe[0];//BE pdvobjpriv->Queue2Pipe[3] = pdvobjpriv->RtOutPipe[0];//BK - + pdvobjpriv->Queue2Pipe[4] = pdvobjpriv->RtOutPipe[0];//BCN pdvobjpriv->Queue2Pipe[5] = pdvobjpriv->RtOutPipe[0];//MGT pdvobjpriv->Queue2Pipe[6] = pdvobjpriv->RtOutPipe[0];//HIGH @@ -194,89 +194,89 @@ _OneOutPipeMapping( static VOID _TwoOutPipeMapping( IN struct adapter *pAdapter, - IN BOOLEAN bWIFICfg + IN BOOLEAN bWIFICfg ) { struct dvobj_priv *pdvobjpriv = adapter_to_dvobj(pAdapter); if(bWIFICfg){ //WMM - - // BK, BE, VI, VO, BCN, CMD,MGT,HIGH,HCCA - //{ 0, 1, 0, 1, 0, 0, 0, 0, 0 }; - //0:H, 1:L - + + // BK, BE, VI, VO, BCN, CMD,MGT,HIGH,HCCA + //{ 0, 1, 0, 1, 0, 0, 0, 0, 0 }; + //0:H, 1:L + pdvobjpriv->Queue2Pipe[0] = pdvobjpriv->RtOutPipe[1];//VO pdvobjpriv->Queue2Pipe[1] = pdvobjpriv->RtOutPipe[0];//VI pdvobjpriv->Queue2Pipe[2] = pdvobjpriv->RtOutPipe[1];//BE pdvobjpriv->Queue2Pipe[3] = pdvobjpriv->RtOutPipe[0];//BK - + pdvobjpriv->Queue2Pipe[4] = pdvobjpriv->RtOutPipe[0];//BCN pdvobjpriv->Queue2Pipe[5] = pdvobjpriv->RtOutPipe[0];//MGT pdvobjpriv->Queue2Pipe[6] = pdvobjpriv->RtOutPipe[0];//HIGH pdvobjpriv->Queue2Pipe[7] = pdvobjpriv->RtOutPipe[0];//TXCMD - + } else{//typical setting - - //BK, BE, VI, VO, BCN, CMD,MGT,HIGH,HCCA - //{ 1, 1, 0, 0, 0, 0, 0, 0, 0 }; - //0:H, 1:L - + + //BK, BE, VI, VO, BCN, CMD,MGT,HIGH,HCCA + //{ 1, 1, 0, 0, 0, 0, 0, 0, 0 }; + //0:H, 1:L + pdvobjpriv->Queue2Pipe[0] = pdvobjpriv->RtOutPipe[0];//VO pdvobjpriv->Queue2Pipe[1] = pdvobjpriv->RtOutPipe[0];//VI pdvobjpriv->Queue2Pipe[2] = pdvobjpriv->RtOutPipe[1];//BE pdvobjpriv->Queue2Pipe[3] = pdvobjpriv->RtOutPipe[1];//BK - + pdvobjpriv->Queue2Pipe[4] = pdvobjpriv->RtOutPipe[0];//BCN pdvobjpriv->Queue2Pipe[5] = pdvobjpriv->RtOutPipe[0];//MGT pdvobjpriv->Queue2Pipe[6] = pdvobjpriv->RtOutPipe[0];//HIGH - pdvobjpriv->Queue2Pipe[7] = pdvobjpriv->RtOutPipe[0];//TXCMD - + pdvobjpriv->Queue2Pipe[7] = pdvobjpriv->RtOutPipe[0];//TXCMD + } - + } static VOID _ThreeOutPipeMapping( IN struct adapter *pAdapter, - IN BOOLEAN bWIFICfg + IN BOOLEAN bWIFICfg ) { struct dvobj_priv *pdvobjpriv = adapter_to_dvobj(pAdapter); if(bWIFICfg){//for WMM - - // BK, BE, VI, VO, BCN, CMD,MGT,HIGH,HCCA - //{ 1, 2, 1, 0, 0, 0, 0, 0, 0 }; - //0:H, 1:N, 2:L - + + // BK, BE, VI, VO, BCN, CMD,MGT,HIGH,HCCA + //{ 1, 2, 1, 0, 0, 0, 0, 0, 0 }; + //0:H, 1:N, 2:L + pdvobjpriv->Queue2Pipe[0] = pdvobjpriv->RtOutPipe[0];//VO pdvobjpriv->Queue2Pipe[1] = pdvobjpriv->RtOutPipe[1];//VI pdvobjpriv->Queue2Pipe[2] = pdvobjpriv->RtOutPipe[2];//BE pdvobjpriv->Queue2Pipe[3] = pdvobjpriv->RtOutPipe[1];//BK - + pdvobjpriv->Queue2Pipe[4] = pdvobjpriv->RtOutPipe[0];//BCN pdvobjpriv->Queue2Pipe[5] = pdvobjpriv->RtOutPipe[0];//MGT pdvobjpriv->Queue2Pipe[6] = pdvobjpriv->RtOutPipe[0];//HIGH pdvobjpriv->Queue2Pipe[7] = pdvobjpriv->RtOutPipe[0];//TXCMD - + } else{//typical setting - - // BK, BE, VI, VO, BCN, CMD,MGT,HIGH,HCCA - //{ 2, 2, 1, 0, 0, 0, 0, 0, 0 }; - //0:H, 1:N, 2:L - + + // BK, BE, VI, VO, BCN, CMD,MGT,HIGH,HCCA + //{ 2, 2, 1, 0, 0, 0, 0, 0, 0 }; + //0:H, 1:N, 2:L + pdvobjpriv->Queue2Pipe[0] = pdvobjpriv->RtOutPipe[0];//VO pdvobjpriv->Queue2Pipe[1] = pdvobjpriv->RtOutPipe[1];//VI pdvobjpriv->Queue2Pipe[2] = pdvobjpriv->RtOutPipe[2];//BE pdvobjpriv->Queue2Pipe[3] = pdvobjpriv->RtOutPipe[2];//BK - + pdvobjpriv->Queue2Pipe[4] = pdvobjpriv->RtOutPipe[0];//BCN pdvobjpriv->Queue2Pipe[5] = pdvobjpriv->RtOutPipe[0];//MGT pdvobjpriv->Queue2Pipe[6] = pdvobjpriv->RtOutPipe[0];//HIGH - pdvobjpriv->Queue2Pipe[7] = pdvobjpriv->RtOutPipe[0];//TXCMD + pdvobjpriv->Queue2Pipe[7] = pdvobjpriv->RtOutPipe[0];//TXCMD } } @@ -290,7 +290,7 @@ Hal_MappingOutPipe( struct registry_priv *pregistrypriv = &pAdapter->registrypriv; BOOLEAN bWIFICfg = (pregistrypriv->wifi_spec) ?_TRUE:_FALSE; - + BOOLEAN result = _TRUE; switch(NumOutPipe) @@ -310,7 +310,7 @@ Hal_MappingOutPipe( } return result; - + } void hal_init_macaddr(struct adapter *adapter) @@ -322,10 +322,10 @@ void hal_init_macaddr(struct adapter *adapter) #endif } -/* +/* * C2H event format: -* Field TRIGGER CONTENT CMD_SEQ CMD_LEN CMD_ID -* BITS [127:120] [119:16] [15:8] [7:4] [3:0] +* Field TRIGGER CONTENT CMD_SEQ CMD_LEN CMD_ID +* BITS [127:120] [119:16] [15:8] [7:4] [3:0] */ void c2h_evt_clear(struct adapter *adapter) @@ -356,7 +356,7 @@ s32 c2h_evt_read(struct adapter *adapter, u8 *buf) _rtw_memset(c2h_evt, 0, 16); *buf = rtw_read8(adapter, REG_C2HEVT_MSG_NORMAL); - *(buf+1) = rtw_read8(adapter, REG_C2HEVT_MSG_NORMAL + 1); + *(buf+1) = rtw_read8(adapter, REG_C2HEVT_MSG_NORMAL + 1); RT_PRINT_DATA(_module_hal_init_c_, _drv_info_, "c2h_evt_read(): ", &c2h_evt , sizeof(c2h_evt)); @@ -376,7 +376,7 @@ s32 c2h_evt_read(struct adapter *adapter, u8 *buf) ret = _SUCCESS; clear_evt: - /* + /* * Clear event to notify FW we have read the command. * If this field isn't clear, the FW won't update the next command message. */ @@ -439,4 +439,3 @@ GetHalDefVar(struct adapter *adapter, HAL_DEF_VARIABLE variable, void *value) return bResult; } - diff --git a/hal/hal_intf.c b/hal/hal_intf.c index d24ceca..072f477 100755 --- a/hal/hal_intf.c +++ b/hal/hal_intf.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Copyright(c) 2007 - 2012 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. @@ -98,11 +98,11 @@ u32 rtw_hal_power_on(struct adapter *padapter) void rtw_hal_power_off(struct adapter *padapter) { if(padapter->HalFunc.hal_power_off) - padapter->HalFunc.hal_power_off(padapter); + padapter->HalFunc.hal_power_off(padapter); } -uint rtw_hal_init(struct adapter *padapter) +uint rtw_hal_init(struct adapter *padapter) { uint status = _SUCCESS; struct dvobj_priv *dvobj = adapter_to_dvobj(padapter); @@ -125,12 +125,12 @@ uint rtw_hal_init(struct adapter *padapter) } else { - status = padapter->HalFunc.hal_init(padapter->pbuddy_adapter); + status = padapter->HalFunc.hal_init(padapter->pbuddy_adapter); if(status == _SUCCESS){ padapter->pbuddy_adapter->hw_init_completed = _TRUE; } else{ - padapter->pbuddy_adapter->hw_init_completed = _FALSE; + padapter->pbuddy_adapter->hw_init_completed = _FALSE; RT_TRACE(_module_hal_init_c_,_drv_err_,("rtw_hal_init: hal__init fail(pbuddy_adapter)\n")); DBG_871X("rtw_hal_init: hal__init fail(pbuddy_adapter)\n"); return status; @@ -146,7 +146,7 @@ uint rtw_hal_init(struct adapter *padapter) padapter = dvobj->padapters[i]; padapter->hw_init_completed = _TRUE; } - + if (padapter->registrypriv.notch_filter == 1) rtw_hal_notch_filter(padapter, 1); @@ -167,7 +167,7 @@ uint rtw_hal_init(struct adapter *padapter) return status; -} +} uint rtw_hal_deinit(struct adapter *padapter) { @@ -193,9 +193,9 @@ _func_enter_; { DBG_871X("\n rtw_hal_deinit: hal_init fail\n"); } - + _func_exit_; - + return status; } @@ -212,17 +212,17 @@ void rtw_hal_get_hwreg(struct adapter *padapter, u8 variable, u8 *val) } u8 rtw_hal_set_def_var(struct adapter *padapter, HAL_DEF_VARIABLE eVariable, PVOID pValue) -{ +{ if(padapter->HalFunc.SetHalDefVarHandler) return padapter->HalFunc.SetHalDefVarHandler(padapter,eVariable,pValue); return _FAIL; } u8 rtw_hal_get_def_var(struct adapter *padapter, HAL_DEF_VARIABLE eVariable, PVOID pValue) -{ +{ if(padapter->HalFunc.GetHalDefVarHandler) return padapter->HalFunc.GetHalDefVarHandler(padapter,eVariable,pValue); - return _FAIL; -} + return _FAIL; +} void rtw_hal_set_odm_var(struct adapter *padapter, HAL_ODM_VARIABLE eVariable, PVOID pValue1,BOOLEAN bSet) { @@ -241,12 +241,12 @@ void rtw_hal_enable_interrupt(struct adapter *padapter) DBG_871X(" rtw_hal_enable_interrupt: Secondary adapter return l\n"); return; } - + if (padapter->HalFunc.enable_interrupt) padapter->HalFunc.enable_interrupt(padapter); - else + else DBG_871X("%s: HalFunc.enable_interrupt is NULL!\n", __FUNCTION__); - + } void rtw_hal_disable_interrupt(struct adapter *padapter) { @@ -254,38 +254,38 @@ void rtw_hal_disable_interrupt(struct adapter *padapter) DBG_871X(" rtw_hal_disable_interrupt: Secondary adapter return l\n"); return; } - + if (padapter->HalFunc.disable_interrupt) padapter->HalFunc.disable_interrupt(padapter); - else + else DBG_871X("%s: HalFunc.disable_interrupt is NULL!\n", __FUNCTION__); - + } u32 rtw_hal_inirp_init(struct adapter *padapter) { u32 rst = _FAIL; - if(padapter->HalFunc.inirp_init) - rst = padapter->HalFunc.inirp_init(padapter); - else - DBG_871X(" %s HalFunc.inirp_init is NULL!!!\n",__FUNCTION__); + if(padapter->HalFunc.inirp_init) + rst = padapter->HalFunc.inirp_init(padapter); + else + DBG_871X(" %s HalFunc.inirp_init is NULL!!!\n",__FUNCTION__); return rst; } - + u32 rtw_hal_inirp_deinit(struct adapter *padapter) { - + if(padapter->HalFunc.inirp_deinit) return padapter->HalFunc.inirp_deinit(padapter); return _FAIL; - + } u8 rtw_hal_intf_ps_func(struct adapter *padapter,HAL_INTF_PS_FUNC efunc_id, u8* val) -{ - if(padapter->HalFunc.interface_ps_func) +{ + if(padapter->HalFunc.interface_ps_func) return padapter->HalFunc.interface_ps_func(padapter,efunc_id,val); return _FAIL; } @@ -295,7 +295,7 @@ s32 rtw_hal_xmitframe_enqueue(struct adapter *padapter, struct xmit_frame *pxmit if(padapter->HalFunc.hal_xmitframe_enqueue) return padapter->HalFunc.hal_xmitframe_enqueue(padapter, pxmitframe); - return _FALSE; + return _FALSE; } s32 rtw_hal_xmit(struct adapter *padapter, struct xmit_frame *pxmitframe) @@ -303,7 +303,7 @@ s32 rtw_hal_xmit(struct adapter *padapter, struct xmit_frame *pxmitframe) if(padapter->HalFunc.hal_xmit) return padapter->HalFunc.hal_xmit(padapter, pxmitframe); - return _FALSE; + return _FALSE; } s32 rtw_hal_mgnt_xmit(struct adapter *padapter, struct xmit_frame *pmgntframe) @@ -323,7 +323,7 @@ s32 rtw_hal_mgnt_xmit(struct adapter *padapter, struct xmit_frame *pmgntframe) { pmgntframe->attrib.encrypt = _BIP_; //pmgntframe->attrib.bswenc = _TRUE; - } + } else { pmgntframe->attrib.encrypt = _AES_; @@ -332,14 +332,14 @@ s32 rtw_hal_mgnt_xmit(struct adapter *padapter, struct xmit_frame *pmgntframe) rtw_mgmt_xmitframe_coalesce(padapter, pmgntframe->pkt, pmgntframe); } #endif //CONFIG_IEEE80211W - + if(padapter->HalFunc.mgnt_xmit) ret = padapter->HalFunc.mgnt_xmit(padapter, pmgntframe); return ret; } s32 rtw_hal_init_xmit_priv(struct adapter *padapter) -{ +{ if(padapter->HalFunc.init_xmit_priv != NULL) return padapter->HalFunc.init_xmit_priv(padapter); return _FAIL; @@ -351,14 +351,14 @@ void rtw_hal_free_xmit_priv(struct adapter *padapter) } s32 rtw_hal_init_recv_priv(struct adapter *padapter) -{ +{ if(padapter->HalFunc.init_recv_priv) return padapter->HalFunc.init_recv_priv(padapter); return _FAIL; } void rtw_hal_free_recv_priv(struct adapter *padapter) -{ +{ if(padapter->HalFunc.free_recv_priv) padapter->HalFunc.free_recv_priv(padapter); } @@ -380,10 +380,10 @@ void rtw_hal_update_ra_mask(struct sta_info *psta, u8 rssi_level) add_RATid(padapter, psta, rssi_level); } else - { + { if(padapter->HalFunc.UpdateRAMaskHandler) padapter->HalFunc.UpdateRAMaskHandler(padapter, psta->mac_id, rssi_level); - } + } } void rtw_hal_add_ra_tid(struct adapter *padapter, u32 bitmap, u8 arg, u8 rssi_level) @@ -428,7 +428,7 @@ u32 rtw_hal_read_rfreg(struct adapter *padapter, u32 eRFPath, u32 RegAddr, u32 B void rtw_hal_write_rfreg(struct adapter *padapter, u32 eRFPath, u32 RegAddr, u32 BitMask, u32 Data) { if(padapter->HalFunc.write_rfreg) - padapter->HalFunc.write_rfreg(padapter, eRFPath, RegAddr, BitMask, Data); + padapter->HalFunc.write_rfreg(padapter, eRFPath, RegAddr, BitMask, Data); } s32 rtw_hal_interrupt_handler(struct adapter *padapter) @@ -455,7 +455,7 @@ void rtw_hal_dm_watchdog(struct adapter *padapter) #if defined(CONFIG_CONCURRENT_MODE) if (padapter->adapter_type != PRIMARY_ADAPTER) return; -#endif +#endif if(padapter->HalFunc.hal_dm_watchdog) padapter->HalFunc.hal_dm_watchdog(padapter); } @@ -463,16 +463,16 @@ void rtw_hal_dm_watchdog(struct adapter *padapter) void rtw_hal_bcn_related_reg_setting(struct adapter *padapter) { if(padapter->HalFunc.SetBeaconRelatedRegistersHandler) - padapter->HalFunc.SetBeaconRelatedRegistersHandler(padapter); + padapter->HalFunc.SetBeaconRelatedRegistersHandler(padapter); } #ifdef CONFIG_ANTENNA_DIVERSITY u8 rtw_hal_antdiv_before_linked(struct adapter *padapter) -{ +{ if(padapter->HalFunc.AntDivBeforeLinkHandler) return padapter->HalFunc.AntDivBeforeLinkHandler(padapter); - return _FALSE; + return _FALSE; } void rtw_hal_antdiv_rssi_compared(struct adapter *padapter, WLAN_BSSID_EX *dst, WLAN_BSSID_EX *src) { @@ -494,7 +494,7 @@ s32 rtw_hal_hostap_mgnt_xmit_entry(struct adapter *padapter, _pkt *pkt) void rtw_hal_sreset_init(struct adapter *padapter) { if(padapter->HalFunc.sreset_init_value) - padapter->HalFunc.sreset_init_value(padapter); + padapter->HalFunc.sreset_init_value(padapter); } void rtw_hal_sreset_reset(struct adapter *padapter) { @@ -516,7 +516,7 @@ void rtw_hal_sreset_xmit_status_check(struct adapter *padapter) return; if(padapter->HalFunc.sreset_xmit_status_check) - padapter->HalFunc.sreset_xmit_status_check(padapter); + padapter->HalFunc.sreset_xmit_status_check(padapter); } void rtw_hal_sreset_linked_status_check(struct adapter *padapter) { @@ -524,13 +524,13 @@ void rtw_hal_sreset_linked_status_check(struct adapter *padapter) return; if(padapter->HalFunc.sreset_linked_status_check) - padapter->HalFunc.sreset_linked_status_check(padapter); + padapter->HalFunc.sreset_linked_status_check(padapter); } u8 rtw_hal_sreset_get_wifi_status(struct adapter *padapter) { u8 status = 0; - if(padapter->HalFunc.sreset_get_wifi_status) - status = padapter->HalFunc.sreset_get_wifi_status(padapter); + if(padapter->HalFunc.sreset_get_wifi_status) + status = padapter->HalFunc.sreset_get_wifi_status(padapter); return status; } @@ -567,7 +567,7 @@ s32 rtw_hal_xmit_thread_handler(struct adapter *padapter) void rtw_hal_notch_filter(struct adapter *adapter, bool enable) { if(adapter->HalFunc.hal_notch_filter) - adapter->HalFunc.hal_notch_filter(adapter,enable); + adapter->HalFunc.hal_notch_filter(adapter,enable); } void rtw_hal_reset_security_engine(struct adapter * adapter) @@ -588,4 +588,3 @@ c2h_id_filter rtw_hal_c2h_id_filter_ccx(struct adapter *adapter) { return adapter->HalFunc.c2h_id_filter_ccx; } - diff --git a/hal/odm.c b/hal/odm.c index b63ec05..58e1852 100755 --- a/hal/odm.c +++ b/hal/odm.c @@ -1,7 +1,7 @@ /****************************************************************************** * * 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. @@ -41,18 +41,18 @@ const u2Byte dB_Invert_Table[8][12] = { //RT_WLAN_BSS tmpbssDesc[MAX_BSS_DESC]; #if (DM_ODM_SUPPORT_TYPE==ODM_MP) -static u4Byte edca_setting_UL[HT_IOT_PEER_MAX] = +static u4Byte edca_setting_UL[HT_IOT_PEER_MAX] = // UNKNOWN REALTEK_90 REALTEK_92SE BROADCOM RALINK ATHEROS CISCO MARVELL 92U_AP SELF_AP(DownLink/Tx) -{ 0x5e4322, 0xa44f, 0x5e4322, 0x5ea32b, 0x5ea422, 0x5ea322, 0x3ea430, 0x5ea44f, 0x5e4322, 0x5e4322}; +{ 0x5e4322, 0xa44f, 0x5e4322, 0x5ea32b, 0x5ea422, 0x5ea322, 0x3ea430, 0x5ea44f, 0x5e4322, 0x5e4322}; -static u4Byte edca_setting_DL[HT_IOT_PEER_MAX] = +static u4Byte edca_setting_DL[HT_IOT_PEER_MAX] = // UNKNOWN REALTEK_90 REALTEK_92SE BROADCOM RALINK ATHEROS CISCO MARVELL 92U_AP SELF_AP(UpLink/Rx) -{ 0xa44f, 0x5ea44f, 0x5e4322, 0x5ea42b, 0xa44f, 0xa630, 0x5ea630, 0xa44f, 0xa42b, 0xa42b}; +{ 0xa44f, 0x5ea44f, 0x5e4322, 0x5ea42b, 0xa44f, 0xa630, 0x5ea630, 0xa44f, 0xa42b, 0xa42b}; -static u4Byte edca_setting_DL_GMode[HT_IOT_PEER_MAX] = +static u4Byte edca_setting_DL_GMode[HT_IOT_PEER_MAX] = // UNKNOWN REALTEK_90 REALTEK_92SE BROADCOM RALINK ATHEROS CISCO MARVELL 92U_AP SELF_AP -{ 0x4322, 0xa44f, 0x5e4322, 0xa42b, 0x5e4322, 0x4322, 0xa42b, 0xa44f, 0x5e4322, 0x5ea42b}; +{ 0x4322, 0xa44f, 0x5e4322, 0xa42b, 0x5e4322, 0x4322, 0xa42b, 0xa44f, 0x5e4322, 0x5ea42b}; //============================================================ @@ -64,7 +64,7 @@ u4Byte EDCAParam[HT_IOT_PEER_MAX][3] = { // UL DL {0x5ea42b, 0x5ea42b, 0x5ea42b}, //0:unknown AP {0xa44f, 0x5ea44f, 0x5e431c}, // 1:realtek AP - {0x5ea42b, 0x5ea42b, 0x5ea42b}, // 2:unknown AP => realtek_92SE + {0x5ea42b, 0x5ea42b, 0x5ea42b}, // 2:unknown AP => realtek_92SE {0x5ea32b, 0x5ea42b, 0x5e4322}, // 3:broadcom AP {0x5ea422, 0x00a44f, 0x00a44f}, // 4:ralink AP {0x5ea322, 0x00a630, 0x00a44f}, // 5:atheros AP @@ -148,11 +148,11 @@ u4Byte OFDMSwingTable[OFDM_TABLE_SIZE_92D] = { 0x11000044, // 35, -11.5dB 0x10000040, // 36, -12.0dB 0x0f00003c,// 37, -12.5dB - 0x0e400039,// 38, -13.0dB + 0x0e400039,// 38, -13.0dB 0x0d800036,// 39, -13.5dB 0x0cc00033,// 40, -14.0dB 0x0c000030,// 41, -14.5dB - 0x0b40002d,// 42, -15.0dB + 0x0b40002d,// 42, -15.0dB }; @@ -161,21 +161,21 @@ u1Byte CCKSwingTable_Ch1_Ch13[CCK_TABLE_SIZE][8] = { {0x33, 0x32, 0x2b, 0x23, 0x1a, 0x11, 0x08, 0x04}, // 1, -0.5dB {0x30, 0x2f, 0x29, 0x21, 0x19, 0x10, 0x08, 0x03}, // 2, -1.0dB {0x2d, 0x2d, 0x27, 0x1f, 0x18, 0x0f, 0x08, 0x03}, // 3, -1.5dB - {0x2b, 0x2a, 0x25, 0x1e, 0x16, 0x0e, 0x07, 0x03}, // 4, -2.0dB + {0x2b, 0x2a, 0x25, 0x1e, 0x16, 0x0e, 0x07, 0x03}, // 4, -2.0dB {0x28, 0x28, 0x22, 0x1c, 0x15, 0x0d, 0x07, 0x03}, // 5, -2.5dB {0x26, 0x25, 0x21, 0x1b, 0x14, 0x0d, 0x06, 0x03}, // 6, -3.0dB {0x24, 0x23, 0x1f, 0x19, 0x13, 0x0c, 0x06, 0x03}, // 7, -3.5dB - {0x22, 0x21, 0x1d, 0x18, 0x11, 0x0b, 0x06, 0x02}, // 8, -4.0dB + {0x22, 0x21, 0x1d, 0x18, 0x11, 0x0b, 0x06, 0x02}, // 8, -4.0dB {0x20, 0x20, 0x1b, 0x16, 0x11, 0x08, 0x05, 0x02}, // 9, -4.5dB - {0x1f, 0x1e, 0x1a, 0x15, 0x10, 0x0a, 0x05, 0x02}, // 10, -5.0dB + {0x1f, 0x1e, 0x1a, 0x15, 0x10, 0x0a, 0x05, 0x02}, // 10, -5.0dB {0x1d, 0x1c, 0x18, 0x14, 0x0f, 0x0a, 0x05, 0x02}, // 11, -5.5dB - {0x1b, 0x1a, 0x17, 0x13, 0x0e, 0x09, 0x04, 0x02}, // 12, -6.0dB + {0x1b, 0x1a, 0x17, 0x13, 0x0e, 0x09, 0x04, 0x02}, // 12, -6.0dB {0x1a, 0x19, 0x16, 0x12, 0x0d, 0x09, 0x04, 0x02}, // 13, -6.5dB - {0x18, 0x17, 0x15, 0x11, 0x0c, 0x08, 0x04, 0x02}, // 14, -7.0dB + {0x18, 0x17, 0x15, 0x11, 0x0c, 0x08, 0x04, 0x02}, // 14, -7.0dB {0x17, 0x16, 0x13, 0x10, 0x0c, 0x08, 0x04, 0x02}, // 15, -7.5dB - {0x16, 0x15, 0x12, 0x0f, 0x0b, 0x07, 0x04, 0x01}, // 16, -8.0dB + {0x16, 0x15, 0x12, 0x0f, 0x0b, 0x07, 0x04, 0x01}, // 16, -8.0dB {0x14, 0x14, 0x11, 0x0e, 0x0b, 0x07, 0x03, 0x02}, // 17, -8.5dB - {0x13, 0x13, 0x10, 0x0d, 0x0a, 0x06, 0x03, 0x01}, // 18, -9.0dB + {0x13, 0x13, 0x10, 0x0d, 0x0a, 0x06, 0x03, 0x01}, // 18, -9.0dB {0x12, 0x12, 0x0f, 0x0c, 0x09, 0x06, 0x03, 0x01}, // 19, -9.5dB {0x11, 0x11, 0x0f, 0x0c, 0x09, 0x06, 0x03, 0x01}, // 20, -10.0dB {0x10, 0x10, 0x0e, 0x0b, 0x08, 0x05, 0x03, 0x01}, // 21, -10.5dB @@ -194,25 +194,25 @@ u1Byte CCKSwingTable_Ch1_Ch13[CCK_TABLE_SIZE][8] = { u1Byte CCKSwingTable_Ch14 [CCK_TABLE_SIZE][8]= { - {0x36, 0x35, 0x2e, 0x1b, 0x00, 0x00, 0x00, 0x00}, // 0, +0dB - {0x33, 0x32, 0x2b, 0x19, 0x00, 0x00, 0x00, 0x00}, // 1, -0.5dB - {0x30, 0x2f, 0x29, 0x18, 0x00, 0x00, 0x00, 0x00}, // 2, -1.0dB + {0x36, 0x35, 0x2e, 0x1b, 0x00, 0x00, 0x00, 0x00}, // 0, +0dB + {0x33, 0x32, 0x2b, 0x19, 0x00, 0x00, 0x00, 0x00}, // 1, -0.5dB + {0x30, 0x2f, 0x29, 0x18, 0x00, 0x00, 0x00, 0x00}, // 2, -1.0dB {0x2d, 0x2d, 0x17, 0x17, 0x00, 0x00, 0x00, 0x00}, // 3, -1.5dB - {0x2b, 0x2a, 0x25, 0x15, 0x00, 0x00, 0x00, 0x00}, // 4, -2.0dB + {0x2b, 0x2a, 0x25, 0x15, 0x00, 0x00, 0x00, 0x00}, // 4, -2.0dB {0x28, 0x28, 0x24, 0x14, 0x00, 0x00, 0x00, 0x00}, // 5, -2.5dB - {0x26, 0x25, 0x21, 0x13, 0x00, 0x00, 0x00, 0x00}, // 6, -3.0dB - {0x24, 0x23, 0x1f, 0x12, 0x00, 0x00, 0x00, 0x00}, // 7, -3.5dB - {0x22, 0x21, 0x1d, 0x11, 0x00, 0x00, 0x00, 0x00}, // 8, -4.0dB + {0x26, 0x25, 0x21, 0x13, 0x00, 0x00, 0x00, 0x00}, // 6, -3.0dB + {0x24, 0x23, 0x1f, 0x12, 0x00, 0x00, 0x00, 0x00}, // 7, -3.5dB + {0x22, 0x21, 0x1d, 0x11, 0x00, 0x00, 0x00, 0x00}, // 8, -4.0dB {0x20, 0x20, 0x1b, 0x10, 0x00, 0x00, 0x00, 0x00}, // 9, -4.5dB - {0x1f, 0x1e, 0x1a, 0x0f, 0x00, 0x00, 0x00, 0x00}, // 10, -5.0dB + {0x1f, 0x1e, 0x1a, 0x0f, 0x00, 0x00, 0x00, 0x00}, // 10, -5.0dB {0x1d, 0x1c, 0x18, 0x0e, 0x00, 0x00, 0x00, 0x00}, // 11, -5.5dB - {0x1b, 0x1a, 0x17, 0x0e, 0x00, 0x00, 0x00, 0x00}, // 12, -6.0dB - {0x1a, 0x19, 0x16, 0x0d, 0x00, 0x00, 0x00, 0x00}, // 13, -6.5dB - {0x18, 0x17, 0x15, 0x0c, 0x00, 0x00, 0x00, 0x00}, // 14, -7.0dB + {0x1b, 0x1a, 0x17, 0x0e, 0x00, 0x00, 0x00, 0x00}, // 12, -6.0dB + {0x1a, 0x19, 0x16, 0x0d, 0x00, 0x00, 0x00, 0x00}, // 13, -6.5dB + {0x18, 0x17, 0x15, 0x0c, 0x00, 0x00, 0x00, 0x00}, // 14, -7.0dB {0x17, 0x16, 0x13, 0x0b, 0x00, 0x00, 0x00, 0x00}, // 15, -7.5dB - {0x16, 0x15, 0x12, 0x0b, 0x00, 0x00, 0x00, 0x00}, // 16, -8.0dB + {0x16, 0x15, 0x12, 0x0b, 0x00, 0x00, 0x00, 0x00}, // 16, -8.0dB {0x14, 0x14, 0x11, 0x0a, 0x00, 0x00, 0x00, 0x00}, // 17, -8.5dB - {0x13, 0x13, 0x10, 0x0a, 0x00, 0x00, 0x00, 0x00}, // 18, -9.0dB + {0x13, 0x13, 0x10, 0x0a, 0x00, 0x00, 0x00, 0x00}, // 18, -9.0dB {0x12, 0x12, 0x0f, 0x09, 0x00, 0x00, 0x00, 0x00}, // 19, -9.5dB {0x11, 0x11, 0x0f, 0x09, 0x00, 0x00, 0x00, 0x00}, // 20, -10.0dB {0x10, 0x10, 0x0e, 0x08, 0x00, 0x00, 0x00, 0x00}, // 21, -10.5dB @@ -227,7 +227,7 @@ u1Byte CCKSwingTable_Ch14 [CCK_TABLE_SIZE][8]= { {0x0a, 0x09, 0x08, 0x05, 0x00, 0x00, 0x00, 0x00}, // 30, -15.0dB {0x09, 0x09, 0x08, 0x05, 0x00, 0x00, 0x00, 0x00}, // 31, -15.5dB {0x09, 0x08, 0x07, 0x04, 0x00, 0x00, 0x00, 0x00} // 32, -16.0dB -}; +}; #ifdef AP_BUILD_WORKAROUND @@ -316,7 +316,7 @@ odm_IsLinked( //END------------COMMON INFO RELATED---------------// //START---------------DIG---------------------------// -VOID +VOID odm_FalseAlarmCounterStatistics( IN PDM_ODM_T pDM_Odm ); @@ -326,24 +326,24 @@ odm_DIGInit( IN PDM_ODM_T pDM_Odm ); -VOID +VOID odm_DIG( IN PDM_ODM_T pDM_Odm ); -VOID +VOID odm_CCKPacketDetectionThresh( IN PDM_ODM_T pDM_Odm ); //END---------------DIG---------------------------// //START-------BB POWER SAVE-----------------------// -VOID +VOID odm_DynamicBBPowerSavingInit( IN PDM_ODM_T pDM_Odm ); -VOID +VOID odm_DynamicBBPowerSaving( IN PDM_ODM_T pDM_Odm ); @@ -365,7 +365,7 @@ odm_Adaptivity( //END---------BB POWER SAVE-----------------------// //START-----------------PSD-----------------------// -#if(DM_ODM_SUPPORT_TYPE & (ODM_MP)) +#if(DM_ODM_SUPPORT_TYPE & (ODM_MP)) //============================================================ // Function predefine. //============================================================ @@ -395,7 +395,7 @@ odm_PathDivChkAntSwitchWorkitemCallback( IN PVOID pContext ); -VOID odm_SetRespPath_92C( IN struct adapter *Adapter, IN u1Byte DefaultRespPath); +VOID odm_SetRespPath_92C( IN struct adapter *Adapter, IN u1Byte DefaultRespPath); VOID odm_OFDMTXPathDiversity_92C( IN struct adapter *Adapter); VOID odm_CCKTXPathDiversity_92C( IN struct adapter *Adapter); VOID odm_ResetPathDiversity_92C( IN struct adapter *Adapter); @@ -411,12 +411,12 @@ VOID odm_PSD_RXHPWorkitemCallback( IN PVOID pContext); //End--------------------- RX High Power -----------------------// VOID -odm_PathDivInit( IN PDM_ODM_T pDM_Odm); +odm_PathDivInit( IN PDM_ODM_T pDM_Odm); VOID odm_SetRespPath_92C( IN struct adapter *Adapter, - IN u1Byte DefaultRespPath + IN u1Byte DefaultRespPath ); #endif @@ -437,7 +437,7 @@ odm_RefreshRateAdaptiveMaskAPADSL( IN PDM_ODM_T pDM_Odm ); -VOID +VOID odm_DynamicTxPowerInit( IN PDM_ODM_T pDM_Odm ); @@ -447,7 +447,7 @@ odm_DynamicTxPowerRestorePowerIndex( IN PDM_ODM_T pDM_Odm ); -VOID +VOID odm_DynamicTxPowerNIC( IN PDM_ODM_T pDM_Odm ); @@ -460,15 +460,15 @@ odm_DynamicTxPowerSavePowerIndex( VOID odm_DynamicTxPowerWritePowerIndex( - IN PDM_ODM_T pDM_Odm, - IN u1Byte Value); + IN PDM_ODM_T pDM_Odm, + IN u1Byte Value); -VOID +VOID odm_DynamicTxPower_92C( IN PDM_ODM_T pDM_Odm ); -VOID +VOID odm_DynamicTxPower_92D( IN PDM_ODM_T pDM_Odm ); @@ -485,11 +485,11 @@ odm_RSSIMonitorCheckMP( IN PDM_ODM_T pDM_Odm ); -VOID +VOID odm_RSSIMonitorCheckCE( IN PDM_ODM_T pDM_Odm ); -VOID +VOID odm_RSSIMonitorCheckAP( IN PDM_ODM_T pDM_Odm ); @@ -500,12 +500,12 @@ VOID odm_RSSIMonitorCheck( IN PDM_ODM_T pDM_Odm ); -VOID +VOID odm_DynamicTxPower( IN PDM_ODM_T pDM_Odm ); -VOID +VOID odm_DynamicTxPowerAP( IN PDM_ODM_T pDM_Odm ); @@ -604,7 +604,7 @@ odm_TXPowerTrackingCheckCE( IN PDM_ODM_T pDM_Odm ); -#if(DM_ODM_SUPPORT_TYPE & (ODM_MP)) +#if(DM_ODM_SUPPORT_TYPE & (ODM_MP)) VOID ODM_RateAdaptiveStateApInit( @@ -612,7 +612,7 @@ ODM_RateAdaptiveStateApInit( IN PRT_WLAN_STA pEntry ); -VOID +VOID odm_TXPowerTrackingCallbackThermalMeter92C( IN struct adapter *Adapter ); @@ -657,23 +657,23 @@ odm_EdcaTurboCheckMP( //check if edca turbo is disabled BOOLEAN odm_IsEdcaTurboDisable( - IN PDM_ODM_T pDM_Odm + IN PDM_ODM_T pDM_Odm ); //choose edca paramter for special IOT case -VOID +VOID ODM_EdcaParaSelByIot( - IN PDM_ODM_T pDM_Odm, + IN PDM_ODM_T pDM_Odm, OUT u4Byte *EDCA_BE_UL, OUT u4Byte *EDCA_BE_DL ); //check if it is UL or DL VOID -odm_EdcaChooseTrafficIdx( +odm_EdcaChooseTrafficIdx( IN PDM_ODM_T pDM_Odm, - IN u8Byte cur_tx_bytes, - IN u8Byte cur_rx_bytes, - IN BOOLEAN bBiasOnRx, - OUT BOOLEAN *pbIsCurRDLState + IN u8Byte cur_tx_bytes, + IN u8Byte cur_rx_bytes, + IN BOOLEAN bBiasOnRx, + OUT BOOLEAN *pbIsCurRDLState ); #elif (DM_ODM_SUPPORT_TYPE==ODM_CE) @@ -682,7 +682,7 @@ odm_EdcaTurboCheckCE( IN PDM_ODM_T pDM_Odm ); #else -VOID +VOID odm_IotEngine( IN PDM_ODM_T pDM_Odm ); @@ -695,12 +695,12 @@ odm_EdcaParaInit( -#define RxDefaultAnt1 0x65a9 +#define RxDefaultAnt1 0x65a9 #define RxDefaultAnt2 0x569a VOID odm_InitHybridAntDiv( - IN PDM_ODM_T pDM_Odm + IN PDM_ODM_T pDM_Odm ); BOOLEAN @@ -710,14 +710,14 @@ odm_StaDefAntSel( IN u4Byte OFDM_Ant2_Cnt, IN u4Byte CCK_Ant1_Cnt, IN u4Byte CCK_Ant2_Cnt, - OUT u1Byte *pDefAnt + OUT u1Byte *pDefAnt ); VOID odm_SetRxIdleAnt( IN PDM_ODM_T pDM_Odm, IN u1Byte Ant, - IN BOOLEAN bDualPath + IN BOOLEAN bDualPath ); @@ -785,7 +785,7 @@ ODM_DMInit( odm_CommonInfoSelfInit(pDM_Odm); odm_CmnInfoInit_Debug(pDM_Odm); odm_DIGInit(pDM_Odm); - odm_AdaptivityInit(pDM_Odm); + odm_AdaptivityInit(pDM_Odm); odm_RateAdaptiveMaskInit(pDM_Odm); if(pDM_Odm->SupportICType & ODM_IC_11AC_SERIES) @@ -802,15 +802,15 @@ ODM_DMInit( odm_TXPowerTrackingInit(pDM_Odm); #if (DM_ODM_SUPPORT_TYPE == ODM_MP) odm_PSDMonitorInit(pDM_Odm); - odm_RXHPInit(pDM_Odm); - odm_PathDivInit(pDM_Odm); //92D Path Div Init //Neil Chen - #endif + odm_RXHPInit(pDM_Odm); + odm_PathDivInit(pDM_Odm); //92D Path Div Init //Neil Chen + #endif ODM_EdcaTurboInit(pDM_Odm); #if (RTL8188E_SUPPORT == 1) ODM_RAInfo_Init_all(pDM_Odm); #endif if( ( pDM_Odm->AntDivType == CG_TRX_HW_ANTDIV ) || - ( pDM_Odm->AntDivType == CGCS_RX_HW_ANTDIV ) || + ( pDM_Odm->AntDivType == CGCS_RX_HW_ANTDIV ) || ( pDM_Odm->AntDivType == CG_TRX_SMART_ANTDIV )) { odm_InitHybridAntDiv(pDM_Odm); @@ -836,8 +836,8 @@ ODM_DMWatchdog( odm_GlobalAdapterCheck(); odm_CmnInfoHook_Debug(pDM_Odm); odm_CmnInfoUpdate_Debug(pDM_Odm); - odm_CommonInfoSelfUpdate(pDM_Odm); - odm_FalseAlarmCounterStatistics(pDM_Odm); + odm_CommonInfoSelfUpdate(pDM_Odm); + odm_FalseAlarmCounterStatistics(pDM_Odm); odm_RSSIMonitorCheck(pDM_Odm); #if (DM_ODM_SUPPORT_TYPE == ODM_CE) @@ -846,19 +846,19 @@ ODM_DMWatchdog( //8723A or 8189ES platform //NeilChen--2012--08--24-- //Fix Leave LPS issue - if( (adapter_to_pwrctl(pDM_Odm->Adapter)->pwr_mode != PS_MODE_ACTIVE) &&// in LPS mode - ( + if( (adapter_to_pwrctl(pDM_Odm->Adapter)->pwr_mode != PS_MODE_ACTIVE) &&// in LPS mode + ( (pDM_Odm->SupportICType & (ODM_RTL8723A ) )|| - (pDM_Odm->SupportICType & (ODM_RTL8188E) )//&&((pDM_Odm->SupportInterface == ODM_ITRF_SDIO)) ) + (pDM_Odm->SupportICType & (ODM_RTL8188E) )//&&((pDM_Odm->SupportInterface == ODM_ITRF_SDIO)) ) - ) + ) ) { - ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("----Step1: odm_DIG is in LPS mode\n")); + ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("----Step1: odm_DIG is in LPS mode\n")); ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("---Step2: 8723AS is in LPS mode\n")); odm_DIGbyRSSI_LPS(pDM_Odm); - } - else + } + else //#endif #endif { @@ -872,19 +872,19 @@ ODM_DMWatchdog( return; odm_Adaptivity(pDM_Odm, pDM_Odm->DM_DigTable.CurIGValue); - - + + odm_RefreshRateAdaptiveMask(pDM_Odm); - + #if (RTL8192D_SUPPORT == 1) ODM_DynamicEarlyMode(pDM_Odm); #endif - odm_DynamicBBPowerSaving(pDM_Odm); + odm_DynamicBBPowerSaving(pDM_Odm); #if (RTL8188E_SUPPORT == 1) - odm_DynamicPrimaryCCA(pDM_Odm); + odm_DynamicPrimaryCCA(pDM_Odm); #endif if( ( pDM_Odm->AntDivType == CG_TRX_HW_ANTDIV ) || - ( pDM_Odm->AntDivType == CGCS_RX_HW_ANTDIV ) || + ( pDM_Odm->AntDivType == CGCS_RX_HW_ANTDIV ) || ( pDM_Odm->AntDivType == CG_TRX_SMART_ANTDIV )) { odm_HwAntDiv(pDM_Odm); @@ -921,7 +921,7 @@ VOID ODM_CmnInfoInit( IN PDM_ODM_T pDM_Odm, IN ODM_CMNINFO_E CmnInfo, - IN u4Byte Value + IN u4Byte Value ) { //ODM_RT_TRACE(pDM_Odm,); @@ -936,7 +936,7 @@ ODM_CmnInfoInit( // case ODM_CMNINFO_ABILITY: pDM_Odm->SupportAbility = (u4Byte)Value; - break; + break; case ODM_CMNINFO_PLATFORM: pDM_Odm->SupportPlatform = (u1Byte)Value; break; @@ -948,7 +948,7 @@ ODM_CmnInfoInit( case ODM_CMNINFO_MP_TEST_CHIP: pDM_Odm->bIsMPChip= (u1Byte)Value; break; - + case ODM_CMNINFO_IC_TYPE: pDM_Odm->SupportICType = Value; break; @@ -984,28 +984,28 @@ ODM_CmnInfoInit( case ODM_CMNINFO_EXT_TRSW: pDM_Odm->ExtTRSW = (u1Byte)Value; break; - case ODM_CMNINFO_PATCH_ID: + case ODM_CMNINFO_PATCH_ID: pDM_Odm->PatchID = (u1Byte)Value; break; - case ODM_CMNINFO_BINHCT_TEST: + case ODM_CMNINFO_BINHCT_TEST: pDM_Odm->bInHctTest = (BOOLEAN)Value; break; - case ODM_CMNINFO_BWIFI_TEST: + case ODM_CMNINFO_BWIFI_TEST: pDM_Odm->bWIFITest = (BOOLEAN)Value; - break; + break; case ODM_CMNINFO_SMART_CONCURRENT: pDM_Odm->bDualMacSmartConcurrent = (BOOLEAN )Value; break; - - //To remove the compiler warning, must add an empty default statement to handle the other values. + + //To remove the compiler warning, must add an empty default statement to handle the other values. default: //do nothing - break; - + break; + } - + } @@ -1013,7 +1013,7 @@ VOID ODM_CmnInfoHook( IN PDM_ODM_T pDM_Odm, IN ODM_CMNINFO_E CmnInfo, - IN PVOID pValue + IN PVOID pValue ) { // @@ -1027,7 +1027,7 @@ ODM_CmnInfoHook( case ODM_CMNINFO_MAC_PHY_MODE: pDM_Odm->pMacPhyMode = (u1Byte *)pValue; break; - + case ODM_CMNINFO_TX_UNI: pDM_Odm->pNumTxBytesUnicast = (u8Byte *)pValue; break; @@ -1059,7 +1059,7 @@ ODM_CmnInfoHook( case ODM_CMNINFO_CHNL: pDM_Odm->pChannel = (u1Byte *)pValue; break; - + case ODM_CMNINFO_DMSP_GET_VALUE: pDM_Odm->pbGetValueFromOtherMac = (BOOLEAN *)pValue; break; @@ -1108,7 +1108,7 @@ ODM_CmnInfoHook( break; //case ODM_CMNINFO_BT_COEXIST: - // pDM_Odm->BTCoexist = (BOOLEAN *)pValue; + // pDM_Odm->BTCoexist = (BOOLEAN *)pValue; //case ODM_CMNINFO_STA_STATUS: //pDM_Odm->pODM_StaInfo[] = (PSTA_INFO_T)pValue; @@ -1121,7 +1121,7 @@ ODM_CmnInfoHook( //case ODM_CMNINFO_MAC_STATUS: // pDM_Odm->pMacInfo = (ODM_MAC_INFO *)pValue; // break; - //To remove the compiler warning, must add an empty default statement to handle the other values. + //To remove the compiler warning, must add an empty default statement to handle the other values. default: //do nothing break; @@ -1136,7 +1136,7 @@ ODM_CmnInfoPtrArrayHook( IN PDM_ODM_T pDM_Odm, IN ODM_CMNINFO_E CmnInfo, IN u2Byte Index, - IN PVOID pValue + IN PVOID pValue ) { // @@ -1146,16 +1146,16 @@ ODM_CmnInfoPtrArrayHook( { // // Dynamic call by reference pointer. - // + // case ODM_CMNINFO_STA_STATUS: pDM_Odm->pODM_StaInfo[Index] = (PSTA_INFO_T)pValue; - break; - //To remove the compiler warning, must add an empty default statement to handle the other values. + break; + //To remove the compiler warning, must add an empty default statement to handle the other values. default: //do nothing break; } - + } @@ -1166,7 +1166,7 @@ VOID ODM_CmnInfoUpdate( IN PDM_ODM_T pDM_Odm, IN u4Byte CmnInfo, - IN u8Byte Value + IN u8Byte Value ) { // @@ -1219,7 +1219,7 @@ ODM_CmnInfoUpdate( case ODM_CMNINFO_BT_DISABLED: pDM_Odm->bBtDisabled = (BOOLEAN)Value; break; - + case ODM_CMNINFO_BT_OPERATION: pDM_Odm->bBtHsOperation = (BOOLEAN)Value; break; @@ -1227,10 +1227,10 @@ ODM_CmnInfoUpdate( case ODM_CMNINFO_BT_DIG: pDM_Odm->btHsDigVal = (u1Byte)Value; break; - + case ODM_CMNINFO_BT_BUSY: pDM_Odm->bBtBusy = (BOOLEAN)Value; - break; + break; case ODM_CMNINFO_BT_DISABLE_EDCA: pDM_Odm->bBtDisableEdcaTurbo = (BOOLEAN)Value; @@ -1239,7 +1239,7 @@ ODM_CmnInfoUpdate( } - + } VOID @@ -1249,12 +1249,12 @@ odm_CommonInfoSelfInit( { pDM_Odm->bCckHighPower = (BOOLEAN) ODM_GetBBReg(pDM_Odm, 0x824, BIT9); pDM_Odm->RFPathRxEnable = (u1Byte) ODM_GetBBReg(pDM_Odm, 0xc04, 0x0F); -#if (DM_ODM_SUPPORT_TYPE != ODM_CE) +#if (DM_ODM_SUPPORT_TYPE != ODM_CE) pDM_Odm->pbNet_closed = &pDM_Odm->BOOLEAN_temp; #endif if(pDM_Odm->SupportICType & (ODM_RTL8192C|ODM_RTL8192D)) { -#if(defined(CONFIG_HW_ANTENNA_DIVERSITY)) +#if(defined(CONFIG_HW_ANTENNA_DIVERSITY)) pDM_Odm->AntDivType = CG_TRX_HW_ANTDIV; #elif (defined(CONFIG_SW_ANTENNA_DIVERSITY)) pDM_Odm->AntDivType = CGCS_RX_SW_ANTDIV; @@ -1262,8 +1262,8 @@ odm_CommonInfoSelfInit( } if(pDM_Odm->SupportICType & (ODM_RTL8723A)) pDM_Odm->AntDivType = CGCS_RX_SW_ANTDIV; - - ODM_InitDebugSetting(pDM_Odm); + + ODM_InitDebugSetting(pDM_Odm); } VOID @@ -1273,7 +1273,7 @@ odm_CommonInfoSelfUpdate( { u1Byte EntryCnt=0; u1Byte i; - PSTA_INFO_T pEntry; + PSTA_INFO_T pEntry; #if (DM_ODM_SUPPORT_TYPE == ODM_MP) @@ -1347,16 +1347,16 @@ odm_CmnInfoHook_Debug( IN PDM_ODM_T pDM_Odm ) { - ODM_RT_TRACE(pDM_Odm,ODM_COMP_COMMON, ODM_DBG_LOUD, ("odm_CmnInfoHook_Debug==>\n")); + ODM_RT_TRACE(pDM_Odm,ODM_COMP_COMMON, ODM_DBG_LOUD, ("odm_CmnInfoHook_Debug==>\n")); ODM_RT_TRACE(pDM_Odm,ODM_COMP_COMMON, ODM_DBG_LOUD, ("pNumTxBytesUnicast=%llu\n",*(pDM_Odm->pNumTxBytesUnicast)) ); ODM_RT_TRACE(pDM_Odm,ODM_COMP_COMMON, ODM_DBG_LOUD, ("pNumRxBytesUnicast=%llu\n",*(pDM_Odm->pNumRxBytesUnicast)) ); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_COMMON, ODM_DBG_LOUD, ("pWirelessMode=0x%x\n",*(pDM_Odm->pWirelessMode)) ); + ODM_RT_TRACE(pDM_Odm,ODM_COMP_COMMON, ODM_DBG_LOUD, ("pWirelessMode=0x%x\n",*(pDM_Odm->pWirelessMode)) ); ODM_RT_TRACE(pDM_Odm,ODM_COMP_COMMON, ODM_DBG_LOUD, ("pSecChOffset=%d\n",*(pDM_Odm->pSecChOffset)) ); ODM_RT_TRACE(pDM_Odm,ODM_COMP_COMMON, ODM_DBG_LOUD, ("pSecurity=%d\n",*(pDM_Odm->pSecurity)) ); ODM_RT_TRACE(pDM_Odm,ODM_COMP_COMMON, ODM_DBG_LOUD, ("pBandWidth=%d\n",*(pDM_Odm->pBandWidth)) ); ODM_RT_TRACE(pDM_Odm,ODM_COMP_COMMON, ODM_DBG_LOUD, ("pChannel=%d\n",*(pDM_Odm->pChannel)) ); -#if (RTL8192D_SUPPORT==1) +#if (RTL8192D_SUPPORT==1) if(pDM_Odm->pBandType) ODM_RT_TRACE(pDM_Odm,ODM_COMP_COMMON, ODM_DBG_LOUD, ("pBandType=%d\n",*(pDM_Odm->pBandType)) ); if(pDM_Odm->pMacPhyMode) @@ -1394,8 +1394,8 @@ ODM_InitAllWorkItems(IN PDM_ODM_T pDM_Odm ) #if USE_WORKITEM struct adapter * pAdapter = pDM_Odm->Adapter; - ODM_InitializeWorkItem( pDM_Odm, - &pDM_Odm->DM_SWAT_Table.SwAntennaSwitchWorkitem, + ODM_InitializeWorkItem( pDM_Odm, + &pDM_Odm->DM_SWAT_Table.SwAntennaSwitchWorkitem, (RT_WORKITEM_CALL_BACK)odm_SwAntDivChkAntSwitchWorkitemCallback, (PVOID)pAdapter, "AntennaSwitchWorkitem" @@ -1403,33 +1403,33 @@ ODM_InitAllWorkItems(IN PDM_ODM_T pDM_Odm ) ODM_InitializeWorkItem( pDM_Odm, - &(pDM_Odm->PathDivSwitchWorkitem), - (RT_WORKITEM_CALL_BACK)odm_PathDivChkAntSwitchWorkitemCallback, + &(pDM_Odm->PathDivSwitchWorkitem), + (RT_WORKITEM_CALL_BACK)odm_PathDivChkAntSwitchWorkitemCallback, (PVOID)pAdapter, "SWAS_WorkItem"); ODM_InitializeWorkItem( pDM_Odm, - &(pDM_Odm->CCKPathDiversityWorkitem), - (RT_WORKITEM_CALL_BACK)odm_CCKTXPathDiversityWorkItemCallback, + &(pDM_Odm->CCKPathDiversityWorkitem), + (RT_WORKITEM_CALL_BACK)odm_CCKTXPathDiversityWorkItemCallback, (PVOID)pAdapter, "CCKTXPathDiversityWorkItem"); #if(defined(CONFIG_HW_ANTENNA_DIVERSITY)) #if (RTL8188E_SUPPORT == 1) ODM_InitializeWorkItem( pDM_Odm, - &(pDM_Odm->FastAntTrainingWorkitem), - (RT_WORKITEM_CALL_BACK)odm_FastAntTrainingWorkItemCallback, + &(pDM_Odm->FastAntTrainingWorkitem), + (RT_WORKITEM_CALL_BACK)odm_FastAntTrainingWorkItemCallback, (PVOID)pAdapter, "FastAntTrainingWorkitem"); #endif #endif ODM_InitializeWorkItem( pDM_Odm, - &(pDM_Odm->DM_RXHP_Table.PSDTimeWorkitem), - (RT_WORKITEM_CALL_BACK)odm_PSD_RXHPWorkitemCallback, + &(pDM_Odm->DM_RXHP_Table.PSDTimeWorkitem), + (RT_WORKITEM_CALL_BACK)odm_PSD_RXHPWorkitemCallback, (PVOID)pAdapter, - "PSDRXHP_WorkItem"); + "PSDRXHP_WorkItem"); #endif } @@ -1439,10 +1439,10 @@ ODM_FreeAllWorkItems(IN PDM_ODM_T pDM_Odm ) #if USE_WORKITEM ODM_FreeWorkItem( &(pDM_Odm->DM_SWAT_Table.SwAntennaSwitchWorkitem)); - ODM_FreeWorkItem(&(pDM_Odm->PathDivSwitchWorkitem)); + ODM_FreeWorkItem(&(pDM_Odm->PathDivSwitchWorkitem)); ODM_FreeWorkItem(&(pDM_Odm->CCKPathDiversityWorkitem)); - + ODM_FreeWorkItem(&(pDM_Odm->FastAntTrainingWorkitem)); ODM_FreeWorkItem((&pDM_Odm->DM_RXHP_Table.PSDTimeWorkitem)); @@ -1483,15 +1483,15 @@ odm_IsLinked( { u4Byte i; BOOLEAN Linked = FALSE; - + for(i=0; ipODM_StaInfo[i]) ) - { + { Linked = TRUE; break; } - + } pDM_Odm->bLinked = Linked; @@ -1528,7 +1528,7 @@ ODM_ChangeDynamicInitGainThresh( if (DM_Type == DIG_TYPE_THRESH_HIGH) { - pDM_DigTable->RssiHighThresh = DM_Value; + pDM_DigTable->RssiHighThresh = DM_Value; } else if (DM_Type == DIG_TYPE_THRESH_LOW) { @@ -1537,11 +1537,11 @@ ODM_ChangeDynamicInitGainThresh( else if (DM_Type == DIG_TYPE_ENABLE) { pDM_DigTable->Dig_Enable_Flag = TRUE; - } + } else if (DM_Type == DIG_TYPE_DISABLE) { pDM_DigTable->Dig_Enable_Flag = FALSE; - } + } else if (DM_Type == DIG_TYPE_BACKOFF) { if(DM_Value > 30) @@ -1578,7 +1578,7 @@ int getIGIForDiff(int value_IGI) } -// Add by Neil Chen to enable edcca to MP Platform +// Add by Neil Chen to enable edcca to MP Platform #if (DM_ODM_SUPPORT_TYPE == ODM_MP) VOID @@ -1599,15 +1599,15 @@ odm_EnableEDCCA( //PlatformEFIOWrite1Byte(Adapter, rOFDM0_ECCAThreshold, 0x00); ODM_Write1Byte(pDM_Odm,rOFDM0_ECCAThreshold,0x00); ODM_Write1Byte(pDM_Odm,rOFDM0_ECCAThreshold+2,0xFD); - - } + + } else { //PlatformEFIOWrite1Byte(Adapter, rOFDM0_ECCAThreshold, 0x03); ODM_Write1Byte(pDM_Odm,rOFDM0_ECCAThreshold,0x03); ODM_Write1Byte(pDM_Odm,rOFDM0_ECCAThreshold+2,0x00); - } - + } + //PlatformEFIOWrite1Byte(Adapter, rOFDM0_ECCAThreshold+2, 0x00); } @@ -1615,7 +1615,7 @@ VOID odm_DisableEDCCA( IN PDM_ODM_T pDM_Odm ) -{ +{ // Disable EDCCA.. ODM_Write1Byte(pDM_Odm, rOFDM0_ECCAThreshold, 0x7f); ODM_Write1Byte(pDM_Odm, rOFDM0_ECCAThreshold+2, 0x7f); @@ -1635,21 +1635,21 @@ odm_DynamicEDCCA( HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter); u1Byte RegC50, RegC58; BOOLEAN bEDCCAenable = FALSE; - + RegC50 = (u1Byte)ODM_GetBBReg(pDM_Odm, rOFDM0_XAAGCCore1, bMaskByte0); RegC58 = (u1Byte)ODM_GetBBReg(pDM_Odm, rOFDM0_XBAGCCore1, bMaskByte0); - if((RegC50 > 0x28 && RegC58 > 0x28) || - ((pDM_Odm->SupportICType == ODM_RTL8723A && IS_WIRELESS_MODE_G(pAdapter) && RegC50>0x26)) || - (pDM_Odm->SupportICType == ODM_RTL8188E && RegC50 > 0x28)) + if((RegC50 > 0x28 && RegC58 > 0x28) || + ((pDM_Odm->SupportICType == ODM_RTL8723A && IS_WIRELESS_MODE_G(pAdapter) && RegC50>0x26)) || + (pDM_Odm->SupportICType == ODM_RTL8188E && RegC50 > 0x28)) { if(!pHalData->bPreEdccaEnable) { odm_EnableEDCCA(pDM_Odm); pHalData->bPreEdccaEnable = TRUE; } - + } else if((RegC50 < 0x25 && RegC58 < 0x25) || (pDM_Odm->SupportICType == ODM_RTL8188E && RegC50 < 0x25)) { @@ -1678,7 +1678,7 @@ ODM_Write_DIG( if(pDM_DigTable->CurIGValue != CurrentIGI)//if(pDM_DigTable->PreIGValue != CurrentIGI) { if(pDM_Odm->SupportPlatform & (ODM_CE|ODM_MP)) - { + { ODM_SetBBReg(pDM_Odm, ODM_REG(IGI_A,pDM_Odm), ODM_BIT(IGI,pDM_Odm), CurrentIGI); if(pDM_Odm->SupportICType != ODM_RTL8188E) ODM_SetBBReg(pDM_Odm, ODM_REG(IGI_B,pDM_Odm), ODM_BIT(IGI,pDM_Odm), CurrentIGI); @@ -1710,14 +1710,14 @@ ODM_Write_DIG( } ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("ODM_Write_DIG():CurrentIGI=0x%x \n",CurrentIGI)); -// Add by Neil Chen to enable edcca to MP Platform +// Add by Neil Chen to enable edcca to MP Platform #if (DM_ODM_SUPPORT_TYPE == ODM_MP) // Adjust EDCCA. if(pDM_Odm->SupportICType & ODM_IC_11N_SERIES) odm_DynamicEDCCA(pDM_Odm); #endif - + } @@ -1736,30 +1736,30 @@ odm_DIGbyRSSI_LPS( #if 0 //and 2.3.5 coding rule struct mlme_priv *pmlmepriv = &(pAdapter->mlmepriv); - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter); + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter); struct dm_priv *pdmpriv = &pHalData->dmpriv; -#endif +#endif u1Byte RSSI_Lower=DM_DIG_MIN_NIC; //0x1E or 0x1C u1Byte bFwCurrentInPSMode = FALSE; u1Byte CurrentIGI=pDM_Odm->RSSI_Min; - + if(! (pDM_Odm->SupportICType & (ODM_RTL8723A |ODM_RTL8188E))) return; //if((pDM_Odm->SupportInterface==ODM_ITRF_PCIE)||(pDM_Odm->SupportInterface ==ODM_ITRF_USB)) // return; - + CurrentIGI=CurrentIGI+RSSI_OFFSET_DIG; #ifdef CONFIG_LPS - bFwCurrentInPSMode = adapter_to_pwrctl(pAdapter)->bFwCurrentInPSMode; + bFwCurrentInPSMode = adapter_to_pwrctl(pAdapter)->bFwCurrentInPSMode; #endif - + ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("==>pDM_Odm->RSSI_Min=%d ()\n",pDM_Odm->RSSI_Min)); // Using FW PS mode to make IGI if(bFwCurrentInPSMode) - { + { ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("---Neil---odm_DIG is in LPS mode\n")); //Adjust by FA in LPS MODE if(pFalseAlmCnt->Cnt_all> DM_DIG_FA_TH2_LPS) @@ -1767,9 +1767,9 @@ odm_DIGbyRSSI_LPS( else if (pFalseAlmCnt->Cnt_all > DM_DIG_FA_TH1_LPS) CurrentIGI = CurrentIGI+1; else if(pFalseAlmCnt->Cnt_all < DM_DIG_FA_TH0_LPS) - CurrentIGI = CurrentIGI-1; + CurrentIGI = CurrentIGI-1; } - else + else { CurrentIGI = RSSI_Lower; } @@ -1784,7 +1784,7 @@ odm_DIGbyRSSI_LPS( //Upper and Lower Bound checking if(CurrentIGI > DM_DIG_MAX_NIC) - CurrentIGI=DM_DIG_MAX_NIC; + CurrentIGI=DM_DIG_MAX_NIC; else if(CurrentIGI < RSSI_Lower) CurrentIGI =RSSI_Lower; @@ -1837,10 +1837,10 @@ odm_Adaptivity( #if (DM_ODM_SUPPORT_TYPE == ODM_MP) struct adapter * pAdapter = pDM_Odm->Adapter; HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter); - BOOLEAN bFwCurrentInPSMode=FALSE; + BOOLEAN bFwCurrentInPSMode=FALSE; PMGNT_INFO pMgntInfo = &(pAdapter->MgntInfo); - - pAdapter->HalFunc.GetHwRegHandler(pAdapter, HW_VAR_FW_PSMODE_STATUS, (pu1Byte)(&bFwCurrentInPSMode)); + + pAdapter->HalFunc.GetHwRegHandler(pAdapter, HW_VAR_FW_PSMODE_STATUS, (pu1Byte)(&bFwCurrentInPSMode)); // Disable EDCCA mode while under LPS mode, added by Roger, 2012.09.14. if(bFwCurrentInPSMode) @@ -1850,7 +1850,7 @@ odm_Adaptivity( if(!(pDM_Odm->SupportAbility & ODM_BB_ADAPTIVITY)) { ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("Go to odm_DynamicEDCCA() \n")); - // Add by Neil Chen to enable edcca to MP Platform + // Add by Neil Chen to enable edcca to MP Platform #if (DM_ODM_SUPPORT_TYPE == ODM_MP) // Adjust EDCCA. if(pDM_Odm->SupportICType & ODM_IC_11N_SERIES) @@ -1860,7 +1860,7 @@ odm_Adaptivity( } ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_Adaptivity() =====> \n")); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("ForceEDCCA=%d, IGI_Base=0x%x, TH_L2H_ini = %d, TH_EDCCA_HL_diff = %d, AdapEn_RSSI = %d\n", + ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("ForceEDCCA=%d, IGI_Base=0x%x, TH_L2H_ini = %d, TH_EDCCA_HL_diff = %d, AdapEn_RSSI = %d\n", pDM_Odm->ForceEDCCA, pDM_Odm->IGI_Base, pDM_Odm->TH_L2H_ini, pDM_Odm->TH_EDCCA_HL_diff, pDM_Odm->AdapEn_RSSI)); if(pDM_Odm->SupportICType & ODM_IC_11AC_SERIES) @@ -1878,9 +1878,9 @@ odm_Adaptivity( return; } -#if (DM_ODM_SUPPORT_TYPE==ODM_MP) +#if (DM_ODM_SUPPORT_TYPE==ODM_MP) if(pMgntInfo->IOTPeer == HT_IOT_PEER_BROADCOM) - ODM_Write1Byte(pDM_Odm, REG_TRX_SIFS_OFDM, 0x0a); + ODM_Write1Byte(pDM_Odm, REG_TRX_SIFS_OFDM, 0x0a); else ODM_Write1Byte(pDM_Odm, REG_TRX_SIFS_OFDM, 0x0e); #endif @@ -1917,7 +1917,7 @@ odm_Adaptivity( { Diff = IGI_target -(s1Byte)IGI; TH_L2H_dmc = pDM_Odm->TH_L2H_ini + Diff; - if(TH_L2H_dmc > 10) TH_L2H_dmc = 10; + if(TH_L2H_dmc > 10) TH_L2H_dmc = 10; TH_H2L_dmc = TH_L2H_dmc - pDM_Odm->TH_EDCCA_HL_diff; } else @@ -1925,7 +1925,7 @@ odm_Adaptivity( TH_L2H_dmc = 0x7f; TH_H2L_dmc = 0x7f; } - ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("IGI=0x%x, TH_L2H_dmc = %d, TH_H2L_dmc = %d\n", + ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("IGI=0x%x, TH_L2H_dmc = %d, TH_H2L_dmc = %d\n", IGI, TH_L2H_dmc, TH_H2L_dmc)); if(pDM_Odm->SupportICType & ODM_IC_11N_SERIES) @@ -1946,13 +1946,13 @@ odm_DIGInit( pDIG_T pDM_DigTable = &pDM_Odm->DM_DigTable; //pDM_DigTable->Dig_Enable_Flag = TRUE; - //pDM_DigTable->Dig_Ext_Port_Stage = DIG_EXT_PORT_STAGE_MAX; + //pDM_DigTable->Dig_Ext_Port_Stage = DIG_EXT_PORT_STAGE_MAX; pDM_DigTable->CurIGValue = (u1Byte) ODM_GetBBReg(pDM_Odm, ODM_REG(IGI_A,pDM_Odm), ODM_BIT(IGI,pDM_Odm)); //pDM_DigTable->PreIGValue = 0x0; //pDM_DigTable->CurSTAConnectState = pDM_DigTable->PreSTAConnectState = DIG_STA_DISCONNECT; //pDM_DigTable->CurMultiSTAConnectState = DIG_MultiSTA_DISCONNECT; - pDM_DigTable->RssiLowThresh = DM_DIG_THRESH_LOW; - pDM_DigTable->RssiHighThresh = DM_DIG_THRESH_HIGH; + pDM_DigTable->RssiLowThresh = DM_DIG_THRESH_LOW; + pDM_DigTable->RssiHighThresh = DM_DIG_THRESH_HIGH; pDM_DigTable->FALowThresh = DM_FALSEALARM_THRESH_LOW; pDM_DigTable->FAHighThresh = DM_FALSEALARM_THRESH_HIGH; if(pDM_Odm->BoardType & (ODM_BOARD_EXT_PA|ODM_BOARD_EXT_LNA)) @@ -1977,7 +1977,7 @@ odm_DIGInit( pDM_DigTable->DIG_Dynamic_MIN_1 = DM_DIG_MIN_NIC; pDM_DigTable->bMediaConnect_0 = FALSE; pDM_DigTable->bMediaConnect_1 = FALSE; - + //To Initialize pDM_Odm->bDMInitialGainEnable == FALSE to avoid DIG error pDM_Odm->bDMInitialGainEnable = TRUE; @@ -1995,7 +1995,7 @@ odm_DigForBtHsMode( pDIG_T pDM_DigTable=&pDM_Odm->DM_DigTable; u1Byte digForBtHs=0; u1Byte digUpBound=0x5a; - + if(pDM_Odm->bBtConnectProcess) { if(pDM_Odm->SupportICType&(ODM_RTL8723A)) @@ -2013,7 +2013,7 @@ odm_DigForBtHsMode( //DIG Bound if(pDM_Odm->SupportICType&(ODM_RTL8723A)) digUpBound = 0x3e; - + if(digForBtHs > digUpBound) digForBtHs = digUpBound; if(digForBtHs < 0x1c) @@ -2026,7 +2026,7 @@ odm_DigForBtHsMode( #endif } -VOID +VOID odm_DIG( IN PDM_ODM_T pDM_Odm ) @@ -2060,20 +2060,20 @@ odm_DIG( { odm_DigForBtHsMode(pDM_Odm); } -#endif +#endif if(!(pDM_Odm->SupportICType &(ODM_RTL8723A|ODM_RTL8188E))) { if(pRX_HP_Table->RXHP_flag == 1) { ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG() Return: In RXHP Operation \n")); - return; + return; } - } + } #endif #if (DM_ODM_SUPPORT_TYPE == ODM_CE) -#ifdef CONFIG_SPECIAL_SETTING_FOR_FUNAI_TV +#ifdef CONFIG_SPECIAL_SETTING_FOR_FUNAI_TV if((pDM_Odm->bLinked) && (pDM_Odm->Adapter->registrypriv.force_igi !=0)) - { + { printk("pDM_Odm->RSSI_Min=%d \n",pDM_Odm->RSSI_Min); ODM_Write_DIG(pDM_Odm,pDM_Odm->Adapter->registrypriv.force_igi); return; @@ -2081,7 +2081,7 @@ odm_DIG( #endif #endif #if (DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL)) - prtl8192cd_priv priv = pDM_Odm->priv; + prtl8192cd_priv priv = pDM_Odm->priv; if (!((priv->up_time > 5) && (priv->up_time % 2)) ) { ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG() Return: Not In DIG Operation Period \n")); @@ -2093,7 +2093,7 @@ odm_DIG( //if(!(pDM_Odm->SupportAbility & (ODM_BB_DIG|ODM_BB_FA_CNT))) if((!(pDM_Odm->SupportAbility&ODM_BB_DIG)) ||(!(pDM_Odm->SupportAbility&ODM_BB_FA_CNT))) { -#if 0 +#if 0 if(pDM_Odm->SupportPlatform & (ODM_AP|ODM_ADSL)) { if ((pDM_Odm->SupportICType == ODM_RTL8192C) && (pDM_Odm->ExtLNA == 1)) @@ -2102,15 +2102,15 @@ odm_DIG( CurrentIGI = 0x20; //pDM_DigTable->CurIGValue = 0x20; ODM_Write_DIG(pDM_Odm, CurrentIGI);//ODM_Write_DIG(pDM_Odm, pDM_DigTable->CurIGValue); } -#endif +#endif ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG() Return: SupportAbility ODM_BB_DIG or ODM_BB_FA_CNT is disabled\n")); return; } - + if(*(pDM_Odm->pbScanInProcess)) { ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG() Return: In Scan Progress \n")); - return; + return; } //add by Neil Chen to avoid PSD is processing @@ -2122,7 +2122,7 @@ odm_DIG( return; } } - + if(pDM_Odm->SupportICType == ODM_RTL8192D) { if(*(pDM_Odm->pMacPhyMode) == ODM_DMSP) @@ -2130,13 +2130,13 @@ odm_DIG( if(*(pDM_Odm->pbMasterOfDMSP)) { DIG_Dynamic_MIN = pDM_DigTable->DIG_Dynamic_MIN_0; - FirstConnect = (pDM_Odm->bLinked) && (pDM_DigTable->bMediaConnect_0 == FALSE); + FirstConnect = (pDM_Odm->bLinked) && (pDM_DigTable->bMediaConnect_0 == FALSE); FirstDisConnect = (!pDM_Odm->bLinked) && (pDM_DigTable->bMediaConnect_0 == TRUE); } else { DIG_Dynamic_MIN = pDM_DigTable->DIG_Dynamic_MIN_1; - FirstConnect = (pDM_Odm->bLinked) && (pDM_DigTable->bMediaConnect_1 == FALSE); + FirstConnect = (pDM_Odm->bLinked) && (pDM_DigTable->bMediaConnect_1 == FALSE); FirstDisConnect = (!pDM_Odm->bLinked) && (pDM_DigTable->bMediaConnect_1 == TRUE); } } @@ -2157,12 +2157,12 @@ odm_DIG( } } else - { + { DIG_Dynamic_MIN = pDM_DigTable->DIG_Dynamic_MIN_0; FirstConnect = (pDM_Odm->bLinked) && (pDM_DigTable->bMediaConnect_0 == FALSE); FirstDisConnect = (!pDM_Odm->bLinked) && (pDM_DigTable->bMediaConnect_0 == TRUE); } - + //1 Boundary Decision if(pDM_Odm->SupportICType & (ODM_RTL8192C) &&(pDM_Odm->BoardType & (ODM_BOARD_EXT_LNA | ODM_BOARD_EXT_PA))) { @@ -2201,7 +2201,7 @@ odm_DIG( dm_dig_max = 0x32; } else -#endif +#endif dm_dig_max = DM_DIG_MAX_AP; dm_dig_min = DM_DIG_MIN_AP; DIG_MaxOfMin = dm_dig_max; @@ -2212,7 +2212,7 @@ odm_DIG( dm_dig_max = 0x5A; else dm_dig_max = DM_DIG_MAX_NIC; - + if(pDM_Odm->SupportICType != ODM_RTL8821) dm_dig_min = DM_DIG_MIN_NIC; else @@ -2222,7 +2222,7 @@ odm_DIG( } } - + if(pDM_Odm->bLinked) { if(pDM_Odm->SupportICType&(ODM_RTL8723A/*|ODM_RTL8821*/)) @@ -2259,12 +2259,12 @@ odm_DIG( pDM_DigTable->rx_gain_range_max = dm_dig_min; else pDM_DigTable->rx_gain_range_max = pDM_Odm->RSSI_Min + 20; - + } } else { - if((pDM_Odm->SupportICType & (ODM_RTL8192E|ODM_RTL8723B|ODM_RTL8812|ODM_RTL8821)) && (pDM_Odm->bBtLimitedDig==1)){ + if((pDM_Odm->SupportICType & (ODM_RTL8192E|ODM_RTL8723B|ODM_RTL8812|ODM_RTL8821)) && (pDM_Odm->bBtLimitedDig==1)){ //2 Modify DIG upper bound for 92E, 8723B, 8821 & 8812 BT if((pDM_Odm->RSSI_Min + 10) > dm_dig_max ) pDM_DigTable->rx_gain_range_max = dm_dig_max; @@ -2274,23 +2274,23 @@ odm_DIG( pDM_DigTable->rx_gain_range_max = pDM_Odm->RSSI_Min + 10; } else{ - + //2 Modify DIG upper bound //2013.03.19 Luke: Modified upper bound for Netgear rental house test if(pDM_Odm->SupportICType != ODM_RTL8821) offset = 20; else offset = 10; - + if((pDM_Odm->RSSI_Min + offset) > dm_dig_max ) pDM_DigTable->rx_gain_range_max = dm_dig_max; else if((pDM_Odm->RSSI_Min + offset) < dm_dig_min ) pDM_DigTable->rx_gain_range_max = dm_dig_min; else pDM_DigTable->rx_gain_range_max = pDM_Odm->RSSI_Min + offset; - + } - + //2 Modify DIG lower bound /* if((pFalseAlmCnt->Cnt_all > 500)&&(DIG_Dynamic_MIN < 0x25)) @@ -2299,7 +2299,7 @@ odm_DIG( DIG_Dynamic_MIN--; */ - + //1 Lower Bound for 88E AntDiv #if (RTL8188E_SUPPORT == 1) if((pDM_Odm->SupportICType == ODM_RTL8188E)&&(pDM_Odm->SupportAbility & ODM_BB_ANT_DIV)) @@ -2311,7 +2311,7 @@ odm_DIG( } } else -#endif +#endif { if(pDM_Odm->SupportICType != ODM_RTL8723B) offset = 0; @@ -2329,7 +2329,7 @@ odm_DIG( ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG() : pDM_Odm->RSSI_Min=%d\n",pDM_Odm->RSSI_Min)); } - + } } else @@ -2338,7 +2338,7 @@ odm_DIG( DIG_Dynamic_MIN = dm_dig_min; ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG() : No Link\n")); } - + //1 Modify DIG lower bound, deal with abnorally large false alarm if(pFalseAlmCnt->Cnt_all > 10000) { @@ -2394,7 +2394,7 @@ odm_DIG( if((pDM_Odm->SupportPlatform&(ODM_MP|ODM_CE))&&(pDM_Odm->PhyDbgInfo.NumQryBeaconPkt < 10) && (pDM_Odm->bsta_state)) pDM_DigTable->rx_gain_range_min = dm_dig_min; - + if(pDM_DigTable->rx_gain_range_min > pDM_DigTable->rx_gain_range_max) pDM_DigTable->rx_gain_range_min = pDM_DigTable->rx_gain_range_max; @@ -2421,11 +2421,11 @@ odm_DIG( else if (pFalseAlmCnt->Cnt_all > DM_DIG_FA_TH1_92D) CurrentIGI = CurrentIGI + 2; //pDM_DigTable->CurIGValue = pDM_DigTable->PreIGValue+1; else if(pFalseAlmCnt->Cnt_all < DM_DIG_FA_TH0_92D) - CurrentIGI = CurrentIGI - 2;//pDM_DigTable->CurIGValue =pDM_DigTable->PreIGValue-1; + CurrentIGI = CurrentIGI - 2;//pDM_DigTable->CurIGValue =pDM_DigTable->PreIGValue-1; } else { - //FA for Combo IC--NeilChen--2012--09--28 + //FA for Combo IC--NeilChen--2012--09--28 if(pDM_Odm->SupportICType == ODM_RTL8723A) { //WLAN and BT ConCurrent @@ -2445,7 +2445,7 @@ odm_DIG( else if (pFalseAlmCnt->Cnt_all > DM_DIG_FA_TH1) CurrentIGI = CurrentIGI + 2;//pDM_DigTable->CurIGValue = pDM_DigTable->PreIGValue+1; else if(pFalseAlmCnt->Cnt_all < DM_DIG_FA_TH0) - CurrentIGI = CurrentIGI - 2;//pDM_DigTable->CurIGValue =pDM_DigTable->PreIGValue-1; + CurrentIGI = CurrentIGI - 2;//pDM_DigTable->CurIGValue =pDM_DigTable->PreIGValue-1; } } else @@ -2455,18 +2455,18 @@ odm_DIG( else if (pFalseAlmCnt->Cnt_all > DM_DIG_FA_TH1) CurrentIGI = CurrentIGI + 2;//pDM_DigTable->CurIGValue = pDM_DigTable->PreIGValue+1; else if(pFalseAlmCnt->Cnt_all < DM_DIG_FA_TH0) - CurrentIGI = CurrentIGI - 2;//pDM_DigTable->CurIGValue =pDM_DigTable->PreIGValue-1; + CurrentIGI = CurrentIGI - 2;//pDM_DigTable->CurIGValue =pDM_DigTable->PreIGValue-1; if((pDM_Odm->SupportPlatform&(ODM_MP|ODM_CE))&&(pDM_Odm->PhyDbgInfo.NumQryBeaconPkt < 10) &&(pFalseAlmCnt->Cnt_all < DM_DIG_FA_TH1) && (pDM_Odm->bsta_state)) - { + { CurrentIGI = pDM_DigTable->rx_gain_range_min; ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG(): Beacon is less than 10 and FA is less than 768, IGI GOES TO 0x1E!!!!!!!!!!!!\n")); } } } } - } + } else { //CurrentIGI = pDM_DigTable->rx_gain_range_min;//pDM_DigTable->CurIGValue = pDM_DigTable->rx_gain_range_min @@ -2495,26 +2495,26 @@ odm_DIG( CurrentIGI = pDM_DigTable->rx_gain_range_max; if(CurrentIGI < pDM_DigTable->rx_gain_range_min) CurrentIGI = pDM_DigTable->rx_gain_range_min; - + if(pDM_Odm->SupportAbility & ODM_BB_ADAPTIVITY) { if(CurrentIGI > Adap_IGI_Upper) CurrentIGI = Adap_IGI_Upper; - + if(CurrentIGI > (pDM_Odm->IGI_target + 4)) CurrentIGI = (u1Byte)pDM_Odm->IGI_target + 4; } - - ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG(): rx_gain_range_max=0x%x, rx_gain_range_min=0x%x\n", + + ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG(): rx_gain_range_max=0x%x, rx_gain_range_min=0x%x\n", pDM_DigTable->rx_gain_range_max, pDM_DigTable->rx_gain_range_min)); ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG(): TotalFA=%d\n", pFalseAlmCnt->Cnt_all)); ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG(): CurIGValue=0x%x\n", CurrentIGI)); //2 High power RSSI threshold -#if (DM_ODM_SUPPORT_TYPE & ODM_MP) +#if (DM_ODM_SUPPORT_TYPE & ODM_MP) { HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pDM_Odm->Adapter); - //PMGNT_INFO pMgntInfo = &(pAdapter->MgntInfo); + //PMGNT_INFO pMgntInfo = &(pAdapter->MgntInfo); // for LC issue to dymanic modify DIG lower bound----------LC Mocca Issue u8Byte curTxOkCnt=0, curRxOkCnt=0; static u8Byte lastTxOkCnt=0, lastRxOkCnt=0; @@ -2522,7 +2522,7 @@ odm_DIG( //u8Byte OKCntAll=0; //static u8Byte TXByteCnt_A=0, TXByteCnt_B=0, RXByteCnt_A=0, RXByteCnt_B=0; //u8Byte CurByteCnt=0, PreByteCnt=0; - + curTxOkCnt = pAdapter->TxStats.NumTxBytesUnicast - lastTxOkCnt; curRxOkCnt =pAdapter->RxStats.NumRxBytesUnicast - lastRxOkCnt; lastTxOkCnt = pAdapter->TxStats.NumTxBytesUnicast; @@ -2539,18 +2539,18 @@ odm_DIG( CurrentIGI=DM_DIG_HIGH_PWR_IGI_LOWER_BOUND; } } - if((pDM_Odm->SupportICType & ODM_RTL8723A) && + if((pDM_Odm->SupportICType & ODM_RTL8723A) && IS_WIRELESS_MODE_G(pAdapter)) { if(pHalData->UndecoratedSmoothedPWDB > 0x28) { if(CurrentIGI < DM_DIG_Gmode_HIGH_PWR_IGI_LOWER_BOUND) { - //pDM_DigTable->CurIGValue = DM_DIG_Gmode_HIGH_PWR_IGI_LOWER_BOUND; + //pDM_DigTable->CurIGValue = DM_DIG_Gmode_HIGH_PWR_IGI_LOWER_BOUND; CurrentIGI = DM_DIG_Gmode_HIGH_PWR_IGI_LOWER_BOUND; - } - } - } + } + } + } #if 0 if((pDM_Odm->SupportICType & ODM_RTL8723A)&&(pMgntInfo->CustomerID = RT_CID_LENOVO_CHINA)) { @@ -2565,9 +2565,9 @@ odm_DIG( { if(CurrentIGI > DM_DIG_MIN_NIC) { - if(OKCntAll >= 1500000) // >=6Mbps + if(OKCntAll >= 1500000) // >=6Mbps CurrentIGI=0x1B; - else if(OKCntAll >= 1000000) //4Mbps + else if(OKCntAll >= 1000000) //4Mbps CurrentIGI=0x1A; else if(OKCntAll >= 500000) //2Mbps CurrentIGI=0x19; @@ -2578,15 +2578,15 @@ odm_DIG( CurrentIGI=0x17; //SCAN mode } } - ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("Modify---->CurIGValue(%#x)\n", CurrentIGI)); + ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("Modify---->CurIGValue(%#x)\n", CurrentIGI)); } } - } -#endif + } +#endif } #endif - -#if (RTL8192D_SUPPORT==1) + +#if (RTL8192D_SUPPORT==1) if(pDM_Odm->SupportICType == ODM_RTL8192D) { //sherry delete DualMacSmartConncurrent 20110517 @@ -2630,8 +2630,8 @@ odm_DIG( if(pDM_DigTable->BT30_CurIGI > (CurrentIGI)) { ODM_Write_DIG(pDM_Odm, CurrentIGI); - - } + + } else { ODM_Write_DIG(pDM_Odm, pDM_DigTable->BT30_CurIGI); @@ -2651,12 +2651,12 @@ odm_DIG( } else { - ODM_Write_DIG(pDM_Odm, pDM_DigTable->BT30_CurIGI);//ODM_Write_DIG(pDM_Odm, pDM_DigTable->CurIGValue); + ODM_Write_DIG(pDM_Odm, pDM_DigTable->BT30_CurIGI);//ODM_Write_DIG(pDM_Odm, pDM_DigTable->CurIGValue); } } - } + } else // BT is not using - #endif + #endif { ODM_Write_DIG(pDM_Odm, CurrentIGI);//ODM_Write_DIG(pDM_Odm, pDM_DigTable->CurIGValue); pDM_DigTable->bMediaConnect_0 = pDM_Odm->bLinked; @@ -2666,7 +2666,7 @@ odm_DIG( } -BOOLEAN +BOOLEAN odm_DigAbort( IN PDM_ODM_T pDM_Odm ) @@ -2675,26 +2675,26 @@ odm_DigAbort( // This should be moved out of OUTSRC struct adapter * pAdapter = pDM_Odm->Adapter; pRXHP_T pRX_HP_Table = &pDM_Odm->DM_RXHP_Table; - + #if OS_WIN_FROM_WIN7(OS_VERSION) if(IsAPModeExist( pAdapter) && pAdapter->bInHctTest) { ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG() Return: Is AP mode or In HCT Test \n")); - return TRUE; + return TRUE; } #endif if(pRX_HP_Table->RXHP_flag == 1) { ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG() Return: In RXHP Operation \n")); - return TRUE; + return TRUE; } return FALSE; #else // For Other team any special case for DIG? return FALSE; #endif - + } @@ -2708,13 +2708,13 @@ odm_DIGInit( pDIG_T pDM_DigTable = &pDM_Odm->DM_DigTable; //pDM_DigTable->Dig_Enable_Flag = TRUE; - //pDM_DigTable->Dig_Ext_Port_Stage = DIG_EXT_PORT_STAGE_MAX; + //pDM_DigTable->Dig_Ext_Port_Stage = DIG_EXT_PORT_STAGE_MAX; pDM_DigTable->CurIGValue = (u1Byte) ODM_GetBBReg(pDM_Odm, ODM_REG(IGI_A,pDM_Odm), ODM_BIT(IGI,pDM_Odm)); //pDM_DigTable->PreIGValue = 0x0; //pDM_DigTable->CurSTAConnectState = pDM_DigTable->PreSTAConnectState = DIG_STA_DISCONNECT; //pDM_DigTable->CurMultiSTAConnectState = DIG_MultiSTA_DISCONNECT; - pDM_DigTable->RssiLowThresh = DM_DIG_THRESH_LOW; - pDM_DigTable->RssiHighThresh = DM_DIG_THRESH_HIGH; + pDM_DigTable->RssiLowThresh = DM_DIG_THRESH_LOW; + pDM_DigTable->RssiHighThresh = DM_DIG_THRESH_HIGH; pDM_DigTable->FALowThresh = DM_FALSEALARM_THRESH_LOW; pDM_DigTable->FAHighThresh = DM_FALSEALARM_THRESH_HIGH; if(pDM_Odm->BoardType & (ODM_BOARD_EXT_LNA | ODM_BOARD_EXT_PA)) @@ -2739,14 +2739,14 @@ odm_DIGInit( pDM_DigTable->DIG_Dynamic_MIN_1 = DM_DIG_MIN_NIC; pDM_DigTable->bMediaConnect_0 = FALSE; pDM_DigTable->bMediaConnect_1 = FALSE; - + //To Initialize pDM_Odm->bDMInitialGainEnable == FALSE to avoid DIG error pDM_Odm->bDMInitialGainEnable = TRUE; } -VOID +VOID odm_DIG( IN PDM_ODM_T pDM_Odm ) @@ -2768,28 +2768,28 @@ odm_DIG( if(IsAPModeExist( pAdapter) && pAdapter->bInHctTest) { ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG() Return: Is AP mode or In HCT Test \n")); - return; + return; } #endif -#if(BT_30_SUPPORT == 1) +#if(BT_30_SUPPORT == 1) if(pDM_Odm->bBtHsOperation) { odm_DigForBtHsMode(pDM_Odm); - return; + return; } -#endif +#endif if(pRX_HP_Table->RXHP_flag == 1) { ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG() Return: In RXHP Operation \n")); - return; + return; } #endif //end ODM_MP type #if (DM_ODM_SUPPORT_TYPE == ODM_CE) -#ifdef CONFIG_SPECIAL_SETTING_FOR_FUNAI_TV +#ifdef CONFIG_SPECIAL_SETTING_FOR_FUNAI_TV if((pDM_Odm->bLinked) && (pDM_Odm->Adapter->registrypriv.force_igi !=0)) - { + { printk("pDM_Odm->RSSI_Min=%d \n",pDM_Odm->RSSI_Min); ODM_Write_DIG(pDM_Odm,pDM_Odm->Adapter->registrypriv.force_igi); return; @@ -2797,7 +2797,7 @@ odm_DIG( #endif #endif #if (DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL)) - prtl8192cd_priv priv = pDM_Odm->priv; + prtl8192cd_priv priv = pDM_Odm->priv; if (!((priv->up_time > 5) && (priv->up_time % 2)) ) { ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG() Return: Not In DIG Operation Period \n")); @@ -2809,7 +2809,7 @@ odm_DIG( //if(!(pDM_Odm->SupportAbility & (ODM_BB_DIG|ODM_BB_FA_CNT))) if((!(pDM_Odm->SupportAbility&ODM_BB_DIG)) ||(!(pDM_Odm->SupportAbility&ODM_BB_FA_CNT))) { -#if 0 +#if 0 if(pDM_Odm->SupportPlatform & (ODM_AP|ODM_ADSL)) { if ((pDM_Odm->SupportICType == ODM_RTL8192C) && (pDM_Odm->ExtLNA == 1)) @@ -2818,15 +2818,15 @@ odm_DIG( CurrentIGI = 0x20; //pDM_DigTable->CurIGValue = 0x20; ODM_Write_DIG(pDM_Odm, CurrentIGI);//ODM_Write_DIG(pDM_Odm, pDM_DigTable->CurIGValue); } -#endif +#endif ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG() Return: SupportAbility ODM_BB_DIG or ODM_BB_FA_CNT is disabled\n")); return; } - + if(*(pDM_Odm->pbScanInProcess)) { ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG() Return: In Scan Progress \n")); - return; + return; } //add by Neil Chen to avoid PSD is processing @@ -2835,7 +2835,7 @@ odm_DIG( ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG() Return: PSD is Processing \n")); return; } - + if(pDM_Odm->SupportICType == ODM_RTL8192D) { if(*(pDM_Odm->pMacPhyMode) == ODM_DMSP) @@ -2843,13 +2843,13 @@ odm_DIG( if(*(pDM_Odm->pbMasterOfDMSP)) { DIG_Dynamic_MIN = pDM_DigTable->DIG_Dynamic_MIN_0; - FirstConnect = (pDM_Odm->bLinked) && (pDM_DigTable->bMediaConnect_0 == FALSE); + FirstConnect = (pDM_Odm->bLinked) && (pDM_DigTable->bMediaConnect_0 == FALSE); FirstDisConnect = (!pDM_Odm->bLinked) && (pDM_DigTable->bMediaConnect_0 == TRUE); } else { DIG_Dynamic_MIN = pDM_DigTable->DIG_Dynamic_MIN_1; - FirstConnect = (pDM_Odm->bLinked) && (pDM_DigTable->bMediaConnect_1 == FALSE); + FirstConnect = (pDM_Odm->bLinked) && (pDM_DigTable->bMediaConnect_1 == FALSE); FirstDisConnect = (!pDM_Odm->bLinked) && (pDM_DigTable->bMediaConnect_1 == TRUE); } } @@ -2870,12 +2870,12 @@ odm_DIG( } } else - { + { DIG_Dynamic_MIN = pDM_DigTable->DIG_Dynamic_MIN_0; FirstConnect = (pDM_Odm->bLinked) && (pDM_DigTable->bMediaConnect_0 == FALSE); FirstDisConnect = (!pDM_Odm->bLinked) && (pDM_DigTable->bMediaConnect_0 == TRUE); } - + //1 Boundary Decision if((pDM_Odm->SupportICType & (ODM_RTL8192C|ODM_RTL8723A)) && ((if(pDM_Odm->BoardType & (ODM_BOARD_EXT_LNA | ODM_BOARD_EXT_PA))) || pDM_Odm->ExtLNA)) @@ -2915,7 +2915,7 @@ odm_DIG( dm_dig_max = 0x32; } else -#endif +#endif dm_dig_max = DM_DIG_MAX_AP; dm_dig_min = DM_DIG_MIN_AP; DIG_MaxOfMin = dm_dig_max; @@ -2928,7 +2928,7 @@ odm_DIG( } } - + if(pDM_Odm->bLinked) { //2 8723A Series, offset need to be 10 //neil @@ -2974,8 +2974,8 @@ odm_DIG( pDM_DigTable->rx_gain_range_max = dm_dig_min; else pDM_DigTable->rx_gain_range_max = pDM_Odm->RSSI_Min + 20; - - + + //2 Modify DIG lower bound /* if((pFalseAlmCnt->Cnt_all > 500)&&(DIG_Dynamic_MIN < 0x25)) @@ -2984,7 +2984,7 @@ odm_DIG( DIG_Dynamic_MIN--; */ if(pDM_Odm->bOneEntryOnly) - { + { if(pDM_Odm->RSSI_Min < dm_dig_min) DIG_Dynamic_MIN = dm_dig_min; else if (pDM_Odm->RSSI_Min > DIG_MaxOfMin) @@ -3017,7 +3017,7 @@ odm_DIG( DIG_Dynamic_MIN = dm_dig_min; ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG() : No Link\n")); } - + //1 Modify DIG lower bound, deal with abnormally large false alarm if(pFalseAlmCnt->Cnt_all > 10000) { @@ -3089,7 +3089,7 @@ odm_DIG( else if (pFalseAlmCnt->Cnt_all > DM_DIG_FA_TH1_92D) CurrentIGI = CurrentIGI + 1; //pDM_DigTable->CurIGValue = pDM_DigTable->PreIGValue+1; else if(pFalseAlmCnt->Cnt_all < DM_DIG_FA_TH0_92D) - CurrentIGI = CurrentIGI - 1;//pDM_DigTable->CurIGValue =pDM_DigTable->PreIGValue-1; + CurrentIGI = CurrentIGI - 1;//pDM_DigTable->CurIGValue =pDM_DigTable->PreIGValue-1; } else { @@ -3111,13 +3111,13 @@ odm_DIG( else if (pFalseAlmCnt->Cnt_all > DM_DIG_FA_TH1) CurrentIGI = CurrentIGI + 2;//pDM_DigTable->CurIGValue = pDM_DigTable->PreIGValue+1; else if(pFalseAlmCnt->Cnt_all < DM_DIG_FA_TH0) - CurrentIGI = CurrentIGI - 2;//pDM_DigTable->CurIGValue =pDM_DigTable->PreIGValue-1; - - + CurrentIGI = CurrentIGI - 2;//pDM_DigTable->CurIGValue =pDM_DigTable->PreIGValue-1; + + } } - } - } + } + } else { //CurrentIGI = pDM_DigTable->rx_gain_range_min;//pDM_DigTable->CurIGValue = pDM_DigTable->rx_gain_range_min @@ -3135,7 +3135,7 @@ odm_DIG( else if (pFalseAlmCnt->Cnt_all > 8000) CurrentIGI = CurrentIGI + 1;//pDM_DigTable->CurIGValue = pDM_DigTable->PreIGValue+1; else if(pFalseAlmCnt->Cnt_all < 500) - CurrentIGI = CurrentIGI - 1;//pDM_DigTable->CurIGValue =pDM_DigTable->PreIGValue-1; + CurrentIGI = CurrentIGI - 1;//pDM_DigTable->CurIGValue =pDM_DigTable->PreIGValue-1; ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG(): England DIG \n")); } } @@ -3151,14 +3151,14 @@ odm_DIG( CurrentIGI = pDM_DigTable->rx_gain_range_max; if(CurrentIGI < pDM_DigTable->rx_gain_range_min) CurrentIGI = pDM_DigTable->rx_gain_range_min; - - ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG(): rx_gain_range_max=0x%x, rx_gain_range_min=0x%x\n", + + ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG(): rx_gain_range_max=0x%x, rx_gain_range_min=0x%x\n", pDM_DigTable->rx_gain_range_max, pDM_DigTable->rx_gain_range_min)); ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG(): TotalFA=%d\n", pFalseAlmCnt->Cnt_all)); ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG(): CurIGValue=0x%x\n", CurrentIGI)); //2 High power RSSI threshold -#if (DM_ODM_SUPPORT_TYPE & ODM_MP) +#if (DM_ODM_SUPPORT_TYPE & ODM_MP) { HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pDM_Odm->Adapter); @@ -3169,7 +3169,7 @@ odm_DIG( u8Byte OKCntAll=0; //static u8Byte TXByteCnt_A=0, TXByteCnt_B=0, RXByteCnt_A=0, RXByteCnt_B=0; //u8Byte CurByteCnt=0, PreByteCnt=0; - + curTxOkCnt = pAdapter->TxStats.NumTxBytesUnicast - lastTxOkCnt; curRxOkCnt =pAdapter->RxStats.NumRxBytesUnicast - lastRxOkCnt; lastTxOkCnt = pAdapter->TxStats.NumTxBytesUnicast; @@ -3192,15 +3192,15 @@ odm_DIG( { if(CurrentIGI < DM_DIG_Gmode_HIGH_PWR_IGI_LOWER_BOUND) { - //pDM_DigTable->CurIGValue = DM_DIG_Gmode_HIGH_PWR_IGI_LOWER_BOUND; + //pDM_DigTable->CurIGValue = DM_DIG_Gmode_HIGH_PWR_IGI_LOWER_BOUND; CurrentIGI = DM_DIG_Gmode_HIGH_PWR_IGI_LOWER_BOUND; - } + } } } } #endif - -#if (RTL8192D_SUPPORT==1) + +#if (RTL8192D_SUPPORT==1) if(pDM_Odm->SupportICType == ODM_RTL8192D) { //sherry delete DualMacSmartConncurrent 20110517 @@ -3240,14 +3240,14 @@ odm_DIG( pDM_DigTable->bMediaConnect_0 = pDM_Odm->bLinked; pDM_DigTable->DIG_Dynamic_MIN_0 = DIG_Dynamic_MIN; } - -} + +} #endif //3============================================================ //3 FASLE ALARM CHECK //3============================================================ -VOID +VOID odm_FalseAlarmCounterStatistics( IN PDM_ODM_T pDM_Odm ) @@ -3269,7 +3269,7 @@ odm_FalseAlarmCounterStatistics( odm_FalseAlarmCounterStatistics_ForSlaveOfDMSP(pDM_Odm); return; } -#endif +#endif if(!(pDM_Odm->SupportAbility & ODM_BB_FA_CNT)) return; @@ -3281,20 +3281,20 @@ odm_FalseAlarmCounterStatistics( //hold ofdm counter ODM_SetBBReg(pDM_Odm, ODM_REG_OFDM_FA_HOLDC_11N, BIT31, 1); //hold page C counter ODM_SetBBReg(pDM_Odm, ODM_REG_OFDM_FA_RSTD_11N, BIT31, 1); //hold page D counter - + ret_value = ODM_GetBBReg(pDM_Odm, ODM_REG_OFDM_FA_TYPE1_11N, bMaskDWord); FalseAlmCnt->Cnt_Fast_Fsync = (ret_value&0xffff); - FalseAlmCnt->Cnt_SB_Search_fail = ((ret_value&0xffff0000)>>16); + FalseAlmCnt->Cnt_SB_Search_fail = ((ret_value&0xffff0000)>>16); ret_value = ODM_GetBBReg(pDM_Odm, ODM_REG_OFDM_FA_TYPE2_11N, bMaskDWord); - FalseAlmCnt->Cnt_OFDM_CCA = (ret_value&0xffff); - FalseAlmCnt->Cnt_Parity_Fail = ((ret_value&0xffff0000)>>16); + FalseAlmCnt->Cnt_OFDM_CCA = (ret_value&0xffff); + FalseAlmCnt->Cnt_Parity_Fail = ((ret_value&0xffff0000)>>16); ret_value = ODM_GetBBReg(pDM_Odm, ODM_REG_OFDM_FA_TYPE3_11N, bMaskDWord); FalseAlmCnt->Cnt_Rate_Illegal = (ret_value&0xffff); FalseAlmCnt->Cnt_Crc8_fail = ((ret_value&0xffff0000)>>16); ret_value = ODM_GetBBReg(pDM_Odm, ODM_REG_OFDM_FA_TYPE4_11N, bMaskDWord); FalseAlmCnt->Cnt_Mcs_fail = (ret_value&0xffff); - FalseAlmCnt->Cnt_Ofdm_fail = FalseAlmCnt->Cnt_Parity_Fail + FalseAlmCnt->Cnt_Rate_Illegal + + FalseAlmCnt->Cnt_Ofdm_fail = FalseAlmCnt->Cnt_Parity_Fail + FalseAlmCnt->Cnt_Rate_Illegal + FalseAlmCnt->Cnt_Crc8_fail + FalseAlmCnt->Cnt_Mcs_fail + FalseAlmCnt->Cnt_Fast_Fsync + FalseAlmCnt->Cnt_SB_Search_fail; @@ -3307,7 +3307,7 @@ odm_FalseAlarmCounterStatistics( } #endif -#if (RTL8192D_SUPPORT==1) +#if (RTL8192D_SUPPORT==1) if(pDM_Odm->SupportICType == ODM_RTL8192D) { odm_GetCCKFalseAlarm_92D(pDM_Odm); @@ -3316,9 +3316,9 @@ odm_FalseAlarmCounterStatistics( #endif { //hold cck counter - ODM_SetBBReg(pDM_Odm, ODM_REG_CCK_FA_RST_11N, BIT12, 1); - ODM_SetBBReg(pDM_Odm, ODM_REG_CCK_FA_RST_11N, BIT14, 1); - + ODM_SetBBReg(pDM_Odm, ODM_REG_CCK_FA_RST_11N, BIT12, 1); + ODM_SetBBReg(pDM_Odm, ODM_REG_CCK_FA_RST_11N, BIT14, 1); + ret_value = ODM_GetBBReg(pDM_Odm, ODM_REG_CCK_FA_LSB_11N, bMaskByte0); FalseAlmCnt->Cnt_Cck_fail = ret_value; ret_value = ODM_GetBBReg(pDM_Odm, ODM_REG_CCK_FA_MSB_11N, bMaskByte3); @@ -3327,14 +3327,14 @@ odm_FalseAlarmCounterStatistics( ret_value = ODM_GetBBReg(pDM_Odm, ODM_REG_CCK_CCA_CNT_11N, bMaskDWord); FalseAlmCnt->Cnt_CCK_CCA = ((ret_value&0xFF)<<8) |((ret_value&0xFF00)>>8); } - - FalseAlmCnt->Cnt_all = ( FalseAlmCnt->Cnt_Fast_Fsync + + + FalseAlmCnt->Cnt_all = ( FalseAlmCnt->Cnt_Fast_Fsync + FalseAlmCnt->Cnt_SB_Search_fail + FalseAlmCnt->Cnt_Parity_Fail + FalseAlmCnt->Cnt_Rate_Illegal + FalseAlmCnt->Cnt_Crc8_fail + FalseAlmCnt->Cnt_Mcs_fail + - FalseAlmCnt->Cnt_Cck_fail); + FalseAlmCnt->Cnt_Cck_fail); FalseAlmCnt->Cnt_CCA_all = FalseAlmCnt->Cnt_OFDM_CCA + FalseAlmCnt->Cnt_CCK_CCA; @@ -3360,13 +3360,13 @@ odm_FalseAlarmCounterStatistics( ODM_SetBBReg(pDM_Odm, ODM_REG_OFDM_FA_RSTD_11N, BIT31, 0); //update page D counter //reset CCK CCA counter - ODM_SetBBReg(pDM_Odm, ODM_REG_CCK_FA_RST_11N, BIT13|BIT12, 0); - ODM_SetBBReg(pDM_Odm, ODM_REG_CCK_FA_RST_11N, BIT13|BIT12, 2); + ODM_SetBBReg(pDM_Odm, ODM_REG_CCK_FA_RST_11N, BIT13|BIT12, 0); + ODM_SetBBReg(pDM_Odm, ODM_REG_CCK_FA_RST_11N, BIT13|BIT12, 2); //reset CCK FA counter - ODM_SetBBReg(pDM_Odm, ODM_REG_CCK_FA_RST_11N, BIT15|BIT14, 0); - ODM_SetBBReg(pDM_Odm, ODM_REG_CCK_FA_RST_11N, BIT15|BIT14, 2); + ODM_SetBBReg(pDM_Odm, ODM_REG_CCK_FA_RST_11N, BIT15|BIT14, 0); + ODM_SetBBReg(pDM_Odm, ODM_REG_CCK_FA_RST_11N, BIT15|BIT14, 2); } - + ODM_RT_TRACE(pDM_Odm,ODM_COMP_FA_CNT, ODM_DBG_LOUD, ("Enter odm_FalseAlarmCounterStatistics\n")); ODM_RT_TRACE(pDM_Odm,ODM_COMP_FA_CNT, ODM_DBG_LOUD, ("Cnt_Fast_Fsync=%d, Cnt_SB_Search_fail=%d\n", FalseAlmCnt->Cnt_Fast_Fsync, FalseAlmCnt->Cnt_SB_Search_fail)); @@ -3387,7 +3387,7 @@ odm_FalseAlarmCounterStatistics( ODM_SetBBReg(pDM_Odm, ODM_REG_OFDM_FA_RST_11AC, BIT17, 0); // reset CCK FA counter ODM_SetBBReg(pDM_Odm, ODM_REG_CCK_FA_RST_11AC, BIT15, 0); - ODM_SetBBReg(pDM_Odm, ODM_REG_CCK_FA_RST_11AC, BIT15, 1); + ODM_SetBBReg(pDM_Odm, ODM_REG_CCK_FA_RST_11AC, BIT15, 1); } ODM_RT_TRACE(pDM_Odm,ODM_COMP_FA_CNT, ODM_DBG_LOUD, ("Cnt_Cck_fail=%d\n", FalseAlmCnt->Cnt_Cck_fail)); ODM_RT_TRACE(pDM_Odm,ODM_COMP_FA_CNT, ODM_DBG_LOUD, ("Cnt_Ofdm_fail=%d\n", FalseAlmCnt->Cnt_Ofdm_fail)); @@ -3398,7 +3398,7 @@ odm_FalseAlarmCounterStatistics( //3 CCK Packet Detect Threshold //3============================================================ -VOID +VOID odm_CCKPacketDetectionThresh( IN PDM_ODM_T pDM_Odm ) @@ -3413,7 +3413,7 @@ odm_CCKPacketDetectionThresh( if (pDM_Odm->bDualMacSmartConcurrent == TRUE) // if (pDM_Odm->bDualMacSmartConcurrent == FALSE) return; -#if(BT_30_SUPPORT == 1) +#if(BT_30_SUPPORT == 1) if(pDM_Odm->bBtHsOperation) { ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_CCKPacketDetectionThresh() write 0xcd for BT HS mode!!\n")); @@ -3450,8 +3450,8 @@ odm_CCKPacketDetectionThresh( else CurCCK_CCAThres = 0x40; } - -#if (RTL8192D_SUPPORT==1) + +#if (RTL8192D_SUPPORT==1) if(pDM_Odm->SupportICType == ODM_RTL8192D) ODM_Write_CCK_CCA_Thres_92D(pDM_Odm, CurCCK_CCAThres); else @@ -3473,13 +3473,13 @@ ODM_Write_CCK_CCA_Thres( } pDM_DigTable->PreCCK_CCAThres = pDM_DigTable->CurCCK_CCAThres; pDM_DigTable->CurCCK_CCAThres = CurCCK_CCAThres; - + } //3============================================================ //3 BB Power Save //3============================================================ -VOID +VOID odm_DynamicBBPowerSavingInit( IN PDM_ODM_T pDM_Odm ) @@ -3499,7 +3499,7 @@ VOID odm_DynamicBBPowerSaving( IN PDM_ODM_T pDM_Odm ) -{ +{ #if (DM_ODM_SUPPORT_TYPE & (ODM_MP|ODM_CE)) if ((pDM_Odm->SupportICType != ODM_RTL8192C) && (pDM_Odm->SupportICType != ODM_RTL8723A)) @@ -3508,13 +3508,13 @@ odm_DynamicBBPowerSaving( return; if(!(pDM_Odm->SupportPlatform & (ODM_MP|ODM_CE))) return; - + //1 2.Power Saving for 92C if((pDM_Odm->SupportICType == ODM_RTL8192C) &&(pDM_Odm->RFType == ODM_2T2R)) { odm_1R_CCA(pDM_Odm); } - + // 20100628 Joseph: Turn off BB power save for 88CE because it makesthroughput unstable. // 20100831 Joseph: Turn ON BB power save again after modifying AGC delay from 900ns ot 600ns. //1 3.Power Saving for 88C @@ -3523,26 +3523,26 @@ odm_DynamicBBPowerSaving( ODM_RF_Saving(pDM_Odm, FALSE); } #endif // #if (DM_ODM_SUPPORT_TYPE == ODM_MP) - + } VOID odm_1R_CCA( - IN PDM_ODM_T pDM_Odm + IN PDM_ODM_T pDM_Odm ) { pPS_T pDM_PSTable = &pDM_Odm->DM_PSTable; if(pDM_Odm->RSSI_Min!= 0xFF) { - + if(pDM_PSTable->PreCCAState == CCA_2R) { if(pDM_Odm->RSSI_Min >= 35) pDM_PSTable->CurCCAState = CCA_1R; else pDM_PSTable->CurCCAState = CCA_2R; - + } else{ if(pDM_Odm->RSSI_Min <= 30) @@ -3554,7 +3554,7 @@ odm_1R_CCA( else{ pDM_PSTable->CurCCAState=CCA_MAX; } - + if(pDM_PSTable->PreCCAState != pDM_PSTable->CurCCAState) { if(pDM_PSTable->CurCCAState == CCA_1R) @@ -3582,8 +3582,8 @@ odm_1R_CCA( void ODM_RF_Saving( - IN PDM_ODM_T pDM_Odm, - IN u1Byte bForceInNormal + IN PDM_ODM_T pDM_Odm, + IN u1Byte bForceInNormal ) { #if (DM_ODM_SUPPORT_TYPE != ODM_AP) @@ -3598,7 +3598,7 @@ ODM_RF_Saving( } #endif if(pDM_PSTable->initialize == 0){ - + pDM_PSTable->Reg874 = (ODM_GetBBReg(pDM_Odm, 0x874, bMaskDWord)&0x1CC000)>>14; pDM_PSTable->RegC70 = (ODM_GetBBReg(pDM_Odm, 0xc70, bMaskDWord)&BIT3)>>3; pDM_PSTable->Reg85C = (ODM_GetBBReg(pDM_Odm, 0x85c, bMaskDWord)&0xFF000000)>>24; @@ -3610,7 +3610,7 @@ ODM_RF_Saving( if(!bForceInNormal) { if(pDM_Odm->RSSI_Min != 0xFF) - { + { if(pDM_PSTable->PreRFState == RF_Normal) { if(pDM_Odm->RSSI_Min >= Rssi_Up_bound) @@ -3632,7 +3632,7 @@ ODM_RF_Saving( { pDM_PSTable->CurRFState = RF_Normal; } - + if(pDM_PSTable->PreRFState != pDM_PSTable->CurRFState) { if(pDM_PSTable->CurRFState == RF_Save) @@ -3654,11 +3654,11 @@ ODM_RF_Saving( } else { - ODM_SetBBReg(pDM_Odm, 0x874 , 0x1CC000, pDM_PSTable->Reg874); - ODM_SetBBReg(pDM_Odm, 0xc70, BIT3, pDM_PSTable->RegC70); + ODM_SetBBReg(pDM_Odm, 0x874 , 0x1CC000, pDM_PSTable->Reg874); + ODM_SetBBReg(pDM_Odm, 0xc70, BIT3, pDM_PSTable->RegC70); ODM_SetBBReg(pDM_Odm, 0x85c, 0xFF000000, pDM_PSTable->Reg85C); - ODM_SetBBReg(pDM_Odm, 0xa74, 0xF000, pDM_PSTable->RegA74); - ODM_SetBBReg(pDM_Odm,0x818, BIT28, 0x0); + ODM_SetBBReg(pDM_Odm, 0xa74, 0xF000, pDM_PSTable->RegA74); + ODM_SetBBReg(pDM_Odm,0x818, BIT28, 0x0); if(pDM_Odm->SupportICType == ODM_RTL8723A) { @@ -3668,7 +3668,7 @@ ODM_RF_Saving( } pDM_PSTable->PreRFState =pDM_PSTable->CurRFState; } -#endif +#endif } @@ -3681,28 +3681,28 @@ ODM_RF_Saving( VOID odm_RateAdaptiveMaskInit( - IN PDM_ODM_T pDM_Odm + IN PDM_ODM_T pDM_Odm ) { PODM_RATE_ADAPTIVE pOdmRA = &pDM_Odm->RateAdaptive; #if (DM_ODM_SUPPORT_TYPE == ODM_MP) - PMGNT_INFO pMgntInfo = &pDM_Odm->Adapter->MgntInfo; + PMGNT_INFO pMgntInfo = &pDM_Odm->Adapter->MgntInfo; PRATE_ADAPTIVE pRA = (PRATE_ADAPTIVE)&pMgntInfo->RateAdaptive; pRA->RATRState = DM_RATR_STA_INIT; if (pMgntInfo->DM_Type == DM_Type_ByDriver) pMgntInfo->bUseRAMask = TRUE; else - pMgntInfo->bUseRAMask = FALSE; + pMgntInfo->bUseRAMask = FALSE; #elif (DM_ODM_SUPPORT_TYPE == ODM_CE) pOdmRA->Type = DM_Type_ByDriver; if (pOdmRA->Type == DM_Type_ByDriver) pDM_Odm->bUseRAMask = _TRUE; else - pDM_Odm->bUseRAMask = _FALSE; - + pDM_Odm->bUseRAMask = _FALSE; + #endif pOdmRA->RATRState = DM_RATR_STA_INIT; @@ -3710,7 +3710,7 @@ odm_RateAdaptiveMaskInit( pOdmRA->LowRSSIThresh = 20; } -#if (DM_ODM_SUPPORT_TYPE & ODM_MP) +#if (DM_ODM_SUPPORT_TYPE & ODM_MP) VOID ODM_RateAdaptiveStateApInit( IN struct adapter *Adapter , @@ -3724,39 +3724,39 @@ ODM_RateAdaptiveStateApInit( #if (DM_ODM_SUPPORT_TYPE == ODM_CE) u4Byte ODM_Get_Rate_Bitmap( - IN PDM_ODM_T pDM_Odm, + IN PDM_ODM_T pDM_Odm, IN u4Byte macid, - IN u4Byte ra_mask, - IN u1Byte rssi_level) + IN u4Byte ra_mask, + IN u1Byte rssi_level) { - PSTA_INFO_T pEntry; - u4Byte rate_bitmap = 0x0fffffff; - u1Byte WirelessMode; - //u1Byte WirelessMode =*(pDM_Odm->pWirelessMode); - - + PSTA_INFO_T pEntry; + u4Byte rate_bitmap = 0x0fffffff; + u1Byte WirelessMode; + //u1Byte WirelessMode =*(pDM_Odm->pWirelessMode); + + pEntry = pDM_Odm->pODM_StaInfo[macid]; if(!IS_STA_VALID(pEntry)) return ra_mask; - + WirelessMode = pEntry->wireless_mode; - + switch(WirelessMode) { case ODM_WM_B: - if(ra_mask & 0x0000000c) //11M or 5.5M enable + if(ra_mask & 0x0000000c) //11M or 5.5M enable rate_bitmap = 0x0000000d; else rate_bitmap = 0x0000000f; break; - + case (ODM_WM_A|ODM_WM_G): if(rssi_level == DM_RATR_STA_HIGH) rate_bitmap = 0x00000f00; else rate_bitmap = 0x00000ff0; break; - + case (ODM_WM_B|ODM_WM_G): if(rssi_level == DM_RATR_STA_HIGH) rate_bitmap = 0x00000f00; @@ -3764,12 +3764,12 @@ u4Byte ODM_Get_Rate_Bitmap( rate_bitmap = 0x00000ff0; else rate_bitmap = 0x00000ff5; - break; - + break; + case (ODM_WM_G|ODM_WM_N24G) : case (ODM_WM_B|ODM_WM_G|ODM_WM_N24G) : case (ODM_WM_A|ODM_WM_B|ODM_WM_G|ODM_WM_N24G) : - { + { if ( pDM_Odm->RFType == ODM_1T2R ||pDM_Odm->RFType == ODM_1T1R) { if(rssi_level == DM_RATR_STA_HIGH) @@ -3785,12 +3785,12 @@ u4Byte ODM_Get_Rate_Bitmap( rate_bitmap = 0x000ff015; else rate_bitmap = 0x000ff005; - } + } } else { if(rssi_level == DM_RATR_STA_HIGH) - { + { rate_bitmap = 0x0f8f0000; } else if(rssi_level == DM_RATR_STA_MIDDLE) @@ -3803,18 +3803,18 @@ u4Byte ODM_Get_Rate_Bitmap( rate_bitmap = 0x0f8ff015; else rate_bitmap = 0x0f8ff005; - } + } } } break; default: //case WIRELESS_11_24N: - //case WIRELESS_11_5N: + //case WIRELESS_11_5N: if(pDM_Odm->RFType == RF_1T2R) rate_bitmap = 0x000fffff; else rate_bitmap = 0x0fffffff; - break; + break; } @@ -3822,8 +3822,8 @@ u4Byte ODM_Get_Rate_Bitmap( ODM_RT_TRACE(pDM_Odm, ODM_COMP_RA_MASK, ODM_DBG_LOUD, (" ==> rssi_level:0x%02x, WirelessMode:0x%02x, rate_bitmap:0x%08x \n",rssi_level,WirelessMode,rate_bitmap)); return rate_bitmap; - -} + +} #endif /*----------------------------------------------------------------------------- @@ -3839,7 +3839,7 @@ u4Byte ODM_Get_Rate_Bitmap( * * Revised History: * When Who Remark - * 05/27/2009 hpfan Create Version 0. + * 05/27/2009 hpfan Create Version 0. * *---------------------------------------------------------------------------*/ VOID @@ -3848,7 +3848,7 @@ odm_RefreshRateAdaptiveMask( ) { if (!(pDM_Odm->SupportAbility & ODM_BB_RA_MASK)) - return; + return; // // 2011/09/29 MH In HW integration first stage, we provide 4 different handle to operate // at the same time. In the stage2/3, we need to prive universal interface and merge all @@ -3869,12 +3869,12 @@ odm_RefreshRateAdaptiveMask( odm_RefreshRateAdaptiveMaskAPADSL(pDM_Odm); break; } - + } VOID odm_RefreshRateAdaptiveMaskMP( - IN PDM_ODM_T pDM_Odm + IN PDM_ODM_T pDM_Odm ) { #if (DM_ODM_SUPPORT_TYPE == ODM_MP) @@ -3938,7 +3938,7 @@ odm_RefreshRateAdaptiveMaskMP( for(i = 0; i < ODM_ASSOCIATE_ENTRY_NUM; i++) { -#if 0 //By YJ,120208 +#if 0 //By YJ,120208 if( pTargetAdapter->MgntInfo.AsocEntry[i].bUsed && pTargetAdapter->MgntInfo.AsocEntry[i].bAssociated) { pEntry = pTargetAdapter->MgntInfo.AsocEntry+i; @@ -3979,24 +3979,24 @@ odm_RefreshRateAdaptiveMaskMP( } } } -#endif +#endif } } if(pMgntInfo->bSetTXPowerTrainingByOid) - pMgntInfo->bSetTXPowerTrainingByOid = FALSE; + pMgntInfo->bSetTXPowerTrainingByOid = FALSE; #endif // #if (DM_ODM_SUPPORT_TYPE == ODM_MP) } VOID odm_RefreshRateAdaptiveMaskCE( - IN PDM_ODM_T pDM_Odm + IN PDM_ODM_T pDM_Odm ) { #if (DM_ODM_SUPPORT_TYPE == ODM_CE) u1Byte i; - struct adapter *pAdapter = pDM_Odm->Adapter; + struct adapter *pAdapter = pDM_Odm->Adapter; if(pAdapter->bDriverStopped) { @@ -4023,10 +4023,10 @@ odm_RefreshRateAdaptiveMaskCE( //printk("RSSI:%d, RSSI_LEVEL:%d\n", pstat->rssi_stat.UndecoratedSmoothedPWDB, pstat->rssi_level); rtw_hal_update_ra_mask(pstat, pstat->rssi_level); } - + } - } - + } + #endif } @@ -4039,7 +4039,7 @@ odm_RefreshRateAdaptiveMaskAPADSL( struct rtl8192cd_priv *priv = pDM_Odm->priv; struct stat_info *pstat; - if (!priv->pmib->dot11StationConfigEntry.autoRate) + if (!priv->pmib->dot11StationConfigEntry.autoRate) return; if (list_empty(&priv->asoc_list)) @@ -4062,7 +4062,7 @@ odm_RefreshRateAdaptiveMaskAPADSL( // Return Value: BOOLEAN // - TRUE: RATRState is changed. -BOOLEAN +BOOLEAN ODM_RAStateCheck( IN PDM_ODM_T pDM_Odm, IN s4Byte RSSI, @@ -4076,7 +4076,7 @@ ODM_RAStateCheck( u1Byte LowRSSIThreshForRA = pRA->LowRSSIThresh; u1Byte RATRState; - // Threshold Adjustment: + // Threshold Adjustment: // when RSSI state trends to go up one or two levels, make sure RSSI is high enough. // Here GoUpGap is added to solve the boundary's level alternation issue. switch (*pRATRState) @@ -4094,7 +4094,7 @@ ODM_RAStateCheck( LowRSSIThreshForRA += GoUpGap; break; - default: + default: ODM_RT_ASSERT(pDM_Odm, FALSE, ("wrong rssi level setting %d !", *pRATRState) ); break; } @@ -4125,9 +4125,9 @@ ODM_RAStateCheck( //3 Dynamic Tx Power //3============================================================ -VOID +VOID odm_DynamicTxPowerInit( - IN PDM_ODM_T pDM_Odm + IN PDM_ODM_T pDM_Odm ) { #if (DM_ODM_SUPPORT_TYPE == ODM_MP) @@ -4135,13 +4135,13 @@ odm_DynamicTxPowerInit( PMGNT_INFO pMgntInfo = &Adapter->MgntInfo; HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); - #if DEV_BUS_TYPE==RT_USB_INTERFACE + #if DEV_BUS_TYPE==RT_USB_INTERFACE if(RT_GetInterfaceSelection(Adapter) == INTF_SEL1_USB_High_Power) { odm_DynamicTxPowerSavePowerIndex(pDM_Odm); pMgntInfo->bDynamicTxPowerEnable = TRUE; - } - else + } + else #else //so 92c pci do not need dynamic tx power? vivi check it later if(IS_HARDWARE_TYPE_8192D(Adapter)) @@ -4149,7 +4149,7 @@ odm_DynamicTxPowerInit( else pMgntInfo->bDynamicTxPowerEnable = FALSE; #endif - + pHalData->LastDTPLvl = TxHighPwrLevel_Normal; pHalData->DynamicTxHighPowerLvl = TxHighPwrLevel_Normal; @@ -4159,7 +4159,7 @@ odm_DynamicTxPowerInit( struct dm_priv *pdmpriv = &pHalData->dmpriv; pdmpriv->bDynamicTxPowerEnable = _FALSE; - #if (RTL8192C_SUPPORT==1) + #if (RTL8192C_SUPPORT==1) #ifdef CONFIG_USB_HCI #ifdef CONFIG_INTEL_PROXIM @@ -4172,34 +4172,34 @@ odm_DynamicTxPowerInit( //odm_SavePowerIndex(Adapter); odm_DynamicTxPowerSavePowerIndex(pDM_Odm); pdmpriv->bDynamicTxPowerEnable = _TRUE; - } - else + } + else #else pdmpriv->bDynamicTxPowerEnable = _FALSE; #endif #endif - + pdmpriv->LastDTPLvl = TxHighPwrLevel_Normal; - pdmpriv->DynamicTxHighPowerLvl = TxHighPwrLevel_Normal; - + pdmpriv->DynamicTxHighPowerLvl = TxHighPwrLevel_Normal; + #endif - + } VOID odm_DynamicTxPowerSavePowerIndex( - IN PDM_ODM_T pDM_Odm + IN PDM_ODM_T pDM_Odm ) -{ +{ u1Byte index; u4Byte Power_Index_REG[6] = {0xc90, 0xc91, 0xc92, 0xc98, 0xc99, 0xc9a}; - -#if (DM_ODM_SUPPORT_TYPE == ODM_MP) + +#if (DM_ODM_SUPPORT_TYPE == ODM_MP) struct adapter *Adapter = pDM_Odm->Adapter; - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); for(index = 0; index< 6; index++) pHalData->PowerIndex_backup[index] = PlatformEFIORead1Byte(Adapter, Power_Index_REG[index]); -#elif (DM_ODM_SUPPORT_TYPE == ODM_CE) +#elif (DM_ODM_SUPPORT_TYPE == ODM_CE) struct adapter *Adapter = pDM_Odm->Adapter; HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); struct dm_priv *pdmpriv = &pHalData->dmpriv; @@ -4222,7 +4222,7 @@ odm_DynamicTxPowerRestorePowerIndex( #if (DM_ODM_SUPPORT_TYPE == ODM_MP) for(index = 0; index< 6; index++) PlatformEFIOWrite1Byte(Adapter, Power_Index_REG[index], pHalData->PowerIndex_backup[index]); -#elif(DM_ODM_SUPPORT_TYPE == ODM_CE) +#elif(DM_ODM_SUPPORT_TYPE == ODM_CE) struct dm_priv *pdmpriv = &pHalData->dmpriv; for(index = 0; index< 6; index++) rtw_write8(Adapter, Power_Index_REG[index], pdmpriv->PowerIndex_backup[index]); @@ -4232,13 +4232,13 @@ odm_DynamicTxPowerRestorePowerIndex( VOID odm_DynamicTxPowerWritePowerIndex( - IN PDM_ODM_T pDM_Odm, - IN u1Byte Value) + IN PDM_ODM_T pDM_Odm, + IN u1Byte Value) { u1Byte index; u4Byte Power_Index_REG[6] = {0xc90, 0xc91, 0xc92, 0xc98, 0xc99, 0xc9a}; - + for(index = 0; index< 6; index++) //PlatformEFIOWrite1Byte(Adapter, Power_Index_REG[index], Value); ODM_Write1Byte(pDM_Odm, Power_Index_REG[index], Value); @@ -4246,12 +4246,12 @@ odm_DynamicTxPowerWritePowerIndex( } -VOID +VOID odm_DynamicTxPower( IN PDM_ODM_T pDM_Odm ) { - // + // // For AP/ADSL use prtl8192cd_priv // For CE/NIC use PADAPTER // @@ -4264,7 +4264,7 @@ odm_DynamicTxPower( // 2012/01/12 MH According to Luke's suggestion, only high power will support the feature. if (pDM_Odm->ExtPA == FALSE) return; - + // // 2011/09/29 MH In HW integration first stage, we provide 4 different handle to operate @@ -4276,31 +4276,31 @@ odm_DynamicTxPower( case ODM_MP: case ODM_CE: odm_DynamicTxPowerNIC(pDM_Odm); - break; + break; case ODM_AP: odm_DynamicTxPowerAP(pDM_Odm); - break; + break; case ODM_ADSL: //odm_DIGAP(pDM_Odm); - break; + break; } - + } -VOID +VOID odm_DynamicTxPowerNIC( IN PDM_ODM_T pDM_Odm ) -{ +{ if (!(pDM_Odm->SupportAbility & ODM_BB_DYNAMIC_TXPWR)) return; - + #if (DM_ODM_SUPPORT_TYPE & (ODM_MP|ODM_CE)) - if(pDM_Odm->SupportICType == ODM_RTL8192C) + if(pDM_Odm->SupportICType == ODM_RTL8192C) { odm_DynamicTxPower_92C(pDM_Odm); } @@ -4317,26 +4317,26 @@ odm_DynamicTxPowerNIC( // ??? // This part need to be redefined. } -#endif +#endif } -VOID +VOID odm_DynamicTxPowerAP( IN PDM_ODM_T pDM_Odm ) -{ +{ #if (DM_ODM_SUPPORT_TYPE == ODM_AP) prtl8192cd_priv priv = pDM_Odm->priv; s4Byte i; if(!priv->pshare->rf_ft_var.tx_pwr_ctrl) return; - + #ifdef HIGH_POWER_EXT_PA if(pDM_Odm->ExtPA) tx_power_control(priv); -#endif +#endif /* * Check if station is near by to use lower tx power @@ -4354,11 +4354,11 @@ odm_DynamicTxPowerAP( } } -#endif +#endif } -VOID +VOID odm_DynamicTxPower_92C( IN PDM_ODM_T pDM_Odm ) @@ -4371,13 +4371,13 @@ odm_DynamicTxPower_92C( // STA not connected and AP not connected - if((!pMgntInfo->bMediaConnect) && + if((!pMgntInfo->bMediaConnect) && (pHalData->EntryMinUndecoratedSmoothedPWDB == 0)) { ODM_RT_TRACE(pDM_Odm,COMP_HIPWR, DBG_LOUD, ("Not connected to any \n")); pHalData->DynamicTxHighPowerLvl = TxHighPwrLevel_Normal; - //the LastDTPlvl should reset when disconnect, + //the LastDTPlvl should reset when disconnect, //otherwise the tx power level wouldn't change when disconnect and connect again. // Maddest 20091220. pHalData->LastDTPLvl=TxHighPwrLevel_Normal; @@ -4385,7 +4385,7 @@ odm_DynamicTxPower_92C( } #if (INTEL_PROXIMITY_SUPPORT == 1) - // Intel set fixed tx power + // Intel set fixed tx power if(pMgntInfo->IntelProximityModeInfo.PowerOutput > 0) { switch(pMgntInfo->IntelProximityModeInfo.PowerOutput){ @@ -4413,11 +4413,11 @@ odm_DynamicTxPower_92C( pHalData->DynamicTxHighPowerLvl = TxHighPwrLevel_100; ODM_RT_TRACE(pDM_Odm,COMP_HIPWR, DBG_LOUD, ("TxHighPwrLevel_100\n")); break; - } + } } else -#endif - { +#endif + { if( (pMgntInfo->bDynamicTxPowerEnable != TRUE) || (pHalData->DMFlag & HAL_DM_HIPWR_DISABLE) || pMgntInfo->IOTAction & HT_IOT_ACT_DISABLE_HIGH_POWER) @@ -4440,11 +4440,11 @@ odm_DynamicTxPower_92C( } } else // associated entry pwdb - { + { UndecoratedSmoothedPWDB = pHalData->EntryMinUndecoratedSmoothedPWDB; ODM_RT_TRACE(pDM_Odm,COMP_HIPWR, DBG_LOUD, ("AP Ext Port PWDB = 0x%x \n", UndecoratedSmoothedPWDB)); } - + if(UndecoratedSmoothedPWDB >= TX_POWER_NEAR_FIELD_THRESH_LVL2) { pHalData->DynamicTxHighPowerLvl = TxHighPwrLevel_Level2; @@ -4477,10 +4477,10 @@ odm_DynamicTxPower_92C( } pHalData->LastDTPLvl = pHalData->DynamicTxHighPowerLvl; - + #elif (DM_ODM_SUPPORT_TYPE == ODM_CE) - #if (RTL8192C_SUPPORT==1) + #if (RTL8192C_SUPPORT==1) struct adapter *Adapter = pDM_Odm->Adapter; HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); struct dm_priv *pdmpriv = &pHalData->dmpriv; @@ -4494,10 +4494,10 @@ odm_DynamicTxPower_92C( #ifdef CONFIG_INTEL_PROXIM if(Adapter->proximity.proxim_on== _TRUE){ struct proximity_priv *prox_priv=Adapter->proximity.proximity_priv; - // Intel set fixed tx power + // Intel set fixed tx power printk("\n %s Adapter->proximity.proxim_on=%d prox_priv->proxim_modeinfo->power_output=%d \n",__FUNCTION__,Adapter->proximity.proxim_on,prox_priv->proxim_modeinfo->power_output); if(prox_priv!=NULL){ - if(prox_priv->proxim_modeinfo->power_output> 0) + if(prox_priv->proxim_modeinfo->power_output> 0) { switch(prox_priv->proxim_modeinfo->power_output) { @@ -4525,27 +4525,27 @@ odm_DynamicTxPower_92C( pdmpriv->DynamicTxHighPowerLvl = TxHighPwrLevel_100; printk("TxHighPwrLevel_100\n"); break; - } + } } } } else -#endif +#endif { // STA not connected and AP not connected - if((check_fwstate(pmlmepriv, _FW_LINKED) != _TRUE) && + if((check_fwstate(pmlmepriv, _FW_LINKED) != _TRUE) && (pdmpriv->EntryMinUndecoratedSmoothedPWDB == 0)) { //ODM_RT_TRACE(pDM_Odm,COMP_HIPWR, DBG_LOUD, ("Not connected to any \n")); pdmpriv->DynamicTxHighPowerLvl = TxHighPwrLevel_Normal; - //the LastDTPlvl should reset when disconnect, + //the LastDTPlvl should reset when disconnect, //otherwise the tx power level wouldn't change when disconnect and connect again. // Maddest 20091220. pdmpriv->LastDTPLvl=TxHighPwrLevel_Normal; return; } - + if(check_fwstate(pmlmepriv, _FW_LINKED) == _TRUE) // Default port { #if 0 @@ -4562,15 +4562,15 @@ odm_DynamicTxPower_92C( //ODM_RT_TRACE(pDM_Odm,COMP_HIPWR, DBG_LOUD, ("STA Default Port PWDB = 0x%x \n", UndecoratedSmoothedPWDB)); } #else - UndecoratedSmoothedPWDB = pdmpriv->EntryMinUndecoratedSmoothedPWDB; + UndecoratedSmoothedPWDB = pdmpriv->EntryMinUndecoratedSmoothedPWDB; #endif } else // associated entry pwdb - { + { UndecoratedSmoothedPWDB = pdmpriv->EntryMinUndecoratedSmoothedPWDB; //ODM_RT_TRACE(pDM_Odm,COMP_HIPWR, DBG_LOUD, ("AP Ext Port PWDB = 0x%x \n", UndecoratedSmoothedPWDB)); } - + if(UndecoratedSmoothedPWDB >= TX_POWER_NEAR_FIELD_THRESH_LVL2) { pdmpriv->DynamicTxHighPowerLvl = TxHighPwrLevel_Level2; @@ -4605,7 +4605,7 @@ odm_DynamicTxPower_92C( } -VOID +VOID odm_DynamicTxPower_92D( IN PDM_ODM_T pDM_Odm ) @@ -4631,19 +4631,19 @@ odm_DynamicTxPower_92D( } // STA not connected and AP not connected - if((!pMgntInfo->bMediaConnect) && + if((!pMgntInfo->bMediaConnect) && (pHalData->EntryMinUndecoratedSmoothedPWDB == 0)) { ODM_RT_TRACE(pDM_Odm,COMP_HIPWR, DBG_LOUD, ("Not connected to any \n")); pHalData->DynamicTxHighPowerLvl = TxHighPwrLevel_Normal; - //the LastDTPlvl should reset when disconnect, + //the LastDTPlvl should reset when disconnect, //otherwise the tx power level wouldn't change when disconnect and connect again. // Maddest 20091220. pHalData->LastDTPLvl=TxHighPwrLevel_Normal; return; } - + if(pMgntInfo->bMediaConnect) // Default port { if(ACTING_AS_AP(Adapter) || pMgntInfo->mIbss) @@ -4658,11 +4658,11 @@ odm_DynamicTxPower_92D( } } else // associated entry pwdb - { + { UndecoratedSmoothedPWDB = pHalData->EntryMinUndecoratedSmoothedPWDB; ODM_RT_TRACE(pDM_Odm,COMP_HIPWR, DBG_LOUD, ("AP Ext Port PWDB = 0x%x \n", UndecoratedSmoothedPWDB)); } - + if(IS_HARDWARE_TYPE_8192D(Adapter) && GET_HAL_DATA(Adapter)->CurrentBandType92D == 1){ if(UndecoratedSmoothedPWDB >= 0x33) { @@ -4683,7 +4683,7 @@ odm_DynamicTxPower_92D( } else - + { if(UndecoratedSmoothedPWDB >= TX_POWER_NEAR_FIELD_THRESH_LVL2) { @@ -4716,7 +4716,7 @@ odm_DynamicTxPower_92D( PHY_SetTxPowerLevel8192C(Adapter, pHalData->CurrentChannel); pHalData->DynamicTxHighPowerLvl = HighPowerLvlBackForMac0; Adapter->DualMacDMSPControl.bChangeTxHighPowerLvlForAnotherMacOfDMSP = FALSE; - } + } } if( (pHalData->DynamicTxHighPowerLvl != pHalData->LastDTPLvl) ) @@ -4745,7 +4745,7 @@ odm_DynamicTxPower_92D( } else { - ODM_RT_TRACE(pDM_Odm,COMP_MLME,DBG_LOUD,("dm_DynamicTxPower() master case \n")); + ODM_RT_TRACE(pDM_Odm,COMP_MLME,DBG_LOUD,("dm_DynamicTxPower() master case \n")); if(!bGetValueFromBuddyAdapter) { ODM_RT_TRACE(pDM_Odm,COMP_MLME,DBG_LOUD,("dm_DynamicTxPower() mac 0 for mac 0 \n")); @@ -4768,13 +4768,13 @@ odm_DynamicTxPower_92D( } pHalData->LastDTPLvl = pHalData->DynamicTxHighPowerLvl; #elif (DM_ODM_SUPPORT_TYPE == ODM_CE) -#if (RTL8192D_SUPPORT==1) +#if (RTL8192D_SUPPORT==1) struct adapter *Adapter = pDM_Odm->Adapter; HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); struct mlme_priv *pmlmepriv = &(Adapter->mlmepriv); struct dm_priv *pdmpriv = &pHalData->dmpriv; - DM_ODM_T *podmpriv = &pHalData->odmpriv; + DM_ODM_T *podmpriv = &pHalData->odmpriv; int UndecoratedSmoothedPWDB; #if (RTL8192D_EASY_SMART_CONCURRENT == 1) struct adapter *BuddyAdapter = Adapter->BuddyAdapter; @@ -4791,18 +4791,18 @@ odm_DynamicTxPower_92D( } // STA not connected and AP not connected - if((check_fwstate(pmlmepriv, _FW_LINKED) != _TRUE) && + if((check_fwstate(pmlmepriv, _FW_LINKED) != _TRUE) && (pdmpriv->EntryMinUndecoratedSmoothedPWDB == 0)) { //ODM_RT_TRACE(pDM_Odm,COMP_HIPWR, DBG_LOUD, ("Not connected to any \n")); pdmpriv->DynamicTxHighPowerLvl = TxHighPwrLevel_Normal; - //the LastDTPlvl should reset when disconnect, + //the LastDTPlvl should reset when disconnect, //otherwise the tx power level wouldn't change when disconnect and connect again. // Maddest 20091220. pdmpriv->LastDTPLvl=TxHighPwrLevel_Normal; return; } - + if(check_fwstate(pmlmepriv, _FW_LINKED) == _TRUE) // Default port { #if 0 @@ -4823,7 +4823,7 @@ odm_DynamicTxPower_92D( #endif } else // associated entry pwdb - { + { UndecoratedSmoothedPWDB = pdmpriv->EntryMinUndecoratedSmoothedPWDB; //ODM_RT_TRACE(pDM_Odm,COMP_HIPWR, DBG_LOUD, ("AP Ext Port PWDB = 0x%x \n", UndecoratedSmoothedPWDB)); } @@ -4878,7 +4878,7 @@ odm_DynamicTxPower_92D( PHY_SetTxPowerLevel8192D(Adapter, pHalData->CurrentChannel); pHalData->DynamicTxHighPowerLvl = HighPowerLvlBackForMac0; Adapter->DualMacDMSPControl.bChangeTxHighPowerLvlForAnotherMacOfDMSP = _FALSE; - } + } } #endif @@ -4907,7 +4907,7 @@ odm_DynamicTxPower_92D( } else { - //ODM_RT_TRACE(pDM_Odm,COMP_MLME,DBG_LOUD,("dm_DynamicTxPower() master case \n")); + //ODM_RT_TRACE(pDM_Odm,COMP_MLME,DBG_LOUD,("dm_DynamicTxPower() master case \n")); if(!bGetValueFromBuddyAdapter) { //ODM_RT_TRACE(pDM_Odm,COMP_MLME,DBG_LOUD,("dm_DynamicTxPower() mac 0 for mac 0 \n")); @@ -4926,7 +4926,7 @@ odm_DynamicTxPower_92D( #endif } pdmpriv->LastDTPLvl = pdmpriv->DynamicTxHighPowerLvl; -#endif +#endif #endif // #if (DM_ODM_SUPPORT_TYPE == ODM_MP) } @@ -4948,7 +4948,7 @@ odm_RSSIMonitorCheck( IN PDM_ODM_T pDM_Odm ) { - // + // // For AP/ADSL use prtl8192cd_priv // For CE/NIC use PADAPTER // @@ -4957,7 +4957,7 @@ odm_RSSIMonitorCheck( if (!(pDM_Odm->SupportAbility & ODM_BB_RSSI_MONITOR)) return; - + // // 2011/09/29 MH In HW integration first stage, we provide 4 different handle to operate // at the same time. In the stage2/3, we need to prive universal interface and merge all @@ -4975,13 +4975,13 @@ odm_RSSIMonitorCheck( case ODM_AP: odm_RSSIMonitorCheckAP(pDM_Odm); - break; + break; case ODM_ADSL: //odm_DIGAP(pDM_Odm); - break; + break; } - + } // odm_RSSIMonitorCheck @@ -4997,7 +4997,7 @@ odm_RSSIMonitorCheckMP( u1Byte i; s4Byte tmpEntryMaxPWDB=0, tmpEntryMinPWDB=0xff; - RTPRINT(FDM, DM_PWDB, ("pHalData->UndecoratedSmoothedPWDB = 0x%x( %d)\n", + RTPRINT(FDM, DM_PWDB, ("pHalData->UndecoratedSmoothedPWDB = 0x%x( %d)\n", pHalData->UndecoratedSmoothedPWDB, pHalData->UndecoratedSmoothedPWDB)); @@ -5017,7 +5017,7 @@ odm_RSSIMonitorCheckMP( if(pEntry->bAssociated) { RTPRINT_ADDR(FDM, DM_PWDB, ("pEntry->MacAddr ="), pEntry->MacAddr); - RTPRINT(FDM, DM_PWDB, ("pEntry->rssi = 0x%x(%d)\n", + RTPRINT(FDM, DM_PWDB, ("pEntry->rssi = 0x%x(%d)\n", pEntry->rssi_stat.UndecoratedSmoothedPWDB, pEntry->rssi_stat.UndecoratedSmoothedPWDB)); if(pEntry->rssi_stat.UndecoratedSmoothedPWDB < tmpEntryMinPWDB) @@ -5035,7 +5035,7 @@ odm_RSSIMonitorCheckMP( if(tmpEntryMaxPWDB != 0) // If associated entry is found { pHalData->EntryMaxUndecoratedSmoothedPWDB = tmpEntryMaxPWDB; - RTPRINT(FDM, DM_PWDB, ("EntryMaxPWDB = 0x%x(%d)\n", + RTPRINT(FDM, DM_PWDB, ("EntryMaxPWDB = 0x%x(%d)\n", tmpEntryMaxPWDB, tmpEntryMaxPWDB)); } else @@ -5045,7 +5045,7 @@ odm_RSSIMonitorCheckMP( if(tmpEntryMinPWDB != 0xff) // If associated entry is found { pHalData->EntryMinUndecoratedSmoothedPWDB = tmpEntryMinPWDB; - RTPRINT(FDM, DM_PWDB, ("EntryMinPWDB = 0x%x(%d)\n", + RTPRINT(FDM, DM_PWDB, ("EntryMinPWDB = 0x%x(%d)\n", tmpEntryMinPWDB, tmpEntryMinPWDB)); } else @@ -5108,7 +5108,7 @@ FindMinimumRSSI_Dmsp( } } } - + } if(bRestoreRssi) @@ -5123,12 +5123,12 @@ static void FindMinimumRSSI( IN struct adapter *pAdapter ) -{ +{ HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter); struct dm_priv *pdmpriv = &pHalData->dmpriv; PDM_ODM_T pDM_Odm = &(pHalData->odmpriv); - //1 1.Determine the minimum RSSI + //1 1.Determine the minimum RSSI if((pDM_Odm->bLinked != _TRUE) && (pdmpriv->EntryMinUndecoratedSmoothedPWDB == 0)) @@ -5157,7 +5157,7 @@ odm_RSSIMonitorCheckCE( struct dm_priv *pdmpriv = &pHalData->dmpriv; int i; int tmpEntryMaxPWDB=0, tmpEntryMinPWDB=0xff; - u8 sta_cnt=0; + u8 sta_cnt=0; u32 PWDB_rssi[NUM_STA]={0};//[0~15]:MACID, [16~31]:PWDB_rssi if(pDM_Odm->bLinked != _TRUE) @@ -5167,14 +5167,14 @@ odm_RSSIMonitorCheckCE( { #if 1 struct sta_info *psta; - - for(i=0; ipODM_StaInfo[i])) { - if(IS_MCAST( psta->hwaddr)) //if(psta->mac_id ==1) + if(IS_MCAST( psta->hwaddr)) //if(psta->mac_id ==1) continue; - + if(psta->rssi_stat.UndecoratedSmoothedPWDB < tmpEntryMinPWDB) tmpEntryMinPWDB = psta->rssi_stat.UndecoratedSmoothedPWDB; @@ -5208,20 +5208,20 @@ odm_RSSIMonitorCheckCE( { phead = &(pstapriv->sta_hash[i]); plist = get_next(phead); - + while ((rtw_end_of_queue_search(phead, plist)) == _FALSE) { psta = LIST_CONTAINOR(plist, struct sta_info, hash_list); plist = get_next(plist); - if(_rtw_memcmp(psta->hwaddr, bcast_addr, ETH_ALEN) || + if(_rtw_memcmp(psta->hwaddr, bcast_addr, ETH_ALEN) || _rtw_memcmp(psta->hwaddr, myid(&Adapter->eeprompriv), ETH_ALEN)) continue; if(psta->state & WIFI_ASOC_STATE) { - + if(psta->rssi_stat.UndecoratedSmoothedPWDB < tmpEntryMinPWDB) tmpEntryMinPWDB = psta->rssi_stat.UndecoratedSmoothedPWDB; @@ -5237,11 +5237,11 @@ odm_RSSIMonitorCheckCE( #endif } } - + } } - + _exit_critical_bh(&pstapriv->sta_hash_lock, &irqL); #endif @@ -5251,11 +5251,11 @@ odm_RSSIMonitorCheckCE( { if(PWDB_rssi[i] != (0)){ if(pHalData->fw_ractrl == _TRUE)// Report every sta's RSSI to FW - { + { #if(RTL8192D_SUPPORT==1) - FillH2CCmd92D(Adapter, H2C_RSSI_REPORT, 3, (u8 *)(&PWDB_rssi[i])); + FillH2CCmd92D(Adapter, H2C_RSSI_REPORT, 3, (u8 *)(&PWDB_rssi[i])); #elif((RTL8192C_SUPPORT==1)||(RTL8723A_SUPPORT==1)) - rtl8192c_set_rssi_cmd(Adapter, (u8*)&PWDB_rssi[i]); + rtl8192c_set_rssi_cmd(Adapter, (u8*)&PWDB_rssi[i]); #endif } else{ @@ -5265,12 +5265,12 @@ odm_RSSIMonitorCheckCE( #endif } } - } + } } if(tmpEntryMaxPWDB != 0) // If associated entry is found { - pdmpriv->EntryMaxUndecoratedSmoothedPWDB = tmpEntryMaxPWDB; + pdmpriv->EntryMaxUndecoratedSmoothedPWDB = tmpEntryMaxPWDB; } else { @@ -5279,7 +5279,7 @@ odm_RSSIMonitorCheckCE( if(tmpEntryMinPWDB != 0xff) // If associated entry is found { - pdmpriv->EntryMinUndecoratedSmoothedPWDB = tmpEntryMinPWDB; + pdmpriv->EntryMinUndecoratedSmoothedPWDB = tmpEntryMinPWDB; } else { @@ -5306,9 +5306,9 @@ odm_RSSIMonitorCheckAP( VOID ODM_InitAllTimers( - IN PDM_ODM_T pDM_Odm + IN PDM_ODM_T pDM_Odm ) -{ +{ ODM_InitializeTimer(pDM_Odm,&pDM_Odm->DM_SWAT_Table.SwAntennaSwitchTimer, (RT_TIMER_CALL_BACK)odm_SwAntDivChkAntSwitchCallback, NULL, "SwAntennaSwitchTimer"); @@ -5322,35 +5322,35 @@ ODM_InitAllTimers( #endif #if (DM_ODM_SUPPORT_TYPE == ODM_MP) - ODM_InitializeTimer(pDM_Odm, &pDM_Odm->PSDTimer, + ODM_InitializeTimer(pDM_Odm, &pDM_Odm->PSDTimer, (RT_TIMER_CALL_BACK)dm_PSDMonitorCallback, NULL, "PSDTimer"); // //Path Diversity //Neil Chen--2011--06--16-- / 2012/02/23 MH Revise Arch. // - ODM_InitializeTimer(pDM_Odm, &pDM_Odm->PathDivSwitchTimer, + ODM_InitializeTimer(pDM_Odm, &pDM_Odm->PathDivSwitchTimer, (RT_TIMER_CALL_BACK)odm_PathDivChkAntSwitchCallback, NULL, "PathDivTimer"); - ODM_InitializeTimer(pDM_Odm, &pDM_Odm->CCKPathDiversityTimer, + ODM_InitializeTimer(pDM_Odm, &pDM_Odm->CCKPathDiversityTimer, (RT_TIMER_CALL_BACK)odm_CCKTXPathDiversityCallback, NULL, "CCKPathDiversityTimer"); ODM_InitializeTimer(pDM_Odm, &pDM_Odm->DM_RXHP_Table.PSDTimer, - (RT_TIMER_CALL_BACK)odm_PSD_RXHPCallback, NULL, "PSDRXHPTimer"); -#endif + (RT_TIMER_CALL_BACK)odm_PSD_RXHPCallback, NULL, "PSDRXHPTimer"); +#endif } VOID ODM_CancelAllTimers( - IN PDM_ODM_T pDM_Odm + IN PDM_ODM_T pDM_Odm ) { #if (DM_ODM_SUPPORT_TYPE == ODM_MP) // - // 2012/01/12 MH Temp BSOD fix. We need to find NIC allocate mem fail reason in + // 2012/01/12 MH Temp BSOD fix. We need to find NIC allocate mem fail reason in // win7 platform. // HAL_ADAPTER_STS_CHK(pDM_Odm) -#endif +#endif ODM_CancelTimer(pDM_Odm,&pDM_Odm->DM_SWAT_Table.SwAntennaSwitchTimer); @@ -5359,7 +5359,7 @@ ODM_CancelAllTimers( #if (RTL8188E_SUPPORT == 1) ODM_CancelTimer(pDM_Odm,&pDM_Odm->FastAntTrainingTimer); #endif - ODM_CancelTimer(pDM_Odm, &pDM_Odm->PSDTimer); + ODM_CancelTimer(pDM_Odm, &pDM_Odm->PSDTimer); // //Path Diversity //Neil Chen--2011--06--16-- / 2012/02/23 MH Revise Arch. @@ -5369,13 +5369,13 @@ ODM_CancelAllTimers( ODM_CancelTimer(pDM_Odm, &pDM_Odm->CCKPathDiversityTimer); ODM_CancelTimer(pDM_Odm, &pDM_Odm->DM_RXHP_Table.PSDTimer); -#endif +#endif } VOID ODM_ReleaseAllTimers( - IN PDM_ODM_T pDM_Odm + IN PDM_ODM_T pDM_Odm ) { ODM_ReleaseTimer(pDM_Odm,&pDM_Odm->DM_SWAT_Table.SwAntennaSwitchTimer); @@ -5395,8 +5395,8 @@ ODM_ReleaseAllTimers( ODM_ReleaseTimer(pDM_Odm, &pDM_Odm->CCKPathDiversityTimer); - ODM_ReleaseTimer(pDM_Odm, &pDM_Odm->DM_RXHP_Table.PSDTimer); -#endif + ODM_ReleaseTimer(pDM_Odm, &pDM_Odm->DM_RXHP_Table.PSDTimer); +#endif } @@ -5408,28 +5408,28 @@ ODM_ReleaseAllTimers( VOID odm_TXPowerTrackingInit( - IN PDM_ODM_T pDM_Odm + IN PDM_ODM_T pDM_Odm ) { odm_TXPowerTrackingThermalMeterInit(pDM_Odm); -} +} VOID odm_TXPowerTrackingThermalMeterInit( - IN PDM_ODM_T pDM_Odm + IN PDM_ODM_T pDM_Odm ) -{ +{ #if (DM_ODM_SUPPORT_TYPE == ODM_MP) struct adapter * Adapter = pDM_Odm->Adapter; - PMGNT_INFO pMgntInfo = &Adapter->MgntInfo; + PMGNT_INFO pMgntInfo = &Adapter->MgntInfo; HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); pMgntInfo->bTXPowerTracking = TRUE; pHalData->TXPowercount = 0; pHalData->bTXPowerTrackingInit = FALSE; #if MP_DRIVER != 1 //for mp driver, turn off txpwrtracking as default - pHalData->TxPowerTrackControl = TRUE; + pHalData->TxPowerTrackControl = TRUE; #endif//#if (MP_DRIVER != 1) ODM_RT_TRACE(pDM_Odm,COMP_POWER_TRACKING, DBG_LOUD, ("pMgntInfo->bTXPowerTracking = %d\n", pMgntInfo->bTXPowerTracking)); #elif (DM_ODM_SUPPORT_TYPE == ODM_CE) @@ -5454,21 +5454,21 @@ odm_TXPowerTrackingThermalMeterInit( #endif #endif - pDM_Odm->RFCalibrateInfo.TxPowerTrackControl = TRUE; + pDM_Odm->RFCalibrateInfo.TxPowerTrackControl = TRUE; pDM_Odm->RFCalibrateInfo.DeltaPowerIndex = 0; pDM_Odm->RFCalibrateInfo.DeltaPowerIndexLast = 0; pDM_Odm->RFCalibrateInfo.PowerIndexOffset = 0; pDM_Odm->RFCalibrateInfo.ThermalValue = 0; pDM_Odm->DefaultOfdmIndex = 12; - pDM_Odm->DefaultCckIndex = 12; + pDM_Odm->DefaultCckIndex = 12; pDM_Odm->BbSwingIdxOfdmBase = pDM_Odm->DefaultOfdmIndex; pDM_Odm->BbSwingIdxCckBase = pDM_Odm->DefaultCckIndex; pDM_Odm->BbSwingIdxOfdm = pDM_Odm->DefaultOfdmIndex; pDM_Odm->BbSwingIdxCck = pDM_Odm->DefaultCckIndex; - + pDM_Odm->RFCalibrateInfo.CCK_index = pDM_Odm->DefaultCckIndex; - pDM_Odm->RFCalibrateInfo.OFDM_index[RF_PATH_A] = pDM_Odm->DefaultOfdmIndex; - pDM_Odm->RFCalibrateInfo.OFDM_index[RF_PATH_B] = pDM_Odm->DefaultOfdmIndex; + pDM_Odm->RFCalibrateInfo.OFDM_index[RF_PATH_A] = pDM_Odm->DefaultOfdmIndex; + pDM_Odm->RFCalibrateInfo.OFDM_index[RF_PATH_B] = pDM_Odm->DefaultOfdmIndex; } @@ -5478,7 +5478,7 @@ ODM_TXPowerTrackingCheck( IN PDM_ODM_T pDM_Odm ) { - // + // // For AP/ADSL use prtl8192cd_priv // For CE/NIC use PADAPTER // @@ -5504,19 +5504,19 @@ ODM_TXPowerTrackingCheck( break; case ODM_AP: - odm_TXPowerTrackingCheckAP(pDM_Odm); - break; + odm_TXPowerTrackingCheckAP(pDM_Odm); + break; case ODM_ADSL: //odm_DIGAP(pDM_Odm); - break; + break; } } VOID odm_TXPowerTrackingCheckCE( - IN PDM_ODM_T pDM_Odm + IN PDM_ODM_T pDM_Odm ) { #if (DM_ODM_SUPPORT_TYPE == ODM_CE) @@ -5525,7 +5525,7 @@ odm_TXPowerTrackingCheckCE( rtl8192c_odm_CheckTXPowerTracking(Adapter); #endif - #if (RTL8192D_SUPPORT==1) + #if (RTL8192D_SUPPORT==1) #if (RTL8192D_EASY_SMART_CONCURRENT == 1) if(!Adapter->bSlaveOfDMSP) #endif @@ -5545,10 +5545,10 @@ odm_TXPowerTrackingCheckCE( //ODM_SetRFReg(pDM_Odm, RF_PATH_A, RF_T_METER, bRFRegOffsetMask, 0x60); PHY_SetRFReg(Adapter, RF_PATH_A, RF_T_METER_88E, BIT17 | BIT16, 0x03); //DBG_8192C("Trigger 92C Thermal Meter!!\n"); - + pDM_Odm->RFCalibrateInfo.TM_Trigger = 1; return; - + } else { @@ -5557,13 +5557,13 @@ odm_TXPowerTrackingCheckCE( pDM_Odm->RFCalibrateInfo.TM_Trigger = 0; } #endif - -#endif + +#endif } VOID odm_TXPowerTrackingCheckMP( - IN PDM_ODM_T pDM_Odm + IN PDM_ODM_T pDM_Odm ) { #if (DM_ODM_SUPPORT_TYPE == ODM_MP) @@ -5578,7 +5578,7 @@ odm_TXPowerTrackingCheckMP( if(!Adapter->bSlaveOfDMSP || Adapter->DualMacSmartConcurrent == FALSE) odm_TXPowerTrackingThermalMeterCheck(Adapter); #endif - + } @@ -5591,7 +5591,7 @@ odm_TXPowerTrackingCheckAP( prtl8192cd_priv priv = pDM_Odm->priv; } -#endif +#endif } @@ -5614,7 +5614,7 @@ odm_TXPowerTrackingThermalMeterCheck( { #ifndef AP_BUILD_WORKAROUND #if (HAL_CODE_BASE==RTL8192_C) - PMGNT_INFO pMgntInfo = &Adapter->MgntInfo; + PMGNT_INFO pMgntInfo = &Adapter->MgntInfo; //HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); static u1Byte TM_Trigger = 0; //u1Byte TxPowerCheckCnt = 5; //10 sec @@ -5633,13 +5633,13 @@ odm_TXPowerTrackingThermalMeterCheck( else PHY_SetRFReg(Adapter, RF_PATH_A, RF_T_METER, bRFRegOffsetMask, 0x60); RT_TRACE(COMP_POWER_TRACKING, DBG_LOUD,("Trigger 92C Thermal Meter!!\n")); - + TM_Trigger = 1; return; } else { - RT_TRACE(COMP_POWER_TRACKING, DBG_LOUD,("Schedule TxPowerTracking direct call!!\n")); + RT_TRACE(COMP_POWER_TRACKING, DBG_LOUD,("Schedule TxPowerTracking direct call!!\n")); odm_TXPowerTrackingDirectCall(Adapter); //Using direct call is instead, added by Roger, 2009.06.18. TM_Trigger = 0; } @@ -5666,7 +5666,7 @@ odm_SwAntDivInit( dm_SW_AntennaSwitchInit(pDM_Odm->priv); #endif } -#if (RTL8723A_SUPPORT==1) +#if (RTL8723A_SUPPORT==1) // Only for 8723A SW ANT DIV INIT--2012--07--17 VOID odm_SwAntDivInit_NIC_8723A( @@ -5674,13 +5674,13 @@ odm_SwAntDivInit_NIC_8723A( { pSWAT_T pDM_SWAT_Table = &pDM_Odm->DM_SWAT_Table; struct adapter * Adapter = pDM_Odm->Adapter; - u1Byte btAntNum=BT_GetPGAntNum(Adapter); + u1Byte btAntNum=BT_GetPGAntNum(Adapter); if(IS_HARDWARE_TYPE_8723A(Adapter)) { pDM_SWAT_Table->ANTA_ON =TRUE; - + // Set default antenna B status by PG if(btAntNum == Ant_x2) pDM_SWAT_Table->ANTB_ON = TRUE; @@ -5688,7 +5688,7 @@ odm_SwAntDivInit_NIC_8723A( pDM_SWAT_Table->ANTB_ON = FALSE; else pDM_SWAT_Table->ANTB_ON = TRUE; - } + } } #endif @@ -5701,10 +5701,10 @@ odm_SwAntDivInit_NIC( // Init SW ANT DIV mechanism for 8723AE/AU/AS// Neil Chen--2012--07--17--- // CE/AP/ADSL no using SW ANT DIV for 8723A Series IC //#if (DM_ODM_SUPPORT_TYPE==ODM_MP) -#if (RTL8723A_SUPPORT==1) +#if (RTL8723A_SUPPORT==1) if(pDM_Odm->SupportICType == ODM_RTL8723A) - { - odm_SwAntDivInit_NIC_8723A(pDM_Odm); + { + odm_SwAntDivInit_NIC_8723A(pDM_Odm); } #endif ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("SWAS:Init SW Antenna Switch\n")); @@ -5730,7 +5730,7 @@ odm_SwAntDivInit_NIC( } // -// 20100514 Joseph: +// 20100514 Joseph: // Add new function to reset the state of antenna diversity before link. // VOID @@ -5751,7 +5751,7 @@ ODM_SwAntDivResetBeforeLink( // VOID ODM_SwAntDivRestAfterLink( - IN PDM_ODM_T pDM_Odm + IN PDM_ODM_T pDM_Odm ) { pSWAT_T pDM_SWAT_Table = &pDM_Odm->DM_SWAT_Table; @@ -5770,12 +5770,12 @@ ODM_SwAntDivChkPerPktRssi( IN u1Byte StationID, IN PODM_PHY_INFO_T pPhyInfo ) -{ +{ SWAT_T *pDM_SWAT_Table = &pDM_Odm->DM_SWAT_Table; - + if(!(pDM_Odm->SupportAbility & (ODM_BB_ANT_DIV))) return; - + if(StationID == pDM_SWAT_Table->RSSI_target) { //1 RSSI for SW Antenna Switch @@ -5801,7 +5801,7 @@ odm_SwAntDivChkAntSwitch( IN u1Byte Step ) { - // + // // For AP/ADSL use prtl8192cd_priv // For CE/NIC use PADAPTER // @@ -5815,7 +5815,7 @@ odm_SwAntDivChkAntSwitch( // switch (pDM_Odm->SupportPlatform) { - case ODM_MP: + case ODM_MP: case ODM_CE: odm_SwAntDivChkAntSwitchNIC(pDM_Odm, Step); break; @@ -5825,8 +5825,8 @@ odm_SwAntDivChkAntSwitch( #if (DM_ODM_SUPPORT_TYPE & (ODM_AP |ODM_ADSL)) if (priv->pshare->rf_ft_var.antSw_enable && (priv->up_time % 4==1)) dm_SW_AntennaSwitch(priv, SWAW_STEP_PEAK); -#endif - break; +#endif + break; } } @@ -5841,16 +5841,16 @@ odm_SwAntDivChkAntSwitch( // After 500ms, ODM_SwAntDivChkAntSwitchCallback() calls this function to compare the signal just // listened on the air with the RSSI of original antenna. // It chooses the antenna with better RSSI. -// There is also a aged policy for error trying. Each error trying will cost more 5 seconds waiting +// There is also a aged policy for error trying. Each error trying will cost more 5 seconds waiting // penalty to get next try. VOID ODM_SetAntenna( - IN PDM_ODM_T pDM_Odm, + IN PDM_ODM_T pDM_Odm, IN u1Byte Antenna) { - ODM_SetBBReg(pDM_Odm, 0x860, BIT8|BIT9, Antenna); + ODM_SetBBReg(pDM_Odm, 0x860, BIT8|BIT9, Antenna); } //--------------------------------2012--09--06-- //Note: Antenna_Main--> Antenna_A @@ -5918,15 +5918,15 @@ odm_SwAntDivChkAntSwitchNIC( if(pDM_SWAT_Table->try_flag == 0xff) { pDM_SWAT_Table->RSSI_target = 0xff; - + #if(DM_ODM_SUPPORT_TYPE & ODM_CE) { u1Byte index = 0; PSTA_INFO_T pEntry = NULL; - - + + for(index=0; indexpODM_StaInfo[index]; if(IS_STA_VALID(pEntry) ) { break; @@ -5944,11 +5944,11 @@ odm_SwAntDivChkAntSwitchNIC( ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("odm_SwAntDivChkAntSwitch(): RSSI_target is PEER STA\n")); } } - #elif (DM_ODM_SUPPORT_TYPE & ODM_MP) + #elif (DM_ODM_SUPPORT_TYPE & ODM_MP) { struct adapter *pAdapter = pDM_Odm->Adapter; PMGNT_INFO pMgntInfo=&pAdapter->MgntInfo; - + // Select RSSI checking target if(pMgntInfo->mAssoc && !ACTING_AS_AP(pAdapter)) { @@ -5961,7 +5961,7 @@ odm_SwAntDivChkAntSwitchNIC( u1Byte index = 0; PSTA_INFO_T pEntry = NULL; struct adapter * pTargetAdapter = NULL; - + if(pMgntInfo->mIbss ) { // Target: AP/IBSS peer. @@ -5973,19 +5973,19 @@ odm_SwAntDivChkAntSwitchNIC( } if(pTargetAdapter != NULL) - { + { for(index=0; indexbAssociated) - break; + break; } - + } - + } if(pEntry == NULL) @@ -6024,12 +6024,12 @@ odm_SwAntDivChkAntSwitchNIC( curRxOkCnt = *(pDM_Odm->pNumRxBytesUnicast) - pDM_SWAT_Table->lastRxOkCnt; pDM_SWAT_Table->lastTxOkCnt = *(pDM_Odm->pNumTxBytesUnicast); pDM_SWAT_Table->lastRxOkCnt = *(pDM_Odm->pNumRxBytesUnicast); -#endif +#endif ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("curTxOkCnt = %lld\n",curTxOkCnt)); ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("curRxOkCnt = %lld\n",curRxOkCnt)); ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("lastTxOkCnt = %lld\n",pDM_SWAT_Table->lastTxOkCnt)); ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("lastRxOkCnt = %lld\n",pDM_SWAT_Table->lastRxOkCnt)); - + if(pDM_SWAT_Table->try_flag == 1) { if(pDM_SWAT_Table->CurAntenna == Antenna_A) @@ -6042,7 +6042,7 @@ odm_SwAntDivChkAntSwitchNIC( pDM_SWAT_Table->TXByteCnt_B += curTxOkCnt; pDM_SWAT_Table->RXByteCnt_B += curRxOkCnt; } - + nextAntenna = (pDM_SWAT_Table->CurAntenna == Antenna_A)? Antenna_B : Antenna_A; pDM_SWAT_Table->RSSI_Trying--; ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("RSSI_Trying = %d\n",pDM_SWAT_Table->RSSI_Trying)); @@ -6050,7 +6050,7 @@ odm_SwAntDivChkAntSwitchNIC( { CurByteCnt = (pDM_SWAT_Table->CurAntenna == Antenna_A)? (pDM_SWAT_Table->TXByteCnt_A+pDM_SWAT_Table->RXByteCnt_A) : (pDM_SWAT_Table->TXByteCnt_B+pDM_SWAT_Table->RXByteCnt_B); PreByteCnt = (pDM_SWAT_Table->CurAntenna == Antenna_A)? (pDM_SWAT_Table->TXByteCnt_B+pDM_SWAT_Table->RXByteCnt_B) : (pDM_SWAT_Table->TXByteCnt_A+pDM_SWAT_Table->RXByteCnt_A); - + if(pDM_SWAT_Table->TrafficLoad == TRAFFIC_HIGH) //CurByteCnt = PlatformDivision64(CurByteCnt, 9); PreByteCnt = PreByteCnt*9; @@ -6059,17 +6059,17 @@ odm_SwAntDivChkAntSwitchNIC( PreByteCnt = PreByteCnt*2; if(pDM_SWAT_Table->RSSI_cnt_A > 0) - RSSI_A = pDM_SWAT_Table->RSSI_sum_A/pDM_SWAT_Table->RSSI_cnt_A; + RSSI_A = pDM_SWAT_Table->RSSI_sum_A/pDM_SWAT_Table->RSSI_cnt_A; else RSSI_A = 0; if(pDM_SWAT_Table->RSSI_cnt_B > 0) - RSSI_B = pDM_SWAT_Table->RSSI_sum_B/pDM_SWAT_Table->RSSI_cnt_B; + RSSI_B = pDM_SWAT_Table->RSSI_sum_B/pDM_SWAT_Table->RSSI_cnt_B; else RSSI_B = 0; curRSSI = (pDM_SWAT_Table->CurAntenna == Antenna_A)? RSSI_A : RSSI_B; pDM_SWAT_Table->PreRSSI = (pDM_SWAT_Table->CurAntenna == Antenna_A)? RSSI_B : RSSI_A; ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("Luke:PreRSSI = %d, CurRSSI = %d\n",pDM_SWAT_Table->PreRSSI, curRSSI)); - ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("SWAS: preAntenna= %s, curAntenna= %s \n", + ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("SWAS: preAntenna= %s, curAntenna= %s \n", (pDM_SWAT_Table->PreAntenna == Antenna_A?"A":"B"), (pDM_SWAT_Table->CurAntenna == Antenna_A?"A":"B"))); ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("Luke:RSSI_A= %d, RSSI_cnt_A = %d, RSSI_B= %d, RSSI_cnt_B = %d\n", RSSI_A, pDM_SWAT_Table->RSSI_cnt_A, RSSI_B, pDM_SWAT_Table->RSSI_cnt_B)); @@ -6078,19 +6078,19 @@ odm_SwAntDivChkAntSwitchNIC( } else { - + if(pDM_SWAT_Table->RSSI_cnt_A > 0) - RSSI_A = pDM_SWAT_Table->RSSI_sum_A/pDM_SWAT_Table->RSSI_cnt_A; + RSSI_A = pDM_SWAT_Table->RSSI_sum_A/pDM_SWAT_Table->RSSI_cnt_A; else RSSI_A = 0; if(pDM_SWAT_Table->RSSI_cnt_B > 0) - RSSI_B = pDM_SWAT_Table->RSSI_sum_B/pDM_SWAT_Table->RSSI_cnt_B; + RSSI_B = pDM_SWAT_Table->RSSI_sum_B/pDM_SWAT_Table->RSSI_cnt_B; else RSSI_B = 0; curRSSI = (pDM_SWAT_Table->CurAntenna == Antenna_A)? RSSI_A : RSSI_B; pDM_SWAT_Table->PreRSSI = (pDM_SWAT_Table->PreAntenna == Antenna_A)? RSSI_A : RSSI_B; ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("Ekul:PreRSSI = %d, CurRSSI = %d\n", pDM_SWAT_Table->PreRSSI, curRSSI)); - ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("SWAS: preAntenna= %s, curAntenna= %s \n", + ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("SWAS: preAntenna= %s, curAntenna= %s \n", (pDM_SWAT_Table->PreAntenna == Antenna_A?"A":"B"), (pDM_SWAT_Table->CurAntenna == Antenna_A?"A":"B"))); ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("Ekul:RSSI_A= %d, RSSI_cnt_A = %d, RSSI_B= %d, RSSI_cnt_B = %d\n", @@ -6107,7 +6107,7 @@ odm_SwAntDivChkAntSwitchNIC( { ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("SWAS: TestMode = TP_MODE")); ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("TRY:CurByteCnt = %lld,", CurByteCnt)); - ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("TRY:PreByteCnt = %lld\n",PreByteCnt)); + ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("TRY:PreByteCnt = %lld\n",PreByteCnt)); if(CurByteCnt < PreByteCnt) { if(pDM_SWAT_Table->CurAntenna == Antenna_A) @@ -6131,7 +6131,7 @@ odm_SwAntDivChkAntSwitchNIC( } ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("SelectAntennaMap=%x\n ",pDM_SWAT_Table->SelectAntennaMap)); ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("Score_A=%d, Score_B=%d\n", Score_A, Score_B)); - + if(pDM_SWAT_Table->CurAntenna == Antenna_A) { nextAntenna = (Score_A > Score_B)?Antenna_A:Antenna_B; @@ -6141,7 +6141,7 @@ odm_SwAntDivChkAntSwitchNIC( nextAntenna = (Score_B > Score_A)?Antenna_B:Antenna_A; } //RT_TRACE(COMP_SWAS, DBG_LOUD, ("nextAntenna=%s\n",(nextAntenna==Antenna_A)?"A":"B")); - //RT_TRACE(COMP_SWAS, DBG_LOUD, ("preAntenna= %s, curAntenna= %s \n", + //RT_TRACE(COMP_SWAS, DBG_LOUD, ("preAntenna= %s, curAntenna= %s \n", //(DM_SWAT_Table.PreAntenna == Antenna_A?"A":"B"), (DM_SWAT_Table.CurAntenna == Antenna_A?"A":"B"))); if(nextAntenna != pDM_SWAT_Table->CurAntenna) @@ -6151,11 +6151,11 @@ odm_SwAntDivChkAntSwitchNIC( else { ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("SWAS: current anntena is good\n")); - } + } } if(pDM_SWAT_Table->TestMode == RSSI_MODE) - { + { ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("SWAS: TestMode = RSSI_MODE")); pDM_SWAT_Table->SelectAntennaMap=0xAA; if(curRSSI < pDM_SWAT_Table->PreRSSI) //Current antenna is worse than previous antenna @@ -6179,7 +6179,7 @@ odm_SwAntDivChkAntSwitchNIC( pDM_SWAT_Table->TXByteCnt_B = 0; pDM_SWAT_Table->RXByteCnt_A = 0; pDM_SWAT_Table->RXByteCnt_B = 0; - + } //1 Normal State @@ -6203,7 +6203,7 @@ odm_SwAntDivChkAntSwitchNIC( pDM_SWAT_Table->bTriggerAntennaSwitch = 0; //RT_TRACE(COMP_SWAS, DBG_LOUD, ("Normal:TrafficLoad = %llu\n", curTxOkCnt+curRxOkCnt)); - //Prepare To Try Antenna + //Prepare To Try Antenna nextAntenna = (pDM_SWAT_Table->CurAntenna == Antenna_A)? Antenna_B : Antenna_A; pDM_SWAT_Table->try_flag = 1; pDM_Odm->RSSI_test = TRUE; @@ -6219,8 +6219,8 @@ odm_SwAntDivChkAntSwitchNIC( } ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("SWAS: Normal State -> Begin Trying!\n")); - - + + pDM_SWAT_Table->RSSI_sum_A = 0; pDM_SWAT_Table->RSSI_cnt_A = 0; pDM_SWAT_Table->RSSI_sum_B = 0; @@ -6232,17 +6232,17 @@ odm_SwAntDivChkAntSwitchNIC( if(nextAntenna != pDM_SWAT_Table->CurAntenna) { ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("SWAS: Change TX Antenna!\n ")); - //PHY_SetBBReg(Adapter, rFPGA0_XA_RFInterfaceOE, 0x300, nextAntenna); - #if (DM_ODM_SUPPORT_TYPE == ODM_MP) - ODM_SetAntenna(pDM_Odm,nextAntenna); + //PHY_SetBBReg(Adapter, rFPGA0_XA_RFInterfaceOE, 0x300, nextAntenna); + #if (DM_ODM_SUPPORT_TYPE == ODM_MP) + ODM_SetAntenna(pDM_Odm,nextAntenna); #elif (DM_ODM_SUPPORT_TYPE == ODM_CE) { - BOOLEAN bEnqueue; - bEnqueue = (pDM_Odm->SupportInterface == ODM_ITRF_PCIE)?FALSE :TRUE; - rtw_antenna_select_cmd(pDM_Odm->Adapter, nextAntenna, bEnqueue); + BOOLEAN bEnqueue; + bEnqueue = (pDM_Odm->SupportInterface == ODM_ITRF_PCIE)?FALSE :TRUE; + rtw_antenna_select_cmd(pDM_Odm->Adapter, nextAntenna, bEnqueue); } #endif - + } //1 5.Reset Statistics @@ -6254,7 +6254,7 @@ odm_SwAntDivChkAntSwitchNIC( { struct adapter * pAdapter = pDM_Odm->Adapter; HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter); - + if(pDM_SWAT_Table->RSSI_Trying == 0) return; @@ -6267,7 +6267,7 @@ odm_SwAntDivChkAntSwitchNIC( { //PlatformSetTimer( pAdapter, &pHalData->SwAntennaSwitchTimer, 10 ); //ms ODM_SetTimer(pDM_Odm,&pDM_SWAT_Table->SwAntennaSwitchTimer, 10 ); //ms - + ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("dm_SW_AntennaSwitch(): Test another antenna for 10 ms\n")); } else if(pDM_SWAT_Table->TrafficLoad == TRAFFIC_LOW) @@ -6297,11 +6297,11 @@ odm_SwAntDivChkAntSwitchNIC( } else //PlatformSetTimer( pAdapter, &pHalData->SwAntennaSwitchTimer, 500 ); //ms - ODM_SetTimer(pDM_Odm,&pDM_SWAT_Table->SwAntennaSwitchTimer, 500 ); //ms + ODM_SetTimer(pDM_Odm,&pDM_SWAT_Table->SwAntennaSwitchTimer, 500 ); //ms } } #endif // #if (DM_ODM_SUPPORT_TYPE & (ODM_MP|ODM_CE)) -#endif // #if (RTL8192C_SUPPORT==1) +#endif // #if (RTL8192C_SUPPORT==1) } @@ -6313,7 +6313,7 @@ odm_SwAntDivSelectChkChnl( ) { #if (RT_MEM_SIZE_LEVEL != RT_MEM_SIZE_MINIMUM) - u1Byte index, target_chnl=0; + u1Byte index, target_chnl=0; HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); PDM_ODM_T pDM_Odm = &pHalData->DM_OutSrc; u1Byte chnl_peer_cnt[14] = {0}; @@ -6323,17 +6323,17 @@ odm_SwAntDivSelectChkChnl( return 0; } else - { + { // 20100519 Joseph: Select checking channel from current scan list. // We just choose the channel with most APs to be the test scan channel. for(index=0; indexMgntInfo.tmpNumBssDesc; index++) { // Add by hpfan: prevent access invalid channel number // TODO: Verify channel number by channel plan - if(Adapter->MgntInfo.tmpbssDesc[index].ChannelNumber == 0 || + if(Adapter->MgntInfo.tmpbssDesc[index].ChannelNumber == 0 || Adapter->MgntInfo.tmpbssDesc[index].ChannelNumber > 13) continue; - + chnl_peer_cnt[Adapter->MgntInfo.tmpbssDesc[index].ChannelNumber-1]++; } for(index=0; index<14; index++) @@ -6342,14 +6342,14 @@ odm_SwAntDivSelectChkChnl( target_chnl = index; } target_chnl+=1; - ODM_RT_TRACE(pDM_Odm,COMP_SWAS, DBG_LOUD, + ODM_RT_TRACE(pDM_Odm,COMP_SWAS, DBG_LOUD, ("odm_SwAntDivSelectChkChnl(): Channel %d is select as test channel.\n", target_chnl)); return target_chnl; } #else return 0; -#endif +#endif } @@ -6366,7 +6366,7 @@ odm_SwAntDivConsructChkScanChnl( if(ChkChnl==0) { - // 20100519 Joseph: Original antenna scanned nothing. + // 20100519 Joseph: Original antenna scanned nothing. // Test antenna shall scan all channel with half period in this condition. RtActChannelList(Adapter, RT_CHNL_LIST_ACTION_CONSTRUCT_SCAN_LIST, NULL, NULL); for(index=0; indexChannelLen; index++) @@ -6374,7 +6374,7 @@ odm_SwAntDivConsructChkScanChnl( } else { - // The using of this CustomizedScanRequest is a trick to rescan the two channels + // The using of this CustomizedScanRequest is a trick to rescan the two channels // under the NORMAL scanning process. It will not affect MGNT_INFO.CustomizedScanRequest. CUSTOMIZED_SCAN_REQUEST CustomScanReq; @@ -6414,7 +6414,7 @@ odm_SwAntDivChkAntSwitchCallback( #else ODM_ScheduleWorkItem(&pDM_SWAT_Table->SwAntennaSwitchWorkitem); #endif - + } VOID odm_SwAntDivChkAntSwitchWorkitemCallback( @@ -6435,7 +6435,7 @@ VOID odm_SwAntDivChkAntSwitchCallback(void *FunctionContext) struct adapter *padapter = pDM_Odm->Adapter; if(padapter->net_closed == _TRUE) return; - odm_SwAntDivChkAntSwitch(pDM_Odm, SWAW_STEP_DETERMINE); + odm_SwAntDivChkAntSwitch(pDM_Odm, SWAW_STEP_DETERMINE); } #elif (DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL)) VOID odm_SwAntDivChkAntSwitchCallback(void *FunctionContext) @@ -6511,15 +6511,15 @@ return FALSE; return FALSE; pHalData = GET_HAL_DATA(Adapter); pMgntInfo = &Adapter->MgntInfo; - + // Condition that does not need to use antenna diversity. if(IS_8723_SERIES(pHalData->VersionID) || IS_92C_SERIAL(pHalData->VersionID) || - (pHalData->AntDivCfg==0) || + (pHalData->AntDivCfg==0) || pMgntInfo->AntennaTest || Adapter->bInHctTest) { - ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, + ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("ODM_SwAntDivCheckBeforeLink8192C(): No AntDiv Mechanism.\n")); return FALSE; } @@ -6539,14 +6539,14 @@ return FALSE; if(pHalData->eRFPowerState!=eRfOn || pMgntInfo->RFChangeInProgress || pMgntInfo->bMediaConnect) { PlatformReleaseSpinLock(Adapter, RT_RF_STATE_SPINLOCK); - - ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, - ("ODM_SwAntDivCheckBeforeLink8192C(): RFChangeInProgress(%x), eRFPowerState(%x)\n", + + ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, + ("ODM_SwAntDivCheckBeforeLink8192C(): RFChangeInProgress(%x), eRFPowerState(%x)\n", pMgntInfo->RFChangeInProgress, pHalData->eRFPowerState)); - + pDM_SWAT_Table->SWAS_NoLink_State = 0; - + return FALSE; } else @@ -6561,11 +6561,11 @@ return FALSE; // Set check state to next step. pDM_SWAT_Table->SWAS_NoLink_State = 1; - + // Copy Current Scan list. Adapter->MgntInfo.tmpNumBssDesc = pMgntInfo->NumBssDesc; PlatformMoveMemory((PVOID)Adapter->MgntInfo.tmpbssDesc, (PVOID)pMgntInfo->bssDesc, sizeof(RT_WLAN_BSS)*MAX_BSS_DESC); - + if(pDM_Odm->SupportICType == ODM_RTL8188E) { if(pDM_FatTable->RxIdleAnt == MAIN_ANT) @@ -6573,7 +6573,7 @@ return FALSE; else ODM_UpdateRxIdleAnt_88E(pDM_Odm, MAIN_ANT); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, + ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("ODM_SwAntDivCheckBeforeLink8192C: Change to %s for testing.\n", ((pDM_FatTable->RxIdleAnt == MAIN_ANT)?"MAIN_ANT":"AUX_ANT"))); } if(pDM_Odm->SupportICType != ODM_RTL8188E) @@ -6581,8 +6581,8 @@ return FALSE; // Switch Antenna to another one. pDM_SWAT_Table->PreAntenna = pDM_SWAT_Table->CurAntenna; pDM_SWAT_Table->CurAntenna = (pDM_SWAT_Table->CurAntenna==Antenna_A)?Antenna_B:Antenna_A; - - ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, + + ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("ODM_SwAntDivCheckBeforeLink8192C: Change to Ant(%s) for testing.\n", (pDM_SWAT_Table->CurAntenna==Antenna_A)?"A":"B")); //PHY_SetBBReg(Adapter, rFPGA0_XA_RFInterfaceOE, 0x300, DM_SWAT_Table.CurAntenna); pDM_SWAT_Table->SWAS_NoLink_BK_Reg860 = ((pDM_SWAT_Table->SWAS_NoLink_BK_Reg860 & 0xfffffcff) | (pDM_SWAT_Table->CurAntenna<<8)); @@ -6620,7 +6620,7 @@ return FALSE; ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("ODM_SwAntDivCheckBeforeLink8192C: Compare scan entry: Score++\n")); RT_PRINT_STR(ODM_COMP_ANT_DIV, ODM_DBG_LOUD, "SSID: ", pTestBssDesc->bdSsIdBuf, pTestBssDesc->bdSsIdLen); ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("Original: %d, Test: %d\n", pTmpBssDesc->RecvSignalPower, pTestBssDesc->RecvSignalPower)); - + Score++; PlatformMoveMemory(pTestBssDesc, pTmpBssDesc, sizeof(RT_WLAN_BSS)); } @@ -6643,7 +6643,7 @@ return FALSE; } else { - ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, + ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("ODM_SwAntDivCheckBeforeLink8192C(): Remain Ant(%s)\n", (pDM_FatTable->RxIdleAnt==MAIN_ANT)?"AUX_ANT":"MAIN_ANT")); if(pDM_FatTable->RxIdleAnt == MAIN_ANT) @@ -6664,7 +6664,7 @@ return FALSE; } else { - ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, + ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("ODM_SwAntDivCheckBeforeLink8192C(): Remain Ant(%s)\n", (pDM_SWAT_Table->CurAntenna==Antenna_A)?"Antenna_B":"Antenna_A")); pDM_SWAT_Table->CurAntenna = pDM_SWAT_Table->PreAntenna; @@ -6706,7 +6706,7 @@ ODM_SwAntDivCheckBeforeLink8192C( #if(defined(CONFIG_HW_ANTENNA_DIVERSITY)) VOID odm_InitHybridAntDiv_88C_92D( - IN PDM_ODM_T pDM_Odm + IN PDM_ODM_T pDM_Odm ) { @@ -6723,8 +6723,8 @@ odm_InitHybridAntDiv_88C_92D( #if(DM_ODM_SUPPORT_TYPE==ODM_AP) if(priv==NULL) return; if(!priv->pshare->rf_ft_var.antHw_enable) - return; - + return; + #ifdef SW_ANT_SWITCH priv->pshare->rf_ft_var.antSw_enable =0; #endif @@ -6744,7 +6744,7 @@ odm_InitHybridAntDiv_88C_92D( #if(DM_ODM_SUPPORT_TYPE==ODM_AP) ODM_Write2Byte(pDM_Odm,ODM_REG_RF_PIN_11N, (ODM_Read2Byte(pDM_Odm,0x804)&0xf0ff )| BIT(8) ); // b11-b8=0001,update RFPin setting #endif - + // only AP support different path selection temperarly if(!bTxPathSel){ //PATH-A ODM_SetBBReg(pDM_Odm,ODM_REG_PIN_CTRL_11N, BIT8|BIT9, 0 ); // ANTSEL as HW control @@ -6759,7 +6759,7 @@ odm_InitHybridAntDiv_88C_92D( ODM_SetBBReg(pDM_Odm,ODM_REG_ANTDIV_PARA1_11N, 0x7FF, 0x0c0); //Pwdb threshold=8dB ODM_SetBBReg(pDM_Odm,ODM_REG_ANTDIV_PARA1_11N, BIT11, 0); //Switch to another antenna by checking pwdb threshold ODM_SetBBReg(pDM_Odm,ODM_REG_ANTDIV_PARA3_11N, BIT23, 1); // Decide final antenna by comparing 2 antennas' pwdb - + //Set CCK HW RX Antenna Diversity ODM_SetBBReg(pDM_Odm,ODM_REG_CCK_ANTDIV_PARA2_11N, BIT4, 0); //Antenna diversity decision period = 32 sample ODM_SetBBReg(pDM_Odm,ODM_REG_CCK_ANTDIV_PARA2_11N, 0xf, 0xf); //Threshold for antenna diversity. Check another antenna power if input power < ANT_lim*4 @@ -6791,7 +6791,7 @@ odm_InitHybridAntDiv_88C_92D( VOID odm_InitHybridAntDiv( - IN PDM_ODM_T pDM_Odm + IN PDM_ODM_T pDM_Odm ) { if(!(pDM_Odm->SupportAbility & ODM_BB_ANT_DIV)) @@ -6799,7 +6799,7 @@ odm_InitHybridAntDiv( ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV,ODM_DBG_LOUD,("Return: Not Support HW AntDiv\n")); return; } - + if(pDM_Odm->SupportICType & (ODM_RTL8192C | ODM_RTL8192D)) { #if ((RTL8192C_SUPPORT == 1)||(RTL8192D_SUPPORT == 1)) @@ -6812,7 +6812,7 @@ odm_InitHybridAntDiv( ODM_AntennaDiversityInit_88E(pDM_Odm); #endif } - + } @@ -6823,7 +6823,7 @@ odm_StaDefAntSel( IN u4Byte OFDM_Ant2_Cnt, IN u4Byte CCK_Ant1_Cnt, IN u4Byte CCK_Ant2_Cnt, - OUT u1Byte *pDefAnt + OUT u1Byte *pDefAnt ) { @@ -6833,7 +6833,7 @@ odm_StaDefAntSel( ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV,ODM_DBG_LOUD,("OFDM_Ant1_Cnt:%d, OFDM_Ant2_Cnt:%d\n",OFDM_Ant1_Cnt,OFDM_Ant2_Cnt)); ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV,ODM_DBG_LOUD,("CCK_Ant1_Cnt:%d, CCK_Ant2_Cnt:%d\n",CCK_Ant1_Cnt,CCK_Ant2_Cnt)); - + if(((OFDM_Ant1_Cnt+OFDM_Ant2_Cnt)==0)&&((CCK_Ant1_Cnt + CCK_Ant2_Cnt) <10)){ ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV,ODM_DBG_LOUD,("odm_StaDefAntSelect Fail: No enough packet info!\n")); return FALSE; @@ -6861,19 +6861,19 @@ odm_StaDefAntSel( } ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV,ODM_DBG_LOUD,("TxAnt = %s\n",((*pDefAnt)==1)?"Ant1":"Ant2")); - + #endif //u4Byte antsel = ODM_GetBBReg(pDM_Odm, 0xc88, bMaskByte0); //(*pDefAnt)= (u1Byte) antsel; - - + + ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV,ODM_DBG_LOUD,("<==============odm_StaDefAntSelect\n")); return TRUE; - + } @@ -6881,7 +6881,7 @@ VOID odm_SetRxIdleAnt( IN PDM_ODM_T pDM_Odm, IN u1Byte Ant, - IN BOOLEAN bDualPath + IN BOOLEAN bDualPath ) { SWAT_T *pDM_SWAT_Table = &pDM_Odm->DM_SWAT_Table; @@ -6891,16 +6891,16 @@ odm_SetRxIdleAnt( if(Ant != pDM_SWAT_Table->RxIdleAnt) { //for path-A - if(Ant==1) + if(Ant==1) ODM_SetBBReg(pDM_Odm,ODM_REG_RX_DEFUALT_A_11N, 0xFFFF, 0x65a9); //right-side antenna else ODM_SetBBReg(pDM_Odm,ODM_REG_RX_DEFUALT_A_11N, 0xFFFF, 0x569a); //left-side antenna //for path-B if(bDualPath){ - if(Ant==0) + if(Ant==0) ODM_SetBBReg(pDM_Odm,ODM_REG_RX_DEFUALT_A_11N, 0xFFFF0000, 0x65a9); //right-side antenna - else + else ODM_SetBBReg(pDM_Odm,ODM_REG_RX_DEFUALT_A_11N, 0xFFFF0000, 0x569a); //left-side antenna } } @@ -6910,7 +6910,7 @@ odm_SetRxIdleAnt( //ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV,ODM_DBG_LOUD,("<==============odm_SetRxIdleAnt\n")); } - + VOID ODM_AntselStatistics_88C( IN PDM_ODM_T pDM_Odm, @@ -6952,20 +6952,20 @@ VOID ODM_SetTxAntByTxInfo_88C_92D( IN PDM_ODM_T pDM_Odm, IN pu1Byte pDesc, - IN u1Byte macId + IN u1Byte macId ) { SWAT_T *pDM_SWAT_Table = &pDM_Odm->DM_SWAT_Table; u1Byte antsel; - if(!(pDM_Odm->SupportAbility&ODM_BB_ANT_DIV)) + if(!(pDM_Odm->SupportAbility&ODM_BB_ANT_DIV)) return; if(pDM_SWAT_Table->RxIdleAnt == 1) antsel=(pDM_SWAT_Table->TxAnt[macId] == 1)?0:1; else antsel=(pDM_SWAT_Table->TxAnt[macId] == 1)?1:0; - + SET_TX_DESC_ANTSEL_A_92C(pDesc, antsel); //SET_TX_DESC_ANTSEL_B_92C(pDesc, antsel); //ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV,ODM_DBG_LOUD,("SET_TX_DESC_ANTSEL_A_92C=%d\n", pDM_SWAT_Table->TxAnt[macId])); @@ -6997,17 +6997,17 @@ odm_HwAntDiv_92C_92D( u4Byte RSSI_Min=0xFF, RSSI, RSSI_Ant1, RSSI_Ant2; u1Byte RxIdleAnt, i; BOOLEAN bRet=FALSE; - PSTA_INFO_T pEntry; - + PSTA_INFO_T pEntry; + #if (DM_ODM_SUPPORT_TYPE==ODM_AP) struct rtl8192cd_priv *priv=pDM_Odm->priv; //if test, return if(priv->pshare->rf_ft_var.CurAntenna & 0x80) - return; -#endif + return; +#endif ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV,ODM_DBG_LOUD,("odm_HwAntDiv==============>\n")); - + if(!(pDM_Odm->SupportAbility&ODM_BB_ANT_DIV)) //if don't support antenna diveristy { ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV,ODM_DBG_LOUD,("odm_HwAntDiv: Not supported!\n")); @@ -7019,7 +7019,7 @@ odm_HwAntDiv_92C_92D( ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV,ODM_DBG_LOUD,("Return: IC Type is not 92C or 92D\n")); return; } - + #if (DM_ODM_SUPPORT_TYPE&(ODM_MP|ODM_CE)) if(!pDM_Odm->bLinked) { @@ -7038,10 +7038,10 @@ odm_HwAntDiv_92C_92D( RSSI_Ant2 = (pDM_SWAT_Table->OFDM_Ant2_Cnt[i] == 0)?0:(pDM_SWAT_Table->RSSI_Ant2_Sum[i]/pDM_SWAT_Table->OFDM_Ant2_Cnt[i]); ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV,ODM_DBG_LOUD,("RSSI_Ant1=%d, RSSI_Ant2=%d\n", RSSI_Ant1, RSSI_Ant2)); - - if(RSSI_Ant1 ||RSSI_Ant2) + + if(RSSI_Ant1 ||RSSI_Ant2) { -#if (DM_ODM_SUPPORT_TYPE==ODM_AP) +#if (DM_ODM_SUPPORT_TYPE==ODM_AP) if(pDM_Odm->pODM_StaInfo[i]->expire_to) #endif { @@ -7053,25 +7053,25 @@ odm_HwAntDiv_92C_92D( } } ///STA: found out default antenna - bRet=odm_StaDefAntSel(pDM_Odm, - pDM_SWAT_Table->OFDM_Ant1_Cnt[i], - pDM_SWAT_Table->OFDM_Ant2_Cnt[i], - pDM_SWAT_Table->CCK_Ant1_Cnt[i], - pDM_SWAT_Table->CCK_Ant2_Cnt[i], + bRet=odm_StaDefAntSel(pDM_Odm, + pDM_SWAT_Table->OFDM_Ant1_Cnt[i], + pDM_SWAT_Table->OFDM_Ant2_Cnt[i], + pDM_SWAT_Table->CCK_Ant1_Cnt[i], + pDM_SWAT_Table->CCK_Ant2_Cnt[i], &pDM_SWAT_Table->TxAnt[i]); //if Tx antenna selection: successful - if(bRet){ + if(bRet){ pDM_SWAT_Table->RSSI_Ant1_Sum[i] = 0; pDM_SWAT_Table->RSSI_Ant2_Sum[i] = 0; pDM_SWAT_Table->OFDM_Ant1_Cnt[i] = 0; - pDM_SWAT_Table->OFDM_Ant2_Cnt[i] = 0; - pDM_SWAT_Table->CCK_Ant1_Cnt[i] = 0; - pDM_SWAT_Table->CCK_Ant2_Cnt[i] = 0; + pDM_SWAT_Table->OFDM_Ant2_Cnt[i] = 0; + pDM_SWAT_Table->CCK_Ant1_Cnt[i] = 0; + pDM_SWAT_Table->CCK_Ant2_Cnt[i] = 0; } } } - + //set RX Idle Ant RxIdleAnt = pDM_SWAT_Table->TxAnt[pDM_SWAT_Table->TargetSTA]; odm_SetRxIdleAnt(pDM_Odm, RxIdleAnt, FALSE); @@ -7084,40 +7084,40 @@ odm_HwAntDiv_92C_92D( pstat = list_entry(plist, struct stat_info, asoc_list); if(pstat->expire_to) { for (i=0; itx_sc_ent[i].hwdesc1); + struct tx_desc *pdesc= &(pstat->tx_sc_ent[i].hwdesc1); pdesc->Dword2 &= set_desc(~ (BIT(24)|BIT(25))); if((pstat->CurAntenna^priv->pshare->rf_ft_var.CurAntenna)&1) pdesc->Dword2 |= set_desc(BIT(24)|BIT(25)); - pdesc= &(pstat->tx_sc_ent[i].hwdesc2); + pdesc= &(pstat->tx_sc_ent[i].hwdesc2); pdesc->Dword2 &= set_desc(~ (BIT(24)|BIT(25))); if((pstat->CurAntenna^priv->pshare->rf_ft_var.CurAntenna)&1) - pdesc->Dword2 |= set_desc(BIT(24)|BIT(25)); + pdesc->Dword2 |= set_desc(BIT(24)|BIT(25)); } - } + } if (plist == plist->next) break; plist = plist->next; }; } -#endif #endif - +#endif + ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD,("<==============odm_HwAntDiv\n")); - + } VOID odm_HwAntDiv( IN PDM_ODM_T pDM_Odm ) -{ +{ if(!(pDM_Odm->SupportAbility & ODM_BB_ANT_DIV)) { ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV,ODM_DBG_LOUD,("Return: Not Support HW AntDiv\n")); return; } - + if(pDM_Odm->SupportICType & (ODM_RTL8192C | ODM_RTL8192D)) { #if ((RTL8192C_SUPPORT == 1)||(RTL8192D_SUPPORT == 1)) @@ -7145,19 +7145,19 @@ odm_HwAntDiv( struct stat_info *pstat, *pstat_min=NULL; struct list_head *phead, *plist; int rssi_min= 0xff, i; - u1Byte idleAnt=priv->pshare->rf_ft_var.CurAntenna; + u1Byte idleAnt=priv->pshare->rf_ft_var.CurAntenna; u1Byte nextAnt; BOOLEAN bRet=FALSE; - + ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV,ODM_DBG_LOUD,("odm_HwAntDiv==============>\n")); if((!priv->pshare->rf_ft_var.antHw_enable) ||(!(pDM_Odm->SupportAbility & ODM_BB_ANT_DIV))) return; - + //if test, return if(priv->pshare->rf_ft_var.CurAntenna & 0x80) return; - + phead = &priv->asoc_list; plist = phead->next; ////========================= @@ -7180,9 +7180,9 @@ odm_HwAntDiv( pstat->cckPktCount[0], &nextAnt ); - + //if default antenna selection: successful - if(bRet){ + if(bRet){ pstat->CurAntenna = nextAnt; //update rssi for(i=0; i<2; i++) { @@ -7199,7 +7199,7 @@ odm_HwAntDiv( if (plist == plist->next) break; plist = plist->next; - + }; ////========================= //Choose RX Idle antenna according to minmum rssi @@ -7218,23 +7218,23 @@ odm_HwAntDiv( pstat = list_entry(plist, struct stat_info, asoc_list); if(pstat->expire_to) { for (i=0; itx_sc_ent[i].hwdesc1); + struct tx_desc *pdesc= &(pstat->tx_sc_ent[i].hwdesc1); pdesc->Dword2 &= set_desc(~ (BIT(24)|BIT(25))); if((pstat->CurAntenna^priv->pshare->rf_ft_var.CurAntenna)&1) pdesc->Dword2 |= set_desc(BIT(24)|BIT(25)); - pdesc= &(pstat->tx_sc_ent[i].hwdesc2); + pdesc= &(pstat->tx_sc_ent[i].hwdesc2); pdesc->Dword2 &= set_desc(~ (BIT(24)|BIT(25))); if((pstat->CurAntenna^priv->pshare->rf_ft_var.CurAntenna)&1) - pdesc->Dword2 |= set_desc(BIT(24)|BIT(25)); + pdesc->Dword2 |= set_desc(BIT(24)|BIT(25)); } - } + } if (plist == plist->next) break; plist = plist->next; }; } -#endif +#endif ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD,"<==============odm_HwAntDiv\n"); } #endif @@ -7255,7 +7255,7 @@ ODM_Diversity_AntennaSelect( PCIeWakeUp(priv, POWER_DOWN_T0); #endif - if (ant==Antenna_B || ant==Antenna_A) + if (ant==Antenna_B || ant==Antenna_A) { if ( !priv->pshare->rf_ft_var.antSw_select) { ODM_Write4Byte(pDM_Odm,0x870, ODM_Read4Byte(pDM_Odm,0x870) | BIT(8)| BIT(9) ); // ANTSEL A as SW control @@ -7303,7 +7303,7 @@ ODM_Diversity_AntennaSelect( #ifdef SW_ANT_SWITCH else if(ant==3) { if(!priv->pshare->rf_ft_var.antSw_enable) { - + dm_SW_AntennaSwitchInit(priv); ODM_Write4Byte(pDM_Odm,0x858, 0x569a569a); priv->pshare->lastTxOkCnt = priv->net_stats.tx_bytes; @@ -7315,7 +7315,7 @@ ODM_Diversity_AntennaSelect( ODM_Write1Byte(pDM_Odm,0xc58, ODM_Read1Byte(pDM_Odm,0xc58) & (~ BIT(7))); // rx OFDM SW control ODM_Write1Byte(pDM_Odm,0xa01, ODM_Read1Byte(pDM_Odm,0xa01) & (~ BIT(7))); // rx CCK SW control - ODM_Write4Byte(pDM_Odm,0x80c, ODM_Read4Byte(pDM_Odm,0x80c) & (~ BIT(21))); // select ant by tx desc + ODM_Write4Byte(pDM_Odm,0x80c, ODM_Read4Byte(pDM_Odm,0x80c) & (~ BIT(21))); // select ant by tx desc priv->pshare->rf_ft_var.antHw_enable = 0; priv->pshare->rf_ft_var.antSw_enable = 1; @@ -7329,13 +7329,13 @@ ODM_Diversity_AntennaSelect( #else //#if(defined(CONFIG_HW_ANTENNA_DIVERSITY)) -VOID odm_InitHybridAntDiv( IN PDM_ODM_T pDM_Odm ){} +VOID odm_InitHybridAntDiv( IN PDM_ODM_T pDM_Odm ){} VOID odm_HwAntDiv( IN PDM_ODM_T pDM_Odm){} #if(DM_ODM_SUPPORT_TYPE==ODM_MP) VOID ODM_SetTxAntByTxInfo_88C_92D( IN PDM_ODM_T pDM_Odm, IN pu1Byte pDesc, - IN u1Byte macId + IN u1Byte macId ){} #elif(DM_ODM_SUPPORT_TYPE==ODM_CE) VOID ODM_SetTxAntByTxInfo_88C_92D( IN PDM_ODM_T pDM_Odm){ } @@ -7369,23 +7369,23 @@ ODM_EdcaTurboInit( Adapter=pDM_Odm->Adapter; pHalData=GET_HAL_DATA(Adapter); - pDM_Odm->DM_EDCA_Table.bCurrentTurboEDCA = FALSE; + pDM_Odm->DM_EDCA_Table.bCurrentTurboEDCA = FALSE; pDM_Odm->DM_EDCA_Table.bIsCurRDLState = FALSE; pHalData->bIsAnyNonBEPkts = FALSE; - + #elif(DM_ODM_SUPPORT_TYPE==ODM_CE) - struct adapter *Adapter = pDM_Odm->Adapter; - pDM_Odm->DM_EDCA_Table.bCurrentTurboEDCA = FALSE; + struct adapter *Adapter = pDM_Odm->Adapter; + pDM_Odm->DM_EDCA_Table.bCurrentTurboEDCA = FALSE; pDM_Odm->DM_EDCA_Table.bIsCurRDLState = FALSE; Adapter->recvpriv.bIsAnyNonBEPkts =FALSE; -#endif +#endif ODM_RT_TRACE(pDM_Odm,ODM_COMP_EDCA_TURBO,ODM_DBG_LOUD,("Orginial VO PARAM: 0x%x\n",ODM_Read4Byte(pDM_Odm,ODM_EDCA_VO_PARAM))); ODM_RT_TRACE(pDM_Odm,ODM_COMP_EDCA_TURBO,ODM_DBG_LOUD,("Orginial VI PARAM: 0x%x\n",ODM_Read4Byte(pDM_Odm,ODM_EDCA_VI_PARAM))); ODM_RT_TRACE(pDM_Odm,ODM_COMP_EDCA_TURBO,ODM_DBG_LOUD,("Orginial BE PARAM: 0x%x\n",ODM_Read4Byte(pDM_Odm,ODM_EDCA_BE_PARAM))); ODM_RT_TRACE(pDM_Odm,ODM_COMP_EDCA_TURBO,ODM_DBG_LOUD,("Orginial BK PARAM: 0x%x\n",ODM_Read4Byte(pDM_Odm,ODM_EDCA_BK_PARAM))); - + } // ODM_InitEdcaTurbo VOID @@ -7393,7 +7393,7 @@ odm_EdcaTurboCheck( IN PDM_ODM_T pDM_Odm ) { - // + // // For AP/ADSL use prtl8192cd_priv // For CE/NIC use PADAPTER // @@ -7431,7 +7431,7 @@ odm_EdcaTurboCheck( #if ((DM_ODM_SUPPORT_TYPE == ODM_AP)||(DM_ODM_SUPPORT_TYPE==ODM_ADSL)) odm_IotEngine(pDM_Odm); #endif - break; + break; } ODM_RT_TRACE(pDM_Odm,ODM_COMP_EDCA_TURBO,ODM_DBG_LOUD,("<========================odm_EdcaTurboCheck\n")); @@ -7449,13 +7449,13 @@ odm_EdcaTurboCheckCE( #if(DM_ODM_SUPPORT_TYPE==ODM_CE) struct adapter * Adapter = pDM_Odm->Adapter; - - u32 trafficIndex; + + u32 trafficIndex; u32 edca_param; u64 cur_tx_bytes = 0; u64 cur_rx_bytes = 0; u8 bbtchange = _FALSE; - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); struct xmit_priv *pxmitpriv = &(Adapter->xmitpriv); struct recv_priv *precvpriv = &(Adapter->recvpriv); struct registry_priv *pregpriv = &Adapter->registrypriv; @@ -7491,7 +7491,7 @@ odm_EdcaTurboCheckCE( { if (cur_tx_bytes > (cur_rx_bytes << 2)) { // Uplink TP is present. - trafficIndex = UP_LINK; + trafficIndex = UP_LINK; } else { // Balance TP is present. @@ -7512,7 +7512,7 @@ odm_EdcaTurboCheckCE( if ((pDM_Odm->DM_EDCA_Table.prv_traffic_idx != trafficIndex) || (!pDM_Odm->DM_EDCA_Table.bCurrentTurboEDCA)) { - + #if 0 //adjust EDCA parameter for BE queue edca_param = EDCAParam[pmlmeinfo->assoc_AP_vendor][trafficIndex]; @@ -7527,7 +7527,7 @@ odm_EdcaTurboCheckCE( edca_param = EDCAParam[HT_IOT_PEER_UNKNOWN][trafficIndex]; } #endif - + #ifdef CONFIG_PCI_HCI if(IS_92C_SERIAL(pHalData->VersionID)) { @@ -7542,7 +7542,7 @@ odm_EdcaTurboCheckCE( pDM_Odm->DM_EDCA_Table.prv_traffic_idx = trafficIndex; } - + pDM_Odm->DM_EDCA_Table.bCurrentTurboEDCA = _TRUE; } else @@ -7563,7 +7563,7 @@ dm_CheckEdcaTurbo_EXIT: precvpriv->bIsAnyNonBEPkts = _FALSE; pxmitpriv->last_tx_bytes = pxmitpriv->tx_bytes; precvpriv->last_rx_bytes = precvpriv->rx_bytes; -#endif +#endif } @@ -7585,12 +7585,12 @@ odm_EdcaTurboCheckMP( PSTA_QOS pStaQos = Adapter->MgntInfo.pStaQos; //[Win7 Count Tx/Rx statistic for Extension Port] odm_CheckEdcaTurbo's Adapter is always Default. 2009.08.20, by Bohn u8Byte Ext_curTxOkCnt = 0; - u8Byte Ext_curRxOkCnt = 0; - static u8Byte Ext_lastTxOkCnt = 0; - static u8Byte Ext_lastRxOkCnt = 0; - //For future Win7 Enable Default Port to modify AMPDU size dynamically, 2009.08.20, Bohn. + u8Byte Ext_curRxOkCnt = 0; + static u8Byte Ext_lastTxOkCnt = 0; + static u8Byte Ext_lastRxOkCnt = 0; + //For future Win7 Enable Default Port to modify AMPDU size dynamically, 2009.08.20, Bohn. u1Byte TwoPortStatus = (u1Byte)TWO_PORT_STATUS__WITHOUT_ANY_ASSOCIATE; - + #elif (DM_ODM_SUPPORT_TYPE==ODM_CE) struct dm_priv *pdmpriv = &pHalData->dmpriv; struct xmit_priv *pxmitpriv = &(Adapter->xmitpriv); @@ -7599,15 +7599,15 @@ odm_EdcaTurboCheckMP( struct mlme_ext_priv *pmlmeext = &(Adapter->mlmeextpriv); struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); #ifdef CONFIG_BT_COEXIST - struct btcoexist_priv *pbtpriv = &(pHalData->bt_coexist); + struct btcoexist_priv *pbtpriv = &(pHalData->bt_coexist); #endif u1Byte bbtchange =FALSE; #endif // Keep past Tx/Rx packet count for RT-to-RT EDCA turbo. u8Byte curTxOkCnt = 0; - u8Byte curRxOkCnt = 0; - u8Byte lastTxOkCnt = 0; - u8Byte lastRxOkCnt = 0; + u8Byte curRxOkCnt = 0; + u8Byte lastTxOkCnt = 0; + u8Byte lastRxOkCnt = 0; u4Byte EDCA_BE_UL = 0x5ea42b;//Parameter suggested by Scott //edca_setting_UL[pMgntInfo->IOTPeer]; u4Byte EDCA_BE_DL = 0x5ea42b;//Parameter suggested by Scott //edca_setting_DL[pMgntInfo->IOTPeer]; u4Byte EDCA_BE = 0x5ea42b; @@ -7616,7 +7616,7 @@ odm_EdcaTurboCheckMP( BOOLEAN bLastIsCurRDLState=FALSE; BOOLEAN bBiasOnRx=FALSE; BOOLEAN bEdcaTurboOn=FALSE; - + ODM_RT_TRACE(pDM_Odm,ODM_COMP_EDCA_TURBO,ODM_DBG_LOUD,("odm_EdcaTurboCheckMP========================>")); ODM_RT_TRACE(pDM_Odm,ODM_COMP_EDCA_TURBO,ODM_DBG_LOUD,("Orginial BE PARAM: 0x%x\n",ODM_Read4Byte(pDM_Odm,ODM_EDCA_BE_PARAM))); @@ -7625,12 +7625,12 @@ odm_EdcaTurboCheckMP( ////list paramter for different platform ////=============================== bLastIsCurRDLState=pDM_Odm->DM_EDCA_Table.bIsCurRDLState; - pbIsCurRDLState=&(pDM_Odm->DM_EDCA_Table.bIsCurRDLState); -#if (DM_ODM_SUPPORT_TYPE==ODM_MP) + pbIsCurRDLState=&(pDM_Odm->DM_EDCA_Table.bIsCurRDLState); +#if (DM_ODM_SUPPORT_TYPE==ODM_MP) // Caculate TX/RX TP: curTxOkCnt = Adapter->TxStats.NumTxBytesUnicast - pMgntInfo->lastTxOkCnt; curRxOkCnt = Adapter->RxStats.NumRxBytesUnicast - pMgntInfo->lastRxOkCnt; - if(pExtAdapter == NULL) + if(pExtAdapter == NULL) pExtAdapter = pDefaultAdapter; Ext_curTxOkCnt = pExtAdapter->TxStats.NumTxBytesUnicast - pMgntInfo->Ext_lastTxOkCnt; @@ -7647,7 +7647,7 @@ odm_EdcaTurboCheckMP( bBiasOnRx=(pMgntInfo->IOTAction & HT_IOT_ACT_EDCA_BIAS_ON_RX)?TRUE:FALSE; bEdcaTurboOn=((!pHalData->bIsAnyNonBEPkts) && (!pMgntInfo->bDisableFrameBursting))?TRUE:FALSE; ODM_RT_TRACE(pDM_Odm,ODM_COMP_EDCA_TURBO,ODM_DBG_LOUD,("bIsAnyNonBEPkts : 0x%lx bDisableFrameBursting : 0x%lx \n",pHalData->bIsAnyNonBEPkts,pMgntInfo->bDisableFrameBursting)); - + #elif(DM_ODM_SUPPORT_TYPE==ODM_CE) // Caculate TX/RX TP: curTxOkCnt = pxmitpriv->tx_bytes - pxmitpriv->last_tx_bytes; @@ -7656,7 +7656,7 @@ odm_EdcaTurboCheckMP( if(pbtpriv->BT_Coexist) { if( (pbtpriv->BT_EDCA[UP_LINK]!=0) || (pbtpriv->BT_EDCA[DOWN_LINK]!=0)) - bbtchange = TRUE; + bbtchange = TRUE; } #endif IOTPeer=pmlmeinfo->assoc_AP_vendor; @@ -7703,7 +7703,7 @@ odm_EdcaTurboCheckMP( // ODM_Write4Byte(pDM_Odm,ODM_EDCA_BE_PARAM,EDCA_BE); // } pDM_Odm->DM_EDCA_Table.bCurrentTurboEDCA = TRUE; - + ODM_RT_TRACE(pDM_Odm,ODM_COMP_EDCA_TURBO,ODM_DBG_LOUD,("EDCA_BE_DL : 0x%lx EDCA_BE_UL : 0x%lx EDCA_BE : 0x%lx \n",EDCA_BE_DL,EDCA_BE_UL,EDCA_BE)); } @@ -7747,7 +7747,7 @@ dm_CheckEdcaTurbo_EXIT: //check if edca turbo is disabled BOOLEAN odm_IsEdcaTurboDisable( - IN PDM_ODM_T pDM_Odm + IN PDM_ODM_T pDM_Odm ) { struct adapter * Adapter = pDM_Odm->Adapter; @@ -7767,7 +7767,7 @@ odm_IsEdcaTurboDisable( WirelessMode=*(pDM_Odm->pWirelessMode); #endif - + #if(BT_30_SUPPORT == 1) if(pDM_Odm->bBtDisableEdcaTurbo) { @@ -7792,18 +7792,18 @@ odm_IsEdcaTurboDisable( ODM_RT_TRACE(pDM_Odm, ODM_COMP_EDCA_TURBO,ODM_DBG_LOUD, ("IOTAction:EdcaTurboDisable\n")); return TRUE; } - + #elif(DM_ODM_SUPPORT_TYPE==ODM_CE) //suggested by Jr.Luke: open TXOP for B/G/BG/A mode 2012-0215 if((WirelessMode==ODM_WM_B)||(WirelessMode==(ODM_WM_B|ODM_WM_G)||(WirelessMode==ODM_WM_G)||(WirelessMode=ODM_WM_A)) - ODM_Write4Byte(pDM_Odm, ODM_EDCA_BE_PARAM, ODM_Read4Byte(pDM_Odm, ODM_EDCA_BE_PARAM)|0x5E0000); - + ODM_Write4Byte(pDM_Odm, ODM_EDCA_BE_PARAM, ODM_Read4Byte(pDM_Odm, ODM_EDCA_BE_PARAM)|0x5E0000); + if(pDM_Odm->SupportICType==ODM_RTL8192D) { if ((pregpriv->wifi_spec == 1) || (pmlmeext->cur_wireless_mode == WIRELESS_11B)) { ODM_RT_TRACE(pDM_Odm, ODM_COMP_EDCA_TURBO,ODM_DBG_LOUD, ("92D:EdcaTurboDisable\n")); return TRUE; } - } + } else { if((pregpriv->wifi_spec == 1) || (pmlmeinfo->HT_enable == 0)){ @@ -7821,14 +7821,14 @@ odm_IsEdcaTurboDisable( #endif return FALSE; - + } //add iot case here: for MP/CE -VOID +VOID ODM_EdcaParaSelByIot( - IN PDM_ODM_T pDM_Odm, + IN PDM_ODM_T pDM_Odm, OUT u4Byte *EDCA_BE_UL, OUT u4Byte *EDCA_BE_DL ) @@ -7845,22 +7845,22 @@ ODM_EdcaParaSelByIot( struct adapter * pDefaultAdapter = GetDefaultAdapter(Adapter); struct adapter * pExtAdapter = GetFirstExtAdapter(Adapter);//NULL; PMGNT_INFO pMgntInfo = &Adapter->MgntInfo; - u1Byte TwoPortStatus = (u1Byte)TWO_PORT_STATUS__WITHOUT_ANY_ASSOCIATE; + u1Byte TwoPortStatus = (u1Byte)TWO_PORT_STATUS__WITHOUT_ANY_ASSOCIATE; #elif(DM_ODM_SUPPORT_TYPE==ODM_CE) struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); #ifdef CONFIG_BT_COEXIST - struct btcoexist_priv *pbtpriv = &(pHalData->bt_coexist); + struct btcoexist_priv *pbtpriv = &(pHalData->bt_coexist); #endif u1Byte bbtchange =FALSE; #endif if(pDM_Odm->pWirelessMode!=NULL) WirelessMode=*(pDM_Odm->pWirelessMode); - + /////////////////////////////////////////////////////////// ////list paramter for different platform -#if (DM_ODM_SUPPORT_TYPE==ODM_MP) +#if (DM_ODM_SUPPORT_TYPE==ODM_MP) IOTPeer=pMgntInfo->IOTPeer; GetTwoPortSharedResource(Adapter,TWO_PORT_SHARED_OBJECT__STATUS,NULL,&TwoPortStatus); @@ -7870,14 +7870,14 @@ ODM_EdcaParaSelByIot( if(pbtpriv->BT_Coexist) { if( (pbtpriv->BT_EDCA[UP_LINK]!=0) || (pbtpriv->BT_EDCA[DOWN_LINK]!=0)) - bbtchange = TRUE; + bbtchange = TRUE; } #endif #endif if(ICType==ODM_RTL8192D) - { + { // Single PHY if(pDM_Odm->RFType==ODM_2T2R) { @@ -7894,7 +7894,7 @@ ODM_EdcaParaSelByIot( } ////============================ /// IOT case for MP -////============================ +////============================ #if (DM_ODM_SUPPORT_TYPE==ODM_MP) else { @@ -7911,22 +7911,22 @@ ODM_EdcaParaSelByIot( } } } - + if(TwoPortStatus == TWO_PORT_STATUS__EXTENSION_ONLY) { (*EDCA_BE_UL) = 0x5ea42b;//Parameter suggested by Scott //edca_setting_UL[ExtAdapter->MgntInfo.IOTPeer]; (*EDCA_BE_DL) = 0x5ea42b;//Parameter suggested by Scott //edca_setting_DL[ExtAdapter->MgntInfo.IOTPeer]; } - + #if (INTEL_PROXIMITY_SUPPORT == 1) if(pMgntInfo->IntelClassModeInfo.bEnableCA == TRUE) { (*EDCA_BE_UL) = (*EDCA_BE_DL) = 0xa44f; } else - #endif + #endif { - if((!pMgntInfo->bDisableFrameBursting) && + if((!pMgntInfo->bDisableFrameBursting) && (pMgntInfo->IOTAction & (HT_IOT_ACT_FORCED_ENABLE_BE_TXOP|HT_IOT_ACT_AMSDU_ENABLE))) {// To check whether we shall force turn on TXOP configuration. if(!((*EDCA_BE_UL) & 0xffff0000)) @@ -7934,14 +7934,14 @@ ODM_EdcaParaSelByIot( if(!((*EDCA_BE_DL) & 0xffff0000)) (*EDCA_BE_DL) |= 0x005e0000; // Force TxOP limit to 0x005e for DL. } - + //92D txop can't be set to 0x3e for cisco1250 if((ICType!=ODM_RTL8192D) && (IOTPeer== HT_IOT_PEER_CISCO) &&(WirelessMode==ODM_WM_N24G)) { (*EDCA_BE_DL) = edca_setting_DL[IOTPeer]; (*EDCA_BE_UL) = edca_setting_UL[IOTPeer]; } - //merge from 92s_92c_merge temp brunch v2445 20120215 + //merge from 92s_92c_merge temp brunch v2445 20120215 else if((IOTPeer == HT_IOT_PEER_CISCO) &&((WirelessMode==ODM_WM_G)||(WirelessMode==ODM_WM_A)||(WirelessMode==ODM_WM_B))) { (*EDCA_BE_DL) = edca_setting_DL_GMode[IOTPeer]; @@ -7958,12 +7958,12 @@ ODM_EdcaParaSelByIot( } else if(IOTPeer == HT_IOT_PEER_ATHEROS) { - // Set DL EDCA for Atheros peer to 0x3ea42b. Suggested by SD3 Wilson for ASUS TP issue. + // Set DL EDCA for Atheros peer to 0x3ea42b. Suggested by SD3 Wilson for ASUS TP issue. (*EDCA_BE_DL) = edca_setting_DL[IOTPeer]; } } ////============================ -/// IOT case for CE +/// IOT case for CE ////============================ #elif (DM_ODM_SUPPORT_TYPE==ODM_CE) @@ -7975,14 +7975,14 @@ ODM_EdcaParaSelByIot( (*EDCA_BE_DL)=EDCAParam[IOTPeer][DOWN_LINK]; } else if((IOTPeer == HT_IOT_PEER_AIRGO) && - ((WirelessMode==ODM_WM_B)||(WirelessMode==(ODM_WM_B|ODM_WM_G)))) + ((WirelessMode==ODM_WM_B)||(WirelessMode==(ODM_WM_B|ODM_WM_G)))) (*EDCA_BE_DL)=0x00a630; - - else if((IOTPeer== HT_IOT_PEER_ATHEROS) && + + else if((IOTPeer== HT_IOT_PEER_ATHEROS) && (WirelessMode&ODM_WM_N5G) && (Adapter->securitypriv.dot11PrivacyAlgrthm == _AES_ )) (*EDCA_BE_DL)=0xa42b; - + } //92C IOT case: else @@ -7991,7 +7991,7 @@ ODM_EdcaParaSelByIot( if(bbtchange) { (*EDCA_BE_UL) = pbtpriv->BT_EDCA[UP_LINK]; - (*EDCA_BE_DL) = pbtpriv->BT_EDCA[DOWN_LINK]; + (*EDCA_BE_DL) = pbtpriv->BT_EDCA[DOWN_LINK]; } else #endif @@ -8029,19 +8029,19 @@ ODM_EdcaParaSelByIot( VOID -odm_EdcaChooseTrafficIdx( +odm_EdcaChooseTrafficIdx( IN PDM_ODM_T pDM_Odm, - IN u8Byte cur_tx_bytes, - IN u8Byte cur_rx_bytes, - IN BOOLEAN bBiasOnRx, - OUT BOOLEAN *pbIsCurRDLState + IN u8Byte cur_tx_bytes, + IN u8Byte cur_rx_bytes, + IN BOOLEAN bBiasOnRx, + OUT BOOLEAN *pbIsCurRDLState ) -{ - - +{ + + if(bBiasOnRx) { - + if(cur_tx_bytes>(cur_rx_bytes*4)) { *pbIsCurRDLState=FALSE; @@ -8083,7 +8083,7 @@ void odm_EdcaParaInit( { prtl8192cd_priv priv = pDM_Odm->priv; int mode=priv->pmib->dot11BssType.net_work_type; - + static unsigned int slot_time, VO_TXOP, VI_TXOP, sifs_time; struct ParaRecord EDCA[4]; @@ -8119,7 +8119,7 @@ void odm_EdcaParaInit( if(OPMODE & WIFI_AP_STATE) { - memcpy(EDCA, rtl_ap_EDCA, 2*sizeof(struct ParaRecord)); + memcpy(EDCA, rtl_ap_EDCA, 2*sizeof(struct ParaRecord)); if(mode & (ODM_WM_A|ODM_WM_G|ODM_WM_N24G|ODM_WM_N5G)) memcpy(&EDCA[VI], &rtl_ap_EDCA[VI_AG], 2*sizeof(struct ParaRecord)); @@ -8128,14 +8128,14 @@ void odm_EdcaParaInit( } else { - memcpy(EDCA, rtl_sta_EDCA, 2*sizeof(struct ParaRecord)); + memcpy(EDCA, rtl_sta_EDCA, 2*sizeof(struct ParaRecord)); if(mode & (ODM_WM_A|ODM_WM_G|ODM_WM_N24G|ODM_WM_N5G)) memcpy(&EDCA[VI], &rtl_sta_EDCA[VI_AG], 2*sizeof(struct ParaRecord)); else memcpy(&EDCA[VI], &rtl_sta_EDCA[VI], 2*sizeof(struct ParaRecord)); } - + #ifdef WIFI_WMM if (QOS_ENABLE) ODM_Write4Byte(pDM_Odm, ODM_EDCA_VI_PARAM, (EDCA[VI].TXOPlimit<< 16) | (EDCA[VI].ECWmax<< 12) | (EDCA[VI].ECWmin<< 8) | (sifs_time + EDCA[VI].AIFSN* slot_time)); @@ -8147,7 +8147,7 @@ void odm_EdcaParaInit( #elif(DM_ODM_SUPPORT_TYPE==ODM_ADSL) ODM_Write4Byte(pDM_Odm, ODM_EDCA_VI_PARAM, (EDCA[BK].ECWmax<< 12) | (EDCA[BK].ECWmin<< 8) | (sifs_time + 2* slot_time)); #endif - + } @@ -8160,17 +8160,17 @@ void odm_EdcaParaInit( #if(DM_ODM_SUPPORT_TYPE==ODM_AP) if (priv->pshare->rf_ft_var.wifi_beq_iot) priv->pshare->iot_mode_VI_exist = 0; - + #ifdef WMM_VIBE_PRI priv->pshare->iot_mode_BE_exist = 0; #endif - + #ifdef LOW_TP_TXOP priv->pshare->BE_cwmax_enhance = 0; #endif #elif (DM_ODM_SUPPORT_TYPE==ODM_ADSL) - priv->pshare->iot_mode_BE_exist = 0; + priv->pshare->iot_mode_BE_exist = 0; #endif priv->pshare->iot_mode_VO_exist = 0; } @@ -8183,7 +8183,7 @@ ODM_ChooseIotMainSTA( { prtl8192cd_priv priv = pDM_Odm->priv; BOOLEAN bhighTP_found_pstat=FALSE; - + if ((GET_ROOT(priv)->up_time % 2) == 0) { unsigned int tx_2s_avg = 0; unsigned int rx_2s_avg = 0; @@ -8210,27 +8210,27 @@ ODM_ChooseIotMainSTA( priv->pshare->highTP_found_pstat = pstat; bhighTP_found_pstat=TRUE; - } + } } #elif(DM_ODM_SUPPORT_TYPE==ODM_AP) for(i=0; i<8; i++) aggReady += (pstat->ADDBA_ready[i]); - if (pstat->ht_cap_len && aggReady) + if (pstat->ht_cap_len && aggReady) { if ((tx_2s_avg + rx_2s_avg >= 25)) { priv->pshare->highTP_found_pstat = pstat; } - + #ifdef CLIENT_MODE if (OPMODE & WIFI_STATION_STATE) { #if (DM_ODM_SUPPORT_TYPE &ODM_AP) && defined(USE_OUT_SRC) if ((pstat->IOTPeer==HT_IOT_PEER_RALINK) && ((tx_2s_avg + rx_2s_avg) >= 45)) #else if(pstat->is_ralink_sta && ((tx_2s_avg + rx_2s_avg) >= 45)) -#endif +#endif priv->pshare->highTP_found_pstat = pstat; } - #endif + #endif } #endif } else { @@ -8273,7 +8273,7 @@ ODM_IotEdcaSwitch( if (mode & (ODM_WM_N24G|ODM_WM_N5G|ODM_WM_G|ODM_WM_A)) { slot_time = 9; - } + } else { BE_TXOP = 94; @@ -8295,25 +8295,25 @@ ODM_IotEdcaSwitch( ODM_Write4Byte(pDM_Odm, ODM_EDCA_VI_PARAM, ((VI_TXOP*(1-priv->pshare->iot_mode_VO_exist)) << 16)| (vi_cw_max << 12) | (vi_cw_min << 8) | vi_aifs); - + #elif (DM_ODM_SUPPORT_TYPE==ODM_AP) if ((OPMODE & WIFI_AP_STATE) && priv->pmib->dot11OperationEntry.wifi_specific) { if (priv->pshare->iot_mode_VO_exist) { #ifdef WMM_VIBE_PRI - if (priv->pshare->iot_mode_BE_exist) + if (priv->pshare->iot_mode_BE_exist) { vi_cw_max = 5; vi_cw_min = 3; vi_aifs = (sifs_time + ((OPMODE & WIFI_AP_STATE)?1:2) * slot_time); } - else + else #endif { vi_cw_max = 6; vi_cw_min = 4; vi_aifs = 0x2b; } - } + } else { vi_aifs = (sifs_time + ((OPMODE & WIFI_AP_STATE)?1:2) * slot_time); } @@ -8326,10 +8326,10 @@ ODM_IotEdcaSwitch( #if (DM_ODM_SUPPORT_TYPE==ODM_AP) - if (priv->pshare->rf_ft_var.wifi_beq_iot && priv->pshare->iot_mode_VI_exist) - ODM_Write4Byte(pDM_Odm, ODM_EDCA_BE_PARAM, (10 << 12) | (4 << 8) | 0x4f); + if (priv->pshare->rf_ft_var.wifi_beq_iot && priv->pshare->iot_mode_VI_exist) + ODM_Write4Byte(pDM_Odm, ODM_EDCA_BE_PARAM, (10 << 12) | (4 << 8) | 0x4f); else if(!enable) -#elif(DM_ODM_SUPPORT_TYPE==ODM_ADSL) +#elif(DM_ODM_SUPPORT_TYPE==ODM_ADSL) if(!enable) //if iot is disable ,maintain original BEQ PARAM #endif ODM_Write4Byte(pDM_Odm, ODM_EDCA_BE_PARAM, (((OPMODE & WIFI_AP_STATE)?6:10) << 12) | (4 << 8) @@ -8340,7 +8340,7 @@ ODM_IotEdcaSwitch( int txop; unsigned int cw_max; unsigned int txop_close; - + #if((DM_ODM_SUPPORT_TYPE==ODM_AP)&&(defined LOW_TP_TXOP)) cw_max = ((priv->pshare->BE_cwmax_enhance) ? 10 : 6); txop_close = ((priv->pshare->rf_ft_var.low_tp_txop && priv->pshare->rf_ft_var.low_tp_txop_close) ? 1 : 0); @@ -8357,30 +8357,30 @@ ODM_IotEdcaSwitch( txop=BE_TXOP*priv->pshare->txop_enlarge; #endif - + if (priv->pshare->ht_sta_num #ifdef WDS || ((OPMODE & WIFI_AP_STATE) && (mode & (ODM_WM_N24G|ODM_WM_N5G)) && priv->pmib->dot11WdsInfo.wdsEnabled && priv->pmib->dot11WdsInfo.wdsNum) #endif - ) + ) { if (priv->pshare->txop_enlarge == 0xe) { // is intel client, use a different edca value ODM_Write4Byte(pDM_Odm, ODM_EDCA_BE_PARAM, (txop<< 16) | (cw_max<< 12) | (4 << 8) | 0x1f); priv->pshare->txop_enlarge = 2; - } + } #if(DM_ODM_SUPPORT_TYPE==ODM_AP) #ifndef LOW_TP_TXOP else if (priv->pshare->txop_enlarge == 0xd) { // is intel ralink, use a different edca value ODM_Write4Byte(pDM_Odm, ODM_EDCA_BE_PARAM, (txop << 16) | (4 << 12) | (3 << 8) | 0x19); priv->pshare->txop_enlarge = 2; - } + } #endif #endif - else + else { if (pDM_Odm->RFType==ODM_2T2R) ODM_Write4Byte(pDM_Odm, ODM_EDCA_BE_PARAM, (txop << 16) | @@ -8396,7 +8396,7 @@ ODM_IotEdcaSwitch( #endif } } - else + else { #if((DM_ODM_SUPPORT_TYPE==ODM_AP)&&(defined LOW_TP_TXOP)) ODM_Write4Byte(pDM_Odm, ODM_EDCA_BE_PARAM, (BE_TXOP << 16) | (cw_max << 12) | (4 << 8) | (sifs_time + 3 * slot_time)); @@ -8409,7 +8409,7 @@ ODM_IotEdcaSwitch( } #endif -VOID +VOID odm_IotEngine( IN PDM_ODM_T pDM_Odm ) @@ -8418,10 +8418,10 @@ odm_IotEngine( struct rtl8192cd_priv *priv=pDM_Odm->priv; PSTA_INFO_T pstat = NULL; u4Byte i; - + #ifdef WIFI_WMM unsigned int switch_turbo = 0; -#endif +#endif //////////////////////////////////////////////////////// // if EDCA Turbo function is not supported or Manual EDCA Setting // then return @@ -8430,19 +8430,19 @@ odm_IotEngine( ODM_RT_TRACE(pDM_Odm, ODM_COMP_EDCA_TURBO, ODM_DBG_LOUD, ("ODM_MAC_EDCA_TURBO NOT SUPPORTED\n")); return; } - + #if((DM_ODM_SUPPORT_TYPE==ODM_AP)&& defined(RTL_MANUAL_EDCA) && defined(WIFI_WMM)) if(priv->pmib->dot11QosEntry.ManualEDCA){ ODM_RT_TRACE(pDM_Odm, ODM_COMP_EDCA_TURBO, ODM_DBG_LOUD, ("ODM_MAC_EDCA_TURBO OFF: MANUAL SETTING\n")); return ; } -#endif +#endif #if !(DM_ODM_SUPPORT_TYPE &ODM_AP) ////////////////////////////////////////////////////// //find high TP STA every 2s ////////////////////////////////////////////////////// - if ((GET_ROOT(priv)->up_time % 2) == 0) + if ((GET_ROOT(priv)->up_time % 2) == 0) priv->pshare->highTP_found_pstat==NULL; #if 0 @@ -8453,7 +8453,7 @@ odm_IotEngine( if(ODM_ChooseIotMainSTA(pDM_Odm, pstat)); //find the correct station break; - if (plist == plist->next) //the last plist + if (plist == plist->next) //the last plist break; plist = plist->next; }; @@ -8480,7 +8480,7 @@ odm_IotEngine( #ifdef WIFI_WMM if (QOS_ENABLE) { - if (!priv->pmib->dot11OperationEntry.wifi_specific + if (!priv->pmib->dot11OperationEntry.wifi_specific #if(DM_ODM_SUPPORT_TYPE==ODM_AP) ||((OPMODE & WIFI_AP_STATE) && (priv->pmib->dot11OperationEntry.wifi_specific == 2)) #elif(DM_ODM_SUPPORT_TYPE==ODM_ADSL) @@ -8506,7 +8506,7 @@ odm_IotEngine( #if(DM_ODM_SUPPORT_TYPE==ODM_AP) if ((OPMODE & WIFI_AP_STATE) && priv->pmib->dot11OperationEntry.wifi_specific) #elif (DM_ODM_SUPPORT_TYPE==ODM_ADSL) - if (priv->pmib->dot11OperationEntry.wifi_specific) + if (priv->pmib->dot11OperationEntry.wifi_specific) #endif { if (!priv->pshare->iot_mode_VO_exist && (priv->pshare->phw->VO_pkt_count > 50)) { @@ -8530,7 +8530,7 @@ odm_IotEngine( #endif #if (DM_ODM_SUPPORT_TYPE==ODM_AP) - if (priv->pshare->rf_ft_var.wifi_beq_iot) + if (priv->pshare->rf_ft_var.wifi_beq_iot) { if (!priv->pshare->iot_mode_VI_exist && (priv->pshare->phw->VI_rx_pkt_count > 50)) { priv->pshare->iot_mode_VI_exist++; @@ -8549,7 +8549,7 @@ odm_IotEngine( if (priv->pshare->iot_mode_enable) switch_turbo++; } - } + } #if(defined(CLIENT_MODE) && (DM_ODM_SUPPORT_TYPE==ODM_AP)) if ((OPMODE & WIFI_STATION_STATE) && (priv->pmib->dot11OperationEntry.wifi_specific == 2)) @@ -8582,7 +8582,7 @@ odm_IotEngine( #if((DM_ODM_SUPPORT_TYPE==ODM_ADSL)||((DM_ODM_SUPPORT_TYPE==ODM_AP)&&(defined WMM_VIBE_PRI))) priv->pshare->phw->BE_pkt_count = 0; #endif - + #if(DM_ODM_SUPPORT_TYPE==ODM_AP) if (priv->pshare->rf_ft_var.wifi_beq_iot) priv->pshare->phw->VI_rx_pkt_count = 0; @@ -8598,16 +8598,16 @@ odm_IotEngine( #ifdef WIFI_WMM #if(DM_ODM_SUPPORT_TYPE==ODM_ADSL) if (QOS_ENABLE && (!priv->pmib->dot11OperationEntry.wifi_specific || (priv->pmib->dot11OperationEntry.wifi_specific == 2) - + #elif(DM_ODM_SUPPORT_TYPE==ODM_AP) - if (QOS_ENABLE && (!priv->pmib->dot11OperationEntry.wifi_specific || + if (QOS_ENABLE && (!priv->pmib->dot11OperationEntry.wifi_specific || ((OPMODE & WIFI_AP_STATE) && (priv->pmib->dot11OperationEntry.wifi_specific == 2)) #ifdef CLIENT_MODE || ((OPMODE & WIFI_STATION_STATE) && (priv->pmib->dot11OperationEntry.wifi_specific == 2)) #endif #endif )) - + { if (pstat && pstat->rssi >= priv->pshare->rf_ft_var.txop_enlarge_upper) { @@ -8616,7 +8616,7 @@ odm_IotEngine( if (pstat->IOTPeer==HT_IOT_PEER_INTEL) #else if (pstat->is_intel_sta) -#endif +#endif { if (priv->pshare->txop_enlarge != 0xe) { @@ -8625,8 +8625,8 @@ odm_IotEngine( if (priv->pshare->iot_mode_enable) switch_turbo++; } - } - else if (priv->pshare->txop_enlarge != 2) + } + else if (priv->pshare->txop_enlarge != 2) { priv->pshare->txop_enlarge = 2; if (priv->pshare->iot_mode_enable) @@ -8637,16 +8637,16 @@ odm_IotEngine( { #if (DM_ODM_SUPPORT_TYPE &ODM_AP) && defined(USE_OUT_SRC) if (pstat->IOTPeer==HT_IOT_PEER_INTEL) -#else +#else if (pstat->is_intel_sta) -#endif - priv->pshare->txop_enlarge = 0xe; +#endif + priv->pshare->txop_enlarge = 0xe; #if (DM_ODM_SUPPORT_TYPE &ODM_AP) && defined(USE_OUT_SRC) else if (pstat->IOTPeer==HT_IOT_PEER_RALINK) #else else if (pstat->is_ralink_sta) -#endif - priv->pshare->txop_enlarge = 0xd; +#endif + priv->pshare->txop_enlarge = 0xd; else priv->pshare->txop_enlarge = 2; @@ -8655,17 +8655,17 @@ odm_IotEngine( } #endif #if 0 - if (priv->pshare->txop_enlarge != 2) + if (priv->pshare->txop_enlarge != 2) { #if(DM_ODM_SUPPORT_TYPE==ODM_AP) if (pstat->IOTPeer==HT_IOT_PEER_INTEL) #else if (pstat->is_intel_sta) - #endif + #endif priv->pshare->txop_enlarge = 0xe; #if(DM_ODM_SUPPORT_TYPE==ODM_AP) else if (pstat->IOTPeer==HT_IOT_PEER_RALINK) - priv->pshare->txop_enlarge = 0xd; + priv->pshare->txop_enlarge = 0xd; #endif else priv->pshare->txop_enlarge = 2; @@ -8674,7 +8674,7 @@ odm_IotEngine( } #endif } - else if (!pstat || pstat->rssi < priv->pshare->rf_ft_var.txop_enlarge_lower) + else if (!pstat || pstat->rssi < priv->pshare->rf_ft_var.txop_enlarge_lower) { if (priv->pshare->txop_enlarge) { priv->pshare->txop_enlarge = 0; @@ -8685,8 +8685,8 @@ odm_IotEngine( #if((DM_ODM_SUPPORT_TYPE==ODM_AP)&&( defined LOW_TP_TXOP)) // for Intel IOT, need to enlarge CW MAX from 6 to 10 - if (pstat && pstat->is_intel_sta && (((pstat->tx_avarage+pstat->rx_avarage)>>10) < - priv->pshare->rf_ft_var.cwmax_enhance_thd)) + if (pstat && pstat->is_intel_sta && (((pstat->tx_avarage+pstat->rx_avarage)>>10) < + priv->pshare->rf_ft_var.cwmax_enhance_thd)) { if (!priv->pshare->BE_cwmax_enhance && priv->pshare->iot_mode_enable) { @@ -8705,11 +8705,11 @@ odm_IotEngine( priv->pshare->current_tx_bytes = 0; priv->pshare->current_rx_bytes = 0; } - + #if((DM_ODM_SUPPORT_TYPE==ODM_AP)&& defined( SW_TX_QUEUE)) if ((priv->assoc_num > 1) && (AMPDU_ENABLE)) - { - if (priv->swq_txmac_chg >= priv->pshare->rf_ft_var.swq_en_highthd){ + { + if (priv->swq_txmac_chg >= priv->pshare->rf_ft_var.swq_en_highthd){ if ((priv->swq_en == 0)){ switch_turbo++; if (priv->pshare->txop_enlarge == 0) @@ -8768,7 +8768,7 @@ odm_IotEngine( under_thd = 0; } - if (switch_turbo) + if (switch_turbo) { priv->pshare->rf_ft_var.low_tp_txop_close = under_thd; priv->pshare->rf_ft_var.low_tp_txop_count = 0; @@ -8778,21 +8778,21 @@ odm_IotEngine( if (priv->pshare->rf_ft_var.low_tp_txop_close) { priv->pshare->rf_ft_var.low_tp_txop_count = priv->pshare->rf_ft_var.low_tp_txop_delay;; } - if (priv->pshare->rf_ft_var.low_tp_txop_count ==priv->pshare->rf_ft_var.low_tp_txop_delay) + if (priv->pshare->rf_ft_var.low_tp_txop_count ==priv->pshare->rf_ft_var.low_tp_txop_delay) - { + { priv->pshare->rf_ft_var.low_tp_txop_count = 0; priv->pshare->rf_ft_var.low_tp_txop_close = under_thd; switch_turbo++; } - } - else + } + else { priv->pshare->rf_ft_var.low_tp_txop_count = 0; } } } -#endif +#endif if (switch_turbo) ODM_IotEdcaSwitch( pDM_Odm, priv->pshare->iot_mode_enable ); @@ -8801,7 +8801,7 @@ odm_IotEngine( #endif -#if( DM_ODM_SUPPORT_TYPE == ODM_MP) +#if( DM_ODM_SUPPORT_TYPE == ODM_MP) // // 2011/07/26 MH Add an API for testing IQK fail case. // @@ -8812,7 +8812,7 @@ ODM_CheckPowerStatus( HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); PDM_ODM_T pDM_Odm = &pHalData->DM_OutSrc; - RT_RF_POWER_STATE rtState; + RT_RF_POWER_STATE rtState; PMGNT_INFO pMgntInfo = &(Adapter->MgntInfo); // 2011/07/27 MH We are not testing ready~~!! We may fail to get correct value when init sequence. @@ -8821,14 +8821,14 @@ ODM_CheckPowerStatus( ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_LOUD, ("ODM_CheckPowerStatus Return TRUE, due to initadapter")); return TRUE; } - + // // 2011/07/19 MH We can not execute tx pwoer tracking/ LLC calibrate or IQK. // - Adapter->HalFunc.GetHwRegHandler(Adapter, HW_VAR_RF_STATE, (pu1Byte)(&rtState)); + Adapter->HalFunc.GetHwRegHandler(Adapter, HW_VAR_RF_STATE, (pu1Byte)(&rtState)); if(Adapter->bDriverStopped || Adapter->bDriverIsGoingToPnpSetPowerSleep || rtState == eRfOff) { - ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_LOUD, ("ODM_CheckPowerStatus Return FALSE, due to %d/%d/%d\n", + ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_LOUD, ("ODM_CheckPowerStatus Return FALSE, due to %d/%d/%d\n", Adapter->bDriverStopped, Adapter->bDriverIsGoingToPnpSetPowerSleep, rtState)); return FALSE; } @@ -8843,13 +8843,13 @@ ODM_CheckPowerStatus( u4Byte GetPSDData( IN PDM_ODM_T pDM_Odm, - unsigned int point, + unsigned int point, u1Byte initial_gain_psd) { //unsigned int val, rfval; //int psd_report; u4Byte psd_report; - + //HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); //Debug Message //val = PHY_QueryBBReg(Adapter,0x908, bMaskDWord); @@ -8870,22 +8870,22 @@ GetPSDData( ODM_SetBBReg(pDM_Odm, 0x808, BIT22, 0); //Read PSD report, Reg8B4[15:0] psd_report = ODM_GetBBReg(pDM_Odm,0x8B4, bMaskDWord) & 0x0000FFFF; - + psd_report = (u4Byte) (ConvertTo_dB(psd_report))+(u4Byte)(initial_gain_psd-0x1c); return psd_report; } -u4Byte +u4Byte ConvertTo_dB( - u4Byte Value) + u4Byte Value) { u1Byte i; u1Byte j; u4Byte dB; Value = Value & 0xFFFF; - + for (i=0;i<8;i++) { if (Value <= dB_Invert_Table[i][11]) @@ -8915,7 +8915,7 @@ ConvertTo_dB( #endif // -// LukeLee: +// LukeLee: // PSD function will be moved to FW in future IC, but now is only implemented in MP platform // So PSD function will not be incorporated to common ODM // @@ -8923,14 +8923,14 @@ ConvertTo_dB( #define AFH_PSD 1 //0:normal PSD scan, 1: only do 20 pts PSD #define MODE_40M 0 //0:20M, 1:40M -#define PSD_TH2 3 +#define PSD_TH2 3 #define PSD_CHMIN 20 // Minimum channel number for BT AFH #define SIR_STEP_SIZE 3 -#define Smooth_Size_1 5 +#define Smooth_Size_1 5 #define Smooth_TH_1 3 -#define Smooth_Size_2 10 +#define Smooth_Size_2 10 #define Smooth_TH_2 4 -#define Smooth_Size_3 20 +#define Smooth_Size_3 20 #define Smooth_TH_3 4 #define Smooth_Step_Size 5 #define Adaptive_SIR 1 @@ -8941,7 +8941,7 @@ ConvertTo_dB( //#endif #define SCAN_INTERVAL 700 //ms #define SYN_Length 5 // for 92D - + #define LNA_Low_Gain_1 0x64 #define LNA_Low_Gain_2 0x5A #define LNA_Low_Gain_3 0x58 @@ -8973,7 +8973,7 @@ odm_PSDMonitorInit( ODM_SetBBReg(pDM_Odm, ODM_PSDREG, BIT12|BIT13, 0x1); pDM_Odm->bPSDinProcess = FALSE; pDM_Odm->bUserAssignLevel = FALSE; - + //pDM_Odm->bDMInitialGainEnable=TRUE; //change the initialization to DIGinit //Set Debug Port //PHY_SetBBReg(Adapter, 0x908, bMaskDWord, 0x803); @@ -8990,17 +8990,17 @@ VOID PatchDCTone( IN PDM_ODM_T pDM_Odm, pu4Byte PSD_report, - u1Byte initial_gain_psd + u1Byte initial_gain_psd ) { //HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); //struct adapter *pAdapter; - + u4Byte psd_report; //2 Switch to CH11 to patch CH9 and CH13 DC tone ODM_SetRFReg(pDM_Odm, RF_PATH_A, RF_CHNLBW, 0x3FF, 11); - + if(pDM_Odm->SupportICType== ODM_RTL8192D) { if((*(pDM_Odm->pMacPhyMode) == ODM_SMSP)||(*(pDM_Odm->pMacPhyMode) == ODM_DMSP)) @@ -9021,18 +9021,18 @@ PatchDCTone( ODM_SetRFReg(pDM_Odm, RF_PATH_A, 0x2C, 0xfffff, 0x01840); } } - + //Ch9 DC tone patch psd_report = GetPSDData(pDM_Odm, 96, initial_gain_psd); PSD_report[50] = psd_report; //Ch13 DC tone patch psd_report = GetPSDData(pDM_Odm, 32, initial_gain_psd); PSD_report[70] = psd_report; - + //2 Switch to CH3 to patch CH1 and CH5 DC tone ODM_SetRFReg(pDM_Odm, RF_PATH_A, RF_CHNLBW, 0x3FF, 3); - + if(pDM_Odm->SupportICType==ODM_RTL8192D) { if((*(pDM_Odm->pMacPhyMode) == ODM_SMSP)||(*(pDM_Odm->pMacPhyMode) == ODM_DMSP)) @@ -9053,7 +9053,7 @@ PatchDCTone( //PHY_SetRFReg(Adapter, RF_PATH_A, 0x2C, 0xfffff, 0x01C41); } } - + //Ch1 DC tone patch psd_report = GetPSDData(pDM_Odm, 96, initial_gain_psd); PSD_report[10] = psd_report; @@ -9069,7 +9069,7 @@ GoodChannelDecision( PDM_ODM_T pDM_Odm, ps4Byte PSD_report, pu1Byte PSD_bitmap, - u1Byte RSSI_BT, + u1Byte RSSI_BT, pu1Byte PSD_bitmap_memory) { pRXHP_T pRX_HP_Table = &pDM_Odm->DM_RXHP_Table; @@ -9081,13 +9081,13 @@ GoodChannelDecision( u1Byte bitmap, Smooth_size[3], Smooth_TH[3]; //u1Byte psd_bit; u4Byte i,n,j, byte_idx, bit_idx, good_cnt, good_cnt_smoothing, Smooth_Interval[3]; - int start_byte_idx,start_bit_idx,cur_byte_idx, cur_bit_idx,NOW_byte_idx ; - + int start_byte_idx,start_bit_idx,cur_byte_idx, cur_bit_idx,NOW_byte_idx ; + // RegB34 = PHY_QueryBBReg(Adapter,0xB34, bMaskDWord)&0xFF; if((pDM_Odm->SupportICType == ODM_RTL8192C)||(pDM_Odm->SupportICType == ODM_RTL8192D)) { - TH1 = RSSI_BT + 0x14; + TH1 = RSSI_BT + 0x14; } Smooth_size[0]=Smooth_Size_1; @@ -9102,17 +9102,17 @@ GoodChannelDecision( good_cnt = 0; if(pDM_Odm->SupportICType==ODM_RTL8723A) { - //2 Threshold + //2 Threshold if(RSSI_BT >=41) - TH1 = 113; + TH1 = 113; else if(RSSI_BT >=38) // >= -15dBm TH1 = 105; //0x69 else if((RSSI_BT >=33)&(RSSI_BT <38)) TH1 = 99+(RSSI_BT-33); //0x63 else if((RSSI_BT >=26)&(RSSI_BT<33)) TH1 = 99-(33-RSSI_BT)+2; //0x5e - else if((RSSI_BT >=24)&(RSSI_BT<26)) + else if((RSSI_BT >=24)&(RSSI_BT<26)) TH1 = 88-((RSSI_BT-24)*3); //0x58 else if((RSSI_BT >=18)&(RSSI_BT<24)) TH1 = 77+((RSSI_BT-18)*2); @@ -9128,11 +9128,11 @@ GoodChannelDecision( for (i = 0; i< 10; i++) PSD_bitmap[i] = 0; - + // Add By Gary for (i=0; i<80; i++) - pRX_HP_Table->PSD_bitmap_RXHP[i] = 0; + pRX_HP_Table->PSD_bitmap_RXHP[i] = 0; // End @@ -9156,15 +9156,15 @@ GoodChannelDecision( else { if(TH1==(RSSI_BT+0x1E)) - break; - if((TH1+2) < (RSSI_BT+0x1E)) + break; + if((TH1+2) < (RSSI_BT+0x1E)) TH1+=3; - else - TH1 = RSSI_BT+0x1E; - + else + TH1 = RSSI_BT+0x1E; + } ODM_RT_TRACE(pDM_Odm,COMP_PSD,DBG_LOUD,("PSD: decision threshold is: %d", TH1)); - + for (i = 0; i< 80; i++) { if(PSD_report[i] < TH1) @@ -9185,7 +9185,7 @@ GoodChannelDecision( ODM_RT_TRACE(pDM_Odm,COMP_PSD, DBG_LOUD,("PSD_bitmap[%u] = %d\n", 2402+n*8+i, (PSD_bitmap[n]&BIT(i))>>i)); } #endif - + //1 Start of smoothing function for (j=0;j<3;j++) @@ -9210,8 +9210,8 @@ GoodChannelDecision( cur_bit_idx = start_bit_idx; cur_byte_idx = start_byte_idx; for ( i=0; i< Smooth_size[j] ; i++) - { - NOW_byte_idx = cur_byte_idx + (i+cur_bit_idx)/8; + { + NOW_byte_idx = cur_byte_idx + (i+cur_bit_idx)/8; PSD_bitmap[NOW_byte_idx] = PSD_bitmap[NOW_byte_idx] & (~BIT( (cur_bit_idx + i)%8)); } } @@ -9229,7 +9229,7 @@ GoodChannelDecision( for (i = 0; i<8; i++) { ODM_RT_TRACE(pDM_Odm,COMP_PSD, DBG_LOUD,("PSD_bitmap[%u] = %d\n", 2402+n*8+i, (PSD_bitmap[n]&BIT(i))>>i)); - + if ( ((PSD_bitmap[n]&BIT(i))>>i) ==1) //----- Add By Gary { pRX_HP_Table->PSD_bitmap_RXHP[8*n+i] = 1; @@ -9239,7 +9239,7 @@ GoodChannelDecision( } - + good_cnt = 0; for ( i = 0; i < 10; i++) { @@ -9253,14 +9253,14 @@ GoodChannelDecision( //RT_TRACE(COMP_PSD, DBG_LOUD,("PSD: SSBT=%d, TH2=%d, TH1=%d",SSBT,TH2,TH1)); for (i = 0; i <10; i++) ODM_RT_TRACE(pDM_Odm,COMP_PSD, DBG_LOUD,("PSD: PSD_bitmap[%u]=%x",i,PSD_bitmap[i])); -/* +/* //Update bitmap memory for(i = 0; i < 80; i++) { byte_idx = i / 8; bit_idx = i -8*byte_idx; psd_bit = (PSD_bitmap[byte_idx] & BIT(bit_idx)) >> bit_idx; - bitmap = PSD_bitmap_memory[i]; + bitmap = PSD_bitmap_memory[i]; PSD_bitmap_memory[i] = (bitmap << 1) |psd_bit; } */ @@ -9276,26 +9276,26 @@ odm_PSD_Monitor( //HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); //PDM_ODM_T pDM_Odm = &pHalData->DM_OutSrc; - - unsigned int pts, start_point, stop_point, initial_gain ; + + unsigned int pts, start_point, stop_point, initial_gain ; static u1Byte PSD_bitmap_memory[80], init_memory = 0; - static u1Byte psd_cnt=0; + static u1Byte psd_cnt=0; static u4Byte PSD_report[80], PSD_report_tmp; static u8Byte lastTxOkCnt=0, lastRxOkCnt=0; - u1Byte H2C_PSD_DATA[5]={0,0,0,0,0}; + u1Byte H2C_PSD_DATA[5]={0,0,0,0,0}; static u1Byte H2C_PSD_DATA_last[5] ={0,0,0,0,0}; u1Byte idx[20]={96,99,102,106,109,112,115,118,122,125, 0,3,6,10,13,16,19,22,26,29}; u1Byte n, i, channel, BBReset,tone_idx; u1Byte PSD_bitmap[10], SSBT=0,initial_gain_psd=0, RSSI_BT=0, initialGainUpper; - s4Byte PSD_skip_start, PSD_skip_stop; + s4Byte PSD_skip_start, PSD_skip_stop; u4Byte CurrentChannel, RXIQI, RxIdleLowPwr, wlan_channel; u4Byte ReScan, Interval, Is40MHz; u8Byte curTxOkCnt, curRxOkCnt; - int cur_byte_idx, cur_bit_idx; + int cur_byte_idx, cur_bit_idx; struct adapter * Adapter = pDM_Odm->Adapter; - PMGNT_INFO pMgntInfo = &Adapter->MgntInfo; - //--------------2G band synthesizer for 92D switch RF channel using----------------- + PMGNT_INFO pMgntInfo = &Adapter->MgntInfo; + //--------------2G band synthesizer for 92D switch RF channel using----------------- u1Byte group_idx=0; u4Byte SYN_RF25=0, SYN_RF26=0, SYN_RF27=0, SYN_RF2B=0, SYN_RF2C=0; u4Byte SYN[5] = {0x25, 0x26, 0x27, 0x2B, 0x2C}; // synthesizer RF register for 2G channel @@ -9307,14 +9307,14 @@ odm_PSD_Monitor( u1Byte RSSI_BT_new = (u1Byte) ODM_GetBBReg(pDM_Odm, 0xB9C, 0xFF); u1Byte rssi_ctrl = (u1Byte) ODM_GetBBReg(pDM_Odm, 0xB38, 0xFF); //--------------------------------------------------------------------- - + if(*(pDM_Odm->pbScanInProcess)) { if((pDM_Odm->SupportICType==ODM_RTL8723A)&(pDM_Odm->SupportInterface==ODM_ITRF_PCIE)) { //pHalData->bPSDactive=FALSE; //ODM_SetTimer(pDM_Odm,&pDM_SWAT_Table->SwAntennaSwitchTimer, 100 ) - ODM_SetTimer( pDM_Odm, &pDM_Odm->PSDTimer, 900); //ms + ODM_SetTimer( pDM_Odm, &pDM_Odm->PSDTimer, 900); //ms //psd_cnt=0; } return; @@ -9364,7 +9364,7 @@ odm_PSD_Monitor( SYN_RF27 = ODM_GetRFReg(Adapter, RF_PATH_B, 0x27, bMaskDWord); SYN_RF2B = ODM_GetRFReg(Adapter, RF_PATH_B, 0x2B, bMaskDWord); SYN_RF2C = ODM_GetRFReg(Adapter, RF_PATH_B, 0x2C, bMaskDWord); - } + } else // DualMAC_DualPHY 2G { SYN_RF25 = ODM_GetRFReg(Adapter, RF_PATH_A, 0x25, bMaskDWord); @@ -9392,7 +9392,7 @@ odm_PSD_Monitor( //Pause TX Queue //PlatformEFIOWrite1Byte(Adapter, REG_TXPAUSE, 0xFF); ODM_Write1Byte(pDM_Odm,REG_TXPAUSE, 0xFF); - + //Force RX to stop TX immediately //PHY_SetRFReg(Adapter, RF_PATH_A, RF_AC, bRFRegOffsetMask, 0x32E13); @@ -9405,21 +9405,21 @@ odm_PSD_Monitor( ODM_SetBBReg(pDM_Odm, 0xC70, BIT0, 0); ODM_SetBBReg(pDM_Odm, 0xC7C, BIT20, 0); - + //Turn off CCA //PHY_SetBBReg(Adapter, 0xC14, bMaskDWord, 0x0); ODM_SetBBReg(pDM_Odm, 0xC14, bMaskDWord, 0x0); - + //BB Reset //BBReset = PlatformEFIORead1Byte(Adapter, 0x02); BBReset = ODM_Read1Byte(pDM_Odm, 0x02); - + //PlatformEFIOWrite1Byte(Adapter, 0x02, BBReset&(~BIT0)); //PlatformEFIOWrite1Byte(Adapter, 0x02, BBReset|BIT0); ODM_Write1Byte(pDM_Odm, 0x02, BBReset&(~BIT0)); ODM_Write1Byte(pDM_Odm, 0x02, BBReset|BIT0); - + //1 Leave RX idle low power //PHY_SetBBReg(Adapter, 0x818, BIT28, 0x0); @@ -9435,22 +9435,22 @@ odm_PSD_Monitor( else if((pDM_Odm->SupportICType==ODM_RTL8192C)||(pDM_Odm->SupportICType==ODM_RTL8192D)) RSSI_BT = RSSI_BT_new; - - + + ODM_RT_TRACE(pDM_Odm,COMP_PSD, DBG_LOUD,("PSD: RSSI_BT= %d\n", RSSI_BT)); - + if(pDM_Odm->SupportICType==ODM_RTL8723A) { //Neil add--2011--10--12 - //2 Initial Gain index + //2 Initial Gain index if(RSSI_BT >=35) // >= -15dBm initial_gain_psd = RSSI_BT*2; else if((RSSI_BT >=33)&(RSSI_BT<35)) initial_gain_psd = RSSI_BT*2+6; else if((RSSI_BT >=24)&(RSSI_BT<33)) initial_gain_psd = 70-(31-RSSI_BT); - else if((RSSI_BT >=19)&(RSSI_BT<24)) + else if((RSSI_BT >=19)&(RSSI_BT<24)) initial_gain_psd = 64-((24-RSSI_BT)*4); else if((RSSI_BT >=14)&(RSSI_BT<19)) initial_gain_psd = 44-((18-RSSI_BT)*2); @@ -9462,12 +9462,12 @@ odm_PSD_Monitor( else { if(rssi_ctrl == 1) // just for debug!! - initial_gain_psd = RSSI_BT_new ; - else - { - //need to do - initial_gain_psd = pDM_Odm->RSSI_Min; // PSD report based on RSSI - } + initial_gain_psd = RSSI_BT_new ; + else + { + //need to do + initial_gain_psd = pDM_Odm->RSSI_Min; // PSD report based on RSSI + } } //if(RSSI_BT<0x17) // RSSI_BT +=3; @@ -9475,7 +9475,7 @@ odm_PSD_Monitor( ODM_RT_TRACE(pDM_Odm,COMP_PSD, DBG_LOUD,("PSD: RSSI_BT= %d\n", RSSI_BT)); //initialGainUpper = 0x5E; //Modify by neil chen - + if(pDM_Odm->bUserAssignLevel) { pDM_Odm->bUserAssignLevel = FALSE; @@ -9485,7 +9485,7 @@ odm_PSD_Monitor( { initialGainUpper = 0x5E; } - + /* if (initial_gain_psd < 0x1a) initial_gain_psd = 0x1a; @@ -9500,7 +9500,7 @@ odm_PSD_Monitor( RSSI_BT = initial_gain_psd; SSBT = RSSI_BT; } - + //if(IS_HARDWARE_TYPE_8723AE(Adapter)) // SSBT = RSSI_BT * 2 +0x3E; //else if((IS_HARDWARE_TYPE_8192C(Adapter))||(IS_HARDWARE_TYPE_8192D(Adapter))) // Add by Gary @@ -9515,7 +9515,7 @@ odm_PSD_Monitor( //pMgntInfo->bDMInitialGainEnable = FALSE; pDM_Odm->bDMInitialGainEnable = FALSE; initial_gain = ODM_GetBBReg(pDM_Odm, 0xc50, bMaskDWord) & 0x7F; - ODM_SetBBReg(pDM_Odm, 0xc50, 0x7F, initial_gain_psd); + ODM_SetBBReg(pDM_Odm, 0xc50, 0x7F, initial_gain_psd); //1 Turn off 3-wire ODM_SetBBReg(pDM_Odm, 0x88c, BIT20|BIT21|BIT22|BIT23, 0xF); @@ -9546,14 +9546,14 @@ odm_PSD_Monitor( start_point = 512; stop_point = 1536; } - + //3 Skip WLAN channels if WLAN busy curTxOkCnt = *(pDM_Odm->pNumTxBytesUnicast) - lastTxOkCnt; curRxOkCnt = *(pDM_Odm->pNumRxBytesUnicast) - lastRxOkCnt; lastTxOkCnt = *(pDM_Odm->pNumTxBytesUnicast); - lastRxOkCnt = *(pDM_Odm->pNumRxBytesUnicast); + lastRxOkCnt = *(pDM_Odm->pNumRxBytesUnicast); PSD_skip_start=80; PSD_skip_stop = 0; @@ -9575,7 +9575,7 @@ odm_PSD_Monitor( else { PSD_skip_start = ((wlan_channel-1)*5 -Is40MHz*10)-10; // Modify by Neil to add 10 chs to mask - PSD_skip_stop = (PSD_skip_start + (1+Is40MHz)*20)+18; + PSD_skip_stop = (PSD_skip_start + (1+Is40MHz)*20)+18; } } else @@ -9602,9 +9602,9 @@ odm_PSD_Monitor( else { PSD_skip_start = ((wlan_channel-1)*5 -Is40MHz*10)-10; // Modify by Neil to add 10 chs to mask - PSD_skip_stop = (PSD_skip_start + (1+Is40MHz)*20)+18; + PSD_skip_stop = (PSD_skip_start + (1+Is40MHz)*20)+18; } - + if(PSD_skip_start < 0) PSD_skip_start = 0; if(PSD_skip_stop >80) @@ -9619,21 +9619,21 @@ odm_PSD_Monitor( PSD_skip_start = (wlan_channel-1)*5 -Is40MHz*10; PSD_skip_stop = PSD_skip_start + (1+Is40MHz)*20; } - } + } ODM_RT_TRACE(pDM_Odm,COMP_PSD,DBG_LOUD,("PSD: Skip tone from %d to %d \n", PSD_skip_start, PSD_skip_stop)); - for (n=0;n<80;n++) - { - if((n%20)==0) - { + for (n=0;n<80;n++) + { + if((n%20)==0) + { channel = (n/20)*4 + 1; /* if(pDM_Odm->SupportICType==ODM_RTL8192D) { switch(channel) { - case 1: + case 1: case 9: group_idx = 0; break; @@ -9641,11 +9641,11 @@ odm_PSD_Monitor( group_idx = 2; break; case 13: - group_idx = 1; + group_idx = 1; break; } - - if((pHalData->MacPhyMode92D == SINGLEMAC_SINGLEPHY)||(pHalData->MacPhyMode92D == DUALMAC_SINGLEPHY)) + + if((pHalData->MacPhyMode92D == SINGLEMAC_SINGLEPHY)||(pHalData->MacPhyMode92D == DUALMAC_SINGLEPHY)) { for(i = 0; i < SYN_Length; i++) ODM_SetRFReg(pDM_Odm, RF_PATH_B, SYN[i], bMaskDWord, SYN_group[group_idx][i]); @@ -9656,8 +9656,8 @@ odm_PSD_Monitor( else // DualMAC_DualPHY 2G { for(i = 0; i < SYN_Length; i++) - ODM_SetRFReg(pDM_Odm, RF_PATH_A, SYN[i], bMaskDWord, SYN_group[group_idx][i]); - + ODM_SetRFReg(pDM_Odm, RF_PATH_A, SYN[i], bMaskDWord, SYN_group[group_idx][i]); + ODM_SetRFReg(pDM_Odm, RF_PATH_A, RF_CHNLBW, 0x3FF, channel); } } @@ -9666,7 +9666,7 @@ odm_PSD_Monitor( } tone_idx = n%20; if ((n>=PSD_skip_start) && (n PSD_report[n]) PSD_report[n] = PSD_report_tmp; - + } } PatchDCTone(pDM_Odm, PSD_report, initial_gain_psd); - + //----end //1 Turn on RX //Rx AGC on @@ -9691,7 +9691,7 @@ odm_PSD_Monitor( ODM_SetBBReg(pDM_Odm, rFPGA0_RFMOD, BIT24, 1); //1 Turn on TX //Resume TX Queue - + ODM_Write1Byte(pDM_Odm,REG_TXPAUSE, 0x00); //Turn on 3-wire ODM_SetBBReg(pDM_Odm, 0x88c, BIT20|BIT21|BIT22|BIT23, 0x0); @@ -9728,11 +9728,11 @@ odm_PSD_Monitor( //Restore RX idle low power if(RxIdleLowPwr == TRUE) ODM_SetBBReg(pDM_Odm, 0x818, BIT28, 1); - + psd_cnt++; ODM_RT_TRACE(pDM_Odm,COMP_PSD, DBG_LOUD,("PSD:psd_cnt = %d \n",psd_cnt)); if (psd_cnt < ReScan) - ODM_SetTimer(pDM_Odm, &pDM_Odm->PSDTimer, Interval); + ODM_SetTimer(pDM_Odm, &pDM_Odm->PSDTimer, Interval); else { psd_cnt = 0; @@ -9749,14 +9749,14 @@ odm_PSD_Monitor( cur_bit_idx=0; //2 Restore H2C PSD Data to Last Data - H2C_PSD_DATA_last[0] = H2C_PSD_DATA[0]; + H2C_PSD_DATA_last[0] = H2C_PSD_DATA[0]; H2C_PSD_DATA_last[1] = H2C_PSD_DATA[1]; H2C_PSD_DATA_last[2] = H2C_PSD_DATA[2]; H2C_PSD_DATA_last[3] = H2C_PSD_DATA[3]; H2C_PSD_DATA_last[4] = H2C_PSD_DATA[4]; - - //2 Translate 80bit channel map to 40bit channel + + //2 Translate 80bit channel map to 40bit channel for ( i=0;i<5;i++) { for(n=0;n<8;n++) @@ -9768,7 +9768,7 @@ odm_PSD_Monitor( } ODM_RT_TRACE(pDM_Odm,COMP_PSD, DBG_LOUD,("H2C_PSD_DATA[%d]=0x%x\n" ,i, H2C_PSD_DATA[i])); } - + //3 To Compare the difference for ( i=0;i<5;i++) { @@ -9781,12 +9781,12 @@ odm_PSD_Monitor( else { if(i==5) - ODM_RT_TRACE(pDM_Odm,COMP_PSD, DBG_LOUD,("Not need to Update\n")); + ODM_RT_TRACE(pDM_Odm,COMP_PSD, DBG_LOUD,("Not need to Update\n")); } } //pHalData->bPSDactive=FALSE; ODM_SetTimer(pDM_Odm, &pDM_Odm->PSDTimer, 900); - ODM_RT_TRACE( pDM_Odm,COMP_PSD, DBG_LOUD,("Leave dm_PSD_Monitor\n")); + ODM_RT_TRACE( pDM_Odm,COMP_PSD, DBG_LOUD,("Leave dm_PSD_Monitor\n")); } } } @@ -9809,29 +9809,29 @@ ODM_PSDMonitor( ) { //HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); - + //if(IS_HARDWARE_TYPE_8723AE(Adapter)) - + if(pDM_Odm->SupportICType == ODM_RTL8723A) //may need to add other IC type { if(pDM_Odm->SupportInterface==ODM_ITRF_PCIE) { #if(BT_30_SUPPORT == 1) if(pDM_Odm->bBtDisabled) //need to check upper layer connection - { + { ODM_RT_TRACE(pDM_Odm,COMP_PSD, DBG_LOUD, ("odm_PSDMonitor, return for BT is disabled!!!\n")); - return; + return; } #endif ODM_RT_TRACE(pDM_Odm,COMP_PSD, DBG_LOUD, ("odm_PSDMonitor\n")); //if(pHalData->bPSDactive ==FALSE) //{ pDM_Odm->bPSDinProcess = TRUE; - //pHalData->bPSDactive=TRUE; + //pHalData->bPSDactive=TRUE; odm_PSD_Monitor(pDM_Odm); pDM_Odm->bPSDinProcess = FALSE; - } - } + } + } } VOID @@ -9884,7 +9884,7 @@ ODM_PSDDbgControl( { pDM_Odm->RSSI_BT = (u1Byte)btRssi; pDM_Odm->bUserAssignLevel = TRUE; - ODM_SetTimer( pDM_Odm, &pDM_Odm->PSDTimer, 0); //ms + ODM_SetTimer( pDM_Odm, &pDM_Odm->PSDTimer, 0); //ms } else { @@ -9901,7 +9901,7 @@ void odm_RXHPInit( { #if (DEV_BUS_TYPE == RT_PCI_INTERFACE)|(DEV_BUS_TYPE == RT_USB_INTERFACE) pRXHP_T pRX_HP_Table = &pDM_Odm->DM_RXHP_Table; - u1Byte index; + u1Byte index; pRX_HP_Table->RXHP_enable = TRUE; pRX_HP_Table->RXHP_flag = 0; @@ -9929,33 +9929,33 @@ void odm_RXHP( pDIG_T pDM_DigTable = &pDM_Odm->DM_DigTable; pRXHP_T pRX_HP_Table = &pDM_Odm->DM_RXHP_Table; PFALSE_ALARM_STATISTICS FalseAlmCnt = &(pDM_Odm->FalseAlmCnt); - - u1Byte i, j, sum; + + u1Byte i, j, sum; u1Byte Is40MHz; - s1Byte Intf_diff_idx, MIN_Intf_diff_idx = 16; - s4Byte cur_channel; - u1Byte ch_map_intf_5M[17] = {0}; - static u4Byte FA_TH = 0; - static u1Byte psd_intf_flag = 0; - static s4Byte curRssi = 0; - static s4Byte preRssi = 0; + s1Byte Intf_diff_idx, MIN_Intf_diff_idx = 16; + s4Byte cur_channel; + u1Byte ch_map_intf_5M[17] = {0}; + static u4Byte FA_TH = 0; + static u1Byte psd_intf_flag = 0; + static s4Byte curRssi = 0; + static s4Byte preRssi = 0; static u1Byte PSDTriggerCnt = 1; - + u1Byte RX_HP_enable = (u1Byte)(ODM_GetBBReg(pDM_Odm, rOFDM0_XAAGCCore2, bMaskDWord)>>31); // for debug!! -#if(DEV_BUS_TYPE == RT_USB_INTERFACE) - static s8Byte lastTxOkCnt = 0, lastRxOkCnt = 0; +#if(DEV_BUS_TYPE == RT_USB_INTERFACE) + static s8Byte lastTxOkCnt = 0, lastRxOkCnt = 0; s8Byte curTxOkCnt, curRxOkCnt; s8Byte curTPOkCnt; s8Byte TP_Acc3, TP_Acc5; static s8Byte TP_Buff[5] = {0}; static u1Byte pre_state = 0, pre_state_flag = 0; - static u1Byte Intf_HighTP_flag = 0, De_counter = 16; + static u1Byte Intf_HighTP_flag = 0, De_counter = 16; static u1Byte TP_Degrade_flag = 0; -#endif +#endif static u1Byte LatchCnt = 0; - - if((pDM_Odm->SupportICType == ODM_RTL8723A)||(pDM_Odm->SupportICType == ODM_RTL8188E)) + + if((pDM_Odm->SupportICType == ODM_RTL8723A)||(pDM_Odm->SupportICType == ODM_RTL8188E)) return; //AGC RX High Power Mode is only applied on 2G band in 92D!!! if(pDM_Odm->SupportICType == ODM_RTL8192D) @@ -9984,7 +9984,7 @@ void odm_RXHP( return; } -#if(DEV_BUS_TYPE == RT_USB_INTERFACE) +#if(DEV_BUS_TYPE == RT_USB_INTERFACE) //2 Record current TP for USB interface curTxOkCnt = *(pDM_Odm->pNumTxBytesUnicast)-lastTxOkCnt; curRxOkCnt = *(pDM_Odm->pNumRxBytesUnicast)-lastRxOkCnt; @@ -9992,10 +9992,10 @@ void odm_RXHP( lastRxOkCnt = *(pDM_Odm->pNumRxBytesUnicast); curTPOkCnt = curTxOkCnt+curRxOkCnt; - TP_Buff[0] = curTPOkCnt; // current TP + TP_Buff[0] = curTPOkCnt; // current TP TP_Acc3 = PlatformDivision64((TP_Buff[1]+TP_Buff[2]+TP_Buff[3]), 3); TP_Acc5 = PlatformDivision64((TP_Buff[0]+TP_Buff[1]+TP_Buff[2]+TP_Buff[3]+TP_Buff[4]), 5); - + if(TP_Acc5 < 1000) pRX_HP_Table->TP_Mode = Idle_Mode; else if((1000 < TP_Acc5)&&(TP_Acc5 < 3750000)) @@ -10003,7 +10003,7 @@ void odm_RXHP( else pRX_HP_Table->TP_Mode = High_TP_Mode; - ODM_RT_TRACE(pDM_Odm, ODM_COMP_RXHP, ODM_DBG_LOUD, ("RX HP TP Mode = %d\n", pRX_HP_Table->TP_Mode)); + ODM_RT_TRACE(pDM_Odm, ODM_COMP_RXHP, ODM_DBG_LOUD, ("RX HP TP Mode = %d\n", pRX_HP_Table->TP_Mode)); // Since TP result would be sampled every 2 sec, it needs to delay 4sec to wait PSD processing. // When LatchCnt = 0, we would Get PSD result. if(TP_Degrade_flag == 1) @@ -10031,42 +10031,42 @@ void odm_RXHP( //3 NOT applied 1. Ad Hoc Mode. //3 NOT applied 2. AP Mode if ((pMgntInfo->mAssoc) && (!pMgntInfo->mIbss) && (!ACTING_AS_AP(Adapter))) - { + { Is40MHz = *(pDM_Odm->pBandWidth); curRssi = pDM_Odm->RSSI_Min; cur_channel = ODM_GetRFReg(pDM_Odm, RF_PATH_A, RF_CHNLBW, 0x0fff) & 0x0f; - ODM_RT_TRACE(pDM_Odm, ODM_COMP_RXHP, ODM_DBG_LOUD, ("RXHP RX HP flag = %d\n", pRX_HP_Table->RXHP_flag)); + ODM_RT_TRACE(pDM_Odm, ODM_COMP_RXHP, ODM_DBG_LOUD, ("RXHP RX HP flag = %d\n", pRX_HP_Table->RXHP_flag)); ODM_RT_TRACE(pDM_Odm, ODM_COMP_RXHP, ODM_DBG_LOUD, ("RXHP FA = %d\n", FalseAlmCnt->Cnt_all)); ODM_RT_TRACE(pDM_Odm, ODM_COMP_RXHP, ODM_DBG_LOUD, ("RXHP cur RSSI = %d, pre RSSI=%d\n", curRssi, preRssi)); ODM_RT_TRACE(pDM_Odm, ODM_COMP_RXHP, ODM_DBG_LOUD, ("RXHP current CH = %d\n", cur_channel)); ODM_RT_TRACE(pDM_Odm, ODM_COMP_RXHP, ODM_DBG_LOUD, ("RXHP Is 40MHz = %d\n", Is40MHz)); - //2 PSD function would be triggered - //3 1. Every 4 sec for PCIE - //3 2. Before TP Mode (Idle TP<4kbps) for USB - //3 3. After TP Mode (High TP) for USB - if((curRssi > 68) && (pRX_HP_Table->RXHP_flag == 0)) // Only RSSI>TH and RX_HP_flag=0 will Do PSD process + //2 PSD function would be triggered + //3 1. Every 4 sec for PCIE + //3 2. Before TP Mode (Idle TP<4kbps) for USB + //3 3. After TP Mode (High TP) for USB + if((curRssi > 68) && (pRX_HP_Table->RXHP_flag == 0)) // Only RSSI>TH and RX_HP_flag=0 will Do PSD process { #if (DEV_BUS_TYPE == RT_USB_INTERFACE) //2 Before TP Mode ==> PSD would be trigger every 4 sec if(pRX_HP_Table->TP_Mode == Idle_Mode) //2.1 less wlan traffic <4kbps { #endif - if(PSDTriggerCnt == 1) - { + if(PSDTriggerCnt == 1) + { odm_PSD_RXHP(pDM_Odm); pRX_HP_Table->PSD_func_trigger = 1; PSDTriggerCnt = 0; } else { - PSDTriggerCnt++; + PSDTriggerCnt++; } #if(DEV_BUS_TYPE == RT_USB_INTERFACE) - } + } //2 After TP Mode ==> Check if TP degrade larger than 20% would trigger PSD function if(pRX_HP_Table->TP_Mode == High_TP_Mode) { - if((pre_state_flag == 0)&&(LatchCnt == 0)) + if((pre_state_flag == 0)&&(LatchCnt == 0)) { // TP var < 5% if((((curTPOkCnt-TP_Acc3)*20)<(TP_Acc3))&&(((curTPOkCnt-TP_Acc3)*20)>(-TP_Acc3))) @@ -10085,7 +10085,7 @@ void odm_RXHP( } } //3 If pre_state_flag=1 ==> start to monitor TP degrade 20% - if(pre_state_flag == 1) + if(pre_state_flag == 1) { if(((TP_Acc3-curTPOkCnt)*5)>(TP_Acc3)) // degrade 20% { @@ -10122,41 +10122,41 @@ void odm_RXHP( TP_Buff[4-i] = TP_Buff[3-i]; } #endif - //2 Update PSD bitmap according to PSD report + //2 Update PSD bitmap according to PSD report if((pRX_HP_Table->PSD_func_trigger == 1)&&(LatchCnt == 0)) - { - //2 Separate 80M bandwidth into 16 group with smaller 5M BW. + { + //2 Separate 80M bandwidth into 16 group with smaller 5M BW. for (i = 0 ; i < 16 ; i++) - { + { sum = 0; for(j = 0; j < 5 ; j++) - sum += pRX_HP_Table->PSD_bitmap_RXHP[5*i + j]; - - if(sum < 5) - { - ch_map_intf_5M[i] = 1; // interference flag - } - } + sum += pRX_HP_Table->PSD_bitmap_RXHP[5*i + j]; + + if(sum < 5) + { + ch_map_intf_5M[i] = 1; // interference flag + } + } //=============just for debug========================= //for(i=0;i<16;i++) //DbgPrint("RX HP: ch_map_intf_5M[%d] = %d\n", i, ch_map_intf_5M[i]); //=============================================== //2 Mask target channel 5M index - for(i = 0; i < (4+4*Is40MHz) ; i++) - { - ch_map_intf_5M[cur_channel - (1+2*Is40MHz) + i] = 0; - } - - psd_intf_flag = 0; - for(i = 0; i < 16; i++) - { - if(ch_map_intf_5M[i] == 1) - { - psd_intf_flag = 1; // interference is detected!!! - break; - } - } - + for(i = 0; i < (4+4*Is40MHz) ; i++) + { + ch_map_intf_5M[cur_channel - (1+2*Is40MHz) + i] = 0; + } + + psd_intf_flag = 0; + for(i = 0; i < 16; i++) + { + if(ch_map_intf_5M[i] == 1) + { + psd_intf_flag = 1; // interference is detected!!! + break; + } + } + #if (DEV_BUS_TYPE == RT_USB_INTERFACE) if(pRX_HP_Table->TP_Mode!=Idle_Mode) { @@ -10169,99 +10169,99 @@ void odm_RXHP( #endif ODM_RT_TRACE(pDM_Odm, ODM_COMP_RXHP, ODM_DBG_LOUD, ("RX HP psd_intf_flag = %d\n", psd_intf_flag)); //2 Distance between target channel and interference - for(i = 0; i < 16; i++) - { + for(i = 0; i < 16; i++) + { if(ch_map_intf_5M[i] == 1) - { - Intf_diff_idx = ((cur_channel+Is40MHz-(i+1))>0) ? (s1Byte)(cur_channel-2*Is40MHz-(i-2)) : (s1Byte)((i+1)-(cur_channel+2*Is40MHz)); - if(Intf_diff_idx < MIN_Intf_diff_idx) + { + Intf_diff_idx = ((cur_channel+Is40MHz-(i+1))>0) ? (s1Byte)(cur_channel-2*Is40MHz-(i-2)) : (s1Byte)((i+1)-(cur_channel+2*Is40MHz)); + if(Intf_diff_idx < MIN_Intf_diff_idx) MIN_Intf_diff_idx = Intf_diff_idx; // the min difference index between interference and target - } - } - ODM_RT_TRACE(pDM_Odm, ODM_COMP_RXHP, ODM_DBG_LOUD, ("RX HP MIN_Intf_diff_idx = %d\n", MIN_Intf_diff_idx)); + } + } + ODM_RT_TRACE(pDM_Odm, ODM_COMP_RXHP, ODM_DBG_LOUD, ("RX HP MIN_Intf_diff_idx = %d\n", MIN_Intf_diff_idx)); //2 Choose False Alarm Threshold switch (MIN_Intf_diff_idx){ - case 0: - case 1: - case 2: - case 3: - FA_TH = FA_RXHP_TH1; - break; - case 4: // CH5 - case 5: // CH6 - FA_TH = FA_RXHP_TH2; - break; - case 6: // CH7 - case 7: // CH8 - FA_TH = FA_RXHP_TH3; - break; - case 8: // CH9 - case 9: //CH10 - FA_TH = FA_RXHP_TH4; - break; - case 10: - case 11: - case 12: - case 13: - case 14: - case 15: - FA_TH = FA_RXHP_TH5; - break; - } + case 0: + case 1: + case 2: + case 3: + FA_TH = FA_RXHP_TH1; + break; + case 4: // CH5 + case 5: // CH6 + FA_TH = FA_RXHP_TH2; + break; + case 6: // CH7 + case 7: // CH8 + FA_TH = FA_RXHP_TH3; + break; + case 8: // CH9 + case 9: //CH10 + FA_TH = FA_RXHP_TH4; + break; + case 10: + case 11: + case 12: + case 13: + case 14: + case 15: + FA_TH = FA_RXHP_TH5; + break; + } ODM_RT_TRACE(pDM_Odm, ODM_COMP_RXHP, ODM_DBG_LOUD, ("RX HP FA_TH = %d\n", FA_TH)); pRX_HP_Table->PSD_func_trigger = 0; } //1 Monitor RSSI variation to choose the suitable IGI or Exit AGC RX High Power Mode - if(pRX_HP_Table->RXHP_flag == 1) - { - if ((curRssi > 80)&&(preRssi < 80)) - { - pRX_HP_Table->Cur_IGI = LNA_Low_Gain_1; - } - else if ((curRssi < 80)&&(preRssi > 80)) - { - pRX_HP_Table->Cur_IGI = LNA_Low_Gain_2; + if(pRX_HP_Table->RXHP_flag == 1) + { + if ((curRssi > 80)&&(preRssi < 80)) + { + pRX_HP_Table->Cur_IGI = LNA_Low_Gain_1; + } + else if ((curRssi < 80)&&(preRssi > 80)) + { + pRX_HP_Table->Cur_IGI = LNA_Low_Gain_2; } - else if ((curRssi > 72)&&(preRssi < 72)) - { - pRX_HP_Table->Cur_IGI = LNA_Low_Gain_2; - } - else if ((curRssi < 72)&&( preRssi > 72)) - { - pRX_HP_Table->Cur_IGI = LNA_Low_Gain_3; - } - else if (curRssi < 68) //RSSI is NOT large enough!!==> Exit AGC RX High Power Mode - { - pRX_HP_Table->Cur_pw_th = pw_th_10dB; - pRX_HP_Table->RXHP_flag = 0; // Back to Normal DIG Mode + else if ((curRssi > 72)&&(preRssi < 72)) + { + pRX_HP_Table->Cur_IGI = LNA_Low_Gain_2; + } + else if ((curRssi < 72)&&( preRssi > 72)) + { + pRX_HP_Table->Cur_IGI = LNA_Low_Gain_3; + } + else if (curRssi < 68) //RSSI is NOT large enough!!==> Exit AGC RX High Power Mode + { + pRX_HP_Table->Cur_pw_th = pw_th_10dB; + pRX_HP_Table->RXHP_flag = 0; // Back to Normal DIG Mode psd_intf_flag = 0; } } else // pRX_HP_Table->RXHP_flag == 0 { //1 Decide whether to enter AGC RX High Power Mode - if ((curRssi > 70) && (psd_intf_flag == 1) && (FalseAlmCnt->Cnt_all > FA_TH) && + if ((curRssi > 70) && (psd_intf_flag == 1) && (FalseAlmCnt->Cnt_all > FA_TH) && (pDM_DigTable->CurIGValue == pDM_DigTable->rx_gain_range_max)) { - if (curRssi > 80) - { + if (curRssi > 80) + { pRX_HP_Table->Cur_IGI = LNA_Low_Gain_1; } - else if (curRssi > 72) - { - pRX_HP_Table->Cur_IGI = LNA_Low_Gain_2; + else if (curRssi > 72) + { + pRX_HP_Table->Cur_IGI = LNA_Low_Gain_2; } - else - { - pRX_HP_Table->Cur_IGI = LNA_Low_Gain_3; + else + { + pRX_HP_Table->Cur_IGI = LNA_Low_Gain_3; } - pRX_HP_Table->Cur_pw_th = pw_th_16dB; //RegC54[9:8]=2'b11: to enter AGC Flow 3 + pRX_HP_Table->Cur_pw_th = pw_th_16dB; //RegC54[9:8]=2'b11: to enter AGC Flow 3 pRX_HP_Table->First_time_enter = TRUE; pRX_HP_Table->RXHP_flag = 1; // RXHP_flag=1: AGC RX High Power Mode, RXHP_flag=0: Normal DIG Mode } } - preRssi = curRssi; - odm_Write_RXHP(pDM_Odm); + preRssi = curRssi; + odm_Write_RXHP(pDM_Odm); } #endif //#if( DM_ODM_SUPPORT_TYPE & (ODM_MP)) #endif //#if (DEV_BUS_TYPE == RT_PCI_INTERFACE) | (DEV_BUS_TYPE == RT_USB_INTERFACE) @@ -10276,9 +10276,9 @@ void odm_Write_RXHP( if(pRX_HP_Table->Cur_IGI != pRX_HP_Table->Pre_IGI) { ODM_SetBBReg(pDM_Odm, rOFDM0_XAAGCCore1, bMaskByte0, pRX_HP_Table->Cur_IGI); - ODM_SetBBReg(pDM_Odm, rOFDM0_XBAGCCore1, bMaskByte0, pRX_HP_Table->Cur_IGI); + ODM_SetBBReg(pDM_Odm, rOFDM0_XBAGCCore1, bMaskByte0, pRX_HP_Table->Cur_IGI); } - + if(pRX_HP_Table->Cur_pw_th != pRX_HP_Table->Pre_pw_th) { ODM_SetBBReg(pDM_Odm, rOFDM0_XAAGCCore2, BIT8|BIT9, pRX_HP_Table->Cur_pw_th); // RegC54[9:8]=2'b11: AGC Flow 3 @@ -10294,7 +10294,7 @@ void odm_Write_RXHP( if(currentIGI<0x50) { ODM_SetBBReg(pDM_Odm, rOFDM0_XAAGCCore1, bMaskByte0, pRX_HP_Table->Cur_IGI); - ODM_SetBBReg(pDM_Odm, rOFDM0_XBAGCCore1, bMaskByte0, pRX_HP_Table->Cur_IGI); + ODM_SetBBReg(pDM_Odm, rOFDM0_XBAGCCore1, bMaskByte0, pRX_HP_Table->Cur_IGI); } } pRX_HP_Table->Pre_IGI = pRX_HP_Table->Cur_IGI; @@ -10310,20 +10310,20 @@ odm_PSD_RXHP( pRXHP_T pRX_HP_Table = &pDM_Odm->DM_RXHP_Table; struct adapter * Adapter = pDM_Odm->Adapter; PMGNT_INFO pMgntInfo = &(Adapter->MgntInfo); - unsigned int pts, start_point, stop_point, initial_gain ; + unsigned int pts, start_point, stop_point, initial_gain ; static u1Byte PSD_bitmap_memory[80], init_memory = 0; - static u1Byte psd_cnt=0; + static u1Byte psd_cnt=0; static u4Byte PSD_report[80], PSD_report_tmp; static u8Byte lastTxOkCnt=0, lastRxOkCnt=0; u1Byte idx[20]={96,99,102,106,109,112,115,118,122,125, 0,3,6,10,13,16,19,22,26,29}; u1Byte n, i, channel, BBReset,tone_idx; u1Byte PSD_bitmap[10], SSBT=0,initial_gain_psd=0, RSSI_BT=0, initialGainUpper; - s4Byte PSD_skip_start, PSD_skip_stop; + s4Byte PSD_skip_start, PSD_skip_stop; u4Byte CurrentChannel, RXIQI, RxIdleLowPwr, wlan_channel; u4Byte ReScan, Interval, Is40MHz; u8Byte curTxOkCnt, curRxOkCnt; - //--------------2G band synthesizer for 92D switch RF channel using----------------- + //--------------2G band synthesizer for 92D switch RF channel using----------------- u1Byte group_idx=0; u4Byte SYN_RF25=0, SYN_RF26=0, SYN_RF27=0, SYN_RF2B=0, SYN_RF2C=0; u4Byte SYN[5] = {0x25, 0x26, 0x27, 0x2B, 0x2C}; // synthesizer RF register for 2G channel @@ -10335,7 +10335,7 @@ odm_PSD_RXHP( u1Byte RSSI_BT_new = (u1Byte) ODM_GetBBReg(pDM_Odm, 0xB9C, 0xFF); u1Byte rssi_ctrl = (u1Byte) ODM_GetBBReg(pDM_Odm, 0xB38, 0xFF); //--------------------------------------------------------------------- - + if(pMgntInfo->bScanInProgress) { return; @@ -10372,7 +10372,7 @@ odm_PSD_RXHP( SYN_RF27 = ODM_GetRFReg(pDM_Odm, RF_PATH_B, 0x27, bMaskDWord); SYN_RF2B = ODM_GetRFReg(pDM_Odm, RF_PATH_B, 0x2B, bMaskDWord); SYN_RF2C = ODM_GetRFReg(pDM_Odm, RF_PATH_B, 0x2C, bMaskDWord); - } + } else // DualMAC_DualPHY 2G { SYN_RF25 = ODM_GetRFReg(pDM_Odm, RF_PATH_A, 0x25, bMaskDWord); @@ -10406,27 +10406,27 @@ odm_PSD_RXHP( //1 Leave RX idle low power ODM_SetBBReg(pDM_Odm, 0x818, BIT28, 0x0); //1 Fix initial gain - RSSI_BT = RSSI_BT_new; + RSSI_BT = RSSI_BT_new; RT_TRACE(COMP_PSD, DBG_LOUD,("PSD: RSSI_BT= %d\n", RSSI_BT)); - + if(rssi_ctrl == 1) // just for debug!! - initial_gain_psd = RSSI_BT_new; - else + initial_gain_psd = RSSI_BT_new; + else initial_gain_psd = pDM_Odm->RSSI_Min; // PSD report based on RSSI - + RT_TRACE(COMP_PSD, DBG_LOUD,("PSD: RSSI_BT= %d\n", RSSI_BT)); - + initialGainUpper = 0x54; - + RSSI_BT = initial_gain_psd; //SSBT = RSSI_BT; - + //RT_TRACE( COMP_PSD, DBG_LOUD,("PSD: SSBT= %d\n", SSBT)); RT_TRACE( COMP_PSD, DBG_LOUD,("PSD: initial gain= 0x%x\n", initial_gain_psd)); - - pDM_Odm->bDMInitialGainEnable = FALSE; + + pDM_Odm->bDMInitialGainEnable = FALSE; initial_gain = ODM_GetBBReg(pDM_Odm, 0xc50, bMaskDWord) & 0x7F; - ODM_SetBBReg(pDM_Odm, 0xc50, 0x7F, initial_gain_psd); + ODM_SetBBReg(pDM_Odm, 0xc50, 0x7F, initial_gain_psd); //1 Turn off 3-wire ODM_SetBBReg(pDM_Odm, 0x88c, BIT20|BIT21|BIT22|BIT23, 0xF); @@ -10457,20 +10457,20 @@ odm_PSD_RXHP( start_point = 512; stop_point = 1536; } - + //3 Skip WLAN channels if WLAN busy curTxOkCnt = *(pDM_Odm->pNumTxBytesUnicast) - lastTxOkCnt; curRxOkCnt = *(pDM_Odm->pNumRxBytesUnicast) - lastRxOkCnt; lastTxOkCnt = *(pDM_Odm->pNumTxBytesUnicast); lastRxOkCnt = *(pDM_Odm->pNumRxBytesUnicast); - + PSD_skip_start=80; PSD_skip_stop = 0; wlan_channel = CurrentChannel & 0x0f; RT_TRACE(COMP_PSD,DBG_LOUD,("PSD: current channel: %x, BW:%d \n", wlan_channel, Is40MHz)); - + if((curRxOkCnt+curTxOkCnt) > 1000) { PSD_skip_start = (wlan_channel-1)*5 -Is40MHz*10; @@ -10479,16 +10479,16 @@ odm_PSD_RXHP( RT_TRACE(COMP_PSD,DBG_LOUD,("PSD: Skip tone from %d to %d \n", PSD_skip_start, PSD_skip_stop)); - for (n=0;n<80;n++) - { - if((n%20)==0) - { + for (n=0;n<80;n++) + { + if((n%20)==0) + { channel = (n/20)*4 + 1; if(pDM_Odm->SupportICType == ODM_RTL8192D) { switch(channel) { - case 1: + case 1: case 9: group_idx = 0; break; @@ -10496,10 +10496,10 @@ odm_PSD_RXHP( group_idx = 2; break; case 13: - group_idx = 1; + group_idx = 1; break; } - if((*(pDM_Odm->pMacPhyMode)==ODM_SMSP)||(*(pDM_Odm->pMacPhyMode)==ODM_DMSP)) + if((*(pDM_Odm->pMacPhyMode)==ODM_SMSP)||(*(pDM_Odm->pMacPhyMode)==ODM_DMSP)) { for(i = 0; i < SYN_Length; i++) ODM_SetRFReg(pDM_Odm, RF_PATH_B, SYN[i], bMaskDWord, SYN_group[group_idx][i]); @@ -10510,17 +10510,17 @@ odm_PSD_RXHP( else // DualMAC_DualPHY 2G { for(i = 0; i < SYN_Length; i++) - ODM_SetRFReg(pDM_Odm, RF_PATH_A, SYN[i], bMaskDWord, SYN_group[group_idx][i]); - + ODM_SetRFReg(pDM_Odm, RF_PATH_A, SYN[i], bMaskDWord, SYN_group[group_idx][i]); + ODM_SetRFReg(pDM_Odm, RF_PATH_A, RF_CHNLBW, 0x3FF, channel); } } else ODM_SetRFReg(pDM_Odm, RF_PATH_A, RF_CHNLBW, 0x3FF, channel); - } + } tone_idx = n%20; if ((n>=PSD_skip_start) && (n PSD_report[n]) PSD_report[n] = PSD_report_tmp; - + } } PatchDCTone(pDM_Odm, PSD_report, initial_gain_psd); - + //----end //1 Turn on RX //Rx AGC on @@ -10579,7 +10579,7 @@ odm_PSD_RXHP( //Restore RX idle low power if(RxIdleLowPwr == TRUE) ODM_SetBBReg(pDM_Odm, 0x818, BIT28, 1); - + psd_cnt++; //gPrint("psd cnt=%d\n", psd_cnt); ODM_RT_TRACE(pDM_Odm,COMP_PSD, DBG_LOUD,("PSD:psd_cnt = %d \n",psd_cnt)); @@ -10588,7 +10588,7 @@ odm_PSD_RXHP( ODM_SetTimer(pDM_Odm, &pRX_HP_Table->PSDTimer, Interval); //ms } else - { + { psd_cnt = 0; for(i=0;i<80;i++) RT_TRACE( COMP_PSD, DBG_LOUD,("psd_report[%d]= %d \n", 2402+i, PSD_report[i])); @@ -10608,7 +10608,7 @@ odm_PSD_RXHPCallback( HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); PDM_ODM_T pDM_Odm = &pHalData->DM_OutSrc; pRXHP_T pRX_HP_Table = &pDM_Odm->DM_RXHP_Table; - + #if DEV_BUS_TYPE==RT_PCI_INTERFACE #if USE_WORKITEM ODM_ScheduleWorkItem(&pRX_HP_Table->PSDTimeWorkitem); @@ -10618,7 +10618,7 @@ odm_PSD_RXHPCallback( #else ODM_ScheduleWorkItem(&pRX_HP_Table->PSDTimeWorkitem); #endif - + } VOID @@ -10629,10 +10629,10 @@ odm_PSD_RXHPWorkitemCallback( struct adapter *pAdapter = (PADAPTER)pContext; HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter); PDM_ODM_T pDM_Odm = &pHalData->DM_OutSrc; - + odm_PSD_RXHP(pDM_Odm); } - + #endif //#if (DM_ODM_SUPPORT_TYPE == ODM_MP) // @@ -10646,13 +10646,13 @@ odm_GlobalAdapterCheck( #if (DM_ODM_SUPPORT_TYPE == ODM_MP) - //sherry delete flag 20110517 + //sherry delete flag 20110517 #if (DEV_BUS_TYPE == RT_PCI_INTERFACE) ACQUIRE_GLOBAL_SPINLOCK(&GlobalSpinlockForGlobalAdapterList); #else ACQUIRE_GLOBAL_MUTEX(GlobalMutexForGlobalAdapterList); #endif - + #if (DEV_BUS_TYPE == RT_PCI_INTERFACE) RELEASE_GLOBAL_SPINLOCK(&GlobalSpinlockForGlobalAdapterList); #else @@ -10680,7 +10680,7 @@ odm_OFDMTXPathDiversity_92C( s4Byte MinRSSI = 0xFF; pPD_T pDM_PDTable = &Adapter->DM_PDTable; pDM_PDTable->OFDMTXPath = 0; - + //1 Default Port if(pMgntInfo->mAssoc) { @@ -10714,9 +10714,9 @@ odm_OFDMTXPathDiversity_92C( { if(pEntry->bAssociated) { - RT_TRACE( COMP_SWAS, DBG_LOUD, ("odm_OFDMTXPathDiversity_92C: MACID=%d, RSSI_0=%d, RSSI_1=%d\n", + RT_TRACE( COMP_SWAS, DBG_LOUD, ("odm_OFDMTXPathDiversity_92C: MACID=%d, RSSI_0=%d, RSSI_1=%d\n", pEntry->AID+1, pEntry->rssi_stat.RxRSSIPercentage[0], pEntry->rssi_stat.RxRSSIPercentage[1])); - + if(pEntry->rssi_stat.RxRSSIPercentage[0] > pEntry->rssi_stat.RxRSSIPercentage[1]) { pDM_PDTable->OFDMTXPath = pDM_PDTable->OFDMTXPath & ~(BIT(pEntry->AID+1)); @@ -10760,7 +10760,7 @@ odm_IsConnected_92C( PMGNT_INFO pMgntInfo = &(Adapter->MgntInfo); u4Byte i; BOOLEAN bConnected=FALSE; - + if(pMgntInfo->mAssoc) { bConnected = TRUE; @@ -10807,8 +10807,8 @@ odm_ResetPathDiversity_92C( pDM_PDTable->OFDM_Pkt_Cnt = 0; pHalData->CCK_Pkt_Cnt =0; pHalData->OFDM_Pkt_Cnt =0; - - if(pDM_PDTable->CCKPathDivEnable == TRUE) + + if(pDM_PDTable->CCKPathDivEnable == TRUE) PHY_SetBBReg(Adapter, rCCK0_AFESetting , 0x0F000000, 0x01); //RX path = PathAB for(i=0; i<2; i++) @@ -10868,7 +10868,7 @@ odm_CCKTXPathDiversity_92C( pDM_PDTable->RSSI_CCK_Path[0], pDM_PDTable->RSSI_CCK_Path[1])); RT_TRACE( COMP_SWAS, DBG_LOUD, ("odm_CCKTXPathDiversity_92C: pDM_PDTable->RSSI_CCK_Path_cnt[0]=%d, pDM_PDTable->RSSI_CCK_Path_cnt[1]=%d\n", pDM_PDTable->RSSI_CCK_Path_cnt[0], pDM_PDTable->RSSI_CCK_Path_cnt[1])); - + if(pDM_PDTable->RSSI_CCK_Path[0] > pDM_PDTable->RSSI_CCK_Path[1]) { pDM_PDTable->CCKTXPath = pDM_PDTable->CCKTXPath & (~BIT0); @@ -10926,9 +10926,9 @@ odm_CCKTXPathDiversity_92C( else pEntry->rssi_stat.RSSI_CCK_Path[i] = 0; } - RT_TRACE( COMP_SWAS, DBG_LOUD, ("odm_CCKTXPathDiversity_92C: MACID=%d, RSSI_CCK0=%d, RSSI_CCK1=%d\n", + RT_TRACE( COMP_SWAS, DBG_LOUD, ("odm_CCKTXPathDiversity_92C: MACID=%d, RSSI_CCK0=%d, RSSI_CCK1=%d\n", pEntry->AID+1, pEntry->rssi_stat.RSSI_CCK_Path[0], pEntry->rssi_stat.RSSI_CCK_Path[1])); - + if(pEntry->rssi_stat.RSSI_CCK_Path[0] >pEntry->rssi_stat.RSSI_CCK_Path[1]) { pDM_PDTable->CCKTXPath = pDM_PDTable->CCKTXPath & ~(BIT(pEntry->AID+1)); @@ -11015,8 +11015,8 @@ odm_PathDiversityAfterLink_92C( RT_TRACE( COMP_SWAS, DBG_LOUD, ("ODM_TXPathDiversity(): No Connections\n")); return; } - - + + if(pDM_PDTable->TrainingState == 0) { RT_TRACE( COMP_SWAS, DBG_LOUD, ("ODM_TXPathDiversity() ==>\n")); @@ -11025,7 +11025,7 @@ odm_PathDiversityAfterLink_92C( if((pDM_PDTable->CCKPathDivEnable == TRUE) && (pDM_PDTable->OFDM_Pkt_Cnt < 100)) { //RT_TRACE( COMP_SWAS, DBG_LOUD, ("odm_CCKTXPathDiversity_92C: TrainingState=0\n")); - + if(pDM_PDTable->CCK_Pkt_Cnt > 300) pDM_PDTable->Timer = 20; else if(pDM_PDTable->CCK_Pkt_Cnt > 100) @@ -11059,8 +11059,8 @@ odm_PathDiversityAfterLink_92C( else { //RT_TRACE( COMP_SWAS, DBG_LOUD, ("odm_CCKTXPathDiversity_92C: TrainingState=2\n")); - pDM_PDTable->TrainingState = 0; - odm_CCKTXPathDiversity_92C(Adapter); + pDM_PDTable->TrainingState = 0; + odm_CCKTXPathDiversity_92C(Adapter); if(pDM_PDTable->OFDM_Pkt_Cnt != 0) { DefaultRespPath = pDM_PDTable->OFDMDefaultRespPath; @@ -11139,7 +11139,7 @@ ODM_CCKPathDiversityChkPerPktRssi( if((pHalData->PathDivCfg != 1) || (pHalData->RSSI_test == FALSE)) return; - + if(pHalData->RSSI_target==NULL && bIsDefPort && bMatchBSSID) bCount = TRUE; else if(pHalData->RSSI_target!=NULL && pEntry!=NULL && pHalData->RSSI_target==pEntry) @@ -11208,11 +11208,11 @@ ODM_PathDiversityBeforeLink92C( pHalData = GET_HAL_DATA(Adapter); pMgntInfo = &Adapter->MgntInfo; pDM_PDTable = &Adapter->DM_PDTable; - + // Condition that does not need to use path diversity. if((!IS_92C_SERIAL(pHalData->VersionID)) || (pHalData->PathDivCfg!=1) || pMgntInfo->AntennaTest ) { - RT_TRACE(COMP_SWAS, DBG_LOUD, + RT_TRACE(COMP_SWAS, DBG_LOUD, ("ODM_PathDiversityBeforeLink92C(): No PathDiv Mechanism before link.\n")); return FALSE; } @@ -11222,15 +11222,15 @@ ODM_PathDiversityBeforeLink92C( if(pHalData->eRFPowerState!=eRfOn || pMgntInfo->RFChangeInProgress || pMgntInfo->bMediaConnect) { PlatformReleaseSpinLock(Adapter, RT_RF_STATE_SPINLOCK); - - RT_TRACE(COMP_SWAS, DBG_LOUD, - ("ODM_PathDiversityBeforeLink92C(): RFChangeInProgress(%x), eRFPowerState(%x)\n", + + RT_TRACE(COMP_SWAS, DBG_LOUD, + ("ODM_PathDiversityBeforeLink92C(): RFChangeInProgress(%x), eRFPowerState(%x)\n", pMgntInfo->RFChangeInProgress, pHalData->eRFPowerState)); - + //pDM_SWAT_Table->SWAS_NoLink_State = 0; pDM_PDTable->PathDiv_NoLink_State = 0; - + return FALSE; } else @@ -11247,7 +11247,7 @@ ODM_PathDiversityBeforeLink92C( // Set check state to next step. //pDM_SWAT_Table->SWAS_NoLink_State = 1; pDM_PDTable->PathDiv_NoLink_State = 1; - + // Copy Current Scan list. Adapter->MgntInfo.tmpNumBssDesc = pMgntInfo->NumBssDesc; PlatformMoveMemory((PVOID)Adapter->MgntInfo.tmpbssDesc, (PVOID)pMgntInfo->bssDesc, sizeof(RT_WLAN_BSS)*MAX_BSS_DESC); @@ -11267,12 +11267,12 @@ ODM_PathDiversityBeforeLink92C( pDM_PDTable->OFDMTXPath = 0x0; pDM_PDTable->CCKTXPath = 0x0; } -#if 0 +#if 0 pDM_SWAT_Table->PreAntenna = pDM_SWAT_Table->CurAntenna; pDM_SWAT_Table->CurAntenna = (pDM_SWAT_Table->CurAntenna==Antenna_A)?Antenna_B:Antenna_A; - - RT_TRACE(COMP_SWAS, DBG_LOUD, + + RT_TRACE(COMP_SWAS, DBG_LOUD, ("ODM_SwAntDivCheckBeforeLink8192C: Change to Ant(%s) for testing.\n", (pDM_SWAT_Table->CurAntenna==Antenna_A)?"A":"B")); //PHY_SetBBReg(Adapter, rFPGA0_XA_RFInterfaceOE, 0x300, DM_SWAT_Table.CurAntenna); pDM_SWAT_Table->SWAS_NoLink_BK_Reg860 = ((pDM_SWAT_Table->SWAS_NoLink_BK_Reg860 & 0xfffffcff) | (pDM_SWAT_Table->CurAntenna<<8)); @@ -11311,7 +11311,7 @@ ODM_PathDiversityBeforeLink92C( RT_TRACE(COMP_SWAS, DBG_LOUD, ("ODM_PathDiversityBeforeLink92C: Compare scan entry: Score++\n")); RT_PRINT_STR(COMP_SWAS, DBG_LOUD, "SSID: ", pTestBssDesc->bdSsIdBuf, pTestBssDesc->bdSsIdLen); RT_TRACE(COMP_SWAS, DBG_LOUD, ("Original: %d, Test: %d\n", pTmpBssDesc->RecvSignalPower, pTestBssDesc->RecvSignalPower)); - + Score++; PlatformMoveMemory(pTestBssDesc, pTmpBssDesc, sizeof(RT_WLAN_BSS)); } @@ -11334,7 +11334,7 @@ ODM_PathDiversityBeforeLink92C( } else { - RT_TRACE(COMP_SWAS, DBG_LOUD, + RT_TRACE(COMP_SWAS, DBG_LOUD, ("ODM_PathDiversityBeforeLink92C(): DefaultRespPath=%d\n", pDM_PDTable->DefaultRespPath)); if(pDM_PDTable->DefaultRespPath == 0) @@ -11367,7 +11367,7 @@ ODM_PathDiversityBeforeLink92C( #else return FALSE; #endif - + } @@ -11375,7 +11375,7 @@ ODM_PathDiversityBeforeLink92C( //----92D Path Diversity----// //#ifdef PathDiv92D //================================== -//3 Path Diversity +//3 Path Diversity //================================== // // 20100514 Luke/Joseph: @@ -11387,7 +11387,7 @@ ODM_PathDiversityBeforeLink92C( // After 500ms, ODM_SwAntDivChkAntSwitchCallback() calls this function to compare the signal just // listened on the air with the RSSI of original antenna. // It chooses the antenna with better RSSI. -// There is also a aged policy for error trying. Each error trying will cost more 5 seconds waiting +// There is also a aged policy for error trying. Each error trying will cost more 5 seconds waiting // penalty to get next try. // // @@ -11414,7 +11414,7 @@ ODM_PathDivChkPerPktRssi( PRT_RFD pRfd ) { - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); BOOLEAN bCount = FALSE; PDM_ODM_T pDM_Odm = &pHalData->DM_OutSrc; pSWAT_T pDM_SWAT_Table = &pDM_Odm->DM_SWAT_Table; @@ -11462,7 +11462,7 @@ ODM_PathDivRestAfterLink( pDM_SWAT_Table->try_flag = 0x0; // NOT 0xff pDM_SWAT_Table->RSSI_Trying = 0; pDM_SWAT_Table->SelectAntennaMap=0xAA; - pDM_SWAT_Table->CurAntenna = Antenna_A; + pDM_SWAT_Table->CurAntenna = Antenna_A; } @@ -11514,7 +11514,7 @@ odm_PathDivChkAntSwitchWorkitemCallback( // Refer to Jr.Luke's SW ANT DIV // 92D Path Diversity Main function // refer to 88C software antenna diversity -// +// VOID odm_PathDivChkAntSwitch( PDM_ODM_T pDM_Odm @@ -11538,14 +11538,14 @@ odm_PathDivChkAntSwitch( u1Byte Score_A=0, Score_B=0; u1Byte i=0x0; // Neil Chen - static u1Byte pathdiv_para=0x0; + static u1Byte pathdiv_para=0x0; static u1Byte switchfirsttime=0x00; // u1Byte regB33 = (u1Byte) PHY_QueryBBReg(Adapter, 0xB30,BIT27); u1Byte regB33 = (u1Byte)ODM_GetBBReg(pDM_Odm, PATHDIV_REG, BIT27); - //u1Byte reg637 =0x0; - static u1Byte fw_value=0x0; + //u1Byte reg637 =0x0; + static u1Byte fw_value=0x0; u1Byte n=0; static u8Byte lastTxOkCnt_tmp=0, lastRxOkCnt_tmp=0; //u8Byte curTxOkCnt_tmp, curRxOkCnt_tmp; @@ -11557,7 +11557,7 @@ odm_PathDivChkAntSwitch( u1Byte PathDiv_Enable = pHalData->bPathDiv_Enable; - //DbgPrint("Path Div PG Value:%x \n",PathDiv_Enable); + //DbgPrint("Path Div PG Value:%x \n",PathDiv_Enable); if((BuddyAdapter==NULL)||(!PathDiv_Enable)||(PathDiv_Trigger)||(pHalData->CurrentBandType92D == BAND_ON_2_4G)) { return; @@ -11569,8 +11569,8 @@ odm_PathDivChkAntSwitch( { if(regB33==0) { - pDM_SWAT_Table->CurAntenna = Antenna_A; // Default MAC0_5G-->Path A (current antenna) - } + pDM_SWAT_Table->CurAntenna = Antenna_A; // Default MAC0_5G-->Path A (current antenna) + } } // Condition that does not need to use antenna diversity. @@ -11594,7 +11594,7 @@ odm_PathDivChkAntSwitch( { ODM_SwAntDivRestAfterLink(Adapter); } */ - + if(pDM_SWAT_Table->try_flag == 0xff) { // Select RSSI checking target @@ -11609,7 +11609,7 @@ odm_PathDivChkAntSwitch( u1Byte index = 0; PRT_WLAN_STA pEntry = NULL; struct adapter * pTargetAdapter = NULL; - + if( pMgntInfo->mIbss || ACTING_AS_AP(Adapter) ) { // Target: AP/IBSS peer. @@ -11629,7 +11629,7 @@ odm_PathDivChkAntSwitch( if(pEntry != NULL) { if(pEntry->bAssociated) - break; + break; } } } @@ -11646,7 +11646,7 @@ odm_PathDivChkAntSwitch( ODM_RT_TRACE(pDM_Odm,ODM_COMP_PATH_DIV, ODM_DBG_LOUD, ("odm_SwAntDivChkAntSwitch(): RSSI_target is PEER STA\n")); } } - + pHalData->RSSI_cnt_A = 0; pHalData->RSSI_cnt_B = 0; pDM_SWAT_Table->try_flag = 0; @@ -11660,7 +11660,7 @@ odm_PathDivChkAntSwitch( curRxOkCnt = Adapter->RxStats.NumRxBytesUnicast - lastRxOkCnt; lastTxOkCnt = Adapter->TxStats.NumTxBytesUnicast; lastRxOkCnt = Adapter->RxStats.NumRxBytesUnicast; - + if(pDM_SWAT_Table->try_flag == 1) // Training State { if(pDM_SWAT_Table->CurAntenna == Antenna_A) @@ -11673,7 +11673,7 @@ odm_PathDivChkAntSwitch( TXByteCnt_B += curTxOkCnt; RXByteCnt_B += curRxOkCnt; } - + nextAntenna = (pDM_SWAT_Table->CurAntenna == Antenna_A)? Antenna_B : Antenna_A; pDM_SWAT_Table->RSSI_Trying--; ODM_RT_TRACE(pDM_Odm,ODM_COMP_PATH_DIV, ODM_DBG_LOUD, ("=PATH DIV=: RSSI_Trying = %d\n",pDM_SWAT_Table->RSSI_Trying)); @@ -11681,7 +11681,7 @@ odm_PathDivChkAntSwitch( { CurByteCnt = (pDM_SWAT_Table->CurAntenna == Antenna_A)? (TXByteCnt_A+RXByteCnt_A) : (TXByteCnt_B+RXByteCnt_B); PreByteCnt = (pDM_SWAT_Table->CurAntenna == Antenna_A)? (TXByteCnt_B+RXByteCnt_B) : (TXByteCnt_A+RXByteCnt_A); - + if(TrafficLoad == TRAFFIC_HIGH) { //CurByteCnt = PlatformDivision64(CurByteCnt, 9); @@ -11693,17 +11693,17 @@ odm_PathDivChkAntSwitch( PreByteCnt =PreByteCnt*2; } if(pHalData->RSSI_cnt_A > 0) - RSSI_A = pHalData->RSSI_sum_A/pHalData->RSSI_cnt_A; + RSSI_A = pHalData->RSSI_sum_A/pHalData->RSSI_cnt_A; else RSSI_A = 0; if(pHalData->RSSI_cnt_B > 0) - RSSI_B = pHalData->RSSI_sum_B/pHalData->RSSI_cnt_B; + RSSI_B = pHalData->RSSI_sum_B/pHalData->RSSI_cnt_B; else RSSI_B = 0; curRSSI = (pDM_SWAT_Table->CurAntenna == Antenna_A)? RSSI_A : RSSI_B; pDM_SWAT_Table->PreRSSI = (pDM_SWAT_Table->CurAntenna == Antenna_A)? RSSI_B : RSSI_A; ODM_RT_TRACE(pDM_Odm,ODM_COMP_PATH_DIV, ODM_DBG_LOUD, ("=PATH DIV=: PreRSSI = %d, CurRSSI = %d\n",pDM_SWAT_Table->PreRSSI, curRSSI)); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_PATH_DIV, ODM_DBG_LOUD, ("=PATH DIV=: preAntenna= %s, curAntenna= %s \n", + ODM_RT_TRACE(pDM_Odm,ODM_COMP_PATH_DIV, ODM_DBG_LOUD, ("=PATH DIV=: preAntenna= %s, curAntenna= %s \n", (pDM_SWAT_Table->PreAntenna == Antenna_A?"A":"B"), (pDM_SWAT_Table->CurAntenna == Antenna_A?"A":"B"))); ODM_RT_TRACE(pDM_Odm,ODM_COMP_PATH_DIV, ODM_DBG_LOUD, ("=PATH DIV=: RSSI_A= %d, RSSI_cnt_A = %d, RSSI_B= %d, RSSI_cnt_B = %d\n", RSSI_A, pHalData->RSSI_cnt_A, RSSI_B, pHalData->RSSI_cnt_B)); @@ -11712,19 +11712,19 @@ odm_PathDivChkAntSwitch( } else // try_flag=0 { - + if(pHalData->RSSI_cnt_A > 0) - RSSI_A = pHalData->RSSI_sum_A/pHalData->RSSI_cnt_A; + RSSI_A = pHalData->RSSI_sum_A/pHalData->RSSI_cnt_A; else RSSI_A = 0; if(pHalData->RSSI_cnt_B > 0) - RSSI_B = pHalData->RSSI_sum_B/pHalData->RSSI_cnt_B; + RSSI_B = pHalData->RSSI_sum_B/pHalData->RSSI_cnt_B; else - RSSI_B = 0; + RSSI_B = 0; curRSSI = (pDM_SWAT_Table->CurAntenna == Antenna_A)? RSSI_A : RSSI_B; pDM_SWAT_Table->PreRSSI = (pDM_SWAT_Table->PreAntenna == Antenna_A)? RSSI_A : RSSI_B; ODM_RT_TRACE(pDM_Odm,ODM_COMP_PATH_DIV, ODM_DBG_LOUD, ("=PATH DIV=: PreRSSI = %d, CurRSSI = %d\n", pDM_SWAT_Table->PreRSSI, curRSSI)); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_PATH_DIV, ODM_DBG_LOUD, ("=PATH DIV=: preAntenna= %s, curAntenna= %s \n", + ODM_RT_TRACE(pDM_Odm,ODM_COMP_PATH_DIV, ODM_DBG_LOUD, ("=PATH DIV=: preAntenna= %s, curAntenna= %s \n", (pDM_SWAT_Table->PreAntenna == Antenna_A?"A":"B"), (pDM_SWAT_Table->CurAntenna == Antenna_A?"A":"B"))); ODM_RT_TRACE(pDM_Odm,ODM_COMP_PATH_DIV, ODM_DBG_LOUD, ("=PATH DIV=: RSSI_A= %d, RSSI_cnt_A = %d, RSSI_B= %d, RSSI_cnt_B = %d\n", @@ -11741,7 +11741,7 @@ odm_PathDivChkAntSwitch( { ODM_RT_TRACE(pDM_Odm,ODM_COMP_PATH_DIV, ODM_DBG_LOUD, ("=PATH=: TestMode = TP_MODE")); ODM_RT_TRACE(pDM_Odm,ODM_COMP_PATH_DIV, ODM_DBG_LOUD, ("=PATH= TRY:CurByteCnt = %"i64fmt"d,", CurByteCnt)); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_PATH_DIV, ODM_DBG_LOUD, ("=PATH= TRY:PreByteCnt = %"i64fmt"d\n",PreByteCnt)); + ODM_RT_TRACE(pDM_Odm,ODM_COMP_PATH_DIV, ODM_DBG_LOUD, ("=PATH= TRY:PreByteCnt = %"i64fmt"d\n",PreByteCnt)); if(CurByteCnt < PreByteCnt) { if(pDM_SWAT_Table->CurAntenna == Antenna_A) @@ -11765,7 +11765,7 @@ odm_PathDivChkAntSwitch( } ODM_RT_TRACE(pDM_Odm,ODM_COMP_PATH_DIV, ODM_DBG_LOUD, ("SelectAntennaMap=%x\n ",pDM_SWAT_Table->SelectAntennaMap)); ODM_RT_TRACE(pDM_Odm,ODM_COMP_PATH_DIV, ODM_DBG_LOUD, ("=PATH=: Score_A=%d, Score_B=%d\n", Score_A, Score_B)); - + if(pDM_SWAT_Table->CurAntenna == Antenna_A) { nextAntenna = (Score_A >= Score_B)?Antenna_A:Antenna_B; @@ -11775,7 +11775,7 @@ odm_PathDivChkAntSwitch( nextAntenna = (Score_B >= Score_A)?Antenna_B:Antenna_A; } ODM_RT_TRACE(pDM_Odm,ODM_COMP_PATH_DIV, ODM_DBG_LOUD, ("=PATH=: nextAntenna=%s\n",(nextAntenna==Antenna_A)?"A":"B")); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_PATH_DIV, ODM_DBG_LOUD, ("=PATH=: preAntenna= %s, curAntenna= %s \n", + ODM_RT_TRACE(pDM_Odm,ODM_COMP_PATH_DIV, ODM_DBG_LOUD, ("=PATH=: preAntenna= %s, curAntenna= %s \n", (pDM_SWAT_Table->PreAntenna == Antenna_A?"A":"B"), (pDM_SWAT_Table->CurAntenna == Antenna_A?"A":"B"))); if(nextAntenna != pDM_SWAT_Table->CurAntenna) @@ -11785,12 +11785,12 @@ odm_PathDivChkAntSwitch( else { ODM_RT_TRACE(pDM_Odm,ODM_COMP_PATH_DIV, ODM_DBG_LOUD, ("=PATH=: current anntena is good\n")); - } + } } - + if(pDM_SWAT_Table->TestMode == RSSI_MODE) - { + { ODM_RT_TRACE(pDM_Odm,ODM_COMP_PATH_DIV, ODM_DBG_LOUD, ("=PATH=: TestMode = RSSI_MODE")); pDM_SWAT_Table->SelectAntennaMap=0xAA; if(curRSSI < pDM_SWAT_Table->PreRSSI) //Current antenna is worse than previous antenna @@ -11804,7 +11804,7 @@ odm_PathDivChkAntSwitch( //RT_TRACE(COMP_SWAS, DBG_LOUD, ("SWAS: current anntena is good\n")); } } - + pDM_SWAT_Table->try_flag = 0; pHalData->RSSI_test = FALSE; pHalData->RSSI_sum_A = 0; @@ -11815,7 +11815,7 @@ odm_PathDivChkAntSwitch( TXByteCnt_B = 0; RXByteCnt_A = 0; RXByteCnt_B = 0; - + } //1 Normal State @@ -11839,14 +11839,14 @@ odm_PathDivChkAntSwitch( pDM_SWAT_Table->bTriggerAntennaSwitch = 0; //RT_TRACE(COMP_SWAS, DBG_LOUD, ("Normal:TrafficLoad = %llu\n", curTxOkCnt+curRxOkCnt)); - //Prepare To Try Antenna + //Prepare To Try Antenna nextAntenna = (pDM_SWAT_Table->CurAntenna == Antenna_A)? Antenna_B : Antenna_A; pDM_SWAT_Table->try_flag = 1; pHalData->RSSI_test = TRUE; if((curRxOkCnt+curTxOkCnt) > 1000) { #if DEV_BUS_TYPE==RT_PCI_INTERFACE - pDM_SWAT_Table->RSSI_Trying = 4; + pDM_SWAT_Table->RSSI_Trying = 4; #else pDM_SWAT_Table->RSSI_Trying = 2; #endif @@ -11858,19 +11858,19 @@ odm_PathDivChkAntSwitch( pDM_SWAT_Table->TestMode = RSSI_MODE; } - - //RT_TRACE(COMP_SWAS, DBG_LOUD, ("SWAS: Normal State -> Begin Trying!\n")); + + //RT_TRACE(COMP_SWAS, DBG_LOUD, ("SWAS: Normal State -> Begin Trying!\n")); pHalData->RSSI_sum_A = 0; pHalData->RSSI_cnt_A = 0; pHalData->RSSI_sum_B = 0; pHalData->RSSI_cnt_B = 0; } // end of try_flag=0 } - + //1 4.Change TRX antenna if(nextAntenna != pDM_SWAT_Table->CurAntenna) { - + ODM_RT_TRACE(pDM_Odm,ODM_COMP_PATH_DIV, ODM_DBG_LOUD, ("=PATH=: Change TX Antenna!\n ")); //PHY_SetBBReg(Adapter, rFPGA0_XA_RFInterfaceOE, 0x300, nextAntenna); for 88C if(nextAntenna==Antenna_A) @@ -11881,9 +11881,9 @@ odm_PathDivChkAntSwitch( #if DEV_BUS_TYPE==RT_PCI_INTERFACE odm_PathDiversity_8192D(pDM_Odm, pathdiv_para); #else - ODM_FillH2CCmd(Adapter, ODM_H2C_PathDiv,1,(pu1Byte)(&fw_value)); + ODM_FillH2CCmd(Adapter, ODM_H2C_PathDiv,1,(pu1Byte)(&fw_value)); #endif - } + } else if(nextAntenna==Antenna_B) { ODM_RT_TRACE(pDM_Odm,ODM_COMP_PATH_DIV, ODM_DBG_LOUD, ("=PATH=: Next Antenna is RF PATH B\n ")); @@ -11891,33 +11891,33 @@ odm_PathDivChkAntSwitch( { switchfirsttime=0x01; pathdiv_para = 0x00; - fw_value=0x00; // to backup RF Path A Releated Registers - + fw_value=0x00; // to backup RF Path A Releated Registers + #if DEV_BUS_TYPE==RT_PCI_INTERFACE odm_PathDiversity_8192D(pDM_Odm, pathdiv_para); #else - ODM_FillH2CCmd(Adapter, ODM_H2C_PathDiv,1,(pu1Byte)(&fw_value)); + ODM_FillH2CCmd(Adapter, ODM_H2C_PathDiv,1,(pu1Byte)(&fw_value)); //for(u1Byte n=0; n<80,n++) //{ //delay_us(500); ODM_delay_ms(500); odm_PathDiversity_8192D(pDM_Odm, pathdiv_para); - - fw_value=0x01; // to backup RF Path A Releated Registers - ODM_FillH2CCmd(Adapter, ODM_H2C_PathDiv,1,(pu1Byte)(&fw_value)); -#endif - ODM_RT_TRACE(pDM_Odm,ODM_COMP_PATH_DIV, ODM_DBG_LOUD, ("=PATH=: FIRST TIME To DO PATH SWITCH!\n ")); - } + + fw_value=0x01; // to backup RF Path A Releated Registers + ODM_FillH2CCmd(Adapter, ODM_H2C_PathDiv,1,(pu1Byte)(&fw_value)); +#endif + ODM_RT_TRACE(pDM_Odm,ODM_COMP_PATH_DIV, ODM_DBG_LOUD, ("=PATH=: FIRST TIME To DO PATH SWITCH!\n ")); + } else { pathdiv_para = 0x01; - fw_value = 0x02; + fw_value = 0x02; #if DEV_BUS_TYPE==RT_PCI_INTERFACE odm_PathDiversity_8192D(pDM_Odm, pathdiv_para); #else - ODM_FillH2CCmd(Adapter, ODM_H2C_PathDiv,1,(pu1Byte)(&fw_value)); -#endif - } + ODM_FillH2CCmd(Adapter, ODM_H2C_PathDiv,1,(pu1Byte)(&fw_value)); +#endif + } } // odm_PathDiversity_8192D(Adapter, pathdiv_para); } @@ -11928,7 +11928,7 @@ odm_PathDivChkAntSwitch( pDM_SWAT_Table->PreRSSI = curRSSI; //lastTxOkCnt = Adapter->TxStats.NumTxBytesUnicast; //lastRxOkCnt = Adapter->RxStats.NumRxBytesUnicast; - + //1 6.Set next timer if(pDM_SWAT_Table->RSSI_Trying == 0) @@ -11946,7 +11946,7 @@ odm_PathDivChkAntSwitch( #else ODM_SetTimer( pDM_Odm, &pDM_Odm->PathDivSwitchTimer, 20 ); //ms ODM_RT_TRACE(pDM_Odm,ODM_COMP_PATH_DIV, ODM_DBG_LOUD, ("=PATH=: Test another antenna for 20 ms\n")); -#endif +#endif } else if(TrafficLoad == TRAFFIC_LOW) { @@ -11965,13 +11965,13 @@ odm_PathDivChkAntSwitch( if(pDM_SWAT_Table->TestMode == TP_MODE) { if(TrafficLoad == TRAFFIC_HIGH) - + #if DEV_BUS_TYPE==RT_PCI_INTERFACE ODM_SetTimer( pDM_Odm, &pDM_Odm->PathDivSwitchTimer, 90 ); //ms //ODM_RT_TRACE(pDM_Odm,ODM_COMP_PATH_DIV, ODM_DBG_LOUD, ("=PATH=: Test another antenna for 90 ms\n")); -#else +#else ODM_SetTimer( pDM_Odm, &pDM_Odm->PathDivSwitchTimer, 180); //ms -#endif +#endif else if(TrafficLoad == TRAFFIC_LOW) ODM_SetTimer( pDM_Odm, &pDM_Odm->PathDivSwitchTimer, 100 ); //ms } @@ -11997,12 +11997,12 @@ odm_SetRespPath_92C( { if(DefaultRespPath == 0) { - PlatformEFIOWrite1Byte(Adapter, 0x6D8, (PlatformEFIORead1Byte(Adapter, 0x6D8)&0xc0)|0x15); + PlatformEFIOWrite1Byte(Adapter, 0x6D8, (PlatformEFIORead1Byte(Adapter, 0x6D8)&0xc0)|0x15); } else { PlatformEFIOWrite1Byte(Adapter, 0x6D8, (PlatformEFIORead1Byte(Adapter, 0x6D8)&0xc0)|0x2A); - } + } } pDM_PDTable->DefaultRespPath = DefaultRespPath; } @@ -12021,7 +12021,7 @@ ODM_FillTXPathInTXDESC( //2011.09.05 Add by Luke Lee for path diversity if(pHalData->PathDivCfg == 1) - { + { TXPath = (pDM_PDTable->OFDMTXPath >> pTcb->macId) & BIT0; //RT_TRACE( COMP_SWAS, DBG_LOUD, ("Fill TXDESC: macID=%d, TXPath=%d\n", pTcb->macId, TXPath)); //SET_TX_DESC_TX_ANT_CCK(pDesc,TXPath); @@ -12050,7 +12050,7 @@ ODM_FillTXPathInTXDESC( //Only for MP //Neil Chen--2012--0502-- VOID odm_PathDivInit( -IN PDM_ODM_T pDM_Odm) +IN PDM_ODM_T pDM_Odm) { pPATHDIV_PARA pathIQK = &pDM_Odm->pathIQK; @@ -12106,7 +12106,7 @@ odm_PHY_SaveAFERegisters( ) { u4Byte i; - + //RTPRINT(FINIT, INIT_IQK, ("Save ADDA parameters.\n")); for( i = 0 ; i < RegisterNum ; i++){ AFEBackup[i] = ODM_GetBBReg(pDM_Odm, AFEReg[i], bMaskDWord); @@ -12126,7 +12126,7 @@ odm_PHY_ReloadAFERegisters( //RTPRINT(FINIT, INIT_IQK, ("Reload ADDA power saving parameters !\n")); for(i = 0 ; i < RegiesterNum; i++) { - + ODM_SetBBReg(pDM_Odm, AFEReg[i], bMaskDWord, AFEBackup[i]); } } @@ -12134,8 +12134,8 @@ odm_PHY_ReloadAFERegisters( //2 8723A ANT DETECT // // Description: -// Implement IQK single tone for RF DPK loopback and BB PSD scanning. -// This function is cooperated with BB team Neil. +// Implement IQK single tone for RF DPK loopback and BB PSD scanning. +// This function is cooperated with BB team Neil. // // Added by Roger, 2011.12.15 // @@ -12158,13 +12158,13 @@ ODM_SingleDualAntennaDetection( BOOLEAN bResult = TRUE; u4Byte AFE_Backup[16]; u4Byte AFE_REG_8723A[16] = { - rRx_Wait_CCA, rTx_CCK_RFON, - rTx_CCK_BBON, rTx_OFDM_RFON, - rTx_OFDM_BBON, rTx_To_Rx, - rTx_To_Tx, rRx_CCK, - rRx_OFDM, rRx_Wait_RIFS, + rRx_Wait_CCA, rTx_CCK_RFON, + rTx_CCK_BBON, rTx_OFDM_RFON, + rTx_OFDM_BBON, rTx_To_Rx, + rTx_To_Tx, rRx_CCK, + rRx_OFDM, rRx_Wait_RIFS, rRx_TO_Rx, rStandby, - rSleep, rPMPD_ANAEN, + rSleep, rPMPD_ANAEN, rFPGA0_XCD_SwitchControl, rBlue_Tooth}; if(!(pDM_Odm->SupportICType & (ODM_RTL8723A|ODM_RTL8192C))) @@ -12183,30 +12183,30 @@ ODM_SingleDualAntennaDetection( ODM_SetBBReg(pDM_Odm, 0x808, BIT14|BIT15, 0x0); } - //1 Backup Current RF/BB Settings - + //1 Backup Current RF/BB Settings + CurrentChannel = ODM_GetRFReg(pDM_Odm, RF_PATH_A, ODM_CHANNEL, bRFRegOffsetMask); RfLoopReg = ODM_GetRFReg(pDM_Odm, RF_PATH_A, 0x00, bRFRegOffsetMask); ODM_SetBBReg(pDM_Odm, rFPGA0_XA_RFInterfaceOE, ODM_DPDT, Antenna_A); // change to Antenna A - // Step 1: USE IQK to transmitter single tone + // Step 1: USE IQK to transmitter single tone ODM_StallExecution(10); - + //Store A Path Register 88c, c08, 874, c50 Reg88c = ODM_GetBBReg(pDM_Odm, rFPGA0_AnalogParameter4, bMaskDWord); Regc08 = ODM_GetBBReg(pDM_Odm, rOFDM0_TRMuxPar, bMaskDWord); Reg874 = ODM_GetBBReg(pDM_Odm, rFPGA0_XCD_RFInterfaceSW, bMaskDWord); - Regc50 = ODM_GetBBReg(pDM_Odm, rOFDM0_XAAGCCore1, bMaskDWord); - + Regc50 = ODM_GetBBReg(pDM_Odm, rOFDM0_XAAGCCore1, bMaskDWord); + // Store AFE Registers - odm_PHY_SaveAFERegisters(pDM_Odm, AFE_REG_8723A, AFE_Backup, 16); - + odm_PHY_SaveAFERegisters(pDM_Odm, AFE_REG_8723A, AFE_Backup, 16); + //Set PSD 128 pts ODM_SetBBReg(pDM_Odm, rFPGA0_PSDFunction, BIT14|BIT15, 0x0); //128 pts - + // To SET CH1 to do ODM_SetRFReg(pDM_Odm, RF_PATH_A, ODM_CHANNEL, bRFRegOffsetMask, 0x01); //Channel 1 - + // AFE all on step ODM_SetBBReg(pDM_Odm, rRx_Wait_CCA, bMaskDWord, 0x6FDB25A4); ODM_SetBBReg(pDM_Odm, rTx_CCK_RFON, bMaskDWord, 0x6FDB25A4); @@ -12227,14 +12227,14 @@ ODM_SingleDualAntennaDetection( // 3 wire Disable ODM_SetBBReg(pDM_Odm, rFPGA0_AnalogParameter4, bMaskDWord, 0xCCF000C0); - + //BB IQK Setting ODM_SetBBReg(pDM_Odm, rOFDM0_TRMuxPar, bMaskDWord, 0x000800E4); ODM_SetBBReg(pDM_Odm, rFPGA0_XCD_RFInterfaceSW, bMaskDWord, 0x22208000); //IQK setting tone@ 4.34Mhz ODM_SetBBReg(pDM_Odm, rTx_IQK_Tone_A, bMaskDWord, 0x10008C1C); - ODM_SetBBReg(pDM_Odm, rTx_IQK, bMaskDWord, 0x01007c00); + ODM_SetBBReg(pDM_Odm, rTx_IQK, bMaskDWord, 0x01007c00); //Page B init @@ -12244,11 +12244,11 @@ ODM_SingleDualAntennaDetection( ODM_SetBBReg(pDM_Odm, rRx_IQK_Tone_A, bMaskDWord, 0x10008c1f); ODM_SetBBReg(pDM_Odm, rTx_IQK_PI_A, bMaskDWord, 0x82150008); ODM_SetBBReg(pDM_Odm, rRx_IQK_PI_A, bMaskDWord, 0x28150008); - ODM_SetBBReg(pDM_Odm, rIQK_AGC_Rsp, bMaskDWord, 0x001028d0); + ODM_SetBBReg(pDM_Odm, rIQK_AGC_Rsp, bMaskDWord, 0x001028d0); //RF loop Setting - ODM_SetRFReg(pDM_Odm, RF_PATH_A, 0x0, 0xFFFFF, 0x50008); - + ODM_SetRFReg(pDM_Odm, RF_PATH_A, 0x0, 0xFFFFF, 0x50008); + //IQK Single tone start ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, bMaskDWord, 0x80800000); ODM_SetBBReg(pDM_Odm, rIQK_AGC_Pts, bMaskDWord, 0xf8000000); @@ -12256,8 +12256,8 @@ ODM_SingleDualAntennaDetection( PSD_report_tmp=0x0; for (n=0;n<2;n++) - { - PSD_report_tmp = GetPSDData(pDM_Odm, 14, initial_gain); + { + PSD_report_tmp = GetPSDData(pDM_Odm, 14, initial_gain); if(PSD_report_tmp >AntA_report) AntA_report=PSD_report_tmp; } @@ -12265,23 +12265,23 @@ ODM_SingleDualAntennaDetection( PSD_report_tmp=0x0; ODM_SetBBReg(pDM_Odm, rFPGA0_XA_RFInterfaceOE, 0x300, Antenna_B); // change to Antenna B - ODM_StallExecution(10); + ODM_StallExecution(10); + - for (n=0;n<2;n++) - { - PSD_report_tmp = GetPSDData(pDM_Odm, 14, initial_gain); + { + PSD_report_tmp = GetPSDData(pDM_Odm, 14, initial_gain); if(PSD_report_tmp > AntB_report) AntB_report=PSD_report_tmp; } // change to open case ODM_SetBBReg(pDM_Odm, rFPGA0_XA_RFInterfaceOE, 0x300, 0); // change to Ant A and B all open case - ODM_StallExecution(10); - + ODM_StallExecution(10); + for (n=0;n<2;n++) - { - PSD_report_tmp = GetPSDData(pDM_Odm, 14, initial_gain); + { + PSD_report_tmp = GetPSDData(pDM_Odm, 14, initial_gain); if(PSD_report_tmp > AntO_report) AntO_report=PSD_report_tmp; } @@ -12291,7 +12291,7 @@ ODM_SingleDualAntennaDetection( PSD_report_tmp = 0x0; //1 Return to antanna A - ODM_SetBBReg(pDM_Odm, rFPGA0_XA_RFInterfaceOE, 0x300, Antenna_A); + ODM_SetBBReg(pDM_Odm, rFPGA0_XA_RFInterfaceOE, 0x300, Antenna_A); ODM_SetBBReg(pDM_Odm, rFPGA0_AnalogParameter4, bMaskDWord, Reg88c); ODM_SetBBReg(pDM_Odm, rOFDM0_TRMuxPar, bMaskDWord, Regc08); ODM_SetBBReg(pDM_Odm, rFPGA0_XCD_RFInterfaceSW, bMaskDWord, Reg874); @@ -12301,10 +12301,10 @@ ODM_SingleDualAntennaDetection( ODM_SetRFReg(pDM_Odm, RF_PATH_A, 0x00, bRFRegOffsetMask,RfLoopReg); //Reload AFE Registers - odm_PHY_ReloadAFERegisters(pDM_Odm, AFE_REG_8723A, AFE_Backup, 16); + odm_PHY_ReloadAFERegisters(pDM_Odm, AFE_REG_8723A, AFE_Backup, 16); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("psd_report_A[%d]= %d \n", 2416, AntA_report)); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("psd_report_B[%d]= %d \n", 2416, AntB_report)); + ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("psd_report_A[%d]= %d \n", 2416, AntA_report)); + ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("psd_report_B[%d]= %d \n", 2416, AntB_report)); ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("psd_report_O[%d]= %d \n", 2416, AntO_report)); @@ -12318,21 +12318,21 @@ ODM_SingleDualAntennaDetection( if(AntB_report > (AntA_report+1)) { pDM_SWAT_Table->ANTB_ON=FALSE; - ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("ODM_SingleDualAntennaDetection(): Single Antenna A\n")); - } + ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("ODM_SingleDualAntennaDetection(): Single Antenna A\n")); + } else { pDM_SWAT_Table->ANTB_ON=TRUE; - ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("ODM_SingleDualAntennaDetection(): Dual Antenna is A and B\n")); - } + ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("ODM_SingleDualAntennaDetection(): Dual Antenna is A and B\n")); + } } else { ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("ODM_SingleDualAntennaDetection(): Need to check again\n")); - pDM_SWAT_Table->ANTB_ON=FALSE; // Set Antenna B off as default + pDM_SWAT_Table->ANTB_ON=FALSE; // Set Antenna B off as default bResult = FALSE; } - } + } //2 Test Ant A and B based on DPDT Open else if(mode==ANTTESTALL) { @@ -12341,9 +12341,9 @@ ODM_SingleDualAntennaDetection( if(AntA_report > (AntO_report+1)) { pDM_SWAT_Table->ANTA_ON=FALSE; - //RT_TRACE(COMP_ANTENNA, DBG_LOUD, ("ODM_AntennaDetection(): Antenna A is OFF\n")); + //RT_TRACE(COMP_ANTENNA, DBG_LOUD, ("ODM_AntennaDetection(): Antenna A is OFF\n")); ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD,("Ant A is OFF")); - } + } else { pDM_SWAT_Table->ANTA_ON=TRUE; @@ -12354,9 +12354,9 @@ ODM_SingleDualAntennaDetection( if(AntB_report > (AntO_report+2)) { pDM_SWAT_Table->ANTB_ON=FALSE; - //RT_TRACE(COMP_ANTENNA, DBG_LOUD, ("ODM_AntennaDetection(): Antenna B is OFF\n")); + //RT_TRACE(COMP_ANTENNA, DBG_LOUD, ("ODM_AntennaDetection(): Antenna B is OFF\n")); ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD,("Ant B is OFF")); - } + } else { pDM_SWAT_Table->ANTB_ON=TRUE; @@ -12375,15 +12375,15 @@ ODM_SingleDualAntennaDetection( pDM_SWAT_Table->ANTA_ON=FALSE; pDM_SWAT_Table->ANTB_ON=TRUE; ODM_SetBBReg(pDM_Odm, rFPGA0_XA_RFInterfaceOE, 0x300, Antenna_B); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("ODM_SingleDualAntennaDetection(): Single Antenna B\n")); - } + ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("ODM_SingleDualAntennaDetection(): Single Antenna B\n")); + } else if(AntA_report > (AntB_report+2)) { pDM_SWAT_Table->ANTA_ON=TRUE; pDM_SWAT_Table->ANTB_ON=FALSE; ODM_SetBBReg(pDM_Odm, rFPGA0_XA_RFInterfaceOE, 0x300, Antenna_A); ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("ODM_SingleDualAntennaDetection(): Single Antenna A\n")); - } + } else { pDM_SWAT_Table->ANTA_ON=TRUE; @@ -12394,8 +12394,8 @@ ODM_SingleDualAntennaDetection( else { ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("ODM_SingleDualAntennaDetection(): Need to check again\n")); - pDM_SWAT_Table->ANTA_ON=TRUE; // Set Antenna A on as default - pDM_SWAT_Table->ANTB_ON=FALSE; // Set Antenna B off as default + pDM_SWAT_Table->ANTA_ON=TRUE; // Set Antenna A on as default + pDM_SWAT_Table->ANTB_ON=FALSE; // Set Antenna B off as default bResult = FALSE; } } @@ -12486,10 +12486,9 @@ void odm_dtc(PDM_ODM_T pDM_Odm) resp_txagc = resp_txagc | (resp_txagc << 5); ODM_Write1Byte(pDM_Odm, 0x06d9, resp_txagc); - DBG_871X("%s RSSI_Min:%u, set RESP_TXAGC to %s %u\n", + DBG_871X("%s RSSI_Min:%u, set RESP_TXAGC to %s %u\n", __func__, pDM_Odm->RSSI_Min, sign?"minus":"plus", dtc_steps); #endif /* CONFIG_RESP_TXAGC_ADJUST */ } #endif /* #if (DM_ODM_SUPPORT_TYPE == ODM_CE) */ - diff --git a/hal/odm_HWConfig.c b/hal/odm_HWConfig.c index a11a815..a8c0634 100755 --- a/hal/odm_HWConfig.c +++ b/hal/odm_HWConfig.c @@ -1,1198 +1,1197 @@ -/****************************************************************************** - * - * 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 - * - * - ******************************************************************************/ - -//============================================================ -// include files -//============================================================ - -#include "odm_precomp.h" - -#if (RTL8188E_FOR_TEST_CHIP > 1) - #define READ_AND_CONFIG(ic, txt) do {\ - if (pDM_Odm->bIsMPChip)\ - READ_AND_CONFIG_MP(ic,txt);\ - else\ - READ_AND_CONFIG_TC(ic,txt);\ - } while(0) -#elif (RTL8188E_FOR_TEST_CHIP == 1) - #define READ_AND_CONFIG READ_AND_CONFIG_TC -#else - #define READ_AND_CONFIG READ_AND_CONFIG_MP -#endif - -#define READ_AND_CONFIG_MP(ic, txt) (ODM_ReadAndConfig##txt##ic(pDM_Odm)) -#define READ_AND_CONFIG_TC(ic, txt) (ODM_ReadAndConfig_TC##txt##ic(pDM_Odm)) - -u1Byte -odm_QueryRxPwrPercentage( - IN s1Byte AntPower - ) -{ - if ((AntPower <= -100) || (AntPower >= 20)) - { - return 0; - } - else if (AntPower >= 0) - { - return 100; - } - else - { - return (100+AntPower); - } - -} - -#if (DM_ODM_SUPPORT_TYPE != ODM_MP) -// -// 2012/01/12 MH MOve some signal strength smooth method to MP HAL layer. -// IF other SW team do not support the feature, remove this section.?? -// -s4Byte -odm_SignalScaleMapping_92CSeries_patch_RT_CID_819x_Lenovo( - IN OUT PDM_ODM_T pDM_Odm, - s4Byte CurrSig -) -{ - s4Byte RetSig; -#if (DM_ODM_SUPPORT_TYPE == ODM_MP) - //if(pDM_Odm->SupportInterface == ODM_ITRF_PCIE) - { - // Step 1. Scale mapping. - // 20100611 Joseph: Re-tunning RSSI presentation for Lenovo. - // 20100426 Joseph: Modify Signal strength mapping. - // This modification makes the RSSI indication similar to Intel solution. - // 20100414 Joseph: Tunning RSSI for Lenovo according to RTL8191SE. - if(CurrSig >= 54 && CurrSig <= 100) - { - RetSig = 100; - } - else if(CurrSig>=42 && CurrSig <= 53 ) - { - RetSig = 95; - } - else if(CurrSig>=36 && CurrSig <= 41 ) - { - RetSig = 74 + ((CurrSig - 36) *20)/6; - } - else if(CurrSig>=33 && CurrSig <= 35 ) - { - RetSig = 65 + ((CurrSig - 33) *8)/2; - } - else if(CurrSig>=18 && CurrSig <= 32 ) - { - RetSig = 62 + ((CurrSig - 18) *2)/15; - } - else if(CurrSig>=15 && CurrSig <= 17 ) - { - RetSig = 33 + ((CurrSig - 15) *28)/2; - } - else if(CurrSig>=10 && CurrSig <= 14 ) - { - RetSig = 39; - } - else if(CurrSig>=8 && CurrSig <= 9 ) - { - RetSig = 33; - } - else if(CurrSig <= 8 ) - { - RetSig = 19; - } - } -#endif //ENDIF (DM_ODM_SUPPORT_TYPE == ODM_MP) - return RetSig; -} - -s4Byte -odm_SignalScaleMapping_92CSeries_patch_RT_CID_819x_Netcore( - IN OUT PDM_ODM_T pDM_Odm, - s4Byte CurrSig -) -{ - s4Byte RetSig; -#if (DM_ODM_SUPPORT_TYPE == ODM_MP) - //if(pDM_Odm->SupportInterface == ODM_ITRF_USB) - { - // Netcore request this modification because 2009.04.13 SU driver use it. - if(CurrSig >= 31 && CurrSig <= 100) - { - RetSig = 100; - } - else if(CurrSig >= 21 && CurrSig <= 30) - { - RetSig = 90 + ((CurrSig - 20) / 1); - } - else if(CurrSig >= 11 && CurrSig <= 20) - { - RetSig = 80 + ((CurrSig - 10) / 1); - } - else if(CurrSig >= 7 && CurrSig <= 10) - { - RetSig = 69 + (CurrSig - 7); - } - else if(CurrSig == 6) - { - RetSig = 54; - } - else if(CurrSig == 5) - { - RetSig = 45; - } - else if(CurrSig == 4) - { - RetSig = 36; - } - else if(CurrSig == 3) - { - RetSig = 27; - } - else if(CurrSig == 2) - { - RetSig = 18; - } - else if(CurrSig == 1) - { - RetSig = 9; - } - else - { - RetSig = CurrSig; - } - } -#endif //ENDIF (DM_ODM_SUPPORT_TYPE == ODM_MP) - return RetSig; -} - - -s4Byte -odm_SignalScaleMapping_92CSeries( - IN OUT PDM_ODM_T pDM_Odm, - IN s4Byte CurrSig -) -{ - s4Byte RetSig; -#if (DEV_BUS_TYPE == RT_PCI_INTERFACE) - if(pDM_Odm->SupportInterface == ODM_ITRF_PCIE) - { - // Step 1. Scale mapping. - if(CurrSig >= 61 && CurrSig <= 100) - { - RetSig = 90 + ((CurrSig - 60) / 4); - } - else if(CurrSig >= 41 && CurrSig <= 60) - { - RetSig = 78 + ((CurrSig - 40) / 2); - } - else if(CurrSig >= 31 && CurrSig <= 40) - { - RetSig = 66 + (CurrSig - 30); - } - else if(CurrSig >= 21 && CurrSig <= 30) - { - RetSig = 54 + (CurrSig - 20); - } - else if(CurrSig >= 5 && CurrSig <= 20) - { - RetSig = 42 + (((CurrSig - 5) * 2) / 3); - } - else if(CurrSig == 4) - { - RetSig = 36; - } - else if(CurrSig == 3) - { - RetSig = 27; - } - else if(CurrSig == 2) - { - RetSig = 18; - } - else if(CurrSig == 1) - { - RetSig = 9; - } - else - { - RetSig = CurrSig; - } - } -#endif - -#if ((DEV_BUS_TYPE == RT_USB_INTERFACE) ||(DEV_BUS_TYPE == RT_SDIO_INTERFACE)) - if((pDM_Odm->SupportInterface == ODM_ITRF_USB) || (pDM_Odm->SupportInterface == ODM_ITRF_SDIO) ) - { - if(CurrSig >= 51 && CurrSig <= 100) - { - RetSig = 100; - } - else if(CurrSig >= 41 && CurrSig <= 50) - { - RetSig = 80 + ((CurrSig - 40)*2); - } - else if(CurrSig >= 31 && CurrSig <= 40) - { - RetSig = 66 + (CurrSig - 30); - } - else if(CurrSig >= 21 && CurrSig <= 30) - { - RetSig = 54 + (CurrSig - 20); - } - else if(CurrSig >= 10 && CurrSig <= 20) - { - RetSig = 42 + (((CurrSig - 10) * 2) / 3); - } - else if(CurrSig >= 5 && CurrSig <= 9) - { - RetSig = 22 + (((CurrSig - 5) * 3) / 2); - } - else if(CurrSig >= 1 && CurrSig <= 4) - { - RetSig = 6 + (((CurrSig - 1) * 3) / 2); - } - else - { - RetSig = CurrSig; - } - } -#endif - return RetSig; -} -s4Byte -odm_SignalScaleMapping( - IN OUT PDM_ODM_T pDM_Odm, - IN s4Byte CurrSig -) -{ - if( (pDM_Odm->SupportPlatform == ODM_MP) && - (pDM_Odm->SupportInterface != ODM_ITRF_PCIE) && //USB & SDIO - (pDM_Odm->PatchID==10))//pMgntInfo->CustomerID == RT_CID_819x_Netcore - { - return odm_SignalScaleMapping_92CSeries_patch_RT_CID_819x_Netcore(pDM_Odm,CurrSig); - } - else if( (pDM_Odm->SupportPlatform == ODM_MP) && - (pDM_Odm->SupportInterface == ODM_ITRF_PCIE) && - (pDM_Odm->PatchID==19))//pMgntInfo->CustomerID == RT_CID_819x_Lenovo) - { - return odm_SignalScaleMapping_92CSeries_patch_RT_CID_819x_Lenovo(pDM_Odm, CurrSig); - } - else{ - return odm_SignalScaleMapping_92CSeries(pDM_Odm,CurrSig); - } - -} -#endif - -//pMgntInfo->CustomerID == RT_CID_819x_Lenovo -static u1Byte odm_SQ_process_patch_RT_CID_819x_Lenovo( - IN PDM_ODM_T pDM_Odm, - IN u1Byte isCCKrate, - IN u1Byte PWDB_ALL, - IN u1Byte path, - IN u1Byte RSSI -) -{ - u1Byte SQ; -#if (DM_ODM_SUPPORT_TYPE & ODM_MP) - // mapping to 5 bars for vista signal strength - // signal quality in driver will be displayed to signal strength - if(isCCKrate){ - // in vista. - if(PWDB_ALL >= 50) - SQ = 100; - else if(PWDB_ALL >= 35 && PWDB_ALL < 50) - SQ = 80; - else if(PWDB_ALL >= 22 && PWDB_ALL < 35) - SQ = 60; - else if(PWDB_ALL >= 18 && PWDB_ALL < 22) - SQ = 40; - else - SQ = 20; - } - else{//OFDM rate - - // mapping to 5 bars for vista signal strength - // signal quality in driver will be displayed to signal strength - // in vista. - if(RSSI >= 50) - SQ = 100; - else if(RSSI >= 35 && RSSI < 50) - SQ = 80; - else if(RSSI >= 22 && RSSI < 35) - SQ = 60; - else if(RSSI >= 18 && RSSI < 22) - SQ = 40; - else - SQ = 20; - } -#endif - return SQ; -} - -static u1Byte -odm_EVMdbToPercentage( - IN s1Byte Value - ) -{ - // - // -33dB~0dB to 0%~99% - // - s1Byte ret_val; - - ret_val = Value; - //ret_val /= 2; - - //ODM_RTPRINT(FRX, RX_PHY_SQ, ("EVMdbToPercentage92C Value=%d / %x \n", ret_val, ret_val)); - - if(ret_val >= 0) - ret_val = 0; - if(ret_val <= -33) - ret_val = -33; - - ret_val = 0 - ret_val; - ret_val*=3; - - if(ret_val == 99) - ret_val = 100; - - return(ret_val); -} - - - -VOID -odm_RxPhyStatus92CSeries_Parsing( - IN OUT PDM_ODM_T pDM_Odm, - OUT PODM_PHY_INFO_T pPhyInfo, - IN pu1Byte pPhyStatus, - IN PODM_PACKET_INFO_T pPktinfo - ) -{ - SWAT_T *pDM_SWAT_Table = &pDM_Odm->DM_SWAT_Table; - u1Byte i, Max_spatial_stream; - s1Byte rx_pwr[4], rx_pwr_all=0; - u1Byte EVM, PWDB_ALL = 0, PWDB_ALL_BT; - u1Byte RSSI, total_rssi=0; - u1Byte isCCKrate=0; - u1Byte rf_rx_num = 0; - u1Byte cck_highpwr = 0; - u1Byte LNA_idx, VGA_idx; - - PPHY_STATUS_RPT_8192CD_T pPhyStaRpt = (PPHY_STATUS_RPT_8192CD_T)pPhyStatus; - - isCCKrate = ((pPktinfo->Rate >= DESC92C_RATE1M ) && (pPktinfo->Rate <= DESC92C_RATE11M ))?TRUE :FALSE; - - pPhyInfo->RxMIMOSignalQuality[ODM_RF_PATH_A] = -1; - pPhyInfo->RxMIMOSignalQuality[ODM_RF_PATH_B] = -1; - - - if(isCCKrate) - { - u1Byte report; - u1Byte cck_agc_rpt; - - pDM_Odm->PhyDbgInfo.NumQryPhyStatusCCK++; - // - // (1)Hardware does not provide RSSI for CCK - // (2)PWDB, Average PWDB cacluated by hardware (for rate adaptive) - // - - //if(pHalData->eRFPowerState == eRfOn) - cck_highpwr = pDM_Odm->bCckHighPower; - //else - // cck_highpwr = FALSE; - - cck_agc_rpt = pPhyStaRpt->cck_agc_rpt_ofdm_cfosho_a ; - - //2011.11.28 LukeLee: 88E use different LNA & VGA gain table - //The RSSI formula should be modified according to the gain table - //In 88E, cck_highpwr is always set to 1 - if(pDM_Odm->SupportICType & (ODM_RTL8188E|ODM_RTL8812)) - { - LNA_idx = ((cck_agc_rpt & 0xE0) >>5); - VGA_idx = (cck_agc_rpt & 0x1F); - switch(LNA_idx) - { - case 7: - if(VGA_idx <= 27) - rx_pwr_all = -100 + 2*(27-VGA_idx); //VGA_idx = 27~2 - else - rx_pwr_all = -100; - break; - case 6: - rx_pwr_all = -48 + 2*(2-VGA_idx); //VGA_idx = 2~0 - break; - case 5: - rx_pwr_all = -42 + 2*(7-VGA_idx); //VGA_idx = 7~5 - break; - case 4: - rx_pwr_all = -36 + 2*(7-VGA_idx); //VGA_idx = 7~4 - break; - case 3: - //rx_pwr_all = -28 + 2*(7-VGA_idx); //VGA_idx = 7~0 - rx_pwr_all = -24 + 2*(7-VGA_idx); //VGA_idx = 7~0 - break; - case 2: - if(cck_highpwr) - rx_pwr_all = -12 + 2*(5-VGA_idx); //VGA_idx = 5~0 - else - rx_pwr_all = -6+ 2*(5-VGA_idx); - break; - case 1: - rx_pwr_all = 8-2*VGA_idx; - break; - case 0: - rx_pwr_all = 14-2*VGA_idx; - break; - default: - //DbgPrint("CCK Exception default\n"); - break; - } - rx_pwr_all += 6; - PWDB_ALL = odm_QueryRxPwrPercentage(rx_pwr_all); - if(cck_highpwr == FALSE) - { - if(PWDB_ALL >= 80) - PWDB_ALL = ((PWDB_ALL-80)<<1)+((PWDB_ALL-80)>>1)+80; - else if((PWDB_ALL <= 78) && (PWDB_ALL >= 20)) - PWDB_ALL += 3; - if(PWDB_ALL>100) - PWDB_ALL = 100; - } - } - else - { - if(!cck_highpwr) - { - report =( cck_agc_rpt & 0xc0 )>>6; - switch(report) - { - // 03312009 modified by cosa - // Modify the RF RNA gain value to -40, -20, -2, 14 by Jenyu's suggestion - // Note: different RF with the different RNA gain. - case 0x3: - rx_pwr_all = -46 - (cck_agc_rpt & 0x3e); - break; - case 0x2: - rx_pwr_all = -26 - (cck_agc_rpt & 0x3e); - break; - case 0x1: - rx_pwr_all = -12 - (cck_agc_rpt & 0x3e); - break; - case 0x0: - rx_pwr_all = 16 - (cck_agc_rpt & 0x3e); - break; - } - } - else - { - //report = pDrvInfo->cfosho[0] & 0x60; - //report = pPhyStaRpt->cck_agc_rpt_ofdm_cfosho_a& 0x60; - - report = (cck_agc_rpt & 0x60)>>5; - switch(report) - { - case 0x3: - rx_pwr_all = -46 - ((cck_agc_rpt & 0x1f)<<1) ; - break; - case 0x2: - rx_pwr_all = -26 - ((cck_agc_rpt & 0x1f)<<1); - break; - case 0x1: - rx_pwr_all = -12 - ((cck_agc_rpt & 0x1f)<<1) ; - break; - case 0x0: - rx_pwr_all = 16 - ((cck_agc_rpt & 0x1f)<<1) ; - break; - } - } - - PWDB_ALL = odm_QueryRxPwrPercentage(rx_pwr_all); - - //Modification for ext-LNA board - if(pDM_Odm->BoardType & (ODM_BOARD_EXT_LNA | ODM_BOARD_EXT_PA)) - { - if((cck_agc_rpt>>7) == 0){ - PWDB_ALL = (PWDB_ALL>94)?100:(PWDB_ALL +6); - } - else - { - if(PWDB_ALL > 38) - PWDB_ALL -= 16; - else - PWDB_ALL = (PWDB_ALL<=16)?(PWDB_ALL>>2):(PWDB_ALL -12); - } - - //CCK modification - if(PWDB_ALL > 25 && PWDB_ALL <= 60) - PWDB_ALL += 6; - //else if (PWDB_ALL <= 25) - // PWDB_ALL += 8; - } - else//Modification for int-LNA board - { - if(PWDB_ALL > 99) - PWDB_ALL -= 8; - else if(PWDB_ALL > 50 && PWDB_ALL <= 68) - PWDB_ALL += 4; - } - } - - pPhyInfo->RxPWDBAll = PWDB_ALL; -#if (DM_ODM_SUPPORT_TYPE & (ODM_MP|ODM_CE)) - pPhyInfo->BTRxRSSIPercentage = PWDB_ALL; - pPhyInfo->RecvSignalPower = rx_pwr_all; -#endif - // - // (3) Get Signal Quality (EVM) - // - if(pPktinfo->bPacketMatchBSSID) - { - u1Byte SQ,SQ_rpt; - - if((pDM_Odm->SupportPlatform == ODM_MP) &&(pDM_Odm->PatchID==19)){//pMgntInfo->CustomerID == RT_CID_819x_Lenovo - SQ = odm_SQ_process_patch_RT_CID_819x_Lenovo(pDM_Odm,isCCKrate,PWDB_ALL,0,0); - } - else if(pPhyInfo->RxPWDBAll > 40 && !pDM_Odm->bInHctTest){ - SQ = 100; - } - else{ - SQ_rpt = pPhyStaRpt->cck_sig_qual_ofdm_pwdb_all; - - if(SQ_rpt > 64) - SQ = 0; - else if (SQ_rpt < 20) - SQ = 100; - else - SQ = ((64-SQ_rpt) * 100) / 44; - - } - - //DbgPrint("cck SQ = %d\n", SQ); - pPhyInfo->SignalQuality = SQ; - pPhyInfo->RxMIMOSignalQuality[ODM_RF_PATH_A] = SQ; - pPhyInfo->RxMIMOSignalQuality[ODM_RF_PATH_B] = -1; - } - } - else //is OFDM rate - { - pDM_Odm->PhyDbgInfo.NumQryPhyStatusOFDM++; - - // - // (1)Get RSSI for HT rate - // - - for(i = ODM_RF_PATH_A; i < ODM_RF_PATH_MAX; i++) - { - // 2008/01/30 MH we will judge RF RX path now. - if (pDM_Odm->RFPathRxEnable & BIT(i)) - rf_rx_num++; - //else - //continue; - - rx_pwr[i] = ((pPhyStaRpt->path_agc[i].gain& 0x3F)*2) - 110; - - #if (DM_ODM_SUPPORT_TYPE & (ODM_MP|ODM_CE)) - pPhyInfo->RxPwr[i] = rx_pwr[i]; - #endif - - /* Translate DBM to percentage. */ - RSSI = odm_QueryRxPwrPercentage(rx_pwr[i]); - total_rssi += RSSI; - //RTPRINT(FRX, RX_PHY_SS, ("RF-%d RXPWR=%x RSSI=%d\n", i, rx_pwr[i], RSSI)); - - //Modification for ext-LNA board - if(pDM_Odm->BoardType & (ODM_BOARD_EXT_LNA | ODM_BOARD_EXT_PA)) - { - if((pPhyStaRpt->path_agc[i].trsw) == 1) - RSSI = (RSSI>94)?100:(RSSI +6); - else - RSSI = (RSSI<=16)?(RSSI>>3):(RSSI -16); - - if((RSSI <= 34) && (RSSI >=4)) - RSSI -= 4; - } - - pPhyInfo->RxMIMOSignalStrength[i] =(u1Byte) RSSI; - - #if (DM_ODM_SUPPORT_TYPE & (/*ODM_MP|*/ODM_CE|ODM_AP|ODM_ADSL)) - //Get Rx snr value in DB - pPhyInfo->RxSNR[i] = pDM_Odm->PhyDbgInfo.RxSNRdB[i] = (s4Byte)(pPhyStaRpt->path_rxsnr[i]/2); - #endif - - /* Record Signal Strength for next packet */ - if(pPktinfo->bPacketMatchBSSID) - { - if((pDM_Odm->SupportPlatform == ODM_MP) &&(pDM_Odm->PatchID==19)) - { - if(i==ODM_RF_PATH_A) - pPhyInfo->SignalQuality = odm_SQ_process_patch_RT_CID_819x_Lenovo(pDM_Odm,isCCKrate,PWDB_ALL,i,RSSI); - - } - - } - } - - - // - // (2)PWDB, Average PWDB cacluated by hardware (for rate adaptive) - // - rx_pwr_all = (((pPhyStaRpt->cck_sig_qual_ofdm_pwdb_all) >> 1 )& 0x7f) -110; - //RTPRINT(FRX, RX_PHY_SS, ("PWDB_ALL=%d\n", PWDB_ALL)); - - PWDB_ALL_BT = PWDB_ALL = odm_QueryRxPwrPercentage(rx_pwr_all); - //RTPRINT(FRX, RX_PHY_SS, ("PWDB_ALL=%d\n",PWDB_ALL)); - - pPhyInfo->RxPWDBAll = PWDB_ALL; - //ODM_RT_TRACE(pDM_Odm,ODM_COMP_RSSI_MONITOR, ODM_DBG_LOUD, ("ODM OFDM RSSI=%d\n",pPhyInfo->RxPWDBAll)); - #if (DM_ODM_SUPPORT_TYPE & (ODM_MP|ODM_CE)) - pPhyInfo->BTRxRSSIPercentage = PWDB_ALL_BT; - pPhyInfo->RxPower = rx_pwr_all; - pPhyInfo->RecvSignalPower = rx_pwr_all; - #endif - - if((pDM_Odm->SupportPlatform == ODM_MP) &&(pDM_Odm->PatchID==19)){ - //do nothing - } - else{//pMgntInfo->CustomerID != RT_CID_819x_Lenovo - // - // (3)EVM of HT rate - // - if(pPktinfo->Rate >=DESC92C_RATEMCS8 && pPktinfo->Rate <=DESC92C_RATEMCS15) - Max_spatial_stream = 2; //both spatial stream make sense - else - Max_spatial_stream = 1; //only spatial stream 1 makes sense - - for(i=0; i>= 1" because the compilor of free build environment - // fill most significant bit to "zero" when doing shifting operation which may change a negative - // value to positive one, then the dbm value (which is supposed to be negative) is not correct anymore. - EVM = odm_EVMdbToPercentage( (pPhyStaRpt->stream_rxevm[i] )); //dbm - - //RTPRINT(FRX, RX_PHY_SQ, ("RXRATE=%x RXEVM=%x EVM=%s%d\n", - //GET_RX_STATUS_DESC_RX_MCS(pDesc), pDrvInfo->rxevm[i], "%", EVM)); - - if(pPktinfo->bPacketMatchBSSID) - { - if(i==ODM_RF_PATH_A) // Fill value in RFD, Get the first spatial stream only - { - pPhyInfo->SignalQuality = (u1Byte)(EVM & 0xff); - } - pPhyInfo->RxMIMOSignalQuality[i] = (u1Byte)(EVM & 0xff); - } - } - } - - } -#if (DM_ODM_SUPPORT_TYPE & (ODM_MP|ODM_CE)) - //UI BSS List signal strength(in percentage), make it good looking, from 0~100. - //It is assigned to the BSS List in GetValueFromBeaconOrProbeRsp(). - if(isCCKrate) - { -#if (DM_ODM_SUPPORT_TYPE == ODM_MP) - // 2012/01/12 MH Use customeris signal strength from HalComRxdDesc.c/ - pPhyInfo->SignalStrength = (u1Byte)(SignalScaleMapping(pDM_Odm->Adapter, PWDB_ALL));//PWDB_ALL; -#else - pPhyInfo->SignalStrength = (u1Byte)(odm_SignalScaleMapping(pDM_Odm, PWDB_ALL));//PWDB_ALL; -#endif - } - else - { - if (rf_rx_num != 0) - { -#if (DM_ODM_SUPPORT_TYPE == ODM_MP) - // 2012/01/12 MH Use customeris signal strength from HalComRxdDesc.c/ - pPhyInfo->SignalStrength = (u1Byte)(SignalScaleMapping(pDM_Odm->Adapter, total_rssi/=rf_rx_num));//PWDB_ALL; -#else - pPhyInfo->SignalStrength = (u1Byte)(odm_SignalScaleMapping(pDM_Odm, total_rssi/=rf_rx_num)); -#endif - } - } -#endif - - //For 92C/92D HW (Hybrid) Antenna Diversity -#if(defined(CONFIG_HW_ANTENNA_DIVERSITY)) - pDM_SWAT_Table->antsel = pPhyStaRpt->ant_sel; - //For 88E HW Antenna Diversity - pDM_Odm->DM_FatTable.antsel_rx_keep_0 = pPhyStaRpt->ant_sel; - pDM_Odm->DM_FatTable.antsel_rx_keep_1 = pPhyStaRpt->ant_sel_b; - pDM_Odm->DM_FatTable.antsel_rx_keep_2 = pPhyStaRpt->antsel_rx_keep_2; -#endif -} - -VOID -odm_Init_RSSIForDM( - IN OUT PDM_ODM_T pDM_Odm - ) -{ - -} - -VOID -odm_Process_RSSIForDM( - IN OUT PDM_ODM_T pDM_Odm, - IN PODM_PHY_INFO_T pPhyInfo, - IN PODM_PACKET_INFO_T pPktinfo - ) -{ - - s4Byte UndecoratedSmoothedPWDB, UndecoratedSmoothedCCK, UndecoratedSmoothedOFDM, RSSI_Ave; - u1Byte isCCKrate=0; - u1Byte RSSI_max, RSSI_min, i; - u4Byte OFDM_pkt=0; - u4Byte Weighting=0; - - PSTA_INFO_T pEntry; - - if(pPktinfo->StationID == 0xFF) - return; - - // 2011/11/17 MH Need to debug - //if (pDM_Odm->SupportPlatform == ODM_MP) - { - - } - - pEntry = pDM_Odm->pODM_StaInfo[pPktinfo->StationID]; - if(!IS_STA_VALID(pEntry) ){ - return; - } - if((!pPktinfo->bPacketMatchBSSID) ) - { - return; - } - - isCCKrate = ((pPktinfo->Rate >= DESC92C_RATE1M ) && (pPktinfo->Rate <= DESC92C_RATE11M ))?TRUE :FALSE; - if(pPktinfo->bPacketBeacon) - pDM_Odm->PhyDbgInfo.NumQryBeaconPkt++; - - pDM_Odm->RxRate = pPktinfo->Rate; -#if(defined(CONFIG_HW_ANTENNA_DIVERSITY)) -#if ((RTL8192C_SUPPORT == 1) ||(RTL8192D_SUPPORT == 1)) - if(pDM_Odm->SupportICType & ODM_RTL8192C|ODM_RTL8192D) - { - if(pPktinfo->bPacketToSelf || pPktinfo->bPacketBeacon) - { - //if(pPktinfo->bPacketBeacon) - //{ - // DbgPrint("This is beacon, isCCKrate=%d\n", isCCKrate); - //} - ODM_AntselStatistics_88C(pDM_Odm, pPktinfo->StationID, pPhyInfo->RxPWDBAll, isCCKrate); - } - } -#endif - //-----------------Smart Antenna Debug Message------------------// -#if (RTL8188E_SUPPORT == 1) - if(pDM_Odm->SupportICType == ODM_RTL8188E) - { - u1Byte antsel_tr_mux; - pFAT_T pDM_FatTable = &pDM_Odm->DM_FatTable; - - if(pDM_Odm->AntDivType == CG_TRX_SMART_ANTDIV) - { - if(pDM_FatTable->FAT_State == FAT_TRAINING_STATE) - { - if(pPktinfo->bPacketToSelf) //(pPktinfo->bPacketMatchBSSID && (!pPktinfo->bPacketBeacon)) - { - antsel_tr_mux = (pDM_FatTable->antsel_rx_keep_2<<2) |(pDM_FatTable->antsel_rx_keep_1 <<1) |pDM_FatTable->antsel_rx_keep_0; - pDM_FatTable->antSumRSSI[antsel_tr_mux] += pPhyInfo->RxPWDBAll; - pDM_FatTable->antRSSIcnt[antsel_tr_mux]++; - //ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD,("isCCKrate=%d, PWDB_ALL=%d\n",isCCKrate, pPhyInfo->RxPWDBAll)); - //ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD,("antsel_tr_mux=3'b%d%d%d\n", - //pDM_FatTable->antsel_rx_keep_2, pDM_FatTable->antsel_rx_keep_1, pDM_FatTable->antsel_rx_keep_0)); - - } - } - } - else if((pDM_Odm->AntDivType == CG_TRX_HW_ANTDIV)||(pDM_Odm->AntDivType == CGCS_RX_HW_ANTDIV)) - { - if(pPktinfo->bPacketToSelf || pPktinfo->bPacketBeacon) - { - antsel_tr_mux = (pDM_FatTable->antsel_rx_keep_2<<2) |(pDM_FatTable->antsel_rx_keep_1 <<1) |pDM_FatTable->antsel_rx_keep_0; - //ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD,("antsel_tr_mux=3'b%d%d%d\n", - // pDM_FatTable->antsel_rx_keep_2, pDM_FatTable->antsel_rx_keep_1, pDM_FatTable->antsel_rx_keep_0)); - - ODM_AntselStatistics_88E(pDM_Odm, antsel_tr_mux, pPktinfo->StationID, pPhyInfo->RxPWDBAll); - } - } - - } -#endif -#endif //#if(defined(CONFIG_HW_ANTENNA_DIVERSITY)) - //-----------------Smart Antenna Debug Message------------------// - - UndecoratedSmoothedCCK = pEntry->rssi_stat.UndecoratedSmoothedCCK; - UndecoratedSmoothedOFDM = pEntry->rssi_stat.UndecoratedSmoothedOFDM; - UndecoratedSmoothedPWDB = pEntry->rssi_stat.UndecoratedSmoothedPWDB; - - if(pPktinfo->bPacketToSelf || pPktinfo->bPacketBeacon) - { - - if(!isCCKrate)//ofdm rate - { - if(pPhyInfo->RxMIMOSignalStrength[ODM_RF_PATH_B] == 0){ - RSSI_Ave = pPhyInfo->RxMIMOSignalStrength[ODM_RF_PATH_A]; - pDM_Odm->RSSI_A = pPhyInfo->RxMIMOSignalStrength[ODM_RF_PATH_A]; - pDM_Odm->RSSI_B = 0; - } - else - { - //DbgPrint("pRfd->Status.RxMIMOSignalStrength[0] = %d, pRfd->Status.RxMIMOSignalStrength[1] = %d \n", - //pRfd->Status.RxMIMOSignalStrength[0], pRfd->Status.RxMIMOSignalStrength[1]); - pDM_Odm->RSSI_A = pPhyInfo->RxMIMOSignalStrength[ODM_RF_PATH_A]; - pDM_Odm->RSSI_B = pPhyInfo->RxMIMOSignalStrength[ODM_RF_PATH_B]; - - if(pPhyInfo->RxMIMOSignalStrength[ODM_RF_PATH_A] > pPhyInfo->RxMIMOSignalStrength[ODM_RF_PATH_B]) - { - RSSI_max = pPhyInfo->RxMIMOSignalStrength[ODM_RF_PATH_A]; - RSSI_min = pPhyInfo->RxMIMOSignalStrength[ODM_RF_PATH_B]; - } - else - { - RSSI_max = pPhyInfo->RxMIMOSignalStrength[ODM_RF_PATH_B]; - RSSI_min = pPhyInfo->RxMIMOSignalStrength[ODM_RF_PATH_A]; - } - if((RSSI_max -RSSI_min) < 3) - RSSI_Ave = RSSI_max; - else if((RSSI_max -RSSI_min) < 6) - RSSI_Ave = RSSI_max - 1; - else if((RSSI_max -RSSI_min) < 10) - RSSI_Ave = RSSI_max - 2; - else - RSSI_Ave = RSSI_max - 3; - } - - //1 Process OFDM RSSI - if(UndecoratedSmoothedOFDM <= 0) // initialize - { - UndecoratedSmoothedOFDM = pPhyInfo->RxPWDBAll; - } - else - { - if(pPhyInfo->RxPWDBAll > (u4Byte)UndecoratedSmoothedOFDM) - { - UndecoratedSmoothedOFDM = - ( ((UndecoratedSmoothedOFDM)*(Rx_Smooth_Factor-1)) + - (RSSI_Ave)) /(Rx_Smooth_Factor); - UndecoratedSmoothedOFDM = UndecoratedSmoothedOFDM + 1; - } - else - { - UndecoratedSmoothedOFDM = - ( ((UndecoratedSmoothedOFDM)*(Rx_Smooth_Factor-1)) + - (RSSI_Ave)) /(Rx_Smooth_Factor); - } - } - - pEntry->rssi_stat.PacketMap = (pEntry->rssi_stat.PacketMap<<1) | BIT0; - - } - else - { - RSSI_Ave = pPhyInfo->RxPWDBAll; - pDM_Odm->RSSI_A = (u1Byte) pPhyInfo->RxPWDBAll; - pDM_Odm->RSSI_B = 0xFF; - - //1 Process CCK RSSI - if(UndecoratedSmoothedCCK <= 0) // initialize - { - UndecoratedSmoothedCCK = pPhyInfo->RxPWDBAll; - } - else - { - if(pPhyInfo->RxPWDBAll > (u4Byte)UndecoratedSmoothedCCK) - { - UndecoratedSmoothedCCK = - ( ((UndecoratedSmoothedCCK)*(Rx_Smooth_Factor-1)) + - (pPhyInfo->RxPWDBAll)) /(Rx_Smooth_Factor); - UndecoratedSmoothedCCK = UndecoratedSmoothedCCK + 1; - } - else - { - UndecoratedSmoothedCCK = - ( ((UndecoratedSmoothedCCK)*(Rx_Smooth_Factor-1)) + - (pPhyInfo->RxPWDBAll)) /(Rx_Smooth_Factor); - } - } - pEntry->rssi_stat.PacketMap = pEntry->rssi_stat.PacketMap<<1; - } - - //if(pEntry) - { - //2011.07.28 LukeLee: modified to prevent unstable CCK RSSI - if(pEntry->rssi_stat.ValidBit >= 64) - pEntry->rssi_stat.ValidBit = 64; - else - pEntry->rssi_stat.ValidBit++; - - for(i=0; irssi_stat.ValidBit; i++) - OFDM_pkt += (u1Byte)(pEntry->rssi_stat.PacketMap>>i)&BIT0; - - if(pEntry->rssi_stat.ValidBit == 64) - { - Weighting = ((OFDM_pkt<<4) > 64)?64:(OFDM_pkt<<4); - UndecoratedSmoothedPWDB = (Weighting*UndecoratedSmoothedOFDM+(64-Weighting)*UndecoratedSmoothedCCK)>>6; - } - else - { - if(pEntry->rssi_stat.ValidBit != 0) - UndecoratedSmoothedPWDB = (OFDM_pkt*UndecoratedSmoothedOFDM+(pEntry->rssi_stat.ValidBit-OFDM_pkt)*UndecoratedSmoothedCCK)/pEntry->rssi_stat.ValidBit; - else - UndecoratedSmoothedPWDB = 0; - } - - pEntry->rssi_stat.UndecoratedSmoothedCCK = UndecoratedSmoothedCCK; - pEntry->rssi_stat.UndecoratedSmoothedOFDM = UndecoratedSmoothedOFDM; - pEntry->rssi_stat.UndecoratedSmoothedPWDB = UndecoratedSmoothedPWDB; - - //DbgPrint("OFDM_pkt=%d, Weighting=%d\n", OFDM_pkt, Weighting); - //DbgPrint("UndecoratedSmoothedOFDM=%d, UndecoratedSmoothedPWDB=%d, UndecoratedSmoothedCCK=%d\n", - // UndecoratedSmoothedOFDM, UndecoratedSmoothedPWDB, UndecoratedSmoothedCCK); - - } - - } -} - -// -// Endianness before calling this API -// -VOID -ODM_PhyStatusQuery_92CSeries( - IN OUT PDM_ODM_T pDM_Odm, - OUT PODM_PHY_INFO_T pPhyInfo, - IN pu1Byte pPhyStatus, - IN PODM_PACKET_INFO_T pPktinfo - ) -{ - - odm_RxPhyStatus92CSeries_Parsing( - pDM_Odm, - pPhyInfo, - pPhyStatus, - pPktinfo); - - if( pDM_Odm->RSSI_test == TRUE) - { - // Select the packets to do RSSI checking for antenna switching. - if(pPktinfo->bPacketToSelf || pPktinfo->bPacketBeacon ) - { - /* - #if 0//(DM_ODM_SUPPORT_TYPE == ODM_MP) - dm_SWAW_RSSI_Check( - Adapter, - (tmppAdapter!=NULL)?(tmppAdapter==Adapter):TRUE, - bPacketMatchBSSID, - pEntry, - pRfd); - #elif (DM_ODM_SUPPORT_TYPE == ODM_CE) - // Select the packets to do RSSI checking for antenna switching. - //odm_SwAntDivRSSICheck8192C(padapter, precvframe->u.hdr.attrib.RxPWDBAll); - #endif - */ - ODM_SwAntDivChkPerPktRssi(pDM_Odm,pPktinfo->StationID,pPhyInfo); - } - } - else - { - odm_Process_RSSIForDM(pDM_Odm,pPhyInfo,pPktinfo); - } - -} - - - -// -// Endianness before calling this API -// -VOID -ODM_PhyStatusQuery_JaguarSeries( - IN OUT PDM_ODM_T pDM_Odm, - OUT PODM_PHY_INFO_T pPhyInfo, - IN pu1Byte pPhyStatus, - IN PODM_PACKET_INFO_T pPktinfo - ) -{ - - -} - -VOID -ODM_PhyStatusQuery( - IN OUT PDM_ODM_T pDM_Odm, - OUT PODM_PHY_INFO_T pPhyInfo, - IN pu1Byte pPhyStatus, - IN PODM_PACKET_INFO_T pPktinfo - ) -{ -#if 0 // How to jaguar jugar series?? - if(pDM_Odm->SupportICType >= ODM_RTL8195 ) - { - ODM_PhyStatusQuery_JaguarSeries(pDM_Odm,pPhyInfo,pPhyStatus,pPktinfo); - } - else -#endif - { - ODM_PhyStatusQuery_92CSeries(pDM_Odm,pPhyInfo,pPhyStatus,pPktinfo); - } -} - -// For future use. -VOID -ODM_MacStatusQuery( - IN OUT PDM_ODM_T pDM_Odm, - IN pu1Byte pMacStatus, - IN u1Byte MacID, - IN BOOLEAN bPacketMatchBSSID, - IN BOOLEAN bPacketToSelf, - IN BOOLEAN bPacketBeacon - ) -{ - // 2011/10/19 Driver team will handle in the future. - -} - -#if (DM_ODM_SUPPORT_TYPE & (ODM_MP|ODM_CE|ODM_AP)) - -HAL_STATUS -ODM_ConfigRFWithHeaderFile( - IN PDM_ODM_T pDM_Odm, - IN ODM_RF_RADIO_PATH_E Content, - IN ODM_RF_RADIO_PATH_E eRFPath - ) -{ - //RT_STATUS rtStatus = RT_STATUS_SUCCESS; - - - ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_LOUD, ("===>ODM_ConfigRFWithHeaderFile\n")); -#if (RTL8723A_SUPPORT == 1) - if (pDM_Odm->SupportICType == ODM_RTL8723A) - { - if(eRFPath == ODM_RF_PATH_A) - READ_AND_CONFIG_MP(8723A,_RadioA_1T_); - - ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_LOUD, (" ===> ODM_ConfigRFWithHeaderFile() Radio_A:Rtl8723RadioA_1TArray\n")); - ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_LOUD, (" ===> ODM_ConfigRFWithHeaderFile() Radio_B:Rtl8723RadioB_1TArray\n")); - } - - ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_TRACE, ("ODM_ConfigRFWithHeaderFile: Radio No %x\n", eRFPath)); - //rtStatus = RT_STATUS_SUCCESS; -#endif -#if (RTL8188E_SUPPORT == 1) - if (pDM_Odm->SupportICType == ODM_RTL8188E) - { - if(IS_VENDOR_8188E_I_CUT_SERIES(pDM_Odm->Adapter)) - READ_AND_CONFIG(8188E,_RadioA_1T_ICUT_); - else - READ_AND_CONFIG(8188E,_RadioA_1T_); - - - ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_LOUD, (" ===> ODM_ConfigRFWithHeaderFile() Radio_A:Rtl8188ERadioA_1TArray\n")); - ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_LOUD, (" ===> ODM_ConfigRFWithHeaderFile() Radio_B:Rtl8188ERadioB_1TArray\n")); - } - - ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_TRACE, ("ODM_ConfigRFWithHeaderFile: Radio No %x\n", eRFPath)); - //rtStatus = RT_STATUS_SUCCESS; -#endif - return HAL_STATUS_SUCCESS; -} - - -HAL_STATUS -ODM_ConfigBBWithHeaderFile( - IN PDM_ODM_T pDM_Odm, - IN ODM_BB_Config_Type ConfigType - ) -{ -#if (RTL8723A_SUPPORT == 1) - if(pDM_Odm->SupportICType == ODM_RTL8723A) - { - - if(ConfigType == CONFIG_BB_PHY_REG) - { - READ_AND_CONFIG_MP(8723A,_PHY_REG_1T_); - } - else if(ConfigType == CONFIG_BB_AGC_TAB) - { - READ_AND_CONFIG_MP(8723A,_AGC_TAB_1T_); - } - ODM_RT_TRACE(pDM_Odm,ODM_COMP_INIT, ODM_DBG_LOUD, (" ===> phy_ConfigBBWithHeaderFile() phy:Rtl8723AGCTAB_1TArray\n")); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_INIT, ODM_DBG_LOUD, (" ===> phy_ConfigBBWithHeaderFile() agc:Rtl8723PHY_REG_1TArray\n")); - } -#endif - -#if (RTL8188E_SUPPORT == 1) - if(pDM_Odm->SupportICType == ODM_RTL8188E) - { - - if(ConfigType == CONFIG_BB_PHY_REG) - { - if(IS_VENDOR_8188E_I_CUT_SERIES(pDM_Odm->Adapter)) - READ_AND_CONFIG(8188E,_PHY_REG_1T_ICUT_); - else - READ_AND_CONFIG(8188E,_PHY_REG_1T_); - } - else if(ConfigType == CONFIG_BB_AGC_TAB) - { - if(IS_VENDOR_8188E_I_CUT_SERIES(pDM_Odm->Adapter)) - READ_AND_CONFIG(8188E,_AGC_TAB_1T_ICUT_); - else - READ_AND_CONFIG(8188E,_AGC_TAB_1T_); - } - else if(ConfigType == CONFIG_BB_PHY_REG_PG) - { - READ_AND_CONFIG(8188E,_PHY_REG_PG_); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_INIT, ODM_DBG_LOUD, (" ===> phy_ConfigBBWithHeaderFile() agc:Rtl8188EPHY_REG_PGArray\n")); - } - } -#endif - - return HAL_STATUS_SUCCESS; -} - -HAL_STATUS -ODM_ConfigMACWithHeaderFile( - IN PDM_ODM_T pDM_Odm - ) -{ - u1Byte result = HAL_STATUS_SUCCESS; -#if (RTL8723A_SUPPORT == 1) - if (pDM_Odm->SupportICType == ODM_RTL8723A) - { - READ_AND_CONFIG_MP(8723A,_MAC_REG_); - } -#endif -#if (RTL8188E_SUPPORT == 1) - if (pDM_Odm->SupportICType == ODM_RTL8188E) - { - if(IS_VENDOR_8188E_I_CUT_SERIES(pDM_Odm->Adapter)) - READ_AND_CONFIG(8188E,_MAC_REG_ICUT_); - else - result =READ_AND_CONFIG(8188E,_MAC_REG_); - } -#endif - - return result; -} - - -#endif // end of (#if DM_ODM_SUPPORT_TYPE) - +/****************************************************************************** + * + * 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 + * + * + ******************************************************************************/ + +//============================================================ +// include files +//============================================================ + +#include "odm_precomp.h" + +#if (RTL8188E_FOR_TEST_CHIP > 1) + #define READ_AND_CONFIG(ic, txt) do {\ + if (pDM_Odm->bIsMPChip)\ + READ_AND_CONFIG_MP(ic,txt);\ + else\ + READ_AND_CONFIG_TC(ic,txt);\ + } while(0) +#elif (RTL8188E_FOR_TEST_CHIP == 1) + #define READ_AND_CONFIG READ_AND_CONFIG_TC +#else + #define READ_AND_CONFIG READ_AND_CONFIG_MP +#endif + +#define READ_AND_CONFIG_MP(ic, txt) (ODM_ReadAndConfig##txt##ic(pDM_Odm)) +#define READ_AND_CONFIG_TC(ic, txt) (ODM_ReadAndConfig_TC##txt##ic(pDM_Odm)) + +u1Byte +odm_QueryRxPwrPercentage( + IN s1Byte AntPower + ) +{ + if ((AntPower <= -100) || (AntPower >= 20)) + { + return 0; + } + else if (AntPower >= 0) + { + return 100; + } + else + { + return (100+AntPower); + } + +} + +#if (DM_ODM_SUPPORT_TYPE != ODM_MP) +// +// 2012/01/12 MH MOve some signal strength smooth method to MP HAL layer. +// IF other SW team do not support the feature, remove this section.?? +// +s4Byte +odm_SignalScaleMapping_92CSeries_patch_RT_CID_819x_Lenovo( + IN OUT PDM_ODM_T pDM_Odm, + s4Byte CurrSig +) +{ + s4Byte RetSig; +#if (DM_ODM_SUPPORT_TYPE == ODM_MP) + //if(pDM_Odm->SupportInterface == ODM_ITRF_PCIE) + { + // Step 1. Scale mapping. + // 20100611 Joseph: Re-tunning RSSI presentation for Lenovo. + // 20100426 Joseph: Modify Signal strength mapping. + // This modification makes the RSSI indication similar to Intel solution. + // 20100414 Joseph: Tunning RSSI for Lenovo according to RTL8191SE. + if(CurrSig >= 54 && CurrSig <= 100) + { + RetSig = 100; + } + else if(CurrSig>=42 && CurrSig <= 53 ) + { + RetSig = 95; + } + else if(CurrSig>=36 && CurrSig <= 41 ) + { + RetSig = 74 + ((CurrSig - 36) *20)/6; + } + else if(CurrSig>=33 && CurrSig <= 35 ) + { + RetSig = 65 + ((CurrSig - 33) *8)/2; + } + else if(CurrSig>=18 && CurrSig <= 32 ) + { + RetSig = 62 + ((CurrSig - 18) *2)/15; + } + else if(CurrSig>=15 && CurrSig <= 17 ) + { + RetSig = 33 + ((CurrSig - 15) *28)/2; + } + else if(CurrSig>=10 && CurrSig <= 14 ) + { + RetSig = 39; + } + else if(CurrSig>=8 && CurrSig <= 9 ) + { + RetSig = 33; + } + else if(CurrSig <= 8 ) + { + RetSig = 19; + } + } +#endif //ENDIF (DM_ODM_SUPPORT_TYPE == ODM_MP) + return RetSig; +} + +s4Byte +odm_SignalScaleMapping_92CSeries_patch_RT_CID_819x_Netcore( + IN OUT PDM_ODM_T pDM_Odm, + s4Byte CurrSig +) +{ + s4Byte RetSig; +#if (DM_ODM_SUPPORT_TYPE == ODM_MP) + //if(pDM_Odm->SupportInterface == ODM_ITRF_USB) + { + // Netcore request this modification because 2009.04.13 SU driver use it. + if(CurrSig >= 31 && CurrSig <= 100) + { + RetSig = 100; + } + else if(CurrSig >= 21 && CurrSig <= 30) + { + RetSig = 90 + ((CurrSig - 20) / 1); + } + else if(CurrSig >= 11 && CurrSig <= 20) + { + RetSig = 80 + ((CurrSig - 10) / 1); + } + else if(CurrSig >= 7 && CurrSig <= 10) + { + RetSig = 69 + (CurrSig - 7); + } + else if(CurrSig == 6) + { + RetSig = 54; + } + else if(CurrSig == 5) + { + RetSig = 45; + } + else if(CurrSig == 4) + { + RetSig = 36; + } + else if(CurrSig == 3) + { + RetSig = 27; + } + else if(CurrSig == 2) + { + RetSig = 18; + } + else if(CurrSig == 1) + { + RetSig = 9; + } + else + { + RetSig = CurrSig; + } + } +#endif //ENDIF (DM_ODM_SUPPORT_TYPE == ODM_MP) + return RetSig; +} + + +s4Byte +odm_SignalScaleMapping_92CSeries( + IN OUT PDM_ODM_T pDM_Odm, + IN s4Byte CurrSig +) +{ + s4Byte RetSig; +#if (DEV_BUS_TYPE == RT_PCI_INTERFACE) + if(pDM_Odm->SupportInterface == ODM_ITRF_PCIE) + { + // Step 1. Scale mapping. + if(CurrSig >= 61 && CurrSig <= 100) + { + RetSig = 90 + ((CurrSig - 60) / 4); + } + else if(CurrSig >= 41 && CurrSig <= 60) + { + RetSig = 78 + ((CurrSig - 40) / 2); + } + else if(CurrSig >= 31 && CurrSig <= 40) + { + RetSig = 66 + (CurrSig - 30); + } + else if(CurrSig >= 21 && CurrSig <= 30) + { + RetSig = 54 + (CurrSig - 20); + } + else if(CurrSig >= 5 && CurrSig <= 20) + { + RetSig = 42 + (((CurrSig - 5) * 2) / 3); + } + else if(CurrSig == 4) + { + RetSig = 36; + } + else if(CurrSig == 3) + { + RetSig = 27; + } + else if(CurrSig == 2) + { + RetSig = 18; + } + else if(CurrSig == 1) + { + RetSig = 9; + } + else + { + RetSig = CurrSig; + } + } +#endif + +#if ((DEV_BUS_TYPE == RT_USB_INTERFACE) ||(DEV_BUS_TYPE == RT_SDIO_INTERFACE)) + if((pDM_Odm->SupportInterface == ODM_ITRF_USB) || (pDM_Odm->SupportInterface == ODM_ITRF_SDIO) ) + { + if(CurrSig >= 51 && CurrSig <= 100) + { + RetSig = 100; + } + else if(CurrSig >= 41 && CurrSig <= 50) + { + RetSig = 80 + ((CurrSig - 40)*2); + } + else if(CurrSig >= 31 && CurrSig <= 40) + { + RetSig = 66 + (CurrSig - 30); + } + else if(CurrSig >= 21 && CurrSig <= 30) + { + RetSig = 54 + (CurrSig - 20); + } + else if(CurrSig >= 10 && CurrSig <= 20) + { + RetSig = 42 + (((CurrSig - 10) * 2) / 3); + } + else if(CurrSig >= 5 && CurrSig <= 9) + { + RetSig = 22 + (((CurrSig - 5) * 3) / 2); + } + else if(CurrSig >= 1 && CurrSig <= 4) + { + RetSig = 6 + (((CurrSig - 1) * 3) / 2); + } + else + { + RetSig = CurrSig; + } + } +#endif + return RetSig; +} +s4Byte +odm_SignalScaleMapping( + IN OUT PDM_ODM_T pDM_Odm, + IN s4Byte CurrSig +) +{ + if( (pDM_Odm->SupportPlatform == ODM_MP) && + (pDM_Odm->SupportInterface != ODM_ITRF_PCIE) && //USB & SDIO + (pDM_Odm->PatchID==10))//pMgntInfo->CustomerID == RT_CID_819x_Netcore + { + return odm_SignalScaleMapping_92CSeries_patch_RT_CID_819x_Netcore(pDM_Odm,CurrSig); + } + else if( (pDM_Odm->SupportPlatform == ODM_MP) && + (pDM_Odm->SupportInterface == ODM_ITRF_PCIE) && + (pDM_Odm->PatchID==19))//pMgntInfo->CustomerID == RT_CID_819x_Lenovo) + { + return odm_SignalScaleMapping_92CSeries_patch_RT_CID_819x_Lenovo(pDM_Odm, CurrSig); + } + else{ + return odm_SignalScaleMapping_92CSeries(pDM_Odm,CurrSig); + } + +} +#endif + +//pMgntInfo->CustomerID == RT_CID_819x_Lenovo +static u1Byte odm_SQ_process_patch_RT_CID_819x_Lenovo( + IN PDM_ODM_T pDM_Odm, + IN u1Byte isCCKrate, + IN u1Byte PWDB_ALL, + IN u1Byte path, + IN u1Byte RSSI +) +{ + u1Byte SQ; +#if (DM_ODM_SUPPORT_TYPE & ODM_MP) + // mapping to 5 bars for vista signal strength + // signal quality in driver will be displayed to signal strength + if(isCCKrate){ + // in vista. + if(PWDB_ALL >= 50) + SQ = 100; + else if(PWDB_ALL >= 35 && PWDB_ALL < 50) + SQ = 80; + else if(PWDB_ALL >= 22 && PWDB_ALL < 35) + SQ = 60; + else if(PWDB_ALL >= 18 && PWDB_ALL < 22) + SQ = 40; + else + SQ = 20; + } + else{//OFDM rate + + // mapping to 5 bars for vista signal strength + // signal quality in driver will be displayed to signal strength + // in vista. + if(RSSI >= 50) + SQ = 100; + else if(RSSI >= 35 && RSSI < 50) + SQ = 80; + else if(RSSI >= 22 && RSSI < 35) + SQ = 60; + else if(RSSI >= 18 && RSSI < 22) + SQ = 40; + else + SQ = 20; + } +#endif + return SQ; +} + +static u1Byte +odm_EVMdbToPercentage( + IN s1Byte Value + ) +{ + // + // -33dB~0dB to 0%~99% + // + s1Byte ret_val; + + ret_val = Value; + //ret_val /= 2; + + //ODM_RTPRINT(FRX, RX_PHY_SQ, ("EVMdbToPercentage92C Value=%d / %x \n", ret_val, ret_val)); + + if(ret_val >= 0) + ret_val = 0; + if(ret_val <= -33) + ret_val = -33; + + ret_val = 0 - ret_val; + ret_val*=3; + + if(ret_val == 99) + ret_val = 100; + + return(ret_val); +} + + + +VOID +odm_RxPhyStatus92CSeries_Parsing( + IN OUT PDM_ODM_T pDM_Odm, + OUT PODM_PHY_INFO_T pPhyInfo, + IN pu1Byte pPhyStatus, + IN PODM_PACKET_INFO_T pPktinfo + ) +{ + SWAT_T *pDM_SWAT_Table = &pDM_Odm->DM_SWAT_Table; + u1Byte i, Max_spatial_stream; + s1Byte rx_pwr[4], rx_pwr_all=0; + u1Byte EVM, PWDB_ALL = 0, PWDB_ALL_BT; + u1Byte RSSI, total_rssi=0; + u1Byte isCCKrate=0; + u1Byte rf_rx_num = 0; + u1Byte cck_highpwr = 0; + u1Byte LNA_idx, VGA_idx; + + PPHY_STATUS_RPT_8192CD_T pPhyStaRpt = (PPHY_STATUS_RPT_8192CD_T)pPhyStatus; + + isCCKrate = ((pPktinfo->Rate >= DESC92C_RATE1M ) && (pPktinfo->Rate <= DESC92C_RATE11M ))?TRUE :FALSE; + + pPhyInfo->RxMIMOSignalQuality[ODM_RF_PATH_A] = -1; + pPhyInfo->RxMIMOSignalQuality[ODM_RF_PATH_B] = -1; + + + if(isCCKrate) + { + u1Byte report; + u1Byte cck_agc_rpt; + + pDM_Odm->PhyDbgInfo.NumQryPhyStatusCCK++; + // + // (1)Hardware does not provide RSSI for CCK + // (2)PWDB, Average PWDB cacluated by hardware (for rate adaptive) + // + + //if(pHalData->eRFPowerState == eRfOn) + cck_highpwr = pDM_Odm->bCckHighPower; + //else + // cck_highpwr = FALSE; + + cck_agc_rpt = pPhyStaRpt->cck_agc_rpt_ofdm_cfosho_a ; + + //2011.11.28 LukeLee: 88E use different LNA & VGA gain table + //The RSSI formula should be modified according to the gain table + //In 88E, cck_highpwr is always set to 1 + if(pDM_Odm->SupportICType & (ODM_RTL8188E|ODM_RTL8812)) + { + LNA_idx = ((cck_agc_rpt & 0xE0) >>5); + VGA_idx = (cck_agc_rpt & 0x1F); + switch(LNA_idx) + { + case 7: + if(VGA_idx <= 27) + rx_pwr_all = -100 + 2*(27-VGA_idx); //VGA_idx = 27~2 + else + rx_pwr_all = -100; + break; + case 6: + rx_pwr_all = -48 + 2*(2-VGA_idx); //VGA_idx = 2~0 + break; + case 5: + rx_pwr_all = -42 + 2*(7-VGA_idx); //VGA_idx = 7~5 + break; + case 4: + rx_pwr_all = -36 + 2*(7-VGA_idx); //VGA_idx = 7~4 + break; + case 3: + //rx_pwr_all = -28 + 2*(7-VGA_idx); //VGA_idx = 7~0 + rx_pwr_all = -24 + 2*(7-VGA_idx); //VGA_idx = 7~0 + break; + case 2: + if(cck_highpwr) + rx_pwr_all = -12 + 2*(5-VGA_idx); //VGA_idx = 5~0 + else + rx_pwr_all = -6+ 2*(5-VGA_idx); + break; + case 1: + rx_pwr_all = 8-2*VGA_idx; + break; + case 0: + rx_pwr_all = 14-2*VGA_idx; + break; + default: + //DbgPrint("CCK Exception default\n"); + break; + } + rx_pwr_all += 6; + PWDB_ALL = odm_QueryRxPwrPercentage(rx_pwr_all); + if(cck_highpwr == FALSE) + { + if(PWDB_ALL >= 80) + PWDB_ALL = ((PWDB_ALL-80)<<1)+((PWDB_ALL-80)>>1)+80; + else if((PWDB_ALL <= 78) && (PWDB_ALL >= 20)) + PWDB_ALL += 3; + if(PWDB_ALL>100) + PWDB_ALL = 100; + } + } + else + { + if(!cck_highpwr) + { + report =( cck_agc_rpt & 0xc0 )>>6; + switch(report) + { + // 03312009 modified by cosa + // Modify the RF RNA gain value to -40, -20, -2, 14 by Jenyu's suggestion + // Note: different RF with the different RNA gain. + case 0x3: + rx_pwr_all = -46 - (cck_agc_rpt & 0x3e); + break; + case 0x2: + rx_pwr_all = -26 - (cck_agc_rpt & 0x3e); + break; + case 0x1: + rx_pwr_all = -12 - (cck_agc_rpt & 0x3e); + break; + case 0x0: + rx_pwr_all = 16 - (cck_agc_rpt & 0x3e); + break; + } + } + else + { + //report = pDrvInfo->cfosho[0] & 0x60; + //report = pPhyStaRpt->cck_agc_rpt_ofdm_cfosho_a& 0x60; + + report = (cck_agc_rpt & 0x60)>>5; + switch(report) + { + case 0x3: + rx_pwr_all = -46 - ((cck_agc_rpt & 0x1f)<<1) ; + break; + case 0x2: + rx_pwr_all = -26 - ((cck_agc_rpt & 0x1f)<<1); + break; + case 0x1: + rx_pwr_all = -12 - ((cck_agc_rpt & 0x1f)<<1) ; + break; + case 0x0: + rx_pwr_all = 16 - ((cck_agc_rpt & 0x1f)<<1) ; + break; + } + } + + PWDB_ALL = odm_QueryRxPwrPercentage(rx_pwr_all); + + //Modification for ext-LNA board + if(pDM_Odm->BoardType & (ODM_BOARD_EXT_LNA | ODM_BOARD_EXT_PA)) + { + if((cck_agc_rpt>>7) == 0){ + PWDB_ALL = (PWDB_ALL>94)?100:(PWDB_ALL +6); + } + else + { + if(PWDB_ALL > 38) + PWDB_ALL -= 16; + else + PWDB_ALL = (PWDB_ALL<=16)?(PWDB_ALL>>2):(PWDB_ALL -12); + } + + //CCK modification + if(PWDB_ALL > 25 && PWDB_ALL <= 60) + PWDB_ALL += 6; + //else if (PWDB_ALL <= 25) + // PWDB_ALL += 8; + } + else//Modification for int-LNA board + { + if(PWDB_ALL > 99) + PWDB_ALL -= 8; + else if(PWDB_ALL > 50 && PWDB_ALL <= 68) + PWDB_ALL += 4; + } + } + + pPhyInfo->RxPWDBAll = PWDB_ALL; +#if (DM_ODM_SUPPORT_TYPE & (ODM_MP|ODM_CE)) + pPhyInfo->BTRxRSSIPercentage = PWDB_ALL; + pPhyInfo->RecvSignalPower = rx_pwr_all; +#endif + // + // (3) Get Signal Quality (EVM) + // + if(pPktinfo->bPacketMatchBSSID) + { + u1Byte SQ,SQ_rpt; + + if((pDM_Odm->SupportPlatform == ODM_MP) &&(pDM_Odm->PatchID==19)){//pMgntInfo->CustomerID == RT_CID_819x_Lenovo + SQ = odm_SQ_process_patch_RT_CID_819x_Lenovo(pDM_Odm,isCCKrate,PWDB_ALL,0,0); + } + else if(pPhyInfo->RxPWDBAll > 40 && !pDM_Odm->bInHctTest){ + SQ = 100; + } + else{ + SQ_rpt = pPhyStaRpt->cck_sig_qual_ofdm_pwdb_all; + + if(SQ_rpt > 64) + SQ = 0; + else if (SQ_rpt < 20) + SQ = 100; + else + SQ = ((64-SQ_rpt) * 100) / 44; + + } + + //DbgPrint("cck SQ = %d\n", SQ); + pPhyInfo->SignalQuality = SQ; + pPhyInfo->RxMIMOSignalQuality[ODM_RF_PATH_A] = SQ; + pPhyInfo->RxMIMOSignalQuality[ODM_RF_PATH_B] = -1; + } + } + else //is OFDM rate + { + pDM_Odm->PhyDbgInfo.NumQryPhyStatusOFDM++; + + // + // (1)Get RSSI for HT rate + // + + for(i = ODM_RF_PATH_A; i < ODM_RF_PATH_MAX; i++) + { + // 2008/01/30 MH we will judge RF RX path now. + if (pDM_Odm->RFPathRxEnable & BIT(i)) + rf_rx_num++; + //else + //continue; + + rx_pwr[i] = ((pPhyStaRpt->path_agc[i].gain& 0x3F)*2) - 110; + + #if (DM_ODM_SUPPORT_TYPE & (ODM_MP|ODM_CE)) + pPhyInfo->RxPwr[i] = rx_pwr[i]; + #endif + + /* Translate DBM to percentage. */ + RSSI = odm_QueryRxPwrPercentage(rx_pwr[i]); + total_rssi += RSSI; + //RTPRINT(FRX, RX_PHY_SS, ("RF-%d RXPWR=%x RSSI=%d\n", i, rx_pwr[i], RSSI)); + + //Modification for ext-LNA board + if(pDM_Odm->BoardType & (ODM_BOARD_EXT_LNA | ODM_BOARD_EXT_PA)) + { + if((pPhyStaRpt->path_agc[i].trsw) == 1) + RSSI = (RSSI>94)?100:(RSSI +6); + else + RSSI = (RSSI<=16)?(RSSI>>3):(RSSI -16); + + if((RSSI <= 34) && (RSSI >=4)) + RSSI -= 4; + } + + pPhyInfo->RxMIMOSignalStrength[i] =(u1Byte) RSSI; + + #if (DM_ODM_SUPPORT_TYPE & (/*ODM_MP|*/ODM_CE|ODM_AP|ODM_ADSL)) + //Get Rx snr value in DB + pPhyInfo->RxSNR[i] = pDM_Odm->PhyDbgInfo.RxSNRdB[i] = (s4Byte)(pPhyStaRpt->path_rxsnr[i]/2); + #endif + + /* Record Signal Strength for next packet */ + if(pPktinfo->bPacketMatchBSSID) + { + if((pDM_Odm->SupportPlatform == ODM_MP) &&(pDM_Odm->PatchID==19)) + { + if(i==ODM_RF_PATH_A) + pPhyInfo->SignalQuality = odm_SQ_process_patch_RT_CID_819x_Lenovo(pDM_Odm,isCCKrate,PWDB_ALL,i,RSSI); + + } + + } + } + + + // + // (2)PWDB, Average PWDB cacluated by hardware (for rate adaptive) + // + rx_pwr_all = (((pPhyStaRpt->cck_sig_qual_ofdm_pwdb_all) >> 1 )& 0x7f) -110; + //RTPRINT(FRX, RX_PHY_SS, ("PWDB_ALL=%d\n", PWDB_ALL)); + + PWDB_ALL_BT = PWDB_ALL = odm_QueryRxPwrPercentage(rx_pwr_all); + //RTPRINT(FRX, RX_PHY_SS, ("PWDB_ALL=%d\n",PWDB_ALL)); + + pPhyInfo->RxPWDBAll = PWDB_ALL; + //ODM_RT_TRACE(pDM_Odm,ODM_COMP_RSSI_MONITOR, ODM_DBG_LOUD, ("ODM OFDM RSSI=%d\n",pPhyInfo->RxPWDBAll)); + #if (DM_ODM_SUPPORT_TYPE & (ODM_MP|ODM_CE)) + pPhyInfo->BTRxRSSIPercentage = PWDB_ALL_BT; + pPhyInfo->RxPower = rx_pwr_all; + pPhyInfo->RecvSignalPower = rx_pwr_all; + #endif + + if((pDM_Odm->SupportPlatform == ODM_MP) &&(pDM_Odm->PatchID==19)){ + //do nothing + } + else{//pMgntInfo->CustomerID != RT_CID_819x_Lenovo + // + // (3)EVM of HT rate + // + if(pPktinfo->Rate >=DESC92C_RATEMCS8 && pPktinfo->Rate <=DESC92C_RATEMCS15) + Max_spatial_stream = 2; //both spatial stream make sense + else + Max_spatial_stream = 1; //only spatial stream 1 makes sense + + for(i=0; i>= 1" because the compilor of free build environment + // fill most significant bit to "zero" when doing shifting operation which may change a negative + // value to positive one, then the dbm value (which is supposed to be negative) is not correct anymore. + EVM = odm_EVMdbToPercentage( (pPhyStaRpt->stream_rxevm[i] )); //dbm + + //RTPRINT(FRX, RX_PHY_SQ, ("RXRATE=%x RXEVM=%x EVM=%s%d\n", + //GET_RX_STATUS_DESC_RX_MCS(pDesc), pDrvInfo->rxevm[i], "%", EVM)); + + if(pPktinfo->bPacketMatchBSSID) + { + if(i==ODM_RF_PATH_A) // Fill value in RFD, Get the first spatial stream only + { + pPhyInfo->SignalQuality = (u1Byte)(EVM & 0xff); + } + pPhyInfo->RxMIMOSignalQuality[i] = (u1Byte)(EVM & 0xff); + } + } + } + + } +#if (DM_ODM_SUPPORT_TYPE & (ODM_MP|ODM_CE)) + //UI BSS List signal strength(in percentage), make it good looking, from 0~100. + //It is assigned to the BSS List in GetValueFromBeaconOrProbeRsp(). + if(isCCKrate) + { +#if (DM_ODM_SUPPORT_TYPE == ODM_MP) + // 2012/01/12 MH Use customeris signal strength from HalComRxdDesc.c/ + pPhyInfo->SignalStrength = (u1Byte)(SignalScaleMapping(pDM_Odm->Adapter, PWDB_ALL));//PWDB_ALL; +#else + pPhyInfo->SignalStrength = (u1Byte)(odm_SignalScaleMapping(pDM_Odm, PWDB_ALL));//PWDB_ALL; +#endif + } + else + { + if (rf_rx_num != 0) + { +#if (DM_ODM_SUPPORT_TYPE == ODM_MP) + // 2012/01/12 MH Use customeris signal strength from HalComRxdDesc.c/ + pPhyInfo->SignalStrength = (u1Byte)(SignalScaleMapping(pDM_Odm->Adapter, total_rssi/=rf_rx_num));//PWDB_ALL; +#else + pPhyInfo->SignalStrength = (u1Byte)(odm_SignalScaleMapping(pDM_Odm, total_rssi/=rf_rx_num)); +#endif + } + } +#endif + + //For 92C/92D HW (Hybrid) Antenna Diversity +#if(defined(CONFIG_HW_ANTENNA_DIVERSITY)) + pDM_SWAT_Table->antsel = pPhyStaRpt->ant_sel; + //For 88E HW Antenna Diversity + pDM_Odm->DM_FatTable.antsel_rx_keep_0 = pPhyStaRpt->ant_sel; + pDM_Odm->DM_FatTable.antsel_rx_keep_1 = pPhyStaRpt->ant_sel_b; + pDM_Odm->DM_FatTable.antsel_rx_keep_2 = pPhyStaRpt->antsel_rx_keep_2; +#endif +} + +VOID +odm_Init_RSSIForDM( + IN OUT PDM_ODM_T pDM_Odm + ) +{ + +} + +VOID +odm_Process_RSSIForDM( + IN OUT PDM_ODM_T pDM_Odm, + IN PODM_PHY_INFO_T pPhyInfo, + IN PODM_PACKET_INFO_T pPktinfo + ) +{ + + s4Byte UndecoratedSmoothedPWDB, UndecoratedSmoothedCCK, UndecoratedSmoothedOFDM, RSSI_Ave; + u1Byte isCCKrate=0; + u1Byte RSSI_max, RSSI_min, i; + u4Byte OFDM_pkt=0; + u4Byte Weighting=0; + + PSTA_INFO_T pEntry; + + if(pPktinfo->StationID == 0xFF) + return; + + // 2011/11/17 MH Need to debug + //if (pDM_Odm->SupportPlatform == ODM_MP) + { + + } + + pEntry = pDM_Odm->pODM_StaInfo[pPktinfo->StationID]; + if(!IS_STA_VALID(pEntry) ){ + return; + } + if((!pPktinfo->bPacketMatchBSSID) ) + { + return; + } + + isCCKrate = ((pPktinfo->Rate >= DESC92C_RATE1M ) && (pPktinfo->Rate <= DESC92C_RATE11M ))?TRUE :FALSE; + if(pPktinfo->bPacketBeacon) + pDM_Odm->PhyDbgInfo.NumQryBeaconPkt++; + + pDM_Odm->RxRate = pPktinfo->Rate; +#if(defined(CONFIG_HW_ANTENNA_DIVERSITY)) +#if ((RTL8192C_SUPPORT == 1) ||(RTL8192D_SUPPORT == 1)) + if(pDM_Odm->SupportICType & ODM_RTL8192C|ODM_RTL8192D) + { + if(pPktinfo->bPacketToSelf || pPktinfo->bPacketBeacon) + { + //if(pPktinfo->bPacketBeacon) + //{ + // DbgPrint("This is beacon, isCCKrate=%d\n", isCCKrate); + //} + ODM_AntselStatistics_88C(pDM_Odm, pPktinfo->StationID, pPhyInfo->RxPWDBAll, isCCKrate); + } + } +#endif + //-----------------Smart Antenna Debug Message------------------// +#if (RTL8188E_SUPPORT == 1) + if(pDM_Odm->SupportICType == ODM_RTL8188E) + { + u1Byte antsel_tr_mux; + pFAT_T pDM_FatTable = &pDM_Odm->DM_FatTable; + + if(pDM_Odm->AntDivType == CG_TRX_SMART_ANTDIV) + { + if(pDM_FatTable->FAT_State == FAT_TRAINING_STATE) + { + if(pPktinfo->bPacketToSelf) //(pPktinfo->bPacketMatchBSSID && (!pPktinfo->bPacketBeacon)) + { + antsel_tr_mux = (pDM_FatTable->antsel_rx_keep_2<<2) |(pDM_FatTable->antsel_rx_keep_1 <<1) |pDM_FatTable->antsel_rx_keep_0; + pDM_FatTable->antSumRSSI[antsel_tr_mux] += pPhyInfo->RxPWDBAll; + pDM_FatTable->antRSSIcnt[antsel_tr_mux]++; + //ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD,("isCCKrate=%d, PWDB_ALL=%d\n",isCCKrate, pPhyInfo->RxPWDBAll)); + //ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD,("antsel_tr_mux=3'b%d%d%d\n", + //pDM_FatTable->antsel_rx_keep_2, pDM_FatTable->antsel_rx_keep_1, pDM_FatTable->antsel_rx_keep_0)); + + } + } + } + else if((pDM_Odm->AntDivType == CG_TRX_HW_ANTDIV)||(pDM_Odm->AntDivType == CGCS_RX_HW_ANTDIV)) + { + if(pPktinfo->bPacketToSelf || pPktinfo->bPacketBeacon) + { + antsel_tr_mux = (pDM_FatTable->antsel_rx_keep_2<<2) |(pDM_FatTable->antsel_rx_keep_1 <<1) |pDM_FatTable->antsel_rx_keep_0; + //ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD,("antsel_tr_mux=3'b%d%d%d\n", + // pDM_FatTable->antsel_rx_keep_2, pDM_FatTable->antsel_rx_keep_1, pDM_FatTable->antsel_rx_keep_0)); + + ODM_AntselStatistics_88E(pDM_Odm, antsel_tr_mux, pPktinfo->StationID, pPhyInfo->RxPWDBAll); + } + } + + } +#endif +#endif //#if(defined(CONFIG_HW_ANTENNA_DIVERSITY)) + //-----------------Smart Antenna Debug Message------------------// + + UndecoratedSmoothedCCK = pEntry->rssi_stat.UndecoratedSmoothedCCK; + UndecoratedSmoothedOFDM = pEntry->rssi_stat.UndecoratedSmoothedOFDM; + UndecoratedSmoothedPWDB = pEntry->rssi_stat.UndecoratedSmoothedPWDB; + + if(pPktinfo->bPacketToSelf || pPktinfo->bPacketBeacon) + { + + if(!isCCKrate)//ofdm rate + { + if(pPhyInfo->RxMIMOSignalStrength[ODM_RF_PATH_B] == 0){ + RSSI_Ave = pPhyInfo->RxMIMOSignalStrength[ODM_RF_PATH_A]; + pDM_Odm->RSSI_A = pPhyInfo->RxMIMOSignalStrength[ODM_RF_PATH_A]; + pDM_Odm->RSSI_B = 0; + } + else + { + //DbgPrint("pRfd->Status.RxMIMOSignalStrength[0] = %d, pRfd->Status.RxMIMOSignalStrength[1] = %d \n", + //pRfd->Status.RxMIMOSignalStrength[0], pRfd->Status.RxMIMOSignalStrength[1]); + pDM_Odm->RSSI_A = pPhyInfo->RxMIMOSignalStrength[ODM_RF_PATH_A]; + pDM_Odm->RSSI_B = pPhyInfo->RxMIMOSignalStrength[ODM_RF_PATH_B]; + + if(pPhyInfo->RxMIMOSignalStrength[ODM_RF_PATH_A] > pPhyInfo->RxMIMOSignalStrength[ODM_RF_PATH_B]) + { + RSSI_max = pPhyInfo->RxMIMOSignalStrength[ODM_RF_PATH_A]; + RSSI_min = pPhyInfo->RxMIMOSignalStrength[ODM_RF_PATH_B]; + } + else + { + RSSI_max = pPhyInfo->RxMIMOSignalStrength[ODM_RF_PATH_B]; + RSSI_min = pPhyInfo->RxMIMOSignalStrength[ODM_RF_PATH_A]; + } + if((RSSI_max -RSSI_min) < 3) + RSSI_Ave = RSSI_max; + else if((RSSI_max -RSSI_min) < 6) + RSSI_Ave = RSSI_max - 1; + else if((RSSI_max -RSSI_min) < 10) + RSSI_Ave = RSSI_max - 2; + else + RSSI_Ave = RSSI_max - 3; + } + + //1 Process OFDM RSSI + if(UndecoratedSmoothedOFDM <= 0) // initialize + { + UndecoratedSmoothedOFDM = pPhyInfo->RxPWDBAll; + } + else + { + if(pPhyInfo->RxPWDBAll > (u4Byte)UndecoratedSmoothedOFDM) + { + UndecoratedSmoothedOFDM = + ( ((UndecoratedSmoothedOFDM)*(Rx_Smooth_Factor-1)) + + (RSSI_Ave)) /(Rx_Smooth_Factor); + UndecoratedSmoothedOFDM = UndecoratedSmoothedOFDM + 1; + } + else + { + UndecoratedSmoothedOFDM = + ( ((UndecoratedSmoothedOFDM)*(Rx_Smooth_Factor-1)) + + (RSSI_Ave)) /(Rx_Smooth_Factor); + } + } + + pEntry->rssi_stat.PacketMap = (pEntry->rssi_stat.PacketMap<<1) | BIT0; + + } + else + { + RSSI_Ave = pPhyInfo->RxPWDBAll; + pDM_Odm->RSSI_A = (u1Byte) pPhyInfo->RxPWDBAll; + pDM_Odm->RSSI_B = 0xFF; + + //1 Process CCK RSSI + if(UndecoratedSmoothedCCK <= 0) // initialize + { + UndecoratedSmoothedCCK = pPhyInfo->RxPWDBAll; + } + else + { + if(pPhyInfo->RxPWDBAll > (u4Byte)UndecoratedSmoothedCCK) + { + UndecoratedSmoothedCCK = + ( ((UndecoratedSmoothedCCK)*(Rx_Smooth_Factor-1)) + + (pPhyInfo->RxPWDBAll)) /(Rx_Smooth_Factor); + UndecoratedSmoothedCCK = UndecoratedSmoothedCCK + 1; + } + else + { + UndecoratedSmoothedCCK = + ( ((UndecoratedSmoothedCCK)*(Rx_Smooth_Factor-1)) + + (pPhyInfo->RxPWDBAll)) /(Rx_Smooth_Factor); + } + } + pEntry->rssi_stat.PacketMap = pEntry->rssi_stat.PacketMap<<1; + } + + //if(pEntry) + { + //2011.07.28 LukeLee: modified to prevent unstable CCK RSSI + if(pEntry->rssi_stat.ValidBit >= 64) + pEntry->rssi_stat.ValidBit = 64; + else + pEntry->rssi_stat.ValidBit++; + + for(i=0; irssi_stat.ValidBit; i++) + OFDM_pkt += (u1Byte)(pEntry->rssi_stat.PacketMap>>i)&BIT0; + + if(pEntry->rssi_stat.ValidBit == 64) + { + Weighting = ((OFDM_pkt<<4) > 64)?64:(OFDM_pkt<<4); + UndecoratedSmoothedPWDB = (Weighting*UndecoratedSmoothedOFDM+(64-Weighting)*UndecoratedSmoothedCCK)>>6; + } + else + { + if(pEntry->rssi_stat.ValidBit != 0) + UndecoratedSmoothedPWDB = (OFDM_pkt*UndecoratedSmoothedOFDM+(pEntry->rssi_stat.ValidBit-OFDM_pkt)*UndecoratedSmoothedCCK)/pEntry->rssi_stat.ValidBit; + else + UndecoratedSmoothedPWDB = 0; + } + + pEntry->rssi_stat.UndecoratedSmoothedCCK = UndecoratedSmoothedCCK; + pEntry->rssi_stat.UndecoratedSmoothedOFDM = UndecoratedSmoothedOFDM; + pEntry->rssi_stat.UndecoratedSmoothedPWDB = UndecoratedSmoothedPWDB; + + //DbgPrint("OFDM_pkt=%d, Weighting=%d\n", OFDM_pkt, Weighting); + //DbgPrint("UndecoratedSmoothedOFDM=%d, UndecoratedSmoothedPWDB=%d, UndecoratedSmoothedCCK=%d\n", + // UndecoratedSmoothedOFDM, UndecoratedSmoothedPWDB, UndecoratedSmoothedCCK); + + } + + } +} + +// +// Endianness before calling this API +// +VOID +ODM_PhyStatusQuery_92CSeries( + IN OUT PDM_ODM_T pDM_Odm, + OUT PODM_PHY_INFO_T pPhyInfo, + IN pu1Byte pPhyStatus, + IN PODM_PACKET_INFO_T pPktinfo + ) +{ + + odm_RxPhyStatus92CSeries_Parsing( + pDM_Odm, + pPhyInfo, + pPhyStatus, + pPktinfo); + + if( pDM_Odm->RSSI_test == TRUE) + { + // Select the packets to do RSSI checking for antenna switching. + if(pPktinfo->bPacketToSelf || pPktinfo->bPacketBeacon ) + { + /* + #if 0//(DM_ODM_SUPPORT_TYPE == ODM_MP) + dm_SWAW_RSSI_Check( + Adapter, + (tmppAdapter!=NULL)?(tmppAdapter==Adapter):TRUE, + bPacketMatchBSSID, + pEntry, + pRfd); + #elif (DM_ODM_SUPPORT_TYPE == ODM_CE) + // Select the packets to do RSSI checking for antenna switching. + //odm_SwAntDivRSSICheck8192C(padapter, precvframe->u.hdr.attrib.RxPWDBAll); + #endif + */ + ODM_SwAntDivChkPerPktRssi(pDM_Odm,pPktinfo->StationID,pPhyInfo); + } + } + else + { + odm_Process_RSSIForDM(pDM_Odm,pPhyInfo,pPktinfo); + } + +} + + + +// +// Endianness before calling this API +// +VOID +ODM_PhyStatusQuery_JaguarSeries( + IN OUT PDM_ODM_T pDM_Odm, + OUT PODM_PHY_INFO_T pPhyInfo, + IN pu1Byte pPhyStatus, + IN PODM_PACKET_INFO_T pPktinfo + ) +{ + + +} + +VOID +ODM_PhyStatusQuery( + IN OUT PDM_ODM_T pDM_Odm, + OUT PODM_PHY_INFO_T pPhyInfo, + IN pu1Byte pPhyStatus, + IN PODM_PACKET_INFO_T pPktinfo + ) +{ +#if 0 // How to jaguar jugar series?? + if(pDM_Odm->SupportICType >= ODM_RTL8195 ) + { + ODM_PhyStatusQuery_JaguarSeries(pDM_Odm,pPhyInfo,pPhyStatus,pPktinfo); + } + else +#endif + { + ODM_PhyStatusQuery_92CSeries(pDM_Odm,pPhyInfo,pPhyStatus,pPktinfo); + } +} + +// For future use. +VOID +ODM_MacStatusQuery( + IN OUT PDM_ODM_T pDM_Odm, + IN pu1Byte pMacStatus, + IN u1Byte MacID, + IN BOOLEAN bPacketMatchBSSID, + IN BOOLEAN bPacketToSelf, + IN BOOLEAN bPacketBeacon + ) +{ + // 2011/10/19 Driver team will handle in the future. + +} + +#if (DM_ODM_SUPPORT_TYPE & (ODM_MP|ODM_CE|ODM_AP)) + +HAL_STATUS +ODM_ConfigRFWithHeaderFile( + IN PDM_ODM_T pDM_Odm, + IN ODM_RF_RADIO_PATH_E Content, + IN ODM_RF_RADIO_PATH_E eRFPath + ) +{ + //RT_STATUS rtStatus = RT_STATUS_SUCCESS; + + + ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_LOUD, ("===>ODM_ConfigRFWithHeaderFile\n")); +#if (RTL8723A_SUPPORT == 1) + if (pDM_Odm->SupportICType == ODM_RTL8723A) + { + if(eRFPath == ODM_RF_PATH_A) + READ_AND_CONFIG_MP(8723A,_RadioA_1T_); + + ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_LOUD, (" ===> ODM_ConfigRFWithHeaderFile() Radio_A:Rtl8723RadioA_1TArray\n")); + ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_LOUD, (" ===> ODM_ConfigRFWithHeaderFile() Radio_B:Rtl8723RadioB_1TArray\n")); + } + + ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_TRACE, ("ODM_ConfigRFWithHeaderFile: Radio No %x\n", eRFPath)); + //rtStatus = RT_STATUS_SUCCESS; +#endif +#if (RTL8188E_SUPPORT == 1) + if (pDM_Odm->SupportICType == ODM_RTL8188E) + { + if(IS_VENDOR_8188E_I_CUT_SERIES(pDM_Odm->Adapter)) + READ_AND_CONFIG(8188E,_RadioA_1T_ICUT_); + else + READ_AND_CONFIG(8188E,_RadioA_1T_); + + + ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_LOUD, (" ===> ODM_ConfigRFWithHeaderFile() Radio_A:Rtl8188ERadioA_1TArray\n")); + ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_LOUD, (" ===> ODM_ConfigRFWithHeaderFile() Radio_B:Rtl8188ERadioB_1TArray\n")); + } + + ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_TRACE, ("ODM_ConfigRFWithHeaderFile: Radio No %x\n", eRFPath)); + //rtStatus = RT_STATUS_SUCCESS; +#endif + return HAL_STATUS_SUCCESS; +} + + +HAL_STATUS +ODM_ConfigBBWithHeaderFile( + IN PDM_ODM_T pDM_Odm, + IN ODM_BB_Config_Type ConfigType + ) +{ +#if (RTL8723A_SUPPORT == 1) + if(pDM_Odm->SupportICType == ODM_RTL8723A) + { + + if(ConfigType == CONFIG_BB_PHY_REG) + { + READ_AND_CONFIG_MP(8723A,_PHY_REG_1T_); + } + else if(ConfigType == CONFIG_BB_AGC_TAB) + { + READ_AND_CONFIG_MP(8723A,_AGC_TAB_1T_); + } + ODM_RT_TRACE(pDM_Odm,ODM_COMP_INIT, ODM_DBG_LOUD, (" ===> phy_ConfigBBWithHeaderFile() phy:Rtl8723AGCTAB_1TArray\n")); + ODM_RT_TRACE(pDM_Odm,ODM_COMP_INIT, ODM_DBG_LOUD, (" ===> phy_ConfigBBWithHeaderFile() agc:Rtl8723PHY_REG_1TArray\n")); + } +#endif + +#if (RTL8188E_SUPPORT == 1) + if(pDM_Odm->SupportICType == ODM_RTL8188E) + { + + if(ConfigType == CONFIG_BB_PHY_REG) + { + if(IS_VENDOR_8188E_I_CUT_SERIES(pDM_Odm->Adapter)) + READ_AND_CONFIG(8188E,_PHY_REG_1T_ICUT_); + else + READ_AND_CONFIG(8188E,_PHY_REG_1T_); + } + else if(ConfigType == CONFIG_BB_AGC_TAB) + { + if(IS_VENDOR_8188E_I_CUT_SERIES(pDM_Odm->Adapter)) + READ_AND_CONFIG(8188E,_AGC_TAB_1T_ICUT_); + else + READ_AND_CONFIG(8188E,_AGC_TAB_1T_); + } + else if(ConfigType == CONFIG_BB_PHY_REG_PG) + { + READ_AND_CONFIG(8188E,_PHY_REG_PG_); + ODM_RT_TRACE(pDM_Odm,ODM_COMP_INIT, ODM_DBG_LOUD, (" ===> phy_ConfigBBWithHeaderFile() agc:Rtl8188EPHY_REG_PGArray\n")); + } + } +#endif + + return HAL_STATUS_SUCCESS; +} + +HAL_STATUS +ODM_ConfigMACWithHeaderFile( + IN PDM_ODM_T pDM_Odm + ) +{ + u1Byte result = HAL_STATUS_SUCCESS; +#if (RTL8723A_SUPPORT == 1) + if (pDM_Odm->SupportICType == ODM_RTL8723A) + { + READ_AND_CONFIG_MP(8723A,_MAC_REG_); + } +#endif +#if (RTL8188E_SUPPORT == 1) + if (pDM_Odm->SupportICType == ODM_RTL8188E) + { + if(IS_VENDOR_8188E_I_CUT_SERIES(pDM_Odm->Adapter)) + READ_AND_CONFIG(8188E,_MAC_REG_ICUT_); + else + result =READ_AND_CONFIG(8188E,_MAC_REG_); + } +#endif + + return result; +} + + +#endif // end of (#if DM_ODM_SUPPORT_TYPE) diff --git a/hal/odm_RTL8188E.c b/hal/odm_RTL8188E.c index 65041c4..13e54bb 100755 --- a/hal/odm_RTL8188E.c +++ b/hal/odm_RTL8188E.c @@ -1,1290 +1,1289 @@ -/****************************************************************************** - * - * 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 - * - * - ******************************************************************************/ - -//============================================================ -// include files -//============================================================ - -#include "odm_precomp.h" - -#if (RTL8188E_SUPPORT == 1) - -VOID -ODM_DIG_LowerBound_88E( - IN PDM_ODM_T pDM_Odm -) -{ - pDIG_T pDM_DigTable = &pDM_Odm->DM_DigTable; - - if(pDM_Odm->AntDivType == CG_TRX_HW_ANTDIV) - { - pDM_DigTable->rx_gain_range_min = (u1Byte) pDM_DigTable->AntDiv_RSSI_max; - ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("ODM_DIG_LowerBound_88E(): pDM_DigTable->AntDiv_RSSI_max=%d \n",pDM_DigTable->AntDiv_RSSI_max)); - } - //If only one Entry connected - - - -} - -#if(defined(CONFIG_HW_ANTENNA_DIVERSITY)) -VOID -odm_RX_HWAntDivInit( - IN PDM_ODM_T pDM_Odm -) -{ - u4Byte value32; - struct adapter * Adapter = pDM_Odm->Adapter; - #if (MP_DRIVER == 1) - if (*(pDM_Odm->mp_mode) == 1) - { - pDM_Odm->AntDivType = CGCS_RX_SW_ANTDIV; - ODM_SetBBReg(pDM_Odm, ODM_REG_IGI_A_11N , BIT7, 0); // disable HW AntDiv - ODM_SetBBReg(pDM_Odm, ODM_REG_LNA_SWITCH_11N , BIT31, 1); // 1:CG, 0:CS - return; - } - #endif - ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("odm_RX_HWAntDivInit() \n")); - - //MAC Setting - value32 = ODM_GetMACReg(pDM_Odm, ODM_REG_ANTSEL_PIN_11N, bMaskDWord); - ODM_SetMACReg(pDM_Odm, ODM_REG_ANTSEL_PIN_11N, bMaskDWord, value32|(BIT23|BIT25)); //Reg4C[25]=1, Reg4C[23]=1 for pin output - //Pin Settings - ODM_SetBBReg(pDM_Odm, ODM_REG_PIN_CTRL_11N , BIT9|BIT8, 0);//Reg870[8]=1'b0, Reg870[9]=1'b0 //antsel antselb by HW - ODM_SetBBReg(pDM_Odm, ODM_REG_RX_ANT_CTRL_11N , BIT10, 0); //Reg864[10]=1'b0 //antsel2 by HW - ODM_SetBBReg(pDM_Odm, ODM_REG_LNA_SWITCH_11N , BIT22, 1); //Regb2c[22]=1'b0 //disable CS/CG switch - ODM_SetBBReg(pDM_Odm, ODM_REG_LNA_SWITCH_11N , BIT31, 1); //Regb2c[31]=1'b1 //output at CG only - //OFDM Settings - ODM_SetBBReg(pDM_Odm, ODM_REG_ANTDIV_PARA1_11N , bMaskDWord, 0x000000a0); - //CCK Settings - ODM_SetBBReg(pDM_Odm, ODM_REG_BB_PWR_SAV4_11N , BIT7, 1); //Fix CCK PHY status report issue - ODM_SetBBReg(pDM_Odm, ODM_REG_CCK_ANTDIV_PARA2_11N , BIT4, 1); //CCK complete HW AntDiv within 64 samples - ODM_UpdateRxIdleAnt_88E(pDM_Odm, MAIN_ANT); - ODM_SetBBReg(pDM_Odm, ODM_REG_ANT_MAPPING1_11N , 0xFFFF, 0x0201); //antenna mapping table - - //ODM_SetBBReg(pDM_Odm, 0xc50 , BIT7, 1); //Enable HW AntDiv - //ODM_SetBBReg(pDM_Odm, 0xa00 , BIT15, 1); //Enable CCK AntDiv -} - -VOID -odm_TRX_HWAntDivInit( - IN PDM_ODM_T pDM_Odm -) -{ - u4Byte value32; - struct adapter * Adapter = pDM_Odm->Adapter; - - #if (MP_DRIVER == 1) - if (*(pDM_Odm->mp_mode) == 1) - { - pDM_Odm->AntDivType = CGCS_RX_SW_ANTDIV; - ODM_SetBBReg(pDM_Odm, ODM_REG_IGI_A_11N , BIT7, 0); // disable HW AntDiv - ODM_SetBBReg(pDM_Odm, ODM_REG_RX_ANT_CTRL_11N , BIT5|BIT4|BIT3, 0); //Default RX (0/1) - return; - } - - #endif - - ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("odm_TRX_HWAntDivInit() \n")); - - //MAC Setting - value32 = ODM_GetMACReg(pDM_Odm, ODM_REG_ANTSEL_PIN_11N, bMaskDWord); - ODM_SetMACReg(pDM_Odm, ODM_REG_ANTSEL_PIN_11N, bMaskDWord, value32|(BIT23|BIT25)); //Reg4C[25]=1, Reg4C[23]=1 for pin output - //Pin Settings - ODM_SetBBReg(pDM_Odm, ODM_REG_PIN_CTRL_11N , BIT9|BIT8, 0);//Reg870[8]=1'b0, Reg870[9]=1'b0 //antsel antselb by HW - ODM_SetBBReg(pDM_Odm, ODM_REG_RX_ANT_CTRL_11N , BIT10, 0); //Reg864[10]=1'b0 //antsel2 by HW - ODM_SetBBReg(pDM_Odm, ODM_REG_LNA_SWITCH_11N , BIT22, 0); //Regb2c[22]=1'b0 //disable CS/CG switch - ODM_SetBBReg(pDM_Odm, ODM_REG_LNA_SWITCH_11N , BIT31, 1); //Regb2c[31]=1'b1 //output at CG only - //OFDM Settings - ODM_SetBBReg(pDM_Odm, ODM_REG_ANTDIV_PARA1_11N , bMaskDWord, 0x000000a0); - //CCK Settings - ODM_SetBBReg(pDM_Odm, ODM_REG_BB_PWR_SAV4_11N , BIT7, 1); //Fix CCK PHY status report issue - ODM_SetBBReg(pDM_Odm, ODM_REG_CCK_ANTDIV_PARA2_11N , BIT4, 1); //CCK complete HW AntDiv within 64 samples - //Tx Settings - ODM_SetBBReg(pDM_Odm, ODM_REG_TX_ANT_CTRL_11N , BIT21, 0); //Reg80c[21]=1'b0 //from TX Reg - ODM_UpdateRxIdleAnt_88E(pDM_Odm, MAIN_ANT); - - //antenna mapping table - if(!pDM_Odm->bIsMPChip) //testchip - { - ODM_SetBBReg(pDM_Odm, ODM_REG_RX_DEFUALT_A_11N , BIT10|BIT9|BIT8, 1); //Reg858[10:8]=3'b001 - ODM_SetBBReg(pDM_Odm, ODM_REG_RX_DEFUALT_A_11N , BIT13|BIT12|BIT11, 2); //Reg858[13:11]=3'b010 - } - else //MPchip - ODM_SetBBReg(pDM_Odm, ODM_REG_ANT_MAPPING1_11N , bMaskDWord, 0x0201); //Reg914=3'b010, Reg915=3'b001 - - //ODM_SetBBReg(pDM_Odm, 0xc50 , BIT7, 1); //Enable HW AntDiv - //ODM_SetBBReg(pDM_Odm, 0xa00 , BIT15, 1); //Enable CCK AntDiv -} - -VOID -odm_FastAntTrainingInit( - IN PDM_ODM_T pDM_Odm -) -{ - u4Byte value32, i; - pFAT_T pDM_FatTable = &pDM_Odm->DM_FatTable; - u4Byte AntCombination = 2; - struct adapter * Adapter = pDM_Odm->Adapter; - ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("odm_FastAntTrainingInit() \n")); - -#if (MP_DRIVER == 1) - if (*(pDM_Odm->mp_mode) == 1) - { - ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_LOUD, ("pDM_Odm->AntDivType: %d\n", pDM_Odm->AntDivType)); - return; - } -#endif - - for(i=0; i<6; i++) - { - pDM_FatTable->Bssid[i] = 0; - pDM_FatTable->antSumRSSI[i] = 0; - pDM_FatTable->antRSSIcnt[i] = 0; - pDM_FatTable->antAveRSSI[i] = 0; - } - pDM_FatTable->TrainIdx = 0; - pDM_FatTable->FAT_State = FAT_NORMAL_STATE; - - //MAC Setting - value32 = ODM_GetMACReg(pDM_Odm, 0x4c, bMaskDWord); - ODM_SetMACReg(pDM_Odm, 0x4c, bMaskDWord, value32|(BIT23|BIT25)); //Reg4C[25]=1, Reg4C[23]=1 for pin output - value32 = ODM_GetMACReg(pDM_Odm, 0x7B4, bMaskDWord); - ODM_SetMACReg(pDM_Odm, 0x7b4, bMaskDWord, value32|(BIT16|BIT17)); //Reg7B4[16]=1 enable antenna training, Reg7B4[17]=1 enable A2 match - //value32 = PlatformEFIORead4Byte(Adapter, 0x7B4); - //PlatformEFIOWrite4Byte(Adapter, 0x7b4, value32|BIT18); //append MACID in reponse packet - - //Match MAC ADDR - ODM_SetMACReg(pDM_Odm, 0x7b4, 0xFFFF, 0); - ODM_SetMACReg(pDM_Odm, 0x7b0, bMaskDWord, 0); - - ODM_SetBBReg(pDM_Odm, 0x870 , BIT9|BIT8, 0);//Reg870[8]=1'b0, Reg870[9]=1'b0 //antsel antselb by HW - ODM_SetBBReg(pDM_Odm, 0x864 , BIT10, 0); //Reg864[10]=1'b0 //antsel2 by HW - ODM_SetBBReg(pDM_Odm, 0xb2c , BIT22, 0); //Regb2c[22]=1'b0 //disable CS/CG switch - ODM_SetBBReg(pDM_Odm, 0xb2c , BIT31, 1); //Regb2c[31]=1'b1 //output at CG only - ODM_SetBBReg(pDM_Odm, 0xca4 , bMaskDWord, 0x000000a0); - - //antenna mapping table - if(AntCombination == 2) - { - if(!pDM_Odm->bIsMPChip) //testchip - { - ODM_SetBBReg(pDM_Odm, 0x858 , BIT10|BIT9|BIT8, 1); //Reg858[10:8]=3'b001 - ODM_SetBBReg(pDM_Odm, 0x858 , BIT13|BIT12|BIT11, 2); //Reg858[13:11]=3'b010 - } - else //MPchip - { - ODM_SetBBReg(pDM_Odm, 0x914 , bMaskByte0, 1); - ODM_SetBBReg(pDM_Odm, 0x914 , bMaskByte1, 2); - } - } - else if(AntCombination == 7) - { - if(!pDM_Odm->bIsMPChip) //testchip - { - ODM_SetBBReg(pDM_Odm, 0x858 , BIT10|BIT9|BIT8, 0); //Reg858[10:8]=3'b000 - ODM_SetBBReg(pDM_Odm, 0x858 , BIT13|BIT12|BIT11, 1); //Reg858[13:11]=3'b001 - ODM_SetBBReg(pDM_Odm, 0x878 , BIT16, 0); - ODM_SetBBReg(pDM_Odm, 0x858 , BIT15|BIT14, 2); //(Reg878[0],Reg858[14:15])=3'b010 - ODM_SetBBReg(pDM_Odm, 0x878 , BIT19|BIT18|BIT17, 3);//Reg878[3:1]=3b'011 - ODM_SetBBReg(pDM_Odm, 0x878 , BIT22|BIT21|BIT20, 4);//Reg878[6:4]=3b'100 - ODM_SetBBReg(pDM_Odm, 0x878 , BIT25|BIT24|BIT23, 5);//Reg878[9:7]=3b'101 - ODM_SetBBReg(pDM_Odm, 0x878 , BIT28|BIT27|BIT26, 6);//Reg878[12:10]=3b'110 - ODM_SetBBReg(pDM_Odm, 0x878 , BIT31|BIT30|BIT29, 7);//Reg878[15:13]=3b'111 - } - else //MPchip - { - ODM_SetBBReg(pDM_Odm, 0x914 , bMaskByte0, 0); - ODM_SetBBReg(pDM_Odm, 0x914 , bMaskByte1, 1); - ODM_SetBBReg(pDM_Odm, 0x914 , bMaskByte2, 2); - ODM_SetBBReg(pDM_Odm, 0x914 , bMaskByte3, 3); - ODM_SetBBReg(pDM_Odm, 0x918 , bMaskByte0, 4); - ODM_SetBBReg(pDM_Odm, 0x918 , bMaskByte1, 5); - ODM_SetBBReg(pDM_Odm, 0x918 , bMaskByte2, 6); - ODM_SetBBReg(pDM_Odm, 0x918 , bMaskByte3, 7); - } - } - - //Default Ant Setting when no fast training - ODM_SetBBReg(pDM_Odm, 0x80c , BIT21, 1); //Reg80c[21]=1'b1 //from TX Info - ODM_SetBBReg(pDM_Odm, 0x864 , BIT5|BIT4|BIT3, 0); //Default RX - ODM_SetBBReg(pDM_Odm, 0x864 , BIT8|BIT7|BIT6, 1); //Optional RX - //ODM_SetBBReg(pDM_Odm, 0x860 , BIT14|BIT13|BIT12, 1); //Default TX - - //Enter Traing state - ODM_SetBBReg(pDM_Odm, 0x864 , BIT2|BIT1|BIT0, (AntCombination-1)); //Reg864[2:0]=3'd6 //ant combination=reg864[2:0]+1 - //ODM_SetBBReg(pDM_Odm, 0xc50 , BIT7, 0); //RegC50[7]=1'b0 //disable HW AntDiv - //ODM_SetBBReg(pDM_Odm, 0xe08 , BIT16, 0); //RegE08[16]=1'b0 //disable fast training - //ODM_SetBBReg(pDM_Odm, 0xe08 , BIT16, 1); //RegE08[16]=1'b1 //enable fast training - ODM_SetBBReg(pDM_Odm, 0xc50 , BIT7, 1); //RegC50[7]=1'b1 //enable HW AntDiv - - - //SW Control - //PHY_SetBBReg(Adapter, 0x864 , BIT10, 1); - //PHY_SetBBReg(Adapter, 0x870 , BIT9, 1); - //PHY_SetBBReg(Adapter, 0x870 , BIT8, 1); - //PHY_SetBBReg(Adapter, 0x864 , BIT11, 1); - //PHY_SetBBReg(Adapter, 0x860 , BIT9, 0); - //PHY_SetBBReg(Adapter, 0x860 , BIT8, 0); -} - -VOID -ODM_AntennaDiversityInit_88E( - IN PDM_ODM_T pDM_Odm -) -{ -/* - //2012.03.27 LukeLee: For temp use, should be removed later - //pDM_Odm->AntDivType = CG_TRX_HW_ANTDIV; - //{ - struct adapter * Adapter = pDM_Odm->Adapter; - HAL_DATA_TYPE* pHalData = GET_HAL_DATA(Adapter); - //pHalData->AntDivCfg = 1; - //} -*/ - if(pDM_Odm->SupportICType != ODM_RTL8188E) - return; - - //ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("pDM_Odm->AntDivType=%d, pHalData->AntDivCfg=%d\n", - // pDM_Odm->AntDivType, pHalData->AntDivCfg)); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("pDM_Odm->AntDivType=%d\n",pDM_Odm->AntDivType)); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("pDM_Odm->bIsMPChip=%s\n",(pDM_Odm->bIsMPChip?"TRUE":"FALSE"))); - - if(pDM_Odm->AntDivType == CGCS_RX_HW_ANTDIV) - odm_RX_HWAntDivInit(pDM_Odm); - else if(pDM_Odm->AntDivType == CG_TRX_HW_ANTDIV) - odm_TRX_HWAntDivInit(pDM_Odm); - else if(pDM_Odm->AntDivType == CG_TRX_SMART_ANTDIV) - odm_FastAntTrainingInit(pDM_Odm); -} - - -VOID -ODM_UpdateRxIdleAnt_88E(IN PDM_ODM_T pDM_Odm, IN u1Byte Ant) -{ - pFAT_T pDM_FatTable = &pDM_Odm->DM_FatTable; - u4Byte DefaultAnt, OptionalAnt; - - if(pDM_FatTable->RxIdleAnt != Ant) - { - ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("Need to Update Rx Idle Ant\n")); - if(Ant == MAIN_ANT) - { - DefaultAnt = (pDM_Odm->AntDivType == CG_TRX_HW_ANTDIV)?MAIN_ANT_CG_TRX:MAIN_ANT_CGCS_RX; - OptionalAnt = (pDM_Odm->AntDivType == CG_TRX_HW_ANTDIV)?AUX_ANT_CG_TRX:AUX_ANT_CGCS_RX; - } - else - { - DefaultAnt = (pDM_Odm->AntDivType == CG_TRX_HW_ANTDIV)?AUX_ANT_CG_TRX:AUX_ANT_CGCS_RX; - OptionalAnt = (pDM_Odm->AntDivType == CG_TRX_HW_ANTDIV)?MAIN_ANT_CG_TRX:MAIN_ANT_CGCS_RX; - } - - if(pDM_Odm->AntDivType == CG_TRX_HW_ANTDIV) - { - ODM_SetBBReg(pDM_Odm, ODM_REG_RX_ANT_CTRL_11N , BIT5|BIT4|BIT3, DefaultAnt); //Default RX - ODM_SetBBReg(pDM_Odm, ODM_REG_RX_ANT_CTRL_11N , BIT8|BIT7|BIT6, OptionalAnt); //Optional RX - ODM_SetBBReg(pDM_Odm, ODM_REG_ANTSEL_CTRL_11N , BIT14|BIT13|BIT12, DefaultAnt); //Default TX - ODM_SetMACReg(pDM_Odm, ODM_REG_RESP_TX_11N , BIT6|BIT7, DefaultAnt); //Resp Tx - - } - else if(pDM_Odm->AntDivType == CGCS_RX_HW_ANTDIV) - { - ODM_SetBBReg(pDM_Odm, ODM_REG_RX_ANT_CTRL_11N , BIT5|BIT4|BIT3, DefaultAnt); //Default RX - ODM_SetBBReg(pDM_Odm, ODM_REG_RX_ANT_CTRL_11N , BIT8|BIT7|BIT6, OptionalAnt); //Optional RX - } - } - pDM_FatTable->RxIdleAnt = Ant; - ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("RxIdleAnt=%s\n",(Ant==MAIN_ANT)?"MAIN_ANT":"AUX_ANT")); - printk("RxIdleAnt=%s\n",(Ant==MAIN_ANT)?"MAIN_ANT":"AUX_ANT"); -} - - -VOID -odm_UpdateTxAnt_88E(IN PDM_ODM_T pDM_Odm, IN u1Byte Ant, IN u4Byte MacId) -{ - pFAT_T pDM_FatTable = &pDM_Odm->DM_FatTable; - u1Byte TargetAnt; - - if(Ant == MAIN_ANT) - TargetAnt = MAIN_ANT_CG_TRX; - else - TargetAnt = AUX_ANT_CG_TRX; - - pDM_FatTable->antsel_a[MacId] = TargetAnt&BIT0; - pDM_FatTable->antsel_b[MacId] = (TargetAnt&BIT1)>>1; - pDM_FatTable->antsel_c[MacId] = (TargetAnt&BIT2)>>2; - - ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("Tx from TxInfo, TargetAnt=%s\n", - (Ant==MAIN_ANT)?"MAIN_ANT":"AUX_ANT")); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD,("antsel_tr_mux=3'b%d%d%d\n", - pDM_FatTable->antsel_c[MacId] , pDM_FatTable->antsel_b[MacId] , pDM_FatTable->antsel_a[MacId] )); -} - -#if (DM_ODM_SUPPORT_TYPE & (ODM_MP|ODM_CE)) -VOID -ODM_SetTxAntByTxInfo_88E( - IN PDM_ODM_T pDM_Odm, - IN pu1Byte pDesc, - IN u1Byte macId - ) -{ - pFAT_T pDM_FatTable = &pDM_Odm->DM_FatTable; - - if((pDM_Odm->AntDivType == CG_TRX_HW_ANTDIV)||(pDM_Odm->AntDivType == CG_TRX_SMART_ANTDIV)) - { - SET_TX_DESC_ANTSEL_A_88E(pDesc, pDM_FatTable->antsel_a[macId]); - SET_TX_DESC_ANTSEL_B_88E(pDesc, pDM_FatTable->antsel_b[macId]); - SET_TX_DESC_ANTSEL_C_88E(pDesc, pDM_FatTable->antsel_c[macId]); - //ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("ODM_SetTxAntByTxInfo_88E_WIN(): MacID=%d, antsel_tr_mux=3'b%d%d%d\n", - // macId, pDM_FatTable->antsel_c[macId], pDM_FatTable->antsel_b[macId], pDM_FatTable->antsel_a[macId])); - } -} -#else// (DM_ODM_SUPPORT_TYPE == ODM_AP) -VOID -ODM_SetTxAntByTxInfo_88E( - IN PDM_ODM_T pDM_Odm - ) -{ -} -#endif - -VOID -ODM_AntselStatistics_88E( - IN PDM_ODM_T pDM_Odm, - IN u1Byte antsel_tr_mux, - IN u4Byte MacId, - IN u1Byte RxPWDBAll -) -{ - pFAT_T pDM_FatTable = &pDM_Odm->DM_FatTable; - if(pDM_Odm->AntDivType == CG_TRX_HW_ANTDIV) - { - if(antsel_tr_mux == MAIN_ANT_CG_TRX) - { - - pDM_FatTable->MainAnt_Sum[MacId]+=RxPWDBAll; - pDM_FatTable->MainAnt_Cnt[MacId]++; - } - else - { - pDM_FatTable->AuxAnt_Sum[MacId]+=RxPWDBAll; - pDM_FatTable->AuxAnt_Cnt[MacId]++; - - } - } - else if(pDM_Odm->AntDivType == CGCS_RX_HW_ANTDIV) - { - if(antsel_tr_mux == MAIN_ANT_CGCS_RX) - { - - pDM_FatTable->MainAnt_Sum[MacId]+=RxPWDBAll; - pDM_FatTable->MainAnt_Cnt[MacId]++; - } - else - { - pDM_FatTable->AuxAnt_Sum[MacId]+=RxPWDBAll; - pDM_FatTable->AuxAnt_Cnt[MacId]++; - - } - } -} - -#define TX_BY_REG 0 -VOID -odm_HWAntDiv( - IN PDM_ODM_T pDM_Odm -) -{ - u4Byte i, MinRSSI=0xFF, AntDivMaxRSSI=0, MaxRSSI=0, LocalMinRSSI, LocalMaxRSSI; - u4Byte Main_RSSI, Aux_RSSI; - u1Byte RxIdleAnt=0, TargetAnt=7; - pFAT_T pDM_FatTable = &pDM_Odm->DM_FatTable; - pDIG_T pDM_DigTable = &pDM_Odm->DM_DigTable; - BOOLEAN bMatchBSSID; - BOOLEAN bPktFilterMacth = FALSE; - PSTA_INFO_T pEntry; - - for (i=0; ipODM_StaInfo[i]; - if(IS_STA_VALID(pEntry)) - { - //2 Caculate RSSI per Antenna - Main_RSSI = (pDM_FatTable->MainAnt_Cnt[i]!=0)?(pDM_FatTable->MainAnt_Sum[i]/pDM_FatTable->MainAnt_Cnt[i]):0; - Aux_RSSI = (pDM_FatTable->AuxAnt_Cnt[i]!=0)?(pDM_FatTable->AuxAnt_Sum[i]/pDM_FatTable->AuxAnt_Cnt[i]):0; - TargetAnt = (Main_RSSI>=Aux_RSSI)?MAIN_ANT:AUX_ANT; - ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("MacID=%d, MainAnt_Sum=%d, MainAnt_Cnt=%d\n", i, pDM_FatTable->MainAnt_Sum[i], pDM_FatTable->MainAnt_Cnt[i])); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("MacID=%d, AuxAnt_Sum=%d, AuxAnt_Cnt=%d\n",i, pDM_FatTable->AuxAnt_Sum[i], pDM_FatTable->AuxAnt_Cnt[i])); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("MacID=%d, Main_RSSI= %d, Aux_RSSI= %d\n", i, Main_RSSI, Aux_RSSI)); - - //2 Select MaxRSSI for DIG - LocalMaxRSSI = (Main_RSSI>Aux_RSSI)?Main_RSSI:Aux_RSSI; - if((LocalMaxRSSI > AntDivMaxRSSI) && (LocalMaxRSSI < 40)) - AntDivMaxRSSI = LocalMaxRSSI; - if(LocalMaxRSSI > MaxRSSI) - MaxRSSI = LocalMaxRSSI; - - //2 Select RX Idle Antenna - if((pDM_FatTable->RxIdleAnt == MAIN_ANT) && (Main_RSSI == 0)) - Main_RSSI = Aux_RSSI; - else if((pDM_FatTable->RxIdleAnt == AUX_ANT) && (Aux_RSSI == 0)) - Aux_RSSI = Main_RSSI; - - LocalMinRSSI = (Main_RSSI>Aux_RSSI)?Aux_RSSI:Main_RSSI; - if(LocalMinRSSI < MinRSSI) - { - MinRSSI = LocalMinRSSI; - RxIdleAnt = TargetAnt; - } -#if TX_BY_REG - -#else - //2 Select TRX Antenna - if(pDM_Odm->AntDivType == CG_TRX_HW_ANTDIV) - odm_UpdateTxAnt_88E(pDM_Odm, TargetAnt, i); -#endif - } - pDM_FatTable->MainAnt_Sum[i] = 0; - pDM_FatTable->AuxAnt_Sum[i] = 0; - pDM_FatTable->MainAnt_Cnt[i] = 0; - pDM_FatTable->AuxAnt_Cnt[i] = 0; - } - - //2 Set RX Idle Antenna - ODM_UpdateRxIdleAnt_88E(pDM_Odm, RxIdleAnt); - - pDM_DigTable->AntDiv_RSSI_max = AntDivMaxRSSI; - pDM_DigTable->RSSI_max = MaxRSSI; -} - - -#if (!(DM_ODM_SUPPORT_TYPE == ODM_CE)) -VOID -odm_SetNextMACAddrTarget( - IN PDM_ODM_T pDM_Odm -) -{ - pFAT_T pDM_FatTable = &pDM_Odm->DM_FatTable; - PSTA_INFO_T pEntry; - //u1Byte Bssid[6]; - u4Byte value32, i; - - // - //2012.03.26 LukeLee: The MAC address is changed according to MACID in turn - // - ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("odm_SetNextMACAddrTarget() ==>\n")); - if(pDM_Odm->bLinked) - { - for (i=0; iTrainIdx+1) == ODM_ASSOCIATE_ENTRY_NUM) - pDM_FatTable->TrainIdx = 0; - else - pDM_FatTable->TrainIdx++; - - pEntry = pDM_Odm->pODM_StaInfo[pDM_FatTable->TrainIdx]; - if(IS_STA_VALID(pEntry)) - { - //Match MAC ADDR -#if (DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL)) - value32 = (pEntry->hwaddr[5]<<8)|pEntry->hwaddr[4]; -#else - value32 = (pEntry->MacAddr[5]<<8)|pEntry->MacAddr[4]; -#endif - ODM_SetMACReg(pDM_Odm, 0x7b4, 0xFFFF, value32); -#if (DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL)) - value32 = (pEntry->hwaddr[3]<<24)|(pEntry->hwaddr[2]<<16) |(pEntry->hwaddr[1]<<8) |pEntry->hwaddr[0]; -#else - value32 = (pEntry->MacAddr[3]<<24)|(pEntry->MacAddr[2]<<16) |(pEntry->MacAddr[1]<<8) |pEntry->MacAddr[0]; -#endif - ODM_SetMACReg(pDM_Odm, 0x7b0, bMaskDWord, value32); - - ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("pDM_FatTable->TrainIdx=%d\n",pDM_FatTable->TrainIdx)); -#if (DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL)) - ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("Training MAC Addr = %x:%x:%x:%x:%x:%x\n", - pEntry->hwaddr[5],pEntry->hwaddr[4],pEntry->hwaddr[3],pEntry->hwaddr[2],pEntry->hwaddr[1],pEntry->hwaddr[0])); -#else - ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("Training MAC Addr = %x:%x:%x:%x:%x:%x\n", - pEntry->MacAddr[5],pEntry->MacAddr[4],pEntry->MacAddr[3],pEntry->MacAddr[2],pEntry->MacAddr[1],pEntry->MacAddr[0])); -#endif - - break; - } - } - - } - -#if 0 - // - //2012.03.26 LukeLee: This should be removed later, the MAC address is changed according to MACID in turn - // - #if( DM_ODM_SUPPORT_TYPE & ODM_MP) - { - struct adapter *Adapter = pDM_Odm->Adapter; - PMGNT_INFO pMgntInfo = &Adapter->MgntInfo; - - for (i=0; i<6; i++) - { - Bssid[i] = pMgntInfo->Bssid[i]; - //DbgPrint("Bssid[%d]=%x\n", i, Bssid[i]); - } - } - #endif - - //odm_SetNextMACAddrTarget(pDM_Odm); - - //1 Select MAC Address Filter - for (i=0; i<6; i++) - { - if(Bssid[i] != pDM_FatTable->Bssid[i]) - { - bMatchBSSID = FALSE; - break; - } - } - if(bMatchBSSID == FALSE) - { - //Match MAC ADDR - value32 = (Bssid[5]<<8)|Bssid[4]; - ODM_SetMACReg(pDM_Odm, 0x7b4, 0xFFFF, value32); - value32 = (Bssid[3]<<24)|(Bssid[2]<<16) |(Bssid[1]<<8) |Bssid[0]; - ODM_SetMACReg(pDM_Odm, 0x7b0, bMaskDWord, value32); - } - - return bMatchBSSID; -#endif - -} - -VOID -odm_FastAntTraining( - IN PDM_ODM_T pDM_Odm -) -{ - u4Byte i, MaxRSSI=0; - u1Byte TargetAnt=2; - pFAT_T pDM_FatTable = &pDM_Odm->DM_FatTable; - BOOLEAN bPktFilterMacth = FALSE; - PSTA_INFO_T pEntry; - - - ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("==>odm_FastAntTraining()\n")); - - //1 TRAINING STATE - if(pDM_FatTable->FAT_State == FAT_TRAINING_STATE) - { - ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("Enter FAT_TRAINING_STATE\n")); - //2 Caculate RSSI per Antenna - for (i=0; i<7; i++) - { - if(pDM_FatTable->antRSSIcnt[i] == 0) - pDM_FatTable->antAveRSSI[i] = 0; - else - { - pDM_FatTable->antAveRSSI[i] = pDM_FatTable->antSumRSSI[i] /pDM_FatTable->antRSSIcnt[i]; - bPktFilterMacth = TRUE; - } - if(pDM_FatTable->antAveRSSI[i] > MaxRSSI) - { - MaxRSSI = pDM_FatTable->antAveRSSI[i]; - TargetAnt = (u1Byte) i; - } - - ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("pDM_FatTable->antAveRSSI[%d] = %d, pDM_FatTable->antRSSIcnt[%d] = %d\n", - i, pDM_FatTable->antAveRSSI[i], i, pDM_FatTable->antRSSIcnt[i])); - } - - //2 Select TRX Antenna - if(bPktFilterMacth == FALSE) - { - ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("None Packet is matched\n")); - - ODM_SetBBReg(pDM_Odm, 0xe08 , BIT16, 0); //RegE08[16]=1'b0 //disable fast training - ODM_SetBBReg(pDM_Odm, 0xc50 , BIT7, 0); //RegC50[7]=1'b0 //disable HW AntDiv - } - else - { - ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("TargetAnt=%d, MaxRSSI=%d\n",TargetAnt,MaxRSSI)); - - ODM_SetBBReg(pDM_Odm, 0xe08 , BIT16, 0); //RegE08[16]=1'b0 //disable fast training - //ODM_SetBBReg(pDM_Odm, 0xc50 , BIT7, 0); //RegC50[7]=1'b0 //disable HW AntDiv - ODM_SetBBReg(pDM_Odm, 0x864 , BIT8|BIT7|BIT6, TargetAnt); //Default RX is Omni, Optional RX is the best decision by FAT - //ODM_SetBBReg(pDM_Odm, 0x860 , BIT14|BIT13|BIT12, TargetAnt); //Default TX - ODM_SetBBReg(pDM_Odm, 0x80c , BIT21, 1); //Reg80c[21]=1'b1 //from TX Info - -#if 0 - pEntry = pDM_Odm->pODM_StaInfo[pDM_FatTable->TrainIdx]; - - if(IS_STA_VALID(pEntry)) - { - pEntry->antsel_a = TargetAnt&BIT0; - pEntry->antsel_b = (TargetAnt&BIT1)>>1; - pEntry->antsel_c = (TargetAnt&BIT2)>>2; - } -#else - pDM_FatTable->antsel_a[pDM_FatTable->TrainIdx] = TargetAnt&BIT0; - pDM_FatTable->antsel_b[pDM_FatTable->TrainIdx] = (TargetAnt&BIT1)>>1; - pDM_FatTable->antsel_c[pDM_FatTable->TrainIdx] = (TargetAnt&BIT2)>>2; -#endif - - - if(TargetAnt == 0) - ODM_SetBBReg(pDM_Odm, 0xc50 , BIT7, 0); //RegC50[7]=1'b0 //disable HW AntDiv - - } - - //2 Reset Counter - for(i=0; i<7; i++) - { - pDM_FatTable->antSumRSSI[i] = 0; - pDM_FatTable->antRSSIcnt[i] = 0; - } - - pDM_FatTable->FAT_State = FAT_NORMAL_STATE; - return; - } - - //1 NORMAL STATE - if(pDM_FatTable->FAT_State == FAT_NORMAL_STATE) - { - ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("Enter FAT_NORMAL_STATE\n")); - - odm_SetNextMACAddrTarget(pDM_Odm); - -#if 0 - pEntry = pDM_Odm->pODM_StaInfo[pDM_FatTable->TrainIdx]; - if(IS_STA_VALID(pEntry)) - { - pEntry->antsel_a = TargetAnt&BIT0; - pEntry->antsel_b = (TargetAnt&BIT1)>>1; - pEntry->antsel_c = (TargetAnt&BIT2)>>2; - } -#endif - - //2 Prepare Training - pDM_FatTable->FAT_State = FAT_TRAINING_STATE; - ODM_SetBBReg(pDM_Odm, 0xe08 , BIT16, 1); //RegE08[16]=1'b1 //enable fast training - ODM_SetBBReg(pDM_Odm, 0xc50 , BIT7, 1); //RegC50[7]=1'b1 //enable HW AntDiv - ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("Start FAT_TRAINING_STATE\n")); - ODM_SetTimer(pDM_Odm,&pDM_Odm->FastAntTrainingTimer, 500 ); //ms - - } - -} - -VOID -odm_FastAntTrainingCallback( - IN PDM_ODM_T pDM_Odm -) -{ - -#if (DM_ODM_SUPPORT_TYPE == ODM_CE) - struct adapter *padapter = pDM_Odm->Adapter; - if(padapter->net_closed == _TRUE) - return; - //if(*pDM_Odm->pbNet_closed == TRUE) - // return; -#endif - -#if USE_WORKITEM - ODM_ScheduleWorkItem(&pDM_Odm->FastAntTrainingWorkitem); -#else - odm_FastAntTraining(pDM_Odm); -#endif -} - -VOID -odm_FastAntTrainingWorkItemCallback( - IN PDM_ODM_T pDM_Odm -) -{ - odm_FastAntTraining(pDM_Odm); -} -#endif - -VOID -ODM_AntennaDiversity_88E( - IN PDM_ODM_T pDM_Odm -) -{ - pFAT_T pDM_FatTable = &pDM_Odm->DM_FatTable; - if((pDM_Odm->SupportICType != ODM_RTL8188E) || (!(pDM_Odm->SupportAbility & ODM_BB_ANT_DIV))) - { - //ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("ODM_AntennaDiversity_88E: Not Support 88E AntDiv\n")); - return; - } -#ifdef CONFIG_SPECIAL_SETTING_FOR_FUNAI_TV - if(pDM_Odm->bLinked){ - if(pDM_Odm->Adapter->registrypriv.force_ant != 0) - { - u4Byte Main_RSSI, Aux_RSSI; - u8 i=0; - Main_RSSI = (pDM_FatTable->MainAnt_Cnt[i]!=0)?(pDM_FatTable->MainAnt_Sum[i]/pDM_FatTable->MainAnt_Cnt[i]):0; - Aux_RSSI = (pDM_FatTable->AuxAnt_Cnt[i]!=0)?(pDM_FatTable->AuxAnt_Sum[i]/pDM_FatTable->AuxAnt_Cnt[i]):0; - - ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("MacID=%d, MainAnt_Sum=%d, MainAnt_Cnt=%d\n", i, pDM_FatTable->MainAnt_Sum[i], pDM_FatTable->MainAnt_Cnt[i])); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("MacID=%d, AuxAnt_Sum=%d, AuxAnt_Cnt=%d\n",i, pDM_FatTable->AuxAnt_Sum[i], pDM_FatTable->AuxAnt_Cnt[i])); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("MacID=%d, Main_RSSI= %d, Aux_RSSI= %d\n", i, Main_RSSI, Aux_RSSI)); - pDM_FatTable->MainAnt_Sum[i] = 0; - pDM_FatTable->AuxAnt_Sum[i] = 0; - pDM_FatTable->MainAnt_Cnt[i] = 0; - pDM_FatTable->AuxAnt_Cnt[i] = 0; - } - if(pDM_Odm->Adapter->registrypriv.force_ant==1){ - ODM_UpdateRxIdleAnt_88E(pDM_Odm, MAIN_ANT); - printk("%s fixed antenna in Main ant\n",__FUNCTION__); - return; - } - else if(pDM_Odm->Adapter->registrypriv.force_ant==2){ - ODM_UpdateRxIdleAnt_88E(pDM_Odm, AUX_ANT); - printk("%s fixed antenna in AUX ant\n",__FUNCTION__); - return; - } - } -#endif - - - - if(!pDM_Odm->bLinked) - { - ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("ODM_AntennaDiversity_88E(): No Link.\n")); - if(pDM_FatTable->bBecomeLinked == TRUE) - { - ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("Need to Turn off HW AntDiv\n")); - ODM_SetBBReg(pDM_Odm, ODM_REG_IGI_A_11N , BIT7, 0); //RegC50[7]=1'b1 //enable HW AntDiv - ODM_SetBBReg(pDM_Odm, ODM_REG_CCK_ANTDIV_PARA1_11N , BIT15, 0); //Enable CCK AntDiv - if(pDM_Odm->AntDivType == CG_TRX_HW_ANTDIV) - ODM_SetBBReg(pDM_Odm, ODM_REG_TX_ANT_CTRL_11N , BIT21, 0); //Reg80c[21]=1'b0 //from TX Reg - pDM_FatTable->bBecomeLinked = pDM_Odm->bLinked; - } - return; - } - else - { - if(pDM_FatTable->bBecomeLinked ==FALSE) - { - ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("Need to Turn on HW AntDiv\n")); - //Because HW AntDiv is disabled before Link, we enable HW AntDiv after link - ODM_SetBBReg(pDM_Odm, ODM_REG_IGI_A_11N , BIT7, 1); //RegC50[7]=1'b1 //enable HW AntDiv - ODM_SetBBReg(pDM_Odm, ODM_REG_CCK_ANTDIV_PARA1_11N , BIT15, 1); //Enable CCK AntDiv - //ODM_SetMACReg(pDM_Odm, 0x7B4 , BIT18, 1); //Response Tx by current HW antdiv - if(pDM_Odm->AntDivType == CG_TRX_HW_ANTDIV) - { -#if TX_BY_REG - ODM_SetBBReg(pDM_Odm, ODM_REG_TX_ANT_CTRL_11N , BIT21, 0); //Reg80c[21]=1'b0 //from Reg -#else - ODM_SetBBReg(pDM_Odm, ODM_REG_TX_ANT_CTRL_11N , BIT21, 1); //Reg80c[21]=1'b1 //from TX Info -#endif - } - pDM_FatTable->bBecomeLinked = pDM_Odm->bLinked; - } - } - - - - if((pDM_Odm->AntDivType == CG_TRX_HW_ANTDIV)||(pDM_Odm->AntDivType == CGCS_RX_HW_ANTDIV)) - odm_HWAntDiv(pDM_Odm); - #if (!(DM_ODM_SUPPORT_TYPE == ODM_CE)) - else if(pDM_Odm->AntDivType == CG_TRX_SMART_ANTDIV) - odm_FastAntTraining(pDM_Odm); - #endif -} - - -/* -#if (DM_ODM_SUPPORT_TYPE == ODM_MP) -VOID -odm_FastAntTrainingCallback( - PRT_TIMER pTimer -) -{ - struct adapter * Adapter = (PADAPTER)pTimer->Adapter; - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); - - //#if DEV_BUS_TYPE==RT_PCI_INTERFACE - //#if USE_WORKITEM - //PlatformScheduleWorkItem(&pHalData->SwAntennaSwitchWorkitem); - //#else - odm_FastAntTraining(&pHalData->DM_OutSrc); - //#endif - //#else - //PlatformScheduleWorkItem(&pHalData->SwAntennaSwitchWorkitem); - //#endif - -} -#elif (DM_ODM_SUPPORT_TYPE == ODM_CE) -VOID odm_FastAntTrainingCallback(void *FunctionContext) -{ - PDM_ODM_T pDM_Odm= (PDM_ODM_T)FunctionContext; - struct adapter *padapter = pDM_Odm->Adapter; - if(padapter->net_closed == _TRUE) - return; - odm_FastAntTraining(pDM_Odm); -} -#elif (DM_ODM_SUPPORT_TYPE == ODM_AP) -VOID odm_FastAntTrainingCallback(void *FunctionContext) -{ - PDM_ODM_T pDM_Odm= (PDM_ODM_T)FunctionContext; - odm_FastAntTraining(pDM_Odm); -} - -#endif -*/ - -#else //#if(defined(CONFIG_HW_ANTENNA_DIVERSITY)) -#if (DM_ODM_SUPPORT_TYPE & (ODM_MP|ODM_CE)) -VOID -ODM_SetTxAntByTxInfo_88E( - IN PDM_ODM_T pDM_Odm, - IN pu1Byte pDesc, - IN u1Byte macId - ) -{ -} -#else// (DM_ODM_SUPPORT_TYPE == ODM_AP) -VOID -ODM_SetTxAntByTxInfo_88E( - IN PDM_ODM_T pDM_Odm - ) -{ -} -#endif -#endif //#if(defined(CONFIG_HW_ANTENNA_DIVERSITY)) -//3============================================================ -//3 Dynamic Primary CCA -//3============================================================ - -VOID -odm_PrimaryCCA_Init( - IN PDM_ODM_T pDM_Odm) -{ - pPri_CCA_T PrimaryCCA = &(pDM_Odm->DM_PriCCA); - PrimaryCCA->DupRTS_flag = 0; - PrimaryCCA->intf_flag = 0; - PrimaryCCA->intf_type = 0; - PrimaryCCA->Monitor_flag = 0; - PrimaryCCA->PriCCA_flag = 0; -} - -BOOLEAN -ODM_DynamicPrimaryCCA_DupRTS( - IN PDM_ODM_T pDM_Odm - ) -{ - pPri_CCA_T PrimaryCCA = &(pDM_Odm->DM_PriCCA); - - return PrimaryCCA->DupRTS_flag; -} - -VOID -odm_DynamicPrimaryCCA( - IN PDM_ODM_T pDM_Odm - ) -{ - struct adapter *Adapter = pDM_Odm->Adapter; // for NIC - prtl8192cd_priv priv = pDM_Odm->priv; // for AP - - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); -#if (DM_ODM_SUPPORT_TYPE & (ODM_MP)) - PMGNT_INFO pMgntInfo = &(Adapter->MgntInfo); - PRT_WLAN_STA pEntry; -#endif - - PFALSE_ALARM_STATISTICS FalseAlmCnt = &(pDM_Odm->FalseAlmCnt); - pPri_CCA_T PrimaryCCA = &(pDM_Odm->DM_PriCCA); - - BOOLEAN Is40MHz; - BOOLEAN Client_40MHz = FALSE, Client_tmp = FALSE; // connected client BW - BOOLEAN bConnected = FALSE; // connected or not - static u1Byte Client_40MHz_pre = 0; - static u8Byte lastTxOkCnt = 0; - static u8Byte lastRxOkCnt = 0; - static u4Byte Counter = 0; - static u1Byte Delay = 1; - u8Byte curTxOkCnt; - u8Byte curRxOkCnt; - u1Byte SecCHOffset; - u1Byte i; - -#if((DM_ODM_SUPPORT_TYPE==ODM_ADSL) ||( DM_ODM_SUPPORT_TYPE==ODM_CE)) - return; -#endif - - if(pDM_Odm->SupportICType != ODM_RTL8188E) - return; - - Is40MHz = *(pDM_Odm->pBandWidth); - SecCHOffset = *(pDM_Odm->pSecChOffset); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_PRICCA, ODM_DBG_LOUD, ("Second CH Offset = %d\n", SecCHOffset)); - -#if (DM_ODM_SUPPORT_TYPE == ODM_MP) - if(Is40MHz==1) - SecCHOffset = SecCHOffset%2+1; // NIC's definition is reverse to AP 1:secondary below, 2: secondary above - ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_PRICCA, ODM_DBG_LOUD, ("Second CH Offset = %d\n", SecCHOffset)); - //3 Check Current WLAN Traffic - curTxOkCnt = Adapter->TxStats.NumTxBytesUnicast - lastTxOkCnt; - curRxOkCnt = Adapter->RxStats.NumRxBytesUnicast - lastRxOkCnt; - lastTxOkCnt = Adapter->TxStats.NumTxBytesUnicast; - lastRxOkCnt = Adapter->RxStats.NumRxBytesUnicast; -#elif (DM_ODM_SUPPORT_TYPE == ODM_AP) - //3 Check Current WLAN Traffic - curTxOkCnt = *(pDM_Odm->pNumTxBytesUnicast)-lastTxOkCnt; - curRxOkCnt = *(pDM_Odm->pNumRxBytesUnicast)-lastRxOkCnt; - lastTxOkCnt = *(pDM_Odm->pNumTxBytesUnicast); - lastRxOkCnt = *(pDM_Odm->pNumRxBytesUnicast); -#endif - - //==================Debug Message==================== - ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_PRICCA, ODM_DBG_LOUD, ("TP = %llu\n", curTxOkCnt+curRxOkCnt)); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_PRICCA, ODM_DBG_LOUD, ("Is40MHz = %d\n", Is40MHz)); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_PRICCA, ODM_DBG_LOUD, ("BW_LSC = %d\n", FalseAlmCnt->Cnt_BW_LSC)); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_PRICCA, ODM_DBG_LOUD, ("BW_USC = %d\n", FalseAlmCnt->Cnt_BW_USC)); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_PRICCA, ODM_DBG_LOUD, ("CCA OFDM = %d\n", FalseAlmCnt->Cnt_OFDM_CCA)); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_PRICCA, ODM_DBG_LOUD, ("CCA CCK = %d\n", FalseAlmCnt->Cnt_CCK_CCA)); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_PRICCA, ODM_DBG_LOUD, ("OFDM FA = %d\n", FalseAlmCnt->Cnt_Ofdm_fail)); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_PRICCA, ODM_DBG_LOUD, ("CCK FA = %d\n", FalseAlmCnt->Cnt_Cck_fail)); - //================================================ - -#if (DM_ODM_SUPPORT_TYPE == ODM_MP) - if (ACTING_AS_AP(Adapter)) // primary cca process only do at AP mode -#endif - { - - #if (DM_ODM_SUPPORT_TYPE == ODM_MP) - ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_PRICCA, ODM_DBG_LOUD, ("ACTING as AP mode=%d\n", ACTING_AS_AP(Adapter))); - //3 To get entry's connection and BW infomation status. - for(i=0;iHTInfo.bBw40MHz; // client BW - ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_PRICCA, ODM_DBG_LOUD, ("Client_BW=%d\n", Client_tmp)); - if(Client_tmp>Client_40MHz) - Client_40MHz = Client_tmp; // 40M/20M coexist => 40M priority is High - - if(pEntry->bAssociated) - { - bConnected=TRUE; // client is connected or not - break; - } - } - else - { - break; - } - } -#elif (DM_ODM_SUPPORT_TYPE == ODM_AP) - //3 To get entry's connection and BW infomation status. - - PSTA_INFO_T pstat; - - for(i=0; ipODM_StaInfo[i]; - if(IS_STA_VALID(pstat) ) - { - Client_tmp = pstat->tx_bw; - if(Client_tmp>Client_40MHz) - Client_40MHz = Client_tmp; // 40M/20M coexist => 40M priority is High - - bConnected = TRUE; - } - } -#endif - ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_PRICCA, ODM_DBG_LOUD, ("bConnected=%d\n", bConnected)); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_PRICCA, ODM_DBG_LOUD, ("Is Client 40MHz=%d\n", Client_40MHz)); - //1 Monitor whether the interference exists or not - if(PrimaryCCA->Monitor_flag == 1) - { - if(SecCHOffset == 1) // secondary channel is below the primary channel - { - if((FalseAlmCnt->Cnt_OFDM_CCA > 500)&&(FalseAlmCnt->Cnt_BW_LSC > FalseAlmCnt->Cnt_BW_USC+500)) - { - if(FalseAlmCnt->Cnt_Ofdm_fail > FalseAlmCnt->Cnt_OFDM_CCA>>1) - { - PrimaryCCA->intf_type = 1; - PrimaryCCA->PriCCA_flag = 1; - ODM_SetBBReg(pDM_Odm, 0xc6c, BIT8|BIT7, 2); // USC MF - if(PrimaryCCA->DupRTS_flag == 1) - PrimaryCCA->DupRTS_flag = 0; - } - else - { - PrimaryCCA->intf_type = 2; - if(PrimaryCCA->DupRTS_flag == 0) - PrimaryCCA->DupRTS_flag = 1; - } - - } - else // interferecne disappear - { - PrimaryCCA->DupRTS_flag = 0; - PrimaryCCA->intf_flag = 0; - PrimaryCCA->intf_type = 0; - } - } - else if(SecCHOffset == 2) // secondary channel is above the primary channel - { - if((FalseAlmCnt->Cnt_OFDM_CCA > 500)&&(FalseAlmCnt->Cnt_BW_USC > FalseAlmCnt->Cnt_BW_LSC+500)) - { - if(FalseAlmCnt->Cnt_Ofdm_fail > FalseAlmCnt->Cnt_OFDM_CCA>>1) - { - PrimaryCCA->intf_type = 1; - PrimaryCCA->PriCCA_flag = 1; - ODM_SetBBReg(pDM_Odm, 0xc6c, BIT8|BIT7, 1); // LSC MF - if(PrimaryCCA->DupRTS_flag == 1) - PrimaryCCA->DupRTS_flag = 0; - } - else - { - PrimaryCCA->intf_type = 2; - if(PrimaryCCA->DupRTS_flag == 0) - PrimaryCCA->DupRTS_flag = 1; - } - - } - else // interferecne disappear - { - PrimaryCCA->DupRTS_flag = 0; - PrimaryCCA->intf_flag = 0; - PrimaryCCA->intf_type = 0; - } - - - } - PrimaryCCA->Monitor_flag = 0; - } - - //1 Dynamic Primary CCA Main Function - if(PrimaryCCA->Monitor_flag == 0) - { - if(Is40MHz) // if RFBW==40M mode which require to process primary cca - { - //2 STA is NOT Connected - if(!bConnected) - { - ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_PRICCA, ODM_DBG_LOUD, ("STA NOT Connected!!!!\n")); - - if(PrimaryCCA->PriCCA_flag == 1) // reset primary cca when STA is disconnected - { - PrimaryCCA->PriCCA_flag = 0; - ODM_SetBBReg(pDM_Odm, 0xc6c, BIT8|BIT7, 0); - } - if(PrimaryCCA->DupRTS_flag == 1) // reset Duplicate RTS when STA is disconnected - PrimaryCCA->DupRTS_flag = 0; - - if(SecCHOffset == 1) // secondary channel is below the primary channel - { - if((FalseAlmCnt->Cnt_OFDM_CCA > 800)&&(FalseAlmCnt->Cnt_BW_LSC*5 > FalseAlmCnt->Cnt_BW_USC*9)) - { - PrimaryCCA->intf_flag = 1; // secondary channel interference is detected!!! - if(FalseAlmCnt->Cnt_Ofdm_fail > FalseAlmCnt->Cnt_OFDM_CCA>>1) - PrimaryCCA->intf_type = 1; // interference is shift - else - PrimaryCCA->intf_type = 2; // interference is in-band - } - else - { - PrimaryCCA->intf_flag = 0; - PrimaryCCA->intf_type = 0; - } - } - else if(SecCHOffset == 2) // secondary channel is above the primary channel - { - if((FalseAlmCnt->Cnt_OFDM_CCA > 800)&&(FalseAlmCnt->Cnt_BW_USC*5 > FalseAlmCnt->Cnt_BW_LSC*9)) - { - PrimaryCCA->intf_flag = 1; // secondary channel interference is detected!!! - if(FalseAlmCnt->Cnt_Ofdm_fail > FalseAlmCnt->Cnt_OFDM_CCA>>1) - PrimaryCCA->intf_type = 1; // interference is shift - else - PrimaryCCA->intf_type = 2; // interference is in-band - } - else - { - PrimaryCCA->intf_flag = 0; - PrimaryCCA->intf_type = 0; - } - } - ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_PRICCA, ODM_DBG_LOUD, ("PrimaryCCA=%d\n",PrimaryCCA->PriCCA_flag)); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_PRICCA, ODM_DBG_LOUD, ("Intf_Type=%d\n", PrimaryCCA->intf_type)); - } - //2 STA is Connected - else - { - if(Client_40MHz == 0) //3 // client BW = 20MHz - { - if(PrimaryCCA->PriCCA_flag == 0) - { - PrimaryCCA->PriCCA_flag = 1; - if(SecCHOffset==1) - ODM_SetBBReg(pDM_Odm, 0xc6c, BIT8|BIT7, 2); - else if(SecCHOffset==2) - ODM_SetBBReg(pDM_Odm, 0xc6c, BIT8|BIT7, 1); - } - ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_PRICCA, ODM_DBG_LOUD, ("STA Connected 20M!!! PrimaryCCA=%d\n", PrimaryCCA->PriCCA_flag)); - } - else //3 // client BW = 40MHz - { - if(PrimaryCCA->intf_flag == 1) // interference is detected!! - { - if(PrimaryCCA->intf_type == 1) - { - if(PrimaryCCA->PriCCA_flag!=1) - { - PrimaryCCA->PriCCA_flag = 1; - if(SecCHOffset==1) - ODM_SetBBReg(pDM_Odm, 0xc6c, BIT8|BIT7, 2); - else if(SecCHOffset==2) - ODM_SetBBReg(pDM_Odm, 0xc6c, BIT8|BIT7, 1); - } - } - else if(PrimaryCCA->intf_type == 2) - { - if(PrimaryCCA->DupRTS_flag!=1) - PrimaryCCA->DupRTS_flag = 1; - } - } - else // if intf_flag==0 - { - if((curTxOkCnt+curRxOkCnt)<10000) //idle mode or TP traffic is very low - { - if(SecCHOffset == 1) - { - if((FalseAlmCnt->Cnt_OFDM_CCA > 800)&&(FalseAlmCnt->Cnt_BW_LSC*5 > FalseAlmCnt->Cnt_BW_USC*9)) - { - PrimaryCCA->intf_flag = 1; - if(FalseAlmCnt->Cnt_Ofdm_fail > FalseAlmCnt->Cnt_OFDM_CCA>>1) - PrimaryCCA->intf_type = 1; // interference is shift - else - PrimaryCCA->intf_type = 2; // interference is in-band - } - } - else if(SecCHOffset == 2) - { - if((FalseAlmCnt->Cnt_OFDM_CCA > 800)&&(FalseAlmCnt->Cnt_BW_USC*5 > FalseAlmCnt->Cnt_BW_LSC*9)) - { - PrimaryCCA->intf_flag = 1; - if(FalseAlmCnt->Cnt_Ofdm_fail > FalseAlmCnt->Cnt_OFDM_CCA>>1) - PrimaryCCA->intf_type = 1; // interference is shift - else - PrimaryCCA->intf_type = 2; // interference is in-band - } - - } - } - else // TP Traffic is High - { - if(SecCHOffset == 1) - { - if(FalseAlmCnt->Cnt_BW_LSC > (FalseAlmCnt->Cnt_BW_USC+500)) - { - if(Delay == 0) // add delay to avoid interference occurring abruptly, jump one time - { - PrimaryCCA->intf_flag = 1; - if(FalseAlmCnt->Cnt_Ofdm_fail > FalseAlmCnt->Cnt_OFDM_CCA>>1) - PrimaryCCA->intf_type = 1; // interference is shift - else - PrimaryCCA->intf_type = 2; // interference is in-band - Delay = 1; - } - else - Delay = 0; - } - } - else if(SecCHOffset == 2) - { - if(FalseAlmCnt->Cnt_BW_USC > (FalseAlmCnt->Cnt_BW_LSC+500)) - { - if(Delay == 0) // add delay to avoid interference occurring abruptly - { - PrimaryCCA->intf_flag = 1; - if(FalseAlmCnt->Cnt_Ofdm_fail > FalseAlmCnt->Cnt_OFDM_CCA>>1) - PrimaryCCA->intf_type = 1; // interference is shift - else - PrimaryCCA->intf_type = 2; // interference is in-band - Delay = 1; - } - else - Delay = 0; - } - } - } - } - ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_PRICCA, ODM_DBG_LOUD, ("Primary CCA=%d\n", PrimaryCCA->PriCCA_flag)); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_PRICCA, ODM_DBG_LOUD, ("Duplicate RTS=%d\n", PrimaryCCA->DupRTS_flag)); - } - - }// end of connected - } - } - //1 Dynamic Primary CCA Monitor Counter - if((PrimaryCCA->PriCCA_flag == 1)||(PrimaryCCA->DupRTS_flag == 1)) - { - if(Client_40MHz == 0) // client=20M no need to monitor primary cca flag - { - Client_40MHz_pre = Client_40MHz; - return; - } - Counter++; - ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_PRICCA, ODM_DBG_LOUD, ("Counter=%d\n", Counter)); - if((Counter == 30)||((Client_40MHz -Client_40MHz_pre)==1)) // Every 60 sec to monitor one time - { - PrimaryCCA->Monitor_flag = 1; // monitor flag is triggered!!!!! - if(PrimaryCCA->PriCCA_flag == 1) - { - PrimaryCCA->PriCCA_flag = 0; - ODM_SetBBReg(pDM_Odm, 0xc6c, BIT8|BIT7, 0); - } - Counter = 0; - } - } - } - - Client_40MHz_pre = Client_40MHz; -} -#else //#if (RTL8188E_SUPPORT == 1) -VOID -ODM_UpdateRxIdleAnt_88E(IN PDM_ODM_T pDM_Odm, IN u1Byte Ant) -{ -} -VOID -odm_PrimaryCCA_Init( - IN PDM_ODM_T pDM_Odm) -{ -} -VOID -odm_DynamicPrimaryCCA( - IN PDM_ODM_T pDM_Odm - ) -{ -} -BOOLEAN -ODM_DynamicPrimaryCCA_DupRTS( - IN PDM_ODM_T pDM_Odm - ) -{ - return FALSE; -} -#endif //#if (RTL8188E_SUPPORT == 1) - +/****************************************************************************** + * + * 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 + * + * + ******************************************************************************/ + +//============================================================ +// include files +//============================================================ + +#include "odm_precomp.h" + +#if (RTL8188E_SUPPORT == 1) + +VOID +ODM_DIG_LowerBound_88E( + IN PDM_ODM_T pDM_Odm +) +{ + pDIG_T pDM_DigTable = &pDM_Odm->DM_DigTable; + + if(pDM_Odm->AntDivType == CG_TRX_HW_ANTDIV) + { + pDM_DigTable->rx_gain_range_min = (u1Byte) pDM_DigTable->AntDiv_RSSI_max; + ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("ODM_DIG_LowerBound_88E(): pDM_DigTable->AntDiv_RSSI_max=%d \n",pDM_DigTable->AntDiv_RSSI_max)); + } + //If only one Entry connected + + + +} + +#if(defined(CONFIG_HW_ANTENNA_DIVERSITY)) +VOID +odm_RX_HWAntDivInit( + IN PDM_ODM_T pDM_Odm +) +{ + u4Byte value32; + struct adapter * Adapter = pDM_Odm->Adapter; + #if (MP_DRIVER == 1) + if (*(pDM_Odm->mp_mode) == 1) + { + pDM_Odm->AntDivType = CGCS_RX_SW_ANTDIV; + ODM_SetBBReg(pDM_Odm, ODM_REG_IGI_A_11N , BIT7, 0); // disable HW AntDiv + ODM_SetBBReg(pDM_Odm, ODM_REG_LNA_SWITCH_11N , BIT31, 1); // 1:CG, 0:CS + return; + } + #endif + ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("odm_RX_HWAntDivInit() \n")); + + //MAC Setting + value32 = ODM_GetMACReg(pDM_Odm, ODM_REG_ANTSEL_PIN_11N, bMaskDWord); + ODM_SetMACReg(pDM_Odm, ODM_REG_ANTSEL_PIN_11N, bMaskDWord, value32|(BIT23|BIT25)); //Reg4C[25]=1, Reg4C[23]=1 for pin output + //Pin Settings + ODM_SetBBReg(pDM_Odm, ODM_REG_PIN_CTRL_11N , BIT9|BIT8, 0);//Reg870[8]=1'b0, Reg870[9]=1'b0 //antsel antselb by HW + ODM_SetBBReg(pDM_Odm, ODM_REG_RX_ANT_CTRL_11N , BIT10, 0); //Reg864[10]=1'b0 //antsel2 by HW + ODM_SetBBReg(pDM_Odm, ODM_REG_LNA_SWITCH_11N , BIT22, 1); //Regb2c[22]=1'b0 //disable CS/CG switch + ODM_SetBBReg(pDM_Odm, ODM_REG_LNA_SWITCH_11N , BIT31, 1); //Regb2c[31]=1'b1 //output at CG only + //OFDM Settings + ODM_SetBBReg(pDM_Odm, ODM_REG_ANTDIV_PARA1_11N , bMaskDWord, 0x000000a0); + //CCK Settings + ODM_SetBBReg(pDM_Odm, ODM_REG_BB_PWR_SAV4_11N , BIT7, 1); //Fix CCK PHY status report issue + ODM_SetBBReg(pDM_Odm, ODM_REG_CCK_ANTDIV_PARA2_11N , BIT4, 1); //CCK complete HW AntDiv within 64 samples + ODM_UpdateRxIdleAnt_88E(pDM_Odm, MAIN_ANT); + ODM_SetBBReg(pDM_Odm, ODM_REG_ANT_MAPPING1_11N , 0xFFFF, 0x0201); //antenna mapping table + + //ODM_SetBBReg(pDM_Odm, 0xc50 , BIT7, 1); //Enable HW AntDiv + //ODM_SetBBReg(pDM_Odm, 0xa00 , BIT15, 1); //Enable CCK AntDiv +} + +VOID +odm_TRX_HWAntDivInit( + IN PDM_ODM_T pDM_Odm +) +{ + u4Byte value32; + struct adapter * Adapter = pDM_Odm->Adapter; + + #if (MP_DRIVER == 1) + if (*(pDM_Odm->mp_mode) == 1) + { + pDM_Odm->AntDivType = CGCS_RX_SW_ANTDIV; + ODM_SetBBReg(pDM_Odm, ODM_REG_IGI_A_11N , BIT7, 0); // disable HW AntDiv + ODM_SetBBReg(pDM_Odm, ODM_REG_RX_ANT_CTRL_11N , BIT5|BIT4|BIT3, 0); //Default RX (0/1) + return; + } + + #endif + + ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("odm_TRX_HWAntDivInit() \n")); + + //MAC Setting + value32 = ODM_GetMACReg(pDM_Odm, ODM_REG_ANTSEL_PIN_11N, bMaskDWord); + ODM_SetMACReg(pDM_Odm, ODM_REG_ANTSEL_PIN_11N, bMaskDWord, value32|(BIT23|BIT25)); //Reg4C[25]=1, Reg4C[23]=1 for pin output + //Pin Settings + ODM_SetBBReg(pDM_Odm, ODM_REG_PIN_CTRL_11N , BIT9|BIT8, 0);//Reg870[8]=1'b0, Reg870[9]=1'b0 //antsel antselb by HW + ODM_SetBBReg(pDM_Odm, ODM_REG_RX_ANT_CTRL_11N , BIT10, 0); //Reg864[10]=1'b0 //antsel2 by HW + ODM_SetBBReg(pDM_Odm, ODM_REG_LNA_SWITCH_11N , BIT22, 0); //Regb2c[22]=1'b0 //disable CS/CG switch + ODM_SetBBReg(pDM_Odm, ODM_REG_LNA_SWITCH_11N , BIT31, 1); //Regb2c[31]=1'b1 //output at CG only + //OFDM Settings + ODM_SetBBReg(pDM_Odm, ODM_REG_ANTDIV_PARA1_11N , bMaskDWord, 0x000000a0); + //CCK Settings + ODM_SetBBReg(pDM_Odm, ODM_REG_BB_PWR_SAV4_11N , BIT7, 1); //Fix CCK PHY status report issue + ODM_SetBBReg(pDM_Odm, ODM_REG_CCK_ANTDIV_PARA2_11N , BIT4, 1); //CCK complete HW AntDiv within 64 samples + //Tx Settings + ODM_SetBBReg(pDM_Odm, ODM_REG_TX_ANT_CTRL_11N , BIT21, 0); //Reg80c[21]=1'b0 //from TX Reg + ODM_UpdateRxIdleAnt_88E(pDM_Odm, MAIN_ANT); + + //antenna mapping table + if(!pDM_Odm->bIsMPChip) //testchip + { + ODM_SetBBReg(pDM_Odm, ODM_REG_RX_DEFUALT_A_11N , BIT10|BIT9|BIT8, 1); //Reg858[10:8]=3'b001 + ODM_SetBBReg(pDM_Odm, ODM_REG_RX_DEFUALT_A_11N , BIT13|BIT12|BIT11, 2); //Reg858[13:11]=3'b010 + } + else //MPchip + ODM_SetBBReg(pDM_Odm, ODM_REG_ANT_MAPPING1_11N , bMaskDWord, 0x0201); //Reg914=3'b010, Reg915=3'b001 + + //ODM_SetBBReg(pDM_Odm, 0xc50 , BIT7, 1); //Enable HW AntDiv + //ODM_SetBBReg(pDM_Odm, 0xa00 , BIT15, 1); //Enable CCK AntDiv +} + +VOID +odm_FastAntTrainingInit( + IN PDM_ODM_T pDM_Odm +) +{ + u4Byte value32, i; + pFAT_T pDM_FatTable = &pDM_Odm->DM_FatTable; + u4Byte AntCombination = 2; + struct adapter * Adapter = pDM_Odm->Adapter; + ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("odm_FastAntTrainingInit() \n")); + +#if (MP_DRIVER == 1) + if (*(pDM_Odm->mp_mode) == 1) + { + ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_LOUD, ("pDM_Odm->AntDivType: %d\n", pDM_Odm->AntDivType)); + return; + } +#endif + + for(i=0; i<6; i++) + { + pDM_FatTable->Bssid[i] = 0; + pDM_FatTable->antSumRSSI[i] = 0; + pDM_FatTable->antRSSIcnt[i] = 0; + pDM_FatTable->antAveRSSI[i] = 0; + } + pDM_FatTable->TrainIdx = 0; + pDM_FatTable->FAT_State = FAT_NORMAL_STATE; + + //MAC Setting + value32 = ODM_GetMACReg(pDM_Odm, 0x4c, bMaskDWord); + ODM_SetMACReg(pDM_Odm, 0x4c, bMaskDWord, value32|(BIT23|BIT25)); //Reg4C[25]=1, Reg4C[23]=1 for pin output + value32 = ODM_GetMACReg(pDM_Odm, 0x7B4, bMaskDWord); + ODM_SetMACReg(pDM_Odm, 0x7b4, bMaskDWord, value32|(BIT16|BIT17)); //Reg7B4[16]=1 enable antenna training, Reg7B4[17]=1 enable A2 match + //value32 = PlatformEFIORead4Byte(Adapter, 0x7B4); + //PlatformEFIOWrite4Byte(Adapter, 0x7b4, value32|BIT18); //append MACID in reponse packet + + //Match MAC ADDR + ODM_SetMACReg(pDM_Odm, 0x7b4, 0xFFFF, 0); + ODM_SetMACReg(pDM_Odm, 0x7b0, bMaskDWord, 0); + + ODM_SetBBReg(pDM_Odm, 0x870 , BIT9|BIT8, 0);//Reg870[8]=1'b0, Reg870[9]=1'b0 //antsel antselb by HW + ODM_SetBBReg(pDM_Odm, 0x864 , BIT10, 0); //Reg864[10]=1'b0 //antsel2 by HW + ODM_SetBBReg(pDM_Odm, 0xb2c , BIT22, 0); //Regb2c[22]=1'b0 //disable CS/CG switch + ODM_SetBBReg(pDM_Odm, 0xb2c , BIT31, 1); //Regb2c[31]=1'b1 //output at CG only + ODM_SetBBReg(pDM_Odm, 0xca4 , bMaskDWord, 0x000000a0); + + //antenna mapping table + if(AntCombination == 2) + { + if(!pDM_Odm->bIsMPChip) //testchip + { + ODM_SetBBReg(pDM_Odm, 0x858 , BIT10|BIT9|BIT8, 1); //Reg858[10:8]=3'b001 + ODM_SetBBReg(pDM_Odm, 0x858 , BIT13|BIT12|BIT11, 2); //Reg858[13:11]=3'b010 + } + else //MPchip + { + ODM_SetBBReg(pDM_Odm, 0x914 , bMaskByte0, 1); + ODM_SetBBReg(pDM_Odm, 0x914 , bMaskByte1, 2); + } + } + else if(AntCombination == 7) + { + if(!pDM_Odm->bIsMPChip) //testchip + { + ODM_SetBBReg(pDM_Odm, 0x858 , BIT10|BIT9|BIT8, 0); //Reg858[10:8]=3'b000 + ODM_SetBBReg(pDM_Odm, 0x858 , BIT13|BIT12|BIT11, 1); //Reg858[13:11]=3'b001 + ODM_SetBBReg(pDM_Odm, 0x878 , BIT16, 0); + ODM_SetBBReg(pDM_Odm, 0x858 , BIT15|BIT14, 2); //(Reg878[0],Reg858[14:15])=3'b010 + ODM_SetBBReg(pDM_Odm, 0x878 , BIT19|BIT18|BIT17, 3);//Reg878[3:1]=3b'011 + ODM_SetBBReg(pDM_Odm, 0x878 , BIT22|BIT21|BIT20, 4);//Reg878[6:4]=3b'100 + ODM_SetBBReg(pDM_Odm, 0x878 , BIT25|BIT24|BIT23, 5);//Reg878[9:7]=3b'101 + ODM_SetBBReg(pDM_Odm, 0x878 , BIT28|BIT27|BIT26, 6);//Reg878[12:10]=3b'110 + ODM_SetBBReg(pDM_Odm, 0x878 , BIT31|BIT30|BIT29, 7);//Reg878[15:13]=3b'111 + } + else //MPchip + { + ODM_SetBBReg(pDM_Odm, 0x914 , bMaskByte0, 0); + ODM_SetBBReg(pDM_Odm, 0x914 , bMaskByte1, 1); + ODM_SetBBReg(pDM_Odm, 0x914 , bMaskByte2, 2); + ODM_SetBBReg(pDM_Odm, 0x914 , bMaskByte3, 3); + ODM_SetBBReg(pDM_Odm, 0x918 , bMaskByte0, 4); + ODM_SetBBReg(pDM_Odm, 0x918 , bMaskByte1, 5); + ODM_SetBBReg(pDM_Odm, 0x918 , bMaskByte2, 6); + ODM_SetBBReg(pDM_Odm, 0x918 , bMaskByte3, 7); + } + } + + //Default Ant Setting when no fast training + ODM_SetBBReg(pDM_Odm, 0x80c , BIT21, 1); //Reg80c[21]=1'b1 //from TX Info + ODM_SetBBReg(pDM_Odm, 0x864 , BIT5|BIT4|BIT3, 0); //Default RX + ODM_SetBBReg(pDM_Odm, 0x864 , BIT8|BIT7|BIT6, 1); //Optional RX + //ODM_SetBBReg(pDM_Odm, 0x860 , BIT14|BIT13|BIT12, 1); //Default TX + + //Enter Traing state + ODM_SetBBReg(pDM_Odm, 0x864 , BIT2|BIT1|BIT0, (AntCombination-1)); //Reg864[2:0]=3'd6 //ant combination=reg864[2:0]+1 + //ODM_SetBBReg(pDM_Odm, 0xc50 , BIT7, 0); //RegC50[7]=1'b0 //disable HW AntDiv + //ODM_SetBBReg(pDM_Odm, 0xe08 , BIT16, 0); //RegE08[16]=1'b0 //disable fast training + //ODM_SetBBReg(pDM_Odm, 0xe08 , BIT16, 1); //RegE08[16]=1'b1 //enable fast training + ODM_SetBBReg(pDM_Odm, 0xc50 , BIT7, 1); //RegC50[7]=1'b1 //enable HW AntDiv + + + //SW Control + //PHY_SetBBReg(Adapter, 0x864 , BIT10, 1); + //PHY_SetBBReg(Adapter, 0x870 , BIT9, 1); + //PHY_SetBBReg(Adapter, 0x870 , BIT8, 1); + //PHY_SetBBReg(Adapter, 0x864 , BIT11, 1); + //PHY_SetBBReg(Adapter, 0x860 , BIT9, 0); + //PHY_SetBBReg(Adapter, 0x860 , BIT8, 0); +} + +VOID +ODM_AntennaDiversityInit_88E( + IN PDM_ODM_T pDM_Odm +) +{ +/* + //2012.03.27 LukeLee: For temp use, should be removed later + //pDM_Odm->AntDivType = CG_TRX_HW_ANTDIV; + //{ + struct adapter * Adapter = pDM_Odm->Adapter; + HAL_DATA_TYPE* pHalData = GET_HAL_DATA(Adapter); + //pHalData->AntDivCfg = 1; + //} +*/ + if(pDM_Odm->SupportICType != ODM_RTL8188E) + return; + + //ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("pDM_Odm->AntDivType=%d, pHalData->AntDivCfg=%d\n", + // pDM_Odm->AntDivType, pHalData->AntDivCfg)); + ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("pDM_Odm->AntDivType=%d\n",pDM_Odm->AntDivType)); + ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("pDM_Odm->bIsMPChip=%s\n",(pDM_Odm->bIsMPChip?"TRUE":"FALSE"))); + + if(pDM_Odm->AntDivType == CGCS_RX_HW_ANTDIV) + odm_RX_HWAntDivInit(pDM_Odm); + else if(pDM_Odm->AntDivType == CG_TRX_HW_ANTDIV) + odm_TRX_HWAntDivInit(pDM_Odm); + else if(pDM_Odm->AntDivType == CG_TRX_SMART_ANTDIV) + odm_FastAntTrainingInit(pDM_Odm); +} + + +VOID +ODM_UpdateRxIdleAnt_88E(IN PDM_ODM_T pDM_Odm, IN u1Byte Ant) +{ + pFAT_T pDM_FatTable = &pDM_Odm->DM_FatTable; + u4Byte DefaultAnt, OptionalAnt; + + if(pDM_FatTable->RxIdleAnt != Ant) + { + ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("Need to Update Rx Idle Ant\n")); + if(Ant == MAIN_ANT) + { + DefaultAnt = (pDM_Odm->AntDivType == CG_TRX_HW_ANTDIV)?MAIN_ANT_CG_TRX:MAIN_ANT_CGCS_RX; + OptionalAnt = (pDM_Odm->AntDivType == CG_TRX_HW_ANTDIV)?AUX_ANT_CG_TRX:AUX_ANT_CGCS_RX; + } + else + { + DefaultAnt = (pDM_Odm->AntDivType == CG_TRX_HW_ANTDIV)?AUX_ANT_CG_TRX:AUX_ANT_CGCS_RX; + OptionalAnt = (pDM_Odm->AntDivType == CG_TRX_HW_ANTDIV)?MAIN_ANT_CG_TRX:MAIN_ANT_CGCS_RX; + } + + if(pDM_Odm->AntDivType == CG_TRX_HW_ANTDIV) + { + ODM_SetBBReg(pDM_Odm, ODM_REG_RX_ANT_CTRL_11N , BIT5|BIT4|BIT3, DefaultAnt); //Default RX + ODM_SetBBReg(pDM_Odm, ODM_REG_RX_ANT_CTRL_11N , BIT8|BIT7|BIT6, OptionalAnt); //Optional RX + ODM_SetBBReg(pDM_Odm, ODM_REG_ANTSEL_CTRL_11N , BIT14|BIT13|BIT12, DefaultAnt); //Default TX + ODM_SetMACReg(pDM_Odm, ODM_REG_RESP_TX_11N , BIT6|BIT7, DefaultAnt); //Resp Tx + + } + else if(pDM_Odm->AntDivType == CGCS_RX_HW_ANTDIV) + { + ODM_SetBBReg(pDM_Odm, ODM_REG_RX_ANT_CTRL_11N , BIT5|BIT4|BIT3, DefaultAnt); //Default RX + ODM_SetBBReg(pDM_Odm, ODM_REG_RX_ANT_CTRL_11N , BIT8|BIT7|BIT6, OptionalAnt); //Optional RX + } + } + pDM_FatTable->RxIdleAnt = Ant; + ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("RxIdleAnt=%s\n",(Ant==MAIN_ANT)?"MAIN_ANT":"AUX_ANT")); + printk("RxIdleAnt=%s\n",(Ant==MAIN_ANT)?"MAIN_ANT":"AUX_ANT"); +} + + +VOID +odm_UpdateTxAnt_88E(IN PDM_ODM_T pDM_Odm, IN u1Byte Ant, IN u4Byte MacId) +{ + pFAT_T pDM_FatTable = &pDM_Odm->DM_FatTable; + u1Byte TargetAnt; + + if(Ant == MAIN_ANT) + TargetAnt = MAIN_ANT_CG_TRX; + else + TargetAnt = AUX_ANT_CG_TRX; + + pDM_FatTable->antsel_a[MacId] = TargetAnt&BIT0; + pDM_FatTable->antsel_b[MacId] = (TargetAnt&BIT1)>>1; + pDM_FatTable->antsel_c[MacId] = (TargetAnt&BIT2)>>2; + + ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("Tx from TxInfo, TargetAnt=%s\n", + (Ant==MAIN_ANT)?"MAIN_ANT":"AUX_ANT")); + ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD,("antsel_tr_mux=3'b%d%d%d\n", + pDM_FatTable->antsel_c[MacId] , pDM_FatTable->antsel_b[MacId] , pDM_FatTable->antsel_a[MacId] )); +} + +#if (DM_ODM_SUPPORT_TYPE & (ODM_MP|ODM_CE)) +VOID +ODM_SetTxAntByTxInfo_88E( + IN PDM_ODM_T pDM_Odm, + IN pu1Byte pDesc, + IN u1Byte macId + ) +{ + pFAT_T pDM_FatTable = &pDM_Odm->DM_FatTable; + + if((pDM_Odm->AntDivType == CG_TRX_HW_ANTDIV)||(pDM_Odm->AntDivType == CG_TRX_SMART_ANTDIV)) + { + SET_TX_DESC_ANTSEL_A_88E(pDesc, pDM_FatTable->antsel_a[macId]); + SET_TX_DESC_ANTSEL_B_88E(pDesc, pDM_FatTable->antsel_b[macId]); + SET_TX_DESC_ANTSEL_C_88E(pDesc, pDM_FatTable->antsel_c[macId]); + //ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("ODM_SetTxAntByTxInfo_88E_WIN(): MacID=%d, antsel_tr_mux=3'b%d%d%d\n", + // macId, pDM_FatTable->antsel_c[macId], pDM_FatTable->antsel_b[macId], pDM_FatTable->antsel_a[macId])); + } +} +#else// (DM_ODM_SUPPORT_TYPE == ODM_AP) +VOID +ODM_SetTxAntByTxInfo_88E( + IN PDM_ODM_T pDM_Odm + ) +{ +} +#endif + +VOID +ODM_AntselStatistics_88E( + IN PDM_ODM_T pDM_Odm, + IN u1Byte antsel_tr_mux, + IN u4Byte MacId, + IN u1Byte RxPWDBAll +) +{ + pFAT_T pDM_FatTable = &pDM_Odm->DM_FatTable; + if(pDM_Odm->AntDivType == CG_TRX_HW_ANTDIV) + { + if(antsel_tr_mux == MAIN_ANT_CG_TRX) + { + + pDM_FatTable->MainAnt_Sum[MacId]+=RxPWDBAll; + pDM_FatTable->MainAnt_Cnt[MacId]++; + } + else + { + pDM_FatTable->AuxAnt_Sum[MacId]+=RxPWDBAll; + pDM_FatTable->AuxAnt_Cnt[MacId]++; + + } + } + else if(pDM_Odm->AntDivType == CGCS_RX_HW_ANTDIV) + { + if(antsel_tr_mux == MAIN_ANT_CGCS_RX) + { + + pDM_FatTable->MainAnt_Sum[MacId]+=RxPWDBAll; + pDM_FatTable->MainAnt_Cnt[MacId]++; + } + else + { + pDM_FatTable->AuxAnt_Sum[MacId]+=RxPWDBAll; + pDM_FatTable->AuxAnt_Cnt[MacId]++; + + } + } +} + +#define TX_BY_REG 0 +VOID +odm_HWAntDiv( + IN PDM_ODM_T pDM_Odm +) +{ + u4Byte i, MinRSSI=0xFF, AntDivMaxRSSI=0, MaxRSSI=0, LocalMinRSSI, LocalMaxRSSI; + u4Byte Main_RSSI, Aux_RSSI; + u1Byte RxIdleAnt=0, TargetAnt=7; + pFAT_T pDM_FatTable = &pDM_Odm->DM_FatTable; + pDIG_T pDM_DigTable = &pDM_Odm->DM_DigTable; + BOOLEAN bMatchBSSID; + BOOLEAN bPktFilterMacth = FALSE; + PSTA_INFO_T pEntry; + + for (i=0; ipODM_StaInfo[i]; + if(IS_STA_VALID(pEntry)) + { + //2 Caculate RSSI per Antenna + Main_RSSI = (pDM_FatTable->MainAnt_Cnt[i]!=0)?(pDM_FatTable->MainAnt_Sum[i]/pDM_FatTable->MainAnt_Cnt[i]):0; + Aux_RSSI = (pDM_FatTable->AuxAnt_Cnt[i]!=0)?(pDM_FatTable->AuxAnt_Sum[i]/pDM_FatTable->AuxAnt_Cnt[i]):0; + TargetAnt = (Main_RSSI>=Aux_RSSI)?MAIN_ANT:AUX_ANT; + ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("MacID=%d, MainAnt_Sum=%d, MainAnt_Cnt=%d\n", i, pDM_FatTable->MainAnt_Sum[i], pDM_FatTable->MainAnt_Cnt[i])); + ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("MacID=%d, AuxAnt_Sum=%d, AuxAnt_Cnt=%d\n",i, pDM_FatTable->AuxAnt_Sum[i], pDM_FatTable->AuxAnt_Cnt[i])); + ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("MacID=%d, Main_RSSI= %d, Aux_RSSI= %d\n", i, Main_RSSI, Aux_RSSI)); + + //2 Select MaxRSSI for DIG + LocalMaxRSSI = (Main_RSSI>Aux_RSSI)?Main_RSSI:Aux_RSSI; + if((LocalMaxRSSI > AntDivMaxRSSI) && (LocalMaxRSSI < 40)) + AntDivMaxRSSI = LocalMaxRSSI; + if(LocalMaxRSSI > MaxRSSI) + MaxRSSI = LocalMaxRSSI; + + //2 Select RX Idle Antenna + if((pDM_FatTable->RxIdleAnt == MAIN_ANT) && (Main_RSSI == 0)) + Main_RSSI = Aux_RSSI; + else if((pDM_FatTable->RxIdleAnt == AUX_ANT) && (Aux_RSSI == 0)) + Aux_RSSI = Main_RSSI; + + LocalMinRSSI = (Main_RSSI>Aux_RSSI)?Aux_RSSI:Main_RSSI; + if(LocalMinRSSI < MinRSSI) + { + MinRSSI = LocalMinRSSI; + RxIdleAnt = TargetAnt; + } +#if TX_BY_REG + +#else + //2 Select TRX Antenna + if(pDM_Odm->AntDivType == CG_TRX_HW_ANTDIV) + odm_UpdateTxAnt_88E(pDM_Odm, TargetAnt, i); +#endif + } + pDM_FatTable->MainAnt_Sum[i] = 0; + pDM_FatTable->AuxAnt_Sum[i] = 0; + pDM_FatTable->MainAnt_Cnt[i] = 0; + pDM_FatTable->AuxAnt_Cnt[i] = 0; + } + + //2 Set RX Idle Antenna + ODM_UpdateRxIdleAnt_88E(pDM_Odm, RxIdleAnt); + + pDM_DigTable->AntDiv_RSSI_max = AntDivMaxRSSI; + pDM_DigTable->RSSI_max = MaxRSSI; +} + + +#if (!(DM_ODM_SUPPORT_TYPE == ODM_CE)) +VOID +odm_SetNextMACAddrTarget( + IN PDM_ODM_T pDM_Odm +) +{ + pFAT_T pDM_FatTable = &pDM_Odm->DM_FatTable; + PSTA_INFO_T pEntry; + //u1Byte Bssid[6]; + u4Byte value32, i; + + // + //2012.03.26 LukeLee: The MAC address is changed according to MACID in turn + // + ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("odm_SetNextMACAddrTarget() ==>\n")); + if(pDM_Odm->bLinked) + { + for (i=0; iTrainIdx+1) == ODM_ASSOCIATE_ENTRY_NUM) + pDM_FatTable->TrainIdx = 0; + else + pDM_FatTable->TrainIdx++; + + pEntry = pDM_Odm->pODM_StaInfo[pDM_FatTable->TrainIdx]; + if(IS_STA_VALID(pEntry)) + { + //Match MAC ADDR +#if (DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL)) + value32 = (pEntry->hwaddr[5]<<8)|pEntry->hwaddr[4]; +#else + value32 = (pEntry->MacAddr[5]<<8)|pEntry->MacAddr[4]; +#endif + ODM_SetMACReg(pDM_Odm, 0x7b4, 0xFFFF, value32); +#if (DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL)) + value32 = (pEntry->hwaddr[3]<<24)|(pEntry->hwaddr[2]<<16) |(pEntry->hwaddr[1]<<8) |pEntry->hwaddr[0]; +#else + value32 = (pEntry->MacAddr[3]<<24)|(pEntry->MacAddr[2]<<16) |(pEntry->MacAddr[1]<<8) |pEntry->MacAddr[0]; +#endif + ODM_SetMACReg(pDM_Odm, 0x7b0, bMaskDWord, value32); + + ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("pDM_FatTable->TrainIdx=%d\n",pDM_FatTable->TrainIdx)); +#if (DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL)) + ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("Training MAC Addr = %x:%x:%x:%x:%x:%x\n", + pEntry->hwaddr[5],pEntry->hwaddr[4],pEntry->hwaddr[3],pEntry->hwaddr[2],pEntry->hwaddr[1],pEntry->hwaddr[0])); +#else + ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("Training MAC Addr = %x:%x:%x:%x:%x:%x\n", + pEntry->MacAddr[5],pEntry->MacAddr[4],pEntry->MacAddr[3],pEntry->MacAddr[2],pEntry->MacAddr[1],pEntry->MacAddr[0])); +#endif + + break; + } + } + + } + +#if 0 + // + //2012.03.26 LukeLee: This should be removed later, the MAC address is changed according to MACID in turn + // + #if( DM_ODM_SUPPORT_TYPE & ODM_MP) + { + struct adapter *Adapter = pDM_Odm->Adapter; + PMGNT_INFO pMgntInfo = &Adapter->MgntInfo; + + for (i=0; i<6; i++) + { + Bssid[i] = pMgntInfo->Bssid[i]; + //DbgPrint("Bssid[%d]=%x\n", i, Bssid[i]); + } + } + #endif + + //odm_SetNextMACAddrTarget(pDM_Odm); + + //1 Select MAC Address Filter + for (i=0; i<6; i++) + { + if(Bssid[i] != pDM_FatTable->Bssid[i]) + { + bMatchBSSID = FALSE; + break; + } + } + if(bMatchBSSID == FALSE) + { + //Match MAC ADDR + value32 = (Bssid[5]<<8)|Bssid[4]; + ODM_SetMACReg(pDM_Odm, 0x7b4, 0xFFFF, value32); + value32 = (Bssid[3]<<24)|(Bssid[2]<<16) |(Bssid[1]<<8) |Bssid[0]; + ODM_SetMACReg(pDM_Odm, 0x7b0, bMaskDWord, value32); + } + + return bMatchBSSID; +#endif + +} + +VOID +odm_FastAntTraining( + IN PDM_ODM_T pDM_Odm +) +{ + u4Byte i, MaxRSSI=0; + u1Byte TargetAnt=2; + pFAT_T pDM_FatTable = &pDM_Odm->DM_FatTable; + BOOLEAN bPktFilterMacth = FALSE; + PSTA_INFO_T pEntry; + + + ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("==>odm_FastAntTraining()\n")); + + //1 TRAINING STATE + if(pDM_FatTable->FAT_State == FAT_TRAINING_STATE) + { + ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("Enter FAT_TRAINING_STATE\n")); + //2 Caculate RSSI per Antenna + for (i=0; i<7; i++) + { + if(pDM_FatTable->antRSSIcnt[i] == 0) + pDM_FatTable->antAveRSSI[i] = 0; + else + { + pDM_FatTable->antAveRSSI[i] = pDM_FatTable->antSumRSSI[i] /pDM_FatTable->antRSSIcnt[i]; + bPktFilterMacth = TRUE; + } + if(pDM_FatTable->antAveRSSI[i] > MaxRSSI) + { + MaxRSSI = pDM_FatTable->antAveRSSI[i]; + TargetAnt = (u1Byte) i; + } + + ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("pDM_FatTable->antAveRSSI[%d] = %d, pDM_FatTable->antRSSIcnt[%d] = %d\n", + i, pDM_FatTable->antAveRSSI[i], i, pDM_FatTable->antRSSIcnt[i])); + } + + //2 Select TRX Antenna + if(bPktFilterMacth == FALSE) + { + ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("None Packet is matched\n")); + + ODM_SetBBReg(pDM_Odm, 0xe08 , BIT16, 0); //RegE08[16]=1'b0 //disable fast training + ODM_SetBBReg(pDM_Odm, 0xc50 , BIT7, 0); //RegC50[7]=1'b0 //disable HW AntDiv + } + else + { + ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("TargetAnt=%d, MaxRSSI=%d\n",TargetAnt,MaxRSSI)); + + ODM_SetBBReg(pDM_Odm, 0xe08 , BIT16, 0); //RegE08[16]=1'b0 //disable fast training + //ODM_SetBBReg(pDM_Odm, 0xc50 , BIT7, 0); //RegC50[7]=1'b0 //disable HW AntDiv + ODM_SetBBReg(pDM_Odm, 0x864 , BIT8|BIT7|BIT6, TargetAnt); //Default RX is Omni, Optional RX is the best decision by FAT + //ODM_SetBBReg(pDM_Odm, 0x860 , BIT14|BIT13|BIT12, TargetAnt); //Default TX + ODM_SetBBReg(pDM_Odm, 0x80c , BIT21, 1); //Reg80c[21]=1'b1 //from TX Info + +#if 0 + pEntry = pDM_Odm->pODM_StaInfo[pDM_FatTable->TrainIdx]; + + if(IS_STA_VALID(pEntry)) + { + pEntry->antsel_a = TargetAnt&BIT0; + pEntry->antsel_b = (TargetAnt&BIT1)>>1; + pEntry->antsel_c = (TargetAnt&BIT2)>>2; + } +#else + pDM_FatTable->antsel_a[pDM_FatTable->TrainIdx] = TargetAnt&BIT0; + pDM_FatTable->antsel_b[pDM_FatTable->TrainIdx] = (TargetAnt&BIT1)>>1; + pDM_FatTable->antsel_c[pDM_FatTable->TrainIdx] = (TargetAnt&BIT2)>>2; +#endif + + + if(TargetAnt == 0) + ODM_SetBBReg(pDM_Odm, 0xc50 , BIT7, 0); //RegC50[7]=1'b0 //disable HW AntDiv + + } + + //2 Reset Counter + for(i=0; i<7; i++) + { + pDM_FatTable->antSumRSSI[i] = 0; + pDM_FatTable->antRSSIcnt[i] = 0; + } + + pDM_FatTable->FAT_State = FAT_NORMAL_STATE; + return; + } + + //1 NORMAL STATE + if(pDM_FatTable->FAT_State == FAT_NORMAL_STATE) + { + ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("Enter FAT_NORMAL_STATE\n")); + + odm_SetNextMACAddrTarget(pDM_Odm); + +#if 0 + pEntry = pDM_Odm->pODM_StaInfo[pDM_FatTable->TrainIdx]; + if(IS_STA_VALID(pEntry)) + { + pEntry->antsel_a = TargetAnt&BIT0; + pEntry->antsel_b = (TargetAnt&BIT1)>>1; + pEntry->antsel_c = (TargetAnt&BIT2)>>2; + } +#endif + + //2 Prepare Training + pDM_FatTable->FAT_State = FAT_TRAINING_STATE; + ODM_SetBBReg(pDM_Odm, 0xe08 , BIT16, 1); //RegE08[16]=1'b1 //enable fast training + ODM_SetBBReg(pDM_Odm, 0xc50 , BIT7, 1); //RegC50[7]=1'b1 //enable HW AntDiv + ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("Start FAT_TRAINING_STATE\n")); + ODM_SetTimer(pDM_Odm,&pDM_Odm->FastAntTrainingTimer, 500 ); //ms + + } + +} + +VOID +odm_FastAntTrainingCallback( + IN PDM_ODM_T pDM_Odm +) +{ + +#if (DM_ODM_SUPPORT_TYPE == ODM_CE) + struct adapter *padapter = pDM_Odm->Adapter; + if(padapter->net_closed == _TRUE) + return; + //if(*pDM_Odm->pbNet_closed == TRUE) + // return; +#endif + +#if USE_WORKITEM + ODM_ScheduleWorkItem(&pDM_Odm->FastAntTrainingWorkitem); +#else + odm_FastAntTraining(pDM_Odm); +#endif +} + +VOID +odm_FastAntTrainingWorkItemCallback( + IN PDM_ODM_T pDM_Odm +) +{ + odm_FastAntTraining(pDM_Odm); +} +#endif + +VOID +ODM_AntennaDiversity_88E( + IN PDM_ODM_T pDM_Odm +) +{ + pFAT_T pDM_FatTable = &pDM_Odm->DM_FatTable; + if((pDM_Odm->SupportICType != ODM_RTL8188E) || (!(pDM_Odm->SupportAbility & ODM_BB_ANT_DIV))) + { + //ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("ODM_AntennaDiversity_88E: Not Support 88E AntDiv\n")); + return; + } +#ifdef CONFIG_SPECIAL_SETTING_FOR_FUNAI_TV + if(pDM_Odm->bLinked){ + if(pDM_Odm->Adapter->registrypriv.force_ant != 0) + { + u4Byte Main_RSSI, Aux_RSSI; + u8 i=0; + Main_RSSI = (pDM_FatTable->MainAnt_Cnt[i]!=0)?(pDM_FatTable->MainAnt_Sum[i]/pDM_FatTable->MainAnt_Cnt[i]):0; + Aux_RSSI = (pDM_FatTable->AuxAnt_Cnt[i]!=0)?(pDM_FatTable->AuxAnt_Sum[i]/pDM_FatTable->AuxAnt_Cnt[i]):0; + + ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("MacID=%d, MainAnt_Sum=%d, MainAnt_Cnt=%d\n", i, pDM_FatTable->MainAnt_Sum[i], pDM_FatTable->MainAnt_Cnt[i])); + ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("MacID=%d, AuxAnt_Sum=%d, AuxAnt_Cnt=%d\n",i, pDM_FatTable->AuxAnt_Sum[i], pDM_FatTable->AuxAnt_Cnt[i])); + ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("MacID=%d, Main_RSSI= %d, Aux_RSSI= %d\n", i, Main_RSSI, Aux_RSSI)); + pDM_FatTable->MainAnt_Sum[i] = 0; + pDM_FatTable->AuxAnt_Sum[i] = 0; + pDM_FatTable->MainAnt_Cnt[i] = 0; + pDM_FatTable->AuxAnt_Cnt[i] = 0; + } + if(pDM_Odm->Adapter->registrypriv.force_ant==1){ + ODM_UpdateRxIdleAnt_88E(pDM_Odm, MAIN_ANT); + printk("%s fixed antenna in Main ant\n",__FUNCTION__); + return; + } + else if(pDM_Odm->Adapter->registrypriv.force_ant==2){ + ODM_UpdateRxIdleAnt_88E(pDM_Odm, AUX_ANT); + printk("%s fixed antenna in AUX ant\n",__FUNCTION__); + return; + } + } +#endif + + + + if(!pDM_Odm->bLinked) + { + ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("ODM_AntennaDiversity_88E(): No Link.\n")); + if(pDM_FatTable->bBecomeLinked == TRUE) + { + ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("Need to Turn off HW AntDiv\n")); + ODM_SetBBReg(pDM_Odm, ODM_REG_IGI_A_11N , BIT7, 0); //RegC50[7]=1'b1 //enable HW AntDiv + ODM_SetBBReg(pDM_Odm, ODM_REG_CCK_ANTDIV_PARA1_11N , BIT15, 0); //Enable CCK AntDiv + if(pDM_Odm->AntDivType == CG_TRX_HW_ANTDIV) + ODM_SetBBReg(pDM_Odm, ODM_REG_TX_ANT_CTRL_11N , BIT21, 0); //Reg80c[21]=1'b0 //from TX Reg + pDM_FatTable->bBecomeLinked = pDM_Odm->bLinked; + } + return; + } + else + { + if(pDM_FatTable->bBecomeLinked ==FALSE) + { + ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("Need to Turn on HW AntDiv\n")); + //Because HW AntDiv is disabled before Link, we enable HW AntDiv after link + ODM_SetBBReg(pDM_Odm, ODM_REG_IGI_A_11N , BIT7, 1); //RegC50[7]=1'b1 //enable HW AntDiv + ODM_SetBBReg(pDM_Odm, ODM_REG_CCK_ANTDIV_PARA1_11N , BIT15, 1); //Enable CCK AntDiv + //ODM_SetMACReg(pDM_Odm, 0x7B4 , BIT18, 1); //Response Tx by current HW antdiv + if(pDM_Odm->AntDivType == CG_TRX_HW_ANTDIV) + { +#if TX_BY_REG + ODM_SetBBReg(pDM_Odm, ODM_REG_TX_ANT_CTRL_11N , BIT21, 0); //Reg80c[21]=1'b0 //from Reg +#else + ODM_SetBBReg(pDM_Odm, ODM_REG_TX_ANT_CTRL_11N , BIT21, 1); //Reg80c[21]=1'b1 //from TX Info +#endif + } + pDM_FatTable->bBecomeLinked = pDM_Odm->bLinked; + } + } + + + + if((pDM_Odm->AntDivType == CG_TRX_HW_ANTDIV)||(pDM_Odm->AntDivType == CGCS_RX_HW_ANTDIV)) + odm_HWAntDiv(pDM_Odm); + #if (!(DM_ODM_SUPPORT_TYPE == ODM_CE)) + else if(pDM_Odm->AntDivType == CG_TRX_SMART_ANTDIV) + odm_FastAntTraining(pDM_Odm); + #endif +} + + +/* +#if (DM_ODM_SUPPORT_TYPE == ODM_MP) +VOID +odm_FastAntTrainingCallback( + PRT_TIMER pTimer +) +{ + struct adapter * Adapter = (PADAPTER)pTimer->Adapter; + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); + + //#if DEV_BUS_TYPE==RT_PCI_INTERFACE + //#if USE_WORKITEM + //PlatformScheduleWorkItem(&pHalData->SwAntennaSwitchWorkitem); + //#else + odm_FastAntTraining(&pHalData->DM_OutSrc); + //#endif + //#else + //PlatformScheduleWorkItem(&pHalData->SwAntennaSwitchWorkitem); + //#endif + +} +#elif (DM_ODM_SUPPORT_TYPE == ODM_CE) +VOID odm_FastAntTrainingCallback(void *FunctionContext) +{ + PDM_ODM_T pDM_Odm= (PDM_ODM_T)FunctionContext; + struct adapter *padapter = pDM_Odm->Adapter; + if(padapter->net_closed == _TRUE) + return; + odm_FastAntTraining(pDM_Odm); +} +#elif (DM_ODM_SUPPORT_TYPE == ODM_AP) +VOID odm_FastAntTrainingCallback(void *FunctionContext) +{ + PDM_ODM_T pDM_Odm= (PDM_ODM_T)FunctionContext; + odm_FastAntTraining(pDM_Odm); +} + +#endif +*/ + +#else //#if(defined(CONFIG_HW_ANTENNA_DIVERSITY)) +#if (DM_ODM_SUPPORT_TYPE & (ODM_MP|ODM_CE)) +VOID +ODM_SetTxAntByTxInfo_88E( + IN PDM_ODM_T pDM_Odm, + IN pu1Byte pDesc, + IN u1Byte macId + ) +{ +} +#else// (DM_ODM_SUPPORT_TYPE == ODM_AP) +VOID +ODM_SetTxAntByTxInfo_88E( + IN PDM_ODM_T pDM_Odm + ) +{ +} +#endif +#endif //#if(defined(CONFIG_HW_ANTENNA_DIVERSITY)) +//3============================================================ +//3 Dynamic Primary CCA +//3============================================================ + +VOID +odm_PrimaryCCA_Init( + IN PDM_ODM_T pDM_Odm) +{ + pPri_CCA_T PrimaryCCA = &(pDM_Odm->DM_PriCCA); + PrimaryCCA->DupRTS_flag = 0; + PrimaryCCA->intf_flag = 0; + PrimaryCCA->intf_type = 0; + PrimaryCCA->Monitor_flag = 0; + PrimaryCCA->PriCCA_flag = 0; +} + +BOOLEAN +ODM_DynamicPrimaryCCA_DupRTS( + IN PDM_ODM_T pDM_Odm + ) +{ + pPri_CCA_T PrimaryCCA = &(pDM_Odm->DM_PriCCA); + + return PrimaryCCA->DupRTS_flag; +} + +VOID +odm_DynamicPrimaryCCA( + IN PDM_ODM_T pDM_Odm + ) +{ + struct adapter *Adapter = pDM_Odm->Adapter; // for NIC + prtl8192cd_priv priv = pDM_Odm->priv; // for AP + + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); +#if (DM_ODM_SUPPORT_TYPE & (ODM_MP)) + PMGNT_INFO pMgntInfo = &(Adapter->MgntInfo); + PRT_WLAN_STA pEntry; +#endif + + PFALSE_ALARM_STATISTICS FalseAlmCnt = &(pDM_Odm->FalseAlmCnt); + pPri_CCA_T PrimaryCCA = &(pDM_Odm->DM_PriCCA); + + BOOLEAN Is40MHz; + BOOLEAN Client_40MHz = FALSE, Client_tmp = FALSE; // connected client BW + BOOLEAN bConnected = FALSE; // connected or not + static u1Byte Client_40MHz_pre = 0; + static u8Byte lastTxOkCnt = 0; + static u8Byte lastRxOkCnt = 0; + static u4Byte Counter = 0; + static u1Byte Delay = 1; + u8Byte curTxOkCnt; + u8Byte curRxOkCnt; + u1Byte SecCHOffset; + u1Byte i; + +#if((DM_ODM_SUPPORT_TYPE==ODM_ADSL) ||( DM_ODM_SUPPORT_TYPE==ODM_CE)) + return; +#endif + + if(pDM_Odm->SupportICType != ODM_RTL8188E) + return; + + Is40MHz = *(pDM_Odm->pBandWidth); + SecCHOffset = *(pDM_Odm->pSecChOffset); + ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_PRICCA, ODM_DBG_LOUD, ("Second CH Offset = %d\n", SecCHOffset)); + +#if (DM_ODM_SUPPORT_TYPE == ODM_MP) + if(Is40MHz==1) + SecCHOffset = SecCHOffset%2+1; // NIC's definition is reverse to AP 1:secondary below, 2: secondary above + ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_PRICCA, ODM_DBG_LOUD, ("Second CH Offset = %d\n", SecCHOffset)); + //3 Check Current WLAN Traffic + curTxOkCnt = Adapter->TxStats.NumTxBytesUnicast - lastTxOkCnt; + curRxOkCnt = Adapter->RxStats.NumRxBytesUnicast - lastRxOkCnt; + lastTxOkCnt = Adapter->TxStats.NumTxBytesUnicast; + lastRxOkCnt = Adapter->RxStats.NumRxBytesUnicast; +#elif (DM_ODM_SUPPORT_TYPE == ODM_AP) + //3 Check Current WLAN Traffic + curTxOkCnt = *(pDM_Odm->pNumTxBytesUnicast)-lastTxOkCnt; + curRxOkCnt = *(pDM_Odm->pNumRxBytesUnicast)-lastRxOkCnt; + lastTxOkCnt = *(pDM_Odm->pNumTxBytesUnicast); + lastRxOkCnt = *(pDM_Odm->pNumRxBytesUnicast); +#endif + + //==================Debug Message==================== + ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_PRICCA, ODM_DBG_LOUD, ("TP = %llu\n", curTxOkCnt+curRxOkCnt)); + ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_PRICCA, ODM_DBG_LOUD, ("Is40MHz = %d\n", Is40MHz)); + ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_PRICCA, ODM_DBG_LOUD, ("BW_LSC = %d\n", FalseAlmCnt->Cnt_BW_LSC)); + ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_PRICCA, ODM_DBG_LOUD, ("BW_USC = %d\n", FalseAlmCnt->Cnt_BW_USC)); + ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_PRICCA, ODM_DBG_LOUD, ("CCA OFDM = %d\n", FalseAlmCnt->Cnt_OFDM_CCA)); + ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_PRICCA, ODM_DBG_LOUD, ("CCA CCK = %d\n", FalseAlmCnt->Cnt_CCK_CCA)); + ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_PRICCA, ODM_DBG_LOUD, ("OFDM FA = %d\n", FalseAlmCnt->Cnt_Ofdm_fail)); + ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_PRICCA, ODM_DBG_LOUD, ("CCK FA = %d\n", FalseAlmCnt->Cnt_Cck_fail)); + //================================================ + +#if (DM_ODM_SUPPORT_TYPE == ODM_MP) + if (ACTING_AS_AP(Adapter)) // primary cca process only do at AP mode +#endif + { + + #if (DM_ODM_SUPPORT_TYPE == ODM_MP) + ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_PRICCA, ODM_DBG_LOUD, ("ACTING as AP mode=%d\n", ACTING_AS_AP(Adapter))); + //3 To get entry's connection and BW infomation status. + for(i=0;iHTInfo.bBw40MHz; // client BW + ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_PRICCA, ODM_DBG_LOUD, ("Client_BW=%d\n", Client_tmp)); + if(Client_tmp>Client_40MHz) + Client_40MHz = Client_tmp; // 40M/20M coexist => 40M priority is High + + if(pEntry->bAssociated) + { + bConnected=TRUE; // client is connected or not + break; + } + } + else + { + break; + } + } +#elif (DM_ODM_SUPPORT_TYPE == ODM_AP) + //3 To get entry's connection and BW infomation status. + + PSTA_INFO_T pstat; + + for(i=0; ipODM_StaInfo[i]; + if(IS_STA_VALID(pstat) ) + { + Client_tmp = pstat->tx_bw; + if(Client_tmp>Client_40MHz) + Client_40MHz = Client_tmp; // 40M/20M coexist => 40M priority is High + + bConnected = TRUE; + } + } +#endif + ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_PRICCA, ODM_DBG_LOUD, ("bConnected=%d\n", bConnected)); + ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_PRICCA, ODM_DBG_LOUD, ("Is Client 40MHz=%d\n", Client_40MHz)); + //1 Monitor whether the interference exists or not + if(PrimaryCCA->Monitor_flag == 1) + { + if(SecCHOffset == 1) // secondary channel is below the primary channel + { + if((FalseAlmCnt->Cnt_OFDM_CCA > 500)&&(FalseAlmCnt->Cnt_BW_LSC > FalseAlmCnt->Cnt_BW_USC+500)) + { + if(FalseAlmCnt->Cnt_Ofdm_fail > FalseAlmCnt->Cnt_OFDM_CCA>>1) + { + PrimaryCCA->intf_type = 1; + PrimaryCCA->PriCCA_flag = 1; + ODM_SetBBReg(pDM_Odm, 0xc6c, BIT8|BIT7, 2); // USC MF + if(PrimaryCCA->DupRTS_flag == 1) + PrimaryCCA->DupRTS_flag = 0; + } + else + { + PrimaryCCA->intf_type = 2; + if(PrimaryCCA->DupRTS_flag == 0) + PrimaryCCA->DupRTS_flag = 1; + } + + } + else // interferecne disappear + { + PrimaryCCA->DupRTS_flag = 0; + PrimaryCCA->intf_flag = 0; + PrimaryCCA->intf_type = 0; + } + } + else if(SecCHOffset == 2) // secondary channel is above the primary channel + { + if((FalseAlmCnt->Cnt_OFDM_CCA > 500)&&(FalseAlmCnt->Cnt_BW_USC > FalseAlmCnt->Cnt_BW_LSC+500)) + { + if(FalseAlmCnt->Cnt_Ofdm_fail > FalseAlmCnt->Cnt_OFDM_CCA>>1) + { + PrimaryCCA->intf_type = 1; + PrimaryCCA->PriCCA_flag = 1; + ODM_SetBBReg(pDM_Odm, 0xc6c, BIT8|BIT7, 1); // LSC MF + if(PrimaryCCA->DupRTS_flag == 1) + PrimaryCCA->DupRTS_flag = 0; + } + else + { + PrimaryCCA->intf_type = 2; + if(PrimaryCCA->DupRTS_flag == 0) + PrimaryCCA->DupRTS_flag = 1; + } + + } + else // interferecne disappear + { + PrimaryCCA->DupRTS_flag = 0; + PrimaryCCA->intf_flag = 0; + PrimaryCCA->intf_type = 0; + } + + + } + PrimaryCCA->Monitor_flag = 0; + } + + //1 Dynamic Primary CCA Main Function + if(PrimaryCCA->Monitor_flag == 0) + { + if(Is40MHz) // if RFBW==40M mode which require to process primary cca + { + //2 STA is NOT Connected + if(!bConnected) + { + ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_PRICCA, ODM_DBG_LOUD, ("STA NOT Connected!!!!\n")); + + if(PrimaryCCA->PriCCA_flag == 1) // reset primary cca when STA is disconnected + { + PrimaryCCA->PriCCA_flag = 0; + ODM_SetBBReg(pDM_Odm, 0xc6c, BIT8|BIT7, 0); + } + if(PrimaryCCA->DupRTS_flag == 1) // reset Duplicate RTS when STA is disconnected + PrimaryCCA->DupRTS_flag = 0; + + if(SecCHOffset == 1) // secondary channel is below the primary channel + { + if((FalseAlmCnt->Cnt_OFDM_CCA > 800)&&(FalseAlmCnt->Cnt_BW_LSC*5 > FalseAlmCnt->Cnt_BW_USC*9)) + { + PrimaryCCA->intf_flag = 1; // secondary channel interference is detected!!! + if(FalseAlmCnt->Cnt_Ofdm_fail > FalseAlmCnt->Cnt_OFDM_CCA>>1) + PrimaryCCA->intf_type = 1; // interference is shift + else + PrimaryCCA->intf_type = 2; // interference is in-band + } + else + { + PrimaryCCA->intf_flag = 0; + PrimaryCCA->intf_type = 0; + } + } + else if(SecCHOffset == 2) // secondary channel is above the primary channel + { + if((FalseAlmCnt->Cnt_OFDM_CCA > 800)&&(FalseAlmCnt->Cnt_BW_USC*5 > FalseAlmCnt->Cnt_BW_LSC*9)) + { + PrimaryCCA->intf_flag = 1; // secondary channel interference is detected!!! + if(FalseAlmCnt->Cnt_Ofdm_fail > FalseAlmCnt->Cnt_OFDM_CCA>>1) + PrimaryCCA->intf_type = 1; // interference is shift + else + PrimaryCCA->intf_type = 2; // interference is in-band + } + else + { + PrimaryCCA->intf_flag = 0; + PrimaryCCA->intf_type = 0; + } + } + ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_PRICCA, ODM_DBG_LOUD, ("PrimaryCCA=%d\n",PrimaryCCA->PriCCA_flag)); + ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_PRICCA, ODM_DBG_LOUD, ("Intf_Type=%d\n", PrimaryCCA->intf_type)); + } + //2 STA is Connected + else + { + if(Client_40MHz == 0) //3 // client BW = 20MHz + { + if(PrimaryCCA->PriCCA_flag == 0) + { + PrimaryCCA->PriCCA_flag = 1; + if(SecCHOffset==1) + ODM_SetBBReg(pDM_Odm, 0xc6c, BIT8|BIT7, 2); + else if(SecCHOffset==2) + ODM_SetBBReg(pDM_Odm, 0xc6c, BIT8|BIT7, 1); + } + ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_PRICCA, ODM_DBG_LOUD, ("STA Connected 20M!!! PrimaryCCA=%d\n", PrimaryCCA->PriCCA_flag)); + } + else //3 // client BW = 40MHz + { + if(PrimaryCCA->intf_flag == 1) // interference is detected!! + { + if(PrimaryCCA->intf_type == 1) + { + if(PrimaryCCA->PriCCA_flag!=1) + { + PrimaryCCA->PriCCA_flag = 1; + if(SecCHOffset==1) + ODM_SetBBReg(pDM_Odm, 0xc6c, BIT8|BIT7, 2); + else if(SecCHOffset==2) + ODM_SetBBReg(pDM_Odm, 0xc6c, BIT8|BIT7, 1); + } + } + else if(PrimaryCCA->intf_type == 2) + { + if(PrimaryCCA->DupRTS_flag!=1) + PrimaryCCA->DupRTS_flag = 1; + } + } + else // if intf_flag==0 + { + if((curTxOkCnt+curRxOkCnt)<10000) //idle mode or TP traffic is very low + { + if(SecCHOffset == 1) + { + if((FalseAlmCnt->Cnt_OFDM_CCA > 800)&&(FalseAlmCnt->Cnt_BW_LSC*5 > FalseAlmCnt->Cnt_BW_USC*9)) + { + PrimaryCCA->intf_flag = 1; + if(FalseAlmCnt->Cnt_Ofdm_fail > FalseAlmCnt->Cnt_OFDM_CCA>>1) + PrimaryCCA->intf_type = 1; // interference is shift + else + PrimaryCCA->intf_type = 2; // interference is in-band + } + } + else if(SecCHOffset == 2) + { + if((FalseAlmCnt->Cnt_OFDM_CCA > 800)&&(FalseAlmCnt->Cnt_BW_USC*5 > FalseAlmCnt->Cnt_BW_LSC*9)) + { + PrimaryCCA->intf_flag = 1; + if(FalseAlmCnt->Cnt_Ofdm_fail > FalseAlmCnt->Cnt_OFDM_CCA>>1) + PrimaryCCA->intf_type = 1; // interference is shift + else + PrimaryCCA->intf_type = 2; // interference is in-band + } + + } + } + else // TP Traffic is High + { + if(SecCHOffset == 1) + { + if(FalseAlmCnt->Cnt_BW_LSC > (FalseAlmCnt->Cnt_BW_USC+500)) + { + if(Delay == 0) // add delay to avoid interference occurring abruptly, jump one time + { + PrimaryCCA->intf_flag = 1; + if(FalseAlmCnt->Cnt_Ofdm_fail > FalseAlmCnt->Cnt_OFDM_CCA>>1) + PrimaryCCA->intf_type = 1; // interference is shift + else + PrimaryCCA->intf_type = 2; // interference is in-band + Delay = 1; + } + else + Delay = 0; + } + } + else if(SecCHOffset == 2) + { + if(FalseAlmCnt->Cnt_BW_USC > (FalseAlmCnt->Cnt_BW_LSC+500)) + { + if(Delay == 0) // add delay to avoid interference occurring abruptly + { + PrimaryCCA->intf_flag = 1; + if(FalseAlmCnt->Cnt_Ofdm_fail > FalseAlmCnt->Cnt_OFDM_CCA>>1) + PrimaryCCA->intf_type = 1; // interference is shift + else + PrimaryCCA->intf_type = 2; // interference is in-band + Delay = 1; + } + else + Delay = 0; + } + } + } + } + ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_PRICCA, ODM_DBG_LOUD, ("Primary CCA=%d\n", PrimaryCCA->PriCCA_flag)); + ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_PRICCA, ODM_DBG_LOUD, ("Duplicate RTS=%d\n", PrimaryCCA->DupRTS_flag)); + } + + }// end of connected + } + } + //1 Dynamic Primary CCA Monitor Counter + if((PrimaryCCA->PriCCA_flag == 1)||(PrimaryCCA->DupRTS_flag == 1)) + { + if(Client_40MHz == 0) // client=20M no need to monitor primary cca flag + { + Client_40MHz_pre = Client_40MHz; + return; + } + Counter++; + ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_PRICCA, ODM_DBG_LOUD, ("Counter=%d\n", Counter)); + if((Counter == 30)||((Client_40MHz -Client_40MHz_pre)==1)) // Every 60 sec to monitor one time + { + PrimaryCCA->Monitor_flag = 1; // monitor flag is triggered!!!!! + if(PrimaryCCA->PriCCA_flag == 1) + { + PrimaryCCA->PriCCA_flag = 0; + ODM_SetBBReg(pDM_Odm, 0xc6c, BIT8|BIT7, 0); + } + Counter = 0; + } + } + } + + Client_40MHz_pre = Client_40MHz; +} +#else //#if (RTL8188E_SUPPORT == 1) +VOID +ODM_UpdateRxIdleAnt_88E(IN PDM_ODM_T pDM_Odm, IN u1Byte Ant) +{ +} +VOID +odm_PrimaryCCA_Init( + IN PDM_ODM_T pDM_Odm) +{ +} +VOID +odm_DynamicPrimaryCCA( + IN PDM_ODM_T pDM_Odm + ) +{ +} +BOOLEAN +ODM_DynamicPrimaryCCA_DupRTS( + IN PDM_ODM_T pDM_Odm + ) +{ + return FALSE; +} +#endif //#if (RTL8188E_SUPPORT == 1) diff --git a/hal/odm_RegConfig8188E.c b/hal/odm_RegConfig8188E.c index 973a841..9e5caf1 100755 --- a/hal/odm_RegConfig8188E.c +++ b/hal/odm_RegConfig8188E.c @@ -1,7 +1,7 @@ /****************************************************************************** * * 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. @@ -20,22 +20,22 @@ #include "odm_precomp.h" -#if (RTL8188E_SUPPORT == 1) +#if (RTL8188E_SUPPORT == 1) void odm_ConfigRFReg_8188E( - IN PDM_ODM_T pDM_Odm, - IN u4Byte Addr, - IN u4Byte Data, + IN PDM_ODM_T pDM_Odm, + IN u4Byte Addr, + IN u4Byte Data, IN ODM_RF_RADIO_PATH_E RF_PATH, IN u4Byte RegAddr ) { if(Addr == 0xffe) - { + { #ifdef CONFIG_LONG_DELAY_ISSUE ODM_sleep_ms(50); - #else + #else ODM_delay_ms(50); #endif } @@ -64,15 +64,15 @@ odm_ConfigRFReg_8188E( ODM_SetRFReg(pDM_Odm, RF_PATH, RegAddr, bRFRegOffsetMask, Data); // Add 1us delay between BB/RF register setting. ODM_delay_us(1); - } + } } -void +void odm_ConfigRF_RadioA_8188E( - IN PDM_ODM_T pDM_Odm, - IN u4Byte Addr, - IN u4Byte Data + IN PDM_ODM_T pDM_Odm, + IN u4Byte Addr, + IN u4Byte Data ) { u4Byte content = 0x1000; // RF_Content: radioa_txt @@ -83,60 +83,60 @@ odm_ConfigRF_RadioA_8188E( ODM_RT_TRACE(pDM_Odm,ODM_COMP_INIT, ODM_DBG_TRACE, ("===> ODM_ConfigRFWithHeaderFile: [RadioA] %08X %08X\n", Addr, Data)); } -void +void odm_ConfigRF_RadioB_8188E( - IN PDM_ODM_T pDM_Odm, - IN u4Byte Addr, - IN u4Byte Data + IN PDM_ODM_T pDM_Odm, + IN u4Byte Addr, + IN u4Byte Data ) { u4Byte content = 0x1001; // RF_Content: radiob_txt u4Byte maskforPhySet= (u4Byte)(content&0xE000); odm_ConfigRFReg_8188E(pDM_Odm, Addr, Data, ODM_RF_PATH_B, Addr|maskforPhySet); - + ODM_RT_TRACE(pDM_Odm,ODM_COMP_INIT, ODM_DBG_TRACE, ("===> ODM_ConfigRFWithHeaderFile: [RadioB] %08X %08X\n", Addr, Data)); - + } -void +void odm_ConfigMAC_8188E( - IN PDM_ODM_T pDM_Odm, - IN u4Byte Addr, - IN u1Byte Data - ) + IN PDM_ODM_T pDM_Odm, + IN u4Byte Addr, + IN u1Byte Data + ) { ODM_Write1Byte(pDM_Odm, Addr, Data); ODM_RT_TRACE(pDM_Odm,ODM_COMP_INIT, ODM_DBG_TRACE, ("===> ODM_ConfigMACWithHeaderFile: [MAC_REG] %08X %08X\n", Addr, Data)); } -void +void odm_ConfigBB_AGC_8188E( - IN PDM_ODM_T pDM_Odm, - IN u4Byte Addr, - IN u4Byte Bitmask, - IN u4Byte Data + IN PDM_ODM_T pDM_Odm, + IN u4Byte Addr, + IN u4Byte Bitmask, + IN u4Byte Data ) { - ODM_SetBBReg(pDM_Odm, Addr, Bitmask, Data); + ODM_SetBBReg(pDM_Odm, Addr, Bitmask, Data); // Add 1us delay between BB/RF register setting. ODM_delay_us(1); ODM_RT_TRACE(pDM_Odm,ODM_COMP_INIT, ODM_DBG_TRACE, ("===> ODM_ConfigBBWithHeaderFile: [AGC_TAB] %08X %08X\n", Addr, Data)); } - + void odm_ConfigBB_PHY_REG_PG_8188E( - IN PDM_ODM_T pDM_Odm, - IN u4Byte Addr, - IN u4Byte Bitmask, - IN u4Byte Data + IN PDM_ODM_T pDM_Odm, + IN u4Byte Addr, + IN u4Byte Bitmask, + IN u4Byte Data ) -{ +{ if (Addr == 0xfe){ #ifdef CONFIG_LONG_DELAY_ISSUE ODM_sleep_ms(50); - #else + #else ODM_delay_ms(50); #endif } @@ -165,18 +165,18 @@ odm_ConfigBB_PHY_REG_PG_8188E( } -void +void odm_ConfigBB_PHY_8188E( - IN PDM_ODM_T pDM_Odm, - IN u4Byte Addr, - IN u4Byte Bitmask, - IN u4Byte Data + IN PDM_ODM_T pDM_Odm, + IN u4Byte Addr, + IN u4Byte Bitmask, + IN u4Byte Data ) -{ +{ if (Addr == 0xfe){ #ifdef CONFIG_LONG_DELAY_ISSUE ODM_sleep_ms(50); - #else + #else ODM_delay_ms(50); #endif } @@ -197,13 +197,12 @@ odm_ConfigBB_PHY_8188E( } else{ if (Addr == 0xa24) - pDM_Odm->RFCalibrateInfo.RegA24 = Data; - ODM_SetBBReg(pDM_Odm, Addr, Bitmask, Data); - + pDM_Odm->RFCalibrateInfo.RegA24 = Data; + ODM_SetBBReg(pDM_Odm, Addr, Bitmask, Data); + // Add 1us delay between BB/RF register setting. ODM_delay_us(1); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_INIT, ODM_DBG_TRACE, ("===> ODM_ConfigBBWithHeaderFile: [PHY_REG] %08X %08X\n", Addr, Data)); + ODM_RT_TRACE(pDM_Odm,ODM_COMP_INIT, ODM_DBG_TRACE, ("===> ODM_ConfigBBWithHeaderFile: [PHY_REG] %08X %08X\n", Addr, Data)); } } #endif - diff --git a/hal/odm_debug.c b/hal/odm_debug.c index 7db60cf..95123ca 100755 --- a/hal/odm_debug.c +++ b/hal/odm_debug.c @@ -1,627 +1,626 @@ -/****************************************************************************** - * - * 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 - * - * - ******************************************************************************/ - -//============================================================ -// include files -//============================================================ - -#include "odm_precomp.h" - -VOID -ODM_InitDebugSetting( - IN PDM_ODM_T pDM_Odm - ) -{ -pDM_Odm->DebugLevel = ODM_DBG_TRACE; - -pDM_Odm->DebugComponents = -\ -#if DBG -//BB Functions -// ODM_COMP_DIG | -// ODM_COMP_RA_MASK | -// ODM_COMP_DYNAMIC_TXPWR | -// ODM_COMP_FA_CNT | -// ODM_COMP_RSSI_MONITOR | -// ODM_COMP_CCK_PD | -// ODM_COMP_ANT_DIV | -// ODM_COMP_PWR_SAVE | -// ODM_COMP_PWR_TRAIN | -// ODM_COMP_RATE_ADAPTIVE | -// ODM_COMP_PATH_DIV | -// ODM_COMP_DYNAMIC_PRICCA | -// ODM_COMP_RXHP | - -//MAC Functions -// ODM_COMP_EDCA_TURBO | -// ODM_COMP_EARLY_MODE | -//RF Functions -// ODM_COMP_TX_PWR_TRACK | -// ODM_COMP_RX_GAIN_TRACK | -// ODM_COMP_CALIBRATION | -//Common -// ODM_COMP_COMMON | -// ODM_COMP_INIT | -#endif - 0; -} - -#if 0 -/*------------------Declare variable----------------------- -// Define debug flag array for common debug print macro. */ -u4Byte ODM_DBGP_Type[ODM_DBGP_TYPE_MAX]; - -/* Define debug print header for every service module. */ -ODM_DBGP_HEAD_T ODM_DBGP_Head; - - -/*----------------------------------------------------------------------------- - * Function: DBGP_Flag_Init - * - * Overview: Refresh all debug print control flag content to zero. - * - * Input: NONE - * - * Output: NONE - * - * Return: NONE - * - * Revised History: - * When Who Remark - * 10/20/2006 MHC Create Version 0. - * - *---------------------------------------------------------------------------*/ -extern void ODM_DBGP_Flag_Init(void) -{ - u1Byte i; - - for (i = 0; i < ODM_DBGP_TYPE_MAX; i++) - { - ODM_DBGP_Type[i] = 0; - } - -#ifndef ADSL_AP_BUILD_WORKAROUND -#if DBG - // 2010/06/02 MH Free build driver can not out any debug message!!! - // Init Debug flag enable condition - - ODM_DBGP_Type[FINIT] = \ -// INIT_EEPROM | -// INIT_TxPower | -// INIT_IQK | -// INIT_RF | - 0; - - ODM_DBGP_Type[FDM] = \ -// WA_IOT | -// DM_PWDB | -// DM_Monitor | -// DM_DIG | -// DM_EDCA_Turbo | -// DM_BT30 | - 0; - - ODM_DBGP_Type[FIOCTL] = \ -// IOCTL_IRP | -// IOCTL_IRP_DETAIL | -// IOCTL_IRP_STATISTICS | -// IOCTL_IRP_HANDLE | -// IOCTL_BT_HCICMD | -// IOCTL_BT_HCICMD_DETAIL | -// IOCTL_BT_HCICMD_EXT | -// IOCTL_BT_EVENT | -// IOCTL_BT_EVENT_DETAIL | -// IOCTL_BT_EVENT_PERIODICAL | -// IOCTL_BT_TX_ACLDATA | -// IOCTL_BT_TX_ACLDATA_DETAIL | -// IOCTL_BT_RX_ACLDATA | -// IOCTL_BT_RX_ACLDATA_DETAIL | -// IOCTL_BT_TP | -// IOCTL_STATE | -// IOCTL_BT_LOGO | -// IOCTL_CALLBACK_FUN | -// IOCTL_PARSE_BT_PKT | - 0; - - ODM_DBGP_Type[FBT] = \ -// BT_TRACE | - 0; - - ODM_DBGP_Type[FEEPROM] = \ -// EEPROM_W | -// EFUSE_PG | -// EFUSE_READ_ALL | -// EFUSE_ANALYSIS | -// EFUSE_PG_DETAIL | - 0; - - ODM_DBGP_Type[FDBG_CTRL] = \ -// DBG_CTRL_TRACE | -// DBG_CTRL_INBAND_NOISE | - 0; - - // 2011/07/20 MH Add for short cut - ODM_DBGP_Type[FSHORT_CUT] = \ -// SHCUT_TX | -// SHCUT_RX | - 0; - -#endif -#endif - /* Define debug header of every service module. */ - //ODM_DBGP_Head.pMANS = "\n\r[MANS] "; - //ODM_DBGP_Head.pRTOS = "\n\r[RTOS] "; - //ODM_DBGP_Head.pALM = "\n\r[ALM] "; - //ODM_DBGP_Head.pPEM = "\n\r[PEM] "; - //ODM_DBGP_Head.pCMPK = "\n\r[CMPK] "; - //ODM_DBGP_Head.pRAPD = "\n\r[RAPD] "; - //ODM_DBGP_Head.pTXPB = "\n\r[TXPB] "; - //ODM_DBGP_Head.pQUMG = "\n\r[QUMG] "; - -} /* DBGP_Flag_Init */ - -#endif - - -#if 0 -u4Byte GlobalDebugLevel = DBG_LOUD; -// -// 2009/06/22 MH Allow Fre build to print none debug info at init time. -// -#if DBG -u8Byte GlobalDebugComponents = \ -// COMP_TRACE | -// COMP_DBG | -// COMP_INIT | -// COMP_OID_QUERY | -// COMP_OID_SET | -// COMP_RECV | -// COMP_SEND | -// COMP_IO | -// COMP_POWER | -// COMP_MLME | -// COMP_SCAN | -// COMP_SYSTEM | -// COMP_SEC | -// COMP_AP | -// COMP_TURBO | -// COMP_QOS | -// COMP_AUTHENTICATOR | -// COMP_BEACON | -// COMP_ANTENNA | -// COMP_RATE | -// COMP_EVENTS | -// COMP_FPGA | -// COMP_RM | -// COMP_MP | -// COMP_RXDESC | -// COMP_CKIP | -// COMP_DIG | -// COMP_TXAGC | -// COMP_HIPWR | -// COMP_HALDM | -// COMP_RSNA | -// COMP_INDIC | -// COMP_LED | -// COMP_RF | -// COMP_DUALMACSWITCH | -// COMP_EASY_CONCURRENT | - -//1!!!!!!!!!!!!!!!!!!!!!!!!!!! -//1//1Attention Please!!!<11n or 8190 specific code should be put below this line> -//1!!!!!!!!!!!!!!!!!!!!!!!!!!! - -// COMP_HT | -// COMP_POWER_TRACKING | -// COMP_RX_REORDER | -// COMP_AMSDU | -// COMP_WPS | -// COMP_RATR | -// COMP_RESET | -// COMP_CMD | -// COMP_EFUSE | -// COMP_MESH_INTERWORKING | -// COMP_CCX | -// COMP_IOCTL | -// COMP_GP | -// COMP_TXAGG | -// COMP_BB_POWERSAVING | -// COMP_SWAS | -// COMP_P2P | -// COMP_MUX | -// COMP_FUNC | -// COMP_TDLS | -// COMP_OMNIPEEK | -// COMP_PSD | - 0; - - -#else -#define FuncEntry -#define FuncExit -u8Byte GlobalDebugComponents = 0; -#endif - -#if (RT_PLATFORM==PLATFORM_LINUX) -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)) -EXPORT_SYMBOL(GlobalDebugComponents); -EXPORT_SYMBOL(GlobalDebugLevel); -#endif -#endif - -/*------------------Declare variable----------------------- -// Define debug flag array for common debug print macro. */ -u4Byte DBGP_Type[DBGP_TYPE_MAX]; - -/* Define debug print header for every service module. */ -DBGP_HEAD_T DBGP_Head; - - -/*----------------------------------------------------------------------------- - * Function: DBGP_Flag_Init - * - * Overview: Refresh all debug print control flag content to zero. - * - * Input: NONE - * - * Output: NONE - * - * Return: NONE - * - * Revised History: - * When Who Remark - * 10/20/2006 MHC Create Version 0. - * - *---------------------------------------------------------------------------*/ -extern void DBGP_Flag_Init(void) -{ - u1Byte i; - - for (i = 0; i < DBGP_TYPE_MAX; i++) - { - DBGP_Type[i] = 0; - } - -#if DBG - // 2010/06/02 MH Free build driver can not out any debug message!!! - // Init Debug flag enable condition - - DBGP_Type[FINIT] = \ -// INIT_EEPROM | -// INIT_TxPower | -// INIT_IQK | -// INIT_RF | - 0; - - DBGP_Type[FDM] = \ -// WA_IOT | -// DM_PWDB | -// DM_Monitor | -// DM_DIG | -// DM_EDCA_Turbo | -// DM_BT30 | - 0; - - DBGP_Type[FIOCTL] = \ -// IOCTL_IRP | -// IOCTL_IRP_DETAIL | -// IOCTL_IRP_STATISTICS | -// IOCTL_IRP_HANDLE | -// IOCTL_BT_HCICMD | -// IOCTL_BT_HCICMD_DETAIL | -// IOCTL_BT_HCICMD_EXT | -// IOCTL_BT_EVENT | -// IOCTL_BT_EVENT_DETAIL | -// IOCTL_BT_EVENT_PERIODICAL | -// IOCTL_BT_TX_ACLDATA | -// IOCTL_BT_TX_ACLDATA_DETAIL | -// IOCTL_BT_RX_ACLDATA | -// IOCTL_BT_RX_ACLDATA_DETAIL | -// IOCTL_BT_TP | -// IOCTL_STATE | -// IOCTL_BT_LOGO | -// IOCTL_CALLBACK_FUN | -// IOCTL_PARSE_BT_PKT | - 0; - - DBGP_Type[FBT] = \ -// BT_TRACE | - 0; - - DBGP_Type[FEEPROM] = \ -// EEPROM_W | -// EFUSE_PG | -// EFUSE_READ_ALL | -// EFUSE_ANALYSIS | -// EFUSE_PG_DETAIL | - 0; - - DBGP_Type[FDBG_CTRL] = \ -// DBG_CTRL_TRACE | -// DBG_CTRL_INBAND_NOISE | - 0; - - // 2011/07/20 MH Add for short cut - DBGP_Type[FSHORT_CUT] = \ -// SHCUT_TX | -// SHCUT_RX | - 0; - -#endif - /* Define debug header of every service module. */ - DBGP_Head.pMANS = "\n\r[MANS] "; - DBGP_Head.pRTOS = "\n\r[RTOS] "; - DBGP_Head.pALM = "\n\r[ALM] "; - DBGP_Head.pPEM = "\n\r[PEM] "; - DBGP_Head.pCMPK = "\n\r[CMPK] "; - DBGP_Head.pRAPD = "\n\r[RAPD] "; - DBGP_Head.pTXPB = "\n\r[TXPB] "; - DBGP_Head.pQUMG = "\n\r[QUMG] "; - -} /* DBGP_Flag_Init */ - - -/*----------------------------------------------------------------------------- - * Function: DBG_PrintAllFlag - * - * Overview: Print All debug flag - * - * Input: NONE - * - * Output: NONE - * - * Return: NONE - * - * Revised History: - * When Who Remark - * 12/10/2008 MHC Create Version 0. - * - *---------------------------------------------------------------------------*/ -extern void DBG_PrintAllFlag(void) -{ - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("DBGFLAG 0 FQoS\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("DBGFLAG 1 FTX\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("DBGFLAG 2 FRX\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("DBGFLAG 3 FSEC\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("DBGFLAG 4 FMGNT\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("DBGFLAG 5 FMLME\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("DBGFLAG 6 FRESOURCE\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("DBGFLAG 7 FBEACON\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("DBGFLAG 8 FISR\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("DBGFLAG 9 FPHY\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("DBGFLAG 11 FMP\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("DBGFLAG 12 FPWR\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("DBGFLAG 13 FDM\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("DBGFLAG 14 FDBG_CTRL\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("DBGFLAG 15 FC2H\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("DBGFLAG 16 FBT\n")); -} // DBG_PrintAllFlag - - -extern void DBG_PrintAllComp(void) -{ - u1Byte i; - - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("GlobalDebugComponents Definition\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT0 COMP_TRACE\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT1 COMP_DBG\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT2 COMP_INIT\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT3 COMP_OID_QUERY\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT4 COMP_OID_SET\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT5 COMP_RECV\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT6 COMP_SEND\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT7 COMP_IO\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT8 COMP_POWER\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT9 COMP_MLME\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT10 COMP_SCAN\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT11 COMP_SYSTEM\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT12 COMP_SEC\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT13 COMP_AP\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT14 COMP_TURBO\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT15 COMP_QOS\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT16 COMP_AUTHENTICATOR\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT17 COMP_BEACON\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT18 COMP_BEACON\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT19 COMP_RATE\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT20 COMP_EVENTS\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT21 COMP_FPGA\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT22 COMP_RM\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT23 COMP_MP\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT24 COMP_RXDESC\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT25 COMP_CKIP\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT26 COMP_DIG\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT27 COMP_TXAGC\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT28 COMP_HIPWR\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT29 COMP_HALDM\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT30 COMP_RSNA\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT31 COMP_INDIC\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT32 COMP_LED\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT33 COMP_RF\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT34 COMP_HT\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT35 COMP_POWER_TRACKING\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT36 COMP_POWER_TRACKING\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT37 COMP_AMSDU\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT38 COMP_WPS\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT39 COMP_RATR\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT40 COMP_RESET\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT41 COMP_CMD\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT42 COMP_EFUSE\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT43 COMP_MESH_INTERWORKING\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT43 COMP_CCX\n")); - - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("GlobalDebugComponents = %"i64fmt"x\n", GlobalDebugComponents)); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("Enable DBG COMP =")); - for (i = 0; i < 64; i++) - { - if (GlobalDebugComponents & ((u8Byte)0x1 << i) ) - { - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT%02d |\n", i)); - } - } - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("\n")); - -} // DBG_PrintAllComp - - -/*----------------------------------------------------------------------------- - * Function: DBG_PrintFlagEvent - * - * Overview: Print dedicated debug flag event - * - * Input: NONE - * - * Output: NONE - * - * Return: NONE - * - * Revised History: - * When Who Remark - * 12/10/2008 MHC Create Version 0. - * - *---------------------------------------------------------------------------*/ -extern void DBG_PrintFlagEvent(u1Byte DbgFlag) -{ - switch(DbgFlag) - { - case FQoS: - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 0 QoS_INIT\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 1 QoS_VISTA\n")); - break; - - case FTX: - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 0 TX_DESC\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 1 TX_DESC_TID\n")); - break; - - case FRX: - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 0 RX_DATA\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 1 RX_PHY_STS\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 2 RX_PHY_SS\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 3 RX_PHY_SQ\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 4 RX_PHY_ASTS\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 5 RX_ERR_LEN\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 6 RX_DEFRAG\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 7 RX_ERR_RATE\n")); - break; - - case FSEC: - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("NA\n")); - break; - - case FMGNT: - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("NA\n")); - break; - - case FMLME: - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 0 MEDIA_STS\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 1 LINK_STS\n")); - break; - - case FRESOURCE: - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 0 OS_CHK\n")); - break; - - case FBEACON: - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 0 BCN_SHOW\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 1 BCN_PEER\n")); - break; - - case FISR: - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 0 ISR_CHK\n")); - break; - - case FPHY: - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 0 PHY_BBR\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 1 PHY_BBW\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 2 PHY_RFR\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 3 PHY_RFW\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 4 PHY_MACR\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 5 PHY_MACW\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 6 PHY_ALLR\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 7 PHY_ALLW\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 8 PHY_TXPWR\n")); - break; - - case FMP: - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 0 MP_RX\n")); - break; - - case FEEPROM: - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 0 EEPROM_W\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 1 EFUSE_PG\n")); - break; - - case FPWR: - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 0 LPS\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 1 IPS\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 2 PWRSW\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 3 PWRHW\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 4 PWRHAL\n")); - break; - - case FDM: - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 0 WA_IOT\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 1 DM_PWDB\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 2 DM_Monitor\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 3 DM_DIG\n")); - break; - - case FDBG_CTRL: - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 0 DBG_CTRL_TRACE\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 1 DBG_CTRL_INBAND_NOISE\n")); - break; - - case FC2H: - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 0 C2H_Summary\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 1 C2H_PacketData\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 2 C2H_ContentData\n")); - break; - - case FBT: - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 0 BT_TRACE\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 1 BT_RFPoll\n")); - break; - - default: - break; - } - -} // DBG_PrintFlagEvent - - -extern void DBG_DumpMem(const u1Byte DbgComp, - const u1Byte DbgLevel, - pu1Byte pMem, - u2Byte Len) -{ - u2Byte i; - - for (i=0;i<((Len>>3) + 1);i++) - { - ODM_RT_TRACE(pDM_Odm,DbgComp, DbgLevel, ("%02X %02X %02X %02X %02X %02X %02X %02X\n", - *(pMem+(i*8)), *(pMem+(i*8+1)), *(pMem+(i*8+2)), *(pMem+(i*8+3)), - *(pMem+(i*8+4)), *(pMem+(i*8+5)), *(pMem+(i*8+6)), *(pMem+(i*8+7)))); - - } -} - - -#endif - +/****************************************************************************** + * + * 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 + * + * + ******************************************************************************/ + +//============================================================ +// include files +//============================================================ + +#include "odm_precomp.h" + +VOID +ODM_InitDebugSetting( + IN PDM_ODM_T pDM_Odm + ) +{ +pDM_Odm->DebugLevel = ODM_DBG_TRACE; + +pDM_Odm->DebugComponents = +\ +#if DBG +//BB Functions +// ODM_COMP_DIG | +// ODM_COMP_RA_MASK | +// ODM_COMP_DYNAMIC_TXPWR | +// ODM_COMP_FA_CNT | +// ODM_COMP_RSSI_MONITOR | +// ODM_COMP_CCK_PD | +// ODM_COMP_ANT_DIV | +// ODM_COMP_PWR_SAVE | +// ODM_COMP_PWR_TRAIN | +// ODM_COMP_RATE_ADAPTIVE | +// ODM_COMP_PATH_DIV | +// ODM_COMP_DYNAMIC_PRICCA | +// ODM_COMP_RXHP | + +//MAC Functions +// ODM_COMP_EDCA_TURBO | +// ODM_COMP_EARLY_MODE | +//RF Functions +// ODM_COMP_TX_PWR_TRACK | +// ODM_COMP_RX_GAIN_TRACK | +// ODM_COMP_CALIBRATION | +//Common +// ODM_COMP_COMMON | +// ODM_COMP_INIT | +#endif + 0; +} + +#if 0 +/*------------------Declare variable----------------------- +// Define debug flag array for common debug print macro. */ +u4Byte ODM_DBGP_Type[ODM_DBGP_TYPE_MAX]; + +/* Define debug print header for every service module. */ +ODM_DBGP_HEAD_T ODM_DBGP_Head; + + +/*----------------------------------------------------------------------------- + * Function: DBGP_Flag_Init + * + * Overview: Refresh all debug print control flag content to zero. + * + * Input: NONE + * + * Output: NONE + * + * Return: NONE + * + * Revised History: + * When Who Remark + * 10/20/2006 MHC Create Version 0. + * + *---------------------------------------------------------------------------*/ +extern void ODM_DBGP_Flag_Init(void) +{ + u1Byte i; + + for (i = 0; i < ODM_DBGP_TYPE_MAX; i++) + { + ODM_DBGP_Type[i] = 0; + } + +#ifndef ADSL_AP_BUILD_WORKAROUND +#if DBG + // 2010/06/02 MH Free build driver can not out any debug message!!! + // Init Debug flag enable condition + + ODM_DBGP_Type[FINIT] = \ +// INIT_EEPROM | +// INIT_TxPower | +// INIT_IQK | +// INIT_RF | + 0; + + ODM_DBGP_Type[FDM] = \ +// WA_IOT | +// DM_PWDB | +// DM_Monitor | +// DM_DIG | +// DM_EDCA_Turbo | +// DM_BT30 | + 0; + + ODM_DBGP_Type[FIOCTL] = \ +// IOCTL_IRP | +// IOCTL_IRP_DETAIL | +// IOCTL_IRP_STATISTICS | +// IOCTL_IRP_HANDLE | +// IOCTL_BT_HCICMD | +// IOCTL_BT_HCICMD_DETAIL | +// IOCTL_BT_HCICMD_EXT | +// IOCTL_BT_EVENT | +// IOCTL_BT_EVENT_DETAIL | +// IOCTL_BT_EVENT_PERIODICAL | +// IOCTL_BT_TX_ACLDATA | +// IOCTL_BT_TX_ACLDATA_DETAIL | +// IOCTL_BT_RX_ACLDATA | +// IOCTL_BT_RX_ACLDATA_DETAIL | +// IOCTL_BT_TP | +// IOCTL_STATE | +// IOCTL_BT_LOGO | +// IOCTL_CALLBACK_FUN | +// IOCTL_PARSE_BT_PKT | + 0; + + ODM_DBGP_Type[FBT] = \ +// BT_TRACE | + 0; + + ODM_DBGP_Type[FEEPROM] = \ +// EEPROM_W | +// EFUSE_PG | +// EFUSE_READ_ALL | +// EFUSE_ANALYSIS | +// EFUSE_PG_DETAIL | + 0; + + ODM_DBGP_Type[FDBG_CTRL] = \ +// DBG_CTRL_TRACE | +// DBG_CTRL_INBAND_NOISE | + 0; + + // 2011/07/20 MH Add for short cut + ODM_DBGP_Type[FSHORT_CUT] = \ +// SHCUT_TX | +// SHCUT_RX | + 0; + +#endif +#endif + /* Define debug header of every service module. */ + //ODM_DBGP_Head.pMANS = "\n\r[MANS] "; + //ODM_DBGP_Head.pRTOS = "\n\r[RTOS] "; + //ODM_DBGP_Head.pALM = "\n\r[ALM] "; + //ODM_DBGP_Head.pPEM = "\n\r[PEM] "; + //ODM_DBGP_Head.pCMPK = "\n\r[CMPK] "; + //ODM_DBGP_Head.pRAPD = "\n\r[RAPD] "; + //ODM_DBGP_Head.pTXPB = "\n\r[TXPB] "; + //ODM_DBGP_Head.pQUMG = "\n\r[QUMG] "; + +} /* DBGP_Flag_Init */ + +#endif + + +#if 0 +u4Byte GlobalDebugLevel = DBG_LOUD; +// +// 2009/06/22 MH Allow Fre build to print none debug info at init time. +// +#if DBG +u8Byte GlobalDebugComponents = \ +// COMP_TRACE | +// COMP_DBG | +// COMP_INIT | +// COMP_OID_QUERY | +// COMP_OID_SET | +// COMP_RECV | +// COMP_SEND | +// COMP_IO | +// COMP_POWER | +// COMP_MLME | +// COMP_SCAN | +// COMP_SYSTEM | +// COMP_SEC | +// COMP_AP | +// COMP_TURBO | +// COMP_QOS | +// COMP_AUTHENTICATOR | +// COMP_BEACON | +// COMP_ANTENNA | +// COMP_RATE | +// COMP_EVENTS | +// COMP_FPGA | +// COMP_RM | +// COMP_MP | +// COMP_RXDESC | +// COMP_CKIP | +// COMP_DIG | +// COMP_TXAGC | +// COMP_HIPWR | +// COMP_HALDM | +// COMP_RSNA | +// COMP_INDIC | +// COMP_LED | +// COMP_RF | +// COMP_DUALMACSWITCH | +// COMP_EASY_CONCURRENT | + +//1!!!!!!!!!!!!!!!!!!!!!!!!!!! +//1//1Attention Please!!!<11n or 8190 specific code should be put below this line> +//1!!!!!!!!!!!!!!!!!!!!!!!!!!! + +// COMP_HT | +// COMP_POWER_TRACKING | +// COMP_RX_REORDER | +// COMP_AMSDU | +// COMP_WPS | +// COMP_RATR | +// COMP_RESET | +// COMP_CMD | +// COMP_EFUSE | +// COMP_MESH_INTERWORKING | +// COMP_CCX | +// COMP_IOCTL | +// COMP_GP | +// COMP_TXAGG | +// COMP_BB_POWERSAVING | +// COMP_SWAS | +// COMP_P2P | +// COMP_MUX | +// COMP_FUNC | +// COMP_TDLS | +// COMP_OMNIPEEK | +// COMP_PSD | + 0; + + +#else +#define FuncEntry +#define FuncExit +u8Byte GlobalDebugComponents = 0; +#endif + +#if (RT_PLATFORM==PLATFORM_LINUX) +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)) +EXPORT_SYMBOL(GlobalDebugComponents); +EXPORT_SYMBOL(GlobalDebugLevel); +#endif +#endif + +/*------------------Declare variable----------------------- +// Define debug flag array for common debug print macro. */ +u4Byte DBGP_Type[DBGP_TYPE_MAX]; + +/* Define debug print header for every service module. */ +DBGP_HEAD_T DBGP_Head; + + +/*----------------------------------------------------------------------------- + * Function: DBGP_Flag_Init + * + * Overview: Refresh all debug print control flag content to zero. + * + * Input: NONE + * + * Output: NONE + * + * Return: NONE + * + * Revised History: + * When Who Remark + * 10/20/2006 MHC Create Version 0. + * + *---------------------------------------------------------------------------*/ +extern void DBGP_Flag_Init(void) +{ + u1Byte i; + + for (i = 0; i < DBGP_TYPE_MAX; i++) + { + DBGP_Type[i] = 0; + } + +#if DBG + // 2010/06/02 MH Free build driver can not out any debug message!!! + // Init Debug flag enable condition + + DBGP_Type[FINIT] = \ +// INIT_EEPROM | +// INIT_TxPower | +// INIT_IQK | +// INIT_RF | + 0; + + DBGP_Type[FDM] = \ +// WA_IOT | +// DM_PWDB | +// DM_Monitor | +// DM_DIG | +// DM_EDCA_Turbo | +// DM_BT30 | + 0; + + DBGP_Type[FIOCTL] = \ +// IOCTL_IRP | +// IOCTL_IRP_DETAIL | +// IOCTL_IRP_STATISTICS | +// IOCTL_IRP_HANDLE | +// IOCTL_BT_HCICMD | +// IOCTL_BT_HCICMD_DETAIL | +// IOCTL_BT_HCICMD_EXT | +// IOCTL_BT_EVENT | +// IOCTL_BT_EVENT_DETAIL | +// IOCTL_BT_EVENT_PERIODICAL | +// IOCTL_BT_TX_ACLDATA | +// IOCTL_BT_TX_ACLDATA_DETAIL | +// IOCTL_BT_RX_ACLDATA | +// IOCTL_BT_RX_ACLDATA_DETAIL | +// IOCTL_BT_TP | +// IOCTL_STATE | +// IOCTL_BT_LOGO | +// IOCTL_CALLBACK_FUN | +// IOCTL_PARSE_BT_PKT | + 0; + + DBGP_Type[FBT] = \ +// BT_TRACE | + 0; + + DBGP_Type[FEEPROM] = \ +// EEPROM_W | +// EFUSE_PG | +// EFUSE_READ_ALL | +// EFUSE_ANALYSIS | +// EFUSE_PG_DETAIL | + 0; + + DBGP_Type[FDBG_CTRL] = \ +// DBG_CTRL_TRACE | +// DBG_CTRL_INBAND_NOISE | + 0; + + // 2011/07/20 MH Add for short cut + DBGP_Type[FSHORT_CUT] = \ +// SHCUT_TX | +// SHCUT_RX | + 0; + +#endif + /* Define debug header of every service module. */ + DBGP_Head.pMANS = "\n\r[MANS] "; + DBGP_Head.pRTOS = "\n\r[RTOS] "; + DBGP_Head.pALM = "\n\r[ALM] "; + DBGP_Head.pPEM = "\n\r[PEM] "; + DBGP_Head.pCMPK = "\n\r[CMPK] "; + DBGP_Head.pRAPD = "\n\r[RAPD] "; + DBGP_Head.pTXPB = "\n\r[TXPB] "; + DBGP_Head.pQUMG = "\n\r[QUMG] "; + +} /* DBGP_Flag_Init */ + + +/*----------------------------------------------------------------------------- + * Function: DBG_PrintAllFlag + * + * Overview: Print All debug flag + * + * Input: NONE + * + * Output: NONE + * + * Return: NONE + * + * Revised History: + * When Who Remark + * 12/10/2008 MHC Create Version 0. + * + *---------------------------------------------------------------------------*/ +extern void DBG_PrintAllFlag(void) +{ + ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("DBGFLAG 0 FQoS\n")); + ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("DBGFLAG 1 FTX\n")); + ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("DBGFLAG 2 FRX\n")); + ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("DBGFLAG 3 FSEC\n")); + ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("DBGFLAG 4 FMGNT\n")); + ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("DBGFLAG 5 FMLME\n")); + ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("DBGFLAG 6 FRESOURCE\n")); + ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("DBGFLAG 7 FBEACON\n")); + ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("DBGFLAG 8 FISR\n")); + ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("DBGFLAG 9 FPHY\n")); + ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("DBGFLAG 11 FMP\n")); + ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("DBGFLAG 12 FPWR\n")); + ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("DBGFLAG 13 FDM\n")); + ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("DBGFLAG 14 FDBG_CTRL\n")); + ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("DBGFLAG 15 FC2H\n")); + ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("DBGFLAG 16 FBT\n")); +} // DBG_PrintAllFlag + + +extern void DBG_PrintAllComp(void) +{ + u1Byte i; + + ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("GlobalDebugComponents Definition\n")); + ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT0 COMP_TRACE\n")); + ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT1 COMP_DBG\n")); + ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT2 COMP_INIT\n")); + ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT3 COMP_OID_QUERY\n")); + ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT4 COMP_OID_SET\n")); + ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT5 COMP_RECV\n")); + ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT6 COMP_SEND\n")); + ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT7 COMP_IO\n")); + ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT8 COMP_POWER\n")); + ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT9 COMP_MLME\n")); + ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT10 COMP_SCAN\n")); + ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT11 COMP_SYSTEM\n")); + ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT12 COMP_SEC\n")); + ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT13 COMP_AP\n")); + ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT14 COMP_TURBO\n")); + ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT15 COMP_QOS\n")); + ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT16 COMP_AUTHENTICATOR\n")); + ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT17 COMP_BEACON\n")); + ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT18 COMP_BEACON\n")); + ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT19 COMP_RATE\n")); + ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT20 COMP_EVENTS\n")); + ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT21 COMP_FPGA\n")); + ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT22 COMP_RM\n")); + ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT23 COMP_MP\n")); + ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT24 COMP_RXDESC\n")); + ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT25 COMP_CKIP\n")); + ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT26 COMP_DIG\n")); + ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT27 COMP_TXAGC\n")); + ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT28 COMP_HIPWR\n")); + ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT29 COMP_HALDM\n")); + ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT30 COMP_RSNA\n")); + ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT31 COMP_INDIC\n")); + ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT32 COMP_LED\n")); + ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT33 COMP_RF\n")); + ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT34 COMP_HT\n")); + ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT35 COMP_POWER_TRACKING\n")); + ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT36 COMP_POWER_TRACKING\n")); + ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT37 COMP_AMSDU\n")); + ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT38 COMP_WPS\n")); + ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT39 COMP_RATR\n")); + ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT40 COMP_RESET\n")); + ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT41 COMP_CMD\n")); + ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT42 COMP_EFUSE\n")); + ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT43 COMP_MESH_INTERWORKING\n")); + ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT43 COMP_CCX\n")); + + ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("GlobalDebugComponents = %"i64fmt"x\n", GlobalDebugComponents)); + ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("Enable DBG COMP =")); + for (i = 0; i < 64; i++) + { + if (GlobalDebugComponents & ((u8Byte)0x1 << i) ) + { + ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT%02d |\n", i)); + } + } + ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("\n")); + +} // DBG_PrintAllComp + + +/*----------------------------------------------------------------------------- + * Function: DBG_PrintFlagEvent + * + * Overview: Print dedicated debug flag event + * + * Input: NONE + * + * Output: NONE + * + * Return: NONE + * + * Revised History: + * When Who Remark + * 12/10/2008 MHC Create Version 0. + * + *---------------------------------------------------------------------------*/ +extern void DBG_PrintFlagEvent(u1Byte DbgFlag) +{ + switch(DbgFlag) + { + case FQoS: + ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 0 QoS_INIT\n")); + ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 1 QoS_VISTA\n")); + break; + + case FTX: + ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 0 TX_DESC\n")); + ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 1 TX_DESC_TID\n")); + break; + + case FRX: + ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 0 RX_DATA\n")); + ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 1 RX_PHY_STS\n")); + ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 2 RX_PHY_SS\n")); + ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 3 RX_PHY_SQ\n")); + ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 4 RX_PHY_ASTS\n")); + ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 5 RX_ERR_LEN\n")); + ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 6 RX_DEFRAG\n")); + ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 7 RX_ERR_RATE\n")); + break; + + case FSEC: + ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("NA\n")); + break; + + case FMGNT: + ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("NA\n")); + break; + + case FMLME: + ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 0 MEDIA_STS\n")); + ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 1 LINK_STS\n")); + break; + + case FRESOURCE: + ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 0 OS_CHK\n")); + break; + + case FBEACON: + ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 0 BCN_SHOW\n")); + ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 1 BCN_PEER\n")); + break; + + case FISR: + ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 0 ISR_CHK\n")); + break; + + case FPHY: + ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 0 PHY_BBR\n")); + ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 1 PHY_BBW\n")); + ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 2 PHY_RFR\n")); + ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 3 PHY_RFW\n")); + ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 4 PHY_MACR\n")); + ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 5 PHY_MACW\n")); + ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 6 PHY_ALLR\n")); + ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 7 PHY_ALLW\n")); + ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 8 PHY_TXPWR\n")); + break; + + case FMP: + ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 0 MP_RX\n")); + break; + + case FEEPROM: + ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 0 EEPROM_W\n")); + ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 1 EFUSE_PG\n")); + break; + + case FPWR: + ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 0 LPS\n")); + ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 1 IPS\n")); + ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 2 PWRSW\n")); + ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 3 PWRHW\n")); + ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 4 PWRHAL\n")); + break; + + case FDM: + ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 0 WA_IOT\n")); + ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 1 DM_PWDB\n")); + ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 2 DM_Monitor\n")); + ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 3 DM_DIG\n")); + break; + + case FDBG_CTRL: + ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 0 DBG_CTRL_TRACE\n")); + ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 1 DBG_CTRL_INBAND_NOISE\n")); + break; + + case FC2H: + ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 0 C2H_Summary\n")); + ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 1 C2H_PacketData\n")); + ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 2 C2H_ContentData\n")); + break; + + case FBT: + ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 0 BT_TRACE\n")); + ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 1 BT_RFPoll\n")); + break; + + default: + break; + } + +} // DBG_PrintFlagEvent + + +extern void DBG_DumpMem(const u1Byte DbgComp, + const u1Byte DbgLevel, + pu1Byte pMem, + u2Byte Len) +{ + u2Byte i; + + for (i=0;i<((Len>>3) + 1);i++) + { + ODM_RT_TRACE(pDM_Odm,DbgComp, DbgLevel, ("%02X %02X %02X %02X %02X %02X %02X %02X\n", + *(pMem+(i*8)), *(pMem+(i*8+1)), *(pMem+(i*8+2)), *(pMem+(i*8+3)), + *(pMem+(i*8+4)), *(pMem+(i*8+5)), *(pMem+(i*8+6)), *(pMem+(i*8+7)))); + + } +} + + +#endif diff --git a/hal/odm_interface.c b/hal/odm_interface.c index ad4a62e..d0ab8f1 100755 --- a/hal/odm_interface.c +++ b/hal/odm_interface.c @@ -1,666 +1,661 @@ -/****************************************************************************** - * - * 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 - * - * - ******************************************************************************/ - -//============================================================ -// include files -//============================================================ - -#include "odm_precomp.h" -// -// ODM IO Relative API. -// - -u1Byte -ODM_Read1Byte( - IN PDM_ODM_T pDM_Odm, - IN u4Byte RegAddr - ) -{ -#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL)) - prtl8192cd_priv priv = pDM_Odm->priv; - return RTL_R8(RegAddr); -#elif(DM_ODM_SUPPORT_TYPE & ODM_CE) - struct adapter * Adapter = pDM_Odm->Adapter; - return rtw_read8(Adapter,RegAddr); -#elif(DM_ODM_SUPPORT_TYPE & ODM_MP) - struct adapter * Adapter = pDM_Odm->Adapter; - return PlatformEFIORead1Byte(Adapter, RegAddr); -#endif - -} - - -u2Byte -ODM_Read2Byte( - IN PDM_ODM_T pDM_Odm, - IN u4Byte RegAddr - ) -{ -#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL)) - prtl8192cd_priv priv = pDM_Odm->priv; - return RTL_R16(RegAddr); -#elif(DM_ODM_SUPPORT_TYPE & ODM_CE) - struct adapter * Adapter = pDM_Odm->Adapter; - return rtw_read16(Adapter,RegAddr); -#elif(DM_ODM_SUPPORT_TYPE & ODM_MP) - struct adapter * Adapter = pDM_Odm->Adapter; - return PlatformEFIORead2Byte(Adapter, RegAddr); -#endif - -} - - -u4Byte -ODM_Read4Byte( - IN PDM_ODM_T pDM_Odm, - IN u4Byte RegAddr - ) -{ -#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL)) - prtl8192cd_priv priv = pDM_Odm->priv; - return RTL_R32(RegAddr); -#elif(DM_ODM_SUPPORT_TYPE & ODM_CE) - struct adapter * Adapter = pDM_Odm->Adapter; - return rtw_read32(Adapter,RegAddr); -#elif(DM_ODM_SUPPORT_TYPE & ODM_MP) - struct adapter * Adapter = pDM_Odm->Adapter; - return PlatformEFIORead4Byte(Adapter, RegAddr); -#endif - -} - - -VOID -ODM_Write1Byte( - IN PDM_ODM_T pDM_Odm, - IN u4Byte RegAddr, - IN u1Byte Data - ) -{ -#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL)) - prtl8192cd_priv priv = pDM_Odm->priv; - RTL_W8(RegAddr, Data); -#elif(DM_ODM_SUPPORT_TYPE & ODM_CE) - struct adapter * Adapter = pDM_Odm->Adapter; - rtw_write8(Adapter,RegAddr, Data); -#elif(DM_ODM_SUPPORT_TYPE & ODM_MP) - struct adapter * Adapter = pDM_Odm->Adapter; - PlatformEFIOWrite1Byte(Adapter, RegAddr, Data); -#endif - -} - - -VOID -ODM_Write2Byte( - IN PDM_ODM_T pDM_Odm, - IN u4Byte RegAddr, - IN u2Byte Data - ) -{ -#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL)) - prtl8192cd_priv priv = pDM_Odm->priv; - RTL_W16(RegAddr, Data); -#elif(DM_ODM_SUPPORT_TYPE & ODM_CE) - struct adapter * Adapter = pDM_Odm->Adapter; - rtw_write16(Adapter,RegAddr, Data); -#elif(DM_ODM_SUPPORT_TYPE & ODM_MP) - struct adapter * Adapter = pDM_Odm->Adapter; - PlatformEFIOWrite2Byte(Adapter, RegAddr, Data); -#endif - -} - - -VOID -ODM_Write4Byte( - IN PDM_ODM_T pDM_Odm, - IN u4Byte RegAddr, - IN u4Byte Data - ) -{ -#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL)) - prtl8192cd_priv priv = pDM_Odm->priv; - RTL_W32(RegAddr, Data); -#elif(DM_ODM_SUPPORT_TYPE & ODM_CE) - struct adapter * Adapter = pDM_Odm->Adapter; - rtw_write32(Adapter,RegAddr, Data); -#elif(DM_ODM_SUPPORT_TYPE & ODM_MP) - struct adapter * Adapter = pDM_Odm->Adapter; - PlatformEFIOWrite4Byte(Adapter, RegAddr, Data); -#endif - -} - - -VOID -ODM_SetMACReg( - IN PDM_ODM_T pDM_Odm, - IN u4Byte RegAddr, - IN u4Byte BitMask, - IN u4Byte Data - ) -{ -#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL)) - PHY_SetBBReg(pDM_Odm->priv, RegAddr, BitMask, Data); -#elif(DM_ODM_SUPPORT_TYPE & (ODM_CE|ODM_MP)) - struct adapter * Adapter = pDM_Odm->Adapter; - PHY_SetBBReg(Adapter, RegAddr, BitMask, Data); -#endif -} - - -u4Byte -ODM_GetMACReg( - IN PDM_ODM_T pDM_Odm, - IN u4Byte RegAddr, - IN u4Byte BitMask - ) -{ -#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL)) - return PHY_QueryBBReg(pDM_Odm->priv, RegAddr, BitMask); -#elif(DM_ODM_SUPPORT_TYPE & (ODM_CE|ODM_MP)) - struct adapter * Adapter = pDM_Odm->Adapter; - return PHY_QueryBBReg(Adapter, RegAddr, BitMask); -#endif -} - - -VOID -ODM_SetBBReg( - IN PDM_ODM_T pDM_Odm, - IN u4Byte RegAddr, - IN u4Byte BitMask, - IN u4Byte Data - ) -{ -#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL)) - PHY_SetBBReg(pDM_Odm->priv, RegAddr, BitMask, Data); -#elif(DM_ODM_SUPPORT_TYPE & (ODM_CE|ODM_MP)) - struct adapter * Adapter = pDM_Odm->Adapter; - PHY_SetBBReg(Adapter, RegAddr, BitMask, Data); -#endif -} - - -u4Byte -ODM_GetBBReg( - IN PDM_ODM_T pDM_Odm, - IN u4Byte RegAddr, - IN u4Byte BitMask - ) -{ -#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL)) - return PHY_QueryBBReg(pDM_Odm->priv, RegAddr, BitMask); -#elif(DM_ODM_SUPPORT_TYPE & (ODM_CE|ODM_MP)) - struct adapter * Adapter = pDM_Odm->Adapter; - return PHY_QueryBBReg(Adapter, RegAddr, BitMask); -#endif -} - - -VOID -ODM_SetRFReg( - IN PDM_ODM_T pDM_Odm, - IN ODM_RF_RADIO_PATH_E eRFPath, - IN u4Byte RegAddr, - IN u4Byte BitMask, - IN u4Byte Data - ) -{ -#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL)) - PHY_SetRFReg(pDM_Odm->priv, eRFPath, RegAddr, BitMask, Data); -#elif(DM_ODM_SUPPORT_TYPE & (ODM_CE|ODM_MP)) - struct adapter * Adapter = pDM_Odm->Adapter; - PHY_SetRFReg(Adapter, eRFPath, RegAddr, BitMask, Data); -#endif -} - - -u4Byte -ODM_GetRFReg( - IN PDM_ODM_T pDM_Odm, - IN ODM_RF_RADIO_PATH_E eRFPath, - IN u4Byte RegAddr, - IN u4Byte BitMask - ) -{ -#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL)) - return PHY_QueryRFReg(pDM_Odm->priv, eRFPath, RegAddr, BitMask, 1); -#elif(DM_ODM_SUPPORT_TYPE & (ODM_CE|ODM_MP)) - struct adapter * Adapter = pDM_Odm->Adapter; - return PHY_QueryRFReg(Adapter, eRFPath, RegAddr, BitMask); -#endif -} - - - - -// -// ODM Memory relative API. -// -VOID -ODM_AllocateMemory( - IN PDM_ODM_T pDM_Odm, - OUT PVOID *pPtr, - IN u4Byte length - ) -{ -#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL)) - *pPtr = kmalloc(length, GFP_ATOMIC); -#elif (DM_ODM_SUPPORT_TYPE & ODM_CE ) - *pPtr = rtw_zvmalloc(length); -#elif(DM_ODM_SUPPORT_TYPE & ODM_MP) - struct adapter * Adapter = pDM_Odm->Adapter; - PlatformAllocateMemory(Adapter, pPtr, length); -#endif -} - -// length could be ignored, used to detect memory leakage. -VOID -ODM_FreeMemory( - IN PDM_ODM_T pDM_Odm, - OUT PVOID pPtr, - IN u4Byte length - ) -{ -#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL)) - kfree(pPtr); -#elif (DM_ODM_SUPPORT_TYPE & ODM_CE ) - rtw_vmfree(pPtr, length); -#elif(DM_ODM_SUPPORT_TYPE & ODM_MP) - //struct adapter * Adapter = pDM_Odm->Adapter; - PlatformFreeMemory(pPtr, length); -#endif -} -s4Byte ODM_CompareMemory( - IN PDM_ODM_T pDM_Odm, - IN PVOID pBuf1, - IN PVOID pBuf2, - IN u4Byte length - ) -{ -#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL)) - return memcmp(pBuf1,pBuf2,length); -#elif (DM_ODM_SUPPORT_TYPE & ODM_CE ) - return _rtw_memcmp(pBuf1,pBuf2,length); -#elif(DM_ODM_SUPPORT_TYPE & ODM_MP) - return PlatformCompareMemory(pBuf1,pBuf2,length); -#endif -} - - - -// -// ODM MISC relative API. -// -VOID -ODM_AcquireSpinLock( - IN PDM_ODM_T pDM_Odm, - IN RT_SPINLOCK_TYPE type - ) -{ -#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL)) - -#elif (DM_ODM_SUPPORT_TYPE & ODM_CE ) - -#elif(DM_ODM_SUPPORT_TYPE & ODM_MP) - struct adapter * Adapter = pDM_Odm->Adapter; - PlatformAcquireSpinLock(Adapter, type); -#endif -} -VOID -ODM_ReleaseSpinLock( - IN PDM_ODM_T pDM_Odm, - IN RT_SPINLOCK_TYPE type - ) -{ -#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL)) - -#elif (DM_ODM_SUPPORT_TYPE & ODM_CE ) - -#elif(DM_ODM_SUPPORT_TYPE & ODM_MP) - struct adapter * Adapter = pDM_Odm->Adapter; - PlatformReleaseSpinLock(Adapter, type); -#endif -} - -// -// Work item relative API. FOr MP driver only~! -// -VOID -ODM_InitializeWorkItem( - IN PDM_ODM_T pDM_Odm, - IN PRT_WORK_ITEM pRtWorkItem, - IN RT_WORKITEM_CALL_BACK RtWorkItemCallback, - IN PVOID pContext, - IN const char* szID - ) -{ -#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL)) - -#elif(DM_ODM_SUPPORT_TYPE & ODM_CE) - -#elif(DM_ODM_SUPPORT_TYPE & ODM_MP) - struct adapter * Adapter = pDM_Odm->Adapter; - PlatformInitializeWorkItem(Adapter, pRtWorkItem, RtWorkItemCallback, pContext, szID); -#endif -} - - -VOID -ODM_StartWorkItem( - IN PRT_WORK_ITEM pRtWorkItem - ) -{ -#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL)) - -#elif(DM_ODM_SUPPORT_TYPE & ODM_CE) - -#elif(DM_ODM_SUPPORT_TYPE & ODM_MP) - PlatformStartWorkItem(pRtWorkItem); -#endif -} - - -VOID -ODM_StopWorkItem( - IN PRT_WORK_ITEM pRtWorkItem - ) -{ -#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL)) - -#elif(DM_ODM_SUPPORT_TYPE & ODM_CE) - -#elif(DM_ODM_SUPPORT_TYPE & ODM_MP) - PlatformStopWorkItem(pRtWorkItem); -#endif -} - - -VOID -ODM_FreeWorkItem( - IN PRT_WORK_ITEM pRtWorkItem - ) -{ -#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL)) - -#elif(DM_ODM_SUPPORT_TYPE & ODM_CE) - -#elif(DM_ODM_SUPPORT_TYPE & ODM_MP) - PlatformFreeWorkItem(pRtWorkItem); -#endif -} - - -VOID -ODM_ScheduleWorkItem( - IN PRT_WORK_ITEM pRtWorkItem - ) -{ -#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL)) - -#elif(DM_ODM_SUPPORT_TYPE & ODM_CE) - -#elif(DM_ODM_SUPPORT_TYPE & ODM_MP) - PlatformScheduleWorkItem(pRtWorkItem); -#endif -} - - -VOID -ODM_IsWorkItemScheduled( - IN PRT_WORK_ITEM pRtWorkItem - ) -{ -#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL)) - -#elif(DM_ODM_SUPPORT_TYPE & ODM_CE) - -#elif(DM_ODM_SUPPORT_TYPE & ODM_MP) - PlatformIsWorkItemScheduled(pRtWorkItem); -#endif -} - - - -// -// ODM Timer relative API. -// -VOID -ODM_StallExecution( - IN u4Byte usDelay - ) -{ -#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL)) - -#elif(DM_ODM_SUPPORT_TYPE & ODM_CE) - rtw_udelay_os(usDelay); -#elif(DM_ODM_SUPPORT_TYPE & ODM_MP) - PlatformStallExecution(usDelay); -#endif -} - -VOID -ODM_delay_ms(IN u4Byte ms) -{ -#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL)) - delay_ms(ms); -#elif(DM_ODM_SUPPORT_TYPE & ODM_CE) - rtw_mdelay_os(ms); -#elif(DM_ODM_SUPPORT_TYPE & ODM_MP) - delay_ms(ms); -#endif -} - -VOID -ODM_delay_us(IN u4Byte us) -{ -#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL)) - delay_us(us); -#elif(DM_ODM_SUPPORT_TYPE & ODM_CE) - rtw_udelay_os(us); -#elif(DM_ODM_SUPPORT_TYPE & ODM_MP) - PlatformStallExecution(us); -#endif -} - -VOID -ODM_sleep_ms(IN u4Byte ms) -{ -#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL)) - -#elif(DM_ODM_SUPPORT_TYPE & ODM_CE) - rtw_msleep_os(ms); -#elif(DM_ODM_SUPPORT_TYPE & ODM_MP) -#endif -} - -VOID -ODM_sleep_us(IN u4Byte us) -{ -#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL)) - -#elif(DM_ODM_SUPPORT_TYPE & ODM_CE) - rtw_usleep_os(us); -#elif(DM_ODM_SUPPORT_TYPE & ODM_MP) -#endif -} - -VOID -ODM_SetTimer( - IN PDM_ODM_T pDM_Odm, - IN PRT_TIMER pTimer, - IN u4Byte msDelay - ) -{ -#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL)) - mod_timer(pTimer, jiffies + (msDelay+9)/10); -#elif(DM_ODM_SUPPORT_TYPE & ODM_CE) - _set_timer(pTimer,msDelay ); //ms -#elif(DM_ODM_SUPPORT_TYPE & ODM_MP) - struct adapter * Adapter = pDM_Odm->Adapter; - PlatformSetTimer(Adapter, pTimer, msDelay); -#endif - -} - -VOID -ODM_InitializeTimer( - IN PDM_ODM_T pDM_Odm, - IN PRT_TIMER pTimer, - IN RT_TIMER_CALL_BACK CallBackFunc, - IN PVOID pContext, - IN const char* szID - ) -{ -#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL)) - pTimer->function = CallBackFunc; - pTimer->data = (unsigned long)pDM_Odm; - init_timer(pTimer); -#elif(DM_ODM_SUPPORT_TYPE & ODM_CE) - struct adapter *Adapter = pDM_Odm->Adapter; - _init_timer(pTimer,Adapter->pnetdev,CallBackFunc,pDM_Odm); -#elif(DM_ODM_SUPPORT_TYPE & ODM_MP) - struct adapter *Adapter = pDM_Odm->Adapter; - PlatformInitializeTimer(Adapter, pTimer, CallBackFunc,pContext,szID); -#endif -} - - -VOID -ODM_CancelTimer( - IN PDM_ODM_T pDM_Odm, - IN PRT_TIMER pTimer - ) -{ -#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL)) - del_timer_sync(pTimer); -#elif(DM_ODM_SUPPORT_TYPE & ODM_CE) - _cancel_timer_ex(pTimer); -#elif(DM_ODM_SUPPORT_TYPE & ODM_MP) - struct adapter *Adapter = pDM_Odm->Adapter; - PlatformCancelTimer(Adapter, pTimer); -#endif -} - - -VOID -ODM_ReleaseTimer( - IN PDM_ODM_T pDM_Odm, - IN PRT_TIMER pTimer - ) -{ -#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL)) - -#elif(DM_ODM_SUPPORT_TYPE & ODM_CE) - -#elif(DM_ODM_SUPPORT_TYPE & ODM_MP) - - struct adapter *Adapter = pDM_Odm->Adapter; - - // <20120301, Kordan> If the initilization fails, InitializeAdapterXxx will return regardless of InitHalDm. - // Hence, uninitialized timers cause BSOD when the driver releases resources since the init fail. - if (pTimer == 0) - { - ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_SERIOUS, ("=====>ODM_ReleaseTimer(), The timer is NULL! Please check it!\n")); - return; - } - - PlatformReleaseTimer(Adapter, pTimer); -#endif -} - - -// -// ODM FW relative API. -// -#if (DM_ODM_SUPPORT_TYPE & ODM_MP) -VOID -ODM_FillH2CCmd( - IN struct adapter * Adapter, - IN u1Byte ElementID, - IN u4Byte CmdLen, - IN pu1Byte pCmdBuffer -) -{ - if(IS_HARDWARE_TYPE_JAGUAR(Adapter)) - { - switch(ElementID) - { - case ODM_H2C_RSSI_REPORT: - FillH2CCmd8812(Adapter, H2C_8812_RSSI_REPORT, CmdLen, pCmdBuffer); - default: - break; - } - - } - else if(IS_HARDWARE_TYPE_8188E(Adapter)) - { - switch(ElementID) - { - case ODM_H2C_PSD_RESULT: - FillH2CCmd88E(Adapter, H2C_88E_PSD_RESULT, CmdLen, pCmdBuffer); - default: - break; - } - } - else - { - switch(ElementID) - { - case ODM_H2C_RSSI_REPORT: - FillH2CCmd92C(Adapter, H2C_RSSI_REPORT, CmdLen, pCmdBuffer); - case ODM_H2C_PSD_RESULT: - FillH2CCmd92C(Adapter, H2C_92C_PSD_RESULT, CmdLen, pCmdBuffer); - default: - break; - } - } -} -#else -u4Byte -ODM_FillH2CCmd( - IN pu1Byte pH2CBuffer, - IN u4Byte H2CBufferLen, - IN u4Byte CmdNum, - IN pu4Byte pElementID, - IN pu4Byte pCmdLen, - IN pu1Byte* pCmbBuffer, - IN pu1Byte CmdStartSeq - ) -{ -#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL)) - -#elif(DM_ODM_SUPPORT_TYPE & ODM_CE) - -#elif(DM_ODM_SUPPORT_TYPE & ODM_MP) - //FillH2CCmd(pH2CBuffer, H2CBufferLen, CmdNum, pElementID, pCmdLen, pCmbBuffer, CmdStartSeq); - return FALSE; -#endif - - return TRUE; -} -#endif - - - - - +/****************************************************************************** + * + * 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 + * + * + ******************************************************************************/ + +//============================================================ +// include files +//============================================================ + +#include "odm_precomp.h" +// +// ODM IO Relative API. +// + +u1Byte +ODM_Read1Byte( + IN PDM_ODM_T pDM_Odm, + IN u4Byte RegAddr + ) +{ +#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL)) + prtl8192cd_priv priv = pDM_Odm->priv; + return RTL_R8(RegAddr); +#elif(DM_ODM_SUPPORT_TYPE & ODM_CE) + struct adapter * Adapter = pDM_Odm->Adapter; + return rtw_read8(Adapter,RegAddr); +#elif(DM_ODM_SUPPORT_TYPE & ODM_MP) + struct adapter * Adapter = pDM_Odm->Adapter; + return PlatformEFIORead1Byte(Adapter, RegAddr); +#endif + +} + + +u2Byte +ODM_Read2Byte( + IN PDM_ODM_T pDM_Odm, + IN u4Byte RegAddr + ) +{ +#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL)) + prtl8192cd_priv priv = pDM_Odm->priv; + return RTL_R16(RegAddr); +#elif(DM_ODM_SUPPORT_TYPE & ODM_CE) + struct adapter * Adapter = pDM_Odm->Adapter; + return rtw_read16(Adapter,RegAddr); +#elif(DM_ODM_SUPPORT_TYPE & ODM_MP) + struct adapter * Adapter = pDM_Odm->Adapter; + return PlatformEFIORead2Byte(Adapter, RegAddr); +#endif + +} + + +u4Byte +ODM_Read4Byte( + IN PDM_ODM_T pDM_Odm, + IN u4Byte RegAddr + ) +{ +#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL)) + prtl8192cd_priv priv = pDM_Odm->priv; + return RTL_R32(RegAddr); +#elif(DM_ODM_SUPPORT_TYPE & ODM_CE) + struct adapter * Adapter = pDM_Odm->Adapter; + return rtw_read32(Adapter,RegAddr); +#elif(DM_ODM_SUPPORT_TYPE & ODM_MP) + struct adapter * Adapter = pDM_Odm->Adapter; + return PlatformEFIORead4Byte(Adapter, RegAddr); +#endif + +} + + +VOID +ODM_Write1Byte( + IN PDM_ODM_T pDM_Odm, + IN u4Byte RegAddr, + IN u1Byte Data + ) +{ +#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL)) + prtl8192cd_priv priv = pDM_Odm->priv; + RTL_W8(RegAddr, Data); +#elif(DM_ODM_SUPPORT_TYPE & ODM_CE) + struct adapter * Adapter = pDM_Odm->Adapter; + rtw_write8(Adapter,RegAddr, Data); +#elif(DM_ODM_SUPPORT_TYPE & ODM_MP) + struct adapter * Adapter = pDM_Odm->Adapter; + PlatformEFIOWrite1Byte(Adapter, RegAddr, Data); +#endif + +} + + +VOID +ODM_Write2Byte( + IN PDM_ODM_T pDM_Odm, + IN u4Byte RegAddr, + IN u2Byte Data + ) +{ +#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL)) + prtl8192cd_priv priv = pDM_Odm->priv; + RTL_W16(RegAddr, Data); +#elif(DM_ODM_SUPPORT_TYPE & ODM_CE) + struct adapter * Adapter = pDM_Odm->Adapter; + rtw_write16(Adapter,RegAddr, Data); +#elif(DM_ODM_SUPPORT_TYPE & ODM_MP) + struct adapter * Adapter = pDM_Odm->Adapter; + PlatformEFIOWrite2Byte(Adapter, RegAddr, Data); +#endif + +} + + +VOID +ODM_Write4Byte( + IN PDM_ODM_T pDM_Odm, + IN u4Byte RegAddr, + IN u4Byte Data + ) +{ +#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL)) + prtl8192cd_priv priv = pDM_Odm->priv; + RTL_W32(RegAddr, Data); +#elif(DM_ODM_SUPPORT_TYPE & ODM_CE) + struct adapter * Adapter = pDM_Odm->Adapter; + rtw_write32(Adapter,RegAddr, Data); +#elif(DM_ODM_SUPPORT_TYPE & ODM_MP) + struct adapter * Adapter = pDM_Odm->Adapter; + PlatformEFIOWrite4Byte(Adapter, RegAddr, Data); +#endif + +} + + +VOID +ODM_SetMACReg( + IN PDM_ODM_T pDM_Odm, + IN u4Byte RegAddr, + IN u4Byte BitMask, + IN u4Byte Data + ) +{ +#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL)) + PHY_SetBBReg(pDM_Odm->priv, RegAddr, BitMask, Data); +#elif(DM_ODM_SUPPORT_TYPE & (ODM_CE|ODM_MP)) + struct adapter * Adapter = pDM_Odm->Adapter; + PHY_SetBBReg(Adapter, RegAddr, BitMask, Data); +#endif +} + + +u4Byte +ODM_GetMACReg( + IN PDM_ODM_T pDM_Odm, + IN u4Byte RegAddr, + IN u4Byte BitMask + ) +{ +#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL)) + return PHY_QueryBBReg(pDM_Odm->priv, RegAddr, BitMask); +#elif(DM_ODM_SUPPORT_TYPE & (ODM_CE|ODM_MP)) + struct adapter * Adapter = pDM_Odm->Adapter; + return PHY_QueryBBReg(Adapter, RegAddr, BitMask); +#endif +} + + +VOID +ODM_SetBBReg( + IN PDM_ODM_T pDM_Odm, + IN u4Byte RegAddr, + IN u4Byte BitMask, + IN u4Byte Data + ) +{ +#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL)) + PHY_SetBBReg(pDM_Odm->priv, RegAddr, BitMask, Data); +#elif(DM_ODM_SUPPORT_TYPE & (ODM_CE|ODM_MP)) + struct adapter * Adapter = pDM_Odm->Adapter; + PHY_SetBBReg(Adapter, RegAddr, BitMask, Data); +#endif +} + + +u4Byte +ODM_GetBBReg( + IN PDM_ODM_T pDM_Odm, + IN u4Byte RegAddr, + IN u4Byte BitMask + ) +{ +#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL)) + return PHY_QueryBBReg(pDM_Odm->priv, RegAddr, BitMask); +#elif(DM_ODM_SUPPORT_TYPE & (ODM_CE|ODM_MP)) + struct adapter * Adapter = pDM_Odm->Adapter; + return PHY_QueryBBReg(Adapter, RegAddr, BitMask); +#endif +} + + +VOID +ODM_SetRFReg( + IN PDM_ODM_T pDM_Odm, + IN ODM_RF_RADIO_PATH_E eRFPath, + IN u4Byte RegAddr, + IN u4Byte BitMask, + IN u4Byte Data + ) +{ +#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL)) + PHY_SetRFReg(pDM_Odm->priv, eRFPath, RegAddr, BitMask, Data); +#elif(DM_ODM_SUPPORT_TYPE & (ODM_CE|ODM_MP)) + struct adapter * Adapter = pDM_Odm->Adapter; + PHY_SetRFReg(Adapter, eRFPath, RegAddr, BitMask, Data); +#endif +} + + +u4Byte +ODM_GetRFReg( + IN PDM_ODM_T pDM_Odm, + IN ODM_RF_RADIO_PATH_E eRFPath, + IN u4Byte RegAddr, + IN u4Byte BitMask + ) +{ +#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL)) + return PHY_QueryRFReg(pDM_Odm->priv, eRFPath, RegAddr, BitMask, 1); +#elif(DM_ODM_SUPPORT_TYPE & (ODM_CE|ODM_MP)) + struct adapter * Adapter = pDM_Odm->Adapter; + return PHY_QueryRFReg(Adapter, eRFPath, RegAddr, BitMask); +#endif +} + + + + +// +// ODM Memory relative API. +// +VOID +ODM_AllocateMemory( + IN PDM_ODM_T pDM_Odm, + OUT PVOID *pPtr, + IN u4Byte length + ) +{ +#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL)) + *pPtr = kmalloc(length, GFP_ATOMIC); +#elif (DM_ODM_SUPPORT_TYPE & ODM_CE ) + *pPtr = rtw_zvmalloc(length); +#elif(DM_ODM_SUPPORT_TYPE & ODM_MP) + struct adapter * Adapter = pDM_Odm->Adapter; + PlatformAllocateMemory(Adapter, pPtr, length); +#endif +} + +// length could be ignored, used to detect memory leakage. +VOID +ODM_FreeMemory( + IN PDM_ODM_T pDM_Odm, + OUT PVOID pPtr, + IN u4Byte length + ) +{ +#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL)) + kfree(pPtr); +#elif (DM_ODM_SUPPORT_TYPE & ODM_CE ) + rtw_vmfree(pPtr, length); +#elif(DM_ODM_SUPPORT_TYPE & ODM_MP) + //struct adapter * Adapter = pDM_Odm->Adapter; + PlatformFreeMemory(pPtr, length); +#endif +} +s4Byte ODM_CompareMemory( + IN PDM_ODM_T pDM_Odm, + IN PVOID pBuf1, + IN PVOID pBuf2, + IN u4Byte length + ) +{ +#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL)) + return memcmp(pBuf1,pBuf2,length); +#elif (DM_ODM_SUPPORT_TYPE & ODM_CE ) + return _rtw_memcmp(pBuf1,pBuf2,length); +#elif(DM_ODM_SUPPORT_TYPE & ODM_MP) + return PlatformCompareMemory(pBuf1,pBuf2,length); +#endif +} + + + +// +// ODM MISC relative API. +// +VOID +ODM_AcquireSpinLock( + IN PDM_ODM_T pDM_Odm, + IN RT_SPINLOCK_TYPE type + ) +{ +#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL)) + +#elif (DM_ODM_SUPPORT_TYPE & ODM_CE ) + +#elif(DM_ODM_SUPPORT_TYPE & ODM_MP) + struct adapter * Adapter = pDM_Odm->Adapter; + PlatformAcquireSpinLock(Adapter, type); +#endif +} +VOID +ODM_ReleaseSpinLock( + IN PDM_ODM_T pDM_Odm, + IN RT_SPINLOCK_TYPE type + ) +{ +#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL)) + +#elif (DM_ODM_SUPPORT_TYPE & ODM_CE ) + +#elif(DM_ODM_SUPPORT_TYPE & ODM_MP) + struct adapter * Adapter = pDM_Odm->Adapter; + PlatformReleaseSpinLock(Adapter, type); +#endif +} + +// +// Work item relative API. FOr MP driver only~! +// +VOID +ODM_InitializeWorkItem( + IN PDM_ODM_T pDM_Odm, + IN PRT_WORK_ITEM pRtWorkItem, + IN RT_WORKITEM_CALL_BACK RtWorkItemCallback, + IN PVOID pContext, + IN const char* szID + ) +{ +#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL)) + +#elif(DM_ODM_SUPPORT_TYPE & ODM_CE) + +#elif(DM_ODM_SUPPORT_TYPE & ODM_MP) + struct adapter * Adapter = pDM_Odm->Adapter; + PlatformInitializeWorkItem(Adapter, pRtWorkItem, RtWorkItemCallback, pContext, szID); +#endif +} + + +VOID +ODM_StartWorkItem( + IN PRT_WORK_ITEM pRtWorkItem + ) +{ +#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL)) + +#elif(DM_ODM_SUPPORT_TYPE & ODM_CE) + +#elif(DM_ODM_SUPPORT_TYPE & ODM_MP) + PlatformStartWorkItem(pRtWorkItem); +#endif +} + + +VOID +ODM_StopWorkItem( + IN PRT_WORK_ITEM pRtWorkItem + ) +{ +#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL)) + +#elif(DM_ODM_SUPPORT_TYPE & ODM_CE) + +#elif(DM_ODM_SUPPORT_TYPE & ODM_MP) + PlatformStopWorkItem(pRtWorkItem); +#endif +} + + +VOID +ODM_FreeWorkItem( + IN PRT_WORK_ITEM pRtWorkItem + ) +{ +#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL)) + +#elif(DM_ODM_SUPPORT_TYPE & ODM_CE) + +#elif(DM_ODM_SUPPORT_TYPE & ODM_MP) + PlatformFreeWorkItem(pRtWorkItem); +#endif +} + + +VOID +ODM_ScheduleWorkItem( + IN PRT_WORK_ITEM pRtWorkItem + ) +{ +#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL)) + +#elif(DM_ODM_SUPPORT_TYPE & ODM_CE) + +#elif(DM_ODM_SUPPORT_TYPE & ODM_MP) + PlatformScheduleWorkItem(pRtWorkItem); +#endif +} + + +VOID +ODM_IsWorkItemScheduled( + IN PRT_WORK_ITEM pRtWorkItem + ) +{ +#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL)) + +#elif(DM_ODM_SUPPORT_TYPE & ODM_CE) + +#elif(DM_ODM_SUPPORT_TYPE & ODM_MP) + PlatformIsWorkItemScheduled(pRtWorkItem); +#endif +} + + + +// +// ODM Timer relative API. +// +VOID +ODM_StallExecution( + IN u4Byte usDelay + ) +{ +#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL)) + +#elif(DM_ODM_SUPPORT_TYPE & ODM_CE) + rtw_udelay_os(usDelay); +#elif(DM_ODM_SUPPORT_TYPE & ODM_MP) + PlatformStallExecution(usDelay); +#endif +} + +VOID +ODM_delay_ms(IN u4Byte ms) +{ +#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL)) + delay_ms(ms); +#elif(DM_ODM_SUPPORT_TYPE & ODM_CE) + rtw_mdelay_os(ms); +#elif(DM_ODM_SUPPORT_TYPE & ODM_MP) + delay_ms(ms); +#endif +} + +VOID +ODM_delay_us(IN u4Byte us) +{ +#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL)) + delay_us(us); +#elif(DM_ODM_SUPPORT_TYPE & ODM_CE) + rtw_udelay_os(us); +#elif(DM_ODM_SUPPORT_TYPE & ODM_MP) + PlatformStallExecution(us); +#endif +} + +VOID +ODM_sleep_ms(IN u4Byte ms) +{ +#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL)) + +#elif(DM_ODM_SUPPORT_TYPE & ODM_CE) + rtw_msleep_os(ms); +#elif(DM_ODM_SUPPORT_TYPE & ODM_MP) +#endif +} + +VOID +ODM_sleep_us(IN u4Byte us) +{ +#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL)) + +#elif(DM_ODM_SUPPORT_TYPE & ODM_CE) + rtw_usleep_os(us); +#elif(DM_ODM_SUPPORT_TYPE & ODM_MP) +#endif +} + +VOID +ODM_SetTimer( + IN PDM_ODM_T pDM_Odm, + IN PRT_TIMER pTimer, + IN u4Byte msDelay + ) +{ +#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL)) + mod_timer(pTimer, jiffies + (msDelay+9)/10); +#elif(DM_ODM_SUPPORT_TYPE & ODM_CE) + _set_timer(pTimer,msDelay ); //ms +#elif(DM_ODM_SUPPORT_TYPE & ODM_MP) + struct adapter * Adapter = pDM_Odm->Adapter; + PlatformSetTimer(Adapter, pTimer, msDelay); +#endif + +} + +VOID +ODM_InitializeTimer( + IN PDM_ODM_T pDM_Odm, + IN PRT_TIMER pTimer, + IN RT_TIMER_CALL_BACK CallBackFunc, + IN PVOID pContext, + IN const char* szID + ) +{ +#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL)) + pTimer->function = CallBackFunc; + pTimer->data = (unsigned long)pDM_Odm; + init_timer(pTimer); +#elif(DM_ODM_SUPPORT_TYPE & ODM_CE) + struct adapter *Adapter = pDM_Odm->Adapter; + _init_timer(pTimer,Adapter->pnetdev,CallBackFunc,pDM_Odm); +#elif(DM_ODM_SUPPORT_TYPE & ODM_MP) + struct adapter *Adapter = pDM_Odm->Adapter; + PlatformInitializeTimer(Adapter, pTimer, CallBackFunc,pContext,szID); +#endif +} + + +VOID +ODM_CancelTimer( + IN PDM_ODM_T pDM_Odm, + IN PRT_TIMER pTimer + ) +{ +#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL)) + del_timer_sync(pTimer); +#elif(DM_ODM_SUPPORT_TYPE & ODM_CE) + _cancel_timer_ex(pTimer); +#elif(DM_ODM_SUPPORT_TYPE & ODM_MP) + struct adapter *Adapter = pDM_Odm->Adapter; + PlatformCancelTimer(Adapter, pTimer); +#endif +} + + +VOID +ODM_ReleaseTimer( + IN PDM_ODM_T pDM_Odm, + IN PRT_TIMER pTimer + ) +{ +#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL)) + +#elif(DM_ODM_SUPPORT_TYPE & ODM_CE) + +#elif(DM_ODM_SUPPORT_TYPE & ODM_MP) + + struct adapter *Adapter = pDM_Odm->Adapter; + + // <20120301, Kordan> If the initilization fails, InitializeAdapterXxx will return regardless of InitHalDm. + // Hence, uninitialized timers cause BSOD when the driver releases resources since the init fail. + if (pTimer == 0) + { + ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_SERIOUS, ("=====>ODM_ReleaseTimer(), The timer is NULL! Please check it!\n")); + return; + } + + PlatformReleaseTimer(Adapter, pTimer); +#endif +} + + +// +// ODM FW relative API. +// +#if (DM_ODM_SUPPORT_TYPE & ODM_MP) +VOID +ODM_FillH2CCmd( + IN struct adapter * Adapter, + IN u1Byte ElementID, + IN u4Byte CmdLen, + IN pu1Byte pCmdBuffer +) +{ + if(IS_HARDWARE_TYPE_JAGUAR(Adapter)) + { + switch(ElementID) + { + case ODM_H2C_RSSI_REPORT: + FillH2CCmd8812(Adapter, H2C_8812_RSSI_REPORT, CmdLen, pCmdBuffer); + default: + break; + } + + } + else if(IS_HARDWARE_TYPE_8188E(Adapter)) + { + switch(ElementID) + { + case ODM_H2C_PSD_RESULT: + FillH2CCmd88E(Adapter, H2C_88E_PSD_RESULT, CmdLen, pCmdBuffer); + default: + break; + } + } + else + { + switch(ElementID) + { + case ODM_H2C_RSSI_REPORT: + FillH2CCmd92C(Adapter, H2C_RSSI_REPORT, CmdLen, pCmdBuffer); + case ODM_H2C_PSD_RESULT: + FillH2CCmd92C(Adapter, H2C_92C_PSD_RESULT, CmdLen, pCmdBuffer); + default: + break; + } + } +} +#else +u4Byte +ODM_FillH2CCmd( + IN pu1Byte pH2CBuffer, + IN u4Byte H2CBufferLen, + IN u4Byte CmdNum, + IN pu4Byte pElementID, + IN pu4Byte pCmdLen, + IN pu1Byte* pCmbBuffer, + IN pu1Byte CmdStartSeq + ) +{ +#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL)) + +#elif(DM_ODM_SUPPORT_TYPE & ODM_CE) + +#elif(DM_ODM_SUPPORT_TYPE & ODM_MP) + //FillH2CCmd(pH2CBuffer, H2CBufferLen, CmdNum, pElementID, pCmdLen, pCmbBuffer, CmdStartSeq); + return FALSE; +#endif + + return TRUE; +} +#endif diff --git a/hal/rtl8188e_cmd.c b/hal/rtl8188e_cmd.c index e484fad..75e3f37 100755 --- a/hal/rtl8188e_cmd.c +++ b/hal/rtl8188e_cmd.c @@ -1,1493 +1,1493 @@ -/****************************************************************************** - * - * 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 - * - * - ******************************************************************************/ -#define _RTL8188E_CMD_C_ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#define CONFIG_H2C_EF - -#define RTL88E_MAX_H2C_BOX_NUMS 4 -#define RTL88E_MAX_CMD_LEN 7 -#define RTL88E_MESSAGE_BOX_SIZE 4 -#define RTL88E_EX_MESSAGE_BOX_SIZE 4 -#define RTL88E_RSVDPAGE_SIZE 1024 - -static u8 _is_fw_read_cmd_down(struct adapter* padapter, u8 msgbox_num) -{ - u8 read_down = _FALSE; - int retry_cnts = 100; - - u8 valid; - - //DBG_8192C(" _is_fw_read_cmd_down ,reg_1cc(%x),msg_box(%d)...\n",rtw_read8(padapter,REG_HMETFR),msgbox_num); - - do{ - valid = rtw_read8(padapter,REG_HMETFR) & BIT(msgbox_num); - if(0 == valid ){ - read_down = _TRUE; - } -#ifdef CONFIG_WOWLAN - rtw_msleep_os(2); -#endif - }while( (!read_down) && (retry_cnts--)); - - return read_down; - -} - - -/***************************************** -* H2C Msg format : -* 0x1DF - 0x1D0 -*| 31 - 8 | 7-5 4 - 0 | -*| h2c_msg |Class_ID CMD_ID | -* -* Extend 0x1FF - 0x1F0 -*|31 - 0 | -*|ext_msg| -******************************************/ -static s32 FillH2CCmd_88E(struct adapter *padapter, u8 ElementID, u32 CmdLen, u8 *pCmdBuffer) -{ - u8 bcmd_down = _FALSE; - s32 retry_cnts = 100; - u8 h2c_box_num; - u32 msgbox_addr; - u32 msgbox_ex_addr; - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter); - u8 cmd_idx,ext_cmd_len; - u32 h2c_cmd = 0; - u32 h2c_cmd_ex = 0; - s32 ret = _FAIL; - -_func_enter_; - - padapter = GET_PRIMARY_ADAPTER(padapter); - pHalData = GET_HAL_DATA(padapter); - - if(padapter->bFWReady == _FALSE) - { - DBG_8192C("FillH2CCmd_88E(): return H2C cmd because fw is not ready\n"); - return ret; - } - - _enter_critical_mutex(&(adapter_to_dvobj(padapter)->h2c_fwcmd_mutex), NULL); - - if (!pCmdBuffer) { - goto exit; - } - if (CmdLen > RTL88E_MAX_CMD_LEN) { - goto exit; - } - if (padapter->bSurpriseRemoved == _TRUE) - goto exit; - - //pay attention to if race condition happened in H2C cmd setting. - do{ - h2c_box_num = pHalData->LastHMEBoxNum; - - if(!_is_fw_read_cmd_down(padapter, h2c_box_num)){ - DBG_8192C(" fw read cmd failed...\n"); - goto exit; - } - - *(u8*)(&h2c_cmd) = ElementID; - - if(CmdLen<=3) - { - _rtw_memcpy((u8*)(&h2c_cmd)+1, pCmdBuffer, CmdLen ); - } - else{ - _rtw_memcpy((u8*)(&h2c_cmd)+1, pCmdBuffer,3); - ext_cmd_len = CmdLen-3; - _rtw_memcpy((u8*)(&h2c_cmd_ex), pCmdBuffer+3,ext_cmd_len ); - - //Write Ext command - msgbox_ex_addr = REG_HMEBOX_EXT_0 + (h2c_box_num *RTL88E_EX_MESSAGE_BOX_SIZE); - #ifdef CONFIG_H2C_EF - for(cmd_idx=0;cmd_idxh2c_cmd:0x%x, reg:0x%x =>h2c_cmd_ex:0x%x ..\n" - // ,pHalData->LastHMEBoxNum ,CmdLen,msgbox_addr,h2c_cmd,msgbox_ex_addr,h2c_cmd_ex); - - pHalData->LastHMEBoxNum = (h2c_box_num+1) % RTL88E_MAX_H2C_BOX_NUMS; - - }while((!bcmd_down) && (retry_cnts--)); - - ret = _SUCCESS; - -exit: - - _exit_critical_mutex(&(adapter_to_dvobj(padapter)->h2c_fwcmd_mutex), NULL); - -_func_exit_; - - return ret; -} - -u8 rtl8192c_h2c_msg_hdl(struct adapter *padapter, unsigned char *pbuf) -{ - u8 ElementID, CmdLen; - u8 *pCmdBuffer; - struct cmd_msg_parm *pcmdmsg; - - if(!pbuf) - return H2C_PARAMETERS_ERROR; - - pcmdmsg = (struct cmd_msg_parm*)pbuf; - ElementID = pcmdmsg->eid; - CmdLen = pcmdmsg->sz; - pCmdBuffer = pcmdmsg->buf; - - FillH2CCmd_88E(padapter, ElementID, CmdLen, pCmdBuffer); - - return H2C_SUCCESS; -} -/* -#if defined(CONFIG_AUTOSUSPEND) && defined(SUPPORT_HW_RFOFF_DETECTED) -u8 rtl8192c_set_FwSelectSuspend_cmd(struct adapter *padapter ,u8 bfwpoll, u16 period) -{ - u8 res=_SUCCESS; - struct H2C_SS_RFOFF_PARAM param; - DBG_8192C("==>%s bfwpoll(%x)\n",__FUNCTION__,bfwpoll); - param.gpio_period = period;//Polling GPIO_11 period time - param.ROFOn = (_TRUE == bfwpoll)?1:0; - FillH2CCmd_88E(padapter, SELECTIVE_SUSPEND_ROF_CMD, sizeof(param), (u8*)(¶m)); - return res; -} -#endif //CONFIG_AUTOSUSPEND && SUPPORT_HW_RFOFF_DETECTED -*/ -u8 rtl8188e_set_rssi_cmd(struct adapter*padapter, u8 *param) -{ - u8 res=_SUCCESS; - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter); -_func_enter_; - - if(pHalData->fw_ractrl == _TRUE){ - #if 0 - *((u32*) param ) = cpu_to_le32( *((u32*) param ) ); - - FillH2CCmd_88E(padapter, RSSI_SETTING_EID, 3, param); - #endif - }else{ - DBG_8192C("==>%s fw dont support RA \n",__FUNCTION__); - res=_FAIL; - } - -_func_exit_; - - return res; -} - -u8 rtl8188e_set_raid_cmd(struct adapter*padapter, u32 mask) -{ - u8 buf[3]; - u8 res=_SUCCESS; - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter); -_func_enter_; - if(pHalData->fw_ractrl == _TRUE){ - _rtw_memset(buf, 0, 3); - mask = cpu_to_le32( mask ); - _rtw_memcpy(buf, &mask, 3); - - FillH2CCmd_88E(padapter, H2C_DM_MACID_CFG, 3, buf); - }else{ - DBG_8192C("==>%s fw dont support RA \n",__FUNCTION__); - res=_FAIL; - } - -_func_exit_; - - return res; - -} - -//bitmap[0:27] = tx_rate_bitmap -//bitmap[28:31]= Rate Adaptive id -//arg[0:4] = macid -//arg[5] = Short GI -void rtl8188e_Add_RateATid(struct adapter *pAdapter, u32 bitmap, u8 arg, u8 rssi_level) -{ - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter); - //struct dm_priv *pdmpriv = &pHalData->dmpriv; - - u8 macid, init_rate, raid, shortGIrate=_FALSE; - - macid = arg&0x1f; - -#ifdef CONFIG_ODM_REFRESH_RAMASK - raid = (bitmap>>28) & 0x0f; - bitmap &=0x0fffffff; - - if(rssi_level != DM_RATR_STA_INIT) - bitmap = ODM_Get_Rate_Bitmap(&pHalData->odmpriv, macid, bitmap, rssi_level); - - bitmap |= ((raid<<28)&0xf0000000); -#endif //CONFIG_ODM_REFRESH_RAMASK - - - init_rate = get_highest_rate_idx(bitmap&0x0fffffff)&0x3f; - - shortGIrate = (arg&BIT(5)) ? _TRUE:_FALSE; - - if (shortGIrate==_TRUE) - init_rate |= BIT(6); - - - //rtw_write8(pAdapter, (REG_INIDATA_RATE_SEL+macid), (u8)init_rate); - - raid = (bitmap>>28) & 0x0f; - - bitmap &= 0x0fffffff; - - DBG_871X("%s=> mac_id:%d , raid:%d , ra_bitmap=0x%x, shortGIrate=0x%02x\n", - __FUNCTION__,macid ,raid ,bitmap, shortGIrate); - - -#if(RATE_ADAPTIVE_SUPPORT == 1) - ODM_RA_UpdateRateInfo_8188E( - &(pHalData->odmpriv), - macid, - raid, - bitmap, - shortGIrate - ); -#endif - -} - -void rtl8188e_set_FwPwrMode_cmd(struct adapter *padapter, u8 Mode) -{ - SETPWRMODE_PARM H2CSetPwrMode; - struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter); - u8 RLBM = 0; // 0:Min, 1:Max , 2:User define -_func_enter_; - - DBG_871X("%s: Mode=%d SmartPS=%d UAPSD=%d\n", __FUNCTION__, - Mode, pwrpriv->smart_ps, padapter->registrypriv.uapsd_enable); - - H2CSetPwrMode.AwakeInterval = 2; //DTIM =1 - - switch(Mode) - { - case PS_MODE_ACTIVE: - H2CSetPwrMode.Mode = 0; - break; - case PS_MODE_MIN: - H2CSetPwrMode.Mode = 1; - break; - case PS_MODE_MAX: - RLBM = 1; - H2CSetPwrMode.Mode = 1; - break; - case PS_MODE_DTIM: - RLBM = 2; - H2CSetPwrMode.Mode = 1; - break; - case PS_MODE_UAPSD_WMM: - H2CSetPwrMode.Mode = 2; - break; - default: - H2CSetPwrMode.Mode = 0; - break; - } - - //H2CSetPwrMode.Mode = Mode; - - H2CSetPwrMode.SmartPS_RLBM = (((pwrpriv->smart_ps<<4)&0xf0) | (RLBM & 0x0f)); - - H2CSetPwrMode.bAllQueueUAPSD = padapter->registrypriv.uapsd_enable; - - if(Mode > 0) - { - H2CSetPwrMode.PwrState = 0x00;// AllON(0x0C), RFON(0x04), RFOFF(0x00) -#ifdef CONFIG_EXT_CLK - H2CSetPwrMode.Mode |= BIT(7);//supporting 26M XTAL CLK_Request feature. -#endif //CONFIG_EXT_CLK - } - else - H2CSetPwrMode.PwrState = 0x0C;// AllON(0x0C), RFON(0x04), RFOFF(0x00) - - FillH2CCmd_88E(padapter, H2C_PS_PWR_MODE, sizeof(H2CSetPwrMode), (u8 *)&H2CSetPwrMode); - - -_func_exit_; -} - -void rtl8188e_set_FwMediaStatus_cmd(struct adapter *padapter, u16 mstatus_rpt ) -{ - u8 opmode,macid; - u16 mst_rpt = cpu_to_le16 (mstatus_rpt); - u32 reg_macid_no_link = REG_MACID_NO_LINK_0; - opmode = (u8) mst_rpt; - macid = (u8)(mst_rpt >> 8) ; - DBG_871X("### %s: MStatus=%x MACID=%d \n", __FUNCTION__,opmode,macid); - FillH2CCmd_88E(padapter, H2C_COM_MEDIA_STATUS_RPT, sizeof(mst_rpt), (u8 *)&mst_rpt); - - if(macid > 31){ - macid = macid-32; - reg_macid_no_link = REG_MACID_NO_LINK_1; - } - - //Delete select macid (MACID 0~63) from queue list. - if(opmode == 1)// 1:connect - { - rtw_write32(padapter,reg_macid_no_link, (rtw_read32(padapter,reg_macid_no_link) & (~BIT(macid)))); - } - else//0: disconnect - { - rtw_write32(padapter,reg_macid_no_link, (rtw_read32(padapter,reg_macid_no_link)|BIT(macid))); - } - - - -} - -void ConstructBeacon(struct adapter *padapter, u8 *pframe, u32 *pLength) -{ - struct rtw_ieee80211_hdr *pwlanhdr; - u16 *fctrl; - u32 rate_len, pktlen; - struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); - struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); - WLAN_BSSID_EX *cur_network = &(pmlmeinfo->network); - u8 bc_addr[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; - - - //DBG_871X("%s\n", __FUNCTION__); - - pwlanhdr = (struct rtw_ieee80211_hdr *)pframe; - - fctrl = &(pwlanhdr->frame_ctl); - *(fctrl) = 0; - - _rtw_memcpy(pwlanhdr->addr1, bc_addr, ETH_ALEN); - _rtw_memcpy(pwlanhdr->addr2, myid(&(padapter->eeprompriv)), ETH_ALEN); - _rtw_memcpy(pwlanhdr->addr3, get_my_bssid(cur_network), ETH_ALEN); - - SetSeqNum(pwlanhdr, 0/*pmlmeext->mgnt_seq*/); - //pmlmeext->mgnt_seq++; - SetFrameSubType(pframe, WIFI_BEACON); - - pframe += sizeof(struct rtw_ieee80211_hdr_3addr); - pktlen = sizeof (struct rtw_ieee80211_hdr_3addr); - - //timestamp will be inserted by hardware - pframe += 8; - pktlen += 8; - - // beacon interval: 2 bytes - _rtw_memcpy(pframe, (unsigned char *)(rtw_get_beacon_interval_from_ie(cur_network->IEs)), 2); - - pframe += 2; - pktlen += 2; - - // capability info: 2 bytes - _rtw_memcpy(pframe, (unsigned char *)(rtw_get_capability_from_ie(cur_network->IEs)), 2); - - pframe += 2; - pktlen += 2; - - if( (pmlmeinfo->state&0x03) == WIFI_FW_AP_STATE) - { - //DBG_871X("ie len=%d\n", cur_network->IELength); - pktlen += cur_network->IELength - sizeof(NDIS_802_11_FIXED_IEs); - _rtw_memcpy(pframe, cur_network->IEs+sizeof(NDIS_802_11_FIXED_IEs), pktlen); - - goto _ConstructBeacon; - } - - //below for ad-hoc mode - - // SSID - pframe = rtw_set_ie(pframe, _SSID_IE_, cur_network->Ssid.SsidLength, cur_network->Ssid.Ssid, &pktlen); - - // supported rates... - rate_len = rtw_get_rateset_len(cur_network->SupportedRates); - pframe = rtw_set_ie(pframe, _SUPPORTEDRATES_IE_, ((rate_len > 8)? 8: rate_len), cur_network->SupportedRates, &pktlen); - - // DS parameter set - pframe = rtw_set_ie(pframe, _DSSET_IE_, 1, (unsigned char *)&(cur_network->Configuration.DSConfig), &pktlen); - - if( (pmlmeinfo->state&0x03) == WIFI_FW_ADHOC_STATE) - { - u32 ATIMWindow; - // IBSS Parameter Set... - //ATIMWindow = cur->Configuration.ATIMWindow; - ATIMWindow = 0; - pframe = rtw_set_ie(pframe, _IBSS_PARA_IE_, 2, (unsigned char *)(&ATIMWindow), &pktlen); - } - - - //todo: ERP IE - - - // EXTERNDED SUPPORTED RATE - if (rate_len > 8) - { - pframe = rtw_set_ie(pframe, _EXT_SUPPORTEDRATES_IE_, (rate_len - 8), (cur_network->SupportedRates + 8), &pktlen); - } - - - //todo:HT for adhoc - -_ConstructBeacon: - - if ((pktlen + TXDESC_SIZE) > 512) - { - DBG_871X("beacon frame too large\n"); - return; - } - - *pLength = pktlen; - - //DBG_871X("%s bcn_sz=%d\n", __FUNCTION__, pktlen); - -} - -void ConstructPSPoll(struct adapter *padapter, u8 *pframe, u32 *pLength) -{ - struct rtw_ieee80211_hdr *pwlanhdr; - u16 *fctrl; - u32 pktlen; - struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); - struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); - - //DBG_871X("%s\n", __FUNCTION__); - - pwlanhdr = (struct rtw_ieee80211_hdr *)pframe; - - // Frame control. - fctrl = &(pwlanhdr->frame_ctl); - *(fctrl) = 0; - SetPwrMgt(fctrl); - SetFrameSubType(pframe, WIFI_PSPOLL); - - // AID. - SetDuration(pframe, (pmlmeinfo->aid | 0xc000)); - - // BSSID. - _rtw_memcpy(pwlanhdr->addr1, get_my_bssid(&(pmlmeinfo->network)), ETH_ALEN); - - // TA. - _rtw_memcpy(pwlanhdr->addr2, myid(&(padapter->eeprompriv)), ETH_ALEN); - - *pLength = 16; -} - -void ConstructNullFunctionData( - struct adapter *padapter, - u8 *pframe, - u32 *pLength, - u8 *StaAddr, - u8 bQoS, - u8 AC, - u8 bEosp, - u8 bForcePowerSave) -{ - struct rtw_ieee80211_hdr *pwlanhdr; - u16 *fctrl; - u32 pktlen; - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - struct wlan_network *cur_network = &pmlmepriv->cur_network; - struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); - struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); - - - //DBG_871X("%s:%d\n", __FUNCTION__, bForcePowerSave); - - pwlanhdr = (struct rtw_ieee80211_hdr*)pframe; - - fctrl = &pwlanhdr->frame_ctl; - *(fctrl) = 0; - if (bForcePowerSave) - { - SetPwrMgt(fctrl); - } - - switch(cur_network->network.InfrastructureMode) - { - case Ndis802_11Infrastructure: - SetToDs(fctrl); - _rtw_memcpy(pwlanhdr->addr1, get_my_bssid(&(pmlmeinfo->network)), ETH_ALEN); - _rtw_memcpy(pwlanhdr->addr2, myid(&(padapter->eeprompriv)), ETH_ALEN); - _rtw_memcpy(pwlanhdr->addr3, StaAddr, ETH_ALEN); - break; - case Ndis802_11APMode: - SetFrDs(fctrl); - _rtw_memcpy(pwlanhdr->addr1, StaAddr, ETH_ALEN); - _rtw_memcpy(pwlanhdr->addr2, get_my_bssid(&(pmlmeinfo->network)), ETH_ALEN); - _rtw_memcpy(pwlanhdr->addr3, myid(&(padapter->eeprompriv)), ETH_ALEN); - break; - case Ndis802_11IBSS: - default: - _rtw_memcpy(pwlanhdr->addr1, StaAddr, ETH_ALEN); - _rtw_memcpy(pwlanhdr->addr2, myid(&(padapter->eeprompriv)), ETH_ALEN); - _rtw_memcpy(pwlanhdr->addr3, get_my_bssid(&(pmlmeinfo->network)), ETH_ALEN); - break; - } - - SetSeqNum(pwlanhdr, 0); - - if (bQoS == _TRUE) { - struct rtw_ieee80211_hdr_3addr_qos *pwlanqoshdr; - - SetFrameSubType(pframe, WIFI_QOS_DATA_NULL); - - pwlanqoshdr = (struct rtw_ieee80211_hdr_3addr_qos*)pframe; - SetPriority(&pwlanqoshdr->qc, AC); - SetEOSP(&pwlanqoshdr->qc, bEosp); - - pktlen = sizeof(struct rtw_ieee80211_hdr_3addr_qos); - } else { - SetFrameSubType(pframe, WIFI_DATA_NULL); - - pktlen = sizeof(struct rtw_ieee80211_hdr_3addr); - } - - *pLength = pktlen; -} - -void ConstructProbeRsp(struct adapter *padapter, u8 *pframe, u32 *pLength, u8 *StaAddr, BOOLEAN bHideSSID) -{ - struct rtw_ieee80211_hdr *pwlanhdr; - u16 *fctrl; - u8 *mac, *bssid; - u32 pktlen; - struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); - struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); - WLAN_BSSID_EX *cur_network = &(pmlmeinfo->network); - - - //DBG_871X("%s\n", __FUNCTION__); - - pwlanhdr = (struct rtw_ieee80211_hdr *)pframe; - - mac = myid(&(padapter->eeprompriv)); - bssid = cur_network->MacAddress; - - fctrl = &(pwlanhdr->frame_ctl); - *(fctrl) = 0; - _rtw_memcpy(pwlanhdr->addr1, StaAddr, ETH_ALEN); - _rtw_memcpy(pwlanhdr->addr2, mac, ETH_ALEN); - _rtw_memcpy(pwlanhdr->addr3, bssid, ETH_ALEN); - - SetSeqNum(pwlanhdr, 0); - SetFrameSubType(fctrl, WIFI_PROBERSP); - - pktlen = sizeof(struct rtw_ieee80211_hdr_3addr); - pframe += pktlen; - - if(cur_network->IELength>MAX_IE_SZ) - return; - - _rtw_memcpy(pframe, cur_network->IEs, cur_network->IELength); - pframe += cur_network->IELength; - pktlen += cur_network->IELength; - - *pLength = pktlen; -} - -#ifdef CONFIG_WOWLAN -// -// Description: -// Construct the ARP response packet to support ARP offload. -// -static void ConstructARPResponse( - struct adapter *padapter, - u8 *pframe, - u32 *pLength, - u8 *pIPAddress - ) -{ - struct rtw_ieee80211_hdr *pwlanhdr; - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - struct wlan_network *cur_network = &pmlmepriv->cur_network; - struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); - struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); - struct security_priv *psecuritypriv = &padapter->securitypriv; - static u8 ARPLLCHeader[8] = {0xAA, 0xAA, 0x03, 0x00, 0x00, 0x00, 0x08, 0x06}; - - u16 *fctrl; - u32 pktlen; - u8 *pARPRspPkt = pframe; - //for TKIP Cal MIC - u8 *payload = pframe; - u8 EncryptionHeadOverhead = 0; - - pwlanhdr = (struct rtw_ieee80211_hdr*)pframe; - - fctrl = &pwlanhdr->frame_ctl; - *(fctrl) = 0; - - //------------------------------------------------------------------------- - // MAC Header. - //------------------------------------------------------------------------- - SetFrameType(fctrl, WIFI_DATA); - //SetFrameSubType(fctrl, 0); - SetToDs(fctrl); - _rtw_memcpy(pwlanhdr->addr1, get_my_bssid(&(pmlmeinfo->network)), ETH_ALEN); - _rtw_memcpy(pwlanhdr->addr2, myid(&(padapter->eeprompriv)), ETH_ALEN); - _rtw_memcpy(pwlanhdr->addr3, get_my_bssid(&(pmlmeinfo->network)), ETH_ALEN); - - SetSeqNum(pwlanhdr, 0); - SetDuration(pwlanhdr, 0); - //SET_80211_HDR_FRAME_CONTROL(pARPRspPkt, 0); - //SET_80211_HDR_TYPE_AND_SUBTYPE(pARPRspPkt, Type_Data); - //SET_80211_HDR_TO_DS(pARPRspPkt, 1); - //SET_80211_HDR_ADDRESS1(pARPRspPkt, pMgntInfo->Bssid); - //SET_80211_HDR_ADDRESS2(pARPRspPkt, Adapter->CurrentAddress); - //SET_80211_HDR_ADDRESS3(pARPRspPkt, pMgntInfo->Bssid); - - //SET_80211_HDR_DURATION(pARPRspPkt, 0); - //SET_80211_HDR_FRAGMENT_SEQUENCE(pARPRspPkt, 0); - *pLength = 24; - -//YJ,del,120503 -#if 0 - //------------------------------------------------------------------------- - // Qos Header: leave space for it if necessary. - //------------------------------------------------------------------------- - if(pStaQos->CurrentQosMode > QOS_DISABLE) - { - SET_80211_HDR_QOS_EN(pARPRspPkt, 1); - PlatformZeroMemory(&(Buffer[*pLength]), sQoSCtlLng); - *pLength += sQoSCtlLng; - } -#endif - //------------------------------------------------------------------------- - // Security Header: leave space for it if necessary. - //------------------------------------------------------------------------- - - switch (psecuritypriv->dot11PrivacyAlgrthm) - { - case _WEP40_: - case _WEP104_: - EncryptionHeadOverhead = 4; - break; - case _TKIP_: - EncryptionHeadOverhead = 8; - break; - case _AES_: - EncryptionHeadOverhead = 8; - break; -#ifdef CONFIG_WAPI_SUPPORT - case _SMS4_: - EncryptionHeadOverhead = 18; - break; -#endif - default: - EncryptionHeadOverhead = 0; - } - - if(EncryptionHeadOverhead > 0) - { - _rtw_memset(&(pframe[*pLength]), 0,EncryptionHeadOverhead); - *pLength += EncryptionHeadOverhead; - //SET_80211_HDR_WEP(pARPRspPkt, 1); //Suggested by CCW. - SetPrivacy(fctrl); - } - - //------------------------------------------------------------------------- - // Frame Body. - //------------------------------------------------------------------------- - pARPRspPkt = (u8*)(pframe+ *pLength); - // LLC header - _rtw_memcpy(pARPRspPkt, ARPLLCHeader, 8); - *pLength += 8; - - // ARP element - pARPRspPkt += 8; - SET_ARP_PKT_HW(pARPRspPkt, 0x0100); - SET_ARP_PKT_PROTOCOL(pARPRspPkt, 0x0008); // IP protocol - SET_ARP_PKT_HW_ADDR_LEN(pARPRspPkt, 6); - SET_ARP_PKT_PROTOCOL_ADDR_LEN(pARPRspPkt, 4); - SET_ARP_PKT_OPERATION(pARPRspPkt, 0x0200); // ARP response - SET_ARP_PKT_SENDER_MAC_ADDR(pARPRspPkt, myid(&(padapter->eeprompriv))); - SET_ARP_PKT_SENDER_IP_ADDR(pARPRspPkt, pIPAddress); -#ifdef CONFIG_ARP_KEEP_ALIVE - if (rtw_gw_addr_query(padapter)==0) { - SET_ARP_PKT_TARGET_MAC_ADDR(pARPRspPkt, pmlmepriv->gw_mac_addr); - SET_ARP_PKT_TARGET_IP_ADDR(pARPRspPkt, pmlmepriv->gw_ip); - } - else -#endif - { - SET_ARP_PKT_TARGET_MAC_ADDR(pARPRspPkt, get_my_bssid(&(pmlmeinfo->network))); - SET_ARP_PKT_TARGET_IP_ADDR(pARPRspPkt, pIPAddress); - DBG_871X("%s Target Mac Addr:" MAC_FMT "\n", __FUNCTION__, MAC_ARG(get_my_bssid(&(pmlmeinfo->network)))); - DBG_871X("%s Target IP Addr" IP_FMT "\n", __FUNCTION__, IP_ARG(pIPAddress)); - } - *pLength += 28; - if (psecuritypriv->dot11PrivacyAlgrthm == _TKIP_) - { - u8 mic[8]; - struct mic_data micdata; - struct sta_info *psta = NULL; - u8 priority[4]={0x0,0x0,0x0,0x0}; - u8 null_key[16]={0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0}; - - DBG_871X("%s(): Add MIC\n",__FUNCTION__); - - psta = rtw_get_stainfo(&padapter->stapriv, get_my_bssid(&(pmlmeinfo->network))); - if (psta != NULL) { - if(_rtw_memcmp(&psta->dot11tkiptxmickey.skey[0],null_key, 16)==_TRUE){ - DBG_871X("%s(): STA dot11tkiptxmickey==0\n",__FUNCTION__); - } - //start to calculate the mic code - rtw_secmicsetkey(&micdata, &psta->dot11tkiptxmickey.skey[0]); - } - - rtw_secmicappend(&micdata, pwlanhdr->addr3, 6); //DA - - rtw_secmicappend(&micdata, pwlanhdr->addr2, 6); //SA - - priority[0]=0; - rtw_secmicappend(&micdata, &priority[0], 4); - - rtw_secmicappend(&micdata, payload, 36); //payload length = 8 + 28 - - rtw_secgetmic(&micdata,&(mic[0])); - - pARPRspPkt += 28; - _rtw_memcpy(pARPRspPkt, &(mic[0]),8); - - *pLength += 8; - } -} -#endif - -void rtl8188e_set_FwRsvdPage_cmd(struct adapter *padapter, PRSVDPAGE_LOC rsvdpageloc) -{ - u8 u1H2CRsvdPageParm[H2C_8188E_RSVDPAGE_LOC_LEN]={0}; - u8 u1H2CAoacRsvdPageParm[H2C_8188E_AOAC_RSVDPAGE_LOC_LEN]={0}; - - //DBG_871X("8188RsvdPageLoc: PsPoll=%d Null=%d QoSNull=%d\n", - // rsvdpageloc->LocPsPoll, rsvdpageloc->LocNullData, rsvdpageloc->LocQosNull); - - SET_8188E_H2CCMD_RSVDPAGE_LOC_PSPOLL(u1H2CRsvdPageParm, rsvdpageloc->LocPsPoll); - SET_8188E_H2CCMD_RSVDPAGE_LOC_NULL_DATA(u1H2CRsvdPageParm, rsvdpageloc->LocNullData); - SET_8188E_H2CCMD_RSVDPAGE_LOC_QOS_NULL_DATA(u1H2CRsvdPageParm, rsvdpageloc->LocQosNull); - - FillH2CCmd_88E(padapter, H2C_COM_RSVD_PAGE, H2C_8188E_RSVDPAGE_LOC_LEN, u1H2CRsvdPageParm); - -#ifdef CONFIG_WOWLAN - //DBG_871X("8188E_AOACRsvdPageLoc: RWC=%d ArpRsp=%d\n", rsvdpageloc->LocRemoteCtrlInfo, rsvdpageloc->LocArpRsp); - SET_8188E_H2CCMD_AOAC_RSVDPAGE_LOC_REMOTE_WAKE_CTRL_INFO(u1H2CAoacRsvdPageParm, rsvdpageloc->LocRemoteCtrlInfo); - SET_8188E_H2CCMD_AOAC_RSVDPAGE_LOC_ARP_RSP(u1H2CAoacRsvdPageParm, rsvdpageloc->LocArpRsp); - - FillH2CCmd_88E(padapter, H2C_COM_AOAC_RSVD_PAGE, H2C_8188E_AOAC_RSVDPAGE_LOC_LEN, u1H2CAoacRsvdPageParm); -#endif -} - -// To check if reserved page content is destroyed by beacon beacuse beacon is too large. -// 2010.06.23. Added by tynli. -VOID -CheckFwRsvdPageContent( - IN struct adapter * Adapter -) -{ - HAL_DATA_TYPE* pHalData = GET_HAL_DATA(Adapter); - u32 MaxBcnPageNum; - - if(pHalData->FwRsvdPageStartOffset != 0) - { - /*MaxBcnPageNum = PageNum_128(pMgntInfo->MaxBeaconSize); - RT_ASSERT((MaxBcnPageNum <= pHalData->FwRsvdPageStartOffset), - ("CheckFwRsvdPageContent(): The reserved page content has been"\ - "destroyed by beacon!!! MaxBcnPageNum(%d) FwRsvdPageStartOffset(%d)\n!", - MaxBcnPageNum, pHalData->FwRsvdPageStartOffset));*/ - } -} - -// -// Description: Fill the reserved packets that FW will use to RSVD page. -// Now we just send 4 types packet to rsvd page. -// (1)Beacon, (2)Ps-poll, (3)Null data, (4)ProbeRsp. -// Input: -// bDLFinished - FALSE: At the first time we will send all the packets as a large packet to Hw, -// so we need to set the packet length to total lengh. -// TRUE: At the second time, we should send the first packet (default:beacon) -// to Hw again and set the lengh in descriptor to the real beacon lengh. -// 2009.10.15 by tynli. -static void SetFwRsvdPagePkt(struct adapter *padapter, BOOLEAN bDLFinished) -{ - PHAL_DATA_TYPE pHalData; - struct xmit_frame *pmgntframe; - struct pkt_attrib *pattrib; - struct xmit_priv *pxmitpriv; - struct mlme_ext_priv *pmlmeext; - struct mlme_ext_info *pmlmeinfo; - u32 BeaconLength, ProbeRspLength, PSPollLength; - u32 NullDataLength, QosNullLength, BTQosNullLength; - u8 *ReservedPagePacket; - u8 PageNum, PageNeed, TxDescLen; - u16 BufIndex; - u32 TotalPacketLen; - RSVDPAGE_LOC RsvdPageLoc; -#ifdef CONFIG_WOWLAN - u32 ARPLegnth = 0; - struct security_priv *psecuritypriv = &padapter->securitypriv; - u8 currentip[4]; - u8 cur_dot11txpn[8]; -#endif - - DBG_871X("%s\n", __FUNCTION__); - - ReservedPagePacket = (u8*)rtw_zmalloc(RTL88E_RSVDPAGE_SIZE); - if (ReservedPagePacket == NULL) { - DBG_871X("%s: alloc ReservedPagePacket fail!\n", __FUNCTION__); - return; - } - - pHalData = GET_HAL_DATA(padapter); - pxmitpriv = &padapter->xmitpriv; - pmlmeext = &padapter->mlmeextpriv; - pmlmeinfo = &pmlmeext->mlmext_info; - - TxDescLen = TXDESC_SIZE; - PageNum = 0; - - //3 (1) beacon * 2 pages - BufIndex = TXDESC_OFFSET; - ConstructBeacon(padapter, &ReservedPagePacket[BufIndex], &BeaconLength); - - // When we count the first page size, we need to reserve description size for the RSVD - // packet, it will be filled in front of the packet in TXPKTBUF. - PageNeed = (u8)PageNum_128(TxDescLen + BeaconLength); - // To reserved 2 pages for beacon buffer. 2010.06.24. - if (PageNeed == 1) - PageNeed += 1; - PageNum += PageNeed; - pHalData->FwRsvdPageStartOffset = PageNum; - - BufIndex += PageNeed*128; - - //3 (2) ps-poll *1 page - RsvdPageLoc.LocPsPoll = PageNum; - ConstructPSPoll(padapter, &ReservedPagePacket[BufIndex], &PSPollLength); - rtl8188e_fill_fake_txdesc(padapter, &ReservedPagePacket[BufIndex-TxDescLen], PSPollLength, _TRUE, _FALSE); - - PageNeed = (u8)PageNum_128(TxDescLen + PSPollLength); - PageNum += PageNeed; - - BufIndex += PageNeed*128; - - //3 (3) null data * 1 page - RsvdPageLoc.LocNullData = PageNum; - ConstructNullFunctionData( - padapter, - &ReservedPagePacket[BufIndex], - &NullDataLength, - get_my_bssid(&pmlmeinfo->network), - _FALSE, 0, 0, _FALSE); - rtl8188e_fill_fake_txdesc(padapter, &ReservedPagePacket[BufIndex-TxDescLen], NullDataLength, _FALSE, _FALSE); - - PageNeed = (u8)PageNum_128(TxDescLen + NullDataLength); - PageNum += PageNeed; - - BufIndex += PageNeed*128; - - //3 (5) Qos null data - RsvdPageLoc.LocQosNull = PageNum; - ConstructNullFunctionData( - padapter, - &ReservedPagePacket[BufIndex], - &QosNullLength, - get_my_bssid(&pmlmeinfo->network), - _TRUE, 0, 0, _FALSE); - rtl8188e_fill_fake_txdesc(padapter, &ReservedPagePacket[BufIndex-TxDescLen], QosNullLength, _FALSE, _FALSE); - - PageNeed = (u8)PageNum_128(TxDescLen + QosNullLength); - PageNum += PageNeed; - - BufIndex += PageNeed*128; - -#ifdef CONFIG_WOWLAN - //3(7) ARP - rtw_get_current_ip_address(padapter, currentip); - RsvdPageLoc.LocArpRsp = PageNum; - ConstructARPResponse( - padapter, - &ReservedPagePacket[BufIndex], - &ARPLegnth, - currentip - ); - rtl8188e_fill_fake_txdesc(padapter, &ReservedPagePacket[BufIndex-TxDescLen], ARPLegnth, _FALSE, _FALSE); - - switch (psecuritypriv->dot11PrivacyAlgrthm) - { - case _WEP40_: - case _WEP104_: - case _TKIP_: - ReservedPagePacket[BufIndex-TxDescLen+6] |= BIT(6); - break; - case _AES_: - ReservedPagePacket[BufIndex-TxDescLen+6] |= BIT(6)|BIT(7); - break; -#ifdef CONFIG_WAPI_SUPPORT - case _SMS4_: - ReservedPagePacket[BufIndex-TxDescLen+6] |= BIT(7); - break; -#endif - default: - ; - } - - PageNeed = (u8)PageNum_128(TxDescLen + ARPLegnth); - PageNum += PageNeed; - - BufIndex += PageNeed*128; - - //3(8) sec IV - rtw_get_sec_iv(padapter, cur_dot11txpn, get_my_bssid(&pmlmeinfo->network)); - RsvdPageLoc.LocRemoteCtrlInfo = PageNum; - _rtw_memcpy(ReservedPagePacket+BufIndex-TxDescLen, cur_dot11txpn, 8); - - TotalPacketLen = BufIndex-TxDescLen + sizeof (union pn48); //IV len -#else - TotalPacketLen = BufIndex + QosNullLength; -#endif - - pmgntframe = alloc_mgtxmitframe(pxmitpriv); - if (pmgntframe == NULL) - goto exit; - - // update attribute - pattrib = &pmgntframe->attrib; - update_mgntframe_attrib(padapter, pattrib); - pattrib->qsel = 0x10; - pattrib->pktlen = pattrib->last_txcmdsz = TotalPacketLen - TXDESC_OFFSET; - - if (TotalPacketLen < RTL88E_RSVDPAGE_SIZE) - _rtw_memcpy(pmgntframe->buf_addr, ReservedPagePacket, TotalPacketLen); - else - DBG_871X("%s: memory copy fail at Line: %d\n", __FUNCTION__, __LINE__); - - rtw_hal_mgnt_xmit(padapter, pmgntframe); - - DBG_871X("%s: Set RSVD page location to Fw\n", __FUNCTION__); - rtl8188e_set_FwRsvdPage_cmd(padapter, &RsvdPageLoc); - //FillH2CCmd_88E(padapter, H2C_COM_RSVD_PAGE, sizeof(RsvdPageLoc), (u8*)&RsvdPageLoc); - -exit: - rtw_mfree(ReservedPagePacket, RTL88E_RSVDPAGE_SIZE); -} - -void rtl8188e_set_FwJoinBssReport_cmd(struct adapter *padapter, u8 mstatus) -{ - JOINBSSRPT_PARM JoinBssRptParm; - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter); - struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); - struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); -#ifdef CONFIG_WOWLAN - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - struct sta_info *psta = NULL; -#endif - BOOLEAN bSendBeacon=_FALSE; - BOOLEAN bcn_valid = _FALSE; - u8 DLBcnCount=0; - u32 poll = 0; - -_func_enter_; - - DBG_871X("%s mstatus(%x)\n", __FUNCTION__,mstatus); - - if(mstatus == 1) - { - // We should set AID, correct TSF, HW seq enable before set JoinBssReport to Fw in 88/92C. - // Suggested by filen. Added by tynli. - rtw_write16(padapter, REG_BCN_PSR_RPT, (0xC000|pmlmeinfo->aid)); - // Do not set TSF again here or vWiFi beacon DMA INT will not work. - //correct_TSF(padapter, pmlmeext); - // Hw sequende enable by dedault. 2010.06.23. by tynli. - //rtw_write16(padapter, REG_NQOS_SEQ, ((pmlmeext->mgnt_seq+100)&0xFFF)); - //rtw_write8(padapter, REG_HWSEQ_CTRL, 0xFF); - - //Set REG_CR bit 8. DMA beacon by SW. - pHalData->RegCR_1 |= BIT0; - rtw_write8(padapter, REG_CR+1, pHalData->RegCR_1); - - // Disable Hw protection for a time which revserd for Hw sending beacon. - // Fix download reserved page packet fail that access collision with the protection time. - // 2010.05.11. Added by tynli. - //SetBcnCtrlReg(padapter, 0, BIT3); - //SetBcnCtrlReg(padapter, BIT4, 0); - rtw_write8(padapter, REG_BCN_CTRL, rtw_read8(padapter, REG_BCN_CTRL)&(~BIT(3))); - rtw_write8(padapter, REG_BCN_CTRL, rtw_read8(padapter, REG_BCN_CTRL)|BIT(4)); - - if(pHalData->RegFwHwTxQCtrl&BIT6) - { - DBG_871X("HalDownloadRSVDPage(): There is an Adapter is sending beacon.\n"); - bSendBeacon = _TRUE; - } - - // Set FWHW_TXQ_CTRL 0x422[6]=0 to tell Hw the packet is not a real beacon frame. - rtw_write8(padapter, REG_FWHW_TXQ_CTRL+2, (pHalData->RegFwHwTxQCtrl&(~BIT6))); - pHalData->RegFwHwTxQCtrl &= (~BIT6); - - // Clear beacon valid check bit. - rtw_hal_set_hwreg(padapter, HW_VAR_BCN_VALID, NULL); - DLBcnCount = 0; - poll = 0; - do - { - // download rsvd page. - SetFwRsvdPagePkt(padapter, _FALSE); - DLBcnCount++; - do - { - rtw_yield_os(); - //rtw_mdelay_os(10); - // check rsvd page download OK. - rtw_hal_get_hwreg(padapter, HW_VAR_BCN_VALID, (u8*)(&bcn_valid)); - poll++; - } while(!bcn_valid && (poll%10)!=0 && !padapter->bSurpriseRemoved && !padapter->bDriverStopped); - - }while(!bcn_valid && DLBcnCount<=100 && !padapter->bSurpriseRemoved && !padapter->bDriverStopped); - - //RT_ASSERT(bcn_valid, ("HalDownloadRSVDPage88ES(): 1 Download RSVD page failed!\n")); - if(padapter->bSurpriseRemoved || padapter->bDriverStopped) - { - } - else if(!bcn_valid) - DBG_871X("%s: 1 Download RSVD page failed! DLBcnCount:%u, poll:%u\n", __FUNCTION__ ,DLBcnCount, poll); - else - DBG_871X("%s: 1 Download RSVD success! DLBcnCount:%u, poll:%u\n", __FUNCTION__, DLBcnCount, poll); - // - // We just can send the reserved page twice during the time that Tx thread is stopped (e.g. pnpsetpower) - // becuase we need to free the Tx BCN Desc which is used by the first reserved page packet. - // At run time, we cannot get the Tx Desc until it is released in TxHandleInterrupt() so we will return - // the beacon TCB in the following code. 2011.11.23. by tynli. - // - //if(bcn_valid && padapter->bEnterPnpSleep) - if(0) - { - if(bSendBeacon) - { - rtw_hal_set_hwreg(padapter, HW_VAR_BCN_VALID, NULL); - DLBcnCount = 0; - poll = 0; - do - { - SetFwRsvdPagePkt(padapter, _TRUE); - DLBcnCount++; - - do - { - rtw_yield_os(); - //rtw_mdelay_os(10); - // check rsvd page download OK. - rtw_hal_get_hwreg(padapter, HW_VAR_BCN_VALID, (u8*)(&bcn_valid)); - poll++; - } while(!bcn_valid && (poll%10)!=0 && !padapter->bSurpriseRemoved && !padapter->bDriverStopped); - }while(!bcn_valid && DLBcnCount<=100 && !padapter->bSurpriseRemoved && !padapter->bDriverStopped); - - //RT_ASSERT(bcn_valid, ("HalDownloadRSVDPage(): 2 Download RSVD page failed!\n")); - if(padapter->bSurpriseRemoved || padapter->bDriverStopped) - { - } - else if(!bcn_valid) - DBG_871X("%s: 2 Download RSVD page failed! DLBcnCount:%u, poll:%u\n", __FUNCTION__ ,DLBcnCount, poll); - else - DBG_871X("%s: 2 Download RSVD success! DLBcnCount:%u, poll:%u\n", __FUNCTION__, DLBcnCount, poll); - } - } - - // Enable Bcn - //SetBcnCtrlReg(padapter, BIT3, 0); - //SetBcnCtrlReg(padapter, 0, BIT4); - rtw_write8(padapter, REG_BCN_CTRL, rtw_read8(padapter, REG_BCN_CTRL)|BIT(3)); - rtw_write8(padapter, REG_BCN_CTRL, rtw_read8(padapter, REG_BCN_CTRL)&(~BIT(4))); - - // To make sure that if there exists an adapter which would like to send beacon. - // If exists, the origianl value of 0x422[6] will be 1, we should check this to - // prevent from setting 0x422[6] to 0 after download reserved page, or it will cause - // the beacon cannot be sent by HW. - // 2010.06.23. Added by tynli. - if(bSendBeacon) - { - rtw_write8(padapter, REG_FWHW_TXQ_CTRL+2, (pHalData->RegFwHwTxQCtrl|BIT6)); - pHalData->RegFwHwTxQCtrl |= BIT6; - } - - // - // Update RSVD page location H2C to Fw. - // - if(bcn_valid) - { - rtw_hal_set_hwreg(padapter, HW_VAR_BCN_VALID, NULL); - DBG_871X("Set RSVD page location to Fw.\n"); - //FillH2CCmd88E(Adapter, H2C_88E_RSVDPAGE, H2C_RSVDPAGE_LOC_LENGTH, pMgntInfo->u1RsvdPageLoc); - } - - // Do not enable HW DMA BCN or it will cause Pcie interface hang by timing issue. 2011.11.24. by tynli. - //if(!padapter->bEnterPnpSleep) - { - // Clear CR[8] or beacon packet will not be send to TxBuf anymore. - pHalData->RegCR_1 &= (~BIT0); - rtw_write8(padapter, REG_CR+1, pHalData->RegCR_1); - } - } -#ifdef CONFIG_WOWLAN - if (adapter_to_pwrctl(padapter)->wowlan_mode){ - JoinBssRptParm.OpMode = mstatus; - psta = rtw_get_stainfo(&padapter->stapriv, get_bssid(pmlmepriv)); - if (psta != NULL) { - JoinBssRptParm.MacID = psta->mac_id; - } else { - JoinBssRptParm.MacID = 0; - } - FillH2CCmd_88E(padapter, H2C_COM_MEDIA_STATUS_RPT, sizeof(JoinBssRptParm), (u8 *)&JoinBssRptParm); - DBG_871X_LEVEL(_drv_info_, "%s opmode:%d MacId:%d\n", __func__, JoinBssRptParm.OpMode, JoinBssRptParm.MacID); - } else { - DBG_871X_LEVEL(_drv_info_, "%s wowlan_mode is off\n", __func__); - } -#endif //CONFIG_WOWLAN -_func_exit_; -} - -#ifdef CONFIG_P2P_PS -void rtl8188e_set_p2p_ps_offload_cmd(struct adapter* padapter, u8 p2p_ps_state) -{ - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter); - struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter); - struct wifidirect_info *pwdinfo = &( padapter->wdinfo ); - struct P2P_PS_Offload_t *p2p_ps_offload = &pHalData->p2p_ps_offload; - u8 i; - -_func_enter_; - -#if 1 - switch(p2p_ps_state) - { - case P2P_PS_DISABLE: - DBG_8192C("P2P_PS_DISABLE \n"); - _rtw_memset(p2p_ps_offload, 0 ,1); - break; - case P2P_PS_ENABLE: - DBG_8192C("P2P_PS_ENABLE \n"); - // update CTWindow value. - if( pwdinfo->ctwindow > 0 ) - { - p2p_ps_offload->CTWindow_En = 1; - rtw_write8(padapter, REG_P2P_CTWIN, pwdinfo->ctwindow); - } - - // hw only support 2 set of NoA - for( i=0 ; inoa_num ; i++) - { - // To control the register setting for which NOA - rtw_write8(padapter, REG_NOA_DESC_SEL, (i << 4)); - if(i == 0) - p2p_ps_offload->NoA0_En = 1; - else - p2p_ps_offload->NoA1_En = 1; - - // config P2P NoA Descriptor Register - //DBG_8192C("%s(): noa_duration = %x\n",__FUNCTION__,pwdinfo->noa_duration[i]); - rtw_write32(padapter, REG_NOA_DESC_DURATION, pwdinfo->noa_duration[i]); - - //DBG_8192C("%s(): noa_interval = %x\n",__FUNCTION__,pwdinfo->noa_interval[i]); - rtw_write32(padapter, REG_NOA_DESC_INTERVAL, pwdinfo->noa_interval[i]); - - //DBG_8192C("%s(): start_time = %x\n",__FUNCTION__,pwdinfo->noa_start_time[i]); - rtw_write32(padapter, REG_NOA_DESC_START, pwdinfo->noa_start_time[i]); - - //DBG_8192C("%s(): noa_count = %x\n",__FUNCTION__,pwdinfo->noa_count[i]); - rtw_write8(padapter, REG_NOA_DESC_COUNT, pwdinfo->noa_count[i]); - } - - if( (pwdinfo->opp_ps == 1) || (pwdinfo->noa_num > 0) ) - { - // rst p2p circuit - rtw_write8(padapter, REG_DUAL_TSF_RST, BIT(4)); - - p2p_ps_offload->Offload_En = 1; - - if(pwdinfo->role == P2P_ROLE_GO) - { - p2p_ps_offload->role= 1; - p2p_ps_offload->AllStaSleep = 0; - } - else - { - p2p_ps_offload->role= 0; - } - - p2p_ps_offload->discovery = 0; - } - break; - case P2P_PS_SCAN: - DBG_8192C("P2P_PS_SCAN \n"); - p2p_ps_offload->discovery = 1; - break; - case P2P_PS_SCAN_DONE: - DBG_8192C("P2P_PS_SCAN_DONE \n"); - p2p_ps_offload->discovery = 0; - pwdinfo->p2p_ps_state = P2P_PS_ENABLE; - break; - default: - break; - } - - FillH2CCmd_88E(padapter, H2C_PS_P2P_OFFLOAD, 1, (u8 *)p2p_ps_offload); -#endif - -_func_exit_; - -} -#endif //CONFIG_P2P_PS - -#ifdef CONFIG_TSF_RESET_OFFLOAD -/* - ask FW to Reset sync register at Beacon early interrupt -*/ -u8 rtl8188e_reset_tsf(struct adapter *padapter, u8 reset_port ) -{ - u8 buf[2]; - u8 res=_SUCCESS; - - s32 ret; -_func_enter_; - if (IFACE_PORT0==reset_port) { - buf[0] = 0x1; buf[1] = 0; - } else{ - buf[0] = 0x0; buf[1] = 0x1; - } - - ret = FillH2CCmd_88E(padapter, H2C_RESET_TSF, 2, buf); - -_func_exit_; - - return res; -} - -int reset_tsf(struct adapter *Adapter, u8 reset_port ) -{ - u8 reset_cnt_before = 0, reset_cnt_after = 0, loop_cnt = 0; - u32 reg_reset_tsf_cnt = (IFACE_PORT0==reset_port) ? - REG_FW_RESET_TSF_CNT_0:REG_FW_RESET_TSF_CNT_1; - u32 reg_bcncrtl = (IFACE_PORT0==reset_port) ? - REG_BCN_CTRL_1:REG_BCN_CTRL; - - rtw_scan_abort(Adapter->pbuddy_adapter); /* site survey will cause reset_tsf fail */ - reset_cnt_after = reset_cnt_before = rtw_read8(Adapter,reg_reset_tsf_cnt); - rtl8188e_reset_tsf(Adapter, reset_port); - - while ((reset_cnt_after == reset_cnt_before ) && (loop_cnt < 10)) { - rtw_msleep_os(100); - loop_cnt++; - reset_cnt_after = rtw_read8(Adapter, reg_reset_tsf_cnt); - } - - return(loop_cnt >= 10) ? _FAIL : _TRUE; -} - - -#endif // CONFIG_TSF_RESET_OFFLOAD - -#ifdef CONFIG_WOWLAN -#ifdef CONFIG_GPIO_WAKEUP -void rtl8188es_set_output_gpio(struct adapter* padapter, u8 index, u8 outputval) -{ - if ( index <= 7 ) { - /* config GPIO mode */ - rtw_write8(padapter, REG_GPIO_PIN_CTRL + 3, rtw_read8(padapter, REG_GPIO_PIN_CTRL + 3) & ~BIT(index) ); - - /* config GPIO Sel */ - /* 0: input */ - /* 1: output */ - rtw_write8(padapter, REG_GPIO_PIN_CTRL + 2, rtw_read8(padapter, REG_GPIO_PIN_CTRL + 2) | BIT(index)); - - /* set output value */ - if ( outputval ) { - rtw_write8(padapter, REG_GPIO_PIN_CTRL + 1, rtw_read8(padapter, REG_GPIO_PIN_CTRL + 1) | BIT(index)); - } else { - rtw_write8(padapter, REG_GPIO_PIN_CTRL + 1, rtw_read8(padapter, REG_GPIO_PIN_CTRL + 1) & ~BIT(index)); - } - } else { - /* 88C Series: */ - /* index: 11~8 transform to 3~0 */ - /* 8723 Series: */ - /* index: 12~8 transform to 4~0 */ - index -= 8; - - /* config GPIO mode */ - rtw_write8(padapter, REG_GPIO_PIN_CTRL_2 + 3, rtw_read8(padapter, REG_GPIO_PIN_CTRL_2 + 3) & ~BIT(index) ); - - /* config GPIO Sel */ - /* 0: input */ - /* 1: output */ - rtw_write8(padapter, REG_GPIO_PIN_CTRL_2 + 2, rtw_read8(padapter, REG_GPIO_PIN_CTRL_2 + 2) | BIT(index)); - - /* set output value */ - if ( outputval ) { - rtw_write8(padapter, REG_GPIO_PIN_CTRL_2 + 1, rtw_read8(padapter, REG_GPIO_PIN_CTRL_2 + 1) | BIT(index)); - } else { - rtw_write8(padapter, REG_GPIO_PIN_CTRL_2 + 1, rtw_read8(padapter, REG_GPIO_PIN_CTRL_2 + 1) & ~BIT(index)); - } - } -} -#endif //CONFIG_GPIO_WAKEUP - -void rtl8188es_set_wowlan_cmd(struct adapter* padapter, u8 enable) -{ - u8 res=_SUCCESS; - u32 test=0; - struct recv_priv *precvpriv = &padapter->recvpriv; - SETWOWLAN_PARM pwowlan_parm; - SETAOAC_GLOBAL_INFO paoac_global_info_parm; - struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter); - struct security_priv *psecpriv = &padapter->securitypriv; -#ifdef CONFIG_GPIO_WAKEUP - u8 gpio_wake_pin = 7; - u8 gpio_high_active = 0; //default low active -#endif - -_func_enter_; - DBG_871X_LEVEL(_drv_always_, "+%s+\n", __func__); - - pwowlan_parm.mode =0; - pwowlan_parm.gpio_index=0; - pwowlan_parm.gpio_duration=0; - pwowlan_parm.second_mode =0; - pwowlan_parm.reserve=0; - - if(enable){ - - pwowlan_parm.mode |=FW_WOWLAN_FUN_EN; - pwrpriv->wowlan_magic =_TRUE; - if (psecpriv->dot11PrivacyAlgrthm == _WEP40_ || psecpriv->dot11PrivacyAlgrthm == _WEP104_) - pwrpriv->wowlan_unicast =_TRUE; - - if(pwrpriv->wowlan_pattern ==_TRUE){ - pwowlan_parm.mode |= FW_WOWLAN_PATTERN_MATCH; - DBG_871X_LEVEL(_drv_info_, "%s 2.pwowlan_parm.mode=0x%x \n",__FUNCTION__,pwowlan_parm.mode ); - } - if(pwrpriv->wowlan_magic ==_TRUE){ - pwowlan_parm.mode |=FW_WOWLAN_MAGIC_PKT; - DBG_871X_LEVEL(_drv_info_, "%s 3.pwowlan_parm.mode=0x%x \n",__FUNCTION__,pwowlan_parm.mode ); - } - if(pwrpriv->wowlan_unicast ==_TRUE){ - pwowlan_parm.mode |=FW_WOWLAN_UNICAST; - DBG_871X_LEVEL(_drv_info_, "%s 4.pwowlan_parm.mode=0x%x \n",__FUNCTION__,pwowlan_parm.mode ); - } - - pwowlan_parm.mode |=FW_WOWLAN_REKEY_WAKEUP; - pwowlan_parm.mode |=FW_WOWLAN_DEAUTH_WAKEUP; - - //DataPinWakeUp -#ifdef CONFIG_USB_HCI - pwowlan_parm.gpio_index=0x0; -#endif //CONFIG_USB_HCI - -#ifdef CONFIG_SDIO_HCI - pwowlan_parm.gpio_index = 0x80; -#endif //CONFIG_SDIO_HCI - -#ifdef CONFIG_GPIO_WAKEUP - pwowlan_parm.gpio_index = gpio_wake_pin; - - //WOWLAN_GPIO_ACTIVE means GPIO high active - //pwowlan_parm.mode |=FW_WOWLAN_GPIO_ACTIVE; - if (gpio_high_active) - pwowlan_parm.mode |=FW_WOWLAN_GPIO_ACTIVE; -#endif //CONFIG_GPIO_WAKEUP - - DBG_871X_LEVEL(_drv_info_, "%s 5.pwowlan_parm.mode=0x%x \n",__FUNCTION__,pwowlan_parm.mode); - DBG_871X_LEVEL(_drv_info_, "%s 6.pwowlan_parm.index=0x%x \n",__FUNCTION__,pwowlan_parm.gpio_index); - res = FillH2CCmd_88E(padapter, H2C_COM_WWLAN, 2, (u8 *)&pwowlan_parm); - - rtw_msleep_os(2); - - //disconnect decision - pwowlan_parm.mode =1; - pwowlan_parm.gpio_index=0; - pwowlan_parm.gpio_duration=0; - FillH2CCmd_88E(padapter, H2C_COM_DISCNT_DECISION, 3, (u8 *)&pwowlan_parm); - - //keep alive period = 10 * 10 BCN interval - pwowlan_parm.mode = FW_WOWLAN_KEEP_ALIVE_EN | FW_ADOPT_USER | FW_WOWLAN_KEEP_ALIVE_PKT_TYPE; - pwowlan_parm.gpio_index=10; - res = FillH2CCmd_88E(padapter, H2C_COM_KEEP_ALIVE, 2, (u8 *)&pwowlan_parm); - - rtw_msleep_os(2); - //Configure STA security information for GTK rekey wakeup event. - paoac_global_info_parm.pairwiseEncAlg= - padapter->securitypriv.dot11PrivacyAlgrthm; - paoac_global_info_parm.groupEncAlg= - padapter->securitypriv.dot118021XGrpPrivacy; - res = FillH2CCmd_88E(padapter, H2C_COM_AOAC_GLOBAL_INFO, 2, (u8 *)&paoac_global_info_parm); - - rtw_msleep_os(2); - //enable Remote wake ctrl - pwowlan_parm.mode = FW_REMOTE_WAKE_CTRL_EN | FW_WOW_FW_UNICAST_EN | FW_ARP_EN; - if (psecpriv->dot11PrivacyAlgrthm == _AES_ || psecpriv->dot11PrivacyAlgrthm == _NO_PRIVACY_) - { - pwowlan_parm.gpio_index=0; - } else { - pwowlan_parm.gpio_index=1; - } - pwowlan_parm.gpio_duration=0; - - res = FillH2CCmd_88E(padapter, H2C_COM_REMOTE_WAKE_CTRL, 3, (u8 *)&pwowlan_parm); - } else { - pwrpriv->wowlan_magic =_FALSE; -#ifdef CONFIG_GPIO_WAKEUP - rtl8188es_set_output_gpio(padapter, gpio_wake_pin, !gpio_high_active); -#endif //CONFIG_GPIO_WAKEUP - res = FillH2CCmd_88E(padapter, H2C_COM_WWLAN, 2, (u8 *)&pwowlan_parm); - rtw_msleep_os(2); - res = FillH2CCmd_88E(padapter, H2C_COM_REMOTE_WAKE_CTRL, 3, (u8 *)&pwowlan_parm); - } -_func_exit_; - DBG_871X_LEVEL(_drv_always_, "-%s res:%d-\n", __func__, res); - return ; -} -#endif //CONFIG_WOWLAN +/****************************************************************************** + * + * 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 + * + * + ******************************************************************************/ +#define _RTL8188E_CMD_C_ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#define CONFIG_H2C_EF + +#define RTL88E_MAX_H2C_BOX_NUMS 4 +#define RTL88E_MAX_CMD_LEN 7 +#define RTL88E_MESSAGE_BOX_SIZE 4 +#define RTL88E_EX_MESSAGE_BOX_SIZE 4 +#define RTL88E_RSVDPAGE_SIZE 1024 + +static u8 _is_fw_read_cmd_down(struct adapter* padapter, u8 msgbox_num) +{ + u8 read_down = _FALSE; + int retry_cnts = 100; + + u8 valid; + + //DBG_8192C(" _is_fw_read_cmd_down ,reg_1cc(%x),msg_box(%d)...\n",rtw_read8(padapter,REG_HMETFR),msgbox_num); + + do{ + valid = rtw_read8(padapter,REG_HMETFR) & BIT(msgbox_num); + if(0 == valid ){ + read_down = _TRUE; + } +#ifdef CONFIG_WOWLAN + rtw_msleep_os(2); +#endif + }while( (!read_down) && (retry_cnts--)); + + return read_down; + +} + + +/***************************************** +* H2C Msg format : +* 0x1DF - 0x1D0 +*| 31 - 8 | 7-5 4 - 0 | +*| h2c_msg |Class_ID CMD_ID | +* +* Extend 0x1FF - 0x1F0 +*|31 - 0 | +*|ext_msg| +******************************************/ +static s32 FillH2CCmd_88E(struct adapter *padapter, u8 ElementID, u32 CmdLen, u8 *pCmdBuffer) +{ + u8 bcmd_down = _FALSE; + s32 retry_cnts = 100; + u8 h2c_box_num; + u32 msgbox_addr; + u32 msgbox_ex_addr; + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter); + u8 cmd_idx,ext_cmd_len; + u32 h2c_cmd = 0; + u32 h2c_cmd_ex = 0; + s32 ret = _FAIL; + +_func_enter_; + + padapter = GET_PRIMARY_ADAPTER(padapter); + pHalData = GET_HAL_DATA(padapter); + + if(padapter->bFWReady == _FALSE) + { + DBG_8192C("FillH2CCmd_88E(): return H2C cmd because fw is not ready\n"); + return ret; + } + + _enter_critical_mutex(&(adapter_to_dvobj(padapter)->h2c_fwcmd_mutex), NULL); + + if (!pCmdBuffer) { + goto exit; + } + if (CmdLen > RTL88E_MAX_CMD_LEN) { + goto exit; + } + if (padapter->bSurpriseRemoved == _TRUE) + goto exit; + + //pay attention to if race condition happened in H2C cmd setting. + do{ + h2c_box_num = pHalData->LastHMEBoxNum; + + if(!_is_fw_read_cmd_down(padapter, h2c_box_num)){ + DBG_8192C(" fw read cmd failed...\n"); + goto exit; + } + + *(u8*)(&h2c_cmd) = ElementID; + + if(CmdLen<=3) + { + _rtw_memcpy((u8*)(&h2c_cmd)+1, pCmdBuffer, CmdLen ); + } + else{ + _rtw_memcpy((u8*)(&h2c_cmd)+1, pCmdBuffer,3); + ext_cmd_len = CmdLen-3; + _rtw_memcpy((u8*)(&h2c_cmd_ex), pCmdBuffer+3,ext_cmd_len ); + + //Write Ext command + msgbox_ex_addr = REG_HMEBOX_EXT_0 + (h2c_box_num *RTL88E_EX_MESSAGE_BOX_SIZE); + #ifdef CONFIG_H2C_EF + for(cmd_idx=0;cmd_idxh2c_cmd:0x%x, reg:0x%x =>h2c_cmd_ex:0x%x ..\n" + // ,pHalData->LastHMEBoxNum ,CmdLen,msgbox_addr,h2c_cmd,msgbox_ex_addr,h2c_cmd_ex); + + pHalData->LastHMEBoxNum = (h2c_box_num+1) % RTL88E_MAX_H2C_BOX_NUMS; + + }while((!bcmd_down) && (retry_cnts--)); + + ret = _SUCCESS; + +exit: + + _exit_critical_mutex(&(adapter_to_dvobj(padapter)->h2c_fwcmd_mutex), NULL); + +_func_exit_; + + return ret; +} + +u8 rtl8192c_h2c_msg_hdl(struct adapter *padapter, unsigned char *pbuf) +{ + u8 ElementID, CmdLen; + u8 *pCmdBuffer; + struct cmd_msg_parm *pcmdmsg; + + if(!pbuf) + return H2C_PARAMETERS_ERROR; + + pcmdmsg = (struct cmd_msg_parm*)pbuf; + ElementID = pcmdmsg->eid; + CmdLen = pcmdmsg->sz; + pCmdBuffer = pcmdmsg->buf; + + FillH2CCmd_88E(padapter, ElementID, CmdLen, pCmdBuffer); + + return H2C_SUCCESS; +} +/* +#if defined(CONFIG_AUTOSUSPEND) && defined(SUPPORT_HW_RFOFF_DETECTED) +u8 rtl8192c_set_FwSelectSuspend_cmd(struct adapter *padapter ,u8 bfwpoll, u16 period) +{ + u8 res=_SUCCESS; + struct H2C_SS_RFOFF_PARAM param; + DBG_8192C("==>%s bfwpoll(%x)\n",__FUNCTION__,bfwpoll); + param.gpio_period = period;//Polling GPIO_11 period time + param.ROFOn = (_TRUE == bfwpoll)?1:0; + FillH2CCmd_88E(padapter, SELECTIVE_SUSPEND_ROF_CMD, sizeof(param), (u8*)(¶m)); + return res; +} +#endif //CONFIG_AUTOSUSPEND && SUPPORT_HW_RFOFF_DETECTED +*/ +u8 rtl8188e_set_rssi_cmd(struct adapter*padapter, u8 *param) +{ + u8 res=_SUCCESS; + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter); +_func_enter_; + + if(pHalData->fw_ractrl == _TRUE){ + #if 0 + *((u32*) param ) = cpu_to_le32( *((u32*) param ) ); + + FillH2CCmd_88E(padapter, RSSI_SETTING_EID, 3, param); + #endif + }else{ + DBG_8192C("==>%s fw dont support RA \n",__FUNCTION__); + res=_FAIL; + } + +_func_exit_; + + return res; +} + +u8 rtl8188e_set_raid_cmd(struct adapter*padapter, u32 mask) +{ + u8 buf[3]; + u8 res=_SUCCESS; + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter); +_func_enter_; + if(pHalData->fw_ractrl == _TRUE){ + _rtw_memset(buf, 0, 3); + mask = cpu_to_le32( mask ); + _rtw_memcpy(buf, &mask, 3); + + FillH2CCmd_88E(padapter, H2C_DM_MACID_CFG, 3, buf); + }else{ + DBG_8192C("==>%s fw dont support RA \n",__FUNCTION__); + res=_FAIL; + } + +_func_exit_; + + return res; + +} + +//bitmap[0:27] = tx_rate_bitmap +//bitmap[28:31]= Rate Adaptive id +//arg[0:4] = macid +//arg[5] = Short GI +void rtl8188e_Add_RateATid(struct adapter *pAdapter, u32 bitmap, u8 arg, u8 rssi_level) +{ + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter); + //struct dm_priv *pdmpriv = &pHalData->dmpriv; + + u8 macid, init_rate, raid, shortGIrate=_FALSE; + + macid = arg&0x1f; + +#ifdef CONFIG_ODM_REFRESH_RAMASK + raid = (bitmap>>28) & 0x0f; + bitmap &=0x0fffffff; + + if(rssi_level != DM_RATR_STA_INIT) + bitmap = ODM_Get_Rate_Bitmap(&pHalData->odmpriv, macid, bitmap, rssi_level); + + bitmap |= ((raid<<28)&0xf0000000); +#endif //CONFIG_ODM_REFRESH_RAMASK + + + init_rate = get_highest_rate_idx(bitmap&0x0fffffff)&0x3f; + + shortGIrate = (arg&BIT(5)) ? _TRUE:_FALSE; + + if (shortGIrate==_TRUE) + init_rate |= BIT(6); + + + //rtw_write8(pAdapter, (REG_INIDATA_RATE_SEL+macid), (u8)init_rate); + + raid = (bitmap>>28) & 0x0f; + + bitmap &= 0x0fffffff; + + DBG_871X("%s=> mac_id:%d , raid:%d , ra_bitmap=0x%x, shortGIrate=0x%02x\n", + __FUNCTION__,macid ,raid ,bitmap, shortGIrate); + + +#if(RATE_ADAPTIVE_SUPPORT == 1) + ODM_RA_UpdateRateInfo_8188E( + &(pHalData->odmpriv), + macid, + raid, + bitmap, + shortGIrate + ); +#endif + +} + +void rtl8188e_set_FwPwrMode_cmd(struct adapter *padapter, u8 Mode) +{ + SETPWRMODE_PARM H2CSetPwrMode; + struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter); + u8 RLBM = 0; // 0:Min, 1:Max , 2:User define +_func_enter_; + + DBG_871X("%s: Mode=%d SmartPS=%d UAPSD=%d\n", __FUNCTION__, + Mode, pwrpriv->smart_ps, padapter->registrypriv.uapsd_enable); + + H2CSetPwrMode.AwakeInterval = 2; //DTIM =1 + + switch(Mode) + { + case PS_MODE_ACTIVE: + H2CSetPwrMode.Mode = 0; + break; + case PS_MODE_MIN: + H2CSetPwrMode.Mode = 1; + break; + case PS_MODE_MAX: + RLBM = 1; + H2CSetPwrMode.Mode = 1; + break; + case PS_MODE_DTIM: + RLBM = 2; + H2CSetPwrMode.Mode = 1; + break; + case PS_MODE_UAPSD_WMM: + H2CSetPwrMode.Mode = 2; + break; + default: + H2CSetPwrMode.Mode = 0; + break; + } + + //H2CSetPwrMode.Mode = Mode; + + H2CSetPwrMode.SmartPS_RLBM = (((pwrpriv->smart_ps<<4)&0xf0) | (RLBM & 0x0f)); + + H2CSetPwrMode.bAllQueueUAPSD = padapter->registrypriv.uapsd_enable; + + if(Mode > 0) + { + H2CSetPwrMode.PwrState = 0x00;// AllON(0x0C), RFON(0x04), RFOFF(0x00) +#ifdef CONFIG_EXT_CLK + H2CSetPwrMode.Mode |= BIT(7);//supporting 26M XTAL CLK_Request feature. +#endif //CONFIG_EXT_CLK + } + else + H2CSetPwrMode.PwrState = 0x0C;// AllON(0x0C), RFON(0x04), RFOFF(0x00) + + FillH2CCmd_88E(padapter, H2C_PS_PWR_MODE, sizeof(H2CSetPwrMode), (u8 *)&H2CSetPwrMode); + + +_func_exit_; +} + +void rtl8188e_set_FwMediaStatus_cmd(struct adapter *padapter, u16 mstatus_rpt ) +{ + u8 opmode,macid; + u16 mst_rpt = cpu_to_le16 (mstatus_rpt); + u32 reg_macid_no_link = REG_MACID_NO_LINK_0; + opmode = (u8) mst_rpt; + macid = (u8)(mst_rpt >> 8) ; + DBG_871X("### %s: MStatus=%x MACID=%d \n", __FUNCTION__,opmode,macid); + FillH2CCmd_88E(padapter, H2C_COM_MEDIA_STATUS_RPT, sizeof(mst_rpt), (u8 *)&mst_rpt); + + if(macid > 31){ + macid = macid-32; + reg_macid_no_link = REG_MACID_NO_LINK_1; + } + + //Delete select macid (MACID 0~63) from queue list. + if(opmode == 1)// 1:connect + { + rtw_write32(padapter,reg_macid_no_link, (rtw_read32(padapter,reg_macid_no_link) & (~BIT(macid)))); + } + else//0: disconnect + { + rtw_write32(padapter,reg_macid_no_link, (rtw_read32(padapter,reg_macid_no_link)|BIT(macid))); + } + + + +} + +void ConstructBeacon(struct adapter *padapter, u8 *pframe, u32 *pLength) +{ + struct rtw_ieee80211_hdr *pwlanhdr; + u16 *fctrl; + u32 rate_len, pktlen; + struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); + struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); + WLAN_BSSID_EX *cur_network = &(pmlmeinfo->network); + u8 bc_addr[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; + + + //DBG_871X("%s\n", __FUNCTION__); + + pwlanhdr = (struct rtw_ieee80211_hdr *)pframe; + + fctrl = &(pwlanhdr->frame_ctl); + *(fctrl) = 0; + + _rtw_memcpy(pwlanhdr->addr1, bc_addr, ETH_ALEN); + _rtw_memcpy(pwlanhdr->addr2, myid(&(padapter->eeprompriv)), ETH_ALEN); + _rtw_memcpy(pwlanhdr->addr3, get_my_bssid(cur_network), ETH_ALEN); + + SetSeqNum(pwlanhdr, 0/*pmlmeext->mgnt_seq*/); + //pmlmeext->mgnt_seq++; + SetFrameSubType(pframe, WIFI_BEACON); + + pframe += sizeof(struct rtw_ieee80211_hdr_3addr); + pktlen = sizeof (struct rtw_ieee80211_hdr_3addr); + + //timestamp will be inserted by hardware + pframe += 8; + pktlen += 8; + + // beacon interval: 2 bytes + _rtw_memcpy(pframe, (unsigned char *)(rtw_get_beacon_interval_from_ie(cur_network->IEs)), 2); + + pframe += 2; + pktlen += 2; + + // capability info: 2 bytes + _rtw_memcpy(pframe, (unsigned char *)(rtw_get_capability_from_ie(cur_network->IEs)), 2); + + pframe += 2; + pktlen += 2; + + if( (pmlmeinfo->state&0x03) == WIFI_FW_AP_STATE) + { + //DBG_871X("ie len=%d\n", cur_network->IELength); + pktlen += cur_network->IELength - sizeof(NDIS_802_11_FIXED_IEs); + _rtw_memcpy(pframe, cur_network->IEs+sizeof(NDIS_802_11_FIXED_IEs), pktlen); + + goto _ConstructBeacon; + } + + //below for ad-hoc mode + + // SSID + pframe = rtw_set_ie(pframe, _SSID_IE_, cur_network->Ssid.SsidLength, cur_network->Ssid.Ssid, &pktlen); + + // supported rates... + rate_len = rtw_get_rateset_len(cur_network->SupportedRates); + pframe = rtw_set_ie(pframe, _SUPPORTEDRATES_IE_, ((rate_len > 8)? 8: rate_len), cur_network->SupportedRates, &pktlen); + + // DS parameter set + pframe = rtw_set_ie(pframe, _DSSET_IE_, 1, (unsigned char *)&(cur_network->Configuration.DSConfig), &pktlen); + + if( (pmlmeinfo->state&0x03) == WIFI_FW_ADHOC_STATE) + { + u32 ATIMWindow; + // IBSS Parameter Set... + //ATIMWindow = cur->Configuration.ATIMWindow; + ATIMWindow = 0; + pframe = rtw_set_ie(pframe, _IBSS_PARA_IE_, 2, (unsigned char *)(&ATIMWindow), &pktlen); + } + + + //todo: ERP IE + + + // EXTERNDED SUPPORTED RATE + if (rate_len > 8) + { + pframe = rtw_set_ie(pframe, _EXT_SUPPORTEDRATES_IE_, (rate_len - 8), (cur_network->SupportedRates + 8), &pktlen); + } + + + //todo:HT for adhoc + +_ConstructBeacon: + + if ((pktlen + TXDESC_SIZE) > 512) + { + DBG_871X("beacon frame too large\n"); + return; + } + + *pLength = pktlen; + + //DBG_871X("%s bcn_sz=%d\n", __FUNCTION__, pktlen); + +} + +void ConstructPSPoll(struct adapter *padapter, u8 *pframe, u32 *pLength) +{ + struct rtw_ieee80211_hdr *pwlanhdr; + u16 *fctrl; + u32 pktlen; + struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); + struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); + + //DBG_871X("%s\n", __FUNCTION__); + + pwlanhdr = (struct rtw_ieee80211_hdr *)pframe; + + // Frame control. + fctrl = &(pwlanhdr->frame_ctl); + *(fctrl) = 0; + SetPwrMgt(fctrl); + SetFrameSubType(pframe, WIFI_PSPOLL); + + // AID. + SetDuration(pframe, (pmlmeinfo->aid | 0xc000)); + + // BSSID. + _rtw_memcpy(pwlanhdr->addr1, get_my_bssid(&(pmlmeinfo->network)), ETH_ALEN); + + // TA. + _rtw_memcpy(pwlanhdr->addr2, myid(&(padapter->eeprompriv)), ETH_ALEN); + + *pLength = 16; +} + +void ConstructNullFunctionData( + struct adapter *padapter, + u8 *pframe, + u32 *pLength, + u8 *StaAddr, + u8 bQoS, + u8 AC, + u8 bEosp, + u8 bForcePowerSave) +{ + struct rtw_ieee80211_hdr *pwlanhdr; + u16 *fctrl; + u32 pktlen; + struct mlme_priv *pmlmepriv = &padapter->mlmepriv; + struct wlan_network *cur_network = &pmlmepriv->cur_network; + struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); + struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); + + + //DBG_871X("%s:%d\n", __FUNCTION__, bForcePowerSave); + + pwlanhdr = (struct rtw_ieee80211_hdr*)pframe; + + fctrl = &pwlanhdr->frame_ctl; + *(fctrl) = 0; + if (bForcePowerSave) + { + SetPwrMgt(fctrl); + } + + switch(cur_network->network.InfrastructureMode) + { + case Ndis802_11Infrastructure: + SetToDs(fctrl); + _rtw_memcpy(pwlanhdr->addr1, get_my_bssid(&(pmlmeinfo->network)), ETH_ALEN); + _rtw_memcpy(pwlanhdr->addr2, myid(&(padapter->eeprompriv)), ETH_ALEN); + _rtw_memcpy(pwlanhdr->addr3, StaAddr, ETH_ALEN); + break; + case Ndis802_11APMode: + SetFrDs(fctrl); + _rtw_memcpy(pwlanhdr->addr1, StaAddr, ETH_ALEN); + _rtw_memcpy(pwlanhdr->addr2, get_my_bssid(&(pmlmeinfo->network)), ETH_ALEN); + _rtw_memcpy(pwlanhdr->addr3, myid(&(padapter->eeprompriv)), ETH_ALEN); + break; + case Ndis802_11IBSS: + default: + _rtw_memcpy(pwlanhdr->addr1, StaAddr, ETH_ALEN); + _rtw_memcpy(pwlanhdr->addr2, myid(&(padapter->eeprompriv)), ETH_ALEN); + _rtw_memcpy(pwlanhdr->addr3, get_my_bssid(&(pmlmeinfo->network)), ETH_ALEN); + break; + } + + SetSeqNum(pwlanhdr, 0); + + if (bQoS == _TRUE) { + struct rtw_ieee80211_hdr_3addr_qos *pwlanqoshdr; + + SetFrameSubType(pframe, WIFI_QOS_DATA_NULL); + + pwlanqoshdr = (struct rtw_ieee80211_hdr_3addr_qos*)pframe; + SetPriority(&pwlanqoshdr->qc, AC); + SetEOSP(&pwlanqoshdr->qc, bEosp); + + pktlen = sizeof(struct rtw_ieee80211_hdr_3addr_qos); + } else { + SetFrameSubType(pframe, WIFI_DATA_NULL); + + pktlen = sizeof(struct rtw_ieee80211_hdr_3addr); + } + + *pLength = pktlen; +} + +void ConstructProbeRsp(struct adapter *padapter, u8 *pframe, u32 *pLength, u8 *StaAddr, BOOLEAN bHideSSID) +{ + struct rtw_ieee80211_hdr *pwlanhdr; + u16 *fctrl; + u8 *mac, *bssid; + u32 pktlen; + struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); + struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); + WLAN_BSSID_EX *cur_network = &(pmlmeinfo->network); + + + //DBG_871X("%s\n", __FUNCTION__); + + pwlanhdr = (struct rtw_ieee80211_hdr *)pframe; + + mac = myid(&(padapter->eeprompriv)); + bssid = cur_network->MacAddress; + + fctrl = &(pwlanhdr->frame_ctl); + *(fctrl) = 0; + _rtw_memcpy(pwlanhdr->addr1, StaAddr, ETH_ALEN); + _rtw_memcpy(pwlanhdr->addr2, mac, ETH_ALEN); + _rtw_memcpy(pwlanhdr->addr3, bssid, ETH_ALEN); + + SetSeqNum(pwlanhdr, 0); + SetFrameSubType(fctrl, WIFI_PROBERSP); + + pktlen = sizeof(struct rtw_ieee80211_hdr_3addr); + pframe += pktlen; + + if(cur_network->IELength>MAX_IE_SZ) + return; + + _rtw_memcpy(pframe, cur_network->IEs, cur_network->IELength); + pframe += cur_network->IELength; + pktlen += cur_network->IELength; + + *pLength = pktlen; +} + +#ifdef CONFIG_WOWLAN +// +// Description: +// Construct the ARP response packet to support ARP offload. +// +static void ConstructARPResponse( + struct adapter *padapter, + u8 *pframe, + u32 *pLength, + u8 *pIPAddress + ) +{ + struct rtw_ieee80211_hdr *pwlanhdr; + struct mlme_priv *pmlmepriv = &padapter->mlmepriv; + struct wlan_network *cur_network = &pmlmepriv->cur_network; + struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); + struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); + struct security_priv *psecuritypriv = &padapter->securitypriv; + static u8 ARPLLCHeader[8] = {0xAA, 0xAA, 0x03, 0x00, 0x00, 0x00, 0x08, 0x06}; + + u16 *fctrl; + u32 pktlen; + u8 *pARPRspPkt = pframe; + //for TKIP Cal MIC + u8 *payload = pframe; + u8 EncryptionHeadOverhead = 0; + + pwlanhdr = (struct rtw_ieee80211_hdr*)pframe; + + fctrl = &pwlanhdr->frame_ctl; + *(fctrl) = 0; + + //------------------------------------------------------------------------- + // MAC Header. + //------------------------------------------------------------------------- + SetFrameType(fctrl, WIFI_DATA); + //SetFrameSubType(fctrl, 0); + SetToDs(fctrl); + _rtw_memcpy(pwlanhdr->addr1, get_my_bssid(&(pmlmeinfo->network)), ETH_ALEN); + _rtw_memcpy(pwlanhdr->addr2, myid(&(padapter->eeprompriv)), ETH_ALEN); + _rtw_memcpy(pwlanhdr->addr3, get_my_bssid(&(pmlmeinfo->network)), ETH_ALEN); + + SetSeqNum(pwlanhdr, 0); + SetDuration(pwlanhdr, 0); + //SET_80211_HDR_FRAME_CONTROL(pARPRspPkt, 0); + //SET_80211_HDR_TYPE_AND_SUBTYPE(pARPRspPkt, Type_Data); + //SET_80211_HDR_TO_DS(pARPRspPkt, 1); + //SET_80211_HDR_ADDRESS1(pARPRspPkt, pMgntInfo->Bssid); + //SET_80211_HDR_ADDRESS2(pARPRspPkt, Adapter->CurrentAddress); + //SET_80211_HDR_ADDRESS3(pARPRspPkt, pMgntInfo->Bssid); + + //SET_80211_HDR_DURATION(pARPRspPkt, 0); + //SET_80211_HDR_FRAGMENT_SEQUENCE(pARPRspPkt, 0); + *pLength = 24; + +//YJ,del,120503 +#if 0 + //------------------------------------------------------------------------- + // Qos Header: leave space for it if necessary. + //------------------------------------------------------------------------- + if(pStaQos->CurrentQosMode > QOS_DISABLE) + { + SET_80211_HDR_QOS_EN(pARPRspPkt, 1); + PlatformZeroMemory(&(Buffer[*pLength]), sQoSCtlLng); + *pLength += sQoSCtlLng; + } +#endif + //------------------------------------------------------------------------- + // Security Header: leave space for it if necessary. + //------------------------------------------------------------------------- + + switch (psecuritypriv->dot11PrivacyAlgrthm) + { + case _WEP40_: + case _WEP104_: + EncryptionHeadOverhead = 4; + break; + case _TKIP_: + EncryptionHeadOverhead = 8; + break; + case _AES_: + EncryptionHeadOverhead = 8; + break; +#ifdef CONFIG_WAPI_SUPPORT + case _SMS4_: + EncryptionHeadOverhead = 18; + break; +#endif + default: + EncryptionHeadOverhead = 0; + } + + if(EncryptionHeadOverhead > 0) + { + _rtw_memset(&(pframe[*pLength]), 0,EncryptionHeadOverhead); + *pLength += EncryptionHeadOverhead; + //SET_80211_HDR_WEP(pARPRspPkt, 1); //Suggested by CCW. + SetPrivacy(fctrl); + } + + //------------------------------------------------------------------------- + // Frame Body. + //------------------------------------------------------------------------- + pARPRspPkt = (u8*)(pframe+ *pLength); + // LLC header + _rtw_memcpy(pARPRspPkt, ARPLLCHeader, 8); + *pLength += 8; + + // ARP element + pARPRspPkt += 8; + SET_ARP_PKT_HW(pARPRspPkt, 0x0100); + SET_ARP_PKT_PROTOCOL(pARPRspPkt, 0x0008); // IP protocol + SET_ARP_PKT_HW_ADDR_LEN(pARPRspPkt, 6); + SET_ARP_PKT_PROTOCOL_ADDR_LEN(pARPRspPkt, 4); + SET_ARP_PKT_OPERATION(pARPRspPkt, 0x0200); // ARP response + SET_ARP_PKT_SENDER_MAC_ADDR(pARPRspPkt, myid(&(padapter->eeprompriv))); + SET_ARP_PKT_SENDER_IP_ADDR(pARPRspPkt, pIPAddress); +#ifdef CONFIG_ARP_KEEP_ALIVE + if (rtw_gw_addr_query(padapter)==0) { + SET_ARP_PKT_TARGET_MAC_ADDR(pARPRspPkt, pmlmepriv->gw_mac_addr); + SET_ARP_PKT_TARGET_IP_ADDR(pARPRspPkt, pmlmepriv->gw_ip); + } + else +#endif + { + SET_ARP_PKT_TARGET_MAC_ADDR(pARPRspPkt, get_my_bssid(&(pmlmeinfo->network))); + SET_ARP_PKT_TARGET_IP_ADDR(pARPRspPkt, pIPAddress); + DBG_871X("%s Target Mac Addr:" MAC_FMT "\n", __FUNCTION__, MAC_ARG(get_my_bssid(&(pmlmeinfo->network)))); + DBG_871X("%s Target IP Addr" IP_FMT "\n", __FUNCTION__, IP_ARG(pIPAddress)); + } + *pLength += 28; + if (psecuritypriv->dot11PrivacyAlgrthm == _TKIP_) + { + u8 mic[8]; + struct mic_data micdata; + struct sta_info *psta = NULL; + u8 priority[4]={0x0,0x0,0x0,0x0}; + u8 null_key[16]={0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0}; + + DBG_871X("%s(): Add MIC\n",__FUNCTION__); + + psta = rtw_get_stainfo(&padapter->stapriv, get_my_bssid(&(pmlmeinfo->network))); + if (psta != NULL) { + if(_rtw_memcmp(&psta->dot11tkiptxmickey.skey[0],null_key, 16)==_TRUE){ + DBG_871X("%s(): STA dot11tkiptxmickey==0\n",__FUNCTION__); + } + //start to calculate the mic code + rtw_secmicsetkey(&micdata, &psta->dot11tkiptxmickey.skey[0]); + } + + rtw_secmicappend(&micdata, pwlanhdr->addr3, 6); //DA + + rtw_secmicappend(&micdata, pwlanhdr->addr2, 6); //SA + + priority[0]=0; + rtw_secmicappend(&micdata, &priority[0], 4); + + rtw_secmicappend(&micdata, payload, 36); //payload length = 8 + 28 + + rtw_secgetmic(&micdata,&(mic[0])); + + pARPRspPkt += 28; + _rtw_memcpy(pARPRspPkt, &(mic[0]),8); + + *pLength += 8; + } +} +#endif + +void rtl8188e_set_FwRsvdPage_cmd(struct adapter *padapter, PRSVDPAGE_LOC rsvdpageloc) +{ + u8 u1H2CRsvdPageParm[H2C_8188E_RSVDPAGE_LOC_LEN]={0}; + u8 u1H2CAoacRsvdPageParm[H2C_8188E_AOAC_RSVDPAGE_LOC_LEN]={0}; + + //DBG_871X("8188RsvdPageLoc: PsPoll=%d Null=%d QoSNull=%d\n", + // rsvdpageloc->LocPsPoll, rsvdpageloc->LocNullData, rsvdpageloc->LocQosNull); + + SET_8188E_H2CCMD_RSVDPAGE_LOC_PSPOLL(u1H2CRsvdPageParm, rsvdpageloc->LocPsPoll); + SET_8188E_H2CCMD_RSVDPAGE_LOC_NULL_DATA(u1H2CRsvdPageParm, rsvdpageloc->LocNullData); + SET_8188E_H2CCMD_RSVDPAGE_LOC_QOS_NULL_DATA(u1H2CRsvdPageParm, rsvdpageloc->LocQosNull); + + FillH2CCmd_88E(padapter, H2C_COM_RSVD_PAGE, H2C_8188E_RSVDPAGE_LOC_LEN, u1H2CRsvdPageParm); + +#ifdef CONFIG_WOWLAN + //DBG_871X("8188E_AOACRsvdPageLoc: RWC=%d ArpRsp=%d\n", rsvdpageloc->LocRemoteCtrlInfo, rsvdpageloc->LocArpRsp); + SET_8188E_H2CCMD_AOAC_RSVDPAGE_LOC_REMOTE_WAKE_CTRL_INFO(u1H2CAoacRsvdPageParm, rsvdpageloc->LocRemoteCtrlInfo); + SET_8188E_H2CCMD_AOAC_RSVDPAGE_LOC_ARP_RSP(u1H2CAoacRsvdPageParm, rsvdpageloc->LocArpRsp); + + FillH2CCmd_88E(padapter, H2C_COM_AOAC_RSVD_PAGE, H2C_8188E_AOAC_RSVDPAGE_LOC_LEN, u1H2CAoacRsvdPageParm); +#endif +} + +// To check if reserved page content is destroyed by beacon beacuse beacon is too large. +// 2010.06.23. Added by tynli. +VOID +CheckFwRsvdPageContent( + IN struct adapter * Adapter +) +{ + HAL_DATA_TYPE* pHalData = GET_HAL_DATA(Adapter); + u32 MaxBcnPageNum; + + if(pHalData->FwRsvdPageStartOffset != 0) + { + /*MaxBcnPageNum = PageNum_128(pMgntInfo->MaxBeaconSize); + RT_ASSERT((MaxBcnPageNum <= pHalData->FwRsvdPageStartOffset), + ("CheckFwRsvdPageContent(): The reserved page content has been"\ + "destroyed by beacon!!! MaxBcnPageNum(%d) FwRsvdPageStartOffset(%d)\n!", + MaxBcnPageNum, pHalData->FwRsvdPageStartOffset));*/ + } +} + +// +// Description: Fill the reserved packets that FW will use to RSVD page. +// Now we just send 4 types packet to rsvd page. +// (1)Beacon, (2)Ps-poll, (3)Null data, (4)ProbeRsp. +// Input: +// bDLFinished - FALSE: At the first time we will send all the packets as a large packet to Hw, +// so we need to set the packet length to total lengh. +// TRUE: At the second time, we should send the first packet (default:beacon) +// to Hw again and set the lengh in descriptor to the real beacon lengh. +// 2009.10.15 by tynli. +static void SetFwRsvdPagePkt(struct adapter *padapter, BOOLEAN bDLFinished) +{ + PHAL_DATA_TYPE pHalData; + struct xmit_frame *pmgntframe; + struct pkt_attrib *pattrib; + struct xmit_priv *pxmitpriv; + struct mlme_ext_priv *pmlmeext; + struct mlme_ext_info *pmlmeinfo; + u32 BeaconLength, ProbeRspLength, PSPollLength; + u32 NullDataLength, QosNullLength, BTQosNullLength; + u8 *ReservedPagePacket; + u8 PageNum, PageNeed, TxDescLen; + u16 BufIndex; + u32 TotalPacketLen; + RSVDPAGE_LOC RsvdPageLoc; +#ifdef CONFIG_WOWLAN + u32 ARPLegnth = 0; + struct security_priv *psecuritypriv = &padapter->securitypriv; + u8 currentip[4]; + u8 cur_dot11txpn[8]; +#endif + + DBG_871X("%s\n", __FUNCTION__); + + ReservedPagePacket = (u8*)rtw_zmalloc(RTL88E_RSVDPAGE_SIZE); + if (ReservedPagePacket == NULL) { + DBG_871X("%s: alloc ReservedPagePacket fail!\n", __FUNCTION__); + return; + } + + pHalData = GET_HAL_DATA(padapter); + pxmitpriv = &padapter->xmitpriv; + pmlmeext = &padapter->mlmeextpriv; + pmlmeinfo = &pmlmeext->mlmext_info; + + TxDescLen = TXDESC_SIZE; + PageNum = 0; + + //3 (1) beacon * 2 pages + BufIndex = TXDESC_OFFSET; + ConstructBeacon(padapter, &ReservedPagePacket[BufIndex], &BeaconLength); + + // When we count the first page size, we need to reserve description size for the RSVD + // packet, it will be filled in front of the packet in TXPKTBUF. + PageNeed = (u8)PageNum_128(TxDescLen + BeaconLength); + // To reserved 2 pages for beacon buffer. 2010.06.24. + if (PageNeed == 1) + PageNeed += 1; + PageNum += PageNeed; + pHalData->FwRsvdPageStartOffset = PageNum; + + BufIndex += PageNeed*128; + + //3 (2) ps-poll *1 page + RsvdPageLoc.LocPsPoll = PageNum; + ConstructPSPoll(padapter, &ReservedPagePacket[BufIndex], &PSPollLength); + rtl8188e_fill_fake_txdesc(padapter, &ReservedPagePacket[BufIndex-TxDescLen], PSPollLength, _TRUE, _FALSE); + + PageNeed = (u8)PageNum_128(TxDescLen + PSPollLength); + PageNum += PageNeed; + + BufIndex += PageNeed*128; + + //3 (3) null data * 1 page + RsvdPageLoc.LocNullData = PageNum; + ConstructNullFunctionData( + padapter, + &ReservedPagePacket[BufIndex], + &NullDataLength, + get_my_bssid(&pmlmeinfo->network), + _FALSE, 0, 0, _FALSE); + rtl8188e_fill_fake_txdesc(padapter, &ReservedPagePacket[BufIndex-TxDescLen], NullDataLength, _FALSE, _FALSE); + + PageNeed = (u8)PageNum_128(TxDescLen + NullDataLength); + PageNum += PageNeed; + + BufIndex += PageNeed*128; + + //3 (5) Qos null data + RsvdPageLoc.LocQosNull = PageNum; + ConstructNullFunctionData( + padapter, + &ReservedPagePacket[BufIndex], + &QosNullLength, + get_my_bssid(&pmlmeinfo->network), + _TRUE, 0, 0, _FALSE); + rtl8188e_fill_fake_txdesc(padapter, &ReservedPagePacket[BufIndex-TxDescLen], QosNullLength, _FALSE, _FALSE); + + PageNeed = (u8)PageNum_128(TxDescLen + QosNullLength); + PageNum += PageNeed; + + BufIndex += PageNeed*128; + +#ifdef CONFIG_WOWLAN + //3(7) ARP + rtw_get_current_ip_address(padapter, currentip); + RsvdPageLoc.LocArpRsp = PageNum; + ConstructARPResponse( + padapter, + &ReservedPagePacket[BufIndex], + &ARPLegnth, + currentip + ); + rtl8188e_fill_fake_txdesc(padapter, &ReservedPagePacket[BufIndex-TxDescLen], ARPLegnth, _FALSE, _FALSE); + + switch (psecuritypriv->dot11PrivacyAlgrthm) + { + case _WEP40_: + case _WEP104_: + case _TKIP_: + ReservedPagePacket[BufIndex-TxDescLen+6] |= BIT(6); + break; + case _AES_: + ReservedPagePacket[BufIndex-TxDescLen+6] |= BIT(6)|BIT(7); + break; +#ifdef CONFIG_WAPI_SUPPORT + case _SMS4_: + ReservedPagePacket[BufIndex-TxDescLen+6] |= BIT(7); + break; +#endif + default: + ; + } + + PageNeed = (u8)PageNum_128(TxDescLen + ARPLegnth); + PageNum += PageNeed; + + BufIndex += PageNeed*128; + + //3(8) sec IV + rtw_get_sec_iv(padapter, cur_dot11txpn, get_my_bssid(&pmlmeinfo->network)); + RsvdPageLoc.LocRemoteCtrlInfo = PageNum; + _rtw_memcpy(ReservedPagePacket+BufIndex-TxDescLen, cur_dot11txpn, 8); + + TotalPacketLen = BufIndex-TxDescLen + sizeof (union pn48); //IV len +#else + TotalPacketLen = BufIndex + QosNullLength; +#endif + + pmgntframe = alloc_mgtxmitframe(pxmitpriv); + if (pmgntframe == NULL) + goto exit; + + // update attribute + pattrib = &pmgntframe->attrib; + update_mgntframe_attrib(padapter, pattrib); + pattrib->qsel = 0x10; + pattrib->pktlen = pattrib->last_txcmdsz = TotalPacketLen - TXDESC_OFFSET; + + if (TotalPacketLen < RTL88E_RSVDPAGE_SIZE) + _rtw_memcpy(pmgntframe->buf_addr, ReservedPagePacket, TotalPacketLen); + else + DBG_871X("%s: memory copy fail at Line: %d\n", __FUNCTION__, __LINE__); + + rtw_hal_mgnt_xmit(padapter, pmgntframe); + + DBG_871X("%s: Set RSVD page location to Fw\n", __FUNCTION__); + rtl8188e_set_FwRsvdPage_cmd(padapter, &RsvdPageLoc); + //FillH2CCmd_88E(padapter, H2C_COM_RSVD_PAGE, sizeof(RsvdPageLoc), (u8*)&RsvdPageLoc); + +exit: + rtw_mfree(ReservedPagePacket, RTL88E_RSVDPAGE_SIZE); +} + +void rtl8188e_set_FwJoinBssReport_cmd(struct adapter *padapter, u8 mstatus) +{ + JOINBSSRPT_PARM JoinBssRptParm; + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter); + struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); + struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); +#ifdef CONFIG_WOWLAN + struct mlme_priv *pmlmepriv = &padapter->mlmepriv; + struct sta_info *psta = NULL; +#endif + BOOLEAN bSendBeacon=_FALSE; + BOOLEAN bcn_valid = _FALSE; + u8 DLBcnCount=0; + u32 poll = 0; + +_func_enter_; + + DBG_871X("%s mstatus(%x)\n", __FUNCTION__,mstatus); + + if(mstatus == 1) + { + // We should set AID, correct TSF, HW seq enable before set JoinBssReport to Fw in 88/92C. + // Suggested by filen. Added by tynli. + rtw_write16(padapter, REG_BCN_PSR_RPT, (0xC000|pmlmeinfo->aid)); + // Do not set TSF again here or vWiFi beacon DMA INT will not work. + //correct_TSF(padapter, pmlmeext); + // Hw sequende enable by dedault. 2010.06.23. by tynli. + //rtw_write16(padapter, REG_NQOS_SEQ, ((pmlmeext->mgnt_seq+100)&0xFFF)); + //rtw_write8(padapter, REG_HWSEQ_CTRL, 0xFF); + + //Set REG_CR bit 8. DMA beacon by SW. + pHalData->RegCR_1 |= BIT0; + rtw_write8(padapter, REG_CR+1, pHalData->RegCR_1); + + // Disable Hw protection for a time which revserd for Hw sending beacon. + // Fix download reserved page packet fail that access collision with the protection time. + // 2010.05.11. Added by tynli. + //SetBcnCtrlReg(padapter, 0, BIT3); + //SetBcnCtrlReg(padapter, BIT4, 0); + rtw_write8(padapter, REG_BCN_CTRL, rtw_read8(padapter, REG_BCN_CTRL)&(~BIT(3))); + rtw_write8(padapter, REG_BCN_CTRL, rtw_read8(padapter, REG_BCN_CTRL)|BIT(4)); + + if(pHalData->RegFwHwTxQCtrl&BIT6) + { + DBG_871X("HalDownloadRSVDPage(): There is an Adapter is sending beacon.\n"); + bSendBeacon = _TRUE; + } + + // Set FWHW_TXQ_CTRL 0x422[6]=0 to tell Hw the packet is not a real beacon frame. + rtw_write8(padapter, REG_FWHW_TXQ_CTRL+2, (pHalData->RegFwHwTxQCtrl&(~BIT6))); + pHalData->RegFwHwTxQCtrl &= (~BIT6); + + // Clear beacon valid check bit. + rtw_hal_set_hwreg(padapter, HW_VAR_BCN_VALID, NULL); + DLBcnCount = 0; + poll = 0; + do + { + // download rsvd page. + SetFwRsvdPagePkt(padapter, _FALSE); + DLBcnCount++; + do + { + rtw_yield_os(); + //rtw_mdelay_os(10); + // check rsvd page download OK. + rtw_hal_get_hwreg(padapter, HW_VAR_BCN_VALID, (u8*)(&bcn_valid)); + poll++; + } while(!bcn_valid && (poll%10)!=0 && !padapter->bSurpriseRemoved && !padapter->bDriverStopped); + + }while(!bcn_valid && DLBcnCount<=100 && !padapter->bSurpriseRemoved && !padapter->bDriverStopped); + + //RT_ASSERT(bcn_valid, ("HalDownloadRSVDPage88ES(): 1 Download RSVD page failed!\n")); + if(padapter->bSurpriseRemoved || padapter->bDriverStopped) + { + } + else if(!bcn_valid) + DBG_871X("%s: 1 Download RSVD page failed! DLBcnCount:%u, poll:%u\n", __FUNCTION__ ,DLBcnCount, poll); + else + DBG_871X("%s: 1 Download RSVD success! DLBcnCount:%u, poll:%u\n", __FUNCTION__, DLBcnCount, poll); + // + // We just can send the reserved page twice during the time that Tx thread is stopped (e.g. pnpsetpower) + // becuase we need to free the Tx BCN Desc which is used by the first reserved page packet. + // At run time, we cannot get the Tx Desc until it is released in TxHandleInterrupt() so we will return + // the beacon TCB in the following code. 2011.11.23. by tynli. + // + //if(bcn_valid && padapter->bEnterPnpSleep) + if(0) + { + if(bSendBeacon) + { + rtw_hal_set_hwreg(padapter, HW_VAR_BCN_VALID, NULL); + DLBcnCount = 0; + poll = 0; + do + { + SetFwRsvdPagePkt(padapter, _TRUE); + DLBcnCount++; + + do + { + rtw_yield_os(); + //rtw_mdelay_os(10); + // check rsvd page download OK. + rtw_hal_get_hwreg(padapter, HW_VAR_BCN_VALID, (u8*)(&bcn_valid)); + poll++; + } while(!bcn_valid && (poll%10)!=0 && !padapter->bSurpriseRemoved && !padapter->bDriverStopped); + }while(!bcn_valid && DLBcnCount<=100 && !padapter->bSurpriseRemoved && !padapter->bDriverStopped); + + //RT_ASSERT(bcn_valid, ("HalDownloadRSVDPage(): 2 Download RSVD page failed!\n")); + if(padapter->bSurpriseRemoved || padapter->bDriverStopped) + { + } + else if(!bcn_valid) + DBG_871X("%s: 2 Download RSVD page failed! DLBcnCount:%u, poll:%u\n", __FUNCTION__ ,DLBcnCount, poll); + else + DBG_871X("%s: 2 Download RSVD success! DLBcnCount:%u, poll:%u\n", __FUNCTION__, DLBcnCount, poll); + } + } + + // Enable Bcn + //SetBcnCtrlReg(padapter, BIT3, 0); + //SetBcnCtrlReg(padapter, 0, BIT4); + rtw_write8(padapter, REG_BCN_CTRL, rtw_read8(padapter, REG_BCN_CTRL)|BIT(3)); + rtw_write8(padapter, REG_BCN_CTRL, rtw_read8(padapter, REG_BCN_CTRL)&(~BIT(4))); + + // To make sure that if there exists an adapter which would like to send beacon. + // If exists, the origianl value of 0x422[6] will be 1, we should check this to + // prevent from setting 0x422[6] to 0 after download reserved page, or it will cause + // the beacon cannot be sent by HW. + // 2010.06.23. Added by tynli. + if(bSendBeacon) + { + rtw_write8(padapter, REG_FWHW_TXQ_CTRL+2, (pHalData->RegFwHwTxQCtrl|BIT6)); + pHalData->RegFwHwTxQCtrl |= BIT6; + } + + // + // Update RSVD page location H2C to Fw. + // + if(bcn_valid) + { + rtw_hal_set_hwreg(padapter, HW_VAR_BCN_VALID, NULL); + DBG_871X("Set RSVD page location to Fw.\n"); + //FillH2CCmd88E(Adapter, H2C_88E_RSVDPAGE, H2C_RSVDPAGE_LOC_LENGTH, pMgntInfo->u1RsvdPageLoc); + } + + // Do not enable HW DMA BCN or it will cause Pcie interface hang by timing issue. 2011.11.24. by tynli. + //if(!padapter->bEnterPnpSleep) + { + // Clear CR[8] or beacon packet will not be send to TxBuf anymore. + pHalData->RegCR_1 &= (~BIT0); + rtw_write8(padapter, REG_CR+1, pHalData->RegCR_1); + } + } +#ifdef CONFIG_WOWLAN + if (adapter_to_pwrctl(padapter)->wowlan_mode){ + JoinBssRptParm.OpMode = mstatus; + psta = rtw_get_stainfo(&padapter->stapriv, get_bssid(pmlmepriv)); + if (psta != NULL) { + JoinBssRptParm.MacID = psta->mac_id; + } else { + JoinBssRptParm.MacID = 0; + } + FillH2CCmd_88E(padapter, H2C_COM_MEDIA_STATUS_RPT, sizeof(JoinBssRptParm), (u8 *)&JoinBssRptParm); + DBG_871X_LEVEL(_drv_info_, "%s opmode:%d MacId:%d\n", __func__, JoinBssRptParm.OpMode, JoinBssRptParm.MacID); + } else { + DBG_871X_LEVEL(_drv_info_, "%s wowlan_mode is off\n", __func__); + } +#endif //CONFIG_WOWLAN +_func_exit_; +} + +#ifdef CONFIG_P2P_PS +void rtl8188e_set_p2p_ps_offload_cmd(struct adapter* padapter, u8 p2p_ps_state) +{ + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter); + struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter); + struct wifidirect_info *pwdinfo = &( padapter->wdinfo ); + struct P2P_PS_Offload_t *p2p_ps_offload = &pHalData->p2p_ps_offload; + u8 i; + +_func_enter_; + +#if 1 + switch(p2p_ps_state) + { + case P2P_PS_DISABLE: + DBG_8192C("P2P_PS_DISABLE \n"); + _rtw_memset(p2p_ps_offload, 0 ,1); + break; + case P2P_PS_ENABLE: + DBG_8192C("P2P_PS_ENABLE \n"); + // update CTWindow value. + if( pwdinfo->ctwindow > 0 ) + { + p2p_ps_offload->CTWindow_En = 1; + rtw_write8(padapter, REG_P2P_CTWIN, pwdinfo->ctwindow); + } + + // hw only support 2 set of NoA + for( i=0 ; inoa_num ; i++) + { + // To control the register setting for which NOA + rtw_write8(padapter, REG_NOA_DESC_SEL, (i << 4)); + if(i == 0) + p2p_ps_offload->NoA0_En = 1; + else + p2p_ps_offload->NoA1_En = 1; + + // config P2P NoA Descriptor Register + //DBG_8192C("%s(): noa_duration = %x\n",__FUNCTION__,pwdinfo->noa_duration[i]); + rtw_write32(padapter, REG_NOA_DESC_DURATION, pwdinfo->noa_duration[i]); + + //DBG_8192C("%s(): noa_interval = %x\n",__FUNCTION__,pwdinfo->noa_interval[i]); + rtw_write32(padapter, REG_NOA_DESC_INTERVAL, pwdinfo->noa_interval[i]); + + //DBG_8192C("%s(): start_time = %x\n",__FUNCTION__,pwdinfo->noa_start_time[i]); + rtw_write32(padapter, REG_NOA_DESC_START, pwdinfo->noa_start_time[i]); + + //DBG_8192C("%s(): noa_count = %x\n",__FUNCTION__,pwdinfo->noa_count[i]); + rtw_write8(padapter, REG_NOA_DESC_COUNT, pwdinfo->noa_count[i]); + } + + if( (pwdinfo->opp_ps == 1) || (pwdinfo->noa_num > 0) ) + { + // rst p2p circuit + rtw_write8(padapter, REG_DUAL_TSF_RST, BIT(4)); + + p2p_ps_offload->Offload_En = 1; + + if(pwdinfo->role == P2P_ROLE_GO) + { + p2p_ps_offload->role= 1; + p2p_ps_offload->AllStaSleep = 0; + } + else + { + p2p_ps_offload->role= 0; + } + + p2p_ps_offload->discovery = 0; + } + break; + case P2P_PS_SCAN: + DBG_8192C("P2P_PS_SCAN \n"); + p2p_ps_offload->discovery = 1; + break; + case P2P_PS_SCAN_DONE: + DBG_8192C("P2P_PS_SCAN_DONE \n"); + p2p_ps_offload->discovery = 0; + pwdinfo->p2p_ps_state = P2P_PS_ENABLE; + break; + default: + break; + } + + FillH2CCmd_88E(padapter, H2C_PS_P2P_OFFLOAD, 1, (u8 *)p2p_ps_offload); +#endif + +_func_exit_; + +} +#endif //CONFIG_P2P_PS + +#ifdef CONFIG_TSF_RESET_OFFLOAD +/* + ask FW to Reset sync register at Beacon early interrupt +*/ +u8 rtl8188e_reset_tsf(struct adapter *padapter, u8 reset_port ) +{ + u8 buf[2]; + u8 res=_SUCCESS; + + s32 ret; +_func_enter_; + if (IFACE_PORT0==reset_port) { + buf[0] = 0x1; buf[1] = 0; + } else{ + buf[0] = 0x0; buf[1] = 0x1; + } + + ret = FillH2CCmd_88E(padapter, H2C_RESET_TSF, 2, buf); + +_func_exit_; + + return res; +} + +int reset_tsf(struct adapter *Adapter, u8 reset_port ) +{ + u8 reset_cnt_before = 0, reset_cnt_after = 0, loop_cnt = 0; + u32 reg_reset_tsf_cnt = (IFACE_PORT0==reset_port) ? + REG_FW_RESET_TSF_CNT_0:REG_FW_RESET_TSF_CNT_1; + u32 reg_bcncrtl = (IFACE_PORT0==reset_port) ? + REG_BCN_CTRL_1:REG_BCN_CTRL; + + rtw_scan_abort(Adapter->pbuddy_adapter); /* site survey will cause reset_tsf fail */ + reset_cnt_after = reset_cnt_before = rtw_read8(Adapter,reg_reset_tsf_cnt); + rtl8188e_reset_tsf(Adapter, reset_port); + + while ((reset_cnt_after == reset_cnt_before ) && (loop_cnt < 10)) { + rtw_msleep_os(100); + loop_cnt++; + reset_cnt_after = rtw_read8(Adapter, reg_reset_tsf_cnt); + } + + return(loop_cnt >= 10) ? _FAIL : _TRUE; +} + + +#endif // CONFIG_TSF_RESET_OFFLOAD + +#ifdef CONFIG_WOWLAN +#ifdef CONFIG_GPIO_WAKEUP +void rtl8188es_set_output_gpio(struct adapter* padapter, u8 index, u8 outputval) +{ + if ( index <= 7 ) { + /* config GPIO mode */ + rtw_write8(padapter, REG_GPIO_PIN_CTRL + 3, rtw_read8(padapter, REG_GPIO_PIN_CTRL + 3) & ~BIT(index) ); + + /* config GPIO Sel */ + /* 0: input */ + /* 1: output */ + rtw_write8(padapter, REG_GPIO_PIN_CTRL + 2, rtw_read8(padapter, REG_GPIO_PIN_CTRL + 2) | BIT(index)); + + /* set output value */ + if ( outputval ) { + rtw_write8(padapter, REG_GPIO_PIN_CTRL + 1, rtw_read8(padapter, REG_GPIO_PIN_CTRL + 1) | BIT(index)); + } else { + rtw_write8(padapter, REG_GPIO_PIN_CTRL + 1, rtw_read8(padapter, REG_GPIO_PIN_CTRL + 1) & ~BIT(index)); + } + } else { + /* 88C Series: */ + /* index: 11~8 transform to 3~0 */ + /* 8723 Series: */ + /* index: 12~8 transform to 4~0 */ + index -= 8; + + /* config GPIO mode */ + rtw_write8(padapter, REG_GPIO_PIN_CTRL_2 + 3, rtw_read8(padapter, REG_GPIO_PIN_CTRL_2 + 3) & ~BIT(index) ); + + /* config GPIO Sel */ + /* 0: input */ + /* 1: output */ + rtw_write8(padapter, REG_GPIO_PIN_CTRL_2 + 2, rtw_read8(padapter, REG_GPIO_PIN_CTRL_2 + 2) | BIT(index)); + + /* set output value */ + if ( outputval ) { + rtw_write8(padapter, REG_GPIO_PIN_CTRL_2 + 1, rtw_read8(padapter, REG_GPIO_PIN_CTRL_2 + 1) | BIT(index)); + } else { + rtw_write8(padapter, REG_GPIO_PIN_CTRL_2 + 1, rtw_read8(padapter, REG_GPIO_PIN_CTRL_2 + 1) & ~BIT(index)); + } + } +} +#endif //CONFIG_GPIO_WAKEUP + +void rtl8188es_set_wowlan_cmd(struct adapter* padapter, u8 enable) +{ + u8 res=_SUCCESS; + u32 test=0; + struct recv_priv *precvpriv = &padapter->recvpriv; + SETWOWLAN_PARM pwowlan_parm; + SETAOAC_GLOBAL_INFO paoac_global_info_parm; + struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter); + struct security_priv *psecpriv = &padapter->securitypriv; +#ifdef CONFIG_GPIO_WAKEUP + u8 gpio_wake_pin = 7; + u8 gpio_high_active = 0; //default low active +#endif + +_func_enter_; + DBG_871X_LEVEL(_drv_always_, "+%s+\n", __func__); + + pwowlan_parm.mode =0; + pwowlan_parm.gpio_index=0; + pwowlan_parm.gpio_duration=0; + pwowlan_parm.second_mode =0; + pwowlan_parm.reserve=0; + + if(enable){ + + pwowlan_parm.mode |=FW_WOWLAN_FUN_EN; + pwrpriv->wowlan_magic =_TRUE; + if (psecpriv->dot11PrivacyAlgrthm == _WEP40_ || psecpriv->dot11PrivacyAlgrthm == _WEP104_) + pwrpriv->wowlan_unicast =_TRUE; + + if(pwrpriv->wowlan_pattern ==_TRUE){ + pwowlan_parm.mode |= FW_WOWLAN_PATTERN_MATCH; + DBG_871X_LEVEL(_drv_info_, "%s 2.pwowlan_parm.mode=0x%x \n",__FUNCTION__,pwowlan_parm.mode ); + } + if(pwrpriv->wowlan_magic ==_TRUE){ + pwowlan_parm.mode |=FW_WOWLAN_MAGIC_PKT; + DBG_871X_LEVEL(_drv_info_, "%s 3.pwowlan_parm.mode=0x%x \n",__FUNCTION__,pwowlan_parm.mode ); + } + if(pwrpriv->wowlan_unicast ==_TRUE){ + pwowlan_parm.mode |=FW_WOWLAN_UNICAST; + DBG_871X_LEVEL(_drv_info_, "%s 4.pwowlan_parm.mode=0x%x \n",__FUNCTION__,pwowlan_parm.mode ); + } + + pwowlan_parm.mode |=FW_WOWLAN_REKEY_WAKEUP; + pwowlan_parm.mode |=FW_WOWLAN_DEAUTH_WAKEUP; + + //DataPinWakeUp +#ifdef CONFIG_USB_HCI + pwowlan_parm.gpio_index=0x0; +#endif //CONFIG_USB_HCI + +#ifdef CONFIG_SDIO_HCI + pwowlan_parm.gpio_index = 0x80; +#endif //CONFIG_SDIO_HCI + +#ifdef CONFIG_GPIO_WAKEUP + pwowlan_parm.gpio_index = gpio_wake_pin; + + //WOWLAN_GPIO_ACTIVE means GPIO high active + //pwowlan_parm.mode |=FW_WOWLAN_GPIO_ACTIVE; + if (gpio_high_active) + pwowlan_parm.mode |=FW_WOWLAN_GPIO_ACTIVE; +#endif //CONFIG_GPIO_WAKEUP + + DBG_871X_LEVEL(_drv_info_, "%s 5.pwowlan_parm.mode=0x%x \n",__FUNCTION__,pwowlan_parm.mode); + DBG_871X_LEVEL(_drv_info_, "%s 6.pwowlan_parm.index=0x%x \n",__FUNCTION__,pwowlan_parm.gpio_index); + res = FillH2CCmd_88E(padapter, H2C_COM_WWLAN, 2, (u8 *)&pwowlan_parm); + + rtw_msleep_os(2); + + //disconnect decision + pwowlan_parm.mode =1; + pwowlan_parm.gpio_index=0; + pwowlan_parm.gpio_duration=0; + FillH2CCmd_88E(padapter, H2C_COM_DISCNT_DECISION, 3, (u8 *)&pwowlan_parm); + + //keep alive period = 10 * 10 BCN interval + pwowlan_parm.mode = FW_WOWLAN_KEEP_ALIVE_EN | FW_ADOPT_USER | FW_WOWLAN_KEEP_ALIVE_PKT_TYPE; + pwowlan_parm.gpio_index=10; + res = FillH2CCmd_88E(padapter, H2C_COM_KEEP_ALIVE, 2, (u8 *)&pwowlan_parm); + + rtw_msleep_os(2); + //Configure STA security information for GTK rekey wakeup event. + paoac_global_info_parm.pairwiseEncAlg= + padapter->securitypriv.dot11PrivacyAlgrthm; + paoac_global_info_parm.groupEncAlg= + padapter->securitypriv.dot118021XGrpPrivacy; + res = FillH2CCmd_88E(padapter, H2C_COM_AOAC_GLOBAL_INFO, 2, (u8 *)&paoac_global_info_parm); + + rtw_msleep_os(2); + //enable Remote wake ctrl + pwowlan_parm.mode = FW_REMOTE_WAKE_CTRL_EN | FW_WOW_FW_UNICAST_EN | FW_ARP_EN; + if (psecpriv->dot11PrivacyAlgrthm == _AES_ || psecpriv->dot11PrivacyAlgrthm == _NO_PRIVACY_) + { + pwowlan_parm.gpio_index=0; + } else { + pwowlan_parm.gpio_index=1; + } + pwowlan_parm.gpio_duration=0; + + res = FillH2CCmd_88E(padapter, H2C_COM_REMOTE_WAKE_CTRL, 3, (u8 *)&pwowlan_parm); + } else { + pwrpriv->wowlan_magic =_FALSE; +#ifdef CONFIG_GPIO_WAKEUP + rtl8188es_set_output_gpio(padapter, gpio_wake_pin, !gpio_high_active); +#endif //CONFIG_GPIO_WAKEUP + res = FillH2CCmd_88E(padapter, H2C_COM_WWLAN, 2, (u8 *)&pwowlan_parm); + rtw_msleep_os(2); + res = FillH2CCmd_88E(padapter, H2C_COM_REMOTE_WAKE_CTRL, 3, (u8 *)&pwowlan_parm); + } +_func_exit_; + DBG_871X_LEVEL(_drv_always_, "-%s res:%d-\n", __func__, res); + return ; +} +#endif //CONFIG_WOWLAN diff --git a/hal/rtl8188e_dm.c b/hal/rtl8188e_dm.c index c850f38..2b5bc2e 100755 --- a/hal/rtl8188e_dm.c +++ b/hal/rtl8188e_dm.c @@ -1,647 +1,646 @@ -/****************************************************************************** - * - * 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 - * - * - ******************************************************************************/ -//============================================================ -// Description: -// -// This file is for 92CE/92CU dynamic mechanism only -// -// -//============================================================ -#define _RTL8188E_DM_C_ - -//============================================================ -// include files -//============================================================ -#include -#include -#include -#include - -#include - -//============================================================ -// Global var -//============================================================ - - -static VOID -dm_CheckProtection( - IN struct adapter *Adapter - ) -{ -#if 0 - PMGNT_INFO pMgntInfo = &(Adapter->MgntInfo); - u1Byte CurRate, RateThreshold; - - if(pMgntInfo->pHTInfo->bCurBW40MHz) - RateThreshold = MGN_MCS1; - else - RateThreshold = MGN_MCS3; - - if(Adapter->TxStats.CurrentInitTxRate <= RateThreshold) - { - pMgntInfo->bDmDisableProtect = TRUE; - DbgPrint("Forced disable protect: %x\n", Adapter->TxStats.CurrentInitTxRate); - } - else - { - pMgntInfo->bDmDisableProtect = FALSE; - DbgPrint("Enable protect: %x\n", Adapter->TxStats.CurrentInitTxRate); - } -#endif -} - -static VOID -dm_CheckStatistics( - IN struct adapter *Adapter - ) -{ -#if 0 - if(!Adapter->MgntInfo.bMediaConnect) - return; - - //2008.12.10 tynli Add for getting Current_Tx_Rate_Reg flexibly. - rtw_hal_get_hwreg( Adapter, HW_VAR_INIT_TX_RATE, (pu1Byte)(&Adapter->TxStats.CurrentInitTxRate) ); - - // Calculate current Tx Rate(Successful transmited!!) - - // Calculate current Rx Rate(Successful received!!) - - //for tx tx retry count - rtw_hal_get_hwreg( Adapter, HW_VAR_RETRY_COUNT, (pu1Byte)(&Adapter->TxStats.NumTxRetryCount) ); -#endif -} - -static void dm_CheckPbcGPIO(struct adapter *padapter) -{ - u8 tmp1byte; - u8 bPbcPressed = _FALSE; - - if(!padapter->registrypriv.hw_wps_pbc) - return; - -#ifdef CONFIG_USB_HCI - tmp1byte = rtw_read8(padapter, GPIO_IO_SEL); - tmp1byte |= (HAL_8188E_HW_GPIO_WPS_BIT); - rtw_write8(padapter, GPIO_IO_SEL, tmp1byte); //enable GPIO[2] as output mode - - tmp1byte &= ~(HAL_8188E_HW_GPIO_WPS_BIT); - rtw_write8(padapter, GPIO_IN, tmp1byte); //reset the floating voltage level - - tmp1byte = rtw_read8(padapter, GPIO_IO_SEL); - tmp1byte &= ~(HAL_8188E_HW_GPIO_WPS_BIT); - rtw_write8(padapter, GPIO_IO_SEL, tmp1byte); //enable GPIO[2] as input mode - - tmp1byte =rtw_read8(padapter, GPIO_IN); - - if (tmp1byte == 0xff) - return ; - - if (tmp1byte&HAL_8188E_HW_GPIO_WPS_BIT) - { - bPbcPressed = _TRUE; - } -#else - tmp1byte = rtw_read8(padapter, GPIO_IN); - //RT_TRACE(COMP_IO, DBG_TRACE, ("dm_CheckPbcGPIO - %x\n", tmp1byte)); - - if (tmp1byte == 0xff || padapter->init_adpt_in_progress) - return ; - - if((tmp1byte&HAL_8188E_HW_GPIO_WPS_BIT)==0) - { - bPbcPressed = _TRUE; - } -#endif - - if( _TRUE == bPbcPressed) - { - // Here we only set bPbcPressed to true - // After trigger PBC, the variable will be set to false - DBG_8192C("CheckPbcGPIO - PBC is pressed\n"); - -#ifdef RTK_DMP_PLATFORM -#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,12)) - kobject_uevent(&padapter->pnetdev->dev.kobj, KOBJ_NET_PBC); -#else - kobject_hotplug(&padapter->pnetdev->class_dev.kobj, KOBJ_NET_PBC); -#endif -#else - - if ( padapter->pid[0] == 0 ) - { // 0 is the default value and it means the application monitors the HW PBC doesn't privde its pid to driver. - return; - } - rtw_signal_process(padapter->pid[0], SIGUSR1); -#endif - } -} - -#ifdef CONFIG_PCI_HCI -// -// Description: -// Perform interrupt migration dynamically to reduce CPU utilization. -// -// Assumption: -// 1. Do not enable migration under WIFI test. -// -// Created by Roger, 2010.03.05. -// -VOID -dm_InterruptMigration( - IN struct adapter *Adapter - ) -{ - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); - struct mlme_priv *pmlmepriv = &(Adapter->mlmepriv); - BOOLEAN bCurrentIntMt, bCurrentACIntDisable; - BOOLEAN IntMtToSet = _FALSE; - BOOLEAN ACIntToSet = _FALSE; - - - // Retrieve current interrupt migration and Tx four ACs IMR settings first. - bCurrentIntMt = pHalData->bInterruptMigration; - bCurrentACIntDisable = pHalData->bDisableTxInt; - - // - // Currently we use busy traffic for reference instead of RxIntOK counts to prevent non-linear Rx statistics - // when interrupt migration is set before. 2010.03.05. - // - if(!Adapter->registrypriv.wifi_spec && - (check_fwstate(pmlmepriv, _FW_LINKED)== _TRUE) && - pmlmepriv->LinkDetectInfo.bHigherBusyTraffic) - { - IntMtToSet = _TRUE; - - // To check whether we should disable Tx interrupt or not. - if(pmlmepriv->LinkDetectInfo.bHigherBusyRxTraffic ) - ACIntToSet = _TRUE; - } - - //Update current settings. - if( bCurrentIntMt != IntMtToSet ){ - DBG_8192C("%s(): Update interrrupt migration(%d)\n",__FUNCTION__,IntMtToSet); - if(IntMtToSet) - { - // - // Set interrrupt migration timer and corresponging Tx/Rx counter. - // timer 25ns*0xfa0=100us for 0xf packets. - // 2010.03.05. - // - rtw_write32(Adapter, REG_INT_MIG, 0xff000fa0);// 0x306:Rx, 0x307:Tx - pHalData->bInterruptMigration = IntMtToSet; - } - else - { - // Reset all interrupt migration settings. - rtw_write32(Adapter, REG_INT_MIG, 0); - pHalData->bInterruptMigration = IntMtToSet; - } - } - - /*if( bCurrentACIntDisable != ACIntToSet ){ - DBG_8192C("%s(): Update AC interrrupt(%d)\n",__FUNCTION__,ACIntToSet); - if(ACIntToSet) // Disable four ACs interrupts. - { - // - // Disable VO, VI, BE and BK four AC interrupts to gain more efficient CPU utilization. - // When extremely highly Rx OK occurs, we will disable Tx interrupts. - // 2010.03.05. - // - UpdateInterruptMask8192CE( Adapter, 0, RT_AC_INT_MASKS ); - pHalData->bDisableTxInt = ACIntToSet; - } - else// Enable four ACs interrupts. - { - UpdateInterruptMask8192CE( Adapter, RT_AC_INT_MASKS, 0 ); - pHalData->bDisableTxInt = ACIntToSet; - } - }*/ - -} - -#endif - -// -// Initialize GPIO setting registers -// -static void -dm_InitGPIOSetting( - IN struct adapter *Adapter - ) -{ - PHAL_DATA_TYPE pHalData = GET_HAL_DATA(Adapter); - - u8 tmp1byte; - - tmp1byte = rtw_read8(Adapter, REG_GPIO_MUXCFG); - tmp1byte &= (GPIOSEL_GPIO | ~GPIOSEL_ENBT); - -#ifdef CONFIG_BT_COEXIST - // UMB-B cut bug. We need to support the modification. - if (IS_81xxC_VENDOR_UMC_B_CUT(pHalData->VersionID) && - pHalData->bt_coexist.BT_Coexist) - { - tmp1byte |= (BIT5); - } -#endif - rtw_write8(Adapter, REG_GPIO_MUXCFG, tmp1byte); - -} - -//============================================================ -// functions -//============================================================ -static void Init_ODM_ComInfo_88E(struct adapter *Adapter) -{ - - PHAL_DATA_TYPE pHalData = GET_HAL_DATA(Adapter); - struct dm_priv *pdmpriv = &pHalData->dmpriv; - PDM_ODM_T pDM_Odm = &(pHalData->odmpriv); - u8 cut_ver,fab_ver; - - // - // Init Value - // - _rtw_memset(pDM_Odm,0,sizeof(pDM_Odm)); - - pDM_Odm->Adapter = Adapter; - - ODM_CmnInfoInit(pDM_Odm,ODM_CMNINFO_PLATFORM,ODM_CE); - - if(Adapter->interface_type == RTW_GSPI ) - ODM_CmnInfoInit(pDM_Odm,ODM_CMNINFO_INTERFACE,ODM_ITRF_SDIO); - else - ODM_CmnInfoInit(pDM_Odm,ODM_CMNINFO_INTERFACE,Adapter->interface_type);//RTL871X_HCI_TYPE - - ODM_CmnInfoInit(pDM_Odm,ODM_CMNINFO_IC_TYPE,ODM_RTL8188E); - - fab_ver = ODM_TSMC; - cut_ver = ODM_CUT_A; - - ODM_CmnInfoInit(pDM_Odm,ODM_CMNINFO_FAB_VER,fab_ver); - ODM_CmnInfoInit(pDM_Odm,ODM_CMNINFO_CUT_VER,cut_ver); - - ODM_CmnInfoInit(pDM_Odm, ODM_CMNINFO_MP_TEST_CHIP,IS_NORMAL_CHIP(pHalData->VersionID)); - -#if 0 -//#ifdef CONFIG_USB_HCI - ODM_CmnInfoInit(pDM_Odm,ODM_CMNINFO_BOARD_TYPE,pHalData->BoardType); - - if(pHalData->BoardType == BOARD_USB_High_PA){ - ODM_CmnInfoInit(pDM_Odm,ODM_CMNINFO_EXT_LNA,_TRUE); - ODM_CmnInfoInit(pDM_Odm,ODM_CMNINFO_EXT_PA,_TRUE); - } -#endif - ODM_CmnInfoInit(pDM_Odm,ODM_CMNINFO_PATCH_ID,pHalData->CustomerID); - // ODM_CMNINFO_BINHCT_TEST only for MP Team - ODM_CmnInfoInit(pDM_Odm,ODM_CMNINFO_BWIFI_TEST,Adapter->registrypriv.wifi_spec); - - - if(pHalData->rf_type == RF_1T1R){ - ODM_CmnInfoUpdate(pDM_Odm,ODM_CMNINFO_RF_TYPE,ODM_1T1R); - } - else if(pHalData->rf_type == RF_2T2R){ - ODM_CmnInfoUpdate(pDM_Odm,ODM_CMNINFO_RF_TYPE,ODM_2T2R); - } - else if(pHalData->rf_type == RF_1T2R){ - ODM_CmnInfoUpdate(pDM_Odm,ODM_CMNINFO_RF_TYPE,ODM_1T2R); - } - - ODM_CmnInfoInit(pDM_Odm, ODM_CMNINFO_RF_ANTENNA_TYPE, pHalData->TRxAntDivType); - - #ifdef CONFIG_DISABLE_ODM - pdmpriv->InitODMFlag = 0; - #else - pdmpriv->InitODMFlag = ODM_RF_CALIBRATION | - ODM_RF_TX_PWR_TRACK //| - ; - //if(pHalData->AntDivCfg) - // pdmpriv->InitODMFlag |= ODM_BB_ANT_DIV; - #endif - - ODM_CmnInfoUpdate(pDM_Odm,ODM_CMNINFO_ABILITY,pdmpriv->InitODMFlag); - -} -static void Update_ODM_ComInfo_88E(struct adapter *Adapter) -{ - struct mlme_ext_priv *pmlmeext = &Adapter->mlmeextpriv; - struct mlme_priv *pmlmepriv = &Adapter->mlmepriv; - struct pwrctrl_priv *pwrctrlpriv = adapter_to_pwrctl(Adapter); - PHAL_DATA_TYPE pHalData = GET_HAL_DATA(Adapter); - PDM_ODM_T pDM_Odm = &(pHalData->odmpriv); - struct dm_priv *pdmpriv = &pHalData->dmpriv; - int i; - - pdmpriv->InitODMFlag = 0 - | ODM_BB_DIG -#ifdef CONFIG_ODM_REFRESH_RAMASK - | ODM_BB_RA_MASK -#endif - | ODM_BB_DYNAMIC_TXPWR - | ODM_BB_FA_CNT - | ODM_BB_RSSI_MONITOR - | ODM_BB_CCK_PD - | ODM_BB_PWR_SAVE - | ODM_RF_CALIBRATION - | ODM_RF_TX_PWR_TRACK -#ifdef CONFIG_ODM_ADAPTIVITY - | ODM_BB_ADAPTIVITY -#endif - ; - - if (!Adapter->registrypriv.qos_opt_enable) { - pdmpriv->InitODMFlag |= ODM_MAC_EDCA_TURBO; - } - - if(pHalData->AntDivCfg) - pdmpriv->InitODMFlag |= ODM_BB_ANT_DIV; - -#if (MP_DRIVER==1) - if (Adapter->registrypriv.mp_mode == 1) { - pdmpriv->InitODMFlag = 0 - | ODM_RF_CALIBRATION - | ODM_RF_TX_PWR_TRACK - ; - } -#endif//(MP_DRIVER==1) - -#ifdef CONFIG_DISABLE_ODM - pdmpriv->InitODMFlag = 0; -#endif//CONFIG_DISABLE_ODM - - ODM_CmnInfoUpdate(pDM_Odm,ODM_CMNINFO_ABILITY,pdmpriv->InitODMFlag); - - ODM_CmnInfoHook(pDM_Odm,ODM_CMNINFO_TX_UNI,&(Adapter->xmitpriv.tx_bytes)); - ODM_CmnInfoHook(pDM_Odm,ODM_CMNINFO_RX_UNI,&(Adapter->recvpriv.rx_bytes)); - ODM_CmnInfoHook(pDM_Odm,ODM_CMNINFO_WM_MODE,&(pmlmeext->cur_wireless_mode)); - ODM_CmnInfoHook(pDM_Odm,ODM_CMNINFO_SEC_CHNL_OFFSET,&(pHalData->nCur40MhzPrimeSC)); - ODM_CmnInfoHook(pDM_Odm,ODM_CMNINFO_SEC_MODE,&(Adapter->securitypriv.dot11PrivacyAlgrthm)); - ODM_CmnInfoHook(pDM_Odm,ODM_CMNINFO_BW,&(pHalData->CurrentChannelBW )); - ODM_CmnInfoHook(pDM_Odm,ODM_CMNINFO_CHNL,&( pHalData->CurrentChannel)); - ODM_CmnInfoHook(pDM_Odm,ODM_CMNINFO_NET_CLOSED,&( Adapter->net_closed)); - ODM_CmnInfoHook(pDM_Odm,ODM_CMNINFO_MP_MODE,&(Adapter->registrypriv.mp_mode)); - - ODM_CmnInfoHook(pDM_Odm,ODM_CMNINFO_BAND,&(pDM_Odm->u1Byte_temp)); - //================= only for 8192D ================= - /* - //pHalData->CurrentBandType92D - ODM_CmnInfoHook(pDM_Odm,ODM_CMNINFO_BAND,&(pDM_Odm->u1Byte_temp)); - ODM_CmnInfoHook(pDM_Odm,ODM_CMNINFO_DMSP_GET_VALUE,&(pDM_Odm->u1Byte_temp)); - ODM_CmnInfoHook(pDM_Odm,ODM_CMNINFO_BUDDY_ADAPTOR,&(pDM_Odm->PADAPTER_temp)); - ODM_CmnInfoHook(pDM_Odm,ODM_CMNINFO_DMSP_IS_MASTER,&(pDM_Odm->u1Byte_temp)); - //================= only for 8192D ================= - // driver havn't those variable now - ODM_CmnInfoHook(pDM_Odm,ODM_CMNINFO_BT_OPERATION,&(pDM_Odm->u1Byte_temp)); - ODM_CmnInfoHook(pDM_Odm,ODM_CMNINFO_BT_DISABLE_EDCA,&(pDM_Odm->u1Byte_temp)); - */ - - ODM_CmnInfoHook(pDM_Odm,ODM_CMNINFO_SCAN,&(pmlmepriv->bScanInProcess)); - ODM_CmnInfoHook(pDM_Odm,ODM_CMNINFO_POWER_SAVING,&(pwrctrlpriv->bpower_saving)); - ODM_CmnInfoInit(pDM_Odm, ODM_CMNINFO_RF_ANTENNA_TYPE, pHalData->TRxAntDivType); - - for(i=0; i< NUM_STA; i++) - { - //pDM_Odm->pODM_StaInfo[i] = NULL; - ODM_CmnInfoPtrArrayHook(pDM_Odm, ODM_CMNINFO_STA_STATUS,i,NULL); - } -} - -void -rtl8188e_InitHalDm( - IN struct adapter *Adapter - ) -{ - PHAL_DATA_TYPE pHalData = GET_HAL_DATA(Adapter); - struct dm_priv *pdmpriv = &pHalData->dmpriv; - PDM_ODM_T pDM_Odm = &(pHalData->odmpriv); - u8 i; - -#ifdef CONFIG_USB_HCI - dm_InitGPIOSetting(Adapter); -#endif - - pdmpriv->DM_Type = DM_Type_ByDriver; - pdmpriv->DMFlag = DYNAMIC_FUNC_DISABLE; - - Update_ODM_ComInfo_88E(Adapter); - ODM_DMInit(pDM_Odm); - - Adapter->fix_rate = 0xFF; - -} - - -VOID -rtl8188e_HalDmWatchDog( - IN struct adapter *Adapter - ) -{ - BOOLEAN bFwCurrentInPSMode = _FALSE; - BOOLEAN bFwPSAwake = _TRUE; - u8 hw_init_completed = _FALSE; - PHAL_DATA_TYPE pHalData = GET_HAL_DATA(Adapter); - struct dm_priv *pdmpriv = &pHalData->dmpriv; - PDM_ODM_T pDM_Odm = &(pHalData->odmpriv); -#ifdef CONFIG_CONCURRENT_MODE - struct adapter *pbuddy_adapter = Adapter->pbuddy_adapter; -#endif //CONFIG_CONCURRENT_MODE - - _func_enter_; - - hw_init_completed = Adapter->hw_init_completed; - - if (hw_init_completed == _FALSE) - goto skip_dm; - -#ifdef CONFIG_LPS - bFwCurrentInPSMode = adapter_to_pwrctl(Adapter)->bFwCurrentInPSMode; - rtw_hal_get_hwreg(Adapter, HW_VAR_FWLPS_RF_ON, (u8 *)(&bFwPSAwake)); -#endif - -#ifdef CONFIG_P2P_PS - // Fw is under p2p powersaving mode, driver should stop dynamic mechanism. - // modifed by thomas. 2011.06.11. - if(Adapter->wdinfo.p2p_ps_mode) - bFwPSAwake = _FALSE; -#endif //CONFIG_P2P_PS - - if( (hw_init_completed == _TRUE) - && ((!bFwCurrentInPSMode) && bFwPSAwake)) - { - // - // Calculate Tx/Rx statistics. - // - dm_CheckStatistics(Adapter); - - // - // Dynamically switch RTS/CTS protection. - // - //dm_CheckProtection(Adapter); - -#ifdef CONFIG_PCI_HCI - // 20100630 Joseph: Disable Interrupt Migration mechanism temporarily because it degrades Rx throughput. - // Tx Migration settings. - //dm_InterruptMigration(Adapter); - - //if(Adapter->HalFunc.TxCheckStuckHandler(Adapter)) - // PlatformScheduleWorkItem(&(GET_HAL_DATA(Adapter)->HalResetWorkItem)); -#endif - - } - - - //ODM - if (hw_init_completed == _TRUE) - { - u8 bLinked=_FALSE; - u8 bsta_state = _FALSE; - - #ifdef CONFIG_DISABLE_ODM - pHalData->odmpriv.SupportAbility = 0; - #endif - - if(rtw_linked_check(Adapter)) - bLinked = _TRUE; - -#ifdef CONFIG_CONCURRENT_MODE - if(pbuddy_adapter && rtw_linked_check(pbuddy_adapter)) - bLinked = _TRUE; -#endif //CONFIG_CONCURRENT_MODE - ODM_CmnInfoUpdate(&pHalData->odmpriv ,ODM_CMNINFO_LINK, bLinked); - - - if (check_fwstate(&Adapter->mlmepriv, WIFI_STATION_STATE)) - bsta_state = _TRUE; -#ifdef CONFIG_CONCURRENT_MODE - if(pbuddy_adapter && check_fwstate(&pbuddy_adapter->mlmepriv, WIFI_STATION_STATE)) - bsta_state = _TRUE; -#endif //CONFIG_CONCURRENT_MODE - ODM_CmnInfoUpdate(&pHalData->odmpriv ,ODM_CMNINFO_STATION_STATE, bsta_state); - - ODM_DMWatchdog(&pHalData->odmpriv); - - } - -skip_dm: - - // Check GPIO to determine current RF on/off and Pbc status. - // Check Hardware Radio ON/OFF or not -#ifdef CONFIG_PCI_HCI - if(pHalData->bGpioHwWpsPbc) -#endif - { - //temp removed - //dm_CheckPbcGPIO(Adapter); - } - return; -} - -void rtl8188e_init_dm_priv(IN struct adapter *Adapter) -{ - PHAL_DATA_TYPE pHalData = GET_HAL_DATA(Adapter); - struct dm_priv *pdmpriv = &pHalData->dmpriv; - PDM_ODM_T podmpriv = &pHalData->odmpriv; - _rtw_memset(pdmpriv, 0, sizeof(struct dm_priv)); - //_rtw_spinlock_init(&(pHalData->odm_stainfo_lock)); - Init_ODM_ComInfo_88E(Adapter); -#ifdef CONFIG_SW_ANTENNA_DIVERSITY - //_init_timer(&(pdmpriv->SwAntennaSwitchTimer), Adapter->pnetdev , odm_SW_AntennaSwitchCallback, Adapter); - ODM_InitAllTimers(podmpriv ); -#endif - ODM_InitDebugSetting(podmpriv); -} - -void rtl8188e_deinit_dm_priv(IN struct adapter *Adapter) -{ - PHAL_DATA_TYPE pHalData = GET_HAL_DATA(Adapter); - struct dm_priv *pdmpriv = &pHalData->dmpriv; - PDM_ODM_T podmpriv = &pHalData->odmpriv; - //_rtw_spinlock_free(&pHalData->odm_stainfo_lock); -#ifdef CONFIG_SW_ANTENNA_DIVERSITY - //_cancel_timer_ex(&pdmpriv->SwAntennaSwitchTimer); - ODM_CancelAllTimers(podmpriv); -#endif -} - - -#ifdef CONFIG_ANTENNA_DIVERSITY -// Add new function to reset the state of antenna diversity before link. -// -// Compare RSSI for deciding antenna -void AntDivCompare8188E(struct adapter *Adapter, WLAN_BSSID_EX *dst, WLAN_BSSID_EX *src) -{ - //struct adapter *Adapter = pDM_Odm->Adapter ; - - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); - if(0 != pHalData->AntDivCfg ) - { - //DBG_8192C("update_network=> orgRSSI(%d)(%d),newRSSI(%d)(%d)\n",dst->Rssi,query_rx_pwr_percentage(dst->Rssi), - // src->Rssi,query_rx_pwr_percentage(src->Rssi)); - //select optimum_antenna for before linked =>For antenna diversity - if(dst->Rssi >= src->Rssi )//keep org parameter - { - src->Rssi = dst->Rssi; - src->PhyInfo.Optimum_antenna = dst->PhyInfo.Optimum_antenna; - } - } -} - -// Add new function to reset the state of antenna diversity before link. -u8 AntDivBeforeLink8188E(struct adapter *Adapter ) -{ - - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); - PDM_ODM_T pDM_Odm =&pHalData->odmpriv; - SWAT_T *pDM_SWAT_Table = &pDM_Odm->DM_SWAT_Table; - struct mlme_priv *pmlmepriv = &(Adapter->mlmepriv); - - // Condition that does not need to use antenna diversity. - if(pHalData->AntDivCfg==0) - { - //DBG_8192C("odm_AntDivBeforeLink8192C(): No AntDiv Mechanism.\n"); - return _FALSE; - } - - if(check_fwstate(pmlmepriv, _FW_LINKED) == _TRUE) - { - return _FALSE; - } - - - if(pDM_SWAT_Table->SWAS_NoLink_State == 0){ - //switch channel - pDM_SWAT_Table->SWAS_NoLink_State = 1; - pDM_SWAT_Table->CurAntenna = (pDM_SWAT_Table->CurAntenna==Antenna_A)?Antenna_B:Antenna_A; - - //PHY_SetBBReg(Adapter, rFPGA0_XA_RFInterfaceOE, 0x300, pDM_SWAT_Table->CurAntenna); - rtw_antenna_select_cmd(Adapter, pDM_SWAT_Table->CurAntenna, _FALSE); - //DBG_8192C("%s change antenna to ANT_( %s ).....\n",__FUNCTION__, (pDM_SWAT_Table->CurAntenna==Antenna_A)?"A":"B"); - return _TRUE; - } - else - { - pDM_SWAT_Table->SWAS_NoLink_State = 0; - return _FALSE; - } - -} -#endif - +/****************************************************************************** + * + * 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 + * + * + ******************************************************************************/ +//============================================================ +// Description: +// +// This file is for 92CE/92CU dynamic mechanism only +// +// +//============================================================ +#define _RTL8188E_DM_C_ + +//============================================================ +// include files +//============================================================ +#include +#include +#include +#include + +#include + +//============================================================ +// Global var +//============================================================ + + +static VOID +dm_CheckProtection( + IN struct adapter *Adapter + ) +{ +#if 0 + PMGNT_INFO pMgntInfo = &(Adapter->MgntInfo); + u1Byte CurRate, RateThreshold; + + if(pMgntInfo->pHTInfo->bCurBW40MHz) + RateThreshold = MGN_MCS1; + else + RateThreshold = MGN_MCS3; + + if(Adapter->TxStats.CurrentInitTxRate <= RateThreshold) + { + pMgntInfo->bDmDisableProtect = TRUE; + DbgPrint("Forced disable protect: %x\n", Adapter->TxStats.CurrentInitTxRate); + } + else + { + pMgntInfo->bDmDisableProtect = FALSE; + DbgPrint("Enable protect: %x\n", Adapter->TxStats.CurrentInitTxRate); + } +#endif +} + +static VOID +dm_CheckStatistics( + IN struct adapter *Adapter + ) +{ +#if 0 + if(!Adapter->MgntInfo.bMediaConnect) + return; + + //2008.12.10 tynli Add for getting Current_Tx_Rate_Reg flexibly. + rtw_hal_get_hwreg( Adapter, HW_VAR_INIT_TX_RATE, (pu1Byte)(&Adapter->TxStats.CurrentInitTxRate) ); + + // Calculate current Tx Rate(Successful transmited!!) + + // Calculate current Rx Rate(Successful received!!) + + //for tx tx retry count + rtw_hal_get_hwreg( Adapter, HW_VAR_RETRY_COUNT, (pu1Byte)(&Adapter->TxStats.NumTxRetryCount) ); +#endif +} + +static void dm_CheckPbcGPIO(struct adapter *padapter) +{ + u8 tmp1byte; + u8 bPbcPressed = _FALSE; + + if(!padapter->registrypriv.hw_wps_pbc) + return; + +#ifdef CONFIG_USB_HCI + tmp1byte = rtw_read8(padapter, GPIO_IO_SEL); + tmp1byte |= (HAL_8188E_HW_GPIO_WPS_BIT); + rtw_write8(padapter, GPIO_IO_SEL, tmp1byte); //enable GPIO[2] as output mode + + tmp1byte &= ~(HAL_8188E_HW_GPIO_WPS_BIT); + rtw_write8(padapter, GPIO_IN, tmp1byte); //reset the floating voltage level + + tmp1byte = rtw_read8(padapter, GPIO_IO_SEL); + tmp1byte &= ~(HAL_8188E_HW_GPIO_WPS_BIT); + rtw_write8(padapter, GPIO_IO_SEL, tmp1byte); //enable GPIO[2] as input mode + + tmp1byte =rtw_read8(padapter, GPIO_IN); + + if (tmp1byte == 0xff) + return ; + + if (tmp1byte&HAL_8188E_HW_GPIO_WPS_BIT) + { + bPbcPressed = _TRUE; + } +#else + tmp1byte = rtw_read8(padapter, GPIO_IN); + //RT_TRACE(COMP_IO, DBG_TRACE, ("dm_CheckPbcGPIO - %x\n", tmp1byte)); + + if (tmp1byte == 0xff || padapter->init_adpt_in_progress) + return ; + + if((tmp1byte&HAL_8188E_HW_GPIO_WPS_BIT)==0) + { + bPbcPressed = _TRUE; + } +#endif + + if( _TRUE == bPbcPressed) + { + // Here we only set bPbcPressed to true + // After trigger PBC, the variable will be set to false + DBG_8192C("CheckPbcGPIO - PBC is pressed\n"); + +#ifdef RTK_DMP_PLATFORM +#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,12)) + kobject_uevent(&padapter->pnetdev->dev.kobj, KOBJ_NET_PBC); +#else + kobject_hotplug(&padapter->pnetdev->class_dev.kobj, KOBJ_NET_PBC); +#endif +#else + + if ( padapter->pid[0] == 0 ) + { // 0 is the default value and it means the application monitors the HW PBC doesn't privde its pid to driver. + return; + } + rtw_signal_process(padapter->pid[0], SIGUSR1); +#endif + } +} + +#ifdef CONFIG_PCI_HCI +// +// Description: +// Perform interrupt migration dynamically to reduce CPU utilization. +// +// Assumption: +// 1. Do not enable migration under WIFI test. +// +// Created by Roger, 2010.03.05. +// +VOID +dm_InterruptMigration( + IN struct adapter *Adapter + ) +{ + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); + struct mlme_priv *pmlmepriv = &(Adapter->mlmepriv); + BOOLEAN bCurrentIntMt, bCurrentACIntDisable; + BOOLEAN IntMtToSet = _FALSE; + BOOLEAN ACIntToSet = _FALSE; + + + // Retrieve current interrupt migration and Tx four ACs IMR settings first. + bCurrentIntMt = pHalData->bInterruptMigration; + bCurrentACIntDisable = pHalData->bDisableTxInt; + + // + // Currently we use busy traffic for reference instead of RxIntOK counts to prevent non-linear Rx statistics + // when interrupt migration is set before. 2010.03.05. + // + if(!Adapter->registrypriv.wifi_spec && + (check_fwstate(pmlmepriv, _FW_LINKED)== _TRUE) && + pmlmepriv->LinkDetectInfo.bHigherBusyTraffic) + { + IntMtToSet = _TRUE; + + // To check whether we should disable Tx interrupt or not. + if(pmlmepriv->LinkDetectInfo.bHigherBusyRxTraffic ) + ACIntToSet = _TRUE; + } + + //Update current settings. + if( bCurrentIntMt != IntMtToSet ){ + DBG_8192C("%s(): Update interrrupt migration(%d)\n",__FUNCTION__,IntMtToSet); + if(IntMtToSet) + { + // + // Set interrrupt migration timer and corresponging Tx/Rx counter. + // timer 25ns*0xfa0=100us for 0xf packets. + // 2010.03.05. + // + rtw_write32(Adapter, REG_INT_MIG, 0xff000fa0);// 0x306:Rx, 0x307:Tx + pHalData->bInterruptMigration = IntMtToSet; + } + else + { + // Reset all interrupt migration settings. + rtw_write32(Adapter, REG_INT_MIG, 0); + pHalData->bInterruptMigration = IntMtToSet; + } + } + + /*if( bCurrentACIntDisable != ACIntToSet ){ + DBG_8192C("%s(): Update AC interrrupt(%d)\n",__FUNCTION__,ACIntToSet); + if(ACIntToSet) // Disable four ACs interrupts. + { + // + // Disable VO, VI, BE and BK four AC interrupts to gain more efficient CPU utilization. + // When extremely highly Rx OK occurs, we will disable Tx interrupts. + // 2010.03.05. + // + UpdateInterruptMask8192CE( Adapter, 0, RT_AC_INT_MASKS ); + pHalData->bDisableTxInt = ACIntToSet; + } + else// Enable four ACs interrupts. + { + UpdateInterruptMask8192CE( Adapter, RT_AC_INT_MASKS, 0 ); + pHalData->bDisableTxInt = ACIntToSet; + } + }*/ + +} + +#endif + +// +// Initialize GPIO setting registers +// +static void +dm_InitGPIOSetting( + IN struct adapter *Adapter + ) +{ + PHAL_DATA_TYPE pHalData = GET_HAL_DATA(Adapter); + + u8 tmp1byte; + + tmp1byte = rtw_read8(Adapter, REG_GPIO_MUXCFG); + tmp1byte &= (GPIOSEL_GPIO | ~GPIOSEL_ENBT); + +#ifdef CONFIG_BT_COEXIST + // UMB-B cut bug. We need to support the modification. + if (IS_81xxC_VENDOR_UMC_B_CUT(pHalData->VersionID) && + pHalData->bt_coexist.BT_Coexist) + { + tmp1byte |= (BIT5); + } +#endif + rtw_write8(Adapter, REG_GPIO_MUXCFG, tmp1byte); + +} + +//============================================================ +// functions +//============================================================ +static void Init_ODM_ComInfo_88E(struct adapter *Adapter) +{ + + PHAL_DATA_TYPE pHalData = GET_HAL_DATA(Adapter); + struct dm_priv *pdmpriv = &pHalData->dmpriv; + PDM_ODM_T pDM_Odm = &(pHalData->odmpriv); + u8 cut_ver,fab_ver; + + // + // Init Value + // + _rtw_memset(pDM_Odm,0,sizeof(pDM_Odm)); + + pDM_Odm->Adapter = Adapter; + + ODM_CmnInfoInit(pDM_Odm,ODM_CMNINFO_PLATFORM,ODM_CE); + + if(Adapter->interface_type == RTW_GSPI ) + ODM_CmnInfoInit(pDM_Odm,ODM_CMNINFO_INTERFACE,ODM_ITRF_SDIO); + else + ODM_CmnInfoInit(pDM_Odm,ODM_CMNINFO_INTERFACE,Adapter->interface_type);//RTL871X_HCI_TYPE + + ODM_CmnInfoInit(pDM_Odm,ODM_CMNINFO_IC_TYPE,ODM_RTL8188E); + + fab_ver = ODM_TSMC; + cut_ver = ODM_CUT_A; + + ODM_CmnInfoInit(pDM_Odm,ODM_CMNINFO_FAB_VER,fab_ver); + ODM_CmnInfoInit(pDM_Odm,ODM_CMNINFO_CUT_VER,cut_ver); + + ODM_CmnInfoInit(pDM_Odm, ODM_CMNINFO_MP_TEST_CHIP,IS_NORMAL_CHIP(pHalData->VersionID)); + +#if 0 +//#ifdef CONFIG_USB_HCI + ODM_CmnInfoInit(pDM_Odm,ODM_CMNINFO_BOARD_TYPE,pHalData->BoardType); + + if(pHalData->BoardType == BOARD_USB_High_PA){ + ODM_CmnInfoInit(pDM_Odm,ODM_CMNINFO_EXT_LNA,_TRUE); + ODM_CmnInfoInit(pDM_Odm,ODM_CMNINFO_EXT_PA,_TRUE); + } +#endif + ODM_CmnInfoInit(pDM_Odm,ODM_CMNINFO_PATCH_ID,pHalData->CustomerID); + // ODM_CMNINFO_BINHCT_TEST only for MP Team + ODM_CmnInfoInit(pDM_Odm,ODM_CMNINFO_BWIFI_TEST,Adapter->registrypriv.wifi_spec); + + + if(pHalData->rf_type == RF_1T1R){ + ODM_CmnInfoUpdate(pDM_Odm,ODM_CMNINFO_RF_TYPE,ODM_1T1R); + } + else if(pHalData->rf_type == RF_2T2R){ + ODM_CmnInfoUpdate(pDM_Odm,ODM_CMNINFO_RF_TYPE,ODM_2T2R); + } + else if(pHalData->rf_type == RF_1T2R){ + ODM_CmnInfoUpdate(pDM_Odm,ODM_CMNINFO_RF_TYPE,ODM_1T2R); + } + + ODM_CmnInfoInit(pDM_Odm, ODM_CMNINFO_RF_ANTENNA_TYPE, pHalData->TRxAntDivType); + + #ifdef CONFIG_DISABLE_ODM + pdmpriv->InitODMFlag = 0; + #else + pdmpriv->InitODMFlag = ODM_RF_CALIBRATION | + ODM_RF_TX_PWR_TRACK //| + ; + //if(pHalData->AntDivCfg) + // pdmpriv->InitODMFlag |= ODM_BB_ANT_DIV; + #endif + + ODM_CmnInfoUpdate(pDM_Odm,ODM_CMNINFO_ABILITY,pdmpriv->InitODMFlag); + +} +static void Update_ODM_ComInfo_88E(struct adapter *Adapter) +{ + struct mlme_ext_priv *pmlmeext = &Adapter->mlmeextpriv; + struct mlme_priv *pmlmepriv = &Adapter->mlmepriv; + struct pwrctrl_priv *pwrctrlpriv = adapter_to_pwrctl(Adapter); + PHAL_DATA_TYPE pHalData = GET_HAL_DATA(Adapter); + PDM_ODM_T pDM_Odm = &(pHalData->odmpriv); + struct dm_priv *pdmpriv = &pHalData->dmpriv; + int i; + + pdmpriv->InitODMFlag = 0 + | ODM_BB_DIG +#ifdef CONFIG_ODM_REFRESH_RAMASK + | ODM_BB_RA_MASK +#endif + | ODM_BB_DYNAMIC_TXPWR + | ODM_BB_FA_CNT + | ODM_BB_RSSI_MONITOR + | ODM_BB_CCK_PD + | ODM_BB_PWR_SAVE + | ODM_RF_CALIBRATION + | ODM_RF_TX_PWR_TRACK +#ifdef CONFIG_ODM_ADAPTIVITY + | ODM_BB_ADAPTIVITY +#endif + ; + + if (!Adapter->registrypriv.qos_opt_enable) { + pdmpriv->InitODMFlag |= ODM_MAC_EDCA_TURBO; + } + + if(pHalData->AntDivCfg) + pdmpriv->InitODMFlag |= ODM_BB_ANT_DIV; + +#if (MP_DRIVER==1) + if (Adapter->registrypriv.mp_mode == 1) { + pdmpriv->InitODMFlag = 0 + | ODM_RF_CALIBRATION + | ODM_RF_TX_PWR_TRACK + ; + } +#endif//(MP_DRIVER==1) + +#ifdef CONFIG_DISABLE_ODM + pdmpriv->InitODMFlag = 0; +#endif//CONFIG_DISABLE_ODM + + ODM_CmnInfoUpdate(pDM_Odm,ODM_CMNINFO_ABILITY,pdmpriv->InitODMFlag); + + ODM_CmnInfoHook(pDM_Odm,ODM_CMNINFO_TX_UNI,&(Adapter->xmitpriv.tx_bytes)); + ODM_CmnInfoHook(pDM_Odm,ODM_CMNINFO_RX_UNI,&(Adapter->recvpriv.rx_bytes)); + ODM_CmnInfoHook(pDM_Odm,ODM_CMNINFO_WM_MODE,&(pmlmeext->cur_wireless_mode)); + ODM_CmnInfoHook(pDM_Odm,ODM_CMNINFO_SEC_CHNL_OFFSET,&(pHalData->nCur40MhzPrimeSC)); + ODM_CmnInfoHook(pDM_Odm,ODM_CMNINFO_SEC_MODE,&(Adapter->securitypriv.dot11PrivacyAlgrthm)); + ODM_CmnInfoHook(pDM_Odm,ODM_CMNINFO_BW,&(pHalData->CurrentChannelBW )); + ODM_CmnInfoHook(pDM_Odm,ODM_CMNINFO_CHNL,&( pHalData->CurrentChannel)); + ODM_CmnInfoHook(pDM_Odm,ODM_CMNINFO_NET_CLOSED,&( Adapter->net_closed)); + ODM_CmnInfoHook(pDM_Odm,ODM_CMNINFO_MP_MODE,&(Adapter->registrypriv.mp_mode)); + + ODM_CmnInfoHook(pDM_Odm,ODM_CMNINFO_BAND,&(pDM_Odm->u1Byte_temp)); + //================= only for 8192D ================= + /* + //pHalData->CurrentBandType92D + ODM_CmnInfoHook(pDM_Odm,ODM_CMNINFO_BAND,&(pDM_Odm->u1Byte_temp)); + ODM_CmnInfoHook(pDM_Odm,ODM_CMNINFO_DMSP_GET_VALUE,&(pDM_Odm->u1Byte_temp)); + ODM_CmnInfoHook(pDM_Odm,ODM_CMNINFO_BUDDY_ADAPTOR,&(pDM_Odm->PADAPTER_temp)); + ODM_CmnInfoHook(pDM_Odm,ODM_CMNINFO_DMSP_IS_MASTER,&(pDM_Odm->u1Byte_temp)); + //================= only for 8192D ================= + // driver havn't those variable now + ODM_CmnInfoHook(pDM_Odm,ODM_CMNINFO_BT_OPERATION,&(pDM_Odm->u1Byte_temp)); + ODM_CmnInfoHook(pDM_Odm,ODM_CMNINFO_BT_DISABLE_EDCA,&(pDM_Odm->u1Byte_temp)); + */ + + ODM_CmnInfoHook(pDM_Odm,ODM_CMNINFO_SCAN,&(pmlmepriv->bScanInProcess)); + ODM_CmnInfoHook(pDM_Odm,ODM_CMNINFO_POWER_SAVING,&(pwrctrlpriv->bpower_saving)); + ODM_CmnInfoInit(pDM_Odm, ODM_CMNINFO_RF_ANTENNA_TYPE, pHalData->TRxAntDivType); + + for(i=0; i< NUM_STA; i++) + { + //pDM_Odm->pODM_StaInfo[i] = NULL; + ODM_CmnInfoPtrArrayHook(pDM_Odm, ODM_CMNINFO_STA_STATUS,i,NULL); + } +} + +void +rtl8188e_InitHalDm( + IN struct adapter *Adapter + ) +{ + PHAL_DATA_TYPE pHalData = GET_HAL_DATA(Adapter); + struct dm_priv *pdmpriv = &pHalData->dmpriv; + PDM_ODM_T pDM_Odm = &(pHalData->odmpriv); + u8 i; + +#ifdef CONFIG_USB_HCI + dm_InitGPIOSetting(Adapter); +#endif + + pdmpriv->DM_Type = DM_Type_ByDriver; + pdmpriv->DMFlag = DYNAMIC_FUNC_DISABLE; + + Update_ODM_ComInfo_88E(Adapter); + ODM_DMInit(pDM_Odm); + + Adapter->fix_rate = 0xFF; + +} + + +VOID +rtl8188e_HalDmWatchDog( + IN struct adapter *Adapter + ) +{ + BOOLEAN bFwCurrentInPSMode = _FALSE; + BOOLEAN bFwPSAwake = _TRUE; + u8 hw_init_completed = _FALSE; + PHAL_DATA_TYPE pHalData = GET_HAL_DATA(Adapter); + struct dm_priv *pdmpriv = &pHalData->dmpriv; + PDM_ODM_T pDM_Odm = &(pHalData->odmpriv); +#ifdef CONFIG_CONCURRENT_MODE + struct adapter *pbuddy_adapter = Adapter->pbuddy_adapter; +#endif //CONFIG_CONCURRENT_MODE + + _func_enter_; + + hw_init_completed = Adapter->hw_init_completed; + + if (hw_init_completed == _FALSE) + goto skip_dm; + +#ifdef CONFIG_LPS + bFwCurrentInPSMode = adapter_to_pwrctl(Adapter)->bFwCurrentInPSMode; + rtw_hal_get_hwreg(Adapter, HW_VAR_FWLPS_RF_ON, (u8 *)(&bFwPSAwake)); +#endif + +#ifdef CONFIG_P2P_PS + // Fw is under p2p powersaving mode, driver should stop dynamic mechanism. + // modifed by thomas. 2011.06.11. + if(Adapter->wdinfo.p2p_ps_mode) + bFwPSAwake = _FALSE; +#endif //CONFIG_P2P_PS + + if( (hw_init_completed == _TRUE) + && ((!bFwCurrentInPSMode) && bFwPSAwake)) + { + // + // Calculate Tx/Rx statistics. + // + dm_CheckStatistics(Adapter); + + // + // Dynamically switch RTS/CTS protection. + // + //dm_CheckProtection(Adapter); + +#ifdef CONFIG_PCI_HCI + // 20100630 Joseph: Disable Interrupt Migration mechanism temporarily because it degrades Rx throughput. + // Tx Migration settings. + //dm_InterruptMigration(Adapter); + + //if(Adapter->HalFunc.TxCheckStuckHandler(Adapter)) + // PlatformScheduleWorkItem(&(GET_HAL_DATA(Adapter)->HalResetWorkItem)); +#endif + + } + + + //ODM + if (hw_init_completed == _TRUE) + { + u8 bLinked=_FALSE; + u8 bsta_state = _FALSE; + + #ifdef CONFIG_DISABLE_ODM + pHalData->odmpriv.SupportAbility = 0; + #endif + + if(rtw_linked_check(Adapter)) + bLinked = _TRUE; + +#ifdef CONFIG_CONCURRENT_MODE + if(pbuddy_adapter && rtw_linked_check(pbuddy_adapter)) + bLinked = _TRUE; +#endif //CONFIG_CONCURRENT_MODE + ODM_CmnInfoUpdate(&pHalData->odmpriv ,ODM_CMNINFO_LINK, bLinked); + + + if (check_fwstate(&Adapter->mlmepriv, WIFI_STATION_STATE)) + bsta_state = _TRUE; +#ifdef CONFIG_CONCURRENT_MODE + if(pbuddy_adapter && check_fwstate(&pbuddy_adapter->mlmepriv, WIFI_STATION_STATE)) + bsta_state = _TRUE; +#endif //CONFIG_CONCURRENT_MODE + ODM_CmnInfoUpdate(&pHalData->odmpriv ,ODM_CMNINFO_STATION_STATE, bsta_state); + + ODM_DMWatchdog(&pHalData->odmpriv); + + } + +skip_dm: + + // Check GPIO to determine current RF on/off and Pbc status. + // Check Hardware Radio ON/OFF or not +#ifdef CONFIG_PCI_HCI + if(pHalData->bGpioHwWpsPbc) +#endif + { + //temp removed + //dm_CheckPbcGPIO(Adapter); + } + return; +} + +void rtl8188e_init_dm_priv(IN struct adapter *Adapter) +{ + PHAL_DATA_TYPE pHalData = GET_HAL_DATA(Adapter); + struct dm_priv *pdmpriv = &pHalData->dmpriv; + PDM_ODM_T podmpriv = &pHalData->odmpriv; + _rtw_memset(pdmpriv, 0, sizeof(struct dm_priv)); + //_rtw_spinlock_init(&(pHalData->odm_stainfo_lock)); + Init_ODM_ComInfo_88E(Adapter); +#ifdef CONFIG_SW_ANTENNA_DIVERSITY + //_init_timer(&(pdmpriv->SwAntennaSwitchTimer), Adapter->pnetdev , odm_SW_AntennaSwitchCallback, Adapter); + ODM_InitAllTimers(podmpriv ); +#endif + ODM_InitDebugSetting(podmpriv); +} + +void rtl8188e_deinit_dm_priv(IN struct adapter *Adapter) +{ + PHAL_DATA_TYPE pHalData = GET_HAL_DATA(Adapter); + struct dm_priv *pdmpriv = &pHalData->dmpriv; + PDM_ODM_T podmpriv = &pHalData->odmpriv; + //_rtw_spinlock_free(&pHalData->odm_stainfo_lock); +#ifdef CONFIG_SW_ANTENNA_DIVERSITY + //_cancel_timer_ex(&pdmpriv->SwAntennaSwitchTimer); + ODM_CancelAllTimers(podmpriv); +#endif +} + + +#ifdef CONFIG_ANTENNA_DIVERSITY +// Add new function to reset the state of antenna diversity before link. +// +// Compare RSSI for deciding antenna +void AntDivCompare8188E(struct adapter *Adapter, WLAN_BSSID_EX *dst, WLAN_BSSID_EX *src) +{ + //struct adapter *Adapter = pDM_Odm->Adapter ; + + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); + if(0 != pHalData->AntDivCfg ) + { + //DBG_8192C("update_network=> orgRSSI(%d)(%d),newRSSI(%d)(%d)\n",dst->Rssi,query_rx_pwr_percentage(dst->Rssi), + // src->Rssi,query_rx_pwr_percentage(src->Rssi)); + //select optimum_antenna for before linked =>For antenna diversity + if(dst->Rssi >= src->Rssi )//keep org parameter + { + src->Rssi = dst->Rssi; + src->PhyInfo.Optimum_antenna = dst->PhyInfo.Optimum_antenna; + } + } +} + +// Add new function to reset the state of antenna diversity before link. +u8 AntDivBeforeLink8188E(struct adapter *Adapter ) +{ + + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); + PDM_ODM_T pDM_Odm =&pHalData->odmpriv; + SWAT_T *pDM_SWAT_Table = &pDM_Odm->DM_SWAT_Table; + struct mlme_priv *pmlmepriv = &(Adapter->mlmepriv); + + // Condition that does not need to use antenna diversity. + if(pHalData->AntDivCfg==0) + { + //DBG_8192C("odm_AntDivBeforeLink8192C(): No AntDiv Mechanism.\n"); + return _FALSE; + } + + if(check_fwstate(pmlmepriv, _FW_LINKED) == _TRUE) + { + return _FALSE; + } + + + if(pDM_SWAT_Table->SWAS_NoLink_State == 0){ + //switch channel + pDM_SWAT_Table->SWAS_NoLink_State = 1; + pDM_SWAT_Table->CurAntenna = (pDM_SWAT_Table->CurAntenna==Antenna_A)?Antenna_B:Antenna_A; + + //PHY_SetBBReg(Adapter, rFPGA0_XA_RFInterfaceOE, 0x300, pDM_SWAT_Table->CurAntenna); + rtw_antenna_select_cmd(Adapter, pDM_SWAT_Table->CurAntenna, _FALSE); + //DBG_8192C("%s change antenna to ANT_( %s ).....\n",__FUNCTION__, (pDM_SWAT_Table->CurAntenna==Antenna_A)?"A":"B"); + return _TRUE; + } + else + { + pDM_SWAT_Table->SWAS_NoLink_State = 0; + return _FALSE; + } + +} +#endif diff --git a/hal/rtl8188e_hal_init.c b/hal/rtl8188e_hal_init.c index a64ad24..df2dfc0 100755 --- a/hal/rtl8188e_hal_init.c +++ b/hal/rtl8188e_hal_init.c @@ -34,20 +34,20 @@ static void iol_mode_enable(struct adapter *padapter, u8 enable) { u8 reg_0xf0 = 0; - + if(enable) { //Enable initial offload reg_0xf0 = rtw_read8(padapter, REG_SYS_CFG); //DBG_871X("%s reg_0xf0:0x%02x, write 0x%02x\n", __FUNCTION__, reg_0xf0, reg_0xf0|SW_OFFLOAD_EN); rtw_write8(padapter, REG_SYS_CFG, reg_0xf0|SW_OFFLOAD_EN); - + if(padapter->bFWReady == _FALSE) { printk("bFWReady == _FALSE call reset 8051...\n"); _8051Reset88E(padapter); - } - + } + } else { @@ -63,7 +63,7 @@ static s32 iol_execute(struct adapter *padapter, u8 control) s32 status = _FAIL; u8 reg_0x88 = 0,reg_1c7=0; u32 start = 0, passing_time = 0; - + u32 t1,t2; control = control&0x0f; reg_0x88 = rtw_read8(padapter, REG_HMEBOX_E0); @@ -87,7 +87,7 @@ static s32 iol_execute(struct adapter *padapter, u8 control) t2= rtw_get_current_time(); //printk("==> step iol_execute : %5u reg-0x1c0= 0x%02x\n",rtw_get_time_interval_ms(t1,t2),rtw_read8(padapter, 0x1c0)); //DBG_871X("%s in %u ms, reg_0x88:0x%02x\n", __FUNCTION__, passing_time, reg_0x88); - + return status; } @@ -96,7 +96,7 @@ static s32 iol_InitLLTTable( u8 txpktbuf_bndy ) { - s32 rst = _SUCCESS; + s32 rst = _SUCCESS; iol_mode_enable(padapter, 1); //DBG_871X("%s txpktbuf_bndy:%u\n", __FUNCTION__, txpktbuf_bndy); rtw_write8(padapter, REG_TDECTRL+1, txpktbuf_bndy); @@ -140,7 +140,7 @@ efuse_phymap_to_logical(u8 * phymap, u16 _offset, u16 _size_byte, u8 *pbuf) // // 1. Read the first byte to check if efuse is empty!!! - // + // // rtemp8 = *(phymap+eFuse_Addr); if(rtemp8 != 0xFF) @@ -162,10 +162,10 @@ efuse_phymap_to_logical(u8 * phymap, u16 _offset, u16 _size_byte, u8 *pbuf) while((rtemp8 != 0xFF) && (eFuse_Addr < EFUSE_REAL_CONTENT_LEN_88E)) { //RTPRINT(FEEPROM, EFUSE_READ_ALL, ("efuse_Addr-%d efuse_data=%x\n", eFuse_Addr-1, *rtemp8)); - + // Check PG header for section num. if((rtemp8 & 0x1F ) == 0x0F) //extended header - { + { u1temp =( (rtemp8 & 0xE0) >> 5); //RTPRINT(FEEPROM, EFUSE_READ_ALL, ("extended header u1temp=%x *rtemp&0xE0 0x%x\n", u1temp, *rtemp8 & 0xE0)); @@ -173,32 +173,32 @@ efuse_phymap_to_logical(u8 * phymap, u16 _offset, u16 _size_byte, u8 *pbuf) rtemp8 = *(phymap+eFuse_Addr); - //RTPRINT(FEEPROM, EFUSE_READ_ALL, ("extended header efuse_Addr-%d efuse_data=%x\n", eFuse_Addr, *rtemp8)); - + //RTPRINT(FEEPROM, EFUSE_READ_ALL, ("extended header efuse_Addr-%d efuse_data=%x\n", eFuse_Addr, *rtemp8)); + if((rtemp8 & 0x0F) == 0x0F) { - eFuse_Addr++; + eFuse_Addr++; rtemp8 = *(phymap+eFuse_Addr); - + if(rtemp8 != 0xFF && (eFuse_Addr < EFUSE_REAL_CONTENT_LEN_88E)) { - eFuse_Addr++; - } + eFuse_Addr++; + } continue; } else { offset = ((rtemp8 & 0xF0) >> 1) | u1temp; wren = (rtemp8 & 0x0F); - eFuse_Addr++; + eFuse_Addr++; } } else { offset = ((rtemp8 >> 4) & 0x0f); - wren = (rtemp8 & 0x0f); + wren = (rtemp8 & 0x0f); } - + if(offset < EFUSE_MAX_SECTION_88E) { // Get word enable value from PG header @@ -206,41 +206,41 @@ efuse_phymap_to_logical(u8 * phymap, u16 _offset, u16 _size_byte, u8 *pbuf) for(i=0; i= EFUSE_REAL_CONTENT_LEN_88E) + + if(eFuse_Addr >= EFUSE_REAL_CONTENT_LEN_88E) break; //RTPRINT(FEEPROM, EFUSE_READ_ALL, ("Addr=%d", eFuse_Addr)); rtemp8 = *(phymap+eFuse_Addr); eFuse_Addr++; - //RTPRINT(FEEPROM, EFUSE_READ_ALL, ("Data=0x%x\n", *rtemp8)); - + //RTPRINT(FEEPROM, EFUSE_READ_ALL, ("Data=0x%x\n", *rtemp8)); + efuse_utilized++; eFuseWord[offset][i] |= (((u2Byte)rtemp8 << 8) & 0xff00); - if(eFuse_Addr >= EFUSE_REAL_CONTENT_LEN_88E) + if(eFuse_Addr >= EFUSE_REAL_CONTENT_LEN_88E) break; } - + wren >>= 1; - + } } // Read next PG header rtemp8 = *(phymap+eFuse_Addr); //RTPRINT(FEEPROM, EFUSE_READ_ALL, ("Addr=%d rtemp 0x%x\n", eFuse_Addr, *rtemp8)); - + if(rtemp8 != 0xFF && (eFuse_Addr < EFUSE_REAL_CONTENT_LEN_88E)) { efuse_utilized++; @@ -265,7 +265,7 @@ efuse_phymap_to_logical(u8 * phymap, u16 _offset, u16 _size_byte, u8 *pbuf) // 4. Copy from Efuse map to output pointer memory!!! // for(i=0; i<_size_byte; i++) - { + { pbuf[i] = efuseTbl[_offset+i]; } @@ -300,7 +300,7 @@ void efuse_read_phymap_from_txpktbuf( u16 limit = *size; u8 *pos = content; - + if(bcnhead<0) //if not valid bcnhead = rtw_read8(adapter, REG_TDECTRL+1); @@ -370,14 +370,14 @@ void efuse_read_phymap_from_txpktbuf( _rtw_memcpy(pos, ((u8*)&lo32)+2, (limit>=count+2)?2:limit-count); count+= (limit>=count+2)?2:limit-count; pos=content+count; - + } else { _rtw_memcpy(pos, ((u8*)&lo32), (limit>=count+4)?4:limit-count); count+=(limit>=count+4)?4:limit-count; pos=content+count; - + } @@ -394,7 +394,7 @@ void efuse_read_phymap_from_txpktbuf( } rtw_write8(adapter, REG_PKT_BUFF_ACCESS_CTRL, DISABLE_TRXPKT_BUF_ACCESS); - + DBG_871X("%s read count:%u\n", __FUNCTION__, count); *size = count; @@ -418,7 +418,7 @@ static s32 iol_read_efuse( rtw_write8(padapter, REG_TDECTRL+1, txpktbuf_bndy); _rtw_memset(physical_map, 0xFF, 512); - + ///reg_0x106 = rtw_read8(padapter, REG_PKT_BUFF_ACCESS_CTRL); //DBG_871X("%s reg_0x106:0x%02x, write 0x%02x\n", __FUNCTION__, reg_0x106, 0x69); rtw_write8(padapter, REG_PKT_BUFF_ACCESS_CTRL, TXPKT_BUF_SELECT); @@ -449,13 +449,13 @@ s32 rtl8188e_iol_efuse_patch(struct adapter *padapter) { s32 result = _SUCCESS; printk("==> %s \n",__FUNCTION__); - + if(rtw_IOL_applied(padapter)){ iol_mode_enable(padapter, 1); result = iol_execute(padapter, CMD_READ_EFUSE_MAP); - if(result == _SUCCESS) + if(result == _SUCCESS) result = iol_execute(padapter, CMD_EFUSE_PATCH); - + iol_mode_enable(padapter, 0); } return result; @@ -466,50 +466,50 @@ static s32 iol_ioconfig( u8 iocfg_bndy ) { - s32 rst = _SUCCESS; - + s32 rst = _SUCCESS; + //DBG_871X("%s iocfg_bndy:%u\n", __FUNCTION__, iocfg_bndy); rtw_write8(padapter, REG_TDECTRL+1, iocfg_bndy); rst = iol_execute(padapter, CMD_IOCONFIG); - + return rst; } int rtl8188e_IOL_exec_cmds_sync(struct adapter *adapter, struct xmit_frame *xmit_frame, u32 max_wating_ms,u32 bndy_cnt) { - + u32 start_time = rtw_get_current_time(); u32 passing_time_ms; u8 polling_ret,i; int ret = _FAIL; u32 t1,t2; - + //printk("===> %s ,bndy_cnt = %d \n",__FUNCTION__,bndy_cnt); if (rtw_IOL_append_END_cmd(xmit_frame) != _SUCCESS) goto exit; #ifdef CONFIG_USB_HCI { - struct pkt_attrib *pattrib = &xmit_frame->attrib; + struct pkt_attrib *pattrib = &xmit_frame->attrib; if(rtw_usb_bulk_size_boundary(adapter,TXDESC_SIZE+pattrib->last_txcmdsz)) { if (rtw_IOL_append_END_cmd(xmit_frame) != _SUCCESS) goto exit; - } + } } #endif //CONFIG_USB_HCI - + //rtw_IOL_cmd_buf_dump(adapter,xmit_frame->attrib.pktlen+TXDESC_OFFSET,xmit_frame->buf_addr); //rtw_hal_mgnt_xmit(adapter, xmit_frame); //rtw_dump_xframe_sync(adapter, xmit_frame); - + dump_mgntframe_and_wait(adapter, xmit_frame, max_wating_ms); - + t1= rtw_get_current_time(); iol_mode_enable(adapter, 1); for(i=0;i %s : %5u\n",__FUNCTION__,rtw_get_time_interval_ms(t1,t2)); exit: //restore BCN_HEAD - rtw_write8(adapter, REG_TDECTRL+1, 0); + rtw_write8(adapter, REG_TDECTRL+1, 0); return ret; } @@ -529,10 +529,10 @@ void rtw_IOL_cmd_tx_pkt_buf_dump(struct adapter *Adapter,int data_len) u32 fifo_data,reg_140; u32 addr,rstatus,loop=0; - u16 data_cnts = (data_len/8)+1; + u16 data_cnts = (data_len/8)+1; u8 *pbuf =rtw_zvmalloc(data_len+10); printk("###### %s ######\n",__FUNCTION__); - + rtw_write8(Adapter, REG_PKT_BUFF_ACCESS_CTRL, TXPKT_BUF_SELECT); if(pbuf){ for(addr=0;addr< data_cnts;addr++){ @@ -541,25 +541,25 @@ void rtw_IOL_cmd_tx_pkt_buf_dump(struct adapter *Adapter,int data_len) rtw_usleep_os(2); loop=0; do{ - rstatus=(reg_140=rtw_read32(Adapter,REG_PKTBUF_DBG_CTRL)&BIT24); + rstatus=(reg_140=rtw_read32(Adapter,REG_PKTBUF_DBG_CTRL)&BIT24); //printk("rstatus = %02x, reg_140:0x%08x\n",rstatus,reg_140); if(rstatus){ fifo_data = rtw_read32(Adapter,REG_PKTBUF_DBG_DATA_L); - //printk("fifo_data_144:0x%08x\n",fifo_data); - _rtw_memcpy(pbuf+(addr*8),&fifo_data , 4); - + //printk("fifo_data_144:0x%08x\n",fifo_data); + _rtw_memcpy(pbuf+(addr*8),&fifo_data , 4); + fifo_data = rtw_read32(Adapter,REG_PKTBUF_DBG_DATA_H); - //printk("fifo_data_148:0x%08x\n",fifo_data); - _rtw_memcpy(pbuf+(addr*8+4), &fifo_data, 4); - + //printk("fifo_data_148:0x%08x\n",fifo_data); + _rtw_memcpy(pbuf+(addr*8+4), &fifo_data, 4); + } rtw_usleep_os(2); }while( !rstatus && (loop++ <10)); } rtw_IOL_cmd_buf_dump(Adapter,data_len,pbuf); - rtw_vmfree(pbuf, data_len+10); - - } + rtw_vmfree(pbuf, data_len+10); + + } printk("###### %s ######\n",__FUNCTION__); } @@ -585,8 +585,8 @@ _FWDownloadEnable( rtw_write8(padapter, REG_MCUFWDL+2, tmp&0xf7); } else - { - + { + // MCU firmware download disable. tmp = rtw_read8(padapter, REG_MCUFWDL); rtw_write8(padapter, REG_MCUFWDL, tmp&0xfe); @@ -595,7 +595,7 @@ _FWDownloadEnable( rtw_write8(padapter, REG_MCUFWDL+1, 0x00); } } -#define MAX_REG_BOLCK_SIZE 196 +#define MAX_REG_BOLCK_SIZE 196 static int _BlockWrite( IN struct adapter * padapter, @@ -651,12 +651,12 @@ _BlockWrite( break; case 3: remainFW[2]=*(p+2); - case 2: + case 2: remainFW[1]=*(p+1); - case 1: + case 1: remainFW[0]=*(p); - ret = rtw_write32(padapter, (FW_8188E_START_ADDRESS + blockCount_p1 * blockSize_p1), - le32_to_cpu(*(u32*)remainFW)); + ret = rtw_write32(padapter, (FW_8188E_START_ADDRESS + blockCount_p1 * blockSize_p1), + le32_to_cpu(*(u32*)remainFW)); } return ret; } @@ -679,7 +679,7 @@ _BlockWrite( #ifdef CONFIG_USB_HCI for (i = 0; i < blockCount_p2; i++) { ret = rtw_writeN(padapter, (FW_8188E_START_ADDRESS + offset + i*blockSize_p2), blockSize_p2, (bufferPtr + offset + i*blockSize_p2)); - + if(ret == _FAIL) goto exit; } @@ -699,7 +699,7 @@ _BlockWrite( for(i = 0 ; i < blockCount_p3 ; i++){ ret =rtw_write8(padapter, (FW_8188E_START_ADDRESS + offset + i), *(bufferPtr + offset + i)); - + if(ret == _FAIL) goto exit; } @@ -756,8 +756,8 @@ _WriteFW( // Since we need dynamic decide method of dwonload fw, so we call this function to get chip version. // We can remove _ReadChipVersion from ReadpadapterInfo8192C later. int ret = _SUCCESS; - u32 pageNums,remainSize ; - u32 page, offset; + u32 pageNums,remainSize ; + u32 page, offset; u8 *bufferPtr = (u8*)buffer; #ifdef CONFIG_PCI_HCI @@ -773,7 +773,7 @@ _WriteFW( for (page = 0; page < pageNums; page++) { offset = page * MAX_PAGE_SIZE; ret = _PageWrite(padapter, page, bufferPtr+offset, MAX_PAGE_SIZE); - + if(ret == _FAIL) goto exit; } @@ -781,7 +781,7 @@ _WriteFW( offset = pageNums * MAX_PAGE_SIZE; page = pageNums; ret = _PageWrite(padapter, page, bufferPtr+offset, remainSize); - + if(ret == _FAIL) goto exit; @@ -810,13 +810,13 @@ void _MCUIO_Reset88E(struct adapter *padapter,u8 bReset) void _8051Reset88E(struct adapter *padapter) { u8 u1bTmp; - + _MCUIO_Reset88E(padapter,_TRUE); u1bTmp = rtw_read8(padapter, REG_SYS_FUNC_EN+1); rtw_write8(padapter, REG_SYS_FUNC_EN+1, u1bTmp&(~BIT2)); _MCUIO_Reset88E(padapter,_FALSE); rtw_write8(padapter, REG_SYS_FUNC_EN+1, u1bTmp|(BIT2)); - + DBG_871X("=====> _8051Reset88E(): 8051 reset success .\n"); } @@ -824,7 +824,7 @@ static s32 _FWFreeToGo(struct adapter *padapter) { u32 counter = 0; u32 value32; - u8 value8; + u8 value8; // polling CheckSum report do { @@ -882,8 +882,8 @@ s32 rtl8188e_FirmwareDownload(struct adapter *padapter) s32 rtStatus = _SUCCESS; u8 writeFW_retry = 0; u32 fwdl_start_time; - PHAL_DATA_TYPE pHalData = GET_HAL_DATA(padapter); - + PHAL_DATA_TYPE pHalData = GET_HAL_DATA(padapter); + u8 *FwImage; u32 FwImageLen; u8 *pFwImageFileName; @@ -902,11 +902,11 @@ s32 rtl8188e_FirmwareDownload(struct adapter *padapter) pFirmware = (PRT_FIRMWARE_8188E)rtw_zmalloc(sizeof(RT_FIRMWARE_8188E)); if(!pFirmware) { - + rtStatus = _FAIL; goto Exit; } - + FwImage = (u8*)Rtl8188E_FwImageArray; FwImageLen = Rtl8188E_FWImgArrayLength; @@ -914,7 +914,7 @@ s32 rtl8188e_FirmwareDownload(struct adapter *padapter) FwImageWoWLAN = (u8*)Rtl8188E_FwWoWImageArray; FwImageWoWLANLen = Rtl8188E_FwWoWImgArrayLength; #endif //CONFIG_WOWLAN - + // RT_TRACE(_module_hal_init_c_, _drv_err_, ("rtl8723a_FirmwareDownload: %s\n", pFwImageFileName)); #ifdef CONFIG_FILE_FWIMG @@ -990,7 +990,7 @@ s32 rtl8188e_FirmwareDownload(struct adapter *padapter) if (rtw_read8(padapter, REG_MCUFWDL) & RAM_DL_SEL) //8051 RAM code { rtw_write8(padapter, REG_MCUFWDL, 0x00); - _8051Reset88E(padapter); + _8051Reset88E(padapter); } _FWDownloadEnable(padapter, _TRUE); @@ -998,7 +998,7 @@ s32 rtl8188e_FirmwareDownload(struct adapter *padapter) while(1) { //reset the FWDL chksum rtw_write8(padapter, REG_MCUFWDL, rtw_read8(padapter, REG_MCUFWDL)|FWDL_ChkSum_rpt); - + rtStatus = _WriteFW(padapter, pFirmwareBuf, FirmwareLen); if(rtStatus == _SUCCESS || padapter->bDriverStopped || padapter->bSurpriseRemoved @@ -1033,10 +1033,10 @@ Exit: //RT_TRACE(COMP_INIT, DBG_LOUD, (" <=== FirmwareDownload91C()\n")); #ifdef CONFIG_WOWLAN if (adapter_to_pwrctl(padapter)->wowlan_mode) - rtl8188e_InitializeFirmwareVars(padapter); + rtl8188e_InitializeFirmwareVars(padapter); else - DBG_871X_LEVEL(_drv_always_, "%s: wowland_mode:%d wowlan_wake_reason:%d\n", - __func__, adapter_to_pwrctl(padapter)->wowlan_mode, + DBG_871X_LEVEL(_drv_always_, "%s: wowland_mode:%d wowlan_wake_reason:%d\n", + __func__, adapter_to_pwrctl(padapter)->wowlan_mode, adapter_to_pwrctl(padapter)->wowlan_wake_reason); #endif @@ -1114,7 +1114,7 @@ _func_enter_; rtw_mfree(padapter->HalData, sizeof(HAL_DATA_TYPE)); padapter->HalData = NULL; } - + _func_exit_; } @@ -1208,7 +1208,7 @@ rtl8188e_EfusePowerSwitch( IN u8 bWrite, IN u8 PwrState) { - hal_EfusePowerSwitch_RTL8188E(pAdapter, bWrite, PwrState); + hal_EfusePowerSwitch_RTL8188E(pAdapter, bWrite, PwrState); } @@ -1228,8 +1228,8 @@ static bool efuse_read_phymap( // Refresh efuse init map as all 0xFF. // _rtw_memset(pbuf, 0xFF, limit); - - + + // // Read physical efuse content. // @@ -1258,8 +1258,8 @@ static VOID Hal_EfuseReadEFuse88E( struct adapter * Adapter, u16 _offset, - u16 _size_byte, - u8 *pbuf, + u16 _size_byte, + u8 *pbuf, IN BOOLEAN bPseudoTest ) { @@ -1305,9 +1305,9 @@ Hal_EfuseReadEFuse88E( // // 1. Read the first byte to check if efuse is empty!!! - // // - ReadEFuseByte(Adapter, eFuse_Addr, rtemp8, bPseudoTest); + // + ReadEFuseByte(Adapter, eFuse_Addr, rtemp8, bPseudoTest); if(*rtemp8 != 0xFF) { efuse_utilized++; @@ -1327,43 +1327,43 @@ Hal_EfuseReadEFuse88E( while((*rtemp8 != 0xFF) && (eFuse_Addr < EFUSE_REAL_CONTENT_LEN_88E)) { //RTPRINT(FEEPROM, EFUSE_READ_ALL, ("efuse_Addr-%d efuse_data=%x\n", eFuse_Addr-1, *rtemp8)); - + // Check PG header for section num. if((*rtemp8 & 0x1F ) == 0x0F) //extended header - { + { u1temp =( (*rtemp8 & 0xE0) >> 5); //RTPRINT(FEEPROM, EFUSE_READ_ALL, ("extended header u1temp=%x *rtemp&0xE0 0x%x\n", u1temp, *rtemp8 & 0xE0)); //RTPRINT(FEEPROM, EFUSE_READ_ALL, ("extended header u1temp=%x \n", u1temp)); - - ReadEFuseByte(Adapter, eFuse_Addr, rtemp8, bPseudoTest); - //RTPRINT(FEEPROM, EFUSE_READ_ALL, ("extended header efuse_Addr-%d efuse_data=%x\n", eFuse_Addr, *rtemp8)); - + ReadEFuseByte(Adapter, eFuse_Addr, rtemp8, bPseudoTest); + + //RTPRINT(FEEPROM, EFUSE_READ_ALL, ("extended header efuse_Addr-%d efuse_data=%x\n", eFuse_Addr, *rtemp8)); + if((*rtemp8 & 0x0F) == 0x0F) { - eFuse_Addr++; - ReadEFuseByte(Adapter, eFuse_Addr, rtemp8, bPseudoTest); - + eFuse_Addr++; + ReadEFuseByte(Adapter, eFuse_Addr, rtemp8, bPseudoTest); + if(*rtemp8 != 0xFF && (eFuse_Addr < EFUSE_REAL_CONTENT_LEN_88E)) { - eFuse_Addr++; - } + eFuse_Addr++; + } continue; } else { offset = ((*rtemp8 & 0xF0) >> 1) | u1temp; wren = (*rtemp8 & 0x0F); - eFuse_Addr++; + eFuse_Addr++; } } else { offset = ((*rtemp8 >> 4) & 0x0f); - wren = (*rtemp8 & 0x0f); + wren = (*rtemp8 & 0x0f); } - + if(offset < EFUSE_MAX_SECTION_88E) { // Get word enable value from PG header @@ -1371,41 +1371,41 @@ Hal_EfuseReadEFuse88E( for(i=0; i= EFUSE_REAL_CONTENT_LEN_88E) + + if(eFuse_Addr >= EFUSE_REAL_CONTENT_LEN_88E) break; //RTPRINT(FEEPROM, EFUSE_READ_ALL, ("Addr=%d", eFuse_Addr)); - ReadEFuseByte(Adapter, eFuse_Addr, rtemp8, bPseudoTest); + ReadEFuseByte(Adapter, eFuse_Addr, rtemp8, bPseudoTest); eFuse_Addr++; - //RTPRINT(FEEPROM, EFUSE_READ_ALL, ("Data=0x%x\n", *rtemp8)); - + //RTPRINT(FEEPROM, EFUSE_READ_ALL, ("Data=0x%x\n", *rtemp8)); + efuse_utilized++; eFuseWord[offset][i] |= (((u2Byte)*rtemp8 << 8) & 0xff00); - if(eFuse_Addr >= EFUSE_REAL_CONTENT_LEN_88E) + if(eFuse_Addr >= EFUSE_REAL_CONTENT_LEN_88E) break; } - + wren >>= 1; - + } } // Read next PG header - ReadEFuseByte(Adapter, eFuse_Addr, rtemp8, bPseudoTest); + ReadEFuseByte(Adapter, eFuse_Addr, rtemp8, bPseudoTest); //RTPRINT(FEEPROM, EFUSE_READ_ALL, ("Addr=%d rtemp 0x%x\n", eFuse_Addr, *rtemp8)); - + if(*rtemp8 != 0xFF && (eFuse_Addr < EFUSE_REAL_CONTENT_LEN_88E)) { efuse_utilized++; @@ -1430,7 +1430,7 @@ Hal_EfuseReadEFuse88E( // 4. Copy from Efuse map to output pointer memory!!! // for(i=0; i<_size_byte; i++) - { + { pbuf[i] = efuseTbl[_offset+i]; } @@ -1506,8 +1506,8 @@ ReadEFuseByIC( struct adapter *Adapter, u8 efuseType, u16 _offset, - u16 _size_byte, - u8 *pbuf, + u16 _size_byte, + u8 *pbuf, IN BOOLEAN bPseudoTest ) { @@ -1522,16 +1522,16 @@ ReadEFuseByIC( if(rtw_IOL_applied(Adapter)) { rtw_hal_power_on(Adapter); - + iol_mode_enable(Adapter, 1); #ifdef DBG_IOL_READ_EFUSE_MAP iol_read_efuse(Adapter, 0, _offset, _size_byte, logical_map); #else ret = iol_read_efuse(Adapter, 0, _offset, _size_byte, pbuf); #endif - iol_mode_enable(Adapter, 0); - - if(_SUCCESS == ret) + iol_mode_enable(Adapter, 0); + + if(_SUCCESS == ret) goto exit; } } @@ -1539,7 +1539,7 @@ ReadEFuseByIC( Hal_EfuseReadEFuse88E(Adapter, _offset, _size_byte, pbuf, bPseudoTest); exit: - + #ifdef DBG_IOL_READ_EFUSE_MAP if(_rtw_memcmp(logical_map, Adapter->eeprompriv.efuse_eeprom_data, 0x130) == _FALSE) { @@ -1557,7 +1557,7 @@ exit: } #endif - return; + return; } static VOID @@ -1565,8 +1565,8 @@ ReadEFuse_Pseudo( struct adapter *Adapter, u8 efuseType, u16 _offset, - u16 _size_byte, - u8 *pbuf, + u16 _size_byte, + u8 *pbuf, IN BOOLEAN bPseudoTest ) { @@ -1578,8 +1578,8 @@ rtl8188e_ReadEFuse( struct adapter *Adapter, u8 efuseType, u16 _offset, - u16 _size_byte, - u8 *pbuf, + u16 _size_byte, + u8 *pbuf, IN BOOLEAN bPseudoTest ) { @@ -1951,7 +1951,7 @@ rtl8188e_EfuseGetCurrentSize( else { ret = hal_EfuseGetCurrentSize_8188e(pAdapter, bPseudoTest); - + } return ret; @@ -2083,7 +2083,7 @@ Hal_EfusePgPacketRead( IN struct adapter *pAdapter, int ret=0; ret = hal_EfusePgPacketRead_8188e(pAdapter, offset, data, bPseudoTest); - + return ret; } @@ -2141,7 +2141,7 @@ hal_EfuseFixHeaderProcess( badworden = Efuse_WordEnableDataWrite(pAdapter, efuse_addr+1, pFixPkt->word_en, originaldata, bPseudoTest); if(badworden != 0xf) // write fail - { + { PgWriteSuccess = Efuse_PgPacketWrite(pAdapter, pFixPkt->offset, badworden, originaldata, bPseudoTest); if(!PgWriteSuccess) @@ -2332,9 +2332,9 @@ hal_EfusePgPacketWriteData( { //RTPRINT(FEEPROM, EFUSE_PG, ("hal_EfusePgPacketWriteData Fail!!\n")); //reorganize other pg packet - + PgWriteSuccess = Efuse_PgPacketWrite(pAdapter, pTargetPkt->offset, badworden, pTargetPkt->data, bPseudoTest); - + if(!PgWriteSuccess) return _FALSE; else @@ -2517,9 +2517,9 @@ hal_EfusePartialWriteCheck( { u32 PgWriteSuccess=0; // if write fail on some words, write these bad words again - + PgWriteSuccess = Efuse_PgPacketWrite(pAdapter, pTargetPkt->offset, badworden, pTargetPkt->data, bPseudoTest); - + if(!PgWriteSuccess) { bRet = _FALSE; // write fail, return @@ -2562,7 +2562,7 @@ hal_EfusePgCheckAvailableAddr( //Change to check TYPE_EFUSE_MAP_LEN ,beacuse 8188E raw 256,logic map over 256. EFUSE_GetEfuseDefinition(pAdapter, EFUSE_WIFI, TYPE_EFUSE_MAP_LEN, (PVOID)&efuse_max_available_len, _FALSE); - + //EFUSE_GetEfuseDefinition(pAdapter, efuseType, TYPE_AVAILABLE_EFUSE_BYTES_TOTAL, (PVOID)&efuse_max_available_len, bPseudoTest); //RTPRINT(FEEPROM, EFUSE_PG, ("efuse_max_available_len = %d\n", efuse_max_available_len)); @@ -2576,7 +2576,7 @@ hal_EfusePgCheckAvailableAddr( static VOID hal_EfuseConstructPGPkt( - IN u8 offset, + IN u8 offset, IN u8 word_en, IN u8 *pData, IN PPGPKT_STRUCT pTargetPkt @@ -2595,13 +2595,13 @@ hal_EfuseConstructPGPkt( static BOOLEAN hal_EfusePgPacketWrite_BT( IN struct adapter *pAdapter, - IN u8 offset, + IN u8 offset, IN u8 word_en, IN u8 *pData, IN BOOLEAN bPseudoTest ) { - PGPKT_STRUCT targetPkt; + PGPKT_STRUCT targetPkt; u16 startAddr=0; u8 efuseType=EFUSE_BT; @@ -2625,13 +2625,13 @@ hal_EfusePgPacketWrite_BT( static BOOLEAN hal_EfusePgPacketWrite_8188e( IN struct adapter * pAdapter, - IN u8 offset, + IN u8 offset, IN u8 word_en, IN u8 *pData, IN BOOLEAN bPseudoTest ) { - PGPKT_STRUCT targetPkt; + PGPKT_STRUCT targetPkt; u16 startAddr=0; u8 efuseType=EFUSE_WIFI; @@ -2655,7 +2655,7 @@ hal_EfusePgPacketWrite_8188e( static int Hal_EfusePgPacketWrite_Pseudo(IN struct adapter *pAdapter, - IN u8 offset, + IN u8 offset, IN u8 word_en, IN u8 *data, IN BOOLEAN bPseudoTest) @@ -2669,21 +2669,21 @@ Hal_EfusePgPacketWrite_Pseudo(IN struct adapter *pAdapter, static int Hal_EfusePgPacketWrite(IN struct adapter *pAdapter, - IN u8 offset, + IN u8 offset, IN u8 word_en, IN u8 *data, IN BOOLEAN bPseudoTest) { int ret=0; ret = hal_EfusePgPacketWrite_8188e(pAdapter, offset, word_en, data, bPseudoTest); - + return ret; } static int rtl8188e_Efuse_PgPacketWrite(IN struct adapter *pAdapter, - IN u8 offset, + IN u8 offset, IN u8 word_en, IN u8 *data, IN BOOLEAN bPseudoTest) @@ -2724,12 +2724,12 @@ ReadChipVersion8188E( // For regulator mode. by tynli. 2011.01.14 pHalData->RegulatorMode = ((value32 & TRP_BT_EN) ? RT_LDO_REGULATOR : RT_SWITCHING_REGULATOR); - ChipVersion.ROMVer = 0; // ROM code version. + ChipVersion.ROMVer = 0; // ROM code version. pHalData->MultiFunc = RT_MULTI_FUNC_NONE; - + //#if DBG -#if 1 +#if 1 dump_chip_info(ChipVersion); #endif @@ -2747,7 +2747,7 @@ ReadChipVersion8188E( pHalData->rf_type = RF_1T1R; pHalData->NumTotalRFPath = 1; } - + MSG_8192C("RF_Type is %x!!\n", pHalData->rf_type); return ChipVersion; @@ -2755,9 +2755,9 @@ ReadChipVersion8188E( static void rtl8188e_read_chip_version(struct adapter *padapter) { - ReadChipVersion8188E(padapter); + ReadChipVersion8188E(padapter); } -void rtl8188e_GetHalODMVar( +void rtl8188e_GetHalODMVar( struct adapter * Adapter, HAL_ODM_VARIABLE eVariable, PVOID pValue1, @@ -2783,8 +2783,8 @@ void rtl8188e_SetHalODMVar( //_irqL irqL; switch(eVariable){ case HAL_ODM_STA_INFO: - { - struct sta_info *psta = (struct sta_info *)pValue1; + { + struct sta_info *psta = (struct sta_info *)pValue1; if(bSet){ DBG_8192C("### Set STA_(%d) info\n",psta->mac_id); ODM_CmnInfoPtrArrayHook(podmpriv, ODM_CMNINFO_STA_STATUS,psta->mac_id,psta); @@ -2796,12 +2796,12 @@ void rtl8188e_SetHalODMVar( DBG_8192C("### Clean STA_(%d) info\n",psta->mac_id); //_enter_critical_bh(&pHalData->odm_stainfo_lock, &irqL); ODM_CmnInfoPtrArrayHook(podmpriv, ODM_CMNINFO_STA_STATUS,psta->mac_id,NULL); - + //_exit_critical_bh(&pHalData->odm_stainfo_lock, &irqL); } } break; - case HAL_ODM_P2P_STATE: + case HAL_ODM_P2P_STATE: ODM_CmnInfoUpdate(podmpriv,ODM_CMNINFO_WIFI_DIRECT,bSet); break; case HAL_ODM_WIFI_DISPLAY_STATE: @@ -2810,7 +2810,7 @@ void rtl8188e_SetHalODMVar( default: break; } -} +} void rtl8188e_start_thread(struct adapter *padapter) { @@ -2993,13 +2993,13 @@ void Read_LLT_Tab(struct adapter *padapter) printk("############### %s ###################\n",__FUNCTION__); for(addr=0;addr<176;addr++) { - next_addr = _LLTRead(padapter,addr); + next_addr = _LLTRead(padapter,addr); printk("%d->",next_addr); if(((addr+1) %8) ==0) - printk("\n"); + printk("\n"); } printk("\n##################################\n"); - + } s32 InitLLTTable(struct adapter *padapter, u8 txpktbuf_bndy) @@ -3011,8 +3011,8 @@ s32 InitLLTTable(struct adapter *padapter, u8 txpktbuf_bndy) #if defined(CONFIG_IOL_LLT) if(rtw_IOL_applied(padapter)) - { - status = iol_InitLLTTable(padapter, txpktbuf_bndy); + { + status = iol_InitLLTTable(padapter, txpktbuf_bndy); } else #endif @@ -3151,14 +3151,14 @@ Hal_ReadPowerValueFromPROM_8188E( IN u8* PROMContent, IN BOOLEAN AutoLoadFail ) -{ +{ u32 rfPath, eeAddr=EEPROM_TX_PWR_INX_88E, group,TxCount=0; HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter); - + _rtw_memset(pwrInfo24G, 0, sizeof(TxPowerInfo24G)); if(AutoLoadFail) - { + { for(rfPath = 0 ; rfPath < pHalData->NumTotalRFPath ; rfPath++) { //2.4G default value @@ -3181,14 +3181,14 @@ Hal_ReadPowerValueFromPROM_8188E( pwrInfo24G->CCK_Diff[rfPath][TxCount] = EEPROM_DEFAULT_DIFF; pwrInfo24G->OFDM_Diff[rfPath][TxCount] = EEPROM_DEFAULT_DIFF; } - } - - + } + + } - - //pHalData->bNOPG = TRUE; + + //pHalData->bNOPG = TRUE; return; - } + } for(rfPath = 0 ; rfPath < pHalData->NumTotalRFPath ; rfPath++) { @@ -3201,7 +3201,7 @@ Hal_ReadPowerValueFromPROM_8188E( if(pwrInfo24G->IndexCCK_Base[rfPath][group] == 0xFF) { pwrInfo24G->IndexCCK_Base[rfPath][group] = EEPROM_DEFAULT_24G_INDEX; -// pHalData->bNOPG = TRUE; +// pHalData->bNOPG = TRUE; } } for(group = 0 ; group < MAX_CHNL_GROUP_24G-1; group++) @@ -3211,7 +3211,7 @@ Hal_ReadPowerValueFromPROM_8188E( //printk(" IndexBW40_Base: %02x \n",pwrInfo24G->IndexBW40_Base[rfPath][group] ); if(pwrInfo24G->IndexBW40_Base[rfPath][group] == 0xFF) pwrInfo24G->IndexBW40_Base[rfPath][group] = EEPROM_DEFAULT_24G_INDEX; - } + } for(TxCount=0;TxCountBW20_Diff[rfPath][TxCount] = EEPROM_DEFAULT_24G_HT20_DIFF; else { - pwrInfo24G->BW20_Diff[rfPath][TxCount] = (PROMContent[eeAddr]&0xf0)>>4; - if(pwrInfo24G->BW20_Diff[rfPath][TxCount] & BIT3) //4bit sign number to 8 bit sign number + pwrInfo24G->BW20_Diff[rfPath][TxCount] = (PROMContent[eeAddr]&0xf0)>>4; + if(pwrInfo24G->BW20_Diff[rfPath][TxCount] & BIT3) //4bit sign number to 8 bit sign number pwrInfo24G->BW20_Diff[rfPath][TxCount] |= 0xF0; } if(PROMContent[eeAddr] == 0xFF) - pwrInfo24G->OFDM_Diff[rfPath][TxCount] = EEPROM_DEFAULT_24G_OFDM_DIFF; - else + pwrInfo24G->OFDM_Diff[rfPath][TxCount] = EEPROM_DEFAULT_24G_OFDM_DIFF; + else { - pwrInfo24G->OFDM_Diff[rfPath][TxCount] = (PROMContent[eeAddr]&0x0f); + pwrInfo24G->OFDM_Diff[rfPath][TxCount] = (PROMContent[eeAddr]&0x0f); if(pwrInfo24G->OFDM_Diff[rfPath][TxCount] & BIT3) //4bit sign number to 8 bit sign number pwrInfo24G->OFDM_Diff[rfPath][TxCount] |= 0xF0; - } + } pwrInfo24G->CCK_Diff[rfPath][TxCount] = 0; eeAddr++; } else - { + { if(PROMContent[eeAddr] == 0xFF) - pwrInfo24G->BW40_Diff[rfPath][TxCount] = EEPROM_DEFAULT_DIFF; - else + pwrInfo24G->BW40_Diff[rfPath][TxCount] = EEPROM_DEFAULT_DIFF; + else { - pwrInfo24G->BW40_Diff[rfPath][TxCount] = (PROMContent[eeAddr]&0xf0)>>4; + pwrInfo24G->BW40_Diff[rfPath][TxCount] = (PROMContent[eeAddr]&0xf0)>>4; if(pwrInfo24G->BW40_Diff[rfPath][TxCount] & BIT3) //4bit sign number to 8 bit sign number pwrInfo24G->BW40_Diff[rfPath][TxCount] |= 0xF0; } - + if(PROMContent[eeAddr] == 0xFF) - pwrInfo24G->BW20_Diff[rfPath][TxCount] = EEPROM_DEFAULT_DIFF; - else + pwrInfo24G->BW20_Diff[rfPath][TxCount] = EEPROM_DEFAULT_DIFF; + else { - pwrInfo24G->BW20_Diff[rfPath][TxCount] = (PROMContent[eeAddr]&0x0f); + pwrInfo24G->BW20_Diff[rfPath][TxCount] = (PROMContent[eeAddr]&0x0f); if(pwrInfo24G->BW20_Diff[rfPath][TxCount] & BIT3) //4bit sign number to 8 bit sign number pwrInfo24G->BW20_Diff[rfPath][TxCount] |= 0xF0; } eeAddr++; - + if(PROMContent[eeAddr] == 0xFF) - pwrInfo24G->OFDM_Diff[rfPath][TxCount] = EEPROM_DEFAULT_DIFF; - else + pwrInfo24G->OFDM_Diff[rfPath][TxCount] = EEPROM_DEFAULT_DIFF; + else { - pwrInfo24G->OFDM_Diff[rfPath][TxCount] = (PROMContent[eeAddr]&0xf0)>>4; + pwrInfo24G->OFDM_Diff[rfPath][TxCount] = (PROMContent[eeAddr]&0xf0)>>4; if(pwrInfo24G->OFDM_Diff[rfPath][TxCount] & BIT3) //4bit sign number to 8 bit sign number pwrInfo24G->OFDM_Diff[rfPath][TxCount] |= 0xF0; } - + if(PROMContent[eeAddr] == 0xFF) - pwrInfo24G->CCK_Diff[rfPath][TxCount] = EEPROM_DEFAULT_DIFF; - else + pwrInfo24G->CCK_Diff[rfPath][TxCount] = EEPROM_DEFAULT_DIFF; + else { - pwrInfo24G->CCK_Diff[rfPath][TxCount] = (PROMContent[eeAddr]&0x0f); + pwrInfo24G->CCK_Diff[rfPath][TxCount] = (PROMContent[eeAddr]&0x0f); if(pwrInfo24G->CCK_Diff[rfPath][TxCount] & BIT3) //4bit sign number to 8 bit sign number pwrInfo24G->CCK_Diff[rfPath][TxCount] |= 0xF0; } @@ -3300,9 +3300,9 @@ Hal_GetChnlGroup( return group; } -static u8 +static u8 Hal_GetChnlGroup88E( - IN u8 chnl, + IN u8 chnl, OUT u8* pGroup ) { @@ -3323,7 +3323,7 @@ Hal_GetChnlGroup88E( else if(chnl <14) // Channel 12-13 *pGroup = 4; else if(chnl ==14) // Channel 14 - *pGroup = 5; + *pGroup = 5; else { //RT_TRACE(COMP_EFUSE,DBG_LOUD,("==>Hal_GetChnlGroup88E in 2.4 G, but Channel %d in Group not found \n",chnl)); @@ -3332,33 +3332,33 @@ Hal_GetChnlGroup88E( else { bIn24G=_FALSE; - - if (chnl <=40) + + if (chnl <=40) *pGroup = 0; else if (chnl <=48) *pGroup = 1; - else if(chnl <=56) + else if(chnl <=56) *pGroup = 2; - else if(chnl <=64) + else if(chnl <=64) *pGroup = 3; else if(chnl <=104) *pGroup = 4; else if(chnl <=112) - *pGroup = 5; + *pGroup = 5; else if(chnl <=120) - *pGroup = 5; + *pGroup = 5; else if(chnl <=128) - *pGroup = 6; + *pGroup = 6; else if(chnl <=136) - *pGroup = 7; + *pGroup = 7; else if(chnl <=144) - *pGroup = 8; + *pGroup = 8; else if(chnl <=153) - *pGroup = 9; + *pGroup = 9; else if(chnl <=161) - *pGroup = 10; + *pGroup = 10; else if(chnl <=177) - *pGroup = 11; + *pGroup = 11; else { //RT_TRACE(COMP_EFUSE,DBG_LOUD,("==>Hal_GetChnlGroup88E in 5G, but Channel %d in Group not found \n",chnl)); @@ -3383,7 +3383,7 @@ void Hal_ReadPowerSavingMode88E( pwrctl->bHWPowerdown = _FALSE; pwrctl->bSupportRemoteWakeup = _FALSE; } - else { + else { //hw power down mode selection , 0:rf-off / 1:power down @@ -3393,21 +3393,21 @@ void Hal_ReadPowerSavingMode88E( pwrctl->bHWPowerdown = padapter->registrypriv.hwpdn_mode; pwrctl->bHWPwrPindetect = padapter->registrypriv.hwpwrp_detect; - + // decide hw if support remote wakeup function // if hw supported, 8051 (SIE) will generate WeakUP signal( D+/D- toggle) when autoresume #ifdef CONFIG_USB_HCI pwrctl->bSupportRemoteWakeup = (hwinfo[EEPROM_USB_OPTIONAL_FUNCTION0] & BIT1)?_TRUE :_FALSE; #endif //CONFIG_USB_HCI - //if(SUPPORT_HW_RADIO_DETECT(Adapter)) + //if(SUPPORT_HW_RADIO_DETECT(Adapter)) //Adapter->registrypriv.usbss_enable = pwrctl->bSupportRemoteWakeup ; - + DBG_8192C("%s...bHWPwrPindetect(%x)-bHWPowerdown(%x) ,bSupportRemoteWakeup(%x)\n",__FUNCTION__, pwrctl->bHWPwrPindetect, pwrctl->bHWPowerdown, pwrctl->bSupportRemoteWakeup); DBG_8192C("### PS params=> power_mgnt(%x),usbss_enable(%x) ###\n",padapter->registrypriv.power_mgnt,padapter->registrypriv.usbss_enable); - + } } @@ -3418,7 +3418,7 @@ Hal_ReadTxPowerInfo88E( IN u8* PROMContent, IN BOOLEAN AutoLoadFail ) -{ +{ HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter); TxPowerInfo24G pwrInfo24G; u8 rfPath, ch, group, rfPathMax=1; @@ -3427,7 +3427,7 @@ Hal_ReadTxPowerInfo88E( Hal_ReadPowerValueFromPROM_8188E(padapter,&pwrInfo24G, PROMContent, AutoLoadFail); if(!AutoLoadFail) - pHalData->bTXPowerDataReadFromEEPORM = TRUE; + pHalData->bTXPowerDataReadFromEEPORM = TRUE; //for(rfPath = 0 ; rfPath < MAX_RF_PATH ; rfPath++) for(rfPath = 0 ; rfPath < pHalData->NumTotalRFPath ; rfPath++) @@ -3445,14 +3445,14 @@ Hal_ReadTxPowerInfo88E( else pHalData->Index24G_BW40_Base[rfPath][ch]=pwrInfo24G.IndexBW40_Base[rfPath][group]; } - + if(bIn24G) { - DBG_871X("======= Path %d, Channel %d =======\n",rfPath,ch+1 ); + DBG_871X("======= Path %d, Channel %d =======\n",rfPath,ch+1 ); DBG_871X("Index24G_CCK_Base[%d][%d] = 0x%x\n",rfPath,ch+1 ,pHalData->Index24G_CCK_Base[rfPath][ch]); - DBG_871X("Index24G_BW40_Base[%d][%d] = 0x%x\n",rfPath,ch+1 ,pHalData->Index24G_BW40_Base[rfPath][ch]); - } - } + DBG_871X("Index24G_BW40_Base[%d][%d] = 0x%x\n",rfPath,ch+1 ,pHalData->Index24G_BW40_Base[rfPath][ch]); + } + } for(TxCount=0;TxCountOFDM_24G_Diff[rfPath][TxCount]=pwrInfo24G.OFDM_Diff[rfPath][TxCount]; pHalData->BW20_24G_Diff[rfPath][TxCount]=pwrInfo24G.BW20_Diff[rfPath][TxCount]; pHalData->BW40_24G_Diff[rfPath][TxCount]=pwrInfo24G.BW40_Diff[rfPath][TxCount]; -#if DBG - DBG_871X("======= TxCount %d =======\n",TxCount ); +#if DBG + DBG_871X("======= TxCount %d =======\n",TxCount ); DBG_871X("CCK_24G_Diff[%d][%d]= %d\n",rfPath,TxCount,pHalData->CCK_24G_Diff[rfPath][TxCount]); DBG_871X("OFDM_24G_Diff[%d][%d]= %d\n",rfPath,TxCount,pHalData->OFDM_24G_Diff[rfPath][TxCount]); DBG_871X("BW20_24G_Diff[%d][%d]= %d\n",rfPath,TxCount,pHalData->BW20_24G_Diff[rfPath][TxCount]); DBG_871X("BW40_24G_Diff[%d][%d]= %d\n",rfPath,TxCount,pHalData->BW40_24G_Diff[rfPath][TxCount]); -#endif +#endif } } - + // 2010/10/19 MH Add Regulator recognize for EU. if(!AutoLoadFail) { struct registry_priv *registry_par = &padapter->registrypriv; - if( registry_par->regulatory_tid == 0xff){ + if( registry_par->regulatory_tid == 0xff){ if(PROMContent[EEPROM_RF_BOARD_OPTION_88E] == 0xFF) pHalData->EEPROMRegulatory = (EEPROM_DEFAULT_BOARD_OPTION&0x7); //bit0~2 else @@ -3506,7 +3506,7 @@ Hal_EfuseParseXtal_8188E( { pHalData->CrystalCap = hwinfo[EEPROM_XTAL_88E]; if(pHalData->CrystalCap == 0xFF) - pHalData->CrystalCap = EEPROM_Default_CrystalCap_88E; + pHalData->CrystalCap = EEPROM_Default_CrystalCap_88E; } else { @@ -3540,10 +3540,10 @@ Hal_EfuseParseEEPROMVer88E( { HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter); - if(!AutoLoadFail){ + if(!AutoLoadFail){ pHalData->EEPROMVersion = hwinfo[EEPROM_VERSION_88E]; if(pHalData->EEPROMVersion == 0xFF) - pHalData->EEPROMVersion = EEPROM_Default_Version; + pHalData->EEPROMVersion = EEPROM_Default_Version; } else{ pHalData->EEPROMVersion = 1; @@ -3602,16 +3602,16 @@ Hal_ReadAntennaDiversity88E( ) { HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter); - struct registry_priv *registry_par = &pAdapter->registrypriv; + struct registry_priv *registry_par = &pAdapter->registrypriv; if(!AutoLoadFail) - { + { // Antenna Diversity setting. if(registry_par->antdiv_cfg == 2)// 2:By EFUSE { pHalData->AntDivCfg = (PROMContent[EEPROM_RF_BOARD_OPTION_88E]&0x18)>>3; - if(PROMContent[EEPROM_RF_BOARD_OPTION_88E] == 0xFF) - pHalData->AntDivCfg = (EEPROM_DEFAULT_BOARD_OPTION&0x18)>>3;; + if(PROMContent[EEPROM_RF_BOARD_OPTION_88E] == 0xFF) + pHalData->AntDivCfg = (EEPROM_DEFAULT_BOARD_OPTION&0x18)>>3;; } else { @@ -3619,24 +3619,24 @@ Hal_ReadAntennaDiversity88E( } if(registry_par->antdiv_type == 0)// If TRxAntDivType is AUTO in advanced setting, use EFUSE value instead. - { - pHalData->TRxAntDivType = PROMContent[EEPROM_RF_ANTENNA_OPT_88E]; - if (pHalData->TRxAntDivType == 0xFF) - pHalData->TRxAntDivType = CG_TRX_HW_ANTDIV; // For 88EE, 1Tx and 1RxCG are fixed.(1Ant, Tx and RxCG are both on aux port) + { + pHalData->TRxAntDivType = PROMContent[EEPROM_RF_ANTENNA_OPT_88E]; + if (pHalData->TRxAntDivType == 0xFF) + pHalData->TRxAntDivType = CG_TRX_HW_ANTDIV; // For 88EE, 1Tx and 1RxCG are fixed.(1Ant, Tx and RxCG are both on aux port) } else{ pHalData->TRxAntDivType = registry_par->antdiv_type ; } - + if (pHalData->TRxAntDivType == CG_TRX_HW_ANTDIV || pHalData->TRxAntDivType == CGCS_RX_HW_ANTDIV) pHalData->AntDivCfg = 1; // 0xC1[3] is ignored. } else { pHalData->AntDivCfg = 0; - pHalData->TRxAntDivType = pHalData->TRxAntDivType; // The value in the driver setting of device manager. + pHalData->TRxAntDivType = pHalData->TRxAntDivType; // The value in the driver setting of device manager. } - + DBG_871X("EEPROM : AntDivCfg = %x, TRxAntDivType = %x\n",pHalData->AntDivCfg, pHalData->TRxAntDivType); @@ -3644,9 +3644,9 @@ Hal_ReadAntennaDiversity88E( void Hal_ReadThermalMeter_88E( - IN struct adapter *Adapter, - IN u8* PROMContent, - IN BOOLEAN AutoloadFail + IN struct adapter *Adapter, + IN u8* PROMContent, + IN BOOLEAN AutoloadFail ) { HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); @@ -3655,7 +3655,7 @@ Hal_ReadThermalMeter_88E( // // ThermalMeter from EEPROM // - if(!AutoloadFail) + if(!AutoloadFail) pHalData->EEPROMThermalMeter = PROMContent[EEPROM_THERMAL_METER_88E]; else pHalData->EEPROMThermalMeter = EEPROM_Default_ThermalMeter_88E; @@ -3664,11 +3664,11 @@ Hal_ReadThermalMeter_88E( if(pHalData->EEPROMThermalMeter == 0xff || AutoloadFail) { pHalData->bAPKThermalMeterIgnore = _TRUE; - pHalData->EEPROMThermalMeter = EEPROM_Default_ThermalMeter_88E; + pHalData->EEPROMThermalMeter = EEPROM_Default_ThermalMeter_88E; } - //pHalData->ThermalMeter[0] = pHalData->EEPROMThermalMeter; - DBG_871X("ThermalMeter = 0x%x\n", pHalData->EEPROMThermalMeter); + //pHalData->ThermalMeter[0] = pHalData->EEPROMThermalMeter; + DBG_871X("ThermalMeter = 0x%x\n", pHalData->EEPROMThermalMeter); } @@ -3797,4 +3797,3 @@ void SetBcnCtrlReg( rtw_write8(padapter, REG_BCN_CTRL, (u8)pHalData->RegBcnCtrlVal); } - diff --git a/hal/rtl8188e_phycfg.c b/hal/rtl8188e_phycfg.c index 83b85d5..0b4779e 100755 --- a/hal/rtl8188e_phycfg.c +++ b/hal/rtl8188e_phycfg.c @@ -1,3552 +1,3551 @@ -/****************************************************************************** - * - * 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 - * - * - ******************************************************************************/ -#define _RTL8188E_PHYCFG_C_ - -#include -#include -#include -#include - -#ifdef CONFIG_IOL -#include -#endif - -#include - - -/*---------------------------Define Local Constant---------------------------*/ -/* Channel switch:The size of command tables for switch channel*/ -#define MAX_PRECMD_CNT 16 -#define MAX_RFDEPENDCMD_CNT 16 -#define MAX_POSTCMD_CNT 16 - -#define MAX_DOZE_WAITING_TIMES_9x 64 - -/*---------------------------Define Local Constant---------------------------*/ - - -/*------------------------Define global variable-----------------------------*/ - -/*------------------------Define local variable------------------------------*/ - - -/*--------------------Define export function prototype-----------------------*/ -// Please refer to header file -/*--------------------Define export function prototype-----------------------*/ - -/*----------------------------Function Body----------------------------------*/ -// -// 1. BB register R/W API -// - -/** -* Function: phy_CalculateBitShift -* -* OverView: Get shifted position of the BitMask -* -* Input: -* u4Byte BitMask, -* -* Output: none -* Return: u4Byte Return the shift bit bit position of the mask -*/ -static u32 -phy_CalculateBitShift( - u32 BitMask - ) -{ - u32 i; - - for(i=0; i<=31; i++) - { - if ( ((BitMask>>i) & 0x1 ) == 1) - break; - } - - return (i); -} - -#if(SIC_ENABLE == 1) -static BOOLEAN -sic_IsSICReady( - IN struct adapter *Adapter - ) -{ - BOOLEAN bRet=_FALSE; - u32 retryCnt=0; - u8 sic_cmd=0xff; - - while(1) - { - if(retryCnt++ >= SIC_MAX_POLL_CNT) - { - //RTPRINT(FPHY, (PHY_SICR|PHY_SICW), ("[SIC], sic_IsSICReady() return FALSE\n")); - return _FALSE; - } - - //if(RT_SDIO_CANNOT_IO(Adapter)) - // return _FALSE; - - sic_cmd = rtw_read8(Adapter, SIC_CMD_REG); - //sic_cmd = PlatformEFIORead1Byte(Adapter, SIC_CMD_REG); -#if(SIC_HW_SUPPORT == 1) - sic_cmd &= 0xf0; // [7:4] -#endif - //RTPRINT(FPHY, (PHY_SICR|PHY_SICW), ("[SIC], sic_IsSICReady(), readback 0x%x=0x%x\n", SIC_CMD_REG, sic_cmd)); - if(sic_cmd == SIC_CMD_READY) - return _TRUE; - else - { - rtw_msleep_os(1); - //delay_ms(1); - } - } - - return bRet; -} - -/* -u32 -sic_CalculateBitShift( - u32 BitMask - ) -{ - u32 i; - - for(i=0; i<=31; i++) - { - if ( ((BitMask>>i) & 0x1 ) == 1) - break; - } - - return (i); -} -*/ - -static u32 -sic_Read4Byte( - PVOID Adapter, - u32 offset - ) -{ - u32 u4ret=0xffffffff; -#if RTL8188E_SUPPORT == 1 - u8 retry = 0; -#endif - - //RTPRINT(FPHY, PHY_SICR, ("[SIC], sic_Read4Byte(): read offset(%#x)\n", offset)); - - if(sic_IsSICReady(Adapter)) - { -#if(SIC_HW_SUPPORT == 1) - rtw_write8(Adapter, SIC_CMD_REG, SIC_CMD_PREREAD); - //PlatformEFIOWrite1Byte(Adapter, SIC_CMD_REG, SIC_CMD_PREREAD); - //RTPRINT(FPHY, PHY_SICR, ("write cmdreg 0x%x = 0x%x\n", SIC_CMD_REG, SIC_CMD_PREREAD)); -#endif - rtw_write8(Adapter, SIC_ADDR_REG, (u8)(offset&0xff)); - //PlatformEFIOWrite1Byte(Adapter, SIC_ADDR_REG, (u1Byte)(offset&0xff)); - //RTPRINT(FPHY, PHY_SICR, ("write 0x%x = 0x%x\n", SIC_ADDR_REG, (u1Byte)(offset&0xff))); - rtw_write8(Adapter, SIC_ADDR_REG+1, (u8)((offset&0xff00)>>8)); - //PlatformEFIOWrite1Byte(Adapter, SIC_ADDR_REG+1, (u1Byte)((offset&0xff00)>>8)); - //RTPRINT(FPHY, PHY_SICR, ("write 0x%x = 0x%x\n", SIC_ADDR_REG+1, (u1Byte)((offset&0xff00)>>8))); - rtw_write8(Adapter, SIC_CMD_REG, SIC_CMD_READ); - //PlatformEFIOWrite1Byte(Adapter, SIC_CMD_REG, SIC_CMD_READ); - //RTPRINT(FPHY, PHY_SICR, ("write cmdreg 0x%x = 0x%x\n", SIC_CMD_REG, SIC_CMD_READ)); - -#if RTL8188E_SUPPORT == 1 - retry = 4; - while(retry--){ - rtw_udelay_os(50); - //PlatformStallExecution(50); - } -#else - rtw_udelay_os(200); - //PlatformStallExecution(200); -#endif - - if(sic_IsSICReady(Adapter)) - { - u4ret = rtw_read32(Adapter, SIC_DATA_REG); - //u4ret = PlatformEFIORead4Byte(Adapter, SIC_DATA_REG); - //RTPRINT(FPHY, PHY_SICR, ("read 0x%x = 0x%x\n", SIC_DATA_REG, u4ret)); - //DbgPrint("<===Read 0x%x = 0x%x\n", offset, u4ret); - } - } - - return u4ret; -} - -static VOID -sic_Write4Byte( - PVOID Adapter, - u32 offset, - u32 data - ) -{ -#if RTL8188E_SUPPORT == 1 - u8 retry = 6; -#endif - //DbgPrint("=>Write 0x%x = 0x%x\n", offset, data); - //RTPRINT(FPHY, PHY_SICW, ("[SIC], sic_Write4Byte(): write offset(%#x)=0x%x\n", offset, data)); - if(sic_IsSICReady(Adapter)) - { -#if(SIC_HW_SUPPORT == 1) - rtw_write8(Adapter, SIC_CMD_REG, SIC_CMD_PREWRITE); - //PlatformEFIOWrite1Byte(Adapter, SIC_CMD_REG, SIC_CMD_PREWRITE); - //RTPRINT(FPHY, PHY_SICW, ("write data 0x%x = 0x%x\n", SIC_CMD_REG, SIC_CMD_PREWRITE)); -#endif - rtw_write8(Adapter, SIC_ADDR_REG, (u8)(offset&0xff)); - //PlatformEFIOWrite1Byte(Adapter, SIC_ADDR_REG, (u1Byte)(offset&0xff)); - //RTPRINT(FPHY, PHY_SICW, ("write 0x%x=0x%x\n", SIC_ADDR_REG, (u1Byte)(offset&0xff))); - rtw_write8(Adapter, SIC_ADDR_REG+1, (u8)((offset&0xff00)>>8)); - //PlatformEFIOWrite1Byte(Adapter, SIC_ADDR_REG+1, (u1Byte)((offset&0xff00)>>8)); - //RTPRINT(FPHY, PHY_SICW, ("write 0x%x=0x%x\n", (SIC_ADDR_REG+1), (u1Byte)((offset&0xff00)>>8))); - rtw_write32(Adapter, SIC_DATA_REG, (u32)data); - //PlatformEFIOWrite4Byte(Adapter, SIC_DATA_REG, (u4Byte)data); - //RTPRINT(FPHY, PHY_SICW, ("write data 0x%x = 0x%x\n", SIC_DATA_REG, data)); - rtw_write8(Adapter, SIC_CMD_REG, SIC_CMD_WRITE); - //PlatformEFIOWrite1Byte(Adapter, SIC_CMD_REG, SIC_CMD_WRITE); - //RTPRINT(FPHY, PHY_SICW, ("write data 0x%x = 0x%x\n", SIC_CMD_REG, SIC_CMD_WRITE)); -#if RTL8188E_SUPPORT == 1 - while(retry--){ - rtw_udelay_os(50); - //PlatformStallExecution(50); - } -#else - rtw_udelay_os(150); - //PlatformStallExecution(150); -#endif - - } -} -//============================================================ -// extern function -//============================================================ -static VOID -SIC_SetBBReg( - IN struct adapter *Adapter, - IN u32 RegAddr, - IN u32 BitMask, - IN u32 Data - ) -{ - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); - u32 OriginalValue, BitShift; - u16 BBWaitCounter = 0; - - //RTPRINT(FPHY, PHY_SICW, ("[SIC], SIC_SetBBReg() start\n")); -/* - while(PlatformAtomicExchange(&pHalData->bChangeBBInProgress, _TRUE) == _TRUE) - { - BBWaitCounter ++; - delay_ms(10); // 1 ms - - if((BBWaitCounter > 100) || RT_CANNOT_IO(Adapter)) - {// Wait too long, return FALSE to avoid to be stuck here. - RTPRINT(FPHY, PHY_SICW, ("[SIC], SIC_SetBBReg(), Fail to set BB offset(%#x)!!, WaitCnt(%d)\n", RegAddr, BBWaitCounter)); - return; - } - } -*/ - // - // Critical section start - // - - //RTPRINT(FPHY, PHY_SICW, ("[SIC], SIC_SetBBReg(), mask=0x%x, addr[0x%x]=0x%x\n", BitMask, RegAddr, Data)); - - if(BitMask!= bMaskDWord){//if not "double word" write - OriginalValue = sic_Read4Byte(Adapter, RegAddr); - //BitShift = sic_CalculateBitShift(BitMask); - BitShift = phy_CalculateBitShift(BitMask); - Data = (((OriginalValue) & (~BitMask)) | (Data << BitShift)); - } - - sic_Write4Byte(Adapter, RegAddr, Data); - - //PlatformAtomicExchange(&pHalData->bChangeBBInProgress, _FALSE); - //RTPRINT(FPHY, PHY_SICW, ("[SIC], SIC_SetBBReg() end\n")); -} - -static u32 -SIC_QueryBBReg( - IN struct adapter *Adapter, - IN u32 RegAddr, - IN u32 BitMask - ) -{ - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); - u32 ReturnValue = 0, OriginalValue, BitShift; - u16 BBWaitCounter = 0; - - //RTPRINT(FPHY, PHY_SICR, ("[SIC], SIC_QueryBBReg() start\n")); - -/* - while(PlatformAtomicExchange(&pHalData->bChangeBBInProgress, _TRUE) == _TRUE) - { - BBWaitCounter ++; - delay_ms(10); // 10 ms - - if((BBWaitCounter > 100) || RT_CANNOT_IO(Adapter)) - {// Wait too long, return FALSE to avoid to be stuck here. - RTPRINT(FPHY, PHY_SICW, ("[SIC], SIC_QueryBBReg(), Fail to query BB offset(%#x)!!, WaitCnt(%d)\n", RegAddr, BBWaitCounter)); - return ReturnValue; - } - } -*/ - OriginalValue = sic_Read4Byte(Adapter, RegAddr); - //BitShift = sic_CalculateBitShift(BitMask); - BitShift = phy_CalculateBitShift(BitMask); - ReturnValue = (OriginalValue & BitMask) >> BitShift; - - //RTPRINT(FPHY, PHY_SICR, ("[SIC], SIC_QueryBBReg(), 0x%x=0x%x\n", RegAddr, OriginalValue)); - //RTPRINT(FPHY, PHY_SICR, ("[SIC], SIC_QueryBBReg() end\n")); - - //PlatformAtomicExchange(&pHalData->bChangeBBInProgress, _FALSE); - return (ReturnValue); -} - -VOID -SIC_Init( - IN struct adapter *Adapter - ) -{ - // Here we need to write 0x1b8~0x1bf = 0 after fw is downloaded - // because for 8723E at beginning 0x1b8=0x1e, that will cause - // sic always not be ready -#if(SIC_HW_SUPPORT == 1) - //RTPRINT(FPHY, PHY_SICR, ("[SIC], SIC_Init(), write 0x%x = 0x%x\n", - // SIC_INIT_REG, SIC_INIT_VAL)); - rtw_write8(Adapter, SIC_INIT_REG, SIC_INIT_VAL); - //PlatformEFIOWrite1Byte(Adapter, SIC_INIT_REG, SIC_INIT_VAL); - //RTPRINT(FPHY, PHY_SICR, ("[SIC], SIC_Init(), write 0x%x = 0x%x\n", - // SIC_CMD_REG, SIC_CMD_INIT)); - rtw_write8(Adapter, SIC_CMD_REG, SIC_CMD_INIT); - //PlatformEFIOWrite1Byte(Adapter, SIC_CMD_REG, SIC_CMD_INIT); -#else - //RTPRINT(FPHY, PHY_SICR, ("[SIC], SIC_Init(), write 0x1b8~0x1bf = 0x0\n")); - rtw_write32(Adapter, SIC_CMD_REG, 0); - //PlatformEFIOWrite4Byte(Adapter, SIC_CMD_REG, 0); - rtw_write32(Adapter, SIC_CMD_REG+4, 0); - //PlatformEFIOWrite4Byte(Adapter, SIC_CMD_REG+4, 0); -#endif -} - -static BOOLEAN -SIC_LedOff( - IN struct adapter *Adapter - ) -{ - // When SIC is enabled, led pin will be used as debug pin, - // so don't execute led function when SIC is enabled. - return _TRUE; -} -#endif - -/** -* Function: PHY_QueryBBReg -* -* OverView: Read "sepcific bits" from BB register -* -* Input: -* struct adapter * Adapter, -* u4Byte RegAddr, //The target address to be readback -* u4Byte BitMask //The target bit position in the target address -* //to be readback -* Output: None -* Return: u4Byte Data //The readback register value -* Note: This function is equal to "GetRegSetting" in PHY programming guide -*/ -u32 -rtl8188e_PHY_QueryBBReg( - IN struct adapter *Adapter, - IN u32 RegAddr, - IN u32 BitMask - ) -{ - u32 ReturnValue = 0, OriginalValue, BitShift; - u16 BBWaitCounter = 0; - -#if (DISABLE_BB_RF == 1) - return 0; -#endif - -#if(SIC_ENABLE == 1) - return SIC_QueryBBReg(Adapter, RegAddr, BitMask); -#endif - - //RT_TRACE(COMP_RF, DBG_TRACE, ("--->PHY_QueryBBReg(): RegAddr(%#lx), BitMask(%#lx)\n", RegAddr, BitMask)); - - OriginalValue = rtw_read32(Adapter, RegAddr); - BitShift = phy_CalculateBitShift(BitMask); - ReturnValue = (OriginalValue & BitMask) >> BitShift; - - //RTPRINT(FPHY, PHY_BBR, ("BBR MASK=0x%lx Addr[0x%lx]=0x%lx\n", BitMask, RegAddr, OriginalValue)); - //RT_TRACE(COMP_RF, DBG_TRACE, ("<---PHY_QueryBBReg(): RegAddr(%#lx), BitMask(%#lx), OriginalValue(%#lx)\n", RegAddr, BitMask, OriginalValue)); - - return (ReturnValue); - -} - - -/** -* Function: PHY_SetBBReg -* -* OverView: Write "Specific bits" to BB register (page 8~) -* -* Input: -* struct adapter * Adapter, -* u4Byte RegAddr, //The target address to be modified -* u4Byte BitMask //The target bit position in the target address -* //to be modified -* u4Byte Data //The new register value in the target bit position -* //of the target address -* -* Output: None -* Return: None -* Note: This function is equal to "PutRegSetting" in PHY programming guide -*/ - -VOID -rtl8188e_PHY_SetBBReg( - IN struct adapter *Adapter, - IN u32 RegAddr, - IN u32 BitMask, - IN u32 Data - ) -{ - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); - //u16 BBWaitCounter = 0; - u32 OriginalValue, BitShift; - -#if (DISABLE_BB_RF == 1) - return; -#endif - -#if(SIC_ENABLE == 1) - SIC_SetBBReg(Adapter, RegAddr, BitMask, Data); - return; -#endif - - //RT_TRACE(COMP_RF, DBG_TRACE, ("--->PHY_SetBBReg(): RegAddr(%#lx), BitMask(%#lx), Data(%#lx)\n", RegAddr, BitMask, Data)); - - if(BitMask!= bMaskDWord){//if not "double word" write - OriginalValue = rtw_read32(Adapter, RegAddr); - BitShift = phy_CalculateBitShift(BitMask); - Data = ((OriginalValue & (~BitMask)) | ((Data << BitShift) & BitMask)); - } - - rtw_write32(Adapter, RegAddr, Data); - - //RTPRINT(FPHY, PHY_BBW, ("BBW MASK=0x%lx Addr[0x%lx]=0x%lx\n", BitMask, RegAddr, Data)); - //RT_TRACE(COMP_RF, DBG_TRACE, ("<---PHY_SetBBReg(): RegAddr(%#lx), BitMask(%#lx), Data(%#lx)\n", RegAddr, BitMask, Data)); - -} - - -// -// 2. RF register R/W API -// -/** -* Function: phy_RFSerialRead -* -* OverView: Read regster from RF chips -* -* Input: -* struct adapter * Adapter, -* RF_RADIO_PATH_E eRFPath, //Radio path of A/B/C/D -* u4Byte Offset, //The target address to be read -* -* Output: None -* Return: u4Byte reback value -* Note: Threre are three types of serial operations: -* 1. Software serial write -* 2. Hardware LSSI-Low Speed Serial Interface -* 3. Hardware HSSI-High speed -* serial write. Driver need to implement (1) and (2). -* This function is equal to the combination of RF_ReadReg() and RFLSSIRead() -*/ -static u32 -phy_RFSerialRead( - IN struct adapter * Adapter, - IN RF_RADIO_PATH_E eRFPath, - IN u32 Offset - ) -{ - u32 retValue = 0; - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); - BB_REGISTER_DEFINITION_T *pPhyReg = &pHalData->PHYRegDef[eRFPath]; - u32 NewOffset; - u32 tmplong,tmplong2; - u8 RfPiEnable=0; -#if 0 - if(pHalData->RFChipID == RF_8225 && Offset > 0x24) //36 valid regs - return retValue; - if(pHalData->RFChipID == RF_8256 && Offset > 0x2D) //45 valid regs - return retValue; -#endif - // - // Make sure RF register offset is correct - // - Offset &= 0xff; - - // - // Switch page for 8256 RF IC - // - NewOffset = Offset; - - // 2009/06/17 MH We can not execute IO for power save or other accident mode. - //if(RT_CANNOT_IO(Adapter)) - //{ - // RTPRINT(FPHY, PHY_RFR, ("phy_RFSerialRead return all one\n")); - // return 0xFFFFFFFF; - //} - - // For 92S LSSI Read RFLSSIRead - // For RF A/B write 0x824/82c(does not work in the future) - // We must use 0x824 for RF A and B to execute read trigger - tmplong = PHY_QueryBBReg(Adapter, rFPGA0_XA_HSSIParameter2, bMaskDWord); - if(eRFPath == RF_PATH_A) - tmplong2 = tmplong; - else - tmplong2 = PHY_QueryBBReg(Adapter, pPhyReg->rfHSSIPara2, bMaskDWord); - - tmplong2 = (tmplong2 & (~bLSSIReadAddress)) | (NewOffset<<23) | bLSSIReadEdge; //T65 RF - - PHY_SetBBReg(Adapter, rFPGA0_XA_HSSIParameter2, bMaskDWord, tmplong&(~bLSSIReadEdge)); - rtw_udelay_os(10);// PlatformStallExecution(10); - - PHY_SetBBReg(Adapter, pPhyReg->rfHSSIPara2, bMaskDWord, tmplong2); - rtw_udelay_os(100);//PlatformStallExecution(100); - - //PHY_SetBBReg(Adapter, rFPGA0_XA_HSSIParameter2, bMaskDWord, tmplong|bLSSIReadEdge); - rtw_udelay_os(10);//PlatformStallExecution(10); - - if(eRFPath == RF_PATH_A) - RfPiEnable = (u8)PHY_QueryBBReg(Adapter, rFPGA0_XA_HSSIParameter1, BIT8); - else if(eRFPath == RF_PATH_B) - RfPiEnable = (u8)PHY_QueryBBReg(Adapter, rFPGA0_XB_HSSIParameter1, BIT8); - - if(RfPiEnable) - { // Read from BBreg8b8, 12 bits for 8190, 20bits for T65 RF - retValue = PHY_QueryBBReg(Adapter, pPhyReg->rfLSSIReadBackPi, bLSSIReadBackData); - //DBG_8192C("Readback from RF-PI : 0x%x\n", retValue); - } - else - { //Read from BBreg8a0, 12 bits for 8190, 20 bits for T65 RF - retValue = PHY_QueryBBReg(Adapter, pPhyReg->rfLSSIReadBack, bLSSIReadBackData); - //DBG_8192C("Readback from RF-SI : 0x%x\n", retValue); - } - //DBG_8192C("RFR-%d Addr[0x%x]=0x%x\n", eRFPath, pPhyReg->rfLSSIReadBack, retValue); - - return retValue; - -} - - - -/** -* Function: phy_RFSerialWrite -* -* OverView: Write data to RF register (page 8~) -* -* Input: -* struct adapter * Adapter, -* RF_RADIO_PATH_E eRFPath, //Radio path of A/B/C/D -* u4Byte Offset, //The target address to be read -* u4Byte Data //The new register Data in the target bit position -* //of the target to be read -* -* Output: None -* Return: None -* Note: Threre are three types of serial operations: -* 1. Software serial write -* 2. Hardware LSSI-Low Speed Serial Interface -* 3. Hardware HSSI-High speed -* serial write. Driver need to implement (1) and (2). -* This function is equal to the combination of RF_ReadReg() and RFLSSIRead() - * - * Note: For RF8256 only - * The total count of RTL8256(Zebra4) register is around 36 bit it only employs - * 4-bit RF address. RTL8256 uses "register mode control bit" (Reg00[12], Reg00[10]) - * to access register address bigger than 0xf. See "Appendix-4 in PHY Configuration - * programming guide" for more details. - * Thus, we define a sub-finction for RTL8526 register address conversion - * =========================================================== - * Register Mode RegCTL[1] RegCTL[0] Note - * (Reg00[12]) (Reg00[10]) - * =========================================================== - * Reg_Mode0 0 x Reg 0 ~15(0x0 ~ 0xf) - * ------------------------------------------------------------------ - * Reg_Mode1 1 0 Reg 16 ~30(0x1 ~ 0xf) - * ------------------------------------------------------------------ - * Reg_Mode2 1 1 Reg 31 ~ 45(0x1 ~ 0xf) - * ------------------------------------------------------------------ - * - * 2008/09/02 MH Add 92S RF definition - * - * - * -*/ -static VOID -phy_RFSerialWrite( - IN struct adapter * Adapter, - IN RF_RADIO_PATH_E eRFPath, - IN u32 Offset, - IN u32 Data - ) -{ - u32 DataAndAddr = 0; - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); - BB_REGISTER_DEFINITION_T *pPhyReg = &pHalData->PHYRegDef[eRFPath]; - u32 NewOffset; - -#if 0 - // We should check valid regs for RF_6052 case. - if(pHalData->RFChipID == RF_8225 && Offset > 0x24) //36 valid regs - return; - if(pHalData->RFChipID == RF_8256 && Offset > 0x2D) //45 valid regs - return; -#endif - - // 2009/06/17 MH We can not execute IO for power save or other accident mode. - //if(RT_CANNOT_IO(Adapter)) - //{ - // RTPRINT(FPHY, PHY_RFW, ("phy_RFSerialWrite stop\n")); - // return; - //} - - Offset &= 0xff; - - // - // Shadow Update - // - //PHY_RFShadowWrite(Adapter, eRFPath, Offset, Data); - - // - // Switch page for 8256 RF IC - // - NewOffset = Offset; - - // - // Put write addr in [5:0] and write data in [31:16] - // - //DataAndAddr = (Data<<16) | (NewOffset&0x3f); - DataAndAddr = ((NewOffset<<20) | (Data&0x000fffff)) & 0x0fffffff; // T65 RF - - // - // Write Operation - // - PHY_SetBBReg(Adapter, pPhyReg->rf3wireOffset, bMaskDWord, DataAndAddr); - //RTPRINT(FPHY, PHY_RFW, ("RFW-%d Addr[0x%lx]=0x%lx\n", eRFPath, pPhyReg->rf3wireOffset, DataAndAddr)); - -} - - -/** -* Function: PHY_QueryRFReg -* -* OverView: Query "Specific bits" to RF register (page 8~) -* -* Input: -* struct adapter * Adapter, -* RF_RADIO_PATH_E eRFPath, //Radio path of A/B/C/D -* u4Byte RegAddr, //The target address to be read -* u4Byte BitMask //The target bit position in the target address -* //to be read -* -* Output: None -* Return: u4Byte Readback value -* Note: This function is equal to "GetRFRegSetting" in PHY programming guide -*/ -u32 -rtl8188e_PHY_QueryRFReg( - IN struct adapter * Adapter, - IN RF_RADIO_PATH_E eRFPath, - IN u32 RegAddr, - IN u32 BitMask - ) -{ - u32 Original_Value, Readback_Value, BitShift; - //HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); - //u8 RFWaitCounter = 0; - //_irqL irqL; - -#if (DISABLE_BB_RF == 1) - return 0; -#endif - - //RT_TRACE(COMP_RF, DBG_TRACE, ("--->PHY_QueryRFReg(): RegAddr(%#lx), eRFPath(%#x), BitMask(%#lx)\n", RegAddr, eRFPath,BitMask)); - -#ifdef CONFIG_USB_HCI - //PlatformAcquireMutex(&pHalData->mxRFOperate); -#else - //_enter_critical(&pHalData->rf_lock, &irqL); -#endif - - - Original_Value = phy_RFSerialRead(Adapter, eRFPath, RegAddr); - - BitShift = phy_CalculateBitShift(BitMask); - Readback_Value = (Original_Value & BitMask) >> BitShift; - -#ifdef CONFIG_USB_HCI - //PlatformReleaseMutex(&pHalData->mxRFOperate); -#else - //_exit_critical(&pHalData->rf_lock, &irqL); -#endif - - - //RTPRINT(FPHY, PHY_RFR, ("RFR-%d MASK=0x%lx Addr[0x%lx]=0x%lx\n", eRFPath, BitMask, RegAddr, Original_Value));//BitMask(%#lx),BitMask, - //RT_TRACE(COMP_RF, DBG_TRACE, ("<---PHY_QueryRFReg(): RegAddr(%#lx), eRFPath(%#x), Original_Value(%#lx)\n", - // RegAddr, eRFPath, Original_Value)); - - return (Readback_Value); -} - -/** -* Function: PHY_SetRFReg -* -* OverView: Write "Specific bits" to RF register (page 8~) -* -* Input: -* struct adapter * Adapter, -* RF_RADIO_PATH_E eRFPath, //Radio path of A/B/C/D -* u4Byte RegAddr, //The target address to be modified -* u4Byte BitMask //The target bit position in the target address -* //to be modified -* u4Byte Data //The new register Data in the target bit position -* //of the target address -* -* Output: None -* Return: None -* Note: This function is equal to "PutRFRegSetting" in PHY programming guide -*/ -VOID -rtl8188e_PHY_SetRFReg( - IN struct adapter * Adapter, - IN RF_RADIO_PATH_E eRFPath, - IN u32 RegAddr, - IN u32 BitMask, - IN u32 Data - ) -{ - - //HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); - //u1Byte RFWaitCounter = 0; - u32 Original_Value, BitShift; - //_irqL irqL; - -#if (DISABLE_BB_RF == 1) - return; -#endif - - //RT_TRACE(COMP_RF, DBG_TRACE, ("--->PHY_SetRFReg(): RegAddr(%#lx), BitMask(%#lx), Data(%#lx), eRFPath(%#x)\n", - // RegAddr, BitMask, Data, eRFPath)); - //RTPRINT(FINIT, INIT_RF, ("PHY_SetRFReg(): RegAddr(%#lx), BitMask(%#lx), Data(%#lx), eRFPath(%#x)\n", - // RegAddr, BitMask, Data, eRFPath)); - - -#ifdef CONFIG_USB_HCI - //PlatformAcquireMutex(&pHalData->mxRFOperate); -#else - //_enter_critical(&pHalData->rf_lock, &irqL); -#endif - - - // RF data is 12 bits only - if (BitMask != bRFRegOffsetMask) - { - Original_Value = phy_RFSerialRead(Adapter, eRFPath, RegAddr); - BitShift = phy_CalculateBitShift(BitMask); - Data = ((Original_Value & (~BitMask)) | (Data<< BitShift)); - } - - phy_RFSerialWrite(Adapter, eRFPath, RegAddr, Data); - - -#ifdef CONFIG_USB_HCI - //PlatformReleaseMutex(&pHalData->mxRFOperate); -#else - //_exit_critical(&pHalData->rf_lock, &irqL); -#endif - - //PHY_QueryRFReg(Adapter,eRFPath,RegAddr,BitMask); - //RT_TRACE(COMP_RF, DBG_TRACE, ("<---PHY_SetRFReg(): RegAddr(%#lx), BitMask(%#lx), Data(%#lx), eRFPath(%#x)\n", - // RegAddr, BitMask, Data, eRFPath)); - -} - - -// -// 3. Initial MAC/BB/RF config by reading MAC/BB/RF txt. -// - -/*----------------------------------------------------------------------------- - * Function: phy_ConfigMACWithParaFile() - * - * Overview: This function read BB parameters from general file format, and do register - * Read/Write - * - * Input: struct adapter * Adapter - * ps1Byte pFileName - * - * Output: NONE - * - * Return: RT_STATUS_SUCCESS: configuration file exist - * - * Note: The format of MACPHY_REG.txt is different from PHY and RF. - * [Register][Mask][Value] - *---------------------------------------------------------------------------*/ -static int -phy_ConfigMACWithParaFile( - IN struct adapter * Adapter, - IN u8* pFileName -) -{ - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); - - int rtStatus = _FAIL; - - return rtStatus; -} - -/*----------------------------------------------------------------------------- - * Function: phy_ConfigMACWithHeaderFile() - * - * Overview: This function read BB parameters from Header file we gen, and do register - * Read/Write - * - * Input: struct adapter * Adapter - * ps1Byte pFileName - * - * Output: NONE - * - * Return: RT_STATUS_SUCCESS: configuration file exist - * - * Note: The format of MACPHY_REG.txt is different from PHY and RF. - * [Register][Mask][Value] - *---------------------------------------------------------------------------*/ -#ifndef CONFIG_PHY_SETTING_WITH_ODM -static int -phy_ConfigMACWithHeaderFile( - IN struct adapter * Adapter -) -{ - u32 i = 0; - u32 ArrayLength = 0; - u32* ptrArray; - //HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); - - //2008.11.06 Modified by tynli. - //RT_TRACE(COMP_INIT, DBG_LOUD, ("Read Rtl819XMACPHY_Array\n")); - ArrayLength = Rtl8188E_MAC_ArrayLength; - ptrArray = (u32*)Rtl8188E_MAC_Array; - -#ifdef CONFIG_IOL_MAC - { - struct xmit_frame *xmit_frame; - if((xmit_frame=rtw_IOL_accquire_xmit_frame(Adapter)) == NULL) - return _FAIL; - - for(i = 0 ;i < ArrayLength;i=i+2){ // Add by tynli for 2 column - rtw_IOL_append_WB_cmd(xmit_frame, ptrArray[i], (u8)ptrArray[i+1]); - } - - return rtw_IOL_exec_cmds_sync(Adapter, xmit_frame, 1000,0); - } -#else - for(i = 0 ;i < ArrayLength;i=i+2){ // Add by tynli for 2 column - rtw_write8(Adapter, ptrArray[i], (u8)ptrArray[i+1]); - } -#endif - - return _SUCCESS; - -} -#endif //#ifndef CONFIG_PHY_SETTING_WITH_ODM - -/*----------------------------------------------------------------------------- - * Function: PHY_MACConfig8192C - * - * Overview: Condig MAC by header file or parameter file. - * - * Input: NONE - * - * Output: NONE - * - * Return: NONE - * - * Revised History: - * When Who Remark - * 08/12/2008 MHC Create Version 0. - * - *---------------------------------------------------------------------------*/ -s32 PHY_MACConfig8188E(struct adapter *Adapter) -{ - int rtStatus = _SUCCESS; - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); - s8 *pszMACRegFile; - s8 sz8188EMACRegFile[] = RTL8188E_PHY_MACREG; - - pszMACRegFile = sz8188EMACRegFile; - - // - // Config MAC - // -#ifdef CONFIG_EMBEDDED_FWIMG - #ifdef CONFIG_PHY_SETTING_WITH_ODM - if(HAL_STATUS_FAILURE == ODM_ConfigMACWithHeaderFile(&pHalData->odmpriv)) - rtStatus = _FAIL; - #else - rtStatus = phy_ConfigMACWithHeaderFile(Adapter); - #endif//#ifdef CONFIG_PHY_SETTING_WITH_ODM -#else - - // Not make sure EEPROM, add later - //RT_TRACE(COMP_INIT, DBG_LOUD, ("Read MACREG.txt\n")); - rtStatus = phy_ConfigMACWithParaFile(Adapter, pszMACRegFile); -#endif//CONFIG_EMBEDDED_FWIMG - - - // 2010.07.13 AMPDU aggregation number B - rtw_write8(Adapter, REG_MAX_AGGR_NUM, MAX_AGGR_NUM); - //rtw_write8(Adapter, REG_MAX_AGGR_NUM, 0x0B); - - return rtStatus; - -} - - -/** -* Function: phy_InitBBRFRegisterDefinition -* -* OverView: Initialize Register definition offset for Radio Path A/B/C/D -* -* Input: -* struct adapter * Adapter, -* -* Output: None -* Return: None -* Note: The initialization value is constant and it should never be changes -*/ -static VOID -phy_InitBBRFRegisterDefinition( - IN struct adapter * Adapter -) -{ - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); - - // RF Interface Sowrtware Control - pHalData->PHYRegDef[RF_PATH_A].rfintfs = rFPGA0_XAB_RFInterfaceSW; // 16 LSBs if read 32-bit from 0x870 - pHalData->PHYRegDef[RF_PATH_B].rfintfs = rFPGA0_XAB_RFInterfaceSW; // 16 MSBs if read 32-bit from 0x870 (16-bit for 0x872) - pHalData->PHYRegDef[RF_PATH_C].rfintfs = rFPGA0_XCD_RFInterfaceSW;// 16 LSBs if read 32-bit from 0x874 - pHalData->PHYRegDef[RF_PATH_D].rfintfs = rFPGA0_XCD_RFInterfaceSW;// 16 MSBs if read 32-bit from 0x874 (16-bit for 0x876) - - // RF Interface Readback Value - pHalData->PHYRegDef[RF_PATH_A].rfintfi = rFPGA0_XAB_RFInterfaceRB; // 16 LSBs if read 32-bit from 0x8E0 - pHalData->PHYRegDef[RF_PATH_B].rfintfi = rFPGA0_XAB_RFInterfaceRB;// 16 MSBs if read 32-bit from 0x8E0 (16-bit for 0x8E2) - pHalData->PHYRegDef[RF_PATH_C].rfintfi = rFPGA0_XCD_RFInterfaceRB;// 16 LSBs if read 32-bit from 0x8E4 - pHalData->PHYRegDef[RF_PATH_D].rfintfi = rFPGA0_XCD_RFInterfaceRB;// 16 MSBs if read 32-bit from 0x8E4 (16-bit for 0x8E6) - - // RF Interface Output (and Enable) - pHalData->PHYRegDef[RF_PATH_A].rfintfo = rFPGA0_XA_RFInterfaceOE; // 16 LSBs if read 32-bit from 0x860 - pHalData->PHYRegDef[RF_PATH_B].rfintfo = rFPGA0_XB_RFInterfaceOE; // 16 LSBs if read 32-bit from 0x864 - - // RF Interface (Output and) Enable - pHalData->PHYRegDef[RF_PATH_A].rfintfe = rFPGA0_XA_RFInterfaceOE; // 16 MSBs if read 32-bit from 0x860 (16-bit for 0x862) - pHalData->PHYRegDef[RF_PATH_B].rfintfe = rFPGA0_XB_RFInterfaceOE; // 16 MSBs if read 32-bit from 0x864 (16-bit for 0x866) - - //Addr of LSSI. Wirte RF register by driver - pHalData->PHYRegDef[RF_PATH_A].rf3wireOffset = rFPGA0_XA_LSSIParameter; //LSSI Parameter - pHalData->PHYRegDef[RF_PATH_B].rf3wireOffset = rFPGA0_XB_LSSIParameter; - - // RF parameter - pHalData->PHYRegDef[RF_PATH_A].rfLSSI_Select = rFPGA0_XAB_RFParameter; //BB Band Select - pHalData->PHYRegDef[RF_PATH_B].rfLSSI_Select = rFPGA0_XAB_RFParameter; - pHalData->PHYRegDef[RF_PATH_C].rfLSSI_Select = rFPGA0_XCD_RFParameter; - pHalData->PHYRegDef[RF_PATH_D].rfLSSI_Select = rFPGA0_XCD_RFParameter; - - // Tx AGC Gain Stage (same for all path. Should we remove this?) - pHalData->PHYRegDef[RF_PATH_A].rfTxGainStage = rFPGA0_TxGainStage; //Tx gain stage - pHalData->PHYRegDef[RF_PATH_B].rfTxGainStage = rFPGA0_TxGainStage; //Tx gain stage - pHalData->PHYRegDef[RF_PATH_C].rfTxGainStage = rFPGA0_TxGainStage; //Tx gain stage - pHalData->PHYRegDef[RF_PATH_D].rfTxGainStage = rFPGA0_TxGainStage; //Tx gain stage - - // Tranceiver A~D HSSI Parameter-1 - pHalData->PHYRegDef[RF_PATH_A].rfHSSIPara1 = rFPGA0_XA_HSSIParameter1; //wire control parameter1 - pHalData->PHYRegDef[RF_PATH_B].rfHSSIPara1 = rFPGA0_XB_HSSIParameter1; //wire control parameter1 - - // Tranceiver A~D HSSI Parameter-2 - pHalData->PHYRegDef[RF_PATH_A].rfHSSIPara2 = rFPGA0_XA_HSSIParameter2; //wire control parameter2 - pHalData->PHYRegDef[RF_PATH_B].rfHSSIPara2 = rFPGA0_XB_HSSIParameter2; //wire control parameter2 - - // RF switch Control - pHalData->PHYRegDef[RF_PATH_A].rfSwitchControl = rFPGA0_XAB_SwitchControl; //TR/Ant switch control - pHalData->PHYRegDef[RF_PATH_B].rfSwitchControl = rFPGA0_XAB_SwitchControl; - pHalData->PHYRegDef[RF_PATH_C].rfSwitchControl = rFPGA0_XCD_SwitchControl; - pHalData->PHYRegDef[RF_PATH_D].rfSwitchControl = rFPGA0_XCD_SwitchControl; - - // AGC control 1 - pHalData->PHYRegDef[RF_PATH_A].rfAGCControl1 = rOFDM0_XAAGCCore1; - pHalData->PHYRegDef[RF_PATH_B].rfAGCControl1 = rOFDM0_XBAGCCore1; - pHalData->PHYRegDef[RF_PATH_C].rfAGCControl1 = rOFDM0_XCAGCCore1; - pHalData->PHYRegDef[RF_PATH_D].rfAGCControl1 = rOFDM0_XDAGCCore1; - - // AGC control 2 - pHalData->PHYRegDef[RF_PATH_A].rfAGCControl2 = rOFDM0_XAAGCCore2; - pHalData->PHYRegDef[RF_PATH_B].rfAGCControl2 = rOFDM0_XBAGCCore2; - pHalData->PHYRegDef[RF_PATH_C].rfAGCControl2 = rOFDM0_XCAGCCore2; - pHalData->PHYRegDef[RF_PATH_D].rfAGCControl2 = rOFDM0_XDAGCCore2; - - // RX AFE control 1 - pHalData->PHYRegDef[RF_PATH_A].rfRxIQImbalance = rOFDM0_XARxIQImbalance; - pHalData->PHYRegDef[RF_PATH_B].rfRxIQImbalance = rOFDM0_XBRxIQImbalance; - pHalData->PHYRegDef[RF_PATH_C].rfRxIQImbalance = rOFDM0_XCRxIQImbalance; - pHalData->PHYRegDef[RF_PATH_D].rfRxIQImbalance = rOFDM0_XDRxIQImbalance; - - // RX AFE control 1 - pHalData->PHYRegDef[RF_PATH_A].rfRxAFE = rOFDM0_XARxAFE; - pHalData->PHYRegDef[RF_PATH_B].rfRxAFE = rOFDM0_XBRxAFE; - pHalData->PHYRegDef[RF_PATH_C].rfRxAFE = rOFDM0_XCRxAFE; - pHalData->PHYRegDef[RF_PATH_D].rfRxAFE = rOFDM0_XDRxAFE; - - // Tx AFE control 1 - pHalData->PHYRegDef[RF_PATH_A].rfTxIQImbalance = rOFDM0_XATxIQImbalance; - pHalData->PHYRegDef[RF_PATH_B].rfTxIQImbalance = rOFDM0_XBTxIQImbalance; - pHalData->PHYRegDef[RF_PATH_C].rfTxIQImbalance = rOFDM0_XCTxIQImbalance; - pHalData->PHYRegDef[RF_PATH_D].rfTxIQImbalance = rOFDM0_XDTxIQImbalance; - - // Tx AFE control 2 - pHalData->PHYRegDef[RF_PATH_A].rfTxAFE = rOFDM0_XATxAFE; - pHalData->PHYRegDef[RF_PATH_B].rfTxAFE = rOFDM0_XBTxAFE; - pHalData->PHYRegDef[RF_PATH_C].rfTxAFE = rOFDM0_XCTxAFE; - pHalData->PHYRegDef[RF_PATH_D].rfTxAFE = rOFDM0_XDTxAFE; - - // Tranceiver LSSI Readback SI mode - pHalData->PHYRegDef[RF_PATH_A].rfLSSIReadBack = rFPGA0_XA_LSSIReadBack; - pHalData->PHYRegDef[RF_PATH_B].rfLSSIReadBack = rFPGA0_XB_LSSIReadBack; - pHalData->PHYRegDef[RF_PATH_C].rfLSSIReadBack = rFPGA0_XC_LSSIReadBack; - pHalData->PHYRegDef[RF_PATH_D].rfLSSIReadBack = rFPGA0_XD_LSSIReadBack; - - // Tranceiver LSSI Readback PI mode - pHalData->PHYRegDef[RF_PATH_A].rfLSSIReadBackPi = TransceiverA_HSPI_Readback; - pHalData->PHYRegDef[RF_PATH_B].rfLSSIReadBackPi = TransceiverB_HSPI_Readback; - //pHalData->PHYRegDef[RF_PATH_C].rfLSSIReadBackPi = rFPGA0_XC_LSSIReadBack; - //pHalData->PHYRegDef[RF_PATH_D].rfLSSIReadBackPi = rFPGA0_XD_LSSIReadBack; - -} - - -/*----------------------------------------------------------------------------- - * Function: phy_ConfigBBWithParaFile() - * - * Overview: This function read BB parameters from general file format, and do register - * Read/Write - * - * Input: struct adapter * Adapter - * ps1Byte pFileName - * - * Output: NONE - * - * Return: RT_STATUS_SUCCESS: configuration file exist - * 2008/11/06 MH For 92S we do not support silent reset now. Disable - * parameter file compare!!!!!!?? - * - *---------------------------------------------------------------------------*/ -static int -phy_ConfigBBWithParaFile( - IN struct adapter * Adapter, - IN u8* pFileName -) -{ - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); - - int rtStatus = _SUCCESS; - - return rtStatus; -} - - - -//**************************************** -// The following is for High Power PA -//**************************************** -VOID -phy_ConfigBBExternalPA( - IN struct adapter * Adapter -) -{ -#ifdef CONFIG_USB_HCI - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); - u16 i=0; - u32 temp=0; - - if(!pHalData->ExternalPA) - { - return; - } - - // 2010/10/19 MH According to Jenyu/EEChou 's opinion, we need not to execute the - // same code as SU. It is already updated in PHY_REG_1T_HP.txt. -#if 0 - PHY_SetBBReg(Adapter, 0xee8, BIT28, 1); - temp = PHY_QueryBBReg(Adapter, 0x860, bMaskDWord); - temp |= (BIT26|BIT21|BIT10|BIT5); - PHY_SetBBReg(Adapter, 0x860, bMaskDWord, temp); - PHY_SetBBReg(Adapter, 0x870, BIT10, 0); - PHY_SetBBReg(Adapter, 0xc80, bMaskDWord, 0x20000080); - PHY_SetBBReg(Adapter, 0xc88, bMaskDWord, 0x40000100); -#endif - -#endif -} - -/*----------------------------------------------------------------------------- - * Function: phy_ConfigBBWithHeaderFile() - * - * Overview: This function read BB parameters from general file format, and do register - * Read/Write - * - * Input: struct adapter * Adapter - * u1Byte ConfigType 0 => PHY_CONFIG - * 1 =>AGC_TAB - * - * Output: NONE - * - * Return: RT_STATUS_SUCCESS: configuration file exist - * - *---------------------------------------------------------------------------*/ -#ifndef CONFIG_PHY_SETTING_WITH_ODM -static int -phy_ConfigBBWithHeaderFile( - IN struct adapter * Adapter, - IN u8 ConfigType -) -{ - int i; - u32* Rtl819XPHY_REGArray_Table; - u32* Rtl819XAGCTAB_Array_Table; - u16 PHY_REGArrayLen, AGCTAB_ArrayLen; - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); - DM_ODM_T *podmpriv = &pHalData->odmpriv; - int ret = _SUCCESS; - - - AGCTAB_ArrayLen = Rtl8188E_AGCTAB_1TArrayLength; - Rtl819XAGCTAB_Array_Table = (u32*)Rtl8188E_AGCTAB_1TArray; - PHY_REGArrayLen = Rtl8188E_PHY_REG_1TArrayLength; - Rtl819XPHY_REGArray_Table = (u32*)Rtl8188E_PHY_REG_1TArray; -// RT_TRACE(COMP_INIT, DBG_LOUD, (" ===> phy_ConfigBBWithHeaderFile() phy:Rtl8188EAGCTAB_1TArray\n")); -// RT_TRACE(COMP_INIT, DBG_LOUD, (" ===> phy_ConfigBBWithHeaderFile() agc:Rtl8188EPHY_REG_1TArray\n")); - - if(ConfigType == CONFIG_BB_PHY_REG) - { - #ifdef CONFIG_IOL_BB_PHY_REG - { - struct xmit_frame *xmit_frame; - u32 tmp_value; - - if((xmit_frame=rtw_IOL_accquire_xmit_frame(Adapter)) == NULL) { - ret = _FAIL; - goto exit; - } - - for(i=0;iRFCalibrateInfo.RegA24 = Rtl819XPHY_REGArray_Table[i+1]; - - rtw_IOL_append_WD_cmd(xmit_frame, Rtl819XPHY_REGArray_Table[i], tmp_value); - //RT_TRACE(COMP_INIT, DBG_TRACE, ("The Rtl819XPHY_REGArray_Table[0] is %lx Rtl819XPHY_REGArray[1] is %lx \n",Rtl819XPHY_REGArray_Table[i], Rtl819XPHY_REGArray_Table[i+1])); - } - - ret = rtw_IOL_exec_cmds_sync(Adapter, xmit_frame, 1000,0); - } - #else - for(i=0;iRFCalibrateInfo.RegA24 = Rtl819XPHY_REGArray_Table[i+1]; - - PHY_SetBBReg(Adapter, Rtl819XPHY_REGArray_Table[i], bMaskDWord, Rtl819XPHY_REGArray_Table[i+1]); - - // Add 1us delay between BB/RF register setting. - rtw_udelay_os(1); - - //RT_TRACE(COMP_INIT, DBG_TRACE, ("The Rtl819XPHY_REGArray_Table[0] is %lx Rtl819XPHY_REGArray[1] is %lx \n",Rtl819XPHY_REGArray_Table[i], Rtl819XPHY_REGArray_Table[i+1])); - } - #endif - // for External PA - phy_ConfigBBExternalPA(Adapter); - } - else if(ConfigType == CONFIG_BB_AGC_TAB) - { - #ifdef CONFIG_IOL_BB_AGC_TAB - { - struct xmit_frame *xmit_frame; - - if((xmit_frame=rtw_IOL_accquire_xmit_frame(Adapter)) == NULL) { - ret = _FAIL; - goto exit; - } - - for(i=0;iMCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][0] = Data; - //printk("MCSTxPowerLevelOriginalOffset[%d][0]-TxAGC_A_Rate18_06 = 0x%x\n", pHalData->pwrGroupCnt, - // pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][0]); - } - if(RegAddr == rTxAGC_A_Rate54_24) - { - pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][1] = Data; - //printk("MCSTxPowerLevelOriginalOffset[%d][1]-TxAGC_A_Rate54_24 = 0x%x\n", pHalData->pwrGroupCnt, - // pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][1]); - } - if(RegAddr == rTxAGC_A_CCK1_Mcs32) - { - pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][6] = Data; - //printk("MCSTxPowerLevelOriginalOffset[%d][6]-TxAGC_A_CCK1_Mcs32 = 0x%x\n", pHalData->pwrGroupCnt, - // pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][6]); - } - if(RegAddr == rTxAGC_B_CCK11_A_CCK2_11 && BitMask == 0xffffff00) - { - pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][7] = Data; - //printk("MCSTxPowerLevelOriginalOffset[%d][7]-TxAGC_B_CCK11_A_CCK2_11 = 0x%x\n", pHalData->pwrGroupCnt, - // pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][7]); - } - if(RegAddr == rTxAGC_A_Mcs03_Mcs00) - { - pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][2] = Data; - //printk("MCSTxPowerLevelOriginalOffset[%d][2]-TxAGC_A_Mcs03_Mcs00 = 0x%x\n", pHalData->pwrGroupCnt, - // pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][2]); - } - if(RegAddr == rTxAGC_A_Mcs07_Mcs04) - { - pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][3] = Data; - //printk("MCSTxPowerLevelOriginalOffset[%d][3]-TxAGC_A_Mcs07_Mcs04 = 0x%x\n", pHalData->pwrGroupCnt, - // pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][3]); - } - if(RegAddr == rTxAGC_A_Mcs11_Mcs08) - { - pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][4] = Data; - //printk("MCSTxPowerLevelOriginalOffset[%d][4]-TxAGC_A_Mcs11_Mcs08 = 0x%x\n", pHalData->pwrGroupCnt, - // pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][4]); - } - if(RegAddr == rTxAGC_A_Mcs15_Mcs12) - { - pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][5] = Data; - //printk("MCSTxPowerLevelOriginalOffset[%d][5]-TxAGC_A_Mcs15_Mcs12 = 0x%x\n", pHalData->pwrGroupCnt,pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][5]); - if(pHalData->rf_type== RF_1T1R) - { - //printk("pwrGroupCnt = %d\n", pHalData->pwrGroupCnt); - pHalData->pwrGroupCnt++; - } - } - if(RegAddr == rTxAGC_B_Rate18_06) - { - pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][8] = Data; - //printk("MCSTxPowerLevelOriginalOffset[%d][8]-TxAGC_B_Rate18_06 = 0x%x\n", pHalData->pwrGroupCnt, - // pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][8]); - } - if(RegAddr == rTxAGC_B_Rate54_24) - { - pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][9] = Data; - //printk("MCSTxPowerLevelOriginalOffset[%d][9]-TxAGC_B_Rate54_24 = 0x%x\n", pHalData->pwrGroupCnt, - // pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][9]); - } - if(RegAddr == rTxAGC_B_CCK1_55_Mcs32) - { - pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][14] = Data; - //printk("MCSTxPowerLevelOriginalOffset[%d][14]-TxAGC_B_CCK1_55_Mcs32 = 0x%x\n", pHalData->pwrGroupCnt, - // pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][14]); - } - if(RegAddr == rTxAGC_B_CCK11_A_CCK2_11 && BitMask == 0x000000ff) - { - pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][15] = Data; - //printk("MCSTxPowerLevelOriginalOffset[%d][15]-TxAGC_B_CCK11_A_CCK2_11 = 0x%x\n", pHalData->pwrGroupCnt, - // pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][15]); - } - if(RegAddr == rTxAGC_B_Mcs03_Mcs00) - { - pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][10] = Data; - //printk("MCSTxPowerLevelOriginalOffset[%d][10]-TxAGC_B_Mcs03_Mcs00 = 0x%x\n", pHalData->pwrGroupCnt, - // pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][10]); - } - if(RegAddr == rTxAGC_B_Mcs07_Mcs04) - { - pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][11] = Data; - //printk("MCSTxPowerLevelOriginalOffset[%d][11]-TxAGC_B_Mcs07_Mcs04 = 0x%x\n", pHalData->pwrGroupCnt, - // pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][11]); - } - if(RegAddr == rTxAGC_B_Mcs11_Mcs08) - { - pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][12] = Data; - //printk("MCSTxPowerLevelOriginalOffset[%d][12]-TxAGC_B_Mcs11_Mcs08 = 0x%x\n", pHalData->pwrGroupCnt, - // pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][12]); - } - if(RegAddr == rTxAGC_B_Mcs15_Mcs12) - { - pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][13] = Data; - //printk("MCSTxPowerLevelOriginalOffset[%d][13]-TxAGC_B_Mcs15_Mcs12 = 0x%x\n", pHalData->pwrGroupCnt, - // pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][13]); - - if(pHalData->rf_type != RF_1T1R) - { - //printk("pwrGroupCnt = %d\n", pHalData->pwrGroupCnt); - pHalData->pwrGroupCnt++; - } - } -} -/*----------------------------------------------------------------------------- - * Function: phy_ConfigBBWithPgParaFile - * - * Overview: - * - * Input: NONE - * - * Output: NONE - * - * Return: NONE - * - * Revised History: - * When Who Remark - * 11/06/2008 MHC Create Version 0. - * 2009/07/29 tynli (porting from 92SE branch)2009/03/11 Add copy parameter file to buffer for silent reset - *---------------------------------------------------------------------------*/ -static int -phy_ConfigBBWithPgParaFile( - IN struct adapter * Adapter, - IN u8* pFileName) -{ - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); - - int rtStatus = _SUCCESS; - - - return rtStatus; - -} /* phy_ConfigBBWithPgParaFile */ - -#ifndef CONFIG_PHY_SETTING_WITH_ODM -/*----------------------------------------------------------------------------- - * Function: phy_ConfigBBWithPgHeaderFile - * - * Overview: Config PHY_REG_PG array - * - * Input: NONE - * - * Output: NONE - * - * Return: NONE - * - * Revised History: - * When Who Remark - * 11/06/2008 MHC Add later!!!!!!.. Please modify for new files!!!! - * 11/10/2008 tynli Modify to mew files. - *---------------------------------------------------------------------------*/ -static int -phy_ConfigBBWithPgHeaderFile( - IN struct adapter * Adapter, - IN u8 ConfigType) -{ - int i; - u32* Rtl819XPHY_REGArray_Table_PG; - u16 PHY_REGArrayPGLen; - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); - - - PHY_REGArrayPGLen = Rtl8188E_PHY_REG_Array_PGLength; - Rtl819XPHY_REGArray_Table_PG = (u32*)Rtl8188E_PHY_REG_Array_PG; - - if(ConfigType == CONFIG_BB_PHY_REG) - { - for(i=0;iphy_BB8192S_Config_ParaFile\n")); - - pszBBRegFile = sz8188EBBRegFile ; - pszAGCTableFile = sz8188EAGCTableFile; - pszBBRegPgFile = sz8188EBBRegPgFile; - pszBBRegMpFile = sz8188EBBRegMpFile; - - // - // 1. Read PHY_REG.TXT BB INIT!! - // We will seperate as 88C / 92C according to chip version - // -#ifdef CONFIG_EMBEDDED_FWIMG - #ifdef CONFIG_PHY_SETTING_WITH_ODM - if(HAL_STATUS_FAILURE ==ODM_ConfigBBWithHeaderFile(&pHalData->odmpriv, CONFIG_BB_PHY_REG)) - rtStatus = _FAIL; - #else - rtStatus = phy_ConfigBBWithHeaderFile(Adapter, CONFIG_BB_PHY_REG); - #endif//#ifdef CONFIG_PHY_SETTING_WITH_ODM -#else - // No matter what kind of CHIP we always read PHY_REG.txt. We must copy different - // type of parameter files to phy_reg.txt at first. - rtStatus = phy_ConfigBBWithParaFile(Adapter,pszBBRegFile); -#endif//#ifdef CONFIG_EMBEDDED_FWIMG - - if(rtStatus != _SUCCESS){ - //RT_TRACE(COMP_INIT, DBG_SERIOUS, ("phy_BB8192S_Config_ParaFile():Write BB Reg Fail!!")); - goto phy_BB8190_Config_ParaFile_Fail; - } - - // - // 20100318 Joseph: Config 2T2R to 1T2R if necessary. - // - //if(pHalData->rf_type == RF_1T2R) - //{ - //phy_BB8192C_Config_1T(Adapter); - //DBG_8192C("phy_BB8188E_Config_ParaFile():Config to 1T!!\n"); - //} - - // - // 2. If EEPROM or EFUSE autoload OK, We must config by PHY_REG_PG.txt - // - if (pEEPROM->bautoload_fail_flag == _FALSE) - { - pHalData->pwrGroupCnt = 0; - -#ifdef CONFIG_EMBEDDED_FWIMG - #ifdef CONFIG_PHY_SETTING_WITH_ODM - if(HAL_STATUS_FAILURE ==ODM_ConfigBBWithHeaderFile(&pHalData->odmpriv, CONFIG_BB_PHY_REG_PG)) - rtStatus = _FAIL; - #else - rtStatus = phy_ConfigBBWithPgHeaderFile(Adapter, CONFIG_BB_PHY_REG_PG); - #endif -#else - rtStatus = phy_ConfigBBWithPgParaFile(Adapter, pszBBRegPgFile); -#endif - } - - if(rtStatus != _SUCCESS){ - //RT_TRACE(COMP_INIT, DBG_SERIOUS, ("phy_BB8192S_Config_ParaFile():BB_PG Reg Fail!!")); - goto phy_BB8190_Config_ParaFile_Fail; - } - - // - // 3. BB AGC table Initialization - // -#ifdef CONFIG_EMBEDDED_FWIMG - #ifdef CONFIG_PHY_SETTING_WITH_ODM - if(HAL_STATUS_FAILURE ==ODM_ConfigBBWithHeaderFile(&pHalData->odmpriv, CONFIG_BB_AGC_TAB)) - rtStatus = _FAIL; - #else - rtStatus = phy_ConfigBBWithHeaderFile(Adapter, CONFIG_BB_AGC_TAB); - #endif//#ifdef CONFIG_PHY_SETTING_WITH_ODM -#else - //RT_TRACE(COMP_INIT, DBG_LOUD, ("phy_BB8192S_Config_ParaFile AGC_TAB.txt\n")); - rtStatus = phy_ConfigBBWithParaFile(Adapter, pszAGCTableFile); -#endif//#ifdef CONFIG_EMBEDDED_FWIMG - - if(rtStatus != _SUCCESS){ - //RT_TRACE(COMP_FPGA, DBG_SERIOUS, ("phy_BB8192S_Config_ParaFile():AGC Table Fail\n")); - goto phy_BB8190_Config_ParaFile_Fail; - } - - -phy_BB8190_Config_ParaFile_Fail: - - return rtStatus; -} - - -int -PHY_BBConfig8188E( - IN struct adapter *Adapter - ) -{ - int rtStatus = _SUCCESS; - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); - u32 RegVal; - u8 TmpU1B=0; - u8 value8,CrystalCap; - - phy_InitBBRFRegisterDefinition(Adapter); - - - // Enable BB and RF - RegVal = rtw_read16(Adapter, REG_SYS_FUNC_EN); - rtw_write16(Adapter, REG_SYS_FUNC_EN, (u16)(RegVal|BIT13|BIT0|BIT1)); - - // 20090923 Joseph: Advised by Steven and Jenyu. Power sequence before init RF. - //rtw_write8(Adapter, REG_AFE_PLL_CTRL, 0x83); - //rtw_write8(Adapter, REG_AFE_PLL_CTRL+1, 0xdb); - - rtw_write8(Adapter, REG_RF_CTRL, RF_EN|RF_RSTB|RF_SDMRSTB); - -#ifdef CONFIG_USB_HCI - rtw_write8(Adapter, REG_SYS_FUNC_EN, FEN_USBA | FEN_USBD | FEN_BB_GLB_RSTn | FEN_BBRSTB); -#else - rtw_write8(Adapter, REG_SYS_FUNC_EN, FEN_PPLL|FEN_PCIEA|FEN_DIO_PCIE|FEN_BB_GLB_RSTn|FEN_BBRSTB); -#endif - -#if 0 -#ifdef CONFIG_USB_HCI - //To Fix MAC loopback mode fail. Suggested by SD4 Johnny. 2010.03.23. - rtw_write8(Adapter, REG_LDOHCI12_CTRL, 0x0f); - rtw_write8(Adapter, 0x15, 0xe9); -#endif - - rtw_write8(Adapter, REG_AFE_XTAL_CTRL+1, 0x80); -#endif - -#ifdef CONFIG_USB_HCI - //rtw_write8(Adapter, 0x15, 0xe9); -#endif - - -#ifdef CONFIG_PCI_HCI - // Force use left antenna by default for 88C. - // if(!IS_92C_SERIAL(pHalData->VersionID) || IS_92C_1T2R(pHalData->VersionID)) - if(Adapter->ledpriv.LedStrategy != SW_LED_MODE10) - { - RegVal = rtw_read32(Adapter, REG_LEDCFG0); - rtw_write32(Adapter, REG_LEDCFG0, RegVal|BIT23); - } -#endif - - // - // Config BB and AGC - // - rtStatus = phy_BB8188E_Config_ParaFile(Adapter); - - // write 0x24[16:11] = 0x24[22:17] = CrystalCap - CrystalCap = pHalData->CrystalCap & 0x3F; - PHY_SetBBReg(Adapter, REG_AFE_XTAL_CTRL, 0x7ff800, (CrystalCap | (CrystalCap << 6))); - - return rtStatus; - -} - - -int -PHY_RFConfig8188E( - IN struct adapter *Adapter - ) -{ - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); - int rtStatus = _SUCCESS; - - // - // RF config - // - rtStatus = PHY_RF6052_Config8188E(Adapter); -#if 0 - switch(pHalData->rf_chip) - { - case RF_6052: - rtStatus = PHY_RF6052_Config(Adapter); - break; - case RF_8225: - rtStatus = PHY_RF8225_Config(Adapter); - break; - case RF_8256: - rtStatus = PHY_RF8256_Config(Adapter); - break; - case RF_8258: - break; - case RF_PSEUDO_11N: - rtStatus = PHY_RF8225_Config(Adapter); - break; - default: //for MacOs Warning: "RF_TYPE_MIN" not handled in switch - break; - } -#endif - return rtStatus; -} - - -/*----------------------------------------------------------------------------- - * Function: PHY_ConfigRFWithParaFile() - * - * Overview: This function read RF parameters from general file format, and do RF 3-wire - * - * Input: struct adapter * Adapter - * ps1Byte pFileName - * RF_RADIO_PATH_E eRFPath - * - * Output: NONE - * - * Return: RT_STATUS_SUCCESS: configuration file exist - * - * Note: Delay may be required for RF configuration - *---------------------------------------------------------------------------*/ -int -rtl8188e_PHY_ConfigRFWithParaFile( - IN struct adapter * Adapter, - IN u8* pFileName, - RF_RADIO_PATH_E eRFPath -) -{ - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); - - int rtStatus = _SUCCESS; - - - return rtStatus; - -} - -//**************************************** -// The following is for High Power PA -//**************************************** -#define HighPowerRadioAArrayLen 22 -//This is for High power PA -u32 Rtl8192S_HighPower_RadioA_Array[HighPowerRadioAArrayLen] = { -0x013,0x00029ea4, -0x013,0x00025e74, -0x013,0x00020ea4, -0x013,0x0001ced0, -0x013,0x00019f40, -0x013,0x00014e70, -0x013,0x000106a0, -0x013,0x0000c670, -0x013,0x000082a0, -0x013,0x00004270, -0x013,0x00000240, -}; - -int -PHY_ConfigRFExternalPA( - IN struct adapter * Adapter, - RF_RADIO_PATH_E eRFPath -) -{ - int rtStatus = _SUCCESS; -#ifdef CONFIG_USB_HCI - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); - u16 i=0; - - if(!pHalData->ExternalPA) - { - return rtStatus; - } - - // 2010/10/19 MH According to Jenyu/EEChou 's opinion, we need not to execute the - // same code as SU. It is already updated in radio_a_1T_HP.txt. -#if 0 - //add for SU High Power PA - for(i = 0;i PHY_ConfigRFWithHeaderFile() Radio_A:Rtl8188ERadioA_1TArray\n")); -// RT_TRACE(COMP_INIT, DBG_LOUD, (" ===> PHY_ConfigRFWithHeaderFile() Radio_B:Rtl8188ERadioB_1TArray\n")); - - switch (eRFPath) - { - case RF_PATH_A: - #ifdef CONFIG_IOL_RF_RF_PATH_A - { - struct xmit_frame *xmit_frame; - if((xmit_frame=rtw_IOL_accquire_xmit_frame(Adapter)) == NULL) { - rtStatus = _FAIL; - goto exit; - } - - for(i = 0;iPHYRegDef[eRFPath]; - u32 NewOffset = 0; - u32 DataAndAddr = 0; - - NewOffset = Rtl819XRadioA_Array_Table[i] & 0x3f; - DataAndAddr = ((NewOffset<<20) | (Rtl819XRadioA_Array_Table[i+1]&0x000fffff)) & 0x0fffffff; // T65 RF - rtw_IOL_append_WD_cmd(xmit_frame, pPhyReg->rf3wireOffset, DataAndAddr); - } - } - rtStatus = rtw_IOL_exec_cmds_sync(Adapter, xmit_frame, 1000,0); - } - #else - for(i = 0;iPHYRegDef[eRFPath]; - u32 NewOffset = 0; - u32 DataAndAddr = 0; - - NewOffset = Rtl819XRadioB_Array_Table[i] & 0x3f; - DataAndAddr = ((NewOffset<<20) | (Rtl819XRadioB_Array_Table[i+1]&0x000fffff)) & 0x0fffffff; // T65 RF - rtw_IOL_append_WD_cmd(xmit_frame, pPhyReg->rf3wireOffset, DataAndAddr); - } - } - rtStatus = rtw_IOL_exec_cmds_sync(Adapter, xmit_frame, 1000,0); - } - #else - for(i = 0;i actually we call PlatformStallExecution()) to do NdisStallExecution() - // [busy wait] instead of NdisMSleep(). So we acquire RT_INITIAL_SPINLOCK - // to run at Dispatch level to achive it. - //cosa PlatformAcquireSpinLock(Adapter, RT_INITIAL_SPINLOCK); - WriteData[i] &= 0xfff; - PHY_SetRFReg(Adapter, eRFPath, WriteAddr[HW90_BLOCK_RF], bRFRegOffsetMask, WriteData[i]); - // TODO: we should not delay for such a long time. Ask SD3 - rtw_mdelay_os(10); - ulRegRead = PHY_QueryRFReg(Adapter, eRFPath, WriteAddr[HW90_BLOCK_RF], bMaskDWord); - rtw_mdelay_os(10); - //cosa PlatformReleaseSpinLock(Adapter, RT_INITIAL_SPINLOCK); - break; - - default: - rtStatus = _FAIL; - break; - } - - - // - // Check whether readback data is correct - // - if(ulRegRead != WriteData[i]) - { - //RT_TRACE(COMP_FPGA, DBG_LOUD, ("ulRegRead: %lx, WriteData: %lx \n", ulRegRead, WriteData[i])); - rtStatus = _FAIL; - break; - } - } - - return rtStatus; -} - - -VOID -rtl8192c_PHY_GetHWRegOriginalValue( - IN struct adapter * Adapter - ) -{ - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); - - // read rx initial gain - pHalData->DefaultInitialGain[0] = (u8)PHY_QueryBBReg(Adapter, rOFDM0_XAAGCCore1, bMaskByte0); - pHalData->DefaultInitialGain[1] = (u8)PHY_QueryBBReg(Adapter, rOFDM0_XBAGCCore1, bMaskByte0); - pHalData->DefaultInitialGain[2] = (u8)PHY_QueryBBReg(Adapter, rOFDM0_XCAGCCore1, bMaskByte0); - pHalData->DefaultInitialGain[3] = (u8)PHY_QueryBBReg(Adapter, rOFDM0_XDAGCCore1, bMaskByte0); - //RT_TRACE(COMP_INIT, DBG_LOUD, - //("Default initial gain (c50=0x%x, c58=0x%x, c60=0x%x, c68=0x%x) \n", - //pHalData->DefaultInitialGain[0], pHalData->DefaultInitialGain[1], - //pHalData->DefaultInitialGain[2], pHalData->DefaultInitialGain[3])); - - // read framesync - pHalData->framesync = (u8)PHY_QueryBBReg(Adapter, rOFDM0_RxDetector3, bMaskByte0); - pHalData->framesyncC34 = PHY_QueryBBReg(Adapter, rOFDM0_RxDetector2, bMaskDWord); - //RT_TRACE(COMP_INIT, DBG_LOUD, ("Default framesync (0x%x) = 0x%x \n", - // rOFDM0_RxDetector3, pHalData->framesync)); -} - - -// -// Description: -// Map dBm into Tx power index according to -// current HW model, for example, RF and PA, and -// current wireless mode. -// By Bruce, 2008-01-29. -// -static u8 -phy_DbmToTxPwrIdx( - IN struct adapter * Adapter, - IN WIRELESS_MODE WirelessMode, - IN int PowerInDbm - ) -{ - u8 TxPwrIdx = 0; - int Offset = 0; - - - // - // Tested by MP, we found that CCK Index 0 equals to 8dbm, OFDM legacy equals to - // 3dbm, and OFDM HT equals to 0dbm repectively. - // Note: - // The mapping may be different by different NICs. Do not use this formula for what needs accurate result. - // By Bruce, 2008-01-29. - // - switch(WirelessMode) - { - case WIRELESS_MODE_B: - Offset = -7; - break; - - case WIRELESS_MODE_G: - case WIRELESS_MODE_N_24G: - Offset = -8; - break; - default: - Offset = -8; - break; - } - - if((PowerInDbm - Offset) > 0) - { - TxPwrIdx = (u8)((PowerInDbm - Offset) * 2); - } - else - { - TxPwrIdx = 0; - } - - // Tx Power Index is too large. - if(TxPwrIdx > MAX_TXPWR_IDX_NMODE_92S) - TxPwrIdx = MAX_TXPWR_IDX_NMODE_92S; - - return TxPwrIdx; -} - -// -// Description: -// Map Tx power index into dBm according to -// current HW model, for example, RF and PA, and -// current wireless mode. -// By Bruce, 2008-01-29. -// -int -phy_TxPwrIdxToDbm( - IN struct adapter * Adapter, - IN WIRELESS_MODE WirelessMode, - IN u8 TxPwrIdx - ) -{ - int Offset = 0; - int PwrOutDbm = 0; - - // - // Tested by MP, we found that CCK Index 0 equals to -7dbm, OFDM legacy equals to -8dbm. - // Note: - // The mapping may be different by different NICs. Do not use this formula for what needs accurate result. - // By Bruce, 2008-01-29. - // - switch(WirelessMode) - { - case WIRELESS_MODE_B: - Offset = -7; - break; - - case WIRELESS_MODE_G: - case WIRELESS_MODE_N_24G: - Offset = -8; - default: - Offset = -8; - break; - } - - PwrOutDbm = TxPwrIdx / 2 + Offset; // Discard the decimal part. - - return PwrOutDbm; -} - - -/*----------------------------------------------------------------------------- - * Function: GetTxPowerLevel8190() - * - * Overview: This function is export to "common" moudule - * - * Input: struct adapter * Adapter - * psByte Power Level - * - * Output: NONE - * - * Return: NONE - * - *---------------------------------------------------------------------------*/ -VOID -PHY_GetTxPowerLevel8188E( - IN struct adapter * Adapter, - OUT u32* powerlevel - ) -{ - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); - u8 TxPwrLevel = 0; - int TxPwrDbm; - - // - // Because the Tx power indexes are different, we report the maximum of them to - // meet the CCX TPC request. By Bruce, 2008-01-31. - // - - // CCK - TxPwrLevel = pHalData->CurrentCckTxPwrIdx; - TxPwrDbm = phy_TxPwrIdxToDbm(Adapter, WIRELESS_MODE_B, TxPwrLevel); - - // Legacy OFDM - TxPwrLevel = pHalData->CurrentOfdm24GTxPwrIdx + pHalData->LegacyHTTxPowerDiff; - - // Compare with Legacy OFDM Tx power. - if(phy_TxPwrIdxToDbm(Adapter, WIRELESS_MODE_G, TxPwrLevel) > TxPwrDbm) - TxPwrDbm = phy_TxPwrIdxToDbm(Adapter, WIRELESS_MODE_G, TxPwrLevel); - - // HT OFDM - TxPwrLevel = pHalData->CurrentOfdm24GTxPwrIdx; - - // Compare with HT OFDM Tx power. - if(phy_TxPwrIdxToDbm(Adapter, WIRELESS_MODE_N_24G, TxPwrLevel) > TxPwrDbm) - TxPwrDbm = phy_TxPwrIdxToDbm(Adapter, WIRELESS_MODE_N_24G, TxPwrLevel); - - *powerlevel = TxPwrDbm; -} - -#if 0 -static void getTxPowerIndex( - IN struct adapter * Adapter, - IN u8 channel, - IN OUT u8* cckPowerLevel, - IN OUT u8* ofdmPowerLevel - ) -{ - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); - u8 index = (channel -1); - // 1. CCK - cckPowerLevel[RF_PATH_A] = pHalData->TxPwrLevelCck[RF_PATH_A][index]; //RF-A - cckPowerLevel[RF_PATH_B] = pHalData->TxPwrLevelCck[RF_PATH_B][index]; //RF-B - - // 2. OFDM for 1S or 2S - if (GET_RF_TYPE(Adapter) == RF_1T2R || GET_RF_TYPE(Adapter) == RF_1T1R) - { - // Read HT 40 OFDM TX power - ofdmPowerLevel[RF_PATH_A] = pHalData->TxPwrLevelHT40_1S[RF_PATH_A][index]; - ofdmPowerLevel[RF_PATH_B] = pHalData->TxPwrLevelHT40_1S[RF_PATH_B][index]; - } - else if (GET_RF_TYPE(Adapter) == RF_2T2R) - { - // Read HT 40 OFDM TX power - ofdmPowerLevel[RF_PATH_A] = pHalData->TxPwrLevelHT40_2S[RF_PATH_A][index]; - ofdmPowerLevel[RF_PATH_B] = pHalData->TxPwrLevelHT40_2S[RF_PATH_B][index]; - } - //RTPRINT(FPHY, PHY_TXPWR, ("Channel-%d, set tx power index !!\n", channel)); -} -#endif - -void getTxPowerIndex88E( - IN struct adapter * Adapter, - IN u8 channel, - IN OUT u8* cckPowerLevel, - IN OUT u8* ofdmPowerLevel, - IN OUT u8* BW20PowerLevel, - IN OUT u8* BW40PowerLevel - ) -{ - - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); - u8 index = (channel -1); - u8 TxCount=0,path_nums; - - - if((RF_1T2R == pHalData->rf_type) ||(RF_1T1R ==pHalData->rf_type )) - path_nums = 1; - else - path_nums = 2; - - for(TxCount=0;TxCount< path_nums ;TxCount++) - { - if(TxCount==RF_PATH_A) - { - // 1. CCK - cckPowerLevel[TxCount] = pHalData->Index24G_CCK_Base[TxCount][index]; - //2. OFDM - ofdmPowerLevel[TxCount] = pHalData->Index24G_BW40_Base[RF_PATH_A][index]+ - pHalData->OFDM_24G_Diff[TxCount][RF_PATH_A]; - // 1. BW20 - BW20PowerLevel[TxCount] = pHalData->Index24G_BW40_Base[RF_PATH_A][index]+ - pHalData->BW20_24G_Diff[TxCount][RF_PATH_A]; - //2. BW40 - BW40PowerLevel[TxCount] = pHalData->Index24G_BW40_Base[TxCount][index]; - //RTPRINT(FPHY, PHY_TXPWR, ("getTxPowerIndex88E(): 40MBase=0x%x 20Mdiff=%d 20MBase=0x%x!!\n", - // pHalData->Index24G_BW40_Base[RF_PATH_A][index], - // pHalData->BW20_24G_Diff[TxCount][RF_PATH_A], - // BW20PowerLevel[TxCount])); - } - else if(TxCount==RF_PATH_B) - { - // 1. CCK - cckPowerLevel[TxCount] = pHalData->Index24G_CCK_Base[TxCount][index]; - //2. OFDM - ofdmPowerLevel[TxCount] = pHalData->Index24G_BW40_Base[RF_PATH_A][index]+ - pHalData->BW20_24G_Diff[RF_PATH_A][index]+ - pHalData->BW20_24G_Diff[TxCount][index]; - // 1. BW20 - BW20PowerLevel[TxCount] = pHalData->Index24G_BW40_Base[RF_PATH_A][index]+ - pHalData->BW20_24G_Diff[TxCount][RF_PATH_A]+ - pHalData->BW20_24G_Diff[TxCount][index]; - //2. BW40 - BW40PowerLevel[TxCount] = pHalData->Index24G_BW40_Base[TxCount][index]; - } - else if(TxCount==RF_PATH_C) - { - // 1. CCK - cckPowerLevel[TxCount] = pHalData->Index24G_CCK_Base[TxCount][index]; - //2. OFDM - ofdmPowerLevel[TxCount] = pHalData->Index24G_BW40_Base[RF_PATH_A][index]+ - pHalData->BW20_24G_Diff[RF_PATH_A][index]+ - pHalData->BW20_24G_Diff[RF_PATH_B][index]+ - pHalData->BW20_24G_Diff[TxCount][index]; - // 1. BW20 - BW20PowerLevel[TxCount] = pHalData->Index24G_BW40_Base[RF_PATH_A][index]+ - pHalData->BW20_24G_Diff[RF_PATH_A][index]+ - pHalData->BW20_24G_Diff[RF_PATH_B][index]+ - pHalData->BW20_24G_Diff[TxCount][index]; - //2. BW40 - BW40PowerLevel[TxCount] = pHalData->Index24G_BW40_Base[TxCount][index]; - } - else if(TxCount==RF_PATH_D) - { - // 1. CCK - cckPowerLevel[TxCount] = pHalData->Index24G_CCK_Base[TxCount][index]; - //2. OFDM - ofdmPowerLevel[TxCount] = pHalData->Index24G_BW40_Base[RF_PATH_A][index]+ - pHalData->BW20_24G_Diff[RF_PATH_A][index]+ - pHalData->BW20_24G_Diff[RF_PATH_B][index]+ - pHalData->BW20_24G_Diff[RF_PATH_C][index]+ - pHalData->BW20_24G_Diff[TxCount][index]; - - // 1. BW20 - BW20PowerLevel[TxCount] = pHalData->Index24G_BW40_Base[RF_PATH_A][index]+ - pHalData->BW20_24G_Diff[RF_PATH_A][index]+ - pHalData->BW20_24G_Diff[RF_PATH_B][index]+ - pHalData->BW20_24G_Diff[RF_PATH_C][index]+ - pHalData->BW20_24G_Diff[TxCount][index]; - - //2. BW40 - BW40PowerLevel[TxCount] = pHalData->Index24G_BW40_Base[TxCount][index]; - } - else - { - } - } - -#if 0 // (INTEL_PROXIMITY_SUPPORT == 1) - switch(pMgntInfo->IntelProximityModeInfo.PowerOutput){ - case 1: // 100% - break; - case 2: // 70% - cckPowerLevel[0] -= 3; - cckPowerLevel[1] -= 3; - ofdmPowerLevel[0] -=3; - ofdmPowerLevel[1] -= 3; - break; - case 3: // 50% - cckPowerLevel[0] -= 6; - cckPowerLevel[1] -= 6; - ofdmPowerLevel[0] -=6; - ofdmPowerLevel[1] -= 6; - break; - case 4: // 35% - cckPowerLevel[0] -= 9; - cckPowerLevel[1] -= 9; - ofdmPowerLevel[0] -=9; - ofdmPowerLevel[1] -= 9; - break; - case 5: // 15% - cckPowerLevel[0] -= 17; - cckPowerLevel[1] -= 17; - ofdmPowerLevel[0] -=17; - ofdmPowerLevel[1] -= 17; - break; - - default: - break; - } -#endif - //RTPRINT(FPHY, PHY_TXPWR, ("Channel-%d, set tx power index !!\n", channel)); -} - -void phy_PowerIndexCheck88E( - IN struct adapter *Adapter, - IN u8 channel, - IN OUT u8 * cckPowerLevel, - IN OUT u8 * ofdmPowerLevel, - IN OUT u8 * BW20PowerLevel, - IN OUT u8 * BW40PowerLevel - ) -{ - - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); -#if 0 // (CCX_SUPPORT == 1) - PMGNT_INFO pMgntInfo = &(Adapter->MgntInfo); - PRT_CCX_INFO pCcxInfo = GET_CCX_INFO(pMgntInfo); - - // - // CCX 2 S31, AP control of client transmit power: - // 1. We shall not exceed Cell Power Limit as possible as we can. - // 2. Tolerance is +/- 5dB. - // 3. 802.11h Power Contraint takes higher precedence over CCX Cell Power Limit. - // - // TODO: - // 1. 802.11h power contraint - // - // 071011, by rcnjko. - // - if( pMgntInfo->OpMode == RT_OP_MODE_INFRASTRUCTURE && - pMgntInfo->mAssoc && - pCcxInfo->bUpdateCcxPwr && - pCcxInfo->bWithCcxCellPwr && - channel == pMgntInfo->dot11CurrentChannelNumber) - { - u1Byte CckCellPwrIdx = phy_DbmToTxPwrIdx(Adapter, WIRELESS_MODE_B, pCcxInfo->CcxCellPwr); - u1Byte LegacyOfdmCellPwrIdx = phy_DbmToTxPwrIdx(Adapter, WIRELESS_MODE_G, pCcxInfo->CcxCellPwr); - u1Byte OfdmCellPwrIdx = phy_DbmToTxPwrIdx(Adapter, WIRELESS_MODE_N_24G, pCcxInfo->CcxCellPwr); - - RT_TRACE(COMP_TXAGC, DBG_LOUD, - ("CCX Cell Limit: %d dbm => CCK Tx power index : %d, Legacy OFDM Tx power index : %d, OFDM Tx power index: %d\n", - pCcxInfo->CcxCellPwr, CckCellPwrIdx, LegacyOfdmCellPwrIdx, OfdmCellPwrIdx)); - RT_TRACE(COMP_TXAGC, DBG_LOUD, - ("EEPROM channel(%d) => CCK Tx power index: %d, Legacy OFDM Tx power index : %d, OFDM Tx power index: %d\n", - channel, cckPowerLevel[0], ofdmPowerLevel[0] + pHalData->LegacyHTTxPowerDiff, ofdmPowerLevel[0])); - - // CCK - if(cckPowerLevel[0] > CckCellPwrIdx) - cckPowerLevel[0] = CckCellPwrIdx; - // Legacy OFDM, HT OFDM - if(ofdmPowerLevel[0] + pHalData->LegacyHTTxPowerDiff > LegacyOfdmCellPwrIdx) - { - if((OfdmCellPwrIdx - pHalData->LegacyHTTxPowerDiff) > 0) - { - ofdmPowerLevel[0] = OfdmCellPwrIdx - pHalData->LegacyHTTxPowerDiff; - } - else - { - ofdmPowerLevel[0] = 0; - } - } - - RT_TRACE(COMP_TXAGC, DBG_LOUD, - ("Altered CCK Tx power index : %d, Legacy OFDM Tx power index: %d, OFDM Tx power index: %d\n", - cckPowerLevel[0], ofdmPowerLevel[0] + pHalData->LegacyHTTxPowerDiff, ofdmPowerLevel[0])); - } -#else - // Add or not ??? -#endif - - pHalData->CurrentCckTxPwrIdx = cckPowerLevel[0]; - pHalData->CurrentOfdm24GTxPwrIdx = ofdmPowerLevel[0]; - pHalData->CurrentBW2024GTxPwrIdx = BW20PowerLevel[0]; - pHalData->CurrentBW4024GTxPwrIdx = BW40PowerLevel[0]; - - //DBG_871X("PHY_SetTxPowerLevel8188E(): CurrentCckTxPwrIdx : 0x%x,CurrentOfdm24GTxPwrIdx: 0x%x, CurrentBW2024GTxPwrIdx: 0x%dx, CurrentBW4024GTxPwrIdx: 0x%x \n", - // pHalData->CurrentCckTxPwrIdx, pHalData->CurrentOfdm24GTxPwrIdx, pHalData->CurrentBW2024GTxPwrIdx, pHalData->CurrentBW4024GTxPwrIdx); -} -/*----------------------------------------------------------------------------- - * Function: SetTxPowerLevel8190() - * - * Overview: This function is export to "HalCommon" moudule - * We must consider RF path later!!!!!!! - * - * Input: struct adapter * Adapter - * u1Byte channel - * - * Output: NONE - * - * Return: NONE - * 2008/11/04 MHC We remove EEPROM_93C56. - * We need to move CCX relative code to independet file. - * 2009/01/21 MHC Support new EEPROM format from SD3 requirement. - * - *---------------------------------------------------------------------------*/ -VOID -PHY_SetTxPowerLevel8188E( - IN struct adapter * Adapter, - IN u8 channel - ) -{ - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); - - u8 cckPowerLevel[MAX_TX_COUNT], ofdmPowerLevel[MAX_TX_COUNT];// [0]:RF-A, [1]:RF-B - u8 BW20PowerLevel[MAX_TX_COUNT], BW40PowerLevel[MAX_TX_COUNT]; - u8 i=0; -/* -#if(MP_DRIVER == 1) - if (Adapter->registrypriv.mp_mode == 1) - return; -#endif -*/ - //getTxPowerIndex(Adapter, channel, &cckPowerLevel[0], &ofdmPowerLevel[0]); - getTxPowerIndex88E(Adapter, channel, &cckPowerLevel[0], &ofdmPowerLevel[0],&BW20PowerLevel[0],&BW40PowerLevel[0]); - - //printk("Channel-%d, cckPowerLevel = 0x%x, ofdmPowerLeve = 0x%x, BW20PowerLevel = 0x%x, BW40PowerLevel = 0x%x,\n", - // channel, cckPowerLevel[0], ofdmPowerLevel[0], BW20PowerLevel[0] ,BW40PowerLevel[0]); - - //RTPRINT(FPHY, PHY_TXPWR, ("Channel-%d, cckPowerLevel (A / B) = 0x%x / 0x%x, ofdmPowerLevel (A / B) = 0x%x / 0x%x\n", - // channel, cckPowerLevel[0], cckPowerLevel[1], ofdmPowerLevel[0], ofdmPowerLevel[1])); - - //ccxPowerIndexCheck(Adapter, channel, &cckPowerLevel[0], &ofdmPowerLevel[0]); - phy_PowerIndexCheck88E(Adapter, channel, &cckPowerLevel[0], &ofdmPowerLevel[0],&BW20PowerLevel[0],&BW40PowerLevel[0]); - - rtl8188e_PHY_RF6052SetCckTxPower(Adapter, &cckPowerLevel[0]); - rtl8188e_PHY_RF6052SetOFDMTxPower(Adapter, &ofdmPowerLevel[0],&BW20PowerLevel[0],&BW40PowerLevel[0], channel); - -#if 0 - switch(pHalData->rf_chip) - { - case RF_8225: - PHY_SetRF8225CckTxPower(Adapter, cckPowerLevel[0]); - PHY_SetRF8225OfdmTxPower(Adapter, ofdmPowerLevel[0]); - break; - - case RF_8256: - PHY_SetRF8256CCKTxPower(Adapter, cckPowerLevel[0]); - PHY_SetRF8256OFDMTxPower(Adapter, ofdmPowerLevel[0]); - break; - - case RF_6052: - PHY_RF6052SetCckTxPower(Adapter, &cckPowerLevel[0]); - PHY_RF6052SetOFDMTxPower(Adapter, &ofdmPowerLevel[0], channel); - break; - - case RF_8258: - break; - } -#endif - -} - - -// -// Description: -// Update transmit power level of all channel supported. -// -// TODO: -// A mode. -// By Bruce, 2008-02-04. -// -BOOLEAN -PHY_UpdateTxPowerDbm8188E( - IN struct adapter *Adapter, - IN int powerInDbm - ) -{ - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); - u8 idx; - u8 rf_path; - - // TODO: A mode Tx power. - u8 CckTxPwrIdx = phy_DbmToTxPwrIdx(Adapter, WIRELESS_MODE_B, powerInDbm); - u8 OfdmTxPwrIdx = phy_DbmToTxPwrIdx(Adapter, WIRELESS_MODE_N_24G, powerInDbm); - - if(OfdmTxPwrIdx - pHalData->LegacyHTTxPowerDiff > 0) - OfdmTxPwrIdx -= pHalData->LegacyHTTxPowerDiff; - else - OfdmTxPwrIdx = 0; - - //RT_TRACE(COMP_TXAGC, DBG_LOUD, ("PHY_UpdateTxPowerDbm8192S(): %ld dBm , CckTxPwrIdx = %d, OfdmTxPwrIdx = %d\n", powerInDbm, CckTxPwrIdx, OfdmTxPwrIdx)); - - for(idx = 0; idx < 14; idx++) - { - for (rf_path = 0; rf_path < 2; rf_path++) - { - pHalData->TxPwrLevelCck[rf_path][idx] = CckTxPwrIdx; - pHalData->TxPwrLevelHT40_1S[rf_path][idx] = - pHalData->TxPwrLevelHT40_2S[rf_path][idx] = OfdmTxPwrIdx; - } - } - - //Adapter->HalFunc.SetTxPowerLevelHandler(Adapter, pHalData->CurrentChannel);//gtest:todo - - return _TRUE; -} - - -/* - Description: - When beacon interval is changed, the values of the - hw registers should be modified. - By tynli, 2008.10.24. - -*/ - - -void -rtl8192c_PHY_SetBeaconHwReg( - IN struct adapter * Adapter, - IN u16 BeaconInterval - ) -{ - -} - - -VOID -PHY_ScanOperationBackup8188E( - IN struct adapter *Adapter, - IN u8 Operation - ) -{ -#if 0 - IO_TYPE IoType; - - if(!Adapter->bDriverStopped) - { - switch(Operation) - { - case SCAN_OPT_BACKUP: - IoType = IO_CMD_PAUSE_DM_BY_SCAN; - rtw_hal_set_hwreg(Adapter,HW_VAR_IO_CMD, (pu1Byte)&IoType); - - break; - - case SCAN_OPT_RESTORE: - IoType = IO_CMD_RESUME_DM_BY_SCAN; - rtw_hal_set_hwreg(Adapter,HW_VAR_IO_CMD, (pu1Byte)&IoType); - break; - - default: - RT_TRACE(COMP_SCAN, DBG_LOUD, ("Unknown Scan Backup Operation. \n")); - break; - } - } -#endif -} - -/*----------------------------------------------------------------------------- - * Function: PHY_SetBWModeCallback8192C() - * - * Overview: Timer callback function for SetSetBWMode - * - * Input: PRT_TIMER pTimer - * - * Output: NONE - * - * Return: NONE - * - * Note: (1) We do not take j mode into consideration now - * (2) Will two workitem of "switch channel" and "switch channel bandwidth" run - * concurrently? - *---------------------------------------------------------------------------*/ -static VOID -_PHY_SetBWMode92C( - IN struct adapter *Adapter -) -{ -// struct adapter * Adapter = (PADAPTER)pTimer->Adapter; - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); - u8 regBwOpMode; - u8 regRRSR_RSC; - - //return; - - // Added it for 20/40 mhz switch time evaluation by guangan 070531 - //u4Byte NowL, NowH; - //u8Byte BeginTime, EndTime; - - /*RT_TRACE(COMP_SCAN, DBG_LOUD, ("==>PHY_SetBWModeCallback8192C() Switch to %s bandwidth\n", \ - pHalData->CurrentChannelBW == HT_CHANNEL_WIDTH_20?"20MHz":"40MHz"))*/ - - if(pHalData->rf_chip == RF_PSEUDO_11N) - { - //pHalData->SetBWModeInProgress= _FALSE; - return; - } - - // There is no 40MHz mode in RF_8225. - if(pHalData->rf_chip==RF_8225) - return; - - if(Adapter->bDriverStopped) - return; - - // Added it for 20/40 mhz switch time evaluation by guangan 070531 - //NowL = PlatformEFIORead4Byte(Adapter, TSFR); - //NowH = PlatformEFIORead4Byte(Adapter, TSFR+4); - //BeginTime = ((u8Byte)NowH << 32) + NowL; - - //3// - //3//<1>Set MAC register - //3// - //Adapter->HalFunc.SetBWModeHandler(); - - regBwOpMode = rtw_read8(Adapter, REG_BWOPMODE); - regRRSR_RSC = rtw_read8(Adapter, REG_RRSR+2); - //regBwOpMode = rtw_hal_get_hwreg(Adapter,HW_VAR_BWMODE,(pu1Byte)®BwOpMode); - - switch(pHalData->CurrentChannelBW) - { - case HT_CHANNEL_WIDTH_20: - regBwOpMode |= BW_OPMODE_20MHZ; - // 2007/02/07 Mark by Emily becasue we have not verify whether this register works - rtw_write8(Adapter, REG_BWOPMODE, regBwOpMode); - break; - - case HT_CHANNEL_WIDTH_40: - regBwOpMode &= ~BW_OPMODE_20MHZ; - // 2007/02/07 Mark by Emily becasue we have not verify whether this register works - rtw_write8(Adapter, REG_BWOPMODE, regBwOpMode); - - regRRSR_RSC = (regRRSR_RSC&0x90) |(pHalData->nCur40MhzPrimeSC<<5); - rtw_write8(Adapter, REG_RRSR+2, regRRSR_RSC); - break; - - default: - /*RT_TRACE(COMP_DBG, DBG_LOUD, ("PHY_SetBWModeCallback8192C(): - unknown Bandwidth: %#X\n",pHalData->CurrentChannelBW));*/ - break; - } - - //3// - //3//<2>Set PHY related register - //3// - switch(pHalData->CurrentChannelBW) - { - /* 20 MHz channel*/ - case HT_CHANNEL_WIDTH_20: - PHY_SetBBReg(Adapter, rFPGA0_RFMOD, bRFMOD, 0x0); - PHY_SetBBReg(Adapter, rFPGA1_RFMOD, bRFMOD, 0x0); - //PHY_SetBBReg(Adapter, rFPGA0_AnalogParameter2, BIT10, 1); - - break; - - - /* 40 MHz channel*/ - case HT_CHANNEL_WIDTH_40: - PHY_SetBBReg(Adapter, rFPGA0_RFMOD, bRFMOD, 0x1); - PHY_SetBBReg(Adapter, rFPGA1_RFMOD, bRFMOD, 0x1); - - // Set Control channel to upper or lower. These settings are required only for 40MHz - PHY_SetBBReg(Adapter, rCCK0_System, bCCKSideBand, (pHalData->nCur40MhzPrimeSC>>1)); - PHY_SetBBReg(Adapter, rOFDM1_LSTF, 0xC00, pHalData->nCur40MhzPrimeSC); - //PHY_SetBBReg(Adapter, rFPGA0_AnalogParameter2, BIT10, 0); - - PHY_SetBBReg(Adapter, 0x818, (BIT26|BIT27), (pHalData->nCur40MhzPrimeSC==HAL_PRIME_CHNL_OFFSET_LOWER)?2:1); - - break; - - - - default: - /*RT_TRACE(COMP_DBG, DBG_LOUD, ("PHY_SetBWModeCallback8192C(): unknown Bandwidth: %#X\n"\ - ,pHalData->CurrentChannelBW));*/ - break; - - } - //Skip over setting of J-mode in BB register here. Default value is "None J mode". Emily 20070315 - - // Added it for 20/40 mhz switch time evaluation by guangan 070531 - //NowL = PlatformEFIORead4Byte(Adapter, TSFR); - //NowH = PlatformEFIORead4Byte(Adapter, TSFR+4); - //EndTime = ((u8Byte)NowH << 32) + NowL; - //RT_TRACE(COMP_SCAN, DBG_LOUD, ("SetBWModeCallback8190Pci: time of SetBWMode = %I64d us!\n", (EndTime - BeginTime))); - - //3<3>Set RF related register - switch(pHalData->rf_chip) - { - case RF_8225: - //PHY_SetRF8225Bandwidth(Adapter, pHalData->CurrentChannelBW); - break; - - case RF_8256: - // Please implement this function in Hal8190PciPhy8256.c - //PHY_SetRF8256Bandwidth(Adapter, pHalData->CurrentChannelBW); - break; - - case RF_8258: - // Please implement this function in Hal8190PciPhy8258.c - // PHY_SetRF8258Bandwidth(); - break; - - case RF_PSEUDO_11N: - // Do Nothing - break; - - case RF_6052: - rtl8188e_PHY_RF6052SetBandwidth(Adapter, pHalData->CurrentChannelBW); - break; - - default: - //RT_ASSERT(FALSE, ("Unknown RFChipID: %d\n", pHalData->RFChipID)); - break; - } - - //pHalData->SetBWModeInProgress= FALSE; - - //RT_TRACE(COMP_SCAN, DBG_LOUD, ("<==PHY_SetBWModeCallback8192C() \n" )); -} - - - /*----------------------------------------------------------------------------- - * Function: SetBWMode8190Pci() - * - * Overview: This function is export to "HalCommon" moudule - * - * Input: struct adapter * Adapter - * HT_CHANNEL_WIDTH Bandwidth //20M or 40M - * - * Output: NONE - * - * Return: NONE - * - * Note: We do not take j mode into consideration now - *---------------------------------------------------------------------------*/ -VOID -PHY_SetBWMode8188E( - IN struct adapter * Adapter, - IN HT_CHANNEL_WIDTH Bandwidth, // 20M or 40M - IN unsigned char Offset // Upper, Lower, or Don't care -) -{ - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); - HT_CHANNEL_WIDTH tmpBW= pHalData->CurrentChannelBW; - // Modified it for 20/40 mhz switch by guangan 070531 - //PMGNT_INFO pMgntInfo=&Adapter->MgntInfo; - - //return; - - //if(pHalData->SwChnlInProgress) -// if(pMgntInfo->bScanInProgress) -// { -// RT_TRACE(COMP_SCAN, DBG_LOUD, ("PHY_SetBWMode8192C() %s Exit because bScanInProgress!\n", -// Bandwidth == HT_CHANNEL_WIDTH_20?"20MHz":"40MHz")); -// return; -// } - -// if(pHalData->SetBWModeInProgress) -// { -// // Modified it for 20/40 mhz switch by guangan 070531 -// RT_TRACE(COMP_SCAN, DBG_LOUD, ("PHY_SetBWMode8192C() %s cancel last timer because SetBWModeInProgress!\n", -// Bandwidth == HT_CHANNEL_WIDTH_20?"20MHz":"40MHz")); -// PlatformCancelTimer(Adapter, &pHalData->SetBWModeTimer); -// //return; -// } - - //if(pHalData->SetBWModeInProgress) - // return; - - //pHalData->SetBWModeInProgress= TRUE; - - pHalData->CurrentChannelBW = Bandwidth; - -#if 0 - if(Offset==HT_EXTCHNL_OFFSET_LOWER) - pHalData->nCur40MhzPrimeSC = HAL_PRIME_CHNL_OFFSET_UPPER; - else if(Offset==HT_EXTCHNL_OFFSET_UPPER) - pHalData->nCur40MhzPrimeSC = HAL_PRIME_CHNL_OFFSET_LOWER; - else - pHalData->nCur40MhzPrimeSC = HAL_PRIME_CHNL_OFFSET_DONT_CARE; -#else - pHalData->nCur40MhzPrimeSC = Offset; -#endif - - if((!Adapter->bDriverStopped) && (!Adapter->bSurpriseRemoved)) - { - #if 0 - //PlatformSetTimer(Adapter, &(pHalData->SetBWModeTimer), 0); - #else - _PHY_SetBWMode92C(Adapter); - #endif - } - else - { - //RT_TRACE(COMP_SCAN, DBG_LOUD, ("PHY_SetBWMode8192C() SetBWModeInProgress FALSE driver sleep or unload\n")); - //pHalData->SetBWModeInProgress= FALSE; - pHalData->CurrentChannelBW = tmpBW; - } - -} - - -static void _PHY_SwChnl8192C(struct adapter *Adapter, u8 channel) -{ - u8 eRFPath; - u32 param1, param2; - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); - - if ( Adapter->bNotifyChannelChange ) - { - DBG_871X( "[%s] ch = %d\n", __FUNCTION__, channel ); - } - - //s1. pre common command - CmdID_SetTxPowerLevel - PHY_SetTxPowerLevel8188E(Adapter, channel); - - //s2. RF dependent command - CmdID_RF_WriteReg, param1=RF_CHNLBW, param2=channel - param1 = RF_CHNLBW; - param2 = channel; - for(eRFPath = 0; eRFPath NumTotalRFPath; eRFPath++) - { - pHalData->RfRegChnlVal[eRFPath] = ((pHalData->RfRegChnlVal[eRFPath] & 0xfffffc00) | param2); - PHY_SetRFReg(Adapter, (RF_RADIO_PATH_E)eRFPath, param1, bRFRegOffsetMask, pHalData->RfRegChnlVal[eRFPath]); - } - - - //s3. post common command - CmdID_End, None - -} -// <20130708, James> A workaround to eliminate the 2480MHz spur for 8188E I-Cut -void -phy_SpurCalibration_8188E( - IN struct adapter * Adapter - ) -{ - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); - - //DbgPrint("===> phy_SpurCalibration_8188E CurrentChannelBW = %d, CurrentChannel = %d\n", pHalData->CurrentChannelBW, pHalData->CurrentChannel); - if(pHalData->CurrentChannelBW == 0 && pHalData->CurrentChannel == 13){ - PHY_SetBBReg(Adapter, rOFDM1_CFOTracking, BIT(28), 0x1); //enable CSI Mask - PHY_SetBBReg(Adapter, rOFDM1_csi_fix_mask, BIT(26)|BIT(25), 0x3); //Fix CSI Mask Tone - } - else{ - PHY_SetBBReg(Adapter, rOFDM1_CFOTracking, BIT(28), 0x0); //disable CSI Mask - PHY_SetBBReg(Adapter, rOFDM1_csi_fix_mask, BIT(26)|BIT(25), 0x0); - } - -} -VOID -PHY_SwChnl8188E( // Call after initialization - IN struct adapter *Adapter, - IN u8 channel - ) -{ - //struct adapter *Adapter = ADJUST_TO_ADAPTIVE_ADAPTER(pAdapter, _TRUE); - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); - u8 tmpchannel = pHalData->CurrentChannel; - BOOLEAN bResult = _TRUE; - - if(pHalData->rf_chip == RF_PSEUDO_11N) - { - //pHalData->SwChnlInProgress=FALSE; - return; //return immediately if it is peudo-phy - } - - //if(pHalData->SwChnlInProgress) - // return; - - //if(pHalData->SetBWModeInProgress) - // return; - - //-------------------------------------------- - switch(pHalData->CurrentWirelessMode) - { - case WIRELESS_MODE_A: - case WIRELESS_MODE_N_5G: - //RT_ASSERT((channel>14), ("WIRELESS_MODE_A but channel<=14")); - break; - - case WIRELESS_MODE_B: - //RT_ASSERT((channel<=14), ("WIRELESS_MODE_B but channel>14")); - break; - - case WIRELESS_MODE_G: - case WIRELESS_MODE_N_24G: - //RT_ASSERT((channel<=14), ("WIRELESS_MODE_G but channel>14")); - break; - - default: - //RT_ASSERT(FALSE, ("Invalid WirelessMode(%#x)!!\n", pHalData->CurrentWirelessMode)); - break; - } - //-------------------------------------------- - - //pHalData->SwChnlInProgress = TRUE; - if(channel == 0) - channel = 1; - - pHalData->CurrentChannel=channel; - - //pHalData->SwChnlStage=0; - //pHalData->SwChnlStep=0; - - if((!Adapter->bDriverStopped) && (!Adapter->bSurpriseRemoved)) - { - #if 0 - //PlatformSetTimer(Adapter, &(pHalData->SwChnlTimer), 0); - #else - _PHY_SwChnl8192C(Adapter, channel); - #endif - if (IS_VENDOR_8188E_I_CUT_SERIES(Adapter)) - phy_SpurCalibration_8188E( Adapter); - if(bResult) - { - //RT_TRACE(COMP_SCAN, DBG_LOUD, ("PHY_SwChnl8192C SwChnlInProgress TRUE schdule workitem done\n")); - } - else - { - //RT_TRACE(COMP_SCAN, DBG_LOUD, ("PHY_SwChnl8192C SwChnlInProgress FALSE schdule workitem error\n")); - //if(IS_HARDWARE_TYPE_8192SU(Adapter)) - //{ - // pHalData->SwChnlInProgress = FALSE; - pHalData->CurrentChannel = tmpchannel; - //} - } - - } - else - { - //RT_TRACE(COMP_SCAN, DBG_LOUD, ("PHY_SwChnl8192C SwChnlInProgress FALSE driver sleep or unload\n")); - //if(IS_HARDWARE_TYPE_8192SU(Adapter)) - //{ - // pHalData->SwChnlInProgress = FALSE; - pHalData->CurrentChannel = tmpchannel; - //} - } -} - - -static BOOLEAN -phy_SwChnlStepByStep( - IN struct adapter *Adapter, - IN u8 channel, - IN u8 *stage, - IN u8 *step, - OUT u32 *delay - ) -{ -#if 0 - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); - PCHANNEL_ACCESS_SETTING pChnlAccessSetting; - SwChnlCmd PreCommonCmd[MAX_PRECMD_CNT]; - u4Byte PreCommonCmdCnt; - SwChnlCmd PostCommonCmd[MAX_POSTCMD_CNT]; - u4Byte PostCommonCmdCnt; - SwChnlCmd RfDependCmd[MAX_RFDEPENDCMD_CNT]; - u4Byte RfDependCmdCnt; - SwChnlCmd *CurrentCmd; - u1Byte eRFPath; - u4Byte RfTXPowerCtrl; - BOOLEAN bAdjRfTXPowerCtrl = _FALSE; - - - RT_ASSERT((Adapter != NULL), ("Adapter should not be NULL\n")); -#if(MP_DRIVER != 1) - RT_ASSERT(IsLegalChannel(Adapter, channel), ("illegal channel: %d\n", channel)); -#endif - RT_ASSERT((pHalData != NULL), ("pHalData should not be NULL\n")); - - pChnlAccessSetting = &Adapter->MgntInfo.Info8185.ChannelAccessSetting; - RT_ASSERT((pChnlAccessSetting != NULL), ("pChnlAccessSetting should not be NULL\n")); - - //for(eRFPath = RF_PATH_A; eRFPath NumTotalRFPath; eRFPath++) - //for(eRFPath = 0; eRFPath NumTotalRFPath; eRFPath++) - //{ - // <1> Fill up pre common command. - PreCommonCmdCnt = 0; - phy_SetSwChnlCmdArray(PreCommonCmd, PreCommonCmdCnt++, MAX_PRECMD_CNT, - CmdID_SetTxPowerLevel, 0, 0, 0); - phy_SetSwChnlCmdArray(PreCommonCmd, PreCommonCmdCnt++, MAX_PRECMD_CNT, - CmdID_End, 0, 0, 0); - - // <2> Fill up post common command. - PostCommonCmdCnt = 0; - - phy_SetSwChnlCmdArray(PostCommonCmd, PostCommonCmdCnt++, MAX_POSTCMD_CNT, - CmdID_End, 0, 0, 0); - - // <3> Fill up RF dependent command. - RfDependCmdCnt = 0; - switch( pHalData->RFChipID ) - { - case RF_8225: - RT_ASSERT((channel >= 1 && channel <= 14), ("illegal channel for Zebra: %d\n", channel)); - // 2008/09/04 MH Change channel. - if(channel==14) channel++; - phy_SetSwChnlCmdArray(RfDependCmd, RfDependCmdCnt++, MAX_RFDEPENDCMD_CNT, - CmdID_RF_WriteReg, rZebra1_Channel, (0x10+channel-1), 10); - phy_SetSwChnlCmdArray(RfDependCmd, RfDependCmdCnt++, MAX_RFDEPENDCMD_CNT, - CmdID_End, 0, 0, 0); - break; - - case RF_8256: - // TEST!! This is not the table for 8256!! - RT_ASSERT((channel >= 1 && channel <= 14), ("illegal channel for Zebra: %d\n", channel)); - phy_SetSwChnlCmdArray(RfDependCmd, RfDependCmdCnt++, MAX_RFDEPENDCMD_CNT, - CmdID_RF_WriteReg, rRfChannel, channel, 10); - phy_SetSwChnlCmdArray(RfDependCmd, RfDependCmdCnt++, MAX_RFDEPENDCMD_CNT, - CmdID_End, 0, 0, 0); - break; - - case RF_6052: - RT_ASSERT((channel >= 1 && channel <= 14), ("illegal channel for Zebra: %d\n", channel)); - phy_SetSwChnlCmdArray(RfDependCmd, RfDependCmdCnt++, MAX_RFDEPENDCMD_CNT, - CmdID_RF_WriteReg, RF_CHNLBW, channel, 10); - phy_SetSwChnlCmdArray(RfDependCmd, RfDependCmdCnt++, MAX_RFDEPENDCMD_CNT, - CmdID_End, 0, 0, 0); - - break; - - case RF_8258: - break; - - // For FPGA two MAC verification - case RF_PSEUDO_11N: - return TRUE; - default: - RT_ASSERT(FALSE, ("Unknown RFChipID: %d\n", pHalData->RFChipID)); - return FALSE; - break; - } - - - do{ - switch(*stage) - { - case 0: - CurrentCmd=&PreCommonCmd[*step]; - break; - case 1: - CurrentCmd=&RfDependCmd[*step]; - break; - case 2: - CurrentCmd=&PostCommonCmd[*step]; - break; - } - - if(CurrentCmd->CmdID==CmdID_End) - { - if((*stage)==2) - { - return TRUE; - } - else - { - (*stage)++; - (*step)=0; - continue; - } - } - - switch(CurrentCmd->CmdID) - { - case CmdID_SetTxPowerLevel: - PHY_SetTxPowerLevel8192C(Adapter,channel); - break; - case CmdID_WritePortUlong: - PlatformEFIOWrite4Byte(Adapter, CurrentCmd->Para1, CurrentCmd->Para2); - break; - case CmdID_WritePortUshort: - PlatformEFIOWrite2Byte(Adapter, CurrentCmd->Para1, (u2Byte)CurrentCmd->Para2); - break; - case CmdID_WritePortUchar: - PlatformEFIOWrite1Byte(Adapter, CurrentCmd->Para1, (u1Byte)CurrentCmd->Para2); - break; - case CmdID_RF_WriteReg: // Only modify channel for the register now !!!!! - for(eRFPath = 0; eRFPath NumTotalRFPath; eRFPath++) - { -#if 1 - pHalData->RfRegChnlVal[eRFPath] = ((pHalData->RfRegChnlVal[eRFPath] & 0xfffffc00) | CurrentCmd->Para2); - PHY_SetRFReg(Adapter, (RF_RADIO_PATH_E)eRFPath, CurrentCmd->Para1, bRFRegOffsetMask, pHalData->RfRegChnlVal[eRFPath]); -#else - PHY_SetRFReg(Adapter, (RF_RADIO_PATH_E)eRFPath, CurrentCmd->Para1, bRFRegOffsetMask, (CurrentCmd->Para2)); -#endif - } - break; - } - - break; - }while(TRUE); - //cosa }/*for(Number of RF paths)*/ - - (*delay)=CurrentCmd->msDelay; - (*step)++; - return FALSE; -#endif - return _TRUE; -} - - -static BOOLEAN -phy_SetSwChnlCmdArray( - SwChnlCmd* CmdTable, - u32 CmdTableIdx, - u32 CmdTableSz, - SwChnlCmdID CmdID, - u32 Para1, - u32 Para2, - u32 msDelay - ) -{ - SwChnlCmd* pCmd; - - if(CmdTable == NULL) - { - //RT_ASSERT(FALSE, ("phy_SetSwChnlCmdArray(): CmdTable cannot be NULL.\n")); - return _FALSE; - } - if(CmdTableIdx >= CmdTableSz) - { - //RT_ASSERT(FALSE, - // ("phy_SetSwChnlCmdArray(): Access invalid index, please check size of the table, CmdTableIdx:%ld, CmdTableSz:%ld\n", - // CmdTableIdx, CmdTableSz)); - return _FALSE; - } - - pCmd = CmdTable + CmdTableIdx; - pCmd->CmdID = CmdID; - pCmd->Para1 = Para1; - pCmd->Para2 = Para2; - pCmd->msDelay = msDelay; - - return _TRUE; -} - - -static void -phy_FinishSwChnlNow( // We should not call this function directly - IN struct adapter *Adapter, - IN u8 channel - ) -{ -#if 0 - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); - u32 delay; - - while(!phy_SwChnlStepByStep(Adapter,channel,&pHalData->SwChnlStage,&pHalData->SwChnlStep,&delay)) - { - if(delay>0) - rtw_mdelay_os(delay); - } -#endif -} - - - -// -// Description: -// Switch channel synchronously. Called by SwChnlByDelayHandler. -// -// Implemented by Bruce, 2008-02-14. -// The following procedure is operted according to SwChanlCallback8190Pci(). -// However, this procedure is performed synchronously which should be running under -// passive level. -// -VOID -PHY_SwChnlPhy8192C( // Only called during initialize - IN struct adapter *Adapter, - IN u8 channel - ) -{ - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); - - //RT_TRACE(COMP_SCAN | COMP_RM, DBG_LOUD, ("==>PHY_SwChnlPhy8192S(), switch from channel %d to channel %d.\n", pHalData->CurrentChannel, channel)); - - // Cannot IO. - //if(RT_CANNOT_IO(Adapter)) - // return; - - // Channel Switching is in progress. - //if(pHalData->SwChnlInProgress) - // return; - - //return immediately if it is peudo-phy - if(pHalData->rf_chip == RF_PSEUDO_11N) - { - //pHalData->SwChnlInProgress=FALSE; - return; - } - - //pHalData->SwChnlInProgress = TRUE; - if( channel == 0) - channel = 1; - - pHalData->CurrentChannel=channel; - - //pHalData->SwChnlStage = 0; - //pHalData->SwChnlStep = 0; - - phy_FinishSwChnlNow(Adapter,channel); - - //pHalData->SwChnlInProgress = FALSE; -} - - -// -// Description: -// Configure H/W functionality to enable/disable Monitor mode. -// Note, because we possibly need to configure BB and RF in this function, -// so caller should in PASSIVE_LEVEL. 080118, by rcnjko. -// -VOID -PHY_SetMonitorMode8192C( - IN struct adapter * pAdapter, - IN BOOLEAN bEnableMonitorMode - ) -{ -#if 0 - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter); - BOOLEAN bFilterOutNonAssociatedBSSID = FALSE; - - //2 Note: we may need to stop antenna diversity. - if(bEnableMonitorMode) - { - bFilterOutNonAssociatedBSSID = FALSE; - RT_TRACE(COMP_RM, DBG_LOUD, ("PHY_SetMonitorMode8192S(): enable monitor mode\n")); - - pHalData->bInMonitorMode = TRUE; - pAdapter->HalFunc.AllowAllDestAddrHandler(pAdapter, TRUE, TRUE); - rtw_hal_set_hwreg(pAdapter, HW_VAR_CHECK_BSSID, (pu1Byte)&bFilterOutNonAssociatedBSSID); - } - else - { - bFilterOutNonAssociatedBSSID = TRUE; - RT_TRACE(COMP_RM, DBG_LOUD, ("PHY_SetMonitorMode8192S(): disable monitor mode\n")); - - pAdapter->HalFunc.AllowAllDestAddrHandler(pAdapter, FALSE, TRUE); - pHalData->bInMonitorMode = FALSE; - rtw_hal_set_hwreg(pAdapter, HW_VAR_CHECK_BSSID, (pu1Byte)&bFilterOutNonAssociatedBSSID); - } -#endif -} - - -/*----------------------------------------------------------------------------- - * Function: PHYCheckIsLegalRfPath8190Pci() - * - * Overview: Check different RF type to execute legal judgement. If RF Path is illegal - * We will return false. - * - * Input: NONE - * - * Output: NONE - * - * Return: NONE - * - * Revised History: - * When Who Remark - * 11/15/2007 MHC Create Version 0. - * - *---------------------------------------------------------------------------*/ -BOOLEAN -PHY_CheckIsLegalRfPath8192C( - IN struct adapter *pAdapter, - IN u32 eRFPath) -{ -// HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter); - BOOLEAN rtValue = _TRUE; - - // NOt check RF Path now.! -#if 0 - if (pHalData->RF_Type == RF_1T2R && eRFPath != RF_PATH_A) - { - rtValue = FALSE; - } - if (pHalData->RF_Type == RF_1T2R && eRFPath != RF_PATH_A) - { - - } -#endif - return rtValue; - -} /* PHY_CheckIsLegalRfPath8192C */ - -static VOID _PHY_SetRFPathSwitch( - IN struct adapter *pAdapter, - IN BOOLEAN bMain, - IN BOOLEAN is2T - ) -{ - u8 u1bTmp; - - if(!pAdapter->hw_init_completed) - { - u1bTmp = rtw_read8(pAdapter, REG_LEDCFG2) | BIT7; - rtw_write8(pAdapter, REG_LEDCFG2, u1bTmp); - //PHY_SetBBReg(pAdapter, REG_LEDCFG0, BIT23, 0x01); - PHY_SetBBReg(pAdapter, rFPGA0_XAB_RFParameter, BIT13, 0x01); - } - - if(is2T) - { - if(bMain) - PHY_SetBBReg(pAdapter, rFPGA0_XB_RFInterfaceOE, BIT5|BIT6, 0x1); //92C_Path_A - else - PHY_SetBBReg(pAdapter, rFPGA0_XB_RFInterfaceOE, BIT5|BIT6, 0x2); //BT - } - else - { - - if(bMain) - PHY_SetBBReg(pAdapter, rFPGA0_XA_RFInterfaceOE, 0x300, 0x2); //Main - else - PHY_SetBBReg(pAdapter, rFPGA0_XA_RFInterfaceOE, 0x300, 0x1); //Aux - } - -} - -//return value TRUE => Main; FALSE => Aux - -static BOOLEAN _PHY_QueryRFPathSwitch( - IN struct adapter *pAdapter, - IN BOOLEAN is2T - ) -{ -// if(is2T) -// return _TRUE; - - if(!pAdapter->hw_init_completed) - { - PHY_SetBBReg(pAdapter, REG_LEDCFG0, BIT23, 0x01); - PHY_SetBBReg(pAdapter, rFPGA0_XAB_RFParameter, BIT13, 0x01); - } - - if(is2T) - { - if(PHY_QueryBBReg(pAdapter, rFPGA0_XB_RFInterfaceOE, BIT5|BIT6) == 0x01) - return _TRUE; - else - return _FALSE; - } - else - { - if(PHY_QueryBBReg(pAdapter, rFPGA0_XA_RFInterfaceOE, 0x300) == 0x02) - return _TRUE; - else - return _FALSE; - } -} - - -static VOID -_PHY_DumpRFReg(IN struct adapter *pAdapter) -{ - u32 rfRegValue,rfRegOffset; - - //RTPRINT(FINIT, INIT_RF, ("PHY_DumpRFReg()====>\n")); - - for(rfRegOffset = 0x00;rfRegOffset<=0x30;rfRegOffset++){ - rfRegValue = PHY_QueryRFReg(pAdapter,RF_PATH_A, rfRegOffset, bMaskDWord); - //RTPRINT(FINIT, INIT_RF, (" 0x%02x = 0x%08x\n",rfRegOffset,rfRegValue)); - } - //RTPRINT(FINIT, INIT_RF, ("<===== PHY_DumpRFReg()\n")); -} - - -// -// Move from phycfg.c to gen.c to be code independent later -// -//-------------------------Move to other DIR later----------------------------*/ -#ifdef CONFIG_USB_HCI - -// -// Description: -// To dump all Tx FIFO LLT related link-list table. -// Added by Roger, 2009.03.10. -// -VOID -DumpBBDbgPort_92CU( - IN struct adapter * Adapter - ) -{ - - //RT_TRACE(COMP_SEND, DBG_WARNING, ("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n")); - //RT_TRACE(COMP_SEND, DBG_WARNING, ("BaseBand Debug Ports:\n")); - - PHY_SetBBReg(Adapter, 0x0908, 0xffff, 0x0000); - //RT_TRACE(COMP_SEND, DBG_WARNING, ("Offset[%x]: %x\n", 0xdf4, PHY_QueryBBReg(Adapter, 0x0df4, bMaskDWord))); - - PHY_SetBBReg(Adapter, 0x0908, 0xffff, 0x0803); - //RT_TRACE(COMP_SEND, DBG_WARNING, ("Offset[%x]: %x\n", 0xdf4, PHY_QueryBBReg(Adapter, 0x0df4, bMaskDWord))); - - PHY_SetBBReg(Adapter, 0x0908, 0xffff, 0x0a06); - //RT_TRACE(COMP_SEND, DBG_WARNING, ("Offset[%x]: %x\n", 0xdf4, PHY_QueryBBReg(Adapter, 0x0df4, bMaskDWord))); - - PHY_SetBBReg(Adapter, 0x0908, 0xffff, 0x0007); - //RT_TRACE(COMP_SEND, DBG_WARNING, ("Offset[%x]: %x\n", 0xdf4, PHY_QueryBBReg(Adapter, 0x0df4, bMaskDWord))); - - PHY_SetBBReg(Adapter, 0x0908, 0xffff, 0x0100); - PHY_SetBBReg(Adapter, 0x0a28, 0x00ff0000, 0x000f0000); - //RT_TRACE(COMP_SEND, DBG_WARNING, ("Offset[%x]: %x\n", 0xdf4, PHY_QueryBBReg(Adapter, 0x0df4, bMaskDWord))); - - PHY_SetBBReg(Adapter, 0x0908, 0xffff, 0x0100); - PHY_SetBBReg(Adapter, 0x0a28, 0x00ff0000, 0x00150000); - //RT_TRACE(COMP_SEND, DBG_WARNING, ("Offset[%x]: %x\n", 0xdf4, PHY_QueryBBReg(Adapter, 0x0df4, bMaskDWord))); - - //RT_TRACE(COMP_SEND, DBG_WARNING, ("Offset[%x]: %x\n", 0x800, PHY_QueryBBReg(Adapter, 0x0800, bMaskDWord))); - //RT_TRACE(COMP_SEND, DBG_WARNING, ("Offset[%x]: %x\n", 0x900, PHY_QueryBBReg(Adapter, 0x0900, bMaskDWord))); - //RT_TRACE(COMP_SEND, DBG_WARNING, ("Offset[%x]: %x\n", 0xa00, PHY_QueryBBReg(Adapter, 0x0a00, bMaskDWord))); - //RT_TRACE(COMP_SEND, DBG_WARNING, ("Offset[%x]: %x\n", 0xa54, PHY_QueryBBReg(Adapter, 0x0a54, bMaskDWord))); - //RT_TRACE(COMP_SEND, DBG_WARNING, ("Offset[%x]: %x\n", 0xa58, PHY_QueryBBReg(Adapter, 0x0a58, bMaskDWord))); - -} -#endif - +/****************************************************************************** + * + * 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 + * + * + ******************************************************************************/ +#define _RTL8188E_PHYCFG_C_ + +#include +#include +#include +#include + +#ifdef CONFIG_IOL +#include +#endif + +#include + + +/*---------------------------Define Local Constant---------------------------*/ +/* Channel switch:The size of command tables for switch channel*/ +#define MAX_PRECMD_CNT 16 +#define MAX_RFDEPENDCMD_CNT 16 +#define MAX_POSTCMD_CNT 16 + +#define MAX_DOZE_WAITING_TIMES_9x 64 + +/*---------------------------Define Local Constant---------------------------*/ + + +/*------------------------Define global variable-----------------------------*/ + +/*------------------------Define local variable------------------------------*/ + + +/*--------------------Define export function prototype-----------------------*/ +// Please refer to header file +/*--------------------Define export function prototype-----------------------*/ + +/*----------------------------Function Body----------------------------------*/ +// +// 1. BB register R/W API +// + +/** +* Function: phy_CalculateBitShift +* +* OverView: Get shifted position of the BitMask +* +* Input: +* u4Byte BitMask, +* +* Output: none +* Return: u4Byte Return the shift bit bit position of the mask +*/ +static u32 +phy_CalculateBitShift( + u32 BitMask + ) +{ + u32 i; + + for(i=0; i<=31; i++) + { + if ( ((BitMask>>i) & 0x1 ) == 1) + break; + } + + return (i); +} + +#if(SIC_ENABLE == 1) +static BOOLEAN +sic_IsSICReady( + IN struct adapter *Adapter + ) +{ + BOOLEAN bRet=_FALSE; + u32 retryCnt=0; + u8 sic_cmd=0xff; + + while(1) + { + if(retryCnt++ >= SIC_MAX_POLL_CNT) + { + //RTPRINT(FPHY, (PHY_SICR|PHY_SICW), ("[SIC], sic_IsSICReady() return FALSE\n")); + return _FALSE; + } + + //if(RT_SDIO_CANNOT_IO(Adapter)) + // return _FALSE; + + sic_cmd = rtw_read8(Adapter, SIC_CMD_REG); + //sic_cmd = PlatformEFIORead1Byte(Adapter, SIC_CMD_REG); +#if(SIC_HW_SUPPORT == 1) + sic_cmd &= 0xf0; // [7:4] +#endif + //RTPRINT(FPHY, (PHY_SICR|PHY_SICW), ("[SIC], sic_IsSICReady(), readback 0x%x=0x%x\n", SIC_CMD_REG, sic_cmd)); + if(sic_cmd == SIC_CMD_READY) + return _TRUE; + else + { + rtw_msleep_os(1); + //delay_ms(1); + } + } + + return bRet; +} + +/* +u32 +sic_CalculateBitShift( + u32 BitMask + ) +{ + u32 i; + + for(i=0; i<=31; i++) + { + if ( ((BitMask>>i) & 0x1 ) == 1) + break; + } + + return (i); +} +*/ + +static u32 +sic_Read4Byte( + PVOID Adapter, + u32 offset + ) +{ + u32 u4ret=0xffffffff; +#if RTL8188E_SUPPORT == 1 + u8 retry = 0; +#endif + + //RTPRINT(FPHY, PHY_SICR, ("[SIC], sic_Read4Byte(): read offset(%#x)\n", offset)); + + if(sic_IsSICReady(Adapter)) + { +#if(SIC_HW_SUPPORT == 1) + rtw_write8(Adapter, SIC_CMD_REG, SIC_CMD_PREREAD); + //PlatformEFIOWrite1Byte(Adapter, SIC_CMD_REG, SIC_CMD_PREREAD); + //RTPRINT(FPHY, PHY_SICR, ("write cmdreg 0x%x = 0x%x\n", SIC_CMD_REG, SIC_CMD_PREREAD)); +#endif + rtw_write8(Adapter, SIC_ADDR_REG, (u8)(offset&0xff)); + //PlatformEFIOWrite1Byte(Adapter, SIC_ADDR_REG, (u1Byte)(offset&0xff)); + //RTPRINT(FPHY, PHY_SICR, ("write 0x%x = 0x%x\n", SIC_ADDR_REG, (u1Byte)(offset&0xff))); + rtw_write8(Adapter, SIC_ADDR_REG+1, (u8)((offset&0xff00)>>8)); + //PlatformEFIOWrite1Byte(Adapter, SIC_ADDR_REG+1, (u1Byte)((offset&0xff00)>>8)); + //RTPRINT(FPHY, PHY_SICR, ("write 0x%x = 0x%x\n", SIC_ADDR_REG+1, (u1Byte)((offset&0xff00)>>8))); + rtw_write8(Adapter, SIC_CMD_REG, SIC_CMD_READ); + //PlatformEFIOWrite1Byte(Adapter, SIC_CMD_REG, SIC_CMD_READ); + //RTPRINT(FPHY, PHY_SICR, ("write cmdreg 0x%x = 0x%x\n", SIC_CMD_REG, SIC_CMD_READ)); + +#if RTL8188E_SUPPORT == 1 + retry = 4; + while(retry--){ + rtw_udelay_os(50); + //PlatformStallExecution(50); + } +#else + rtw_udelay_os(200); + //PlatformStallExecution(200); +#endif + + if(sic_IsSICReady(Adapter)) + { + u4ret = rtw_read32(Adapter, SIC_DATA_REG); + //u4ret = PlatformEFIORead4Byte(Adapter, SIC_DATA_REG); + //RTPRINT(FPHY, PHY_SICR, ("read 0x%x = 0x%x\n", SIC_DATA_REG, u4ret)); + //DbgPrint("<===Read 0x%x = 0x%x\n", offset, u4ret); + } + } + + return u4ret; +} + +static VOID +sic_Write4Byte( + PVOID Adapter, + u32 offset, + u32 data + ) +{ +#if RTL8188E_SUPPORT == 1 + u8 retry = 6; +#endif + //DbgPrint("=>Write 0x%x = 0x%x\n", offset, data); + //RTPRINT(FPHY, PHY_SICW, ("[SIC], sic_Write4Byte(): write offset(%#x)=0x%x\n", offset, data)); + if(sic_IsSICReady(Adapter)) + { +#if(SIC_HW_SUPPORT == 1) + rtw_write8(Adapter, SIC_CMD_REG, SIC_CMD_PREWRITE); + //PlatformEFIOWrite1Byte(Adapter, SIC_CMD_REG, SIC_CMD_PREWRITE); + //RTPRINT(FPHY, PHY_SICW, ("write data 0x%x = 0x%x\n", SIC_CMD_REG, SIC_CMD_PREWRITE)); +#endif + rtw_write8(Adapter, SIC_ADDR_REG, (u8)(offset&0xff)); + //PlatformEFIOWrite1Byte(Adapter, SIC_ADDR_REG, (u1Byte)(offset&0xff)); + //RTPRINT(FPHY, PHY_SICW, ("write 0x%x=0x%x\n", SIC_ADDR_REG, (u1Byte)(offset&0xff))); + rtw_write8(Adapter, SIC_ADDR_REG+1, (u8)((offset&0xff00)>>8)); + //PlatformEFIOWrite1Byte(Adapter, SIC_ADDR_REG+1, (u1Byte)((offset&0xff00)>>8)); + //RTPRINT(FPHY, PHY_SICW, ("write 0x%x=0x%x\n", (SIC_ADDR_REG+1), (u1Byte)((offset&0xff00)>>8))); + rtw_write32(Adapter, SIC_DATA_REG, (u32)data); + //PlatformEFIOWrite4Byte(Adapter, SIC_DATA_REG, (u4Byte)data); + //RTPRINT(FPHY, PHY_SICW, ("write data 0x%x = 0x%x\n", SIC_DATA_REG, data)); + rtw_write8(Adapter, SIC_CMD_REG, SIC_CMD_WRITE); + //PlatformEFIOWrite1Byte(Adapter, SIC_CMD_REG, SIC_CMD_WRITE); + //RTPRINT(FPHY, PHY_SICW, ("write data 0x%x = 0x%x\n", SIC_CMD_REG, SIC_CMD_WRITE)); +#if RTL8188E_SUPPORT == 1 + while(retry--){ + rtw_udelay_os(50); + //PlatformStallExecution(50); + } +#else + rtw_udelay_os(150); + //PlatformStallExecution(150); +#endif + + } +} +//============================================================ +// extern function +//============================================================ +static VOID +SIC_SetBBReg( + IN struct adapter *Adapter, + IN u32 RegAddr, + IN u32 BitMask, + IN u32 Data + ) +{ + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); + u32 OriginalValue, BitShift; + u16 BBWaitCounter = 0; + + //RTPRINT(FPHY, PHY_SICW, ("[SIC], SIC_SetBBReg() start\n")); +/* + while(PlatformAtomicExchange(&pHalData->bChangeBBInProgress, _TRUE) == _TRUE) + { + BBWaitCounter ++; + delay_ms(10); // 1 ms + + if((BBWaitCounter > 100) || RT_CANNOT_IO(Adapter)) + {// Wait too long, return FALSE to avoid to be stuck here. + RTPRINT(FPHY, PHY_SICW, ("[SIC], SIC_SetBBReg(), Fail to set BB offset(%#x)!!, WaitCnt(%d)\n", RegAddr, BBWaitCounter)); + return; + } + } +*/ + // + // Critical section start + // + + //RTPRINT(FPHY, PHY_SICW, ("[SIC], SIC_SetBBReg(), mask=0x%x, addr[0x%x]=0x%x\n", BitMask, RegAddr, Data)); + + if(BitMask!= bMaskDWord){//if not "double word" write + OriginalValue = sic_Read4Byte(Adapter, RegAddr); + //BitShift = sic_CalculateBitShift(BitMask); + BitShift = phy_CalculateBitShift(BitMask); + Data = (((OriginalValue) & (~BitMask)) | (Data << BitShift)); + } + + sic_Write4Byte(Adapter, RegAddr, Data); + + //PlatformAtomicExchange(&pHalData->bChangeBBInProgress, _FALSE); + //RTPRINT(FPHY, PHY_SICW, ("[SIC], SIC_SetBBReg() end\n")); +} + +static u32 +SIC_QueryBBReg( + IN struct adapter *Adapter, + IN u32 RegAddr, + IN u32 BitMask + ) +{ + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); + u32 ReturnValue = 0, OriginalValue, BitShift; + u16 BBWaitCounter = 0; + + //RTPRINT(FPHY, PHY_SICR, ("[SIC], SIC_QueryBBReg() start\n")); + +/* + while(PlatformAtomicExchange(&pHalData->bChangeBBInProgress, _TRUE) == _TRUE) + { + BBWaitCounter ++; + delay_ms(10); // 10 ms + + if((BBWaitCounter > 100) || RT_CANNOT_IO(Adapter)) + {// Wait too long, return FALSE to avoid to be stuck here. + RTPRINT(FPHY, PHY_SICW, ("[SIC], SIC_QueryBBReg(), Fail to query BB offset(%#x)!!, WaitCnt(%d)\n", RegAddr, BBWaitCounter)); + return ReturnValue; + } + } +*/ + OriginalValue = sic_Read4Byte(Adapter, RegAddr); + //BitShift = sic_CalculateBitShift(BitMask); + BitShift = phy_CalculateBitShift(BitMask); + ReturnValue = (OriginalValue & BitMask) >> BitShift; + + //RTPRINT(FPHY, PHY_SICR, ("[SIC], SIC_QueryBBReg(), 0x%x=0x%x\n", RegAddr, OriginalValue)); + //RTPRINT(FPHY, PHY_SICR, ("[SIC], SIC_QueryBBReg() end\n")); + + //PlatformAtomicExchange(&pHalData->bChangeBBInProgress, _FALSE); + return (ReturnValue); +} + +VOID +SIC_Init( + IN struct adapter *Adapter + ) +{ + // Here we need to write 0x1b8~0x1bf = 0 after fw is downloaded + // because for 8723E at beginning 0x1b8=0x1e, that will cause + // sic always not be ready +#if(SIC_HW_SUPPORT == 1) + //RTPRINT(FPHY, PHY_SICR, ("[SIC], SIC_Init(), write 0x%x = 0x%x\n", + // SIC_INIT_REG, SIC_INIT_VAL)); + rtw_write8(Adapter, SIC_INIT_REG, SIC_INIT_VAL); + //PlatformEFIOWrite1Byte(Adapter, SIC_INIT_REG, SIC_INIT_VAL); + //RTPRINT(FPHY, PHY_SICR, ("[SIC], SIC_Init(), write 0x%x = 0x%x\n", + // SIC_CMD_REG, SIC_CMD_INIT)); + rtw_write8(Adapter, SIC_CMD_REG, SIC_CMD_INIT); + //PlatformEFIOWrite1Byte(Adapter, SIC_CMD_REG, SIC_CMD_INIT); +#else + //RTPRINT(FPHY, PHY_SICR, ("[SIC], SIC_Init(), write 0x1b8~0x1bf = 0x0\n")); + rtw_write32(Adapter, SIC_CMD_REG, 0); + //PlatformEFIOWrite4Byte(Adapter, SIC_CMD_REG, 0); + rtw_write32(Adapter, SIC_CMD_REG+4, 0); + //PlatformEFIOWrite4Byte(Adapter, SIC_CMD_REG+4, 0); +#endif +} + +static BOOLEAN +SIC_LedOff( + IN struct adapter *Adapter + ) +{ + // When SIC is enabled, led pin will be used as debug pin, + // so don't execute led function when SIC is enabled. + return _TRUE; +} +#endif + +/** +* Function: PHY_QueryBBReg +* +* OverView: Read "sepcific bits" from BB register +* +* Input: +* struct adapter * Adapter, +* u4Byte RegAddr, //The target address to be readback +* u4Byte BitMask //The target bit position in the target address +* //to be readback +* Output: None +* Return: u4Byte Data //The readback register value +* Note: This function is equal to "GetRegSetting" in PHY programming guide +*/ +u32 +rtl8188e_PHY_QueryBBReg( + IN struct adapter *Adapter, + IN u32 RegAddr, + IN u32 BitMask + ) +{ + u32 ReturnValue = 0, OriginalValue, BitShift; + u16 BBWaitCounter = 0; + +#if (DISABLE_BB_RF == 1) + return 0; +#endif + +#if(SIC_ENABLE == 1) + return SIC_QueryBBReg(Adapter, RegAddr, BitMask); +#endif + + //RT_TRACE(COMP_RF, DBG_TRACE, ("--->PHY_QueryBBReg(): RegAddr(%#lx), BitMask(%#lx)\n", RegAddr, BitMask)); + + OriginalValue = rtw_read32(Adapter, RegAddr); + BitShift = phy_CalculateBitShift(BitMask); + ReturnValue = (OriginalValue & BitMask) >> BitShift; + + //RTPRINT(FPHY, PHY_BBR, ("BBR MASK=0x%lx Addr[0x%lx]=0x%lx\n", BitMask, RegAddr, OriginalValue)); + //RT_TRACE(COMP_RF, DBG_TRACE, ("<---PHY_QueryBBReg(): RegAddr(%#lx), BitMask(%#lx), OriginalValue(%#lx)\n", RegAddr, BitMask, OriginalValue)); + + return (ReturnValue); + +} + + +/** +* Function: PHY_SetBBReg +* +* OverView: Write "Specific bits" to BB register (page 8~) +* +* Input: +* struct adapter * Adapter, +* u4Byte RegAddr, //The target address to be modified +* u4Byte BitMask //The target bit position in the target address +* //to be modified +* u4Byte Data //The new register value in the target bit position +* //of the target address +* +* Output: None +* Return: None +* Note: This function is equal to "PutRegSetting" in PHY programming guide +*/ + +VOID +rtl8188e_PHY_SetBBReg( + IN struct adapter *Adapter, + IN u32 RegAddr, + IN u32 BitMask, + IN u32 Data + ) +{ + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); + //u16 BBWaitCounter = 0; + u32 OriginalValue, BitShift; + +#if (DISABLE_BB_RF == 1) + return; +#endif + +#if(SIC_ENABLE == 1) + SIC_SetBBReg(Adapter, RegAddr, BitMask, Data); + return; +#endif + + //RT_TRACE(COMP_RF, DBG_TRACE, ("--->PHY_SetBBReg(): RegAddr(%#lx), BitMask(%#lx), Data(%#lx)\n", RegAddr, BitMask, Data)); + + if(BitMask!= bMaskDWord){//if not "double word" write + OriginalValue = rtw_read32(Adapter, RegAddr); + BitShift = phy_CalculateBitShift(BitMask); + Data = ((OriginalValue & (~BitMask)) | ((Data << BitShift) & BitMask)); + } + + rtw_write32(Adapter, RegAddr, Data); + + //RTPRINT(FPHY, PHY_BBW, ("BBW MASK=0x%lx Addr[0x%lx]=0x%lx\n", BitMask, RegAddr, Data)); + //RT_TRACE(COMP_RF, DBG_TRACE, ("<---PHY_SetBBReg(): RegAddr(%#lx), BitMask(%#lx), Data(%#lx)\n", RegAddr, BitMask, Data)); + +} + + +// +// 2. RF register R/W API +// +/** +* Function: phy_RFSerialRead +* +* OverView: Read regster from RF chips +* +* Input: +* struct adapter * Adapter, +* RF_RADIO_PATH_E eRFPath, //Radio path of A/B/C/D +* u4Byte Offset, //The target address to be read +* +* Output: None +* Return: u4Byte reback value +* Note: Threre are three types of serial operations: +* 1. Software serial write +* 2. Hardware LSSI-Low Speed Serial Interface +* 3. Hardware HSSI-High speed +* serial write. Driver need to implement (1) and (2). +* This function is equal to the combination of RF_ReadReg() and RFLSSIRead() +*/ +static u32 +phy_RFSerialRead( + IN struct adapter * Adapter, + IN RF_RADIO_PATH_E eRFPath, + IN u32 Offset + ) +{ + u32 retValue = 0; + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); + BB_REGISTER_DEFINITION_T *pPhyReg = &pHalData->PHYRegDef[eRFPath]; + u32 NewOffset; + u32 tmplong,tmplong2; + u8 RfPiEnable=0; +#if 0 + if(pHalData->RFChipID == RF_8225 && Offset > 0x24) //36 valid regs + return retValue; + if(pHalData->RFChipID == RF_8256 && Offset > 0x2D) //45 valid regs + return retValue; +#endif + // + // Make sure RF register offset is correct + // + Offset &= 0xff; + + // + // Switch page for 8256 RF IC + // + NewOffset = Offset; + + // 2009/06/17 MH We can not execute IO for power save or other accident mode. + //if(RT_CANNOT_IO(Adapter)) + //{ + // RTPRINT(FPHY, PHY_RFR, ("phy_RFSerialRead return all one\n")); + // return 0xFFFFFFFF; + //} + + // For 92S LSSI Read RFLSSIRead + // For RF A/B write 0x824/82c(does not work in the future) + // We must use 0x824 for RF A and B to execute read trigger + tmplong = PHY_QueryBBReg(Adapter, rFPGA0_XA_HSSIParameter2, bMaskDWord); + if(eRFPath == RF_PATH_A) + tmplong2 = tmplong; + else + tmplong2 = PHY_QueryBBReg(Adapter, pPhyReg->rfHSSIPara2, bMaskDWord); + + tmplong2 = (tmplong2 & (~bLSSIReadAddress)) | (NewOffset<<23) | bLSSIReadEdge; //T65 RF + + PHY_SetBBReg(Adapter, rFPGA0_XA_HSSIParameter2, bMaskDWord, tmplong&(~bLSSIReadEdge)); + rtw_udelay_os(10);// PlatformStallExecution(10); + + PHY_SetBBReg(Adapter, pPhyReg->rfHSSIPara2, bMaskDWord, tmplong2); + rtw_udelay_os(100);//PlatformStallExecution(100); + + //PHY_SetBBReg(Adapter, rFPGA0_XA_HSSIParameter2, bMaskDWord, tmplong|bLSSIReadEdge); + rtw_udelay_os(10);//PlatformStallExecution(10); + + if(eRFPath == RF_PATH_A) + RfPiEnable = (u8)PHY_QueryBBReg(Adapter, rFPGA0_XA_HSSIParameter1, BIT8); + else if(eRFPath == RF_PATH_B) + RfPiEnable = (u8)PHY_QueryBBReg(Adapter, rFPGA0_XB_HSSIParameter1, BIT8); + + if(RfPiEnable) + { // Read from BBreg8b8, 12 bits for 8190, 20bits for T65 RF + retValue = PHY_QueryBBReg(Adapter, pPhyReg->rfLSSIReadBackPi, bLSSIReadBackData); + //DBG_8192C("Readback from RF-PI : 0x%x\n", retValue); + } + else + { //Read from BBreg8a0, 12 bits for 8190, 20 bits for T65 RF + retValue = PHY_QueryBBReg(Adapter, pPhyReg->rfLSSIReadBack, bLSSIReadBackData); + //DBG_8192C("Readback from RF-SI : 0x%x\n", retValue); + } + //DBG_8192C("RFR-%d Addr[0x%x]=0x%x\n", eRFPath, pPhyReg->rfLSSIReadBack, retValue); + + return retValue; + +} + + + +/** +* Function: phy_RFSerialWrite +* +* OverView: Write data to RF register (page 8~) +* +* Input: +* struct adapter * Adapter, +* RF_RADIO_PATH_E eRFPath, //Radio path of A/B/C/D +* u4Byte Offset, //The target address to be read +* u4Byte Data //The new register Data in the target bit position +* //of the target to be read +* +* Output: None +* Return: None +* Note: Threre are three types of serial operations: +* 1. Software serial write +* 2. Hardware LSSI-Low Speed Serial Interface +* 3. Hardware HSSI-High speed +* serial write. Driver need to implement (1) and (2). +* This function is equal to the combination of RF_ReadReg() and RFLSSIRead() + * + * Note: For RF8256 only + * The total count of RTL8256(Zebra4) register is around 36 bit it only employs + * 4-bit RF address. RTL8256 uses "register mode control bit" (Reg00[12], Reg00[10]) + * to access register address bigger than 0xf. See "Appendix-4 in PHY Configuration + * programming guide" for more details. + * Thus, we define a sub-finction for RTL8526 register address conversion + * =========================================================== + * Register Mode RegCTL[1] RegCTL[0] Note + * (Reg00[12]) (Reg00[10]) + * =========================================================== + * Reg_Mode0 0 x Reg 0 ~15(0x0 ~ 0xf) + * ------------------------------------------------------------------ + * Reg_Mode1 1 0 Reg 16 ~30(0x1 ~ 0xf) + * ------------------------------------------------------------------ + * Reg_Mode2 1 1 Reg 31 ~ 45(0x1 ~ 0xf) + * ------------------------------------------------------------------ + * + * 2008/09/02 MH Add 92S RF definition + * + * + * +*/ +static VOID +phy_RFSerialWrite( + IN struct adapter * Adapter, + IN RF_RADIO_PATH_E eRFPath, + IN u32 Offset, + IN u32 Data + ) +{ + u32 DataAndAddr = 0; + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); + BB_REGISTER_DEFINITION_T *pPhyReg = &pHalData->PHYRegDef[eRFPath]; + u32 NewOffset; + +#if 0 + // We should check valid regs for RF_6052 case. + if(pHalData->RFChipID == RF_8225 && Offset > 0x24) //36 valid regs + return; + if(pHalData->RFChipID == RF_8256 && Offset > 0x2D) //45 valid regs + return; +#endif + + // 2009/06/17 MH We can not execute IO for power save or other accident mode. + //if(RT_CANNOT_IO(Adapter)) + //{ + // RTPRINT(FPHY, PHY_RFW, ("phy_RFSerialWrite stop\n")); + // return; + //} + + Offset &= 0xff; + + // + // Shadow Update + // + //PHY_RFShadowWrite(Adapter, eRFPath, Offset, Data); + + // + // Switch page for 8256 RF IC + // + NewOffset = Offset; + + // + // Put write addr in [5:0] and write data in [31:16] + // + //DataAndAddr = (Data<<16) | (NewOffset&0x3f); + DataAndAddr = ((NewOffset<<20) | (Data&0x000fffff)) & 0x0fffffff; // T65 RF + + // + // Write Operation + // + PHY_SetBBReg(Adapter, pPhyReg->rf3wireOffset, bMaskDWord, DataAndAddr); + //RTPRINT(FPHY, PHY_RFW, ("RFW-%d Addr[0x%lx]=0x%lx\n", eRFPath, pPhyReg->rf3wireOffset, DataAndAddr)); + +} + + +/** +* Function: PHY_QueryRFReg +* +* OverView: Query "Specific bits" to RF register (page 8~) +* +* Input: +* struct adapter * Adapter, +* RF_RADIO_PATH_E eRFPath, //Radio path of A/B/C/D +* u4Byte RegAddr, //The target address to be read +* u4Byte BitMask //The target bit position in the target address +* //to be read +* +* Output: None +* Return: u4Byte Readback value +* Note: This function is equal to "GetRFRegSetting" in PHY programming guide +*/ +u32 +rtl8188e_PHY_QueryRFReg( + IN struct adapter * Adapter, + IN RF_RADIO_PATH_E eRFPath, + IN u32 RegAddr, + IN u32 BitMask + ) +{ + u32 Original_Value, Readback_Value, BitShift; + //HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); + //u8 RFWaitCounter = 0; + //_irqL irqL; + +#if (DISABLE_BB_RF == 1) + return 0; +#endif + + //RT_TRACE(COMP_RF, DBG_TRACE, ("--->PHY_QueryRFReg(): RegAddr(%#lx), eRFPath(%#x), BitMask(%#lx)\n", RegAddr, eRFPath,BitMask)); + +#ifdef CONFIG_USB_HCI + //PlatformAcquireMutex(&pHalData->mxRFOperate); +#else + //_enter_critical(&pHalData->rf_lock, &irqL); +#endif + + + Original_Value = phy_RFSerialRead(Adapter, eRFPath, RegAddr); + + BitShift = phy_CalculateBitShift(BitMask); + Readback_Value = (Original_Value & BitMask) >> BitShift; + +#ifdef CONFIG_USB_HCI + //PlatformReleaseMutex(&pHalData->mxRFOperate); +#else + //_exit_critical(&pHalData->rf_lock, &irqL); +#endif + + + //RTPRINT(FPHY, PHY_RFR, ("RFR-%d MASK=0x%lx Addr[0x%lx]=0x%lx\n", eRFPath, BitMask, RegAddr, Original_Value));//BitMask(%#lx),BitMask, + //RT_TRACE(COMP_RF, DBG_TRACE, ("<---PHY_QueryRFReg(): RegAddr(%#lx), eRFPath(%#x), Original_Value(%#lx)\n", + // RegAddr, eRFPath, Original_Value)); + + return (Readback_Value); +} + +/** +* Function: PHY_SetRFReg +* +* OverView: Write "Specific bits" to RF register (page 8~) +* +* Input: +* struct adapter * Adapter, +* RF_RADIO_PATH_E eRFPath, //Radio path of A/B/C/D +* u4Byte RegAddr, //The target address to be modified +* u4Byte BitMask //The target bit position in the target address +* //to be modified +* u4Byte Data //The new register Data in the target bit position +* //of the target address +* +* Output: None +* Return: None +* Note: This function is equal to "PutRFRegSetting" in PHY programming guide +*/ +VOID +rtl8188e_PHY_SetRFReg( + IN struct adapter * Adapter, + IN RF_RADIO_PATH_E eRFPath, + IN u32 RegAddr, + IN u32 BitMask, + IN u32 Data + ) +{ + + //HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); + //u1Byte RFWaitCounter = 0; + u32 Original_Value, BitShift; + //_irqL irqL; + +#if (DISABLE_BB_RF == 1) + return; +#endif + + //RT_TRACE(COMP_RF, DBG_TRACE, ("--->PHY_SetRFReg(): RegAddr(%#lx), BitMask(%#lx), Data(%#lx), eRFPath(%#x)\n", + // RegAddr, BitMask, Data, eRFPath)); + //RTPRINT(FINIT, INIT_RF, ("PHY_SetRFReg(): RegAddr(%#lx), BitMask(%#lx), Data(%#lx), eRFPath(%#x)\n", + // RegAddr, BitMask, Data, eRFPath)); + + +#ifdef CONFIG_USB_HCI + //PlatformAcquireMutex(&pHalData->mxRFOperate); +#else + //_enter_critical(&pHalData->rf_lock, &irqL); +#endif + + + // RF data is 12 bits only + if (BitMask != bRFRegOffsetMask) + { + Original_Value = phy_RFSerialRead(Adapter, eRFPath, RegAddr); + BitShift = phy_CalculateBitShift(BitMask); + Data = ((Original_Value & (~BitMask)) | (Data<< BitShift)); + } + + phy_RFSerialWrite(Adapter, eRFPath, RegAddr, Data); + + +#ifdef CONFIG_USB_HCI + //PlatformReleaseMutex(&pHalData->mxRFOperate); +#else + //_exit_critical(&pHalData->rf_lock, &irqL); +#endif + + //PHY_QueryRFReg(Adapter,eRFPath,RegAddr,BitMask); + //RT_TRACE(COMP_RF, DBG_TRACE, ("<---PHY_SetRFReg(): RegAddr(%#lx), BitMask(%#lx), Data(%#lx), eRFPath(%#x)\n", + // RegAddr, BitMask, Data, eRFPath)); + +} + + +// +// 3. Initial MAC/BB/RF config by reading MAC/BB/RF txt. +// + +/*----------------------------------------------------------------------------- + * Function: phy_ConfigMACWithParaFile() + * + * Overview: This function read BB parameters from general file format, and do register + * Read/Write + * + * Input: struct adapter * Adapter + * ps1Byte pFileName + * + * Output: NONE + * + * Return: RT_STATUS_SUCCESS: configuration file exist + * + * Note: The format of MACPHY_REG.txt is different from PHY and RF. + * [Register][Mask][Value] + *---------------------------------------------------------------------------*/ +static int +phy_ConfigMACWithParaFile( + IN struct adapter * Adapter, + IN u8* pFileName +) +{ + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); + + int rtStatus = _FAIL; + + return rtStatus; +} + +/*----------------------------------------------------------------------------- + * Function: phy_ConfigMACWithHeaderFile() + * + * Overview: This function read BB parameters from Header file we gen, and do register + * Read/Write + * + * Input: struct adapter * Adapter + * ps1Byte pFileName + * + * Output: NONE + * + * Return: RT_STATUS_SUCCESS: configuration file exist + * + * Note: The format of MACPHY_REG.txt is different from PHY and RF. + * [Register][Mask][Value] + *---------------------------------------------------------------------------*/ +#ifndef CONFIG_PHY_SETTING_WITH_ODM +static int +phy_ConfigMACWithHeaderFile( + IN struct adapter * Adapter +) +{ + u32 i = 0; + u32 ArrayLength = 0; + u32* ptrArray; + //HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); + + //2008.11.06 Modified by tynli. + //RT_TRACE(COMP_INIT, DBG_LOUD, ("Read Rtl819XMACPHY_Array\n")); + ArrayLength = Rtl8188E_MAC_ArrayLength; + ptrArray = (u32*)Rtl8188E_MAC_Array; + +#ifdef CONFIG_IOL_MAC + { + struct xmit_frame *xmit_frame; + if((xmit_frame=rtw_IOL_accquire_xmit_frame(Adapter)) == NULL) + return _FAIL; + + for(i = 0 ;i < ArrayLength;i=i+2){ // Add by tynli for 2 column + rtw_IOL_append_WB_cmd(xmit_frame, ptrArray[i], (u8)ptrArray[i+1]); + } + + return rtw_IOL_exec_cmds_sync(Adapter, xmit_frame, 1000,0); + } +#else + for(i = 0 ;i < ArrayLength;i=i+2){ // Add by tynli for 2 column + rtw_write8(Adapter, ptrArray[i], (u8)ptrArray[i+1]); + } +#endif + + return _SUCCESS; + +} +#endif //#ifndef CONFIG_PHY_SETTING_WITH_ODM + +/*----------------------------------------------------------------------------- + * Function: PHY_MACConfig8192C + * + * Overview: Condig MAC by header file or parameter file. + * + * Input: NONE + * + * Output: NONE + * + * Return: NONE + * + * Revised History: + * When Who Remark + * 08/12/2008 MHC Create Version 0. + * + *---------------------------------------------------------------------------*/ +s32 PHY_MACConfig8188E(struct adapter *Adapter) +{ + int rtStatus = _SUCCESS; + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); + s8 *pszMACRegFile; + s8 sz8188EMACRegFile[] = RTL8188E_PHY_MACREG; + + pszMACRegFile = sz8188EMACRegFile; + + // + // Config MAC + // +#ifdef CONFIG_EMBEDDED_FWIMG + #ifdef CONFIG_PHY_SETTING_WITH_ODM + if(HAL_STATUS_FAILURE == ODM_ConfigMACWithHeaderFile(&pHalData->odmpriv)) + rtStatus = _FAIL; + #else + rtStatus = phy_ConfigMACWithHeaderFile(Adapter); + #endif//#ifdef CONFIG_PHY_SETTING_WITH_ODM +#else + + // Not make sure EEPROM, add later + //RT_TRACE(COMP_INIT, DBG_LOUD, ("Read MACREG.txt\n")); + rtStatus = phy_ConfigMACWithParaFile(Adapter, pszMACRegFile); +#endif//CONFIG_EMBEDDED_FWIMG + + + // 2010.07.13 AMPDU aggregation number B + rtw_write8(Adapter, REG_MAX_AGGR_NUM, MAX_AGGR_NUM); + //rtw_write8(Adapter, REG_MAX_AGGR_NUM, 0x0B); + + return rtStatus; + +} + + +/** +* Function: phy_InitBBRFRegisterDefinition +* +* OverView: Initialize Register definition offset for Radio Path A/B/C/D +* +* Input: +* struct adapter * Adapter, +* +* Output: None +* Return: None +* Note: The initialization value is constant and it should never be changes +*/ +static VOID +phy_InitBBRFRegisterDefinition( + IN struct adapter * Adapter +) +{ + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); + + // RF Interface Sowrtware Control + pHalData->PHYRegDef[RF_PATH_A].rfintfs = rFPGA0_XAB_RFInterfaceSW; // 16 LSBs if read 32-bit from 0x870 + pHalData->PHYRegDef[RF_PATH_B].rfintfs = rFPGA0_XAB_RFInterfaceSW; // 16 MSBs if read 32-bit from 0x870 (16-bit for 0x872) + pHalData->PHYRegDef[RF_PATH_C].rfintfs = rFPGA0_XCD_RFInterfaceSW;// 16 LSBs if read 32-bit from 0x874 + pHalData->PHYRegDef[RF_PATH_D].rfintfs = rFPGA0_XCD_RFInterfaceSW;// 16 MSBs if read 32-bit from 0x874 (16-bit for 0x876) + + // RF Interface Readback Value + pHalData->PHYRegDef[RF_PATH_A].rfintfi = rFPGA0_XAB_RFInterfaceRB; // 16 LSBs if read 32-bit from 0x8E0 + pHalData->PHYRegDef[RF_PATH_B].rfintfi = rFPGA0_XAB_RFInterfaceRB;// 16 MSBs if read 32-bit from 0x8E0 (16-bit for 0x8E2) + pHalData->PHYRegDef[RF_PATH_C].rfintfi = rFPGA0_XCD_RFInterfaceRB;// 16 LSBs if read 32-bit from 0x8E4 + pHalData->PHYRegDef[RF_PATH_D].rfintfi = rFPGA0_XCD_RFInterfaceRB;// 16 MSBs if read 32-bit from 0x8E4 (16-bit for 0x8E6) + + // RF Interface Output (and Enable) + pHalData->PHYRegDef[RF_PATH_A].rfintfo = rFPGA0_XA_RFInterfaceOE; // 16 LSBs if read 32-bit from 0x860 + pHalData->PHYRegDef[RF_PATH_B].rfintfo = rFPGA0_XB_RFInterfaceOE; // 16 LSBs if read 32-bit from 0x864 + + // RF Interface (Output and) Enable + pHalData->PHYRegDef[RF_PATH_A].rfintfe = rFPGA0_XA_RFInterfaceOE; // 16 MSBs if read 32-bit from 0x860 (16-bit for 0x862) + pHalData->PHYRegDef[RF_PATH_B].rfintfe = rFPGA0_XB_RFInterfaceOE; // 16 MSBs if read 32-bit from 0x864 (16-bit for 0x866) + + //Addr of LSSI. Wirte RF register by driver + pHalData->PHYRegDef[RF_PATH_A].rf3wireOffset = rFPGA0_XA_LSSIParameter; //LSSI Parameter + pHalData->PHYRegDef[RF_PATH_B].rf3wireOffset = rFPGA0_XB_LSSIParameter; + + // RF parameter + pHalData->PHYRegDef[RF_PATH_A].rfLSSI_Select = rFPGA0_XAB_RFParameter; //BB Band Select + pHalData->PHYRegDef[RF_PATH_B].rfLSSI_Select = rFPGA0_XAB_RFParameter; + pHalData->PHYRegDef[RF_PATH_C].rfLSSI_Select = rFPGA0_XCD_RFParameter; + pHalData->PHYRegDef[RF_PATH_D].rfLSSI_Select = rFPGA0_XCD_RFParameter; + + // Tx AGC Gain Stage (same for all path. Should we remove this?) + pHalData->PHYRegDef[RF_PATH_A].rfTxGainStage = rFPGA0_TxGainStage; //Tx gain stage + pHalData->PHYRegDef[RF_PATH_B].rfTxGainStage = rFPGA0_TxGainStage; //Tx gain stage + pHalData->PHYRegDef[RF_PATH_C].rfTxGainStage = rFPGA0_TxGainStage; //Tx gain stage + pHalData->PHYRegDef[RF_PATH_D].rfTxGainStage = rFPGA0_TxGainStage; //Tx gain stage + + // Tranceiver A~D HSSI Parameter-1 + pHalData->PHYRegDef[RF_PATH_A].rfHSSIPara1 = rFPGA0_XA_HSSIParameter1; //wire control parameter1 + pHalData->PHYRegDef[RF_PATH_B].rfHSSIPara1 = rFPGA0_XB_HSSIParameter1; //wire control parameter1 + + // Tranceiver A~D HSSI Parameter-2 + pHalData->PHYRegDef[RF_PATH_A].rfHSSIPara2 = rFPGA0_XA_HSSIParameter2; //wire control parameter2 + pHalData->PHYRegDef[RF_PATH_B].rfHSSIPara2 = rFPGA0_XB_HSSIParameter2; //wire control parameter2 + + // RF switch Control + pHalData->PHYRegDef[RF_PATH_A].rfSwitchControl = rFPGA0_XAB_SwitchControl; //TR/Ant switch control + pHalData->PHYRegDef[RF_PATH_B].rfSwitchControl = rFPGA0_XAB_SwitchControl; + pHalData->PHYRegDef[RF_PATH_C].rfSwitchControl = rFPGA0_XCD_SwitchControl; + pHalData->PHYRegDef[RF_PATH_D].rfSwitchControl = rFPGA0_XCD_SwitchControl; + + // AGC control 1 + pHalData->PHYRegDef[RF_PATH_A].rfAGCControl1 = rOFDM0_XAAGCCore1; + pHalData->PHYRegDef[RF_PATH_B].rfAGCControl1 = rOFDM0_XBAGCCore1; + pHalData->PHYRegDef[RF_PATH_C].rfAGCControl1 = rOFDM0_XCAGCCore1; + pHalData->PHYRegDef[RF_PATH_D].rfAGCControl1 = rOFDM0_XDAGCCore1; + + // AGC control 2 + pHalData->PHYRegDef[RF_PATH_A].rfAGCControl2 = rOFDM0_XAAGCCore2; + pHalData->PHYRegDef[RF_PATH_B].rfAGCControl2 = rOFDM0_XBAGCCore2; + pHalData->PHYRegDef[RF_PATH_C].rfAGCControl2 = rOFDM0_XCAGCCore2; + pHalData->PHYRegDef[RF_PATH_D].rfAGCControl2 = rOFDM0_XDAGCCore2; + + // RX AFE control 1 + pHalData->PHYRegDef[RF_PATH_A].rfRxIQImbalance = rOFDM0_XARxIQImbalance; + pHalData->PHYRegDef[RF_PATH_B].rfRxIQImbalance = rOFDM0_XBRxIQImbalance; + pHalData->PHYRegDef[RF_PATH_C].rfRxIQImbalance = rOFDM0_XCRxIQImbalance; + pHalData->PHYRegDef[RF_PATH_D].rfRxIQImbalance = rOFDM0_XDRxIQImbalance; + + // RX AFE control 1 + pHalData->PHYRegDef[RF_PATH_A].rfRxAFE = rOFDM0_XARxAFE; + pHalData->PHYRegDef[RF_PATH_B].rfRxAFE = rOFDM0_XBRxAFE; + pHalData->PHYRegDef[RF_PATH_C].rfRxAFE = rOFDM0_XCRxAFE; + pHalData->PHYRegDef[RF_PATH_D].rfRxAFE = rOFDM0_XDRxAFE; + + // Tx AFE control 1 + pHalData->PHYRegDef[RF_PATH_A].rfTxIQImbalance = rOFDM0_XATxIQImbalance; + pHalData->PHYRegDef[RF_PATH_B].rfTxIQImbalance = rOFDM0_XBTxIQImbalance; + pHalData->PHYRegDef[RF_PATH_C].rfTxIQImbalance = rOFDM0_XCTxIQImbalance; + pHalData->PHYRegDef[RF_PATH_D].rfTxIQImbalance = rOFDM0_XDTxIQImbalance; + + // Tx AFE control 2 + pHalData->PHYRegDef[RF_PATH_A].rfTxAFE = rOFDM0_XATxAFE; + pHalData->PHYRegDef[RF_PATH_B].rfTxAFE = rOFDM0_XBTxAFE; + pHalData->PHYRegDef[RF_PATH_C].rfTxAFE = rOFDM0_XCTxAFE; + pHalData->PHYRegDef[RF_PATH_D].rfTxAFE = rOFDM0_XDTxAFE; + + // Tranceiver LSSI Readback SI mode + pHalData->PHYRegDef[RF_PATH_A].rfLSSIReadBack = rFPGA0_XA_LSSIReadBack; + pHalData->PHYRegDef[RF_PATH_B].rfLSSIReadBack = rFPGA0_XB_LSSIReadBack; + pHalData->PHYRegDef[RF_PATH_C].rfLSSIReadBack = rFPGA0_XC_LSSIReadBack; + pHalData->PHYRegDef[RF_PATH_D].rfLSSIReadBack = rFPGA0_XD_LSSIReadBack; + + // Tranceiver LSSI Readback PI mode + pHalData->PHYRegDef[RF_PATH_A].rfLSSIReadBackPi = TransceiverA_HSPI_Readback; + pHalData->PHYRegDef[RF_PATH_B].rfLSSIReadBackPi = TransceiverB_HSPI_Readback; + //pHalData->PHYRegDef[RF_PATH_C].rfLSSIReadBackPi = rFPGA0_XC_LSSIReadBack; + //pHalData->PHYRegDef[RF_PATH_D].rfLSSIReadBackPi = rFPGA0_XD_LSSIReadBack; + +} + + +/*----------------------------------------------------------------------------- + * Function: phy_ConfigBBWithParaFile() + * + * Overview: This function read BB parameters from general file format, and do register + * Read/Write + * + * Input: struct adapter * Adapter + * ps1Byte pFileName + * + * Output: NONE + * + * Return: RT_STATUS_SUCCESS: configuration file exist + * 2008/11/06 MH For 92S we do not support silent reset now. Disable + * parameter file compare!!!!!!?? + * + *---------------------------------------------------------------------------*/ +static int +phy_ConfigBBWithParaFile( + IN struct adapter * Adapter, + IN u8* pFileName +) +{ + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); + + int rtStatus = _SUCCESS; + + return rtStatus; +} + + + +//**************************************** +// The following is for High Power PA +//**************************************** +VOID +phy_ConfigBBExternalPA( + IN struct adapter * Adapter +) +{ +#ifdef CONFIG_USB_HCI + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); + u16 i=0; + u32 temp=0; + + if(!pHalData->ExternalPA) + { + return; + } + + // 2010/10/19 MH According to Jenyu/EEChou 's opinion, we need not to execute the + // same code as SU. It is already updated in PHY_REG_1T_HP.txt. +#if 0 + PHY_SetBBReg(Adapter, 0xee8, BIT28, 1); + temp = PHY_QueryBBReg(Adapter, 0x860, bMaskDWord); + temp |= (BIT26|BIT21|BIT10|BIT5); + PHY_SetBBReg(Adapter, 0x860, bMaskDWord, temp); + PHY_SetBBReg(Adapter, 0x870, BIT10, 0); + PHY_SetBBReg(Adapter, 0xc80, bMaskDWord, 0x20000080); + PHY_SetBBReg(Adapter, 0xc88, bMaskDWord, 0x40000100); +#endif + +#endif +} + +/*----------------------------------------------------------------------------- + * Function: phy_ConfigBBWithHeaderFile() + * + * Overview: This function read BB parameters from general file format, and do register + * Read/Write + * + * Input: struct adapter * Adapter + * u1Byte ConfigType 0 => PHY_CONFIG + * 1 =>AGC_TAB + * + * Output: NONE + * + * Return: RT_STATUS_SUCCESS: configuration file exist + * + *---------------------------------------------------------------------------*/ +#ifndef CONFIG_PHY_SETTING_WITH_ODM +static int +phy_ConfigBBWithHeaderFile( + IN struct adapter * Adapter, + IN u8 ConfigType +) +{ + int i; + u32* Rtl819XPHY_REGArray_Table; + u32* Rtl819XAGCTAB_Array_Table; + u16 PHY_REGArrayLen, AGCTAB_ArrayLen; + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); + DM_ODM_T *podmpriv = &pHalData->odmpriv; + int ret = _SUCCESS; + + + AGCTAB_ArrayLen = Rtl8188E_AGCTAB_1TArrayLength; + Rtl819XAGCTAB_Array_Table = (u32*)Rtl8188E_AGCTAB_1TArray; + PHY_REGArrayLen = Rtl8188E_PHY_REG_1TArrayLength; + Rtl819XPHY_REGArray_Table = (u32*)Rtl8188E_PHY_REG_1TArray; +// RT_TRACE(COMP_INIT, DBG_LOUD, (" ===> phy_ConfigBBWithHeaderFile() phy:Rtl8188EAGCTAB_1TArray\n")); +// RT_TRACE(COMP_INIT, DBG_LOUD, (" ===> phy_ConfigBBWithHeaderFile() agc:Rtl8188EPHY_REG_1TArray\n")); + + if(ConfigType == CONFIG_BB_PHY_REG) + { + #ifdef CONFIG_IOL_BB_PHY_REG + { + struct xmit_frame *xmit_frame; + u32 tmp_value; + + if((xmit_frame=rtw_IOL_accquire_xmit_frame(Adapter)) == NULL) { + ret = _FAIL; + goto exit; + } + + for(i=0;iRFCalibrateInfo.RegA24 = Rtl819XPHY_REGArray_Table[i+1]; + + rtw_IOL_append_WD_cmd(xmit_frame, Rtl819XPHY_REGArray_Table[i], tmp_value); + //RT_TRACE(COMP_INIT, DBG_TRACE, ("The Rtl819XPHY_REGArray_Table[0] is %lx Rtl819XPHY_REGArray[1] is %lx \n",Rtl819XPHY_REGArray_Table[i], Rtl819XPHY_REGArray_Table[i+1])); + } + + ret = rtw_IOL_exec_cmds_sync(Adapter, xmit_frame, 1000,0); + } + #else + for(i=0;iRFCalibrateInfo.RegA24 = Rtl819XPHY_REGArray_Table[i+1]; + + PHY_SetBBReg(Adapter, Rtl819XPHY_REGArray_Table[i], bMaskDWord, Rtl819XPHY_REGArray_Table[i+1]); + + // Add 1us delay between BB/RF register setting. + rtw_udelay_os(1); + + //RT_TRACE(COMP_INIT, DBG_TRACE, ("The Rtl819XPHY_REGArray_Table[0] is %lx Rtl819XPHY_REGArray[1] is %lx \n",Rtl819XPHY_REGArray_Table[i], Rtl819XPHY_REGArray_Table[i+1])); + } + #endif + // for External PA + phy_ConfigBBExternalPA(Adapter); + } + else if(ConfigType == CONFIG_BB_AGC_TAB) + { + #ifdef CONFIG_IOL_BB_AGC_TAB + { + struct xmit_frame *xmit_frame; + + if((xmit_frame=rtw_IOL_accquire_xmit_frame(Adapter)) == NULL) { + ret = _FAIL; + goto exit; + } + + for(i=0;iMCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][0] = Data; + //printk("MCSTxPowerLevelOriginalOffset[%d][0]-TxAGC_A_Rate18_06 = 0x%x\n", pHalData->pwrGroupCnt, + // pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][0]); + } + if(RegAddr == rTxAGC_A_Rate54_24) + { + pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][1] = Data; + //printk("MCSTxPowerLevelOriginalOffset[%d][1]-TxAGC_A_Rate54_24 = 0x%x\n", pHalData->pwrGroupCnt, + // pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][1]); + } + if(RegAddr == rTxAGC_A_CCK1_Mcs32) + { + pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][6] = Data; + //printk("MCSTxPowerLevelOriginalOffset[%d][6]-TxAGC_A_CCK1_Mcs32 = 0x%x\n", pHalData->pwrGroupCnt, + // pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][6]); + } + if(RegAddr == rTxAGC_B_CCK11_A_CCK2_11 && BitMask == 0xffffff00) + { + pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][7] = Data; + //printk("MCSTxPowerLevelOriginalOffset[%d][7]-TxAGC_B_CCK11_A_CCK2_11 = 0x%x\n", pHalData->pwrGroupCnt, + // pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][7]); + } + if(RegAddr == rTxAGC_A_Mcs03_Mcs00) + { + pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][2] = Data; + //printk("MCSTxPowerLevelOriginalOffset[%d][2]-TxAGC_A_Mcs03_Mcs00 = 0x%x\n", pHalData->pwrGroupCnt, + // pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][2]); + } + if(RegAddr == rTxAGC_A_Mcs07_Mcs04) + { + pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][3] = Data; + //printk("MCSTxPowerLevelOriginalOffset[%d][3]-TxAGC_A_Mcs07_Mcs04 = 0x%x\n", pHalData->pwrGroupCnt, + // pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][3]); + } + if(RegAddr == rTxAGC_A_Mcs11_Mcs08) + { + pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][4] = Data; + //printk("MCSTxPowerLevelOriginalOffset[%d][4]-TxAGC_A_Mcs11_Mcs08 = 0x%x\n", pHalData->pwrGroupCnt, + // pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][4]); + } + if(RegAddr == rTxAGC_A_Mcs15_Mcs12) + { + pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][5] = Data; + //printk("MCSTxPowerLevelOriginalOffset[%d][5]-TxAGC_A_Mcs15_Mcs12 = 0x%x\n", pHalData->pwrGroupCnt,pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][5]); + if(pHalData->rf_type== RF_1T1R) + { + //printk("pwrGroupCnt = %d\n", pHalData->pwrGroupCnt); + pHalData->pwrGroupCnt++; + } + } + if(RegAddr == rTxAGC_B_Rate18_06) + { + pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][8] = Data; + //printk("MCSTxPowerLevelOriginalOffset[%d][8]-TxAGC_B_Rate18_06 = 0x%x\n", pHalData->pwrGroupCnt, + // pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][8]); + } + if(RegAddr == rTxAGC_B_Rate54_24) + { + pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][9] = Data; + //printk("MCSTxPowerLevelOriginalOffset[%d][9]-TxAGC_B_Rate54_24 = 0x%x\n", pHalData->pwrGroupCnt, + // pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][9]); + } + if(RegAddr == rTxAGC_B_CCK1_55_Mcs32) + { + pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][14] = Data; + //printk("MCSTxPowerLevelOriginalOffset[%d][14]-TxAGC_B_CCK1_55_Mcs32 = 0x%x\n", pHalData->pwrGroupCnt, + // pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][14]); + } + if(RegAddr == rTxAGC_B_CCK11_A_CCK2_11 && BitMask == 0x000000ff) + { + pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][15] = Data; + //printk("MCSTxPowerLevelOriginalOffset[%d][15]-TxAGC_B_CCK11_A_CCK2_11 = 0x%x\n", pHalData->pwrGroupCnt, + // pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][15]); + } + if(RegAddr == rTxAGC_B_Mcs03_Mcs00) + { + pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][10] = Data; + //printk("MCSTxPowerLevelOriginalOffset[%d][10]-TxAGC_B_Mcs03_Mcs00 = 0x%x\n", pHalData->pwrGroupCnt, + // pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][10]); + } + if(RegAddr == rTxAGC_B_Mcs07_Mcs04) + { + pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][11] = Data; + //printk("MCSTxPowerLevelOriginalOffset[%d][11]-TxAGC_B_Mcs07_Mcs04 = 0x%x\n", pHalData->pwrGroupCnt, + // pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][11]); + } + if(RegAddr == rTxAGC_B_Mcs11_Mcs08) + { + pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][12] = Data; + //printk("MCSTxPowerLevelOriginalOffset[%d][12]-TxAGC_B_Mcs11_Mcs08 = 0x%x\n", pHalData->pwrGroupCnt, + // pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][12]); + } + if(RegAddr == rTxAGC_B_Mcs15_Mcs12) + { + pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][13] = Data; + //printk("MCSTxPowerLevelOriginalOffset[%d][13]-TxAGC_B_Mcs15_Mcs12 = 0x%x\n", pHalData->pwrGroupCnt, + // pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][13]); + + if(pHalData->rf_type != RF_1T1R) + { + //printk("pwrGroupCnt = %d\n", pHalData->pwrGroupCnt); + pHalData->pwrGroupCnt++; + } + } +} +/*----------------------------------------------------------------------------- + * Function: phy_ConfigBBWithPgParaFile + * + * Overview: + * + * Input: NONE + * + * Output: NONE + * + * Return: NONE + * + * Revised History: + * When Who Remark + * 11/06/2008 MHC Create Version 0. + * 2009/07/29 tynli (porting from 92SE branch)2009/03/11 Add copy parameter file to buffer for silent reset + *---------------------------------------------------------------------------*/ +static int +phy_ConfigBBWithPgParaFile( + IN struct adapter * Adapter, + IN u8* pFileName) +{ + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); + + int rtStatus = _SUCCESS; + + + return rtStatus; + +} /* phy_ConfigBBWithPgParaFile */ + +#ifndef CONFIG_PHY_SETTING_WITH_ODM +/*----------------------------------------------------------------------------- + * Function: phy_ConfigBBWithPgHeaderFile + * + * Overview: Config PHY_REG_PG array + * + * Input: NONE + * + * Output: NONE + * + * Return: NONE + * + * Revised History: + * When Who Remark + * 11/06/2008 MHC Add later!!!!!!.. Please modify for new files!!!! + * 11/10/2008 tynli Modify to mew files. + *---------------------------------------------------------------------------*/ +static int +phy_ConfigBBWithPgHeaderFile( + IN struct adapter * Adapter, + IN u8 ConfigType) +{ + int i; + u32* Rtl819XPHY_REGArray_Table_PG; + u16 PHY_REGArrayPGLen; + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); + + + PHY_REGArrayPGLen = Rtl8188E_PHY_REG_Array_PGLength; + Rtl819XPHY_REGArray_Table_PG = (u32*)Rtl8188E_PHY_REG_Array_PG; + + if(ConfigType == CONFIG_BB_PHY_REG) + { + for(i=0;iphy_BB8192S_Config_ParaFile\n")); + + pszBBRegFile = sz8188EBBRegFile ; + pszAGCTableFile = sz8188EAGCTableFile; + pszBBRegPgFile = sz8188EBBRegPgFile; + pszBBRegMpFile = sz8188EBBRegMpFile; + + // + // 1. Read PHY_REG.TXT BB INIT!! + // We will seperate as 88C / 92C according to chip version + // +#ifdef CONFIG_EMBEDDED_FWIMG + #ifdef CONFIG_PHY_SETTING_WITH_ODM + if(HAL_STATUS_FAILURE ==ODM_ConfigBBWithHeaderFile(&pHalData->odmpriv, CONFIG_BB_PHY_REG)) + rtStatus = _FAIL; + #else + rtStatus = phy_ConfigBBWithHeaderFile(Adapter, CONFIG_BB_PHY_REG); + #endif//#ifdef CONFIG_PHY_SETTING_WITH_ODM +#else + // No matter what kind of CHIP we always read PHY_REG.txt. We must copy different + // type of parameter files to phy_reg.txt at first. + rtStatus = phy_ConfigBBWithParaFile(Adapter,pszBBRegFile); +#endif//#ifdef CONFIG_EMBEDDED_FWIMG + + if(rtStatus != _SUCCESS){ + //RT_TRACE(COMP_INIT, DBG_SERIOUS, ("phy_BB8192S_Config_ParaFile():Write BB Reg Fail!!")); + goto phy_BB8190_Config_ParaFile_Fail; + } + + // + // 20100318 Joseph: Config 2T2R to 1T2R if necessary. + // + //if(pHalData->rf_type == RF_1T2R) + //{ + //phy_BB8192C_Config_1T(Adapter); + //DBG_8192C("phy_BB8188E_Config_ParaFile():Config to 1T!!\n"); + //} + + // + // 2. If EEPROM or EFUSE autoload OK, We must config by PHY_REG_PG.txt + // + if (pEEPROM->bautoload_fail_flag == _FALSE) + { + pHalData->pwrGroupCnt = 0; + +#ifdef CONFIG_EMBEDDED_FWIMG + #ifdef CONFIG_PHY_SETTING_WITH_ODM + if(HAL_STATUS_FAILURE ==ODM_ConfigBBWithHeaderFile(&pHalData->odmpriv, CONFIG_BB_PHY_REG_PG)) + rtStatus = _FAIL; + #else + rtStatus = phy_ConfigBBWithPgHeaderFile(Adapter, CONFIG_BB_PHY_REG_PG); + #endif +#else + rtStatus = phy_ConfigBBWithPgParaFile(Adapter, pszBBRegPgFile); +#endif + } + + if(rtStatus != _SUCCESS){ + //RT_TRACE(COMP_INIT, DBG_SERIOUS, ("phy_BB8192S_Config_ParaFile():BB_PG Reg Fail!!")); + goto phy_BB8190_Config_ParaFile_Fail; + } + + // + // 3. BB AGC table Initialization + // +#ifdef CONFIG_EMBEDDED_FWIMG + #ifdef CONFIG_PHY_SETTING_WITH_ODM + if(HAL_STATUS_FAILURE ==ODM_ConfigBBWithHeaderFile(&pHalData->odmpriv, CONFIG_BB_AGC_TAB)) + rtStatus = _FAIL; + #else + rtStatus = phy_ConfigBBWithHeaderFile(Adapter, CONFIG_BB_AGC_TAB); + #endif//#ifdef CONFIG_PHY_SETTING_WITH_ODM +#else + //RT_TRACE(COMP_INIT, DBG_LOUD, ("phy_BB8192S_Config_ParaFile AGC_TAB.txt\n")); + rtStatus = phy_ConfigBBWithParaFile(Adapter, pszAGCTableFile); +#endif//#ifdef CONFIG_EMBEDDED_FWIMG + + if(rtStatus != _SUCCESS){ + //RT_TRACE(COMP_FPGA, DBG_SERIOUS, ("phy_BB8192S_Config_ParaFile():AGC Table Fail\n")); + goto phy_BB8190_Config_ParaFile_Fail; + } + + +phy_BB8190_Config_ParaFile_Fail: + + return rtStatus; +} + + +int +PHY_BBConfig8188E( + IN struct adapter *Adapter + ) +{ + int rtStatus = _SUCCESS; + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); + u32 RegVal; + u8 TmpU1B=0; + u8 value8,CrystalCap; + + phy_InitBBRFRegisterDefinition(Adapter); + + + // Enable BB and RF + RegVal = rtw_read16(Adapter, REG_SYS_FUNC_EN); + rtw_write16(Adapter, REG_SYS_FUNC_EN, (u16)(RegVal|BIT13|BIT0|BIT1)); + + // 20090923 Joseph: Advised by Steven and Jenyu. Power sequence before init RF. + //rtw_write8(Adapter, REG_AFE_PLL_CTRL, 0x83); + //rtw_write8(Adapter, REG_AFE_PLL_CTRL+1, 0xdb); + + rtw_write8(Adapter, REG_RF_CTRL, RF_EN|RF_RSTB|RF_SDMRSTB); + +#ifdef CONFIG_USB_HCI + rtw_write8(Adapter, REG_SYS_FUNC_EN, FEN_USBA | FEN_USBD | FEN_BB_GLB_RSTn | FEN_BBRSTB); +#else + rtw_write8(Adapter, REG_SYS_FUNC_EN, FEN_PPLL|FEN_PCIEA|FEN_DIO_PCIE|FEN_BB_GLB_RSTn|FEN_BBRSTB); +#endif + +#if 0 +#ifdef CONFIG_USB_HCI + //To Fix MAC loopback mode fail. Suggested by SD4 Johnny. 2010.03.23. + rtw_write8(Adapter, REG_LDOHCI12_CTRL, 0x0f); + rtw_write8(Adapter, 0x15, 0xe9); +#endif + + rtw_write8(Adapter, REG_AFE_XTAL_CTRL+1, 0x80); +#endif + +#ifdef CONFIG_USB_HCI + //rtw_write8(Adapter, 0x15, 0xe9); +#endif + + +#ifdef CONFIG_PCI_HCI + // Force use left antenna by default for 88C. + // if(!IS_92C_SERIAL(pHalData->VersionID) || IS_92C_1T2R(pHalData->VersionID)) + if(Adapter->ledpriv.LedStrategy != SW_LED_MODE10) + { + RegVal = rtw_read32(Adapter, REG_LEDCFG0); + rtw_write32(Adapter, REG_LEDCFG0, RegVal|BIT23); + } +#endif + + // + // Config BB and AGC + // + rtStatus = phy_BB8188E_Config_ParaFile(Adapter); + + // write 0x24[16:11] = 0x24[22:17] = CrystalCap + CrystalCap = pHalData->CrystalCap & 0x3F; + PHY_SetBBReg(Adapter, REG_AFE_XTAL_CTRL, 0x7ff800, (CrystalCap | (CrystalCap << 6))); + + return rtStatus; + +} + + +int +PHY_RFConfig8188E( + IN struct adapter *Adapter + ) +{ + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); + int rtStatus = _SUCCESS; + + // + // RF config + // + rtStatus = PHY_RF6052_Config8188E(Adapter); +#if 0 + switch(pHalData->rf_chip) + { + case RF_6052: + rtStatus = PHY_RF6052_Config(Adapter); + break; + case RF_8225: + rtStatus = PHY_RF8225_Config(Adapter); + break; + case RF_8256: + rtStatus = PHY_RF8256_Config(Adapter); + break; + case RF_8258: + break; + case RF_PSEUDO_11N: + rtStatus = PHY_RF8225_Config(Adapter); + break; + default: //for MacOs Warning: "RF_TYPE_MIN" not handled in switch + break; + } +#endif + return rtStatus; +} + + +/*----------------------------------------------------------------------------- + * Function: PHY_ConfigRFWithParaFile() + * + * Overview: This function read RF parameters from general file format, and do RF 3-wire + * + * Input: struct adapter * Adapter + * ps1Byte pFileName + * RF_RADIO_PATH_E eRFPath + * + * Output: NONE + * + * Return: RT_STATUS_SUCCESS: configuration file exist + * + * Note: Delay may be required for RF configuration + *---------------------------------------------------------------------------*/ +int +rtl8188e_PHY_ConfigRFWithParaFile( + IN struct adapter * Adapter, + IN u8* pFileName, + RF_RADIO_PATH_E eRFPath +) +{ + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); + + int rtStatus = _SUCCESS; + + + return rtStatus; + +} + +//**************************************** +// The following is for High Power PA +//**************************************** +#define HighPowerRadioAArrayLen 22 +//This is for High power PA +u32 Rtl8192S_HighPower_RadioA_Array[HighPowerRadioAArrayLen] = { +0x013,0x00029ea4, +0x013,0x00025e74, +0x013,0x00020ea4, +0x013,0x0001ced0, +0x013,0x00019f40, +0x013,0x00014e70, +0x013,0x000106a0, +0x013,0x0000c670, +0x013,0x000082a0, +0x013,0x00004270, +0x013,0x00000240, +}; + +int +PHY_ConfigRFExternalPA( + IN struct adapter * Adapter, + RF_RADIO_PATH_E eRFPath +) +{ + int rtStatus = _SUCCESS; +#ifdef CONFIG_USB_HCI + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); + u16 i=0; + + if(!pHalData->ExternalPA) + { + return rtStatus; + } + + // 2010/10/19 MH According to Jenyu/EEChou 's opinion, we need not to execute the + // same code as SU. It is already updated in radio_a_1T_HP.txt. +#if 0 + //add for SU High Power PA + for(i = 0;i PHY_ConfigRFWithHeaderFile() Radio_A:Rtl8188ERadioA_1TArray\n")); +// RT_TRACE(COMP_INIT, DBG_LOUD, (" ===> PHY_ConfigRFWithHeaderFile() Radio_B:Rtl8188ERadioB_1TArray\n")); + + switch (eRFPath) + { + case RF_PATH_A: + #ifdef CONFIG_IOL_RF_RF_PATH_A + { + struct xmit_frame *xmit_frame; + if((xmit_frame=rtw_IOL_accquire_xmit_frame(Adapter)) == NULL) { + rtStatus = _FAIL; + goto exit; + } + + for(i = 0;iPHYRegDef[eRFPath]; + u32 NewOffset = 0; + u32 DataAndAddr = 0; + + NewOffset = Rtl819XRadioA_Array_Table[i] & 0x3f; + DataAndAddr = ((NewOffset<<20) | (Rtl819XRadioA_Array_Table[i+1]&0x000fffff)) & 0x0fffffff; // T65 RF + rtw_IOL_append_WD_cmd(xmit_frame, pPhyReg->rf3wireOffset, DataAndAddr); + } + } + rtStatus = rtw_IOL_exec_cmds_sync(Adapter, xmit_frame, 1000,0); + } + #else + for(i = 0;iPHYRegDef[eRFPath]; + u32 NewOffset = 0; + u32 DataAndAddr = 0; + + NewOffset = Rtl819XRadioB_Array_Table[i] & 0x3f; + DataAndAddr = ((NewOffset<<20) | (Rtl819XRadioB_Array_Table[i+1]&0x000fffff)) & 0x0fffffff; // T65 RF + rtw_IOL_append_WD_cmd(xmit_frame, pPhyReg->rf3wireOffset, DataAndAddr); + } + } + rtStatus = rtw_IOL_exec_cmds_sync(Adapter, xmit_frame, 1000,0); + } + #else + for(i = 0;i actually we call PlatformStallExecution()) to do NdisStallExecution() + // [busy wait] instead of NdisMSleep(). So we acquire RT_INITIAL_SPINLOCK + // to run at Dispatch level to achive it. + //cosa PlatformAcquireSpinLock(Adapter, RT_INITIAL_SPINLOCK); + WriteData[i] &= 0xfff; + PHY_SetRFReg(Adapter, eRFPath, WriteAddr[HW90_BLOCK_RF], bRFRegOffsetMask, WriteData[i]); + // TODO: we should not delay for such a long time. Ask SD3 + rtw_mdelay_os(10); + ulRegRead = PHY_QueryRFReg(Adapter, eRFPath, WriteAddr[HW90_BLOCK_RF], bMaskDWord); + rtw_mdelay_os(10); + //cosa PlatformReleaseSpinLock(Adapter, RT_INITIAL_SPINLOCK); + break; + + default: + rtStatus = _FAIL; + break; + } + + + // + // Check whether readback data is correct + // + if(ulRegRead != WriteData[i]) + { + //RT_TRACE(COMP_FPGA, DBG_LOUD, ("ulRegRead: %lx, WriteData: %lx \n", ulRegRead, WriteData[i])); + rtStatus = _FAIL; + break; + } + } + + return rtStatus; +} + + +VOID +rtl8192c_PHY_GetHWRegOriginalValue( + IN struct adapter * Adapter + ) +{ + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); + + // read rx initial gain + pHalData->DefaultInitialGain[0] = (u8)PHY_QueryBBReg(Adapter, rOFDM0_XAAGCCore1, bMaskByte0); + pHalData->DefaultInitialGain[1] = (u8)PHY_QueryBBReg(Adapter, rOFDM0_XBAGCCore1, bMaskByte0); + pHalData->DefaultInitialGain[2] = (u8)PHY_QueryBBReg(Adapter, rOFDM0_XCAGCCore1, bMaskByte0); + pHalData->DefaultInitialGain[3] = (u8)PHY_QueryBBReg(Adapter, rOFDM0_XDAGCCore1, bMaskByte0); + //RT_TRACE(COMP_INIT, DBG_LOUD, + //("Default initial gain (c50=0x%x, c58=0x%x, c60=0x%x, c68=0x%x) \n", + //pHalData->DefaultInitialGain[0], pHalData->DefaultInitialGain[1], + //pHalData->DefaultInitialGain[2], pHalData->DefaultInitialGain[3])); + + // read framesync + pHalData->framesync = (u8)PHY_QueryBBReg(Adapter, rOFDM0_RxDetector3, bMaskByte0); + pHalData->framesyncC34 = PHY_QueryBBReg(Adapter, rOFDM0_RxDetector2, bMaskDWord); + //RT_TRACE(COMP_INIT, DBG_LOUD, ("Default framesync (0x%x) = 0x%x \n", + // rOFDM0_RxDetector3, pHalData->framesync)); +} + + +// +// Description: +// Map dBm into Tx power index according to +// current HW model, for example, RF and PA, and +// current wireless mode. +// By Bruce, 2008-01-29. +// +static u8 +phy_DbmToTxPwrIdx( + IN struct adapter * Adapter, + IN WIRELESS_MODE WirelessMode, + IN int PowerInDbm + ) +{ + u8 TxPwrIdx = 0; + int Offset = 0; + + + // + // Tested by MP, we found that CCK Index 0 equals to 8dbm, OFDM legacy equals to + // 3dbm, and OFDM HT equals to 0dbm repectively. + // Note: + // The mapping may be different by different NICs. Do not use this formula for what needs accurate result. + // By Bruce, 2008-01-29. + // + switch(WirelessMode) + { + case WIRELESS_MODE_B: + Offset = -7; + break; + + case WIRELESS_MODE_G: + case WIRELESS_MODE_N_24G: + Offset = -8; + break; + default: + Offset = -8; + break; + } + + if((PowerInDbm - Offset) > 0) + { + TxPwrIdx = (u8)((PowerInDbm - Offset) * 2); + } + else + { + TxPwrIdx = 0; + } + + // Tx Power Index is too large. + if(TxPwrIdx > MAX_TXPWR_IDX_NMODE_92S) + TxPwrIdx = MAX_TXPWR_IDX_NMODE_92S; + + return TxPwrIdx; +} + +// +// Description: +// Map Tx power index into dBm according to +// current HW model, for example, RF and PA, and +// current wireless mode. +// By Bruce, 2008-01-29. +// +int +phy_TxPwrIdxToDbm( + IN struct adapter * Adapter, + IN WIRELESS_MODE WirelessMode, + IN u8 TxPwrIdx + ) +{ + int Offset = 0; + int PwrOutDbm = 0; + + // + // Tested by MP, we found that CCK Index 0 equals to -7dbm, OFDM legacy equals to -8dbm. + // Note: + // The mapping may be different by different NICs. Do not use this formula for what needs accurate result. + // By Bruce, 2008-01-29. + // + switch(WirelessMode) + { + case WIRELESS_MODE_B: + Offset = -7; + break; + + case WIRELESS_MODE_G: + case WIRELESS_MODE_N_24G: + Offset = -8; + default: + Offset = -8; + break; + } + + PwrOutDbm = TxPwrIdx / 2 + Offset; // Discard the decimal part. + + return PwrOutDbm; +} + + +/*----------------------------------------------------------------------------- + * Function: GetTxPowerLevel8190() + * + * Overview: This function is export to "common" moudule + * + * Input: struct adapter * Adapter + * psByte Power Level + * + * Output: NONE + * + * Return: NONE + * + *---------------------------------------------------------------------------*/ +VOID +PHY_GetTxPowerLevel8188E( + IN struct adapter * Adapter, + OUT u32* powerlevel + ) +{ + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); + u8 TxPwrLevel = 0; + int TxPwrDbm; + + // + // Because the Tx power indexes are different, we report the maximum of them to + // meet the CCX TPC request. By Bruce, 2008-01-31. + // + + // CCK + TxPwrLevel = pHalData->CurrentCckTxPwrIdx; + TxPwrDbm = phy_TxPwrIdxToDbm(Adapter, WIRELESS_MODE_B, TxPwrLevel); + + // Legacy OFDM + TxPwrLevel = pHalData->CurrentOfdm24GTxPwrIdx + pHalData->LegacyHTTxPowerDiff; + + // Compare with Legacy OFDM Tx power. + if(phy_TxPwrIdxToDbm(Adapter, WIRELESS_MODE_G, TxPwrLevel) > TxPwrDbm) + TxPwrDbm = phy_TxPwrIdxToDbm(Adapter, WIRELESS_MODE_G, TxPwrLevel); + + // HT OFDM + TxPwrLevel = pHalData->CurrentOfdm24GTxPwrIdx; + + // Compare with HT OFDM Tx power. + if(phy_TxPwrIdxToDbm(Adapter, WIRELESS_MODE_N_24G, TxPwrLevel) > TxPwrDbm) + TxPwrDbm = phy_TxPwrIdxToDbm(Adapter, WIRELESS_MODE_N_24G, TxPwrLevel); + + *powerlevel = TxPwrDbm; +} + +#if 0 +static void getTxPowerIndex( + IN struct adapter * Adapter, + IN u8 channel, + IN OUT u8* cckPowerLevel, + IN OUT u8* ofdmPowerLevel + ) +{ + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); + u8 index = (channel -1); + // 1. CCK + cckPowerLevel[RF_PATH_A] = pHalData->TxPwrLevelCck[RF_PATH_A][index]; //RF-A + cckPowerLevel[RF_PATH_B] = pHalData->TxPwrLevelCck[RF_PATH_B][index]; //RF-B + + // 2. OFDM for 1S or 2S + if (GET_RF_TYPE(Adapter) == RF_1T2R || GET_RF_TYPE(Adapter) == RF_1T1R) + { + // Read HT 40 OFDM TX power + ofdmPowerLevel[RF_PATH_A] = pHalData->TxPwrLevelHT40_1S[RF_PATH_A][index]; + ofdmPowerLevel[RF_PATH_B] = pHalData->TxPwrLevelHT40_1S[RF_PATH_B][index]; + } + else if (GET_RF_TYPE(Adapter) == RF_2T2R) + { + // Read HT 40 OFDM TX power + ofdmPowerLevel[RF_PATH_A] = pHalData->TxPwrLevelHT40_2S[RF_PATH_A][index]; + ofdmPowerLevel[RF_PATH_B] = pHalData->TxPwrLevelHT40_2S[RF_PATH_B][index]; + } + //RTPRINT(FPHY, PHY_TXPWR, ("Channel-%d, set tx power index !!\n", channel)); +} +#endif + +void getTxPowerIndex88E( + IN struct adapter * Adapter, + IN u8 channel, + IN OUT u8* cckPowerLevel, + IN OUT u8* ofdmPowerLevel, + IN OUT u8* BW20PowerLevel, + IN OUT u8* BW40PowerLevel + ) +{ + + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); + u8 index = (channel -1); + u8 TxCount=0,path_nums; + + + if((RF_1T2R == pHalData->rf_type) ||(RF_1T1R ==pHalData->rf_type )) + path_nums = 1; + else + path_nums = 2; + + for(TxCount=0;TxCount< path_nums ;TxCount++) + { + if(TxCount==RF_PATH_A) + { + // 1. CCK + cckPowerLevel[TxCount] = pHalData->Index24G_CCK_Base[TxCount][index]; + //2. OFDM + ofdmPowerLevel[TxCount] = pHalData->Index24G_BW40_Base[RF_PATH_A][index]+ + pHalData->OFDM_24G_Diff[TxCount][RF_PATH_A]; + // 1. BW20 + BW20PowerLevel[TxCount] = pHalData->Index24G_BW40_Base[RF_PATH_A][index]+ + pHalData->BW20_24G_Diff[TxCount][RF_PATH_A]; + //2. BW40 + BW40PowerLevel[TxCount] = pHalData->Index24G_BW40_Base[TxCount][index]; + //RTPRINT(FPHY, PHY_TXPWR, ("getTxPowerIndex88E(): 40MBase=0x%x 20Mdiff=%d 20MBase=0x%x!!\n", + // pHalData->Index24G_BW40_Base[RF_PATH_A][index], + // pHalData->BW20_24G_Diff[TxCount][RF_PATH_A], + // BW20PowerLevel[TxCount])); + } + else if(TxCount==RF_PATH_B) + { + // 1. CCK + cckPowerLevel[TxCount] = pHalData->Index24G_CCK_Base[TxCount][index]; + //2. OFDM + ofdmPowerLevel[TxCount] = pHalData->Index24G_BW40_Base[RF_PATH_A][index]+ + pHalData->BW20_24G_Diff[RF_PATH_A][index]+ + pHalData->BW20_24G_Diff[TxCount][index]; + // 1. BW20 + BW20PowerLevel[TxCount] = pHalData->Index24G_BW40_Base[RF_PATH_A][index]+ + pHalData->BW20_24G_Diff[TxCount][RF_PATH_A]+ + pHalData->BW20_24G_Diff[TxCount][index]; + //2. BW40 + BW40PowerLevel[TxCount] = pHalData->Index24G_BW40_Base[TxCount][index]; + } + else if(TxCount==RF_PATH_C) + { + // 1. CCK + cckPowerLevel[TxCount] = pHalData->Index24G_CCK_Base[TxCount][index]; + //2. OFDM + ofdmPowerLevel[TxCount] = pHalData->Index24G_BW40_Base[RF_PATH_A][index]+ + pHalData->BW20_24G_Diff[RF_PATH_A][index]+ + pHalData->BW20_24G_Diff[RF_PATH_B][index]+ + pHalData->BW20_24G_Diff[TxCount][index]; + // 1. BW20 + BW20PowerLevel[TxCount] = pHalData->Index24G_BW40_Base[RF_PATH_A][index]+ + pHalData->BW20_24G_Diff[RF_PATH_A][index]+ + pHalData->BW20_24G_Diff[RF_PATH_B][index]+ + pHalData->BW20_24G_Diff[TxCount][index]; + //2. BW40 + BW40PowerLevel[TxCount] = pHalData->Index24G_BW40_Base[TxCount][index]; + } + else if(TxCount==RF_PATH_D) + { + // 1. CCK + cckPowerLevel[TxCount] = pHalData->Index24G_CCK_Base[TxCount][index]; + //2. OFDM + ofdmPowerLevel[TxCount] = pHalData->Index24G_BW40_Base[RF_PATH_A][index]+ + pHalData->BW20_24G_Diff[RF_PATH_A][index]+ + pHalData->BW20_24G_Diff[RF_PATH_B][index]+ + pHalData->BW20_24G_Diff[RF_PATH_C][index]+ + pHalData->BW20_24G_Diff[TxCount][index]; + + // 1. BW20 + BW20PowerLevel[TxCount] = pHalData->Index24G_BW40_Base[RF_PATH_A][index]+ + pHalData->BW20_24G_Diff[RF_PATH_A][index]+ + pHalData->BW20_24G_Diff[RF_PATH_B][index]+ + pHalData->BW20_24G_Diff[RF_PATH_C][index]+ + pHalData->BW20_24G_Diff[TxCount][index]; + + //2. BW40 + BW40PowerLevel[TxCount] = pHalData->Index24G_BW40_Base[TxCount][index]; + } + else + { + } + } + +#if 0 // (INTEL_PROXIMITY_SUPPORT == 1) + switch(pMgntInfo->IntelProximityModeInfo.PowerOutput){ + case 1: // 100% + break; + case 2: // 70% + cckPowerLevel[0] -= 3; + cckPowerLevel[1] -= 3; + ofdmPowerLevel[0] -=3; + ofdmPowerLevel[1] -= 3; + break; + case 3: // 50% + cckPowerLevel[0] -= 6; + cckPowerLevel[1] -= 6; + ofdmPowerLevel[0] -=6; + ofdmPowerLevel[1] -= 6; + break; + case 4: // 35% + cckPowerLevel[0] -= 9; + cckPowerLevel[1] -= 9; + ofdmPowerLevel[0] -=9; + ofdmPowerLevel[1] -= 9; + break; + case 5: // 15% + cckPowerLevel[0] -= 17; + cckPowerLevel[1] -= 17; + ofdmPowerLevel[0] -=17; + ofdmPowerLevel[1] -= 17; + break; + + default: + break; + } +#endif + //RTPRINT(FPHY, PHY_TXPWR, ("Channel-%d, set tx power index !!\n", channel)); +} + +void phy_PowerIndexCheck88E( + IN struct adapter *Adapter, + IN u8 channel, + IN OUT u8 * cckPowerLevel, + IN OUT u8 * ofdmPowerLevel, + IN OUT u8 * BW20PowerLevel, + IN OUT u8 * BW40PowerLevel + ) +{ + + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); +#if 0 // (CCX_SUPPORT == 1) + PMGNT_INFO pMgntInfo = &(Adapter->MgntInfo); + PRT_CCX_INFO pCcxInfo = GET_CCX_INFO(pMgntInfo); + + // + // CCX 2 S31, AP control of client transmit power: + // 1. We shall not exceed Cell Power Limit as possible as we can. + // 2. Tolerance is +/- 5dB. + // 3. 802.11h Power Contraint takes higher precedence over CCX Cell Power Limit. + // + // TODO: + // 1. 802.11h power contraint + // + // 071011, by rcnjko. + // + if( pMgntInfo->OpMode == RT_OP_MODE_INFRASTRUCTURE && + pMgntInfo->mAssoc && + pCcxInfo->bUpdateCcxPwr && + pCcxInfo->bWithCcxCellPwr && + channel == pMgntInfo->dot11CurrentChannelNumber) + { + u1Byte CckCellPwrIdx = phy_DbmToTxPwrIdx(Adapter, WIRELESS_MODE_B, pCcxInfo->CcxCellPwr); + u1Byte LegacyOfdmCellPwrIdx = phy_DbmToTxPwrIdx(Adapter, WIRELESS_MODE_G, pCcxInfo->CcxCellPwr); + u1Byte OfdmCellPwrIdx = phy_DbmToTxPwrIdx(Adapter, WIRELESS_MODE_N_24G, pCcxInfo->CcxCellPwr); + + RT_TRACE(COMP_TXAGC, DBG_LOUD, + ("CCX Cell Limit: %d dbm => CCK Tx power index : %d, Legacy OFDM Tx power index : %d, OFDM Tx power index: %d\n", + pCcxInfo->CcxCellPwr, CckCellPwrIdx, LegacyOfdmCellPwrIdx, OfdmCellPwrIdx)); + RT_TRACE(COMP_TXAGC, DBG_LOUD, + ("EEPROM channel(%d) => CCK Tx power index: %d, Legacy OFDM Tx power index : %d, OFDM Tx power index: %d\n", + channel, cckPowerLevel[0], ofdmPowerLevel[0] + pHalData->LegacyHTTxPowerDiff, ofdmPowerLevel[0])); + + // CCK + if(cckPowerLevel[0] > CckCellPwrIdx) + cckPowerLevel[0] = CckCellPwrIdx; + // Legacy OFDM, HT OFDM + if(ofdmPowerLevel[0] + pHalData->LegacyHTTxPowerDiff > LegacyOfdmCellPwrIdx) + { + if((OfdmCellPwrIdx - pHalData->LegacyHTTxPowerDiff) > 0) + { + ofdmPowerLevel[0] = OfdmCellPwrIdx - pHalData->LegacyHTTxPowerDiff; + } + else + { + ofdmPowerLevel[0] = 0; + } + } + + RT_TRACE(COMP_TXAGC, DBG_LOUD, + ("Altered CCK Tx power index : %d, Legacy OFDM Tx power index: %d, OFDM Tx power index: %d\n", + cckPowerLevel[0], ofdmPowerLevel[0] + pHalData->LegacyHTTxPowerDiff, ofdmPowerLevel[0])); + } +#else + // Add or not ??? +#endif + + pHalData->CurrentCckTxPwrIdx = cckPowerLevel[0]; + pHalData->CurrentOfdm24GTxPwrIdx = ofdmPowerLevel[0]; + pHalData->CurrentBW2024GTxPwrIdx = BW20PowerLevel[0]; + pHalData->CurrentBW4024GTxPwrIdx = BW40PowerLevel[0]; + + //DBG_871X("PHY_SetTxPowerLevel8188E(): CurrentCckTxPwrIdx : 0x%x,CurrentOfdm24GTxPwrIdx: 0x%x, CurrentBW2024GTxPwrIdx: 0x%dx, CurrentBW4024GTxPwrIdx: 0x%x \n", + // pHalData->CurrentCckTxPwrIdx, pHalData->CurrentOfdm24GTxPwrIdx, pHalData->CurrentBW2024GTxPwrIdx, pHalData->CurrentBW4024GTxPwrIdx); +} +/*----------------------------------------------------------------------------- + * Function: SetTxPowerLevel8190() + * + * Overview: This function is export to "HalCommon" moudule + * We must consider RF path later!!!!!!! + * + * Input: struct adapter * Adapter + * u1Byte channel + * + * Output: NONE + * + * Return: NONE + * 2008/11/04 MHC We remove EEPROM_93C56. + * We need to move CCX relative code to independet file. + * 2009/01/21 MHC Support new EEPROM format from SD3 requirement. + * + *---------------------------------------------------------------------------*/ +VOID +PHY_SetTxPowerLevel8188E( + IN struct adapter * Adapter, + IN u8 channel + ) +{ + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); + + u8 cckPowerLevel[MAX_TX_COUNT], ofdmPowerLevel[MAX_TX_COUNT];// [0]:RF-A, [1]:RF-B + u8 BW20PowerLevel[MAX_TX_COUNT], BW40PowerLevel[MAX_TX_COUNT]; + u8 i=0; +/* +#if(MP_DRIVER == 1) + if (Adapter->registrypriv.mp_mode == 1) + return; +#endif +*/ + //getTxPowerIndex(Adapter, channel, &cckPowerLevel[0], &ofdmPowerLevel[0]); + getTxPowerIndex88E(Adapter, channel, &cckPowerLevel[0], &ofdmPowerLevel[0],&BW20PowerLevel[0],&BW40PowerLevel[0]); + + //printk("Channel-%d, cckPowerLevel = 0x%x, ofdmPowerLeve = 0x%x, BW20PowerLevel = 0x%x, BW40PowerLevel = 0x%x,\n", + // channel, cckPowerLevel[0], ofdmPowerLevel[0], BW20PowerLevel[0] ,BW40PowerLevel[0]); + + //RTPRINT(FPHY, PHY_TXPWR, ("Channel-%d, cckPowerLevel (A / B) = 0x%x / 0x%x, ofdmPowerLevel (A / B) = 0x%x / 0x%x\n", + // channel, cckPowerLevel[0], cckPowerLevel[1], ofdmPowerLevel[0], ofdmPowerLevel[1])); + + //ccxPowerIndexCheck(Adapter, channel, &cckPowerLevel[0], &ofdmPowerLevel[0]); + phy_PowerIndexCheck88E(Adapter, channel, &cckPowerLevel[0], &ofdmPowerLevel[0],&BW20PowerLevel[0],&BW40PowerLevel[0]); + + rtl8188e_PHY_RF6052SetCckTxPower(Adapter, &cckPowerLevel[0]); + rtl8188e_PHY_RF6052SetOFDMTxPower(Adapter, &ofdmPowerLevel[0],&BW20PowerLevel[0],&BW40PowerLevel[0], channel); + +#if 0 + switch(pHalData->rf_chip) + { + case RF_8225: + PHY_SetRF8225CckTxPower(Adapter, cckPowerLevel[0]); + PHY_SetRF8225OfdmTxPower(Adapter, ofdmPowerLevel[0]); + break; + + case RF_8256: + PHY_SetRF8256CCKTxPower(Adapter, cckPowerLevel[0]); + PHY_SetRF8256OFDMTxPower(Adapter, ofdmPowerLevel[0]); + break; + + case RF_6052: + PHY_RF6052SetCckTxPower(Adapter, &cckPowerLevel[0]); + PHY_RF6052SetOFDMTxPower(Adapter, &ofdmPowerLevel[0], channel); + break; + + case RF_8258: + break; + } +#endif + +} + + +// +// Description: +// Update transmit power level of all channel supported. +// +// TODO: +// A mode. +// By Bruce, 2008-02-04. +// +BOOLEAN +PHY_UpdateTxPowerDbm8188E( + IN struct adapter *Adapter, + IN int powerInDbm + ) +{ + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); + u8 idx; + u8 rf_path; + + // TODO: A mode Tx power. + u8 CckTxPwrIdx = phy_DbmToTxPwrIdx(Adapter, WIRELESS_MODE_B, powerInDbm); + u8 OfdmTxPwrIdx = phy_DbmToTxPwrIdx(Adapter, WIRELESS_MODE_N_24G, powerInDbm); + + if(OfdmTxPwrIdx - pHalData->LegacyHTTxPowerDiff > 0) + OfdmTxPwrIdx -= pHalData->LegacyHTTxPowerDiff; + else + OfdmTxPwrIdx = 0; + + //RT_TRACE(COMP_TXAGC, DBG_LOUD, ("PHY_UpdateTxPowerDbm8192S(): %ld dBm , CckTxPwrIdx = %d, OfdmTxPwrIdx = %d\n", powerInDbm, CckTxPwrIdx, OfdmTxPwrIdx)); + + for(idx = 0; idx < 14; idx++) + { + for (rf_path = 0; rf_path < 2; rf_path++) + { + pHalData->TxPwrLevelCck[rf_path][idx] = CckTxPwrIdx; + pHalData->TxPwrLevelHT40_1S[rf_path][idx] = + pHalData->TxPwrLevelHT40_2S[rf_path][idx] = OfdmTxPwrIdx; + } + } + + //Adapter->HalFunc.SetTxPowerLevelHandler(Adapter, pHalData->CurrentChannel);//gtest:todo + + return _TRUE; +} + + +/* + Description: + When beacon interval is changed, the values of the + hw registers should be modified. + By tynli, 2008.10.24. + +*/ + + +void +rtl8192c_PHY_SetBeaconHwReg( + IN struct adapter * Adapter, + IN u16 BeaconInterval + ) +{ + +} + + +VOID +PHY_ScanOperationBackup8188E( + IN struct adapter *Adapter, + IN u8 Operation + ) +{ +#if 0 + IO_TYPE IoType; + + if(!Adapter->bDriverStopped) + { + switch(Operation) + { + case SCAN_OPT_BACKUP: + IoType = IO_CMD_PAUSE_DM_BY_SCAN; + rtw_hal_set_hwreg(Adapter,HW_VAR_IO_CMD, (pu1Byte)&IoType); + + break; + + case SCAN_OPT_RESTORE: + IoType = IO_CMD_RESUME_DM_BY_SCAN; + rtw_hal_set_hwreg(Adapter,HW_VAR_IO_CMD, (pu1Byte)&IoType); + break; + + default: + RT_TRACE(COMP_SCAN, DBG_LOUD, ("Unknown Scan Backup Operation. \n")); + break; + } + } +#endif +} + +/*----------------------------------------------------------------------------- + * Function: PHY_SetBWModeCallback8192C() + * + * Overview: Timer callback function for SetSetBWMode + * + * Input: PRT_TIMER pTimer + * + * Output: NONE + * + * Return: NONE + * + * Note: (1) We do not take j mode into consideration now + * (2) Will two workitem of "switch channel" and "switch channel bandwidth" run + * concurrently? + *---------------------------------------------------------------------------*/ +static VOID +_PHY_SetBWMode92C( + IN struct adapter *Adapter +) +{ +// struct adapter * Adapter = (PADAPTER)pTimer->Adapter; + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); + u8 regBwOpMode; + u8 regRRSR_RSC; + + //return; + + // Added it for 20/40 mhz switch time evaluation by guangan 070531 + //u4Byte NowL, NowH; + //u8Byte BeginTime, EndTime; + + /*RT_TRACE(COMP_SCAN, DBG_LOUD, ("==>PHY_SetBWModeCallback8192C() Switch to %s bandwidth\n", \ + pHalData->CurrentChannelBW == HT_CHANNEL_WIDTH_20?"20MHz":"40MHz"))*/ + + if(pHalData->rf_chip == RF_PSEUDO_11N) + { + //pHalData->SetBWModeInProgress= _FALSE; + return; + } + + // There is no 40MHz mode in RF_8225. + if(pHalData->rf_chip==RF_8225) + return; + + if(Adapter->bDriverStopped) + return; + + // Added it for 20/40 mhz switch time evaluation by guangan 070531 + //NowL = PlatformEFIORead4Byte(Adapter, TSFR); + //NowH = PlatformEFIORead4Byte(Adapter, TSFR+4); + //BeginTime = ((u8Byte)NowH << 32) + NowL; + + //3// + //3//<1>Set MAC register + //3// + //Adapter->HalFunc.SetBWModeHandler(); + + regBwOpMode = rtw_read8(Adapter, REG_BWOPMODE); + regRRSR_RSC = rtw_read8(Adapter, REG_RRSR+2); + //regBwOpMode = rtw_hal_get_hwreg(Adapter,HW_VAR_BWMODE,(pu1Byte)®BwOpMode); + + switch(pHalData->CurrentChannelBW) + { + case HT_CHANNEL_WIDTH_20: + regBwOpMode |= BW_OPMODE_20MHZ; + // 2007/02/07 Mark by Emily becasue we have not verify whether this register works + rtw_write8(Adapter, REG_BWOPMODE, regBwOpMode); + break; + + case HT_CHANNEL_WIDTH_40: + regBwOpMode &= ~BW_OPMODE_20MHZ; + // 2007/02/07 Mark by Emily becasue we have not verify whether this register works + rtw_write8(Adapter, REG_BWOPMODE, regBwOpMode); + + regRRSR_RSC = (regRRSR_RSC&0x90) |(pHalData->nCur40MhzPrimeSC<<5); + rtw_write8(Adapter, REG_RRSR+2, regRRSR_RSC); + break; + + default: + /*RT_TRACE(COMP_DBG, DBG_LOUD, ("PHY_SetBWModeCallback8192C(): + unknown Bandwidth: %#X\n",pHalData->CurrentChannelBW));*/ + break; + } + + //3// + //3//<2>Set PHY related register + //3// + switch(pHalData->CurrentChannelBW) + { + /* 20 MHz channel*/ + case HT_CHANNEL_WIDTH_20: + PHY_SetBBReg(Adapter, rFPGA0_RFMOD, bRFMOD, 0x0); + PHY_SetBBReg(Adapter, rFPGA1_RFMOD, bRFMOD, 0x0); + //PHY_SetBBReg(Adapter, rFPGA0_AnalogParameter2, BIT10, 1); + + break; + + + /* 40 MHz channel*/ + case HT_CHANNEL_WIDTH_40: + PHY_SetBBReg(Adapter, rFPGA0_RFMOD, bRFMOD, 0x1); + PHY_SetBBReg(Adapter, rFPGA1_RFMOD, bRFMOD, 0x1); + + // Set Control channel to upper or lower. These settings are required only for 40MHz + PHY_SetBBReg(Adapter, rCCK0_System, bCCKSideBand, (pHalData->nCur40MhzPrimeSC>>1)); + PHY_SetBBReg(Adapter, rOFDM1_LSTF, 0xC00, pHalData->nCur40MhzPrimeSC); + //PHY_SetBBReg(Adapter, rFPGA0_AnalogParameter2, BIT10, 0); + + PHY_SetBBReg(Adapter, 0x818, (BIT26|BIT27), (pHalData->nCur40MhzPrimeSC==HAL_PRIME_CHNL_OFFSET_LOWER)?2:1); + + break; + + + + default: + /*RT_TRACE(COMP_DBG, DBG_LOUD, ("PHY_SetBWModeCallback8192C(): unknown Bandwidth: %#X\n"\ + ,pHalData->CurrentChannelBW));*/ + break; + + } + //Skip over setting of J-mode in BB register here. Default value is "None J mode". Emily 20070315 + + // Added it for 20/40 mhz switch time evaluation by guangan 070531 + //NowL = PlatformEFIORead4Byte(Adapter, TSFR); + //NowH = PlatformEFIORead4Byte(Adapter, TSFR+4); + //EndTime = ((u8Byte)NowH << 32) + NowL; + //RT_TRACE(COMP_SCAN, DBG_LOUD, ("SetBWModeCallback8190Pci: time of SetBWMode = %I64d us!\n", (EndTime - BeginTime))); + + //3<3>Set RF related register + switch(pHalData->rf_chip) + { + case RF_8225: + //PHY_SetRF8225Bandwidth(Adapter, pHalData->CurrentChannelBW); + break; + + case RF_8256: + // Please implement this function in Hal8190PciPhy8256.c + //PHY_SetRF8256Bandwidth(Adapter, pHalData->CurrentChannelBW); + break; + + case RF_8258: + // Please implement this function in Hal8190PciPhy8258.c + // PHY_SetRF8258Bandwidth(); + break; + + case RF_PSEUDO_11N: + // Do Nothing + break; + + case RF_6052: + rtl8188e_PHY_RF6052SetBandwidth(Adapter, pHalData->CurrentChannelBW); + break; + + default: + //RT_ASSERT(FALSE, ("Unknown RFChipID: %d\n", pHalData->RFChipID)); + break; + } + + //pHalData->SetBWModeInProgress= FALSE; + + //RT_TRACE(COMP_SCAN, DBG_LOUD, ("<==PHY_SetBWModeCallback8192C() \n" )); +} + + + /*----------------------------------------------------------------------------- + * Function: SetBWMode8190Pci() + * + * Overview: This function is export to "HalCommon" moudule + * + * Input: struct adapter * Adapter + * HT_CHANNEL_WIDTH Bandwidth //20M or 40M + * + * Output: NONE + * + * Return: NONE + * + * Note: We do not take j mode into consideration now + *---------------------------------------------------------------------------*/ +VOID +PHY_SetBWMode8188E( + IN struct adapter * Adapter, + IN HT_CHANNEL_WIDTH Bandwidth, // 20M or 40M + IN unsigned char Offset // Upper, Lower, or Don't care +) +{ + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); + HT_CHANNEL_WIDTH tmpBW= pHalData->CurrentChannelBW; + // Modified it for 20/40 mhz switch by guangan 070531 + //PMGNT_INFO pMgntInfo=&Adapter->MgntInfo; + + //return; + + //if(pHalData->SwChnlInProgress) +// if(pMgntInfo->bScanInProgress) +// { +// RT_TRACE(COMP_SCAN, DBG_LOUD, ("PHY_SetBWMode8192C() %s Exit because bScanInProgress!\n", +// Bandwidth == HT_CHANNEL_WIDTH_20?"20MHz":"40MHz")); +// return; +// } + +// if(pHalData->SetBWModeInProgress) +// { +// // Modified it for 20/40 mhz switch by guangan 070531 +// RT_TRACE(COMP_SCAN, DBG_LOUD, ("PHY_SetBWMode8192C() %s cancel last timer because SetBWModeInProgress!\n", +// Bandwidth == HT_CHANNEL_WIDTH_20?"20MHz":"40MHz")); +// PlatformCancelTimer(Adapter, &pHalData->SetBWModeTimer); +// //return; +// } + + //if(pHalData->SetBWModeInProgress) + // return; + + //pHalData->SetBWModeInProgress= TRUE; + + pHalData->CurrentChannelBW = Bandwidth; + +#if 0 + if(Offset==HT_EXTCHNL_OFFSET_LOWER) + pHalData->nCur40MhzPrimeSC = HAL_PRIME_CHNL_OFFSET_UPPER; + else if(Offset==HT_EXTCHNL_OFFSET_UPPER) + pHalData->nCur40MhzPrimeSC = HAL_PRIME_CHNL_OFFSET_LOWER; + else + pHalData->nCur40MhzPrimeSC = HAL_PRIME_CHNL_OFFSET_DONT_CARE; +#else + pHalData->nCur40MhzPrimeSC = Offset; +#endif + + if((!Adapter->bDriverStopped) && (!Adapter->bSurpriseRemoved)) + { + #if 0 + //PlatformSetTimer(Adapter, &(pHalData->SetBWModeTimer), 0); + #else + _PHY_SetBWMode92C(Adapter); + #endif + } + else + { + //RT_TRACE(COMP_SCAN, DBG_LOUD, ("PHY_SetBWMode8192C() SetBWModeInProgress FALSE driver sleep or unload\n")); + //pHalData->SetBWModeInProgress= FALSE; + pHalData->CurrentChannelBW = tmpBW; + } + +} + + +static void _PHY_SwChnl8192C(struct adapter *Adapter, u8 channel) +{ + u8 eRFPath; + u32 param1, param2; + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); + + if ( Adapter->bNotifyChannelChange ) + { + DBG_871X( "[%s] ch = %d\n", __FUNCTION__, channel ); + } + + //s1. pre common command - CmdID_SetTxPowerLevel + PHY_SetTxPowerLevel8188E(Adapter, channel); + + //s2. RF dependent command - CmdID_RF_WriteReg, param1=RF_CHNLBW, param2=channel + param1 = RF_CHNLBW; + param2 = channel; + for(eRFPath = 0; eRFPath NumTotalRFPath; eRFPath++) + { + pHalData->RfRegChnlVal[eRFPath] = ((pHalData->RfRegChnlVal[eRFPath] & 0xfffffc00) | param2); + PHY_SetRFReg(Adapter, (RF_RADIO_PATH_E)eRFPath, param1, bRFRegOffsetMask, pHalData->RfRegChnlVal[eRFPath]); + } + + + //s3. post common command - CmdID_End, None + +} +// <20130708, James> A workaround to eliminate the 2480MHz spur for 8188E I-Cut +void +phy_SpurCalibration_8188E( + IN struct adapter * Adapter + ) +{ + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); + + //DbgPrint("===> phy_SpurCalibration_8188E CurrentChannelBW = %d, CurrentChannel = %d\n", pHalData->CurrentChannelBW, pHalData->CurrentChannel); + if(pHalData->CurrentChannelBW == 0 && pHalData->CurrentChannel == 13){ + PHY_SetBBReg(Adapter, rOFDM1_CFOTracking, BIT(28), 0x1); //enable CSI Mask + PHY_SetBBReg(Adapter, rOFDM1_csi_fix_mask, BIT(26)|BIT(25), 0x3); //Fix CSI Mask Tone + } + else{ + PHY_SetBBReg(Adapter, rOFDM1_CFOTracking, BIT(28), 0x0); //disable CSI Mask + PHY_SetBBReg(Adapter, rOFDM1_csi_fix_mask, BIT(26)|BIT(25), 0x0); + } + +} +VOID +PHY_SwChnl8188E( // Call after initialization + IN struct adapter *Adapter, + IN u8 channel + ) +{ + //struct adapter *Adapter = ADJUST_TO_ADAPTIVE_ADAPTER(pAdapter, _TRUE); + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); + u8 tmpchannel = pHalData->CurrentChannel; + BOOLEAN bResult = _TRUE; + + if(pHalData->rf_chip == RF_PSEUDO_11N) + { + //pHalData->SwChnlInProgress=FALSE; + return; //return immediately if it is peudo-phy + } + + //if(pHalData->SwChnlInProgress) + // return; + + //if(pHalData->SetBWModeInProgress) + // return; + + //-------------------------------------------- + switch(pHalData->CurrentWirelessMode) + { + case WIRELESS_MODE_A: + case WIRELESS_MODE_N_5G: + //RT_ASSERT((channel>14), ("WIRELESS_MODE_A but channel<=14")); + break; + + case WIRELESS_MODE_B: + //RT_ASSERT((channel<=14), ("WIRELESS_MODE_B but channel>14")); + break; + + case WIRELESS_MODE_G: + case WIRELESS_MODE_N_24G: + //RT_ASSERT((channel<=14), ("WIRELESS_MODE_G but channel>14")); + break; + + default: + //RT_ASSERT(FALSE, ("Invalid WirelessMode(%#x)!!\n", pHalData->CurrentWirelessMode)); + break; + } + //-------------------------------------------- + + //pHalData->SwChnlInProgress = TRUE; + if(channel == 0) + channel = 1; + + pHalData->CurrentChannel=channel; + + //pHalData->SwChnlStage=0; + //pHalData->SwChnlStep=0; + + if((!Adapter->bDriverStopped) && (!Adapter->bSurpriseRemoved)) + { + #if 0 + //PlatformSetTimer(Adapter, &(pHalData->SwChnlTimer), 0); + #else + _PHY_SwChnl8192C(Adapter, channel); + #endif + if (IS_VENDOR_8188E_I_CUT_SERIES(Adapter)) + phy_SpurCalibration_8188E( Adapter); + if(bResult) + { + //RT_TRACE(COMP_SCAN, DBG_LOUD, ("PHY_SwChnl8192C SwChnlInProgress TRUE schdule workitem done\n")); + } + else + { + //RT_TRACE(COMP_SCAN, DBG_LOUD, ("PHY_SwChnl8192C SwChnlInProgress FALSE schdule workitem error\n")); + //if(IS_HARDWARE_TYPE_8192SU(Adapter)) + //{ + // pHalData->SwChnlInProgress = FALSE; + pHalData->CurrentChannel = tmpchannel; + //} + } + + } + else + { + //RT_TRACE(COMP_SCAN, DBG_LOUD, ("PHY_SwChnl8192C SwChnlInProgress FALSE driver sleep or unload\n")); + //if(IS_HARDWARE_TYPE_8192SU(Adapter)) + //{ + // pHalData->SwChnlInProgress = FALSE; + pHalData->CurrentChannel = tmpchannel; + //} + } +} + + +static BOOLEAN +phy_SwChnlStepByStep( + IN struct adapter *Adapter, + IN u8 channel, + IN u8 *stage, + IN u8 *step, + OUT u32 *delay + ) +{ +#if 0 + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); + PCHANNEL_ACCESS_SETTING pChnlAccessSetting; + SwChnlCmd PreCommonCmd[MAX_PRECMD_CNT]; + u4Byte PreCommonCmdCnt; + SwChnlCmd PostCommonCmd[MAX_POSTCMD_CNT]; + u4Byte PostCommonCmdCnt; + SwChnlCmd RfDependCmd[MAX_RFDEPENDCMD_CNT]; + u4Byte RfDependCmdCnt; + SwChnlCmd *CurrentCmd; + u1Byte eRFPath; + u4Byte RfTXPowerCtrl; + BOOLEAN bAdjRfTXPowerCtrl = _FALSE; + + + RT_ASSERT((Adapter != NULL), ("Adapter should not be NULL\n")); +#if(MP_DRIVER != 1) + RT_ASSERT(IsLegalChannel(Adapter, channel), ("illegal channel: %d\n", channel)); +#endif + RT_ASSERT((pHalData != NULL), ("pHalData should not be NULL\n")); + + pChnlAccessSetting = &Adapter->MgntInfo.Info8185.ChannelAccessSetting; + RT_ASSERT((pChnlAccessSetting != NULL), ("pChnlAccessSetting should not be NULL\n")); + + //for(eRFPath = RF_PATH_A; eRFPath NumTotalRFPath; eRFPath++) + //for(eRFPath = 0; eRFPath NumTotalRFPath; eRFPath++) + //{ + // <1> Fill up pre common command. + PreCommonCmdCnt = 0; + phy_SetSwChnlCmdArray(PreCommonCmd, PreCommonCmdCnt++, MAX_PRECMD_CNT, + CmdID_SetTxPowerLevel, 0, 0, 0); + phy_SetSwChnlCmdArray(PreCommonCmd, PreCommonCmdCnt++, MAX_PRECMD_CNT, + CmdID_End, 0, 0, 0); + + // <2> Fill up post common command. + PostCommonCmdCnt = 0; + + phy_SetSwChnlCmdArray(PostCommonCmd, PostCommonCmdCnt++, MAX_POSTCMD_CNT, + CmdID_End, 0, 0, 0); + + // <3> Fill up RF dependent command. + RfDependCmdCnt = 0; + switch( pHalData->RFChipID ) + { + case RF_8225: + RT_ASSERT((channel >= 1 && channel <= 14), ("illegal channel for Zebra: %d\n", channel)); + // 2008/09/04 MH Change channel. + if(channel==14) channel++; + phy_SetSwChnlCmdArray(RfDependCmd, RfDependCmdCnt++, MAX_RFDEPENDCMD_CNT, + CmdID_RF_WriteReg, rZebra1_Channel, (0x10+channel-1), 10); + phy_SetSwChnlCmdArray(RfDependCmd, RfDependCmdCnt++, MAX_RFDEPENDCMD_CNT, + CmdID_End, 0, 0, 0); + break; + + case RF_8256: + // TEST!! This is not the table for 8256!! + RT_ASSERT((channel >= 1 && channel <= 14), ("illegal channel for Zebra: %d\n", channel)); + phy_SetSwChnlCmdArray(RfDependCmd, RfDependCmdCnt++, MAX_RFDEPENDCMD_CNT, + CmdID_RF_WriteReg, rRfChannel, channel, 10); + phy_SetSwChnlCmdArray(RfDependCmd, RfDependCmdCnt++, MAX_RFDEPENDCMD_CNT, + CmdID_End, 0, 0, 0); + break; + + case RF_6052: + RT_ASSERT((channel >= 1 && channel <= 14), ("illegal channel for Zebra: %d\n", channel)); + phy_SetSwChnlCmdArray(RfDependCmd, RfDependCmdCnt++, MAX_RFDEPENDCMD_CNT, + CmdID_RF_WriteReg, RF_CHNLBW, channel, 10); + phy_SetSwChnlCmdArray(RfDependCmd, RfDependCmdCnt++, MAX_RFDEPENDCMD_CNT, + CmdID_End, 0, 0, 0); + + break; + + case RF_8258: + break; + + // For FPGA two MAC verification + case RF_PSEUDO_11N: + return TRUE; + default: + RT_ASSERT(FALSE, ("Unknown RFChipID: %d\n", pHalData->RFChipID)); + return FALSE; + break; + } + + + do{ + switch(*stage) + { + case 0: + CurrentCmd=&PreCommonCmd[*step]; + break; + case 1: + CurrentCmd=&RfDependCmd[*step]; + break; + case 2: + CurrentCmd=&PostCommonCmd[*step]; + break; + } + + if(CurrentCmd->CmdID==CmdID_End) + { + if((*stage)==2) + { + return TRUE; + } + else + { + (*stage)++; + (*step)=0; + continue; + } + } + + switch(CurrentCmd->CmdID) + { + case CmdID_SetTxPowerLevel: + PHY_SetTxPowerLevel8192C(Adapter,channel); + break; + case CmdID_WritePortUlong: + PlatformEFIOWrite4Byte(Adapter, CurrentCmd->Para1, CurrentCmd->Para2); + break; + case CmdID_WritePortUshort: + PlatformEFIOWrite2Byte(Adapter, CurrentCmd->Para1, (u2Byte)CurrentCmd->Para2); + break; + case CmdID_WritePortUchar: + PlatformEFIOWrite1Byte(Adapter, CurrentCmd->Para1, (u1Byte)CurrentCmd->Para2); + break; + case CmdID_RF_WriteReg: // Only modify channel for the register now !!!!! + for(eRFPath = 0; eRFPath NumTotalRFPath; eRFPath++) + { +#if 1 + pHalData->RfRegChnlVal[eRFPath] = ((pHalData->RfRegChnlVal[eRFPath] & 0xfffffc00) | CurrentCmd->Para2); + PHY_SetRFReg(Adapter, (RF_RADIO_PATH_E)eRFPath, CurrentCmd->Para1, bRFRegOffsetMask, pHalData->RfRegChnlVal[eRFPath]); +#else + PHY_SetRFReg(Adapter, (RF_RADIO_PATH_E)eRFPath, CurrentCmd->Para1, bRFRegOffsetMask, (CurrentCmd->Para2)); +#endif + } + break; + } + + break; + }while(TRUE); + //cosa }/*for(Number of RF paths)*/ + + (*delay)=CurrentCmd->msDelay; + (*step)++; + return FALSE; +#endif + return _TRUE; +} + + +static BOOLEAN +phy_SetSwChnlCmdArray( + SwChnlCmd* CmdTable, + u32 CmdTableIdx, + u32 CmdTableSz, + SwChnlCmdID CmdID, + u32 Para1, + u32 Para2, + u32 msDelay + ) +{ + SwChnlCmd* pCmd; + + if(CmdTable == NULL) + { + //RT_ASSERT(FALSE, ("phy_SetSwChnlCmdArray(): CmdTable cannot be NULL.\n")); + return _FALSE; + } + if(CmdTableIdx >= CmdTableSz) + { + //RT_ASSERT(FALSE, + // ("phy_SetSwChnlCmdArray(): Access invalid index, please check size of the table, CmdTableIdx:%ld, CmdTableSz:%ld\n", + // CmdTableIdx, CmdTableSz)); + return _FALSE; + } + + pCmd = CmdTable + CmdTableIdx; + pCmd->CmdID = CmdID; + pCmd->Para1 = Para1; + pCmd->Para2 = Para2; + pCmd->msDelay = msDelay; + + return _TRUE; +} + + +static void +phy_FinishSwChnlNow( // We should not call this function directly + IN struct adapter *Adapter, + IN u8 channel + ) +{ +#if 0 + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); + u32 delay; + + while(!phy_SwChnlStepByStep(Adapter,channel,&pHalData->SwChnlStage,&pHalData->SwChnlStep,&delay)) + { + if(delay>0) + rtw_mdelay_os(delay); + } +#endif +} + + + +// +// Description: +// Switch channel synchronously. Called by SwChnlByDelayHandler. +// +// Implemented by Bruce, 2008-02-14. +// The following procedure is operted according to SwChanlCallback8190Pci(). +// However, this procedure is performed synchronously which should be running under +// passive level. +// +VOID +PHY_SwChnlPhy8192C( // Only called during initialize + IN struct adapter *Adapter, + IN u8 channel + ) +{ + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); + + //RT_TRACE(COMP_SCAN | COMP_RM, DBG_LOUD, ("==>PHY_SwChnlPhy8192S(), switch from channel %d to channel %d.\n", pHalData->CurrentChannel, channel)); + + // Cannot IO. + //if(RT_CANNOT_IO(Adapter)) + // return; + + // Channel Switching is in progress. + //if(pHalData->SwChnlInProgress) + // return; + + //return immediately if it is peudo-phy + if(pHalData->rf_chip == RF_PSEUDO_11N) + { + //pHalData->SwChnlInProgress=FALSE; + return; + } + + //pHalData->SwChnlInProgress = TRUE; + if( channel == 0) + channel = 1; + + pHalData->CurrentChannel=channel; + + //pHalData->SwChnlStage = 0; + //pHalData->SwChnlStep = 0; + + phy_FinishSwChnlNow(Adapter,channel); + + //pHalData->SwChnlInProgress = FALSE; +} + + +// +// Description: +// Configure H/W functionality to enable/disable Monitor mode. +// Note, because we possibly need to configure BB and RF in this function, +// so caller should in PASSIVE_LEVEL. 080118, by rcnjko. +// +VOID +PHY_SetMonitorMode8192C( + IN struct adapter * pAdapter, + IN BOOLEAN bEnableMonitorMode + ) +{ +#if 0 + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter); + BOOLEAN bFilterOutNonAssociatedBSSID = FALSE; + + //2 Note: we may need to stop antenna diversity. + if(bEnableMonitorMode) + { + bFilterOutNonAssociatedBSSID = FALSE; + RT_TRACE(COMP_RM, DBG_LOUD, ("PHY_SetMonitorMode8192S(): enable monitor mode\n")); + + pHalData->bInMonitorMode = TRUE; + pAdapter->HalFunc.AllowAllDestAddrHandler(pAdapter, TRUE, TRUE); + rtw_hal_set_hwreg(pAdapter, HW_VAR_CHECK_BSSID, (pu1Byte)&bFilterOutNonAssociatedBSSID); + } + else + { + bFilterOutNonAssociatedBSSID = TRUE; + RT_TRACE(COMP_RM, DBG_LOUD, ("PHY_SetMonitorMode8192S(): disable monitor mode\n")); + + pAdapter->HalFunc.AllowAllDestAddrHandler(pAdapter, FALSE, TRUE); + pHalData->bInMonitorMode = FALSE; + rtw_hal_set_hwreg(pAdapter, HW_VAR_CHECK_BSSID, (pu1Byte)&bFilterOutNonAssociatedBSSID); + } +#endif +} + + +/*----------------------------------------------------------------------------- + * Function: PHYCheckIsLegalRfPath8190Pci() + * + * Overview: Check different RF type to execute legal judgement. If RF Path is illegal + * We will return false. + * + * Input: NONE + * + * Output: NONE + * + * Return: NONE + * + * Revised History: + * When Who Remark + * 11/15/2007 MHC Create Version 0. + * + *---------------------------------------------------------------------------*/ +BOOLEAN +PHY_CheckIsLegalRfPath8192C( + IN struct adapter *pAdapter, + IN u32 eRFPath) +{ +// HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter); + BOOLEAN rtValue = _TRUE; + + // NOt check RF Path now.! +#if 0 + if (pHalData->RF_Type == RF_1T2R && eRFPath != RF_PATH_A) + { + rtValue = FALSE; + } + if (pHalData->RF_Type == RF_1T2R && eRFPath != RF_PATH_A) + { + + } +#endif + return rtValue; + +} /* PHY_CheckIsLegalRfPath8192C */ + +static VOID _PHY_SetRFPathSwitch( + IN struct adapter *pAdapter, + IN BOOLEAN bMain, + IN BOOLEAN is2T + ) +{ + u8 u1bTmp; + + if(!pAdapter->hw_init_completed) + { + u1bTmp = rtw_read8(pAdapter, REG_LEDCFG2) | BIT7; + rtw_write8(pAdapter, REG_LEDCFG2, u1bTmp); + //PHY_SetBBReg(pAdapter, REG_LEDCFG0, BIT23, 0x01); + PHY_SetBBReg(pAdapter, rFPGA0_XAB_RFParameter, BIT13, 0x01); + } + + if(is2T) + { + if(bMain) + PHY_SetBBReg(pAdapter, rFPGA0_XB_RFInterfaceOE, BIT5|BIT6, 0x1); //92C_Path_A + else + PHY_SetBBReg(pAdapter, rFPGA0_XB_RFInterfaceOE, BIT5|BIT6, 0x2); //BT + } + else + { + + if(bMain) + PHY_SetBBReg(pAdapter, rFPGA0_XA_RFInterfaceOE, 0x300, 0x2); //Main + else + PHY_SetBBReg(pAdapter, rFPGA0_XA_RFInterfaceOE, 0x300, 0x1); //Aux + } + +} + +//return value TRUE => Main; FALSE => Aux + +static BOOLEAN _PHY_QueryRFPathSwitch( + IN struct adapter *pAdapter, + IN BOOLEAN is2T + ) +{ +// if(is2T) +// return _TRUE; + + if(!pAdapter->hw_init_completed) + { + PHY_SetBBReg(pAdapter, REG_LEDCFG0, BIT23, 0x01); + PHY_SetBBReg(pAdapter, rFPGA0_XAB_RFParameter, BIT13, 0x01); + } + + if(is2T) + { + if(PHY_QueryBBReg(pAdapter, rFPGA0_XB_RFInterfaceOE, BIT5|BIT6) == 0x01) + return _TRUE; + else + return _FALSE; + } + else + { + if(PHY_QueryBBReg(pAdapter, rFPGA0_XA_RFInterfaceOE, 0x300) == 0x02) + return _TRUE; + else + return _FALSE; + } +} + + +static VOID +_PHY_DumpRFReg(IN struct adapter *pAdapter) +{ + u32 rfRegValue,rfRegOffset; + + //RTPRINT(FINIT, INIT_RF, ("PHY_DumpRFReg()====>\n")); + + for(rfRegOffset = 0x00;rfRegOffset<=0x30;rfRegOffset++){ + rfRegValue = PHY_QueryRFReg(pAdapter,RF_PATH_A, rfRegOffset, bMaskDWord); + //RTPRINT(FINIT, INIT_RF, (" 0x%02x = 0x%08x\n",rfRegOffset,rfRegValue)); + } + //RTPRINT(FINIT, INIT_RF, ("<===== PHY_DumpRFReg()\n")); +} + + +// +// Move from phycfg.c to gen.c to be code independent later +// +//-------------------------Move to other DIR later----------------------------*/ +#ifdef CONFIG_USB_HCI + +// +// Description: +// To dump all Tx FIFO LLT related link-list table. +// Added by Roger, 2009.03.10. +// +VOID +DumpBBDbgPort_92CU( + IN struct adapter * Adapter + ) +{ + + //RT_TRACE(COMP_SEND, DBG_WARNING, ("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n")); + //RT_TRACE(COMP_SEND, DBG_WARNING, ("BaseBand Debug Ports:\n")); + + PHY_SetBBReg(Adapter, 0x0908, 0xffff, 0x0000); + //RT_TRACE(COMP_SEND, DBG_WARNING, ("Offset[%x]: %x\n", 0xdf4, PHY_QueryBBReg(Adapter, 0x0df4, bMaskDWord))); + + PHY_SetBBReg(Adapter, 0x0908, 0xffff, 0x0803); + //RT_TRACE(COMP_SEND, DBG_WARNING, ("Offset[%x]: %x\n", 0xdf4, PHY_QueryBBReg(Adapter, 0x0df4, bMaskDWord))); + + PHY_SetBBReg(Adapter, 0x0908, 0xffff, 0x0a06); + //RT_TRACE(COMP_SEND, DBG_WARNING, ("Offset[%x]: %x\n", 0xdf4, PHY_QueryBBReg(Adapter, 0x0df4, bMaskDWord))); + + PHY_SetBBReg(Adapter, 0x0908, 0xffff, 0x0007); + //RT_TRACE(COMP_SEND, DBG_WARNING, ("Offset[%x]: %x\n", 0xdf4, PHY_QueryBBReg(Adapter, 0x0df4, bMaskDWord))); + + PHY_SetBBReg(Adapter, 0x0908, 0xffff, 0x0100); + PHY_SetBBReg(Adapter, 0x0a28, 0x00ff0000, 0x000f0000); + //RT_TRACE(COMP_SEND, DBG_WARNING, ("Offset[%x]: %x\n", 0xdf4, PHY_QueryBBReg(Adapter, 0x0df4, bMaskDWord))); + + PHY_SetBBReg(Adapter, 0x0908, 0xffff, 0x0100); + PHY_SetBBReg(Adapter, 0x0a28, 0x00ff0000, 0x00150000); + //RT_TRACE(COMP_SEND, DBG_WARNING, ("Offset[%x]: %x\n", 0xdf4, PHY_QueryBBReg(Adapter, 0x0df4, bMaskDWord))); + + //RT_TRACE(COMP_SEND, DBG_WARNING, ("Offset[%x]: %x\n", 0x800, PHY_QueryBBReg(Adapter, 0x0800, bMaskDWord))); + //RT_TRACE(COMP_SEND, DBG_WARNING, ("Offset[%x]: %x\n", 0x900, PHY_QueryBBReg(Adapter, 0x0900, bMaskDWord))); + //RT_TRACE(COMP_SEND, DBG_WARNING, ("Offset[%x]: %x\n", 0xa00, PHY_QueryBBReg(Adapter, 0x0a00, bMaskDWord))); + //RT_TRACE(COMP_SEND, DBG_WARNING, ("Offset[%x]: %x\n", 0xa54, PHY_QueryBBReg(Adapter, 0x0a54, bMaskDWord))); + //RT_TRACE(COMP_SEND, DBG_WARNING, ("Offset[%x]: %x\n", 0xa58, PHY_QueryBBReg(Adapter, 0x0a58, bMaskDWord))); + +} +#endif diff --git a/hal/rtl8188e_rf6052.c b/hal/rtl8188e_rf6052.c index 08744e8..f709de8 100755 --- a/hal/rtl8188e_rf6052.c +++ b/hal/rtl8188e_rf6052.c @@ -1,1272 +1,1271 @@ -/****************************************************************************** - * - * 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 - * - * - ******************************************************************************/ -/****************************************************************************** - * - * - * Module: rtl8192c_rf6052.c ( Source C File) - * - * Note: Provide RF 6052 series relative API. - * - * Function: - * - * Export: - * - * Abbrev: - * - * History: - * Data Who Remark - * - * 09/25/2008 MHC Create initial version. - * 11/05/2008 MHC Add API for tw power setting. - * - * -******************************************************************************/ - -#define _RTL8188E_RF6052_C_ - -#include -#include -#include -#include - -#include - -/*---------------------------Define Local Constant---------------------------*/ -// Define local structure for debug!!!!! -typedef struct RF_Shadow_Compare_Map { - // Shadow register value - u32 Value; - // Compare or not flag - u8 Compare; - // Record If it had ever modified unpredicted - u8 ErrorOrNot; - // Recorver Flag - u8 Recorver; - // - u8 Driver_Write; -}RF_SHADOW_T; -/*---------------------------Define Local Constant---------------------------*/ - - -/*------------------------Define global variable-----------------------------*/ -/*------------------------Define global variable-----------------------------*/ - - -/*------------------------Define local variable------------------------------*/ -// 2008/11/20 MH For Debug only, RF -//static RF_SHADOW_T RF_Shadow[RF6052_MAX_PATH][RF6052_MAX_REG] = {0}; -static RF_SHADOW_T RF_Shadow[RF6052_MAX_PATH][RF6052_MAX_REG]; -/*------------------------Define local variable------------------------------*/ - - -/*----------------------------------------------------------------------------- - * Function: RF_ChangeTxPath - * - * Overview: For RL6052, we must change some RF settign for 1T or 2T. - * - * Input: u2Byte DataRate // 0x80-8f, 0x90-9f - * - * Output: NONE - * - * Return: NONE - * - * Revised History: - * When Who Remark - * 09/25/2008 MHC Create Version 0. - * Firmwaer support the utility later. - * - *---------------------------------------------------------------------------*/ -void rtl8188e_RF_ChangeTxPath( IN struct adapter *Adapter, - IN u16 DataRate) -{ -// We do not support gain table change inACUT now !!!! Delete later !!! -#if 0//(RTL92SE_FPGA_VERIFY == 0) - static u1Byte RF_Path_Type = 2; // 1 = 1T 2= 2T - static u4Byte tx_gain_tbl1[6] - = {0x17f50, 0x11f40, 0x0cf30, 0x08720, 0x04310, 0x00100}; - static u4Byte tx_gain_tbl2[6] - = {0x15ea0, 0x10e90, 0x0c680, 0x08250, 0x04040, 0x00030}; - u1Byte i; - - if (RF_Path_Type == 2 && (DataRate&0xF) <= 0x7) - { - // Set TX SYNC power G2G3 loop filter - PHY_SetRFReg(Adapter, (RF_RADIO_PATH_E)RF_PATH_A, - RF_TXPA_G2, bRFRegOffsetMask, 0x0f000); - PHY_SetRFReg(Adapter, (RF_RADIO_PATH_E)RF_PATH_A, - RF_TXPA_G3, bRFRegOffsetMask, 0xeacf1); - - // Change TX AGC gain table - for (i = 0; i < 6; i++) - PHY_SetRFReg(Adapter, (RF_RADIO_PATH_E)RF_PATH_A, - RF_TX_AGC, bRFRegOffsetMask, tx_gain_tbl1[i]); - - // Set PA to high value - PHY_SetRFReg(Adapter, (RF_RADIO_PATH_E)RF_PATH_A, - RF_TXPA_G2, bRFRegOffsetMask, 0x01e39); - } - else if (RF_Path_Type == 1 && (DataRate&0xF) >= 0x8) - { - // Set TX SYNC power G2G3 loop filter - PHY_SetRFReg(Adapter, (RF_RADIO_PATH_E)RF_PATH_A, - RF_TXPA_G2, bRFRegOffsetMask, 0x04440); - PHY_SetRFReg(Adapter, (RF_RADIO_PATH_E)RF_PATH_A, - RF_TXPA_G3, bRFRegOffsetMask, 0xea4f1); - - // Change TX AGC gain table - for (i = 0; i < 6; i++) - PHY_SetRFReg(Adapter, (RF_RADIO_PATH_E)RF_PATH_A, - RF_TX_AGC, bRFRegOffsetMask, tx_gain_tbl2[i]); - - // Set PA low gain - PHY_SetRFReg(Adapter, (RF_RADIO_PATH_E)RF_PATH_A, - RF_TXPA_G2, bRFRegOffsetMask, 0x01e19); - } -#endif - -} /* RF_ChangeTxPath */ - - -/*----------------------------------------------------------------------------- - * Function: PHY_RF6052SetBandwidth() - * - * Overview: This function is called by SetBWModeCallback8190Pci() only - * - * Input: struct adapter * Adapter - * WIRELESS_BANDWIDTH_E Bandwidth //20M or 40M - * - * Output: NONE - * - * Return: NONE - * - * Note: For RF type 0222D - *---------------------------------------------------------------------------*/ -VOID -rtl8188e_PHY_RF6052SetBandwidth( - IN struct adapter * Adapter, - IN HT_CHANNEL_WIDTH Bandwidth) //20M or 40M -{ - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); - - switch(Bandwidth) - { - case HT_CHANNEL_WIDTH_20: - pHalData->RfRegChnlVal[0] = ((pHalData->RfRegChnlVal[0] & 0xfffff3ff) | BIT(10) | BIT(11)); - PHY_SetRFReg(Adapter, RF_PATH_A, RF_CHNLBW, bRFRegOffsetMask, pHalData->RfRegChnlVal[0]); - break; - - case HT_CHANNEL_WIDTH_40: - pHalData->RfRegChnlVal[0] = ((pHalData->RfRegChnlVal[0] & 0xfffff3ff)| BIT(10)); - PHY_SetRFReg(Adapter, RF_PATH_A, RF_CHNLBW, bRFRegOffsetMask, pHalData->RfRegChnlVal[0]); - break; - - default: - //RT_TRACE(COMP_DBG, DBG_LOUD, ("PHY_SetRF8225Bandwidth(): unknown Bandwidth: %#X\n",Bandwidth )); - break; - } - -} - - -/*----------------------------------------------------------------------------- - * Function: PHY_RF6052SetCckTxPower - * - * Overview: - * - * Input: NONE - * - * Output: NONE - * - * Return: NONE - * - * Revised History: - * When Who Remark - * 11/05/2008 MHC Simulate 8192series.. - * - *---------------------------------------------------------------------------*/ - -VOID -rtl8188e_PHY_RF6052SetCckTxPower( - IN struct adapter * Adapter, - IN u8* pPowerlevel) -{ - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); - struct mlme_priv *pmlmepriv = &Adapter->mlmepriv; - struct dm_priv *pdmpriv = &pHalData->dmpriv; - struct mlme_ext_priv *pmlmeext = &Adapter->mlmeextpriv; - //PMGNT_INFO pMgntInfo=&Adapter->MgntInfo; - u32 TxAGC[2]={0, 0}, tmpval=0,pwrtrac_value; - BOOLEAN TurboScanOff = _FALSE; - u8 idx1, idx2; - u8* ptr; - u8 direction; - //FOR CE ,must disable turbo scan - TurboScanOff = _TRUE; - - - if(pmlmeext->sitesurvey_res.state == SCAN_PROCESS) - { - TxAGC[RF_PATH_A] = 0x3f3f3f3f; - TxAGC[RF_PATH_B] = 0x3f3f3f3f; - - TurboScanOff = _TRUE;//disable turbo scan - - if(TurboScanOff) - { - for(idx1=RF_PATH_A; idx1<=RF_PATH_B; idx1++) - { - TxAGC[idx1] = - pPowerlevel[idx1] | (pPowerlevel[idx1]<<8) | - (pPowerlevel[idx1]<<16) | (pPowerlevel[idx1]<<24); -#ifdef CONFIG_USB_HCI - // 2010/10/18 MH For external PA module. We need to limit power index to be less than 0x20. - if (TxAGC[idx1] > 0x20 && pHalData->ExternalPA) - TxAGC[idx1] = 0x20; -#endif - } - } - } - else - { -// 20100427 Joseph: Driver dynamic Tx power shall not affect Tx power. It shall be determined by power training mechanism. -// Currently, we cannot fully disable driver dynamic tx power mechanism because it is referenced by BT coexist mechanism. -// In the future, two mechanism shall be separated from each other and maintained independantly. Thanks for Lanhsin's reminder. - if(pdmpriv->DynamicTxHighPowerLvl == TxHighPwrLevel_Level1) - { - TxAGC[RF_PATH_A] = 0x10101010; - TxAGC[RF_PATH_B] = 0x10101010; - } - else if(pdmpriv->DynamicTxHighPowerLvl == TxHighPwrLevel_Level2) - { - TxAGC[RF_PATH_A] = 0x00000000; - TxAGC[RF_PATH_B] = 0x00000000; - } - else - { - for(idx1=RF_PATH_A; idx1<=RF_PATH_B; idx1++) - { - TxAGC[idx1] = - pPowerlevel[idx1] | (pPowerlevel[idx1]<<8) | - (pPowerlevel[idx1]<<16) | (pPowerlevel[idx1]<<24); - } - - if(pHalData->EEPROMRegulatory==0) - { - tmpval = (pHalData->MCSTxPowerLevelOriginalOffset[0][6]) + - (pHalData->MCSTxPowerLevelOriginalOffset[0][7]<<8); - TxAGC[RF_PATH_A] += tmpval; - - tmpval = (pHalData->MCSTxPowerLevelOriginalOffset[0][14]) + - (pHalData->MCSTxPowerLevelOriginalOffset[0][15]<<24); - TxAGC[RF_PATH_B] += tmpval; - } - } - } - - - ODM_TxPwrTrackAdjust88E(&pHalData->odmpriv, 1, &direction, &pwrtrac_value); - //printk("ODM_TxPwrTrackAdjust88E => direction:%02x, pwrtrac_value:%d \n", direction, pwrtrac_value); - //printk(" ==> TxAGC:0x%08x \n",TxAGC[0] ); - - if (direction == 1) // Increase TX pwoer - { - TxAGC[0] += pwrtrac_value; - TxAGC[1] += pwrtrac_value; - - } - else if (direction == 2) // Decrease TX pwoer - { - TxAGC[0] -= pwrtrac_value; - TxAGC[1] -= pwrtrac_value; - } - - for(idx1=RF_PATH_A; idx1<=RF_PATH_B; idx1++) - { - ptr = (u8*)(&(TxAGC[idx1])); - for(idx2=0; idx2<4; idx2++) - { - if(*ptr > RF6052_MAX_TX_PWR) - *ptr = RF6052_MAX_TX_PWR; - ptr++; - } - } - //printk(" ==> TxAGC:0x%08x \n",TxAGC[0] ); - - // rf-A cck tx power - tmpval = TxAGC[RF_PATH_A]&0xff; - PHY_SetBBReg(Adapter, rTxAGC_A_CCK1_Mcs32, bMaskByte1, tmpval); - //printk("CCK PWR 1M (rf-A) = 0x%x (reg 0x%x)\n", tmpval, rTxAGC_A_CCK1_Mcs32); - - - tmpval = TxAGC[RF_PATH_A]>>8; - PHY_SetBBReg(Adapter, rTxAGC_B_CCK11_A_CCK2_11, 0xffffff00, tmpval); - //printk("CCK PWR 2~11M (rf-A) = 0x%x (reg 0x%x)\n", tmpval, rTxAGC_B_CCK11_A_CCK2_11); - -/* - // rf-B cck tx power - tmpval = TxAGC[RF_PATH_B]>>24; - PHY_SetBBReg(Adapter, rTxAGC_B_CCK11_A_CCK2_11, bMaskByte0, tmpval); - //printk("CCK PWR 11M (rf-B) = 0x%x (reg 0x%x)\n", tmpval, rTxAGC_B_CCK11_A_CCK2_11); - tmpval = TxAGC[RF_PATH_B]&0x00ffffff; - PHY_SetBBReg(Adapter, rTxAGC_B_CCK1_55_Mcs32, 0xffffff00, tmpval); - //printk("CCK PWR 1~5.5M (rf-B) = 0x%x (reg 0x%x)\n",tmpval, rTxAGC_B_CCK1_55_Mcs32); -*/ -} /* PHY_RF6052SetCckTxPower */ - -#if 0 -// -// powerbase0 for OFDM rates -// powerbase1 for HT MCS rates -// -static void getPowerBase( - IN struct adapter *Adapter, - IN u8* pPowerLevel, - IN u8 Channel, - IN OUT u32* OfdmBase, - IN OUT u32* MCSBase - ) -{ - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); - u32 powerBase0, powerBase1; - u8 Legacy_pwrdiff=0, HT20_pwrdiff=0; - u8 i, powerlevel[2]; - - for(i=0; i<2; i++) - { - powerlevel[i] = pPowerLevel[i]; - Legacy_pwrdiff = pHalData->TxPwrLegacyHtDiff[i][Channel-1]; - powerBase0 = powerlevel[i] + Legacy_pwrdiff; - - powerBase0 = (powerBase0<<24) | (powerBase0<<16) |(powerBase0<<8) |powerBase0; - *(OfdmBase+i) = powerBase0; - //RTPRINT(FPHY, PHY_TXPWR, (" [OFDM power base index rf(%c) = 0x%x]\n", ((i==0)?'A':'B'), *(OfdmBase+i))); - } - - for(i=0; i<2; i++) - { - //Check HT20 to HT40 diff - if(pHalData->CurrentChannelBW == HT_CHANNEL_WIDTH_20) - { - HT20_pwrdiff = pHalData->TxPwrHt20Diff[i][Channel-1]; - powerlevel[i] += HT20_pwrdiff; - } - powerBase1 = powerlevel[i]; - powerBase1 = (powerBase1<<24) | (powerBase1<<16) |(powerBase1<<8) |powerBase1; - *(MCSBase+i) = powerBase1; - //RTPRINT(FPHY, PHY_TXPWR, (" [MCS power base index rf(%c) = 0x%x]\n", ((i==0)?'A':'B'), *(MCSBase+i))); - } -} -#endif -// -// powerbase0 for OFDM rates -// powerbase1 for HT MCS rates -// -void getPowerBase88E( - IN struct adapter *Adapter, - IN u8* pPowerLevelOFDM, - IN u8* pPowerLevelBW20, - IN u8* pPowerLevelBW40, - IN u8 Channel, - IN OUT u32* OfdmBase, - IN OUT u32* MCSBase - ) -{ - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); - u32 powerBase0, powerBase1; - u8 Legacy_pwrdiff=0; - s8 HT20_pwrdiff=0; - u8 i, powerlevel[2]; - - for(i=0; i<2; i++) - { - powerBase0 = pPowerLevelOFDM[i]; - - powerBase0 = (powerBase0<<24) | (powerBase0<<16) |(powerBase0<<8) |powerBase0; - *(OfdmBase+i) = powerBase0; - //DBG_871X(" [OFDM power base index rf(%c) = 0x%x]\n", ((i==0)?'A':'B'), *(OfdmBase+i)); - } - - for(i=0; iNumTotalRFPath; i++) - { - //Check HT20 to HT40 diff - if(pHalData->CurrentChannelBW == HT_CHANNEL_WIDTH_20) - { - powerlevel[i] = pPowerLevelBW20[i]; - } - else - { - powerlevel[i] = pPowerLevelBW40[i]; - } - powerBase1 = powerlevel[i]; - powerBase1 = (powerBase1<<24) | (powerBase1<<16) |(powerBase1<<8) |powerBase1; - *(MCSBase+i) = powerBase1; - //DBG_871X(" [MCS power base index rf(%c) = 0x%x]\n", ((i==0)?'A':'B'), *(MCSBase+i)); - } -} -#if 0 -static void getTxPowerWriteValByRegulatory( - IN struct adapter *Adapter, - IN u8 Channel, - IN u8 index, - IN u32* powerBase0, - IN u32* powerBase1, - OUT u32* pOutWriteVal - ) -{ - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); - struct dm_priv *pdmpriv = &pHalData->dmpriv; - u8 i, chnlGroup, pwr_diff_limit[4]; - u32 writeVal, customer_limit, rf; - - // - // Index 0 & 1= legacy OFDM, 2-5=HT_MCS rate - // - for(rf=0; rf<2; rf++) - { - switch(pHalData->EEPROMRegulatory) - { - case 0: // Realtek better performance - // increase power diff defined by Realtek for large power - chnlGroup = 0; - //RTPRINT(FPHY, PHY_TXPWR, ("MCSTxPowerLevelOriginalOffset[%d][%d] = 0x%x\n", - // chnlGroup, index, pHalData->MCSTxPowerLevelOriginalOffset[chnlGroup][index+(rf?8:0)])); - writeVal = pHalData->MCSTxPowerLevelOriginalOffset[chnlGroup][index+(rf?8:0)] + - ((index<2)?powerBase0[rf]:powerBase1[rf]); - //RTPRINT(FPHY, PHY_TXPWR, ("RTK better performance, writeVal(%c) = 0x%x\n", ((rf==0)?'A':'B'), writeVal)); - break; - case 1: // Realtek regulatory - // increase power diff defined by Realtek for regulatory - { - if(pHalData->pwrGroupCnt == 1) - chnlGroup = 0; - if(pHalData->pwrGroupCnt >= 3) - { - if(Channel <= 3) - chnlGroup = 0; - else if(Channel >= 4 && Channel <= 9) - chnlGroup = 1; - else if(Channel > 9) - chnlGroup = 2; - - if(pHalData->CurrentChannelBW == HT_CHANNEL_WIDTH_20) - chnlGroup++; - else - chnlGroup+=4; - } - //RTPRINT(FPHY, PHY_TXPWR, ("MCSTxPowerLevelOriginalOffset[%d][%d] = 0x%x\n", - //chnlGroup, index, pHalData->MCSTxPowerLevelOriginalOffset[chnlGroup][index+(rf?8:0)])); - writeVal = pHalData->MCSTxPowerLevelOriginalOffset[chnlGroup][index+(rf?8:0)] + - ((index<2)?powerBase0[rf]:powerBase1[rf]); - //RTPRINT(FPHY, PHY_TXPWR, ("Realtek regulatory, 20MHz, writeVal(%c) = 0x%x\n", ((rf==0)?'A':'B'), writeVal)); - } - break; - case 2: // Better regulatory - // don't increase any power diff - writeVal = ((index<2)?powerBase0[rf]:powerBase1[rf]); - //RTPRINT(FPHY, PHY_TXPWR, ("Better regulatory, writeVal(%c) = 0x%x\n", ((rf==0)?'A':'B'), writeVal)); - break; - case 3: // Customer defined power diff. - // increase power diff defined by customer. - chnlGroup = 0; - //RTPRINT(FPHY, PHY_TXPWR, ("MCSTxPowerLevelOriginalOffset[%d][%d] = 0x%x\n", - // chnlGroup, index, pHalData->MCSTxPowerLevelOriginalOffset[chnlGroup][index+(rf?8:0)])); - - if (pHalData->CurrentChannelBW == HT_CHANNEL_WIDTH_40) - { - //RTPRINT(FPHY, PHY_TXPWR, ("customer's limit, 40MHz rf(%c) = 0x%x\n", - // ((rf==0)?'A':'B'), pHalData->PwrGroupHT40[rf][Channel-1])); - } - else - { - //RTPRINT(FPHY, PHY_TXPWR, ("customer's limit, 20MHz rf(%c) = 0x%x\n", - // ((rf==0)?'A':'B'), pHalData->PwrGroupHT20[rf][Channel-1])); - } - for (i=0; i<4; i++) - { - pwr_diff_limit[i] = (u8)((pHalData->MCSTxPowerLevelOriginalOffset[chnlGroup][index+(rf?8:0)]&(0x7f<<(i*8)))>>(i*8)); - if (pHalData->CurrentChannelBW == HT_CHANNEL_WIDTH_40) - { - if(pwr_diff_limit[i] > pHalData->PwrGroupHT40[rf][Channel-1]) - pwr_diff_limit[i] = pHalData->PwrGroupHT40[rf][Channel-1]; - } - else - { - if(pwr_diff_limit[i] > pHalData->PwrGroupHT20[rf][Channel-1]) - pwr_diff_limit[i] = pHalData->PwrGroupHT20[rf][Channel-1]; - } - } - customer_limit = (pwr_diff_limit[3]<<24) | (pwr_diff_limit[2]<<16) | - (pwr_diff_limit[1]<<8) | (pwr_diff_limit[0]); - //RTPRINT(FPHY, PHY_TXPWR, ("Customer's limit rf(%c) = 0x%x\n", ((rf==0)?'A':'B'), customer_limit)); - - writeVal = customer_limit + ((index<2)?powerBase0[rf]:powerBase1[rf]); - //RTPRINT(FPHY, PHY_TXPWR, ("Customer, writeVal rf(%c)= 0x%x\n", ((rf==0)?'A':'B'), writeVal)); - break; - default: - chnlGroup = 0; - writeVal = pHalData->MCSTxPowerLevelOriginalOffset[chnlGroup][index+(rf?8:0)] + - ((index<2)?powerBase0[rf]:powerBase1[rf]); - //RTPRINT(FPHY, PHY_TXPWR, ("RTK better performance, writeVal rf(%c) = 0x%x\n", ((rf==0)?'A':'B'), writeVal)); - break; - } - -// 20100427 Joseph: Driver dynamic Tx power shall not affect Tx power. It shall be determined by power training mechanism. -// Currently, we cannot fully disable driver dynamic tx power mechanism because it is referenced by BT coexist mechanism. -// In the future, two mechanism shall be separated from each other and maintained independantly. Thanks for Lanhsin's reminder. - - if(pdmpriv->DynamicTxHighPowerLvl == TxHighPwrLevel_Level1) - writeVal = 0x14141414; - else if(pdmpriv->DynamicTxHighPowerLvl == TxHighPwrLevel_Level2) - writeVal = 0x00000000; - - - // 20100628 Joseph: High power mode for BT-Coexist mechanism. - // This mechanism is only applied when Driver-Highpower-Mechanism is OFF. - if(pdmpriv->DynamicTxHighPowerLvl == TxHighPwrLevel_BT1) - { - //RTPRINT(FBT, BT_TRACE, ("Tx Power (-6)\n")); - writeVal = writeVal - 0x06060606; - } - else if(pdmpriv->DynamicTxHighPowerLvl == TxHighPwrLevel_BT2) - { - //RTPRINT(FBT, BT_TRACE, ("Tx Power (-0)\n")); - writeVal = writeVal; - } - *(pOutWriteVal+rf) = writeVal; - } -} -#endif -void getTxPowerWriteValByRegulatory88E( - IN struct adapter *Adapter, - IN u8 Channel, - IN u8 index, - IN u32* powerBase0, - IN u32* powerBase1, - OUT u32* pOutWriteVal - ) -{ - - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); - struct dm_priv *pdmpriv = &pHalData->dmpriv; - u1Byte i, chnlGroup=0, pwr_diff_limit[4], customer_pwr_limit; - s1Byte pwr_diff=0; - u4Byte writeVal, customer_limit, rf; - u1Byte Regulatory = pHalData->EEPROMRegulatory; - - // - // Index 0 & 1= legacy OFDM, 2-5=HT_MCS rate - // -#if 0 // (INTEL_PROXIMITY_SUPPORT == 1) - if(pMgntInfo->IntelProximityModeInfo.PowerOutput > 0) - Regulatory = 2; -#endif - - for(rf=0; rf<2; rf++) - { - switch(Regulatory) - { - case 0: // Realtek better performance - // increase power diff defined by Realtek for large power - chnlGroup = 0; - //RTPRINT(FPHY, PHY_TXPWR, ("MCSTxPowerLevelOriginalOffset[%d][%d] = 0x%x\n", - // chnlGroup, index, pHalData->MCSTxPowerLevelOriginalOffset[chnlGroup][index+(rf?8:0)])); - writeVal = pHalData->MCSTxPowerLevelOriginalOffset[chnlGroup][index+(rf?8:0)] + - ((index<2)?powerBase0[rf]:powerBase1[rf]); - //RTPRINT(FPHY, PHY_TXPWR, ("RTK better performance, writeVal(%c) = 0x%x\n", ((rf==0)?'A':'B'), writeVal)); - break; - case 1: // Realtek regulatory - // increase power diff defined by Realtek for regulatory - { - if(pHalData->pwrGroupCnt == 1) - chnlGroup = 0; - //if(pHalData->pwrGroupCnt >= pHalData->PGMaxGroup) - { - if (Channel < 3) // Chanel 1-2 - chnlGroup = 0; - else if (Channel < 6) // Channel 3-5 - chnlGroup = 1; - else if(Channel <9) // Channel 6-8 - chnlGroup = 2; - else if(Channel <12) // Channel 9-11 - chnlGroup = 3; - else if(Channel <14) // Channel 12-13 - chnlGroup = 4; - else if(Channel ==14) // Channel 14 - chnlGroup = 4; - - if(pHalData->CurrentChannelBW == HT_CHANNEL_WIDTH_20) - chnlGroup++; - else - chnlGroup+=6; - -/* - if(Channel <= 3) - chnlGroup = 0; - else if(Channel >= 4 && Channel <= 9) - chnlGroup = 1; - else if(Channel > 9) - chnlGroup = 2; - - - if(pHalData->CurrentChannelBW == HT_CHANNEL_WIDTH_20) - chnlGroup++; - else - chnlGroup+=4; -*/ - } - //RTPRINT(FPHY, PHY_TXPWR, ("MCSTxPowerLevelOriginalOffset[%d][%d] = 0x%x\n", - //chnlGroup, index, pHalData->MCSTxPowerLevelOriginalOffset[chnlGroup][index+(rf?8:0)])); - writeVal = pHalData->MCSTxPowerLevelOriginalOffset[chnlGroup][index+(rf?8:0)] + - ((index<2)?powerBase0[rf]:powerBase1[rf]); - //RTPRINT(FPHY, PHY_TXPWR, ("Realtek regulatory, 20MHz, writeVal(%c) = 0x%x\n", ((rf==0)?'A':'B'), writeVal)); - } - break; - case 2: // Better regulatory - // don't increase any power diff - writeVal = ((index<2)?powerBase0[rf]:powerBase1[rf]); - //RTPRINT(FPHY, PHY_TXPWR, ("Better regulatory, writeVal(%c) = 0x%x\n", ((rf==0)?'A':'B'), writeVal)); - break; - case 3: // Customer defined power diff. - // increase power diff defined by customer. - chnlGroup = 0; - //RTPRINT(FPHY, PHY_TXPWR, ("MCSTxPowerLevelOriginalOffset[%d][%d] = 0x%x\n", - // chnlGroup, index, pHalData->MCSTxPowerLevelOriginalOffset[chnlGroup][index+(rf?8:0)])); - - /* - if (pHalData->CurrentChannelBW == HT_CHANNEL_WIDTH_20_40) - { - RTPRINT(FPHY, PHY_TXPWR, ("customer's limit, 40MHz rf(%c) = 0x%x\n", - ((rf==0)?'A':'B'), pHalData->PwrGroupHT40[rf][Channel-1])); - } - else - { - RTPRINT(FPHY, PHY_TXPWR, ("customer's limit, 20MHz rf(%c) = 0x%x\n", - ((rf==0)?'A':'B'), pHalData->PwrGroupHT20[rf][Channel-1])); - }*/ - - if(index < 2) - pwr_diff = pHalData->TxPwrLegacyHtDiff[rf][Channel-1]; - else if (pHalData->CurrentChannelBW == HT_CHANNEL_WIDTH_20) - pwr_diff = pHalData->TxPwrHt20Diff[rf][Channel-1]; - - //RTPRINT(FPHY, PHY_TXPWR, ("power diff rf(%c) = 0x%x\n", ((rf==0)?'A':'B'), pwr_diff)); - - if (pHalData->CurrentChannelBW == HT_CHANNEL_WIDTH_40) - customer_pwr_limit = pHalData->PwrGroupHT40[rf][Channel-1]; - else - customer_pwr_limit = pHalData->PwrGroupHT20[rf][Channel-1]; - - //RTPRINT(FPHY, PHY_TXPWR, ("customer pwr limit rf(%c) = 0x%x\n", ((rf==0)?'A':'B'), customer_pwr_limit)); - - if(pwr_diff >= customer_pwr_limit) - pwr_diff = 0; - else - pwr_diff = customer_pwr_limit - pwr_diff; - - for (i=0; i<4; i++) - { - pwr_diff_limit[i] = (u1Byte)((pHalData->MCSTxPowerLevelOriginalOffset[chnlGroup][index+(rf?8:0)]&(0x7f<<(i*8)))>>(i*8)); - - if(pwr_diff_limit[i] > pwr_diff) - pwr_diff_limit[i] = pwr_diff; - } - customer_limit = (pwr_diff_limit[3]<<24) | (pwr_diff_limit[2]<<16) | - (pwr_diff_limit[1]<<8) | (pwr_diff_limit[0]); - //RTPRINT(FPHY, PHY_TXPWR, ("Customer's limit rf(%c) = 0x%x\n", ((rf==0)?'A':'B'), customer_limit)); - writeVal = customer_limit + ((index<2)?powerBase0[rf]:powerBase1[rf]); - //RTPRINT(FPHY, PHY_TXPWR, ("Customer, writeVal rf(%c)= 0x%x\n", ((rf==0)?'A':'B'), writeVal)); - break; - default: - chnlGroup = 0; - writeVal = pHalData->MCSTxPowerLevelOriginalOffset[chnlGroup][index+(rf?8:0)] + - ((index<2)?powerBase0[rf]:powerBase1[rf]); - //RTPRINT(FPHY, PHY_TXPWR, ("RTK better performance, writeVal rf(%c) = 0x%x\n", ((rf==0)?'A':'B'), writeVal)); - break; - } - -// 20100427 Joseph: Driver dynamic Tx power shall not affect Tx power. It shall be determined by power training mechanism. -// Currently, we cannot fully disable driver dynamic tx power mechanism because it is referenced by BT coexist mechanism. -// In the future, two mechanism shall be separated from each other and maintained independantly. Thanks for Lanhsin's reminder. - //92d do not need this - if(pdmpriv->DynamicTxHighPowerLvl == TxHighPwrLevel_Level1) - writeVal = 0x14141414; - else if(pdmpriv->DynamicTxHighPowerLvl == TxHighPwrLevel_Level2) - writeVal = 0x00000000; - - // 20100628 Joseph: High power mode for BT-Coexist mechanism. - // This mechanism is only applied when Driver-Highpower-Mechanism is OFF. - if(pdmpriv->DynamicTxHighPowerLvl == TxHighPwrLevel_BT1) - { - //RTPRINT(FBT, BT_TRACE, ("Tx Power (-6)\n")); - writeVal = writeVal - 0x06060606; - } - else if(pdmpriv->DynamicTxHighPowerLvl == TxHighPwrLevel_BT2) - { - //RTPRINT(FBT, BT_TRACE, ("Tx Power (-0)\n")); - writeVal = writeVal ; - } - /* - if(pMgntInfo->bDisableTXPowerByRate) - { - // add for OID_RT_11N_TX_POWER_BY_RATE ,disable tx powre change by rate - writeVal = 0x2c2c2c2c; - } - */ - *(pOutWriteVal+rf) = writeVal; - } -} - -static void writeOFDMPowerReg88E( - IN struct adapter *Adapter, - IN u8 index, - IN u32* pValue - ) -{ - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); - u16 RegOffset_A[6] = { rTxAGC_A_Rate18_06, rTxAGC_A_Rate54_24, - rTxAGC_A_Mcs03_Mcs00, rTxAGC_A_Mcs07_Mcs04, - rTxAGC_A_Mcs11_Mcs08, rTxAGC_A_Mcs15_Mcs12}; - u16 RegOffset_B[6] = { rTxAGC_B_Rate18_06, rTxAGC_B_Rate54_24, - rTxAGC_B_Mcs03_Mcs00, rTxAGC_B_Mcs07_Mcs04, - rTxAGC_B_Mcs11_Mcs08, rTxAGC_B_Mcs15_Mcs12}; - u8 i, rf, pwr_val[4]; - u32 writeVal; - u16 RegOffset; - - for(rf=0; rf<2; rf++) - { - writeVal = pValue[rf]; - for(i=0; i<4; i++) - { - pwr_val[i] = (u8)((writeVal & (0x7f<<(i*8)))>>(i*8)); - if (pwr_val[i] > RF6052_MAX_TX_PWR) - pwr_val[i] = RF6052_MAX_TX_PWR; - } - writeVal = (pwr_val[3]<<24) | (pwr_val[2]<<16) |(pwr_val[1]<<8) |pwr_val[0]; - - if(rf == 0) - RegOffset = RegOffset_A[index]; - else - RegOffset = RegOffset_B[index]; - - PHY_SetBBReg(Adapter, RegOffset, bMaskDWord, writeVal); - //printk("Set OFDM tx pwr- 0x%x = %08x\n", RegOffset, writeVal); - - // 201005115 Joseph: Set Tx Power diff for Tx power training mechanism. - if(((pHalData->rf_type == RF_2T2R) && - (RegOffset == rTxAGC_A_Mcs15_Mcs12 || RegOffset == rTxAGC_B_Mcs15_Mcs12))|| - ((pHalData->rf_type != RF_2T2R) && - (RegOffset == rTxAGC_A_Mcs07_Mcs04 || RegOffset == rTxAGC_B_Mcs07_Mcs04)) ) - { - writeVal = pwr_val[3]; - if(RegOffset == rTxAGC_A_Mcs15_Mcs12 || RegOffset == rTxAGC_A_Mcs07_Mcs04) - RegOffset = 0xc90; - if(RegOffset == rTxAGC_B_Mcs15_Mcs12 || RegOffset == rTxAGC_B_Mcs07_Mcs04) - RegOffset = 0xc98; - for(i=0; i<3; i++) - { - if(i!=2) - writeVal = (writeVal>8)?(writeVal-8):0; - else - writeVal = (writeVal>6)?(writeVal-6):0; - rtw_write8(Adapter, (u32)(RegOffset+i), (u8)writeVal); - } - } - } -} - - -/*----------------------------------------------------------------------------- - * Function: PHY_RF6052SetOFDMTxPower - * - * Overview: For legacy and HY OFDM, we must read EEPROM TX power index for - * different channel and read original value in TX power register area from - * 0xe00. We increase offset and original value to be correct tx pwr. - * - * Input: NONE - * - * Output: NONE - * - * Return: NONE - * - * Revised History: - * When Who Remark - * 11/05/2008 MHC Simulate 8192 series method. - * 01/06/2009 MHC 1. Prevent Path B tx power overflow or underflow dure to - * A/B pwr difference or legacy/HT pwr diff. - * 2. We concern with path B legacy/HT OFDM difference. - * 01/22/2009 MHC Support new EPRO format from SD3. - * - *---------------------------------------------------------------------------*/ - -VOID -rtl8188e_PHY_RF6052SetOFDMTxPower( - IN struct adapter *Adapter, - IN u8* pPowerLevelOFDM, - IN u8* pPowerLevelBW20, - IN u8* pPowerLevelBW40, - IN u8 Channel) -{ - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); - u32 writeVal[2], powerBase0[2], powerBase1[2], pwrtrac_value; - u8 direction; - u8 index = 0; - - - //DBG_871X("PHY_RF6052SetOFDMTxPower, channel(%d) \n", Channel); - - getPowerBase88E(Adapter, pPowerLevelOFDM,pPowerLevelBW20,pPowerLevelBW40, Channel, &powerBase0[0], &powerBase1[0]); - - // - // 2012/04/23 MH According to power tracking value, we need to revise OFDM tx power. - // This is ued to fix unstable power tracking mode. - // - ODM_TxPwrTrackAdjust88E(&pHalData->odmpriv, 0, &direction, &pwrtrac_value); - - for(index=0; index<6; index++) - { - getTxPowerWriteValByRegulatory88E(Adapter, Channel, index, - &powerBase0[0], &powerBase1[0], &writeVal[0]); - - if (direction == 1) - { - writeVal[0] += pwrtrac_value; - writeVal[1] += pwrtrac_value; - } - else if (direction == 2) - { - writeVal[0] -= pwrtrac_value; - writeVal[1] -= pwrtrac_value; - } - - writeOFDMPowerReg88E(Adapter, index, &writeVal[0]); - } -} - - -static VOID -phy_RF6052_Config_HardCode( - IN struct adapter * Adapter - ) -{ - - // Set Default Bandwidth to 20M - //Adapter->HalFunc .SetBWModeHandler(Adapter, HT_CHANNEL_WIDTH_20); - - // TODO: Set Default Channel to channel one for RTL8225 - -} - -static int -phy_RF6052_Config_ParaFile( - IN struct adapter * Adapter - ) -{ - u32 u4RegValue; - u8 eRFPath; - BB_REGISTER_DEFINITION_T *pPhyReg; - - int rtStatus = _SUCCESS; - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); - - static char sz88eRadioAFile[] = RTL8188E_PHY_RADIO_A; - static char sz88eRadioBFile[] = RTL8188E_PHY_RADIO_B; - char *pszRadioAFile, *pszRadioBFile; - - - - pszRadioAFile = sz88eRadioAFile; - pszRadioBFile = sz88eRadioBFile; - - - //3//----------------------------------------------------------------- - //3// <2> Initialize RF - //3//----------------------------------------------------------------- - //for(eRFPath = RF_PATH_A; eRFPath NumTotalRFPath; eRFPath++) - for(eRFPath = 0; eRFPath NumTotalRFPath; eRFPath++) - { - - pPhyReg = &pHalData->PHYRegDef[eRFPath]; - - /*----Store original RFENV control type----*/ - switch(eRFPath) - { - case RF_PATH_A: - case RF_PATH_C: - u4RegValue = PHY_QueryBBReg(Adapter, pPhyReg->rfintfs, bRFSI_RFENV); - break; - case RF_PATH_B : - case RF_PATH_D: - u4RegValue = PHY_QueryBBReg(Adapter, pPhyReg->rfintfs, bRFSI_RFENV<<16); - break; - } - - /*----Set RF_ENV enable----*/ - PHY_SetBBReg(Adapter, pPhyReg->rfintfe, bRFSI_RFENV<<16, 0x1); - rtw_udelay_os(1);//PlatformStallExecution(1); - - /*----Set RF_ENV output high----*/ - PHY_SetBBReg(Adapter, pPhyReg->rfintfo, bRFSI_RFENV, 0x1); - rtw_udelay_os(1);//PlatformStallExecution(1); - - /* Set bit number of Address and Data for RF register */ - PHY_SetBBReg(Adapter, pPhyReg->rfHSSIPara2, b3WireAddressLength, 0x0); // Set 1 to 4 bits for 8255 - rtw_udelay_os(1);//PlatformStallExecution(1); - - PHY_SetBBReg(Adapter, pPhyReg->rfHSSIPara2, b3WireDataLength, 0x0); // Set 0 to 12 bits for 8255 - rtw_udelay_os(1);//PlatformStallExecution(1); - - /*----Initialize RF fom connfiguration file----*/ - switch(eRFPath) - { - case RF_PATH_A: -#ifdef CONFIG_EMBEDDED_FWIMG - #ifdef CONFIG_PHY_SETTING_WITH_ODM - if(HAL_STATUS_FAILURE ==ODM_ConfigRFWithHeaderFile(&pHalData->odmpriv,(ODM_RF_RADIO_PATH_E)eRFPath, (ODM_RF_RADIO_PATH_E)eRFPath)) - rtStatus= _FAIL; - #else - rtStatus= rtl8188e_PHY_ConfigRFWithHeaderFile(Adapter,(RF_RADIO_PATH_E)eRFPath); - #endif//#ifdef CONFIG_PHY_SETTING_WITH_ODM -#else - rtStatus = rtl8188e_PHY_ConfigRFWithParaFile(Adapter, pszRadioAFile, (RF_RADIO_PATH_E)eRFPath); -#endif//#ifdef CONFIG_EMBEDDED_FWIMG - break; - case RF_PATH_B: -#ifdef CONFIG_EMBEDDED_FWIMG - #ifdef CONFIG_PHY_SETTING_WITH_ODM - if(HAL_STATUS_FAILURE ==ODM_ConfigRFWithHeaderFile(&pHalData->odmpriv,(ODM_RF_RADIO_PATH_E)eRFPath, (ODM_RF_RADIO_PATH_E)eRFPath)) - rtStatus= _FAIL; - #else - rtStatus = rtl8188e_PHY_ConfigRFWithHeaderFile(Adapter,(RF_RADIO_PATH_E)eRFPath); - #endif //#ifdef CONFIG_PHY_SETTING_WITH_ODM -#else - rtStatus =rtl8188e_PHY_ConfigRFWithParaFile(Adapter, pszRadioBFile, (RF_RADIO_PATH_E)eRFPath); -#endif - break; - case RF_PATH_C: - break; - case RF_PATH_D: - break; - } - - /*----Restore RFENV control type----*/; - switch(eRFPath) - { - case RF_PATH_A: - case RF_PATH_C: - PHY_SetBBReg(Adapter, pPhyReg->rfintfs, bRFSI_RFENV, u4RegValue); - break; - case RF_PATH_B : - case RF_PATH_D: - PHY_SetBBReg(Adapter, pPhyReg->rfintfs, bRFSI_RFENV<<16, u4RegValue); - break; - } - - if(rtStatus != _SUCCESS){ - //RT_TRACE(COMP_FPGA, DBG_LOUD, ("phy_RF6052_Config_ParaFile():Radio[%d] Fail!!", eRFPath)); - goto phy_RF6052_Config_ParaFile_Fail; - } - - } - - //RT_TRACE(COMP_INIT, DBG_LOUD, ("<---phy_RF6052_Config_ParaFile()\n")); - return rtStatus; - -phy_RF6052_Config_ParaFile_Fail: - return rtStatus; -} - - -int -PHY_RF6052_Config8188E( - IN struct adapter * Adapter) -{ - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); - int rtStatus = _SUCCESS; - - // - // Initialize general global value - // - // TODO: Extend RF_PATH_C and RF_PATH_D in the future - if(pHalData->rf_type == RF_1T1R) - pHalData->NumTotalRFPath = 1; - else - pHalData->NumTotalRFPath = 2; - - // - // Config BB and RF - // - rtStatus = phy_RF6052_Config_ParaFile(Adapter); -#if 0 - switch( Adapter->MgntInfo.bRegHwParaFile ) - { - case 0: - phy_RF6052_Config_HardCode(Adapter); - break; - - case 1: - rtStatus = phy_RF6052_Config_ParaFile(Adapter); - break; - - case 2: - // Partial Modify. - phy_RF6052_Config_HardCode(Adapter); - phy_RF6052_Config_ParaFile(Adapter); - break; - - default: - phy_RF6052_Config_HardCode(Adapter); - break; - } -#endif - return rtStatus; - -} - - -// -// ==> RF shadow Operation API Code Section!!! -// -/*----------------------------------------------------------------------------- - * Function: PHY_RFShadowRead - * PHY_RFShadowWrite - * PHY_RFShadowCompare - * PHY_RFShadowRecorver - * PHY_RFShadowCompareAll - * PHY_RFShadowRecorverAll - * PHY_RFShadowCompareFlagSet - * PHY_RFShadowRecorverFlagSet - * - * Overview: When we set RF register, we must write shadow at first. - * When we are running, we must compare shadow abd locate error addr. - * Decide to recorver or not. - * - * Input: NONE - * - * Output: NONE - * - * Return: NONE - * - * Revised History: - * When Who Remark - * 11/20/2008 MHC Create Version 0. - * - *---------------------------------------------------------------------------*/ -u32 -PHY_RFShadowRead( - IN struct adapter * Adapter, - IN RF_RADIO_PATH_E eRFPath, - IN u32 Offset) -{ - return RF_Shadow[eRFPath][Offset].Value; - -} /* PHY_RFShadowRead */ - - -VOID -PHY_RFShadowWrite( - IN struct adapter * Adapter, - IN RF_RADIO_PATH_E eRFPath, - IN u32 Offset, - IN u32 Data) -{ - RF_Shadow[eRFPath][Offset].Value = (Data & bRFRegOffsetMask); - RF_Shadow[eRFPath][Offset].Driver_Write = _TRUE; - -} /* PHY_RFShadowWrite */ - - -BOOLEAN -PHY_RFShadowCompare( - IN struct adapter * Adapter, - IN RF_RADIO_PATH_E eRFPath, - IN u32 Offset) -{ - u32 reg; - // Check if we need to check the register - if (RF_Shadow[eRFPath][Offset].Compare == _TRUE) - { - reg = PHY_QueryRFReg(Adapter, eRFPath, Offset, bRFRegOffsetMask); - // Compare shadow and real rf register for 20bits!! - if (RF_Shadow[eRFPath][Offset].Value != reg) - { - // Locate error position. - RF_Shadow[eRFPath][Offset].ErrorOrNot = _TRUE; - //RT_TRACE(COMP_INIT, DBG_LOUD, - //("PHY_RFShadowCompare RF-%d Addr%02lx Err = %05lx\n", - //eRFPath, Offset, reg)); - } - return RF_Shadow[eRFPath][Offset].ErrorOrNot ; - } - return _FALSE; -} /* PHY_RFShadowCompare */ - - -VOID -PHY_RFShadowRecorver( - IN struct adapter * Adapter, - IN RF_RADIO_PATH_E eRFPath, - IN u32 Offset) -{ - // Check if the address is error - if (RF_Shadow[eRFPath][Offset].ErrorOrNot == _TRUE) - { - // Check if we need to recorver the register. - if (RF_Shadow[eRFPath][Offset].Recorver == _TRUE) - { - PHY_SetRFReg(Adapter, eRFPath, Offset, bRFRegOffsetMask, - RF_Shadow[eRFPath][Offset].Value); - //RT_TRACE(COMP_INIT, DBG_LOUD, - //("PHY_RFShadowRecorver RF-%d Addr%02lx=%05lx", - //eRFPath, Offset, RF_Shadow[eRFPath][Offset].Value)); - } - } - -} /* PHY_RFShadowRecorver */ - - -VOID -PHY_RFShadowCompareAll( - IN struct adapter * Adapter) -{ - u32 eRFPath; - u32 Offset; - - for (eRFPath = 0; eRFPath < RF6052_MAX_PATH; eRFPath++) - { - for (Offset = 0; Offset <= RF6052_MAX_REG; Offset++) - { - PHY_RFShadowCompare(Adapter, (RF_RADIO_PATH_E)eRFPath, Offset); - } - } - -} /* PHY_RFShadowCompareAll */ - - -VOID -PHY_RFShadowRecorverAll( - IN struct adapter * Adapter) -{ - u32 eRFPath; - u32 Offset; - - for (eRFPath = 0; eRFPath < RF6052_MAX_PATH; eRFPath++) - { - for (Offset = 0; Offset <= RF6052_MAX_REG; Offset++) - { - PHY_RFShadowRecorver(Adapter, (RF_RADIO_PATH_E)eRFPath, Offset); - } - } - -} /* PHY_RFShadowRecorverAll */ - - -VOID -PHY_RFShadowCompareFlagSet( - IN struct adapter * Adapter, - IN RF_RADIO_PATH_E eRFPath, - IN u32 Offset, - IN u8 Type) -{ - // Set True or False!!! - RF_Shadow[eRFPath][Offset].Compare = Type; - -} /* PHY_RFShadowCompareFlagSet */ - - -VOID -PHY_RFShadowRecorverFlagSet( - IN struct adapter * Adapter, - IN RF_RADIO_PATH_E eRFPath, - IN u32 Offset, - IN u8 Type) -{ - // Set True or False!!! - RF_Shadow[eRFPath][Offset].Recorver= Type; - -} /* PHY_RFShadowRecorverFlagSet */ - - -VOID -PHY_RFShadowCompareFlagSetAll( - IN struct adapter * Adapter) -{ - u32 eRFPath; - u32 Offset; - - for (eRFPath = 0; eRFPath < RF6052_MAX_PATH; eRFPath++) - { - for (Offset = 0; Offset <= RF6052_MAX_REG; Offset++) - { - // 2008/11/20 MH For S3S4 test, we only check reg 26/27 now!!!! - if (Offset != 0x26 && Offset != 0x27) - PHY_RFShadowCompareFlagSet(Adapter, (RF_RADIO_PATH_E)eRFPath, Offset, _FALSE); - else - PHY_RFShadowCompareFlagSet(Adapter, (RF_RADIO_PATH_E)eRFPath, Offset, _TRUE); - } - } - -} /* PHY_RFShadowCompareFlagSetAll */ - - -VOID -PHY_RFShadowRecorverFlagSetAll( - IN struct adapter * Adapter) -{ - u32 eRFPath; - u32 Offset; - - for (eRFPath = 0; eRFPath < RF6052_MAX_PATH; eRFPath++) - { - for (Offset = 0; Offset <= RF6052_MAX_REG; Offset++) - { - // 2008/11/20 MH For S3S4 test, we only check reg 26/27 now!!!! - if (Offset != 0x26 && Offset != 0x27) - PHY_RFShadowRecorverFlagSet(Adapter, (RF_RADIO_PATH_E)eRFPath, Offset, _FALSE); - else - PHY_RFShadowRecorverFlagSet(Adapter, (RF_RADIO_PATH_E)eRFPath, Offset, _TRUE); - } - } - -} /* PHY_RFShadowCompareFlagSetAll */ - -VOID -PHY_RFShadowRefresh( - IN struct adapter * Adapter) -{ - u32 eRFPath; - u32 Offset; - - for (eRFPath = 0; eRFPath < RF6052_MAX_PATH; eRFPath++) - { - for (Offset = 0; Offset <= RF6052_MAX_REG; Offset++) - { - RF_Shadow[eRFPath][Offset].Value = 0; - RF_Shadow[eRFPath][Offset].Compare = _FALSE; - RF_Shadow[eRFPath][Offset].Recorver = _FALSE; - RF_Shadow[eRFPath][Offset].ErrorOrNot = _FALSE; - RF_Shadow[eRFPath][Offset].Driver_Write = _FALSE; - } - } - -} /* PHY_RFShadowRead */ - -/* End of HalRf6052.c */ - +/****************************************************************************** + * + * 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 + * + * + ******************************************************************************/ +/****************************************************************************** + * + * + * Module: rtl8192c_rf6052.c ( Source C File) + * + * Note: Provide RF 6052 series relative API. + * + * Function: + * + * Export: + * + * Abbrev: + * + * History: + * Data Who Remark + * + * 09/25/2008 MHC Create initial version. + * 11/05/2008 MHC Add API for tw power setting. + * + * +******************************************************************************/ + +#define _RTL8188E_RF6052_C_ + +#include +#include +#include +#include + +#include + +/*---------------------------Define Local Constant---------------------------*/ +// Define local structure for debug!!!!! +typedef struct RF_Shadow_Compare_Map { + // Shadow register value + u32 Value; + // Compare or not flag + u8 Compare; + // Record If it had ever modified unpredicted + u8 ErrorOrNot; + // Recorver Flag + u8 Recorver; + // + u8 Driver_Write; +}RF_SHADOW_T; +/*---------------------------Define Local Constant---------------------------*/ + + +/*------------------------Define global variable-----------------------------*/ +/*------------------------Define global variable-----------------------------*/ + + +/*------------------------Define local variable------------------------------*/ +// 2008/11/20 MH For Debug only, RF +//static RF_SHADOW_T RF_Shadow[RF6052_MAX_PATH][RF6052_MAX_REG] = {0}; +static RF_SHADOW_T RF_Shadow[RF6052_MAX_PATH][RF6052_MAX_REG]; +/*------------------------Define local variable------------------------------*/ + + +/*----------------------------------------------------------------------------- + * Function: RF_ChangeTxPath + * + * Overview: For RL6052, we must change some RF settign for 1T or 2T. + * + * Input: u2Byte DataRate // 0x80-8f, 0x90-9f + * + * Output: NONE + * + * Return: NONE + * + * Revised History: + * When Who Remark + * 09/25/2008 MHC Create Version 0. + * Firmwaer support the utility later. + * + *---------------------------------------------------------------------------*/ +void rtl8188e_RF_ChangeTxPath( IN struct adapter *Adapter, + IN u16 DataRate) +{ +// We do not support gain table change inACUT now !!!! Delete later !!! +#if 0//(RTL92SE_FPGA_VERIFY == 0) + static u1Byte RF_Path_Type = 2; // 1 = 1T 2= 2T + static u4Byte tx_gain_tbl1[6] + = {0x17f50, 0x11f40, 0x0cf30, 0x08720, 0x04310, 0x00100}; + static u4Byte tx_gain_tbl2[6] + = {0x15ea0, 0x10e90, 0x0c680, 0x08250, 0x04040, 0x00030}; + u1Byte i; + + if (RF_Path_Type == 2 && (DataRate&0xF) <= 0x7) + { + // Set TX SYNC power G2G3 loop filter + PHY_SetRFReg(Adapter, (RF_RADIO_PATH_E)RF_PATH_A, + RF_TXPA_G2, bRFRegOffsetMask, 0x0f000); + PHY_SetRFReg(Adapter, (RF_RADIO_PATH_E)RF_PATH_A, + RF_TXPA_G3, bRFRegOffsetMask, 0xeacf1); + + // Change TX AGC gain table + for (i = 0; i < 6; i++) + PHY_SetRFReg(Adapter, (RF_RADIO_PATH_E)RF_PATH_A, + RF_TX_AGC, bRFRegOffsetMask, tx_gain_tbl1[i]); + + // Set PA to high value + PHY_SetRFReg(Adapter, (RF_RADIO_PATH_E)RF_PATH_A, + RF_TXPA_G2, bRFRegOffsetMask, 0x01e39); + } + else if (RF_Path_Type == 1 && (DataRate&0xF) >= 0x8) + { + // Set TX SYNC power G2G3 loop filter + PHY_SetRFReg(Adapter, (RF_RADIO_PATH_E)RF_PATH_A, + RF_TXPA_G2, bRFRegOffsetMask, 0x04440); + PHY_SetRFReg(Adapter, (RF_RADIO_PATH_E)RF_PATH_A, + RF_TXPA_G3, bRFRegOffsetMask, 0xea4f1); + + // Change TX AGC gain table + for (i = 0; i < 6; i++) + PHY_SetRFReg(Adapter, (RF_RADIO_PATH_E)RF_PATH_A, + RF_TX_AGC, bRFRegOffsetMask, tx_gain_tbl2[i]); + + // Set PA low gain + PHY_SetRFReg(Adapter, (RF_RADIO_PATH_E)RF_PATH_A, + RF_TXPA_G2, bRFRegOffsetMask, 0x01e19); + } +#endif + +} /* RF_ChangeTxPath */ + + +/*----------------------------------------------------------------------------- + * Function: PHY_RF6052SetBandwidth() + * + * Overview: This function is called by SetBWModeCallback8190Pci() only + * + * Input: struct adapter * Adapter + * WIRELESS_BANDWIDTH_E Bandwidth //20M or 40M + * + * Output: NONE + * + * Return: NONE + * + * Note: For RF type 0222D + *---------------------------------------------------------------------------*/ +VOID +rtl8188e_PHY_RF6052SetBandwidth( + IN struct adapter * Adapter, + IN HT_CHANNEL_WIDTH Bandwidth) //20M or 40M +{ + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); + + switch(Bandwidth) + { + case HT_CHANNEL_WIDTH_20: + pHalData->RfRegChnlVal[0] = ((pHalData->RfRegChnlVal[0] & 0xfffff3ff) | BIT(10) | BIT(11)); + PHY_SetRFReg(Adapter, RF_PATH_A, RF_CHNLBW, bRFRegOffsetMask, pHalData->RfRegChnlVal[0]); + break; + + case HT_CHANNEL_WIDTH_40: + pHalData->RfRegChnlVal[0] = ((pHalData->RfRegChnlVal[0] & 0xfffff3ff)| BIT(10)); + PHY_SetRFReg(Adapter, RF_PATH_A, RF_CHNLBW, bRFRegOffsetMask, pHalData->RfRegChnlVal[0]); + break; + + default: + //RT_TRACE(COMP_DBG, DBG_LOUD, ("PHY_SetRF8225Bandwidth(): unknown Bandwidth: %#X\n",Bandwidth )); + break; + } + +} + + +/*----------------------------------------------------------------------------- + * Function: PHY_RF6052SetCckTxPower + * + * Overview: + * + * Input: NONE + * + * Output: NONE + * + * Return: NONE + * + * Revised History: + * When Who Remark + * 11/05/2008 MHC Simulate 8192series.. + * + *---------------------------------------------------------------------------*/ + +VOID +rtl8188e_PHY_RF6052SetCckTxPower( + IN struct adapter * Adapter, + IN u8* pPowerlevel) +{ + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); + struct mlme_priv *pmlmepriv = &Adapter->mlmepriv; + struct dm_priv *pdmpriv = &pHalData->dmpriv; + struct mlme_ext_priv *pmlmeext = &Adapter->mlmeextpriv; + //PMGNT_INFO pMgntInfo=&Adapter->MgntInfo; + u32 TxAGC[2]={0, 0}, tmpval=0,pwrtrac_value; + BOOLEAN TurboScanOff = _FALSE; + u8 idx1, idx2; + u8* ptr; + u8 direction; + //FOR CE ,must disable turbo scan + TurboScanOff = _TRUE; + + + if(pmlmeext->sitesurvey_res.state == SCAN_PROCESS) + { + TxAGC[RF_PATH_A] = 0x3f3f3f3f; + TxAGC[RF_PATH_B] = 0x3f3f3f3f; + + TurboScanOff = _TRUE;//disable turbo scan + + if(TurboScanOff) + { + for(idx1=RF_PATH_A; idx1<=RF_PATH_B; idx1++) + { + TxAGC[idx1] = + pPowerlevel[idx1] | (pPowerlevel[idx1]<<8) | + (pPowerlevel[idx1]<<16) | (pPowerlevel[idx1]<<24); +#ifdef CONFIG_USB_HCI + // 2010/10/18 MH For external PA module. We need to limit power index to be less than 0x20. + if (TxAGC[idx1] > 0x20 && pHalData->ExternalPA) + TxAGC[idx1] = 0x20; +#endif + } + } + } + else + { +// 20100427 Joseph: Driver dynamic Tx power shall not affect Tx power. It shall be determined by power training mechanism. +// Currently, we cannot fully disable driver dynamic tx power mechanism because it is referenced by BT coexist mechanism. +// In the future, two mechanism shall be separated from each other and maintained independantly. Thanks for Lanhsin's reminder. + if(pdmpriv->DynamicTxHighPowerLvl == TxHighPwrLevel_Level1) + { + TxAGC[RF_PATH_A] = 0x10101010; + TxAGC[RF_PATH_B] = 0x10101010; + } + else if(pdmpriv->DynamicTxHighPowerLvl == TxHighPwrLevel_Level2) + { + TxAGC[RF_PATH_A] = 0x00000000; + TxAGC[RF_PATH_B] = 0x00000000; + } + else + { + for(idx1=RF_PATH_A; idx1<=RF_PATH_B; idx1++) + { + TxAGC[idx1] = + pPowerlevel[idx1] | (pPowerlevel[idx1]<<8) | + (pPowerlevel[idx1]<<16) | (pPowerlevel[idx1]<<24); + } + + if(pHalData->EEPROMRegulatory==0) + { + tmpval = (pHalData->MCSTxPowerLevelOriginalOffset[0][6]) + + (pHalData->MCSTxPowerLevelOriginalOffset[0][7]<<8); + TxAGC[RF_PATH_A] += tmpval; + + tmpval = (pHalData->MCSTxPowerLevelOriginalOffset[0][14]) + + (pHalData->MCSTxPowerLevelOriginalOffset[0][15]<<24); + TxAGC[RF_PATH_B] += tmpval; + } + } + } + + + ODM_TxPwrTrackAdjust88E(&pHalData->odmpriv, 1, &direction, &pwrtrac_value); + //printk("ODM_TxPwrTrackAdjust88E => direction:%02x, pwrtrac_value:%d \n", direction, pwrtrac_value); + //printk(" ==> TxAGC:0x%08x \n",TxAGC[0] ); + + if (direction == 1) // Increase TX pwoer + { + TxAGC[0] += pwrtrac_value; + TxAGC[1] += pwrtrac_value; + + } + else if (direction == 2) // Decrease TX pwoer + { + TxAGC[0] -= pwrtrac_value; + TxAGC[1] -= pwrtrac_value; + } + + for(idx1=RF_PATH_A; idx1<=RF_PATH_B; idx1++) + { + ptr = (u8*)(&(TxAGC[idx1])); + for(idx2=0; idx2<4; idx2++) + { + if(*ptr > RF6052_MAX_TX_PWR) + *ptr = RF6052_MAX_TX_PWR; + ptr++; + } + } + //printk(" ==> TxAGC:0x%08x \n",TxAGC[0] ); + + // rf-A cck tx power + tmpval = TxAGC[RF_PATH_A]&0xff; + PHY_SetBBReg(Adapter, rTxAGC_A_CCK1_Mcs32, bMaskByte1, tmpval); + //printk("CCK PWR 1M (rf-A) = 0x%x (reg 0x%x)\n", tmpval, rTxAGC_A_CCK1_Mcs32); + + + tmpval = TxAGC[RF_PATH_A]>>8; + PHY_SetBBReg(Adapter, rTxAGC_B_CCK11_A_CCK2_11, 0xffffff00, tmpval); + //printk("CCK PWR 2~11M (rf-A) = 0x%x (reg 0x%x)\n", tmpval, rTxAGC_B_CCK11_A_CCK2_11); + +/* + // rf-B cck tx power + tmpval = TxAGC[RF_PATH_B]>>24; + PHY_SetBBReg(Adapter, rTxAGC_B_CCK11_A_CCK2_11, bMaskByte0, tmpval); + //printk("CCK PWR 11M (rf-B) = 0x%x (reg 0x%x)\n", tmpval, rTxAGC_B_CCK11_A_CCK2_11); + tmpval = TxAGC[RF_PATH_B]&0x00ffffff; + PHY_SetBBReg(Adapter, rTxAGC_B_CCK1_55_Mcs32, 0xffffff00, tmpval); + //printk("CCK PWR 1~5.5M (rf-B) = 0x%x (reg 0x%x)\n",tmpval, rTxAGC_B_CCK1_55_Mcs32); +*/ +} /* PHY_RF6052SetCckTxPower */ + +#if 0 +// +// powerbase0 for OFDM rates +// powerbase1 for HT MCS rates +// +static void getPowerBase( + IN struct adapter *Adapter, + IN u8* pPowerLevel, + IN u8 Channel, + IN OUT u32* OfdmBase, + IN OUT u32* MCSBase + ) +{ + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); + u32 powerBase0, powerBase1; + u8 Legacy_pwrdiff=0, HT20_pwrdiff=0; + u8 i, powerlevel[2]; + + for(i=0; i<2; i++) + { + powerlevel[i] = pPowerLevel[i]; + Legacy_pwrdiff = pHalData->TxPwrLegacyHtDiff[i][Channel-1]; + powerBase0 = powerlevel[i] + Legacy_pwrdiff; + + powerBase0 = (powerBase0<<24) | (powerBase0<<16) |(powerBase0<<8) |powerBase0; + *(OfdmBase+i) = powerBase0; + //RTPRINT(FPHY, PHY_TXPWR, (" [OFDM power base index rf(%c) = 0x%x]\n", ((i==0)?'A':'B'), *(OfdmBase+i))); + } + + for(i=0; i<2; i++) + { + //Check HT20 to HT40 diff + if(pHalData->CurrentChannelBW == HT_CHANNEL_WIDTH_20) + { + HT20_pwrdiff = pHalData->TxPwrHt20Diff[i][Channel-1]; + powerlevel[i] += HT20_pwrdiff; + } + powerBase1 = powerlevel[i]; + powerBase1 = (powerBase1<<24) | (powerBase1<<16) |(powerBase1<<8) |powerBase1; + *(MCSBase+i) = powerBase1; + //RTPRINT(FPHY, PHY_TXPWR, (" [MCS power base index rf(%c) = 0x%x]\n", ((i==0)?'A':'B'), *(MCSBase+i))); + } +} +#endif +// +// powerbase0 for OFDM rates +// powerbase1 for HT MCS rates +// +void getPowerBase88E( + IN struct adapter *Adapter, + IN u8* pPowerLevelOFDM, + IN u8* pPowerLevelBW20, + IN u8* pPowerLevelBW40, + IN u8 Channel, + IN OUT u32* OfdmBase, + IN OUT u32* MCSBase + ) +{ + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); + u32 powerBase0, powerBase1; + u8 Legacy_pwrdiff=0; + s8 HT20_pwrdiff=0; + u8 i, powerlevel[2]; + + for(i=0; i<2; i++) + { + powerBase0 = pPowerLevelOFDM[i]; + + powerBase0 = (powerBase0<<24) | (powerBase0<<16) |(powerBase0<<8) |powerBase0; + *(OfdmBase+i) = powerBase0; + //DBG_871X(" [OFDM power base index rf(%c) = 0x%x]\n", ((i==0)?'A':'B'), *(OfdmBase+i)); + } + + for(i=0; iNumTotalRFPath; i++) + { + //Check HT20 to HT40 diff + if(pHalData->CurrentChannelBW == HT_CHANNEL_WIDTH_20) + { + powerlevel[i] = pPowerLevelBW20[i]; + } + else + { + powerlevel[i] = pPowerLevelBW40[i]; + } + powerBase1 = powerlevel[i]; + powerBase1 = (powerBase1<<24) | (powerBase1<<16) |(powerBase1<<8) |powerBase1; + *(MCSBase+i) = powerBase1; + //DBG_871X(" [MCS power base index rf(%c) = 0x%x]\n", ((i==0)?'A':'B'), *(MCSBase+i)); + } +} +#if 0 +static void getTxPowerWriteValByRegulatory( + IN struct adapter *Adapter, + IN u8 Channel, + IN u8 index, + IN u32* powerBase0, + IN u32* powerBase1, + OUT u32* pOutWriteVal + ) +{ + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); + struct dm_priv *pdmpriv = &pHalData->dmpriv; + u8 i, chnlGroup, pwr_diff_limit[4]; + u32 writeVal, customer_limit, rf; + + // + // Index 0 & 1= legacy OFDM, 2-5=HT_MCS rate + // + for(rf=0; rf<2; rf++) + { + switch(pHalData->EEPROMRegulatory) + { + case 0: // Realtek better performance + // increase power diff defined by Realtek for large power + chnlGroup = 0; + //RTPRINT(FPHY, PHY_TXPWR, ("MCSTxPowerLevelOriginalOffset[%d][%d] = 0x%x\n", + // chnlGroup, index, pHalData->MCSTxPowerLevelOriginalOffset[chnlGroup][index+(rf?8:0)])); + writeVal = pHalData->MCSTxPowerLevelOriginalOffset[chnlGroup][index+(rf?8:0)] + + ((index<2)?powerBase0[rf]:powerBase1[rf]); + //RTPRINT(FPHY, PHY_TXPWR, ("RTK better performance, writeVal(%c) = 0x%x\n", ((rf==0)?'A':'B'), writeVal)); + break; + case 1: // Realtek regulatory + // increase power diff defined by Realtek for regulatory + { + if(pHalData->pwrGroupCnt == 1) + chnlGroup = 0; + if(pHalData->pwrGroupCnt >= 3) + { + if(Channel <= 3) + chnlGroup = 0; + else if(Channel >= 4 && Channel <= 9) + chnlGroup = 1; + else if(Channel > 9) + chnlGroup = 2; + + if(pHalData->CurrentChannelBW == HT_CHANNEL_WIDTH_20) + chnlGroup++; + else + chnlGroup+=4; + } + //RTPRINT(FPHY, PHY_TXPWR, ("MCSTxPowerLevelOriginalOffset[%d][%d] = 0x%x\n", + //chnlGroup, index, pHalData->MCSTxPowerLevelOriginalOffset[chnlGroup][index+(rf?8:0)])); + writeVal = pHalData->MCSTxPowerLevelOriginalOffset[chnlGroup][index+(rf?8:0)] + + ((index<2)?powerBase0[rf]:powerBase1[rf]); + //RTPRINT(FPHY, PHY_TXPWR, ("Realtek regulatory, 20MHz, writeVal(%c) = 0x%x\n", ((rf==0)?'A':'B'), writeVal)); + } + break; + case 2: // Better regulatory + // don't increase any power diff + writeVal = ((index<2)?powerBase0[rf]:powerBase1[rf]); + //RTPRINT(FPHY, PHY_TXPWR, ("Better regulatory, writeVal(%c) = 0x%x\n", ((rf==0)?'A':'B'), writeVal)); + break; + case 3: // Customer defined power diff. + // increase power diff defined by customer. + chnlGroup = 0; + //RTPRINT(FPHY, PHY_TXPWR, ("MCSTxPowerLevelOriginalOffset[%d][%d] = 0x%x\n", + // chnlGroup, index, pHalData->MCSTxPowerLevelOriginalOffset[chnlGroup][index+(rf?8:0)])); + + if (pHalData->CurrentChannelBW == HT_CHANNEL_WIDTH_40) + { + //RTPRINT(FPHY, PHY_TXPWR, ("customer's limit, 40MHz rf(%c) = 0x%x\n", + // ((rf==0)?'A':'B'), pHalData->PwrGroupHT40[rf][Channel-1])); + } + else + { + //RTPRINT(FPHY, PHY_TXPWR, ("customer's limit, 20MHz rf(%c) = 0x%x\n", + // ((rf==0)?'A':'B'), pHalData->PwrGroupHT20[rf][Channel-1])); + } + for (i=0; i<4; i++) + { + pwr_diff_limit[i] = (u8)((pHalData->MCSTxPowerLevelOriginalOffset[chnlGroup][index+(rf?8:0)]&(0x7f<<(i*8)))>>(i*8)); + if (pHalData->CurrentChannelBW == HT_CHANNEL_WIDTH_40) + { + if(pwr_diff_limit[i] > pHalData->PwrGroupHT40[rf][Channel-1]) + pwr_diff_limit[i] = pHalData->PwrGroupHT40[rf][Channel-1]; + } + else + { + if(pwr_diff_limit[i] > pHalData->PwrGroupHT20[rf][Channel-1]) + pwr_diff_limit[i] = pHalData->PwrGroupHT20[rf][Channel-1]; + } + } + customer_limit = (pwr_diff_limit[3]<<24) | (pwr_diff_limit[2]<<16) | + (pwr_diff_limit[1]<<8) | (pwr_diff_limit[0]); + //RTPRINT(FPHY, PHY_TXPWR, ("Customer's limit rf(%c) = 0x%x\n", ((rf==0)?'A':'B'), customer_limit)); + + writeVal = customer_limit + ((index<2)?powerBase0[rf]:powerBase1[rf]); + //RTPRINT(FPHY, PHY_TXPWR, ("Customer, writeVal rf(%c)= 0x%x\n", ((rf==0)?'A':'B'), writeVal)); + break; + default: + chnlGroup = 0; + writeVal = pHalData->MCSTxPowerLevelOriginalOffset[chnlGroup][index+(rf?8:0)] + + ((index<2)?powerBase0[rf]:powerBase1[rf]); + //RTPRINT(FPHY, PHY_TXPWR, ("RTK better performance, writeVal rf(%c) = 0x%x\n", ((rf==0)?'A':'B'), writeVal)); + break; + } + +// 20100427 Joseph: Driver dynamic Tx power shall not affect Tx power. It shall be determined by power training mechanism. +// Currently, we cannot fully disable driver dynamic tx power mechanism because it is referenced by BT coexist mechanism. +// In the future, two mechanism shall be separated from each other and maintained independantly. Thanks for Lanhsin's reminder. + + if(pdmpriv->DynamicTxHighPowerLvl == TxHighPwrLevel_Level1) + writeVal = 0x14141414; + else if(pdmpriv->DynamicTxHighPowerLvl == TxHighPwrLevel_Level2) + writeVal = 0x00000000; + + + // 20100628 Joseph: High power mode for BT-Coexist mechanism. + // This mechanism is only applied when Driver-Highpower-Mechanism is OFF. + if(pdmpriv->DynamicTxHighPowerLvl == TxHighPwrLevel_BT1) + { + //RTPRINT(FBT, BT_TRACE, ("Tx Power (-6)\n")); + writeVal = writeVal - 0x06060606; + } + else if(pdmpriv->DynamicTxHighPowerLvl == TxHighPwrLevel_BT2) + { + //RTPRINT(FBT, BT_TRACE, ("Tx Power (-0)\n")); + writeVal = writeVal; + } + *(pOutWriteVal+rf) = writeVal; + } +} +#endif +void getTxPowerWriteValByRegulatory88E( + IN struct adapter *Adapter, + IN u8 Channel, + IN u8 index, + IN u32* powerBase0, + IN u32* powerBase1, + OUT u32* pOutWriteVal + ) +{ + + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); + struct dm_priv *pdmpriv = &pHalData->dmpriv; + u1Byte i, chnlGroup=0, pwr_diff_limit[4], customer_pwr_limit; + s1Byte pwr_diff=0; + u4Byte writeVal, customer_limit, rf; + u1Byte Regulatory = pHalData->EEPROMRegulatory; + + // + // Index 0 & 1= legacy OFDM, 2-5=HT_MCS rate + // +#if 0 // (INTEL_PROXIMITY_SUPPORT == 1) + if(pMgntInfo->IntelProximityModeInfo.PowerOutput > 0) + Regulatory = 2; +#endif + + for(rf=0; rf<2; rf++) + { + switch(Regulatory) + { + case 0: // Realtek better performance + // increase power diff defined by Realtek for large power + chnlGroup = 0; + //RTPRINT(FPHY, PHY_TXPWR, ("MCSTxPowerLevelOriginalOffset[%d][%d] = 0x%x\n", + // chnlGroup, index, pHalData->MCSTxPowerLevelOriginalOffset[chnlGroup][index+(rf?8:0)])); + writeVal = pHalData->MCSTxPowerLevelOriginalOffset[chnlGroup][index+(rf?8:0)] + + ((index<2)?powerBase0[rf]:powerBase1[rf]); + //RTPRINT(FPHY, PHY_TXPWR, ("RTK better performance, writeVal(%c) = 0x%x\n", ((rf==0)?'A':'B'), writeVal)); + break; + case 1: // Realtek regulatory + // increase power diff defined by Realtek for regulatory + { + if(pHalData->pwrGroupCnt == 1) + chnlGroup = 0; + //if(pHalData->pwrGroupCnt >= pHalData->PGMaxGroup) + { + if (Channel < 3) // Chanel 1-2 + chnlGroup = 0; + else if (Channel < 6) // Channel 3-5 + chnlGroup = 1; + else if(Channel <9) // Channel 6-8 + chnlGroup = 2; + else if(Channel <12) // Channel 9-11 + chnlGroup = 3; + else if(Channel <14) // Channel 12-13 + chnlGroup = 4; + else if(Channel ==14) // Channel 14 + chnlGroup = 4; + + if(pHalData->CurrentChannelBW == HT_CHANNEL_WIDTH_20) + chnlGroup++; + else + chnlGroup+=6; + +/* + if(Channel <= 3) + chnlGroup = 0; + else if(Channel >= 4 && Channel <= 9) + chnlGroup = 1; + else if(Channel > 9) + chnlGroup = 2; + + + if(pHalData->CurrentChannelBW == HT_CHANNEL_WIDTH_20) + chnlGroup++; + else + chnlGroup+=4; +*/ + } + //RTPRINT(FPHY, PHY_TXPWR, ("MCSTxPowerLevelOriginalOffset[%d][%d] = 0x%x\n", + //chnlGroup, index, pHalData->MCSTxPowerLevelOriginalOffset[chnlGroup][index+(rf?8:0)])); + writeVal = pHalData->MCSTxPowerLevelOriginalOffset[chnlGroup][index+(rf?8:0)] + + ((index<2)?powerBase0[rf]:powerBase1[rf]); + //RTPRINT(FPHY, PHY_TXPWR, ("Realtek regulatory, 20MHz, writeVal(%c) = 0x%x\n", ((rf==0)?'A':'B'), writeVal)); + } + break; + case 2: // Better regulatory + // don't increase any power diff + writeVal = ((index<2)?powerBase0[rf]:powerBase1[rf]); + //RTPRINT(FPHY, PHY_TXPWR, ("Better regulatory, writeVal(%c) = 0x%x\n", ((rf==0)?'A':'B'), writeVal)); + break; + case 3: // Customer defined power diff. + // increase power diff defined by customer. + chnlGroup = 0; + //RTPRINT(FPHY, PHY_TXPWR, ("MCSTxPowerLevelOriginalOffset[%d][%d] = 0x%x\n", + // chnlGroup, index, pHalData->MCSTxPowerLevelOriginalOffset[chnlGroup][index+(rf?8:0)])); + + /* + if (pHalData->CurrentChannelBW == HT_CHANNEL_WIDTH_20_40) + { + RTPRINT(FPHY, PHY_TXPWR, ("customer's limit, 40MHz rf(%c) = 0x%x\n", + ((rf==0)?'A':'B'), pHalData->PwrGroupHT40[rf][Channel-1])); + } + else + { + RTPRINT(FPHY, PHY_TXPWR, ("customer's limit, 20MHz rf(%c) = 0x%x\n", + ((rf==0)?'A':'B'), pHalData->PwrGroupHT20[rf][Channel-1])); + }*/ + + if(index < 2) + pwr_diff = pHalData->TxPwrLegacyHtDiff[rf][Channel-1]; + else if (pHalData->CurrentChannelBW == HT_CHANNEL_WIDTH_20) + pwr_diff = pHalData->TxPwrHt20Diff[rf][Channel-1]; + + //RTPRINT(FPHY, PHY_TXPWR, ("power diff rf(%c) = 0x%x\n", ((rf==0)?'A':'B'), pwr_diff)); + + if (pHalData->CurrentChannelBW == HT_CHANNEL_WIDTH_40) + customer_pwr_limit = pHalData->PwrGroupHT40[rf][Channel-1]; + else + customer_pwr_limit = pHalData->PwrGroupHT20[rf][Channel-1]; + + //RTPRINT(FPHY, PHY_TXPWR, ("customer pwr limit rf(%c) = 0x%x\n", ((rf==0)?'A':'B'), customer_pwr_limit)); + + if(pwr_diff >= customer_pwr_limit) + pwr_diff = 0; + else + pwr_diff = customer_pwr_limit - pwr_diff; + + for (i=0; i<4; i++) + { + pwr_diff_limit[i] = (u1Byte)((pHalData->MCSTxPowerLevelOriginalOffset[chnlGroup][index+(rf?8:0)]&(0x7f<<(i*8)))>>(i*8)); + + if(pwr_diff_limit[i] > pwr_diff) + pwr_diff_limit[i] = pwr_diff; + } + customer_limit = (pwr_diff_limit[3]<<24) | (pwr_diff_limit[2]<<16) | + (pwr_diff_limit[1]<<8) | (pwr_diff_limit[0]); + //RTPRINT(FPHY, PHY_TXPWR, ("Customer's limit rf(%c) = 0x%x\n", ((rf==0)?'A':'B'), customer_limit)); + writeVal = customer_limit + ((index<2)?powerBase0[rf]:powerBase1[rf]); + //RTPRINT(FPHY, PHY_TXPWR, ("Customer, writeVal rf(%c)= 0x%x\n", ((rf==0)?'A':'B'), writeVal)); + break; + default: + chnlGroup = 0; + writeVal = pHalData->MCSTxPowerLevelOriginalOffset[chnlGroup][index+(rf?8:0)] + + ((index<2)?powerBase0[rf]:powerBase1[rf]); + //RTPRINT(FPHY, PHY_TXPWR, ("RTK better performance, writeVal rf(%c) = 0x%x\n", ((rf==0)?'A':'B'), writeVal)); + break; + } + +// 20100427 Joseph: Driver dynamic Tx power shall not affect Tx power. It shall be determined by power training mechanism. +// Currently, we cannot fully disable driver dynamic tx power mechanism because it is referenced by BT coexist mechanism. +// In the future, two mechanism shall be separated from each other and maintained independantly. Thanks for Lanhsin's reminder. + //92d do not need this + if(pdmpriv->DynamicTxHighPowerLvl == TxHighPwrLevel_Level1) + writeVal = 0x14141414; + else if(pdmpriv->DynamicTxHighPowerLvl == TxHighPwrLevel_Level2) + writeVal = 0x00000000; + + // 20100628 Joseph: High power mode for BT-Coexist mechanism. + // This mechanism is only applied when Driver-Highpower-Mechanism is OFF. + if(pdmpriv->DynamicTxHighPowerLvl == TxHighPwrLevel_BT1) + { + //RTPRINT(FBT, BT_TRACE, ("Tx Power (-6)\n")); + writeVal = writeVal - 0x06060606; + } + else if(pdmpriv->DynamicTxHighPowerLvl == TxHighPwrLevel_BT2) + { + //RTPRINT(FBT, BT_TRACE, ("Tx Power (-0)\n")); + writeVal = writeVal ; + } + /* + if(pMgntInfo->bDisableTXPowerByRate) + { + // add for OID_RT_11N_TX_POWER_BY_RATE ,disable tx powre change by rate + writeVal = 0x2c2c2c2c; + } + */ + *(pOutWriteVal+rf) = writeVal; + } +} + +static void writeOFDMPowerReg88E( + IN struct adapter *Adapter, + IN u8 index, + IN u32* pValue + ) +{ + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); + u16 RegOffset_A[6] = { rTxAGC_A_Rate18_06, rTxAGC_A_Rate54_24, + rTxAGC_A_Mcs03_Mcs00, rTxAGC_A_Mcs07_Mcs04, + rTxAGC_A_Mcs11_Mcs08, rTxAGC_A_Mcs15_Mcs12}; + u16 RegOffset_B[6] = { rTxAGC_B_Rate18_06, rTxAGC_B_Rate54_24, + rTxAGC_B_Mcs03_Mcs00, rTxAGC_B_Mcs07_Mcs04, + rTxAGC_B_Mcs11_Mcs08, rTxAGC_B_Mcs15_Mcs12}; + u8 i, rf, pwr_val[4]; + u32 writeVal; + u16 RegOffset; + + for(rf=0; rf<2; rf++) + { + writeVal = pValue[rf]; + for(i=0; i<4; i++) + { + pwr_val[i] = (u8)((writeVal & (0x7f<<(i*8)))>>(i*8)); + if (pwr_val[i] > RF6052_MAX_TX_PWR) + pwr_val[i] = RF6052_MAX_TX_PWR; + } + writeVal = (pwr_val[3]<<24) | (pwr_val[2]<<16) |(pwr_val[1]<<8) |pwr_val[0]; + + if(rf == 0) + RegOffset = RegOffset_A[index]; + else + RegOffset = RegOffset_B[index]; + + PHY_SetBBReg(Adapter, RegOffset, bMaskDWord, writeVal); + //printk("Set OFDM tx pwr- 0x%x = %08x\n", RegOffset, writeVal); + + // 201005115 Joseph: Set Tx Power diff for Tx power training mechanism. + if(((pHalData->rf_type == RF_2T2R) && + (RegOffset == rTxAGC_A_Mcs15_Mcs12 || RegOffset == rTxAGC_B_Mcs15_Mcs12))|| + ((pHalData->rf_type != RF_2T2R) && + (RegOffset == rTxAGC_A_Mcs07_Mcs04 || RegOffset == rTxAGC_B_Mcs07_Mcs04)) ) + { + writeVal = pwr_val[3]; + if(RegOffset == rTxAGC_A_Mcs15_Mcs12 || RegOffset == rTxAGC_A_Mcs07_Mcs04) + RegOffset = 0xc90; + if(RegOffset == rTxAGC_B_Mcs15_Mcs12 || RegOffset == rTxAGC_B_Mcs07_Mcs04) + RegOffset = 0xc98; + for(i=0; i<3; i++) + { + if(i!=2) + writeVal = (writeVal>8)?(writeVal-8):0; + else + writeVal = (writeVal>6)?(writeVal-6):0; + rtw_write8(Adapter, (u32)(RegOffset+i), (u8)writeVal); + } + } + } +} + + +/*----------------------------------------------------------------------------- + * Function: PHY_RF6052SetOFDMTxPower + * + * Overview: For legacy and HY OFDM, we must read EEPROM TX power index for + * different channel and read original value in TX power register area from + * 0xe00. We increase offset and original value to be correct tx pwr. + * + * Input: NONE + * + * Output: NONE + * + * Return: NONE + * + * Revised History: + * When Who Remark + * 11/05/2008 MHC Simulate 8192 series method. + * 01/06/2009 MHC 1. Prevent Path B tx power overflow or underflow dure to + * A/B pwr difference or legacy/HT pwr diff. + * 2. We concern with path B legacy/HT OFDM difference. + * 01/22/2009 MHC Support new EPRO format from SD3. + * + *---------------------------------------------------------------------------*/ + +VOID +rtl8188e_PHY_RF6052SetOFDMTxPower( + IN struct adapter *Adapter, + IN u8* pPowerLevelOFDM, + IN u8* pPowerLevelBW20, + IN u8* pPowerLevelBW40, + IN u8 Channel) +{ + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); + u32 writeVal[2], powerBase0[2], powerBase1[2], pwrtrac_value; + u8 direction; + u8 index = 0; + + + //DBG_871X("PHY_RF6052SetOFDMTxPower, channel(%d) \n", Channel); + + getPowerBase88E(Adapter, pPowerLevelOFDM,pPowerLevelBW20,pPowerLevelBW40, Channel, &powerBase0[0], &powerBase1[0]); + + // + // 2012/04/23 MH According to power tracking value, we need to revise OFDM tx power. + // This is ued to fix unstable power tracking mode. + // + ODM_TxPwrTrackAdjust88E(&pHalData->odmpriv, 0, &direction, &pwrtrac_value); + + for(index=0; index<6; index++) + { + getTxPowerWriteValByRegulatory88E(Adapter, Channel, index, + &powerBase0[0], &powerBase1[0], &writeVal[0]); + + if (direction == 1) + { + writeVal[0] += pwrtrac_value; + writeVal[1] += pwrtrac_value; + } + else if (direction == 2) + { + writeVal[0] -= pwrtrac_value; + writeVal[1] -= pwrtrac_value; + } + + writeOFDMPowerReg88E(Adapter, index, &writeVal[0]); + } +} + + +static VOID +phy_RF6052_Config_HardCode( + IN struct adapter * Adapter + ) +{ + + // Set Default Bandwidth to 20M + //Adapter->HalFunc .SetBWModeHandler(Adapter, HT_CHANNEL_WIDTH_20); + + // TODO: Set Default Channel to channel one for RTL8225 + +} + +static int +phy_RF6052_Config_ParaFile( + IN struct adapter * Adapter + ) +{ + u32 u4RegValue; + u8 eRFPath; + BB_REGISTER_DEFINITION_T *pPhyReg; + + int rtStatus = _SUCCESS; + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); + + static char sz88eRadioAFile[] = RTL8188E_PHY_RADIO_A; + static char sz88eRadioBFile[] = RTL8188E_PHY_RADIO_B; + char *pszRadioAFile, *pszRadioBFile; + + + + pszRadioAFile = sz88eRadioAFile; + pszRadioBFile = sz88eRadioBFile; + + + //3//----------------------------------------------------------------- + //3// <2> Initialize RF + //3//----------------------------------------------------------------- + //for(eRFPath = RF_PATH_A; eRFPath NumTotalRFPath; eRFPath++) + for(eRFPath = 0; eRFPath NumTotalRFPath; eRFPath++) + { + + pPhyReg = &pHalData->PHYRegDef[eRFPath]; + + /*----Store original RFENV control type----*/ + switch(eRFPath) + { + case RF_PATH_A: + case RF_PATH_C: + u4RegValue = PHY_QueryBBReg(Adapter, pPhyReg->rfintfs, bRFSI_RFENV); + break; + case RF_PATH_B : + case RF_PATH_D: + u4RegValue = PHY_QueryBBReg(Adapter, pPhyReg->rfintfs, bRFSI_RFENV<<16); + break; + } + + /*----Set RF_ENV enable----*/ + PHY_SetBBReg(Adapter, pPhyReg->rfintfe, bRFSI_RFENV<<16, 0x1); + rtw_udelay_os(1);//PlatformStallExecution(1); + + /*----Set RF_ENV output high----*/ + PHY_SetBBReg(Adapter, pPhyReg->rfintfo, bRFSI_RFENV, 0x1); + rtw_udelay_os(1);//PlatformStallExecution(1); + + /* Set bit number of Address and Data for RF register */ + PHY_SetBBReg(Adapter, pPhyReg->rfHSSIPara2, b3WireAddressLength, 0x0); // Set 1 to 4 bits for 8255 + rtw_udelay_os(1);//PlatformStallExecution(1); + + PHY_SetBBReg(Adapter, pPhyReg->rfHSSIPara2, b3WireDataLength, 0x0); // Set 0 to 12 bits for 8255 + rtw_udelay_os(1);//PlatformStallExecution(1); + + /*----Initialize RF fom connfiguration file----*/ + switch(eRFPath) + { + case RF_PATH_A: +#ifdef CONFIG_EMBEDDED_FWIMG + #ifdef CONFIG_PHY_SETTING_WITH_ODM + if(HAL_STATUS_FAILURE ==ODM_ConfigRFWithHeaderFile(&pHalData->odmpriv,(ODM_RF_RADIO_PATH_E)eRFPath, (ODM_RF_RADIO_PATH_E)eRFPath)) + rtStatus= _FAIL; + #else + rtStatus= rtl8188e_PHY_ConfigRFWithHeaderFile(Adapter,(RF_RADIO_PATH_E)eRFPath); + #endif//#ifdef CONFIG_PHY_SETTING_WITH_ODM +#else + rtStatus = rtl8188e_PHY_ConfigRFWithParaFile(Adapter, pszRadioAFile, (RF_RADIO_PATH_E)eRFPath); +#endif//#ifdef CONFIG_EMBEDDED_FWIMG + break; + case RF_PATH_B: +#ifdef CONFIG_EMBEDDED_FWIMG + #ifdef CONFIG_PHY_SETTING_WITH_ODM + if(HAL_STATUS_FAILURE ==ODM_ConfigRFWithHeaderFile(&pHalData->odmpriv,(ODM_RF_RADIO_PATH_E)eRFPath, (ODM_RF_RADIO_PATH_E)eRFPath)) + rtStatus= _FAIL; + #else + rtStatus = rtl8188e_PHY_ConfigRFWithHeaderFile(Adapter,(RF_RADIO_PATH_E)eRFPath); + #endif //#ifdef CONFIG_PHY_SETTING_WITH_ODM +#else + rtStatus =rtl8188e_PHY_ConfigRFWithParaFile(Adapter, pszRadioBFile, (RF_RADIO_PATH_E)eRFPath); +#endif + break; + case RF_PATH_C: + break; + case RF_PATH_D: + break; + } + + /*----Restore RFENV control type----*/; + switch(eRFPath) + { + case RF_PATH_A: + case RF_PATH_C: + PHY_SetBBReg(Adapter, pPhyReg->rfintfs, bRFSI_RFENV, u4RegValue); + break; + case RF_PATH_B : + case RF_PATH_D: + PHY_SetBBReg(Adapter, pPhyReg->rfintfs, bRFSI_RFENV<<16, u4RegValue); + break; + } + + if(rtStatus != _SUCCESS){ + //RT_TRACE(COMP_FPGA, DBG_LOUD, ("phy_RF6052_Config_ParaFile():Radio[%d] Fail!!", eRFPath)); + goto phy_RF6052_Config_ParaFile_Fail; + } + + } + + //RT_TRACE(COMP_INIT, DBG_LOUD, ("<---phy_RF6052_Config_ParaFile()\n")); + return rtStatus; + +phy_RF6052_Config_ParaFile_Fail: + return rtStatus; +} + + +int +PHY_RF6052_Config8188E( + IN struct adapter * Adapter) +{ + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); + int rtStatus = _SUCCESS; + + // + // Initialize general global value + // + // TODO: Extend RF_PATH_C and RF_PATH_D in the future + if(pHalData->rf_type == RF_1T1R) + pHalData->NumTotalRFPath = 1; + else + pHalData->NumTotalRFPath = 2; + + // + // Config BB and RF + // + rtStatus = phy_RF6052_Config_ParaFile(Adapter); +#if 0 + switch( Adapter->MgntInfo.bRegHwParaFile ) + { + case 0: + phy_RF6052_Config_HardCode(Adapter); + break; + + case 1: + rtStatus = phy_RF6052_Config_ParaFile(Adapter); + break; + + case 2: + // Partial Modify. + phy_RF6052_Config_HardCode(Adapter); + phy_RF6052_Config_ParaFile(Adapter); + break; + + default: + phy_RF6052_Config_HardCode(Adapter); + break; + } +#endif + return rtStatus; + +} + + +// +// ==> RF shadow Operation API Code Section!!! +// +/*----------------------------------------------------------------------------- + * Function: PHY_RFShadowRead + * PHY_RFShadowWrite + * PHY_RFShadowCompare + * PHY_RFShadowRecorver + * PHY_RFShadowCompareAll + * PHY_RFShadowRecorverAll + * PHY_RFShadowCompareFlagSet + * PHY_RFShadowRecorverFlagSet + * + * Overview: When we set RF register, we must write shadow at first. + * When we are running, we must compare shadow abd locate error addr. + * Decide to recorver or not. + * + * Input: NONE + * + * Output: NONE + * + * Return: NONE + * + * Revised History: + * When Who Remark + * 11/20/2008 MHC Create Version 0. + * + *---------------------------------------------------------------------------*/ +u32 +PHY_RFShadowRead( + IN struct adapter * Adapter, + IN RF_RADIO_PATH_E eRFPath, + IN u32 Offset) +{ + return RF_Shadow[eRFPath][Offset].Value; + +} /* PHY_RFShadowRead */ + + +VOID +PHY_RFShadowWrite( + IN struct adapter * Adapter, + IN RF_RADIO_PATH_E eRFPath, + IN u32 Offset, + IN u32 Data) +{ + RF_Shadow[eRFPath][Offset].Value = (Data & bRFRegOffsetMask); + RF_Shadow[eRFPath][Offset].Driver_Write = _TRUE; + +} /* PHY_RFShadowWrite */ + + +BOOLEAN +PHY_RFShadowCompare( + IN struct adapter * Adapter, + IN RF_RADIO_PATH_E eRFPath, + IN u32 Offset) +{ + u32 reg; + // Check if we need to check the register + if (RF_Shadow[eRFPath][Offset].Compare == _TRUE) + { + reg = PHY_QueryRFReg(Adapter, eRFPath, Offset, bRFRegOffsetMask); + // Compare shadow and real rf register for 20bits!! + if (RF_Shadow[eRFPath][Offset].Value != reg) + { + // Locate error position. + RF_Shadow[eRFPath][Offset].ErrorOrNot = _TRUE; + //RT_TRACE(COMP_INIT, DBG_LOUD, + //("PHY_RFShadowCompare RF-%d Addr%02lx Err = %05lx\n", + //eRFPath, Offset, reg)); + } + return RF_Shadow[eRFPath][Offset].ErrorOrNot ; + } + return _FALSE; +} /* PHY_RFShadowCompare */ + + +VOID +PHY_RFShadowRecorver( + IN struct adapter * Adapter, + IN RF_RADIO_PATH_E eRFPath, + IN u32 Offset) +{ + // Check if the address is error + if (RF_Shadow[eRFPath][Offset].ErrorOrNot == _TRUE) + { + // Check if we need to recorver the register. + if (RF_Shadow[eRFPath][Offset].Recorver == _TRUE) + { + PHY_SetRFReg(Adapter, eRFPath, Offset, bRFRegOffsetMask, + RF_Shadow[eRFPath][Offset].Value); + //RT_TRACE(COMP_INIT, DBG_LOUD, + //("PHY_RFShadowRecorver RF-%d Addr%02lx=%05lx", + //eRFPath, Offset, RF_Shadow[eRFPath][Offset].Value)); + } + } + +} /* PHY_RFShadowRecorver */ + + +VOID +PHY_RFShadowCompareAll( + IN struct adapter * Adapter) +{ + u32 eRFPath; + u32 Offset; + + for (eRFPath = 0; eRFPath < RF6052_MAX_PATH; eRFPath++) + { + for (Offset = 0; Offset <= RF6052_MAX_REG; Offset++) + { + PHY_RFShadowCompare(Adapter, (RF_RADIO_PATH_E)eRFPath, Offset); + } + } + +} /* PHY_RFShadowCompareAll */ + + +VOID +PHY_RFShadowRecorverAll( + IN struct adapter * Adapter) +{ + u32 eRFPath; + u32 Offset; + + for (eRFPath = 0; eRFPath < RF6052_MAX_PATH; eRFPath++) + { + for (Offset = 0; Offset <= RF6052_MAX_REG; Offset++) + { + PHY_RFShadowRecorver(Adapter, (RF_RADIO_PATH_E)eRFPath, Offset); + } + } + +} /* PHY_RFShadowRecorverAll */ + + +VOID +PHY_RFShadowCompareFlagSet( + IN struct adapter * Adapter, + IN RF_RADIO_PATH_E eRFPath, + IN u32 Offset, + IN u8 Type) +{ + // Set True or False!!! + RF_Shadow[eRFPath][Offset].Compare = Type; + +} /* PHY_RFShadowCompareFlagSet */ + + +VOID +PHY_RFShadowRecorverFlagSet( + IN struct adapter * Adapter, + IN RF_RADIO_PATH_E eRFPath, + IN u32 Offset, + IN u8 Type) +{ + // Set True or False!!! + RF_Shadow[eRFPath][Offset].Recorver= Type; + +} /* PHY_RFShadowRecorverFlagSet */ + + +VOID +PHY_RFShadowCompareFlagSetAll( + IN struct adapter * Adapter) +{ + u32 eRFPath; + u32 Offset; + + for (eRFPath = 0; eRFPath < RF6052_MAX_PATH; eRFPath++) + { + for (Offset = 0; Offset <= RF6052_MAX_REG; Offset++) + { + // 2008/11/20 MH For S3S4 test, we only check reg 26/27 now!!!! + if (Offset != 0x26 && Offset != 0x27) + PHY_RFShadowCompareFlagSet(Adapter, (RF_RADIO_PATH_E)eRFPath, Offset, _FALSE); + else + PHY_RFShadowCompareFlagSet(Adapter, (RF_RADIO_PATH_E)eRFPath, Offset, _TRUE); + } + } + +} /* PHY_RFShadowCompareFlagSetAll */ + + +VOID +PHY_RFShadowRecorverFlagSetAll( + IN struct adapter * Adapter) +{ + u32 eRFPath; + u32 Offset; + + for (eRFPath = 0; eRFPath < RF6052_MAX_PATH; eRFPath++) + { + for (Offset = 0; Offset <= RF6052_MAX_REG; Offset++) + { + // 2008/11/20 MH For S3S4 test, we only check reg 26/27 now!!!! + if (Offset != 0x26 && Offset != 0x27) + PHY_RFShadowRecorverFlagSet(Adapter, (RF_RADIO_PATH_E)eRFPath, Offset, _FALSE); + else + PHY_RFShadowRecorverFlagSet(Adapter, (RF_RADIO_PATH_E)eRFPath, Offset, _TRUE); + } + } + +} /* PHY_RFShadowCompareFlagSetAll */ + +VOID +PHY_RFShadowRefresh( + IN struct adapter * Adapter) +{ + u32 eRFPath; + u32 Offset; + + for (eRFPath = 0; eRFPath < RF6052_MAX_PATH; eRFPath++) + { + for (Offset = 0; Offset <= RF6052_MAX_REG; Offset++) + { + RF_Shadow[eRFPath][Offset].Value = 0; + RF_Shadow[eRFPath][Offset].Compare = _FALSE; + RF_Shadow[eRFPath][Offset].Recorver = _FALSE; + RF_Shadow[eRFPath][Offset].ErrorOrNot = _FALSE; + RF_Shadow[eRFPath][Offset].Driver_Write = _FALSE; + } + } + +} /* PHY_RFShadowRead */ + +/* End of HalRf6052.c */ diff --git a/hal/rtl8188e_rxdesc.c b/hal/rtl8188e_rxdesc.c index f538aac..10f7028 100755 --- a/hal/rtl8188e_rxdesc.c +++ b/hal/rtl8188e_rxdesc.c @@ -48,7 +48,7 @@ static void process_rssi(struct adapter *padapter,union recv_frame *prframe) //DBG_8192C("process_rssi=> pattrib->rssil(%d) signal_strength(%d)\n ",pattrib->RecvSignalPower,pattrib->signal_strength); //if(pRfd->Status.bPacketToSelf || pRfd->Status.bPacketBeacon) { - + #ifdef CONFIG_NEW_SIGNAL_STAT_PROCESS if(signal_stat->update_req) { signal_stat->total_num = 0; @@ -58,9 +58,9 @@ static void process_rssi(struct adapter *padapter,union recv_frame *prframe) signal_stat->total_num++; signal_stat->total_val += pattrib->phy_info.SignalStrength; - signal_stat->avg_val = signal_stat->total_val / signal_stat->total_num; + signal_stat->avg_val = signal_stat->total_val / signal_stat->total_num; #else //CONFIG_NEW_SIGNAL_STAT_PROCESS - + //Adapter->RxStats.RssiCalculateCnt++; //For antenna Test if(padapter->recvpriv.signal_strength_data.total_num++ >= PHY_RSSI_SLID_WIN_MAX) { @@ -76,7 +76,7 @@ static void process_rssi(struct adapter *padapter,union recv_frame *prframe) tmp_val = padapter->recvpriv.signal_strength_data.total_val/padapter->recvpriv.signal_strength_data.total_num; - + if(padapter->recvpriv.is_signal_dbg) { padapter->recvpriv.signal_strength= padapter->recvpriv.signal_strength_dbg; padapter->recvpriv.rssi=(s8)translate2dbm((u8)padapter->recvpriv.signal_strength_dbg); @@ -96,7 +96,7 @@ static void process_rssi(struct adapter *padapter,union recv_frame *prframe) static void process_link_qual(struct adapter *padapter,union recv_frame *prframe) { u32 last_evm=0, tmpVal; - struct rx_pkt_attrib *pattrib; + struct rx_pkt_attrib *pattrib; #ifdef CONFIG_NEW_SIGNAL_STAT_PROCESS struct signal_stat * signal_stat; #endif //CONFIG_NEW_SIGNAL_STAT_PROCESS @@ -122,7 +122,7 @@ static void process_link_qual(struct adapter *padapter,union recv_frame *prframe signal_stat->total_num++; signal_stat->total_val += pattrib->phy_info.SignalQuality; signal_stat->avg_val = signal_stat->total_val / signal_stat->total_num; - + #else //CONFIG_NEW_SIGNAL_STAT_PROCESS if(pattrib->phy_info.SignalQuality != 0) { @@ -168,7 +168,7 @@ void rtl8188e_process_phy_info(struct adapter *padapter, void *prframe) // // Check PWDB. // - //process_PWDB(padapter, precvframe); + //process_PWDB(padapter, precvframe); //UpdateRxSignalStatistics8192C(Adapter, pRfd); // @@ -202,17 +202,17 @@ void update_recvframe_attrib_88e( pattrib = &precvframe->u.hdr.attrib; _rtw_memset(pattrib, 0, sizeof(struct rx_pkt_attrib)); - pattrib->crc_err = (u8)((report.rxdw0 >> 14) & 0x1);;//(u8)prxreport->crc32; - + pattrib->crc_err = (u8)((report.rxdw0 >> 14) & 0x1);;//(u8)prxreport->crc32; + // update rx report to recv_frame attribute pattrib->pkt_rpt_type = (u8)((report.rxdw3 >> 14) & 0x3);//prxreport->rpt_sel; - - if(pattrib->pkt_rpt_type == NORMAL_RX)//Normal rx packet + + if(pattrib->pkt_rpt_type == NORMAL_RX)//Normal rx packet { pattrib->pkt_len = (u16)(report.rxdw0 &0x00003fff);//(u16)prxreport->pktlen; pattrib->drvinfo_sz = (u8)((report.rxdw0 >> 16) & 0xf) * 8;//(u8)(prxreport->drvinfosize << 3); - - pattrib->physt = (u8)((report.rxdw0 >> 26) & 0x1);//(u8)prxreport->physt; + + pattrib->physt = (u8)((report.rxdw0 >> 26) & 0x1);//(u8)prxreport->physt; pattrib->bdecrypted = (report.rxdw0 & BIT(27))? 0:1;//(u8)(prxreport->swdec ? 0 : 1); pattrib->encrypt = (u8)((report.rxdw0 >> 20) & 0x7);//(u8)prxreport->security; @@ -229,10 +229,10 @@ void update_recvframe_attrib_88e( pattrib->mcs_rate = (u8)(report.rxdw3 & 0x3f);//(u8)prxreport->rxmcs; pattrib->rxht = (u8)((report.rxdw3 >> 6) & 0x1);//(u8)prxreport->rxht; - + pattrib->icv_err = (u8)((report.rxdw0 >> 15) & 0x1);//(u8)prxreport->icverr; pattrib->shift_sz = (u8)((report.rxdw0 >> 24) & 0x3); - + } else if(pattrib->pkt_rpt_type == TX_REPORT1)//CCX { @@ -249,13 +249,13 @@ void update_recvframe_attrib_88e( // pattrib->MacIDValidEntry[0] = report.rxdw4; pattrib->MacIDValidEntry[1] = report.rxdw5; - + } else if(pattrib->pkt_rpt_type == HIS_REPORT)// USB HISR RPT { pattrib->pkt_len = (u16)(report.rxdw0 &0x00003fff);//(u16)prxreport->pktlen; - } - + } + } /* @@ -269,19 +269,19 @@ void update_recvframe_phyinfo_88e( { struct adapter * padapter = precvframe->u.hdr.adapter; struct rx_pkt_attrib *pattrib = &precvframe->u.hdr.attrib; - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter); - PODM_PHY_INFO_T pPHYInfo = (PODM_PHY_INFO_T)(&pattrib->phy_info); + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter); + PODM_PHY_INFO_T pPHYInfo = (PODM_PHY_INFO_T)(&pattrib->phy_info); u8 *wlanhdr; ODM_PACKET_INFO_T pkt_info; u8 *sa; struct sta_priv *pstapriv; struct sta_info *psta; //_irqL irqL; - + pkt_info.bPacketMatchBSSID =_FALSE; pkt_info.bPacketToSelf = _FALSE; pkt_info.bPacketBeacon = _FALSE; - + wlanhdr = get_recvframe_data(precvframe); pkt_info.bPacketMatchBSSID = ((!IsFrameTypeCtrl(wlanhdr)) && @@ -293,12 +293,12 @@ void update_recvframe_phyinfo_88e( pkt_info.bPacketBeacon = pkt_info.bPacketMatchBSSID && (GetFrameSubType(wlanhdr) == WIFI_BEACON); if(pkt_info.bPacketBeacon){ - if(check_fwstate(&padapter->mlmepriv, WIFI_STATION_STATE) == _TRUE){ + if(check_fwstate(&padapter->mlmepriv, WIFI_STATION_STATE) == _TRUE){ sa = padapter->mlmepriv.cur_network.network.MacAddress; #if 0 - { + { DBG_8192C("==> rx beacon from AP[%02x:%02x:%02x:%02x:%02x:%02x]\n", - sa[0],sa[1],sa[2],sa[3],sa[4],sa[5]); + sa[0],sa[1],sa[2],sa[3],sa[4],sa[5]); } #endif } @@ -307,44 +307,43 @@ void update_recvframe_phyinfo_88e( } else{ sa = get_sa(wlanhdr); - } - + } + pstapriv = &padapter->stapriv; pkt_info.StationID = 0xFF; psta = rtw_get_stainfo(pstapriv, sa); if (psta) { - pkt_info.StationID = psta->mac_id; + pkt_info.StationID = psta->mac_id; //DBG_8192C("%s ==> StationID(%d)\n",__FUNCTION__,pkt_info.StationID); - } - pkt_info.Rate = pattrib->mcs_rate; + } + pkt_info.Rate = pattrib->mcs_rate; //rtl8188e_query_rx_phy_status(precvframe, pphy_status); - //_enter_critical_bh(&pHalData->odm_stainfo_lock, &irqL); + //_enter_critical_bh(&pHalData->odm_stainfo_lock, &irqL); ODM_PhyStatusQuery(&pHalData->odmpriv,pPHYInfo,(u8 *)pphy_status,&(pkt_info)); //_exit_critical_bh(&pHalData->odm_stainfo_lock, &irqL); precvframe->u.hdr.psta = NULL; if (pkt_info.bPacketMatchBSSID && (check_fwstate(&padapter->mlmepriv, WIFI_AP_STATE) == _TRUE)) - { + { if (psta) - { + { precvframe->u.hdr.psta = psta; rtl8188e_process_phy_info(padapter, precvframe); - - } + + } } else if (pkt_info.bPacketToSelf || pkt_info.bPacketBeacon) { if (check_fwstate(&padapter->mlmepriv, WIFI_ADHOC_STATE|WIFI_ADHOC_MASTER_STATE) == _TRUE) - { + { if (psta) - { + { precvframe->u.hdr.psta = psta; } } - rtl8188e_process_phy_info(padapter, precvframe); + rtl8188e_process_phy_info(padapter, precvframe); } } - diff --git a/hal/rtl8188e_sreset.c b/hal/rtl8188e_sreset.c index ea7aec4..7bb457a 100755 --- a/hal/rtl8188e_sreset.c +++ b/hal/rtl8188e_sreset.c @@ -1,125 +1,124 @@ -/****************************************************************************** - * - * 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 - * - * - ******************************************************************************/ -#define _RTL8188E_SRESET_C_ - -#include -#include - -#ifdef DBG_CONFIG_ERROR_DETECT - -void rtl8188e_sreset_xmit_status_check(struct adapter *padapter) -{ - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter); - struct sreset_priv *psrtpriv = &pHalData->srestpriv; - - unsigned long current_time; - struct xmit_priv *pxmitpriv = &padapter->xmitpriv; - unsigned int diff_time; - u32 txdma_status; - - if( (txdma_status=rtw_read32(padapter, REG_TXDMA_STATUS)) !=0x00){ - DBG_871X("%s REG_TXDMA_STATUS:0x%08x\n", __FUNCTION__, txdma_status); - rtw_hal_sreset_reset(padapter); - } -#ifdef CONFIG_USB_HCI - //total xmit irp = 4 - //DBG_8192C("==>%s free_xmitbuf_cnt(%d),txirp_cnt(%d)\n",__FUNCTION__,pxmitpriv->free_xmitbuf_cnt,pxmitpriv->txirp_cnt); - //if(pxmitpriv->txirp_cnt == NR_XMITBUFF+1) - current_time = rtw_get_current_time(); - - if(0 == pxmitpriv->free_xmitbuf_cnt || 0 == pxmitpriv->free_xmit_extbuf_cnt) { - - diff_time = rtw_get_passing_time_ms(psrtpriv->last_tx_time); - - if (diff_time > 2000) { - if (psrtpriv->last_tx_complete_time == 0) { - psrtpriv->last_tx_complete_time = current_time; - } - else{ - diff_time = rtw_get_passing_time_ms(psrtpriv->last_tx_complete_time); - if (diff_time > 4000) { - u32 ability; - - //padapter->Wifi_Error_Status = WIFI_TX_HANG; - rtw_hal_get_def_var(padapter, HAL_DEF_DBG_DM_FUNC, &ability); - - DBG_871X("%s tx hang %s\n", __FUNCTION__, - (ability & ODM_BB_ADAPTIVITY)? "ODM_BB_ADAPTIVITY" : ""); - - if (!(ability & ODM_BB_ADAPTIVITY)) - rtw_hal_sreset_reset(padapter); - } - } - } - } -#endif //CONFIG_USB_HCI - - if (psrtpriv->dbg_trigger_point == SRESET_TGP_XMIT_STATUS) { - psrtpriv->dbg_trigger_point = SRESET_TGP_NULL; - rtw_hal_sreset_reset(padapter); - return; - } -} - -void rtl8188e_sreset_linked_status_check(struct adapter *padapter) -{ - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter); - struct sreset_priv *psrtpriv = &pHalData->srestpriv; - - u32 rx_dma_status = 0; - u8 fw_status=0; - rx_dma_status = rtw_read32(padapter,REG_RXDMA_STATUS); - if(rx_dma_status!= 0x00){ - DBG_8192C("%s REG_RXDMA_STATUS:0x%08x \n",__FUNCTION__,rx_dma_status); - rtw_write32(padapter,REG_RXDMA_STATUS,rx_dma_status); - } - fw_status = rtw_read8(padapter,REG_FMETHR); - if(fw_status != 0x00) - { - if(fw_status == 1) - DBG_8192C("%s REG_FW_STATUS (0x%02x), Read_Efuse_Fail !! \n",__FUNCTION__,fw_status); - else if(fw_status == 2) - DBG_8192C("%s REG_FW_STATUS (0x%02x), Condition_No_Match !! \n",__FUNCTION__,fw_status); - } -#if 0 - u32 regc50,regc58,reg824,reg800; - regc50 = rtw_read32(padapter,0xc50); - regc58 = rtw_read32(padapter,0xc58); - reg824 = rtw_read32(padapter,0x824); - reg800 = rtw_read32(padapter,0x800); - if( ((regc50&0xFFFFFF00)!= 0x69543400)|| - ((regc58&0xFFFFFF00)!= 0x69543400)|| - (((reg824&0xFFFFFF00)!= 0x00390000)&&(((reg824&0xFFFFFF00)!= 0x80390000)))|| - ( ((reg800&0xFFFFFF00)!= 0x03040000)&&((reg800&0xFFFFFF00)!= 0x83040000))) - { - DBG_8192C("%s regc50:0x%08x, regc58:0x%08x, reg824:0x%08x, reg800:0x%08x,\n", __FUNCTION__, - regc50, regc58, reg824, reg800); - rtw_hal_sreset_reset(padapter); - } -#endif - - if (psrtpriv->dbg_trigger_point == SRESET_TGP_LINK_STATUS) { - psrtpriv->dbg_trigger_point = SRESET_TGP_NULL; - rtw_hal_sreset_reset(padapter); - return; - } -} -#endif - +/****************************************************************************** + * + * 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 + * + * + ******************************************************************************/ +#define _RTL8188E_SRESET_C_ + +#include +#include + +#ifdef DBG_CONFIG_ERROR_DETECT + +void rtl8188e_sreset_xmit_status_check(struct adapter *padapter) +{ + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter); + struct sreset_priv *psrtpriv = &pHalData->srestpriv; + + unsigned long current_time; + struct xmit_priv *pxmitpriv = &padapter->xmitpriv; + unsigned int diff_time; + u32 txdma_status; + + if( (txdma_status=rtw_read32(padapter, REG_TXDMA_STATUS)) !=0x00){ + DBG_871X("%s REG_TXDMA_STATUS:0x%08x\n", __FUNCTION__, txdma_status); + rtw_hal_sreset_reset(padapter); + } +#ifdef CONFIG_USB_HCI + //total xmit irp = 4 + //DBG_8192C("==>%s free_xmitbuf_cnt(%d),txirp_cnt(%d)\n",__FUNCTION__,pxmitpriv->free_xmitbuf_cnt,pxmitpriv->txirp_cnt); + //if(pxmitpriv->txirp_cnt == NR_XMITBUFF+1) + current_time = rtw_get_current_time(); + + if(0 == pxmitpriv->free_xmitbuf_cnt || 0 == pxmitpriv->free_xmit_extbuf_cnt) { + + diff_time = rtw_get_passing_time_ms(psrtpriv->last_tx_time); + + if (diff_time > 2000) { + if (psrtpriv->last_tx_complete_time == 0) { + psrtpriv->last_tx_complete_time = current_time; + } + else{ + diff_time = rtw_get_passing_time_ms(psrtpriv->last_tx_complete_time); + if (diff_time > 4000) { + u32 ability; + + //padapter->Wifi_Error_Status = WIFI_TX_HANG; + rtw_hal_get_def_var(padapter, HAL_DEF_DBG_DM_FUNC, &ability); + + DBG_871X("%s tx hang %s\n", __FUNCTION__, + (ability & ODM_BB_ADAPTIVITY)? "ODM_BB_ADAPTIVITY" : ""); + + if (!(ability & ODM_BB_ADAPTIVITY)) + rtw_hal_sreset_reset(padapter); + } + } + } + } +#endif //CONFIG_USB_HCI + + if (psrtpriv->dbg_trigger_point == SRESET_TGP_XMIT_STATUS) { + psrtpriv->dbg_trigger_point = SRESET_TGP_NULL; + rtw_hal_sreset_reset(padapter); + return; + } +} + +void rtl8188e_sreset_linked_status_check(struct adapter *padapter) +{ + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter); + struct sreset_priv *psrtpriv = &pHalData->srestpriv; + + u32 rx_dma_status = 0; + u8 fw_status=0; + rx_dma_status = rtw_read32(padapter,REG_RXDMA_STATUS); + if(rx_dma_status!= 0x00){ + DBG_8192C("%s REG_RXDMA_STATUS:0x%08x \n",__FUNCTION__,rx_dma_status); + rtw_write32(padapter,REG_RXDMA_STATUS,rx_dma_status); + } + fw_status = rtw_read8(padapter,REG_FMETHR); + if(fw_status != 0x00) + { + if(fw_status == 1) + DBG_8192C("%s REG_FW_STATUS (0x%02x), Read_Efuse_Fail !! \n",__FUNCTION__,fw_status); + else if(fw_status == 2) + DBG_8192C("%s REG_FW_STATUS (0x%02x), Condition_No_Match !! \n",__FUNCTION__,fw_status); + } +#if 0 + u32 regc50,regc58,reg824,reg800; + regc50 = rtw_read32(padapter,0xc50); + regc58 = rtw_read32(padapter,0xc58); + reg824 = rtw_read32(padapter,0x824); + reg800 = rtw_read32(padapter,0x800); + if( ((regc50&0xFFFFFF00)!= 0x69543400)|| + ((regc58&0xFFFFFF00)!= 0x69543400)|| + (((reg824&0xFFFFFF00)!= 0x00390000)&&(((reg824&0xFFFFFF00)!= 0x80390000)))|| + ( ((reg800&0xFFFFFF00)!= 0x03040000)&&((reg800&0xFFFFFF00)!= 0x83040000))) + { + DBG_8192C("%s regc50:0x%08x, regc58:0x%08x, reg824:0x%08x, reg800:0x%08x,\n", __FUNCTION__, + regc50, regc58, reg824, reg800); + rtw_hal_sreset_reset(padapter); + } +#endif + + if (psrtpriv->dbg_trigger_point == SRESET_TGP_LINK_STATUS) { + psrtpriv->dbg_trigger_point = SRESET_TGP_NULL; + rtw_hal_sreset_reset(padapter); + return; + } +} +#endif diff --git a/hal/rtl8188e_xmit.c b/hal/rtl8188e_xmit.c index 8fc63e6..53f6e6e 100755 --- a/hal/rtl8188e_xmit.c +++ b/hal/rtl8188e_xmit.c @@ -39,7 +39,7 @@ void dump_txrpt_ccx_88e(void *buf) , __func__ , txrpt_ccx->tag1, txrpt_ccx->pkt_num, txrpt_ccx->txdma_underflow, txrpt_ccx->int_bt, txrpt_ccx->int_tri, txrpt_ccx->int_ccx , txrpt_ccx->mac_id, txrpt_ccx->pkt_ok, txrpt_ccx->bmc - , txrpt_ccx->retry_cnt, txrpt_ccx->lifetime_over, txrpt_ccx->retry_over + , txrpt_ccx->retry_cnt, txrpt_ccx->lifetime_over, txrpt_ccx->retry_over , txrpt_ccx_qtime_88e(txrpt_ccx) , txrpt_ccx->final_data_rate , txrpt_ccx->qsel, txrpt_ccx_sw_88e(txrpt_ccx) @@ -71,16 +71,16 @@ void _dbg_dump_tx_info(struct adapter *padapter,int frame_tag,struct tx_desc *pt if(bDumpTxPkt ==1){//dump txdesc for data frame DBG_871X("dump tx_desc for data frame\n"); - if((frame_tag&0x0f) == DATA_FRAMETAG){ - bDumpTxDesc = _TRUE; + if((frame_tag&0x0f) == DATA_FRAMETAG){ + bDumpTxDesc = _TRUE; } - } + } else if(bDumpTxPkt ==2){//dump txdesc for mgnt frame DBG_871X("dump tx_desc for mgnt frame\n"); - if((frame_tag&0x0f) == MGNT_FRAMETAG){ - bDumpTxDesc = _TRUE; + if((frame_tag&0x0f) == MGNT_FRAMETAG){ + bDumpTxDesc = _TRUE; } - } + } else if(bDumpTxPkt ==3){//dump early info } @@ -114,7 +114,7 @@ void _dbg_dump_tx_info(struct adapter *padapter,int frame_tag,struct tx_desc *pt //#define DBG_EMINFO -#if RTL8188E_EARLY_MODE_PKT_NUM_10 == 1 +#if RTL8188E_EARLY_MODE_PKT_NUM_10 == 1 #define EARLY_MODE_MAX_PKT_NUM 10 #else #define EARLY_MODE_MAX_PKT_NUM 5 @@ -122,7 +122,7 @@ void _dbg_dump_tx_info(struct adapter *padapter,int frame_tag,struct tx_desc *pt struct EMInfo{ - u8 EMPktNum; + u8 EMPktNum; u16 EMPktLen[EARLY_MODE_MAX_PKT_NUM]; }; @@ -152,7 +152,7 @@ InsertEMContent_8188E( } #endif - + #if RTL8188E_EARLY_MODE_PKT_NUM_10 == 1 SET_EARLYMODE_PKTNUM(VirtualAddress, pEMInfo->EMPktNum); @@ -197,7 +197,7 @@ InsertEMContent_8188E( dwtmp += pEMInfo->EMPktLen[9]; } SET_EARLYMODE_LEN4(VirtualAddress, dwtmp); -#else +#else SET_EARLYMODE_PKTNUM(VirtualAddress, pEMInfo->EMPktNum); SET_EARLYMODE_LEN0(VirtualAddress, pEMInfo->EMPktLen[0]); SET_EARLYMODE_LEN1(VirtualAddress, pEMInfo->EMPktLen[1]); @@ -205,7 +205,7 @@ InsertEMContent_8188E( SET_EARLYMODE_LEN2_2(VirtualAddress, pEMInfo->EMPktLen[2]>>4); SET_EARLYMODE_LEN3(VirtualAddress, pEMInfo->EMPktLen[3]); SET_EARLYMODE_LEN4(VirtualAddress, pEMInfo->EMPktLen[4]); -#endif +#endif //RT_PRINT_DATA(COMP_SEND, DBG_LOUD, "EMHdr:", VirtualAddress, 8); } @@ -218,34 +218,34 @@ void UpdateEarlyModeInfo8188E(struct xmit_priv *pxmitpriv,struct xmit_buf *pxmit int index,j; u16 offset,pktlen; PTXDESC ptxdesc; - + u8 *pmem,*pEMInfo_mem; s8 node_num_0=0,node_num_1=0; struct EMInfo eminfo; struct agg_pkt_info *paggpkt; - struct xmit_frame *pframe = (struct xmit_frame*)pxmitbuf->priv_data; - pmem= pframe->buf_addr; - - #ifdef DBG_EMINFO + struct xmit_frame *pframe = (struct xmit_frame*)pxmitbuf->priv_data; + pmem= pframe->buf_addr; + + #ifdef DBG_EMINFO DBG_8192C("\n%s ==> agg_num:%d\n",__FUNCTION__, pframe->agg_num); for(index=0;indexagg_num;index++){ - offset = pxmitpriv->agg_pkt[index].offset; + offset = pxmitpriv->agg_pkt[index].offset; pktlen = pxmitpriv->agg_pkt[index].pkt_len; DBG_8192C("%s ==> agg_pkt[%d].offset=%d\n",__FUNCTION__,index,offset); DBG_8192C("%s ==> agg_pkt[%d].pkt_len=%d\n",__FUNCTION__,index,pktlen); } #endif - + if( pframe->agg_num > EARLY_MODE_MAX_PKT_NUM) - { + { node_num_0 = pframe->agg_num; node_num_1= EARLY_MODE_MAX_PKT_NUM-1; } - + for(index=0;indexagg_num;index++){ offset = pxmitpriv->agg_pkt[index].offset; - pktlen = pxmitpriv->agg_pkt[index].pkt_len; + pktlen = pxmitpriv->agg_pkt[index].pkt_len; _rtw_memset(&eminfo,0,sizeof(struct EMInfo)); if( pframe->agg_num > EARLY_MODE_MAX_PKT_NUM){ @@ -255,38 +255,36 @@ void UpdateEarlyModeInfo8188E(struct xmit_priv *pxmitpriv,struct xmit_buf *pxmit } else{ eminfo.EMPktNum = node_num_1; - node_num_1--; - } + node_num_1--; + } } else{ - eminfo.EMPktNum = pframe->agg_num-(index+1); - } + eminfo.EMPktNum = pframe->agg_num-(index+1); + } for(j=0;j< eminfo.EMPktNum ;j++){ eminfo.EMPktLen[j] = pxmitpriv->agg_pkt[index+1+j].pkt_len+4;// 4 bytes CRC } - + if(pmem){ if(index==0){ ptxdesc = (PTXDESC)(pmem); - pEMInfo_mem = ((u8 *)ptxdesc)+TXDESC_SIZE; + pEMInfo_mem = ((u8 *)ptxdesc)+TXDESC_SIZE; } else{ pmem = pmem + pxmitpriv->agg_pkt[index-1].offset; ptxdesc = (PTXDESC)(pmem); - pEMInfo_mem = ((u8 *)ptxdesc)+TXDESC_SIZE; + pEMInfo_mem = ((u8 *)ptxdesc)+TXDESC_SIZE; } - + #ifdef DBG_EMINFO DBG_8192C("%s ==> desc.pkt_len=%d\n",__FUNCTION__,ptxdesc->pktlen); #endif InsertEMContent_8188E(&eminfo,pEMInfo_mem); - } - - - } + } + + + } _rtw_memset(pxmitpriv->agg_pkt,0,sizeof(struct agg_pkt_info)*MAX_AGG_PKT_NUM); } #endif - - diff --git a/hal/rtl8188eu_led.c b/hal/rtl8188eu_led.c index 0d7dfc6..041b1f7 100755 --- a/hal/rtl8188eu_led.c +++ b/hal/rtl8188eu_led.c @@ -1,7 +1,7 @@ /****************************************************************************** * * 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. @@ -34,7 +34,7 @@ //================================================================================ -// LED_819xUsb routines. +// LED_819xUsb routines. //================================================================================ // @@ -43,7 +43,7 @@ // void SwLedOn( - struct adapter *padapter, + struct adapter *padapter, PLED_871x pLed ) { @@ -57,7 +57,7 @@ SwLedOn( LedCfg = rtw_read8(padapter, REG_LEDCFG2); switch(pLed->LedPin) - { + { case LED_PIN_LED0: rtw_write8(padapter, REG_LEDCFG2, (LedCfg&0xf0)|BIT5|BIT6); // SW control led0 on. break; @@ -69,7 +69,7 @@ SwLedOn( default: break; } - + pLed->bLedOn = _TRUE; } @@ -80,14 +80,14 @@ SwLedOn( // void SwLedOff( - struct adapter *padapter, + struct adapter *padapter, PLED_871x pLed ) { u8 LedCfg; HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter); - if((padapter->bSurpriseRemoved == _TRUE) || ( padapter->bDriverStopped == _TRUE)) + if((padapter->bSurpriseRemoved == _TRUE) || ( padapter->bDriverStopped == _TRUE)) { goto exit; } @@ -100,11 +100,11 @@ SwLedOff( case LED_PIN_LED0: if(pHalData->bLedOpenDrain == _TRUE) // Open-drain arrangement for controlling the LED) { - LedCfg &= 0x90; // Set to software control. - rtw_write8(padapter, REG_LEDCFG2, (LedCfg|BIT3)); + LedCfg &= 0x90; // Set to software control. + rtw_write8(padapter, REG_LEDCFG2, (LedCfg|BIT3)); LedCfg = rtw_read8(padapter, REG_MAC_PINMUX_CFG); LedCfg &= 0xFE; - rtw_write8(padapter, REG_MAC_PINMUX_CFG, LedCfg); + rtw_write8(padapter, REG_MAC_PINMUX_CFG, LedCfg); } else { @@ -122,7 +122,7 @@ SwLedOff( } exit: pLed->bLedOn = _FALSE; - + } //================================================================================ @@ -167,4 +167,3 @@ rtl8188eu_DeInitSwLeds( DeInitLed871x( &(ledpriv->SwLed0) ); DeInitLed871x( &(ledpriv->SwLed1) ); } - diff --git a/hal/rtl8188eu_recv.c b/hal/rtl8188eu_recv.c index f1697b2..9b6a4e9 100755 --- a/hal/rtl8188eu_recv.c +++ b/hal/rtl8188eu_recv.c @@ -1,7 +1,7 @@ /****************************************************************************** * * 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. @@ -58,7 +58,7 @@ int rtl8188eu_init_recv_priv(struct adapter *padapter) int i, res = _SUCCESS; struct recv_buf *precvbuf; -#ifdef CONFIG_RECV_THREAD_MODE +#ifdef CONFIG_RECV_THREAD_MODE _rtw_init_sema(&precvpriv->recv_sema, 0);//will be removed _rtw_init_sema(&precvpriv->terminate_recvthread_sema, 0);//will be removed #endif @@ -208,5 +208,3 @@ void rtl8188eu_free_recv_priv (struct adapter *padapter) #endif } - - diff --git a/hal/rtl8188eu_xmit.c b/hal/rtl8188eu_xmit.c index c5c5c67..018b5a8 100755 --- a/hal/rtl8188eu_xmit.c +++ b/hal/rtl8188eu_xmit.c @@ -1,7 +1,7 @@ /****************************************************************************** * * 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. @@ -52,7 +52,7 @@ u8 urb_zero_packet_chk(struct adapter *padapter, int sz) u8 blnSetTxDescOffset; HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter); blnSetTxDescOffset = (((sz + TXDESC_SIZE) % pHalData->UsbBulkOutSize) ==0)?1:0; - + return blnSetTxDescOffset; } @@ -65,12 +65,12 @@ void rtl8188eu_cal_txdesc_chksum(struct tx_desc *ptxdesc) //Clear first ptxdesc->txdw7 &= cpu_to_le32(0xffff0000); - + for(index = 0 ; index < count ; index++){ checksum = checksum ^ le16_to_cpu(*(usPtr + index)); } - ptxdesc->txdw7 |= cpu_to_le32(0x0000ffff&checksum); + ptxdesc->txdw7 |= cpu_to_le32(0x0000ffff&checksum); } // @@ -133,15 +133,15 @@ void fill_txdesc_sectype(struct pkt_attrib *pattrib, struct tx_desc *ptxdesc) if ((pattrib->encrypt > 0) && !pattrib->bswenc) { switch (pattrib->encrypt) - { + { //SEC_TYPE : 0:NO_ENC,1:WEP40/TKIP,2:WAPI,3:AES case _WEP40_: case _WEP104_: ptxdesc->txdw1 |= cpu_to_le32((0x01<txdw2 |= cpu_to_le32(0x7 << AMPDU_DENSITY_SHT); - break; + break; case _TKIP_: - case _TKIP_WTMIC_: + case _TKIP_WTMIC_: ptxdesc->txdw1 |= cpu_to_le32((0x01<txdw2 |= cpu_to_le32(0x7 << AMPDU_DENSITY_SHT); break; @@ -158,16 +158,16 @@ void fill_txdesc_sectype(struct pkt_attrib *pattrib, struct tx_desc *ptxdesc) case _NO_PRIVACY_: default: break; - + } - + } } void fill_txdesc_vcs(struct pkt_attrib *pattrib, u32 *pdw) { - //DBG_8192C("cvs_mode=%d\n", pattrib->vcs_mode); + //DBG_8192C("cvs_mode=%d\n", pattrib->vcs_mode); switch(pattrib->vcs_mode) { @@ -179,7 +179,7 @@ void fill_txdesc_vcs(struct pkt_attrib *pattrib, u32 *pdw) break; case NONE_VCS: default: - break; + break; } if(pattrib->vcs_mode) { @@ -211,7 +211,7 @@ void fill_txdesc_phy(struct pkt_attrib *pattrib, u32 *pdw) *pdw |= (pattrib->bwmode&HT_CHANNEL_WIDTH_40)? cpu_to_le32(BIT(25)):0; if(pattrib->ch_offset == HAL_PRIME_CHNL_OFFSET_LOWER) - *pdw |= cpu_to_le32((0x01<ch_offset == HAL_PRIME_CHNL_OFFSET_UPPER) *pdw |= cpu_to_le32((0x02<ch_offset == HAL_PRIME_CHNL_OFFSET_DONT_CARE) @@ -223,12 +223,12 @@ void fill_txdesc_phy(struct pkt_attrib *pattrib, u32 *pdw) static s32 update_txdesc(struct xmit_frame *pxmitframe, u8 *pmem, s32 sz ,u8 bagg_pkt) -{ +{ int pull=0; uint qsel; u8 data_rate,pwr_status,offset; struct adapter *padapter = pxmitframe->padapter; - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; + struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct pkt_attrib *pattrib = &pxmitframe->attrib; HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter); //struct dm_priv *pdmpriv = &pHalData->dmpriv; @@ -236,16 +236,16 @@ static s32 update_txdesc(struct xmit_frame *pxmitframe, u8 *pmem, s32 sz ,u8 bag struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); sint bmcst = IS_MCAST(pattrib->ra); - + #ifdef CONFIG_P2P struct wifidirect_info* pwdinfo = &padapter->wdinfo; #endif //CONFIG_P2P -#ifndef CONFIG_USE_USB_BUFFER_ALLOC_TX +#ifndef CONFIG_USE_USB_BUFFER_ALLOC_TX if (padapter->registrypriv.mp_mode == 0) { if((!bagg_pkt) &&(urb_zero_packet_chk(padapter, sz)==0))//(sz %512) != 0 - //if((!bagg_pkt) &&(rtw_usb_bulk_size_boundary(padapter,TXDESC_SIZE+sz)==_FALSE)) + //if((!bagg_pkt) &&(rtw_usb_bulk_size_boundary(padapter,TXDESC_SIZE+sz)==_FALSE)) { ptxdesc = (struct tx_desc *)(pmem+PACKET_OFFSET_SZ); //DBG_8192C("==> non-agg-pkt,shift pointer...\n"); @@ -255,17 +255,17 @@ if (padapter->registrypriv.mp_mode == 0) #endif // CONFIG_USE_USB_BUFFER_ALLOC_TX _rtw_memset(ptxdesc, 0, sizeof(struct tx_desc)); - + //4 offset 0 ptxdesc->txdw0 |= cpu_to_le32(OWN | FSG | LSG); //DBG_8192C("%s==> pkt_len=%d,bagg_pkt=%02x\n",__FUNCTION__,sz,bagg_pkt); ptxdesc->txdw0 |= cpu_to_le32(sz & 0x0000ffff);//update TXPKTSIZE - - offset = TXDESC_SIZE + OFFSET_SZ; - #ifdef CONFIG_TX_EARLY_MODE - if(bagg_pkt){ - offset += EARLY_MODE_INFO_SIZE ;//0x28 + offset = TXDESC_SIZE + OFFSET_SZ; + + #ifdef CONFIG_TX_EARLY_MODE + if(bagg_pkt){ + offset += EARLY_MODE_INFO_SIZE ;//0x28 } #endif //DBG_8192C("%s==>offset(0x%02x) \n",__FUNCTION__,offset); @@ -277,11 +277,11 @@ if (padapter->registrypriv.mp_mode == 0) if (padapter->registrypriv.mp_mode == 0) { if(!bagg_pkt){ - if((pull) && (pxmitframe->pkt_offset>0)) { - pxmitframe->pkt_offset = pxmitframe->pkt_offset -1; + if((pull) && (pxmitframe->pkt_offset>0)) { + pxmitframe->pkt_offset = pxmitframe->pkt_offset -1; } } -} +} #endif //DBG_8192C("%s, pkt_offset=0x%02x\n",__FUNCTION__,pxmitframe->pkt_offset); @@ -294,7 +294,7 @@ if (padapter->registrypriv.mp_mode == 0) if((pxmitframe->frame_tag&0x0f) == DATA_FRAMETAG) { - //DBG_8192C("pxmitframe->frame_tag == DATA_FRAMETAG\n"); + //DBG_8192C("pxmitframe->frame_tag == DATA_FRAMETAG\n"); //offset 4 ptxdesc->txdw1 |= cpu_to_le32(pattrib->mac_id&0x3F); @@ -309,20 +309,20 @@ if (padapter->registrypriv.mp_mode == 0) if(pattrib->ampdu_en==_TRUE){ ptxdesc->txdw2 |= cpu_to_le32(AGG_EN);//AGG EN - + //SET_TX_DESC_MAX_AGG_NUM_88E(pDesc, 0x1F); //SET_TX_DESC_MCSG1_MAX_LEN_88E(pDesc, 0x6); //SET_TX_DESC_MCSG2_MAX_LEN_88E(pDesc, 0x6); //SET_TX_DESC_MCSG3_MAX_LEN_88E(pDesc, 0x6); //SET_TX_DESC_MCS7_SGI_MAX_LEN_88E(pDesc, 0x6); - ptxdesc->txdw6 = 0x6666f800; + ptxdesc->txdw6 = 0x6666f800; } else{ ptxdesc->txdw2 |= cpu_to_le32(AGG_BK);//AGG BK } - + //offset 8 - + //offset 12 ptxdesc->txdw3 |= cpu_to_le32((pattrib->seqnum<< SEQ_SHT)&0x0FFF0000); @@ -346,49 +346,49 @@ if (padapter->registrypriv.mp_mode == 0) (pattrib->dhcp_pkt != 1)) { //Non EAP & ARP & DHCP type data packet - + fill_txdesc_vcs(pattrib, &ptxdesc->txdw4); fill_txdesc_phy(pattrib, &ptxdesc->txdw4); ptxdesc->txdw4 |= cpu_to_le32(0x00000008);//RTS Rate=24M - ptxdesc->txdw5 |= cpu_to_le32(0x0001ff00);//DATA/RTS Rate FB LMT + ptxdesc->txdw5 |= cpu_to_le32(0x0001ff00);//DATA/RTS Rate FB LMT - #if (RATE_ADAPTIVE_SUPPORT == 1) + #if (RATE_ADAPTIVE_SUPPORT == 1) if(pattrib->ht_en){ if( ODM_RA_GetShortGI_8188E(&pHalData->odmpriv,pattrib->mac_id)) ptxdesc->txdw5 |= cpu_to_le32(SGI);//SGI } - - data_rate =ODM_RA_GetDecisionRate_8188E(&pHalData->odmpriv,pattrib->mac_id); + + data_rate =ODM_RA_GetDecisionRate_8188E(&pHalData->odmpriv,pattrib->mac_id); //for debug - #if 1 + #if 1 if(padapter->fix_rate!= 0xFF){ - + data_rate = padapter->fix_rate; ptxdesc->txdw4 |= cpu_to_le32(DISDATAFB); //printk("==> fix data_rate:0x%02x\n",data_rate); } #endif - - ptxdesc->txdw5 |= cpu_to_le32(data_rate & 0x3F); + + ptxdesc->txdw5 |= cpu_to_le32(data_rate & 0x3F); #if (POWER_TRAINING_ACTIVE==1) pwr_status = ODM_RA_GetHwPwrStatus_8188E(&pHalData->odmpriv,pattrib->mac_id); ptxdesc->txdw4 |=cpu_to_le32( (pwr_status & 0x7)<< PWR_STATUS_SHT); #endif //(POWER_TRAINING_ACTIVE==1) - #else//if (RATE_ADAPTIVE_SUPPORT == 1) - + #else//if (RATE_ADAPTIVE_SUPPORT == 1) + if(pattrib->ht_en) ptxdesc->txdw5 |= cpu_to_le32(SGI);//SGI - data_rate = 0x13; //default rate: MCS7 + data_rate = 0x13; //default rate: MCS7 if(padapter->fix_rate!= 0xFF){//rate control by iwpriv - data_rate = padapter->fix_rate; + data_rate = padapter->fix_rate; ptxdesc->txdw4 | cpu_to_le32(DISDATAFB); } - ptxdesc->txdw5 |= cpu_to_le32(data_rate & 0x3F); + ptxdesc->txdw5 |= cpu_to_le32(data_rate & 0x3F); - #endif//if (RATE_ADAPTIVE_SUPPORT == 1) + #endif//if (RATE_ADAPTIVE_SUPPORT == 1) } else @@ -397,7 +397,7 @@ if (padapter->registrypriv.mp_mode == 0) // Use the 1M data rate to send the EAP/ARP packet. // This will maybe make the handshake smooth. - ptxdesc->txdw2 |= cpu_to_le32(AGG_BK);//AGG BK + ptxdesc->txdw2 |= cpu_to_le32(AGG_BK);//AGG BK if (pmlmeinfo->preamble_mode == PREAMBLE_SHORT) ptxdesc->txdw4 |= cpu_to_le32(BIT(24));// DATA_SHORT @@ -417,19 +417,19 @@ if (padapter->registrypriv.mp_mode == 0) } else if((pxmitframe->frame_tag&0x0f)== MGNT_FRAMETAG) { - //DBG_8192C("pxmitframe->frame_tag == MGNT_FRAMETAG\n"); - - //offset 4 + //DBG_8192C("pxmitframe->frame_tag == MGNT_FRAMETAG\n"); + + //offset 4 ptxdesc->txdw1 |= cpu_to_le32(pattrib->mac_id&0x3f); - + qsel = (uint)(pattrib->qsel&0x0000001f); ptxdesc->txdw1 |= cpu_to_le32((qsel<txdw1 |= cpu_to_le32((pattrib->raid<< RATE_ID_SHT) & 0x000f0000); - + //fill_txdesc_sectype(pattrib, ptxdesc); - - //offset 8 + + //offset 8 #ifdef CONFIG_XMIT_ACK //CCX-TXRPT ack for xmit mgmt frames. if (pxmitframe->ack_report) { @@ -445,7 +445,7 @@ if (padapter->registrypriv.mp_mode == 0) //offset 12 ptxdesc->txdw3 |= cpu_to_le32((pattrib->seqnum<txdw5 |= cpu_to_le32(RTY_LMT_EN);//retry limit enable if(pattrib->retry_ctrl == _TRUE) @@ -472,12 +472,12 @@ if (padapter->registrypriv.mp_mode == 0) { DBG_8192C("pxmitframe->frame_tag = %d\n", pxmitframe->frame_tag); - //offset 4 + //offset 4 ptxdesc->txdw1 |= cpu_to_le32((4)&0x3f);//CAM_ID(MAC_ID) ptxdesc->txdw1 |= cpu_to_le32((6<< RATE_ID_SHT) & 0x000f0000);//raid - //offset 8 + //offset 8 //offset 12 ptxdesc->txdw3 |= cpu_to_le32((pattrib->seqnum<registrypriv.mp_mode == 0) // (3) Use HW Qos SEQ to control the seq num of Ext port non-Qos packets. // 2010.06.23. Added by tynli. if(!pattrib->qos_en) - { + { //ptxdesc->txdw4 |= cpu_to_le32(BIT(7)); // Hw set sequence number //ptxdesc->txdw3 |= cpu_to_le32((8 <<28)); //set bit3 to 1. Suugested by TimChen. 2009.12.29. ptxdesc->txdw3 |= cpu_to_le32(EN_HWSEQ); // Hw set sequence number - ptxdesc->txdw4 |= cpu_to_le32(HW_SSN); // Hw set sequence number - + ptxdesc->txdw4 |= cpu_to_le32(HW_SSN); // Hw set sequence number + } -#ifdef CONFIG_HW_ANTENNA_DIVERSITY //CONFIG_ANTENNA_DIVERSITY +#ifdef CONFIG_HW_ANTENNA_DIVERSITY //CONFIG_ANTENNA_DIVERSITY ODM_SetTxAntByTxInfo_88E(&pHalData->odmpriv, pmem, pattrib->mac_id); #endif rtl8188eu_cal_txdesc_chksum(ptxdesc); - _dbg_dump_tx_info(padapter,pxmitframe->frame_tag,ptxdesc); + _dbg_dump_tx_info(padapter,pxmitframe->frame_tag,ptxdesc); return pull; - + } @@ -606,18 +606,18 @@ static s32 rtw_dump_xframe(struct adapter *padapter, struct xmit_frame *pxmitfra mem_addr = pxmitframe->buf_addr; RT_TRACE(_module_rtl871x_xmit_c_,_drv_info_,("rtw_dump_xframe()\n")); - + for (t = 0; t < pattrib->nr_frags; t++) { if (inner_ret != _SUCCESS && ret == _SUCCESS) ret = _FAIL; - + if (t != (pattrib->nr_frags - 1)) { RT_TRACE(_module_rtl871x_xmit_c_,_drv_err_,("pattrib->nr_frags=%d\n", pattrib->nr_frags)); sz = pxmitpriv->frag_len; - sz = sz - 4 - (psecuritypriv->sw_encrypt ? 0 : pattrib->icv_len); + sz = sz - 4 - (psecuritypriv->sw_encrypt ? 0 : pattrib->icv_len); } else //no frag { @@ -625,12 +625,12 @@ static s32 rtw_dump_xframe(struct adapter *padapter, struct xmit_frame *pxmitfra } pull = update_txdesc(pxmitframe, mem_addr, sz, _FALSE); - + if(pull) { mem_addr += PACKET_OFFSET_SZ; //pull txdesc head - - //pxmitbuf ->pbuf = mem_addr; + + //pxmitbuf ->pbuf = mem_addr; pxmitframe->buf_addr = mem_addr; w_sz = sz + TXDESC_SIZE; @@ -638,10 +638,10 @@ static s32 rtw_dump_xframe(struct adapter *padapter, struct xmit_frame *pxmitfra else { w_sz = sz + TXDESC_SIZE + PACKET_OFFSET_SZ; - } -#ifdef CONFIG_IOL_IOREG_CFG_DBG + } +#ifdef CONFIG_IOL_IOREG_CFG_DBG rtw_IOL_cmd_buf_dump(padapter,w_sz,pxmitframe->buf_addr); -#endif +#endif ff_hwaddr = rtw_get_ff_hwaddr(pxmitframe); #ifdef CONFIG_XMIT_THREAD_MODE @@ -655,19 +655,19 @@ static s32 rtw_dump_xframe(struct adapter *padapter, struct xmit_frame *pxmitfra rtw_count_tx_stats(padapter, pxmitframe, sz); RT_TRACE(_module_rtl871x_xmit_c_,_drv_info_,("rtw_write_port, w_sz=%d\n", w_sz)); - //DBG_8192C("rtw_write_port, w_sz=%d, sz=%d, txdesc_sz=%d, tid=%d\n", w_sz, sz, w_sz-sz, pattrib->priority); + //DBG_8192C("rtw_write_port, w_sz=%d, sz=%d, txdesc_sz=%d, tid=%d\n", w_sz, sz, w_sz-sz, pattrib->priority); mem_addr += w_sz; mem_addr = (u8 *)RND4(((SIZE_PTR)(mem_addr))); } - + rtw_free_xmitframe(pxmitpriv, pxmitframe); - + if (ret != _SUCCESS) rtw_sctx_done_err(&pxmitbuf->sctx, RTW_SCTX_DONE_UNKNOWN); - + return ret; } @@ -736,7 +736,7 @@ s32 rtl8188eu_xmitframe_complete(struct adapter *padapter, struct xmit_priv *pxm //3 1. pick up first frame do { rtw_free_xmitframe(pxmitpriv, pxmitframe); - + pxmitframe = rtw_dequeue_xframe(pxmitpriv, pxmitpriv->hwxmits, pxmitpriv->hwxmit_entry); if (pxmitframe == NULL) { // no more xmit frame, release xmit buffer @@ -807,15 +807,15 @@ s32 rtl8188eu_xmitframe_complete(struct adapter *padapter, struct xmit_priv *pxm //psta = pfirstframe->attrib.psta; psta = rtw_get_stainfo(&padapter->stapriv, pfirstframe->attrib.ra); if(pfirstframe->attrib.psta != psta){ - DBG_871X("%s, pattrib->psta(%p) != psta(%p)\n", __func__, pfirstframe->attrib.psta, psta); + DBG_871X("%s, pattrib->psta(%p) != psta(%p)\n", __func__, pfirstframe->attrib.psta, psta); } - if (psta == NULL) { - DBG_8192C("rtw_xmit_classifier: psta == NULL\n"); + if (psta == NULL) { + DBG_8192C("rtw_xmit_classifier: psta == NULL\n"); } if(!(psta->state &_FW_LINKED)){ - DBG_871X("%s, psta->state(0x%x) != _FW_LINKED\n", __func__, psta->state); + DBG_871X("%s, psta->state(0x%x) != _FW_LINKED\n", __func__, psta->state); } - + switch (pfirstframe->attrib.priority) { case 1: case 2: @@ -849,7 +849,7 @@ s32 rtl8188eu_xmitframe_complete(struct adapter *padapter, struct xmit_priv *pxm xmitframe_phead = get_list_head(&ptxservq->sta_pending); xmitframe_plist = get_next(xmitframe_phead); - + while (rtw_end_of_queue_search(xmitframe_phead, xmitframe_plist) == _FALSE) { pxmitframe = LIST_CONTAINOR(xmitframe_plist, struct xmit_frame, list); @@ -860,17 +860,17 @@ s32 rtl8188eu_xmitframe_complete(struct adapter *padapter, struct xmit_priv *pxm pxmitframe->pkt_offset = 1;// not first frame of aggregation,reserve offset for EM Info #else pxmitframe->pkt_offset = 0; // not first frame of aggregation, no need to reserve offset - #endif + #endif len = xmitframe_need_length(pxmitframe) + TXDESC_SIZE +(pxmitframe->pkt_offset*PACKET_OFFSET_SZ); - + if (_RND8(pbuf + len) > MAX_XMITBUF_SZ) //if (_RND8(pbuf + len) > (MAX_XMITBUF_SZ/2))//to do : for TX TP finial tune , Georgia 2012-0323 { //DBG_8192C("%s....len> MAX_XMITBUF_SZ\n",__FUNCTION__); pxmitframe->agg_num = 1; - pxmitframe->pkt_offset = 1; - break; + pxmitframe->pkt_offset = 1; + break; } rtw_list_delete(&pxmitframe->list); ptxservq->qcnt--; @@ -899,7 +899,7 @@ s32 rtl8188eu_xmitframe_complete(struct adapter *padapter, struct xmit_priv *pxm // pxmitframe->pxmitbuf = pxmitbuf; pxmitframe->buf_addr = pxmitbuf->pbuf + pbuf; - + if (rtw_xmitframe_coalesce(padapter, pxmitframe->pkt, pxmitframe) == _FALSE) { DBG_871X("%s coalesce failed \n",__FUNCTION__); rtw_free_xmitframe(pxmitpriv, pxmitframe); @@ -912,7 +912,7 @@ s32 rtl8188eu_xmitframe_complete(struct adapter *padapter, struct xmit_priv *pxm // (len - TXDESC_SIZE) == pxmitframe->attrib.last_txcmdsz update_txdesc(pxmitframe, pxmitframe->buf_addr, pxmitframe->attrib.last_txcmdsz,_TRUE); - + // don't need xmitframe any more rtw_free_xmitframe(pxmitpriv, pxmitframe); @@ -922,9 +922,9 @@ s32 rtl8188eu_xmitframe_complete(struct adapter *padapter, struct xmit_priv *pxm pfirstframe->agg_num++; -#ifdef CONFIG_TX_EARLY_MODE - pxmitpriv->agg_pkt[pfirstframe->agg_num-1].offset = _RND8(len); - pxmitpriv->agg_pkt[pfirstframe->agg_num-1].pkt_len = pxmitframe->attrib.last_txcmdsz; +#ifdef CONFIG_TX_EARLY_MODE + pxmitpriv->agg_pkt[pfirstframe->agg_num-1].offset = _RND8(len); + pxmitpriv->agg_pkt[pfirstframe->agg_num-1].pkt_len = pxmitframe->attrib.last_txcmdsz; #endif if (MAX_TX_AGG_PACKET_NUMBER == pfirstframe->agg_num) break; @@ -965,15 +965,15 @@ s32 rtl8188eu_xmitframe_complete(struct adapter *padapter, struct xmit_priv *pxm #endif // CONFIG_USE_USB_BUFFER_ALLOC_TX update_txdesc(pfirstframe, pfirstframe->buf_addr, pfirstframe->attrib.last_txcmdsz,_TRUE); - + #ifdef CONFIG_TX_EARLY_MODE //prepare EM info for first frame, agg_num value start from 1 pxmitpriv->agg_pkt[0].offset = _RND8(pfirstframe->attrib.last_txcmdsz +TXDESC_SIZE +(pfirstframe->pkt_offset*PACKET_OFFSET_SZ)); - pxmitpriv->agg_pkt[0].pkt_len = pfirstframe->attrib.last_txcmdsz;//get from rtw_xmitframe_coalesce + pxmitpriv->agg_pkt[0].pkt_len = pfirstframe->attrib.last_txcmdsz;//get from rtw_xmitframe_coalesce UpdateEarlyModeInfo8188E(pxmitpriv,pxmitbuf ); #endif - + //3 4. write xmit buffer to USB FIFO ff_hwaddr = rtw_get_ff_hwaddr(pfirstframe); //DBG_8192C("%s ===================================== write port,buf_size(%d) \n",__FUNCTION__,pbuf_tail); @@ -984,8 +984,8 @@ s32 rtl8188eu_xmitframe_complete(struct adapter *padapter, struct xmit_priv *pxm //3 5. update statisitc pbuf_tail -= (pfirstframe->agg_num * TXDESC_SIZE); pbuf_tail -= (pfirstframe->pkt_offset * PACKET_OFFSET_SZ); - - + + rtw_count_tx_stats(padapter, pfirstframe, pbuf_tail); rtw_free_xmitframe(pxmitpriv, pfirstframe); @@ -996,11 +996,11 @@ s32 rtl8188eu_xmitframe_complete(struct adapter *padapter, struct xmit_priv *pxm #else s32 rtl8188eu_xmitframe_complete(struct adapter *padapter, struct xmit_priv *pxmitpriv, struct xmit_buf *pxmitbuf) -{ +{ struct hw_xmit *phwxmits; sint hwentry; - struct xmit_frame *pxmitframe=NULL; + struct xmit_frame *pxmitframe=NULL; int res=_SUCCESS, xcnt = 0; phwxmits = pxmitpriv->hwxmits; @@ -1010,65 +1010,65 @@ s32 rtl8188eu_xmitframe_complete(struct adapter *padapter, struct xmit_priv *pxm if(pxmitbuf==NULL) { - pxmitbuf = rtw_alloc_xmitbuf(pxmitpriv); + pxmitbuf = rtw_alloc_xmitbuf(pxmitpriv); if(!pxmitbuf) { return _FALSE; - } - } + } + } do - { + { pxmitframe = rtw_dequeue_xframe(pxmitpriv, phwxmits, hwentry); - + if(pxmitframe) { - pxmitframe->pxmitbuf = pxmitbuf; + pxmitframe->pxmitbuf = pxmitbuf; pxmitframe->buf_addr = pxmitbuf->pbuf; - pxmitbuf->priv_data = pxmitframe; + pxmitbuf->priv_data = pxmitframe; if((pxmitframe->frame_tag&0x0f) == DATA_FRAMETAG) - { + { if(pxmitframe->attrib.priority<=15)//TID0~15 { res = rtw_xmitframe_coalesce(padapter, pxmitframe->pkt, pxmitframe); - } + } //DBG_8192C("==> pxmitframe->attrib.priority:%d\n",pxmitframe->attrib.priority); - rtw_os_xmit_complete(padapter, pxmitframe);//always return ndis_packet after rtw_xmitframe_coalesce + rtw_os_xmit_complete(padapter, pxmitframe);//always return ndis_packet after rtw_xmitframe_coalesce } - + RT_TRACE(_module_rtl871x_xmit_c_,_drv_info_,("xmitframe_complete(): rtw_dump_xframe\n")); - + if(res == _SUCCESS) { - rtw_dump_xframe(padapter, pxmitframe); + rtw_dump_xframe(padapter, pxmitframe); } else { rtw_free_xmitbuf(pxmitpriv, pxmitbuf); - rtw_free_xmitframe(pxmitpriv, pxmitframe); + rtw_free_xmitframe(pxmitpriv, pxmitframe); } - + xcnt++; - + } else - { + { rtw_free_xmitbuf(pxmitpriv, pxmitbuf); return _FALSE; } break; - + }while(0/*xcnt < (NR_XMITFRAME >> 3)*/); return _TRUE; - + } #endif @@ -1103,11 +1103,11 @@ static s32 pre_xmitframe(struct adapter *padapter, struct xmit_frame *pxmitframe struct xmit_priv *pxmitpriv = &padapter->xmitpriv; struct pkt_attrib *pattrib = &pxmitframe->attrib; struct mlme_priv *pmlmepriv = &padapter->mlmepriv; -#ifdef CONFIG_CONCURRENT_MODE +#ifdef CONFIG_CONCURRENT_MODE struct adapter *pbuddy_adapter = padapter->pbuddy_adapter; - struct mlme_priv *pbuddy_mlmepriv = &(pbuddy_adapter->mlmepriv); + struct mlme_priv *pbuddy_mlmepriv = &(pbuddy_adapter->mlmepriv); #endif - + _enter_critical_bh(&pxmitpriv->lock, &irqL); //DBG_8192C("==> %s \n",__FUNCTION__); @@ -1122,7 +1122,7 @@ static s32 pre_xmitframe(struct adapter *padapter, struct xmit_frame *pxmitframe if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY|_FW_UNDER_LINKING) == _TRUE) goto enqueue; -#ifdef CONFIG_CONCURRENT_MODE +#ifdef CONFIG_CONCURRENT_MODE if (check_fwstate(pbuddy_mlmepriv, _FW_UNDER_SURVEY|_FW_UNDER_LINKING) == _TRUE) goto enqueue; #endif @@ -1178,31 +1178,31 @@ s32 rtl8188eu_hal_xmit(struct adapter *padapter, struct xmit_frame *pxmitframe) s32 rtl8188eu_hal_xmitframe_enqueue(struct adapter *padapter, struct xmit_frame *pxmitframe) { - struct xmit_priv *pxmitpriv = &padapter->xmitpriv; + struct xmit_priv *pxmitpriv = &padapter->xmitpriv; s32 err; - - if ((err=rtw_xmitframe_enqueue(padapter, pxmitframe)) != _SUCCESS) + + if ((err=rtw_xmitframe_enqueue(padapter, pxmitframe)) != _SUCCESS) { rtw_free_xmitframe(pxmitpriv, pxmitframe); // Trick, make the statistics correct pxmitpriv->tx_pkts--; - pxmitpriv->tx_drop++; + pxmitpriv->tx_drop++; } else { tasklet_hi_schedule(&pxmitpriv->xmit_tasklet); } - + return err; - + } #ifdef CONFIG_HOSTAPD_MLME static void rtl8188eu_hostap_mgnt_xmit_cb(struct urb *urb) -{ +{ struct sk_buff *skb = (struct sk_buff *)urb->context; //DBG_8192C("%s\n", __FUNCTION__); @@ -1213,23 +1213,23 @@ static void rtl8188eu_hostap_mgnt_xmit_cb(struct urb *urb) s32 rtl8188eu_hostap_mgnt_xmit_entry(struct adapter *padapter, _pkt *pkt) { u16 fc; - int rc, len, pipe; + int rc, len, pipe; unsigned int bmcst, tid, qsel; struct sk_buff *skb, *pxmit_skb; struct urb *urb; unsigned char *pxmitbuf; struct tx_desc *ptxdesc; struct rtw_ieee80211_hdr *tx_hdr; - struct hostapd_priv *phostapdpriv = padapter->phostapdpriv; + struct hostapd_priv *phostapdpriv = padapter->phostapdpriv; struct net_device *pnetdev = padapter->pnetdev; HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter); - struct dvobj_priv *pdvobj = adapter_to_dvobj(padapter); + struct dvobj_priv *pdvobj = adapter_to_dvobj(padapter); + - //DBG_8192C("%s\n", __FUNCTION__); skb = pkt; - + len = skb->len; tx_hdr = (struct rtw_ieee80211_hdr *)(skb->data); fc = le16_to_cpu(tx_hdr->frame_ctl); @@ -1250,42 +1250,42 @@ s32 rtl8188eu_hostap_mgnt_xmit_entry(struct adapter *padapter, _pkt *pkt) goto _exit; } - // ----- fill tx desc ----- - ptxdesc = (struct tx_desc *)pxmitbuf; + // ----- fill tx desc ----- + ptxdesc = (struct tx_desc *)pxmitbuf; _rtw_memset(ptxdesc, 0, sizeof(*ptxdesc)); - - //offset 0 - ptxdesc->txdw0 |= cpu_to_le32(len&0x0000ffff); + + //offset 0 + ptxdesc->txdw0 |= cpu_to_le32(len&0x0000ffff); ptxdesc->txdw0 |= cpu_to_le32(((TXDESC_SIZE+OFFSET_SZ)<txdw0 |= cpu_to_le32(OWN | FSG | LSG); - if(bmcst) + if(bmcst) { ptxdesc->txdw0 |= cpu_to_le32(BIT(24)); - } + } - //offset 4 + //offset 4 ptxdesc->txdw1 |= cpu_to_le32(0x00);//MAC_ID ptxdesc->txdw1 |= cpu_to_le32((0x12<txdw1 |= cpu_to_le32((0x06<< 16) & 0x000f0000);//b mode - //offset 8 + //offset 8 - //offset 12 + //offset 12 ptxdesc->txdw3 |= cpu_to_le32((le16_to_cpu(tx_hdr->seq_ctl)<<16)&0xffff0000); - //offset 16 + //offset 16 ptxdesc->txdw4 |= cpu_to_le32(BIT(8));//driver uses rate - + //offset 20 //HW append seq ptxdesc->txdw4 |= cpu_to_le32(BIT(7)); // Hw set sequence number ptxdesc->txdw3 |= cpu_to_le32((8 <<28)); //set bit3 to 1. Suugested by TimChen. 2009.12.29. - + rtl8188eu_cal_txdesc_chksum(ptxdesc); // ----- end of fill tx desc ----- @@ -1299,14 +1299,14 @@ s32 rtl8188eu_hostap_mgnt_xmit_entry(struct adapter *padapter, _pkt *pkt) // ----- prepare urb for submit ----- - + //translate DMA FIFO addr to pipehandle //pipe = ffaddr2pipehdl(pdvobj, MGT_QUEUE_INX); pipe = usb_sndbulkpipe(pdvobj->pusbdev, pHalData->Queue2EPNum[(u8)MGT_QUEUE_INX]&0x0f); - + usb_fill_bulk_urb(urb, pdvobj->pusbdev, pipe, pxmit_skb->data, pxmit_skb->len, rtl8192cu_hostap_mgnt_xmit_cb, pxmit_skb); - + urb->transfer_flags |= URB_ZERO_PACKET; usb_anchor_urb(urb, &phostapdpriv->anchored); rc = usb_submit_urb(urb, GFP_ATOMIC); @@ -1316,12 +1316,11 @@ s32 rtl8188eu_hostap_mgnt_xmit_entry(struct adapter *padapter, _pkt *pkt) } usb_free_urb(urb); - -_exit: - + +_exit: + rtw_skb_free(skb); return 0; } #endif - diff --git a/hal/usb_halinit.c b/hal/usb_halinit.c index 3fd4c17..4700a21 100755 --- a/hal/usb_halinit.c +++ b/hal/usb_halinit.c @@ -1,7 +1,7 @@ /****************************************************************************** * * 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. @@ -62,25 +62,25 @@ _ConfigNormalChipOutEP_8188E( IN struct adapter *pAdapter, IN u8 NumOutPipe ) -{ +{ HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter); switch(NumOutPipe){ - case 3: + case 3: pHalData->OutEpQueueSel=TX_SELE_HQ| TX_SELE_LQ|TX_SELE_NQ; pHalData->OutEpNumber=3; break; - case 2: + case 2: pHalData->OutEpQueueSel=TX_SELE_HQ| TX_SELE_NQ; pHalData->OutEpNumber=2; break; - case 1: + case 1: pHalData->OutEpQueueSel=TX_SELE_HQ; pHalData->OutEpNumber=1; break; - default: + default: break; - + } DBG_871X("%s OutEpQueueSel(0x%02x), OutEpNumber(%d) \n",__FUNCTION__,pHalData->OutEpQueueSel,pHalData->OutEpNumber ); @@ -96,7 +96,7 @@ static BOOLEAN HalUsbSetQueuePipeMapping8188EUsb( BOOLEAN result = _FALSE; _ConfigNormalChipOutEP_8188E(pAdapter, NumOutPipe); - + // Normal chip with one IN and one OUT doesn't have interrupt IN EP. if(1 == pHalData->OutEpNumber){ if(1 != NumInPipe){ @@ -110,7 +110,7 @@ static BOOLEAN HalUsbSetQueuePipeMapping8188EUsb( //} result = Hal_MappingOutPipe(pAdapter, NumOutPipe); - + return result; } @@ -156,13 +156,13 @@ static u32 InitPowerOn_rtl8188eu(struct adapter *padapter) // HW Power on sequence rtw_hal_get_hwreg(padapter, HW_VAR_APFM_ON_MAC, &bMacPwrCtrlOn); - if(bMacPwrCtrlOn == _TRUE) + if(bMacPwrCtrlOn == _TRUE) return _SUCCESS; - + if(!HalPwrSeqCmdParsing(padapter, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK, Rtl8188E_NIC_PWR_ON_FLOW)) { DBG_871X(KERN_ERR "%s: run power on flow fail\n", __func__); - return _FAIL; + return _FAIL; } // Enable MAC DMA/WMAC/SCHEDULE/SEC block @@ -175,7 +175,7 @@ static u32 InitPowerOn_rtl8188eu(struct adapter *padapter) value16 |= (HCI_TXDMA_EN | HCI_RXDMA_EN | TXDMA_EN | RXDMA_EN | PROTOCOL_EN | SCHEDULE_EN | ENSEC | CALTMR_EN); // for SDIO - Set CR bit10 to enable 32k calibration. Suggested by SD1 Gimmy. Added by tynli. 2011.08.31. - + rtw_write16(padapter, REG_CR, value16); bMacPwrCtrlOn = _TRUE; @@ -205,7 +205,7 @@ static void _InitPABias(struct adapter *padapter) HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter); u8 pa_setting; BOOLEAN is92C = IS_92C_SERIAL(pHalData->VersionID); - + //FIXED PA current issue //efuse_one_byte_read(padapter, 0x1FA, &pa_setting); pa_setting = EFUSE_Read1Byte(padapter, 0x1FA); @@ -215,11 +215,11 @@ static void _InitPABias(struct adapter *padapter) if(!(pa_setting & BIT0)) { PHY_SetRFReg(padapter, RF_PATH_A, 0x15, 0x0FFFFF, 0x0F406); - PHY_SetRFReg(padapter, RF_PATH_A, 0x15, 0x0FFFFF, 0x4F406); - PHY_SetRFReg(padapter, RF_PATH_A, 0x15, 0x0FFFFF, 0x8F406); - PHY_SetRFReg(padapter, RF_PATH_A, 0x15, 0x0FFFFF, 0xCF406); + PHY_SetRFReg(padapter, RF_PATH_A, 0x15, 0x0FFFFF, 0x4F406); + PHY_SetRFReg(padapter, RF_PATH_A, 0x15, 0x0FFFFF, 0x8F406); + PHY_SetRFReg(padapter, RF_PATH_A, 0x15, 0x0FFFFF, 0xCF406); //RT_TRACE(COMP_INIT, DBG_LOUD, ("PA BIAS path A\n")); - } + } if(!(pa_setting & BIT1) && is92C) { @@ -235,7 +235,7 @@ static void _InitPABias(struct adapter *padapter) pa_setting = rtw_read8(padapter, 0x16); pa_setting &= 0x0F; rtw_write8(padapter, 0x16, pa_setting | 0x80); - rtw_write8(padapter, 0x16, pa_setting | 0x90); + rtw_write8(padapter, 0x16, pa_setting | 0x90); } } #ifdef CONFIG_BT_COEXIST @@ -250,26 +250,26 @@ static void _InitBTCoexist(struct adapter *padapter) //#if MP_DRIVER != 1 if (padapter->registrypriv.mp_mode == 0) - { + { if(pbtpriv->BT_Ant_isolation) { rtw_write8( padapter,REG_GPIO_MUXCFG, 0xa0); DBG_8192C("BT write 0x%x = 0x%x\n", REG_GPIO_MUXCFG, 0xa0); } } -//#endif +//#endif u1Tmp = rtw_read8(padapter, 0x4fd) & BIT0; - u1Tmp = u1Tmp | - ((pbtpriv->BT_Ant_isolation==1)?0:BIT1) | + u1Tmp = u1Tmp | + ((pbtpriv->BT_Ant_isolation==1)?0:BIT1) | ((pbtpriv->BT_Service==BT_SCO)?0:BIT2); rtw_write8( padapter, 0x4fd, u1Tmp); DBG_8192C("BT write 0x%x = 0x%x for non-isolation\n", 0x4fd, u1Tmp); - - + + rtw_write32(padapter, REG_BT_COEX_TABLE+4, 0xaaaa9aaa); DBG_8192C("BT write 0x%x = 0x%x\n", REG_BT_COEX_TABLE+4, 0xaaaa9aaa); - + rtw_write32(padapter, REG_BT_COEX_TABLE+8, 0xffbd0040); DBG_8192C("BT write 0x%x = 0x%x\n", REG_BT_COEX_TABLE+8, 0xffbd0040); @@ -281,7 +281,7 @@ static void _InitBTCoexist(struct adapter *padapter) u1Tmp &= ~(BIT1); rtw_write8( padapter, rOFDM0_TRxPathEnable, u1Tmp); DBG_8192C("BT write 0xC04 = 0x%x\n", u1Tmp); - + u1Tmp = rtw_read8(padapter, rOFDM1_TRxPathEnable); u1Tmp &= ~(BIT1); rtw_write8( padapter, rOFDM1_TRxPathEnable, u1Tmp); @@ -305,11 +305,11 @@ _SetMacID( { u32 i; for(i=0 ; i< MAC_ADDR_LEN ; i++){ -#ifdef CONFIG_CONCURRENT_MODE +#ifdef CONFIG_CONCURRENT_MODE if(Adapter->iface_type == IFACE_PORT1) rtw_write32(Adapter, REG_MACID1+i, MacID[i]); else -#endif +#endif rtw_write32(Adapter, REG_MACID+i, MacID[i]); } } @@ -321,11 +321,11 @@ _SetBSSID( { u32 i; for(i=0 ; i< MAC_ADDR_LEN ; i++){ -#ifdef CONFIG_CONCURRENT_MODE +#ifdef CONFIG_CONCURRENT_MODE if(Adapter->iface_type == IFACE_PORT1) rtw_write32(Adapter, REG_BSSID1+i, BSSID[i]); else -#endif +#endif rtw_write32(Adapter, REG_BSSID+i, BSSID[i]); } } @@ -343,19 +343,19 @@ _InitInterrupt( //HISR write one to clear rtw_write32(Adapter, REG_HISR_88E, 0xFFFFFFFF); - // HIMR - - imr = IMR_PSTIMEOUT_88E | IMR_TBDER_88E | IMR_CPWM_88E | IMR_CPWM2_88E ; + // HIMR - + imr = IMR_PSTIMEOUT_88E | IMR_TBDER_88E | IMR_CPWM_88E | IMR_CPWM2_88E ; rtw_write32(Adapter, REG_HIMR_88E, imr); pHalData->IntrMask[0]=imr; - - imr_ex = IMR_TXERR_88E | IMR_RXERR_88E | IMR_TXFOVW_88E |IMR_RXFOVW_88E; + + imr_ex = IMR_TXERR_88E | IMR_RXERR_88E | IMR_TXFOVW_88E |IMR_RXFOVW_88E; rtw_write32(Adapter, REG_HIMRE_88E, imr_ex); pHalData->IntrMask[1]=imr_ex; - + #ifdef CONFIG_SUPPORT_USB_INT // REG_USB_SPECIAL_OPTION - BIT(4) // 0; Use interrupt endpoint to upload interrupt pkt - // 1; Use bulk endpoint to upload interrupt pkt, + // 1; Use bulk endpoint to upload interrupt pkt, usb_opt = rtw_read8(Adapter, REG_USB_SPECIAL_OPTION); @@ -365,13 +365,13 @@ _InitInterrupt( #endif ) usb_opt = usb_opt & (~INT_BULK_SEL); - else + else usb_opt = usb_opt | (INT_BULK_SEL); - rtw_write8(Adapter, REG_USB_SPECIAL_OPTION, usb_opt ); + rtw_write8(Adapter, REG_USB_SPECIAL_OPTION, usb_opt ); #endif//CONFIG_SUPPORT_USB_INT - + } @@ -420,7 +420,7 @@ _InitQueueReservedPage( { rtw_write16(Adapter,REG_RQPN_NPQ, 0x0000);//Just follow MP Team,??? Georgia 03/28 rtw_write16(Adapter,REG_RQPN_NPQ, 0x0d); - rtw_write32(Adapter,REG_RQPN, 0x808E000d);//reserve 7 page for LPS + rtw_write32(Adapter,REG_RQPN, 0x808E000d);//reserve 7 page for LPS } } @@ -429,7 +429,7 @@ _InitTxBufferBoundary( IN struct adapter *Adapter, IN u8 txpktbuf_bndy ) -{ +{ struct registry_priv *pregistrypriv = &Adapter->registrypriv; //HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter); @@ -448,8 +448,8 @@ _InitPageBoundary( IN struct adapter *Adapter ) { - // RX Page Boundary - // + // RX Page Boundary + // u16 rxff_bndy = MAX_RX_DMA_BUFFER_SIZE_88E-1; #if 0 @@ -460,10 +460,10 @@ _InitPageBoundary( { Offset = MAX_RX_DMA_BUFFER_SIZE_88E+MAX_TX_REPORT_BUFFER_SIZE-MAX_SUPPORT_WOL_PATTERN_NUM(Adapter)*WKFMCAM_SIZE; Offset = Offset / 128; // RX page size = 128 byte - rxff_bndy= (Offset*128) -1; + rxff_bndy= (Offset*128) -1; } else - + #endif rtw_write16(Adapter, (REG_TRXFF_BNDY + 2), rxff_bndy); } @@ -482,10 +482,10 @@ _InitNormalChipRegPriority( { u16 value16 = (rtw_read16(Adapter, REG_TRXDMA_CTRL) & 0x7); - value16 |= _TXDMA_BEQ_MAP(beQ) | _TXDMA_BKQ_MAP(bkQ) | - _TXDMA_VIQ_MAP(viQ) | _TXDMA_VOQ_MAP(voQ) | + value16 |= _TXDMA_BEQ_MAP(beQ) | _TXDMA_BKQ_MAP(bkQ) | + _TXDMA_VIQ_MAP(viQ) | _TXDMA_VOQ_MAP(voQ) | _TXDMA_MGQ_MAP(mgtQ)| _TXDMA_HIQ_MAP(hiQ); - + rtw_write16(Adapter, REG_TRXDMA_CTRL, value16); } @@ -512,7 +512,7 @@ _InitNormalChipOneOutEpPriority( //RT_ASSERT(FALSE,("Shall not reach here!\n")); break; } - + _InitNormalChipRegPriority(Adapter, value, value, @@ -532,11 +532,11 @@ _InitNormalChipTwoOutEpPriority( HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); struct registry_priv *pregistrypriv = &Adapter->registrypriv; u16 beQ,bkQ,viQ,voQ,mgtQ,hiQ; - + u16 valueHi = 0; u16 valueLow = 0; - + switch(pHalData->OutEpQueueSel) { case (TX_SELE_HQ | TX_SELE_LQ): @@ -561,16 +561,16 @@ _InitNormalChipTwoOutEpPriority( bkQ = valueLow; viQ = valueHi; voQ = valueHi; - mgtQ = valueHi; - hiQ = valueHi; + mgtQ = valueHi; + hiQ = valueHi; } else{//for WMM ,CONFIG_OUT_EP_WIFI_MODE beQ = valueLow; - bkQ = valueHi; + bkQ = valueHi; viQ = valueHi; voQ = valueLow; mgtQ = valueHi; - hiQ = valueHi; + hiQ = valueHi; } _InitNormalChipRegPriority(Adapter,beQ,bkQ,viQ,voQ,mgtQ,hiQ); @@ -587,19 +587,19 @@ _InitNormalChipThreeOutEpPriority( if(!pregistrypriv->wifi_spec ){// typical setting beQ = QUEUE_LOW; - bkQ = QUEUE_LOW; - viQ = QUEUE_NORMAL; - voQ = QUEUE_HIGH; - mgtQ = QUEUE_HIGH; - hiQ = QUEUE_HIGH; + bkQ = QUEUE_LOW; + viQ = QUEUE_NORMAL; + voQ = QUEUE_HIGH; + mgtQ = QUEUE_HIGH; + hiQ = QUEUE_HIGH; } else{// for WMM beQ = QUEUE_LOW; - bkQ = QUEUE_NORMAL; - viQ = QUEUE_NORMAL; - voQ = QUEUE_HIGH; - mgtQ = QUEUE_HIGH; - hiQ = QUEUE_HIGH; + bkQ = QUEUE_NORMAL; + viQ = QUEUE_NORMAL; + voQ = QUEUE_HIGH; + mgtQ = QUEUE_HIGH; + hiQ = QUEUE_HIGH; } _InitNormalChipRegPriority(Adapter,beQ,bkQ,viQ,voQ,mgtQ,hiQ); } @@ -665,7 +665,7 @@ _InitTransferPageSize( ) { // Tx page size is always 128. - + u8 value8; value8 = _PSRX(PBP_128) | _PSTX(PBP_128); rtw_write8(Adapter, REG_PBP, value8); @@ -690,11 +690,11 @@ _InitWMACSetting( HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); //pHalData->ReceiveConfig = AAP | APM | AM | AB | APP_ICV | ADF | AMF | APP_FCS | HTC_LOC_CTRL | APP_MIC | APP_PHYSTS; - //pHalData->ReceiveConfig = - //RCR_AAP | RCR_APM | RCR_AM | RCR_AB |RCR_CBSSID_DATA| RCR_CBSSID_BCN| RCR_APP_ICV | RCR_AMF | RCR_HTC_LOC_CTRL | RCR_APP_MIC | RCR_APP_PHYSTS; + //pHalData->ReceiveConfig = + //RCR_AAP | RCR_APM | RCR_AM | RCR_AB |RCR_CBSSID_DATA| RCR_CBSSID_BCN| RCR_APP_ICV | RCR_AMF | RCR_HTC_LOC_CTRL | RCR_APP_MIC | RCR_APP_PHYSTS; // don't turn on AAP, it will allow all packets to driver - pHalData->ReceiveConfig = RCR_APM | RCR_AM | RCR_AB |RCR_CBSSID_DATA| RCR_CBSSID_BCN| RCR_APP_ICV | RCR_AMF | RCR_HTC_LOC_CTRL | RCR_APP_MIC | RCR_APP_PHYSTS; - + pHalData->ReceiveConfig = RCR_APM | RCR_AM | RCR_AB |RCR_CBSSID_DATA| RCR_CBSSID_BCN| RCR_APP_ICV | RCR_AMF | RCR_HTC_LOC_CTRL | RCR_APP_MIC | RCR_APP_PHYSTS; + #if (1 == RTL8188E_RX_PACKET_INCLUDE_CRC) pHalData->ReceiveConfig |= ACRC32; #endif @@ -722,7 +722,7 @@ _InitWMACSetting( //rtw_write16(Adapter, REG_RXFLTMAP0, value16); //enable RX_SHIFT bits - //rtw_write8(Adapter, REG_TRXDMA_CTRL, rtw_read8(Adapter, REG_TRXDMA_CTRL)|BIT(1)); + //rtw_write8(Adapter, REG_TRXDMA_CTRL, rtw_read8(Adapter, REG_TRXDMA_CTRL)|BIT(1)); } @@ -750,7 +750,7 @@ _InitAdaptiveCtrl( // Retry Limit value16 = _LRL(0x30) | _SRL(0x30); rtw_write16(Adapter, REG_RL, value16); - + } static VOID @@ -777,7 +777,7 @@ _InitEDCA( rtw_write16(Adapter,REG_MAC_SPEC_SIFS, 0x100a); // Set SIFS for CCK - rtw_write16(Adapter,REG_SIFS_CTX, 0x100a); + rtw_write16(Adapter,REG_SIFS_CTX, 0x100a); // Set SIFS for OFDM rtw_write16(Adapter,REG_SIFS_TRX, 0x100a); @@ -804,12 +804,12 @@ _InitBeaconMaxError( static void _InitHWLed(struct adapter *Adapter) { struct led_priv *pledpriv = &(Adapter->ledpriv); - + if( pledpriv->LedStrategy != HW_LED) return; - + // HW led control -// to do .... +// to do .... //must consider cases of antenna diversity/ commbo card/solo card/mini card } @@ -840,11 +840,11 @@ _InitRetryFunction( ) { u8 value8; - //#if 0 //MAC SPEC + //#if 0 //MAC SPEC value8 = rtw_read8(Adapter, REG_FWHW_TXQ_CTRL); value8 |= EN_AMPDU_RTY_NEW; rtw_write8(Adapter, REG_FWHW_TXQ_CTRL, value8); - //#endif + //#endif // Set ACK timeout rtw_write8(Adapter, REG_ACKTO, 0x40); } @@ -852,7 +852,7 @@ _InitRetryFunction( /*----------------------------------------------------------------------------- * Function: usb_AggSettingTxUpdate() * - * Overview: Seperate TX/RX parameters update independent for TP detection and + * Overview: Seperate TX/RX parameters update independent for TP detection and * dynamic TX/RX aggreagtion parameters update. * * Input: PADAPTER @@ -871,7 +871,7 @@ usb_AggSettingTxUpdate( { #ifdef CONFIG_USB_TX_AGGREGATION HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); - //PMGNT_INFO pMgntInfo = &(Adapter->MgntInfo); + //PMGNT_INFO pMgntInfo = &(Adapter->MgntInfo); u32 value32; if(Adapter->registrypriv.wifi_spec) @@ -881,10 +881,10 @@ usb_AggSettingTxUpdate( value32 = rtw_read32(Adapter, REG_TDECTRL); value32 = value32 & ~(BLK_DESC_NUM_MASK << BLK_DESC_NUM_SHIFT); value32 |= ((pHalData->UsbTxAggDescNum & BLK_DESC_NUM_MASK) << BLK_DESC_NUM_SHIFT); - + rtw_write32(Adapter, REG_TDECTRL, value32); } - + #endif } // usb_AggSettingTxUpdate @@ -892,7 +892,7 @@ usb_AggSettingTxUpdate( /*----------------------------------------------------------------------------- * Function: usb_AggSettingRxUpdate() * - * Overview: Seperate TX/RX parameters update independent for TP detection and + * Overview: Seperate TX/RX parameters update independent for TP detection and * dynamic TX/RX aggreagtion parameters update. * * Input: PADAPTER @@ -955,14 +955,14 @@ usb_AggSettingRxUpdate( case USB_RX_AGG_MIX: rtw_write8(Adapter, REG_RXDMA_AGG_PG_TH, pHalData->UsbRxAggPageCount); rtw_write8(Adapter, REG_RXDMA_AGG_PG_TH+1, (pHalData->UsbRxAggPageTimeout& 0x1F));//0x280[12:8] - + rtw_write8(Adapter, REG_USB_AGG_TH, pHalData->UsbRxAggBlockCount); - rtw_write8(Adapter, REG_USB_AGG_TO, pHalData->UsbRxAggBlockTimeout); - + rtw_write8(Adapter, REG_USB_AGG_TO, pHalData->UsbRxAggBlockTimeout); + break; case USB_RX_AGG_DISABLE: default: - // TODO: + // TODO: break; } @@ -1060,7 +1060,7 @@ HalRxAggr8188EUsb( * * Revised History: * When Who Remark - * 12/10/2010 MHC Create Version 0. + * 12/10/2010 MHC Create Version 0. * *---------------------------------------------------------------------------*/ VOID @@ -1097,7 +1097,7 @@ _InitBeaconParameters( rtw_write16(Adapter, REG_BCNTCFG, 0x660F); pHalData->RegBcnCtrlVal = rtw_read8(Adapter, REG_BCN_CTRL); - pHalData->RegTxPause = rtw_read8(Adapter, REG_TXPAUSE); + pHalData->RegTxPause = rtw_read8(Adapter, REG_TXPAUSE); pHalData->RegFwHwTxQCtrl = rtw_read8(Adapter, REG_FWHW_TXQ_CTRL+2); pHalData->RegReg542 = rtw_read8(Adapter, REG_TBTT_PROHIBIT+2); pHalData->RegCR_1 = rtw_read8(Adapter, REG_CR+1); @@ -1142,9 +1142,9 @@ _BeaconFunctionEnable( { rtw_write8(Adapter, REG_BCN_CTRL, (BIT4 | BIT3 | BIT1)); //SetBcnCtrlReg(Adapter, (BIT4 | BIT3 | BIT1), 0x00); - //RT_TRACE(COMP_BEACON, DBG_LOUD, ("_BeaconFunctionEnable 0x550 0x%x\n", PlatformEFIORead1Byte(Adapter, 0x550))); + //RT_TRACE(COMP_BEACON, DBG_LOUD, ("_BeaconFunctionEnable 0x550 0x%x\n", PlatformEFIORead1Byte(Adapter, 0x550))); - rtw_write8(Adapter, REG_RD_CTRL+1, 0x6F); + rtw_write8(Adapter, REG_RD_CTRL+1, 0x6F); } @@ -1187,7 +1187,7 @@ static VOID _RfPowerSave( } else{ pHalData->eRFPowerState = eRfOn; - pMgntInfo->RfOffReason = 0; + pMgntInfo->RfOffReason = 0; if(Adapter->bInSetPower || Adapter->bResetInProgress) PlatformUsbEnableInPipes(Adapter); RT_TRACE((COMP_INIT|COMP_RF), DBG_LOUD, ("InitializeAdapter8192CUsb(): RF is on.\n")); @@ -1197,7 +1197,7 @@ static VOID _RfPowerSave( enum { Antenna_Lfet = 1, - Antenna_Right = 2, + Antenna_Right = 2, }; static VOID @@ -1208,17 +1208,17 @@ _InitAntenna_Selection(IN struct adapter *Adapter) if(pHalData->AntDivCfg==0) return; - DBG_8192C("==> %s ....\n",__FUNCTION__); - - rtw_write32(Adapter, REG_LEDCFG0, rtw_read32(Adapter, REG_LEDCFG0)|BIT23); + DBG_8192C("==> %s ....\n",__FUNCTION__); + + rtw_write32(Adapter, REG_LEDCFG0, rtw_read32(Adapter, REG_LEDCFG0)|BIT23); PHY_SetBBReg(Adapter, rFPGA0_XAB_RFParameter, BIT13, 0x01); - + if(PHY_QueryBBReg(Adapter, rFPGA0_XA_RFInterfaceOE, 0x300) == Antenna_A) pHalData->CurAntenna = Antenna_A; else pHalData->CurAntenna = Antenna_B; DBG_8192C("%s,Cur_ant:(%x)%s\n",__FUNCTION__,pHalData->CurAntenna,(pHalData->CurAntenna == Antenna_A)?"Antenna_A":"Antenna_B"); - + } @@ -1237,9 +1237,9 @@ HalDetectSelectiveSuspendMode( HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); struct dvobj_priv *pdvobjpriv = adapter_to_dvobj(Adapter); - // If support HW radio detect, we need to enable WOL ability, otherwise, we + // If support HW radio detect, we need to enable WOL ability, otherwise, we // can not use FW to notify host the power state switch. - + EFUSE_ShadowRead(Adapter, 1, EEPROM_USB_OPTIONAL1, (u32 *)&tmpvalue); DBG_8192C("HalDetectSelectiveSuspendMode(): SS "); @@ -1258,7 +1258,7 @@ HalDetectSelectiveSuspendMode( { //PMGNT_INFO pMgntInfo = &(Adapter->MgntInfo); - //if (!pMgntInfo->bRegDongleSS) + //if (!pMgntInfo->bRegDongleSS) //{ // RT_TRACE(COMP_INIT, DBG_LOUD, ("Dongle disable SS\n")); pdvobjpriv->RegUsbSS = _FALSE; @@ -1281,14 +1281,14 @@ HalDetectSelectiveSuspendMode( * When Who Remark * 08/23/2010 MHC HW suspend mode switch test.. *---------------------------------------------------------------------------*/ -static VOID +static VOID HwSuspendModeEnable_88eu( IN struct adapter *pAdapter, IN u8 Type ) { - //PRT_USB_DEVICE pDevice = GET_RT_USB_DEVICE(pAdapter); - u16 reg = rtw_read16(pAdapter, REG_GPIO_MUXCFG); + //PRT_USB_DEVICE pDevice = GET_RT_USB_DEVICE(pAdapter); + u16 reg = rtw_read16(pAdapter, REG_GPIO_MUXCFG); //if (!pDevice->RegUsbSS) { @@ -1297,11 +1297,11 @@ HwSuspendModeEnable_88eu( // // 2010/08/23 MH According to Alfred's suggestion, we need to to prevent HW - // to enter suspend mode automatically. Otherwise, it will shut down major power + // to enter suspend mode automatically. Otherwise, it will shut down major power // domain and 8051 will stop. When we try to enter selective suspend mode, we // need to prevent HW to enter D2 mode aumotmatically. Another way, Host will // issue a S10 signal to power domain. Then it will cleat SIC setting(from Yngli). - // We need to enable HW suspend mode when enter S3/S4 or disable. We need + // We need to enable HW suspend mode when enter S3/S4 or disable. We need // to disable HW suspend mode for IPS/radio_off. // //RT_TRACE(COMP_RF, DBG_LOUD, ("HwSuspendModeEnable92Cu = %d\n", Type)); @@ -1321,7 +1321,7 @@ HwSuspendModeEnable_88eu( reg &= (~BIT14); rtw_write16(pAdapter, REG_GPIO_MUXCFG, reg); } - + } // HwSuspendModeEnable92Cu rt_rf_power_state RfOnOffDetect(IN struct adapter *pAdapter ) { @@ -1333,14 +1333,14 @@ rt_rf_power_state RfOnOffDetect(IN struct adapter *pAdapter ) { val8 = rtw_read8(pAdapter, REG_HSISR); DBG_8192C("pwrdown, 0x5c(BIT7)=%02x\n", val8); - rfpowerstate = (val8 & BIT7) ? rf_off: rf_on; + rfpowerstate = (val8 & BIT7) ? rf_off: rf_on; } else // rf on/off { rtw_write8( pAdapter, REG_MAC_PINMUX_CFG,rtw_read8(pAdapter, REG_MAC_PINMUX_CFG)&~(BIT3)); val8 = rtw_read8(pAdapter, REG_GPIO_IO_SEL); DBG_8192C("GPIO_IN=%02x\n", val8); - rfpowerstate = (val8 & BIT3) ? rf_on : rf_off; + rfpowerstate = (val8 & BIT3) ? rf_on : rf_off; } return rfpowerstate; } // HalDetectPwrDownMode @@ -1356,7 +1356,7 @@ u32 rtl8188eu_hal_init(struct adapter *Adapter) HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); struct pwrctrl_priv *pwrctrlpriv = adapter_to_pwrctl(Adapter); struct registry_priv *pregistrypriv = &Adapter->registrypriv; - + rt_rf_power_state eRfPowerStateToSet; #ifdef CONFIG_BT_COEXIST struct btcoexist_priv *pbtpriv = &(pHalData->bt_coexist); @@ -1374,10 +1374,10 @@ u32 rtl8188eu_hal_init(struct adapter *Adapter) HAL_INIT_STAGES_DOWNLOAD_FW, HAL_INIT_STAGES_MAC, HAL_INIT_STAGES_BB, - HAL_INIT_STAGES_RF, + HAL_INIT_STAGES_RF, HAL_INIT_STAGES_EFUSE_PATCH, - HAL_INIT_STAGES_INIT_LLTT, - + HAL_INIT_STAGES_INIT_LLTT, + HAL_INIT_STAGES_MISC02, HAL_INIT_STAGES_TURN_ON_BLOCK, HAL_INIT_STAGES_INIT_SECURITY, @@ -1402,13 +1402,13 @@ u32 rtl8188eu_hal_init(struct adapter *Adapter) "HAL_INIT_STAGES_BEGIN", "HAL_INIT_STAGES_INIT_PW_ON", "HAL_INIT_STAGES_MISC01", - "HAL_INIT_STAGES_DOWNLOAD_FW", - "HAL_INIT_STAGES_MAC", + "HAL_INIT_STAGES_DOWNLOAD_FW", + "HAL_INIT_STAGES_MAC", "HAL_INIT_STAGES_BB", "HAL_INIT_STAGES_RF", "HAL_INIT_STAGES_EFUSE_PATCH", "HAL_INIT_STAGES_INIT_LLTT", - "HAL_INIT_STAGES_MISC02", + "HAL_INIT_STAGES_MISC02", "HAL_INIT_STAGES_TURN_ON_BLOCK", "HAL_INIT_STAGES_INIT_SECURITY", "HAL_INIT_STAGES_MISC11", @@ -1440,13 +1440,13 @@ u32 rtl8188eu_hal_init(struct adapter *Adapter) _func_enter_; - + HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_BEGIN); #ifdef CONFIG_WOWLAN - + pwrctrlpriv->wowlan_wake_reason = rtw_read8(Adapter, REG_WOWLAN_WAKE_REASON); - DBG_8192C("%s wowlan_wake_reason: 0x%02x\n", + DBG_8192C("%s wowlan_wake_reason: 0x%02x\n", __func__, pwrctrlpriv->wowlan_wake_reason); if(rtw_read8(Adapter, REG_MCUFWDL)&BIT7){ /*&& @@ -1496,7 +1496,7 @@ HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_BEGIN); goto exit; } - + HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_INIT_PW_ON); status = InitPowerOn_rtl8188eu(Adapter); @@ -1525,15 +1525,15 @@ HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_INIT_PW_ON); // for WMM txpktbuf_bndy = WMM_NORMAL_TX_PAGE_BOUNDARY_88E; } - + HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_MISC01); - _InitQueueReservedPage(Adapter); + _InitQueueReservedPage(Adapter); _InitQueuePriority(Adapter); - _InitPageBoundary(Adapter); + _InitPageBoundary(Adapter); _InitTransferPageSize(Adapter); - + #ifdef CONFIG_IOL_IOREG_CFG - _InitTxBufferBoundary(Adapter, 0); + _InitTxBufferBoundary(Adapter, 0); #endif @@ -1546,8 +1546,8 @@ HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_DOWNLOAD_FW); } #endif //MP_DRIVER == 1 { - #if 0 - Adapter->bFWReady = _FALSE; //because no fw for test chip + #if 0 + Adapter->bFWReady = _FALSE; //because no fw for test chip pHalData->fw_ractrl = _FALSE; #else @@ -1579,10 +1579,10 @@ HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_MAC); status = PHY_MACConfig8188E(Adapter); if(status == _FAIL) { - DBG_871X(" ### Failed to init MAC ...... \n "); + DBG_871X(" ### Failed to init MAC ...... \n "); goto exit; } -#endif +#endif // //d. Initialize BB related configurations. @@ -1600,7 +1600,7 @@ HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_BB); HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_RF); #if (HAL_RF_ENABLE == 1) - status = PHY_RFConfig8188E(Adapter); + status = PHY_RFConfig8188E(Adapter); if(status == _FAIL) { DBG_871X(" ### Failed to init RF ...... \n "); @@ -1609,15 +1609,15 @@ HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_RF); #endif HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_EFUSE_PATCH); -#if defined(CONFIG_IOL_EFUSE_PATCH) +#if defined(CONFIG_IOL_EFUSE_PATCH) status = rtl8188e_iol_efuse_patch(Adapter); - if(status == _FAIL){ + if(status == _FAIL){ DBG_871X("%s rtl8188e_iol_efuse_patch failed \n",__FUNCTION__); goto exit; - } + } #endif - _InitTxBufferBoundary(Adapter, txpktbuf_bndy); + _InitTxBufferBoundary(Adapter, txpktbuf_bndy); HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_INIT_LLTT); status = InitLLTTable(Adapter, txpktbuf_bndy); @@ -1625,14 +1625,14 @@ HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_INIT_LLTT); RT_TRACE(_module_hci_hal_init_c_, _drv_err_, ("Failed to init LLT table\n")); goto exit; } - + HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_MISC02); // Get Rx PHY status in order to report RSSI and others. _InitDriverInfoSize(Adapter, DRVINFO_SZ); _InitInterrupt(Adapter); hal_init_macaddr(Adapter);//set mac_address - _InitNetworkType(Adapter);//set msr + _InitNetworkType(Adapter);//set msr _InitWMACSetting(Adapter); _InitAdaptiveCtrl(Adapter); _InitEDCA(Adapter); @@ -1645,12 +1645,12 @@ HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_MISC02); // // Init CR MACTXEN, MACRXEN after setting RxFF boundary REG_TRXFF_BNDY to patch - // Hw bug which Hw initials RxFF boundry size to a value which is larger than the real Rx buffer size in 88E. + // Hw bug which Hw initials RxFF boundry size to a value which is larger than the real Rx buffer size in 88E. // // Enable MACTXEN/MACRXEN block value16 = rtw_read16(Adapter, REG_CR); value16 |= (MACTXEN | MACRXEN); - rtw_write8(Adapter, REG_CR, value16); + rtw_write8(Adapter, REG_CR, value16); _InitHardwareDropIncorrectBulkOut(Adapter); @@ -1662,7 +1662,7 @@ HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_MISC02); #if (RATE_ADAPTIVE_SUPPORT==1) {//Enable TX Report - //Enable Tx Report Timer + //Enable Tx Report Timer value8 = rtw_read8(Adapter, REG_TX_RPT_CTRL); rtw_write8(Adapter, REG_TX_RPT_CTRL, (value8|BIT1|BIT0)); //Set MAX RPT MACID @@ -1670,7 +1670,7 @@ HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_MISC02); //Tx RPT Timer. Unit: 32us rtw_write16(Adapter, REG_TX_RPT_TIME, 0xCdf0); } -#endif +#endif #if 0 if(pHTInfo->bRDGEnable){ @@ -1678,7 +1678,7 @@ HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_MISC02); } #endif -#ifdef CONFIG_TX_EARLY_MODE +#ifdef CONFIG_TX_EARLY_MODE if( pHalData->bEarlyModeEnable) { RT_TRACE(_module_hci_hal_init_c_, _drv_info_,("EarlyMode Enabled!!!\n")); @@ -1705,7 +1705,7 @@ HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_MISC02); rtw_write32(Adapter,REG_MACID_NO_LINK_0,0xFFFFFFFF); rtw_write32(Adapter,REG_MACID_NO_LINK_1,0xFFFFFFFF); - + #if defined(CONFIG_CONCURRENT_MODE) || defined(CONFIG_TX_MCAST2UNI) #ifdef CONFIG_CHECK_AC_LIFETIME @@ -1721,13 +1721,13 @@ HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_MISC02); rtw_write16(Adapter, REG_PKT_BE_BK_LIFE_TIME, 0x3000); // unit: 256us. 3s #endif // CONFIG_TX_MCAST2UNI #endif // CONFIG_CONCURRENT_MODE || CONFIG_TX_MCAST2UNI - + #ifdef CONFIG_LED _InitHWLed(Adapter); #endif //CONFIG_LED - + // // Joseph Note: Keep RfRegChnlVal for later use. // @@ -1745,12 +1745,12 @@ HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_MISC11); // 2010/12/17 MH We need to set TX power according to EFUSE content at first. PHY_SetTxPowerLevel8188E(Adapter, pHalData->CurrentChannel); -// Move by Neo for USB SS to below setp +// Move by Neo for USB SS to below setp //_RfPowerSave(Adapter); _InitAntenna_Selection(Adapter); - - // + + // // Disable BAR, suggested by Scott // 2010.04.09 add by hpfan // @@ -1758,7 +1758,7 @@ HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_MISC11); // HW SEQ CTRL //set 0x0 to 0xFF by tynli. Default enable HW SEQ NUM. - rtw_write8(Adapter,REG_HWSEQ_CTRL, 0xFF); + rtw_write8(Adapter,REG_HWSEQ_CTRL, 0xFF); if(pregistrypriv->wifi_spec) rtw_write16(Adapter,REG_FAST_EDCA_CTRL ,0); @@ -1768,23 +1768,23 @@ HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_MISC11); HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_INIT_HAL_DM); rtl8188e_InitHalDm(Adapter); - + #if (MP_DRIVER == 1) if (Adapter->registrypriv.mp_mode == 1) { Adapter->mppriv.channel = pHalData->CurrentChannel; MPT_InitializeAdapter(Adapter, Adapter->mppriv.channel); } - else + else #endif //#if (MP_DRIVER == 1) { // // 2010/08/11 MH Merge from 8192SE for Minicard init. We need to confirm current radio status - // and then decide to enable RF or not.!!!??? For Selective suspend mode. We may not + // and then decide to enable RF or not.!!!??? For Selective suspend mode. We may not // call init_adapter. May cause some problem?? // - // Fix the bug that Hw/Sw radio off before S3/S4, the RF off action will not be executed - // in MgntActSet_RF_State() after wake up, because the value of pHalData->eRFPowerState + // Fix the bug that Hw/Sw radio off before S3/S4, the RF off action will not be executed + // in MgntActSet_RF_State() after wake up, because the value of pHalData->eRFPowerState // is the same as eRfOff, we should change it to eRfOn after we config RF parameters. // Added by tynli. 2010.03.30. pwrctrlpriv->rf_pwrstate = rf_on; @@ -1803,12 +1803,12 @@ HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_INIT_HAL_DM); pwrctrlpriv->b_hw_radio_off = _TRUE; DBG_8192C("eRfPowerStateToSet=%d\n", eRfPowerStateToSet); - + if(pwrctrlpriv->reg_rfoff == _TRUE) { // User disable RF via registry. DBG_8192C("InitializeAdapter8192CU(): Turn off RF for RegRfOff.\n"); //MgntActSet_RF_State(Adapter, rf_off, RF_CHANGE_BY_SW, _TRUE); - + // Those action will be discard in MgntActSet_RF_State because off the same state //for(eRFPath = 0; eRFPath NumTotalRFPath; eRFPath++) //PHY_SetRFReg(Adapter, (RF_RADIO_PATH_E)eRFPath, 0x4, 0xC00, 0x0); @@ -1827,26 +1827,26 @@ HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_INIT_HAL_DM); { DBG_8192C("InitializeAdapter8192CU(): RF=%d \n", eRfPowerStateToSet); if (eRfPowerStateToSet == rf_off) - { + { //MgntActSet_RF_State(Adapter, rf_off, RF_CHANGE_BY_HW, _TRUE); - pwrctrlpriv->b_hw_radio_off = _TRUE; + pwrctrlpriv->b_hw_radio_off = _TRUE; } else { pwrctrlpriv->rf_pwrstate = rf_off; - pwrctrlpriv->rfoff_reason = RF_CHANGE_BY_INIT; - pwrctrlpriv->b_hw_radio_off = _FALSE; + pwrctrlpriv->rfoff_reason = RF_CHANGE_BY_INIT; + pwrctrlpriv->b_hw_radio_off = _FALSE; //MgntActSet_RF_State(Adapter, rf_on, pwrctrlpriv->rfoff_reason, _TRUE); } - } + } else { pwrctrlpriv->rf_pwrstate = rf_off; - pwrctrlpriv->rfoff_reason = RF_CHANGE_BY_INIT; + pwrctrlpriv->rfoff_reason = RF_CHANGE_BY_INIT; //MgntActSet_RF_State(Adapter, rf_on, pwrctrlpriv->rfoff_reason, _TRUE); } - - pwrctrlpriv->rfoff_reason = 0; + + pwrctrlpriv->rfoff_reason = 0; pwrctrlpriv->b_hw_radio_off = _FALSE; pwrctrlpriv->rf_pwrstate = rf_on; rtw_led_control(Adapter, LED_CTL_POWER_ON); @@ -1866,7 +1866,7 @@ HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_INIT_HAL_DM); // 2010.10.06. // //if(IS_HARDWARE_TYPE_8723AU(Adapter)) - //{ + //{ // u1bTmp = rtw_read8(Adapter, REG_MULTI_FUNC_CTRL); // rtw_write8(Adapter, REG_MULTI_FUNC_CTRL, (u1bTmp|WL_HWPDN_EN)); //} @@ -1905,11 +1905,11 @@ HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_IQK); PHY_IQCalibrate_8188E(Adapter,_FALSE); pHalData->odmpriv.RFCalibrateInfo.bIQKInitialized = _TRUE; } - + HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_PW_TRACK); - + ODM_TXPowerTrackingCheck(&pHalData->odmpriv ); - + HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_LCK); PHY_LCCalibrate_8188E(Adapter); @@ -1940,7 +1940,7 @@ HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_END); , (hal_init_stages_timestamp[hal_init_profiling_i+1]-hal_init_stages_timestamp[hal_init_profiling_i]) , rtw_get_time_interval_ms(hal_init_stages_timestamp[hal_init_profiling_i], hal_init_stages_timestamp[hal_init_profiling_i+1]) ); - } + } #endif @@ -1961,17 +1961,17 @@ void _ps_close_RF(struct adapter *padapter){ VOID hal_poweroff_rtl8188eu( - IN struct adapter * Adapter + IN struct adapter * Adapter ) { // PMGNT_INFO pMgntInfo = &(Adapter->MgntInfo); - u8 val8; + u8 val8; u16 val16; u32 val32; u8 bMacPwrCtrlOn=_FALSE; rtw_hal_get_hwreg(Adapter, HW_VAR_APFM_ON_MAC, &bMacPwrCtrlOn); - if(bMacPwrCtrlOn == _FALSE) + if(bMacPwrCtrlOn == _FALSE) return ; RT_TRACE(COMP_INIT, DBG_LOUD, ("%s\n",__FUNCTION__)); @@ -1980,13 +1980,13 @@ VOID hal_poweroff_rtl8188eu( val8 = rtw_read8(Adapter, REG_TX_RPT_CTRL); rtw_write8(Adapter, REG_TX_RPT_CTRL, val8&(~BIT1)); - // stop rx + // stop rx rtw_write8(Adapter, REG_CR, 0x0); - + // Run LPS WL RFOFF flow HalPwrSeqCmdParsing(Adapter, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK, Rtl8188E_NIC_LPS_ENTER_FLOW); - + // 2. 0x1F[7:0] = 0 // turn off RF //rtw_write8(Adapter, REG_RF_CTRL, 0x00); @@ -1994,13 +1994,13 @@ VOID hal_poweroff_rtl8188eu( if ((val8 & RAM_DL_SEL) && Adapter->bFWReady) //8051 RAM code { //rtl8723a_FirmwareSelfReset(padapter); - //_8051Reset88E(padapter); - + //_8051Reset88E(padapter); + // Reset MCU 0x2[10]=0. val8 = rtw_read8(Adapter, REG_SYS_FUNC_EN+1); val8 &= ~BIT(2); // 0x2[10], FEN_CPUEN rtw_write8(Adapter, REG_SYS_FUNC_EN+1, val8); - } + } //val8 = rtw_read8(Adapter, REG_SYS_FUNC_EN+1); //val8 &= ~BIT(2); // 0x2[10], FEN_CPUEN @@ -2014,16 +2014,16 @@ VOID hal_poweroff_rtl8188eu( //Disable 32k val8 = rtw_read8(Adapter, REG_32K_CTRL); rtw_write8(Adapter, REG_32K_CTRL, val8&(~BIT0)); - + // Card disable power action flow - HalPwrSeqCmdParsing(Adapter, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK, Rtl8188E_NIC_DISABLE_FLOW); - + HalPwrSeqCmdParsing(Adapter, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK, Rtl8188E_NIC_DISABLE_FLOW); + // Reset MCU IO Wrapper val8 = rtw_read8(Adapter, REG_RSV_CTRL+1); - rtw_write8(Adapter, REG_RSV_CTRL+1, (val8&(~BIT3))); + rtw_write8(Adapter, REG_RSV_CTRL+1, (val8&(~BIT3))); val8 = rtw_read8(Adapter, REG_RSV_CTRL+1); rtw_write8(Adapter, REG_RSV_CTRL+1, val8|BIT3); - + #if 0 // 7. RSV_CTRL 0x1C[7:0] = 0x0E // lock ISO/CLK/Power control register rtw_write8(Adapter, REG_RSV_CTRL, 0x0e); @@ -2049,9 +2049,9 @@ static void rtl8188eu_hw_power_down(struct adapter *padapter) { // 2010/-8/09 MH For power down module, we need to enable register block contrl reg at 0x1c. // Then enable power down control bit of register 0x04 BIT4 and BIT15 as 1. - + // Enable register area 0x0-0xc. - rtw_write8(padapter,REG_RSV_CTRL, 0x0); + rtw_write8(padapter,REG_RSV_CTRL, 0x0); rtw_write16(padapter, REG_APS_FSMCO, 0x8812); } @@ -2059,44 +2059,44 @@ u32 rtl8188eu_hal_deinit(struct adapter *Adapter) { struct pwrctrl_priv *pwrctl = adapter_to_pwrctl(Adapter); HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); - DBG_8192C("==> %s \n",__FUNCTION__); + DBG_8192C("==> %s \n",__FUNCTION__); #ifdef CONFIG_SUPPORT_USB_INT rtw_write32(Adapter, REG_HIMR_88E, IMR_DISABLED_88E); rtw_write32(Adapter, REG_HIMRE_88E, IMR_DISABLED_88E); #endif - + #ifdef SUPPORT_HW_RFOFF_DETECTED - DBG_8192C("bkeepfwalive(%x)\n", pwrctl->bkeepfwalive); - if(pwrctl->bkeepfwalive) - { - _ps_close_RF(Adapter); - if((pwrctl->bHWPwrPindetect) && (pwrctl->bHWPowerdown)) + DBG_8192C("bkeepfwalive(%x)\n", pwrctl->bkeepfwalive); + if(pwrctl->bkeepfwalive) + { + _ps_close_RF(Adapter); + if((pwrctl->bHWPwrPindetect) && (pwrctl->bHWPowerdown)) rtl8188eu_hw_power_down(Adapter); - } + } else #endif { if(Adapter->hw_init_completed == _TRUE){ hal_poweroff_rtl8188eu(Adapter); - if((pwrctl->bHWPwrPindetect ) && (pwrctl->bHWPowerdown)) + if((pwrctl->bHWPwrPindetect ) && (pwrctl->bHWPowerdown)) rtl8188eu_hw_power_down(Adapter); - + } - } + } return _SUCCESS; } unsigned int rtl8188eu_inirp_init(struct adapter *Adapter) -{ - u8 i; +{ + u8 i; struct recv_buf *precvbuf; uint status; struct dvobj_priv *pdev= adapter_to_dvobj(Adapter); struct intf_hdl * pintfhdl=&Adapter->iopriv.intf; - struct recv_priv *precvpriv = &(Adapter->recvpriv); + struct recv_priv *precvpriv = &(Adapter->recvpriv); u32 (*_read_port)(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *pmem); #ifdef CONFIG_USB_INTERRUPT_IN_PIPE HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); @@ -2109,12 +2109,12 @@ _func_enter_; status = _SUCCESS; - RT_TRACE(_module_hci_hal_init_c_,_drv_info_,("===> usb_inirp_init \n")); - + RT_TRACE(_module_hci_hal_init_c_,_drv_info_,("===> usb_inirp_init \n")); + precvpriv->ff_hwaddr = RECV_BULK_IN_ADDR; - //issue Rx irp to receive data - precvbuf = (struct recv_buf *)precvpriv->precv_buf; + //issue Rx irp to receive data + precvbuf = (struct recv_buf *)precvpriv->precv_buf; for(i=0; iff_hwaddr, 0, (unsigned char *)precvbuf) == _FALSE ) @@ -2123,8 +2123,8 @@ _func_enter_; status = _FAIL; goto exit; } - - precvbuf++; + + precvbuf++; precvpriv->free_recv_buf_queue_cnt--; } @@ -2134,7 +2134,7 @@ _func_enter_; status = _FAIL; DBG_871X("%s =>Warning !! Have not USB Int-IN pipe, pHalData->RtIntInPipe(%d)!!!\n",__FUNCTION__,pHalData->RtIntInPipe); goto exit; - } + } _read_interrupt = pintfhdl->io_ops._read_interrupt; if(_read_interrupt(pintfhdl, RECV_INT_IN_ADDR) == _FALSE ) { @@ -2144,7 +2144,7 @@ _func_enter_; #endif exit: - + RT_TRACE(_module_hci_hal_init_c_,_drv_info_,("<=== usb_inirp_init \n")); _func_exit_; @@ -2154,9 +2154,9 @@ _func_exit_; } unsigned int rtl8188eu_inirp_deinit(struct adapter *Adapter) -{ +{ RT_TRACE(_module_hci_hal_init_c_,_drv_info_,("\n ===> usb_rx_deinit \n")); - + rtw_read_port_cancel(Adapter); RT_TRACE(_module_hci_hal_init_c_,_drv_info_,("\n <=== usb_rx_deinit \n")); @@ -2183,25 +2183,25 @@ _ReadPowerValueFromPROM( _rtw_memset(pwrInfo, 0, sizeof(TxPowerInfo)); - if(AutoLoadFail){ + if(AutoLoadFail){ for(group = 0 ; group < CHANNEL_GROUP_MAX ; group++){ for(rfPath = 0 ; rfPath < RF_PATH_MAX ; rfPath++){ - pwrInfo->CCKIndex[rfPath][group] = EEPROM_Default_TxPowerLevel; + pwrInfo->CCKIndex[rfPath][group] = EEPROM_Default_TxPowerLevel; pwrInfo->HT40_1SIndex[rfPath][group] = EEPROM_Default_TxPowerLevel; pwrInfo->HT40_2SIndexDiff[rfPath][group]= EEPROM_Default_HT40_2SDiff; pwrInfo->HT20IndexDiff[rfPath][group] = EEPROM_Default_HT20_Diff; pwrInfo->OFDMIndexDiff[rfPath][group] = EEPROM_Default_LegacyHTTxPowerDiff; - pwrInfo->HT40MaxOffset[rfPath][group] = EEPROM_Default_HT40_PwrMaxOffset; + pwrInfo->HT40MaxOffset[rfPath][group] = EEPROM_Default_HT40_PwrMaxOffset; pwrInfo->HT20MaxOffset[rfPath][group] = EEPROM_Default_HT20_PwrMaxOffset; } } pwrInfo->TSSI_A = EEPROM_Default_TSSI; pwrInfo->TSSI_B = EEPROM_Default_TSSI; - + return; } - + for(rfPath = 0 ; rfPath < RF_PATH_MAX ; rfPath++){ for(group = 0 ; group < CHANNEL_GROUP_MAX ; group++){ eeAddr = EEPROM_CCK_TX_PWR_INX + (rfPath * 3) + group; @@ -2214,7 +2214,7 @@ _ReadPowerValueFromPROM( for(group = 0 ; group < CHANNEL_GROUP_MAX ; group++){ for(rfPath = 0 ; rfPath < RF_PATH_MAX ; rfPath++){ - pwrInfo->HT40_2SIndexDiff[rfPath][group] = + pwrInfo->HT40_2SIndexDiff[rfPath][group] = (PROMContent[EEPROM_HT40_2S_TX_PWR_INX_DIFF + group] >> (rfPath * 4)) & 0xF; #if 1 @@ -2251,14 +2251,14 @@ _GetChannelGroup( { //RT_ASSERT((channel < 14), ("Channel %d no is supported!\n")); - if(channel < 3){ // Channel 1~3 + if(channel < 3){ // Channel 1~3 return 0; } else if(channel < 9){ // Channel 4~9 return 1; } - return 2; // Channel 10~14 + return 2; // Channel 10~14 } @@ -2302,10 +2302,10 @@ ReadTxPowerInfo( for(rfPath = 0 ; rfPath < RF_PATH_MAX ; rfPath++){ for(ch = 0 ; ch < CHANNEL_MAX_NUMBER ; ch++){ - RTPRINT(FINIT, INIT_TxPower, - ("RF(%d)-Ch(%d) [CCK / HT40_1S / HT40_2S] = [0x%x / 0x%x / 0x%x]\n", - rfPath, ch, pHalData->TxPwrLevelCck[rfPath][ch], - pHalData->TxPwrLevelHT40_1S[rfPath][ch], + RTPRINT(FINIT, INIT_TxPower, + ("RF(%d)-Ch(%d) [CCK / HT40_1S / HT40_2S] = [0x%x / 0x%x / 0x%x]\n", + rfPath, ch, pHalData->TxPwrLevelCck[rfPath][ch], + pHalData->TxPwrLevelHT40_1S[rfPath][ch], pHalData->TxPwrLevelHT40_2S[rfPath][ch])); } @@ -2318,15 +2318,15 @@ ReadTxPowerInfo( for(ch = 0 ; ch < CHANNEL_MAX_NUMBER ; ch++){ RTPRINT(FINIT, INIT_TxPower, ("RF-A Legacy to Ht40 Diff[%d] = 0x%x\n", ch, pHalData->TxPwrLegacyHtDiff[RF_PATH_A][ch])); } - + for(ch = 0 ; ch < CHANNEL_MAX_NUMBER ; ch++){ RTPRINT(FINIT, INIT_TxPower, ("RF-B Ht20 to HT40 Diff[%d] = 0x%x\n", ch, pHalData->TxPwrHt20Diff[RF_PATH_B][ch])); } - + for(ch = 0 ; ch < CHANNEL_MAX_NUMBER ; ch++){ RTPRINT(FINIT, INIT_TxPower, ("RF-B Legacy to HT40 Diff[%d] = 0x%x\n", ch, pHalData->TxPwrLegacyHtDiff[RF_PATH_B][ch])); } - + #endif // 2010/10/19 MH Add Regulator recognize for CU. if(!AutoLoadFail) @@ -2358,11 +2358,11 @@ _ReadIDs( HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); if(_FALSE == AutoloadFail){ - // VID, PID + // VID, PID pHalData->EEPROMVID = le16_to_cpu( *(u16 *)&PROMContent[EEPROM_VID]); pHalData->EEPROMPID = le16_to_cpu( *(u16 *)&PROMContent[EEPROM_PID]); - - // Customer ID, 0x00 and 0xff are reserved for Realtek. + + // Customer ID, 0x00 and 0xff are reserved for Realtek. pHalData->EEPROMCustomerID = *(u8 *)&PROMContent[EEPROM_CUSTOMER_ID]; pHalData->EEPROMSubCustomerID = *(u8 *)&PROMContent[EEPROM_SUBCUSTOMER_ID]; @@ -2371,7 +2371,7 @@ _ReadIDs( pHalData->EEPROMVID = EEPROM_Default_VID; pHalData->EEPROMPID = EEPROM_Default_PID; - // Customer ID, 0x00 and 0xff are reserved for Realtek. + // Customer ID, 0x00 and 0xff are reserved for Realtek. pHalData->EEPROMCustomerID = EEPROM_Default_CustomerID; pHalData->EEPROMSubCustomerID = EEPROM_Default_SubCustomerID; @@ -2393,7 +2393,7 @@ _ReadIDs( pHalData->CustomerID = RT_CID_DLINK; break; case EEPROM_CID_WHQL: -/* +/* Adapter->bInHctTest = TRUE; pMgntInfo->bSupportTurboMode = FALSE; @@ -2402,16 +2402,16 @@ _ReadIDs( pMgntInfo->PowerSaveControl.bInactivePs = FALSE; pMgntInfo->PowerSaveControl.bIPSModeBackup = FALSE; pMgntInfo->PowerSaveControl.bLeisurePs = FALSE; - + pMgntInfo->keepAliveLevel = 0; Adapter->bUnloadDriverwhenS3S4 = FALSE; -*/ +*/ break; default: pHalData->CustomerID = RT_CID_DEFAULT; break; - + } MSG_8192C("EEPROMVID = 0x%04x\n", pHalData->EEPROMVID); @@ -2426,24 +2426,24 @@ _ReadIDs( static VOID _ReadMACAddress( - IN struct adapter *Adapter, + IN struct adapter *Adapter, IN u8* PROMContent, IN BOOLEAN AutoloadFail ) { #if 0 - + EEPROM_EFUSE_PRIV *pEEPROM = GET_EEPROM_EFUSE_PRIV(Adapter); if(_FALSE == AutoloadFail){ //Read Permanent MAC address and set value to hardware - _rtw_memcpy(pEEPROM->mac_addr, &PROMContent[EEPROM_MAC_ADDR], ETH_ALEN); + _rtw_memcpy(pEEPROM->mac_addr, &PROMContent[EEPROM_MAC_ADDR], ETH_ALEN); } else{ //Random assigh MAC address u8 sMacAddr[MAC_ADDR_LEN] = {0x00, 0xE0, 0x4C, 0x81, 0x92, 0x00}; - //sMacAddr[5] = (u8)GetRandomNumber(1, 254); - _rtw_memcpy(pEEPROM->mac_addr, sMacAddr, ETH_ALEN); + //sMacAddr[5] = (u8)GetRandomNumber(1, 254); + _rtw_memcpy(pEEPROM->mac_addr, sMacAddr, ETH_ALEN); } DBG_8192C("%s MAC Address from EFUSE = "MAC_FMT"\n",__FUNCTION__, MAC_ARG(pEEPROM->mac_addr)); //NicIFSetMacAddress(Adapter, Adapter->PermanentAddress); @@ -2453,18 +2453,18 @@ _ReadMACAddress( static VOID _ReadBoardType( - IN struct adapter *Adapter, + IN struct adapter *Adapter, IN u8* PROMContent, IN BOOLEAN AutoloadFail ) { - + } static VOID _ReadLEDSetting( - IN struct adapter *Adapter, + IN struct adapter *Adapter, IN u8* PROMContent, IN BOOLEAN AutoloadFail ) @@ -2488,9 +2488,9 @@ _ReadLEDSetting( static VOID _ReadThermalMeter( - IN struct adapter *Adapter, - IN u8* PROMContent, - IN BOOLEAN AutoloadFail + IN struct adapter *Adapter, + IN u8* PROMContent, + IN BOOLEAN AutoloadFail ) { #if 0 @@ -2501,11 +2501,11 @@ _ReadThermalMeter( // // ThermalMeter from EEPROM // - if(!AutoloadFail) + if(!AutoloadFail) tempval = PROMContent[EEPROM_THERMAL_METER]; else tempval = EEPROM_Default_ThermalMeter; - + pHalData->EEPROMThermalMeter = (tempval&0x1f); //[4:0] if(pHalData->EEPROMThermalMeter == 0x1f || AutoloadFail) @@ -2517,32 +2517,32 @@ _ReadThermalMeter( #endif pdmpriv->ThermalMeter[0] = pHalData->EEPROMThermalMeter; - + //RTPRINT(FINIT, INIT_TxPower, ("ThermalMeter = 0x%x\n", pHalData->EEPROMThermalMeter)); -#endif +#endif } static VOID _ReadRFSetting( - IN struct adapter *Adapter, - IN u8* PROMContent, - IN BOOLEAN AutoloadFail + IN struct adapter *Adapter, + IN u8* PROMContent, + IN BOOLEAN AutoloadFail ) { } static void _ReadPROMVersion( - IN struct adapter *Adapter, - IN u8* PROMContent, - IN BOOLEAN AutoloadFail + IN struct adapter *Adapter, + IN u8* PROMContent, + IN BOOLEAN AutoloadFail ) { #if 0 HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); if(AutoloadFail){ - pHalData->EEPROMVersion = EEPROM_Default_Version; + pHalData->EEPROMVersion = EEPROM_Default_Version; } else{ pHalData->EEPROMVersion = *(u8 *)&PROMContent[EEPROM_VERSION]; @@ -2567,13 +2567,13 @@ readAntennaDiversity( if(!AutoLoadFail) { - // Antenna Diversity setting. + // Antenna Diversity setting. if(registry_par->antdiv_cfg == 2) // 2: From Efuse pHalData->AntDivCfg = (hwinfo[EEPROM_RF_OPT1]&0x18)>>3; else pHalData->AntDivCfg = registry_par->antdiv_cfg ; // 0:OFF , 1:ON, - DBG_8192C("### AntDivCfg(%x)\n",pHalData->AntDivCfg); + DBG_8192C("### AntDivCfg(%x)\n",pHalData->AntDivCfg); //if(pHalData->EEPROMBluetoothCoexist!=0 && pHalData->EEPROMBluetoothAntNum==Ant_x1) // pHalData->AntDivCfg = 0; @@ -2605,7 +2605,7 @@ hal_InitPGData( for(i = 0; i < HWSET_MAX_SIZE_88E; i += 2) { //value16 = EF2Byte(ReadEEprom(pAdapter, (u2Byte) (i>>1))); - //*((u16 *)(&PROMContent[i])) = value16; + //*((u16 *)(&PROMContent[i])) = value16; } } else @@ -2617,11 +2617,11 @@ hal_InitPGData( } else {//autoload fail - //RT_TRACE(COMP_INIT, DBG_LOUD, ("AutoLoad Fail reported from CR9346!!\n")); + //RT_TRACE(COMP_INIT, DBG_LOUD, ("AutoLoad Fail reported from CR9346!!\n")); pEEPROM->bautoload_fail_flag = _TRUE; //update to default value 0xFF - if (_FALSE == pEEPROM->EepromOrEfuse) - EFUSE_ShadowMapUpdate(pAdapter, EFUSE_WIFI, _FALSE); + if (_FALSE == pEEPROM->EepromOrEfuse) + EFUSE_ShadowMapUpdate(pAdapter, EFUSE_WIFI, _FALSE); } #endif } @@ -2637,21 +2637,21 @@ Hal_EfuseParsePIDVID_8188EU( if( !AutoLoadFail ) { - // VID, PID + // VID, PID pHalData->EEPROMVID = EF2Byte( *(u16 *)&hwinfo[EEPROM_VID_88EU] ); pHalData->EEPROMPID = EF2Byte( *(u16 *)&hwinfo[EEPROM_PID_88EU] ); - - // Customer ID, 0x00 and 0xff are reserved for Realtek. + + // Customer ID, 0x00 and 0xff are reserved for Realtek. pHalData->EEPROMCustomerID = *(u8 *)&hwinfo[EEPROM_CUSTOMERID_88E]; pHalData->EEPROMSubCustomerID = EEPROM_Default_SubCustomerID; } else { - pHalData->EEPROMVID = EEPROM_Default_VID; - pHalData->EEPROMPID = EEPROM_Default_PID; + pHalData->EEPROMVID = EEPROM_Default_VID; + pHalData->EEPROMPID = EEPROM_Default_PID; - // Customer ID, 0x00 and 0xff are reserved for Realtek. + // Customer ID, 0x00 and 0xff are reserved for Realtek. pHalData->EEPROMCustomerID = EEPROM_Default_CustomerID; pHalData->EEPROMSubCustomerID = EEPROM_Default_SubCustomerID; @@ -2744,7 +2744,7 @@ Hal_CustomizeByCustomerID_8188EU( #endif } -// Read HW power down mode selection +// Read HW power down mode selection static void _ReadPSSetting(IN struct adapter *Adapter,IN u8*PROMContent,IN u8 AutoloadFail) { #if 0 @@ -2759,29 +2759,29 @@ static void _ReadPSSetting(IN struct adapter *Adapter,IN u8*PROMContent,IN u8 Au pwrctl->bHWPwrPindetect = Adapter->registrypriv.hwpwrp_detect; //else //pwrctl->bHWPwrPindetect = _FALSE;//dongle not support new - - + + //hw power down mode selection , 0:rf-off / 1:power down if(Adapter->registrypriv.hwpdn_mode==2) pwrctl->bHWPowerdown = (PROMContent[EEPROM_RF_OPT3] & BIT4); else pwrctl->bHWPowerdown = Adapter->registrypriv.hwpdn_mode; - + // decide hw if support remote wakeup function // if hw supported, 8051 (SIE) will generate WeakUP signal( D+/D- toggle) when autoresume pwrctl->bSupportRemoteWakeup = (PROMContent[EEPROM_TEST_USB_OPT] & BIT1)?_TRUE :_FALSE; - //if(SUPPORT_HW_RADIO_DETECT(Adapter)) + //if(SUPPORT_HW_RADIO_DETECT(Adapter)) //Adapter->registrypriv.usbss_enable = pwrctl->bSupportRemoteWakeup ; - + DBG_8192C("%s...bHWPwrPindetect(%x)-bHWPowerdown(%x) ,bSupportRemoteWakeup(%x)\n",__FUNCTION__, pwrctl->bHWPwrPindetect,pwrctl->bHWPowerdown ,pwrctl->bSupportRemoteWakeup); DBG_8192C("### PS params=> power_mgnt(%x),usbss_enable(%x) ###\n",Adapter->registrypriv.power_mgnt,Adapter->registrypriv.usbss_enable); - + } -#endif +#endif } #ifdef CONFIG_EFUSE_CONFIG_FILE @@ -2820,9 +2820,9 @@ static u32 Hal_readPGDataFromConfigFile( set_fs(fs); filp_close(fp, NULL); - + pEEPROM->bloadfile_fail_flag = _FALSE; - + return _SUCCESS; } @@ -2842,7 +2842,7 @@ Hal_ReadMACAddrFromFile_8188EU( u8 null_mac_addr[ETH_ALEN] = {0, 0, 0,0, 0, 0}; u8 multi_mac_addr[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; - + _rtw_memset(source_addr, 0, 18); _rtw_memset(pEEPROM->mac_addr, 0, ETH_ALEN); @@ -2910,12 +2910,12 @@ readAdapterInfo_8188EU( Hal_EfuseParsePIDVID_8188EU(padapter, pEEPROM->efuse_eeprom_data, pEEPROM->bautoload_fail_flag); #ifdef CONFIG_EFUSE_CONFIG_FILE Hal_ReadMACAddrFromFile_8188EU(padapter); -#else //CONFIG_EFUSE_CONFIG_FILE +#else //CONFIG_EFUSE_CONFIG_FILE Hal_EfuseParseMACAddr_8188EU(padapter, pEEPROM->efuse_eeprom_data, pEEPROM->bautoload_fail_flag); -#endif //CONFIG_EFUSE_CONFIG_FILE +#endif //CONFIG_EFUSE_CONFIG_FILE Hal_ReadPowerSavingMode88E(padapter, pEEPROM->efuse_eeprom_data, pEEPROM->bautoload_fail_flag); - Hal_ReadTxPowerInfo88E(padapter, pEEPROM->efuse_eeprom_data, pEEPROM->bautoload_fail_flag); + Hal_ReadTxPowerInfo88E(padapter, pEEPROM->efuse_eeprom_data, pEEPROM->bautoload_fail_flag); Hal_EfuseParseEEPROMVer88E(padapter, pEEPROM->efuse_eeprom_data, pEEPROM->bautoload_fail_flag); rtl8188e_EfuseParseChnlPlan(padapter, pEEPROM->efuse_eeprom_data, pEEPROM->bautoload_fail_flag); Hal_EfuseParseXtal_8188E(padapter, pEEPROM->efuse_eeprom_data, pEEPROM->bautoload_fail_flag); @@ -2937,7 +2937,7 @@ readAdapterInfo_8188EU( #else -#ifdef CONFIG_INTEL_PROXIM +#ifdef CONFIG_INTEL_PROXIM /* for intel proximity */ if (pHalData->rf_type== RF_1T1R) { Adapter->proximity.proxim_support = _TRUE; @@ -2948,14 +2948,14 @@ readAdapterInfo_8188EU( } else { Adapter->proximity.proxim_support = _FALSE; } -#endif //CONFIG_INTEL_PROXIM +#endif //CONFIG_INTEL_PROXIM #endif } static void _ReadPROMContent( IN struct adapter * Adapter ) -{ +{ EEPROM_EFUSE_PRIV *pEEPROM = GET_EEPROM_EFUSE_PRIV(Adapter); u8 eeValue; @@ -2997,7 +2997,7 @@ static int _ReadAdapterInfo8188EU(struct adapter *Adapter) { //HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); u32 start=rtw_get_current_time(); - + MSG_8192C("====> %s\n", __FUNCTION__); //Efuse_InitSomeVar(Adapter); @@ -3018,9 +3018,9 @@ static int _ReadAdapterInfo8188EU(struct adapter *Adapter) static void ReadAdapterInfo8188EU(struct adapter *Adapter) { - // Read EEPROM size before call any EEPROM function + // Read EEPROM size before call any EEPROM function Adapter->EepromAddressSize = GetEEPROMSize8188E(Adapter); - + _ReadAdapterInfo8188EU(Adapter); } @@ -3028,7 +3028,7 @@ static void ReadAdapterInfo8188EU(struct adapter *Adapter) #define GPIO_DEBUG_PORT_NUM 0 static void rtl8192cu_trigger_gpio_0(struct adapter *padapter) { -#ifdef CONFIG_USB_SUPPORT_ASYNC_VDN_REQ +#ifdef CONFIG_USB_SUPPORT_ASYNC_VDN_REQ u32 gpioctrl; DBG_8192C("==> trigger_gpio_0...\n"); rtw_write16_async(padapter,REG_GPIO_PIN_CTRL,0); @@ -3043,7 +3043,7 @@ static void rtl8192cu_trigger_gpio_0(struct adapter *padapter) static void ResumeTxBeacon(struct adapter *padapter) { - HAL_DATA_TYPE* pHalData = GET_HAL_DATA(padapter); + HAL_DATA_TYPE* pHalData = GET_HAL_DATA(padapter); // 2010.03.01. Marked by tynli. No need to call workitem beacause we record the value // which should be read from register to a global variable. @@ -3065,17 +3065,17 @@ void UpdateInterruptMask8188EU(struct adapter *padapter,u8 bHIMR0 ,u32 AddMSR, u himr = &(pHalData->IntrMask[0]); else himr = &(pHalData->IntrMask[1]); - + if (AddMSR) *himr |= AddMSR; if (RemoveMSR) *himr &= (~RemoveMSR); - if(bHIMR0) + if(bHIMR0) rtw_write32(padapter, REG_HIMR_88E, *himr); else - rtw_write32(padapter, REG_HIMRE_88E, *himr); + rtw_write32(padapter, REG_HIMRE_88E, *himr); } @@ -3108,35 +3108,35 @@ static void hw_var_set_opmode(struct adapter *Adapter, u8 variable, u8* val) { // disable Port1 TSF update rtw_write8(Adapter, REG_BCN_CTRL_1, rtw_read8(Adapter, REG_BCN_CTRL_1)|BIT(4)); - + // set net_type val8 = rtw_read8(Adapter, MSR)&0x03; val8 |= (mode<<2); rtw_write8(Adapter, MSR, val8); - + DBG_871X("%s()-%d mode = %d\n", __FUNCTION__, __LINE__, mode); if((mode == _HW_STATE_STATION_) || (mode == _HW_STATE_NOLINK_)) { - if(!check_buddy_mlmeinfo_state(Adapter, WIFI_FW_AP_STATE)) + if(!check_buddy_mlmeinfo_state(Adapter, WIFI_FW_AP_STATE)) { - #ifdef CONFIG_INTERRUPT_BASED_TXBCN + #ifdef CONFIG_INTERRUPT_BASED_TXBCN - #ifdef CONFIG_INTERRUPT_BASED_TXBCN_EARLY_INT + #ifdef CONFIG_INTERRUPT_BASED_TXBCN_EARLY_INT rtw_write8(Adapter, REG_DRVERLYINT, 0x05);//restore early int time to 5ms - UpdateInterruptMask8188EU(Adapter,_TRUE, 0, IMR_BCNDMAINT0_88E); + UpdateInterruptMask8188EU(Adapter,_TRUE, 0, IMR_BCNDMAINT0_88E); #endif // CONFIG_INTERRUPT_BASED_TXBCN_EARLY_INT - - #ifdef CONFIG_INTERRUPT_BASED_TXBCN_BCN_OK_ERR - UpdateInterruptMask8188EU(Adapter,_TRUE ,0, (IMR_TBDER_88E|IMR_TBDOK_88E)); + + #ifdef CONFIG_INTERRUPT_BASED_TXBCN_BCN_OK_ERR + UpdateInterruptMask8188EU(Adapter,_TRUE ,0, (IMR_TBDER_88E|IMR_TBDOK_88E)); #endif// CONFIG_INTERRUPT_BASED_TXBCN_BCN_OK_ERR - - #endif //CONFIG_INTERRUPT_BASED_TXBCN - + + #endif //CONFIG_INTERRUPT_BASED_TXBCN + StopTxBeacon(Adapter); } - + rtw_write8(Adapter,REG_BCN_CTRL_1, 0x11);//disable atim wnd and disable beacon function //rtw_write8(Adapter,REG_BCN_CTRL_1, 0x18); } @@ -3149,58 +3149,58 @@ static void hw_var_set_opmode(struct adapter *Adapter, u8 variable, u8* val) } else if(mode == _HW_STATE_AP_) { -#ifdef CONFIG_INTERRUPT_BASED_TXBCN +#ifdef CONFIG_INTERRUPT_BASED_TXBCN #ifdef CONFIG_INTERRUPT_BASED_TXBCN_EARLY_INT UpdateInterruptMask8188EU(Adapter,_TRUE ,IMR_BCNDMAINT0_88E, 0); #endif//CONFIG_INTERRUPT_BASED_TXBCN_EARLY_INT - #ifdef CONFIG_INTERRUPT_BASED_TXBCN_BCN_OK_ERR + #ifdef CONFIG_INTERRUPT_BASED_TXBCN_BCN_OK_ERR UpdateInterruptMask8188EU(Adapter,_TRUE ,(IMR_TBDER_88E|IMR_TBDOK_88E), 0); #endif//CONFIG_INTERRUPT_BASED_TXBCN_BCN_OK_ERR - + #endif //CONFIG_INTERRUPT_BASED_TXBCN ResumeTxBeacon(Adapter); - + rtw_write8(Adapter, REG_BCN_CTRL_1, 0x12); //Set RCR //rtw_write32(padapter, REG_RCR, 0x70002a8e);//CBSSID_DATA must set to 0 //rtw_write32(Adapter, REG_RCR, 0x7000228e);//CBSSID_DATA must set to 0 rtw_write32(Adapter, REG_RCR, 0x7000208e);//CBSSID_DATA must set to 0,reject ICV_ERR packet - //enable to rx data frame + //enable to rx data frame rtw_write16(Adapter, REG_RXFLTMAP2, 0xFFFF); //enable to rx ps-poll rtw_write16(Adapter, REG_RXFLTMAP1, 0x0400); - //Beacon Control related register for first time - rtw_write8(Adapter, REG_BCNDMATIM, 0x02); // 2ms + //Beacon Control related register for first time + rtw_write8(Adapter, REG_BCNDMATIM, 0x02); // 2ms //rtw_write8(Adapter, REG_BCN_MAX_ERR, 0xFF); rtw_write8(Adapter, REG_ATIMWND_1, 0x0a); // 10ms for port1 rtw_write16(Adapter, REG_BCNTCFG, 0x00); rtw_write16(Adapter, REG_TBTT_PROHIBIT, 0xff04); rtw_write16(Adapter, REG_TSFTR_SYN_OFFSET, 0x7fff);// +32767 (~32ms) - - //reset TSF2 + + //reset TSF2 rtw_write8(Adapter, REG_DUAL_TSF_RST, BIT(1)); //BIT4 - If set 0, hw will clr bcnq when tx becon ok/fail or port 1 rtw_write8(Adapter, REG_MBID_NUM, rtw_read8(Adapter, REG_MBID_NUM)|BIT(3)|BIT(4)); - //enable BCN1 Function for if2 + //enable BCN1 Function for if2 //don't enable update TSF1 for if2 (due to TSF update when beacon/probe rsp are received) rtw_write8(Adapter, REG_BCN_CTRL_1, (DIS_TSF_UDT0_NORMAL_CHIP|EN_BCN_FUNCTION | EN_TXBCN_RPT|BIT(1))); #ifdef CONFIG_CONCURRENT_MODE if(check_buddy_fwstate(Adapter, WIFI_FW_NULL_STATE)) - rtw_write8(Adapter, REG_BCN_CTRL, + rtw_write8(Adapter, REG_BCN_CTRL, rtw_read8(Adapter, REG_BCN_CTRL) & ~EN_BCN_FUNCTION); #endif //BCN1 TSF will sync to BCN0 TSF with offset(0x518) if if1_sta linked //rtw_write8(Adapter, REG_BCN_CTRL_1, rtw_read8(Adapter, REG_BCN_CTRL_1)|BIT(5)); //rtw_write8(Adapter, REG_DUAL_TSF_RST, BIT(3)); - + //dis BCN0 ATIM WND if if1 is station rtw_write8(Adapter, REG_BCN_CTRL, rtw_read8(Adapter, REG_BCN_CTRL)|BIT(0)); @@ -3211,7 +3211,7 @@ static void hw_var_set_opmode(struct adapter *Adapter, u8 variable, u8* val) DBG_871X("ERROR! %s()-%d: Reset port1 TSF fail\n", __FUNCTION__, __LINE__); } -#endif // CONFIG_TSF_RESET_OFFLOAD +#endif // CONFIG_TSF_RESET_OFFLOAD } } else @@ -3219,34 +3219,34 @@ static void hw_var_set_opmode(struct adapter *Adapter, u8 variable, u8* val) { // disable Port0 TSF update rtw_write8(Adapter, REG_BCN_CTRL, rtw_read8(Adapter, REG_BCN_CTRL)|BIT(4)); - + // set net_type val8 = rtw_read8(Adapter, MSR)&0x0c; val8 |= mode; rtw_write8(Adapter, MSR, val8); - + DBG_871X("%s()-%d mode = %d\n", __FUNCTION__, __LINE__, mode); - + if((mode == _HW_STATE_STATION_) || (mode == _HW_STATE_NOLINK_)) { #ifdef CONFIG_CONCURRENT_MODE - if(!check_buddy_mlmeinfo_state(Adapter, WIFI_FW_AP_STATE)) + if(!check_buddy_mlmeinfo_state(Adapter, WIFI_FW_AP_STATE)) #endif //CONFIG_CONCURRENT_MODE { - #ifdef CONFIG_INTERRUPT_BASED_TXBCN + #ifdef CONFIG_INTERRUPT_BASED_TXBCN #ifdef CONFIG_INTERRUPT_BASED_TXBCN_EARLY_INT - rtw_write8(Adapter, REG_DRVERLYINT, 0x05);//restore early int time to 5ms - UpdateInterruptMask8188EU(Adapter,_TRUE, 0, IMR_BCNDMAINT0_88E); + rtw_write8(Adapter, REG_DRVERLYINT, 0x05);//restore early int time to 5ms + UpdateInterruptMask8188EU(Adapter,_TRUE, 0, IMR_BCNDMAINT0_88E); #endif//CONFIG_INTERRUPT_BASED_TXBCN_EARLY_INT - - #ifdef CONFIG_INTERRUPT_BASED_TXBCN_BCN_OK_ERR - UpdateInterruptMask8188EU(Adapter,_TRUE ,0, (IMR_TBDER_88E|IMR_TBDOK_88E)); + + #ifdef CONFIG_INTERRUPT_BASED_TXBCN_BCN_OK_ERR + UpdateInterruptMask8188EU(Adapter,_TRUE ,0, (IMR_TBDER_88E|IMR_TBDOK_88E)); #endif //CONFIG_INTERRUPT_BASED_TXBCN_BCN_OK_ERR - - #endif //CONFIG_INTERRUPT_BASED_TXBCN + + #endif //CONFIG_INTERRUPT_BASED_TXBCN StopTxBeacon(Adapter); } - + rtw_write8(Adapter,REG_BCN_CTRL, 0x19);//disable atim wnd //rtw_write8(Adapter,REG_BCN_CTRL, 0x18); } @@ -3260,15 +3260,15 @@ static void hw_var_set_opmode(struct adapter *Adapter, u8 variable, u8* val) else if(mode == _HW_STATE_AP_) { -#ifdef CONFIG_INTERRUPT_BASED_TXBCN +#ifdef CONFIG_INTERRUPT_BASED_TXBCN #ifdef CONFIG_INTERRUPT_BASED_TXBCN_EARLY_INT UpdateInterruptMask8188EU(Adapter,_TRUE ,IMR_BCNDMAINT0_88E, 0); #endif//CONFIG_INTERRUPT_BASED_TXBCN_EARLY_INT - #ifdef CONFIG_INTERRUPT_BASED_TXBCN_BCN_OK_ERR + #ifdef CONFIG_INTERRUPT_BASED_TXBCN_BCN_OK_ERR UpdateInterruptMask8188EU(Adapter,_TRUE ,(IMR_TBDER_88E|IMR_TBDOK_88E), 0); #endif//CONFIG_INTERRUPT_BASED_TXBCN_BCN_OK_ERR - + #endif //CONFIG_INTERRUPT_BASED_TXBCN @@ -3286,8 +3286,8 @@ static void hw_var_set_opmode(struct adapter *Adapter, u8 variable, u8* val) rtw_write16(Adapter, REG_RXFLTMAP1, 0x0400); //Beacon Control related register for first time - rtw_write8(Adapter, REG_BCNDMATIM, 0x02); // 2ms - + rtw_write8(Adapter, REG_BCNDMATIM, 0x02); // 2ms + //rtw_write8(Adapter, REG_BCN_MAX_ERR, 0xFF); rtw_write8(Adapter, REG_ATIMWND, 0x0a); // 10ms rtw_write16(Adapter, REG_BCNTCFG, 0x00); @@ -3299,7 +3299,7 @@ static void hw_var_set_opmode(struct adapter *Adapter, u8 variable, u8* val) //BIT3 - If set 0, hw will clr bcnq when tx becon ok/fail or port 0 rtw_write8(Adapter, REG_MBID_NUM, rtw_read8(Adapter, REG_MBID_NUM)|BIT(3)|BIT(4)); - + //enable BCN0 Function for if1 //don't enable update TSF0 for if1 (due to TSF update when beacon/probe rsp are received) #if defined(CONFIG_INTERRUPT_BASED_TXBCN_BCN_OK_ERR) @@ -3310,12 +3310,12 @@ static void hw_var_set_opmode(struct adapter *Adapter, u8 variable, u8* val) #ifdef CONFIG_CONCURRENT_MODE if(check_buddy_fwstate(Adapter, WIFI_FW_NULL_STATE)) - rtw_write8(Adapter, REG_BCN_CTRL_1, + rtw_write8(Adapter, REG_BCN_CTRL_1, rtw_read8(Adapter, REG_BCN_CTRL_1) & ~EN_BCN_FUNCTION); #endif //dis BCN1 ATIM WND if if2 is station - rtw_write8(Adapter, REG_BCN_CTRL_1, rtw_read8(Adapter, REG_BCN_CTRL_1)|BIT(0)); + rtw_write8(Adapter, REG_BCN_CTRL_1, rtw_read8(Adapter, REG_BCN_CTRL_1)|BIT(0)); #ifdef CONFIG_TSF_RESET_OFFLOAD // Reset TSF for STA+AP concurrent mode if ( check_buddy_fwstate(Adapter, (WIFI_STATION_STATE|WIFI_ASOC_STATE)) ) { @@ -3349,7 +3349,7 @@ static void hw_var_set_macaddr(struct adapter *Adapter, u8 variable, u8* val) { rtw_write8(Adapter, (reg_macid+idx), val[idx]); } - + } static void hw_var_set_bssid(struct adapter *Adapter, u8 variable, u8* val) @@ -3383,10 +3383,10 @@ static void hw_var_set_bcn_func(struct adapter *Adapter, u8 variable, u8* val) if(Adapter->iface_type == IFACE_PORT1) { bcn_ctrl_reg = REG_BCN_CTRL_1; - } + } else -#endif - { +#endif + { bcn_ctrl_reg = REG_BCN_CTRL; } @@ -3398,7 +3398,7 @@ static void hw_var_set_bcn_func(struct adapter *Adapter, u8 variable, u8* val) { rtw_write8(Adapter, bcn_ctrl_reg, rtw_read8(Adapter, bcn_ctrl_reg)&(~(EN_BCN_FUNCTION | EN_TXBCN_RPT))); } - + } @@ -3414,7 +3414,7 @@ static void hw_var_set_correct_tsf(struct adapter *Adapter, u8 variable, u8* val tsf = pmlmeext->TSFValue - rtw_modular64(pmlmeext->TSFValue, (pmlmeinfo->bcn_interval*1024)) -1024; //us if(((pmlmeinfo->state&0x03) == WIFI_FW_ADHOC_STATE) || ((pmlmeinfo->state&0x03) == WIFI_FW_AP_STATE)) - { + { //pHalData->RegTxPause |= STOP_BCNQ;BIT(6) //rtw_write8(Adapter, REG_TXPAUSE, (rtw_read8(Adapter, REG_TXPAUSE)|BIT(6))); StopTxBeacon(Adapter); @@ -3424,18 +3424,18 @@ static void hw_var_set_correct_tsf(struct adapter *Adapter, u8 variable, u8* val { //disable related TSF function rtw_write8(Adapter, REG_BCN_CTRL_1, rtw_read8(Adapter, REG_BCN_CTRL_1)&(~BIT(3))); - + rtw_write32(Adapter, REG_TSFTR1, tsf); rtw_write32(Adapter, REG_TSFTR1+4, tsf>>32); //enable related TSF function - rtw_write8(Adapter, REG_BCN_CTRL_1, rtw_read8(Adapter, REG_BCN_CTRL_1)|BIT(3)); + rtw_write8(Adapter, REG_BCN_CTRL_1, rtw_read8(Adapter, REG_BCN_CTRL_1)|BIT(3)); // Update buddy port's TSF if it is SoftAP for beacon TX issue! if ( (pmlmeinfo->state&0x03) == WIFI_FW_STATION_STATE && check_buddy_fwstate(Adapter, WIFI_AP_STATE) - ) { + ) { //disable related TSF function rtw_write8(Adapter, REG_BCN_CTRL, rtw_read8(Adapter, REG_BCN_CTRL)&(~BIT(3))); @@ -3450,26 +3450,26 @@ static void hw_var_set_correct_tsf(struct adapter *Adapter, u8 variable, u8* val DBG_871X("ERROR! %s()-%d: Reset port0 TSF fail\n", __FUNCTION__, __LINE__); -#endif // CONFIG_TSF_RESET_OFFLOAD - } +#endif // CONFIG_TSF_RESET_OFFLOAD + } + - } else { //disable related TSF function rtw_write8(Adapter, REG_BCN_CTRL, rtw_read8(Adapter, REG_BCN_CTRL)&(~BIT(3))); - + rtw_write32(Adapter, REG_TSFTR, tsf); rtw_write32(Adapter, REG_TSFTR+4, tsf>>32); //enable related TSF function rtw_write8(Adapter, REG_BCN_CTRL, rtw_read8(Adapter, REG_BCN_CTRL)|BIT(3)); - + // Update buddy port's TSF if it is SoftAP for beacon TX issue! if ( (pmlmeinfo->state&0x03) == WIFI_FW_STATION_STATE && check_buddy_fwstate(Adapter, WIFI_AP_STATE) - ) { + ) { //disable related TSF function rtw_write8(Adapter, REG_BCN_CTRL_1, rtw_read8(Adapter, REG_BCN_CTRL_1)&(~BIT(3))); @@ -3484,11 +3484,11 @@ static void hw_var_set_correct_tsf(struct adapter *Adapter, u8 variable, u8* val DBG_871X("ERROR! %s()-%d: Reset port1 TSF fail\n", __FUNCTION__, __LINE__); #endif // CONFIG_TSF_RESET_OFFLOAD - } + } } - - + + if(((pmlmeinfo->state&0x03) == WIFI_FW_ADHOC_STATE) || ((pmlmeinfo->state&0x03) == WIFI_FW_AP_STATE)) { //pHalData->RegTxPause &= (~STOP_BCNQ); @@ -3503,11 +3503,11 @@ static void hw_var_set_mlme_disconnect(struct adapter *Adapter, u8 variable, u8* #ifdef CONFIG_CONCURRENT_MODE //HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); struct adapter *pbuddy_adapter = Adapter->pbuddy_adapter; - - - if(check_buddy_mlmeinfo_state(Adapter, _HW_STATE_NOLINK_)) + + + if(check_buddy_mlmeinfo_state(Adapter, _HW_STATE_NOLINK_)) rtw_write16(Adapter, REG_RXFLTMAP2, 0x00); - + if(Adapter->iface_type == IFACE_PORT1) { @@ -3532,8 +3532,8 @@ static void hw_var_set_mlme_disconnect(struct adapter *Adapter, u8 variable, u8* } static void hw_var_set_mlme_sitesurvey(struct adapter *Adapter, u8 variable, u8* val) -{ -#ifdef CONFIG_CONCURRENT_MODE +{ +#ifdef CONFIG_CONCURRENT_MODE HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); struct mlme_ext_priv *pmlmeext = &Adapter->mlmeextpriv; @@ -3556,11 +3556,11 @@ static void hw_var_set_mlme_sitesurvey(struct adapter *Adapter, u8 variable, u8* else { rtw_write8(Adapter, REG_BCN_CTRL, rtw_read8(Adapter, REG_BCN_CTRL)|BIT(4)); - } + } } - + if(check_buddy_mlmeinfo_state(Adapter, WIFI_FW_AP_STATE) && - check_buddy_fwstate(Adapter, _FW_LINKED)) + check_buddy_fwstate(Adapter, _FW_LINKED)) { StopTxBeacon(Adapter); } @@ -3578,14 +3578,14 @@ static void hw_var_set_mlme_sitesurvey(struct adapter *Adapter, u8 variable, u8* rtw_write8(Adapter, REG_BCN_CTRL, rtw_read8(Adapter, REG_BCN_CTRL)&(~BIT(4))); rtw_write32(Adapter, REG_RCR, rtw_read32(Adapter, REG_RCR)|RCR_CBSSID_BCN); - + if(check_buddy_mlmeinfo_state(Adapter, WIFI_FW_AP_STATE) && check_buddy_fwstate(Adapter, _FW_LINKED)) { - ResumeTxBeacon(Adapter); + ResumeTxBeacon(Adapter); } } -#endif +#endif } static void hw_var_set_mlme_join(struct adapter *Adapter, u8 variable, u8* val) @@ -3597,13 +3597,13 @@ static void hw_var_set_mlme_join(struct adapter *Adapter, u8 variable, u8* val) struct mlme_priv *pmlmepriv = &Adapter->mlmepriv; if(type == 0) // prepare to join - { + { if(check_buddy_mlmeinfo_state(Adapter, WIFI_FW_AP_STATE) && - check_buddy_fwstate(Adapter, _FW_LINKED)) + check_buddy_fwstate(Adapter, _FW_LINKED)) { StopTxBeacon(Adapter); } - + //enable to rx data frame.Accept all data frame //rtw_write32(padapter, REG_RCR, rtw_read32(padapter, REG_RCR)|RCR_ADF); rtw_write16(Adapter, REG_RXFLTMAP2,0xFFFF); @@ -3623,30 +3623,30 @@ static void hw_var_set_mlme_join(struct adapter *Adapter, u8 variable, u8* val) } } else if(type == 1) //joinbss_event call back when join res < 0 - { - if(check_buddy_mlmeinfo_state(Adapter, _HW_STATE_NOLINK_)) + { + if(check_buddy_mlmeinfo_state(Adapter, _HW_STATE_NOLINK_)) rtw_write16(Adapter, REG_RXFLTMAP2,0x00); if(check_buddy_mlmeinfo_state(Adapter, WIFI_FW_AP_STATE) && check_buddy_fwstate(Adapter, _FW_LINKED)) { - ResumeTxBeacon(Adapter); - + ResumeTxBeacon(Adapter); + //reset TSF 1/2 after ResumeTxBeacon - rtw_write8(Adapter, REG_DUAL_TSF_RST, BIT(1)|BIT(0)); - + rtw_write8(Adapter, REG_DUAL_TSF_RST, BIT(1)|BIT(0)); + } } else if(type == 2) //sta add event call back { - + //enable update TSF if(Adapter->iface_type == IFACE_PORT1) rtw_write8(Adapter, REG_BCN_CTRL_1, rtw_read8(Adapter, REG_BCN_CTRL_1)&(~BIT(4))); else rtw_write8(Adapter, REG_BCN_CTRL, rtw_read8(Adapter, REG_BCN_CTRL)&(~BIT(4))); - - + + if(check_fwstate(pmlmepriv, WIFI_ADHOC_STATE|WIFI_ADHOC_MASTER_STATE)) { //fixed beacon issue for 8191su........... @@ -3658,16 +3658,16 @@ static void hw_var_set_mlme_join(struct adapter *Adapter, u8 variable, u8* val) if(check_buddy_mlmeinfo_state(Adapter, WIFI_FW_AP_STATE) && check_buddy_fwstate(Adapter, _FW_LINKED)) { - ResumeTxBeacon(Adapter); - + ResumeTxBeacon(Adapter); + //reset TSF 1/2 after ResumeTxBeacon rtw_write8(Adapter, REG_DUAL_TSF_RST, BIT(1)|BIT(0)); } - + } rtw_write16(Adapter, REG_RL, RetryLimit << RETRY_LIMIT_SHORT_SHIFT | RetryLimit << RETRY_LIMIT_LONG_SHIFT); - + #endif } @@ -3675,7 +3675,7 @@ void SetHwReg8188EU(struct adapter *Adapter, u8 variable, u8* val) { HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); struct dm_priv *pdmpriv = &pHalData->dmpriv; - DM_ODM_T *podmpriv = &pHalData->odmpriv; + DM_ODM_T *podmpriv = &pHalData->odmpriv; _func_enter_; switch(variable) @@ -3692,7 +3692,7 @@ _func_enter_; case HW_VAR_MEDIA_STATUS1: { u8 val8; - + val8 = rtw_read8(Adapter, MSR)&0x03; val8 |= *((u8 *)val) <<2; rtw_write8(Adapter, MSR, val8); @@ -3702,7 +3702,7 @@ _func_enter_; hw_var_set_opmode(Adapter, variable, val); break; case HW_VAR_MAC_ADDR: - hw_var_set_macaddr(Adapter, variable, val); + hw_var_set_macaddr(Adapter, variable, val); break; case HW_VAR_BSSID: hw_var_set_bssid(Adapter, variable, val); @@ -3743,7 +3743,7 @@ _func_enter_; } break; case HW_VAR_TXPAUSE: - rtw_write8(Adapter, REG_TXPAUSE, *((u8 *)val)); + rtw_write8(Adapter, REG_TXPAUSE, *((u8 *)val)); break; case HW_VAR_BCN_FUNC: hw_var_set_bcn_func(Adapter, variable, val); @@ -3751,7 +3751,7 @@ _func_enter_; case HW_VAR_CORRECT_TSF: #ifdef CONFIG_CONCURRENT_MODE hw_var_set_correct_tsf(Adapter, variable, val); -#else +#else { u64 tsf; struct mlme_ext_priv *pmlmeext = &Adapter->mlmeextpriv; @@ -3761,7 +3761,7 @@ _func_enter_; tsf = pmlmeext->TSFValue - rtw_modular64(pmlmeext->TSFValue, (pmlmeinfo->bcn_interval*1024)) -1024; //us if(((pmlmeinfo->state&0x03) == WIFI_FW_ADHOC_STATE) || ((pmlmeinfo->state&0x03) == WIFI_FW_AP_STATE)) - { + { //pHalData->RegTxPause |= STOP_BCNQ;BIT(6) //rtw_write8(Adapter, REG_TXPAUSE, (rtw_read8(Adapter, REG_TXPAUSE)|BIT(6))); StopTxBeacon(Adapter); @@ -3769,14 +3769,14 @@ _func_enter_; //disable related TSF function rtw_write8(Adapter, REG_BCN_CTRL, rtw_read8(Adapter, REG_BCN_CTRL)&(~BIT(3))); - + rtw_write32(Adapter, REG_TSFTR, tsf); rtw_write32(Adapter, REG_TSFTR+4, tsf>>32); //enable related TSF function rtw_write8(Adapter, REG_BCN_CTRL, rtw_read8(Adapter, REG_BCN_CTRL)|BIT(3)); - - + + if(((pmlmeinfo->state&0x03) == WIFI_FW_ADHOC_STATE) || ((pmlmeinfo->state&0x03) == WIFI_FW_AP_STATE)) { //pHalData->RegTxPause &= (~STOP_BCNQ); @@ -3788,15 +3788,15 @@ _func_enter_; break; case HW_VAR_CHECK_BSSID: if(*((u8 *)val)) - { - rtw_write32(Adapter, REG_RCR, rtw_read32(Adapter, REG_RCR)|RCR_CBSSID_DATA|RCR_CBSSID_BCN); + { + rtw_write32(Adapter, REG_RCR, rtw_read32(Adapter, REG_RCR)|RCR_CBSSID_DATA|RCR_CBSSID_BCN); } else { u32 val32; val32 = rtw_read32(Adapter, REG_RCR); - + val32 &= ~(RCR_CBSSID_DATA | RCR_CBSSID_BCN); rtw_write32(Adapter, REG_RCR, val32); @@ -3816,7 +3816,7 @@ _func_enter_; rtw_write8(Adapter, REG_DUAL_TSF_RST, (BIT(0)|BIT(1))); //disable update TSF - rtw_write8(Adapter, REG_BCN_CTRL, rtw_read8(Adapter, REG_BCN_CTRL)|BIT(4)); + rtw_write8(Adapter, REG_BCN_CTRL, rtw_read8(Adapter, REG_BCN_CTRL)|BIT(4)); } #endif break; @@ -3876,7 +3876,7 @@ _func_enter_; } } } -#endif +#endif break; case HW_VAR_MLME_JOIN: #ifdef CONFIG_CONCURRENT_MODE @@ -3886,7 +3886,7 @@ _func_enter_; u8 RetryLimit = 0x30; u8 type = *((u8 *)val); struct mlme_priv *pmlmepriv = &Adapter->mlmepriv; - + if(type == 0) // prepare to join { //enable to rx data frame.Accept all data frame @@ -3946,11 +3946,11 @@ _func_enter_; { struct mlme_ext_priv *pmlmeext = &Adapter->mlmeextpriv; struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); - u16 bcn_interval = *((u16 *)val); + u16 bcn_interval = *((u16 *)val); if((pmlmeinfo->state&0x03) == WIFI_FW_AP_STATE){ DBG_8192C("%s==> bcn_interval:%d, eraly_int:%d \n",__FUNCTION__,bcn_interval,bcn_interval>>1); - rtw_write8(Adapter, REG_DRVERLYINT, bcn_interval>>1);// 50ms for sdio - } + rtw_write8(Adapter, REG_DRVERLYINT, bcn_interval>>1);// 50ms for sdio + } } #endif//CONFIG_INTERRUPT_BASED_TXBCN_EARLY_INT @@ -3960,7 +3960,7 @@ _func_enter_; u8 u1bAIFS, aSifsTime; struct mlme_ext_priv *pmlmeext = &Adapter->mlmeextpriv; struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); - + rtw_write8(Adapter, REG_SLOT, val[0]); if(pmlmeinfo->WMM_enable == 0) @@ -3969,9 +3969,9 @@ _func_enter_; aSifsTime = 10; else aSifsTime = 16; - + u1bAIFS = aSifsTime + (2 * pmlmeinfo->slotTime); - + // Temporary removed, 2008.06.20. rtw_write8(Adapter, REG_EDCA_VO_PARAM, u1bAIFS); rtw_write8(Adapter, REG_EDCA_VI_PARAM, u1bAIFS); @@ -3982,12 +3982,12 @@ _func_enter_; break; case HW_VAR_RESP_SIFS: { -#if 0 +#if 0 // SIFS for OFDM Data ACK rtw_write8(Adapter, REG_SIFS_CTX+1, val[0]); // SIFS for OFDM consecutive tx like CTS data! rtw_write8(Adapter, REG_SIFS_TRX+1, val[1]); - + rtw_write8(Adapter,REG_SPEC_SIFS+1, val[0]); rtw_write8(Adapter,REG_MAC_SPEC_SIFS+1, val[0]); @@ -4003,7 +4003,7 @@ _func_enter_; //RESP_SIFS for OFDM rtw_write8(Adapter, REG_T2T_SIFS, val[2]); //SIFS_T2T_OFDM (0x0a) rtw_write8(Adapter, REG_T2T_SIFS+1, val[3]); //SIFS_R2T_OFDM(0x0a) -#endif +#endif } break; case HW_VAR_ACK_PREAMBLE: @@ -4021,7 +4021,7 @@ _func_enter_; break; case HW_VAR_SEC_CFG: #ifdef CONFIG_CONCURRENT_MODE - rtw_write8(Adapter, REG_SECCFG, 0x0c|BIT(5));// enable tx enc and rx dec engine, and no key search for MC/BC + rtw_write8(Adapter, REG_SECCFG, 0x0c|BIT(5));// enable tx enc and rx dec engine, and no key search for MC/BC #else rtw_write8(Adapter, REG_SECCFG, *((u8 *)val)); #endif @@ -4033,7 +4033,7 @@ _func_enter_; case HW_VAR_DM_FUNC_OP: if(val[0]) {// save dm flag - podmpriv->BK_SupportAbility = podmpriv->SupportAbility; + podmpriv->BK_SupportAbility = podmpriv->SupportAbility; } else {// restore dm flag @@ -4047,7 +4047,7 @@ _func_enter_; case HW_VAR_DM_FUNC_SET: if(*((u32 *)val) == DYNAMIC_ALL_FUNC_ENABLE){ pdmpriv->DMFlag = pdmpriv->InitDMFlag; - podmpriv->SupportAbility = pdmpriv->InitODMFlag; + podmpriv->SupportAbility = pdmpriv->InitODMFlag; } else{ podmpriv->SupportAbility |= *((u32 *)val); @@ -4097,7 +4097,7 @@ _func_enter_; u32 cmd; u32 *cam_val = (u32 *)val; rtw_write32(Adapter, WCAMI, cam_val[0]); - + cmd = CAM_POLLINIG | CAM_WRITE | cam_val[1]; rtw_write32(Adapter, RWCAM, cmd); } @@ -4204,10 +4204,10 @@ _func_enter_; { if((pRegToSet[index] & 0xf0) > (FactorToSet<<4)) pRegToSet[index] = (pRegToSet[index] & 0x0f) | (FactorToSet<<4); - + if((pRegToSet[index] & 0x0f) > FactorToSet) pRegToSet[index] = (pRegToSet[index] & 0xf0) | (FactorToSet); - + rtw_write8(Adapter, (REG_AGGLEN_LMT+index), pRegToSet[index]); } @@ -4245,7 +4245,7 @@ _func_enter_; case HW_VAR_H2C_FW_PWRMODE: { u8 psmode = (*(u8 *)val); - + // Forece leave RF low power mode for 1T1R to prevent conficting setting in Fw power // saving sequence. 2010.06.07. Added by tynli. Suggested by SD3 yschang. if( (psmode != PS_MODE_ACTIVE) && (!IS_92C_SERIAL(pHalData->VersionID))) @@ -4295,10 +4295,10 @@ _func_enter_; #endif //CONFIG_TDLS case HW_VAR_INITIAL_GAIN: { - DIG_T *pDigTable = &podmpriv->DM_DigTable; - u32 rx_gain = ((u32 *)(val))[0]; - - if(rx_gain == 0xff){//restore rx gain + DIG_T *pDigTable = &podmpriv->DM_DigTable; + u32 rx_gain = ((u32 *)(val))[0]; + + if(rx_gain == 0xff){//restore rx gain ODM_Write_DIG(podmpriv,pDigTable->BackupIGValue); } else{ @@ -4328,7 +4328,7 @@ _func_enter_; case HW_VAR_RPT_TIMER_SETTING: { u16 min_rpt_time = (*(u16 *)val); - ODM_RA_Set_TxRPT_Time(podmpriv,min_rpt_time); + ODM_RA_Set_TxRPT_Time(podmpriv,min_rpt_time); } break; #endif @@ -4338,19 +4338,19 @@ _func_enter_; //odm_SwAntDivRestAfterLink8192C(Adapter); ODM_SwAntDivRestAfterLink(podmpriv); break; -#endif +#endif #ifdef CONFIG_ANTENNA_DIVERSITY case HW_VAR_ANTENNA_DIVERSITY_SELECT: { u8 Optimum_antenna = (*(u8 *)val); - u8 Ant ; + u8 Ant ; //switch antenna to Optimum_antenna //DBG_8192C("==> HW_VAR_ANTENNA_DIVERSITY_SELECT , Ant_(%s)\n",(Optimum_antenna==2)?"A":"B"); - if(pHalData->CurAntenna != Optimum_antenna) - { + if(pHalData->CurAntenna != Optimum_antenna) + { Ant = (Optimum_antenna==2)?MAIN_ANT:AUX_ANT; ODM_UpdateRxIdleAnt_88E(&pHalData->odmpriv, Ant); - + pHalData->CurAntenna = Optimum_antenna ; //DBG_8192C("==> HW_VAR_ANTENNA_DIVERSITY_SELECT , Ant_(%s)\n",(Optimum_antenna==2)?"A":"B"); } @@ -4358,16 +4358,16 @@ _func_enter_; break; #endif case HW_VAR_EFUSE_BYTES: // To set EFUE total used bytes, added by Roger, 2008.12.22. - pHalData->EfuseUsedBytes = *((u16 *)val); + pHalData->EfuseUsedBytes = *((u16 *)val); break; case HW_VAR_FIFO_CLEARN_UP: - { + { struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(Adapter); - u8 trycnt = 100; - + u8 trycnt = 100; + //pause tx rtw_write8(Adapter,REG_TXPAUSE,0xff); - + //keep sn Adapter->xmitpriv.nqos_ssn = rtw_read16(Adapter,REG_NQOS_SEQ); @@ -4391,14 +4391,14 @@ _func_enter_; break; case HW_VAR_CHECK_TXBUF: -#ifdef CONFIG_CONCURRENT_MODE +#ifdef CONFIG_CONCURRENT_MODE { int i; #if 0 //for Miracast source PKT lost issue - u8 RetryLimit = 0x01; + u8 RetryLimit = 0x01; rtw_write16(Adapter, REG_RL, RetryLimit << RETRY_LIMIT_SHORT_SHIFT | RetryLimit << RETRY_LIMIT_LONG_SHIFT); #endif - + for(i=0;i<1000;i++) { if(rtw_read32(Adapter, 0x200) != rtw_read32(Adapter, 0x204)) @@ -4413,7 +4413,7 @@ _func_enter_; } } #if 0 //for Miracast source PKT lost issue - RetryLimit = 0x30; + RetryLimit = 0x30; rtw_write16(Adapter, REG_RL, RetryLimit << RETRY_LIMIT_SHORT_SHIFT | RetryLimit << RETRY_LIMIT_LONG_SHIFT); #endif } @@ -4527,18 +4527,18 @@ _func_enter_; rtw_write8(Adapter, REG_TX_RPT_CTRL+1, maxMacid+1); } break; - #endif + #endif case HW_VAR_H2C_MEDIA_STATUS_RPT: - { + { rtl8188e_set_FwMediaStatus_cmd(Adapter , (*(u16 *)val)); } break; case HW_VAR_BCN_VALID: //BCN_VALID, BIT16 of REG_TDECTRL = BIT0 of REG_TDECTRL+2, write 1 to clear, Clear by sw - rtw_write8(Adapter, REG_TDECTRL+2, rtw_read8(Adapter, REG_TDECTRL+2) | BIT0); + rtw_write8(Adapter, REG_TDECTRL+2, rtw_read8(Adapter, REG_TDECTRL+2) | BIT0); break; default: - + break; } @@ -4548,7 +4548,7 @@ _func_exit_; void GetHwReg8188EU(struct adapter *Adapter, u8 variable, u8* val) { HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); - DM_ODM_T *podmpriv = &pHalData->odmpriv; + DM_ODM_T *podmpriv = &pHalData->odmpriv; _func_enter_; switch(variable) @@ -4595,7 +4595,7 @@ _func_enter_; break; #endif case HW_VAR_EFUSE_BYTES: // To get EFUE total used bytes, added by Roger, 2008.12.22. - *((u16 *)(val)) = pHalData->EfuseUsedBytes; + *((u16 *)(val)) = pHalData->EfuseUsedBytes; break; case HW_VAR_APFM_ON_MAC: *val = pHalData->bMacPwrCtrlOn; @@ -4622,7 +4622,7 @@ _func_enter_; case HW_VAR_C2HEVT_MSG_NORMAL: *val = rtw_read8(Adapter, REG_C2HEVT_MSG_NORMAL); break; - + default: break; } @@ -4631,7 +4631,7 @@ _func_exit_; } // -// Description: +// Description: // Query setting of specified variable. // u8 @@ -4643,9 +4643,9 @@ GetHalDefVar8188EUsb( { HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); struct dm_priv *pdmpriv = &pHalData->dmpriv; - DM_ODM_T *podmpriv = &pHalData->odmpriv; + DM_ODM_T *podmpriv = &pHalData->odmpriv; u8 bResult = _SUCCESS; - + switch(eVariable) { case HAL_DEF_UNDERCORATEDSMOOTHEDPWDB: @@ -4657,7 +4657,7 @@ GetHalDefVar8188EUsb( psta = rtw_get_stainfo(pstapriv, pmlmepriv->cur_network.network.MacAddress); if(psta) { - *((int *)pValue) = psta->rssi_stat.UndecoratedSmoothedPWDB; + *((int *)pValue) = psta->rssi_stat.UndecoratedSmoothedPWDB; } } #else //V4 branch @@ -4665,7 +4665,7 @@ GetHalDefVar8188EUsb( *((int *)pValue) = pHalData->dmpriv.UndecoratedSmoothedPWDB; } else{ - + } #endif break; @@ -4673,10 +4673,10 @@ GetHalDefVar8188EUsb( #ifdef CONFIG_ANTENNA_DIVERSITY *((u8 *)pValue) = (pHalData->AntDivCfg==0)?_FALSE:_TRUE; #endif - break; + break; case HAL_DEF_CURRENT_ANTENNA: #ifdef CONFIG_ANTENNA_DIVERSITY - *(( u8*)pValue) = pHalData->CurAntenna; + *(( u8*)pValue) = pHalData->CurAntenna; #endif break; case HAL_DEF_DRVINFO_SZ: @@ -4701,10 +4701,10 @@ GetHalDefVar8188EUsb( u8 MacID = *((u8*)pValue); *((u8*)pValue) = ODM_RA_GetShortGI_8188E(podmpriv, MacID); } - break; + break; #endif - + case HAL_DEF_PT_PWR_STATUS: #if(POWER_TRAINING_ACTIVE==1) { @@ -4712,18 +4712,18 @@ GetHalDefVar8188EUsb( *((u8*)pValue) = ODM_RA_GetHwPwrStatus_8188E(podmpriv, MacID); } #endif//(POWER_TRAINING_ACTIVE==1) - break; + break; case HW_VAR_MAX_RX_AMPDU_FACTOR: *(( u32*)pValue) = MAX_AMPDU_FACTOR_64K; break; - + case HW_DEF_RA_INFO_DUMP: -#if (RATE_ADAPTIVE_SUPPORT == 1) +#if (RATE_ADAPTIVE_SUPPORT == 1) { u8 entry_id = *((u8*)pValue); u8 i; - u8 bLinked = _FALSE; + u8 bLinked = _FALSE; #ifdef CONFIG_CONCURRENT_MODE struct adapter *pbuddy_adapter = Adapter->pbuddy_adapter; #endif //CONFIG_CONCURRENT_MODE @@ -4732,13 +4732,13 @@ GetHalDefVar8188EUsb( if(rtw_linked_check(Adapter)) bLinked = _TRUE; - + #ifdef CONFIG_CONCURRENT_MODE if(pbuddy_adapter && rtw_linked_check(pbuddy_adapter)) bLinked = _TRUE; -#endif - - if(bLinked){ +#endif + + if(bLinked){ DBG_871X("============ RA status check ===================\n"); if(Adapter->bRxRSSIDisplay >30) Adapter->bRxRSSIDisplay = 1; @@ -4790,7 +4790,7 @@ SetHalDefVar8188EUsb( { HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); struct dm_priv *pdmpriv = &pHalData->dmpriv; - DM_ODM_T *podmpriv = &pHalData->odmpriv; + DM_ODM_T *podmpriv = &pHalData->odmpriv; u8 bResult = _SUCCESS; switch(eVariable) @@ -4798,7 +4798,7 @@ SetHalDefVar8188EUsb( case HAL_DEF_DBG_DM_FUNC: { u8 dm_func = *(( u8*)pValue); - + if(dm_func == 0){ //disable all dynamic func podmpriv->SupportAbility = DYNAMIC_FUNC_DISABLE; DBG_8192C("==> Disable all dynamic function...\n"); @@ -4819,17 +4819,17 @@ SetHalDefVar8188EUsb( //} else if(dm_func == 5){//disable antenna diversity podmpriv->SupportAbility &= (~DYNAMIC_BB_ANT_DIV); - } + } else if(dm_func == 6){//turn on all dynamic func if(!(podmpriv->SupportAbility & DYNAMIC_BB_DIG)) - { + { DIG_T *pDigTable = &podmpriv->DM_DigTable; - pDigTable->CurIGValue= rtw_read8(Adapter,0xc50); + pDigTable->CurIGValue= rtw_read8(Adapter,0xc50); } //pdmpriv->DMFlag |= DYNAMIC_FUNC_BT; podmpriv->SupportAbility = DYNAMIC_ALL_FUNC_ENABLE; DBG_8192C("==> Turn on all dynamic function...\n"); - } + } } break; case HAL_DEF_DBG_DUMP_RXPKT: @@ -4869,7 +4869,7 @@ u32 _update_92cu_basic_rate(struct adapter *padapter, unsigned int mask) // BrateCfg = mask & 0x159; } - BrateCfg |= 0x01; // default enable 1M ACK rate + BrateCfg |= 0x01; // default enable 1M ACK rate return BrateCfg; } @@ -4894,7 +4894,7 @@ void UpdateHalRAMask8188EUsb(struct adapter *padapter, u32 mac_id, u8 rssi_level { //volatile unsigned int result; u8 init_rate=0; - u8 networkType, raid; + u8 networkType, raid; u32 mask,rate_bitmap; u8 shortGIrate = _FALSE; int supportRateNum = 0; @@ -4903,7 +4903,7 @@ void UpdateHalRAMask8188EUsb(struct adapter *padapter, u32 mac_id, u8 rssi_level //struct dm_priv *pdmpriv = &pHalData->dmpriv; struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); - WLAN_BSSID_EX *cur_network = &(pmlmeinfo->network); + WLAN_BSSID_EX *cur_network = &(pmlmeinfo->network); if (mac_id >= NUM_STA) //CAM_SIZE { @@ -4926,16 +4926,16 @@ void UpdateHalRAMask8188EUsb(struct adapter *padapter, u32 mac_id, u8 rssi_level networkType = judge_network_type(padapter, cur_network->SupportedRates, supportRateNum) & 0xf; //pmlmeext->cur_wireless_mode = networkType; raid = networktype_to_raid(networkType); - + mask = update_supported_rate(cur_network->SupportedRates, supportRateNum); mask |= (pmlmeinfo->HT_enable)? update_MSC_rate(&(pmlmeinfo->HT_caps)): 0; - - + + if (support_short_GI(padapter, &(pmlmeinfo->HT_caps))) { shortGIrate = _TRUE; } - + break; case 1://for broadcast/multicast @@ -4954,37 +4954,37 @@ void UpdateHalRAMask8188EUsb(struct adapter *padapter, u32 mac_id, u8 rssi_level supportRateNum = rtw_get_rateset_len(pmlmeinfo->FW_sta_info[mac_id].SupportedRates); networkType = judge_network_type(padapter, pmlmeinfo->FW_sta_info[mac_id].SupportedRates, supportRateNum) & 0xf; //pmlmeext->cur_wireless_mode = networkType; - raid = networktype_to_raid(networkType); + raid = networktype_to_raid(networkType); mask = update_supported_rate(cur_network->SupportedRates, supportRateNum); - + //todo: support HT in IBSS - + break; } - + //mask &=0x0fffffff; - rate_bitmap = 0x0fffffff; + rate_bitmap = 0x0fffffff; #ifdef CONFIG_ODM_REFRESH_RAMASK - { + { rate_bitmap = ODM_Get_Rate_Bitmap(&pHalData->odmpriv,mac_id,mask,rssi_level); printk("%s => mac_id:%d, networkType:0x%02x, mask:0x%08x\n\t ==> rssi_level:%d, rate_bitmap:0x%08x\n", __FUNCTION__,mac_id,networkType,mask,rssi_level,rate_bitmap); } #endif - - mask &= rate_bitmap; - + + mask &= rate_bitmap; + init_rate = get_highest_rate_idx(mask)&0x3f; - + if(pHalData->fw_ractrl == _TRUE) { u8 arg = 0; //arg = (cam_idx-4)&0x1f;//MACID arg = mac_id&0x1f;//MACID - + arg |= BIT(7); - + if (shortGIrate==_TRUE) arg |= BIT(5); mask |= ((raid<<28)&0xf0000000); @@ -5000,28 +5000,28 @@ void UpdateHalRAMask8188EUsb(struct adapter *padapter, u32 mac_id, u8 rssi_level #endif //CONFIG_INTEL_PROXIM mask |= ((raid<<28)&0xf0000000); - //to do + //to do /* *(pu4Byte)&RateMask=EF4Byte((ratr_bitmap&0x0fffffff) | (ratr_index<<28)); RateMask[4] = macId | (bShortGI?0x20:0x00) | 0x80; - */ - rtl8188e_set_raid_cmd(padapter, mask); - + */ + rtl8188e_set_raid_cmd(padapter, mask); + } else - { + { -#if(RATE_ADAPTIVE_SUPPORT == 1) +#if(RATE_ADAPTIVE_SUPPORT == 1) ODM_RA_UpdateRateInfo_8188E( &(pHalData->odmpriv), mac_id, - raid, + raid, mask, shortGIrate ); -#endif +#endif } @@ -5039,25 +5039,25 @@ void SetBeaconRelatedRegisters8188EUsb(struct adapter *padapter) //HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter); struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); - u32 bcn_ctrl_reg = REG_BCN_CTRL; - //reset TSF, enable update TSF, correcting TSF On Beacon - + u32 bcn_ctrl_reg = REG_BCN_CTRL; + //reset TSF, enable update TSF, correcting TSF On Beacon + //REG_BCN_INTERVAL //REG_BCNDMATIM //REG_ATIMWND //REG_TBTT_PROHIBIT //REG_DRVERLYINT - //REG_BCN_MAX_ERR + //REG_BCN_MAX_ERR //REG_BCNTCFG //(0x510) //REG_DUAL_TSF_RST - //REG_BCN_CTRL //(0x550) + //REG_BCN_CTRL //(0x550) //BCN interval #ifdef CONFIG_CONCURRENT_MODE - if (padapter->iface_type == IFACE_PORT1){ + if (padapter->iface_type == IFACE_PORT1){ bcn_ctrl_reg = REG_BCN_CTRL_1; - } -#endif + } +#endif rtw_write16(padapter, REG_BCN_INTERVAL, pmlmeinfo->bcn_interval); rtw_write8(padapter, REG_ATIMWND, 0x02);// 2ms @@ -5065,12 +5065,12 @@ void SetBeaconRelatedRegisters8188EUsb(struct adapter *padapter) rtw_write8(padapter, REG_SLOT, 0x09); - value32 =rtw_read32(padapter, REG_TCR); + value32 =rtw_read32(padapter, REG_TCR); value32 &= ~TSFRST; - rtw_write32(padapter, REG_TCR, value32); + rtw_write32(padapter, REG_TCR, value32); value32 |= TSFRST; - rtw_write32(padapter, REG_TCR, value32); + rtw_write32(padapter, REG_TCR, value32); // NOTE: Fix test chip's bug (about contention windows's randomness) rtw_write8(padapter, REG_RXTSF_OFFSET_CCK, 0x50); @@ -5081,7 +5081,7 @@ void SetBeaconRelatedRegisters8188EUsb(struct adapter *padapter) ResumeTxBeacon(padapter); //rtw_write8(padapter, 0x422, rtw_read8(padapter, 0x422)|BIT(6)); - + //rtw_write8(padapter, 0x541, 0xff); //rtw_write8(padapter, 0x542, rtw_read8(padapter, 0x541)|BIT(0)); @@ -5103,9 +5103,9 @@ static void rtl8188eu_init_default_value(struct adapter * padapter) //init default value - pHalData->fw_ractrl = _FALSE; + pHalData->fw_ractrl = _FALSE; if(!pwrctrlpriv->bkeepfwalive) - pHalData->LastHMEBoxNum = 0; + pHalData->LastHMEBoxNum = 0; //init dm default value pHalData->odmpriv.RFCalibrateInfo.bIQKInitialized = _FALSE; @@ -5121,7 +5121,7 @@ static void rtl8188eu_init_default_value(struct adapter * padapter) } static u8 rtl8188eu_ps_func(struct adapter *Adapter,HAL_INTF_PS_FUNC efunc_id, u8 *val) -{ +{ u8 bResult = _TRUE; switch(efunc_id){ @@ -5161,7 +5161,7 @@ _func_enter_; pHalFunc->hal_power_on = InitPowerOn_rtl8188eu; pHalFunc->hal_power_off = hal_poweroff_rtl8188eu; - + pHalFunc->hal_init = &rtl8188eu_hal_init; pHalFunc->hal_deinit = &rtl8188eu_hal_deinit; @@ -5180,9 +5180,9 @@ _func_enter_; pHalFunc->DeInitSwLeds = &rtl8188eu_DeInitSwLeds; #else //case of hw led or no led pHalFunc->InitSwLeds = NULL; - pHalFunc->DeInitSwLeds = NULL; + pHalFunc->DeInitSwLeds = NULL; #endif//CONFIG_SW_LED - + pHalFunc->init_default_value = &rtl8188eu_init_default_value; pHalFunc->intf_chip_configure = &rtl8188eu_interface_configure; pHalFunc->read_adapter_info = &ReadAdapterInfo8188EU; @@ -5195,8 +5195,8 @@ _func_enter_; pHalFunc->SetHwRegHandler = &SetHwReg8188EU; pHalFunc->GetHwRegHandler = &GetHwReg8188EU; - pHalFunc->GetHalDefVarHandler = &GetHalDefVar8188EUsb; - pHalFunc->SetHalDefVarHandler = &SetHalDefVar8188EUsb; + pHalFunc->GetHalDefVarHandler = &GetHalDefVar8188EUsb; + pHalFunc->SetHalDefVarHandler = &SetHalDefVar8188EUsb; pHalFunc->UpdateRAMaskHandler = &UpdateHalRAMask8188EUsb; pHalFunc->SetBeaconRelatedRegistersHandler = &SetBeaconRelatedRegisters8188EUsb; @@ -5217,4 +5217,3 @@ _func_enter_; _func_exit_; } - diff --git a/hal/usb_ops_linux.c b/hal/usb_ops_linux.c index d917eef..e266e61 100755 --- a/hal/usb_ops_linux.c +++ b/hal/usb_ops_linux.c @@ -1,7 +1,7 @@ /****************************************************************************** * * 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. @@ -60,21 +60,21 @@ static int usbctrl_vendorreq(struct intf_hdl *pintfhdl, u8 request, u16 value, u if((padapter->bSurpriseRemoved) ||(dvobj_to_pwrctl(pdvobjpriv)->pnp_bstop_trx)){ RT_TRACE(_module_hci_ops_os_c_,_drv_err_,("usbctrl_vendorreq:(padapter->bSurpriseRemoved ||pwrctl->pnp_bstop_trx)!!!\n")); - status = -EPERM; + status = -EPERM; goto exit; - } + } if(len>MAX_VENDOR_REQ_CMD_SIZE){ DBG_8192C( "[%s] Buffer len error ,vendor request failed\n", __FUNCTION__ ); status = -EINVAL; goto exit; - } + } #ifdef CONFIG_USB_VENDOR_REQ_MUTEX _enter_critical_mutex(&pdvobjpriv->usb_vendor_req_mutex, NULL); #endif - - + + // Acquire IO memory for vendorreq #ifdef CONFIG_USB_VENDOR_REQ_BUFFER_PREALLOC pIo_buf = pdvobjpriv->usb_vendor_req_buf; @@ -89,7 +89,7 @@ static int usbctrl_vendorreq(struct intf_hdl *pintfhdl, u8 request, u16 value, u // Added by Albert 2010/02/09 // For mstar platform, mstar suggests the address for USB IO should be 16 bytes alignment. // Trying to fix it here. - pIo_buf = (tmp_buf==NULL)?NULL:tmp_buf + ALIGNMENT_UNIT -((SIZE_PTR)(tmp_buf) & 0x0f ); + pIo_buf = (tmp_buf==NULL)?NULL:tmp_buf + ALIGNMENT_UNIT -((SIZE_PTR)(tmp_buf) & 0x0f ); #endif if ( pIo_buf== NULL) { @@ -97,23 +97,23 @@ static int usbctrl_vendorreq(struct intf_hdl *pintfhdl, u8 request, u16 value, u status = -ENOMEM; goto release_mutex; } - + while(++vendorreq_times<= MAX_USBCTRL_VENDORREQ_TIMES) { _rtw_memset(pIo_buf, 0, len); - + if (requesttype == 0x01) { pipe = usb_rcvctrlpipe(udev, 0);//read_in - reqtype = REALTEK_USB_VENQT_READ; - } - else + reqtype = REALTEK_USB_VENQT_READ; + } + else { pipe = usb_sndctrlpipe(udev, 0);//write_out - reqtype = REALTEK_USB_VENQT_WRITE; + reqtype = REALTEK_USB_VENQT_WRITE; _rtw_memcpy( pIo_buf, pdata, len); - } - + } + #if 0 //timeout test for firmware downloading status = rtw_usb_control_msg(udev, pipe, request, reqtype, value, index, pIo_buf, len @@ -122,7 +122,7 @@ static int usbctrl_vendorreq(struct intf_hdl *pintfhdl, u8 request, u16 value, u #else status = rtw_usb_control_msg(udev, pipe, request, reqtype, value, index, pIo_buf, len, RTW_USB_CONTROL_MSG_TIMEOUT); #endif - + if ( status == len) // Success this control transfer. { rtw_reset_continual_io_error(pdvobjpriv); @@ -134,10 +134,10 @@ static int usbctrl_vendorreq(struct intf_hdl *pintfhdl, u8 request, u16 value, u else { // error cases DBG_8192C("reg 0x%x, usb %s %u fail, status:%d value=0x%x, vendorreq_times:%d\n" , value,(requesttype == 0x01)?"read":"write" , len, status, *(u32*)pdata, vendorreq_times); - + if (status < 0) { if(status == (-ESHUTDOWN) || status == -ENODEV ) - { + { padapter->bSurpriseRemoved = _TRUE; } else { #ifdef DBG_CONFIG_ERROR_DETECT @@ -162,15 +162,15 @@ static int usbctrl_vendorreq(struct intf_hdl *pintfhdl, u8 request, u16 value, u padapter->bSurpriseRemoved = _TRUE; break; } - + } - + // firmware download is checksumed, don't retry if( (value >= FW_8188E_START_ADDRESS && value <= FW_8188E_END_ADDRESS) || status == len ) break; - + } - + // release IO memory used by vendorreq #ifdef CONFIG_USB_VENDOR_REQ_BUFFER_DYNAMIC_ALLOCATE rtw_mfree(tmp_buf, tmp_buflen); @@ -193,7 +193,7 @@ static u8 usb_read8(struct intf_hdl *pintfhdl, u32 addr) u16 index; u16 len; u8 data=0; - + _func_enter_; request = 0x05; @@ -201,25 +201,25 @@ static u8 usb_read8(struct intf_hdl *pintfhdl, u32 addr) index = 0;//n/a wvalue = (u16)(addr&0x0000ffff); - len = 1; - + len = 1; + usbctrl_vendorreq(pintfhdl, request, wvalue, index, &data, len, requesttype); _func_exit_; return data; - + } static u16 usb_read16(struct intf_hdl *pintfhdl, u32 addr) -{ +{ u8 request; u8 requesttype; u16 wvalue; u16 index; u16 len; u16 data=0; - + _func_enter_; request = 0x05; @@ -227,14 +227,14 @@ static u16 usb_read16(struct intf_hdl *pintfhdl, u32 addr) index = 0;//n/a wvalue = (u16)(addr&0x0000ffff); - len = 2; - + len = 2; + usbctrl_vendorreq(pintfhdl, request, wvalue, index, &data, len, requesttype); _func_exit_; return data; - + } static u32 usb_read32(struct intf_hdl *pintfhdl, u32 addr) @@ -245,7 +245,7 @@ static u32 usb_read32(struct intf_hdl *pintfhdl, u32 addr) u16 index; u16 len; u32 data=0; - + _func_enter_; request = 0x05; @@ -253,14 +253,14 @@ static u32 usb_read32(struct intf_hdl *pintfhdl, u32 addr) index = 0;//n/a wvalue = (u16)(addr&0x0000ffff); - len = 4; - + len = 4; + usbctrl_vendorreq(pintfhdl, request, wvalue, index, &data, len, requesttype); _func_exit_; return data; - + } static int usb_write8(struct intf_hdl *pintfhdl, u32 addr, u8 val) @@ -272,7 +272,7 @@ static int usb_write8(struct intf_hdl *pintfhdl, u32 addr, u8 val) u16 len; u8 data; int ret; - + _func_enter_; request = 0x05; @@ -281,19 +281,19 @@ static int usb_write8(struct intf_hdl *pintfhdl, u32 addr, u8 val) wvalue = (u16)(addr&0x0000ffff); len = 1; - - data = val; - + + data = val; + ret = usbctrl_vendorreq(pintfhdl, request, wvalue, index, &data, len, requesttype); - + _func_exit_; - + return ret; - + } static int usb_write16(struct intf_hdl *pintfhdl, u32 addr, u16 val) -{ +{ u8 request; u8 requesttype; u16 wvalue; @@ -301,7 +301,7 @@ static int usb_write16(struct intf_hdl *pintfhdl, u32 addr, u16 val) u16 len; u16 data; int ret; - + _func_enter_; request = 0x05; @@ -310,15 +310,15 @@ static int usb_write16(struct intf_hdl *pintfhdl, u32 addr, u16 val) wvalue = (u16)(addr&0x0000ffff); len = 2; - + data = val; - + ret = usbctrl_vendorreq(pintfhdl, request, wvalue, index, &data, len, requesttype); - + _func_exit_; - + return ret; - + } static int usb_write32(struct intf_hdl *pintfhdl, u32 addr, u32 val) @@ -330,7 +330,7 @@ static int usb_write32(struct intf_hdl *pintfhdl, u32 addr, u32 val) u16 len; u32 data; int ret; - + _func_enter_; request = 0x05; @@ -339,14 +339,14 @@ static int usb_write32(struct intf_hdl *pintfhdl, u32 addr, u32 val) wvalue = (u16)(addr&0x0000ffff); len = 4; - data =val; + data =val; ret =usbctrl_vendorreq(pintfhdl, request, wvalue, index, &data, len, requesttype); - + _func_exit_; - + return ret; - + } static int usb_writeN(struct intf_hdl *pintfhdl, u32 addr, u32 length, u8 *pdata) @@ -358,7 +358,7 @@ static int usb_writeN(struct intf_hdl *pintfhdl, u32 addr, u32 length, u8 *pdata u16 len; u8 buf[VENDOR_CMD_MAX_DATA_LEN]={0}; int ret; - + _func_enter_; request = 0x05; @@ -368,28 +368,28 @@ static int usb_writeN(struct intf_hdl *pintfhdl, u32 addr, u32 length, u8 *pdata wvalue = (u16)(addr&0x0000ffff); len = length; _rtw_memcpy(buf, pdata, len ); - + ret = usbctrl_vendorreq(pintfhdl, request, wvalue, index, buf, len, requesttype); - + _func_exit_; - + return ret; - + } #ifdef CONFIG_SUPPORT_USB_INT void interrupt_handler_8188eu(struct adapter *padapter,u16 pkt_len,u8 *pbuf) -{ +{ HAL_DATA_TYPE *pHalData=GET_HAL_DATA(padapter); struct reportpwrstate_parm pwr_rpt; - + if ( pkt_len != INTERRUPT_MSG_FORMAT_LEN ) { DBG_8192C("%s Invalid interrupt content length (%d)!\n", __FUNCTION__, pkt_len); return ; } - // HISR + // HISR _rtw_memcpy(&(pHalData->IntArray[0]), &(pbuf[USB_INTR_CONTENT_HISR_OFFSET]), 4); _rtw_memcpy(&(pHalData->IntArray[1]), &(pbuf[USB_INTR_CONTENT_HISRE_OFFSET]), 4); @@ -397,11 +397,11 @@ void interrupt_handler_8188eu(struct adapter *padapter,u16 pkt_len,u8 *pbuf) { u32 hisr=0 ,hisr_ex=0; _rtw_memcpy(&hisr,&(pHalData->IntArray[0]),4); - hisr = le32_to_cpu(hisr); - + hisr = le32_to_cpu(hisr); + _rtw_memcpy(&hisr_ex,&(pHalData->IntArray[1]),4); hisr_ex = le32_to_cpu(hisr_ex); - + if((hisr != 0) || (hisr_ex!=0)) DBG_871X("===> %s hisr:0x%08x ,hisr_ex:0x%08x \n",__FUNCTION__,hisr,hisr_ex); } @@ -414,8 +414,8 @@ void interrupt_handler_8188eu(struct adapter *padapter,u16 pkt_len,u8 *pbuf) _rtw_memcpy(&pwr_rpt.state, &(pbuf[USB_INTR_CONTENT_CPWM1_OFFSET]), 1); //_rtw_memcpy(&pwr_rpt.state2, &(pbuf[USB_INTR_CONTENT_CPWM2_OFFSET]), 1); - //88e's cpwm value only change BIT0, so driver need to add PS_STATE_S2 for LPS flow. - pwr_rpt.state |= PS_STATE_S2; + //88e's cpwm value only change BIT0, so driver need to add PS_STATE_S2 for LPS flow. + pwr_rpt.state |= PS_STATE_S2; _set_workitem(&(adapter_to_pwrctl(padapter)->cpwm_event)); } #endif//CONFIG_LPS_LCLK @@ -427,8 +427,8 @@ void interrupt_handler_8188eu(struct adapter *padapter,u16 pkt_len,u8 *pbuf) #endif #ifdef CONFIG_INTERRUPT_BASED_TXBCN_BCN_OK_ERR if (pHalData->IntArray[0] & (IMR_TBDER_88E|IMR_TBDOK_88E)) - #endif - { + #endif + { struct mlme_priv *pmlmepriv = &padapter->mlmepriv; #if 0 if(pHalData->IntArray[0] & IMR_BCNDMAINT0_88E) @@ -438,7 +438,7 @@ void interrupt_handler_8188eu(struct adapter *padapter,u16 pkt_len,u8 *pbuf) if(pHalData->IntArray[0] & IMR_TBDER_88E) DBG_8192C("%s: HISR_TXBCNERR\n", __func__); #endif - + if(check_fwstate(pmlmepriv, WIFI_AP_STATE)) { @@ -460,7 +460,7 @@ void interrupt_handler_8188eu(struct adapter *padapter,u16 pkt_len,u8 *pbuf) } } #endif - + } #endif //CONFIG_INTERRUPT_BASED_TXBCN @@ -475,19 +475,19 @@ void interrupt_handler_8188eu(struct adapter *padapter,u16 pkt_len,u8 *pbuf) if( pHalData->IntArray[1] & IMR_TXFOVW_88E ) DBG_871X("===> %s Transmit FIFO Overflow \n",__FUNCTION__); if( pHalData->IntArray[1] & IMR_RXFOVW_88E ) - DBG_871X("===> %s Receive FIFO Overflow \n",__FUNCTION__); + DBG_871X("===> %s Receive FIFO Overflow \n",__FUNCTION__); #endif//DBG_CONFIG_ERROR_DETECT_INT - // C2H Event + // C2H Event if(pbuf[0]!= 0){ - _rtw_memcpy(&(pHalData->C2hArray[0]), &(pbuf[USB_INTR_CONTENT_C2H_OFFSET]), 16); + _rtw_memcpy(&(pHalData->C2hArray[0]), &(pbuf[USB_INTR_CONTENT_C2H_OFFSET]), 16); //rtw_c2h_wk_cmd(padapter); to do.. - } - + } + } #endif - + #ifdef CONFIG_USB_INTERRUPT_IN_PIPE static void usb_read_interrupt_complete(struct urb *purb, struct pt_regs *regs) { @@ -496,21 +496,21 @@ static void usb_read_interrupt_complete(struct urb *purb, struct pt_regs *regs) if(padapter->bSurpriseRemoved || padapter->bDriverStopped||padapter->bReadPortCancel) { - DBG_8192C("%s() RX Warning! bDriverStopped(%d) OR bSurpriseRemoved(%d) bReadPortCancel(%d)\n", + DBG_8192C("%s() RX Warning! bDriverStopped(%d) OR bSurpriseRemoved(%d) bReadPortCancel(%d)\n", __FUNCTION__,padapter->bDriverStopped, padapter->bSurpriseRemoved,padapter->bReadPortCancel); return; } - + if(purb->status==0)//SUCCESS { if (purb->actual_length > INTERRUPT_MSG_FORMAT_LEN) { - DBG_8192C("usb_read_interrupt_complete: purb->actual_length > INTERRUPT_MSG_FORMAT_LEN(%d)\n",INTERRUPT_MSG_FORMAT_LEN); + DBG_8192C("usb_read_interrupt_complete: purb->actual_length > INTERRUPT_MSG_FORMAT_LEN(%d)\n",INTERRUPT_MSG_FORMAT_LEN); } interrupt_handler_8188eu(padapter, purb->actual_length,purb->transfer_buffer ); - + err = usb_submit_urb(purb, GFP_ATOMIC); if((err) && (err != (-EPERM))) { @@ -523,13 +523,13 @@ static void usb_read_interrupt_complete(struct urb *purb, struct pt_regs *regs) switch(purb->status) { case -EINVAL: - case -EPIPE: + case -EPIPE: case -ENODEV: case -ESHUTDOWN: //padapter->bSurpriseRemoved=_TRUE; RT_TRACE(_module_hci_ops_os_c_,_drv_err_,("usb_read_port_complete:bSurpriseRemoved=TRUE\n")); case -ENOENT: - padapter->bDriverStopped=_TRUE; + padapter->bDriverStopped=_TRUE; RT_TRACE(_module_hci_ops_os_c_,_drv_err_,("usb_read_port_complete:bDriverStopped=TRUE\n")); break; case -EPROTO: @@ -538,9 +538,9 @@ static void usb_read_interrupt_complete(struct urb *purb, struct pt_regs *regs) DBG_8192C("ERROR: URB IS IN PROGRESS!/n"); break; default: - break; + break; } - } + } } @@ -559,12 +559,12 @@ _func_enter_; //translate DMA FIFO addr to pipehandle pipe = ffaddr2pipehdl(pdvobj, addr); - usb_fill_int_urb(precvpriv->int_in_urb, pusbd, pipe, + usb_fill_int_urb(precvpriv->int_in_urb, pusbd, pipe, precvpriv->int_in_buf, - INTERRUPT_MSG_FORMAT_LEN, - usb_read_interrupt_complete, - adapter, - 1); + INTERRUPT_MSG_FORMAT_LEN, + usb_read_interrupt_complete, + adapter, + 1); err = usb_submit_urb(precvpriv->int_in_urb, GFP_ATOMIC); if((err) && (err != (-EPERM))) @@ -580,9 +580,9 @@ _func_exit_; #endif static s32 pre_recv_entry(union recv_frame *precvframe, struct recv_stat *prxstat, struct phy_stat *pphy_status) -{ +{ s32 ret=_SUCCESS; -#ifdef CONFIG_CONCURRENT_MODE +#ifdef CONFIG_CONCURRENT_MODE u8 *primary_myid, *secondary_myid, *paddr1; union recv_frame *precvframe_if2 = NULL; struct adapter *primary_padapter = precvframe->u.hdr.adapter; @@ -590,11 +590,11 @@ static s32 pre_recv_entry(union recv_frame *precvframe, struct recv_stat *prxsta struct recv_priv *precvpriv = &primary_padapter->recvpriv; _queue *pfree_recv_queue = &precvpriv->free_recv_queue; u8 *pbuf = precvframe->u.hdr.rx_data; - + if(!secondary_padapter) return ret; - - paddr1 = GetAddr1Ptr(precvframe->u.hdr.rx_data); + + paddr1 = GetAddr1Ptr(precvframe->u.hdr.rx_data); if(IS_MCAST(paddr1) == _FALSE)//unicast packets { @@ -602,31 +602,31 @@ static s32 pre_recv_entry(union recv_frame *precvframe, struct recv_stat *prxsta secondary_myid = myid(&secondary_padapter->eeprompriv); if(_rtw_memcmp(paddr1, secondary_myid, ETH_ALEN)) - { + { //change to secondary interface precvframe->u.hdr.adapter = secondary_padapter; - } + } //ret = recv_entry(precvframe); } - else // Handle BC/MC Packets + else // Handle BC/MC Packets { - + u8 clone = _TRUE; -#if 0 +#if 0 u8 type, subtype, *paddr2, *paddr3; - + type = GetFrameType(pbuf); subtype = GetFrameSubType(pbuf); //bit(7)~bit(2) - + switch (type) { case WIFI_MGT_TYPE: //Handle BC/MC mgnt Packets if(subtype == WIFI_BEACON) { paddr3 = GetAddr3Ptr(precvframe->u.hdr.rx_data); - + if (check_fwstate(&secondary_padapter->mlmepriv, _FW_LINKED) && _rtw_memcmp(paddr3, get_bssid(&secondary_padapter->mlmepriv), ETH_ALEN)) { @@ -640,23 +640,23 @@ static s32 pre_recv_entry(union recv_frame *precvframe, struct recv_stat *prxsta { if(clone==_FALSE) { - clone = _TRUE; - } + clone = _TRUE; + } else { clone = _FALSE; } - precvframe->u.hdr.adapter = primary_padapter; + precvframe->u.hdr.adapter = primary_padapter; } if(check_fwstate(&primary_padapter->mlmepriv, _FW_UNDER_SURVEY|_FW_UNDER_LINKING) || check_fwstate(&secondary_padapter->mlmepriv, _FW_UNDER_SURVEY|_FW_UNDER_LINKING)) { clone = _TRUE; - precvframe->u.hdr.adapter = primary_padapter; + precvframe->u.hdr.adapter = primary_padapter; } - + } else if(subtype == WIFI_PROBEREQ) { @@ -664,14 +664,14 @@ static s32 pre_recv_entry(union recv_frame *precvframe, struct recv_stat *prxsta //change to secondary interface precvframe->u.hdr.adapter = secondary_padapter; clone = _FALSE; - } + } break; case WIFI_CTRL_TYPE: // Handle BC/MC ctrl Packets - + break; case WIFI_DATA_TYPE: //Handle BC/MC data Packets //Notes: AP MODE never rx BC/MC data packets - + paddr2 = GetAddr2Ptr(precvframe->u.hdr.rx_data); if(_rtw_memcmp(paddr2, get_bssid(&secondary_padapter->mlmepriv), ETH_ALEN)) @@ -683,8 +683,8 @@ static s32 pre_recv_entry(union recv_frame *precvframe, struct recv_stat *prxsta break; default: - - break; + + break; } #endif @@ -692,16 +692,16 @@ static s32 pre_recv_entry(union recv_frame *precvframe, struct recv_stat *prxsta { //clone/copy to if2 u8 shift_sz = 0; - u32 alloc_sz, skb_len; + u32 alloc_sz, skb_len; _pkt *pkt_copy = NULL; struct rx_pkt_attrib *pattrib = NULL; - + precvframe_if2 = rtw_alloc_recvframe(pfree_recv_queue); if(precvframe_if2) { precvframe_if2->u.hdr.adapter = secondary_padapter; - - _rtw_init_listhead(&precvframe_if2->u.hdr.list); + + _rtw_init_listhead(&precvframe_if2->u.hdr.list); precvframe_if2->u.hdr.precvbuf = NULL; //can't access the precvbuf for new arch. precvframe_if2->u.hdr.len=0; @@ -750,26 +750,26 @@ static s32 pre_recv_entry(union recv_frame *precvframe, struct recv_stat *prxsta skb_reserve( pkt_copy, shift_sz );//force ip_hdr at 8-byte alignment address according to shift_sz. _rtw_memcpy(pkt_copy->data, pbuf, skb_len); precvframe_if2->u.hdr.rx_data = precvframe_if2->u.hdr.rx_tail = pkt_copy->data; - - - recvframe_put(precvframe_if2, skb_len); - if (pattrib->physt) - update_recvframe_phyinfo_88e(precvframe_if2, (struct phy_stat*)pphy_status); - ret = rtw_recv_entry(precvframe_if2); - } + + recvframe_put(precvframe_if2, skb_len); + if (pattrib->physt) + update_recvframe_phyinfo_88e(precvframe_if2, (struct phy_stat*)pphy_status); + ret = rtw_recv_entry(precvframe_if2); + + } else { rtw_free_recvframe(precvframe_if2, pfree_recv_queue); - DBG_8192C("%s()-%d: alloc_skb() failed!\n", __FUNCTION__, __LINE__); + DBG_8192C("%s()-%d: alloc_skb() failed!\n", __FUNCTION__, __LINE__); } } - + } - + } if (precvframe->u.hdr.attrib.physt) - update_recvframe_phyinfo_88e(precvframe, (struct phy_stat*)pphy_status); + update_recvframe_phyinfo_88e(precvframe, (struct phy_stat*)pphy_status); ret = rtw_recv_entry(precvframe); #endif @@ -796,20 +796,20 @@ static int recvbuf2recvframe(struct adapter *padapter, struct recv_buf *precvbuf _queue *pfree_recv_queue = &precvpriv->free_recv_queue; - transfer_len = (s32)precvbuf->transfer_len; + transfer_len = (s32)precvbuf->transfer_len; pbuf = precvbuf->pbuf; - prxstat = (struct recv_stat *)pbuf; + prxstat = (struct recv_stat *)pbuf; pkt_cnt = (le32_to_cpu(prxstat->rxdw2)>>16) & 0xff; #if 0 //temp remove when disable usb rx aggregation if((pkt_cnt > 10) || (pkt_cnt < 1) || (transfer_lenrxdw0, prxstat->rxdw1, prxstat->rxdw2, prxstat->rxdw4)); @@ -820,11 +820,11 @@ static int recvbuf2recvframe(struct adapter *padapter, struct recv_buf *precvbuf if(precvframe==NULL) { RT_TRACE(_module_rtl871x_recv_c_,_drv_err_,("recvbuf2recvframe: precvframe==NULL\n")); - DBG_8192C("%s()-%d: rtw_alloc_recvframe() failed! RX Drop!\n", __FUNCTION__, __LINE__); + DBG_8192C("%s()-%d: rtw_alloc_recvframe() failed! RX Drop!\n", __FUNCTION__, __LINE__); goto _exit_recvbuf2recvframe; } - _rtw_init_listhead(&precvframe->u.hdr.list); + _rtw_init_listhead(&precvframe->u.hdr.list); precvframe->u.hdr.precvbuf = NULL; //can't access the precvbuf for new arch. precvframe->u.hdr.len=0; @@ -832,16 +832,16 @@ static int recvbuf2recvframe(struct adapter *padapter, struct recv_buf *precvbuf update_recvframe_attrib_88e(precvframe, prxstat); pattrib = &precvframe->u.hdr.attrib; - + if ((padapter->registrypriv.mp_mode == 0) &&((pattrib->crc_err) || (pattrib->icv_err))) - { + { DBG_8192C("%s: RX Warning! crc_err=%d icv_err=%d, skip!\n", __FUNCTION__, pattrib->crc_err, pattrib->icv_err); - + rtw_free_recvframe(precvframe, pfree_recv_queue); goto _exit_recvbuf2recvframe; } - - + + if( (pattrib->physt) && (pattrib->pkt_rpt_type == NORMAL_RX)) { pphy_status = (struct phy_stat *)(pbuf + RXDESC_OFFSET); @@ -850,9 +850,9 @@ static int recvbuf2recvframe(struct adapter *padapter, struct recv_buf *precvbuf pkt_offset = RXDESC_SIZE + pattrib->drvinfo_sz + pattrib->shift_sz + pattrib->pkt_len; if((pattrib->pkt_len<=0) || (pkt_offset>transfer_len)) - { + { RT_TRACE(_module_rtl871x_recv_c_,_drv_info_,("recvbuf2recvframe: pkt_len<=0\n")); - DBG_8192C("%s()-%d: RX Warning!\n", __FUNCTION__, __LINE__); + DBG_8192C("%s()-%d: RX Warning!\n", __FUNCTION__, __LINE__); rtw_free_recvframe(precvframe, pfree_recv_queue); goto _exit_recvbuf2recvframe; } @@ -913,7 +913,7 @@ static int recvbuf2recvframe(struct adapter *padapter, struct recv_buf *precvbuf } recvframe_put(precvframe, skb_len); - //recvframe_pull(precvframe, drvinfo_sz + RXDESC_SIZE); + //recvframe_pull(precvframe, drvinfo_sz + RXDESC_SIZE); #ifdef CONFIG_USB_RX_AGGREGATION switch(pHalData->UsbRxAggMode) @@ -925,8 +925,8 @@ static int recvbuf2recvframe(struct adapter *padapter, struct recv_buf *precvbuf case USB_RX_AGG_USB: pkt_offset = (u16)_RND4(pkt_offset); break; - case USB_RX_AGG_DISABLE: - default: + case USB_RX_AGG_DISABLE: + default: break; } #endif @@ -943,9 +943,9 @@ static int recvbuf2recvframe(struct adapter *padapter, struct recv_buf *precvbuf } } else -#endif +#endif { - if (pattrib->physt) + if (pattrib->physt) update_recvframe_phyinfo_88e(precvframe, (struct phy_stat*)pphy_status); if(rtw_recv_entry(precvframe) != _SUCCESS) { @@ -956,13 +956,13 @@ static int recvbuf2recvframe(struct adapter *padapter, struct recv_buf *precvbuf } else{ // pkt_rpt_type == TX_REPORT1-CCX, TX_REPORT2-TX RTP,HIS_REPORT-USB HISR RTP - + //enqueue recvframe to txrtp queue if(pattrib->pkt_rpt_type == TX_REPORT1){ //DBG_8192C("rx CCX \n"); //CCX-TXRPT ack for xmit mgmt frames. handle_txrpt_ccx_88e(padapter, precvframe->u.hdr.rx_data); - + } else if(pattrib->pkt_rpt_type == TX_REPORT2){ //DBG_8192C("rx TX RPT \n"); @@ -973,7 +973,7 @@ static int recvbuf2recvframe(struct adapter *padapter, struct recv_buf *precvbuf pattrib->MacIDValidEntry[0], pattrib->MacIDValidEntry[1] ); - + } else if(pattrib->pkt_rpt_type == HIS_REPORT) { @@ -981,14 +981,14 @@ static int recvbuf2recvframe(struct adapter *padapter, struct recv_buf *precvbuf #ifdef CONFIG_SUPPORT_USB_INT interrupt_handler_8188eu(padapter,pattrib->pkt_len,precvframe->u.hdr.rx_data); #endif - } - rtw_free_recvframe(precvframe, pfree_recv_queue); - - } + } + rtw_free_recvframe(precvframe, pfree_recv_queue); + + } pkt_cnt--; transfer_len -= pkt_offset; - pbuf += pkt_offset; + pbuf += pkt_offset; precvframe = NULL; pkt_copy = NULL; @@ -1003,7 +1003,7 @@ _exit_recvbuf2recvframe: } void rtl8188eu_recv_tasklet(void *priv) -{ +{ struct recv_buf *precvbuf = NULL; struct adapter *padapter = (struct adapter*)priv; struct recv_priv *precvpriv = &padapter->recvpriv; @@ -1013,33 +1013,33 @@ void rtl8188eu_recv_tasklet(void *priv) if ((padapter->bDriverStopped == _TRUE)||(padapter->bSurpriseRemoved== _TRUE)) { DBG_8192C("recv_tasklet => bDriverStopped or bSurpriseRemoved \n"); - + break; } - + recvbuf2recvframe(padapter, precvbuf); rtw_read_port(padapter, precvpriv->ff_hwaddr, 0, (unsigned char *)precvbuf); - } - + } + } static void usb_read_port_complete(struct urb *purb, struct pt_regs *regs) -{ - struct recv_buf *precvbuf = (struct recv_buf *)purb->context; - struct adapter *padapter =(struct adapter *)precvbuf->adapter; +{ + struct recv_buf *precvbuf = (struct recv_buf *)purb->context; + struct adapter *padapter =(struct adapter *)precvbuf->adapter; struct recv_priv *precvpriv = &padapter->recvpriv; RT_TRACE(_module_hci_ops_os_c_,_drv_err_,("usb_read_port_complete!!!\n")); - + precvpriv->rx_pending_cnt --; - + if(padapter->bSurpriseRemoved || padapter->bDriverStopped||padapter->bReadPortCancel) { - RT_TRACE(_module_hci_ops_os_c_,_drv_err_,("usb_read_port_complete:bDriverStopped(%d) OR bSurpriseRemoved(%d)\n", padapter->bDriverStopped, padapter->bSurpriseRemoved)); - DBG_8192C("%s() RX Warning! bDriverStopped(%d) OR bSurpriseRemoved(%d) bReadPortCancel(%d)\n", - __FUNCTION__,padapter->bDriverStopped, padapter->bSurpriseRemoved,padapter->bReadPortCancel); + RT_TRACE(_module_hci_ops_os_c_,_drv_err_,("usb_read_port_complete:bDriverStopped(%d) OR bSurpriseRemoved(%d)\n", padapter->bDriverStopped, padapter->bSurpriseRemoved)); + DBG_8192C("%s() RX Warning! bDriverStopped(%d) OR bSurpriseRemoved(%d) bReadPortCancel(%d)\n", + __FUNCTION__,padapter->bDriverStopped, padapter->bSurpriseRemoved,padapter->bReadPortCancel); goto exit; } @@ -1051,22 +1051,22 @@ static void usb_read_port_complete(struct urb *purb, struct pt_regs *regs) rtw_read_port(padapter, precvpriv->ff_hwaddr, 0, (unsigned char *)precvbuf); } - else - { + else + { rtw_reset_continual_io_error(adapter_to_dvobj(padapter)); - - precvbuf->transfer_len = purb->actual_length; - //rtw_enqueue_rx_transfer_buffer(precvpriv, rx_transfer_buf); + precvbuf->transfer_len = purb->actual_length; + + //rtw_enqueue_rx_transfer_buffer(precvpriv, rx_transfer_buf); rtw_enqueue_recvbuf(precvbuf, &precvpriv->recv_buf_pending_queue); - tasklet_schedule(&precvpriv->recv_tasklet); - } + tasklet_schedule(&precvpriv->recv_tasklet); + } } else { RT_TRACE(_module_hci_ops_os_c_,_drv_err_,("usb_read_port_complete : purb->status(%d) != 0 \n", purb->status)); - + DBG_8192C("###=> usb_read_port_complete => urb status(%d)\n", purb->status); if(rtw_inc_and_chk_continual_io_error(adapter_to_dvobj(padapter)) == _TRUE ){ @@ -1075,13 +1075,13 @@ static void usb_read_port_complete(struct urb *purb, struct pt_regs *regs) switch(purb->status) { case -EINVAL: - case -EPIPE: + case -EPIPE: case -ENODEV: case -ESHUTDOWN: //padapter->bSurpriseRemoved=_TRUE; RT_TRACE(_module_hci_ops_os_c_,_drv_err_,("usb_read_port_complete:bSurpriseRemoved=TRUE\n")); case -ENOENT: - padapter->bDriverStopped=_TRUE; + padapter->bDriverStopped=_TRUE; RT_TRACE(_module_hci_ops_os_c_,_drv_err_,("usb_read_port_complete:bDriverStopped=TRUE\n")); break; case -EPROTO: @@ -1089,35 +1089,35 @@ static void usb_read_port_complete(struct urb *purb, struct pt_regs *regs) case -ETIME: case -ECOMM: case -EOVERFLOW: - #ifdef DBG_CONFIG_ERROR_DETECT - { + #ifdef DBG_CONFIG_ERROR_DETECT + { HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter); - pHalData->srestpriv.Wifi_Error_Status = USB_READ_PORT_FAIL; + pHalData->srestpriv.Wifi_Error_Status = USB_READ_PORT_FAIL; } #endif - rtw_read_port(padapter, precvpriv->ff_hwaddr, 0, (unsigned char *)precvbuf); + rtw_read_port(padapter, precvpriv->ff_hwaddr, 0, (unsigned char *)precvbuf); break; case -EINPROGRESS: DBG_8192C("ERROR: URB IS IN PROGRESS!/n"); break; default: - break; + break; } - - } -exit: - + } + +exit: + _func_exit_; - + } static u32 usb_read_port(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *rmem) -{ +{ int err; unsigned int pipe; u32 ret = _SUCCESS; - PURB purb = NULL; + PURB purb = NULL; struct recv_buf *precvbuf = (struct recv_buf *)rmem; struct adapter *adapter = pintfhdl->padapter; struct dvobj_priv *pdvobj = adapter_to_dvobj(adapter); @@ -1125,7 +1125,7 @@ static u32 usb_read_port(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *rmem) struct usb_device *pusbd = pdvobj->pusbdev; _func_enter_; - + if(adapter->bDriverStopped || adapter->bSurpriseRemoved ||dvobj_to_pwrctl(pdvobj)->pnp_bstop_trx) { RT_TRACE(_module_hci_ops_os_c_,_drv_err_,("usb_read_port:( padapter->bDriverStopped ||padapter->bSurpriseRemoved ||pwrctl->pnp_bstop_trx)!!!\n")); @@ -1133,37 +1133,37 @@ _func_enter_; } if(precvbuf !=NULL) - { + { rtl8188eu_init_recvbuf(adapter, precvbuf); if(precvbuf->pbuf) - { + { precvpriv->rx_pending_cnt++; - - purb = precvbuf->purb; + + purb = precvbuf->purb; //translate DMA FIFO addr to pipehandle - pipe = ffaddr2pipehdl(pdvobj, addr); + pipe = ffaddr2pipehdl(pdvobj, addr); - usb_fill_bulk_urb(purb, pusbd, pipe, + usb_fill_bulk_urb(purb, pusbd, pipe, precvbuf->pbuf, - MAX_RECVBUF_SZ, - usb_read_port_complete, - precvbuf);//context is precvbuf + MAX_RECVBUF_SZ, + usb_read_port_complete, + precvbuf);//context is precvbuf purb->transfer_dma = precvbuf->dma_transfer_addr; - purb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; + purb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; - err = usb_submit_urb(purb, GFP_ATOMIC); + err = usb_submit_urb(purb, GFP_ATOMIC); if((err) && (err != (-EPERM))) { RT_TRACE(_module_hci_ops_os_c_,_drv_err_,("cannot submit rx in-token(err=0x%.8x), URB_STATUS =0x%.8x", err, purb->status)); DBG_8192C("cannot submit rx in-token(err = 0x%08x),urb_status = %d\n",err,purb->status); ret = _FAIL; } - + } - + } else { @@ -1193,19 +1193,19 @@ static int recvbuf2recvframe(struct adapter *padapter, _pkt *pskb) _queue *pfree_recv_queue = &precvpriv->free_recv_queue; - transfer_len = (s32)pskb->len; + transfer_len = (s32)pskb->len; pbuf = pskb->data; - prxstat = (struct recv_stat *)pbuf; + prxstat = (struct recv_stat *)pbuf; pkt_cnt = (le32_to_cpu(prxstat->rxdw2)>>16) & 0xff; #if 0 //temp remove when disable usb rx aggregation if((pkt_cnt > 10) || (pkt_cnt < 1) || (transfer_lenrxdw0, prxstat->rxdw1, prxstat->rxdw2, prxstat->rxdw4)); @@ -1216,21 +1216,21 @@ static int recvbuf2recvframe(struct adapter *padapter, _pkt *pskb) if(precvframe==NULL) { RT_TRACE(_module_rtl871x_recv_c_,_drv_err_,("recvbuf2recvframe: precvframe==NULL\n")); - DBG_8192C("%s()-%d: rtw_alloc_recvframe() failed! RX Drop!\n", __FUNCTION__, __LINE__); + DBG_8192C("%s()-%d: rtw_alloc_recvframe() failed! RX Drop!\n", __FUNCTION__, __LINE__); goto _exit_recvbuf2recvframe; } - _rtw_init_listhead(&precvframe->u.hdr.list); + _rtw_init_listhead(&precvframe->u.hdr.list); precvframe->u.hdr.precvbuf = NULL; //can't access the precvbuf for new arch. precvframe->u.hdr.len=0; //rtl8192c_query_rx_desc_status(precvframe, prxstat); update_recvframe_attrib_88e(precvframe, prxstat); - pattrib = &precvframe->u.hdr.attrib; - + pattrib = &precvframe->u.hdr.attrib; + if ((padapter->registrypriv.mp_mode == 0) &&((pattrib->crc_err) || (pattrib->icv_err))) - { + { DBG_8192C("%s: RX Warning! crc_err=%d icv_err=%d, skip!\n", __FUNCTION__, pattrib->crc_err, pattrib->icv_err); rtw_free_recvframe(precvframe, pfree_recv_queue); @@ -1245,13 +1245,13 @@ static int recvbuf2recvframe(struct adapter *padapter, _pkt *pskb) pkt_offset = RXDESC_SIZE + pattrib->drvinfo_sz + pattrib->shift_sz + pattrib->pkt_len; if((pattrib->pkt_len<=0) || (pkt_offset>transfer_len)) - { + { RT_TRACE(_module_rtl871x_recv_c_,_drv_info_,("recvbuf2recvframe: pkt_len<=0\n")); - DBG_8192C("%s()-%d: RX Warning!,pkt_len<=0 or pkt_offset> transfoer_len \n", __FUNCTION__, __LINE__); + DBG_8192C("%s()-%d: RX Warning!,pkt_len<=0 or pkt_offset> transfoer_len \n", __FUNCTION__, __LINE__); rtw_free_recvframe(precvframe, pfree_recv_queue); goto _exit_recvbuf2recvframe; } - + // Modified by Albert 20101213 // For 8 bytes IP header alignment. if (pattrib->qos) // Qos data, wireless lan header length is 26 @@ -1297,16 +1297,16 @@ static int recvbuf2recvframe(struct adapter *padapter, _pkt *pskb) else { if((pattrib->mfrag == 1)&&(pattrib->frag_num == 0)) - { + { DBG_8192C("recvbuf2recvframe: alloc_skb fail , drop frag frame \n"); rtw_free_recvframe(precvframe, pfree_recv_queue); goto _exit_recvbuf2recvframe; } - + precvframe->u.hdr.pkt = rtw_skb_clone(pskb); if(precvframe->u.hdr.pkt) { - precvframe->u.hdr.rx_head = precvframe->u.hdr.rx_data = precvframe->u.hdr.rx_tail + precvframe->u.hdr.rx_head = precvframe->u.hdr.rx_data = precvframe->u.hdr.rx_tail = pbuf+ pattrib->drvinfo_sz + RXDESC_SIZE; precvframe->u.hdr.rx_end = pbuf +pattrib->drvinfo_sz + RXDESC_SIZE+ alloc_sz; } @@ -1316,11 +1316,11 @@ static int recvbuf2recvframe(struct adapter *padapter, _pkt *pskb) rtw_free_recvframe(precvframe, pfree_recv_queue); goto _exit_recvbuf2recvframe; } - + } recvframe_put(precvframe, skb_len); - //recvframe_pull(precvframe, drvinfo_sz + RXDESC_SIZE); + //recvframe_pull(precvframe, drvinfo_sz + RXDESC_SIZE); #ifdef CONFIG_USB_RX_AGGREGATION switch(pHalData->UsbRxAggMode) @@ -1332,8 +1332,8 @@ static int recvbuf2recvframe(struct adapter *padapter, _pkt *pskb) case USB_RX_AGG_USB: pkt_offset = (u16)_RND4(pkt_offset); break; - case USB_RX_AGG_DISABLE: - default: + case USB_RX_AGG_DISABLE: + default: break; } #endif @@ -1352,7 +1352,7 @@ static int recvbuf2recvframe(struct adapter *padapter, _pkt *pskb) else #endif { - if (pattrib->physt) + if (pattrib->physt) update_recvframe_phyinfo_88e(precvframe, (struct phy_stat*)pphy_status); if(rtw_recv_entry(precvframe) != _SUCCESS) { @@ -1362,7 +1362,7 @@ static int recvbuf2recvframe(struct adapter *padapter, _pkt *pskb) } } else{ // pkt_rpt_type == TX_REPORT1-CCX, TX_REPORT2-TX RTP,HIS_REPORT-USB HISR RTP - + //enqueue recvframe to txrtp queue if(pattrib->pkt_rpt_type == TX_REPORT1){ //DBG_8192C("rx CCX \n"); @@ -1378,7 +1378,7 @@ static int recvbuf2recvframe(struct adapter *padapter, _pkt *pskb) pattrib->MacIDValidEntry[0], pattrib->MacIDValidEntry[1] ); - + } else if(pattrib->pkt_rpt_type == HIS_REPORT) { @@ -1386,14 +1386,14 @@ static int recvbuf2recvframe(struct adapter *padapter, _pkt *pskb) #ifdef CONFIG_SUPPORT_USB_INT interrupt_handler_8188eu(padapter,pattrib->pkt_len,precvframe->u.hdr.rx_data); #endif - } - rtw_free_recvframe(precvframe, pfree_recv_queue); - + } + rtw_free_recvframe(precvframe, pfree_recv_queue); + } - + pkt_cnt--; transfer_len -= pkt_offset; - pbuf += pkt_offset; + pbuf += pkt_offset; precvframe = NULL; pkt_copy = NULL; @@ -1404,7 +1404,7 @@ static int recvbuf2recvframe(struct adapter *padapter, _pkt *pskb) _exit_recvbuf2recvframe: - return _SUCCESS; + return _SUCCESS; } void rtl8188eu_recv_tasklet(void *priv) @@ -1412,7 +1412,7 @@ void rtl8188eu_recv_tasklet(void *priv) _pkt *pskb; struct adapter *padapter = (struct adapter*)priv; struct recv_priv *precvpriv = &padapter->recvpriv; - + while (NULL != (pskb = skb_dequeue(&precvpriv->rx_skb_queue))) { if ((padapter->bDriverStopped == _TRUE)||(padapter->bSurpriseRemoved== _TRUE)) @@ -1421,7 +1421,7 @@ void rtl8188eu_recv_tasklet(void *priv) rtw_skb_free(pskb); break; } - + recvbuf2recvframe(padapter, pskb); #ifdef CONFIG_PREALLOC_RECV_SKB @@ -1429,15 +1429,15 @@ void rtl8188eu_recv_tasklet(void *priv) skb_reset_tail_pointer(pskb); pskb->len = 0; - + skb_queue_tail(&precvpriv->free_recv_skb_queue, pskb); - + #else rtw_skb_free(pskb); #endif - + } - + } @@ -1445,39 +1445,39 @@ static void usb_read_port_complete(struct urb *purb, struct pt_regs *regs) { _irqL irqL; uint isevt, *pbuf; - struct recv_buf *precvbuf = (struct recv_buf *)purb->context; - struct adapter *padapter =(struct adapter *)precvbuf->adapter; - struct recv_priv *precvpriv = &padapter->recvpriv; - + struct recv_buf *precvbuf = (struct recv_buf *)purb->context; + struct adapter *padapter =(struct adapter *)precvbuf->adapter; + struct recv_priv *precvpriv = &padapter->recvpriv; + RT_TRACE(_module_hci_ops_os_c_,_drv_err_,("usb_read_port_complete!!!\n")); - + //_enter_critical(&precvpriv->lock, &irqL); //precvbuf->irp_pending=_FALSE; //precvpriv->rx_pending_cnt --; //_exit_critical(&precvpriv->lock, &irqL); - + precvpriv->rx_pending_cnt --; - + //if(precvpriv->rx_pending_cnt== 0) - //{ + //{ // RT_TRACE(_module_hci_ops_os_c_,_drv_err_,("usb_read_port_complete: rx_pending_cnt== 0, set allrxreturnevt!\n")); - // _rtw_up_sema(&precvpriv->allrxreturnevt); + // _rtw_up_sema(&precvpriv->allrxreturnevt); //} if(padapter->bSurpriseRemoved || padapter->bDriverStopped||padapter->bReadPortCancel) { - RT_TRACE(_module_hci_ops_os_c_,_drv_err_,("usb_read_port_complete:bDriverStopped(%d) OR bSurpriseRemoved(%d)\n", padapter->bDriverStopped, padapter->bSurpriseRemoved)); - + RT_TRACE(_module_hci_ops_os_c_,_drv_err_,("usb_read_port_complete:bDriverStopped(%d) OR bSurpriseRemoved(%d)\n", padapter->bDriverStopped, padapter->bSurpriseRemoved)); + #ifdef CONFIG_PREALLOC_RECV_SKB precvbuf->reuse = _TRUE; #else if(precvbuf->pskb){ DBG_8192C("==> free skb(%p)\n",precvbuf->pskb); rtw_skb_free(precvbuf->pskb); - } + } #endif - DBG_8192C("%s() RX Warning! bDriverStopped(%d) OR bSurpriseRemoved(%d) bReadPortCancel(%d)\n", - __FUNCTION__,padapter->bDriverStopped, padapter->bSurpriseRemoved,padapter->bReadPortCancel); + DBG_8192C("%s() RX Warning! bDriverStopped(%d) OR bSurpriseRemoved(%d) bReadPortCancel(%d)\n", + __FUNCTION__,padapter->bDriverStopped, padapter->bSurpriseRemoved,padapter->bReadPortCancel); goto exit; } @@ -1488,14 +1488,14 @@ static void usb_read_port_complete(struct urb *purb, struct pt_regs *regs) RT_TRACE(_module_hci_ops_os_c_,_drv_err_,("usb_read_port_complete: (purb->actual_length > MAX_RECVBUF_SZ) || (purb->actual_length < RXDESC_SIZE)\n")); precvbuf->reuse = _TRUE; rtw_read_port(padapter, precvpriv->ff_hwaddr, 0, (unsigned char *)precvbuf); - DBG_8192C("%s()-%d: RX Warning!\n", __FUNCTION__, __LINE__); + DBG_8192C("%s()-%d: RX Warning!\n", __FUNCTION__, __LINE__); } - else - { + else + { rtw_reset_continual_io_error(adapter_to_dvobj(padapter)); - - precvbuf->transfer_len = purb->actual_length; - skb_put(precvbuf->pskb, purb->actual_length); + + precvbuf->transfer_len = purb->actual_length; + skb_put(precvbuf->pskb, purb->actual_length); skb_queue_tail(&precvpriv->rx_skb_queue, precvbuf->pskb); if (skb_queue_len(&precvpriv->rx_skb_queue)<=1) @@ -1503,13 +1503,13 @@ static void usb_read_port_complete(struct urb *purb, struct pt_regs *regs) precvbuf->pskb = NULL; precvbuf->reuse = _FALSE; - rtw_read_port(padapter, precvpriv->ff_hwaddr, 0, (unsigned char *)precvbuf); - } + rtw_read_port(padapter, precvpriv->ff_hwaddr, 0, (unsigned char *)precvbuf); + } } else { RT_TRACE(_module_hci_ops_os_c_,_drv_err_,("usb_read_port_complete : purb->status(%d) != 0 \n", purb->status)); - + DBG_8192C("###=> usb_read_port_complete => urb status(%d)\n", purb->status); if(rtw_inc_and_chk_continual_io_error(adapter_to_dvobj(padapter)) == _TRUE ){ @@ -1518,13 +1518,13 @@ static void usb_read_port_complete(struct urb *purb, struct pt_regs *regs) switch(purb->status) { case -EINVAL: - case -EPIPE: + case -EPIPE: case -ENODEV: case -ESHUTDOWN: //padapter->bSurpriseRemoved=_TRUE; RT_TRACE(_module_hci_ops_os_c_,_drv_err_,("usb_read_port_complete:bSurpriseRemoved=TRUE\n")); case -ENOENT: - padapter->bDriverStopped=_TRUE; + padapter->bDriverStopped=_TRUE; RT_TRACE(_module_hci_ops_os_c_,_drv_err_,("usb_read_port_complete:bDriverStopped=TRUE\n")); break; case -EPROTO: @@ -1532,32 +1532,32 @@ static void usb_read_port_complete(struct urb *purb, struct pt_regs *regs) case -ETIME: case -ECOMM: case -EOVERFLOW: - #ifdef DBG_CONFIG_ERROR_DETECT - { + #ifdef DBG_CONFIG_ERROR_DETECT + { HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter); - pHalData->srestpriv.Wifi_Error_Status = USB_READ_PORT_FAIL; + pHalData->srestpriv.Wifi_Error_Status = USB_READ_PORT_FAIL; } #endif precvbuf->reuse = _TRUE; - rtw_read_port(padapter, precvpriv->ff_hwaddr, 0, (unsigned char *)precvbuf); + rtw_read_port(padapter, precvpriv->ff_hwaddr, 0, (unsigned char *)precvbuf); break; case -EINPROGRESS: DBG_8192C("ERROR: URB IS IN PROGRESS!/n"); break; default: - break; + break; } - - } -exit: - + } + +exit: + _func_exit_; - + } static u32 usb_read_port(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *rmem) -{ +{ _irqL irqL; int err; unsigned int pipe; @@ -1570,10 +1570,10 @@ static u32 usb_read_port(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *rmem) struct dvobj_priv *pdvobj = adapter_to_dvobj(adapter); struct recv_priv *precvpriv = &adapter->recvpriv; struct usb_device *pusbd = pdvobj->pusbdev; - + _func_enter_; - + if(adapter->bDriverStopped || adapter->bSurpriseRemoved ||dvobj_to_pwrctl(pdvobj)->pnp_bstop_trx) { RT_TRACE(_module_hci_ops_os_c_,_drv_err_,("usb_read_port:( padapter->bDriverStopped ||padapter->bSurpriseRemoved ||pwrctl->pnp_bstop_trx)!!!\n")); @@ -1589,41 +1589,41 @@ _func_enter_; } } #endif - + if(precvbuf !=NULL) - { - rtl8188eu_init_recvbuf(adapter, precvbuf); + { + rtl8188eu_init_recvbuf(adapter, precvbuf); //re-assign for linux based on skb if((precvbuf->reuse == _FALSE) || (precvbuf->pskb == NULL)) { precvbuf->pskb = rtw_skb_alloc(MAX_RECVBUF_SZ + RECVBUFF_ALIGN_SZ); - if(precvbuf->pskb == NULL) + if(precvbuf->pskb == NULL) { RT_TRACE(_module_hci_ops_os_c_,_drv_err_,("init_recvbuf(): alloc_skb fail!\n")); DBG_8192C("#### usb_read_port() alloc_skb fail!#####\n"); return _FAIL; - } + } tmpaddr = (SIZE_PTR)precvbuf->pskb->data; - alignment = tmpaddr & (RECVBUFF_ALIGN_SZ-1); + alignment = tmpaddr & (RECVBUFF_ALIGN_SZ-1); skb_reserve(precvbuf->pskb, (RECVBUFF_ALIGN_SZ - alignment)); precvbuf->phead = precvbuf->pskb->head; - precvbuf->pdata = precvbuf->pskb->data; + precvbuf->pdata = precvbuf->pskb->data; precvbuf->ptail = skb_tail_pointer(precvbuf->pskb); precvbuf->pend = skb_end_pointer(precvbuf->pskb); precvbuf->pbuf = precvbuf->pskb->data; - } + } else//reuse skb { precvbuf->phead = precvbuf->pskb->head; precvbuf->pdata = precvbuf->pskb->data; precvbuf->ptail = skb_tail_pointer(precvbuf->pskb); precvbuf->pend = skb_end_pointer(precvbuf->pskb); - precvbuf->pbuf = precvbuf->pskb->data; + precvbuf->pbuf = precvbuf->pskb->data; precvbuf->reuse = _FALSE; } @@ -1640,11 +1640,11 @@ _func_enter_; //translate DMA FIFO addr to pipehandle pipe = ffaddr2pipehdl(pdvobj, addr); - usb_fill_bulk_urb(purb, pusbd, pipe, + usb_fill_bulk_urb(purb, pusbd, pipe, precvbuf->pbuf, - MAX_RECVBUF_SZ, - usb_read_port_complete, - precvbuf);//context is precvbuf + MAX_RECVBUF_SZ, + usb_read_port_complete, + precvbuf);//context is precvbuf err = usb_submit_urb(purb, GFP_ATOMIC); if((err) && (err != (-EPERM))) @@ -1667,7 +1667,7 @@ _func_exit_; #endif // CONFIG_USE_USB_BUFFER_ALLOC_RX void rtl8188eu_xmit_tasklet(void *priv) -{ +{ int ret = _FALSE; struct adapter *padapter = (struct adapter*)priv; struct xmit_priv *pxmitpriv = &padapter->xmitpriv; @@ -1687,33 +1687,33 @@ void rtl8188eu_xmit_tasklet(void *priv) if(ret==_FALSE) break; - + } - + } void rtl8188eu_set_intf_ops(struct _io_ops *pops) -{ - _func_enter_; +{ + _func_enter_; - _rtw_memset((u8 *)pops, 0, sizeof(struct _io_ops)); + _rtw_memset((u8 *)pops, 0, sizeof(struct _io_ops)); pops->_read8 = &usb_read8; pops->_read16 = &usb_read16; pops->_read32 = &usb_read32; pops->_read_mem = &usb_read_mem; - pops->_read_port = &usb_read_port; - + pops->_read_port = &usb_read_port; + pops->_write8 = &usb_write8; pops->_write16 = &usb_write16; pops->_write32 = &usb_write32; pops->_writeN = &usb_writeN; - -#ifdef CONFIG_USB_SUPPORT_ASYNC_VDN_REQ + +#ifdef CONFIG_USB_SUPPORT_ASYNC_VDN_REQ pops->_write8_async= &usb_async_write8; pops->_write16_async = &usb_async_write16; pops->_write32_async = &usb_async_write32; -#endif +#endif pops->_write_mem = &usb_write_mem; pops->_write_port = &usb_write_port; @@ -1734,4 +1734,3 @@ void rtl8188eu_set_hw_type(struct adapter *padapter) padapter->HardwareType = HARDWARE_TYPE_RTL8188EU; DBG_871X("CHIP TYPE: RTL8188E\n"); } - diff --git a/include/Hal8188EPhyCfg.h b/include/Hal8188EPhyCfg.h index a729277..30570dd 100755 --- a/include/Hal8188EPhyCfg.h +++ b/include/Hal8188EPhyCfg.h @@ -1,429 +1,428 @@ -/****************************************************************************** - * - * 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 __INC_HAL8188EPHYCFG_H__ -#define __INC_HAL8188EPHYCFG_H__ - - -/*--------------------------Define Parameters-------------------------------*/ -#define LOOP_LIMIT 5 -#define MAX_STALL_TIME 50 //us -#define AntennaDiversityValue 0x80 //(Adapter->bSoftwareAntennaDiversity ? 0x00:0x80) -#define MAX_TXPWR_IDX_NMODE_92S 63 -#define Reset_Cnt_Limit 3 - -#define IQK_MAC_REG_NUM 4 -#define IQK_ADDA_REG_NUM 16 -#define IQK_BB_REG_NUM 9 -#define HP_THERMAL_NUM 8 - -#ifdef CONFIG_PCI_HCI -#define MAX_AGGR_NUM 0x0B -#else -#define MAX_AGGR_NUM 0x07 -#endif // CONFIG_PCI_HCI - - -/*--------------------------Define Parameters-------------------------------*/ - - -/*------------------------------Define structure----------------------------*/ -typedef enum _SwChnlCmdID{ - CmdID_End, - CmdID_SetTxPowerLevel, - CmdID_BBRegWrite10, - CmdID_WritePortUlong, - CmdID_WritePortUshort, - CmdID_WritePortUchar, - CmdID_RF_WriteReg, -}SwChnlCmdID; - - -/* 1. Switch channel related */ -typedef struct _SwChnlCmd{ - SwChnlCmdID CmdID; - u32 Para1; - u32 Para2; - u32 msDelay; -}SwChnlCmd; - -typedef enum _HW90_BLOCK{ - HW90_BLOCK_MAC = 0, - HW90_BLOCK_PHY0 = 1, - HW90_BLOCK_PHY1 = 2, - HW90_BLOCK_RF = 3, - HW90_BLOCK_MAXIMUM = 4, // Never use this -}HW90_BLOCK_E, *PHW90_BLOCK_E; - -typedef enum _RF_RADIO_PATH{ - RF_PATH_A = 0, //Radio Path A - RF_PATH_B = 1, //Radio Path B - RF_PATH_C = 2, //Radio Path C - RF_PATH_D = 3, //Radio Path D - //RF_PATH_MAX //Max RF number 90 support -}RF_RADIO_PATH_E, *PRF_RADIO_PATH_E; - -#define MAX_PG_GROUP 13 - -#define RF_PATH_MAX 2 -#define MAX_RF_PATH RF_PATH_MAX -#define MAX_TX_COUNT_88E 1 -#define MAX_TX_COUNT MAX_TX_COUNT_88E // 4 //path numbers - -#define CHANNEL_MAX_NUMBER 14 // 14 is the max channel number -#define MAX_CHNL_GROUP_24G 6 // ch1~2, ch3~5, ch6~8,ch9~11,ch12~13,CH 14 total six groups -#define CHANNEL_GROUP_MAX_88E 6 - -typedef enum _WIRELESS_MODE { - WIRELESS_MODE_UNKNOWN = 0x00, - WIRELESS_MODE_A = BIT2, - WIRELESS_MODE_B = BIT0, - WIRELESS_MODE_G = BIT1, - WIRELESS_MODE_AUTO = BIT5, - WIRELESS_MODE_N_24G = BIT3, - WIRELESS_MODE_N_5G = BIT4, - WIRELESS_MODE_AC = BIT6 -} WIRELESS_MODE; - - -typedef enum _PHY_Rate_Tx_Power_Offset_Area{ - RA_OFFSET_LEGACY_OFDM1, - RA_OFFSET_LEGACY_OFDM2, - RA_OFFSET_HT_OFDM1, - RA_OFFSET_HT_OFDM2, - RA_OFFSET_HT_OFDM3, - RA_OFFSET_HT_OFDM4, - RA_OFFSET_HT_CCK, -}RA_OFFSET_AREA,*PRA_OFFSET_AREA; - - -/* BB/RF related */ -typedef enum _RF_TYPE_8190P{ - RF_TYPE_MIN, // 0 - RF_8225=1, // 1 11b/g RF for verification only - RF_8256=2, // 2 11b/g/n - RF_8258=3, // 3 11a/b/g/n RF - RF_6052=4, // 4 11b/g/n RF - //RF_6052=5, // 4 11b/g/n RF - // TODO: We sholud remove this psudo PHY RF after we get new RF. - RF_PSEUDO_11N=5, // 5, It is a temporality RF. -}RF_TYPE_8190P_E,*PRF_TYPE_8190P_E; - - -typedef struct _BB_REGISTER_DEFINITION{ - u32 rfintfs; // set software control: - // 0x870~0x877[8 bytes] - - u32 rfintfi; // readback data: - // 0x8e0~0x8e7[8 bytes] - - u32 rfintfo; // output data: - // 0x860~0x86f [16 bytes] - - u32 rfintfe; // output enable: - // 0x860~0x86f [16 bytes] - - u32 rf3wireOffset; // LSSI data: - // 0x840~0x84f [16 bytes] - - u32 rfLSSI_Select; // BB Band Select: - // 0x878~0x87f [8 bytes] - - u32 rfTxGainStage; // Tx gain stage: - // 0x80c~0x80f [4 bytes] - - u32 rfHSSIPara1; // wire parameter control1 : - // 0x820~0x823,0x828~0x82b, 0x830~0x833, 0x838~0x83b [16 bytes] - - u32 rfHSSIPara2; // wire parameter control2 : - // 0x824~0x827,0x82c~0x82f, 0x834~0x837, 0x83c~0x83f [16 bytes] - - u32 rfSwitchControl; //Tx Rx antenna control : - // 0x858~0x85f [16 bytes] - - u32 rfAGCControl1; //AGC parameter control1 : - // 0xc50~0xc53,0xc58~0xc5b, 0xc60~0xc63, 0xc68~0xc6b [16 bytes] - - u32 rfAGCControl2; //AGC parameter control2 : - // 0xc54~0xc57,0xc5c~0xc5f, 0xc64~0xc67, 0xc6c~0xc6f [16 bytes] - - u32 rfRxIQImbalance; //OFDM Rx IQ imbalance matrix : - // 0xc14~0xc17,0xc1c~0xc1f, 0xc24~0xc27, 0xc2c~0xc2f [16 bytes] - - u32 rfRxAFE; //Rx IQ DC ofset and Rx digital filter, Rx DC notch filter : - // 0xc10~0xc13,0xc18~0xc1b, 0xc20~0xc23, 0xc28~0xc2b [16 bytes] - - u32 rfTxIQImbalance; //OFDM Tx IQ imbalance matrix - // 0xc80~0xc83,0xc88~0xc8b, 0xc90~0xc93, 0xc98~0xc9b [16 bytes] - - u32 rfTxAFE; //Tx IQ DC Offset and Tx DFIR type - // 0xc84~0xc87,0xc8c~0xc8f, 0xc94~0xc97, 0xc9c~0xc9f [16 bytes] - - u32 rfLSSIReadBack; //LSSI RF readback data SI mode - // 0x8a0~0x8af [16 bytes] - - u32 rfLSSIReadBackPi; //LSSI RF readback data PI mode 0x8b8-8bc for Path A and B - -}BB_REGISTER_DEFINITION_T, *PBB_REGISTER_DEFINITION_T; - -typedef struct _R_ANTENNA_SELECT_OFDM{ - u32 r_tx_antenna:4; - u32 r_ant_l:4; - u32 r_ant_non_ht:4; - u32 r_ant_ht1:4; - u32 r_ant_ht2:4; - u32 r_ant_ht_s1:4; - u32 r_ant_non_ht_s1:4; - u32 OFDM_TXSC:2; - u32 Reserved:2; -}R_ANTENNA_SELECT_OFDM; - -typedef struct _R_ANTENNA_SELECT_CCK{ - u8 r_cckrx_enable_2:2; - u8 r_cckrx_enable:2; - u8 r_ccktx_enable:4; -}R_ANTENNA_SELECT_CCK; - -/*------------------------------Define structure----------------------------*/ - - -/*------------------------Export global variable----------------------------*/ -/*------------------------Export global variable----------------------------*/ - - -/*------------------------Export Marco Definition---------------------------*/ -/*------------------------Export Marco Definition---------------------------*/ - - -/*--------------------------Exported Function prototype---------------------*/ -// -// BB and RF register read/write -// -u32 rtl8188e_PHY_QueryBBReg( IN struct adapter *Adapter, - IN u32 RegAddr, - IN u32 BitMask ); -void rtl8188e_PHY_SetBBReg( IN struct adapter *Adapter, - IN u32 RegAddr, - IN u32 BitMask, - IN u32 Data ); -u32 rtl8188e_PHY_QueryRFReg( IN struct adapter * Adapter, - IN RF_RADIO_PATH_E eRFPath, - IN u32 RegAddr, - IN u32 BitMask ); -void rtl8188e_PHY_SetRFReg( IN struct adapter * Adapter, - IN RF_RADIO_PATH_E eRFPath, - IN u32 RegAddr, - IN u32 BitMask, - IN u32 Data ); - -// -// Initialization related function -// -/* MAC/BB/RF HAL config */ -int PHY_MACConfig8188E(IN struct adapter *Adapter ); -int PHY_BBConfig8188E(IN struct adapter *Adapter ); -int PHY_RFConfig8188E(IN struct adapter *Adapter ); - -/* RF config */ -int rtl8188e_PHY_ConfigRFWithParaFile(IN struct adapter *Adapter, IN u8 * pFileName, RF_RADIO_PATH_E eRFPath); -int rtl8188e_PHY_ConfigRFWithHeaderFile( IN struct adapter * Adapter, - IN RF_RADIO_PATH_E eRFPath); - -/* Read initi reg value for tx power setting. */ -void rtl8192c_PHY_GetHWRegOriginalValue( IN struct adapter * Adapter ); - -// -// RF Power setting -// -//extern BOOLEAN PHY_SetRFPowerState(IN struct adapter * Adapter, -// IN RT_RF_POWER_STATE eRFPowerState); - -// -// BB TX Power R/W -// -void PHY_GetTxPowerLevel8188E( IN struct adapter * Adapter, - OUT u32* powerlevel ); -void PHY_SetTxPowerLevel8188E( IN struct adapter * Adapter, - IN u8 channel ); -BOOLEAN PHY_UpdateTxPowerDbm8188E( IN struct adapter *Adapter, - IN int powerInDbm ); - -// -VOID -PHY_ScanOperationBackup8188E(IN struct adapter *Adapter, - IN u8 Operation ); - -// -// Switch bandwidth for 8192S -// -//extern void PHY_SetBWModeCallback8192C( IN PRT_TIMER pTimer ); -void PHY_SetBWMode8188E( IN struct adapter * pAdapter, - IN HT_CHANNEL_WIDTH ChnlWidth, - IN unsigned char Offset ); - -// -// Set FW CMD IO for 8192S. -// -//extern BOOLEAN HalSetIO8192C( IN struct adapter * Adapter, -// IN IO_TYPE IOType); - -// -// Set A2 entry to fw for 8192S -// -extern void FillA2Entry8192C( IN struct adapter * Adapter, - IN u8 index, - IN u8* val); - - -// -// channel switch related funciton -// -//extern void PHY_SwChnlCallback8192C( IN PRT_TIMER pTimer ); -void PHY_SwChnl8188E( IN struct adapter * pAdapter, - IN u8 channel ); - // Call after initialization -void PHY_SwChnlPhy8192C( IN struct adapter * pAdapter, - IN u8 channel ); - -void ChkFwCmdIoDone( IN struct adapter *Adapter); - -// -// BB/MAC/RF other monitor API -// -void PHY_SetMonitorMode8192C(IN struct adapter *pAdapter, - IN BOOLEAN bEnableMonitorMode ); - -BOOLEAN PHY_CheckIsLegalRfPath8192C(IN struct adapter *pAdapter, - IN u32 eRFPath ); - -VOID PHY_SetRFPathSwitch_8188E(IN struct adapter *pAdapter, IN BOOLEAN bMain); - -extern VOID -PHY_SwitchEphyParameter( - IN struct adapter * Adapter - ); - -extern VOID -PHY_EnableHostClkReq( - IN struct adapter * Adapter - ); - -BOOLEAN -SetAntennaConfig92C( - IN struct adapter *Adapter, - IN u8 DefaultAnt - ); - -#ifdef CONFIG_PHY_SETTING_WITH_ODM -VOID -storePwrIndexDiffRateOffset( - IN struct adapter *Adapter, - IN u32 RegAddr, - IN u32 BitMask, - IN u32 Data - ); -#endif //CONFIG_PHY_SETTING_WITH_ODM -/*--------------------------Exported Function prototype---------------------*/ - -#define PHY_QueryBBReg(Adapter, RegAddr, BitMask) rtl8188e_PHY_QueryBBReg((Adapter), (RegAddr), (BitMask)) -#define PHY_SetBBReg(Adapter, RegAddr, BitMask, Data) rtl8188e_PHY_SetBBReg((Adapter), (RegAddr), (BitMask), (Data)) -#define PHY_QueryRFReg(Adapter, eRFPath, RegAddr, BitMask) rtl8188e_PHY_QueryRFReg((Adapter), (eRFPath), (RegAddr), (BitMask)) -#define PHY_SetRFReg(Adapter, eRFPath, RegAddr, BitMask, Data) rtl8188e_PHY_SetRFReg((Adapter), (eRFPath), (RegAddr), (BitMask), (Data)) - -#define PHY_SetMacReg PHY_SetBBReg -#define PHY_QueryMacReg PHY_QueryBBReg - - -// -// Initialization related function -// -/* MAC/BB/RF HAL config */ -//extern s32 PHY_MACConfig8723(struct adapter *padapter); -//s32 PHY_BBConfig8723(struct adapter *padapter); -//s32 PHY_RFConfig8723(struct adapter *padapter); - - - -//================================================================== -// Note: If SIC_ENABLE under PCIE, because of the slow operation -// you should -// 2) "#define RTL8723_FPGA_VERIFICATION 1" in Precomp.h.WlanE.Windows -// 3) "#define RTL8190_Download_Firmware_From_Header 0" in Precomp.h.WlanE.Windows if needed. -// -#if (RTL8188E_SUPPORT == 1) && (RTL8188E_FPGA_TRUE_PHY_VERIFICATION == 1) -#define SIC_ENABLE 1 -#define SIC_HW_SUPPORT 1 -#else -#define SIC_ENABLE 0 -#define SIC_HW_SUPPORT 0 -#endif -//================================================================== - - -#define SIC_MAX_POLL_CNT 5 - -#if(SIC_HW_SUPPORT == 1) -#define SIC_CMD_READY 0 -#define SIC_CMD_PREWRITE 0x1 -#if(RTL8188E_SUPPORT == 1) -#define SIC_CMD_WRITE 0x40 -#define SIC_CMD_PREREAD 0x2 -#define SIC_CMD_READ 0x80 -#define SIC_CMD_INIT 0xf0 -#define SIC_INIT_VAL 0xff - -#define SIC_INIT_REG 0x1b7 -#define SIC_CMD_REG 0x1EB // 1byte -#define SIC_ADDR_REG 0x1E8 // 1b4~1b5, 2 bytes -#define SIC_DATA_REG 0x1EC // 1b0~1b3 -#else -#define SIC_CMD_WRITE 0x11 -#define SIC_CMD_PREREAD 0x2 -#define SIC_CMD_READ 0x12 -#define SIC_CMD_INIT 0x1f -#define SIC_INIT_VAL 0xff - -#define SIC_INIT_REG 0x1b7 -#define SIC_CMD_REG 0x1b6 // 1byte -#define SIC_ADDR_REG 0x1b4 // 1b4~1b5, 2 bytes -#define SIC_DATA_REG 0x1b0 // 1b0~1b3 -#endif -#else -#define SIC_CMD_READY 0 -#define SIC_CMD_WRITE 1 -#define SIC_CMD_READ 2 - -#if(RTL8188E_SUPPORT == 1) -#define SIC_CMD_REG 0x1EB // 1byte -#define SIC_ADDR_REG 0x1E8 // 1b9~1ba, 2 bytes -#define SIC_DATA_REG 0x1EC // 1bc~1bf -#else -#define SIC_CMD_REG 0x1b8 // 1byte -#define SIC_ADDR_REG 0x1b9 // 1b9~1ba, 2 bytes -#define SIC_DATA_REG 0x1bc // 1bc~1bf -#endif -#endif - -#if(SIC_ENABLE == 1) -VOID SIC_Init(IN struct adapter *Adapter); -#endif - - -#endif // __INC_HAL8192CPHYCFG_H - +/****************************************************************************** + * + * 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 __INC_HAL8188EPHYCFG_H__ +#define __INC_HAL8188EPHYCFG_H__ + + +/*--------------------------Define Parameters-------------------------------*/ +#define LOOP_LIMIT 5 +#define MAX_STALL_TIME 50 //us +#define AntennaDiversityValue 0x80 //(Adapter->bSoftwareAntennaDiversity ? 0x00:0x80) +#define MAX_TXPWR_IDX_NMODE_92S 63 +#define Reset_Cnt_Limit 3 + +#define IQK_MAC_REG_NUM 4 +#define IQK_ADDA_REG_NUM 16 +#define IQK_BB_REG_NUM 9 +#define HP_THERMAL_NUM 8 + +#ifdef CONFIG_PCI_HCI +#define MAX_AGGR_NUM 0x0B +#else +#define MAX_AGGR_NUM 0x07 +#endif // CONFIG_PCI_HCI + + +/*--------------------------Define Parameters-------------------------------*/ + + +/*------------------------------Define structure----------------------------*/ +typedef enum _SwChnlCmdID{ + CmdID_End, + CmdID_SetTxPowerLevel, + CmdID_BBRegWrite10, + CmdID_WritePortUlong, + CmdID_WritePortUshort, + CmdID_WritePortUchar, + CmdID_RF_WriteReg, +}SwChnlCmdID; + + +/* 1. Switch channel related */ +typedef struct _SwChnlCmd{ + SwChnlCmdID CmdID; + u32 Para1; + u32 Para2; + u32 msDelay; +}SwChnlCmd; + +typedef enum _HW90_BLOCK{ + HW90_BLOCK_MAC = 0, + HW90_BLOCK_PHY0 = 1, + HW90_BLOCK_PHY1 = 2, + HW90_BLOCK_RF = 3, + HW90_BLOCK_MAXIMUM = 4, // Never use this +}HW90_BLOCK_E, *PHW90_BLOCK_E; + +typedef enum _RF_RADIO_PATH{ + RF_PATH_A = 0, //Radio Path A + RF_PATH_B = 1, //Radio Path B + RF_PATH_C = 2, //Radio Path C + RF_PATH_D = 3, //Radio Path D + //RF_PATH_MAX //Max RF number 90 support +}RF_RADIO_PATH_E, *PRF_RADIO_PATH_E; + +#define MAX_PG_GROUP 13 + +#define RF_PATH_MAX 2 +#define MAX_RF_PATH RF_PATH_MAX +#define MAX_TX_COUNT_88E 1 +#define MAX_TX_COUNT MAX_TX_COUNT_88E // 4 //path numbers + +#define CHANNEL_MAX_NUMBER 14 // 14 is the max channel number +#define MAX_CHNL_GROUP_24G 6 // ch1~2, ch3~5, ch6~8,ch9~11,ch12~13,CH 14 total six groups +#define CHANNEL_GROUP_MAX_88E 6 + +typedef enum _WIRELESS_MODE { + WIRELESS_MODE_UNKNOWN = 0x00, + WIRELESS_MODE_A = BIT2, + WIRELESS_MODE_B = BIT0, + WIRELESS_MODE_G = BIT1, + WIRELESS_MODE_AUTO = BIT5, + WIRELESS_MODE_N_24G = BIT3, + WIRELESS_MODE_N_5G = BIT4, + WIRELESS_MODE_AC = BIT6 +} WIRELESS_MODE; + + +typedef enum _PHY_Rate_Tx_Power_Offset_Area{ + RA_OFFSET_LEGACY_OFDM1, + RA_OFFSET_LEGACY_OFDM2, + RA_OFFSET_HT_OFDM1, + RA_OFFSET_HT_OFDM2, + RA_OFFSET_HT_OFDM3, + RA_OFFSET_HT_OFDM4, + RA_OFFSET_HT_CCK, +}RA_OFFSET_AREA,*PRA_OFFSET_AREA; + + +/* BB/RF related */ +typedef enum _RF_TYPE_8190P{ + RF_TYPE_MIN, // 0 + RF_8225=1, // 1 11b/g RF for verification only + RF_8256=2, // 2 11b/g/n + RF_8258=3, // 3 11a/b/g/n RF + RF_6052=4, // 4 11b/g/n RF + //RF_6052=5, // 4 11b/g/n RF + // TODO: We sholud remove this psudo PHY RF after we get new RF. + RF_PSEUDO_11N=5, // 5, It is a temporality RF. +}RF_TYPE_8190P_E,*PRF_TYPE_8190P_E; + + +typedef struct _BB_REGISTER_DEFINITION{ + u32 rfintfs; // set software control: + // 0x870~0x877[8 bytes] + + u32 rfintfi; // readback data: + // 0x8e0~0x8e7[8 bytes] + + u32 rfintfo; // output data: + // 0x860~0x86f [16 bytes] + + u32 rfintfe; // output enable: + // 0x860~0x86f [16 bytes] + + u32 rf3wireOffset; // LSSI data: + // 0x840~0x84f [16 bytes] + + u32 rfLSSI_Select; // BB Band Select: + // 0x878~0x87f [8 bytes] + + u32 rfTxGainStage; // Tx gain stage: + // 0x80c~0x80f [4 bytes] + + u32 rfHSSIPara1; // wire parameter control1 : + // 0x820~0x823,0x828~0x82b, 0x830~0x833, 0x838~0x83b [16 bytes] + + u32 rfHSSIPara2; // wire parameter control2 : + // 0x824~0x827,0x82c~0x82f, 0x834~0x837, 0x83c~0x83f [16 bytes] + + u32 rfSwitchControl; //Tx Rx antenna control : + // 0x858~0x85f [16 bytes] + + u32 rfAGCControl1; //AGC parameter control1 : + // 0xc50~0xc53,0xc58~0xc5b, 0xc60~0xc63, 0xc68~0xc6b [16 bytes] + + u32 rfAGCControl2; //AGC parameter control2 : + // 0xc54~0xc57,0xc5c~0xc5f, 0xc64~0xc67, 0xc6c~0xc6f [16 bytes] + + u32 rfRxIQImbalance; //OFDM Rx IQ imbalance matrix : + // 0xc14~0xc17,0xc1c~0xc1f, 0xc24~0xc27, 0xc2c~0xc2f [16 bytes] + + u32 rfRxAFE; //Rx IQ DC ofset and Rx digital filter, Rx DC notch filter : + // 0xc10~0xc13,0xc18~0xc1b, 0xc20~0xc23, 0xc28~0xc2b [16 bytes] + + u32 rfTxIQImbalance; //OFDM Tx IQ imbalance matrix + // 0xc80~0xc83,0xc88~0xc8b, 0xc90~0xc93, 0xc98~0xc9b [16 bytes] + + u32 rfTxAFE; //Tx IQ DC Offset and Tx DFIR type + // 0xc84~0xc87,0xc8c~0xc8f, 0xc94~0xc97, 0xc9c~0xc9f [16 bytes] + + u32 rfLSSIReadBack; //LSSI RF readback data SI mode + // 0x8a0~0x8af [16 bytes] + + u32 rfLSSIReadBackPi; //LSSI RF readback data PI mode 0x8b8-8bc for Path A and B + +}BB_REGISTER_DEFINITION_T, *PBB_REGISTER_DEFINITION_T; + +typedef struct _R_ANTENNA_SELECT_OFDM{ + u32 r_tx_antenna:4; + u32 r_ant_l:4; + u32 r_ant_non_ht:4; + u32 r_ant_ht1:4; + u32 r_ant_ht2:4; + u32 r_ant_ht_s1:4; + u32 r_ant_non_ht_s1:4; + u32 OFDM_TXSC:2; + u32 Reserved:2; +}R_ANTENNA_SELECT_OFDM; + +typedef struct _R_ANTENNA_SELECT_CCK{ + u8 r_cckrx_enable_2:2; + u8 r_cckrx_enable:2; + u8 r_ccktx_enable:4; +}R_ANTENNA_SELECT_CCK; + +/*------------------------------Define structure----------------------------*/ + + +/*------------------------Export global variable----------------------------*/ +/*------------------------Export global variable----------------------------*/ + + +/*------------------------Export Marco Definition---------------------------*/ +/*------------------------Export Marco Definition---------------------------*/ + + +/*--------------------------Exported Function prototype---------------------*/ +// +// BB and RF register read/write +// +u32 rtl8188e_PHY_QueryBBReg( IN struct adapter *Adapter, + IN u32 RegAddr, + IN u32 BitMask ); +void rtl8188e_PHY_SetBBReg( IN struct adapter *Adapter, + IN u32 RegAddr, + IN u32 BitMask, + IN u32 Data ); +u32 rtl8188e_PHY_QueryRFReg( IN struct adapter * Adapter, + IN RF_RADIO_PATH_E eRFPath, + IN u32 RegAddr, + IN u32 BitMask ); +void rtl8188e_PHY_SetRFReg( IN struct adapter * Adapter, + IN RF_RADIO_PATH_E eRFPath, + IN u32 RegAddr, + IN u32 BitMask, + IN u32 Data ); + +// +// Initialization related function +// +/* MAC/BB/RF HAL config */ +int PHY_MACConfig8188E(IN struct adapter *Adapter ); +int PHY_BBConfig8188E(IN struct adapter *Adapter ); +int PHY_RFConfig8188E(IN struct adapter *Adapter ); + +/* RF config */ +int rtl8188e_PHY_ConfigRFWithParaFile(IN struct adapter *Adapter, IN u8 * pFileName, RF_RADIO_PATH_E eRFPath); +int rtl8188e_PHY_ConfigRFWithHeaderFile( IN struct adapter * Adapter, + IN RF_RADIO_PATH_E eRFPath); + +/* Read initi reg value for tx power setting. */ +void rtl8192c_PHY_GetHWRegOriginalValue( IN struct adapter * Adapter ); + +// +// RF Power setting +// +//extern BOOLEAN PHY_SetRFPowerState(IN struct adapter * Adapter, +// IN RT_RF_POWER_STATE eRFPowerState); + +// +// BB TX Power R/W +// +void PHY_GetTxPowerLevel8188E( IN struct adapter * Adapter, + OUT u32* powerlevel ); +void PHY_SetTxPowerLevel8188E( IN struct adapter * Adapter, + IN u8 channel ); +BOOLEAN PHY_UpdateTxPowerDbm8188E( IN struct adapter *Adapter, + IN int powerInDbm ); + +// +VOID +PHY_ScanOperationBackup8188E(IN struct adapter *Adapter, + IN u8 Operation ); + +// +// Switch bandwidth for 8192S +// +//extern void PHY_SetBWModeCallback8192C( IN PRT_TIMER pTimer ); +void PHY_SetBWMode8188E( IN struct adapter * pAdapter, + IN HT_CHANNEL_WIDTH ChnlWidth, + IN unsigned char Offset ); + +// +// Set FW CMD IO for 8192S. +// +//extern BOOLEAN HalSetIO8192C( IN struct adapter * Adapter, +// IN IO_TYPE IOType); + +// +// Set A2 entry to fw for 8192S +// +extern void FillA2Entry8192C( IN struct adapter * Adapter, + IN u8 index, + IN u8* val); + + +// +// channel switch related funciton +// +//extern void PHY_SwChnlCallback8192C( IN PRT_TIMER pTimer ); +void PHY_SwChnl8188E( IN struct adapter * pAdapter, + IN u8 channel ); + // Call after initialization +void PHY_SwChnlPhy8192C( IN struct adapter * pAdapter, + IN u8 channel ); + +void ChkFwCmdIoDone( IN struct adapter *Adapter); + +// +// BB/MAC/RF other monitor API +// +void PHY_SetMonitorMode8192C(IN struct adapter *pAdapter, + IN BOOLEAN bEnableMonitorMode ); + +BOOLEAN PHY_CheckIsLegalRfPath8192C(IN struct adapter *pAdapter, + IN u32 eRFPath ); + +VOID PHY_SetRFPathSwitch_8188E(IN struct adapter *pAdapter, IN BOOLEAN bMain); + +extern VOID +PHY_SwitchEphyParameter( + IN struct adapter * Adapter + ); + +extern VOID +PHY_EnableHostClkReq( + IN struct adapter * Adapter + ); + +BOOLEAN +SetAntennaConfig92C( + IN struct adapter *Adapter, + IN u8 DefaultAnt + ); + +#ifdef CONFIG_PHY_SETTING_WITH_ODM +VOID +storePwrIndexDiffRateOffset( + IN struct adapter *Adapter, + IN u32 RegAddr, + IN u32 BitMask, + IN u32 Data + ); +#endif //CONFIG_PHY_SETTING_WITH_ODM +/*--------------------------Exported Function prototype---------------------*/ + +#define PHY_QueryBBReg(Adapter, RegAddr, BitMask) rtl8188e_PHY_QueryBBReg((Adapter), (RegAddr), (BitMask)) +#define PHY_SetBBReg(Adapter, RegAddr, BitMask, Data) rtl8188e_PHY_SetBBReg((Adapter), (RegAddr), (BitMask), (Data)) +#define PHY_QueryRFReg(Adapter, eRFPath, RegAddr, BitMask) rtl8188e_PHY_QueryRFReg((Adapter), (eRFPath), (RegAddr), (BitMask)) +#define PHY_SetRFReg(Adapter, eRFPath, RegAddr, BitMask, Data) rtl8188e_PHY_SetRFReg((Adapter), (eRFPath), (RegAddr), (BitMask), (Data)) + +#define PHY_SetMacReg PHY_SetBBReg +#define PHY_QueryMacReg PHY_QueryBBReg + + +// +// Initialization related function +// +/* MAC/BB/RF HAL config */ +//extern s32 PHY_MACConfig8723(struct adapter *padapter); +//s32 PHY_BBConfig8723(struct adapter *padapter); +//s32 PHY_RFConfig8723(struct adapter *padapter); + + + +//================================================================== +// Note: If SIC_ENABLE under PCIE, because of the slow operation +// you should +// 2) "#define RTL8723_FPGA_VERIFICATION 1" in Precomp.h.WlanE.Windows +// 3) "#define RTL8190_Download_Firmware_From_Header 0" in Precomp.h.WlanE.Windows if needed. +// +#if (RTL8188E_SUPPORT == 1) && (RTL8188E_FPGA_TRUE_PHY_VERIFICATION == 1) +#define SIC_ENABLE 1 +#define SIC_HW_SUPPORT 1 +#else +#define SIC_ENABLE 0 +#define SIC_HW_SUPPORT 0 +#endif +//================================================================== + + +#define SIC_MAX_POLL_CNT 5 + +#if(SIC_HW_SUPPORT == 1) +#define SIC_CMD_READY 0 +#define SIC_CMD_PREWRITE 0x1 +#if(RTL8188E_SUPPORT == 1) +#define SIC_CMD_WRITE 0x40 +#define SIC_CMD_PREREAD 0x2 +#define SIC_CMD_READ 0x80 +#define SIC_CMD_INIT 0xf0 +#define SIC_INIT_VAL 0xff + +#define SIC_INIT_REG 0x1b7 +#define SIC_CMD_REG 0x1EB // 1byte +#define SIC_ADDR_REG 0x1E8 // 1b4~1b5, 2 bytes +#define SIC_DATA_REG 0x1EC // 1b0~1b3 +#else +#define SIC_CMD_WRITE 0x11 +#define SIC_CMD_PREREAD 0x2 +#define SIC_CMD_READ 0x12 +#define SIC_CMD_INIT 0x1f +#define SIC_INIT_VAL 0xff + +#define SIC_INIT_REG 0x1b7 +#define SIC_CMD_REG 0x1b6 // 1byte +#define SIC_ADDR_REG 0x1b4 // 1b4~1b5, 2 bytes +#define SIC_DATA_REG 0x1b0 // 1b0~1b3 +#endif +#else +#define SIC_CMD_READY 0 +#define SIC_CMD_WRITE 1 +#define SIC_CMD_READ 2 + +#if(RTL8188E_SUPPORT == 1) +#define SIC_CMD_REG 0x1EB // 1byte +#define SIC_ADDR_REG 0x1E8 // 1b9~1ba, 2 bytes +#define SIC_DATA_REG 0x1EC // 1bc~1bf +#else +#define SIC_CMD_REG 0x1b8 // 1byte +#define SIC_ADDR_REG 0x1b9 // 1b9~1ba, 2 bytes +#define SIC_DATA_REG 0x1bc // 1bc~1bf +#endif +#endif + +#if(SIC_ENABLE == 1) +VOID SIC_Init(IN struct adapter *Adapter); +#endif + + +#endif // __INC_HAL8192CPHYCFG_H diff --git a/include/Hal8188EPhyReg.h b/include/Hal8188EPhyReg.h index f83e609..e0070c2 100755 --- a/include/Hal8188EPhyReg.h +++ b/include/Hal8188EPhyReg.h @@ -1,1112 +1,1111 @@ -/****************************************************************************** - * - * 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 __INC_HAL8188EPHYREG_H__ -#define __INC_HAL8188EPHYREG_H__ -/*--------------------------Define Parameters-------------------------------*/ -// -// BB-PHY register PMAC 0x100 PHY 0x800 - 0xEFF -// 1. PMAC duplicate register due to connection: RF_Mode, TRxRN, NumOf L-STF -// 2. 0x800/0x900/0xA00/0xC00/0xD00/0xE00 -// 3. RF register 0x00-2E -// 4. Bit Mask for BB/RF register -// 5. Other defintion for BB/RF R/W -// - - -// -// 1. PMAC duplicate register due to connection: RF_Mode, TRxRN, NumOf L-STF -// 1. Page1(0x100) -// -#define rPMAC_Reset 0x100 -#define rPMAC_TxStart 0x104 -#define rPMAC_TxLegacySIG 0x108 -#define rPMAC_TxHTSIG1 0x10c -#define rPMAC_TxHTSIG2 0x110 -#define rPMAC_PHYDebug 0x114 -#define rPMAC_TxPacketNum 0x118 -#define rPMAC_TxIdle 0x11c -#define rPMAC_TxMACHeader0 0x120 -#define rPMAC_TxMACHeader1 0x124 -#define rPMAC_TxMACHeader2 0x128 -#define rPMAC_TxMACHeader3 0x12c -#define rPMAC_TxMACHeader4 0x130 -#define rPMAC_TxMACHeader5 0x134 -#define rPMAC_TxDataType 0x138 -#define rPMAC_TxRandomSeed 0x13c -#define rPMAC_CCKPLCPPreamble 0x140 -#define rPMAC_CCKPLCPHeader 0x144 -#define rPMAC_CCKCRC16 0x148 -#define rPMAC_OFDMRxCRC32OK 0x170 -#define rPMAC_OFDMRxCRC32Er 0x174 -#define rPMAC_OFDMRxParityEr 0x178 -#define rPMAC_OFDMRxCRC8Er 0x17c -#define rPMAC_CCKCRxRC16Er 0x180 -#define rPMAC_CCKCRxRC32Er 0x184 -#define rPMAC_CCKCRxRC32OK 0x188 -#define rPMAC_TxStatus 0x18c - -// -// 2. Page2(0x200) -// -// The following two definition are only used for USB interface. -#define RF_BB_CMD_ADDR 0x02c0 // RF/BB read/write command address. -#define RF_BB_CMD_DATA 0x02c4 // RF/BB read/write command data. - -// -// 3. Page8(0x800) -// -#define rFPGA0_RFMOD 0x800 //RF mode & CCK TxSC // RF BW Setting?? - -#define rFPGA0_TxInfo 0x804 // Status report?? -#define rFPGA0_PSDFunction 0x808 - -#define rFPGA0_TxGainStage 0x80c // Set TX PWR init gain? - -#define rFPGA0_RFTiming1 0x810 // Useless now -#define rFPGA0_RFTiming2 0x814 - -#define rFPGA0_XA_HSSIParameter1 0x820 // RF 3 wire register -#define rFPGA0_XA_HSSIParameter2 0x824 -#define rFPGA0_XB_HSSIParameter1 0x828 -#define rFPGA0_XB_HSSIParameter2 0x82c - -#define rFPGA0_XA_LSSIParameter 0x840 -#define rFPGA0_XB_LSSIParameter 0x844 - -#define rFPGA0_RFWakeUpParameter 0x850 // Useless now -#define rFPGA0_RFSleepUpParameter 0x854 - -#define rFPGA0_XAB_SwitchControl 0x858 // RF Channel switch -#define rFPGA0_XCD_SwitchControl 0x85c - -#define rFPGA0_XA_RFInterfaceOE 0x860 // RF Channel switch -#define rFPGA0_XB_RFInterfaceOE 0x864 - -#define rFPGA0_XAB_RFInterfaceSW 0x870 // RF Interface Software Control -#define rFPGA0_XCD_RFInterfaceSW 0x874 - -#define rFPGA0_XAB_RFParameter 0x878 // RF Parameter -#define rFPGA0_XCD_RFParameter 0x87c - -#define rFPGA0_AnalogParameter1 0x880 // Crystal cap setting RF-R/W protection for parameter4?? -#define rFPGA0_AnalogParameter2 0x884 -#define rFPGA0_AnalogParameter3 0x888 -#define rFPGA0_AdDaClockEn 0x888 // enable ad/da clock1 for dual-phy -#define rFPGA0_AnalogParameter4 0x88c - -#define rFPGA0_XA_LSSIReadBack 0x8a0 // Tranceiver LSSI Readback -#define rFPGA0_XB_LSSIReadBack 0x8a4 -#define rFPGA0_XC_LSSIReadBack 0x8a8 -#define rFPGA0_XD_LSSIReadBack 0x8ac - -#define rFPGA0_PSDReport 0x8b4 // Useless now -#define TransceiverA_HSPI_Readback 0x8b8 // Transceiver A HSPI Readback -#define TransceiverB_HSPI_Readback 0x8bc // Transceiver B HSPI Readback -#define rFPGA0_XAB_RFInterfaceRB 0x8e0 // Useless now // RF Interface Readback Value -#define rFPGA0_XCD_RFInterfaceRB 0x8e4 // Useless now - -// -// 4. Page9(0x900) -// -#define rFPGA1_RFMOD 0x900 //RF mode & OFDM TxSC // RF BW Setting?? - -#define rFPGA1_TxBlock 0x904 // Useless now -#define rFPGA1_DebugSelect 0x908 // Useless now -#define rFPGA1_TxInfo 0x90c // Useless now // Status report?? - -// -// 5. PageA(0xA00) -// -// Set Control channel to upper or lower. These settings are required only for 40MHz -#define rCCK0_System 0xa00 - -#define rCCK0_AFESetting 0xa04 // Disable init gain now // Select RX path by RSSI -#define rCCK0_CCA 0xa08 // Disable init gain now // Init gain - -#define rCCK0_RxAGC1 0xa0c //AGC default value, saturation level // Antenna Diversity, RX AGC, LNA Threshold, RX LNA Threshold useless now. Not the same as 90 series -#define rCCK0_RxAGC2 0xa10 //AGC & DAGC - -#define rCCK0_RxHP 0xa14 - -#define rCCK0_DSPParameter1 0xa18 //Timing recovery & Channel estimation threshold -#define rCCK0_DSPParameter2 0xa1c //SQ threshold - -#define rCCK0_TxFilter1 0xa20 -#define rCCK0_TxFilter2 0xa24 -#define rCCK0_DebugPort 0xa28 //debug port and Tx filter3 -#define rCCK0_FalseAlarmReport 0xa2c //0xa2d useless now 0xa30-a4f channel report -#define rCCK0_TRSSIReport 0xa50 -#define rCCK0_RxReport 0xa54 //0xa57 -#define rCCK0_FACounterLower 0xa5c //0xa5b -#define rCCK0_FACounterUpper 0xa58 //0xa5c - -// -// PageB(0xB00) -// -#define rPdp_AntA 0xb00 -#define rPdp_AntA_4 0xb04 -#define rConfig_Pmpd_AntA 0xb28 -#define rConfig_AntA 0xb68 -#define rConfig_AntB 0xb6c -#define rPdp_AntB 0xb70 -#define rPdp_AntB_4 0xb74 -#define rConfig_Pmpd_AntB 0xb98 -#define rAPK 0xbd8 - - - -// -// 6. PageC(0xC00) -// -#define rOFDM0_LSTF 0xc00 - -#define rOFDM0_TRxPathEnable 0xc04 -#define rOFDM0_TRMuxPar 0xc08 -#define rOFDM0_TRSWIsolation 0xc0c - -#define rOFDM0_XARxAFE 0xc10 //RxIQ DC offset, Rx digital filter, DC notch filter -#define rOFDM0_XARxIQImbalance 0xc14 //RxIQ imblance matrix -#define rOFDM0_XBRxAFE 0xc18 -#define rOFDM0_XBRxIQImbalance 0xc1c -#define rOFDM0_XCRxAFE 0xc20 -#define rOFDM0_XCRxIQImbalance 0xc24 -#define rOFDM0_XDRxAFE 0xc28 -#define rOFDM0_XDRxIQImbalance 0xc2c - -#define rOFDM0_RxDetector1 0xc30 //PD,BW & SBD // DM tune init gain -#define rOFDM0_RxDetector2 0xc34 //SBD & Fame Sync. -#define rOFDM0_RxDetector3 0xc38 //Frame Sync. -#define rOFDM0_RxDetector4 0xc3c //PD, SBD, Frame Sync & Short-GI - -#define rOFDM0_RxDSP 0xc40 //Rx Sync Path -#define rOFDM0_CFOandDAGC 0xc44 //CFO & DAGC -#define rOFDM0_CCADropThreshold 0xc48 //CCA Drop threshold -#define rOFDM0_ECCAThreshold 0xc4c // energy CCA - -#define rOFDM0_XAAGCCore1 0xc50 // DIG -#define rOFDM0_XAAGCCore2 0xc54 -#define rOFDM0_XBAGCCore1 0xc58 -#define rOFDM0_XBAGCCore2 0xc5c -#define rOFDM0_XCAGCCore1 0xc60 -#define rOFDM0_XCAGCCore2 0xc64 -#define rOFDM0_XDAGCCore1 0xc68 -#define rOFDM0_XDAGCCore2 0xc6c - -#define rOFDM0_AGCParameter1 0xc70 -#define rOFDM0_AGCParameter2 0xc74 -#define rOFDM0_AGCRSSITable 0xc78 -#define rOFDM0_HTSTFAGC 0xc7c - -#define rOFDM0_XATxIQImbalance 0xc80 // TX PWR TRACK and DIG -#define rOFDM0_XATxAFE 0xc84 -#define rOFDM0_XBTxIQImbalance 0xc88 -#define rOFDM0_XBTxAFE 0xc8c -#define rOFDM0_XCTxIQImbalance 0xc90 -#define rOFDM0_XCTxAFE 0xc94 -#define rOFDM0_XDTxIQImbalance 0xc98 -#define rOFDM0_XDTxAFE 0xc9c - -#define rOFDM0_RxIQExtAnta 0xca0 -#define rOFDM0_TxCoeff1 0xca4 -#define rOFDM0_TxCoeff2 0xca8 -#define rOFDM0_TxCoeff3 0xcac -#define rOFDM0_TxCoeff4 0xcb0 -#define rOFDM0_TxCoeff5 0xcb4 -#define rOFDM0_TxCoeff6 0xcb8 -#define rOFDM0_RxHPParameter 0xce0 -#define rOFDM0_TxPseudoNoiseWgt 0xce4 -#define rOFDM0_FrameSync 0xcf0 -#define rOFDM0_DFSReport 0xcf4 - - -// -// 7. PageD(0xD00) -// -#define rOFDM1_LSTF 0xd00 -#define rOFDM1_TRxPathEnable 0xd04 - -#define rOFDM1_CFO 0xd08 // No setting now -#define rOFDM1_CSI1 0xd10 -#define rOFDM1_SBD 0xd14 -#define rOFDM1_CSI2 0xd18 -#define rOFDM1_CFOTracking 0xd2c -#define rOFDM1_TRxMesaure1 0xd34 -#define rOFDM1_IntfDet 0xd3c -#define rOFDM1_csi_fix_mask 0xd40 -#define rOFDM1_PseudoNoiseStateAB 0xd50 -#define rOFDM1_PseudoNoiseStateCD 0xd54 -#define rOFDM1_RxPseudoNoiseWgt 0xd58 - -#define rOFDM_PHYCounter1 0xda0 //cca, parity fail -#define rOFDM_PHYCounter2 0xda4 //rate illegal, crc8 fail -#define rOFDM_PHYCounter3 0xda8 //MCS not support - -#define rOFDM_ShortCFOAB 0xdac // No setting now -#define rOFDM_ShortCFOCD 0xdb0 -#define rOFDM_LongCFOAB 0xdb4 -#define rOFDM_LongCFOCD 0xdb8 -#define rOFDM_TailCFOAB 0xdbc -#define rOFDM_TailCFOCD 0xdc0 -#define rOFDM_PWMeasure1 0xdc4 -#define rOFDM_PWMeasure2 0xdc8 -#define rOFDM_BWReport 0xdcc -#define rOFDM_AGCReport 0xdd0 -#define rOFDM_RxSNR 0xdd4 -#define rOFDM_RxEVMCSI 0xdd8 -#define rOFDM_SIGReport 0xddc - - -// -// 8. PageE(0xE00) -// -#define rTxAGC_A_Rate18_06 0xe00 -#define rTxAGC_A_Rate54_24 0xe04 -#define rTxAGC_A_CCK1_Mcs32 0xe08 -#define rTxAGC_A_Mcs03_Mcs00 0xe10 -#define rTxAGC_A_Mcs07_Mcs04 0xe14 -#define rTxAGC_A_Mcs11_Mcs08 0xe18 -#define rTxAGC_A_Mcs15_Mcs12 0xe1c - -#define rTxAGC_B_Rate18_06 0x830 -#define rTxAGC_B_Rate54_24 0x834 -#define rTxAGC_B_CCK1_55_Mcs32 0x838 -#define rTxAGC_B_Mcs03_Mcs00 0x83c -#define rTxAGC_B_Mcs07_Mcs04 0x848 -#define rTxAGC_B_Mcs11_Mcs08 0x84c -#define rTxAGC_B_Mcs15_Mcs12 0x868 -#define rTxAGC_B_CCK11_A_CCK2_11 0x86c - -#define rFPGA0_IQK 0xe28 -#define rTx_IQK_Tone_A 0xe30 -#define rRx_IQK_Tone_A 0xe34 -#define rTx_IQK_PI_A 0xe38 -#define rRx_IQK_PI_A 0xe3c - -#define rTx_IQK 0xe40 -#define rRx_IQK 0xe44 -#define rIQK_AGC_Pts 0xe48 -#define rIQK_AGC_Rsp 0xe4c -#define rTx_IQK_Tone_B 0xe50 -#define rRx_IQK_Tone_B 0xe54 -#define rTx_IQK_PI_B 0xe58 -#define rRx_IQK_PI_B 0xe5c -#define rIQK_AGC_Cont 0xe60 - -#define rBlue_Tooth 0xe6c -#define rRx_Wait_CCA 0xe70 -#define rTx_CCK_RFON 0xe74 -#define rTx_CCK_BBON 0xe78 -#define rTx_OFDM_RFON 0xe7c -#define rTx_OFDM_BBON 0xe80 -#define rTx_To_Rx 0xe84 -#define rTx_To_Tx 0xe88 -#define rRx_CCK 0xe8c - -#define rTx_Power_Before_IQK_A 0xe94 -#define rTx_Power_After_IQK_A 0xe9c - -#define rRx_Power_Before_IQK_A 0xea0 -#define rRx_Power_Before_IQK_A_2 0xea4 -#define rRx_Power_After_IQK_A 0xea8 -#define rRx_Power_After_IQK_A_2 0xeac - -#define rTx_Power_Before_IQK_B 0xeb4 -#define rTx_Power_After_IQK_B 0xebc - -#define rRx_Power_Before_IQK_B 0xec0 -#define rRx_Power_Before_IQK_B_2 0xec4 -#define rRx_Power_After_IQK_B 0xec8 -#define rRx_Power_After_IQK_B_2 0xecc - -#define rRx_OFDM 0xed0 -#define rRx_Wait_RIFS 0xed4 -#define rRx_TO_Rx 0xed8 -#define rStandby 0xedc -#define rSleep 0xee0 -#define rPMPD_ANAEN 0xeec - -// -// 7. RF Register 0x00-0x2E (RF 8256) -// RF-0222D 0x00-3F -// -//Zebra1 -#define rZebra1_HSSIEnable 0x0 // Useless now -#define rZebra1_TRxEnable1 0x1 -#define rZebra1_TRxEnable2 0x2 -#define rZebra1_AGC 0x4 -#define rZebra1_ChargePump 0x5 -#define rZebra1_Channel 0x7 // RF channel switch - -//#endif -#define rZebra1_TxGain 0x8 // Useless now -#define rZebra1_TxLPF 0x9 -#define rZebra1_RxLPF 0xb -#define rZebra1_RxHPFCorner 0xc - -//Zebra4 -#define rGlobalCtrl 0 // Useless now -#define rRTL8256_TxLPF 19 -#define rRTL8256_RxLPF 11 - -//RTL8258 -#define rRTL8258_TxLPF 0x11 // Useless now -#define rRTL8258_RxLPF 0x13 -#define rRTL8258_RSSILPF 0xa - -// -// RL6052 Register definition -// -#define RF_AC 0x00 // - -#define RF_IQADJ_G1 0x01 // -#define RF_IQADJ_G2 0x02 // - -#define RF_POW_TRSW 0x05 // - -#define RF_GAIN_RX 0x06 // -#define RF_GAIN_TX 0x07 // - -#define RF_TXM_IDAC 0x08 // -#define RF_IPA_G 0x09 // -#define RF_TXBIAS_G 0x0A -#define RF_TXPA_AG 0x0B -#define RF_IPA_A 0x0C // -#define RF_TXBIAS_A 0x0D -#define RF_BS_PA_APSET_G9_G11 0x0E -#define RF_BS_IQGEN 0x0F // - -#define RF_MODE1 0x10 // -#define RF_MODE2 0x11 // - -#define RF_RX_AGC_HP 0x12 // -#define RF_TX_AGC 0x13 // -#define RF_BIAS 0x14 // -#define RF_IPA 0x15 // -#define RF_TXBIAS 0x16 -#define RF_POW_ABILITY 0x17 // -#define RF_CHNLBW 0x18 // RF channel and BW switch -#define RF_TOP 0x19 // - -#define RF_RX_G1 0x1A // -#define RF_RX_G2 0x1B // - -#define RF_RX_BB2 0x1C // -#define RF_RX_BB1 0x1D // - -#define RF_RCK1 0x1E // -#define RF_RCK2 0x1F // - -#define RF_TX_G1 0x20 // -#define RF_TX_G2 0x21 // -#define RF_TX_G3 0x22 // - -#define RF_TX_BB1 0x23 // - -//#if HARDWARE_TYPE_IS_RTL8192D == 1 -#define RF_T_METER_92D 0x42 // -//#else -#define RF_T_METER_88E 0x42 // -#define RF_T_METER 0x24 // - -//#endif - -#define RF_SYN_G1 0x25 // RF TX Power control -#define RF_SYN_G2 0x26 // RF TX Power control -#define RF_SYN_G3 0x27 // RF TX Power control -#define RF_SYN_G4 0x28 // RF TX Power control -#define RF_SYN_G5 0x29 // RF TX Power control -#define RF_SYN_G6 0x2A // RF TX Power control -#define RF_SYN_G7 0x2B // RF TX Power control -#define RF_SYN_G8 0x2C // RF TX Power control - -#define RF_RCK_OS 0x30 // RF TX PA control -#define RF_TXPA_G1 0x31 // RF TX PA control -#define RF_TXPA_G2 0x32 // RF TX PA control -#define RF_TXPA_G3 0x33 // RF TX PA control -#define RF_TX_BIAS_A 0x35 -#define RF_TX_BIAS_D 0x36 -#define RF_LOBF_9 0x38 -#define RF_RXRF_A3 0x3C // -#define RF_TRSW 0x3F - -#define RF_TXRF_A2 0x41 -#define RF_TXPA_G4 0x46 -#define RF_TXPA_A4 0x4B -#define RF_0x52 0x52 -#define RF_WE_LUT 0xEF - - -// -//Bit Mask -// -// 1. Page1(0x100) -#define bBBResetB 0x100 // Useless now? -#define bGlobalResetB 0x200 -#define bOFDMTxStart 0x4 -#define bCCKTxStart 0x8 -#define bCRC32Debug 0x100 -#define bPMACLoopback 0x10 -#define bTxLSIG 0xffffff -#define bOFDMTxRate 0xf -#define bOFDMTxReserved 0x10 -#define bOFDMTxLength 0x1ffe0 -#define bOFDMTxParity 0x20000 -#define bTxHTSIG1 0xffffff -#define bTxHTMCSRate 0x7f -#define bTxHTBW 0x80 -#define bTxHTLength 0xffff00 -#define bTxHTSIG2 0xffffff -#define bTxHTSmoothing 0x1 -#define bTxHTSounding 0x2 -#define bTxHTReserved 0x4 -#define bTxHTAggreation 0x8 -#define bTxHTSTBC 0x30 -#define bTxHTAdvanceCoding 0x40 -#define bTxHTShortGI 0x80 -#define bTxHTNumberHT_LTF 0x300 -#define bTxHTCRC8 0x3fc00 -#define bCounterReset 0x10000 -#define bNumOfOFDMTx 0xffff -#define bNumOfCCKTx 0xffff0000 -#define bTxIdleInterval 0xffff -#define bOFDMService 0xffff0000 -#define bTxMACHeader 0xffffffff -#define bTxDataInit 0xff -#define bTxHTMode 0x100 -#define bTxDataType 0x30000 -#define bTxRandomSeed 0xffffffff -#define bCCKTxPreamble 0x1 -#define bCCKTxSFD 0xffff0000 -#define bCCKTxSIG 0xff -#define bCCKTxService 0xff00 -#define bCCKLengthExt 0x8000 -#define bCCKTxLength 0xffff0000 -#define bCCKTxCRC16 0xffff -#define bCCKTxStatus 0x1 -#define bOFDMTxStatus 0x2 - -#define IS_BB_REG_OFFSET_92S(_Offset) ((_Offset >= 0x800) && (_Offset <= 0xfff)) - -// 2. Page8(0x800) -#define bRFMOD 0x1 // Reg 0x800 rFPGA0_RFMOD -#define bJapanMode 0x2 -#define bCCKTxSC 0x30 -#define bCCKEn 0x1000000 -#define bOFDMEn 0x2000000 - -#define bOFDMRxADCPhase 0x10000 // Useless now -#define bOFDMTxDACPhase 0x40000 -#define bXATxAGC 0x3f - -#define bAntennaSelect 0x0300 - -#define bXBTxAGC 0xf00 // Reg 80c rFPGA0_TxGainStage -#define bXCTxAGC 0xf000 -#define bXDTxAGC 0xf0000 - -#define bPAStart 0xf0000000 // Useless now -#define bTRStart 0x00f00000 -#define bRFStart 0x0000f000 -#define bBBStart 0x000000f0 -#define bBBCCKStart 0x0000000f -#define bPAEnd 0xf //Reg0x814 -#define bTREnd 0x0f000000 -#define bRFEnd 0x000f0000 -#define bCCAMask 0x000000f0 //T2R -#define bR2RCCAMask 0x00000f00 -#define bHSSI_R2TDelay 0xf8000000 -#define bHSSI_T2RDelay 0xf80000 -#define bContTxHSSI 0x400 //chane gain at continue Tx -#define bIGFromCCK 0x200 -#define bAGCAddress 0x3f -#define bRxHPTx 0x7000 -#define bRxHPT2R 0x38000 -#define bRxHPCCKIni 0xc0000 -#define bAGCTxCode 0xc00000 -#define bAGCRxCode 0x300000 - -#define b3WireDataLength 0x800 // Reg 0x820~84f rFPGA0_XA_HSSIParameter1 -#define b3WireAddressLength 0x400 - -#define b3WireRFPowerDown 0x1 // Useless now -//#define bHWSISelect 0x8 -#define b5GPAPEPolarity 0x40000000 -#define b2GPAPEPolarity 0x80000000 -#define bRFSW_TxDefaultAnt 0x3 -#define bRFSW_TxOptionAnt 0x30 -#define bRFSW_RxDefaultAnt 0x300 -#define bRFSW_RxOptionAnt 0x3000 -#define bRFSI_3WireData 0x1 -#define bRFSI_3WireClock 0x2 -#define bRFSI_3WireLoad 0x4 -#define bRFSI_3WireRW 0x8 -#define bRFSI_3Wire 0xf - -#define bRFSI_RFENV 0x10 // Reg 0x870 rFPGA0_XAB_RFInterfaceSW - -#define bRFSI_TRSW 0x20 // Useless now -#define bRFSI_TRSWB 0x40 -#define bRFSI_ANTSW 0x100 -#define bRFSI_ANTSWB 0x200 -#define bRFSI_PAPE 0x400 -#define bRFSI_PAPE5G 0x800 -#define bBandSelect 0x1 -#define bHTSIG2_GI 0x80 -#define bHTSIG2_Smoothing 0x01 -#define bHTSIG2_Sounding 0x02 -#define bHTSIG2_Aggreaton 0x08 -#define bHTSIG2_STBC 0x30 -#define bHTSIG2_AdvCoding 0x40 -#define bHTSIG2_NumOfHTLTF 0x300 -#define bHTSIG2_CRC8 0x3fc -#define bHTSIG1_MCS 0x7f -#define bHTSIG1_BandWidth 0x80 -#define bHTSIG1_HTLength 0xffff -#define bLSIG_Rate 0xf -#define bLSIG_Reserved 0x10 -#define bLSIG_Length 0x1fffe -#define bLSIG_Parity 0x20 -#define bCCKRxPhase 0x4 - -#define bLSSIReadAddress 0x7f800000 // T65 RF - -#define bLSSIReadEdge 0x80000000 //LSSI "Read" edge signal - -#define bLSSIReadBackData 0xfffff // T65 RF - -#define bLSSIReadOKFlag 0x1000 // Useless now -#define bCCKSampleRate 0x8 //0: 44MHz, 1:88MHz -#define bRegulator0Standby 0x1 -#define bRegulatorPLLStandby 0x2 -#define bRegulator1Standby 0x4 -#define bPLLPowerUp 0x8 -#define bDPLLPowerUp 0x10 -#define bDA10PowerUp 0x20 -#define bAD7PowerUp 0x200 -#define bDA6PowerUp 0x2000 -#define bXtalPowerUp 0x4000 -#define b40MDClkPowerUP 0x8000 -#define bDA6DebugMode 0x20000 -#define bDA6Swing 0x380000 - -#define bADClkPhase 0x4000000 // Reg 0x880 rFPGA0_AnalogParameter1 20/40 CCK support switch 40/80 BB MHZ - -#define b80MClkDelay 0x18000000 // Useless -#define bAFEWatchDogEnable 0x20000000 - -#define bXtalCap01 0xc0000000 // Reg 0x884 rFPGA0_AnalogParameter2 Crystal cap -#define bXtalCap23 0x3 -#define bXtalCap92x 0x0f000000 -#define bXtalCap 0x0f000000 - -#define bIntDifClkEnable 0x400 // Useless -#define bExtSigClkEnable 0x800 -#define bBandgapMbiasPowerUp 0x10000 -#define bAD11SHGain 0xc0000 -#define bAD11InputRange 0x700000 -#define bAD11OPCurrent 0x3800000 -#define bIPathLoopback 0x4000000 -#define bQPathLoopback 0x8000000 -#define bAFELoopback 0x10000000 -#define bDA10Swing 0x7e0 -#define bDA10Reverse 0x800 -#define bDAClkSource 0x1000 -#define bAD7InputRange 0x6000 -#define bAD7Gain 0x38000 -#define bAD7OutputCMMode 0x40000 -#define bAD7InputCMMode 0x380000 -#define bAD7Current 0xc00000 -#define bRegulatorAdjust 0x7000000 -#define bAD11PowerUpAtTx 0x1 -#define bDA10PSAtTx 0x10 -#define bAD11PowerUpAtRx 0x100 -#define bDA10PSAtRx 0x1000 -#define bCCKRxAGCFormat 0x200 -#define bPSDFFTSamplepPoint 0xc000 -#define bPSDAverageNum 0x3000 -#define bIQPathControl 0xc00 -#define bPSDFreq 0x3ff -#define bPSDAntennaPath 0x30 -#define bPSDIQSwitch 0x40 -#define bPSDRxTrigger 0x400000 -#define bPSDTxTrigger 0x80000000 -#define bPSDSineToneScale 0x7f000000 -#define bPSDReport 0xffff - -// 3. Page9(0x900) -#define bOFDMTxSC 0x30000000 // Useless -#define bCCKTxOn 0x1 -#define bOFDMTxOn 0x2 -#define bDebugPage 0xfff //reset debug page and also HWord, LWord -#define bDebugItem 0xff //reset debug page and LWord -#define bAntL 0x10 -#define bAntNonHT 0x100 -#define bAntHT1 0x1000 -#define bAntHT2 0x10000 -#define bAntHT1S1 0x100000 -#define bAntNonHTS1 0x1000000 - -// 4. PageA(0xA00) -#define bCCKBBMode 0x3 // Useless -#define bCCKTxPowerSaving 0x80 -#define bCCKRxPowerSaving 0x40 - -#define bCCKSideBand 0x10 // Reg 0xa00 rCCK0_System 20/40 switch - -#define bCCKScramble 0x8 // Useless -#define bCCKAntDiversity 0x8000 -#define bCCKCarrierRecovery 0x4000 -#define bCCKTxRate 0x3000 -#define bCCKDCCancel 0x0800 -#define bCCKISICancel 0x0400 -#define bCCKMatchFilter 0x0200 -#define bCCKEqualizer 0x0100 -#define bCCKPreambleDetect 0x800000 -#define bCCKFastFalseCCA 0x400000 -#define bCCKChEstStart 0x300000 -#define bCCKCCACount 0x080000 -#define bCCKcs_lim 0x070000 -#define bCCKBistMode 0x80000000 -#define bCCKCCAMask 0x40000000 -#define bCCKTxDACPhase 0x4 -#define bCCKRxADCPhase 0x20000000 //r_rx_clk -#define bCCKr_cp_mode0 0x0100 -#define bCCKTxDCOffset 0xf0 -#define bCCKRxDCOffset 0xf -#define bCCKCCAMode 0xc000 -#define bCCKFalseCS_lim 0x3f00 -#define bCCKCS_ratio 0xc00000 -#define bCCKCorgBit_sel 0x300000 -#define bCCKPD_lim 0x0f0000 -#define bCCKNewCCA 0x80000000 -#define bCCKRxHPofIG 0x8000 -#define bCCKRxIG 0x7f00 -#define bCCKLNAPolarity 0x800000 -#define bCCKRx1stGain 0x7f0000 -#define bCCKRFExtend 0x20000000 //CCK Rx Iinital gain polarity -#define bCCKRxAGCSatLevel 0x1f000000 -#define bCCKRxAGCSatCount 0xe0 -#define bCCKRxRFSettle 0x1f //AGCsamp_dly -#define bCCKFixedRxAGC 0x8000 -//#define bCCKRxAGCFormat 0x4000 //remove to HSSI register 0x824 -#define bCCKAntennaPolarity 0x2000 -#define bCCKTxFilterType 0x0c00 -#define bCCKRxAGCReportType 0x0300 -#define bCCKRxDAGCEn 0x80000000 -#define bCCKRxDAGCPeriod 0x20000000 -#define bCCKRxDAGCSatLevel 0x1f000000 -#define bCCKTimingRecovery 0x800000 -#define bCCKTxC0 0x3f0000 -#define bCCKTxC1 0x3f000000 -#define bCCKTxC2 0x3f -#define bCCKTxC3 0x3f00 -#define bCCKTxC4 0x3f0000 -#define bCCKTxC5 0x3f000000 -#define bCCKTxC6 0x3f -#define bCCKTxC7 0x3f00 -#define bCCKDebugPort 0xff0000 -#define bCCKDACDebug 0x0f000000 -#define bCCKFalseAlarmEnable 0x8000 -#define bCCKFalseAlarmRead 0x4000 -#define bCCKTRSSI 0x7f -#define bCCKRxAGCReport 0xfe -#define bCCKRxReport_AntSel 0x80000000 -#define bCCKRxReport_MFOff 0x40000000 -#define bCCKRxRxReport_SQLoss 0x20000000 -#define bCCKRxReport_Pktloss 0x10000000 -#define bCCKRxReport_Lockedbit 0x08000000 -#define bCCKRxReport_RateError 0x04000000 -#define bCCKRxReport_RxRate 0x03000000 -#define bCCKRxFACounterLower 0xff -#define bCCKRxFACounterUpper 0xff000000 -#define bCCKRxHPAGCStart 0xe000 -#define bCCKRxHPAGCFinal 0x1c00 -#define bCCKRxFalseAlarmEnable 0x8000 -#define bCCKFACounterFreeze 0x4000 -#define bCCKTxPathSel 0x10000000 -#define bCCKDefaultRxPath 0xc000000 -#define bCCKOptionRxPath 0x3000000 - -// 5. PageC(0xC00) -#define bNumOfSTF 0x3 // Useless -#define bShift_L 0xc0 -#define bGI_TH 0xc -#define bRxPathA 0x1 -#define bRxPathB 0x2 -#define bRxPathC 0x4 -#define bRxPathD 0x8 -#define bTxPathA 0x1 -#define bTxPathB 0x2 -#define bTxPathC 0x4 -#define bTxPathD 0x8 -#define bTRSSIFreq 0x200 -#define bADCBackoff 0x3000 -#define bDFIRBackoff 0xc000 -#define bTRSSILatchPhase 0x10000 -#define bRxIDCOffset 0xff -#define bRxQDCOffset 0xff00 -#define bRxDFIRMode 0x1800000 -#define bRxDCNFType 0xe000000 -#define bRXIQImb_A 0x3ff -#define bRXIQImb_B 0xfc00 -#define bRXIQImb_C 0x3f0000 -#define bRXIQImb_D 0xffc00000 -#define bDC_dc_Notch 0x60000 -#define bRxNBINotch 0x1f000000 -#define bPD_TH 0xf -#define bPD_TH_Opt2 0xc000 -#define bPWED_TH 0x700 -#define bIfMF_Win_L 0x800 -#define bPD_Option 0x1000 -#define bMF_Win_L 0xe000 -#define bBW_Search_L 0x30000 -#define bwin_enh_L 0xc0000 -#define bBW_TH 0x700000 -#define bED_TH2 0x3800000 -#define bBW_option 0x4000000 -#define bRatio_TH 0x18000000 -#define bWindow_L 0xe0000000 -#define bSBD_Option 0x1 -#define bFrame_TH 0x1c -#define bFS_Option 0x60 -#define bDC_Slope_check 0x80 -#define bFGuard_Counter_DC_L 0xe00 -#define bFrame_Weight_Short 0x7000 -#define bSub_Tune 0xe00000 -#define bFrame_DC_Length 0xe000000 -#define bSBD_start_offset 0x30000000 -#define bFrame_TH_2 0x7 -#define bFrame_GI2_TH 0x38 -#define bGI2_Sync_en 0x40 -#define bSarch_Short_Early 0x300 -#define bSarch_Short_Late 0xc00 -#define bSarch_GI2_Late 0x70000 -#define bCFOAntSum 0x1 -#define bCFOAcc 0x2 -#define bCFOStartOffset 0xc -#define bCFOLookBack 0x70 -#define bCFOSumWeight 0x80 -#define bDAGCEnable 0x10000 -#define bTXIQImb_A 0x3ff -#define bTXIQImb_B 0xfc00 -#define bTXIQImb_C 0x3f0000 -#define bTXIQImb_D 0xffc00000 -#define bTxIDCOffset 0xff -#define bTxQDCOffset 0xff00 -#define bTxDFIRMode 0x10000 -#define bTxPesudoNoiseOn 0x4000000 -#define bTxPesudoNoise_A 0xff -#define bTxPesudoNoise_B 0xff00 -#define bTxPesudoNoise_C 0xff0000 -#define bTxPesudoNoise_D 0xff000000 -#define bCCADropOption 0x20000 -#define bCCADropThres 0xfff00000 -#define bEDCCA_H 0xf -#define bEDCCA_L 0xf0 -#define bLambda_ED 0x300 -#define bRxInitialGain 0x7f -#define bRxAntDivEn 0x80 -#define bRxAGCAddressForLNA 0x7f00 -#define bRxHighPowerFlow 0x8000 -#define bRxAGCFreezeThres 0xc0000 -#define bRxFreezeStep_AGC1 0x300000 -#define bRxFreezeStep_AGC2 0xc00000 -#define bRxFreezeStep_AGC3 0x3000000 -#define bRxFreezeStep_AGC0 0xc000000 -#define bRxRssi_Cmp_En 0x10000000 -#define bRxQuickAGCEn 0x20000000 -#define bRxAGCFreezeThresMode 0x40000000 -#define bRxOverFlowCheckType 0x80000000 -#define bRxAGCShift 0x7f -#define bTRSW_Tri_Only 0x80 -#define bPowerThres 0x300 -#define bRxAGCEn 0x1 -#define bRxAGCTogetherEn 0x2 -#define bRxAGCMin 0x4 -#define bRxHP_Ini 0x7 -#define bRxHP_TRLNA 0x70 -#define bRxHP_RSSI 0x700 -#define bRxHP_BBP1 0x7000 -#define bRxHP_BBP2 0x70000 -#define bRxHP_BBP3 0x700000 -#define bRSSI_H 0x7f0000 //the threshold for high power -#define bRSSI_Gen 0x7f000000 //the threshold for ant diversity -#define bRxSettle_TRSW 0x7 -#define bRxSettle_LNA 0x38 -#define bRxSettle_RSSI 0x1c0 -#define bRxSettle_BBP 0xe00 -#define bRxSettle_RxHP 0x7000 -#define bRxSettle_AntSW_RSSI 0x38000 -#define bRxSettle_AntSW 0xc0000 -#define bRxProcessTime_DAGC 0x300000 -#define bRxSettle_HSSI 0x400000 -#define bRxProcessTime_BBPPW 0x800000 -#define bRxAntennaPowerShift 0x3000000 -#define bRSSITableSelect 0xc000000 -#define bRxHP_Final 0x7000000 -#define bRxHTSettle_BBP 0x7 -#define bRxHTSettle_HSSI 0x8 -#define bRxHTSettle_RxHP 0x70 -#define bRxHTSettle_BBPPW 0x80 -#define bRxHTSettle_Idle 0x300 -#define bRxHTSettle_Reserved 0x1c00 -#define bRxHTRxHPEn 0x8000 -#define bRxHTAGCFreezeThres 0x30000 -#define bRxHTAGCTogetherEn 0x40000 -#define bRxHTAGCMin 0x80000 -#define bRxHTAGCEn 0x100000 -#define bRxHTDAGCEn 0x200000 -#define bRxHTRxHP_BBP 0x1c00000 -#define bRxHTRxHP_Final 0xe0000000 -#define bRxPWRatioTH 0x3 -#define bRxPWRatioEn 0x4 -#define bRxMFHold 0x3800 -#define bRxPD_Delay_TH1 0x38 -#define bRxPD_Delay_TH2 0x1c0 -#define bRxPD_DC_COUNT_MAX 0x600 -//#define bRxMF_Hold 0x3800 -#define bRxPD_Delay_TH 0x8000 -#define bRxProcess_Delay 0xf0000 -#define bRxSearchrange_GI2_Early 0x700000 -#define bRxFrame_Guard_Counter_L 0x3800000 -#define bRxSGI_Guard_L 0xc000000 -#define bRxSGI_Search_L 0x30000000 -#define bRxSGI_TH 0xc0000000 -#define bDFSCnt0 0xff -#define bDFSCnt1 0xff00 -#define bDFSFlag 0xf0000 -#define bMFWeightSum 0x300000 -#define bMinIdxTH 0x7f000000 -#define bDAFormat 0x40000 -#define bTxChEmuEnable 0x01000000 -#define bTRSWIsolation_A 0x7f -#define bTRSWIsolation_B 0x7f00 -#define bTRSWIsolation_C 0x7f0000 -#define bTRSWIsolation_D 0x7f000000 -#define bExtLNAGain 0x7c00 - -// 6. PageE(0xE00) -#define bSTBCEn 0x4 // Useless -#define bAntennaMapping 0x10 -#define bNss 0x20 -#define bCFOAntSumD 0x200 -#define bPHYCounterReset 0x8000000 -#define bCFOReportGet 0x4000000 -#define bOFDMContinueTx 0x10000000 -#define bOFDMSingleCarrier 0x20000000 -#define bOFDMSingleTone 0x40000000 -//#define bRxPath1 0x01 -//#define bRxPath2 0x02 -//#define bRxPath3 0x04 -//#define bRxPath4 0x08 -//#define bTxPath1 0x10 -//#define bTxPath2 0x20 -#define bHTDetect 0x100 -#define bCFOEn 0x10000 -#define bCFOValue 0xfff00000 -#define bSigTone_Re 0x3f -#define bSigTone_Im 0x7f00 -#define bCounter_CCA 0xffff -#define bCounter_ParityFail 0xffff0000 -#define bCounter_RateIllegal 0xffff -#define bCounter_CRC8Fail 0xffff0000 -#define bCounter_MCSNoSupport 0xffff -#define bCounter_FastSync 0xffff -#define bShortCFO 0xfff -#define bShortCFOTLength 12 //total -#define bShortCFOFLength 11 //fraction -#define bLongCFO 0x7ff -#define bLongCFOTLength 11 -#define bLongCFOFLength 11 -#define bTailCFO 0x1fff -#define bTailCFOTLength 13 -#define bTailCFOFLength 12 -#define bmax_en_pwdB 0xffff -#define bCC_power_dB 0xffff0000 -#define bnoise_pwdB 0xffff -#define bPowerMeasTLength 10 -#define bPowerMeasFLength 3 -#define bRx_HT_BW 0x1 -#define bRxSC 0x6 -#define bRx_HT 0x8 -#define bNB_intf_det_on 0x1 -#define bIntf_win_len_cfg 0x30 -#define bNB_Intf_TH_cfg 0x1c0 -#define bRFGain 0x3f -#define bTableSel 0x40 -#define bTRSW 0x80 -#define bRxSNR_A 0xff -#define bRxSNR_B 0xff00 -#define bRxSNR_C 0xff0000 -#define bRxSNR_D 0xff000000 -#define bSNREVMTLength 8 -#define bSNREVMFLength 1 -#define bCSI1st 0xff -#define bCSI2nd 0xff00 -#define bRxEVM1st 0xff0000 -#define bRxEVM2nd 0xff000000 -#define bSIGEVM 0xff -#define bPWDB 0xff00 -#define bSGIEN 0x10000 - -#define bSFactorQAM1 0xf // Useless -#define bSFactorQAM2 0xf0 -#define bSFactorQAM3 0xf00 -#define bSFactorQAM4 0xf000 -#define bSFactorQAM5 0xf0000 -#define bSFactorQAM6 0xf0000 -#define bSFactorQAM7 0xf00000 -#define bSFactorQAM8 0xf000000 -#define bSFactorQAM9 0xf0000000 -#define bCSIScheme 0x100000 - -#define bNoiseLvlTopSet 0x3 // Useless -#define bChSmooth 0x4 -#define bChSmoothCfg1 0x38 -#define bChSmoothCfg2 0x1c0 -#define bChSmoothCfg3 0xe00 -#define bChSmoothCfg4 0x7000 -#define bMRCMode 0x800000 -#define bTHEVMCfg 0x7000000 - -#define bLoopFitType 0x1 // Useless -#define bUpdCFO 0x40 -#define bUpdCFOOffData 0x80 -#define bAdvUpdCFO 0x100 -#define bAdvTimeCtrl 0x800 -#define bUpdClko 0x1000 -#define bFC 0x6000 -#define bTrackingMode 0x8000 -#define bPhCmpEnable 0x10000 -#define bUpdClkoLTF 0x20000 -#define bComChCFO 0x40000 -#define bCSIEstiMode 0x80000 -#define bAdvUpdEqz 0x100000 -#define bUChCfg 0x7000000 -#define bUpdEqz 0x8000000 - -//Rx Pseduo noise -#define bRxPesudoNoiseOn 0x20000000 // Useless -#define bRxPesudoNoise_A 0xff -#define bRxPesudoNoise_B 0xff00 -#define bRxPesudoNoise_C 0xff0000 -#define bRxPesudoNoise_D 0xff000000 -#define bPesudoNoiseState_A 0xffff -#define bPesudoNoiseState_B 0xffff0000 -#define bPesudoNoiseState_C 0xffff -#define bPesudoNoiseState_D 0xffff0000 - -//7. RF Register -//Zebra1 -#define bZebra1_HSSIEnable 0x8 // Useless -#define bZebra1_TRxControl 0xc00 -#define bZebra1_TRxGainSetting 0x07f -#define bZebra1_RxCorner 0xc00 -#define bZebra1_TxChargePump 0x38 -#define bZebra1_RxChargePump 0x7 -#define bZebra1_ChannelNum 0xf80 -#define bZebra1_TxLPFBW 0x400 -#define bZebra1_RxLPFBW 0x600 - -//Zebra4 -#define bRTL8256RegModeCtrl1 0x100 // Useless -#define bRTL8256RegModeCtrl0 0x40 -#define bRTL8256_TxLPFBW 0x18 -#define bRTL8256_RxLPFBW 0x600 - -//RTL8258 -#define bRTL8258_TxLPFBW 0xc // Useless -#define bRTL8258_RxLPFBW 0xc00 -#define bRTL8258_RSSILPFBW 0xc0 - - -// -// Other Definition -// - -//byte endable for sb_write -#define bByte0 0x1 // Useless -#define bByte1 0x2 -#define bByte2 0x4 -#define bByte3 0x8 -#define bWord0 0x3 -#define bWord1 0xc -#define bDWord 0xf - -//for PutRegsetting & GetRegSetting BitMask -#define bMaskByte0 0xff // Reg 0xc50 rOFDM0_XAAGCCore~0xC6f -#define bMaskByte1 0xff00 -#define bMaskByte2 0xff0000 -#define bMaskByte3 0xff000000 -#define bMaskHWord 0xffff0000 -#define bMaskLWord 0x0000ffff -#define bMaskDWord 0xffffffff -#define bMask12Bits 0xfff -#define bMaskH4Bits 0xf0000000 -#define bMaskOFDM_D 0xffc00000 -#define bMaskCCK 0x3f3f3f3f - -//for PutRFRegsetting & GetRFRegSetting BitMask -//#define bMask12Bits 0xfffff // RF Reg mask bits -//#define bMask20Bits 0xfffff // RF Reg mask bits T65 RF -#define bRFRegOffsetMask 0xfffff - -#define bEnable 0x1 // Useless -#define bDisable 0x0 - -#define LeftAntenna 0x0 // Useless -#define RightAntenna 0x1 - -#define tCheckTxStatus 500 //500ms // Useless -#define tUpdateRxCounter 100 //100ms - -#define rateCCK 0 // Useless -#define rateOFDM 1 -#define rateHT 2 - -//define Register-End -#define bPMAC_End 0x1ff // Useless -#define bFPGAPHY0_End 0x8ff -#define bFPGAPHY1_End 0x9ff -#define bCCKPHY0_End 0xaff -#define bOFDMPHY0_End 0xcff -#define bOFDMPHY1_End 0xdff - -//define max debug item in each debug page -//#define bMaxItem_FPGA_PHY0 0x9 -//#define bMaxItem_FPGA_PHY1 0x3 -//#define bMaxItem_PHY_11B 0x16 -//#define bMaxItem_OFDM_PHY0 0x29 -//#define bMaxItem_OFDM_PHY1 0x0 - -#define bPMACControl 0x0 // Useless -#define bWMACControl 0x1 -#define bWNICControl 0x2 - -#define PathA 0x0 // Useless -#define PathB 0x1 -#define PathC 0x2 -#define PathD 0x3 - -/*--------------------------Define Parameters-------------------------------*/ - - -#endif - +/****************************************************************************** + * + * 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 __INC_HAL8188EPHYREG_H__ +#define __INC_HAL8188EPHYREG_H__ +/*--------------------------Define Parameters-------------------------------*/ +// +// BB-PHY register PMAC 0x100 PHY 0x800 - 0xEFF +// 1. PMAC duplicate register due to connection: RF_Mode, TRxRN, NumOf L-STF +// 2. 0x800/0x900/0xA00/0xC00/0xD00/0xE00 +// 3. RF register 0x00-2E +// 4. Bit Mask for BB/RF register +// 5. Other defintion for BB/RF R/W +// + + +// +// 1. PMAC duplicate register due to connection: RF_Mode, TRxRN, NumOf L-STF +// 1. Page1(0x100) +// +#define rPMAC_Reset 0x100 +#define rPMAC_TxStart 0x104 +#define rPMAC_TxLegacySIG 0x108 +#define rPMAC_TxHTSIG1 0x10c +#define rPMAC_TxHTSIG2 0x110 +#define rPMAC_PHYDebug 0x114 +#define rPMAC_TxPacketNum 0x118 +#define rPMAC_TxIdle 0x11c +#define rPMAC_TxMACHeader0 0x120 +#define rPMAC_TxMACHeader1 0x124 +#define rPMAC_TxMACHeader2 0x128 +#define rPMAC_TxMACHeader3 0x12c +#define rPMAC_TxMACHeader4 0x130 +#define rPMAC_TxMACHeader5 0x134 +#define rPMAC_TxDataType 0x138 +#define rPMAC_TxRandomSeed 0x13c +#define rPMAC_CCKPLCPPreamble 0x140 +#define rPMAC_CCKPLCPHeader 0x144 +#define rPMAC_CCKCRC16 0x148 +#define rPMAC_OFDMRxCRC32OK 0x170 +#define rPMAC_OFDMRxCRC32Er 0x174 +#define rPMAC_OFDMRxParityEr 0x178 +#define rPMAC_OFDMRxCRC8Er 0x17c +#define rPMAC_CCKCRxRC16Er 0x180 +#define rPMAC_CCKCRxRC32Er 0x184 +#define rPMAC_CCKCRxRC32OK 0x188 +#define rPMAC_TxStatus 0x18c + +// +// 2. Page2(0x200) +// +// The following two definition are only used for USB interface. +#define RF_BB_CMD_ADDR 0x02c0 // RF/BB read/write command address. +#define RF_BB_CMD_DATA 0x02c4 // RF/BB read/write command data. + +// +// 3. Page8(0x800) +// +#define rFPGA0_RFMOD 0x800 //RF mode & CCK TxSC // RF BW Setting?? + +#define rFPGA0_TxInfo 0x804 // Status report?? +#define rFPGA0_PSDFunction 0x808 + +#define rFPGA0_TxGainStage 0x80c // Set TX PWR init gain? + +#define rFPGA0_RFTiming1 0x810 // Useless now +#define rFPGA0_RFTiming2 0x814 + +#define rFPGA0_XA_HSSIParameter1 0x820 // RF 3 wire register +#define rFPGA0_XA_HSSIParameter2 0x824 +#define rFPGA0_XB_HSSIParameter1 0x828 +#define rFPGA0_XB_HSSIParameter2 0x82c + +#define rFPGA0_XA_LSSIParameter 0x840 +#define rFPGA0_XB_LSSIParameter 0x844 + +#define rFPGA0_RFWakeUpParameter 0x850 // Useless now +#define rFPGA0_RFSleepUpParameter 0x854 + +#define rFPGA0_XAB_SwitchControl 0x858 // RF Channel switch +#define rFPGA0_XCD_SwitchControl 0x85c + +#define rFPGA0_XA_RFInterfaceOE 0x860 // RF Channel switch +#define rFPGA0_XB_RFInterfaceOE 0x864 + +#define rFPGA0_XAB_RFInterfaceSW 0x870 // RF Interface Software Control +#define rFPGA0_XCD_RFInterfaceSW 0x874 + +#define rFPGA0_XAB_RFParameter 0x878 // RF Parameter +#define rFPGA0_XCD_RFParameter 0x87c + +#define rFPGA0_AnalogParameter1 0x880 // Crystal cap setting RF-R/W protection for parameter4?? +#define rFPGA0_AnalogParameter2 0x884 +#define rFPGA0_AnalogParameter3 0x888 +#define rFPGA0_AdDaClockEn 0x888 // enable ad/da clock1 for dual-phy +#define rFPGA0_AnalogParameter4 0x88c + +#define rFPGA0_XA_LSSIReadBack 0x8a0 // Tranceiver LSSI Readback +#define rFPGA0_XB_LSSIReadBack 0x8a4 +#define rFPGA0_XC_LSSIReadBack 0x8a8 +#define rFPGA0_XD_LSSIReadBack 0x8ac + +#define rFPGA0_PSDReport 0x8b4 // Useless now +#define TransceiverA_HSPI_Readback 0x8b8 // Transceiver A HSPI Readback +#define TransceiverB_HSPI_Readback 0x8bc // Transceiver B HSPI Readback +#define rFPGA0_XAB_RFInterfaceRB 0x8e0 // Useless now // RF Interface Readback Value +#define rFPGA0_XCD_RFInterfaceRB 0x8e4 // Useless now + +// +// 4. Page9(0x900) +// +#define rFPGA1_RFMOD 0x900 //RF mode & OFDM TxSC // RF BW Setting?? + +#define rFPGA1_TxBlock 0x904 // Useless now +#define rFPGA1_DebugSelect 0x908 // Useless now +#define rFPGA1_TxInfo 0x90c // Useless now // Status report?? + +// +// 5. PageA(0xA00) +// +// Set Control channel to upper or lower. These settings are required only for 40MHz +#define rCCK0_System 0xa00 + +#define rCCK0_AFESetting 0xa04 // Disable init gain now // Select RX path by RSSI +#define rCCK0_CCA 0xa08 // Disable init gain now // Init gain + +#define rCCK0_RxAGC1 0xa0c //AGC default value, saturation level // Antenna Diversity, RX AGC, LNA Threshold, RX LNA Threshold useless now. Not the same as 90 series +#define rCCK0_RxAGC2 0xa10 //AGC & DAGC + +#define rCCK0_RxHP 0xa14 + +#define rCCK0_DSPParameter1 0xa18 //Timing recovery & Channel estimation threshold +#define rCCK0_DSPParameter2 0xa1c //SQ threshold + +#define rCCK0_TxFilter1 0xa20 +#define rCCK0_TxFilter2 0xa24 +#define rCCK0_DebugPort 0xa28 //debug port and Tx filter3 +#define rCCK0_FalseAlarmReport 0xa2c //0xa2d useless now 0xa30-a4f channel report +#define rCCK0_TRSSIReport 0xa50 +#define rCCK0_RxReport 0xa54 //0xa57 +#define rCCK0_FACounterLower 0xa5c //0xa5b +#define rCCK0_FACounterUpper 0xa58 //0xa5c + +// +// PageB(0xB00) +// +#define rPdp_AntA 0xb00 +#define rPdp_AntA_4 0xb04 +#define rConfig_Pmpd_AntA 0xb28 +#define rConfig_AntA 0xb68 +#define rConfig_AntB 0xb6c +#define rPdp_AntB 0xb70 +#define rPdp_AntB_4 0xb74 +#define rConfig_Pmpd_AntB 0xb98 +#define rAPK 0xbd8 + + + +// +// 6. PageC(0xC00) +// +#define rOFDM0_LSTF 0xc00 + +#define rOFDM0_TRxPathEnable 0xc04 +#define rOFDM0_TRMuxPar 0xc08 +#define rOFDM0_TRSWIsolation 0xc0c + +#define rOFDM0_XARxAFE 0xc10 //RxIQ DC offset, Rx digital filter, DC notch filter +#define rOFDM0_XARxIQImbalance 0xc14 //RxIQ imblance matrix +#define rOFDM0_XBRxAFE 0xc18 +#define rOFDM0_XBRxIQImbalance 0xc1c +#define rOFDM0_XCRxAFE 0xc20 +#define rOFDM0_XCRxIQImbalance 0xc24 +#define rOFDM0_XDRxAFE 0xc28 +#define rOFDM0_XDRxIQImbalance 0xc2c + +#define rOFDM0_RxDetector1 0xc30 //PD,BW & SBD // DM tune init gain +#define rOFDM0_RxDetector2 0xc34 //SBD & Fame Sync. +#define rOFDM0_RxDetector3 0xc38 //Frame Sync. +#define rOFDM0_RxDetector4 0xc3c //PD, SBD, Frame Sync & Short-GI + +#define rOFDM0_RxDSP 0xc40 //Rx Sync Path +#define rOFDM0_CFOandDAGC 0xc44 //CFO & DAGC +#define rOFDM0_CCADropThreshold 0xc48 //CCA Drop threshold +#define rOFDM0_ECCAThreshold 0xc4c // energy CCA + +#define rOFDM0_XAAGCCore1 0xc50 // DIG +#define rOFDM0_XAAGCCore2 0xc54 +#define rOFDM0_XBAGCCore1 0xc58 +#define rOFDM0_XBAGCCore2 0xc5c +#define rOFDM0_XCAGCCore1 0xc60 +#define rOFDM0_XCAGCCore2 0xc64 +#define rOFDM0_XDAGCCore1 0xc68 +#define rOFDM0_XDAGCCore2 0xc6c + +#define rOFDM0_AGCParameter1 0xc70 +#define rOFDM0_AGCParameter2 0xc74 +#define rOFDM0_AGCRSSITable 0xc78 +#define rOFDM0_HTSTFAGC 0xc7c + +#define rOFDM0_XATxIQImbalance 0xc80 // TX PWR TRACK and DIG +#define rOFDM0_XATxAFE 0xc84 +#define rOFDM0_XBTxIQImbalance 0xc88 +#define rOFDM0_XBTxAFE 0xc8c +#define rOFDM0_XCTxIQImbalance 0xc90 +#define rOFDM0_XCTxAFE 0xc94 +#define rOFDM0_XDTxIQImbalance 0xc98 +#define rOFDM0_XDTxAFE 0xc9c + +#define rOFDM0_RxIQExtAnta 0xca0 +#define rOFDM0_TxCoeff1 0xca4 +#define rOFDM0_TxCoeff2 0xca8 +#define rOFDM0_TxCoeff3 0xcac +#define rOFDM0_TxCoeff4 0xcb0 +#define rOFDM0_TxCoeff5 0xcb4 +#define rOFDM0_TxCoeff6 0xcb8 +#define rOFDM0_RxHPParameter 0xce0 +#define rOFDM0_TxPseudoNoiseWgt 0xce4 +#define rOFDM0_FrameSync 0xcf0 +#define rOFDM0_DFSReport 0xcf4 + + +// +// 7. PageD(0xD00) +// +#define rOFDM1_LSTF 0xd00 +#define rOFDM1_TRxPathEnable 0xd04 + +#define rOFDM1_CFO 0xd08 // No setting now +#define rOFDM1_CSI1 0xd10 +#define rOFDM1_SBD 0xd14 +#define rOFDM1_CSI2 0xd18 +#define rOFDM1_CFOTracking 0xd2c +#define rOFDM1_TRxMesaure1 0xd34 +#define rOFDM1_IntfDet 0xd3c +#define rOFDM1_csi_fix_mask 0xd40 +#define rOFDM1_PseudoNoiseStateAB 0xd50 +#define rOFDM1_PseudoNoiseStateCD 0xd54 +#define rOFDM1_RxPseudoNoiseWgt 0xd58 + +#define rOFDM_PHYCounter1 0xda0 //cca, parity fail +#define rOFDM_PHYCounter2 0xda4 //rate illegal, crc8 fail +#define rOFDM_PHYCounter3 0xda8 //MCS not support + +#define rOFDM_ShortCFOAB 0xdac // No setting now +#define rOFDM_ShortCFOCD 0xdb0 +#define rOFDM_LongCFOAB 0xdb4 +#define rOFDM_LongCFOCD 0xdb8 +#define rOFDM_TailCFOAB 0xdbc +#define rOFDM_TailCFOCD 0xdc0 +#define rOFDM_PWMeasure1 0xdc4 +#define rOFDM_PWMeasure2 0xdc8 +#define rOFDM_BWReport 0xdcc +#define rOFDM_AGCReport 0xdd0 +#define rOFDM_RxSNR 0xdd4 +#define rOFDM_RxEVMCSI 0xdd8 +#define rOFDM_SIGReport 0xddc + + +// +// 8. PageE(0xE00) +// +#define rTxAGC_A_Rate18_06 0xe00 +#define rTxAGC_A_Rate54_24 0xe04 +#define rTxAGC_A_CCK1_Mcs32 0xe08 +#define rTxAGC_A_Mcs03_Mcs00 0xe10 +#define rTxAGC_A_Mcs07_Mcs04 0xe14 +#define rTxAGC_A_Mcs11_Mcs08 0xe18 +#define rTxAGC_A_Mcs15_Mcs12 0xe1c + +#define rTxAGC_B_Rate18_06 0x830 +#define rTxAGC_B_Rate54_24 0x834 +#define rTxAGC_B_CCK1_55_Mcs32 0x838 +#define rTxAGC_B_Mcs03_Mcs00 0x83c +#define rTxAGC_B_Mcs07_Mcs04 0x848 +#define rTxAGC_B_Mcs11_Mcs08 0x84c +#define rTxAGC_B_Mcs15_Mcs12 0x868 +#define rTxAGC_B_CCK11_A_CCK2_11 0x86c + +#define rFPGA0_IQK 0xe28 +#define rTx_IQK_Tone_A 0xe30 +#define rRx_IQK_Tone_A 0xe34 +#define rTx_IQK_PI_A 0xe38 +#define rRx_IQK_PI_A 0xe3c + +#define rTx_IQK 0xe40 +#define rRx_IQK 0xe44 +#define rIQK_AGC_Pts 0xe48 +#define rIQK_AGC_Rsp 0xe4c +#define rTx_IQK_Tone_B 0xe50 +#define rRx_IQK_Tone_B 0xe54 +#define rTx_IQK_PI_B 0xe58 +#define rRx_IQK_PI_B 0xe5c +#define rIQK_AGC_Cont 0xe60 + +#define rBlue_Tooth 0xe6c +#define rRx_Wait_CCA 0xe70 +#define rTx_CCK_RFON 0xe74 +#define rTx_CCK_BBON 0xe78 +#define rTx_OFDM_RFON 0xe7c +#define rTx_OFDM_BBON 0xe80 +#define rTx_To_Rx 0xe84 +#define rTx_To_Tx 0xe88 +#define rRx_CCK 0xe8c + +#define rTx_Power_Before_IQK_A 0xe94 +#define rTx_Power_After_IQK_A 0xe9c + +#define rRx_Power_Before_IQK_A 0xea0 +#define rRx_Power_Before_IQK_A_2 0xea4 +#define rRx_Power_After_IQK_A 0xea8 +#define rRx_Power_After_IQK_A_2 0xeac + +#define rTx_Power_Before_IQK_B 0xeb4 +#define rTx_Power_After_IQK_B 0xebc + +#define rRx_Power_Before_IQK_B 0xec0 +#define rRx_Power_Before_IQK_B_2 0xec4 +#define rRx_Power_After_IQK_B 0xec8 +#define rRx_Power_After_IQK_B_2 0xecc + +#define rRx_OFDM 0xed0 +#define rRx_Wait_RIFS 0xed4 +#define rRx_TO_Rx 0xed8 +#define rStandby 0xedc +#define rSleep 0xee0 +#define rPMPD_ANAEN 0xeec + +// +// 7. RF Register 0x00-0x2E (RF 8256) +// RF-0222D 0x00-3F +// +//Zebra1 +#define rZebra1_HSSIEnable 0x0 // Useless now +#define rZebra1_TRxEnable1 0x1 +#define rZebra1_TRxEnable2 0x2 +#define rZebra1_AGC 0x4 +#define rZebra1_ChargePump 0x5 +#define rZebra1_Channel 0x7 // RF channel switch + +//#endif +#define rZebra1_TxGain 0x8 // Useless now +#define rZebra1_TxLPF 0x9 +#define rZebra1_RxLPF 0xb +#define rZebra1_RxHPFCorner 0xc + +//Zebra4 +#define rGlobalCtrl 0 // Useless now +#define rRTL8256_TxLPF 19 +#define rRTL8256_RxLPF 11 + +//RTL8258 +#define rRTL8258_TxLPF 0x11 // Useless now +#define rRTL8258_RxLPF 0x13 +#define rRTL8258_RSSILPF 0xa + +// +// RL6052 Register definition +// +#define RF_AC 0x00 // + +#define RF_IQADJ_G1 0x01 // +#define RF_IQADJ_G2 0x02 // + +#define RF_POW_TRSW 0x05 // + +#define RF_GAIN_RX 0x06 // +#define RF_GAIN_TX 0x07 // + +#define RF_TXM_IDAC 0x08 // +#define RF_IPA_G 0x09 // +#define RF_TXBIAS_G 0x0A +#define RF_TXPA_AG 0x0B +#define RF_IPA_A 0x0C // +#define RF_TXBIAS_A 0x0D +#define RF_BS_PA_APSET_G9_G11 0x0E +#define RF_BS_IQGEN 0x0F // + +#define RF_MODE1 0x10 // +#define RF_MODE2 0x11 // + +#define RF_RX_AGC_HP 0x12 // +#define RF_TX_AGC 0x13 // +#define RF_BIAS 0x14 // +#define RF_IPA 0x15 // +#define RF_TXBIAS 0x16 +#define RF_POW_ABILITY 0x17 // +#define RF_CHNLBW 0x18 // RF channel and BW switch +#define RF_TOP 0x19 // + +#define RF_RX_G1 0x1A // +#define RF_RX_G2 0x1B // + +#define RF_RX_BB2 0x1C // +#define RF_RX_BB1 0x1D // + +#define RF_RCK1 0x1E // +#define RF_RCK2 0x1F // + +#define RF_TX_G1 0x20 // +#define RF_TX_G2 0x21 // +#define RF_TX_G3 0x22 // + +#define RF_TX_BB1 0x23 // + +//#if HARDWARE_TYPE_IS_RTL8192D == 1 +#define RF_T_METER_92D 0x42 // +//#else +#define RF_T_METER_88E 0x42 // +#define RF_T_METER 0x24 // + +//#endif + +#define RF_SYN_G1 0x25 // RF TX Power control +#define RF_SYN_G2 0x26 // RF TX Power control +#define RF_SYN_G3 0x27 // RF TX Power control +#define RF_SYN_G4 0x28 // RF TX Power control +#define RF_SYN_G5 0x29 // RF TX Power control +#define RF_SYN_G6 0x2A // RF TX Power control +#define RF_SYN_G7 0x2B // RF TX Power control +#define RF_SYN_G8 0x2C // RF TX Power control + +#define RF_RCK_OS 0x30 // RF TX PA control +#define RF_TXPA_G1 0x31 // RF TX PA control +#define RF_TXPA_G2 0x32 // RF TX PA control +#define RF_TXPA_G3 0x33 // RF TX PA control +#define RF_TX_BIAS_A 0x35 +#define RF_TX_BIAS_D 0x36 +#define RF_LOBF_9 0x38 +#define RF_RXRF_A3 0x3C // +#define RF_TRSW 0x3F + +#define RF_TXRF_A2 0x41 +#define RF_TXPA_G4 0x46 +#define RF_TXPA_A4 0x4B +#define RF_0x52 0x52 +#define RF_WE_LUT 0xEF + + +// +//Bit Mask +// +// 1. Page1(0x100) +#define bBBResetB 0x100 // Useless now? +#define bGlobalResetB 0x200 +#define bOFDMTxStart 0x4 +#define bCCKTxStart 0x8 +#define bCRC32Debug 0x100 +#define bPMACLoopback 0x10 +#define bTxLSIG 0xffffff +#define bOFDMTxRate 0xf +#define bOFDMTxReserved 0x10 +#define bOFDMTxLength 0x1ffe0 +#define bOFDMTxParity 0x20000 +#define bTxHTSIG1 0xffffff +#define bTxHTMCSRate 0x7f +#define bTxHTBW 0x80 +#define bTxHTLength 0xffff00 +#define bTxHTSIG2 0xffffff +#define bTxHTSmoothing 0x1 +#define bTxHTSounding 0x2 +#define bTxHTReserved 0x4 +#define bTxHTAggreation 0x8 +#define bTxHTSTBC 0x30 +#define bTxHTAdvanceCoding 0x40 +#define bTxHTShortGI 0x80 +#define bTxHTNumberHT_LTF 0x300 +#define bTxHTCRC8 0x3fc00 +#define bCounterReset 0x10000 +#define bNumOfOFDMTx 0xffff +#define bNumOfCCKTx 0xffff0000 +#define bTxIdleInterval 0xffff +#define bOFDMService 0xffff0000 +#define bTxMACHeader 0xffffffff +#define bTxDataInit 0xff +#define bTxHTMode 0x100 +#define bTxDataType 0x30000 +#define bTxRandomSeed 0xffffffff +#define bCCKTxPreamble 0x1 +#define bCCKTxSFD 0xffff0000 +#define bCCKTxSIG 0xff +#define bCCKTxService 0xff00 +#define bCCKLengthExt 0x8000 +#define bCCKTxLength 0xffff0000 +#define bCCKTxCRC16 0xffff +#define bCCKTxStatus 0x1 +#define bOFDMTxStatus 0x2 + +#define IS_BB_REG_OFFSET_92S(_Offset) ((_Offset >= 0x800) && (_Offset <= 0xfff)) + +// 2. Page8(0x800) +#define bRFMOD 0x1 // Reg 0x800 rFPGA0_RFMOD +#define bJapanMode 0x2 +#define bCCKTxSC 0x30 +#define bCCKEn 0x1000000 +#define bOFDMEn 0x2000000 + +#define bOFDMRxADCPhase 0x10000 // Useless now +#define bOFDMTxDACPhase 0x40000 +#define bXATxAGC 0x3f + +#define bAntennaSelect 0x0300 + +#define bXBTxAGC 0xf00 // Reg 80c rFPGA0_TxGainStage +#define bXCTxAGC 0xf000 +#define bXDTxAGC 0xf0000 + +#define bPAStart 0xf0000000 // Useless now +#define bTRStart 0x00f00000 +#define bRFStart 0x0000f000 +#define bBBStart 0x000000f0 +#define bBBCCKStart 0x0000000f +#define bPAEnd 0xf //Reg0x814 +#define bTREnd 0x0f000000 +#define bRFEnd 0x000f0000 +#define bCCAMask 0x000000f0 //T2R +#define bR2RCCAMask 0x00000f00 +#define bHSSI_R2TDelay 0xf8000000 +#define bHSSI_T2RDelay 0xf80000 +#define bContTxHSSI 0x400 //chane gain at continue Tx +#define bIGFromCCK 0x200 +#define bAGCAddress 0x3f +#define bRxHPTx 0x7000 +#define bRxHPT2R 0x38000 +#define bRxHPCCKIni 0xc0000 +#define bAGCTxCode 0xc00000 +#define bAGCRxCode 0x300000 + +#define b3WireDataLength 0x800 // Reg 0x820~84f rFPGA0_XA_HSSIParameter1 +#define b3WireAddressLength 0x400 + +#define b3WireRFPowerDown 0x1 // Useless now +//#define bHWSISelect 0x8 +#define b5GPAPEPolarity 0x40000000 +#define b2GPAPEPolarity 0x80000000 +#define bRFSW_TxDefaultAnt 0x3 +#define bRFSW_TxOptionAnt 0x30 +#define bRFSW_RxDefaultAnt 0x300 +#define bRFSW_RxOptionAnt 0x3000 +#define bRFSI_3WireData 0x1 +#define bRFSI_3WireClock 0x2 +#define bRFSI_3WireLoad 0x4 +#define bRFSI_3WireRW 0x8 +#define bRFSI_3Wire 0xf + +#define bRFSI_RFENV 0x10 // Reg 0x870 rFPGA0_XAB_RFInterfaceSW + +#define bRFSI_TRSW 0x20 // Useless now +#define bRFSI_TRSWB 0x40 +#define bRFSI_ANTSW 0x100 +#define bRFSI_ANTSWB 0x200 +#define bRFSI_PAPE 0x400 +#define bRFSI_PAPE5G 0x800 +#define bBandSelect 0x1 +#define bHTSIG2_GI 0x80 +#define bHTSIG2_Smoothing 0x01 +#define bHTSIG2_Sounding 0x02 +#define bHTSIG2_Aggreaton 0x08 +#define bHTSIG2_STBC 0x30 +#define bHTSIG2_AdvCoding 0x40 +#define bHTSIG2_NumOfHTLTF 0x300 +#define bHTSIG2_CRC8 0x3fc +#define bHTSIG1_MCS 0x7f +#define bHTSIG1_BandWidth 0x80 +#define bHTSIG1_HTLength 0xffff +#define bLSIG_Rate 0xf +#define bLSIG_Reserved 0x10 +#define bLSIG_Length 0x1fffe +#define bLSIG_Parity 0x20 +#define bCCKRxPhase 0x4 + +#define bLSSIReadAddress 0x7f800000 // T65 RF + +#define bLSSIReadEdge 0x80000000 //LSSI "Read" edge signal + +#define bLSSIReadBackData 0xfffff // T65 RF + +#define bLSSIReadOKFlag 0x1000 // Useless now +#define bCCKSampleRate 0x8 //0: 44MHz, 1:88MHz +#define bRegulator0Standby 0x1 +#define bRegulatorPLLStandby 0x2 +#define bRegulator1Standby 0x4 +#define bPLLPowerUp 0x8 +#define bDPLLPowerUp 0x10 +#define bDA10PowerUp 0x20 +#define bAD7PowerUp 0x200 +#define bDA6PowerUp 0x2000 +#define bXtalPowerUp 0x4000 +#define b40MDClkPowerUP 0x8000 +#define bDA6DebugMode 0x20000 +#define bDA6Swing 0x380000 + +#define bADClkPhase 0x4000000 // Reg 0x880 rFPGA0_AnalogParameter1 20/40 CCK support switch 40/80 BB MHZ + +#define b80MClkDelay 0x18000000 // Useless +#define bAFEWatchDogEnable 0x20000000 + +#define bXtalCap01 0xc0000000 // Reg 0x884 rFPGA0_AnalogParameter2 Crystal cap +#define bXtalCap23 0x3 +#define bXtalCap92x 0x0f000000 +#define bXtalCap 0x0f000000 + +#define bIntDifClkEnable 0x400 // Useless +#define bExtSigClkEnable 0x800 +#define bBandgapMbiasPowerUp 0x10000 +#define bAD11SHGain 0xc0000 +#define bAD11InputRange 0x700000 +#define bAD11OPCurrent 0x3800000 +#define bIPathLoopback 0x4000000 +#define bQPathLoopback 0x8000000 +#define bAFELoopback 0x10000000 +#define bDA10Swing 0x7e0 +#define bDA10Reverse 0x800 +#define bDAClkSource 0x1000 +#define bAD7InputRange 0x6000 +#define bAD7Gain 0x38000 +#define bAD7OutputCMMode 0x40000 +#define bAD7InputCMMode 0x380000 +#define bAD7Current 0xc00000 +#define bRegulatorAdjust 0x7000000 +#define bAD11PowerUpAtTx 0x1 +#define bDA10PSAtTx 0x10 +#define bAD11PowerUpAtRx 0x100 +#define bDA10PSAtRx 0x1000 +#define bCCKRxAGCFormat 0x200 +#define bPSDFFTSamplepPoint 0xc000 +#define bPSDAverageNum 0x3000 +#define bIQPathControl 0xc00 +#define bPSDFreq 0x3ff +#define bPSDAntennaPath 0x30 +#define bPSDIQSwitch 0x40 +#define bPSDRxTrigger 0x400000 +#define bPSDTxTrigger 0x80000000 +#define bPSDSineToneScale 0x7f000000 +#define bPSDReport 0xffff + +// 3. Page9(0x900) +#define bOFDMTxSC 0x30000000 // Useless +#define bCCKTxOn 0x1 +#define bOFDMTxOn 0x2 +#define bDebugPage 0xfff //reset debug page and also HWord, LWord +#define bDebugItem 0xff //reset debug page and LWord +#define bAntL 0x10 +#define bAntNonHT 0x100 +#define bAntHT1 0x1000 +#define bAntHT2 0x10000 +#define bAntHT1S1 0x100000 +#define bAntNonHTS1 0x1000000 + +// 4. PageA(0xA00) +#define bCCKBBMode 0x3 // Useless +#define bCCKTxPowerSaving 0x80 +#define bCCKRxPowerSaving 0x40 + +#define bCCKSideBand 0x10 // Reg 0xa00 rCCK0_System 20/40 switch + +#define bCCKScramble 0x8 // Useless +#define bCCKAntDiversity 0x8000 +#define bCCKCarrierRecovery 0x4000 +#define bCCKTxRate 0x3000 +#define bCCKDCCancel 0x0800 +#define bCCKISICancel 0x0400 +#define bCCKMatchFilter 0x0200 +#define bCCKEqualizer 0x0100 +#define bCCKPreambleDetect 0x800000 +#define bCCKFastFalseCCA 0x400000 +#define bCCKChEstStart 0x300000 +#define bCCKCCACount 0x080000 +#define bCCKcs_lim 0x070000 +#define bCCKBistMode 0x80000000 +#define bCCKCCAMask 0x40000000 +#define bCCKTxDACPhase 0x4 +#define bCCKRxADCPhase 0x20000000 //r_rx_clk +#define bCCKr_cp_mode0 0x0100 +#define bCCKTxDCOffset 0xf0 +#define bCCKRxDCOffset 0xf +#define bCCKCCAMode 0xc000 +#define bCCKFalseCS_lim 0x3f00 +#define bCCKCS_ratio 0xc00000 +#define bCCKCorgBit_sel 0x300000 +#define bCCKPD_lim 0x0f0000 +#define bCCKNewCCA 0x80000000 +#define bCCKRxHPofIG 0x8000 +#define bCCKRxIG 0x7f00 +#define bCCKLNAPolarity 0x800000 +#define bCCKRx1stGain 0x7f0000 +#define bCCKRFExtend 0x20000000 //CCK Rx Iinital gain polarity +#define bCCKRxAGCSatLevel 0x1f000000 +#define bCCKRxAGCSatCount 0xe0 +#define bCCKRxRFSettle 0x1f //AGCsamp_dly +#define bCCKFixedRxAGC 0x8000 +//#define bCCKRxAGCFormat 0x4000 //remove to HSSI register 0x824 +#define bCCKAntennaPolarity 0x2000 +#define bCCKTxFilterType 0x0c00 +#define bCCKRxAGCReportType 0x0300 +#define bCCKRxDAGCEn 0x80000000 +#define bCCKRxDAGCPeriod 0x20000000 +#define bCCKRxDAGCSatLevel 0x1f000000 +#define bCCKTimingRecovery 0x800000 +#define bCCKTxC0 0x3f0000 +#define bCCKTxC1 0x3f000000 +#define bCCKTxC2 0x3f +#define bCCKTxC3 0x3f00 +#define bCCKTxC4 0x3f0000 +#define bCCKTxC5 0x3f000000 +#define bCCKTxC6 0x3f +#define bCCKTxC7 0x3f00 +#define bCCKDebugPort 0xff0000 +#define bCCKDACDebug 0x0f000000 +#define bCCKFalseAlarmEnable 0x8000 +#define bCCKFalseAlarmRead 0x4000 +#define bCCKTRSSI 0x7f +#define bCCKRxAGCReport 0xfe +#define bCCKRxReport_AntSel 0x80000000 +#define bCCKRxReport_MFOff 0x40000000 +#define bCCKRxRxReport_SQLoss 0x20000000 +#define bCCKRxReport_Pktloss 0x10000000 +#define bCCKRxReport_Lockedbit 0x08000000 +#define bCCKRxReport_RateError 0x04000000 +#define bCCKRxReport_RxRate 0x03000000 +#define bCCKRxFACounterLower 0xff +#define bCCKRxFACounterUpper 0xff000000 +#define bCCKRxHPAGCStart 0xe000 +#define bCCKRxHPAGCFinal 0x1c00 +#define bCCKRxFalseAlarmEnable 0x8000 +#define bCCKFACounterFreeze 0x4000 +#define bCCKTxPathSel 0x10000000 +#define bCCKDefaultRxPath 0xc000000 +#define bCCKOptionRxPath 0x3000000 + +// 5. PageC(0xC00) +#define bNumOfSTF 0x3 // Useless +#define bShift_L 0xc0 +#define bGI_TH 0xc +#define bRxPathA 0x1 +#define bRxPathB 0x2 +#define bRxPathC 0x4 +#define bRxPathD 0x8 +#define bTxPathA 0x1 +#define bTxPathB 0x2 +#define bTxPathC 0x4 +#define bTxPathD 0x8 +#define bTRSSIFreq 0x200 +#define bADCBackoff 0x3000 +#define bDFIRBackoff 0xc000 +#define bTRSSILatchPhase 0x10000 +#define bRxIDCOffset 0xff +#define bRxQDCOffset 0xff00 +#define bRxDFIRMode 0x1800000 +#define bRxDCNFType 0xe000000 +#define bRXIQImb_A 0x3ff +#define bRXIQImb_B 0xfc00 +#define bRXIQImb_C 0x3f0000 +#define bRXIQImb_D 0xffc00000 +#define bDC_dc_Notch 0x60000 +#define bRxNBINotch 0x1f000000 +#define bPD_TH 0xf +#define bPD_TH_Opt2 0xc000 +#define bPWED_TH 0x700 +#define bIfMF_Win_L 0x800 +#define bPD_Option 0x1000 +#define bMF_Win_L 0xe000 +#define bBW_Search_L 0x30000 +#define bwin_enh_L 0xc0000 +#define bBW_TH 0x700000 +#define bED_TH2 0x3800000 +#define bBW_option 0x4000000 +#define bRatio_TH 0x18000000 +#define bWindow_L 0xe0000000 +#define bSBD_Option 0x1 +#define bFrame_TH 0x1c +#define bFS_Option 0x60 +#define bDC_Slope_check 0x80 +#define bFGuard_Counter_DC_L 0xe00 +#define bFrame_Weight_Short 0x7000 +#define bSub_Tune 0xe00000 +#define bFrame_DC_Length 0xe000000 +#define bSBD_start_offset 0x30000000 +#define bFrame_TH_2 0x7 +#define bFrame_GI2_TH 0x38 +#define bGI2_Sync_en 0x40 +#define bSarch_Short_Early 0x300 +#define bSarch_Short_Late 0xc00 +#define bSarch_GI2_Late 0x70000 +#define bCFOAntSum 0x1 +#define bCFOAcc 0x2 +#define bCFOStartOffset 0xc +#define bCFOLookBack 0x70 +#define bCFOSumWeight 0x80 +#define bDAGCEnable 0x10000 +#define bTXIQImb_A 0x3ff +#define bTXIQImb_B 0xfc00 +#define bTXIQImb_C 0x3f0000 +#define bTXIQImb_D 0xffc00000 +#define bTxIDCOffset 0xff +#define bTxQDCOffset 0xff00 +#define bTxDFIRMode 0x10000 +#define bTxPesudoNoiseOn 0x4000000 +#define bTxPesudoNoise_A 0xff +#define bTxPesudoNoise_B 0xff00 +#define bTxPesudoNoise_C 0xff0000 +#define bTxPesudoNoise_D 0xff000000 +#define bCCADropOption 0x20000 +#define bCCADropThres 0xfff00000 +#define bEDCCA_H 0xf +#define bEDCCA_L 0xf0 +#define bLambda_ED 0x300 +#define bRxInitialGain 0x7f +#define bRxAntDivEn 0x80 +#define bRxAGCAddressForLNA 0x7f00 +#define bRxHighPowerFlow 0x8000 +#define bRxAGCFreezeThres 0xc0000 +#define bRxFreezeStep_AGC1 0x300000 +#define bRxFreezeStep_AGC2 0xc00000 +#define bRxFreezeStep_AGC3 0x3000000 +#define bRxFreezeStep_AGC0 0xc000000 +#define bRxRssi_Cmp_En 0x10000000 +#define bRxQuickAGCEn 0x20000000 +#define bRxAGCFreezeThresMode 0x40000000 +#define bRxOverFlowCheckType 0x80000000 +#define bRxAGCShift 0x7f +#define bTRSW_Tri_Only 0x80 +#define bPowerThres 0x300 +#define bRxAGCEn 0x1 +#define bRxAGCTogetherEn 0x2 +#define bRxAGCMin 0x4 +#define bRxHP_Ini 0x7 +#define bRxHP_TRLNA 0x70 +#define bRxHP_RSSI 0x700 +#define bRxHP_BBP1 0x7000 +#define bRxHP_BBP2 0x70000 +#define bRxHP_BBP3 0x700000 +#define bRSSI_H 0x7f0000 //the threshold for high power +#define bRSSI_Gen 0x7f000000 //the threshold for ant diversity +#define bRxSettle_TRSW 0x7 +#define bRxSettle_LNA 0x38 +#define bRxSettle_RSSI 0x1c0 +#define bRxSettle_BBP 0xe00 +#define bRxSettle_RxHP 0x7000 +#define bRxSettle_AntSW_RSSI 0x38000 +#define bRxSettle_AntSW 0xc0000 +#define bRxProcessTime_DAGC 0x300000 +#define bRxSettle_HSSI 0x400000 +#define bRxProcessTime_BBPPW 0x800000 +#define bRxAntennaPowerShift 0x3000000 +#define bRSSITableSelect 0xc000000 +#define bRxHP_Final 0x7000000 +#define bRxHTSettle_BBP 0x7 +#define bRxHTSettle_HSSI 0x8 +#define bRxHTSettle_RxHP 0x70 +#define bRxHTSettle_BBPPW 0x80 +#define bRxHTSettle_Idle 0x300 +#define bRxHTSettle_Reserved 0x1c00 +#define bRxHTRxHPEn 0x8000 +#define bRxHTAGCFreezeThres 0x30000 +#define bRxHTAGCTogetherEn 0x40000 +#define bRxHTAGCMin 0x80000 +#define bRxHTAGCEn 0x100000 +#define bRxHTDAGCEn 0x200000 +#define bRxHTRxHP_BBP 0x1c00000 +#define bRxHTRxHP_Final 0xe0000000 +#define bRxPWRatioTH 0x3 +#define bRxPWRatioEn 0x4 +#define bRxMFHold 0x3800 +#define bRxPD_Delay_TH1 0x38 +#define bRxPD_Delay_TH2 0x1c0 +#define bRxPD_DC_COUNT_MAX 0x600 +//#define bRxMF_Hold 0x3800 +#define bRxPD_Delay_TH 0x8000 +#define bRxProcess_Delay 0xf0000 +#define bRxSearchrange_GI2_Early 0x700000 +#define bRxFrame_Guard_Counter_L 0x3800000 +#define bRxSGI_Guard_L 0xc000000 +#define bRxSGI_Search_L 0x30000000 +#define bRxSGI_TH 0xc0000000 +#define bDFSCnt0 0xff +#define bDFSCnt1 0xff00 +#define bDFSFlag 0xf0000 +#define bMFWeightSum 0x300000 +#define bMinIdxTH 0x7f000000 +#define bDAFormat 0x40000 +#define bTxChEmuEnable 0x01000000 +#define bTRSWIsolation_A 0x7f +#define bTRSWIsolation_B 0x7f00 +#define bTRSWIsolation_C 0x7f0000 +#define bTRSWIsolation_D 0x7f000000 +#define bExtLNAGain 0x7c00 + +// 6. PageE(0xE00) +#define bSTBCEn 0x4 // Useless +#define bAntennaMapping 0x10 +#define bNss 0x20 +#define bCFOAntSumD 0x200 +#define bPHYCounterReset 0x8000000 +#define bCFOReportGet 0x4000000 +#define bOFDMContinueTx 0x10000000 +#define bOFDMSingleCarrier 0x20000000 +#define bOFDMSingleTone 0x40000000 +//#define bRxPath1 0x01 +//#define bRxPath2 0x02 +//#define bRxPath3 0x04 +//#define bRxPath4 0x08 +//#define bTxPath1 0x10 +//#define bTxPath2 0x20 +#define bHTDetect 0x100 +#define bCFOEn 0x10000 +#define bCFOValue 0xfff00000 +#define bSigTone_Re 0x3f +#define bSigTone_Im 0x7f00 +#define bCounter_CCA 0xffff +#define bCounter_ParityFail 0xffff0000 +#define bCounter_RateIllegal 0xffff +#define bCounter_CRC8Fail 0xffff0000 +#define bCounter_MCSNoSupport 0xffff +#define bCounter_FastSync 0xffff +#define bShortCFO 0xfff +#define bShortCFOTLength 12 //total +#define bShortCFOFLength 11 //fraction +#define bLongCFO 0x7ff +#define bLongCFOTLength 11 +#define bLongCFOFLength 11 +#define bTailCFO 0x1fff +#define bTailCFOTLength 13 +#define bTailCFOFLength 12 +#define bmax_en_pwdB 0xffff +#define bCC_power_dB 0xffff0000 +#define bnoise_pwdB 0xffff +#define bPowerMeasTLength 10 +#define bPowerMeasFLength 3 +#define bRx_HT_BW 0x1 +#define bRxSC 0x6 +#define bRx_HT 0x8 +#define bNB_intf_det_on 0x1 +#define bIntf_win_len_cfg 0x30 +#define bNB_Intf_TH_cfg 0x1c0 +#define bRFGain 0x3f +#define bTableSel 0x40 +#define bTRSW 0x80 +#define bRxSNR_A 0xff +#define bRxSNR_B 0xff00 +#define bRxSNR_C 0xff0000 +#define bRxSNR_D 0xff000000 +#define bSNREVMTLength 8 +#define bSNREVMFLength 1 +#define bCSI1st 0xff +#define bCSI2nd 0xff00 +#define bRxEVM1st 0xff0000 +#define bRxEVM2nd 0xff000000 +#define bSIGEVM 0xff +#define bPWDB 0xff00 +#define bSGIEN 0x10000 + +#define bSFactorQAM1 0xf // Useless +#define bSFactorQAM2 0xf0 +#define bSFactorQAM3 0xf00 +#define bSFactorQAM4 0xf000 +#define bSFactorQAM5 0xf0000 +#define bSFactorQAM6 0xf0000 +#define bSFactorQAM7 0xf00000 +#define bSFactorQAM8 0xf000000 +#define bSFactorQAM9 0xf0000000 +#define bCSIScheme 0x100000 + +#define bNoiseLvlTopSet 0x3 // Useless +#define bChSmooth 0x4 +#define bChSmoothCfg1 0x38 +#define bChSmoothCfg2 0x1c0 +#define bChSmoothCfg3 0xe00 +#define bChSmoothCfg4 0x7000 +#define bMRCMode 0x800000 +#define bTHEVMCfg 0x7000000 + +#define bLoopFitType 0x1 // Useless +#define bUpdCFO 0x40 +#define bUpdCFOOffData 0x80 +#define bAdvUpdCFO 0x100 +#define bAdvTimeCtrl 0x800 +#define bUpdClko 0x1000 +#define bFC 0x6000 +#define bTrackingMode 0x8000 +#define bPhCmpEnable 0x10000 +#define bUpdClkoLTF 0x20000 +#define bComChCFO 0x40000 +#define bCSIEstiMode 0x80000 +#define bAdvUpdEqz 0x100000 +#define bUChCfg 0x7000000 +#define bUpdEqz 0x8000000 + +//Rx Pseduo noise +#define bRxPesudoNoiseOn 0x20000000 // Useless +#define bRxPesudoNoise_A 0xff +#define bRxPesudoNoise_B 0xff00 +#define bRxPesudoNoise_C 0xff0000 +#define bRxPesudoNoise_D 0xff000000 +#define bPesudoNoiseState_A 0xffff +#define bPesudoNoiseState_B 0xffff0000 +#define bPesudoNoiseState_C 0xffff +#define bPesudoNoiseState_D 0xffff0000 + +//7. RF Register +//Zebra1 +#define bZebra1_HSSIEnable 0x8 // Useless +#define bZebra1_TRxControl 0xc00 +#define bZebra1_TRxGainSetting 0x07f +#define bZebra1_RxCorner 0xc00 +#define bZebra1_TxChargePump 0x38 +#define bZebra1_RxChargePump 0x7 +#define bZebra1_ChannelNum 0xf80 +#define bZebra1_TxLPFBW 0x400 +#define bZebra1_RxLPFBW 0x600 + +//Zebra4 +#define bRTL8256RegModeCtrl1 0x100 // Useless +#define bRTL8256RegModeCtrl0 0x40 +#define bRTL8256_TxLPFBW 0x18 +#define bRTL8256_RxLPFBW 0x600 + +//RTL8258 +#define bRTL8258_TxLPFBW 0xc // Useless +#define bRTL8258_RxLPFBW 0xc00 +#define bRTL8258_RSSILPFBW 0xc0 + + +// +// Other Definition +// + +//byte endable for sb_write +#define bByte0 0x1 // Useless +#define bByte1 0x2 +#define bByte2 0x4 +#define bByte3 0x8 +#define bWord0 0x3 +#define bWord1 0xc +#define bDWord 0xf + +//for PutRegsetting & GetRegSetting BitMask +#define bMaskByte0 0xff // Reg 0xc50 rOFDM0_XAAGCCore~0xC6f +#define bMaskByte1 0xff00 +#define bMaskByte2 0xff0000 +#define bMaskByte3 0xff000000 +#define bMaskHWord 0xffff0000 +#define bMaskLWord 0x0000ffff +#define bMaskDWord 0xffffffff +#define bMask12Bits 0xfff +#define bMaskH4Bits 0xf0000000 +#define bMaskOFDM_D 0xffc00000 +#define bMaskCCK 0x3f3f3f3f + +//for PutRFRegsetting & GetRFRegSetting BitMask +//#define bMask12Bits 0xfffff // RF Reg mask bits +//#define bMask20Bits 0xfffff // RF Reg mask bits T65 RF +#define bRFRegOffsetMask 0xfffff + +#define bEnable 0x1 // Useless +#define bDisable 0x0 + +#define LeftAntenna 0x0 // Useless +#define RightAntenna 0x1 + +#define tCheckTxStatus 500 //500ms // Useless +#define tUpdateRxCounter 100 //100ms + +#define rateCCK 0 // Useless +#define rateOFDM 1 +#define rateHT 2 + +//define Register-End +#define bPMAC_End 0x1ff // Useless +#define bFPGAPHY0_End 0x8ff +#define bFPGAPHY1_End 0x9ff +#define bCCKPHY0_End 0xaff +#define bOFDMPHY0_End 0xcff +#define bOFDMPHY1_End 0xdff + +//define max debug item in each debug page +//#define bMaxItem_FPGA_PHY0 0x9 +//#define bMaxItem_FPGA_PHY1 0x3 +//#define bMaxItem_PHY_11B 0x16 +//#define bMaxItem_OFDM_PHY0 0x29 +//#define bMaxItem_OFDM_PHY1 0x0 + +#define bPMACControl 0x0 // Useless +#define bWMACControl 0x1 +#define bWNICControl 0x2 + +#define PathA 0x0 // Useless +#define PathB 0x1 +#define PathC 0x2 +#define PathD 0x3 + +/*--------------------------Define Parameters-------------------------------*/ + + +#endif diff --git a/include/Hal8188EPwrSeq.h b/include/Hal8188EPwrSeq.h index 915da60..54c21ca 100755 --- a/include/Hal8188EPwrSeq.h +++ b/include/Hal8188EPwrSeq.h @@ -1,177 +1,176 @@ - -/****************************************************************************** - * - * 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 __HAL8188EPWRSEQ_H__ -#define __HAL8188EPWRSEQ_H__ - -#include "HalPwrSeqCmd.h" - -/* - Check document WM-20110607-Paul-RTL8188E_Power_Architecture-R02.vsd - There are 6 HW Power States: - 0: POFF--Power Off - 1: PDN--Power Down - 2: CARDEMU--Card Emulation - 3: ACT--Active Mode - 4: LPS--Low Power State - 5: SUS--Suspend - - The transision from different states are defined below - TRANS_CARDEMU_TO_ACT - TRANS_ACT_TO_CARDEMU - TRANS_CARDEMU_TO_SUS - TRANS_SUS_TO_CARDEMU - TRANS_CARDEMU_TO_PDN - TRANS_ACT_TO_LPS - TRANS_LPS_TO_ACT - - TRANS_END - - PWR SEQ Version: rtl8188E_PwrSeq_V09.h -*/ -#define RTL8188E_TRANS_CARDEMU_TO_ACT_STEPS 10 -#define RTL8188E_TRANS_ACT_TO_CARDEMU_STEPS 10 -#define RTL8188E_TRANS_CARDEMU_TO_SUS_STEPS 10 -#define RTL8188E_TRANS_SUS_TO_CARDEMU_STEPS 10 -#define RTL8188E_TRANS_CARDEMU_TO_PDN_STEPS 10 -#define RTL8188E_TRANS_PDN_TO_CARDEMU_STEPS 10 -#define RTL8188E_TRANS_ACT_TO_LPS_STEPS 15 -#define RTL8188E_TRANS_LPS_TO_ACT_STEPS 15 -#define RTL8188E_TRANS_END_STEPS 1 - - -#define RTL8188E_TRANS_CARDEMU_TO_ACT \ - /* format */ \ - /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \ - {0x0006, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_POLLING, BIT1, BIT1},/* wait till 0x04[17] = 1 power ready*/ \ - {0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0|BIT1, 0}, /* 0x02[1:0] = 0 reset BB*/ \ - {0x0026, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT7, BIT7}, /*0x24[23] = 2b'01 schmit trigger */ \ - {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT7, 0}, /* 0x04[15] = 0 disable HWPDN (control by DRV)*/\ - {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT4|BIT3, 0}, /*0x04[12:11] = 2b'00 disable WL suspend*/ \ - {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, BIT0}, /*0x04[8] = 1 polling until return 0*/ \ - {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_POLLING, BIT0, 0}, /*wait till 0x04[8] = 0*/ \ - {0x0023, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT4, 0}, /*LDO normal mode*/ \ - {0x0074, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT4, BIT4}, /*SDIO Driving*/ \ - -#define RTL8188E_TRANS_ACT_TO_CARDEMU \ - /* format */ \ - /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \ - {0x001F, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0},/*0x1F[7:0] = 0 turn off RF*/ \ - {0x0023, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT4, BIT4}, /*LDO Sleep mode*/ \ - {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT1, BIT1}, /*0x04[9] = 1 turn off MAC by HW state machine*/ \ - {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_POLLING, BIT1, 0}, /*wait till 0x04[9] = 0 polling until return 0 to disable*/ \ - -#define RTL8188E_TRANS_CARDEMU_TO_SUS \ - /* format */ \ - /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \ - {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK|PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT3|BIT4, BIT3}, /*0x04[12:11] = 2b'01enable WL suspend*/ \ - {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_PCI_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT3|BIT4, BIT3|BIT4}, /*0x04[12:11] = 2b'11enable WL suspend for PCIe*/ \ - {0x0007, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK|PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, BIT7}, /* 0x04[31:30] = 2b'10 enable enable bandgap mbias in suspend */ \ - {0x0041, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK|PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT4, 0}, /*Clear SIC_EN register 0x40[12] = 1'b0 */ \ - {0xfe10, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK|PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT4, BIT4}, /*Set USB suspend enable local register 0xfe10[4]=1 */ \ - {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_SDIO,PWR_CMD_WRITE, BIT0, BIT0}, /*Set SDIO suspend local register*/ \ - {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_SDIO,PWR_CMD_POLLING, BIT1, 0}, /*wait power state to suspend*/ - -#define RTL8188E_TRANS_SUS_TO_CARDEMU \ - /* format */ \ - /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \ - {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_SDIO,PWR_CMD_WRITE, BIT0, 0}, /*Set SDIO suspend local register*/ \ - {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_SDIO,PWR_CMD_POLLING, BIT1, BIT1}, /*wait power state to suspend*/\ - {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT3|BIT4, 0}, /*0x04[12:11] = 2b'01enable WL suspend*/ - -#define RTL8188E_TRANS_CARDEMU_TO_CARDDIS \ - /* format */ \ - /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \ - {0x0026, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT7, BIT7}, /*0x24[23] = 2b'01 schmit trigger */ \ - {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK|PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT3|BIT4, BIT3}, /*0x04[12:11] = 2b'01 enable WL suspend*/ \ - {0x0007, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK|PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0}, /* 0x04[31:30] = 2b'10 enable enable bandgap mbias in suspend */ \ - {0x0041, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK|PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT4, 0}, /*Clear SIC_EN register 0x40[12] = 1'b0 */ \ - {0xfe10, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT4, BIT4}, /*Set USB suspend enable local register 0xfe10[4]=1 */ \ - {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_SDIO,PWR_CMD_WRITE, BIT0, BIT0}, /*Set SDIO suspend local register*/ \ - {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_SDIO,PWR_CMD_POLLING, BIT1, 0}, /*wait power state to suspend*/ - -#define RTL8188E_TRANS_CARDDIS_TO_CARDEMU \ - /* format */ \ - /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \ - {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_SDIO,PWR_CMD_WRITE, BIT0, 0}, /*Set SDIO suspend local register*/ \ - {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_SDIO,PWR_CMD_POLLING, BIT1, BIT1}, /*wait power state to suspend*/\ - {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT3|BIT4, 0}, /*0x04[12:11] = 2b'01enable WL suspend*/ - -#define RTL8188E_TRANS_CARDEMU_TO_PDN \ - /* format */ \ - /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \ - {0x0006, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, 0},/* 0x04[16] = 0*/\ - {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT7, BIT7},/* 0x04[15] = 1*/ - -#define RTL8188E_TRANS_PDN_TO_CARDEMU \ - /* format */ \ - /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \ - {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT7, 0},/* 0x04[15] = 0*/ - -//This is used by driver for LPSRadioOff Procedure, not for FW LPS Step -#define RTL8188E_TRANS_ACT_TO_LPS \ - /* format */ \ - /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \ - {0x0522, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0x7F},/*Tx Pause*/ \ - {0x05F8, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_POLLING, 0xFF, 0},/*Should be zero if no packet is transmitting*/ \ - {0x05F9, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_POLLING, 0xFF, 0},/*Should be zero if no packet is transmitting*/ \ - {0x05FA, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_POLLING, 0xFF, 0},/*Should be zero if no packet is transmitting*/ \ - {0x05FB, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_POLLING, 0xFF, 0},/*Should be zero if no packet is transmitting*/ \ - {0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, 0},/*CCK and OFDM are disabled,and clock are gated*/ \ - {0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_DELAY, 0, PWRSEQ_DELAY_US},/*Delay 1us*/ \ - {0x0100, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0x3F},/*Reset MAC TRX*/ \ - {0x0101, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT1, 0},/*check if removed later*/ \ - {0x0553, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT5, BIT5},/*Respond TxOK to scheduler*/ \ - - -#define RTL8188E_TRANS_LPS_TO_ACT \ - /* format */ \ - /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \ - {0x0080, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_SDIO,PWR_CMD_WRITE, 0xFF, 0x84}, /*SDIO RPWM*/\ - {0xFE58, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0x84}, /*USB RPWM*/\ - {0x0361, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_PCI_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0x84}, /*PCIe RPWM*/\ - {0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_DELAY, 0, PWRSEQ_DELAY_MS}, /*Delay*/\ - {0x0008, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT4, 0}, /*. 0x08[4] = 0 switch TSF to 40M*/\ - {0x0109, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_POLLING, BIT7, 0}, /*Polling 0x109[7]=0 TSF in 40M*/\ - {0x0029, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT6|BIT7, 0}, /*. 0x29[7:6] = 2b'00 enable BB clock*/\ - {0x0101, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT1, BIT1}, /*. 0x101[1] = 1*/\ - {0x0100, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0xFF}, /*. 0x100[7:0] = 0xFF enable WMAC TRX*/\ - {0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT1|BIT0, BIT1|BIT0}, /*. 0x02[1:0] = 2b'11 enable BB macro*/\ - {0x0522, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0}, /*. 0x522 = 0*/ - -#define RTL8188E_TRANS_END \ - /* format */ \ - /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \ - {0xFFFF, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,0,PWR_CMD_END, 0, 0}, // - - -extern WLAN_PWR_CFG rtl8188E_power_on_flow[RTL8188E_TRANS_CARDEMU_TO_ACT_STEPS+RTL8188E_TRANS_END_STEPS]; -extern WLAN_PWR_CFG rtl8188E_radio_off_flow[RTL8188E_TRANS_ACT_TO_CARDEMU_STEPS+RTL8188E_TRANS_END_STEPS]; -extern WLAN_PWR_CFG rtl8188E_card_disable_flow[RTL8188E_TRANS_ACT_TO_CARDEMU_STEPS+RTL8188E_TRANS_CARDEMU_TO_PDN_STEPS+RTL8188E_TRANS_END_STEPS]; -extern WLAN_PWR_CFG rtl8188E_card_enable_flow[RTL8188E_TRANS_ACT_TO_CARDEMU_STEPS+RTL8188E_TRANS_CARDEMU_TO_PDN_STEPS+RTL8188E_TRANS_END_STEPS]; -extern WLAN_PWR_CFG rtl8188E_suspend_flow[RTL8188E_TRANS_ACT_TO_CARDEMU_STEPS+RTL8188E_TRANS_CARDEMU_TO_SUS_STEPS+RTL8188E_TRANS_END_STEPS]; -extern WLAN_PWR_CFG rtl8188E_resume_flow[RTL8188E_TRANS_ACT_TO_CARDEMU_STEPS+RTL8188E_TRANS_CARDEMU_TO_SUS_STEPS+RTL8188E_TRANS_END_STEPS]; -extern WLAN_PWR_CFG rtl8188E_hwpdn_flow[RTL8188E_TRANS_ACT_TO_CARDEMU_STEPS+RTL8188E_TRANS_CARDEMU_TO_PDN_STEPS+RTL8188E_TRANS_END_STEPS]; -extern WLAN_PWR_CFG rtl8188E_enter_lps_flow[RTL8188E_TRANS_ACT_TO_LPS_STEPS+RTL8188E_TRANS_END_STEPS]; -extern WLAN_PWR_CFG rtl8188E_leave_lps_flow[RTL8188E_TRANS_LPS_TO_ACT_STEPS+RTL8188E_TRANS_END_STEPS]; - -#endif //__HAL8188EPWRSEQ_H__ - + +/****************************************************************************** + * + * 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 __HAL8188EPWRSEQ_H__ +#define __HAL8188EPWRSEQ_H__ + +#include "HalPwrSeqCmd.h" + +/* + Check document WM-20110607-Paul-RTL8188E_Power_Architecture-R02.vsd + There are 6 HW Power States: + 0: POFF--Power Off + 1: PDN--Power Down + 2: CARDEMU--Card Emulation + 3: ACT--Active Mode + 4: LPS--Low Power State + 5: SUS--Suspend + + The transision from different states are defined below + TRANS_CARDEMU_TO_ACT + TRANS_ACT_TO_CARDEMU + TRANS_CARDEMU_TO_SUS + TRANS_SUS_TO_CARDEMU + TRANS_CARDEMU_TO_PDN + TRANS_ACT_TO_LPS + TRANS_LPS_TO_ACT + + TRANS_END + + PWR SEQ Version: rtl8188E_PwrSeq_V09.h +*/ +#define RTL8188E_TRANS_CARDEMU_TO_ACT_STEPS 10 +#define RTL8188E_TRANS_ACT_TO_CARDEMU_STEPS 10 +#define RTL8188E_TRANS_CARDEMU_TO_SUS_STEPS 10 +#define RTL8188E_TRANS_SUS_TO_CARDEMU_STEPS 10 +#define RTL8188E_TRANS_CARDEMU_TO_PDN_STEPS 10 +#define RTL8188E_TRANS_PDN_TO_CARDEMU_STEPS 10 +#define RTL8188E_TRANS_ACT_TO_LPS_STEPS 15 +#define RTL8188E_TRANS_LPS_TO_ACT_STEPS 15 +#define RTL8188E_TRANS_END_STEPS 1 + + +#define RTL8188E_TRANS_CARDEMU_TO_ACT \ + /* format */ \ + /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \ + {0x0006, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_POLLING, BIT1, BIT1},/* wait till 0x04[17] = 1 power ready*/ \ + {0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0|BIT1, 0}, /* 0x02[1:0] = 0 reset BB*/ \ + {0x0026, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT7, BIT7}, /*0x24[23] = 2b'01 schmit trigger */ \ + {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT7, 0}, /* 0x04[15] = 0 disable HWPDN (control by DRV)*/\ + {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT4|BIT3, 0}, /*0x04[12:11] = 2b'00 disable WL suspend*/ \ + {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, BIT0}, /*0x04[8] = 1 polling until return 0*/ \ + {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_POLLING, BIT0, 0}, /*wait till 0x04[8] = 0*/ \ + {0x0023, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT4, 0}, /*LDO normal mode*/ \ + {0x0074, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT4, BIT4}, /*SDIO Driving*/ \ + +#define RTL8188E_TRANS_ACT_TO_CARDEMU \ + /* format */ \ + /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \ + {0x001F, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0},/*0x1F[7:0] = 0 turn off RF*/ \ + {0x0023, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT4, BIT4}, /*LDO Sleep mode*/ \ + {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT1, BIT1}, /*0x04[9] = 1 turn off MAC by HW state machine*/ \ + {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_POLLING, BIT1, 0}, /*wait till 0x04[9] = 0 polling until return 0 to disable*/ \ + +#define RTL8188E_TRANS_CARDEMU_TO_SUS \ + /* format */ \ + /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \ + {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK|PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT3|BIT4, BIT3}, /*0x04[12:11] = 2b'01enable WL suspend*/ \ + {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_PCI_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT3|BIT4, BIT3|BIT4}, /*0x04[12:11] = 2b'11enable WL suspend for PCIe*/ \ + {0x0007, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK|PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, BIT7}, /* 0x04[31:30] = 2b'10 enable enable bandgap mbias in suspend */ \ + {0x0041, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK|PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT4, 0}, /*Clear SIC_EN register 0x40[12] = 1'b0 */ \ + {0xfe10, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK|PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT4, BIT4}, /*Set USB suspend enable local register 0xfe10[4]=1 */ \ + {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_SDIO,PWR_CMD_WRITE, BIT0, BIT0}, /*Set SDIO suspend local register*/ \ + {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_SDIO,PWR_CMD_POLLING, BIT1, 0}, /*wait power state to suspend*/ + +#define RTL8188E_TRANS_SUS_TO_CARDEMU \ + /* format */ \ + /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \ + {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_SDIO,PWR_CMD_WRITE, BIT0, 0}, /*Set SDIO suspend local register*/ \ + {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_SDIO,PWR_CMD_POLLING, BIT1, BIT1}, /*wait power state to suspend*/\ + {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT3|BIT4, 0}, /*0x04[12:11] = 2b'01enable WL suspend*/ + +#define RTL8188E_TRANS_CARDEMU_TO_CARDDIS \ + /* format */ \ + /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \ + {0x0026, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT7, BIT7}, /*0x24[23] = 2b'01 schmit trigger */ \ + {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK|PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT3|BIT4, BIT3}, /*0x04[12:11] = 2b'01 enable WL suspend*/ \ + {0x0007, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK|PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0}, /* 0x04[31:30] = 2b'10 enable enable bandgap mbias in suspend */ \ + {0x0041, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK|PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT4, 0}, /*Clear SIC_EN register 0x40[12] = 1'b0 */ \ + {0xfe10, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT4, BIT4}, /*Set USB suspend enable local register 0xfe10[4]=1 */ \ + {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_SDIO,PWR_CMD_WRITE, BIT0, BIT0}, /*Set SDIO suspend local register*/ \ + {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_SDIO,PWR_CMD_POLLING, BIT1, 0}, /*wait power state to suspend*/ + +#define RTL8188E_TRANS_CARDDIS_TO_CARDEMU \ + /* format */ \ + /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \ + {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_SDIO,PWR_CMD_WRITE, BIT0, 0}, /*Set SDIO suspend local register*/ \ + {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_SDIO,PWR_CMD_POLLING, BIT1, BIT1}, /*wait power state to suspend*/\ + {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT3|BIT4, 0}, /*0x04[12:11] = 2b'01enable WL suspend*/ + +#define RTL8188E_TRANS_CARDEMU_TO_PDN \ + /* format */ \ + /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \ + {0x0006, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, 0},/* 0x04[16] = 0*/\ + {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT7, BIT7},/* 0x04[15] = 1*/ + +#define RTL8188E_TRANS_PDN_TO_CARDEMU \ + /* format */ \ + /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \ + {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT7, 0},/* 0x04[15] = 0*/ + +//This is used by driver for LPSRadioOff Procedure, not for FW LPS Step +#define RTL8188E_TRANS_ACT_TO_LPS \ + /* format */ \ + /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \ + {0x0522, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0x7F},/*Tx Pause*/ \ + {0x05F8, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_POLLING, 0xFF, 0},/*Should be zero if no packet is transmitting*/ \ + {0x05F9, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_POLLING, 0xFF, 0},/*Should be zero if no packet is transmitting*/ \ + {0x05FA, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_POLLING, 0xFF, 0},/*Should be zero if no packet is transmitting*/ \ + {0x05FB, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_POLLING, 0xFF, 0},/*Should be zero if no packet is transmitting*/ \ + {0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, 0},/*CCK and OFDM are disabled,and clock are gated*/ \ + {0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_DELAY, 0, PWRSEQ_DELAY_US},/*Delay 1us*/ \ + {0x0100, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0x3F},/*Reset MAC TRX*/ \ + {0x0101, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT1, 0},/*check if removed later*/ \ + {0x0553, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT5, BIT5},/*Respond TxOK to scheduler*/ \ + + +#define RTL8188E_TRANS_LPS_TO_ACT \ + /* format */ \ + /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \ + {0x0080, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_SDIO,PWR_CMD_WRITE, 0xFF, 0x84}, /*SDIO RPWM*/\ + {0xFE58, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0x84}, /*USB RPWM*/\ + {0x0361, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_PCI_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0x84}, /*PCIe RPWM*/\ + {0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_DELAY, 0, PWRSEQ_DELAY_MS}, /*Delay*/\ + {0x0008, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT4, 0}, /*. 0x08[4] = 0 switch TSF to 40M*/\ + {0x0109, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_POLLING, BIT7, 0}, /*Polling 0x109[7]=0 TSF in 40M*/\ + {0x0029, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT6|BIT7, 0}, /*. 0x29[7:6] = 2b'00 enable BB clock*/\ + {0x0101, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT1, BIT1}, /*. 0x101[1] = 1*/\ + {0x0100, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0xFF}, /*. 0x100[7:0] = 0xFF enable WMAC TRX*/\ + {0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT1|BIT0, BIT1|BIT0}, /*. 0x02[1:0] = 2b'11 enable BB macro*/\ + {0x0522, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0}, /*. 0x522 = 0*/ + +#define RTL8188E_TRANS_END \ + /* format */ \ + /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \ + {0xFFFF, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,0,PWR_CMD_END, 0, 0}, // + + +extern WLAN_PWR_CFG rtl8188E_power_on_flow[RTL8188E_TRANS_CARDEMU_TO_ACT_STEPS+RTL8188E_TRANS_END_STEPS]; +extern WLAN_PWR_CFG rtl8188E_radio_off_flow[RTL8188E_TRANS_ACT_TO_CARDEMU_STEPS+RTL8188E_TRANS_END_STEPS]; +extern WLAN_PWR_CFG rtl8188E_card_disable_flow[RTL8188E_TRANS_ACT_TO_CARDEMU_STEPS+RTL8188E_TRANS_CARDEMU_TO_PDN_STEPS+RTL8188E_TRANS_END_STEPS]; +extern WLAN_PWR_CFG rtl8188E_card_enable_flow[RTL8188E_TRANS_ACT_TO_CARDEMU_STEPS+RTL8188E_TRANS_CARDEMU_TO_PDN_STEPS+RTL8188E_TRANS_END_STEPS]; +extern WLAN_PWR_CFG rtl8188E_suspend_flow[RTL8188E_TRANS_ACT_TO_CARDEMU_STEPS+RTL8188E_TRANS_CARDEMU_TO_SUS_STEPS+RTL8188E_TRANS_END_STEPS]; +extern WLAN_PWR_CFG rtl8188E_resume_flow[RTL8188E_TRANS_ACT_TO_CARDEMU_STEPS+RTL8188E_TRANS_CARDEMU_TO_SUS_STEPS+RTL8188E_TRANS_END_STEPS]; +extern WLAN_PWR_CFG rtl8188E_hwpdn_flow[RTL8188E_TRANS_ACT_TO_CARDEMU_STEPS+RTL8188E_TRANS_CARDEMU_TO_PDN_STEPS+RTL8188E_TRANS_END_STEPS]; +extern WLAN_PWR_CFG rtl8188E_enter_lps_flow[RTL8188E_TRANS_ACT_TO_LPS_STEPS+RTL8188E_TRANS_END_STEPS]; +extern WLAN_PWR_CFG rtl8188E_leave_lps_flow[RTL8188E_TRANS_LPS_TO_ACT_STEPS+RTL8188E_TRANS_END_STEPS]; + +#endif //__HAL8188EPWRSEQ_H__ diff --git a/include/Hal8192CPhyCfg.h b/include/Hal8192CPhyCfg.h index 0ab5a0e..3a12dbc 100755 --- a/include/Hal8192CPhyCfg.h +++ b/include/Hal8192CPhyCfg.h @@ -1,7 +1,7 @@ /****************************************************************************** * * 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. @@ -21,18 +21,18 @@ * Module: __INC_HAL8192CPHYCFG_H * * - * Note: - * + * Note: + * * * Export: Constants, macro, functions(API), global variables(None). * - * Abbrev: + * Abbrev: * * History: - * Data Who Remark - * 08/07/2007 MHC 1. Porting from 9x series PHYCFG.h. + * Data Who Remark + * 08/07/2007 MHC 1. Porting from 9x series PHYCFG.h. * 2. Reorganize code architecture. - * + * *****************************************************************************/ /* Check to see if the file has been included already. */ #ifndef __INC_HAL8192CPHYCFG_H @@ -79,7 +79,7 @@ /*--------------------------Define Parameters-------------------------------*/ -/*------------------------------Define structure----------------------------*/ +/*------------------------------Define structure----------------------------*/ typedef enum _SwChnlCmdID{ CmdID_End, CmdID_SetTxPowerLevel, @@ -112,7 +112,7 @@ typedef enum _RF_RADIO_PATH{ RF_PATH_B = 1, //Radio Path B RF_PATH_C = 2, //Radio Path C RF_PATH_D = 3, //Radio Path D - //RF_PATH_MAX //Max RF number 90 support + //RF_PATH_MAX //Max RF number 90 support }RF_RADIO_PATH_E, *PRF_RADIO_PATH_E; #define RF_PATH_MAX 2 @@ -122,12 +122,12 @@ typedef enum _RF_RADIO_PATH{ typedef enum _WIRELESS_MODE { WIRELESS_MODE_UNKNOWN = 0x00, - WIRELESS_MODE_A = BIT2, - WIRELESS_MODE_B = BIT0, - WIRELESS_MODE_G = BIT1, - WIRELESS_MODE_AUTO = BIT5, - WIRELESS_MODE_N_24G = BIT3, - WIRELESS_MODE_N_5G = BIT4, + WIRELESS_MODE_A = BIT2, + WIRELESS_MODE_B = BIT0, + WIRELESS_MODE_G = BIT1, + WIRELESS_MODE_AUTO = BIT5, + WIRELESS_MODE_N_24G = BIT3, + WIRELESS_MODE_N_5G = BIT4, WIRELESS_MODE_AC = BIT6 } WIRELESS_MODE; @@ -152,75 +152,75 @@ typedef enum _PHY_Rate_Tx_Power_Offset_Area{ typedef enum _RF_TYPE_8190P{ RF_TYPE_MIN, // 0 RF_8225=1, // 1 11b/g RF for verification only - RF_8256=2, // 2 11b/g/n + RF_8256=2, // 2 11b/g/n RF_8258=3, // 3 11a/b/g/n RF RF_6052=4, // 4 11b/g/n RF //RF_6052=5, // 4 11b/g/n RF // TODO: We sholud remove this psudo PHY RF after we get new RF. - RF_PSEUDO_11N=5, // 5, It is a temporality RF. + RF_PSEUDO_11N=5, // 5, It is a temporality RF. }RF_TYPE_8190P_E,*PRF_TYPE_8190P_E; typedef struct _BB_REGISTER_DEFINITION{ - u32 rfintfs; // set software control: + u32 rfintfs; // set software control: // 0x870~0x877[8 bytes] - - u32 rfintfi; // readback data: + + u32 rfintfi; // readback data: // 0x8e0~0x8e7[8 bytes] - - u32 rfintfo; // output data: + + u32 rfintfo; // output data: // 0x860~0x86f [16 bytes] - - u32 rfintfe; // output enable: + + u32 rfintfe; // output enable: // 0x860~0x86f [16 bytes] - + u32 rf3wireOffset; // LSSI data: // 0x840~0x84f [16 bytes] - - u32 rfLSSI_Select; // BB Band Select: + + u32 rfLSSI_Select; // BB Band Select: // 0x878~0x87f [8 bytes] - - u32 rfTxGainStage; // Tx gain stage: + + u32 rfTxGainStage; // Tx gain stage: // 0x80c~0x80f [4 bytes] - - u32 rfHSSIPara1; // wire parameter control1 : + + u32 rfHSSIPara1; // wire parameter control1 : // 0x820~0x823,0x828~0x82b, 0x830~0x833, 0x838~0x83b [16 bytes] - - u32 rfHSSIPara2; // wire parameter control2 : + + u32 rfHSSIPara2; // wire parameter control2 : // 0x824~0x827,0x82c~0x82f, 0x834~0x837, 0x83c~0x83f [16 bytes] - - u32 rfSwitchControl; //Tx Rx antenna control : + + u32 rfSwitchControl; //Tx Rx antenna control : // 0x858~0x85f [16 bytes] - - u32 rfAGCControl1; //AGC parameter control1 : - // 0xc50~0xc53,0xc58~0xc5b, 0xc60~0xc63, 0xc68~0xc6b [16 bytes] - - u32 rfAGCControl2; //AGC parameter control2 : - // 0xc54~0xc57,0xc5c~0xc5f, 0xc64~0xc67, 0xc6c~0xc6f [16 bytes] - - u32 rfRxIQImbalance; //OFDM Rx IQ imbalance matrix : + + u32 rfAGCControl1; //AGC parameter control1 : + // 0xc50~0xc53,0xc58~0xc5b, 0xc60~0xc63, 0xc68~0xc6b [16 bytes] + + u32 rfAGCControl2; //AGC parameter control2 : + // 0xc54~0xc57,0xc5c~0xc5f, 0xc64~0xc67, 0xc6c~0xc6f [16 bytes] + + u32 rfRxIQImbalance; //OFDM Rx IQ imbalance matrix : // 0xc14~0xc17,0xc1c~0xc1f, 0xc24~0xc27, 0xc2c~0xc2f [16 bytes] - - u32 rfRxAFE; //Rx IQ DC ofset and Rx digital filter, Rx DC notch filter : + + u32 rfRxAFE; //Rx IQ DC ofset and Rx digital filter, Rx DC notch filter : // 0xc10~0xc13,0xc18~0xc1b, 0xc20~0xc23, 0xc28~0xc2b [16 bytes] - + u32 rfTxIQImbalance; //OFDM Tx IQ imbalance matrix // 0xc80~0xc83,0xc88~0xc8b, 0xc90~0xc93, 0xc98~0xc9b [16 bytes] - - u32 rfTxAFE; //Tx IQ DC Offset and Tx DFIR type + + u32 rfTxAFE; //Tx IQ DC Offset and Tx DFIR type // 0xc84~0xc87,0xc8c~0xc8f, 0xc94~0xc97, 0xc9c~0xc9f [16 bytes] - - u32 rfLSSIReadBack; //LSSI RF readback data SI mode + + u32 rfLSSIReadBack; //LSSI RF readback data SI mode // 0x8a0~0x8af [16 bytes] - u32 rfLSSIReadBackPi; //LSSI RF readback data PI mode 0x8b8-8bc for Path A and B + u32 rfLSSIReadBackPi; //LSSI RF readback data PI mode 0x8b8-8bc for Path A and B }BB_REGISTER_DEFINITION_T, *PBB_REGISTER_DEFINITION_T; -typedef struct _R_ANTENNA_SELECT_OFDM{ - u32 r_tx_antenna:4; +typedef struct _R_ANTENNA_SELECT_OFDM{ + u32 r_tx_antenna:4; u32 r_ant_l:4; - u32 r_ant_non_ht:4; + u32 r_ant_non_ht:4; u32 r_ant_ht1:4; u32 r_ant_ht2:4; u32 r_ant_ht_s1:4; @@ -230,12 +230,12 @@ typedef struct _R_ANTENNA_SELECT_OFDM{ }R_ANTENNA_SELECT_OFDM; typedef struct _R_ANTENNA_SELECT_CCK{ - u8 r_cckrx_enable_2:2; + u8 r_cckrx_enable_2:2; u8 r_cckrx_enable:2; u8 r_ccktx_enable:4; }R_ANTENNA_SELECT_CCK; -/*------------------------------Define structure----------------------------*/ +/*------------------------------Define structure----------------------------*/ /*------------------------Export global variable----------------------------*/ @@ -276,7 +276,7 @@ int PHY_BBConfig8192C( IN struct adapter *Adapter ); int PHY_RFConfig8192C( IN struct adapter *Adapter ); /* RF config */ int rtl8192c_PHY_ConfigRFWithParaFile( IN struct adapter *Adapter, - IN u8* pFileName, + IN u8* pFileName, IN RF_RADIO_PATH_E eRFPath); int rtl8192c_PHY_ConfigRFWithHeaderFile( IN struct adapter * Adapter, IN RF_RADIO_PATH_E eRFPath); @@ -291,21 +291,21 @@ void rtl8192c_PHY_GetHWRegOriginalValue( IN struct adapter * Adapter ); // // RF Power setting // -//extern BOOLEAN PHY_SetRFPowerState(IN struct adapter * Adapter, +//extern BOOLEAN PHY_SetRFPowerState(IN struct adapter * Adapter, // IN RT_RF_POWER_STATE eRFPowerState); // // BB TX Power R/W // void PHY_GetTxPowerLevel8192C( IN struct adapter * Adapter, - OUT u32* powerlevel ); + OUT u32* powerlevel ); void PHY_SetTxPowerLevel8192C( IN struct adapter * Adapter, IN u8 channel ); BOOLEAN PHY_UpdateTxPowerDbm8192C( IN struct adapter *Adapter, IN int powerInDbm ); // -VOID +VOID PHY_ScanOperationBackup8192C(IN struct adapter *Adapter, IN u8 Operation ); @@ -342,7 +342,7 @@ void PHY_SwChnlPhy8192C( IN struct adapter * pAdapter, IN u8 channel ); void ChkFwCmdIoDone( IN struct adapter *Adapter); - + // // BB/MAC/RF other monitor API // @@ -358,7 +358,7 @@ VOID rtl8192c_PHY_SetRFPathSwitch(IN struct adapter *pAdapter, IN BOOLEAN bMain // // Modify the value of the hw register when beacon interval be changed. // -void +void rtl8192c_PHY_SetBeaconHwReg( IN struct adapter * Adapter, IN u16 BeaconInterval ); @@ -376,7 +376,7 @@ PHY_EnableHostClkReq( BOOLEAN SetAntennaConfig92C( IN struct adapter *Adapter, - IN u8 DefaultAnt + IN u8 DefaultAnt ); #ifdef RTL8192C_RECONFIG_TO_1T1R @@ -393,4 +393,3 @@ extern void PHY_Reconfig_To_1T1R(struct adapter *padapter); #define PHY_QueryMacReg PHY_QueryBBReg #endif // __INC_HAL8192CPHYCFG_H - diff --git a/include/Hal8192CPhyReg.h b/include/Hal8192CPhyReg.h index 4902995..c6d9aff 100755 --- a/include/Hal8192CPhyReg.h +++ b/include/Hal8192CPhyReg.h @@ -1,7 +1,7 @@ /****************************************************************************** * * 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. @@ -27,18 +27,18 @@ * 3. PMAC/BB register bit mask. * 4. RF reg bit mask. * 5. Other BB/RF relative definition. - * + * * * Export: Constants, macro, functions(API), global variables(None). * - * Abbrev: + * Abbrev: * * History: - * Data Who Remark - * 08/07/2007 MHC 1. Porting from 9x series PHYCFG.h. + * Data Who Remark + * 08/07/2007 MHC 1. Porting from 9x series PHYCFG.h. * 2. Reorganize code architecture. * 09/25/2008 MH 1. Add RL6052 register definition - * + * *****************************************************************************/ #ifndef __INC_HAL8192CPHYREG_H #define __INC_HAL8192CPHYREG_H @@ -179,8 +179,8 @@ #define rCCK0_AFESetting 0xa04 // Disable init gain now // Select RX path by RSSI #define rCCK0_CCA 0xa08 // Disable init gain now // Init gain -#define rCCK0_RxAGC1 0xa0c //AGC default value, saturation level // Antenna Diversity, RX AGC, LNA Threshold, RX LNA Threshold useless now. Not the same as 90 series -#define rCCK0_RxAGC2 0xa10 //AGC & DAGC +#define rCCK0_RxAGC1 0xa0c //AGC default value, saturation level // Antenna Diversity, RX AGC, LNA Threshold, RX LNA Threshold useless now. Not the same as 90 series +#define rCCK0_RxAGC2 0xa10 //AGC & DAGC #define rCCK0_RxHP 0xa14 @@ -191,20 +191,20 @@ #define rCCK0_TxFilter2 0xa24 #define rCCK0_DebugPort 0xa28 //debug port and Tx filter3 #define rCCK0_FalseAlarmReport 0xa2c //0xa2d useless now 0xa30-a4f channel report -#define rCCK0_TRSSIReport 0xa50 -#define rCCK0_RxReport 0xa54 //0xa57 -#define rCCK0_FACounterLower 0xa5c //0xa5b -#define rCCK0_FACounterUpper 0xa58 //0xa5c +#define rCCK0_TRSSIReport 0xa50 +#define rCCK0_RxReport 0xa54 //0xa57 +#define rCCK0_FACounterLower 0xa5c //0xa5b +#define rCCK0_FACounterUpper 0xa58 //0xa5c // // PageB(0xB00) // -#define rPdp_AntA 0xb00 -#define rPdp_AntA_4 0xb04 -#define rConfig_Pmpd_AntA 0xb28 -#define rConfig_AntA 0xb68 -#define rConfig_AntB 0xb6c -#define rPdp_AntB 0xb70 -#define rPdp_AntB_4 0xb74 +#define rPdp_AntA 0xb00 +#define rPdp_AntA_4 0xb04 +#define rConfig_Pmpd_AntA 0xb28 +#define rConfig_AntA 0xb68 +#define rConfig_AntB 0xb6c +#define rPdp_AntB 0xb70 +#define rPdp_AntB_4 0xb74 #define rConfig_Pmpd_AntB 0xb98 #define rAPK 0xbd8 @@ -218,16 +218,16 @@ #define rOFDM0_TRSWIsolation 0xc0c #define rOFDM0_XARxAFE 0xc10 //RxIQ DC offset, Rx digital filter, DC notch filter -#define rOFDM0_XARxIQImbalance 0xc14 //RxIQ imblance matrix -#define rOFDM0_XBRxAFE 0xc18 -#define rOFDM0_XBRxIQImbalance 0xc1c -#define rOFDM0_XCRxAFE 0xc20 -#define rOFDM0_XCRxIQImbalance 0xc24 -#define rOFDM0_XDRxAFE 0xc28 -#define rOFDM0_XDRxIQImbalance 0xc2c +#define rOFDM0_XARxIQImbalance 0xc14 //RxIQ imblance matrix +#define rOFDM0_XBRxAFE 0xc18 +#define rOFDM0_XBRxIQImbalance 0xc1c +#define rOFDM0_XCRxAFE 0xc20 +#define rOFDM0_XCRxIQImbalance 0xc24 +#define rOFDM0_XDRxAFE 0xc28 +#define rOFDM0_XDRxIQImbalance 0xc2c #define rOFDM0_RxDetector1 0xc30 //PD,BW & SBD // DM tune init gain -#define rOFDM0_RxDetector2 0xc34 //SBD & Fame Sync. +#define rOFDM0_RxDetector2 0xc34 //SBD & Fame Sync. #define rOFDM0_RxDetector3 0xc38 //Frame Sync. #define rOFDM0_RxDetector4 0xc3c //PD, SBD, Frame Sync & Short-GI @@ -255,7 +255,7 @@ #define rOFDM0_XBTxIQImbalance 0xc88 #define rOFDM0_XBTxAFE 0xc8c #define rOFDM0_XCTxIQImbalance 0xc90 -#define rOFDM0_XCTxAFE 0xc94 +#define rOFDM0_XCTxAFE 0xc94 #define rOFDM0_XDTxIQImbalance 0xc98 #define rOFDM0_XDTxAFE 0xc9c @@ -298,8 +298,8 @@ #define rOFDM_LongCFOCD 0xdb8 #define rOFDM_TailCFOAB 0xdbc #define rOFDM_TailCFOCD 0xdc0 -#define rOFDM_PWMeasure1 0xdc4 -#define rOFDM_PWMeasure2 0xdc8 +#define rOFDM_PWMeasure1 0xdc4 +#define rOFDM_PWMeasure2 0xdc8 #define rOFDM_BWReport 0xdcc #define rOFDM_AGCReport 0xdd0 #define rOFDM_RxSNR 0xdd4 @@ -324,7 +324,7 @@ #define rTx_IQK_PI_A 0xe38 #define rRx_IQK_PI_A 0xe3c -#define rTx_IQK 0xe40 +#define rTx_IQK 0xe40 #define rRx_IQK 0xe44 #define rIQK_AGC_Pts 0xe48 #define rIQK_AGC_Rsp 0xe4c @@ -361,10 +361,10 @@ #define rRx_Power_After_IQK_B_2 0xecc #define rRx_OFDM 0xed0 -#define rRx_Wait_RIFS 0xed4 -#define rRx_TO_Rx 0xed8 -#define rStandby 0xedc -#define rSleep 0xee0 +#define rRx_Wait_RIFS 0xed4 +#define rRx_TO_Rx 0xed8 +#define rStandby 0xedc +#define rSleep 0xee0 #define rPMPD_ANAEN 0xeec // @@ -398,56 +398,56 @@ // // RL6052 Register definition // -#define RF_AC 0x00 // +#define RF_AC 0x00 // -#define RF_IQADJ_G1 0x01 // -#define RF_IQADJ_G2 0x02 // +#define RF_IQADJ_G1 0x01 // +#define RF_IQADJ_G2 0x02 // #define RF_BS_PA_APSET_G1_G4 0x03 #define RF_BS_PA_APSET_G5_G8 0x04 -#define RF_POW_TRSW 0x05 // +#define RF_POW_TRSW 0x05 // -#define RF_GAIN_RX 0x06 // -#define RF_GAIN_TX 0x07 // +#define RF_GAIN_RX 0x06 // +#define RF_GAIN_TX 0x07 // -#define RF_TXM_IDAC 0x08 // -#define RF_IPA_G 0x09 // +#define RF_TXM_IDAC 0x08 // +#define RF_IPA_G 0x09 // #define RF_TXBIAS_G 0x0A #define RF_TXPA_AG 0x0B -#define RF_IPA_A 0x0C // +#define RF_IPA_A 0x0C // #define RF_TXBIAS_A 0x0D #define RF_BS_PA_APSET_G9_G11 0x0E -#define RF_BS_IQGEN 0x0F // +#define RF_BS_IQGEN 0x0F // -#define RF_MODE1 0x10 // -#define RF_MODE2 0x11 // +#define RF_MODE1 0x10 // +#define RF_MODE2 0x11 // -#define RF_RX_AGC_HP 0x12 // -#define RF_TX_AGC 0x13 // -#define RF_BIAS 0x14 // -#define RF_IPA 0x15 // +#define RF_RX_AGC_HP 0x12 // +#define RF_TX_AGC 0x13 // +#define RF_BIAS 0x14 // +#define RF_IPA 0x15 // #define RF_TXBIAS 0x16 // -#define RF_POW_ABILITY 0x17 // -#define RF_MODE_AG 0x18 // +#define RF_POW_ABILITY 0x17 // +#define RF_MODE_AG 0x18 // #define rRfChannel 0x18 // RF channel and BW switch #define RF_CHNLBW 0x18 // RF channel and BW switch -#define RF_TOP 0x19 // +#define RF_TOP 0x19 // -#define RF_RX_G1 0x1A // -#define RF_RX_G2 0x1B // +#define RF_RX_G1 0x1A // +#define RF_RX_G2 0x1B // -#define RF_RX_BB2 0x1C // -#define RF_RX_BB1 0x1D // +#define RF_RX_BB2 0x1C // +#define RF_RX_BB1 0x1D // -#define RF_RCK1 0x1E // -#define RF_RCK2 0x1F // +#define RF_RCK1 0x1E // +#define RF_RCK2 0x1F // -#define RF_TX_G1 0x20 // -#define RF_TX_G2 0x21 // -#define RF_TX_G3 0x22 // +#define RF_TX_G1 0x20 // +#define RF_TX_G2 0x21 // +#define RF_TX_G3 0x22 // -#define RF_TX_BB1 0x23 // +#define RF_TX_BB1 0x23 // -#define RF_T_METER 0x24 // +#define RF_T_METER 0x24 // #define RF_SYN_G1 0x25 // RF TX Power control #define RF_SYN_G2 0x26 // RF TX Power control @@ -513,7 +513,7 @@ #define bCCKTxStatus 0x1 #define bOFDMTxStatus 0x2 -#define IS_BB_REG_OFFSET_92S(_Offset) ((_Offset >= 0x800) && (_Offset <= 0xfff)) +#define IS_BB_REG_OFFSET_92S(_Offset) ((_Offset >= 0x800) && (_Offset <= 0xfff)) // 2. Page8(0x800) #define bRFMOD 0x1 // Reg 0x800 rFPGA0_RFMOD @@ -522,157 +522,157 @@ #define bCCKEn 0x1000000 #define bOFDMEn 0x2000000 -#define bOFDMRxADCPhase 0x10000 // Useless now -#define bOFDMTxDACPhase 0x40000 -#define bXATxAGC 0x3f +#define bOFDMRxADCPhase 0x10000 // Useless now +#define bOFDMTxDACPhase 0x40000 +#define bXATxAGC 0x3f -#define bAntennaSelect 0x0300 +#define bAntennaSelect 0x0300 -#define bXBTxAGC 0xf00 // Reg 80c rFPGA0_TxGainStage -#define bXCTxAGC 0xf000 -#define bXDTxAGC 0xf0000 - -#define bPAStart 0xf0000000 // Useless now -#define bTRStart 0x00f00000 -#define bRFStart 0x0000f000 -#define bBBStart 0x000000f0 -#define bBBCCKStart 0x0000000f -#define bPAEnd 0xf //Reg0x814 -#define bTREnd 0x0f000000 -#define bRFEnd 0x000f0000 -#define bCCAMask 0x000000f0 //T2R -#define bR2RCCAMask 0x00000f00 -#define bHSSI_R2TDelay 0xf8000000 -#define bHSSI_T2RDelay 0xf80000 -#define bContTxHSSI 0x400 //chane gain at continue Tx -#define bIGFromCCK 0x200 -#define bAGCAddress 0x3f -#define bRxHPTx 0x7000 -#define bRxHPT2R 0x38000 -#define bRxHPCCKIni 0xc0000 -#define bAGCTxCode 0xc00000 -#define bAGCRxCode 0x300000 +#define bXBTxAGC 0xf00 // Reg 80c rFPGA0_TxGainStage +#define bXCTxAGC 0xf000 +#define bXDTxAGC 0xf0000 -#define b3WireDataLength 0x800 // Reg 0x820~84f rFPGA0_XA_HSSIParameter1 -#define b3WireAddressLength 0x400 +#define bPAStart 0xf0000000 // Useless now +#define bTRStart 0x00f00000 +#define bRFStart 0x0000f000 +#define bBBStart 0x000000f0 +#define bBBCCKStart 0x0000000f +#define bPAEnd 0xf //Reg0x814 +#define bTREnd 0x0f000000 +#define bRFEnd 0x000f0000 +#define bCCAMask 0x000000f0 //T2R +#define bR2RCCAMask 0x00000f00 +#define bHSSI_R2TDelay 0xf8000000 +#define bHSSI_T2RDelay 0xf80000 +#define bContTxHSSI 0x400 //chane gain at continue Tx +#define bIGFromCCK 0x200 +#define bAGCAddress 0x3f +#define bRxHPTx 0x7000 +#define bRxHPT2R 0x38000 +#define bRxHPCCKIni 0xc0000 +#define bAGCTxCode 0xc00000 +#define bAGCRxCode 0x300000 -#define b3WireRFPowerDown 0x1 // Useless now -//#define bHWSISelect 0x8 -#define b5GPAPEPolarity 0x40000000 -#define b2GPAPEPolarity 0x80000000 -#define bRFSW_TxDefaultAnt 0x3 -#define bRFSW_TxOptionAnt 0x30 -#define bRFSW_RxDefaultAnt 0x300 -#define bRFSW_RxOptionAnt 0x3000 -#define bRFSI_3WireData 0x1 -#define bRFSI_3WireClock 0x2 -#define bRFSI_3WireLoad 0x4 -#define bRFSI_3WireRW 0x8 -#define bRFSI_3Wire 0xf +#define b3WireDataLength 0x800 // Reg 0x820~84f rFPGA0_XA_HSSIParameter1 +#define b3WireAddressLength 0x400 -#define bRFSI_RFENV 0x10 // Reg 0x870 rFPGA0_XAB_RFInterfaceSW +#define b3WireRFPowerDown 0x1 // Useless now +//#define bHWSISelect 0x8 +#define b5GPAPEPolarity 0x40000000 +#define b2GPAPEPolarity 0x80000000 +#define bRFSW_TxDefaultAnt 0x3 +#define bRFSW_TxOptionAnt 0x30 +#define bRFSW_RxDefaultAnt 0x300 +#define bRFSW_RxOptionAnt 0x3000 +#define bRFSI_3WireData 0x1 +#define bRFSI_3WireClock 0x2 +#define bRFSI_3WireLoad 0x4 +#define bRFSI_3WireRW 0x8 +#define bRFSI_3Wire 0xf -#define bRFSI_TRSW 0x20 // Useless now -#define bRFSI_TRSWB 0x40 -#define bRFSI_ANTSW 0x100 -#define bRFSI_ANTSWB 0x200 -#define bRFSI_PAPE 0x400 -#define bRFSI_PAPE5G 0x800 -#define bBandSelect 0x1 -#define bHTSIG2_GI 0x80 -#define bHTSIG2_Smoothing 0x01 -#define bHTSIG2_Sounding 0x02 -#define bHTSIG2_Aggreaton 0x08 -#define bHTSIG2_STBC 0x30 -#define bHTSIG2_AdvCoding 0x40 -#define bHTSIG2_NumOfHTLTF 0x300 -#define bHTSIG2_CRC8 0x3fc -#define bHTSIG1_MCS 0x7f -#define bHTSIG1_BandWidth 0x80 -#define bHTSIG1_HTLength 0xffff -#define bLSIG_Rate 0xf -#define bLSIG_Reserved 0x10 -#define bLSIG_Length 0x1fffe -#define bLSIG_Parity 0x20 -#define bCCKRxPhase 0x4 +#define bRFSI_RFENV 0x10 // Reg 0x870 rFPGA0_XAB_RFInterfaceSW -#define bLSSIReadAddress 0x7f800000 // T65 RF +#define bRFSI_TRSW 0x20 // Useless now +#define bRFSI_TRSWB 0x40 +#define bRFSI_ANTSW 0x100 +#define bRFSI_ANTSWB 0x200 +#define bRFSI_PAPE 0x400 +#define bRFSI_PAPE5G 0x800 +#define bBandSelect 0x1 +#define bHTSIG2_GI 0x80 +#define bHTSIG2_Smoothing 0x01 +#define bHTSIG2_Sounding 0x02 +#define bHTSIG2_Aggreaton 0x08 +#define bHTSIG2_STBC 0x30 +#define bHTSIG2_AdvCoding 0x40 +#define bHTSIG2_NumOfHTLTF 0x300 +#define bHTSIG2_CRC8 0x3fc +#define bHTSIG1_MCS 0x7f +#define bHTSIG1_BandWidth 0x80 +#define bHTSIG1_HTLength 0xffff +#define bLSIG_Rate 0xf +#define bLSIG_Reserved 0x10 +#define bLSIG_Length 0x1fffe +#define bLSIG_Parity 0x20 +#define bCCKRxPhase 0x4 -#define bLSSIReadEdge 0x80000000 //LSSI "Read" edge signal +#define bLSSIReadAddress 0x7f800000 // T65 RF -#define bLSSIReadBackData 0xfffff // T65 RF +#define bLSSIReadEdge 0x80000000 //LSSI "Read" edge signal -#define bLSSIReadOKFlag 0x1000 // Useless now -#define bCCKSampleRate 0x8 //0: 44MHz, 1:88MHz -#define bRegulator0Standby 0x1 -#define bRegulatorPLLStandby 0x2 -#define bRegulator1Standby 0x4 -#define bPLLPowerUp 0x8 -#define bDPLLPowerUp 0x10 -#define bDA10PowerUp 0x20 -#define bAD7PowerUp 0x200 -#define bDA6PowerUp 0x2000 -#define bXtalPowerUp 0x4000 -#define b40MDClkPowerUP 0x8000 -#define bDA6DebugMode 0x20000 -#define bDA6Swing 0x380000 +#define bLSSIReadBackData 0xfffff // T65 RF -#define bADClkPhase 0x4000000 // Reg 0x880 rFPGA0_AnalogParameter1 20/40 CCK support switch 40/80 BB MHZ +#define bLSSIReadOKFlag 0x1000 // Useless now +#define bCCKSampleRate 0x8 //0: 44MHz, 1:88MHz +#define bRegulator0Standby 0x1 +#define bRegulatorPLLStandby 0x2 +#define bRegulator1Standby 0x4 +#define bPLLPowerUp 0x8 +#define bDPLLPowerUp 0x10 +#define bDA10PowerUp 0x20 +#define bAD7PowerUp 0x200 +#define bDA6PowerUp 0x2000 +#define bXtalPowerUp 0x4000 +#define b40MDClkPowerUP 0x8000 +#define bDA6DebugMode 0x20000 +#define bDA6Swing 0x380000 -#define b80MClkDelay 0x18000000 // Useless -#define bAFEWatchDogEnable 0x20000000 +#define bADClkPhase 0x4000000 // Reg 0x880 rFPGA0_AnalogParameter1 20/40 CCK support switch 40/80 BB MHZ -#define bXtalCap01 0xc0000000 // Reg 0x884 rFPGA0_AnalogParameter2 Crystal cap -#define bXtalCap23 0x3 +#define b80MClkDelay 0x18000000 // Useless +#define bAFEWatchDogEnable 0x20000000 + +#define bXtalCap01 0xc0000000 // Reg 0x884 rFPGA0_AnalogParameter2 Crystal cap +#define bXtalCap23 0x3 #define bXtalCap92x 0x0f000000 -#define bXtalCap 0x0f000000 +#define bXtalCap 0x0f000000 -#define bIntDifClkEnable 0x400 // Useless -#define bExtSigClkEnable 0x800 -#define bBandgapMbiasPowerUp 0x10000 -#define bAD11SHGain 0xc0000 -#define bAD11InputRange 0x700000 -#define bAD11OPCurrent 0x3800000 -#define bIPathLoopback 0x4000000 -#define bQPathLoopback 0x8000000 -#define bAFELoopback 0x10000000 -#define bDA10Swing 0x7e0 -#define bDA10Reverse 0x800 -#define bDAClkSource 0x1000 -#define bAD7InputRange 0x6000 -#define bAD7Gain 0x38000 -#define bAD7OutputCMMode 0x40000 -#define bAD7InputCMMode 0x380000 -#define bAD7Current 0xc00000 -#define bRegulatorAdjust 0x7000000 -#define bAD11PowerUpAtTx 0x1 -#define bDA10PSAtTx 0x10 -#define bAD11PowerUpAtRx 0x100 -#define bDA10PSAtRx 0x1000 -#define bCCKRxAGCFormat 0x200 -#define bPSDFFTSamplepPoint 0xc000 -#define bPSDAverageNum 0x3000 -#define bIQPathControl 0xc00 -#define bPSDFreq 0x3ff -#define bPSDAntennaPath 0x30 -#define bPSDIQSwitch 0x40 -#define bPSDRxTrigger 0x400000 -#define bPSDTxTrigger 0x80000000 -#define bPSDSineToneScale 0x7f000000 -#define bPSDReport 0xffff +#define bIntDifClkEnable 0x400 // Useless +#define bExtSigClkEnable 0x800 +#define bBandgapMbiasPowerUp 0x10000 +#define bAD11SHGain 0xc0000 +#define bAD11InputRange 0x700000 +#define bAD11OPCurrent 0x3800000 +#define bIPathLoopback 0x4000000 +#define bQPathLoopback 0x8000000 +#define bAFELoopback 0x10000000 +#define bDA10Swing 0x7e0 +#define bDA10Reverse 0x800 +#define bDAClkSource 0x1000 +#define bAD7InputRange 0x6000 +#define bAD7Gain 0x38000 +#define bAD7OutputCMMode 0x40000 +#define bAD7InputCMMode 0x380000 +#define bAD7Current 0xc00000 +#define bRegulatorAdjust 0x7000000 +#define bAD11PowerUpAtTx 0x1 +#define bDA10PSAtTx 0x10 +#define bAD11PowerUpAtRx 0x100 +#define bDA10PSAtRx 0x1000 +#define bCCKRxAGCFormat 0x200 +#define bPSDFFTSamplepPoint 0xc000 +#define bPSDAverageNum 0x3000 +#define bIQPathControl 0xc00 +#define bPSDFreq 0x3ff +#define bPSDAntennaPath 0x30 +#define bPSDIQSwitch 0x40 +#define bPSDRxTrigger 0x400000 +#define bPSDTxTrigger 0x80000000 +#define bPSDSineToneScale 0x7f000000 +#define bPSDReport 0xffff // 3. Page9(0x900) -#define bOFDMTxSC 0x30000000 // Useless -#define bCCKTxOn 0x1 -#define bOFDMTxOn 0x2 -#define bDebugPage 0xfff //reset debug page and also HWord, LWord -#define bDebugItem 0xff //reset debug page and LWord -#define bAntL 0x10 -#define bAntNonHT 0x100 -#define bAntHT1 0x1000 -#define bAntHT2 0x10000 -#define bAntHT1S1 0x100000 -#define bAntNonHTS1 0x1000000 +#define bOFDMTxSC 0x30000000 // Useless +#define bCCKTxOn 0x1 +#define bOFDMTxOn 0x2 +#define bDebugPage 0xfff //reset debug page and also HWord, LWord +#define bDebugItem 0xff //reset debug page and LWord +#define bAntL 0x10 +#define bAntNonHT 0x100 +#define bAntHT1 0x1000 +#define bAntHT2 0x10000 +#define bAntHT1S1 0x100000 +#define bAntNonHTS1 0x1000000 // 4. PageA(0xA00) #define bCCKBBMode 0x3 // Useless @@ -716,7 +716,7 @@ #define bCCKRxAGCSatCount 0xe0 #define bCCKRxRFSettle 0x1f //AGCsamp_dly #define bCCKFixedRxAGC 0x8000 -//#define bCCKRxAGCFormat 0x4000 //remove to HSSI register 0x824 +//#define bCCKRxAGCFormat 0x4000 //remove to HSSI register 0x824 #define bCCKAntennaPolarity 0x2000 #define bCCKTxFilterType 0x0c00 #define bCCKRxAGCReportType 0x0300 @@ -748,9 +748,9 @@ #define bCCKRxFACounterLower 0xff #define bCCKRxFACounterUpper 0xff000000 #define bCCKRxHPAGCStart 0xe000 -#define bCCKRxHPAGCFinal 0x1c00 +#define bCCKRxHPAGCFinal 0x1c00 #define bCCKRxFalseAlarmEnable 0x8000 -#define bCCKFACounterFreeze 0x4000 +#define bCCKFACounterFreeze 0x4000 #define bCCKTxPathSel 0x10000000 #define bCCKDefaultRxPath 0xc000000 #define bCCKOptionRxPath 0x3000000 @@ -902,16 +902,16 @@ #define bRxSGI_TH 0xc0000000 #define bDFSCnt0 0xff #define bDFSCnt1 0xff00 -#define bDFSFlag 0xf0000 +#define bDFSFlag 0xf0000 #define bMFWeightSum 0x300000 -#define bMinIdxTH 0x7f000000 -#define bDAFormat 0x40000 -#define bTxChEmuEnable 0x01000000 +#define bMinIdxTH 0x7f000000 +#define bDAFormat 0x40000 +#define bTxChEmuEnable 0x01000000 #define bTRSWIsolation_A 0x7f #define bTRSWIsolation_B 0x7f00 #define bTRSWIsolation_C 0x7f0000 -#define bTRSWIsolation_D 0x7f000000 -#define bExtLNAGain 0x7c00 +#define bTRSWIsolation_D 0x7f000000 +#define bExtLNAGain 0x7c00 // 6. PageE(0xE00) #define bSTBCEn 0x4 // Useless @@ -948,7 +948,7 @@ #define bLongCFOFLength 11 #define bTailCFO 0x1fff #define bTailCFOTLength 13 -#define bTailCFOFLength 12 +#define bTailCFOFLength 12 #define bmax_en_pwdB 0xffff #define bCC_power_dB 0xffff0000 #define bnoise_pwdB 0xffff @@ -956,27 +956,27 @@ #define bPowerMeasFLength 3 #define bRx_HT_BW 0x1 #define bRxSC 0x6 -#define bRx_HT 0x8 +#define bRx_HT 0x8 #define bNB_intf_det_on 0x1 #define bIntf_win_len_cfg 0x30 -#define bNB_Intf_TH_cfg 0x1c0 +#define bNB_Intf_TH_cfg 0x1c0 #define bRFGain 0x3f #define bTableSel 0x40 -#define bTRSW 0x80 +#define bTRSW 0x80 #define bRxSNR_A 0xff #define bRxSNR_B 0xff00 #define bRxSNR_C 0xff0000 #define bRxSNR_D 0xff000000 #define bSNREVMTLength 8 -#define bSNREVMFLength 1 +#define bSNREVMFLength 1 #define bCSI1st 0xff #define bCSI2nd 0xff00 #define bRxEVM1st 0xff0000 -#define bRxEVM2nd 0xff000000 +#define bRxEVM2nd 0xff000000 #define bSIGEVM 0xff #define bPWDB 0xff00 #define bSGIEN 0x10000 - + #define bSFactorQAM1 0xf // Useless #define bSFactorQAM2 0xf0 #define bSFactorQAM3 0xf00 @@ -987,7 +987,7 @@ #define bSFactorQAM8 0xf000000 #define bSFactorQAM9 0xf0000000 #define bCSIScheme 0x100000 - + #define bNoiseLvlTopSet 0x3 // Useless #define bChSmooth 0x4 #define bChSmoothCfg1 0x38 @@ -996,7 +996,7 @@ #define bChSmoothCfg4 0x7000 #define bMRCMode 0x800000 #define bTHEVMCfg 0x7000000 - + #define bLoopFitType 0x1 // Useless #define bUpdCFO 0x40 #define bUpdCFOOffData 0x80 @@ -1070,24 +1070,24 @@ #define bMaskLWord 0x0000ffff #define bMaskDWord 0xffffffff #define bMask12Bits 0xfff -#define bMaskH4Bits 0xf0000000 +#define bMaskH4Bits 0xf0000000 #define bMaskOFDM_D 0xffc00000 #define bMaskCCK 0x3f3f3f3f //for PutRFRegsetting & GetRFRegSetting BitMask //#define bMask12Bits 0xfffff // RF Reg mask bits //#define bMask20Bits 0xfffff // RF Reg mask bits T65 RF -#define bRFRegOffsetMask 0xfffff - +#define bRFRegOffsetMask 0xfffff + #define bEnable 0x1 // Useless #define bDisable 0x0 - + #define LeftAntenna 0x0 // Useless #define RightAntenna 0x1 - + #define tCheckTxStatus 500 //500ms // Useless #define tUpdateRxCounter 100 //100ms - + #define rateCCK 0 // Useless #define rateOFDM 1 #define rateHT 2 @@ -1110,7 +1110,7 @@ #define bPMACControl 0x0 // Useless #define bWMACControl 0x1 #define bWNICControl 0x2 - + #define PathA 0x0 // Useless #define PathB 0x1 #define PathC 0x2 @@ -1120,4 +1120,3 @@ #endif //__INC_HAL8192SPHYREG_H - diff --git a/include/Hal8192DPhyCfg.h b/include/Hal8192DPhyCfg.h index 60f7ec0..0d5fe4d 100755 --- a/include/Hal8192DPhyCfg.h +++ b/include/Hal8192DPhyCfg.h @@ -1,7 +1,7 @@ /****************************************************************************** * * 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. @@ -22,18 +22,18 @@ * Module: __INC_HAL8192DPHYCFG_H * * - * Note: - * + * Note: + * * * Export: Constants, macro, functions(API), global variables(None). * - * Abbrev: + * Abbrev: * * History: - * Data Who Remark - * 08/07/2007 MHC 1. Porting from 9x series PHYCFG.h. + * Data Who Remark + * 08/07/2007 MHC 1. Porting from 9x series PHYCFG.h. * 2. Reorganize code architecture. - * + * *****************************************************************************/ /* Check to see if the file has been included already. */ #ifndef __INC_HAL8192DPHYCFG_H @@ -74,7 +74,7 @@ /*--------------------------Define Parameters-------------------------------*/ -/*------------------------------Define structure----------------------------*/ +/*------------------------------Define structure----------------------------*/ typedef enum _SwChnlCmdID{ CmdID_End, CmdID_SetTxPowerLevel, @@ -115,7 +115,7 @@ typedef enum _RF_RADIO_PATH{ RF_PATH_B = 1, //Radio Path B RF_PATH_C = 2, //Radio Path C RF_PATH_D = 3, //Radio Path D - //RF_PATH_MAX //Max RF number 90 support + //RF_PATH_MAX //Max RF number 90 support }RF_RADIO_PATH_E, *PRF_RADIO_PATH_E; #define RF_PATH_MAX 2 @@ -150,8 +150,8 @@ typedef enum _WIRELESS_MODE { #if (RTL8192D_DUAL_MAC_MODE_SWITCH == 1) typedef enum _BaseBand_Config_Type{ - BaseBand_Config_PHY_REG = 0, - BaseBand_Config_AGC_TAB = 1, + BaseBand_Config_PHY_REG = 0, + BaseBand_Config_AGC_TAB = 1, BaseBand_Config_AGC_TAB_2G = 2, BaseBand_Config_AGC_TAB_5G = 3, }BaseBand_Config_Type, *PBaseBand_Config_Type; @@ -166,7 +166,7 @@ typedef enum _BaseBand_Config_Type{ typedef enum _MACPHY_MODE_8192D{ SINGLEMAC_SINGLEPHY, //SMSP DUALMAC_DUALPHY, //DMDP - DUALMAC_SINGLEPHY, //DMSP + DUALMAC_SINGLEPHY, //DMSP }MACPHY_MODE_8192D,*PMACPHY_MODE_8192D; typedef enum _MACPHY_MODE_CHANGE_ACTION{ @@ -180,7 +180,7 @@ typedef enum _MACPHY_MODE_CHANGE_ACTION{ }MACPHY_MODE_CHANGE_ACTION,*PMACPHY_MODE_CHANGE_ACTION; typedef enum _BAND_TYPE{ - BAND_ON_2_4G = 1, + BAND_ON_2_4G = 1, BAND_ON_5G = 2, BAND_ON_BOTH, BANDMAX @@ -201,77 +201,77 @@ typedef enum _PHY_Rate_Tx_Power_Offset_Area{ typedef enum _RF_TYPE_8190P{ RF_TYPE_MIN, // 0 RF_8225=1, // 1 11b/g RF for verification only - RF_8256=2, // 2 11b/g/n + RF_8256=2, // 2 11b/g/n RF_8258=3, // 3 11a/b/g/n RF RF_6052=4, // 4 11b/g/n RF //RF_6052=5, // 4 11b/g/n RF // TODO: We sholud remove this psudo PHY RF after we get new RF. - RF_PSEUDO_11N=5, // 5, It is a temporality RF. + RF_PSEUDO_11N=5, // 5, It is a temporality RF. }RF_TYPE_8190P_E,*PRF_TYPE_8190P_E; typedef struct _BB_REGISTER_DEFINITION{ - u32 rfintfs; // set software control: + u32 rfintfs; // set software control: // 0x870~0x877[8 bytes] - - u32 rfintfi; // readback data: + + u32 rfintfi; // readback data: // 0x8e0~0x8e7[8 bytes] - - u32 rfintfo; // output data: + + u32 rfintfo; // output data: // 0x860~0x86f [16 bytes] - - u32 rfintfe; // output enable: + + u32 rfintfe; // output enable: // 0x860~0x86f [16 bytes] - + u32 rf3wireOffset; // LSSI data: // 0x840~0x84f [16 bytes] - - u32 rfLSSI_Select; // BB Band Select: + + u32 rfLSSI_Select; // BB Band Select: // 0x878~0x87f [8 bytes] - - u32 rfTxGainStage; // Tx gain stage: + + u32 rfTxGainStage; // Tx gain stage: // 0x80c~0x80f [4 bytes] - - u32 rfHSSIPara1; // wire parameter control1 : + + u32 rfHSSIPara1; // wire parameter control1 : // 0x820~0x823,0x828~0x82b, 0x830~0x833, 0x838~0x83b [16 bytes] - - u32 rfHSSIPara2; // wire parameter control2 : + + u32 rfHSSIPara2; // wire parameter control2 : // 0x824~0x827,0x82c~0x82f, 0x834~0x837, 0x83c~0x83f [16 bytes] - - u32 rfSwitchControl; //Tx Rx antenna control : + + u32 rfSwitchControl; //Tx Rx antenna control : // 0x858~0x85f [16 bytes] - - u32 rfAGCControl1; //AGC parameter control1 : - // 0xc50~0xc53,0xc58~0xc5b, 0xc60~0xc63, 0xc68~0xc6b [16 bytes] - - u32 rfAGCControl2; //AGC parameter control2 : - // 0xc54~0xc57,0xc5c~0xc5f, 0xc64~0xc67, 0xc6c~0xc6f [16 bytes] - - u32 rfRxIQImbalance; //OFDM Rx IQ imbalance matrix : + + u32 rfAGCControl1; //AGC parameter control1 : + // 0xc50~0xc53,0xc58~0xc5b, 0xc60~0xc63, 0xc68~0xc6b [16 bytes] + + u32 rfAGCControl2; //AGC parameter control2 : + // 0xc54~0xc57,0xc5c~0xc5f, 0xc64~0xc67, 0xc6c~0xc6f [16 bytes] + + u32 rfRxIQImbalance; //OFDM Rx IQ imbalance matrix : // 0xc14~0xc17,0xc1c~0xc1f, 0xc24~0xc27, 0xc2c~0xc2f [16 bytes] - - u32 rfRxAFE; //Rx IQ DC ofset and Rx digital filter, Rx DC notch filter : + + u32 rfRxAFE; //Rx IQ DC ofset and Rx digital filter, Rx DC notch filter : // 0xc10~0xc13,0xc18~0xc1b, 0xc20~0xc23, 0xc28~0xc2b [16 bytes] - + u32 rfTxIQImbalance; //OFDM Tx IQ imbalance matrix // 0xc80~0xc83,0xc88~0xc8b, 0xc90~0xc93, 0xc98~0xc9b [16 bytes] - - u32 rfTxAFE; //Tx IQ DC Offset and Tx DFIR type + + u32 rfTxAFE; //Tx IQ DC Offset and Tx DFIR type // 0xc84~0xc87,0xc8c~0xc8f, 0xc94~0xc97, 0xc9c~0xc9f [16 bytes] - - u32 rfLSSIReadBack; //LSSI RF readback data SI mode + + u32 rfLSSIReadBack; //LSSI RF readback data SI mode // 0x8a0~0x8af [16 bytes] - u32 rfLSSIReadBackPi; //LSSI RF readback data PI mode 0x8b8-8bc for Path A and B + u32 rfLSSIReadBackPi; //LSSI RF readback data PI mode 0x8b8-8bc for Path A and B }BB_REGISTER_DEFINITION_T, *PBB_REGISTER_DEFINITION_T; -typedef struct _R_ANTENNA_SELECT_OFDM{ - u32 r_tx_antenna:4; +typedef struct _R_ANTENNA_SELECT_OFDM{ + u32 r_tx_antenna:4; u32 r_ant_l:4; - u32 r_ant_non_ht:4; + u32 r_ant_non_ht:4; u32 r_ant_ht1:4; u32 r_ant_ht2:4; u32 r_ant_ht_s1:4; @@ -281,12 +281,12 @@ typedef struct _R_ANTENNA_SELECT_OFDM{ }R_ANTENNA_SELECT_OFDM; typedef struct _R_ANTENNA_SELECT_CCK{ - u8 r_cckrx_enable_2:2; + u8 r_cckrx_enable_2:2; u8 r_cckrx_enable:2; u8 r_ccktx_enable:4; }R_ANTENNA_SELECT_CCK; -/*------------------------------Define structure----------------------------*/ +/*------------------------------Define structure----------------------------*/ /*------------------------Export global variable----------------------------*/ @@ -329,7 +329,7 @@ extern int PHY_BBConfig8192D( IN struct adapter *Adapter ); extern int PHY_RFConfig8192D( IN struct adapter *Adapter ); /* RF config */ int rtl8192d_PHY_ConfigRFWithParaFile( IN struct adapter *Adapter, - IN u8* pFileName, + IN u8* pFileName, IN RF_RADIO_PATH_E eRFPath); int rtl8192d_PHY_ConfigRFWithHeaderFile( IN struct adapter * Adapter, IN RF_CONTENT Content, @@ -344,21 +344,21 @@ void rtl8192d_PHY_GetHWRegOriginalValue( IN struct adapter * Adapter ); // // RF Power setting // -//extern BOOLEAN PHY_SetRFPowerState(IN struct adapter * Adapter, +//extern BOOLEAN PHY_SetRFPowerState(IN struct adapter * Adapter, // IN RT_RF_POWER_STATE eRFPowerState); // // BB TX Power R/W // void PHY_GetTxPowerLevel8192D( IN struct adapter * Adapter, - OUT u32* powerlevel ); + OUT u32* powerlevel ); void PHY_SetTxPowerLevel8192D( IN struct adapter * Adapter, IN u8 channel ); BOOLEAN PHY_UpdateTxPowerDbm8192D( IN struct adapter *Adapter, IN int powerInDbm ); // -VOID +VOID PHY_ScanOperationBackup8192D(IN struct adapter *Adapter, IN u8 Operation ); @@ -396,7 +396,7 @@ void PHY_SwChnlPhy8192D( IN struct adapter * pAdapter, extern void ChkFwCmdIoDone( IN struct adapter *Adapter); - + // // BB/MAC/RF other monitor API // @@ -410,7 +410,7 @@ BOOLEAN PHY_CheckIsLegalRfPath8192D(IN struct adapter *pAdapter, // // Modify the value of the hw register when beacon interval be changed. // -void +void rtl8192d_PHY_SetBeaconHwReg( IN struct adapter * Adapter, IN u16 BeaconInterval ); @@ -428,7 +428,7 @@ PHY_EnableHostClkReq( BOOLEAN SetAntennaConfig92C( IN struct adapter *Adapter, - IN u8 DefaultAnt + IN u8 DefaultAnt ); VOID @@ -439,7 +439,7 @@ PHY_UpdateBBRFConfiguration8192D( VOID PHY_ReadMacPhyMode92D( IN struct adapter *Adapter, - IN BOOLEAN AutoloadFail + IN BOOLEAN AutoloadFail ); VOID PHY_ConfigMacPhyMode92D( @@ -460,7 +460,7 @@ rtl8192d_PHY_InitRxSetting( ); -VOID +VOID rtl8192d_PHY_SetRFPathSwitch(IN struct adapter *pAdapter, IN BOOLEAN bMain); VOID @@ -469,7 +469,7 @@ HalChangeCCKStatus8192D( IN BOOLEAN bCCKDisable ); -VOID +VOID PHY_InitPABias92D(IN struct adapter *Adapter); /*--------------------------Exported Function prototype---------------------*/ @@ -484,4 +484,3 @@ PHY_InitPABias92D(IN struct adapter *Adapter); #define PHY_QueryMacReg PHY_QueryBBReg #endif // __INC_HAL8192SPHYCFG_H - diff --git a/include/Hal8192DPhyReg.h b/include/Hal8192DPhyReg.h index de23a41..8c3b111 100755 --- a/include/Hal8192DPhyReg.h +++ b/include/Hal8192DPhyReg.h @@ -1,7 +1,7 @@ /****************************************************************************** * * 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. @@ -16,1157 +16,1156 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA * * - ******************************************************************************/ -/***************************************************************************** - * - * Module: __INC_HAL8192DPHYREG_H - * - * - * Note: 1. Define PMAC/BB register map - * 2. Define RF register map - * 3. PMAC/BB register bit mask. - * 4. RF reg bit mask. - * 5. Other BB/RF relative definition. - * - * - * Export: Constants, macro, functions(API), global variables(None). - * - * Abbrev: - * - * History: - * Data Who Remark - * 08/07/2007 MHC 1. Porting from 9x series PHYCFG.h. - * 2. Reorganize code architecture. - * 09/25/2008 MH 1. Add RL6052 register definition - * - *****************************************************************************/ -#ifndef __INC_HAL8192DPHYREG_H -#define __INC_HAL8192DPHYREG_H - - -/*--------------------------Define Parameters-------------------------------*/ - -//============================================================ -// 8192S Regsiter offset definition -//============================================================ - -// -// BB-PHY register PMAC 0x100 PHY 0x800 - 0xEFF -// 1. PMAC duplicate register due to connection: RF_Mode, TRxRN, NumOf L-STF -// 2. 0x800/0x900/0xA00/0xC00/0xD00/0xE00 -// 3. RF register 0x00-2E -// 4. Bit Mask for BB/RF register -// 5. Other defintion for BB/RF R/W -// - - -// -// 1. PMAC duplicate register due to connection: RF_Mode, TRxRN, NumOf L-STF -// 1. Page1(0x100) -// -#define rPMAC_Reset 0x100 -#define rPMAC_TxStart 0x104 -#define rPMAC_TxLegacySIG 0x108 -#define rPMAC_TxHTSIG1 0x10c -#define rPMAC_TxHTSIG2 0x110 -#define rPMAC_PHYDebug 0x114 -#define rPMAC_TxPacketNum 0x118 -#define rPMAC_TxIdle 0x11c -#define rPMAC_TxMACHeader0 0x120 -#define rPMAC_TxMACHeader1 0x124 -#define rPMAC_TxMACHeader2 0x128 -#define rPMAC_TxMACHeader3 0x12c -#define rPMAC_TxMACHeader4 0x130 -#define rPMAC_TxMACHeader5 0x134 -#define rPMAC_TxDataType 0x138 -#define rPMAC_TxRandomSeed 0x13c -#define rPMAC_CCKPLCPPreamble 0x140 -#define rPMAC_CCKPLCPHeader 0x144 -#define rPMAC_CCKCRC16 0x148 -#define rPMAC_OFDMRxCRC32OK 0x170 -#define rPMAC_OFDMRxCRC32Er 0x174 -#define rPMAC_OFDMRxParityEr 0x178 -#define rPMAC_OFDMRxCRC8Er 0x17c -#define rPMAC_CCKCRxRC16Er 0x180 -#define rPMAC_CCKCRxRC32Er 0x184 -#define rPMAC_CCKCRxRC32OK 0x188 -#define rPMAC_TxStatus 0x18c - -// -// 2. Page2(0x200) -// -// The following two definition are only used for USB interface. -#define RF_BB_CMD_ADDR 0x02c0 // RF/BB read/write command address. -#define RF_BB_CMD_DATA 0x02c4 // RF/BB read/write command data. - -// -// 3. Page8(0x800) -// -#define rFPGA0_RFMOD 0x800 //RF mode & CCK TxSC // RF BW Setting?? - -#define rFPGA0_TxInfo 0x804 // Status report?? -#define rFPGA0_PSDFunction 0x808 - -#define rFPGA0_TxGainStage 0x80c // Set TX PWR init gain? - -#define rFPGA0_RFTiming1 0x810 // Useless now -#define rFPGA0_RFTiming2 0x814 - -#define rFPGA0_XA_HSSIParameter1 0x820 // RF 3 wire register -#define rFPGA0_XA_HSSIParameter2 0x824 -#define rFPGA0_XB_HSSIParameter1 0x828 -#define rFPGA0_XB_HSSIParameter2 0x82c - -#define rFPGA0_XA_LSSIParameter 0x840 -#define rFPGA0_XB_LSSIParameter 0x844 - -#define rFPGA0_RFWakeUpParameter 0x850 // Useless now -#define rFPGA0_RFSleepUpParameter 0x854 - -#define rFPGA0_XAB_SwitchControl 0x858 // RF Channel switch -#define rFPGA0_XCD_SwitchControl 0x85c - -#define rFPGA0_XA_RFInterfaceOE 0x860 // RF Channel switch -#define rFPGA0_XB_RFInterfaceOE 0x864 - -#define rFPGA0_XAB_RFInterfaceSW 0x870 // RF Interface Software Control -#define rFPGA0_XCD_RFInterfaceSW 0x874 - -#define rFPGA0_XAB_RFParameter 0x878 // RF Parameter -#define rFPGA0_XCD_RFParameter 0x87c - -#define rFPGA0_AnalogParameter1 0x880 // Crystal cap setting RF-R/W protection for parameter4?? -#define rFPGA0_AnalogParameter2 0x884 -#define rFPGA0_AnalogParameter3 0x888 -#define rFPGA0_AdDaClockEn 0x888 // enable ad/da clock1 for dual-phy -#define rFPGA0_AnalogParameter4 0x88c - -#define rFPGA0_XA_LSSIReadBack 0x8a0 // Tranceiver LSSI Readback -#define rFPGA0_XB_LSSIReadBack 0x8a4 -#define rFPGA0_XC_LSSIReadBack 0x8a8 -#define rFPGA0_XD_LSSIReadBack 0x8ac - -#define rFPGA0_PSDReport 0x8b4 // Useless now -#define TransceiverA_HSPI_Readback 0x8b8 // Transceiver A HSPI Readback -#define TransceiverB_HSPI_Readback 0x8bc // Transceiver B HSPI Readback -#define rFPGA0_XAB_RFInterfaceRB 0x8e0 // Useless now // RF Interface Readback Value -#define rFPGA0_XCD_RFInterfaceRB 0x8e4 // Useless now - -// -// 4. Page9(0x900) -// -#define rFPGA1_RFMOD 0x900 //RF mode & OFDM TxSC // RF BW Setting?? - -#define rFPGA1_TxBlock 0x904 // Useless now -#define rFPGA1_DebugSelect 0x908 // Useless now -#define rFPGA1_TxInfo 0x90c // Useless now // Status report?? - -// -// 5. PageA(0xA00) -// -// Set Control channel to upper or lower. These settings are required only for 40MHz -#define rCCK0_System 0xa00 - -#define rCCK0_AFESetting 0xa04 // Disable init gain now // Select RX path by RSSI -#define rCCK0_CCA 0xa08 // Disable init gain now // Init gain - -#define rCCK0_RxAGC1 0xa0c //AGC default value, saturation level // Antenna Diversity, RX AGC, LNA Threshold, RX LNA Threshold useless now. Not the same as 90 series -#define rCCK0_RxAGC2 0xa10 //AGC & DAGC - -#define rCCK0_RxHP 0xa14 - -#define rCCK0_DSPParameter1 0xa18 //Timing recovery & Channel estimation threshold -#define rCCK0_DSPParameter2 0xa1c //SQ threshold - -#define rCCK0_TxFilter1 0xa20 -#define rCCK0_TxFilter2 0xa24 -#define rCCK0_DebugPort 0xa28 //debug port and Tx filter3 -#define rCCK0_FalseAlarmReport 0xa2c //0xa2d useless now 0xa30-a4f channel report -#define rCCK0_TRSSIReport 0xa50 -#define rCCK0_RxReport 0xa54 //0xa57 -#define rCCK0_FACounterLower 0xa5c //0xa5b -#define rCCK0_FACounterUpper 0xa58 //0xa5c - -// -// PageB(0xB00) -// -#define rPdp_AntA 0xb00 -#define rPdp_AntA_4 0xb04 -#define rPdp_AntA_8 0xb08 -#define rPdp_AntA_C 0xb0c -#define rPdp_AntA_10 0xb10 -#define rPdp_AntA_14 0xb14 -#define rPdp_AntA_18 0xb18 -#define rPdp_AntA_1C 0xb1c -#define rPdp_AntA_20 0xb20 -#define rPdp_AntA_24 0xb24 - -#define rConfig_Pmpd_AntA 0xb28 -#define rConfig_ram64x16 0xb2c - -#define rBndA 0xb30 -#define rHssiPar 0xb34 - -#define rConfig_AntA 0xb68 -#define rConfig_AntB 0xb6c - -#define rPdp_AntB 0xb70 -#define rPdp_AntB_4 0xb74 -#define rPdp_AntB_8 0xb78 -#define rPdp_AntB_C 0xb7c -#define rPdp_AntB_10 0xb80 -#define rPdp_AntB_14 0xb84 -#define rPdp_AntB_18 0xb88 -#define rPdp_AntB_1C 0xb8c -#define rPdp_AntB_20 0xb90 -#define rPdp_AntB_24 0xb94 - -#define rConfig_Pmpd_AntB 0xb98 - -#define rBndB 0xba0 - -#define rAPK 0xbd8 -#define rPm_Rx0_AntA 0xbdc -#define rPm_Rx1_AntA 0xbe0 -#define rPm_Rx2_AntA 0xbe4 -#define rPm_Rx3_AntA 0xbe8 -#define rPm_Rx0_AntB 0xbec -#define rPm_Rx1_AntB 0xbf0 -#define rPm_Rx2_AntB 0xbf4 -#define rPm_Rx3_AntB 0xbf8 - -// -// 6. PageC(0xC00) -// -#define rOFDM0_LSTF 0xc00 - -#define rOFDM0_TRxPathEnable 0xc04 -#define rOFDM0_TRMuxPar 0xc08 -#define rOFDM0_TRSWIsolation 0xc0c - -#define rOFDM0_XARxAFE 0xc10 //RxIQ DC offset, Rx digital filter, DC notch filter -#define rOFDM0_XARxIQImbalance 0xc14 //RxIQ imblance matrix -#define rOFDM0_XBRxAFE 0xc18 -#define rOFDM0_XBRxIQImbalance 0xc1c -#define rOFDM0_XCRxAFE 0xc20 -#define rOFDM0_XCRxIQImbalance 0xc24 -#define rOFDM0_XDRxAFE 0xc28 -#define rOFDM0_XDRxIQImbalance 0xc2c - -#define rOFDM0_RxDetector1 0xc30 //PD,BW & SBD // DM tune init gain -#define rOFDM0_RxDetector2 0xc34 //SBD & Fame Sync. -#define rOFDM0_RxDetector3 0xc38 //Frame Sync. -#define rOFDM0_RxDetector4 0xc3c //PD, SBD, Frame Sync & Short-GI - -#define rOFDM0_RxDSP 0xc40 //Rx Sync Path -#define rOFDM0_CFOandDAGC 0xc44 //CFO & DAGC -#define rOFDM0_CCADropThreshold 0xc48 //CCA Drop threshold -#define rOFDM0_ECCAThreshold 0xc4c // energy CCA - -#define rOFDM0_XAAGCCore1 0xc50 // DIG -#define rOFDM0_XAAGCCore2 0xc54 -#define rOFDM0_XBAGCCore1 0xc58 -#define rOFDM0_XBAGCCore2 0xc5c -#define rOFDM0_XCAGCCore1 0xc60 -#define rOFDM0_XCAGCCore2 0xc64 -#define rOFDM0_XDAGCCore1 0xc68 -#define rOFDM0_XDAGCCore2 0xc6c - -#define rOFDM0_AGCParameter1 0xc70 -#define rOFDM0_AGCParameter2 0xc74 -#define rOFDM0_AGCRSSITable 0xc78 -#define rOFDM0_HTSTFAGC 0xc7c - -#define rOFDM0_XATxIQImbalance 0xc80 // TX PWR TRACK and DIG -#define rOFDM0_XATxAFE 0xc84 -#define rOFDM0_XBTxIQImbalance 0xc88 -#define rOFDM0_XBTxAFE 0xc8c -#define rOFDM0_XCTxIQImbalance 0xc90 -#define rOFDM0_XCTxAFE 0xc94 -#define rOFDM0_XDTxIQImbalance 0xc98 -#define rOFDM0_XDTxAFE 0xc9c - -#define rOFDM0_RxIQExtAnta 0xca0 -#define rOFDM0_TxCoeff1 0xca4 -#define rOFDM0_TxCoeff2 0xca8 -#define rOFDM0_TxCoeff3 0xcac -#define rOFDM0_TxCoeff4 0xcb0 -#define rOFDM0_TxCoeff5 0xcb4 -#define rOFDM0_TxCoeff6 0xcb8 -#define rOFDM0_RxHPParameter 0xce0 -#define rOFDM0_TxPseudoNoiseWgt 0xce4 -#define rOFDM0_FrameSync 0xcf0 -#define rOFDM0_DFSReport 0xcf4 - -// -// 7. PageD(0xD00) -// -#define rOFDM1_LSTF 0xd00 -#define rOFDM1_TRxPathEnable 0xd04 - -#define rOFDM1_CFO 0xd08 // No setting now -#define rOFDM1_CSI1 0xd10 -#define rOFDM1_SBD 0xd14 -#define rOFDM1_CSI2 0xd18 -#define rOFDM1_CFOTracking 0xd2c -#define rOFDM1_TRxMesaure1 0xd34 -#define rOFDM1_IntfDet 0xd3c -#define rOFDM1_PseudoNoiseStateAB 0xd50 -#define rOFDM1_PseudoNoiseStateCD 0xd54 -#define rOFDM1_RxPseudoNoiseWgt 0xd58 - -#define rOFDM_PHYCounter1 0xda0 //cca, parity fail -#define rOFDM_PHYCounter2 0xda4 //rate illegal, crc8 fail -#define rOFDM_PHYCounter3 0xda8 //MCS not support - -#define rOFDM_ShortCFOAB 0xdac // No setting now -#define rOFDM_ShortCFOCD 0xdb0 -#define rOFDM_LongCFOAB 0xdb4 -#define rOFDM_LongCFOCD 0xdb8 -#define rOFDM_TailCFOAB 0xdbc -#define rOFDM_TailCFOCD 0xdc0 -#define rOFDM_PWMeasure1 0xdc4 -#define rOFDM_PWMeasure2 0xdc8 -#define rOFDM_BWReport 0xdcc -#define rOFDM_AGCReport 0xdd0 -#define rOFDM_RxSNR 0xdd4 -#define rOFDM_RxEVMCSI 0xdd8 -#define rOFDM_SIGReport 0xddc - - -// -// 8. PageE(0xE00) -// -#define rTxAGC_A_Rate18_06 0xe00 -#define rTxAGC_A_Rate54_24 0xe04 -#define rTxAGC_A_CCK1_Mcs32 0xe08 -#define rTxAGC_A_Mcs03_Mcs00 0xe10 -#define rTxAGC_A_Mcs07_Mcs04 0xe14 -#define rTxAGC_A_Mcs11_Mcs08 0xe18 -#define rTxAGC_A_Mcs15_Mcs12 0xe1c - -#define rTxAGC_B_Rate18_06 0x830 -#define rTxAGC_B_Rate54_24 0x834 -#define rTxAGC_B_CCK1_55_Mcs32 0x838 -#define rTxAGC_B_Mcs03_Mcs00 0x83c -#define rTxAGC_B_Mcs07_Mcs04 0x848 -#define rTxAGC_B_Mcs11_Mcs08 0x84c -#define rTxAGC_B_Mcs15_Mcs12 0x868 -#define rTxAGC_B_CCK11_A_CCK2_11 0x86c - -#define rFPGA0_IQK 0xe28 -#define rTx_IQK_Tone_A 0xe30 -#define rRx_IQK_Tone_A 0xe34 -#define rTx_IQK_PI_A 0xe38 -#define rRx_IQK_PI_A 0xe3c - -#define rTx_IQK 0xe40 -#define rRx_IQK 0xe44 -#define rIQK_AGC_Pts 0xe48 -#define rIQK_AGC_Rsp 0xe4c -#define rTx_IQK_Tone_B 0xe50 -#define rRx_IQK_Tone_B 0xe54 -#define rTx_IQK_PI_B 0xe58 -#define rRx_IQK_PI_B 0xe5c -#define rIQK_AGC_Cont 0xe60 - -#define rBlue_Tooth 0xe6c -#define rRx_Wait_CCA 0xe70 -#define rTx_CCK_RFON 0xe74 -#define rTx_CCK_BBON 0xe78 -#define rTx_OFDM_RFON 0xe7c -#define rTx_OFDM_BBON 0xe80 -#define rTx_To_Rx 0xe84 -#define rTx_To_Tx 0xe88 -#define rRx_CCK 0xe8c - -#define rTx_Power_Before_IQK_A 0xe94 -#define rTx_Power_After_IQK_A 0xe9c - -#define rRx_Power_Before_IQK_A 0xea0 -#define rRx_Power_Before_IQK_A_2 0xea4 -#define rRx_Power_After_IQK_A 0xea8 -#define rRx_Power_After_IQK_A_2 0xeac - -#define rTx_Power_Before_IQK_B 0xeb4 -#define rTx_Power_After_IQK_B 0xebc - -#define rRx_Power_Before_IQK_B 0xec0 -#define rRx_Power_Before_IQK_B_2 0xec4 -#define rRx_Power_After_IQK_B 0xec8 -#define rRx_Power_After_IQK_B_2 0xecc - -#define rRx_OFDM 0xed0 -#define rRx_Wait_RIFS 0xed4 -#define rRx_TO_Rx 0xed8 -#define rStandby 0xedc -#define rSleep 0xee0 -#define rPMPD_ANAEN 0xeec - -// -// 7. RF Register 0x00-0x2E (RF 8256) -// RF-0222D 0x00-3F -// -//Zebra1 -#define rZebra1_HSSIEnable 0x0 // Useless now -#define rZebra1_TRxEnable1 0x1 -#define rZebra1_TRxEnable2 0x2 -#define rZebra1_AGC 0x4 -#define rZebra1_ChargePump 0x5 -#define rZebra1_Channel 0x7 // RF channel switch - -//#endif -#define rZebra1_TxGain 0x8 // Useless now -#define rZebra1_TxLPF 0x9 -#define rZebra1_RxLPF 0xb -#define rZebra1_RxHPFCorner 0xc - -//Zebra4 -#define rGlobalCtrl 0 // Useless now -#define rRTL8256_TxLPF 19 -#define rRTL8256_RxLPF 11 - -//RTL8258 -#define rRTL8258_TxLPF 0x11 // Useless now -#define rRTL8258_RxLPF 0x13 -#define rRTL8258_RSSILPF 0xa - -// -// RL6052 Register definition -// -#define RF_AC 0x00 // - -#define RF_IQADJ_G1 0x01 // -#define RF_IQADJ_G2 0x02 // -#define RF_BS_PA_APSET_G1_G4 0x03 -#define RF_BS_PA_APSET_G5_G8 0x04 -#define RF_POW_TRSW 0x05 // - -#define RF_GAIN_RX 0x06 // -#define RF_GAIN_TX 0x07 // - -#define RF_TXM_IDAC 0x08 // -#define RF_IPA_G 0x09 // -#define RF_TXBIAS_G 0x0A -#define RF_TXPA_AG 0x0B -#define RF_IPA_A 0x0C // -#define RF_TXBIAS_A 0x0D -#define RF_BS_PA_APSET_G9_G11 0x0E -#define RF_BS_IQGEN 0x0F // - -#define RF_MODE1 0x10 // -#define RF_MODE2 0x11 // - -#define RF_RX_AGC_HP 0x12 // -#define RF_TX_AGC 0x13 // -#define RF_BIAS 0x14 // -#define RF_IPA 0x15 // -#define RF_TXBIAS 0x16 // -#define RF_POW_ABILITY 0x17 // -#define RF_MODE_AG 0x18 // -#define rRfChannel 0x18 // RF channel and BW switch -#define RF_CHNLBW 0x18 // RF channel and BW switch -#define RF_TOP 0x19 // - -#define RF_RX_G1 0x1A // -#define RF_RX_G2 0x1B // - -#define RF_RX_BB2 0x1C // -#define RF_RX_BB1 0x1D // - -#define RF_RCK1 0x1E // -#define RF_RCK2 0x1F // - -#define RF_TX_G1 0x20 // -#define RF_TX_G2 0x21 // -#define RF_TX_G3 0x22 // - -#define RF_TX_BB1 0x23 // - -#define RF_T_METER 0x42 // - -#define RF_SYN_G1 0x25 // RF TX Power control -#define RF_SYN_G2 0x26 // RF TX Power control -#define RF_SYN_G3 0x27 // RF TX Power control -#define RF_SYN_G4 0x28 // RF TX Power control -#define RF_SYN_G5 0x29 // RF TX Power control -#define RF_SYN_G6 0x2A // RF TX Power control -#define RF_SYN_G7 0x2B // RF TX Power control -#define RF_SYN_G8 0x2C // RF TX Power control - -#define RF_RCK_OS 0x30 // RF TX PA control - -#define RF_TXPA_G1 0x31 // RF TX PA control -#define RF_TXPA_G2 0x32 // RF TX PA control -#define RF_TXPA_G3 0x33 // RF TX PA control -#define RF_LOBF_9 0x38 -#define RF_RXRF_A3 0x3C // -#define RF_TRSW 0x3F - -#define RF_TXRF_A2 0x41 -#define RF_TXPA_G4 0x46 -#define RF_TXPA_A4 0x4B - -// -//Bit Mask -// -// 1. Page1(0x100) -#define bBBResetB 0x100 // Useless now? -#define bGlobalResetB 0x200 -#define bOFDMTxStart 0x4 -#define bCCKTxStart 0x8 -#define bCRC32Debug 0x100 -#define bPMACLoopback 0x10 -#define bTxLSIG 0xffffff -#define bOFDMTxRate 0xf -#define bOFDMTxReserved 0x10 -#define bOFDMTxLength 0x1ffe0 -#define bOFDMTxParity 0x20000 -#define bTxHTSIG1 0xffffff -#define bTxHTMCSRate 0x7f -#define bTxHTBW 0x80 -#define bTxHTLength 0xffff00 -#define bTxHTSIG2 0xffffff -#define bTxHTSmoothing 0x1 -#define bTxHTSounding 0x2 -#define bTxHTReserved 0x4 -#define bTxHTAggreation 0x8 -#define bTxHTSTBC 0x30 -#define bTxHTAdvanceCoding 0x40 -#define bTxHTShortGI 0x80 -#define bTxHTNumberHT_LTF 0x300 -#define bTxHTCRC8 0x3fc00 -#define bCounterReset 0x10000 -#define bNumOfOFDMTx 0xffff -#define bNumOfCCKTx 0xffff0000 -#define bTxIdleInterval 0xffff -#define bOFDMService 0xffff0000 -#define bTxMACHeader 0xffffffff -#define bTxDataInit 0xff -#define bTxHTMode 0x100 -#define bTxDataType 0x30000 -#define bTxRandomSeed 0xffffffff -#define bCCKTxPreamble 0x1 -#define bCCKTxSFD 0xffff0000 -#define bCCKTxSIG 0xff -#define bCCKTxService 0xff00 -#define bCCKLengthExt 0x8000 -#define bCCKTxLength 0xffff0000 -#define bCCKTxCRC16 0xffff -#define bCCKTxStatus 0x1 -#define bOFDMTxStatus 0x2 - -#define IS_BB_REG_OFFSET_92S(_Offset) ((_Offset >= 0x800) && (_Offset <= 0xfff)) - -// 2. Page8(0x800) -#define bRFMOD 0x1 // Reg 0x800 rFPGA0_RFMOD -#define bJapanMode 0x2 -#define bCCKTxSC 0x30 -#define bCCKEn 0x1000000 -#define bOFDMEn 0x2000000 - -#define bOFDMRxADCPhase 0x10000 // Useless now -#define bOFDMTxDACPhase 0x40000 -#define bXATxAGC 0x3f - -#define bAntennaSelect 0x0300 - -#define bXBTxAGC 0xf00 // Reg 80c rFPGA0_TxGainStage -#define bXCTxAGC 0xf000 -#define bXDTxAGC 0xf0000 - -#define bPAStart 0xf0000000 // Useless now -#define bTRStart 0x00f00000 -#define bRFStart 0x0000f000 -#define bBBStart 0x000000f0 -#define bBBCCKStart 0x0000000f -#define bPAEnd 0xf //Reg0x814 -#define bTREnd 0x0f000000 -#define bRFEnd 0x000f0000 -#define bCCAMask 0x000000f0 //T2R -#define bR2RCCAMask 0x00000f00 -#define bHSSI_R2TDelay 0xf8000000 -#define bHSSI_T2RDelay 0xf80000 -#define bContTxHSSI 0x400 //chane gain at continue Tx -#define bIGFromCCK 0x200 -#define bAGCAddress 0x3f -#define bRxHPTx 0x7000 -#define bRxHPT2R 0x38000 -#define bRxHPCCKIni 0xc0000 -#define bAGCTxCode 0xc00000 -#define bAGCRxCode 0x300000 - -#define b3WireDataLength 0x800 // Reg 0x820~84f rFPGA0_XA_HSSIParameter1 -#define b3WireAddressLength 0x400 - -#define b3WireRFPowerDown 0x1 // Useless now -//#define bHWSISelect 0x8 -#define b5GPAPEPolarity 0x40000000 -#define b2GPAPEPolarity 0x80000000 -#define bRFSW_TxDefaultAnt 0x3 -#define bRFSW_TxOptionAnt 0x30 -#define bRFSW_RxDefaultAnt 0x300 -#define bRFSW_RxOptionAnt 0x3000 -#define bRFSI_3WireData 0x1 -#define bRFSI_3WireClock 0x2 -#define bRFSI_3WireLoad 0x4 -#define bRFSI_3WireRW 0x8 -#define bRFSI_3Wire 0xf - -#define bRFSI_RFENV 0x10 // Reg 0x870 rFPGA0_XAB_RFInterfaceSW - -#define bRFSI_TRSW 0x20 // Useless now -#define bRFSI_TRSWB 0x40 -#define bRFSI_ANTSW 0x100 -#define bRFSI_ANTSWB 0x200 -#define bRFSI_PAPE 0x400 -#define bRFSI_PAPE5G 0x800 -#define bBandSelect 0x1 -#define bHTSIG2_GI 0x80 -#define bHTSIG2_Smoothing 0x01 -#define bHTSIG2_Sounding 0x02 -#define bHTSIG2_Aggreaton 0x08 -#define bHTSIG2_STBC 0x30 -#define bHTSIG2_AdvCoding 0x40 -#define bHTSIG2_NumOfHTLTF 0x300 -#define bHTSIG2_CRC8 0x3fc -#define bHTSIG1_MCS 0x7f -#define bHTSIG1_BandWidth 0x80 -#define bHTSIG1_HTLength 0xffff -#define bLSIG_Rate 0xf -#define bLSIG_Reserved 0x10 -#define bLSIG_Length 0x1fffe -#define bLSIG_Parity 0x20 -#define bCCKRxPhase 0x4 - -#define bLSSIReadAddress 0x7f800000 // T65 RF - -#define bLSSIReadEdge 0x80000000 //LSSI "Read" edge signal - -#define bLSSIReadBackData 0xfffff // T65 RF - -#define bLSSIReadOKFlag 0x1000 // Useless now -#define bCCKSampleRate 0x8 //0: 44MHz, 1:88MHz -#define bRegulator0Standby 0x1 -#define bRegulatorPLLStandby 0x2 -#define bRegulator1Standby 0x4 -#define bPLLPowerUp 0x8 -#define bDPLLPowerUp 0x10 -#define bDA10PowerUp 0x20 -#define bAD7PowerUp 0x200 -#define bDA6PowerUp 0x2000 -#define bXtalPowerUp 0x4000 -#define b40MDClkPowerUP 0x8000 -#define bDA6DebugMode 0x20000 -#define bDA6Swing 0x380000 - -#define bADClkPhase 0x4000000 // Reg 0x880 rFPGA0_AnalogParameter1 20/40 CCK support switch 40/80 BB MHZ - -#define b80MClkDelay 0x18000000 // Useless -#define bAFEWatchDogEnable 0x20000000 - -#define bXtalCap01 0xc0000000 // Reg 0x884 rFPGA0_AnalogParameter2 Crystal cap -#define bXtalCap23 0x3 -#define bXtalCap92x 0x0f000000 -#define bXtalCap 0x0f000000 - -#define bIntDifClkEnable 0x400 // Useless -#define bExtSigClkEnable 0x800 -#define bBandgapMbiasPowerUp 0x10000 -#define bAD11SHGain 0xc0000 -#define bAD11InputRange 0x700000 -#define bAD11OPCurrent 0x3800000 -#define bIPathLoopback 0x4000000 -#define bQPathLoopback 0x8000000 -#define bAFELoopback 0x10000000 -#define bDA10Swing 0x7e0 -#define bDA10Reverse 0x800 -#define bDAClkSource 0x1000 -#define bAD7InputRange 0x6000 -#define bAD7Gain 0x38000 -#define bAD7OutputCMMode 0x40000 -#define bAD7InputCMMode 0x380000 -#define bAD7Current 0xc00000 -#define bRegulatorAdjust 0x7000000 -#define bAD11PowerUpAtTx 0x1 -#define bDA10PSAtTx 0x10 -#define bAD11PowerUpAtRx 0x100 -#define bDA10PSAtRx 0x1000 -#define bCCKRxAGCFormat 0x200 -#define bPSDFFTSamplepPoint 0xc000 -#define bPSDAverageNum 0x3000 -#define bIQPathControl 0xc00 -#define bPSDFreq 0x3ff -#define bPSDAntennaPath 0x30 -#define bPSDIQSwitch 0x40 -#define bPSDRxTrigger 0x400000 -#define bPSDTxTrigger 0x80000000 -#define bPSDSineToneScale 0x7f000000 -#define bPSDReport 0xffff - -// 3. Page9(0x900) -#define bOFDMTxSC 0x30000000 // Useless -#define bCCKTxOn 0x1 -#define bOFDMTxOn 0x2 -#define bDebugPage 0xfff //reset debug page and also HWord, LWord -#define bDebugItem 0xff //reset debug page and LWord -#define bAntL 0x10 -#define bAntNonHT 0x100 -#define bAntHT1 0x1000 -#define bAntHT2 0x10000 -#define bAntHT1S1 0x100000 -#define bAntNonHTS1 0x1000000 - -// 4. PageA(0xA00) -#define bCCKBBMode 0x3 // Useless -#define bCCKTxPowerSaving 0x80 -#define bCCKRxPowerSaving 0x40 - -#define bCCKSideBand 0x10 // Reg 0xa00 rCCK0_System 20/40 switch - -#define bCCKScramble 0x8 // Useless -#define bCCKAntDiversity 0x8000 -#define bCCKCarrierRecovery 0x4000 -#define bCCKTxRate 0x3000 -#define bCCKDCCancel 0x0800 -#define bCCKISICancel 0x0400 -#define bCCKMatchFilter 0x0200 -#define bCCKEqualizer 0x0100 -#define bCCKPreambleDetect 0x800000 -#define bCCKFastFalseCCA 0x400000 -#define bCCKChEstStart 0x300000 -#define bCCKCCACount 0x080000 -#define bCCKcs_lim 0x070000 -#define bCCKBistMode 0x80000000 -#define bCCKCCAMask 0x40000000 -#define bCCKTxDACPhase 0x4 -#define bCCKRxADCPhase 0x20000000 //r_rx_clk -#define bCCKr_cp_mode0 0x0100 -#define bCCKTxDCOffset 0xf0 -#define bCCKRxDCOffset 0xf -#define bCCKCCAMode 0xc000 -#define bCCKFalseCS_lim 0x3f00 -#define bCCKCS_ratio 0xc00000 -#define bCCKCorgBit_sel 0x300000 -#define bCCKPD_lim 0x0f0000 -#define bCCKNewCCA 0x80000000 -#define bCCKRxHPofIG 0x8000 -#define bCCKRxIG 0x7f00 -#define bCCKLNAPolarity 0x800000 -#define bCCKRx1stGain 0x7f0000 -#define bCCKRFExtend 0x20000000 //CCK Rx Iinital gain polarity -#define bCCKRxAGCSatLevel 0x1f000000 -#define bCCKRxAGCSatCount 0xe0 -#define bCCKRxRFSettle 0x1f //AGCsamp_dly -#define bCCKFixedRxAGC 0x8000 -//#define bCCKRxAGCFormat 0x4000 //remove to HSSI register 0x824 -#define bCCKAntennaPolarity 0x2000 -#define bCCKTxFilterType 0x0c00 -#define bCCKRxAGCReportType 0x0300 -#define bCCKRxDAGCEn 0x80000000 -#define bCCKRxDAGCPeriod 0x20000000 -#define bCCKRxDAGCSatLevel 0x1f000000 -#define bCCKTimingRecovery 0x800000 -#define bCCKTxC0 0x3f0000 -#define bCCKTxC1 0x3f000000 -#define bCCKTxC2 0x3f -#define bCCKTxC3 0x3f00 -#define bCCKTxC4 0x3f0000 -#define bCCKTxC5 0x3f000000 -#define bCCKTxC6 0x3f -#define bCCKTxC7 0x3f00 -#define bCCKDebugPort 0xff0000 -#define bCCKDACDebug 0x0f000000 -#define bCCKFalseAlarmEnable 0x8000 -#define bCCKFalseAlarmRead 0x4000 -#define bCCKTRSSI 0x7f -#define bCCKRxAGCReport 0xfe -#define bCCKRxReport_AntSel 0x80000000 -#define bCCKRxReport_MFOff 0x40000000 -#define bCCKRxRxReport_SQLoss 0x20000000 -#define bCCKRxReport_Pktloss 0x10000000 -#define bCCKRxReport_Lockedbit 0x08000000 -#define bCCKRxReport_RateError 0x04000000 -#define bCCKRxReport_RxRate 0x03000000 -#define bCCKRxFACounterLower 0xff -#define bCCKRxFACounterUpper 0xff000000 -#define bCCKRxHPAGCStart 0xe000 -#define bCCKRxHPAGCFinal 0x1c00 -#define bCCKRxFalseAlarmEnable 0x8000 -#define bCCKFACounterFreeze 0x4000 -#define bCCKTxPathSel 0x10000000 -#define bCCKDefaultRxPath 0xc000000 -#define bCCKOptionRxPath 0x3000000 - -// 5. PageC(0xC00) -#define bNumOfSTF 0x3 // Useless -#define bShift_L 0xc0 -#define bGI_TH 0xc -#define bRxPathA 0x1 -#define bRxPathB 0x2 -#define bRxPathC 0x4 -#define bRxPathD 0x8 -#define bTxPathA 0x1 -#define bTxPathB 0x2 -#define bTxPathC 0x4 -#define bTxPathD 0x8 -#define bTRSSIFreq 0x200 -#define bADCBackoff 0x3000 -#define bDFIRBackoff 0xc000 -#define bTRSSILatchPhase 0x10000 -#define bRxIDCOffset 0xff -#define bRxQDCOffset 0xff00 -#define bRxDFIRMode 0x1800000 -#define bRxDCNFType 0xe000000 -#define bRXIQImb_A 0x3ff -#define bRXIQImb_B 0xfc00 -#define bRXIQImb_C 0x3f0000 -#define bRXIQImb_D 0xffc00000 -#define bDC_dc_Notch 0x60000 -#define bRxNBINotch 0x1f000000 -#define bPD_TH 0xf -#define bPD_TH_Opt2 0xc000 -#define bPWED_TH 0x700 -#define bIfMF_Win_L 0x800 -#define bPD_Option 0x1000 -#define bMF_Win_L 0xe000 -#define bBW_Search_L 0x30000 -#define bwin_enh_L 0xc0000 -#define bBW_TH 0x700000 -#define bED_TH2 0x3800000 -#define bBW_option 0x4000000 -#define bRatio_TH 0x18000000 -#define bWindow_L 0xe0000000 -#define bSBD_Option 0x1 -#define bFrame_TH 0x1c -#define bFS_Option 0x60 -#define bDC_Slope_check 0x80 -#define bFGuard_Counter_DC_L 0xe00 -#define bFrame_Weight_Short 0x7000 -#define bSub_Tune 0xe00000 -#define bFrame_DC_Length 0xe000000 -#define bSBD_start_offset 0x30000000 -#define bFrame_TH_2 0x7 -#define bFrame_GI2_TH 0x38 -#define bGI2_Sync_en 0x40 -#define bSarch_Short_Early 0x300 -#define bSarch_Short_Late 0xc00 -#define bSarch_GI2_Late 0x70000 -#define bCFOAntSum 0x1 -#define bCFOAcc 0x2 -#define bCFOStartOffset 0xc -#define bCFOLookBack 0x70 -#define bCFOSumWeight 0x80 -#define bDAGCEnable 0x10000 -#define bTXIQImb_A 0x3ff -#define bTXIQImb_B 0xfc00 -#define bTXIQImb_C 0x3f0000 -#define bTXIQImb_D 0xffc00000 -#define bTxIDCOffset 0xff -#define bTxQDCOffset 0xff00 -#define bTxDFIRMode 0x10000 -#define bTxPesudoNoiseOn 0x4000000 -#define bTxPesudoNoise_A 0xff -#define bTxPesudoNoise_B 0xff00 -#define bTxPesudoNoise_C 0xff0000 -#define bTxPesudoNoise_D 0xff000000 -#define bCCADropOption 0x20000 -#define bCCADropThres 0xfff00000 -#define bEDCCA_H 0xf -#define bEDCCA_L 0xf0 -#define bLambda_ED 0x300 -#define bRxInitialGain 0x7f -#define bRxAntDivEn 0x80 -#define bRxAGCAddressForLNA 0x7f00 -#define bRxHighPowerFlow 0x8000 -#define bRxAGCFreezeThres 0xc0000 -#define bRxFreezeStep_AGC1 0x300000 -#define bRxFreezeStep_AGC2 0xc00000 -#define bRxFreezeStep_AGC3 0x3000000 -#define bRxFreezeStep_AGC0 0xc000000 -#define bRxRssi_Cmp_En 0x10000000 -#define bRxQuickAGCEn 0x20000000 -#define bRxAGCFreezeThresMode 0x40000000 -#define bRxOverFlowCheckType 0x80000000 -#define bRxAGCShift 0x7f -#define bTRSW_Tri_Only 0x80 -#define bPowerThres 0x300 -#define bRxAGCEn 0x1 -#define bRxAGCTogetherEn 0x2 -#define bRxAGCMin 0x4 -#define bRxHP_Ini 0x7 -#define bRxHP_TRLNA 0x70 -#define bRxHP_RSSI 0x700 -#define bRxHP_BBP1 0x7000 -#define bRxHP_BBP2 0x70000 -#define bRxHP_BBP3 0x700000 -#define bRSSI_H 0x7f0000 //the threshold for high power -#define bRSSI_Gen 0x7f000000 //the threshold for ant diversity -#define bRxSettle_TRSW 0x7 -#define bRxSettle_LNA 0x38 -#define bRxSettle_RSSI 0x1c0 -#define bRxSettle_BBP 0xe00 -#define bRxSettle_RxHP 0x7000 -#define bRxSettle_AntSW_RSSI 0x38000 -#define bRxSettle_AntSW 0xc0000 -#define bRxProcessTime_DAGC 0x300000 -#define bRxSettle_HSSI 0x400000 -#define bRxProcessTime_BBPPW 0x800000 -#define bRxAntennaPowerShift 0x3000000 -#define bRSSITableSelect 0xc000000 -#define bRxHP_Final 0x7000000 -#define bRxHTSettle_BBP 0x7 -#define bRxHTSettle_HSSI 0x8 -#define bRxHTSettle_RxHP 0x70 -#define bRxHTSettle_BBPPW 0x80 -#define bRxHTSettle_Idle 0x300 -#define bRxHTSettle_Reserved 0x1c00 -#define bRxHTRxHPEn 0x8000 -#define bRxHTAGCFreezeThres 0x30000 -#define bRxHTAGCTogetherEn 0x40000 -#define bRxHTAGCMin 0x80000 -#define bRxHTAGCEn 0x100000 -#define bRxHTDAGCEn 0x200000 -#define bRxHTRxHP_BBP 0x1c00000 -#define bRxHTRxHP_Final 0xe0000000 -#define bRxPWRatioTH 0x3 -#define bRxPWRatioEn 0x4 -#define bRxMFHold 0x3800 -#define bRxPD_Delay_TH1 0x38 -#define bRxPD_Delay_TH2 0x1c0 -#define bRxPD_DC_COUNT_MAX 0x600 -//#define bRxMF_Hold 0x3800 -#define bRxPD_Delay_TH 0x8000 -#define bRxProcess_Delay 0xf0000 -#define bRxSearchrange_GI2_Early 0x700000 -#define bRxFrame_Guard_Counter_L 0x3800000 -#define bRxSGI_Guard_L 0xc000000 -#define bRxSGI_Search_L 0x30000000 -#define bRxSGI_TH 0xc0000000 -#define bDFSCnt0 0xff -#define bDFSCnt1 0xff00 -#define bDFSFlag 0xf0000 -#define bMFWeightSum 0x300000 -#define bMinIdxTH 0x7f000000 -#define bDAFormat 0x40000 -#define bTxChEmuEnable 0x01000000 -#define bTRSWIsolation_A 0x7f -#define bTRSWIsolation_B 0x7f00 -#define bTRSWIsolation_C 0x7f0000 -#define bTRSWIsolation_D 0x7f000000 -#define bExtLNAGain 0x7c00 - -// 6. PageE(0xE00) -#define bSTBCEn 0x4 // Useless -#define bAntennaMapping 0x10 -#define bNss 0x20 -#define bCFOAntSumD 0x200 -#define bPHYCounterReset 0x8000000 -#define bCFOReportGet 0x4000000 -#define bOFDMContinueTx 0x10000000 -#define bOFDMSingleCarrier 0x20000000 -#define bOFDMSingleTone 0x40000000 -//#define bRxPath1 0x01 -//#define bRxPath2 0x02 -//#define bRxPath3 0x04 -//#define bRxPath4 0x08 -//#define bTxPath1 0x10 -//#define bTxPath2 0x20 -#define bHTDetect 0x100 -#define bCFOEn 0x10000 -#define bCFOValue 0xfff00000 -#define bSigTone_Re 0x3f -#define bSigTone_Im 0x7f00 -#define bCounter_CCA 0xffff -#define bCounter_ParityFail 0xffff0000 -#define bCounter_RateIllegal 0xffff -#define bCounter_CRC8Fail 0xffff0000 -#define bCounter_MCSNoSupport 0xffff -#define bCounter_FastSync 0xffff -#define bShortCFO 0xfff -#define bShortCFOTLength 12 //total -#define bShortCFOFLength 11 //fraction -#define bLongCFO 0x7ff -#define bLongCFOTLength 11 -#define bLongCFOFLength 11 -#define bTailCFO 0x1fff -#define bTailCFOTLength 13 -#define bTailCFOFLength 12 -#define bmax_en_pwdB 0xffff -#define bCC_power_dB 0xffff0000 -#define bnoise_pwdB 0xffff -#define bPowerMeasTLength 10 -#define bPowerMeasFLength 3 -#define bRx_HT_BW 0x1 -#define bRxSC 0x6 -#define bRx_HT 0x8 -#define bNB_intf_det_on 0x1 -#define bIntf_win_len_cfg 0x30 -#define bNB_Intf_TH_cfg 0x1c0 -#define bRFGain 0x3f -#define bTableSel 0x40 -#define bTRSW 0x80 -#define bRxSNR_A 0xff -#define bRxSNR_B 0xff00 -#define bRxSNR_C 0xff0000 -#define bRxSNR_D 0xff000000 -#define bSNREVMTLength 8 -#define bSNREVMFLength 1 -#define bCSI1st 0xff -#define bCSI2nd 0xff00 -#define bRxEVM1st 0xff0000 -#define bRxEVM2nd 0xff000000 -#define bSIGEVM 0xff -#define bPWDB 0xff00 -#define bSGIEN 0x10000 - -#define bSFactorQAM1 0xf // Useless -#define bSFactorQAM2 0xf0 -#define bSFactorQAM3 0xf00 -#define bSFactorQAM4 0xf000 -#define bSFactorQAM5 0xf0000 -#define bSFactorQAM6 0xf0000 -#define bSFactorQAM7 0xf00000 -#define bSFactorQAM8 0xf000000 -#define bSFactorQAM9 0xf0000000 -#define bCSIScheme 0x100000 - -#define bNoiseLvlTopSet 0x3 // Useless -#define bChSmooth 0x4 -#define bChSmoothCfg1 0x38 -#define bChSmoothCfg2 0x1c0 -#define bChSmoothCfg3 0xe00 -#define bChSmoothCfg4 0x7000 -#define bMRCMode 0x800000 -#define bTHEVMCfg 0x7000000 - -#define bLoopFitType 0x1 // Useless -#define bUpdCFO 0x40 -#define bUpdCFOOffData 0x80 -#define bAdvUpdCFO 0x100 -#define bAdvTimeCtrl 0x800 -#define bUpdClko 0x1000 -#define bFC 0x6000 -#define bTrackingMode 0x8000 -#define bPhCmpEnable 0x10000 -#define bUpdClkoLTF 0x20000 -#define bComChCFO 0x40000 -#define bCSIEstiMode 0x80000 -#define bAdvUpdEqz 0x100000 -#define bUChCfg 0x7000000 -#define bUpdEqz 0x8000000 - -//Rx Pseduo noise -#define bRxPesudoNoiseOn 0x20000000 // Useless -#define bRxPesudoNoise_A 0xff -#define bRxPesudoNoise_B 0xff00 -#define bRxPesudoNoise_C 0xff0000 -#define bRxPesudoNoise_D 0xff000000 -#define bPesudoNoiseState_A 0xffff -#define bPesudoNoiseState_B 0xffff0000 -#define bPesudoNoiseState_C 0xffff -#define bPesudoNoiseState_D 0xffff0000 - -//7. RF Register -//Zebra1 -#define bZebra1_HSSIEnable 0x8 // Useless -#define bZebra1_TRxControl 0xc00 -#define bZebra1_TRxGainSetting 0x07f -#define bZebra1_RxCorner 0xc00 -#define bZebra1_TxChargePump 0x38 -#define bZebra1_RxChargePump 0x7 -#define bZebra1_ChannelNum 0xf80 -#define bZebra1_TxLPFBW 0x400 -#define bZebra1_RxLPFBW 0x600 - -//Zebra4 -#define bRTL8256RegModeCtrl1 0x100 // Useless -#define bRTL8256RegModeCtrl0 0x40 -#define bRTL8256_TxLPFBW 0x18 -#define bRTL8256_RxLPFBW 0x600 - -//RTL8258 -#define bRTL8258_TxLPFBW 0xc // Useless -#define bRTL8258_RxLPFBW 0xc00 -#define bRTL8258_RSSILPFBW 0xc0 - - -// -// Other Definition -// - -//byte endable for sb_write -#define bByte0 0x1 // Useless -#define bByte1 0x2 -#define bByte2 0x4 -#define bByte3 0x8 -#define bWord0 0x3 -#define bWord1 0xc -#define bDWord 0xf - -//for PutRegsetting & GetRegSetting BitMask -#define bMaskByte0 0xff // Reg 0xc50 rOFDM0_XAAGCCore~0xC6f -#define bMaskByte1 0xff00 -#define bMaskByte2 0xff0000 -#define bMaskByte3 0xff000000 -#define bMaskHWord 0xffff0000 -#define bMaskLWord 0x0000ffff -#define bMaskDWord 0xffffffff -#define bMask12Bits 0xfff -#define bMaskH4Bits 0xf0000000 -#define bMaskOFDM_D 0xffc00000 -#define bMaskCCK 0x3f3f3f3f - -//for PutRFRegsetting & GetRFRegSetting BitMask -//#define bMask12Bits 0xfffff // RF Reg mask bits -//#define bMask20Bits 0xfffff // RF Reg mask bits T65 RF -#define bRFRegOffsetMask 0xfffff -//#define bRFRegOffsetMask 0xfff - -//MAC0 will wirte PHY1 -#define MAC0_ACCESS_PHY1 0x4000 -//MAC1 will wirte PHY0 -#define MAC1_ACCESS_PHY0 0x2000 - -#define bEnable 0x1 // Useless -#define bDisable 0x0 - -#define LeftAntenna 0x0 // Useless -#define RightAntenna 0x1 - -#define tCheckTxStatus 500 //500ms // Useless -#define tUpdateRxCounter 100 //100ms - -#define rateCCK 0 // Useless -#define rateOFDM 1 -#define rateHT 2 - -//define Register-End -#define bPMAC_End 0x1ff // Useless -#define bFPGAPHY0_End 0x8ff -#define bFPGAPHY1_End 0x9ff -#define bCCKPHY0_End 0xaff -#define bOFDMPHY0_End 0xcff -#define bOFDMPHY1_End 0xdff - -//define max debug item in each debug page -//#define bMaxItem_FPGA_PHY0 0x9 -//#define bMaxItem_FPGA_PHY1 0x3 -//#define bMaxItem_PHY_11B 0x16 -//#define bMaxItem_OFDM_PHY0 0x29 -//#define bMaxItem_OFDM_PHY1 0x0 - -#define bPMACControl 0x0 // Useless -#define bWMACControl 0x1 -#define bWNICControl 0x2 - -#define PathA 0x0 // Useless -#define PathB 0x1 -#define PathC 0x2 -#define PathD 0x3 - -/*--------------------------Define Parameters-------------------------------*/ - - -#endif //__INC_HAL8192SPHYREG_H - + ******************************************************************************/ +/***************************************************************************** + * + * Module: __INC_HAL8192DPHYREG_H + * + * + * Note: 1. Define PMAC/BB register map + * 2. Define RF register map + * 3. PMAC/BB register bit mask. + * 4. RF reg bit mask. + * 5. Other BB/RF relative definition. + * + * + * Export: Constants, macro, functions(API), global variables(None). + * + * Abbrev: + * + * History: + * Data Who Remark + * 08/07/2007 MHC 1. Porting from 9x series PHYCFG.h. + * 2. Reorganize code architecture. + * 09/25/2008 MH 1. Add RL6052 register definition + * + *****************************************************************************/ +#ifndef __INC_HAL8192DPHYREG_H +#define __INC_HAL8192DPHYREG_H + + +/*--------------------------Define Parameters-------------------------------*/ + +//============================================================ +// 8192S Regsiter offset definition +//============================================================ + +// +// BB-PHY register PMAC 0x100 PHY 0x800 - 0xEFF +// 1. PMAC duplicate register due to connection: RF_Mode, TRxRN, NumOf L-STF +// 2. 0x800/0x900/0xA00/0xC00/0xD00/0xE00 +// 3. RF register 0x00-2E +// 4. Bit Mask for BB/RF register +// 5. Other defintion for BB/RF R/W +// + + +// +// 1. PMAC duplicate register due to connection: RF_Mode, TRxRN, NumOf L-STF +// 1. Page1(0x100) +// +#define rPMAC_Reset 0x100 +#define rPMAC_TxStart 0x104 +#define rPMAC_TxLegacySIG 0x108 +#define rPMAC_TxHTSIG1 0x10c +#define rPMAC_TxHTSIG2 0x110 +#define rPMAC_PHYDebug 0x114 +#define rPMAC_TxPacketNum 0x118 +#define rPMAC_TxIdle 0x11c +#define rPMAC_TxMACHeader0 0x120 +#define rPMAC_TxMACHeader1 0x124 +#define rPMAC_TxMACHeader2 0x128 +#define rPMAC_TxMACHeader3 0x12c +#define rPMAC_TxMACHeader4 0x130 +#define rPMAC_TxMACHeader5 0x134 +#define rPMAC_TxDataType 0x138 +#define rPMAC_TxRandomSeed 0x13c +#define rPMAC_CCKPLCPPreamble 0x140 +#define rPMAC_CCKPLCPHeader 0x144 +#define rPMAC_CCKCRC16 0x148 +#define rPMAC_OFDMRxCRC32OK 0x170 +#define rPMAC_OFDMRxCRC32Er 0x174 +#define rPMAC_OFDMRxParityEr 0x178 +#define rPMAC_OFDMRxCRC8Er 0x17c +#define rPMAC_CCKCRxRC16Er 0x180 +#define rPMAC_CCKCRxRC32Er 0x184 +#define rPMAC_CCKCRxRC32OK 0x188 +#define rPMAC_TxStatus 0x18c + +// +// 2. Page2(0x200) +// +// The following two definition are only used for USB interface. +#define RF_BB_CMD_ADDR 0x02c0 // RF/BB read/write command address. +#define RF_BB_CMD_DATA 0x02c4 // RF/BB read/write command data. + +// +// 3. Page8(0x800) +// +#define rFPGA0_RFMOD 0x800 //RF mode & CCK TxSC // RF BW Setting?? + +#define rFPGA0_TxInfo 0x804 // Status report?? +#define rFPGA0_PSDFunction 0x808 + +#define rFPGA0_TxGainStage 0x80c // Set TX PWR init gain? + +#define rFPGA0_RFTiming1 0x810 // Useless now +#define rFPGA0_RFTiming2 0x814 + +#define rFPGA0_XA_HSSIParameter1 0x820 // RF 3 wire register +#define rFPGA0_XA_HSSIParameter2 0x824 +#define rFPGA0_XB_HSSIParameter1 0x828 +#define rFPGA0_XB_HSSIParameter2 0x82c + +#define rFPGA0_XA_LSSIParameter 0x840 +#define rFPGA0_XB_LSSIParameter 0x844 + +#define rFPGA0_RFWakeUpParameter 0x850 // Useless now +#define rFPGA0_RFSleepUpParameter 0x854 + +#define rFPGA0_XAB_SwitchControl 0x858 // RF Channel switch +#define rFPGA0_XCD_SwitchControl 0x85c + +#define rFPGA0_XA_RFInterfaceOE 0x860 // RF Channel switch +#define rFPGA0_XB_RFInterfaceOE 0x864 + +#define rFPGA0_XAB_RFInterfaceSW 0x870 // RF Interface Software Control +#define rFPGA0_XCD_RFInterfaceSW 0x874 + +#define rFPGA0_XAB_RFParameter 0x878 // RF Parameter +#define rFPGA0_XCD_RFParameter 0x87c + +#define rFPGA0_AnalogParameter1 0x880 // Crystal cap setting RF-R/W protection for parameter4?? +#define rFPGA0_AnalogParameter2 0x884 +#define rFPGA0_AnalogParameter3 0x888 +#define rFPGA0_AdDaClockEn 0x888 // enable ad/da clock1 for dual-phy +#define rFPGA0_AnalogParameter4 0x88c + +#define rFPGA0_XA_LSSIReadBack 0x8a0 // Tranceiver LSSI Readback +#define rFPGA0_XB_LSSIReadBack 0x8a4 +#define rFPGA0_XC_LSSIReadBack 0x8a8 +#define rFPGA0_XD_LSSIReadBack 0x8ac + +#define rFPGA0_PSDReport 0x8b4 // Useless now +#define TransceiverA_HSPI_Readback 0x8b8 // Transceiver A HSPI Readback +#define TransceiverB_HSPI_Readback 0x8bc // Transceiver B HSPI Readback +#define rFPGA0_XAB_RFInterfaceRB 0x8e0 // Useless now // RF Interface Readback Value +#define rFPGA0_XCD_RFInterfaceRB 0x8e4 // Useless now + +// +// 4. Page9(0x900) +// +#define rFPGA1_RFMOD 0x900 //RF mode & OFDM TxSC // RF BW Setting?? + +#define rFPGA1_TxBlock 0x904 // Useless now +#define rFPGA1_DebugSelect 0x908 // Useless now +#define rFPGA1_TxInfo 0x90c // Useless now // Status report?? + +// +// 5. PageA(0xA00) +// +// Set Control channel to upper or lower. These settings are required only for 40MHz +#define rCCK0_System 0xa00 + +#define rCCK0_AFESetting 0xa04 // Disable init gain now // Select RX path by RSSI +#define rCCK0_CCA 0xa08 // Disable init gain now // Init gain + +#define rCCK0_RxAGC1 0xa0c //AGC default value, saturation level // Antenna Diversity, RX AGC, LNA Threshold, RX LNA Threshold useless now. Not the same as 90 series +#define rCCK0_RxAGC2 0xa10 //AGC & DAGC + +#define rCCK0_RxHP 0xa14 + +#define rCCK0_DSPParameter1 0xa18 //Timing recovery & Channel estimation threshold +#define rCCK0_DSPParameter2 0xa1c //SQ threshold + +#define rCCK0_TxFilter1 0xa20 +#define rCCK0_TxFilter2 0xa24 +#define rCCK0_DebugPort 0xa28 //debug port and Tx filter3 +#define rCCK0_FalseAlarmReport 0xa2c //0xa2d useless now 0xa30-a4f channel report +#define rCCK0_TRSSIReport 0xa50 +#define rCCK0_RxReport 0xa54 //0xa57 +#define rCCK0_FACounterLower 0xa5c //0xa5b +#define rCCK0_FACounterUpper 0xa58 //0xa5c + +// +// PageB(0xB00) +// +#define rPdp_AntA 0xb00 +#define rPdp_AntA_4 0xb04 +#define rPdp_AntA_8 0xb08 +#define rPdp_AntA_C 0xb0c +#define rPdp_AntA_10 0xb10 +#define rPdp_AntA_14 0xb14 +#define rPdp_AntA_18 0xb18 +#define rPdp_AntA_1C 0xb1c +#define rPdp_AntA_20 0xb20 +#define rPdp_AntA_24 0xb24 + +#define rConfig_Pmpd_AntA 0xb28 +#define rConfig_ram64x16 0xb2c + +#define rBndA 0xb30 +#define rHssiPar 0xb34 + +#define rConfig_AntA 0xb68 +#define rConfig_AntB 0xb6c + +#define rPdp_AntB 0xb70 +#define rPdp_AntB_4 0xb74 +#define rPdp_AntB_8 0xb78 +#define rPdp_AntB_C 0xb7c +#define rPdp_AntB_10 0xb80 +#define rPdp_AntB_14 0xb84 +#define rPdp_AntB_18 0xb88 +#define rPdp_AntB_1C 0xb8c +#define rPdp_AntB_20 0xb90 +#define rPdp_AntB_24 0xb94 + +#define rConfig_Pmpd_AntB 0xb98 + +#define rBndB 0xba0 + +#define rAPK 0xbd8 +#define rPm_Rx0_AntA 0xbdc +#define rPm_Rx1_AntA 0xbe0 +#define rPm_Rx2_AntA 0xbe4 +#define rPm_Rx3_AntA 0xbe8 +#define rPm_Rx0_AntB 0xbec +#define rPm_Rx1_AntB 0xbf0 +#define rPm_Rx2_AntB 0xbf4 +#define rPm_Rx3_AntB 0xbf8 + +// +// 6. PageC(0xC00) +// +#define rOFDM0_LSTF 0xc00 + +#define rOFDM0_TRxPathEnable 0xc04 +#define rOFDM0_TRMuxPar 0xc08 +#define rOFDM0_TRSWIsolation 0xc0c + +#define rOFDM0_XARxAFE 0xc10 //RxIQ DC offset, Rx digital filter, DC notch filter +#define rOFDM0_XARxIQImbalance 0xc14 //RxIQ imblance matrix +#define rOFDM0_XBRxAFE 0xc18 +#define rOFDM0_XBRxIQImbalance 0xc1c +#define rOFDM0_XCRxAFE 0xc20 +#define rOFDM0_XCRxIQImbalance 0xc24 +#define rOFDM0_XDRxAFE 0xc28 +#define rOFDM0_XDRxIQImbalance 0xc2c + +#define rOFDM0_RxDetector1 0xc30 //PD,BW & SBD // DM tune init gain +#define rOFDM0_RxDetector2 0xc34 //SBD & Fame Sync. +#define rOFDM0_RxDetector3 0xc38 //Frame Sync. +#define rOFDM0_RxDetector4 0xc3c //PD, SBD, Frame Sync & Short-GI + +#define rOFDM0_RxDSP 0xc40 //Rx Sync Path +#define rOFDM0_CFOandDAGC 0xc44 //CFO & DAGC +#define rOFDM0_CCADropThreshold 0xc48 //CCA Drop threshold +#define rOFDM0_ECCAThreshold 0xc4c // energy CCA + +#define rOFDM0_XAAGCCore1 0xc50 // DIG +#define rOFDM0_XAAGCCore2 0xc54 +#define rOFDM0_XBAGCCore1 0xc58 +#define rOFDM0_XBAGCCore2 0xc5c +#define rOFDM0_XCAGCCore1 0xc60 +#define rOFDM0_XCAGCCore2 0xc64 +#define rOFDM0_XDAGCCore1 0xc68 +#define rOFDM0_XDAGCCore2 0xc6c + +#define rOFDM0_AGCParameter1 0xc70 +#define rOFDM0_AGCParameter2 0xc74 +#define rOFDM0_AGCRSSITable 0xc78 +#define rOFDM0_HTSTFAGC 0xc7c + +#define rOFDM0_XATxIQImbalance 0xc80 // TX PWR TRACK and DIG +#define rOFDM0_XATxAFE 0xc84 +#define rOFDM0_XBTxIQImbalance 0xc88 +#define rOFDM0_XBTxAFE 0xc8c +#define rOFDM0_XCTxIQImbalance 0xc90 +#define rOFDM0_XCTxAFE 0xc94 +#define rOFDM0_XDTxIQImbalance 0xc98 +#define rOFDM0_XDTxAFE 0xc9c + +#define rOFDM0_RxIQExtAnta 0xca0 +#define rOFDM0_TxCoeff1 0xca4 +#define rOFDM0_TxCoeff2 0xca8 +#define rOFDM0_TxCoeff3 0xcac +#define rOFDM0_TxCoeff4 0xcb0 +#define rOFDM0_TxCoeff5 0xcb4 +#define rOFDM0_TxCoeff6 0xcb8 +#define rOFDM0_RxHPParameter 0xce0 +#define rOFDM0_TxPseudoNoiseWgt 0xce4 +#define rOFDM0_FrameSync 0xcf0 +#define rOFDM0_DFSReport 0xcf4 + +// +// 7. PageD(0xD00) +// +#define rOFDM1_LSTF 0xd00 +#define rOFDM1_TRxPathEnable 0xd04 + +#define rOFDM1_CFO 0xd08 // No setting now +#define rOFDM1_CSI1 0xd10 +#define rOFDM1_SBD 0xd14 +#define rOFDM1_CSI2 0xd18 +#define rOFDM1_CFOTracking 0xd2c +#define rOFDM1_TRxMesaure1 0xd34 +#define rOFDM1_IntfDet 0xd3c +#define rOFDM1_PseudoNoiseStateAB 0xd50 +#define rOFDM1_PseudoNoiseStateCD 0xd54 +#define rOFDM1_RxPseudoNoiseWgt 0xd58 + +#define rOFDM_PHYCounter1 0xda0 //cca, parity fail +#define rOFDM_PHYCounter2 0xda4 //rate illegal, crc8 fail +#define rOFDM_PHYCounter3 0xda8 //MCS not support + +#define rOFDM_ShortCFOAB 0xdac // No setting now +#define rOFDM_ShortCFOCD 0xdb0 +#define rOFDM_LongCFOAB 0xdb4 +#define rOFDM_LongCFOCD 0xdb8 +#define rOFDM_TailCFOAB 0xdbc +#define rOFDM_TailCFOCD 0xdc0 +#define rOFDM_PWMeasure1 0xdc4 +#define rOFDM_PWMeasure2 0xdc8 +#define rOFDM_BWReport 0xdcc +#define rOFDM_AGCReport 0xdd0 +#define rOFDM_RxSNR 0xdd4 +#define rOFDM_RxEVMCSI 0xdd8 +#define rOFDM_SIGReport 0xddc + + +// +// 8. PageE(0xE00) +// +#define rTxAGC_A_Rate18_06 0xe00 +#define rTxAGC_A_Rate54_24 0xe04 +#define rTxAGC_A_CCK1_Mcs32 0xe08 +#define rTxAGC_A_Mcs03_Mcs00 0xe10 +#define rTxAGC_A_Mcs07_Mcs04 0xe14 +#define rTxAGC_A_Mcs11_Mcs08 0xe18 +#define rTxAGC_A_Mcs15_Mcs12 0xe1c + +#define rTxAGC_B_Rate18_06 0x830 +#define rTxAGC_B_Rate54_24 0x834 +#define rTxAGC_B_CCK1_55_Mcs32 0x838 +#define rTxAGC_B_Mcs03_Mcs00 0x83c +#define rTxAGC_B_Mcs07_Mcs04 0x848 +#define rTxAGC_B_Mcs11_Mcs08 0x84c +#define rTxAGC_B_Mcs15_Mcs12 0x868 +#define rTxAGC_B_CCK11_A_CCK2_11 0x86c + +#define rFPGA0_IQK 0xe28 +#define rTx_IQK_Tone_A 0xe30 +#define rRx_IQK_Tone_A 0xe34 +#define rTx_IQK_PI_A 0xe38 +#define rRx_IQK_PI_A 0xe3c + +#define rTx_IQK 0xe40 +#define rRx_IQK 0xe44 +#define rIQK_AGC_Pts 0xe48 +#define rIQK_AGC_Rsp 0xe4c +#define rTx_IQK_Tone_B 0xe50 +#define rRx_IQK_Tone_B 0xe54 +#define rTx_IQK_PI_B 0xe58 +#define rRx_IQK_PI_B 0xe5c +#define rIQK_AGC_Cont 0xe60 + +#define rBlue_Tooth 0xe6c +#define rRx_Wait_CCA 0xe70 +#define rTx_CCK_RFON 0xe74 +#define rTx_CCK_BBON 0xe78 +#define rTx_OFDM_RFON 0xe7c +#define rTx_OFDM_BBON 0xe80 +#define rTx_To_Rx 0xe84 +#define rTx_To_Tx 0xe88 +#define rRx_CCK 0xe8c + +#define rTx_Power_Before_IQK_A 0xe94 +#define rTx_Power_After_IQK_A 0xe9c + +#define rRx_Power_Before_IQK_A 0xea0 +#define rRx_Power_Before_IQK_A_2 0xea4 +#define rRx_Power_After_IQK_A 0xea8 +#define rRx_Power_After_IQK_A_2 0xeac + +#define rTx_Power_Before_IQK_B 0xeb4 +#define rTx_Power_After_IQK_B 0xebc + +#define rRx_Power_Before_IQK_B 0xec0 +#define rRx_Power_Before_IQK_B_2 0xec4 +#define rRx_Power_After_IQK_B 0xec8 +#define rRx_Power_After_IQK_B_2 0xecc + +#define rRx_OFDM 0xed0 +#define rRx_Wait_RIFS 0xed4 +#define rRx_TO_Rx 0xed8 +#define rStandby 0xedc +#define rSleep 0xee0 +#define rPMPD_ANAEN 0xeec + +// +// 7. RF Register 0x00-0x2E (RF 8256) +// RF-0222D 0x00-3F +// +//Zebra1 +#define rZebra1_HSSIEnable 0x0 // Useless now +#define rZebra1_TRxEnable1 0x1 +#define rZebra1_TRxEnable2 0x2 +#define rZebra1_AGC 0x4 +#define rZebra1_ChargePump 0x5 +#define rZebra1_Channel 0x7 // RF channel switch + +//#endif +#define rZebra1_TxGain 0x8 // Useless now +#define rZebra1_TxLPF 0x9 +#define rZebra1_RxLPF 0xb +#define rZebra1_RxHPFCorner 0xc + +//Zebra4 +#define rGlobalCtrl 0 // Useless now +#define rRTL8256_TxLPF 19 +#define rRTL8256_RxLPF 11 + +//RTL8258 +#define rRTL8258_TxLPF 0x11 // Useless now +#define rRTL8258_RxLPF 0x13 +#define rRTL8258_RSSILPF 0xa + +// +// RL6052 Register definition +// +#define RF_AC 0x00 // + +#define RF_IQADJ_G1 0x01 // +#define RF_IQADJ_G2 0x02 // +#define RF_BS_PA_APSET_G1_G4 0x03 +#define RF_BS_PA_APSET_G5_G8 0x04 +#define RF_POW_TRSW 0x05 // + +#define RF_GAIN_RX 0x06 // +#define RF_GAIN_TX 0x07 // + +#define RF_TXM_IDAC 0x08 // +#define RF_IPA_G 0x09 // +#define RF_TXBIAS_G 0x0A +#define RF_TXPA_AG 0x0B +#define RF_IPA_A 0x0C // +#define RF_TXBIAS_A 0x0D +#define RF_BS_PA_APSET_G9_G11 0x0E +#define RF_BS_IQGEN 0x0F // + +#define RF_MODE1 0x10 // +#define RF_MODE2 0x11 // + +#define RF_RX_AGC_HP 0x12 // +#define RF_TX_AGC 0x13 // +#define RF_BIAS 0x14 // +#define RF_IPA 0x15 // +#define RF_TXBIAS 0x16 // +#define RF_POW_ABILITY 0x17 // +#define RF_MODE_AG 0x18 // +#define rRfChannel 0x18 // RF channel and BW switch +#define RF_CHNLBW 0x18 // RF channel and BW switch +#define RF_TOP 0x19 // + +#define RF_RX_G1 0x1A // +#define RF_RX_G2 0x1B // + +#define RF_RX_BB2 0x1C // +#define RF_RX_BB1 0x1D // + +#define RF_RCK1 0x1E // +#define RF_RCK2 0x1F // + +#define RF_TX_G1 0x20 // +#define RF_TX_G2 0x21 // +#define RF_TX_G3 0x22 // + +#define RF_TX_BB1 0x23 // + +#define RF_T_METER 0x42 // + +#define RF_SYN_G1 0x25 // RF TX Power control +#define RF_SYN_G2 0x26 // RF TX Power control +#define RF_SYN_G3 0x27 // RF TX Power control +#define RF_SYN_G4 0x28 // RF TX Power control +#define RF_SYN_G5 0x29 // RF TX Power control +#define RF_SYN_G6 0x2A // RF TX Power control +#define RF_SYN_G7 0x2B // RF TX Power control +#define RF_SYN_G8 0x2C // RF TX Power control + +#define RF_RCK_OS 0x30 // RF TX PA control + +#define RF_TXPA_G1 0x31 // RF TX PA control +#define RF_TXPA_G2 0x32 // RF TX PA control +#define RF_TXPA_G3 0x33 // RF TX PA control +#define RF_LOBF_9 0x38 +#define RF_RXRF_A3 0x3C // +#define RF_TRSW 0x3F + +#define RF_TXRF_A2 0x41 +#define RF_TXPA_G4 0x46 +#define RF_TXPA_A4 0x4B + +// +//Bit Mask +// +// 1. Page1(0x100) +#define bBBResetB 0x100 // Useless now? +#define bGlobalResetB 0x200 +#define bOFDMTxStart 0x4 +#define bCCKTxStart 0x8 +#define bCRC32Debug 0x100 +#define bPMACLoopback 0x10 +#define bTxLSIG 0xffffff +#define bOFDMTxRate 0xf +#define bOFDMTxReserved 0x10 +#define bOFDMTxLength 0x1ffe0 +#define bOFDMTxParity 0x20000 +#define bTxHTSIG1 0xffffff +#define bTxHTMCSRate 0x7f +#define bTxHTBW 0x80 +#define bTxHTLength 0xffff00 +#define bTxHTSIG2 0xffffff +#define bTxHTSmoothing 0x1 +#define bTxHTSounding 0x2 +#define bTxHTReserved 0x4 +#define bTxHTAggreation 0x8 +#define bTxHTSTBC 0x30 +#define bTxHTAdvanceCoding 0x40 +#define bTxHTShortGI 0x80 +#define bTxHTNumberHT_LTF 0x300 +#define bTxHTCRC8 0x3fc00 +#define bCounterReset 0x10000 +#define bNumOfOFDMTx 0xffff +#define bNumOfCCKTx 0xffff0000 +#define bTxIdleInterval 0xffff +#define bOFDMService 0xffff0000 +#define bTxMACHeader 0xffffffff +#define bTxDataInit 0xff +#define bTxHTMode 0x100 +#define bTxDataType 0x30000 +#define bTxRandomSeed 0xffffffff +#define bCCKTxPreamble 0x1 +#define bCCKTxSFD 0xffff0000 +#define bCCKTxSIG 0xff +#define bCCKTxService 0xff00 +#define bCCKLengthExt 0x8000 +#define bCCKTxLength 0xffff0000 +#define bCCKTxCRC16 0xffff +#define bCCKTxStatus 0x1 +#define bOFDMTxStatus 0x2 + +#define IS_BB_REG_OFFSET_92S(_Offset) ((_Offset >= 0x800) && (_Offset <= 0xfff)) + +// 2. Page8(0x800) +#define bRFMOD 0x1 // Reg 0x800 rFPGA0_RFMOD +#define bJapanMode 0x2 +#define bCCKTxSC 0x30 +#define bCCKEn 0x1000000 +#define bOFDMEn 0x2000000 + +#define bOFDMRxADCPhase 0x10000 // Useless now +#define bOFDMTxDACPhase 0x40000 +#define bXATxAGC 0x3f + +#define bAntennaSelect 0x0300 + +#define bXBTxAGC 0xf00 // Reg 80c rFPGA0_TxGainStage +#define bXCTxAGC 0xf000 +#define bXDTxAGC 0xf0000 + +#define bPAStart 0xf0000000 // Useless now +#define bTRStart 0x00f00000 +#define bRFStart 0x0000f000 +#define bBBStart 0x000000f0 +#define bBBCCKStart 0x0000000f +#define bPAEnd 0xf //Reg0x814 +#define bTREnd 0x0f000000 +#define bRFEnd 0x000f0000 +#define bCCAMask 0x000000f0 //T2R +#define bR2RCCAMask 0x00000f00 +#define bHSSI_R2TDelay 0xf8000000 +#define bHSSI_T2RDelay 0xf80000 +#define bContTxHSSI 0x400 //chane gain at continue Tx +#define bIGFromCCK 0x200 +#define bAGCAddress 0x3f +#define bRxHPTx 0x7000 +#define bRxHPT2R 0x38000 +#define bRxHPCCKIni 0xc0000 +#define bAGCTxCode 0xc00000 +#define bAGCRxCode 0x300000 + +#define b3WireDataLength 0x800 // Reg 0x820~84f rFPGA0_XA_HSSIParameter1 +#define b3WireAddressLength 0x400 + +#define b3WireRFPowerDown 0x1 // Useless now +//#define bHWSISelect 0x8 +#define b5GPAPEPolarity 0x40000000 +#define b2GPAPEPolarity 0x80000000 +#define bRFSW_TxDefaultAnt 0x3 +#define bRFSW_TxOptionAnt 0x30 +#define bRFSW_RxDefaultAnt 0x300 +#define bRFSW_RxOptionAnt 0x3000 +#define bRFSI_3WireData 0x1 +#define bRFSI_3WireClock 0x2 +#define bRFSI_3WireLoad 0x4 +#define bRFSI_3WireRW 0x8 +#define bRFSI_3Wire 0xf + +#define bRFSI_RFENV 0x10 // Reg 0x870 rFPGA0_XAB_RFInterfaceSW + +#define bRFSI_TRSW 0x20 // Useless now +#define bRFSI_TRSWB 0x40 +#define bRFSI_ANTSW 0x100 +#define bRFSI_ANTSWB 0x200 +#define bRFSI_PAPE 0x400 +#define bRFSI_PAPE5G 0x800 +#define bBandSelect 0x1 +#define bHTSIG2_GI 0x80 +#define bHTSIG2_Smoothing 0x01 +#define bHTSIG2_Sounding 0x02 +#define bHTSIG2_Aggreaton 0x08 +#define bHTSIG2_STBC 0x30 +#define bHTSIG2_AdvCoding 0x40 +#define bHTSIG2_NumOfHTLTF 0x300 +#define bHTSIG2_CRC8 0x3fc +#define bHTSIG1_MCS 0x7f +#define bHTSIG1_BandWidth 0x80 +#define bHTSIG1_HTLength 0xffff +#define bLSIG_Rate 0xf +#define bLSIG_Reserved 0x10 +#define bLSIG_Length 0x1fffe +#define bLSIG_Parity 0x20 +#define bCCKRxPhase 0x4 + +#define bLSSIReadAddress 0x7f800000 // T65 RF + +#define bLSSIReadEdge 0x80000000 //LSSI "Read" edge signal + +#define bLSSIReadBackData 0xfffff // T65 RF + +#define bLSSIReadOKFlag 0x1000 // Useless now +#define bCCKSampleRate 0x8 //0: 44MHz, 1:88MHz +#define bRegulator0Standby 0x1 +#define bRegulatorPLLStandby 0x2 +#define bRegulator1Standby 0x4 +#define bPLLPowerUp 0x8 +#define bDPLLPowerUp 0x10 +#define bDA10PowerUp 0x20 +#define bAD7PowerUp 0x200 +#define bDA6PowerUp 0x2000 +#define bXtalPowerUp 0x4000 +#define b40MDClkPowerUP 0x8000 +#define bDA6DebugMode 0x20000 +#define bDA6Swing 0x380000 + +#define bADClkPhase 0x4000000 // Reg 0x880 rFPGA0_AnalogParameter1 20/40 CCK support switch 40/80 BB MHZ + +#define b80MClkDelay 0x18000000 // Useless +#define bAFEWatchDogEnable 0x20000000 + +#define bXtalCap01 0xc0000000 // Reg 0x884 rFPGA0_AnalogParameter2 Crystal cap +#define bXtalCap23 0x3 +#define bXtalCap92x 0x0f000000 +#define bXtalCap 0x0f000000 + +#define bIntDifClkEnable 0x400 // Useless +#define bExtSigClkEnable 0x800 +#define bBandgapMbiasPowerUp 0x10000 +#define bAD11SHGain 0xc0000 +#define bAD11InputRange 0x700000 +#define bAD11OPCurrent 0x3800000 +#define bIPathLoopback 0x4000000 +#define bQPathLoopback 0x8000000 +#define bAFELoopback 0x10000000 +#define bDA10Swing 0x7e0 +#define bDA10Reverse 0x800 +#define bDAClkSource 0x1000 +#define bAD7InputRange 0x6000 +#define bAD7Gain 0x38000 +#define bAD7OutputCMMode 0x40000 +#define bAD7InputCMMode 0x380000 +#define bAD7Current 0xc00000 +#define bRegulatorAdjust 0x7000000 +#define bAD11PowerUpAtTx 0x1 +#define bDA10PSAtTx 0x10 +#define bAD11PowerUpAtRx 0x100 +#define bDA10PSAtRx 0x1000 +#define bCCKRxAGCFormat 0x200 +#define bPSDFFTSamplepPoint 0xc000 +#define bPSDAverageNum 0x3000 +#define bIQPathControl 0xc00 +#define bPSDFreq 0x3ff +#define bPSDAntennaPath 0x30 +#define bPSDIQSwitch 0x40 +#define bPSDRxTrigger 0x400000 +#define bPSDTxTrigger 0x80000000 +#define bPSDSineToneScale 0x7f000000 +#define bPSDReport 0xffff + +// 3. Page9(0x900) +#define bOFDMTxSC 0x30000000 // Useless +#define bCCKTxOn 0x1 +#define bOFDMTxOn 0x2 +#define bDebugPage 0xfff //reset debug page and also HWord, LWord +#define bDebugItem 0xff //reset debug page and LWord +#define bAntL 0x10 +#define bAntNonHT 0x100 +#define bAntHT1 0x1000 +#define bAntHT2 0x10000 +#define bAntHT1S1 0x100000 +#define bAntNonHTS1 0x1000000 + +// 4. PageA(0xA00) +#define bCCKBBMode 0x3 // Useless +#define bCCKTxPowerSaving 0x80 +#define bCCKRxPowerSaving 0x40 + +#define bCCKSideBand 0x10 // Reg 0xa00 rCCK0_System 20/40 switch + +#define bCCKScramble 0x8 // Useless +#define bCCKAntDiversity 0x8000 +#define bCCKCarrierRecovery 0x4000 +#define bCCKTxRate 0x3000 +#define bCCKDCCancel 0x0800 +#define bCCKISICancel 0x0400 +#define bCCKMatchFilter 0x0200 +#define bCCKEqualizer 0x0100 +#define bCCKPreambleDetect 0x800000 +#define bCCKFastFalseCCA 0x400000 +#define bCCKChEstStart 0x300000 +#define bCCKCCACount 0x080000 +#define bCCKcs_lim 0x070000 +#define bCCKBistMode 0x80000000 +#define bCCKCCAMask 0x40000000 +#define bCCKTxDACPhase 0x4 +#define bCCKRxADCPhase 0x20000000 //r_rx_clk +#define bCCKr_cp_mode0 0x0100 +#define bCCKTxDCOffset 0xf0 +#define bCCKRxDCOffset 0xf +#define bCCKCCAMode 0xc000 +#define bCCKFalseCS_lim 0x3f00 +#define bCCKCS_ratio 0xc00000 +#define bCCKCorgBit_sel 0x300000 +#define bCCKPD_lim 0x0f0000 +#define bCCKNewCCA 0x80000000 +#define bCCKRxHPofIG 0x8000 +#define bCCKRxIG 0x7f00 +#define bCCKLNAPolarity 0x800000 +#define bCCKRx1stGain 0x7f0000 +#define bCCKRFExtend 0x20000000 //CCK Rx Iinital gain polarity +#define bCCKRxAGCSatLevel 0x1f000000 +#define bCCKRxAGCSatCount 0xe0 +#define bCCKRxRFSettle 0x1f //AGCsamp_dly +#define bCCKFixedRxAGC 0x8000 +//#define bCCKRxAGCFormat 0x4000 //remove to HSSI register 0x824 +#define bCCKAntennaPolarity 0x2000 +#define bCCKTxFilterType 0x0c00 +#define bCCKRxAGCReportType 0x0300 +#define bCCKRxDAGCEn 0x80000000 +#define bCCKRxDAGCPeriod 0x20000000 +#define bCCKRxDAGCSatLevel 0x1f000000 +#define bCCKTimingRecovery 0x800000 +#define bCCKTxC0 0x3f0000 +#define bCCKTxC1 0x3f000000 +#define bCCKTxC2 0x3f +#define bCCKTxC3 0x3f00 +#define bCCKTxC4 0x3f0000 +#define bCCKTxC5 0x3f000000 +#define bCCKTxC6 0x3f +#define bCCKTxC7 0x3f00 +#define bCCKDebugPort 0xff0000 +#define bCCKDACDebug 0x0f000000 +#define bCCKFalseAlarmEnable 0x8000 +#define bCCKFalseAlarmRead 0x4000 +#define bCCKTRSSI 0x7f +#define bCCKRxAGCReport 0xfe +#define bCCKRxReport_AntSel 0x80000000 +#define bCCKRxReport_MFOff 0x40000000 +#define bCCKRxRxReport_SQLoss 0x20000000 +#define bCCKRxReport_Pktloss 0x10000000 +#define bCCKRxReport_Lockedbit 0x08000000 +#define bCCKRxReport_RateError 0x04000000 +#define bCCKRxReport_RxRate 0x03000000 +#define bCCKRxFACounterLower 0xff +#define bCCKRxFACounterUpper 0xff000000 +#define bCCKRxHPAGCStart 0xe000 +#define bCCKRxHPAGCFinal 0x1c00 +#define bCCKRxFalseAlarmEnable 0x8000 +#define bCCKFACounterFreeze 0x4000 +#define bCCKTxPathSel 0x10000000 +#define bCCKDefaultRxPath 0xc000000 +#define bCCKOptionRxPath 0x3000000 + +// 5. PageC(0xC00) +#define bNumOfSTF 0x3 // Useless +#define bShift_L 0xc0 +#define bGI_TH 0xc +#define bRxPathA 0x1 +#define bRxPathB 0x2 +#define bRxPathC 0x4 +#define bRxPathD 0x8 +#define bTxPathA 0x1 +#define bTxPathB 0x2 +#define bTxPathC 0x4 +#define bTxPathD 0x8 +#define bTRSSIFreq 0x200 +#define bADCBackoff 0x3000 +#define bDFIRBackoff 0xc000 +#define bTRSSILatchPhase 0x10000 +#define bRxIDCOffset 0xff +#define bRxQDCOffset 0xff00 +#define bRxDFIRMode 0x1800000 +#define bRxDCNFType 0xe000000 +#define bRXIQImb_A 0x3ff +#define bRXIQImb_B 0xfc00 +#define bRXIQImb_C 0x3f0000 +#define bRXIQImb_D 0xffc00000 +#define bDC_dc_Notch 0x60000 +#define bRxNBINotch 0x1f000000 +#define bPD_TH 0xf +#define bPD_TH_Opt2 0xc000 +#define bPWED_TH 0x700 +#define bIfMF_Win_L 0x800 +#define bPD_Option 0x1000 +#define bMF_Win_L 0xe000 +#define bBW_Search_L 0x30000 +#define bwin_enh_L 0xc0000 +#define bBW_TH 0x700000 +#define bED_TH2 0x3800000 +#define bBW_option 0x4000000 +#define bRatio_TH 0x18000000 +#define bWindow_L 0xe0000000 +#define bSBD_Option 0x1 +#define bFrame_TH 0x1c +#define bFS_Option 0x60 +#define bDC_Slope_check 0x80 +#define bFGuard_Counter_DC_L 0xe00 +#define bFrame_Weight_Short 0x7000 +#define bSub_Tune 0xe00000 +#define bFrame_DC_Length 0xe000000 +#define bSBD_start_offset 0x30000000 +#define bFrame_TH_2 0x7 +#define bFrame_GI2_TH 0x38 +#define bGI2_Sync_en 0x40 +#define bSarch_Short_Early 0x300 +#define bSarch_Short_Late 0xc00 +#define bSarch_GI2_Late 0x70000 +#define bCFOAntSum 0x1 +#define bCFOAcc 0x2 +#define bCFOStartOffset 0xc +#define bCFOLookBack 0x70 +#define bCFOSumWeight 0x80 +#define bDAGCEnable 0x10000 +#define bTXIQImb_A 0x3ff +#define bTXIQImb_B 0xfc00 +#define bTXIQImb_C 0x3f0000 +#define bTXIQImb_D 0xffc00000 +#define bTxIDCOffset 0xff +#define bTxQDCOffset 0xff00 +#define bTxDFIRMode 0x10000 +#define bTxPesudoNoiseOn 0x4000000 +#define bTxPesudoNoise_A 0xff +#define bTxPesudoNoise_B 0xff00 +#define bTxPesudoNoise_C 0xff0000 +#define bTxPesudoNoise_D 0xff000000 +#define bCCADropOption 0x20000 +#define bCCADropThres 0xfff00000 +#define bEDCCA_H 0xf +#define bEDCCA_L 0xf0 +#define bLambda_ED 0x300 +#define bRxInitialGain 0x7f +#define bRxAntDivEn 0x80 +#define bRxAGCAddressForLNA 0x7f00 +#define bRxHighPowerFlow 0x8000 +#define bRxAGCFreezeThres 0xc0000 +#define bRxFreezeStep_AGC1 0x300000 +#define bRxFreezeStep_AGC2 0xc00000 +#define bRxFreezeStep_AGC3 0x3000000 +#define bRxFreezeStep_AGC0 0xc000000 +#define bRxRssi_Cmp_En 0x10000000 +#define bRxQuickAGCEn 0x20000000 +#define bRxAGCFreezeThresMode 0x40000000 +#define bRxOverFlowCheckType 0x80000000 +#define bRxAGCShift 0x7f +#define bTRSW_Tri_Only 0x80 +#define bPowerThres 0x300 +#define bRxAGCEn 0x1 +#define bRxAGCTogetherEn 0x2 +#define bRxAGCMin 0x4 +#define bRxHP_Ini 0x7 +#define bRxHP_TRLNA 0x70 +#define bRxHP_RSSI 0x700 +#define bRxHP_BBP1 0x7000 +#define bRxHP_BBP2 0x70000 +#define bRxHP_BBP3 0x700000 +#define bRSSI_H 0x7f0000 //the threshold for high power +#define bRSSI_Gen 0x7f000000 //the threshold for ant diversity +#define bRxSettle_TRSW 0x7 +#define bRxSettle_LNA 0x38 +#define bRxSettle_RSSI 0x1c0 +#define bRxSettle_BBP 0xe00 +#define bRxSettle_RxHP 0x7000 +#define bRxSettle_AntSW_RSSI 0x38000 +#define bRxSettle_AntSW 0xc0000 +#define bRxProcessTime_DAGC 0x300000 +#define bRxSettle_HSSI 0x400000 +#define bRxProcessTime_BBPPW 0x800000 +#define bRxAntennaPowerShift 0x3000000 +#define bRSSITableSelect 0xc000000 +#define bRxHP_Final 0x7000000 +#define bRxHTSettle_BBP 0x7 +#define bRxHTSettle_HSSI 0x8 +#define bRxHTSettle_RxHP 0x70 +#define bRxHTSettle_BBPPW 0x80 +#define bRxHTSettle_Idle 0x300 +#define bRxHTSettle_Reserved 0x1c00 +#define bRxHTRxHPEn 0x8000 +#define bRxHTAGCFreezeThres 0x30000 +#define bRxHTAGCTogetherEn 0x40000 +#define bRxHTAGCMin 0x80000 +#define bRxHTAGCEn 0x100000 +#define bRxHTDAGCEn 0x200000 +#define bRxHTRxHP_BBP 0x1c00000 +#define bRxHTRxHP_Final 0xe0000000 +#define bRxPWRatioTH 0x3 +#define bRxPWRatioEn 0x4 +#define bRxMFHold 0x3800 +#define bRxPD_Delay_TH1 0x38 +#define bRxPD_Delay_TH2 0x1c0 +#define bRxPD_DC_COUNT_MAX 0x600 +//#define bRxMF_Hold 0x3800 +#define bRxPD_Delay_TH 0x8000 +#define bRxProcess_Delay 0xf0000 +#define bRxSearchrange_GI2_Early 0x700000 +#define bRxFrame_Guard_Counter_L 0x3800000 +#define bRxSGI_Guard_L 0xc000000 +#define bRxSGI_Search_L 0x30000000 +#define bRxSGI_TH 0xc0000000 +#define bDFSCnt0 0xff +#define bDFSCnt1 0xff00 +#define bDFSFlag 0xf0000 +#define bMFWeightSum 0x300000 +#define bMinIdxTH 0x7f000000 +#define bDAFormat 0x40000 +#define bTxChEmuEnable 0x01000000 +#define bTRSWIsolation_A 0x7f +#define bTRSWIsolation_B 0x7f00 +#define bTRSWIsolation_C 0x7f0000 +#define bTRSWIsolation_D 0x7f000000 +#define bExtLNAGain 0x7c00 + +// 6. PageE(0xE00) +#define bSTBCEn 0x4 // Useless +#define bAntennaMapping 0x10 +#define bNss 0x20 +#define bCFOAntSumD 0x200 +#define bPHYCounterReset 0x8000000 +#define bCFOReportGet 0x4000000 +#define bOFDMContinueTx 0x10000000 +#define bOFDMSingleCarrier 0x20000000 +#define bOFDMSingleTone 0x40000000 +//#define bRxPath1 0x01 +//#define bRxPath2 0x02 +//#define bRxPath3 0x04 +//#define bRxPath4 0x08 +//#define bTxPath1 0x10 +//#define bTxPath2 0x20 +#define bHTDetect 0x100 +#define bCFOEn 0x10000 +#define bCFOValue 0xfff00000 +#define bSigTone_Re 0x3f +#define bSigTone_Im 0x7f00 +#define bCounter_CCA 0xffff +#define bCounter_ParityFail 0xffff0000 +#define bCounter_RateIllegal 0xffff +#define bCounter_CRC8Fail 0xffff0000 +#define bCounter_MCSNoSupport 0xffff +#define bCounter_FastSync 0xffff +#define bShortCFO 0xfff +#define bShortCFOTLength 12 //total +#define bShortCFOFLength 11 //fraction +#define bLongCFO 0x7ff +#define bLongCFOTLength 11 +#define bLongCFOFLength 11 +#define bTailCFO 0x1fff +#define bTailCFOTLength 13 +#define bTailCFOFLength 12 +#define bmax_en_pwdB 0xffff +#define bCC_power_dB 0xffff0000 +#define bnoise_pwdB 0xffff +#define bPowerMeasTLength 10 +#define bPowerMeasFLength 3 +#define bRx_HT_BW 0x1 +#define bRxSC 0x6 +#define bRx_HT 0x8 +#define bNB_intf_det_on 0x1 +#define bIntf_win_len_cfg 0x30 +#define bNB_Intf_TH_cfg 0x1c0 +#define bRFGain 0x3f +#define bTableSel 0x40 +#define bTRSW 0x80 +#define bRxSNR_A 0xff +#define bRxSNR_B 0xff00 +#define bRxSNR_C 0xff0000 +#define bRxSNR_D 0xff000000 +#define bSNREVMTLength 8 +#define bSNREVMFLength 1 +#define bCSI1st 0xff +#define bCSI2nd 0xff00 +#define bRxEVM1st 0xff0000 +#define bRxEVM2nd 0xff000000 +#define bSIGEVM 0xff +#define bPWDB 0xff00 +#define bSGIEN 0x10000 + +#define bSFactorQAM1 0xf // Useless +#define bSFactorQAM2 0xf0 +#define bSFactorQAM3 0xf00 +#define bSFactorQAM4 0xf000 +#define bSFactorQAM5 0xf0000 +#define bSFactorQAM6 0xf0000 +#define bSFactorQAM7 0xf00000 +#define bSFactorQAM8 0xf000000 +#define bSFactorQAM9 0xf0000000 +#define bCSIScheme 0x100000 + +#define bNoiseLvlTopSet 0x3 // Useless +#define bChSmooth 0x4 +#define bChSmoothCfg1 0x38 +#define bChSmoothCfg2 0x1c0 +#define bChSmoothCfg3 0xe00 +#define bChSmoothCfg4 0x7000 +#define bMRCMode 0x800000 +#define bTHEVMCfg 0x7000000 + +#define bLoopFitType 0x1 // Useless +#define bUpdCFO 0x40 +#define bUpdCFOOffData 0x80 +#define bAdvUpdCFO 0x100 +#define bAdvTimeCtrl 0x800 +#define bUpdClko 0x1000 +#define bFC 0x6000 +#define bTrackingMode 0x8000 +#define bPhCmpEnable 0x10000 +#define bUpdClkoLTF 0x20000 +#define bComChCFO 0x40000 +#define bCSIEstiMode 0x80000 +#define bAdvUpdEqz 0x100000 +#define bUChCfg 0x7000000 +#define bUpdEqz 0x8000000 + +//Rx Pseduo noise +#define bRxPesudoNoiseOn 0x20000000 // Useless +#define bRxPesudoNoise_A 0xff +#define bRxPesudoNoise_B 0xff00 +#define bRxPesudoNoise_C 0xff0000 +#define bRxPesudoNoise_D 0xff000000 +#define bPesudoNoiseState_A 0xffff +#define bPesudoNoiseState_B 0xffff0000 +#define bPesudoNoiseState_C 0xffff +#define bPesudoNoiseState_D 0xffff0000 + +//7. RF Register +//Zebra1 +#define bZebra1_HSSIEnable 0x8 // Useless +#define bZebra1_TRxControl 0xc00 +#define bZebra1_TRxGainSetting 0x07f +#define bZebra1_RxCorner 0xc00 +#define bZebra1_TxChargePump 0x38 +#define bZebra1_RxChargePump 0x7 +#define bZebra1_ChannelNum 0xf80 +#define bZebra1_TxLPFBW 0x400 +#define bZebra1_RxLPFBW 0x600 + +//Zebra4 +#define bRTL8256RegModeCtrl1 0x100 // Useless +#define bRTL8256RegModeCtrl0 0x40 +#define bRTL8256_TxLPFBW 0x18 +#define bRTL8256_RxLPFBW 0x600 + +//RTL8258 +#define bRTL8258_TxLPFBW 0xc // Useless +#define bRTL8258_RxLPFBW 0xc00 +#define bRTL8258_RSSILPFBW 0xc0 + + +// +// Other Definition +// + +//byte endable for sb_write +#define bByte0 0x1 // Useless +#define bByte1 0x2 +#define bByte2 0x4 +#define bByte3 0x8 +#define bWord0 0x3 +#define bWord1 0xc +#define bDWord 0xf + +//for PutRegsetting & GetRegSetting BitMask +#define bMaskByte0 0xff // Reg 0xc50 rOFDM0_XAAGCCore~0xC6f +#define bMaskByte1 0xff00 +#define bMaskByte2 0xff0000 +#define bMaskByte3 0xff000000 +#define bMaskHWord 0xffff0000 +#define bMaskLWord 0x0000ffff +#define bMaskDWord 0xffffffff +#define bMask12Bits 0xfff +#define bMaskH4Bits 0xf0000000 +#define bMaskOFDM_D 0xffc00000 +#define bMaskCCK 0x3f3f3f3f + +//for PutRFRegsetting & GetRFRegSetting BitMask +//#define bMask12Bits 0xfffff // RF Reg mask bits +//#define bMask20Bits 0xfffff // RF Reg mask bits T65 RF +#define bRFRegOffsetMask 0xfffff +//#define bRFRegOffsetMask 0xfff + +//MAC0 will wirte PHY1 +#define MAC0_ACCESS_PHY1 0x4000 +//MAC1 will wirte PHY0 +#define MAC1_ACCESS_PHY0 0x2000 + +#define bEnable 0x1 // Useless +#define bDisable 0x0 + +#define LeftAntenna 0x0 // Useless +#define RightAntenna 0x1 + +#define tCheckTxStatus 500 //500ms // Useless +#define tUpdateRxCounter 100 //100ms + +#define rateCCK 0 // Useless +#define rateOFDM 1 +#define rateHT 2 + +//define Register-End +#define bPMAC_End 0x1ff // Useless +#define bFPGAPHY0_End 0x8ff +#define bFPGAPHY1_End 0x9ff +#define bCCKPHY0_End 0xaff +#define bOFDMPHY0_End 0xcff +#define bOFDMPHY1_End 0xdff + +//define max debug item in each debug page +//#define bMaxItem_FPGA_PHY0 0x9 +//#define bMaxItem_FPGA_PHY1 0x3 +//#define bMaxItem_PHY_11B 0x16 +//#define bMaxItem_OFDM_PHY0 0x29 +//#define bMaxItem_OFDM_PHY1 0x0 + +#define bPMACControl 0x0 // Useless +#define bWMACControl 0x1 +#define bWNICControl 0x2 + +#define PathA 0x0 // Useless +#define PathB 0x1 +#define PathC 0x2 +#define PathD 0x3 + +/*--------------------------Define Parameters-------------------------------*/ + + +#endif //__INC_HAL8192SPHYREG_H diff --git a/include/Hal8723APhyCfg.h b/include/Hal8723APhyCfg.h index 08c0b0f..1b37c18 100755 --- a/include/Hal8723APhyCfg.h +++ b/include/Hal8723APhyCfg.h @@ -1,30 +1,29 @@ -/****************************************************************************** - * - * 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 __INC_HAL8723PHYCFG_H__ -#define __INC_HAL8723PHYCFG_H__ - -#include -/* MAC/BB/RF HAL config */ -int PHY_BBConfig8723A( IN struct adapter *Adapter ); -int PHY_RFConfig8723A( IN struct adapter *Adapter ); -s32 PHY_MACConfig8723A(struct adapter *padapter); - -#endif - +/****************************************************************************** + * + * 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 __INC_HAL8723PHYCFG_H__ +#define __INC_HAL8723PHYCFG_H__ + +#include +/* MAC/BB/RF HAL config */ +int PHY_BBConfig8723A( IN struct adapter *Adapter ); +int PHY_RFConfig8723A( IN struct adapter *Adapter ); +s32 PHY_MACConfig8723A(struct adapter *padapter); + +#endif diff --git a/include/Hal8723APhyReg.h b/include/Hal8723APhyReg.h index 7b244b4..727fe34 100755 --- a/include/Hal8723APhyReg.h +++ b/include/Hal8723APhyReg.h @@ -1,74 +1,73 @@ -/****************************************************************************** - * - * 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 __INC_HAL8723APHYREG_H__ -#define __INC_HAL8723APHYREG_H__ - -#include - -// -// PageB(0xB00) -// -#define rPdp_AntA 0xb00 -#define rPdp_AntA_4 0xb04 -#define rPdp_AntA_8 0xb08 -#define rPdp_AntA_C 0xb0c -#define rPdp_AntA_10 0xb10 -#define rPdp_AntA_14 0xb14 -#define rPdp_AntA_18 0xb18 -#define rPdp_AntA_1C 0xb1c -#define rPdp_AntA_20 0xb20 -#define rPdp_AntA_24 0xb24 - -#define rConfig_Pmpd_AntA 0xb28 -#define rConfig_ram64x16 0xb2c - -#define rBndA 0xb30 -#define rHssiPar 0xb34 - -#define rConfig_AntA 0xb68 -#define rConfig_AntB 0xb6c - -#define rPdp_AntB 0xb70 -#define rPdp_AntB_4 0xb74 -#define rPdp_AntB_8 0xb78 -#define rPdp_AntB_C 0xb7c -#define rPdp_AntB_10 0xb80 -#define rPdp_AntB_14 0xb84 -#define rPdp_AntB_18 0xb88 -#define rPdp_AntB_1C 0xb8c -#define rPdp_AntB_20 0xb90 -#define rPdp_AntB_24 0xb94 - -#define rConfig_Pmpd_AntB 0xb98 - -#define rBndB 0xba0 - -#define rAPK 0xbd8 -#define rPm_Rx0_AntA 0xbdc -#define rPm_Rx1_AntA 0xbe0 -#define rPm_Rx2_AntA 0xbe4 -#define rPm_Rx3_AntA 0xbe8 -#define rPm_Rx0_AntB 0xbec -#define rPm_Rx1_AntB 0xbf0 -#define rPm_Rx2_AntB 0xbf4 -#define rPm_Rx3_AntB 0xbf8 - -#endif - +/****************************************************************************** + * + * 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 __INC_HAL8723APHYREG_H__ +#define __INC_HAL8723APHYREG_H__ + +#include + +// +// PageB(0xB00) +// +#define rPdp_AntA 0xb00 +#define rPdp_AntA_4 0xb04 +#define rPdp_AntA_8 0xb08 +#define rPdp_AntA_C 0xb0c +#define rPdp_AntA_10 0xb10 +#define rPdp_AntA_14 0xb14 +#define rPdp_AntA_18 0xb18 +#define rPdp_AntA_1C 0xb1c +#define rPdp_AntA_20 0xb20 +#define rPdp_AntA_24 0xb24 + +#define rConfig_Pmpd_AntA 0xb28 +#define rConfig_ram64x16 0xb2c + +#define rBndA 0xb30 +#define rHssiPar 0xb34 + +#define rConfig_AntA 0xb68 +#define rConfig_AntB 0xb6c + +#define rPdp_AntB 0xb70 +#define rPdp_AntB_4 0xb74 +#define rPdp_AntB_8 0xb78 +#define rPdp_AntB_C 0xb7c +#define rPdp_AntB_10 0xb80 +#define rPdp_AntB_14 0xb84 +#define rPdp_AntB_18 0xb88 +#define rPdp_AntB_1C 0xb8c +#define rPdp_AntB_20 0xb90 +#define rPdp_AntB_24 0xb94 + +#define rConfig_Pmpd_AntB 0xb98 + +#define rBndB 0xba0 + +#define rAPK 0xbd8 +#define rPm_Rx0_AntA 0xbdc +#define rPm_Rx1_AntA 0xbe0 +#define rPm_Rx2_AntA 0xbe4 +#define rPm_Rx3_AntA 0xbe8 +#define rPm_Rx0_AntB 0xbec +#define rPm_Rx1_AntB 0xbf0 +#define rPm_Rx2_AntB 0xbf4 +#define rPm_Rx3_AntB 0xbf8 + +#endif diff --git a/include/Hal8723PwrSeq.h b/include/Hal8723PwrSeq.h index ab1c32a..3ac16a4 100755 --- a/include/Hal8723PwrSeq.h +++ b/include/Hal8723PwrSeq.h @@ -1,171 +1,170 @@ -#ifndef __HAL8723PWRSEQ_H__ -#define __HAL8723PWRSEQ_H__ -/* - Check document WM-20110607-Paul-RTL8723A_Power_Architecture-R02.vsd - There are 6 HW Power States: - 0: POFF--Power Off - 1: PDN--Power Down - 2: CARDEMU--Card Emulation - 3: ACT--Active Mode - 4: LPS--Low Power State - 5: SUS--Suspend - - The transision from different states are defined below - TRANS_CARDEMU_TO_ACT - TRANS_ACT_TO_CARDEMU - TRANS_CARDEMU_TO_SUS - TRANS_SUS_TO_CARDEMU - TRANS_CARDEMU_TO_PDN - TRANS_ACT_TO_LPS - TRANS_LPS_TO_ACT - - TRANS_END -*/ -#include "HalPwrSeqCmd.h" -#include "rtl8723a_spec.h" - -#define RTL8723A_TRANS_CARDEMU_TO_ACT_STEPS 15 -#define RTL8723A_TRANS_ACT_TO_CARDEMU_STEPS 15 -#define RTL8723A_TRANS_CARDEMU_TO_SUS_STEPS 15 -#define RTL8723A_TRANS_SUS_TO_CARDEMU_STEPS 15 -#define RTL8723A_TRANS_CARDEMU_TO_PDN_STEPS 15 -#define RTL8723A_TRANS_PDN_TO_CARDEMU_STEPS 15 -#define RTL8723A_TRANS_ACT_TO_LPS_STEPS 15 -#define RTL8723A_TRANS_LPS_TO_ACT_STEPS 15 -#define RTL8723A_TRANS_END_STEPS 1 - - -#define RTL8723A_TRANS_CARDEMU_TO_ACT \ - /* format */ \ - /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \ - {0x0020, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK|PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, BIT0}, /*0x20[0] = 1b'1 enable LDOA12 MACRO block for all interface*/ \ - {0x0067, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK|PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT4, 0}, /*0x67[0] = 0 to disable BT_GPS_SEL pins*/ \ - {0x0001, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK|PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_DELAY, 1, PWRSEQ_DELAY_MS},/*Delay 1ms*/ \ - {0x0000, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK|PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT5, 0}, /*0x00[5] = 1b'0 release analog Ips to digital ,1:isolation*/ \ - {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT2, 0},/* disable SW LPS 0x04[10]=0*/ \ - {0x0006, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_POLLING, BIT1, BIT1},/* wait till 0x04[17] = 1 power ready*/ \ - {0x0006, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, BIT0},/* release WLON reset 0x04[16]=1*/ \ - {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT7, 0},/* disable HWPDN 0x04[15]=0*/ \ - {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, (BIT4|BIT3), 0},/* disable WL suspend*/ \ - {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, BIT0},/* polling until return 0*/ \ - {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_POLLING, BIT0, 0},/**/ \ - {0x004E, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT7, 1},/*0x4C[23] = 0x4E[7] = 1, switch DPDT_SEL_P output from WL BB */\ - -#define RTL8723A_TRANS_ACT_TO_CARDEMU \ - /* format */ \ - /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \ - {0x001F, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0},/*0x1F[7:0] = 0 turn off RF*/ \ - {0x004E, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT7, 0},/*0x4C[23] = 0x4E[7] = 0, switch DPDT_SEL_P output from register 0x65[2] */\ - {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT1, BIT1}, /*0x04[9] = 1 turn off MAC by HW state machine*/ \ - {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_POLLING, BIT1, 0}, /*wait till 0x04[9] = 0 polling until return 0 to disable*/ \ - {0x0000, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK|PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT5, BIT5}, /*0x00[5] = 1b'1 analog Ips to digital ,1:isolation*/ \ - {0x0020, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK|PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, 0}, /*0x20[0] = 1b'0 disable LDOA12 MACRO block*/ \ - - -#define RTL8723A_TRANS_CARDEMU_TO_SUS \ - /* format */ \ - /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \ - {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_PCI_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT4|BIT3, (BIT4|BIT3)}, /*0x04[12:11] = 2b'11 enable WL suspend for PCIe*/ \ - {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK|PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT3|BIT4, BIT3}, /*0x04[12:11] = 2b'01 enable WL suspend*/ \ - {0x0023, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT4, BIT4}, /*0x23[4] = 1b'1 12H LDO enter sleep mode*/ \ - {0x0007, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0x20}, /*0x07[7:0] = 0x20 SDIO SOP option to disable BG/MB/ACK/SWR*/ \ - {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_PCI_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT3|BIT4, BIT3|BIT4}, /*0x04[12:11] = 2b'11 enable WL suspend for PCIe*/ \ - {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_SDIO,PWR_CMD_WRITE, BIT0, BIT0}, /*Set SDIO suspend local register*/ \ - {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_SDIO,PWR_CMD_POLLING, BIT1, 0}, /*wait power state to suspend*/ - -#define RTL8723A_TRANS_SUS_TO_CARDEMU \ - /* format */ \ - /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \ - {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT3 | BIT7, 0}, /*clear suspend enable and power down enable*/ \ - {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_SDIO,PWR_CMD_WRITE, BIT0, 0}, /*Set SDIO suspend local register*/ \ - {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_SDIO,PWR_CMD_POLLING, BIT1, BIT1}, /*wait power state to suspend*/\ - {0x0023, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT4, 0}, /*0x23[4] = 1b'0 12H LDO enter normal mode*/ \ - {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT3|BIT4, 0}, /*0x04[12:11] = 2b'01enable WL suspend*/ - -#define RTL8723A_TRANS_CARDEMU_TO_CARDDIS \ - /* format */ \ - /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \ - {0x0007, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0x20}, /*0x07=0x20 , SOP option to disable BG/MB*/ \ - {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK|PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT3|BIT4, BIT3}, /*0x04[12:11] = 2b'01 enable WL suspend*/ \ - {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_PCI_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT2, BIT2}, /*0x04[10] = 1, enable SW LPS*/ \ - {0x004A, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, 1}, /*0x48[16] = 1 to enable GPIO9 as EXT WAKEUP*/ \ - {0x0023, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT4, BIT4}, /*0x23[4] = 1b'1 12H LDO enter sleep mode*/ \ - {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_SDIO,PWR_CMD_WRITE, BIT0, BIT0}, /*Set SDIO suspend local register*/ \ - {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_SDIO,PWR_CMD_POLLING, BIT1, 0}, /*wait power state to suspend*/ - -#define RTL8723A_TRANS_CARDDIS_TO_CARDEMU \ - /* format */ \ - /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \ - {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT3 | BIT7, 0}, /*clear suspend enable and power down enable*/ \ - {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_SDIO,PWR_CMD_WRITE, BIT0, 0}, /*Set SDIO suspend local register*/ \ - {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_SDIO,PWR_CMD_POLLING, BIT1, BIT1}, /*wait power state to suspend*/\ - {0x004A, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, 0}, /*0x48[16] = 0 to disable GPIO9 as EXT WAKEUP*/ \ - {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT3|BIT4, 0}, /*0x04[12:11] = 2b'01enable WL suspend*/\ - {0x0023, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT4, 0}, /*0x23[4] = 1b'0 12H LDO enter normal mode*/ \ - {0x0301, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_PCI_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0},/*PCIe DMA start*/ - - -#define RTL8723A_TRANS_CARDEMU_TO_PDN \ - /* format */ \ - /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \ - {0x0023, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT4, BIT4}, /*0x23[4] = 1b'1 12H LDO enter sleep mode*/ \ - {0x0007, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK|PWR_INTF_USB_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0x20}, /*0x07[7:0] = 0x20 SOP option to disable BG/MB/ACK/SWR*/ \ - {0x0006, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, 0},/* 0x04[16] = 0*/\ - {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT7, BIT7},/* 0x04[15] = 1*/ - -#define RTL8723A_TRANS_PDN_TO_CARDEMU \ - /* format */ \ - /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \ - {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT7, 0},/* 0x04[15] = 0*/ - -#define RTL8723A_TRANS_ACT_TO_LPS \ - /* format */ \ - /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \ - {0x0301, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_PCI_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0xFF},/*PCIe DMA stop*/ \ - {0x0522, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0xFF},/*Tx Pause*/ \ - {0x05F8, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_POLLING, 0xFF, 0},/*Should be zero if no packet is transmitting*/ \ - {0x05F9, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_POLLING, 0xFF, 0},/*Should be zero if no packet is transmitting*/ \ - {0x05FA, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_POLLING, 0xFF, 0},/*Should be zero if no packet is transmitting*/ \ - {0x05FB, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_POLLING, 0xFF, 0},/*Should be zero if no packet is transmitting*/ \ - {0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, 0},/*CCK and OFDM are disabled,and clock are gated*/ \ - {0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_DELAY, 0, PWRSEQ_DELAY_US},/*Delay 1us*/ \ - {0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT1, 0},/*Whole BB is reset*/ \ - {0x0100, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0x03},/*Reset MAC TRX*/ \ - {0x0101, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT1, 0},/*check if removed later*/ \ - {0x0093, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0x00},/*When driver enter Sus/ Disable, enable LOP for BT*/ \ - {0x0553, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT5, BIT5},/*Respond TxOK to scheduler*/ \ - - -#define RTL8723A_TRANS_LPS_TO_ACT \ - /* format */ \ - /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \ - {0x0080, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_SDIO,PWR_CMD_WRITE, 0xFF, 0x84}, /*SDIO RPWM*/\ - {0xFE58, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0x84}, /*USB RPWM*/\ - {0x0361, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_PCI_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0x84}, /*PCIe RPWM*/\ - {0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_DELAY, 0, PWRSEQ_DELAY_MS}, /*Delay*/\ - {0x0008, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT4, 0}, /*. 0x08[4] = 0 switch TSF to 40M*/\ - {0x0109, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_POLLING, BIT7, 0}, /*Polling 0x109[7]=0 TSF in 40M*/\ - {0x0029, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT6|BIT7, 0}, /*. 0x29[7:6] = 2b'00 enable BB clock*/\ - {0x0101, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT1, BIT1}, /*. 0x101[1] = 1*/\ - {0x0100, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0xFF}, /*. 0x100[7:0] = 0xFF enable WMAC TRX*/\ - {0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT1|BIT0, BIT1|BIT0}, /*. 0x02[1:0] = 2b'11 enable BB macro*/\ - {0x0522, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0}, /*. 0x522 = 0*/ - -#define RTL8723A_TRANS_END \ - /* format */ \ - /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \ - {0xFFFF, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,0,PWR_CMD_END, 0, 0}, // - - -extern WLAN_PWR_CFG rtl8723A_power_on_flow[RTL8723A_TRANS_CARDEMU_TO_ACT_STEPS+RTL8723A_TRANS_END_STEPS]; -extern WLAN_PWR_CFG rtl8723A_radio_off_flow[RTL8723A_TRANS_ACT_TO_CARDEMU_STEPS+RTL8723A_TRANS_END_STEPS]; -extern WLAN_PWR_CFG rtl8723A_card_disable_flow[RTL8723A_TRANS_ACT_TO_CARDEMU_STEPS+RTL8723A_TRANS_CARDEMU_TO_PDN_STEPS+RTL8723A_TRANS_END_STEPS]; -extern WLAN_PWR_CFG rtl8723A_card_enable_flow[RTL8723A_TRANS_ACT_TO_CARDEMU_STEPS+RTL8723A_TRANS_CARDEMU_TO_PDN_STEPS+RTL8723A_TRANS_END_STEPS]; -extern WLAN_PWR_CFG rtl8723A_suspend_flow[RTL8723A_TRANS_ACT_TO_CARDEMU_STEPS+RTL8723A_TRANS_CARDEMU_TO_SUS_STEPS+RTL8723A_TRANS_END_STEPS]; -extern WLAN_PWR_CFG rtl8723A_resume_flow[RTL8723A_TRANS_ACT_TO_CARDEMU_STEPS+RTL8723A_TRANS_CARDEMU_TO_SUS_STEPS+RTL8723A_TRANS_END_STEPS]; -extern WLAN_PWR_CFG rtl8723A_hwpdn_flow[RTL8723A_TRANS_ACT_TO_CARDEMU_STEPS+RTL8723A_TRANS_CARDEMU_TO_PDN_STEPS+RTL8723A_TRANS_END_STEPS]; -extern WLAN_PWR_CFG rtl8723A_enter_lps_flow[RTL8723A_TRANS_ACT_TO_LPS_STEPS+RTL8723A_TRANS_END_STEPS]; -extern WLAN_PWR_CFG rtl8723A_leave_lps_flow[RTL8723A_TRANS_LPS_TO_ACT_STEPS+RTL8723A_TRANS_END_STEPS]; - -#endif - +#ifndef __HAL8723PWRSEQ_H__ +#define __HAL8723PWRSEQ_H__ +/* + Check document WM-20110607-Paul-RTL8723A_Power_Architecture-R02.vsd + There are 6 HW Power States: + 0: POFF--Power Off + 1: PDN--Power Down + 2: CARDEMU--Card Emulation + 3: ACT--Active Mode + 4: LPS--Low Power State + 5: SUS--Suspend + + The transision from different states are defined below + TRANS_CARDEMU_TO_ACT + TRANS_ACT_TO_CARDEMU + TRANS_CARDEMU_TO_SUS + TRANS_SUS_TO_CARDEMU + TRANS_CARDEMU_TO_PDN + TRANS_ACT_TO_LPS + TRANS_LPS_TO_ACT + + TRANS_END +*/ +#include "HalPwrSeqCmd.h" +#include "rtl8723a_spec.h" + +#define RTL8723A_TRANS_CARDEMU_TO_ACT_STEPS 15 +#define RTL8723A_TRANS_ACT_TO_CARDEMU_STEPS 15 +#define RTL8723A_TRANS_CARDEMU_TO_SUS_STEPS 15 +#define RTL8723A_TRANS_SUS_TO_CARDEMU_STEPS 15 +#define RTL8723A_TRANS_CARDEMU_TO_PDN_STEPS 15 +#define RTL8723A_TRANS_PDN_TO_CARDEMU_STEPS 15 +#define RTL8723A_TRANS_ACT_TO_LPS_STEPS 15 +#define RTL8723A_TRANS_LPS_TO_ACT_STEPS 15 +#define RTL8723A_TRANS_END_STEPS 1 + + +#define RTL8723A_TRANS_CARDEMU_TO_ACT \ + /* format */ \ + /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \ + {0x0020, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK|PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, BIT0}, /*0x20[0] = 1b'1 enable LDOA12 MACRO block for all interface*/ \ + {0x0067, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK|PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT4, 0}, /*0x67[0] = 0 to disable BT_GPS_SEL pins*/ \ + {0x0001, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK|PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_DELAY, 1, PWRSEQ_DELAY_MS},/*Delay 1ms*/ \ + {0x0000, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK|PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT5, 0}, /*0x00[5] = 1b'0 release analog Ips to digital ,1:isolation*/ \ + {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT2, 0},/* disable SW LPS 0x04[10]=0*/ \ + {0x0006, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_POLLING, BIT1, BIT1},/* wait till 0x04[17] = 1 power ready*/ \ + {0x0006, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, BIT0},/* release WLON reset 0x04[16]=1*/ \ + {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT7, 0},/* disable HWPDN 0x04[15]=0*/ \ + {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, (BIT4|BIT3), 0},/* disable WL suspend*/ \ + {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, BIT0},/* polling until return 0*/ \ + {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_POLLING, BIT0, 0},/**/ \ + {0x004E, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT7, 1},/*0x4C[23] = 0x4E[7] = 1, switch DPDT_SEL_P output from WL BB */\ + +#define RTL8723A_TRANS_ACT_TO_CARDEMU \ + /* format */ \ + /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \ + {0x001F, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0},/*0x1F[7:0] = 0 turn off RF*/ \ + {0x004E, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT7, 0},/*0x4C[23] = 0x4E[7] = 0, switch DPDT_SEL_P output from register 0x65[2] */\ + {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT1, BIT1}, /*0x04[9] = 1 turn off MAC by HW state machine*/ \ + {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_POLLING, BIT1, 0}, /*wait till 0x04[9] = 0 polling until return 0 to disable*/ \ + {0x0000, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK|PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT5, BIT5}, /*0x00[5] = 1b'1 analog Ips to digital ,1:isolation*/ \ + {0x0020, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK|PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, 0}, /*0x20[0] = 1b'0 disable LDOA12 MACRO block*/ \ + + +#define RTL8723A_TRANS_CARDEMU_TO_SUS \ + /* format */ \ + /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \ + {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_PCI_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT4|BIT3, (BIT4|BIT3)}, /*0x04[12:11] = 2b'11 enable WL suspend for PCIe*/ \ + {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK|PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT3|BIT4, BIT3}, /*0x04[12:11] = 2b'01 enable WL suspend*/ \ + {0x0023, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT4, BIT4}, /*0x23[4] = 1b'1 12H LDO enter sleep mode*/ \ + {0x0007, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0x20}, /*0x07[7:0] = 0x20 SDIO SOP option to disable BG/MB/ACK/SWR*/ \ + {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_PCI_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT3|BIT4, BIT3|BIT4}, /*0x04[12:11] = 2b'11 enable WL suspend for PCIe*/ \ + {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_SDIO,PWR_CMD_WRITE, BIT0, BIT0}, /*Set SDIO suspend local register*/ \ + {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_SDIO,PWR_CMD_POLLING, BIT1, 0}, /*wait power state to suspend*/ + +#define RTL8723A_TRANS_SUS_TO_CARDEMU \ + /* format */ \ + /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \ + {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT3 | BIT7, 0}, /*clear suspend enable and power down enable*/ \ + {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_SDIO,PWR_CMD_WRITE, BIT0, 0}, /*Set SDIO suspend local register*/ \ + {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_SDIO,PWR_CMD_POLLING, BIT1, BIT1}, /*wait power state to suspend*/\ + {0x0023, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT4, 0}, /*0x23[4] = 1b'0 12H LDO enter normal mode*/ \ + {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT3|BIT4, 0}, /*0x04[12:11] = 2b'01enable WL suspend*/ + +#define RTL8723A_TRANS_CARDEMU_TO_CARDDIS \ + /* format */ \ + /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \ + {0x0007, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0x20}, /*0x07=0x20 , SOP option to disable BG/MB*/ \ + {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK|PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT3|BIT4, BIT3}, /*0x04[12:11] = 2b'01 enable WL suspend*/ \ + {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_PCI_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT2, BIT2}, /*0x04[10] = 1, enable SW LPS*/ \ + {0x004A, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, 1}, /*0x48[16] = 1 to enable GPIO9 as EXT WAKEUP*/ \ + {0x0023, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT4, BIT4}, /*0x23[4] = 1b'1 12H LDO enter sleep mode*/ \ + {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_SDIO,PWR_CMD_WRITE, BIT0, BIT0}, /*Set SDIO suspend local register*/ \ + {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_SDIO,PWR_CMD_POLLING, BIT1, 0}, /*wait power state to suspend*/ + +#define RTL8723A_TRANS_CARDDIS_TO_CARDEMU \ + /* format */ \ + /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \ + {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT3 | BIT7, 0}, /*clear suspend enable and power down enable*/ \ + {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_SDIO,PWR_CMD_WRITE, BIT0, 0}, /*Set SDIO suspend local register*/ \ + {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_SDIO,PWR_CMD_POLLING, BIT1, BIT1}, /*wait power state to suspend*/\ + {0x004A, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, 0}, /*0x48[16] = 0 to disable GPIO9 as EXT WAKEUP*/ \ + {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT3|BIT4, 0}, /*0x04[12:11] = 2b'01enable WL suspend*/\ + {0x0023, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT4, 0}, /*0x23[4] = 1b'0 12H LDO enter normal mode*/ \ + {0x0301, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_PCI_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0},/*PCIe DMA start*/ + + +#define RTL8723A_TRANS_CARDEMU_TO_PDN \ + /* format */ \ + /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \ + {0x0023, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT4, BIT4}, /*0x23[4] = 1b'1 12H LDO enter sleep mode*/ \ + {0x0007, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK|PWR_INTF_USB_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0x20}, /*0x07[7:0] = 0x20 SOP option to disable BG/MB/ACK/SWR*/ \ + {0x0006, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, 0},/* 0x04[16] = 0*/\ + {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT7, BIT7},/* 0x04[15] = 1*/ + +#define RTL8723A_TRANS_PDN_TO_CARDEMU \ + /* format */ \ + /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \ + {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT7, 0},/* 0x04[15] = 0*/ + +#define RTL8723A_TRANS_ACT_TO_LPS \ + /* format */ \ + /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \ + {0x0301, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_PCI_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0xFF},/*PCIe DMA stop*/ \ + {0x0522, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0xFF},/*Tx Pause*/ \ + {0x05F8, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_POLLING, 0xFF, 0},/*Should be zero if no packet is transmitting*/ \ + {0x05F9, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_POLLING, 0xFF, 0},/*Should be zero if no packet is transmitting*/ \ + {0x05FA, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_POLLING, 0xFF, 0},/*Should be zero if no packet is transmitting*/ \ + {0x05FB, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_POLLING, 0xFF, 0},/*Should be zero if no packet is transmitting*/ \ + {0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, 0},/*CCK and OFDM are disabled,and clock are gated*/ \ + {0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_DELAY, 0, PWRSEQ_DELAY_US},/*Delay 1us*/ \ + {0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT1, 0},/*Whole BB is reset*/ \ + {0x0100, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0x03},/*Reset MAC TRX*/ \ + {0x0101, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT1, 0},/*check if removed later*/ \ + {0x0093, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0x00},/*When driver enter Sus/ Disable, enable LOP for BT*/ \ + {0x0553, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT5, BIT5},/*Respond TxOK to scheduler*/ \ + + +#define RTL8723A_TRANS_LPS_TO_ACT \ + /* format */ \ + /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \ + {0x0080, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,PWR_BASEADDR_SDIO,PWR_CMD_WRITE, 0xFF, 0x84}, /*SDIO RPWM*/\ + {0xFE58, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0x84}, /*USB RPWM*/\ + {0x0361, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_PCI_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0x84}, /*PCIe RPWM*/\ + {0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_DELAY, 0, PWRSEQ_DELAY_MS}, /*Delay*/\ + {0x0008, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT4, 0}, /*. 0x08[4] = 0 switch TSF to 40M*/\ + {0x0109, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_POLLING, BIT7, 0}, /*Polling 0x109[7]=0 TSF in 40M*/\ + {0x0029, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT6|BIT7, 0}, /*. 0x29[7:6] = 2b'00 enable BB clock*/\ + {0x0101, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT1, BIT1}, /*. 0x101[1] = 1*/\ + {0x0100, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0xFF}, /*. 0x100[7:0] = 0xFF enable WMAC TRX*/\ + {0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT1|BIT0, BIT1|BIT0}, /*. 0x02[1:0] = 2b'11 enable BB macro*/\ + {0x0522, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0}, /*. 0x522 = 0*/ + +#define RTL8723A_TRANS_END \ + /* format */ \ + /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \ + {0xFFFF, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,0,PWR_CMD_END, 0, 0}, // + + +extern WLAN_PWR_CFG rtl8723A_power_on_flow[RTL8723A_TRANS_CARDEMU_TO_ACT_STEPS+RTL8723A_TRANS_END_STEPS]; +extern WLAN_PWR_CFG rtl8723A_radio_off_flow[RTL8723A_TRANS_ACT_TO_CARDEMU_STEPS+RTL8723A_TRANS_END_STEPS]; +extern WLAN_PWR_CFG rtl8723A_card_disable_flow[RTL8723A_TRANS_ACT_TO_CARDEMU_STEPS+RTL8723A_TRANS_CARDEMU_TO_PDN_STEPS+RTL8723A_TRANS_END_STEPS]; +extern WLAN_PWR_CFG rtl8723A_card_enable_flow[RTL8723A_TRANS_ACT_TO_CARDEMU_STEPS+RTL8723A_TRANS_CARDEMU_TO_PDN_STEPS+RTL8723A_TRANS_END_STEPS]; +extern WLAN_PWR_CFG rtl8723A_suspend_flow[RTL8723A_TRANS_ACT_TO_CARDEMU_STEPS+RTL8723A_TRANS_CARDEMU_TO_SUS_STEPS+RTL8723A_TRANS_END_STEPS]; +extern WLAN_PWR_CFG rtl8723A_resume_flow[RTL8723A_TRANS_ACT_TO_CARDEMU_STEPS+RTL8723A_TRANS_CARDEMU_TO_SUS_STEPS+RTL8723A_TRANS_END_STEPS]; +extern WLAN_PWR_CFG rtl8723A_hwpdn_flow[RTL8723A_TRANS_ACT_TO_CARDEMU_STEPS+RTL8723A_TRANS_CARDEMU_TO_PDN_STEPS+RTL8723A_TRANS_END_STEPS]; +extern WLAN_PWR_CFG rtl8723A_enter_lps_flow[RTL8723A_TRANS_ACT_TO_LPS_STEPS+RTL8723A_TRANS_END_STEPS]; +extern WLAN_PWR_CFG rtl8723A_leave_lps_flow[RTL8723A_TRANS_LPS_TO_ACT_STEPS+RTL8723A_TRANS_END_STEPS]; + +#endif diff --git a/include/HalPwrSeqCmd.h b/include/HalPwrSeqCmd.h index 6709a65..00b8fd3 100755 --- a/include/HalPwrSeqCmd.h +++ b/include/HalPwrSeqCmd.h @@ -1,138 +1,137 @@ -/****************************************************************************** - * - * 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 __HALPWRSEQCMD_H__ -#define __HALPWRSEQCMD_H__ - -#include - -/*---------------------------------------------*/ -//3 The value of cmd: 4 bits -/*---------------------------------------------*/ -#define PWR_CMD_READ 0x00 - // offset: the read register offset - // msk: the mask of the read value - // value: N/A, left by 0 - // note: dirver shall implement this function by read & msk - -#define PWR_CMD_WRITE 0x01 - // offset: the read register offset - // msk: the mask of the write bits - // value: write value - // note: driver shall implement this cmd by read & msk after write - -#define PWR_CMD_POLLING 0x02 - // offset: the read register offset - // msk: the mask of the polled value - // value: the value to be polled, masked by the msd field. - // note: driver shall implement this cmd by - // do{ - // if( (Read(offset) & msk) == (value & msk) ) - // break; - // } while(not timeout); - -#define PWR_CMD_DELAY 0x03 - // offset: the value to delay - // msk: N/A - // value: the unit of delay, 0: us, 1: ms - -#define PWR_CMD_END 0x04 - // offset: N/A - // msk: N/A - // value: N/A - -/*---------------------------------------------*/ -//3 The value of base: 4 bits -/*---------------------------------------------*/ - // define the base address of each block -#define PWR_BASEADDR_MAC 0x00 -#define PWR_BASEADDR_USB 0x01 -#define PWR_BASEADDR_PCIE 0x02 -#define PWR_BASEADDR_SDIO 0x03 - -/*---------------------------------------------*/ -//3 The value of interface_msk: 4 bits -/*---------------------------------------------*/ -#define PWR_INTF_SDIO_MSK BIT(0) -#define PWR_INTF_USB_MSK BIT(1) -#define PWR_INTF_PCI_MSK BIT(2) -#define PWR_INTF_ALL_MSK (BIT(0)|BIT(1)|BIT(2)|BIT(3)) - -/*---------------------------------------------*/ -//3 The value of fab_msk: 4 bits -/*---------------------------------------------*/ -#define PWR_FAB_TSMC_MSK BIT(0) -#define PWR_FAB_UMC_MSK BIT(1) -#define PWR_FAB_ALL_MSK (BIT(0)|BIT(1)|BIT(2)|BIT(3)) - -/*---------------------------------------------*/ -//3 The value of cut_msk: 8 bits -/*---------------------------------------------*/ -#define PWR_CUT_TESTCHIP_MSK BIT(0) -#define PWR_CUT_A_MSK BIT(1) -#define PWR_CUT_B_MSK BIT(2) -#define PWR_CUT_C_MSK BIT(3) -#define PWR_CUT_D_MSK BIT(4) -#define PWR_CUT_E_MSK BIT(5) -#define PWR_CUT_F_MSK BIT(6) -#define PWR_CUT_G_MSK BIT(7) -#define PWR_CUT_ALL_MSK 0xFF - - -typedef enum _PWRSEQ_CMD_DELAY_UNIT_ -{ - PWRSEQ_DELAY_US, - PWRSEQ_DELAY_MS, -} PWRSEQ_DELAY_UNIT; - -typedef struct _WL_PWR_CFG_ -{ - u16 offset; - u8 cut_msk; - u8 fab_msk:4; - u8 interface_msk:4; - u8 base:4; - u8 cmd:4; - u8 msk; - u8 value; -} WLAN_PWR_CFG, *PWLAN_PWR_CFG; - - -#define GET_PWR_CFG_OFFSET(__PWR_CMD) __PWR_CMD.offset -#define GET_PWR_CFG_CUT_MASK(__PWR_CMD) __PWR_CMD.cut_msk -#define GET_PWR_CFG_FAB_MASK(__PWR_CMD) __PWR_CMD.fab_msk -#define GET_PWR_CFG_INTF_MASK(__PWR_CMD) __PWR_CMD.interface_msk -#define GET_PWR_CFG_BASE(__PWR_CMD) __PWR_CMD.base -#define GET_PWR_CFG_CMD(__PWR_CMD) __PWR_CMD.cmd -#define GET_PWR_CFG_MASK(__PWR_CMD) __PWR_CMD.msk -#define GET_PWR_CFG_VALUE(__PWR_CMD) __PWR_CMD.value - - -//================================================================================ -// Prototype of protected function. -//================================================================================ -u8 HalPwrSeqCmdParsing( - struct adapter * padapter, - u8 CutVersion, - u8 FabVersion, - u8 InterfaceType, - WLAN_PWR_CFG PwrCfgCmd[]); - -#endif - +/****************************************************************************** + * + * 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 __HALPWRSEQCMD_H__ +#define __HALPWRSEQCMD_H__ + +#include + +/*---------------------------------------------*/ +//3 The value of cmd: 4 bits +/*---------------------------------------------*/ +#define PWR_CMD_READ 0x00 + // offset: the read register offset + // msk: the mask of the read value + // value: N/A, left by 0 + // note: dirver shall implement this function by read & msk + +#define PWR_CMD_WRITE 0x01 + // offset: the read register offset + // msk: the mask of the write bits + // value: write value + // note: driver shall implement this cmd by read & msk after write + +#define PWR_CMD_POLLING 0x02 + // offset: the read register offset + // msk: the mask of the polled value + // value: the value to be polled, masked by the msd field. + // note: driver shall implement this cmd by + // do{ + // if( (Read(offset) & msk) == (value & msk) ) + // break; + // } while(not timeout); + +#define PWR_CMD_DELAY 0x03 + // offset: the value to delay + // msk: N/A + // value: the unit of delay, 0: us, 1: ms + +#define PWR_CMD_END 0x04 + // offset: N/A + // msk: N/A + // value: N/A + +/*---------------------------------------------*/ +//3 The value of base: 4 bits +/*---------------------------------------------*/ + // define the base address of each block +#define PWR_BASEADDR_MAC 0x00 +#define PWR_BASEADDR_USB 0x01 +#define PWR_BASEADDR_PCIE 0x02 +#define PWR_BASEADDR_SDIO 0x03 + +/*---------------------------------------------*/ +//3 The value of interface_msk: 4 bits +/*---------------------------------------------*/ +#define PWR_INTF_SDIO_MSK BIT(0) +#define PWR_INTF_USB_MSK BIT(1) +#define PWR_INTF_PCI_MSK BIT(2) +#define PWR_INTF_ALL_MSK (BIT(0)|BIT(1)|BIT(2)|BIT(3)) + +/*---------------------------------------------*/ +//3 The value of fab_msk: 4 bits +/*---------------------------------------------*/ +#define PWR_FAB_TSMC_MSK BIT(0) +#define PWR_FAB_UMC_MSK BIT(1) +#define PWR_FAB_ALL_MSK (BIT(0)|BIT(1)|BIT(2)|BIT(3)) + +/*---------------------------------------------*/ +//3 The value of cut_msk: 8 bits +/*---------------------------------------------*/ +#define PWR_CUT_TESTCHIP_MSK BIT(0) +#define PWR_CUT_A_MSK BIT(1) +#define PWR_CUT_B_MSK BIT(2) +#define PWR_CUT_C_MSK BIT(3) +#define PWR_CUT_D_MSK BIT(4) +#define PWR_CUT_E_MSK BIT(5) +#define PWR_CUT_F_MSK BIT(6) +#define PWR_CUT_G_MSK BIT(7) +#define PWR_CUT_ALL_MSK 0xFF + + +typedef enum _PWRSEQ_CMD_DELAY_UNIT_ +{ + PWRSEQ_DELAY_US, + PWRSEQ_DELAY_MS, +} PWRSEQ_DELAY_UNIT; + +typedef struct _WL_PWR_CFG_ +{ + u16 offset; + u8 cut_msk; + u8 fab_msk:4; + u8 interface_msk:4; + u8 base:4; + u8 cmd:4; + u8 msk; + u8 value; +} WLAN_PWR_CFG, *PWLAN_PWR_CFG; + + +#define GET_PWR_CFG_OFFSET(__PWR_CMD) __PWR_CMD.offset +#define GET_PWR_CFG_CUT_MASK(__PWR_CMD) __PWR_CMD.cut_msk +#define GET_PWR_CFG_FAB_MASK(__PWR_CMD) __PWR_CMD.fab_msk +#define GET_PWR_CFG_INTF_MASK(__PWR_CMD) __PWR_CMD.interface_msk +#define GET_PWR_CFG_BASE(__PWR_CMD) __PWR_CMD.base +#define GET_PWR_CFG_CMD(__PWR_CMD) __PWR_CMD.cmd +#define GET_PWR_CFG_MASK(__PWR_CMD) __PWR_CMD.msk +#define GET_PWR_CFG_VALUE(__PWR_CMD) __PWR_CMD.value + + +//================================================================================ +// Prototype of protected function. +//================================================================================ +u8 HalPwrSeqCmdParsing( + struct adapter * padapter, + u8 CutVersion, + u8 FabVersion, + u8 InterfaceType, + WLAN_PWR_CFG PwrCfgCmd[]); + +#endif diff --git a/include/HalVerDef.h b/include/HalVerDef.h index 204c3ac..fe09740 100755 --- a/include/HalVerDef.h +++ b/include/HalVerDef.h @@ -1,7 +1,7 @@ /****************************************************************************** * * 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. @@ -20,60 +20,60 @@ #ifndef __HAL_VERSION_DEF_H__ #define __HAL_VERSION_DEF_H__ -#define TRUE _TRUE +#define TRUE _TRUE #define FALSE _FALSE // HAL_IC_TYPE_E typedef enum tag_HAL_IC_Type_Definition { - CHIP_8192S = 0, - CHIP_8188C = 1, - CHIP_8192C = 2, - CHIP_8192D = 3, - CHIP_8723A = 4, - CHIP_8188E = 5, - CHIP_8881A = 6, - CHIP_8812A = 7, - CHIP_8821A = 8, - CHIP_8723B = 9, - CHIP_8192E = 10, + CHIP_8192S = 0, + CHIP_8188C = 1, + CHIP_8192C = 2, + CHIP_8192D = 3, + CHIP_8723A = 4, + CHIP_8188E = 5, + CHIP_8881A = 6, + CHIP_8812A = 7, + CHIP_8821A = 8, + CHIP_8723B = 9, + CHIP_8192E = 10, }HAL_IC_TYPE_E; //HAL_CHIP_TYPE_E typedef enum tag_HAL_CHIP_Type_Definition { - TEST_CHIP = 0, - NORMAL_CHIP = 1, + TEST_CHIP = 0, + NORMAL_CHIP = 1, FPGA = 2, }HAL_CHIP_TYPE_E; //HAL_CUT_VERSION_E typedef enum tag_HAL_Cut_Version_Definition { - A_CUT_VERSION = 0, - B_CUT_VERSION = 1, - C_CUT_VERSION = 2, - D_CUT_VERSION = 3, - E_CUT_VERSION = 4, - F_CUT_VERSION = 5, - G_CUT_VERSION = 6, - H_CUT_VERSION = 7, - I_CUT_VERSION = 8, - J_CUT_VERSION = 9, - K_CUT_VERSION = 10, + A_CUT_VERSION = 0, + B_CUT_VERSION = 1, + C_CUT_VERSION = 2, + D_CUT_VERSION = 3, + E_CUT_VERSION = 4, + F_CUT_VERSION = 5, + G_CUT_VERSION = 6, + H_CUT_VERSION = 7, + I_CUT_VERSION = 8, + J_CUT_VERSION = 9, + K_CUT_VERSION = 10, }HAL_CUT_VERSION_E; // HAL_Manufacturer typedef enum tag_HAL_Manufacturer_Version_Definition { - CHIP_VENDOR_TSMC = 0, - CHIP_VENDOR_UMC = 1, + CHIP_VENDOR_TSMC = 0, + CHIP_VENDOR_UMC = 1, }HAL_VENDOR_E; typedef enum tag_HAL_RF_Type_Definition { - RF_TYPE_1T1R = 0, - RF_TYPE_1T2R = 1, + RF_TYPE_1T1R = 0, + RF_TYPE_1T2R = 1, RF_TYPE_2T2R = 2, RF_TYPE_2T3R = 3, RF_TYPE_2T4R = 4, @@ -88,7 +88,7 @@ typedef struct tag_HAL_VERSION HAL_CHIP_TYPE_E ChipType; HAL_CUT_VERSION_E CUTVersion; HAL_VENDOR_E VendorType; - HAL_RF_TYPE_E RFType; + HAL_RF_TYPE_E RFType; u8 ROMVer; }HAL_VERSION,*PHAL_VERSION; @@ -145,7 +145,7 @@ typedef struct tag_HAL_VERSION //---------------------------------------------------------------------------- #define IS_81XXC_TEST_CHIP(version) ((IS_81XXC(version) && (!IS_NORMAL_CHIP(version)))? TRUE: FALSE) -#define IS_92C_SERIAL(version) ((IS_81XXC(version) && IS_2T2R(version)) ? TRUE : FALSE) +#define IS_92C_SERIAL(version) ((IS_81XXC(version) && IS_2T2R(version)) ? TRUE : FALSE) #define IS_81xxC_VENDOR_UMC_A_CUT(version) (IS_81XXC(version)?(IS_CHIP_VENDOR_UMC(version) ? (IS_A_CUT(version) ? TRUE : FALSE) : FALSE): FALSE) #define IS_81xxC_VENDOR_UMC_B_CUT(version) (IS_81XXC(version)?(IS_CHIP_VENDOR_UMC(version) ? (IS_B_CUT(version) ? TRUE : FALSE) : FALSE): FALSE) #define IS_81xxC_VENDOR_UMC_C_CUT(version) (IS_81XXC(version)?(IS_CHIP_VENDOR_UMC(version) ? (IS_C_CUT(version) ? TRUE : FALSE) : FALSE): FALSE) @@ -161,4 +161,3 @@ typedef struct tag_HAL_VERSION #define IS_8723A_B_CUT(version) ((IS_8723_SERIES(version)) ? ( IS_B_CUT(version)?TRUE : FALSE) : FALSE) #endif - diff --git a/include/autoconf.h b/include/autoconf.h index 0620005..df53fdf 100755 --- a/include/autoconf.h +++ b/include/autoconf.h @@ -1,7 +1,7 @@ /****************************************************************************** * * 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. @@ -35,20 +35,20 @@ #define RTL871X_MODULE_NAME "88EU" #define DRV_NAME "rtl8188eu" -#define CONFIG_USB_HCI +#define CONFIG_USB_HCI -#define CONFIG_RTL8188E +#define CONFIG_RTL8188E #if defined(CONFIG_PLATFORM_ACTIONS_ATM702X) - #ifndef CONFIG_IOCTL_CFG80211 - #define CONFIG_IOCTL_CFG80211 + #ifndef CONFIG_IOCTL_CFG80211 + #define CONFIG_IOCTL_CFG80211 #endif #endif #ifdef CONFIG_IOCTL_CFG80211 //#define RTW_USE_CFG80211_STA_EVENT /* Indecate new sta asoc through cfg80211_new_sta */ #define CONFIG_CFG80211_FORCE_COMPATIBLE_2_6_37_UNDER - //#define CONFIG_DEBUG_CFG80211 + //#define CONFIG_DEBUG_CFG80211 //#define CONFIG_DRV_ISSUE_PROV_REQ // IOT FOR S2 #define CONFIG_SET_SCAN_DENY_TIMER @@ -60,37 +60,37 @@ //#define CONFIG_H2CLBK -#define CONFIG_EMBEDDED_FWIMG +#define CONFIG_EMBEDDED_FWIMG //#define CONFIG_FILE_FWIMG #define CONFIG_XMIT_ACK #ifdef CONFIG_XMIT_ACK #define CONFIG_ACTIVE_KEEP_ALIVE_CHECK #endif -#define CONFIG_80211N_HT +#define CONFIG_80211N_HT -#define CONFIG_RECV_REORDERING_CTRL +#define CONFIG_RECV_REORDERING_CTRL -//#define CONFIG_TCP_CSUM_OFFLOAD_RX +//#define CONFIG_TCP_CSUM_OFFLOAD_RX -//#define CONFIG_DRVEXT_MODULE +//#define CONFIG_DRVEXT_MODULE #define CONFIG_SUPPORT_USB_INT #ifdef CONFIG_SUPPORT_USB_INT -//#define CONFIG_USB_INTERRUPT_IN_PIPE +//#define CONFIG_USB_INTERRUPT_IN_PIPE #endif - #define CONFIG_IPS + #define CONFIG_IPS #ifdef CONFIG_IPS //#define CONFIG_IPS_LEVEL_2 //enable this to set default IPS mode to IPS_LEVEL_2 #endif - #define SUPPORT_HW_RFOFF_DETECTED + #define SUPPORT_HW_RFOFF_DETECTED - #define CONFIG_LPS + #define CONFIG_LPS #if defined(CONFIG_LPS) && defined(CONFIG_SUPPORT_USB_INT) - //#define CONFIG_LPS_LCLK + //#define CONFIG_LPS_LCLK #endif #ifdef CONFIG_LPS_LCLK @@ -101,21 +101,21 @@ #define CONFIG_ANTENNA_DIVERSITY //after link - #ifdef CONFIG_ANTENNA_DIVERSITY - #define CONFIG_HW_ANTENNA_DIVERSITY + #ifdef CONFIG_ANTENNA_DIVERSITY + #define CONFIG_HW_ANTENNA_DIVERSITY #endif - //#define CONFIG_CONCURRENT_MODE + //#define CONFIG_CONCURRENT_MODE #ifdef CONFIG_CONCURRENT_MODE //#define CONFIG_HWPORT_SWAP //Port0->Sec , Port1 -> Pri //#define CONFIG_STA_MODE_SCAN_UNDER_AP_MODE - #define CONFIG_TSF_RESET_OFFLOAD // For 2 PORT TSF SYNC. + #define CONFIG_TSF_RESET_OFFLOAD // For 2 PORT TSF SYNC. #endif #define CONFIG_IOL -#define CONFIG_AP_MODE +#define CONFIG_AP_MODE #ifdef CONFIG_AP_MODE //#define CONFIG_INTERRUPT_BASED_TXBCN // Tx Beacon when driver BCN_OK ,BCN_ERR interrupt occurs #if defined(CONFIG_CONCURRENT_MODE) && defined(CONFIG_INTERRUPT_BASED_TXBCN) @@ -123,22 +123,22 @@ #endif #ifdef CONFIG_INTERRUPT_BASED_TXBCN //#define CONFIG_INTERRUPT_BASED_TXBCN_EARLY_INT - #define CONFIG_INTERRUPT_BASED_TXBCN_BCN_OK_ERR + #define CONFIG_INTERRUPT_BASED_TXBCN_BCN_OK_ERR #endif - + #define CONFIG_NATIVEAP_MLME #ifndef CONFIG_NATIVEAP_MLME - #define CONFIG_HOSTAPD_MLME - #endif - #define CONFIG_FIND_BEST_CHANNEL - //#define CONFIG_NO_WIRELESS_HANDLERS + #define CONFIG_HOSTAPD_MLME + #endif + #define CONFIG_FIND_BEST_CHANNEL + //#define CONFIG_NO_WIRELESS_HANDLERS #endif -#define CONFIG_P2P +#define CONFIG_P2P #ifdef CONFIG_P2P //The CONFIG_WFD is for supporting the Wi-Fi display #define CONFIG_WFD - + #ifndef CONFIG_WIFI_TEST #define CONFIG_P2P_REMOVE_GROUP_INFO #endif @@ -150,13 +150,13 @@ #endif // Added by Kurt 20110511 -//#define CONFIG_TDLS +//#define CONFIG_TDLS #ifdef CONFIG_TDLS // #ifndef CONFIG_WFD -// #define CONFIG_WFD +// #define CONFIG_WFD // #endif -// #define CONFIG_TDLS_AUTOSETUP -// #define CONFIG_TDLS_AUTOCHECKALIVE +// #define CONFIG_TDLS_AUTOSETUP +// #define CONFIG_TDLS_AUTOCHECKALIVE #endif @@ -175,9 +175,9 @@ #define CONFIG_IOL_READ_EFUSE_MAP //#define DBG_IOL_READ_EFUSE_MAP //#define CONFIG_IOL_LLT - #define CONFIG_IOL_EFUSE_PATCH + #define CONFIG_IOL_EFUSE_PATCH //#define CONFIG_IOL_IOREG_CFG - //#define CONFIG_IOL_IOREG_CFG_DBG + //#define CONFIG_IOL_IOREG_CFG_DBG #endif @@ -201,31 +201,31 @@ #endif // CONFIG_BR_EXT #define CONFIG_TX_MCAST2UNI // Support IP multicast->unicast -//#define CONFIG_CHECK_AC_LIFETIME // Check packet lifetime of 4 ACs. +//#define CONFIG_CHECK_AC_LIFETIME // Check packet lifetime of 4 ACs. -/* - * Interface Related Config +/* + * Interface Related Config */ #ifndef CONFIG_MINIMAL_MEMORY_USAGE - #define CONFIG_USB_TX_AGGREGATION - #define CONFIG_USB_RX_AGGREGATION + #define CONFIG_USB_TX_AGGREGATION + #define CONFIG_USB_RX_AGGREGATION #endif -#define CONFIG_PREALLOC_RECV_SKB +#define CONFIG_PREALLOC_RECV_SKB //#define CONFIG_REDUCE_USB_TX_INT // Trade-off: Improve performance, but may cause TX URBs blocked by USB Host/Bus driver on few platforms. -//#define CONFIG_EASY_REPLACEMENT +//#define CONFIG_EASY_REPLACEMENT -/* +/* * CONFIG_USE_USB_BUFFER_ALLOC_XX uses Linux USB Buffer alloc API and is for Linux platform only now! */ -//#define CONFIG_USE_USB_BUFFER_ALLOC_TX // Trade-off: For TX path, improve stability on some platforms, but may cause performance degrade on other platforms. -//#define CONFIG_USE_USB_BUFFER_ALLOC_RX // For RX path +//#define CONFIG_USE_USB_BUFFER_ALLOC_TX // Trade-off: For TX path, improve stability on some platforms, but may cause performance degrade on other platforms. +//#define CONFIG_USE_USB_BUFFER_ALLOC_RX // For RX path #ifdef CONFIG_USE_USB_BUFFER_ALLOC_RX #undef CONFIG_PREALLOC_RECV_SKB #endif -/* +/* * USB VENDOR REQ BUFFER ALLOCATION METHOD * if not set we'll use function local variable (stack memory) */ @@ -235,7 +235,7 @@ #define CONFIG_USB_VENDOR_REQ_MUTEX #define CONFIG_VENDOR_REQ_RETRY -//#define CONFIG_USB_SUPPORT_ASYNC_VDN_REQ +//#define CONFIG_USB_SUPPORT_ASYNC_VDN_REQ /* @@ -254,7 +254,7 @@ #define ENABLE_USB_DROP_INCORRECT_OUT -//#define RTL8192CU_ADHOC_WORKAROUND_SETTING +//#define RTL8192CU_ADHOC_WORKAROUND_SETTING #define DISABLE_BB_RF 0 @@ -268,8 +268,8 @@ */ #ifdef CONFIG_PLATFORM_MN10300 #define CONFIG_SPECIAL_SETTING_FOR_FUNAI_TV - #define CONFIG_USE_USB_BUFFER_ALLOC_RX - + #define CONFIG_USE_USB_BUFFER_ALLOC_RX + #if defined (CONFIG_SW_ANTENNA_DIVERSITY) #undef CONFIG_SW_ANTENNA_DIVERSITY #define CONFIG_HW_ANTENNA_DIVERSITY @@ -278,18 +278,18 @@ #if defined (CONFIG_POWER_SAVING) #undef CONFIG_POWER_SAVING #endif - + #endif//CONFIG_PLATFORM_MN10300 #ifdef CONFIG_PLATFORM_TI_DM365 -#define CONFIG_USE_USB_BUFFER_ALLOC_RX +#define CONFIG_USE_USB_BUFFER_ALLOC_RX #endif #if defined(CONFIG_PLATFORM_ACTIONS_ATM702X) - #ifdef CONFIG_USB_TX_AGGREGATION + #ifdef CONFIG_USB_TX_AGGREGATION #undef CONFIG_USB_TX_AGGREGATION #endif #ifndef CONFIG_USE_USB_BUFFER_ALLOC_TX @@ -305,20 +305,20 @@ * Outsource Related Config */ -#define RTL8192CE_SUPPORT 0 -#define RTL8192CU_SUPPORT 0 -#define RTL8192C_SUPPORT (RTL8192CE_SUPPORT|RTL8192CU_SUPPORT) +#define RTL8192CE_SUPPORT 0 +#define RTL8192CU_SUPPORT 0 +#define RTL8192C_SUPPORT (RTL8192CE_SUPPORT|RTL8192CU_SUPPORT) -#define RTL8192DE_SUPPORT 0 -#define RTL8192DU_SUPPORT 0 -#define RTL8192D_SUPPORT (RTL8192DE_SUPPORT|RTL8192DU_SUPPORT) +#define RTL8192DE_SUPPORT 0 +#define RTL8192DU_SUPPORT 0 +#define RTL8192D_SUPPORT (RTL8192DE_SUPPORT|RTL8192DU_SUPPORT) -#define RTL8723AU_SUPPORT 0 -#define RTL8723AS_SUPPORT 0 -#define RTL8723AE_SUPPORT 0 -#define RTL8723A_SUPPORT (RTL8723AU_SUPPORT|RTL8723AS_SUPPORT|RTL8723AE_SUPPORT) +#define RTL8723AU_SUPPORT 0 +#define RTL8723AS_SUPPORT 0 +#define RTL8723AE_SUPPORT 0 +#define RTL8723A_SUPPORT (RTL8723AU_SUPPORT|RTL8723AS_SUPPORT|RTL8723AE_SUPPORT) -#define RTL8723_FPGA_VERIFICATION 0 +#define RTL8723_FPGA_VERIFICATION 0 #define RTL8188EE_SUPPORT 0 #define RTL8188EU_SUPPORT 1 @@ -326,13 +326,13 @@ #define RTL8188E_SUPPORT (RTL8188EE_SUPPORT|RTL8188EU_SUPPORT|RTL8188ES_SUPPORT) #define RTL8188E_FOR_TEST_CHIP 0 //#if (RTL8188E_SUPPORT==1) -#define RATE_ADAPTIVE_SUPPORT 1 +#define RATE_ADAPTIVE_SUPPORT 1 #define POWER_TRAINING_ACTIVE 1 //#endif #ifdef CONFIG_USB_TX_AGGREGATION -//#define CONFIG_TX_EARLY_MODE +//#define CONFIG_TX_EARLY_MODE #endif #ifdef CONFIG_TX_EARLY_MODE @@ -381,10 +381,9 @@ //#define DBG_HAL_INIT_PROFILING -//#define DBG_MEMORY_LEAK +//#define DBG_MEMORY_LEAK //TX use 1 urb //#define CONFIG_SINGLE_XMIT_BUF //RX use 1 urb //#define CONFIG_SINGLE_RECV_BUF - diff --git a/include/basic_types.h b/include/basic_types.h index fcfed00..afd72f4 100755 --- a/include/basic_types.h +++ b/include/basic_types.h @@ -1,7 +1,7 @@ /****************************************************************************** * * 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. @@ -29,13 +29,13 @@ #ifndef TRUE #define _TRUE 1 #else - #define _TRUE TRUE + #define _TRUE TRUE #endif - -#ifndef FALSE + +#ifndef FALSE #define _FALSE 0 #else - #define _FALSE FALSE + #define _FALSE FALSE #endif #include @@ -55,14 +55,14 @@ #define UCHAR u8 #define USHORT u16 #define UINT u32 - #define ULONG u32 + #define ULONG u32 typedef void (*proc_t)(void*); - typedef __kernel_size_t SIZE_T; + typedef __kernel_size_t SIZE_T; typedef __kernel_ssize_t SSIZE_T; #define FIELD_OFFSET(s,field) ((SSIZE_T)&((s*)(0))->field) - + #define MEM_ALIGNMENT_OFFSET (sizeof (SIZE_T)) #define MEM_ALIGNMENT_PADDING (sizeof(SIZE_T) - 1) @@ -83,8 +83,8 @@ // // Byte Swapping routine. // -#define EF1Byte -#define EF2Byte le16_to_cpu +#define EF1Byte +#define EF2Byte le16_to_cpu #define EF4Byte le32_to_cpu // @@ -99,7 +99,7 @@ // #define WriteEF1Byte(_ptr, _val) (*((u8 *)(_ptr)))=EF1Byte(_val) #define WriteEF2Byte(_ptr, _val) (*((u16 *)(_ptr)))=EF2Byte(_val) -#define WriteEF4Byte(_ptr, _val) (*((u32 *)(_ptr)))=EF4Byte(_val) +#define WriteEF4Byte(_ptr, _val) (*((u32 *)(_ptr)))=EF4Byte(_val) // // Example: @@ -116,7 +116,7 @@ // BIT_OFFSET_LEN_MASK_32(16, 2) => 0x00030000 // #define BIT_OFFSET_LEN_MASK_32(__BitOffset, __BitLen) \ - (BIT_LEN_MASK_32(__BitLen) << (__BitOffset)) + (BIT_LEN_MASK_32(__BitLen) << (__BitOffset)) // // Description: @@ -140,7 +140,7 @@ // // Description: -// Mask subfield (continuous bits in little-endian) of 4-byte value in litten byte oredering +// Mask subfield (continuous bits in little-endian) of 4-byte value in litten byte oredering // and return the result in 4-byte value in host byte ordering. // #define LE_BITS_CLEARED_TO_4BYTE(__pStart, __BitOffset, __BitLen) \ @@ -152,7 +152,7 @@ // // Description: -// Set subfield of little-endian 4-byte value to specified value. +// Set subfield of little-endian 4-byte value to specified value. // #define SET_BITS_TO_LE_4BYTE(__pStart, __BitOffset, __BitLen, __Value) \ *((u32 *)(__pStart)) = \ @@ -162,23 +162,23 @@ ( (((u32)__Value) & BIT_LEN_MASK_32(__BitLen)) << (__BitOffset) ) \ ); - + #define BIT_LEN_MASK_16(__BitLen) \ (0xFFFF >> (16 - (__BitLen))) - + #define BIT_OFFSET_LEN_MASK_16(__BitOffset, __BitLen) \ (BIT_LEN_MASK_16(__BitLen) << (__BitOffset)) - + #define LE_P2BYTE_TO_HOST_2BYTE(__pStart) \ (EF2Byte(*((u16 *)(__pStart)))) - + #define LE_BITS_TO_2BYTE(__pStart, __BitOffset, __BitLen) \ ( \ ( LE_P2BYTE_TO_HOST_2BYTE(__pStart) >> (__BitOffset) ) \ & \ BIT_LEN_MASK_16(__BitLen) \ ) - + #define LE_BITS_CLEARED_TO_2BYTE(__pStart, __BitOffset, __BitLen) \ ( \ LE_P2BYTE_TO_HOST_2BYTE(__pStart) \ @@ -193,7 +193,7 @@ | \ ( (((u16)__Value) & BIT_LEN_MASK_16(__BitLen)) << (__BitOffset) ) \ ); - + #define BIT_LEN_MASK_8(__BitLen) \ (0xFF >> (8 - (__BitLen))) @@ -248,4 +248,3 @@ typedef unsigned char BOOLEAN,*PBOOLEAN; #endif //__BASIC_TYPES_H__ - diff --git a/include/circ_buf.h b/include/circ_buf.h index 2352316..236fbe6 100755 --- a/include/circ_buf.h +++ b/include/circ_buf.h @@ -1,7 +1,7 @@ /****************************************************************************** * * 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. @@ -25,4 +25,3 @@ #define CIRC_SPACE(head,tail,size) CIRC_CNT((tail),((head)+1),(size)) #endif //_CIRC_BUF_H_ - diff --git a/include/cmd_osdep.h b/include/cmd_osdep.h index 077efa7..c4903f4 100755 --- a/include/cmd_osdep.h +++ b/include/cmd_osdep.h @@ -1,7 +1,7 @@ /****************************************************************************** * * 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. @@ -33,4 +33,3 @@ extern sint _rtw_enqueue_cmd(_queue *queue, struct cmd_obj *obj); extern struct cmd_obj *_rtw_dequeue_cmd(_queue *queue); #endif - diff --git a/include/drv_conf.h b/include/drv_conf.h index 03c07f5..d8aa8c5 100755 --- a/include/drv_conf.h +++ b/include/drv_conf.h @@ -1,7 +1,7 @@ /****************************************************************************** * * 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. @@ -56,7 +56,7 @@ #endif //About USB VENDOR REQ -#if defined(CONFIG_USB_VENDOR_REQ_BUFFER_PREALLOC) && !defined(CONFIG_USB_VENDOR_REQ_MUTEX) +#if defined(CONFIG_USB_VENDOR_REQ_BUFFER_PREALLOC) && !defined(CONFIG_USB_VENDOR_REQ_MUTEX) #warning "define CONFIG_USB_VENDOR_REQ_MUTEX for CONFIG_USB_VENDOR_REQ_BUFFER_PREALLOC automatically" #define CONFIG_USB_VENDOR_REQ_MUTEX #endif @@ -69,4 +69,3 @@ //#include #endif // __DRV_CONF_H__ - diff --git a/include/drv_types.h b/include/drv_types.h index c6ba93d..eb65c13 100755 --- a/include/drv_types.h +++ b/include/drv_types.h @@ -112,7 +112,7 @@ struct registry_priv u8 network_mode; //infra, ad-hoc, auto u8 channel;//ad-hoc support requirement u8 wireless_mode;//A, B, G, auto - u8 scan_mode;//active, passive + u8 scan_mode;//active, passive u8 radio_enable; u8 preamble;//long, short, auto u8 vrtl_carrier_sense;//Enable, Disable, Auto @@ -150,7 +150,7 @@ struct registry_priv u8 ht_enable; u8 cbw40_enable; u8 ampdu_enable;//for tx - u8 rx_stbc; + u8 rx_stbc; u8 ampdu_amsdu;//A-MPDU Supports A-MSDU is permitted #endif u8 lowrate_two_xmit; @@ -241,8 +241,8 @@ struct registry_priv enum _IFACE_ID { IFACE_ID0, //maping to PRIMARY_ADAPTER IFACE_ID1, //maping to SECONDARY_ADAPTER - IFACE_ID2, - IFACE_ID3, + IFACE_ID2, + IFACE_ID3, IFACE_ID_MAX, }; @@ -250,7 +250,7 @@ struct dvobj_priv { struct adapter *if1; //PRIMARY_ADAPTER struct adapter *if2; //SECONDARY_ADAPTER - + s32 processing_dev_remove; //for local/global synchronization @@ -343,10 +343,10 @@ struct dvobj_priv u8 const_hwsw_rfoff_d3; u8 const_support_pciaspm; // pci-e bridge */ - u8 const_hostpci_aspm_setting; + u8 const_hostpci_aspm_setting; // pci-e device */ - u8 const_devicepci_aspm_setting; - u8 b_support_aspm; // If it supports ASPM, Offset[560h] = 0x40, otherwise Offset[560h] = 0x00. + u8 const_devicepci_aspm_setting; + u8 b_support_aspm; // If it supports ASPM, Offset[560h] = 0x40, otherwise Offset[560h] = 0x00. u8 b_support_backdoor; u8 bdma64; @@ -425,7 +425,7 @@ struct adapter { int DriverState;// for disable driver using module, use dongle to replace module. int pid[3];//process id from UI, 0:wps, 1:hostapd, 2:dhcpcd int bDongle;//build-in module or external dongle - u16 chip_type; + u16 chip_type; u16 HardwareType; u16 interface_type;//USB,SDIO,SPI,PCI @@ -435,20 +435,20 @@ struct adapter { struct cmd_priv cmdpriv; struct evt_priv evtpriv; //struct io_queue *pio_queue; - struct io_priv iopriv; + struct io_priv iopriv; struct xmit_priv xmitpriv; struct recv_priv recvpriv; struct sta_priv stapriv; struct security_priv securitypriv; _lock security_key_mutex; // add for CONFIG_IEEE80211W, none 11w also can use struct registry_priv registrypriv; - struct eeprom_priv eeprompriv; + struct eeprom_priv eeprompriv; struct led_priv ledpriv; -#if defined(CONFIG_CHECK_BT_HANG) && defined(CONFIG_BT_COEXIST) +#if defined(CONFIG_CHECK_BT_HANG) && defined(CONFIG_BT_COEXIST) //Check BT status for BT Hung. struct workqueue_struct *priv_checkbt_wq; struct delayed_work checkbt_work; -#endif +#endif #ifdef CONFIG_DRVEXT_MODULE struct drvext_priv drvextpriv; @@ -611,4 +611,3 @@ __inline static u8 *myid(struct eeprom_priv *peepriv) #endif //__DRV_TYPES_H__ - diff --git a/include/drv_types_ce.h b/include/drv_types_ce.h index b3d3523..b8f594d 100755 --- a/include/drv_types_ce.h +++ b/include/drv_types_ce.h @@ -1,7 +1,7 @@ /****************************************************************************** * * 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. @@ -49,7 +49,7 @@ typedef struct _MP_REG_ENTRY u8 Type; // NdisParameterInteger/NdisParameterHexInteger/NdisParameterStringle/NdisParameterMultiString uint FieldOffset; // offset to MP_ADAPTER field uint FieldSize; // size (in bytes) of the field - + #ifdef UNDER_AMD64 u64 Default; #else @@ -64,7 +64,7 @@ typedef struct _MP_REG_ENTRY typedef struct _USB_EXTENSION { LPCUSB_FUNCS _lpUsbFuncs; USB_HANDLE _hDevice; - PVOID pAdapter; + PVOID pAdapter; #if 0 USB_ENDPOINT_DESCRIPTOR _endpACLIn; @@ -90,4 +90,3 @@ typedef struct _OCTET_STRING{ #endif - diff --git a/include/drv_types_gspi.h b/include/drv_types_gspi.h index fb4c5bd..6acb193 100755 --- a/include/drv_types_gspi.h +++ b/include/drv_types_gspi.h @@ -1,45 +1,44 @@ -/****************************************************************************** - * - * Copyright(c) 2007 - 2012 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 __DRV_TYPES_GSPI_H__ -#define __DRV_TYPES_GSPI_H__ - -#include -#include - -// SPI Header Files -#include - - -typedef struct gspi_data -{ - u8 func_number; - - u8 tx_block_mode; - u8 rx_block_mode; - u32 block_transfer_len; - - struct spi_device *func; - - struct workqueue_struct *priv_wq; - struct delayed_work irq_work; -} GSPI_DATA, *PGSPI_DATA; - -#endif // #ifndef __DRV_TYPES_GSPI_H__ - +/****************************************************************************** + * + * Copyright(c) 2007 - 2012 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 __DRV_TYPES_GSPI_H__ +#define __DRV_TYPES_GSPI_H__ + +#include +#include + +// SPI Header Files +#include + + +typedef struct gspi_data +{ + u8 func_number; + + u8 tx_block_mode; + u8 rx_block_mode; + u32 block_transfer_len; + + struct spi_device *func; + + struct workqueue_struct *priv_wq; + struct delayed_work irq_work; +} GSPI_DATA, *PGSPI_DATA; + +#endif // #ifndef __DRV_TYPES_GSPI_H__ diff --git a/include/drv_types_linux.h b/include/drv_types_linux.h index db1c585..812b744 100755 --- a/include/drv_types_linux.h +++ b/include/drv_types_linux.h @@ -1,7 +1,7 @@ /****************************************************************************** * * 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. @@ -22,4 +22,3 @@ #endif - diff --git a/include/drv_types_sdio.h b/include/drv_types_sdio.h index 5b9dc40..2415f27 100755 --- a/include/drv_types_sdio.h +++ b/include/drv_types_sdio.h @@ -1,42 +1,41 @@ -/****************************************************************************** - * - * 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 __DRV_TYPES_SDIO_H__ -#define __DRV_TYPES_SDIO_H__ - -#include -#include - -// SDIO Header Files -#include - -typedef struct sdio_data -{ - u8 func_number; - - u8 tx_block_mode; - u8 rx_block_mode; - u32 block_transfer_len; - - struct sdio_func *func; - _thread_hdl_ sys_sdio_irq_thd; -} SDIO_DATA, *PSDIO_DATA; - -#endif - +/****************************************************************************** + * + * 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 __DRV_TYPES_SDIO_H__ +#define __DRV_TYPES_SDIO_H__ + +#include +#include + +// SDIO Header Files +#include + +typedef struct sdio_data +{ + u8 func_number; + + u8 tx_block_mode; + u8 rx_block_mode; + u32 block_transfer_len; + + struct sdio_func *func; + _thread_hdl_ sys_sdio_irq_thd; +} SDIO_DATA, *PSDIO_DATA; + +#endif diff --git a/include/drv_types_xp.h b/include/drv_types_xp.h index 2d51b1d..1d735d6 100755 --- a/include/drv_types_xp.h +++ b/include/drv_types_xp.h @@ -1,7 +1,7 @@ /****************************************************************************** * * 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. @@ -70,7 +70,7 @@ typedef struct _MP_REG_ENTRY u8 Type; // NdisParameterInteger/NdisParameterHexInteger/NdisParameterStringle/NdisParameterMultiString uint FieldOffset; // offset to MP_ADAPTER field uint FieldSize; // size (in bytes) of the field - + #ifdef UNDER_AMD64 u64 Default; #else @@ -92,4 +92,3 @@ typedef struct _OCTET_STRING{ #endif - diff --git a/include/ethernet.h b/include/ethernet.h index cadc8c1..12d2e41 100755 --- a/include/ethernet.h +++ b/include/ethernet.h @@ -1,7 +1,7 @@ /****************************************************************************** * * 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. @@ -17,7 +17,7 @@ * * ******************************************************************************/ -/*! \file */ +/*! \file */ #ifndef __INC_ETHERNET_H #define __INC_ETHERNET_H @@ -30,7 +30,7 @@ #define RT_ETH_IS_MULTICAST(_pAddr) ((((UCHAR *)(_pAddr))[0]&0x01)!=0) //!< Is Multicast Address? #define RT_ETH_IS_BROADCAST(_pAddr) ( \ - ((UCHAR *)(_pAddr))[0]==0xff && \ + ((UCHAR *)(_pAddr))[0]==0xff && \ ((UCHAR *)(_pAddr))[1]==0xff && \ ((UCHAR *)(_pAddr))[2]==0xff && \ ((UCHAR *)(_pAddr))[3]==0xff && \ @@ -39,4 +39,3 @@ #endif // #ifndef __INC_ETHERNET_H - diff --git a/include/gspi_hal.h b/include/gspi_hal.h index bb57fef..31f3493 100755 --- a/include/gspi_hal.h +++ b/include/gspi_hal.h @@ -26,4 +26,3 @@ void rtl8188es_set_hal_ops(struct adapter *padapter); #define hal_set_hal_ops rtl8188es_set_hal_ops #endif //__GSPI_HAL_H__ - diff --git a/include/gspi_ops.h b/include/gspi_ops.h index 2b739ef..6557f60 100755 --- a/include/gspi_ops.h +++ b/include/gspi_ops.h @@ -25,28 +25,28 @@ * suppose that it will be the same * for diff chips of GSPI, if not * we should move it to HAL folder */ -#define SPI_LOCAL_DOMAIN 0x0 -#define WLAN_IOREG_DOMAIN 0x8 -#define FW_FIFO_DOMAIN 0x4 -#define TX_HIQ_DOMAIN 0xc -#define TX_MIQ_DOMAIN 0xd -#define TX_LOQ_DOMAIN 0xe -#define RX_RXFIFO_DOMAIN 0x1f +#define SPI_LOCAL_DOMAIN 0x0 +#define WLAN_IOREG_DOMAIN 0x8 +#define FW_FIFO_DOMAIN 0x4 +#define TX_HIQ_DOMAIN 0xc +#define TX_MIQ_DOMAIN 0xd +#define TX_LOQ_DOMAIN 0xe +#define RX_RXFIFO_DOMAIN 0x1f //IO Bus domain address mapping #define DEFUALT_OFFSET 0x0 -#define SPI_LOCAL_OFFSET 0x10250000 -#define WLAN_IOREG_OFFSET 0x10260000 -#define FW_FIFO_OFFSET 0x10270000 -#define TX_HIQ_OFFSET 0x10310000 +#define SPI_LOCAL_OFFSET 0x10250000 +#define WLAN_IOREG_OFFSET 0x10260000 +#define FW_FIFO_OFFSET 0x10270000 +#define TX_HIQ_OFFSET 0x10310000 #define TX_MIQ_OFFSET 0x1032000 #define TX_LOQ_OFFSET 0x10330000 -#define RX_RXOFF_OFFSET 0x10340000 +#define RX_RXOFF_OFFSET 0x10340000 //SPI Local registers #define SPI_REG_TX_CTRL 0x0000 // SPI Tx Control #define SPI_REG_STATUS_RECOVERY 0x0004 -#define SPI_REG_INT_TIMEOUT 0x0006 +#define SPI_REG_INT_TIMEOUT 0x0006 #define SPI_REG_HIMR 0x0014 // SPI Host Interrupt Mask #define SPI_REG_HISR 0x0018 // SPI Host Interrupt Service Routine #define SPI_REG_RX0_REQ_LEN 0x001C // RXDMA Request Length @@ -62,18 +62,18 @@ #define SPI_REG_HISR_ON 0x0091 //SPI Host Extension Interrupt Status Always #define SPI_REG_CFG 0x00F0 //SPI Configuration Register -#define SPI_TX_CTRL (SPI_REG_TX_CTRL |SPI_LOCAL_OFFSET) -#define SPI_STATUS_RECOVERY (SPI_REG_STATUS_RECOVERY |SPI_LOCAL_OFFSET) -#define SPI_INT_TIMEOUT (SPI_REG_INT_TIMEOUT |SPI_LOCAL_OFFSET) -#define SPI_HIMR (SPI_REG_HIMR |SPI_LOCAL_OFFSET) -#define SPI_HISR (SPI_REG_HISR |SPI_LOCAL_OFFSET) -#define SPI_RX0_REQ_LEN_1_BYTE (SPI_REG_RX0_REQ_LEN |SPI_LOCAL_OFFSET) -#define SPI_FREE_TXPG (SPI_REG_FREE_TXPG |SPI_LOCAL_OFFSET) +#define SPI_TX_CTRL (SPI_REG_TX_CTRL |SPI_LOCAL_OFFSET) +#define SPI_STATUS_RECOVERY (SPI_REG_STATUS_RECOVERY |SPI_LOCAL_OFFSET) +#define SPI_INT_TIMEOUT (SPI_REG_INT_TIMEOUT |SPI_LOCAL_OFFSET) +#define SPI_HIMR (SPI_REG_HIMR |SPI_LOCAL_OFFSET) +#define SPI_HISR (SPI_REG_HISR |SPI_LOCAL_OFFSET) +#define SPI_RX0_REQ_LEN_1_BYTE (SPI_REG_RX0_REQ_LEN |SPI_LOCAL_OFFSET) +#define SPI_FREE_TXPG (SPI_REG_FREE_TXPG |SPI_LOCAL_OFFSET) #define SPI_HIMR_DISABLED 0 //SPI HIMR MASK diff with SDIO -#define SPI_HISR_RX_REQUEST BIT(0) +#define SPI_HISR_RX_REQUEST BIT(0) #define SPI_HISR_AVAL BIT(1) #define SPI_HISR_TXERR BIT(2) #define SPI_HISR_RXERR BIT(3) @@ -110,17 +110,17 @@ SPI_HISR_PSTIMEOUT |\ SPI_HISR_OCPINT) -#define REG_LEN_FORMAT(pcmd, x) SET_BITS_TO_LE_4BYTE(pcmd, 0, 8, x)//(x<<(unsigned int)24) -#define REG_ADDR_FORMAT(pcmd,x) SET_BITS_TO_LE_4BYTE(pcmd, 8, 16, x)//(x<<(unsigned int)16) -#define REG_DOMAIN_ID_FORMAT(pcmd,x) SET_BITS_TO_LE_4BYTE(pcmd, 24, 5, x)//(x<<(unsigned int)0) -#define REG_FUN_FORMAT(pcmd,x) SET_BITS_TO_LE_4BYTE(pcmd, 29, 2, x)//(x<<(unsigned int)5) -#define REG_RW_FORMAT(pcmd,x) SET_BITS_TO_LE_4BYTE(pcmd, 31, 1, x)//(x<<(unsigned int)7) +#define REG_LEN_FORMAT(pcmd, x) SET_BITS_TO_LE_4BYTE(pcmd, 0, 8, x)//(x<<(unsigned int)24) +#define REG_ADDR_FORMAT(pcmd,x) SET_BITS_TO_LE_4BYTE(pcmd, 8, 16, x)//(x<<(unsigned int)16) +#define REG_DOMAIN_ID_FORMAT(pcmd,x) SET_BITS_TO_LE_4BYTE(pcmd, 24, 5, x)//(x<<(unsigned int)0) +#define REG_FUN_FORMAT(pcmd,x) SET_BITS_TO_LE_4BYTE(pcmd, 29, 2, x)//(x<<(unsigned int)5) +#define REG_RW_FORMAT(pcmd,x) SET_BITS_TO_LE_4BYTE(pcmd, 31, 1, x)//(x<<(unsigned int)7) -#define FIFO_LEN_FORMAT(pcmd, x) SET_BITS_TO_LE_4BYTE(pcmd, 0, 16, x)//(x<<(unsigned int)24) -//#define FIFO_ADDR_FORMAT(pcmd,x) SET_BITS_TO_LE_4BYTE(pcmd, 8, 16, x)//(x<<(unsigned int)16) -#define FIFO_DOMAIN_ID_FORMAT(pcmd,x) SET_BITS_TO_LE_4BYTE(pcmd, 24, 5, x)//(x<<(unsigned int)0) -#define FIFO_FUN_FORMAT(pcmd,x) SET_BITS_TO_LE_4BYTE(pcmd, 29, 2, x)//(x<<(unsigned int)5) -#define FIFO_RW_FORMAT(pcmd,x) SET_BITS_TO_LE_4BYTE(pcmd, 31, 1, x)//(x<<(unsigned int)7) +#define FIFO_LEN_FORMAT(pcmd, x) SET_BITS_TO_LE_4BYTE(pcmd, 0, 16, x)//(x<<(unsigned int)24) +//#define FIFO_ADDR_FORMAT(pcmd,x) SET_BITS_TO_LE_4BYTE(pcmd, 8, 16, x)//(x<<(unsigned int)16) +#define FIFO_DOMAIN_ID_FORMAT(pcmd,x) SET_BITS_TO_LE_4BYTE(pcmd, 24, 5, x)//(x<<(unsigned int)0) +#define FIFO_FUN_FORMAT(pcmd,x) SET_BITS_TO_LE_4BYTE(pcmd, 29, 2, x)//(x<<(unsigned int)5) +#define FIFO_RW_FORMAT(pcmd,x) SET_BITS_TO_LE_4BYTE(pcmd, 31, 1, x)//(x<<(unsigned int)7) //get status dword0 @@ -133,8 +133,8 @@ //get status dword1 #define GET_STATUS_HISR_MID8BIT(status) LE_BITS_TO_4BYTE(status + 4, 24, 8) #define GET_STATUS_HISR_LOW8BIT(status) LE_BITS_TO_4BYTE(status + 4, 16, 8) -#define GET_STATUS_ERROR(status) LE_BITS_TO_4BYTE(status + 4, 17, 1) -#define GET_STATUS_INT(status) LE_BITS_TO_4BYTE(status + 4, 16, 1) +#define GET_STATUS_ERROR(status) LE_BITS_TO_4BYTE(status + 4, 17, 1) +#define GET_STATUS_INT(status) LE_BITS_TO_4BYTE(status + 4, 16, 1) #define GET_STATUS_RX_LENGTH(status) LE_BITS_TO_4BYTE(status + 4, 0, 16) diff --git a/include/gspi_ops_linux.h b/include/gspi_ops_linux.h index 6358a0f..9bd18da 100755 --- a/include/gspi_ops_linux.h +++ b/include/gspi_ops_linux.h @@ -21,4 +21,3 @@ #define __SDIO_OPS_LINUX_H__ #endif - diff --git a/include/gspi_osintf.h b/include/gspi_osintf.h index b7946c4..3b258f8 100755 --- a/include/gspi_osintf.h +++ b/include/gspi_osintf.h @@ -32,4 +32,3 @@ extern void sd_setup_irs(struct adapter *padapter); #endif #endif - diff --git a/include/h2clbk.h b/include/h2clbk.h index 17d6022..ee68822 100755 --- a/include/h2clbk.h +++ b/include/h2clbk.h @@ -1,7 +1,7 @@ /****************************************************************************** * * 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. @@ -33,4 +33,3 @@ void _lbk_rsp(struct adapter *Adapter); void _lbk_evt(IN struct adapter *Adapter); void h2c_event_callback(unsigned char *dev, unsigned char *pbuf); - diff --git a/include/hal_com.h b/include/hal_com.h index ca131b7..947687f 100755 --- a/include/hal_com.h +++ b/include/hal_com.h @@ -1,7 +1,7 @@ /****************************************************************************** * * 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. @@ -28,7 +28,7 @@ #define RATR_2M 0x00000002 #define RATR_55M 0x00000004 #define RATR_11M 0x00000008 -//OFDM +//OFDM #define RATR_6M 0x00000010 #define RATR_9M 0x00000020 #define RATR_12M 0x00000040 @@ -37,7 +37,7 @@ #define RATR_36M 0x00000200 #define RATR_48M 0x00000400 #define RATR_54M 0x00000800 -//MCS 1 Spatial Stream +//MCS 1 Spatial Stream #define RATR_MCS0 0x00001000 #define RATR_MCS1 0x00002000 #define RATR_MCS2 0x00004000 @@ -61,7 +61,7 @@ #define RATE_2M BIT(1) #define RATE_5_5M BIT(2) #define RATE_11M BIT(3) -//OFDM +//OFDM #define RATE_6M BIT(4) #define RATE_9M BIT(5) #define RATE_12M BIT(6) @@ -90,15 +90,15 @@ #define RATE_MCS15 BIT(27) // ALL CCK Rate -#define RATE_ALL_CCK RATR_1M|RATR_2M|RATR_55M|RATR_11M +#define RATE_ALL_CCK RATR_1M|RATR_2M|RATR_55M|RATR_11M #define RATE_ALL_OFDM_AG RATR_6M|RATR_9M|RATR_12M|RATR_18M|RATR_24M|\ - RATR_36M|RATR_48M|RATR_54M + RATR_36M|RATR_48M|RATR_54M #define RATE_ALL_OFDM_1SS RATR_MCS0|RATR_MCS1|RATR_MCS2|RATR_MCS3 |\ - RATR_MCS4|RATR_MCS5|RATR_MCS6 |RATR_MCS7 + RATR_MCS4|RATR_MCS5|RATR_MCS6 |RATR_MCS7 #define RATE_ALL_OFDM_2SS RATR_MCS8|RATR_MCS9 |RATR_MCS10|RATR_MCS11|\ RATR_MCS12|RATR_MCS13|RATR_MCS14|RATR_MCS15 -/*------------------------------ Tx Desc definition Macro ------------------------*/ +/*------------------------------ Tx Desc definition Macro ------------------------*/ //#pragma mark -- Tx Desc related definition. -- //---------------------------------------------------------------------------- //----------------------------------------------------------- @@ -182,4 +182,3 @@ u8 SetHalDefVar(struct adapter *adapter, HAL_DEF_VARIABLE variable, void *value) u8 GetHalDefVar(struct adapter *adapter, HAL_DEF_VARIABLE variable, void *value); #endif //__HAL_COMMON_H__ - diff --git a/include/hal_intf.h b/include/hal_intf.h index 9aa6470..0f5c6b8 100755 --- a/include/hal_intf.h +++ b/include/hal_intf.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Copyright(c) 2007 - 2012 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. @@ -31,8 +31,8 @@ enum RTL871X_HCI_TYPE { RTW_PCIE = BIT0, - RTW_USB = BIT1, - RTW_SDIO = BIT2, + RTW_USB = BIT1, + RTW_SDIO = BIT2, RTW_GSPI = BIT3, }; @@ -43,7 +43,7 @@ enum _CHIP_TYPE { RTL8188C_8192C, RTL8192D, RTL8723A, - RTL8188E, + RTL8188E, MAX_CHIP_TYPE }; @@ -101,7 +101,7 @@ typedef enum _HW_VARIABLES{ HW_VAR_INITIAL_GAIN, HW_VAR_TRIGGER_GPIO_0, HW_VAR_BT_SET_COEXIST, - HW_VAR_BT_ISSUE_DELBA, + HW_VAR_BT_ISSUE_DELBA, HW_VAR_CURRENT_ANTENNA, HW_VAR_ANTENNA_DIVERSITY_LINK, HW_VAR_ANTENNA_DIVERSITY_SELECT, @@ -121,7 +121,7 @@ typedef enum _HW_VARIABLES{ HW_VAR_SYS_CLKR, HW_VAR_NAV_UPPER, HW_VAR_RPT_TIMER_SETTING, - HW_VAR_TX_RPT_MAX_MACID, + HW_VAR_TX_RPT_MAX_MACID, HW_VAR_H2C_MEDIA_STATUS_RPT, HW_VAR_CHK_HI_QUEUE_EMPTY, HW_VAR_READ_LLT_TAB, @@ -150,7 +150,7 @@ typedef enum _HAL_DEF_VARIABLE{ }HAL_DEF_VARIABLE; typedef enum _HAL_ODM_VARIABLE{ - HAL_ODM_STA_INFO, + HAL_ODM_STA_INFO, HAL_ODM_P2P_STATE, HAL_ODM_WIFI_DISPLAY_STATE, }HAL_ODM_VARIABLE; @@ -243,14 +243,14 @@ struct hal_ops { void (*ReadEFuse)(struct adapter *padapter, u8 efuseType, u16 _offset, u16 _size_byte, u8 *pbuf, BOOLEAN bPseudoTest); void (*EFUSEGetEfuseDefinition)(struct adapter *padapter, u8 efuseType, u8 type, void *pOut, BOOLEAN bPseudoTest); u16 (*EfuseGetCurrentSize)(struct adapter *padapter, u8 efuseType, BOOLEAN bPseudoTest); - int (*Efuse_PgPacketRead)(struct adapter *padapter, u8 offset, u8 *data, BOOLEAN bPseudoTest); - int (*Efuse_PgPacketWrite)(struct adapter *padapter, u8 offset, u8 word_en, u8 *data, BOOLEAN bPseudoTest); + int (*Efuse_PgPacketRead)(struct adapter *padapter, u8 offset, u8 *data, BOOLEAN bPseudoTest); + int (*Efuse_PgPacketWrite)(struct adapter *padapter, u8 offset, u8 word_en, u8 *data, BOOLEAN bPseudoTest); u8 (*Efuse_WordEnableDataWrite)(struct adapter *padapter, u16 efuse_addr, u8 word_en, u8 *data, BOOLEAN bPseudoTest); BOOLEAN (*Efuse_PgPacketWrite_BT)(struct adapter *padapter, u8 offset, u8 word_en, u8 *data, BOOLEAN bPseudoTest); - + #ifdef DBG_CONFIG_ERROR_DETECT void (*sreset_init_value)(struct adapter *padapter); - void (*sreset_reset_value)(struct adapter *padapter); + void (*sreset_reset_value)(struct adapter *padapter); void (*silentreset)(struct adapter *padapter); void (*sreset_xmit_status_check)(struct adapter *padapter); void (*sreset_linked_status_check) (struct adapter *padapter); @@ -273,8 +273,8 @@ struct hal_ops { void (*hal_init_checkbthang_workqueue)(struct adapter * padapter); void (*hal_free_checkbthang_workqueue)(struct adapter * padapter); void (*hal_cancel_checkbthang_workqueue)(struct adapter * padapter); - void (*hal_checke_bt_hang)(struct adapter * padapter); -#endif + void (*hal_checke_bt_hang)(struct adapter * padapter); +#endif }; typedef enum _RT_EEPROM_TYPE{ @@ -286,10 +286,10 @@ typedef enum _RT_EEPROM_TYPE{ #define RF_CHANGE_BY_INIT 0 -#define RF_CHANGE_BY_IPS BIT28 -#define RF_CHANGE_BY_PS BIT29 -#define RF_CHANGE_BY_HW BIT30 -#define RF_CHANGE_BY_SW BIT31 +#define RF_CHANGE_BY_IPS BIT28 +#define RF_CHANGE_BY_PS BIT29 +#define RF_CHANGE_BY_HW BIT30 +#define RF_CHANGE_BY_SW BIT31 typedef enum _HARDWARE_TYPE{ HARDWARE_TYPE_RTL8180, @@ -412,7 +412,7 @@ u8 rtw_hal_get_def_var(struct adapter *padapter, HAL_DEF_VARIABLE eVariable, PVO void rtw_hal_set_odm_var(struct adapter *padapter, HAL_ODM_VARIABLE eVariable, PVOID pValue1,BOOLEAN bSet); void rtw_hal_get_odm_var(struct adapter *padapter, HAL_ODM_VARIABLE eVariable, PVOID pValue1,BOOLEAN bSet); - + void rtw_hal_enable_interrupt(struct adapter *padapter); void rtw_hal_disable_interrupt(struct adapter *padapter); @@ -484,4 +484,3 @@ s32 rtw_hal_c2h_handler(struct adapter *adapter, struct c2h_evt_hdr *c2h_evt); c2h_id_filter rtw_hal_c2h_id_filter_ccx(struct adapter *adapter); #endif //__HAL_INTF_H__ - diff --git a/include/ieee80211.h b/include/ieee80211.h index e1358ae..fcfc5e7 100755 --- a/include/ieee80211.h +++ b/include/ieee80211.h @@ -1,7 +1,7 @@ /****************************************************************************** * * 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. @@ -115,11 +115,11 @@ enum { #define IEEE_CRYPT_ALG_NAME_LEN 16 -#define WPA_CIPHER_NONE BIT(0) -#define WPA_CIPHER_WEP40 BIT(1) +#define WPA_CIPHER_NONE BIT(0) +#define WPA_CIPHER_WEP40 BIT(1) #define WPA_CIPHER_WEP104 BIT(2) -#define WPA_CIPHER_TKIP BIT(3) -#define WPA_CIPHER_CCMP BIT(4) +#define WPA_CIPHER_TKIP BIT(3) +#define WPA_CIPHER_CCMP BIT(4) @@ -171,8 +171,8 @@ enum NETWORK_TYPE WIRELESS_11A = BIT(2), // tx: ofdm only, rx: ofdm only, hw: ofdm only WIRELESS_11_24N = BIT(3), // tx: MCS only, rx: MCS & cck, hw: MCS & cck WIRELESS_11_5N = BIT(4), // tx: MCS only, rx: MCS & ofdm, hw: ofdm only - //WIRELESS_AUTO = BIT(5), - WIRELESS_AC = BIT(6), + //WIRELESS_AUTO = BIT(5), + WIRELESS_AC = BIT(6), //Combination WIRELESS_11BG = (WIRELESS_11B|WIRELESS_11G), // tx: cck & ofdm, rx: cck & ofdm & MCS, hw: cck & ofdm @@ -198,7 +198,7 @@ enum NETWORK_TYPE #define IsSupportedTxCCK(NetType) ((NetType) & (WIRELESS_11B) ? _TRUE : _FALSE) #define IsSupportedTxOFDM(NetType) ((NetType) & (WIRELESS_11G|WIRELESS_11A) ? _TRUE : _FALSE) -#define IsSupportedTxMCS(NetType) ((NetType) & (WIRELESS_11_24N|WIRELESS_11_5N) ? _TRUE : _FALSE) +#define IsSupportedTxMCS(NetType) ((NetType) & (WIRELESS_11_24N|WIRELESS_11_5N) ? _TRUE : _FALSE) typedef struct ieee_param { @@ -216,7 +216,7 @@ typedef struct ieee_param { } wpa_ie; struct{ int command; - int reason_code; + int reason_code; } mlme; struct { u8 alg[IEEE_CRYPT_ALG_NAME_LEN]; @@ -232,7 +232,7 @@ typedef struct ieee_param { u16 aid; u16 capability; int flags; - u8 tx_supp_rates[16]; + u8 tx_supp_rates[16]; struct rtw_ieee80211_ht_cap ht_cap; } add_sta; struct { @@ -241,7 +241,7 @@ typedef struct ieee_param { } bcn_ie; #endif - } u; + } u; }ieee_param; #ifdef CONFIG_AP_MODE @@ -256,7 +256,7 @@ struct sta_data{ u16 capability; int flags; u32 sta_set; - u8 tx_supp_rates[16]; + u8 tx_supp_rates[16]; u32 tx_supp_rates_len; struct rtw_ieee80211_ht_cap ht_cap; u64 rx_pkts; @@ -388,7 +388,7 @@ enum eap_type { /* management */ #define RTW_IEEE80211_STYPE_ASSOC_REQ 0x0000 -#define RTW_IEEE80211_STYPE_ASSOC_RESP 0x0010 +#define RTW_IEEE80211_STYPE_ASSOC_RESP 0x0010 #define RTW_IEEE80211_STYPE_REASSOC_REQ 0x0020 #define RTW_IEEE80211_STYPE_REASSOC_RESP 0x0030 #define RTW_IEEE80211_STYPE_PROBE_REQ 0x0040 @@ -581,7 +581,7 @@ struct ieee80211_snap_hdr { #define IEEE80211_24GHZ_BAND (1<<0) #define IEEE80211_52GHZ_BAND (1<<1) -#define IEEE80211_CCK_RATE_LEN 4 +#define IEEE80211_CCK_RATE_LEN 4 #define IEEE80211_NUM_OFDM_RATESLEN 8 @@ -589,7 +589,7 @@ struct ieee80211_snap_hdr { #define IEEE80211_CCK_RATE_2MB 0x04 #define IEEE80211_CCK_RATE_5MB 0x0B #define IEEE80211_CCK_RATE_11MB 0x16 -#define IEEE80211_OFDM_RATE_LEN 8 +#define IEEE80211_OFDM_RATE_LEN 8 #define IEEE80211_OFDM_RATE_6MB 0x0C #define IEEE80211_OFDM_RATE_9MB 0x12 #define IEEE80211_OFDM_RATE_12MB 0x18 @@ -925,9 +925,9 @@ struct ieee80211_network { u8 rates_len; u8 rates_ex[MAX_RATES_EX_LENGTH]; u8 rates_ex_len; - + u8 edca_parmsets[18]; - + u8 mode; u8 flags; u8 time_stamp[8]; @@ -946,7 +946,7 @@ struct ieee80211_network { u8 qbssload[5]; u8 network_type; int join_res; - unsigned long last_scanned; + unsigned long last_scanned; }; #endif /* @@ -960,7 +960,7 @@ enum ieee80211_state { /* the card is not linked at all */ IEEE80211_NOLINK = 0, - + /* IEEE80211_ASSOCIATING* are for BSS client mode * the driver shall not perform RX filtering unless * the state is LINKED. @@ -968,31 +968,31 @@ enum ieee80211_state { * defaults to NOLINK for ALL the other states (including * LINKED_SCANNING) */ - + /* the association procedure will start (wq scheduling)*/ IEEE80211_ASSOCIATING, IEEE80211_ASSOCIATING_RETRY, - + /* the association procedure is sending AUTH request*/ IEEE80211_ASSOCIATING_AUTHENTICATING, - + /* the association procedure has successfully authentcated * and is sending association request */ IEEE80211_ASSOCIATING_AUTHENTICATED, - + /* the link is ok. the card associated to a BSS or linked * to a ibss cell or acting as an AP and creating the bss */ IEEE80211_LINKED, - + /* same as LINKED, but the driver shall apply RX filter * rules as we are in NO_LINK mode. As the card is still * logically linked, but it is doing a syncro site survey * then it will be back to LINKED state. */ IEEE80211_LINKED_SCANNING, - + }; #define DEFAULT_MAX_SCAN_AGE (15 * HZ) @@ -1197,7 +1197,7 @@ enum rtw_ieee80211_back_parties { RTW_IEEE80211_CHAN_NO_HT40PLUS = 1<<4, RTW_IEEE80211_CHAN_NO_HT40MINUS = 1<<5, }; - + #define RTW_IEEE80211_CHAN_NO_HT40 \ (RTW_IEEE80211_CHAN_NO_HT40PLUS | RTW_IEEE80211_CHAN_NO_HT40MINUS) @@ -1214,7 +1214,7 @@ struct rtw_ieee80211_channel { //u32 orig_flags; //int orig_mag; //int orig_mpwr; -}; +}; #define CHAN_FMT \ /*"band:%d, "*/ \ @@ -1227,7 +1227,7 @@ struct rtw_ieee80211_channel { /*"beacon_found:%u\n"*/ \ /*"orig_flags:0x%08x\n"*/ \ /*"orig_mag:%d\n"*/ \ - /*"orig_mpwr:%d\n"*/ + /*"orig_mpwr:%d\n"*/ #define CHAN_ARG(channel) \ /*(channel)->band*/ \ @@ -1389,4 +1389,3 @@ int rtw_action_frame_parse(const u8 *frame, u32 frame_len, u8* category, u8 *act const char *action_public_str(u8 action); #endif /* IEEE80211_H */ - diff --git a/include/ieee80211_ext.h b/include/ieee80211_ext.h index 86ab2ac..c621f78 100755 --- a/include/ieee80211_ext.h +++ b/include/ieee80211_ext.h @@ -1,7 +1,7 @@ /****************************************************************************** * * 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. @@ -16,296 +16,295 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA * * - ******************************************************************************/ -#ifndef __IEEE80211_EXT_H -#define __IEEE80211_EXT_H - -#include -#include -#include - -#define WMM_OUI_TYPE 2 -#define WMM_OUI_SUBTYPE_INFORMATION_ELEMENT 0 -#define WMM_OUI_SUBTYPE_PARAMETER_ELEMENT 1 -#define WMM_OUI_SUBTYPE_TSPEC_ELEMENT 2 -#define WMM_VERSION 1 - -#define WPA_PROTO_WPA BIT(0) -#define WPA_PROTO_RSN BIT(1) - -#define WPA_KEY_MGMT_IEEE8021X BIT(0) -#define WPA_KEY_MGMT_PSK BIT(1) -#define WPA_KEY_MGMT_NONE BIT(2) -#define WPA_KEY_MGMT_IEEE8021X_NO_WPA BIT(3) -#define WPA_KEY_MGMT_WPA_NONE BIT(4) - - -#define WPA_CAPABILITY_PREAUTH BIT(0) -#define WPA_CAPABILITY_MGMT_FRAME_PROTECTION BIT(6) -#define WPA_CAPABILITY_PEERKEY_ENABLED BIT(9) - - -#define PMKID_LEN 16 - - -struct wpa_ie_hdr { - u8 elem_id; - u8 len; - u8 oui[4]; /* 24-bit OUI followed by 8-bit OUI type */ - u8 version[2]; /* little endian */ -}__attribute__ ((packed)); - -struct rsn_ie_hdr { - u8 elem_id; /* WLAN_EID_RSN */ - u8 len; - u8 version[2]; /* little endian */ -}__attribute__ ((packed)); - -struct wme_ac_parameter { -#if defined(CONFIG_LITTLE_ENDIAN) - /* byte 1 */ - u8 aifsn:4, - acm:1, - aci:2, - reserved:1; - - /* byte 2 */ - u8 eCWmin:4, - eCWmax:4; -#elif defined(CONFIG_BIG_ENDIAN) - /* byte 1 */ - u8 reserved:1, - aci:2, - acm:1, - aifsn:4; - - /* byte 2 */ - u8 eCWmax:4, - eCWmin:4; -#else -#error "Please fix " -#endif - - /* bytes 3 & 4 */ - u16 txopLimit; -} __attribute__ ((packed)); - -struct wme_parameter_element { - /* required fields for WME version 1 */ - u8 oui[3]; - u8 oui_type; - u8 oui_subtype; - u8 version; - u8 acInfo; - u8 reserved; - struct wme_ac_parameter ac[4]; - -} __attribute__ ((packed)); - -#define WPA_PUT_LE16(a, val) \ - do { \ - (a)[1] = ((u16) (val)) >> 8; \ - (a)[0] = ((u16) (val)) & 0xff; \ - } while (0) - -#define WPA_PUT_BE32(a, val) \ - do { \ - (a)[0] = (u8) ((((u32) (val)) >> 24) & 0xff); \ - (a)[1] = (u8) ((((u32) (val)) >> 16) & 0xff); \ - (a)[2] = (u8) ((((u32) (val)) >> 8) & 0xff); \ - (a)[3] = (u8) (((u32) (val)) & 0xff); \ - } while (0) - -#define WPA_PUT_LE32(a, val) \ - do { \ - (a)[3] = (u8) ((((u32) (val)) >> 24) & 0xff); \ - (a)[2] = (u8) ((((u32) (val)) >> 16) & 0xff); \ - (a)[1] = (u8) ((((u32) (val)) >> 8) & 0xff); \ - (a)[0] = (u8) (((u32) (val)) & 0xff); \ - } while (0) - -#define RSN_SELECTOR_PUT(a, val) WPA_PUT_BE32((u8 *) (a), (val)) -//#define RSN_SELECTOR_PUT(a, val) WPA_PUT_LE32((u8 *) (a), (val)) - - - -/* Action category code */ -enum ieee80211_category { - WLAN_CATEGORY_SPECTRUM_MGMT = 0, - WLAN_CATEGORY_QOS = 1, - WLAN_CATEGORY_DLS = 2, - WLAN_CATEGORY_BACK = 3, - WLAN_CATEGORY_HT = 7, - WLAN_CATEGORY_WMM = 17, -}; - -/* SPECTRUM_MGMT action code */ -enum ieee80211_spectrum_mgmt_actioncode { - WLAN_ACTION_SPCT_MSR_REQ = 0, - WLAN_ACTION_SPCT_MSR_RPRT = 1, - WLAN_ACTION_SPCT_TPC_REQ = 2, - WLAN_ACTION_SPCT_TPC_RPRT = 3, - WLAN_ACTION_SPCT_CHL_SWITCH = 4, - WLAN_ACTION_SPCT_EXT_CHL_SWITCH = 5, -}; - -/* BACK action code */ -enum ieee80211_back_actioncode { - WLAN_ACTION_ADDBA_REQ = 0, - WLAN_ACTION_ADDBA_RESP = 1, - WLAN_ACTION_DELBA = 2, -}; - -/* HT features action code */ -enum ieee80211_ht_actioncode { - WLAN_ACTION_NOTIFY_CH_WIDTH = 0, - WLAN_ACTION_SM_PS = 1, - WLAN_ACTION_PSPM = 2, - WLAN_ACTION_PCO_PHASE = 3, - WLAN_ACTION_MIMO_CSI_MX = 4, - WLAN_ACTION_MIMO_NONCP_BF = 5, - WLAN_ACTION_MIMP_CP_BF = 6, - WLAN_ACTION_ASEL_INDICATES_FB = 7, - WLAN_ACTION_HI_INFO_EXCHG = 8, -}; - -/* BACK (block-ack) parties */ -enum ieee80211_back_parties { - WLAN_BACK_RECIPIENT = 0, - WLAN_BACK_INITIATOR = 1, - WLAN_BACK_TIMER = 2, -}; - -struct ieee80211_mgmt { - u16 frame_control; - u16 duration; - u8 da[6]; - u8 sa[6]; - u8 bssid[6]; - u16 seq_ctrl; - union { - struct { - u16 auth_alg; - u16 auth_transaction; - u16 status_code; - /* possibly followed by Challenge text */ - u8 variable[0]; - } __attribute__ ((packed)) auth; - struct { - u16 reason_code; - } __attribute__ ((packed)) deauth; - struct { - u16 capab_info; - u16 listen_interval; - /* followed by SSID and Supported rates */ - u8 variable[0]; - } __attribute__ ((packed)) assoc_req; - struct { - u16 capab_info; - u16 status_code; - u16 aid; - /* followed by Supported rates */ - u8 variable[0]; - } __attribute__ ((packed)) assoc_resp, reassoc_resp; - struct { - u16 capab_info; - u16 listen_interval; - u8 current_ap[6]; - /* followed by SSID and Supported rates */ - u8 variable[0]; - } __attribute__ ((packed)) reassoc_req; - struct { - u16 reason_code; - } __attribute__ ((packed)) disassoc; - struct { - __le64 timestamp; - u16 beacon_int; - u16 capab_info; - /* followed by some of SSID, Supported rates, - * FH Params, DS Params, CF Params, IBSS Params, TIM */ - u8 variable[0]; - } __attribute__ ((packed)) beacon; - struct { - /* only variable items: SSID, Supported rates */ - u8 variable[0]; - } __attribute__ ((packed)) probe_req; - struct { - __le64 timestamp; - u16 beacon_int; - u16 capab_info; - /* followed by some of SSID, Supported rates, - * FH Params, DS Params, CF Params, IBSS Params */ - u8 variable[0]; - } __attribute__ ((packed)) probe_resp; - struct { - u8 category; - union { - struct { - u8 action_code; - u8 dialog_token; - u8 status_code; - u8 variable[0]; - } __attribute__ ((packed)) wme_action; -#if 0 - struct{ - u8 action_code; - u8 element_id; - u8 length; - struct ieee80211_channel_sw_ie sw_elem; - } __attribute__ ((packed)) chan_switch; - struct{ - u8 action_code; - u8 dialog_token; - u8 element_id; - u8 length; - struct ieee80211_msrment_ie msr_elem; - } __attribute__ ((packed)) measurement; -#endif - struct{ - u8 action_code; - u8 dialog_token; - u16 capab; - u16 timeout; - u16 start_seq_num; - } __attribute__ ((packed)) addba_req; - struct{ - u8 action_code; - u8 dialog_token; - u16 status; - u16 capab; - u16 timeout; - } __attribute__ ((packed)) addba_resp; - struct{ - u8 action_code; - u16 params; - u16 reason_code; - } __attribute__ ((packed)) delba; - struct{ - u8 action_code; - /* capab_info for open and confirm, - * reason for close - */ - u16 aux; - /* Followed in plink_confirm by status - * code, AID and supported rates, - * and directly by supported rates in - * plink_open and plink_close - */ - u8 variable[0]; - } __attribute__ ((packed)) plink_action; - struct{ - u8 action_code; - u8 variable[0]; - } __attribute__ ((packed)) mesh_action; - } __attribute__ ((packed)) u; - } __attribute__ ((packed)) action; - } __attribute__ ((packed)) u; -}__attribute__ ((packed)); - -/* mgmt header + 1 byte category code */ -#define IEEE80211_MIN_ACTION_SIZE FIELD_OFFSET(struct ieee80211_mgmt, u.action.u) - - - -#endif - + ******************************************************************************/ +#ifndef __IEEE80211_EXT_H +#define __IEEE80211_EXT_H + +#include +#include +#include + +#define WMM_OUI_TYPE 2 +#define WMM_OUI_SUBTYPE_INFORMATION_ELEMENT 0 +#define WMM_OUI_SUBTYPE_PARAMETER_ELEMENT 1 +#define WMM_OUI_SUBTYPE_TSPEC_ELEMENT 2 +#define WMM_VERSION 1 + +#define WPA_PROTO_WPA BIT(0) +#define WPA_PROTO_RSN BIT(1) + +#define WPA_KEY_MGMT_IEEE8021X BIT(0) +#define WPA_KEY_MGMT_PSK BIT(1) +#define WPA_KEY_MGMT_NONE BIT(2) +#define WPA_KEY_MGMT_IEEE8021X_NO_WPA BIT(3) +#define WPA_KEY_MGMT_WPA_NONE BIT(4) + + +#define WPA_CAPABILITY_PREAUTH BIT(0) +#define WPA_CAPABILITY_MGMT_FRAME_PROTECTION BIT(6) +#define WPA_CAPABILITY_PEERKEY_ENABLED BIT(9) + + +#define PMKID_LEN 16 + + +struct wpa_ie_hdr { + u8 elem_id; + u8 len; + u8 oui[4]; /* 24-bit OUI followed by 8-bit OUI type */ + u8 version[2]; /* little endian */ +}__attribute__ ((packed)); + +struct rsn_ie_hdr { + u8 elem_id; /* WLAN_EID_RSN */ + u8 len; + u8 version[2]; /* little endian */ +}__attribute__ ((packed)); + +struct wme_ac_parameter { +#if defined(CONFIG_LITTLE_ENDIAN) + /* byte 1 */ + u8 aifsn:4, + acm:1, + aci:2, + reserved:1; + + /* byte 2 */ + u8 eCWmin:4, + eCWmax:4; +#elif defined(CONFIG_BIG_ENDIAN) + /* byte 1 */ + u8 reserved:1, + aci:2, + acm:1, + aifsn:4; + + /* byte 2 */ + u8 eCWmax:4, + eCWmin:4; +#else +#error "Please fix " +#endif + + /* bytes 3 & 4 */ + u16 txopLimit; +} __attribute__ ((packed)); + +struct wme_parameter_element { + /* required fields for WME version 1 */ + u8 oui[3]; + u8 oui_type; + u8 oui_subtype; + u8 version; + u8 acInfo; + u8 reserved; + struct wme_ac_parameter ac[4]; + +} __attribute__ ((packed)); + +#define WPA_PUT_LE16(a, val) \ + do { \ + (a)[1] = ((u16) (val)) >> 8; \ + (a)[0] = ((u16) (val)) & 0xff; \ + } while (0) + +#define WPA_PUT_BE32(a, val) \ + do { \ + (a)[0] = (u8) ((((u32) (val)) >> 24) & 0xff); \ + (a)[1] = (u8) ((((u32) (val)) >> 16) & 0xff); \ + (a)[2] = (u8) ((((u32) (val)) >> 8) & 0xff); \ + (a)[3] = (u8) (((u32) (val)) & 0xff); \ + } while (0) + +#define WPA_PUT_LE32(a, val) \ + do { \ + (a)[3] = (u8) ((((u32) (val)) >> 24) & 0xff); \ + (a)[2] = (u8) ((((u32) (val)) >> 16) & 0xff); \ + (a)[1] = (u8) ((((u32) (val)) >> 8) & 0xff); \ + (a)[0] = (u8) (((u32) (val)) & 0xff); \ + } while (0) + +#define RSN_SELECTOR_PUT(a, val) WPA_PUT_BE32((u8 *) (a), (val)) +//#define RSN_SELECTOR_PUT(a, val) WPA_PUT_LE32((u8 *) (a), (val)) + + + +/* Action category code */ +enum ieee80211_category { + WLAN_CATEGORY_SPECTRUM_MGMT = 0, + WLAN_CATEGORY_QOS = 1, + WLAN_CATEGORY_DLS = 2, + WLAN_CATEGORY_BACK = 3, + WLAN_CATEGORY_HT = 7, + WLAN_CATEGORY_WMM = 17, +}; + +/* SPECTRUM_MGMT action code */ +enum ieee80211_spectrum_mgmt_actioncode { + WLAN_ACTION_SPCT_MSR_REQ = 0, + WLAN_ACTION_SPCT_MSR_RPRT = 1, + WLAN_ACTION_SPCT_TPC_REQ = 2, + WLAN_ACTION_SPCT_TPC_RPRT = 3, + WLAN_ACTION_SPCT_CHL_SWITCH = 4, + WLAN_ACTION_SPCT_EXT_CHL_SWITCH = 5, +}; + +/* BACK action code */ +enum ieee80211_back_actioncode { + WLAN_ACTION_ADDBA_REQ = 0, + WLAN_ACTION_ADDBA_RESP = 1, + WLAN_ACTION_DELBA = 2, +}; + +/* HT features action code */ +enum ieee80211_ht_actioncode { + WLAN_ACTION_NOTIFY_CH_WIDTH = 0, + WLAN_ACTION_SM_PS = 1, + WLAN_ACTION_PSPM = 2, + WLAN_ACTION_PCO_PHASE = 3, + WLAN_ACTION_MIMO_CSI_MX = 4, + WLAN_ACTION_MIMO_NONCP_BF = 5, + WLAN_ACTION_MIMP_CP_BF = 6, + WLAN_ACTION_ASEL_INDICATES_FB = 7, + WLAN_ACTION_HI_INFO_EXCHG = 8, +}; + +/* BACK (block-ack) parties */ +enum ieee80211_back_parties { + WLAN_BACK_RECIPIENT = 0, + WLAN_BACK_INITIATOR = 1, + WLAN_BACK_TIMER = 2, +}; + +struct ieee80211_mgmt { + u16 frame_control; + u16 duration; + u8 da[6]; + u8 sa[6]; + u8 bssid[6]; + u16 seq_ctrl; + union { + struct { + u16 auth_alg; + u16 auth_transaction; + u16 status_code; + /* possibly followed by Challenge text */ + u8 variable[0]; + } __attribute__ ((packed)) auth; + struct { + u16 reason_code; + } __attribute__ ((packed)) deauth; + struct { + u16 capab_info; + u16 listen_interval; + /* followed by SSID and Supported rates */ + u8 variable[0]; + } __attribute__ ((packed)) assoc_req; + struct { + u16 capab_info; + u16 status_code; + u16 aid; + /* followed by Supported rates */ + u8 variable[0]; + } __attribute__ ((packed)) assoc_resp, reassoc_resp; + struct { + u16 capab_info; + u16 listen_interval; + u8 current_ap[6]; + /* followed by SSID and Supported rates */ + u8 variable[0]; + } __attribute__ ((packed)) reassoc_req; + struct { + u16 reason_code; + } __attribute__ ((packed)) disassoc; + struct { + __le64 timestamp; + u16 beacon_int; + u16 capab_info; + /* followed by some of SSID, Supported rates, + * FH Params, DS Params, CF Params, IBSS Params, TIM */ + u8 variable[0]; + } __attribute__ ((packed)) beacon; + struct { + /* only variable items: SSID, Supported rates */ + u8 variable[0]; + } __attribute__ ((packed)) probe_req; + struct { + __le64 timestamp; + u16 beacon_int; + u16 capab_info; + /* followed by some of SSID, Supported rates, + * FH Params, DS Params, CF Params, IBSS Params */ + u8 variable[0]; + } __attribute__ ((packed)) probe_resp; + struct { + u8 category; + union { + struct { + u8 action_code; + u8 dialog_token; + u8 status_code; + u8 variable[0]; + } __attribute__ ((packed)) wme_action; +#if 0 + struct{ + u8 action_code; + u8 element_id; + u8 length; + struct ieee80211_channel_sw_ie sw_elem; + } __attribute__ ((packed)) chan_switch; + struct{ + u8 action_code; + u8 dialog_token; + u8 element_id; + u8 length; + struct ieee80211_msrment_ie msr_elem; + } __attribute__ ((packed)) measurement; +#endif + struct{ + u8 action_code; + u8 dialog_token; + u16 capab; + u16 timeout; + u16 start_seq_num; + } __attribute__ ((packed)) addba_req; + struct{ + u8 action_code; + u8 dialog_token; + u16 status; + u16 capab; + u16 timeout; + } __attribute__ ((packed)) addba_resp; + struct{ + u8 action_code; + u16 params; + u16 reason_code; + } __attribute__ ((packed)) delba; + struct{ + u8 action_code; + /* capab_info for open and confirm, + * reason for close + */ + u16 aux; + /* Followed in plink_confirm by status + * code, AID and supported rates, + * and directly by supported rates in + * plink_open and plink_close + */ + u8 variable[0]; + } __attribute__ ((packed)) plink_action; + struct{ + u8 action_code; + u8 variable[0]; + } __attribute__ ((packed)) mesh_action; + } __attribute__ ((packed)) u; + } __attribute__ ((packed)) action; + } __attribute__ ((packed)) u; +}__attribute__ ((packed)); + +/* mgmt header + 1 byte category code */ +#define IEEE80211_MIN_ACTION_SIZE FIELD_OFFSET(struct ieee80211_mgmt, u.action.u) + + + +#endif diff --git a/include/if_ether.h b/include/if_ether.h index 93ed096..3a7396c 100755 --- a/include/if_ether.h +++ b/include/if_ether.h @@ -1,7 +1,7 @@ /****************************************************************************** * * 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. @@ -17,13 +17,13 @@ * * ******************************************************************************/ - + #ifndef _LINUX_IF_ETHER_H #define _LINUX_IF_ETHER_H /* * IEEE 802.3 Ethernet magic constants. The frame sizes omit the preamble - * and FCS/CRC (frame check sequence). + * and FCS/CRC (frame check sequence). */ #define ETH_ALEN 6 /* Octets in one ethernet addr */ @@ -69,18 +69,18 @@ /* * Non DIX types. Won't clash for 1500 types. */ - + #define ETH_P_802_3 0x0001 /* Dummy type for 802.3 frames */ #define ETH_P_AX25 0x0002 /* Dummy protocol id for AX.25 */ #define ETH_P_ALL 0x0003 /* Every packet (be careful!!!) */ -#define ETH_P_802_2 0x0004 /* 802.2 frames */ +#define ETH_P_802_2 0x0004 /* 802.2 frames */ #define ETH_P_SNAP 0x0005 /* Internal only */ #define ETH_P_DDCMP 0x0006 /* DEC DDCMP: Internal only */ #define ETH_P_WAN_PPP 0x0007 /* Dummy type for WAN PPP frames*/ #define ETH_P_PPP_MP 0x0008 /* Dummy type for PPP MP frames */ -#define ETH_P_LOCALTALK 0x0009 /* Localtalk pseudo type */ +#define ETH_P_LOCALTALK 0x0009 /* Localtalk pseudo type */ #define ETH_P_PPPTALK 0x0010 /* Dummy type for Atalk over PPP*/ -#define ETH_P_TR_802_2 0x0011 /* 802.2 frames */ +#define ETH_P_TR_802_2 0x0011 /* 802.2 frames */ #define ETH_P_MOBITEX 0x0015 /* Mobitex (kaz@cafe.net) */ #define ETH_P_CONTROL 0x0016 /* Card specific control frames */ #define ETH_P_IRDA 0x0017 /* Linux-IrDA */ @@ -89,8 +89,8 @@ /* * This is an Ethernet frame header. */ - -struct ethhdr + +struct ethhdr { unsigned char h_dest[ETH_ALEN]; /* destination eth addr */ unsigned char h_source[ETH_ALEN]; /* source ether addr */ @@ -110,4 +110,3 @@ struct _vlan { #endif /* _LINUX_IF_ETHER_H */ - diff --git a/include/ioctl_cfg80211.h b/include/ioctl_cfg80211.h index ed62975..ea49ab5 100755 --- a/include/ioctl_cfg80211.h +++ b/include/ioctl_cfg80211.h @@ -1,176 +1,175 @@ -/****************************************************************************** - * - * 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 __IOCTL_CFG80211_H__ -#define __IOCTL_CFG80211_H__ - - -#if defined(RTW_USE_CFG80211_STA_EVENT) - #undef CONFIG_CFG80211_FORCE_COMPATIBLE_2_6_37_UNDER -#endif - -struct rtw_wdev_invit_info { - u8 state; /* 0: req, 1:rep */ - u8 peer_mac[ETH_ALEN]; - u8 active; - u8 token; - u8 flags; - u8 status; - u8 req_op_ch; - u8 rsp_op_ch; -}; - -#define rtw_wdev_invit_info_init(invit_info) \ - do { \ - (invit_info)->state = 0xff; \ - _rtw_memset((invit_info)->peer_mac, 0, ETH_ALEN); \ - (invit_info)->active = 0xff; \ - (invit_info)->token = 0; \ - (invit_info)->flags = 0x00; \ - (invit_info)->status = 0xff; \ - (invit_info)->req_op_ch = 0; \ - (invit_info)->rsp_op_ch = 0; \ - } while (0) - -struct rtw_wdev_nego_info { - u8 state; /* 0: req, 1:rep, 3:conf */ - u8 peer_mac[ETH_ALEN]; - u8 active; - u8 token; - u8 status; - u8 req_intent; - u8 req_op_ch; - u8 req_listen_ch; - u8 rsp_intent; - u8 rsp_op_ch; - u8 conf_op_ch; -}; - -#define rtw_wdev_nego_info_init(nego_info) \ - do { \ - (nego_info)->state = 0xff; \ - _rtw_memset((nego_info)->peer_mac, 0, ETH_ALEN); \ - (nego_info)->active = 0xff; \ - (nego_info)->token = 0; \ - (nego_info)->status = 0xff; \ - (nego_info)->req_intent = 0xff; \ - (nego_info)->req_op_ch = 0; \ - (nego_info)->req_listen_ch = 0; \ - (nego_info)->rsp_intent = 0xff; \ - (nego_info)->rsp_op_ch = 0; \ - (nego_info)->conf_op_ch = 0; \ - } while (0) - -struct rtw_wdev_priv -{ - struct wireless_dev *rtw_wdev; - - struct adapter *padapter; - - struct cfg80211_scan_request *scan_request; - _lock scan_req_lock; - - struct net_device *pmon_ndev;//for monitor interface - char ifname_mon[IFNAMSIZ + 1]; //interface name for monitor interface - - u8 p2p_enabled; - - u8 provdisc_req_issued; - - struct rtw_wdev_invit_info invit_info; - struct rtw_wdev_nego_info nego_info; - - u8 bandroid_scan; - bool block; - bool power_mgmt; - -#ifdef CONFIG_CONCURRENT_MODE - ATOMIC_T ro_ch_to; - ATOMIC_T switch_ch_to; -#endif - -}; - -#define wdev_to_priv(w) ((struct rtw_wdev_priv *)(wdev_priv(w))) - -#define wiphy_to_adapter(x) (struct adapter *)(((struct rtw_wdev_priv*)wiphy_priv(x))->padapter) - -#define wiphy_to_wdev(x) (struct wireless_dev *)(((struct rtw_wdev_priv*)wiphy_priv(x))->rtw_wdev) - -int rtw_wdev_alloc(struct adapter *padapter, struct device *dev); -void rtw_wdev_free(struct wireless_dev *wdev); -void rtw_wdev_unregister(struct wireless_dev *wdev); - -void rtw_cfg80211_init_wiphy(struct adapter *padapter); - -void rtw_cfg80211_surveydone_event_callback(struct adapter *padapter); -struct cfg80211_bss *rtw_cfg80211_inform_bss(struct adapter *padapter, struct wlan_network *pnetwork); -int rtw_cfg80211_check_bss(struct adapter *padapter); -void rtw_cfg80211_ibss_indicate_connect(struct adapter *padapter); -void rtw_cfg80211_indicate_connect(struct adapter *padapter); -void rtw_cfg80211_indicate_disconnect(struct adapter *padapter); -void rtw_cfg80211_indicate_scan_done(struct rtw_wdev_priv *pwdev_priv, bool aborted); - -#ifdef CONFIG_AP_MODE -void rtw_cfg80211_indicate_sta_assoc(struct adapter *padapter, u8 *pmgmt_frame, uint frame_len); -void rtw_cfg80211_indicate_sta_disassoc(struct adapter *padapter, unsigned char *da, unsigned short reason); -#endif //CONFIG_AP_MODE - -void rtw_cfg80211_issue_p2p_provision_request(struct adapter *padapter, const u8 *buf, size_t len); -void rtw_cfg80211_rx_p2p_action_public(struct adapter *padapter, u8 *pmgmt_frame, uint frame_len); -void rtw_cfg80211_rx_action_p2p(struct adapter *padapter, u8 *pmgmt_frame, uint frame_len); -void rtw_cfg80211_rx_action(struct adapter *adapter, u8 *frame, uint frame_len, const char*msg); - -int rtw_cfg80211_set_mgnt_wpsp2pie(struct net_device *net, char *buf, int len, int type); - -bool rtw_cfg80211_pwr_mgmt(struct adapter *adapter); - -#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) && !defined(COMPAT_KERNEL_RELEASE) -#define rtw_cfg80211_rx_mgmt(adapter, freq, sig_dbm, buf, len, gfp) cfg80211_rx_mgmt((adapter)->pnetdev, freq, buf, len, gfp) -#elif (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)) -#define rtw_cfg80211_rx_mgmt(adapter, freq, sig_dbm, buf, len, gfp) cfg80211_rx_mgmt((adapter)->pnetdev, freq, sig_dbm, buf, len, gfp) -#else -#define rtw_cfg80211_rx_mgmt(adapter, freq, sig_dbm, buf, len, gfp) cfg80211_rx_mgmt((adapter)->rtw_wdev, freq, sig_dbm, buf, len, gfp) -#endif - -#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) && !defined(COMPAT_KERNEL_RELEASE) -#define rtw_cfg80211_send_rx_assoc(adapter, bss, buf, len) cfg80211_send_rx_assoc((adapter)->pnetdev, buf, len) -#else -#define rtw_cfg80211_send_rx_assoc(adapter, bss, buf, len) cfg80211_send_rx_assoc((adapter)->pnetdev, bss, buf, len) -#endif - -#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)) -#define rtw_cfg80211_mgmt_tx_status(adapter, cookie, buf, len, ack, gfp) cfg80211_mgmt_tx_status((adapter)->pnetdev, cookie, buf, len, ack, gfp) -#else -#define rtw_cfg80211_mgmt_tx_status(adapter, cookie, buf, len, ack, gfp) cfg80211_mgmt_tx_status((adapter)->rtw_wdev, cookie, buf, len, ack, gfp) -#endif - -#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)) -#define rtw_cfg80211_ready_on_channel(adapter, cookie, chan, channel_type, duration, gfp) cfg80211_ready_on_channel((adapter)->pnetdev, cookie, chan, channel_type, duration, gfp) -#define rtw_cfg80211_remain_on_channel_expired(adapter, cookie, chan, chan_type, gfp) cfg80211_remain_on_channel_expired((adapter)->pnetdev, cookie, chan, chan_type, gfp) -#elif (LINUX_VERSION_CODE < KERNEL_VERSION(3,8,0)) -#define rtw_cfg80211_ready_on_channel(adapter, cookie, chan, channel_type, duration, gfp) cfg80211_ready_on_channel((adapter)->rtw_wdev, cookie, chan, channel_type, duration, gfp) -#define rtw_cfg80211_remain_on_channel_expired(adapter, cookie, chan, chan_type, gfp) cfg80211_remain_on_channel_expired((adapter)->rtw_wdev, cookie, chan, chan_type, gfp) -#else -#define rtw_cfg80211_ready_on_channel(adapter, cookie, chan, channel_type, duration, gfp) cfg80211_ready_on_channel((adapter)->rtw_wdev, cookie, chan, duration, gfp) -#define rtw_cfg80211_remain_on_channel_expired(adapter, cookie, chan, chan_type, gfp) cfg80211_remain_on_channel_expired((adapter)->rtw_wdev, cookie, chan, gfp) -#endif - -#endif //__IOCTL_CFG80211_H__ - +/****************************************************************************** + * + * 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 __IOCTL_CFG80211_H__ +#define __IOCTL_CFG80211_H__ + + +#if defined(RTW_USE_CFG80211_STA_EVENT) + #undef CONFIG_CFG80211_FORCE_COMPATIBLE_2_6_37_UNDER +#endif + +struct rtw_wdev_invit_info { + u8 state; /* 0: req, 1:rep */ + u8 peer_mac[ETH_ALEN]; + u8 active; + u8 token; + u8 flags; + u8 status; + u8 req_op_ch; + u8 rsp_op_ch; +}; + +#define rtw_wdev_invit_info_init(invit_info) \ + do { \ + (invit_info)->state = 0xff; \ + _rtw_memset((invit_info)->peer_mac, 0, ETH_ALEN); \ + (invit_info)->active = 0xff; \ + (invit_info)->token = 0; \ + (invit_info)->flags = 0x00; \ + (invit_info)->status = 0xff; \ + (invit_info)->req_op_ch = 0; \ + (invit_info)->rsp_op_ch = 0; \ + } while (0) + +struct rtw_wdev_nego_info { + u8 state; /* 0: req, 1:rep, 3:conf */ + u8 peer_mac[ETH_ALEN]; + u8 active; + u8 token; + u8 status; + u8 req_intent; + u8 req_op_ch; + u8 req_listen_ch; + u8 rsp_intent; + u8 rsp_op_ch; + u8 conf_op_ch; +}; + +#define rtw_wdev_nego_info_init(nego_info) \ + do { \ + (nego_info)->state = 0xff; \ + _rtw_memset((nego_info)->peer_mac, 0, ETH_ALEN); \ + (nego_info)->active = 0xff; \ + (nego_info)->token = 0; \ + (nego_info)->status = 0xff; \ + (nego_info)->req_intent = 0xff; \ + (nego_info)->req_op_ch = 0; \ + (nego_info)->req_listen_ch = 0; \ + (nego_info)->rsp_intent = 0xff; \ + (nego_info)->rsp_op_ch = 0; \ + (nego_info)->conf_op_ch = 0; \ + } while (0) + +struct rtw_wdev_priv +{ + struct wireless_dev *rtw_wdev; + + struct adapter *padapter; + + struct cfg80211_scan_request *scan_request; + _lock scan_req_lock; + + struct net_device *pmon_ndev;//for monitor interface + char ifname_mon[IFNAMSIZ + 1]; //interface name for monitor interface + + u8 p2p_enabled; + + u8 provdisc_req_issued; + + struct rtw_wdev_invit_info invit_info; + struct rtw_wdev_nego_info nego_info; + + u8 bandroid_scan; + bool block; + bool power_mgmt; + +#ifdef CONFIG_CONCURRENT_MODE + ATOMIC_T ro_ch_to; + ATOMIC_T switch_ch_to; +#endif + +}; + +#define wdev_to_priv(w) ((struct rtw_wdev_priv *)(wdev_priv(w))) + +#define wiphy_to_adapter(x) (struct adapter *)(((struct rtw_wdev_priv*)wiphy_priv(x))->padapter) + +#define wiphy_to_wdev(x) (struct wireless_dev *)(((struct rtw_wdev_priv*)wiphy_priv(x))->rtw_wdev) + +int rtw_wdev_alloc(struct adapter *padapter, struct device *dev); +void rtw_wdev_free(struct wireless_dev *wdev); +void rtw_wdev_unregister(struct wireless_dev *wdev); + +void rtw_cfg80211_init_wiphy(struct adapter *padapter); + +void rtw_cfg80211_surveydone_event_callback(struct adapter *padapter); +struct cfg80211_bss *rtw_cfg80211_inform_bss(struct adapter *padapter, struct wlan_network *pnetwork); +int rtw_cfg80211_check_bss(struct adapter *padapter); +void rtw_cfg80211_ibss_indicate_connect(struct adapter *padapter); +void rtw_cfg80211_indicate_connect(struct adapter *padapter); +void rtw_cfg80211_indicate_disconnect(struct adapter *padapter); +void rtw_cfg80211_indicate_scan_done(struct rtw_wdev_priv *pwdev_priv, bool aborted); + +#ifdef CONFIG_AP_MODE +void rtw_cfg80211_indicate_sta_assoc(struct adapter *padapter, u8 *pmgmt_frame, uint frame_len); +void rtw_cfg80211_indicate_sta_disassoc(struct adapter *padapter, unsigned char *da, unsigned short reason); +#endif //CONFIG_AP_MODE + +void rtw_cfg80211_issue_p2p_provision_request(struct adapter *padapter, const u8 *buf, size_t len); +void rtw_cfg80211_rx_p2p_action_public(struct adapter *padapter, u8 *pmgmt_frame, uint frame_len); +void rtw_cfg80211_rx_action_p2p(struct adapter *padapter, u8 *pmgmt_frame, uint frame_len); +void rtw_cfg80211_rx_action(struct adapter *adapter, u8 *frame, uint frame_len, const char*msg); + +int rtw_cfg80211_set_mgnt_wpsp2pie(struct net_device *net, char *buf, int len, int type); + +bool rtw_cfg80211_pwr_mgmt(struct adapter *adapter); + +#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) && !defined(COMPAT_KERNEL_RELEASE) +#define rtw_cfg80211_rx_mgmt(adapter, freq, sig_dbm, buf, len, gfp) cfg80211_rx_mgmt((adapter)->pnetdev, freq, buf, len, gfp) +#elif (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)) +#define rtw_cfg80211_rx_mgmt(adapter, freq, sig_dbm, buf, len, gfp) cfg80211_rx_mgmt((adapter)->pnetdev, freq, sig_dbm, buf, len, gfp) +#else +#define rtw_cfg80211_rx_mgmt(adapter, freq, sig_dbm, buf, len, gfp) cfg80211_rx_mgmt((adapter)->rtw_wdev, freq, sig_dbm, buf, len, gfp) +#endif + +#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) && !defined(COMPAT_KERNEL_RELEASE) +#define rtw_cfg80211_send_rx_assoc(adapter, bss, buf, len) cfg80211_send_rx_assoc((adapter)->pnetdev, buf, len) +#else +#define rtw_cfg80211_send_rx_assoc(adapter, bss, buf, len) cfg80211_send_rx_assoc((adapter)->pnetdev, bss, buf, len) +#endif + +#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)) +#define rtw_cfg80211_mgmt_tx_status(adapter, cookie, buf, len, ack, gfp) cfg80211_mgmt_tx_status((adapter)->pnetdev, cookie, buf, len, ack, gfp) +#else +#define rtw_cfg80211_mgmt_tx_status(adapter, cookie, buf, len, ack, gfp) cfg80211_mgmt_tx_status((adapter)->rtw_wdev, cookie, buf, len, ack, gfp) +#endif + +#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)) +#define rtw_cfg80211_ready_on_channel(adapter, cookie, chan, channel_type, duration, gfp) cfg80211_ready_on_channel((adapter)->pnetdev, cookie, chan, channel_type, duration, gfp) +#define rtw_cfg80211_remain_on_channel_expired(adapter, cookie, chan, chan_type, gfp) cfg80211_remain_on_channel_expired((adapter)->pnetdev, cookie, chan, chan_type, gfp) +#elif (LINUX_VERSION_CODE < KERNEL_VERSION(3,8,0)) +#define rtw_cfg80211_ready_on_channel(adapter, cookie, chan, channel_type, duration, gfp) cfg80211_ready_on_channel((adapter)->rtw_wdev, cookie, chan, channel_type, duration, gfp) +#define rtw_cfg80211_remain_on_channel_expired(adapter, cookie, chan, chan_type, gfp) cfg80211_remain_on_channel_expired((adapter)->rtw_wdev, cookie, chan, chan_type, gfp) +#else +#define rtw_cfg80211_ready_on_channel(adapter, cookie, chan, channel_type, duration, gfp) cfg80211_ready_on_channel((adapter)->rtw_wdev, cookie, chan, duration, gfp) +#define rtw_cfg80211_remain_on_channel_expired(adapter, cookie, chan, chan_type, gfp) cfg80211_remain_on_channel_expired((adapter)->rtw_wdev, cookie, chan, gfp) +#endif + +#endif //__IOCTL_CFG80211_H__ diff --git a/include/ip.h b/include/ip.h index 6e60fde..dc57bdb 100755 --- a/include/ip.h +++ b/include/ip.h @@ -1,7 +1,7 @@ /****************************************************************************** * * 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. @@ -101,7 +101,7 @@ struct ip_options { is_data:1, /* Options in __data, rather than skb */ is_strictroute:1, /* Strict source route */ srr_is_hit:1, /* Packet destination addr was our one */ - is_changed:1, /* IP checksum more not valid */ + is_changed:1, /* IP checksum more not valid */ rr_needaddr:1, /* Need to record addr of outgoing dev */ ts_needtime:1, /* Need to record timestamp */ ts_needaddr:1; /* Need to record addr of outgoing dev */ @@ -119,7 +119,7 @@ struct iphdr { version:4; #elif defined (__BIG_ENDIAN_BITFIELD) __u8 version:4, - ihl:4; + ihl:4; #else #error "Please fix " #endif @@ -136,4 +136,3 @@ struct iphdr { }; #endif /* _LINUX_IP_H */ - diff --git a/include/mlme_osdep.h b/include/mlme_osdep.h index 710077b..f5f10dd 100755 --- a/include/mlme_osdep.h +++ b/include/mlme_osdep.h @@ -1,7 +1,7 @@ /****************************************************************************** * * 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. @@ -37,4 +37,3 @@ extern void rtw_report_sec_ie(struct adapter *adapter,u8 authmode,u8 *sec_ie); void rtw_reset_securitypriv( struct adapter *adapter ); #endif //_MLME_OSDEP_H_ - diff --git a/include/mp_custom_oid.h b/include/mp_custom_oid.h index 9cf1c82..7d52831 100755 --- a/include/mp_custom_oid.h +++ b/include/mp_custom_oid.h @@ -1,7 +1,7 @@ /****************************************************************************** * * 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. @@ -38,7 +38,7 @@ #define OID_RT_PRO_RESET_DUT 0xFF818000 #define OID_RT_PRO_SET_DATA_RATE 0xFF818001 #define OID_RT_PRO_START_TEST 0xFF818002 -#define OID_RT_PRO_STOP_TEST 0xFF818003 +#define OID_RT_PRO_STOP_TEST 0xFF818003 #define OID_RT_PRO_SET_PREAMBLE 0xFF818004 #define OID_RT_PRO_SET_SCRAMBLER 0xFF818005 #define OID_RT_PRO_SET_FILTER_BB 0xFF818006 @@ -71,7 +71,7 @@ #define OID_RT_PRO_READ_EEPROM 0xFF818022 #define OID_RT_PRO_RESET_TX_PACKET_SENT 0xFF818023 #define OID_RT_PRO_QUERY_TX_PACKET_SENT 0xFF818024 -#define OID_RT_PRO_RESET_RX_PACKET_RECEIVED 0xFF818025 +#define OID_RT_PRO_RESET_RX_PACKET_RECEIVED 0xFF818025 #define OID_RT_PRO_QUERY_RX_PACKET_RECEIVED 0xFF818026 #define OID_RT_PRO_QUERY_RX_PACKET_CRC32_ERROR 0xFF818027 #define OID_RT_PRO_QUERY_CURRENT_ADDRESS 0xFF818028 @@ -84,7 +84,7 @@ #define OID_RT_PRO_SET_MODULATION 0xFF81802F // -//Sean +//Sean #define OID_RT_DRIVER_OPTION 0xFF818080 #define OID_RT_RF_OFF 0xFF818081 #define OID_RT_AUTH_STATUS 0xFF818082 @@ -114,15 +114,15 @@ #define OID_RT_WIRELESS_MODE_STARTING_ADHOC 0xFF818503 // -#define OID_RT_GET_CONNECT_STATE 0xFF030001 -#define OID_RT_RESCAN 0xFF030002 +#define OID_RT_GET_CONNECT_STATE 0xFF030001 +#define OID_RT_RESCAN 0xFF030002 #define OID_RT_SET_KEY_LENGTH 0xFF030003 #define OID_RT_SET_DEFAULT_KEY_ID 0xFF030004 #define OID_RT_SET_CHANNEL 0xFF010182 -#define OID_RT_SET_SNIFFER_MODE 0xFF010183 -#define OID_RT_GET_SIGNAL_QUALITY 0xFF010184 -#define OID_RT_GET_SMALL_PACKET_CRC 0xFF010185 +#define OID_RT_SET_SNIFFER_MODE 0xFF010183 +#define OID_RT_GET_SIGNAL_QUALITY 0xFF010184 +#define OID_RT_GET_SMALL_PACKET_CRC 0xFF010185 #define OID_RT_GET_MIDDLE_PACKET_CRC 0xFF010186 #define OID_RT_GET_LARGE_PACKET_CRC 0xFF010187 #define OID_RT_GET_TX_RETRY 0xFF010188 @@ -239,8 +239,8 @@ #define OID_RT_PRO_READ_REGISTER 0xFF871101 //Q #define OID_RT_PRO_WRITE_REGISTER 0xFF871102 //S -#define OID_RT_PRO_BURST_READ_REGISTER 0xFF871103 //Q -#define OID_RT_PRO_BURST_WRITE_REGISTER 0xFF871104 //S +#define OID_RT_PRO_BURST_READ_REGISTER 0xFF871103 //Q +#define OID_RT_PRO_BURST_WRITE_REGISTER 0xFF871104 //S #define OID_RT_PRO_WRITE_TXCMD 0xFF871105 //S @@ -283,9 +283,9 @@ #define OID_RT_PRO_READ_TSSI 0xFF871123//S #define OID_RT_PRO_SET_POWER_TRACKING 0xFF871124//S - + #define OID_RT_PRO_QRY_PWRSTATE 0xFF871150 //Q -#define OID_RT_PRO_SET_PWRSTATE 0xFF871151 //S +#define OID_RT_PRO_SET_PWRSTATE 0xFF871151 //S //Method 2 , using workitem #define OID_RT_SET_READ_REG 0xFF871181 //S @@ -299,7 +299,7 @@ //For SDIO INTERFACE only #define OID_RT_PRO_SYNCPAGERW_SRAM 0xFF8711A0 //Q, S -#define OID_RT_PRO_871X_DRV_EXT 0xFF8711A1 +#define OID_RT_PRO_871X_DRV_EXT 0xFF8711A1 //For USB INTERFACE only #define OID_RT_PRO_USB_VENDOR_REQ 0xFF8711B0 //Q, S @@ -314,8 +314,8 @@ #define OID_RT_PRO_ENCRYPTION_CTRL 0xFF871200 //Q, S #define OID_RT_PRO_ADD_STA_INFO 0xFF871201 //S -#define OID_RT_PRO_DELE_STA_INFO 0xFF871202 //S -#define OID_RT_PRO_QUERY_DR_VARIABLE 0xFF871203 //Q +#define OID_RT_PRO_DELE_STA_INFO 0xFF871202 //S +#define OID_RT_PRO_QUERY_DR_VARIABLE 0xFF871203 //Q #define OID_RT_PRO_RX_PACKET_TYPE 0xFF871204 //Q, S @@ -327,7 +327,7 @@ #define OID_RT_SET_BANDWIDTH 0xFF871209 //S #define OID_RT_SET_CRYSTAL_CAP 0xFF87120A //S -#define OID_RT_SET_RX_PACKET_TYPE 0xFF87120B //S +#define OID_RT_SET_RX_PACKET_TYPE 0xFF87120B //S #define OID_RT_GET_EFUSE_MAX_SIZE 0xFF87120C //Q @@ -351,4 +351,3 @@ #define OID_RT_PRO_EFUSE_MAP 0xFF871217 //Q, S #endif //#ifndef __CUSTOM_OID_H - diff --git a/include/nic_spec.h b/include/nic_spec.h index 18e7b2c..fba5e56 100755 --- a/include/nic_spec.h +++ b/include/nic_spec.h @@ -1,7 +1,7 @@ /****************************************************************************** * * 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. @@ -16,7 +16,7 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA * * - ******************************************************************************/ + ******************************************************************************/ #ifndef __NIC_SPEC_H__ @@ -44,4 +44,3 @@ #endif // __RTL8711_SPEC_H__ - diff --git a/include/odm.h b/include/odm.h index c07e90f..1230a06 100644 --- a/include/odm.h +++ b/include/odm.h @@ -452,7 +452,7 @@ enum odm_ability_def { ODM_RF_CALIBRATION = BIT26, }; -/* ODM_CMNINFO_INTERFACE */ +/* ODM_CMNINFO_INTERFACE */ enum odm_interface_def { ODM_ITRF_PCIE = 0x1, ODM_ITRF_USB = 0x2, @@ -578,7 +578,7 @@ enum odm_security { ODM_SEC_RESERVE = 3, ODM_SEC_AESCCMP = 4, ODM_SEC_WEP104 = 5, - ODM_WEP_WPA_MIXED = 6, /* WEP + WPA */ + ODM_WEP_WPA_MIXED = 6, /* WEP + WPA */ ODM_SEC_SMS4 = 7, }; @@ -758,7 +758,7 @@ enum ant_div_type { /* Copy from SD4 defined structure. We use to support PHY DM integration. */ struct odm_dm_struct { - /* Add for different team use temporarily */ + /* Add for different team use temporarily */ struct adapter *Adapter; /* For CE/NIC team */ struct rtl8192cd_priv *priv; /* For AP/ADSL team */ /* WHen you use above pointers, they must be initialized. */ diff --git a/include/osdep_ce_service.h b/include/osdep_ce_service.h index 6d2cc48..a747ed0 100755 --- a/include/osdep_ce_service.h +++ b/include/osdep_ce_service.h @@ -1,7 +1,7 @@ /****************************************************************************** * * 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. @@ -16,156 +16,155 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA * * - ******************************************************************************/ - -#ifndef __OSDEP_CE_SERVICE_H_ -#define __OSDEP_CE_SERVICE_H_ - - -#include -#include - -#ifdef CONFIG_SDIO_HCI -#include "SDCardDDK.h" -#endif - -#ifdef CONFIG_USB_HCI -#include -#endif - -typedef HANDLE _sema; -typedef LIST_ENTRY _list; -typedef NDIS_STATUS _OS_STATUS; - -typedef NDIS_SPIN_LOCK _lock; - -typedef HANDLE _rwlock; //Mutex - -typedef u32 _irqL; - -typedef NDIS_HANDLE _nic_hdl; - - -typedef NDIS_MINIPORT_TIMER _timer; - -struct __queue { - LIST_ENTRY queue; - _lock lock; -}; - -typedef NDIS_PACKET _pkt; -typedef NDIS_BUFFER _buffer; -typedef struct __queue _queue; - -typedef HANDLE _thread_hdl_; -typedef DWORD thread_return; -typedef void* thread_context; -typedef NDIS_WORK_ITEM _workitem; - -#define thread_exit() ExitThread(STATUS_SUCCESS); return 0; - - -#define SEMA_UPBND (0x7FFFFFFF) //8192 - -__inline static _list *get_prev(_list *list) -{ - return list->Blink; -} - -__inline static _list *get_next(_list *list) -{ - return list->Flink; -} - -__inline static _list *get_list_head(_queue *queue) -{ - return (&(queue->queue)); -} - -#define LIST_CONTAINOR(ptr, type, member) CONTAINING_RECORD(ptr, type, member) - -__inline static void _enter_critical(_lock *plock, _irqL *pirqL) -{ - NdisAcquireSpinLock(plock); -} - -__inline static void _exit_critical(_lock *plock, _irqL *pirqL) -{ - NdisReleaseSpinLock(plock); -} - -__inline static _enter_critical_ex(_lock *plock, _irqL *pirqL) -{ - NdisDprAcquireSpinLock(plock); -} - -__inline static _exit_critical_ex(_lock *plock, _irqL *pirqL) -{ - NdisDprReleaseSpinLock(plock); -} - - -__inline static void _enter_hwio_critical(_rwlock *prwlock, _irqL *pirqL) -{ - WaitForSingleObject(*prwlock, INFINITE ); - -} - -__inline static void _exit_hwio_critical(_rwlock *prwlock, _irqL *pirqL) -{ - ReleaseMutex(*prwlock); -} - -__inline static void rtw_list_delete(_list *plist) -{ - RemoveEntryList(plist); - InitializeListHead(plist); -} - -__inline static void _init_timer(_timer *ptimer,_nic_hdl nic_hdl,void *pfunc,PVOID cntx) -{ - NdisMInitializeTimer(ptimer, nic_hdl, pfunc, cntx); -} - -__inline static void _set_timer(_timer *ptimer,u32 delay_time) -{ - NdisMSetTimer(ptimer,delay_time); -} - -__inline static void _cancel_timer(_timer *ptimer,u8 *bcancelled) -{ - NdisMCancelTimer(ptimer,bcancelled); -} - -__inline static void _init_workitem(_workitem *pwork, void *pfunc, PVOID cntx) -{ - - NdisInitializeWorkItem(pwork, pfunc, cntx); -} - -__inline static void _set_workitem(_workitem *pwork) -{ - NdisScheduleWorkItem(pwork); -} - -#define ATOMIC_INIT(i) { (i) } - -// -// Global Mutex: can only be used at PASSIVE level. -// - -#define ACQUIRE_GLOBAL_MUTEX(_MutexCounter) \ -{ \ - while (NdisInterlockedIncrement((PULONG)&(_MutexCounter)) != 1)\ - { \ - NdisInterlockedDecrement((PULONG)&(_MutexCounter)); \ - NdisMSleep(10000); \ - } \ -} - -#define RELEASE_GLOBAL_MUTEX(_MutexCounter) \ -{ \ - NdisInterlockedDecrement((PULONG)&(_MutexCounter)); \ -} -#endif - + ******************************************************************************/ + +#ifndef __OSDEP_CE_SERVICE_H_ +#define __OSDEP_CE_SERVICE_H_ + + +#include +#include + +#ifdef CONFIG_SDIO_HCI +#include "SDCardDDK.h" +#endif + +#ifdef CONFIG_USB_HCI +#include +#endif + +typedef HANDLE _sema; +typedef LIST_ENTRY _list; +typedef NDIS_STATUS _OS_STATUS; + +typedef NDIS_SPIN_LOCK _lock; + +typedef HANDLE _rwlock; //Mutex + +typedef u32 _irqL; + +typedef NDIS_HANDLE _nic_hdl; + + +typedef NDIS_MINIPORT_TIMER _timer; + +struct __queue { + LIST_ENTRY queue; + _lock lock; +}; + +typedef NDIS_PACKET _pkt; +typedef NDIS_BUFFER _buffer; +typedef struct __queue _queue; + +typedef HANDLE _thread_hdl_; +typedef DWORD thread_return; +typedef void* thread_context; +typedef NDIS_WORK_ITEM _workitem; + +#define thread_exit() ExitThread(STATUS_SUCCESS); return 0; + + +#define SEMA_UPBND (0x7FFFFFFF) //8192 + +__inline static _list *get_prev(_list *list) +{ + return list->Blink; +} + +__inline static _list *get_next(_list *list) +{ + return list->Flink; +} + +__inline static _list *get_list_head(_queue *queue) +{ + return (&(queue->queue)); +} + +#define LIST_CONTAINOR(ptr, type, member) CONTAINING_RECORD(ptr, type, member) + +__inline static void _enter_critical(_lock *plock, _irqL *pirqL) +{ + NdisAcquireSpinLock(plock); +} + +__inline static void _exit_critical(_lock *plock, _irqL *pirqL) +{ + NdisReleaseSpinLock(plock); +} + +__inline static _enter_critical_ex(_lock *plock, _irqL *pirqL) +{ + NdisDprAcquireSpinLock(plock); +} + +__inline static _exit_critical_ex(_lock *plock, _irqL *pirqL) +{ + NdisDprReleaseSpinLock(plock); +} + + +__inline static void _enter_hwio_critical(_rwlock *prwlock, _irqL *pirqL) +{ + WaitForSingleObject(*prwlock, INFINITE ); + +} + +__inline static void _exit_hwio_critical(_rwlock *prwlock, _irqL *pirqL) +{ + ReleaseMutex(*prwlock); +} + +__inline static void rtw_list_delete(_list *plist) +{ + RemoveEntryList(plist); + InitializeListHead(plist); +} + +__inline static void _init_timer(_timer *ptimer,_nic_hdl nic_hdl,void *pfunc,PVOID cntx) +{ + NdisMInitializeTimer(ptimer, nic_hdl, pfunc, cntx); +} + +__inline static void _set_timer(_timer *ptimer,u32 delay_time) +{ + NdisMSetTimer(ptimer,delay_time); +} + +__inline static void _cancel_timer(_timer *ptimer,u8 *bcancelled) +{ + NdisMCancelTimer(ptimer,bcancelled); +} + +__inline static void _init_workitem(_workitem *pwork, void *pfunc, PVOID cntx) +{ + + NdisInitializeWorkItem(pwork, pfunc, cntx); +} + +__inline static void _set_workitem(_workitem *pwork) +{ + NdisScheduleWorkItem(pwork); +} + +#define ATOMIC_INIT(i) { (i) } + +// +// Global Mutex: can only be used at PASSIVE level. +// + +#define ACQUIRE_GLOBAL_MUTEX(_MutexCounter) \ +{ \ + while (NdisInterlockedIncrement((PULONG)&(_MutexCounter)) != 1)\ + { \ + NdisInterlockedDecrement((PULONG)&(_MutexCounter)); \ + NdisMSleep(10000); \ + } \ +} + +#define RELEASE_GLOBAL_MUTEX(_MutexCounter) \ +{ \ + NdisInterlockedDecrement((PULONG)&(_MutexCounter)); \ +} +#endif diff --git a/include/osdep_intf.h b/include/osdep_intf.h index dfad5d5..76e59bf 100755 --- a/include/osdep_intf.h +++ b/include/osdep_intf.h @@ -1,7 +1,7 @@ /****************************************************************************** * * 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. @@ -26,9 +26,9 @@ #include struct intf_priv { - + u8 *intf_dev; - u32 max_iosz; //USB2.0: 128, USB1.1: 64, SDIO:64 + u32 max_iosz; //USB2.0: 128, USB1.1: 64, SDIO:64 u32 max_xmitsz; //USB2.0: unlimited, SDIO:512 u32 max_recvsz; //USB2.0: unlimited, SDIO:512 @@ -36,9 +36,9 @@ struct intf_priv { volatile u8 *allocated_io_rwmem; u32 io_wsz; //unit: 4bytes u32 io_rsz;//unit: 4bytes - u8 intf_status; - - void (*_bus_io)(u8 *priv); + u8 intf_status; + + void (*_bus_io)(u8 *priv); /* Under Sync. IRP (SDIO/USB) @@ -50,10 +50,10 @@ The protection mechanism is through the pending queue. _mutex ioctl_mutex; - - #ifdef CONFIG_USB_HCI + + #ifdef CONFIG_USB_HCI // when in USB, IO is through interrupt in/out endpoints - struct usb_device *udev; + struct usb_device *udev; PURB piorw_urb; u8 io_irp_cnt; u8 bio_irp_pending; @@ -62,7 +62,7 @@ The protection mechanism is through the pending queue. u8 bio_irp_timeout; u8 bio_timer_cancel; #endif -}; +}; #ifdef CONFIG_R871X_TEST int rtw_start_pseudo_adhoc(struct adapter *padapter); @@ -126,4 +126,3 @@ int rtw_gw_addr_query(struct adapter *padapter); #endif #endif //_OSDEP_INTF_H_ - diff --git a/include/osdep_service.h b/include/osdep_service.h index d5a8ea7..567fafe 100755 --- a/include/osdep_service.h +++ b/include/osdep_service.h @@ -1,7 +1,7 @@ /****************************************************************************** * * 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. @@ -34,7 +34,7 @@ #undef _FALSE #define _FALSE 0 - + #include #include @@ -77,10 +77,10 @@ #include #include -#ifdef CONFIG_IOCTL_CFG80211 -// #include +#ifdef CONFIG_IOCTL_CFG80211 +// #include #include - #include + #include #endif //CONFIG_IOCTL_CFG80211 #ifdef CONFIG_TCP_CSUM_OFFLOAD_TX @@ -103,7 +103,7 @@ #ifdef CONFIG_TX_MCAST2UNI extern int rtw_mc2u_disable; -#endif // CONFIG_TX_MCAST2UNI +#endif // CONFIG_TX_MCAST2UNI extern char* rtw_initmac; @@ -139,30 +139,30 @@ extern int pm_netdev_open(struct net_device *pnetdev,u8 bnormal); #endif #endif - typedef struct semaphore _sema; + typedef struct semaphore _sema; typedef spinlock_t _lock; #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) - typedef struct mutex _mutex; + typedef struct mutex _mutex; #else typedef struct semaphore _mutex; #endif typedef struct timer_list _timer; struct __queue { - struct list_head queue; + struct list_head queue; _lock lock; }; typedef struct sk_buff _pkt; typedef unsigned char _buffer; - + typedef struct __queue _queue; typedef struct list_head _list; typedef int _OS_STATUS; //typedef u32 _irqL; typedef unsigned long _irqL; typedef struct net_device * _nic_hdl; - + typedef void* _thread_hdl_; typedef int thread_return; typedef void* thread_context; @@ -203,18 +203,18 @@ static inline unsigned char *skb_end_pointer(const struct sk_buff *skb) __inline static _list *get_next(_list *list) { return list->next; -} +} __inline static _list *get_list_head(_queue *queue) { return (&(queue->queue)); } - -#define LIST_CONTAINOR(ptr, type, member) \ - ((type *)((char *)(ptr)-(SIZE_T)(&((type *)0)->member))) - +#define LIST_CONTAINOR(ptr, type, member) \ + ((type *)((char *)(ptr)-(SIZE_T)(&((type *)0)->member))) + + __inline static void _enter_critical(_lock *plock, _irqL *pirqL) { spin_lock_irqsave(plock, *pirqL); @@ -274,20 +274,20 @@ __inline static void rtw_list_delete(_list *plist) __inline static void _init_timer(_timer *ptimer,_nic_hdl nic_hdl,void *pfunc,void* cntx) { - //setup_timer(ptimer, pfunc,(u32)cntx); + //setup_timer(ptimer, pfunc,(u32)cntx); ptimer->function = pfunc; ptimer->data = (unsigned long)cntx; init_timer(ptimer); } __inline static void _set_timer(_timer *ptimer,u32 delay_time) -{ - mod_timer(ptimer , (jiffies+(delay_time*HZ/1000))); +{ + mod_timer(ptimer , (jiffies+(delay_time*HZ/1000))); } __inline static void _cancel_timer(_timer *ptimer,u8 *bcancelled) { - del_timer_sync(ptimer); + del_timer_sync(ptimer); *bcancelled= _TRUE;//TRUE ==1; FALSE==0 } @@ -617,7 +617,7 @@ extern void rtw_sleep_schedulable(int ms); extern void rtw_msleep_os(int ms); extern void rtw_usleep_os(int us); -extern u32 rtw_atoi(u8* s); +extern u32 rtw_atoi(u8* s); #ifdef DBG_DELAY_OS #define rtw_mdelay_os(ms) _rtw_mdelay_os((ms), __FUNCTION__, __LINE__) @@ -645,9 +645,9 @@ static __inline void thread_enter(char *name) allow_signal(SIGTERM); } -__inline static void flush_signals_thread(void) +__inline static void flush_signals_thread(void) { - if (signal_pending (current)) + if (signal_pending (current)) { flush_signals(current); } @@ -674,7 +674,7 @@ __inline static u32 _RND4(u32 sz) u32 val; val = ((sz >> 2) + ((sz & 3) ? 1: 0)) << 2; - + return val; } @@ -685,7 +685,7 @@ __inline static u32 _RND8(u32 sz) u32 val; val = ((sz >> 3) + ((sz & 7) ? 1: 0)) << 3; - + return val; } @@ -696,7 +696,7 @@ __inline static u32 _RND128(u32 sz) u32 val; val = ((sz >> 7) + ((sz & 127) ? 1: 0)) << 7; - + return val; } @@ -707,7 +707,7 @@ __inline static u32 _RND256(u32 sz) u32 val; val = ((sz >> 8) + ((sz & 255) ? 1: 0)) << 8; - + return val; } @@ -718,7 +718,7 @@ __inline static u32 _RND512(u32 sz) u32 val; val = ((sz >> 9) + ((sz & 511) ? 1: 0)) << 9; - + return val; } @@ -829,7 +829,7 @@ extern u64 rtw_division64(u64 x, u64 y); } while (0) #define RTW_GET_BE24(a) ((((u32) (a)[0]) << 16) | (((u32) (a)[1]) << 8) | \ - ((u32) (a)[2])) + ((u32) (a)[2])) #define RTW_PUT_BE24(a, val) \ do { \ (a)[0] = (u8) ((((u32) (val)) >> 16) & 0xff); \ @@ -838,7 +838,7 @@ extern u64 rtw_division64(u64 x, u64 y); } while (0) #define RTW_GET_BE32(a) ((((u32) (a)[0]) << 24) | (((u32) (a)[1]) << 16) | \ - (((u32) (a)[2]) << 8) | ((u32) (a)[3])) + (((u32) (a)[2]) << 8) | ((u32) (a)[3])) #define RTW_PUT_BE32(a, val) \ do { \ (a)[0] = (u8) ((((u32) (val)) >> 24) & 0xff); \ @@ -848,7 +848,7 @@ extern u64 rtw_division64(u64 x, u64 y); } while (0) #define RTW_GET_LE32(a) ((((u32) (a)[3]) << 24) | (((u32) (a)[2]) << 16) | \ - (((u32) (a)[1]) << 8) | ((u32) (a)[0])) + (((u32) (a)[1]) << 8) | ((u32) (a)[0])) #define RTW_PUT_LE32(a, val) \ do { \ (a)[3] = (u8) ((((u32) (val)) >> 24) & 0xff); \ @@ -860,7 +860,7 @@ extern u64 rtw_division64(u64 x, u64 y); #define RTW_GET_BE64(a) ((((u64) (a)[0]) << 56) | (((u64) (a)[1]) << 48) | \ (((u64) (a)[2]) << 40) | (((u64) (a)[3]) << 32) | \ (((u64) (a)[4]) << 24) | (((u64) (a)[5]) << 16) | \ - (((u64) (a)[6]) << 8) | ((u64) (a)[7])) + (((u64) (a)[6]) << 8) | ((u64) (a)[7])) #define RTW_PUT_BE64(a, val) \ do { \ (a)[0] = (u8) (((u64) (val)) >> 56); \ @@ -896,5 +896,3 @@ struct rtw_cbuf *rtw_cbuf_alloc(u32 size); void rtw_cbuf_free(struct rtw_cbuf *cbuf); #endif - - diff --git a/include/pci_hal.h b/include/pci_hal.h index e5e3d79..f5dfc46 100755 --- a/include/pci_hal.h +++ b/include/pci_hal.h @@ -1,7 +1,7 @@ /****************************************************************************** * * 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. @@ -31,32 +31,32 @@ #define PCI_MAX_DEVICES 32 #define PCI_MAX_FUNCTION 8 -#define PCI_CONF_ADDRESS 0x0CF8 // PCI Configuration Space Address -#define PCI_CONF_DATA 0x0CFC // PCI Configuration Space Data +#define PCI_CONF_ADDRESS 0x0CF8 // PCI Configuration Space Address +#define PCI_CONF_DATA 0x0CFC // PCI Configuration Space Data #define PCI_CLASS_BRIDGE_DEV 0x06 #define PCI_SUBCLASS_BR_PCI_TO_PCI 0x04 -#define PCI_CAPABILITY_ID_PCI_EXPRESS 0x10 +#define PCI_CAPABILITY_ID_PCI_EXPRESS 0x10 -#define U1DONTCARE 0xFF -#define U2DONTCARE 0xFFFF -#define U4DONTCARE 0xFFFFFFFF +#define U1DONTCARE 0xFF +#define U2DONTCARE 0xFFFF +#define U4DONTCARE 0xFFFFFFFF #define PCI_VENDER_ID_REALTEK 0x10ec -#define HAL_HW_PCI_8180_DEVICE_ID 0x8180 -#define HAL_HW_PCI_8185_DEVICE_ID 0x8185 //8185 or 8185b -#define HAL_HW_PCI_8188_DEVICE_ID 0x8188 //8185b -#define HAL_HW_PCI_8198_DEVICE_ID 0x8198 //8185b -#define HAL_HW_PCI_8190_DEVICE_ID 0x8190 //8190 +#define HAL_HW_PCI_8180_DEVICE_ID 0x8180 +#define HAL_HW_PCI_8185_DEVICE_ID 0x8185 //8185 or 8185b +#define HAL_HW_PCI_8188_DEVICE_ID 0x8188 //8185b +#define HAL_HW_PCI_8198_DEVICE_ID 0x8198 //8185b +#define HAL_HW_PCI_8190_DEVICE_ID 0x8190 //8190 #define HAL_HW_PCI_8723E_DEVICE_ID 0x8723 //8723E -#define HAL_HW_PCI_8192_DEVICE_ID 0x8192 //8192 PCI-E +#define HAL_HW_PCI_8192_DEVICE_ID 0x8192 //8192 PCI-E #define HAL_HW_PCI_8192SE_DEVICE_ID 0x8192 //8192 SE -#define HAL_HW_PCI_8174_DEVICE_ID 0x8174 //8192 SE -#define HAL_HW_PCI_8173_DEVICE_ID 0x8173 //8191 SE Crab -#define HAL_HW_PCI_8172_DEVICE_ID 0x8172 //8191 SE RE -#define HAL_HW_PCI_8171_DEVICE_ID 0x8171 //8191 SE Unicron +#define HAL_HW_PCI_8174_DEVICE_ID 0x8174 //8192 SE +#define HAL_HW_PCI_8173_DEVICE_ID 0x8173 //8191 SE Crab +#define HAL_HW_PCI_8172_DEVICE_ID 0x8172 //8191 SE RE +#define HAL_HW_PCI_8171_DEVICE_ID 0x8171 //8191 SE Unicron #define HAL_HW_PCI_0045_DEVICE_ID 0x0045 //8190 PCI for Ceraga #define HAL_HW_PCI_0046_DEVICE_ID 0x0046 //8190 Cardbus for Ceraga #define HAL_HW_PCI_0044_DEVICE_ID 0x0044 //8192e PCIE for Ceraga @@ -68,12 +68,12 @@ #define HAL_HW_PCI_8192CE_DEVICE_ID 0x8178 //8192ce #define HAL_HW_PCI_8191CE_DEVICE_ID 0x8177 //8192ce #define HAL_HW_PCI_8188CE_DEVICE_ID 0x8176 //8192ce -#define HAL_HW_PCI_8192CU_DEVICE_ID 0x8191 //8192ce +#define HAL_HW_PCI_8192CU_DEVICE_ID 0x8191 //8192ce #define HAL_HW_PCI_8192DE_DEVICE_ID 0x8193 //8192de #define HAL_HW_PCI_002B_DEVICE_ID 0x002B //8192de, provided by HW SD #define HAL_HW_PCI_8188EE_DEVICE_ID 0x8179 -#define HAL_MEMORY_MAPPED_IO_RANGE_8190PCI 0x1000 //8190 support 16 pages of IO registers +#define HAL_MEMORY_MAPPED_IO_RANGE_8190PCI 0x1000 //8190 support 16 pages of IO registers #define HAL_HW_PCI_REVISION_ID_8190PCI 0x00 #define HAL_MEMORY_MAPPED_IO_RANGE_8192PCIE 0x4000 //8192 support 16 pages of IO registers #define HAL_HW_PCI_REVISION_ID_8192PCIE 0x01 @@ -100,10 +100,10 @@ struct rt_pci_capabilities_header { struct pci_priv{ u8 linkctrl_reg; - + u8 busnumber; - u8 devnumber; - u8 funcnumber; + u8 devnumber; + u8 funcnumber; u8 pcibridge_busnum; u8 pcibridge_devnum; @@ -112,7 +112,7 @@ struct pci_priv{ u16 pcibridge_vendorid; u16 pcibridge_deviceid; u8 pcibridge_pciehdr_offset; - u8 pcibridge_linkctrlreg; + u8 pcibridge_linkctrlreg; u8 amd_l1_patch; }; @@ -128,10 +128,10 @@ typedef struct _RT_ISR_CONTENT //#define RegAddr(addr) (addr + 0xB2000000UL) //some platform macros will def here -static inline void NdisRawWritePortUlong(u32 port, u32 val) +static inline void NdisRawWritePortUlong(u32 port, u32 val) { outl(val, port); - //writel(val, (u8 *)RegAddr(port)); + //writel(val, (u8 *)RegAddr(port)); } static inline void NdisRawWritePortUchar(u32 port, u8 val) @@ -162,4 +162,3 @@ void rtl8188ee_set_hal_ops(struct adapter * padapter); #define hal_set_hal_ops rtl8188ee_set_hal_ops #endif //__PCIE_HAL_H__ - diff --git a/include/pci_ops.h b/include/pci_ops.h index f69d87a..166fdeb 100755 --- a/include/pci_ops.h +++ b/include/pci_ops.h @@ -1,7 +1,7 @@ /****************************************************************************** * * 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. @@ -40,4 +40,3 @@ void rtl8188ee_set_intf_ops(struct _io_ops *pops); #define pci_set_intf_ops rtl8188ee_set_intf_ops #endif - diff --git a/include/pci_osintf.h b/include/pci_osintf.h index 4e7af6d..5811058 100755 --- a/include/pci_osintf.h +++ b/include/pci_osintf.h @@ -1,7 +1,7 @@ /****************************************************************************** * * 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. @@ -30,4 +30,3 @@ void rtw_pci_enable_aspm(struct adapter *padapter); #endif - diff --git a/include/recv_osdep.h b/include/recv_osdep.h index c1b1683..09a70f5 100755 --- a/include/recv_osdep.h +++ b/include/recv_osdep.h @@ -1,7 +1,7 @@ /****************************************************************************** * * 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. @@ -35,13 +35,13 @@ extern sint _rtw_init_recv_priv(struct recv_priv *precvpriv, struct adapter *pad extern void _rtw_free_recv_priv (struct recv_priv *precvpriv); -extern s32 rtw_recv_entry(union recv_frame *precv_frame); +extern s32 rtw_recv_entry(union recv_frame *precv_frame); extern int rtw_recv_indicatepkt(struct adapter *adapter, union recv_frame *precv_frame); extern void rtw_recv_returnpacket(IN _nic_hdl cnxt, IN _pkt *preturnedpkt); extern void rtw_hostapd_mlme_rx(struct adapter *padapter, union recv_frame *precv_frame); extern void rtw_handle_tkip_mic_err(struct adapter *padapter,u8 bgroup); - + int rtw_init_recv_priv(struct recv_priv *precvpriv, struct adapter *padapter); void rtw_free_recv_priv (struct recv_priv *precvpriv); @@ -61,4 +61,3 @@ void rtw_init_recv_timer(struct recv_reorder_ctrl *preorder_ctrl); #endif // - diff --git a/include/rtl8188e_cmd.h b/include/rtl8188e_cmd.h index a254844..0110d6e 100755 --- a/include/rtl8188e_cmd.h +++ b/include/rtl8188e_cmd.h @@ -35,7 +35,7 @@ enum cmd_msg_element_id P2P_PS_OFFLOAD_EID = 8, SELECTIVE_SUSPEND_ROF_CMD = 9, P2P_PS_CTW_CMD_EID = 32, - MAX_CMDMSG_EID + MAX_CMDMSG_EID }; #else typedef enum _RTL8188E_H2C_CMD_ID @@ -43,8 +43,8 @@ typedef enum _RTL8188E_H2C_CMD_ID //Class Common H2C_COM_RSVD_PAGE =0x00, H2C_COM_MEDIA_STATUS_RPT =0x01, - H2C_COM_SCAN =0x02, - H2C_COM_KEEP_ALIVE =0x03, + H2C_COM_SCAN =0x02, + H2C_COM_KEEP_ALIVE =0x03, H2C_COM_DISCNT_DECISION =0x04, #ifndef CONFIG_WOWLAN H2C_COM_WWLAN =0x05, @@ -71,7 +71,7 @@ typedef enum _RTL8188E_H2C_CMD_ID H2C_BT_COEX_GPIO_MODE =0x61, H2C_BT_DAC_SWING_VAL =0x62, H2C_BT_PSD_RST =0x63, - + //Class Remote WakeUp #ifdef CONFIG_WOWLAN H2C_COM_WWLAN =0x80, @@ -80,10 +80,10 @@ typedef enum _RTL8188E_H2C_CMD_ID H2C_COM_AOAC_RSVD_PAGE =0x83, #endif - //Class + //Class H2C_RESET_TSF =0xc0, }RTL8188E_H2C_CMD_ID; - + #endif @@ -209,11 +209,11 @@ typedef struct _SETAOAC_GLOBAL_INFO{ #define SET_ARP_PKT_PROTOCOL(__pHeader, __Value) WriteEF2Byte( ((u8*)(__pHeader)) + 2, __Value) #define SET_ARP_PKT_HW_ADDR_LEN(__pHeader, __Value) WriteEF1Byte( ((u8*)(__pHeader)) + 4, __Value) #define SET_ARP_PKT_PROTOCOL_ADDR_LEN(__pHeader, __Value) WriteEF1Byte( ((u8*)(__pHeader)) + 5, __Value) -#define SET_ARP_PKT_OPERATION(__pHeader, __Value) WriteEF2Byte( ((u8*)(__pHeader)) + 6, __Value) -#define SET_ARP_PKT_SENDER_MAC_ADDR(__pHeader, _val) cpMacAddr(((u8*)(__pHeader))+8, (u8*)(_val)) -#define SET_ARP_PKT_SENDER_IP_ADDR(__pHeader, _val) cpIpAddr(((u8*)(__pHeader))+14, (u8*)(_val)) -#define SET_ARP_PKT_TARGET_MAC_ADDR(__pHeader, _val) cpMacAddr(((u8*)(__pHeader))+18, (u8*)(_val)) -#define SET_ARP_PKT_TARGET_IP_ADDR(__pHeader, _val) cpIpAddr(((u8*)(__pHeader))+24, (u8*)(_val)) +#define SET_ARP_PKT_OPERATION(__pHeader, __Value) WriteEF2Byte( ((u8*)(__pHeader)) + 6, __Value) +#define SET_ARP_PKT_SENDER_MAC_ADDR(__pHeader, _val) cpMacAddr(((u8*)(__pHeader))+8, (u8*)(_val)) +#define SET_ARP_PKT_SENDER_IP_ADDR(__pHeader, _val) cpIpAddr(((u8*)(__pHeader))+14, (u8*)(_val)) +#define SET_ARP_PKT_TARGET_MAC_ADDR(__pHeader, _val) cpMacAddr(((u8*)(__pHeader))+18, (u8*)(_val)) +#define SET_ARP_PKT_TARGET_IP_ADDR(__pHeader, _val) cpIpAddr(((u8*)(__pHeader))+24, (u8*)(_val)) #define FW_WOWLAN_FUN_EN BIT(0) #define FW_WOWLAN_PATTERN_MATCH BIT(1) @@ -254,5 +254,3 @@ void SetFwRelatedForWoWLAN8188ES(struct adapter* padapter, u8 bHostIsGoingtoSlee #define SET_8188E_H2CCMD_AOAC_RSVDPAGE_LOC_ARP_RSP(__pH2CCmd, __Value) SET_BITS_TO_LE_1BYTE((__pH2CCmd)+1, 0, 8, __Value) #endif//__RTL8188E_CMD_H__ - - diff --git a/include/rtl8188e_dm.h b/include/rtl8188e_dm.h index edc017c..63fa574 100755 --- a/include/rtl8188e_dm.h +++ b/include/rtl8188e_dm.h @@ -21,7 +21,7 @@ #define __RTL8188E_DM_H__ enum{ UP_LINK, - DOWN_LINK, + DOWN_LINK, }; //###### duplicate code,will move to ODM ######### #define IQK_MAC_REG_NUM 4 @@ -29,7 +29,7 @@ enum{ #define IQK_BB_REG_NUM 9 #define HP_THERMAL_NUM 8 //###### duplicate code,will move to ODM ######### -struct dm_priv +struct dm_priv { u8 DM_Type; u8 DMFlag; @@ -54,7 +54,7 @@ struct dm_priv PS_T DM_PSTable; FALSE_ALARM_STATISTICS FalseAlmCnt; - + //for rate adaptive, in fact, 88c/92c fw will handle this u8 bUseRAMask; RATE_ADAPTIVE RateAdaptive; @@ -65,11 +65,11 @@ struct dm_priv u8 DynamicTxHighPowerLvl;//Add by Jacken Tx Power Control for Near/Far Range 2008/03/06 u8 PowerIndex_backup[6]; u8 TxPowerTrackControl; //for mp mode, turn off txpwrtracking as default -#if 0 +#if 0 //for tx power tracking u8 bTXPowerTracking; u8 TXPowercount; - u8 bTXPowerTrackingInit; + u8 bTXPowerTrackingInit; u8 TM_Trigger; @@ -89,7 +89,7 @@ struct dm_priv u8 bDPdone; u8 bDPPathAOK; u8 bDPPathBOK; - + //for IQK u32 RegC04; u32 Reg874; @@ -103,7 +103,7 @@ struct dm_priv u32 IQK_MAC_backup[IQK_MAC_REG_NUM]; u32 IQK_BB_backup_recover[9]; u32 IQK_BB_backup[IQK_BB_REG_NUM]; - + u8 bCCKinCH14; @@ -137,10 +137,10 @@ struct dm_priv //for Antenna diversity #ifdef CONFIG_ANTENNA_DIVERSITY // SWAT_T DM_SWAT_Table; -#endif +#endif #ifdef CONFIG_SW_ANTENNA_DIVERSITY // _timer SwAntennaSwitchTimer; -/* +/* u64 lastTxOkCnt; u64 lastRxOkCnt; u64 TXByteCnt_A; @@ -154,7 +154,7 @@ struct dm_priv s32 OFDM_Pkt_Cnt; u8 RSSI_Select; -// u8 DIG_Dynamic_MIN ; +// u8 DIG_Dynamic_MIN ; //###### duplicate code,will move to ODM ######### #endif // Add for Reading Initial Data Rate SEL Register 0x484 during watchdog. Using for fill tx desc. 2011.3.21 by Thomas @@ -176,4 +176,3 @@ void AntDivCompare8188E(struct adapter *Adapter, WLAN_BSSID_EX *dst, WLAN_BSSID_ u8 AntDivBeforeLink8188E(struct adapter *Adapter ); #endif #endif - diff --git a/include/rtl8188e_hal.h b/include/rtl8188e_hal.h index a7499c3..2c45659 100755 --- a/include/rtl8188e_hal.h +++ b/include/rtl8188e_hal.h @@ -1,714 +1,713 @@ -/****************************************************************************** - * - * 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 __RTL8188E_HAL_H__ -#define __RTL8188E_HAL_H__ - - -//include HAL Related header after HAL Related compiling flags -#include "rtl8188e_spec.h" -#include "Hal8188EPhyReg.h" -#include "Hal8188EPhyCfg.h" -#include "rtl8188e_rf.h" -#include "rtl8188e_dm.h" -#include "rtl8188e_recv.h" -#include "rtl8188e_xmit.h" -#include "rtl8188e_cmd.h" -#include "Hal8188EPwrSeq.h" -#ifdef DBG_CONFIG_ERROR_DETECT -#include "rtl8188e_sreset.h" -#endif -#include "rtw_efuse.h" - -#include "../hal/odm_precomp.h" - - // Fw Array - #define Rtl8188E_FwImageArray Rtl8188EFwImgArray - #define Rtl8188E_FWImgArrayLength Rtl8188EFWImgArrayLength -#ifdef CONFIG_WOWLAN - #define Rtl8188E_FwWoWImageArray Array_8188E_FW_WoWLAN - #define Rtl8188E_FwWoWImgArrayLength ArrayLength_8188E_FW_WoWLAN -#endif //CONFIG_WOWLAN - - -#ifdef CONFIG_SDIO_HCI - - //TODO: We should define 8188ES firmware related macro settings here!! - //TODO: The following need to check!! - #define RTL8188E_FW_UMC_IMG "rtl8188E\\rtl8188efw.bin" - #define RTL8188E_PHY_REG "rtl8188E\\PHY_REG_1T.txt" - #define RTL8188E_PHY_RADIO_A "rtl8188E\\radio_a_1T.txt" - #define RTL8188E_PHY_RADIO_B "rtl8188E\\radio_b_1T.txt" - #define RTL8188E_AGC_TAB "rtl8188E\\AGC_TAB_1T.txt" - #define RTL8188E_PHY_MACREG "rtl8188E\\MAC_REG.txt" - #define RTL8188E_PHY_REG_PG "rtl8188E\\PHY_REG_PG.txt" - #define RTL8188E_PHY_REG_MP "rtl8188E\\PHY_REG_MP.txt" - -//--------------------------------------------------------------------- -// RTL8188E From header -//--------------------------------------------------------------------- -#if 0 - #define Rtl8188E_PHY_REG_Array_PG Rtl8188ESPHY_REG_Array_PG - #define Rtl8188E_PHY_REG_Array_PGLength Rtl8188ESPHY_REG_Array_PGLength - -#endif - - //--------------------------------------------------------------------- - // RTL8188E Power Configuration CMDs for USB/SDIO interfaces - //--------------------------------------------------------------------- - #define Rtl8188E_NIC_PWR_ON_FLOW rtl8188E_power_on_flow - #define Rtl8188E_NIC_RF_OFF_FLOW rtl8188E_radio_off_flow - #define Rtl8188E_NIC_DISABLE_FLOW rtl8188E_card_disable_flow - #define Rtl8188E_NIC_ENABLE_FLOW rtl8188E_card_enable_flow - #define Rtl8188E_NIC_SUSPEND_FLOW rtl8188E_suspend_flow - #define Rtl8188E_NIC_RESUME_FLOW rtl8188E_resume_flow - #define Rtl8188E_NIC_PDN_FLOW rtl8188E_hwpdn_flow - #define Rtl8188E_NIC_LPS_ENTER_FLOW rtl8188E_enter_lps_flow - #define Rtl8188E_NIC_LPS_LEAVE_FLOW rtl8188E_leave_lps_flow - -#elif defined(CONFIG_USB_HCI) - #define RTL8188E_FW_UMC_IMG "rtl8188E\\rtl8188efw.bin" - #define RTL8188E_PHY_REG "rtl8188E\\PHY_REG_1T.txt" - #define RTL8188E_PHY_RADIO_A "rtl8188E\\radio_a_1T.txt" - #define RTL8188E_PHY_RADIO_B "rtl8188E\\radio_b_1T.txt" - #define RTL8188E_AGC_TAB "rtl8188E\\AGC_TAB_1T.txt" - #define RTL8188E_PHY_MACREG "rtl8188E\\MAC_REG.txt" - #define RTL8188E_PHY_REG_PG "rtl8188E\\PHY_REG_PG.txt" - #define RTL8188E_PHY_REG_MP "rtl8188E\\PHY_REG_MP.txt" - -#if 0 - #define Rtl8188E_PHY_REG_Array_PG Rtl8188EUPHY_REG_Array_PG - #define Rtl8188E_PHY_REG_Array_PGLength Rtl8188EUPHY_REG_Array_PGLength - -#endif - - //--------------------------------------------------------------------- - // RTL8188E Power Configuration CMDs for USB/SDIO interfaces - //--------------------------------------------------------------------- - #define Rtl8188E_NIC_PWR_ON_FLOW rtl8188E_power_on_flow - #define Rtl8188E_NIC_RF_OFF_FLOW rtl8188E_radio_off_flow - #define Rtl8188E_NIC_DISABLE_FLOW rtl8188E_card_disable_flow - #define Rtl8188E_NIC_ENABLE_FLOW rtl8188E_card_enable_flow - #define Rtl8188E_NIC_SUSPEND_FLOW rtl8188E_suspend_flow - #define Rtl8188E_NIC_RESUME_FLOW rtl8188E_resume_flow - #define Rtl8188E_NIC_PDN_FLOW rtl8188E_hwpdn_flow - #define Rtl8188E_NIC_LPS_ENTER_FLOW rtl8188E_enter_lps_flow - #define Rtl8188E_NIC_LPS_LEAVE_FLOW rtl8188E_leave_lps_flow - -#elif defined(CONFIG_PCI_HCI) - #define RTL8188E_FW_UMC_IMG "rtl8188E\\rtl8188efw.bin" - #define RTL8188E_PHY_REG "rtl8188E\\PHY_REG_1T.txt" - #define RTL8188E_PHY_RADIO_A "rtl8188E\\radio_a_1T.txt" - #define RTL8188E_PHY_RADIO_B "rtl8188E\\radio_b_1T.txt" - #define RTL8188E_AGC_TAB "rtl8188E\\AGC_TAB_1T.txt" - #define RTL8188E_PHY_MACREG "rtl8188E\\MAC_REG.txt" - #define RTL8188E_PHY_REG_PG "rtl8188E\\PHY_REG_PG.txt" - #define RTL8188E_PHY_REG_MP "rtl8188E\\PHY_REG_MP.txt" - - #define Rtl8188E_PHY_REG_Array_PG Rtl8188EEPHY_REG_Array_PG - #define Rtl8188E_PHY_REG_Array_PGLength Rtl8188EEPHY_REG_Array_PGLength - - - #ifndef CONFIG_PHY_SETTING_WITH_ODM - #if MP_DRIVER == 1 - #define Rtl8188ES_PHY_REG_Array_MP Rtl8188ESPHY_REG_Array_MP - #endif - #endif - - //--------------------------------------------------------------------- - // RTL8188E Power Configuration CMDs for USB/SDIO/PCIE interfaces - //--------------------------------------------------------------------- - #define Rtl8188E_NIC_PWR_ON_FLOW rtl8188E_power_on_flow - #define Rtl8188E_NIC_RF_OFF_FLOW rtl8188E_radio_off_flow - #define Rtl8188E_NIC_DISABLE_FLOW rtl8188E_card_disable_flow - #define Rtl8188E_NIC_ENABLE_FLOW rtl8188E_card_enable_flow - #define Rtl8188E_NIC_SUSPEND_FLOW rtl8188E_suspend_flow - #define Rtl8188E_NIC_RESUME_FLOW rtl8188E_resume_flow - #define Rtl8188E_NIC_PDN_FLOW rtl8188E_hwpdn_flow - #define Rtl8188E_NIC_LPS_ENTER_FLOW rtl8188E_enter_lps_flow - #define Rtl8188E_NIC_LPS_LEAVE_FLOW rtl8188E_leave_lps_flow -#endif //CONFIG_***_HCI - - -#define DRVINFO_SZ 4 // unit is 8bytes -#define PageNum_128(_Len) (u32)(((_Len)>>7) + ((_Len)&0x7F ? 1:0)) - - -#if 1 // download firmware related data structure -#define FW_8188E_SIZE 0x4000 //16384,16k -#define FW_8188E_START_ADDRESS 0x1000 -#define FW_8188E_END_ADDRESS 0x1FFF //0x5FFF - -#define MAX_PAGE_SIZE 4096 // @ page : 4k bytes - -#define IS_FW_HEADER_EXIST(_pFwHdr) ((le16_to_cpu(_pFwHdr->Signature)&0xFFF0) == 0x92C0 ||\ - (le16_to_cpu(_pFwHdr->Signature)&0xFFF0) == 0x88C0 ||\ - (le16_to_cpu(_pFwHdr->Signature)&0xFFF0) == 0x2300 ||\ - (le16_to_cpu(_pFwHdr->Signature)&0xFFF0) == 0x88E0) - -typedef enum _FIRMWARE_SOURCE { - FW_SOURCE_IMG_FILE = 0, - FW_SOURCE_HEADER_FILE = 1, //from header file -} FIRMWARE_SOURCE, *PFIRMWARE_SOURCE; - -typedef struct _RT_FIRMWARE { - FIRMWARE_SOURCE eFWSource; -#ifdef CONFIG_EMBEDDED_FWIMG - u8* szFwBuffer; -#else - u8 szFwBuffer[FW_8188E_SIZE]; -#endif - u32 ulFwLength; - -#ifdef CONFIG_WOWLAN - u8* szWoWLANFwBuffer; - u32 ulWoWLANFwLength; -#endif //CONFIG_WOWLAN -} RT_FIRMWARE, *PRT_FIRMWARE, RT_FIRMWARE_8188E, *PRT_FIRMWARE_8188E; - -// -// This structure must be cared byte-ordering -// - -typedef struct _RT_8188E_FIRMWARE_HDR -{ - // 8-byte alinment required - - //--- LONG WORD 0 ---- - u16 Signature; // 92C0: test chip; 92C, 88C0: test chip; 88C1: MP A-cut; 92C1: MP A-cut - u8 Category; // AP/NIC and USB/PCI - u8 Function; // Reserved for different FW function indcation, for further use when driver needs to download different FW in different conditions - u16 Version; // FW Version - u8 Subversion; // FW Subversion, default 0x00 - u16 Rsvd1; - - - //--- LONG WORD 1 ---- - u8 Month; // Release time Month field - u8 Date; // Release time Date field - u8 Hour; // Release time Hour field - u8 Minute; // Release time Minute field - u16 RamCodeSize; // The size of RAM code - u8 Foundry; - u8 Rsvd2; - - //--- LONG WORD 2 ---- - u32 SvnIdx; // The SVN entry index - u32 Rsvd3; - - //--- LONG WORD 3 ---- - u32 Rsvd4; - u32 Rsvd5; -}RT_8188E_FIRMWARE_HDR, *PRT_8188E_FIRMWARE_HDR; -#endif // download firmware related data structure - - -#define DRIVER_EARLY_INT_TIME 0x05 -#define BCN_DMA_ATIME_INT_TIME 0x02 - -#ifdef CONFIG_USB_RX_AGGREGATION - -typedef enum _USB_RX_AGG_MODE{ - USB_RX_AGG_DISABLE, - USB_RX_AGG_DMA, - USB_RX_AGG_USB, - USB_RX_AGG_MIX -}USB_RX_AGG_MODE; - -//#define MAX_RX_DMA_BUFFER_SIZE 10240 // 10K for 8192C RX DMA buffer - -#endif - - -#define MAX_RX_DMA_BUFFER_SIZE_88E 0x2400 //9k for 88E nornal chip , //MaxRxBuff=10k-max(TxReportSize(64*8), WOLPattern(16*24)) - -#define MAX_TX_REPORT_BUFFER_SIZE 0x0400 // 1k - - -// BK, BE, VI, VO, HCCA, MANAGEMENT, COMMAND, HIGH, BEACON. -#define MAX_TX_QUEUE 9 - -#define TX_SELE_HQ BIT(0) // High Queue -#define TX_SELE_LQ BIT(1) // Low Queue -#define TX_SELE_NQ BIT(2) // Normal Queue - -// Note: We will divide number of page equally for each queue other than public queue! -// 22k = 22528 bytes = 176 pages (@page = 128 bytes) -// must reserved about 7 pages for LPS => 176-7 = 169 (0xA9) -// 2*BCN / 1*ps-poll / 1*null-data /1*prob_rsp /1*QOS null-data /1*BT QOS null-data - -#define TX_TOTAL_PAGE_NUMBER_88E 0xA9// 169 (21632=> 21k) - -#ifdef RTL8188ES_MAC_LOOPBACK -#define TX_PAGE_BOUNDARY_88E 0x48 //72 -#else //TX_PAGE_BOUNDARY_LOOPBACK_MODE -#define TX_PAGE_BOUNDARY_88E (TX_TOTAL_PAGE_NUMBER_88E + 1) -#endif - - -//Note: For Normal Chip Setting ,modify later -#define WMM_NORMAL_TX_TOTAL_PAGE_NUMBER TX_TOTAL_PAGE_NUMBER_88E //0xA9 , 0xb0=>176=>22k -#define WMM_NORMAL_TX_PAGE_BOUNDARY_88E (WMM_NORMAL_TX_TOTAL_PAGE_NUMBER + 1) //0xA9 - - - -//------------------------------------------------------------------------- -// Chip specific -//------------------------------------------------------------------------- -#define CHIP_BONDING_IDENTIFIER(_value) (((_value)>>22)&0x3) -#define CHIP_BONDING_92C_1T2R 0x1 -#define CHIP_BONDING_88C_USB_MCARD 0x2 -#define CHIP_BONDING_88C_USB_HP 0x1 -#include "HalVerDef.h" -#include "hal_com.h" - -//------------------------------------------------------------------------- -// Channel Plan -//------------------------------------------------------------------------- -enum ChannelPlan -{ - CHPL_FCC = 0, - CHPL_IC = 1, - CHPL_ETSI = 2, - CHPL_SPAIN = 3, - CHPL_FRANCE = 4, - CHPL_MKK = 5, - CHPL_MKK1 = 6, - CHPL_ISRAEL = 7, - CHPL_TELEC = 8, - CHPL_GLOBAL = 9, - CHPL_WORLD = 10, -}; - -typedef struct _TxPowerInfo -{ - u8 CCKIndex[RF_PATH_MAX][CHANNEL_GROUP_MAX_88E]; - u8 HT40_1SIndex[RF_PATH_MAX][CHANNEL_GROUP_MAX_88E]; - u8 HT40_2SIndexDiff[RF_PATH_MAX][CHANNEL_GROUP_MAX_88E]; - u8 HT20IndexDiff[RF_PATH_MAX][CHANNEL_GROUP_MAX_88E]; - u8 OFDMIndexDiff[RF_PATH_MAX][CHANNEL_GROUP_MAX_88E]; - u8 HT40MaxOffset[RF_PATH_MAX][CHANNEL_GROUP_MAX_88E]; - u8 HT20MaxOffset[RF_PATH_MAX][CHANNEL_GROUP_MAX_88E]; - u8 TSSI_A[3]; - u8 TSSI_B[3]; - u8 TSSI_A_5G[3]; //5GL/5GM/5GH - u8 TSSI_B_5G[3]; -} TxPowerInfo, *PTxPowerInfo; - -typedef struct _TxPowerInfo24G{ - u1Byte IndexCCK_Base[MAX_RF_PATH][MAX_CHNL_GROUP_24G]; - u1Byte IndexBW40_Base[MAX_RF_PATH][MAX_CHNL_GROUP_24G-1]; - //If only one tx, only BW20 and OFDM are used. - s1Byte CCK_Diff[MAX_RF_PATH][MAX_TX_COUNT]; - s1Byte OFDM_Diff[MAX_RF_PATH][MAX_TX_COUNT]; - s1Byte BW20_Diff[MAX_RF_PATH][MAX_TX_COUNT]; - s1Byte BW40_Diff[MAX_RF_PATH][MAX_TX_COUNT]; -}TxPowerInfo24G, *PTxPowerInfo24G; - -#define EFUSE_REAL_CONTENT_LEN 512 -#define EFUSE_MAP_LEN 128 -#define EFUSE_MAX_SECTION 16 -#define EFUSE_IC_ID_OFFSET 506 //For some inferiority IC purpose. added by Roger, 2009.09.02. -#define AVAILABLE_EFUSE_ADDR(addr) (addr < EFUSE_REAL_CONTENT_LEN) -// -// -// To prevent out of boundary programming case, -// leave 1byte and program full section -// 9bytes + 1byt + 5bytes and pre 1byte. -// For worst case: -// | 1byte|----8bytes----|1byte|--5bytes--| -// | | Reserved(14bytes) | -// -#define EFUSE_OOB_PROTECT_BYTES 15 // PG data exclude header, dummy 6 bytes frome CP test and reserved 1byte. - -#define HWSET_MAX_SIZE_88E 512 - -#define EFUSE_REAL_CONTENT_LEN_88E 256 -#define EFUSE_MAP_LEN_88E 512 -#define EFUSE_MAX_SECTION_88E 64 -#define EFUSE_MAX_WORD_UNIT_88E 4 -#define EFUSE_IC_ID_OFFSET_88E 506 //For some inferiority IC purpose. added by Roger, 2009.09.02. -#define AVAILABLE_EFUSE_ADDR_88E(addr) (addr < EFUSE_REAL_CONTENT_LEN_88E) -// To prevent out of boundary programming case, leave 1byte and program full section -// 9bytes + 1byt + 5bytes and pre 1byte. -// For worst case: -// | 2byte|----8bytes----|1byte|--7bytes--| //92D -#define EFUSE_OOB_PROTECT_BYTES_88E 18 // PG data exclude header, dummy 7 bytes frome CP test and reserved 1byte. -#define EFUSE_PROTECT_BYTES_BANK_88E 16 - - -//======================================================== -// EFUSE for BT definition -//======================================================== -#define EFUSE_BT_REAL_CONTENT_LEN 1536 // 512*3 -#define EFUSE_BT_MAP_LEN 1024 // 1k bytes -#define EFUSE_BT_MAX_SECTION 128 // 1024/8 - -#define EFUSE_PROTECT_BYTES_BANK 16 - -// -// For RTL8723 WiFi/BT/GPS multi-function configuration. 2010.10.06. -// -typedef enum _RT_MULTI_FUNC { - RT_MULTI_FUNC_NONE = 0x00, - RT_MULTI_FUNC_WIFI = 0x01, - RT_MULTI_FUNC_BT = 0x02, - RT_MULTI_FUNC_GPS = 0x04, -} RT_MULTI_FUNC, *PRT_MULTI_FUNC; - -// -// For RTL8723 WiFi PDn/GPIO polarity control configuration. 2010.10.08. -// -typedef enum _RT_POLARITY_CTL { - RT_POLARITY_LOW_ACT = 0, - RT_POLARITY_HIGH_ACT = 1, -} RT_POLARITY_CTL, *PRT_POLARITY_CTL; - -// For RTL8723 regulator mode. by tynli. 2011.01.14. -typedef enum _RT_REGULATOR_MODE { - RT_SWITCHING_REGULATOR = 0, - RT_LDO_REGULATOR = 1, -} RT_REGULATOR_MODE, *PRT_REGULATOR_MODE; - - -typedef struct hal_data_8188e -{ - HAL_VERSION VersionID; - RT_MULTI_FUNC MultiFunc; // For multi-function consideration. - RT_POLARITY_CTL PolarityCtl; // For Wifi PDn Polarity control. - RT_REGULATOR_MODE RegulatorMode; // switching regulator or LDO - u16 CustomerID; - - u16 FirmwareVersion; - u16 FirmwareVersionRev; - u16 FirmwareSubVersion; - u16 FirmwareSignature; - u8 PGMaxGroup; - //current WIFI_PHY values - u32 ReceiveConfig; - WIRELESS_MODE CurrentWirelessMode; - HT_CHANNEL_WIDTH CurrentChannelBW; - u8 CurrentChannel; - u8 nCur40MhzPrimeSC;// Control channel sub-carrier - - u16 BasicRateSet; - - //rf_ctrl - u8 rf_chip; - u8 rf_type; - u8 NumTotalRFPath; - - u8 BoardType; - - // - // EEPROM setting. - // - u16 EEPROMVID; - u16 EEPROMPID; - u16 EEPROMSVID; - u16 EEPROMSDID; - u8 EEPROMCustomerID; - u8 EEPROMSubCustomerID; - u8 EEPROMVersion; - u8 EEPROMRegulatory; - - u8 bTXPowerDataReadFromEEPORM; - u8 EEPROMThermalMeter; - u8 bAPKThermalMeterIgnore; - - BOOLEAN EepromOrEfuse; - u8 EfuseMap[2][HWSET_MAX_SIZE_512]; //92C:256bytes, 88E:512bytes, we use union set (512bytes) - u8 EfuseUsedPercentage; - EFUSE_HAL EfuseHal; - - //u8 bIQKInitialized; - - - u8 Index24G_CCK_Base[MAX_RF_PATH][CHANNEL_MAX_NUMBER]; - u8 Index24G_BW40_Base[MAX_RF_PATH][CHANNEL_MAX_NUMBER]; - //If only one tx, only BW20 and OFDM are used. - s8 CCK_24G_Diff[MAX_RF_PATH][MAX_TX_COUNT]; - s8 OFDM_24G_Diff[MAX_RF_PATH][MAX_TX_COUNT]; - s8 BW20_24G_Diff[MAX_RF_PATH][MAX_TX_COUNT]; - s8 BW40_24G_Diff[MAX_RF_PATH][MAX_TX_COUNT]; - - u8 TxPwrLevelCck[RF_PATH_MAX][CHANNEL_MAX_NUMBER]; - u8 TxPwrLevelHT40_1S[RF_PATH_MAX][CHANNEL_MAX_NUMBER]; // For HT 40MHZ pwr - u8 TxPwrLevelHT40_2S[RF_PATH_MAX][CHANNEL_MAX_NUMBER]; // For HT 40MHZ pwr - u8 TxPwrHt20Diff[RF_PATH_MAX][CHANNEL_MAX_NUMBER];// HT 20<->40 Pwr diff - u8 TxPwrLegacyHtDiff[RF_PATH_MAX][CHANNEL_MAX_NUMBER];// For HT<->legacy pwr diff - // For power group - u8 PwrGroupHT20[RF_PATH_MAX][CHANNEL_MAX_NUMBER]; - u8 PwrGroupHT40[RF_PATH_MAX][CHANNEL_MAX_NUMBER]; - - u8 LegacyHTTxPowerDiff;// Legacy to HT rate power diff - // The current Tx Power Level - u8 CurrentCckTxPwrIdx; - u8 CurrentOfdm24GTxPwrIdx; - u8 CurrentBW2024GTxPwrIdx; - u8 CurrentBW4024GTxPwrIdx; - - - // Read/write are allow for following hardware information variables - u8 framesync; - u32 framesyncC34; - u8 framesyncMonitor; - u8 DefaultInitialGain[4]; - u8 pwrGroupCnt; - u32 MCSTxPowerLevelOriginalOffset[MAX_PG_GROUP][16]; - u32 CCKTxPowerLevelOriginalOffset; - - u8 CrystalCap; - u32 AntennaTxPath; // Antenna path Tx - u32 AntennaRxPath; // Antenna path Rx - u8 BluetoothCoexist; - u8 ExternalPA; - - u8 bLedOpenDrain; // Support Open-drain arrangement for controlling the LED. Added by Roger, 2009.10.16. - - //u32 LedControlNum; - //u32 LedControlMode; - //u32 TxPowerTrackControl; - u8 b1x1RecvCombine; // for 1T1R receive combining - - //u8 bCurrentTurboEDCA; - u32 AcParam_BE; //Original parameter for BE, use for EDCA turbo. - - BB_REGISTER_DEFINITION_T PHYRegDef[4]; //Radio A/B/C/D - - u32 RfRegChnlVal[2]; - - //RDG enable - BOOLEAN bRDGEnable; - - //for host message to fw - u8 LastHMEBoxNum; - - u8 fw_ractrl; - u8 RegTxPause; - // Beacon function related global variable. - u32 RegBcnCtrlVal; - u8 RegFwHwTxQCtrl; - u8 RegReg542; - u8 RegCR_1; - - struct dm_priv dmpriv; - DM_ODM_T odmpriv; - //_lock odm_stainfo_lock; -#ifdef DBG_CONFIG_ERROR_DETECT - struct sreset_priv srestpriv; -#endif - -#ifdef CONFIG_BT_COEXIST - struct btcoexist_priv bt_coexist; -#endif - - u8 CurAntenna; - u8 AntDivCfg; - u8 TRxAntDivType; - - - u8 bDumpRxPkt;//for debug - u8 bDumpTxPkt;//for debug - u8 FwRsvdPageStartOffset; //2010.06.23. Added by tynli. Reserve page start offset except beacon in TxQ. - - // 2010/08/09 MH Add CU power down mode. - BOOLEAN pwrdown; - - // Add for dual MAC 0--Mac0 1--Mac1 - u32 interfaceIndex; - - u8 OutEpQueueSel; - u8 OutEpNumber; - - // 2010/12/10 MH Add for USB aggreation mode dynamic shceme. - BOOLEAN UsbRxHighSpeedMode; - - // 2010/11/22 MH Add for slim combo debug mode selective. - // This is used for fix the drawback of CU TSMC-A/UMC-A cut. HW auto suspend ability. Close BT clock. - BOOLEAN SlimComboDbg; - - u16 EfuseUsedBytes; - -#ifdef CONFIG_P2P - struct P2P_PS_Offload_t p2p_ps_offload; -#endif - - // Auto FSM to Turn On, include clock, isolation, power control for MAC only - u8 bMacPwrCtrlOn; - -#ifdef CONFIG_SDIO_HCI - // - // For SDIO Interface HAL related - // - - // - // SDIO ISR Related - // -// u32 IntrMask[1]; -// u32 IntrMaskToSet[1]; -// LOG_INTERRUPT InterruptLog; - u32 sdio_himr; - u32 sdio_hisr; - - // - // SDIO Tx FIFO related. - // - // HIQ, MID, LOW, PUB free pages; padapter->xmitpriv.free_txpg - u8 SdioTxFIFOFreePage[SDIO_TX_FREE_PG_QUEUE]; - _lock SdioTxFIFOFreePageLock; - - // - // SDIO Rx FIFO related. - // - u8 SdioRxFIFOCnt; - u16 SdioRxFIFOSize; -#endif //CONFIG_SDIO_HCI - -#ifdef CONFIG_USB_HCI - u32 UsbBulkOutSize; - - // Interrupt relatd register information. - u32 IntArray[3];//HISR0,HISR1,HSISR - u32 IntrMask[3]; - u8 C2hArray[16]; -#ifdef CONFIG_USB_TX_AGGREGATION - u8 UsbTxAggMode; - u8 UsbTxAggDescNum; -#endif -#ifdef CONFIG_USB_RX_AGGREGATION - u16 HwRxPageSize; // Hardware setting - u32 MaxUsbRxAggBlock; - - USB_RX_AGG_MODE UsbRxAggMode; - u8 UsbRxAggBlockCount; // USB Block count. Block size is 512-byte in hight speed and 64-byte in full speed - u8 UsbRxAggBlockTimeout; - u8 UsbRxAggPageCount; // 8192C DMA page count - u8 UsbRxAggPageTimeout; -#endif -#endif //CONFIG_USB_HCI - - -#ifdef CONFIG_PCI_HCI - - // - // EEPROM setting. - // - - u16 EEPROMDID; - u16 EEPROMSMID; - u16 EEPROMChannelPlan; - - u8 EEPROMTSSI[2]; - u8 EEPROMBoardType; - u32 TransmitConfig; - - u32 IntrMask[2]; - u32 IntrMaskToSet[2]; - - u8 bDefaultAntenna; - u8 bIQKInitialized; - - u8 bInterruptMigration; - u8 bDisableTxInt; - u8 bGpioHwWpsPbc; -#endif //CONFIG_PCI_HCI - - -#ifdef CONFIG_TX_EARLY_MODE - u8 bEarlyModeEnable; -#endif -} HAL_DATA_8188E, *PHAL_DATA_8188E; - -typedef struct hal_data_8188e HAL_DATA_TYPE, *PHAL_DATA_TYPE; - - -#define GET_HAL_DATA(__pAdapter) ((HAL_DATA_TYPE *)((__pAdapter)->HalData)) -#define GET_RF_TYPE(priv) (GET_HAL_DATA(priv)->rf_type) - -#define INCLUDE_MULTI_FUNC_BT(_Adapter) (GET_HAL_DATA(_Adapter)->MultiFunc & RT_MULTI_FUNC_BT) -#define INCLUDE_MULTI_FUNC_GPS(_Adapter) (GET_HAL_DATA(_Adapter)->MultiFunc & RT_MULTI_FUNC_GPS) - -//#define IS_MULTI_FUNC_CHIP(_Adapter) (((((PHAL_DATA_TYPE)(_Adapter->HalData))->MultiFunc) & (RT_MULTI_FUNC_BT|RT_MULTI_FUNC_GPS)) ? _TRUE : _FALSE) - -//#define RT_IS_FUNC_DISABLED(__pAdapter, __FuncBits) ( (__pAdapter)->DisabledFunctions & (__FuncBits) ) - -#ifdef CONFIG_PCI_HCI -void InterruptRecognized8188EE(struct adapter *Adapter, PRT_ISR_CONTENT pIsrContent); -void UpdateInterruptMask8188EE(struct adapter *Adapter, u32 AddMSR, u32 AddMSR1, u32 RemoveMSR, u32 RemoveMSR1); -#endif //CONFIG_PCI_HCI - -// rtl8188e_hal_init.c -#ifdef CONFIG_WOWLAN -s32 rtl8188e_FirmwareDownload(struct adapter *padapter, BOOLEAN bUsedWoWLANFw); -#else -s32 rtl8188e_FirmwareDownload(struct adapter *padapter); -#endif -void _8051Reset88E(struct adapter *padapter); -void rtl8188e_InitializeFirmwareVars(struct adapter *padapter); - - -s32 InitLLTTable(struct adapter *padapter, u8 txpktbuf_bndy); -void Read_LLT_Tab(struct adapter *padapter); - -// EFuse -u8 GetEEPROMSize8188E(struct adapter *padapter); -void Hal_InitPGData88E(struct adapter *padapter); -void Hal_EfuseParseIDCode88E(struct adapter *padapter, u8 *hwinfo); -void Hal_ReadTxPowerInfo88E(struct adapter *padapter,u8* hwinfo,BOOLEAN AutoLoadFail); - -void Hal_EfuseParseEEPROMVer88E(struct adapter *padapter, u8 *hwinfo, BOOLEAN AutoLoadFail); -void rtl8188e_EfuseParseChnlPlan(struct adapter *padapter, u8 *hwinfo, BOOLEAN AutoLoadFail); -void Hal_EfuseParseCustomerID88E(struct adapter *padapter, u8 *hwinfo, BOOLEAN AutoLoadFail); -void Hal_ReadAntennaDiversity88E (struct adapter *pAdapter,u8*PROMContent,BOOLEAN AutoLoadFail); -void Hal_ReadThermalMeter_88E(struct adapter *Adapter,u8* PROMContent,BOOLEAN AutoloadFail); -void Hal_EfuseParseXtal_8188E(struct adapter *pAdapter,u8* hwinfo,BOOLEAN AutoLoadFail); -void Hal_EfuseParseBoardType88E(struct adapter *pAdapter,u8* hwinfo,BOOLEAN AutoLoadFail); -void Hal_ReadPowerSavingMode88E(struct adapter *pAdapter,u8* hwinfo,BOOLEAN AutoLoadFail); - -BOOLEAN HalDetectPwrDownMode88E(struct adapter *Adapter); - -#ifdef CONFIG_WOWLAN -void Hal_DetectWoWMode(struct adapter *pAdapter); -#endif //CONFIG_WOWLAN - -#ifdef CONFIG_RF_GAIN_OFFSET -void Hal_ReadRFGainOffset(struct adapter *pAdapter,u8* hwinfo,BOOLEAN AutoLoadFail); -#endif //CONFIG_RF_GAIN_OFFSET - -//RT_CHANNEL_DOMAIN rtl8723a_HalMapChannelPlan(struct adapter *padapter, u8 HalChannelPlan); -//VERSION_8192C rtl8723a_ReadChipVersion(struct adapter *padapter); -//void rtl8723a_ReadBluetoothCoexistInfo(struct adapter *padapter, u8 *PROMContent, BOOLEAN AutoloadFail); -void Hal_InitChannelPlan(struct adapter *padapter); - -void rtl8188e_set_hal_ops(struct hal_ops *pHalFunc); - -// register -void SetBcnCtrlReg(struct adapter *padapter, u8 SetBits, u8 ClearBits); - -void rtl8188e_start_thread(struct adapter *padapter); -void rtl8188e_stop_thread(struct adapter *padapter); - -void rtw_IOL_cmd_tx_pkt_buf_dump(struct adapter *Adapter,int data_len); -#ifdef CONFIG_IOL_EFUSE_PATCH -s32 rtl8188e_iol_efuse_patch(struct adapter *padapter); -#endif//CONFIG_IOL_EFUSE_PATCH - -#endif //__RTL8188E_HAL_H__ - +/****************************************************************************** + * + * 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 __RTL8188E_HAL_H__ +#define __RTL8188E_HAL_H__ + + +//include HAL Related header after HAL Related compiling flags +#include "rtl8188e_spec.h" +#include "Hal8188EPhyReg.h" +#include "Hal8188EPhyCfg.h" +#include "rtl8188e_rf.h" +#include "rtl8188e_dm.h" +#include "rtl8188e_recv.h" +#include "rtl8188e_xmit.h" +#include "rtl8188e_cmd.h" +#include "Hal8188EPwrSeq.h" +#ifdef DBG_CONFIG_ERROR_DETECT +#include "rtl8188e_sreset.h" +#endif +#include "rtw_efuse.h" + +#include "../hal/odm_precomp.h" + + // Fw Array + #define Rtl8188E_FwImageArray Rtl8188EFwImgArray + #define Rtl8188E_FWImgArrayLength Rtl8188EFWImgArrayLength +#ifdef CONFIG_WOWLAN + #define Rtl8188E_FwWoWImageArray Array_8188E_FW_WoWLAN + #define Rtl8188E_FwWoWImgArrayLength ArrayLength_8188E_FW_WoWLAN +#endif //CONFIG_WOWLAN + + +#ifdef CONFIG_SDIO_HCI + + //TODO: We should define 8188ES firmware related macro settings here!! + //TODO: The following need to check!! + #define RTL8188E_FW_UMC_IMG "rtl8188E\\rtl8188efw.bin" + #define RTL8188E_PHY_REG "rtl8188E\\PHY_REG_1T.txt" + #define RTL8188E_PHY_RADIO_A "rtl8188E\\radio_a_1T.txt" + #define RTL8188E_PHY_RADIO_B "rtl8188E\\radio_b_1T.txt" + #define RTL8188E_AGC_TAB "rtl8188E\\AGC_TAB_1T.txt" + #define RTL8188E_PHY_MACREG "rtl8188E\\MAC_REG.txt" + #define RTL8188E_PHY_REG_PG "rtl8188E\\PHY_REG_PG.txt" + #define RTL8188E_PHY_REG_MP "rtl8188E\\PHY_REG_MP.txt" + +//--------------------------------------------------------------------- +// RTL8188E From header +//--------------------------------------------------------------------- +#if 0 + #define Rtl8188E_PHY_REG_Array_PG Rtl8188ESPHY_REG_Array_PG + #define Rtl8188E_PHY_REG_Array_PGLength Rtl8188ESPHY_REG_Array_PGLength + +#endif + + //--------------------------------------------------------------------- + // RTL8188E Power Configuration CMDs for USB/SDIO interfaces + //--------------------------------------------------------------------- + #define Rtl8188E_NIC_PWR_ON_FLOW rtl8188E_power_on_flow + #define Rtl8188E_NIC_RF_OFF_FLOW rtl8188E_radio_off_flow + #define Rtl8188E_NIC_DISABLE_FLOW rtl8188E_card_disable_flow + #define Rtl8188E_NIC_ENABLE_FLOW rtl8188E_card_enable_flow + #define Rtl8188E_NIC_SUSPEND_FLOW rtl8188E_suspend_flow + #define Rtl8188E_NIC_RESUME_FLOW rtl8188E_resume_flow + #define Rtl8188E_NIC_PDN_FLOW rtl8188E_hwpdn_flow + #define Rtl8188E_NIC_LPS_ENTER_FLOW rtl8188E_enter_lps_flow + #define Rtl8188E_NIC_LPS_LEAVE_FLOW rtl8188E_leave_lps_flow + +#elif defined(CONFIG_USB_HCI) + #define RTL8188E_FW_UMC_IMG "rtl8188E\\rtl8188efw.bin" + #define RTL8188E_PHY_REG "rtl8188E\\PHY_REG_1T.txt" + #define RTL8188E_PHY_RADIO_A "rtl8188E\\radio_a_1T.txt" + #define RTL8188E_PHY_RADIO_B "rtl8188E\\radio_b_1T.txt" + #define RTL8188E_AGC_TAB "rtl8188E\\AGC_TAB_1T.txt" + #define RTL8188E_PHY_MACREG "rtl8188E\\MAC_REG.txt" + #define RTL8188E_PHY_REG_PG "rtl8188E\\PHY_REG_PG.txt" + #define RTL8188E_PHY_REG_MP "rtl8188E\\PHY_REG_MP.txt" + +#if 0 + #define Rtl8188E_PHY_REG_Array_PG Rtl8188EUPHY_REG_Array_PG + #define Rtl8188E_PHY_REG_Array_PGLength Rtl8188EUPHY_REG_Array_PGLength + +#endif + + //--------------------------------------------------------------------- + // RTL8188E Power Configuration CMDs for USB/SDIO interfaces + //--------------------------------------------------------------------- + #define Rtl8188E_NIC_PWR_ON_FLOW rtl8188E_power_on_flow + #define Rtl8188E_NIC_RF_OFF_FLOW rtl8188E_radio_off_flow + #define Rtl8188E_NIC_DISABLE_FLOW rtl8188E_card_disable_flow + #define Rtl8188E_NIC_ENABLE_FLOW rtl8188E_card_enable_flow + #define Rtl8188E_NIC_SUSPEND_FLOW rtl8188E_suspend_flow + #define Rtl8188E_NIC_RESUME_FLOW rtl8188E_resume_flow + #define Rtl8188E_NIC_PDN_FLOW rtl8188E_hwpdn_flow + #define Rtl8188E_NIC_LPS_ENTER_FLOW rtl8188E_enter_lps_flow + #define Rtl8188E_NIC_LPS_LEAVE_FLOW rtl8188E_leave_lps_flow + +#elif defined(CONFIG_PCI_HCI) + #define RTL8188E_FW_UMC_IMG "rtl8188E\\rtl8188efw.bin" + #define RTL8188E_PHY_REG "rtl8188E\\PHY_REG_1T.txt" + #define RTL8188E_PHY_RADIO_A "rtl8188E\\radio_a_1T.txt" + #define RTL8188E_PHY_RADIO_B "rtl8188E\\radio_b_1T.txt" + #define RTL8188E_AGC_TAB "rtl8188E\\AGC_TAB_1T.txt" + #define RTL8188E_PHY_MACREG "rtl8188E\\MAC_REG.txt" + #define RTL8188E_PHY_REG_PG "rtl8188E\\PHY_REG_PG.txt" + #define RTL8188E_PHY_REG_MP "rtl8188E\\PHY_REG_MP.txt" + + #define Rtl8188E_PHY_REG_Array_PG Rtl8188EEPHY_REG_Array_PG + #define Rtl8188E_PHY_REG_Array_PGLength Rtl8188EEPHY_REG_Array_PGLength + + + #ifndef CONFIG_PHY_SETTING_WITH_ODM + #if MP_DRIVER == 1 + #define Rtl8188ES_PHY_REG_Array_MP Rtl8188ESPHY_REG_Array_MP + #endif + #endif + + //--------------------------------------------------------------------- + // RTL8188E Power Configuration CMDs for USB/SDIO/PCIE interfaces + //--------------------------------------------------------------------- + #define Rtl8188E_NIC_PWR_ON_FLOW rtl8188E_power_on_flow + #define Rtl8188E_NIC_RF_OFF_FLOW rtl8188E_radio_off_flow + #define Rtl8188E_NIC_DISABLE_FLOW rtl8188E_card_disable_flow + #define Rtl8188E_NIC_ENABLE_FLOW rtl8188E_card_enable_flow + #define Rtl8188E_NIC_SUSPEND_FLOW rtl8188E_suspend_flow + #define Rtl8188E_NIC_RESUME_FLOW rtl8188E_resume_flow + #define Rtl8188E_NIC_PDN_FLOW rtl8188E_hwpdn_flow + #define Rtl8188E_NIC_LPS_ENTER_FLOW rtl8188E_enter_lps_flow + #define Rtl8188E_NIC_LPS_LEAVE_FLOW rtl8188E_leave_lps_flow +#endif //CONFIG_***_HCI + + +#define DRVINFO_SZ 4 // unit is 8bytes +#define PageNum_128(_Len) (u32)(((_Len)>>7) + ((_Len)&0x7F ? 1:0)) + + +#if 1 // download firmware related data structure +#define FW_8188E_SIZE 0x4000 //16384,16k +#define FW_8188E_START_ADDRESS 0x1000 +#define FW_8188E_END_ADDRESS 0x1FFF //0x5FFF + +#define MAX_PAGE_SIZE 4096 // @ page : 4k bytes + +#define IS_FW_HEADER_EXIST(_pFwHdr) ((le16_to_cpu(_pFwHdr->Signature)&0xFFF0) == 0x92C0 ||\ + (le16_to_cpu(_pFwHdr->Signature)&0xFFF0) == 0x88C0 ||\ + (le16_to_cpu(_pFwHdr->Signature)&0xFFF0) == 0x2300 ||\ + (le16_to_cpu(_pFwHdr->Signature)&0xFFF0) == 0x88E0) + +typedef enum _FIRMWARE_SOURCE { + FW_SOURCE_IMG_FILE = 0, + FW_SOURCE_HEADER_FILE = 1, //from header file +} FIRMWARE_SOURCE, *PFIRMWARE_SOURCE; + +typedef struct _RT_FIRMWARE { + FIRMWARE_SOURCE eFWSource; +#ifdef CONFIG_EMBEDDED_FWIMG + u8* szFwBuffer; +#else + u8 szFwBuffer[FW_8188E_SIZE]; +#endif + u32 ulFwLength; + +#ifdef CONFIG_WOWLAN + u8* szWoWLANFwBuffer; + u32 ulWoWLANFwLength; +#endif //CONFIG_WOWLAN +} RT_FIRMWARE, *PRT_FIRMWARE, RT_FIRMWARE_8188E, *PRT_FIRMWARE_8188E; + +// +// This structure must be cared byte-ordering +// + +typedef struct _RT_8188E_FIRMWARE_HDR +{ + // 8-byte alinment required + + //--- LONG WORD 0 ---- + u16 Signature; // 92C0: test chip; 92C, 88C0: test chip; 88C1: MP A-cut; 92C1: MP A-cut + u8 Category; // AP/NIC and USB/PCI + u8 Function; // Reserved for different FW function indcation, for further use when driver needs to download different FW in different conditions + u16 Version; // FW Version + u8 Subversion; // FW Subversion, default 0x00 + u16 Rsvd1; + + + //--- LONG WORD 1 ---- + u8 Month; // Release time Month field + u8 Date; // Release time Date field + u8 Hour; // Release time Hour field + u8 Minute; // Release time Minute field + u16 RamCodeSize; // The size of RAM code + u8 Foundry; + u8 Rsvd2; + + //--- LONG WORD 2 ---- + u32 SvnIdx; // The SVN entry index + u32 Rsvd3; + + //--- LONG WORD 3 ---- + u32 Rsvd4; + u32 Rsvd5; +}RT_8188E_FIRMWARE_HDR, *PRT_8188E_FIRMWARE_HDR; +#endif // download firmware related data structure + + +#define DRIVER_EARLY_INT_TIME 0x05 +#define BCN_DMA_ATIME_INT_TIME 0x02 + +#ifdef CONFIG_USB_RX_AGGREGATION + +typedef enum _USB_RX_AGG_MODE{ + USB_RX_AGG_DISABLE, + USB_RX_AGG_DMA, + USB_RX_AGG_USB, + USB_RX_AGG_MIX +}USB_RX_AGG_MODE; + +//#define MAX_RX_DMA_BUFFER_SIZE 10240 // 10K for 8192C RX DMA buffer + +#endif + + +#define MAX_RX_DMA_BUFFER_SIZE_88E 0x2400 //9k for 88E nornal chip , //MaxRxBuff=10k-max(TxReportSize(64*8), WOLPattern(16*24)) + +#define MAX_TX_REPORT_BUFFER_SIZE 0x0400 // 1k + + +// BK, BE, VI, VO, HCCA, MANAGEMENT, COMMAND, HIGH, BEACON. +#define MAX_TX_QUEUE 9 + +#define TX_SELE_HQ BIT(0) // High Queue +#define TX_SELE_LQ BIT(1) // Low Queue +#define TX_SELE_NQ BIT(2) // Normal Queue + +// Note: We will divide number of page equally for each queue other than public queue! +// 22k = 22528 bytes = 176 pages (@page = 128 bytes) +// must reserved about 7 pages for LPS => 176-7 = 169 (0xA9) +// 2*BCN / 1*ps-poll / 1*null-data /1*prob_rsp /1*QOS null-data /1*BT QOS null-data + +#define TX_TOTAL_PAGE_NUMBER_88E 0xA9// 169 (21632=> 21k) + +#ifdef RTL8188ES_MAC_LOOPBACK +#define TX_PAGE_BOUNDARY_88E 0x48 //72 +#else //TX_PAGE_BOUNDARY_LOOPBACK_MODE +#define TX_PAGE_BOUNDARY_88E (TX_TOTAL_PAGE_NUMBER_88E + 1) +#endif + + +//Note: For Normal Chip Setting ,modify later +#define WMM_NORMAL_TX_TOTAL_PAGE_NUMBER TX_TOTAL_PAGE_NUMBER_88E //0xA9 , 0xb0=>176=>22k +#define WMM_NORMAL_TX_PAGE_BOUNDARY_88E (WMM_NORMAL_TX_TOTAL_PAGE_NUMBER + 1) //0xA9 + + + +//------------------------------------------------------------------------- +// Chip specific +//------------------------------------------------------------------------- +#define CHIP_BONDING_IDENTIFIER(_value) (((_value)>>22)&0x3) +#define CHIP_BONDING_92C_1T2R 0x1 +#define CHIP_BONDING_88C_USB_MCARD 0x2 +#define CHIP_BONDING_88C_USB_HP 0x1 +#include "HalVerDef.h" +#include "hal_com.h" + +//------------------------------------------------------------------------- +// Channel Plan +//------------------------------------------------------------------------- +enum ChannelPlan +{ + CHPL_FCC = 0, + CHPL_IC = 1, + CHPL_ETSI = 2, + CHPL_SPAIN = 3, + CHPL_FRANCE = 4, + CHPL_MKK = 5, + CHPL_MKK1 = 6, + CHPL_ISRAEL = 7, + CHPL_TELEC = 8, + CHPL_GLOBAL = 9, + CHPL_WORLD = 10, +}; + +typedef struct _TxPowerInfo +{ + u8 CCKIndex[RF_PATH_MAX][CHANNEL_GROUP_MAX_88E]; + u8 HT40_1SIndex[RF_PATH_MAX][CHANNEL_GROUP_MAX_88E]; + u8 HT40_2SIndexDiff[RF_PATH_MAX][CHANNEL_GROUP_MAX_88E]; + u8 HT20IndexDiff[RF_PATH_MAX][CHANNEL_GROUP_MAX_88E]; + u8 OFDMIndexDiff[RF_PATH_MAX][CHANNEL_GROUP_MAX_88E]; + u8 HT40MaxOffset[RF_PATH_MAX][CHANNEL_GROUP_MAX_88E]; + u8 HT20MaxOffset[RF_PATH_MAX][CHANNEL_GROUP_MAX_88E]; + u8 TSSI_A[3]; + u8 TSSI_B[3]; + u8 TSSI_A_5G[3]; //5GL/5GM/5GH + u8 TSSI_B_5G[3]; +} TxPowerInfo, *PTxPowerInfo; + +typedef struct _TxPowerInfo24G{ + u1Byte IndexCCK_Base[MAX_RF_PATH][MAX_CHNL_GROUP_24G]; + u1Byte IndexBW40_Base[MAX_RF_PATH][MAX_CHNL_GROUP_24G-1]; + //If only one tx, only BW20 and OFDM are used. + s1Byte CCK_Diff[MAX_RF_PATH][MAX_TX_COUNT]; + s1Byte OFDM_Diff[MAX_RF_PATH][MAX_TX_COUNT]; + s1Byte BW20_Diff[MAX_RF_PATH][MAX_TX_COUNT]; + s1Byte BW40_Diff[MAX_RF_PATH][MAX_TX_COUNT]; +}TxPowerInfo24G, *PTxPowerInfo24G; + +#define EFUSE_REAL_CONTENT_LEN 512 +#define EFUSE_MAP_LEN 128 +#define EFUSE_MAX_SECTION 16 +#define EFUSE_IC_ID_OFFSET 506 //For some inferiority IC purpose. added by Roger, 2009.09.02. +#define AVAILABLE_EFUSE_ADDR(addr) (addr < EFUSE_REAL_CONTENT_LEN) +// +// +// To prevent out of boundary programming case, +// leave 1byte and program full section +// 9bytes + 1byt + 5bytes and pre 1byte. +// For worst case: +// | 1byte|----8bytes----|1byte|--5bytes--| +// | | Reserved(14bytes) | +// +#define EFUSE_OOB_PROTECT_BYTES 15 // PG data exclude header, dummy 6 bytes frome CP test and reserved 1byte. + +#define HWSET_MAX_SIZE_88E 512 + +#define EFUSE_REAL_CONTENT_LEN_88E 256 +#define EFUSE_MAP_LEN_88E 512 +#define EFUSE_MAX_SECTION_88E 64 +#define EFUSE_MAX_WORD_UNIT_88E 4 +#define EFUSE_IC_ID_OFFSET_88E 506 //For some inferiority IC purpose. added by Roger, 2009.09.02. +#define AVAILABLE_EFUSE_ADDR_88E(addr) (addr < EFUSE_REAL_CONTENT_LEN_88E) +// To prevent out of boundary programming case, leave 1byte and program full section +// 9bytes + 1byt + 5bytes and pre 1byte. +// For worst case: +// | 2byte|----8bytes----|1byte|--7bytes--| //92D +#define EFUSE_OOB_PROTECT_BYTES_88E 18 // PG data exclude header, dummy 7 bytes frome CP test and reserved 1byte. +#define EFUSE_PROTECT_BYTES_BANK_88E 16 + + +//======================================================== +// EFUSE for BT definition +//======================================================== +#define EFUSE_BT_REAL_CONTENT_LEN 1536 // 512*3 +#define EFUSE_BT_MAP_LEN 1024 // 1k bytes +#define EFUSE_BT_MAX_SECTION 128 // 1024/8 + +#define EFUSE_PROTECT_BYTES_BANK 16 + +// +// For RTL8723 WiFi/BT/GPS multi-function configuration. 2010.10.06. +// +typedef enum _RT_MULTI_FUNC { + RT_MULTI_FUNC_NONE = 0x00, + RT_MULTI_FUNC_WIFI = 0x01, + RT_MULTI_FUNC_BT = 0x02, + RT_MULTI_FUNC_GPS = 0x04, +} RT_MULTI_FUNC, *PRT_MULTI_FUNC; + +// +// For RTL8723 WiFi PDn/GPIO polarity control configuration. 2010.10.08. +// +typedef enum _RT_POLARITY_CTL { + RT_POLARITY_LOW_ACT = 0, + RT_POLARITY_HIGH_ACT = 1, +} RT_POLARITY_CTL, *PRT_POLARITY_CTL; + +// For RTL8723 regulator mode. by tynli. 2011.01.14. +typedef enum _RT_REGULATOR_MODE { + RT_SWITCHING_REGULATOR = 0, + RT_LDO_REGULATOR = 1, +} RT_REGULATOR_MODE, *PRT_REGULATOR_MODE; + + +typedef struct hal_data_8188e +{ + HAL_VERSION VersionID; + RT_MULTI_FUNC MultiFunc; // For multi-function consideration. + RT_POLARITY_CTL PolarityCtl; // For Wifi PDn Polarity control. + RT_REGULATOR_MODE RegulatorMode; // switching regulator or LDO + u16 CustomerID; + + u16 FirmwareVersion; + u16 FirmwareVersionRev; + u16 FirmwareSubVersion; + u16 FirmwareSignature; + u8 PGMaxGroup; + //current WIFI_PHY values + u32 ReceiveConfig; + WIRELESS_MODE CurrentWirelessMode; + HT_CHANNEL_WIDTH CurrentChannelBW; + u8 CurrentChannel; + u8 nCur40MhzPrimeSC;// Control channel sub-carrier + + u16 BasicRateSet; + + //rf_ctrl + u8 rf_chip; + u8 rf_type; + u8 NumTotalRFPath; + + u8 BoardType; + + // + // EEPROM setting. + // + u16 EEPROMVID; + u16 EEPROMPID; + u16 EEPROMSVID; + u16 EEPROMSDID; + u8 EEPROMCustomerID; + u8 EEPROMSubCustomerID; + u8 EEPROMVersion; + u8 EEPROMRegulatory; + + u8 bTXPowerDataReadFromEEPORM; + u8 EEPROMThermalMeter; + u8 bAPKThermalMeterIgnore; + + BOOLEAN EepromOrEfuse; + u8 EfuseMap[2][HWSET_MAX_SIZE_512]; //92C:256bytes, 88E:512bytes, we use union set (512bytes) + u8 EfuseUsedPercentage; + EFUSE_HAL EfuseHal; + + //u8 bIQKInitialized; + + + u8 Index24G_CCK_Base[MAX_RF_PATH][CHANNEL_MAX_NUMBER]; + u8 Index24G_BW40_Base[MAX_RF_PATH][CHANNEL_MAX_NUMBER]; + //If only one tx, only BW20 and OFDM are used. + s8 CCK_24G_Diff[MAX_RF_PATH][MAX_TX_COUNT]; + s8 OFDM_24G_Diff[MAX_RF_PATH][MAX_TX_COUNT]; + s8 BW20_24G_Diff[MAX_RF_PATH][MAX_TX_COUNT]; + s8 BW40_24G_Diff[MAX_RF_PATH][MAX_TX_COUNT]; + + u8 TxPwrLevelCck[RF_PATH_MAX][CHANNEL_MAX_NUMBER]; + u8 TxPwrLevelHT40_1S[RF_PATH_MAX][CHANNEL_MAX_NUMBER]; // For HT 40MHZ pwr + u8 TxPwrLevelHT40_2S[RF_PATH_MAX][CHANNEL_MAX_NUMBER]; // For HT 40MHZ pwr + u8 TxPwrHt20Diff[RF_PATH_MAX][CHANNEL_MAX_NUMBER];// HT 20<->40 Pwr diff + u8 TxPwrLegacyHtDiff[RF_PATH_MAX][CHANNEL_MAX_NUMBER];// For HT<->legacy pwr diff + // For power group + u8 PwrGroupHT20[RF_PATH_MAX][CHANNEL_MAX_NUMBER]; + u8 PwrGroupHT40[RF_PATH_MAX][CHANNEL_MAX_NUMBER]; + + u8 LegacyHTTxPowerDiff;// Legacy to HT rate power diff + // The current Tx Power Level + u8 CurrentCckTxPwrIdx; + u8 CurrentOfdm24GTxPwrIdx; + u8 CurrentBW2024GTxPwrIdx; + u8 CurrentBW4024GTxPwrIdx; + + + // Read/write are allow for following hardware information variables + u8 framesync; + u32 framesyncC34; + u8 framesyncMonitor; + u8 DefaultInitialGain[4]; + u8 pwrGroupCnt; + u32 MCSTxPowerLevelOriginalOffset[MAX_PG_GROUP][16]; + u32 CCKTxPowerLevelOriginalOffset; + + u8 CrystalCap; + u32 AntennaTxPath; // Antenna path Tx + u32 AntennaRxPath; // Antenna path Rx + u8 BluetoothCoexist; + u8 ExternalPA; + + u8 bLedOpenDrain; // Support Open-drain arrangement for controlling the LED. Added by Roger, 2009.10.16. + + //u32 LedControlNum; + //u32 LedControlMode; + //u32 TxPowerTrackControl; + u8 b1x1RecvCombine; // for 1T1R receive combining + + //u8 bCurrentTurboEDCA; + u32 AcParam_BE; //Original parameter for BE, use for EDCA turbo. + + BB_REGISTER_DEFINITION_T PHYRegDef[4]; //Radio A/B/C/D + + u32 RfRegChnlVal[2]; + + //RDG enable + BOOLEAN bRDGEnable; + + //for host message to fw + u8 LastHMEBoxNum; + + u8 fw_ractrl; + u8 RegTxPause; + // Beacon function related global variable. + u32 RegBcnCtrlVal; + u8 RegFwHwTxQCtrl; + u8 RegReg542; + u8 RegCR_1; + + struct dm_priv dmpriv; + DM_ODM_T odmpriv; + //_lock odm_stainfo_lock; +#ifdef DBG_CONFIG_ERROR_DETECT + struct sreset_priv srestpriv; +#endif + +#ifdef CONFIG_BT_COEXIST + struct btcoexist_priv bt_coexist; +#endif + + u8 CurAntenna; + u8 AntDivCfg; + u8 TRxAntDivType; + + + u8 bDumpRxPkt;//for debug + u8 bDumpTxPkt;//for debug + u8 FwRsvdPageStartOffset; //2010.06.23. Added by tynli. Reserve page start offset except beacon in TxQ. + + // 2010/08/09 MH Add CU power down mode. + BOOLEAN pwrdown; + + // Add for dual MAC 0--Mac0 1--Mac1 + u32 interfaceIndex; + + u8 OutEpQueueSel; + u8 OutEpNumber; + + // 2010/12/10 MH Add for USB aggreation mode dynamic shceme. + BOOLEAN UsbRxHighSpeedMode; + + // 2010/11/22 MH Add for slim combo debug mode selective. + // This is used for fix the drawback of CU TSMC-A/UMC-A cut. HW auto suspend ability. Close BT clock. + BOOLEAN SlimComboDbg; + + u16 EfuseUsedBytes; + +#ifdef CONFIG_P2P + struct P2P_PS_Offload_t p2p_ps_offload; +#endif + + // Auto FSM to Turn On, include clock, isolation, power control for MAC only + u8 bMacPwrCtrlOn; + +#ifdef CONFIG_SDIO_HCI + // + // For SDIO Interface HAL related + // + + // + // SDIO ISR Related + // +// u32 IntrMask[1]; +// u32 IntrMaskToSet[1]; +// LOG_INTERRUPT InterruptLog; + u32 sdio_himr; + u32 sdio_hisr; + + // + // SDIO Tx FIFO related. + // + // HIQ, MID, LOW, PUB free pages; padapter->xmitpriv.free_txpg + u8 SdioTxFIFOFreePage[SDIO_TX_FREE_PG_QUEUE]; + _lock SdioTxFIFOFreePageLock; + + // + // SDIO Rx FIFO related. + // + u8 SdioRxFIFOCnt; + u16 SdioRxFIFOSize; +#endif //CONFIG_SDIO_HCI + +#ifdef CONFIG_USB_HCI + u32 UsbBulkOutSize; + + // Interrupt relatd register information. + u32 IntArray[3];//HISR0,HISR1,HSISR + u32 IntrMask[3]; + u8 C2hArray[16]; +#ifdef CONFIG_USB_TX_AGGREGATION + u8 UsbTxAggMode; + u8 UsbTxAggDescNum; +#endif +#ifdef CONFIG_USB_RX_AGGREGATION + u16 HwRxPageSize; // Hardware setting + u32 MaxUsbRxAggBlock; + + USB_RX_AGG_MODE UsbRxAggMode; + u8 UsbRxAggBlockCount; // USB Block count. Block size is 512-byte in hight speed and 64-byte in full speed + u8 UsbRxAggBlockTimeout; + u8 UsbRxAggPageCount; // 8192C DMA page count + u8 UsbRxAggPageTimeout; +#endif +#endif //CONFIG_USB_HCI + + +#ifdef CONFIG_PCI_HCI + + // + // EEPROM setting. + // + + u16 EEPROMDID; + u16 EEPROMSMID; + u16 EEPROMChannelPlan; + + u8 EEPROMTSSI[2]; + u8 EEPROMBoardType; + u32 TransmitConfig; + + u32 IntrMask[2]; + u32 IntrMaskToSet[2]; + + u8 bDefaultAntenna; + u8 bIQKInitialized; + + u8 bInterruptMigration; + u8 bDisableTxInt; + u8 bGpioHwWpsPbc; +#endif //CONFIG_PCI_HCI + + +#ifdef CONFIG_TX_EARLY_MODE + u8 bEarlyModeEnable; +#endif +} HAL_DATA_8188E, *PHAL_DATA_8188E; + +typedef struct hal_data_8188e HAL_DATA_TYPE, *PHAL_DATA_TYPE; + + +#define GET_HAL_DATA(__pAdapter) ((HAL_DATA_TYPE *)((__pAdapter)->HalData)) +#define GET_RF_TYPE(priv) (GET_HAL_DATA(priv)->rf_type) + +#define INCLUDE_MULTI_FUNC_BT(_Adapter) (GET_HAL_DATA(_Adapter)->MultiFunc & RT_MULTI_FUNC_BT) +#define INCLUDE_MULTI_FUNC_GPS(_Adapter) (GET_HAL_DATA(_Adapter)->MultiFunc & RT_MULTI_FUNC_GPS) + +//#define IS_MULTI_FUNC_CHIP(_Adapter) (((((PHAL_DATA_TYPE)(_Adapter->HalData))->MultiFunc) & (RT_MULTI_FUNC_BT|RT_MULTI_FUNC_GPS)) ? _TRUE : _FALSE) + +//#define RT_IS_FUNC_DISABLED(__pAdapter, __FuncBits) ( (__pAdapter)->DisabledFunctions & (__FuncBits) ) + +#ifdef CONFIG_PCI_HCI +void InterruptRecognized8188EE(struct adapter *Adapter, PRT_ISR_CONTENT pIsrContent); +void UpdateInterruptMask8188EE(struct adapter *Adapter, u32 AddMSR, u32 AddMSR1, u32 RemoveMSR, u32 RemoveMSR1); +#endif //CONFIG_PCI_HCI + +// rtl8188e_hal_init.c +#ifdef CONFIG_WOWLAN +s32 rtl8188e_FirmwareDownload(struct adapter *padapter, BOOLEAN bUsedWoWLANFw); +#else +s32 rtl8188e_FirmwareDownload(struct adapter *padapter); +#endif +void _8051Reset88E(struct adapter *padapter); +void rtl8188e_InitializeFirmwareVars(struct adapter *padapter); + + +s32 InitLLTTable(struct adapter *padapter, u8 txpktbuf_bndy); +void Read_LLT_Tab(struct adapter *padapter); + +// EFuse +u8 GetEEPROMSize8188E(struct adapter *padapter); +void Hal_InitPGData88E(struct adapter *padapter); +void Hal_EfuseParseIDCode88E(struct adapter *padapter, u8 *hwinfo); +void Hal_ReadTxPowerInfo88E(struct adapter *padapter,u8* hwinfo,BOOLEAN AutoLoadFail); + +void Hal_EfuseParseEEPROMVer88E(struct adapter *padapter, u8 *hwinfo, BOOLEAN AutoLoadFail); +void rtl8188e_EfuseParseChnlPlan(struct adapter *padapter, u8 *hwinfo, BOOLEAN AutoLoadFail); +void Hal_EfuseParseCustomerID88E(struct adapter *padapter, u8 *hwinfo, BOOLEAN AutoLoadFail); +void Hal_ReadAntennaDiversity88E (struct adapter *pAdapter,u8*PROMContent,BOOLEAN AutoLoadFail); +void Hal_ReadThermalMeter_88E(struct adapter *Adapter,u8* PROMContent,BOOLEAN AutoloadFail); +void Hal_EfuseParseXtal_8188E(struct adapter *pAdapter,u8* hwinfo,BOOLEAN AutoLoadFail); +void Hal_EfuseParseBoardType88E(struct adapter *pAdapter,u8* hwinfo,BOOLEAN AutoLoadFail); +void Hal_ReadPowerSavingMode88E(struct adapter *pAdapter,u8* hwinfo,BOOLEAN AutoLoadFail); + +BOOLEAN HalDetectPwrDownMode88E(struct adapter *Adapter); + +#ifdef CONFIG_WOWLAN +void Hal_DetectWoWMode(struct adapter *pAdapter); +#endif //CONFIG_WOWLAN + +#ifdef CONFIG_RF_GAIN_OFFSET +void Hal_ReadRFGainOffset(struct adapter *pAdapter,u8* hwinfo,BOOLEAN AutoLoadFail); +#endif //CONFIG_RF_GAIN_OFFSET + +//RT_CHANNEL_DOMAIN rtl8723a_HalMapChannelPlan(struct adapter *padapter, u8 HalChannelPlan); +//VERSION_8192C rtl8723a_ReadChipVersion(struct adapter *padapter); +//void rtl8723a_ReadBluetoothCoexistInfo(struct adapter *padapter, u8 *PROMContent, BOOLEAN AutoloadFail); +void Hal_InitChannelPlan(struct adapter *padapter); + +void rtl8188e_set_hal_ops(struct hal_ops *pHalFunc); + +// register +void SetBcnCtrlReg(struct adapter *padapter, u8 SetBits, u8 ClearBits); + +void rtl8188e_start_thread(struct adapter *padapter); +void rtl8188e_stop_thread(struct adapter *padapter); + +void rtw_IOL_cmd_tx_pkt_buf_dump(struct adapter *Adapter,int data_len); +#ifdef CONFIG_IOL_EFUSE_PATCH +s32 rtl8188e_iol_efuse_patch(struct adapter *padapter); +#endif//CONFIG_IOL_EFUSE_PATCH + +#endif //__RTL8188E_HAL_H__ diff --git a/include/rtl8188e_led.h b/include/rtl8188e_led.h index ada0446..4073c64 100755 --- a/include/rtl8188e_led.h +++ b/include/rtl8188e_led.h @@ -1,46 +1,45 @@ -/****************************************************************************** - * - * 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 __RTL8188E_LED_H__ -#define __RTL8188E_LED_H__ - -#include -#include -#include - - -//================================================================================ -// Interface to manipulate LED objects. -//================================================================================ -#ifdef CONFIG_USB_HCI -void rtl8188eu_InitSwLeds(struct adapter *padapter); -void rtl8188eu_DeInitSwLeds(struct adapter *padapter); -#endif -#ifdef CONFIG_PCI_HCI -void rtl8188ee_gen_RefreshLedState(struct adapter *Adapter); -void rtl8188ee_InitSwLeds(struct adapter *padapter); -void rtl8188ee_DeInitSwLeds(struct adapter *padapter); -#endif -#ifdef CONFIG_SDIO_HCI -void rtl8188es_InitSwLeds(struct adapter *padapter); -void rtl8188es_DeInitSwLeds(struct adapter *padapter); -#endif - -#endif - +/****************************************************************************** + * + * 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 __RTL8188E_LED_H__ +#define __RTL8188E_LED_H__ + +#include +#include +#include + + +//================================================================================ +// Interface to manipulate LED objects. +//================================================================================ +#ifdef CONFIG_USB_HCI +void rtl8188eu_InitSwLeds(struct adapter *padapter); +void rtl8188eu_DeInitSwLeds(struct adapter *padapter); +#endif +#ifdef CONFIG_PCI_HCI +void rtl8188ee_gen_RefreshLedState(struct adapter *Adapter); +void rtl8188ee_InitSwLeds(struct adapter *padapter); +void rtl8188ee_DeInitSwLeds(struct adapter *padapter); +#endif +#ifdef CONFIG_SDIO_HCI +void rtl8188es_InitSwLeds(struct adapter *padapter); +void rtl8188es_DeInitSwLeds(struct adapter *padapter); +#endif + +#endif diff --git a/include/rtl8188e_recv.h b/include/rtl8188e_recv.h index bb923e4..7707c6e 100755 --- a/include/rtl8188e_recv.h +++ b/include/rtl8188e_recv.h @@ -1,146 +1,145 @@ -/****************************************************************************** - * - * 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 __RTL8188E_RECV_H__ -#define __RTL8188E_RECV_H__ - -#include - -#define TX_RPT1_PKT_LEN 8 - -typedef enum _RX_PACKET_TYPE{ - NORMAL_RX,//Normal rx packet - TX_REPORT1,//CCX - TX_REPORT2,//TX RPT - HIS_REPORT,// USB HISR RPT -}RX_PACKET_TYPE, *PRX_PACKET_TYPE; - -typedef struct rxreport_8188e -{ - //Offset 0 - u32 pktlen:14; - u32 crc32:1; - u32 icverr:1; - u32 drvinfosize:4; - u32 security:3; - u32 qos:1; - u32 shift:2; - u32 physt:1; - u32 swdec:1; - u32 ls:1; - u32 fs:1; - u32 eor:1; - u32 own:1; - - //Offset 4 - u32 macid:5; - u32 tid:4; - u32 hwrsvd:4; - u32 amsdu:1; - u32 paggr:1; - u32 faggr:1; - u32 a1fit:4; - u32 a2fit:4; - u32 pam:1; - u32 pwr:1; - u32 md:1; - u32 mf:1; - u32 type:2; - u32 mc:1; - u32 bc:1; - - //Offset 8 - u32 seq:12; - u32 frag:4; - u32 nextpktlen:14; - u32 nextind:1; - u32 rsvd0831:1; - - //Offset 12 - u32 rxmcs:6; - u32 rxht:1; - u32 gf:1; - u32 splcp:1; - u32 bw:1; - u32 htc:1; - u32 eosp:1; - u32 bssidfit:2; - u32 rpt_sel:2; - u32 rsvd1216:13; - u32 pattern_match:1; - u32 unicastwake:1; - u32 magicwake:1; - - //Offset 16 - /* - u32 pattern0match:1; - u32 pattern1match:1; - u32 pattern2match:1; - u32 pattern3match:1; - u32 pattern4match:1; - u32 pattern5match:1; - u32 pattern6match:1; - u32 pattern7match:1; - u32 pattern8match:1; - u32 pattern9match:1; - u32 patternamatch:1; - u32 patternbmatch:1; - u32 patterncmatch:1; - u32 rsvd1613:19; - */ - u32 rsvd16; - - //Offset 20 - u32 tsfl; - - //Offset 24 - u32 bassn:12; - u32 bavld:1; - u32 rsvd2413:19; -} RXREPORT, *PRXREPORT; - - -#ifdef CONFIG_SDIO_HCI -s32 rtl8188es_init_recv_priv(struct adapter *padapter); -void rtl8188es_free_recv_priv(struct adapter *padapter); -void rtl8188es_recv_hdl(struct adapter *padapter, struct recv_buf *precvbuf); -#endif - -#ifdef CONFIG_USB_HCI -#define INTERRUPT_MSG_FORMAT_LEN 60 -void rtl8188eu_init_recvbuf(struct adapter *padapter, struct recv_buf *precvbuf); -s32 rtl8188eu_init_recv_priv(struct adapter *padapter); -void rtl8188eu_free_recv_priv(struct adapter *padapter); -void rtl8188eu_recv_hdl(struct adapter *padapter, struct recv_buf *precvbuf); -void rtl8188eu_recv_tasklet(void *priv); - -#endif - -#ifdef CONFIG_PCI_HCI -s32 rtl8188ee_init_recv_priv(struct adapter *padapter); -void rtl8188ee_free_recv_priv(struct adapter *padapter); -#endif - -void rtl8188e_query_rx_phy_status(union recv_frame *prframe, struct phy_stat *pphy_stat); -void rtl8188e_process_phy_info(struct adapter *padapter, void *prframe); -void update_recvframe_phyinfo_88e(union recv_frame *precvframe,struct phy_stat *pphy_status); -void update_recvframe_attrib_88e( union recv_frame *precvframe, struct recv_stat *prxstat); - -#endif - +/****************************************************************************** + * + * 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 __RTL8188E_RECV_H__ +#define __RTL8188E_RECV_H__ + +#include + +#define TX_RPT1_PKT_LEN 8 + +typedef enum _RX_PACKET_TYPE{ + NORMAL_RX,//Normal rx packet + TX_REPORT1,//CCX + TX_REPORT2,//TX RPT + HIS_REPORT,// USB HISR RPT +}RX_PACKET_TYPE, *PRX_PACKET_TYPE; + +typedef struct rxreport_8188e +{ + //Offset 0 + u32 pktlen:14; + u32 crc32:1; + u32 icverr:1; + u32 drvinfosize:4; + u32 security:3; + u32 qos:1; + u32 shift:2; + u32 physt:1; + u32 swdec:1; + u32 ls:1; + u32 fs:1; + u32 eor:1; + u32 own:1; + + //Offset 4 + u32 macid:5; + u32 tid:4; + u32 hwrsvd:4; + u32 amsdu:1; + u32 paggr:1; + u32 faggr:1; + u32 a1fit:4; + u32 a2fit:4; + u32 pam:1; + u32 pwr:1; + u32 md:1; + u32 mf:1; + u32 type:2; + u32 mc:1; + u32 bc:1; + + //Offset 8 + u32 seq:12; + u32 frag:4; + u32 nextpktlen:14; + u32 nextind:1; + u32 rsvd0831:1; + + //Offset 12 + u32 rxmcs:6; + u32 rxht:1; + u32 gf:1; + u32 splcp:1; + u32 bw:1; + u32 htc:1; + u32 eosp:1; + u32 bssidfit:2; + u32 rpt_sel:2; + u32 rsvd1216:13; + u32 pattern_match:1; + u32 unicastwake:1; + u32 magicwake:1; + + //Offset 16 + /* + u32 pattern0match:1; + u32 pattern1match:1; + u32 pattern2match:1; + u32 pattern3match:1; + u32 pattern4match:1; + u32 pattern5match:1; + u32 pattern6match:1; + u32 pattern7match:1; + u32 pattern8match:1; + u32 pattern9match:1; + u32 patternamatch:1; + u32 patternbmatch:1; + u32 patterncmatch:1; + u32 rsvd1613:19; + */ + u32 rsvd16; + + //Offset 20 + u32 tsfl; + + //Offset 24 + u32 bassn:12; + u32 bavld:1; + u32 rsvd2413:19; +} RXREPORT, *PRXREPORT; + + +#ifdef CONFIG_SDIO_HCI +s32 rtl8188es_init_recv_priv(struct adapter *padapter); +void rtl8188es_free_recv_priv(struct adapter *padapter); +void rtl8188es_recv_hdl(struct adapter *padapter, struct recv_buf *precvbuf); +#endif + +#ifdef CONFIG_USB_HCI +#define INTERRUPT_MSG_FORMAT_LEN 60 +void rtl8188eu_init_recvbuf(struct adapter *padapter, struct recv_buf *precvbuf); +s32 rtl8188eu_init_recv_priv(struct adapter *padapter); +void rtl8188eu_free_recv_priv(struct adapter *padapter); +void rtl8188eu_recv_hdl(struct adapter *padapter, struct recv_buf *precvbuf); +void rtl8188eu_recv_tasklet(void *priv); + +#endif + +#ifdef CONFIG_PCI_HCI +s32 rtl8188ee_init_recv_priv(struct adapter *padapter); +void rtl8188ee_free_recv_priv(struct adapter *padapter); +#endif + +void rtl8188e_query_rx_phy_status(union recv_frame *prframe, struct phy_stat *pphy_stat); +void rtl8188e_process_phy_info(struct adapter *padapter, void *prframe); +void update_recvframe_phyinfo_88e(union recv_frame *precvframe,struct phy_stat *pphy_status); +void update_recvframe_attrib_88e( union recv_frame *precvframe, struct recv_stat *prxstat); + +#endif diff --git a/include/rtl8188e_rf.h b/include/rtl8188e_rf.h index 67f43b5..204d78c 100755 --- a/include/rtl8188e_rf.h +++ b/include/rtl8188e_rf.h @@ -26,11 +26,11 @@ int PHY_RF6052_Config8188E( IN struct adapter * Adapter ); -void rtl8188e_RF_ChangeTxPath( IN struct adapter *Adapter, +void rtl8188e_RF_ChangeTxPath( IN struct adapter *Adapter, IN u16 DataRate); -void rtl8188e_PHY_RF6052SetBandwidth( +void rtl8188e_PHY_RF6052SetBandwidth( IN struct adapter * Adapter, - IN HT_CHANNEL_WIDTH Bandwidth); + IN HT_CHANNEL_WIDTH Bandwidth); VOID rtl8188e_PHY_RF6052SetCckTxPower( IN struct adapter *Adapter, IN u8* pPowerlevel); @@ -38,8 +38,7 @@ VOID rtl8188e_PHY_RF6052SetOFDMTxPower( IN struct adapter *Adapter, IN u8* pPowerLevelOFDM, IN u8* pPowerLevelBW20, - IN u8* pPowerLevelBW40, + IN u8* pPowerLevelBW40, IN u8 Channel); #endif//__RTL8188E_RF_H__ - diff --git a/include/rtl8188e_spec.h b/include/rtl8188e_spec.h index 0421da9..5446063 100755 --- a/include/rtl8188e_spec.h +++ b/include/rtl8188e_spec.h @@ -1,1741 +1,1740 @@ -/****************************************************************************** - * - * 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 __RTL8188E_SPEC_H__ -#define __RTL8188E_SPEC_H__ - -#include - -#ifndef BIT -#define BIT(x) (1 << (x)) -#endif - -#define BIT0 0x00000001 -#define BIT1 0x00000002 -#define BIT2 0x00000004 -#define BIT3 0x00000008 -#define BIT4 0x00000010 -#define BIT5 0x00000020 -#define BIT6 0x00000040 -#define BIT7 0x00000080 -#define BIT8 0x00000100 -#define BIT9 0x00000200 -#define BIT10 0x00000400 -#define BIT11 0x00000800 -#define BIT12 0x00001000 -#define BIT13 0x00002000 -#define BIT14 0x00004000 -#define BIT15 0x00008000 -#define BIT16 0x00010000 -#define BIT17 0x00020000 -#define BIT18 0x00040000 -#define BIT19 0x00080000 -#define BIT20 0x00100000 -#define BIT21 0x00200000 -#define BIT22 0x00400000 -#define BIT23 0x00800000 -#define BIT24 0x01000000 -#define BIT25 0x02000000 -#define BIT26 0x04000000 -#define BIT27 0x08000000 -#define BIT28 0x10000000 -#define BIT29 0x20000000 -#define BIT30 0x40000000 -#define BIT31 0x80000000 - -//============================================================ -// 8192C Regsiter offset definition -//============================================================ - -#define HAL_PS_TIMER_INT_DELAY 50 // 50 microseconds -#define HAL_92C_NAV_UPPER_UNIT 128 // micro-second - -#define MAC_ADDR_LEN 6 -// 8188E PKT_BUFF_ACCESS_CTRL value -#define TXPKT_BUF_SELECT 0x69 -#define RXPKT_BUF_SELECT 0xA5 -#define DISABLE_TRXPKT_BUF_ACCESS 0x0 - -//============================================================ -// -//============================================================ - -//----------------------------------------------------- -// -// 0x0000h ~ 0x00FFh System Configuration -// -//----------------------------------------------------- -#define REG_SYS_ISO_CTRL 0x0000 -#define REG_SYS_FUNC_EN 0x0002 -#define REG_APS_FSMCO 0x0004 -#define REG_SYS_CLKR 0x0008 -#define REG_9346CR 0x000A -#define REG_EE_VPD 0x000C -#define REG_AFE_MISC 0x0010 -#define REG_SPS0_CTRL 0x0011 -#define REG_SPS_OCP_CFG 0x0018 -#define REG_RSV_CTRL 0x001C -#define REG_RF_CTRL 0x001F -#define REG_LDOA15_CTRL 0x0020 -#define REG_LDOV12D_CTRL 0x0021 -#define REG_LDOHCI12_CTRL 0x0022 -#define REG_LPLDO_CTRL 0x0023 -#define REG_AFE_XTAL_CTRL 0x0024 -#define REG_AFE_PLL_CTRL 0x0028 -#define REG_APE_PLL_CTRL_EXT 0x002c -#define REG_EFUSE_CTRL 0x0030 -#define REG_EFUSE_TEST 0x0034 -#define REG_GPIO_MUXCFG 0x0040 -#define REG_GPIO_IO_SEL 0x0042 -#define REG_MAC_PINMUX_CFG 0x0043 -#define REG_GPIO_PIN_CTRL 0x0044 -#define REG_GPIO_INTM 0x0048 -#define REG_LEDCFG0 0x004C -#define REG_LEDCFG1 0x004D -#define REG_LEDCFG2 0x004E -#define REG_LEDCFG3 0x004F -#define REG_FSIMR 0x0050 -#define REG_FSISR 0x0054 -#define REG_HSIMR 0x0058 -#define REG_HSISR 0x005c -#define REG_GPIO_PIN_CTRL_2 0x0060 // RTL8723 WIFI/BT/GPS Multi-Function GPIO Pin Control. -#define REG_GPIO_IO_SEL_2 0x0062 // RTL8723 WIFI/BT/GPS Multi-Function GPIO Select. -#define REG_BB_PAD_CTRL 0x0064 -#define REG_MULTI_FUNC_CTRL 0x0068 // RTL8723 WIFI/BT/GPS Multi-Function control source. -#define REG_GPIO_OUTPUT 0x006c -#define REG_AFE_XTAL_CTRL_EXT 0x0078 //RTL8188E -#define REG_XCK_OUT_CTRL 0x007c //RTL8188E -#define REG_MCUFWDL 0x0080 -#define REG_WOL_EVENT 0x0081 //RTL8188E -#define REG_MCUTSTCFG 0x0084 -#define REG_HMEBOX_E0 0x0088 -#define REG_HMEBOX_E1 0x008A -#define REG_HMEBOX_E2 0x008C -#define REG_HMEBOX_E3 0x008E -#define REG_HMEBOX_EXT_0 0x01F0 -#define REG_HMEBOX_EXT_1 0x01F4 -#define REG_HMEBOX_EXT_2 0x01F8 -#define REG_HMEBOX_EXT_3 0x01FC -#define REG_HIMR_88E 0x00B0 -#define REG_HISR_88E 0x00B4 -#define REG_HIMRE_88E 0x00B8 -#define REG_HISRE_88E 0x00BC -#define REG_EFUSE_ACCESS 0x00CF // Efuse access protection for RTL8723 -#define REG_BIST_SCAN 0x00D0 -#define REG_BIST_RPT 0x00D4 -#define REG_BIST_ROM_RPT 0x00D8 -#define REG_USB_SIE_INTF 0x00E0 -#define REG_PCIE_MIO_INTF 0x00E4 -#define REG_PCIE_MIO_INTD 0x00E8 -#define REG_HPON_FSM 0x00EC -#define REG_SYS_CFG 0x00F0 -#define REG_GPIO_OUTSTS 0x00F4 // For RTL8723 only. -#define REG_TYPE_ID 0x00FC - -#define REG_MAC_PHY_CTRL_NORMAL 0x00f8 - -//----------------------------------------------------- -// -// 0x0100h ~ 0x01FFh MACTOP General Configuration -// -//----------------------------------------------------- -#define REG_CR 0x0100 -#define REG_PBP 0x0104 -#define REG_PKT_BUFF_ACCESS_CTRL 0x0106 -#define REG_TRXDMA_CTRL 0x010C -#define REG_TRXFF_BNDY 0x0114 -#define REG_TRXFF_STATUS 0x0118 -#define REG_RXFF_PTR 0x011C -//#define REG_HIMR 0x0120 -//#define REG_HISR 0x0124 -#define REG_HIMRE 0x0128 -#define REG_HISRE 0x012C -#define REG_CPWM 0x012F -#define REG_FWIMR 0x0130 -#define REG_FTIMR 0x0138 -#define REG_FWISR 0x0134 -#define REG_PKTBUF_DBG_CTRL 0x0140 -#define REG_PKTBUF_DBG_ADDR (REG_PKTBUF_DBG_CTRL) -#define REG_RXPKTBUF_DBG (REG_PKTBUF_DBG_CTRL+2) -#define REG_TXPKTBUF_DBG (REG_PKTBUF_DBG_CTRL+3) -#define REG_RXPKTBUF_CTRL (REG_PKTBUF_DBG_CTRL+2) -#define REG_PKTBUF_DBG_DATA_L 0x0144 -#define REG_PKTBUF_DBG_DATA_H 0x0148 - -#define REG_TC0_CTRL 0x0150 -#define REG_TC1_CTRL 0x0154 -#define REG_TC2_CTRL 0x0158 -#define REG_TC3_CTRL 0x015C -#define REG_TC4_CTRL 0x0160 -#define REG_TCUNIT_BASE 0x0164 -#define REG_MBIST_START 0x0174 -#define REG_MBIST_DONE 0x0178 -#define REG_MBIST_FAIL 0x017C -#define REG_32K_CTRL 0x0194 //RTL8188E -#define REG_C2HEVT_MSG_NORMAL 0x01A0 -#define REG_C2HEVT_CLEAR 0x01AF -#define REG_MCUTST_1 0x01c0 -#ifdef CONFIG_WOWLAN -#define REG_WOWLAN_WAKE_REASON 0x01c7 -#endif -#define REG_FMETHR 0x01C8 -#define REG_HMETFR 0x01CC -#define REG_HMEBOX_0 0x01D0 -#define REG_HMEBOX_1 0x01D4 -#define REG_HMEBOX_2 0x01D8 -#define REG_HMEBOX_3 0x01DC - -#define REG_LLT_INIT 0x01E0 - - -//----------------------------------------------------- -// -// 0x0200h ~ 0x027Fh TXDMA Configuration -// -//----------------------------------------------------- -#define REG_RQPN 0x0200 -#define REG_FIFOPAGE 0x0204 -#define REG_TDECTRL 0x0208 -#define REG_TXDMA_OFFSET_CHK 0x020C -#define REG_TXDMA_STATUS 0x0210 -#define REG_RQPN_NPQ 0x0214 - -//----------------------------------------------------- -// -// 0x0280h ~ 0x02FFh RXDMA Configuration -// -//----------------------------------------------------- -#define REG_RXDMA_AGG_PG_TH 0x0280 -#define REG_RXPKT_NUM 0x0284 -#define REG_RXDMA_STATUS 0x0288 - -//----------------------------------------------------- -// -// 0x0300h ~ 0x03FFh PCIe -// -//----------------------------------------------------- -#define REG_PCIE_CTRL_REG 0x0300 -#define REG_INT_MIG 0x0304 // Interrupt Migration -#define REG_BCNQ_DESA 0x0308 // TX Beacon Descriptor Address -#define REG_HQ_DESA 0x0310 // TX High Queue Descriptor Address -#define REG_MGQ_DESA 0x0318 // TX Manage Queue Descriptor Address -#define REG_VOQ_DESA 0x0320 // TX VO Queue Descriptor Address -#define REG_VIQ_DESA 0x0328 // TX VI Queue Descriptor Address -#define REG_BEQ_DESA 0x0330 // TX BE Queue Descriptor Address -#define REG_BKQ_DESA 0x0338 // TX BK Queue Descriptor Address -#define REG_RX_DESA 0x0340 // RX Queue Descriptor Address -#define REG_MDIO 0x0354 // MDIO for Access PCIE PHY -#define REG_DBG_SEL 0x0360 // Debug Selection Register -#define REG_PCIE_HRPWM 0x0361 //PCIe RPWM -#define REG_PCIE_HCPWM 0x0363 //PCIe CPWM -#define REG_WATCH_DOG 0x0368 - -// RTL8723 series ------------------------------- -#define REG_PCIE_HISR 0x03A0 - -// spec version 11 -//----------------------------------------------------- -// -// 0x0400h ~ 0x047Fh Protocol Configuration -// -//----------------------------------------------------- -#define REG_VOQ_INFORMATION 0x0400 -#define REG_VIQ_INFORMATION 0x0404 -#define REG_BEQ_INFORMATION 0x0408 -#define REG_BKQ_INFORMATION 0x040C -#define REG_MGQ_INFORMATION 0x0410 -#define REG_HGQ_INFORMATION 0x0414 -#define REG_BCNQ_INFORMATION 0x0418 -#define REG_TXPKT_EMPTY 0x041A - -#define REG_CPU_MGQ_INFORMATION 0x041C -#define REG_FWHW_TXQ_CTRL 0x0420 -#define REG_HWSEQ_CTRL 0x0423 -#define REG_TXPKTBUF_BCNQ_BDNY 0x0424 -#define REG_TXPKTBUF_MGQ_BDNY 0x0425 -#define REG_LIFETIME_EN 0x0426 -#define REG_MULTI_BCNQ_OFFSET 0x0427 -#define REG_SPEC_SIFS 0x0428 -#define REG_RL 0x042A -#define REG_DARFRC 0x0430 -#define REG_RARFRC 0x0438 -#define REG_RRSR 0x0440 -#define REG_ARFR0 0x0444 -#define REG_ARFR1 0x0448 -#define REG_ARFR2 0x044C -#define REG_ARFR3 0x0450 -#define REG_AGGLEN_LMT 0x0458 -#define REG_AMPDU_MIN_SPACE 0x045C -#define REG_TXPKTBUF_WMAC_LBK_BF_HD 0x045D -#define REG_FAST_EDCA_CTRL 0x0460 -#define REG_RD_RESP_PKT_TH 0x0463 -#define REG_INIRTS_RATE_SEL 0x0480 -//#define REG_INIDATA_RATE_SEL 0x0484 -#define REG_MACID_NO_LINK_0 0x0484 -#define REG_MACID_NO_LINK_1 0x0488 - -#define REG_POWER_STATUS 0x04A4 -#define REG_POWER_STAGE1 0x04B4 -#define REG_POWER_STAGE2 0x04B8 -#define REG_PKT_VO_VI_LIFE_TIME 0x04C0 -#define REG_PKT_BE_BK_LIFE_TIME 0x04C2 -#define REG_STBC_SETTING 0x04C4 -#define REG_PROT_MODE_CTRL 0x04C8 -#define REG_MAX_AGGR_NUM 0x04CA -#define REG_RTS_MAX_AGGR_NUM 0x04CB -#define REG_BAR_MODE_CTRL 0x04CC -#define REG_RA_TRY_RATE_AGG_LMT 0x04CF -#define REG_EARLY_MODE_CONTROL 0x4D0 -#define REG_NQOS_SEQ 0x04DC -#define REG_QOS_SEQ 0x04DE -#define REG_NEED_CPU_HANDLE 0x04E0 -#define REG_PKT_LOSE_RPT 0x04E1 -#define REG_PTCL_ERR_STATUS 0x04E2 -#define REG_TX_RPT_CTRL 0x04EC -#define REG_TX_RPT_TIME 0x04F0 // 2 byte -#define REG_DUMMY 0x04FC - -#ifdef CONFIG_WOWLAN -#define REG_TXPKTBUF_IV_LOW 0x0484 -#define REG_TXPKTBUF_IV_HIGH 0x0488 -#endif - -//----------------------------------------------------- -// -// 0x0500h ~ 0x05FFh EDCA Configuration -// -//----------------------------------------------------- -#define REG_EDCA_VO_PARAM 0x0500 -#define REG_EDCA_VI_PARAM 0x0504 -#define REG_EDCA_BE_PARAM 0x0508 -#define REG_EDCA_BK_PARAM 0x050C -#define REG_BCNTCFG 0x0510 -#define REG_PIFS 0x0512 -#define REG_RDG_PIFS 0x0513 -#define REG_SIFS_CTX 0x0514 -#define REG_SIFS_TRX 0x0516 -#define REG_TSFTR_SYN_OFFSET 0x0518 -#define REG_AGGR_BREAK_TIME 0x051A -#define REG_SLOT 0x051B -#define REG_TX_PTCL_CTRL 0x0520 -#define REG_TXPAUSE 0x0522 -#define REG_DIS_TXREQ_CLR 0x0523 -#define REG_RD_CTRL 0x0524 -// -// Format for offset 540h-542h: -// [3:0]: TBTT prohibit setup in unit of 32us. The time for HW getting beacon content before TBTT. -// [7:4]: Reserved. -// [19:8]: TBTT prohibit hold in unit of 32us. The time for HW holding to send the beacon packet. -// [23:20]: Reserved -// Description: -// | -// |<--Setup--|--Hold------------>| -// --------------|---------------------- -// | -// TBTT -// Note: We cannot update beacon content to HW or send any AC packets during the time between Setup and Hold. -// Described by Designer Tim and Bruce, 2011-01-14. -// -#define REG_TBTT_PROHIBIT 0x0540 -#define REG_RD_NAV_NXT 0x0544 -#define REG_NAV_PROT_LEN 0x0546 -#define REG_BCN_CTRL 0x0550 -#define REG_BCN_CTRL_1 0x0551 -#define REG_MBID_NUM 0x0552 -#define REG_DUAL_TSF_RST 0x0553 -#define REG_BCN_INTERVAL 0x0554 // The same as REG_MBSSID_BCN_SPACE -#define REG_DRVERLYINT 0x0558 -#define REG_BCNDMATIM 0x0559 -#define REG_ATIMWND 0x055A -#define REG_BCN_MAX_ERR 0x055D -#define REG_RXTSF_OFFSET_CCK 0x055E -#define REG_RXTSF_OFFSET_OFDM 0x055F -#define REG_TSFTR 0x0560 -#define REG_TSFTR1 0x0568 -#define REG_ATIMWND_1 0x0570 -#define REG_PSTIMER 0x0580 -#define REG_TIMER0 0x0584 -#define REG_TIMER1 0x0588 -#define REG_ACMHWCTRL 0x05C0 - -//#define REG_FW_TSF_SYNC_CNT 0x04A0 -#define REG_FW_RESET_TSF_CNT_1 0x05FC -#define REG_FW_RESET_TSF_CNT_0 0x05FD -#define REG_FW_BCN_DIS_CNT 0x05FE - -//----------------------------------------------------- -// -// 0x0600h ~ 0x07FFh WMAC Configuration -// -//----------------------------------------------------- -#define REG_APSD_CTRL 0x0600 -#define REG_BWOPMODE 0x0603 -#define REG_TCR 0x0604 -#define REG_RCR 0x0608 -#define REG_RX_PKT_LIMIT 0x060C -#define REG_RX_DLK_TIME 0x060D -#define REG_RX_DRVINFO_SZ 0x060F - -#define REG_MACID 0x0610 -#define REG_BSSID 0x0618 -#define REG_MAR 0x0620 -#define REG_MBIDCAMCFG 0x0628 - -#define REG_USTIME_EDCA 0x0638 -#define REG_MAC_SPEC_SIFS 0x063A - -// 20100719 Joseph: Hardware register definition change. (HW datasheet v54) -#define REG_R2T_SIFS 0x063C // [15:8]SIFS_R2T_OFDM, [7:0]SIFS_R2T_CCK -#define REG_T2T_SIFS 0x063E // [15:8]SIFS_T2T_OFDM, [7:0]SIFS_T2T_CCK -#define REG_ACKTO 0x0640 -#define REG_CTS2TO 0x0641 -#define REG_EIFS 0x0642 - - -//RXERR_RPT -#define RXERR_TYPE_OFDM_PPDU 0 -#define RXERR_TYPE_OFDM_FALSE_ALARM 1 -#define RXERR_TYPE_OFDM_MPDU_OK 2 -#define RXERR_TYPE_OFDM_MPDU_FAIL 3 -#define RXERR_TYPE_CCK_PPDU 4 -#define RXERR_TYPE_CCK_FALSE_ALARM 5 -#define RXERR_TYPE_CCK_MPDU_OK 6 -#define RXERR_TYPE_CCK_MPDU_FAIL 7 -#define RXERR_TYPE_HT_PPDU 8 -#define RXERR_TYPE_HT_FALSE_ALARM 9 -#define RXERR_TYPE_HT_MPDU_TOTAL 10 -#define RXERR_TYPE_HT_MPDU_OK 11 -#define RXERR_TYPE_HT_MPDU_FAIL 12 -#define RXERR_TYPE_RX_FULL_DROP 15 - -#define RXERR_COUNTER_MASK 0xFFFFF -#define RXERR_RPT_RST BIT(27) -#define _RXERR_RPT_SEL(type) ((type) << 28) - - -// -// Note: -// The NAV upper value is very important to WiFi 11n 5.2.3 NAV test. The default value is -// always too small, but the WiFi TestPlan test by 25,000 microseconds of NAV through sending -// CTS in the air. We must update this value greater than 25,000 microseconds to pass the item. -// The offset of NAV_UPPER in 8192C Spec is incorrect, and the offset should be 0x0652. Commented -// by SD1 Scott. -// By Bruce, 2011-07-18. -// -#define REG_NAV_UPPER 0x0652 // unit of 128 - -//WMA, BA, CCX -//#define REG_NAV_CTRL 0x0650 -#define REG_BACAMCMD 0x0654 -#define REG_BACAMCONTENT 0x0658 -#define REG_LBDLY 0x0660 -#define REG_FWDLY 0x0661 -#define REG_RXERR_RPT 0x0664 -#define REG_WMAC_TRXPTCL_CTL 0x0668 - -// Security -#define REG_CAMCMD 0x0670 -#define REG_CAMWRITE 0x0674 -#define REG_CAMREAD 0x0678 -#define REG_CAMDBG 0x067C -#define REG_SECCFG 0x0680 - -// Power -#define REG_WOW_CTRL 0x0690 -#define REG_PS_RX_INFO 0x0692 -#define REG_UAPSD_TID 0x0693 -#define REG_WKFMCAM_CMD 0x0698 -#define REG_WKFMCAM_NUM_88E 0x698 -#define REG_RXFLTMAP0 0x06A0 -#define REG_RXFLTMAP1 0x06A2 -#define REG_RXFLTMAP2 0x06A4 -#define REG_BCN_PSR_RPT 0x06A8 -#define REG_BT_COEX_TABLE 0x06C0 - - -// Hardware Port 2 -#define REG_MACID1 0x0700 -#define REG_BSSID1 0x0708 - - -//----------------------------------------------------- -// -// 0xFE00h ~ 0xFE55h USB Configuration -// -//----------------------------------------------------- -#define REG_USB_INFO 0xFE17 -#define REG_USB_SPECIAL_OPTION 0xFE55 -#define REG_USB_DMA_AGG_TO 0xFE5B -#define REG_USB_AGG_TO 0xFE5C -#define REG_USB_AGG_TH 0xFE5D - - -// For normal chip -#define REG_NORMAL_SIE_VID 0xFE60 // 0xFE60~0xFE61 -#define REG_NORMAL_SIE_PID 0xFE62 // 0xFE62~0xFE63 -#define REG_NORMAL_SIE_OPTIONAL 0xFE64 -#define REG_NORMAL_SIE_EP 0xFE65 // 0xFE65~0xFE67 -#define REG_NORMAL_SIE_PHY 0xFE68 // 0xFE68~0xFE6B -#define REG_NORMAL_SIE_OPTIONAL2 0xFE6C -#define REG_NORMAL_SIE_GPS_EP 0xFE6D // 0xFE6D, for RTL8723 only. -#define REG_NORMAL_SIE_MAC_ADDR 0xFE70 // 0xFE70~0xFE75 -#define REG_NORMAL_SIE_STRING 0xFE80 // 0xFE80~0xFEDF - - -//----------------------------------------------------- -// -// Redifine 8192C register definition for compatibility -// -//----------------------------------------------------- - -// TODO: use these definition when using REG_xxx naming rule. -// NOTE: DO NOT Remove these definition. Use later. - -#define EFUSE_CTRL REG_EFUSE_CTRL // E-Fuse Control. -#define EFUSE_TEST REG_EFUSE_TEST // E-Fuse Test. -#define MSR (REG_CR + 2) // Media Status register -#define ISR REG_HISR_88E -#define TSFR REG_TSFTR // Timing Sync Function Timer Register. - -#define PBP REG_PBP - -// Redifine MACID register, to compatible prior ICs. -#define IDR0 REG_MACID // MAC ID Register, Offset 0x0050-0x0053 -#define IDR4 (REG_MACID + 4) // MAC ID Register, Offset 0x0054-0x0055 - - -// -// 9. Security Control Registers (Offset: ) -// -#define RWCAM REG_CAMCMD //IN 8190 Data Sheet is called CAMcmd -#define WCAMI REG_CAMWRITE // Software write CAM input content -#define RCAMO REG_CAMREAD // Software read/write CAM config -#define CAMDBG REG_CAMDBG -#define SECR REG_SECCFG //Security Configuration Register - -// Unused register -#define UnusedRegister 0x1BF -#define DCAM UnusedRegister -#define PSR UnusedRegister -#define BBAddr UnusedRegister -#define PhyDataR UnusedRegister - -// Min Spacing related settings. -#define MAX_MSS_DENSITY_2T 0x13 -#define MAX_MSS_DENSITY_1T 0x0A - -//---------------------------------------------------------------------------- -// 8192C Cmd9346CR bits (Offset 0xA, 16bit) -//---------------------------------------------------------------------------- -#define CmdEEPROM_En BIT5 // EEPROM enable when set 1 -#define CmdEERPOMSEL BIT4 // System EEPROM select, 0: boot from E-FUSE, 1: The EEPROM used is 9346 -#define Cmd9346CR_9356SEL BIT4 - -//---------------------------------------------------------------------------- -// 8192C GPIO MUX Configuration Register (offset 0x40, 4 byte) -//---------------------------------------------------------------------------- -#define GPIOSEL_GPIO 0 -#define GPIOSEL_ENBT BIT5 - -//---------------------------------------------------------------------------- -// 8192C GPIO PIN Control Register (offset 0x44, 4 byte) -//---------------------------------------------------------------------------- -#define GPIO_IN REG_GPIO_PIN_CTRL // GPIO pins input value -#define GPIO_OUT (REG_GPIO_PIN_CTRL+1) // GPIO pins output value -#define GPIO_IO_SEL (REG_GPIO_PIN_CTRL+2) // GPIO pins output enable when a bit is set to "1"; otherwise, input is configured. -#define GPIO_MOD (REG_GPIO_PIN_CTRL+3) - -//---------------------------------------------------------------------------- -// 8723/8188E Host System Interrupt Mask Register (offset 0x58, 32 byte) -//---------------------------------------------------------------------------- -#define HSIMR_GPIO12_0_INT_EN BIT0 -#define HSIMR_SPS_OCP_INT_EN BIT5 -#define HSIMR_RON_INT_EN BIT6 -#define HSIMR_PDN_INT_EN BIT7 -#define HSIMR_GPIO9_INT_EN BIT25 - - -//---------------------------------------------------------------------------- -// 8723/8188E Host System Interrupt Status Register (offset 0x5C, 32 byte) -//---------------------------------------------------------------------------- -#define HSISR_GPIO12_0_INT BIT0 -#define HSISR_SPS_OCP_INT BIT5 -#define HSISR_RON_INT_EN BIT6 -#define HSISR_PDNINT BIT7 -#define HSISR_GPIO9_INT BIT25 - -//---------------------------------------------------------------------------- -// 8192C (MSR) Media Status Register (Offset 0x4C, 8 bits) -//---------------------------------------------------------------------------- -/* -Network Type -00: No link -01: Link in ad hoc network -10: Link in infrastructure network -11: AP mode -Default: 00b. -*/ -#define MSR_NOLINK 0x00 -#define MSR_ADHOC 0x01 -#define MSR_INFRA 0x02 -#define MSR_AP 0x03 - -//---------------------------------------------------------------------------- -// 88EU (MSR) Media Status Register (Offset 0x4C, 8 bits) -//---------------------------------------------------------------------------- -#define USB_INTR_CONTENT_C2H_OFFSET 0 -#define USB_INTR_CONTENT_CPWM1_OFFSET 16 -#define USB_INTR_CONTENT_CPWM2_OFFSET 20 -#define USB_INTR_CONTENT_HISR_OFFSET 48 -#define USB_INTR_CONTENT_HISRE_OFFSET 52 - - -//---------------------------------------------------------------------------- -// 88E Driver Initialization Offload REG_FDHM0(Offset 0x88, 8 bits) -//---------------------------------------------------------------------------- -//IOL config for REG_FDHM0(Reg0x88) -#define CMD_INIT_LLT BIT0 -#define CMD_READ_EFUSE_MAP BIT1 -#define CMD_EFUSE_PATCH BIT2 -#define CMD_IOCONFIG BIT3 -#define CMD_INIT_LLT_ERR BIT4 -#define CMD_READ_EFUSE_MAP_ERR BIT5 -#define CMD_EFUSE_PATCH_ERR BIT6 -#define CMD_IOCONFIG_ERR BIT7 - -// -// 6. Adaptive Control Registers (Offset: 0x0160 - 0x01CF) -// -//---------------------------------------------------------------------------- -// 8192C Response Rate Set Register (offset 0x181, 24bits) -//---------------------------------------------------------------------------- -#define RRSR_1M BIT0 -#define RRSR_2M BIT1 -#define RRSR_5_5M BIT2 -#define RRSR_11M BIT3 -#define RRSR_6M BIT4 -#define RRSR_9M BIT5 -#define RRSR_12M BIT6 -#define RRSR_18M BIT7 -#define RRSR_24M BIT8 -#define RRSR_36M BIT9 -#define RRSR_48M BIT10 -#define RRSR_54M BIT11 -#define RRSR_MCS0 BIT12 -#define RRSR_MCS1 BIT13 -#define RRSR_MCS2 BIT14 -#define RRSR_MCS3 BIT15 -#define RRSR_MCS4 BIT16 -#define RRSR_MCS5 BIT17 -#define RRSR_MCS6 BIT18 -#define RRSR_MCS7 BIT19 - -//---------------------------------------------------------------------------- -// 8192C Response Rate Set Register (offset 0x1BF, 8bits) -//---------------------------------------------------------------------------- -// WOL bit information -#define HAL92C_WOL_PTK_UPDATE_EVENT BIT0 -#define HAL92C_WOL_GTK_UPDATE_EVENT BIT1 - -//---------------------------------------------------------------------------- -// 8192C BW_OPMODE bits (Offset 0x203, 8bit) -//---------------------------------------------------------------------------- -#define BW_OPMODE_20MHZ BIT2 -#define BW_OPMODE_5G BIT1 - - -//---------------------------------------------------------------------------- -// 8192C CAM Config Setting (offset 0x250, 1 byte) -//---------------------------------------------------------------------------- -#define CAM_VALID BIT15 -#define CAM_NOTVALID 0x0000 -#define CAM_USEDK BIT5 - -#define CAM_CONTENT_COUNT 8 - -#define CAM_NONE 0x0 -#define CAM_WEP40 0x01 -#define CAM_TKIP 0x02 -#define CAM_AES 0x04 -#define CAM_WEP104 0x05 -#define CAM_SMS4 0x6 - -#define TOTAL_CAM_ENTRY 32 -#define HALF_CAM_ENTRY 16 - -#define CAM_CONFIG_USEDK _TRUE -#define CAM_CONFIG_NO_USEDK _FALSE - -#define CAM_WRITE BIT16 -#define CAM_READ 0x00000000 -#define CAM_POLLINIG BIT31 - -#define SCR_UseDK 0x01 -#define SCR_TxSecEnable 0x02 -#define SCR_RxSecEnable 0x04 - -// -// 10. Power Save Control Registers (Offset: 0x0260 - 0x02DF) -// -#define WOW_PMEN BIT0 // Power management Enable. -#define WOW_WOMEN BIT1 // WoW function on or off. -#define WOW_MAGIC BIT2 // Magic packet -#define WOW_UWF BIT3 // Unicast Wakeup frame. - -// -// 12. Host Interrupt Status Registers (Offset: 0x0300 - 0x030F) -// -//---------------------------------------------------------------------------- -//---------------------------------------------------------------------------- -// 8188 IMR/ISR bits -//---------------------------------------------------------------------------- -#define IMR_DISABLED_88E 0x0 -// IMR DW0(0x0060-0063) Bit 0-31 -#define IMR_TXCCK_88E BIT30 // TXRPT interrupt when CCX bit of the packet is set -#define IMR_PSTIMEOUT_88E BIT29 // Power Save Time Out Interrupt -#define IMR_GTINT4_88E BIT28 // When GTIMER4 expires, this bit is set to 1 -#define IMR_GTINT3_88E BIT27 // When GTIMER3 expires, this bit is set to 1 -#define IMR_TBDER_88E BIT26 // Transmit Beacon0 Error -#define IMR_TBDOK_88E BIT25 // Transmit Beacon0 OK -#define IMR_TSF_BIT32_TOGGLE_88E BIT24 // TSF Timer BIT32 toggle indication interrupt -#define IMR_BCNDMAINT0_88E BIT20 // Beacon DMA Interrupt 0 -#define IMR_BCNDERR0_88E BIT16 // Beacon Queue DMA Error 0 -#define IMR_HSISR_IND_ON_INT_88E BIT15 // HSISR Indicator (HSIMR & HSISR is true, this bit is set to 1) -#define IMR_BCNDMAINT_E_88E BIT14 // Beacon DMA Interrupt Extension for Win7 -#define IMR_ATIMEND_88E BIT12 // CTWidnow End or ATIM Window End -#define IMR_HISR1_IND_INT_88E BIT11 // HISR1 Indicator (HISR1 & HIMR1 is true, this bit is set to 1) -#define IMR_C2HCMD_88E BIT10 // CPU to Host Command INT Status, Write 1 clear -#define IMR_CPWM2_88E BIT9 // CPU power Mode exchange INT Status, Write 1 clear -#define IMR_CPWM_88E BIT8 // CPU power Mode exchange INT Status, Write 1 clear -#define IMR_HIGHDOK_88E BIT7 // High Queue DMA OK -#define IMR_MGNTDOK_88E BIT6 // Management Queue DMA OK -#define IMR_BKDOK_88E BIT5 // AC_BK DMA OK -#define IMR_BEDOK_88E BIT4 // AC_BE DMA OK -#define IMR_VIDOK_88E BIT3 // AC_VI DMA OK -#define IMR_VODOK_88E BIT2 // AC_VO DMA OK -#define IMR_RDU_88E BIT1 // Rx Descriptor Unavailable -#define IMR_ROK_88E BIT0 // Receive DMA OK - -// IMR DW1(0x00B4-00B7) Bit 0-31 -#define IMR_BCNDMAINT7_88E BIT27 // Beacon DMA Interrupt 7 -#define IMR_BCNDMAINT6_88E BIT26 // Beacon DMA Interrupt 6 -#define IMR_BCNDMAINT5_88E BIT25 // Beacon DMA Interrupt 5 -#define IMR_BCNDMAINT4_88E BIT24 // Beacon DMA Interrupt 4 -#define IMR_BCNDMAINT3_88E BIT23 // Beacon DMA Interrupt 3 -#define IMR_BCNDMAINT2_88E BIT22 // Beacon DMA Interrupt 2 -#define IMR_BCNDMAINT1_88E BIT21 // Beacon DMA Interrupt 1 -#define IMR_BCNDERR7_88E BIT20 // Beacon Queue DMA Error Interrup 7 -#define IMR_BCNDERR6_88E BIT19 // Beacon Queue DMA Error Interrup 6 -#define IMR_BCNDERR5_88E BIT18 // Beacon Queue DMA Error Interrup 5 -#define IMR_BCNDERR4_88E BIT17 // Beacon Queue DMA Error Interrup 4 -#define IMR_BCNDERR3_88E BIT16 // Beacon Queue DMA Error Interrup 3 -#define IMR_BCNDERR2_88E BIT15 // Beacon Queue DMA Error Interrup 2 -#define IMR_BCNDERR1_88E BIT14 // Beacon Queue DMA Error Interrup 1 -#define IMR_ATIMEND_E_88E BIT13 // ATIM Window End Extension for Win7 -#define IMR_TXERR_88E BIT11 // Tx Error Flag Interrupt Status, write 1 clear. -#define IMR_RXERR_88E BIT10 // Rx Error Flag INT Status, Write 1 clear -#define IMR_TXFOVW_88E BIT9 // Transmit FIFO Overflow -#define IMR_RXFOVW_88E BIT8 // Receive FIFO Overflow - -#define HAL_NIC_UNPLUG_ISR 0xFFFFFFFF // The value when the NIC is unplugged for PCI. - - -#ifdef CONFIG_PCI_HCI -//#define IMR_RX_MASK (IMR_ROK_88E|IMR_RDU_88E|IMR_RXFOVW_88E) -#define IMR_TX_MASK (IMR_VODOK_88E|IMR_VIDOK_88E|IMR_BEDOK_88E|IMR_BKDOK_88E|IMR_MGNTDOK_88E|IMR_HIGHDOK_88E|IMR_BCNDERR0_88E) - -#ifdef CONFIG_CONCURRENT_MODE -#define RT_IBSS_INT_MASKS (IMR_BCNDMAINT0_88E | IMR_TBDOK_88E | IMR_TBDER_88E | IMR_BCNDMAINT_E_88E) -#else -#define RT_IBSS_INT_MASKS (IMR_BCNDMAINT0_88E | IMR_TBDOK_88E | IMR_TBDER_88E) -#endif - -#define RT_AC_INT_MASKS (IMR_VIDOK_88E | IMR_VODOK_88E | IMR_BEDOK_88E|IMR_BKDOK_88E) -#define RT_BSS_INT_MASKS (RT_IBSS_INT_MASKS) -#endif - - -// 8192C EFUSE -//---------------------------------------------------------------------------- -#define HWSET_MAX_SIZE 256 -#define HWSET_MAX_SIZE_88E 512 - - - -/*=================================================================== -===================================================================== -Here the register defines are for 92C. When the define is as same with 92C, -we will use the 92C's define for the consistency -So the following defines for 92C is not entire!!!!!! -===================================================================== -=====================================================================*/ -/* -Based on Datasheet V33---090401 -Register Summary -Current IOREG MAP -0x0000h ~ 0x00FFh System Configuration (256 Bytes) -0x0100h ~ 0x01FFh MACTOP General Configuration (256 Bytes) -0x0200h ~ 0x027Fh TXDMA Configuration (128 Bytes) -0x0280h ~ 0x02FFh RXDMA Configuration (128 Bytes) -0x0300h ~ 0x03FFh PCIE EMAC Reserved Region (256 Bytes) -0x0400h ~ 0x04FFh Protocol Configuration (256 Bytes) -0x0500h ~ 0x05FFh EDCA Configuration (256 Bytes) -0x0600h ~ 0x07FFh WMAC Configuration (512 Bytes) -0x2000h ~ 0x3FFFh 8051 FW Download Region (8196 Bytes) -*/ - //---------------------------------------------------------------------------- - // 8192C (TXPAUSE) transmission pause (Offset 0x522, 8 bits) - //---------------------------------------------------------------------------- -// Note: -// The the bits of stoping AC(VO/VI/BE/BK) queue in datasheet RTL8192S/RTL8192C are wrong, -// the correct arragement is VO - Bit0, VI - Bit1, BE - Bit2, and BK - Bit3. -// 8723 and 88E may be not correct either in the eralier version. Confirmed with DD Tim. -// By Bruce, 2011-09-22. -#define StopBecon BIT6 -#define StopHigh BIT5 -#define StopMgt BIT4 -#define StopBK BIT3 -#define StopBE BIT2 -#define StopVI BIT1 -#define StopVO BIT0 - -//---------------------------------------------------------------------------- -// 8192C (RCR) Receive Configuration Register (Offset 0x608, 32 bits) -//---------------------------------------------------------------------------- -#define RCR_APPFCS BIT31 //WMAC append FCS after pauload -#define RCR_APP_MIC BIT30 // -#define RCR_APP_PHYSTS BIT28// -#define RCR_APP_ICV BIT29 // -#define RCR_APP_PHYST_RXFF BIT28 // -#define RCR_APP_BA_SSN BIT27 //Accept BA SSN -#define RCR_ENMBID BIT24 //Enable Multiple BssId. -#define RCR_LSIGEN BIT23 -#define RCR_MFBEN BIT22 -#define RCR_HTC_LOC_CTRL BIT14 //MFC<--HTC=1 MFC-->HTC=0 -#define RCR_AMF BIT13 //Accept management type frame -#define RCR_ACF BIT12 //Accept control type frame -#define RCR_ADF BIT11 //Accept data type frame -#define RCR_AICV BIT9 //Accept ICV error packet -#define RCR_ACRC32 BIT8 //Accept CRC32 error packet -#define RCR_CBSSID_BCN BIT7 //Accept BSSID match packet (Rx beacon, probe rsp) -#define RCR_CBSSID_DATA BIT6 //Accept BSSID match packet (Data) -#define RCR_CBSSID RCR_CBSSID_DATA //Accept BSSID match packet -#define RCR_APWRMGT BIT5 //Accept power management packet -#define RCR_ADD3 BIT4 //Accept address 3 match packet -#define RCR_AB BIT3 //Accept broadcast packet -#define RCR_AM BIT2 //Accept multicast packet -#define RCR_APM BIT1 //Accept physical match packet -#define RCR_AAP BIT0 //Accept all unicast packet -#define RCR_MXDMA_OFFSET 8 -#define RCR_FIFO_OFFSET 13 - -//----------------------------------------------------- -// -// 0xFE00h ~ 0xFE55h USB Configuration -// -//----------------------------------------------------- -#define REG_USB_INFO 0xFE17 -#define REG_USB_SPECIAL_OPTION 0xFE55 -#define REG_USB_DMA_AGG_TO 0xFE5B -#define REG_USB_AGG_TO 0xFE5C -#define REG_USB_AGG_TH 0xFE5D - -#define REG_USB_HRPWM 0xFE58 -#define REG_USB_HCPWM 0xFE57 - -//============================================================================ -// 8192C Regsiter Bit and Content definition -//============================================================================ -//----------------------------------------------------- -// -// 0x0000h ~ 0x00FFh System Configuration -// -//----------------------------------------------------- - -//2 SYS_ISO_CTRL -#define ISO_MD2PP BIT(0) -#define ISO_UA2USB BIT(1) -#define ISO_UD2CORE BIT(2) -#define ISO_PA2PCIE BIT(3) -#define ISO_PD2CORE BIT(4) -#define ISO_IP2MAC BIT(5) -#define ISO_DIOP BIT(6) -#define ISO_DIOE BIT(7) -#define ISO_EB2CORE BIT(8) -#define ISO_DIOR BIT(9) -#define PWC_EV12V BIT(15) - - -//2 SYS_FUNC_EN -#define FEN_BBRSTB BIT(0) -#define FEN_BB_GLB_RSTn BIT(1) -#define FEN_USBA BIT(2) -#define FEN_UPLL BIT(3) -#define FEN_USBD BIT(4) -#define FEN_DIO_PCIE BIT(5) -#define FEN_PCIEA BIT(6) -#define FEN_PPLL BIT(7) -#define FEN_PCIED BIT(8) -#define FEN_DIOE BIT(9) -#define FEN_CPUEN BIT(10) -#define FEN_DCORE BIT(11) -#define FEN_ELDR BIT(12) -#define FEN_DIO_RF BIT(13) -#define FEN_HWPDN BIT(14) -#define FEN_MREGEN BIT(15) - -//2 APS_FSMCO -#define PFM_LDALL BIT(0) -#define PFM_ALDN BIT(1) -#define PFM_LDKP BIT(2) -#define PFM_WOWL BIT(3) -#define EnPDN BIT(4) -#define PDN_PL BIT(5) -#define APFM_ONMAC BIT(8) -#define APFM_OFF BIT(9) -#define APFM_RSM BIT(10) -#define AFSM_HSUS BIT(11) -#define AFSM_PCIE BIT(12) -#define APDM_MAC BIT(13) -#define APDM_HOST BIT(14) -#define APDM_HPDN BIT(15) -#define RDY_MACON BIT(16) -#define SUS_HOST BIT(17) -#define ROP_ALD BIT(20) -#define ROP_PWR BIT(21) -#define ROP_SPS BIT(22) -#define SOP_MRST BIT(25) -#define SOP_FUSE BIT(26) -#define SOP_ABG BIT(27) -#define SOP_AMB BIT(28) -#define SOP_RCK BIT(29) -#define SOP_A8M BIT(30) -#define XOP_BTCK BIT(31) - -//2 SYS_CLKR -#define ANAD16V_EN BIT(0) -#define ANA8M BIT(1) -#define MACSLP BIT(4) -#define LOADER_CLK_EN BIT(5) - - -//2 9346CR - -#define BOOT_FROM_EEPROM BIT(4) -#define EEPROM_EN BIT(5) - - -//2 SPS0_CTRL - - -//2 SPS_OCP_CFG - - -//2 RF_CTRL -#define RF_EN BIT(0) -#define RF_RSTB BIT(1) -#define RF_SDMRSTB BIT(2) - - - -//2 LDOV12D_CTRL -#define LDV12_EN BIT(0) -#define LDV12_SDBY BIT(1) -#define LPLDO_HSM BIT(2) -#define LPLDO_LSM_DIS BIT(3) -#define _LDV12_VADJ(x) (((x) & 0xF) << 4) - - -//2EFUSE_CTRL -#define ALD_EN BIT(18) -#define EF_PD BIT(19) -#define EF_FLAG BIT(31) - -//2 EFUSE_TEST (For RTL8723 partially) -#define EF_TRPT BIT(7) -#define EF_CELL_SEL (BIT(8)|BIT(9)) // 00: Wifi Efuse, 01: BT Efuse0, 10: BT Efuse1, 11: BT Efuse2 -#define LDOE25_EN BIT(31) -#define EFUSE_SEL(x) (((x) & 0x3) << 8) -#define EFUSE_SEL_MASK 0x300 -#define EFUSE_WIFI_SEL_0 0x0 -#define EFUSE_BT_SEL_0 0x1 -#define EFUSE_BT_SEL_1 0x2 -#define EFUSE_BT_SEL_2 0x3 - -#define EFUSE_ACCESS_ON 0x69 // For RTL8723 only. -#define EFUSE_ACCESS_OFF 0x00 // For RTL8723 only. - - -//2 8051FWDL -//2 MCUFWDL -#define MCUFWDL_EN BIT(0) -#define MCUFWDL_RDY BIT(1) -#define FWDL_ChkSum_rpt BIT(2) -#define MACINI_RDY BIT(3) -#define BBINI_RDY BIT(4) -#define RFINI_RDY BIT(5) -#define WINTINI_RDY BIT(6) -#define RAM_DL_SEL BIT(7) // 1:RAM, 0:ROM -#define ROM_DLEN BIT(19) -#define CPRST BIT(23) - - - -//2 REG_SYS_CFG -#define XCLK_VLD BIT(0) -#define ACLK_VLD BIT(1) -#define UCLK_VLD BIT(2) -#define PCLK_VLD BIT(3) -#define PCIRSTB BIT(4) -#define V15_VLD BIT(5) -#define SW_OFFLOAD_EN BIT(7) -#define SIC_IDLE BIT(8) -#define BD_MAC2 BIT(9) -#define BD_MAC1 BIT(10) -#define IC_MACPHY_MODE BIT(11) -#define CHIP_VER (BIT(12)|BIT(13)|BIT(14)|BIT(15)) -#define BT_FUNC BIT(16) -#define VENDOR_ID BIT(19) -#define PAD_HWPD_IDN BIT(22) -#define TRP_VAUX_EN BIT(23) // RTL ID -#define TRP_BT_EN BIT(24) -#define BD_PKG_SEL BIT(25) -#define BD_HCI_SEL BIT(26) -#define TYPE_ID BIT(27) - -#define CHIP_VER_RTL_MASK 0xF000 //Bit 12 ~ 15 -#define CHIP_VER_RTL_SHIFT 12 - - -//2REG_GPIO_OUTSTS (For RTL8723 only) -#define EFS_HCI_SEL (BIT(0)|BIT(1)) -#define PAD_HCI_SEL (BIT(2)|BIT(3)) -#define HCI_SEL (BIT(4)|BIT(5)) -#define PKG_SEL_HCI BIT(6) -#define FEN_GPS BIT(7) -#define FEN_BT BIT(8) -#define FEN_WL BIT(9) -#define FEN_PCI BIT(10) -#define FEN_USB BIT(11) -#define BTRF_HWPDN_N BIT(12) -#define WLRF_HWPDN_N BIT(13) -#define PDN_BT_N BIT(14) -#define PDN_GPS_N BIT(15) -#define BT_CTL_HWPDN BIT(16) -#define GPS_CTL_HWPDN BIT(17) -#define PPHY_SUSB BIT(20) -#define UPHY_SUSB BIT(21) -#define PCI_SUSEN BIT(22) -#define USB_SUSEN BIT(23) -#define RF_RL_ID (BIT(31)|BIT(30)|BIT(29)|BIT(28)) - - -//2SYS_CFG -#define RTL_ID BIT(23) // TestChip ID, 1:Test(RLE); 0:MP(RL) - -//----------------------------------------------------- -// -// 0x0100h ~ 0x01FFh MACTOP General Configuration -// -//----------------------------------------------------- - - -//2 Function Enable Registers -//2 CR - - - -#define HCI_TXDMA_EN BIT(0) -#define HCI_RXDMA_EN BIT(1) -#define TXDMA_EN BIT(2) -#define RXDMA_EN BIT(3) -#define PROTOCOL_EN BIT(4) -#define SCHEDULE_EN BIT(5) -#define MACTXEN BIT(6) -#define MACRXEN BIT(7) -#define ENSWBCN BIT(8) -#define ENSEC BIT(9) -#define CALTMR_EN BIT(10) // 32k CAL TMR enable - -// Network type -#define _NETTYPE(x) (((x) & 0x3) << 16) -#define MASK_NETTYPE 0x30000 -#define NT_NO_LINK 0x0 -#define NT_LINK_AD_HOC 0x1 -#define NT_LINK_AP 0x2 -#define NT_AS_AP 0x3 - - - -//2 PBP - Page Size Register -#define GET_RX_PAGE_SIZE(value) ((value) & 0xF) -#define GET_TX_PAGE_SIZE(value) (((value) & 0xF0) >> 4) -#define _PSRX_MASK 0xF -#define _PSTX_MASK 0xF0 -#define _PSRX(x) (x) -#define _PSTX(x) ((x) << 4) - -#define PBP_64 0x0 -#define PBP_128 0x1 -#define PBP_256 0x2 -#define PBP_512 0x3 -#define PBP_1024 0x4 - - -//2 TX/RXDMA -#define RXDMA_ARBBW_EN BIT(0) -#define RXSHFT_EN BIT(1) -#define RXDMA_AGG_EN BIT(2) -#define QS_VO_QUEUE BIT(8) -#define QS_VI_QUEUE BIT(9) -#define QS_BE_QUEUE BIT(10) -#define QS_BK_QUEUE BIT(11) -#define QS_MANAGER_QUEUE BIT(12) -#define QS_HIGH_QUEUE BIT(13) - -#define HQSEL_VOQ BIT(0) -#define HQSEL_VIQ BIT(1) -#define HQSEL_BEQ BIT(2) -#define HQSEL_BKQ BIT(3) -#define HQSEL_MGTQ BIT(4) -#define HQSEL_HIQ BIT(5) - -// For normal driver, 0x10C -#define _TXDMA_HIQ_MAP(x) (((x)&0x3) << 14) -#define _TXDMA_MGQ_MAP(x) (((x)&0x3) << 12) -#define _TXDMA_BKQ_MAP(x) (((x)&0x3) << 10) -#define _TXDMA_BEQ_MAP(x) (((x)&0x3) << 8 ) -#define _TXDMA_VIQ_MAP(x) (((x)&0x3) << 6 ) -#define _TXDMA_VOQ_MAP(x) (((x)&0x3) << 4 ) - -#define QUEUE_LOW 1 -#define QUEUE_NORMAL 2 -#define QUEUE_HIGH 3 - - - -//2 TRXFF_BNDY - - -//2 LLT_INIT -#define _LLT_NO_ACTIVE 0x0 -#define _LLT_WRITE_ACCESS 0x1 -#define _LLT_READ_ACCESS 0x2 - -#define _LLT_INIT_DATA(x) ((x) & 0xFF) -#define _LLT_INIT_ADDR(x) (((x) & 0xFF) << 8) -#define _LLT_OP(x) (((x) & 0x3) << 30) -#define _LLT_OP_VALUE(x) (((x) >> 30) & 0x3) - - -//----------------------------------------------------- -// -// 0x0200h ~ 0x027Fh TXDMA Configuration -// -//----------------------------------------------------- -//2RQPN -#define _HPQ(x) ((x) & 0xFF) -#define _LPQ(x) (((x) & 0xFF) << 8) -#define _PUBQ(x) (((x) & 0xFF) << 16) -#define _NPQ(x) ((x) & 0xFF) // NOTE: in RQPN_NPQ register - - -#define HPQ_PUBLIC_DIS BIT(24) -#define LPQ_PUBLIC_DIS BIT(25) -#define LD_RQPN BIT(31) - - -//2TDECTRL -#define BCN_VALID BIT(16) -#define BCN_HEAD(x) (((x) & 0xFF) << 8) -#define BCN_HEAD_MASK 0xFF00 - - -//2 TDECTL -#define BLK_DESC_NUM_SHIFT 4 -#define BLK_DESC_NUM_MASK 0xF - - -//2 TXDMA_OFFSET_CHK -#define DROP_DATA_EN BIT(9) - - - - -//----------------------------------------------------- -// -// 0x0280h ~ 0x028Bh RX DMA Configuration -// -//----------------------------------------------------- - -// REG_RXDMA_CONTROL, 0x0286h -// Write only. When this bit is set, RXDMA will decrease RX PKT counter by one. Before -// this bit is polled, FW shall update RXFF_RD_PTR first. This register is write pulse and auto clear. -//#define RXPKT_RELEASE_POLL BIT(0) -// Read only. When RXMA finishes on-going DMA operation, RXMDA will report idle state in -// this bit. FW can start releasing packets after RXDMA entering idle mode. -//#define RXDMA_IDLE BIT(1) -// When this bit is set, RXDMA will enter this mode after on-going RXDMA packet to host -// completed, and stop DMA packet to host. RXDMA will then report Default: 0; -//#define RW_RELEASE_EN BIT(2) - -//2 REG_RXPKT_NUM, 0x0284 -#define RXPKT_RELEASE_POLL BIT(16) -#define RXDMA_IDLE BIT(17) -#define RW_RELEASE_EN BIT(18) - -//----------------------------------------------------- -// -// 0x0400h ~ 0x047Fh Protocol Configuration -// -//----------------------------------------------------- -//2 FWHW_TXQ_CTRL -#define EN_AMPDU_RTY_NEW BIT(7) - - -//2 SPEC SIFS -#define _SPEC_SIFS_CCK(x) ((x) & 0xFF) -#define _SPEC_SIFS_OFDM(x) (((x) & 0xFF) << 8) - -//2 RL -#define RETRY_LIMIT_SHORT_SHIFT 8 -#define RETRY_LIMIT_LONG_SHIFT 0 - - - - - -//----------------------------------------------------- -// -// 0x0500h ~ 0x05FFh EDCA Configuration -// -//----------------------------------------------------- - - - -//2 EDCA setting -#define AC_PARAM_TXOP_LIMIT_OFFSET 16 -#define AC_PARAM_ECW_MAX_OFFSET 12 -#define AC_PARAM_ECW_MIN_OFFSET 8 -#define AC_PARAM_AIFS_OFFSET 0 - - - -#define _LRL(x) ((x) & 0x3F) -#define _SRL(x) (((x) & 0x3F) << 8) - - -//2 BCN_CTRL -#define EN_MBSSID BIT(1) -#define EN_TXBCN_RPT BIT(2) -#define EN_BCN_FUNCTION BIT(3) -#define DIS_TSF_UPDATE BIT(3) - -// The same function but different bit field. -#define DIS_TSF_UDT0_NORMAL_CHIP BIT(4) -#define DIS_TSF_UDT0_TEST_CHIP BIT(5) -#define STOP_BCNQ BIT(6) - - -//2 ACMHWCTRL -#define AcmHw_HwEn BIT(0) -#define AcmHw_BeqEn BIT(1) -#define AcmHw_ViqEn BIT(2) -#define AcmHw_VoqEn BIT(3) -#define AcmHw_BeqStatus BIT(4) -#define AcmHw_ViqStatus BIT(5) -#define AcmHw_VoqStatus BIT(6) - - - -//----------------------------------------------------- -// -// 0x0600h ~ 0x07FFh WMAC Configuration -// -//----------------------------------------------------- -//2APSD_CTRL -#define APSDOFF BIT(6) -#define APSDOFF_STATUS BIT(7) - - -#define RATE_BITMAP_ALL 0xFFFFF - -// Only use CCK 1M rate for ACK -#define RATE_RRSR_CCK_ONLY_1M 0xFFFF1 - -//2 TCR -#define TSFRST BIT(0) -#define DIS_GCLK BIT(1) -#define PAD_SEL BIT(2) -#define PWR_ST BIT(6) -#define PWRBIT_OW_EN BIT(7) -#define ACRC BIT(8) -#define CFENDFORM BIT(9) -#define ICV BIT(10) - - - -//2 RCR -#define AAP BIT(0) -#define APM BIT(1) -#define AM BIT(2) -#define AB BIT(3) -#define ADD3 BIT(4) -#define APWRMGT BIT(5) -#define CBSSID BIT(6) -#define CBSSID_DATA BIT(6) -#define CBSSID_BCN BIT(7) -#define ACRC32 BIT(8) -#define AICV BIT(9) -#define ADF BIT(11) -#define ACF BIT(12) -#define AMF BIT(13) -#define HTC_LOC_CTRL BIT(14) -#define UC_DATA_EN BIT(16) -#define BM_DATA_EN BIT(17) -#define MFBEN BIT(22) -#define LSIGEN BIT(23) -#define EnMBID BIT(24) -#define APP_BASSN BIT(27) -#define APP_PHYSTS BIT(28) -#define APP_ICV BIT(29) -#define APP_MIC BIT(30) -#define APP_FCS BIT(31) - - -//2 SECCFG -#define SCR_TxUseDK BIT(0) //Force Tx Use Default Key -#define SCR_RxUseDK BIT(1) //Force Rx Use Default Key -#define SCR_TxEncEnable BIT(2) //Enable Tx Encryption -#define SCR_RxDecEnable BIT(3) //Enable Rx Decryption -#define SCR_SKByA2 BIT(4) //Search kEY BY A2 -#define SCR_NoSKMC BIT(5) //No Key Search Multicast -#define SCR_TXBCUSEDK BIT(6) // Force Tx Broadcast packets Use Default Key -#define SCR_RXBCUSEDK BIT(7) // Force Rx Broadcast packets Use Default Key - - -//----------------------------------------------------- -// -// RTL8188E SDIO Configuration -// -//----------------------------------------------------- - -// I/O bus domain address mapping -#define SDIO_LOCAL_BASE 0x10250000 -#define WLAN_IOREG_BASE 0x10260000 -#define FIRMWARE_FIFO_BASE 0x10270000 -#define TX_HIQ_BASE 0x10310000 -#define TX_MIQ_BASE 0x10320000 -#define TX_LOQ_BASE 0x10330000 -#define RX_RX0FF_BASE 0x10340000 - -// SDIO host local register space mapping. -#define SDIO_LOCAL_MSK 0x0FFF -#define WLAN_IOREG_MSK 0x7FFF -#define WLAN_FIFO_MSK 0x1FFF // Aggregation Length[12:0] -#define WLAN_RX0FF_MSK 0x0003 - -#define SDIO_WITHOUT_REF_DEVICE_ID 0 // Without reference to the SDIO Device ID -#define SDIO_LOCAL_DEVICE_ID 0 // 0b[16], 000b[15:13] -#define WLAN_TX_HIQ_DEVICE_ID 4 // 0b[16], 100b[15:13] -#define WLAN_TX_MIQ_DEVICE_ID 5 // 0b[16], 101b[15:13] -#define WLAN_TX_LOQ_DEVICE_ID 6 // 0b[16], 110b[15:13] -#define WLAN_RX0FF_DEVICE_ID 7 // 0b[16], 111b[15:13] -#define WLAN_IOREG_DEVICE_ID 8 // 1b[16] - -// SDIO Tx Free Page Index -#define HI_QUEUE_IDX 0 -#define MID_QUEUE_IDX 1 -#define LOW_QUEUE_IDX 2 -#define PUBLIC_QUEUE_IDX 3 - -#define SDIO_MAX_TX_QUEUE 3 // HIQ, MIQ and LOQ -#define SDIO_MAX_RX_QUEUE 1 - -#define SDIO_REG_TX_CTRL 0x0000 // SDIO Tx Control -#define SDIO_REG_HIMR 0x0014 // SDIO Host Interrupt Mask -#define SDIO_REG_HISR 0x0018 // SDIO Host Interrupt Service Routine -#define SDIO_REG_HCPWM 0x0019 // HCI Current Power Mode -#define SDIO_REG_RX0_REQ_LEN 0x001C // RXDMA Request Length -#define SDIO_REG_FREE_TXPG 0x0020 // Free Tx Buffer Page -#define SDIO_REG_HCPWM1 0x0024 // HCI Current Power Mode 1 -#define SDIO_REG_HCPWM2 0x0026 // HCI Current Power Mode 2 -#define SDIO_REG_HTSFR_INFO 0x0030 // HTSF Informaion -#define SDIO_REG_HRPWM1 0x0080 // HCI Request Power Mode 1 -#define SDIO_REG_HRPWM2 0x0082 // HCI Request Power Mode 2 -#define SDIO_REG_HPS_CLKR 0x0084 // HCI Power Save Clock -#define SDIO_REG_HSUS_CTRL 0x0086 // SDIO HCI Suspend Control -#define SDIO_REG_HIMR_ON 0x0090 // SDIO Host Extension Interrupt Mask Always -#define SDIO_REG_HISR_ON 0x0091 // SDIO Host Extension Interrupt Status Always - -#define SDIO_HIMR_DISABLED 0 - -// RTL8188E SDIO Host Interrupt Mask Register -#define SDIO_HIMR_RX_REQUEST_MSK BIT0 -#define SDIO_HIMR_AVAL_MSK BIT1 -#define SDIO_HIMR_TXERR_MSK BIT2 -#define SDIO_HIMR_RXERR_MSK BIT3 -#define SDIO_HIMR_TXFOVW_MSK BIT4 -#define SDIO_HIMR_RXFOVW_MSK BIT5 -#define SDIO_HIMR_TXBCNOK_MSK BIT6 -#define SDIO_HIMR_TXBCNERR_MSK BIT7 -#define SDIO_HIMR_BCNERLY_INT_MSK BIT16 -#define SDIO_HIMR_C2HCMD_MSK BIT17 -#define SDIO_HIMR_CPWM1_MSK BIT18 -#define SDIO_HIMR_CPWM2_MSK BIT19 -#define SDIO_HIMR_HSISR_IND_MSK BIT20 -#define SDIO_HIMR_GTINT3_IND_MSK BIT21 -#define SDIO_HIMR_GTINT4_IND_MSK BIT22 -#define SDIO_HIMR_PSTIMEOUT_MSK BIT23 -#define SDIO_HIMR_OCPINT_MSK BIT24 -#define SDIO_HIMR_ATIMEND_MSK BIT25 -#define SDIO_HIMR_ATIMEND_E_MSK BIT26 -#define SDIO_HIMR_CTWEND_MSK BIT27 - -//RTL8188E SDIO Specific -#define SDIO_HIMR_MCU_ERR_MSK BIT28 -#define SDIO_HIMR_TSF_BIT32_TOGGLE_MSK BIT29 - -// SDIO Host Interrupt Service Routine -#define SDIO_HISR_RX_REQUEST BIT0 -#define SDIO_HISR_AVAL BIT1 -#define SDIO_HISR_TXERR BIT2 -#define SDIO_HISR_RXERR BIT3 -#define SDIO_HISR_TXFOVW BIT4 -#define SDIO_HISR_RXFOVW BIT5 -#define SDIO_HISR_TXBCNOK BIT6 -#define SDIO_HISR_TXBCNERR BIT7 -#define SDIO_HISR_BCNERLY_INT BIT16 -#define SDIO_HISR_C2HCMD BIT17 -#define SDIO_HISR_CPWM1 BIT18 -#define SDIO_HISR_CPWM2 BIT19 -#define SDIO_HISR_HSISR_IND BIT20 -#define SDIO_HISR_GTINT3_IND BIT21 -#define SDIO_HISR_GTINT4_IND BIT22 -#define SDIO_HISR_PSTIMEOUT BIT23 -#define SDIO_HISR_OCPINT BIT24 -#define SDIO_HISR_ATIMEND BIT25 -#define SDIO_HISR_ATIMEND_E BIT26 -#define SDIO_HISR_CTWEND BIT27 - -//RTL8188E SDIO Specific -#define SDIO_HISR_MCU_ERR BIT28 -#define SDIO_HISR_TSF_BIT32_TOGGLE BIT29 - -#define MASK_SDIO_HISR_CLEAR (SDIO_HISR_TXERR |\ - SDIO_HISR_RXERR |\ - SDIO_HISR_TXFOVW |\ - SDIO_HISR_RXFOVW |\ - SDIO_HISR_TXBCNOK |\ - SDIO_HISR_TXBCNERR |\ - SDIO_HISR_C2HCMD |\ - SDIO_HISR_CPWM1 |\ - SDIO_HISR_CPWM2 |\ - SDIO_HISR_HSISR_IND |\ - SDIO_HISR_GTINT3_IND |\ - SDIO_HISR_GTINT4_IND |\ - SDIO_HISR_PSTIMEOUT |\ - SDIO_HISR_OCPINT) - -// SDIO HCI Suspend Control Register -#define HCI_RESUME_PWR_RDY BIT1 -#define HCI_SUS_CTRL BIT0 - -// SDIO Tx FIFO related -#define SDIO_TX_FREE_PG_QUEUE 4 // The number of Tx FIFO free page -#define SDIO_TX_FIFO_PAGE_SZ 128 - -/* move to rtl8188e_xmit.h -#if DEV_BUS_TYPE == RT_SDIO_INTERFACE - #define MAX_TX_AGG_PACKET_NUMBER 0x8 -#else - #define MAX_TX_AGG_PACKET_NUMBER 0xFF -#endif -*/ - -// vivi added for new cam search flow, 20091028 -//#define SCR_TxUseBroadcastDK BIT6 // Force Tx Use Broadcast Default Key -//#define SCR_RxUseBroadcastDK BIT7 // Force Rx Use Broadcast Default Key - -//----------------------------------------------------- -// -// 0xFE00h ~ 0xFE55h USB Configuration -// -//----------------------------------------------------- - -//2 USB Information (0xFE17) -#define USB_IS_HIGH_SPEED 0 -#define USB_IS_FULL_SPEED 1 -#define USB_SPEED_MASK BIT(5) - -#define USB_NORMAL_SIE_EP_MASK 0xF -#define USB_NORMAL_SIE_EP_SHIFT 4 - - -//2 Special Option -#define USB_AGG_EN BIT(3) - -// 0; Use interrupt endpoint to upload interrupt pkt -// 1; Use bulk endpoint to upload interrupt pkt, -#define INT_BULK_SEL BIT(4) - - - -//2REG_C2HEVT_CLEAR -#define C2H_EVT_HOST_CLOSE 0x00 // Set by driver and notify FW that the driver has read the C2H command message -#define C2H_EVT_FW_CLOSE 0xFF // Set by FW indicating that FW had set the C2H command message and it's not yet read by driver. - - -//2REG_MULTI_FUNC_CTRL(For RTL8723 Only) -#define WL_HWPDN_EN BIT0 // Enable GPIO[9] as WiFi HW PDn source -#define WL_HWPDN_SL BIT1 // WiFi HW PDn polarity control -#define WL_FUNC_EN BIT2 // WiFi function enable -#define WL_HWROF_EN BIT3 // Enable GPIO[9] as WiFi RF HW PDn source -#define BT_HWPDN_EN BIT16 // Enable GPIO[11] as BT HW PDn source -#define BT_HWPDN_SL BIT17 // BT HW PDn polarity control -#define BT_FUNC_EN BIT18 // BT function enable -#define BT_HWROF_EN BIT19 // Enable GPIO[11] as BT/GPS RF HW PDn source -#define GPS_HWPDN_EN BIT20 // Enable GPIO[10] as GPS HW PDn source -#define GPS_HWPDN_SL BIT21 // GPS HW PDn polarity control -#define GPS_FUNC_EN BIT22 // GPS function enable - - -//3 REG_LIFECTRL_CTRL -#define HAL92C_EN_PKT_LIFE_TIME_BK BIT3 -#define HAL92C_EN_PKT_LIFE_TIME_BE BIT2 -#define HAL92C_EN_PKT_LIFE_TIME_VI BIT1 -#define HAL92C_EN_PKT_LIFE_TIME_VO BIT0 - -#define HAL92C_MSDU_LIFE_TIME_UNIT 128 // in us, said by Tim. - -//======================================================== -// General definitions -//======================================================== -//#if (HAL_8195A_USB == 1) -//#define LAST_ENTRY_OF_TX_PKT_BUFFER 255 -//#else -#define LAST_ENTRY_OF_TX_PKT_BUFFER 176 // 22k 22528 bytes -//#endif - -#define POLLING_LLT_THRESHOLD 20 -//#if RTL8188E_FOR_MP_TEST == 1 -//#define POLLING_READY_TIMEOUT_COUNT 3000 -//#else -#define POLLING_READY_TIMEOUT_COUNT 1000 -//#endif -// GPIO BIT -#define HAL_8188E_HW_GPIO_WPS_BIT BIT7 - -#if 0//(RTL8188E_SUPPORT == 1) -////////////////////////////////ONLY for 88EE///////////////////////////////// -// -// Host Interrupt Status Registers (Offset: 0x00B4-00B7, 0x00BC-00BF) -// Host Interrupt Mask Registers (Offset: 0x00B0-00B3, 0x00B8-00BB) -// -//---------------------------------------------------------------------------- -// 8188 IMR/ISR bits -//---------------------------------------------------------------------------- -#define IMR_DISABLED_88E 0x0 -// IMR DW0(0x00B0-00B3) Bit 0-31 -#define IMR_TXCCK_88E BIT30 // TXRPT interrupt when CCX bit of the packet is set -#define IMR_PSTIMEOUT_88E BIT29 // Power Save Time Out Interrupt -#define IMR_GTINT4_88E BIT28 // When GTIMER4 expires, this bit is set to 1 -#define IMR_GTINT3_88E BIT27 // When GTIMER3 expires, this bit is set to 1 -#define IMR_TBDER_88E BIT26 // Transmit Beacon0 Error -#define IMR_TBDOK_88E BIT25 // Transmit Beacon0 OK -#define IMR_TSF_BIT32_TOGGLE_88E BIT24 // TSF Timer BIT32 toggle indication interrupt -#define IMR_BcnInt_88E BIT20 // Beacon DMA Interrupt 0 -#define IMR_BDOK_88E BIT16 // Beacon Queue DMA OK0 -#define IMR_HSISR_IND_ON_INT_88E BIT15 // HSISR Indicator (HSIMR & HSISR is true, this bit is set to 1) -#define IMR_BCNDMAINT_E_88E BIT14 // Beacon DMA Interrupt Extension for Win7 -#define IMR_ATIMEND_88E BIT12 // CTWidnow End or ATIM Window End -#define IMR_HISR1_IND_INT_88E BIT11 // HISR1 Indicator (HISR1 & HIMR1 is true, this bit is set to 1) -#define IMR_C2HCMD_88E BIT10 // CPU to Host Command INT Status, Write 1 clear -#define IMR_CPWM2_88E BIT9 // CPU power Mode exchange INT Status, Write 1 clear -#define IMR_CPWM_88E BIT8 // CPU power Mode exchange INT Status, Write 1 clear -#define IMR_HIGHDOK_88E BIT7 // High Queue DMA OK -#define IMR_MGNTDOK_88E BIT6 // Management Queue DMA OK -#define IMR_BKDOK_88E BIT5 // AC_BK DMA OK -#define IMR_BEDOK_88E BIT4 // AC_BE DMA OK -#define IMR_VIDOK_88E BIT3 // AC_VI DMA OK -#define IMR_VODOK_88E BIT2 // AC_VO DMA OK -#define IMR_RDU_88E BIT1 // Rx Descriptor Unavailable -#define IMR_ROK_88E BIT0 // Receive DMA OK - -// IMR DW1(0x00B8-00BB) Bit 0-31 -#define IMR_BCNDMAINT7_88E BIT27 // Beacon DMA Interrupt 7 -#define IMR_BCNDMAINT6_88E BIT26 // Beacon DMA Interrupt 6 -#define IMR_BCNDMAINT5_88E BIT25 // Beacon DMA Interrupt 5 -#define IMR_BCNDMAINT4_88E BIT24 // Beacon DMA Interrupt 4 -#define IMR_BCNDMAINT3_88E BIT23 // Beacon DMA Interrupt 3 -#define IMR_BCNDMAINT2_88E BIT22 // Beacon DMA Interrupt 2 -#define IMR_BCNDMAINT1_88E BIT21 // Beacon DMA Interrupt 1 -#define IMR_BCNDOK7_88E BIT20 // Beacon Queue DMA OK Interrup 7 -#define IMR_BCNDOK6_88E BIT19 // Beacon Queue DMA OK Interrup 6 -#define IMR_BCNDOK5_88E BIT18 // Beacon Queue DMA OK Interrup 5 -#define IMR_BCNDOK4_88E BIT17 // Beacon Queue DMA OK Interrup 4 -#define IMR_BCNDOK3_88E BIT16 // Beacon Queue DMA OK Interrup 3 -#define IMR_BCNDOK2_88E BIT15 // Beacon Queue DMA OK Interrup 2 -#define IMR_BCNDOK1_88E BIT14 // Beacon Queue DMA OK Interrup 1 -#define IMR_ATIMEND_E_88E BIT13 // ATIM Window End Extension for Win7 -#define IMR_TXERR_88E BIT11 // Tx Error Flag Interrupt Status, write 1 clear. -#define IMR_RXERR_88E BIT10 // Rx Error Flag INT Status, Write 1 clear -#define IMR_TXFOVW_88E BIT9 // Transmit FIFO Overflow -#define IMR_RXFOVW_88E BIT8 // Receive FIFO Overflow - - - -////////////////////////////////ONLY for 88EE///////////////////////////////// -#endif //(RTL8188E_SUPPORT == 1) - - -//---------------------------------------------------------------------------- -// 8192C EEPROM/EFUSE share register definition. -//---------------------------------------------------------------------------- - -//==================================================== -// EEPROM/Efuse PG Offset for 88EE/88EU/88ES -//==================================================== -#define EEPROM_TX_PWR_INX_88E 0x10 - -#define EEPROM_ChannelPlan_88E 0xB8 -#define EEPROM_XTAL_88E 0xB9 -#define EEPROM_THERMAL_METER_88E 0xBA -#define EEPROM_IQK_LCK_88E 0xBB - -#define EEPROM_RF_BOARD_OPTION_88E 0xC1 -#define EEPROM_RF_FEATURE_OPTION_88E 0xC2 -#define EEPROM_RF_BT_SETTING_88E 0xC3 -#define EEPROM_VERSION_88E 0xC4 -#define EEPROM_CUSTOMERID_88E 0xC5 -#define EEPROM_RF_ANTENNA_OPT_88E 0xC9 - -#ifdef CONFIG_RF_GAIN_OFFSET -#define EEPROM_RF_GAIN_OFFSET_88E 0xC1 -#define EEPROM_RF_GAIN_VAL_88E 0xF6 //Physical address which is the BB gain offset value -#endif //CONFIG_RF_GAIN_OFFSET - -// RTL88EE -#define EEPROM_MAC_ADDR_88EE 0xD0 -#define EEPROM_VID_88EE 0xD6 -#define EEPROM_DID_88EE 0xD8 -#define EEPROM_SVID_88EE 0xDA -#define EEPROM_SMID_88EE 0xDC - -//RTL88EU -#define EEPROM_MAC_ADDR_88EU 0xD7 -#define EEPROM_VID_88EU 0xD0 -#define EEPROM_PID_88EU 0xD2 -#define EEPROM_USB_OPTIONAL_FUNCTION0 0xD4 - -// RTL88ES -#define EEPROM_MAC_ADDR_88ES 0x11A - - - - -//==================================================== -// EEPROM/Efuse Value Type -//==================================================== -#define EETYPE_TX_PWR 0x0 - -// -// Default Value for EEPROM or EFUSE!!! -// -#define EEPROM_Default_TSSI 0x0 -#define EEPROM_Default_TxPowerDiff 0x0 -#define EEPROM_Default_CrystalCap 0x5 -#define EEPROM_Default_BoardType 0x02 // Default: 2X2, RTL8192CE(QFPN68) -#define EEPROM_Default_TxPower 0x1010 -#define EEPROM_Default_HT2T_TxPwr 0x10 - -#define EEPROM_Default_LegacyHTTxPowerDiff 0x3 -#define EEPROM_Default_ThermalMeter 0x12 - -#define EEPROM_Default_AntTxPowerDiff 0x0 -#define EEPROM_Default_TxPwDiff_CrystalCap 0x5 -#if (RTL8188ES_SUPPORT==1) //for SDIO -#define EEPROM_Default_TxPowerLevel 0x25 -#else //for USB/PCIE -#define EEPROM_Default_TxPowerLevel 0x2A -#endif - -#define EEPROM_Default_HT40_2SDiff 0x0 -#define EEPROM_Default_HT20_Diff 2 // HT20<->40 default Tx Power Index Difference -#define EEPROM_Default_LegacyHTTxPowerDiff 0x3 -#define EEPROM_Default_HT40_PwrMaxOffset 0 -#define EEPROM_Default_HT20_PwrMaxOffset 0 - -#define EEPROM_Default_CrystalCap_88E 0x20 -#define EEPROM_Default_ThermalMeter_88E 0x18 - -#ifdef CONFIG_RF_GAIN_OFFSET -#define EEPROM_Default_RFGainOffset 0xff -#endif //CONFIG_RF_GAIN_OFFSET - -//New EFUSE deafult value -#define EEPROM_DEFAULT_24G_INDEX 0x2D -#define EEPROM_DEFAULT_24G_HT20_DIFF 0X02 -#define EEPROM_DEFAULT_24G_OFDM_DIFF 0X04 - -#define EEPROM_DEFAULT_5G_INDEX 0X2A -#define EEPROM_DEFAULT_5G_HT20_DIFF 0X00 -#define EEPROM_DEFAULT_5G_OFDM_DIFF 0X04 - -#define EEPROM_DEFAULT_DIFF 0XFE -#define EEPROM_DEFAULT_CHANNEL_PLAN 0x7F -#define EEPROM_DEFAULT_BOARD_OPTION 0x00 -#define EEPROM_DEFAULT_FEATURE_OPTION 0x00 -#define EEPROM_DEFAULT_BT_OPTION 0x10 - - -// For debug -#define EEPROM_Default_PID 0x1234 -#define EEPROM_Default_VID 0x5678 -#define EEPROM_Default_CustomerID 0xAB -#define EEPROM_Default_CustomerID_8188E 0x00 -#define EEPROM_Default_SubCustomerID 0xCD -#define EEPROM_Default_Version 0 - -#define EEPROM_CHANNEL_PLAN_FCC 0x0 -#define EEPROM_CHANNEL_PLAN_IC 0x1 -#define EEPROM_CHANNEL_PLAN_ETSI 0x2 -#define EEPROM_CHANNEL_PLAN_SPAIN 0x3 -#define EEPROM_CHANNEL_PLAN_FRANCE 0x4 -#define EEPROM_CHANNEL_PLAN_MKK 0x5 -#define EEPROM_CHANNEL_PLAN_MKK1 0x6 -#define EEPROM_CHANNEL_PLAN_ISRAEL 0x7 -#define EEPROM_CHANNEL_PLAN_TELEC 0x8 -#define EEPROM_CHANNEL_PLAN_GLOBAL_DOMAIN 0x9 -#define EEPROM_CHANNEL_PLAN_WORLD_WIDE_13 0xA -#define EEPROM_CHANNEL_PLAN_NCC 0xB -#define EEPROM_USB_OPTIONAL1 0xE -#define EEPROM_CHANNEL_PLAN_BY_HW_MASK 0x80 - - -#define EEPROM_CID_DEFAULT 0x0 -#define EEPROM_CID_TOSHIBA 0x4 -#define EEPROM_CID_CCX 0x10 // CCX test. By Bruce, 2009-02-25. -#define EEPROM_CID_QMI 0x0D -#define EEPROM_CID_WHQL 0xFE // added by chiyoko for dtm, 20090108 - - -#define RTL_EEPROM_ID 0x8129 - -#endif //__RTL8188E_SPEC_H__ - +/****************************************************************************** + * + * 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 __RTL8188E_SPEC_H__ +#define __RTL8188E_SPEC_H__ + +#include + +#ifndef BIT +#define BIT(x) (1 << (x)) +#endif + +#define BIT0 0x00000001 +#define BIT1 0x00000002 +#define BIT2 0x00000004 +#define BIT3 0x00000008 +#define BIT4 0x00000010 +#define BIT5 0x00000020 +#define BIT6 0x00000040 +#define BIT7 0x00000080 +#define BIT8 0x00000100 +#define BIT9 0x00000200 +#define BIT10 0x00000400 +#define BIT11 0x00000800 +#define BIT12 0x00001000 +#define BIT13 0x00002000 +#define BIT14 0x00004000 +#define BIT15 0x00008000 +#define BIT16 0x00010000 +#define BIT17 0x00020000 +#define BIT18 0x00040000 +#define BIT19 0x00080000 +#define BIT20 0x00100000 +#define BIT21 0x00200000 +#define BIT22 0x00400000 +#define BIT23 0x00800000 +#define BIT24 0x01000000 +#define BIT25 0x02000000 +#define BIT26 0x04000000 +#define BIT27 0x08000000 +#define BIT28 0x10000000 +#define BIT29 0x20000000 +#define BIT30 0x40000000 +#define BIT31 0x80000000 + +//============================================================ +// 8192C Regsiter offset definition +//============================================================ + +#define HAL_PS_TIMER_INT_DELAY 50 // 50 microseconds +#define HAL_92C_NAV_UPPER_UNIT 128 // micro-second + +#define MAC_ADDR_LEN 6 +// 8188E PKT_BUFF_ACCESS_CTRL value +#define TXPKT_BUF_SELECT 0x69 +#define RXPKT_BUF_SELECT 0xA5 +#define DISABLE_TRXPKT_BUF_ACCESS 0x0 + +//============================================================ +// +//============================================================ + +//----------------------------------------------------- +// +// 0x0000h ~ 0x00FFh System Configuration +// +//----------------------------------------------------- +#define REG_SYS_ISO_CTRL 0x0000 +#define REG_SYS_FUNC_EN 0x0002 +#define REG_APS_FSMCO 0x0004 +#define REG_SYS_CLKR 0x0008 +#define REG_9346CR 0x000A +#define REG_EE_VPD 0x000C +#define REG_AFE_MISC 0x0010 +#define REG_SPS0_CTRL 0x0011 +#define REG_SPS_OCP_CFG 0x0018 +#define REG_RSV_CTRL 0x001C +#define REG_RF_CTRL 0x001F +#define REG_LDOA15_CTRL 0x0020 +#define REG_LDOV12D_CTRL 0x0021 +#define REG_LDOHCI12_CTRL 0x0022 +#define REG_LPLDO_CTRL 0x0023 +#define REG_AFE_XTAL_CTRL 0x0024 +#define REG_AFE_PLL_CTRL 0x0028 +#define REG_APE_PLL_CTRL_EXT 0x002c +#define REG_EFUSE_CTRL 0x0030 +#define REG_EFUSE_TEST 0x0034 +#define REG_GPIO_MUXCFG 0x0040 +#define REG_GPIO_IO_SEL 0x0042 +#define REG_MAC_PINMUX_CFG 0x0043 +#define REG_GPIO_PIN_CTRL 0x0044 +#define REG_GPIO_INTM 0x0048 +#define REG_LEDCFG0 0x004C +#define REG_LEDCFG1 0x004D +#define REG_LEDCFG2 0x004E +#define REG_LEDCFG3 0x004F +#define REG_FSIMR 0x0050 +#define REG_FSISR 0x0054 +#define REG_HSIMR 0x0058 +#define REG_HSISR 0x005c +#define REG_GPIO_PIN_CTRL_2 0x0060 // RTL8723 WIFI/BT/GPS Multi-Function GPIO Pin Control. +#define REG_GPIO_IO_SEL_2 0x0062 // RTL8723 WIFI/BT/GPS Multi-Function GPIO Select. +#define REG_BB_PAD_CTRL 0x0064 +#define REG_MULTI_FUNC_CTRL 0x0068 // RTL8723 WIFI/BT/GPS Multi-Function control source. +#define REG_GPIO_OUTPUT 0x006c +#define REG_AFE_XTAL_CTRL_EXT 0x0078 //RTL8188E +#define REG_XCK_OUT_CTRL 0x007c //RTL8188E +#define REG_MCUFWDL 0x0080 +#define REG_WOL_EVENT 0x0081 //RTL8188E +#define REG_MCUTSTCFG 0x0084 +#define REG_HMEBOX_E0 0x0088 +#define REG_HMEBOX_E1 0x008A +#define REG_HMEBOX_E2 0x008C +#define REG_HMEBOX_E3 0x008E +#define REG_HMEBOX_EXT_0 0x01F0 +#define REG_HMEBOX_EXT_1 0x01F4 +#define REG_HMEBOX_EXT_2 0x01F8 +#define REG_HMEBOX_EXT_3 0x01FC +#define REG_HIMR_88E 0x00B0 +#define REG_HISR_88E 0x00B4 +#define REG_HIMRE_88E 0x00B8 +#define REG_HISRE_88E 0x00BC +#define REG_EFUSE_ACCESS 0x00CF // Efuse access protection for RTL8723 +#define REG_BIST_SCAN 0x00D0 +#define REG_BIST_RPT 0x00D4 +#define REG_BIST_ROM_RPT 0x00D8 +#define REG_USB_SIE_INTF 0x00E0 +#define REG_PCIE_MIO_INTF 0x00E4 +#define REG_PCIE_MIO_INTD 0x00E8 +#define REG_HPON_FSM 0x00EC +#define REG_SYS_CFG 0x00F0 +#define REG_GPIO_OUTSTS 0x00F4 // For RTL8723 only. +#define REG_TYPE_ID 0x00FC + +#define REG_MAC_PHY_CTRL_NORMAL 0x00f8 + +//----------------------------------------------------- +// +// 0x0100h ~ 0x01FFh MACTOP General Configuration +// +//----------------------------------------------------- +#define REG_CR 0x0100 +#define REG_PBP 0x0104 +#define REG_PKT_BUFF_ACCESS_CTRL 0x0106 +#define REG_TRXDMA_CTRL 0x010C +#define REG_TRXFF_BNDY 0x0114 +#define REG_TRXFF_STATUS 0x0118 +#define REG_RXFF_PTR 0x011C +//#define REG_HIMR 0x0120 +//#define REG_HISR 0x0124 +#define REG_HIMRE 0x0128 +#define REG_HISRE 0x012C +#define REG_CPWM 0x012F +#define REG_FWIMR 0x0130 +#define REG_FTIMR 0x0138 +#define REG_FWISR 0x0134 +#define REG_PKTBUF_DBG_CTRL 0x0140 +#define REG_PKTBUF_DBG_ADDR (REG_PKTBUF_DBG_CTRL) +#define REG_RXPKTBUF_DBG (REG_PKTBUF_DBG_CTRL+2) +#define REG_TXPKTBUF_DBG (REG_PKTBUF_DBG_CTRL+3) +#define REG_RXPKTBUF_CTRL (REG_PKTBUF_DBG_CTRL+2) +#define REG_PKTBUF_DBG_DATA_L 0x0144 +#define REG_PKTBUF_DBG_DATA_H 0x0148 + +#define REG_TC0_CTRL 0x0150 +#define REG_TC1_CTRL 0x0154 +#define REG_TC2_CTRL 0x0158 +#define REG_TC3_CTRL 0x015C +#define REG_TC4_CTRL 0x0160 +#define REG_TCUNIT_BASE 0x0164 +#define REG_MBIST_START 0x0174 +#define REG_MBIST_DONE 0x0178 +#define REG_MBIST_FAIL 0x017C +#define REG_32K_CTRL 0x0194 //RTL8188E +#define REG_C2HEVT_MSG_NORMAL 0x01A0 +#define REG_C2HEVT_CLEAR 0x01AF +#define REG_MCUTST_1 0x01c0 +#ifdef CONFIG_WOWLAN +#define REG_WOWLAN_WAKE_REASON 0x01c7 +#endif +#define REG_FMETHR 0x01C8 +#define REG_HMETFR 0x01CC +#define REG_HMEBOX_0 0x01D0 +#define REG_HMEBOX_1 0x01D4 +#define REG_HMEBOX_2 0x01D8 +#define REG_HMEBOX_3 0x01DC + +#define REG_LLT_INIT 0x01E0 + + +//----------------------------------------------------- +// +// 0x0200h ~ 0x027Fh TXDMA Configuration +// +//----------------------------------------------------- +#define REG_RQPN 0x0200 +#define REG_FIFOPAGE 0x0204 +#define REG_TDECTRL 0x0208 +#define REG_TXDMA_OFFSET_CHK 0x020C +#define REG_TXDMA_STATUS 0x0210 +#define REG_RQPN_NPQ 0x0214 + +//----------------------------------------------------- +// +// 0x0280h ~ 0x02FFh RXDMA Configuration +// +//----------------------------------------------------- +#define REG_RXDMA_AGG_PG_TH 0x0280 +#define REG_RXPKT_NUM 0x0284 +#define REG_RXDMA_STATUS 0x0288 + +//----------------------------------------------------- +// +// 0x0300h ~ 0x03FFh PCIe +// +//----------------------------------------------------- +#define REG_PCIE_CTRL_REG 0x0300 +#define REG_INT_MIG 0x0304 // Interrupt Migration +#define REG_BCNQ_DESA 0x0308 // TX Beacon Descriptor Address +#define REG_HQ_DESA 0x0310 // TX High Queue Descriptor Address +#define REG_MGQ_DESA 0x0318 // TX Manage Queue Descriptor Address +#define REG_VOQ_DESA 0x0320 // TX VO Queue Descriptor Address +#define REG_VIQ_DESA 0x0328 // TX VI Queue Descriptor Address +#define REG_BEQ_DESA 0x0330 // TX BE Queue Descriptor Address +#define REG_BKQ_DESA 0x0338 // TX BK Queue Descriptor Address +#define REG_RX_DESA 0x0340 // RX Queue Descriptor Address +#define REG_MDIO 0x0354 // MDIO for Access PCIE PHY +#define REG_DBG_SEL 0x0360 // Debug Selection Register +#define REG_PCIE_HRPWM 0x0361 //PCIe RPWM +#define REG_PCIE_HCPWM 0x0363 //PCIe CPWM +#define REG_WATCH_DOG 0x0368 + +// RTL8723 series ------------------------------- +#define REG_PCIE_HISR 0x03A0 + +// spec version 11 +//----------------------------------------------------- +// +// 0x0400h ~ 0x047Fh Protocol Configuration +// +//----------------------------------------------------- +#define REG_VOQ_INFORMATION 0x0400 +#define REG_VIQ_INFORMATION 0x0404 +#define REG_BEQ_INFORMATION 0x0408 +#define REG_BKQ_INFORMATION 0x040C +#define REG_MGQ_INFORMATION 0x0410 +#define REG_HGQ_INFORMATION 0x0414 +#define REG_BCNQ_INFORMATION 0x0418 +#define REG_TXPKT_EMPTY 0x041A + +#define REG_CPU_MGQ_INFORMATION 0x041C +#define REG_FWHW_TXQ_CTRL 0x0420 +#define REG_HWSEQ_CTRL 0x0423 +#define REG_TXPKTBUF_BCNQ_BDNY 0x0424 +#define REG_TXPKTBUF_MGQ_BDNY 0x0425 +#define REG_LIFETIME_EN 0x0426 +#define REG_MULTI_BCNQ_OFFSET 0x0427 +#define REG_SPEC_SIFS 0x0428 +#define REG_RL 0x042A +#define REG_DARFRC 0x0430 +#define REG_RARFRC 0x0438 +#define REG_RRSR 0x0440 +#define REG_ARFR0 0x0444 +#define REG_ARFR1 0x0448 +#define REG_ARFR2 0x044C +#define REG_ARFR3 0x0450 +#define REG_AGGLEN_LMT 0x0458 +#define REG_AMPDU_MIN_SPACE 0x045C +#define REG_TXPKTBUF_WMAC_LBK_BF_HD 0x045D +#define REG_FAST_EDCA_CTRL 0x0460 +#define REG_RD_RESP_PKT_TH 0x0463 +#define REG_INIRTS_RATE_SEL 0x0480 +//#define REG_INIDATA_RATE_SEL 0x0484 +#define REG_MACID_NO_LINK_0 0x0484 +#define REG_MACID_NO_LINK_1 0x0488 + +#define REG_POWER_STATUS 0x04A4 +#define REG_POWER_STAGE1 0x04B4 +#define REG_POWER_STAGE2 0x04B8 +#define REG_PKT_VO_VI_LIFE_TIME 0x04C0 +#define REG_PKT_BE_BK_LIFE_TIME 0x04C2 +#define REG_STBC_SETTING 0x04C4 +#define REG_PROT_MODE_CTRL 0x04C8 +#define REG_MAX_AGGR_NUM 0x04CA +#define REG_RTS_MAX_AGGR_NUM 0x04CB +#define REG_BAR_MODE_CTRL 0x04CC +#define REG_RA_TRY_RATE_AGG_LMT 0x04CF +#define REG_EARLY_MODE_CONTROL 0x4D0 +#define REG_NQOS_SEQ 0x04DC +#define REG_QOS_SEQ 0x04DE +#define REG_NEED_CPU_HANDLE 0x04E0 +#define REG_PKT_LOSE_RPT 0x04E1 +#define REG_PTCL_ERR_STATUS 0x04E2 +#define REG_TX_RPT_CTRL 0x04EC +#define REG_TX_RPT_TIME 0x04F0 // 2 byte +#define REG_DUMMY 0x04FC + +#ifdef CONFIG_WOWLAN +#define REG_TXPKTBUF_IV_LOW 0x0484 +#define REG_TXPKTBUF_IV_HIGH 0x0488 +#endif + +//----------------------------------------------------- +// +// 0x0500h ~ 0x05FFh EDCA Configuration +// +//----------------------------------------------------- +#define REG_EDCA_VO_PARAM 0x0500 +#define REG_EDCA_VI_PARAM 0x0504 +#define REG_EDCA_BE_PARAM 0x0508 +#define REG_EDCA_BK_PARAM 0x050C +#define REG_BCNTCFG 0x0510 +#define REG_PIFS 0x0512 +#define REG_RDG_PIFS 0x0513 +#define REG_SIFS_CTX 0x0514 +#define REG_SIFS_TRX 0x0516 +#define REG_TSFTR_SYN_OFFSET 0x0518 +#define REG_AGGR_BREAK_TIME 0x051A +#define REG_SLOT 0x051B +#define REG_TX_PTCL_CTRL 0x0520 +#define REG_TXPAUSE 0x0522 +#define REG_DIS_TXREQ_CLR 0x0523 +#define REG_RD_CTRL 0x0524 +// +// Format for offset 540h-542h: +// [3:0]: TBTT prohibit setup in unit of 32us. The time for HW getting beacon content before TBTT. +// [7:4]: Reserved. +// [19:8]: TBTT prohibit hold in unit of 32us. The time for HW holding to send the beacon packet. +// [23:20]: Reserved +// Description: +// | +// |<--Setup--|--Hold------------>| +// --------------|---------------------- +// | +// TBTT +// Note: We cannot update beacon content to HW or send any AC packets during the time between Setup and Hold. +// Described by Designer Tim and Bruce, 2011-01-14. +// +#define REG_TBTT_PROHIBIT 0x0540 +#define REG_RD_NAV_NXT 0x0544 +#define REG_NAV_PROT_LEN 0x0546 +#define REG_BCN_CTRL 0x0550 +#define REG_BCN_CTRL_1 0x0551 +#define REG_MBID_NUM 0x0552 +#define REG_DUAL_TSF_RST 0x0553 +#define REG_BCN_INTERVAL 0x0554 // The same as REG_MBSSID_BCN_SPACE +#define REG_DRVERLYINT 0x0558 +#define REG_BCNDMATIM 0x0559 +#define REG_ATIMWND 0x055A +#define REG_BCN_MAX_ERR 0x055D +#define REG_RXTSF_OFFSET_CCK 0x055E +#define REG_RXTSF_OFFSET_OFDM 0x055F +#define REG_TSFTR 0x0560 +#define REG_TSFTR1 0x0568 +#define REG_ATIMWND_1 0x0570 +#define REG_PSTIMER 0x0580 +#define REG_TIMER0 0x0584 +#define REG_TIMER1 0x0588 +#define REG_ACMHWCTRL 0x05C0 + +//#define REG_FW_TSF_SYNC_CNT 0x04A0 +#define REG_FW_RESET_TSF_CNT_1 0x05FC +#define REG_FW_RESET_TSF_CNT_0 0x05FD +#define REG_FW_BCN_DIS_CNT 0x05FE + +//----------------------------------------------------- +// +// 0x0600h ~ 0x07FFh WMAC Configuration +// +//----------------------------------------------------- +#define REG_APSD_CTRL 0x0600 +#define REG_BWOPMODE 0x0603 +#define REG_TCR 0x0604 +#define REG_RCR 0x0608 +#define REG_RX_PKT_LIMIT 0x060C +#define REG_RX_DLK_TIME 0x060D +#define REG_RX_DRVINFO_SZ 0x060F + +#define REG_MACID 0x0610 +#define REG_BSSID 0x0618 +#define REG_MAR 0x0620 +#define REG_MBIDCAMCFG 0x0628 + +#define REG_USTIME_EDCA 0x0638 +#define REG_MAC_SPEC_SIFS 0x063A + +// 20100719 Joseph: Hardware register definition change. (HW datasheet v54) +#define REG_R2T_SIFS 0x063C // [15:8]SIFS_R2T_OFDM, [7:0]SIFS_R2T_CCK +#define REG_T2T_SIFS 0x063E // [15:8]SIFS_T2T_OFDM, [7:0]SIFS_T2T_CCK +#define REG_ACKTO 0x0640 +#define REG_CTS2TO 0x0641 +#define REG_EIFS 0x0642 + + +//RXERR_RPT +#define RXERR_TYPE_OFDM_PPDU 0 +#define RXERR_TYPE_OFDM_FALSE_ALARM 1 +#define RXERR_TYPE_OFDM_MPDU_OK 2 +#define RXERR_TYPE_OFDM_MPDU_FAIL 3 +#define RXERR_TYPE_CCK_PPDU 4 +#define RXERR_TYPE_CCK_FALSE_ALARM 5 +#define RXERR_TYPE_CCK_MPDU_OK 6 +#define RXERR_TYPE_CCK_MPDU_FAIL 7 +#define RXERR_TYPE_HT_PPDU 8 +#define RXERR_TYPE_HT_FALSE_ALARM 9 +#define RXERR_TYPE_HT_MPDU_TOTAL 10 +#define RXERR_TYPE_HT_MPDU_OK 11 +#define RXERR_TYPE_HT_MPDU_FAIL 12 +#define RXERR_TYPE_RX_FULL_DROP 15 + +#define RXERR_COUNTER_MASK 0xFFFFF +#define RXERR_RPT_RST BIT(27) +#define _RXERR_RPT_SEL(type) ((type) << 28) + + +// +// Note: +// The NAV upper value is very important to WiFi 11n 5.2.3 NAV test. The default value is +// always too small, but the WiFi TestPlan test by 25,000 microseconds of NAV through sending +// CTS in the air. We must update this value greater than 25,000 microseconds to pass the item. +// The offset of NAV_UPPER in 8192C Spec is incorrect, and the offset should be 0x0652. Commented +// by SD1 Scott. +// By Bruce, 2011-07-18. +// +#define REG_NAV_UPPER 0x0652 // unit of 128 + +//WMA, BA, CCX +//#define REG_NAV_CTRL 0x0650 +#define REG_BACAMCMD 0x0654 +#define REG_BACAMCONTENT 0x0658 +#define REG_LBDLY 0x0660 +#define REG_FWDLY 0x0661 +#define REG_RXERR_RPT 0x0664 +#define REG_WMAC_TRXPTCL_CTL 0x0668 + +// Security +#define REG_CAMCMD 0x0670 +#define REG_CAMWRITE 0x0674 +#define REG_CAMREAD 0x0678 +#define REG_CAMDBG 0x067C +#define REG_SECCFG 0x0680 + +// Power +#define REG_WOW_CTRL 0x0690 +#define REG_PS_RX_INFO 0x0692 +#define REG_UAPSD_TID 0x0693 +#define REG_WKFMCAM_CMD 0x0698 +#define REG_WKFMCAM_NUM_88E 0x698 +#define REG_RXFLTMAP0 0x06A0 +#define REG_RXFLTMAP1 0x06A2 +#define REG_RXFLTMAP2 0x06A4 +#define REG_BCN_PSR_RPT 0x06A8 +#define REG_BT_COEX_TABLE 0x06C0 + + +// Hardware Port 2 +#define REG_MACID1 0x0700 +#define REG_BSSID1 0x0708 + + +//----------------------------------------------------- +// +// 0xFE00h ~ 0xFE55h USB Configuration +// +//----------------------------------------------------- +#define REG_USB_INFO 0xFE17 +#define REG_USB_SPECIAL_OPTION 0xFE55 +#define REG_USB_DMA_AGG_TO 0xFE5B +#define REG_USB_AGG_TO 0xFE5C +#define REG_USB_AGG_TH 0xFE5D + + +// For normal chip +#define REG_NORMAL_SIE_VID 0xFE60 // 0xFE60~0xFE61 +#define REG_NORMAL_SIE_PID 0xFE62 // 0xFE62~0xFE63 +#define REG_NORMAL_SIE_OPTIONAL 0xFE64 +#define REG_NORMAL_SIE_EP 0xFE65 // 0xFE65~0xFE67 +#define REG_NORMAL_SIE_PHY 0xFE68 // 0xFE68~0xFE6B +#define REG_NORMAL_SIE_OPTIONAL2 0xFE6C +#define REG_NORMAL_SIE_GPS_EP 0xFE6D // 0xFE6D, for RTL8723 only. +#define REG_NORMAL_SIE_MAC_ADDR 0xFE70 // 0xFE70~0xFE75 +#define REG_NORMAL_SIE_STRING 0xFE80 // 0xFE80~0xFEDF + + +//----------------------------------------------------- +// +// Redifine 8192C register definition for compatibility +// +//----------------------------------------------------- + +// TODO: use these definition when using REG_xxx naming rule. +// NOTE: DO NOT Remove these definition. Use later. + +#define EFUSE_CTRL REG_EFUSE_CTRL // E-Fuse Control. +#define EFUSE_TEST REG_EFUSE_TEST // E-Fuse Test. +#define MSR (REG_CR + 2) // Media Status register +#define ISR REG_HISR_88E +#define TSFR REG_TSFTR // Timing Sync Function Timer Register. + +#define PBP REG_PBP + +// Redifine MACID register, to compatible prior ICs. +#define IDR0 REG_MACID // MAC ID Register, Offset 0x0050-0x0053 +#define IDR4 (REG_MACID + 4) // MAC ID Register, Offset 0x0054-0x0055 + + +// +// 9. Security Control Registers (Offset: ) +// +#define RWCAM REG_CAMCMD //IN 8190 Data Sheet is called CAMcmd +#define WCAMI REG_CAMWRITE // Software write CAM input content +#define RCAMO REG_CAMREAD // Software read/write CAM config +#define CAMDBG REG_CAMDBG +#define SECR REG_SECCFG //Security Configuration Register + +// Unused register +#define UnusedRegister 0x1BF +#define DCAM UnusedRegister +#define PSR UnusedRegister +#define BBAddr UnusedRegister +#define PhyDataR UnusedRegister + +// Min Spacing related settings. +#define MAX_MSS_DENSITY_2T 0x13 +#define MAX_MSS_DENSITY_1T 0x0A + +//---------------------------------------------------------------------------- +// 8192C Cmd9346CR bits (Offset 0xA, 16bit) +//---------------------------------------------------------------------------- +#define CmdEEPROM_En BIT5 // EEPROM enable when set 1 +#define CmdEERPOMSEL BIT4 // System EEPROM select, 0: boot from E-FUSE, 1: The EEPROM used is 9346 +#define Cmd9346CR_9356SEL BIT4 + +//---------------------------------------------------------------------------- +// 8192C GPIO MUX Configuration Register (offset 0x40, 4 byte) +//---------------------------------------------------------------------------- +#define GPIOSEL_GPIO 0 +#define GPIOSEL_ENBT BIT5 + +//---------------------------------------------------------------------------- +// 8192C GPIO PIN Control Register (offset 0x44, 4 byte) +//---------------------------------------------------------------------------- +#define GPIO_IN REG_GPIO_PIN_CTRL // GPIO pins input value +#define GPIO_OUT (REG_GPIO_PIN_CTRL+1) // GPIO pins output value +#define GPIO_IO_SEL (REG_GPIO_PIN_CTRL+2) // GPIO pins output enable when a bit is set to "1"; otherwise, input is configured. +#define GPIO_MOD (REG_GPIO_PIN_CTRL+3) + +//---------------------------------------------------------------------------- +// 8723/8188E Host System Interrupt Mask Register (offset 0x58, 32 byte) +//---------------------------------------------------------------------------- +#define HSIMR_GPIO12_0_INT_EN BIT0 +#define HSIMR_SPS_OCP_INT_EN BIT5 +#define HSIMR_RON_INT_EN BIT6 +#define HSIMR_PDN_INT_EN BIT7 +#define HSIMR_GPIO9_INT_EN BIT25 + + +//---------------------------------------------------------------------------- +// 8723/8188E Host System Interrupt Status Register (offset 0x5C, 32 byte) +//---------------------------------------------------------------------------- +#define HSISR_GPIO12_0_INT BIT0 +#define HSISR_SPS_OCP_INT BIT5 +#define HSISR_RON_INT_EN BIT6 +#define HSISR_PDNINT BIT7 +#define HSISR_GPIO9_INT BIT25 + +//---------------------------------------------------------------------------- +// 8192C (MSR) Media Status Register (Offset 0x4C, 8 bits) +//---------------------------------------------------------------------------- +/* +Network Type +00: No link +01: Link in ad hoc network +10: Link in infrastructure network +11: AP mode +Default: 00b. +*/ +#define MSR_NOLINK 0x00 +#define MSR_ADHOC 0x01 +#define MSR_INFRA 0x02 +#define MSR_AP 0x03 + +//---------------------------------------------------------------------------- +// 88EU (MSR) Media Status Register (Offset 0x4C, 8 bits) +//---------------------------------------------------------------------------- +#define USB_INTR_CONTENT_C2H_OFFSET 0 +#define USB_INTR_CONTENT_CPWM1_OFFSET 16 +#define USB_INTR_CONTENT_CPWM2_OFFSET 20 +#define USB_INTR_CONTENT_HISR_OFFSET 48 +#define USB_INTR_CONTENT_HISRE_OFFSET 52 + + +//---------------------------------------------------------------------------- +// 88E Driver Initialization Offload REG_FDHM0(Offset 0x88, 8 bits) +//---------------------------------------------------------------------------- +//IOL config for REG_FDHM0(Reg0x88) +#define CMD_INIT_LLT BIT0 +#define CMD_READ_EFUSE_MAP BIT1 +#define CMD_EFUSE_PATCH BIT2 +#define CMD_IOCONFIG BIT3 +#define CMD_INIT_LLT_ERR BIT4 +#define CMD_READ_EFUSE_MAP_ERR BIT5 +#define CMD_EFUSE_PATCH_ERR BIT6 +#define CMD_IOCONFIG_ERR BIT7 + +// +// 6. Adaptive Control Registers (Offset: 0x0160 - 0x01CF) +// +//---------------------------------------------------------------------------- +// 8192C Response Rate Set Register (offset 0x181, 24bits) +//---------------------------------------------------------------------------- +#define RRSR_1M BIT0 +#define RRSR_2M BIT1 +#define RRSR_5_5M BIT2 +#define RRSR_11M BIT3 +#define RRSR_6M BIT4 +#define RRSR_9M BIT5 +#define RRSR_12M BIT6 +#define RRSR_18M BIT7 +#define RRSR_24M BIT8 +#define RRSR_36M BIT9 +#define RRSR_48M BIT10 +#define RRSR_54M BIT11 +#define RRSR_MCS0 BIT12 +#define RRSR_MCS1 BIT13 +#define RRSR_MCS2 BIT14 +#define RRSR_MCS3 BIT15 +#define RRSR_MCS4 BIT16 +#define RRSR_MCS5 BIT17 +#define RRSR_MCS6 BIT18 +#define RRSR_MCS7 BIT19 + +//---------------------------------------------------------------------------- +// 8192C Response Rate Set Register (offset 0x1BF, 8bits) +//---------------------------------------------------------------------------- +// WOL bit information +#define HAL92C_WOL_PTK_UPDATE_EVENT BIT0 +#define HAL92C_WOL_GTK_UPDATE_EVENT BIT1 + +//---------------------------------------------------------------------------- +// 8192C BW_OPMODE bits (Offset 0x203, 8bit) +//---------------------------------------------------------------------------- +#define BW_OPMODE_20MHZ BIT2 +#define BW_OPMODE_5G BIT1 + + +//---------------------------------------------------------------------------- +// 8192C CAM Config Setting (offset 0x250, 1 byte) +//---------------------------------------------------------------------------- +#define CAM_VALID BIT15 +#define CAM_NOTVALID 0x0000 +#define CAM_USEDK BIT5 + +#define CAM_CONTENT_COUNT 8 + +#define CAM_NONE 0x0 +#define CAM_WEP40 0x01 +#define CAM_TKIP 0x02 +#define CAM_AES 0x04 +#define CAM_WEP104 0x05 +#define CAM_SMS4 0x6 + +#define TOTAL_CAM_ENTRY 32 +#define HALF_CAM_ENTRY 16 + +#define CAM_CONFIG_USEDK _TRUE +#define CAM_CONFIG_NO_USEDK _FALSE + +#define CAM_WRITE BIT16 +#define CAM_READ 0x00000000 +#define CAM_POLLINIG BIT31 + +#define SCR_UseDK 0x01 +#define SCR_TxSecEnable 0x02 +#define SCR_RxSecEnable 0x04 + +// +// 10. Power Save Control Registers (Offset: 0x0260 - 0x02DF) +// +#define WOW_PMEN BIT0 // Power management Enable. +#define WOW_WOMEN BIT1 // WoW function on or off. +#define WOW_MAGIC BIT2 // Magic packet +#define WOW_UWF BIT3 // Unicast Wakeup frame. + +// +// 12. Host Interrupt Status Registers (Offset: 0x0300 - 0x030F) +// +//---------------------------------------------------------------------------- +//---------------------------------------------------------------------------- +// 8188 IMR/ISR bits +//---------------------------------------------------------------------------- +#define IMR_DISABLED_88E 0x0 +// IMR DW0(0x0060-0063) Bit 0-31 +#define IMR_TXCCK_88E BIT30 // TXRPT interrupt when CCX bit of the packet is set +#define IMR_PSTIMEOUT_88E BIT29 // Power Save Time Out Interrupt +#define IMR_GTINT4_88E BIT28 // When GTIMER4 expires, this bit is set to 1 +#define IMR_GTINT3_88E BIT27 // When GTIMER3 expires, this bit is set to 1 +#define IMR_TBDER_88E BIT26 // Transmit Beacon0 Error +#define IMR_TBDOK_88E BIT25 // Transmit Beacon0 OK +#define IMR_TSF_BIT32_TOGGLE_88E BIT24 // TSF Timer BIT32 toggle indication interrupt +#define IMR_BCNDMAINT0_88E BIT20 // Beacon DMA Interrupt 0 +#define IMR_BCNDERR0_88E BIT16 // Beacon Queue DMA Error 0 +#define IMR_HSISR_IND_ON_INT_88E BIT15 // HSISR Indicator (HSIMR & HSISR is true, this bit is set to 1) +#define IMR_BCNDMAINT_E_88E BIT14 // Beacon DMA Interrupt Extension for Win7 +#define IMR_ATIMEND_88E BIT12 // CTWidnow End or ATIM Window End +#define IMR_HISR1_IND_INT_88E BIT11 // HISR1 Indicator (HISR1 & HIMR1 is true, this bit is set to 1) +#define IMR_C2HCMD_88E BIT10 // CPU to Host Command INT Status, Write 1 clear +#define IMR_CPWM2_88E BIT9 // CPU power Mode exchange INT Status, Write 1 clear +#define IMR_CPWM_88E BIT8 // CPU power Mode exchange INT Status, Write 1 clear +#define IMR_HIGHDOK_88E BIT7 // High Queue DMA OK +#define IMR_MGNTDOK_88E BIT6 // Management Queue DMA OK +#define IMR_BKDOK_88E BIT5 // AC_BK DMA OK +#define IMR_BEDOK_88E BIT4 // AC_BE DMA OK +#define IMR_VIDOK_88E BIT3 // AC_VI DMA OK +#define IMR_VODOK_88E BIT2 // AC_VO DMA OK +#define IMR_RDU_88E BIT1 // Rx Descriptor Unavailable +#define IMR_ROK_88E BIT0 // Receive DMA OK + +// IMR DW1(0x00B4-00B7) Bit 0-31 +#define IMR_BCNDMAINT7_88E BIT27 // Beacon DMA Interrupt 7 +#define IMR_BCNDMAINT6_88E BIT26 // Beacon DMA Interrupt 6 +#define IMR_BCNDMAINT5_88E BIT25 // Beacon DMA Interrupt 5 +#define IMR_BCNDMAINT4_88E BIT24 // Beacon DMA Interrupt 4 +#define IMR_BCNDMAINT3_88E BIT23 // Beacon DMA Interrupt 3 +#define IMR_BCNDMAINT2_88E BIT22 // Beacon DMA Interrupt 2 +#define IMR_BCNDMAINT1_88E BIT21 // Beacon DMA Interrupt 1 +#define IMR_BCNDERR7_88E BIT20 // Beacon Queue DMA Error Interrup 7 +#define IMR_BCNDERR6_88E BIT19 // Beacon Queue DMA Error Interrup 6 +#define IMR_BCNDERR5_88E BIT18 // Beacon Queue DMA Error Interrup 5 +#define IMR_BCNDERR4_88E BIT17 // Beacon Queue DMA Error Interrup 4 +#define IMR_BCNDERR3_88E BIT16 // Beacon Queue DMA Error Interrup 3 +#define IMR_BCNDERR2_88E BIT15 // Beacon Queue DMA Error Interrup 2 +#define IMR_BCNDERR1_88E BIT14 // Beacon Queue DMA Error Interrup 1 +#define IMR_ATIMEND_E_88E BIT13 // ATIM Window End Extension for Win7 +#define IMR_TXERR_88E BIT11 // Tx Error Flag Interrupt Status, write 1 clear. +#define IMR_RXERR_88E BIT10 // Rx Error Flag INT Status, Write 1 clear +#define IMR_TXFOVW_88E BIT9 // Transmit FIFO Overflow +#define IMR_RXFOVW_88E BIT8 // Receive FIFO Overflow + +#define HAL_NIC_UNPLUG_ISR 0xFFFFFFFF // The value when the NIC is unplugged for PCI. + + +#ifdef CONFIG_PCI_HCI +//#define IMR_RX_MASK (IMR_ROK_88E|IMR_RDU_88E|IMR_RXFOVW_88E) +#define IMR_TX_MASK (IMR_VODOK_88E|IMR_VIDOK_88E|IMR_BEDOK_88E|IMR_BKDOK_88E|IMR_MGNTDOK_88E|IMR_HIGHDOK_88E|IMR_BCNDERR0_88E) + +#ifdef CONFIG_CONCURRENT_MODE +#define RT_IBSS_INT_MASKS (IMR_BCNDMAINT0_88E | IMR_TBDOK_88E | IMR_TBDER_88E | IMR_BCNDMAINT_E_88E) +#else +#define RT_IBSS_INT_MASKS (IMR_BCNDMAINT0_88E | IMR_TBDOK_88E | IMR_TBDER_88E) +#endif + +#define RT_AC_INT_MASKS (IMR_VIDOK_88E | IMR_VODOK_88E | IMR_BEDOK_88E|IMR_BKDOK_88E) +#define RT_BSS_INT_MASKS (RT_IBSS_INT_MASKS) +#endif + + +// 8192C EFUSE +//---------------------------------------------------------------------------- +#define HWSET_MAX_SIZE 256 +#define HWSET_MAX_SIZE_88E 512 + + + +/*=================================================================== +===================================================================== +Here the register defines are for 92C. When the define is as same with 92C, +we will use the 92C's define for the consistency +So the following defines for 92C is not entire!!!!!! +===================================================================== +=====================================================================*/ +/* +Based on Datasheet V33---090401 +Register Summary +Current IOREG MAP +0x0000h ~ 0x00FFh System Configuration (256 Bytes) +0x0100h ~ 0x01FFh MACTOP General Configuration (256 Bytes) +0x0200h ~ 0x027Fh TXDMA Configuration (128 Bytes) +0x0280h ~ 0x02FFh RXDMA Configuration (128 Bytes) +0x0300h ~ 0x03FFh PCIE EMAC Reserved Region (256 Bytes) +0x0400h ~ 0x04FFh Protocol Configuration (256 Bytes) +0x0500h ~ 0x05FFh EDCA Configuration (256 Bytes) +0x0600h ~ 0x07FFh WMAC Configuration (512 Bytes) +0x2000h ~ 0x3FFFh 8051 FW Download Region (8196 Bytes) +*/ + //---------------------------------------------------------------------------- + // 8192C (TXPAUSE) transmission pause (Offset 0x522, 8 bits) + //---------------------------------------------------------------------------- +// Note: +// The the bits of stoping AC(VO/VI/BE/BK) queue in datasheet RTL8192S/RTL8192C are wrong, +// the correct arragement is VO - Bit0, VI - Bit1, BE - Bit2, and BK - Bit3. +// 8723 and 88E may be not correct either in the eralier version. Confirmed with DD Tim. +// By Bruce, 2011-09-22. +#define StopBecon BIT6 +#define StopHigh BIT5 +#define StopMgt BIT4 +#define StopBK BIT3 +#define StopBE BIT2 +#define StopVI BIT1 +#define StopVO BIT0 + +//---------------------------------------------------------------------------- +// 8192C (RCR) Receive Configuration Register (Offset 0x608, 32 bits) +//---------------------------------------------------------------------------- +#define RCR_APPFCS BIT31 //WMAC append FCS after pauload +#define RCR_APP_MIC BIT30 // +#define RCR_APP_PHYSTS BIT28// +#define RCR_APP_ICV BIT29 // +#define RCR_APP_PHYST_RXFF BIT28 // +#define RCR_APP_BA_SSN BIT27 //Accept BA SSN +#define RCR_ENMBID BIT24 //Enable Multiple BssId. +#define RCR_LSIGEN BIT23 +#define RCR_MFBEN BIT22 +#define RCR_HTC_LOC_CTRL BIT14 //MFC<--HTC=1 MFC-->HTC=0 +#define RCR_AMF BIT13 //Accept management type frame +#define RCR_ACF BIT12 //Accept control type frame +#define RCR_ADF BIT11 //Accept data type frame +#define RCR_AICV BIT9 //Accept ICV error packet +#define RCR_ACRC32 BIT8 //Accept CRC32 error packet +#define RCR_CBSSID_BCN BIT7 //Accept BSSID match packet (Rx beacon, probe rsp) +#define RCR_CBSSID_DATA BIT6 //Accept BSSID match packet (Data) +#define RCR_CBSSID RCR_CBSSID_DATA //Accept BSSID match packet +#define RCR_APWRMGT BIT5 //Accept power management packet +#define RCR_ADD3 BIT4 //Accept address 3 match packet +#define RCR_AB BIT3 //Accept broadcast packet +#define RCR_AM BIT2 //Accept multicast packet +#define RCR_APM BIT1 //Accept physical match packet +#define RCR_AAP BIT0 //Accept all unicast packet +#define RCR_MXDMA_OFFSET 8 +#define RCR_FIFO_OFFSET 13 + +//----------------------------------------------------- +// +// 0xFE00h ~ 0xFE55h USB Configuration +// +//----------------------------------------------------- +#define REG_USB_INFO 0xFE17 +#define REG_USB_SPECIAL_OPTION 0xFE55 +#define REG_USB_DMA_AGG_TO 0xFE5B +#define REG_USB_AGG_TO 0xFE5C +#define REG_USB_AGG_TH 0xFE5D + +#define REG_USB_HRPWM 0xFE58 +#define REG_USB_HCPWM 0xFE57 + +//============================================================================ +// 8192C Regsiter Bit and Content definition +//============================================================================ +//----------------------------------------------------- +// +// 0x0000h ~ 0x00FFh System Configuration +// +//----------------------------------------------------- + +//2 SYS_ISO_CTRL +#define ISO_MD2PP BIT(0) +#define ISO_UA2USB BIT(1) +#define ISO_UD2CORE BIT(2) +#define ISO_PA2PCIE BIT(3) +#define ISO_PD2CORE BIT(4) +#define ISO_IP2MAC BIT(5) +#define ISO_DIOP BIT(6) +#define ISO_DIOE BIT(7) +#define ISO_EB2CORE BIT(8) +#define ISO_DIOR BIT(9) +#define PWC_EV12V BIT(15) + + +//2 SYS_FUNC_EN +#define FEN_BBRSTB BIT(0) +#define FEN_BB_GLB_RSTn BIT(1) +#define FEN_USBA BIT(2) +#define FEN_UPLL BIT(3) +#define FEN_USBD BIT(4) +#define FEN_DIO_PCIE BIT(5) +#define FEN_PCIEA BIT(6) +#define FEN_PPLL BIT(7) +#define FEN_PCIED BIT(8) +#define FEN_DIOE BIT(9) +#define FEN_CPUEN BIT(10) +#define FEN_DCORE BIT(11) +#define FEN_ELDR BIT(12) +#define FEN_DIO_RF BIT(13) +#define FEN_HWPDN BIT(14) +#define FEN_MREGEN BIT(15) + +//2 APS_FSMCO +#define PFM_LDALL BIT(0) +#define PFM_ALDN BIT(1) +#define PFM_LDKP BIT(2) +#define PFM_WOWL BIT(3) +#define EnPDN BIT(4) +#define PDN_PL BIT(5) +#define APFM_ONMAC BIT(8) +#define APFM_OFF BIT(9) +#define APFM_RSM BIT(10) +#define AFSM_HSUS BIT(11) +#define AFSM_PCIE BIT(12) +#define APDM_MAC BIT(13) +#define APDM_HOST BIT(14) +#define APDM_HPDN BIT(15) +#define RDY_MACON BIT(16) +#define SUS_HOST BIT(17) +#define ROP_ALD BIT(20) +#define ROP_PWR BIT(21) +#define ROP_SPS BIT(22) +#define SOP_MRST BIT(25) +#define SOP_FUSE BIT(26) +#define SOP_ABG BIT(27) +#define SOP_AMB BIT(28) +#define SOP_RCK BIT(29) +#define SOP_A8M BIT(30) +#define XOP_BTCK BIT(31) + +//2 SYS_CLKR +#define ANAD16V_EN BIT(0) +#define ANA8M BIT(1) +#define MACSLP BIT(4) +#define LOADER_CLK_EN BIT(5) + + +//2 9346CR + +#define BOOT_FROM_EEPROM BIT(4) +#define EEPROM_EN BIT(5) + + +//2 SPS0_CTRL + + +//2 SPS_OCP_CFG + + +//2 RF_CTRL +#define RF_EN BIT(0) +#define RF_RSTB BIT(1) +#define RF_SDMRSTB BIT(2) + + + +//2 LDOV12D_CTRL +#define LDV12_EN BIT(0) +#define LDV12_SDBY BIT(1) +#define LPLDO_HSM BIT(2) +#define LPLDO_LSM_DIS BIT(3) +#define _LDV12_VADJ(x) (((x) & 0xF) << 4) + + +//2EFUSE_CTRL +#define ALD_EN BIT(18) +#define EF_PD BIT(19) +#define EF_FLAG BIT(31) + +//2 EFUSE_TEST (For RTL8723 partially) +#define EF_TRPT BIT(7) +#define EF_CELL_SEL (BIT(8)|BIT(9)) // 00: Wifi Efuse, 01: BT Efuse0, 10: BT Efuse1, 11: BT Efuse2 +#define LDOE25_EN BIT(31) +#define EFUSE_SEL(x) (((x) & 0x3) << 8) +#define EFUSE_SEL_MASK 0x300 +#define EFUSE_WIFI_SEL_0 0x0 +#define EFUSE_BT_SEL_0 0x1 +#define EFUSE_BT_SEL_1 0x2 +#define EFUSE_BT_SEL_2 0x3 + +#define EFUSE_ACCESS_ON 0x69 // For RTL8723 only. +#define EFUSE_ACCESS_OFF 0x00 // For RTL8723 only. + + +//2 8051FWDL +//2 MCUFWDL +#define MCUFWDL_EN BIT(0) +#define MCUFWDL_RDY BIT(1) +#define FWDL_ChkSum_rpt BIT(2) +#define MACINI_RDY BIT(3) +#define BBINI_RDY BIT(4) +#define RFINI_RDY BIT(5) +#define WINTINI_RDY BIT(6) +#define RAM_DL_SEL BIT(7) // 1:RAM, 0:ROM +#define ROM_DLEN BIT(19) +#define CPRST BIT(23) + + + +//2 REG_SYS_CFG +#define XCLK_VLD BIT(0) +#define ACLK_VLD BIT(1) +#define UCLK_VLD BIT(2) +#define PCLK_VLD BIT(3) +#define PCIRSTB BIT(4) +#define V15_VLD BIT(5) +#define SW_OFFLOAD_EN BIT(7) +#define SIC_IDLE BIT(8) +#define BD_MAC2 BIT(9) +#define BD_MAC1 BIT(10) +#define IC_MACPHY_MODE BIT(11) +#define CHIP_VER (BIT(12)|BIT(13)|BIT(14)|BIT(15)) +#define BT_FUNC BIT(16) +#define VENDOR_ID BIT(19) +#define PAD_HWPD_IDN BIT(22) +#define TRP_VAUX_EN BIT(23) // RTL ID +#define TRP_BT_EN BIT(24) +#define BD_PKG_SEL BIT(25) +#define BD_HCI_SEL BIT(26) +#define TYPE_ID BIT(27) + +#define CHIP_VER_RTL_MASK 0xF000 //Bit 12 ~ 15 +#define CHIP_VER_RTL_SHIFT 12 + + +//2REG_GPIO_OUTSTS (For RTL8723 only) +#define EFS_HCI_SEL (BIT(0)|BIT(1)) +#define PAD_HCI_SEL (BIT(2)|BIT(3)) +#define HCI_SEL (BIT(4)|BIT(5)) +#define PKG_SEL_HCI BIT(6) +#define FEN_GPS BIT(7) +#define FEN_BT BIT(8) +#define FEN_WL BIT(9) +#define FEN_PCI BIT(10) +#define FEN_USB BIT(11) +#define BTRF_HWPDN_N BIT(12) +#define WLRF_HWPDN_N BIT(13) +#define PDN_BT_N BIT(14) +#define PDN_GPS_N BIT(15) +#define BT_CTL_HWPDN BIT(16) +#define GPS_CTL_HWPDN BIT(17) +#define PPHY_SUSB BIT(20) +#define UPHY_SUSB BIT(21) +#define PCI_SUSEN BIT(22) +#define USB_SUSEN BIT(23) +#define RF_RL_ID (BIT(31)|BIT(30)|BIT(29)|BIT(28)) + + +//2SYS_CFG +#define RTL_ID BIT(23) // TestChip ID, 1:Test(RLE); 0:MP(RL) + +//----------------------------------------------------- +// +// 0x0100h ~ 0x01FFh MACTOP General Configuration +// +//----------------------------------------------------- + + +//2 Function Enable Registers +//2 CR + + + +#define HCI_TXDMA_EN BIT(0) +#define HCI_RXDMA_EN BIT(1) +#define TXDMA_EN BIT(2) +#define RXDMA_EN BIT(3) +#define PROTOCOL_EN BIT(4) +#define SCHEDULE_EN BIT(5) +#define MACTXEN BIT(6) +#define MACRXEN BIT(7) +#define ENSWBCN BIT(8) +#define ENSEC BIT(9) +#define CALTMR_EN BIT(10) // 32k CAL TMR enable + +// Network type +#define _NETTYPE(x) (((x) & 0x3) << 16) +#define MASK_NETTYPE 0x30000 +#define NT_NO_LINK 0x0 +#define NT_LINK_AD_HOC 0x1 +#define NT_LINK_AP 0x2 +#define NT_AS_AP 0x3 + + + +//2 PBP - Page Size Register +#define GET_RX_PAGE_SIZE(value) ((value) & 0xF) +#define GET_TX_PAGE_SIZE(value) (((value) & 0xF0) >> 4) +#define _PSRX_MASK 0xF +#define _PSTX_MASK 0xF0 +#define _PSRX(x) (x) +#define _PSTX(x) ((x) << 4) + +#define PBP_64 0x0 +#define PBP_128 0x1 +#define PBP_256 0x2 +#define PBP_512 0x3 +#define PBP_1024 0x4 + + +//2 TX/RXDMA +#define RXDMA_ARBBW_EN BIT(0) +#define RXSHFT_EN BIT(1) +#define RXDMA_AGG_EN BIT(2) +#define QS_VO_QUEUE BIT(8) +#define QS_VI_QUEUE BIT(9) +#define QS_BE_QUEUE BIT(10) +#define QS_BK_QUEUE BIT(11) +#define QS_MANAGER_QUEUE BIT(12) +#define QS_HIGH_QUEUE BIT(13) + +#define HQSEL_VOQ BIT(0) +#define HQSEL_VIQ BIT(1) +#define HQSEL_BEQ BIT(2) +#define HQSEL_BKQ BIT(3) +#define HQSEL_MGTQ BIT(4) +#define HQSEL_HIQ BIT(5) + +// For normal driver, 0x10C +#define _TXDMA_HIQ_MAP(x) (((x)&0x3) << 14) +#define _TXDMA_MGQ_MAP(x) (((x)&0x3) << 12) +#define _TXDMA_BKQ_MAP(x) (((x)&0x3) << 10) +#define _TXDMA_BEQ_MAP(x) (((x)&0x3) << 8 ) +#define _TXDMA_VIQ_MAP(x) (((x)&0x3) << 6 ) +#define _TXDMA_VOQ_MAP(x) (((x)&0x3) << 4 ) + +#define QUEUE_LOW 1 +#define QUEUE_NORMAL 2 +#define QUEUE_HIGH 3 + + + +//2 TRXFF_BNDY + + +//2 LLT_INIT +#define _LLT_NO_ACTIVE 0x0 +#define _LLT_WRITE_ACCESS 0x1 +#define _LLT_READ_ACCESS 0x2 + +#define _LLT_INIT_DATA(x) ((x) & 0xFF) +#define _LLT_INIT_ADDR(x) (((x) & 0xFF) << 8) +#define _LLT_OP(x) (((x) & 0x3) << 30) +#define _LLT_OP_VALUE(x) (((x) >> 30) & 0x3) + + +//----------------------------------------------------- +// +// 0x0200h ~ 0x027Fh TXDMA Configuration +// +//----------------------------------------------------- +//2RQPN +#define _HPQ(x) ((x) & 0xFF) +#define _LPQ(x) (((x) & 0xFF) << 8) +#define _PUBQ(x) (((x) & 0xFF) << 16) +#define _NPQ(x) ((x) & 0xFF) // NOTE: in RQPN_NPQ register + + +#define HPQ_PUBLIC_DIS BIT(24) +#define LPQ_PUBLIC_DIS BIT(25) +#define LD_RQPN BIT(31) + + +//2TDECTRL +#define BCN_VALID BIT(16) +#define BCN_HEAD(x) (((x) & 0xFF) << 8) +#define BCN_HEAD_MASK 0xFF00 + + +//2 TDECTL +#define BLK_DESC_NUM_SHIFT 4 +#define BLK_DESC_NUM_MASK 0xF + + +//2 TXDMA_OFFSET_CHK +#define DROP_DATA_EN BIT(9) + + + + +//----------------------------------------------------- +// +// 0x0280h ~ 0x028Bh RX DMA Configuration +// +//----------------------------------------------------- + +// REG_RXDMA_CONTROL, 0x0286h +// Write only. When this bit is set, RXDMA will decrease RX PKT counter by one. Before +// this bit is polled, FW shall update RXFF_RD_PTR first. This register is write pulse and auto clear. +//#define RXPKT_RELEASE_POLL BIT(0) +// Read only. When RXMA finishes on-going DMA operation, RXMDA will report idle state in +// this bit. FW can start releasing packets after RXDMA entering idle mode. +//#define RXDMA_IDLE BIT(1) +// When this bit is set, RXDMA will enter this mode after on-going RXDMA packet to host +// completed, and stop DMA packet to host. RXDMA will then report Default: 0; +//#define RW_RELEASE_EN BIT(2) + +//2 REG_RXPKT_NUM, 0x0284 +#define RXPKT_RELEASE_POLL BIT(16) +#define RXDMA_IDLE BIT(17) +#define RW_RELEASE_EN BIT(18) + +//----------------------------------------------------- +// +// 0x0400h ~ 0x047Fh Protocol Configuration +// +//----------------------------------------------------- +//2 FWHW_TXQ_CTRL +#define EN_AMPDU_RTY_NEW BIT(7) + + +//2 SPEC SIFS +#define _SPEC_SIFS_CCK(x) ((x) & 0xFF) +#define _SPEC_SIFS_OFDM(x) (((x) & 0xFF) << 8) + +//2 RL +#define RETRY_LIMIT_SHORT_SHIFT 8 +#define RETRY_LIMIT_LONG_SHIFT 0 + + + + + +//----------------------------------------------------- +// +// 0x0500h ~ 0x05FFh EDCA Configuration +// +//----------------------------------------------------- + + + +//2 EDCA setting +#define AC_PARAM_TXOP_LIMIT_OFFSET 16 +#define AC_PARAM_ECW_MAX_OFFSET 12 +#define AC_PARAM_ECW_MIN_OFFSET 8 +#define AC_PARAM_AIFS_OFFSET 0 + + + +#define _LRL(x) ((x) & 0x3F) +#define _SRL(x) (((x) & 0x3F) << 8) + + +//2 BCN_CTRL +#define EN_MBSSID BIT(1) +#define EN_TXBCN_RPT BIT(2) +#define EN_BCN_FUNCTION BIT(3) +#define DIS_TSF_UPDATE BIT(3) + +// The same function but different bit field. +#define DIS_TSF_UDT0_NORMAL_CHIP BIT(4) +#define DIS_TSF_UDT0_TEST_CHIP BIT(5) +#define STOP_BCNQ BIT(6) + + +//2 ACMHWCTRL +#define AcmHw_HwEn BIT(0) +#define AcmHw_BeqEn BIT(1) +#define AcmHw_ViqEn BIT(2) +#define AcmHw_VoqEn BIT(3) +#define AcmHw_BeqStatus BIT(4) +#define AcmHw_ViqStatus BIT(5) +#define AcmHw_VoqStatus BIT(6) + + + +//----------------------------------------------------- +// +// 0x0600h ~ 0x07FFh WMAC Configuration +// +//----------------------------------------------------- +//2APSD_CTRL +#define APSDOFF BIT(6) +#define APSDOFF_STATUS BIT(7) + + +#define RATE_BITMAP_ALL 0xFFFFF + +// Only use CCK 1M rate for ACK +#define RATE_RRSR_CCK_ONLY_1M 0xFFFF1 + +//2 TCR +#define TSFRST BIT(0) +#define DIS_GCLK BIT(1) +#define PAD_SEL BIT(2) +#define PWR_ST BIT(6) +#define PWRBIT_OW_EN BIT(7) +#define ACRC BIT(8) +#define CFENDFORM BIT(9) +#define ICV BIT(10) + + + +//2 RCR +#define AAP BIT(0) +#define APM BIT(1) +#define AM BIT(2) +#define AB BIT(3) +#define ADD3 BIT(4) +#define APWRMGT BIT(5) +#define CBSSID BIT(6) +#define CBSSID_DATA BIT(6) +#define CBSSID_BCN BIT(7) +#define ACRC32 BIT(8) +#define AICV BIT(9) +#define ADF BIT(11) +#define ACF BIT(12) +#define AMF BIT(13) +#define HTC_LOC_CTRL BIT(14) +#define UC_DATA_EN BIT(16) +#define BM_DATA_EN BIT(17) +#define MFBEN BIT(22) +#define LSIGEN BIT(23) +#define EnMBID BIT(24) +#define APP_BASSN BIT(27) +#define APP_PHYSTS BIT(28) +#define APP_ICV BIT(29) +#define APP_MIC BIT(30) +#define APP_FCS BIT(31) + + +//2 SECCFG +#define SCR_TxUseDK BIT(0) //Force Tx Use Default Key +#define SCR_RxUseDK BIT(1) //Force Rx Use Default Key +#define SCR_TxEncEnable BIT(2) //Enable Tx Encryption +#define SCR_RxDecEnable BIT(3) //Enable Rx Decryption +#define SCR_SKByA2 BIT(4) //Search kEY BY A2 +#define SCR_NoSKMC BIT(5) //No Key Search Multicast +#define SCR_TXBCUSEDK BIT(6) // Force Tx Broadcast packets Use Default Key +#define SCR_RXBCUSEDK BIT(7) // Force Rx Broadcast packets Use Default Key + + +//----------------------------------------------------- +// +// RTL8188E SDIO Configuration +// +//----------------------------------------------------- + +// I/O bus domain address mapping +#define SDIO_LOCAL_BASE 0x10250000 +#define WLAN_IOREG_BASE 0x10260000 +#define FIRMWARE_FIFO_BASE 0x10270000 +#define TX_HIQ_BASE 0x10310000 +#define TX_MIQ_BASE 0x10320000 +#define TX_LOQ_BASE 0x10330000 +#define RX_RX0FF_BASE 0x10340000 + +// SDIO host local register space mapping. +#define SDIO_LOCAL_MSK 0x0FFF +#define WLAN_IOREG_MSK 0x7FFF +#define WLAN_FIFO_MSK 0x1FFF // Aggregation Length[12:0] +#define WLAN_RX0FF_MSK 0x0003 + +#define SDIO_WITHOUT_REF_DEVICE_ID 0 // Without reference to the SDIO Device ID +#define SDIO_LOCAL_DEVICE_ID 0 // 0b[16], 000b[15:13] +#define WLAN_TX_HIQ_DEVICE_ID 4 // 0b[16], 100b[15:13] +#define WLAN_TX_MIQ_DEVICE_ID 5 // 0b[16], 101b[15:13] +#define WLAN_TX_LOQ_DEVICE_ID 6 // 0b[16], 110b[15:13] +#define WLAN_RX0FF_DEVICE_ID 7 // 0b[16], 111b[15:13] +#define WLAN_IOREG_DEVICE_ID 8 // 1b[16] + +// SDIO Tx Free Page Index +#define HI_QUEUE_IDX 0 +#define MID_QUEUE_IDX 1 +#define LOW_QUEUE_IDX 2 +#define PUBLIC_QUEUE_IDX 3 + +#define SDIO_MAX_TX_QUEUE 3 // HIQ, MIQ and LOQ +#define SDIO_MAX_RX_QUEUE 1 + +#define SDIO_REG_TX_CTRL 0x0000 // SDIO Tx Control +#define SDIO_REG_HIMR 0x0014 // SDIO Host Interrupt Mask +#define SDIO_REG_HISR 0x0018 // SDIO Host Interrupt Service Routine +#define SDIO_REG_HCPWM 0x0019 // HCI Current Power Mode +#define SDIO_REG_RX0_REQ_LEN 0x001C // RXDMA Request Length +#define SDIO_REG_FREE_TXPG 0x0020 // Free Tx Buffer Page +#define SDIO_REG_HCPWM1 0x0024 // HCI Current Power Mode 1 +#define SDIO_REG_HCPWM2 0x0026 // HCI Current Power Mode 2 +#define SDIO_REG_HTSFR_INFO 0x0030 // HTSF Informaion +#define SDIO_REG_HRPWM1 0x0080 // HCI Request Power Mode 1 +#define SDIO_REG_HRPWM2 0x0082 // HCI Request Power Mode 2 +#define SDIO_REG_HPS_CLKR 0x0084 // HCI Power Save Clock +#define SDIO_REG_HSUS_CTRL 0x0086 // SDIO HCI Suspend Control +#define SDIO_REG_HIMR_ON 0x0090 // SDIO Host Extension Interrupt Mask Always +#define SDIO_REG_HISR_ON 0x0091 // SDIO Host Extension Interrupt Status Always + +#define SDIO_HIMR_DISABLED 0 + +// RTL8188E SDIO Host Interrupt Mask Register +#define SDIO_HIMR_RX_REQUEST_MSK BIT0 +#define SDIO_HIMR_AVAL_MSK BIT1 +#define SDIO_HIMR_TXERR_MSK BIT2 +#define SDIO_HIMR_RXERR_MSK BIT3 +#define SDIO_HIMR_TXFOVW_MSK BIT4 +#define SDIO_HIMR_RXFOVW_MSK BIT5 +#define SDIO_HIMR_TXBCNOK_MSK BIT6 +#define SDIO_HIMR_TXBCNERR_MSK BIT7 +#define SDIO_HIMR_BCNERLY_INT_MSK BIT16 +#define SDIO_HIMR_C2HCMD_MSK BIT17 +#define SDIO_HIMR_CPWM1_MSK BIT18 +#define SDIO_HIMR_CPWM2_MSK BIT19 +#define SDIO_HIMR_HSISR_IND_MSK BIT20 +#define SDIO_HIMR_GTINT3_IND_MSK BIT21 +#define SDIO_HIMR_GTINT4_IND_MSK BIT22 +#define SDIO_HIMR_PSTIMEOUT_MSK BIT23 +#define SDIO_HIMR_OCPINT_MSK BIT24 +#define SDIO_HIMR_ATIMEND_MSK BIT25 +#define SDIO_HIMR_ATIMEND_E_MSK BIT26 +#define SDIO_HIMR_CTWEND_MSK BIT27 + +//RTL8188E SDIO Specific +#define SDIO_HIMR_MCU_ERR_MSK BIT28 +#define SDIO_HIMR_TSF_BIT32_TOGGLE_MSK BIT29 + +// SDIO Host Interrupt Service Routine +#define SDIO_HISR_RX_REQUEST BIT0 +#define SDIO_HISR_AVAL BIT1 +#define SDIO_HISR_TXERR BIT2 +#define SDIO_HISR_RXERR BIT3 +#define SDIO_HISR_TXFOVW BIT4 +#define SDIO_HISR_RXFOVW BIT5 +#define SDIO_HISR_TXBCNOK BIT6 +#define SDIO_HISR_TXBCNERR BIT7 +#define SDIO_HISR_BCNERLY_INT BIT16 +#define SDIO_HISR_C2HCMD BIT17 +#define SDIO_HISR_CPWM1 BIT18 +#define SDIO_HISR_CPWM2 BIT19 +#define SDIO_HISR_HSISR_IND BIT20 +#define SDIO_HISR_GTINT3_IND BIT21 +#define SDIO_HISR_GTINT4_IND BIT22 +#define SDIO_HISR_PSTIMEOUT BIT23 +#define SDIO_HISR_OCPINT BIT24 +#define SDIO_HISR_ATIMEND BIT25 +#define SDIO_HISR_ATIMEND_E BIT26 +#define SDIO_HISR_CTWEND BIT27 + +//RTL8188E SDIO Specific +#define SDIO_HISR_MCU_ERR BIT28 +#define SDIO_HISR_TSF_BIT32_TOGGLE BIT29 + +#define MASK_SDIO_HISR_CLEAR (SDIO_HISR_TXERR |\ + SDIO_HISR_RXERR |\ + SDIO_HISR_TXFOVW |\ + SDIO_HISR_RXFOVW |\ + SDIO_HISR_TXBCNOK |\ + SDIO_HISR_TXBCNERR |\ + SDIO_HISR_C2HCMD |\ + SDIO_HISR_CPWM1 |\ + SDIO_HISR_CPWM2 |\ + SDIO_HISR_HSISR_IND |\ + SDIO_HISR_GTINT3_IND |\ + SDIO_HISR_GTINT4_IND |\ + SDIO_HISR_PSTIMEOUT |\ + SDIO_HISR_OCPINT) + +// SDIO HCI Suspend Control Register +#define HCI_RESUME_PWR_RDY BIT1 +#define HCI_SUS_CTRL BIT0 + +// SDIO Tx FIFO related +#define SDIO_TX_FREE_PG_QUEUE 4 // The number of Tx FIFO free page +#define SDIO_TX_FIFO_PAGE_SZ 128 + +/* move to rtl8188e_xmit.h +#if DEV_BUS_TYPE == RT_SDIO_INTERFACE + #define MAX_TX_AGG_PACKET_NUMBER 0x8 +#else + #define MAX_TX_AGG_PACKET_NUMBER 0xFF +#endif +*/ + +// vivi added for new cam search flow, 20091028 +//#define SCR_TxUseBroadcastDK BIT6 // Force Tx Use Broadcast Default Key +//#define SCR_RxUseBroadcastDK BIT7 // Force Rx Use Broadcast Default Key + +//----------------------------------------------------- +// +// 0xFE00h ~ 0xFE55h USB Configuration +// +//----------------------------------------------------- + +//2 USB Information (0xFE17) +#define USB_IS_HIGH_SPEED 0 +#define USB_IS_FULL_SPEED 1 +#define USB_SPEED_MASK BIT(5) + +#define USB_NORMAL_SIE_EP_MASK 0xF +#define USB_NORMAL_SIE_EP_SHIFT 4 + + +//2 Special Option +#define USB_AGG_EN BIT(3) + +// 0; Use interrupt endpoint to upload interrupt pkt +// 1; Use bulk endpoint to upload interrupt pkt, +#define INT_BULK_SEL BIT(4) + + + +//2REG_C2HEVT_CLEAR +#define C2H_EVT_HOST_CLOSE 0x00 // Set by driver and notify FW that the driver has read the C2H command message +#define C2H_EVT_FW_CLOSE 0xFF // Set by FW indicating that FW had set the C2H command message and it's not yet read by driver. + + +//2REG_MULTI_FUNC_CTRL(For RTL8723 Only) +#define WL_HWPDN_EN BIT0 // Enable GPIO[9] as WiFi HW PDn source +#define WL_HWPDN_SL BIT1 // WiFi HW PDn polarity control +#define WL_FUNC_EN BIT2 // WiFi function enable +#define WL_HWROF_EN BIT3 // Enable GPIO[9] as WiFi RF HW PDn source +#define BT_HWPDN_EN BIT16 // Enable GPIO[11] as BT HW PDn source +#define BT_HWPDN_SL BIT17 // BT HW PDn polarity control +#define BT_FUNC_EN BIT18 // BT function enable +#define BT_HWROF_EN BIT19 // Enable GPIO[11] as BT/GPS RF HW PDn source +#define GPS_HWPDN_EN BIT20 // Enable GPIO[10] as GPS HW PDn source +#define GPS_HWPDN_SL BIT21 // GPS HW PDn polarity control +#define GPS_FUNC_EN BIT22 // GPS function enable + + +//3 REG_LIFECTRL_CTRL +#define HAL92C_EN_PKT_LIFE_TIME_BK BIT3 +#define HAL92C_EN_PKT_LIFE_TIME_BE BIT2 +#define HAL92C_EN_PKT_LIFE_TIME_VI BIT1 +#define HAL92C_EN_PKT_LIFE_TIME_VO BIT0 + +#define HAL92C_MSDU_LIFE_TIME_UNIT 128 // in us, said by Tim. + +//======================================================== +// General definitions +//======================================================== +//#if (HAL_8195A_USB == 1) +//#define LAST_ENTRY_OF_TX_PKT_BUFFER 255 +//#else +#define LAST_ENTRY_OF_TX_PKT_BUFFER 176 // 22k 22528 bytes +//#endif + +#define POLLING_LLT_THRESHOLD 20 +//#if RTL8188E_FOR_MP_TEST == 1 +//#define POLLING_READY_TIMEOUT_COUNT 3000 +//#else +#define POLLING_READY_TIMEOUT_COUNT 1000 +//#endif +// GPIO BIT +#define HAL_8188E_HW_GPIO_WPS_BIT BIT7 + +#if 0//(RTL8188E_SUPPORT == 1) +////////////////////////////////ONLY for 88EE///////////////////////////////// +// +// Host Interrupt Status Registers (Offset: 0x00B4-00B7, 0x00BC-00BF) +// Host Interrupt Mask Registers (Offset: 0x00B0-00B3, 0x00B8-00BB) +// +//---------------------------------------------------------------------------- +// 8188 IMR/ISR bits +//---------------------------------------------------------------------------- +#define IMR_DISABLED_88E 0x0 +// IMR DW0(0x00B0-00B3) Bit 0-31 +#define IMR_TXCCK_88E BIT30 // TXRPT interrupt when CCX bit of the packet is set +#define IMR_PSTIMEOUT_88E BIT29 // Power Save Time Out Interrupt +#define IMR_GTINT4_88E BIT28 // When GTIMER4 expires, this bit is set to 1 +#define IMR_GTINT3_88E BIT27 // When GTIMER3 expires, this bit is set to 1 +#define IMR_TBDER_88E BIT26 // Transmit Beacon0 Error +#define IMR_TBDOK_88E BIT25 // Transmit Beacon0 OK +#define IMR_TSF_BIT32_TOGGLE_88E BIT24 // TSF Timer BIT32 toggle indication interrupt +#define IMR_BcnInt_88E BIT20 // Beacon DMA Interrupt 0 +#define IMR_BDOK_88E BIT16 // Beacon Queue DMA OK0 +#define IMR_HSISR_IND_ON_INT_88E BIT15 // HSISR Indicator (HSIMR & HSISR is true, this bit is set to 1) +#define IMR_BCNDMAINT_E_88E BIT14 // Beacon DMA Interrupt Extension for Win7 +#define IMR_ATIMEND_88E BIT12 // CTWidnow End or ATIM Window End +#define IMR_HISR1_IND_INT_88E BIT11 // HISR1 Indicator (HISR1 & HIMR1 is true, this bit is set to 1) +#define IMR_C2HCMD_88E BIT10 // CPU to Host Command INT Status, Write 1 clear +#define IMR_CPWM2_88E BIT9 // CPU power Mode exchange INT Status, Write 1 clear +#define IMR_CPWM_88E BIT8 // CPU power Mode exchange INT Status, Write 1 clear +#define IMR_HIGHDOK_88E BIT7 // High Queue DMA OK +#define IMR_MGNTDOK_88E BIT6 // Management Queue DMA OK +#define IMR_BKDOK_88E BIT5 // AC_BK DMA OK +#define IMR_BEDOK_88E BIT4 // AC_BE DMA OK +#define IMR_VIDOK_88E BIT3 // AC_VI DMA OK +#define IMR_VODOK_88E BIT2 // AC_VO DMA OK +#define IMR_RDU_88E BIT1 // Rx Descriptor Unavailable +#define IMR_ROK_88E BIT0 // Receive DMA OK + +// IMR DW1(0x00B8-00BB) Bit 0-31 +#define IMR_BCNDMAINT7_88E BIT27 // Beacon DMA Interrupt 7 +#define IMR_BCNDMAINT6_88E BIT26 // Beacon DMA Interrupt 6 +#define IMR_BCNDMAINT5_88E BIT25 // Beacon DMA Interrupt 5 +#define IMR_BCNDMAINT4_88E BIT24 // Beacon DMA Interrupt 4 +#define IMR_BCNDMAINT3_88E BIT23 // Beacon DMA Interrupt 3 +#define IMR_BCNDMAINT2_88E BIT22 // Beacon DMA Interrupt 2 +#define IMR_BCNDMAINT1_88E BIT21 // Beacon DMA Interrupt 1 +#define IMR_BCNDOK7_88E BIT20 // Beacon Queue DMA OK Interrup 7 +#define IMR_BCNDOK6_88E BIT19 // Beacon Queue DMA OK Interrup 6 +#define IMR_BCNDOK5_88E BIT18 // Beacon Queue DMA OK Interrup 5 +#define IMR_BCNDOK4_88E BIT17 // Beacon Queue DMA OK Interrup 4 +#define IMR_BCNDOK3_88E BIT16 // Beacon Queue DMA OK Interrup 3 +#define IMR_BCNDOK2_88E BIT15 // Beacon Queue DMA OK Interrup 2 +#define IMR_BCNDOK1_88E BIT14 // Beacon Queue DMA OK Interrup 1 +#define IMR_ATIMEND_E_88E BIT13 // ATIM Window End Extension for Win7 +#define IMR_TXERR_88E BIT11 // Tx Error Flag Interrupt Status, write 1 clear. +#define IMR_RXERR_88E BIT10 // Rx Error Flag INT Status, Write 1 clear +#define IMR_TXFOVW_88E BIT9 // Transmit FIFO Overflow +#define IMR_RXFOVW_88E BIT8 // Receive FIFO Overflow + + + +////////////////////////////////ONLY for 88EE///////////////////////////////// +#endif //(RTL8188E_SUPPORT == 1) + + +//---------------------------------------------------------------------------- +// 8192C EEPROM/EFUSE share register definition. +//---------------------------------------------------------------------------- + +//==================================================== +// EEPROM/Efuse PG Offset for 88EE/88EU/88ES +//==================================================== +#define EEPROM_TX_PWR_INX_88E 0x10 + +#define EEPROM_ChannelPlan_88E 0xB8 +#define EEPROM_XTAL_88E 0xB9 +#define EEPROM_THERMAL_METER_88E 0xBA +#define EEPROM_IQK_LCK_88E 0xBB + +#define EEPROM_RF_BOARD_OPTION_88E 0xC1 +#define EEPROM_RF_FEATURE_OPTION_88E 0xC2 +#define EEPROM_RF_BT_SETTING_88E 0xC3 +#define EEPROM_VERSION_88E 0xC4 +#define EEPROM_CUSTOMERID_88E 0xC5 +#define EEPROM_RF_ANTENNA_OPT_88E 0xC9 + +#ifdef CONFIG_RF_GAIN_OFFSET +#define EEPROM_RF_GAIN_OFFSET_88E 0xC1 +#define EEPROM_RF_GAIN_VAL_88E 0xF6 //Physical address which is the BB gain offset value +#endif //CONFIG_RF_GAIN_OFFSET + +// RTL88EE +#define EEPROM_MAC_ADDR_88EE 0xD0 +#define EEPROM_VID_88EE 0xD6 +#define EEPROM_DID_88EE 0xD8 +#define EEPROM_SVID_88EE 0xDA +#define EEPROM_SMID_88EE 0xDC + +//RTL88EU +#define EEPROM_MAC_ADDR_88EU 0xD7 +#define EEPROM_VID_88EU 0xD0 +#define EEPROM_PID_88EU 0xD2 +#define EEPROM_USB_OPTIONAL_FUNCTION0 0xD4 + +// RTL88ES +#define EEPROM_MAC_ADDR_88ES 0x11A + + + + +//==================================================== +// EEPROM/Efuse Value Type +//==================================================== +#define EETYPE_TX_PWR 0x0 + +// +// Default Value for EEPROM or EFUSE!!! +// +#define EEPROM_Default_TSSI 0x0 +#define EEPROM_Default_TxPowerDiff 0x0 +#define EEPROM_Default_CrystalCap 0x5 +#define EEPROM_Default_BoardType 0x02 // Default: 2X2, RTL8192CE(QFPN68) +#define EEPROM_Default_TxPower 0x1010 +#define EEPROM_Default_HT2T_TxPwr 0x10 + +#define EEPROM_Default_LegacyHTTxPowerDiff 0x3 +#define EEPROM_Default_ThermalMeter 0x12 + +#define EEPROM_Default_AntTxPowerDiff 0x0 +#define EEPROM_Default_TxPwDiff_CrystalCap 0x5 +#if (RTL8188ES_SUPPORT==1) //for SDIO +#define EEPROM_Default_TxPowerLevel 0x25 +#else //for USB/PCIE +#define EEPROM_Default_TxPowerLevel 0x2A +#endif + +#define EEPROM_Default_HT40_2SDiff 0x0 +#define EEPROM_Default_HT20_Diff 2 // HT20<->40 default Tx Power Index Difference +#define EEPROM_Default_LegacyHTTxPowerDiff 0x3 +#define EEPROM_Default_HT40_PwrMaxOffset 0 +#define EEPROM_Default_HT20_PwrMaxOffset 0 + +#define EEPROM_Default_CrystalCap_88E 0x20 +#define EEPROM_Default_ThermalMeter_88E 0x18 + +#ifdef CONFIG_RF_GAIN_OFFSET +#define EEPROM_Default_RFGainOffset 0xff +#endif //CONFIG_RF_GAIN_OFFSET + +//New EFUSE deafult value +#define EEPROM_DEFAULT_24G_INDEX 0x2D +#define EEPROM_DEFAULT_24G_HT20_DIFF 0X02 +#define EEPROM_DEFAULT_24G_OFDM_DIFF 0X04 + +#define EEPROM_DEFAULT_5G_INDEX 0X2A +#define EEPROM_DEFAULT_5G_HT20_DIFF 0X00 +#define EEPROM_DEFAULT_5G_OFDM_DIFF 0X04 + +#define EEPROM_DEFAULT_DIFF 0XFE +#define EEPROM_DEFAULT_CHANNEL_PLAN 0x7F +#define EEPROM_DEFAULT_BOARD_OPTION 0x00 +#define EEPROM_DEFAULT_FEATURE_OPTION 0x00 +#define EEPROM_DEFAULT_BT_OPTION 0x10 + + +// For debug +#define EEPROM_Default_PID 0x1234 +#define EEPROM_Default_VID 0x5678 +#define EEPROM_Default_CustomerID 0xAB +#define EEPROM_Default_CustomerID_8188E 0x00 +#define EEPROM_Default_SubCustomerID 0xCD +#define EEPROM_Default_Version 0 + +#define EEPROM_CHANNEL_PLAN_FCC 0x0 +#define EEPROM_CHANNEL_PLAN_IC 0x1 +#define EEPROM_CHANNEL_PLAN_ETSI 0x2 +#define EEPROM_CHANNEL_PLAN_SPAIN 0x3 +#define EEPROM_CHANNEL_PLAN_FRANCE 0x4 +#define EEPROM_CHANNEL_PLAN_MKK 0x5 +#define EEPROM_CHANNEL_PLAN_MKK1 0x6 +#define EEPROM_CHANNEL_PLAN_ISRAEL 0x7 +#define EEPROM_CHANNEL_PLAN_TELEC 0x8 +#define EEPROM_CHANNEL_PLAN_GLOBAL_DOMAIN 0x9 +#define EEPROM_CHANNEL_PLAN_WORLD_WIDE_13 0xA +#define EEPROM_CHANNEL_PLAN_NCC 0xB +#define EEPROM_USB_OPTIONAL1 0xE +#define EEPROM_CHANNEL_PLAN_BY_HW_MASK 0x80 + + +#define EEPROM_CID_DEFAULT 0x0 +#define EEPROM_CID_TOSHIBA 0x4 +#define EEPROM_CID_CCX 0x10 // CCX test. By Bruce, 2009-02-25. +#define EEPROM_CID_QMI 0x0D +#define EEPROM_CID_WHQL 0xFE // added by chiyoko for dtm, 20090108 + + +#define RTL_EEPROM_ID 0x8129 + +#endif //__RTL8188E_SPEC_H__ diff --git a/include/rtl8188e_sreset.h b/include/rtl8188e_sreset.h index 453ff46..e13d0bb 100755 --- a/include/rtl8188e_sreset.h +++ b/include/rtl8188e_sreset.h @@ -1,7 +1,7 @@ /****************************************************************************** * * 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. @@ -30,4 +30,3 @@ extern void rtl8188e_sreset_xmit_status_check(struct adapter *padapter); extern void rtl8188e_sreset_linked_status_check(struct adapter *padapter); #endif #endif - diff --git a/include/rtl8188e_xmit.h b/include/rtl8188e_xmit.h index 848e147..48bbff1 100755 --- a/include/rtl8188e_xmit.h +++ b/include/rtl8188e_xmit.h @@ -1,311 +1,310 @@ -/****************************************************************************** - * - * 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 __RTL8188E_XMIT_H__ -#define __RTL8188E_XMIT_H__ - -#define MAX_TX_AGG_PACKET_NUMBER 0xFF -// -// Queue Select Value in TxDesc -// -#define QSLT_BK 0x2//0x01 -#define QSLT_BE 0x0 -#define QSLT_VI 0x5//0x4 -#define QSLT_VO 0x7//0x6 -#define QSLT_BEACON 0x10 -#define QSLT_HIGH 0x11 -#define QSLT_MGNT 0x12 -#define QSLT_CMD 0x13 - -//For 88e early mode -#define SET_EARLYMODE_PKTNUM(__pAddr, __Value) SET_BITS_TO_LE_4BYTE(__pAddr, 0, 3, __Value) -#define SET_EARLYMODE_LEN0(__pAddr, __Value) SET_BITS_TO_LE_4BYTE(__pAddr, 4, 12, __Value) -#define SET_EARLYMODE_LEN1(__pAddr, __Value) SET_BITS_TO_LE_4BYTE(__pAddr, 16, 12, __Value) -#define SET_EARLYMODE_LEN2_1(__pAddr, __Value) SET_BITS_TO_LE_4BYTE(__pAddr, 28, 4, __Value) -#define SET_EARLYMODE_LEN2_2(__pAddr, __Value) SET_BITS_TO_LE_4BYTE(__pAddr+4, 0, 8, __Value) -#define SET_EARLYMODE_LEN3(__pAddr, __Value) SET_BITS_TO_LE_4BYTE(__pAddr+4, 8, 12, __Value) -#define SET_EARLYMODE_LEN4(__pAddr, __Value) SET_BITS_TO_LE_4BYTE(__pAddr+4, 20, 12, __Value) - -// -//defined for TX DESC Operation -// - -#define MAX_TID (15) - -//OFFSET 0 -#define OFFSET_SZ 0 -#define OFFSET_SHT 16 -#define BMC BIT(24) -#define LSG BIT(26) -#define FSG BIT(27) -#define OWN BIT(31) - - -//OFFSET 4 -#define PKT_OFFSET_SZ 0 -#define QSEL_SHT 8 -#define RATE_ID_SHT 16 -#define NAVUSEHDR BIT(20) -#define SEC_TYPE_SHT 22 -#define PKT_OFFSET_SHT 26 - -//OFFSET 8 -#define AGG_EN BIT(12) -#define AGG_BK BIT(16) -#define AMPDU_DENSITY_SHT 20 -#define ANTSEL_A BIT(24) -#define ANTSEL_B BIT(25) -#define TX_ANT_CCK_SHT 26 -#define TX_ANTL_SHT 28 -#define TX_ANT_HT_SHT 30 - -//OFFSET 12 -#define SEQ_SHT 16 -#define EN_HWSEQ BIT(31) - -//OFFSET 16 -#define QOS BIT(6) -#define HW_SSN BIT(7) -#define USERATE BIT(8) -#define DISDATAFB BIT(10) -#define CTS_2_SELF BIT(11) -#define RTS_EN BIT(12) -#define HW_RTS_EN BIT(13) -#define DATA_SHORT BIT(24) -#define PWR_STATUS_SHT 15 -#define DATA_SC_SHT 20 -#define DATA_BW BIT(25) - -//OFFSET 20 -#define RTY_LMT_EN BIT(17) - -enum TXDESC_SC{ - SC_DONT_CARE = 0x00, - SC_UPPER= 0x01, - SC_LOWER=0x02, - SC_DUPLICATE=0x03 -}; -//OFFSET 20 -#define SGI BIT(6) -#define USB_TXAGG_NUM_SHT 24 - -typedef struct txdesc_88e -{ - //Offset 0 - u32 pktlen:16; - u32 offset:8; - u32 bmc:1; - u32 htc:1; - u32 ls:1; - u32 fs:1; - u32 linip:1; - u32 noacm:1; - u32 gf:1; - u32 own:1; - - //Offset 4 - u32 macid:6; - u32 rsvd0406:2; - u32 qsel:5; - u32 rd_nav_ext:1; - u32 lsig_txop_en:1; - u32 pifs:1; - u32 rate_id:4; - u32 navusehdr:1; - u32 en_desc_id:1; - u32 sectype:2; - u32 rsvd0424:2; - u32 pkt_offset:5; // unit: 8 bytes - u32 rsvd0431:1; - - //Offset 8 - u32 rts_rc:6; - u32 data_rc:6; - u32 agg_en:1; - u32 rd_en:1; - u32 bar_rty_th:2; - u32 bk:1; - u32 morefrag:1; - u32 raw:1; - u32 ccx:1; - u32 ampdu_density:3; - u32 bt_null:1; - u32 ant_sel_a:1; - u32 ant_sel_b:1; - u32 tx_ant_cck:2; - u32 tx_antl:2; - u32 tx_ant_ht:2; - - //Offset 12 - u32 nextheadpage:8; - u32 tailpage:8; - u32 seq:12; - u32 cpu_handle:1; - u32 tag1:1; - u32 trigger_int:1; - u32 hwseq_en:1; - - //Offset 16 - u32 rtsrate:5; - u32 ap_dcfe:1; - u32 hwseq_sel:2; - u32 userate:1; - u32 disrtsfb:1; - u32 disdatafb:1; - u32 cts2self:1; - u32 rtsen:1; - u32 hw_rts_en:1; - u32 port_id:1; - u32 pwr_status:3; - u32 wait_dcts:1; - u32 cts2ap_en:1; - u32 data_sc:2; - u32 data_stbc:2; - u32 data_short:1; - u32 data_bw:1; - u32 rts_short:1; - u32 rts_bw:1; - u32 rts_sc:2; - u32 vcs_stbc:2; - - //Offset 20 - u32 datarate:6; - u32 sgi:1; - u32 try_rate:1; - u32 data_ratefb_lmt:5; - u32 rts_ratefb_lmt:4; - u32 rty_lmt_en:1; - u32 data_rt_lmt:6; - u32 usb_txagg_num:8; - - //Offset 24 - u32 txagg_a:5; - u32 txagg_b:5; - u32 use_max_len:1; - u32 max_agg_num:5; - u32 mcsg1_max_len:4; - u32 mcsg2_max_len:4; - u32 mcsg3_max_len:4; - u32 mcs7_sgi_max_len:4; - - //Offset 28 - u32 checksum:16; // TxBuffSize(PCIe)/CheckSum(USB) - u32 sw0:8; /* offset 30 */ - u32 sw1:4; - u32 mcs15_sgi_max_len:4; -}TXDESC, *PTXDESC; - -#define txdesc_set_ccx_sw_88e(txdesc, value) \ - do { \ - ((struct txdesc_88e *)(txdesc))->sw1 = (((value)>>8) & 0x0f); \ - ((struct txdesc_88e *)(txdesc))->sw0 = ((value) & 0xff); \ - } while (0) - -struct txrpt_ccx_88e { - /* offset 0 */ - u8 tag1:1; - u8 pkt_num:3; - u8 txdma_underflow:1; - u8 int_bt:1; - u8 int_tri:1; - u8 int_ccx:1; - - /* offset 1 */ - u8 mac_id:6; - u8 pkt_ok:1; - u8 bmc:1; - - /* offset 2 */ - u8 retry_cnt:6; - u8 lifetime_over:1; - u8 retry_over:1; - - /* offset 3 */ - u8 ccx_qtime0; - u8 ccx_qtime1; - - /* offset 5 */ - u8 final_data_rate; - - /* offset 6 */ - u8 sw1:4; - u8 qsel:4; - - /* offset 7 */ - u8 sw0; -}; - -#define txrpt_ccx_sw_88e(txrpt_ccx) ((txrpt_ccx)->sw0 + ((txrpt_ccx)->sw1<<8)) -#define txrpt_ccx_qtime_88e(txrpt_ccx) ((txrpt_ccx)->ccx_qtime0+((txrpt_ccx)->ccx_qtime1<<8)) - -void rtl8188e_fill_fake_txdesc(struct adapter *padapter,u8*pDesc,u32 BufferLen,u8 IsPsPoll,u8 IsBTQosNull); -#ifdef CONFIG_SDIO_HCI -s32 rtl8188es_init_xmit_priv(struct adapter *padapter); -void rtl8188es_free_xmit_priv(struct adapter *padapter); -s32 rtl8188es_hal_xmit(struct adapter *padapter, struct xmit_frame *pxmitframe); -s32 rtl8188es_mgnt_xmit(struct adapter *padapter, struct xmit_frame *pmgntframe); -s32 rtl8188es_hal_xmitframe_enqueue(struct adapter *padapter, struct xmit_frame *pxmitframe); -thread_return rtl8188es_xmit_thread(thread_context context); -s32 rtl8188es_xmit_buf_handler(struct adapter *padapter); -#define hal_xmit_handler rtl8188es_xmit_buf_handler - -#ifdef CONFIG_SDIO_TX_TASKLET -void rtl8188es_xmit_tasklet(void *priv); -#endif -#endif - -#ifdef CONFIG_USB_HCI -s32 rtl8188eu_init_xmit_priv(struct adapter *padapter); -void rtl8188eu_free_xmit_priv(struct adapter *padapter); -s32 rtl8188eu_hal_xmit(struct adapter *padapter, struct xmit_frame *pxmitframe); -s32 rtl8188eu_mgnt_xmit(struct adapter *padapter, struct xmit_frame *pmgntframe); -s32 rtl8188eu_hal_xmitframe_enqueue(struct adapter *padapter, struct xmit_frame *pxmitframe); -s32 rtl8188eu_xmit_buf_handler(struct adapter *padapter); -#define hal_xmit_handler rtl8188eu_xmit_buf_handler -void rtl8188eu_xmit_tasklet(void *priv); -s32 rtl8188eu_xmitframe_complete(struct adapter *padapter, struct xmit_priv *pxmitpriv, struct xmit_buf *pxmitbuf); -#endif - -#ifdef CONFIG_PCI_HCI -s32 rtl8188ee_init_xmit_priv(struct adapter *padapter); -void rtl8188ee_free_xmit_priv(struct adapter *padapter); -struct xmit_buf *rtl8188ee_dequeue_xmitbuf(struct rtw_tx_ring *ring); -void rtl8188ee_xmitframe_resume(struct adapter *padapter); -s32 rtl8188ee_hal_xmit(struct adapter *padapter, struct xmit_frame *pxmitframe); -s32 rtl8188ee_mgnt_xmit(struct adapter *padapter, struct xmit_frame *pmgntframe); -void rtl8188ee_xmit_tasklet(void *priv); -#endif - - - -#ifdef CONFIG_TX_EARLY_MODE -void UpdateEarlyModeInfo8188E(struct xmit_priv *pxmitpriv,struct xmit_buf *pxmitbuf ); -#endif - -#ifdef CONFIG_XMIT_ACK -void dump_txrpt_ccx_88e(void *buf); -void handle_txrpt_ccx_88e(struct adapter *adapter, u8 *buf); -#else -#define dump_txrpt_ccx_88e(buf) do {} while(0) -#define handle_txrpt_ccx_88e(adapter, buf) do {} while(0) -#endif //CONFIG_XMIT_ACK - -void _dbg_dump_tx_info(struct adapter *padapter,int frame_tag,struct tx_desc *ptxdesc); -#endif //__RTL8188E_XMIT_H__ - +/****************************************************************************** + * + * 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 __RTL8188E_XMIT_H__ +#define __RTL8188E_XMIT_H__ + +#define MAX_TX_AGG_PACKET_NUMBER 0xFF +// +// Queue Select Value in TxDesc +// +#define QSLT_BK 0x2//0x01 +#define QSLT_BE 0x0 +#define QSLT_VI 0x5//0x4 +#define QSLT_VO 0x7//0x6 +#define QSLT_BEACON 0x10 +#define QSLT_HIGH 0x11 +#define QSLT_MGNT 0x12 +#define QSLT_CMD 0x13 + +//For 88e early mode +#define SET_EARLYMODE_PKTNUM(__pAddr, __Value) SET_BITS_TO_LE_4BYTE(__pAddr, 0, 3, __Value) +#define SET_EARLYMODE_LEN0(__pAddr, __Value) SET_BITS_TO_LE_4BYTE(__pAddr, 4, 12, __Value) +#define SET_EARLYMODE_LEN1(__pAddr, __Value) SET_BITS_TO_LE_4BYTE(__pAddr, 16, 12, __Value) +#define SET_EARLYMODE_LEN2_1(__pAddr, __Value) SET_BITS_TO_LE_4BYTE(__pAddr, 28, 4, __Value) +#define SET_EARLYMODE_LEN2_2(__pAddr, __Value) SET_BITS_TO_LE_4BYTE(__pAddr+4, 0, 8, __Value) +#define SET_EARLYMODE_LEN3(__pAddr, __Value) SET_BITS_TO_LE_4BYTE(__pAddr+4, 8, 12, __Value) +#define SET_EARLYMODE_LEN4(__pAddr, __Value) SET_BITS_TO_LE_4BYTE(__pAddr+4, 20, 12, __Value) + +// +//defined for TX DESC Operation +// + +#define MAX_TID (15) + +//OFFSET 0 +#define OFFSET_SZ 0 +#define OFFSET_SHT 16 +#define BMC BIT(24) +#define LSG BIT(26) +#define FSG BIT(27) +#define OWN BIT(31) + + +//OFFSET 4 +#define PKT_OFFSET_SZ 0 +#define QSEL_SHT 8 +#define RATE_ID_SHT 16 +#define NAVUSEHDR BIT(20) +#define SEC_TYPE_SHT 22 +#define PKT_OFFSET_SHT 26 + +//OFFSET 8 +#define AGG_EN BIT(12) +#define AGG_BK BIT(16) +#define AMPDU_DENSITY_SHT 20 +#define ANTSEL_A BIT(24) +#define ANTSEL_B BIT(25) +#define TX_ANT_CCK_SHT 26 +#define TX_ANTL_SHT 28 +#define TX_ANT_HT_SHT 30 + +//OFFSET 12 +#define SEQ_SHT 16 +#define EN_HWSEQ BIT(31) + +//OFFSET 16 +#define QOS BIT(6) +#define HW_SSN BIT(7) +#define USERATE BIT(8) +#define DISDATAFB BIT(10) +#define CTS_2_SELF BIT(11) +#define RTS_EN BIT(12) +#define HW_RTS_EN BIT(13) +#define DATA_SHORT BIT(24) +#define PWR_STATUS_SHT 15 +#define DATA_SC_SHT 20 +#define DATA_BW BIT(25) + +//OFFSET 20 +#define RTY_LMT_EN BIT(17) + +enum TXDESC_SC{ + SC_DONT_CARE = 0x00, + SC_UPPER= 0x01, + SC_LOWER=0x02, + SC_DUPLICATE=0x03 +}; +//OFFSET 20 +#define SGI BIT(6) +#define USB_TXAGG_NUM_SHT 24 + +typedef struct txdesc_88e +{ + //Offset 0 + u32 pktlen:16; + u32 offset:8; + u32 bmc:1; + u32 htc:1; + u32 ls:1; + u32 fs:1; + u32 linip:1; + u32 noacm:1; + u32 gf:1; + u32 own:1; + + //Offset 4 + u32 macid:6; + u32 rsvd0406:2; + u32 qsel:5; + u32 rd_nav_ext:1; + u32 lsig_txop_en:1; + u32 pifs:1; + u32 rate_id:4; + u32 navusehdr:1; + u32 en_desc_id:1; + u32 sectype:2; + u32 rsvd0424:2; + u32 pkt_offset:5; // unit: 8 bytes + u32 rsvd0431:1; + + //Offset 8 + u32 rts_rc:6; + u32 data_rc:6; + u32 agg_en:1; + u32 rd_en:1; + u32 bar_rty_th:2; + u32 bk:1; + u32 morefrag:1; + u32 raw:1; + u32 ccx:1; + u32 ampdu_density:3; + u32 bt_null:1; + u32 ant_sel_a:1; + u32 ant_sel_b:1; + u32 tx_ant_cck:2; + u32 tx_antl:2; + u32 tx_ant_ht:2; + + //Offset 12 + u32 nextheadpage:8; + u32 tailpage:8; + u32 seq:12; + u32 cpu_handle:1; + u32 tag1:1; + u32 trigger_int:1; + u32 hwseq_en:1; + + //Offset 16 + u32 rtsrate:5; + u32 ap_dcfe:1; + u32 hwseq_sel:2; + u32 userate:1; + u32 disrtsfb:1; + u32 disdatafb:1; + u32 cts2self:1; + u32 rtsen:1; + u32 hw_rts_en:1; + u32 port_id:1; + u32 pwr_status:3; + u32 wait_dcts:1; + u32 cts2ap_en:1; + u32 data_sc:2; + u32 data_stbc:2; + u32 data_short:1; + u32 data_bw:1; + u32 rts_short:1; + u32 rts_bw:1; + u32 rts_sc:2; + u32 vcs_stbc:2; + + //Offset 20 + u32 datarate:6; + u32 sgi:1; + u32 try_rate:1; + u32 data_ratefb_lmt:5; + u32 rts_ratefb_lmt:4; + u32 rty_lmt_en:1; + u32 data_rt_lmt:6; + u32 usb_txagg_num:8; + + //Offset 24 + u32 txagg_a:5; + u32 txagg_b:5; + u32 use_max_len:1; + u32 max_agg_num:5; + u32 mcsg1_max_len:4; + u32 mcsg2_max_len:4; + u32 mcsg3_max_len:4; + u32 mcs7_sgi_max_len:4; + + //Offset 28 + u32 checksum:16; // TxBuffSize(PCIe)/CheckSum(USB) + u32 sw0:8; /* offset 30 */ + u32 sw1:4; + u32 mcs15_sgi_max_len:4; +}TXDESC, *PTXDESC; + +#define txdesc_set_ccx_sw_88e(txdesc, value) \ + do { \ + ((struct txdesc_88e *)(txdesc))->sw1 = (((value)>>8) & 0x0f); \ + ((struct txdesc_88e *)(txdesc))->sw0 = ((value) & 0xff); \ + } while (0) + +struct txrpt_ccx_88e { + /* offset 0 */ + u8 tag1:1; + u8 pkt_num:3; + u8 txdma_underflow:1; + u8 int_bt:1; + u8 int_tri:1; + u8 int_ccx:1; + + /* offset 1 */ + u8 mac_id:6; + u8 pkt_ok:1; + u8 bmc:1; + + /* offset 2 */ + u8 retry_cnt:6; + u8 lifetime_over:1; + u8 retry_over:1; + + /* offset 3 */ + u8 ccx_qtime0; + u8 ccx_qtime1; + + /* offset 5 */ + u8 final_data_rate; + + /* offset 6 */ + u8 sw1:4; + u8 qsel:4; + + /* offset 7 */ + u8 sw0; +}; + +#define txrpt_ccx_sw_88e(txrpt_ccx) ((txrpt_ccx)->sw0 + ((txrpt_ccx)->sw1<<8)) +#define txrpt_ccx_qtime_88e(txrpt_ccx) ((txrpt_ccx)->ccx_qtime0+((txrpt_ccx)->ccx_qtime1<<8)) + +void rtl8188e_fill_fake_txdesc(struct adapter *padapter,u8*pDesc,u32 BufferLen,u8 IsPsPoll,u8 IsBTQosNull); +#ifdef CONFIG_SDIO_HCI +s32 rtl8188es_init_xmit_priv(struct adapter *padapter); +void rtl8188es_free_xmit_priv(struct adapter *padapter); +s32 rtl8188es_hal_xmit(struct adapter *padapter, struct xmit_frame *pxmitframe); +s32 rtl8188es_mgnt_xmit(struct adapter *padapter, struct xmit_frame *pmgntframe); +s32 rtl8188es_hal_xmitframe_enqueue(struct adapter *padapter, struct xmit_frame *pxmitframe); +thread_return rtl8188es_xmit_thread(thread_context context); +s32 rtl8188es_xmit_buf_handler(struct adapter *padapter); +#define hal_xmit_handler rtl8188es_xmit_buf_handler + +#ifdef CONFIG_SDIO_TX_TASKLET +void rtl8188es_xmit_tasklet(void *priv); +#endif +#endif + +#ifdef CONFIG_USB_HCI +s32 rtl8188eu_init_xmit_priv(struct adapter *padapter); +void rtl8188eu_free_xmit_priv(struct adapter *padapter); +s32 rtl8188eu_hal_xmit(struct adapter *padapter, struct xmit_frame *pxmitframe); +s32 rtl8188eu_mgnt_xmit(struct adapter *padapter, struct xmit_frame *pmgntframe); +s32 rtl8188eu_hal_xmitframe_enqueue(struct adapter *padapter, struct xmit_frame *pxmitframe); +s32 rtl8188eu_xmit_buf_handler(struct adapter *padapter); +#define hal_xmit_handler rtl8188eu_xmit_buf_handler +void rtl8188eu_xmit_tasklet(void *priv); +s32 rtl8188eu_xmitframe_complete(struct adapter *padapter, struct xmit_priv *pxmitpriv, struct xmit_buf *pxmitbuf); +#endif + +#ifdef CONFIG_PCI_HCI +s32 rtl8188ee_init_xmit_priv(struct adapter *padapter); +void rtl8188ee_free_xmit_priv(struct adapter *padapter); +struct xmit_buf *rtl8188ee_dequeue_xmitbuf(struct rtw_tx_ring *ring); +void rtl8188ee_xmitframe_resume(struct adapter *padapter); +s32 rtl8188ee_hal_xmit(struct adapter *padapter, struct xmit_frame *pxmitframe); +s32 rtl8188ee_mgnt_xmit(struct adapter *padapter, struct xmit_frame *pmgntframe); +void rtl8188ee_xmit_tasklet(void *priv); +#endif + + + +#ifdef CONFIG_TX_EARLY_MODE +void UpdateEarlyModeInfo8188E(struct xmit_priv *pxmitpriv,struct xmit_buf *pxmitbuf ); +#endif + +#ifdef CONFIG_XMIT_ACK +void dump_txrpt_ccx_88e(void *buf); +void handle_txrpt_ccx_88e(struct adapter *adapter, u8 *buf); +#else +#define dump_txrpt_ccx_88e(buf) do {} while(0) +#define handle_txrpt_ccx_88e(adapter, buf) do {} while(0) +#endif //CONFIG_XMIT_ACK + +void _dbg_dump_tx_info(struct adapter *padapter,int frame_tag,struct tx_desc *ptxdesc); +#endif //__RTL8188E_XMIT_H__ diff --git a/include/rtl8192c_cmd.h b/include/rtl8192c_cmd.h index 72174c0..9627c66 100755 --- a/include/rtl8192c_cmd.h +++ b/include/rtl8192c_cmd.h @@ -1,7 +1,7 @@ /****************************************************************************** * * 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. @@ -22,7 +22,7 @@ enum cmd_msg_element_id -{ +{ NONE_CMDMSG_EID, AP_OFFLOAD_EID=0, SET_PWRMODE_EID=1, @@ -49,13 +49,13 @@ struct cmd_msg_parm { }; typedef struct _SETPWRMODE_PARM{ - u8 Mode; - u8 SmartPS; + u8 Mode; + u8 SmartPS; u8 BcnPassTime; // unit: 100ms }SETPWRMODE_PARM, *PSETPWRMODE_PARM; struct H2C_SS_RFOFF_PARAM{ - u8 ROFOn; // 1: on, 0:off + u8 ROFOn; // 1: on, 0:off u16 gpio_period; // unit: 1024 us }__attribute__ ((packed)); @@ -65,8 +65,8 @@ typedef struct JOINBSSRPT_PARM{ }JOINBSSRPT_PARM, *PJOINBSSRPT_PARM; typedef struct _RSVDPAGE_LOC{ - u8 LocProbeRsp; - u8 LocPsPoll; + u8 LocProbeRsp; + u8 LocPsPoll; u8 LocNullData; }RSVDPAGE_LOC, *PRSVDPAGE_LOC; @@ -98,7 +98,7 @@ void rtl8192c_set_p2p_ps_offload_cmd(struct adapter* padapter, u8 p2p_ps_state); #ifdef CONFIG_IOL typedef struct _IO_OFFLOAD_LOC{ - u8 LocCmd; + u8 LocCmd; }IO_OFFLOAD_LOC, *PIO_OFFLOAD_LOC; int rtl8192c_IOL_exec_cmds_sync(struct adapter *adapter, struct xmit_frame *xmit_frame, u32 max_wating_ms, u32 bndy_cnt); #endif //CONFIG_IOL @@ -113,4 +113,3 @@ u8 rtl8192c_reset_tsf(struct adapter *padapter, u8 reset_port); #endif // CONFIG_TSF_RESET_OFFLOAD #endif // __RTL8192C_CMD_H_ - diff --git a/include/rtl8192c_dm.h b/include/rtl8192c_dm.h index aad3393..ac18c66 100755 --- a/include/rtl8192c_dm.h +++ b/include/rtl8192c_dm.h @@ -1,7 +1,7 @@ /****************************************************************************** * * 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. @@ -34,15 +34,15 @@ enum{ UP_LINK, - DOWN_LINK, + DOWN_LINK, }; typedef enum _BT_Ant_NUM{ - Ant_x2 = 0, + Ant_x2 = 0, Ant_x1 = 1 } BT_Ant_NUM, *PBT_Ant_NUM; typedef enum _BT_CoType{ - BT_2Wire = 0, + BT_2Wire = 0, BT_ISSC_3Wire = 1, BT_Accel = 2, BT_CSR_BC4 = 3, @@ -51,12 +51,12 @@ typedef enum _BT_CoType{ } BT_CoType, *PBT_CoType; typedef enum _BT_CurState{ - BT_OFF = 0, + BT_OFF = 0, BT_ON = 1, } BT_CurState, *PBT_CurState; typedef enum _BT_ServiceType{ - BT_SCO = 0, + BT_SCO = 0, BT_A2DP = 1, BT_HID = 2, BT_HID_Idle = 3, @@ -69,7 +69,7 @@ typedef enum _BT_ServiceType{ } BT_ServiceType, *PBT_ServiceType; typedef enum _BT_RadioShared{ - BT_Radio_Shared = 0, + BT_Radio_Shared = 0, BT_Radio_Individual = 1, } BT_RadioShared, *PBT_RadioShared; @@ -116,7 +116,7 @@ struct btcoexist_priv { #define IQK_BB_REG_NUM 9 #define HP_THERMAL_NUM 8 //###### duplicate code,will move to ODM ######### -struct dm_priv +struct dm_priv { u8 DM_Type; u8 DMFlag; @@ -141,7 +141,7 @@ struct dm_priv PS_T DM_PSTable; FALSE_ALARM_STATISTICS FalseAlmCnt; - + //for rate adaptive, in fact, 88c/92c fw will handle this u8 bUseRAMask; RATE_ADAPTIVE RateAdaptive; @@ -150,11 +150,11 @@ struct dm_priv u8 bDynamicTxPowerEnable; u8 LastDTPLvl; u8 DynamicTxHighPowerLvl;//Add by Jacken Tx Power Control for Near/Far Range 2008/03/06 - + //for tx power tracking u8 bTXPowerTracking; u8 TXPowercount; - u8 bTXPowerTrackingInit; + u8 bTXPowerTrackingInit; u8 TxPowerTrackControl; //for mp mode, turn off txpwrtracking as default u8 TM_Trigger; @@ -173,7 +173,7 @@ struct dm_priv u8 bDPdone; u8 bDPPathAOK; u8 bDPPathBOK; - + //for IQK u32 RegC04; u32 Reg874; @@ -221,10 +221,10 @@ struct dm_priv //for Antenna diversity #ifdef CONFIG_ANTENNA_DIVERSITY // SWAT_T DM_SWAT_Table; -#endif +#endif #ifdef CONFIG_SW_ANTENNA_DIVERSITY // _timer SwAntennaSwitchTimer; -/* +/* u64 lastTxOkCnt; u64 lastRxOkCnt; u64 TXByteCnt_A; @@ -238,7 +238,7 @@ struct dm_priv s32 OFDM_Pkt_Cnt; u8 RSSI_Select; -// u8 DIG_Dynamic_MIN ; +// u8 DIG_Dynamic_MIN ; //###### duplicate code,will move to ODM ######### // Add for Reading Initial Data Rate SEL Register 0x484 during watchdog. Using for fill tx desc. 2011.3.21 by Thomas u8 INIDATA_RATE[32]; @@ -260,4 +260,3 @@ void rtl8192c_InitHalDm( IN struct adapter *Adapter); void rtl8192c_HalDmWatchDog(IN struct adapter *Adapter); #endif //__HAL8190PCIDM_H__ - diff --git a/include/rtl8192c_event.h b/include/rtl8192c_event.h index 7596531..ddc08bf 100755 --- a/include/rtl8192c_event.h +++ b/include/rtl8192c_event.h @@ -1,7 +1,7 @@ /****************************************************************************** * * 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. @@ -16,13 +16,11 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA * * - ******************************************************************************/ -#ifndef _RTL8192C_EVENT_H_ -#define _RTL8192C_EVENT_H_ - - - - -#endif - - + ******************************************************************************/ +#ifndef _RTL8192C_EVENT_H_ +#define _RTL8192C_EVENT_H_ + + + + +#endif diff --git a/include/rtl8192c_hal.h b/include/rtl8192c_hal.h index 0b0e348..92bbe5d 100755 --- a/include/rtl8192c_hal.h +++ b/include/rtl8192c_hal.h @@ -1,7 +1,7 @@ /****************************************************************************** * * 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. @@ -38,7 +38,7 @@ #ifdef CONFIG_PCI_HCI - + #define RTL819X_DEFAULT_RF_TYPE RF_2T2R //#define RTL819X_DEFAULT_RF_TYPE RF_1T2R #define RTL819X_TOTAL_RF_PATH 2 @@ -88,7 +88,7 @@ #define Rtl819XFwTSMCImageArray Rtl8192CEFwTSMCImgArray #define Rtl819XFwUMCACutImageArray Rtl8192CEFwUMCACutImgArray #define Rtl819XFwUMCBCutImageArray Rtl8192CEFwUMCBCutImgArray - + // #define Rtl8723FwUMCImageArray Rtl8192CEFwUMC8723ImgArray #define Rtl819XMAC_Array Rtl8192CEMAC_2T_Array #define Rtl819XAGCTAB_2TArray Rtl8192CEAGCTAB_2TArray @@ -99,34 +99,34 @@ #define Rtl819XRadioA_1TArray Rtl8192CERadioA_1TArray #define Rtl819XRadioB_2TArray Rtl8192CERadioB_2TArray #define Rtl819XRadioB_1TArray Rtl8192CERadioB_1TArray - #define Rtl819XPHY_REG_Array_PG Rtl8192CEPHY_REG_Array_PG - #define Rtl819XPHY_REG_Array_MP Rtl8192CEPHY_REG_Array_MP + #define Rtl819XPHY_REG_Array_PG Rtl8192CEPHY_REG_Array_PG + #define Rtl819XPHY_REG_Array_MP Rtl8192CEPHY_REG_Array_MP - #define PHY_REG_2TArrayLength Rtl8192CEPHY_REG_2TArrayLength - #define PHY_REG_1TArrayLength Rtl8192CEPHY_REG_1TArrayLength - #define PHY_ChangeTo_1T1RArrayLength Rtl8192CEPHY_ChangeTo_1T1RArrayLength - #define PHY_ChangeTo_1T2RArrayLength Rtl8192CEPHY_ChangeTo_1T2RArrayLength - #define PHY_ChangeTo_2T2RArrayLength Rtl8192CEPHY_ChangeTo_2T2RArrayLength - #define PHY_REG_Array_PGLength Rtl8192CEPHY_REG_Array_PGLength - //#define PHY_REG_Array_PG_mCardLength Rtl8192CEPHY_REG_Array_PG_mCardLength - #define PHY_REG_Array_MPLength Rtl8192CEPHY_REG_Array_MPLength - #define PHY_REG_Array_MPLength Rtl8192CEPHY_REG_Array_MPLength - //#define PHY_REG_1T_mCardArrayLength Rtl8192CEPHY_REG_1T_mCardArrayLength - //#define PHY_REG_2T_mCardArrayLength Rtl8192CEPHY_REG_2T_mCardArrayLength - //#define PHY_REG_Array_PG_HPLength Rtl8192CEPHY_REG_Array_PG_HPLength - #define RadioA_2TArrayLength Rtl8192CERadioA_2TArrayLength - #define RadioB_2TArrayLength Rtl8192CERadioB_2TArrayLength - #define RadioA_1TArrayLength Rtl8192CERadioA_1TArrayLength - #define RadioB_1TArrayLength Rtl8192CERadioB_1TArrayLength - //#define RadioA_1T_mCardArrayLength Rtl8192CERadioA_1T_mCardArrayLength - //#define RadioB_1T_mCardArrayLength Rtl8192CERadioB_1T_mCardArrayLength - //#define RadioA_1T_HPArrayLength Rtl8192CERadioA_1T_HPArrayLength - #define RadioB_GM_ArrayLength Rtl8192CERadioB_GM_ArrayLength - #define MAC_2T_ArrayLength Rtl8192CEMAC_2T_ArrayLength - #define MACPHY_Array_PGLength Rtl8192CEMACPHY_Array_PGLength - #define AGCTAB_2TArrayLength Rtl8192CEAGCTAB_2TArrayLength - #define AGCTAB_1TArrayLength Rtl8192CEAGCTAB_1TArrayLength - //#define AGCTAB_1T_HPArrayLength Rtl8192CEAGCTAB_1T_HPArrayLength + #define PHY_REG_2TArrayLength Rtl8192CEPHY_REG_2TArrayLength + #define PHY_REG_1TArrayLength Rtl8192CEPHY_REG_1TArrayLength + #define PHY_ChangeTo_1T1RArrayLength Rtl8192CEPHY_ChangeTo_1T1RArrayLength + #define PHY_ChangeTo_1T2RArrayLength Rtl8192CEPHY_ChangeTo_1T2RArrayLength + #define PHY_ChangeTo_2T2RArrayLength Rtl8192CEPHY_ChangeTo_2T2RArrayLength + #define PHY_REG_Array_PGLength Rtl8192CEPHY_REG_Array_PGLength + //#define PHY_REG_Array_PG_mCardLength Rtl8192CEPHY_REG_Array_PG_mCardLength + #define PHY_REG_Array_MPLength Rtl8192CEPHY_REG_Array_MPLength + #define PHY_REG_Array_MPLength Rtl8192CEPHY_REG_Array_MPLength + //#define PHY_REG_1T_mCardArrayLength Rtl8192CEPHY_REG_1T_mCardArrayLength + //#define PHY_REG_2T_mCardArrayLength Rtl8192CEPHY_REG_2T_mCardArrayLength + //#define PHY_REG_Array_PG_HPLength Rtl8192CEPHY_REG_Array_PG_HPLength + #define RadioA_2TArrayLength Rtl8192CERadioA_2TArrayLength + #define RadioB_2TArrayLength Rtl8192CERadioB_2TArrayLength + #define RadioA_1TArrayLength Rtl8192CERadioA_1TArrayLength + #define RadioB_1TArrayLength Rtl8192CERadioB_1TArrayLength + //#define RadioA_1T_mCardArrayLength Rtl8192CERadioA_1T_mCardArrayLength + //#define RadioB_1T_mCardArrayLength Rtl8192CERadioB_1T_mCardArrayLength + //#define RadioA_1T_HPArrayLength Rtl8192CERadioA_1T_HPArrayLength + #define RadioB_GM_ArrayLength Rtl8192CERadioB_GM_ArrayLength + #define MAC_2T_ArrayLength Rtl8192CEMAC_2T_ArrayLength + #define MACPHY_Array_PGLength Rtl8192CEMACPHY_Array_PGLength + #define AGCTAB_2TArrayLength Rtl8192CEAGCTAB_2TArrayLength + #define AGCTAB_1TArrayLength Rtl8192CEAGCTAB_1TArrayLength + //#define AGCTAB_1T_HPArrayLength Rtl8192CEAGCTAB_1T_HPArrayLength #elif defined(CONFIG_USB_HCI) @@ -140,7 +140,7 @@ #define RTL8192C_FW_UMC_IMG "rtl8192CU\\rtl8192cfwU.bin" #define RTL8192C_FW_UMC_B_IMG "rtl8192CU\\rtl8192cfwU_B.bin" - //#define RTL819X_FW_BOOT_IMG "rtl8192CU\\boot.img" + //#define RTL819X_FW_BOOT_IMG "rtl8192CU\\boot.img" //#define RTL819X_FW_MAIN_IMG "rtl8192CU\\main.img" //#define RTL819X_FW_DATA_IMG "rtl8192CU\\data.img" @@ -148,7 +148,7 @@ #define RTL8188C_PHY_RADIO_A "rtl8188CU\\radio_a.txt" #define RTL8188C_PHY_RADIO_B "rtl8188CU\\radio_b.txt" #define RTL8188C_PHY_RADIO_A_mCard "rtl8192CU\\radio_a_1T_mCard.txt" - #define RTL8188C_PHY_RADIO_B_mCard "rtl8192CU\\radio_b_1T_mCard.txt" + #define RTL8188C_PHY_RADIO_B_mCard "rtl8192CU\\radio_b_1T_mCard.txt" #define RTL8188C_PHY_RADIO_A_HP "rtl8192CU\\radio_a_1T_HP.txt" #define RTL8188C_AGC_TAB "rtl8188CU\\AGC_TAB.txt" #define RTL8188C_PHY_MACREG "rtl8188CU\\MACREG.txt" @@ -177,46 +177,46 @@ #define Rtl819XAGCTAB_1T_HPArray Rtl8192CUAGCTAB_1T_HPArray #define Rtl819XPHY_REG_2TArray Rtl8192CUPHY_REG_2TArray #define Rtl819XPHY_REG_1TArray Rtl8192CUPHY_REG_1TArray - #define Rtl819XPHY_REG_1T_mCardArray Rtl8192CUPHY_REG_1T_mCardArray - #define Rtl819XPHY_REG_2T_mCardArray Rtl8192CUPHY_REG_2T_mCardArray + #define Rtl819XPHY_REG_1T_mCardArray Rtl8192CUPHY_REG_1T_mCardArray + #define Rtl819XPHY_REG_2T_mCardArray Rtl8192CUPHY_REG_2T_mCardArray #define Rtl819XPHY_REG_1T_HPArray Rtl8192CUPHY_REG_1T_HPArray #define Rtl819XRadioA_2TArray Rtl8192CURadioA_2TArray #define Rtl819XRadioA_1TArray Rtl8192CURadioA_1TArray - #define Rtl819XRadioA_1T_mCardArray Rtl8192CURadioA_1T_mCardArray + #define Rtl819XRadioA_1T_mCardArray Rtl8192CURadioA_1T_mCardArray #define Rtl819XRadioB_2TArray Rtl8192CURadioB_2TArray - #define Rtl819XRadioB_1TArray Rtl8192CURadioB_1TArray + #define Rtl819XRadioB_1TArray Rtl8192CURadioB_1TArray #define Rtl819XRadioB_1T_mCardArray Rtl8192CURadioB_1T_mCardArray - #define Rtl819XRadioA_1T_HPArray Rtl8192CURadioA_1T_HPArray - #define Rtl819XPHY_REG_Array_PG Rtl8192CUPHY_REG_Array_PG - #define Rtl819XPHY_REG_Array_PG_mCard Rtl8192CUPHY_REG_Array_PG_mCard + #define Rtl819XRadioA_1T_HPArray Rtl8192CURadioA_1T_HPArray + #define Rtl819XPHY_REG_Array_PG Rtl8192CUPHY_REG_Array_PG + #define Rtl819XPHY_REG_Array_PG_mCard Rtl8192CUPHY_REG_Array_PG_mCard #define Rtl819XPHY_REG_Array_PG_HP Rtl8192CUPHY_REG_Array_PG_HP - #define Rtl819XPHY_REG_Array_MP Rtl8192CUPHY_REG_Array_MP + #define Rtl819XPHY_REG_Array_MP Rtl8192CUPHY_REG_Array_MP - #define PHY_REG_2TArrayLength Rtl8192CUPHY_REG_2TArrayLength - #define PHY_REG_1TArrayLength Rtl8192CUPHY_REG_1TArrayLength - #define PHY_ChangeTo_1T1RArrayLength Rtl8192CUPHY_ChangeTo_1T1RArrayLength - #define PHY_ChangeTo_1T2RArrayLength Rtl8192CUPHY_ChangeTo_1T2RArrayLength - #define PHY_ChangeTo_2T2RArrayLength Rtl8192CUPHY_ChangeTo_2T2RArrayLength - #define PHY_REG_Array_PGLength Rtl8192CUPHY_REG_Array_PGLength - #define PHY_REG_Array_PG_mCardLength Rtl8192CUPHY_REG_Array_PG_mCardLength - #define PHY_REG_Array_MPLength Rtl8192CUPHY_REG_Array_MPLength - #define PHY_REG_Array_MPLength Rtl8192CUPHY_REG_Array_MPLength - #define PHY_REG_1T_mCardArrayLength Rtl8192CUPHY_REG_1T_mCardArrayLength - #define PHY_REG_2T_mCardArrayLength Rtl8192CUPHY_REG_2T_mCardArrayLength - #define PHY_REG_Array_PG_HPLength Rtl8192CUPHY_REG_Array_PG_HPLength - #define RadioA_2TArrayLength Rtl8192CURadioA_2TArrayLength - #define RadioB_2TArrayLength Rtl8192CURadioB_2TArrayLength - #define RadioA_1TArrayLength Rtl8192CURadioA_1TArrayLength - #define RadioB_1TArrayLength Rtl8192CURadioB_1TArrayLength - #define RadioA_1T_mCardArrayLength Rtl8192CURadioA_1T_mCardArrayLength - #define RadioB_1T_mCardArrayLength Rtl8192CURadioB_1T_mCardArrayLength - #define RadioA_1T_HPArrayLength Rtl8192CURadioA_1T_HPArrayLength - #define RadioB_GM_ArrayLength Rtl8192CURadioB_GM_ArrayLength - #define MAC_2T_ArrayLength Rtl8192CUMAC_2T_ArrayLength - #define MACPHY_Array_PGLength Rtl8192CUMACPHY_Array_PGLength - #define AGCTAB_2TArrayLength Rtl8192CUAGCTAB_2TArrayLength - #define AGCTAB_1TArrayLength Rtl8192CUAGCTAB_1TArrayLength - #define AGCTAB_1T_HPArrayLength Rtl8192CUAGCTAB_1T_HPArrayLength + #define PHY_REG_2TArrayLength Rtl8192CUPHY_REG_2TArrayLength + #define PHY_REG_1TArrayLength Rtl8192CUPHY_REG_1TArrayLength + #define PHY_ChangeTo_1T1RArrayLength Rtl8192CUPHY_ChangeTo_1T1RArrayLength + #define PHY_ChangeTo_1T2RArrayLength Rtl8192CUPHY_ChangeTo_1T2RArrayLength + #define PHY_ChangeTo_2T2RArrayLength Rtl8192CUPHY_ChangeTo_2T2RArrayLength + #define PHY_REG_Array_PGLength Rtl8192CUPHY_REG_Array_PGLength + #define PHY_REG_Array_PG_mCardLength Rtl8192CUPHY_REG_Array_PG_mCardLength + #define PHY_REG_Array_MPLength Rtl8192CUPHY_REG_Array_MPLength + #define PHY_REG_Array_MPLength Rtl8192CUPHY_REG_Array_MPLength + #define PHY_REG_1T_mCardArrayLength Rtl8192CUPHY_REG_1T_mCardArrayLength + #define PHY_REG_2T_mCardArrayLength Rtl8192CUPHY_REG_2T_mCardArrayLength + #define PHY_REG_Array_PG_HPLength Rtl8192CUPHY_REG_Array_PG_HPLength + #define RadioA_2TArrayLength Rtl8192CURadioA_2TArrayLength + #define RadioB_2TArrayLength Rtl8192CURadioB_2TArrayLength + #define RadioA_1TArrayLength Rtl8192CURadioA_1TArrayLength + #define RadioB_1TArrayLength Rtl8192CURadioB_1TArrayLength + #define RadioA_1T_mCardArrayLength Rtl8192CURadioA_1T_mCardArrayLength + #define RadioB_1T_mCardArrayLength Rtl8192CURadioB_1T_mCardArrayLength + #define RadioA_1T_HPArrayLength Rtl8192CURadioA_1T_HPArrayLength + #define RadioB_GM_ArrayLength Rtl8192CURadioB_GM_ArrayLength + #define MAC_2T_ArrayLength Rtl8192CUMAC_2T_ArrayLength + #define MACPHY_Array_PGLength Rtl8192CUMACPHY_Array_PGLength + #define AGCTAB_2TArrayLength Rtl8192CUAGCTAB_2TArrayLength + #define AGCTAB_1TArrayLength Rtl8192CUAGCTAB_1TArrayLength + #define AGCTAB_1T_HPArrayLength Rtl8192CUAGCTAB_1T_HPArrayLength #define PHY_REG_1T_HPArrayLength Rtl8192CUPHY_REG_1T_HPArrayLength #endif @@ -381,15 +381,15 @@ typedef struct _TxPowerInfo{ #define EFUSE_MAP_LEN 128 #define EFUSE_MAX_SECTION 16 #define EFUSE_IC_ID_OFFSET 506 //For some inferiority IC purpose. added by Roger, 2009.09.02. -#define AVAILABLE_EFUSE_ADDR(addr) (addr < EFUSE_REAL_CONTENT_LEN) +#define AVAILABLE_EFUSE_ADDR(addr) (addr < EFUSE_REAL_CONTENT_LEN) // // To prevent out of boundary programming case, leave 1byte and program full section // 9bytes + 1byt + 5bytes and pre 1byte. // For worst case: -// | 1byte|----8bytes----|1byte|--5bytes--| +// | 1byte|----8bytes----|1byte|--5bytes--| // | | Reserved(14bytes) | // -#define EFUSE_OOB_PROTECT_BYTES 15 // PG data exclude header, dummy 6 bytes frome CP test and reserved 1byte. +#define EFUSE_OOB_PROTECT_BYTES 15 // PG data exclude header, dummy 6 bytes frome CP test and reserved 1byte. #define EFUSE_MAP_LEN_8723 256 @@ -419,13 +419,13 @@ typedef enum _RT_MULTI_FUNC{ // typedef enum _RT_POLARITY_CTL{ RT_POLARITY_LOW_ACT = 0, - RT_POLARITY_HIGH_ACT = 1, + RT_POLARITY_HIGH_ACT = 1, }RT_POLARITY_CTL,*PRT_POLARITY_CTL; // For RTL8723 regulator mode. by tynli. 2011.01.14. typedef enum _RT_REGULATOR_MODE{ RT_SWITCHING_REGULATOR = 0, - RT_LDO_REGULATOR = 1, + RT_LDO_REGULATOR = 1, }RT_REGULATOR_MODE,*PRT_REGULATOR_MODE; enum c2h_id_8192c { @@ -460,7 +460,7 @@ struct hal_data_8192ce u32 IntrMaskToSet[2]; u32 DisabledFunctions; - + //current WIFI_PHY values u32 ReceiveConfig; u32 TransmitConfig; @@ -489,8 +489,8 @@ struct hal_data_8192ce u16 EEPROMChannelPlan; u16 EEPROMVersion; - u8 EEPROMChnlAreaTxPwrCCK[2][3]; - u8 EEPROMChnlAreaTxPwrHT40_1S[2][3]; + u8 EEPROMChnlAreaTxPwrCCK[2][3]; + u8 EEPROMChnlAreaTxPwrHT40_1S[2][3]; u8 EEPROMChnlAreaTxPwrHT40_2SDiff[2][3]; u8 EEPROMPwrLimitHT20[3]; u8 EEPROMPwrLimitHT40[3]; @@ -508,7 +508,7 @@ struct hal_data_8192ce u8 TxPwrLevelCck[RF_PATH_MAX][CHANNEL_MAX_NUMBER]; u8 TxPwrLevelHT40_1S[RF_PATH_MAX][CHANNEL_MAX_NUMBER]; // For HT 40MHZ pwr - u8 TxPwrLevelHT40_2S[RF_PATH_MAX][CHANNEL_MAX_NUMBER]; // For HT 40MHZ pwr + u8 TxPwrLevelHT40_2S[RF_PATH_MAX][CHANNEL_MAX_NUMBER]; // For HT 40MHZ pwr u8 TxPwrHt20Diff[RF_PATH_MAX][CHANNEL_MAX_NUMBER];// HT 20<->40 Pwr diff u8 TxPwrLegacyHtDiff[RF_PATH_MAX][CHANNEL_MAX_NUMBER];// For HT<->legacy pwr diff // For power group @@ -517,11 +517,11 @@ struct hal_data_8192ce u8 LegacyHTTxPowerDiff;// Legacy to HT rate power diff - BOOLEAN EepromOrEfuse; + BOOLEAN EepromOrEfuse; u8 EfuseMap[2][HWSET_MAX_SIZE_512]; //92C:256bytes, 88E:512bytes, we use union set (512bytes) u8 EfuseUsedPercentage; EFUSE_HAL EfuseHal; - + #ifdef CONFIG_BT_COEXIST struct btcoexist_priv bt_coexist; #endif @@ -545,7 +545,7 @@ struct hal_data_8192ce u8 bLedOpenDrain; // Support Open-drain arrangement for controlling the LED. Added by Roger, 2009.10.16. //u32 TxPowerTrackControl; u8 b1x1RecvCombine; // for 1T1R receive combining - + u32 AcParam_BE; //Original parameter for BE, use for EDCA turbo. //vivi, for tx power tracking, 20080407 @@ -556,9 +556,9 @@ struct hal_data_8192ce u8 CurrentOfdm24GTxPwrIdx; BB_REGISTER_DEFINITION_T PHYRegDef[4]; //Radio A/B/C/D - + u32 RfRegChnlVal[2]; - + //RDG enable BOOLEAN bRDGEnable; @@ -571,8 +571,8 @@ struct hal_data_8192ce u32 RegBcnCtrlVal; u8 RegFwHwTxQCtrl; u8 RegReg542; - u8 CurAntenna; - + u8 CurAntenna; + //### ODM-DUPLICATE CODE ### u8 AntDivCfg; /* @@ -592,9 +592,9 @@ struct hal_data_8192ce u32 OFDM_Ant2_Cnt; #endif */ -//### ODM-DUPLICATE CODE ### +//### ODM-DUPLICATE CODE ### struct dm_priv dmpriv; - DM_ODM_T odmpriv; + DM_ODM_T odmpriv; //_lock odm_stainfo_lock; u8 bDumpRxPkt;//for debug #ifdef DBG_CONFIG_ERROR_DETECT @@ -607,7 +607,7 @@ struct hal_data_8192ce u8 FwRsvdPageStartOffset; //2010.06.23. Added by tynli. Reserve page start offset except beacon in TxQ. u16 EfuseUsedBytes; - + #ifdef CONFIG_P2P struct P2P_PS_Offload_t p2p_ps_offload; #endif //CONFIG_P2P @@ -682,7 +682,7 @@ struct hal_data_8192cu u8 TxPwrLevelCck[RF_PATH_MAX][CHANNEL_MAX_NUMBER]; u8 TxPwrLevelHT40_1S[RF_PATH_MAX][CHANNEL_MAX_NUMBER]; // For HT 40MHZ pwr - u8 TxPwrLevelHT40_2S[RF_PATH_MAX][CHANNEL_MAX_NUMBER]; // For HT 40MHZ pwr + u8 TxPwrLevelHT40_2S[RF_PATH_MAX][CHANNEL_MAX_NUMBER]; // For HT 40MHZ pwr s8 TxPwrHt20Diff[RF_PATH_MAX][CHANNEL_MAX_NUMBER];// HT 20<->40 Pwr diff u8 TxPwrLegacyHtDiff[RF_PATH_MAX][CHANNEL_MAX_NUMBER];// For HT<->legacy pwr diff // For power group @@ -737,19 +737,19 @@ struct hal_data_8192cu u32 RegBcnCtrlVal; u8 RegFwHwTxQCtrl; u8 RegReg542; - + struct dm_priv dmpriv; - DM_ODM_T odmpriv; + DM_ODM_T odmpriv; //_lock odm_stainfo_lock; #ifdef DBG_CONFIG_ERROR_DETECT struct sreset_priv srestpriv; -#endif +#endif #ifdef CONFIG_BT_COEXIST struct btcoexist_priv bt_coexist; #endif - u8 CurAntenna; - + u8 CurAntenna; + /*****ODM duplicate data********/ u8 AntDivCfg; /* @@ -812,11 +812,11 @@ struct hal_data_8192cu u16 EfuseUsedBytes; - BOOLEAN EepromOrEfuse; + BOOLEAN EepromOrEfuse; u8 EfuseMap[2][HWSET_MAX_SIZE_512]; //92C:256bytes, 88E:512bytes, we use union set (512bytes) u8 EfuseUsedPercentage; EFUSE_HAL EfuseHal; - + #ifdef CONFIG_P2P struct P2P_PS_Offload_t p2p_ps_offload; @@ -846,4 +846,3 @@ void rtl8192c_set_hal_ops(struct hal_ops *pHalFunc); s32 c2h_id_filter_ccx_8192c(u8 id); #endif - diff --git a/include/rtl8192c_led.h b/include/rtl8192c_led.h index 0cdc87d..4141122 100755 --- a/include/rtl8192c_led.h +++ b/include/rtl8192c_led.h @@ -1,7 +1,7 @@ /****************************************************************************** * * 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. @@ -16,27 +16,26 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA * * - ******************************************************************************/ -#ifndef __RTL8192C_LED_H_ -#define __RTL8192C_LED_H_ - -#include -#include -#include - - -//================================================================================ -// Interface to manipulate LED objects. -//================================================================================ -#ifdef CONFIG_USB_HCI -void rtl8192cu_InitSwLeds(struct adapter *padapter); -void rtl8192cu_DeInitSwLeds(struct adapter *padapter); -#endif -#ifdef CONFIG_PCI_HCI -void rtl8192ce_gen_RefreshLedState(struct adapter *Adapter); -void rtl8192ce_InitSwLeds(struct adapter *padapter); -void rtl8192ce_DeInitSwLeds(struct adapter *padapter); -#endif - -#endif - + ******************************************************************************/ +#ifndef __RTL8192C_LED_H_ +#define __RTL8192C_LED_H_ + +#include +#include +#include + + +//================================================================================ +// Interface to manipulate LED objects. +//================================================================================ +#ifdef CONFIG_USB_HCI +void rtl8192cu_InitSwLeds(struct adapter *padapter); +void rtl8192cu_DeInitSwLeds(struct adapter *padapter); +#endif +#ifdef CONFIG_PCI_HCI +void rtl8192ce_gen_RefreshLedState(struct adapter *Adapter); +void rtl8192ce_InitSwLeds(struct adapter *padapter); +void rtl8192ce_DeInitSwLeds(struct adapter *padapter); +#endif + +#endif diff --git a/include/rtl8192c_recv.h b/include/rtl8192c_recv.h index 55651d6..698db8a 100755 --- a/include/rtl8192c_recv.h +++ b/include/rtl8192c_recv.h @@ -1,7 +1,7 @@ /****************************************************************************** * * 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. @@ -34,7 +34,7 @@ #if defined(CONFIG_GSPI_HCI) #define NR_RECVBUFF (32) #elif defined(CONFIG_SDIO_HCI) - #define NR_RECVBUFF (8) + #define NR_RECVBUFF (8) #else #ifdef CONFIG_SINGLE_RECV_BUF #define NR_RECVBUFF (1) @@ -144,4 +144,3 @@ void rtl8192c_translate_rx_signal_stuff(union recv_frame *precvframe, struct phy void rtl8192c_query_rx_desc_status(union recv_frame *precvframe, struct recv_stat *pdesc); #endif - diff --git a/include/rtl8192c_rf.h b/include/rtl8192c_rf.h index 213a1b4..2588f88 100755 --- a/include/rtl8192c_rf.h +++ b/include/rtl8192c_rf.h @@ -1,7 +1,7 @@ /****************************************************************************** * * 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. @@ -16,77 +16,76 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA * * - ******************************************************************************/ -/****************************************************************************** - * - * - * Module: rtl8192c_rf.h ( Header File) - * - * Note: Collect every HAL RF type exter API or constant. - * - * Function: - * - * Export: - * - * Abbrev: - * - * History: - * Data Who Remark - * - * 09/25/2008 MHC Create initial version. - * - * -******************************************************************************/ -#ifndef _RTL8192C_RF_H_ -#define _RTL8192C_RF_H_ -/* Check to see if the file has been included already. */ - - -/*--------------------------Define Parameters-------------------------------*/ - -// -// For RF 6052 Series -// -#define RF6052_MAX_TX_PWR 0x3F -#define RF6052_MAX_REG 0x3F -#define RF6052_MAX_PATH 2 -/*--------------------------Define Parameters-------------------------------*/ - - -/*------------------------------Define structure----------------------------*/ - -/*------------------------------Define structure----------------------------*/ - - -/*------------------------Export global variable----------------------------*/ -/*------------------------Export global variable----------------------------*/ - -/*------------------------Export Marco Definition---------------------------*/ - -/*------------------------Export Marco Definition---------------------------*/ - - -/*--------------------------Exported Function prototype---------------------*/ - -// -// RF RL6052 Series API -// -void rtl8192c_RF_ChangeTxPath( IN struct adapter *Adapter, - IN u16 DataRate); -void rtl8192c_PHY_RF6052SetBandwidth( - IN struct adapter * Adapter, - IN HT_CHANNEL_WIDTH Bandwidth); -VOID rtl8192c_PHY_RF6052SetCckTxPower( - IN struct adapter *Adapter, - IN u8* pPowerlevel); -VOID rtl8192c_PHY_RF6052SetOFDMTxPower( - IN struct adapter *Adapter, - IN u8* pPowerLevel, - IN u8 Channel); -int PHY_RF6052_Config8192C( IN struct adapter * Adapter ); - -/*--------------------------Exported Function prototype---------------------*/ - - -#endif/* End of HalRf.h */ - + ******************************************************************************/ +/****************************************************************************** + * + * + * Module: rtl8192c_rf.h ( Header File) + * + * Note: Collect every HAL RF type exter API or constant. + * + * Function: + * + * Export: + * + * Abbrev: + * + * History: + * Data Who Remark + * + * 09/25/2008 MHC Create initial version. + * + * +******************************************************************************/ +#ifndef _RTL8192C_RF_H_ +#define _RTL8192C_RF_H_ +/* Check to see if the file has been included already. */ + + +/*--------------------------Define Parameters-------------------------------*/ + +// +// For RF 6052 Series +// +#define RF6052_MAX_TX_PWR 0x3F +#define RF6052_MAX_REG 0x3F +#define RF6052_MAX_PATH 2 +/*--------------------------Define Parameters-------------------------------*/ + + +/*------------------------------Define structure----------------------------*/ + +/*------------------------------Define structure----------------------------*/ + + +/*------------------------Export global variable----------------------------*/ +/*------------------------Export global variable----------------------------*/ + +/*------------------------Export Marco Definition---------------------------*/ + +/*------------------------Export Marco Definition---------------------------*/ + + +/*--------------------------Exported Function prototype---------------------*/ + +// +// RF RL6052 Series API +// +void rtl8192c_RF_ChangeTxPath( IN struct adapter *Adapter, + IN u16 DataRate); +void rtl8192c_PHY_RF6052SetBandwidth( + IN struct adapter * Adapter, + IN HT_CHANNEL_WIDTH Bandwidth); +VOID rtl8192c_PHY_RF6052SetCckTxPower( + IN struct adapter *Adapter, + IN u8* pPowerlevel); +VOID rtl8192c_PHY_RF6052SetOFDMTxPower( + IN struct adapter *Adapter, + IN u8* pPowerLevel, + IN u8 Channel); +int PHY_RF6052_Config8192C( IN struct adapter * Adapter ); + +/*--------------------------Exported Function prototype---------------------*/ + + +#endif/* End of HalRf.h */ diff --git a/include/rtl8192c_spec.h b/include/rtl8192c_spec.h index ce88b02..dd7d451 100755 --- a/include/rtl8192c_spec.h +++ b/include/rtl8192c_spec.h @@ -1,7 +1,7 @@ /****************************************************************************** * * 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. @@ -168,7 +168,7 @@ // //----------------------------------------------------- #define REG_PCIE_CTRL_REG 0x0300 -#define REG_INT_MIG 0x0304 // Interrupt Migration +#define REG_INT_MIG 0x0304 // Interrupt Migration #define REG_BCNQ_DESA 0x0308 // TX Beacon Descriptor Address #define REG_HQ_DESA 0x0310 // TX High Queue Descriptor Address #define REG_MGQ_DESA 0x0318 // TX Manage Queue Descriptor Address @@ -284,7 +284,7 @@ #define REG_ATIMWND 0x055A #define REG_BCN_MAX_ERR 0x055D #define REG_RXTSF_OFFSET_CCK 0x055E -#define REG_RXTSF_OFFSET_OFDM 0x055F +#define REG_RXTSF_OFFSET_OFDM 0x055F #define REG_TSFTR 0x0560 #define REG_TSFTR1 0x0568 #define REG_INIT_TSFTR 0x0564 @@ -453,14 +453,14 @@ #define InvalidBBRFValue 0x12345678 // Min Spacing related settings. -#define MAX_MSS_DENSITY_2T 0x13 -#define MAX_MSS_DENSITY_1T 0x0A +#define MAX_MSS_DENSITY_2T 0x13 +#define MAX_MSS_DENSITY_1T 0x0A //---------------------------------------------------------------------------- // 8192C Cmd9346CR bits (Offset 0xA, 16bit) //---------------------------------------------------------------------------- #define CmdEEPROM_En BIT5 // EEPROM enable when set 1 -#define CmdEERPOMSEL BIT4 // System EEPROM select, 0: boot from E-FUSE, 1: The EEPROM used is 9346 +#define CmdEERPOMSEL BIT4 // System EEPROM select, 0: boot from E-FUSE, 1: The EEPROM used is 9346 #define Cmd9346CR_9356SEL BIT4 #define AutoLoadEEPROM (CmdEEPROM_En|CmdEERPOMSEL) #define AutoLoadEFUSE CmdEEPROM_En @@ -480,7 +480,7 @@ #define GPIO_MOD (REG_GPIO_PIN_CTRL+3) //---------------------------------------------------------------------------- -// 8192C (MSR) Media Status Register (Offset 0x4C, 8 bits) +// 8192C (MSR) Media Status Register (Offset 0x4C, 8 bits) //---------------------------------------------------------------------------- /* Network Type @@ -508,16 +508,16 @@ Default: 00b. #define RRSR_RSC_LOWSUBCHNL 0x200000 #define RRSR_SHORT 0x800000 #define RRSR_1M BIT0 -#define RRSR_2M BIT1 -#define RRSR_5_5M BIT2 -#define RRSR_11M BIT3 -#define RRSR_6M BIT4 -#define RRSR_9M BIT5 -#define RRSR_12M BIT6 -#define RRSR_18M BIT7 -#define RRSR_24M BIT8 -#define RRSR_36M BIT9 -#define RRSR_48M BIT10 +#define RRSR_2M BIT1 +#define RRSR_5_5M BIT2 +#define RRSR_11M BIT3 +#define RRSR_6M BIT4 +#define RRSR_9M BIT5 +#define RRSR_12M BIT6 +#define RRSR_18M BIT7 +#define RRSR_24M BIT8 +#define RRSR_36M BIT9 +#define RRSR_48M BIT10 #define RRSR_54M BIT11 #define RRSR_MCS0 BIT12 #define RRSR_MCS1 BIT13 @@ -527,7 +527,7 @@ Default: 00b. #define RRSR_MCS5 BIT17 #define RRSR_MCS6 BIT18 #define RRSR_MCS7 BIT19 -#define BRSR_AckShortPmb BIT23 +#define BRSR_AckShortPmb BIT23 // CCK ACK: use Short Preamble or not //---------------------------------------------------------------------------- @@ -545,20 +545,20 @@ Default: 00b. #define CAM_NOTVALID 0x0000 #define CAM_USEDK BIT5 -#define CAM_CONTENT_COUNT 8 - +#define CAM_CONTENT_COUNT 8 + #define CAM_NONE 0x0 #define CAM_WEP40 0x01 #define CAM_TKIP 0x02 #define CAM_AES 0x04 #define CAM_WEP104 0x05 - + #define TOTAL_CAM_ENTRY 32 -#define HALF_CAM_ENTRY 16 - +#define HALF_CAM_ENTRY 16 + #define CAM_CONFIG_USEDK _TRUE #define CAM_CONFIG_NO_USEDK _FALSE - + #define CAM_WRITE BIT16 #define CAM_READ 0x00000000 #define CAM_POLLINIG BIT31 @@ -593,7 +593,7 @@ Default: 00b. #define IMR_TIMEOUT2 BIT17 // Timeout interrupt 2 #define IMR_TIMEOUT1 BIT16 // Timeout interrupt 1 #define IMR_TXFOVW BIT15 // Transmit FIFO Overflow -#define IMR_PSTIMEOUT BIT14 // Power save time out interrupt +#define IMR_PSTIMEOUT BIT14 // Power save time out interrupt #define IMR_BcnInt BIT13 // Beacon DMA Interrupt 0 #define IMR_RXFOVW BIT12 // Receive FIFO Overflow #define IMR_RDU BIT11 // Receive Descriptor Unavailable @@ -683,7 +683,7 @@ Default: 00b. #define EEPROM_CID_TOSHIBA 0x4 #define EEPROM_CID_CCX 0x10 // CCX test. By Bruce, 2009-02-25. #define EEPROM_CID_QMI 0x0D -#define EEPROM_CID_WHQL 0xFE // added by chiyoko for dtm, 20090108 +#define EEPROM_CID_WHQL 0xFE // added by chiyoko for dtm, 20090108 #define RTL_EEPROM_ID 0x8129 @@ -725,7 +725,7 @@ typedef enum _INTERFACE_SELECT_8192CPCIe{ #define EEPROM_HT40_MAX_PWR_OFFSET 0x6F #define EEPROM_HT20_MAX_PWR_OFFSET 0x72 -#define EEPROM_CHANNEL_PLAN 0x75 +#define EEPROM_CHANNEL_PLAN 0x75 #define EEPROM_TSSI_A 0x76 #define EEPROM_TSSI_B 0x77 #define EEPROM_THERMAL_METER 0x78 @@ -738,16 +738,16 @@ typedef enum _INTERFACE_SELECT_8192CPCIe{ #define EEPROM_NORMAL_BoardType EEPROM_RF_OPT1 //[7:5] -#endif +#endif #ifdef CONFIG_USB_HCI //should be renamed and moved to another file typedef enum _BOARD_TYPE_8192CUSB{ - BOARD_USB_DONGLE = 0, // USB dongle - BOARD_USB_High_PA = 1, // USB dongle with high power PA - BOARD_MINICARD = 2, // Minicard - BOARD_USB_SOLO = 3, // USB solo-Slim module + BOARD_USB_DONGLE = 0, // USB dongle + BOARD_USB_High_PA = 1, // USB dongle with high power PA + BOARD_MINICARD = 2, // Minicard + BOARD_USB_SOLO = 3, // USB solo-Slim module BOARD_USB_COMBO = 4, // USB Combo-Slim module } BOARD_TYPE_8192CUSB, *PBOARD_TYPE_8192CUSB; @@ -817,7 +817,7 @@ typedef enum _BOARD_TYPE_8192CUSB{ #define EEPROM_TxPowerCCK 0x5A // CCK Tx Power -// 2009/02/09 Cosa Add for SD3 requirement +// 2009/02/09 Cosa Add for SD3 requirement #define EEPROM_TX_PWR_HT20_DIFF 0x6e// HT20 Tx Power Index Difference #define DEFAULT_HT20_TXPWR_DIFF 2 // HT20<->40 default Tx Power Index Difference #define EEPROM_TX_PWR_OFDM_DIFF 0x71// OFDM Tx Power Index Difference @@ -908,7 +908,7 @@ typedef enum _BOARD_TYPE_8192CUSB{ #define EEPROM_CID_DEFAULT 0x0 -#define EEPROM_CID_WHQL 0xFE // added by chiyoko for dtm, 20090108 +#define EEPROM_CID_WHQL 0xFE // added by chiyoko for dtm, 20090108 #define EEPROM_CID_CCX 0x10 // CCX test. By Bruce, 2009-02-25. @@ -919,7 +919,7 @@ typedef enum _BOARD_TYPE_8192CUSB{ /*=================================================================== ===================================================================== -Here the register defines are for 92C. When the define is as same with 92C, +Here the register defines are for 92C. When the define is as same with 92C, we will use the 92C's define for the consistency So the following defines for 92C is not entire!!!!!! ===================================================================== @@ -956,23 +956,23 @@ Current IOREG MAP #define RCR_ACF BIT12 //Accept control type frame #define RCR_ADF BIT11 //Accept data type frame #define RCR_AICV BIT9 //Accept ICV error packet -#define RCR_ACRC32 BIT8 //Accept CRC32 error packet +#define RCR_ACRC32 BIT8 //Accept CRC32 error packet #define RCR_CBSSID_BCN BIT7 //Accept BSSID match packet (Rx beacon, probe rsp) #define RCR_CBSSID_DATA BIT6 //Accept BSSID match packet (Data) #define RCR_CBSSID RCR_CBSSID_DATA //Accept BSSID match packet #define RCR_APWRMGT BIT5 //Accept power management packet #define RCR_ADD3 BIT4 //Accept address 3 match packet -#define RCR_AB BIT3 //Accept broadcast packet -#define RCR_AM BIT2 //Accept multicast packet +#define RCR_AB BIT3 //Accept broadcast packet +#define RCR_AM BIT2 //Accept multicast packet #define RCR_APM BIT1 //Accept physical match packet -#define RCR_AAP BIT0 //Accept all unicast packet +#define RCR_AAP BIT0 //Accept all unicast packet #define RCR_MXDMA_OFFSET 8 #define RCR_FIFO_OFFSET 13 //============================================================================ -// 8192c USB specific Regsiter Offset and Content definition, +// 8192c USB specific Regsiter Offset and Content definition, // 2009.08.18, added by vivi. for merge 92c and 92C into one driver //============================================================================ //#define APS_FSMCO 0x0004 same with 92Ce @@ -1003,7 +1003,7 @@ Current IOREG MAP #define InvalidBBRFValue 0x12345678 //============================================================================ -// 8192C Regsiter Bit and Content definition +// 8192C Regsiter Bit and Content definition //============================================================================ //----------------------------------------------------- // @@ -1094,16 +1094,16 @@ Current IOREG MAP //2 9346CR -#define EEDO BIT(0) -#define EEDI BIT(1) -#define EESK BIT(2) -#define EECS BIT(3) -//#define EERPROMSEL BIT(4) -//#define EEPROM_EN BIT(5) +#define EEDO BIT(0) +#define EEDI BIT(1) +#define EESK BIT(2) +#define EECS BIT(3) +//#define EERPROMSEL BIT(4) +//#define EEPROM_EN BIT(5) #define BOOT_FROM_EEPROM BIT(4) #define EEPROM_EN BIT(5) -#define EEM0 BIT(6) -#define EEM1 BIT(7) +#define EEM0 BIT(6) +#define EEM1 BIT(7) //2 AFE_MISC @@ -1216,7 +1216,7 @@ Current IOREG MAP #define EFUSE_ACCESS_ON 0x69 // For RTL8723 only. #define EFUSE_ACCESS_OFF 0x00 // For RTL8723 only. -//2 PWR_DATA +//2 PWR_DATA //2 CAL_TIMER @@ -1247,10 +1247,10 @@ Current IOREG MAP //2 GPIO_INTM //2 LEDCFG -#define LED0PL BIT(4) +#define LED0PL BIT(4) #define LED0DIS BIT(7) #define LED1DIS BIT(15) -#define LED1PL BIT(12) +#define LED1PL BIT(12) #define SECCAM_CLR BIT(30) @@ -1303,7 +1303,7 @@ Current IOREG MAP //2REG_GPIO_OUTSTS (For RTL8723 only) #define EFS_HCI_SEL (BIT(0)|BIT(1)) #define PAD_HCI_SEL (BIT(2)|BIT(3)) -#define HCI_SEL (BIT(4)|BIT(5)) +#define HCI_SEL (BIT(4)|BIT(5)) #define PKG_SEL_HCI BIT(6) #define FEN_GPS BIT(7) #define FEN_BT BIT(8) @@ -1397,12 +1397,12 @@ Current IOREG MAP #define HQSEL_HIQ BIT(5) // For normal driver, 0x10C -#define _TXDMA_HIQ_MAP(x) (((x)&0x3) << 14) -#define _TXDMA_MGQ_MAP(x) (((x)&0x3) << 12) -#define _TXDMA_BKQ_MAP(x) (((x)&0x3) << 10) -#define _TXDMA_BEQ_MAP(x) (((x)&0x3) << 8 ) -#define _TXDMA_VIQ_MAP(x) (((x)&0x3) << 6 ) -#define _TXDMA_VOQ_MAP(x) (((x)&0x3) << 4 ) +#define _TXDMA_HIQ_MAP(x) (((x)&0x3) << 14) +#define _TXDMA_MGQ_MAP(x) (((x)&0x3) << 12) +#define _TXDMA_BKQ_MAP(x) (((x)&0x3) << 10) +#define _TXDMA_BEQ_MAP(x) (((x)&0x3) << 8 ) +#define _TXDMA_VIQ_MAP(x) (((x)&0x3) << 6 ) +#define _TXDMA_VOQ_MAP(x) (((x)&0x3) << 4 ) #define QUEUE_LOW 1 #define QUEUE_NORMAL 2 @@ -1787,4 +1787,3 @@ Current IOREG MAP #include "basic_types.h" #endif - diff --git a/include/rtl8192c_sreset.h b/include/rtl8192c_sreset.h index 3859707..160cd1f 100755 --- a/include/rtl8192c_sreset.h +++ b/include/rtl8192c_sreset.h @@ -1,7 +1,7 @@ /****************************************************************************** * * 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. @@ -16,18 +16,17 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA * * - ******************************************************************************/ -#ifndef _RTL8192C_SRESET_C_ -#define _RTL8192C_SRESET_C_ - -#include -#include -#include -#include - -#ifdef DBG_CONFIG_ERROR_DETECT -extern void rtl8192c_sreset_xmit_status_check(struct adapter *padapter); -extern void rtl8192c_sreset_linked_status_check(struct adapter *padapter); -#endif -#endif - + ******************************************************************************/ +#ifndef _RTL8192C_SRESET_C_ +#define _RTL8192C_SRESET_C_ + +#include +#include +#include +#include + +#ifdef DBG_CONFIG_ERROR_DETECT +extern void rtl8192c_sreset_xmit_status_check(struct adapter *padapter); +extern void rtl8192c_sreset_linked_status_check(struct adapter *padapter); +#endif +#endif diff --git a/include/rtl8192c_xmit.h b/include/rtl8192c_xmit.h index fc49f52..8e1b6ac 100755 --- a/include/rtl8192c_xmit.h +++ b/include/rtl8192c_xmit.h @@ -1,7 +1,7 @@ /****************************************************************************** * * 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. @@ -32,7 +32,7 @@ #define BMC BIT(24) #define LSG BIT(26) #define FSG BIT(27) -#define OWN BIT(31) +#define OWN BIT(31) //OFFSET 4 @@ -162,4 +162,3 @@ s32 rtl8192ce_hostap_mgnt_xmit_entry(struct adapter *padapter, _pkt *pkt); #endif #endif - diff --git a/include/rtl8192d_cmd.h b/include/rtl8192d_cmd.h index eb16654..b178fa8 100755 --- a/include/rtl8192d_cmd.h +++ b/include/rtl8192d_cmd.h @@ -1,7 +1,7 @@ /****************************************************************************** * * 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. @@ -22,7 +22,7 @@ //-------------------------------------------- -//3 Host Message Box +//3 Host Message Box //-------------------------------------------- // User Define Message [31:8] @@ -63,7 +63,7 @@ struct P2P_PS_Offload_t { // Description: Determine the types of H2C commands that are the same in driver and Fw. // Fisrt constructed by tynli. 2009.10.09. -typedef enum _RTL8192D_H2C_CMD +typedef enum _RTL8192D_H2C_CMD { H2C_AP_OFFLOAD = 0, /*0*/ H2C_SETPWRMODE = 1, /*1*/ @@ -99,5 +99,3 @@ void rtl8192d_set_p2p_ps_offload_cmd(struct adapter* padapter, u8 p2p_ps_state); #endif //CONFIG_P2P #endif - - diff --git a/include/rtl8192d_dm.h b/include/rtl8192d_dm.h index 9a0d6d7..837fd58 100755 --- a/include/rtl8192d_dm.h +++ b/include/rtl8192d_dm.h @@ -1,7 +1,7 @@ /****************************************************************************** * * 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. @@ -28,7 +28,7 @@ //============================================================ enum{ UP_LINK, - DOWN_LINK, + DOWN_LINK, }; /*------------------------Export global variable----------------------------*/ /*------------------------Export global variable----------------------------*/ @@ -51,13 +51,13 @@ enum{ #define IQK_Matrix_REG_NUM 8 #define IQK_Matrix_Settings_NUM 1+24+21 //###### duplicate code,will move to ODM ######### -struct dm_priv +struct dm_priv { u8 DM_Type; u8 DMFlag; u8 InitDMFlag; u32 InitODMFlag; - + //* Upper and Lower Signal threshold for Rate Adaptive*/ int UndecoratedSmoothedPWDB; int EntryMinUndecoratedSmoothedPWDB; @@ -73,22 +73,22 @@ struct dm_priv PS_T DM_PSTable; - FALSE_ALARM_STATISTICS FalseAlmCnt; - + FALSE_ALARM_STATISTICS FalseAlmCnt; + //for rate adaptive, in fact, 88c/92c fw will handle this u8 bUseRAMask; RATE_ADAPTIVE RateAdaptive; */ - + //for High Power u8 bDynamicTxPowerEnable; u8 LastDTPLvl; u8 DynamicTxHighPowerLvl;//Add by Jacken Tx Power Control for Near/Far Range 2008/03/06 - + //for tx power tracking u8 bTXPowerTracking; u8 TXPowercount; - u8 bTXPowerTrackingInit; + u8 bTXPowerTrackingInit; u8 TxPowerTrackControl; //for mp mode, turn off txpwrtracking as default u8 TM_Trigger; @@ -111,7 +111,7 @@ struct dm_priv u8 bAPKdone; u8 bAPKThermalMeterIgnore; u32 RegA24; - + //for IQK u32 Reg874; u32 RegC08; @@ -125,22 +125,22 @@ struct dm_priv u32 IQK_BB_backup[IQK_BB_REG_NUM]; u8 bCCKinCH14; - + char CCK_index; //u8 Record_CCK_20Mindex; //u8 Record_CCK_40Mindex; char OFDM_index[2]; - + BOOLEAN bDPKdone[2]; u8 PowerIndex_backup[6]; - + //for Antenna diversity //#ifdef CONFIG_ANTENNA_DIVERSITY //SWAT_T DM_SWAT_Table; //#endif //Neil Chen----2011--06--23----- - //3 Path Diversity + //3 Path Diversity BOOLEAN bPathDiv_Enable; //For 92D Non-interrupt Antenna Diversity by Neil ,add by wl.2011.07.19 BOOLEAN RSSI_test; s32 RSSI_sum_A; @@ -152,7 +152,7 @@ struct dm_priv //for TxPwrTracking int RegE94; - int RegE9C; + int RegE9C; int RegEB4; int RegEBC; #if MP_DRIVER == 1 @@ -180,4 +180,3 @@ void rtl8192d_InitHalDm(IN struct adapter *Adapter); void rtl8192d_HalDmWatchDog(IN struct adapter *Adapter); #endif //__HAL8190PCIDM_H__ - diff --git a/include/rtl8192d_hal.h b/include/rtl8192d_hal.h index e85a5da..165f3e3 100755 --- a/include/rtl8192d_hal.h +++ b/include/rtl8192d_hal.h @@ -1,7 +1,7 @@ /****************************************************************************** * * 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. @@ -33,14 +33,14 @@ #include "../hal/OUTSRC/odm_precomp.h" #ifdef CONFIG_PCI_HCI - #include + #include #define RTL819X_DEFAULT_RF_TYPE RF_2T2R //--------------------------------------------------------------------- // RTL8192DE From file //--------------------------------------------------------------------- - #define RTL8192D_FW_IMG "rtl8192DE\\rtl8192dfw.bin" + #define RTL8192D_FW_IMG "rtl8192DE\\rtl8192dfw.bin" #define RTL8192D_PHY_REG "rtl8192DE\\PHY_REG.txt" #define RTL8192D_PHY_REG_PG "rtl8192DE\\PHY_REG_PG.txt" @@ -50,7 +50,7 @@ #define RTL8192D_AGC_TAB_2G "rtl8192DE\\AGC_TAB_2G.txt" #define RTL8192D_AGC_TAB_5G "rtl8192DE\\AGC_TAB_5G.txt" #define RTL8192D_PHY_RADIO_A "rtl8192DE\\radio_a.txt" - #define RTL8192D_PHY_RADIO_B "rtl8192DE\\radio_b.txt" + #define RTL8192D_PHY_RADIO_B "rtl8192DE\\radio_b.txt" #define RTL8192D_PHY_RADIO_A_intPA "rtl8192DE\\radio_a_intPA.txt" #define RTL8192D_PHY_RADIO_B_intPA "rtl8192DE\\radio_b_intPA.txt" #define RTL8192D_PHY_MACREG "rtl8192DE\\MAC_REG.txt" @@ -59,16 +59,16 @@ // RTL8192DE From header //--------------------------------------------------------------------- // Fw Array - #define Rtl8192D_FwImageArray Rtl8192DEFwImgArray + #define Rtl8192D_FwImageArray Rtl8192DEFwImgArray // MAC/BB/PHY Array #define Rtl8192D_MAC_Array Rtl8192DEMAC_2T_Array #define Rtl8192D_AGCTAB_Array Rtl8192DEAGCTAB_Array #define Rtl8192D_AGCTAB_5GArray Rtl8192DEAGCTAB_5GArray #define Rtl8192D_AGCTAB_2GArray Rtl8192DEAGCTAB_2GArray - #define Rtl8192D_AGCTAB_2TArray Rtl8192DEAGCTAB_2TArray - #define Rtl8192D_AGCTAB_1TArray Rtl8192DEAGCTAB_1TArray - #define Rtl8192D_PHY_REG_2TArray Rtl8192DEPHY_REG_2TArray + #define Rtl8192D_AGCTAB_2TArray Rtl8192DEAGCTAB_2TArray + #define Rtl8192D_AGCTAB_1TArray Rtl8192DEAGCTAB_1TArray + #define Rtl8192D_PHY_REG_2TArray Rtl8192DEPHY_REG_2TArray #define Rtl8192D_PHY_REG_1TArray Rtl8192DEPHY_REG_1TArray #define Rtl8192D_PHY_REG_Array_PG Rtl8192DEPHY_REG_Array_PG #define Rtl8192D_PHY_REG_Array_MP Rtl8192DEPHY_REG_Array_MP @@ -77,7 +77,7 @@ #define Rtl8192D_RadioB_2TArray Rtl8192DERadioB_2TArray #define Rtl8192D_RadioB_1TArray Rtl8192DERadioB_1TArray #define Rtl8192D_RadioA_2T_intPAArray Rtl8192DERadioA_2T_intPAArray - #define Rtl8192D_RadioB_2T_intPAArray Rtl8192DERadioB_2T_intPAArray + #define Rtl8192D_RadioB_2T_intPAArray Rtl8192DERadioB_2T_intPAArray // Array length #define Rtl8192D_FwImageArrayLength Rtl8192DEImgArrayLength @@ -86,7 +86,7 @@ #define Rtl8192D_AGCTAB_2GArrayLength Rtl8192DEAGCTAB_2GArrayLength #define Rtl8192D_AGCTAB_2TArrayLength Rtl8192DEAGCTAB_2TArrayLength #define Rtl8192D_AGCTAB_1TArrayLength Rtl8192DEAGCTAB_1TArrayLength - #define Rtl8192D_AGCTAB_ArrayLength Rtl8192DEAGCTAB_ArrayLength + #define Rtl8192D_AGCTAB_ArrayLength Rtl8192DEAGCTAB_ArrayLength #define Rtl8192D_PHY_REG_2TArrayLength Rtl8192DEPHY_REG_2TArrayLength #define Rtl8192D_PHY_REG_1TArrayLength Rtl8192DEPHY_REG_1TArrayLength #define Rtl8192D_PHY_REG_Array_PGLength Rtl8192DEPHY_REG_Array_PGLength @@ -98,7 +98,7 @@ #elif defined(CONFIG_USB_HCI) - + #define RTL819X_DEFAULT_RF_TYPE RF_1T2R //--------------------------------------------------------------------- @@ -108,8 +108,8 @@ #define RTL8192D_PHY_REG "rtl8192DU\\PHY_REG.txt" #define RTL8192D_PHY_REG_PG "rtl8192DU\\PHY_REG_PG.txt" - #define RTL8192D_PHY_REG_MP "rtl8192DU\\PHY_REG_MP.txt" - + #define RTL8192D_PHY_REG_MP "rtl8192DU\\PHY_REG_MP.txt" + #define RTL8192D_AGC_TAB "rtl8192DU\\AGC_TAB.txt" #define RTL8192D_AGC_TAB_2G "rtl8192DU\\AGC_TAB_2G.txt" #define RTL8192D_AGC_TAB_5G "rtl8192DU\\AGC_TAB_5G.txt" @@ -124,16 +124,16 @@ //--------------------------------------------------------------------- // Fw Array - #define Rtl8192D_FwImageArray Rtl8192DUFwImgArray - + #define Rtl8192D_FwImageArray Rtl8192DUFwImgArray + // MAC/BB/PHY Array #define Rtl8192D_MAC_Array Rtl8192DUMAC_2T_Array #define Rtl8192D_AGCTAB_Array Rtl8192DUAGCTAB_Array #define Rtl8192D_AGCTAB_5GArray Rtl8192DUAGCTAB_5GArray #define Rtl8192D_AGCTAB_2GArray Rtl8192DUAGCTAB_2GArray - #define Rtl8192D_AGCTAB_2TArray Rtl8192DUAGCTAB_2TArray - #define Rtl8192D_AGCTAB_1TArray Rtl8192DUAGCTAB_1TArray - #define Rtl8192D_PHY_REG_2TArray Rtl8192DUPHY_REG_2TArray + #define Rtl8192D_AGCTAB_2TArray Rtl8192DUAGCTAB_2TArray + #define Rtl8192D_AGCTAB_1TArray Rtl8192DUAGCTAB_1TArray + #define Rtl8192D_PHY_REG_2TArray Rtl8192DUPHY_REG_2TArray #define Rtl8192D_PHY_REG_1TArray Rtl8192DUPHY_REG_1TArray #define Rtl8192D_PHY_REG_Array_PG Rtl8192DUPHY_REG_Array_PG #define Rtl8192D_PHY_REG_Array_MP Rtl8192DUPHY_REG_Array_MP @@ -142,8 +142,8 @@ #define Rtl8192D_RadioB_2TArray Rtl8192DURadioB_2TArray #define Rtl8192D_RadioB_1TArray Rtl8192DURadioB_1TArray #define Rtl8192D_RadioA_2T_intPAArray Rtl8192DURadioA_2T_intPAArray - #define Rtl8192D_RadioB_2T_intPAArray Rtl8192DURadioB_2T_intPAArray - + #define Rtl8192D_RadioB_2T_intPAArray Rtl8192DURadioB_2T_intPAArray + // Array length #define Rtl8192D_FwImageArrayLength Rtl8192DUImgArrayLength #define Rtl8192D_MAC_ArrayLength Rtl8192DUMAC_2T_ArrayLength @@ -151,14 +151,14 @@ #define Rtl8192D_AGCTAB_2GArrayLength Rtl8192DUAGCTAB_2GArrayLength #define Rtl8192D_AGCTAB_2TArrayLength Rtl8192DUAGCTAB_2TArrayLength #define Rtl8192D_AGCTAB_1TArrayLength Rtl8192DUAGCTAB_1TArrayLength - #define Rtl8192D_AGCTAB_ArrayLength Rtl8192DUAGCTAB_ArrayLength + #define Rtl8192D_AGCTAB_ArrayLength Rtl8192DUAGCTAB_ArrayLength #define Rtl8192D_PHY_REG_2TArrayLength Rtl8192DUPHY_REG_2TArrayLength #define Rtl8192D_PHY_REG_1TArrayLength Rtl8192DUPHY_REG_1TArrayLength #define Rtl8192D_PHY_REG_Array_PGLength Rtl8192DUPHY_REG_Array_PGLength #define Rtl8192D_PHY_REG_Array_MPLength Rtl8192DUPHY_REG_Array_MPLength #define Rtl8192D_RadioA_2TArrayLength Rtl8192DURadioA_2TArrayLength #define Rtl8192D_RadioB_2TArrayLength Rtl8192DURadioB_2TArrayLength - #define Rtl8192D_RadioA_2T_intPAArrayLength Rtl8192DURadioA_2T_intPAArrayLength + #define Rtl8192D_RadioA_2T_intPAArrayLength Rtl8192DURadioA_2T_intPAArrayLength #define Rtl8192D_RadioB_2T_intPAArrayLength Rtl8192DURadioB_2T_intPAArrayLength // The file name "_2T" is for 92CU, "_1T" is for 88CU. Modified by tynli. 2009.11.24. @@ -171,12 +171,12 @@ #define Rtl819XPHY_REG_1TArray Rtl8192DUPHY_REG_1TArray #define Rtl819XRadioA_2TArray Rtl8192DURadioA_2TArray #define Rtl819XRadioA_1TArray Rtl8192DURadioA_1TArray - #define Rtl819XRadioA_2T_intPAArray Rtl8192DURadioA_2T_intPAArray + #define Rtl819XRadioA_2T_intPAArray Rtl8192DURadioA_2T_intPAArray #define Rtl819XRadioB_2TArray Rtl8192DURadioB_2TArray #define Rtl819XRadioB_1TArray Rtl8192DURadioB_1TArray - #define Rtl819XRadioB_2T_intPAArray Rtl8192DURadioB_2T_intPAArray - #define Rtl819XPHY_REG_Array_PG Rtl8192DUPHY_REG_Array_PG - #define Rtl819XPHY_REG_Array_MP Rtl8192DUPHY_REG_Array_MP + #define Rtl819XRadioB_2T_intPAArray Rtl8192DURadioB_2T_intPAArray + #define Rtl819XPHY_REG_Array_PG Rtl8192DUPHY_REG_Array_PG + #define Rtl819XPHY_REG_Array_MP Rtl8192DUPHY_REG_Array_MP #define Rtl819XAGCTAB_2TArray Rtl8192DUAGCTAB_2TArray #define Rtl819XAGCTAB_1TArray Rtl8192DUAGCTAB_1TArray*/ @@ -187,7 +187,7 @@ #define PageNum_128(_Len) (u32)(((_Len)>>7) + ((_Len)&0x7F ? 1:0)) // -// Check if FW header exists. We do not consider the lower 4 bits in this case. +// Check if FW header exists. We do not consider the lower 4 bits in this case. // By tynli. 2009.12.04. // #define IS_FW_HEADER_EXIST(_pFwHdr) ((le16_to_cpu(_pFwHdr->Signature)&0xFFF0) == 0x92C0 ||\ @@ -251,7 +251,7 @@ typedef struct _RT_8192D_FIRMWARE_HDR {//8-byte alinment required #define BCN_DMA_ATIME_INT_TIME 0x02 typedef enum _BT_CoType{ - BT_2Wire = 0, + BT_2Wire = 0, BT_ISSC_3Wire = 1, BT_Accel = 2, BT_CSR = 3, @@ -260,12 +260,12 @@ typedef enum _BT_CoType{ } BT_CoType, *PBT_CoType; typedef enum _BT_CurState{ - BT_OFF = 0, + BT_OFF = 0, BT_ON = 1, } BT_CurState, *PBT_CurState; typedef enum _BT_ServiceType{ - BT_SCO = 0, + BT_SCO = 0, BT_A2DP = 1, BT_HID = 2, BT_HID_Idle = 3, @@ -277,7 +277,7 @@ typedef enum _BT_ServiceType{ } BT_ServiceType, *PBT_ServiceType; typedef enum _BT_RadioShared{ - BT_Radio_Shared = 0, + BT_Radio_Shared = 0, BT_Radio_Individual = 1, } BT_RadioShared, *PBT_RadioShared; @@ -289,7 +289,7 @@ typedef struct _BT_COEXIST_STR{ u8 BT_CUR_State; //0:on, 1:off u8 BT_Ant_isolation; //0:good, 1:bad u8 BT_PapeCtrl; //0:SW, 1:SW/HW dynamic - u8 BT_Service; + u8 BT_Service; u8 BT_RadioSharedType; u8 Ratio_Tx; u8 Ratio_PRI; @@ -410,12 +410,12 @@ typedef struct _TxPowerInfo{ // 9bytes + 1byt + 5bytes and pre 1byte. // For worst case: // | 2byte|----8bytes----|1byte|--7bytes--| //92D -#define EFUSE_OOB_PROTECT_BYTES 18 // PG data exclude header, dummy 7 bytes frome CP test and reserved 1byte. +#define EFUSE_OOB_PROTECT_BYTES 18 // PG data exclude header, dummy 7 bytes frome CP test and reserved 1byte. typedef enum _PA_MODE { PA_MODE_EXTERNAL = 0x00, PA_MODE_INTERNAL_SP3T = 0x01, - PA_MODE_INTERNAL_SPDT = 0x02 + PA_MODE_INTERNAL_SPDT = 0x02 } PA_MODE; /* Copy from rtl8192c */ @@ -437,8 +437,8 @@ enum c2h_id_8192d { #ifdef CONFIG_PCI_HCI struct hal_data_8192de { - HAL_VERSION VersionID; - // add for 92D Phy mode/mac/Band mode + HAL_VERSION VersionID; + // add for 92D Phy mode/mac/Band mode MACPHY_MODE_8192D MacPhyMode92D; BAND_TYPE CurrentBandType92D; //0:2.4G, 1:5G BAND_TYPE BandSet92D; @@ -498,7 +498,7 @@ struct hal_data_8192de u8 TxPwrLevelCck[RF_PATH_MAX][CHANNEL_MAX_NUMBER_2G]; u8 TxPwrLevelHT40_1S[RF_PATH_MAX][CHANNEL_MAX_NUMBER]; // For HT 40MHZ pwr - u8 TxPwrLevelHT40_2S[RF_PATH_MAX][CHANNEL_MAX_NUMBER]; // For HT 40MHZ pwr + u8 TxPwrLevelHT40_2S[RF_PATH_MAX][CHANNEL_MAX_NUMBER]; // For HT 40MHZ pwr s8 TxPwrHt20Diff[RF_PATH_MAX][CHANNEL_MAX_NUMBER];// HT 20<->40 Pwr diff u8 TxPwrLegacyHtDiff[RF_PATH_MAX][CHANNEL_MAX_NUMBER];// For HT<->legacy pwr diff // For power group @@ -543,7 +543,7 @@ struct hal_data_8192de u8 CurrentOfdm24GTxPwrIdx; BB_REGISTER_DEFINITION_T PHYRegDef[4]; //Radio A/B/C/D - + u32 RfRegChnlVal[2]; @@ -568,7 +568,7 @@ struct hal_data_8192de #else //regc80¡¢regc94¡¢regc4c¡¢regc88¡¢regc9c¡¢regc14¡¢regca0¡¢regc1c¡¢regc78 u4Byte IQKMatrixReg[IQK_Matrix_REG_NUM]; - IQK_MATRIX_REGS_SETTING IQKMatrixRegSetting[IQK_Matrix_Settings_NUM]; // 1->2G,24->5G 20M channel,21->5G 40M channel. + IQK_MATRIX_REGS_SETTING IQKMatrixRegSetting[IQK_Matrix_Settings_NUM]; // 1->2G,24->5G 20M channel,21->5G 40M channel. #endif //for host message to fw @@ -581,9 +581,9 @@ struct hal_data_8192de u8 RegFwHwTxQCtrl; u8 RegReg542; u8 RegCR_1; - + struct dm_priv dmpriv; - DM_ODM_T odmpriv; + DM_ODM_T odmpriv; //_lock odm_stainfo_lock; u8 bInterruptMigration; @@ -595,8 +595,8 @@ struct hal_data_8192de u16 RegRRSR; u16 EfuseUsedBytes; - - BOOLEAN EepromOrEfuse; + + BOOLEAN EepromOrEfuse; u8 EfuseMap[2][HWSET_MAX_SIZE_512]; //92C:256bytes, 88E:512bytes, we use union set (512bytes) u8 EfuseUsedPercentage; EFUSE_HAL EfuseHal; @@ -630,7 +630,7 @@ VOID UpdateInterruptMask8192DE(struct adapter *Adapter, u32 AddMSR, u32 RemoveMS //should be renamed and moved to another file typedef enum _INTERFACE_SELECT_8192DUSB{ - INTF_SEL0_USB = 0, // USB + INTF_SEL0_USB = 0, // USB INTF_SEL1_MINICARD = 1, // Minicard INTF_SEL2_EKB_PRO = 2, // Eee keyboard proprietary INTF_SEL3_PRO = 3, // Customized proprietary @@ -640,9 +640,9 @@ typedef INTERFACE_SELECT_8192DUSB INTERFACE_SELECT_USB; struct hal_data_8192du { - HAL_VERSION VersionID; + HAL_VERSION VersionID; - // add for 92D Phy mode/mac/Band mode + // add for 92D Phy mode/mac/Band mode MACPHY_MODE_8192D MacPhyMode92D; BAND_TYPE CurrentBandType92D; //0:2.4G, 1:5G BAND_TYPE BandSet92D; @@ -687,7 +687,7 @@ struct hal_data_8192du u16 EEPROMSVID; u16 EEPROMSDID; u8 EEPROMCustomerID; - u8 EEPROMSubCustomerID; + u8 EEPROMSubCustomerID; u8 EEPROMRegulatory; u8 EEPROMThermalMeter; @@ -698,7 +698,7 @@ struct hal_data_8192du u8 TxPwrLevelCck[RF_PATH_MAX][CHANNEL_MAX_NUMBER_2G]; u8 TxPwrLevelHT40_1S[RF_PATH_MAX][CHANNEL_MAX_NUMBER]; // For HT 40MHZ pwr - u8 TxPwrLevelHT40_2S[RF_PATH_MAX][CHANNEL_MAX_NUMBER]; // For HT 40MHZ pwr + u8 TxPwrLevelHT40_2S[RF_PATH_MAX][CHANNEL_MAX_NUMBER]; // For HT 40MHZ pwr s8 TxPwrHt20Diff[RF_PATH_MAX][CHANNEL_MAX_NUMBER];// HT 20<->40 Pwr diff u8 TxPwrLegacyHtDiff[RF_PATH_MAX][CHANNEL_MAX_NUMBER];// For HT<->legacy pwr diff // For power group @@ -743,7 +743,7 @@ struct hal_data_8192du u8 CurrentOfdm24GTxPwrIdx; BB_REGISTER_DEFINITION_T PHYRegDef[4]; //Radio A/B/C/D - + u32 RfRegChnlVal[2]; @@ -769,7 +769,7 @@ struct hal_data_8192du #else //regc80¡¢regc94¡¢regc4c¡¢regc88¡¢regc9c¡¢regc14¡¢regca0¡¢regc1c¡¢regc78 u4Byte IQKMatrixReg[IQK_Matrix_REG_NUM]; - IQK_MATRIX_REGS_SETTING IQKMatrixRegSetting[IQK_Matrix_Settings_NUM]; // 1->2G,24->5G 20M channel,21->5G 40M channel. + IQK_MATRIX_REGS_SETTING IQKMatrixRegSetting[IQK_Matrix_Settings_NUM]; // 1->2G,24->5G 20M channel,21->5G 40M channel. #endif //for host message to fw @@ -780,11 +780,11 @@ struct hal_data_8192du u32 RegBcnCtrlVal; u8 RegTxPause; u8 RegFwHwTxQCtrl; - u8 RegReg542; + u8 RegReg542; u8 RegCR_1; - + struct dm_priv dmpriv; - DM_ODM_T odmpriv; + DM_ODM_T odmpriv; //_lock odm_stainfo_lock; u8 FwRsvdPageStartOffset; //2010.06.23. Added by tynli. Reserve page start offset except beacon in TxQ. @@ -820,8 +820,8 @@ struct hal_data_8192du u16 RegRRSR; u16 EfuseUsedBytes; - - BOOLEAN EepromOrEfuse; + + BOOLEAN EepromOrEfuse; u8 EfuseMap[2][HWSET_MAX_SIZE_512]; //92C:256bytes, 88E:512bytes, we use union set (512bytes) u8 EfuseUsedPercentage; EFUSE_HAL EfuseHal; @@ -851,4 +851,3 @@ VOID PHY_SetPowerOnFor8192D(struct adapter *Adapter); void rtl8192d_free_hal_data(struct adapter * padapter); void rtl8192d_set_hal_ops(struct hal_ops *pHalFunc); #endif - diff --git a/include/rtl8192d_led.h b/include/rtl8192d_led.h index 26e00c8..28dd54b 100755 --- a/include/rtl8192d_led.h +++ b/include/rtl8192d_led.h @@ -1,7 +1,7 @@ /****************************************************************************** * * 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. @@ -16,28 +16,27 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA * * - ******************************************************************************/ -#ifndef __RTL8192D_LED_H_ -#define __RTL8192D_LED_H_ - -#include -#include -#include - - -//================================================================================ -// Interface to manipulate LED objects. -//================================================================================ -#ifdef CONFIG_USB_HCI -void rtl8192du_InitSwLeds(struct adapter *padapter); -void rtl8192du_DeInitSwLeds(struct adapter *padapter); -#endif - -#ifdef CONFIG_PCI_HCI -void rtl8192de_gen_RefreshLedState(struct adapter *Adapter); -void rtl8192de_InitSwLeds(struct adapter *padapter); -void rtl8192de_DeInitSwLeds(struct adapter *padapter); -#endif - -#endif - + ******************************************************************************/ +#ifndef __RTL8192D_LED_H_ +#define __RTL8192D_LED_H_ + +#include +#include +#include + + +//================================================================================ +// Interface to manipulate LED objects. +//================================================================================ +#ifdef CONFIG_USB_HCI +void rtl8192du_InitSwLeds(struct adapter *padapter); +void rtl8192du_DeInitSwLeds(struct adapter *padapter); +#endif + +#ifdef CONFIG_PCI_HCI +void rtl8192de_gen_RefreshLedState(struct adapter *Adapter); +void rtl8192de_InitSwLeds(struct adapter *padapter); +void rtl8192de_DeInitSwLeds(struct adapter *padapter); +#endif + +#endif diff --git a/include/rtl8192d_recv.h b/include/rtl8192d_recv.h index fed709c..16a2cbf 100755 --- a/include/rtl8192d_recv.h +++ b/include/rtl8192d_recv.h @@ -1,7 +1,7 @@ /****************************************************************************** * * 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. @@ -136,4 +136,3 @@ void rtl8192d_translate_rx_signal_stuff(union recv_frame *precvframe, struct phy void rtl8192d_query_rx_desc_status(union recv_frame *precvframe, struct recv_stat *pdesc); #endif - diff --git a/include/rtl8192d_rf.h b/include/rtl8192d_rf.h index 03f9d3c..3d92888 100755 --- a/include/rtl8192d_rf.h +++ b/include/rtl8192d_rf.h @@ -1,7 +1,7 @@ /****************************************************************************** * * 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. @@ -16,82 +16,81 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA * * - ******************************************************************************/ -/****************************************************************************** - * - * - * Module: rtl8192d_rf.h ( Header File) - * - * Note: Collect every HAL RF type exter API or constant. - * - * Function: - * - * Export: - * - * Abbrev: - * - * History: - * Data Who Remark - * - * 09/25/2008 MHC Create initial version. - * - * -******************************************************************************/ -#ifndef _RTL8192D_RF_H_ -#define _RTL8192D_RF_H_ -/* Check to see if the file has been included already. */ - - -/*--------------------------Define Parameters-------------------------------*/ - -// -// For RF 6052 Series -// -#define RF6052_MAX_TX_PWR 0x3F -#define RF6052_MAX_REG 0x3F -#define RF6052_MAX_PATH 2 -/*--------------------------Define Parameters-------------------------------*/ - - -/*------------------------------Define structure----------------------------*/ - -/*------------------------------Define structure----------------------------*/ - - -/*------------------------Export global variable----------------------------*/ -/*------------------------Export global variable----------------------------*/ - -/*------------------------Export Marco Definition---------------------------*/ - -/*------------------------Export Marco Definition---------------------------*/ - - -/*--------------------------Exported Function prototype---------------------*/ - -// -// RF RL6052 Series API -// -void rtl8192d_RF_ChangeTxPath( IN struct adapter *Adapter, - IN u16 DataRate); -void rtl8192d_PHY_RF6052SetBandwidth( - IN struct adapter * Adapter, - IN HT_CHANNEL_WIDTH Bandwidth); -VOID rtl8192d_PHY_RF6052SetCckTxPower( - IN struct adapter *Adapter, - IN u8* pPowerlevel); -VOID rtl8192d_PHY_RF6052SetOFDMTxPower( - IN struct adapter *Adapter, - IN u8* pPowerLevel, - IN u8 Channel); -int PHY_RF6052_Config8192D( IN struct adapter * Adapter ); - -BOOLEAN rtl8192d_PHY_EnableAnotherPHY(IN struct adapter *Adapter, IN BOOLEAN bMac0); - -void rtl8192d_PHY_PowerDownAnotherPHY(IN struct adapter *Adapter, IN BOOLEAN bMac0); - - -/*--------------------------Exported Function prototype---------------------*/ - - -#endif/* End of HalRf.h */ - + ******************************************************************************/ +/****************************************************************************** + * + * + * Module: rtl8192d_rf.h ( Header File) + * + * Note: Collect every HAL RF type exter API or constant. + * + * Function: + * + * Export: + * + * Abbrev: + * + * History: + * Data Who Remark + * + * 09/25/2008 MHC Create initial version. + * + * +******************************************************************************/ +#ifndef _RTL8192D_RF_H_ +#define _RTL8192D_RF_H_ +/* Check to see if the file has been included already. */ + + +/*--------------------------Define Parameters-------------------------------*/ + +// +// For RF 6052 Series +// +#define RF6052_MAX_TX_PWR 0x3F +#define RF6052_MAX_REG 0x3F +#define RF6052_MAX_PATH 2 +/*--------------------------Define Parameters-------------------------------*/ + + +/*------------------------------Define structure----------------------------*/ + +/*------------------------------Define structure----------------------------*/ + + +/*------------------------Export global variable----------------------------*/ +/*------------------------Export global variable----------------------------*/ + +/*------------------------Export Marco Definition---------------------------*/ + +/*------------------------Export Marco Definition---------------------------*/ + + +/*--------------------------Exported Function prototype---------------------*/ + +// +// RF RL6052 Series API +// +void rtl8192d_RF_ChangeTxPath( IN struct adapter *Adapter, + IN u16 DataRate); +void rtl8192d_PHY_RF6052SetBandwidth( + IN struct adapter * Adapter, + IN HT_CHANNEL_WIDTH Bandwidth); +VOID rtl8192d_PHY_RF6052SetCckTxPower( + IN struct adapter *Adapter, + IN u8* pPowerlevel); +VOID rtl8192d_PHY_RF6052SetOFDMTxPower( + IN struct adapter *Adapter, + IN u8* pPowerLevel, + IN u8 Channel); +int PHY_RF6052_Config8192D( IN struct adapter * Adapter ); + +BOOLEAN rtl8192d_PHY_EnableAnotherPHY(IN struct adapter *Adapter, IN BOOLEAN bMac0); + +void rtl8192d_PHY_PowerDownAnotherPHY(IN struct adapter *Adapter, IN BOOLEAN bMac0); + + +/*--------------------------Exported Function prototype---------------------*/ + + +#endif/* End of HalRf.h */ diff --git a/include/rtl8192d_spec.h b/include/rtl8192d_spec.h index 74e11d5..6fe6239 100755 --- a/include/rtl8192d_spec.h +++ b/include/rtl8192d_spec.h @@ -1,7 +1,7 @@ /****************************************************************************** * * 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. @@ -91,14 +91,14 @@ #define REG_SYS_CFG 0x00F0 #define REG_MAC_PHY_CTRL_NORMAL 0x00f8 -#define REG_MAC0 0x0081 -#define REG_MAC1 0x0053 -#define FW_MAC0_ready 0x18 -#define FW_MAC1_ready 0x1A -#define MAC0_ON BIT7 -#define MAC1_ON BIT0 -#define mac0_ready BIT0 -#define mac1_ready BIT0 +#define REG_MAC0 0x0081 +#define REG_MAC1 0x0053 +#define FW_MAC0_ready 0x18 +#define FW_MAC1_ready 0x1A +#define MAC0_ON BIT7 +#define MAC1_ON BIT0 +#define mac0_ready BIT0 +#define mac1_ready BIT0 //----------------------------------------------------- @@ -177,7 +177,7 @@ // //----------------------------------------------------- #define REG_PCIE_CTRL_REG 0x0300 -#define REG_INT_MIG 0x0304 // Interrupt Migration +#define REG_INT_MIG 0x0304 // Interrupt Migration #define REG_BCNQ_DESA 0x0308 // TX Beacon Descriptor Address #define REG_HQ_DESA 0x0310 // TX High Queue Descriptor Address #define REG_MGQ_DESA 0x0318 // TX Manage Queue Descriptor Address @@ -189,7 +189,7 @@ #define REG_DBI 0x0348 // Backdoor REG for Access Configuration //sherry added for DBI Read/Write 20091126 #define REG_DBI_WDATA 0x0348 // Backdoor REG for Access Configuration -#define REG_DBI_RDATA 0x034C //Backdoor REG for Access Configuration +#define REG_DBI_RDATA 0x034C //Backdoor REG for Access Configuration #define REG_DBI_CTRL 0x0350 //Backdoor REG for Access Configuration #define REG_DBI_FLAG 0x0352 //Backdoor REG for Access Configuration#define REG_MDIO 0x0354 // MDIO for Access PCIE PHY #define REG_MDIO 0x0354 // MDIO for Access PCIE PHY @@ -300,7 +300,7 @@ #define REG_USTIME_TSF 0x055C #define REG_BCN_MAX_ERR 0x055D #define REG_RXTSF_OFFSET_CCK 0x055E -#define REG_RXTSF_OFFSET_OFDM 0x055F +#define REG_RXTSF_OFFSET_OFDM 0x055F #define REG_TSFTR 0x0560 #define REG_TSFTR1 0x0568 #define REG_INIT_TSFTR 0x0564 @@ -394,7 +394,7 @@ #define REG_USB_AGG_TO 0xFE5C #define REG_USB_AGG_TH 0xFE5D -// for 92DU high_Queue low_Queue Normal_Queue select +// for 92DU high_Queue low_Queue Normal_Queue select #define REG_USB_High_NORMAL_Queue_Select_MAC0 0xFE44 //#define REG_USB_LOW_Queue_Select_MAC0 0xFE45 #define REG_USB_High_NORMAL_Queue_Select_MAC1 0xFE47 @@ -443,7 +443,7 @@ #define MACIDR0 REG_MACID // MAC ID Register, Offset 0x0050-0x0053 #define MACIDR4 (REG_MACID + 4) // MAC ID Register, Offset 0x0054-0x0055 -#define PBP REG_PBP +#define PBP REG_PBP // Redifine MACID register, to compatible prior ICs. #define IDR0 MACIDR0 @@ -463,20 +463,20 @@ #define UnusedRegister 0x1BF #define DCAM UnusedRegister #define PSR UnusedRegister -#define BBAddr UnusedRegister +#define BBAddr UnusedRegister #define PhyDataR UnusedRegister #define InvalidBBRFValue 0x12345678 // Min Spacing related settings. -#define MAX_MSS_DENSITY_2T 0x13 -#define MAX_MSS_DENSITY_1T 0x0A +#define MAX_MSS_DENSITY_2T 0x13 +#define MAX_MSS_DENSITY_1T 0x0A //---------------------------------------------------------------------------- // 8192C Cmd9346CR bits (Offset 0xA, 16bit) //---------------------------------------------------------------------------- #define CmdEEPROM_En BIT5 // EEPROM enable when set 1 -#define CmdEERPOMSEL BIT4 // System EEPROM select, 0: boot from E-FUSE, 1: The EEPROM used is 9346 +#define CmdEERPOMSEL BIT4 // System EEPROM select, 0: boot from E-FUSE, 1: The EEPROM used is 9346 #define Cmd9346CR_9356SEL BIT4 #define AutoLoadEEPROM (CmdEEPROM_En|CmdEERPOMSEL) #define AutoLoadEFUSE CmdEEPROM_En @@ -496,7 +496,7 @@ //---------------------------------------------------------------------------- -// 8192C (MSR) Media Status Register (Offset 0x4C, 8 bits) +// 8192C (MSR) Media Status Register (Offset 0x4C, 8 bits) //---------------------------------------------------------------------------- /* Network Type @@ -524,16 +524,16 @@ Default: 00b. #define RRSR_RSC_LOWSUBCHNL 0x200000 #define RRSR_SHORT 0x800000 #define RRSR_1M BIT0 -#define RRSR_2M BIT1 -#define RRSR_5_5M BIT2 -#define RRSR_11M BIT3 -#define RRSR_6M BIT4 -#define RRSR_9M BIT5 -#define RRSR_12M BIT6 -#define RRSR_18M BIT7 -#define RRSR_24M BIT8 -#define RRSR_36M BIT9 -#define RRSR_48M BIT10 +#define RRSR_2M BIT1 +#define RRSR_5_5M BIT2 +#define RRSR_11M BIT3 +#define RRSR_6M BIT4 +#define RRSR_9M BIT5 +#define RRSR_12M BIT6 +#define RRSR_18M BIT7 +#define RRSR_24M BIT8 +#define RRSR_36M BIT9 +#define RRSR_48M BIT10 #define RRSR_54M BIT11 #define RRSR_MCS0 BIT12 #define RRSR_MCS1 BIT13 @@ -543,7 +543,7 @@ Default: 00b. #define RRSR_MCS5 BIT17 #define RRSR_MCS6 BIT18 #define RRSR_MCS7 BIT19 -#define BRSR_AckShortPmb BIT23 +#define BRSR_AckShortPmb BIT23 // CCK ACK: use Short Preamble or not //---------------------------------------------------------------------------- @@ -561,7 +561,7 @@ Default: 00b. #define CAM_NOTVALID 0x0000 #define CAM_USEDK BIT5 -#define CAM_CONTENT_COUNT 8 +#define CAM_CONTENT_COUNT 8 #define CAM_NONE 0x0 #define CAM_WEP40 0x01 @@ -572,11 +572,11 @@ Default: 00b. #define TOTAL_CAM_ENTRY 32 -#define HALF_CAM_ENTRY 16 - +#define HALF_CAM_ENTRY 16 + #define CAM_CONFIG_USEDK _TRUE #define CAM_CONFIG_NO_USEDK _FALSE - + #define CAM_WRITE BIT16 #define CAM_READ 0x00000000 #define CAM_POLLINIG BIT31 @@ -611,7 +611,7 @@ Default: 00b. #define IMR_TIMEOUT2 BIT17 // Timeout interrupt 2 #define IMR_TIMEOUT1 BIT16 // Timeout interrupt 1 #define IMR_TXFOVW BIT15 // Transmit FIFO Overflow -#define IMR_PSTIMEOUT BIT14 // Power save time out interrupt +#define IMR_PSTIMEOUT BIT14 // Power save time out interrupt #define IMR_BcnInt BIT13 // Beacon DMA Interrupt 0 #define IMR_RXFOVW BIT12 // Receive FIFO Overflow #define IMR_RDU BIT11 // Receive Descriptor Unavailable @@ -651,10 +651,10 @@ Default: 00b. // Default Value for EEPROM or EFUSE!!! // #define EEPROM_Default_TSSI 0x0 -#define EEPROM_Default_TxPowerDiff 0x0 -#define EEPROM_Default_CrystalCap 0x0 //92D default 0x0 -#define EEPROM_Default_BoardType 0x02 // Default: 2X2, RTL8192CE(QFPN68) -#define EEPROM_Default_TxPower 0x1010 +#define EEPROM_Default_TxPowerDiff 0x0 +#define EEPROM_Default_CrystalCap 0x0 //92D default 0x0 +#define EEPROM_Default_BoardType 0x02 // Default: 2X2, RTL8192CE(QFPN68) +#define EEPROM_Default_TxPower 0x1010 #define EEPROM_Default_HT2T_TxPwr 0x10 #define EEPROM_Default_LegacyHTTxPowerDiff 0x4 @@ -666,17 +666,17 @@ Default: 00b. #define EEPROM_Default_TxPowerLevel_5G 0x22 #define EEPROM_Default_HT40_2SDiff 0x0 -#define EEPROM_Default_HT20_Diff 2 // HT20<->40 default Tx Power Index Difference +#define EEPROM_Default_HT20_Diff 2 // HT20<->40 default Tx Power Index Difference #define EEPROM_Default_LegacyHTTxPowerDiff 0x4 //OFDM Tx Power index diff -#define EEPROM_Default_HT40_PwrMaxOffset 0 -#define EEPROM_Default_HT20_PwrMaxOffset 0 +#define EEPROM_Default_HT40_PwrMaxOffset 0 +#define EEPROM_Default_HT20_PwrMaxOffset 0 // For debug -#define EEPROM_Default_PID 0x1234 -#define EEPROM_Default_VID 0x5678 -#define EEPROM_Default_CustomerID 0xAB -#define EEPROM_Default_SubCustomerID 0xCD -#define EEPROM_Default_Version 0 +#define EEPROM_Default_PID 0x1234 +#define EEPROM_Default_VID 0x5678 +#define EEPROM_Default_CustomerID 0xAB +#define EEPROM_Default_SubCustomerID 0xCD +#define EEPROM_Default_Version 0 #define EEPROM_Default_externalPA_C9 0x00 #define EEPROM_Default_externalPA_CC 0xFF @@ -704,11 +704,11 @@ Default: 00b. #define EEPROM_CHANNEL_PLAN_BY_HW_MASK 0x80 -#define EEPROM_CID_DEFAULT 0x0 -#define EEPROM_CID_TOSHIBA 0x4 +#define EEPROM_CID_DEFAULT 0x0 +#define EEPROM_CID_TOSHIBA 0x4 #define EEPROM_CID_CCX 0x10 // CCX test. By Bruce, 2009-02-25. #define EEPROM_CID_QMI 0x0D -#define EEPROM_CID_WHQL 0xFE // added by chiyoko for dtm, 20090108 +#define EEPROM_CID_WHQL 0xFE // added by chiyoko for dtm, 20090108 #define RTL8192_EEPROM_ID 0x8129 @@ -767,7 +767,7 @@ Default: 00b. #define EEPROM_HT40_MAX_PWR_OFFSET_5GH 0xB5 #define EEPROM_HT20_MAX_PWR_OFFSET_5GH 0xB8 -#define EEPROM_CHANNEL_PLAN 0xBB // Map of supported channels. +#define EEPROM_CHANNEL_PLAN 0xBB // Map of supported channels. #define EEPROM_IQK_DELTA 0xBC #define EEPROM_LCK_DELTA 0xBC #define EEPROM_XTAL_K 0xBD //[7:5] @@ -792,7 +792,7 @@ Default: 00b. #define EEPROM_DEF_PART_NO 0x3FD //Byte #define EEPROME_CHIP_VERSION_L 0x3FF #define EEPROME_CHIP_VERSION_H 0x3FE -#endif +#endif #ifdef CONFIG_USB_HCI #define RTL8190_EEPROM_ID 0x8129 // 0-1 @@ -846,7 +846,7 @@ Default: 00b. #define EEPROM_HT40_MAX_PWR_OFFSET_5GH 0xB5 #define EEPROM_HT20_MAX_PWR_OFFSET_5GH 0xB8 -#define EEPROM_CHANNEL_PLAN 0xBB // Map of supported channels. +#define EEPROM_CHANNEL_PLAN 0xBB // Map of supported channels. #define EEPROM_TEST_CHANNEL_PLAN 0xBB #define EEPROM_IQK_DELTA 0xBC #define EEPROM_LCK_DELTA 0xBC @@ -946,7 +946,7 @@ Default: 00b. #define EEPROM_CID_DEFAULT 0x0 -#define EEPROM_CID_WHQL 0xFE // added by chiyoko for dtm, 20090108 +#define EEPROM_CID_WHQL 0xFE // added by chiyoko for dtm, 20090108 #define EEPROM_CID_CCX 0x10 // CCX test. By Bruce, 2009-02-25. @@ -957,7 +957,7 @@ Default: 00b. /*=================================================================== ===================================================================== -Here the register defines are for 92C. When the define is as same with 92C, +Here the register defines are for 92C. When the define is as same with 92C, we will use the 92C's define for the consistency So the following defines for 92C is not entire!!!!!! ===================================================================== @@ -993,23 +993,23 @@ Current IOREG MAP #define RCR_ACF BIT12 //Accept control type frame #define RCR_ADF BIT11 //Accept data type frame #define RCR_AICV BIT9 //Accept ICV error packet -#define RCR_ACRC32 BIT8 //Accept CRC32 error packet +#define RCR_ACRC32 BIT8 //Accept CRC32 error packet #define RCR_CBSSID_BCN BIT7 //Accept BSSID match packet (Rx beacon, probe rsp) #define RCR_CBSSID_DATA BIT6 //Accept BSSID match packet (Data) #define RCR_CBSSID RCR_CBSSID_DATA //Accept BSSID match packet #define RCR_APWRMGT BIT5 //Accept power management packet #define RCR_ADD3 BIT4 //Accept address 3 match packet -#define RCR_AB BIT3 //Accept broadcast packet -#define RCR_AM BIT2 //Accept multicast packet +#define RCR_AB BIT3 //Accept broadcast packet +#define RCR_AM BIT2 //Accept multicast packet #define RCR_APM BIT1 //Accept physical match packet -#define RCR_AAP BIT0 //Accept all unicast packet +#define RCR_AAP BIT0 //Accept all unicast packet #define RCR_MXDMA_OFFSET 8 #define RCR_FIFO_OFFSET 13 //============================================================================ -// 8192c USB specific Regsiter Offset and Content definition, +// 8192c USB specific Regsiter Offset and Content definition, // 2009.08.18, added by vivi. for merge 92c and 92C into one driver //============================================================================ //#define APS_FSMCO 0x0004 same with 92Ce @@ -1040,7 +1040,7 @@ Current IOREG MAP #define InvalidBBRFValue 0x12345678 //============================================================================ -// 8192C Regsiter Bit and Content definition +// 8192C Regsiter Bit and Content definition //============================================================================ //----------------------------------------------------- // @@ -1230,11 +1230,11 @@ Current IOREG MAP #define EF_PD BIT(19) #define EF_FLAG BIT(31) -//2 EFUSE_TEST +//2 EFUSE_TEST #define EF_TRPT BIT(7) #define LDOE25_EN BIT(31) -//2 PWR_DATA +//2 PWR_DATA //2 CAL_TIMER @@ -1264,8 +1264,8 @@ Current IOREG MAP //2 GPIO_INTM //2 LEDCFG -#define LED0PL BIT(4) -#define LED1PL BIT(12) +#define LED0PL BIT(4) +#define LED1PL BIT(12) #define LED0DIS BIT(7) #define SECCAM_CLR BIT(30) @@ -1387,12 +1387,12 @@ Current IOREG MAP #define HQSEL_HIQ BIT(5) // For normal driver, 0x10C -#define _TXDMA_HIQ_MAP(x) (((x)&0x3) << 14) -#define _TXDMA_MGQ_MAP(x) (((x)&0x3) << 12) -#define _TXDMA_BKQ_MAP(x) (((x)&0x3) << 10) -#define _TXDMA_BEQ_MAP(x) (((x)&0x3) << 8 ) -#define _TXDMA_VIQ_MAP(x) (((x)&0x3) << 6 ) -#define _TXDMA_VOQ_MAP(x) (((x)&0x3) << 4 ) +#define _TXDMA_HIQ_MAP(x) (((x)&0x3) << 14) +#define _TXDMA_MGQ_MAP(x) (((x)&0x3) << 12) +#define _TXDMA_BKQ_MAP(x) (((x)&0x3) << 10) +#define _TXDMA_BEQ_MAP(x) (((x)&0x3) << 8 ) +#define _TXDMA_VIQ_MAP(x) (((x)&0x3) << 6 ) +#define _TXDMA_VOQ_MAP(x) (((x)&0x3) << 4 ) #define QUEUE_LOW 1 #define QUEUE_NORMAL 2 @@ -1695,8 +1695,8 @@ Current IOREG MAP #define SCR_RxDecEnable BIT(3) //Enable Rx Decryption #define SCR_SKByA2 BIT(4) //Search kEY BY A2 #define SCR_NoSKMC BIT(5) //No Key Search Multicast -#define SCR_TXBCUSEDK BIT(6) // Force Tx Broadcast packets Use Default Key -#define SCR_RXBCUSEDK BIT(7) // Force Rx Broadcast packets Use Default Key +#define SCR_TXBCUSEDK BIT(6) // Force Tx Broadcast packets Use Default Key +#define SCR_RXBCUSEDK BIT(7) // Force Rx Broadcast packets Use Default Key //vivi added for new cam search flow, 20091028 #ifdef HW_EN_DE_CRYPTION_FOR_NEW_CAM_SEARCH_FLOW @@ -1758,4 +1758,3 @@ Current IOREG MAP #include "basic_types.h" #endif - diff --git a/include/rtl8192d_xmit.h b/include/rtl8192d_xmit.h index 87e9260..f7a3b6a 100755 --- a/include/rtl8192d_xmit.h +++ b/include/rtl8192d_xmit.h @@ -1,7 +1,7 @@ /****************************************************************************** * * 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. @@ -32,7 +32,7 @@ #define BMC BIT(24) #define LSG BIT(26) #define FSG BIT(27) -#define OWN BIT(31) +#define OWN BIT(31) //OFFSET 4 @@ -178,4 +178,3 @@ s32 rtl8192de_hostap_mgnt_xmit_entry(struct adapter *padapter, _pkt *pkt); #endif - diff --git a/include/rtw_android.h b/include/rtw_android.h index f9214c2..468ae77 100755 --- a/include/rtw_android.h +++ b/include/rtw_android.h @@ -1,7 +1,7 @@ /****************************************************************************** * * 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. @@ -17,7 +17,7 @@ * * ******************************************************************************/ - + #ifndef __RTW_ANDROID_H__ #define __RTW_ANDROID_H__ @@ -25,28 +25,28 @@ #include enum ANDROID_WIFI_CMD { - ANDROID_WIFI_CMD_START, - ANDROID_WIFI_CMD_STOP, + ANDROID_WIFI_CMD_START, + ANDROID_WIFI_CMD_STOP, ANDROID_WIFI_CMD_SCAN_ACTIVE, - ANDROID_WIFI_CMD_SCAN_PASSIVE, - ANDROID_WIFI_CMD_RSSI, + ANDROID_WIFI_CMD_SCAN_PASSIVE, + ANDROID_WIFI_CMD_RSSI, ANDROID_WIFI_CMD_LINKSPEED, ANDROID_WIFI_CMD_RXFILTER_START, - ANDROID_WIFI_CMD_RXFILTER_STOP, - ANDROID_WIFI_CMD_RXFILTER_ADD, + ANDROID_WIFI_CMD_RXFILTER_STOP, + ANDROID_WIFI_CMD_RXFILTER_ADD, ANDROID_WIFI_CMD_RXFILTER_REMOVE, ANDROID_WIFI_CMD_BTCOEXSCAN_START, ANDROID_WIFI_CMD_BTCOEXSCAN_STOP, ANDROID_WIFI_CMD_BTCOEXMODE, ANDROID_WIFI_CMD_SETSUSPENDOPT, - ANDROID_WIFI_CMD_P2P_DEV_ADDR, - ANDROID_WIFI_CMD_SETFWPATH, - ANDROID_WIFI_CMD_SETBAND, - ANDROID_WIFI_CMD_GETBAND, - ANDROID_WIFI_CMD_COUNTRY, + ANDROID_WIFI_CMD_P2P_DEV_ADDR, + ANDROID_WIFI_CMD_SETFWPATH, + ANDROID_WIFI_CMD_SETBAND, + ANDROID_WIFI_CMD_GETBAND, + ANDROID_WIFI_CMD_COUNTRY, ANDROID_WIFI_CMD_P2P_SET_NOA, - ANDROID_WIFI_CMD_P2P_GET_NOA, - ANDROID_WIFI_CMD_P2P_SET_PS, + ANDROID_WIFI_CMD_P2P_GET_NOA, + ANDROID_WIFI_CMD_P2P_SET_PS, ANDROID_WIFI_CMD_SET_AP_WPS_P2P_IE, #ifdef PNO_SUPPORT ANDROID_WIFI_CMD_PNOSSIDCLR_SET, @@ -61,7 +61,7 @@ enum ANDROID_WIFI_CMD { ANDROID_WIFI_CMD_WFD_ENABLE, ANDROID_WIFI_CMD_WFD_DISABLE, - + ANDROID_WIFI_CMD_WFD_SET_TCPPORT, ANDROID_WIFI_CMD_WFD_SET_MAX_TPUT, ANDROID_WIFI_CMD_WFD_SET_DEVTYPE, @@ -87,4 +87,3 @@ static void rtw_android_wifictrl_func_del(void) {} #endif /* defined(RTW_ENABLE_WIFI_CONTROL_FUNC) */ #endif //__RTW_ANDROID_H__ - diff --git a/include/rtw_ap.h b/include/rtw_ap.h index 4731900..7a6c404 100755 --- a/include/rtw_ap.h +++ b/include/rtw_ap.h @@ -1,65 +1,65 @@ -/****************************************************************************** - * - * Copyright(c) 2007 - 2012 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_AP_H_ -#define __RTW_AP_H_ - -#include -#include -#include - - -#ifdef CONFIG_AP_MODE - -//external function -extern void rtw_indicate_sta_assoc_event(struct adapter *padapter, struct sta_info *psta); -extern void rtw_indicate_sta_disassoc_event(struct adapter *padapter, struct sta_info *psta); - - -void init_mlme_ap_info(struct adapter *padapter); -void free_mlme_ap_info(struct adapter *padapter); -//void update_BCNTIM(struct adapter *padapter); -void rtw_add_bcn_ie(struct adapter *padapter, WLAN_BSSID_EX *pnetwork, u8 index, u8 *data, u8 len); -void rtw_remove_bcn_ie(struct adapter *padapter, WLAN_BSSID_EX *pnetwork, u8 index); -void update_beacon(struct adapter *padapter, u8 ie_id, u8 *oui, u8 tx); -void add_RATid(struct adapter *padapter, struct sta_info *psta, u8 rssi_level); -void expire_timeout_chk(struct adapter *padapter); -void update_sta_info_apmode(struct adapter *padapter, struct sta_info *psta); -int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf, int len); -void rtw_ap_restore_network(struct adapter *padapter); -void rtw_set_macaddr_acl(struct adapter *padapter, int mode); -int rtw_acl_add_sta(struct adapter *padapter, u8 *addr); -int rtw_acl_remove_sta(struct adapter *padapter, u8 *addr); - -#ifdef CONFIG_NATIVEAP_MLME -void associated_clients_update(struct adapter *padapter, u8 updated); -void bss_cap_update_on_sta_join(struct adapter *padapter, struct sta_info *psta); -u8 bss_cap_update_on_sta_leave(struct adapter *padapter, struct sta_info *psta); -void sta_info_update(struct adapter *padapter, struct sta_info *psta); -void ap_sta_info_defer_update(struct adapter *padapter, struct sta_info *psta); -u8 ap_free_sta(struct adapter *padapter, struct sta_info *psta, bool active, u16 reason); -int rtw_sta_flush(struct adapter *padapter); -int rtw_ap_inform_ch_switch(struct adapter *padapter, u8 new_ch, u8 ch_offset); -void start_ap_mode(struct adapter *padapter); -void stop_ap_mode(struct adapter *padapter); -#endif -#endif //end of CONFIG_AP_MODE - -#endif -void update_bmc_sta(struct adapter *padapter); +/****************************************************************************** + * + * Copyright(c) 2007 - 2012 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_AP_H_ +#define __RTW_AP_H_ + +#include +#include +#include + + +#ifdef CONFIG_AP_MODE + +//external function +extern void rtw_indicate_sta_assoc_event(struct adapter *padapter, struct sta_info *psta); +extern void rtw_indicate_sta_disassoc_event(struct adapter *padapter, struct sta_info *psta); + + +void init_mlme_ap_info(struct adapter *padapter); +void free_mlme_ap_info(struct adapter *padapter); +//void update_BCNTIM(struct adapter *padapter); +void rtw_add_bcn_ie(struct adapter *padapter, WLAN_BSSID_EX *pnetwork, u8 index, u8 *data, u8 len); +void rtw_remove_bcn_ie(struct adapter *padapter, WLAN_BSSID_EX *pnetwork, u8 index); +void update_beacon(struct adapter *padapter, u8 ie_id, u8 *oui, u8 tx); +void add_RATid(struct adapter *padapter, struct sta_info *psta, u8 rssi_level); +void expire_timeout_chk(struct adapter *padapter); +void update_sta_info_apmode(struct adapter *padapter, struct sta_info *psta); +int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf, int len); +void rtw_ap_restore_network(struct adapter *padapter); +void rtw_set_macaddr_acl(struct adapter *padapter, int mode); +int rtw_acl_add_sta(struct adapter *padapter, u8 *addr); +int rtw_acl_remove_sta(struct adapter *padapter, u8 *addr); + +#ifdef CONFIG_NATIVEAP_MLME +void associated_clients_update(struct adapter *padapter, u8 updated); +void bss_cap_update_on_sta_join(struct adapter *padapter, struct sta_info *psta); +u8 bss_cap_update_on_sta_leave(struct adapter *padapter, struct sta_info *psta); +void sta_info_update(struct adapter *padapter, struct sta_info *psta); +void ap_sta_info_defer_update(struct adapter *padapter, struct sta_info *psta); +u8 ap_free_sta(struct adapter *padapter, struct sta_info *psta, bool active, u16 reason); +int rtw_sta_flush(struct adapter *padapter); +int rtw_ap_inform_ch_switch(struct adapter *padapter, u8 new_ch, u8 ch_offset); +void start_ap_mode(struct adapter *padapter); +void stop_ap_mode(struct adapter *padapter); +#endif +#endif //end of CONFIG_AP_MODE + +#endif +void update_bmc_sta(struct adapter *padapter); diff --git a/include/rtw_br_ext.h b/include/rtw_br_ext.h index 9a5773f..384bf75 100755 --- a/include/rtw_br_ext.h +++ b/include/rtw_br_ext.h @@ -1,7 +1,7 @@ /****************************************************************************** * * 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. @@ -21,7 +21,7 @@ #define _RTW_BR_EXT_H_ #if 1 // rtw_wifi_driver -#define CL_IPV6_PASS 1 +#define CL_IPV6_PASS 1 #define MACADDRLEN 6 #define _DEBUG_ERR DBG_8192C #define _DEBUG_INFO //DBG_8192C @@ -49,7 +49,7 @@ struct nat25_network_db_entry atomic_t use_count; unsigned char macAddr[6]; unsigned long ageing_timer; - unsigned char networkAddr[MAX_NETWORK_ADDR_LEN]; + unsigned char networkAddr[MAX_NETWORK_ADDR_LEN]; }; enum NAT25_METHOD { @@ -74,4 +74,3 @@ void nat25_db_cleanup(struct adapter *priv); void netdev_br_init(struct net_device *netdev); #endif // _RTW_BR_EXT_H_ - diff --git a/include/rtw_bt_mp.h b/include/rtw_bt_mp.h index 78d2864..074d1a6 100755 --- a/include/rtw_bt_mp.h +++ b/include/rtw_bt_mp.h @@ -1,318 +1,317 @@ -/****************************************************************************** - * - * 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_BT_MP_H -#define __RTW_BT_MP_H - -#include -#include -#include - - -#if(MP_DRIVER == 1) - -#pragma pack(1) - -// definition for BT_UP_OP_BT_READY -#define MP_BT_NOT_READY 0 -#define MP_BT_READY 1 - -// definition for BT_UP_OP_BT_SET_MODE -typedef enum _MP_BT_MODE{ - MP_BT_MODE_RF_TXRX_TEST_MODE = 0, - MP_BT_MODE_BT20_DUT_TEST_MODE = 1, - MP_BT_MODE_BT40_DIRECT_TEST_MODE = 2, - MP_BT_MODE_CONNECT_TEST_MODE = 3, - MP_BT_MODE_MAX -}MP_BT_MODE,*PMP_BT_MODE; - - -// definition for BT_UP_OP_BT_SET_TX_RX_PARAMETER -typedef struct _BT_TXRX_PARAMETERS{ - u1Byte txrxChannel; - u4Byte txrxTxPktCnt; - u1Byte txrxTxPktInterval; - u1Byte txrxPayloadType; - u1Byte txrxPktType; - u2Byte txrxPayloadLen; - u4Byte txrxPktHeader; - u1Byte txrxWhitenCoeff; - u1Byte txrxBdaddr[6]; - u1Byte txrxTxGainIndex; -} BT_TXRX_PARAMETERS, *PBT_TXRX_PARAMETERS; - -// txrxPktType -typedef enum _MP_BT_PKT_TYPE{ - MP_BT_PKT_DH1 = 0, - MP_BT_PKT_DH3 = 1, - MP_BT_PKT_DH5 = 2, - MP_BT_PKT_2DH1 = 3, - MP_BT_PKT_2DH3 = 4, - MP_BT_PKT_2DH5 = 5, - MP_BT_PKT_3DH1 = 6, - MP_BT_PKT_3DH3 = 7, - MP_BT_PKT_3DH5 = 8, - MP_BT_PKT_LE = 9, - MP_BT_PKT_MAX -}MP_BT_PKT_TYPE,*PMP_BT_PKT_TYPE; -// txrxPayloadType -typedef enum _MP_BT_PAYLOAD_TYPE{ - MP_BT_PAYLOAD_01010101 = 0, - MP_BT_PAYLOAD_ALL_1 = 1, - MP_BT_PAYLOAD_ALL_0 = 2, - MP_BT_PAYLOAD_11110000 = 3, - MP_BT_PAYLOAD_PRBS9 = 4, - MP_BT_PAYLOAD_MAX -}MP_BT_PAYLOAD_TYPE,*PMP_BT_PAYLOAD_TYPE; - - -// definition for BT_UP_OP_BT_TEST_CTRL -typedef enum _MP_BT_TEST_CTRL{ - MP_BT_TEST_STOP_ALL_TESTS = 0, - MP_BT_TEST_START_RX_TEST = 1, - MP_BT_TEST_START_PACKET_TX_TEST = 2, - MP_BT_TEST_START_CONTINUOUS_TX_TEST = 3, - MP_BT_TEST_START_INQUIRY_SCAN_TEST = 4, - MP_BT_TEST_START_PAGE_SCAN_TEST = 5, - MP_BT_TEST_START_INQUIRY_PAGE_SCAN_TEST = 6, - MP_BT_TEST_START_LEGACY_CONNECT_TEST = 7, - MP_BT_TEST_START_LE_CONNECT_TEST_INITIATOR = 8, - MP_BT_TEST_START_LE_CONNECT_TEST_ADVERTISER = 9, - MP_BT_TEST_MAX -}MP_BT_TEST_CTRL,*PMP_BT_TEST_CTRL; - - -typedef enum _RTL_EXT_C2H_EVT -{ - EXT_C2H_WIFI_FW_ACTIVE_RSP = 0, - EXT_C2H_TRIG_BY_BT_FW = 1, - MAX_EXT_C2HEVENT -}RTL_EXT_C2H_EVT; - - -// return status definition to the user layer -typedef enum _BT_CTRL_STATUS{ - BT_STATUS_SUCCESS = 0x00, // Success - BT_STATUS_BT_OP_SUCCESS = 0x01, // bt fw op execution success - BT_STATUS_H2C_SUCCESS = 0x02, // H2c success - BT_STATUS_H2C_TIMTOUT = 0x03, // H2c timeout - BT_STATUS_H2C_BT_NO_RSP = 0x04, // H2c sent, bt no rsp - BT_STATUS_C2H_SUCCESS = 0x05, // C2h success - BT_STATUS_C2H_REQNUM_MISMATCH = 0x06, // bt fw wrong rsp - BT_STATUS_OPCODE_U_VERSION_MISMATCH = 0x07, // Upper layer OP code version mismatch. - BT_STATUS_OPCODE_L_VERSION_MISMATCH = 0x08, // Lower layer OP code version mismatch. - BT_STATUS_UNKNOWN_OPCODE_U = 0x09, // Unknown Upper layer OP code - BT_STATUS_UNKNOWN_OPCODE_L = 0x0a, // Unknown Lower layer OP code - BT_STATUS_PARAMETER_FORMAT_ERROR_U = 0x0b, // Wrong parameters sent by upper layer. - BT_STATUS_PARAMETER_FORMAT_ERROR_L = 0x0c, // bt fw parameter format is not consistency - BT_STATUS_PARAMETER_OUT_OF_RANGE_U = 0x0d, // uppery layer parameter value is out of range - BT_STATUS_PARAMETER_OUT_OF_RANGE_L = 0x0e, // bt fw parameter value is out of range - BT_STATUS_UNKNOWN_STATUS_L = 0x0f, // bt returned an defined status code - BT_STATUS_UNKNOWN_STATUS_H = 0x10, // driver need to do error handle or not handle-well. - BT_STATUS_WRONG_LEVEL = 0x11, // should be under passive level - BT_STATUS_MAX -}BT_CTRL_STATUS,*PBT_CTRL_STATUS; - -// OP codes definition between the user layer and driver -typedef enum _BT_CTRL_OPCODE_UPPER{ - BT_UP_OP_BT_READY = 0x00, - BT_UP_OP_BT_SET_MODE = 0x01, - BT_UP_OP_BT_SET_TX_RX_PARAMETER = 0x02, - BT_UP_OP_BT_SET_GENERAL = 0x03, - BT_UP_OP_BT_GET_GENERAL = 0x04, - BT_UP_OP_BT_TEST_CTRL = 0x05, - BT_UP_OP_TEST_BT = 0x06, - BT_UP_OP_MAX -}BT_CTRL_OPCODE_UPPER,*PBT_CTRL_OPCODE_UPPER; - - -typedef enum _BT_SET_GENERAL{ - BT_GSET_REG = 0x00, - BT_GSET_RESET = 0x01, - BT_GSET_TARGET_BD_ADDR = 0x02, - BT_GSET_TX_PWR_FINETUNE = 0x03, - BT_SET_TRACKING_INTERVAL = 0x04, - BT_SET_THERMAL_METER = 0x05, - BT_ENABLE_CFO_TRACKING = 0x06, - BT_GSET_UPDATE_BT_PATCH = 0x07, - BT_GSET_MAX -}BT_SET_GENERAL,*PBT_SET_GENERAL; - -typedef enum _BT_GET_GENERAL{ - BT_GGET_REG = 0x00, - BT_GGET_STATUS = 0x01, - BT_GGET_REPORT = 0x02, - BT_GGET_AFH_MAP = 0x03, - BT_GGET_AFH_STATUS = 0x04, - BT_GGET_MAX -}BT_GET_GENERAL,*PBT_GET_GENERAL; - -// definition for BT_UP_OP_BT_SET_GENERAL -typedef enum _BT_REG_TYPE{ - BT_REG_RF = 0, - BT_REG_MODEM = 1, - BT_REG_BLUEWIZE = 2, - BT_REG_VENDOR = 3, - BT_REG_LE = 4, - BT_REG_MAX -}BT_REG_TYPE,*PBT_REG_TYPE; - -// definition for BT_LO_OP_GET_AFH_MAP -typedef enum _BT_AFH_MAP_TYPE{ - BT_AFH_MAP_RESULT = 0, - BT_AFH_MAP_WIFI_PSD_ONLY = 1, - BT_AFH_MAP_WIFI_CH_BW_ONLY = 2, - BT_AFH_MAP_BT_PSD_ONLY = 3, - BT_AFH_MAP_HOST_CLASSIFICATION_ONLY = 4, - BT_AFH_MAP_MAX -}BT_AFH_MAP_TYPE,*PBT_AFH_MAP_TYPE; - -// definition for BT_UP_OP_BT_GET_GENERAL -typedef enum _BT_REPORT_TYPE{ - BT_REPORT_RX_PACKET_CNT = 0, - BT_REPORT_RX_ERROR_BITS = 1, - BT_REPORT_RSSI = 2, - BT_REPORT_CFO_HDR_QUALITY = 3, - BT_REPORT_CONNECT_TARGET_BD_ADDR = 4, - BT_REPORT_MAX -}BT_REPORT_TYPE,*PBT_REPORT_TYPE; - -VOID -MPTBT_Test( - IN struct adapter *Adapter, - IN u1Byte opCode, - IN u1Byte byte1, - IN u1Byte byte2, - IN u1Byte byte3 - ); - -NDIS_STATUS -MPTBT_SendOidBT( - IN struct adapter * pAdapter, - IN PVOID InformationBuffer, - IN ULONG InformationBufferLength, - OUT PULONG BytesRead, - OUT PULONG BytesNeeded - ); - -VOID -MPTBT_FwC2hBtMpCtrl( - struct adapter *Adapter, - pu1Byte tmpBuf, - u1Byte length - ); - -void MPh2c_timeout_handle(void *FunctionContext); - -VOID mptbt_BtControlProcess( - struct adapter *Adapter, - PVOID pInBuf - ); - -#define BT_H2C_MAX_RETRY 1 -#define BT_MAX_C2H_LEN 20 - -typedef struct _BT_REQ_CMD{ - UCHAR opCodeVer; - UCHAR OpCode; - USHORT paraLength; - UCHAR pParamStart[100]; -} BT_REQ_CMD, *PBT_REQ_CMD; - -typedef struct _BT_RSP_CMD{ - USHORT status; - USHORT paraLength; - UCHAR pParamStart[100]; -} BT_RSP_CMD, *PBT_RSP_CMD; - - -typedef struct _BT_H2C{ - u1Byte opCodeVer:4; - u1Byte reqNum:4; - u1Byte opCode; - u1Byte buf[100]; -}BT_H2C, *PBT_H2C; - - - -typedef struct _BT_EXT_C2H{ - u1Byte extendId; - u1Byte statusCode:4; - u1Byte retLen:4; - u1Byte opCodeVer:4; - u1Byte reqNum:4; - u1Byte buf[100]; -}BT_EXT_C2H, *PBT_EXT_C2H; - -typedef enum _BT_OPCODE_STATUS{ - BT_OP_STATUS_SUCCESS = 0x00, // Success - BT_OP_STATUS_VERSION_MISMATCH = 0x01, - BT_OP_STATUS_UNKNOWN_OPCODE = 0x02, - BT_OP_STATUS_ERROR_PARAMETER = 0x03, - BT_OP_STATUS_MAX -}BT_OPCODE_STATUS,*PBT_OPCODE_STATUS; - - -//OP codes definition between driver and bt fw -typedef enum _BT_CTRL_OPCODE_LOWER{ - BT_LO_OP_GET_BT_VERSION = 0x00, - BT_LO_OP_RESET = 0x01, - BT_LO_OP_TEST_CTRL = 0x02, - BT_LO_OP_SET_BT_MODE = 0x03, - BT_LO_OP_SET_CHNL_TX_GAIN = 0x04, - BT_LO_OP_SET_PKT_TYPE_LEN = 0x05, - BT_LO_OP_SET_PKT_CNT_L_PL_TYPE = 0x06, - BT_LO_OP_SET_PKT_CNT_H_PKT_INTV = 0x07, - BT_LO_OP_SET_PKT_HEADER = 0x08, - BT_LO_OP_SET_WHITENCOEFF = 0x09, - BT_LO_OP_SET_BD_ADDR_L = 0x0a, - BT_LO_OP_SET_BD_ADDR_H = 0x0b, - BT_LO_OP_WRITE_REG_ADDR = 0x0c, - BT_LO_OP_WRITE_REG_VALUE = 0x0d, - BT_LO_OP_GET_BT_STATUS = 0x0e, - BT_LO_OP_GET_BD_ADDR_L = 0x0f, - BT_LO_OP_GET_BD_ADDR_H = 0x10, - BT_LO_OP_READ_REG = 0x11, - BT_LO_OP_SET_TARGET_BD_ADDR_L = 0x12, - BT_LO_OP_SET_TARGET_BD_ADDR_H = 0x13, - BT_LO_OP_SET_TX_POWER_CALIBRATION = 0x14, - BT_LO_OP_GET_RX_PKT_CNT_L = 0x15, - BT_LO_OP_GET_RX_PKT_CNT_H = 0x16, - BT_LO_OP_GET_RX_ERROR_BITS_L = 0x17, - BT_LO_OP_GET_RX_ERROR_BITS_H = 0x18, - BT_LO_OP_GET_RSSI = 0x19, - BT_LO_OP_GET_CFO_HDR_QUALITY_L = 0x1a, - BT_LO_OP_GET_CFO_HDR_QUALITY_H = 0x1b, - BT_LO_OP_GET_TARGET_BD_ADDR_L = 0x1c, - BT_LO_OP_GET_TARGET_BD_ADDR_H = 0x1d, - BT_LO_OP_GET_AFH_MAP_L = 0x1e, - BT_LO_OP_GET_AFH_MAP_M = 0x1f, - BT_LO_OP_GET_AFH_MAP_H = 0x20, - BT_LO_OP_GET_AFH_STATUS = 0x21, - BT_LO_OP_SET_TRACKING_INTERVAL = 0x22, - BT_LO_OP_SET_THERMAL_METER = 0x23, - BT_LO_OP_ENABLE_CFO_TRACKING = 0x24, - BT_LO_OP_MAX -}BT_CTRL_OPCODE_LOWER,*PBT_CTRL_OPCODE_LOWER; - -#endif /* #if(MP_DRIVER == 1) */ - -#endif // #ifndef __INC_MPT_BT_H - +/****************************************************************************** + * + * 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_BT_MP_H +#define __RTW_BT_MP_H + +#include +#include +#include + + +#if(MP_DRIVER == 1) + +#pragma pack(1) + +// definition for BT_UP_OP_BT_READY +#define MP_BT_NOT_READY 0 +#define MP_BT_READY 1 + +// definition for BT_UP_OP_BT_SET_MODE +typedef enum _MP_BT_MODE{ + MP_BT_MODE_RF_TXRX_TEST_MODE = 0, + MP_BT_MODE_BT20_DUT_TEST_MODE = 1, + MP_BT_MODE_BT40_DIRECT_TEST_MODE = 2, + MP_BT_MODE_CONNECT_TEST_MODE = 3, + MP_BT_MODE_MAX +}MP_BT_MODE,*PMP_BT_MODE; + + +// definition for BT_UP_OP_BT_SET_TX_RX_PARAMETER +typedef struct _BT_TXRX_PARAMETERS{ + u1Byte txrxChannel; + u4Byte txrxTxPktCnt; + u1Byte txrxTxPktInterval; + u1Byte txrxPayloadType; + u1Byte txrxPktType; + u2Byte txrxPayloadLen; + u4Byte txrxPktHeader; + u1Byte txrxWhitenCoeff; + u1Byte txrxBdaddr[6]; + u1Byte txrxTxGainIndex; +} BT_TXRX_PARAMETERS, *PBT_TXRX_PARAMETERS; + +// txrxPktType +typedef enum _MP_BT_PKT_TYPE{ + MP_BT_PKT_DH1 = 0, + MP_BT_PKT_DH3 = 1, + MP_BT_PKT_DH5 = 2, + MP_BT_PKT_2DH1 = 3, + MP_BT_PKT_2DH3 = 4, + MP_BT_PKT_2DH5 = 5, + MP_BT_PKT_3DH1 = 6, + MP_BT_PKT_3DH3 = 7, + MP_BT_PKT_3DH5 = 8, + MP_BT_PKT_LE = 9, + MP_BT_PKT_MAX +}MP_BT_PKT_TYPE,*PMP_BT_PKT_TYPE; +// txrxPayloadType +typedef enum _MP_BT_PAYLOAD_TYPE{ + MP_BT_PAYLOAD_01010101 = 0, + MP_BT_PAYLOAD_ALL_1 = 1, + MP_BT_PAYLOAD_ALL_0 = 2, + MP_BT_PAYLOAD_11110000 = 3, + MP_BT_PAYLOAD_PRBS9 = 4, + MP_BT_PAYLOAD_MAX +}MP_BT_PAYLOAD_TYPE,*PMP_BT_PAYLOAD_TYPE; + + +// definition for BT_UP_OP_BT_TEST_CTRL +typedef enum _MP_BT_TEST_CTRL{ + MP_BT_TEST_STOP_ALL_TESTS = 0, + MP_BT_TEST_START_RX_TEST = 1, + MP_BT_TEST_START_PACKET_TX_TEST = 2, + MP_BT_TEST_START_CONTINUOUS_TX_TEST = 3, + MP_BT_TEST_START_INQUIRY_SCAN_TEST = 4, + MP_BT_TEST_START_PAGE_SCAN_TEST = 5, + MP_BT_TEST_START_INQUIRY_PAGE_SCAN_TEST = 6, + MP_BT_TEST_START_LEGACY_CONNECT_TEST = 7, + MP_BT_TEST_START_LE_CONNECT_TEST_INITIATOR = 8, + MP_BT_TEST_START_LE_CONNECT_TEST_ADVERTISER = 9, + MP_BT_TEST_MAX +}MP_BT_TEST_CTRL,*PMP_BT_TEST_CTRL; + + +typedef enum _RTL_EXT_C2H_EVT +{ + EXT_C2H_WIFI_FW_ACTIVE_RSP = 0, + EXT_C2H_TRIG_BY_BT_FW = 1, + MAX_EXT_C2HEVENT +}RTL_EXT_C2H_EVT; + + +// return status definition to the user layer +typedef enum _BT_CTRL_STATUS{ + BT_STATUS_SUCCESS = 0x00, // Success + BT_STATUS_BT_OP_SUCCESS = 0x01, // bt fw op execution success + BT_STATUS_H2C_SUCCESS = 0x02, // H2c success + BT_STATUS_H2C_TIMTOUT = 0x03, // H2c timeout + BT_STATUS_H2C_BT_NO_RSP = 0x04, // H2c sent, bt no rsp + BT_STATUS_C2H_SUCCESS = 0x05, // C2h success + BT_STATUS_C2H_REQNUM_MISMATCH = 0x06, // bt fw wrong rsp + BT_STATUS_OPCODE_U_VERSION_MISMATCH = 0x07, // Upper layer OP code version mismatch. + BT_STATUS_OPCODE_L_VERSION_MISMATCH = 0x08, // Lower layer OP code version mismatch. + BT_STATUS_UNKNOWN_OPCODE_U = 0x09, // Unknown Upper layer OP code + BT_STATUS_UNKNOWN_OPCODE_L = 0x0a, // Unknown Lower layer OP code + BT_STATUS_PARAMETER_FORMAT_ERROR_U = 0x0b, // Wrong parameters sent by upper layer. + BT_STATUS_PARAMETER_FORMAT_ERROR_L = 0x0c, // bt fw parameter format is not consistency + BT_STATUS_PARAMETER_OUT_OF_RANGE_U = 0x0d, // uppery layer parameter value is out of range + BT_STATUS_PARAMETER_OUT_OF_RANGE_L = 0x0e, // bt fw parameter value is out of range + BT_STATUS_UNKNOWN_STATUS_L = 0x0f, // bt returned an defined status code + BT_STATUS_UNKNOWN_STATUS_H = 0x10, // driver need to do error handle or not handle-well. + BT_STATUS_WRONG_LEVEL = 0x11, // should be under passive level + BT_STATUS_MAX +}BT_CTRL_STATUS,*PBT_CTRL_STATUS; + +// OP codes definition between the user layer and driver +typedef enum _BT_CTRL_OPCODE_UPPER{ + BT_UP_OP_BT_READY = 0x00, + BT_UP_OP_BT_SET_MODE = 0x01, + BT_UP_OP_BT_SET_TX_RX_PARAMETER = 0x02, + BT_UP_OP_BT_SET_GENERAL = 0x03, + BT_UP_OP_BT_GET_GENERAL = 0x04, + BT_UP_OP_BT_TEST_CTRL = 0x05, + BT_UP_OP_TEST_BT = 0x06, + BT_UP_OP_MAX +}BT_CTRL_OPCODE_UPPER,*PBT_CTRL_OPCODE_UPPER; + + +typedef enum _BT_SET_GENERAL{ + BT_GSET_REG = 0x00, + BT_GSET_RESET = 0x01, + BT_GSET_TARGET_BD_ADDR = 0x02, + BT_GSET_TX_PWR_FINETUNE = 0x03, + BT_SET_TRACKING_INTERVAL = 0x04, + BT_SET_THERMAL_METER = 0x05, + BT_ENABLE_CFO_TRACKING = 0x06, + BT_GSET_UPDATE_BT_PATCH = 0x07, + BT_GSET_MAX +}BT_SET_GENERAL,*PBT_SET_GENERAL; + +typedef enum _BT_GET_GENERAL{ + BT_GGET_REG = 0x00, + BT_GGET_STATUS = 0x01, + BT_GGET_REPORT = 0x02, + BT_GGET_AFH_MAP = 0x03, + BT_GGET_AFH_STATUS = 0x04, + BT_GGET_MAX +}BT_GET_GENERAL,*PBT_GET_GENERAL; + +// definition for BT_UP_OP_BT_SET_GENERAL +typedef enum _BT_REG_TYPE{ + BT_REG_RF = 0, + BT_REG_MODEM = 1, + BT_REG_BLUEWIZE = 2, + BT_REG_VENDOR = 3, + BT_REG_LE = 4, + BT_REG_MAX +}BT_REG_TYPE,*PBT_REG_TYPE; + +// definition for BT_LO_OP_GET_AFH_MAP +typedef enum _BT_AFH_MAP_TYPE{ + BT_AFH_MAP_RESULT = 0, + BT_AFH_MAP_WIFI_PSD_ONLY = 1, + BT_AFH_MAP_WIFI_CH_BW_ONLY = 2, + BT_AFH_MAP_BT_PSD_ONLY = 3, + BT_AFH_MAP_HOST_CLASSIFICATION_ONLY = 4, + BT_AFH_MAP_MAX +}BT_AFH_MAP_TYPE,*PBT_AFH_MAP_TYPE; + +// definition for BT_UP_OP_BT_GET_GENERAL +typedef enum _BT_REPORT_TYPE{ + BT_REPORT_RX_PACKET_CNT = 0, + BT_REPORT_RX_ERROR_BITS = 1, + BT_REPORT_RSSI = 2, + BT_REPORT_CFO_HDR_QUALITY = 3, + BT_REPORT_CONNECT_TARGET_BD_ADDR = 4, + BT_REPORT_MAX +}BT_REPORT_TYPE,*PBT_REPORT_TYPE; + +VOID +MPTBT_Test( + IN struct adapter *Adapter, + IN u1Byte opCode, + IN u1Byte byte1, + IN u1Byte byte2, + IN u1Byte byte3 + ); + +NDIS_STATUS +MPTBT_SendOidBT( + IN struct adapter * pAdapter, + IN PVOID InformationBuffer, + IN ULONG InformationBufferLength, + OUT PULONG BytesRead, + OUT PULONG BytesNeeded + ); + +VOID +MPTBT_FwC2hBtMpCtrl( + struct adapter *Adapter, + pu1Byte tmpBuf, + u1Byte length + ); + +void MPh2c_timeout_handle(void *FunctionContext); + +VOID mptbt_BtControlProcess( + struct adapter *Adapter, + PVOID pInBuf + ); + +#define BT_H2C_MAX_RETRY 1 +#define BT_MAX_C2H_LEN 20 + +typedef struct _BT_REQ_CMD{ + UCHAR opCodeVer; + UCHAR OpCode; + USHORT paraLength; + UCHAR pParamStart[100]; +} BT_REQ_CMD, *PBT_REQ_CMD; + +typedef struct _BT_RSP_CMD{ + USHORT status; + USHORT paraLength; + UCHAR pParamStart[100]; +} BT_RSP_CMD, *PBT_RSP_CMD; + + +typedef struct _BT_H2C{ + u1Byte opCodeVer:4; + u1Byte reqNum:4; + u1Byte opCode; + u1Byte buf[100]; +}BT_H2C, *PBT_H2C; + + + +typedef struct _BT_EXT_C2H{ + u1Byte extendId; + u1Byte statusCode:4; + u1Byte retLen:4; + u1Byte opCodeVer:4; + u1Byte reqNum:4; + u1Byte buf[100]; +}BT_EXT_C2H, *PBT_EXT_C2H; + +typedef enum _BT_OPCODE_STATUS{ + BT_OP_STATUS_SUCCESS = 0x00, // Success + BT_OP_STATUS_VERSION_MISMATCH = 0x01, + BT_OP_STATUS_UNKNOWN_OPCODE = 0x02, + BT_OP_STATUS_ERROR_PARAMETER = 0x03, + BT_OP_STATUS_MAX +}BT_OPCODE_STATUS,*PBT_OPCODE_STATUS; + + +//OP codes definition between driver and bt fw +typedef enum _BT_CTRL_OPCODE_LOWER{ + BT_LO_OP_GET_BT_VERSION = 0x00, + BT_LO_OP_RESET = 0x01, + BT_LO_OP_TEST_CTRL = 0x02, + BT_LO_OP_SET_BT_MODE = 0x03, + BT_LO_OP_SET_CHNL_TX_GAIN = 0x04, + BT_LO_OP_SET_PKT_TYPE_LEN = 0x05, + BT_LO_OP_SET_PKT_CNT_L_PL_TYPE = 0x06, + BT_LO_OP_SET_PKT_CNT_H_PKT_INTV = 0x07, + BT_LO_OP_SET_PKT_HEADER = 0x08, + BT_LO_OP_SET_WHITENCOEFF = 0x09, + BT_LO_OP_SET_BD_ADDR_L = 0x0a, + BT_LO_OP_SET_BD_ADDR_H = 0x0b, + BT_LO_OP_WRITE_REG_ADDR = 0x0c, + BT_LO_OP_WRITE_REG_VALUE = 0x0d, + BT_LO_OP_GET_BT_STATUS = 0x0e, + BT_LO_OP_GET_BD_ADDR_L = 0x0f, + BT_LO_OP_GET_BD_ADDR_H = 0x10, + BT_LO_OP_READ_REG = 0x11, + BT_LO_OP_SET_TARGET_BD_ADDR_L = 0x12, + BT_LO_OP_SET_TARGET_BD_ADDR_H = 0x13, + BT_LO_OP_SET_TX_POWER_CALIBRATION = 0x14, + BT_LO_OP_GET_RX_PKT_CNT_L = 0x15, + BT_LO_OP_GET_RX_PKT_CNT_H = 0x16, + BT_LO_OP_GET_RX_ERROR_BITS_L = 0x17, + BT_LO_OP_GET_RX_ERROR_BITS_H = 0x18, + BT_LO_OP_GET_RSSI = 0x19, + BT_LO_OP_GET_CFO_HDR_QUALITY_L = 0x1a, + BT_LO_OP_GET_CFO_HDR_QUALITY_H = 0x1b, + BT_LO_OP_GET_TARGET_BD_ADDR_L = 0x1c, + BT_LO_OP_GET_TARGET_BD_ADDR_H = 0x1d, + BT_LO_OP_GET_AFH_MAP_L = 0x1e, + BT_LO_OP_GET_AFH_MAP_M = 0x1f, + BT_LO_OP_GET_AFH_MAP_H = 0x20, + BT_LO_OP_GET_AFH_STATUS = 0x21, + BT_LO_OP_SET_TRACKING_INTERVAL = 0x22, + BT_LO_OP_SET_THERMAL_METER = 0x23, + BT_LO_OP_ENABLE_CFO_TRACKING = 0x24, + BT_LO_OP_MAX +}BT_CTRL_OPCODE_LOWER,*PBT_CTRL_OPCODE_LOWER; + +#endif /* #if(MP_DRIVER == 1) */ + +#endif // #ifndef __INC_MPT_BT_H diff --git a/include/rtw_byteorder.h b/include/rtw_byteorder.h index ad72188..80dbcb5 100755 --- a/include/rtw_byteorder.h +++ b/include/rtw_byteorder.h @@ -1,7 +1,7 @@ /****************************************************************************** * * 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. @@ -37,4 +37,3 @@ #endif #endif /* _RTL871X_BYTEORDER_H_ */ - diff --git a/include/rtw_cmd.h b/include/rtw_cmd.h index b1bf50e..0861a88 100755 --- a/include/rtw_cmd.h +++ b/include/rtw_cmd.h @@ -1,7 +1,7 @@ /****************************************************************************** * * 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. @@ -32,7 +32,7 @@ #define FREE_CMDOBJ_SZ 128 - + #define MAX_CMDSZ 1024 #define MAX_RSPSZ 512 #define MAX_EVTSZ 1024 @@ -47,19 +47,19 @@ u32 cmdsz; u8 *rsp; u32 rspsz; - //_sema cmd_sem; + //_sema cmd_sem; _list list; }; struct cmd_priv { _sema cmd_queue_sema; //_sema cmd_done_sema; - _sema terminate_cmdthread_sema; + _sema terminate_cmdthread_sema; _queue cmd_queue; u8 cmd_seq; u8 *cmd_buf; //shall be non-paged, and 4 bytes aligned u8 *cmd_allocated_buf; - u8 *rsp_buf; //shall be non-paged, and 4 bytes aligned + u8 *rsp_buf; //shall be non-paged, and 4 bytes aligned u8 *rsp_allocated_buf; u32 cmd_issued_cnt; u32 cmd_done_cnt; @@ -74,7 +74,7 @@ u16 evtcode; u8 res; u8 *parmbuf; - u32 evtsz; + u32 evtsz; _list list; }; #endif @@ -93,15 +93,15 @@ struct rtw_cbuf *c2h_queue; #define C2H_QUEUE_MAX_LEN 10 #endif - + #ifdef CONFIG_H2CLBK _sema lbkevt_done; u8 lbkevt_limit; u8 lbkevt_num; - u8 *cmdevt_parm; + u8 *cmdevt_parm; #endif ATOMIC_T event_seq; - u8 *evt_buf; //shall be non-paged, and 4 bytes aligned + u8 *evt_buf; //shall be non-paged, and 4 bytes aligned u8 *evt_allocated_buf; u32 evt_done_cnt; #if defined(CONFIG_SDIO_HCI) || defined(CONFIG_GSPI_HCI) @@ -155,7 +155,7 @@ u8 p2p_protocol_wk_cmd(struct adapter*padapter, int intCmdType ); #endif //CONFIG_P2P enum rtw_drvextra_cmd_id -{ +{ NONE_WK_CID, DYNAMIC_CHK_WK_CID, DM_CTRL_WK_CID, @@ -173,7 +173,7 @@ enum rtw_drvextra_cmd_id FREE_ASSOC_RESOURCES, // add for CONFIG_IEEE80211W, none 11w also can use #ifdef CONFIG_DETECT_C2H_BY_POLLING EVENT_POLLING_CID, -#endif +#endif MAX_WK_CID }; @@ -277,14 +277,14 @@ Caller Mode: AP, Ad-HoC, Infra Notes: To ask RTL8711 performing site-survey -Command-Event Mode +Command-Event Mode */ #define RTW_SSID_SCAN_AMOUNT 9 // for WEXT_CSCAN_AMOUNT 9 #define RTW_CHANNEL_SCAN_AMOUNT (14+37) struct sitesurvey_parm { - sint scan_mode; //active: 1, passive: 0 + sint scan_mode; //active: 1, passive: 0 /* sint bsslimit; // 1 ~ 48 */ u8 ssid_num; u8 ch_num; @@ -320,25 +320,25 @@ when 802.1x ==> keyid > 2 ==> unicast key */ struct setkey_parm { u8 algorithm; // encryption algorithm, could be none, wep40, TKIP, CCMP, wep104 - u8 keyid; - u8 grpkey; // 1: this is the grpkey for 802.1x. 0: this is the unicast key for 802.1x - u8 set_tx; // 1: main tx key for wep. 0: other key. + u8 keyid; + u8 grpkey; // 1: this is the grpkey for 802.1x. 0: this is the unicast key for 802.1x + u8 set_tx; // 1: main tx key for wep. 0: other key. u8 key[16]; // this could be 40 or 104 }; /* -When in AP or Ad-Hoc mode, this is used to +When in AP or Ad-Hoc mode, this is used to allocate an sw/hw entry for a newly associated sta. Command -when shared key ==> algorithm/keyid +when shared key ==> algorithm/keyid */ struct set_stakey_parm { u8 addr[ETH_ALEN]; u8 algorithm; - u8 id;// currently for erasing cam entry if algorithm == _NO_PRIVACY_ + u8 id;// currently for erasing cam entry if algorithm == _NO_PRIVACY_ u8 key[16]; }; @@ -369,16 +369,16 @@ struct set_assocsta_rsp { /* Caller Ad-Hoc/AP - + Command mode - + This is to force fw to del an sta_data entry per driver's request - + FW will invalidate the cam entry associated with it. */ struct del_assocsta_parm { - u8 addr[ETH_ALEN]; + u8 addr[ETH_ALEN]; }; /* @@ -450,7 +450,7 @@ Command-Rsp Mode */ struct getdatarate_parm { u32 rsvd; - + }; struct getdatarate_rsp { u8 datarates[NumRates]; @@ -560,18 +560,18 @@ struct Tx_Beacon_param /* Notes: This command is used for H2C/C2H loopback testing - mac[0] == 0 + mac[0] == 0 ==> CMD mode, return H2C_SUCCESS. The following condition must be ture under CMD mode mac[1] == mac[4], mac[2] == mac[3], mac[0]=mac[5]= 0; s0 == 0x1234, s1 == 0xabcd, w0 == 0x78563412, w1 == 0x5aa5def7; s2 == (b1 << 8 | b0); - + mac[0] == 1 ==> CMD_RSP mode, return H2C_SUCCESS_RSP - + The rsp layout shall be: - rsp: parm: + rsp: parm: mac[0] = mac[5]; mac[1] = mac[4]; mac[2] = mac[3]; @@ -580,14 +580,14 @@ struct Tx_Beacon_param mac[5] = mac[0]; s0 = s1; s1 = swap16(s0); - w0 = swap32(w1); - b0 = b1 - s2 = s0 + s1 - b1 = b0 + w0 = swap32(w1); + b0 = b1 + s2 = s0 + s1 + b1 = b0 w1 = w0 - - mac[0] == 2 - ==> CMD_EVENT mode, return H2C_SUCCESS + + mac[0] == 2 + ==> CMD_EVENT mode, return H2C_SUCCESS The event layout shall be: event: parm: mac[0] = mac[5]; @@ -598,17 +598,17 @@ struct Tx_Beacon_param mac[5] = mac[0]; s0 = swap16(s0) - event.mac[2]; s1 = s1 + event.mac[2]; - w0 = swap32(w0); - b0 = b1 - s2 = s0 + event.mac[2] - b1 = b0 - w1 = swap32(w1) - event.mac[2]; - + w0 = swap32(w0); + b0 = b1 + s2 = s0 + event.mac[2] + b1 = b0 + w1 = swap32(w1) - event.mac[2]; + parm->mac[3] is the total event counts that host requested. - - + + event will be the same with the cmd's param. - + */ #ifdef CONFIG_H2CLBK @@ -625,7 +625,7 @@ struct seth2clbk_parm { }; struct geth2clbk_parm { - u32 rsv; + u32 rsv; }; struct geth2clbk_rsp { @@ -651,10 +651,10 @@ struct drvextra_cmd_parm { /*------------------- Below are used for RF/BB tunning ---------------------*/ struct setantenna_parm { - u8 tx_antset; + u8 tx_antset; u8 rx_antset; - u8 tx_antenna; - u8 rx_antenna; + u8 tx_antenna; + u8 rx_antenna; }; struct enrateadaptive_parm { @@ -807,7 +807,7 @@ struct setassocrspextraie_parm { struct addBaReq_parm { - unsigned int tid; + unsigned int tid; u8 addr[ETH_ALEN]; }; @@ -876,25 +876,25 @@ struct SwitchBandwidth_parm #endif /* MP_FIRMWARE_OFFLOAD */ -/*H2C Handler index: 59 */ +/*H2C Handler index: 59 */ struct SetChannelPlan_param { u8 channel_plan; }; -/*H2C Handler index: 60 */ +/*H2C Handler index: 60 */ struct LedBlink_param { PLED_871x pLed; }; -/*H2C Handler index: 61 */ +/*H2C Handler index: 61 */ struct SetChannelSwitch_param { u8 new_ch_no; }; -/*H2C Handler index: 62 */ +/*H2C Handler index: 62 */ struct TDLSoption_param { u8 addr[ETH_ALEN]; @@ -906,7 +906,7 @@ struct TDLSoption_param /* -Result: +Result: 0x00: success 0x01: sucess, and check Response. 0x02: cmd ignored due to duplicated sequcne number @@ -988,7 +988,7 @@ u8 rtw_drvextra_cmd_hdl(struct adapter *padapter, unsigned char *pbuf); extern void rtw_survey_cmd_callback(struct adapter *padapter, struct cmd_obj *pcmd); extern void rtw_disassoc_cmd_callback(struct adapter *padapter, struct cmd_obj *pcmd); -extern void rtw_joinbss_cmd_callback(struct adapter *padapter, struct cmd_obj *pcmd); +extern void rtw_joinbss_cmd_callback(struct adapter *padapter, struct cmd_obj *pcmd); extern void rtw_createbss_cmd_callback(struct adapter *padapter, struct cmd_obj *pcmd); extern void rtw_getbbrfreg_cmdrsp_callback(struct adapter *padapter, struct cmd_obj *pcmd); extern void rtw_readtssi_cmdrsp_callback(struct adapter* padapter, struct cmd_obj *pcmd); @@ -1006,90 +1006,90 @@ struct _cmd_callback { enum rtw_h2c_cmd { GEN_CMD_CODE(_Read_MACREG) , /*0*/ - GEN_CMD_CODE(_Write_MACREG) , - GEN_CMD_CODE(_Read_BBREG) , - GEN_CMD_CODE(_Write_BBREG) , - GEN_CMD_CODE(_Read_RFREG) , - GEN_CMD_CODE(_Write_RFREG) , /*5*/ - GEN_CMD_CODE(_Read_EEPROM) , - GEN_CMD_CODE(_Write_EEPROM) , - GEN_CMD_CODE(_Read_EFUSE) , - GEN_CMD_CODE(_Write_EFUSE) , - - GEN_CMD_CODE(_Read_CAM) , /*10*/ - GEN_CMD_CODE(_Write_CAM) , - GEN_CMD_CODE(_setBCNITV), - GEN_CMD_CODE(_setMBIDCFG), - GEN_CMD_CODE(_JoinBss), /*14*/ - GEN_CMD_CODE(_DisConnect) , /*15*/ - GEN_CMD_CODE(_CreateBss) , - GEN_CMD_CODE(_SetOpMode) , + GEN_CMD_CODE(_Write_MACREG) , + GEN_CMD_CODE(_Read_BBREG) , + GEN_CMD_CODE(_Write_BBREG) , + GEN_CMD_CODE(_Read_RFREG) , + GEN_CMD_CODE(_Write_RFREG) , /*5*/ + GEN_CMD_CODE(_Read_EEPROM) , + GEN_CMD_CODE(_Write_EEPROM) , + GEN_CMD_CODE(_Read_EFUSE) , + GEN_CMD_CODE(_Write_EFUSE) , + + GEN_CMD_CODE(_Read_CAM) , /*10*/ + GEN_CMD_CODE(_Write_CAM) , + GEN_CMD_CODE(_setBCNITV), + GEN_CMD_CODE(_setMBIDCFG), + GEN_CMD_CODE(_JoinBss), /*14*/ + GEN_CMD_CODE(_DisConnect) , /*15*/ + GEN_CMD_CODE(_CreateBss) , + GEN_CMD_CODE(_SetOpMode) , GEN_CMD_CODE(_SiteSurvey), /*18*/ - GEN_CMD_CODE(_SetAuth) , - - GEN_CMD_CODE(_SetKey) , /*20*/ - GEN_CMD_CODE(_SetStaKey) , - GEN_CMD_CODE(_SetAssocSta) , - GEN_CMD_CODE(_DelAssocSta) , - GEN_CMD_CODE(_SetStaPwrState) , - GEN_CMD_CODE(_SetBasicRate) , /*25*/ - GEN_CMD_CODE(_GetBasicRate) , - GEN_CMD_CODE(_SetDataRate) , - GEN_CMD_CODE(_GetDataRate) , + GEN_CMD_CODE(_SetAuth) , + + GEN_CMD_CODE(_SetKey) , /*20*/ + GEN_CMD_CODE(_SetStaKey) , + GEN_CMD_CODE(_SetAssocSta) , + GEN_CMD_CODE(_DelAssocSta) , + GEN_CMD_CODE(_SetStaPwrState) , + GEN_CMD_CODE(_SetBasicRate) , /*25*/ + GEN_CMD_CODE(_GetBasicRate) , + GEN_CMD_CODE(_SetDataRate) , + GEN_CMD_CODE(_GetDataRate) , GEN_CMD_CODE(_SetPhyInfo) , - - GEN_CMD_CODE(_GetPhyInfo) , /*30*/ + + GEN_CMD_CODE(_GetPhyInfo) , /*30*/ GEN_CMD_CODE(_SetPhy) , - GEN_CMD_CODE(_GetPhy) , - GEN_CMD_CODE(_readRssi) , - GEN_CMD_CODE(_readGain) , - GEN_CMD_CODE(_SetAtim) , /*35*/ - GEN_CMD_CODE(_SetPwrMode) , - GEN_CMD_CODE(_JoinbssRpt), - GEN_CMD_CODE(_SetRaTable) , - GEN_CMD_CODE(_GetRaTable) , - - GEN_CMD_CODE(_GetCCXReport), /*40*/ - GEN_CMD_CODE(_GetDTMReport), - GEN_CMD_CODE(_GetTXRateStatistics), - GEN_CMD_CODE(_SetUsbSuspend), - GEN_CMD_CODE(_SetH2cLbk), - GEN_CMD_CODE(_AddBAReq) , /*45*/ + GEN_CMD_CODE(_GetPhy) , + GEN_CMD_CODE(_readRssi) , + GEN_CMD_CODE(_readGain) , + GEN_CMD_CODE(_SetAtim) , /*35*/ + GEN_CMD_CODE(_SetPwrMode) , + GEN_CMD_CODE(_JoinbssRpt), + GEN_CMD_CODE(_SetRaTable) , + GEN_CMD_CODE(_GetRaTable) , + + GEN_CMD_CODE(_GetCCXReport), /*40*/ + GEN_CMD_CODE(_GetDTMReport), + GEN_CMD_CODE(_GetTXRateStatistics), + GEN_CMD_CODE(_SetUsbSuspend), + GEN_CMD_CODE(_SetH2cLbk), + GEN_CMD_CODE(_AddBAReq) , /*45*/ GEN_CMD_CODE(_SetChannel), /*46*/ - GEN_CMD_CODE(_SetTxPower), + GEN_CMD_CODE(_SetTxPower), GEN_CMD_CODE(_SwitchAntenna), GEN_CMD_CODE(_SetCrystalCap), GEN_CMD_CODE(_SetSingleCarrierTx), /*50*/ - + GEN_CMD_CODE(_SetSingleToneTx),/*51*/ GEN_CMD_CODE(_SetCarrierSuppressionTx), GEN_CMD_CODE(_SetContinuousTx), GEN_CMD_CODE(_SwitchBandwidth), /*54*/ GEN_CMD_CODE(_TX_Beacon), /*55*/ - + GEN_CMD_CODE(_Set_MLME_EVT), /*56*/ GEN_CMD_CODE(_Set_Drv_Extra), /*57*/ GEN_CMD_CODE(_Set_H2C_MSG), /*58*/ - + GEN_CMD_CODE(_SetChannelPlan), /*59*/ GEN_CMD_CODE(_LedBlink), /*60*/ GEN_CMD_CODE(_SetChannelSwitch), /*61*/ GEN_CMD_CODE(_TDLS), /*62*/ - + MAX_H2CCMD }; #define _GetBBReg_CMD_ _Read_BBREG_CMD_ -#define _SetBBReg_CMD_ _Write_BBREG_CMD_ -#define _GetRFReg_CMD_ _Read_RFREG_CMD_ -#define _SetRFReg_CMD_ _Write_RFREG_CMD_ +#define _SetBBReg_CMD_ _Write_BBREG_CMD_ +#define _GetRFReg_CMD_ _Read_RFREG_CMD_ +#define _SetRFReg_CMD_ _Write_RFREG_CMD_ #ifdef _RTW_CMD_C_ -static struct _cmd_callback rtw_cmd_callback[] = +static struct _cmd_callback rtw_cmd_callback[] = { {GEN_CMD_CODE(_Read_MACREG), NULL}, /*0*/ - {GEN_CMD_CODE(_Write_MACREG), NULL}, + {GEN_CMD_CODE(_Write_MACREG), NULL}, {GEN_CMD_CODE(_Read_BBREG), &rtw_getbbrfreg_cmdrsp_callback}, {GEN_CMD_CODE(_Write_BBREG), NULL}, {GEN_CMD_CODE(_Read_RFREG), &rtw_getbbrfreg_cmdrsp_callback}, @@ -1098,32 +1098,32 @@ static struct _cmd_callback rtw_cmd_callback[] = {GEN_CMD_CODE(_Write_EEPROM), NULL}, {GEN_CMD_CODE(_Read_EFUSE), NULL}, {GEN_CMD_CODE(_Write_EFUSE), NULL}, - + {GEN_CMD_CODE(_Read_CAM), NULL}, /*10*/ - {GEN_CMD_CODE(_Write_CAM), NULL}, + {GEN_CMD_CODE(_Write_CAM), NULL}, {GEN_CMD_CODE(_setBCNITV), NULL}, - {GEN_CMD_CODE(_setMBIDCFG), NULL}, + {GEN_CMD_CODE(_setMBIDCFG), NULL}, {GEN_CMD_CODE(_JoinBss), &rtw_joinbss_cmd_callback}, /*14*/ {GEN_CMD_CODE(_DisConnect), &rtw_disassoc_cmd_callback}, /*15*/ {GEN_CMD_CODE(_CreateBss), &rtw_createbss_cmd_callback}, {GEN_CMD_CODE(_SetOpMode), NULL}, {GEN_CMD_CODE(_SiteSurvey), &rtw_survey_cmd_callback}, /*18*/ {GEN_CMD_CODE(_SetAuth), NULL}, - + {GEN_CMD_CODE(_SetKey), NULL}, /*20*/ {GEN_CMD_CODE(_SetStaKey), &rtw_setstaKey_cmdrsp_callback}, {GEN_CMD_CODE(_SetAssocSta), &rtw_setassocsta_cmdrsp_callback}, - {GEN_CMD_CODE(_DelAssocSta), NULL}, - {GEN_CMD_CODE(_SetStaPwrState), NULL}, + {GEN_CMD_CODE(_DelAssocSta), NULL}, + {GEN_CMD_CODE(_SetStaPwrState), NULL}, {GEN_CMD_CODE(_SetBasicRate), NULL}, /*25*/ {GEN_CMD_CODE(_GetBasicRate), NULL}, {GEN_CMD_CODE(_SetDataRate), NULL}, {GEN_CMD_CODE(_GetDataRate), NULL}, {GEN_CMD_CODE(_SetPhyInfo), NULL}, - + {GEN_CMD_CODE(_GetPhyInfo), NULL}, /*30*/ {GEN_CMD_CODE(_SetPhy), NULL}, - {GEN_CMD_CODE(_GetPhy), NULL}, + {GEN_CMD_CODE(_GetPhy), NULL}, {GEN_CMD_CODE(_readRssi), NULL}, {GEN_CMD_CODE(_readGain), NULL}, {GEN_CMD_CODE(_SetAtim), NULL}, /*35*/ @@ -1131,19 +1131,19 @@ static struct _cmd_callback rtw_cmd_callback[] = {GEN_CMD_CODE(_JoinbssRpt), NULL}, {GEN_CMD_CODE(_SetRaTable), NULL}, {GEN_CMD_CODE(_GetRaTable) , NULL}, - + {GEN_CMD_CODE(_GetCCXReport), NULL}, /*40*/ - {GEN_CMD_CODE(_GetDTMReport), NULL}, - {GEN_CMD_CODE(_GetTXRateStatistics), NULL}, - {GEN_CMD_CODE(_SetUsbSuspend), NULL}, - {GEN_CMD_CODE(_SetH2cLbk), NULL}, - {GEN_CMD_CODE(_AddBAReq), NULL}, /*45*/ + {GEN_CMD_CODE(_GetDTMReport), NULL}, + {GEN_CMD_CODE(_GetTXRateStatistics), NULL}, + {GEN_CMD_CODE(_SetUsbSuspend), NULL}, + {GEN_CMD_CODE(_SetH2cLbk), NULL}, + {GEN_CMD_CODE(_AddBAReq), NULL}, /*45*/ {GEN_CMD_CODE(_SetChannel), NULL}, /*46*/ {GEN_CMD_CODE(_SetTxPower), NULL}, {GEN_CMD_CODE(_SwitchAntenna), NULL}, {GEN_CMD_CODE(_SetCrystalCap), NULL}, {GEN_CMD_CODE(_SetSingleCarrierTx), NULL}, /*50*/ - + {GEN_CMD_CODE(_SetSingleToneTx), NULL}, /*51*/ {GEN_CMD_CODE(_SetCarrierSuppressionTx), NULL}, {GEN_CMD_CODE(_SetContinuousTx), NULL}, @@ -1155,11 +1155,10 @@ static struct _cmd_callback rtw_cmd_callback[] = {GEN_CMD_CODE(_Set_H2C_MSG), NULL},/*58*/ {GEN_CMD_CODE(_SetChannelPlan), NULL},/*59*/ {GEN_CMD_CODE(_LedBlink), NULL},/*60*/ - + {GEN_CMD_CODE(_SetChannelSwitch), NULL},/*61*/ {GEN_CMD_CODE(_TDLS), NULL},/*62*/ }; #endif #endif // _CMD_H_ - diff --git a/include/rtw_debug.h b/include/rtw_debug.h index e68316d..91cf914 100755 --- a/include/rtw_debug.h +++ b/include/rtw_debug.h @@ -172,7 +172,7 @@ extern u32 GlobalDebugLevel; #define DRIVER_PREFIX "R8188EU: " #define DEBUG_LEVEL (_drv_err_) -#if defined (_dbgdump) +#if defined (_dbgdump) #undef DBG_871X_LEVEL #define DBG_871X_LEVEL(level, fmt, arg...) \ do {\ @@ -279,7 +279,7 @@ extern u32 GlobalDebugLevel; off_t offset, int count, int *eof, void *data); - int proc_set_write_reg(struct file *file, const char *buffer, + int proc_set_write_reg(struct file *file, const char *buffer, unsigned long count, void *data); int proc_get_read_reg(char *page, char **start, @@ -399,7 +399,7 @@ extern u32 GlobalDebugLevel; int proc_get_ht_enable(char *page, char **start, off_t offset, int count, int *eof, void *data); - + int proc_set_ht_enable(struct file *file, const char *buffer, unsigned long count, void *data); @@ -409,18 +409,18 @@ extern u32 GlobalDebugLevel; int proc_set_cbw40_enable(struct file *file, const char *buffer, unsigned long count, void *data); - + int proc_get_ampdu_enable(char *page, char **start, off_t offset, int count, int *eof, void *data); - + int proc_set_ampdu_enable(struct file *file, const char *buffer, unsigned long count, void *data); - + int proc_get_rx_stbc(char *page, char **start, off_t offset, int count, int *eof, void *data); - + int proc_set_rx_stbc(struct file *file, const char *buffer, unsigned long count, void *data); #endif //CONFIG_80211N_HT @@ -462,4 +462,3 @@ int proc_set_odm_adaptivity(struct file *file, const char *buffer, unsigned long #endif //CONFIG_PROC_DEBUG #endif //__RTW_DEBUG_H__ - diff --git a/include/rtw_eeprom.h b/include/rtw_eeprom.h index 9a1b8b9..b51399b 100755 --- a/include/rtw_eeprom.h +++ b/include/rtw_eeprom.h @@ -1,7 +1,7 @@ /****************************************************************************** * * 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. @@ -30,7 +30,7 @@ #define HWSET_MAX_SIZE_512 512 #define EEPROM_MAX_SIZE HWSET_MAX_SIZE_512 -#define CLOCK_RATE 50 //100us +#define CLOCK_RATE 50 //100us //- EEPROM opcodes #define EEPROM_READ_OPCODE 06 @@ -41,7 +41,7 @@ //Country codes #define USA 0x555320 -#define EUROPE 0x1 //temp, should be provided later +#define EUROPE 0x1 //temp, should be provided later #define JAPAN 0x2 //temp, should be provided later #ifdef CONFIG_SDIO_HCI @@ -64,9 +64,9 @@ #define EEPROM_CID_WHQL 0xFE // added by chiyoko for dtm, 20090108 // -// Customer ID, note that: -// This variable is initiailzed through EEPROM or registry, -// however, its definition may be different with that in EEPROM for +// Customer ID, note that: +// This variable is initiailzed through EEPROM or registry, +// however, its definition may be different with that in EEPROM for // EEPROM size consideration. So, we have to perform proper translation between them. // Besides, CustomerID of registry has precedence of that of EEPROM. // defined below. 060703, by rcnjko. @@ -79,7 +79,7 @@ typedef enum _RT_CUSTOMER_ID RT_CID_8187_HW_LED = 3, RT_CID_8187_NETGEAR = 4, RT_CID_WHQL = 5, - RT_CID_819x_CAMEO = 6, + RT_CID_819x_CAMEO = 6, RT_CID_819x_RUNTOP = 7, RT_CID_819x_Senao = 8, RT_CID_TOSHIBA = 9, // Merge by Jacken, 2008/01/31. @@ -92,10 +92,10 @@ typedef enum _RT_CUSTOMER_ID RT_CID_819x_ALPHA = 16, RT_CID_819x_Sitecom = 17, RT_CID_CCX = 18, // It's set under CCX logo test and isn't demanded for CCX functions, but for test behavior like retry limit and tx report. By Bruce, 2009-02-17. - RT_CID_819x_Lenovo = 19, + RT_CID_819x_Lenovo = 19, RT_CID_819x_QMI = 20, - RT_CID_819x_Edimax_Belkin = 21, - RT_CID_819x_Sercomm_Belkin = 22, + RT_CID_819x_Edimax_Belkin = 21, + RT_CID_819x_Sercomm_Belkin = 22, RT_CID_819x_CAMEO1 = 23, RT_CID_819x_MSI = 24, RT_CID_819x_Acer = 25, @@ -117,8 +117,8 @@ typedef enum _RT_CUSTOMER_ID RT_CID_819x_ALPHA_WD=41, }RT_CUSTOMER_ID, *PRT_CUSTOMER_ID; -struct eeprom_priv -{ +struct eeprom_priv +{ u8 bautoload_fail_flag; u8 bloadfile_fail_flag; u8 bloadmac_fail_flag; @@ -127,7 +127,7 @@ struct eeprom_priv u8 mac_addr[6]; //PermanentAddress //u8 config0; u16 channel_plan; - //u8 country_string[3]; + //u8 country_string[3]; //u8 tx_power_b[15]; //u8 tx_power_g[15]; //u8 tx_power_a[201]; @@ -142,10 +142,10 @@ struct eeprom_priv #endif //CONFIG_RF_GAIN_OFFSET #ifdef CONFIG_SDIO_HCI - u8 sdio_setting; + u8 sdio_setting; u32 ocr; u8 cis0[eeprom_cis0_sz]; - u8 cis1[eeprom_cis1_sz]; + u8 cis1[eeprom_cis1_sz]; #endif }; @@ -153,7 +153,7 @@ struct eeprom_priv extern void eeprom_write16(struct adapter *padapter, u16 reg, u16 data); extern u16 eeprom_read16(struct adapter *padapter, u16 reg); extern void read_eeprom_content(struct adapter *padapter); -extern void eeprom_read_sz(struct adapter * padapter, u16 reg,u8* data, u32 sz); +extern void eeprom_read_sz(struct adapter * padapter, u16 reg,u8* data, u32 sz); extern void read_eeprom_content_by_attrib(struct adapter * padapter ); @@ -164,4 +164,3 @@ extern int retriveAdaptorInfoFile(char *path, struct eeprom_priv * eeprom_priv); #endif //CONFIG_ADAPTOR_INFO_CACHING_FILE #endif //__RTL871X_EEPROM_H__ - diff --git a/include/rtw_efuse.h b/include/rtw_efuse.h index 5ca3a04..80e4554 100755 --- a/include/rtw_efuse.h +++ b/include/rtw_efuse.h @@ -1,7 +1,7 @@ /****************************************************************************** * * 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. @@ -25,7 +25,7 @@ #define EFUSE_ERROE_HANDLE 1 -#define PG_STATE_HEADER 0x01 +#define PG_STATE_HEADER 0x01 #define PG_STATE_WORD_0 0x02 #define PG_STATE_WORD_1 0x04 #define PG_STATE_WORD_2 0x08 @@ -76,15 +76,15 @@ enum _EFUSE_DEF_TYPE { /*--------------------------Define Parameters-------------------------------*/ #define EFUSE_MAX_WORD_UNIT 4 -/*------------------------------Define structure----------------------------*/ +/*------------------------------Define structure----------------------------*/ typedef struct PG_PKT_STRUCT_A{ u8 offset; u8 word_en; - u8 data[8]; + u8 data[8]; u8 word_cnts; }PGPKT_STRUCT,*PPGPKT_STRUCT; -/*------------------------------Define structure----------------------------*/ +/*------------------------------Define structure----------------------------*/ typedef struct _EFUSE_HAL{ u8 fakeEfuseBank; u32 fakeEfuseUsedBytes; @@ -129,7 +129,7 @@ u8 rtw_efuse_access(struct adapter *padapter, u8 bRead, u16 start_addr, u16 cnts u8 rtw_efuse_map_read(struct adapter *padapter, u16 addr, u16 cnts, u8 *data); u8 rtw_efuse_map_write(struct adapter *padapter, u16 addr, u16 cnts, u8 *data); u8 rtw_BT_efuse_map_read(struct adapter *padapter, u16 addr, u16 cnts, u8 *data); -u8 rtw_BT_efuse_map_write(struct adapter *padapter, u16 addr, u16 cnts, u8 *data); +u8 rtw_BT_efuse_map_write(struct adapter *padapter, u16 addr, u16 cnts, u8 *data); u16 Efuse_GetCurrentSize(struct adapter *pAdapter, u8 efuseType, BOOLEAN bPseudoTest); u8 Efuse_CalculateWordCnts(u8 word_en); @@ -139,8 +139,8 @@ u8 efuse_OneByteRead(struct adapter *pAdapter, u16 addr, u8 *data, BOOLEAN bPse u8 efuse_OneByteWrite(struct adapter *pAdapter, u16 addr, u8 data, BOOLEAN bPseudoTest); void Efuse_PowerSwitch(struct adapter *pAdapter,u8 bWrite,u8 PwrState); -int Efuse_PgPacketRead(struct adapter *pAdapter, u8 offset, u8 *data, BOOLEAN bPseudoTest); -int Efuse_PgPacketWrite(struct adapter *pAdapter, u8 offset, u8 word_en, u8 *data, BOOLEAN bPseudoTest); +int Efuse_PgPacketRead(struct adapter *pAdapter, u8 offset, u8 *data, BOOLEAN bPseudoTest); +int Efuse_PgPacketWrite(struct adapter *pAdapter, u8 offset, u8 word_en, u8 *data, BOOLEAN bPseudoTest); void efuse_WordEnableDataRead(u8 word_en, u8 *sourdata, u8 *targetdata); u8 Efuse_WordEnableDataWrite(struct adapter *pAdapter, u16 efuse_addr, u8 word_en, u8 *data, BOOLEAN bPseudoTest); @@ -149,4 +149,3 @@ void EFUSE_ShadowMapUpdate(struct adapter *pAdapter, u8 efuseType, BOOLEAN bPseu void EFUSE_ShadowRead(struct adapter *pAdapter, u8 Type, u16 Offset, u32 *Value); #endif - diff --git a/include/rtw_event.h b/include/rtw_event.h index e810745..89e790d 100755 --- a/include/rtw_event.h +++ b/include/rtw_event.h @@ -1,7 +1,7 @@ /****************************************************************************** * * 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. @@ -50,8 +50,8 @@ bss_cnt indicates the number of bss that has been reported. */ struct surveydone_event { - unsigned int bss_cnt; - + unsigned int bss_cnt; + }; /* @@ -78,7 +78,7 @@ struct stassoc_event { unsigned char macaddr[6]; unsigned char rsvd[2]; int cam_id; - + }; struct stadel_event { @@ -89,7 +89,7 @@ struct stadel_event { struct addba_event { - unsigned int tid; + unsigned int tid; }; @@ -102,7 +102,7 @@ struct c2hlbk_event{ unsigned char b0; unsigned short s2; unsigned char b1; - unsigned int w1; + unsigned int w1; }; #endif//CONFIG_H2CLBK @@ -116,7 +116,7 @@ struct fwevent { }; -#define C2HEVENT_SZ 32 +#define C2HEVENT_SZ 32 struct event_node{ unsigned char *node; @@ -138,9 +138,8 @@ struct c2hevent_queue { struct network_queue { volatile int head; volatile int tail; - WLAN_BSSID_EX networks[NETWORK_QUEUE_SZ]; + WLAN_BSSID_EX networks[NETWORK_QUEUE_SZ]; }; #endif // _WLANEVENT_H_ - diff --git a/include/rtw_ht.h b/include/rtw_ht.h index 3cd904d..74e416d 100755 --- a/include/rtw_ht.h +++ b/include/rtw_ht.h @@ -1,7 +1,7 @@ /****************************************************************************** * * 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. @@ -26,13 +26,13 @@ struct ht_priv { - u32 ht_option; + u32 ht_option; u32 ampdu_enable;//for enable Tx A-MPDU //u8 baddbareq_issued[16]; u32 tx_amsdu_enable;//for enable Tx A-MSDU u32 tx_amdsu_maxlen; // 1: 8k, 0:4k ; default:8k, for tx u32 rx_ampdu_maxlen; //for rx reordering ctrl win_sz, updated when join_callback. - + u8 bwmode;// u8 ch_offset;//PRIME_CHNL_OFFSET u8 sgi;//short GI @@ -43,8 +43,7 @@ struct ht_priv u8 candidate_tid_bitmap; struct rtw_ieee80211_ht_cap ht_cap; - + }; #endif //_RTL871X_HT_H_ - diff --git a/include/rtw_io.h b/include/rtw_io.h index 6d91b62..da005db 100755 --- a/include/rtw_io.h +++ b/include/rtw_io.h @@ -1,7 +1,7 @@ /****************************************************************************** * * 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. @@ -66,7 +66,7 @@ #define _IO_CMDMASK_ (0x1F80) -/* +/* For prompt mode accessing, caller shall free io_req Otherwise, io_handler will free io_req */ @@ -143,16 +143,16 @@ struct _io_ops void (*_read_port_cancel)(struct intf_hdl *pintfhdl); void (*_write_port_cancel)(struct intf_hdl *pintfhdl); - + }; -struct io_req { +struct io_req { _list list; - u32 addr; + u32 addr; volatile u32 val; u32 command; u32 status; - u8 *pbuf; + u8 *pbuf; _sema sema; #ifdef PLATFORM_OS_CE @@ -161,31 +161,31 @@ struct io_req { USB_TRANSFER usb_transfer_write_mem; #endif #endif - - void (*_async_io_callback)(struct adapter *padater, struct io_req *pio_req, u8 *cnxt); - u8 *cnxt; -#ifdef PLATFORM_OS_XP + void (*_async_io_callback)(struct adapter *padater, struct io_req *pio_req, u8 *cnxt); + u8 *cnxt; + +#ifdef PLATFORM_OS_XP PMDL pmdl; - PIRP pirp; + PIRP pirp; #ifdef CONFIG_SDIO_HCI PSDBUS_REQUEST_PACKET sdrp; -#endif +#endif -#endif +#endif }; struct intf_hdl { -/* +/* u32 intf_option; u32 bus_status; u32 do_flush; u8 *adapter; - u8 *intf_dev; + u8 *intf_dev; struct intf_priv *pintfpriv; u8 cnt; void (*intf_hdl_init)(u8 *priv); @@ -195,7 +195,7 @@ struct intf_hdl { struct _io_ops io_ops; //u8 intf_status;//moved to struct intf_priv u16 len; - u16 done_len; + u16 done_len; */ struct adapter *padapter; struct dvobj_priv *pintf_dev;// pointer to &(padapter->dvobjpriv); @@ -206,7 +206,7 @@ struct intf_hdl { struct reg_protocol_rd { -#ifdef CONFIG_LITTLE_ENDIAN +#ifdef CONFIG_LITTLE_ENDIAN //DW1 u32 NumOfTrans:4; @@ -231,22 +231,22 @@ struct reg_protocol_rd { //DW1 u32 Reserved1 :4; - u32 NumOfTrans :4; + u32 NumOfTrans :4; - u32 Reserved2 :24; + u32 Reserved2 :24; //DW2 u32 WriteEnable : 1; - u32 ByteCount :7; + u32 ByteCount :7; u32 Reserved3 : 3; - u32 Byte4Access : 1; + u32 Byte4Access : 1; u32 Byte2Access : 1; - u32 Byte1Access : 1; - u32 BurstMode :1 ; - u32 FixOrContinuous : 1; + u32 Byte1Access : 1; + u32 BurstMode :1 ; + u32 FixOrContinuous : 1; u32 Reserved4 : 16; @@ -257,12 +257,12 @@ struct reg_protocol_rd { //u32 Value; #endif - + }; struct reg_protocol_wt { - + #ifdef CONFIG_LITTLE_ENDIAN @@ -288,21 +288,21 @@ struct reg_protocol_wt { #else //DW1 u32 Reserved1 :4; - u32 NumOfTrans :4; + u32 NumOfTrans :4; - u32 Reserved2 :24; + u32 Reserved2 :24; //DW2 u32 WriteEnable : 1; - u32 ByteCount :7; - + u32 ByteCount :7; + u32 Reserved3 : 3; - u32 Byte4Access : 1; + u32 Byte4Access : 1; u32 Byte2Access : 1; - u32 Byte1Access : 1; - u32 BurstMode :1 ; - u32 FixOrContinuous : 1; + u32 Byte1Access : 1; + u32 BurstMode :1 ; + u32 FixOrContinuous : 1; u32 Reserved4 : 16; @@ -337,10 +337,10 @@ Below is the data structure used by _io_handler */ -struct io_queue { - _lock lock; - _list free_ioreqs; - _list pending; //The io_req list that will be served in the single protocol read/write. +struct io_queue { + _lock lock; + _list free_ioreqs; + _list pending; //The io_req list that will be served in the single protocol read/write. _list processing; u8 *free_ioreqs_buf; // 4-byte aligned u8 *pallocated_free_ioreqs_buf; @@ -348,9 +348,9 @@ struct io_queue { }; struct io_priv{ - - struct adapter *padapter; - + + struct adapter *padapter; + struct intf_hdl intf; }; @@ -449,9 +449,9 @@ extern int dbg_rtw_writeN(struct adapter *adapter, u32 addr ,u32 length , u8 *da extern void rtw_write_scsi(struct adapter *adapter, u32 cnt, u8 *pmem); -//ioreq +//ioreq extern void ioreq_read8(struct adapter *adapter, u32 addr, u8 *pval); -extern void ioreq_read16(struct adapter *adapter, u32 addr, u16 *pval); +extern void ioreq_read16(struct adapter *adapter, u32 addr, u16 *pval); extern void ioreq_read32(struct adapter *adapter, u32 addr, u32 *pval); extern void ioreq_write8(struct adapter *adapter, u32 addr, u8 val); extern void ioreq_write16(struct adapter *adapter, u32 addr, u16 val); @@ -459,11 +459,11 @@ extern void ioreq_write32(struct adapter *adapter, u32 addr, u32 val); extern uint async_read8(struct adapter *adapter, u32 addr, u8 *pbuff, - void (*_async_io_callback)(struct adapter *padater, struct io_req *pio_req, u8 *cnxt), u8 *cnxt); + void (*_async_io_callback)(struct adapter *padater, struct io_req *pio_req, u8 *cnxt), u8 *cnxt); extern uint async_read16(struct adapter *adapter, u32 addr, u8 *pbuff, - void (*_async_io_callback)(struct adapter *padater, struct io_req *pio_req, u8 *cnxt), u8 *cnxt); + void (*_async_io_callback)(struct adapter *padater, struct io_req *pio_req, u8 *cnxt), u8 *cnxt); extern uint async_read32(struct adapter *adapter, u32 addr, u8 *pbuff, - void (*_async_io_callback)(struct adapter *padater, struct io_req *pio_req, u8 *cnxt), u8 *cnxt); + void (*_async_io_callback)(struct adapter *padater, struct io_req *pio_req, u8 *cnxt), u8 *cnxt); extern void async_read_mem(struct adapter *adapter, u32 addr, u32 cnt, u8 *pmem); extern void async_read_port(struct adapter *adapter, u32 addr, u32 cnt, u8 *pmem); @@ -522,4 +522,3 @@ extern void dev_power_down(struct adapter * Adapter, u8 bpwrup); rtw_read32(_a,_b) #endif //_RTL8711_IO_H_ - diff --git a/include/rtw_ioctl.h b/include/rtw_ioctl.h index 48441ff..2d79236 100755 --- a/include/rtw_ioctl.h +++ b/include/rtw_ioctl.h @@ -1,7 +1,7 @@ /****************************************************************************** * * 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. @@ -64,11 +64,11 @@ #define OID_MP_SEG3 0xFF818700 #define OID_MP_SEG4 0xFF011100 -#define DEBUG_OID(dbg, str) \ - if((!dbg)) \ - { \ +#define DEBUG_OID(dbg, str) \ + if((!dbg)) \ + { \ RT_TRACE(_module_rtl871x_ioctl_c_,_drv_info_,("%s(%d): %s", __FUNCTION__, __LINE__, str)); \ - } + } enum oid_type @@ -80,10 +80,10 @@ enum oid_type struct oid_funs_node { unsigned int oid_start; //the starting number for OID unsigned int oid_end; //the ending number for OID - struct oid_obj_priv *node_array; + struct oid_obj_priv *node_array; unsigned int array_sz; //the size of node_array - int query_counter; //count the number of query hits for this segment - int set_counter; //count the number of set hits for this segment + int query_counter; //count the number of query hits for this segment + int set_counter; //count the number of set hits for this segment }; struct oid_par_priv @@ -99,8 +99,8 @@ struct oid_par_priv }; struct oid_obj_priv { - unsigned char dbg; // 0: without OID debug message 1: with OID debug message - NDIS_STATUS (*oidfuns)(struct oid_par_priv *poid_par_priv); + unsigned char dbg; // 0: without OID debug message 1: with OID debug message + NDIS_STATUS (*oidfuns)(struct oid_par_priv *poid_par_priv); }; #if defined(CONFIG_WIRELESS_EXT) @@ -116,7 +116,7 @@ extern NDIS_STATUS drv_query_info( OUT u32* BytesNeeded ); -extern NDIS_STATUS drv_set_info( +extern NDIS_STATUS drv_set_info( IN _nic_hdl MiniportAdapterContext, IN NDIS_OID Oid, IN void * InformationBuffer, @@ -126,4 +126,3 @@ extern NDIS_STATUS drv_set_info( ); #endif // #ifndef __INC_CEINFO_ - diff --git a/include/rtw_ioctl_query.h b/include/rtw_ioctl_query.h index d3891ca..5b3f18f 100755 --- a/include/rtw_ioctl_query.h +++ b/include/rtw_ioctl_query.h @@ -1,7 +1,7 @@ /****************************************************************************** * * 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. @@ -25,4 +25,3 @@ #endif - diff --git a/include/rtw_ioctl_rtl.h b/include/rtw_ioctl_rtl.h index 9a43c28..c017006 100755 --- a/include/rtw_ioctl_rtl.h +++ b/include/rtw_ioctl_rtl.h @@ -1,7 +1,7 @@ /****************************************************************************** * * 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. @@ -24,7 +24,7 @@ #include #include -//************** oid_rtl_seg_01_01 ************** +//************** oid_rtl_seg_01_01 ************** NDIS_STATUS oid_rt_get_signal_quality_hdl(struct oid_par_priv* poid_par_priv);//84 NDIS_STATUS oid_rt_get_small_packet_crc_hdl(struct oid_par_priv* poid_par_priv); NDIS_STATUS oid_rt_get_middle_packet_crc_hdl(struct oid_par_priv* poid_par_priv); @@ -63,17 +63,17 @@ NDIS_STATUS oid_rt_wireless_mode_for_scan_list_hdl(struct oid_par_priv* poid_par NDIS_STATUS oid_rt_get_bss_wireless_mode_hdl(struct oid_par_priv* poid_par_priv); NDIS_STATUS oid_rt_scan_with_magic_packet_hdl(struct oid_par_priv* poid_par_priv); -//************** oid_rtl_seg_01_03 section start ************** +//************** oid_rtl_seg_01_03 section start ************** NDIS_STATUS oid_rt_ap_get_associated_station_list_hdl(struct oid_par_priv* poid_par_priv); NDIS_STATUS oid_rt_ap_switch_into_ap_mode_hdl(struct oid_par_priv* poid_par_priv); NDIS_STATUS oid_rt_ap_supported_hdl(struct oid_par_priv* poid_par_priv); NDIS_STATUS oid_rt_ap_set_passphrase_hdl(struct oid_par_priv* poid_par_priv); -// oid_rtl_seg_01_11 +// oid_rtl_seg_01_11 NDIS_STATUS oid_rt_pro_rf_write_registry_hdl(struct oid_par_priv* poid_par_priv); NDIS_STATUS oid_rt_pro_rf_read_registry_hdl(struct oid_par_priv* poid_par_priv); -//************** oid_rtl_seg_03_00 section start ************** +//************** oid_rtl_seg_03_00 section start ************** NDIS_STATUS oid_rt_get_connect_state_hdl(struct oid_par_priv* poid_par_priv); NDIS_STATUS oid_rt_set_default_key_id_hdl(struct oid_par_priv* poid_par_priv); @@ -81,4 +81,3 @@ NDIS_STATUS oid_rt_set_default_key_id_hdl(struct oid_par_priv* poid_par_priv); #endif - diff --git a/include/rtw_ioctl_set.h b/include/rtw_ioctl_set.h index b50764b..55ebcde 100755 --- a/include/rtw_ioctl_set.h +++ b/include/rtw_ioctl_set.h @@ -1,7 +1,7 @@ /****************************************************************************** * * 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. @@ -53,4 +53,3 @@ int rtw_set_channel_plan(struct adapter *adapter, u8 channel_plan); int rtw_set_country(struct adapter *adapter, const char *country_code); #endif - diff --git a/include/rtw_iol.h b/include/rtw_iol.h index 42b2ee3..b5a469c 100755 --- a/include/rtw_iol.h +++ b/include/rtw_iol.h @@ -1,139 +1,138 @@ -/****************************************************************************** - * - * 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_IOL_H_ -#define __RTW_IOL_H_ - -#include -#include -#include -struct xmit_frame *rtw_IOL_accquire_xmit_frame(struct adapter *adapter); -int rtw_IOL_append_cmds(struct xmit_frame *xmit_frame, u8 *IOL_cmds, u32 cmd_len); -int rtw_IOL_append_LLT_cmd(struct xmit_frame *xmit_frame, u8 page_boundary); -int rtw_IOL_exec_cmds_sync(struct adapter *adapter, struct xmit_frame *xmit_frame, u32 max_wating_ms, u32 bndy_cnt); -bool rtw_IOL_applied(struct adapter *adapter); -int rtw_IOL_append_DELAY_US_cmd(struct xmit_frame *xmit_frame, u16 us); -int rtw_IOL_append_DELAY_MS_cmd(struct xmit_frame *xmit_frame, u16 ms); -int rtw_IOL_append_END_cmd(struct xmit_frame *xmit_frame); - - -#ifdef CONFIG_IOL_NEW_GENERATION -#define IOREG_CMD_END_LEN 4 - -struct ioreg_cfg{ - u8 length; - u8 cmd_id; - u16 address; - u32 data; - u32 mask; -}; -enum ioreg_cmd{ - IOREG_CMD_LLT = 0x01, - IOREG_CMD_REFUSE = 0x02, - IOREG_CMD_EFUSE_PATH = 0x03, - IOREG_CMD_WB_REG = 0x04, - IOREG_CMD_WW_REG = 0x05, - IOREG_CMD_WD_REG = 0x06, - IOREG_CMD_W_RF = 0x07, - IOREG_CMD_DELAY_US = 0x10, - IOREG_CMD_DELAY_MS = 0x11, - IOREG_CMD_END = 0xFF, -}; -void read_efuse_from_txpktbuf(struct adapter *adapter, int bcnhead, u8 *content, u16 *size); - -int _rtw_IOL_append_WB_cmd(struct xmit_frame *xmit_frame, u16 addr, u8 value, u8 mask); -int _rtw_IOL_append_WW_cmd(struct xmit_frame *xmit_frame, u16 addr, u16 value, u16 mask); -int _rtw_IOL_append_WD_cmd(struct xmit_frame *xmit_frame, u16 addr, u32 value, u32 mask); -int _rtw_IOL_append_WRF_cmd(struct xmit_frame *xmit_frame, u8 rf_path, u16 addr, u32 value, u32 mask); -#define rtw_IOL_append_WB_cmd(xmit_frame, addr, value,mask) _rtw_IOL_append_WB_cmd((xmit_frame), (addr), (value) ,(mask)) -#define rtw_IOL_append_WW_cmd(xmit_frame, addr, value,mask) _rtw_IOL_append_WW_cmd((xmit_frame), (addr), (value),(mask)) -#define rtw_IOL_append_WD_cmd(xmit_frame, addr, value,mask) _rtw_IOL_append_WD_cmd((xmit_frame), (addr), (value),(mask)) -#define rtw_IOL_append_WRF_cmd(xmit_frame, rf_path, addr, value,mask) _rtw_IOL_append_WRF_cmd((xmit_frame),(rf_path), (addr), (value),(mask)) - -u8 rtw_IOL_cmd_boundary_handle(struct xmit_frame *pxmit_frame); -void rtw_IOL_cmd_buf_dump(struct adapter *Adapter,int buf_len,u8 *pbuf); - -#ifdef CONFIG_IOL_IOREG_CFG_DBG - struct cmd_cmp{ - u16 addr; - u32 value; - }; -#endif - -#else //CONFIG_IOL_NEW_GENERATION - -typedef struct _io_offload_cmd { - u8 rsvd0; - u8 cmd; - u16 address; - u32 value; -} IO_OFFLOAD_CMD, IOL_CMD; - -#define IOL_CMD_LLT 0x00 -//#define IOL_CMD_R_EFUSE 0x01 -#define IOL_CMD_WB_REG 0x02 -#define IOL_CMD_WW_REG 0x03 -#define IOL_CMD_WD_REG 0x04 -//#define IOL_CMD_W_RF 0x05 -#define IOL_CMD_DELAY_US 0x80 -#define IOL_CMD_DELAY_MS 0x81 -//#define IOL_CMD_DELAY_S 0x82 -#define IOL_CMD_END 0x83 - -/***************************************************** -CMD Address Value -(B1) (B2/B3:H/L addr) (B4:B7 : MSB:LSB) -****************************************************** -IOL_CMD_LLT - B7: PGBNDY -//IOL_CMD_R_EFUSE - - -IOL_CMD_WB_REG 0x0~0xFFFF B7 -IOL_CMD_WW_REG 0x0~0xFFFF B6~B7 -IOL_CMD_WD_REG 0x0~0xFFFF B4~B7 -//IOL_CMD_W_RF RF Reg B5~B7 -IOL_CMD_DELAY_US - B6~B7 -IOL_CMD_DELAY_MS - B6~B7 -//IOL_CMD_DELAY_S - B6~B7 -IOL_CMD_END - - -******************************************************/ -int _rtw_IOL_append_WB_cmd(struct xmit_frame *xmit_frame, u16 addr, u8 value); -int _rtw_IOL_append_WW_cmd(struct xmit_frame *xmit_frame, u16 addr, u16 value); -int _rtw_IOL_append_WD_cmd(struct xmit_frame *xmit_frame, u16 addr, u32 value); - - -int rtw_IOL_exec_cmd_array_sync(struct adapter *adapter, u8 *IOL_cmds, u32 cmd_num, u32 max_wating_ms); -int rtw_IOL_exec_empty_cmds_sync(struct adapter *adapter, u32 max_wating_ms); - -#ifdef DBG_IO -int dbg_rtw_IOL_append_WB_cmd(struct xmit_frame *xmit_frame, u16 addr, u8 value, const char *caller, const int line); -int dbg_rtw_IOL_append_WW_cmd(struct xmit_frame *xmit_frame, u16 addr, u16 value, const char *caller, const int line); -int dbg_rtw_IOL_append_WD_cmd(struct xmit_frame *xmit_frame, u16 addr, u32 value, const char *caller, const int line); -#define rtw_IOL_append_WB_cmd(xmit_frame, addr, value) dbg_rtw_IOL_append_WB_cmd((xmit_frame), (addr), (value), __FUNCTION__, __LINE__) -#define rtw_IOL_append_WW_cmd(xmit_frame, addr, value) dbg_rtw_IOL_append_WW_cmd((xmit_frame), (addr), (value), __FUNCTION__, __LINE__) -#define rtw_IOL_append_WD_cmd(xmit_frame, addr, value) dbg_rtw_IOL_append_WD_cmd((xmit_frame), (addr), (value), __FUNCTION__, __LINE__) -#else -#define rtw_IOL_append_WB_cmd(xmit_frame, addr, value) _rtw_IOL_append_WB_cmd((xmit_frame), (addr), (value)) -#define rtw_IOL_append_WW_cmd(xmit_frame, addr, value) _rtw_IOL_append_WW_cmd((xmit_frame), (addr), (value)) -#define rtw_IOL_append_WD_cmd(xmit_frame, addr, value) _rtw_IOL_append_WD_cmd((xmit_frame), (addr), (value)) -#endif // DBG_IO -#endif // CONFIG_IOL_NEW_GENERATION - - - -#endif //__RTW_IOL_H_ - +/****************************************************************************** + * + * 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_IOL_H_ +#define __RTW_IOL_H_ + +#include +#include +#include +struct xmit_frame *rtw_IOL_accquire_xmit_frame(struct adapter *adapter); +int rtw_IOL_append_cmds(struct xmit_frame *xmit_frame, u8 *IOL_cmds, u32 cmd_len); +int rtw_IOL_append_LLT_cmd(struct xmit_frame *xmit_frame, u8 page_boundary); +int rtw_IOL_exec_cmds_sync(struct adapter *adapter, struct xmit_frame *xmit_frame, u32 max_wating_ms, u32 bndy_cnt); +bool rtw_IOL_applied(struct adapter *adapter); +int rtw_IOL_append_DELAY_US_cmd(struct xmit_frame *xmit_frame, u16 us); +int rtw_IOL_append_DELAY_MS_cmd(struct xmit_frame *xmit_frame, u16 ms); +int rtw_IOL_append_END_cmd(struct xmit_frame *xmit_frame); + + +#ifdef CONFIG_IOL_NEW_GENERATION +#define IOREG_CMD_END_LEN 4 + +struct ioreg_cfg{ + u8 length; + u8 cmd_id; + u16 address; + u32 data; + u32 mask; +}; +enum ioreg_cmd{ + IOREG_CMD_LLT = 0x01, + IOREG_CMD_REFUSE = 0x02, + IOREG_CMD_EFUSE_PATH = 0x03, + IOREG_CMD_WB_REG = 0x04, + IOREG_CMD_WW_REG = 0x05, + IOREG_CMD_WD_REG = 0x06, + IOREG_CMD_W_RF = 0x07, + IOREG_CMD_DELAY_US = 0x10, + IOREG_CMD_DELAY_MS = 0x11, + IOREG_CMD_END = 0xFF, +}; +void read_efuse_from_txpktbuf(struct adapter *adapter, int bcnhead, u8 *content, u16 *size); + +int _rtw_IOL_append_WB_cmd(struct xmit_frame *xmit_frame, u16 addr, u8 value, u8 mask); +int _rtw_IOL_append_WW_cmd(struct xmit_frame *xmit_frame, u16 addr, u16 value, u16 mask); +int _rtw_IOL_append_WD_cmd(struct xmit_frame *xmit_frame, u16 addr, u32 value, u32 mask); +int _rtw_IOL_append_WRF_cmd(struct xmit_frame *xmit_frame, u8 rf_path, u16 addr, u32 value, u32 mask); +#define rtw_IOL_append_WB_cmd(xmit_frame, addr, value,mask) _rtw_IOL_append_WB_cmd((xmit_frame), (addr), (value) ,(mask)) +#define rtw_IOL_append_WW_cmd(xmit_frame, addr, value,mask) _rtw_IOL_append_WW_cmd((xmit_frame), (addr), (value),(mask)) +#define rtw_IOL_append_WD_cmd(xmit_frame, addr, value,mask) _rtw_IOL_append_WD_cmd((xmit_frame), (addr), (value),(mask)) +#define rtw_IOL_append_WRF_cmd(xmit_frame, rf_path, addr, value,mask) _rtw_IOL_append_WRF_cmd((xmit_frame),(rf_path), (addr), (value),(mask)) + +u8 rtw_IOL_cmd_boundary_handle(struct xmit_frame *pxmit_frame); +void rtw_IOL_cmd_buf_dump(struct adapter *Adapter,int buf_len,u8 *pbuf); + +#ifdef CONFIG_IOL_IOREG_CFG_DBG + struct cmd_cmp{ + u16 addr; + u32 value; + }; +#endif + +#else //CONFIG_IOL_NEW_GENERATION + +typedef struct _io_offload_cmd { + u8 rsvd0; + u8 cmd; + u16 address; + u32 value; +} IO_OFFLOAD_CMD, IOL_CMD; + +#define IOL_CMD_LLT 0x00 +//#define IOL_CMD_R_EFUSE 0x01 +#define IOL_CMD_WB_REG 0x02 +#define IOL_CMD_WW_REG 0x03 +#define IOL_CMD_WD_REG 0x04 +//#define IOL_CMD_W_RF 0x05 +#define IOL_CMD_DELAY_US 0x80 +#define IOL_CMD_DELAY_MS 0x81 +//#define IOL_CMD_DELAY_S 0x82 +#define IOL_CMD_END 0x83 + +/***************************************************** +CMD Address Value +(B1) (B2/B3:H/L addr) (B4:B7 : MSB:LSB) +****************************************************** +IOL_CMD_LLT - B7: PGBNDY +//IOL_CMD_R_EFUSE - - +IOL_CMD_WB_REG 0x0~0xFFFF B7 +IOL_CMD_WW_REG 0x0~0xFFFF B6~B7 +IOL_CMD_WD_REG 0x0~0xFFFF B4~B7 +//IOL_CMD_W_RF RF Reg B5~B7 +IOL_CMD_DELAY_US - B6~B7 +IOL_CMD_DELAY_MS - B6~B7 +//IOL_CMD_DELAY_S - B6~B7 +IOL_CMD_END - - +******************************************************/ +int _rtw_IOL_append_WB_cmd(struct xmit_frame *xmit_frame, u16 addr, u8 value); +int _rtw_IOL_append_WW_cmd(struct xmit_frame *xmit_frame, u16 addr, u16 value); +int _rtw_IOL_append_WD_cmd(struct xmit_frame *xmit_frame, u16 addr, u32 value); + + +int rtw_IOL_exec_cmd_array_sync(struct adapter *adapter, u8 *IOL_cmds, u32 cmd_num, u32 max_wating_ms); +int rtw_IOL_exec_empty_cmds_sync(struct adapter *adapter, u32 max_wating_ms); + +#ifdef DBG_IO +int dbg_rtw_IOL_append_WB_cmd(struct xmit_frame *xmit_frame, u16 addr, u8 value, const char *caller, const int line); +int dbg_rtw_IOL_append_WW_cmd(struct xmit_frame *xmit_frame, u16 addr, u16 value, const char *caller, const int line); +int dbg_rtw_IOL_append_WD_cmd(struct xmit_frame *xmit_frame, u16 addr, u32 value, const char *caller, const int line); +#define rtw_IOL_append_WB_cmd(xmit_frame, addr, value) dbg_rtw_IOL_append_WB_cmd((xmit_frame), (addr), (value), __FUNCTION__, __LINE__) +#define rtw_IOL_append_WW_cmd(xmit_frame, addr, value) dbg_rtw_IOL_append_WW_cmd((xmit_frame), (addr), (value), __FUNCTION__, __LINE__) +#define rtw_IOL_append_WD_cmd(xmit_frame, addr, value) dbg_rtw_IOL_append_WD_cmd((xmit_frame), (addr), (value), __FUNCTION__, __LINE__) +#else +#define rtw_IOL_append_WB_cmd(xmit_frame, addr, value) _rtw_IOL_append_WB_cmd((xmit_frame), (addr), (value)) +#define rtw_IOL_append_WW_cmd(xmit_frame, addr, value) _rtw_IOL_append_WW_cmd((xmit_frame), (addr), (value)) +#define rtw_IOL_append_WD_cmd(xmit_frame, addr, value) _rtw_IOL_append_WD_cmd((xmit_frame), (addr), (value)) +#endif // DBG_IO +#endif // CONFIG_IOL_NEW_GENERATION + + + +#endif //__RTW_IOL_H_ diff --git a/include/rtw_led.h b/include/rtw_led.h index 427b94b..0a48d30 100755 --- a/include/rtw_led.h +++ b/include/rtw_led.h @@ -1,7 +1,7 @@ /****************************************************************************** * * 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. @@ -16,222 +16,221 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA * * - ******************************************************************************/ -#ifndef __RTW_LED_H_ -#define __RTW_LED_H_ - -#include -#include -#include - -#define MSECS(t) (HZ * ((t) / 1000) + (HZ * ((t) % 1000)) / 1000) - -#define LED_BLINK_NORMAL_INTERVAL 100 -#define LED_BLINK_SLOWLY_INTERVAL 200 -#define LED_BLINK_LONG_INTERVAL 400 - -#define LED_BLINK_NO_LINK_INTERVAL_ALPHA 1000 -#define LED_BLINK_LINK_INTERVAL_ALPHA 500 //500 -#define LED_BLINK_SCAN_INTERVAL_ALPHA 180 //150 -#define LED_BLINK_FASTER_INTERVAL_ALPHA 50 -#define LED_BLINK_WPS_SUCESS_INTERVAL_ALPHA 5000 - -#define LED_BLINK_NORMAL_INTERVAL_NETTRONIX 100 -#define LED_BLINK_SLOWLY_INTERVAL_NETTRONIX 2000 - -#define LED_BLINK_SLOWLY_INTERVAL_PORNET 1000 -#define LED_BLINK_NORMAL_INTERVAL_PORNET 100 - -#define LED_BLINK_FAST_INTERVAL_BITLAND 30 - -// 060403, rcnjko: Customized for AzWave. -#define LED_CM2_BLINK_ON_INTERVAL 250 -#define LED_CM2_BLINK_OFF_INTERVAL 4750 - -#define LED_CM8_BLINK_INTERVAL 500 //for QMI -#define LED_CM8_BLINK_OFF_INTERVAL 3750 //for QMI - -// 080124, lanhsin: Customized for RunTop -#define LED_RunTop_BLINK_INTERVAL 300 - -// 060421, rcnjko: Customized for Sercomm Printer Server case. -#define LED_CM3_BLINK_INTERVAL 1500 - -typedef enum _LED_CTL_MODE{ - LED_CTL_POWER_ON = 1, - LED_CTL_LINK = 2, - LED_CTL_NO_LINK = 3, - LED_CTL_TX = 4, - LED_CTL_RX = 5, - LED_CTL_SITE_SURVEY = 6, - LED_CTL_POWER_OFF = 7, - LED_CTL_START_TO_LINK = 8, - LED_CTL_START_WPS = 9, - LED_CTL_STOP_WPS = 10, - LED_CTL_START_WPS_BOTTON = 11, //added for runtop - LED_CTL_STOP_WPS_FAIL = 12, //added for ALPHA - LED_CTL_STOP_WPS_FAIL_OVERLAP = 13, //added for BELKIN - LED_CTL_CONNECTION_NO_TRANSFER = 14, -}LED_CTL_MODE; - -typedef enum _LED_STATE_871x{ - LED_UNKNOWN = 0, - RTW_LED_ON = 1, - RTW_LED_OFF = 2, - LED_BLINK_NORMAL = 3, - LED_BLINK_SLOWLY = 4, - LED_BLINK_POWER_ON = 5, - LED_BLINK_SCAN = 6, // LED is blinking during scanning period, the # of times to blink is depend on time for scanning. - LED_BLINK_NO_LINK = 7, // LED is blinking during no link state. - LED_BLINK_StartToBlink = 8,// Customzied for Sercomm Printer Server case - LED_BLINK_TXRX = 9, - LED_BLINK_WPS = 10, // LED is blinkg during WPS communication - LED_BLINK_WPS_STOP = 11, //for ALPHA - LED_BLINK_WPS_STOP_OVERLAP = 12, //for BELKIN - LED_BLINK_RUNTOP = 13, // Customized for RunTop - LED_BLINK_CAMEO = 14, - LED_BLINK_XAVI = 15, - LED_BLINK_ALWAYS_ON = 16, -}LED_STATE_871x; - -typedef enum _LED_PIN_871x{ - LED_PIN_NULL = 0, - LED_PIN_LED0 = 1, - LED_PIN_LED1 = 2, - LED_PIN_LED2 = 3, - LED_PIN_GPIO0 = 4, -}LED_PIN_871x; - -typedef struct _LED_871x{ - struct adapter *padapter; - - LED_PIN_871x LedPin; // Identify how to implement this SW led. - LED_STATE_871x CurrLedState; // Current LED state. - LED_STATE_871x BlinkingLedState; // Next state for blinking, either RTW_LED_ON or RTW_LED_OFF are. - - u8 bLedOn; // true if LED is ON, false if LED is OFF. - - u8 bLedBlinkInProgress; // true if it is blinking, false o.w.. - - u8 bLedWPSBlinkInProgress; - - u32 BlinkTimes; // Number of times to toggle led state for blinking. - - _timer BlinkTimer; // Timer object for led blinking. - -#if defined(CONFIG_USB_HCI) || defined(CONFIG_SDIO_HCI) || defined(CONFIG_GSPI_HCI) - u8 bSWLedCtrl; - - // ALPHA, added by chiyoko, 20090106 - u8 bLedNoLinkBlinkInProgress; - u8 bLedLinkBlinkInProgress; - u8 bLedStartToLinkBlinkInProgress; - u8 bLedScanBlinkInProgress; - + ******************************************************************************/ +#ifndef __RTW_LED_H_ +#define __RTW_LED_H_ + +#include +#include +#include + +#define MSECS(t) (HZ * ((t) / 1000) + (HZ * ((t) % 1000)) / 1000) + +#define LED_BLINK_NORMAL_INTERVAL 100 +#define LED_BLINK_SLOWLY_INTERVAL 200 +#define LED_BLINK_LONG_INTERVAL 400 + +#define LED_BLINK_NO_LINK_INTERVAL_ALPHA 1000 +#define LED_BLINK_LINK_INTERVAL_ALPHA 500 //500 +#define LED_BLINK_SCAN_INTERVAL_ALPHA 180 //150 +#define LED_BLINK_FASTER_INTERVAL_ALPHA 50 +#define LED_BLINK_WPS_SUCESS_INTERVAL_ALPHA 5000 + +#define LED_BLINK_NORMAL_INTERVAL_NETTRONIX 100 +#define LED_BLINK_SLOWLY_INTERVAL_NETTRONIX 2000 + +#define LED_BLINK_SLOWLY_INTERVAL_PORNET 1000 +#define LED_BLINK_NORMAL_INTERVAL_PORNET 100 + +#define LED_BLINK_FAST_INTERVAL_BITLAND 30 + +// 060403, rcnjko: Customized for AzWave. +#define LED_CM2_BLINK_ON_INTERVAL 250 +#define LED_CM2_BLINK_OFF_INTERVAL 4750 + +#define LED_CM8_BLINK_INTERVAL 500 //for QMI +#define LED_CM8_BLINK_OFF_INTERVAL 3750 //for QMI + +// 080124, lanhsin: Customized for RunTop +#define LED_RunTop_BLINK_INTERVAL 300 + +// 060421, rcnjko: Customized for Sercomm Printer Server case. +#define LED_CM3_BLINK_INTERVAL 1500 + +typedef enum _LED_CTL_MODE{ + LED_CTL_POWER_ON = 1, + LED_CTL_LINK = 2, + LED_CTL_NO_LINK = 3, + LED_CTL_TX = 4, + LED_CTL_RX = 5, + LED_CTL_SITE_SURVEY = 6, + LED_CTL_POWER_OFF = 7, + LED_CTL_START_TO_LINK = 8, + LED_CTL_START_WPS = 9, + LED_CTL_STOP_WPS = 10, + LED_CTL_START_WPS_BOTTON = 11, //added for runtop + LED_CTL_STOP_WPS_FAIL = 12, //added for ALPHA + LED_CTL_STOP_WPS_FAIL_OVERLAP = 13, //added for BELKIN + LED_CTL_CONNECTION_NO_TRANSFER = 14, +}LED_CTL_MODE; + +typedef enum _LED_STATE_871x{ + LED_UNKNOWN = 0, + RTW_LED_ON = 1, + RTW_LED_OFF = 2, + LED_BLINK_NORMAL = 3, + LED_BLINK_SLOWLY = 4, + LED_BLINK_POWER_ON = 5, + LED_BLINK_SCAN = 6, // LED is blinking during scanning period, the # of times to blink is depend on time for scanning. + LED_BLINK_NO_LINK = 7, // LED is blinking during no link state. + LED_BLINK_StartToBlink = 8,// Customzied for Sercomm Printer Server case + LED_BLINK_TXRX = 9, + LED_BLINK_WPS = 10, // LED is blinkg during WPS communication + LED_BLINK_WPS_STOP = 11, //for ALPHA + LED_BLINK_WPS_STOP_OVERLAP = 12, //for BELKIN + LED_BLINK_RUNTOP = 13, // Customized for RunTop + LED_BLINK_CAMEO = 14, + LED_BLINK_XAVI = 15, + LED_BLINK_ALWAYS_ON = 16, +}LED_STATE_871x; + +typedef enum _LED_PIN_871x{ + LED_PIN_NULL = 0, + LED_PIN_LED0 = 1, + LED_PIN_LED1 = 2, + LED_PIN_LED2 = 3, + LED_PIN_GPIO0 = 4, +}LED_PIN_871x; + +typedef struct _LED_871x{ + struct adapter *padapter; + + LED_PIN_871x LedPin; // Identify how to implement this SW led. + LED_STATE_871x CurrLedState; // Current LED state. + LED_STATE_871x BlinkingLedState; // Next state for blinking, either RTW_LED_ON or RTW_LED_OFF are. + + u8 bLedOn; // true if LED is ON, false if LED is OFF. + + u8 bLedBlinkInProgress; // true if it is blinking, false o.w.. + + u8 bLedWPSBlinkInProgress; + + u32 BlinkTimes; // Number of times to toggle led state for blinking. + + _timer BlinkTimer; // Timer object for led blinking. + +#if defined(CONFIG_USB_HCI) || defined(CONFIG_SDIO_HCI) || defined(CONFIG_GSPI_HCI) + u8 bSWLedCtrl; + + // ALPHA, added by chiyoko, 20090106 + u8 bLedNoLinkBlinkInProgress; + u8 bLedLinkBlinkInProgress; + u8 bLedStartToLinkBlinkInProgress; + u8 bLedScanBlinkInProgress; + #if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) - _workitem BlinkWorkItem; // Workitem used by BlinkTimer to manipulate H/W to blink LED. - #endif -#endif //defined(CONFIG_USB_HCI) || defined(CONFIG_SDIO_HCI) || defined(CONFIG_GSPI_HCI) - -#if defined(CONFIG_PCI_HCI) - u8 bLedSlowBlinkInProgress;//added by vivi, for led new mode -#endif - -} LED_871x, *PLED_871x; - -#if defined(CONFIG_USB_HCI) || defined(CONFIG_SDIO_HCI) || defined(CONFIG_GSPI_HCI) - -#define IS_LED_WPS_BLINKING(_LED_871x) (((PLED_871x)_LED_871x)->CurrLedState==LED_BLINK_WPS \ - || ((PLED_871x)_LED_871x)->CurrLedState==LED_BLINK_WPS_STOP \ - || ((PLED_871x)_LED_871x)->bLedWPSBlinkInProgress) - -#define IS_LED_BLINKING(_LED_871x) (((PLED_871x)_LED_871x)->bLedWPSBlinkInProgress \ - ||((PLED_871x)_LED_871x)->bLedScanBlinkInProgress) - -//================================================================================ -// LED customization. -//================================================================================ - -typedef enum _LED_STRATEGY_871x{ - SW_LED_MODE0 = 0, // SW control 1 LED via GPIO0. It is default option. - SW_LED_MODE1= 1, // 2 LEDs, through LED0 and LED1. For ALPHA. - SW_LED_MODE2 = 2, // SW control 1 LED via GPIO0, customized for AzWave 8187 minicard. - SW_LED_MODE3 = 3, // SW control 1 LED via GPIO0, customized for Sercomm Printer Server case. - SW_LED_MODE4 = 4, //for Edimax / Belkin - SW_LED_MODE5 = 5, //for Sercomm / Belkin - SW_LED_MODE6 = 6, //for 88CU minicard, porting from ce SW_LED_MODE7 - HW_LED = 50, // HW control 2 LEDs, LED0 and LED1 (there are 4 different control modes, see MAC.CONFIG1 for details.) - LED_ST_NONE = 99, -}LED_STRATEGY_871x, *PLED_STRATEGY_871x; - -void -LedControl871x( - struct adapter *padapter, - LED_CTL_MODE LedAction - ); -#endif //defined(CONFIG_USB_HCI) || defined(CONFIG_SDIO_HCI) || defined(CONFIG_GSPI_HCI) - -#if defined(CONFIG_PCI_HCI) -//================================================================================ -// LED customization. -//================================================================================ - -typedef enum _LED_STRATEGY_871x{ - SW_LED_MODE0 = 0, // SW control 1 LED via GPIO0. It is default option. - SW_LED_MODE1 = 1, // SW control for PCI Express - SW_LED_MODE2 = 2, // SW control for Cameo. - SW_LED_MODE3 = 3, // SW contorl for RunTop. - SW_LED_MODE4 = 4, // SW control for Netcore - SW_LED_MODE5 = 5, //added by vivi, for led new mode, DLINK - SW_LED_MODE6 = 6, //added by vivi, for led new mode, PRONET - SW_LED_MODE7 = 7, //added by chiyokolin, for Lenovo, PCI Express Minicard Spec Rev.1.2 spec - SW_LED_MODE8 = 8, //added by chiyokolin, for QMI - SW_LED_MODE9 = 9, //added by chiyokolin, for BITLAND, PCI Express Minicard Spec Rev.1.1 - SW_LED_MODE10 = 10, //added by chiyokolin, for Edimax-ASUS - HW_LED = 50, // HW control 2 LEDs, LED0 and LED1 (there are 4 different control modes) - LED_ST_NONE = 99, -}LED_STRATEGY_871x, *PLED_STRATEGY_871x; -#endif //defined(CONFIG_PCI_HCI) - -struct led_priv{ - /* add for led controll */ - LED_871x SwLed0; - LED_871x SwLed1; - LED_STRATEGY_871x LedStrategy; - u8 bRegUseLed; - void (*LedControlHandler)(struct adapter *padapter, LED_CTL_MODE LedAction); - /* add for led controll */ -}; - -#ifdef CONFIG_SW_LED -#define rtw_led_control(adapter, LedAction) \ - do { \ - if((adapter)->ledpriv.LedControlHandler) \ - (adapter)->ledpriv.LedControlHandler((adapter), (LedAction)); \ - } while(0) -#else //CONFIG_SW_LED -#define rtw_led_control(adapter, LedAction) -#endif //CONFIG_SW_LED - -void BlinkTimerCallback(void *data); -void BlinkWorkItemCallback(struct work_struct *work); - -void ResetLedStatus(PLED_871x pLed); - -void -InitLed871x( - struct adapter *padapter, - PLED_871x pLed, - LED_PIN_871x LedPin - ); - -void -DeInitLed871x( - PLED_871x pLed - ); - -//hal... -extern void BlinkHandler(PLED_871x pLed); - -#endif //__RTW_LED_H_ - + _workitem BlinkWorkItem; // Workitem used by BlinkTimer to manipulate H/W to blink LED. + #endif +#endif //defined(CONFIG_USB_HCI) || defined(CONFIG_SDIO_HCI) || defined(CONFIG_GSPI_HCI) + +#if defined(CONFIG_PCI_HCI) + u8 bLedSlowBlinkInProgress;//added by vivi, for led new mode +#endif + +} LED_871x, *PLED_871x; + +#if defined(CONFIG_USB_HCI) || defined(CONFIG_SDIO_HCI) || defined(CONFIG_GSPI_HCI) + +#define IS_LED_WPS_BLINKING(_LED_871x) (((PLED_871x)_LED_871x)->CurrLedState==LED_BLINK_WPS \ + || ((PLED_871x)_LED_871x)->CurrLedState==LED_BLINK_WPS_STOP \ + || ((PLED_871x)_LED_871x)->bLedWPSBlinkInProgress) + +#define IS_LED_BLINKING(_LED_871x) (((PLED_871x)_LED_871x)->bLedWPSBlinkInProgress \ + ||((PLED_871x)_LED_871x)->bLedScanBlinkInProgress) + +//================================================================================ +// LED customization. +//================================================================================ + +typedef enum _LED_STRATEGY_871x{ + SW_LED_MODE0 = 0, // SW control 1 LED via GPIO0. It is default option. + SW_LED_MODE1= 1, // 2 LEDs, through LED0 and LED1. For ALPHA. + SW_LED_MODE2 = 2, // SW control 1 LED via GPIO0, customized for AzWave 8187 minicard. + SW_LED_MODE3 = 3, // SW control 1 LED via GPIO0, customized for Sercomm Printer Server case. + SW_LED_MODE4 = 4, //for Edimax / Belkin + SW_LED_MODE5 = 5, //for Sercomm / Belkin + SW_LED_MODE6 = 6, //for 88CU minicard, porting from ce SW_LED_MODE7 + HW_LED = 50, // HW control 2 LEDs, LED0 and LED1 (there are 4 different control modes, see MAC.CONFIG1 for details.) + LED_ST_NONE = 99, +}LED_STRATEGY_871x, *PLED_STRATEGY_871x; + +void +LedControl871x( + struct adapter *padapter, + LED_CTL_MODE LedAction + ); +#endif //defined(CONFIG_USB_HCI) || defined(CONFIG_SDIO_HCI) || defined(CONFIG_GSPI_HCI) + +#if defined(CONFIG_PCI_HCI) +//================================================================================ +// LED customization. +//================================================================================ + +typedef enum _LED_STRATEGY_871x{ + SW_LED_MODE0 = 0, // SW control 1 LED via GPIO0. It is default option. + SW_LED_MODE1 = 1, // SW control for PCI Express + SW_LED_MODE2 = 2, // SW control for Cameo. + SW_LED_MODE3 = 3, // SW contorl for RunTop. + SW_LED_MODE4 = 4, // SW control for Netcore + SW_LED_MODE5 = 5, //added by vivi, for led new mode, DLINK + SW_LED_MODE6 = 6, //added by vivi, for led new mode, PRONET + SW_LED_MODE7 = 7, //added by chiyokolin, for Lenovo, PCI Express Minicard Spec Rev.1.2 spec + SW_LED_MODE8 = 8, //added by chiyokolin, for QMI + SW_LED_MODE9 = 9, //added by chiyokolin, for BITLAND, PCI Express Minicard Spec Rev.1.1 + SW_LED_MODE10 = 10, //added by chiyokolin, for Edimax-ASUS + HW_LED = 50, // HW control 2 LEDs, LED0 and LED1 (there are 4 different control modes) + LED_ST_NONE = 99, +}LED_STRATEGY_871x, *PLED_STRATEGY_871x; +#endif //defined(CONFIG_PCI_HCI) + +struct led_priv{ + /* add for led controll */ + LED_871x SwLed0; + LED_871x SwLed1; + LED_STRATEGY_871x LedStrategy; + u8 bRegUseLed; + void (*LedControlHandler)(struct adapter *padapter, LED_CTL_MODE LedAction); + /* add for led controll */ +}; + +#ifdef CONFIG_SW_LED +#define rtw_led_control(adapter, LedAction) \ + do { \ + if((adapter)->ledpriv.LedControlHandler) \ + (adapter)->ledpriv.LedControlHandler((adapter), (LedAction)); \ + } while(0) +#else //CONFIG_SW_LED +#define rtw_led_control(adapter, LedAction) +#endif //CONFIG_SW_LED + +void BlinkTimerCallback(void *data); +void BlinkWorkItemCallback(struct work_struct *work); + +void ResetLedStatus(PLED_871x pLed); + +void +InitLed871x( + struct adapter *padapter, + PLED_871x pLed, + LED_PIN_871x LedPin + ); + +void +DeInitLed871x( + PLED_871x pLed + ); + +//hal... +extern void BlinkHandler(PLED_871x pLed); + +#endif //__RTW_LED_H_ diff --git a/include/rtw_mlme.h b/include/rtw_mlme.h index 6d7c665..7b86911 100755 --- a/include/rtw_mlme.h +++ b/include/rtw_mlme.h @@ -1,7 +1,7 @@ /****************************************************************************** * * 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. @@ -38,7 +38,7 @@ // Commented by Albert 20101105 // Increase the scanning timeout because of increasing the SURVEY_TO value. -#define SCANNING_TIMEOUT 8000 +#define SCANNING_TIMEOUT 8000 #define SCAN_INTERVAL (30) // unit:2sec, 30*2=60sec @@ -48,10 +48,10 @@ #define SCANQUEUE_LIFETIME 20 // unit:sec #endif -#define WIFI_NULL_STATE 0x00000000 +#define WIFI_NULL_STATE 0x00000000 #define WIFI_ASOC_STATE 0x00000001 // Under Linked state... -#define WIFI_REASOC_STATE 0x00000002 +#define WIFI_REASOC_STATE 0x00000002 #define WIFI_SLEEP_STATE 0x00000004 #define WIFI_STATION_STATE 0x00000008 @@ -211,7 +211,7 @@ struct wifi_display_info{ u8 wfd_pc; // WFD preferred connection // 0 -> Prefer to use the P2P for WFD connection on peer side. // 1 -> Prefer to use the TDLS for WFD connection on peer side. - + u8 wfd_device_type; // WFD Device Type // 0 -> WFD Source Device // 1 -> WFD Primary Sink Device @@ -230,7 +230,7 @@ struct tx_provdisc_req_info{ struct rx_provdisc_req_info{ //When peer device issue prov_disc_req first, we should store the following informations 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. + u8 strconfig_method_desc_of_prov_disc_req[4]; // description for the config method located in the provisioning discovery request frame. // The UI must know this information to know which config method the remote p2p device is requiring. }; @@ -269,7 +269,7 @@ struct wifidirect_info{ struct adapter* padapter; _timer find_phase_timer; _timer restore_p2p_state_timer; - + // Used to do the scanning. After confirming the peer is availalble, the driver transmits the P2P frame to peer. _timer pre_tx_scan_timer; _timer reset_ch_sitesurvey; @@ -289,11 +289,11 @@ struct wifidirect_info{ struct scan_limit_info p2p_info; // Used for get the limit scan channel from the P2P negotiation handshake #ifdef CONFIG_WFD struct wifi_display_info *wfd_info; -#endif +#endif enum P2P_ROLE role; enum P2P_STATE pre_p2p_state; enum P2P_STATE p2p_state; - u8 device_addr[ETH_ALEN]; // The device address should be the mac address of this device. + u8 device_addr[ETH_ALEN]; // The device address should be the mac address of this device. u8 interface_addr[ETH_ALEN]; u8 social_chan[4]; u8 listen_channel; @@ -314,8 +314,8 @@ struct wifidirect_info{ u8 negotiation_dialog_token; u8 nego_ssid[ WLAN_SSID_MAXLEN ]; // SSID information for group negotitation u8 nego_ssidlen; - u8 p2p_group_ssid[WLAN_SSID_MAXLEN]; - u8 p2p_group_ssid_len; + u8 p2p_group_ssid[WLAN_SSID_MAXLEN]; + u8 p2p_group_ssid_len; u8 persistent_supported; // Flag to know the persistent function should be supported or not. // In the Sigma test, the Sigma will provide this enable from the sta_set_p2p CAPI. // 0: disable @@ -337,7 +337,7 @@ struct wifidirect_info{ enum P2P_WPSINFO ui_got_wps_info; // This field will store the WPS value (PIN value or PBC) that UI had got from the user. 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. + // The value should be the combination of config method defined in page104 of WPS v2.0 spec. u8 external_uuid; // UUID flag u8 uuid[16]; // UUID uint channel_list_attr_len; // This field will contain the length of body of P2P Channel List attribute of group negotitation response frame. @@ -388,7 +388,7 @@ struct tdls_info{ u8 enable; #ifdef CONFIG_WFD struct wifi_display_info *wfd_info; -#endif +#endif }; struct mlme_priv { @@ -450,7 +450,7 @@ struct mlme_priv { int num_sta_no_ht; /* Number of HT AP/stations 20 MHz */ - //int num_sta_ht_20mhz; + //int num_sta_ht_20mhz; int num_FortyMHzIntolerant; @@ -464,9 +464,9 @@ struct mlme_priv { u8 acm_mask; // for wmm acm mask u8 ChannelPlan; - RT_SCAN_TYPE scan_mode; // active: 1, passive: 0 + RT_SCAN_TYPE scan_mode; // active: 1, passive: 0 - //u8 probereq_wpsie[MAX_WPS_IE_LEN];//added in probe req + //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; @@ -495,17 +495,17 @@ struct mlme_priv { /* Overlapping BSS information */ int olbc_ht; - + #ifdef CONFIG_80211N_HT u16 ht_op_mode; -#endif /* CONFIG_80211N_HT */ +#endif /* CONFIG_80211N_HT */ u8 *assoc_req; u32 assoc_req_len; u8 *assoc_rsp; u32 assoc_rsp_len; - u8 *wps_beacon_ie; + u8 *wps_beacon_ie; //u8 *wps_probe_req_ie; u8 *wps_probe_resp_ie; u8 *wps_assoc_resp_ie; // for CONFIG_IOCTL_CFG80211, this IE could include p2p ie / wfd ie @@ -514,11 +514,11 @@ struct mlme_priv { //u32 wps_probe_req_ie_len; u32 wps_probe_resp_ie_len; u32 wps_assoc_resp_ie_len; // for CONFIG_IOCTL_CFG80211, this IE len could include p2p ie / wfd ie - + u8 *p2p_beacon_ie; u8 *p2p_probe_req_ie; - u8 *p2p_probe_resp_ie; - u8 *p2p_go_probe_resp_ie; //for GO + u8 *p2p_probe_resp_ie; + u8 *p2p_go_probe_resp_ie; //for GO u8 *p2p_assoc_req_ie; u32 p2p_beacon_ie_len; @@ -538,19 +538,19 @@ struct mlme_priv { u32 wps_p2p_assoc_resp_ie_len; #endif */ - + _lock bcn_update_lock; u8 update_bcn; - - + + #endif //#if defined (CONFIG_AP_MODE) && defined (CONFIG_NATIVEAP_MLME) #if defined(CONFIG_WFD) && defined(CONFIG_IOCTL_CFG80211) - + u8 *wfd_beacon_ie; u8 *wfd_probe_req_ie; - u8 *wfd_probe_resp_ie; - u8 *wfd_go_probe_resp_ie; //for GO + u8 *wfd_probe_resp_ie; + u8 *wfd_go_probe_resp_ie; //for GO u8 *wfd_assoc_req_ie; u32 wfd_beacon_ie_len; @@ -612,8 +612,8 @@ struct hostapd_priv #ifdef CONFIG_HOSTAPD_MLME struct net_device *pmgnt_netdev; struct usb_anchor anchored; -#endif - +#endif + }; extern int hostapd_mode_init(struct adapter *padapter); @@ -846,4 +846,3 @@ void rtw_proxim_disable(struct adapter *padapter); void rtw_proxim_send_packet(struct adapter *padapter,u8 *pbuf,u16 len,u8 hw_rate); #endif //CONFIG_INTEL_PROXIM #endif //__RTL871X_MLME_H_ - diff --git a/include/rtw_mlme_ext.h b/include/rtw_mlme_ext.h index a2f0966..bc5a3c6 100755 --- a/include/rtw_mlme_ext.h +++ b/include/rtw_mlme_ext.h @@ -1,7 +1,7 @@ /****************************************************************************** * * 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. @@ -49,7 +49,7 @@ #else #define ROAMING_LIMIT 8 #endif -//#define IOCMD_REG0 0x10250370 +//#define IOCMD_REG0 0x10250370 //#define IOCMD_REG1 0x10250374 //#define IOCMD_REG2 0x10250378 @@ -65,32 +65,32 @@ // 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_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_TRAIN BIT(8) -#define DYNAMIC_BB_RATE_ADAPTIVE BIT(9) -#define DYNAMIC_BB_PATH_DIV BIT(10) -#define DYNAMIC_BB_PSD BIT(11) +#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_TRAIN 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) +#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_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 DYNAMIC_ALL_FUNC_ENABLE 0xFFFFFFF #define _HW_STATE_NOLINK_ 0x00 #define _HW_STATE_ADHOC_ 0x01 -#define _HW_STATE_STATION_ 0x02 +#define _HW_STATE_STATION_ 0x02 #define _HW_STATE_AP_ 0x03 @@ -120,12 +120,12 @@ extern unsigned char REALTEK_96B_IE[]; // // Channel Plan Type. -// Note: -// We just add new channel plan when the new channel plan is different from any of the following -// channel plan. +// 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 RT_CHANNEL_INFO in the RT_CHANNEL_LIST. -// +// typedef enum _RT_CHANNEL_DOMAIN { //===== old channel plan mapping =====// @@ -252,31 +252,31 @@ enum Associated_AP marvellAP = 3, ralinkAP = 4, realtekAP = 5, - airgocapAP = 6, + airgocapAP = 6, unknownAP = 7, maxAP, }; typedef 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, by Bohn, 2009.12.17 - 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 + 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, by Bohn, 2009.12.17 + 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 }HT_IOT_PEER_E, *PHTIOT_PEER_E; @@ -302,7 +302,7 @@ struct action_handler { unsigned int (*func)(struct adapter *padapter, union recv_frame *precv_frame); }; -struct ss_res +struct ss_res { int state; int bss_cnt; @@ -319,7 +319,7 @@ struct ss_res //#define AD_HOC_MODE 0x04 //#define NO_LINK_MODE 0x00 -#define WIFI_FW_NULL_STATE _HW_STATE_NOLINK_ +#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_ @@ -349,15 +349,15 @@ struct ss_res // 13: Free TDLS sta enum TDLS_option { - TDLS_WRCR = 1, - TDLS_SD_PTI = 2, - TDLS_CS_OFF = 3, - TDLS_INIT_CH_SEN = 4, + TDLS_WRCR = 1, + TDLS_SD_PTI = 2, + TDLS_CS_OFF = 3, + TDLS_INIT_CH_SEN = 4, TDLS_DONE_CH_SEN = 5, TDLS_OFF_CH = 6, - TDLS_BASE_CH = 7, + TDLS_BASE_CH = 7, TDLS_P_OFF_CH = 8, - TDLS_P_BASE_CH = 9, + TDLS_P_BASE_CH = 9, TDLS_RS_RCR = 10, TDLS_CKALV_PH1 = 11, TDLS_CKALV_PH2 = 12, @@ -378,17 +378,17 @@ struct FW_Sta_Info /* * Usage: - * When one iface acted as AP mode and the other iface is STA mode and scanning, + * 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, + * 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_MILLISECOND 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 + * 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 @@ -396,8 +396,8 @@ struct FW_Sta_Info */ #if defined CONFIG_STA_MODE_SCAN_UNDER_AP_MODE && defined CONFIG_CONCURRENT_MODE #define RTW_SCAN_NUM_OF_CH 8 -#define RTW_STAY_AP_CH_MILLISECOND 3 // this value is a multiplier,for example, when this value is 3, it would stay AP's op ch for - // 3 * SURVEY_TO millisecond. +#define RTW_STAY_AP_CH_MILLISECOND 3 // this value is a multiplier,for example, when this value is 3, it would stay AP's op ch for + // 3 * SURVEY_TO millisecond. #endif //defined CONFIG_STA_MODE_SCAN_UNDER_AP_MODE && defined CONFIG_CONCURRENT_MODE struct mlme_ext_info @@ -423,7 +423,7 @@ struct mlme_ext_info u8 ERP_enable; u8 ERP_IE; u8 HT_enable; - u8 HT_caps_enable; + u8 HT_caps_enable; u8 HT_info_enable; u8 HT_protection; u8 turboMode_cts2self; @@ -509,20 +509,20 @@ struct mlme_ext_priv u64 mgnt_80211w_IPN; u64 mgnt_80211w_IPN_rx; #endif //CONFIG_IEEE80211W - //struct fw_priv fwpriv; - + //struct fw_priv fwpriv; + 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 max_chan_nums; 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 ss_res sitesurvey_res; struct mlme_ext_info mlmext_info;//for sta/adhoc mode, including current scanning/connecting/connected related info. //for ap mode, network includes ap's cap_info _timer survey_timer; @@ -537,19 +537,19 @@ struct mlme_ext_priv u8 tx_rate; // TXRATE when USERATE is set. u32 retry; //retry for issue probereq - + u64 TSFValue; -#ifdef CONFIG_AP_MODE +#ifdef CONFIG_AP_MODE unsigned char bstart_bss; #endif #ifdef CONFIG_80211D u8 update_channel_plan_by_ap_done; #endif - //recv_decache check for Action_public frame + //recv_decache check for Action_public frame u8 action_public_dialog_token; - u16 action_public_rxseq; + u16 action_public_rxseq; #ifdef CONFIG_ACTIVE_KEEP_ALIVE_CHECK u8 active_keep_alive_check; @@ -810,7 +810,7 @@ int rtw_get_ch_setting_union(struct adapter *adapter, u8 *ch, u8 *bw, u8 *offset struct cmd_hdl { uint parmsize; - u8 (*h2cfuns)(struct adapter *padapter, u8 *pbuf); + u8 (*h2cfuns)(struct adapter *padapter, u8 *pbuf); }; @@ -827,7 +827,7 @@ 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 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); @@ -864,7 +864,7 @@ static struct cmd_hdl wlancmds[] = { 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(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) @@ -896,7 +896,7 @@ static struct cmd_hdl wlancmds[] = { 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 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) @@ -905,7 +905,7 @@ static struct cmd_hdl wlancmds[] = { 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(sizeof(struct Tx_Beacon_param), tx_beacon_hdl) /*55*/ GEN_MLME_EXT_HANDLER(0, mlme_evt_hdl) /*56*/ @@ -929,13 +929,13 @@ struct C2HEvent_Header unsigned int len:16; unsigned int ID:8; unsigned int seq:8; - + #elif defined(CONFIG_BIG_ENDIAN) unsigned int seq:8; unsigned int ID:8; unsigned int len:16; - + #else # error "Must be LITTLE or BIG Endian" @@ -953,39 +953,39 @@ 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_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(_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(_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(_ReportPwrState), //filen: only for PCIE, USB GEN_EVT_CODE(_CloseRF), //filen: only for PCIE, work around ASPM - MAX_C2HEVT + MAX_C2HEVT }; -#ifdef _RTW_MLME_EXT_C_ +#ifdef _RTW_MLME_EXT_C_ -static struct fwevent wlanevents[] = +static struct fwevent wlanevents[] = { - {0, rtw_dummy_event_callback}, /*0*/ + {0, rtw_dummy_event_callback}, /*0*/ {0, NULL}, {0, NULL}, {0, NULL}, @@ -995,10 +995,10 @@ static struct fwevent wlanevents[] = {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}, + {sizeof(struct stadel_event), &rtw_stadel_event_callback}, {0, &rtw_atimdone_event_callback}, {0, rtw_dummy_event_callback}, {0, NULL}, /*15*/ @@ -1008,11 +1008,10 @@ static struct fwevent wlanevents[] = {0, rtw_fwdbg_event_callback}, {0, NULL}, /*20*/ {0, NULL}, - {0, NULL}, + {0, NULL}, {0, &rtw_cpwm_event_callback}, }; #endif//_RTL8192C_CMD_C_ #endif - diff --git a/include/rtw_mp.h b/include/rtw_mp.h index a4d16be..f223723 100755 --- a/include/rtw_mp.h +++ b/include/rtw_mp.h @@ -1,7 +1,7 @@ /****************************************************************************** * * 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. @@ -88,19 +88,19 @@ typedef enum _ANTENNA_PATH{ ANTENNA_B , ANTENNA_BD , ANTENNA_BC , - ANTENNA_BCD , + ANTENNA_BCD , ANTENNA_A , ANTENNA_AD , ANTENNA_AC , - ANTENNA_ACD , + ANTENNA_ACD , ANTENNA_AB , - ANTENNA_ABD , - ANTENNA_ABC , - ANTENNA_ABCD + ANTENNA_ABD , + ANTENNA_ABC , + ANTENNA_ABCD } ANTENNA_PATH; -#define MAX_MP_XMITBUF_SZ 2048 +#define MAX_MP_XMITBUF_SZ 2048 #define NR_MP_XMITFRAME 8 struct mp_xmit_frame @@ -167,28 +167,28 @@ struct mp_tx #define u4Byte u32 #define s4Byte s32 #define u1Byte u8 -#define pu1Byte u8* +#define pu1Byte u8* #define u2Byte u16 -#define pu2Byte u16* +#define pu2Byte u16* #define u4Byte u32 -#define pu4Byte u32* +#define pu4Byte u32* #define u8Byte u64 -#define pu8Byte u64* +#define pu8Byte u64* #define s1Byte s8 -#define ps1Byte s8* +#define ps1Byte s8* #define s2Byte s16 -#define ps2Byte s16* +#define ps2Byte s16* #define s4Byte s32 -#define ps4Byte s32* +#define ps4Byte s32* #define s8Byte s64 -#define ps8Byte s64* +#define ps8Byte s64* #define UCHAR u8 #define USHORT u16 @@ -214,7 +214,7 @@ typedef struct _MPT_CONTEXT BOOLEAN MptH2cRspEvent; BOOLEAN MptBtC2hEvent; BOOLEAN bMPh2c_timeout; - + /* 8190 PCI does not support NDIS_WORK_ITEM. */ // Work Item for Mass Production Test. //NDIS_WORK_ITEM MptWorkItem; @@ -233,7 +233,7 @@ typedef struct _MPT_CONTEXT // _TEST_MODE, defined in MPT_Req2.h ULONG MptTestItem; // Variable needed in each implementation of CurrMptAct. - ULONG MptActType; // Type of action performed in CurrMptAct. + ULONG MptActType; // Type of action performed in CurrMptAct. // The Offset of IO operation is depend of MptActType. ULONG MptIoOffset; // The Value of IO operation is depend of MptActType. @@ -242,9 +242,9 @@ typedef struct _MPT_CONTEXT ULONG MptRfPath; WIRELESS_MODE MptWirelessModeToSw; // Wireless mode to switch. - u8 MptChannelToSw; // Channel to switch. - u8 MptInitGainToSet; // Initial gain to set. - //ULONG bMptAntennaA; // TRUE if we want to use antenna A. + u8 MptChannelToSw; // Channel to switch. + u8 MptInitGainToSet; // Initial gain to set. + //ULONG bMptAntennaA; // TRUE if we want to use antenna A. ULONG MptBandWidth; // bandwidth to switch. ULONG MptRateIndex; // rate index. // Register value kept for Single Carrier Tx test. @@ -258,14 +258,14 @@ typedef struct _MPT_CONTEXT ULONG MptRCR; // TRUE if we only receive packets with specific pattern. BOOLEAN bMptFilterPattern; - // Rx OK count, statistics used in Mass Production Test. - ULONG MptRxOkCnt; - // Rx CRC32 error count, statistics used in Mass Production Test. - ULONG MptRxCrcErrCnt; + // Rx OK count, statistics used in Mass Production Test. + ULONG MptRxOkCnt; + // Rx CRC32 error count, statistics used in Mass Production Test. + ULONG MptRxCrcErrCnt; BOOLEAN bCckContTx; // TRUE if we are in CCK Continuous Tx test. - BOOLEAN bOfdmContTx; // TRUE if we are in OFDM Continuous Tx test. - BOOLEAN bStartContTx; // TRUE if we have start Continuous Tx test. + BOOLEAN bOfdmContTx; // TRUE if we are in OFDM Continuous Tx test. + BOOLEAN bStartContTx; // TRUE if we have start Continuous Tx test. // TRUE if we are in Single Carrier Tx test. BOOLEAN bSingleCarrier; // TRUE if we are in Carrier Suppression Tx Test. @@ -288,19 +288,19 @@ typedef struct _MPT_CONTEXT u8 backup0xc50; u8 backup0xc58; u8 backup0xc30; - u8 backup0x52_RF_A; - u8 backup0x52_RF_B; - + u8 backup0x52_RF_A; + u8 backup0x52_RF_B; + u1Byte h2cReqNum; u1Byte c2hBuf[20]; u1Byte btInBuf[100]; ULONG mptOutLen; u1Byte mptOutBuf[100]; - + }MPT_CONTEXT, *PMPT_CONTEXT; -enum { +enum { WRITE_REG = 1, READ_REG, WRITE_RF, @@ -377,7 +377,7 @@ struct mp_priv u16 antenna_tx; u16 antenna_rx; // u8 curr_rfpath; - + u8 check_mp_pkt; u8 bSetTxPower; @@ -412,7 +412,7 @@ struct bb_reg_param { }; //======================================================================= -#define LOWER _TRUE +#define LOWER _TRUE #define RAISE _FALSE /* Hardware Registers */ @@ -521,7 +521,7 @@ typedef enum _POWER_MODE_ { #define RPTMaxCount 0x000FFFFF; // parameter 1 : BitMask -// bit 0 : OFDM PPDU +// bit 0 : OFDM PPDU // bit 1 : OFDM False Alarm // bit 2 : OFDM MPDU OK // bit 3 : OFDM MPDU Fail @@ -560,15 +560,15 @@ typedef enum _ENCRY_CTRL_STATE_ { SW_ENCRY_HW_DECRY //sw encryption & hw decryption }ENCRY_CTRL_STATE; -#define Mac_OFDM_OK 0x00000000 -#define Mac_OFDM_Fail 0x10000000 -#define Mac_OFDM_FasleAlarm 0x20000000 +#define Mac_OFDM_OK 0x00000000 +#define Mac_OFDM_Fail 0x10000000 +#define Mac_OFDM_FasleAlarm 0x20000000 #define Mac_CCK_OK 0x30000000 #define Mac_CCK_Fail 0x40000000 #define Mac_CCK_FasleAlarm 0x50000000 -#define Mac_HT_OK 0x60000000 +#define Mac_HT_OK 0x60000000 #define Mac_HT_Fail 0x70000000 -#define Mac_HT_FasleAlarm 0x90000000 +#define Mac_HT_FasleAlarm 0x90000000 #define Mac_DropPacket 0xA0000000 //======================================================================= @@ -673,4 +673,3 @@ void MP_PHY_SetRFPathSwitch(struct adapter *pAdapter ,BOOLEAN bMain); void MPT_PwrCtlDM(struct adapter *padapter, u32 bstart); #endif //_RTW_MP_H_ - diff --git a/include/rtw_mp_ioctl.h b/include/rtw_mp_ioctl.h index 3e0e101..5450aa8 100755 --- a/include/rtw_mp_ioctl.h +++ b/include/rtw_mp_ioctl.h @@ -1,7 +1,7 @@ /****************************************************************************** * * 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. @@ -387,7 +387,7 @@ static struct oid_obj_priv oid_rtl_seg_87_12_00[]= {1, &oid_rt_pro_read_efuse_hdl}, //0x05 Q OID_RT_PRO_READ_EFUSE {1, &oid_rt_pro_write_efuse_hdl}, //0x06 S OID_RT_PRO_WRITE_EFUSE {1, &oid_rt_pro_rw_efuse_pgpkt_hdl}, //0x07 Q,S - {1, &oid_rt_get_efuse_current_size_hdl}, //0x08 Q + {1, &oid_rt_get_efuse_current_size_hdl}, //0x08 Q {1, &oid_rt_set_bandwidth_hdl}, //0x09 {1, &oid_rt_set_crystal_cap_hdl}, //0x0a {1, &oid_rt_set_rx_packet_type_hdl}, //0x0b S @@ -528,7 +528,7 @@ enum RTL871X_MP_IOCTL_SUBCODE { 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*/ + GEN_MP_IOCTL_SUBCODE(GET_WIFI_STATUS), /*37*/ MAX_MP_IOCTL_SUBCODE, }; @@ -592,4 +592,3 @@ extern struct mp_ioctl_handler mp_ioctl_hdl[]; #endif /* _RTW_MP_IOCTL_C_ */ #endif - diff --git a/include/rtw_mp_phy_regdef.h b/include/rtw_mp_phy_regdef.h index 0f8df41..d0ba216 100755 --- a/include/rtw_mp_phy_regdef.h +++ b/include/rtw_mp_phy_regdef.h @@ -1,7 +1,7 @@ /****************************************************************************** * * 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. @@ -27,18 +27,18 @@ * 3. PMAC/BB register bit mask. * 4. RF reg bit mask. * 5. Other BB/RF relative definition. - * + * * * Export: Constants, macro, functions(API), global variables(None). * - * Abbrev: + * Abbrev: * * History: - * Data Who Remark + * Data Who Remark * 08/07/2007 MHC 1. Porting from 9x series PHYCFG.h. * 2. Reorganize code architecture. * 09/25/2008 MH 1. Add RL6052 register definition - * + * *****************************************************************************/ #ifndef __RTW_MP_PHY_REGDEF_H_ #define __RTW_MP_PHY_REGDEF_H_ @@ -111,8 +111,8 @@ #define rFPGA0_RFTiming1 0x810 // Useless now #define rFPGA0_RFTiming2 0x814 -//#define rFPGA0_XC_RFTiming 0x818 -//#define rFPGA0_XD_RFTiming 0x81c +//#define rFPGA0_XC_RFTiming 0x818 +//#define rFPGA0_XD_RFTiming 0x81c #define rFPGA0_XA_HSSIParameter1 0x820 // RF 3 wire register #define rFPGA0_XA_HSSIParameter2 0x824 @@ -176,8 +176,8 @@ #define rCCK0_AFESetting 0xa04 // Disable init gain now // Select RX path by RSSI #define rCCK0_CCA 0xa08 // Disable init gain now // Init gain -#define rCCK0_RxAGC1 0xa0c //AGC default value, saturation level // Antenna Diversity, RX AGC, LNA Threshold, RX LNA Threshold useless now. Not the same as 90 series -#define rCCK0_RxAGC2 0xa10 //AGC & DAGC +#define rCCK0_RxAGC1 0xa0c //AGC default value, saturation level // Antenna Diversity, RX AGC, LNA Threshold, RX LNA Threshold useless now. Not the same as 90 series +#define rCCK0_RxAGC2 0xa10 //AGC & DAGC #define rCCK0_RxHP 0xa14 @@ -188,10 +188,10 @@ #define rCCK0_TxFilter2 0xa24 #define rCCK0_DebugPort 0xa28 //debug port and Tx filter3 #define rCCK0_FalseAlarmReport 0xa2c //0xa2d useless now 0xa30-a4f channel report -#define rCCK0_TRSSIReport 0xa50 -#define rCCK0_RxReport 0xa54 //0xa57 -#define rCCK0_FACounterLower 0xa5c //0xa5b -#define rCCK0_FACounterUpper 0xa58 //0xa5c +#define rCCK0_TRSSIReport 0xa50 +#define rCCK0_RxReport 0xa54 //0xa57 +#define rCCK0_FACounterLower 0xa5c //0xa5b +#define rCCK0_FACounterUpper 0xa58 //0xa5c // // 6. PageC(0xC00) @@ -203,16 +203,16 @@ #define rOFDM0_TRSWIsolation 0xc0c #define rOFDM0_XARxAFE 0xc10 //RxIQ DC offset, Rx digital filter, DC notch filter -#define rOFDM0_XARxIQImbalance 0xc14 //RxIQ imblance matrix -#define rOFDM0_XBRxAFE 0xc18 -#define rOFDM0_XBRxIQImbalance 0xc1c -#define rOFDM0_XCRxAFE 0xc20 -#define rOFDM0_XCRxIQImbalance 0xc24 -#define rOFDM0_XDRxAFE 0xc28 -#define rOFDM0_XDRxIQImbalance 0xc2c +#define rOFDM0_XARxIQImbalance 0xc14 //RxIQ imblance matrix +#define rOFDM0_XBRxAFE 0xc18 +#define rOFDM0_XBRxIQImbalance 0xc1c +#define rOFDM0_XCRxAFE 0xc20 +#define rOFDM0_XCRxIQImbalance 0xc24 +#define rOFDM0_XDRxAFE 0xc28 +#define rOFDM0_XDRxIQImbalance 0xc2c #define rOFDM0_RxDetector1 0xc30 //PD,BW & SBD // DM tune init gain -#define rOFDM0_RxDetector2 0xc34 //SBD & Fame Sync. +#define rOFDM0_RxDetector2 0xc34 //SBD & Fame Sync. #define rOFDM0_RxDetector3 0xc38 //Frame Sync. #define rOFDM0_RxDetector4 0xc3c //PD, SBD, Frame Sync & Short-GI @@ -221,7 +221,7 @@ #define rOFDM0_CCADropThreshold 0xc48 //CCA Drop threshold #define rOFDM0_ECCAThreshold 0xc4c // energy CCA -#define rOFDM0_XAAGCCore1 0xc50 // DIG +#define rOFDM0_XAAGCCore1 0xc50 // DIG #define rOFDM0_XAAGCCore2 0xc54 #define rOFDM0_XBAGCCore1 0xc58 #define rOFDM0_XBAGCCore2 0xc5c @@ -240,7 +240,7 @@ #define rOFDM0_XBTxIQImbalance 0xc88 #define rOFDM0_XBTxAFE 0xc8c #define rOFDM0_XCTxIQImbalance 0xc90 -#define rOFDM0_XCTxAFE 0xc94 +#define rOFDM0_XCTxAFE 0xc94 #define rOFDM0_XDTxIQImbalance 0xc98 #define rOFDM0_XDTxAFE 0xc9c #define rOFDM0_RxIQExtAnta 0xca0 @@ -285,8 +285,8 @@ #define rOFDM_LongCFOCD 0xdb8 #define rOFDM_TailCFOAB 0xdbc #define rOFDM_TailCFOCD 0xdc0 -#define rOFDM_PWMeasure1 0xdc4 -#define rOFDM_PWMeasure2 0xdc8 +#define rOFDM_PWMeasure1 0xdc4 +#define rOFDM_PWMeasure2 0xdc8 #define rOFDM_BWReport 0xdcc #define rOFDM_AGCReport 0xdd0 #define rOFDM_RxSNR 0xdd4 @@ -306,7 +306,7 @@ #define rTxAGC_Mcs15_Mcs12 0xe1c // Analog- control in RX_WAIT_CCA : REG: EE0 [Analog- Power & Control Register] -#define rRx_Wait_CCCA 0xe70 +#define rRx_Wait_CCCA 0xe70 #define rAnapar_Ctrl_BB 0xee0 // @@ -343,48 +343,48 @@ // // RL6052 Register definition // -#define RF_AC 0x00 // +#define RF_AC 0x00 // -#define RF_IQADJ_G1 0x01 // -#define RF_IQADJ_G2 0x02 // -#define RF_POW_TRSW 0x05 // +#define RF_IQADJ_G1 0x01 // +#define RF_IQADJ_G2 0x02 // +#define RF_POW_TRSW 0x05 // -#define RF_GAIN_RX 0x06 // -#define RF_GAIN_TX 0x07 // +#define RF_GAIN_RX 0x06 // +#define RF_GAIN_TX 0x07 // -#define RF_TXM_IDAC 0x08 // -#define RF_BS_IQGEN 0x0F // +#define RF_TXM_IDAC 0x08 // +#define RF_BS_IQGEN 0x0F // -#define RF_MODE1 0x10 // -#define RF_MODE2 0x11 // +#define RF_MODE1 0x10 // +#define RF_MODE2 0x11 // -#define RF_RX_AGC_HP 0x12 // -#define RF_TX_AGC 0x13 // -#define RF_BIAS 0x14 // -#define RF_IPA 0x15 // +#define RF_RX_AGC_HP 0x12 // +#define RF_TX_AGC 0x13 // +#define RF_BIAS 0x14 // +#define RF_IPA 0x15 // #define RF_TXBIAS 0x16 // -#define RF_POW_ABILITY 0x17 // -#define RF_MODE_AG 0x18 // +#define RF_POW_ABILITY 0x17 // +#define RF_MODE_AG 0x18 // #define rRfChannel 0x18 // RF channel and BW switch #define RF_CHNLBW 0x18 // RF channel and BW switch -#define RF_TOP 0x19 // +#define RF_TOP 0x19 // -#define RF_RX_G1 0x1A // -#define RF_RX_G2 0x1B // +#define RF_RX_G1 0x1A // +#define RF_RX_G2 0x1B // -#define RF_RX_BB2 0x1C // -#define RF_RX_BB1 0x1D // +#define RF_RX_BB2 0x1C // +#define RF_RX_BB1 0x1D // -#define RF_RCK1 0x1E // -#define RF_RCK2 0x1F // +#define RF_RCK1 0x1E // +#define RF_RCK2 0x1F // -#define RF_TX_G1 0x20 // -#define RF_TX_G2 0x21 // -#define RF_TX_G3 0x22 // +#define RF_TX_G1 0x20 // +#define RF_TX_G2 0x21 // +#define RF_TX_G3 0x22 // -#define RF_TX_BB1 0x23 // +#define RF_TX_BB1 0x23 // -#define RF_T_METER 0x24 // +#define RF_T_METER 0x24 // #define RF_SYN_G1 0x25 // RF TX Power control #define RF_SYN_G2 0x26 // RF TX Power control @@ -450,7 +450,7 @@ #define bCCKTxStatus 0x1 #define bOFDMTxStatus 0x2 -#define IS_BB_REG_OFFSET_92S(_Offset) ((_Offset >= 0x800) && (_Offset <= 0xfff)) +#define IS_BB_REG_OFFSET_92S(_Offset) ((_Offset >= 0x800) && (_Offset <= 0xfff)) // 2. Page8(0x800) #define bRFMOD 0x1 // Reg 0x800 rFPGA0_RFMOD @@ -459,317 +459,317 @@ #define bCCKEn 0x1000000 #define bOFDMEn 0x2000000 -#define bOFDMRxADCPhase 0x10000 // Useless now -#define bOFDMTxDACPhase 0x40000 -#define bXATxAGC 0x3f +#define bOFDMRxADCPhase 0x10000 // Useless now +#define bOFDMTxDACPhase 0x40000 +#define bXATxAGC 0x3f -#define bXBTxAGC 0xf00 // Reg 80c rFPGA0_TxGainStage -#define bXCTxAGC 0xf000 -#define bXDTxAGC 0xf0000 - -#define bPAStart 0xf0000000 // Useless now -#define bTRStart 0x00f00000 -#define bRFStart 0x0000f000 -#define bBBStart 0x000000f0 -#define bBBCCKStart 0x0000000f -#define bPAEnd 0xf //Reg0x814 -#define bTREnd 0x0f000000 -#define bRFEnd 0x000f0000 -#define bCCAMask 0x000000f0 //T2R -#define bR2RCCAMask 0x00000f00 -#define bHSSI_R2TDelay 0xf8000000 -#define bHSSI_T2RDelay 0xf80000 -#define bContTxHSSI 0x400 //chane gain at continue Tx -#define bIGFromCCK 0x200 -#define bAGCAddress 0x3f -#define bRxHPTx 0x7000 -#define bRxHPT2R 0x38000 -#define bRxHPCCKIni 0xc0000 -#define bAGCTxCode 0xc00000 -#define bAGCRxCode 0x300000 +#define bXBTxAGC 0xf00 // Reg 80c rFPGA0_TxGainStage +#define bXCTxAGC 0xf000 +#define bXDTxAGC 0xf0000 -#define b3WireDataLength 0x800 // Reg 0x820~84f rFPGA0_XA_HSSIParameter1 -#define b3WireAddressLength 0x400 +#define bPAStart 0xf0000000 // Useless now +#define bTRStart 0x00f00000 +#define bRFStart 0x0000f000 +#define bBBStart 0x000000f0 +#define bBBCCKStart 0x0000000f +#define bPAEnd 0xf //Reg0x814 +#define bTREnd 0x0f000000 +#define bRFEnd 0x000f0000 +#define bCCAMask 0x000000f0 //T2R +#define bR2RCCAMask 0x00000f00 +#define bHSSI_R2TDelay 0xf8000000 +#define bHSSI_T2RDelay 0xf80000 +#define bContTxHSSI 0x400 //chane gain at continue Tx +#define bIGFromCCK 0x200 +#define bAGCAddress 0x3f +#define bRxHPTx 0x7000 +#define bRxHPT2R 0x38000 +#define bRxHPCCKIni 0xc0000 +#define bAGCTxCode 0xc00000 +#define bAGCRxCode 0x300000 -#define b3WireRFPowerDown 0x1 // Useless now -//#define bHWSISelect 0x8 -#define b5GPAPEPolarity 0x40000000 -#define b2GPAPEPolarity 0x80000000 -#define bRFSW_TxDefaultAnt 0x3 -#define bRFSW_TxOptionAnt 0x30 -#define bRFSW_RxDefaultAnt 0x300 -#define bRFSW_RxOptionAnt 0x3000 -#define bRFSI_3WireData 0x1 -#define bRFSI_3WireClock 0x2 -#define bRFSI_3WireLoad 0x4 -#define bRFSI_3WireRW 0x8 -#define bRFSI_3Wire 0xf +#define b3WireDataLength 0x800 // Reg 0x820~84f rFPGA0_XA_HSSIParameter1 +#define b3WireAddressLength 0x400 -#define bRFSI_RFENV 0x10 // Reg 0x870 rFPGA0_XAB_RFInterfaceSW +#define b3WireRFPowerDown 0x1 // Useless now +//#define bHWSISelect 0x8 +#define b5GPAPEPolarity 0x40000000 +#define b2GPAPEPolarity 0x80000000 +#define bRFSW_TxDefaultAnt 0x3 +#define bRFSW_TxOptionAnt 0x30 +#define bRFSW_RxDefaultAnt 0x300 +#define bRFSW_RxOptionAnt 0x3000 +#define bRFSI_3WireData 0x1 +#define bRFSI_3WireClock 0x2 +#define bRFSI_3WireLoad 0x4 +#define bRFSI_3WireRW 0x8 +#define bRFSI_3Wire 0xf -#define bRFSI_TRSW 0x20 // Useless now -#define bRFSI_TRSWB 0x40 -#define bRFSI_ANTSW 0x100 -#define bRFSI_ANTSWB 0x200 -#define bRFSI_PAPE 0x400 -#define bRFSI_PAPE5G 0x800 -#define bBandSelect 0x1 -#define bHTSIG2_GI 0x80 -#define bHTSIG2_Smoothing 0x01 -#define bHTSIG2_Sounding 0x02 -#define bHTSIG2_Aggreaton 0x08 -#define bHTSIG2_STBC 0x30 -#define bHTSIG2_AdvCoding 0x40 -#define bHTSIG2_NumOfHTLTF 0x300 -#define bHTSIG2_CRC8 0x3fc -#define bHTSIG1_MCS 0x7f -#define bHTSIG1_BandWidth 0x80 -#define bHTSIG1_HTLength 0xffff -#define bLSIG_Rate 0xf -#define bLSIG_Reserved 0x10 -#define bLSIG_Length 0x1fffe -#define bLSIG_Parity 0x20 -#define bCCKRxPhase 0x4 +#define bRFSI_RFENV 0x10 // Reg 0x870 rFPGA0_XAB_RFInterfaceSW + +#define bRFSI_TRSW 0x20 // Useless now +#define bRFSI_TRSWB 0x40 +#define bRFSI_ANTSW 0x100 +#define bRFSI_ANTSWB 0x200 +#define bRFSI_PAPE 0x400 +#define bRFSI_PAPE5G 0x800 +#define bBandSelect 0x1 +#define bHTSIG2_GI 0x80 +#define bHTSIG2_Smoothing 0x01 +#define bHTSIG2_Sounding 0x02 +#define bHTSIG2_Aggreaton 0x08 +#define bHTSIG2_STBC 0x30 +#define bHTSIG2_AdvCoding 0x40 +#define bHTSIG2_NumOfHTLTF 0x300 +#define bHTSIG2_CRC8 0x3fc +#define bHTSIG1_MCS 0x7f +#define bHTSIG1_BandWidth 0x80 +#define bHTSIG1_HTLength 0xffff +#define bLSIG_Rate 0xf +#define bLSIG_Reserved 0x10 +#define bLSIG_Length 0x1fffe +#define bLSIG_Parity 0x20 +#define bCCKRxPhase 0x4 #if (RTL92SE_FPGA_VERIFY == 1) -#define bLSSIReadAddress 0x3f000000 //LSSI "Read" Address // Reg 0x824 rFPGA0_XA_HSSIParameter2 +#define bLSSIReadAddress 0x3f000000 //LSSI "Read" Address // Reg 0x824 rFPGA0_XA_HSSIParameter2 #else -#define bLSSIReadAddress 0x7f800000 // T65 RF +#define bLSSIReadAddress 0x7f800000 // T65 RF #endif -#define bLSSIReadEdge 0x80000000 //LSSI "Read" edge signal +#define bLSSIReadEdge 0x80000000 //LSSI "Read" edge signal #if (RTL92SE_FPGA_VERIFY == 1) -#define bLSSIReadBackData 0xfff // Reg 0x8a0 rFPGA0_XA_LSSIReadBack +#define bLSSIReadBackData 0xfff // Reg 0x8a0 rFPGA0_XA_LSSIReadBack #else -#define bLSSIReadBackData 0xfffff // T65 RF +#define bLSSIReadBackData 0xfffff // T65 RF #endif -#define bLSSIReadOKFlag 0x1000 // Useless now -#define bCCKSampleRate 0x8 //0: 44MHz, 1:88MHz -#define bRegulator0Standby 0x1 -#define bRegulatorPLLStandby 0x2 -#define bRegulator1Standby 0x4 -#define bPLLPowerUp 0x8 -#define bDPLLPowerUp 0x10 -#define bDA10PowerUp 0x20 -#define bAD7PowerUp 0x200 -#define bDA6PowerUp 0x2000 -#define bXtalPowerUp 0x4000 -#define b40MDClkPowerUP 0x8000 -#define bDA6DebugMode 0x20000 -#define bDA6Swing 0x380000 +#define bLSSIReadOKFlag 0x1000 // Useless now +#define bCCKSampleRate 0x8 //0: 44MHz, 1:88MHz +#define bRegulator0Standby 0x1 +#define bRegulatorPLLStandby 0x2 +#define bRegulator1Standby 0x4 +#define bPLLPowerUp 0x8 +#define bDPLLPowerUp 0x10 +#define bDA10PowerUp 0x20 +#define bAD7PowerUp 0x200 +#define bDA6PowerUp 0x2000 +#define bXtalPowerUp 0x4000 +#define b40MDClkPowerUP 0x8000 +#define bDA6DebugMode 0x20000 +#define bDA6Swing 0x380000 -#define bADClkPhase 0x4000000 // Reg 0x880 rFPGA0_AnalogParameter1 20/40 CCK support switch 40/80 BB MHZ +#define bADClkPhase 0x4000000 // Reg 0x880 rFPGA0_AnalogParameter1 20/40 CCK support switch 40/80 BB MHZ -#define b80MClkDelay 0x18000000 // Useless -#define bAFEWatchDogEnable 0x20000000 +#define b80MClkDelay 0x18000000 // Useless +#define bAFEWatchDogEnable 0x20000000 -#define bXtalCap01 0xc0000000 // Reg 0x884 rFPGA0_AnalogParameter2 Crystal cap -#define bXtalCap23 0x3 +#define bXtalCap01 0xc0000000 // Reg 0x884 rFPGA0_AnalogParameter2 Crystal cap +#define bXtalCap23 0x3 #define bXtalCap92x 0x0f000000 -#define bXtalCap 0x0f000000 +#define bXtalCap 0x0f000000 -#define bIntDifClkEnable 0x400 // Useless -#define bExtSigClkEnable 0x800 -#define bBandgapMbiasPowerUp 0x10000 -#define bAD11SHGain 0xc0000 -#define bAD11InputRange 0x700000 -#define bAD11OPCurrent 0x3800000 -#define bIPathLoopback 0x4000000 -#define bQPathLoopback 0x8000000 -#define bAFELoopback 0x10000000 -#define bDA10Swing 0x7e0 -#define bDA10Reverse 0x800 -#define bDAClkSource 0x1000 -#define bAD7InputRange 0x6000 -#define bAD7Gain 0x38000 -#define bAD7OutputCMMode 0x40000 -#define bAD7InputCMMode 0x380000 -#define bAD7Current 0xc00000 -#define bRegulatorAdjust 0x7000000 -#define bAD11PowerUpAtTx 0x1 -#define bDA10PSAtTx 0x10 -#define bAD11PowerUpAtRx 0x100 -#define bDA10PSAtRx 0x1000 -#define bCCKRxAGCFormat 0x200 -#define bPSDFFTSamplepPoint 0xc000 -#define bPSDAverageNum 0x3000 -#define bIQPathControl 0xc00 -#define bPSDFreq 0x3ff -#define bPSDAntennaPath 0x30 -#define bPSDIQSwitch 0x40 -#define bPSDRxTrigger 0x400000 -#define bPSDTxTrigger 0x80000000 -#define bPSDSineToneScale 0x7f000000 -#define bPSDReport 0xffff +#define bIntDifClkEnable 0x400 // Useless +#define bExtSigClkEnable 0x800 +#define bBandgapMbiasPowerUp 0x10000 +#define bAD11SHGain 0xc0000 +#define bAD11InputRange 0x700000 +#define bAD11OPCurrent 0x3800000 +#define bIPathLoopback 0x4000000 +#define bQPathLoopback 0x8000000 +#define bAFELoopback 0x10000000 +#define bDA10Swing 0x7e0 +#define bDA10Reverse 0x800 +#define bDAClkSource 0x1000 +#define bAD7InputRange 0x6000 +#define bAD7Gain 0x38000 +#define bAD7OutputCMMode 0x40000 +#define bAD7InputCMMode 0x380000 +#define bAD7Current 0xc00000 +#define bRegulatorAdjust 0x7000000 +#define bAD11PowerUpAtTx 0x1 +#define bDA10PSAtTx 0x10 +#define bAD11PowerUpAtRx 0x100 +#define bDA10PSAtRx 0x1000 +#define bCCKRxAGCFormat 0x200 +#define bPSDFFTSamplepPoint 0xc000 +#define bPSDAverageNum 0x3000 +#define bIQPathControl 0xc00 +#define bPSDFreq 0x3ff +#define bPSDAntennaPath 0x30 +#define bPSDIQSwitch 0x40 +#define bPSDRxTrigger 0x400000 +#define bPSDTxTrigger 0x80000000 +#define bPSDSineToneScale 0x7f000000 +#define bPSDReport 0xffff // 3. Page9(0x900) -#define bOFDMTxSC 0x30000000 // Useless -#define bCCKTxOn 0x1 -#define bOFDMTxOn 0x2 -#define bDebugPage 0xfff //reset debug page and also HWord, LWord -#define bDebugItem 0xff //reset debug page and LWord -#define bAntL 0x10 -#define bAntNonHT 0x100 -#define bAntHT1 0x1000 -#define bAntHT2 0x10000 -#define bAntHT1S1 0x100000 -#define bAntNonHTS1 0x1000000 +#define bOFDMTxSC 0x30000000 // Useless +#define bCCKTxOn 0x1 +#define bOFDMTxOn 0x2 +#define bDebugPage 0xfff //reset debug page and also HWord, LWord +#define bDebugItem 0xff //reset debug page and LWord +#define bAntL 0x10 +#define bAntNonHT 0x100 +#define bAntHT1 0x1000 +#define bAntHT2 0x10000 +#define bAntHT1S1 0x100000 +#define bAntNonHTS1 0x1000000 // 4. PageA(0xA00) -#define bCCKBBMode 0x3 // Useless -#define bCCKTxPowerSaving 0x80 -#define bCCKRxPowerSaving 0x40 +#define bCCKBBMode 0x3 // Useless +#define bCCKTxPowerSaving 0x80 +#define bCCKRxPowerSaving 0x40 -#define bCCKSideBand 0x10 // Reg 0xa00 rCCK0_System 20/40 switch +#define bCCKSideBand 0x10 // Reg 0xa00 rCCK0_System 20/40 switch -#define bCCKScramble 0x8 // Useless -#define bCCKAntDiversity 0x8000 -#define bCCKCarrierRecovery 0x4000 -#define bCCKTxRate 0x3000 -#define bCCKDCCancel 0x0800 -#define bCCKISICancel 0x0400 -#define bCCKMatchFilter 0x0200 -#define bCCKEqualizer 0x0100 -#define bCCKPreambleDetect 0x800000 -#define bCCKFastFalseCCA 0x400000 -#define bCCKChEstStart 0x300000 -#define bCCKCCACount 0x080000 -#define bCCKcs_lim 0x070000 -#define bCCKBistMode 0x80000000 -#define bCCKCCAMask 0x40000000 -#define bCCKTxDACPhase 0x4 -#define bCCKRxADCPhase 0x20000000 //r_rx_clk -#define bCCKr_cp_mode0 0x0100 -#define bCCKTxDCOffset 0xf0 -#define bCCKRxDCOffset 0xf -#define bCCKCCAMode 0xc000 -#define bCCKFalseCS_lim 0x3f00 -#define bCCKCS_ratio 0xc00000 -#define bCCKCorgBit_sel 0x300000 -#define bCCKPD_lim 0x0f0000 -#define bCCKNewCCA 0x80000000 -#define bCCKRxHPofIG 0x8000 -#define bCCKRxIG 0x7f00 -#define bCCKLNAPolarity 0x800000 -#define bCCKRx1stGain 0x7f0000 -#define bCCKRFExtend 0x20000000 //CCK Rx Iinital gain polarity -#define bCCKRxAGCSatLevel 0x1f000000 -#define bCCKRxAGCSatCount 0xe0 -#define bCCKRxRFSettle 0x1f //AGCsamp_dly -#define bCCKFixedRxAGC 0x8000 -//#define bCCKRxAGCFormat 0x4000 //remove to HSSI register 0x824 -#define bCCKAntennaPolarity 0x2000 -#define bCCKTxFilterType 0x0c00 -#define bCCKRxAGCReportType 0x0300 -#define bCCKRxDAGCEn 0x80000000 -#define bCCKRxDAGCPeriod 0x20000000 -#define bCCKRxDAGCSatLevel 0x1f000000 -#define bCCKTimingRecovery 0x800000 -#define bCCKTxC0 0x3f0000 -#define bCCKTxC1 0x3f000000 -#define bCCKTxC2 0x3f -#define bCCKTxC3 0x3f00 -#define bCCKTxC4 0x3f0000 -#define bCCKTxC5 0x3f000000 -#define bCCKTxC6 0x3f -#define bCCKTxC7 0x3f00 -#define bCCKDebugPort 0xff0000 -#define bCCKDACDebug 0x0f000000 -#define bCCKFalseAlarmEnable 0x8000 -#define bCCKFalseAlarmRead 0x4000 -#define bCCKTRSSI 0x7f -#define bCCKRxAGCReport 0xfe -#define bCCKRxReport_AntSel 0x80000000 -#define bCCKRxReport_MFOff 0x40000000 -#define bCCKRxRxReport_SQLoss 0x20000000 -#define bCCKRxReport_Pktloss 0x10000000 -#define bCCKRxReport_Lockedbit 0x08000000 -#define bCCKRxReport_RateError 0x04000000 -#define bCCKRxReport_RxRate 0x03000000 -#define bCCKRxFACounterLower 0xff -#define bCCKRxFACounterUpper 0xff000000 -#define bCCKRxHPAGCStart 0xe000 -#define bCCKRxHPAGCFinal 0x1c00 -#define bCCKRxFalseAlarmEnable 0x8000 -#define bCCKFACounterFreeze 0x4000 -#define bCCKTxPathSel 0x10000000 -#define bCCKDefaultRxPath 0xc000000 -#define bCCKOptionRxPath 0x3000000 +#define bCCKScramble 0x8 // Useless +#define bCCKAntDiversity 0x8000 +#define bCCKCarrierRecovery 0x4000 +#define bCCKTxRate 0x3000 +#define bCCKDCCancel 0x0800 +#define bCCKISICancel 0x0400 +#define bCCKMatchFilter 0x0200 +#define bCCKEqualizer 0x0100 +#define bCCKPreambleDetect 0x800000 +#define bCCKFastFalseCCA 0x400000 +#define bCCKChEstStart 0x300000 +#define bCCKCCACount 0x080000 +#define bCCKcs_lim 0x070000 +#define bCCKBistMode 0x80000000 +#define bCCKCCAMask 0x40000000 +#define bCCKTxDACPhase 0x4 +#define bCCKRxADCPhase 0x20000000 //r_rx_clk +#define bCCKr_cp_mode0 0x0100 +#define bCCKTxDCOffset 0xf0 +#define bCCKRxDCOffset 0xf +#define bCCKCCAMode 0xc000 +#define bCCKFalseCS_lim 0x3f00 +#define bCCKCS_ratio 0xc00000 +#define bCCKCorgBit_sel 0x300000 +#define bCCKPD_lim 0x0f0000 +#define bCCKNewCCA 0x80000000 +#define bCCKRxHPofIG 0x8000 +#define bCCKRxIG 0x7f00 +#define bCCKLNAPolarity 0x800000 +#define bCCKRx1stGain 0x7f0000 +#define bCCKRFExtend 0x20000000 //CCK Rx Iinital gain polarity +#define bCCKRxAGCSatLevel 0x1f000000 +#define bCCKRxAGCSatCount 0xe0 +#define bCCKRxRFSettle 0x1f //AGCsamp_dly +#define bCCKFixedRxAGC 0x8000 +//#define bCCKRxAGCFormat 0x4000 //remove to HSSI register 0x824 +#define bCCKAntennaPolarity 0x2000 +#define bCCKTxFilterType 0x0c00 +#define bCCKRxAGCReportType 0x0300 +#define bCCKRxDAGCEn 0x80000000 +#define bCCKRxDAGCPeriod 0x20000000 +#define bCCKRxDAGCSatLevel 0x1f000000 +#define bCCKTimingRecovery 0x800000 +#define bCCKTxC0 0x3f0000 +#define bCCKTxC1 0x3f000000 +#define bCCKTxC2 0x3f +#define bCCKTxC3 0x3f00 +#define bCCKTxC4 0x3f0000 +#define bCCKTxC5 0x3f000000 +#define bCCKTxC6 0x3f +#define bCCKTxC7 0x3f00 +#define bCCKDebugPort 0xff0000 +#define bCCKDACDebug 0x0f000000 +#define bCCKFalseAlarmEnable 0x8000 +#define bCCKFalseAlarmRead 0x4000 +#define bCCKTRSSI 0x7f +#define bCCKRxAGCReport 0xfe +#define bCCKRxReport_AntSel 0x80000000 +#define bCCKRxReport_MFOff 0x40000000 +#define bCCKRxRxReport_SQLoss 0x20000000 +#define bCCKRxReport_Pktloss 0x10000000 +#define bCCKRxReport_Lockedbit 0x08000000 +#define bCCKRxReport_RateError 0x04000000 +#define bCCKRxReport_RxRate 0x03000000 +#define bCCKRxFACounterLower 0xff +#define bCCKRxFACounterUpper 0xff000000 +#define bCCKRxHPAGCStart 0xe000 +#define bCCKRxHPAGCFinal 0x1c00 +#define bCCKRxFalseAlarmEnable 0x8000 +#define bCCKFACounterFreeze 0x4000 +#define bCCKTxPathSel 0x10000000 +#define bCCKDefaultRxPath 0xc000000 +#define bCCKOptionRxPath 0x3000000 // 5. PageC(0xC00) -#define bNumOfSTF 0x3 // Useless -#define bShift_L 0xc0 -#define bGI_TH 0xc -#define bRxPathA 0x1 -#define bRxPathB 0x2 -#define bRxPathC 0x4 -#define bRxPathD 0x8 -#define bTxPathA 0x1 -#define bTxPathB 0x2 -#define bTxPathC 0x4 -#define bTxPathD 0x8 -#define bTRSSIFreq 0x200 -#define bADCBackoff 0x3000 -#define bDFIRBackoff 0xc000 -#define bTRSSILatchPhase 0x10000 -#define bRxIDCOffset 0xff -#define bRxQDCOffset 0xff00 -#define bRxDFIRMode 0x1800000 -#define bRxDCNFType 0xe000000 -#define bRXIQImb_A 0x3ff -#define bRXIQImb_B 0xfc00 -#define bRXIQImb_C 0x3f0000 -#define bRXIQImb_D 0xffc00000 -#define bDC_dc_Notch 0x60000 -#define bRxNBINotch 0x1f000000 -#define bPD_TH 0xf -#define bPD_TH_Opt2 0xc000 -#define bPWED_TH 0x700 -#define bIfMF_Win_L 0x800 -#define bPD_Option 0x1000 -#define bMF_Win_L 0xe000 -#define bBW_Search_L 0x30000 -#define bwin_enh_L 0xc0000 -#define bBW_TH 0x700000 -#define bED_TH2 0x3800000 -#define bBW_option 0x4000000 -#define bRatio_TH 0x18000000 -#define bWindow_L 0xe0000000 -#define bSBD_Option 0x1 -#define bFrame_TH 0x1c -#define bFS_Option 0x60 -#define bDC_Slope_check 0x80 -#define bFGuard_Counter_DC_L 0xe00 -#define bFrame_Weight_Short 0x7000 -#define bSub_Tune 0xe00000 -#define bFrame_DC_Length 0xe000000 -#define bSBD_start_offset 0x30000000 -#define bFrame_TH_2 0x7 -#define bFrame_GI2_TH 0x38 -#define bGI2_Sync_en 0x40 -#define bSarch_Short_Early 0x300 -#define bSarch_Short_Late 0xc00 -#define bSarch_GI2_Late 0x70000 -#define bCFOAntSum 0x1 -#define bCFOAcc 0x2 -#define bCFOStartOffset 0xc -#define bCFOLookBack 0x70 -#define bCFOSumWeight 0x80 -#define bDAGCEnable 0x10000 -#define bTXIQImb_A 0x3ff -#define bTXIQImb_B 0xfc00 -#define bTXIQImb_C 0x3f0000 -#define bTXIQImb_D 0xffc00000 -#define bTxIDCOffset 0xff -#define bTxQDCOffset 0xff00 -#define bTxDFIRMode 0x10000 -#define bTxPesudoNoiseOn 0x4000000 -#define bTxPesudoNoise_A 0xff -#define bTxPesudoNoise_B 0xff00 -#define bTxPesudoNoise_C 0xff0000 -#define bTxPesudoNoise_D 0xff000000 -#define bCCADropOption 0x20000 -#define bCCADropThres 0xfff00000 -#define bEDCCA_H 0xf -#define bEDCCA_L 0xf0 +#define bNumOfSTF 0x3 // Useless +#define bShift_L 0xc0 +#define bGI_TH 0xc +#define bRxPathA 0x1 +#define bRxPathB 0x2 +#define bRxPathC 0x4 +#define bRxPathD 0x8 +#define bTxPathA 0x1 +#define bTxPathB 0x2 +#define bTxPathC 0x4 +#define bTxPathD 0x8 +#define bTRSSIFreq 0x200 +#define bADCBackoff 0x3000 +#define bDFIRBackoff 0xc000 +#define bTRSSILatchPhase 0x10000 +#define bRxIDCOffset 0xff +#define bRxQDCOffset 0xff00 +#define bRxDFIRMode 0x1800000 +#define bRxDCNFType 0xe000000 +#define bRXIQImb_A 0x3ff +#define bRXIQImb_B 0xfc00 +#define bRXIQImb_C 0x3f0000 +#define bRXIQImb_D 0xffc00000 +#define bDC_dc_Notch 0x60000 +#define bRxNBINotch 0x1f000000 +#define bPD_TH 0xf +#define bPD_TH_Opt2 0xc000 +#define bPWED_TH 0x700 +#define bIfMF_Win_L 0x800 +#define bPD_Option 0x1000 +#define bMF_Win_L 0xe000 +#define bBW_Search_L 0x30000 +#define bwin_enh_L 0xc0000 +#define bBW_TH 0x700000 +#define bED_TH2 0x3800000 +#define bBW_option 0x4000000 +#define bRatio_TH 0x18000000 +#define bWindow_L 0xe0000000 +#define bSBD_Option 0x1 +#define bFrame_TH 0x1c +#define bFS_Option 0x60 +#define bDC_Slope_check 0x80 +#define bFGuard_Counter_DC_L 0xe00 +#define bFrame_Weight_Short 0x7000 +#define bSub_Tune 0xe00000 +#define bFrame_DC_Length 0xe000000 +#define bSBD_start_offset 0x30000000 +#define bFrame_TH_2 0x7 +#define bFrame_GI2_TH 0x38 +#define bGI2_Sync_en 0x40 +#define bSarch_Short_Early 0x300 +#define bSarch_Short_Late 0xc00 +#define bSarch_GI2_Late 0x70000 +#define bCFOAntSum 0x1 +#define bCFOAcc 0x2 +#define bCFOStartOffset 0xc +#define bCFOLookBack 0x70 +#define bCFOSumWeight 0x80 +#define bDAGCEnable 0x10000 +#define bTXIQImb_A 0x3ff +#define bTXIQImb_B 0xfc00 +#define bTXIQImb_C 0x3f0000 +#define bTXIQImb_D 0xffc00000 +#define bTxIDCOffset 0xff +#define bTxQDCOffset 0xff00 +#define bTxDFIRMode 0x10000 +#define bTxPesudoNoiseOn 0x4000000 +#define bTxPesudoNoise_A 0xff +#define bTxPesudoNoise_B 0xff00 +#define bTxPesudoNoise_C 0xff0000 +#define bTxPesudoNoise_D 0xff000000 +#define bCCADropOption 0x20000 +#define bCCADropThres 0xfff00000 +#define bEDCCA_H 0xf +#define bEDCCA_L 0xf0 #define bLambda_ED 0x300 #define bRxInitialGain 0x7f #define bRxAntDivEn 0x80 @@ -841,16 +841,16 @@ #define bRxSGI_TH 0xc0000000 #define bDFSCnt0 0xff #define bDFSCnt1 0xff00 -#define bDFSFlag 0xf0000 +#define bDFSFlag 0xf0000 #define bMFWeightSum 0x300000 -#define bMinIdxTH 0x7f000000 -#define bDAFormat 0x40000 -#define bTxChEmuEnable 0x01000000 +#define bMinIdxTH 0x7f000000 +#define bDAFormat 0x40000 +#define bTxChEmuEnable 0x01000000 #define bTRSWIsolation_A 0x7f #define bTRSWIsolation_B 0x7f00 #define bTRSWIsolation_C 0x7f0000 -#define bTRSWIsolation_D 0x7f000000 -#define bExtLNAGain 0x7c00 +#define bTRSWIsolation_D 0x7f000000 +#define bExtLNAGain 0x7c00 // 6. PageE(0xE00) #define bSTBCEn 0x4 // Useless @@ -887,7 +887,7 @@ #define bLongCFOFLength 11 #define bTailCFO 0x1fff #define bTailCFOTLength 13 -#define bTailCFOFLength 12 +#define bTailCFOFLength 12 #define bmax_en_pwdB 0xffff #define bCC_power_dB 0xffff0000 #define bnoise_pwdB 0xffff @@ -895,27 +895,27 @@ #define bPowerMeasFLength 3 #define bRx_HT_BW 0x1 #define bRxSC 0x6 -#define bRx_HT 0x8 +#define bRx_HT 0x8 #define bNB_intf_det_on 0x1 #define bIntf_win_len_cfg 0x30 -#define bNB_Intf_TH_cfg 0x1c0 +#define bNB_Intf_TH_cfg 0x1c0 #define bRFGain 0x3f #define bTableSel 0x40 -#define bTRSW 0x80 +#define bTRSW 0x80 #define bRxSNR_A 0xff #define bRxSNR_B 0xff00 #define bRxSNR_C 0xff0000 #define bRxSNR_D 0xff000000 #define bSNREVMTLength 8 -#define bSNREVMFLength 1 +#define bSNREVMFLength 1 #define bCSI1st 0xff #define bCSI2nd 0xff00 #define bRxEVM1st 0xff0000 -#define bRxEVM2nd 0xff000000 +#define bRxEVM2nd 0xff000000 #define bSIGEVM 0xff #define bPWDB 0xff00 #define bSGIEN 0x10000 - + #define bSFactorQAM1 0xf // Useless #define bSFactorQAM2 0xf0 #define bSFactorQAM3 0xf00 @@ -926,7 +926,7 @@ #define bSFactorQAM8 0xf000000 #define bSFactorQAM9 0xf0000000 #define bCSIScheme 0x100000 - + #define bNoiseLvlTopSet 0x3 // Useless #define bChSmooth 0x4 #define bChSmoothCfg1 0x38 @@ -935,7 +935,7 @@ #define bChSmoothCfg4 0x7000 #define bMRCMode 0x800000 #define bTHEVMCfg 0x7000000 - + #define bLoopFitType 0x1 // Useless #define bUpdCFO 0x40 #define bUpdCFOOffData 0x80 @@ -1017,8 +1017,8 @@ #define bMaskHWord 0xffff0000 #define bMaskLWord 0x0000ffff #define bMaskDWord 0xffffffff -#define bMaskH4Bits 0xf0000000 -#define bMaskOFDM_D 0xffc00000 +#define bMaskH4Bits 0xf0000000 +#define bMaskOFDM_D 0xffc00000 #define bMaskCCK 0x3f3f3f3f #define bMask12Bits 0xfff @@ -1026,21 +1026,21 @@ #if (RTL92SE_FPGA_VERIFY == 1) //#define bMask12Bits 0xfff // RF Reg mask bits //#define bMask20Bits 0xfff // RF Reg mask bits T65 RF -#define bRFRegOffsetMask 0xfff +#define bRFRegOffsetMask 0xfff #else //#define bMask12Bits 0xfffff // RF Reg mask bits //#define bMask20Bits 0xfffff // RF Reg mask bits T65 RF -#define bRFRegOffsetMask 0xfffff -#endif +#define bRFRegOffsetMask 0xfffff +#endif #define bEnable 0x1 // Useless #define bDisable 0x0 - + #define LeftAntenna 0x0 // Useless #define RightAntenna 0x1 - + #define tCheckTxStatus 500 //500ms // Useless #define tUpdateRxCounter 100 //100ms - + #define rateCCK 0 // Useless #define rateOFDM 1 #define rateHT 2 @@ -1096,4 +1096,3 @@ #endif //__INC_HAL8192SPHYREG_H - diff --git a/include/rtw_odm.h b/include/rtw_odm.h index a5cb544..a941c05 100755 --- a/include/rtw_odm.h +++ b/include/rtw_odm.h @@ -39,4 +39,3 @@ void rtw_odm_adaptivity_parm_set(struct adapter *adapter, s8 TH_L2H_ini, s8 TH_E s8 IGI_Base, bool ForceEDCCA, u8 AdapEn_RSSI, u8 IGI_LowerBound); #endif // __RTW_ODM_H__ - diff --git a/include/rtw_p2p.h b/include/rtw_p2p.h index fd46e74..1f40346 100755 --- a/include/rtw_p2p.h +++ b/include/rtw_p2p.h @@ -1,7 +1,7 @@ /****************************************************************************** * * 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. @@ -158,4 +158,3 @@ void dbg_rtw_p2p_set_role(struct wifidirect_info *wdinfo, enum P2P_ROLE role, co (wdinfo)->find_phase_state_exchange_cnt != P2P_FINDPHASE_EX_NONE) #endif - diff --git a/include/rtw_pwrctrl.h b/include/rtw_pwrctrl.h index 54a108b..719c77f 100755 --- a/include/rtw_pwrctrl.h +++ b/include/rtw_pwrctrl.h @@ -29,15 +29,15 @@ #endif //CONFIG_HAS_EARLYSUSPEND -#define FW_PWR0 0 -#define FW_PWR1 1 -#define FW_PWR2 2 -#define FW_PWR3 3 +#define FW_PWR0 0 +#define FW_PWR1 1 +#define FW_PWR2 2 +#define FW_PWR3 3 -#define HW_PWR0 7 -#define HW_PWR1 6 -#define HW_PWR2 2 +#define HW_PWR0 7 +#define HW_PWR1 6 +#define HW_PWR2 2 #define HW_PWR3 0 #define HW_PWR4 8 @@ -108,7 +108,7 @@ struct reportpwrstate_parm { unsigned char mode; unsigned char state; //the CPWM value unsigned short rsvd; -}; +}; typedef _sema _pwrlock; @@ -179,7 +179,7 @@ enum _PS_BBRegBackup_ { enum { // for ips_mode IPS_NONE=0, IPS_NORMAL, - IPS_LEVEL_2, + IPS_LEVEL_2, }; struct pwrctrl_priv @@ -216,17 +216,17 @@ struct pwrctrl_priv #ifdef CONFIG_PCI_HCI //just for PCIE ASPM - u8 b_support_aspm; // If it supports ASPM, Offset[560h] = 0x40, otherwise Offset[560h] = 0x00. + u8 b_support_aspm; // If it supports ASPM, Offset[560h] = 0x40, otherwise Offset[560h] = 0x00. u8 b_support_backdoor; //just for PCIE ASPM u8 const_amdpci_aspm; #endif - uint ips_enter_cnts; - uint ips_leave_cnts; + uint ips_enter_cnts; + uint ips_leave_cnts; - u8 ips_mode; + u8 ips_mode; u8 ips_mode_req; // used to accept the mode setting request, will update to ipsmode later uint bips_processing; u32 ips_deny_time; /* will deny IPS when system time is smaller than this */ @@ -237,7 +237,7 @@ struct pwrctrl_priv u8 power_mgnt; u8 bFwCurrentInPSMode; u32 DelayLPSLastTimeStamp; - u8 btcoex_rfon; + u8 btcoex_rfon; s32 pnp_current_pwr_state; u8 pnp_bstop_trx; @@ -248,7 +248,7 @@ struct pwrctrl_priv u8 bAutoResume; u8 autopm_cnt; #endif - u8 bSupportRemoteWakeup; + u8 bSupportRemoteWakeup; #ifdef CONFIG_WOWLAN u8 wowlan_mode; u8 wowlan_pattern; @@ -259,19 +259,19 @@ struct pwrctrl_priv u32 wowlan_pattern_context[8][5]; u64 wowlan_fw_iv; #endif // CONFIG_WOWLAN - _timer pwr_state_check_timer; + _timer pwr_state_check_timer; int pwr_state_check_interval; u8 pwr_state_check_cnts; - int ps_flag; - + int ps_flag; + rt_rf_power_state rf_pwrstate;//cur power state - //rt_rf_power_state current_rfpwrstate; + //rt_rf_power_state current_rfpwrstate; rt_rf_power_state change_rfpwrstate; u8 bHWPowerdown;//if support hw power down u8 bHWPwrPindetect; - u8 bkeepfwalive; + u8 bkeepfwalive; u8 brfoffbyhw; unsigned long PS_BBRegBackup[PSBBREG_TOTALCNT]; @@ -284,7 +284,7 @@ struct pwrctrl_priv struct early_suspend early_suspend; u8 do_late_resume; #endif //CONFIG_HAS_EARLYSUSPEND - + #ifdef CONFIG_ANDROID_POWER android_early_suspend_t early_suspend; u8 do_late_resume; @@ -308,7 +308,7 @@ struct pwrctrl_priv /*DBG_871X("%s _rtw_set_pwr_state_check_timer(%p, %d)\n", __FUNCTION__, (pwrctl), (ms));*/ \ _set_timer(&(pwrctl)->pwr_state_check_timer, (ms)); \ } while(0) - + #define rtw_set_pwr_state_check_timer(pwrctl) \ _rtw_set_pwr_state_check_timer((pwrctl), (pwrctl)->pwr_state_check_interval) @@ -381,4 +381,3 @@ int rtw_pm_set_ips(struct adapter *padapter, u8 mode); int rtw_pm_set_lps(struct adapter *padapter, u8 mode); #endif //__RTL871X_PWRCTRL_H_ - diff --git a/include/rtw_qos.h b/include/rtw_qos.h index a359c5f..bd15f93 100755 --- a/include/rtw_qos.h +++ b/include/rtw_qos.h @@ -1,7 +1,7 @@ /****************************************************************************** * * 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. @@ -30,11 +30,10 @@ struct qos_priv { - - unsigned int qos_option; //bit mask option: u-apsd, s-apsd, ts, block ack... + + unsigned int qos_option; //bit mask option: u-apsd, s-apsd, ts, block ack... }; #endif //_RTL871X_QOS_H_ - diff --git a/include/rtw_recv.h b/include/rtw_recv.h index 2a6d57d..5462d4f 100755 --- a/include/rtw_recv.h +++ b/include/rtw_recv.h @@ -66,24 +66,24 @@ struct recv_reorder_ctrl }; struct stainfo_rxcache { - u16 tid_rxseq[16]; + u16 tid_rxseq[16]; /* - unsigned short tid0_rxseq; - unsigned short tid1_rxseq; - unsigned short tid2_rxseq; - unsigned short tid3_rxseq; - unsigned short tid4_rxseq; - unsigned short tid5_rxseq; - unsigned short tid6_rxseq; - unsigned short tid7_rxseq; - unsigned short tid8_rxseq; - unsigned short tid9_rxseq; - unsigned short tid10_rxseq; - unsigned short tid11_rxseq; - unsigned short tid12_rxseq; - unsigned short tid13_rxseq; - unsigned short tid14_rxseq; - unsigned short tid15_rxseq; + unsigned short tid0_rxseq; + unsigned short tid1_rxseq; + unsigned short tid2_rxseq; + unsigned short tid3_rxseq; + unsigned short tid4_rxseq; + unsigned short tid5_rxseq; + unsigned short tid6_rxseq; + unsigned short tid7_rxseq; + unsigned short tid8_rxseq; + unsigned short tid9_rxseq; + unsigned short tid10_rxseq; + unsigned short tid11_rxseq; + unsigned short tid12_rxseq; + unsigned short tid13_rxseq; + unsigned short tid14_rxseq; + unsigned short tid15_rxseq; */ }; @@ -96,46 +96,46 @@ struct smooth_rssi_data { }; struct signal_stat { - u8 update_req; //used to indicate + u8 update_req; //used to indicate u8 avg_val; //avg of valid elements u32 total_num; //num of valid elements - u32 total_val; //sum of valid elements + u32 total_val; //sum of valid elements }; /* #define MAX_PATH_NUM_92CS 2 typedef struct _ODM_Phy_Status_Info_ -{ - u1Byte RxPWDBAll; - u1Byte SignalQuality; // in 0-100 index. +{ + u1Byte RxPWDBAll; + u1Byte SignalQuality; // in 0-100 index. u1Byte RxMIMOSignalQuality[MAX_PATH_NUM_92CS]; //EVM u1Byte RxMIMOSignalStrength[MAX_PATH_NUM_92CS];// in 0~100 index #if (DM_ODM_SUPPORT_TYPE & (ODM_MP|ODM_CE)) s1Byte RxPower; // in dBm Translate from PWdB s1Byte RecvSignalPower;// Real power in dBm for this packet, no beautification and aggregation. Keep this raw info to be used for the other procedures. - u1Byte BTRxRSSIPercentage; + u1Byte BTRxRSSIPercentage; u1Byte SignalStrength; // in 0-100 index. u1Byte RxPwr[MAX_PATH_NUM_92CS];//per-path's pwdb #endif - u1Byte RxSNR[MAX_PATH_NUM_92CS];//per-path's SNR + u1Byte RxSNR[MAX_PATH_NUM_92CS];//per-path's SNR }ODM_PHY_INFO_T,*PODM_PHY_INFO_T; */ #define MAX_PATH_NUM_92CS 2 struct phy_info //ODM_PHY_INFO_T -{ - u8 RxPWDBAll; - u8 SignalQuality; // in 0-100 index. +{ + u8 RxPWDBAll; + u8 SignalQuality; // in 0-100 index. u8 RxMIMOSignalQuality[MAX_PATH_NUM_92CS]; //EVM u8 RxMIMOSignalStrength[MAX_PATH_NUM_92CS];// in 0~100 index //#if (DM_ODM_SUPPORT_TYPE & (ODM_MP|ODM_CE)) s8 RxPower; // in dBm Translate from PWdB s8 RecvSignalPower;// Real power in dBm for this packet, no beautification and aggregation. Keep this raw info to be used for the other procedures. - u8 BTRxRSSIPercentage; + u8 BTRxRSSIPercentage; u8 SignalStrength; // in 0-100 index. u8 RxPwr[MAX_PATH_NUM_92CS];//per-path's pwdb u8 RxSNR[MAX_PATH_NUM_92CS];//per-path's SNR -//#endif +//#endif }; @@ -145,8 +145,8 @@ struct rx_pkt_attrib { u8 drvinfo_sz; u8 shift_sz; u8 hdrlen; //the WLAN Header Len - u8 to_fr_ds; - u8 amsdu; + u8 to_fr_ds; + u8 amsdu; u8 qos; u8 priority; u8 pw_save; @@ -165,35 +165,35 @@ struct rx_pkt_attrib { u16 eth_type; - u8 dst[ETH_ALEN]; - u8 src[ETH_ALEN]; - u8 ta[ETH_ALEN]; - u8 ra[ETH_ALEN]; - u8 bssid[ETH_ALEN]; - + u8 dst[ETH_ALEN]; + u8 src[ETH_ALEN]; + u8 ta[ETH_ALEN]; + u8 ra[ETH_ALEN]; + u8 bssid[ETH_ALEN]; + u8 ack_policy; - + //#ifdef CONFIG_TCP_CSUM_OFFLOAD_RX u8 tcpchk_valid; // 0: invalid, 1: valid u8 ip_chkrpt; //0: incorrect, 1: correct u8 tcp_chkrpt; //0: incorrect, 1: correct //#endif - u8 key_index; + u8 key_index; u8 mcs_rate; u8 rxht; - u8 sgi; - u8 pkt_rpt_type; + u8 sgi; + u8 pkt_rpt_type; u32 MacIDValidEntry[2]; // 64 bits present 64 entry. /* u8 signal_qual; s8 rx_mimo_signal_qual[2]; u8 signal_strength; - u32 RxPWDBAll; + u32 RxPWDBAll; s32 RecvSignalPower; */ - struct phy_info phy_info; + struct phy_info phy_info; }; @@ -321,7 +321,7 @@ struct recv_priv #ifdef CONFIG_PCI_HCI // Rx struct rtw_rx_ring rx_ring[PCI_MAX_RX_QUEUE]; - int rxringcount; + int rxringcount; u16 rxbuffersize; #endif @@ -583,7 +583,7 @@ __inline static u8 *recvframe_put(union recv_frame *precvframe, sint sz) //used for append sz bytes from ptr to rx_tail, update rx_tail and return the updated rx_tail to the caller //after putting, rx_tail must be still larger than rx_end. - unsigned char * prev_rx_tail; + unsigned char * prev_rx_tail; if(precvframe==NULL) return NULL; @@ -668,7 +668,7 @@ __inline static u8 *pkt_to_recvmem(_pkt *pkt) union recv_frame * precv_frame = pkt_to_recvframe(pkt); - return precv_frame->u.hdr.rx_head; + return precv_frame->u.hdr.rx_head; } @@ -678,7 +678,7 @@ __inline static u8 *pkt_to_recvdata(_pkt *pkt) union recv_frame * precv_frame =pkt_to_recvframe(pkt); - return precv_frame->u.hdr.rx_data; + return precv_frame->u.hdr.rx_data; } @@ -694,8 +694,8 @@ __inline static s32 translate_percentage_to_dbm(u32 SignalStrengthIndex) s32 SignalPower; // in dBm. // Translate to dBm (x=0.5y-95). - SignalPower = (s32)((SignalStrengthIndex + 1) >> 1); - SignalPower -= 95; + SignalPower = (s32)((SignalStrengthIndex + 1) >> 1); + SignalPower -= 95; return SignalPower; } @@ -708,4 +708,3 @@ extern void _rtw_init_sta_recv_priv(struct sta_recv_priv *psta_recvpriv); extern void mgt_dispatcher(struct adapter *padapter, union recv_frame *precv_frame); #endif - diff --git a/include/rtw_rf.h b/include/rtw_rf.h index 6ca4400..3df1b7b 100755 --- a/include/rtw_rf.h +++ b/include/rtw_rf.h @@ -1,7 +1,7 @@ /****************************************************************************** * * 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. @@ -17,7 +17,7 @@ * * ******************************************************************************/ -#ifndef __RTW_RF_H_ +#ifndef __RTW_RF_H_ #define __RTW_RF_H_ #include @@ -51,15 +51,15 @@ //Country codes #define USA 0x555320 -#define EUROPE 0x1 //temp, should be provided later -#define JAPAN 0x2 //temp, should be provided later +#define EUROPE 0x1 //temp, should be provided later +#define JAPAN 0x2 //temp, should be provided later struct regulatory_class { - u32 starting_freq; //MHz, + u32 starting_freq; //MHz, u8 channel_set[MAX_CHANNEL_NUM]; u8 channel_cck_power[MAX_CHANNEL_NUM];//dbm u8 channel_ofdm_power[MAX_CHANNEL_NUM];//dbm - u8 txpower_limit; //dbm + u8 txpower_limit; //dbm u8 channel_spacing; //MHz u8 modem; }; @@ -106,8 +106,8 @@ typedef enum _RF90_RADIO_PATH{ RF90_PATH_A = 0, //Radio Path A RF90_PATH_B = 1, //Radio Path B RF90_PATH_C = 2, //Radio Path C - RF90_PATH_D = 3 //Radio Path D - //RF90_PATH_MAX //Max RF number 90 support + RF90_PATH_D = 3 //Radio Path D + //RF90_PATH_MAX //Max RF number 90 support }RF90_RADIO_PATH_E, *PRF90_RADIO_PATH_E; // Bandwidth Offset @@ -117,14 +117,14 @@ typedef enum _RF90_RADIO_PATH{ // Represent Channel Width in HT Capabilities // -typedef enum _HT_CHANNEL_WIDTH { - +typedef enum _HT_CHANNEL_WIDTH { + HT_CHANNEL_WIDTH_20 = 0, HT_CHANNEL_WIDTH_40 = 1, HT_CHANNEL_WIDTH_80 = 2, HT_CHANNEL_WIDTH_160 = 3, HT_CHANNEL_WIDTH_10 = 4, - + }HT_CHANNEL_WIDTH, *PHT_CHANNEL_WIDTH; // @@ -155,4 +155,3 @@ u32 rtw_freq2ch(u32 freq); #endif //_RTL8711_RF_H_ - diff --git a/include/rtw_security.h b/include/rtw_security.h index 2372f9e..27c7f4f 100755 --- a/include/rtw_security.h +++ b/include/rtw_security.h @@ -1,7 +1,7 @@ /****************************************************************************** * * 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. @@ -35,7 +35,7 @@ #define _WEP_WPA_MIXED_ 0x07 // WEP + WPA #define _SMS4_ 0x06 #ifdef CONFIG_IEEE80211W -#define _BIP_ 0x8 +#define _BIP_ 0x8 #endif //CONFIG_IEEE80211W #define is_wep_enc(alg) (((alg) == _WEP40_) || ((alg) == _WEP104_)) @@ -65,9 +65,9 @@ typedef enum { #endif union pn48 { - + u64 val; - + #ifdef CONFIG_LITTLE_ENDIAN struct { @@ -80,7 +80,7 @@ struct { u8 TSC6; u8 TSC7; } _byte_; - + #elif defined(CONFIG_BIG_ENDIAN) struct { @@ -93,7 +93,7 @@ struct { u8 TSC1; u8 TSC0; } _byte_; - + #endif }; @@ -107,28 +107,28 @@ union Keytype { typedef struct _RT_PMKID_LIST { u8 bUsed; - u8 Bssid[6]; + u8 Bssid[6]; u8 PMKID[16]; u8 SsidBuf[33]; u8* ssid_octet; - u16 ssid_length; + u16 ssid_length; } RT_PMKID_LIST, *PRT_PMKID_LIST; struct security_priv { - u32 dot11AuthAlgrthm; // 802.11 auth, could be open, shared, 8021x and authswitch + u32 dot11AuthAlgrthm; // 802.11 auth, could be open, shared, 8021x and authswitch u32 dot11PrivacyAlgrthm; // This specify the privacy for shared auth. algorithm. /* WEP */ u32 dot11PrivacyKeyIndex; // this is only valid for legendary wep, 0~3 for key id. (tx key index) - union Keytype dot11DefKey[4]; // this is only valid for def. key - u32 dot11DefKeylen[4]; - u8 key_mask; /* use to restore wep key after hal_init */ + union Keytype dot11DefKey[4]; // this is only valid for def. key + u32 dot11DefKeylen[4]; + u8 key_mask; /* use to restore wep key after hal_init */ - u32 dot118021XGrpPrivacy; // This specify the privacy algthm. used for Grp key + u32 dot118021XGrpPrivacy; // This specify the privacy algthm. used for Grp key u32 dot118021XGrpKeyid; // key id used for Grp Key ( tx key index) - union Keytype dot118021XGrpKey[4]; // 802.1x Group Key, for inx0 and inx1 + union Keytype dot118021XGrpKey[4]; // 802.1x Group Key, for inx0 and inx1 union Keytype dot118021XGrptxmickey[4]; union Keytype dot118021XGrprxmickey[4]; union pn48 dot11Grptxpn; // PN48 used for Grp Key xmit. @@ -140,19 +140,19 @@ struct security_priv union pn48 dot11wBIPrxpn; // PN48 used for Grp Key recv. #endif //CONFIG_IEEE80211W #ifdef CONFIG_AP_MODE - //extend security capabilities for AP_MODE + //extend security capabilities for AP_MODE unsigned int dot8021xalg;//0:disable, 1:psk, 2:802.1x unsigned int wpa_psk;//0:disable, bit(0): WPA, bit(1):WPA2 unsigned int wpa_group_cipher; unsigned int wpa2_group_cipher; unsigned int wpa_pairwise_cipher; - unsigned int wpa2_pairwise_cipher; + unsigned int wpa2_pairwise_cipher; #endif u8 wps_ie[MAX_WPS_IE_LEN];//added in assoc req int wps_ie_len; - - + + u8 binstallGrpkey; #ifdef CONFIG_IEEE80211W u8 binstallBIPkey; @@ -161,13 +161,13 @@ struct security_priv //_timer tkip_timer; u8 bcheck_grpkey; u8 bgrpkey_handshake; - + //u8 packet_cnt;//unused, removed - + s32 sw_encrypt;//from registry_priv s32 sw_decrypt;//from registry_priv - - s32 hw_decrypted;//if the rx packets is hw_decrypted==_FALSE, it means the hw has not been ready. + + s32 hw_decrypted;//if the rx packets is hw_decrypted==_FALSE, it means the hw has not been ready. //keeps the auth_type & enc_status from upper layer ioctl(wpa_supplicant or wzc) @@ -186,7 +186,7 @@ struct security_priv //for tkip countermeasure - u32 last_mic_err_time; + u32 last_mic_err_time; u8 btkip_countermeasure; u8 btkip_wait_report; u32 btkip_countermeasure_time; @@ -273,7 +273,7 @@ do{\ #define ROL32( A, n ) ( ((A) << (n)) | ( ((A)>>(32-(n))) & ( (1UL << (n)) - 1 ) ) ) -#define ROR32( A, n ) ROL32( (A), 32-(n) ) +#define ROR32( A, n ) ROL32( (A), 32-(n) ) struct mic_data { @@ -366,7 +366,7 @@ static inline u32 rotr(u32 val, int bits) (a)[6] = (u8) (((u64) (val)) >> 8); \ (a)[7] = (u8) (((u64) (val)) & 0xff); \ } while (0) - + /* ===== start - public domain SHA256 implementation ===== */ /* This is based on SHA256 implementation in LibTomCrypt that was released into @@ -395,7 +395,7 @@ static const unsigned long K[64] = { ( ((((unsigned long) (x) & 0xFFFFFFFFUL) >> (unsigned long) ((y) & 31)) | \ ((unsigned long) (x) << (unsigned long) (32 - ((y) & 31)))) & 0xFFFFFFFFUL) #define Ch(x,y,z) (z ^ (x & (y ^ z))) -#define Maj(x,y,z) (((x | y) & z) | (x & y)) +#define Maj(x,y,z) (((x | y) & z) | (x & y)) #define S(x, n) RORc((x), (n)) #define R(x, n) (((x)&0xFFFFFFFFUL)>>(n)) #define Sigma0(x) (S(x, 2) ^ S(x, 13) ^ S(x, 22)) @@ -433,10 +433,10 @@ u32 rtw_BIP_verify(struct adapter *padapter, u8 *precvframe); #endif //CONFIG_IEEE80211W #ifdef CONFIG_TDLS void wpa_tdls_generate_tpk(struct adapter *padapter, struct sta_info *psta); -int wpa_tdls_ftie_mic(u8 *kck, u8 trans_seq, +int wpa_tdls_ftie_mic(u8 *kck, u8 trans_seq, u8 *lnkid, u8 *rsnie, u8 *timeoutie, u8 *ftie, u8 *mic); -int tdls_verify_mic(u8 *kck, u8 trans_seq, +int tdls_verify_mic(u8 *kck, u8 trans_seq, u8 *lnkid, u8 *rsnie, u8 *timeoutie, u8 *ftie); #endif //CONFIG_TDLS @@ -446,4 +446,3 @@ void rtw_sec_restore_wep_key(struct adapter *adapter); u8 rtw_handle_tkip_countermeasure(struct adapter* adapter, const char *caller); #endif //__RTL871X_SECURITY_H_ - diff --git a/include/rtw_sreset.h b/include/rtw_sreset.h index d37e677..149d2ef 100755 --- a/include/rtw_sreset.h +++ b/include/rtw_sreset.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Copyright(c) 2007 - 2012 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. @@ -31,8 +31,8 @@ enum { }; struct sreset_priv { - _mutex silentreset_mutex; - u8 silent_reset_inprogress; + _mutex silentreset_mutex; + u8 silent_reset_inprogress; u8 Wifi_Error_Status; unsigned long last_tx_time; unsigned long last_tx_complete_time; @@ -42,14 +42,14 @@ struct sreset_priv { #include -#define WIFI_STATUS_SUCCESS 0 -#define USB_VEN_REQ_CMD_FAIL BIT0 -#define USB_READ_PORT_FAIL BIT1 +#define WIFI_STATUS_SUCCESS 0 +#define USB_VEN_REQ_CMD_FAIL BIT0 +#define USB_READ_PORT_FAIL BIT1 #define USB_WRITE_PORT_FAIL BIT2 -#define WIFI_MAC_TXDMA_ERROR BIT3 +#define WIFI_MAC_TXDMA_ERROR BIT3 #define WIFI_TX_HANG BIT4 #define WIFI_RX_HANG BIT5 -#define WIFI_IF_NOT_EXIST BIT6 +#define WIFI_IF_NOT_EXIST BIT6 void sreset_init_value(struct adapter *padapter); void sreset_reset_value(struct adapter *padapter); @@ -60,4 +60,3 @@ bool sreset_inprogress(struct adapter *padapter); void sreset_reset(struct adapter *padapter); #endif - diff --git a/include/rtw_tdls.h b/include/rtw_tdls.h index 80adf34..5740b83 100755 --- a/include/rtw_tdls.h +++ b/include/rtw_tdls.h @@ -1,143 +1,142 @@ -/****************************************************************************** - * - * 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_TDLS_H_ -#define __RTW_TDLS_H_ - -#include - -#ifdef CONFIG_TDLS -/* TDLS STA state */ -#define TDLS_STATE_NONE 0x00000000 //default state -#define TDLS_INITIATOR_STATE 0x10000000 -#define TDLS_RESPONDER_STATE 0x20000000 -#define TDLS_LINKED_STATE 0x40000000 -#define TDLS_CH_SWITCH_ON_STATE 0x01000000 -#define TDLS_PEER_AT_OFF_STATE 0x02000000 //could send pkt on target ch -#define TDLS_AT_OFF_CH_STATE 0x04000000 -#define TDLS_CH_SW_INITIATOR_STATE 0x08000000 //avoiding duplicated or unconditional ch. switch rsp. -#define TDLS_APSD_CHSW_STATE 0x00100000 //in APSD and want to setup channel switch -#define TDLS_PEER_SLEEP_STATE 0x00200000 //peer sta is sleeping -#define TDLS_SW_OFF_STATE 0x00400000 //terminate channel swithcing -#define TDLS_ALIVE_STATE 0x00010000 //Check if peer sta is alived. - -#define TPK_RESEND_COUNT 301 -#define CH_SWITCH_TIME 10 -#define CH_SWITCH_TIMEOUT 30 -#define TDLS_STAY_TIME 500 -#define TDLS_SIGNAL_THRESH 0x20 -#define TDLS_WATCHDOG_PERIOD 10 //Periodically sending tdls discovery request in TDLS_WATCHDOG_PERIOD * 2 sec -#define TDLS_ALIVE_TIMER_PH1 5000 -#define TDLS_ALIVE_TIMER_PH2 2000 -#define TDLS_STAY_TIME 500 -#define TDLS_HANDSHAKE_TIME 8000 -#define TDLS_ALIVE_COUNT 3 -#define TDLS_INI_MACID_ENTRY 6 - -/* TDLS */ -#define TDLS_MIC_LEN 16 -#define WPA_NONCE_LEN 32 -#define TDLS_TIMEOUT_LEN 4 - -struct wpa_tdls_ftie { - u8 ie_type; /* FTIE */ - u8 ie_len; - u8 mic_ctrl[2]; - u8 mic[TDLS_MIC_LEN]; - u8 Anonce[WPA_NONCE_LEN]; /* Responder Nonce in TDLS */ - u8 Snonce[WPA_NONCE_LEN]; /* Initiator Nonce in TDLS */ - /* followed by optional elements */ -} ; - -struct wpa_tdls_lnkid { - u8 ie_type; /* Link Identifier IE */ - u8 ie_len; - u8 bssid[ETH_ALEN]; - u8 init_sta[ETH_ALEN]; - u8 resp_sta[ETH_ALEN]; -} ; - -static u8 TDLS_RSNIE[]={ 0x01, 0x00, //version shall be set to 1 - 0x00, 0x0f, 0xac, 0x07, //group sipher suite - 0x01, 0x00, //pairwise cipher suite count - 0x00, 0x0f, 0xac, 0x04, //pairwise cipher suite list; CCMP only - 0x01, 0x00, //AKM suite count - 0x00, 0x0f, 0xac, 0x07, //TPK Handshake - 0x00, 0x02, - //PMKID shall not be present - }; - -static u8 TDLS_WMMIE[]={0x00, 0x50, 0xf2, 0x02, 0x00, 0x01, 0x00}; //Qos info all set zero - -static u8 TDLS_EXT_CAPIE[] = {0x00, 0x00, 0x00, 0x50, 0x20}; //bit(28), bit(30), bit(37) - -// SRC: Supported Regulatory Classes -static u8 TDLS_SRC[] = { 0x01, 0x01, 0x02, 0x03, 0x04, 0x0c, 0x16, 0x17, 0x18, 0x19, 0x1b, 0x1c, 0x1d, 0x1e, 0x20, 0x21 }; - -void rtw_reset_tdls_info(struct adapter* padapter); -int rtw_init_tdls_info(struct adapter* padapter); -void rtw_free_tdls_info(struct tdls_info *ptdlsinfo); -void issue_nulldata_to_TDLS_peer_STA(struct adapter *padapter, struct sta_info *ptdls_sta, unsigned int power_mode); -void init_TPK_timer(struct adapter *padapter, struct sta_info *psta); -void init_ch_switch_timer(struct adapter *padapter, struct sta_info *psta); -void init_base_ch_timer(struct adapter *padapter, struct sta_info *psta); -void init_off_ch_timer(struct adapter *padapter, struct sta_info *psta); -void init_tdls_alive_timer(struct adapter *padapter, struct sta_info *psta); -void init_handshake_timer(struct adapter *padapter, struct sta_info *psta); -void free_tdls_sta(struct adapter *padapter, struct sta_info *ptdls_sta); -#ifdef CONFIG_WFD -void issue_tunneled_probe_req(struct adapter *padapter); -void issue_tunneled_probe_rsp(struct adapter *padapter, union recv_frame *precv_frame); -#endif //CONFIG_WFD -void issue_tdls_dis_req(struct adapter *padapter, u8 *mac_addr); -void issue_tdls_setup_req(struct adapter *padapter, u8 *mac_addr); -void issue_tdls_setup_rsp(struct adapter *padapter, union recv_frame *precv_frame); -void issue_tdls_setup_cfm(struct adapter *padapter, union recv_frame *precv_frame); -void issue_tdls_dis_rsp(struct adapter * padapter, union recv_frame * precv_frame, u8 dialog); -void issue_tdls_teardown(struct adapter *padapter, u8 *mac_addr); -void issue_tdls_peer_traffic_indication(struct adapter *padapter, struct sta_info *psta); -void issue_tdls_ch_switch_req(struct adapter *padapter, u8 *mac_addr); -void issue_tdls_ch_switch_rsp(struct adapter *padapter, u8 *mac_addr); -sint On_TDLS_Dis_Rsp(struct adapter *adapter, union recv_frame *precv_frame); -sint On_TDLS_Setup_Req(struct adapter *adapter, union recv_frame *precv_frame); -sint On_TDLS_Setup_Rsp(struct adapter *adapter, union recv_frame *precv_frame); -sint On_TDLS_Setup_Cfm(struct adapter *adapter, union recv_frame *precv_frame); -sint On_TDLS_Dis_Req(struct adapter *adapter, union recv_frame *precv_frame); -sint On_TDLS_Teardown(struct adapter *adapter, union recv_frame *precv_frame); -sint On_TDLS_Peer_Traffic_Rsp(struct adapter *adapter, union recv_frame *precv_frame); -sint On_TDLS_Ch_Switch_Req(struct adapter *adapter, union recv_frame *precv_frame); -sint On_TDLS_Ch_Switch_Rsp(struct adapter *adapter, union recv_frame *precv_frame); -void rtw_build_tdls_setup_req_ies(struct adapter * padapter, struct xmit_frame * pxmitframe, u8 *pframe); -void rtw_build_tdls_setup_rsp_ies(struct adapter * padapter, struct xmit_frame * pxmitframe, u8 *pframe); -void rtw_build_tdls_setup_cfm_ies(struct adapter * padapter, struct xmit_frame * pxmitframe, u8 *pframe); -void rtw_build_tdls_teardown_ies(struct adapter * padapter, struct xmit_frame * pxmitframe, u8 *pframe); -void rtw_build_tdls_dis_req_ies(struct adapter * padapter, struct xmit_frame * pxmitframe, u8 *pframe); -void rtw_build_tdls_dis_rsp_ies(struct adapter * padapter, struct xmit_frame * pxmitframe, u8 *pframe, u8 dialog); -void rtw_build_tdls_peer_traffic_indication_ies(struct adapter * padapter, struct xmit_frame * pxmitframe, u8 *pframe); -void rtw_build_tdls_ch_switch_req_ies(struct adapter * padapter, struct xmit_frame * pxmitframe, u8 *pframe); -void rtw_build_tdls_ch_switch_rsp_ies(struct adapter * padapter, struct xmit_frame * pxmitframe, u8 *pframe); -void rtw_build_tunneled_probe_req_ies(struct adapter * padapter, struct xmit_frame * pxmitframe, u8 *pframe); -void rtw_build_tunneled_probe_rsp_ies(struct adapter * padapter, struct xmit_frame * pxmitframe, u8 *pframe); - -int update_sgi_tdls(struct adapter *padapter, struct sta_info *psta); -u32 update_mask_tdls(struct adapter *padapter, struct sta_info *psta); -#endif //CONFIG_TDLS - -#endif - +/****************************************************************************** + * + * 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_TDLS_H_ +#define __RTW_TDLS_H_ + +#include + +#ifdef CONFIG_TDLS +/* TDLS STA state */ +#define TDLS_STATE_NONE 0x00000000 //default state +#define TDLS_INITIATOR_STATE 0x10000000 +#define TDLS_RESPONDER_STATE 0x20000000 +#define TDLS_LINKED_STATE 0x40000000 +#define TDLS_CH_SWITCH_ON_STATE 0x01000000 +#define TDLS_PEER_AT_OFF_STATE 0x02000000 //could send pkt on target ch +#define TDLS_AT_OFF_CH_STATE 0x04000000 +#define TDLS_CH_SW_INITIATOR_STATE 0x08000000 //avoiding duplicated or unconditional ch. switch rsp. +#define TDLS_APSD_CHSW_STATE 0x00100000 //in APSD and want to setup channel switch +#define TDLS_PEER_SLEEP_STATE 0x00200000 //peer sta is sleeping +#define TDLS_SW_OFF_STATE 0x00400000 //terminate channel swithcing +#define TDLS_ALIVE_STATE 0x00010000 //Check if peer sta is alived. + +#define TPK_RESEND_COUNT 301 +#define CH_SWITCH_TIME 10 +#define CH_SWITCH_TIMEOUT 30 +#define TDLS_STAY_TIME 500 +#define TDLS_SIGNAL_THRESH 0x20 +#define TDLS_WATCHDOG_PERIOD 10 //Periodically sending tdls discovery request in TDLS_WATCHDOG_PERIOD * 2 sec +#define TDLS_ALIVE_TIMER_PH1 5000 +#define TDLS_ALIVE_TIMER_PH2 2000 +#define TDLS_STAY_TIME 500 +#define TDLS_HANDSHAKE_TIME 8000 +#define TDLS_ALIVE_COUNT 3 +#define TDLS_INI_MACID_ENTRY 6 + +/* TDLS */ +#define TDLS_MIC_LEN 16 +#define WPA_NONCE_LEN 32 +#define TDLS_TIMEOUT_LEN 4 + +struct wpa_tdls_ftie { + u8 ie_type; /* FTIE */ + u8 ie_len; + u8 mic_ctrl[2]; + u8 mic[TDLS_MIC_LEN]; + u8 Anonce[WPA_NONCE_LEN]; /* Responder Nonce in TDLS */ + u8 Snonce[WPA_NONCE_LEN]; /* Initiator Nonce in TDLS */ + /* followed by optional elements */ +} ; + +struct wpa_tdls_lnkid { + u8 ie_type; /* Link Identifier IE */ + u8 ie_len; + u8 bssid[ETH_ALEN]; + u8 init_sta[ETH_ALEN]; + u8 resp_sta[ETH_ALEN]; +} ; + +static u8 TDLS_RSNIE[]={ 0x01, 0x00, //version shall be set to 1 + 0x00, 0x0f, 0xac, 0x07, //group sipher suite + 0x01, 0x00, //pairwise cipher suite count + 0x00, 0x0f, 0xac, 0x04, //pairwise cipher suite list; CCMP only + 0x01, 0x00, //AKM suite count + 0x00, 0x0f, 0xac, 0x07, //TPK Handshake + 0x00, 0x02, + //PMKID shall not be present + }; + +static u8 TDLS_WMMIE[]={0x00, 0x50, 0xf2, 0x02, 0x00, 0x01, 0x00}; //Qos info all set zero + +static u8 TDLS_EXT_CAPIE[] = {0x00, 0x00, 0x00, 0x50, 0x20}; //bit(28), bit(30), bit(37) + +// SRC: Supported Regulatory Classes +static u8 TDLS_SRC[] = { 0x01, 0x01, 0x02, 0x03, 0x04, 0x0c, 0x16, 0x17, 0x18, 0x19, 0x1b, 0x1c, 0x1d, 0x1e, 0x20, 0x21 }; + +void rtw_reset_tdls_info(struct adapter* padapter); +int rtw_init_tdls_info(struct adapter* padapter); +void rtw_free_tdls_info(struct tdls_info *ptdlsinfo); +void issue_nulldata_to_TDLS_peer_STA(struct adapter *padapter, struct sta_info *ptdls_sta, unsigned int power_mode); +void init_TPK_timer(struct adapter *padapter, struct sta_info *psta); +void init_ch_switch_timer(struct adapter *padapter, struct sta_info *psta); +void init_base_ch_timer(struct adapter *padapter, struct sta_info *psta); +void init_off_ch_timer(struct adapter *padapter, struct sta_info *psta); +void init_tdls_alive_timer(struct adapter *padapter, struct sta_info *psta); +void init_handshake_timer(struct adapter *padapter, struct sta_info *psta); +void free_tdls_sta(struct adapter *padapter, struct sta_info *ptdls_sta); +#ifdef CONFIG_WFD +void issue_tunneled_probe_req(struct adapter *padapter); +void issue_tunneled_probe_rsp(struct adapter *padapter, union recv_frame *precv_frame); +#endif //CONFIG_WFD +void issue_tdls_dis_req(struct adapter *padapter, u8 *mac_addr); +void issue_tdls_setup_req(struct adapter *padapter, u8 *mac_addr); +void issue_tdls_setup_rsp(struct adapter *padapter, union recv_frame *precv_frame); +void issue_tdls_setup_cfm(struct adapter *padapter, union recv_frame *precv_frame); +void issue_tdls_dis_rsp(struct adapter * padapter, union recv_frame * precv_frame, u8 dialog); +void issue_tdls_teardown(struct adapter *padapter, u8 *mac_addr); +void issue_tdls_peer_traffic_indication(struct adapter *padapter, struct sta_info *psta); +void issue_tdls_ch_switch_req(struct adapter *padapter, u8 *mac_addr); +void issue_tdls_ch_switch_rsp(struct adapter *padapter, u8 *mac_addr); +sint On_TDLS_Dis_Rsp(struct adapter *adapter, union recv_frame *precv_frame); +sint On_TDLS_Setup_Req(struct adapter *adapter, union recv_frame *precv_frame); +sint On_TDLS_Setup_Rsp(struct adapter *adapter, union recv_frame *precv_frame); +sint On_TDLS_Setup_Cfm(struct adapter *adapter, union recv_frame *precv_frame); +sint On_TDLS_Dis_Req(struct adapter *adapter, union recv_frame *precv_frame); +sint On_TDLS_Teardown(struct adapter *adapter, union recv_frame *precv_frame); +sint On_TDLS_Peer_Traffic_Rsp(struct adapter *adapter, union recv_frame *precv_frame); +sint On_TDLS_Ch_Switch_Req(struct adapter *adapter, union recv_frame *precv_frame); +sint On_TDLS_Ch_Switch_Rsp(struct adapter *adapter, union recv_frame *precv_frame); +void rtw_build_tdls_setup_req_ies(struct adapter * padapter, struct xmit_frame * pxmitframe, u8 *pframe); +void rtw_build_tdls_setup_rsp_ies(struct adapter * padapter, struct xmit_frame * pxmitframe, u8 *pframe); +void rtw_build_tdls_setup_cfm_ies(struct adapter * padapter, struct xmit_frame * pxmitframe, u8 *pframe); +void rtw_build_tdls_teardown_ies(struct adapter * padapter, struct xmit_frame * pxmitframe, u8 *pframe); +void rtw_build_tdls_dis_req_ies(struct adapter * padapter, struct xmit_frame * pxmitframe, u8 *pframe); +void rtw_build_tdls_dis_rsp_ies(struct adapter * padapter, struct xmit_frame * pxmitframe, u8 *pframe, u8 dialog); +void rtw_build_tdls_peer_traffic_indication_ies(struct adapter * padapter, struct xmit_frame * pxmitframe, u8 *pframe); +void rtw_build_tdls_ch_switch_req_ies(struct adapter * padapter, struct xmit_frame * pxmitframe, u8 *pframe); +void rtw_build_tdls_ch_switch_rsp_ies(struct adapter * padapter, struct xmit_frame * pxmitframe, u8 *pframe); +void rtw_build_tunneled_probe_req_ies(struct adapter * padapter, struct xmit_frame * pxmitframe, u8 *pframe); +void rtw_build_tunneled_probe_rsp_ies(struct adapter * padapter, struct xmit_frame * pxmitframe, u8 *pframe); + +int update_sgi_tdls(struct adapter *padapter, struct sta_info *psta); +u32 update_mask_tdls(struct adapter *padapter, struct sta_info *psta); +#endif //CONFIG_TDLS + +#endif diff --git a/include/rtw_wapi.h b/include/rtw_wapi.h index 19efd6d..6bcefc2 100755 --- a/include/rtw_wapi.h +++ b/include/rtw_wapi.h @@ -1,229 +1,229 @@ -#ifndef __INC_WAPI_H -#define __INC_WAPI_H - -#include -#include -#include -#include -#include -#include -//#include "rtl819x_Qos.h" - -#define CONFIG_WAPI_SW_SMS4 -#define WAPI_DEBUG - -#define SMS4_MIC_LEN 16 -#define WAPI_EXT_LEN 18 -#define MAX_WAPI_IE_LEN 256 -#define sMacHdrLng 24 // octets in data header, no WEP - -#ifdef WAPI_DEBUG - -/* WAPI trace debug */ -extern u32 wapi_debug_component; - -static inline void dump_buf(u8 *buf, u32 len) -{ - u32 i; - printk("-----------------Len %d----------------\n", len); - for(i=0; i +#include +#include +#include +#include +#include +//#include "rtl819x_Qos.h" + +#define CONFIG_WAPI_SW_SMS4 +#define WAPI_DEBUG + +#define SMS4_MIC_LEN 16 +#define WAPI_EXT_LEN 18 +#define MAX_WAPI_IE_LEN 256 +#define sMacHdrLng 24 // octets in data header, no WEP + +#ifdef WAPI_DEBUG + +/* WAPI trace debug */ +extern u32 wapi_debug_component; + +static inline void dump_buf(u8 *buf, u32 len) +{ + u32 i; + printk("-----------------Len %d----------------\n", len); + for(i=0; i #endif //_RTL871X_XMIT_H_ - diff --git a/include/sdio_hal.h b/include/sdio_hal.h index 23bb1c5..32db2e8 100755 --- a/include/sdio_hal.h +++ b/include/sdio_hal.h @@ -1,7 +1,7 @@ /****************************************************************************** * * 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. @@ -31,4 +31,3 @@ void rtl8188es_set_hal_ops(struct adapter *padapter); #define hal_set_hal_ops rtl8188es_set_hal_ops #endif //__SDIO_HAL_H__ - diff --git a/include/sdio_ops.h b/include/sdio_ops.h index a08dfd8..1e30d33 100755 --- a/include/sdio_ops.h +++ b/include/sdio_ops.h @@ -1,7 +1,7 @@ /****************************************************************************** * * 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. @@ -27,7 +27,7 @@ #include extern void sdio_set_intf_ops(struct _io_ops *pops); - + //extern void sdio_func1cmd52_read(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *rmem); //extern void sdio_func1cmd52_write(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *wmem); extern u8 SdioLocalCmd52Read1Byte(struct adapter *padapter, u32 addr); @@ -56,4 +56,3 @@ extern u8 RecvOnePkt(struct adapter *padapter, u32 size); extern void ClearInterrupt8189ESdio(struct adapter *padapter); #endif //CONFIG_WOWLAN #endif - diff --git a/include/sdio_ops_linux.h b/include/sdio_ops_linux.h index 008c5bf..6ff1bca 100755 --- a/include/sdio_ops_linux.h +++ b/include/sdio_ops_linux.h @@ -1,7 +1,7 @@ /****************************************************************************** * * 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. @@ -49,4 +49,3 @@ s32 sd_write(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, void *pdata); void rtw_sdio_set_irq_thd(struct dvobj_priv *dvobj, _thread_hdl_ thd_hdl); #endif - diff --git a/include/sdio_osintf.h b/include/sdio_osintf.h index 626f31b..4ee7cbb 100755 --- a/include/sdio_osintf.h +++ b/include/sdio_osintf.h @@ -1,7 +1,7 @@ /****************************************************************************** * * 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. @@ -37,4 +37,3 @@ extern void sd_setup_irs(struct adapter *padapter); #endif #endif - diff --git a/include/sta_info.h b/include/sta_info.h index 197232b..b3f67d7 100755 --- a/include/sta_info.h +++ b/include/sta_info.h @@ -1,7 +1,7 @@ /****************************************************************************** * * 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. @@ -75,7 +75,7 @@ struct stainfo_stats { u64 last_rx_probersp_uo_pkts; u64 last_rx_ctrl_pkts; u64 last_rx_data_pkts; - + u64 rx_bytes; u64 rx_drops; @@ -101,24 +101,24 @@ struct sta_info { //_list sleep_list;//sleep_q //_list wakeup_list;//wakeup_q struct adapter *padapter; - + struct sta_xmit_priv sta_xmitpriv; struct sta_recv_priv sta_recvpriv; - + _queue sleep_q; unsigned int sleepq_len; - + uint state; uint aid; uint mac_id; uint qos_option; u8 hwaddr[ETH_ALEN]; - uint ieee8021x_blocked; //0: allowed, 1:blocked + uint ieee8021x_blocked; //0: allowed, 1:blocked uint dot118021XPrivacy; //aes, tkip... union Keytype dot11tkiptxmickey; union Keytype dot11tkiprxmickey; - union Keytype dot118021x_UncstKey; + union Keytype dot118021x_UncstKey; union pn48 dot11txpn; // PN48 used for Unicast xmit. #ifdef CONFIG_IEEE80211W union pn48 dot11wtxpn; // PN48 used for Unicast mgmt xmit. @@ -130,12 +130,12 @@ struct sta_info { u32 bssratelen; s32 rssi; s32 signal_quality; - + u8 cts2self; u8 rtsen; u8 raid; - u8 init_rate; + u8 init_rate; u32 ra_mask; u8 wireless_mode; // NETWORK_TYPE struct stainfo_stats sta_stats; @@ -165,49 +165,49 @@ struct sta_info { u8 alive_count; #endif //CONFIG_TDLS - //for A-MPDU TX, ADDBA timeout check + //for A-MPDU TX, ADDBA timeout check _timer addba_retry_timer; - - //for A-MPDU Rx reordering buffer control + + //for A-MPDU Rx reordering buffer control struct recv_reorder_ctrl recvreorder_ctrl[16]; //for A-MPDU Tx //unsigned char ampdu_txen_bitmap; u16 BA_starting_seqctrl[16]; - + #ifdef CONFIG_80211N_HT - struct ht_priv htpriv; + struct ht_priv htpriv; #endif - - //Notes: + + //Notes: //STA_Mode: - //curr_network(mlme_priv/security_priv/qos/ht) + sta_info: (STA & AP) CAP/INFO + //curr_network(mlme_priv/security_priv/qos/ht) + sta_info: (STA & AP) CAP/INFO //scan_q: AP CAP/INFO //AP_Mode: //curr_network(mlme_priv/security_priv/qos/ht) : AP CAP/INFO //sta_info: (AP & STA) CAP/INFO - + #ifdef CONFIG_AP_MODE _list asoc_list; _list auth_list; - + unsigned int expire_to; unsigned int auth_seq; unsigned int authalg; unsigned char chg_txt[128]; - u16 capability; - int flags; + u16 capability; + int flags; int dot8021xalg;//0:disable, 1:psk, 2:802.1x int wpa_psk;//0:disable, bit(0): WPA, bit(1):WPA2 int wpa_group_cipher; int wpa2_group_cipher; int wpa_pairwise_cipher; - int wpa2_pairwise_cipher; + int wpa2_pairwise_cipher; u8 bpairwise_key_installed; @@ -233,7 +233,7 @@ struct sta_info { u8 uapsd_bk;//BIT(0): Delivery enabled, BIT(1): Trigger enabled u8 uapsd_be; u8 uapsd_vi; - u8 uapsd_vo; + u8 uapsd_vo; u8 has_legacy_ac; unsigned int sleepq_ac_len; @@ -252,16 +252,16 @@ struct sta_info { u8 num_of_secdev_type; u8 secdev_types_list[32];// 32/8 == 4; u16 dev_name_len; - u8 dev_name[32]; + u8 dev_name[32]; #endif //CONFIG_P2P #ifdef CONFIG_TX_MCAST2UNI u8 under_exist_checking; #endif // CONFIG_TX_MCAST2UNI - + u8 keep_alive_trycnt; -#endif // CONFIG_AP_MODE +#endif // CONFIG_AP_MODE #ifdef CONFIG_IOCTL_CFG80211 u8 *passoc_req; @@ -282,25 +282,25 @@ struct sta_info { #endif //for DM RSSI_STA rssi_stat; - + //ODM_STA_INFO_T // ================ODM Relative Info======================= // Please be care, dont declare too much structure here. It will cost memory * STA support num. // // - // 2011/10/20 MH Add for ODM STA info. + // 2011/10/20 MH Add for ODM STA info. // // Driver Write u8 bValid; // record the sta status link or not? - //u8 WirelessMode; // - u8 IOTPeer; // Enum value. HT_IOT_PEER_E + //u8 WirelessMode; // + u8 IOTPeer; // Enum value. HT_IOT_PEER_E // ODM Write //1 PHY_STATUS_INFO - u8 RSSI_Path[4]; // + u8 RSSI_Path[4]; // u8 RSSI_Ave; u8 RXEVM[4]; u8 RXSNR[4]; - + u8 rssi_level; //for Refresh RA mask // ODM Write //1 TX_INFO (may changed by IC) @@ -393,21 +393,21 @@ struct sta_info { , sta->sta_stats.rx_data_pkts -sta->sta_stats.last_rx_data_pkts #define STA_PKTS_FMT "(m:%llu, c:%llu, d:%llu)" - + struct sta_priv { - + u8 *pallocated_stainfo_buf; u8 *pstainfo_buf; _queue free_sta_queue; - + _lock sta_hash_lock; _list sta_hash[NUM_STA]; int asoc_sta_count; _queue sleep_q; _queue wakeup_q; - + struct adapter *padapter; - + #ifdef CONFIG_AP_MODE _list asoc_list; @@ -420,7 +420,7 @@ struct sta_priv { unsigned int auth_to; //sec, time to expire in authenticating. unsigned int assoc_to; //sec, time to expire before associating. unsigned int expire_to; //sec , time to expire after associated. - + /* pointers to STA info; based on allocated AID or NULL if AID free * AID is in the range 1-2007, so sta_aid[0] corresponders to AID 1 * and so on @@ -428,13 +428,13 @@ struct sta_priv { struct sta_info *sta_aid[NUM_STA]; u16 sta_dz_bitmap;//only support 15 stations, staion aid bitmap for sleeping sta. - u16 tim_bitmap;//only support 15 stations, aid=0~15 mapping bit0~bit15 + u16 tim_bitmap;//only support 15 stations, aid=0~15 mapping bit0~bit15 u16 max_num_sta; struct wlan_acl_pool acl_list; -#endif - +#endif + #ifdef CONFIG_ATMEL_RC_PATCH u8 atmel_rc_pattern [6]; #endif @@ -455,7 +455,7 @@ __inline static u32 wifi_mac_hash(u8 *mac) x ^= x >> 8; x = x & (NUM_STA - 1); - + return x; } @@ -476,4 +476,3 @@ extern struct sta_info* rtw_get_bcmc_stainfo(struct adapter* padapter); extern u8 rtw_access_ctrl(struct adapter *padapter, u8 *mac_addr); #endif //_STA_INFO_H_ - diff --git a/include/usb_hal.h b/include/usb_hal.h index 0ce9b85..e02435b 100755 --- a/include/usb_hal.h +++ b/include/usb_hal.h @@ -1,7 +1,7 @@ /****************************************************************************** * * 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. @@ -23,8 +23,7 @@ void rtl8188eu_set_hal_ops(struct adapter * padapter); #define hal_set_hal_ops rtl8188eu_set_hal_ops -#ifdef CONFIG_INTEL_PROXIM +#ifdef CONFIG_INTEL_PROXIM extern struct adapter *rtw_usb_get_sw_pointer(void); #endif //CONFIG_INTEL_PROXIM #endif //__USB_HAL_H__ - diff --git a/include/usb_ops.h b/include/usb_ops.h index da82682..e55aa1a 100755 --- a/include/usb_ops.h +++ b/include/usb_ops.h @@ -1,7 +1,7 @@ /****************************************************************************** * * 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. @@ -38,18 +38,18 @@ enum{ #define MAX_VENDOR_REQ_CMD_SIZE 254 //8188cu SIE Support #define MAX_USB_IO_CTL_SIZE (MAX_VENDOR_REQ_CMD_SIZE +ALIGNMENT_UNIT) -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,12)) +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,12)) #define rtw_usb_control_msg(dev, pipe, request, requesttype, value, index, data, size, timeout_ms) \ - usb_control_msg((dev), (pipe), (request), (requesttype), (value), (index), (data), (size), (timeout_ms)) + usb_control_msg((dev), (pipe), (request), (requesttype), (value), (index), (data), (size), (timeout_ms)) #define rtw_usb_bulk_msg(usb_dev, pipe, data, len, actual_length, timeout_ms) \ usb_bulk_msg((usb_dev), (pipe), (data), (len), (actual_length), (timeout_ms)) #else #define rtw_usb_control_msg(dev, pipe, request, requesttype, value, index, data, size,timeout_ms) \ usb_control_msg((dev), (pipe), (request), (requesttype), (value), (index), (data), (size), \ - ((timeout_ms) == 0) ||((timeout_ms)*HZ/1000>0)?((timeout_ms)*HZ/1000):1) + ((timeout_ms) == 0) ||((timeout_ms)*HZ/1000>0)?((timeout_ms)*HZ/1000):1) #define rtw_usb_bulk_msg(usb_dev, pipe, data, len, actual_length, timeout_ms) \ usb_bulk_msg((usb_dev), (pipe), (data), (len), (actual_length), \ - ((timeout_ms) == 0) ||((timeout_ms)*HZ/1000>0)?((timeout_ms)*HZ/1000):1) + ((timeout_ms) == 0) ||((timeout_ms)*HZ/1000>0)?((timeout_ms)*HZ/1000):1) #endif #include @@ -66,12 +66,11 @@ static inline u8 rtw_usb_bulk_size_boundary(struct adapter * padapter,int buf_le u8 rst = _TRUE; struct dvobj_priv *pdvobjpriv = adapter_to_dvobj(padapter); - if (pdvobjpriv->ishighspeed == _TRUE) - rst = (0 == (buf_len) % USB_HIGH_SPEED_BULK_SIZE)?_TRUE:_FALSE; - else - rst = (0 == (buf_len) % USB_FULL_SPEED_BULK_SIZE)?_TRUE:_FALSE; + if (pdvobjpriv->ishighspeed == _TRUE) + rst = (0 == (buf_len) % USB_HIGH_SPEED_BULK_SIZE)?_TRUE:_FALSE; + else + rst = (0 == (buf_len) % USB_FULL_SPEED_BULK_SIZE)?_TRUE:_FALSE; return rst; } #endif //__USB_OPS_H_ - diff --git a/include/usb_ops_linux.h b/include/usb_ops_linux.h index d418ba2..d3a5507 100755 --- a/include/usb_ops_linux.h +++ b/include/usb_ops_linux.h @@ -1,7 +1,7 @@ /****************************************************************************** * * 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. @@ -60,4 +60,3 @@ u32 usb_write_port(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *wmem); void usb_write_port_cancel(struct intf_hdl *pintfhdl); #endif - diff --git a/include/usb_osintf.h b/include/usb_osintf.h index 5a28b8d..6bdcf3e 100755 --- a/include/usb_osintf.h +++ b/include/usb_osintf.h @@ -1,7 +1,7 @@ /****************************************************************************** * * 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. @@ -35,4 +35,3 @@ u8 usbvendorrequest(struct dvobj_priv *pdvobjpriv, RT_USB_BREQUEST brequest, RT_ #endif - diff --git a/include/usb_vendor_req.h b/include/usb_vendor_req.h index b60eefa..0f67122 100755 --- a/include/usb_vendor_req.h +++ b/include/usb_vendor_req.h @@ -1,7 +1,7 @@ /****************************************************************************** * * 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. @@ -57,4 +57,3 @@ typedef enum _RT_USB_WVALUE { //BOOLEAN CEusbGetDescriptorRequest(PCE_USB_DEVICE CEdevice, IN short urbLength, IN UCHAR DescriptorType, IN UCHAR Index, IN USHORT LanguageId, IN PVOID TransferBuffer, IN ULONG TransferBufferLength); #endif - diff --git a/include/wifi.h b/include/wifi.h index 8ed9669..cadbc31 100755 --- a/include/wifi.h +++ b/include/wifi.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Copyright(c) 2007 - 2012 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. @@ -64,7 +64,7 @@ enum WIFI_FRAME_TYPE { WIFI_MGT_TYPE = (0), WIFI_CTRL_TYPE = (BIT(2)), WIFI_DATA_TYPE = (BIT(3)), - WIFI_QOS_DATA_TYPE = (BIT(7)|BIT(3)), //!< QoS Data + WIFI_QOS_DATA_TYPE = (BIT(7)|BIT(3)), //!< QoS Data }; enum WIFI_FRAME_SUBTYPE { @@ -193,7 +193,7 @@ enum WIFI_STATUS_CODE { #define WLAN_STATUS_AP_UNABLE_TO_HANDLE_NEW_STA 17 #define WLAN_STATUS_ASSOC_DENIED_RATES 18 #endif -//entended +//entended /* IEEE 802.11b */ #define WLAN_STATUS_ASSOC_DENIED_NOSHORT 19 #define WLAN_STATUS_ASSOC_DENIED_NOPBCC 20 @@ -413,7 +413,7 @@ __inline static int IS_MCAST(unsigned char *da) __inline static unsigned char * get_da(unsigned char *pframe) { - unsigned char *da; + unsigned char *da; unsigned int to_fr_ds = (GetToDs(pframe) << 1) | GetFrDs(pframe); switch (to_fr_ds) { @@ -437,7 +437,7 @@ __inline static unsigned char * get_da(unsigned char *pframe) __inline static unsigned char * get_sa(unsigned char *pframe) { - unsigned char *sa; + unsigned char *sa; unsigned int to_fr_ds = (GetToDs(pframe) << 1) | GetFrDs(pframe); switch (to_fr_ds) { @@ -460,7 +460,7 @@ __inline static unsigned char * get_sa(unsigned char *pframe) __inline static unsigned char * get_hdr_bssid(unsigned char *pframe) { - unsigned char *sa; + unsigned char *sa; unsigned int to_fr_ds = (GetToDs(pframe) << 1) | GetFrDs(pframe); switch (to_fr_ds) { @@ -476,7 +476,7 @@ __inline static unsigned char * get_hdr_bssid(unsigned char *pframe) case 0x03: // ToDs=1, FromDs=1 sa = GetAddr1Ptr(pframe); break; - default: + default: sa =NULL; //??????? break; } @@ -608,7 +608,7 @@ __inline static int IsFrameTypeCtrl(unsigned char *pframe) #ifdef CONFIG_IEEE80211W #define _MME_IE_LENGTH_ 18 -#endif //CONFIG_IEEE80211W +#endif //CONFIG_IEEE80211W /*----------------------------------------------------------------------------- Below is the definition for WMM ------------------------------------------------------------------------------*/ @@ -617,7 +617,7 @@ __inline static int IsFrameTypeCtrl(unsigned char *pframe) /*----------------------------------------------------------------------------- - Below is the definition for 802.11n + Below is the definition for 802.11n ------------------------------------------------------------------------------*/ //#ifdef CONFIG_80211N_HT @@ -655,12 +655,12 @@ struct rtw_ieee80211_bar { * This structure refers to "HT capabilities element" as * described in 802.11n draft section 7.3.2.52 */ - + struct rtw_ieee80211_ht_cap { - __le16 cap_info; - u8 ampdu_params_info; - u8 supp_mcs_set[16]; - __le16 extended_ht_cap_info; + __le16 cap_info; + u8 ampdu_params_info; + u8 supp_mcs_set[16]; + __le16 extended_ht_cap_info; __le32 tx_BF_cap_info; u8 antenna_selection_info; } __attribute__ ((packed)); @@ -672,7 +672,7 @@ struct rtw_ieee80211_ht_cap { * described in 802.11n draft section 7.3.2.53 */ struct ieee80211_ht_addt_info { - u8 control_chan; + u8 control_chan; u8 ht_param; __le16 operation_mode; __le16 stbc_param; @@ -681,8 +681,8 @@ struct ieee80211_ht_addt_info { struct HT_caps_element { - union { - struct { + union { + struct { __le16 HT_caps_info; u8 AMPDU_para; u8 MCS_rate[16]; @@ -702,7 +702,7 @@ struct HT_info_element { struct AC_param { u8 ACI_AIFSN; - u8 CW; + u8 CW; __le16 TXOP_limit; } __attribute__ ((packed)); @@ -723,7 +723,7 @@ typedef enum _HT_CAP_AMPDU_FACTOR { MAX_AMPDU_FACTOR_8K = 0, MAX_AMPDU_FACTOR_16K = 1, MAX_AMPDU_FACTOR_32K = 2, - MAX_AMPDU_FACTOR_64K = 3, + MAX_AMPDU_FACTOR_64K = 3, } HT_CAP_AMPDU_FACTOR; /* 802.11n HT capabilities masks */ @@ -751,9 +751,9 @@ typedef enum _HT_CAP_AMPDU_FACTOR { #define IEEE80211_HT_CAP_MCS_TX_UEQM 0x10 /* 802.11n HT IE masks */ #define IEEE80211_HT_IE_CHA_SEC_OFFSET 0x03 -#define IEEE80211_HT_IE_CHA_SEC_NONE 0x00 -#define IEEE80211_HT_IE_CHA_SEC_ABOVE 0x01 -#define IEEE80211_HT_IE_CHA_SEC_BELOW 0x03 +#define IEEE80211_HT_IE_CHA_SEC_NONE 0x00 +#define IEEE80211_HT_IE_CHA_SEC_ABOVE 0x01 +#define IEEE80211_HT_IE_CHA_SEC_BELOW 0x03 #define IEEE80211_HT_IE_CHA_WIDTH 0x04 #define IEEE80211_HT_IE_HT_PROTECTION 0x0003 #define IEEE80211_HT_IE_NON_GF_STA_PRSNT 0x0004 @@ -996,7 +996,7 @@ typedef enum _HT_CAP_AMPDU_FACTOR { #define P2P_FINDPHASE_EX_NONE 0 // default value, used when: (1)p2p disabed or (2)p2p enabled but only do 1 scan phase #define P2P_FINDPHASE_EX_FULL 1 // used when p2p enabled and want to do 1 scan phase and P2P_FINDPHASE_EX_MAX-1 find phase -#define P2P_FINDPHASE_EX_SOCIAL_FIRST (P2P_FINDPHASE_EX_FULL+1) +#define P2P_FINDPHASE_EX_SOCIAL_FIRST (P2P_FINDPHASE_EX_FULL+1) #define P2P_FINDPHASE_EX_MAX 4 #define P2P_FINDPHASE_EX_SOCIAL_LAST P2P_FINDPHASE_EX_MAX @@ -1030,7 +1030,7 @@ enum P2P_ROLE { P2P_ROLE_DISABLE = 0, P2P_ROLE_DEVICE = 1, P2P_ROLE_CLIENT = 2, - P2P_ROLE_GO = 3 + P2P_ROLE_GO = 3 }; enum P2P_STATE { @@ -1042,7 +1042,7 @@ enum P2P_STATE { P2P_STATE_FIND_PHASE_SEARCH = 5, // In the search state of find phase P2P_STATE_TX_PROVISION_DIS_REQ = 6, // In P2P provisioning discovery P2P_STATE_RX_PROVISION_DIS_RSP = 7, - P2P_STATE_RX_PROVISION_DIS_REQ = 8, + P2P_STATE_RX_PROVISION_DIS_REQ = 8, P2P_STATE_GONEGO_ING = 9, // Doing the group owner negoitation handshake P2P_STATE_GONEGO_OK = 10, // finish the group negoitation handshake with success P2P_STATE_GONEGO_FAIL = 11, // finish the group negoitation handshake with failure @@ -1055,8 +1055,8 @@ enum P2P_STATE { P2P_STATE_RECV_INVITE_REQ_GO = 18, // receiving the P2P Inviation request and this wifi is GO. P2P_STATE_RECV_INVITE_REQ_JOIN = 19, // receiving the P2P Inviation request to join an existing P2P Group. P2P_STATE_RX_INVITE_RESP_FAIL = 20, // recveing the P2P Inviation response with failure - P2P_STATE_RX_INFOR_NOREADY = 21, // receiving p2p negoitation response with information is not available - P2P_STATE_TX_INFOR_NOREADY = 22, // sending p2p negoitation response with information is not available + P2P_STATE_RX_INFOR_NOREADY = 21, // receiving p2p negoitation response with information is not available + P2P_STATE_TX_INFOR_NOREADY = 22, // sending p2p negoitation response with information is not available }; enum P2P_WPSINFO { @@ -1072,7 +1072,7 @@ enum P2P_PROTO_WK_ID { P2P_FIND_PHASE_WK = 0, P2P_RESTORE_STATE_WK = 1, P2P_PRE_TX_PROVDISC_PROCESS_WK = 2, - P2P_PRE_TX_NEGOREQ_PROCESS_WK = 3, + P2P_PRE_TX_NEGOREQ_PROCESS_WK = 3, P2P_PRE_TX_INVITEREQ_PROCESS_WK = 4, P2P_AP_P2P_CH_SWITCH_PROCESS_WK =5, P2P_RO_CH_WK = 6, @@ -1108,7 +1108,7 @@ enum P2P_PS_MODE { #define WFD_DEVINFO_SOURCE 0x0000 #define WFD_DEVINFO_PSINK 0x0001 #define WFD_DEVINFO_SSINK 0x0002 -#define WFD_DEVINFO_DUAL 0x0003 +#define WFD_DEVINFO_DUAL 0x0003 #define WFD_DEVINFO_SESSION_AVAIL 0x0010 #define WFD_DEVINFO_WSD 0x0040 diff --git a/include/wlan_bssdef.h b/include/wlan_bssdef.h index 120bf06..53b9bed 100755 --- a/include/wlan_bssdef.h +++ b/include/wlan_bssdef.h @@ -1,7 +1,7 @@ /****************************************************************************** * * 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. @@ -27,7 +27,7 @@ #define NDIS_802_11_LENGTH_RATES_EX 16 typedef unsigned char NDIS_802_11_MAC_ADDRESS[6]; -typedef long NDIS_802_11_RSSI; // in dBm +typedef long NDIS_802_11_RSSI; // in dBm typedef unsigned char NDIS_802_11_RATES[NDIS_802_11_LENGTH_RATES]; // Set of 8 data rates typedef unsigned char NDIS_802_11_RATES_EX[NDIS_802_11_LENGTH_RATES_EX]; // Set of 16 data rates @@ -58,11 +58,11 @@ typedef struct _NDIS_802_11_CONFIGURATION_FH ULONG HopSet; // to one if non-802.11 ULONG DwellTime; // units are Kusec } NDIS_802_11_CONFIGURATION_FH, *PNDIS_802_11_CONFIGURATION_FH; - + /* FW will only save the channel number in DSConfig. - ODI Handler will convert the channel number to freq. number. + ODI Handler will convert the channel number to freq. number. */ typedef struct _NDIS_802_11_CONFIGURATION { @@ -220,7 +220,7 @@ typedef enum _NDIS_802_11_RELOAD_DEFAULTS typedef struct _NDIS_802_11_KEY { ULONG Length; // Length of this structure - ULONG KeyIndex; + ULONG KeyIndex; ULONG KeyLength; // length of key in bytes NDIS_802_11_MAC_ADDRESS BSSID; NDIS_802_11_KEY_RSC KeyRSC; @@ -230,8 +230,8 @@ typedef struct _NDIS_802_11_KEY typedef struct _NDIS_802_11_REMOVE_KEY { ULONG Length; // Length of this structure - ULONG KeyIndex; - NDIS_802_11_MAC_ADDRESS BSSID; + ULONG KeyIndex; + NDIS_802_11_MAC_ADDRESS BSSID; } NDIS_802_11_REMOVE_KEY, *PNDIS_802_11_REMOVE_KEY; typedef struct _NDIS_802_11_WEP @@ -253,7 +253,7 @@ typedef enum _NDIS_802_11_STATUS_TYPE { Ndis802_11StatusType_Authentication, Ndis802_11StatusType_MediaStreamMode, - Ndis802_11StatusType_PMKID_CandidateList, + Ndis802_11StatusType_PMKID_CandidateList, Ndis802_11StatusTypeMax // not a real type, defined as an upper bound } NDIS_802_11_STATUS_TYPE, *PNDIS_802_11_STATUS_TYPE; @@ -277,7 +277,7 @@ typedef struct _NDIS_802_11_AUTHENTICATION_EVENT NDIS_802_11_STATUS_INDICATION Status; NDIS_802_11_AUTHENTICATION_REQUEST Request[1]; } NDIS_802_11_AUTHENTICATION_EVENT, *PNDIS_802_11_AUTHENTICATION_EVENT; - + typedef struct _NDIS_802_11_TEST { ULONG Length; @@ -296,22 +296,22 @@ typedef struct _NDIS_802_11_TEST typedef struct _WLAN_PHY_INFO { u8 SignalStrength;//(in percentage) - u8 SignalQuality;//(in percentage) - u8 Optimum_antenna; //for Antenna diversity - u8 Reserved_0; + u8 SignalQuality;//(in percentage) + u8 Optimum_antenna; //for Antenna diversity + u8 Reserved_0; }WLAN_PHY_INFO,*PWLAN_PHY_INFO; typedef struct _WLAN_BCN_INFO { /* these infor get from rtw_get_encrypt_info when - * * translate scan to UI */ + * * translate scan to UI */ u8 encryp_protocol;//ENCRYP_PROTOCOL_E: OPEN/WEP/WPA/WPA2/WAPI int group_cipher; //WPA/WPA2 group cipher int pairwise_cipher;////WPA/WPA2/WEP pairwise cipher int is_8021x; /* bwmode 20/40 and ch_offset UP/LOW */ - unsigned short ht_cap_info; + unsigned short ht_cap_info; unsigned char ht_info_infos_0; }WLAN_BCN_INFO,*PWLAN_BCN_INFO; @@ -333,7 +333,7 @@ typedef struct _WLAN_BSSID_EX WLAN_PHY_INFO PhyInfo; ULONG IELength; UCHAR IEs[MAX_IE_SZ]; //(timestamp, beacon interval, and capability information) -} +} __attribute__((packed)) WLAN_BSSID_EX, *PWLAN_BSSID_EX; @@ -341,13 +341,13 @@ __inline static uint get_WLAN_BSSID_EX_sz(WLAN_BSSID_EX *bss) { #if 0 uint t_len; - - t_len = sizeof (ULONG) - + sizeof (NDIS_802_11_MAC_ADDRESS) - + 2 - + sizeof (NDIS_802_11_SSID) - + sizeof (ULONG) - + sizeof (NDIS_802_11_RSSI) + + t_len = sizeof (ULONG) + + sizeof (NDIS_802_11_MAC_ADDRESS) + + 2 + + sizeof (NDIS_802_11_SSID) + + sizeof (ULONG) + + sizeof (NDIS_802_11_RSSI) + sizeof (NDIS_802_11_NETWORK_TYPE) + sizeof (NDIS_802_11_CONFIGURATION) + sizeof (NDIS_802_11_NETWORK_INFRASTRUCTURE) @@ -356,7 +356,7 @@ __inline static uint get_WLAN_BSSID_EX_sz(WLAN_BSSID_EX *bss) + sizeof(WLAN_PHY_INFO) //all new member add here + sizeof (ULONG) - + bss->IELength; + + bss->IELength; return t_len; #else return (sizeof(WLAN_BSSID_EX) -MAX_IE_SZ + bss->IELength); @@ -364,7 +364,7 @@ __inline static uint get_WLAN_BSSID_EX_sz(WLAN_BSSID_EX *bss) } struct wlan_network { - _list list; + _list list; int network_type; //refer to ieee80211.h for WIRELESS_11A/B/G int fixed; // set to fixed when not to be removed as site-surveying unsigned long last_scanned; //timestamp for the network @@ -376,16 +376,16 @@ struct wlan_network { enum VRTL_CARRIER_SENSE { - DISABLE_VCS, - ENABLE_VCS, + DISABLE_VCS, + ENABLE_VCS, AUTO_VCS }; enum VCS_TYPE { - NONE_VCS, + NONE_VCS, RTS_CTS, - CTS_TO_SELF + CTS_TO_SELF }; @@ -412,7 +412,7 @@ enum UAPSD_MAX_SP #define NUM_PMKID_CACHE NUM_PRE_AUTH_KEY /* -* WPA2 +* WPA2 */ #ifndef PLATFORM_OS_CE @@ -433,20 +433,19 @@ typedef struct _NDIS_802_11_AUTHENTICATION_ENCRYPTION { NDIS_802_11_AUTHENTICATION_MODE AuthModeSupported; NDIS_802_11_ENCRYPTION_STATUS EncryptStatusSupported; - + } NDIS_802_11_AUTHENTICATION_ENCRYPTION, *PNDIS_802_11_AUTHENTICATION_ENCRYPTION; -typedef struct _NDIS_802_11_CAPABILITY +typedef struct _NDIS_802_11_CAPABILITY { ULONG Length; ULONG Version; ULONG NoOfPMKIDs; ULONG NoOfAuthEncryptPairsSupported; NDIS_802_11_AUTHENTICATION_ENCRYPTION AuthenticationEncryptionSupported[1]; - + } NDIS_802_11_CAPABILITY, *PNDIS_802_11_CAPABILITY; #endif #endif //#ifndef WLAN_BSSDEF_H_ - diff --git a/include/xmit_osdep.h b/include/xmit_osdep.h index 07a0172..fbdff03 100755 --- a/include/xmit_osdep.h +++ b/include/xmit_osdep.h @@ -1,7 +1,7 @@ /****************************************************************************** * * 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. @@ -60,4 +60,3 @@ extern void rtw_os_pkt_complete(struct adapter *padapter, _pkt *pkt); extern void rtw_os_xmit_complete(struct adapter *padapter, struct xmit_frame *pxframe); #endif //__XMIT_OSDEP_H_ - diff --git a/os_dep/ioctl_cfg80211.c b/os_dep/ioctl_cfg80211.c index a6998bb..92db6ea 100755 --- a/os_dep/ioctl_cfg80211.c +++ b/os_dep/ioctl_cfg80211.c @@ -1,5765 +1,5764 @@ -/****************************************************************************** - * - * Copyright(c) 2007 - 2012 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 - * - * - ******************************************************************************/ -#define _IOCTL_CFG80211_C_ - -#include -#include -#include -#include -#include -#include -#include - -#ifdef CONFIG_IOCTL_CFG80211 - -#include "ioctl_cfg80211.h" - -#define RTW_MAX_MGMT_TX_CNT (8) - -#define RTW_SCAN_IE_LEN_MAX 2304 -#define RTW_MAX_REMAIN_ON_CHANNEL_DURATION 65535 //ms -#define RTW_MAX_NUM_PMKIDS 4 - -#define RTW_CH_MAX_2G_CHANNEL 14 /* Max channel in 2G band */ - - - -#ifdef CONFIG_WAPI_SUPPORT - -#ifndef WLAN_CIPHER_SUITE_SMS4 -#define WLAN_CIPHER_SUITE_SMS4 0x00147201 -#endif - -#ifndef WLAN_AKM_SUITE_WAPI_PSK -#define WLAN_AKM_SUITE_WAPI_PSK 0x000FAC04 -#endif - -#ifndef WLAN_AKM_SUITE_WAPI_CERT -#define WLAN_AKM_SUITE_WAPI_CERT 0x000FAC12 -#endif - -#ifndef NL80211_WAPI_VERSION_1 -#define NL80211_WAPI_VERSION_1 (1 << 2) -#endif - -#endif - - - -static const u32 rtw_cipher_suites[] = { - WLAN_CIPHER_SUITE_WEP40, - WLAN_CIPHER_SUITE_WEP104, - WLAN_CIPHER_SUITE_TKIP, - WLAN_CIPHER_SUITE_CCMP, -#ifdef CONFIG_IEEE80211W - WLAN_CIPHER_SUITE_AES_CMAC, -#endif //CONFIG_IEEE80211W -}; - -#define RATETAB_ENT(_rate, _rateid, _flags) \ - { \ - .bitrate = (_rate), \ - .hw_value = (_rateid), \ - .flags = (_flags), \ - } - -#define CHAN2G(_channel, _freq, _flags) { \ - .band = IEEE80211_BAND_2GHZ, \ - .center_freq = (_freq), \ - .hw_value = (_channel), \ - .flags = (_flags), \ - .max_antenna_gain = 0, \ - .max_power = 30, \ -} - -#define CHAN5G(_channel, _flags) { \ - .band = IEEE80211_BAND_5GHZ, \ - .center_freq = 5000 + (5 * (_channel)), \ - .hw_value = (_channel), \ - .flags = (_flags), \ - .max_antenna_gain = 0, \ - .max_power = 30, \ -} - -static struct ieee80211_rate rtw_rates[] = { - RATETAB_ENT(10, 0x1, 0), - RATETAB_ENT(20, 0x2, 0), - RATETAB_ENT(55, 0x4, 0), - RATETAB_ENT(110, 0x8, 0), - RATETAB_ENT(60, 0x10, 0), - RATETAB_ENT(90, 0x20, 0), - RATETAB_ENT(120, 0x40, 0), - RATETAB_ENT(180, 0x80, 0), - RATETAB_ENT(240, 0x100, 0), - RATETAB_ENT(360, 0x200, 0), - RATETAB_ENT(480, 0x400, 0), - RATETAB_ENT(540, 0x800, 0), -}; - -#define rtw_a_rates (rtw_rates + 4) -#define RTW_A_RATES_NUM 8 -#define rtw_g_rates (rtw_rates + 0) -#define RTW_G_RATES_NUM 12 - -#define RTW_2G_CHANNELS_NUM 14 -#define RTW_5G_CHANNELS_NUM 37 - -static struct ieee80211_channel rtw_2ghz_channels[] = { - CHAN2G(1, 2412, 0), - CHAN2G(2, 2417, 0), - CHAN2G(3, 2422, 0), - CHAN2G(4, 2427, 0), - CHAN2G(5, 2432, 0), - CHAN2G(6, 2437, 0), - CHAN2G(7, 2442, 0), - CHAN2G(8, 2447, 0), - CHAN2G(9, 2452, 0), - CHAN2G(10, 2457, 0), - CHAN2G(11, 2462, 0), - CHAN2G(12, 2467, 0), - CHAN2G(13, 2472, 0), - CHAN2G(14, 2484, 0), -}; - -static struct ieee80211_channel rtw_5ghz_a_channels[] = { - CHAN5G(34, 0), CHAN5G(36, 0), - CHAN5G(38, 0), CHAN5G(40, 0), - CHAN5G(42, 0), CHAN5G(44, 0), - CHAN5G(46, 0), CHAN5G(48, 0), - CHAN5G(52, 0), CHAN5G(56, 0), - CHAN5G(60, 0), CHAN5G(64, 0), - CHAN5G(100, 0), CHAN5G(104, 0), - CHAN5G(108, 0), CHAN5G(112, 0), - CHAN5G(116, 0), CHAN5G(120, 0), - CHAN5G(124, 0), CHAN5G(128, 0), - CHAN5G(132, 0), CHAN5G(136, 0), - CHAN5G(140, 0), CHAN5G(149, 0), - CHAN5G(153, 0), CHAN5G(157, 0), - CHAN5G(161, 0), CHAN5G(165, 0), - CHAN5G(184, 0), CHAN5G(188, 0), - CHAN5G(192, 0), CHAN5G(196, 0), - CHAN5G(200, 0), CHAN5G(204, 0), - CHAN5G(208, 0), CHAN5G(212, 0), - CHAN5G(216, 0), -}; - - -void rtw_2g_channels_init(struct ieee80211_channel *channels) -{ - _rtw_memcpy((void*)channels, (void*)rtw_2ghz_channels, - sizeof(struct ieee80211_channel)*RTW_2G_CHANNELS_NUM - ); -} - -void rtw_5g_channels_init(struct ieee80211_channel *channels) -{ - _rtw_memcpy((void*)channels, (void*)rtw_5ghz_a_channels, - sizeof(struct ieee80211_channel)*RTW_5G_CHANNELS_NUM - ); -} - -void rtw_2g_rates_init(struct ieee80211_rate *rates) -{ - _rtw_memcpy(rates, rtw_g_rates, - sizeof(struct ieee80211_rate)*RTW_G_RATES_NUM - ); -} - -void rtw_5g_rates_init(struct ieee80211_rate *rates) -{ - _rtw_memcpy(rates, rtw_a_rates, - sizeof(struct ieee80211_rate)*RTW_A_RATES_NUM - ); -} - -struct ieee80211_supported_band *rtw_spt_band_alloc( - enum ieee80211_band band - ) -{ - struct ieee80211_supported_band *spt_band = NULL; - int n_channels, n_bitrates; - - if(band == IEEE80211_BAND_2GHZ) - { - n_channels = RTW_2G_CHANNELS_NUM; - n_bitrates = RTW_G_RATES_NUM; - } - else if(band == IEEE80211_BAND_5GHZ) - { - n_channels = RTW_5G_CHANNELS_NUM; - n_bitrates = RTW_A_RATES_NUM; - } - else - { - goto exit; - } - - spt_band = (struct ieee80211_supported_band *)rtw_zmalloc( - sizeof(struct ieee80211_supported_band) - + sizeof(struct ieee80211_channel)*n_channels - + sizeof(struct ieee80211_rate)*n_bitrates - ); - if(!spt_band) - goto exit; - - spt_band->channels = (struct ieee80211_channel*)(((u8*)spt_band)+sizeof(struct ieee80211_supported_band)); - spt_band->bitrates= (struct ieee80211_rate*)(((u8*)spt_band->channels)+sizeof(struct ieee80211_channel)*n_channels); - spt_band->band = band; - spt_band->n_channels = n_channels; - spt_band->n_bitrates = n_bitrates; - - if(band == IEEE80211_BAND_2GHZ) - { - rtw_2g_channels_init(spt_band->channels); - rtw_2g_rates_init(spt_band->bitrates); - } - else if(band == IEEE80211_BAND_5GHZ) - { - rtw_5g_channels_init(spt_band->channels); - rtw_5g_rates_init(spt_band->bitrates); - } - - //spt_band.ht_cap - -exit: - - return spt_band; -} - -void rtw_spt_band_free(struct ieee80211_supported_band *spt_band) -{ - u32 size; - - if(!spt_band) - return; - - if(spt_band->band == IEEE80211_BAND_2GHZ) - { - size = sizeof(struct ieee80211_supported_band) - + sizeof(struct ieee80211_channel)*RTW_2G_CHANNELS_NUM - + sizeof(struct ieee80211_rate)*RTW_G_RATES_NUM; - } - else if(spt_band->band == IEEE80211_BAND_5GHZ) - { - size = sizeof(struct ieee80211_supported_band) - + sizeof(struct ieee80211_channel)*RTW_5G_CHANNELS_NUM - + sizeof(struct ieee80211_rate)*RTW_A_RATES_NUM; - } - else - { - - } - rtw_mfree((u8*)spt_band, size); -} - -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE) -static const struct ieee80211_txrx_stypes -rtw_cfg80211_default_mgmt_stypes[NUM_NL80211_IFTYPES] = { - [NL80211_IFTYPE_ADHOC] = { - .tx = 0xffff, - .rx = BIT(IEEE80211_STYPE_ACTION >> 4) - }, - [NL80211_IFTYPE_STATION] = { - .tx = 0xffff, - .rx = BIT(IEEE80211_STYPE_ACTION >> 4) | - BIT(IEEE80211_STYPE_PROBE_REQ >> 4) - }, - [NL80211_IFTYPE_AP] = { - .tx = 0xffff, - .rx = BIT(IEEE80211_STYPE_ASSOC_REQ >> 4) | - BIT(IEEE80211_STYPE_REASSOC_REQ >> 4) | - BIT(IEEE80211_STYPE_PROBE_REQ >> 4) | - BIT(IEEE80211_STYPE_DISASSOC >> 4) | - BIT(IEEE80211_STYPE_AUTH >> 4) | - BIT(IEEE80211_STYPE_DEAUTH >> 4) | - BIT(IEEE80211_STYPE_ACTION >> 4) - }, - [NL80211_IFTYPE_AP_VLAN] = { - /* copy AP */ - .tx = 0xffff, - .rx = BIT(IEEE80211_STYPE_ASSOC_REQ >> 4) | - BIT(IEEE80211_STYPE_REASSOC_REQ >> 4) | - BIT(IEEE80211_STYPE_PROBE_REQ >> 4) | - BIT(IEEE80211_STYPE_DISASSOC >> 4) | - BIT(IEEE80211_STYPE_AUTH >> 4) | - BIT(IEEE80211_STYPE_DEAUTH >> 4) | - BIT(IEEE80211_STYPE_ACTION >> 4) - }, - [NL80211_IFTYPE_P2P_CLIENT] = { - .tx = 0xffff, - .rx = BIT(IEEE80211_STYPE_ACTION >> 4) | - BIT(IEEE80211_STYPE_PROBE_REQ >> 4) - }, - [NL80211_IFTYPE_P2P_GO] = { - .tx = 0xffff, - .rx = BIT(IEEE80211_STYPE_ASSOC_REQ >> 4) | - BIT(IEEE80211_STYPE_REASSOC_REQ >> 4) | - BIT(IEEE80211_STYPE_PROBE_REQ >> 4) | - BIT(IEEE80211_STYPE_DISASSOC >> 4) | - BIT(IEEE80211_STYPE_AUTH >> 4) | - BIT(IEEE80211_STYPE_DEAUTH >> 4) | - BIT(IEEE80211_STYPE_ACTION >> 4) - }, -}; -#endif - -static int rtw_ieee80211_channel_to_frequency(int chan, int band) -{ - /* see 802.11 17.3.8.3.2 and Annex J - * there are overlapping channel numbers in 5GHz and 2GHz bands */ - - if (band == IEEE80211_BAND_5GHZ) { - if (chan >= 182 && chan <= 196) - return 4000 + chan * 5; - else - return 5000 + chan * 5; - } else { /* IEEE80211_BAND_2GHZ */ - if (chan == 14) - return 2484; - else if (chan < 14) - return 2407 + chan * 5; - else - return 0; /* not supported */ - } -} - -#define MAX_BSSINFO_LEN 1000 -struct cfg80211_bss *rtw_cfg80211_inform_bss(struct adapter *padapter, struct wlan_network *pnetwork) -{ - struct ieee80211_channel *notify_channel; - struct cfg80211_bss *bss = NULL; - //struct ieee80211_supported_band *band; - u16 channel; - u32 freq; - u64 notify_timestamp; - u16 notify_capability; - u16 notify_interval; - u8 *notify_ie; - size_t notify_ielen; - s32 notify_signal; - u8 buf[MAX_BSSINFO_LEN], *pbuf; - size_t len,bssinf_len=0; - struct rtw_ieee80211_hdr *pwlanhdr; - unsigned short *fctrl; - u8 bc_addr[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; - - struct wireless_dev *wdev = padapter->rtw_wdev; - struct wiphy *wiphy = wdev->wiphy; - struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); - - - //DBG_8192C("%s\n", __func__); - - bssinf_len = pnetwork->network.IELength+sizeof (struct rtw_ieee80211_hdr_3addr); - if(bssinf_len > MAX_BSSINFO_LEN){ - DBG_871X("%s IE Length too long > %d byte \n",__FUNCTION__,MAX_BSSINFO_LEN); - goto exit; - } - - //To reduce PBC Overlap rate - //_enter_critical_bh(&pwdev_priv->scan_req_lock, &irqL); - if(wdev_to_priv(wdev)->scan_request != NULL) - { - u8 *psr=NULL, sr = 0; - NDIS_802_11_SSID *pssid = &pnetwork->network.Ssid; - struct cfg80211_scan_request *request = wdev_to_priv(wdev)->scan_request; - struct cfg80211_ssid *ssids = request->ssids; - u32 wpsielen=0; - u8 *wpsie=NULL; - - wpsie = rtw_get_wps_ie(pnetwork->network.IEs+_FIXED_IE_LENGTH_, pnetwork->network.IELength-_FIXED_IE_LENGTH_, NULL, &wpsielen); - - if(wpsie && wpsielen>0) - psr = rtw_get_wps_attr_content(wpsie, wpsielen, WPS_ATTR_SELECTED_REGISTRAR, (u8*)(&sr), NULL); - - if (sr != 0) - { - if(request->n_ssids == 1 && request->n_channels == 1) // it means under processing WPS - { - DBG_8192C("ssid=%s, len=%d\n", pssid->Ssid, pssid->SsidLength); - - if (ssids[0].ssid_len == 0) { - } - else if(pssid->SsidLength == ssids[0].ssid_len && - _rtw_memcmp(pssid->Ssid, ssids[0].ssid, ssids[0].ssid_len)) - { - DBG_871X("%s, got sr and ssid match!\n", __func__); - } - else - { - if(psr !=NULL) - *psr = 0; //clear sr - -#if 0 - WLAN_BSSID_EX *pselect_network = &pnetwork->network; - struct cfg80211_bss *pselect_bss = NULL; - struct ieee80211_channel *notify_channel = NULL; - u32 freq; - - DBG_871X("%s, got sr, but ssid mismatch, to remove this bss\n", __func__); - - if (pselect_network->Configuration.DSConfig <= RTW_CH_MAX_2G_CHANNEL) - freq = rtw_ieee80211_channel_to_frequency(pselect_network->Configuration.DSConfig, IEEE80211_BAND_2GHZ); - else - freq = rtw_ieee80211_channel_to_frequency(pselect_network->Configuration.DSConfig, IEEE80211_BAND_5GHZ); - - notify_channel = ieee80211_get_channel(wiphy, freq); - pselect_bss = cfg80211_get_bss(wiphy, NULL/*notify_channel*/, - pselect_network->MacAddress, pselect_network->Ssid.Ssid, - pselect_network->Ssid.SsidLength, 0/*WLAN_CAPABILITY_ESS*/, - 0/*WLAN_CAPABILITY_ESS*/); - - if(pselect_bss) - { - DBG_871X("%s, got bss for cfg80211 for unlinking bss\n", __func__); - - cfg80211_unlink_bss(wiphy, pselect_bss); -#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0) - cfg80211_put_bss(wiphy, pselect_bss); -#else - cfg80211_put_bss(pselect_bss); -#endif - - } - - goto exit; -#endif - } - } - } - } - //_exit_critical_bh(&pwdev_priv->scan_req_lock, &irqL); - - channel = pnetwork->network.Configuration.DSConfig; - if (channel <= RTW_CH_MAX_2G_CHANNEL) - freq = rtw_ieee80211_channel_to_frequency(channel, IEEE80211_BAND_2GHZ); - else - freq = rtw_ieee80211_channel_to_frequency(channel, IEEE80211_BAND_5GHZ); - - notify_channel = ieee80211_get_channel(wiphy, freq); - - //rtw_get_timestampe_from_ie() - notify_timestamp = jiffies_to_msecs(jiffies)*1000; /* uSec */ - - notify_interval = le16_to_cpu(*(u16*)rtw_get_beacon_interval_from_ie(pnetwork->network.IEs)); - notify_capability = le16_to_cpu(*(u16*)rtw_get_capability_from_ie(pnetwork->network.IEs)); - - - notify_ie = pnetwork->network.IEs+_FIXED_IE_LENGTH_; - notify_ielen = pnetwork->network.IELength-_FIXED_IE_LENGTH_; - - //We've set wiphy's signal_type as CFG80211_SIGNAL_TYPE_MBM: signal strength in mBm (100*dBm) - if ( check_fwstate(pmlmepriv, _FW_LINKED)== _TRUE && - is_same_network(&pmlmepriv->cur_network.network, &pnetwork->network, 0)) { - notify_signal = 100*translate_percentage_to_dbm(padapter->recvpriv.signal_strength);//dbm - } else { - notify_signal = 100*translate_percentage_to_dbm(pnetwork->network.PhyInfo.SignalStrength);//dbm - } - - #if 0 - DBG_8192C("bssid: "MAC_FMT"\n", MAC_ARG(pnetwork->network.MacAddress)); - DBG_8192C("Channel: %d(%d)\n", channel, freq); - DBG_8192C("Capability: %X\n", notify_capability); - DBG_8192C("Beacon interval: %d\n", notify_interval); - DBG_8192C("Signal: %d\n", notify_signal); - DBG_8192C("notify_timestamp: %#018llx\n", notify_timestamp); - #endif - - pbuf = buf; - - pwlanhdr = (struct rtw_ieee80211_hdr *)pbuf; - fctrl = &(pwlanhdr->frame_ctl); - *(fctrl) = 0; - - SetSeqNum(pwlanhdr, 0/*pmlmeext->mgnt_seq*/); - //pmlmeext->mgnt_seq++; - - if (pnetwork->network.Reserved[0] == 1) { // WIFI_BEACON - _rtw_memcpy(pwlanhdr->addr1, bc_addr, ETH_ALEN); - SetFrameSubType(pbuf, WIFI_BEACON); - } else { - _rtw_memcpy(pwlanhdr->addr1, myid(&(padapter->eeprompriv)), ETH_ALEN); - SetFrameSubType(pbuf, WIFI_PROBERSP); - } - - _rtw_memcpy(pwlanhdr->addr2, pnetwork->network.MacAddress, ETH_ALEN); - _rtw_memcpy(pwlanhdr->addr3, pnetwork->network.MacAddress, ETH_ALEN); - - - pbuf += sizeof(struct rtw_ieee80211_hdr_3addr); - len = sizeof (struct rtw_ieee80211_hdr_3addr); - - _rtw_memcpy(pbuf, pnetwork->network.IEs, pnetwork->network.IELength); - len += pnetwork->network.IELength; - - //#ifdef CONFIG_P2P - //if(rtw_get_p2p_ie(pnetwork->network.IEs+12, pnetwork->network.IELength-12, NULL, NULL)) - //{ - // DBG_8192C("%s, got p2p_ie\n", __func__); - //} - //#endif - - -#if 1 - bss = cfg80211_inform_bss_frame(wiphy, notify_channel, (struct ieee80211_mgmt *)buf, - len, notify_signal, GFP_ATOMIC); -#else - - bss = cfg80211_inform_bss(wiphy, notify_channel, (const u8 *)pnetwork->network.MacAddress, - notify_timestamp, notify_capability, notify_interval, notify_ie, - notify_ielen, notify_signal, GFP_ATOMIC/*GFP_KERNEL*/); -#endif - - if (unlikely(!bss)) { - DBG_8192C(FUNC_ADPT_FMT" bss NULL\n", FUNC_ADPT_ARG(padapter)); - goto exit; - } - -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,38)) -#ifndef COMPAT_KERNEL_RELEASE - //patch for cfg80211, update beacon ies to information_elements - if (pnetwork->network.Reserved[0] == 1) { // WIFI_BEACON - - if(bss->len_information_elements != bss->len_beacon_ies) - { - bss->information_elements = bss->beacon_ies; - bss->len_information_elements = bss->len_beacon_ies; - } - } -#endif //COMPAT_KERNEL_RELEASE -#endif //LINUX_VERSION_CODE < KERNEL_VERSION(2,6,38) - -/* - { - if( bss->information_elements == bss->proberesp_ies) - { - if( bss->len_information_elements != bss->len_proberesp_ies) - { - DBG_8192C("error!, len_information_elements != bss->len_proberesp_ies\n"); - } - - } - else if(bss->len_information_elements < bss->len_beacon_ies) - { - bss->information_elements = bss->beacon_ies; - bss->len_information_elements = bss->len_beacon_ies; - } - } -*/ - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0) - cfg80211_put_bss(wiphy, bss); -#else - cfg80211_put_bss(bss); -#endif - -exit: - return bss; - -} - -/* - Check the given bss is valid by kernel API cfg80211_get_bss() - @padapter : the given adapter - - return _TRUE if bss is valid, _FALSE for not found. -*/ -int rtw_cfg80211_check_bss(struct adapter *padapter) -{ - WLAN_BSSID_EX *pnetwork = &(padapter->mlmeextpriv.mlmext_info.network); - struct cfg80211_bss *bss = NULL; - struct ieee80211_channel *notify_channel = NULL; - u32 freq; - - if (!(pnetwork) || !(padapter->rtw_wdev)) - return _FALSE; - - if (pnetwork->Configuration.DSConfig <= RTW_CH_MAX_2G_CHANNEL) - freq = rtw_ieee80211_channel_to_frequency(pnetwork->Configuration.DSConfig, IEEE80211_BAND_2GHZ); - else - freq = rtw_ieee80211_channel_to_frequency(pnetwork->Configuration.DSConfig, IEEE80211_BAND_5GHZ); - - notify_channel = ieee80211_get_channel(padapter->rtw_wdev->wiphy, freq); - bss = cfg80211_get_bss(padapter->rtw_wdev->wiphy, notify_channel, - pnetwork->MacAddress, pnetwork->Ssid.Ssid, - pnetwork->Ssid.SsidLength, - WLAN_CAPABILITY_ESS, WLAN_CAPABILITY_ESS); - - return (bss!=NULL); -} - -void rtw_cfg80211_ibss_indicate_connect(struct adapter *padapter) -{ - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - struct wlan_network *cur_network = &(pmlmepriv->cur_network); - struct wireless_dev *pwdev = padapter->rtw_wdev; - struct cfg80211_bss *bss = NULL; - - DBG_871X(FUNC_ADPT_FMT"\n", FUNC_ADPT_ARG(padapter)); - if (pwdev->iftype != NL80211_IFTYPE_ADHOC) - { - return; - } - - if (!rtw_cfg80211_check_bss(padapter)) { - WLAN_BSSID_EX *pnetwork = &(padapter->mlmeextpriv.mlmext_info.network); - struct wlan_network *scanned = pmlmepriv->cur_network_scanned; - - if(check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE)==_TRUE) - { - - _rtw_memcpy(&cur_network->network, pnetwork, sizeof(WLAN_BSSID_EX)); - if(cur_network) - { - if (!rtw_cfg80211_inform_bss(padapter,cur_network)) - DBG_871X(FUNC_ADPT_FMT" inform fail !!\n", FUNC_ADPT_ARG(padapter)); - else - DBG_871X(FUNC_ADPT_FMT" inform success !!\n", FUNC_ADPT_ARG(padapter)); - } - else - { - DBG_871X("cur_network is not exist!!!\n"); - return ; - } - } - else - { - if(scanned == NULL) - rtw_warn_on(1); - - if (_rtw_memcmp(&(scanned->network.Ssid), &(pnetwork->Ssid), sizeof(NDIS_802_11_SSID)) == _TRUE - && _rtw_memcmp(scanned->network.MacAddress, pnetwork->MacAddress, sizeof(NDIS_802_11_MAC_ADDRESS)) == _TRUE - ) { - if (!rtw_cfg80211_inform_bss(padapter,scanned)) { - DBG_871X(FUNC_ADPT_FMT" inform fail !!\n", FUNC_ADPT_ARG(padapter)); - } else { - //DBG_871X(FUNC_ADPT_FMT" inform success !!\n", FUNC_ADPT_ARG(padapter)); - } - } else { - DBG_871X("scanned & pnetwork compare fail\n"); - rtw_warn_on(1); - } - } - - if (!rtw_cfg80211_check_bss(padapter)) - DBG_871X_LEVEL(_drv_always_, FUNC_ADPT_FMT" BSS not found !!\n", FUNC_ADPT_ARG(padapter)); - } - //notify cfg80211 that device joined an IBSS - cfg80211_ibss_joined(padapter->pnetdev, cur_network->network.MacAddress, GFP_ATOMIC); -} - -void rtw_cfg80211_indicate_connect(struct adapter *padapter) -{ - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - struct wlan_network *cur_network = &(pmlmepriv->cur_network); - struct wireless_dev *pwdev = padapter->rtw_wdev; -#ifdef CONFIG_P2P - struct wifidirect_info *pwdinfo= &(padapter->wdinfo); -#endif - struct cfg80211_bss *bss = NULL; - - DBG_871X(FUNC_ADPT_FMT"\n", FUNC_ADPT_ARG(padapter)); - if (pwdev->iftype != NL80211_IFTYPE_STATION - #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE) - && pwdev->iftype != NL80211_IFTYPE_P2P_CLIENT - #endif - ) { - return; - } - - if(check_fwstate(pmlmepriv, WIFI_AP_STATE) == _TRUE) - return; - -#ifdef CONFIG_P2P - if(pwdinfo->driver_interface == DRIVER_CFG80211 ) - { - if(!rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) - { - rtw_p2p_set_pre_state(pwdinfo, rtw_p2p_state(pwdinfo)); - rtw_p2p_set_role(pwdinfo, P2P_ROLE_CLIENT); - rtw_p2p_set_state(pwdinfo, P2P_STATE_GONEGO_OK); - DBG_8192C("%s, role=%d, p2p_state=%d, pre_p2p_state=%d\n", __func__, rtw_p2p_role(pwdinfo), rtw_p2p_state(pwdinfo), rtw_p2p_pre_state(pwdinfo)); - } - } -#endif //CONFIG_P2P - - { - WLAN_BSSID_EX *pnetwork = &(padapter->mlmeextpriv.mlmext_info.network); - struct wlan_network *scanned = pmlmepriv->cur_network_scanned; - - //DBG_871X(FUNC_ADPT_FMT" BSS not found\n", FUNC_ADPT_ARG(padapter)); - - if(scanned == NULL) { - rtw_warn_on(1); - goto check_bss; - } - - if (_rtw_memcmp(scanned->network.MacAddress, pnetwork->MacAddress, sizeof(NDIS_802_11_MAC_ADDRESS)) == _TRUE - && _rtw_memcmp(&(scanned->network.Ssid), &(pnetwork->Ssid), sizeof(NDIS_802_11_SSID)) == _TRUE - ) { - if (!rtw_cfg80211_inform_bss(padapter,scanned)) { - DBG_871X(FUNC_ADPT_FMT" inform fail !!\n", FUNC_ADPT_ARG(padapter)); - } else { - //DBG_871X(FUNC_ADPT_FMT" inform success !!\n", FUNC_ADPT_ARG(padapter)); - } - } else { - DBG_871X("scanned: %s("MAC_FMT"), cur: %s("MAC_FMT")\n", - scanned->network.Ssid.Ssid, MAC_ARG(scanned->network.MacAddress), - pnetwork->Ssid.Ssid, MAC_ARG(pnetwork->MacAddress) - ); - rtw_warn_on(1); - } - } - -check_bss: - if (!rtw_cfg80211_check_bss(padapter)) - DBG_871X_LEVEL(_drv_always_, FUNC_ADPT_FMT" BSS not found !!\n", FUNC_ADPT_ARG(padapter)); - - #ifdef CONFIG_LAYER2_ROAMING - if (rtw_to_roaming(padapter) > 0) { - #if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 39) || defined(COMPAT_KERNEL_RELEASE) - struct wiphy *wiphy = pwdev->wiphy; - struct ieee80211_channel *notify_channel; - u32 freq; - u16 channel = cur_network->network.Configuration.DSConfig; - - if (channel <= RTW_CH_MAX_2G_CHANNEL) - freq = rtw_ieee80211_channel_to_frequency(channel, IEEE80211_BAND_2GHZ); - else - freq = rtw_ieee80211_channel_to_frequency(channel, IEEE80211_BAND_5GHZ); - - notify_channel = ieee80211_get_channel(wiphy, freq); - #endif - - DBG_871X(FUNC_ADPT_FMT" call cfg80211_roamed\n", FUNC_ADPT_ARG(padapter)); - cfg80211_roamed(padapter->pnetdev - #if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 39) || defined(COMPAT_KERNEL_RELEASE) - , notify_channel - #endif - , cur_network->network.MacAddress - , pmlmepriv->assoc_req+sizeof(struct rtw_ieee80211_hdr_3addr)+2 - , pmlmepriv->assoc_req_len-sizeof(struct rtw_ieee80211_hdr_3addr)-2 - , pmlmepriv->assoc_rsp+sizeof(struct rtw_ieee80211_hdr_3addr)+6 - , pmlmepriv->assoc_rsp_len-sizeof(struct rtw_ieee80211_hdr_3addr)-6 - , GFP_ATOMIC); - } - else - #endif - { - DBG_8192C("pwdev->sme_state(b)=%d\n", pwdev->sme_state); - cfg80211_connect_result(padapter->pnetdev, cur_network->network.MacAddress - , pmlmepriv->assoc_req+sizeof(struct rtw_ieee80211_hdr_3addr)+2 - , pmlmepriv->assoc_req_len-sizeof(struct rtw_ieee80211_hdr_3addr)-2 - , pmlmepriv->assoc_rsp+sizeof(struct rtw_ieee80211_hdr_3addr)+6 - , pmlmepriv->assoc_rsp_len-sizeof(struct rtw_ieee80211_hdr_3addr)-6 - , WLAN_STATUS_SUCCESS, GFP_ATOMIC); - DBG_8192C("pwdev->sme_state(a)=%d\n", pwdev->sme_state); - } -} - -void rtw_cfg80211_indicate_disconnect(struct adapter *padapter) -{ - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - struct wireless_dev *pwdev = padapter->rtw_wdev; -#ifdef CONFIG_P2P - struct wifidirect_info *pwdinfo= &(padapter->wdinfo); -#endif - - DBG_871X(FUNC_ADPT_FMT"\n", FUNC_ADPT_ARG(padapter)); - - if (pwdev->iftype != NL80211_IFTYPE_STATION - #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE) - && pwdev->iftype != NL80211_IFTYPE_P2P_CLIENT - #endif - ) { - return; - } - - if(check_fwstate(pmlmepriv, WIFI_AP_STATE) == _TRUE) - return; - -#ifdef CONFIG_P2P - if( pwdinfo->driver_interface == DRIVER_CFG80211 ) - { - if(!rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) - { - rtw_p2p_set_state(pwdinfo, rtw_p2p_pre_state(pwdinfo)); - rtw_p2p_set_role(pwdinfo, P2P_ROLE_DEVICE); - - DBG_8192C("%s, role=%d, p2p_state=%d, pre_p2p_state=%d\n", __func__, rtw_p2p_role(pwdinfo), rtw_p2p_state(pwdinfo), rtw_p2p_pre_state(pwdinfo)); - } - } -#endif //CONFIG_P2P - - if (!padapter->mlmepriv.not_indic_disco) { - DBG_8192C("pwdev->sme_state(b)=%d\n", pwdev->sme_state); - - if(pwdev->sme_state==CFG80211_SME_CONNECTING) - cfg80211_connect_result(padapter->pnetdev, NULL, NULL, 0, NULL, 0, - WLAN_STATUS_UNSPECIFIED_FAILURE, GFP_ATOMIC/*GFP_KERNEL*/); - else if(pwdev->sme_state==CFG80211_SME_CONNECTED) - cfg80211_disconnected(padapter->pnetdev, 0, NULL, 0, GFP_ATOMIC); - //else - //DBG_8192C("pwdev->sme_state=%d\n", pwdev->sme_state); - - DBG_8192C("pwdev->sme_state(a)=%d\n", pwdev->sme_state); - } -} - - -#ifdef CONFIG_AP_MODE -static u8 set_pairwise_key(struct adapter *padapter, struct sta_info *psta) -{ - struct cmd_obj* ph2c; - struct set_stakey_parm *psetstakey_para; - struct cmd_priv *pcmdpriv=&padapter->cmdpriv; - u8 res=_SUCCESS; - - ph2c = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj)); - if ( ph2c == NULL){ - res= _FAIL; - goto exit; - } - - psetstakey_para = (struct set_stakey_parm*)rtw_zmalloc(sizeof(struct set_stakey_parm)); - if(psetstakey_para==NULL){ - rtw_mfree((u8 *) ph2c, sizeof(struct cmd_obj)); - res=_FAIL; - goto exit; - } - - init_h2fwcmd_w_parm_no_rsp(ph2c, psetstakey_para, _SetStaKey_CMD_); - - - psetstakey_para->algorithm = (u8)psta->dot118021XPrivacy; - - _rtw_memcpy(psetstakey_para->addr, psta->hwaddr, ETH_ALEN); - - _rtw_memcpy(psetstakey_para->key, &psta->dot118021x_UncstKey, 16); - - - res = rtw_enqueue_cmd(pcmdpriv, ph2c); - -exit: - - return res; - -} - -static int set_group_key(struct adapter *padapter, u8 *key, u8 alg, int keyid) -{ - u8 keylen; - struct cmd_obj* pcmd; - struct setkey_parm *psetkeyparm; - struct cmd_priv *pcmdpriv=&(padapter->cmdpriv); - int res=_SUCCESS; - - DBG_8192C("%s\n", __FUNCTION__); - - pcmd = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj)); - if(pcmd==NULL){ - res= _FAIL; - goto exit; - } - psetkeyparm=(struct setkey_parm*)rtw_zmalloc(sizeof(struct setkey_parm)); - if(psetkeyparm==NULL){ - rtw_mfree((unsigned char *)pcmd, sizeof(struct cmd_obj)); - res= _FAIL; - goto exit; - } - - _rtw_memset(psetkeyparm, 0, sizeof(struct setkey_parm)); - - psetkeyparm->keyid=(u8)keyid; - if (is_wep_enc(alg)) - padapter->securitypriv.key_mask |= BIT(psetkeyparm->keyid); - - psetkeyparm->algorithm = alg; - - psetkeyparm->set_tx = 1; - - switch(alg) - { - case _WEP40_: - keylen = 5; - break; - case _WEP104_: - keylen = 13; - break; - case _TKIP_: - case _TKIP_WTMIC_: - case _AES_: - keylen = 16; - default: - keylen = 16; - } - - _rtw_memcpy(&(psetkeyparm->key[0]), key, keylen); - - pcmd->cmdcode = _SetKey_CMD_; - pcmd->parmbuf = (u8 *)psetkeyparm; - pcmd->cmdsz = (sizeof(struct setkey_parm)); - pcmd->rsp = NULL; - pcmd->rspsz = 0; - - - _rtw_init_listhead(&pcmd->list); - - res = rtw_enqueue_cmd(pcmdpriv, pcmd); - -exit: - - return res; - - -} - -static int set_wep_key(struct adapter *padapter, u8 *key, u8 keylen, int keyid) -{ - u8 alg; - - switch(keylen) - { - case 5: - alg =_WEP40_; - break; - case 13: - alg =_WEP104_; - break; - default: - alg =_NO_PRIVACY_; - } - - return set_group_key(padapter, key, alg, keyid); - -} - -static int rtw_cfg80211_ap_set_encryption(struct net_device *dev, struct ieee_param *param, u32 param_len) -{ - int ret = 0; - u32 wep_key_idx, wep_key_len,wep_total_len; - struct sta_info *psta = NULL, *pbcmc_sta = NULL; - struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - struct security_priv* psecuritypriv=&(padapter->securitypriv); - struct sta_priv *pstapriv = &padapter->stapriv; - - DBG_8192C("%s\n", __FUNCTION__); - - param->u.crypt.err = 0; - param->u.crypt.alg[IEEE_CRYPT_ALG_NAME_LEN - 1] = '\0'; - - //sizeof(struct ieee_param) = 64 bytes; - //if (param_len != (u32) ((u8 *) param->u.crypt.key - (u8 *) param) + param->u.crypt.key_len) - if (param_len != sizeof(struct ieee_param) + param->u.crypt.key_len) - { - ret = -EINVAL; - goto exit; - } - - if (param->sta_addr[0] == 0xff && param->sta_addr[1] == 0xff && - param->sta_addr[2] == 0xff && param->sta_addr[3] == 0xff && - param->sta_addr[4] == 0xff && param->sta_addr[5] == 0xff) - { - if (param->u.crypt.idx >= WEP_KEYS) - { - ret = -EINVAL; - goto exit; - } - } - else - { - psta = rtw_get_stainfo(pstapriv, param->sta_addr); - if(!psta) - { - //ret = -EINVAL; - DBG_8192C("rtw_set_encryption(), sta has already been removed or never been added\n"); - goto exit; - } - } - - if (strcmp(param->u.crypt.alg, "none") == 0 && (psta==NULL)) - { - //todo:clear default encryption keys - - DBG_8192C("clear default encryption keys, keyid=%d\n", param->u.crypt.idx); - - goto exit; - } - - - if (strcmp(param->u.crypt.alg, "WEP") == 0 && (psta==NULL)) - { - DBG_8192C("r871x_set_encryption, crypt.alg = WEP\n"); - - wep_key_idx = param->u.crypt.idx; - wep_key_len = param->u.crypt.key_len; - - DBG_8192C("r871x_set_encryption, wep_key_idx=%d, len=%d\n", wep_key_idx, wep_key_len); - - if((wep_key_idx >= WEP_KEYS) || (wep_key_len<=0)) - { - ret = -EINVAL; - goto exit; - } - - if (wep_key_len > 0) - { - wep_key_len = wep_key_len <= 5 ? 5 : 13; - } - - if (psecuritypriv->bWepDefaultKeyIdxSet == 0) - { - //wep default key has not been set, so use this key index as default key. - - psecuritypriv->ndisencryptstatus = Ndis802_11Encryption1Enabled; - psecuritypriv->dot11PrivacyAlgrthm=_WEP40_; - psecuritypriv->dot118021XGrpPrivacy=_WEP40_; - - if(wep_key_len == 13) - { - psecuritypriv->dot11PrivacyAlgrthm=_WEP104_; - psecuritypriv->dot118021XGrpPrivacy=_WEP104_; - } - - psecuritypriv->dot11PrivacyKeyIndex = wep_key_idx; - } - - _rtw_memcpy(&(psecuritypriv->dot11DefKey[wep_key_idx].skey[0]), param->u.crypt.key, wep_key_len); - - psecuritypriv->dot11DefKeylen[wep_key_idx] = wep_key_len; - - set_wep_key(padapter, param->u.crypt.key, wep_key_len, wep_key_idx); - - goto exit; - - } - - - if(!psta && check_fwstate(pmlmepriv, WIFI_AP_STATE)) // //group key - { - if(param->u.crypt.set_tx == 0) //group key - { - if(strcmp(param->u.crypt.alg, "WEP") == 0) - { - DBG_8192C("%s, set group_key, WEP\n", __FUNCTION__); - - _rtw_memcpy(psecuritypriv->dot118021XGrpKey[param->u.crypt.idx].skey, param->u.crypt.key, (param->u.crypt.key_len>16 ?16:param->u.crypt.key_len)); - - psecuritypriv->dot118021XGrpPrivacy = _WEP40_; - if(param->u.crypt.key_len==13) - { - psecuritypriv->dot118021XGrpPrivacy = _WEP104_; - } - - } - else if(strcmp(param->u.crypt.alg, "TKIP") == 0) - { - DBG_8192C("%s, set group_key, TKIP\n", __FUNCTION__); - - psecuritypriv->dot118021XGrpPrivacy = _TKIP_; - - _rtw_memcpy(psecuritypriv->dot118021XGrpKey[param->u.crypt.idx].skey, param->u.crypt.key, (param->u.crypt.key_len>16 ?16:param->u.crypt.key_len)); - - //DEBUG_ERR("set key length :param->u.crypt.key_len=%d\n", param->u.crypt.key_len); - //set mic key - _rtw_memcpy(psecuritypriv->dot118021XGrptxmickey[param->u.crypt.idx].skey, &(param->u.crypt.key[16]), 8); - _rtw_memcpy(psecuritypriv->dot118021XGrprxmickey[param->u.crypt.idx].skey, &(param->u.crypt.key[24]), 8); - - psecuritypriv->busetkipkey = _TRUE; - - } - else if(strcmp(param->u.crypt.alg, "CCMP") == 0) - { - DBG_8192C("%s, set group_key, CCMP\n", __FUNCTION__); - - psecuritypriv->dot118021XGrpPrivacy = _AES_; - - _rtw_memcpy(psecuritypriv->dot118021XGrpKey[param->u.crypt.idx].skey, param->u.crypt.key, (param->u.crypt.key_len>16 ?16:param->u.crypt.key_len)); - } - else - { - DBG_8192C("%s, set group_key, none\n", __FUNCTION__); - - psecuritypriv->dot118021XGrpPrivacy = _NO_PRIVACY_; - } - - psecuritypriv->dot118021XGrpKeyid = param->u.crypt.idx; - - psecuritypriv->binstallGrpkey = _TRUE; - - psecuritypriv->dot11PrivacyAlgrthm = psecuritypriv->dot118021XGrpPrivacy;//!!! - - set_group_key(padapter, param->u.crypt.key, psecuritypriv->dot118021XGrpPrivacy, param->u.crypt.idx); - - pbcmc_sta=rtw_get_bcmc_stainfo(padapter); - if(pbcmc_sta) - { - pbcmc_sta->ieee8021x_blocked = _FALSE; - pbcmc_sta->dot118021XPrivacy= psecuritypriv->dot118021XGrpPrivacy;//rx will use bmc_sta's dot118021XPrivacy - } - - } - - goto exit; - - } - - if(psecuritypriv->dot11AuthAlgrthm == dot11AuthAlgrthm_8021X && psta) // psk/802_1x - { - if(check_fwstate(pmlmepriv, WIFI_AP_STATE)) - { - if(param->u.crypt.set_tx ==1) //pairwise key - { - _rtw_memcpy(psta->dot118021x_UncstKey.skey, param->u.crypt.key, (param->u.crypt.key_len>16 ?16:param->u.crypt.key_len)); - - if(strcmp(param->u.crypt.alg, "WEP") == 0) - { - DBG_8192C("%s, set pairwise key, WEP\n", __FUNCTION__); - - psta->dot118021XPrivacy = _WEP40_; - if(param->u.crypt.key_len==13) - { - psta->dot118021XPrivacy = _WEP104_; - } - } - else if(strcmp(param->u.crypt.alg, "TKIP") == 0) - { - DBG_8192C("%s, set pairwise key, TKIP\n", __FUNCTION__); - - psta->dot118021XPrivacy = _TKIP_; - - //DEBUG_ERR("set key length :param->u.crypt.key_len=%d\n", param->u.crypt.key_len); - //set mic key - _rtw_memcpy(psta->dot11tkiptxmickey.skey, &(param->u.crypt.key[16]), 8); - _rtw_memcpy(psta->dot11tkiprxmickey.skey, &(param->u.crypt.key[24]), 8); - - psecuritypriv->busetkipkey = _TRUE; - - } - else if(strcmp(param->u.crypt.alg, "CCMP") == 0) - { - - DBG_8192C("%s, set pairwise key, CCMP\n", __FUNCTION__); - - psta->dot118021XPrivacy = _AES_; - } - else - { - DBG_8192C("%s, set pairwise key, none\n", __FUNCTION__); - - psta->dot118021XPrivacy = _NO_PRIVACY_; - } - - set_pairwise_key(padapter, psta); - - psta->ieee8021x_blocked = _FALSE; - - psta->bpairwise_key_installed = _TRUE; - - } - else//group key??? - { - if(strcmp(param->u.crypt.alg, "WEP") == 0) - { - _rtw_memcpy(psecuritypriv->dot118021XGrpKey[param->u.crypt.idx].skey, param->u.crypt.key, (param->u.crypt.key_len>16 ?16:param->u.crypt.key_len)); - - psecuritypriv->dot118021XGrpPrivacy = _WEP40_; - if(param->u.crypt.key_len==13) - { - psecuritypriv->dot118021XGrpPrivacy = _WEP104_; - } - } - else if(strcmp(param->u.crypt.alg, "TKIP") == 0) - { - psecuritypriv->dot118021XGrpPrivacy = _TKIP_; - - _rtw_memcpy(psecuritypriv->dot118021XGrpKey[param->u.crypt.idx].skey, param->u.crypt.key, (param->u.crypt.key_len>16 ?16:param->u.crypt.key_len)); - - //DEBUG_ERR("set key length :param->u.crypt.key_len=%d\n", param->u.crypt.key_len); - //set mic key - _rtw_memcpy(psecuritypriv->dot118021XGrptxmickey[param->u.crypt.idx].skey, &(param->u.crypt.key[16]), 8); - _rtw_memcpy(psecuritypriv->dot118021XGrprxmickey[param->u.crypt.idx].skey, &(param->u.crypt.key[24]), 8); - - psecuritypriv->busetkipkey = _TRUE; - - } - else if(strcmp(param->u.crypt.alg, "CCMP") == 0) - { - psecuritypriv->dot118021XGrpPrivacy = _AES_; - - _rtw_memcpy(psecuritypriv->dot118021XGrpKey[param->u.crypt.idx].skey, param->u.crypt.key, (param->u.crypt.key_len>16 ?16:param->u.crypt.key_len)); - } - else - { - psecuritypriv->dot118021XGrpPrivacy = _NO_PRIVACY_; - } - - psecuritypriv->dot118021XGrpKeyid = param->u.crypt.idx; - - psecuritypriv->binstallGrpkey = _TRUE; - - psecuritypriv->dot11PrivacyAlgrthm = psecuritypriv->dot118021XGrpPrivacy;//!!! - - set_group_key(padapter, param->u.crypt.key, psecuritypriv->dot118021XGrpPrivacy, param->u.crypt.idx); - - pbcmc_sta=rtw_get_bcmc_stainfo(padapter); - if(pbcmc_sta) - { - pbcmc_sta->ieee8021x_blocked = _FALSE; - pbcmc_sta->dot118021XPrivacy= psecuritypriv->dot118021XGrpPrivacy;//rx will use bmc_sta's dot118021XPrivacy - } - - } - - } - - } - -exit: - - return ret; - -} -#endif - -static int rtw_cfg80211_set_encryption(struct net_device *dev, struct ieee_param *param, u32 param_len) -{ - int ret = 0; - u32 wep_key_idx, wep_key_len,wep_total_len; - struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - struct security_priv *psecuritypriv = &padapter->securitypriv; -#ifdef CONFIG_P2P - struct wifidirect_info* pwdinfo = &padapter->wdinfo; -#endif //CONFIG_P2P - -_func_enter_; - - DBG_8192C("%s\n", __func__); - - param->u.crypt.err = 0; - param->u.crypt.alg[IEEE_CRYPT_ALG_NAME_LEN - 1] = '\0'; - - if (param_len < (u32) ((u8 *) param->u.crypt.key - (u8 *) param) + param->u.crypt.key_len) - { - ret = -EINVAL; - goto exit; - } - - if (param->sta_addr[0] == 0xff && param->sta_addr[1] == 0xff && - param->sta_addr[2] == 0xff && param->sta_addr[3] == 0xff && - param->sta_addr[4] == 0xff && param->sta_addr[5] == 0xff) - { - if (param->u.crypt.idx >= WEP_KEYS -#ifdef CONFIG_IEEE80211W - && param->u.crypt.idx > BIP_MAX_KEYID -#endif //CONFIG_IEEE80211W - ) - { - ret = -EINVAL; - goto exit; - } - } else { -#ifdef CONFIG_WAPI_SUPPORT - if (strcmp(param->u.crypt.alg, "SMS4")) -#endif - { - ret = -EINVAL; - goto exit; - } - } - - if (strcmp(param->u.crypt.alg, "WEP") == 0) - { - RT_TRACE(_module_rtl871x_ioctl_os_c,_drv_err_,("wpa_set_encryption, crypt.alg = WEP\n")); - DBG_8192C("wpa_set_encryption, crypt.alg = WEP\n"); - - wep_key_idx = param->u.crypt.idx; - wep_key_len = param->u.crypt.key_len; - - if ((wep_key_idx > WEP_KEYS) || (wep_key_len <= 0)) - { - ret = -EINVAL; - goto exit; - } - - if (psecuritypriv->bWepDefaultKeyIdxSet == 0) - { - //wep default key has not been set, so use this key index as default key. - - wep_key_len = wep_key_len <= 5 ? 5 : 13; - - psecuritypriv->ndisencryptstatus = Ndis802_11Encryption1Enabled; - psecuritypriv->dot11PrivacyAlgrthm = _WEP40_; - psecuritypriv->dot118021XGrpPrivacy = _WEP40_; - - if(wep_key_len==13) - { - psecuritypriv->dot11PrivacyAlgrthm = _WEP104_; - psecuritypriv->dot118021XGrpPrivacy = _WEP104_; - } - - psecuritypriv->dot11PrivacyKeyIndex = wep_key_idx; - } - - _rtw_memcpy(&(psecuritypriv->dot11DefKey[wep_key_idx].skey[0]), param->u.crypt.key, wep_key_len); - - psecuritypriv->dot11DefKeylen[wep_key_idx] = wep_key_len; - - rtw_set_key(padapter, psecuritypriv, wep_key_idx, 0,_TRUE); - - goto exit; - } - - if(padapter->securitypriv.dot11AuthAlgrthm == dot11AuthAlgrthm_8021X) // 802_1x - { - struct sta_info * psta,*pbcmc_sta; - struct sta_priv * pstapriv = &padapter->stapriv; - - //DBG_8192C("%s, : dot11AuthAlgrthm == dot11AuthAlgrthm_8021X \n", __func__); - - if (check_fwstate(pmlmepriv, WIFI_STATION_STATE | WIFI_MP_STATE) == _TRUE) //sta mode - { - psta = rtw_get_stainfo(pstapriv, get_bssid(pmlmepriv)); - if (psta == NULL) { - //DEBUG_ERR( ("Set wpa_set_encryption: Obtain Sta_info fail \n")); - DBG_8192C("%s, : Obtain Sta_info fail \n", __func__); - } - else - { - //Jeff: don't disable ieee8021x_blocked while clearing key - if (strcmp(param->u.crypt.alg, "none") != 0) - psta->ieee8021x_blocked = _FALSE; - - - if((padapter->securitypriv.ndisencryptstatus == Ndis802_11Encryption2Enabled)|| - (padapter->securitypriv.ndisencryptstatus == Ndis802_11Encryption3Enabled)) - { - psta->dot118021XPrivacy = padapter->securitypriv.dot11PrivacyAlgrthm; - } - - if(param->u.crypt.set_tx ==1)//pairwise key - { - - DBG_8192C("%s, : param->u.crypt.set_tx ==1 \n", __func__); - - _rtw_memcpy(psta->dot118021x_UncstKey.skey, param->u.crypt.key, (param->u.crypt.key_len>16 ?16:param->u.crypt.key_len)); - - if(strcmp(param->u.crypt.alg, "TKIP") == 0)//set mic key - { - //DEBUG_ERR(("\nset key length :param->u.crypt.key_len=%d\n", param->u.crypt.key_len)); - _rtw_memcpy(psta->dot11tkiptxmickey.skey, &(param->u.crypt.key[16]), 8); - _rtw_memcpy(psta->dot11tkiprxmickey.skey, &(param->u.crypt.key[24]), 8); - - padapter->securitypriv.busetkipkey=_FALSE; - //_set_timer(&padapter->securitypriv.tkip_timer, 50); - } - - //DEBUG_ERR((" param->u.crypt.key_len=%d\n",param->u.crypt.key_len)); - DBG_871X(" ~~~~set sta key:unicastkey\n"); - - rtw_setstakey_cmd(padapter, (unsigned char *)psta, _TRUE, _TRUE); - } - else//group key - { - if(strcmp(param->u.crypt.alg, "TKIP") == 0 || strcmp(param->u.crypt.alg, "CCMP") == 0) - { - _rtw_memcpy(padapter->securitypriv.dot118021XGrpKey[param->u.crypt.idx].skey, param->u.crypt.key,(param->u.crypt.key_len>16 ?16:param->u.crypt.key_len)); - _rtw_memcpy(padapter->securitypriv.dot118021XGrptxmickey[param->u.crypt.idx].skey,&(param->u.crypt.key[16]),8); - _rtw_memcpy(padapter->securitypriv.dot118021XGrprxmickey[param->u.crypt.idx].skey,&(param->u.crypt.key[24]),8); - padapter->securitypriv.binstallGrpkey = _TRUE; - //DEBUG_ERR((" param->u.crypt.key_len=%d\n", param->u.crypt.key_len)); - DBG_871X(" ~~~~set sta key:groupkey\n"); - - padapter->securitypriv.dot118021XGrpKeyid = param->u.crypt.idx; -#ifdef CONFIG_CONCURRENT_MODE - if (padapter->adapter_type == PRIMARY_ADAPTER) - rtw_set_key(padapter,&padapter->securitypriv,param->u.crypt.idx, 1,_TRUE); - else - DBG_871X_LEVEL(_drv_always_, "second interface do not set cam.\n"); -#else - rtw_set_key(padapter,&padapter->securitypriv,param->u.crypt.idx, 1,_TRUE); -#endif - } -#ifdef CONFIG_IEEE80211W - else if(strcmp(param->u.crypt.alg, "BIP") == 0) - { - int no; - //DBG_871X("BIP key_len=%d , index=%d @@@@@@@@@@@@@@@@@@\n", param->u.crypt.key_len, param->u.crypt.idx); - //save the IGTK key, length 16 bytes - _rtw_memcpy(padapter->securitypriv.dot11wBIPKey[param->u.crypt.idx].skey, param->u.crypt.key,(param->u.crypt.key_len>16 ?16:param->u.crypt.key_len)); - /*DBG_871X("IGTK key below:\n"); - for(no=0;no<16;no++) - printk(" %02x ", padapter->securitypriv.dot11wBIPKey[param->u.crypt.idx].skey[no]); - DBG_871X("\n");*/ - padapter->securitypriv.dot11wBIPKeyid = param->u.crypt.idx; - padapter->securitypriv.binstallBIPkey = _TRUE; - DBG_871X(" ~~~~set sta key:IGKT\n"); - } -#endif //CONFIG_IEEE80211W - -#ifdef CONFIG_P2P - if(pwdinfo->driver_interface == DRIVER_CFG80211 ) - { - if(rtw_p2p_chk_state(pwdinfo, P2P_STATE_PROVISIONING_ING)) - { - rtw_p2p_set_state(pwdinfo, P2P_STATE_PROVISIONING_DONE); - } - } -#endif //CONFIG_P2P - - } - } - - pbcmc_sta=rtw_get_bcmc_stainfo(padapter); - if(pbcmc_sta==NULL) - { - //DEBUG_ERR( ("Set OID_802_11_ADD_KEY: bcmc stainfo is null \n")); - } - else - { - //Jeff: don't disable ieee8021x_blocked while clearing key - if (strcmp(param->u.crypt.alg, "none") != 0) - pbcmc_sta->ieee8021x_blocked = _FALSE; - - if((padapter->securitypriv.ndisencryptstatus == Ndis802_11Encryption2Enabled)|| - (padapter->securitypriv.ndisencryptstatus == Ndis802_11Encryption3Enabled)) - { - pbcmc_sta->dot118021XPrivacy = padapter->securitypriv.dot11PrivacyAlgrthm; - } - } - } - else if(check_fwstate(pmlmepriv, WIFI_ADHOC_STATE)) //adhoc mode - { - } - } - -#ifdef CONFIG_WAPI_SUPPORT - if (strcmp(param->u.crypt.alg, "SMS4") == 0) - { - PRT_WAPI_T pWapiInfo = &padapter->wapiInfo; - PRT_WAPI_STA_INFO pWapiSta; - u8 WapiASUEPNInitialValueSrc[16] = {0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C} ; - u8 WapiAEPNInitialValueSrc[16] = {0x37,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C} ; - u8 WapiAEMultiCastPNInitialValueSrc[16] = {0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C} ; - - if(param->u.crypt.set_tx == 1) - { - list_for_each_entry(pWapiSta, &pWapiInfo->wapiSTAUsedList, list) { - if(_rtw_memcmp(pWapiSta->PeerMacAddr,param->sta_addr,6)) - { - _rtw_memcpy(pWapiSta->lastTxUnicastPN,WapiASUEPNInitialValueSrc,16); - - pWapiSta->wapiUsk.bSet = true; - _rtw_memcpy(pWapiSta->wapiUsk.dataKey,param->u.crypt.key,16); - _rtw_memcpy(pWapiSta->wapiUsk.micKey,param->u.crypt.key+16,16); - pWapiSta->wapiUsk.keyId = param->u.crypt.idx ; - pWapiSta->wapiUsk.bTxEnable = true; - - _rtw_memcpy(pWapiSta->lastRxUnicastPNBEQueue,WapiAEPNInitialValueSrc,16); - _rtw_memcpy(pWapiSta->lastRxUnicastPNBKQueue,WapiAEPNInitialValueSrc,16); - _rtw_memcpy(pWapiSta->lastRxUnicastPNVIQueue,WapiAEPNInitialValueSrc,16); - _rtw_memcpy(pWapiSta->lastRxUnicastPNVOQueue,WapiAEPNInitialValueSrc,16); - _rtw_memcpy(pWapiSta->lastRxUnicastPN,WapiAEPNInitialValueSrc,16); - pWapiSta->wapiUskUpdate.bTxEnable = false; - pWapiSta->wapiUskUpdate.bSet = false; - - if (psecuritypriv->sw_encrypt== false || psecuritypriv->sw_decrypt == false) - { - //set unicast key for ASUE - rtw_wapi_set_key(padapter, &pWapiSta->wapiUsk, pWapiSta, false, false); - } - } - } - } - else - { - list_for_each_entry(pWapiSta, &pWapiInfo->wapiSTAUsedList, list) { - if(_rtw_memcmp(pWapiSta->PeerMacAddr,get_bssid(pmlmepriv),6)) - { - pWapiSta->wapiMsk.bSet = true; - _rtw_memcpy(pWapiSta->wapiMsk.dataKey,param->u.crypt.key,16); - _rtw_memcpy(pWapiSta->wapiMsk.micKey,param->u.crypt.key+16,16); - pWapiSta->wapiMsk.keyId = param->u.crypt.idx ; - pWapiSta->wapiMsk.bTxEnable = false; - if(!pWapiSta->bSetkeyOk) - pWapiSta->bSetkeyOk = true; - pWapiSta->bAuthenticateInProgress = false; - - _rtw_memcpy(pWapiSta->lastRxMulticastPN, WapiAEMultiCastPNInitialValueSrc, 16); - - if (psecuritypriv->sw_decrypt == false) - { - //set rx broadcast key for ASUE - rtw_wapi_set_key(padapter, &pWapiSta->wapiMsk, pWapiSta, true, false); - } - } - - } - } - } -#endif - - -exit: - - DBG_8192C("%s, ret=%d\n", __func__, ret); - - _func_exit_; - - return ret; -} - -static int cfg80211_rtw_add_key(struct wiphy *wiphy, struct net_device *ndev, -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE) - u8 key_index, bool pairwise, const u8 *mac_addr, -#else // (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) - u8 key_index, const u8 *mac_addr, -#endif // (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) - struct key_params *params) -{ - char *alg_name; - u32 param_len; - struct ieee_param *param = NULL; - int ret=0; - struct wireless_dev *rtw_wdev = wiphy_to_wdev(wiphy); - struct adapter *padapter = wiphy_to_adapter(wiphy); - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - - DBG_871X(FUNC_NDEV_FMT" adding key for %pM\n", FUNC_NDEV_ARG(ndev), mac_addr); - DBG_871X("cipher=0x%x\n", params->cipher); - DBG_871X("key_len=0x%x\n", params->key_len); - DBG_871X("seq_len=0x%x\n", params->seq_len); - DBG_871X("key_index=%d\n", key_index); -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE) - DBG_871X("pairwise=%d\n", pairwise); -#endif // (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) - - param_len = sizeof(struct ieee_param) + params->key_len; - param = (struct ieee_param *)rtw_malloc(param_len); - if (param == NULL) - return -1; - - _rtw_memset(param, 0, param_len); - - param->cmd = IEEE_CMD_SET_ENCRYPTION; - _rtw_memset(param->sta_addr, 0xff, ETH_ALEN); - - switch (params->cipher) { - case IW_AUTH_CIPHER_NONE: - //todo: remove key - //remove = 1; - alg_name = "none"; - break; - case WLAN_CIPHER_SUITE_WEP40: - case WLAN_CIPHER_SUITE_WEP104: - alg_name = "WEP"; - break; - case WLAN_CIPHER_SUITE_TKIP: - alg_name = "TKIP"; - break; - case WLAN_CIPHER_SUITE_CCMP: - alg_name = "CCMP"; - break; -#ifdef CONFIG_IEEE80211W - case WLAN_CIPHER_SUITE_AES_CMAC: - alg_name = "BIP"; - break; -#endif //CONFIG_IEEE80211W -#ifdef CONFIG_WAPI_SUPPORT - case WLAN_CIPHER_SUITE_SMS4: - alg_name= "SMS4"; - if(pairwise == NL80211_KEYTYPE_PAIRWISE) { - if (key_index != 0 && key_index != 1) { - ret = -ENOTSUPP; - goto addkey_end; - } - _rtw_memcpy((void*)param->sta_addr, (void*)mac_addr, ETH_ALEN); - } else { - DBG_871X("mac_addr is null \n"); - } - DBG_871X("rtw_wx_set_enc_ext: SMS4 case \n"); - break; -#endif - - default: - ret = -ENOTSUPP; - goto addkey_end; - } - - strncpy((char *)param->u.crypt.alg, alg_name, IEEE_CRYPT_ALG_NAME_LEN); - - - if (!mac_addr || is_broadcast_ether_addr(mac_addr)) - { - param->u.crypt.set_tx = 0; //for wpa/wpa2 group key - } else { - param->u.crypt.set_tx = 1; //for wpa/wpa2 pairwise key - } - - - //param->u.crypt.idx = key_index - 1; - param->u.crypt.idx = key_index; - - if (params->seq_len && params->seq) - { - _rtw_memcpy(param->u.crypt.seq, params->seq, params->seq_len); - } - - if(params->key_len && params->key) - { - param->u.crypt.key_len = params->key_len; - _rtw_memcpy(param->u.crypt.key, params->key, params->key_len); - } - - if(check_fwstate(pmlmepriv, WIFI_STATION_STATE) == _TRUE) - { - ret = rtw_cfg80211_set_encryption(ndev, param, param_len); - } - else if(check_fwstate(pmlmepriv, WIFI_AP_STATE) == _TRUE) - { -#ifdef CONFIG_AP_MODE - if(mac_addr) - _rtw_memcpy(param->sta_addr, (void*)mac_addr, ETH_ALEN); - - ret = rtw_cfg80211_ap_set_encryption(ndev, param, param_len); -#endif - } - else - { - DBG_8192C("error! fw_state=0x%x, iftype=%d\n", pmlmepriv->fw_state, rtw_wdev->iftype); - - } - -addkey_end: - if(param) - { - rtw_mfree((u8*)param, param_len); - } - - return ret; - -} - -static int cfg80211_rtw_get_key(struct wiphy *wiphy, struct net_device *ndev, -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE) - u8 key_index, bool pairwise, const u8 *mac_addr, -#else // (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) - u8 key_index, const u8 *mac_addr, -#endif // (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) - void *cookie, - void (*callback)(void *cookie, - struct key_params*)) -{ -#if 0 - struct iwm_priv *iwm = ndev_to_iwm(ndev); - struct iwm_key *key = &iwm->keys[key_index]; - struct key_params params; - - IWM_DBG_WEXT(iwm, DBG, "Getting key %d\n", key_index); - - memset(¶ms, 0, sizeof(params)); - - params.cipher = key->cipher; - params.key_len = key->key_len; - params.seq_len = key->seq_len; - params.seq = key->seq; - params.key = key->key; - - callback(cookie, ¶ms); - - return key->key_len ? 0 : -ENOENT; -#endif - DBG_871X(FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(ndev)); - return 0; -} - -static int cfg80211_rtw_del_key(struct wiphy *wiphy, struct net_device *ndev, -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE) - u8 key_index, bool pairwise, const u8 *mac_addr) -#else // (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) - u8 key_index, const u8 *mac_addr) -#endif // (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) -{ - struct adapter *padapter = (struct adapter *)rtw_netdev_priv(ndev); - struct security_priv *psecuritypriv = &padapter->securitypriv; - - DBG_871X(FUNC_NDEV_FMT" key_index=%d\n", FUNC_NDEV_ARG(ndev), key_index); - - if (key_index == psecuritypriv->dot11PrivacyKeyIndex) - { - //clear the flag of wep default key set. - psecuritypriv->bWepDefaultKeyIdxSet = 0; - } - - return 0; -} - -static int cfg80211_rtw_set_default_key(struct wiphy *wiphy, - struct net_device *ndev, u8 key_index - #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) || defined(COMPAT_KERNEL_RELEASE) - , bool unicast, bool multicast - #endif - ) -{ - struct adapter *padapter = (struct adapter *)rtw_netdev_priv(ndev); - struct security_priv *psecuritypriv = &padapter->securitypriv; - - DBG_871X(FUNC_NDEV_FMT" key_index=%d" - #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) || defined(COMPAT_KERNEL_RELEASE) - ", unicast=%d, multicast=%d" - #endif - ".\n", FUNC_NDEV_ARG(ndev), key_index - #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) || defined(COMPAT_KERNEL_RELEASE) - , unicast, multicast - #endif - ); - - if ((key_index < WEP_KEYS) && ((psecuritypriv->dot11PrivacyAlgrthm == _WEP40_) || (psecuritypriv->dot11PrivacyAlgrthm == _WEP104_))) //set wep default key - { - psecuritypriv->ndisencryptstatus = Ndis802_11Encryption1Enabled; - - psecuritypriv->dot11PrivacyKeyIndex = key_index; - - psecuritypriv->dot11PrivacyAlgrthm = _WEP40_; - psecuritypriv->dot118021XGrpPrivacy = _WEP40_; - if (psecuritypriv->dot11DefKeylen[key_index] == 13) - { - psecuritypriv->dot11PrivacyAlgrthm = _WEP104_; - psecuritypriv->dot118021XGrpPrivacy = _WEP104_; - } - - psecuritypriv->bWepDefaultKeyIdxSet = 1; //set the flag to represent that wep default key has been set - } - - return 0; - -} - -static int cfg80211_rtw_get_station(struct wiphy *wiphy, - struct net_device *ndev, - u8 *mac, struct station_info *sinfo) -{ - int ret = 0; - struct adapter *padapter = wiphy_to_adapter(wiphy); - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - struct sta_info *psta = NULL; - struct sta_priv *pstapriv = &padapter->stapriv; - - sinfo->filled = 0; - - if (!mac) { - DBG_871X(FUNC_NDEV_FMT" mac==%p\n", FUNC_NDEV_ARG(ndev), mac); - ret = -ENOENT; - goto exit; - } - - psta = rtw_get_stainfo(pstapriv, mac); - if (psta == NULL) { - DBG_8192C("%s, sta_info is null\n", __func__); - ret = -ENOENT; - goto exit; - } - -#ifdef CONFIG_DEBUG_CFG80211 - DBG_871X(FUNC_NDEV_FMT" mac="MAC_FMT"\n", FUNC_NDEV_ARG(ndev), MAC_ARG(mac)); -#endif - - //for infra./P2PClient mode - if( check_fwstate(pmlmepriv, WIFI_STATION_STATE) - && check_fwstate(pmlmepriv, _FW_LINKED) - ) - { - struct wlan_network *cur_network = &(pmlmepriv->cur_network); - - if (_rtw_memcmp(mac, cur_network->network.MacAddress, ETH_ALEN) == _FALSE) { - DBG_871X("%s, mismatch bssid="MAC_FMT"\n", __func__, MAC_ARG(cur_network->network.MacAddress)); - ret = -ENOENT; - goto exit; - } - - sinfo->filled |= STATION_INFO_SIGNAL; - sinfo->signal = translate_percentage_to_dbm(padapter->recvpriv.signal_strength); - - sinfo->filled |= STATION_INFO_TX_BITRATE; - sinfo->txrate.legacy = rtw_get_cur_max_rate(padapter); - - sinfo->filled |= STATION_INFO_RX_PACKETS; - sinfo->rx_packets = sta_rx_data_pkts(psta); - - sinfo->filled |= STATION_INFO_TX_PACKETS; - sinfo->tx_packets = psta->sta_stats.tx_pkts; - - } - - //for Ad-Hoc/AP mode - if ((check_fwstate(pmlmepriv, WIFI_ADHOC_STATE) - ||check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) - ||check_fwstate(pmlmepriv, WIFI_AP_STATE)) - && check_fwstate(pmlmepriv, _FW_LINKED) - ) - { - //TODO: should acquire station info... - } - -exit: - return ret; -} - -extern int netdev_open(struct net_device *pnetdev); -#ifdef CONFIG_CONCURRENT_MODE -extern int netdev_if2_open(struct net_device *pnetdev); -#endif - -/* -enum nl80211_iftype { - NL80211_IFTYPE_UNSPECIFIED, - NL80211_IFTYPE_ADHOC, //1 - NL80211_IFTYPE_STATION, //2 - NL80211_IFTYPE_AP, //3 - NL80211_IFTYPE_AP_VLAN, - NL80211_IFTYPE_WDS, - NL80211_IFTYPE_MONITOR, //6 - NL80211_IFTYPE_MESH_POINT, - NL80211_IFTYPE_P2P_CLIENT, //8 - NL80211_IFTYPE_P2P_GO, //9 - //keep last - NUM_NL80211_IFTYPES, - NL80211_IFTYPE_MAX = NUM_NL80211_IFTYPES - 1 -}; -*/ -static int cfg80211_rtw_change_iface(struct wiphy *wiphy, - struct net_device *ndev, - enum nl80211_iftype type, u32 *flags, - struct vif_params *params) -{ - enum nl80211_iftype old_type; - NDIS_802_11_NETWORK_INFRASTRUCTURE networkType ; - struct adapter *padapter = wiphy_to_adapter(wiphy); - struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); - struct wireless_dev *rtw_wdev = wiphy_to_wdev(wiphy); -#ifdef CONFIG_P2P - struct wifidirect_info *pwdinfo= &(padapter->wdinfo); -#endif - int ret = 0; - u8 change = _FALSE; - - DBG_871X(FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(ndev)); - - if(adapter_to_dvobj(padapter)->processing_dev_remove == _TRUE) - { - ret= -EPERM; - goto exit; - } - - -#ifdef CONFIG_CONCURRENT_MODE - if(padapter->adapter_type == SECONDARY_ADAPTER) - { - DBG_871X(FUNC_NDEV_FMT" call netdev_if2_open\n", FUNC_NDEV_ARG(ndev)); - if(netdev_if2_open(ndev) != 0) { - ret= -EPERM; - goto exit; - } - } - else if(padapter->adapter_type == PRIMARY_ADAPTER) -#endif //CONFIG_CONCURRENT_MODE - { - DBG_871X(FUNC_NDEV_FMT" call netdev_open\n", FUNC_NDEV_ARG(ndev)); - if(netdev_open(ndev) != 0) { - ret= -EPERM; - goto exit; - } - } - - if(_FAIL == rtw_pwr_wakeup(padapter)) { - ret= -EPERM; - goto exit; - } - - old_type = rtw_wdev->iftype; - DBG_871X(FUNC_NDEV_FMT" old_iftype=%d, new_iftype=%d\n", - FUNC_NDEV_ARG(ndev), old_type, type); - - if(old_type != type) - { - change = _TRUE; - pmlmeext->action_public_rxseq = 0xffff; - pmlmeext->action_public_dialog_token = 0xff; - } - - switch (type) { - case NL80211_IFTYPE_ADHOC: - networkType = Ndis802_11IBSS; - break; -#if defined(CONFIG_P2P) && ((LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE)) - case NL80211_IFTYPE_P2P_CLIENT: -#endif - case NL80211_IFTYPE_STATION: - networkType = Ndis802_11Infrastructure; - #ifdef CONFIG_P2P - if(pwdinfo->driver_interface == DRIVER_CFG80211 ) - { - if(change && rtw_p2p_chk_role(pwdinfo, P2P_ROLE_GO)) - { - //it means remove GO and change mode from AP(GO) to station(P2P DEVICE) - rtw_p2p_set_role(pwdinfo, P2P_ROLE_DEVICE); - rtw_p2p_set_state(pwdinfo, rtw_p2p_pre_state(pwdinfo)); - - DBG_8192C("%s, role=%d, p2p_state=%d, pre_p2p_state=%d\n", __func__, rtw_p2p_role(pwdinfo), rtw_p2p_state(pwdinfo), rtw_p2p_pre_state(pwdinfo)); - } - } - #endif //CONFIG_P2P - break; -#if defined(CONFIG_P2P) && ((LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE)) - case NL80211_IFTYPE_P2P_GO: -#endif - case NL80211_IFTYPE_AP: - networkType = Ndis802_11APMode; - #ifdef CONFIG_P2P - if(pwdinfo->driver_interface == DRIVER_CFG80211 ) - { - if(change && !rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) - { - //it means P2P Group created, we will be GO and change mode from P2P DEVICE to AP(GO) - rtw_p2p_set_role(pwdinfo, P2P_ROLE_GO); - } - } - #endif //CONFIG_P2P - break; - default: - return -EOPNOTSUPP; - } - - rtw_wdev->iftype = type; - - if (rtw_set_802_11_infrastructure_mode(padapter, networkType) ==_FALSE) - { - rtw_wdev->iftype = old_type; - ret = -EPERM; - goto exit; - } - - rtw_setopmode_cmd(padapter, networkType,_TRUE); - -exit: - - return ret; -} - -void rtw_cfg80211_indicate_scan_done(struct rtw_wdev_priv *pwdev_priv, bool aborted) -{ - _irqL irqL; - - _enter_critical_bh(&pwdev_priv->scan_req_lock, &irqL); - if(pwdev_priv->scan_request != NULL) - { - //struct cfg80211_scan_request *scan_request = pwdev_priv->scan_request; - - #ifdef CONFIG_DEBUG_CFG80211 - DBG_871X("%s with scan req\n", __FUNCTION__); - #endif - - //avoid WARN_ON(request != wiphy_to_dev(request->wiphy)->scan_req); - //if(scan_request == wiphy_to_dev(scan_request->wiphy)->scan_req) - if(pwdev_priv->scan_request->wiphy != pwdev_priv->rtw_wdev->wiphy) - { - DBG_8192C("error wiphy compare\n"); - } - else - { - cfg80211_scan_done(pwdev_priv->scan_request, aborted); - } - - pwdev_priv->scan_request = NULL; - - } else { - #ifdef CONFIG_DEBUG_CFG80211 - DBG_871X("%s without scan req\n", __FUNCTION__); - #endif - } - _exit_critical_bh(&pwdev_priv->scan_req_lock, &irqL); -} - -void rtw_cfg80211_surveydone_event_callback(struct adapter *padapter) -{ - _irqL irqL; - _list *plist, *phead; - struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); - _queue *queue = &(pmlmepriv->scanned_queue); - struct wlan_network *pnetwork = NULL; - u32 cnt=0; - u32 wait_for_surveydone; - sint wait_status; -#ifdef CONFIG_P2P - struct wifidirect_info* pwdinfo = &padapter->wdinfo; -#endif //CONFIG_P2P - struct rtw_wdev_priv *pwdev_priv = wdev_to_priv(padapter->rtw_wdev); - -#ifdef CONFIG_DEBUG_CFG80211 - DBG_8192C("%s\n", __func__); -#endif - - _enter_critical_bh(&(pmlmepriv->scanned_queue.lock), &irqL); - - phead = get_list_head(queue); - plist = get_next(phead); - - while(1) - { - if (rtw_end_of_queue_search(phead,plist)== _TRUE) - break; - - pnetwork = LIST_CONTAINOR(plist, struct wlan_network, list); - - //report network only if the current channel set contains the channel to which this network belongs - if(rtw_ch_set_search_ch(padapter->mlmeextpriv.channel_set, pnetwork->network.Configuration.DSConfig) >= 0 - && _TRUE == rtw_validate_ssid(&(pnetwork->network.Ssid)) - ) - { - //ev=translate_scan(padapter, a, pnetwork, ev, stop); - rtw_cfg80211_inform_bss(padapter, pnetwork); - } - - plist = get_next(plist); - - } - - _exit_critical_bh(&(pmlmepriv->scanned_queue.lock), &irqL); - - //call this after other things have been done - rtw_cfg80211_indicate_scan_done(wdev_to_priv(padapter->rtw_wdev), _FALSE); -} - -static int rtw_cfg80211_set_probe_req_wpsp2pie(struct adapter *padapter, char *buf, int len) -{ - int ret = 0; - uint wps_ielen = 0; - u8 *wps_ie; - u32 p2p_ielen = 0; - u8 *p2p_ie; - u32 wfd_ielen = 0; - u8 *wfd_ie; - struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); - -#ifdef CONFIG_DEBUG_CFG80211 - DBG_8192C("%s, ielen=%d\n", __func__, len); -#endif - - if(len>0) - { - if((wps_ie = rtw_get_wps_ie(buf, len, NULL, &wps_ielen))) - { - #ifdef CONFIG_DEBUG_CFG80211 - DBG_8192C("probe_req_wps_ielen=%d\n", wps_ielen); - #endif - - if(pmlmepriv->wps_probe_req_ie) - { - u32 free_len = pmlmepriv->wps_probe_req_ie_len; - pmlmepriv->wps_probe_req_ie_len = 0; - rtw_mfree(pmlmepriv->wps_probe_req_ie, free_len); - pmlmepriv->wps_probe_req_ie = NULL; - } - - pmlmepriv->wps_probe_req_ie = rtw_malloc(wps_ielen); - if ( pmlmepriv->wps_probe_req_ie == NULL) { - DBG_8192C("%s()-%d: rtw_malloc() ERROR!\n", __FUNCTION__, __LINE__); - return -EINVAL; - - } - _rtw_memcpy(pmlmepriv->wps_probe_req_ie, wps_ie, wps_ielen); - pmlmepriv->wps_probe_req_ie_len = wps_ielen; - } - - //buf += wps_ielen; - //len -= wps_ielen; - - #ifdef CONFIG_P2P - if((p2p_ie=rtw_get_p2p_ie(buf, len, NULL, &p2p_ielen))) - { - struct wifidirect_info *wdinfo = &padapter->wdinfo; - u32 attr_contentlen = 0; - u8 listen_ch_attr[5]; - - #ifdef CONFIG_DEBUG_CFG80211 - DBG_8192C("probe_req_p2p_ielen=%d\n", p2p_ielen); - #endif - - if(pmlmepriv->p2p_probe_req_ie) - { - u32 free_len = pmlmepriv->p2p_probe_req_ie_len; - pmlmepriv->p2p_probe_req_ie_len = 0; - rtw_mfree(pmlmepriv->p2p_probe_req_ie, free_len); - pmlmepriv->p2p_probe_req_ie = NULL; - } - - pmlmepriv->p2p_probe_req_ie = rtw_malloc(p2p_ielen); - if ( pmlmepriv->p2p_probe_req_ie == NULL) { - DBG_8192C("%s()-%d: rtw_malloc() ERROR!\n", __FUNCTION__, __LINE__); - return -EINVAL; - - } - _rtw_memcpy(pmlmepriv->p2p_probe_req_ie, p2p_ie, p2p_ielen); - pmlmepriv->p2p_probe_req_ie_len = p2p_ielen; - - if(rtw_get_p2p_attr_content(p2p_ie, p2p_ielen, P2P_ATTR_LISTEN_CH, (u8*)listen_ch_attr, (uint*) &attr_contentlen) - && attr_contentlen == 5) - { - if (wdinfo->listen_channel != listen_ch_attr[4]) { - DBG_871X(FUNC_ADPT_FMT" listen channel - country:%c%c%c, class:%u, ch:%u\n", - FUNC_ADPT_ARG(padapter), listen_ch_attr[0], listen_ch_attr[1], listen_ch_attr[2], - listen_ch_attr[3], listen_ch_attr[4]); - wdinfo->listen_channel = listen_ch_attr[4]; - } - } - } - #endif //CONFIG_P2P - - //buf += p2p_ielen; - //len -= p2p_ielen; - - #ifdef CONFIG_WFD - if(rtw_get_wfd_ie(buf, len, NULL, &wfd_ielen)) - { - #ifdef CONFIG_DEBUG_CFG80211 - DBG_8192C("probe_req_wfd_ielen=%d\n", wfd_ielen); - #endif - - if(pmlmepriv->wfd_probe_req_ie) - { - u32 free_len = pmlmepriv->wfd_probe_req_ie_len; - pmlmepriv->wfd_probe_req_ie_len = 0; - rtw_mfree(pmlmepriv->wfd_probe_req_ie, free_len); - pmlmepriv->wfd_probe_req_ie = NULL; - } - - pmlmepriv->wfd_probe_req_ie = rtw_malloc(wfd_ielen); - if ( pmlmepriv->wfd_probe_req_ie == NULL) { - DBG_8192C("%s()-%d: rtw_malloc() ERROR!\n", __FUNCTION__, __LINE__); - return -EINVAL; - - } - rtw_get_wfd_ie(buf, len, pmlmepriv->wfd_probe_req_ie, &pmlmepriv->wfd_probe_req_ie_len); - } - #endif //CONFIG_WFD - - } - - return ret; - -} - -static int cfg80211_rtw_scan(struct wiphy *wiphy - #if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 6, 0)) - , struct net_device *ndev - #endif - , struct cfg80211_scan_request *request) -{ - int i; - u8 _status = _FALSE; - int ret = 0; - struct adapter *padapter = wiphy_to_adapter(wiphy); - struct mlme_priv *pmlmepriv= &padapter->mlmepriv; - NDIS_802_11_SSID ssid[RTW_SSID_SCAN_AMOUNT]; - struct rtw_ieee80211_channel ch[RTW_CHANNEL_SCAN_AMOUNT]; - _irqL irqL; - u8 *wps_ie=NULL; - uint wps_ielen=0; - u8 *p2p_ie=NULL; - uint p2p_ielen=0; - u8 survey_times=3; - u8 survey_times_for_one_ch=6; -#ifdef CONFIG_P2P - struct wifidirect_info *pwdinfo= &(padapter->wdinfo); -#endif //CONFIG_P2P - struct rtw_wdev_priv *pwdev_priv = wdev_to_priv(padapter->rtw_wdev); - struct cfg80211_ssid *ssids = request->ssids; - int social_channel = 0, j = 0; - bool need_indicate_scan_done = _FALSE; -#ifdef CONFIG_CONCURRENT_MODE - PADAPTER pbuddy_adapter = NULL; - struct mlme_priv *pbuddy_mlmepriv = NULL; -#endif //CONFIG_CONCURRENT_MODE - -//#ifdef CONFIG_DEBUG_CFG80211 - DBG_871X(FUNC_ADPT_FMT"\n", FUNC_ADPT_ARG(padapter)); -//#endif - -#ifdef CONFIG_CONCURRENT_MODE - if (padapter->pbuddy_adapter) { - pbuddy_adapter = padapter->pbuddy_adapter; - pbuddy_mlmepriv = &(pbuddy_adapter->mlmepriv); - } -#endif //CONFIG_CONCURRENT_MODE - - _enter_critical_bh(&pwdev_priv->scan_req_lock, &irqL); - pwdev_priv->scan_request = request; - _exit_critical_bh(&pwdev_priv->scan_req_lock, &irqL); - - if (check_fwstate(pmlmepriv, WIFI_AP_STATE) == _TRUE) - { -#ifdef CONFIG_DEBUG_CFG80211 - DBG_871X("%s under WIFI_AP_STATE\n", __FUNCTION__); -#endif - - if (check_fwstate(pmlmepriv, WIFI_UNDER_WPS|_FW_UNDER_SURVEY|_FW_UNDER_LINKING) == _TRUE) - { - DBG_8192C("%s, fwstate=0x%x\n", __func__, pmlmepriv->fw_state); - - if(check_fwstate(pmlmepriv, WIFI_UNDER_WPS)) - { - DBG_8192C("AP mode process WPS \n"); - } - - need_indicate_scan_done = _TRUE; - goto check_need_indicate_scan_done; - } - } - - if(_FAIL == rtw_pwr_wakeup(padapter)) { - need_indicate_scan_done = _TRUE; - goto check_need_indicate_scan_done; - } - - #ifdef CONFIG_P2P - if( pwdinfo->driver_interface == DRIVER_CFG80211 ) - { - if(ssids->ssid != NULL - && _rtw_memcmp(ssids->ssid, "DIRECT-", 7) - && rtw_get_p2p_ie((u8 *)request->ie, request->ie_len, NULL, NULL) - ) - { - if(rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) - { - rtw_p2p_enable(padapter, P2P_ROLE_DEVICE); - wdev_to_priv(padapter->rtw_wdev)->p2p_enabled = _TRUE; - } - else - { - rtw_p2p_set_pre_state(pwdinfo, rtw_p2p_state(pwdinfo)); - #ifdef CONFIG_DEBUG_CFG80211 - DBG_8192C("%s, role=%d, p2p_state=%d\n", __func__, rtw_p2p_role(pwdinfo), rtw_p2p_state(pwdinfo)); - #endif - } - rtw_p2p_set_state(pwdinfo, P2P_STATE_LISTEN); - - if(request->n_channels == 3 && - request->channels[0]->hw_value == 1 && - request->channels[1]->hw_value == 6 && - request->channels[2]->hw_value == 11 - ) - { - social_channel = 1; - } - } - } - #endif //CONFIG_P2P - - if(request->ie && request->ie_len>0) - { - rtw_cfg80211_set_probe_req_wpsp2pie(padapter, (u8 *)request->ie, request->ie_len ); - } - - if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY) == _TRUE) { - DBG_8192C("%s, fwstate=0x%x\n", __func__, pmlmepriv->fw_state); - need_indicate_scan_done = _TRUE; - goto check_need_indicate_scan_done; - } else if (check_fwstate(pmlmepriv, _FW_UNDER_LINKING) == _TRUE) { - DBG_8192C("%s, fwstate=0x%x\n", __func__, pmlmepriv->fw_state); - ret = -EBUSY; - goto check_need_indicate_scan_done; - } - - if (pmlmepriv->LinkDetectInfo.bBusyTraffic == _TRUE) - { - DBG_8192C("%s, bBusyTraffic == _TRUE\n", __func__); - need_indicate_scan_done = _TRUE; - goto check_need_indicate_scan_done; - } - - if (rtw_is_scan_deny(padapter)){ - DBG_871X(FUNC_ADPT_FMT ": scan deny\n", FUNC_ADPT_ARG(padapter)); - need_indicate_scan_done = _TRUE; - goto check_need_indicate_scan_done; - } - -#ifdef CONFIG_CONCURRENT_MODE - if(pbuddy_mlmepriv && (pbuddy_mlmepriv->LinkDetectInfo.bBusyTraffic == _TRUE)) - { - DBG_8192C("%s, bBusyTraffic == _TRUE at buddy_intf\n", __func__); - need_indicate_scan_done = _TRUE; - goto check_need_indicate_scan_done; - } - - if (check_buddy_fwstate(padapter, - _FW_UNDER_SURVEY|_FW_UNDER_LINKING|WIFI_UNDER_WPS) == _TRUE) - { - if(check_buddy_fwstate(padapter, _FW_UNDER_SURVEY)) - { - DBG_8192C("scanning_via_buddy_intf\n"); - pmlmepriv->scanning_via_buddy_intf = _TRUE; - } - - DBG_8192C("buddy_intf's mlme state:0x%x\n", pbuddy_mlmepriv->fw_state); - - need_indicate_scan_done = _TRUE; - goto check_need_indicate_scan_done; - } -#endif - - -#ifdef CONFIG_P2P - if( pwdinfo->driver_interface == DRIVER_CFG80211 ) - { - if(!rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE) && !rtw_p2p_chk_state(pwdinfo, P2P_STATE_IDLE)) - { - rtw_p2p_set_state(pwdinfo, P2P_STATE_FIND_PHASE_SEARCH); - rtw_free_network_queue(padapter, _TRUE); - - if(social_channel == 0) - rtw_p2p_findphase_ex_set(pwdinfo, P2P_FINDPHASE_EX_NONE); - else - rtw_p2p_findphase_ex_set(pwdinfo, P2P_FINDPHASE_EX_SOCIAL_LAST); - } - } -#endif //CONFIG_P2P - - - _rtw_memset(ssid, 0, sizeof(NDIS_802_11_SSID)*RTW_SSID_SCAN_AMOUNT); - //parsing request ssids, n_ssids - for (i = 0; i < request->n_ssids && i < RTW_SSID_SCAN_AMOUNT; i++) { - #ifdef CONFIG_DEBUG_CFG80211 - DBG_8192C("ssid=%s, len=%d\n", ssids[i].ssid, ssids[i].ssid_len); - #endif - _rtw_memcpy(ssid[i].Ssid, ssids[i].ssid, ssids[i].ssid_len); - ssid[i].SsidLength = ssids[i].ssid_len; - } - - /* parsing channels, n_channels */ - _rtw_memset(ch, 0, sizeof(struct rtw_ieee80211_channel)*RTW_CHANNEL_SCAN_AMOUNT); - for (i=0;in_channels && ichannels[i])); - #endif - ch[i].hw_value = request->channels[i]->hw_value; - ch[i].flags = request->channels[i]->flags; - } - - _enter_critical_bh(&pmlmepriv->lock, &irqL); - if (request->n_channels == 1) { - for(i=1;in_channels <= 4) { - for(j=request->n_channels-1;j>=0;j--) - for(i=0;in_channels); - } else { - _status = rtw_sitesurvey_cmd(padapter, ssid, RTW_SSID_SCAN_AMOUNT, NULL, 0); - } - _exit_critical_bh(&pmlmepriv->lock, &irqL); - - - if(_status == _FALSE) - { - ret = -1; - } - -check_need_indicate_scan_done: - if(need_indicate_scan_done) - rtw_cfg80211_surveydone_event_callback(padapter); - -exit: - - return ret; - -} - -static int cfg80211_rtw_set_wiphy_params(struct wiphy *wiphy, u32 changed) -{ -#if 0 - struct iwm_priv *iwm = wiphy_to_iwm(wiphy); - - if (changed & WIPHY_PARAM_RTS_THRESHOLD && - (iwm->conf.rts_threshold != wiphy->rts_threshold)) { - int ret; - - iwm->conf.rts_threshold = wiphy->rts_threshold; - - ret = iwm_umac_set_config_fix(iwm, UMAC_PARAM_TBL_CFG_FIX, - CFG_RTS_THRESHOLD, - iwm->conf.rts_threshold); - if (ret < 0) - return ret; - } - - if (changed & WIPHY_PARAM_FRAG_THRESHOLD && - (iwm->conf.frag_threshold != wiphy->frag_threshold)) { - int ret; - - iwm->conf.frag_threshold = wiphy->frag_threshold; - - ret = iwm_umac_set_config_fix(iwm, UMAC_PARAM_TBL_FA_CFG_FIX, - CFG_FRAG_THRESHOLD, - iwm->conf.frag_threshold); - if (ret < 0) - return ret; - } -#endif - DBG_8192C("%s\n", __func__); - return 0; -} - - - -static int rtw_cfg80211_set_wpa_version(struct security_priv *psecuritypriv, u32 wpa_version) -{ - DBG_8192C("%s, wpa_version=%d\n", __func__, wpa_version); - - if (!wpa_version) { - psecuritypriv->ndisauthtype = Ndis802_11AuthModeOpen; - return 0; - } - - - if (wpa_version & (NL80211_WPA_VERSION_1 | NL80211_WPA_VERSION_2)) - { - psecuritypriv->ndisauthtype = Ndis802_11AuthModeWPAPSK; - } - -/* - if (wpa_version & NL80211_WPA_VERSION_2) - { - psecuritypriv->ndisauthtype = Ndis802_11AuthModeWPA2PSK; - } -*/ - - return 0; - -} - -static int rtw_cfg80211_set_auth_type(struct security_priv *psecuritypriv, - enum nl80211_auth_type sme_auth_type) -{ - DBG_8192C("%s, nl80211_auth_type=%d\n", __func__, sme_auth_type); - - - switch (sme_auth_type) { - case NL80211_AUTHTYPE_AUTOMATIC: - - psecuritypriv->dot11AuthAlgrthm = dot11AuthAlgrthm_Auto; - - break; - case NL80211_AUTHTYPE_OPEN_SYSTEM: - - psecuritypriv->dot11AuthAlgrthm = dot11AuthAlgrthm_Open; - - if(psecuritypriv->ndisauthtype>Ndis802_11AuthModeWPA) - psecuritypriv->dot11AuthAlgrthm = dot11AuthAlgrthm_8021X; - -#ifdef CONFIG_WAPI_SUPPORT - if(psecuritypriv->ndisauthtype == Ndis802_11AuthModeWAPI) - psecuritypriv->dot11AuthAlgrthm = dot11AuthAlgrthm_WAPI; -#endif - - break; - case NL80211_AUTHTYPE_SHARED_KEY: - - psecuritypriv->dot11AuthAlgrthm = dot11AuthAlgrthm_Shared; - - psecuritypriv->ndisencryptstatus = Ndis802_11Encryption1Enabled; - - - break; - default: - psecuritypriv->dot11AuthAlgrthm = dot11AuthAlgrthm_Open; - //return -ENOTSUPP; - } - - return 0; - -} - -static int rtw_cfg80211_set_cipher(struct security_priv *psecuritypriv, u32 cipher, bool ucast) -{ - u32 ndisencryptstatus = Ndis802_11EncryptionDisabled; - - u32 *profile_cipher = ucast ? &psecuritypriv->dot11PrivacyAlgrthm : - &psecuritypriv->dot118021XGrpPrivacy; - - DBG_8192C("%s, ucast=%d, cipher=0x%x\n", __func__, ucast, cipher); - - - if (!cipher) { - *profile_cipher = _NO_PRIVACY_; - psecuritypriv->ndisencryptstatus = ndisencryptstatus; - return 0; - } - - switch (cipher) { - case IW_AUTH_CIPHER_NONE: - *profile_cipher = _NO_PRIVACY_; - ndisencryptstatus = Ndis802_11EncryptionDisabled; -#ifdef CONFIG_WAPI_SUPPORT - if(psecuritypriv->dot11PrivacyAlgrthm ==_SMS4_ ) - { - *profile_cipher = _SMS4_; - } -#endif - break; - case WLAN_CIPHER_SUITE_WEP40: - *profile_cipher = _WEP40_; - ndisencryptstatus = Ndis802_11Encryption1Enabled; - break; - case WLAN_CIPHER_SUITE_WEP104: - *profile_cipher = _WEP104_; - ndisencryptstatus = Ndis802_11Encryption1Enabled; - break; - case WLAN_CIPHER_SUITE_TKIP: - *profile_cipher = _TKIP_; - ndisencryptstatus = Ndis802_11Encryption2Enabled; - break; - case WLAN_CIPHER_SUITE_CCMP: - *profile_cipher = _AES_; - ndisencryptstatus = Ndis802_11Encryption3Enabled; - break; -#ifdef CONFIG_WAPI_SUPPORT - case WLAN_CIPHER_SUITE_SMS4: - *profile_cipher = _SMS4_; - ndisencryptstatus = Ndis802_11_EncrypteionWAPI; - break; -#endif - default: - DBG_8192C("Unsupported cipher: 0x%x\n", cipher); - return -ENOTSUPP; - } - - if(ucast) - { - psecuritypriv->ndisencryptstatus = ndisencryptstatus; - - //if(psecuritypriv->dot11PrivacyAlgrthm >= _AES_) - // psecuritypriv->ndisauthtype = Ndis802_11AuthModeWPA2PSK; - } - - return 0; -} - -static int rtw_cfg80211_set_key_mgt(struct security_priv *psecuritypriv, u32 key_mgt) -{ - DBG_8192C("%s, key_mgt=0x%x\n", __func__, key_mgt); - - if (key_mgt == WLAN_AKM_SUITE_8021X) - //*auth_type = UMAC_AUTH_TYPE_8021X; - psecuritypriv->dot11AuthAlgrthm = dot11AuthAlgrthm_8021X; - else if (key_mgt == WLAN_AKM_SUITE_PSK) { - psecuritypriv->dot11AuthAlgrthm = dot11AuthAlgrthm_8021X; - } -#ifdef CONFIG_WAPI_SUPPORT - else if(key_mgt ==WLAN_AKM_SUITE_WAPI_PSK){ - psecuritypriv->dot11AuthAlgrthm = dot11AuthAlgrthm_WAPI; - } - else if(key_mgt ==WLAN_AKM_SUITE_WAPI_CERT){ - psecuritypriv->dot11AuthAlgrthm = dot11AuthAlgrthm_WAPI; - } -#endif - - - else { - DBG_8192C("Invalid key mgt: 0x%x\n", key_mgt); - //return -EINVAL; - } - - return 0; -} - -static int rtw_cfg80211_set_wpa_ie(struct adapter *padapter, u8 *pie, size_t ielen) -{ - u8 *buf=NULL, *pos=NULL; - u32 left; - int group_cipher = 0, pairwise_cipher = 0; - int ret = 0; - int wpa_ielen=0; - int wpa2_ielen=0; - u8 *pwpa, *pwpa2; - u8 null_addr[]= {0,0,0,0,0,0}; - - if (pie == NULL || !ielen) { - /* Treat this as normal case, but need to clear WIFI_UNDER_WPS */ - _clr_fwstate_(&padapter->mlmepriv, WIFI_UNDER_WPS); - goto exit; - } - - if (ielen > MAX_WPA_IE_LEN+MAX_WPS_IE_LEN+MAX_P2P_IE_LEN) { - ret = -EINVAL; - goto exit; - } - - buf = rtw_zmalloc(ielen); - if (buf == NULL){ - ret = -ENOMEM; - goto exit; - } - - _rtw_memcpy(buf, pie , ielen); - - //dump - { - int i; - DBG_8192C("set wpa_ie(length:%zu):\n", ielen); - for(i=0;i0) - { - if(rtw_parse_wpa_ie(pwpa, wpa_ielen+2, &group_cipher, &pairwise_cipher, NULL) == _SUCCESS) - { - padapter->securitypriv.dot11AuthAlgrthm= dot11AuthAlgrthm_8021X; - padapter->securitypriv.ndisauthtype=Ndis802_11AuthModeWPAPSK; - _rtw_memcpy(padapter->securitypriv.supplicant_ie, &pwpa[0], wpa_ielen+2); - - DBG_8192C("got wpa_ie, wpa_ielen:%u\n", wpa_ielen); - } - } - - pwpa2 = rtw_get_wpa2_ie(buf, &wpa2_ielen, ielen); - if(pwpa2 && wpa2_ielen>0) - { - if(rtw_parse_wpa2_ie(pwpa2, wpa2_ielen+2, &group_cipher, &pairwise_cipher, NULL) == _SUCCESS) - { - padapter->securitypriv.dot11AuthAlgrthm= dot11AuthAlgrthm_8021X; - padapter->securitypriv.ndisauthtype=Ndis802_11AuthModeWPA2PSK; - _rtw_memcpy(padapter->securitypriv.supplicant_ie, &pwpa2[0], wpa2_ielen+2); - - DBG_8192C("got wpa2_ie, wpa2_ielen:%u\n", wpa2_ielen); - } - } - - if (group_cipher == 0) - { - group_cipher = WPA_CIPHER_NONE; - } - if (pairwise_cipher == 0) - { - pairwise_cipher = WPA_CIPHER_NONE; - } - - switch(group_cipher) - { - case WPA_CIPHER_NONE: - padapter->securitypriv.dot118021XGrpPrivacy=_NO_PRIVACY_; - padapter->securitypriv.ndisencryptstatus=Ndis802_11EncryptionDisabled; - break; - case WPA_CIPHER_WEP40: - padapter->securitypriv.dot118021XGrpPrivacy=_WEP40_; - padapter->securitypriv.ndisencryptstatus = Ndis802_11Encryption1Enabled; - break; - case WPA_CIPHER_TKIP: - padapter->securitypriv.dot118021XGrpPrivacy=_TKIP_; - padapter->securitypriv.ndisencryptstatus = Ndis802_11Encryption2Enabled; - break; - case WPA_CIPHER_CCMP: - padapter->securitypriv.dot118021XGrpPrivacy=_AES_; - padapter->securitypriv.ndisencryptstatus = Ndis802_11Encryption3Enabled; - break; - case WPA_CIPHER_WEP104: - padapter->securitypriv.dot118021XGrpPrivacy=_WEP104_; - padapter->securitypriv.ndisencryptstatus = Ndis802_11Encryption1Enabled; - break; - } - - switch(pairwise_cipher) - { - case WPA_CIPHER_NONE: - padapter->securitypriv.dot11PrivacyAlgrthm=_NO_PRIVACY_; - padapter->securitypriv.ndisencryptstatus=Ndis802_11EncryptionDisabled; - break; - case WPA_CIPHER_WEP40: - padapter->securitypriv.dot11PrivacyAlgrthm=_WEP40_; - padapter->securitypriv.ndisencryptstatus = Ndis802_11Encryption1Enabled; - break; - case WPA_CIPHER_TKIP: - padapter->securitypriv.dot11PrivacyAlgrthm=_TKIP_; - padapter->securitypriv.ndisencryptstatus = Ndis802_11Encryption2Enabled; - break; - case WPA_CIPHER_CCMP: - padapter->securitypriv.dot11PrivacyAlgrthm=_AES_; - padapter->securitypriv.ndisencryptstatus = Ndis802_11Encryption3Enabled; - break; - case WPA_CIPHER_WEP104: - padapter->securitypriv.dot11PrivacyAlgrthm=_WEP104_; - padapter->securitypriv.ndisencryptstatus = Ndis802_11Encryption1Enabled; - break; - } - - {/* handle wps_ie */ - uint wps_ielen; - u8 *wps_ie; - - wps_ie = rtw_get_wps_ie(buf, ielen, NULL, &wps_ielen); - if (wps_ie && wps_ielen > 0) { - DBG_8192C("got wps_ie, wps_ielen:%u\n", wps_ielen); - padapter->securitypriv.wps_ie_len = wps_ielensecuritypriv.wps_ie, wps_ie, padapter->securitypriv.wps_ie_len); - set_fwstate(&padapter->mlmepriv, WIFI_UNDER_WPS); - } else { - _clr_fwstate_(&padapter->mlmepriv, WIFI_UNDER_WPS); - } - } - - #ifdef CONFIG_P2P - {//check p2p_ie for assoc req; - uint p2p_ielen=0; - u8 *p2p_ie; - struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); - - if((p2p_ie=rtw_get_p2p_ie(buf, ielen, NULL, &p2p_ielen))) - { - #ifdef CONFIG_DEBUG_CFG80211 - DBG_8192C("%s p2p_assoc_req_ielen=%d\n", __FUNCTION__, p2p_ielen); - #endif - - if(pmlmepriv->p2p_assoc_req_ie) - { - u32 free_len = pmlmepriv->p2p_assoc_req_ie_len; - pmlmepriv->p2p_assoc_req_ie_len = 0; - rtw_mfree(pmlmepriv->p2p_assoc_req_ie, free_len); - pmlmepriv->p2p_assoc_req_ie = NULL; - } - - pmlmepriv->p2p_assoc_req_ie = rtw_malloc(p2p_ielen); - if ( pmlmepriv->p2p_assoc_req_ie == NULL) { - DBG_8192C("%s()-%d: rtw_malloc() ERROR!\n", __FUNCTION__, __LINE__); - goto exit; - } - _rtw_memcpy(pmlmepriv->p2p_assoc_req_ie, p2p_ie, p2p_ielen); - pmlmepriv->p2p_assoc_req_ie_len = p2p_ielen; - } - } - #endif //CONFIG_P2P - - #ifdef CONFIG_WFD - {//check wfd_ie for assoc req; - uint wfd_ielen=0; - u8 *wfd_ie; - struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); - - if(rtw_get_wfd_ie(buf, ielen, NULL, &wfd_ielen)) - { - #ifdef CONFIG_DEBUG_CFG80211 - DBG_8192C("%s wfd_assoc_req_ielen=%d\n", __FUNCTION__, wfd_ielen); - #endif - - if(pmlmepriv->wfd_assoc_req_ie) - { - u32 free_len = pmlmepriv->wfd_assoc_req_ie_len; - pmlmepriv->wfd_assoc_req_ie_len = 0; - rtw_mfree(pmlmepriv->wfd_assoc_req_ie, free_len); - pmlmepriv->wfd_assoc_req_ie = NULL; - } - - pmlmepriv->wfd_assoc_req_ie = rtw_malloc(wfd_ielen); - if ( pmlmepriv->wfd_assoc_req_ie == NULL) { - DBG_8192C("%s()-%d: rtw_malloc() ERROR!\n", __FUNCTION__, __LINE__); - goto exit; - } - rtw_get_wfd_ie(buf, ielen, pmlmepriv->wfd_assoc_req_ie, &pmlmepriv->wfd_assoc_req_ie_len); - } - } - #endif //CONFIG_WFD - - //TKIP and AES disallow multicast packets until installing group key - if(padapter->securitypriv.dot11PrivacyAlgrthm == _TKIP_ - || padapter->securitypriv.dot11PrivacyAlgrthm == _TKIP_WTMIC_ - || padapter->securitypriv.dot11PrivacyAlgrthm == _AES_) - //WPS open need to enable multicast - //|| check_fwstate(&padapter->mlmepriv, WIFI_UNDER_WPS) == _TRUE) - rtw_hal_set_hwreg(padapter, HW_VAR_OFF_RCR_AM, null_addr); - - RT_TRACE(_module_rtl871x_ioctl_os_c, _drv_info_, - ("rtw_set_wpa_ie: pairwise_cipher=0x%08x padapter->securitypriv.ndisencryptstatus=%d padapter->securitypriv.ndisauthtype=%d\n", - pairwise_cipher, padapter->securitypriv.ndisencryptstatus, padapter->securitypriv.ndisauthtype)); - -exit: - if (buf) - rtw_mfree(buf, ielen); - if (ret) - _clr_fwstate_(&padapter->mlmepriv, WIFI_UNDER_WPS); - return ret; -} - -static int cfg80211_rtw_join_ibss(struct wiphy *wiphy, struct net_device *ndev, - struct cfg80211_ibss_params *params) -{ - struct adapter *padapter = wiphy_to_adapter(wiphy); - NDIS_802_11_SSID ndis_ssid; - struct security_priv *psecuritypriv = &padapter->securitypriv; - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - int ret=0; - - if(_FAIL == rtw_pwr_wakeup(padapter)) { - ret= -EPERM; - goto exit; - } - - if(check_fwstate(pmlmepriv, WIFI_AP_STATE)) { - ret = -EPERM; - goto exit; - } - -#ifdef CONFIG_CONCURRENT_MODE - if (check_buddy_fwstate(padapter, _FW_UNDER_LINKING) == _TRUE) { - DBG_8192C("%s, but buddy_intf is under linking\n", __FUNCTION__); - ret = -EINVAL; - goto exit; - } - if (check_buddy_fwstate(padapter, _FW_UNDER_SURVEY) == _TRUE) { - rtw_scan_abort(padapter->pbuddy_adapter); - } -#endif //CONFIG_CONCURRENT_MODE - - if (!params->ssid || !params->ssid_len) - { - ret = -EINVAL; - goto exit; - } - - if (params->ssid_len > IW_ESSID_MAX_SIZE){ - - ret= -E2BIG; - goto exit; - } - - _rtw_memset(&ndis_ssid, 0, sizeof(NDIS_802_11_SSID)); - ndis_ssid.SsidLength = params->ssid_len; - _rtw_memcpy(ndis_ssid.Ssid, params->ssid, params->ssid_len); - - //DBG_8192C("ssid=%s, len=%zu\n", ndis_ssid.Ssid, params->ssid_len); - - psecuritypriv->ndisencryptstatus = Ndis802_11EncryptionDisabled; - psecuritypriv->dot11PrivacyAlgrthm = _NO_PRIVACY_; - psecuritypriv->dot118021XGrpPrivacy = _NO_PRIVACY_; - psecuritypriv->dot11AuthAlgrthm = dot11AuthAlgrthm_Open; //open system - psecuritypriv->ndisauthtype = Ndis802_11AuthModeOpen; - - ret = rtw_cfg80211_set_auth_type(psecuritypriv, NL80211_AUTHTYPE_OPEN_SYSTEM); - rtw_set_802_11_authentication_mode(padapter, psecuritypriv->ndisauthtype); - - if (rtw_set_802_11_ssid(padapter, &ndis_ssid) == _FALSE) - { - ret = -1; - goto exit; - } - -exit: - return ret; -} - -static int cfg80211_rtw_leave_ibss(struct wiphy *wiphy, struct net_device *ndev) -{ -#if 0 - struct iwm_priv *iwm = wiphy_to_iwm(wiphy); - - if (iwm->umac_profile_active) - return iwm_invalidate_mlme_profile(iwm); -#endif - DBG_871X(FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(ndev)); - return 0; -} - -static int cfg80211_rtw_connect(struct wiphy *wiphy, struct net_device *ndev, - struct cfg80211_connect_params *sme) -{ - int ret=0; - _irqL irqL; - _list *phead; - struct wlan_network *pnetwork = NULL; - NDIS_802_11_AUTHENTICATION_MODE authmode; - NDIS_802_11_SSID ndis_ssid; - u8 *dst_ssid, *src_ssid; - u8 *dst_bssid, *src_bssid; - //u8 matched_by_bssid=_FALSE; - //u8 matched_by_ssid=_FALSE; - u8 matched=_FALSE; - struct adapter *padapter = wiphy_to_adapter(wiphy); - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - struct security_priv *psecuritypriv = &padapter->securitypriv; - _queue *queue = &pmlmepriv->scanned_queue; - - padapter->mlmepriv.not_indic_disco = _TRUE; - - DBG_871X("=>"FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(ndev)); - DBG_871X("privacy=%d, key=%p, key_len=%d, key_idx=%d\n", - sme->privacy, sme->key, sme->key_len, sme->key_idx); - - - if(wdev_to_priv(padapter->rtw_wdev)->block == _TRUE) - { - ret = -EBUSY; - DBG_871X("%s wdev_priv.block is set\n", __FUNCTION__); - goto exit; - } - -#ifdef CONFIG_PLATFORM_MSTAR - printk("MStar Android!\n"); - if((wdev_to_priv(padapter->rtw_wdev))->bandroid_scan == _FALSE) - { -#ifdef CONFIG_P2P - struct wifidirect_info *pwdinfo= &(padapter->wdinfo); - if(rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) -#endif //CONFIG_P2P - { - ret = -EBUSY; - printk("Android hasn't attached yet!\n"); - goto exit; - } - } -#endif - - if(_FAIL == rtw_pwr_wakeup(padapter)) { - ret= -EPERM; - goto exit; - } - - if(check_fwstate(pmlmepriv, WIFI_AP_STATE)) { - ret = -EPERM; - goto exit; - } - -#ifdef CONFIG_CONCURRENT_MODE - if (check_buddy_fwstate(padapter, _FW_UNDER_LINKING) == _TRUE) { - DBG_8192C("%s, but buddy_intf is under linking\n", __FUNCTION__); - ret = -EINVAL; - goto exit; - } - if (check_buddy_fwstate(padapter, _FW_UNDER_SURVEY) == _TRUE) { - rtw_scan_abort(padapter->pbuddy_adapter); - } -#endif - - if (!sme->ssid || !sme->ssid_len) - { - ret = -EINVAL; - goto exit; - } - - if (sme->ssid_len > IW_ESSID_MAX_SIZE){ - - ret= -E2BIG; - goto exit; - } - - _rtw_memset(&ndis_ssid, 0, sizeof(NDIS_802_11_SSID)); - ndis_ssid.SsidLength = sme->ssid_len; - _rtw_memcpy(ndis_ssid.Ssid, sme->ssid, sme->ssid_len); - - DBG_8192C("ssid=%s, len=%zu\n", ndis_ssid.Ssid, sme->ssid_len); - - - if (sme->bssid) - DBG_8192C("bssid="MAC_FMT"\n", MAC_ARG(sme->bssid)); - - - if (check_fwstate(pmlmepriv, _FW_UNDER_LINKING) == _TRUE) { - ret = -EBUSY; - DBG_8192C("%s, fw_state=0x%x, goto exit\n", __FUNCTION__, pmlmepriv->fw_state); - goto exit; - } - if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY) == _TRUE) { - rtw_scan_abort(padapter); - } - - psecuritypriv->ndisencryptstatus = Ndis802_11EncryptionDisabled; - psecuritypriv->dot11PrivacyAlgrthm = _NO_PRIVACY_; - psecuritypriv->dot118021XGrpPrivacy = _NO_PRIVACY_; - psecuritypriv->dot11AuthAlgrthm = dot11AuthAlgrthm_Open; //open system - psecuritypriv->ndisauthtype = Ndis802_11AuthModeOpen; - -#ifdef CONFIG_WAPI_SUPPORT - padapter->wapiInfo.bWapiEnable = false; -#endif - - ret = rtw_cfg80211_set_wpa_version(psecuritypriv, sme->crypto.wpa_versions); - if (ret < 0) - goto exit; - -#ifdef CONFIG_WAPI_SUPPORT - if(sme->crypto.wpa_versions & NL80211_WAPI_VERSION_1) - { - padapter->wapiInfo.bWapiEnable = true; - padapter->wapiInfo.extra_prefix_len = WAPI_EXT_LEN; - padapter->wapiInfo.extra_postfix_len = SMS4_MIC_LEN; - } -#endif - - ret = rtw_cfg80211_set_auth_type(psecuritypriv, sme->auth_type); - -#ifdef CONFIG_WAPI_SUPPORT - if(psecuritypriv->dot11AuthAlgrthm == dot11AuthAlgrthm_WAPI) - padapter->mlmeextpriv.mlmext_info.auth_algo = psecuritypriv->dot11AuthAlgrthm; -#endif - - - if (ret < 0) - goto exit; - - DBG_8192C("%s, ie_len=%zu\n", __func__, sme->ie_len); - - ret = rtw_cfg80211_set_wpa_ie(padapter, sme->ie, sme->ie_len); - if (ret < 0) - goto exit; - - if (sme->crypto.n_ciphers_pairwise) { - ret = rtw_cfg80211_set_cipher(psecuritypriv, sme->crypto.ciphers_pairwise[0], _TRUE); - if (ret < 0) - goto exit; - } - - //For WEP Shared auth - if((psecuritypriv->dot11AuthAlgrthm == dot11AuthAlgrthm_Shared - || psecuritypriv->dot11AuthAlgrthm == dot11AuthAlgrthm_Auto) && sme->key - ) - { - u32 wep_key_idx, wep_key_len,wep_total_len; - NDIS_802_11_WEP *pwep = NULL; - DBG_871X("%s(): Shared/Auto WEP\n",__FUNCTION__); - - wep_key_idx = sme->key_idx; - wep_key_len = sme->key_len; - - if (sme->key_idx > WEP_KEYS) { - ret = -EINVAL; - goto exit; - } - - if (wep_key_len > 0) - { - wep_key_len = wep_key_len <= 5 ? 5 : 13; - wep_total_len = wep_key_len + FIELD_OFFSET(NDIS_802_11_WEP, KeyMaterial); - pwep =(NDIS_802_11_WEP *) rtw_malloc(wep_total_len); - if(pwep == NULL){ - DBG_871X(" wpa_set_encryption: pwep allocate fail !!!\n"); - ret = -ENOMEM; - goto exit; - } - - _rtw_memset(pwep, 0, wep_total_len); - - pwep->KeyLength = wep_key_len; - pwep->Length = wep_total_len; - - if(wep_key_len==13) - { - padapter->securitypriv.dot11PrivacyAlgrthm=_WEP104_; - padapter->securitypriv.dot118021XGrpPrivacy=_WEP104_; - } - } - else { - ret = -EINVAL; - goto exit; - } - - pwep->KeyIndex = wep_key_idx; - pwep->KeyIndex |= 0x80000000; - - _rtw_memcpy(pwep->KeyMaterial, (void *)sme->key, pwep->KeyLength); - - if(rtw_set_802_11_add_wep(padapter, pwep) == (u8)_FAIL) - { - ret = -EOPNOTSUPP ; - } - - if (pwep) { - rtw_mfree((u8 *)pwep,wep_total_len); - } - - if(ret < 0) - goto exit; - } - - ret = rtw_cfg80211_set_cipher(psecuritypriv, sme->crypto.cipher_group, _FALSE); - if (ret < 0) - return ret; - - if (sme->crypto.n_akm_suites) { - ret = rtw_cfg80211_set_key_mgt(psecuritypriv, sme->crypto.akm_suites[0]); - if (ret < 0) - goto exit; - } - -#ifdef CONFIG_WAPI_SUPPORT - if(sme->crypto.akm_suites[0] ==WLAN_AKM_SUITE_WAPI_PSK){ - padapter->wapiInfo.bWapiPSK = true; - } - else if(sme->crypto.akm_suites[0] ==WLAN_AKM_SUITE_WAPI_CERT){ - padapter->wapiInfo.bWapiPSK = false; - } -#endif - - authmode = psecuritypriv->ndisauthtype; - rtw_set_802_11_authentication_mode(padapter, authmode); - - //rtw_set_802_11_encryption_mode(padapter, padapter->securitypriv.ndisencryptstatus); - - if (rtw_set_802_11_connect(padapter, sme->bssid, &ndis_ssid) == _FALSE) { - ret = -1; - goto exit; - } - - DBG_8192C("set ssid:dot11AuthAlgrthm=%d, dot11PrivacyAlgrthm=%d, dot118021XGrpPrivacy=%d\n", psecuritypriv->dot11AuthAlgrthm, psecuritypriv->dot11PrivacyAlgrthm, psecuritypriv->dot118021XGrpPrivacy); - -exit: - - DBG_8192C("<=%s, ret %d\n",__FUNCTION__, ret); - - padapter->mlmepriv.not_indic_disco = _FALSE; - - return ret; -} - -static int cfg80211_rtw_disconnect(struct wiphy *wiphy, struct net_device *ndev, - u16 reason_code) -{ - struct adapter *padapter = wiphy_to_adapter(wiphy); - - DBG_871X(FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(ndev)); - - padapter->mlmepriv.not_indic_disco = _TRUE; - - rtw_set_roaming(padapter, 0); - - if(check_fwstate(&padapter->mlmepriv, _FW_LINKED)) - { - rtw_scan_abort(padapter); - LeaveAllPowerSaveMode(padapter); - rtw_disassoc_cmd(padapter, 500, _FALSE); - - DBG_871X("%s...call rtw_indicate_disconnect\n", __FUNCTION__); - - rtw_indicate_disconnect(padapter); - - rtw_free_assoc_resources(padapter, 1); - } - - padapter->mlmepriv.not_indic_disco = _FALSE; - - return 0; -} - -static int cfg80211_rtw_set_txpower(struct wiphy *wiphy, -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0)) - struct wireless_dev *wdev, -#endif -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36)) || defined(COMPAT_KERNEL_RELEASE) - enum nl80211_tx_power_setting type, int mbm) -#else - enum tx_power_setting type, int dbm) -#endif -{ -#if 0 - struct iwm_priv *iwm = wiphy_to_iwm(wiphy); - int ret; - - switch (type) { - case NL80211_TX_POWER_AUTOMATIC: - return 0; - case NL80211_TX_POWER_FIXED: - if (mbm < 0 || (mbm % 100)) - return -EOPNOTSUPP; - - if (!test_bit(IWM_STATUS_READY, &iwm->status)) - return 0; - - ret = iwm_umac_set_config_fix(iwm, UMAC_PARAM_TBL_CFG_FIX, - CFG_TX_PWR_LIMIT_USR, - MBM_TO_DBM(mbm) * 2); - if (ret < 0) - return ret; - - return iwm_tx_power_trigger(iwm); - default: - IWM_ERR(iwm, "Unsupported power type: %d\n", type); - return -EOPNOTSUPP; - } -#endif - DBG_8192C("%s\n", __func__); - return 0; -} - -static int cfg80211_rtw_get_txpower(struct wiphy *wiphy, -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0)) - struct wireless_dev *wdev, -#endif - int *dbm) -{ - //struct adapter *padapter = wiphy_to_adapter(wiphy); - - DBG_8192C("%s\n", __func__); - - *dbm = (12); - - return 0; -} - -inline bool rtw_cfg80211_pwr_mgmt(struct adapter *adapter) -{ - struct rtw_wdev_priv *rtw_wdev_priv = wdev_to_priv(adapter->rtw_wdev); - return rtw_wdev_priv->power_mgmt; -} - -static int cfg80211_rtw_set_power_mgmt(struct wiphy *wiphy, - struct net_device *ndev, - bool enabled, int timeout) -{ - struct adapter *padapter = wiphy_to_adapter(wiphy); - struct rtw_wdev_priv *rtw_wdev_priv = wdev_to_priv(padapter->rtw_wdev); - - DBG_871X(FUNC_NDEV_FMT" enabled:%u, timeout:%d\n", FUNC_NDEV_ARG(ndev), - enabled, timeout); - - rtw_wdev_priv->power_mgmt = enabled; - - #ifdef CONFIG_LPS - if (!enabled) - LPS_Leave(padapter); - #endif - - return 0; -} - -static int cfg80211_rtw_set_pmksa(struct wiphy *wiphy, - struct net_device *netdev, - struct cfg80211_pmksa *pmksa) -{ - u8 index,blInserted = _FALSE; - struct adapter *padapter = wiphy_to_adapter(wiphy); - struct security_priv *psecuritypriv = &padapter->securitypriv; - u8 strZeroMacAddress[ ETH_ALEN ] = { 0x00 }; - - DBG_871X(FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(netdev)); - - if ( _rtw_memcmp( pmksa->bssid, strZeroMacAddress, ETH_ALEN ) == _TRUE ) - { - return -EINVAL; - } - - blInserted = _FALSE; - - //overwrite PMKID - for(index=0 ; indexPMKIDList[index].Bssid, pmksa->bssid, ETH_ALEN) ==_TRUE ) - { // BSSID is matched, the same AP => rewrite with new PMKID. - DBG_871X(FUNC_NDEV_FMT" BSSID exists in the PMKList.\n", FUNC_NDEV_ARG(netdev)); - - _rtw_memcpy( psecuritypriv->PMKIDList[index].PMKID, pmksa->pmkid, WLAN_PMKID_LEN); - psecuritypriv->PMKIDList[index].bUsed = _TRUE; - psecuritypriv->PMKIDIndex = index+1; - blInserted = _TRUE; - break; - } - } - - if(!blInserted) - { - // Find a new entry - DBG_871X(FUNC_NDEV_FMT" Use the new entry index = %d for this PMKID.\n", - FUNC_NDEV_ARG(netdev), psecuritypriv->PMKIDIndex ); - - _rtw_memcpy(psecuritypriv->PMKIDList[psecuritypriv->PMKIDIndex].Bssid, pmksa->bssid, ETH_ALEN); - _rtw_memcpy(psecuritypriv->PMKIDList[psecuritypriv->PMKIDIndex].PMKID, pmksa->pmkid, WLAN_PMKID_LEN); - - psecuritypriv->PMKIDList[psecuritypriv->PMKIDIndex].bUsed = _TRUE; - psecuritypriv->PMKIDIndex++ ; - if(psecuritypriv->PMKIDIndex==16) - { - psecuritypriv->PMKIDIndex =0; - } - } - - return 0; -} - -static int cfg80211_rtw_del_pmksa(struct wiphy *wiphy, - struct net_device *netdev, - struct cfg80211_pmksa *pmksa) -{ - u8 index, bMatched = _FALSE; - struct adapter *padapter = wiphy_to_adapter(wiphy); - struct security_priv *psecuritypriv = &padapter->securitypriv; - - DBG_871X(FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(netdev)); - - for(index=0 ; indexPMKIDList[index].Bssid, pmksa->bssid, ETH_ALEN) ==_TRUE ) - { // BSSID is matched, the same AP => Remove this PMKID information and reset it. - _rtw_memset( psecuritypriv->PMKIDList[index].Bssid, 0x00, ETH_ALEN ); - _rtw_memset( psecuritypriv->PMKIDList[index].PMKID, 0x00, WLAN_PMKID_LEN ); - psecuritypriv->PMKIDList[index].bUsed = _FALSE; - bMatched = _TRUE; - break; - } - } - - if(_FALSE == bMatched) - { - DBG_871X(FUNC_NDEV_FMT" do not have matched BSSID\n" - , FUNC_NDEV_ARG(netdev)); - return -EINVAL; - } - - return 0; -} - -static int cfg80211_rtw_flush_pmksa(struct wiphy *wiphy, - struct net_device *netdev) -{ - struct adapter *padapter = wiphy_to_adapter(wiphy); - struct security_priv *psecuritypriv = &padapter->securitypriv; - - DBG_871X(FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(netdev)); - - _rtw_memset( &psecuritypriv->PMKIDList[ 0 ], 0x00, sizeof( RT_PMKID_LIST ) * NUM_PMKID_CACHE ); - psecuritypriv->PMKIDIndex = 0; - - return 0; -} - -#ifdef CONFIG_AP_MODE -void rtw_cfg80211_indicate_sta_assoc(struct adapter *padapter, u8 *pmgmt_frame, uint frame_len) -{ - s32 freq; - int channel; - struct wireless_dev *pwdev = padapter->rtw_wdev; - struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); - struct net_device *ndev = padapter->pnetdev; - - DBG_871X(FUNC_ADPT_FMT"\n", FUNC_ADPT_ARG(padapter)); - -#if defined(RTW_USE_CFG80211_STA_EVENT) || defined(COMPAT_KERNEL_RELEASE) - { - struct station_info sinfo; - u8 ie_offset; - if (GetFrameSubType(pmgmt_frame) == WIFI_ASSOCREQ) - ie_offset = _ASOCREQ_IE_OFFSET_; - else // WIFI_REASSOCREQ - ie_offset = _REASOCREQ_IE_OFFSET_; - - sinfo.filled = 0; - sinfo.filled = STATION_INFO_ASSOC_REQ_IES; - sinfo.assoc_req_ies = pmgmt_frame + WLAN_HDR_A3_LEN + ie_offset; - sinfo.assoc_req_ies_len = frame_len - WLAN_HDR_A3_LEN - ie_offset; - cfg80211_new_sta(ndev, GetAddr2Ptr(pmgmt_frame), &sinfo, GFP_ATOMIC); - } -#else /* defined(RTW_USE_CFG80211_STA_EVENT) */ - channel = pmlmeext->cur_channel; - if (channel <= RTW_CH_MAX_2G_CHANNEL) - freq = rtw_ieee80211_channel_to_frequency(channel, IEEE80211_BAND_2GHZ); - else - freq = rtw_ieee80211_channel_to_frequency(channel, IEEE80211_BAND_5GHZ); - - #ifdef COMPAT_KERNEL_RELEASE - rtw_cfg80211_rx_mgmt(padapter, freq, 0, pmgmt_frame, frame_len, GFP_ATOMIC); - #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) && !defined(CONFIG_CFG80211_FORCE_COMPATIBLE_2_6_37_UNDER) - rtw_cfg80211_rx_mgmt(padapter, freq, 0, pmgmt_frame, frame_len, GFP_ATOMIC); - #else //COMPAT_KERNEL_RELEASE - { - //to avoid WARN_ON(wdev->iftype != NL80211_IFTYPE_STATION) when calling cfg80211_send_rx_assoc() - #ifndef CONFIG_PLATFORM_MSTAR - pwdev->iftype = NL80211_IFTYPE_STATION; - #endif //CONFIG_PLATFORM_MSTAR - DBG_8192C("iftype=%d before call cfg80211_send_rx_assoc()\n", pwdev->iftype); - rtw_cfg80211_send_rx_assoc(padapter, NULL, pmgmt_frame, frame_len); - DBG_8192C("iftype=%d after call cfg80211_send_rx_assoc()\n", pwdev->iftype); - pwdev->iftype = NL80211_IFTYPE_AP; - //cfg80211_rx_action(padapter->pnetdev, freq, pmgmt_frame, frame_len, GFP_ATOMIC); - } - #endif //COMPAT_KERNEL_RELEASE -#endif /* defined(RTW_USE_CFG80211_STA_EVENT) */ - -} - -void rtw_cfg80211_indicate_sta_disassoc(struct adapter *padapter, unsigned char *da, unsigned short reason) -{ - s32 freq; - int channel; - u8 *pmgmt_frame; - uint frame_len; - struct rtw_ieee80211_hdr *pwlanhdr; - unsigned short *fctrl; - u8 mgmt_buf[128] = {0}; - struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); - struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); - struct net_device *ndev = padapter->pnetdev; - - DBG_871X(FUNC_ADPT_FMT"\n", FUNC_ADPT_ARG(padapter)); - -#if defined(RTW_USE_CFG80211_STA_EVENT) || defined(COMPAT_KERNEL_RELEASE) - cfg80211_del_sta(ndev, da, GFP_ATOMIC); -#else /* defined(RTW_USE_CFG80211_STA_EVENT) */ - channel = pmlmeext->cur_channel; - if (channel <= RTW_CH_MAX_2G_CHANNEL) - freq = rtw_ieee80211_channel_to_frequency(channel, IEEE80211_BAND_2GHZ); - else - freq = rtw_ieee80211_channel_to_frequency(channel, IEEE80211_BAND_5GHZ); - - pmgmt_frame = mgmt_buf; - pwlanhdr = (struct rtw_ieee80211_hdr *)pmgmt_frame; - - fctrl = &(pwlanhdr->frame_ctl); - *(fctrl) = 0; - - //_rtw_memcpy(pwlanhdr->addr1, da, ETH_ALEN); - //_rtw_memcpy(pwlanhdr->addr2, myid(&(padapter->eeprompriv)), ETH_ALEN); - _rtw_memcpy(pwlanhdr->addr1, myid(&(padapter->eeprompriv)), ETH_ALEN); - _rtw_memcpy(pwlanhdr->addr2, da, ETH_ALEN); - _rtw_memcpy(pwlanhdr->addr3, get_my_bssid(&(pmlmeinfo->network)), ETH_ALEN); - - SetSeqNum(pwlanhdr, pmlmeext->mgnt_seq); - pmlmeext->mgnt_seq++; - SetFrameSubType(pmgmt_frame, WIFI_DEAUTH); - - pmgmt_frame += sizeof(struct rtw_ieee80211_hdr_3addr); - frame_len = sizeof(struct rtw_ieee80211_hdr_3addr); - - reason = cpu_to_le16(reason); - pmgmt_frame = rtw_set_fixed_ie(pmgmt_frame, _RSON_CODE_ , (unsigned char *)&reason, &frame_len); - - #ifdef COMPAT_KERNEL_RELEASE - rtw_cfg80211_rx_mgmt(padapter, freq, 0, mgmt_buf, frame_len, GFP_ATOMIC); - #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) && !defined(CONFIG_CFG80211_FORCE_COMPATIBLE_2_6_37_UNDER) - rtw_cfg80211_rx_mgmt(padapter, freq, 0, mgmt_buf, frame_len, GFP_ATOMIC); - #else //COMPAT_KERNEL_RELEASE - cfg80211_send_disassoc(padapter->pnetdev, mgmt_buf, frame_len); - //cfg80211_rx_action(padapter->pnetdev, freq, mgmt_buf, frame_len, GFP_ATOMIC); - #endif //COMPAT_KERNEL_RELEASE -#endif /* defined(RTW_USE_CFG80211_STA_EVENT) */ -} - -static int rtw_cfg80211_monitor_if_open(struct net_device *ndev) -{ - int ret = 0; - - DBG_8192C("%s\n", __func__); - - return ret; -} - -static int rtw_cfg80211_monitor_if_close(struct net_device *ndev) -{ - int ret = 0; - - DBG_8192C("%s\n", __func__); - - return ret; -} - -static int rtw_cfg80211_monitor_if_xmit_entry(struct sk_buff *skb, struct net_device *ndev) -{ - int ret = 0; - int rtap_len; - int qos_len = 0; - int dot11_hdr_len = 24; - int snap_len = 6; - unsigned char *pdata; - u16 frame_ctl; - unsigned char src_mac_addr[6]; - unsigned char dst_mac_addr[6]; - struct ieee80211_hdr *dot11_hdr; - struct ieee80211_radiotap_header *rtap_hdr; - struct adapter *padapter = (struct adapter *)rtw_netdev_priv(ndev); - - DBG_871X(FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(ndev)); - - if (skb) - rtw_mstat_update(MSTAT_TYPE_SKB, MSTAT_ALLOC_SUCCESS, skb->truesize); - - if (unlikely(skb->len < sizeof(struct ieee80211_radiotap_header))) - goto fail; - - rtap_hdr = (struct ieee80211_radiotap_header *)skb->data; - if (unlikely(rtap_hdr->it_version)) - goto fail; - - rtap_len = ieee80211_get_radiotap_len(skb->data); - if (unlikely(skb->len < rtap_len)) - goto fail; - - if(rtap_len != 14) - { - DBG_8192C("radiotap len (should be 14): %d\n", rtap_len); - goto fail; - } - - /* Skip the ratio tap header */ - skb_pull(skb, rtap_len); - - dot11_hdr = (struct ieee80211_hdr *)skb->data; - frame_ctl = le16_to_cpu(dot11_hdr->frame_control); - /* Check if the QoS bit is set */ - if ((frame_ctl & RTW_IEEE80211_FCTL_FTYPE) == RTW_IEEE80211_FTYPE_DATA) { - /* Check if this ia a Wireless Distribution System (WDS) frame - * which has 4 MAC addresses - */ - if (dot11_hdr->frame_control & 0x0080) - qos_len = 2; - if ((dot11_hdr->frame_control & 0x0300) == 0x0300) - dot11_hdr_len += 6; - - memcpy(dst_mac_addr, dot11_hdr->addr1, sizeof(dst_mac_addr)); - memcpy(src_mac_addr, dot11_hdr->addr2, sizeof(src_mac_addr)); - - /* Skip the 802.11 header, QoS (if any) and SNAP, but leave spaces for - * for two MAC addresses - */ - skb_pull(skb, dot11_hdr_len + qos_len + snap_len - sizeof(src_mac_addr) * 2); - pdata = (unsigned char*)skb->data; - memcpy(pdata, dst_mac_addr, sizeof(dst_mac_addr)); - memcpy(pdata + sizeof(dst_mac_addr), src_mac_addr, sizeof(src_mac_addr)); - - DBG_8192C("should be eapol packet\n"); - - /* Use the real net device to transmit the packet */ - ret = _rtw_xmit_entry(skb, padapter->pnetdev); - - return ret; - - } - else if ((frame_ctl & (RTW_IEEE80211_FCTL_FTYPE|RTW_IEEE80211_FCTL_STYPE)) - == (RTW_IEEE80211_FTYPE_MGMT|RTW_IEEE80211_STYPE_ACTION) - ) - { - //only for action frames - struct xmit_frame *pmgntframe; - struct pkt_attrib *pattrib; - unsigned char *pframe; - //u8 category, action, OUI_Subtype, dialogToken=0; - //unsigned char *frame_body; - struct rtw_ieee80211_hdr *pwlanhdr; - struct xmit_priv *pxmitpriv = &(padapter->xmitpriv); - struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); - u8 *buf = skb->data; - u32 len = skb->len; - u8 category, action; - int type = -1; - - if (rtw_action_frame_parse(buf, len, &category, &action) == _FALSE) { - DBG_8192C(FUNC_NDEV_FMT" frame_control:0x%x\n", FUNC_NDEV_ARG(ndev), - le16_to_cpu(((struct rtw_ieee80211_hdr_3addr *)buf)->frame_ctl)); - goto fail; - } - - DBG_8192C("RTW_Tx:da="MAC_FMT" via "FUNC_NDEV_FMT"\n", - MAC_ARG(GetAddr1Ptr(buf)), FUNC_NDEV_ARG(ndev)); - #ifdef CONFIG_P2P - if((type = rtw_p2p_check_frames(padapter, buf, len, _TRUE)) >= 0) - goto dump; - #endif - if (category == RTW_WLAN_CATEGORY_PUBLIC) - DBG_871X("RTW_Tx:%s\n", action_public_str(action)); - else - DBG_871X("RTW_Tx:category(%u), action(%u)\n", category, action); - -dump: - //starting alloc mgmt frame to dump it - if ((pmgntframe = alloc_mgtxmitframe(pxmitpriv)) == NULL) - { - goto fail; - } - - //update attribute - pattrib = &pmgntframe->attrib; - update_mgntframe_attrib(padapter, pattrib); - pattrib->retry_ctrl = _FALSE; - - _rtw_memset(pmgntframe->buf_addr, 0, WLANHDR_OFFSET + TXDESC_OFFSET); - - pframe = (u8 *)(pmgntframe->buf_addr) + TXDESC_OFFSET; - - _rtw_memcpy(pframe, (void*)buf, len); - #ifdef CONFIG_WFD - if (type >= 0) - { - struct wifi_display_info *pwfd_info; - - pwfd_info = padapter->wdinfo.wfd_info; - - if ( _TRUE == pwfd_info->wfd_enable ) - { - rtw_append_wfd_ie( padapter, pframe, &len ); - } - } - #endif // CONFIG_WFD - pattrib->pktlen = len; - - pwlanhdr = (struct rtw_ieee80211_hdr *)pframe; - //update seq number - pmlmeext->mgnt_seq = GetSequence(pwlanhdr); - pattrib->seqnum = pmlmeext->mgnt_seq; - pmlmeext->mgnt_seq++; - - - pattrib->last_txcmdsz = pattrib->pktlen; - - dump_mgntframe(padapter, pmgntframe); - - } - else - { - DBG_8192C("frame_ctl=0x%x\n", frame_ctl & (RTW_IEEE80211_FCTL_FTYPE|RTW_IEEE80211_FCTL_STYPE)); - } - - -fail: - - dev_kfree_skb(skb); - - return 0; - -} - -static void rtw_cfg80211_monitor_if_set_multicast_list(struct net_device *ndev) -{ - DBG_8192C("%s\n", __func__); -} - -static int rtw_cfg80211_monitor_if_set_mac_address(struct net_device *ndev, void *addr) -{ - int ret = 0; - - DBG_8192C("%s\n", __func__); - - return ret; -} - -#if (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,29)) -static const struct net_device_ops rtw_cfg80211_monitor_if_ops = { - .ndo_open = rtw_cfg80211_monitor_if_open, - .ndo_stop = rtw_cfg80211_monitor_if_close, - .ndo_start_xmit = rtw_cfg80211_monitor_if_xmit_entry, - #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,2,0)) - .ndo_set_multicast_list = rtw_cfg80211_monitor_if_set_multicast_list, - #endif - .ndo_set_mac_address = rtw_cfg80211_monitor_if_set_mac_address, -}; -#endif - -static int rtw_cfg80211_add_monitor_if(struct adapter *padapter, char *name, struct net_device **ndev) -{ - int ret = 0; - struct net_device* mon_ndev = NULL; - struct wireless_dev* mon_wdev = NULL; - struct rtw_netdev_priv_indicator *pnpi; - struct rtw_wdev_priv *pwdev_priv = wdev_to_priv(padapter->rtw_wdev); - - if (!name ) { - DBG_871X(FUNC_ADPT_FMT" without specific name\n", FUNC_ADPT_ARG(padapter)); - ret = -EINVAL; - goto out; - } - - if (pwdev_priv->pmon_ndev) { - DBG_871X(FUNC_ADPT_FMT" monitor interface exist: "NDEV_FMT"\n", - FUNC_ADPT_ARG(padapter), NDEV_ARG(pwdev_priv->pmon_ndev)); - ret = -EBUSY; - goto out; - } - - mon_ndev = alloc_etherdev(sizeof(struct rtw_netdev_priv_indicator)); - if (!mon_ndev) { - DBG_871X(FUNC_ADPT_FMT" allocate ndev fail\n", FUNC_ADPT_ARG(padapter)); - ret = -ENOMEM; - goto out; - } - - mon_ndev->type = ARPHRD_IEEE80211_RADIOTAP; - strncpy(mon_ndev->name, name, IFNAMSIZ); - mon_ndev->name[IFNAMSIZ - 1] = 0; - mon_ndev->destructor = rtw_ndev_destructor; - -#if (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,29)) - mon_ndev->netdev_ops = &rtw_cfg80211_monitor_if_ops; -#else - mon_ndev->open = rtw_cfg80211_monitor_if_open; - mon_ndev->stop = rtw_cfg80211_monitor_if_close; - mon_ndev->hard_start_xmit = rtw_cfg80211_monitor_if_xmit_entry; - mon_ndev->set_mac_address = rtw_cfg80211_monitor_if_set_mac_address; -#endif - - pnpi = netdev_priv(mon_ndev); - pnpi->priv = padapter; - pnpi->sizeof_priv = sizeof(struct adapter); - - /* wdev */ - mon_wdev = (struct wireless_dev *)rtw_zmalloc(sizeof(struct wireless_dev)); - if (!mon_wdev) { - DBG_871X(FUNC_ADPT_FMT" allocate mon_wdev fail\n", FUNC_ADPT_ARG(padapter)); - ret = -ENOMEM; - goto out; - } - - mon_wdev->wiphy = padapter->rtw_wdev->wiphy; - mon_wdev->netdev = mon_ndev; - mon_wdev->iftype = NL80211_IFTYPE_MONITOR; - mon_ndev->ieee80211_ptr = mon_wdev; - - ret = register_netdevice(mon_ndev); - if (ret) { - goto out; - } - - *ndev = pwdev_priv->pmon_ndev = mon_ndev; - _rtw_memcpy(pwdev_priv->ifname_mon, name, IFNAMSIZ+1); - -out: - if (ret && mon_wdev) { - rtw_mfree((u8*)mon_wdev, sizeof(struct wireless_dev)); - mon_wdev = NULL; - } - - if (ret && mon_ndev) { - free_netdev(mon_ndev); - *ndev = mon_ndev = NULL; - } - - return ret; -} - -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0)) -static struct wireless_dev * -#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) || defined(COMPAT_KERNEL_RELEASE) -static struct net_device * -#else -static int -#endif - cfg80211_rtw_add_virtual_intf( - struct wiphy *wiphy, - #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0)) - const char *name, - #else - char *name, - #endif - enum nl80211_iftype type, u32 *flags, struct vif_params *params) -{ - int ret = 0; - struct net_device* ndev = NULL; - struct adapter *padapter = wiphy_to_adapter(wiphy); - - DBG_871X(FUNC_ADPT_FMT " wiphy:%s, name:%s, type:%d\n", - FUNC_ADPT_ARG(padapter), wiphy_name(wiphy), name, type); - - switch (type) { - case NL80211_IFTYPE_ADHOC: - case NL80211_IFTYPE_AP_VLAN: - case NL80211_IFTYPE_WDS: - case NL80211_IFTYPE_MESH_POINT: - ret = -ENODEV; - break; - case NL80211_IFTYPE_MONITOR: - ret = rtw_cfg80211_add_monitor_if(padapter, (char *)name, &ndev); - break; - -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE) - case NL80211_IFTYPE_P2P_CLIENT: -#endif - case NL80211_IFTYPE_STATION: - ret = -ENODEV; - break; - -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE) - case NL80211_IFTYPE_P2P_GO: -#endif - case NL80211_IFTYPE_AP: - ret = -ENODEV; - break; - default: - ret = -ENODEV; - DBG_871X("Unsupported interface type\n"); - break; - } - - DBG_871X(FUNC_ADPT_FMT" ndev:%p, ret:%d\n", FUNC_ADPT_ARG(padapter), ndev, ret); - -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0)) - return ndev ? ndev->ieee80211_ptr : ERR_PTR(ret); -#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) || defined(COMPAT_KERNEL_RELEASE) - return ndev ? ndev : ERR_PTR(ret); -#else - return ret; -#endif -} - -static int cfg80211_rtw_del_virtual_intf(struct wiphy *wiphy, -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0)) - struct wireless_dev *wdev -#else - struct net_device *ndev -#endif -) -{ - struct rtw_wdev_priv *pwdev_priv = (struct rtw_wdev_priv *)wiphy_priv(wiphy); -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0)) - struct net_device *ndev; - ndev = wdev ? wdev->netdev : NULL; -#endif - - if (!ndev) - goto exit; - - unregister_netdevice(ndev); - - if (ndev == pwdev_priv->pmon_ndev) { - pwdev_priv->pmon_ndev = NULL; - pwdev_priv->ifname_mon[0] = '\0'; - DBG_871X(FUNC_NDEV_FMT" remove monitor interface\n", FUNC_NDEV_ARG(ndev)); - } - -exit: - return 0; -} - -static int rtw_add_beacon(struct adapter *adapter, const u8 *head, size_t head_len, const u8 *tail, size_t tail_len) -{ - int ret=0; - u8 *pbuf = NULL; - uint len, wps_ielen=0; - uint p2p_ielen=0; - u8 *p2p_ie; - u8 got_p2p_ie = _FALSE; - struct mlme_priv *pmlmepriv = &(adapter->mlmepriv); - //struct sta_priv *pstapriv = &padapter->stapriv; - - - DBG_8192C("%s beacon_head_len=%zu, beacon_tail_len=%zu\n", __FUNCTION__, head_len, tail_len); - - - if(check_fwstate(pmlmepriv, WIFI_AP_STATE) != _TRUE) - return -EINVAL; - - if(head_len<24) - return -EINVAL; - - - pbuf = rtw_zmalloc(head_len+tail_len); - if(!pbuf) - return -ENOMEM; - - - //_rtw_memcpy(&pstapriv->max_num_sta, param->u.bcn_ie.reserved, 2); - - //if((pstapriv->max_num_sta>NUM_STA) || (pstapriv->max_num_sta<=0)) - // pstapriv->max_num_sta = NUM_STA; - - - _rtw_memcpy(pbuf, (void *)head+24, head_len-24);// 24=beacon header len. - _rtw_memcpy(pbuf+head_len-24, (void *)tail, tail_len); - - len = head_len+tail_len-24; - - //check wps ie if inclued - if(rtw_get_wps_ie(pbuf+_FIXED_IE_LENGTH_, len-_FIXED_IE_LENGTH_, NULL, &wps_ielen)) - DBG_8192C("add bcn, wps_ielen=%d\n", wps_ielen); - -#ifdef CONFIG_P2P - //check p2p ie if inclued - if( adapter->wdinfo.driver_interface == DRIVER_CFG80211 ) - { - //check p2p if enable - if(rtw_get_p2p_ie(pbuf+_FIXED_IE_LENGTH_, len-_FIXED_IE_LENGTH_, NULL, &p2p_ielen)) - { - struct mlme_ext_priv *pmlmeext = &adapter->mlmeextpriv; - struct wifidirect_info *pwdinfo= &(adapter->wdinfo); - - DBG_8192C("got p2p_ie, len=%d\n", p2p_ielen); - got_p2p_ie = _TRUE; - - if(rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) - { - DBG_8192C("Enable P2P function for the first time\n"); - rtw_p2p_enable(adapter, P2P_ROLE_GO); - wdev_to_priv(adapter->rtw_wdev)->p2p_enabled = _TRUE; - } - else - { - DBG_8192C("enter GO Mode, p2p_ielen=%d\n", p2p_ielen); - - rtw_p2p_set_role(pwdinfo, P2P_ROLE_GO); - rtw_p2p_set_state(pwdinfo, P2P_STATE_GONEGO_OK); - pwdinfo->intent = 15; - } - } - } -#endif // CONFIG_P2P - - /* pbss_network->IEs will not include p2p_ie, wfd ie */ - rtw_ies_remove_ie(pbuf, &len, _BEACON_IE_OFFSET_, _VENDOR_SPECIFIC_IE_, P2P_OUI, 4); - rtw_ies_remove_ie(pbuf, &len, _BEACON_IE_OFFSET_, _VENDOR_SPECIFIC_IE_, WFD_OUI, 4); - - if (rtw_check_beacon_data(adapter, pbuf, len) == _SUCCESS) - { -#ifdef CONFIG_P2P - //check p2p if enable - if(got_p2p_ie == _TRUE) - { - struct mlme_ext_priv *pmlmeext = &adapter->mlmeextpriv; - struct wifidirect_info *pwdinfo= &(adapter->wdinfo); - pwdinfo->operating_channel = pmlmeext->cur_channel; - } -#endif //CONFIG_P2P - ret = 0; - } - else - { - ret = -EINVAL; - } - - - rtw_mfree(pbuf, head_len+tail_len); - - return ret; -} - -#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) && !defined(COMPAT_KERNEL_RELEASE) -static int cfg80211_rtw_add_beacon(struct wiphy *wiphy, struct net_device *ndev, - struct beacon_parameters *info) -{ - int ret=0; - struct adapter *adapter = wiphy_to_adapter(wiphy); - - DBG_871X(FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(ndev)); - ret = rtw_add_beacon(adapter, info->head, info->head_len, info->tail, info->tail_len); - - return ret; -} - -static int cfg80211_rtw_set_beacon(struct wiphy *wiphy, struct net_device *ndev, - struct beacon_parameters *info) -{ - struct adapter *padapter = wiphy_to_adapter(wiphy); - struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); - - DBG_871X(FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(ndev)); - - pmlmeext->bstart_bss = _TRUE; - - cfg80211_rtw_add_beacon(wiphy, ndev, info); - - return 0; -} - -static int cfg80211_rtw_del_beacon(struct wiphy *wiphy, struct net_device *ndev) -{ - DBG_871X(FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(ndev)); - - return 0; -} -#else -static int cfg80211_rtw_start_ap(struct wiphy *wiphy, struct net_device *ndev, - struct cfg80211_ap_settings *settings) -{ - int ret = 0; - struct adapter *adapter = wiphy_to_adapter(wiphy); - - DBG_871X(FUNC_NDEV_FMT" hidden_ssid:%d, auth_type:%d\n", FUNC_NDEV_ARG(ndev), - settings->hidden_ssid, settings->auth_type); - - ret = rtw_add_beacon(adapter, settings->beacon.head, settings->beacon.head_len, - settings->beacon.tail, settings->beacon.tail_len); - - adapter->mlmeextpriv.mlmext_info.hidden_ssid_mode = settings->hidden_ssid; - - if (settings->ssid && settings->ssid_len) { - WLAN_BSSID_EX *pbss_network = &adapter->mlmepriv.cur_network.network; - WLAN_BSSID_EX *pbss_network_ext = &adapter->mlmeextpriv.mlmext_info.network; - - if(0) - DBG_871X(FUNC_ADPT_FMT" ssid:(%s,%d), from ie:(%s,%d)\n", FUNC_ADPT_ARG(adapter), - settings->ssid, settings->ssid_len, - pbss_network->Ssid.Ssid, pbss_network->Ssid.SsidLength); - - _rtw_memcpy(pbss_network->Ssid.Ssid, (void *)settings->ssid, settings->ssid_len); - pbss_network->Ssid.SsidLength = settings->ssid_len; - _rtw_memcpy(pbss_network_ext->Ssid.Ssid, (void *)settings->ssid, settings->ssid_len); - pbss_network_ext->Ssid.SsidLength = settings->ssid_len; - - if(0) - DBG_871X(FUNC_ADPT_FMT" after ssid:(%s,%d), (%s,%d)\n", FUNC_ADPT_ARG(adapter), - pbss_network->Ssid.Ssid, pbss_network->Ssid.SsidLength, - pbss_network_ext->Ssid.Ssid, pbss_network_ext->Ssid.SsidLength); - } - - return ret; -} - -static int cfg80211_rtw_change_beacon(struct wiphy *wiphy, struct net_device *ndev, - struct cfg80211_beacon_data *info) -{ - int ret = 0; - struct adapter *adapter = wiphy_to_adapter(wiphy); - - DBG_871X(FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(ndev)); - - ret = rtw_add_beacon(adapter, info->head, info->head_len, info->tail, info->tail_len); - - return ret; -} - -static int cfg80211_rtw_stop_ap(struct wiphy *wiphy, struct net_device *ndev) -{ - DBG_871X(FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(ndev)); - return 0; -} - -#endif //(LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) - -static int cfg80211_rtw_add_station(struct wiphy *wiphy, struct net_device *ndev, - u8 *mac, struct station_parameters *params) -{ - DBG_871X(FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(ndev)); - - return 0; -} - -static int cfg80211_rtw_del_station(struct wiphy *wiphy, struct net_device *ndev, - u8 *mac) -{ - int ret=0; - _irqL irqL; - _list *phead, *plist; - u8 updated; - struct sta_info *psta = NULL; - struct adapter *padapter = (struct adapter *)rtw_netdev_priv(ndev); - struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); - struct sta_priv *pstapriv = &padapter->stapriv; - - DBG_871X("+"FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(ndev)); - - if(check_fwstate(pmlmepriv, (_FW_LINKED|WIFI_AP_STATE)) != _TRUE) - { - DBG_8192C("%s, fw_state != FW_LINKED|WIFI_AP_STATE\n", __func__); - return -EINVAL; - } - - - if(!mac) - { - DBG_8192C("flush all sta, and cam_entry\n"); - - flush_all_cam_entry(padapter); //clear CAM - - ret = rtw_sta_flush(padapter); - - return ret; - } - - - DBG_8192C("free sta macaddr =" MAC_FMT "\n", MAC_ARG(mac)); - - if (mac[0] == 0xff && mac[1] == 0xff && - mac[2] == 0xff && mac[3] == 0xff && - mac[4] == 0xff && mac[5] == 0xff) - { - return -EINVAL; - } - - - _enter_critical_bh(&pstapriv->asoc_list_lock, &irqL); - - phead = &pstapriv->asoc_list; - plist = get_next(phead); - - //check asoc_queue - while ((rtw_end_of_queue_search(phead, plist)) == _FALSE) - { - psta = LIST_CONTAINOR(plist, struct sta_info, asoc_list); - - plist = get_next(plist); - - if(_rtw_memcmp(mac, psta->hwaddr, ETH_ALEN)) - { - if(psta->dot8021xalg == 1 && psta->bpairwise_key_installed == _FALSE) - { - DBG_8192C("%s, sta's dot8021xalg = 1 and key_installed = _FALSE\n", __func__); - } - else - { - DBG_8192C("free psta=%p, aid=%d\n", psta, psta->aid); - - rtw_list_delete(&psta->asoc_list); - pstapriv->asoc_list_cnt--; - - //_exit_critical_bh(&pstapriv->asoc_list_lock, &irqL); - updated = ap_free_sta(padapter, psta, _TRUE, WLAN_REASON_DEAUTH_LEAVING); - //_enter_critical_bh(&pstapriv->asoc_list_lock, &irqL); - - psta = NULL; - - break; - } - - } - - } - - _exit_critical_bh(&pstapriv->asoc_list_lock, &irqL); - - associated_clients_update(padapter, updated); - - DBG_871X("-"FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(ndev)); - - return ret; - -} - -static int cfg80211_rtw_change_station(struct wiphy *wiphy, struct net_device *ndev, - u8 *mac, struct station_parameters *params) -{ - DBG_871X(FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(ndev)); - - return 0; -} - -static int cfg80211_rtw_dump_station(struct wiphy *wiphy, struct net_device *ndev, - int idx, u8 *mac, struct station_info *sinfo) -{ - DBG_871X(FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(ndev)); - - //TODO: dump scanned queue - - return -ENOENT; -} - -static int cfg80211_rtw_change_bss(struct wiphy *wiphy, struct net_device *ndev, - struct bss_parameters *params) -{ - u8 i; - - DBG_871X(FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(ndev)); -/* - DBG_8192C("use_cts_prot=%d\n", params->use_cts_prot); - DBG_8192C("use_short_preamble=%d\n", params->use_short_preamble); - DBG_8192C("use_short_slot_time=%d\n", params->use_short_slot_time); - DBG_8192C("ap_isolate=%d\n", params->ap_isolate); - - DBG_8192C("basic_rates_len=%d\n", params->basic_rates_len); - for(i=0; ibasic_rates_len; i++) - { - DBG_8192C("basic_rates=%d\n", params->basic_rates[i]); - - } -*/ - return 0; - -} - -static int cfg80211_rtw_set_channel(struct wiphy *wiphy - #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35)) - , struct net_device *ndev - #endif - , struct ieee80211_channel *chan, enum nl80211_channel_type channel_type) -{ - #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35)) - DBG_871X(FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(ndev)); - #endif - - return 0; -} - -static int cfg80211_rtw_auth(struct wiphy *wiphy, struct net_device *ndev, - struct cfg80211_auth_request *req) -{ - DBG_871X(FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(ndev)); - - return 0; -} - -static int cfg80211_rtw_assoc(struct wiphy *wiphy, struct net_device *ndev, - struct cfg80211_assoc_request *req) -{ - DBG_871X(FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(ndev)); - - return 0; -} -#endif //CONFIG_AP_MODE - -void rtw_cfg80211_rx_action_p2p(struct adapter *padapter, u8 *pmgmt_frame, uint frame_len) -{ - int type; - s32 freq; - int channel; - struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); - u8 category, action; - - channel = rtw_get_oper_ch(padapter); - - DBG_8192C("RTW_Rx:cur_ch=%d\n", channel); - #ifdef CONFIG_P2P - type = rtw_p2p_check_frames(padapter, pmgmt_frame, frame_len, _FALSE); - if (type >= 0) - goto indicate; - #endif - rtw_action_frame_parse(pmgmt_frame, frame_len, &category, &action); - DBG_871X("RTW_Rx:category(%u), action(%u)\n", category, action); - -indicate: - if (channel <= RTW_CH_MAX_2G_CHANNEL) - freq = rtw_ieee80211_channel_to_frequency(channel, IEEE80211_BAND_2GHZ); - else - freq = rtw_ieee80211_channel_to_frequency(channel, IEEE80211_BAND_5GHZ); - -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE) - rtw_cfg80211_rx_mgmt(padapter, freq, 0, pmgmt_frame, frame_len, GFP_ATOMIC); -#else - cfg80211_rx_action(padapter->pnetdev, freq, pmgmt_frame, frame_len, GFP_ATOMIC); -#endif -} - -void rtw_cfg80211_rx_p2p_action_public(struct adapter *padapter, u8 *pmgmt_frame, uint frame_len) -{ - int type; - s32 freq; - int channel; - struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); - u8 category, action; - - channel = rtw_get_oper_ch(padapter); - - DBG_8192C("RTW_Rx:cur_ch=%d\n", channel); - #ifdef CONFIG_P2P - type = rtw_p2p_check_frames(padapter, pmgmt_frame, frame_len, _FALSE); - if (type >= 0) { - switch (type) { - case P2P_GO_NEGO_CONF: - case P2P_PROVISION_DISC_RESP: - case P2P_INVIT_RESP: - rtw_set_scan_deny(padapter, 2000); - rtw_clear_scan_deny(padapter); - } - goto indicate; - } - #endif - rtw_action_frame_parse(pmgmt_frame, frame_len, &category, &action); - DBG_871X("RTW_Rx:category(%u), action(%u)\n", category, action); - -indicate: - if (channel <= RTW_CH_MAX_2G_CHANNEL) - freq = rtw_ieee80211_channel_to_frequency(channel, IEEE80211_BAND_2GHZ); - else - freq = rtw_ieee80211_channel_to_frequency(channel, IEEE80211_BAND_5GHZ); - -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE) - rtw_cfg80211_rx_mgmt(padapter, freq, 0, pmgmt_frame, frame_len, GFP_ATOMIC); -#else - cfg80211_rx_action(padapter->pnetdev, freq, pmgmt_frame, frame_len, GFP_ATOMIC); -#endif -} - -void rtw_cfg80211_rx_action(struct adapter *adapter, u8 *frame, uint frame_len, const char*msg) -{ - s32 freq; - int channel; - struct mlme_ext_priv *pmlmeext = &(adapter->mlmeextpriv); - struct rtw_wdev_priv *pwdev_priv = wdev_to_priv(adapter->rtw_wdev); - u8 category, action; - - channel = rtw_get_oper_ch(adapter); - - rtw_action_frame_parse(frame, frame_len, &category, &action); - - DBG_8192C("RTW_Rx:cur_ch=%d\n", channel); - if (msg) - DBG_871X("RTW_Rx:%s\n", msg); - else - DBG_871X("RTW_Rx:category(%u), action(%u)\n", category, action); - - if (channel <= RTW_CH_MAX_2G_CHANNEL) - freq = rtw_ieee80211_channel_to_frequency(channel, IEEE80211_BAND_2GHZ); - else - freq = rtw_ieee80211_channel_to_frequency(channel, IEEE80211_BAND_5GHZ); - -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE) - rtw_cfg80211_rx_mgmt(adapter, freq, 0, frame, frame_len, GFP_ATOMIC); -#else - cfg80211_rx_action(adapter->pnetdev, freq, frame, frame_len, GFP_ATOMIC); -#endif - -} - -#ifdef CONFIG_P2P -void rtw_cfg80211_issue_p2p_provision_request(struct adapter *padapter, const u8 *buf, size_t len) -{ - u16 wps_devicepassword_id = 0x0000; - uint wps_devicepassword_id_len = 0; - u8 wpsie[ 255 ] = { 0x00 }, p2p_ie[ 255 ] = { 0x00 }; - uint p2p_ielen = 0; - uint wpsielen = 0; - u32 devinfo_contentlen = 0; - u8 devinfo_content[64] = { 0x00 }; - u16 capability = 0; - uint capability_len = 0; - - unsigned char category = RTW_WLAN_CATEGORY_PUBLIC; - u8 action = P2P_PUB_ACTION_ACTION; - u8 dialogToken = 1; - u32 p2poui = cpu_to_be32(P2POUI); - u8 oui_subtype = P2P_PROVISION_DISC_REQ; - u32 p2pielen = 0; -#ifdef CONFIG_WFD - u32 wfdielen = 0; -#endif //CONFIG_WFD - - struct xmit_frame *pmgntframe; - struct pkt_attrib *pattrib; - unsigned char *pframe; - struct rtw_ieee80211_hdr *pwlanhdr; - unsigned short *fctrl; - struct xmit_priv *pxmitpriv = &(padapter->xmitpriv); - struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); - struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); - - struct wifidirect_info *pwdinfo = &(padapter->wdinfo); - u8 *frame_body = (unsigned char *)(buf + sizeof(struct rtw_ieee80211_hdr_3addr)); - size_t frame_body_len = len - sizeof(struct rtw_ieee80211_hdr_3addr); - - - DBG_871X( "[%s] In\n", __FUNCTION__ ); - - //prepare for building provision_request frame - _rtw_memcpy(pwdinfo->tx_prov_disc_info.peerIFAddr, GetAddr1Ptr(buf), ETH_ALEN); - _rtw_memcpy(pwdinfo->tx_prov_disc_info.peerDevAddr, GetAddr1Ptr(buf), ETH_ALEN); - - pwdinfo->tx_prov_disc_info.wps_config_method_request = WPS_CM_PUSH_BUTTON; - - rtw_get_wps_ie( frame_body + _PUBLIC_ACTION_IE_OFFSET_, frame_body_len - _PUBLIC_ACTION_IE_OFFSET_, wpsie, &wpsielen); - rtw_get_wps_attr_content( wpsie, wpsielen, WPS_ATTR_DEVICE_PWID, (u8*) &wps_devicepassword_id, &wps_devicepassword_id_len); - wps_devicepassword_id = be16_to_cpu( wps_devicepassword_id ); - - switch(wps_devicepassword_id) - { - case WPS_DPID_PIN: - pwdinfo->tx_prov_disc_info.wps_config_method_request = WPS_CM_LABEL; - break; - case WPS_DPID_USER_SPEC: - pwdinfo->tx_prov_disc_info.wps_config_method_request = WPS_CM_DISPLYA; - break; - case WPS_DPID_MACHINE_SPEC: - break; - case WPS_DPID_REKEY: - break; - case WPS_DPID_PBC: - pwdinfo->tx_prov_disc_info.wps_config_method_request = WPS_CM_PUSH_BUTTON; - break; - case WPS_DPID_REGISTRAR_SPEC: - pwdinfo->tx_prov_disc_info.wps_config_method_request = WPS_CM_KEYPAD; - break; - default: - break; - } - - - if ( rtw_get_p2p_ie( frame_body + _PUBLIC_ACTION_IE_OFFSET_, frame_body_len - _PUBLIC_ACTION_IE_OFFSET_, p2p_ie, &p2p_ielen ) ) - { - - rtw_get_p2p_attr_content( p2p_ie, p2p_ielen, P2P_ATTR_DEVICE_INFO, devinfo_content, &devinfo_contentlen); - rtw_get_p2p_attr_content( p2p_ie, p2p_ielen, P2P_ATTR_CAPABILITY, (u8*)&capability, &capability_len); - - } - - - //start to build provision_request frame - _rtw_memset(wpsie, 0, sizeof(wpsie)); - _rtw_memset(p2p_ie, 0, sizeof(p2p_ie)); - p2p_ielen = 0; - - if ((pmgntframe = alloc_mgtxmitframe(pxmitpriv)) == NULL) - { - return; - } - - - //update attribute - pattrib = &pmgntframe->attrib; - update_mgntframe_attrib(padapter, pattrib); - - _rtw_memset(pmgntframe->buf_addr, 0, WLANHDR_OFFSET + TXDESC_OFFSET); - - pframe = (u8 *)(pmgntframe->buf_addr) + TXDESC_OFFSET; - pwlanhdr = (struct rtw_ieee80211_hdr *)pframe; - - fctrl = &(pwlanhdr->frame_ctl); - *(fctrl) = 0; - - _rtw_memcpy(pwlanhdr->addr1, pwdinfo->tx_prov_disc_info.peerDevAddr, ETH_ALEN); - _rtw_memcpy(pwlanhdr->addr2, myid(&(padapter->eeprompriv)), ETH_ALEN); - _rtw_memcpy(pwlanhdr->addr3, pwdinfo->tx_prov_disc_info.peerDevAddr, ETH_ALEN); - - SetSeqNum(pwlanhdr, pmlmeext->mgnt_seq); - pmlmeext->mgnt_seq++; - SetFrameSubType(pframe, WIFI_ACTION); - - pframe += sizeof(struct rtw_ieee80211_hdr_3addr); - pattrib->pktlen = sizeof(struct rtw_ieee80211_hdr_3addr); - - pframe = rtw_set_fixed_ie(pframe, 1, &(category), &(pattrib->pktlen)); - pframe = rtw_set_fixed_ie(pframe, 1, &(action), &(pattrib->pktlen)); - pframe = rtw_set_fixed_ie(pframe, 4, (unsigned char *) &(p2poui), &(pattrib->pktlen)); - pframe = rtw_set_fixed_ie(pframe, 1, &(oui_subtype), &(pattrib->pktlen)); - pframe = rtw_set_fixed_ie(pframe, 1, &(dialogToken), &(pattrib->pktlen)); - - - //build_prov_disc_request_p2p_ie - // P2P OUI - p2pielen = 0; - p2p_ie[ p2pielen++ ] = 0x50; - p2p_ie[ p2pielen++ ] = 0x6F; - p2p_ie[ p2pielen++ ] = 0x9A; - p2p_ie[ p2pielen++ ] = 0x09; // WFA P2P v1.0 - - // Commented by Albert 20110301 - // According to the P2P Specification, the provision discovery request frame should contain 3 P2P attributes - // 1. P2P Capability - // 2. Device Info - // 3. Group ID ( When joining an operating P2P Group ) - - // P2P Capability ATTR - // Type: - p2p_ie[ p2pielen++ ] = P2P_ATTR_CAPABILITY; - - // Length: - //*(u16*) ( p2pie + p2pielen ) = cpu_to_le16( 0x0002 ); - RTW_PUT_LE16(p2p_ie + p2pielen, 0x0002); - p2pielen += 2; - - // Value: - // Device Capability Bitmap, 1 byte - // Group Capability Bitmap, 1 byte - _rtw_memcpy(p2p_ie + p2pielen, &capability, 2); - p2pielen += 2; - - - // Device Info ATTR - // Type: - p2p_ie[ p2pielen++ ] = P2P_ATTR_DEVICE_INFO; - - // Length: - // 21 -> P2P Device Address (6bytes) + Config Methods (2bytes) + Primary Device Type (8bytes) - // + NumofSecondDevType (1byte) + WPS Device Name ID field (2bytes) + WPS Device Name Len field (2bytes) - //*(u16*) ( p2pie + p2pielen ) = cpu_to_le16( 21 + pwdinfo->device_name_len ); - RTW_PUT_LE16(p2p_ie + p2pielen, devinfo_contentlen); - p2pielen += 2; - - // Value: - _rtw_memcpy(p2p_ie + p2pielen, devinfo_content, devinfo_contentlen); - p2pielen += devinfo_contentlen; - - - pframe = rtw_set_ie(pframe, _VENDOR_SPECIFIC_IE_, p2pielen, (unsigned char *) p2p_ie, &p2p_ielen); - //p2pielen = build_prov_disc_request_p2p_ie( pwdinfo, pframe, NULL, 0, pwdinfo->tx_prov_disc_info.peerDevAddr); - //pframe += p2pielen; - pattrib->pktlen += p2p_ielen; - - wpsielen = 0; - // WPS OUI - *(u32*) ( wpsie ) = cpu_to_be32( WPSOUI ); - wpsielen += 4; - - // WPS version - // Type: - *(u16*) ( wpsie + wpsielen ) = cpu_to_be16( WPS_ATTR_VER1 ); - wpsielen += 2; - - // Length: - *(u16*) ( wpsie + wpsielen ) = cpu_to_be16( 0x0001 ); - wpsielen += 2; - - // Value: - wpsie[wpsielen++] = WPS_VERSION_1; // Version 1.0 - - // Config Method - // Type: - *(u16*) ( wpsie + wpsielen ) = cpu_to_be16( WPS_ATTR_CONF_METHOD ); - wpsielen += 2; - - // Length: - *(u16*) ( wpsie + wpsielen ) = cpu_to_be16( 0x0002 ); - wpsielen += 2; - - // Value: - *(u16*) ( wpsie + wpsielen ) = cpu_to_be16( pwdinfo->tx_prov_disc_info.wps_config_method_request ); - wpsielen += 2; - - pframe = rtw_set_ie(pframe, _VENDOR_SPECIFIC_IE_, wpsielen, (unsigned char *) wpsie, &pattrib->pktlen ); - - -#ifdef CONFIG_WFD - wfdielen = build_provdisc_req_wfd_ie(pwdinfo, pframe); - pframe += wfdielen; - pattrib->pktlen += wfdielen; -#endif //CONFIG_WFD - - pattrib->last_txcmdsz = pattrib->pktlen; - - //dump_mgntframe(padapter, pmgntframe); - if (dump_mgntframe_and_wait_ack(padapter, pmgntframe) != _SUCCESS) - DBG_8192C("%s, ack to\n", __func__); - - //if(wps_devicepassword_id == WPS_DPID_REGISTRAR_SPEC) - //{ - // DBG_8192C("waiting for p2p peer key-in PIN CODE\n"); - // rtw_msleep_os(15000); // 15 sec for key in PIN CODE, workaround for GS2 before issuing Nego Req. - //} - -} - -static s32 cfg80211_rtw_remain_on_channel(struct wiphy *wiphy, -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0)) - struct wireless_dev *wdev, -#else - struct net_device *ndev, -#endif - struct ieee80211_channel * channel, -#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,8,0)) - enum nl80211_channel_type channel_type, -#endif - unsigned int duration, u64 *cookie) -{ - s32 err = 0; - struct adapter *padapter = wiphy_to_adapter(wiphy); - struct rtw_wdev_priv *pwdev_priv = wdev_to_priv(padapter->rtw_wdev); - struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; - struct wifidirect_info *pwdinfo = &padapter->wdinfo; - struct cfg80211_wifidirect_info *pcfg80211_wdinfo = &padapter->cfg80211_wdinfo; - u8 remain_ch = (u8) ieee80211_frequency_to_channel(channel->center_freq); - u8 ready_on_channel = _FALSE; - - DBG_871X(FUNC_ADPT_FMT" ch:%u duration:%d\n", FUNC_ADPT_ARG(padapter), remain_ch, duration); - - if(pcfg80211_wdinfo->is_ro_ch == _TRUE) - { - DBG_8192C("%s, cancel ro ch timer\n", __func__); - - _cancel_timer_ex(&padapter->cfg80211_wdinfo.remain_on_ch_timer); - -#ifdef CONFIG_CONCURRENT_MODE - ATOMIC_SET(&pwdev_priv->ro_ch_to, 1); -#endif //CONFIG_CONCURRENT_MODE - - p2p_protocol_wk_hdl(padapter, P2P_RO_CH_WK); - } - - pcfg80211_wdinfo->is_ro_ch = _TRUE; - - if(_FAIL == rtw_pwr_wakeup(padapter)) { - err = -EFAULT; - goto exit; - } - - _rtw_memcpy(&pcfg80211_wdinfo->remain_on_ch_channel, channel, sizeof(struct ieee80211_channel)); - #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,8,0)) - pcfg80211_wdinfo->remain_on_ch_type= channel_type; - #endif - pcfg80211_wdinfo->remain_on_ch_cookie= *cookie; - - rtw_scan_abort(padapter); -#ifdef CONFIG_CONCURRENT_MODE - if(rtw_buddy_adapter_up(padapter)) - rtw_scan_abort(padapter->pbuddy_adapter); -#endif //CONFIG_CONCURRENT_MODE - - //if(!rtw_p2p_chk_role(pwdinfo, P2P_ROLE_CLIENT) && !rtw_p2p_chk_role(pwdinfo, P2P_ROLE_GO)) - if(rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) - { - rtw_p2p_enable(padapter, P2P_ROLE_DEVICE); - wdev_to_priv(padapter->rtw_wdev)->p2p_enabled = _TRUE; - padapter->wdinfo.listen_channel = remain_ch; - } - else - { - rtw_p2p_set_pre_state(pwdinfo, rtw_p2p_state(pwdinfo)); -#ifdef CONFIG_DEBUG_CFG80211 - DBG_8192C("%s, role=%d, p2p_state=%d\n", __func__, rtw_p2p_role(pwdinfo), rtw_p2p_state(pwdinfo)); -#endif - } - - - rtw_p2p_set_state(pwdinfo, P2P_STATE_LISTEN); - - - if(duration < 400) - duration = duration*3;//extend from exper. - - -#ifdef CONFIG_CONCURRENT_MODE - if(check_buddy_fwstate(padapter, _FW_LINKED) && - (durationext_listen_interval)) - { - duration = duration + pwdinfo->ext_listen_interval; - } -#endif - - pcfg80211_wdinfo->restore_channel = rtw_get_oper_ch(padapter); - - if(rtw_ch_set_search_ch(pmlmeext->channel_set, remain_ch) >= 0) { -#ifdef CONFIG_CONCURRENT_MODE - if ( check_buddy_fwstate(padapter, _FW_LINKED ) ) - { - PADAPTER pbuddy_adapter = padapter->pbuddy_adapter; - struct mlme_ext_priv *pbuddy_mlmeext = &pbuddy_adapter->mlmeextpriv; - - if(remain_ch != pbuddy_mlmeext->cur_channel) - { - if(ATOMIC_READ(&pwdev_priv->switch_ch_to)==1 || - (remain_ch != pmlmeext->cur_channel)) - { - DBG_8192C("%s, issue nulldata pwrbit=1\n", __func__); - issue_nulldata(padapter->pbuddy_adapter, NULL, 1, 3, 500); - - ATOMIC_SET(&pwdev_priv->switch_ch_to, 0); - - DBG_8192C("%s, set switch ch timer, duration=%d\n", __func__, duration-pwdinfo->ext_listen_interval); - _set_timer(&pwdinfo->ap_p2p_switch_timer, duration-pwdinfo->ext_listen_interval); - } - } - - ready_on_channel = _TRUE; - //pmlmeext->cur_channel = remain_ch; - //set_channel_bwmode(padapter, remain_ch, HAL_PRIME_CHNL_OFFSET_DONT_CARE, HT_CHANNEL_WIDTH_20); - }else -#endif //CONFIG_CONCURRENT_MODE - if(remain_ch != rtw_get_oper_ch(padapter) ) - { - ready_on_channel = _TRUE; - //pmlmeext->cur_channel = remain_ch; - //set_channel_bwmode(padapter, remain_ch, HAL_PRIME_CHNL_OFFSET_DONT_CARE, HT_CHANNEL_WIDTH_20); - } - } else { - DBG_871X("%s remain_ch:%u not in channel plan!!!!\n", __FUNCTION__, remain_ch); - } - - - //call this after other things have been done -#ifdef CONFIG_CONCURRENT_MODE - if(ATOMIC_READ(&pwdev_priv->ro_ch_to)==1 || - (remain_ch != rtw_get_oper_ch(padapter))) - { - u8 co_channel = 0xff; - ATOMIC_SET(&pwdev_priv->ro_ch_to, 0); -#endif - - if(ready_on_channel == _TRUE) - { - if ( !check_fwstate(&padapter->mlmepriv, _FW_LINKED ) ) - { - pmlmeext->cur_channel = remain_ch; - - - set_channel_bwmode(padapter, remain_ch, HAL_PRIME_CHNL_OFFSET_DONT_CARE, HT_CHANNEL_WIDTH_20); - } - } - DBG_8192C("%s, set ro ch timer, duration=%d\n", __func__, duration); - _set_timer( &pcfg80211_wdinfo->remain_on_ch_timer, duration); - -#ifdef CONFIG_CONCURRENT_MODE - } -#endif - - rtw_cfg80211_ready_on_channel(padapter, *cookie, channel, channel_type, duration, GFP_KERNEL); - -exit: - if (err) - pcfg80211_wdinfo->is_ro_ch = _FALSE; - - return err; -} - -static s32 cfg80211_rtw_cancel_remain_on_channel(struct wiphy *wiphy, -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0)) - struct wireless_dev *wdev, -#else - struct net_device *ndev, -#endif - u64 cookie) -{ - s32 err = 0; - struct adapter *padapter = wiphy_to_adapter(wiphy); - struct rtw_wdev_priv *pwdev_priv = wdev_to_priv(padapter->rtw_wdev); - struct wifidirect_info *pwdinfo = &padapter->wdinfo; - struct cfg80211_wifidirect_info *pcfg80211_wdinfo = &padapter->cfg80211_wdinfo; - - DBG_871X(FUNC_ADPT_FMT"\n", FUNC_ADPT_ARG(padapter)); - - if (pcfg80211_wdinfo->is_ro_ch == _TRUE) { - DBG_8192C("%s, cancel ro ch timer\n", __func__); - _cancel_timer_ex(&padapter->cfg80211_wdinfo.remain_on_ch_timer); - #ifdef CONFIG_CONCURRENT_MODE - ATOMIC_SET(&pwdev_priv->ro_ch_to, 1); - #endif - p2p_protocol_wk_hdl(padapter, P2P_RO_CH_WK); - } - - #if 0 - // Disable P2P Listen State - if(!rtw_p2p_chk_role(pwdinfo, P2P_ROLE_CLIENT) && !rtw_p2p_chk_role(pwdinfo, P2P_ROLE_GO)) - { - if(!rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) - { - rtw_p2p_set_state(pwdinfo, P2P_STATE_NONE); - _rtw_memset(pwdinfo, 0x00, sizeof(struct wifidirect_info)); - } - } - else - #endif - { - rtw_p2p_set_state(pwdinfo, rtw_p2p_pre_state(pwdinfo)); -#ifdef CONFIG_DEBUG_CFG80211 - DBG_8192C("%s, role=%d, p2p_state=%d\n", __func__, rtw_p2p_role(pwdinfo), rtw_p2p_state(pwdinfo)); -#endif - } - pcfg80211_wdinfo->is_ro_ch = _FALSE; - - return err; -} - -#endif //CONFIG_P2P - -static int _cfg80211_rtw_mgmt_tx(struct adapter *padapter, u8 tx_ch, const u8 *buf, size_t len) -{ - struct xmit_frame *pmgntframe; - struct pkt_attrib *pattrib; - unsigned char *pframe; - int ret = _FAIL; - bool ack = _TRUE; - struct rtw_ieee80211_hdr *pwlanhdr; - struct rtw_wdev_priv *pwdev_priv = wdev_to_priv(padapter->rtw_wdev); - struct xmit_priv *pxmitpriv = &(padapter->xmitpriv); - struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); - struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); - struct wifidirect_info *pwdinfo = &padapter->wdinfo; - //struct cfg80211_wifidirect_info *pcfg80211_wdinfo = &padapter->cfg80211_wdinfo; - - if(_FAIL == rtw_pwr_wakeup(padapter)) { - ret = -EFAULT; - goto exit; - } - - rtw_set_scan_deny(padapter, 1000); - - rtw_scan_abort(padapter); - #ifdef CONFIG_CONCURRENT_MODE - if(rtw_buddy_adapter_up(padapter)) - rtw_scan_abort(padapter->pbuddy_adapter); - #endif /* CONFIG_CONCURRENT_MODE */ - - if (padapter->cfg80211_wdinfo.is_ro_ch == _TRUE) { - //DBG_8192C("%s, cancel ro ch timer\n", __func__); - //_cancel_timer_ex(&padapter->cfg80211_wdinfo.remain_on_ch_timer); - //padapter->cfg80211_wdinfo.is_ro_ch = _FALSE; - #ifdef CONFIG_CONCURRENT_MODE - if (!check_fwstate(&padapter->mlmepriv, _FW_LINKED )) - { - DBG_8192C("%s, extend ro ch time\n", __func__); - _set_timer( &padapter->cfg80211_wdinfo.remain_on_ch_timer, pwdinfo->ext_listen_period); - } - #endif //CONFIG_CONCURRENT_MODE - } - -#ifdef CONFIG_CONCURRENT_MODE - if (check_buddy_fwstate(padapter, _FW_LINKED )) { - u8 co_channel=0xff; - PADAPTER pbuddy_adapter = padapter->pbuddy_adapter; - struct mlme_ext_priv *pbuddy_mlmeext = &pbuddy_adapter->mlmeextpriv; - - co_channel = rtw_get_oper_ch(padapter); - - if (tx_ch != pbuddy_mlmeext->cur_channel) { - - u16 ext_listen_period; - - if (ATOMIC_READ(&pwdev_priv->switch_ch_to)==1) { - DBG_8192C("%s, issue nulldata pwrbit=1\n", __func__); - issue_nulldata(padapter->pbuddy_adapter, NULL, 1, 3, 500); - - ATOMIC_SET(&pwdev_priv->switch_ch_to, 0); - - //DBG_8192C("%s, set switch ch timer, period=%d\n", __func__, pwdinfo->ext_listen_period); - //_set_timer(&pwdinfo->ap_p2p_switch_timer, pwdinfo->ext_listen_period); - } - - if (check_fwstate(&padapter->mlmepriv, _FW_LINKED )) - { - ext_listen_period = 500;// 500ms - } - else - { - ext_listen_period = pwdinfo->ext_listen_period; - } - - DBG_8192C("%s, set switch ch timer, period=%d\n", __func__, ext_listen_period); - _set_timer(&pwdinfo->ap_p2p_switch_timer, ext_listen_period); - - } - - if (!check_fwstate(&padapter->mlmepriv, _FW_LINKED )) - pmlmeext->cur_channel = tx_ch; - - if (tx_ch != co_channel) - set_channel_bwmode(padapter, tx_ch, HAL_PRIME_CHNL_OFFSET_DONT_CARE, HT_CHANNEL_WIDTH_20); - }else -#endif //CONFIG_CONCURRENT_MODE - //if (tx_ch != pmlmeext->cur_channel) { - if(tx_ch != rtw_get_oper_ch(padapter)) { - if (!check_fwstate(&padapter->mlmepriv, _FW_LINKED )) - pmlmeext->cur_channel = tx_ch; - set_channel_bwmode(padapter, tx_ch, HAL_PRIME_CHNL_OFFSET_DONT_CARE, HT_CHANNEL_WIDTH_20); - } - - //starting alloc mgmt frame to dump it - if ((pmgntframe = alloc_mgtxmitframe(pxmitpriv)) == NULL) - { - //ret = -ENOMEM; - ret = _FAIL; - goto exit; - } - - //update attribute - pattrib = &pmgntframe->attrib; - update_mgntframe_attrib(padapter, pattrib); - pattrib->retry_ctrl = _FALSE; - - _rtw_memset(pmgntframe->buf_addr, 0, WLANHDR_OFFSET + TXDESC_OFFSET); - - pframe = (u8 *)(pmgntframe->buf_addr) + TXDESC_OFFSET; - - _rtw_memcpy(pframe, (void*)buf, len); - pattrib->pktlen = len; - - pwlanhdr = (struct rtw_ieee80211_hdr *)pframe; - //update seq number - pmlmeext->mgnt_seq = GetSequence(pwlanhdr); - pattrib->seqnum = pmlmeext->mgnt_seq; - pmlmeext->mgnt_seq++; - -#ifdef CONFIG_WFD - { - struct wifi_display_info *pwfd_info; - - pwfd_info = padapter->wdinfo.wfd_info; - - if ( _TRUE == pwfd_info->wfd_enable ) - { - rtw_append_wfd_ie( padapter, pframe, &pattrib->pktlen ); - } - } -#endif // CONFIG_WFD - - pattrib->last_txcmdsz = pattrib->pktlen; - - if (dump_mgntframe_and_wait_ack(padapter, pmgntframe) != _SUCCESS) - { - ack = _FALSE; - ret = _FAIL; - - #ifdef CONFIG_DEBUG_CFG80211 - DBG_8192C("%s, ack == _FAIL\n", __func__); - #endif - } - else - { - #ifdef CONFIG_DEBUG_CFG80211 - DBG_8192C("%s, ack=%d, ok!\n", __func__, ack); - #endif - ret = _SUCCESS; - } - -exit: - - #ifdef CONFIG_DEBUG_CFG80211 - DBG_8192C("%s, ret=%d\n", __func__, ret); - #endif - - return ret; - -} - -static int cfg80211_rtw_mgmt_tx(struct wiphy *wiphy, -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0)) - struct wireless_dev *wdev, -#else - struct net_device *ndev, -#endif - struct ieee80211_channel *chan, -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) || defined(COMPAT_KERNEL_RELEASE) - bool offchan, -#endif -#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,8,0)) - enum nl80211_channel_type channel_type, - #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE) - bool channel_type_valid, - #endif -#endif -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) || defined(COMPAT_KERNEL_RELEASE) - unsigned int wait, -#endif - const u8 *buf, size_t len, -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0)) - bool no_cck, -#endif -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0)) - bool dont_wait_for_ack, -#endif - u64 *cookie) -{ - struct adapter *padapter = (struct adapter *)wiphy_to_adapter(wiphy); - struct rtw_wdev_priv *pwdev_priv = wdev_to_priv(padapter->rtw_wdev); - int ret = 0; - int tx_ret; - u32 dump_limit = RTW_MAX_MGMT_TX_CNT; - u32 dump_cnt = 0; - bool ack = _TRUE; - u8 tx_ch = (u8)ieee80211_frequency_to_channel(chan->center_freq); - u8 category, action; - int type = (-1); - u32 start = rtw_get_current_time(); - - /* cookie generation */ - *cookie = (unsigned long) buf; - -#ifdef CONFIG_DEBUG_CFG80211 - DBG_871X(FUNC_ADPT_FMT" len=%zu, ch=%d" - #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,8,0)) - ", ch_type=%d" - #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE) - ", channel_type_valid=%d" - #endif - #endif - "\n", FUNC_ADPT_ARG(padapter), - len, tx_ch - #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,8,0)) - , channel_type - #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE) - , channel_type_valid - #endif - #endif - ); -#endif /* CONFIG_DEBUG_CFG80211 */ - - /* indicate ack before issue frame to avoid racing with rsp frame */ -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE) - rtw_cfg80211_mgmt_tx_status(padapter, *cookie, buf, len, ack, GFP_KERNEL); -#elif (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,34) && LINUX_VERSION_CODE<=KERNEL_VERSION(2,6,35)) - cfg80211_action_tx_status(ndev, *cookie, buf, len, ack, GFP_KERNEL); -#endif - - if (rtw_action_frame_parse(buf, len, &category, &action) == _FALSE) { - DBG_8192C(FUNC_ADPT_FMT" frame_control:0x%x\n", FUNC_ADPT_ARG(padapter), - le16_to_cpu(((struct rtw_ieee80211_hdr_3addr *)buf)->frame_ctl)); - goto exit; - } - - DBG_8192C("RTW_Tx:tx_ch=%d, da="MAC_FMT"\n", tx_ch, MAC_ARG(GetAddr1Ptr(buf))); - #ifdef CONFIG_P2P - if((type = rtw_p2p_check_frames(padapter, buf, len, _TRUE)) >= 0) { - goto dump; - } - #endif - if (category == RTW_WLAN_CATEGORY_PUBLIC) - DBG_871X("RTW_Tx:%s\n", action_public_str(action)); - else - DBG_871X("RTW_Tx:category(%u), action(%u)\n", category, action); - -dump: - do { - dump_cnt++; - tx_ret = _cfg80211_rtw_mgmt_tx(padapter, tx_ch, buf, len); - } while (dump_cnt < dump_limit && tx_ret != _SUCCESS); - - if (tx_ret != _SUCCESS || dump_cnt > 1) { - DBG_871X(FUNC_ADPT_FMT" %s (%d/%d) in %d ms\n", FUNC_ADPT_ARG(padapter), - tx_ret==_SUCCESS?"OK":"FAIL", dump_cnt, dump_limit, rtw_get_passing_time_ms(start)); - } - - switch (type) { - case P2P_GO_NEGO_CONF: - rtw_clear_scan_deny(padapter); - break; - case P2P_INVIT_RESP: - if (pwdev_priv->invit_info.flags & BIT(0) - && pwdev_priv->invit_info.status == 0) - { - DBG_871X(FUNC_ADPT_FMT" agree with invitation of persistent group\n", - FUNC_ADPT_ARG(padapter)); - rtw_set_scan_deny(padapter, 5000); - rtw_pwr_wakeup_ex(padapter, 5000); - rtw_clear_scan_deny(padapter); - } - break; - } - -exit: - return ret; -} - -static void cfg80211_rtw_mgmt_frame_register(struct wiphy *wiphy, -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0)) - struct wireless_dev *wdev, -#else - struct net_device *ndev, -#endif - u16 frame_type, bool reg) -{ - _adapter *adapter = wiphy_to_adapter(wiphy); - -#ifdef CONFIG_DEBUG_CFG80211 - DBG_871X(FUNC_ADPT_FMT" frame_type:%x, reg:%d\n", FUNC_ADPT_ARG(adapter), - frame_type, reg); -#endif - - if (frame_type != (IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_PROBE_REQ)) - return; - - return; -} - -static int rtw_cfg80211_set_beacon_wpsp2pie(struct net_device *ndev, char *buf, int len) -{ - int ret = 0; - uint wps_ielen = 0; - u8 *wps_ie; - u32 p2p_ielen = 0; - u8 wps_oui[8]={0x0,0x50,0xf2,0x04}; - u8 *p2p_ie; - u32 wfd_ielen = 0; - u8 *wfd_ie; - _adapter *padapter = (_adapter *)rtw_netdev_priv(ndev); - struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); - struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); - - DBG_871X(FUNC_NDEV_FMT" ielen=%d\n", FUNC_NDEV_ARG(ndev), len); - - if(len>0) - { - if((wps_ie = rtw_get_wps_ie(buf, len, NULL, &wps_ielen))) - { - #ifdef CONFIG_DEBUG_CFG80211 - DBG_8192C("bcn_wps_ielen=%d\n", wps_ielen); - #endif - - if(pmlmepriv->wps_beacon_ie) - { - u32 free_len = pmlmepriv->wps_beacon_ie_len; - pmlmepriv->wps_beacon_ie_len = 0; - rtw_mfree(pmlmepriv->wps_beacon_ie, free_len); - pmlmepriv->wps_beacon_ie = NULL; - } - - pmlmepriv->wps_beacon_ie = rtw_malloc(wps_ielen); - if ( pmlmepriv->wps_beacon_ie == NULL) { - DBG_8192C("%s()-%d: rtw_malloc() ERROR!\n", __FUNCTION__, __LINE__); - return -EINVAL; - - } - - _rtw_memcpy(pmlmepriv->wps_beacon_ie, wps_ie, wps_ielen); - pmlmepriv->wps_beacon_ie_len = wps_ielen; - - update_beacon(padapter, _VENDOR_SPECIFIC_IE_, wps_oui, _TRUE); - - } - - //buf += wps_ielen; - //len -= wps_ielen; - - #ifdef CONFIG_P2P - if((p2p_ie=rtw_get_p2p_ie(buf, len, NULL, &p2p_ielen))) - { - #ifdef CONFIG_DEBUG_CFG80211 - DBG_8192C("bcn_p2p_ielen=%d\n", p2p_ielen); - #endif - - if(pmlmepriv->p2p_beacon_ie) - { - u32 free_len = pmlmepriv->p2p_beacon_ie_len; - pmlmepriv->p2p_beacon_ie_len = 0; - rtw_mfree(pmlmepriv->p2p_beacon_ie, free_len); - pmlmepriv->p2p_beacon_ie = NULL; - } - - pmlmepriv->p2p_beacon_ie = rtw_malloc(p2p_ielen); - if ( pmlmepriv->p2p_beacon_ie == NULL) { - DBG_8192C("%s()-%d: rtw_malloc() ERROR!\n", __FUNCTION__, __LINE__); - return -EINVAL; - - } - - _rtw_memcpy(pmlmepriv->p2p_beacon_ie, p2p_ie, p2p_ielen); - pmlmepriv->p2p_beacon_ie_len = p2p_ielen; - - } - #endif //CONFIG_P2P - - //buf += p2p_ielen; - //len -= p2p_ielen; - - #ifdef CONFIG_WFD - if(rtw_get_wfd_ie(buf, len, NULL, &wfd_ielen)) - { - #ifdef CONFIG_DEBUG_CFG80211 - DBG_8192C("bcn_wfd_ielen=%d\n", wfd_ielen); - #endif - - if(pmlmepriv->wfd_beacon_ie) - { - u32 free_len = pmlmepriv->wfd_beacon_ie_len; - pmlmepriv->wfd_beacon_ie_len = 0; - rtw_mfree(pmlmepriv->wfd_beacon_ie, free_len); - pmlmepriv->wfd_beacon_ie = NULL; - } - - pmlmepriv->wfd_beacon_ie = rtw_malloc(wfd_ielen); - if ( pmlmepriv->wfd_beacon_ie == NULL) { - DBG_8192C("%s()-%d: rtw_malloc() ERROR!\n", __FUNCTION__, __LINE__); - return -EINVAL; - - } - rtw_get_wfd_ie(buf, len, pmlmepriv->wfd_beacon_ie, &pmlmepriv->wfd_beacon_ie_len); - } - #endif //CONFIG_WFD - - pmlmeext->bstart_bss = _TRUE; - - } - - return ret; - -} - -static int rtw_cfg80211_set_probe_resp_wpsp2pie(struct net_device *net, char *buf, int len) -{ - int ret = 0; - uint wps_ielen = 0; - u8 *wps_ie; - u32 p2p_ielen = 0; - u8 *p2p_ie; - u32 wfd_ielen = 0; - u8 *wfd_ie; - _adapter *padapter = (_adapter *)rtw_netdev_priv(net); - struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); - -#ifdef CONFIG_DEBUG_CFG80211 - DBG_8192C("%s, ielen=%d\n", __func__, len); -#endif - - if(len>0) - { - if((wps_ie = rtw_get_wps_ie(buf, len, NULL, &wps_ielen))) - { - uint attr_contentlen = 0; - u16 uconfig_method, *puconfig_method = NULL; - - #ifdef CONFIG_DEBUG_CFG80211 - DBG_8192C("probe_resp_wps_ielen=%d\n", wps_ielen); - #endif - - if(check_fwstate(pmlmepriv, WIFI_UNDER_WPS)) - { - u8 sr = 0; - rtw_get_wps_attr_content(wps_ie, wps_ielen, WPS_ATTR_SELECTED_REGISTRAR, (u8*)(&sr), NULL); - - if (sr != 0) - { - DBG_871X("%s, got sr\n", __func__); - } - else - { - DBG_8192C("GO mode process WPS under site-survey, sr no set\n"); - return ret; - } - } - - if(pmlmepriv->wps_probe_resp_ie) - { - u32 free_len = pmlmepriv->wps_probe_resp_ie_len; - pmlmepriv->wps_probe_resp_ie_len = 0; - rtw_mfree(pmlmepriv->wps_probe_resp_ie, free_len); - pmlmepriv->wps_probe_resp_ie = NULL; - } - - pmlmepriv->wps_probe_resp_ie = rtw_malloc(wps_ielen); - if ( pmlmepriv->wps_probe_resp_ie == NULL) { - DBG_8192C("%s()-%d: rtw_malloc() ERROR!\n", __FUNCTION__, __LINE__); - return -EINVAL; - - } - - //add PUSH_BUTTON config_method by driver self in wpsie of probe_resp at GO Mode - if ( (puconfig_method = (u16*)rtw_get_wps_attr_content( wps_ie, wps_ielen, WPS_ATTR_CONF_METHOD , NULL, &attr_contentlen)) != NULL ) - { - #ifdef CONFIG_DEBUG_CFG80211 - //printk("config_method in wpsie of probe_resp = 0x%x\n", be16_to_cpu(*puconfig_method)); - #endif - - uconfig_method = WPS_CM_PUSH_BUTTON; - uconfig_method = cpu_to_be16( uconfig_method ); - - *puconfig_method |= uconfig_method; - } - - _rtw_memcpy(pmlmepriv->wps_probe_resp_ie, wps_ie, wps_ielen); - pmlmepriv->wps_probe_resp_ie_len = wps_ielen; - - } - - //buf += wps_ielen; - //len -= wps_ielen; - - #ifdef CONFIG_P2P - if((p2p_ie=rtw_get_p2p_ie(buf, len, NULL, &p2p_ielen))) - { - u8 is_GO = _FALSE; - u32 attr_contentlen = 0; - u16 cap_attr=0; - - #ifdef CONFIG_DEBUG_CFG80211 - DBG_8192C("probe_resp_p2p_ielen=%d\n", p2p_ielen); - #endif - - //Check P2P Capability ATTR - if( rtw_get_p2p_attr_content( p2p_ie, p2p_ielen, P2P_ATTR_CAPABILITY, (u8*)&cap_attr, (uint*) &attr_contentlen) ) - { - u8 grp_cap=0; - //DBG_8192C( "[%s] Got P2P Capability Attr!!\n", __FUNCTION__ ); - cap_attr = le16_to_cpu(cap_attr); - grp_cap = (u8)((cap_attr >> 8)&0xff); - - is_GO = (grp_cap&BIT(0)) ? _TRUE:_FALSE; - - if(is_GO) - DBG_8192C("Got P2P Capability Attr, grp_cap=0x%x, is_GO\n", grp_cap); - } - - - if(is_GO == _FALSE) - { - if(pmlmepriv->p2p_probe_resp_ie) - { - u32 free_len = pmlmepriv->p2p_probe_resp_ie_len; - pmlmepriv->p2p_probe_resp_ie_len = 0; - rtw_mfree(pmlmepriv->p2p_probe_resp_ie, free_len); - pmlmepriv->p2p_probe_resp_ie = NULL; - } - - pmlmepriv->p2p_probe_resp_ie = rtw_malloc(p2p_ielen); - if ( pmlmepriv->p2p_probe_resp_ie == NULL) { - DBG_8192C("%s()-%d: rtw_malloc() ERROR!\n", __FUNCTION__, __LINE__); - return -EINVAL; - - } - _rtw_memcpy(pmlmepriv->p2p_probe_resp_ie, p2p_ie, p2p_ielen); - pmlmepriv->p2p_probe_resp_ie_len = p2p_ielen; - } - else - { - if(pmlmepriv->p2p_go_probe_resp_ie) - { - u32 free_len = pmlmepriv->p2p_go_probe_resp_ie_len; - pmlmepriv->p2p_go_probe_resp_ie_len = 0; - rtw_mfree(pmlmepriv->p2p_go_probe_resp_ie, free_len); - pmlmepriv->p2p_go_probe_resp_ie = NULL; - } - - pmlmepriv->p2p_go_probe_resp_ie = rtw_malloc(p2p_ielen); - if ( pmlmepriv->p2p_go_probe_resp_ie == NULL) { - DBG_8192C("%s()-%d: rtw_malloc() ERROR!\n", __FUNCTION__, __LINE__); - return -EINVAL; - - } - _rtw_memcpy(pmlmepriv->p2p_go_probe_resp_ie, p2p_ie, p2p_ielen); - pmlmepriv->p2p_go_probe_resp_ie_len = p2p_ielen; - } - - } - #endif //CONFIG_P2P - - //buf += p2p_ielen; - //len -= p2p_ielen; - - #ifdef CONFIG_WFD - if(rtw_get_wfd_ie(buf, len, NULL, &wfd_ielen)) - { - #ifdef CONFIG_DEBUG_CFG80211 - DBG_8192C("probe_resp_wfd_ielen=%d\n", wfd_ielen); - #endif - - if(pmlmepriv->wfd_probe_resp_ie) - { - u32 free_len = pmlmepriv->wfd_probe_resp_ie_len; - pmlmepriv->wfd_probe_resp_ie_len = 0; - rtw_mfree(pmlmepriv->wfd_probe_resp_ie, free_len); - pmlmepriv->wfd_probe_resp_ie = NULL; - } - - pmlmepriv->wfd_probe_resp_ie = rtw_malloc(wfd_ielen); - if ( pmlmepriv->wfd_probe_resp_ie == NULL) { - DBG_8192C("%s()-%d: rtw_malloc() ERROR!\n", __FUNCTION__, __LINE__); - return -EINVAL; - - } - rtw_get_wfd_ie(buf, len, pmlmepriv->wfd_probe_resp_ie, &pmlmepriv->wfd_probe_resp_ie_len); - } - #endif //CONFIG_WFD - - } - - return ret; - -} - -static int rtw_cfg80211_set_assoc_resp_wpsp2pie(struct net_device *net, char *buf, int len) -{ - int ret = 0; - _adapter *padapter = (_adapter *)rtw_netdev_priv(net); - struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); - - DBG_8192C("%s, ielen=%d\n", __func__, len); - - if(len>0) - { - if(pmlmepriv->wps_assoc_resp_ie) - { - u32 free_len = pmlmepriv->wps_assoc_resp_ie_len; - pmlmepriv->wps_assoc_resp_ie_len = 0; - rtw_mfree(pmlmepriv->wps_assoc_resp_ie, free_len); - pmlmepriv->wps_assoc_resp_ie = NULL; - } - - pmlmepriv->wps_assoc_resp_ie = rtw_malloc(len); - if ( pmlmepriv->wps_assoc_resp_ie == NULL) { - DBG_8192C("%s()-%d: rtw_malloc() ERROR!\n", __FUNCTION__, __LINE__); - return -EINVAL; - - } - _rtw_memcpy(pmlmepriv->wps_assoc_resp_ie, buf, len); - pmlmepriv->wps_assoc_resp_ie_len = len; - } - - return ret; - -} - -int rtw_cfg80211_set_mgnt_wpsp2pie(struct net_device *net, char *buf, int len, - int type) -{ - int ret = 0; - uint wps_ielen = 0; - u32 p2p_ielen = 0; - -#ifdef CONFIG_DEBUG_CFG80211 - DBG_8192C("%s, ielen=%d\n", __func__, len); -#endif - - if( (rtw_get_wps_ie(buf, len, NULL, &wps_ielen) && (wps_ielen>0)) - #ifdef CONFIG_P2P - || (rtw_get_p2p_ie(buf, len, NULL, &p2p_ielen) && (p2p_ielen>0)) - #endif - ) - { - if (net != NULL) - { - switch (type) - { - case 0x1: //BEACON - ret = rtw_cfg80211_set_beacon_wpsp2pie(net, buf, len); - break; - case 0x2: //PROBE_RESP - ret = rtw_cfg80211_set_probe_resp_wpsp2pie(net, buf, len); - break; - case 0x4: //ASSOC_RESP - ret = rtw_cfg80211_set_assoc_resp_wpsp2pie(net, buf, len); - break; - } - } - } - - return ret; - -} - -static struct cfg80211_ops rtw_cfg80211_ops = { - .change_virtual_intf = cfg80211_rtw_change_iface, - .add_key = cfg80211_rtw_add_key, - .get_key = cfg80211_rtw_get_key, - .del_key = cfg80211_rtw_del_key, - .set_default_key = cfg80211_rtw_set_default_key, - .get_station = cfg80211_rtw_get_station, - .scan = cfg80211_rtw_scan, - .set_wiphy_params = cfg80211_rtw_set_wiphy_params, - .connect = cfg80211_rtw_connect, - .disconnect = cfg80211_rtw_disconnect, - .join_ibss = cfg80211_rtw_join_ibss, - .leave_ibss = cfg80211_rtw_leave_ibss, - .set_tx_power = cfg80211_rtw_set_txpower, - .get_tx_power = cfg80211_rtw_get_txpower, - .set_power_mgmt = cfg80211_rtw_set_power_mgmt, - .set_pmksa = cfg80211_rtw_set_pmksa, - .del_pmksa = cfg80211_rtw_del_pmksa, - .flush_pmksa = cfg80211_rtw_flush_pmksa, - -#ifdef CONFIG_AP_MODE - .add_virtual_intf = cfg80211_rtw_add_virtual_intf, - .del_virtual_intf = cfg80211_rtw_del_virtual_intf, - - #if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 4, 0)) && !defined(COMPAT_KERNEL_RELEASE) - .add_beacon = cfg80211_rtw_add_beacon, - .set_beacon = cfg80211_rtw_set_beacon, - .del_beacon = cfg80211_rtw_del_beacon, - #else - .start_ap = cfg80211_rtw_start_ap, - .change_beacon = cfg80211_rtw_change_beacon, - .stop_ap = cfg80211_rtw_stop_ap, - #endif - - .add_station = cfg80211_rtw_add_station, - .del_station = cfg80211_rtw_del_station, - .change_station = cfg80211_rtw_change_station, - .dump_station = cfg80211_rtw_dump_station, - .change_bss = cfg80211_rtw_change_bss, - #if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 6, 0)) - .set_channel = cfg80211_rtw_set_channel, - #endif - //.auth = cfg80211_rtw_auth, - //.assoc = cfg80211_rtw_assoc, -#endif //CONFIG_AP_MODE - -#ifdef CONFIG_P2P - .remain_on_channel = cfg80211_rtw_remain_on_channel, - .cancel_remain_on_channel = cfg80211_rtw_cancel_remain_on_channel, -#endif - -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE) - .mgmt_tx = cfg80211_rtw_mgmt_tx, - .mgmt_frame_register = cfg80211_rtw_mgmt_frame_register, -#elif (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,34) && LINUX_VERSION_CODE<=KERNEL_VERSION(2,6,35)) - .action = cfg80211_rtw_mgmt_tx, -#endif -}; - -static void rtw_cfg80211_init_ht_capab(struct ieee80211_sta_ht_cap *ht_cap, enum ieee80211_band band, u8 rf_type) -{ - -#define MAX_BIT_RATE_40MHZ_MCS15 300 /* Mbps */ -#define MAX_BIT_RATE_40MHZ_MCS7 150 /* Mbps */ - - ht_cap->ht_supported = _TRUE; - - ht_cap->cap = IEEE80211_HT_CAP_SUP_WIDTH_20_40 | - IEEE80211_HT_CAP_SGI_40 | IEEE80211_HT_CAP_SGI_20 | - IEEE80211_HT_CAP_DSSSCCK40 | IEEE80211_HT_CAP_MAX_AMSDU; - - /* - *Maximum length of AMPDU that the STA can receive. - *Length = 2 ^ (13 + max_ampdu_length_exp) - 1 (octets) - */ - ht_cap->ampdu_factor = IEEE80211_HT_MAX_AMPDU_64K; - - /*Minimum MPDU start spacing , */ - ht_cap->ampdu_density = IEEE80211_HT_MPDU_DENSITY_16; - - ht_cap->mcs.tx_params = IEEE80211_HT_MCS_TX_DEFINED; - - /* - *hw->wiphy->bands[IEEE80211_BAND_2GHZ] - *base on ant_num - *rx_mask: RX mask - *if rx_ant =1 rx_mask[0]=0xff;==>MCS0-MCS7 - *if rx_ant =2 rx_mask[1]=0xff;==>MCS8-MCS15 - *if rx_ant >=3 rx_mask[2]=0xff; - *if BW_40 rx_mask[4]=0x01; - *highest supported RX rate - */ - if(rf_type == RF_1T1R) - { - ht_cap->mcs.rx_mask[0] = 0xFF; - ht_cap->mcs.rx_mask[1] = 0x00; - ht_cap->mcs.rx_mask[4] = 0x01; - - ht_cap->mcs.rx_highest = MAX_BIT_RATE_40MHZ_MCS7; - } - else if((rf_type == RF_1T2R) || (rf_type==RF_2T2R)) - { - ht_cap->mcs.rx_mask[0] = 0xFF; - ht_cap->mcs.rx_mask[1] = 0xFF; - ht_cap->mcs.rx_mask[4] = 0x01; - - ht_cap->mcs.rx_highest = MAX_BIT_RATE_40MHZ_MCS15; - } - else - { - DBG_8192C("%s, error rf_type=%d\n", __func__, rf_type); - } - -} - -void rtw_cfg80211_init_wiphy(_adapter *padapter) -{ - u8 rf_type; - struct ieee80211_supported_band *bands; - struct wireless_dev *pwdev = padapter->rtw_wdev; - struct wiphy *wiphy = pwdev->wiphy; - - rtw_hal_get_hwreg(padapter, HW_VAR_RF_TYPE, (u8 *)(&rf_type)); - - DBG_8192C("%s:rf_type=%d\n", __func__, rf_type); - - /* if (padapter->registrypriv.wireless_mode & WIRELESS_11G) */ - { - bands = wiphy->bands[IEEE80211_BAND_2GHZ]; - if(bands) - rtw_cfg80211_init_ht_capab(&bands->ht_cap, IEEE80211_BAND_2GHZ, rf_type); - } - - /* if (padapter->registrypriv.wireless_mode & WIRELESS_11A) */ - { - bands = wiphy->bands[IEEE80211_BAND_5GHZ]; - if(bands) - rtw_cfg80211_init_ht_capab(&bands->ht_cap, IEEE80211_BAND_5GHZ, rf_type); - } -} - -/* -struct ieee80211_iface_limit rtw_limits[] = { - { .max = 1, .types = BIT(NL80211_IFTYPE_STATION) - | BIT(NL80211_IFTYPE_ADHOC) -#ifdef CONFIG_AP_MODE - | BIT(NL80211_IFTYPE_AP) -#endif -#if defined(CONFIG_P2P) && ((LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE)) - | BIT(NL80211_IFTYPE_P2P_CLIENT) - | BIT(NL80211_IFTYPE_P2P_GO) -#endif - }, - {.max = 1, .types = BIT(NL80211_IFTYPE_MONITOR)}, -}; - -struct ieee80211_iface_combination rtw_combinations = { - .limits = rtw_limits, - .n_limits = ARRAY_SIZE(rtw_limits), - .max_interfaces = 2, - .num_different_channels = 1, -}; -*/ - -static void rtw_cfg80211_preinit_wiphy(_adapter *padapter, struct wiphy *wiphy) -{ - - wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM; - - wiphy->max_scan_ssids = RTW_SSID_SCAN_AMOUNT; - wiphy->max_scan_ie_len = RTW_SCAN_IE_LEN_MAX; - wiphy->max_num_pmkids = RTW_MAX_NUM_PMKIDS; - -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) || defined(COMPAT_KERNEL_RELEASE) - wiphy->max_remain_on_channel_duration = RTW_MAX_REMAIN_ON_CHANNEL_DURATION; -#endif - - wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) - | BIT(NL80211_IFTYPE_ADHOC) -#ifdef CONFIG_AP_MODE - | BIT(NL80211_IFTYPE_AP) - | BIT(NL80211_IFTYPE_MONITOR) -#endif -#if defined(CONFIG_P2P) && ((LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE)) - | BIT(NL80211_IFTYPE_P2P_CLIENT) - | BIT(NL80211_IFTYPE_P2P_GO) -#endif - ; - -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE) -#ifdef CONFIG_AP_MODE - wiphy->mgmt_stypes = rtw_cfg80211_default_mgmt_stypes; -#endif //CONFIG_AP_MODE -#endif - -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,0,0)) - wiphy->software_iftypes |= BIT(NL80211_IFTYPE_MONITOR); -#endif - - /* - wiphy->iface_combinations = &rtw_combinations; - wiphy->n_iface_combinations = 1; - */ - - wiphy->cipher_suites = rtw_cipher_suites; - wiphy->n_cipher_suites = ARRAY_SIZE(rtw_cipher_suites); - - /* if (padapter->registrypriv.wireless_mode & WIRELESS_11G) */ - wiphy->bands[IEEE80211_BAND_2GHZ] = rtw_spt_band_alloc(IEEE80211_BAND_2GHZ); - /* if (padapter->registrypriv.wireless_mode & WIRELESS_11A) */ - wiphy->bands[IEEE80211_BAND_5GHZ] = rtw_spt_band_alloc(IEEE80211_BAND_5GHZ); - -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38) && LINUX_VERSION_CODE < KERNEL_VERSION(3,0,0)) - wiphy->flags |= WIPHY_FLAG_SUPPORTS_SEPARATE_DEFAULT_KEYS; -#endif - -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0)) - wiphy->flags |= WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL; - wiphy->flags |= WIPHY_FLAG_OFFCHAN_TX | WIPHY_FLAG_HAVE_AP_SME; -#endif - - if(padapter->registrypriv.power_mgnt != PS_MODE_ACTIVE) - wiphy->flags |= WIPHY_FLAG_PS_ON_BY_DEFAULT; - else - wiphy->flags &= ~WIPHY_FLAG_PS_ON_BY_DEFAULT; -} - -int rtw_wdev_alloc(_adapter *padapter, struct device *dev) -{ - int ret = 0; - struct wiphy *wiphy; - struct wireless_dev *wdev; - struct rtw_wdev_priv *pwdev_priv; - struct net_device *pnetdev = padapter->pnetdev; - - DBG_8192C("%s(padapter=%p)\n", __func__, padapter); - - /* wiphy */ - wiphy = wiphy_new(&rtw_cfg80211_ops, sizeof(struct rtw_wdev_priv)); - if (!wiphy) { - DBG_8192C("Couldn't allocate wiphy device\n"); - ret = -ENOMEM; - goto exit; - } - set_wiphy_dev(wiphy, dev); - rtw_cfg80211_preinit_wiphy(padapter, wiphy); - - ret = wiphy_register(wiphy); - if (ret < 0) { - DBG_8192C("Couldn't register wiphy device\n"); - goto free_wiphy; - } - - /* wdev */ - wdev = (struct wireless_dev *)rtw_zmalloc(sizeof(struct wireless_dev)); - if (!wdev) { - DBG_8192C("Couldn't allocate wireless device\n"); - ret = -ENOMEM; - goto unregister_wiphy; - } - wdev->wiphy = wiphy; - wdev->netdev = pnetdev; - //wdev->iftype = NL80211_IFTYPE_STATION; - wdev->iftype = NL80211_IFTYPE_MONITOR; // for rtw_setopmode_cmd() in cfg80211_rtw_change_iface() - padapter->rtw_wdev = wdev; - pnetdev->ieee80211_ptr = wdev; - - //init pwdev_priv - pwdev_priv = wdev_to_priv(wdev); - pwdev_priv->rtw_wdev = wdev; - pwdev_priv->pmon_ndev = NULL; - pwdev_priv->ifname_mon[0] = '\0'; - pwdev_priv->padapter = padapter; - pwdev_priv->scan_request = NULL; - _rtw_spinlock_init(&pwdev_priv->scan_req_lock); - - pwdev_priv->p2p_enabled = _FALSE; - pwdev_priv->provdisc_req_issued = _FALSE; - rtw_wdev_invit_info_init(&pwdev_priv->invit_info); - rtw_wdev_nego_info_init(&pwdev_priv->nego_info); - - pwdev_priv->bandroid_scan = _FALSE; - - if(padapter->registrypriv.power_mgnt != PS_MODE_ACTIVE) - pwdev_priv->power_mgmt = _TRUE; - else - pwdev_priv->power_mgmt = _FALSE; - -#ifdef CONFIG_CONCURRENT_MODE - ATOMIC_SET(&pwdev_priv->switch_ch_to, 1); - ATOMIC_SET(&pwdev_priv->ro_ch_to, 1); -#endif - - return ret; - - rtw_mfree((u8*)wdev, sizeof(struct wireless_dev)); -unregister_wiphy: - wiphy_unregister(wiphy); - free_wiphy: - wiphy_free(wiphy); -exit: - return ret; - -} - -void rtw_wdev_free(struct wireless_dev *wdev) -{ - struct rtw_wdev_priv *pwdev_priv; - - DBG_8192C("%s(wdev=%p)\n", __func__, wdev); - - if (!wdev) - return; - - pwdev_priv = wdev_to_priv(wdev); - - rtw_spt_band_free(wdev->wiphy->bands[IEEE80211_BAND_2GHZ]); - rtw_spt_band_free(wdev->wiphy->bands[IEEE80211_BAND_5GHZ]); - - wiphy_free(wdev->wiphy); - - rtw_mfree((u8*)wdev, sizeof(struct wireless_dev)); -} - -void rtw_wdev_unregister(struct wireless_dev *wdev) -{ - struct rtw_wdev_priv *pwdev_priv; - - DBG_8192C("%s(wdev=%p)\n", __func__, wdev); - - if (!wdev) - return; - - pwdev_priv = wdev_to_priv(wdev); - - rtw_cfg80211_indicate_scan_done(pwdev_priv, _TRUE); - - if (pwdev_priv->pmon_ndev) { - DBG_8192C("%s, unregister monitor interface\n", __func__); - unregister_netdev(pwdev_priv->pmon_ndev); - } - - wiphy_unregister(wdev->wiphy); -} - -#endif //CONFIG_IOCTL_CFG80211 - +/****************************************************************************** + * + * Copyright(c) 2007 - 2012 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 + * + * + ******************************************************************************/ +#define _IOCTL_CFG80211_C_ + +#include +#include +#include +#include +#include +#include +#include + +#ifdef CONFIG_IOCTL_CFG80211 + +#include "ioctl_cfg80211.h" + +#define RTW_MAX_MGMT_TX_CNT (8) + +#define RTW_SCAN_IE_LEN_MAX 2304 +#define RTW_MAX_REMAIN_ON_CHANNEL_DURATION 65535 //ms +#define RTW_MAX_NUM_PMKIDS 4 + +#define RTW_CH_MAX_2G_CHANNEL 14 /* Max channel in 2G band */ + + + +#ifdef CONFIG_WAPI_SUPPORT + +#ifndef WLAN_CIPHER_SUITE_SMS4 +#define WLAN_CIPHER_SUITE_SMS4 0x00147201 +#endif + +#ifndef WLAN_AKM_SUITE_WAPI_PSK +#define WLAN_AKM_SUITE_WAPI_PSK 0x000FAC04 +#endif + +#ifndef WLAN_AKM_SUITE_WAPI_CERT +#define WLAN_AKM_SUITE_WAPI_CERT 0x000FAC12 +#endif + +#ifndef NL80211_WAPI_VERSION_1 +#define NL80211_WAPI_VERSION_1 (1 << 2) +#endif + +#endif + + + +static const u32 rtw_cipher_suites[] = { + WLAN_CIPHER_SUITE_WEP40, + WLAN_CIPHER_SUITE_WEP104, + WLAN_CIPHER_SUITE_TKIP, + WLAN_CIPHER_SUITE_CCMP, +#ifdef CONFIG_IEEE80211W + WLAN_CIPHER_SUITE_AES_CMAC, +#endif //CONFIG_IEEE80211W +}; + +#define RATETAB_ENT(_rate, _rateid, _flags) \ + { \ + .bitrate = (_rate), \ + .hw_value = (_rateid), \ + .flags = (_flags), \ + } + +#define CHAN2G(_channel, _freq, _flags) { \ + .band = IEEE80211_BAND_2GHZ, \ + .center_freq = (_freq), \ + .hw_value = (_channel), \ + .flags = (_flags), \ + .max_antenna_gain = 0, \ + .max_power = 30, \ +} + +#define CHAN5G(_channel, _flags) { \ + .band = IEEE80211_BAND_5GHZ, \ + .center_freq = 5000 + (5 * (_channel)), \ + .hw_value = (_channel), \ + .flags = (_flags), \ + .max_antenna_gain = 0, \ + .max_power = 30, \ +} + +static struct ieee80211_rate rtw_rates[] = { + RATETAB_ENT(10, 0x1, 0), + RATETAB_ENT(20, 0x2, 0), + RATETAB_ENT(55, 0x4, 0), + RATETAB_ENT(110, 0x8, 0), + RATETAB_ENT(60, 0x10, 0), + RATETAB_ENT(90, 0x20, 0), + RATETAB_ENT(120, 0x40, 0), + RATETAB_ENT(180, 0x80, 0), + RATETAB_ENT(240, 0x100, 0), + RATETAB_ENT(360, 0x200, 0), + RATETAB_ENT(480, 0x400, 0), + RATETAB_ENT(540, 0x800, 0), +}; + +#define rtw_a_rates (rtw_rates + 4) +#define RTW_A_RATES_NUM 8 +#define rtw_g_rates (rtw_rates + 0) +#define RTW_G_RATES_NUM 12 + +#define RTW_2G_CHANNELS_NUM 14 +#define RTW_5G_CHANNELS_NUM 37 + +static struct ieee80211_channel rtw_2ghz_channels[] = { + CHAN2G(1, 2412, 0), + CHAN2G(2, 2417, 0), + CHAN2G(3, 2422, 0), + CHAN2G(4, 2427, 0), + CHAN2G(5, 2432, 0), + CHAN2G(6, 2437, 0), + CHAN2G(7, 2442, 0), + CHAN2G(8, 2447, 0), + CHAN2G(9, 2452, 0), + CHAN2G(10, 2457, 0), + CHAN2G(11, 2462, 0), + CHAN2G(12, 2467, 0), + CHAN2G(13, 2472, 0), + CHAN2G(14, 2484, 0), +}; + +static struct ieee80211_channel rtw_5ghz_a_channels[] = { + CHAN5G(34, 0), CHAN5G(36, 0), + CHAN5G(38, 0), CHAN5G(40, 0), + CHAN5G(42, 0), CHAN5G(44, 0), + CHAN5G(46, 0), CHAN5G(48, 0), + CHAN5G(52, 0), CHAN5G(56, 0), + CHAN5G(60, 0), CHAN5G(64, 0), + CHAN5G(100, 0), CHAN5G(104, 0), + CHAN5G(108, 0), CHAN5G(112, 0), + CHAN5G(116, 0), CHAN5G(120, 0), + CHAN5G(124, 0), CHAN5G(128, 0), + CHAN5G(132, 0), CHAN5G(136, 0), + CHAN5G(140, 0), CHAN5G(149, 0), + CHAN5G(153, 0), CHAN5G(157, 0), + CHAN5G(161, 0), CHAN5G(165, 0), + CHAN5G(184, 0), CHAN5G(188, 0), + CHAN5G(192, 0), CHAN5G(196, 0), + CHAN5G(200, 0), CHAN5G(204, 0), + CHAN5G(208, 0), CHAN5G(212, 0), + CHAN5G(216, 0), +}; + + +void rtw_2g_channels_init(struct ieee80211_channel *channels) +{ + _rtw_memcpy((void*)channels, (void*)rtw_2ghz_channels, + sizeof(struct ieee80211_channel)*RTW_2G_CHANNELS_NUM + ); +} + +void rtw_5g_channels_init(struct ieee80211_channel *channels) +{ + _rtw_memcpy((void*)channels, (void*)rtw_5ghz_a_channels, + sizeof(struct ieee80211_channel)*RTW_5G_CHANNELS_NUM + ); +} + +void rtw_2g_rates_init(struct ieee80211_rate *rates) +{ + _rtw_memcpy(rates, rtw_g_rates, + sizeof(struct ieee80211_rate)*RTW_G_RATES_NUM + ); +} + +void rtw_5g_rates_init(struct ieee80211_rate *rates) +{ + _rtw_memcpy(rates, rtw_a_rates, + sizeof(struct ieee80211_rate)*RTW_A_RATES_NUM + ); +} + +struct ieee80211_supported_band *rtw_spt_band_alloc( + enum ieee80211_band band + ) +{ + struct ieee80211_supported_band *spt_band = NULL; + int n_channels, n_bitrates; + + if(band == IEEE80211_BAND_2GHZ) + { + n_channels = RTW_2G_CHANNELS_NUM; + n_bitrates = RTW_G_RATES_NUM; + } + else if(band == IEEE80211_BAND_5GHZ) + { + n_channels = RTW_5G_CHANNELS_NUM; + n_bitrates = RTW_A_RATES_NUM; + } + else + { + goto exit; + } + + spt_band = (struct ieee80211_supported_band *)rtw_zmalloc( + sizeof(struct ieee80211_supported_band) + + sizeof(struct ieee80211_channel)*n_channels + + sizeof(struct ieee80211_rate)*n_bitrates + ); + if(!spt_band) + goto exit; + + spt_band->channels = (struct ieee80211_channel*)(((u8*)spt_band)+sizeof(struct ieee80211_supported_band)); + spt_band->bitrates= (struct ieee80211_rate*)(((u8*)spt_band->channels)+sizeof(struct ieee80211_channel)*n_channels); + spt_band->band = band; + spt_band->n_channels = n_channels; + spt_band->n_bitrates = n_bitrates; + + if(band == IEEE80211_BAND_2GHZ) + { + rtw_2g_channels_init(spt_band->channels); + rtw_2g_rates_init(spt_band->bitrates); + } + else if(band == IEEE80211_BAND_5GHZ) + { + rtw_5g_channels_init(spt_band->channels); + rtw_5g_rates_init(spt_band->bitrates); + } + + //spt_band.ht_cap + +exit: + + return spt_band; +} + +void rtw_spt_band_free(struct ieee80211_supported_band *spt_band) +{ + u32 size; + + if(!spt_band) + return; + + if(spt_band->band == IEEE80211_BAND_2GHZ) + { + size = sizeof(struct ieee80211_supported_band) + + sizeof(struct ieee80211_channel)*RTW_2G_CHANNELS_NUM + + sizeof(struct ieee80211_rate)*RTW_G_RATES_NUM; + } + else if(spt_band->band == IEEE80211_BAND_5GHZ) + { + size = sizeof(struct ieee80211_supported_band) + + sizeof(struct ieee80211_channel)*RTW_5G_CHANNELS_NUM + + sizeof(struct ieee80211_rate)*RTW_A_RATES_NUM; + } + else + { + + } + rtw_mfree((u8*)spt_band, size); +} + +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE) +static const struct ieee80211_txrx_stypes +rtw_cfg80211_default_mgmt_stypes[NUM_NL80211_IFTYPES] = { + [NL80211_IFTYPE_ADHOC] = { + .tx = 0xffff, + .rx = BIT(IEEE80211_STYPE_ACTION >> 4) + }, + [NL80211_IFTYPE_STATION] = { + .tx = 0xffff, + .rx = BIT(IEEE80211_STYPE_ACTION >> 4) | + BIT(IEEE80211_STYPE_PROBE_REQ >> 4) + }, + [NL80211_IFTYPE_AP] = { + .tx = 0xffff, + .rx = BIT(IEEE80211_STYPE_ASSOC_REQ >> 4) | + BIT(IEEE80211_STYPE_REASSOC_REQ >> 4) | + BIT(IEEE80211_STYPE_PROBE_REQ >> 4) | + BIT(IEEE80211_STYPE_DISASSOC >> 4) | + BIT(IEEE80211_STYPE_AUTH >> 4) | + BIT(IEEE80211_STYPE_DEAUTH >> 4) | + BIT(IEEE80211_STYPE_ACTION >> 4) + }, + [NL80211_IFTYPE_AP_VLAN] = { + /* copy AP */ + .tx = 0xffff, + .rx = BIT(IEEE80211_STYPE_ASSOC_REQ >> 4) | + BIT(IEEE80211_STYPE_REASSOC_REQ >> 4) | + BIT(IEEE80211_STYPE_PROBE_REQ >> 4) | + BIT(IEEE80211_STYPE_DISASSOC >> 4) | + BIT(IEEE80211_STYPE_AUTH >> 4) | + BIT(IEEE80211_STYPE_DEAUTH >> 4) | + BIT(IEEE80211_STYPE_ACTION >> 4) + }, + [NL80211_IFTYPE_P2P_CLIENT] = { + .tx = 0xffff, + .rx = BIT(IEEE80211_STYPE_ACTION >> 4) | + BIT(IEEE80211_STYPE_PROBE_REQ >> 4) + }, + [NL80211_IFTYPE_P2P_GO] = { + .tx = 0xffff, + .rx = BIT(IEEE80211_STYPE_ASSOC_REQ >> 4) | + BIT(IEEE80211_STYPE_REASSOC_REQ >> 4) | + BIT(IEEE80211_STYPE_PROBE_REQ >> 4) | + BIT(IEEE80211_STYPE_DISASSOC >> 4) | + BIT(IEEE80211_STYPE_AUTH >> 4) | + BIT(IEEE80211_STYPE_DEAUTH >> 4) | + BIT(IEEE80211_STYPE_ACTION >> 4) + }, +}; +#endif + +static int rtw_ieee80211_channel_to_frequency(int chan, int band) +{ + /* see 802.11 17.3.8.3.2 and Annex J + * there are overlapping channel numbers in 5GHz and 2GHz bands */ + + if (band == IEEE80211_BAND_5GHZ) { + if (chan >= 182 && chan <= 196) + return 4000 + chan * 5; + else + return 5000 + chan * 5; + } else { /* IEEE80211_BAND_2GHZ */ + if (chan == 14) + return 2484; + else if (chan < 14) + return 2407 + chan * 5; + else + return 0; /* not supported */ + } +} + +#define MAX_BSSINFO_LEN 1000 +struct cfg80211_bss *rtw_cfg80211_inform_bss(struct adapter *padapter, struct wlan_network *pnetwork) +{ + struct ieee80211_channel *notify_channel; + struct cfg80211_bss *bss = NULL; + //struct ieee80211_supported_band *band; + u16 channel; + u32 freq; + u64 notify_timestamp; + u16 notify_capability; + u16 notify_interval; + u8 *notify_ie; + size_t notify_ielen; + s32 notify_signal; + u8 buf[MAX_BSSINFO_LEN], *pbuf; + size_t len,bssinf_len=0; + struct rtw_ieee80211_hdr *pwlanhdr; + unsigned short *fctrl; + u8 bc_addr[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; + + struct wireless_dev *wdev = padapter->rtw_wdev; + struct wiphy *wiphy = wdev->wiphy; + struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); + + + //DBG_8192C("%s\n", __func__); + + bssinf_len = pnetwork->network.IELength+sizeof (struct rtw_ieee80211_hdr_3addr); + if(bssinf_len > MAX_BSSINFO_LEN){ + DBG_871X("%s IE Length too long > %d byte \n",__FUNCTION__,MAX_BSSINFO_LEN); + goto exit; + } + + //To reduce PBC Overlap rate + //_enter_critical_bh(&pwdev_priv->scan_req_lock, &irqL); + if(wdev_to_priv(wdev)->scan_request != NULL) + { + u8 *psr=NULL, sr = 0; + NDIS_802_11_SSID *pssid = &pnetwork->network.Ssid; + struct cfg80211_scan_request *request = wdev_to_priv(wdev)->scan_request; + struct cfg80211_ssid *ssids = request->ssids; + u32 wpsielen=0; + u8 *wpsie=NULL; + + wpsie = rtw_get_wps_ie(pnetwork->network.IEs+_FIXED_IE_LENGTH_, pnetwork->network.IELength-_FIXED_IE_LENGTH_, NULL, &wpsielen); + + if(wpsie && wpsielen>0) + psr = rtw_get_wps_attr_content(wpsie, wpsielen, WPS_ATTR_SELECTED_REGISTRAR, (u8*)(&sr), NULL); + + if (sr != 0) + { + if(request->n_ssids == 1 && request->n_channels == 1) // it means under processing WPS + { + DBG_8192C("ssid=%s, len=%d\n", pssid->Ssid, pssid->SsidLength); + + if (ssids[0].ssid_len == 0) { + } + else if(pssid->SsidLength == ssids[0].ssid_len && + _rtw_memcmp(pssid->Ssid, ssids[0].ssid, ssids[0].ssid_len)) + { + DBG_871X("%s, got sr and ssid match!\n", __func__); + } + else + { + if(psr !=NULL) + *psr = 0; //clear sr + +#if 0 + WLAN_BSSID_EX *pselect_network = &pnetwork->network; + struct cfg80211_bss *pselect_bss = NULL; + struct ieee80211_channel *notify_channel = NULL; + u32 freq; + + DBG_871X("%s, got sr, but ssid mismatch, to remove this bss\n", __func__); + + if (pselect_network->Configuration.DSConfig <= RTW_CH_MAX_2G_CHANNEL) + freq = rtw_ieee80211_channel_to_frequency(pselect_network->Configuration.DSConfig, IEEE80211_BAND_2GHZ); + else + freq = rtw_ieee80211_channel_to_frequency(pselect_network->Configuration.DSConfig, IEEE80211_BAND_5GHZ); + + notify_channel = ieee80211_get_channel(wiphy, freq); + pselect_bss = cfg80211_get_bss(wiphy, NULL/*notify_channel*/, + pselect_network->MacAddress, pselect_network->Ssid.Ssid, + pselect_network->Ssid.SsidLength, 0/*WLAN_CAPABILITY_ESS*/, + 0/*WLAN_CAPABILITY_ESS*/); + + if(pselect_bss) + { + DBG_871X("%s, got bss for cfg80211 for unlinking bss\n", __func__); + + cfg80211_unlink_bss(wiphy, pselect_bss); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0) + cfg80211_put_bss(wiphy, pselect_bss); +#else + cfg80211_put_bss(pselect_bss); +#endif + + } + + goto exit; +#endif + } + } + } + } + //_exit_critical_bh(&pwdev_priv->scan_req_lock, &irqL); + + channel = pnetwork->network.Configuration.DSConfig; + if (channel <= RTW_CH_MAX_2G_CHANNEL) + freq = rtw_ieee80211_channel_to_frequency(channel, IEEE80211_BAND_2GHZ); + else + freq = rtw_ieee80211_channel_to_frequency(channel, IEEE80211_BAND_5GHZ); + + notify_channel = ieee80211_get_channel(wiphy, freq); + + //rtw_get_timestampe_from_ie() + notify_timestamp = jiffies_to_msecs(jiffies)*1000; /* uSec */ + + notify_interval = le16_to_cpu(*(u16*)rtw_get_beacon_interval_from_ie(pnetwork->network.IEs)); + notify_capability = le16_to_cpu(*(u16*)rtw_get_capability_from_ie(pnetwork->network.IEs)); + + + notify_ie = pnetwork->network.IEs+_FIXED_IE_LENGTH_; + notify_ielen = pnetwork->network.IELength-_FIXED_IE_LENGTH_; + + //We've set wiphy's signal_type as CFG80211_SIGNAL_TYPE_MBM: signal strength in mBm (100*dBm) + if ( check_fwstate(pmlmepriv, _FW_LINKED)== _TRUE && + is_same_network(&pmlmepriv->cur_network.network, &pnetwork->network, 0)) { + notify_signal = 100*translate_percentage_to_dbm(padapter->recvpriv.signal_strength);//dbm + } else { + notify_signal = 100*translate_percentage_to_dbm(pnetwork->network.PhyInfo.SignalStrength);//dbm + } + + #if 0 + DBG_8192C("bssid: "MAC_FMT"\n", MAC_ARG(pnetwork->network.MacAddress)); + DBG_8192C("Channel: %d(%d)\n", channel, freq); + DBG_8192C("Capability: %X\n", notify_capability); + DBG_8192C("Beacon interval: %d\n", notify_interval); + DBG_8192C("Signal: %d\n", notify_signal); + DBG_8192C("notify_timestamp: %#018llx\n", notify_timestamp); + #endif + + pbuf = buf; + + pwlanhdr = (struct rtw_ieee80211_hdr *)pbuf; + fctrl = &(pwlanhdr->frame_ctl); + *(fctrl) = 0; + + SetSeqNum(pwlanhdr, 0/*pmlmeext->mgnt_seq*/); + //pmlmeext->mgnt_seq++; + + if (pnetwork->network.Reserved[0] == 1) { // WIFI_BEACON + _rtw_memcpy(pwlanhdr->addr1, bc_addr, ETH_ALEN); + SetFrameSubType(pbuf, WIFI_BEACON); + } else { + _rtw_memcpy(pwlanhdr->addr1, myid(&(padapter->eeprompriv)), ETH_ALEN); + SetFrameSubType(pbuf, WIFI_PROBERSP); + } + + _rtw_memcpy(pwlanhdr->addr2, pnetwork->network.MacAddress, ETH_ALEN); + _rtw_memcpy(pwlanhdr->addr3, pnetwork->network.MacAddress, ETH_ALEN); + + + pbuf += sizeof(struct rtw_ieee80211_hdr_3addr); + len = sizeof (struct rtw_ieee80211_hdr_3addr); + + _rtw_memcpy(pbuf, pnetwork->network.IEs, pnetwork->network.IELength); + len += pnetwork->network.IELength; + + //#ifdef CONFIG_P2P + //if(rtw_get_p2p_ie(pnetwork->network.IEs+12, pnetwork->network.IELength-12, NULL, NULL)) + //{ + // DBG_8192C("%s, got p2p_ie\n", __func__); + //} + //#endif + + +#if 1 + bss = cfg80211_inform_bss_frame(wiphy, notify_channel, (struct ieee80211_mgmt *)buf, + len, notify_signal, GFP_ATOMIC); +#else + + bss = cfg80211_inform_bss(wiphy, notify_channel, (const u8 *)pnetwork->network.MacAddress, + notify_timestamp, notify_capability, notify_interval, notify_ie, + notify_ielen, notify_signal, GFP_ATOMIC/*GFP_KERNEL*/); +#endif + + if (unlikely(!bss)) { + DBG_8192C(FUNC_ADPT_FMT" bss NULL\n", FUNC_ADPT_ARG(padapter)); + goto exit; + } + +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,38)) +#ifndef COMPAT_KERNEL_RELEASE + //patch for cfg80211, update beacon ies to information_elements + if (pnetwork->network.Reserved[0] == 1) { // WIFI_BEACON + + if(bss->len_information_elements != bss->len_beacon_ies) + { + bss->information_elements = bss->beacon_ies; + bss->len_information_elements = bss->len_beacon_ies; + } + } +#endif //COMPAT_KERNEL_RELEASE +#endif //LINUX_VERSION_CODE < KERNEL_VERSION(2,6,38) + +/* + { + if( bss->information_elements == bss->proberesp_ies) + { + if( bss->len_information_elements != bss->len_proberesp_ies) + { + DBG_8192C("error!, len_information_elements != bss->len_proberesp_ies\n"); + } + + } + else if(bss->len_information_elements < bss->len_beacon_ies) + { + bss->information_elements = bss->beacon_ies; + bss->len_information_elements = bss->len_beacon_ies; + } + } +*/ + +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0) + cfg80211_put_bss(wiphy, bss); +#else + cfg80211_put_bss(bss); +#endif + +exit: + return bss; + +} + +/* + Check the given bss is valid by kernel API cfg80211_get_bss() + @padapter : the given adapter + + return _TRUE if bss is valid, _FALSE for not found. +*/ +int rtw_cfg80211_check_bss(struct adapter *padapter) +{ + WLAN_BSSID_EX *pnetwork = &(padapter->mlmeextpriv.mlmext_info.network); + struct cfg80211_bss *bss = NULL; + struct ieee80211_channel *notify_channel = NULL; + u32 freq; + + if (!(pnetwork) || !(padapter->rtw_wdev)) + return _FALSE; + + if (pnetwork->Configuration.DSConfig <= RTW_CH_MAX_2G_CHANNEL) + freq = rtw_ieee80211_channel_to_frequency(pnetwork->Configuration.DSConfig, IEEE80211_BAND_2GHZ); + else + freq = rtw_ieee80211_channel_to_frequency(pnetwork->Configuration.DSConfig, IEEE80211_BAND_5GHZ); + + notify_channel = ieee80211_get_channel(padapter->rtw_wdev->wiphy, freq); + bss = cfg80211_get_bss(padapter->rtw_wdev->wiphy, notify_channel, + pnetwork->MacAddress, pnetwork->Ssid.Ssid, + pnetwork->Ssid.SsidLength, + WLAN_CAPABILITY_ESS, WLAN_CAPABILITY_ESS); + + return (bss!=NULL); +} + +void rtw_cfg80211_ibss_indicate_connect(struct adapter *padapter) +{ + struct mlme_priv *pmlmepriv = &padapter->mlmepriv; + struct wlan_network *cur_network = &(pmlmepriv->cur_network); + struct wireless_dev *pwdev = padapter->rtw_wdev; + struct cfg80211_bss *bss = NULL; + + DBG_871X(FUNC_ADPT_FMT"\n", FUNC_ADPT_ARG(padapter)); + if (pwdev->iftype != NL80211_IFTYPE_ADHOC) + { + return; + } + + if (!rtw_cfg80211_check_bss(padapter)) { + WLAN_BSSID_EX *pnetwork = &(padapter->mlmeextpriv.mlmext_info.network); + struct wlan_network *scanned = pmlmepriv->cur_network_scanned; + + if(check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE)==_TRUE) + { + + _rtw_memcpy(&cur_network->network, pnetwork, sizeof(WLAN_BSSID_EX)); + if(cur_network) + { + if (!rtw_cfg80211_inform_bss(padapter,cur_network)) + DBG_871X(FUNC_ADPT_FMT" inform fail !!\n", FUNC_ADPT_ARG(padapter)); + else + DBG_871X(FUNC_ADPT_FMT" inform success !!\n", FUNC_ADPT_ARG(padapter)); + } + else + { + DBG_871X("cur_network is not exist!!!\n"); + return ; + } + } + else + { + if(scanned == NULL) + rtw_warn_on(1); + + if (_rtw_memcmp(&(scanned->network.Ssid), &(pnetwork->Ssid), sizeof(NDIS_802_11_SSID)) == _TRUE + && _rtw_memcmp(scanned->network.MacAddress, pnetwork->MacAddress, sizeof(NDIS_802_11_MAC_ADDRESS)) == _TRUE + ) { + if (!rtw_cfg80211_inform_bss(padapter,scanned)) { + DBG_871X(FUNC_ADPT_FMT" inform fail !!\n", FUNC_ADPT_ARG(padapter)); + } else { + //DBG_871X(FUNC_ADPT_FMT" inform success !!\n", FUNC_ADPT_ARG(padapter)); + } + } else { + DBG_871X("scanned & pnetwork compare fail\n"); + rtw_warn_on(1); + } + } + + if (!rtw_cfg80211_check_bss(padapter)) + DBG_871X_LEVEL(_drv_always_, FUNC_ADPT_FMT" BSS not found !!\n", FUNC_ADPT_ARG(padapter)); + } + //notify cfg80211 that device joined an IBSS + cfg80211_ibss_joined(padapter->pnetdev, cur_network->network.MacAddress, GFP_ATOMIC); +} + +void rtw_cfg80211_indicate_connect(struct adapter *padapter) +{ + struct mlme_priv *pmlmepriv = &padapter->mlmepriv; + struct wlan_network *cur_network = &(pmlmepriv->cur_network); + struct wireless_dev *pwdev = padapter->rtw_wdev; +#ifdef CONFIG_P2P + struct wifidirect_info *pwdinfo= &(padapter->wdinfo); +#endif + struct cfg80211_bss *bss = NULL; + + DBG_871X(FUNC_ADPT_FMT"\n", FUNC_ADPT_ARG(padapter)); + if (pwdev->iftype != NL80211_IFTYPE_STATION + #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE) + && pwdev->iftype != NL80211_IFTYPE_P2P_CLIENT + #endif + ) { + return; + } + + if(check_fwstate(pmlmepriv, WIFI_AP_STATE) == _TRUE) + return; + +#ifdef CONFIG_P2P + if(pwdinfo->driver_interface == DRIVER_CFG80211 ) + { + if(!rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) + { + rtw_p2p_set_pre_state(pwdinfo, rtw_p2p_state(pwdinfo)); + rtw_p2p_set_role(pwdinfo, P2P_ROLE_CLIENT); + rtw_p2p_set_state(pwdinfo, P2P_STATE_GONEGO_OK); + DBG_8192C("%s, role=%d, p2p_state=%d, pre_p2p_state=%d\n", __func__, rtw_p2p_role(pwdinfo), rtw_p2p_state(pwdinfo), rtw_p2p_pre_state(pwdinfo)); + } + } +#endif //CONFIG_P2P + + { + WLAN_BSSID_EX *pnetwork = &(padapter->mlmeextpriv.mlmext_info.network); + struct wlan_network *scanned = pmlmepriv->cur_network_scanned; + + //DBG_871X(FUNC_ADPT_FMT" BSS not found\n", FUNC_ADPT_ARG(padapter)); + + if(scanned == NULL) { + rtw_warn_on(1); + goto check_bss; + } + + if (_rtw_memcmp(scanned->network.MacAddress, pnetwork->MacAddress, sizeof(NDIS_802_11_MAC_ADDRESS)) == _TRUE + && _rtw_memcmp(&(scanned->network.Ssid), &(pnetwork->Ssid), sizeof(NDIS_802_11_SSID)) == _TRUE + ) { + if (!rtw_cfg80211_inform_bss(padapter,scanned)) { + DBG_871X(FUNC_ADPT_FMT" inform fail !!\n", FUNC_ADPT_ARG(padapter)); + } else { + //DBG_871X(FUNC_ADPT_FMT" inform success !!\n", FUNC_ADPT_ARG(padapter)); + } + } else { + DBG_871X("scanned: %s("MAC_FMT"), cur: %s("MAC_FMT")\n", + scanned->network.Ssid.Ssid, MAC_ARG(scanned->network.MacAddress), + pnetwork->Ssid.Ssid, MAC_ARG(pnetwork->MacAddress) + ); + rtw_warn_on(1); + } + } + +check_bss: + if (!rtw_cfg80211_check_bss(padapter)) + DBG_871X_LEVEL(_drv_always_, FUNC_ADPT_FMT" BSS not found !!\n", FUNC_ADPT_ARG(padapter)); + + #ifdef CONFIG_LAYER2_ROAMING + if (rtw_to_roaming(padapter) > 0) { + #if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 39) || defined(COMPAT_KERNEL_RELEASE) + struct wiphy *wiphy = pwdev->wiphy; + struct ieee80211_channel *notify_channel; + u32 freq; + u16 channel = cur_network->network.Configuration.DSConfig; + + if (channel <= RTW_CH_MAX_2G_CHANNEL) + freq = rtw_ieee80211_channel_to_frequency(channel, IEEE80211_BAND_2GHZ); + else + freq = rtw_ieee80211_channel_to_frequency(channel, IEEE80211_BAND_5GHZ); + + notify_channel = ieee80211_get_channel(wiphy, freq); + #endif + + DBG_871X(FUNC_ADPT_FMT" call cfg80211_roamed\n", FUNC_ADPT_ARG(padapter)); + cfg80211_roamed(padapter->pnetdev + #if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 39) || defined(COMPAT_KERNEL_RELEASE) + , notify_channel + #endif + , cur_network->network.MacAddress + , pmlmepriv->assoc_req+sizeof(struct rtw_ieee80211_hdr_3addr)+2 + , pmlmepriv->assoc_req_len-sizeof(struct rtw_ieee80211_hdr_3addr)-2 + , pmlmepriv->assoc_rsp+sizeof(struct rtw_ieee80211_hdr_3addr)+6 + , pmlmepriv->assoc_rsp_len-sizeof(struct rtw_ieee80211_hdr_3addr)-6 + , GFP_ATOMIC); + } + else + #endif + { + DBG_8192C("pwdev->sme_state(b)=%d\n", pwdev->sme_state); + cfg80211_connect_result(padapter->pnetdev, cur_network->network.MacAddress + , pmlmepriv->assoc_req+sizeof(struct rtw_ieee80211_hdr_3addr)+2 + , pmlmepriv->assoc_req_len-sizeof(struct rtw_ieee80211_hdr_3addr)-2 + , pmlmepriv->assoc_rsp+sizeof(struct rtw_ieee80211_hdr_3addr)+6 + , pmlmepriv->assoc_rsp_len-sizeof(struct rtw_ieee80211_hdr_3addr)-6 + , WLAN_STATUS_SUCCESS, GFP_ATOMIC); + DBG_8192C("pwdev->sme_state(a)=%d\n", pwdev->sme_state); + } +} + +void rtw_cfg80211_indicate_disconnect(struct adapter *padapter) +{ + struct mlme_priv *pmlmepriv = &padapter->mlmepriv; + struct wireless_dev *pwdev = padapter->rtw_wdev; +#ifdef CONFIG_P2P + struct wifidirect_info *pwdinfo= &(padapter->wdinfo); +#endif + + DBG_871X(FUNC_ADPT_FMT"\n", FUNC_ADPT_ARG(padapter)); + + if (pwdev->iftype != NL80211_IFTYPE_STATION + #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE) + && pwdev->iftype != NL80211_IFTYPE_P2P_CLIENT + #endif + ) { + return; + } + + if(check_fwstate(pmlmepriv, WIFI_AP_STATE) == _TRUE) + return; + +#ifdef CONFIG_P2P + if( pwdinfo->driver_interface == DRIVER_CFG80211 ) + { + if(!rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) + { + rtw_p2p_set_state(pwdinfo, rtw_p2p_pre_state(pwdinfo)); + rtw_p2p_set_role(pwdinfo, P2P_ROLE_DEVICE); + + DBG_8192C("%s, role=%d, p2p_state=%d, pre_p2p_state=%d\n", __func__, rtw_p2p_role(pwdinfo), rtw_p2p_state(pwdinfo), rtw_p2p_pre_state(pwdinfo)); + } + } +#endif //CONFIG_P2P + + if (!padapter->mlmepriv.not_indic_disco) { + DBG_8192C("pwdev->sme_state(b)=%d\n", pwdev->sme_state); + + if(pwdev->sme_state==CFG80211_SME_CONNECTING) + cfg80211_connect_result(padapter->pnetdev, NULL, NULL, 0, NULL, 0, + WLAN_STATUS_UNSPECIFIED_FAILURE, GFP_ATOMIC/*GFP_KERNEL*/); + else if(pwdev->sme_state==CFG80211_SME_CONNECTED) + cfg80211_disconnected(padapter->pnetdev, 0, NULL, 0, GFP_ATOMIC); + //else + //DBG_8192C("pwdev->sme_state=%d\n", pwdev->sme_state); + + DBG_8192C("pwdev->sme_state(a)=%d\n", pwdev->sme_state); + } +} + + +#ifdef CONFIG_AP_MODE +static u8 set_pairwise_key(struct adapter *padapter, struct sta_info *psta) +{ + struct cmd_obj* ph2c; + struct set_stakey_parm *psetstakey_para; + struct cmd_priv *pcmdpriv=&padapter->cmdpriv; + u8 res=_SUCCESS; + + ph2c = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj)); + if ( ph2c == NULL){ + res= _FAIL; + goto exit; + } + + psetstakey_para = (struct set_stakey_parm*)rtw_zmalloc(sizeof(struct set_stakey_parm)); + if(psetstakey_para==NULL){ + rtw_mfree((u8 *) ph2c, sizeof(struct cmd_obj)); + res=_FAIL; + goto exit; + } + + init_h2fwcmd_w_parm_no_rsp(ph2c, psetstakey_para, _SetStaKey_CMD_); + + + psetstakey_para->algorithm = (u8)psta->dot118021XPrivacy; + + _rtw_memcpy(psetstakey_para->addr, psta->hwaddr, ETH_ALEN); + + _rtw_memcpy(psetstakey_para->key, &psta->dot118021x_UncstKey, 16); + + + res = rtw_enqueue_cmd(pcmdpriv, ph2c); + +exit: + + return res; + +} + +static int set_group_key(struct adapter *padapter, u8 *key, u8 alg, int keyid) +{ + u8 keylen; + struct cmd_obj* pcmd; + struct setkey_parm *psetkeyparm; + struct cmd_priv *pcmdpriv=&(padapter->cmdpriv); + int res=_SUCCESS; + + DBG_8192C("%s\n", __FUNCTION__); + + pcmd = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj)); + if(pcmd==NULL){ + res= _FAIL; + goto exit; + } + psetkeyparm=(struct setkey_parm*)rtw_zmalloc(sizeof(struct setkey_parm)); + if(psetkeyparm==NULL){ + rtw_mfree((unsigned char *)pcmd, sizeof(struct cmd_obj)); + res= _FAIL; + goto exit; + } + + _rtw_memset(psetkeyparm, 0, sizeof(struct setkey_parm)); + + psetkeyparm->keyid=(u8)keyid; + if (is_wep_enc(alg)) + padapter->securitypriv.key_mask |= BIT(psetkeyparm->keyid); + + psetkeyparm->algorithm = alg; + + psetkeyparm->set_tx = 1; + + switch(alg) + { + case _WEP40_: + keylen = 5; + break; + case _WEP104_: + keylen = 13; + break; + case _TKIP_: + case _TKIP_WTMIC_: + case _AES_: + keylen = 16; + default: + keylen = 16; + } + + _rtw_memcpy(&(psetkeyparm->key[0]), key, keylen); + + pcmd->cmdcode = _SetKey_CMD_; + pcmd->parmbuf = (u8 *)psetkeyparm; + pcmd->cmdsz = (sizeof(struct setkey_parm)); + pcmd->rsp = NULL; + pcmd->rspsz = 0; + + + _rtw_init_listhead(&pcmd->list); + + res = rtw_enqueue_cmd(pcmdpriv, pcmd); + +exit: + + return res; + + +} + +static int set_wep_key(struct adapter *padapter, u8 *key, u8 keylen, int keyid) +{ + u8 alg; + + switch(keylen) + { + case 5: + alg =_WEP40_; + break; + case 13: + alg =_WEP104_; + break; + default: + alg =_NO_PRIVACY_; + } + + return set_group_key(padapter, key, alg, keyid); + +} + +static int rtw_cfg80211_ap_set_encryption(struct net_device *dev, struct ieee_param *param, u32 param_len) +{ + int ret = 0; + u32 wep_key_idx, wep_key_len,wep_total_len; + struct sta_info *psta = NULL, *pbcmc_sta = NULL; + struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); + struct mlme_priv *pmlmepriv = &padapter->mlmepriv; + struct security_priv* psecuritypriv=&(padapter->securitypriv); + struct sta_priv *pstapriv = &padapter->stapriv; + + DBG_8192C("%s\n", __FUNCTION__); + + param->u.crypt.err = 0; + param->u.crypt.alg[IEEE_CRYPT_ALG_NAME_LEN - 1] = '\0'; + + //sizeof(struct ieee_param) = 64 bytes; + //if (param_len != (u32) ((u8 *) param->u.crypt.key - (u8 *) param) + param->u.crypt.key_len) + if (param_len != sizeof(struct ieee_param) + param->u.crypt.key_len) + { + ret = -EINVAL; + goto exit; + } + + if (param->sta_addr[0] == 0xff && param->sta_addr[1] == 0xff && + param->sta_addr[2] == 0xff && param->sta_addr[3] == 0xff && + param->sta_addr[4] == 0xff && param->sta_addr[5] == 0xff) + { + if (param->u.crypt.idx >= WEP_KEYS) + { + ret = -EINVAL; + goto exit; + } + } + else + { + psta = rtw_get_stainfo(pstapriv, param->sta_addr); + if(!psta) + { + //ret = -EINVAL; + DBG_8192C("rtw_set_encryption(), sta has already been removed or never been added\n"); + goto exit; + } + } + + if (strcmp(param->u.crypt.alg, "none") == 0 && (psta==NULL)) + { + //todo:clear default encryption keys + + DBG_8192C("clear default encryption keys, keyid=%d\n", param->u.crypt.idx); + + goto exit; + } + + + if (strcmp(param->u.crypt.alg, "WEP") == 0 && (psta==NULL)) + { + DBG_8192C("r871x_set_encryption, crypt.alg = WEP\n"); + + wep_key_idx = param->u.crypt.idx; + wep_key_len = param->u.crypt.key_len; + + DBG_8192C("r871x_set_encryption, wep_key_idx=%d, len=%d\n", wep_key_idx, wep_key_len); + + if((wep_key_idx >= WEP_KEYS) || (wep_key_len<=0)) + { + ret = -EINVAL; + goto exit; + } + + if (wep_key_len > 0) + { + wep_key_len = wep_key_len <= 5 ? 5 : 13; + } + + if (psecuritypriv->bWepDefaultKeyIdxSet == 0) + { + //wep default key has not been set, so use this key index as default key. + + psecuritypriv->ndisencryptstatus = Ndis802_11Encryption1Enabled; + psecuritypriv->dot11PrivacyAlgrthm=_WEP40_; + psecuritypriv->dot118021XGrpPrivacy=_WEP40_; + + if(wep_key_len == 13) + { + psecuritypriv->dot11PrivacyAlgrthm=_WEP104_; + psecuritypriv->dot118021XGrpPrivacy=_WEP104_; + } + + psecuritypriv->dot11PrivacyKeyIndex = wep_key_idx; + } + + _rtw_memcpy(&(psecuritypriv->dot11DefKey[wep_key_idx].skey[0]), param->u.crypt.key, wep_key_len); + + psecuritypriv->dot11DefKeylen[wep_key_idx] = wep_key_len; + + set_wep_key(padapter, param->u.crypt.key, wep_key_len, wep_key_idx); + + goto exit; + + } + + + if(!psta && check_fwstate(pmlmepriv, WIFI_AP_STATE)) // //group key + { + if(param->u.crypt.set_tx == 0) //group key + { + if(strcmp(param->u.crypt.alg, "WEP") == 0) + { + DBG_8192C("%s, set group_key, WEP\n", __FUNCTION__); + + _rtw_memcpy(psecuritypriv->dot118021XGrpKey[param->u.crypt.idx].skey, param->u.crypt.key, (param->u.crypt.key_len>16 ?16:param->u.crypt.key_len)); + + psecuritypriv->dot118021XGrpPrivacy = _WEP40_; + if(param->u.crypt.key_len==13) + { + psecuritypriv->dot118021XGrpPrivacy = _WEP104_; + } + + } + else if(strcmp(param->u.crypt.alg, "TKIP") == 0) + { + DBG_8192C("%s, set group_key, TKIP\n", __FUNCTION__); + + psecuritypriv->dot118021XGrpPrivacy = _TKIP_; + + _rtw_memcpy(psecuritypriv->dot118021XGrpKey[param->u.crypt.idx].skey, param->u.crypt.key, (param->u.crypt.key_len>16 ?16:param->u.crypt.key_len)); + + //DEBUG_ERR("set key length :param->u.crypt.key_len=%d\n", param->u.crypt.key_len); + //set mic key + _rtw_memcpy(psecuritypriv->dot118021XGrptxmickey[param->u.crypt.idx].skey, &(param->u.crypt.key[16]), 8); + _rtw_memcpy(psecuritypriv->dot118021XGrprxmickey[param->u.crypt.idx].skey, &(param->u.crypt.key[24]), 8); + + psecuritypriv->busetkipkey = _TRUE; + + } + else if(strcmp(param->u.crypt.alg, "CCMP") == 0) + { + DBG_8192C("%s, set group_key, CCMP\n", __FUNCTION__); + + psecuritypriv->dot118021XGrpPrivacy = _AES_; + + _rtw_memcpy(psecuritypriv->dot118021XGrpKey[param->u.crypt.idx].skey, param->u.crypt.key, (param->u.crypt.key_len>16 ?16:param->u.crypt.key_len)); + } + else + { + DBG_8192C("%s, set group_key, none\n", __FUNCTION__); + + psecuritypriv->dot118021XGrpPrivacy = _NO_PRIVACY_; + } + + psecuritypriv->dot118021XGrpKeyid = param->u.crypt.idx; + + psecuritypriv->binstallGrpkey = _TRUE; + + psecuritypriv->dot11PrivacyAlgrthm = psecuritypriv->dot118021XGrpPrivacy;//!!! + + set_group_key(padapter, param->u.crypt.key, psecuritypriv->dot118021XGrpPrivacy, param->u.crypt.idx); + + pbcmc_sta=rtw_get_bcmc_stainfo(padapter); + if(pbcmc_sta) + { + pbcmc_sta->ieee8021x_blocked = _FALSE; + pbcmc_sta->dot118021XPrivacy= psecuritypriv->dot118021XGrpPrivacy;//rx will use bmc_sta's dot118021XPrivacy + } + + } + + goto exit; + + } + + if(psecuritypriv->dot11AuthAlgrthm == dot11AuthAlgrthm_8021X && psta) // psk/802_1x + { + if(check_fwstate(pmlmepriv, WIFI_AP_STATE)) + { + if(param->u.crypt.set_tx ==1) //pairwise key + { + _rtw_memcpy(psta->dot118021x_UncstKey.skey, param->u.crypt.key, (param->u.crypt.key_len>16 ?16:param->u.crypt.key_len)); + + if(strcmp(param->u.crypt.alg, "WEP") == 0) + { + DBG_8192C("%s, set pairwise key, WEP\n", __FUNCTION__); + + psta->dot118021XPrivacy = _WEP40_; + if(param->u.crypt.key_len==13) + { + psta->dot118021XPrivacy = _WEP104_; + } + } + else if(strcmp(param->u.crypt.alg, "TKIP") == 0) + { + DBG_8192C("%s, set pairwise key, TKIP\n", __FUNCTION__); + + psta->dot118021XPrivacy = _TKIP_; + + //DEBUG_ERR("set key length :param->u.crypt.key_len=%d\n", param->u.crypt.key_len); + //set mic key + _rtw_memcpy(psta->dot11tkiptxmickey.skey, &(param->u.crypt.key[16]), 8); + _rtw_memcpy(psta->dot11tkiprxmickey.skey, &(param->u.crypt.key[24]), 8); + + psecuritypriv->busetkipkey = _TRUE; + + } + else if(strcmp(param->u.crypt.alg, "CCMP") == 0) + { + + DBG_8192C("%s, set pairwise key, CCMP\n", __FUNCTION__); + + psta->dot118021XPrivacy = _AES_; + } + else + { + DBG_8192C("%s, set pairwise key, none\n", __FUNCTION__); + + psta->dot118021XPrivacy = _NO_PRIVACY_; + } + + set_pairwise_key(padapter, psta); + + psta->ieee8021x_blocked = _FALSE; + + psta->bpairwise_key_installed = _TRUE; + + } + else//group key??? + { + if(strcmp(param->u.crypt.alg, "WEP") == 0) + { + _rtw_memcpy(psecuritypriv->dot118021XGrpKey[param->u.crypt.idx].skey, param->u.crypt.key, (param->u.crypt.key_len>16 ?16:param->u.crypt.key_len)); + + psecuritypriv->dot118021XGrpPrivacy = _WEP40_; + if(param->u.crypt.key_len==13) + { + psecuritypriv->dot118021XGrpPrivacy = _WEP104_; + } + } + else if(strcmp(param->u.crypt.alg, "TKIP") == 0) + { + psecuritypriv->dot118021XGrpPrivacy = _TKIP_; + + _rtw_memcpy(psecuritypriv->dot118021XGrpKey[param->u.crypt.idx].skey, param->u.crypt.key, (param->u.crypt.key_len>16 ?16:param->u.crypt.key_len)); + + //DEBUG_ERR("set key length :param->u.crypt.key_len=%d\n", param->u.crypt.key_len); + //set mic key + _rtw_memcpy(psecuritypriv->dot118021XGrptxmickey[param->u.crypt.idx].skey, &(param->u.crypt.key[16]), 8); + _rtw_memcpy(psecuritypriv->dot118021XGrprxmickey[param->u.crypt.idx].skey, &(param->u.crypt.key[24]), 8); + + psecuritypriv->busetkipkey = _TRUE; + + } + else if(strcmp(param->u.crypt.alg, "CCMP") == 0) + { + psecuritypriv->dot118021XGrpPrivacy = _AES_; + + _rtw_memcpy(psecuritypriv->dot118021XGrpKey[param->u.crypt.idx].skey, param->u.crypt.key, (param->u.crypt.key_len>16 ?16:param->u.crypt.key_len)); + } + else + { + psecuritypriv->dot118021XGrpPrivacy = _NO_PRIVACY_; + } + + psecuritypriv->dot118021XGrpKeyid = param->u.crypt.idx; + + psecuritypriv->binstallGrpkey = _TRUE; + + psecuritypriv->dot11PrivacyAlgrthm = psecuritypriv->dot118021XGrpPrivacy;//!!! + + set_group_key(padapter, param->u.crypt.key, psecuritypriv->dot118021XGrpPrivacy, param->u.crypt.idx); + + pbcmc_sta=rtw_get_bcmc_stainfo(padapter); + if(pbcmc_sta) + { + pbcmc_sta->ieee8021x_blocked = _FALSE; + pbcmc_sta->dot118021XPrivacy= psecuritypriv->dot118021XGrpPrivacy;//rx will use bmc_sta's dot118021XPrivacy + } + + } + + } + + } + +exit: + + return ret; + +} +#endif + +static int rtw_cfg80211_set_encryption(struct net_device *dev, struct ieee_param *param, u32 param_len) +{ + int ret = 0; + u32 wep_key_idx, wep_key_len,wep_total_len; + struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); + struct mlme_priv *pmlmepriv = &padapter->mlmepriv; + struct security_priv *psecuritypriv = &padapter->securitypriv; +#ifdef CONFIG_P2P + struct wifidirect_info* pwdinfo = &padapter->wdinfo; +#endif //CONFIG_P2P + +_func_enter_; + + DBG_8192C("%s\n", __func__); + + param->u.crypt.err = 0; + param->u.crypt.alg[IEEE_CRYPT_ALG_NAME_LEN - 1] = '\0'; + + if (param_len < (u32) ((u8 *) param->u.crypt.key - (u8 *) param) + param->u.crypt.key_len) + { + ret = -EINVAL; + goto exit; + } + + if (param->sta_addr[0] == 0xff && param->sta_addr[1] == 0xff && + param->sta_addr[2] == 0xff && param->sta_addr[3] == 0xff && + param->sta_addr[4] == 0xff && param->sta_addr[5] == 0xff) + { + if (param->u.crypt.idx >= WEP_KEYS +#ifdef CONFIG_IEEE80211W + && param->u.crypt.idx > BIP_MAX_KEYID +#endif //CONFIG_IEEE80211W + ) + { + ret = -EINVAL; + goto exit; + } + } else { +#ifdef CONFIG_WAPI_SUPPORT + if (strcmp(param->u.crypt.alg, "SMS4")) +#endif + { + ret = -EINVAL; + goto exit; + } + } + + if (strcmp(param->u.crypt.alg, "WEP") == 0) + { + RT_TRACE(_module_rtl871x_ioctl_os_c,_drv_err_,("wpa_set_encryption, crypt.alg = WEP\n")); + DBG_8192C("wpa_set_encryption, crypt.alg = WEP\n"); + + wep_key_idx = param->u.crypt.idx; + wep_key_len = param->u.crypt.key_len; + + if ((wep_key_idx > WEP_KEYS) || (wep_key_len <= 0)) + { + ret = -EINVAL; + goto exit; + } + + if (psecuritypriv->bWepDefaultKeyIdxSet == 0) + { + //wep default key has not been set, so use this key index as default key. + + wep_key_len = wep_key_len <= 5 ? 5 : 13; + + psecuritypriv->ndisencryptstatus = Ndis802_11Encryption1Enabled; + psecuritypriv->dot11PrivacyAlgrthm = _WEP40_; + psecuritypriv->dot118021XGrpPrivacy = _WEP40_; + + if(wep_key_len==13) + { + psecuritypriv->dot11PrivacyAlgrthm = _WEP104_; + psecuritypriv->dot118021XGrpPrivacy = _WEP104_; + } + + psecuritypriv->dot11PrivacyKeyIndex = wep_key_idx; + } + + _rtw_memcpy(&(psecuritypriv->dot11DefKey[wep_key_idx].skey[0]), param->u.crypt.key, wep_key_len); + + psecuritypriv->dot11DefKeylen[wep_key_idx] = wep_key_len; + + rtw_set_key(padapter, psecuritypriv, wep_key_idx, 0,_TRUE); + + goto exit; + } + + if(padapter->securitypriv.dot11AuthAlgrthm == dot11AuthAlgrthm_8021X) // 802_1x + { + struct sta_info * psta,*pbcmc_sta; + struct sta_priv * pstapriv = &padapter->stapriv; + + //DBG_8192C("%s, : dot11AuthAlgrthm == dot11AuthAlgrthm_8021X \n", __func__); + + if (check_fwstate(pmlmepriv, WIFI_STATION_STATE | WIFI_MP_STATE) == _TRUE) //sta mode + { + psta = rtw_get_stainfo(pstapriv, get_bssid(pmlmepriv)); + if (psta == NULL) { + //DEBUG_ERR( ("Set wpa_set_encryption: Obtain Sta_info fail \n")); + DBG_8192C("%s, : Obtain Sta_info fail \n", __func__); + } + else + { + //Jeff: don't disable ieee8021x_blocked while clearing key + if (strcmp(param->u.crypt.alg, "none") != 0) + psta->ieee8021x_blocked = _FALSE; + + + if((padapter->securitypriv.ndisencryptstatus == Ndis802_11Encryption2Enabled)|| + (padapter->securitypriv.ndisencryptstatus == Ndis802_11Encryption3Enabled)) + { + psta->dot118021XPrivacy = padapter->securitypriv.dot11PrivacyAlgrthm; + } + + if(param->u.crypt.set_tx ==1)//pairwise key + { + + DBG_8192C("%s, : param->u.crypt.set_tx ==1 \n", __func__); + + _rtw_memcpy(psta->dot118021x_UncstKey.skey, param->u.crypt.key, (param->u.crypt.key_len>16 ?16:param->u.crypt.key_len)); + + if(strcmp(param->u.crypt.alg, "TKIP") == 0)//set mic key + { + //DEBUG_ERR(("\nset key length :param->u.crypt.key_len=%d\n", param->u.crypt.key_len)); + _rtw_memcpy(psta->dot11tkiptxmickey.skey, &(param->u.crypt.key[16]), 8); + _rtw_memcpy(psta->dot11tkiprxmickey.skey, &(param->u.crypt.key[24]), 8); + + padapter->securitypriv.busetkipkey=_FALSE; + //_set_timer(&padapter->securitypriv.tkip_timer, 50); + } + + //DEBUG_ERR((" param->u.crypt.key_len=%d\n",param->u.crypt.key_len)); + DBG_871X(" ~~~~set sta key:unicastkey\n"); + + rtw_setstakey_cmd(padapter, (unsigned char *)psta, _TRUE, _TRUE); + } + else//group key + { + if(strcmp(param->u.crypt.alg, "TKIP") == 0 || strcmp(param->u.crypt.alg, "CCMP") == 0) + { + _rtw_memcpy(padapter->securitypriv.dot118021XGrpKey[param->u.crypt.idx].skey, param->u.crypt.key,(param->u.crypt.key_len>16 ?16:param->u.crypt.key_len)); + _rtw_memcpy(padapter->securitypriv.dot118021XGrptxmickey[param->u.crypt.idx].skey,&(param->u.crypt.key[16]),8); + _rtw_memcpy(padapter->securitypriv.dot118021XGrprxmickey[param->u.crypt.idx].skey,&(param->u.crypt.key[24]),8); + padapter->securitypriv.binstallGrpkey = _TRUE; + //DEBUG_ERR((" param->u.crypt.key_len=%d\n", param->u.crypt.key_len)); + DBG_871X(" ~~~~set sta key:groupkey\n"); + + padapter->securitypriv.dot118021XGrpKeyid = param->u.crypt.idx; +#ifdef CONFIG_CONCURRENT_MODE + if (padapter->adapter_type == PRIMARY_ADAPTER) + rtw_set_key(padapter,&padapter->securitypriv,param->u.crypt.idx, 1,_TRUE); + else + DBG_871X_LEVEL(_drv_always_, "second interface do not set cam.\n"); +#else + rtw_set_key(padapter,&padapter->securitypriv,param->u.crypt.idx, 1,_TRUE); +#endif + } +#ifdef CONFIG_IEEE80211W + else if(strcmp(param->u.crypt.alg, "BIP") == 0) + { + int no; + //DBG_871X("BIP key_len=%d , index=%d @@@@@@@@@@@@@@@@@@\n", param->u.crypt.key_len, param->u.crypt.idx); + //save the IGTK key, length 16 bytes + _rtw_memcpy(padapter->securitypriv.dot11wBIPKey[param->u.crypt.idx].skey, param->u.crypt.key,(param->u.crypt.key_len>16 ?16:param->u.crypt.key_len)); + /*DBG_871X("IGTK key below:\n"); + for(no=0;no<16;no++) + printk(" %02x ", padapter->securitypriv.dot11wBIPKey[param->u.crypt.idx].skey[no]); + DBG_871X("\n");*/ + padapter->securitypriv.dot11wBIPKeyid = param->u.crypt.idx; + padapter->securitypriv.binstallBIPkey = _TRUE; + DBG_871X(" ~~~~set sta key:IGKT\n"); + } +#endif //CONFIG_IEEE80211W + +#ifdef CONFIG_P2P + if(pwdinfo->driver_interface == DRIVER_CFG80211 ) + { + if(rtw_p2p_chk_state(pwdinfo, P2P_STATE_PROVISIONING_ING)) + { + rtw_p2p_set_state(pwdinfo, P2P_STATE_PROVISIONING_DONE); + } + } +#endif //CONFIG_P2P + + } + } + + pbcmc_sta=rtw_get_bcmc_stainfo(padapter); + if(pbcmc_sta==NULL) + { + //DEBUG_ERR( ("Set OID_802_11_ADD_KEY: bcmc stainfo is null \n")); + } + else + { + //Jeff: don't disable ieee8021x_blocked while clearing key + if (strcmp(param->u.crypt.alg, "none") != 0) + pbcmc_sta->ieee8021x_blocked = _FALSE; + + if((padapter->securitypriv.ndisencryptstatus == Ndis802_11Encryption2Enabled)|| + (padapter->securitypriv.ndisencryptstatus == Ndis802_11Encryption3Enabled)) + { + pbcmc_sta->dot118021XPrivacy = padapter->securitypriv.dot11PrivacyAlgrthm; + } + } + } + else if(check_fwstate(pmlmepriv, WIFI_ADHOC_STATE)) //adhoc mode + { + } + } + +#ifdef CONFIG_WAPI_SUPPORT + if (strcmp(param->u.crypt.alg, "SMS4") == 0) + { + PRT_WAPI_T pWapiInfo = &padapter->wapiInfo; + PRT_WAPI_STA_INFO pWapiSta; + u8 WapiASUEPNInitialValueSrc[16] = {0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C} ; + u8 WapiAEPNInitialValueSrc[16] = {0x37,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C} ; + u8 WapiAEMultiCastPNInitialValueSrc[16] = {0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C} ; + + if(param->u.crypt.set_tx == 1) + { + list_for_each_entry(pWapiSta, &pWapiInfo->wapiSTAUsedList, list) { + if(_rtw_memcmp(pWapiSta->PeerMacAddr,param->sta_addr,6)) + { + _rtw_memcpy(pWapiSta->lastTxUnicastPN,WapiASUEPNInitialValueSrc,16); + + pWapiSta->wapiUsk.bSet = true; + _rtw_memcpy(pWapiSta->wapiUsk.dataKey,param->u.crypt.key,16); + _rtw_memcpy(pWapiSta->wapiUsk.micKey,param->u.crypt.key+16,16); + pWapiSta->wapiUsk.keyId = param->u.crypt.idx ; + pWapiSta->wapiUsk.bTxEnable = true; + + _rtw_memcpy(pWapiSta->lastRxUnicastPNBEQueue,WapiAEPNInitialValueSrc,16); + _rtw_memcpy(pWapiSta->lastRxUnicastPNBKQueue,WapiAEPNInitialValueSrc,16); + _rtw_memcpy(pWapiSta->lastRxUnicastPNVIQueue,WapiAEPNInitialValueSrc,16); + _rtw_memcpy(pWapiSta->lastRxUnicastPNVOQueue,WapiAEPNInitialValueSrc,16); + _rtw_memcpy(pWapiSta->lastRxUnicastPN,WapiAEPNInitialValueSrc,16); + pWapiSta->wapiUskUpdate.bTxEnable = false; + pWapiSta->wapiUskUpdate.bSet = false; + + if (psecuritypriv->sw_encrypt== false || psecuritypriv->sw_decrypt == false) + { + //set unicast key for ASUE + rtw_wapi_set_key(padapter, &pWapiSta->wapiUsk, pWapiSta, false, false); + } + } + } + } + else + { + list_for_each_entry(pWapiSta, &pWapiInfo->wapiSTAUsedList, list) { + if(_rtw_memcmp(pWapiSta->PeerMacAddr,get_bssid(pmlmepriv),6)) + { + pWapiSta->wapiMsk.bSet = true; + _rtw_memcpy(pWapiSta->wapiMsk.dataKey,param->u.crypt.key,16); + _rtw_memcpy(pWapiSta->wapiMsk.micKey,param->u.crypt.key+16,16); + pWapiSta->wapiMsk.keyId = param->u.crypt.idx ; + pWapiSta->wapiMsk.bTxEnable = false; + if(!pWapiSta->bSetkeyOk) + pWapiSta->bSetkeyOk = true; + pWapiSta->bAuthenticateInProgress = false; + + _rtw_memcpy(pWapiSta->lastRxMulticastPN, WapiAEMultiCastPNInitialValueSrc, 16); + + if (psecuritypriv->sw_decrypt == false) + { + //set rx broadcast key for ASUE + rtw_wapi_set_key(padapter, &pWapiSta->wapiMsk, pWapiSta, true, false); + } + } + + } + } + } +#endif + + +exit: + + DBG_8192C("%s, ret=%d\n", __func__, ret); + + _func_exit_; + + return ret; +} + +static int cfg80211_rtw_add_key(struct wiphy *wiphy, struct net_device *ndev, +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE) + u8 key_index, bool pairwise, const u8 *mac_addr, +#else // (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) + u8 key_index, const u8 *mac_addr, +#endif // (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) + struct key_params *params) +{ + char *alg_name; + u32 param_len; + struct ieee_param *param = NULL; + int ret=0; + struct wireless_dev *rtw_wdev = wiphy_to_wdev(wiphy); + struct adapter *padapter = wiphy_to_adapter(wiphy); + struct mlme_priv *pmlmepriv = &padapter->mlmepriv; + + DBG_871X(FUNC_NDEV_FMT" adding key for %pM\n", FUNC_NDEV_ARG(ndev), mac_addr); + DBG_871X("cipher=0x%x\n", params->cipher); + DBG_871X("key_len=0x%x\n", params->key_len); + DBG_871X("seq_len=0x%x\n", params->seq_len); + DBG_871X("key_index=%d\n", key_index); +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE) + DBG_871X("pairwise=%d\n", pairwise); +#endif // (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) + + param_len = sizeof(struct ieee_param) + params->key_len; + param = (struct ieee_param *)rtw_malloc(param_len); + if (param == NULL) + return -1; + + _rtw_memset(param, 0, param_len); + + param->cmd = IEEE_CMD_SET_ENCRYPTION; + _rtw_memset(param->sta_addr, 0xff, ETH_ALEN); + + switch (params->cipher) { + case IW_AUTH_CIPHER_NONE: + //todo: remove key + //remove = 1; + alg_name = "none"; + break; + case WLAN_CIPHER_SUITE_WEP40: + case WLAN_CIPHER_SUITE_WEP104: + alg_name = "WEP"; + break; + case WLAN_CIPHER_SUITE_TKIP: + alg_name = "TKIP"; + break; + case WLAN_CIPHER_SUITE_CCMP: + alg_name = "CCMP"; + break; +#ifdef CONFIG_IEEE80211W + case WLAN_CIPHER_SUITE_AES_CMAC: + alg_name = "BIP"; + break; +#endif //CONFIG_IEEE80211W +#ifdef CONFIG_WAPI_SUPPORT + case WLAN_CIPHER_SUITE_SMS4: + alg_name= "SMS4"; + if(pairwise == NL80211_KEYTYPE_PAIRWISE) { + if (key_index != 0 && key_index != 1) { + ret = -ENOTSUPP; + goto addkey_end; + } + _rtw_memcpy((void*)param->sta_addr, (void*)mac_addr, ETH_ALEN); + } else { + DBG_871X("mac_addr is null \n"); + } + DBG_871X("rtw_wx_set_enc_ext: SMS4 case \n"); + break; +#endif + + default: + ret = -ENOTSUPP; + goto addkey_end; + } + + strncpy((char *)param->u.crypt.alg, alg_name, IEEE_CRYPT_ALG_NAME_LEN); + + + if (!mac_addr || is_broadcast_ether_addr(mac_addr)) + { + param->u.crypt.set_tx = 0; //for wpa/wpa2 group key + } else { + param->u.crypt.set_tx = 1; //for wpa/wpa2 pairwise key + } + + + //param->u.crypt.idx = key_index - 1; + param->u.crypt.idx = key_index; + + if (params->seq_len && params->seq) + { + _rtw_memcpy(param->u.crypt.seq, params->seq, params->seq_len); + } + + if(params->key_len && params->key) + { + param->u.crypt.key_len = params->key_len; + _rtw_memcpy(param->u.crypt.key, params->key, params->key_len); + } + + if(check_fwstate(pmlmepriv, WIFI_STATION_STATE) == _TRUE) + { + ret = rtw_cfg80211_set_encryption(ndev, param, param_len); + } + else if(check_fwstate(pmlmepriv, WIFI_AP_STATE) == _TRUE) + { +#ifdef CONFIG_AP_MODE + if(mac_addr) + _rtw_memcpy(param->sta_addr, (void*)mac_addr, ETH_ALEN); + + ret = rtw_cfg80211_ap_set_encryption(ndev, param, param_len); +#endif + } + else + { + DBG_8192C("error! fw_state=0x%x, iftype=%d\n", pmlmepriv->fw_state, rtw_wdev->iftype); + + } + +addkey_end: + if(param) + { + rtw_mfree((u8*)param, param_len); + } + + return ret; + +} + +static int cfg80211_rtw_get_key(struct wiphy *wiphy, struct net_device *ndev, +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE) + u8 key_index, bool pairwise, const u8 *mac_addr, +#else // (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) + u8 key_index, const u8 *mac_addr, +#endif // (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) + void *cookie, + void (*callback)(void *cookie, + struct key_params*)) +{ +#if 0 + struct iwm_priv *iwm = ndev_to_iwm(ndev); + struct iwm_key *key = &iwm->keys[key_index]; + struct key_params params; + + IWM_DBG_WEXT(iwm, DBG, "Getting key %d\n", key_index); + + memset(¶ms, 0, sizeof(params)); + + params.cipher = key->cipher; + params.key_len = key->key_len; + params.seq_len = key->seq_len; + params.seq = key->seq; + params.key = key->key; + + callback(cookie, ¶ms); + + return key->key_len ? 0 : -ENOENT; +#endif + DBG_871X(FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(ndev)); + return 0; +} + +static int cfg80211_rtw_del_key(struct wiphy *wiphy, struct net_device *ndev, +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE) + u8 key_index, bool pairwise, const u8 *mac_addr) +#else // (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) + u8 key_index, const u8 *mac_addr) +#endif // (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) +{ + struct adapter *padapter = (struct adapter *)rtw_netdev_priv(ndev); + struct security_priv *psecuritypriv = &padapter->securitypriv; + + DBG_871X(FUNC_NDEV_FMT" key_index=%d\n", FUNC_NDEV_ARG(ndev), key_index); + + if (key_index == psecuritypriv->dot11PrivacyKeyIndex) + { + //clear the flag of wep default key set. + psecuritypriv->bWepDefaultKeyIdxSet = 0; + } + + return 0; +} + +static int cfg80211_rtw_set_default_key(struct wiphy *wiphy, + struct net_device *ndev, u8 key_index + #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) || defined(COMPAT_KERNEL_RELEASE) + , bool unicast, bool multicast + #endif + ) +{ + struct adapter *padapter = (struct adapter *)rtw_netdev_priv(ndev); + struct security_priv *psecuritypriv = &padapter->securitypriv; + + DBG_871X(FUNC_NDEV_FMT" key_index=%d" + #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) || defined(COMPAT_KERNEL_RELEASE) + ", unicast=%d, multicast=%d" + #endif + ".\n", FUNC_NDEV_ARG(ndev), key_index + #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) || defined(COMPAT_KERNEL_RELEASE) + , unicast, multicast + #endif + ); + + if ((key_index < WEP_KEYS) && ((psecuritypriv->dot11PrivacyAlgrthm == _WEP40_) || (psecuritypriv->dot11PrivacyAlgrthm == _WEP104_))) //set wep default key + { + psecuritypriv->ndisencryptstatus = Ndis802_11Encryption1Enabled; + + psecuritypriv->dot11PrivacyKeyIndex = key_index; + + psecuritypriv->dot11PrivacyAlgrthm = _WEP40_; + psecuritypriv->dot118021XGrpPrivacy = _WEP40_; + if (psecuritypriv->dot11DefKeylen[key_index] == 13) + { + psecuritypriv->dot11PrivacyAlgrthm = _WEP104_; + psecuritypriv->dot118021XGrpPrivacy = _WEP104_; + } + + psecuritypriv->bWepDefaultKeyIdxSet = 1; //set the flag to represent that wep default key has been set + } + + return 0; + +} + +static int cfg80211_rtw_get_station(struct wiphy *wiphy, + struct net_device *ndev, + u8 *mac, struct station_info *sinfo) +{ + int ret = 0; + struct adapter *padapter = wiphy_to_adapter(wiphy); + struct mlme_priv *pmlmepriv = &padapter->mlmepriv; + struct sta_info *psta = NULL; + struct sta_priv *pstapriv = &padapter->stapriv; + + sinfo->filled = 0; + + if (!mac) { + DBG_871X(FUNC_NDEV_FMT" mac==%p\n", FUNC_NDEV_ARG(ndev), mac); + ret = -ENOENT; + goto exit; + } + + psta = rtw_get_stainfo(pstapriv, mac); + if (psta == NULL) { + DBG_8192C("%s, sta_info is null\n", __func__); + ret = -ENOENT; + goto exit; + } + +#ifdef CONFIG_DEBUG_CFG80211 + DBG_871X(FUNC_NDEV_FMT" mac="MAC_FMT"\n", FUNC_NDEV_ARG(ndev), MAC_ARG(mac)); +#endif + + //for infra./P2PClient mode + if( check_fwstate(pmlmepriv, WIFI_STATION_STATE) + && check_fwstate(pmlmepriv, _FW_LINKED) + ) + { + struct wlan_network *cur_network = &(pmlmepriv->cur_network); + + if (_rtw_memcmp(mac, cur_network->network.MacAddress, ETH_ALEN) == _FALSE) { + DBG_871X("%s, mismatch bssid="MAC_FMT"\n", __func__, MAC_ARG(cur_network->network.MacAddress)); + ret = -ENOENT; + goto exit; + } + + sinfo->filled |= STATION_INFO_SIGNAL; + sinfo->signal = translate_percentage_to_dbm(padapter->recvpriv.signal_strength); + + sinfo->filled |= STATION_INFO_TX_BITRATE; + sinfo->txrate.legacy = rtw_get_cur_max_rate(padapter); + + sinfo->filled |= STATION_INFO_RX_PACKETS; + sinfo->rx_packets = sta_rx_data_pkts(psta); + + sinfo->filled |= STATION_INFO_TX_PACKETS; + sinfo->tx_packets = psta->sta_stats.tx_pkts; + + } + + //for Ad-Hoc/AP mode + if ((check_fwstate(pmlmepriv, WIFI_ADHOC_STATE) + ||check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) + ||check_fwstate(pmlmepriv, WIFI_AP_STATE)) + && check_fwstate(pmlmepriv, _FW_LINKED) + ) + { + //TODO: should acquire station info... + } + +exit: + return ret; +} + +extern int netdev_open(struct net_device *pnetdev); +#ifdef CONFIG_CONCURRENT_MODE +extern int netdev_if2_open(struct net_device *pnetdev); +#endif + +/* +enum nl80211_iftype { + NL80211_IFTYPE_UNSPECIFIED, + NL80211_IFTYPE_ADHOC, //1 + NL80211_IFTYPE_STATION, //2 + NL80211_IFTYPE_AP, //3 + NL80211_IFTYPE_AP_VLAN, + NL80211_IFTYPE_WDS, + NL80211_IFTYPE_MONITOR, //6 + NL80211_IFTYPE_MESH_POINT, + NL80211_IFTYPE_P2P_CLIENT, //8 + NL80211_IFTYPE_P2P_GO, //9 + //keep last + NUM_NL80211_IFTYPES, + NL80211_IFTYPE_MAX = NUM_NL80211_IFTYPES - 1 +}; +*/ +static int cfg80211_rtw_change_iface(struct wiphy *wiphy, + struct net_device *ndev, + enum nl80211_iftype type, u32 *flags, + struct vif_params *params) +{ + enum nl80211_iftype old_type; + NDIS_802_11_NETWORK_INFRASTRUCTURE networkType ; + struct adapter *padapter = wiphy_to_adapter(wiphy); + struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); + struct wireless_dev *rtw_wdev = wiphy_to_wdev(wiphy); +#ifdef CONFIG_P2P + struct wifidirect_info *pwdinfo= &(padapter->wdinfo); +#endif + int ret = 0; + u8 change = _FALSE; + + DBG_871X(FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(ndev)); + + if(adapter_to_dvobj(padapter)->processing_dev_remove == _TRUE) + { + ret= -EPERM; + goto exit; + } + + +#ifdef CONFIG_CONCURRENT_MODE + if(padapter->adapter_type == SECONDARY_ADAPTER) + { + DBG_871X(FUNC_NDEV_FMT" call netdev_if2_open\n", FUNC_NDEV_ARG(ndev)); + if(netdev_if2_open(ndev) != 0) { + ret= -EPERM; + goto exit; + } + } + else if(padapter->adapter_type == PRIMARY_ADAPTER) +#endif //CONFIG_CONCURRENT_MODE + { + DBG_871X(FUNC_NDEV_FMT" call netdev_open\n", FUNC_NDEV_ARG(ndev)); + if(netdev_open(ndev) != 0) { + ret= -EPERM; + goto exit; + } + } + + if(_FAIL == rtw_pwr_wakeup(padapter)) { + ret= -EPERM; + goto exit; + } + + old_type = rtw_wdev->iftype; + DBG_871X(FUNC_NDEV_FMT" old_iftype=%d, new_iftype=%d\n", + FUNC_NDEV_ARG(ndev), old_type, type); + + if(old_type != type) + { + change = _TRUE; + pmlmeext->action_public_rxseq = 0xffff; + pmlmeext->action_public_dialog_token = 0xff; + } + + switch (type) { + case NL80211_IFTYPE_ADHOC: + networkType = Ndis802_11IBSS; + break; +#if defined(CONFIG_P2P) && ((LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE)) + case NL80211_IFTYPE_P2P_CLIENT: +#endif + case NL80211_IFTYPE_STATION: + networkType = Ndis802_11Infrastructure; + #ifdef CONFIG_P2P + if(pwdinfo->driver_interface == DRIVER_CFG80211 ) + { + if(change && rtw_p2p_chk_role(pwdinfo, P2P_ROLE_GO)) + { + //it means remove GO and change mode from AP(GO) to station(P2P DEVICE) + rtw_p2p_set_role(pwdinfo, P2P_ROLE_DEVICE); + rtw_p2p_set_state(pwdinfo, rtw_p2p_pre_state(pwdinfo)); + + DBG_8192C("%s, role=%d, p2p_state=%d, pre_p2p_state=%d\n", __func__, rtw_p2p_role(pwdinfo), rtw_p2p_state(pwdinfo), rtw_p2p_pre_state(pwdinfo)); + } + } + #endif //CONFIG_P2P + break; +#if defined(CONFIG_P2P) && ((LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE)) + case NL80211_IFTYPE_P2P_GO: +#endif + case NL80211_IFTYPE_AP: + networkType = Ndis802_11APMode; + #ifdef CONFIG_P2P + if(pwdinfo->driver_interface == DRIVER_CFG80211 ) + { + if(change && !rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) + { + //it means P2P Group created, we will be GO and change mode from P2P DEVICE to AP(GO) + rtw_p2p_set_role(pwdinfo, P2P_ROLE_GO); + } + } + #endif //CONFIG_P2P + break; + default: + return -EOPNOTSUPP; + } + + rtw_wdev->iftype = type; + + if (rtw_set_802_11_infrastructure_mode(padapter, networkType) ==_FALSE) + { + rtw_wdev->iftype = old_type; + ret = -EPERM; + goto exit; + } + + rtw_setopmode_cmd(padapter, networkType,_TRUE); + +exit: + + return ret; +} + +void rtw_cfg80211_indicate_scan_done(struct rtw_wdev_priv *pwdev_priv, bool aborted) +{ + _irqL irqL; + + _enter_critical_bh(&pwdev_priv->scan_req_lock, &irqL); + if(pwdev_priv->scan_request != NULL) + { + //struct cfg80211_scan_request *scan_request = pwdev_priv->scan_request; + + #ifdef CONFIG_DEBUG_CFG80211 + DBG_871X("%s with scan req\n", __FUNCTION__); + #endif + + //avoid WARN_ON(request != wiphy_to_dev(request->wiphy)->scan_req); + //if(scan_request == wiphy_to_dev(scan_request->wiphy)->scan_req) + if(pwdev_priv->scan_request->wiphy != pwdev_priv->rtw_wdev->wiphy) + { + DBG_8192C("error wiphy compare\n"); + } + else + { + cfg80211_scan_done(pwdev_priv->scan_request, aborted); + } + + pwdev_priv->scan_request = NULL; + + } else { + #ifdef CONFIG_DEBUG_CFG80211 + DBG_871X("%s without scan req\n", __FUNCTION__); + #endif + } + _exit_critical_bh(&pwdev_priv->scan_req_lock, &irqL); +} + +void rtw_cfg80211_surveydone_event_callback(struct adapter *padapter) +{ + _irqL irqL; + _list *plist, *phead; + struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); + _queue *queue = &(pmlmepriv->scanned_queue); + struct wlan_network *pnetwork = NULL; + u32 cnt=0; + u32 wait_for_surveydone; + sint wait_status; +#ifdef CONFIG_P2P + struct wifidirect_info* pwdinfo = &padapter->wdinfo; +#endif //CONFIG_P2P + struct rtw_wdev_priv *pwdev_priv = wdev_to_priv(padapter->rtw_wdev); + +#ifdef CONFIG_DEBUG_CFG80211 + DBG_8192C("%s\n", __func__); +#endif + + _enter_critical_bh(&(pmlmepriv->scanned_queue.lock), &irqL); + + phead = get_list_head(queue); + plist = get_next(phead); + + while(1) + { + if (rtw_end_of_queue_search(phead,plist)== _TRUE) + break; + + pnetwork = LIST_CONTAINOR(plist, struct wlan_network, list); + + //report network only if the current channel set contains the channel to which this network belongs + if(rtw_ch_set_search_ch(padapter->mlmeextpriv.channel_set, pnetwork->network.Configuration.DSConfig) >= 0 + && _TRUE == rtw_validate_ssid(&(pnetwork->network.Ssid)) + ) + { + //ev=translate_scan(padapter, a, pnetwork, ev, stop); + rtw_cfg80211_inform_bss(padapter, pnetwork); + } + + plist = get_next(plist); + + } + + _exit_critical_bh(&(pmlmepriv->scanned_queue.lock), &irqL); + + //call this after other things have been done + rtw_cfg80211_indicate_scan_done(wdev_to_priv(padapter->rtw_wdev), _FALSE); +} + +static int rtw_cfg80211_set_probe_req_wpsp2pie(struct adapter *padapter, char *buf, int len) +{ + int ret = 0; + uint wps_ielen = 0; + u8 *wps_ie; + u32 p2p_ielen = 0; + u8 *p2p_ie; + u32 wfd_ielen = 0; + u8 *wfd_ie; + struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); + +#ifdef CONFIG_DEBUG_CFG80211 + DBG_8192C("%s, ielen=%d\n", __func__, len); +#endif + + if(len>0) + { + if((wps_ie = rtw_get_wps_ie(buf, len, NULL, &wps_ielen))) + { + #ifdef CONFIG_DEBUG_CFG80211 + DBG_8192C("probe_req_wps_ielen=%d\n", wps_ielen); + #endif + + if(pmlmepriv->wps_probe_req_ie) + { + u32 free_len = pmlmepriv->wps_probe_req_ie_len; + pmlmepriv->wps_probe_req_ie_len = 0; + rtw_mfree(pmlmepriv->wps_probe_req_ie, free_len); + pmlmepriv->wps_probe_req_ie = NULL; + } + + pmlmepriv->wps_probe_req_ie = rtw_malloc(wps_ielen); + if ( pmlmepriv->wps_probe_req_ie == NULL) { + DBG_8192C("%s()-%d: rtw_malloc() ERROR!\n", __FUNCTION__, __LINE__); + return -EINVAL; + + } + _rtw_memcpy(pmlmepriv->wps_probe_req_ie, wps_ie, wps_ielen); + pmlmepriv->wps_probe_req_ie_len = wps_ielen; + } + + //buf += wps_ielen; + //len -= wps_ielen; + + #ifdef CONFIG_P2P + if((p2p_ie=rtw_get_p2p_ie(buf, len, NULL, &p2p_ielen))) + { + struct wifidirect_info *wdinfo = &padapter->wdinfo; + u32 attr_contentlen = 0; + u8 listen_ch_attr[5]; + + #ifdef CONFIG_DEBUG_CFG80211 + DBG_8192C("probe_req_p2p_ielen=%d\n", p2p_ielen); + #endif + + if(pmlmepriv->p2p_probe_req_ie) + { + u32 free_len = pmlmepriv->p2p_probe_req_ie_len; + pmlmepriv->p2p_probe_req_ie_len = 0; + rtw_mfree(pmlmepriv->p2p_probe_req_ie, free_len); + pmlmepriv->p2p_probe_req_ie = NULL; + } + + pmlmepriv->p2p_probe_req_ie = rtw_malloc(p2p_ielen); + if ( pmlmepriv->p2p_probe_req_ie == NULL) { + DBG_8192C("%s()-%d: rtw_malloc() ERROR!\n", __FUNCTION__, __LINE__); + return -EINVAL; + + } + _rtw_memcpy(pmlmepriv->p2p_probe_req_ie, p2p_ie, p2p_ielen); + pmlmepriv->p2p_probe_req_ie_len = p2p_ielen; + + if(rtw_get_p2p_attr_content(p2p_ie, p2p_ielen, P2P_ATTR_LISTEN_CH, (u8*)listen_ch_attr, (uint*) &attr_contentlen) + && attr_contentlen == 5) + { + if (wdinfo->listen_channel != listen_ch_attr[4]) { + DBG_871X(FUNC_ADPT_FMT" listen channel - country:%c%c%c, class:%u, ch:%u\n", + FUNC_ADPT_ARG(padapter), listen_ch_attr[0], listen_ch_attr[1], listen_ch_attr[2], + listen_ch_attr[3], listen_ch_attr[4]); + wdinfo->listen_channel = listen_ch_attr[4]; + } + } + } + #endif //CONFIG_P2P + + //buf += p2p_ielen; + //len -= p2p_ielen; + + #ifdef CONFIG_WFD + if(rtw_get_wfd_ie(buf, len, NULL, &wfd_ielen)) + { + #ifdef CONFIG_DEBUG_CFG80211 + DBG_8192C("probe_req_wfd_ielen=%d\n", wfd_ielen); + #endif + + if(pmlmepriv->wfd_probe_req_ie) + { + u32 free_len = pmlmepriv->wfd_probe_req_ie_len; + pmlmepriv->wfd_probe_req_ie_len = 0; + rtw_mfree(pmlmepriv->wfd_probe_req_ie, free_len); + pmlmepriv->wfd_probe_req_ie = NULL; + } + + pmlmepriv->wfd_probe_req_ie = rtw_malloc(wfd_ielen); + if ( pmlmepriv->wfd_probe_req_ie == NULL) { + DBG_8192C("%s()-%d: rtw_malloc() ERROR!\n", __FUNCTION__, __LINE__); + return -EINVAL; + + } + rtw_get_wfd_ie(buf, len, pmlmepriv->wfd_probe_req_ie, &pmlmepriv->wfd_probe_req_ie_len); + } + #endif //CONFIG_WFD + + } + + return ret; + +} + +static int cfg80211_rtw_scan(struct wiphy *wiphy + #if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 6, 0)) + , struct net_device *ndev + #endif + , struct cfg80211_scan_request *request) +{ + int i; + u8 _status = _FALSE; + int ret = 0; + struct adapter *padapter = wiphy_to_adapter(wiphy); + struct mlme_priv *pmlmepriv= &padapter->mlmepriv; + NDIS_802_11_SSID ssid[RTW_SSID_SCAN_AMOUNT]; + struct rtw_ieee80211_channel ch[RTW_CHANNEL_SCAN_AMOUNT]; + _irqL irqL; + u8 *wps_ie=NULL; + uint wps_ielen=0; + u8 *p2p_ie=NULL; + uint p2p_ielen=0; + u8 survey_times=3; + u8 survey_times_for_one_ch=6; +#ifdef CONFIG_P2P + struct wifidirect_info *pwdinfo= &(padapter->wdinfo); +#endif //CONFIG_P2P + struct rtw_wdev_priv *pwdev_priv = wdev_to_priv(padapter->rtw_wdev); + struct cfg80211_ssid *ssids = request->ssids; + int social_channel = 0, j = 0; + bool need_indicate_scan_done = _FALSE; +#ifdef CONFIG_CONCURRENT_MODE + PADAPTER pbuddy_adapter = NULL; + struct mlme_priv *pbuddy_mlmepriv = NULL; +#endif //CONFIG_CONCURRENT_MODE + +//#ifdef CONFIG_DEBUG_CFG80211 + DBG_871X(FUNC_ADPT_FMT"\n", FUNC_ADPT_ARG(padapter)); +//#endif + +#ifdef CONFIG_CONCURRENT_MODE + if (padapter->pbuddy_adapter) { + pbuddy_adapter = padapter->pbuddy_adapter; + pbuddy_mlmepriv = &(pbuddy_adapter->mlmepriv); + } +#endif //CONFIG_CONCURRENT_MODE + + _enter_critical_bh(&pwdev_priv->scan_req_lock, &irqL); + pwdev_priv->scan_request = request; + _exit_critical_bh(&pwdev_priv->scan_req_lock, &irqL); + + if (check_fwstate(pmlmepriv, WIFI_AP_STATE) == _TRUE) + { +#ifdef CONFIG_DEBUG_CFG80211 + DBG_871X("%s under WIFI_AP_STATE\n", __FUNCTION__); +#endif + + if (check_fwstate(pmlmepriv, WIFI_UNDER_WPS|_FW_UNDER_SURVEY|_FW_UNDER_LINKING) == _TRUE) + { + DBG_8192C("%s, fwstate=0x%x\n", __func__, pmlmepriv->fw_state); + + if(check_fwstate(pmlmepriv, WIFI_UNDER_WPS)) + { + DBG_8192C("AP mode process WPS \n"); + } + + need_indicate_scan_done = _TRUE; + goto check_need_indicate_scan_done; + } + } + + if(_FAIL == rtw_pwr_wakeup(padapter)) { + need_indicate_scan_done = _TRUE; + goto check_need_indicate_scan_done; + } + + #ifdef CONFIG_P2P + if( pwdinfo->driver_interface == DRIVER_CFG80211 ) + { + if(ssids->ssid != NULL + && _rtw_memcmp(ssids->ssid, "DIRECT-", 7) + && rtw_get_p2p_ie((u8 *)request->ie, request->ie_len, NULL, NULL) + ) + { + if(rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) + { + rtw_p2p_enable(padapter, P2P_ROLE_DEVICE); + wdev_to_priv(padapter->rtw_wdev)->p2p_enabled = _TRUE; + } + else + { + rtw_p2p_set_pre_state(pwdinfo, rtw_p2p_state(pwdinfo)); + #ifdef CONFIG_DEBUG_CFG80211 + DBG_8192C("%s, role=%d, p2p_state=%d\n", __func__, rtw_p2p_role(pwdinfo), rtw_p2p_state(pwdinfo)); + #endif + } + rtw_p2p_set_state(pwdinfo, P2P_STATE_LISTEN); + + if(request->n_channels == 3 && + request->channels[0]->hw_value == 1 && + request->channels[1]->hw_value == 6 && + request->channels[2]->hw_value == 11 + ) + { + social_channel = 1; + } + } + } + #endif //CONFIG_P2P + + if(request->ie && request->ie_len>0) + { + rtw_cfg80211_set_probe_req_wpsp2pie(padapter, (u8 *)request->ie, request->ie_len ); + } + + if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY) == _TRUE) { + DBG_8192C("%s, fwstate=0x%x\n", __func__, pmlmepriv->fw_state); + need_indicate_scan_done = _TRUE; + goto check_need_indicate_scan_done; + } else if (check_fwstate(pmlmepriv, _FW_UNDER_LINKING) == _TRUE) { + DBG_8192C("%s, fwstate=0x%x\n", __func__, pmlmepriv->fw_state); + ret = -EBUSY; + goto check_need_indicate_scan_done; + } + + if (pmlmepriv->LinkDetectInfo.bBusyTraffic == _TRUE) + { + DBG_8192C("%s, bBusyTraffic == _TRUE\n", __func__); + need_indicate_scan_done = _TRUE; + goto check_need_indicate_scan_done; + } + + if (rtw_is_scan_deny(padapter)){ + DBG_871X(FUNC_ADPT_FMT ": scan deny\n", FUNC_ADPT_ARG(padapter)); + need_indicate_scan_done = _TRUE; + goto check_need_indicate_scan_done; + } + +#ifdef CONFIG_CONCURRENT_MODE + if(pbuddy_mlmepriv && (pbuddy_mlmepriv->LinkDetectInfo.bBusyTraffic == _TRUE)) + { + DBG_8192C("%s, bBusyTraffic == _TRUE at buddy_intf\n", __func__); + need_indicate_scan_done = _TRUE; + goto check_need_indicate_scan_done; + } + + if (check_buddy_fwstate(padapter, + _FW_UNDER_SURVEY|_FW_UNDER_LINKING|WIFI_UNDER_WPS) == _TRUE) + { + if(check_buddy_fwstate(padapter, _FW_UNDER_SURVEY)) + { + DBG_8192C("scanning_via_buddy_intf\n"); + pmlmepriv->scanning_via_buddy_intf = _TRUE; + } + + DBG_8192C("buddy_intf's mlme state:0x%x\n", pbuddy_mlmepriv->fw_state); + + need_indicate_scan_done = _TRUE; + goto check_need_indicate_scan_done; + } +#endif + + +#ifdef CONFIG_P2P + if( pwdinfo->driver_interface == DRIVER_CFG80211 ) + { + if(!rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE) && !rtw_p2p_chk_state(pwdinfo, P2P_STATE_IDLE)) + { + rtw_p2p_set_state(pwdinfo, P2P_STATE_FIND_PHASE_SEARCH); + rtw_free_network_queue(padapter, _TRUE); + + if(social_channel == 0) + rtw_p2p_findphase_ex_set(pwdinfo, P2P_FINDPHASE_EX_NONE); + else + rtw_p2p_findphase_ex_set(pwdinfo, P2P_FINDPHASE_EX_SOCIAL_LAST); + } + } +#endif //CONFIG_P2P + + + _rtw_memset(ssid, 0, sizeof(NDIS_802_11_SSID)*RTW_SSID_SCAN_AMOUNT); + //parsing request ssids, n_ssids + for (i = 0; i < request->n_ssids && i < RTW_SSID_SCAN_AMOUNT; i++) { + #ifdef CONFIG_DEBUG_CFG80211 + DBG_8192C("ssid=%s, len=%d\n", ssids[i].ssid, ssids[i].ssid_len); + #endif + _rtw_memcpy(ssid[i].Ssid, ssids[i].ssid, ssids[i].ssid_len); + ssid[i].SsidLength = ssids[i].ssid_len; + } + + /* parsing channels, n_channels */ + _rtw_memset(ch, 0, sizeof(struct rtw_ieee80211_channel)*RTW_CHANNEL_SCAN_AMOUNT); + for (i=0;in_channels && ichannels[i])); + #endif + ch[i].hw_value = request->channels[i]->hw_value; + ch[i].flags = request->channels[i]->flags; + } + + _enter_critical_bh(&pmlmepriv->lock, &irqL); + if (request->n_channels == 1) { + for(i=1;in_channels <= 4) { + for(j=request->n_channels-1;j>=0;j--) + for(i=0;in_channels); + } else { + _status = rtw_sitesurvey_cmd(padapter, ssid, RTW_SSID_SCAN_AMOUNT, NULL, 0); + } + _exit_critical_bh(&pmlmepriv->lock, &irqL); + + + if(_status == _FALSE) + { + ret = -1; + } + +check_need_indicate_scan_done: + if(need_indicate_scan_done) + rtw_cfg80211_surveydone_event_callback(padapter); + +exit: + + return ret; + +} + +static int cfg80211_rtw_set_wiphy_params(struct wiphy *wiphy, u32 changed) +{ +#if 0 + struct iwm_priv *iwm = wiphy_to_iwm(wiphy); + + if (changed & WIPHY_PARAM_RTS_THRESHOLD && + (iwm->conf.rts_threshold != wiphy->rts_threshold)) { + int ret; + + iwm->conf.rts_threshold = wiphy->rts_threshold; + + ret = iwm_umac_set_config_fix(iwm, UMAC_PARAM_TBL_CFG_FIX, + CFG_RTS_THRESHOLD, + iwm->conf.rts_threshold); + if (ret < 0) + return ret; + } + + if (changed & WIPHY_PARAM_FRAG_THRESHOLD && + (iwm->conf.frag_threshold != wiphy->frag_threshold)) { + int ret; + + iwm->conf.frag_threshold = wiphy->frag_threshold; + + ret = iwm_umac_set_config_fix(iwm, UMAC_PARAM_TBL_FA_CFG_FIX, + CFG_FRAG_THRESHOLD, + iwm->conf.frag_threshold); + if (ret < 0) + return ret; + } +#endif + DBG_8192C("%s\n", __func__); + return 0; +} + + + +static int rtw_cfg80211_set_wpa_version(struct security_priv *psecuritypriv, u32 wpa_version) +{ + DBG_8192C("%s, wpa_version=%d\n", __func__, wpa_version); + + if (!wpa_version) { + psecuritypriv->ndisauthtype = Ndis802_11AuthModeOpen; + return 0; + } + + + if (wpa_version & (NL80211_WPA_VERSION_1 | NL80211_WPA_VERSION_2)) + { + psecuritypriv->ndisauthtype = Ndis802_11AuthModeWPAPSK; + } + +/* + if (wpa_version & NL80211_WPA_VERSION_2) + { + psecuritypriv->ndisauthtype = Ndis802_11AuthModeWPA2PSK; + } +*/ + + return 0; + +} + +static int rtw_cfg80211_set_auth_type(struct security_priv *psecuritypriv, + enum nl80211_auth_type sme_auth_type) +{ + DBG_8192C("%s, nl80211_auth_type=%d\n", __func__, sme_auth_type); + + + switch (sme_auth_type) { + case NL80211_AUTHTYPE_AUTOMATIC: + + psecuritypriv->dot11AuthAlgrthm = dot11AuthAlgrthm_Auto; + + break; + case NL80211_AUTHTYPE_OPEN_SYSTEM: + + psecuritypriv->dot11AuthAlgrthm = dot11AuthAlgrthm_Open; + + if(psecuritypriv->ndisauthtype>Ndis802_11AuthModeWPA) + psecuritypriv->dot11AuthAlgrthm = dot11AuthAlgrthm_8021X; + +#ifdef CONFIG_WAPI_SUPPORT + if(psecuritypriv->ndisauthtype == Ndis802_11AuthModeWAPI) + psecuritypriv->dot11AuthAlgrthm = dot11AuthAlgrthm_WAPI; +#endif + + break; + case NL80211_AUTHTYPE_SHARED_KEY: + + psecuritypriv->dot11AuthAlgrthm = dot11AuthAlgrthm_Shared; + + psecuritypriv->ndisencryptstatus = Ndis802_11Encryption1Enabled; + + + break; + default: + psecuritypriv->dot11AuthAlgrthm = dot11AuthAlgrthm_Open; + //return -ENOTSUPP; + } + + return 0; + +} + +static int rtw_cfg80211_set_cipher(struct security_priv *psecuritypriv, u32 cipher, bool ucast) +{ + u32 ndisencryptstatus = Ndis802_11EncryptionDisabled; + + u32 *profile_cipher = ucast ? &psecuritypriv->dot11PrivacyAlgrthm : + &psecuritypriv->dot118021XGrpPrivacy; + + DBG_8192C("%s, ucast=%d, cipher=0x%x\n", __func__, ucast, cipher); + + + if (!cipher) { + *profile_cipher = _NO_PRIVACY_; + psecuritypriv->ndisencryptstatus = ndisencryptstatus; + return 0; + } + + switch (cipher) { + case IW_AUTH_CIPHER_NONE: + *profile_cipher = _NO_PRIVACY_; + ndisencryptstatus = Ndis802_11EncryptionDisabled; +#ifdef CONFIG_WAPI_SUPPORT + if(psecuritypriv->dot11PrivacyAlgrthm ==_SMS4_ ) + { + *profile_cipher = _SMS4_; + } +#endif + break; + case WLAN_CIPHER_SUITE_WEP40: + *profile_cipher = _WEP40_; + ndisencryptstatus = Ndis802_11Encryption1Enabled; + break; + case WLAN_CIPHER_SUITE_WEP104: + *profile_cipher = _WEP104_; + ndisencryptstatus = Ndis802_11Encryption1Enabled; + break; + case WLAN_CIPHER_SUITE_TKIP: + *profile_cipher = _TKIP_; + ndisencryptstatus = Ndis802_11Encryption2Enabled; + break; + case WLAN_CIPHER_SUITE_CCMP: + *profile_cipher = _AES_; + ndisencryptstatus = Ndis802_11Encryption3Enabled; + break; +#ifdef CONFIG_WAPI_SUPPORT + case WLAN_CIPHER_SUITE_SMS4: + *profile_cipher = _SMS4_; + ndisencryptstatus = Ndis802_11_EncrypteionWAPI; + break; +#endif + default: + DBG_8192C("Unsupported cipher: 0x%x\n", cipher); + return -ENOTSUPP; + } + + if(ucast) + { + psecuritypriv->ndisencryptstatus = ndisencryptstatus; + + //if(psecuritypriv->dot11PrivacyAlgrthm >= _AES_) + // psecuritypriv->ndisauthtype = Ndis802_11AuthModeWPA2PSK; + } + + return 0; +} + +static int rtw_cfg80211_set_key_mgt(struct security_priv *psecuritypriv, u32 key_mgt) +{ + DBG_8192C("%s, key_mgt=0x%x\n", __func__, key_mgt); + + if (key_mgt == WLAN_AKM_SUITE_8021X) + //*auth_type = UMAC_AUTH_TYPE_8021X; + psecuritypriv->dot11AuthAlgrthm = dot11AuthAlgrthm_8021X; + else if (key_mgt == WLAN_AKM_SUITE_PSK) { + psecuritypriv->dot11AuthAlgrthm = dot11AuthAlgrthm_8021X; + } +#ifdef CONFIG_WAPI_SUPPORT + else if(key_mgt ==WLAN_AKM_SUITE_WAPI_PSK){ + psecuritypriv->dot11AuthAlgrthm = dot11AuthAlgrthm_WAPI; + } + else if(key_mgt ==WLAN_AKM_SUITE_WAPI_CERT){ + psecuritypriv->dot11AuthAlgrthm = dot11AuthAlgrthm_WAPI; + } +#endif + + + else { + DBG_8192C("Invalid key mgt: 0x%x\n", key_mgt); + //return -EINVAL; + } + + return 0; +} + +static int rtw_cfg80211_set_wpa_ie(struct adapter *padapter, u8 *pie, size_t ielen) +{ + u8 *buf=NULL, *pos=NULL; + u32 left; + int group_cipher = 0, pairwise_cipher = 0; + int ret = 0; + int wpa_ielen=0; + int wpa2_ielen=0; + u8 *pwpa, *pwpa2; + u8 null_addr[]= {0,0,0,0,0,0}; + + if (pie == NULL || !ielen) { + /* Treat this as normal case, but need to clear WIFI_UNDER_WPS */ + _clr_fwstate_(&padapter->mlmepriv, WIFI_UNDER_WPS); + goto exit; + } + + if (ielen > MAX_WPA_IE_LEN+MAX_WPS_IE_LEN+MAX_P2P_IE_LEN) { + ret = -EINVAL; + goto exit; + } + + buf = rtw_zmalloc(ielen); + if (buf == NULL){ + ret = -ENOMEM; + goto exit; + } + + _rtw_memcpy(buf, pie , ielen); + + //dump + { + int i; + DBG_8192C("set wpa_ie(length:%zu):\n", ielen); + for(i=0;i0) + { + if(rtw_parse_wpa_ie(pwpa, wpa_ielen+2, &group_cipher, &pairwise_cipher, NULL) == _SUCCESS) + { + padapter->securitypriv.dot11AuthAlgrthm= dot11AuthAlgrthm_8021X; + padapter->securitypriv.ndisauthtype=Ndis802_11AuthModeWPAPSK; + _rtw_memcpy(padapter->securitypriv.supplicant_ie, &pwpa[0], wpa_ielen+2); + + DBG_8192C("got wpa_ie, wpa_ielen:%u\n", wpa_ielen); + } + } + + pwpa2 = rtw_get_wpa2_ie(buf, &wpa2_ielen, ielen); + if(pwpa2 && wpa2_ielen>0) + { + if(rtw_parse_wpa2_ie(pwpa2, wpa2_ielen+2, &group_cipher, &pairwise_cipher, NULL) == _SUCCESS) + { + padapter->securitypriv.dot11AuthAlgrthm= dot11AuthAlgrthm_8021X; + padapter->securitypriv.ndisauthtype=Ndis802_11AuthModeWPA2PSK; + _rtw_memcpy(padapter->securitypriv.supplicant_ie, &pwpa2[0], wpa2_ielen+2); + + DBG_8192C("got wpa2_ie, wpa2_ielen:%u\n", wpa2_ielen); + } + } + + if (group_cipher == 0) + { + group_cipher = WPA_CIPHER_NONE; + } + if (pairwise_cipher == 0) + { + pairwise_cipher = WPA_CIPHER_NONE; + } + + switch(group_cipher) + { + case WPA_CIPHER_NONE: + padapter->securitypriv.dot118021XGrpPrivacy=_NO_PRIVACY_; + padapter->securitypriv.ndisencryptstatus=Ndis802_11EncryptionDisabled; + break; + case WPA_CIPHER_WEP40: + padapter->securitypriv.dot118021XGrpPrivacy=_WEP40_; + padapter->securitypriv.ndisencryptstatus = Ndis802_11Encryption1Enabled; + break; + case WPA_CIPHER_TKIP: + padapter->securitypriv.dot118021XGrpPrivacy=_TKIP_; + padapter->securitypriv.ndisencryptstatus = Ndis802_11Encryption2Enabled; + break; + case WPA_CIPHER_CCMP: + padapter->securitypriv.dot118021XGrpPrivacy=_AES_; + padapter->securitypriv.ndisencryptstatus = Ndis802_11Encryption3Enabled; + break; + case WPA_CIPHER_WEP104: + padapter->securitypriv.dot118021XGrpPrivacy=_WEP104_; + padapter->securitypriv.ndisencryptstatus = Ndis802_11Encryption1Enabled; + break; + } + + switch(pairwise_cipher) + { + case WPA_CIPHER_NONE: + padapter->securitypriv.dot11PrivacyAlgrthm=_NO_PRIVACY_; + padapter->securitypriv.ndisencryptstatus=Ndis802_11EncryptionDisabled; + break; + case WPA_CIPHER_WEP40: + padapter->securitypriv.dot11PrivacyAlgrthm=_WEP40_; + padapter->securitypriv.ndisencryptstatus = Ndis802_11Encryption1Enabled; + break; + case WPA_CIPHER_TKIP: + padapter->securitypriv.dot11PrivacyAlgrthm=_TKIP_; + padapter->securitypriv.ndisencryptstatus = Ndis802_11Encryption2Enabled; + break; + case WPA_CIPHER_CCMP: + padapter->securitypriv.dot11PrivacyAlgrthm=_AES_; + padapter->securitypriv.ndisencryptstatus = Ndis802_11Encryption3Enabled; + break; + case WPA_CIPHER_WEP104: + padapter->securitypriv.dot11PrivacyAlgrthm=_WEP104_; + padapter->securitypriv.ndisencryptstatus = Ndis802_11Encryption1Enabled; + break; + } + + {/* handle wps_ie */ + uint wps_ielen; + u8 *wps_ie; + + wps_ie = rtw_get_wps_ie(buf, ielen, NULL, &wps_ielen); + if (wps_ie && wps_ielen > 0) { + DBG_8192C("got wps_ie, wps_ielen:%u\n", wps_ielen); + padapter->securitypriv.wps_ie_len = wps_ielensecuritypriv.wps_ie, wps_ie, padapter->securitypriv.wps_ie_len); + set_fwstate(&padapter->mlmepriv, WIFI_UNDER_WPS); + } else { + _clr_fwstate_(&padapter->mlmepriv, WIFI_UNDER_WPS); + } + } + + #ifdef CONFIG_P2P + {//check p2p_ie for assoc req; + uint p2p_ielen=0; + u8 *p2p_ie; + struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); + + if((p2p_ie=rtw_get_p2p_ie(buf, ielen, NULL, &p2p_ielen))) + { + #ifdef CONFIG_DEBUG_CFG80211 + DBG_8192C("%s p2p_assoc_req_ielen=%d\n", __FUNCTION__, p2p_ielen); + #endif + + if(pmlmepriv->p2p_assoc_req_ie) + { + u32 free_len = pmlmepriv->p2p_assoc_req_ie_len; + pmlmepriv->p2p_assoc_req_ie_len = 0; + rtw_mfree(pmlmepriv->p2p_assoc_req_ie, free_len); + pmlmepriv->p2p_assoc_req_ie = NULL; + } + + pmlmepriv->p2p_assoc_req_ie = rtw_malloc(p2p_ielen); + if ( pmlmepriv->p2p_assoc_req_ie == NULL) { + DBG_8192C("%s()-%d: rtw_malloc() ERROR!\n", __FUNCTION__, __LINE__); + goto exit; + } + _rtw_memcpy(pmlmepriv->p2p_assoc_req_ie, p2p_ie, p2p_ielen); + pmlmepriv->p2p_assoc_req_ie_len = p2p_ielen; + } + } + #endif //CONFIG_P2P + + #ifdef CONFIG_WFD + {//check wfd_ie for assoc req; + uint wfd_ielen=0; + u8 *wfd_ie; + struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); + + if(rtw_get_wfd_ie(buf, ielen, NULL, &wfd_ielen)) + { + #ifdef CONFIG_DEBUG_CFG80211 + DBG_8192C("%s wfd_assoc_req_ielen=%d\n", __FUNCTION__, wfd_ielen); + #endif + + if(pmlmepriv->wfd_assoc_req_ie) + { + u32 free_len = pmlmepriv->wfd_assoc_req_ie_len; + pmlmepriv->wfd_assoc_req_ie_len = 0; + rtw_mfree(pmlmepriv->wfd_assoc_req_ie, free_len); + pmlmepriv->wfd_assoc_req_ie = NULL; + } + + pmlmepriv->wfd_assoc_req_ie = rtw_malloc(wfd_ielen); + if ( pmlmepriv->wfd_assoc_req_ie == NULL) { + DBG_8192C("%s()-%d: rtw_malloc() ERROR!\n", __FUNCTION__, __LINE__); + goto exit; + } + rtw_get_wfd_ie(buf, ielen, pmlmepriv->wfd_assoc_req_ie, &pmlmepriv->wfd_assoc_req_ie_len); + } + } + #endif //CONFIG_WFD + + //TKIP and AES disallow multicast packets until installing group key + if(padapter->securitypriv.dot11PrivacyAlgrthm == _TKIP_ + || padapter->securitypriv.dot11PrivacyAlgrthm == _TKIP_WTMIC_ + || padapter->securitypriv.dot11PrivacyAlgrthm == _AES_) + //WPS open need to enable multicast + //|| check_fwstate(&padapter->mlmepriv, WIFI_UNDER_WPS) == _TRUE) + rtw_hal_set_hwreg(padapter, HW_VAR_OFF_RCR_AM, null_addr); + + RT_TRACE(_module_rtl871x_ioctl_os_c, _drv_info_, + ("rtw_set_wpa_ie: pairwise_cipher=0x%08x padapter->securitypriv.ndisencryptstatus=%d padapter->securitypriv.ndisauthtype=%d\n", + pairwise_cipher, padapter->securitypriv.ndisencryptstatus, padapter->securitypriv.ndisauthtype)); + +exit: + if (buf) + rtw_mfree(buf, ielen); + if (ret) + _clr_fwstate_(&padapter->mlmepriv, WIFI_UNDER_WPS); + return ret; +} + +static int cfg80211_rtw_join_ibss(struct wiphy *wiphy, struct net_device *ndev, + struct cfg80211_ibss_params *params) +{ + struct adapter *padapter = wiphy_to_adapter(wiphy); + NDIS_802_11_SSID ndis_ssid; + struct security_priv *psecuritypriv = &padapter->securitypriv; + struct mlme_priv *pmlmepriv = &padapter->mlmepriv; + int ret=0; + + if(_FAIL == rtw_pwr_wakeup(padapter)) { + ret= -EPERM; + goto exit; + } + + if(check_fwstate(pmlmepriv, WIFI_AP_STATE)) { + ret = -EPERM; + goto exit; + } + +#ifdef CONFIG_CONCURRENT_MODE + if (check_buddy_fwstate(padapter, _FW_UNDER_LINKING) == _TRUE) { + DBG_8192C("%s, but buddy_intf is under linking\n", __FUNCTION__); + ret = -EINVAL; + goto exit; + } + if (check_buddy_fwstate(padapter, _FW_UNDER_SURVEY) == _TRUE) { + rtw_scan_abort(padapter->pbuddy_adapter); + } +#endif //CONFIG_CONCURRENT_MODE + + if (!params->ssid || !params->ssid_len) + { + ret = -EINVAL; + goto exit; + } + + if (params->ssid_len > IW_ESSID_MAX_SIZE){ + + ret= -E2BIG; + goto exit; + } + + _rtw_memset(&ndis_ssid, 0, sizeof(NDIS_802_11_SSID)); + ndis_ssid.SsidLength = params->ssid_len; + _rtw_memcpy(ndis_ssid.Ssid, params->ssid, params->ssid_len); + + //DBG_8192C("ssid=%s, len=%zu\n", ndis_ssid.Ssid, params->ssid_len); + + psecuritypriv->ndisencryptstatus = Ndis802_11EncryptionDisabled; + psecuritypriv->dot11PrivacyAlgrthm = _NO_PRIVACY_; + psecuritypriv->dot118021XGrpPrivacy = _NO_PRIVACY_; + psecuritypriv->dot11AuthAlgrthm = dot11AuthAlgrthm_Open; //open system + psecuritypriv->ndisauthtype = Ndis802_11AuthModeOpen; + + ret = rtw_cfg80211_set_auth_type(psecuritypriv, NL80211_AUTHTYPE_OPEN_SYSTEM); + rtw_set_802_11_authentication_mode(padapter, psecuritypriv->ndisauthtype); + + if (rtw_set_802_11_ssid(padapter, &ndis_ssid) == _FALSE) + { + ret = -1; + goto exit; + } + +exit: + return ret; +} + +static int cfg80211_rtw_leave_ibss(struct wiphy *wiphy, struct net_device *ndev) +{ +#if 0 + struct iwm_priv *iwm = wiphy_to_iwm(wiphy); + + if (iwm->umac_profile_active) + return iwm_invalidate_mlme_profile(iwm); +#endif + DBG_871X(FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(ndev)); + return 0; +} + +static int cfg80211_rtw_connect(struct wiphy *wiphy, struct net_device *ndev, + struct cfg80211_connect_params *sme) +{ + int ret=0; + _irqL irqL; + _list *phead; + struct wlan_network *pnetwork = NULL; + NDIS_802_11_AUTHENTICATION_MODE authmode; + NDIS_802_11_SSID ndis_ssid; + u8 *dst_ssid, *src_ssid; + u8 *dst_bssid, *src_bssid; + //u8 matched_by_bssid=_FALSE; + //u8 matched_by_ssid=_FALSE; + u8 matched=_FALSE; + struct adapter *padapter = wiphy_to_adapter(wiphy); + struct mlme_priv *pmlmepriv = &padapter->mlmepriv; + struct security_priv *psecuritypriv = &padapter->securitypriv; + _queue *queue = &pmlmepriv->scanned_queue; + + padapter->mlmepriv.not_indic_disco = _TRUE; + + DBG_871X("=>"FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(ndev)); + DBG_871X("privacy=%d, key=%p, key_len=%d, key_idx=%d\n", + sme->privacy, sme->key, sme->key_len, sme->key_idx); + + + if(wdev_to_priv(padapter->rtw_wdev)->block == _TRUE) + { + ret = -EBUSY; + DBG_871X("%s wdev_priv.block is set\n", __FUNCTION__); + goto exit; + } + +#ifdef CONFIG_PLATFORM_MSTAR + printk("MStar Android!\n"); + if((wdev_to_priv(padapter->rtw_wdev))->bandroid_scan == _FALSE) + { +#ifdef CONFIG_P2P + struct wifidirect_info *pwdinfo= &(padapter->wdinfo); + if(rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) +#endif //CONFIG_P2P + { + ret = -EBUSY; + printk("Android hasn't attached yet!\n"); + goto exit; + } + } +#endif + + if(_FAIL == rtw_pwr_wakeup(padapter)) { + ret= -EPERM; + goto exit; + } + + if(check_fwstate(pmlmepriv, WIFI_AP_STATE)) { + ret = -EPERM; + goto exit; + } + +#ifdef CONFIG_CONCURRENT_MODE + if (check_buddy_fwstate(padapter, _FW_UNDER_LINKING) == _TRUE) { + DBG_8192C("%s, but buddy_intf is under linking\n", __FUNCTION__); + ret = -EINVAL; + goto exit; + } + if (check_buddy_fwstate(padapter, _FW_UNDER_SURVEY) == _TRUE) { + rtw_scan_abort(padapter->pbuddy_adapter); + } +#endif + + if (!sme->ssid || !sme->ssid_len) + { + ret = -EINVAL; + goto exit; + } + + if (sme->ssid_len > IW_ESSID_MAX_SIZE){ + + ret= -E2BIG; + goto exit; + } + + _rtw_memset(&ndis_ssid, 0, sizeof(NDIS_802_11_SSID)); + ndis_ssid.SsidLength = sme->ssid_len; + _rtw_memcpy(ndis_ssid.Ssid, sme->ssid, sme->ssid_len); + + DBG_8192C("ssid=%s, len=%zu\n", ndis_ssid.Ssid, sme->ssid_len); + + + if (sme->bssid) + DBG_8192C("bssid="MAC_FMT"\n", MAC_ARG(sme->bssid)); + + + if (check_fwstate(pmlmepriv, _FW_UNDER_LINKING) == _TRUE) { + ret = -EBUSY; + DBG_8192C("%s, fw_state=0x%x, goto exit\n", __FUNCTION__, pmlmepriv->fw_state); + goto exit; + } + if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY) == _TRUE) { + rtw_scan_abort(padapter); + } + + psecuritypriv->ndisencryptstatus = Ndis802_11EncryptionDisabled; + psecuritypriv->dot11PrivacyAlgrthm = _NO_PRIVACY_; + psecuritypriv->dot118021XGrpPrivacy = _NO_PRIVACY_; + psecuritypriv->dot11AuthAlgrthm = dot11AuthAlgrthm_Open; //open system + psecuritypriv->ndisauthtype = Ndis802_11AuthModeOpen; + +#ifdef CONFIG_WAPI_SUPPORT + padapter->wapiInfo.bWapiEnable = false; +#endif + + ret = rtw_cfg80211_set_wpa_version(psecuritypriv, sme->crypto.wpa_versions); + if (ret < 0) + goto exit; + +#ifdef CONFIG_WAPI_SUPPORT + if(sme->crypto.wpa_versions & NL80211_WAPI_VERSION_1) + { + padapter->wapiInfo.bWapiEnable = true; + padapter->wapiInfo.extra_prefix_len = WAPI_EXT_LEN; + padapter->wapiInfo.extra_postfix_len = SMS4_MIC_LEN; + } +#endif + + ret = rtw_cfg80211_set_auth_type(psecuritypriv, sme->auth_type); + +#ifdef CONFIG_WAPI_SUPPORT + if(psecuritypriv->dot11AuthAlgrthm == dot11AuthAlgrthm_WAPI) + padapter->mlmeextpriv.mlmext_info.auth_algo = psecuritypriv->dot11AuthAlgrthm; +#endif + + + if (ret < 0) + goto exit; + + DBG_8192C("%s, ie_len=%zu\n", __func__, sme->ie_len); + + ret = rtw_cfg80211_set_wpa_ie(padapter, sme->ie, sme->ie_len); + if (ret < 0) + goto exit; + + if (sme->crypto.n_ciphers_pairwise) { + ret = rtw_cfg80211_set_cipher(psecuritypriv, sme->crypto.ciphers_pairwise[0], _TRUE); + if (ret < 0) + goto exit; + } + + //For WEP Shared auth + if((psecuritypriv->dot11AuthAlgrthm == dot11AuthAlgrthm_Shared + || psecuritypriv->dot11AuthAlgrthm == dot11AuthAlgrthm_Auto) && sme->key + ) + { + u32 wep_key_idx, wep_key_len,wep_total_len; + NDIS_802_11_WEP *pwep = NULL; + DBG_871X("%s(): Shared/Auto WEP\n",__FUNCTION__); + + wep_key_idx = sme->key_idx; + wep_key_len = sme->key_len; + + if (sme->key_idx > WEP_KEYS) { + ret = -EINVAL; + goto exit; + } + + if (wep_key_len > 0) + { + wep_key_len = wep_key_len <= 5 ? 5 : 13; + wep_total_len = wep_key_len + FIELD_OFFSET(NDIS_802_11_WEP, KeyMaterial); + pwep =(NDIS_802_11_WEP *) rtw_malloc(wep_total_len); + if(pwep == NULL){ + DBG_871X(" wpa_set_encryption: pwep allocate fail !!!\n"); + ret = -ENOMEM; + goto exit; + } + + _rtw_memset(pwep, 0, wep_total_len); + + pwep->KeyLength = wep_key_len; + pwep->Length = wep_total_len; + + if(wep_key_len==13) + { + padapter->securitypriv.dot11PrivacyAlgrthm=_WEP104_; + padapter->securitypriv.dot118021XGrpPrivacy=_WEP104_; + } + } + else { + ret = -EINVAL; + goto exit; + } + + pwep->KeyIndex = wep_key_idx; + pwep->KeyIndex |= 0x80000000; + + _rtw_memcpy(pwep->KeyMaterial, (void *)sme->key, pwep->KeyLength); + + if(rtw_set_802_11_add_wep(padapter, pwep) == (u8)_FAIL) + { + ret = -EOPNOTSUPP ; + } + + if (pwep) { + rtw_mfree((u8 *)pwep,wep_total_len); + } + + if(ret < 0) + goto exit; + } + + ret = rtw_cfg80211_set_cipher(psecuritypriv, sme->crypto.cipher_group, _FALSE); + if (ret < 0) + return ret; + + if (sme->crypto.n_akm_suites) { + ret = rtw_cfg80211_set_key_mgt(psecuritypriv, sme->crypto.akm_suites[0]); + if (ret < 0) + goto exit; + } + +#ifdef CONFIG_WAPI_SUPPORT + if(sme->crypto.akm_suites[0] ==WLAN_AKM_SUITE_WAPI_PSK){ + padapter->wapiInfo.bWapiPSK = true; + } + else if(sme->crypto.akm_suites[0] ==WLAN_AKM_SUITE_WAPI_CERT){ + padapter->wapiInfo.bWapiPSK = false; + } +#endif + + authmode = psecuritypriv->ndisauthtype; + rtw_set_802_11_authentication_mode(padapter, authmode); + + //rtw_set_802_11_encryption_mode(padapter, padapter->securitypriv.ndisencryptstatus); + + if (rtw_set_802_11_connect(padapter, sme->bssid, &ndis_ssid) == _FALSE) { + ret = -1; + goto exit; + } + + DBG_8192C("set ssid:dot11AuthAlgrthm=%d, dot11PrivacyAlgrthm=%d, dot118021XGrpPrivacy=%d\n", psecuritypriv->dot11AuthAlgrthm, psecuritypriv->dot11PrivacyAlgrthm, psecuritypriv->dot118021XGrpPrivacy); + +exit: + + DBG_8192C("<=%s, ret %d\n",__FUNCTION__, ret); + + padapter->mlmepriv.not_indic_disco = _FALSE; + + return ret; +} + +static int cfg80211_rtw_disconnect(struct wiphy *wiphy, struct net_device *ndev, + u16 reason_code) +{ + struct adapter *padapter = wiphy_to_adapter(wiphy); + + DBG_871X(FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(ndev)); + + padapter->mlmepriv.not_indic_disco = _TRUE; + + rtw_set_roaming(padapter, 0); + + if(check_fwstate(&padapter->mlmepriv, _FW_LINKED)) + { + rtw_scan_abort(padapter); + LeaveAllPowerSaveMode(padapter); + rtw_disassoc_cmd(padapter, 500, _FALSE); + + DBG_871X("%s...call rtw_indicate_disconnect\n", __FUNCTION__); + + rtw_indicate_disconnect(padapter); + + rtw_free_assoc_resources(padapter, 1); + } + + padapter->mlmepriv.not_indic_disco = _FALSE; + + return 0; +} + +static int cfg80211_rtw_set_txpower(struct wiphy *wiphy, +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0)) + struct wireless_dev *wdev, +#endif +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36)) || defined(COMPAT_KERNEL_RELEASE) + enum nl80211_tx_power_setting type, int mbm) +#else + enum tx_power_setting type, int dbm) +#endif +{ +#if 0 + struct iwm_priv *iwm = wiphy_to_iwm(wiphy); + int ret; + + switch (type) { + case NL80211_TX_POWER_AUTOMATIC: + return 0; + case NL80211_TX_POWER_FIXED: + if (mbm < 0 || (mbm % 100)) + return -EOPNOTSUPP; + + if (!test_bit(IWM_STATUS_READY, &iwm->status)) + return 0; + + ret = iwm_umac_set_config_fix(iwm, UMAC_PARAM_TBL_CFG_FIX, + CFG_TX_PWR_LIMIT_USR, + MBM_TO_DBM(mbm) * 2); + if (ret < 0) + return ret; + + return iwm_tx_power_trigger(iwm); + default: + IWM_ERR(iwm, "Unsupported power type: %d\n", type); + return -EOPNOTSUPP; + } +#endif + DBG_8192C("%s\n", __func__); + return 0; +} + +static int cfg80211_rtw_get_txpower(struct wiphy *wiphy, +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0)) + struct wireless_dev *wdev, +#endif + int *dbm) +{ + //struct adapter *padapter = wiphy_to_adapter(wiphy); + + DBG_8192C("%s\n", __func__); + + *dbm = (12); + + return 0; +} + +inline bool rtw_cfg80211_pwr_mgmt(struct adapter *adapter) +{ + struct rtw_wdev_priv *rtw_wdev_priv = wdev_to_priv(adapter->rtw_wdev); + return rtw_wdev_priv->power_mgmt; +} + +static int cfg80211_rtw_set_power_mgmt(struct wiphy *wiphy, + struct net_device *ndev, + bool enabled, int timeout) +{ + struct adapter *padapter = wiphy_to_adapter(wiphy); + struct rtw_wdev_priv *rtw_wdev_priv = wdev_to_priv(padapter->rtw_wdev); + + DBG_871X(FUNC_NDEV_FMT" enabled:%u, timeout:%d\n", FUNC_NDEV_ARG(ndev), + enabled, timeout); + + rtw_wdev_priv->power_mgmt = enabled; + + #ifdef CONFIG_LPS + if (!enabled) + LPS_Leave(padapter); + #endif + + return 0; +} + +static int cfg80211_rtw_set_pmksa(struct wiphy *wiphy, + struct net_device *netdev, + struct cfg80211_pmksa *pmksa) +{ + u8 index,blInserted = _FALSE; + struct adapter *padapter = wiphy_to_adapter(wiphy); + struct security_priv *psecuritypriv = &padapter->securitypriv; + u8 strZeroMacAddress[ ETH_ALEN ] = { 0x00 }; + + DBG_871X(FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(netdev)); + + if ( _rtw_memcmp( pmksa->bssid, strZeroMacAddress, ETH_ALEN ) == _TRUE ) + { + return -EINVAL; + } + + blInserted = _FALSE; + + //overwrite PMKID + for(index=0 ; indexPMKIDList[index].Bssid, pmksa->bssid, ETH_ALEN) ==_TRUE ) + { // BSSID is matched, the same AP => rewrite with new PMKID. + DBG_871X(FUNC_NDEV_FMT" BSSID exists in the PMKList.\n", FUNC_NDEV_ARG(netdev)); + + _rtw_memcpy( psecuritypriv->PMKIDList[index].PMKID, pmksa->pmkid, WLAN_PMKID_LEN); + psecuritypriv->PMKIDList[index].bUsed = _TRUE; + psecuritypriv->PMKIDIndex = index+1; + blInserted = _TRUE; + break; + } + } + + if(!blInserted) + { + // Find a new entry + DBG_871X(FUNC_NDEV_FMT" Use the new entry index = %d for this PMKID.\n", + FUNC_NDEV_ARG(netdev), psecuritypriv->PMKIDIndex ); + + _rtw_memcpy(psecuritypriv->PMKIDList[psecuritypriv->PMKIDIndex].Bssid, pmksa->bssid, ETH_ALEN); + _rtw_memcpy(psecuritypriv->PMKIDList[psecuritypriv->PMKIDIndex].PMKID, pmksa->pmkid, WLAN_PMKID_LEN); + + psecuritypriv->PMKIDList[psecuritypriv->PMKIDIndex].bUsed = _TRUE; + psecuritypriv->PMKIDIndex++ ; + if(psecuritypriv->PMKIDIndex==16) + { + psecuritypriv->PMKIDIndex =0; + } + } + + return 0; +} + +static int cfg80211_rtw_del_pmksa(struct wiphy *wiphy, + struct net_device *netdev, + struct cfg80211_pmksa *pmksa) +{ + u8 index, bMatched = _FALSE; + struct adapter *padapter = wiphy_to_adapter(wiphy); + struct security_priv *psecuritypriv = &padapter->securitypriv; + + DBG_871X(FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(netdev)); + + for(index=0 ; indexPMKIDList[index].Bssid, pmksa->bssid, ETH_ALEN) ==_TRUE ) + { // BSSID is matched, the same AP => Remove this PMKID information and reset it. + _rtw_memset( psecuritypriv->PMKIDList[index].Bssid, 0x00, ETH_ALEN ); + _rtw_memset( psecuritypriv->PMKIDList[index].PMKID, 0x00, WLAN_PMKID_LEN ); + psecuritypriv->PMKIDList[index].bUsed = _FALSE; + bMatched = _TRUE; + break; + } + } + + if(_FALSE == bMatched) + { + DBG_871X(FUNC_NDEV_FMT" do not have matched BSSID\n" + , FUNC_NDEV_ARG(netdev)); + return -EINVAL; + } + + return 0; +} + +static int cfg80211_rtw_flush_pmksa(struct wiphy *wiphy, + struct net_device *netdev) +{ + struct adapter *padapter = wiphy_to_adapter(wiphy); + struct security_priv *psecuritypriv = &padapter->securitypriv; + + DBG_871X(FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(netdev)); + + _rtw_memset( &psecuritypriv->PMKIDList[ 0 ], 0x00, sizeof( RT_PMKID_LIST ) * NUM_PMKID_CACHE ); + psecuritypriv->PMKIDIndex = 0; + + return 0; +} + +#ifdef CONFIG_AP_MODE +void rtw_cfg80211_indicate_sta_assoc(struct adapter *padapter, u8 *pmgmt_frame, uint frame_len) +{ + s32 freq; + int channel; + struct wireless_dev *pwdev = padapter->rtw_wdev; + struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); + struct net_device *ndev = padapter->pnetdev; + + DBG_871X(FUNC_ADPT_FMT"\n", FUNC_ADPT_ARG(padapter)); + +#if defined(RTW_USE_CFG80211_STA_EVENT) || defined(COMPAT_KERNEL_RELEASE) + { + struct station_info sinfo; + u8 ie_offset; + if (GetFrameSubType(pmgmt_frame) == WIFI_ASSOCREQ) + ie_offset = _ASOCREQ_IE_OFFSET_; + else // WIFI_REASSOCREQ + ie_offset = _REASOCREQ_IE_OFFSET_; + + sinfo.filled = 0; + sinfo.filled = STATION_INFO_ASSOC_REQ_IES; + sinfo.assoc_req_ies = pmgmt_frame + WLAN_HDR_A3_LEN + ie_offset; + sinfo.assoc_req_ies_len = frame_len - WLAN_HDR_A3_LEN - ie_offset; + cfg80211_new_sta(ndev, GetAddr2Ptr(pmgmt_frame), &sinfo, GFP_ATOMIC); + } +#else /* defined(RTW_USE_CFG80211_STA_EVENT) */ + channel = pmlmeext->cur_channel; + if (channel <= RTW_CH_MAX_2G_CHANNEL) + freq = rtw_ieee80211_channel_to_frequency(channel, IEEE80211_BAND_2GHZ); + else + freq = rtw_ieee80211_channel_to_frequency(channel, IEEE80211_BAND_5GHZ); + + #ifdef COMPAT_KERNEL_RELEASE + rtw_cfg80211_rx_mgmt(padapter, freq, 0, pmgmt_frame, frame_len, GFP_ATOMIC); + #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) && !defined(CONFIG_CFG80211_FORCE_COMPATIBLE_2_6_37_UNDER) + rtw_cfg80211_rx_mgmt(padapter, freq, 0, pmgmt_frame, frame_len, GFP_ATOMIC); + #else //COMPAT_KERNEL_RELEASE + { + //to avoid WARN_ON(wdev->iftype != NL80211_IFTYPE_STATION) when calling cfg80211_send_rx_assoc() + #ifndef CONFIG_PLATFORM_MSTAR + pwdev->iftype = NL80211_IFTYPE_STATION; + #endif //CONFIG_PLATFORM_MSTAR + DBG_8192C("iftype=%d before call cfg80211_send_rx_assoc()\n", pwdev->iftype); + rtw_cfg80211_send_rx_assoc(padapter, NULL, pmgmt_frame, frame_len); + DBG_8192C("iftype=%d after call cfg80211_send_rx_assoc()\n", pwdev->iftype); + pwdev->iftype = NL80211_IFTYPE_AP; + //cfg80211_rx_action(padapter->pnetdev, freq, pmgmt_frame, frame_len, GFP_ATOMIC); + } + #endif //COMPAT_KERNEL_RELEASE +#endif /* defined(RTW_USE_CFG80211_STA_EVENT) */ + +} + +void rtw_cfg80211_indicate_sta_disassoc(struct adapter *padapter, unsigned char *da, unsigned short reason) +{ + s32 freq; + int channel; + u8 *pmgmt_frame; + uint frame_len; + struct rtw_ieee80211_hdr *pwlanhdr; + unsigned short *fctrl; + u8 mgmt_buf[128] = {0}; + struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); + struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); + struct net_device *ndev = padapter->pnetdev; + + DBG_871X(FUNC_ADPT_FMT"\n", FUNC_ADPT_ARG(padapter)); + +#if defined(RTW_USE_CFG80211_STA_EVENT) || defined(COMPAT_KERNEL_RELEASE) + cfg80211_del_sta(ndev, da, GFP_ATOMIC); +#else /* defined(RTW_USE_CFG80211_STA_EVENT) */ + channel = pmlmeext->cur_channel; + if (channel <= RTW_CH_MAX_2G_CHANNEL) + freq = rtw_ieee80211_channel_to_frequency(channel, IEEE80211_BAND_2GHZ); + else + freq = rtw_ieee80211_channel_to_frequency(channel, IEEE80211_BAND_5GHZ); + + pmgmt_frame = mgmt_buf; + pwlanhdr = (struct rtw_ieee80211_hdr *)pmgmt_frame; + + fctrl = &(pwlanhdr->frame_ctl); + *(fctrl) = 0; + + //_rtw_memcpy(pwlanhdr->addr1, da, ETH_ALEN); + //_rtw_memcpy(pwlanhdr->addr2, myid(&(padapter->eeprompriv)), ETH_ALEN); + _rtw_memcpy(pwlanhdr->addr1, myid(&(padapter->eeprompriv)), ETH_ALEN); + _rtw_memcpy(pwlanhdr->addr2, da, ETH_ALEN); + _rtw_memcpy(pwlanhdr->addr3, get_my_bssid(&(pmlmeinfo->network)), ETH_ALEN); + + SetSeqNum(pwlanhdr, pmlmeext->mgnt_seq); + pmlmeext->mgnt_seq++; + SetFrameSubType(pmgmt_frame, WIFI_DEAUTH); + + pmgmt_frame += sizeof(struct rtw_ieee80211_hdr_3addr); + frame_len = sizeof(struct rtw_ieee80211_hdr_3addr); + + reason = cpu_to_le16(reason); + pmgmt_frame = rtw_set_fixed_ie(pmgmt_frame, _RSON_CODE_ , (unsigned char *)&reason, &frame_len); + + #ifdef COMPAT_KERNEL_RELEASE + rtw_cfg80211_rx_mgmt(padapter, freq, 0, mgmt_buf, frame_len, GFP_ATOMIC); + #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) && !defined(CONFIG_CFG80211_FORCE_COMPATIBLE_2_6_37_UNDER) + rtw_cfg80211_rx_mgmt(padapter, freq, 0, mgmt_buf, frame_len, GFP_ATOMIC); + #else //COMPAT_KERNEL_RELEASE + cfg80211_send_disassoc(padapter->pnetdev, mgmt_buf, frame_len); + //cfg80211_rx_action(padapter->pnetdev, freq, mgmt_buf, frame_len, GFP_ATOMIC); + #endif //COMPAT_KERNEL_RELEASE +#endif /* defined(RTW_USE_CFG80211_STA_EVENT) */ +} + +static int rtw_cfg80211_monitor_if_open(struct net_device *ndev) +{ + int ret = 0; + + DBG_8192C("%s\n", __func__); + + return ret; +} + +static int rtw_cfg80211_monitor_if_close(struct net_device *ndev) +{ + int ret = 0; + + DBG_8192C("%s\n", __func__); + + return ret; +} + +static int rtw_cfg80211_monitor_if_xmit_entry(struct sk_buff *skb, struct net_device *ndev) +{ + int ret = 0; + int rtap_len; + int qos_len = 0; + int dot11_hdr_len = 24; + int snap_len = 6; + unsigned char *pdata; + u16 frame_ctl; + unsigned char src_mac_addr[6]; + unsigned char dst_mac_addr[6]; + struct ieee80211_hdr *dot11_hdr; + struct ieee80211_radiotap_header *rtap_hdr; + struct adapter *padapter = (struct adapter *)rtw_netdev_priv(ndev); + + DBG_871X(FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(ndev)); + + if (skb) + rtw_mstat_update(MSTAT_TYPE_SKB, MSTAT_ALLOC_SUCCESS, skb->truesize); + + if (unlikely(skb->len < sizeof(struct ieee80211_radiotap_header))) + goto fail; + + rtap_hdr = (struct ieee80211_radiotap_header *)skb->data; + if (unlikely(rtap_hdr->it_version)) + goto fail; + + rtap_len = ieee80211_get_radiotap_len(skb->data); + if (unlikely(skb->len < rtap_len)) + goto fail; + + if(rtap_len != 14) + { + DBG_8192C("radiotap len (should be 14): %d\n", rtap_len); + goto fail; + } + + /* Skip the ratio tap header */ + skb_pull(skb, rtap_len); + + dot11_hdr = (struct ieee80211_hdr *)skb->data; + frame_ctl = le16_to_cpu(dot11_hdr->frame_control); + /* Check if the QoS bit is set */ + if ((frame_ctl & RTW_IEEE80211_FCTL_FTYPE) == RTW_IEEE80211_FTYPE_DATA) { + /* Check if this ia a Wireless Distribution System (WDS) frame + * which has 4 MAC addresses + */ + if (dot11_hdr->frame_control & 0x0080) + qos_len = 2; + if ((dot11_hdr->frame_control & 0x0300) == 0x0300) + dot11_hdr_len += 6; + + memcpy(dst_mac_addr, dot11_hdr->addr1, sizeof(dst_mac_addr)); + memcpy(src_mac_addr, dot11_hdr->addr2, sizeof(src_mac_addr)); + + /* Skip the 802.11 header, QoS (if any) and SNAP, but leave spaces for + * for two MAC addresses + */ + skb_pull(skb, dot11_hdr_len + qos_len + snap_len - sizeof(src_mac_addr) * 2); + pdata = (unsigned char*)skb->data; + memcpy(pdata, dst_mac_addr, sizeof(dst_mac_addr)); + memcpy(pdata + sizeof(dst_mac_addr), src_mac_addr, sizeof(src_mac_addr)); + + DBG_8192C("should be eapol packet\n"); + + /* Use the real net device to transmit the packet */ + ret = _rtw_xmit_entry(skb, padapter->pnetdev); + + return ret; + + } + else if ((frame_ctl & (RTW_IEEE80211_FCTL_FTYPE|RTW_IEEE80211_FCTL_STYPE)) + == (RTW_IEEE80211_FTYPE_MGMT|RTW_IEEE80211_STYPE_ACTION) + ) + { + //only for action frames + struct xmit_frame *pmgntframe; + struct pkt_attrib *pattrib; + unsigned char *pframe; + //u8 category, action, OUI_Subtype, dialogToken=0; + //unsigned char *frame_body; + struct rtw_ieee80211_hdr *pwlanhdr; + struct xmit_priv *pxmitpriv = &(padapter->xmitpriv); + struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); + u8 *buf = skb->data; + u32 len = skb->len; + u8 category, action; + int type = -1; + + if (rtw_action_frame_parse(buf, len, &category, &action) == _FALSE) { + DBG_8192C(FUNC_NDEV_FMT" frame_control:0x%x\n", FUNC_NDEV_ARG(ndev), + le16_to_cpu(((struct rtw_ieee80211_hdr_3addr *)buf)->frame_ctl)); + goto fail; + } + + DBG_8192C("RTW_Tx:da="MAC_FMT" via "FUNC_NDEV_FMT"\n", + MAC_ARG(GetAddr1Ptr(buf)), FUNC_NDEV_ARG(ndev)); + #ifdef CONFIG_P2P + if((type = rtw_p2p_check_frames(padapter, buf, len, _TRUE)) >= 0) + goto dump; + #endif + if (category == RTW_WLAN_CATEGORY_PUBLIC) + DBG_871X("RTW_Tx:%s\n", action_public_str(action)); + else + DBG_871X("RTW_Tx:category(%u), action(%u)\n", category, action); + +dump: + //starting alloc mgmt frame to dump it + if ((pmgntframe = alloc_mgtxmitframe(pxmitpriv)) == NULL) + { + goto fail; + } + + //update attribute + pattrib = &pmgntframe->attrib; + update_mgntframe_attrib(padapter, pattrib); + pattrib->retry_ctrl = _FALSE; + + _rtw_memset(pmgntframe->buf_addr, 0, WLANHDR_OFFSET + TXDESC_OFFSET); + + pframe = (u8 *)(pmgntframe->buf_addr) + TXDESC_OFFSET; + + _rtw_memcpy(pframe, (void*)buf, len); + #ifdef CONFIG_WFD + if (type >= 0) + { + struct wifi_display_info *pwfd_info; + + pwfd_info = padapter->wdinfo.wfd_info; + + if ( _TRUE == pwfd_info->wfd_enable ) + { + rtw_append_wfd_ie( padapter, pframe, &len ); + } + } + #endif // CONFIG_WFD + pattrib->pktlen = len; + + pwlanhdr = (struct rtw_ieee80211_hdr *)pframe; + //update seq number + pmlmeext->mgnt_seq = GetSequence(pwlanhdr); + pattrib->seqnum = pmlmeext->mgnt_seq; + pmlmeext->mgnt_seq++; + + + pattrib->last_txcmdsz = pattrib->pktlen; + + dump_mgntframe(padapter, pmgntframe); + + } + else + { + DBG_8192C("frame_ctl=0x%x\n", frame_ctl & (RTW_IEEE80211_FCTL_FTYPE|RTW_IEEE80211_FCTL_STYPE)); + } + + +fail: + + dev_kfree_skb(skb); + + return 0; + +} + +static void rtw_cfg80211_monitor_if_set_multicast_list(struct net_device *ndev) +{ + DBG_8192C("%s\n", __func__); +} + +static int rtw_cfg80211_monitor_if_set_mac_address(struct net_device *ndev, void *addr) +{ + int ret = 0; + + DBG_8192C("%s\n", __func__); + + return ret; +} + +#if (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,29)) +static const struct net_device_ops rtw_cfg80211_monitor_if_ops = { + .ndo_open = rtw_cfg80211_monitor_if_open, + .ndo_stop = rtw_cfg80211_monitor_if_close, + .ndo_start_xmit = rtw_cfg80211_monitor_if_xmit_entry, + #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,2,0)) + .ndo_set_multicast_list = rtw_cfg80211_monitor_if_set_multicast_list, + #endif + .ndo_set_mac_address = rtw_cfg80211_monitor_if_set_mac_address, +}; +#endif + +static int rtw_cfg80211_add_monitor_if(struct adapter *padapter, char *name, struct net_device **ndev) +{ + int ret = 0; + struct net_device* mon_ndev = NULL; + struct wireless_dev* mon_wdev = NULL; + struct rtw_netdev_priv_indicator *pnpi; + struct rtw_wdev_priv *pwdev_priv = wdev_to_priv(padapter->rtw_wdev); + + if (!name ) { + DBG_871X(FUNC_ADPT_FMT" without specific name\n", FUNC_ADPT_ARG(padapter)); + ret = -EINVAL; + goto out; + } + + if (pwdev_priv->pmon_ndev) { + DBG_871X(FUNC_ADPT_FMT" monitor interface exist: "NDEV_FMT"\n", + FUNC_ADPT_ARG(padapter), NDEV_ARG(pwdev_priv->pmon_ndev)); + ret = -EBUSY; + goto out; + } + + mon_ndev = alloc_etherdev(sizeof(struct rtw_netdev_priv_indicator)); + if (!mon_ndev) { + DBG_871X(FUNC_ADPT_FMT" allocate ndev fail\n", FUNC_ADPT_ARG(padapter)); + ret = -ENOMEM; + goto out; + } + + mon_ndev->type = ARPHRD_IEEE80211_RADIOTAP; + strncpy(mon_ndev->name, name, IFNAMSIZ); + mon_ndev->name[IFNAMSIZ - 1] = 0; + mon_ndev->destructor = rtw_ndev_destructor; + +#if (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,29)) + mon_ndev->netdev_ops = &rtw_cfg80211_monitor_if_ops; +#else + mon_ndev->open = rtw_cfg80211_monitor_if_open; + mon_ndev->stop = rtw_cfg80211_monitor_if_close; + mon_ndev->hard_start_xmit = rtw_cfg80211_monitor_if_xmit_entry; + mon_ndev->set_mac_address = rtw_cfg80211_monitor_if_set_mac_address; +#endif + + pnpi = netdev_priv(mon_ndev); + pnpi->priv = padapter; + pnpi->sizeof_priv = sizeof(struct adapter); + + /* wdev */ + mon_wdev = (struct wireless_dev *)rtw_zmalloc(sizeof(struct wireless_dev)); + if (!mon_wdev) { + DBG_871X(FUNC_ADPT_FMT" allocate mon_wdev fail\n", FUNC_ADPT_ARG(padapter)); + ret = -ENOMEM; + goto out; + } + + mon_wdev->wiphy = padapter->rtw_wdev->wiphy; + mon_wdev->netdev = mon_ndev; + mon_wdev->iftype = NL80211_IFTYPE_MONITOR; + mon_ndev->ieee80211_ptr = mon_wdev; + + ret = register_netdevice(mon_ndev); + if (ret) { + goto out; + } + + *ndev = pwdev_priv->pmon_ndev = mon_ndev; + _rtw_memcpy(pwdev_priv->ifname_mon, name, IFNAMSIZ+1); + +out: + if (ret && mon_wdev) { + rtw_mfree((u8*)mon_wdev, sizeof(struct wireless_dev)); + mon_wdev = NULL; + } + + if (ret && mon_ndev) { + free_netdev(mon_ndev); + *ndev = mon_ndev = NULL; + } + + return ret; +} + +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0)) +static struct wireless_dev * +#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) || defined(COMPAT_KERNEL_RELEASE) +static struct net_device * +#else +static int +#endif + cfg80211_rtw_add_virtual_intf( + struct wiphy *wiphy, + #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0)) + const char *name, + #else + char *name, + #endif + enum nl80211_iftype type, u32 *flags, struct vif_params *params) +{ + int ret = 0; + struct net_device* ndev = NULL; + struct adapter *padapter = wiphy_to_adapter(wiphy); + + DBG_871X(FUNC_ADPT_FMT " wiphy:%s, name:%s, type:%d\n", + FUNC_ADPT_ARG(padapter), wiphy_name(wiphy), name, type); + + switch (type) { + case NL80211_IFTYPE_ADHOC: + case NL80211_IFTYPE_AP_VLAN: + case NL80211_IFTYPE_WDS: + case NL80211_IFTYPE_MESH_POINT: + ret = -ENODEV; + break; + case NL80211_IFTYPE_MONITOR: + ret = rtw_cfg80211_add_monitor_if(padapter, (char *)name, &ndev); + break; + +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE) + case NL80211_IFTYPE_P2P_CLIENT: +#endif + case NL80211_IFTYPE_STATION: + ret = -ENODEV; + break; + +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE) + case NL80211_IFTYPE_P2P_GO: +#endif + case NL80211_IFTYPE_AP: + ret = -ENODEV; + break; + default: + ret = -ENODEV; + DBG_871X("Unsupported interface type\n"); + break; + } + + DBG_871X(FUNC_ADPT_FMT" ndev:%p, ret:%d\n", FUNC_ADPT_ARG(padapter), ndev, ret); + +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0)) + return ndev ? ndev->ieee80211_ptr : ERR_PTR(ret); +#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) || defined(COMPAT_KERNEL_RELEASE) + return ndev ? ndev : ERR_PTR(ret); +#else + return ret; +#endif +} + +static int cfg80211_rtw_del_virtual_intf(struct wiphy *wiphy, +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0)) + struct wireless_dev *wdev +#else + struct net_device *ndev +#endif +) +{ + struct rtw_wdev_priv *pwdev_priv = (struct rtw_wdev_priv *)wiphy_priv(wiphy); +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0)) + struct net_device *ndev; + ndev = wdev ? wdev->netdev : NULL; +#endif + + if (!ndev) + goto exit; + + unregister_netdevice(ndev); + + if (ndev == pwdev_priv->pmon_ndev) { + pwdev_priv->pmon_ndev = NULL; + pwdev_priv->ifname_mon[0] = '\0'; + DBG_871X(FUNC_NDEV_FMT" remove monitor interface\n", FUNC_NDEV_ARG(ndev)); + } + +exit: + return 0; +} + +static int rtw_add_beacon(struct adapter *adapter, const u8 *head, size_t head_len, const u8 *tail, size_t tail_len) +{ + int ret=0; + u8 *pbuf = NULL; + uint len, wps_ielen=0; + uint p2p_ielen=0; + u8 *p2p_ie; + u8 got_p2p_ie = _FALSE; + struct mlme_priv *pmlmepriv = &(adapter->mlmepriv); + //struct sta_priv *pstapriv = &padapter->stapriv; + + + DBG_8192C("%s beacon_head_len=%zu, beacon_tail_len=%zu\n", __FUNCTION__, head_len, tail_len); + + + if(check_fwstate(pmlmepriv, WIFI_AP_STATE) != _TRUE) + return -EINVAL; + + if(head_len<24) + return -EINVAL; + + + pbuf = rtw_zmalloc(head_len+tail_len); + if(!pbuf) + return -ENOMEM; + + + //_rtw_memcpy(&pstapriv->max_num_sta, param->u.bcn_ie.reserved, 2); + + //if((pstapriv->max_num_sta>NUM_STA) || (pstapriv->max_num_sta<=0)) + // pstapriv->max_num_sta = NUM_STA; + + + _rtw_memcpy(pbuf, (void *)head+24, head_len-24);// 24=beacon header len. + _rtw_memcpy(pbuf+head_len-24, (void *)tail, tail_len); + + len = head_len+tail_len-24; + + //check wps ie if inclued + if(rtw_get_wps_ie(pbuf+_FIXED_IE_LENGTH_, len-_FIXED_IE_LENGTH_, NULL, &wps_ielen)) + DBG_8192C("add bcn, wps_ielen=%d\n", wps_ielen); + +#ifdef CONFIG_P2P + //check p2p ie if inclued + if( adapter->wdinfo.driver_interface == DRIVER_CFG80211 ) + { + //check p2p if enable + if(rtw_get_p2p_ie(pbuf+_FIXED_IE_LENGTH_, len-_FIXED_IE_LENGTH_, NULL, &p2p_ielen)) + { + struct mlme_ext_priv *pmlmeext = &adapter->mlmeextpriv; + struct wifidirect_info *pwdinfo= &(adapter->wdinfo); + + DBG_8192C("got p2p_ie, len=%d\n", p2p_ielen); + got_p2p_ie = _TRUE; + + if(rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) + { + DBG_8192C("Enable P2P function for the first time\n"); + rtw_p2p_enable(adapter, P2P_ROLE_GO); + wdev_to_priv(adapter->rtw_wdev)->p2p_enabled = _TRUE; + } + else + { + DBG_8192C("enter GO Mode, p2p_ielen=%d\n", p2p_ielen); + + rtw_p2p_set_role(pwdinfo, P2P_ROLE_GO); + rtw_p2p_set_state(pwdinfo, P2P_STATE_GONEGO_OK); + pwdinfo->intent = 15; + } + } + } +#endif // CONFIG_P2P + + /* pbss_network->IEs will not include p2p_ie, wfd ie */ + rtw_ies_remove_ie(pbuf, &len, _BEACON_IE_OFFSET_, _VENDOR_SPECIFIC_IE_, P2P_OUI, 4); + rtw_ies_remove_ie(pbuf, &len, _BEACON_IE_OFFSET_, _VENDOR_SPECIFIC_IE_, WFD_OUI, 4); + + if (rtw_check_beacon_data(adapter, pbuf, len) == _SUCCESS) + { +#ifdef CONFIG_P2P + //check p2p if enable + if(got_p2p_ie == _TRUE) + { + struct mlme_ext_priv *pmlmeext = &adapter->mlmeextpriv; + struct wifidirect_info *pwdinfo= &(adapter->wdinfo); + pwdinfo->operating_channel = pmlmeext->cur_channel; + } +#endif //CONFIG_P2P + ret = 0; + } + else + { + ret = -EINVAL; + } + + + rtw_mfree(pbuf, head_len+tail_len); + + return ret; +} + +#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) && !defined(COMPAT_KERNEL_RELEASE) +static int cfg80211_rtw_add_beacon(struct wiphy *wiphy, struct net_device *ndev, + struct beacon_parameters *info) +{ + int ret=0; + struct adapter *adapter = wiphy_to_adapter(wiphy); + + DBG_871X(FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(ndev)); + ret = rtw_add_beacon(adapter, info->head, info->head_len, info->tail, info->tail_len); + + return ret; +} + +static int cfg80211_rtw_set_beacon(struct wiphy *wiphy, struct net_device *ndev, + struct beacon_parameters *info) +{ + struct adapter *padapter = wiphy_to_adapter(wiphy); + struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); + + DBG_871X(FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(ndev)); + + pmlmeext->bstart_bss = _TRUE; + + cfg80211_rtw_add_beacon(wiphy, ndev, info); + + return 0; +} + +static int cfg80211_rtw_del_beacon(struct wiphy *wiphy, struct net_device *ndev) +{ + DBG_871X(FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(ndev)); + + return 0; +} +#else +static int cfg80211_rtw_start_ap(struct wiphy *wiphy, struct net_device *ndev, + struct cfg80211_ap_settings *settings) +{ + int ret = 0; + struct adapter *adapter = wiphy_to_adapter(wiphy); + + DBG_871X(FUNC_NDEV_FMT" hidden_ssid:%d, auth_type:%d\n", FUNC_NDEV_ARG(ndev), + settings->hidden_ssid, settings->auth_type); + + ret = rtw_add_beacon(adapter, settings->beacon.head, settings->beacon.head_len, + settings->beacon.tail, settings->beacon.tail_len); + + adapter->mlmeextpriv.mlmext_info.hidden_ssid_mode = settings->hidden_ssid; + + if (settings->ssid && settings->ssid_len) { + WLAN_BSSID_EX *pbss_network = &adapter->mlmepriv.cur_network.network; + WLAN_BSSID_EX *pbss_network_ext = &adapter->mlmeextpriv.mlmext_info.network; + + if(0) + DBG_871X(FUNC_ADPT_FMT" ssid:(%s,%d), from ie:(%s,%d)\n", FUNC_ADPT_ARG(adapter), + settings->ssid, settings->ssid_len, + pbss_network->Ssid.Ssid, pbss_network->Ssid.SsidLength); + + _rtw_memcpy(pbss_network->Ssid.Ssid, (void *)settings->ssid, settings->ssid_len); + pbss_network->Ssid.SsidLength = settings->ssid_len; + _rtw_memcpy(pbss_network_ext->Ssid.Ssid, (void *)settings->ssid, settings->ssid_len); + pbss_network_ext->Ssid.SsidLength = settings->ssid_len; + + if(0) + DBG_871X(FUNC_ADPT_FMT" after ssid:(%s,%d), (%s,%d)\n", FUNC_ADPT_ARG(adapter), + pbss_network->Ssid.Ssid, pbss_network->Ssid.SsidLength, + pbss_network_ext->Ssid.Ssid, pbss_network_ext->Ssid.SsidLength); + } + + return ret; +} + +static int cfg80211_rtw_change_beacon(struct wiphy *wiphy, struct net_device *ndev, + struct cfg80211_beacon_data *info) +{ + int ret = 0; + struct adapter *adapter = wiphy_to_adapter(wiphy); + + DBG_871X(FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(ndev)); + + ret = rtw_add_beacon(adapter, info->head, info->head_len, info->tail, info->tail_len); + + return ret; +} + +static int cfg80211_rtw_stop_ap(struct wiphy *wiphy, struct net_device *ndev) +{ + DBG_871X(FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(ndev)); + return 0; +} + +#endif //(LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) + +static int cfg80211_rtw_add_station(struct wiphy *wiphy, struct net_device *ndev, + u8 *mac, struct station_parameters *params) +{ + DBG_871X(FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(ndev)); + + return 0; +} + +static int cfg80211_rtw_del_station(struct wiphy *wiphy, struct net_device *ndev, + u8 *mac) +{ + int ret=0; + _irqL irqL; + _list *phead, *plist; + u8 updated; + struct sta_info *psta = NULL; + struct adapter *padapter = (struct adapter *)rtw_netdev_priv(ndev); + struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); + struct sta_priv *pstapriv = &padapter->stapriv; + + DBG_871X("+"FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(ndev)); + + if(check_fwstate(pmlmepriv, (_FW_LINKED|WIFI_AP_STATE)) != _TRUE) + { + DBG_8192C("%s, fw_state != FW_LINKED|WIFI_AP_STATE\n", __func__); + return -EINVAL; + } + + + if(!mac) + { + DBG_8192C("flush all sta, and cam_entry\n"); + + flush_all_cam_entry(padapter); //clear CAM + + ret = rtw_sta_flush(padapter); + + return ret; + } + + + DBG_8192C("free sta macaddr =" MAC_FMT "\n", MAC_ARG(mac)); + + if (mac[0] == 0xff && mac[1] == 0xff && + mac[2] == 0xff && mac[3] == 0xff && + mac[4] == 0xff && mac[5] == 0xff) + { + return -EINVAL; + } + + + _enter_critical_bh(&pstapriv->asoc_list_lock, &irqL); + + phead = &pstapriv->asoc_list; + plist = get_next(phead); + + //check asoc_queue + while ((rtw_end_of_queue_search(phead, plist)) == _FALSE) + { + psta = LIST_CONTAINOR(plist, struct sta_info, asoc_list); + + plist = get_next(plist); + + if(_rtw_memcmp(mac, psta->hwaddr, ETH_ALEN)) + { + if(psta->dot8021xalg == 1 && psta->bpairwise_key_installed == _FALSE) + { + DBG_8192C("%s, sta's dot8021xalg = 1 and key_installed = _FALSE\n", __func__); + } + else + { + DBG_8192C("free psta=%p, aid=%d\n", psta, psta->aid); + + rtw_list_delete(&psta->asoc_list); + pstapriv->asoc_list_cnt--; + + //_exit_critical_bh(&pstapriv->asoc_list_lock, &irqL); + updated = ap_free_sta(padapter, psta, _TRUE, WLAN_REASON_DEAUTH_LEAVING); + //_enter_critical_bh(&pstapriv->asoc_list_lock, &irqL); + + psta = NULL; + + break; + } + + } + + } + + _exit_critical_bh(&pstapriv->asoc_list_lock, &irqL); + + associated_clients_update(padapter, updated); + + DBG_871X("-"FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(ndev)); + + return ret; + +} + +static int cfg80211_rtw_change_station(struct wiphy *wiphy, struct net_device *ndev, + u8 *mac, struct station_parameters *params) +{ + DBG_871X(FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(ndev)); + + return 0; +} + +static int cfg80211_rtw_dump_station(struct wiphy *wiphy, struct net_device *ndev, + int idx, u8 *mac, struct station_info *sinfo) +{ + DBG_871X(FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(ndev)); + + //TODO: dump scanned queue + + return -ENOENT; +} + +static int cfg80211_rtw_change_bss(struct wiphy *wiphy, struct net_device *ndev, + struct bss_parameters *params) +{ + u8 i; + + DBG_871X(FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(ndev)); +/* + DBG_8192C("use_cts_prot=%d\n", params->use_cts_prot); + DBG_8192C("use_short_preamble=%d\n", params->use_short_preamble); + DBG_8192C("use_short_slot_time=%d\n", params->use_short_slot_time); + DBG_8192C("ap_isolate=%d\n", params->ap_isolate); + + DBG_8192C("basic_rates_len=%d\n", params->basic_rates_len); + for(i=0; ibasic_rates_len; i++) + { + DBG_8192C("basic_rates=%d\n", params->basic_rates[i]); + + } +*/ + return 0; + +} + +static int cfg80211_rtw_set_channel(struct wiphy *wiphy + #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35)) + , struct net_device *ndev + #endif + , struct ieee80211_channel *chan, enum nl80211_channel_type channel_type) +{ + #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35)) + DBG_871X(FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(ndev)); + #endif + + return 0; +} + +static int cfg80211_rtw_auth(struct wiphy *wiphy, struct net_device *ndev, + struct cfg80211_auth_request *req) +{ + DBG_871X(FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(ndev)); + + return 0; +} + +static int cfg80211_rtw_assoc(struct wiphy *wiphy, struct net_device *ndev, + struct cfg80211_assoc_request *req) +{ + DBG_871X(FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(ndev)); + + return 0; +} +#endif //CONFIG_AP_MODE + +void rtw_cfg80211_rx_action_p2p(struct adapter *padapter, u8 *pmgmt_frame, uint frame_len) +{ + int type; + s32 freq; + int channel; + struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); + u8 category, action; + + channel = rtw_get_oper_ch(padapter); + + DBG_8192C("RTW_Rx:cur_ch=%d\n", channel); + #ifdef CONFIG_P2P + type = rtw_p2p_check_frames(padapter, pmgmt_frame, frame_len, _FALSE); + if (type >= 0) + goto indicate; + #endif + rtw_action_frame_parse(pmgmt_frame, frame_len, &category, &action); + DBG_871X("RTW_Rx:category(%u), action(%u)\n", category, action); + +indicate: + if (channel <= RTW_CH_MAX_2G_CHANNEL) + freq = rtw_ieee80211_channel_to_frequency(channel, IEEE80211_BAND_2GHZ); + else + freq = rtw_ieee80211_channel_to_frequency(channel, IEEE80211_BAND_5GHZ); + +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE) + rtw_cfg80211_rx_mgmt(padapter, freq, 0, pmgmt_frame, frame_len, GFP_ATOMIC); +#else + cfg80211_rx_action(padapter->pnetdev, freq, pmgmt_frame, frame_len, GFP_ATOMIC); +#endif +} + +void rtw_cfg80211_rx_p2p_action_public(struct adapter *padapter, u8 *pmgmt_frame, uint frame_len) +{ + int type; + s32 freq; + int channel; + struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); + u8 category, action; + + channel = rtw_get_oper_ch(padapter); + + DBG_8192C("RTW_Rx:cur_ch=%d\n", channel); + #ifdef CONFIG_P2P + type = rtw_p2p_check_frames(padapter, pmgmt_frame, frame_len, _FALSE); + if (type >= 0) { + switch (type) { + case P2P_GO_NEGO_CONF: + case P2P_PROVISION_DISC_RESP: + case P2P_INVIT_RESP: + rtw_set_scan_deny(padapter, 2000); + rtw_clear_scan_deny(padapter); + } + goto indicate; + } + #endif + rtw_action_frame_parse(pmgmt_frame, frame_len, &category, &action); + DBG_871X("RTW_Rx:category(%u), action(%u)\n", category, action); + +indicate: + if (channel <= RTW_CH_MAX_2G_CHANNEL) + freq = rtw_ieee80211_channel_to_frequency(channel, IEEE80211_BAND_2GHZ); + else + freq = rtw_ieee80211_channel_to_frequency(channel, IEEE80211_BAND_5GHZ); + +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE) + rtw_cfg80211_rx_mgmt(padapter, freq, 0, pmgmt_frame, frame_len, GFP_ATOMIC); +#else + cfg80211_rx_action(padapter->pnetdev, freq, pmgmt_frame, frame_len, GFP_ATOMIC); +#endif +} + +void rtw_cfg80211_rx_action(struct adapter *adapter, u8 *frame, uint frame_len, const char*msg) +{ + s32 freq; + int channel; + struct mlme_ext_priv *pmlmeext = &(adapter->mlmeextpriv); + struct rtw_wdev_priv *pwdev_priv = wdev_to_priv(adapter->rtw_wdev); + u8 category, action; + + channel = rtw_get_oper_ch(adapter); + + rtw_action_frame_parse(frame, frame_len, &category, &action); + + DBG_8192C("RTW_Rx:cur_ch=%d\n", channel); + if (msg) + DBG_871X("RTW_Rx:%s\n", msg); + else + DBG_871X("RTW_Rx:category(%u), action(%u)\n", category, action); + + if (channel <= RTW_CH_MAX_2G_CHANNEL) + freq = rtw_ieee80211_channel_to_frequency(channel, IEEE80211_BAND_2GHZ); + else + freq = rtw_ieee80211_channel_to_frequency(channel, IEEE80211_BAND_5GHZ); + +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE) + rtw_cfg80211_rx_mgmt(adapter, freq, 0, frame, frame_len, GFP_ATOMIC); +#else + cfg80211_rx_action(adapter->pnetdev, freq, frame, frame_len, GFP_ATOMIC); +#endif + +} + +#ifdef CONFIG_P2P +void rtw_cfg80211_issue_p2p_provision_request(struct adapter *padapter, const u8 *buf, size_t len) +{ + u16 wps_devicepassword_id = 0x0000; + uint wps_devicepassword_id_len = 0; + u8 wpsie[ 255 ] = { 0x00 }, p2p_ie[ 255 ] = { 0x00 }; + uint p2p_ielen = 0; + uint wpsielen = 0; + u32 devinfo_contentlen = 0; + u8 devinfo_content[64] = { 0x00 }; + u16 capability = 0; + uint capability_len = 0; + + unsigned char category = RTW_WLAN_CATEGORY_PUBLIC; + u8 action = P2P_PUB_ACTION_ACTION; + u8 dialogToken = 1; + u32 p2poui = cpu_to_be32(P2POUI); + u8 oui_subtype = P2P_PROVISION_DISC_REQ; + u32 p2pielen = 0; +#ifdef CONFIG_WFD + u32 wfdielen = 0; +#endif //CONFIG_WFD + + struct xmit_frame *pmgntframe; + struct pkt_attrib *pattrib; + unsigned char *pframe; + struct rtw_ieee80211_hdr *pwlanhdr; + unsigned short *fctrl; + struct xmit_priv *pxmitpriv = &(padapter->xmitpriv); + struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); + struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); + + struct wifidirect_info *pwdinfo = &(padapter->wdinfo); + u8 *frame_body = (unsigned char *)(buf + sizeof(struct rtw_ieee80211_hdr_3addr)); + size_t frame_body_len = len - sizeof(struct rtw_ieee80211_hdr_3addr); + + + DBG_871X( "[%s] In\n", __FUNCTION__ ); + + //prepare for building provision_request frame + _rtw_memcpy(pwdinfo->tx_prov_disc_info.peerIFAddr, GetAddr1Ptr(buf), ETH_ALEN); + _rtw_memcpy(pwdinfo->tx_prov_disc_info.peerDevAddr, GetAddr1Ptr(buf), ETH_ALEN); + + pwdinfo->tx_prov_disc_info.wps_config_method_request = WPS_CM_PUSH_BUTTON; + + rtw_get_wps_ie( frame_body + _PUBLIC_ACTION_IE_OFFSET_, frame_body_len - _PUBLIC_ACTION_IE_OFFSET_, wpsie, &wpsielen); + rtw_get_wps_attr_content( wpsie, wpsielen, WPS_ATTR_DEVICE_PWID, (u8*) &wps_devicepassword_id, &wps_devicepassword_id_len); + wps_devicepassword_id = be16_to_cpu( wps_devicepassword_id ); + + switch(wps_devicepassword_id) + { + case WPS_DPID_PIN: + pwdinfo->tx_prov_disc_info.wps_config_method_request = WPS_CM_LABEL; + break; + case WPS_DPID_USER_SPEC: + pwdinfo->tx_prov_disc_info.wps_config_method_request = WPS_CM_DISPLYA; + break; + case WPS_DPID_MACHINE_SPEC: + break; + case WPS_DPID_REKEY: + break; + case WPS_DPID_PBC: + pwdinfo->tx_prov_disc_info.wps_config_method_request = WPS_CM_PUSH_BUTTON; + break; + case WPS_DPID_REGISTRAR_SPEC: + pwdinfo->tx_prov_disc_info.wps_config_method_request = WPS_CM_KEYPAD; + break; + default: + break; + } + + + if ( rtw_get_p2p_ie( frame_body + _PUBLIC_ACTION_IE_OFFSET_, frame_body_len - _PUBLIC_ACTION_IE_OFFSET_, p2p_ie, &p2p_ielen ) ) + { + + rtw_get_p2p_attr_content( p2p_ie, p2p_ielen, P2P_ATTR_DEVICE_INFO, devinfo_content, &devinfo_contentlen); + rtw_get_p2p_attr_content( p2p_ie, p2p_ielen, P2P_ATTR_CAPABILITY, (u8*)&capability, &capability_len); + + } + + + //start to build provision_request frame + _rtw_memset(wpsie, 0, sizeof(wpsie)); + _rtw_memset(p2p_ie, 0, sizeof(p2p_ie)); + p2p_ielen = 0; + + if ((pmgntframe = alloc_mgtxmitframe(pxmitpriv)) == NULL) + { + return; + } + + + //update attribute + pattrib = &pmgntframe->attrib; + update_mgntframe_attrib(padapter, pattrib); + + _rtw_memset(pmgntframe->buf_addr, 0, WLANHDR_OFFSET + TXDESC_OFFSET); + + pframe = (u8 *)(pmgntframe->buf_addr) + TXDESC_OFFSET; + pwlanhdr = (struct rtw_ieee80211_hdr *)pframe; + + fctrl = &(pwlanhdr->frame_ctl); + *(fctrl) = 0; + + _rtw_memcpy(pwlanhdr->addr1, pwdinfo->tx_prov_disc_info.peerDevAddr, ETH_ALEN); + _rtw_memcpy(pwlanhdr->addr2, myid(&(padapter->eeprompriv)), ETH_ALEN); + _rtw_memcpy(pwlanhdr->addr3, pwdinfo->tx_prov_disc_info.peerDevAddr, ETH_ALEN); + + SetSeqNum(pwlanhdr, pmlmeext->mgnt_seq); + pmlmeext->mgnt_seq++; + SetFrameSubType(pframe, WIFI_ACTION); + + pframe += sizeof(struct rtw_ieee80211_hdr_3addr); + pattrib->pktlen = sizeof(struct rtw_ieee80211_hdr_3addr); + + pframe = rtw_set_fixed_ie(pframe, 1, &(category), &(pattrib->pktlen)); + pframe = rtw_set_fixed_ie(pframe, 1, &(action), &(pattrib->pktlen)); + pframe = rtw_set_fixed_ie(pframe, 4, (unsigned char *) &(p2poui), &(pattrib->pktlen)); + pframe = rtw_set_fixed_ie(pframe, 1, &(oui_subtype), &(pattrib->pktlen)); + pframe = rtw_set_fixed_ie(pframe, 1, &(dialogToken), &(pattrib->pktlen)); + + + //build_prov_disc_request_p2p_ie + // P2P OUI + p2pielen = 0; + p2p_ie[ p2pielen++ ] = 0x50; + p2p_ie[ p2pielen++ ] = 0x6F; + p2p_ie[ p2pielen++ ] = 0x9A; + p2p_ie[ p2pielen++ ] = 0x09; // WFA P2P v1.0 + + // Commented by Albert 20110301 + // According to the P2P Specification, the provision discovery request frame should contain 3 P2P attributes + // 1. P2P Capability + // 2. Device Info + // 3. Group ID ( When joining an operating P2P Group ) + + // P2P Capability ATTR + // Type: + p2p_ie[ p2pielen++ ] = P2P_ATTR_CAPABILITY; + + // Length: + //*(u16*) ( p2pie + p2pielen ) = cpu_to_le16( 0x0002 ); + RTW_PUT_LE16(p2p_ie + p2pielen, 0x0002); + p2pielen += 2; + + // Value: + // Device Capability Bitmap, 1 byte + // Group Capability Bitmap, 1 byte + _rtw_memcpy(p2p_ie + p2pielen, &capability, 2); + p2pielen += 2; + + + // Device Info ATTR + // Type: + p2p_ie[ p2pielen++ ] = P2P_ATTR_DEVICE_INFO; + + // Length: + // 21 -> P2P Device Address (6bytes) + Config Methods (2bytes) + Primary Device Type (8bytes) + // + NumofSecondDevType (1byte) + WPS Device Name ID field (2bytes) + WPS Device Name Len field (2bytes) + //*(u16*) ( p2pie + p2pielen ) = cpu_to_le16( 21 + pwdinfo->device_name_len ); + RTW_PUT_LE16(p2p_ie + p2pielen, devinfo_contentlen); + p2pielen += 2; + + // Value: + _rtw_memcpy(p2p_ie + p2pielen, devinfo_content, devinfo_contentlen); + p2pielen += devinfo_contentlen; + + + pframe = rtw_set_ie(pframe, _VENDOR_SPECIFIC_IE_, p2pielen, (unsigned char *) p2p_ie, &p2p_ielen); + //p2pielen = build_prov_disc_request_p2p_ie( pwdinfo, pframe, NULL, 0, pwdinfo->tx_prov_disc_info.peerDevAddr); + //pframe += p2pielen; + pattrib->pktlen += p2p_ielen; + + wpsielen = 0; + // WPS OUI + *(u32*) ( wpsie ) = cpu_to_be32( WPSOUI ); + wpsielen += 4; + + // WPS version + // Type: + *(u16*) ( wpsie + wpsielen ) = cpu_to_be16( WPS_ATTR_VER1 ); + wpsielen += 2; + + // Length: + *(u16*) ( wpsie + wpsielen ) = cpu_to_be16( 0x0001 ); + wpsielen += 2; + + // Value: + wpsie[wpsielen++] = WPS_VERSION_1; // Version 1.0 + + // Config Method + // Type: + *(u16*) ( wpsie + wpsielen ) = cpu_to_be16( WPS_ATTR_CONF_METHOD ); + wpsielen += 2; + + // Length: + *(u16*) ( wpsie + wpsielen ) = cpu_to_be16( 0x0002 ); + wpsielen += 2; + + // Value: + *(u16*) ( wpsie + wpsielen ) = cpu_to_be16( pwdinfo->tx_prov_disc_info.wps_config_method_request ); + wpsielen += 2; + + pframe = rtw_set_ie(pframe, _VENDOR_SPECIFIC_IE_, wpsielen, (unsigned char *) wpsie, &pattrib->pktlen ); + + +#ifdef CONFIG_WFD + wfdielen = build_provdisc_req_wfd_ie(pwdinfo, pframe); + pframe += wfdielen; + pattrib->pktlen += wfdielen; +#endif //CONFIG_WFD + + pattrib->last_txcmdsz = pattrib->pktlen; + + //dump_mgntframe(padapter, pmgntframe); + if (dump_mgntframe_and_wait_ack(padapter, pmgntframe) != _SUCCESS) + DBG_8192C("%s, ack to\n", __func__); + + //if(wps_devicepassword_id == WPS_DPID_REGISTRAR_SPEC) + //{ + // DBG_8192C("waiting for p2p peer key-in PIN CODE\n"); + // rtw_msleep_os(15000); // 15 sec for key in PIN CODE, workaround for GS2 before issuing Nego Req. + //} + +} + +static s32 cfg80211_rtw_remain_on_channel(struct wiphy *wiphy, +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0)) + struct wireless_dev *wdev, +#else + struct net_device *ndev, +#endif + struct ieee80211_channel * channel, +#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,8,0)) + enum nl80211_channel_type channel_type, +#endif + unsigned int duration, u64 *cookie) +{ + s32 err = 0; + struct adapter *padapter = wiphy_to_adapter(wiphy); + struct rtw_wdev_priv *pwdev_priv = wdev_to_priv(padapter->rtw_wdev); + struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; + struct wifidirect_info *pwdinfo = &padapter->wdinfo; + struct cfg80211_wifidirect_info *pcfg80211_wdinfo = &padapter->cfg80211_wdinfo; + u8 remain_ch = (u8) ieee80211_frequency_to_channel(channel->center_freq); + u8 ready_on_channel = _FALSE; + + DBG_871X(FUNC_ADPT_FMT" ch:%u duration:%d\n", FUNC_ADPT_ARG(padapter), remain_ch, duration); + + if(pcfg80211_wdinfo->is_ro_ch == _TRUE) + { + DBG_8192C("%s, cancel ro ch timer\n", __func__); + + _cancel_timer_ex(&padapter->cfg80211_wdinfo.remain_on_ch_timer); + +#ifdef CONFIG_CONCURRENT_MODE + ATOMIC_SET(&pwdev_priv->ro_ch_to, 1); +#endif //CONFIG_CONCURRENT_MODE + + p2p_protocol_wk_hdl(padapter, P2P_RO_CH_WK); + } + + pcfg80211_wdinfo->is_ro_ch = _TRUE; + + if(_FAIL == rtw_pwr_wakeup(padapter)) { + err = -EFAULT; + goto exit; + } + + _rtw_memcpy(&pcfg80211_wdinfo->remain_on_ch_channel, channel, sizeof(struct ieee80211_channel)); + #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,8,0)) + pcfg80211_wdinfo->remain_on_ch_type= channel_type; + #endif + pcfg80211_wdinfo->remain_on_ch_cookie= *cookie; + + rtw_scan_abort(padapter); +#ifdef CONFIG_CONCURRENT_MODE + if(rtw_buddy_adapter_up(padapter)) + rtw_scan_abort(padapter->pbuddy_adapter); +#endif //CONFIG_CONCURRENT_MODE + + //if(!rtw_p2p_chk_role(pwdinfo, P2P_ROLE_CLIENT) && !rtw_p2p_chk_role(pwdinfo, P2P_ROLE_GO)) + if(rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) + { + rtw_p2p_enable(padapter, P2P_ROLE_DEVICE); + wdev_to_priv(padapter->rtw_wdev)->p2p_enabled = _TRUE; + padapter->wdinfo.listen_channel = remain_ch; + } + else + { + rtw_p2p_set_pre_state(pwdinfo, rtw_p2p_state(pwdinfo)); +#ifdef CONFIG_DEBUG_CFG80211 + DBG_8192C("%s, role=%d, p2p_state=%d\n", __func__, rtw_p2p_role(pwdinfo), rtw_p2p_state(pwdinfo)); +#endif + } + + + rtw_p2p_set_state(pwdinfo, P2P_STATE_LISTEN); + + + if(duration < 400) + duration = duration*3;//extend from exper. + + +#ifdef CONFIG_CONCURRENT_MODE + if(check_buddy_fwstate(padapter, _FW_LINKED) && + (durationext_listen_interval)) + { + duration = duration + pwdinfo->ext_listen_interval; + } +#endif + + pcfg80211_wdinfo->restore_channel = rtw_get_oper_ch(padapter); + + if(rtw_ch_set_search_ch(pmlmeext->channel_set, remain_ch) >= 0) { +#ifdef CONFIG_CONCURRENT_MODE + if ( check_buddy_fwstate(padapter, _FW_LINKED ) ) + { + PADAPTER pbuddy_adapter = padapter->pbuddy_adapter; + struct mlme_ext_priv *pbuddy_mlmeext = &pbuddy_adapter->mlmeextpriv; + + if(remain_ch != pbuddy_mlmeext->cur_channel) + { + if(ATOMIC_READ(&pwdev_priv->switch_ch_to)==1 || + (remain_ch != pmlmeext->cur_channel)) + { + DBG_8192C("%s, issue nulldata pwrbit=1\n", __func__); + issue_nulldata(padapter->pbuddy_adapter, NULL, 1, 3, 500); + + ATOMIC_SET(&pwdev_priv->switch_ch_to, 0); + + DBG_8192C("%s, set switch ch timer, duration=%d\n", __func__, duration-pwdinfo->ext_listen_interval); + _set_timer(&pwdinfo->ap_p2p_switch_timer, duration-pwdinfo->ext_listen_interval); + } + } + + ready_on_channel = _TRUE; + //pmlmeext->cur_channel = remain_ch; + //set_channel_bwmode(padapter, remain_ch, HAL_PRIME_CHNL_OFFSET_DONT_CARE, HT_CHANNEL_WIDTH_20); + }else +#endif //CONFIG_CONCURRENT_MODE + if(remain_ch != rtw_get_oper_ch(padapter) ) + { + ready_on_channel = _TRUE; + //pmlmeext->cur_channel = remain_ch; + //set_channel_bwmode(padapter, remain_ch, HAL_PRIME_CHNL_OFFSET_DONT_CARE, HT_CHANNEL_WIDTH_20); + } + } else { + DBG_871X("%s remain_ch:%u not in channel plan!!!!\n", __FUNCTION__, remain_ch); + } + + + //call this after other things have been done +#ifdef CONFIG_CONCURRENT_MODE + if(ATOMIC_READ(&pwdev_priv->ro_ch_to)==1 || + (remain_ch != rtw_get_oper_ch(padapter))) + { + u8 co_channel = 0xff; + ATOMIC_SET(&pwdev_priv->ro_ch_to, 0); +#endif + + if(ready_on_channel == _TRUE) + { + if ( !check_fwstate(&padapter->mlmepriv, _FW_LINKED ) ) + { + pmlmeext->cur_channel = remain_ch; + + + set_channel_bwmode(padapter, remain_ch, HAL_PRIME_CHNL_OFFSET_DONT_CARE, HT_CHANNEL_WIDTH_20); + } + } + DBG_8192C("%s, set ro ch timer, duration=%d\n", __func__, duration); + _set_timer( &pcfg80211_wdinfo->remain_on_ch_timer, duration); + +#ifdef CONFIG_CONCURRENT_MODE + } +#endif + + rtw_cfg80211_ready_on_channel(padapter, *cookie, channel, channel_type, duration, GFP_KERNEL); + +exit: + if (err) + pcfg80211_wdinfo->is_ro_ch = _FALSE; + + return err; +} + +static s32 cfg80211_rtw_cancel_remain_on_channel(struct wiphy *wiphy, +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0)) + struct wireless_dev *wdev, +#else + struct net_device *ndev, +#endif + u64 cookie) +{ + s32 err = 0; + struct adapter *padapter = wiphy_to_adapter(wiphy); + struct rtw_wdev_priv *pwdev_priv = wdev_to_priv(padapter->rtw_wdev); + struct wifidirect_info *pwdinfo = &padapter->wdinfo; + struct cfg80211_wifidirect_info *pcfg80211_wdinfo = &padapter->cfg80211_wdinfo; + + DBG_871X(FUNC_ADPT_FMT"\n", FUNC_ADPT_ARG(padapter)); + + if (pcfg80211_wdinfo->is_ro_ch == _TRUE) { + DBG_8192C("%s, cancel ro ch timer\n", __func__); + _cancel_timer_ex(&padapter->cfg80211_wdinfo.remain_on_ch_timer); + #ifdef CONFIG_CONCURRENT_MODE + ATOMIC_SET(&pwdev_priv->ro_ch_to, 1); + #endif + p2p_protocol_wk_hdl(padapter, P2P_RO_CH_WK); + } + + #if 0 + // Disable P2P Listen State + if(!rtw_p2p_chk_role(pwdinfo, P2P_ROLE_CLIENT) && !rtw_p2p_chk_role(pwdinfo, P2P_ROLE_GO)) + { + if(!rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) + { + rtw_p2p_set_state(pwdinfo, P2P_STATE_NONE); + _rtw_memset(pwdinfo, 0x00, sizeof(struct wifidirect_info)); + } + } + else + #endif + { + rtw_p2p_set_state(pwdinfo, rtw_p2p_pre_state(pwdinfo)); +#ifdef CONFIG_DEBUG_CFG80211 + DBG_8192C("%s, role=%d, p2p_state=%d\n", __func__, rtw_p2p_role(pwdinfo), rtw_p2p_state(pwdinfo)); +#endif + } + pcfg80211_wdinfo->is_ro_ch = _FALSE; + + return err; +} + +#endif //CONFIG_P2P + +static int _cfg80211_rtw_mgmt_tx(struct adapter *padapter, u8 tx_ch, const u8 *buf, size_t len) +{ + struct xmit_frame *pmgntframe; + struct pkt_attrib *pattrib; + unsigned char *pframe; + int ret = _FAIL; + bool ack = _TRUE; + struct rtw_ieee80211_hdr *pwlanhdr; + struct rtw_wdev_priv *pwdev_priv = wdev_to_priv(padapter->rtw_wdev); + struct xmit_priv *pxmitpriv = &(padapter->xmitpriv); + struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); + struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); + struct wifidirect_info *pwdinfo = &padapter->wdinfo; + //struct cfg80211_wifidirect_info *pcfg80211_wdinfo = &padapter->cfg80211_wdinfo; + + if(_FAIL == rtw_pwr_wakeup(padapter)) { + ret = -EFAULT; + goto exit; + } + + rtw_set_scan_deny(padapter, 1000); + + rtw_scan_abort(padapter); + #ifdef CONFIG_CONCURRENT_MODE + if(rtw_buddy_adapter_up(padapter)) + rtw_scan_abort(padapter->pbuddy_adapter); + #endif /* CONFIG_CONCURRENT_MODE */ + + if (padapter->cfg80211_wdinfo.is_ro_ch == _TRUE) { + //DBG_8192C("%s, cancel ro ch timer\n", __func__); + //_cancel_timer_ex(&padapter->cfg80211_wdinfo.remain_on_ch_timer); + //padapter->cfg80211_wdinfo.is_ro_ch = _FALSE; + #ifdef CONFIG_CONCURRENT_MODE + if (!check_fwstate(&padapter->mlmepriv, _FW_LINKED )) + { + DBG_8192C("%s, extend ro ch time\n", __func__); + _set_timer( &padapter->cfg80211_wdinfo.remain_on_ch_timer, pwdinfo->ext_listen_period); + } + #endif //CONFIG_CONCURRENT_MODE + } + +#ifdef CONFIG_CONCURRENT_MODE + if (check_buddy_fwstate(padapter, _FW_LINKED )) { + u8 co_channel=0xff; + PADAPTER pbuddy_adapter = padapter->pbuddy_adapter; + struct mlme_ext_priv *pbuddy_mlmeext = &pbuddy_adapter->mlmeextpriv; + + co_channel = rtw_get_oper_ch(padapter); + + if (tx_ch != pbuddy_mlmeext->cur_channel) { + + u16 ext_listen_period; + + if (ATOMIC_READ(&pwdev_priv->switch_ch_to)==1) { + DBG_8192C("%s, issue nulldata pwrbit=1\n", __func__); + issue_nulldata(padapter->pbuddy_adapter, NULL, 1, 3, 500); + + ATOMIC_SET(&pwdev_priv->switch_ch_to, 0); + + //DBG_8192C("%s, set switch ch timer, period=%d\n", __func__, pwdinfo->ext_listen_period); + //_set_timer(&pwdinfo->ap_p2p_switch_timer, pwdinfo->ext_listen_period); + } + + if (check_fwstate(&padapter->mlmepriv, _FW_LINKED )) + { + ext_listen_period = 500;// 500ms + } + else + { + ext_listen_period = pwdinfo->ext_listen_period; + } + + DBG_8192C("%s, set switch ch timer, period=%d\n", __func__, ext_listen_period); + _set_timer(&pwdinfo->ap_p2p_switch_timer, ext_listen_period); + + } + + if (!check_fwstate(&padapter->mlmepriv, _FW_LINKED )) + pmlmeext->cur_channel = tx_ch; + + if (tx_ch != co_channel) + set_channel_bwmode(padapter, tx_ch, HAL_PRIME_CHNL_OFFSET_DONT_CARE, HT_CHANNEL_WIDTH_20); + }else +#endif //CONFIG_CONCURRENT_MODE + //if (tx_ch != pmlmeext->cur_channel) { + if(tx_ch != rtw_get_oper_ch(padapter)) { + if (!check_fwstate(&padapter->mlmepriv, _FW_LINKED )) + pmlmeext->cur_channel = tx_ch; + set_channel_bwmode(padapter, tx_ch, HAL_PRIME_CHNL_OFFSET_DONT_CARE, HT_CHANNEL_WIDTH_20); + } + + //starting alloc mgmt frame to dump it + if ((pmgntframe = alloc_mgtxmitframe(pxmitpriv)) == NULL) + { + //ret = -ENOMEM; + ret = _FAIL; + goto exit; + } + + //update attribute + pattrib = &pmgntframe->attrib; + update_mgntframe_attrib(padapter, pattrib); + pattrib->retry_ctrl = _FALSE; + + _rtw_memset(pmgntframe->buf_addr, 0, WLANHDR_OFFSET + TXDESC_OFFSET); + + pframe = (u8 *)(pmgntframe->buf_addr) + TXDESC_OFFSET; + + _rtw_memcpy(pframe, (void*)buf, len); + pattrib->pktlen = len; + + pwlanhdr = (struct rtw_ieee80211_hdr *)pframe; + //update seq number + pmlmeext->mgnt_seq = GetSequence(pwlanhdr); + pattrib->seqnum = pmlmeext->mgnt_seq; + pmlmeext->mgnt_seq++; + +#ifdef CONFIG_WFD + { + struct wifi_display_info *pwfd_info; + + pwfd_info = padapter->wdinfo.wfd_info; + + if ( _TRUE == pwfd_info->wfd_enable ) + { + rtw_append_wfd_ie( padapter, pframe, &pattrib->pktlen ); + } + } +#endif // CONFIG_WFD + + pattrib->last_txcmdsz = pattrib->pktlen; + + if (dump_mgntframe_and_wait_ack(padapter, pmgntframe) != _SUCCESS) + { + ack = _FALSE; + ret = _FAIL; + + #ifdef CONFIG_DEBUG_CFG80211 + DBG_8192C("%s, ack == _FAIL\n", __func__); + #endif + } + else + { + #ifdef CONFIG_DEBUG_CFG80211 + DBG_8192C("%s, ack=%d, ok!\n", __func__, ack); + #endif + ret = _SUCCESS; + } + +exit: + + #ifdef CONFIG_DEBUG_CFG80211 + DBG_8192C("%s, ret=%d\n", __func__, ret); + #endif + + return ret; + +} + +static int cfg80211_rtw_mgmt_tx(struct wiphy *wiphy, +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0)) + struct wireless_dev *wdev, +#else + struct net_device *ndev, +#endif + struct ieee80211_channel *chan, +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) || defined(COMPAT_KERNEL_RELEASE) + bool offchan, +#endif +#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,8,0)) + enum nl80211_channel_type channel_type, + #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE) + bool channel_type_valid, + #endif +#endif +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) || defined(COMPAT_KERNEL_RELEASE) + unsigned int wait, +#endif + const u8 *buf, size_t len, +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0)) + bool no_cck, +#endif +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0)) + bool dont_wait_for_ack, +#endif + u64 *cookie) +{ + struct adapter *padapter = (struct adapter *)wiphy_to_adapter(wiphy); + struct rtw_wdev_priv *pwdev_priv = wdev_to_priv(padapter->rtw_wdev); + int ret = 0; + int tx_ret; + u32 dump_limit = RTW_MAX_MGMT_TX_CNT; + u32 dump_cnt = 0; + bool ack = _TRUE; + u8 tx_ch = (u8)ieee80211_frequency_to_channel(chan->center_freq); + u8 category, action; + int type = (-1); + u32 start = rtw_get_current_time(); + + /* cookie generation */ + *cookie = (unsigned long) buf; + +#ifdef CONFIG_DEBUG_CFG80211 + DBG_871X(FUNC_ADPT_FMT" len=%zu, ch=%d" + #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,8,0)) + ", ch_type=%d" + #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE) + ", channel_type_valid=%d" + #endif + #endif + "\n", FUNC_ADPT_ARG(padapter), + len, tx_ch + #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,8,0)) + , channel_type + #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE) + , channel_type_valid + #endif + #endif + ); +#endif /* CONFIG_DEBUG_CFG80211 */ + + /* indicate ack before issue frame to avoid racing with rsp frame */ +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE) + rtw_cfg80211_mgmt_tx_status(padapter, *cookie, buf, len, ack, GFP_KERNEL); +#elif (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,34) && LINUX_VERSION_CODE<=KERNEL_VERSION(2,6,35)) + cfg80211_action_tx_status(ndev, *cookie, buf, len, ack, GFP_KERNEL); +#endif + + if (rtw_action_frame_parse(buf, len, &category, &action) == _FALSE) { + DBG_8192C(FUNC_ADPT_FMT" frame_control:0x%x\n", FUNC_ADPT_ARG(padapter), + le16_to_cpu(((struct rtw_ieee80211_hdr_3addr *)buf)->frame_ctl)); + goto exit; + } + + DBG_8192C("RTW_Tx:tx_ch=%d, da="MAC_FMT"\n", tx_ch, MAC_ARG(GetAddr1Ptr(buf))); + #ifdef CONFIG_P2P + if((type = rtw_p2p_check_frames(padapter, buf, len, _TRUE)) >= 0) { + goto dump; + } + #endif + if (category == RTW_WLAN_CATEGORY_PUBLIC) + DBG_871X("RTW_Tx:%s\n", action_public_str(action)); + else + DBG_871X("RTW_Tx:category(%u), action(%u)\n", category, action); + +dump: + do { + dump_cnt++; + tx_ret = _cfg80211_rtw_mgmt_tx(padapter, tx_ch, buf, len); + } while (dump_cnt < dump_limit && tx_ret != _SUCCESS); + + if (tx_ret != _SUCCESS || dump_cnt > 1) { + DBG_871X(FUNC_ADPT_FMT" %s (%d/%d) in %d ms\n", FUNC_ADPT_ARG(padapter), + tx_ret==_SUCCESS?"OK":"FAIL", dump_cnt, dump_limit, rtw_get_passing_time_ms(start)); + } + + switch (type) { + case P2P_GO_NEGO_CONF: + rtw_clear_scan_deny(padapter); + break; + case P2P_INVIT_RESP: + if (pwdev_priv->invit_info.flags & BIT(0) + && pwdev_priv->invit_info.status == 0) + { + DBG_871X(FUNC_ADPT_FMT" agree with invitation of persistent group\n", + FUNC_ADPT_ARG(padapter)); + rtw_set_scan_deny(padapter, 5000); + rtw_pwr_wakeup_ex(padapter, 5000); + rtw_clear_scan_deny(padapter); + } + break; + } + +exit: + return ret; +} + +static void cfg80211_rtw_mgmt_frame_register(struct wiphy *wiphy, +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0)) + struct wireless_dev *wdev, +#else + struct net_device *ndev, +#endif + u16 frame_type, bool reg) +{ + _adapter *adapter = wiphy_to_adapter(wiphy); + +#ifdef CONFIG_DEBUG_CFG80211 + DBG_871X(FUNC_ADPT_FMT" frame_type:%x, reg:%d\n", FUNC_ADPT_ARG(adapter), + frame_type, reg); +#endif + + if (frame_type != (IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_PROBE_REQ)) + return; + + return; +} + +static int rtw_cfg80211_set_beacon_wpsp2pie(struct net_device *ndev, char *buf, int len) +{ + int ret = 0; + uint wps_ielen = 0; + u8 *wps_ie; + u32 p2p_ielen = 0; + u8 wps_oui[8]={0x0,0x50,0xf2,0x04}; + u8 *p2p_ie; + u32 wfd_ielen = 0; + u8 *wfd_ie; + _adapter *padapter = (_adapter *)rtw_netdev_priv(ndev); + struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); + struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); + + DBG_871X(FUNC_NDEV_FMT" ielen=%d\n", FUNC_NDEV_ARG(ndev), len); + + if(len>0) + { + if((wps_ie = rtw_get_wps_ie(buf, len, NULL, &wps_ielen))) + { + #ifdef CONFIG_DEBUG_CFG80211 + DBG_8192C("bcn_wps_ielen=%d\n", wps_ielen); + #endif + + if(pmlmepriv->wps_beacon_ie) + { + u32 free_len = pmlmepriv->wps_beacon_ie_len; + pmlmepriv->wps_beacon_ie_len = 0; + rtw_mfree(pmlmepriv->wps_beacon_ie, free_len); + pmlmepriv->wps_beacon_ie = NULL; + } + + pmlmepriv->wps_beacon_ie = rtw_malloc(wps_ielen); + if ( pmlmepriv->wps_beacon_ie == NULL) { + DBG_8192C("%s()-%d: rtw_malloc() ERROR!\n", __FUNCTION__, __LINE__); + return -EINVAL; + + } + + _rtw_memcpy(pmlmepriv->wps_beacon_ie, wps_ie, wps_ielen); + pmlmepriv->wps_beacon_ie_len = wps_ielen; + + update_beacon(padapter, _VENDOR_SPECIFIC_IE_, wps_oui, _TRUE); + + } + + //buf += wps_ielen; + //len -= wps_ielen; + + #ifdef CONFIG_P2P + if((p2p_ie=rtw_get_p2p_ie(buf, len, NULL, &p2p_ielen))) + { + #ifdef CONFIG_DEBUG_CFG80211 + DBG_8192C("bcn_p2p_ielen=%d\n", p2p_ielen); + #endif + + if(pmlmepriv->p2p_beacon_ie) + { + u32 free_len = pmlmepriv->p2p_beacon_ie_len; + pmlmepriv->p2p_beacon_ie_len = 0; + rtw_mfree(pmlmepriv->p2p_beacon_ie, free_len); + pmlmepriv->p2p_beacon_ie = NULL; + } + + pmlmepriv->p2p_beacon_ie = rtw_malloc(p2p_ielen); + if ( pmlmepriv->p2p_beacon_ie == NULL) { + DBG_8192C("%s()-%d: rtw_malloc() ERROR!\n", __FUNCTION__, __LINE__); + return -EINVAL; + + } + + _rtw_memcpy(pmlmepriv->p2p_beacon_ie, p2p_ie, p2p_ielen); + pmlmepriv->p2p_beacon_ie_len = p2p_ielen; + + } + #endif //CONFIG_P2P + + //buf += p2p_ielen; + //len -= p2p_ielen; + + #ifdef CONFIG_WFD + if(rtw_get_wfd_ie(buf, len, NULL, &wfd_ielen)) + { + #ifdef CONFIG_DEBUG_CFG80211 + DBG_8192C("bcn_wfd_ielen=%d\n", wfd_ielen); + #endif + + if(pmlmepriv->wfd_beacon_ie) + { + u32 free_len = pmlmepriv->wfd_beacon_ie_len; + pmlmepriv->wfd_beacon_ie_len = 0; + rtw_mfree(pmlmepriv->wfd_beacon_ie, free_len); + pmlmepriv->wfd_beacon_ie = NULL; + } + + pmlmepriv->wfd_beacon_ie = rtw_malloc(wfd_ielen); + if ( pmlmepriv->wfd_beacon_ie == NULL) { + DBG_8192C("%s()-%d: rtw_malloc() ERROR!\n", __FUNCTION__, __LINE__); + return -EINVAL; + + } + rtw_get_wfd_ie(buf, len, pmlmepriv->wfd_beacon_ie, &pmlmepriv->wfd_beacon_ie_len); + } + #endif //CONFIG_WFD + + pmlmeext->bstart_bss = _TRUE; + + } + + return ret; + +} + +static int rtw_cfg80211_set_probe_resp_wpsp2pie(struct net_device *net, char *buf, int len) +{ + int ret = 0; + uint wps_ielen = 0; + u8 *wps_ie; + u32 p2p_ielen = 0; + u8 *p2p_ie; + u32 wfd_ielen = 0; + u8 *wfd_ie; + _adapter *padapter = (_adapter *)rtw_netdev_priv(net); + struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); + +#ifdef CONFIG_DEBUG_CFG80211 + DBG_8192C("%s, ielen=%d\n", __func__, len); +#endif + + if(len>0) + { + if((wps_ie = rtw_get_wps_ie(buf, len, NULL, &wps_ielen))) + { + uint attr_contentlen = 0; + u16 uconfig_method, *puconfig_method = NULL; + + #ifdef CONFIG_DEBUG_CFG80211 + DBG_8192C("probe_resp_wps_ielen=%d\n", wps_ielen); + #endif + + if(check_fwstate(pmlmepriv, WIFI_UNDER_WPS)) + { + u8 sr = 0; + rtw_get_wps_attr_content(wps_ie, wps_ielen, WPS_ATTR_SELECTED_REGISTRAR, (u8*)(&sr), NULL); + + if (sr != 0) + { + DBG_871X("%s, got sr\n", __func__); + } + else + { + DBG_8192C("GO mode process WPS under site-survey, sr no set\n"); + return ret; + } + } + + if(pmlmepriv->wps_probe_resp_ie) + { + u32 free_len = pmlmepriv->wps_probe_resp_ie_len; + pmlmepriv->wps_probe_resp_ie_len = 0; + rtw_mfree(pmlmepriv->wps_probe_resp_ie, free_len); + pmlmepriv->wps_probe_resp_ie = NULL; + } + + pmlmepriv->wps_probe_resp_ie = rtw_malloc(wps_ielen); + if ( pmlmepriv->wps_probe_resp_ie == NULL) { + DBG_8192C("%s()-%d: rtw_malloc() ERROR!\n", __FUNCTION__, __LINE__); + return -EINVAL; + + } + + //add PUSH_BUTTON config_method by driver self in wpsie of probe_resp at GO Mode + if ( (puconfig_method = (u16*)rtw_get_wps_attr_content( wps_ie, wps_ielen, WPS_ATTR_CONF_METHOD , NULL, &attr_contentlen)) != NULL ) + { + #ifdef CONFIG_DEBUG_CFG80211 + //printk("config_method in wpsie of probe_resp = 0x%x\n", be16_to_cpu(*puconfig_method)); + #endif + + uconfig_method = WPS_CM_PUSH_BUTTON; + uconfig_method = cpu_to_be16( uconfig_method ); + + *puconfig_method |= uconfig_method; + } + + _rtw_memcpy(pmlmepriv->wps_probe_resp_ie, wps_ie, wps_ielen); + pmlmepriv->wps_probe_resp_ie_len = wps_ielen; + + } + + //buf += wps_ielen; + //len -= wps_ielen; + + #ifdef CONFIG_P2P + if((p2p_ie=rtw_get_p2p_ie(buf, len, NULL, &p2p_ielen))) + { + u8 is_GO = _FALSE; + u32 attr_contentlen = 0; + u16 cap_attr=0; + + #ifdef CONFIG_DEBUG_CFG80211 + DBG_8192C("probe_resp_p2p_ielen=%d\n", p2p_ielen); + #endif + + //Check P2P Capability ATTR + if( rtw_get_p2p_attr_content( p2p_ie, p2p_ielen, P2P_ATTR_CAPABILITY, (u8*)&cap_attr, (uint*) &attr_contentlen) ) + { + u8 grp_cap=0; + //DBG_8192C( "[%s] Got P2P Capability Attr!!\n", __FUNCTION__ ); + cap_attr = le16_to_cpu(cap_attr); + grp_cap = (u8)((cap_attr >> 8)&0xff); + + is_GO = (grp_cap&BIT(0)) ? _TRUE:_FALSE; + + if(is_GO) + DBG_8192C("Got P2P Capability Attr, grp_cap=0x%x, is_GO\n", grp_cap); + } + + + if(is_GO == _FALSE) + { + if(pmlmepriv->p2p_probe_resp_ie) + { + u32 free_len = pmlmepriv->p2p_probe_resp_ie_len; + pmlmepriv->p2p_probe_resp_ie_len = 0; + rtw_mfree(pmlmepriv->p2p_probe_resp_ie, free_len); + pmlmepriv->p2p_probe_resp_ie = NULL; + } + + pmlmepriv->p2p_probe_resp_ie = rtw_malloc(p2p_ielen); + if ( pmlmepriv->p2p_probe_resp_ie == NULL) { + DBG_8192C("%s()-%d: rtw_malloc() ERROR!\n", __FUNCTION__, __LINE__); + return -EINVAL; + + } + _rtw_memcpy(pmlmepriv->p2p_probe_resp_ie, p2p_ie, p2p_ielen); + pmlmepriv->p2p_probe_resp_ie_len = p2p_ielen; + } + else + { + if(pmlmepriv->p2p_go_probe_resp_ie) + { + u32 free_len = pmlmepriv->p2p_go_probe_resp_ie_len; + pmlmepriv->p2p_go_probe_resp_ie_len = 0; + rtw_mfree(pmlmepriv->p2p_go_probe_resp_ie, free_len); + pmlmepriv->p2p_go_probe_resp_ie = NULL; + } + + pmlmepriv->p2p_go_probe_resp_ie = rtw_malloc(p2p_ielen); + if ( pmlmepriv->p2p_go_probe_resp_ie == NULL) { + DBG_8192C("%s()-%d: rtw_malloc() ERROR!\n", __FUNCTION__, __LINE__); + return -EINVAL; + + } + _rtw_memcpy(pmlmepriv->p2p_go_probe_resp_ie, p2p_ie, p2p_ielen); + pmlmepriv->p2p_go_probe_resp_ie_len = p2p_ielen; + } + + } + #endif //CONFIG_P2P + + //buf += p2p_ielen; + //len -= p2p_ielen; + + #ifdef CONFIG_WFD + if(rtw_get_wfd_ie(buf, len, NULL, &wfd_ielen)) + { + #ifdef CONFIG_DEBUG_CFG80211 + DBG_8192C("probe_resp_wfd_ielen=%d\n", wfd_ielen); + #endif + + if(pmlmepriv->wfd_probe_resp_ie) + { + u32 free_len = pmlmepriv->wfd_probe_resp_ie_len; + pmlmepriv->wfd_probe_resp_ie_len = 0; + rtw_mfree(pmlmepriv->wfd_probe_resp_ie, free_len); + pmlmepriv->wfd_probe_resp_ie = NULL; + } + + pmlmepriv->wfd_probe_resp_ie = rtw_malloc(wfd_ielen); + if ( pmlmepriv->wfd_probe_resp_ie == NULL) { + DBG_8192C("%s()-%d: rtw_malloc() ERROR!\n", __FUNCTION__, __LINE__); + return -EINVAL; + + } + rtw_get_wfd_ie(buf, len, pmlmepriv->wfd_probe_resp_ie, &pmlmepriv->wfd_probe_resp_ie_len); + } + #endif //CONFIG_WFD + + } + + return ret; + +} + +static int rtw_cfg80211_set_assoc_resp_wpsp2pie(struct net_device *net, char *buf, int len) +{ + int ret = 0; + _adapter *padapter = (_adapter *)rtw_netdev_priv(net); + struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); + + DBG_8192C("%s, ielen=%d\n", __func__, len); + + if(len>0) + { + if(pmlmepriv->wps_assoc_resp_ie) + { + u32 free_len = pmlmepriv->wps_assoc_resp_ie_len; + pmlmepriv->wps_assoc_resp_ie_len = 0; + rtw_mfree(pmlmepriv->wps_assoc_resp_ie, free_len); + pmlmepriv->wps_assoc_resp_ie = NULL; + } + + pmlmepriv->wps_assoc_resp_ie = rtw_malloc(len); + if ( pmlmepriv->wps_assoc_resp_ie == NULL) { + DBG_8192C("%s()-%d: rtw_malloc() ERROR!\n", __FUNCTION__, __LINE__); + return -EINVAL; + + } + _rtw_memcpy(pmlmepriv->wps_assoc_resp_ie, buf, len); + pmlmepriv->wps_assoc_resp_ie_len = len; + } + + return ret; + +} + +int rtw_cfg80211_set_mgnt_wpsp2pie(struct net_device *net, char *buf, int len, + int type) +{ + int ret = 0; + uint wps_ielen = 0; + u32 p2p_ielen = 0; + +#ifdef CONFIG_DEBUG_CFG80211 + DBG_8192C("%s, ielen=%d\n", __func__, len); +#endif + + if( (rtw_get_wps_ie(buf, len, NULL, &wps_ielen) && (wps_ielen>0)) + #ifdef CONFIG_P2P + || (rtw_get_p2p_ie(buf, len, NULL, &p2p_ielen) && (p2p_ielen>0)) + #endif + ) + { + if (net != NULL) + { + switch (type) + { + case 0x1: //BEACON + ret = rtw_cfg80211_set_beacon_wpsp2pie(net, buf, len); + break; + case 0x2: //PROBE_RESP + ret = rtw_cfg80211_set_probe_resp_wpsp2pie(net, buf, len); + break; + case 0x4: //ASSOC_RESP + ret = rtw_cfg80211_set_assoc_resp_wpsp2pie(net, buf, len); + break; + } + } + } + + return ret; + +} + +static struct cfg80211_ops rtw_cfg80211_ops = { + .change_virtual_intf = cfg80211_rtw_change_iface, + .add_key = cfg80211_rtw_add_key, + .get_key = cfg80211_rtw_get_key, + .del_key = cfg80211_rtw_del_key, + .set_default_key = cfg80211_rtw_set_default_key, + .get_station = cfg80211_rtw_get_station, + .scan = cfg80211_rtw_scan, + .set_wiphy_params = cfg80211_rtw_set_wiphy_params, + .connect = cfg80211_rtw_connect, + .disconnect = cfg80211_rtw_disconnect, + .join_ibss = cfg80211_rtw_join_ibss, + .leave_ibss = cfg80211_rtw_leave_ibss, + .set_tx_power = cfg80211_rtw_set_txpower, + .get_tx_power = cfg80211_rtw_get_txpower, + .set_power_mgmt = cfg80211_rtw_set_power_mgmt, + .set_pmksa = cfg80211_rtw_set_pmksa, + .del_pmksa = cfg80211_rtw_del_pmksa, + .flush_pmksa = cfg80211_rtw_flush_pmksa, + +#ifdef CONFIG_AP_MODE + .add_virtual_intf = cfg80211_rtw_add_virtual_intf, + .del_virtual_intf = cfg80211_rtw_del_virtual_intf, + + #if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 4, 0)) && !defined(COMPAT_KERNEL_RELEASE) + .add_beacon = cfg80211_rtw_add_beacon, + .set_beacon = cfg80211_rtw_set_beacon, + .del_beacon = cfg80211_rtw_del_beacon, + #else + .start_ap = cfg80211_rtw_start_ap, + .change_beacon = cfg80211_rtw_change_beacon, + .stop_ap = cfg80211_rtw_stop_ap, + #endif + + .add_station = cfg80211_rtw_add_station, + .del_station = cfg80211_rtw_del_station, + .change_station = cfg80211_rtw_change_station, + .dump_station = cfg80211_rtw_dump_station, + .change_bss = cfg80211_rtw_change_bss, + #if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 6, 0)) + .set_channel = cfg80211_rtw_set_channel, + #endif + //.auth = cfg80211_rtw_auth, + //.assoc = cfg80211_rtw_assoc, +#endif //CONFIG_AP_MODE + +#ifdef CONFIG_P2P + .remain_on_channel = cfg80211_rtw_remain_on_channel, + .cancel_remain_on_channel = cfg80211_rtw_cancel_remain_on_channel, +#endif + +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE) + .mgmt_tx = cfg80211_rtw_mgmt_tx, + .mgmt_frame_register = cfg80211_rtw_mgmt_frame_register, +#elif (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,34) && LINUX_VERSION_CODE<=KERNEL_VERSION(2,6,35)) + .action = cfg80211_rtw_mgmt_tx, +#endif +}; + +static void rtw_cfg80211_init_ht_capab(struct ieee80211_sta_ht_cap *ht_cap, enum ieee80211_band band, u8 rf_type) +{ + +#define MAX_BIT_RATE_40MHZ_MCS15 300 /* Mbps */ +#define MAX_BIT_RATE_40MHZ_MCS7 150 /* Mbps */ + + ht_cap->ht_supported = _TRUE; + + ht_cap->cap = IEEE80211_HT_CAP_SUP_WIDTH_20_40 | + IEEE80211_HT_CAP_SGI_40 | IEEE80211_HT_CAP_SGI_20 | + IEEE80211_HT_CAP_DSSSCCK40 | IEEE80211_HT_CAP_MAX_AMSDU; + + /* + *Maximum length of AMPDU that the STA can receive. + *Length = 2 ^ (13 + max_ampdu_length_exp) - 1 (octets) + */ + ht_cap->ampdu_factor = IEEE80211_HT_MAX_AMPDU_64K; + + /*Minimum MPDU start spacing , */ + ht_cap->ampdu_density = IEEE80211_HT_MPDU_DENSITY_16; + + ht_cap->mcs.tx_params = IEEE80211_HT_MCS_TX_DEFINED; + + /* + *hw->wiphy->bands[IEEE80211_BAND_2GHZ] + *base on ant_num + *rx_mask: RX mask + *if rx_ant =1 rx_mask[0]=0xff;==>MCS0-MCS7 + *if rx_ant =2 rx_mask[1]=0xff;==>MCS8-MCS15 + *if rx_ant >=3 rx_mask[2]=0xff; + *if BW_40 rx_mask[4]=0x01; + *highest supported RX rate + */ + if(rf_type == RF_1T1R) + { + ht_cap->mcs.rx_mask[0] = 0xFF; + ht_cap->mcs.rx_mask[1] = 0x00; + ht_cap->mcs.rx_mask[4] = 0x01; + + ht_cap->mcs.rx_highest = MAX_BIT_RATE_40MHZ_MCS7; + } + else if((rf_type == RF_1T2R) || (rf_type==RF_2T2R)) + { + ht_cap->mcs.rx_mask[0] = 0xFF; + ht_cap->mcs.rx_mask[1] = 0xFF; + ht_cap->mcs.rx_mask[4] = 0x01; + + ht_cap->mcs.rx_highest = MAX_BIT_RATE_40MHZ_MCS15; + } + else + { + DBG_8192C("%s, error rf_type=%d\n", __func__, rf_type); + } + +} + +void rtw_cfg80211_init_wiphy(_adapter *padapter) +{ + u8 rf_type; + struct ieee80211_supported_band *bands; + struct wireless_dev *pwdev = padapter->rtw_wdev; + struct wiphy *wiphy = pwdev->wiphy; + + rtw_hal_get_hwreg(padapter, HW_VAR_RF_TYPE, (u8 *)(&rf_type)); + + DBG_8192C("%s:rf_type=%d\n", __func__, rf_type); + + /* if (padapter->registrypriv.wireless_mode & WIRELESS_11G) */ + { + bands = wiphy->bands[IEEE80211_BAND_2GHZ]; + if(bands) + rtw_cfg80211_init_ht_capab(&bands->ht_cap, IEEE80211_BAND_2GHZ, rf_type); + } + + /* if (padapter->registrypriv.wireless_mode & WIRELESS_11A) */ + { + bands = wiphy->bands[IEEE80211_BAND_5GHZ]; + if(bands) + rtw_cfg80211_init_ht_capab(&bands->ht_cap, IEEE80211_BAND_5GHZ, rf_type); + } +} + +/* +struct ieee80211_iface_limit rtw_limits[] = { + { .max = 1, .types = BIT(NL80211_IFTYPE_STATION) + | BIT(NL80211_IFTYPE_ADHOC) +#ifdef CONFIG_AP_MODE + | BIT(NL80211_IFTYPE_AP) +#endif +#if defined(CONFIG_P2P) && ((LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE)) + | BIT(NL80211_IFTYPE_P2P_CLIENT) + | BIT(NL80211_IFTYPE_P2P_GO) +#endif + }, + {.max = 1, .types = BIT(NL80211_IFTYPE_MONITOR)}, +}; + +struct ieee80211_iface_combination rtw_combinations = { + .limits = rtw_limits, + .n_limits = ARRAY_SIZE(rtw_limits), + .max_interfaces = 2, + .num_different_channels = 1, +}; +*/ + +static void rtw_cfg80211_preinit_wiphy(_adapter *padapter, struct wiphy *wiphy) +{ + + wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM; + + wiphy->max_scan_ssids = RTW_SSID_SCAN_AMOUNT; + wiphy->max_scan_ie_len = RTW_SCAN_IE_LEN_MAX; + wiphy->max_num_pmkids = RTW_MAX_NUM_PMKIDS; + +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) || defined(COMPAT_KERNEL_RELEASE) + wiphy->max_remain_on_channel_duration = RTW_MAX_REMAIN_ON_CHANNEL_DURATION; +#endif + + wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) + | BIT(NL80211_IFTYPE_ADHOC) +#ifdef CONFIG_AP_MODE + | BIT(NL80211_IFTYPE_AP) + | BIT(NL80211_IFTYPE_MONITOR) +#endif +#if defined(CONFIG_P2P) && ((LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE)) + | BIT(NL80211_IFTYPE_P2P_CLIENT) + | BIT(NL80211_IFTYPE_P2P_GO) +#endif + ; + +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE) +#ifdef CONFIG_AP_MODE + wiphy->mgmt_stypes = rtw_cfg80211_default_mgmt_stypes; +#endif //CONFIG_AP_MODE +#endif + +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,0,0)) + wiphy->software_iftypes |= BIT(NL80211_IFTYPE_MONITOR); +#endif + + /* + wiphy->iface_combinations = &rtw_combinations; + wiphy->n_iface_combinations = 1; + */ + + wiphy->cipher_suites = rtw_cipher_suites; + wiphy->n_cipher_suites = ARRAY_SIZE(rtw_cipher_suites); + + /* if (padapter->registrypriv.wireless_mode & WIRELESS_11G) */ + wiphy->bands[IEEE80211_BAND_2GHZ] = rtw_spt_band_alloc(IEEE80211_BAND_2GHZ); + /* if (padapter->registrypriv.wireless_mode & WIRELESS_11A) */ + wiphy->bands[IEEE80211_BAND_5GHZ] = rtw_spt_band_alloc(IEEE80211_BAND_5GHZ); + +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38) && LINUX_VERSION_CODE < KERNEL_VERSION(3,0,0)) + wiphy->flags |= WIPHY_FLAG_SUPPORTS_SEPARATE_DEFAULT_KEYS; +#endif + +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0)) + wiphy->flags |= WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL; + wiphy->flags |= WIPHY_FLAG_OFFCHAN_TX | WIPHY_FLAG_HAVE_AP_SME; +#endif + + if(padapter->registrypriv.power_mgnt != PS_MODE_ACTIVE) + wiphy->flags |= WIPHY_FLAG_PS_ON_BY_DEFAULT; + else + wiphy->flags &= ~WIPHY_FLAG_PS_ON_BY_DEFAULT; +} + +int rtw_wdev_alloc(_adapter *padapter, struct device *dev) +{ + int ret = 0; + struct wiphy *wiphy; + struct wireless_dev *wdev; + struct rtw_wdev_priv *pwdev_priv; + struct net_device *pnetdev = padapter->pnetdev; + + DBG_8192C("%s(padapter=%p)\n", __func__, padapter); + + /* wiphy */ + wiphy = wiphy_new(&rtw_cfg80211_ops, sizeof(struct rtw_wdev_priv)); + if (!wiphy) { + DBG_8192C("Couldn't allocate wiphy device\n"); + ret = -ENOMEM; + goto exit; + } + set_wiphy_dev(wiphy, dev); + rtw_cfg80211_preinit_wiphy(padapter, wiphy); + + ret = wiphy_register(wiphy); + if (ret < 0) { + DBG_8192C("Couldn't register wiphy device\n"); + goto free_wiphy; + } + + /* wdev */ + wdev = (struct wireless_dev *)rtw_zmalloc(sizeof(struct wireless_dev)); + if (!wdev) { + DBG_8192C("Couldn't allocate wireless device\n"); + ret = -ENOMEM; + goto unregister_wiphy; + } + wdev->wiphy = wiphy; + wdev->netdev = pnetdev; + //wdev->iftype = NL80211_IFTYPE_STATION; + wdev->iftype = NL80211_IFTYPE_MONITOR; // for rtw_setopmode_cmd() in cfg80211_rtw_change_iface() + padapter->rtw_wdev = wdev; + pnetdev->ieee80211_ptr = wdev; + + //init pwdev_priv + pwdev_priv = wdev_to_priv(wdev); + pwdev_priv->rtw_wdev = wdev; + pwdev_priv->pmon_ndev = NULL; + pwdev_priv->ifname_mon[0] = '\0'; + pwdev_priv->padapter = padapter; + pwdev_priv->scan_request = NULL; + _rtw_spinlock_init(&pwdev_priv->scan_req_lock); + + pwdev_priv->p2p_enabled = _FALSE; + pwdev_priv->provdisc_req_issued = _FALSE; + rtw_wdev_invit_info_init(&pwdev_priv->invit_info); + rtw_wdev_nego_info_init(&pwdev_priv->nego_info); + + pwdev_priv->bandroid_scan = _FALSE; + + if(padapter->registrypriv.power_mgnt != PS_MODE_ACTIVE) + pwdev_priv->power_mgmt = _TRUE; + else + pwdev_priv->power_mgmt = _FALSE; + +#ifdef CONFIG_CONCURRENT_MODE + ATOMIC_SET(&pwdev_priv->switch_ch_to, 1); + ATOMIC_SET(&pwdev_priv->ro_ch_to, 1); +#endif + + return ret; + + rtw_mfree((u8*)wdev, sizeof(struct wireless_dev)); +unregister_wiphy: + wiphy_unregister(wiphy); + free_wiphy: + wiphy_free(wiphy); +exit: + return ret; + +} + +void rtw_wdev_free(struct wireless_dev *wdev) +{ + struct rtw_wdev_priv *pwdev_priv; + + DBG_8192C("%s(wdev=%p)\n", __func__, wdev); + + if (!wdev) + return; + + pwdev_priv = wdev_to_priv(wdev); + + rtw_spt_band_free(wdev->wiphy->bands[IEEE80211_BAND_2GHZ]); + rtw_spt_band_free(wdev->wiphy->bands[IEEE80211_BAND_5GHZ]); + + wiphy_free(wdev->wiphy); + + rtw_mfree((u8*)wdev, sizeof(struct wireless_dev)); +} + +void rtw_wdev_unregister(struct wireless_dev *wdev) +{ + struct rtw_wdev_priv *pwdev_priv; + + DBG_8192C("%s(wdev=%p)\n", __func__, wdev); + + if (!wdev) + return; + + pwdev_priv = wdev_to_priv(wdev); + + rtw_cfg80211_indicate_scan_done(pwdev_priv, _TRUE); + + if (pwdev_priv->pmon_ndev) { + DBG_8192C("%s, unregister monitor interface\n", __func__); + unregister_netdev(pwdev_priv->pmon_ndev); + } + + wiphy_unregister(wdev->wiphy); +} + +#endif //CONFIG_IOCTL_CFG80211 diff --git a/os_dep/ioctl_linux.c b/os_dep/ioctl_linux.c index 365416d..b7d2b14 100755 --- a/os_dep/ioctl_linux.c +++ b/os_dep/ioctl_linux.c @@ -76,9 +76,9 @@ extern u8 convert_ip_addr(u8 hch, u8 mch, u8 lch); static u32 rtw_rates[] = {1000000,2000000,5500000,11000000, 6000000,9000000,12000000,18000000,24000000,36000000,48000000,54000000}; -static const char * const iw_operation_mode[] = -{ - "Auto", "Ad-Hoc", "Managed", "Master", "Repeater", "Secondary", "Monitor" +static const char * const iw_operation_mode[] = +{ + "Auto", "Ad-Hoc", "Managed", "Master", "Repeater", "Secondary", "Monitor" }; static int hex2num_i(char c) @@ -146,11 +146,11 @@ static void indicate_wx_custom_event(struct adapter *padapter, char *msg) return; _rtw_memcpy(buff, msg, strlen(msg)); - + _rtw_memset(&wrqu,0,sizeof(wrqu)); wrqu.data.length = strlen(msg); - DBG_871X("%s %s\n", __FUNCTION__, buff); + DBG_871X("%s %s\n", __FUNCTION__, buff); #ifndef CONFIG_IOCTL_CFG80211 wireless_send_event(padapter->pnetdev, IWEVCUSTOM, &wrqu, buff); #endif @@ -169,21 +169,21 @@ static void request_wps_pbc_event(struct adapter *padapter) buff = rtw_malloc(IW_CUSTOM_MAX); if(!buff) return; - + _rtw_memset(buff, 0, IW_CUSTOM_MAX); - + p=buff; - + p+=sprintf(p, "WPS_PBC_START.request=TRUE"); - + _rtw_memset(&wrqu,0,sizeof(wrqu)); - + wrqu.data.length = p-buff; - + wrqu.data.length = (wrqu.data.lengthpnetdev, IWEVCUSTOM, &wrqu, buff); #endif @@ -197,9 +197,9 @@ static void request_wps_pbc_event(struct adapter *padapter) void indicate_wx_scan_complete_event(struct adapter *padapter) -{ +{ union iwreq_data wrqu; - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; + struct mlme_priv *pmlmepriv = &padapter->mlmepriv; _rtw_memset(&wrqu, 0, sizeof(union iwreq_data)); @@ -211,7 +211,7 @@ void indicate_wx_scan_complete_event(struct adapter *padapter) void rtw_indicate_wx_assoc_event(struct adapter *padapter) -{ +{ union iwreq_data wrqu; struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; @@ -219,9 +219,9 @@ void rtw_indicate_wx_assoc_event(struct adapter *padapter) WLAN_BSSID_EX *pnetwork = (WLAN_BSSID_EX*)(&(pmlmeinfo->network)); _rtw_memset(&wrqu, 0, sizeof(union iwreq_data)); - - wrqu.ap_addr.sa_family = ARPHRD_ETHER; - + + wrqu.ap_addr.sa_family = ARPHRD_ETHER; + if(check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE)==_TRUE ) _rtw_memcpy(wrqu.ap_addr.sa_data, pnetwork->MacAddress, ETH_ALEN); else @@ -234,14 +234,14 @@ void rtw_indicate_wx_assoc_event(struct adapter *padapter) } void rtw_indicate_wx_disassoc_event(struct adapter *padapter) -{ +{ union iwreq_data wrqu; _rtw_memset(&wrqu, 0, sizeof(union iwreq_data)); wrqu.ap_addr.sa_family = ARPHRD_ETHER; _rtw_memset(wrqu.ap_addr.sa_data, 0, ETH_ALEN); - + #ifndef CONFIG_IOCTL_CFG80211 DBG_871X_LEVEL(_drv_always_, "indicate disassoc\n"); wireless_send_event(padapter->pnetdev, SIOCGIWAP, &wrqu, NULL); @@ -250,17 +250,17 @@ void rtw_indicate_wx_disassoc_event(struct adapter *padapter) /* uint rtw_is_cckrates_included(u8 *rate) -{ - u32 i = 0; +{ + u32 i = 0; while(rate[i]!=0) - { - if ( (((rate[i]) & 0x7f) == 2) || (((rate[i]) & 0x7f) == 4) || - (((rate[i]) & 0x7f) == 11) || (((rate[i]) & 0x7f) == 22) ) - return _TRUE; + { + if ( (((rate[i]) & 0x7f) == 2) || (((rate[i]) & 0x7f) == 4) || + (((rate[i]) & 0x7f) == 11) || (((rate[i]) & 0x7f) == 22) ) + return _TRUE; i++; } - + return _FALSE; } @@ -272,15 +272,15 @@ uint rtw_is_cckratesonly_included(u8 *rate) { if ( (((rate[i]) & 0x7f) != 2) && (((rate[i]) & 0x7f) != 4) && (((rate[i]) & 0x7f) != 11) && (((rate[i]) & 0x7f) != 22) ) - return _FALSE; + return _FALSE; i++; } - + return _TRUE; } */ -static char *translate_scan(struct adapter *padapter, +static char *translate_scan(struct adapter *padapter, struct iw_request_info* info, struct wlan_network *pnetwork, char *start, char *stop) { @@ -291,7 +291,7 @@ static char *translate_scan(struct adapter *padapter, char custom[MAX_CUSTOM_LEN]; char *p; u16 max_rate=0, rate, ht_cap=_FALSE; - u32 i = 0; + u32 i = 0; char *current_val; long rssi; u8 bw_40MHz=0, short_GI=0; @@ -307,14 +307,14 @@ static char *translate_scan(struct adapter *padapter, { } - else if ( ( SCAN_RESULT_P2P_ONLY == pwdinfo->wfd_info->scan_result_type ) || + else if ( ( SCAN_RESULT_P2P_ONLY == pwdinfo->wfd_info->scan_result_type ) || ( SCAN_RESULT_WFD_TYPE == pwdinfo->wfd_info->scan_result_type ) ) #endif // CONFIG_WFD { if(!rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) { u32 blnGotP2PIE = _FALSE; - + // User is doing the P2P device discovery // The prefix of SSID should be "DIRECT-" and the IE should contains the P2P IE. // If not, the driver should ignore this AP and go to the next AP. @@ -343,7 +343,7 @@ static char *translate_scan(struct adapter *padapter, { return start; } - + } } @@ -353,12 +353,12 @@ static char *translate_scan(struct adapter *padapter, u32 blnGotWFD = _FALSE; u8 wfd_ie[ 128 ] = { 0x00 }; uint wfd_ielen = 0; - + if ( rtw_get_wfd_ie_from_scan_queue( &pnetwork->network.IEs[0], pnetwork->network.IELength, wfd_ie, &wfd_ielen, pnetwork->network.Reserved[0]) ) { u8 wfd_devinfo[ 6 ] = { 0x00 }; uint wfd_devlen = 6; - + if ( rtw_get_wfd_attr_content( wfd_ie, wfd_ielen, WFD_ATTR_DEVICE_INFO, wfd_devinfo, &wfd_devlen) ) { if ( pwdinfo->wfd_info->wfd_device_type == WFD_DEVINFO_PSINK ) @@ -382,7 +382,7 @@ static char *translate_scan(struct adapter *padapter, } } } - + if ( blnGotWFD == _FALSE ) { return start; @@ -401,7 +401,7 @@ static char *translate_scan(struct adapter *padapter, /* Add the ESSID */ iwe.cmd = SIOCGIWESSID; - iwe.u.data.flags = 1; + iwe.u.data.flags = 1; iwe.u.data.length = min((u16)pnetwork->network.Ssid.SsidLength, (u16)32); start = iwe_stream_add_point(info, start, stop, &iwe, pnetwork->network.Ssid.Ssid); @@ -411,8 +411,8 @@ static char *translate_scan(struct adapter *padapter, if(p && ht_ielen>0) { struct rtw_ieee80211_ht_cap *pht_capie; - ht_cap = _TRUE; - pht_capie = (struct rtw_ieee80211_ht_cap *)(p+2); + ht_cap = _TRUE; + pht_capie = (struct rtw_ieee80211_ht_cap *)(p+2); _rtw_memcpy(&mcs_rate , pht_capie->supp_mcs_set, 2); bw_40MHz = (pht_capie->cap_info&IEEE80211_HT_CAP_SUP_WIDTH) ? 1:0; short_GI = (pht_capie->cap_info&(IEEE80211_HT_CAP_SGI_20|IEEE80211_HT_CAP_SGI_40)) ? 1:0; @@ -420,20 +420,20 @@ static char *translate_scan(struct adapter *padapter, /* Add the protocol name */ iwe.cmd = SIOCGIWNAME; - if ((rtw_is_cckratesonly_included((u8*)&pnetwork->network.SupportedRates)) == _TRUE) + if ((rtw_is_cckratesonly_included((u8*)&pnetwork->network.SupportedRates)) == _TRUE) { if(ht_cap == _TRUE) snprintf(iwe.u.name, IFNAMSIZ, "IEEE 802.11bn"); else snprintf(iwe.u.name, IFNAMSIZ, "IEEE 802.11b"); - } - else if ((rtw_is_cckrates_included((u8*)&pnetwork->network.SupportedRates)) == _TRUE) + } + else if ((rtw_is_cckrates_included((u8*)&pnetwork->network.SupportedRates)) == _TRUE) { if(ht_cap == _TRUE) snprintf(iwe.u.name, IFNAMSIZ, "IEEE 802.11bgn"); else snprintf(iwe.u.name, IFNAMSIZ, "IEEE 802.11bg"); - } + } else { if(pnetwork->network.Configuration.DSConfig > 14) @@ -450,7 +450,7 @@ static char *translate_scan(struct adapter *padapter, else snprintf(iwe.u.name, IFNAMSIZ, "IEEE 802.11g"); } - } + } start = iwe_stream_add_event(info, start, stop, &iwe, IW_EV_CHAR_LEN); @@ -495,20 +495,20 @@ static char *translate_scan(struct adapter *padapter, p += snprintf(p, MAX_CUSTOM_LEN - (p - custom), " Rates (Mb/s): "); while(pnetwork->network.SupportedRates[i]!=0) { - rate = pnetwork->network.SupportedRates[i]&0x7F; + rate = pnetwork->network.SupportedRates[i]&0x7F; if (rate > max_rate) max_rate = rate; p += snprintf(p, MAX_CUSTOM_LEN - (p - custom), "%d%s ", rate >> 1, (rate & 1) ? ".5" : ""); i++; } - + if(ht_cap == _TRUE) { if(mcs_rate&0x8000)//MCS15 { max_rate = (bw_40MHz) ? ((short_GI)?300:270):((short_GI)?144:130); - + } else if(mcs_rate&0x0080)//MCS7 { @@ -520,7 +520,7 @@ static char *translate_scan(struct adapter *padapter, max_rate = (bw_40MHz) ? ((short_GI)?150:135):((short_GI)?72:65); } - max_rate = max_rate*2;//Mbps/2; + max_rate = max_rate*2;//Mbps/2; } iwe.cmd = SIOCGIWRATE; @@ -547,16 +547,16 @@ static char *translate_scan(struct adapter *padapter, for (i = 0; i < wpa_len; i++) { p += sprintf(p, "%02x", wpa_ie[i]); } - + _rtw_memset(&iwe, 0, sizeof(iwe)); iwe.cmd = IWEVCUSTOM; iwe.u.data.length = strlen(buf); start = iwe_stream_add_point(info, start, stop, &iwe,buf); - + _rtw_memset(&iwe, 0, sizeof(iwe)); iwe.cmd =IWEVGENIE; iwe.u.data.length = wpa_len; - start = iwe_stream_add_point(info, start, stop, &iwe, wpa_ie); + start = iwe_stream_add_point(info, start, stop, &iwe, wpa_ie); } if (rsn_len > 0) { @@ -570,18 +570,18 @@ static char *translate_scan(struct adapter *padapter, iwe.cmd = IWEVCUSTOM; iwe.u.data.length = strlen(buf); start = iwe_stream_add_point(info, start, stop, &iwe,buf); - + _rtw_memset(&iwe, 0, sizeof(iwe)); iwe.cmd =IWEVGENIE; iwe.u.data.length = rsn_len; - start = iwe_stream_add_point(info, start, stop, &iwe, rsn_ie); + start = iwe_stream_add_point(info, start, stop, &iwe, rsn_ie); } } { //parsing WPS IE - uint cnt = 0,total_ielen; + uint cnt = 0,total_ielen; u8 *wpsie_ptr=NULL; - uint wps_ielen = 0; + uint wps_ielen = 0; u8 *ie_ptr = pnetwork->network.IEs +_FIXED_IE_LENGTH_; total_ielen= pnetwork->network.IELength - _FIXED_IE_LENGTH_; @@ -599,13 +599,13 @@ static char *translate_scan(struct adapter *padapter, while(cnt < total_ielen) { - if(rtw_is_wps_ie(&ie_ptr[cnt], &wps_ielen) && (wps_ielen>2)) + if(rtw_is_wps_ie(&ie_ptr[cnt], &wps_ielen) && (wps_ielen>2)) { wpsie_ptr = &ie_ptr[cnt]; iwe.cmd =IWEVGENIE; iwe.u.data.length = (u16)wps_ielen; - start = iwe_stream_add_point(info, start, stop, &iwe, wpsie_ptr); - } + start = iwe_stream_add_point(info, start, stop, &iwe, wpsie_ptr); + } cnt+=ie_ptr[cnt+1]+2; //goto next } } @@ -655,7 +655,7 @@ static char *translate_scan(struct adapter *padapter, { struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); u8 ss, sq; - + /* Add quality statistics */ iwe.cmd = IWEVQUAL; iwe.u.qual.updated = IW_QUAL_QUAL_UPDATED | IW_QUAL_LEVEL_UPDATED | IW_QUAL_NOISE_INVALID @@ -672,8 +672,8 @@ static char *translate_scan(struct adapter *padapter, ss = pnetwork->network.PhyInfo.SignalStrength; sq = pnetwork->network.PhyInfo.SignalQuality; } - - + + #ifdef CONFIG_SIGNAL_DISPLAY_DBM iwe.u.qual.level = (u8) translate_percentage_to_dbm(ss);//dbm #else @@ -682,15 +682,15 @@ static char *translate_scan(struct adapter *padapter, BT_SignalCompensation(padapter, &iwe.u.qual.level, NULL); #endif // CONFIG_BT_COEXIST #endif - + iwe.u.qual.qual = (u8)sq; // signal quality #ifdef CONFIG_PLATFORM_ROCKCHIPS iwe.u.qual.noise = -100; // noise level suggest by zhf@rockchips - #else + #else iwe.u.qual.noise = 0; // noise level #endif //CONFIG_PLATFORM_ROCKCHIPS - + //DBG_871X("iqual=%d, ilevel=%d, inoise=%d, iupdated=%d\n", iwe.u.qual.qual, iwe.u.qual.level , iwe.u.qual.noise, iwe.u.qual.updated); start = iwe_stream_add_event(info, start, stop, &iwe, IW_EV_QUAL_LEN); @@ -709,12 +709,12 @@ static char *translate_scan(struct adapter *padapter, iwe.u.data.length = strlen(buf); start = iwe_stream_add_point(info, start, stop, &iwe, buf); } - - return start; + + return start; } static int wpa_set_auth_algs(struct net_device *dev, u32 value) -{ +{ struct adapter *padapter = (struct adapter *) rtw_netdev_priv(dev); int ret = 0; @@ -724,7 +724,7 @@ static int wpa_set_auth_algs(struct net_device *dev, u32 value) padapter->securitypriv.ndisencryptstatus = Ndis802_11Encryption1Enabled; padapter->securitypriv.ndisauthtype = Ndis802_11AuthModeAutoSwitch; padapter->securitypriv.dot11AuthAlgrthm = dot11AuthAlgrthm_Auto; - } + } else if (value & AUTH_ALG_SHARED_KEY) { DBG_871X("wpa_set_auth_algs, AUTH_ALG_SHARED_KEY [value:0x%x]\n",value); @@ -737,7 +737,7 @@ static int wpa_set_auth_algs(struct net_device *dev, u32 value) padapter->securitypriv.ndisauthtype = Ndis802_11AuthModeShared; padapter->securitypriv.dot11AuthAlgrthm = dot11AuthAlgrthm_Shared; #endif - } + } else if(value & AUTH_ALG_OPEN_SYSTEM) { DBG_871X("wpa_set_auth_algs, AUTH_ALG_OPEN_SYSTEM\n"); @@ -749,10 +749,10 @@ static int wpa_set_auth_algs(struct net_device *dev, u32 value) padapter->securitypriv.dot11AuthAlgrthm = dot11AuthAlgrthm_Auto; #else padapter->securitypriv.ndisauthtype = Ndis802_11AuthModeOpen; - padapter->securitypriv.dot11AuthAlgrthm = dot11AuthAlgrthm_Open; + padapter->securitypriv.dot11AuthAlgrthm = dot11AuthAlgrthm_Open; #endif } - + } else if(value & AUTH_ALG_LEAP) { @@ -765,16 +765,16 @@ static int wpa_set_auth_algs(struct net_device *dev, u32 value) } return ret; - + } static int wpa_set_encryption(struct net_device *dev, struct ieee_param *param, u32 param_len) { int ret = 0; u32 wep_key_idx, wep_key_len,wep_total_len; - NDIS_802_11_WEP *pwep = NULL; + NDIS_802_11_WEP *pwep = NULL; struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; + struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct security_priv *psecuritypriv = &padapter->securitypriv; #ifdef CONFIG_P2P struct wifidirect_info* pwdinfo = &padapter->wdinfo; @@ -793,7 +793,7 @@ _func_enter_; if (param->sta_addr[0] == 0xff && param->sta_addr[1] == 0xff && param->sta_addr[2] == 0xff && param->sta_addr[3] == 0xff && - param->sta_addr[4] == 0xff && param->sta_addr[5] == 0xff) + param->sta_addr[4] == 0xff && param->sta_addr[5] == 0xff) { if (param->u.crypt.idx >= WEP_KEYS @@ -805,8 +805,8 @@ _func_enter_; ret = -EINVAL; goto exit; } - } - else + } + else { #ifdef CONFIG_WAPI_SUPPORT if (strcmp(param->u.crypt.alg, "SMS4")) @@ -837,19 +837,19 @@ _func_enter_; RT_TRACE(_module_rtl871x_ioctl_os_c,_drv_info_,("(2)wep_key_idx=%d\n", wep_key_idx)); - if (wep_key_len > 0) + if (wep_key_len > 0) { - wep_key_len = wep_key_len <= 5 ? 5 : 13; + wep_key_len = wep_key_len <= 5 ? 5 : 13; wep_total_len = wep_key_len + FIELD_OFFSET(NDIS_802_11_WEP, KeyMaterial); - pwep =(NDIS_802_11_WEP *) rtw_malloc(wep_total_len); + pwep =(NDIS_802_11_WEP *) rtw_malloc(wep_total_len); if(pwep == NULL){ RT_TRACE(_module_rtl871x_ioctl_os_c,_drv_err_,(" wpa_set_encryption: pwep allocate fail !!!\n")); goto exit; } - _rtw_memset(pwep, 0, wep_total_len); + _rtw_memset(pwep, 0, wep_total_len); - pwep->KeyLength = wep_key_len; + pwep->KeyLength = wep_key_len; pwep->Length = wep_total_len; if(wep_key_len==13) @@ -858,7 +858,7 @@ _func_enter_; padapter->securitypriv.dot118021XGrpPrivacy=_WEP104_; } } - else { + else { ret = -EINVAL; goto exit; } @@ -880,21 +880,21 @@ _func_enter_; else { DBG_871X("wep, set_tx=0\n"); - - //don't update "psecuritypriv->dot11PrivacyAlgrthm" and + + //don't update "psecuritypriv->dot11PrivacyAlgrthm" and //"psecuritypriv->dot11PrivacyKeyIndex=keyid", but can rtw_set_key to fw/cam - + if (wep_key_idx >= WEP_KEYS) { ret = -EOPNOTSUPP ; goto exit; - } - + } + _rtw_memcpy(&(psecuritypriv->dot11DefKey[wep_key_idx].skey[0]), pwep->KeyMaterial, pwep->KeyLength); - psecuritypriv->dot11DefKeylen[wep_key_idx]=pwep->KeyLength; + psecuritypriv->dot11DefKeylen[wep_key_idx]=pwep->KeyLength; rtw_set_key(padapter, psecuritypriv, wep_key_idx, 0,_TRUE); } - goto exit; + goto exit; } if(padapter->securitypriv.dot11AuthAlgrthm == dot11AuthAlgrthm_8021X) // 802_1x @@ -904,43 +904,43 @@ _func_enter_; if (check_fwstate(pmlmepriv, WIFI_STATION_STATE | WIFI_MP_STATE) == _TRUE) //sta mode { - psta = rtw_get_stainfo(pstapriv, get_bssid(pmlmepriv)); + psta = rtw_get_stainfo(pstapriv, get_bssid(pmlmepriv)); if (psta == NULL) { //DEBUG_ERR( ("Set wpa_set_encryption: Obtain Sta_info fail \n")); } else { //Jeff: don't disable ieee8021x_blocked while clearing key - if (strcmp(param->u.crypt.alg, "none") != 0) + if (strcmp(param->u.crypt.alg, "none") != 0) psta->ieee8021x_blocked = _FALSE; - + if((padapter->securitypriv.ndisencryptstatus == Ndis802_11Encryption2Enabled)|| (padapter->securitypriv.ndisencryptstatus == Ndis802_11Encryption3Enabled)) { psta->dot118021XPrivacy = padapter->securitypriv.dot11PrivacyAlgrthm; - } + } if(param->u.crypt.set_tx ==1)//pairwise key - { + { _rtw_memcpy(psta->dot118021x_UncstKey.skey, param->u.crypt.key, (param->u.crypt.key_len>16 ?16:param->u.crypt.key_len)); - + if(strcmp(param->u.crypt.alg, "TKIP") == 0)//set mic key - { + { //DEBUG_ERR(("\nset key length :param->u.crypt.key_len=%d\n", param->u.crypt.key_len)); _rtw_memcpy(psta->dot11tkiptxmickey.skey, &(param->u.crypt.key[16]), 8); _rtw_memcpy(psta->dot11tkiprxmickey.skey, &(param->u.crypt.key[24]), 8); padapter->securitypriv.busetkipkey=_FALSE; - //_set_timer(&padapter->securitypriv.tkip_timer, 50); + //_set_timer(&padapter->securitypriv.tkip_timer, 50); } //DEBUG_ERR((" param->u.crypt.key_len=%d\n",param->u.crypt.key_len)); DBG_871X(" ~~~~set sta key:unicastkey\n"); - + rtw_setstakey_cmd(padapter, (unsigned char *)psta, _TRUE, _TRUE); } else//group key - { + { if(strcmp(param->u.crypt.alg, "TKIP") == 0 || strcmp(param->u.crypt.alg, "CCMP") == 0) { printk("[%s] GTK key_len=%d @@@@@@@@@@@@@@@@@@\n", param->u.crypt.alg, param->u.crypt.key_len); @@ -951,12 +951,12 @@ _func_enter_; _rtw_memcpy(padapter->securitypriv.dot118021XGrptxmickey[param->u.crypt.idx].skey,&(param->u.crypt.key[16]),8); _rtw_memcpy(padapter->securitypriv.dot118021XGrprxmickey[param->u.crypt.idx].skey,&(param->u.crypt.key[24]),8); } - padapter->securitypriv.binstallGrpkey = _TRUE; + padapter->securitypriv.binstallGrpkey = _TRUE; //DEBUG_ERR((" param->u.crypt.key_len=%d\n", param->u.crypt.key_len)); DBG_871X(" ~~~~set sta key:groupkey\n"); - + padapter->securitypriv.dot118021XGrpKeyid = param->u.crypt.idx; - + rtw_set_key(padapter,&padapter->securitypriv,param->u.crypt.idx, 1,_TRUE); } #ifdef CONFIG_IEEE80211W @@ -975,15 +975,15 @@ _func_enter_; DBG_871X(" ~~~~set sta key:IGKT\n"); } #endif //CONFIG_IEEE80211W - + #ifdef CONFIG_P2P if(rtw_p2p_chk_state(pwdinfo, P2P_STATE_PROVISIONING_ING)) { rtw_p2p_set_state(pwdinfo, P2P_STATE_PROVISIONING_DONE); } #endif //CONFIG_P2P - - } + + } } pbcmc_sta=rtw_get_bcmc_stainfo(padapter); @@ -994,19 +994,19 @@ _func_enter_; else { //Jeff: don't disable ieee8021x_blocked while clearing key - if (strcmp(param->u.crypt.alg, "none") != 0) + if (strcmp(param->u.crypt.alg, "none") != 0) pbcmc_sta->ieee8021x_blocked = _FALSE; - + if((padapter->securitypriv.ndisencryptstatus == Ndis802_11Encryption2Enabled)|| (padapter->securitypriv.ndisencryptstatus == Ndis802_11Encryption3Enabled)) - { + { pbcmc_sta->dot118021XPrivacy = padapter->securitypriv.dot11PrivacyAlgrthm; } } } else if(check_fwstate(pmlmepriv, WIFI_ADHOC_STATE)) //adhoc mode - { - } + { + } } #ifdef CONFIG_WAPI_SUPPORT @@ -1016,7 +1016,7 @@ _func_enter_; PRT_WAPI_STA_INFO pWapiSta; u8 WapiASUEPNInitialValueSrc[16] = {0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C} ; u8 WapiAEPNInitialValueSrc[16] = {0x37,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C} ; - u8 WapiAEMultiCastPNInitialValueSrc[16] = {0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C} ; + u8 WapiAEMultiCastPNInitialValueSrc[16] = {0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C} ; if(param->u.crypt.set_tx == 1) { @@ -1076,20 +1076,20 @@ _func_enter_; #endif exit: - + if (pwep) { - rtw_mfree((u8 *)pwep, wep_total_len); - } - + rtw_mfree((u8 *)pwep, wep_total_len); + } + _func_exit_; - return ret; + return ret; } static int rtw_set_wpa_ie(struct adapter *padapter, char *pie, unsigned short ielen) { - u8 *buf=NULL, *pos=NULL; - u32 left; + u8 *buf=NULL, *pos=NULL; + u32 left; int group_cipher = 0, pairwise_cipher = 0; int ret = 0; u8 null_addr[]= {0,0,0,0,0,0}; @@ -1099,20 +1099,20 @@ static int rtw_set_wpa_ie(struct adapter *padapter, char *pie, unsigned short ie if((ielen > MAX_WPA_IE_LEN) || (pie == NULL)){ _clr_fwstate_(&padapter->mlmepriv, WIFI_UNDER_WPS); - if(pie == NULL) + if(pie == NULL) return ret; else return -EINVAL; } if(ielen) - { + { buf = rtw_zmalloc(ielen); if (buf == NULL){ ret = -ENOMEM; goto exit; } - + _rtw_memcpy(buf, pie , ielen); //dump @@ -1122,7 +1122,7 @@ static int rtw_set_wpa_ie(struct adapter *padapter, char *pie, unsigned short ie for(i=0;i= RSN_SELECTOR_LEN){ pos += RSN_SELECTOR_LEN; left -= RSN_SELECTOR_LEN; - } + } else if (left > 0){ RT_TRACE(_module_rtl871x_ioctl_os_c,_drv_err_,("Ie length mismatch, %u too much \n", left)); ret =-1; goto exit; } -#endif - +#endif + if(rtw_parse_wpa_ie(buf, ielen, &group_cipher, &pairwise_cipher, NULL) == _SUCCESS) { padapter->securitypriv.dot11AuthAlgrthm= dot11AuthAlgrthm_8021X; padapter->securitypriv.ndisauthtype=Ndis802_11AuthModeWPAPSK; - _rtw_memcpy(padapter->securitypriv.supplicant_ie, &buf[0], ielen); + _rtw_memcpy(padapter->securitypriv.supplicant_ie, &buf[0], ielen); } - + if(rtw_parse_wpa2_ie(buf, ielen, &group_cipher, &pairwise_cipher, NULL) == _SUCCESS) { padapter->securitypriv.dot11AuthAlgrthm= dot11AuthAlgrthm_8021X; - padapter->securitypriv.ndisauthtype=Ndis802_11AuthModeWPA2PSK; - _rtw_memcpy(padapter->securitypriv.supplicant_ie, &buf[0], ielen); + padapter->securitypriv.ndisauthtype=Ndis802_11AuthModeWPA2PSK; + _rtw_memcpy(padapter->securitypriv.supplicant_ie, &buf[0], ielen); } - + if (group_cipher == 0) { group_cipher = WPA_CIPHER_NONE; @@ -1167,7 +1167,7 @@ static int rtw_set_wpa_ie(struct adapter *padapter, char *pie, unsigned short ie { pairwise_cipher = WPA_CIPHER_NONE; } - + switch(group_cipher) { case WPA_CIPHER_NONE: @@ -1186,7 +1186,7 @@ static int rtw_set_wpa_ie(struct adapter *padapter, char *pie, unsigned short ie padapter->securitypriv.dot118021XGrpPrivacy=_AES_; padapter->securitypriv.ndisencryptstatus = Ndis802_11Encryption3Enabled; break; - case WPA_CIPHER_WEP104: + case WPA_CIPHER_WEP104: padapter->securitypriv.dot118021XGrpPrivacy=_WEP104_; padapter->securitypriv.ndisencryptstatus = Ndis802_11Encryption1Enabled; break; @@ -1210,31 +1210,31 @@ static int rtw_set_wpa_ie(struct adapter *padapter, char *pie, unsigned short ie padapter->securitypriv.dot11PrivacyAlgrthm=_AES_; padapter->securitypriv.ndisencryptstatus = Ndis802_11Encryption3Enabled; break; - case WPA_CIPHER_WEP104: + case WPA_CIPHER_WEP104: padapter->securitypriv.dot11PrivacyAlgrthm=_WEP104_; padapter->securitypriv.ndisencryptstatus = Ndis802_11Encryption1Enabled; break; } - + _clr_fwstate_(&padapter->mlmepriv, WIFI_UNDER_WPS); - {//set wps_ie - u16 cnt = 0; + {//set wps_ie + u16 cnt = 0; u8 eid, wps_oui[4]={0x0,0x50,0xf2,0x04}; - + while( cnt < ielen ) { eid = buf[cnt]; - + if((eid==_VENDOR_SPECIFIC_IE_)&&(_rtw_memcmp(&buf[cnt+2], wps_oui, 4)==_TRUE)) { DBG_871X("SET WPS_IE\n"); padapter->securitypriv.wps_ie_len = ( (buf[cnt+1]+2) < (MAX_WPA_IE_LEN<<2)) ? (buf[cnt+1]+2):(MAX_WPA_IE_LEN<<2); - + _rtw_memcpy(padapter->securitypriv.wps_ie, &buf[cnt], padapter->securitypriv.wps_ie_len); - + set_fwstate(&padapter->mlmepriv, WIFI_UNDER_WPS); - + #ifdef CONFIG_P2P if(rtw_p2p_chk_state(pwdinfo, P2P_STATE_GONEGO_OK)) { @@ -1242,15 +1242,15 @@ static int rtw_set_wpa_ie(struct adapter *padapter, char *pie, unsigned short ie } #endif //CONFIG_P2P cnt += buf[cnt+1]+2; - + break; } else { - cnt += buf[cnt+1]+2; //goto next - } - } - } + cnt += buf[cnt+1]+2; //goto next + } + } + } } - + //TKIP and AES disallow multicast packets until installing group key if(padapter->securitypriv.dot11PrivacyAlgrthm == _TKIP_ || padapter->securitypriv.dot11PrivacyAlgrthm == _TKIP_WTMIC_ @@ -1258,11 +1258,11 @@ static int rtw_set_wpa_ie(struct adapter *padapter, char *pie, unsigned short ie //WPS open need to enable multicast //|| check_fwstate(&padapter->mlmepriv, WIFI_UNDER_WPS) == _TRUE) rtw_hal_set_hwreg(padapter, HW_VAR_OFF_RCR_AM, null_addr); - + RT_TRACE(_module_rtl871x_ioctl_os_c, _drv_info_, ("rtw_set_wpa_ie: pairwise_cipher=0x%08x padapter->securitypriv.ndisencryptstatus=%d padapter->securitypriv.ndisauthtype=%d\n", pairwise_cipher, padapter->securitypriv.ndisencryptstatus, padapter->securitypriv.ndisauthtype)); - + exit: if (buf) rtw_mfree(buf, ielen); @@ -1270,8 +1270,8 @@ exit: return ret; } -static int rtw_wx_get_name(struct net_device *dev, - struct iw_request_info *info, +static int rtw_wx_get_name(struct net_device *dev, + struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); @@ -1285,7 +1285,7 @@ static int rtw_wx_get_name(struct net_device *dev, RT_TRACE(_module_rtl871x_mlme_c_,_drv_info_,("cmd_code=%x\n", info->cmd)); - _func_enter_; + _func_enter_; if (check_fwstate(pmlmepriv, _FW_LINKED|WIFI_ADHOC_MASTER_STATE) == _TRUE) { @@ -1342,27 +1342,27 @@ static int rtw_wx_get_name(struct net_device *dev, return 0; } -static int rtw_wx_set_freq(struct net_device *dev, - struct iw_request_info *info, +static int rtw_wx_set_freq(struct net_device *dev, + struct iw_request_info *info, union iwreq_data *wrqu, char *extra) -{ +{ _func_enter_; RT_TRACE(_module_rtl871x_mlme_c_, _drv_notice_, ("+rtw_wx_set_freq\n")); _func_exit_; - + return 0; } -static int rtw_wx_get_freq(struct net_device *dev, - struct iw_request_info *info, +static int rtw_wx_get_freq(struct net_device *dev, + struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); WLAN_BSSID_EX *pcur_bss = &pmlmepriv->cur_network.network; - + if(check_fwstate(pmlmepriv, _FW_LINKED) == _TRUE) { //wrqu->freq.m = ieee80211_wlan_frequencies[pcur_bss->Configuration.DSConfig-1] * 100000; @@ -1386,9 +1386,9 @@ static int rtw_wx_set_mode(struct net_device *dev, struct iw_request_info *a, struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); NDIS_802_11_NETWORK_INFRASTRUCTURE networkType ; int ret = 0; - + _func_enter_; - + if(_FAIL == rtw_pwr_wakeup(padapter)) { ret= -EPERM; goto exit; @@ -1398,44 +1398,44 @@ static int rtw_wx_set_mode(struct net_device *dev, struct iw_request_info *a, ret = -EPERM; goto exit; } - + switch(wrqu->mode) { case IW_MODE_AUTO: networkType = Ndis802_11AutoUnknown; - DBG_871X("set_mode = IW_MODE_AUTO\n"); - break; - case IW_MODE_ADHOC: - networkType = Ndis802_11IBSS; - DBG_871X("set_mode = IW_MODE_ADHOC\n"); + DBG_871X("set_mode = IW_MODE_AUTO\n"); break; - case IW_MODE_MASTER: + case IW_MODE_ADHOC: + networkType = Ndis802_11IBSS; + DBG_871X("set_mode = IW_MODE_ADHOC\n"); + break; + case IW_MODE_MASTER: networkType = Ndis802_11APMode; DBG_871X("set_mode = IW_MODE_MASTER\n"); - //rtw_setopmode_cmd(padapter, networkType,_TRUE); - break; + //rtw_setopmode_cmd(padapter, networkType,_TRUE); + break; case IW_MODE_INFRA: networkType = Ndis802_11Infrastructure; - DBG_871X("set_mode = IW_MODE_INFRA\n"); + DBG_871X("set_mode = IW_MODE_INFRA\n"); break; - + default : ret = -EINVAL;; RT_TRACE(_module_rtl871x_ioctl_os_c,_drv_err_,("\n Mode: %s is not supported \n", iw_operation_mode[wrqu->mode])); goto exit; } - -/* + +/* if(Ndis802_11APMode == networkType) { rtw_setopmode_cmd(padapter, networkType,_TRUE); - } + } else { - rtw_setopmode_cmd(padapter, Ndis802_11AutoUnknown,_TRUE); + rtw_setopmode_cmd(padapter, Ndis802_11AutoUnknown,_TRUE); } */ - + if (rtw_set_802_11_infrastructure_mode(padapter, networkType) ==_FALSE){ ret = -EPERM; @@ -1446,11 +1446,11 @@ static int rtw_wx_set_mode(struct net_device *dev, struct iw_request_info *a, rtw_setopmode_cmd(padapter, networkType,_TRUE); exit: - + _func_exit_; - + return ret; - + } static int rtw_wx_get_mode(struct net_device *dev, struct iw_request_info *a, @@ -1458,18 +1458,18 @@ static int rtw_wx_get_mode(struct net_device *dev, struct iw_request_info *a, { struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); - + RT_TRACE(_module_rtl871x_mlme_c_,_drv_info_,(" rtw_wx_get_mode \n")); _func_enter_; - + if (check_fwstate(pmlmepriv, WIFI_STATION_STATE) == _TRUE) { wrqu->mode = IW_MODE_INFRA; } else if ((check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) == _TRUE) || (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE) == _TRUE)) - + { wrqu->mode = IW_MODE_ADHOC; } @@ -1483,9 +1483,9 @@ static int rtw_wx_get_mode(struct net_device *dev, struct iw_request_info *a, } _func_exit_; - + return 0; - + } @@ -1501,7 +1501,7 @@ static int rtw_wx_set_pmkid(struct net_device *dev, struct iw_pmksa* pPMK = ( struct iw_pmksa* ) extra; u8 strZeroMacAddress[ ETH_ALEN ] = { 0x00 }; u8 strIssueBssid[ ETH_ALEN ] = { 0x00 }; - + /* struct iw_pmksa { @@ -1528,13 +1528,13 @@ static int rtw_wx_set_pmkid(struct net_device *dev, intReturn = _TRUE; } blInserted = _FALSE; - + //overwrite PMKID for(j=0 ; jPMKIDList[j].Bssid, strIssueBssid, ETH_ALEN) ==_TRUE ) { // BSSID is matched, the same AP => rewrite with new PMKID. - + DBG_871X( "[rtw_wx_set_pmkid] BSSID exists in the PMKList.\n" ); _rtw_memcpy( psecuritypriv->PMKIDList[j].PMKID, pPMK->pmkid, IW_PMKID_LEN); @@ -1542,7 +1542,7 @@ static int rtw_wx_set_pmkid(struct net_device *dev, psecuritypriv->PMKIDIndex = j+1; blInserted = _TRUE; break; - } + } } if(!blInserted) @@ -1569,14 +1569,14 @@ static int rtw_wx_set_pmkid(struct net_device *dev, for(j=0 ; jPMKIDList[j].Bssid, strIssueBssid, ETH_ALEN) ==_TRUE ) - { // BSSID is matched, the same AP => Remove this PMKID information and reset it. + { // BSSID is matched, the same AP => Remove this PMKID information and reset it. _rtw_memset( psecuritypriv->PMKIDList[ j ].Bssid, 0x00, ETH_ALEN ); psecuritypriv->PMKIDList[ j ].bUsed = _FALSE; break; - } + } } } - else if ( pPMK->cmd == IW_PMKSA_FLUSH ) + else if ( pPMK->cmd == IW_PMKSA_FLUSH ) { DBG_871X( "[rtw_wx_set_pmkid] IW_PMKSA_FLUSH!\n" ); _rtw_memset( &psecuritypriv->PMKIDList[ 0 ], 0x00, sizeof( RT_PMKID_LIST ) * NUM_PMKID_CACHE ); @@ -1586,14 +1586,14 @@ static int rtw_wx_set_pmkid(struct net_device *dev, return( intReturn ); } -static int rtw_wx_get_sens(struct net_device *dev, - struct iw_request_info *info, +static int rtw_wx_get_sens(struct net_device *dev, + struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { #ifdef CONFIG_PLATFORM_ROCKCHIPS struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); - struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); - + struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); + /* * 20110311 Commented by Jeff * For rockchip platform's wpa_driver_wext_get_rssi @@ -1602,8 +1602,8 @@ static int rtw_wx_get_sens(struct net_device *dev, //wrqu->sens.value=-padapter->recvpriv.signal_strength; wrqu->sens.value=-padapter->recvpriv.rssi; //DBG_871X("%s: %d\n", __FUNCTION__, wrqu->sens.value); - wrqu->sens.fixed = 0; /* no auto select */ - } else + wrqu->sens.fixed = 0; /* no auto select */ + } else #endif { wrqu->sens.value = 0; @@ -1613,8 +1613,8 @@ static int rtw_wx_get_sens(struct net_device *dev, return 0; } -static int rtw_wx_get_range(struct net_device *dev, - struct iw_request_info *info, +static int rtw_wx_get_range(struct net_device *dev, + struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { struct iw_range *range = (struct iw_range *)extra; @@ -1623,9 +1623,9 @@ static int rtw_wx_get_range(struct net_device *dev, u16 val; int i; - + _func_enter_; - + RT_TRACE(_module_rtl871x_mlme_c_,_drv_info_,("rtw_wx_get_range. cmd_code=%x\n", info->cmd)); wrqu->data.length = sizeof(*range); @@ -1640,7 +1640,7 @@ static int rtw_wx_get_range(struct net_device *dev, */ /* ~5 Mb/s real (802.11b) */ - range->throughput = 5 * 1000 * 1000; + range->throughput = 5 * 1000 * 1000; // TODO: Not used in 802.11b? // range->min_nwid; /* Minimal NWID we are able to set */ @@ -1648,14 +1648,14 @@ static int rtw_wx_get_range(struct net_device *dev, // range->max_nwid; /* Maximal NWID we are able to set */ /* Old Frequency (backward compat - moved lower ) */ -// range->old_num_channels; +// range->old_num_channels; // range->old_num_frequency; // range->old_freq[6]; /* Filler to keep "version" at the same offset */ /* signal level threshold range */ //percent values between 0 and 100. - range->max_qual.qual = 100; + range->max_qual.qual = 100; range->max_qual.level = 100; range->max_qual.noise = 100; range->max_qual.updated = 7; /* Updated all three */ @@ -1769,8 +1769,8 @@ static int rtw_wx_set_wap(struct net_device *dev, ret = -EINVAL; goto exit; } -#endif -*/ +#endif +*/ #ifdef CONFIG_CONCURRENT_MODE if (check_buddy_fwstate(padapter, _FW_UNDER_SURVEY|_FW_UNDER_LINKING) == _TRUE) @@ -1797,13 +1797,13 @@ static int rtw_wx_set_wap(struct net_device *dev, ret= -1; goto exit; } - + if(!padapter->bup){ ret = -1; goto exit; } - + if (temp->sa_family != ARPHRD_ETHER){ ret = -EINVAL; goto exit; @@ -1816,17 +1816,17 @@ static int rtw_wx_set_wap(struct net_device *dev, while (1) { - + if ((rtw_end_of_queue_search(phead, pmlmepriv->pscanned)) == _TRUE) { -#if 0 +#if 0 ret = -EINVAL; goto exit; if(check_fwstate(pmlmepriv, WIFI_ADHOC_STATE) == _TRUE) { - rtw_set_802_11_bssid(padapter, temp->sa_data); - goto exit; + rtw_set_802_11_bssid(padapter, temp->sa_data); + goto exit; } else { @@ -1837,7 +1837,7 @@ static int rtw_wx_set_wap(struct net_device *dev, break; } - + pnetwork = LIST_CONTAINOR(pmlmepriv->pscanned, struct wlan_network, list); pmlmepriv->pscanned = get_next(pmlmepriv->pscanned); @@ -1847,7 +1847,7 @@ static int rtw_wx_set_wap(struct net_device *dev, src_bssid = temp->sa_data; if ((_rtw_memcmp(dst_bssid, src_bssid, ETH_ALEN)) == _TRUE) - { + { if(!rtw_set_802_11_infrastructure_mode(padapter, pnetwork->network.InfrastructureMode)) { ret = -1; @@ -1855,44 +1855,44 @@ static int rtw_wx_set_wap(struct net_device *dev, goto exit; } - break; + break; } - } + } _exit_critical_bh(&queue->lock, &irqL); - + rtw_set_802_11_authentication_mode(padapter, authmode); //set_802_11_encryption_mode(padapter, padapter->securitypriv.ndisencryptstatus); if (rtw_set_802_11_bssid(padapter, temp->sa_data) == _FALSE) { ret = -1; - goto exit; - } - + goto exit; + } + exit: - + _func_exit_; - - return ret; + + return ret; } -static int rtw_wx_get_wap(struct net_device *dev, - struct iw_request_info *info, +static int rtw_wx_get_wap(struct net_device *dev, + struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); + struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); - WLAN_BSSID_EX *pcur_bss = &pmlmepriv->cur_network.network; - + WLAN_BSSID_EX *pcur_bss = &pmlmepriv->cur_network.network; + wrqu->ap_addr.sa_family = ARPHRD_ETHER; - + _rtw_memset(wrqu->ap_addr.sa_data, 0, ETH_ALEN); - + RT_TRACE(_module_rtl871x_mlme_c_,_drv_info_,("rtw_wx_get_wap\n")); _func_enter_; - if ( ((check_fwstate(pmlmepriv, _FW_LINKED)) == _TRUE) || + if ( ((check_fwstate(pmlmepriv, _FW_LINKED)) == _TRUE) || ((check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE)) == _TRUE) || ((check_fwstate(pmlmepriv, WIFI_AP_STATE)) == _TRUE) ) { @@ -1901,17 +1901,17 @@ static int rtw_wx_get_wap(struct net_device *dev, } else { - _rtw_memset(wrqu->ap_addr.sa_data, 0, ETH_ALEN); - } + _rtw_memset(wrqu->ap_addr.sa_data, 0, ETH_ALEN); + } _func_exit_; - + return 0; - + } -static int rtw_wx_set_mlme(struct net_device *dev, - struct iw_request_info *info, +static int rtw_wx_set_mlme(struct net_device *dev, + struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { #if 0 @@ -1938,7 +1938,7 @@ struct iw_mlme reason = cpu_to_le16(mlme->reason_code); DBG_871X("%s, cmd=%d, reason=%d\n", __FUNCTION__, mlme->cmd, reason); - + switch (mlme->cmd) { case IW_MLME_DEAUTH: if(!rtw_set_802_11_disassociate(padapter)) @@ -1959,13 +1959,13 @@ static int rtw_wx_set_scan(struct net_device *dev, struct iw_request_info *a, union iwreq_data *wrqu, char *extra) { u8 _status = _FALSE; - int ret = 0; + int ret = 0; struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); struct mlme_priv *pmlmepriv= &padapter->mlmepriv; NDIS_802_11_SSID ssid[RTW_SSID_SCAN_AMOUNT]; _irqL irqL; #ifdef CONFIG_P2P - struct wifidirect_info *pwdinfo= &(padapter->wdinfo); + struct wifidirect_info *pwdinfo= &(padapter->wdinfo); #endif //CONFIG_P2P RT_TRACE(_module_rtl871x_mlme_c_,_drv_info_,("rtw_wx_set_scan\n")); @@ -1985,12 +1985,12 @@ _func_enter_; ret= -1; goto exit; } - + if(!padapter->bup){ ret = -1; goto exit; } - + if (padapter->hw_init_completed==_FALSE){ ret = -1; goto exit; @@ -2013,7 +2013,7 @@ _func_enter_; { indicate_wx_scan_complete_event(padapter); goto exit; - } + } #ifdef CONFIG_BT_COEXIST { @@ -2035,15 +2035,15 @@ _func_enter_; #ifdef CONFIG_CONCURRENT_MODE if (check_buddy_fwstate(padapter, _FW_UNDER_SURVEY|_FW_UNDER_LINKING|WIFI_UNDER_WPS) == _TRUE) - { + { if(check_buddy_fwstate(padapter, _FW_UNDER_SURVEY)) { DBG_871X("scanning_via_buddy_intf\n"); pmlmepriv->scanning_via_buddy_intf = _TRUE; - } + } indicate_wx_scan_complete_event(padapter); - + goto exit; } #endif @@ -2071,7 +2071,7 @@ _func_enter_; ret = 0; goto exit; } - + */ #ifdef CONFIG_P2P if ( pwdinfo->p2p_state != P2P_STATE_NONE ) @@ -2086,31 +2086,31 @@ _func_enter_; _rtw_memset(ssid, 0, sizeof(NDIS_802_11_SSID)*RTW_SSID_SCAN_AMOUNT); #if WIRELESS_EXT >= 17 - if (wrqu->data.length == sizeof(struct iw_scan_req)) + if (wrqu->data.length == sizeof(struct iw_scan_req)) { struct iw_scan_req *req = (struct iw_scan_req *)extra; - + if (wrqu->data.flags & IW_SCAN_THIS_ESSID) { int len = min((int)req->essid_len, IW_ESSID_MAX_SIZE); _rtw_memcpy(ssid[0].Ssid, req->essid, len); - ssid[0].SsidLength = len; + ssid[0].SsidLength = len; DBG_871X("IW_SCAN_THIS_ESSID, ssid=%s, len=%d\n", req->essid, req->essid_len); - - _enter_critical_bh(&pmlmepriv->lock, &irqL); - + + _enter_critical_bh(&pmlmepriv->lock, &irqL); + _status = rtw_sitesurvey_cmd(padapter, ssid, 1, NULL, 0); - + _exit_critical_bh(&pmlmepriv->lock, &irqL); - + } else if (req->scan_type == IW_SCAN_TYPE_PASSIVE) { DBG_871X("rtw_wx_set_scan, req->scan_type == IW_SCAN_TYPE_PASSIVE\n"); } - + } else #endif @@ -2126,7 +2126,7 @@ _func_enter_; int ssid_index = 0; //DBG_871X("%s COMBO_SCAN header is recognized\n", __FUNCTION__); - + while(len >= 1) { section = *(pos++); len-=1; @@ -2137,7 +2137,7 @@ _func_enter_; len = 0; break; } - + sec_len = *(pos++); len-=1; if(sec_len>0 && sec_len<=len) { @@ -2147,11 +2147,11 @@ _func_enter_; // , ssid[ssid_index].Ssid, ssid[ssid_index].SsidLength); ssid_index++; } - + pos+=sec_len; len-=sec_len; break; - - + + case WEXT_CSCAN_CHANNEL_SECTION: //DBG_871X("WEXT_CSCAN_CHANNEL_SECTION\n"); pos+=1; len-=1; @@ -2162,7 +2162,7 @@ _func_enter_; break; case WEXT_CSCAN_PASV_DWELL_SECTION: //DBG_871X("WEXT_CSCAN_PASV_DWELL_SECTION\n"); - pos+=2; len-=2; + pos+=2; len-=2; break; case WEXT_CSCAN_HOME_DWELL_SECTION: //DBG_871X("WEXT_CSCAN_HOME_DWELL_SECTION\n"); @@ -2177,20 +2177,20 @@ _func_enter_; DBG_871X("WEXT_CSCAN_NPROBE_SECTION\n"); break; #endif - + default: //DBG_871X("Unknown CSCAN section %c\n", section); len = 0; // stop parsing } //DBG_871X("len:%d\n", len); - + } - + //jeff: it has still some scan paramater to parse, we only do this now... _status = rtw_set_802_11_bssid_list_scan(padapter, ssid, RTW_SSID_SCAN_AMOUNT); - + } else - + { _status = rtw_set_802_11_bssid_list_scan(padapter, NULL, 0); } @@ -2205,7 +2205,7 @@ exit: _func_exit_; - return ret; + return ret; } static int rtw_wx_get_scan(struct net_device *dev, struct iw_request_info *a, @@ -2243,13 +2243,13 @@ static int rtw_wx_get_scan(struct net_device *dev, struct iw_request_info *a, goto exit; } #endif -*/ +*/ if(adapter_to_pwrctl(padapter)->brfoffbyhw && padapter->bDriverStopped) { ret = -EINVAL; goto exit; } - + #ifdef CONFIG_P2P if(!rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) { @@ -2271,7 +2271,7 @@ static int rtw_wx_get_scan(struct net_device *dev, struct iw_request_info *a, #endif //CONFIG_P2P /* -#ifdef CONFIG_CONCURRENT_MODE +#ifdef CONFIG_CONCURRENT_MODE if(pmlmepriv->scanning_via_buddy_intf == _TRUE) { pmlmepriv->scanning_via_buddy_intf = _FALSE;//reset @@ -2279,10 +2279,10 @@ static int rtw_wx_get_scan(struct net_device *dev, struct iw_request_info *a, // change pointers to buddy interface padapter = pbuddy_adapter; pmlmepriv = pbuddy_mlmepriv; - queue = &(pbuddy_mlmepriv->scanned_queue); - + queue = &(pbuddy_mlmepriv->scanned_queue); + } -#endif // CONFIG_CONCURRENT_MODE +#endif // CONFIG_CONCURRENT_MODE */ #if 1 // Wireless Extension use EAGAIN to try wait_status = _FW_UNDER_SURVEY @@ -2312,8 +2312,8 @@ static int rtw_wx_get_scan(struct net_device *dev, struct iw_request_info *a, } #endif // CONFIG_DUALMAC_CONCURRENT - while(check_fwstate(pmlmepriv, wait_status) == _TRUE) - { + while(check_fwstate(pmlmepriv, wait_status) == _TRUE) + { rtw_msleep_os(30); cnt++; if(cnt > wait_for_surveydone ) @@ -2325,7 +2325,7 @@ static int rtw_wx_get_scan(struct net_device *dev, struct iw_request_info *a, phead = get_list_head(queue); plist = get_next(phead); - + while(1) { if (rtw_end_of_queue_search(phead,plist)== _TRUE) @@ -2347,24 +2347,24 @@ static int rtw_wx_get_scan(struct net_device *dev, struct iw_request_info *a, } plist = get_next(plist); - - } + + } _exit_critical_bh(&(pmlmepriv->scanned_queue.lock), &irqL); wrqu->data.length = ev-extra; wrqu->data.flags = 0; - -exit: - - _func_exit_; - + +exit: + + _func_exit_; + #ifdef DBG_IOCTL DBG_871X("DBG_IOCTL %s:%d return %d\n",__FUNCTION__, __LINE__, ret); #endif - + return ret ; - + } //set ssid flow @@ -2372,7 +2372,7 @@ exit: //s2. set_802_11_authenticaion_mode() //s3. set_802_11_encryption_mode() //s4. rtw_set_802_11_ssid() -static int rtw_wx_set_essid(struct net_device *dev, +static int rtw_wx_set_essid(struct net_device *dev, struct iw_request_info *a, union iwreq_data *wrqu, char *extra) { @@ -2383,18 +2383,18 @@ static int rtw_wx_set_essid(struct net_device *dev, _list *phead; s8 status = _TRUE; struct wlan_network *pnetwork = NULL; - NDIS_802_11_AUTHENTICATION_MODE authmode; - NDIS_802_11_SSID ndis_ssid; + NDIS_802_11_AUTHENTICATION_MODE authmode; + NDIS_802_11_SSID ndis_ssid; u8 *dst_ssid, *src_ssid; uint ret = 0, len; _func_enter_; - + #ifdef DBG_IOCTL DBG_871X("DBG_IOCTL %s:%d\n",__FUNCTION__, __LINE__); #endif - + /* #ifdef CONFIG_CONCURRENT_MODE if(padapter->iface_type > PRIMARY_IFACE) @@ -2407,11 +2407,11 @@ static int rtw_wx_set_essid(struct net_device *dev, #ifdef CONFIG_CONCURRENT_MODE if (check_buddy_fwstate(padapter, _FW_UNDER_SURVEY|_FW_UNDER_LINKING) == _TRUE) - { + { DBG_871X("set ssid, but buddy_intf is under scanning or linking\n"); - + ret = -EINVAL; - + goto exit; } #endif @@ -2428,7 +2428,7 @@ static int rtw_wx_set_essid(struct net_device *dev, RT_TRACE(_module_rtl871x_ioctl_os_c, _drv_info_, ("+rtw_wx_set_essid: fw_state=0x%08x\n", get_fwstate(pmlmepriv))); if(_FAIL == rtw_pwr_wakeup(padapter)) - { + { ret = -1; goto exit; } @@ -2446,12 +2446,12 @@ static int rtw_wx_set_essid(struct net_device *dev, ret= -E2BIG; goto exit; } - + if(check_fwstate(pmlmepriv, WIFI_AP_STATE)) { ret = -1; goto exit; - } - + } + authmode = padapter->securitypriv.ndisauthtype; DBG_871X("=>%s\n",__FUNCTION__); if (wrqu->essid.flags && wrqu->essid.length) @@ -2460,7 +2460,7 @@ static int rtw_wx_set_essid(struct net_device *dev, // We got the codes in "set_info" function of iwconfig source code. // ========================================= // wrq.u.essid.length = strlen(essid) + 1; - // if(we_kernel_version > 20) + // if(we_kernel_version > 20) // wrq.u.essid.length--; // ========================================= // That means, if the WIRELESS_EXT less than or equal to 20, the correct ssid len should subtract 1. @@ -2475,24 +2475,24 @@ static int rtw_wx_set_essid(struct net_device *dev, _rtw_memset(&ndis_ssid, 0, sizeof(NDIS_802_11_SSID)); ndis_ssid.SsidLength = len; - _rtw_memcpy(ndis_ssid.Ssid, extra, len); + _rtw_memcpy(ndis_ssid.Ssid, extra, len); src_ssid = ndis_ssid.Ssid; - + RT_TRACE(_module_rtl871x_ioctl_os_c, _drv_info_, ("rtw_wx_set_essid: ssid=[%s]\n", src_ssid)); _enter_critical_bh(&queue->lock, &irqL); phead = get_list_head(queue); pmlmepriv->pscanned = get_next(phead); while (1) - { + { if (rtw_end_of_queue_search(phead, pmlmepriv->pscanned) == _TRUE) { -#if 0 +#if 0 if(check_fwstate(pmlmepriv, WIFI_ADHOC_STATE) == _TRUE) { - rtw_set_802_11_ssid(padapter, &ndis_ssid); + rtw_set_802_11_ssid(padapter, &ndis_ssid); - goto exit; + goto exit; } else { @@ -2500,13 +2500,13 @@ static int rtw_wx_set_essid(struct net_device *dev, ret = -EINVAL; goto exit; } -#endif +#endif RT_TRACE(_module_rtl871x_ioctl_os_c, _drv_warning_, ("rtw_wx_set_essid: scan_q is empty, set ssid to check if scanning again!\n")); break; } - + pnetwork = LIST_CONTAINOR(pmlmepriv->pscanned, struct wlan_network, list); pmlmepriv->pscanned = get_next(pmlmepriv->pscanned); @@ -2522,13 +2522,13 @@ static int rtw_wx_set_essid(struct net_device *dev, { RT_TRACE(_module_rtl871x_ioctl_os_c, _drv_info_, ("rtw_wx_set_essid: find match, set infra mode\n")); - + if(check_fwstate(pmlmepriv, WIFI_ADHOC_STATE) == _TRUE) { if(pnetwork->network.InfrastructureMode != pmlmepriv->cur_network.network.InfrastructureMode) continue; - } - + } + if (rtw_set_802_11_infrastructure_mode(padapter, pnetwork->network.InfrastructureMode) == _FALSE) { ret = -1; @@ -2536,7 +2536,7 @@ static int rtw_wx_set_essid(struct net_device *dev, goto exit; } - break; + break; } } _exit_critical_bh(&queue->lock, &irqL); @@ -2547,23 +2547,23 @@ static int rtw_wx_set_essid(struct net_device *dev, if (rtw_set_802_11_ssid(padapter, &ndis_ssid) == _FALSE) { ret = -1; goto exit; - } - } - + } + } + exit: DBG_871X("<=%s, ret %d\n",__FUNCTION__, ret); - + #ifdef DBG_IOCTL DBG_871X("DBG_IOCTL %s:%d return %d\n",__FUNCTION__, __LINE__, ret); #endif - + _func_exit_; - - return ret; + + return ret; } -static int rtw_wx_get_essid(struct net_device *dev, +static int rtw_wx_get_essid(struct net_device *dev, struct iw_request_info *a, union iwreq_data *wrqu, char *extra) { @@ -2582,7 +2582,7 @@ static int rtw_wx_get_essid(struct net_device *dev, len = pcur_bss->Ssid.SsidLength; wrqu->essid.length = len; - + _rtw_memcpy(extra, pcur_bss->Ssid.Ssid, len); wrqu->essid.flags = 1; @@ -2594,14 +2594,14 @@ static int rtw_wx_get_essid(struct net_device *dev, } exit: - + _func_exit_; - + return ret; - + } -static int rtw_wx_set_rate(struct net_device *dev, +static int rtw_wx_set_rate(struct net_device *dev, struct iw_request_info *a, union iwreq_data *wrqu, char *extra) { @@ -2617,7 +2617,7 @@ _func_enter_; RT_TRACE(_module_rtl871x_mlme_c_,_drv_info_,(" rtw_wx_set_rate \n")); RT_TRACE(_module_rtl871x_ioctl_os_c,_drv_info_,("target_rate = %d, fixed = %d\n",target_rate,fixed)); - + if(target_rate == -1){ ratevalue = 11; goto set_rate; @@ -2693,127 +2693,127 @@ _func_exit_; return ret; } -static int rtw_wx_get_rate(struct net_device *dev, - struct iw_request_info *info, +static int rtw_wx_get_rate(struct net_device *dev, + struct iw_request_info *info, union iwreq_data *wrqu, char *extra) -{ +{ u16 max_rate = 0; max_rate = rtw_get_cur_max_rate((struct adapter *)rtw_netdev_priv(dev)); if(max_rate == 0) return -EPERM; - + wrqu->bitrate.fixed = 0; /* no auto select */ wrqu->bitrate.value = max_rate * 100000; return 0; } -static int rtw_wx_set_rts(struct net_device *dev, - struct iw_request_info *info, +static int rtw_wx_set_rts(struct net_device *dev, + struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); _func_enter_; - + if (wrqu->rts.disabled) padapter->registrypriv.rts_thresh = 2347; else { if (wrqu->rts.value < 0 || wrqu->rts.value > 2347) return -EINVAL; - + padapter->registrypriv.rts_thresh = wrqu->rts.value; } DBG_871X("%s, rts_thresh=%d\n", __func__, padapter->registrypriv.rts_thresh); - + _func_exit_; - + return 0; } -static int rtw_wx_get_rts(struct net_device *dev, - struct iw_request_info *info, +static int rtw_wx_get_rts(struct net_device *dev, + struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); - + _func_enter_; - DBG_871X("%s, rts_thresh=%d\n", __func__, padapter->registrypriv.rts_thresh); - + DBG_871X("%s, rts_thresh=%d\n", __func__, padapter->registrypriv.rts_thresh); + wrqu->rts.value = padapter->registrypriv.rts_thresh; wrqu->rts.fixed = 0; /* no auto select */ //wrqu->rts.disabled = (wrqu->rts.value == DEFAULT_RTS_THRESHOLD); - + _func_exit_; - + return 0; } -static int rtw_wx_set_frag(struct net_device *dev, - struct iw_request_info *info, +static int rtw_wx_set_frag(struct net_device *dev, + struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); _func_enter_; - + if (wrqu->frag.disabled) padapter->xmitpriv.frag_len = MAX_FRAG_THRESHOLD; else { if (wrqu->frag.value < MIN_FRAG_THRESHOLD || wrqu->frag.value > MAX_FRAG_THRESHOLD) return -EINVAL; - + padapter->xmitpriv.frag_len = wrqu->frag.value & ~0x1; } DBG_871X("%s, frag_len=%d\n", __func__, padapter->xmitpriv.frag_len); - + _func_exit_; - + return 0; - + } -static int rtw_wx_get_frag(struct net_device *dev, - struct iw_request_info *info, +static int rtw_wx_get_frag(struct net_device *dev, + struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); - + _func_enter_; DBG_871X("%s, frag_len=%d\n", __func__, padapter->xmitpriv.frag_len); - + wrqu->frag.value = padapter->xmitpriv.frag_len; wrqu->frag.fixed = 0; /* no auto select */ //wrqu->frag.disabled = (wrqu->frag.value == DEFAULT_FRAG_THRESHOLD); - + _func_exit_; - + return 0; } -static int rtw_wx_get_retry(struct net_device *dev, - struct iw_request_info *info, +static int rtw_wx_get_retry(struct net_device *dev, + struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { //struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); - + wrqu->retry.value = 7; wrqu->retry.fixed = 0; /* no auto select */ wrqu->retry.disabled = 1; - + return 0; -} +} #if 0 #define IW_ENCODE_INDEX 0x00FF /* Token index (if needed) */ @@ -2838,13 +2838,13 @@ iwconfig wlan0 key restricted [2] -> flags = 0x4802 */ #endif -static int rtw_wx_set_enc(struct net_device *dev, - struct iw_request_info *info, +static int rtw_wx_set_enc(struct net_device *dev, + struct iw_request_info *info, union iwreq_data *wrqu, char *keybuf) -{ +{ u32 key, ret = 0; u32 keyindex_provided; - NDIS_802_11_WEP wep; + NDIS_802_11_WEP wep; NDIS_802_11_AUTHENTICATION_MODE authmode; struct iw_point *erq = &(wrqu->encoding); @@ -2853,10 +2853,10 @@ static int rtw_wx_set_enc(struct net_device *dev, DBG_871X("+rtw_wx_set_enc, flags=0x%x\n", erq->flags); _rtw_memset(&wep, 0, sizeof(NDIS_802_11_WEP)); - + key = erq->flags & IW_ENCODE_INDEX; - - _func_enter_; + + _func_enter_; if (erq->flags & IW_ENCODE_DISABLED) { @@ -2865,9 +2865,9 @@ static int rtw_wx_set_enc(struct net_device *dev, padapter->securitypriv.dot11PrivacyAlgrthm=_NO_PRIVACY_; padapter->securitypriv.dot118021XGrpPrivacy=_NO_PRIVACY_; padapter->securitypriv.dot11AuthAlgrthm= dot11AuthAlgrthm_Open; //open system - authmode = Ndis802_11AuthModeOpen; + authmode = Ndis802_11AuthModeOpen; padapter->securitypriv.ndisauthtype=authmode; - + goto exit; } @@ -2876,15 +2876,15 @@ static int rtw_wx_set_enc(struct net_device *dev, return -EINVAL; key--; keyindex_provided = 1; - } + } else { keyindex_provided = 0; key = padapter->securitypriv.dot11PrivacyKeyIndex; DBG_871X("rtw_wx_set_enc, key=%d\n", key); } - - //set authentication mode + + //set authentication mode if(erq->flags & IW_ENCODE_OPEN) { DBG_871X("rtw_wx_set_enc():IW_ENCODE_OPEN\n"); @@ -2898,11 +2898,11 @@ static int rtw_wx_set_enc(struct net_device *dev, padapter->securitypriv.dot11PrivacyAlgrthm=_NO_PRIVACY_; padapter->securitypriv.dot118021XGrpPrivacy=_NO_PRIVACY_; - authmode = Ndis802_11AuthModeOpen; + authmode = Ndis802_11AuthModeOpen; padapter->securitypriv.ndisauthtype=authmode; - } + } else if(erq->flags & IW_ENCODE_RESTRICTED) - { + { DBG_871X("rtw_wx_set_enc():IW_ENCODE_RESTRICTED\n"); padapter->securitypriv.ndisencryptstatus = Ndis802_11Encryption1Enabled; @@ -2913,7 +2913,7 @@ static int rtw_wx_set_enc(struct net_device *dev, #endif padapter->securitypriv.dot11PrivacyAlgrthm=_WEP40_; - padapter->securitypriv.dot118021XGrpPrivacy=_WEP40_; + padapter->securitypriv.dot118021XGrpPrivacy=_WEP40_; authmode = Ndis802_11AuthModeShared; padapter->securitypriv.ndisauthtype=authmode; } @@ -2925,10 +2925,10 @@ static int rtw_wx_set_enc(struct net_device *dev, padapter->securitypriv.dot11AuthAlgrthm= dot11AuthAlgrthm_Open; //open system padapter->securitypriv.dot11PrivacyAlgrthm=_NO_PRIVACY_; padapter->securitypriv.dot118021XGrpPrivacy=_NO_PRIVACY_; - authmode = Ndis802_11AuthModeOpen; + authmode = Ndis802_11AuthModeOpen; padapter->securitypriv.ndisauthtype=authmode; } - + wep.KeyIndex = key; if (erq->length > 0) { @@ -2939,7 +2939,7 @@ static int rtw_wx_set_enc(struct net_device *dev, else { wep.KeyLength = 0 ; - + if(keyindex_provided == 1)// set key_id only, no given KeyMaterial(erq->length==0). { padapter->securitypriv.dot11PrivacyKeyIndex = key; @@ -2949,42 +2949,42 @@ static int rtw_wx_set_enc(struct net_device *dev, switch(padapter->securitypriv.dot11DefKeylen[key]) { case 5: - padapter->securitypriv.dot11PrivacyAlgrthm=_WEP40_; + padapter->securitypriv.dot11PrivacyAlgrthm=_WEP40_; break; case 13: - padapter->securitypriv.dot11PrivacyAlgrthm=_WEP104_; + padapter->securitypriv.dot11PrivacyAlgrthm=_WEP104_; break; default: - padapter->securitypriv.dot11PrivacyAlgrthm=_NO_PRIVACY_; + padapter->securitypriv.dot11PrivacyAlgrthm=_NO_PRIVACY_; break; } - + goto exit; - + } - + } wep.KeyIndex |= 0x80000000; _rtw_memcpy(wep.KeyMaterial, keybuf, wep.KeyLength); - + if (rtw_set_802_11_add_wep(padapter, &wep) == _FALSE) { if(rf_on == pwrpriv->rf_pwrstate ) ret = -EOPNOTSUPP; goto exit; - } + } exit: - + _func_exit_; - + return ret; - + } -static int rtw_wx_get_enc(struct net_device *dev, - struct iw_request_info *info, +static int rtw_wx_get_enc(struct net_device *dev, + struct iw_request_info *info, union iwreq_data *wrqu, char *keybuf) { uint key, ret =0; @@ -2993,7 +2993,7 @@ static int rtw_wx_get_enc(struct net_device *dev, struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); _func_enter_; - + if(check_fwstate(pmlmepriv, _FW_LINKED) != _TRUE) { if(check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) != _TRUE) @@ -3001,10 +3001,10 @@ static int rtw_wx_get_enc(struct net_device *dev, erq->length = 0; erq->flags |= IW_ENCODE_DISABLED; return 0; - } - } + } + } + - key = erq->flags & IW_ENCODE_INDEX; if (key) { @@ -3014,15 +3014,15 @@ static int rtw_wx_get_enc(struct net_device *dev, } else { key = padapter->securitypriv.dot11PrivacyKeyIndex; - } + } erq->flags = key + 1; //if(padapter->securitypriv.ndisauthtype == Ndis802_11AuthModeOpen) //{ // erq->flags |= IW_ENCODE_OPEN; - //} - + //} + switch(padapter->securitypriv.ndisencryptstatus) { case Ndis802_11EncryptionNotSupported: @@ -3030,28 +3030,28 @@ static int rtw_wx_get_enc(struct net_device *dev, erq->length = 0; erq->flags |= IW_ENCODE_DISABLED; - + break; - - case Ndis802_11Encryption1Enabled: - - erq->length = padapter->securitypriv.dot11DefKeylen[key]; + + case Ndis802_11Encryption1Enabled: + + erq->length = padapter->securitypriv.dot11DefKeylen[key]; if(erq->length) { _rtw_memcpy(keybuf, padapter->securitypriv.dot11DefKey[key].skey, padapter->securitypriv.dot11DefKeylen[key]); - + erq->flags |= IW_ENCODE_ENABLED; if(padapter->securitypriv.ndisauthtype == Ndis802_11AuthModeOpen) { - erq->flags |= IW_ENCODE_OPEN; + erq->flags |= IW_ENCODE_OPEN; } else if(padapter->securitypriv.ndisauthtype == Ndis802_11AuthModeShared) { erq->flags |= IW_ENCODE_RESTRICTED; - } - } + } + } else { erq->length = 0; @@ -3067,60 +3067,60 @@ static int rtw_wx_get_enc(struct net_device *dev, erq->flags |= (IW_ENCODE_ENABLED | IW_ENCODE_OPEN | IW_ENCODE_NOKEY); break; - + default: erq->length = 0; erq->flags |= IW_ENCODE_DISABLED; break; - - } - - _func_exit_; - - return ret; - -} -static int rtw_wx_get_power(struct net_device *dev, - struct iw_request_info *info, + } + + _func_exit_; + + return ret; + +} + +static int rtw_wx_get_power(struct net_device *dev, + struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { //struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); - + wrqu->power.value = 0; wrqu->power.fixed = 0; /* no auto select */ wrqu->power.disabled = 1; - + return 0; } -static int rtw_wx_set_gen_ie(struct net_device *dev, - struct iw_request_info *info, +static int rtw_wx_set_gen_ie(struct net_device *dev, + struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { int ret; struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); - - ret = rtw_set_wpa_ie(padapter, extra, wrqu->data.length); - - return ret; -} -static int rtw_wx_set_auth(struct net_device *dev, - struct iw_request_info *info, + ret = rtw_set_wpa_ie(padapter, extra, wrqu->data.length); + + return ret; +} + +static int rtw_wx_set_auth(struct net_device *dev, + struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); struct iw_param *param = (struct iw_param*)&(wrqu->param); - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; + struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct security_priv *psecuritypriv = &padapter->securitypriv; struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); u32 value = param->value; int ret = 0; - + switch (param->flags & IW_AUTH_INDEX) { case IW_AUTH_WPA_VERSION: @@ -3141,10 +3141,10 @@ static int rtw_wx_set_auth(struct net_device *dev, #endif break; case IW_AUTH_CIPHER_PAIRWISE: - + break; case IW_AUTH_CIPHER_GROUP: - + break; case IW_AUTH_KEY_MGMT: #ifdef CONFIG_WAPI_SUPPORT @@ -3166,11 +3166,11 @@ static int rtw_wx_set_auth(struct net_device *dev, { if ( param->value ) { // wpa_supplicant is enabling the tkip countermeasure. - padapter->securitypriv.btkip_countermeasure = _TRUE; + padapter->securitypriv.btkip_countermeasure = _TRUE; } else { // wpa_supplicant is disabling the tkip countermeasure. - padapter->securitypriv.btkip_countermeasure = _FALSE; + padapter->securitypriv.btkip_countermeasure = _FALSE; } break; } @@ -3190,10 +3190,10 @@ static int rtw_wx_set_auth(struct net_device *dev, if(padapter->securitypriv.ndisencryptstatus == Ndis802_11Encryption1Enabled) { - break;//it means init value, or using wep, ndisencryptstatus = Ndis802_11Encryption1Enabled, + break;//it means init value, or using wep, ndisencryptstatus = Ndis802_11Encryption1Enabled, // then it needn't reset it; } - + if(param->value){ padapter->securitypriv.ndisencryptstatus = Ndis802_11EncryptionDisabled; padapter->securitypriv.dot11PrivacyAlgrthm=_NO_PRIVACY_; @@ -3201,7 +3201,7 @@ static int rtw_wx_set_auth(struct net_device *dev, padapter->securitypriv.dot11AuthAlgrthm= dot11AuthAlgrthm_Open; //open system padapter->securitypriv.ndisauthtype=Ndis802_11AuthModeOpen; } - + break; } @@ -3221,8 +3221,8 @@ static int rtw_wx_set_auth(struct net_device *dev, #endif - ret = wpa_set_auth_algs(dev, (u32)param->value); - + ret = wpa_set_auth_algs(dev, (u32)param->value); + break; case IW_AUTH_WPA_ENABLED: @@ -3231,9 +3231,9 @@ static int rtw_wx_set_auth(struct net_device *dev, // padapter->securitypriv.dot11AuthAlgrthm = dot11AuthAlgrthm_8021X; //802.1x //else // padapter->securitypriv.dot11AuthAlgrthm = dot11AuthAlgrthm_Open;//open system - + //_disassociate(priv); - + break; case IW_AUTH_RX_UNENCRYPTED_EAPOL: @@ -3253,29 +3253,29 @@ static int rtw_wx_set_auth(struct net_device *dev, default: return -EOPNOTSUPP; - + } - + return ret; - + } -static int rtw_wx_set_enc_ext(struct net_device *dev, - struct iw_request_info *info, +static int rtw_wx_set_enc_ext(struct net_device *dev, + struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { char *alg_name; u32 param_len; struct ieee_param *param = NULL; struct iw_point *pencoding = &wrqu->encoding; - struct iw_encode_ext *pext = (struct iw_encode_ext *)extra; + struct iw_encode_ext *pext = (struct iw_encode_ext *)extra; int ret=0; param_len = sizeof(struct ieee_param) + pext->key_len; param = (struct ieee_param *)rtw_malloc(param_len); if (param == NULL) return -1; - + _rtw_memset(param, 0, param_len); param->cmd = IEEE_CMD_SET_ENCRYPTION; @@ -3284,8 +3284,8 @@ static int rtw_wx_set_enc_ext(struct net_device *dev, switch (pext->alg) { case IW_ENCODE_ALG_NONE: - //todo: remove key - //remove = 1; + //todo: remove key + //remove = 1; alg_name = "none"; break; case IW_ENCODE_ALG_WEP: @@ -3323,7 +3323,7 @@ static int rtw_wx_set_enc_ext(struct net_device *dev, } /* cliW: WEP does not have group key - * just not checking GROUP key setting + * just not checking GROUP key setting */ if ((pext->alg != IW_ENCODE_ALG_WEP) && ((pext->ext_flags & IW_ENCODE_EXT_GROUP_KEY) @@ -3358,7 +3358,7 @@ static int rtw_wx_set_enc_ext(struct net_device *dev, if (pencoding->flags & IW_ENCODE_DISABLED) { - //todo: remove key + //todo: remove key //remove = 1; } @@ -3373,10 +3373,10 @@ static int rtw_wx_set_enc_ext(struct net_device *dev, } -static int rtw_wx_get_nick(struct net_device *dev, - struct iw_request_info *info, +static int rtw_wx_get_nick(struct net_device *dev, + struct iw_request_info *info, union iwreq_data *wrqu, char *extra) -{ +{ //struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); //struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); //struct security_priv *psecuritypriv = &padapter->securitypriv; @@ -3390,19 +3390,19 @@ static int rtw_wx_get_nick(struct net_device *dev, //rtw_signal_process(pid, SIGUSR1); //for test - //dump debug info here + //dump debug info here /* u32 dot11AuthAlgrthm; // 802.11 auth, could be open, shared, and 8021x u32 dot11PrivacyAlgrthm; // This specify the privacy for shared auth. algorithm. - u32 dot118021XGrpPrivacy; // This specify the privacy algthm. used for Grp key + u32 dot118021XGrpPrivacy; // This specify the privacy algthm. used for Grp key u32 ndisauthtype; u32 ndisencryptstatus; */ - //DBG_871X("auth_alg=0x%x, enc_alg=0x%x, auth_type=0x%x, enc_type=0x%x\n", + //DBG_871X("auth_alg=0x%x, enc_alg=0x%x, auth_type=0x%x, enc_type=0x%x\n", // psecuritypriv->dot11AuthAlgrthm, psecuritypriv->dot11PrivacyAlgrthm, // psecuritypriv->ndisauthtype, psecuritypriv->ndisencryptstatus); - + //DBG_871X("enc_alg=0x%x\n", psecuritypriv->dot11PrivacyAlgrthm); //DBG_871X("auth_type=0x%x\n", psecuritypriv->ndisauthtype); //DBG_871X("enc_type=0x%x\n", psecuritypriv->ndisencryptstatus); @@ -3413,7 +3413,7 @@ static int rtw_wx_get_nick(struct net_device *dev, DBG_871X("dbg(0x280)=0x%x\n", rtw_read32(padapter, 0x280)); DBG_871X("dbg(0x284)=0x%x\n", rtw_read32(padapter, 0x284)); DBG_871X("dbg(0x288)=0x%x\n", rtw_read32(padapter, 0x288)); - + DBG_871X("dbg(0x664)=0x%x\n", rtw_read32(padapter, 0x664)); @@ -3423,18 +3423,18 @@ static int rtw_wx_get_nick(struct net_device *dev, DBG_871X("dbg(0x438)=0x%x\n", rtw_read32(padapter, 0x438)); DBG_871X("dbg(0x440)=0x%x\n", rtw_read32(padapter, 0x440)); - + DBG_871X("dbg(0x458)=0x%x\n", rtw_read32(padapter, 0x458)); - + DBG_871X("dbg(0x484)=0x%x\n", rtw_read32(padapter, 0x484)); DBG_871X("dbg(0x488)=0x%x\n", rtw_read32(padapter, 0x488)); - + DBG_871X("dbg(0x444)=0x%x\n", rtw_read32(padapter, 0x444)); DBG_871X("dbg(0x448)=0x%x\n", rtw_read32(padapter, 0x448)); DBG_871X("dbg(0x44c)=0x%x\n", rtw_read32(padapter, 0x44c)); DBG_871X("dbg(0x450)=0x%x\n", rtw_read32(padapter, 0x450)); #endif - + return 0; } @@ -3577,13 +3577,13 @@ static int rtw_wx_priv_null(struct net_device *dev, struct iw_request_info *a, static int dummy(struct net_device *dev, struct iw_request_info *a, union iwreq_data *wrqu, char *b) { - //struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); + //struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); //struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); //DBG_871X("cmd_code=%x, fwstate=0x%x\n", a->cmd, get_fwstate(pmlmepriv)); - + return -1; - + } static int rtw_wx_set_channel_plan(struct net_device *dev, @@ -3604,7 +3604,7 @@ static int rtw_wx_set_channel_plan(struct net_device *dev, if( _SUCCESS == rtw_set_chplan_cmd(padapter, channel_plan_req, 1) ) { DBG_871X("%s set channel_plan = 0x%02X\n", __func__, pmlmepriv->ChannelPlan); - } else + } else return -EPERM; return 0; @@ -3676,8 +3676,8 @@ struct iw_point #ifdef CONFIG_DRVEXT_MODULE u8 res; - struct drvext_handler *phandler; - struct drvext_oidparam *poidparam; + struct drvext_handler *phandler; + struct drvext_oidparam *poidparam; int ret; u16 len; u8 *pparmbuf, bset; @@ -3688,8 +3688,8 @@ struct iw_point ret = -EINVAL; goto _rtw_drvext_hdl_exit; } - - + + bset = (u8)(p->flags&0xFFFF); len = p->length; pparmbuf = (u8*)rtw_malloc(len); @@ -3697,32 +3697,32 @@ struct iw_point ret = -ENOMEM; goto _rtw_drvext_hdl_exit; } - + if(bset)//set info { if (copy_from_user(pparmbuf, p->pointer,len)) { rtw_mfree(pparmbuf, len); ret = -EFAULT; goto _rtw_drvext_hdl_exit; - } + } } else//query info { - + } - + // - poidparam = (struct drvext_oidparam *)pparmbuf; - + poidparam = (struct drvext_oidparam *)pparmbuf; + RT_TRACE(_module_rtl871x_ioctl_os_c,_drv_info_,("drvext set oid subcode [%d], len[%d], InformationBufferLength[%d]\r\n", - poidparam->subcode, poidparam->len, len)); + poidparam->subcode, poidparam->len, len)); - //check subcode + //check subcode if ( poidparam->subcode >= MAX_DRVEXT_HANDLERS) { - RT_TRACE(_module_rtl871x_ioctl_os_c,_drv_err_,("no matching drvext handlers\r\n")); + RT_TRACE(_module_rtl871x_ioctl_os_c,_drv_err_,("no matching drvext handlers\r\n")); ret = -EINVAL; goto _rtw_drvext_hdl_exit; } @@ -3730,7 +3730,7 @@ struct iw_point if ( poidparam->subcode >= MAX_DRVEXT_OID_SUBCODES) { - RT_TRACE(_module_rtl871x_ioctl_os_c,_drv_err_,("no matching drvext subcodes\r\n")); + RT_TRACE(_module_rtl871x_ioctl_os_c,_drv_err_,("no matching drvext subcodes\r\n")); ret = -EINVAL; goto _rtw_drvext_hdl_exit; } @@ -3740,9 +3740,9 @@ struct iw_point if (poidparam->len != phandler->parmsize) { - RT_TRACE(_module_rtl871x_ioctl_os_c,_drv_err_,("no matching drvext param size %d vs %d\r\n", - poidparam->len , phandler->parmsize)); - ret = -EINVAL; + RT_TRACE(_module_rtl871x_ioctl_os_c,_drv_err_,("no matching drvext param size %d vs %d\r\n", + poidparam->len , phandler->parmsize)); + ret = -EINVAL; goto _rtw_drvext_hdl_exit; } @@ -3752,21 +3752,21 @@ struct iw_point if(res==0) { ret = 0; - + if (bset == 0x00) {//query info //_rtw_memcpy(p->pointer, pparmbuf, len); if (copy_to_user(p->pointer, pparmbuf, len)) ret = -EFAULT; - } - } + } + } else ret = -EFAULT; - -_rtw_drvext_hdl_exit: - - return ret; - + +_rtw_drvext_hdl_exit: + + return ret; + #endif return 0; @@ -3775,7 +3775,7 @@ _rtw_drvext_hdl_exit: static void rtw_dbg_mode_hdl(struct adapter *padapter, u32 id, u8 *pdata, u32 len) { - pRW_Reg RegRWStruct; + pRW_Reg RegRWStruct; struct rf_reg_param *prfreg; u8 path; u8 offset; @@ -3804,7 +3804,7 @@ static void rtw_dbg_mode_hdl(struct adapter *padapter, u32 id, u8 *pdata, u32 le default: break; } - + break; case GEN_MP_IOCTL_SUBCODE(WRITE_REG): RegRWStruct = (pRW_Reg)pdata; @@ -3819,40 +3819,40 @@ static void rtw_dbg_mode_hdl(struct adapter *padapter, u32 id, u8 *pdata, u32 le case 4: rtw_write32(padapter, RegRWStruct->offset, (u32)RegRWStruct->value); break; - default: + default: break; } - + break; case GEN_MP_IOCTL_SUBCODE(READ_RF_REG): prfreg = (struct rf_reg_param *)pdata; - path = (u8)prfreg->path; - offset = (u8)prfreg->offset; + path = (u8)prfreg->path; + offset = (u8)prfreg->offset; value = rtw_hal_read_rfreg(padapter, path, offset, 0xffffffff); prfreg->value = value; - break; + break; case GEN_MP_IOCTL_SUBCODE(WRITE_RF_REG): prfreg = (struct rf_reg_param *)pdata; path = (u8)prfreg->path; - offset = (u8)prfreg->offset; + offset = (u8)prfreg->offset; value = prfreg->value; rtw_hal_write_rfreg(padapter, path, offset, 0xffffffff, value); - - break; + + break; case GEN_MP_IOCTL_SUBCODE(TRIGGER_GPIO): DBG_871X("==> trigger gpio 0\n"); rtw_hal_set_hwreg(padapter, HW_VAR_TRIGGER_GPIO_0, NULL); - break; + break; #ifdef CONFIG_BT_COEXIST - case GEN_MP_IOCTL_SUBCODE(SET_DM_BT): + case GEN_MP_IOCTL_SUBCODE(SET_DM_BT): DBG_871X("==> set dm_bt_coexist:%x\n",*(u8 *)pdata); rtw_hal_set_hwreg(padapter, HW_VAR_BT_SET_COEXIST, pdata); break; @@ -3862,15 +3862,15 @@ static void rtw_dbg_mode_hdl(struct adapter *padapter, u32 id, u8 *pdata, u32 le break; #endif #ifdef DBG_CONFIG_ERROR_DETECT - case GEN_MP_IOCTL_SUBCODE(GET_WIFI_STATUS): - *pdata = rtw_hal_sreset_get_wifi_status(padapter); + case GEN_MP_IOCTL_SUBCODE(GET_WIFI_STATUS): + *pdata = rtw_hal_sreset_get_wifi_status(padapter); break; #endif - + default: break; } - + } static int rtw_mp_ioctl_hdl(struct net_device *dev, struct iw_request_info *info, @@ -3956,29 +3956,29 @@ static int rtw_get_ap_info(struct net_device *dev, u8 bssid[ETH_ALEN]; char data[32]; struct wlan_network *pnetwork = NULL; - struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); - struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); + struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); + struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); _queue *queue = &(pmlmepriv->scanned_queue); - struct iw_point *pdata = &wrqu->data; + struct iw_point *pdata = &wrqu->data; DBG_871X("+rtw_get_aplist_info\n"); if((padapter->bDriverStopped) || (pdata==NULL)) - { + { ret= -EINVAL; goto exit; - } - - while((check_fwstate(pmlmepriv, (_FW_UNDER_SURVEY|_FW_UNDER_LINKING))) == _TRUE) - { + } + + while((check_fwstate(pmlmepriv, (_FW_UNDER_SURVEY|_FW_UNDER_LINKING))) == _TRUE) + { rtw_msleep_os(30); cnt++; if(cnt > 100) break; } - - //pdata->length = 0;//? + + //pdata->length = 0;//? pdata->flags = 0; if(pdata->length>=32) { @@ -3987,18 +3987,18 @@ static int rtw_get_ap_info(struct net_device *dev, ret= -EINVAL; goto exit; } - } + } else { ret= -EINVAL; goto exit; - } + } _enter_critical_bh(&(pmlmepriv->scanned_queue.lock), &irqL); - + phead = get_list_head(queue); plist = get_next(phead); - + while(1) { if (rtw_end_of_queue_search(phead,plist)== _TRUE) @@ -4007,20 +4007,20 @@ static int rtw_get_ap_info(struct net_device *dev, pnetwork = LIST_CONTAINOR(plist, struct wlan_network, list); - //if(hwaddr_aton_i(pdata->pointer, bssid)) - if(hwaddr_aton_i(data, bssid)) - { + //if(hwaddr_aton_i(pdata->pointer, bssid)) + if(hwaddr_aton_i(data, bssid)) + { DBG_871X("Invalid BSSID '%s'.\n", (u8*)data); _exit_critical_bh(&(pmlmepriv->scanned_queue.lock), &irqL); return -EINVAL; - } - - + } + + if(_rtw_memcmp(bssid, pnetwork->network.MacAddress, ETH_ALEN) == _TRUE)//BSSID match, then check if supporting wpa/wpa2 { DBG_871X("BSSID:" MAC_FMT "\n", MAC_ARG(bssid)); - - pbuf = rtw_get_wpa_ie(&pnetwork->network.IEs[12], &wpa_ielen, pnetwork->network.IELength-12); + + pbuf = rtw_get_wpa_ie(&pnetwork->network.IEs[12], &wpa_ielen, pnetwork->network.IELength-12); if(pbuf && (wpa_ielen>0)) { pdata->flags = 1; @@ -4033,12 +4033,12 @@ static int rtw_get_ap_info(struct net_device *dev, pdata->flags = 2; break; } - + } - plist = get_next(plist); - - } + plist = get_next(plist); + + } _exit_critical_bh(&(pmlmepriv->scanned_queue.lock), &irqL); @@ -4049,30 +4049,30 @@ static int rtw_get_ap_info(struct net_device *dev, ret= -EINVAL; goto exit; } - } - + } + exit: - + return ret; - + } static int rtw_set_pid(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - - int ret = 0; - struct adapter *padapter = rtw_netdev_priv(dev); + + int ret = 0; + struct adapter *padapter = rtw_netdev_priv(dev); int *pdata = (int *)wrqu; int selector; if((padapter->bDriverStopped) || (pdata==NULL)) - { + { ret= -EINVAL; goto exit; - } - + } + selector = *pdata; if(selector < 3 && selector >=0) { padapter->pid[selector] = *(pdata+1); @@ -4085,18 +4085,18 @@ static int rtw_set_pid(struct net_device *dev, DBG_871X("%s selector %d error\n", __FUNCTION__, selector); exit: - + return ret; - + } static int rtw_wps_start(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - - int ret = 0; - struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); + + int ret = 0; + struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); struct iw_point *pdata = &wrqu->data; u32 u32wps_start = 0; unsigned int uintRet = 0; @@ -4104,10 +4104,10 @@ static int rtw_wps_start(struct net_device *dev, uintRet = copy_from_user( ( void* ) &u32wps_start, pdata->pointer, 4 ); if((padapter->bDriverStopped) || (pdata==NULL)) - { + { ret= -EINVAL; goto exit; - } + } if ( u32wps_start == 0 ) { @@ -4132,11 +4132,11 @@ static int rtw_wps_start(struct net_device *dev, #ifdef CONFIG_INTEL_WIDI process_intel_widi_wps_status(padapter, u32wps_start); #endif //CONFIG_INTEL_WIDI - + exit: - + return ret; - + } #ifdef CONFIG_P2P @@ -4144,10 +4144,10 @@ static int rtw_wext_p2p_enable(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - - int ret = 0; + + int ret = 0; struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); - struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); + struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); struct iw_point *pdata = &wrqu->data; struct wifidirect_info *pwdinfo= &(padapter->wdinfo); struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; @@ -4169,8 +4169,8 @@ static int rtw_wext_p2p_enable(struct net_device *dev, } //set channel/bandwidth - if(init_role != P2P_ROLE_DISABLE) - { + if(init_role != P2P_ROLE_DISABLE) + { u8 channel, ch_offset; u16 bwmode; @@ -4189,7 +4189,7 @@ static int rtw_wext_p2p_enable(struct net_device *dev, //struct wifidirect_info *pbuddy_wdinfo = &pbuddy_adapter->wdinfo; struct mlme_priv *pbuddy_mlmepriv = &pbuddy_adapter->mlmepriv; struct mlme_ext_priv *pbuddy_mlmeext = &pbuddy_adapter->mlmeextpriv; - + _set_timer( &pwdinfo->ap_p2p_switch_timer, pwdinfo->ext_listen_interval ); if ( check_fwstate( pbuddy_mlmepriv, _FW_LINKED ) ) { @@ -4209,10 +4209,10 @@ static int rtw_wext_p2p_enable(struct net_device *dev, else { pwdinfo->operating_channel = pmlmeext->cur_channel; - + channel = pwdinfo->operating_channel; ch_offset = pmlmeext->cur_ch_offset; - bwmode = pmlmeext->cur_bwmode; + bwmode = pmlmeext->cur_bwmode; } set_channel_bwmode(padapter, channel, ch_offset, bwmode); @@ -4220,26 +4220,26 @@ static int rtw_wext_p2p_enable(struct net_device *dev, exit: return ret; - + } static int rtw_p2p_set_go_nego_ssid(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - - int ret = 0; + + int ret = 0; struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); - struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); + struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); struct iw_point *pdata = &wrqu->data; struct wifidirect_info *pwdinfo= &(padapter->wdinfo); DBG_871X( "[%s] ssid = %s, len = %zu\n", __FUNCTION__, extra, strlen( extra ) ); _rtw_memcpy( pwdinfo->nego_ssid, extra, strlen( extra ) ); pwdinfo->nego_ssidlen = strlen( extra ); - + return ret; - + } @@ -4247,9 +4247,9 @@ static int rtw_p2p_set_intent(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - int ret = 0; - struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); - struct wifidirect_info *pwdinfo= &(padapter->wdinfo); + int ret = 0; + struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); + struct wifidirect_info *pwdinfo= &(padapter->wdinfo); u8 intent = pwdinfo->intent; extra[ wrqu->data.length ] = 0x00; @@ -4264,7 +4264,7 @@ static int rtw_p2p_set_intent(struct net_device *dev, { ret = -1; } - + DBG_871X( "[%s] intent = %d\n", __FUNCTION__, intent); return ret; @@ -4275,8 +4275,8 @@ static int rtw_p2p_set_listen_ch(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - - int ret = 0; + + int ret = 0; struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); struct wifidirect_info *pwdinfo= &(padapter->wdinfo); u8 listen_ch = pwdinfo->listen_channel; // Listen channel number @@ -4293,11 +4293,11 @@ static int rtw_p2p_set_listen_ch(struct net_device *dev, { ret = -1; } - + DBG_871X( "[%s] listen_ch = %d\n", __FUNCTION__, pwdinfo->listen_channel ); - + return ret; - + } static int rtw_p2p_set_op_ch(struct net_device *dev, @@ -4307,7 +4307,7 @@ static int rtw_p2p_set_op_ch(struct net_device *dev, // Commented by Albert 20110524 // This function is used to set the operating channel if the driver will become the group owner - int ret = 0; + int ret = 0; struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); struct wifidirect_info *pwdinfo= &(padapter->wdinfo); u8 op_ch = pwdinfo->operating_channel; // Operating channel number @@ -4323,9 +4323,9 @@ static int rtw_p2p_set_op_ch(struct net_device *dev, { ret = -1; } - + DBG_871X( "[%s] op_ch = %d\n", __FUNCTION__, pwdinfo->operating_channel ); - + return ret; } @@ -4335,8 +4335,8 @@ static int rtw_p2p_profilefound(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - - int ret = 0; + + int ret = 0; struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); struct wifidirect_info *pwdinfo= &(padapter->wdinfo); @@ -4352,7 +4352,7 @@ static int rtw_p2p_profilefound(struct net_device *dev, DBG_871X( "[%s] In value = %s, len = %d \n", __FUNCTION__, extra, wrqu->data.length -1); - + // The upper application should pass the SSID to driver by using this rtw_p2p_profilefound function. if(!rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) { @@ -4371,7 +4371,7 @@ static int rtw_p2p_profilefound(struct net_device *dev, else { int jj, kk; - + // Add this profile information into pwdinfo->profileinfo // Ex: 1XX:XX:XX:XX:XX:XXYYSSID for( jj = 0, kk = 1; jj < ETH_ALEN; jj++, kk += 3 ) @@ -4384,18 +4384,18 @@ static int rtw_p2p_profilefound(struct net_device *dev, pwdinfo->profileindex++; } } - } - + } + return ret; - + } static int rtw_p2p_setDN(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - - int ret = 0; + + int ret = 0; struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); struct wifidirect_info *pwdinfo= &(padapter->wdinfo); @@ -4406,7 +4406,7 @@ static int rtw_p2p_setDN(struct net_device *dev, pwdinfo->device_name_len = wrqu->data.length - 1; return ret; - + } @@ -4414,18 +4414,18 @@ static int rtw_p2p_get_status(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - - int ret = 0; - struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); + + int ret = 0; + struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); struct iw_point *pdata = &wrqu->data; struct wifidirect_info *pwdinfo = &( padapter->wdinfo ); #ifdef CONFIG_CONCURRENT_MODE struct adapter *pbuddy_adapter = padapter->pbuddy_adapter; struct wifidirect_info *pbuddy_wdinfo = &pbuddy_adapter->wdinfo; struct mlme_priv *pbuddy_mlmepriv = &pbuddy_adapter->mlmepriv; - struct mlme_ext_priv *pbuddy_mlmeext = &pbuddy_adapter->mlmeextpriv; + struct mlme_ext_priv *pbuddy_mlmeext = &pbuddy_adapter->mlmeextpriv; #endif - + if ( padapter->bShowGetP2PState ) { DBG_871X( "[%s] Role = %d, Status = %d, peer addr = %.2X:%.2X:%.2X:%.2X:%.2X:%.2X\n", __FUNCTION__, rtw_p2p_role(pwdinfo), rtw_p2p_state(pwdinfo), @@ -4440,11 +4440,11 @@ static int rtw_p2p_get_status(struct net_device *dev, wrqu->data.length = strlen( extra ); return ret; - + } // Commented by Albert 20110520 -// This function will return the config method description +// This function will return the config method description // This config method description will show us which config method the remote P2P device is intented to use // by sending the provisioning discovery request frame. @@ -4452,8 +4452,8 @@ static int rtw_p2p_get_req_cm(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - - int ret = 0; + + int ret = 0; struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); struct iw_point *pdata = &wrqu->data; struct wifidirect_info *pwdinfo = &( padapter->wdinfo ); @@ -4461,7 +4461,7 @@ static int rtw_p2p_get_req_cm(struct net_device *dev, sprintf( extra, "\n\nCM=%s\n", pwdinfo->rx_prov_disc_info.strconfig_method_desc_of_prov_disc_req ); wrqu->data.length = strlen( extra ); return ret; - + } @@ -4469,13 +4469,13 @@ static int rtw_p2p_get_role(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - - int ret = 0; - struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); + + int ret = 0; + struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); struct iw_point *pdata = &wrqu->data; struct wifidirect_info *pwdinfo = &( padapter->wdinfo ); - + DBG_871X( "[%s] Role = %d, Status = %d, peer addr = %.2X:%.2X:%.2X:%.2X:%.2X:%.2X\n", __FUNCTION__, rtw_p2p_role(pwdinfo), rtw_p2p_state(pwdinfo), pwdinfo->p2p_peer_interface_addr[ 0 ], pwdinfo->p2p_peer_interface_addr[ 1 ], pwdinfo->p2p_peer_interface_addr[ 2 ], pwdinfo->p2p_peer_interface_addr[ 3 ], pwdinfo->p2p_peer_interface_addr[ 4 ], pwdinfo->p2p_peer_interface_addr[ 5 ]); @@ -4483,7 +4483,7 @@ static int rtw_p2p_get_role(struct net_device *dev, sprintf( extra, "\n\nRole=%.2d\n", rtw_p2p_role(pwdinfo) ); wrqu->data.length = strlen( extra ); return ret; - + } @@ -4491,9 +4491,9 @@ static int rtw_p2p_get_peer_ifaddr(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - - int ret = 0; - struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); + + int ret = 0; + struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); struct iw_point *pdata = &wrqu->data; struct wifidirect_info *pwdinfo = &( padapter->wdinfo ); @@ -4507,7 +4507,7 @@ static int rtw_p2p_get_peer_ifaddr(struct net_device *dev, pwdinfo->p2p_peer_interface_addr[ 3 ], pwdinfo->p2p_peer_interface_addr[ 4 ], pwdinfo->p2p_peer_interface_addr[ 5 ]); wrqu->data.length = strlen( extra ); return ret; - + } static int rtw_p2p_get_peer_devaddr(struct net_device *dev, @@ -4515,23 +4515,23 @@ static int rtw_p2p_get_peer_devaddr(struct net_device *dev, union iwreq_data *wrqu, char *extra) { - - int ret = 0; - struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); + + int ret = 0; + struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); struct iw_point *pdata = &wrqu->data; struct wifidirect_info *pwdinfo = &( padapter->wdinfo ); DBG_871X( "[%s] Role = %d, Status = %d, peer addr = %.2X:%.2X:%.2X:%.2X:%.2X:%.2X\n", __FUNCTION__, rtw_p2p_role(pwdinfo), rtw_p2p_state(pwdinfo), - pwdinfo->rx_prov_disc_info.peerDevAddr[ 0 ], pwdinfo->rx_prov_disc_info.peerDevAddr[ 1 ], + pwdinfo->rx_prov_disc_info.peerDevAddr[ 0 ], pwdinfo->rx_prov_disc_info.peerDevAddr[ 1 ], pwdinfo->rx_prov_disc_info.peerDevAddr[ 2 ], pwdinfo->rx_prov_disc_info.peerDevAddr[ 3 ], pwdinfo->rx_prov_disc_info.peerDevAddr[ 4 ], pwdinfo->rx_prov_disc_info.peerDevAddr[ 5 ]); sprintf( extra, "\n%.2X%.2X%.2X%.2X%.2X%.2X", - pwdinfo->rx_prov_disc_info.peerDevAddr[ 0 ], pwdinfo->rx_prov_disc_info.peerDevAddr[ 1 ], + pwdinfo->rx_prov_disc_info.peerDevAddr[ 0 ], pwdinfo->rx_prov_disc_info.peerDevAddr[ 1 ], pwdinfo->rx_prov_disc_info.peerDevAddr[ 2 ], pwdinfo->rx_prov_disc_info.peerDevAddr[ 3 ], pwdinfo->rx_prov_disc_info.peerDevAddr[ 4 ], pwdinfo->rx_prov_disc_info.peerDevAddr[ 5 ]); - wrqu->data.length = strlen( extra ); + wrqu->data.length = strlen( extra ); return ret; - + } static int rtw_p2p_get_peer_devaddr_by_invitation(struct net_device *dev, @@ -4539,23 +4539,23 @@ static int rtw_p2p_get_peer_devaddr_by_invitation(struct net_device *dev, union iwreq_data *wrqu, char *extra) { - - int ret = 0; - struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); + + int ret = 0; + struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); struct iw_point *pdata = &wrqu->data; struct wifidirect_info *pwdinfo = &( padapter->wdinfo ); DBG_871X( "[%s] Role = %d, Status = %d, peer addr = %.2X:%.2X:%.2X:%.2X:%.2X:%.2X\n", __FUNCTION__, rtw_p2p_role(pwdinfo), rtw_p2p_state(pwdinfo), - pwdinfo->p2p_peer_device_addr[ 0 ], pwdinfo->p2p_peer_device_addr[ 1 ], + pwdinfo->p2p_peer_device_addr[ 0 ], pwdinfo->p2p_peer_device_addr[ 1 ], pwdinfo->p2p_peer_device_addr[ 2 ], pwdinfo->p2p_peer_device_addr[ 3 ], pwdinfo->p2p_peer_device_addr[ 4 ], pwdinfo->p2p_peer_device_addr[ 5 ]); sprintf( extra, "\nMAC %.2X:%.2X:%.2X:%.2X:%.2X:%.2X", - pwdinfo->p2p_peer_device_addr[ 0 ], pwdinfo->p2p_peer_device_addr[ 1 ], + pwdinfo->p2p_peer_device_addr[ 0 ], pwdinfo->p2p_peer_device_addr[ 1 ], pwdinfo->p2p_peer_device_addr[ 2 ], pwdinfo->p2p_peer_device_addr[ 3 ], pwdinfo->p2p_peer_device_addr[ 4 ], pwdinfo->p2p_peer_device_addr[ 5 ]); - wrqu->data.length = strlen( extra ); + wrqu->data.length = strlen( extra ); return ret; - + } static int rtw_p2p_get_groupid(struct net_device *dev, @@ -4563,20 +4563,20 @@ static int rtw_p2p_get_groupid(struct net_device *dev, union iwreq_data *wrqu, char *extra) { - - int ret = 0; - struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); + + int ret = 0; + struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); struct iw_point *pdata = &wrqu->data; struct wifidirect_info *pwdinfo = &( padapter->wdinfo ); sprintf( extra, "\n%.2X:%.2X:%.2X:%.2X:%.2X:%.2X %s", - pwdinfo->groupid_info.go_device_addr[ 0 ], pwdinfo->groupid_info.go_device_addr[ 1 ], + pwdinfo->groupid_info.go_device_addr[ 0 ], pwdinfo->groupid_info.go_device_addr[ 1 ], pwdinfo->groupid_info.go_device_addr[ 2 ], pwdinfo->groupid_info.go_device_addr[ 3 ], pwdinfo->groupid_info.go_device_addr[ 4 ], pwdinfo->groupid_info.go_device_addr[ 5 ], pwdinfo->groupid_info.ssid); - wrqu->data.length = strlen( extra ); + wrqu->data.length = strlen( extra ); return ret; - + } static int rtw_p2p_get_op_ch(struct net_device *dev, @@ -4584,19 +4584,19 @@ static int rtw_p2p_get_op_ch(struct net_device *dev, union iwreq_data *wrqu, char *extra) { - - int ret = 0; - struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); + + int ret = 0; + struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); struct iw_point *pdata = &wrqu->data; struct wifidirect_info *pwdinfo = &( padapter->wdinfo ); - + DBG_871X( "[%s] Op_ch = %02x\n", __FUNCTION__, pwdinfo->operating_channel); - + sprintf( extra, "\n\nOp_ch=%.2d\n", pwdinfo->operating_channel ); wrqu->data.length = strlen( extra ); return ret; - + } inline static void macstr2num(u8 *dst, u8 *src) @@ -4611,8 +4611,8 @@ inline static void macstr2num(u8 *dst, u8 *src) static int rtw_p2p_get_wps_configmethod(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra, char *subcmd) -{ - +{ + int ret = 0; struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); u8 peerMAC[ETH_ALEN] = { 0x00 }; @@ -4680,8 +4680,8 @@ static int rtw_p2p_get_wps_configmethod(struct net_device *dev, wrqu->data.length = strlen(attr_content_str); _rtw_memcpy(extra, attr_content_str, wrqu->data.length); - return ret; - + return ret; + } #ifdef CONFIG_WFD @@ -4689,9 +4689,9 @@ static int rtw_p2p_get_peer_wfd_port(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - - int ret = 0; - struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); + + int ret = 0; + struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); struct iw_point *pdata = &wrqu->data; struct wifidirect_info *pwdinfo = &( padapter->wdinfo ); @@ -4699,19 +4699,19 @@ static int rtw_p2p_get_peer_wfd_port(struct net_device *dev, sprintf( extra, "\n\nPort=%d\n", pwdinfo->wfd_info->peer_rtsp_ctrlport ); DBG_871X( "[%s] remote port = %d\n", __FUNCTION__, pwdinfo->wfd_info->peer_rtsp_ctrlport ); - + wrqu->data.length = strlen( extra ); return ret; - + } static int rtw_p2p_get_peer_wfd_preferred_connection(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - - int ret = 0; - struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); + + int ret = 0; + struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); struct iw_point *pdata = &wrqu->data; struct wifidirect_info *pwdinfo = &( padapter->wdinfo ); @@ -4721,16 +4721,16 @@ static int rtw_p2p_get_peer_wfd_preferred_connection(struct net_device *dev, wrqu->data.length = strlen( extra ); pwdinfo->wfd_info->wfd_pc = _FALSE; // Reset the WFD preferred connection to P2P return ret; - + } static int rtw_p2p_get_peer_wfd_session_available(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - - int ret = 0; - struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); + + int ret = 0; + struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); struct iw_point *pdata = &wrqu->data; struct wifidirect_info *pwdinfo = &( padapter->wdinfo ); @@ -4740,7 +4740,7 @@ static int rtw_p2p_get_peer_wfd_session_available(struct net_device *dev, wrqu->data.length = strlen( extra ); pwdinfo->wfd_info->peer_session_avail = _TRUE; // Reset the WFD session available return ret; - + } #endif // CONFIG_WFD @@ -4750,7 +4750,7 @@ static int rtw_p2p_get_go_device_address(struct net_device *dev, union iwreq_data *wrqu, char *extra, char *subcmd) { - int ret = 0; + int ret = 0; struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); u8 peerMAC[ETH_ALEN] = { 0x00 }; struct mlme_priv *pmlmepriv = &padapter->mlmepriv; @@ -4833,15 +4833,15 @@ static int rtw_p2p_get_go_device_address(struct net_device *dev, wrqu->data.length = strlen(go_devadd_str); _rtw_memcpy(extra, go_devadd_str, wrqu->data.length); - return ret; - + return ret; + } static int rtw_p2p_get_device_type(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra, char *subcmd) -{ - +{ + int ret = 0; struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); u8 peerMAC[ETH_ALEN] = { 0x00 }; @@ -4911,15 +4911,15 @@ static int rtw_p2p_get_device_type(struct net_device *dev, wrqu->data.length = strlen(dev_type_str); _rtw_memcpy(extra, dev_type_str, wrqu->data.length); - return ret; - + return ret; + } static int rtw_p2p_get_device_name(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra, char *subcmd) -{ - +{ + int ret = 0; struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); u8 peerMAC[ETH_ALEN] = { 0x00 }; @@ -4985,8 +4985,8 @@ static int rtw_p2p_get_device_name(struct net_device *dev, wrqu->data.length = strlen(dev_name_str); _rtw_memcpy(extra, dev_name_str, wrqu->data.length); - return ret; - + return ret; + } static int rtw_p2p_get_invitation_procedure(struct net_device *dev, @@ -4994,7 +4994,7 @@ static int rtw_p2p_get_invitation_procedure(struct net_device *dev, union iwreq_data *wrqu, char *extra, char *subcmd) { - int ret = 0; + int ret = 0; struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); u8 peerMAC[ETH_ALEN] = { 0x00 }; struct mlme_priv *pmlmepriv = &padapter->mlmepriv; @@ -5074,21 +5074,21 @@ static int rtw_p2p_get_invitation_procedure(struct net_device *dev, wrqu->data.length = strlen(inv_proc_str); _rtw_memcpy(extra, inv_proc_str, wrqu->data.length); - return ret; - + return ret; + } static int rtw_p2p_connect(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - - int ret = 0; - struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); + + int ret = 0; + struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); struct wifidirect_info *pwdinfo = &( padapter->wdinfo ); u8 peerMAC[ ETH_ALEN ] = { 0x00 }; - int jj,kk; - u8 peerMACStr[ ETH_ALEN * 2 ] = { 0x00 }; + int jj,kk; + u8 peerMACStr[ ETH_ALEN * 2 ] = { 0x00 }; struct mlme_priv *pmlmepriv = &padapter->mlmepriv; _irqL irqL; _list *plist, *phead; @@ -5099,7 +5099,7 @@ static int rtw_p2p_connect(struct net_device *dev, struct adapter *pbuddy_adapter = padapter->pbuddy_adapter; struct mlme_priv *pbuddy_mlmepriv = &pbuddy_adapter->mlmepriv; struct mlme_ext_priv *pbuddy_mlmeext = &pbuddy_adapter->mlmeextpriv; -#endif // CONFIG_CONCURRENT_MODE +#endif // CONFIG_CONCURRENT_MODE // Commented by Albert 20110304 // The input data contains two informations. @@ -5115,12 +5115,12 @@ static int rtw_p2p_connect(struct net_device *dev, DBG_871X( "[%s] WiFi Direct is disable!\n", __FUNCTION__ ); return ret; } - + if ( pwdinfo->ui_got_wps_info == P2P_NO_WPSINFO ) { return -1; } - + for( jj = 0, kk = 0; jj < ETH_ALEN; jj++, kk += 3 ) { peerMAC[ jj ] = key_2char2num( extra[kk], extra[kk+ 1] ); @@ -5130,7 +5130,7 @@ static int rtw_p2p_connect(struct net_device *dev, phead = get_list_head(queue); plist = get_next(phead); - + while(1) { if (rtw_end_of_queue_search(phead,plist)== _TRUE) @@ -5144,7 +5144,7 @@ static int rtw_p2p_connect(struct net_device *dev, } plist = get_next(plist); - + } _exit_critical_bh(&(pmlmepriv->scanned_queue.lock), &irqL); @@ -5160,7 +5160,7 @@ static int rtw_p2p_connect(struct net_device *dev, _rtw_memset( &pwdinfo->nego_req_info, 0x00, sizeof( struct tx_nego_req_info ) ); _rtw_memset( &pwdinfo->groupid_info, 0x00, sizeof( struct group_id_info ) ); - + pwdinfo->nego_req_info.peer_channel_num[ 0 ] = uintPeerChannel; _rtw_memcpy( pwdinfo->nego_req_info.peerDevAddr, pnetwork->network.MacAddress, ETH_ALEN ); pwdinfo->nego_req_info.benable = _TRUE; @@ -5180,7 +5180,7 @@ static int rtw_p2p_connect(struct net_device *dev, { // Have to enter the power saving with the AP set_channel_bwmode(padapter, pbuddy_mlmeext->cur_channel, pbuddy_mlmeext->cur_ch_offset, pbuddy_mlmeext->cur_bwmode); - + issue_nulldata(pbuddy_adapter, NULL, 1, 3, 500); } #endif // CONFIG_CONCURRENT_MODE @@ -5198,7 +5198,7 @@ static int rtw_p2p_connect(struct net_device *dev, } #else _set_timer( &pwdinfo->restore_p2p_state_timer, P2P_GO_NEGO_TIMEOUT ); -#endif // CONFIG_CONCURRENT_MODE +#endif // CONFIG_CONCURRENT_MODE } else @@ -5206,7 +5206,7 @@ static int rtw_p2p_connect(struct net_device *dev, DBG_871X( "[%s] Not Found in Scanning Queue~\n", __FUNCTION__ ); ret = -1; } -exit: +exit: return ret; } @@ -5214,20 +5214,20 @@ static int rtw_p2p_invite_req(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - - int ret = 0; - struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); - struct iw_point *pdata = &wrqu->data; + + int ret = 0; + struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); + struct iw_point *pdata = &wrqu->data; struct wifidirect_info *pwdinfo = &( padapter->wdinfo ); - int jj,kk; - u8 peerMACStr[ ETH_ALEN * 2 ] = { 0x00 }; + int jj,kk; + u8 peerMACStr[ ETH_ALEN * 2 ] = { 0x00 }; struct mlme_priv *pmlmepriv = &padapter->mlmepriv; _list *plist, *phead; _queue *queue = &(pmlmepriv->scanned_queue); struct wlan_network *pnetwork = NULL; uint uintPeerChannel = 0; u8 attr_content[50] = { 0x00 }, _status = 0; - u8 *p2pie; + u8 *p2pie; uint p2pielen = 0, attr_contentlen = 0; _irqL irqL; struct tx_invite_req_info* pinvite_req_info = &pwdinfo->invitereq_info; @@ -5240,10 +5240,10 @@ static int rtw_p2p_invite_req(struct net_device *dev, #ifdef CONFIG_WFD struct wifi_display_info* pwfd_info = pwdinfo->wfd_info; #endif // CONFIG_WFD - + // Commented by Albert 20120321 // The input data contains two informations. - // 1. First information is the P2P device address which you want to send to. + // 1. First information is the P2P device address which you want to send to. // 2. Second information is the group id which combines with GO's mac address, space and GO's ssid. // Command line sample: iwpriv wlan0 p2p_set invite="00:11:22:33:44:55 00:E0:4C:00:00:05 DIRECT-xy" // Format: 00:11:22:33:44:55 00:E0:4C:00:00:05 DIRECT-xy @@ -5272,7 +5272,7 @@ static int rtw_p2p_invite_req(struct net_device *dev, _rtw_memset( pinvite_req_info->peer_macaddr, 0x00, ETH_ALEN ); pinvite_req_info->token = 3; } - + for( jj = 0, kk = 0; jj < ETH_ALEN; jj++, kk += 3 ) { pinvite_req_info->peer_macaddr[ jj ] = key_2char2num( extra[kk], extra[kk+ 1] ); @@ -5282,7 +5282,7 @@ static int rtw_p2p_invite_req(struct net_device *dev, phead = get_list_head(queue); plist = get_next(phead); - + while(1) { if (rtw_end_of_queue_search(phead,plist)== _TRUE) @@ -5315,13 +5315,13 @@ static int rtw_p2p_invite_req(struct net_device *dev, { uintPeerChannel = pnetwork->network.Configuration.DSConfig; break; - } + } } } plist = get_next(plist); - + } _exit_critical_bh(&(pmlmepriv->scanned_queue.lock), &irqL); @@ -5331,7 +5331,7 @@ static int rtw_p2p_invite_req(struct net_device *dev, { u8 wfd_ie[ 128 ] = { 0x00 }; uint wfd_ielen = 0; - + if ( rtw_get_wfd_ie_from_scan_queue( &pnetwork->network.IEs[0], pnetwork->network.IELength, wfd_ie, &wfd_ielen, pnetwork->network.Reserved[0]) ) { u8 wfd_devinfo[ 6 ] = { 0x00 }; @@ -5341,7 +5341,7 @@ static int rtw_p2p_invite_req(struct net_device *dev, if ( rtw_get_wfd_attr_content( wfd_ie, wfd_ielen, WFD_ATTR_DEVICE_INFO, wfd_devinfo, &wfd_devlen ) ) { u16 wfd_devinfo_field = 0; - + // Commented by Albert 20120319 // The first two bytes are the WFD device information field of WFD device information subelement. // In big endian format. @@ -5356,7 +5356,7 @@ static int rtw_p2p_invite_req(struct net_device *dev, } } } - + if ( _FALSE == pwfd_info->peer_session_avail ) { DBG_871X( "[%s] WFD Session not avaiable!\n", __FUNCTION__ ); @@ -5394,7 +5394,7 @@ static int rtw_p2p_invite_req(struct net_device *dev, { // Have to enter the power saving with the AP set_channel_bwmode(padapter, pbuddy_mlmeext->cur_channel, pbuddy_mlmeext->cur_ch_offset, pbuddy_mlmeext->cur_bwmode); - + issue_nulldata(pbuddy_adapter, NULL, 1, 3, 500); } else @@ -5406,7 +5406,7 @@ static int rtw_p2p_invite_req(struct net_device *dev, #endif _set_timer( &pwdinfo->pre_tx_scan_timer, P2P_TX_PRESCAN_TIMEOUT ); - + #ifdef CONFIG_CONCURRENT_MODE if ( check_fwstate( pbuddy_mlmepriv, _FW_LINKED ) ) { @@ -5418,38 +5418,38 @@ static int rtw_p2p_invite_req(struct net_device *dev, } #else _set_timer( &pwdinfo->restore_p2p_state_timer, P2P_INVITE_TIMEOUT ); -#endif // CONFIG_CONCURRENT_MODE +#endif // CONFIG_CONCURRENT_MODE + - } else { DBG_871X( "[%s] NOT Found in the Scanning Queue!\n", __FUNCTION__ ); } exit: - + return ret; - + } static int rtw_p2p_set_persistent(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - - int ret = 0; - struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); - struct iw_point *pdata = &wrqu->data; + + int ret = 0; + struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); + struct iw_point *pdata = &wrqu->data; struct wifidirect_info *pwdinfo = &( padapter->wdinfo ); - int jj,kk; - u8 peerMACStr[ ETH_ALEN * 2 ] = { 0x00 }; + int jj,kk; + u8 peerMACStr[ ETH_ALEN * 2 ] = { 0x00 }; struct mlme_priv *pmlmepriv = &padapter->mlmepriv; _list *plist, *phead; _queue *queue = &(pmlmepriv->scanned_queue); struct wlan_network *pnetwork = NULL; uint uintPeerChannel = 0; u8 attr_content[50] = { 0x00 }, _status = 0; - u8 *p2pie; + u8 *p2pie; uint p2pielen = 0, attr_contentlen = 0; _irqL irqL; struct tx_invite_req_info* pinvite_req_info = &pwdinfo->invitereq_info; @@ -5462,12 +5462,12 @@ static int rtw_p2p_set_persistent(struct net_device *dev, #ifdef CONFIG_WFD struct wifi_display_info* pwfd_info = pwdinfo->wfd_info; #endif // CONFIG_WFD - + // Commented by Albert 20120328 // The input data is 0 or 1 // 0: disable persistent group functionality // 1: enable persistent group founctionality - + DBG_871X( "[%s] data = %s\n", __FUNCTION__, extra ); if(rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) @@ -5491,11 +5491,11 @@ static int rtw_p2p_set_persistent(struct net_device *dev, } } printk( "[%s] persistent_supported = %d\n", __FUNCTION__, pwdinfo->persistent_supported ); - + exit: - + return ret; - + } static int hexstr2bin(const char *hex, u8 *buf, size_t len) @@ -5560,7 +5560,7 @@ static int rtw_p2p_set_wps_uuid(struct net_device *dev, DBG_871X("[%s] data = %s\n", __FUNCTION__, extra); - if ((36 == strlen(extra)) && (uuid_str2bin(extra, pwdinfo->uuid) == 0)) + if ((36 == strlen(extra)) && (uuid_str2bin(extra, pwdinfo->uuid) == 0)) { pwdinfo->external_uuid = 1; } else { @@ -5576,14 +5576,14 @@ static int rtw_p2p_set_pc(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - - int ret = 0; - struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); - struct iw_point *pdata = &wrqu->data; + + int ret = 0; + struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); + struct iw_point *pdata = &wrqu->data; struct wifidirect_info *pwdinfo = &( padapter->wdinfo ); u8 peerMAC[ ETH_ALEN ] = { 0x00 }; - int jj,kk; - u8 peerMACStr[ ETH_ALEN * 2 ] = { 0x00 }; + int jj,kk; + u8 peerMACStr[ ETH_ALEN * 2 ] = { 0x00 }; struct mlme_priv *pmlmepriv = &padapter->mlmepriv; _list *plist, *phead; _queue *queue = &(pmlmepriv->scanned_queue); @@ -5596,9 +5596,9 @@ static int rtw_p2p_set_pc(struct net_device *dev, #ifdef CONFIG_CONCURRENT_MODE struct adapter *pbuddy_adapter = padapter->pbuddy_adapter; struct mlme_ext_priv *pbuddy_mlmeext = &pbuddy_adapter->mlmeextpriv; -#endif // CONFIG_CONCURRENT_MODE +#endif // CONFIG_CONCURRENT_MODE struct wifi_display_info* pwfd_info = pwdinfo->wfd_info; - + // Commented by Albert 20120512 // 1. Input information is the MAC address which wants to know the Preferred Connection bit (PC bit) // Format: 00:E0:4C:00:00:05 @@ -5610,7 +5610,7 @@ static int rtw_p2p_set_pc(struct net_device *dev, DBG_871X( "[%s] WiFi Direct is disable!\n", __FUNCTION__ ); return ret; } - + for( jj = 0, kk = 0; jj < ETH_ALEN; jj++, kk += 3 ) { peerMAC[ jj ] = key_2char2num( extra[kk], extra[kk+ 1] ); @@ -5620,7 +5620,7 @@ static int rtw_p2p_set_pc(struct net_device *dev, phead = get_list_head(queue); plist = get_next(phead); - + while(1) { if (rtw_end_of_queue_search(phead,plist)== _TRUE) @@ -5655,13 +5655,13 @@ static int rtw_p2p_set_pc(struct net_device *dev, { uintPeerChannel = pnetwork->network.Configuration.DSConfig; break; - } + } } } plist = get_next(plist); - + } _exit_critical_bh(&(pmlmepriv->scanned_queue.lock), &irqL); @@ -5671,7 +5671,7 @@ static int rtw_p2p_set_pc(struct net_device *dev, { u8 wfd_ie[ 128 ] = { 0x00 }; uint wfd_ielen = 0; - + if ( rtw_get_wfd_ie_from_scan_queue( &pnetwork->network.IEs[0], pnetwork->network.IELength, wfd_ie, &wfd_ielen, pnetwork->network.Reserved[0]) ) { u8 wfd_devinfo[ 6 ] = { 0x00 }; @@ -5681,7 +5681,7 @@ static int rtw_p2p_set_pc(struct net_device *dev, if ( rtw_get_wfd_attr_content( wfd_ie, wfd_ielen, WFD_ATTR_DEVICE_INFO, wfd_devinfo, &wfd_devlen ) ) { u16 wfd_devinfo_field = 0; - + // Commented by Albert 20120319 // The first two bytes are the WFD device information field of WFD device information subelement. // In big endian format. @@ -5696,34 +5696,34 @@ static int rtw_p2p_set_pc(struct net_device *dev, } } } - } + } else { DBG_871X( "[%s] NOT Found in the Scanning Queue!\n", __FUNCTION__ ); } exit: - + return ret; - + } static int rtw_p2p_set_wfd_device_type(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - - int ret = 0; - struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); - struct iw_point *pdata = &wrqu->data; + + int ret = 0; + struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); + struct iw_point *pdata = &wrqu->data; struct wifidirect_info *pwdinfo = &( padapter->wdinfo ); struct wifi_display_info* pwfd_info = pwdinfo->wfd_info; - + // Commented by Albert 20120328 // The input data is 0 or 1 // 0: specify to Miracast source device // 1 or others: specify to Miracast sink device (display device) - + DBG_871X( "[%s] data = %s\n", __FUNCTION__, extra ); if ( extra[ 0 ] == '0' ) // Set to Miracast source device. @@ -5736,22 +5736,22 @@ static int rtw_p2p_set_wfd_device_type(struct net_device *dev, } exit: - + return ret; - + } static int rtw_p2p_set_scan_result_type(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - - int ret = 0; - struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); - struct iw_point *pdata = &wrqu->data; + + int ret = 0; + struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); + struct iw_point *pdata = &wrqu->data; struct wifidirect_info *pwdinfo = &( padapter->wdinfo ); struct wifi_display_info *pwfd_info = pwdinfo->wfd_info; - + // Commented by Albert 20120328 // The input data is 0 , 1 , 2 // 0: when the P2P is enabled, the scan result will return all the found P2P device. @@ -5759,7 +5759,7 @@ static int rtw_p2p_set_scan_result_type(struct net_device *dev, // 2: when the P2P is enabled, the scan result will show up the found Miracast devices base on... // It will show up all the Miracast source device if this device is sink. // It will show up all the Miracast sink device if this device is source. - + DBG_871X( "[%s] data = %s\n", __FUNCTION__, extra ); if ( extra[ 0 ] == '0' ) @@ -5778,11 +5778,11 @@ static int rtw_p2p_set_scan_result_type(struct net_device *dev, { pwfd_info->scan_result_type = SCAN_RESULT_P2P_ONLY; } - + exit: - + return ret; - + } static int rtw_p2p_set_wfd_enable(struct net_device *dev, @@ -5792,7 +5792,7 @@ static int rtw_p2p_set_wfd_enable(struct net_device *dev, // Commented by Kurt 20121206 // This function is used to set wfd enabled - int ret = 0; + int ret = 0; struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); struct wifidirect_info *pwdinfo= &(padapter->wdinfo); @@ -5802,9 +5802,9 @@ static int rtw_p2p_set_wfd_enable(struct net_device *dev, pwdinfo->wfd_info->wfd_enable = _TRUE; DBG_871X( "[%s] wfd_enable = %d\n", __FUNCTION__, pwdinfo->wfd_info->wfd_enable ); - + return ret; - + } static int rtw_p2p_set_driver_iface(struct net_device *dev, @@ -5813,7 +5813,7 @@ static int rtw_p2p_set_driver_iface(struct net_device *dev, { // Commented by Kurt 20121206 // This function is used to set driver iface is WEXT or CFG80211 - int ret = 0; + int ret = 0; struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); struct wifidirect_info *pwdinfo= &(padapter->wdinfo); @@ -5827,9 +5827,9 @@ static int rtw_p2p_set_driver_iface(struct net_device *dev, pwdinfo->driver_interface = DRIVER_CFG80211; DBG_871X( "[%s] driver_interface = CFG80211\n", __FUNCTION__); } - + return ret; - + } // To set the WFD session available to enable or disable @@ -5837,13 +5837,13 @@ static int rtw_p2p_set_sa(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - - int ret = 0; - struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); - struct iw_point *pdata = &wrqu->data; + + int ret = 0; + struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); + struct iw_point *pdata = &wrqu->data; struct wifidirect_info *pwdinfo = &( padapter->wdinfo ); struct wifi_display_info *pwfd_info = pwdinfo->wfd_info; - + DBG_871X( "[%s] data = %s\n", __FUNCTION__, extra ); if( 0 ) @@ -5867,11 +5867,11 @@ static int rtw_p2p_set_sa(struct net_device *dev, } } printk( "[%s] session available = %d\n", __FUNCTION__, pwdinfo->session_available ); - + exit: - + return ret; - + } #endif // CONFIG_WFD @@ -5879,12 +5879,12 @@ static int rtw_p2p_prov_disc(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - int ret = 0; - struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); + int ret = 0; + struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); struct wifidirect_info *pwdinfo = &( padapter->wdinfo ); u8 peerMAC[ ETH_ALEN ] = { 0x00 }; - int jj,kk; - u8 peerMACStr[ ETH_ALEN * 2 ] = { 0x00 }; + int jj,kk; + u8 peerMACStr[ ETH_ALEN * 2 ] = { 0x00 }; struct mlme_priv *pmlmepriv = &padapter->mlmepriv; _list *plist, *phead; _queue *queue = &(pmlmepriv->scanned_queue); @@ -5894,13 +5894,13 @@ static int rtw_p2p_prov_disc(struct net_device *dev, u8 *p2pie; uint p2pielen = 0, attr_contentlen = 0; _irqL irqL; - u8 ie_offset; + u8 ie_offset; #ifdef CONFIG_CONCURRENT_MODE struct adapter *pbuddy_adapter = padapter->pbuddy_adapter; struct mlme_priv *pbuddy_mlmepriv = &pbuddy_adapter->mlmepriv; struct mlme_ext_priv *pbuddy_mlmeext = &pbuddy_adapter->mlmeextpriv; -#endif // CONFIG_CONCURRENT_MODE - +#endif // CONFIG_CONCURRENT_MODE + #ifdef CONFIG_WFD struct wifi_display_info* pwfd_info = pwdinfo->wfd_info; #endif // CONFIG_WFD @@ -5933,12 +5933,12 @@ static int rtw_p2p_prov_disc(struct net_device *dev, // Reset the content of struct tx_provdisc_req_info excluded the wps_config_method_request. _rtw_memset( pwdinfo->tx_prov_disc_info.peerDevAddr, 0x00, ETH_ALEN ); _rtw_memset( pwdinfo->tx_prov_disc_info.peerIFAddr, 0x00, ETH_ALEN ); - _rtw_memset( &pwdinfo->tx_prov_disc_info.ssid, 0x00, sizeof( NDIS_802_11_SSID ) ); + _rtw_memset( &pwdinfo->tx_prov_disc_info.ssid, 0x00, sizeof( NDIS_802_11_SSID ) ); pwdinfo->tx_prov_disc_info.peer_channel_num[ 0 ] = 0; pwdinfo->tx_prov_disc_info.peer_channel_num[ 1 ] = 0; pwdinfo->tx_prov_disc_info.benable = _FALSE; } - + for( jj = 0, kk = 0; jj < ETH_ALEN; jj++, kk += 3 ) { peerMAC[ jj ] = key_2char2num( extra[kk], extra[kk+ 1] ); @@ -5970,7 +5970,7 @@ static int rtw_p2p_prov_disc(struct net_device *dev, phead = get_list_head(queue); plist = get_next(phead); - + while(1) { if (rtw_end_of_queue_search(phead,plist)== _TRUE) @@ -6013,7 +6013,7 @@ static int rtw_p2p_prov_disc(struct net_device *dev, { uintPeerChannel = pnetwork->network.Configuration.DSConfig; break; - } + } } //Get the next P2P IE @@ -6022,9 +6022,9 @@ static int rtw_p2p_prov_disc(struct net_device *dev, } #ifdef CONFIG_INTEL_WIDI - // Some Intel WiDi source may not provide P2P IE, + // Some Intel WiDi source may not provide P2P IE, // so we could only compare mac addr by 802.11 Source Address - if( pmlmepriv->widi_state == INTEL_WIDI_STATE_WFD_CONNECTION + if( pmlmepriv->widi_state == INTEL_WIDI_STATE_WFD_CONNECTION && uintPeerChannel == 0 ) { if ( _rtw_memcmp( pnetwork->network.MacAddress, peerMAC, ETH_ALEN ) ) @@ -6036,7 +6036,7 @@ static int rtw_p2p_prov_disc(struct net_device *dev, #endif //CONFIG_INTEL_WIDI plist = get_next(plist); - + } _exit_critical_bh(&(pmlmepriv->scanned_queue.lock), &irqL); @@ -6047,7 +6047,7 @@ static int rtw_p2p_prov_disc(struct net_device *dev, { u8 wfd_ie[ 128 ] = { 0x00 }; uint wfd_ielen = 0; - + if ( rtw_get_wfd_ie_from_scan_queue( &pnetwork->network.IEs[0], pnetwork->network.IELength, wfd_ie, &wfd_ielen, pnetwork->network.Reserved[0]) ) { u8 wfd_devinfo[ 6 ] = { 0x00 }; @@ -6057,7 +6057,7 @@ static int rtw_p2p_prov_disc(struct net_device *dev, if ( rtw_get_wfd_attr_content( wfd_ie, wfd_ielen, WFD_ATTR_DEVICE_INFO, wfd_devinfo, &wfd_devlen ) ) { u16 wfd_devinfo_field = 0; - + // Commented by Albert 20120319 // The first two bytes are the WFD device information field of WFD device information subelement. // In big endian format. @@ -6072,7 +6072,7 @@ static int rtw_p2p_prov_disc(struct net_device *dev, } } } - + if ( _FALSE == pwfd_info->peer_session_avail ) { DBG_871X( "[%s] WFD Session not avaiable!\n", __FUNCTION__ ); @@ -6110,7 +6110,7 @@ static int rtw_p2p_prov_disc(struct net_device *dev, { // Have to enter the power saving with the AP set_channel_bwmode(padapter, pbuddy_mlmeext->cur_channel, pbuddy_mlmeext->cur_ch_offset, pbuddy_mlmeext->cur_bwmode); - + issue_nulldata(pbuddy_adapter, NULL, 1, 3, 500); } else @@ -6122,7 +6122,7 @@ static int rtw_p2p_prov_disc(struct net_device *dev, #endif _set_timer( &pwdinfo->pre_tx_scan_timer, P2P_TX_PRESCAN_TIMEOUT ); - + #ifdef CONFIG_CONCURRENT_MODE if ( check_fwstate( pbuddy_mlmepriv, _FW_LINKED ) ) { @@ -6134,8 +6134,8 @@ static int rtw_p2p_prov_disc(struct net_device *dev, } #else _set_timer( &pwdinfo->restore_p2p_state_timer, P2P_PROVISION_TIMEOUT ); -#endif // CONFIG_CONCURRENT_MODE - +#endif // CONFIG_CONCURRENT_MODE + } else { @@ -6143,16 +6143,16 @@ static int rtw_p2p_prov_disc(struct net_device *dev, #ifdef CONFIG_INTEL_WIDI rtw_p2p_set_state(pwdinfo, P2P_STATE_FIND_PHASE_SEARCH); rtw_p2p_findphase_ex_set(pwdinfo, P2P_FINDPHASE_EX_NONE); - rtw_free_network_queue(padapter, _TRUE); - _enter_critical_bh(&pmlmepriv->lock, &irqL); + rtw_free_network_queue(padapter, _TRUE); + _enter_critical_bh(&pmlmepriv->lock, &irqL); rtw_sitesurvey_cmd(padapter, NULL, 0, NULL, 0); _exit_critical_bh(&pmlmepriv->lock, &irqL); #endif //CONFIG_INTEL_WIDI } exit: - + return ret; - + } // Added by Albert 20110328 @@ -6163,11 +6163,11 @@ static int rtw_p2p_got_wpsinfo(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - - int ret = 0; - struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); + + int ret = 0; + struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); struct wifidirect_info *pwdinfo = &( padapter->wdinfo ); - + DBG_871X( "[%s] data = %s\n", __FUNCTION__, extra ); // Added by Albert 20110328 @@ -6175,7 +6175,7 @@ static int rtw_p2p_got_wpsinfo(struct net_device *dev, // if the input data is P2P_GOT_WPSINFO_PEER_DISPLAY_PIN -> the utility just input the PIN code got from the peer P2P device. // if the input data is P2P_GOT_WPSINFO_SELF_DISPLAY_PIN -> the utility just got the PIN code from itself. // if the input data is P2P_GOT_WPSINFO_PBC -> the utility just determine to use the PBC - + if ( *extra == '0' ) { pwdinfo->ui_got_wps_info = P2P_NO_WPSINFO; @@ -6196,9 +6196,9 @@ static int rtw_p2p_got_wpsinfo(struct net_device *dev, { pwdinfo->ui_got_wps_info = P2P_NO_WPSINFO; } - + return ret; - + } #endif //CONFIG_P2P @@ -6207,12 +6207,12 @@ static int rtw_p2p_set(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - + int ret = 0; #ifdef CONFIG_P2P struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); - struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); + struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); struct iw_point *pdata = &wrqu->data; struct wifidirect_info *pwdinfo= &(padapter->wdinfo); struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; @@ -6265,7 +6265,7 @@ static int rtw_p2p_set(struct net_device *dev, { // Commented by Albert 2011/05/24 // The wrqu->data.length will include the null character - // So, we will decrease (10 + 1) + // So, we will decrease (10 + 1) wrqu->data.length -= 11; rtw_p2p_set_listen_ch( dev, info, wrqu, &extra[10] ); } @@ -6273,7 +6273,7 @@ static int rtw_p2p_set(struct net_device *dev, { // Commented by Albert 2011/05/24 // The wrqu->data.length will include the null character - // So, we will decrease (6 + 1) + // So, we will decrease (6 + 1) wrqu->data.length -= 7; rtw_p2p_set_op_ch( dev, info, wrqu, &extra[6] ); } @@ -6330,20 +6330,20 @@ static int rtw_p2p_set(struct net_device *dev, #endif //CONFIG_P2P return ret; - + } static int rtw_p2p_get(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - - int ret = 0; - + + int ret = 0; + #ifdef CONFIG_P2P struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); - struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); + struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); struct iw_point *pdata = &wrqu->data; struct wifidirect_info *pwdinfo= &(padapter->wdinfo); struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; @@ -6352,7 +6352,7 @@ static int rtw_p2p_get(struct net_device *dev, { DBG_871X( "[%s] extra = %s\n", __FUNCTION__, (char*) wrqu->data.pointer ); } - + if ( _rtw_memcmp( wrqu->data.pointer, "status", 6 ) ) { rtw_p2p_get_status( dev, info, wrqu, extra ); @@ -6400,12 +6400,12 @@ static int rtw_p2p_get(struct net_device *dev, { rtw_p2p_get_peer_wfd_preferred_connection( dev, info, wrqu, extra ); } -#endif // CONFIG_WFD - +#endif // CONFIG_WFD + #endif //CONFIG_P2P return ret; - + } static int rtw_p2p_get2(struct net_device *dev, @@ -6502,14 +6502,14 @@ static int rtw_rereg_nd_name(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - int ret = 0; + int ret = 0; struct adapter *padapter = rtw_netdev_priv(dev); struct rereg_nd_name_data *rereg_priv = &padapter->rereg_nd_name_priv; char new_ifname[IFNAMSIZ]; if(rereg_priv->old_ifname[0] == 0) { char *reg_ifname; -#ifdef CONFIG_CONCURRENT_MODE +#ifdef CONFIG_CONCURRENT_MODE if (padapter->isprimary) reg_ifname = padapter->registrypriv.ifname; else @@ -6545,13 +6545,13 @@ static int rtw_rereg_nd_name(struct net_device *dev, strncpy(rereg_priv->old_ifname, new_ifname, IFNAMSIZ); rereg_priv->old_ifname[IFNAMSIZ-1] = 0; - + if(_rtw_memcmp(new_ifname, "disable%d", 9) == _TRUE) { DBG_871X("%s disable\n", __FUNCTION__); // free network queue for Android's timming issue rtw_free_network_queue(padapter, _TRUE); - + // close led rtw_led_control(padapter, LED_CTL_POWER_OFF); rereg_priv->old_bRegUseLed = padapter->ledpriv.bRegUseLed; @@ -6572,48 +6572,48 @@ exit: #if 0 void mac_reg_dump(struct adapter *padapter) { - int i,j=1; + int i,j=1; DBG_871X("\n======= MAC REG =======\n"); for(i=0x0;i<0x300;i+=4) - { + { if(j%4==1) DBG_871X("0x%02x",i); - DBG_871X(" 0x%08x ",rtw_read32(padapter,i)); - if((j++)%4 == 0) DBG_871X("\n"); + DBG_871X(" 0x%08x ",rtw_read32(padapter,i)); + if((j++)%4 == 0) DBG_871X("\n"); } for(i=0x400;i<0x800;i+=4) - { + { if(j%4==1) DBG_871X("0x%02x",i); - DBG_871X(" 0x%08x ",rtw_read32(padapter,i)); - if((j++)%4 == 0) DBG_871X("\n"); - } + DBG_871X(" 0x%08x ",rtw_read32(padapter,i)); + if((j++)%4 == 0) DBG_871X("\n"); + } } void bb_reg_dump(struct adapter *padapter) { - int i,j=1; + int i,j=1; DBG_871X("\n======= BB REG =======\n"); for(i=0x800;i<0x1000;i+=4) { if(j%4==1) DBG_871X("0x%02x",i); - - DBG_871X(" 0x%08x ",rtw_read32(padapter,i)); - if((j++)%4 == 0) DBG_871X("\n"); - } + + DBG_871X(" 0x%08x ",rtw_read32(padapter,i)); + if((j++)%4 == 0) DBG_871X("\n"); + } } void rf_reg_dump(struct adapter *padapter) -{ +{ int i,j=1,path; - u32 value; + u32 value; DBG_871X("\n======= RF REG =======\n"); for(path=0;path<2;path++) { DBG_871X("\nRF_Path(%x)\n",path); for(i=0;i<0x100;i++) - { + { value = PHY_QueryRFReg(padapter, (RF_RADIO_PATH_E)path,i, bMaskDWord); if(j%4==1) DBG_871X("0x%02x ",i); DBG_871X(" 0x%08x ",value); - if((j++)%4==0) DBG_871X("\n"); - } + if((j++)%4==0) DBG_871X("\n"); + } } } @@ -6621,57 +6621,57 @@ void rf_reg_dump(struct adapter *padapter) static void mac_reg_dump(struct adapter *padapter) { - int i,j=1; + int i,j=1; printk("\n======= MAC REG =======\n"); for(i=0x0;i<0x300;i+=4) - { + { if(j%4==1) printk("0x%02x",i); - printk(" 0x%08x ",rtw_read32(padapter,i)); - if((j++)%4 == 0) printk("\n"); + printk(" 0x%08x ",rtw_read32(padapter,i)); + if((j++)%4 == 0) printk("\n"); } for(i=0x400;i<0x800;i+=4) - { + { if(j%4==1) printk("0x%02x",i); - printk(" 0x%08x ",rtw_read32(padapter,i)); - if((j++)%4 == 0) printk("\n"); - } + printk(" 0x%08x ",rtw_read32(padapter,i)); + if((j++)%4 == 0) printk("\n"); + } } void bb_reg_dump(struct adapter *padapter) { - int i,j=1; + int i,j=1; printk("\n======= BB REG =======\n"); for(i=0x800;i<0x1000;i+=4) { if(j%4==1) printk("0x%02x",i); - - printk(" 0x%08x ",rtw_read32(padapter,i)); - if((j++)%4 == 0) printk("\n"); - } + + printk(" 0x%08x ",rtw_read32(padapter,i)); + if((j++)%4 == 0) printk("\n"); + } } void rf_reg_dump(struct adapter *padapter) -{ +{ int i,j=1,path; - u32 value; + u32 value; u8 rf_type,path_nums = 0; rtw_hal_get_hwreg(padapter, HW_VAR_RF_TYPE, (u8 *)(&rf_type)); - + printk("\n======= RF REG =======\n"); - if((RF_1T2R == rf_type) ||(RF_1T1R ==rf_type )) + if((RF_1T2R == rf_type) ||(RF_1T1R ==rf_type )) path_nums = 1; - else + else path_nums = 2; - + for(path=0;pathmlmepriv); struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; @@ -6695,9 +6695,9 @@ static int rtw_dbg_port(struct net_device *dev, struct security_priv *psecuritypriv = &padapter->securitypriv; struct wlan_network *cur_network = &(pmlmepriv->cur_network); struct sta_priv *pstapriv = &padapter->stapriv; - - pdata = (u32*)&wrqu->data; + + pdata = (u32*)&wrqu->data; val32 = *pdata; arg = (u16)(val32&0x0000ffff); @@ -6705,7 +6705,7 @@ static int rtw_dbg_port(struct net_device *dev, minor_cmd = (u8)((val32>>16)&0x00ff); extra_arg = *(pdata+1); - + switch(major_cmd) { case 0x70://read_reg @@ -6720,7 +6720,7 @@ static int rtw_dbg_port(struct net_device *dev, case 4: DBG_871X("rtw_read32(0x%x)=0x%08x\n", arg, rtw_read32(padapter, arg)); break; - } + } break; case 0x71://write_reg switch(minor_cmd) @@ -6737,7 +6737,7 @@ static int rtw_dbg_port(struct net_device *dev, rtw_write32(padapter, arg, extra_arg); DBG_871X("rtw_write32(0x%x)=0x%08x\n", arg, rtw_read32(padapter, arg)); break; - } + } break; case 0x72://read_bb DBG_871X("read_bbreg(0x%x)=0x%x\n", arg, rtw_hal_read_bbreg(padapter, arg, 0xffffffff)); @@ -6747,17 +6747,17 @@ static int rtw_dbg_port(struct net_device *dev, DBG_871X("write_bbreg(0x%x)=0x%x\n", arg, rtw_hal_read_bbreg(padapter, arg, 0xffffffff)); break; case 0x74://read_rf - DBG_871X("read RF_reg path(0x%02x),offset(0x%x),value(0x%08x)\n",minor_cmd,arg,rtw_hal_read_rfreg(padapter, minor_cmd, arg, 0xffffffff)); + DBG_871X("read RF_reg path(0x%02x),offset(0x%x),value(0x%08x)\n",minor_cmd,arg,rtw_hal_read_rfreg(padapter, minor_cmd, arg, 0xffffffff)); break; case 0x75://write_rf rtw_hal_write_rfreg(padapter, minor_cmd, arg, 0xffffffff, extra_arg); DBG_871X("write RF_reg path(0x%02x),offset(0x%x),value(0x%08x)\n",minor_cmd,arg, rtw_hal_read_rfreg(padapter, minor_cmd, arg, 0xffffffff)); - break; + break; case 0x76: switch(minor_cmd) { - case 0x00: //normal mode, + case 0x00: //normal mode, padapter->recvpriv.is_signal_dbg = 0; break; case 0x01: //dbg mode @@ -6779,10 +6779,10 @@ static int rtw_dbg_port(struct net_device *dev, struct xmit_frame *xmit_frame; if((xmit_frame=rtw_IOL_accquire_xmit_frame(padapter)) == NULL) { - ret = -ENOMEM; + ret = -ENOMEM; break; } - + rtw_IOL_append_LLT_cmd(xmit_frame, page_boundary); @@ -6797,12 +6797,12 @@ static int rtw_dbg_port(struct net_device *dev, u32 blink_num = 50; u32 blink_delay_ms = 200; int i; - + { struct xmit_frame *xmit_frame; if((xmit_frame=rtw_IOL_accquire_xmit_frame(padapter)) == NULL) { - ret = -ENOMEM; + ret = -ENOMEM; break; } @@ -6824,7 +6824,7 @@ static int rtw_dbg_port(struct net_device *dev, } } break; - + case 0x06: //continuous wirte byte test { u16 reg = arg; @@ -6832,12 +6832,12 @@ static int rtw_dbg_port(struct net_device *dev, u32 write_num = extra_arg; int i; u8 final; - + { struct xmit_frame *xmit_frame; if((xmit_frame=rtw_IOL_accquire_xmit_frame(padapter)) == NULL) { - ret = -ENOMEM; + ret = -ENOMEM; break; } @@ -6859,13 +6859,13 @@ static int rtw_dbg_port(struct net_device *dev, } } break; - + case 0x07: //continuous wirte word test { u16 reg = arg; u16 start_value = 200; u32 write_num = extra_arg; - + int i; u16 final; @@ -6873,7 +6873,7 @@ static int rtw_dbg_port(struct net_device *dev, struct xmit_frame *xmit_frame; if((xmit_frame=rtw_IOL_accquire_xmit_frame(padapter)) == NULL) { - ret = -ENOMEM; + ret = -ENOMEM; break; } @@ -6895,13 +6895,13 @@ static int rtw_dbg_port(struct net_device *dev, } } break; - + case 0x08: //continuous wirte dword test { u16 reg = arg; u32 start_value = 0x110000c7; u32 write_num = extra_arg; - + int i; u32 final; @@ -6909,7 +6909,7 @@ static int rtw_dbg_port(struct net_device *dev, struct xmit_frame *xmit_frame; if((xmit_frame=rtw_IOL_accquire_xmit_frame(padapter)) == NULL) { - ret = -ENOMEM; + ret = -ENOMEM; break; } @@ -6922,7 +6922,7 @@ static int rtw_dbg_port(struct net_device *dev, } if(_SUCCESS !=rtw_IOL_exec_cmds_sync(padapter, xmit_frame, 5000,0)) ret = -EPERM; - + } if(start_value+write_num-1 == (final=rtw_read32(padapter, reg)) ) { @@ -6965,7 +6965,7 @@ static int rtw_dbg_port(struct net_device *dev, DBG_871X("fwstate=0x%x\n", get_fwstate(pmlmepriv)); break; case 0x01: - DBG_871X("auth_alg=0x%x, enc_alg=0x%x, auth_type=0x%x, enc_type=0x%x\n", + DBG_871X("auth_alg=0x%x, enc_alg=0x%x, auth_type=0x%x, enc_type=0x%x\n", psecuritypriv->dot11AuthAlgrthm, psecuritypriv->dot11PrivacyAlgrthm, psecuritypriv->ndisauthtype, psecuritypriv->ndisencryptstatus); break; @@ -6989,33 +6989,33 @@ static int rtw_dbg_port(struct net_device *dev, { int i; struct recv_reorder_ctrl *preorder_ctrl; - + DBG_871X("SSID=%s\n", cur_network->network.Ssid.Ssid); DBG_871X("sta's macaddr:" MAC_FMT "\n", MAC_ARG(psta->hwaddr)); DBG_871X("cur_channel=%d, cur_bwmode=%d, cur_ch_offset=%d\n", pmlmeext->cur_channel, pmlmeext->cur_bwmode, pmlmeext->cur_ch_offset); DBG_871X("rtsen=%d, cts2slef=%d\n", psta->rtsen, psta->cts2self); DBG_871X("state=0x%x, aid=%d, macid=%d, raid=%d\n", psta->state, psta->aid, psta->mac_id, psta->raid); #ifdef CONFIG_80211N_HT - DBG_871X("qos_en=%d, ht_en=%d, init_rate=%d\n", psta->qos_option, psta->htpriv.ht_option, psta->init_rate); - DBG_871X("bwmode=%d, ch_offset=%d, sgi=%d\n", psta->htpriv.bwmode, psta->htpriv.ch_offset, psta->htpriv.sgi); - DBG_871X("ampdu_enable = %d\n", psta->htpriv.ampdu_enable); + DBG_871X("qos_en=%d, ht_en=%d, init_rate=%d\n", psta->qos_option, psta->htpriv.ht_option, psta->init_rate); + DBG_871X("bwmode=%d, ch_offset=%d, sgi=%d\n", psta->htpriv.bwmode, psta->htpriv.ch_offset, psta->htpriv.sgi); + DBG_871X("ampdu_enable = %d\n", psta->htpriv.ampdu_enable); DBG_871X("agg_enable_bitmap=%x, candidate_tid_bitmap=%x\n", psta->htpriv.agg_enable_bitmap, psta->htpriv.candidate_tid_bitmap); #endif //CONFIG_80211N_HT - + for(i=0;i<16;i++) - { + { preorder_ctrl = &psta->recvreorder_ctrl[i]; if(preorder_ctrl->enable) { DBG_871X("tid=%d, indicate_seq=%d\n", i, preorder_ctrl->indicate_seq); } - } - + } + } else - { + { DBG_871X("can't get sta's macaddr, cur_network's macaddr:" MAC_FMT "\n", MAC_ARG(cur_network->network.MacAddress)); - } + } break; case 0x06: { @@ -7028,14 +7028,14 @@ static int rtw_dbg_port(struct net_device *dev, } break; case 0x07: - DBG_871X("bSurpriseRemoved=%d, bDriverStopped=%d\n", + DBG_871X("bSurpriseRemoved=%d, bDriverStopped=%d\n", padapter->bSurpriseRemoved, padapter->bDriverStopped); break; case 0x08: { struct xmit_priv *pxmitpriv = &padapter->xmitpriv; struct recv_priv *precvpriv = &padapter->recvpriv; - + DBG_871X("free_xmitbuf_cnt=%d, free_xmitframe_cnt=%d" ", free_xmit_extbuf_cnt=%d, free_xframe_ext_cnt=%d" ", free_recvframe_cnt=%d\n", @@ -7046,23 +7046,23 @@ static int rtw_dbg_port(struct net_device *dev, DBG_871X("rx_urb_pending_cn=%d\n", precvpriv->rx_pending_cnt); #endif } - break; + break; case 0x09: { int i, j; _list *plist, *phead; struct recv_reorder_ctrl *preorder_ctrl; - + #ifdef CONFIG_AP_MODE DBG_871X("sta_dz_bitmap=0x%x, tim_bitmap=0x%x\n", pstapriv->sta_dz_bitmap, pstapriv->tim_bitmap); -#endif +#endif _enter_critical_bh(&pstapriv->sta_hash_lock, &irqL); for(i=0; i< NUM_STA; i++) { phead = &(pstapriv->sta_hash[i]); plist = get_next(phead); - + while ((rtw_end_of_queue_search(phead, plist)) == _FALSE) { psta = LIST_CONTAINOR(plist, struct sta_info, hash_list); @@ -7075,12 +7075,12 @@ static int rtw_dbg_port(struct net_device *dev, DBG_871X("rtsen=%d, cts2slef=%d\n", psta->rtsen, psta->cts2self); DBG_871X("state=0x%x, aid=%d, macid=%d, raid=%d\n", psta->state, psta->aid, psta->mac_id, psta->raid); #ifdef CONFIG_80211N_HT - DBG_871X("qos_en=%d, ht_en=%d, init_rate=%d\n", psta->qos_option, psta->htpriv.ht_option, psta->init_rate); - DBG_871X("bwmode=%d, ch_offset=%d, sgi=%d\n", psta->htpriv.bwmode, psta->htpriv.ch_offset, psta->htpriv.sgi); - DBG_871X("ampdu_enable = %d\n", psta->htpriv.ampdu_enable); + DBG_871X("qos_en=%d, ht_en=%d, init_rate=%d\n", psta->qos_option, psta->htpriv.ht_option, psta->init_rate); + DBG_871X("bwmode=%d, ch_offset=%d, sgi=%d\n", psta->htpriv.bwmode, psta->htpriv.ch_offset, psta->htpriv.sgi); + DBG_871X("ampdu_enable = %d\n", psta->htpriv.ampdu_enable); DBG_871X("agg_enable_bitmap=%x, candidate_tid_bitmap=%x\n", psta->htpriv.agg_enable_bitmap, psta->htpriv.candidate_tid_bitmap); #endif //CONFIG_80211N_HT - + #ifdef CONFIG_AP_MODE DBG_871X("capability=0x%x\n", psta->capability); DBG_871X("flags=0x%x\n", psta->flags); @@ -7090,23 +7090,23 @@ static int rtw_dbg_port(struct net_device *dev, DBG_871X("qos_info=0x%x\n", psta->qos_info); #endif DBG_871X("dot118021XPrivacy=0x%x\n", psta->dot118021XPrivacy); - - - + + + for(j=0;j<16;j++) - { + { preorder_ctrl = &psta->recvreorder_ctrl[j]; if(preorder_ctrl->enable) { DBG_871X("tid=%d, indicate_seq=%d\n", j, preorder_ctrl->indicate_seq); } - } - - } - + } + + } + } } - + _exit_critical_bh(&pstapriv->sta_hash_lock, &irqL); } @@ -7115,15 +7115,15 @@ static int rtw_dbg_port(struct net_device *dev, { #ifdef DBG_TRX_STA_PKTS int i, j; - _list *plist, *phead; - + _list *plist, *phead; + _enter_critical_bh(&pstapriv->sta_hash_lock, &irqL); for(i=0; i< NUM_STA; i++) { phead = &(pstapriv->sta_hash[i]); plist = get_next(phead); - + while ((rtw_end_of_queue_search(phead, plist)) == _FALSE) { psta = LIST_CONTAINOR(plist, struct sta_info, hash_list); @@ -7137,45 +7137,45 @@ static int rtw_dbg_port(struct net_device *dev, psta->tx_bk_cnt =0; psta->tx_be_cnt =0; psta->tx_vo_cnt =0; - psta->tx_vi_cnt =0; + psta->tx_vi_cnt =0; } else{ if(extra_arg == psta->mac_id) { - DBG_871X("=== sta's macaddr:" MAC_FMT "===\n", MAC_ARG(psta->hwaddr)); + DBG_871X("=== sta's macaddr:" MAC_FMT "===\n", MAC_ARG(psta->hwaddr)); DBG_871X("rx_bk_cnt =%d\n", psta->rx_bk_cnt); DBG_871X("rx_be_cnt =%d\n", psta->rx_be_cnt); DBG_871X("rx_vo_cnt =%d\n", psta->rx_vo_cnt); - DBG_871X("rx_vi_cnt =%d\n\n", psta->rx_vi_cnt); - + DBG_871X("rx_vi_cnt =%d\n\n", psta->rx_vi_cnt); + DBG_871X("tx_bk_cnt =%d\n", psta->tx_bk_cnt); DBG_871X("tx_be_cnt =%d\n", psta->tx_be_cnt); DBG_871X("tx_vo_cnt =%d\n", psta->tx_vo_cnt); - DBG_871X("tx_vi_cnt =%dn\n", psta->tx_vi_cnt); + DBG_871X("tx_vi_cnt =%dn\n", psta->tx_vi_cnt); } } - + } - } - _exit_critical_bh(&pstapriv->sta_hash_lock, &irqL); + } + _exit_critical_bh(&pstapriv->sta_hash_lock, &irqL); #endif - } + } break; - - case 0x0c://dump rx/tx packet + + case 0x0c://dump rx/tx packet { if(arg == 0){ - DBG_871X("dump rx packet (%d)\n",extra_arg); - //pHalData->bDumpRxPkt =extra_arg; + DBG_871X("dump rx packet (%d)\n",extra_arg); + //pHalData->bDumpRxPkt =extra_arg; rtw_hal_set_def_var(padapter, HAL_DEF_DBG_DUMP_RXPKT, &(extra_arg)); } else if(arg==1){ - DBG_871X("dump tx packet (%d)\n",extra_arg); + DBG_871X("dump tx packet (%d)\n",extra_arg); rtw_hal_set_def_var(padapter, HAL_DEF_DBG_DUMP_TXPKT, &(extra_arg)); } } break; -#if 0 +#if 0 case 0x0d://dump cam { //u8 entry = (u8) extra_arg; @@ -7183,21 +7183,21 @@ static int rtw_dbg_port(struct net_device *dev, //dump cam for(entry=0;entry<32;entry++) read_cam(padapter,entry); - } + } break; #endif #ifdef DBG_CONFIG_ERROR_DETECT case 0x0f: { - if(extra_arg == 0){ + if(extra_arg == 0){ DBG_871X("###### silent reset test.......#####\n"); - rtw_hal_sreset_reset(padapter); + rtw_hal_sreset_reset(padapter); } else { HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter); struct sreset_priv *psrtpriv = &pHalData->srestpriv; psrtpriv->dbg_trigger_point = extra_arg; } - + } break; case 0x15: @@ -7205,9 +7205,9 @@ static int rtw_dbg_port(struct net_device *dev, struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter); DBG_871X("==>silent resete cnts:%d\n",pwrpriv->ips_enter_cnts); } - break; - - #endif + break; + + #endif case 0x10:// driver version display DBG_871X("rtw driver version=%s\n", DRIVERVERSION); @@ -7231,7 +7231,7 @@ static int rtw_dbg_port(struct net_device *dev, } else DBG_871X("get rx_stbc=%d\n",pregpriv->rx_stbc); - + } break; case 0x13: //set ampdu_enable @@ -7245,14 +7245,14 @@ static int rtw_dbg_port(struct net_device *dev, } else DBG_871X("get ampdu_enable=%d\n",pregpriv->ampdu_enable); - + } break; case 0x14: //get wifi_spec { struct registry_priv *pregpriv = &padapter->registrypriv; DBG_871X("get wifi_spec=%d\n",pregpriv->wifi_spec); - + } break; case 0x16: @@ -7269,17 +7269,17 @@ static int rtw_dbg_port(struct net_device *dev, #ifdef DBG_FIXED_CHAN case 0x17: { - struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); + struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); printk("===> Fixed channel to %d \n",extra_arg); - pmlmeext->fixed_chan = extra_arg; - + pmlmeext->fixed_chan = extra_arg; + } break; #endif case 0x20: { rtw_hal_get_hwreg(padapter, HW_VAR_READ_LLT_TAB,(u8 *)&extra_arg); - } + } break; case 0x23: { @@ -7293,7 +7293,7 @@ static int rtw_dbg_port(struct net_device *dev, DBG_871X("turn %s the bShowGetP2PState Variable\n",(extra_arg==1)?"on":"off"); padapter->bShowGetP2PState = extra_arg; #endif // CONFIG_P2P - break; + break; } case 0xaa: { @@ -7301,9 +7301,9 @@ static int rtw_dbg_port(struct net_device *dev, DBG_871X("chang data rate to :0x%02x\n",extra_arg); padapter->fix_rate = extra_arg; } - break; + break; case 0xdd://registers dump , 0 for mac reg,1 for bb reg, 2 for rf reg - { + { if(extra_arg==0){ mac_reg_dump(padapter); } @@ -7313,16 +7313,16 @@ static int rtw_dbg_port(struct net_device *dev, else if(extra_arg==2){ rf_reg_dump(padapter); } - + } - break; + break; case 0xee://turn on/off dynamic funcs { u32 odm_flag; if(0xf==extra_arg){ - rtw_hal_get_def_var(padapter, HAL_DEF_DBG_DM_FUNC,&odm_flag); + rtw_hal_get_def_var(padapter, HAL_DEF_DBG_DM_FUNC,&odm_flag); DBG_871X(" === DMFlag(0x%08x) === \n",odm_flag); DBG_871X("extra_arg = 0 - disable all dynamic func \n"); DBG_871X("extra_arg = 1 - disable DIG- BIT(0)\n"); @@ -7330,16 +7330,16 @@ static int rtw_dbg_port(struct net_device *dev, DBG_871X("extra_arg = 3 - disable tx power tracking - BIT(2)\n"); DBG_871X("extra_arg = 4 - disable BT coexistence - BIT(3)\n"); DBG_871X("extra_arg = 5 - disable antenna diversity - BIT(4)\n"); - DBG_871X("extra_arg = 6 - enable all dynamic func \n"); + DBG_871X("extra_arg = 6 - enable all dynamic func \n"); } else{ /* extra_arg = 0 - disable all dynamic func extra_arg = 1 - disable DIG extra_arg = 2 - disable tx power tracking extra_arg = 3 - turn on all dynamic func - */ + */ rtw_hal_set_def_var(padapter, HAL_DEF_DBG_DM_FUNC, &(extra_arg)); - rtw_hal_get_def_var(padapter, HAL_DEF_DBG_DM_FUNC,&odm_flag); + rtw_hal_get_def_var(padapter, HAL_DEF_DBG_DM_FUNC,&odm_flag); DBG_871X(" === DMFlag(0x%08x) === \n",odm_flag); } } @@ -7362,35 +7362,35 @@ static int rtw_dbg_port(struct net_device *dev, DBG_871X("dbg(0x280)=0x%x\n", rtw_read32(padapter, 0x280)); DBG_871X("dbg(0x284)=0x%x\n", rtw_read32(padapter, 0x284)); DBG_871X("dbg(0x288)=0x%x\n", rtw_read32(padapter, 0x288)); - + DBG_871X("dbg(0x664)=0x%x\n", rtw_read32(padapter, 0x664)); DBG_871X("\n"); - + DBG_871X("dbg(0x430)=0x%x\n", rtw_read32(padapter, 0x430)); DBG_871X("dbg(0x438)=0x%x\n", rtw_read32(padapter, 0x438)); DBG_871X("dbg(0x440)=0x%x\n", rtw_read32(padapter, 0x440)); - + DBG_871X("dbg(0x458)=0x%x\n", rtw_read32(padapter, 0x458)); - + DBG_871X("dbg(0x484)=0x%x\n", rtw_read32(padapter, 0x484)); DBG_871X("dbg(0x488)=0x%x\n", rtw_read32(padapter, 0x488)); - + DBG_871X("dbg(0x444)=0x%x\n", rtw_read32(padapter, 0x444)); DBG_871X("dbg(0x448)=0x%x\n", rtw_read32(padapter, 0x448)); DBG_871X("dbg(0x44c)=0x%x\n", rtw_read32(padapter, 0x44c)); DBG_871X("dbg(0x450)=0x%x\n", rtw_read32(padapter, 0x450)); } break; - } + } break; default: DBG_871X("error dbg cmd!\n"); - break; + break; } - + return ret; @@ -7401,14 +7401,14 @@ static int wpa_set_param(struct net_device *dev, u8 name, u32 value) uint ret=0; u32 flags; struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); - + switch (name){ case IEEE_PARAM_WPA_ENABLED: padapter->securitypriv.dot11AuthAlgrthm= dot11AuthAlgrthm_8021X; //802.1x - + //ret = ieee80211_wpa_enable(ieee, value); - + switch((value)&0xff) { case 1 : //WPA @@ -7420,16 +7420,16 @@ static int wpa_set_param(struct net_device *dev, u8 name, u32 value) padapter->securitypriv.ndisencryptstatus = Ndis802_11Encryption3Enabled; break; } - + RT_TRACE(_module_rtl871x_ioctl_os_c,_drv_info_,("wpa_set_param:padapter->securitypriv.ndisauthtype=%d\n", padapter->securitypriv.ndisauthtype)); - + break; case IEEE_PARAM_TKIP_COUNTERMEASURES: //ieee->tkip_countermeasures=value; break; - case IEEE_PARAM_DROP_UNENCRYPTED: + case IEEE_PARAM_DROP_UNENCRYPTED: { /* HACK: * @@ -7442,13 +7442,13 @@ static int wpa_set_param(struct net_device *dev, u8 name, u32 value) * can use this to determine if the CAP_PRIVACY_ON bit should * be set. */ - -#if 0 + +#if 0 struct ieee80211_security sec = { .flags = SEC_ENABLED, .enabled = value, }; - ieee->drop_unencrypted = value; + ieee->drop_unencrypted = value; /* We only change SEC_LEVEL for open mode. Others * are set by ipw_wpa_set_encryption. */ @@ -7462,30 +7462,30 @@ static int wpa_set_param(struct net_device *dev, u8 name, u32 value) } if (ieee->set_security) ieee->set_security(ieee->dev, &sec); -#endif +#endif break; } - case IEEE_PARAM_PRIVACY_INVOKED: - + case IEEE_PARAM_PRIVACY_INVOKED: + //ieee->privacy_invoked=value; - + break; case IEEE_PARAM_AUTH_ALGS: - + ret = wpa_set_auth_algs(dev, value); - + break; case IEEE_PARAM_IEEE_802_1X: - - //ieee->ieee802_1x=value; - + + //ieee->ieee802_1x=value; + break; - + case IEEE_PARAM_WPAX_SELECT: - + // added for WPA2 mixed mode //DBG_871X(KERN_WARNING "------------------------>wpax value = %x\n", value); /* @@ -7494,26 +7494,26 @@ static int wpa_set_param(struct net_device *dev, u8 name, u32 value) ieee->wpax_type_notify = value; spin_unlock_irqrestore(&ieee->wpax_suitlist_lock,flags); */ - + break; - default: + default: + - ret = -EOPNOTSUPP; - + break; - + } return ret; - + } static int wpa_mlme(struct net_device *dev, u32 command, u32 reason) -{ +{ int ret = 0; struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); @@ -7522,15 +7522,15 @@ static int wpa_mlme(struct net_device *dev, u32 command, u32 reason) case IEEE_MLME_STA_DEAUTH: if(!rtw_set_802_11_disassociate(padapter)) - ret = -1; - + ret = -1; + break; case IEEE_MLME_STA_DISASSOC: - + if(!rtw_set_802_11_disassociate(padapter)) - ret = -1; - + ret = -1; + break; default: @@ -7539,7 +7539,7 @@ static int wpa_mlme(struct net_device *dev, u32 command, u32 reason) } return ret; - + } static int wpa_supplicant_ioctl(struct net_device *dev, struct iw_point *p) @@ -7547,20 +7547,20 @@ static int wpa_supplicant_ioctl(struct net_device *dev, struct iw_point *p) struct ieee_param *param; uint ret=0; - //down(&ieee->wx_sem); + //down(&ieee->wx_sem); if (p->length < sizeof(struct ieee_param) || !p->pointer){ ret = -EINVAL; goto out; } - + param = (struct ieee_param *)rtw_malloc(p->length); if (param == NULL) { ret = -ENOMEM; goto out; } - + if (copy_from_user(param, p->pointer, p->length)) { rtw_mfree((u8*)param, p->length); @@ -7591,20 +7591,20 @@ static int wpa_supplicant_ioctl(struct net_device *dev, struct iw_point *p) DBG_871X("Unknown WPA supplicant request: %d\n", param->cmd); ret = -EOPNOTSUPP; break; - + } if (ret == 0 && copy_to_user(p->pointer, param, p->length)) ret = -EFAULT; rtw_mfree((u8 *)param, p->length); - + out: - + //up(&ieee->wx_sem); - + return ret; - + } #ifdef CONFIG_AP_MODE @@ -7612,7 +7612,7 @@ static u8 set_pairwise_key(struct adapter *padapter, struct sta_info *psta) { struct cmd_obj* ph2c; struct set_stakey_parm *psetstakey_para; - struct cmd_priv *pcmdpriv=&padapter->cmdpriv; + struct cmd_priv *pcmdpriv=&padapter->cmdpriv; u8 res=_SUCCESS; ph2c = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj)); @@ -7633,17 +7633,17 @@ static u8 set_pairwise_key(struct adapter *padapter, struct sta_info *psta) psetstakey_para->algorithm = (u8)psta->dot118021XPrivacy; - _rtw_memcpy(psetstakey_para->addr, psta->hwaddr, ETH_ALEN); - + _rtw_memcpy(psetstakey_para->addr, psta->hwaddr, ETH_ALEN); + _rtw_memcpy(psetstakey_para->key, &psta->dot118021x_UncstKey, 16); - - res = rtw_enqueue_cmd(pcmdpriv, ph2c); + + res = rtw_enqueue_cmd(pcmdpriv, ph2c); exit: return res; - + } static int set_group_key(struct adapter *padapter, u8 *key, u8 alg, int keyid) @@ -7651,11 +7651,11 @@ static int set_group_key(struct adapter *padapter, u8 *key, u8 alg, int keyid) u8 keylen; struct cmd_obj* pcmd; struct setkey_parm *psetkeyparm; - struct cmd_priv *pcmdpriv=&(padapter->cmdpriv); + struct cmd_priv *pcmdpriv=&(padapter->cmdpriv); int res=_SUCCESS; DBG_871X("%s\n", __FUNCTION__); - + pcmd = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj)); if(pcmd==NULL){ res= _FAIL; @@ -7669,7 +7669,7 @@ static int set_group_key(struct adapter *padapter, u8 *key, u8 alg, int keyid) } _rtw_memset(psetkeyparm, 0, sizeof(struct setkey_parm)); - + psetkeyparm->keyid=(u8)keyid; if (is_wep_enc(alg)) padapter->securitypriv.key_mask |= BIT(psetkeyparm->keyid); @@ -7679,25 +7679,25 @@ static int set_group_key(struct adapter *padapter, u8 *key, u8 alg, int keyid) switch(alg) { - case _WEP40_: + case _WEP40_: keylen = 5; break; case _WEP104_: - keylen = 13; + keylen = 13; break; case _TKIP_: - case _TKIP_WTMIC_: + case _TKIP_WTMIC_: case _AES_: - keylen = 16; + keylen = 16; default: - keylen = 16; + keylen = 16; } _rtw_memcpy(&(psetkeyparm->key[0]), key, keylen); - + pcmd->cmdcode = _SetKey_CMD_; - pcmd->parmbuf = (u8 *)psetkeyparm; - pcmd->cmdsz = (sizeof(struct setkey_parm)); + pcmd->parmbuf = (u8 *)psetkeyparm; + pcmd->cmdsz = (sizeof(struct setkey_parm)); pcmd->rsp = NULL; pcmd->rspsz = 0; @@ -7709,24 +7709,24 @@ static int set_group_key(struct adapter *padapter, u8 *key, u8 alg, int keyid) exit: return res; - + } static int set_wep_key(struct adapter *padapter, u8 *key, u8 keylen, int keyid) -{ +{ u8 alg; switch(keylen) { case 5: - alg =_WEP40_; + alg =_WEP40_; break; case 13: - alg =_WEP104_; + alg =_WEP104_; break; default: - alg =_NO_PRIVACY_; + alg =_NO_PRIVACY_; } return set_group_key(padapter, key, alg, keyid); @@ -7739,9 +7739,9 @@ static int rtw_set_encryption(struct net_device *dev, struct ieee_param *param, int ret = 0; u32 wep_key_idx, wep_key_len,wep_total_len; NDIS_802_11_WEP *pwep = NULL; - struct sta_info *psta = NULL, *pbcmc_sta = NULL; + struct sta_info *psta = NULL, *pbcmc_sta = NULL; struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; + struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct security_priv* psecuritypriv=&(padapter->securitypriv); struct sta_priv *pstapriv = &padapter->stapriv; @@ -7760,23 +7760,23 @@ static int rtw_set_encryption(struct net_device *dev, struct ieee_param *param, if (param->sta_addr[0] == 0xff && param->sta_addr[1] == 0xff && param->sta_addr[2] == 0xff && param->sta_addr[3] == 0xff && - param->sta_addr[4] == 0xff && param->sta_addr[5] == 0xff) + param->sta_addr[4] == 0xff && param->sta_addr[5] == 0xff) { if (param->u.crypt.idx >= WEP_KEYS) { ret = -EINVAL; goto exit; - } + } } - else - { + else + { psta = rtw_get_stainfo(pstapriv, param->sta_addr); if(!psta) { //ret = -EINVAL; DBG_871X("rtw_set_encryption(), sta has already been removed or never been added\n"); goto exit; - } + } } if (strcmp(param->u.crypt.alg, "none") == 0 && (psta==NULL)) @@ -7784,18 +7784,18 @@ static int rtw_set_encryption(struct net_device *dev, struct ieee_param *param, //todo:clear default encryption keys DBG_871X("clear default encryption keys, keyid=%d\n", param->u.crypt.idx); - + goto exit; } if (strcmp(param->u.crypt.alg, "WEP") == 0 && (psta==NULL)) - { + { DBG_871X("r871x_set_encryption, crypt.alg = WEP\n"); - + wep_key_idx = param->u.crypt.idx; wep_key_len = param->u.crypt.key_len; - + DBG_871X("r871x_set_encryption, wep_key_idx=%d, len=%d\n", wep_key_idx, wep_key_len); if((wep_key_idx >= WEP_KEYS) || (wep_key_len<=0)) @@ -7803,25 +7803,25 @@ static int rtw_set_encryption(struct net_device *dev, struct ieee_param *param, ret = -EINVAL; goto exit; } - - if (wep_key_len > 0) - { - wep_key_len = wep_key_len <= 5 ? 5 : 13; + + if (wep_key_len > 0) + { + wep_key_len = wep_key_len <= 5 ? 5 : 13; wep_total_len = wep_key_len + FIELD_OFFSET(NDIS_802_11_WEP, KeyMaterial); - pwep =(NDIS_802_11_WEP *)rtw_malloc(wep_total_len); + pwep =(NDIS_802_11_WEP *)rtw_malloc(wep_total_len); if(pwep == NULL){ DBG_871X(" r871x_set_encryption: pwep allocate fail !!!\n"); goto exit; } - - _rtw_memset(pwep, 0, wep_total_len); - - pwep->KeyLength = wep_key_len; + + _rtw_memset(pwep, 0, wep_total_len); + + pwep->KeyLength = wep_key_len; pwep->Length = wep_total_len; - + } - + pwep->KeyIndex = wep_key_idx; _rtw_memcpy(pwep->KeyMaterial, param->u.crypt.key, pwep->KeyLength); @@ -7833,44 +7833,44 @@ static int rtw_set_encryption(struct net_device *dev, struct ieee_param *param, psecuritypriv->ndisencryptstatus = Ndis802_11Encryption1Enabled; psecuritypriv->dot11PrivacyAlgrthm=_WEP40_; psecuritypriv->dot118021XGrpPrivacy=_WEP40_; - + if(pwep->KeyLength==13) { psecuritypriv->dot11PrivacyAlgrthm=_WEP104_; psecuritypriv->dot118021XGrpPrivacy=_WEP104_; } - + psecuritypriv->dot11PrivacyKeyIndex = wep_key_idx; - + _rtw_memcpy(&(psecuritypriv->dot11DefKey[wep_key_idx].skey[0]), pwep->KeyMaterial, pwep->KeyLength); psecuritypriv->dot11DefKeylen[wep_key_idx]=pwep->KeyLength; - set_wep_key(padapter, pwep->KeyMaterial, pwep->KeyLength, wep_key_idx); + set_wep_key(padapter, pwep->KeyMaterial, pwep->KeyLength, wep_key_idx); + - } else { DBG_871X("wep, set_tx=0\n"); - - //don't update "psecuritypriv->dot11PrivacyAlgrthm" and + + //don't update "psecuritypriv->dot11PrivacyAlgrthm" and //"psecuritypriv->dot11PrivacyKeyIndex=keyid", but can rtw_set_key to cam - + _rtw_memcpy(&(psecuritypriv->dot11DefKey[wep_key_idx].skey[0]), pwep->KeyMaterial, pwep->KeyLength); - psecuritypriv->dot11DefKeylen[wep_key_idx] = pwep->KeyLength; + psecuritypriv->dot11DefKeylen[wep_key_idx] = pwep->KeyLength; set_wep_key(padapter, pwep->KeyMaterial, pwep->KeyLength, wep_key_idx); - + } goto exit; - + } - + if(!psta && check_fwstate(pmlmepriv, WIFI_AP_STATE)) // //group key { if(param->u.crypt.set_tx ==1) @@ -7878,36 +7878,36 @@ static int rtw_set_encryption(struct net_device *dev, struct ieee_param *param, if(strcmp(param->u.crypt.alg, "WEP") == 0) { DBG_871X("%s, set group_key, WEP\n", __FUNCTION__); - + _rtw_memcpy(psecuritypriv->dot118021XGrpKey[param->u.crypt.idx].skey, param->u.crypt.key, (param->u.crypt.key_len>16 ?16:param->u.crypt.key_len)); - + psecuritypriv->dot118021XGrpPrivacy = _WEP40_; if(param->u.crypt.key_len==13) - { + { psecuritypriv->dot118021XGrpPrivacy = _WEP104_; } - + } else if(strcmp(param->u.crypt.alg, "TKIP") == 0) - { + { DBG_871X("%s, set group_key, TKIP\n", __FUNCTION__); - + psecuritypriv->dot118021XGrpPrivacy = _TKIP_; _rtw_memcpy(psecuritypriv->dot118021XGrpKey[param->u.crypt.idx].skey, param->u.crypt.key, (param->u.crypt.key_len>16 ?16:param->u.crypt.key_len)); - + //DEBUG_ERR("set key length :param->u.crypt.key_len=%d\n", param->u.crypt.key_len); //set mic key _rtw_memcpy(psecuritypriv->dot118021XGrptxmickey[param->u.crypt.idx].skey, &(param->u.crypt.key[16]), 8); _rtw_memcpy(psecuritypriv->dot118021XGrprxmickey[param->u.crypt.idx].skey, &(param->u.crypt.key[24]), 8); psecuritypriv->busetkipkey = _TRUE; - + } else if(strcmp(param->u.crypt.alg, "CCMP") == 0) { DBG_871X("%s, set group_key, CCMP\n", __FUNCTION__); - + psecuritypriv->dot118021XGrpPrivacy = _AES_; _rtw_memcpy(psecuritypriv->dot118021XGrpKey[param->u.crypt.idx].skey, param->u.crypt.key, (param->u.crypt.key_len>16 ?16:param->u.crypt.key_len)); @@ -7915,7 +7915,7 @@ static int rtw_set_encryption(struct net_device *dev, struct ieee_param *param, else { DBG_871X("%s, set group_key, none\n", __FUNCTION__); - + psecuritypriv->dot118021XGrpPrivacy = _NO_PRIVACY_; } @@ -7924,98 +7924,98 @@ static int rtw_set_encryption(struct net_device *dev, struct ieee_param *param, psecuritypriv->binstallGrpkey = _TRUE; psecuritypriv->dot11PrivacyAlgrthm = psecuritypriv->dot118021XGrpPrivacy;//!!! - + set_group_key(padapter, param->u.crypt.key, psecuritypriv->dot118021XGrpPrivacy, param->u.crypt.idx); - + pbcmc_sta=rtw_get_bcmc_stainfo(padapter); if(pbcmc_sta) { pbcmc_sta->ieee8021x_blocked = _FALSE; - pbcmc_sta->dot118021XPrivacy= psecuritypriv->dot118021XGrpPrivacy;//rx will use bmc_sta's dot118021XPrivacy - } - + pbcmc_sta->dot118021XPrivacy= psecuritypriv->dot118021XGrpPrivacy;//rx will use bmc_sta's dot118021XPrivacy + } + } goto exit; - - } + + } if(psecuritypriv->dot11AuthAlgrthm == dot11AuthAlgrthm_8021X && psta) // psk/802_1x { if(check_fwstate(pmlmepriv, WIFI_AP_STATE)) { if(param->u.crypt.set_tx ==1) - { + { _rtw_memcpy(psta->dot118021x_UncstKey.skey, param->u.crypt.key, (param->u.crypt.key_len>16 ?16:param->u.crypt.key_len)); - + if(strcmp(param->u.crypt.alg, "WEP") == 0) { DBG_871X("%s, set pairwise key, WEP\n", __FUNCTION__); - + psta->dot118021XPrivacy = _WEP40_; if(param->u.crypt.key_len==13) - { + { psta->dot118021XPrivacy = _WEP104_; } } else if(strcmp(param->u.crypt.alg, "TKIP") == 0) - { + { DBG_871X("%s, set pairwise key, TKIP\n", __FUNCTION__); - + psta->dot118021XPrivacy = _TKIP_; - + //DEBUG_ERR("set key length :param->u.crypt.key_len=%d\n", param->u.crypt.key_len); //set mic key _rtw_memcpy(psta->dot11tkiptxmickey.skey, &(param->u.crypt.key[16]), 8); _rtw_memcpy(psta->dot11tkiprxmickey.skey, &(param->u.crypt.key[24]), 8); psecuritypriv->busetkipkey = _TRUE; - + } else if(strcmp(param->u.crypt.alg, "CCMP") == 0) { DBG_871X("%s, set pairwise key, CCMP\n", __FUNCTION__); - + psta->dot118021XPrivacy = _AES_; } else { DBG_871X("%s, set pairwise key, none\n", __FUNCTION__); - + psta->dot118021XPrivacy = _NO_PRIVACY_; } - + set_pairwise_key(padapter, psta); - + psta->ieee8021x_blocked = _FALSE; - - } + + } else//group key??? - { + { if(strcmp(param->u.crypt.alg, "WEP") == 0) { _rtw_memcpy(psecuritypriv->dot118021XGrpKey[param->u.crypt.idx].skey, param->u.crypt.key, (param->u.crypt.key_len>16 ?16:param->u.crypt.key_len)); - + psecuritypriv->dot118021XGrpPrivacy = _WEP40_; if(param->u.crypt.key_len==13) - { + { psecuritypriv->dot118021XGrpPrivacy = _WEP104_; } } else if(strcmp(param->u.crypt.alg, "TKIP") == 0) - { + { psecuritypriv->dot118021XGrpPrivacy = _TKIP_; _rtw_memcpy(psecuritypriv->dot118021XGrpKey[param->u.crypt.idx].skey, param->u.crypt.key, (param->u.crypt.key_len>16 ?16:param->u.crypt.key_len)); - + //DEBUG_ERR("set key length :param->u.crypt.key_len=%d\n", param->u.crypt.key_len); //set mic key _rtw_memcpy(psecuritypriv->dot118021XGrptxmickey[param->u.crypt.idx].skey, &(param->u.crypt.key[16]), 8); _rtw_memcpy(psecuritypriv->dot118021XGrprxmickey[param->u.crypt.idx].skey, &(param->u.crypt.key[24]), 8); psecuritypriv->busetkipkey = _TRUE; - + } else if(strcmp(param->u.crypt.alg, "CCMP") == 0) { @@ -8030,39 +8030,39 @@ static int rtw_set_encryption(struct net_device *dev, struct ieee_param *param, psecuritypriv->dot118021XGrpKeyid = param->u.crypt.idx; - psecuritypriv->binstallGrpkey = _TRUE; - + psecuritypriv->binstallGrpkey = _TRUE; + psecuritypriv->dot11PrivacyAlgrthm = psecuritypriv->dot118021XGrpPrivacy;//!!! - + set_group_key(padapter, param->u.crypt.key, psecuritypriv->dot118021XGrpPrivacy, param->u.crypt.idx); - + pbcmc_sta=rtw_get_bcmc_stainfo(padapter); if(pbcmc_sta) { pbcmc_sta->ieee8021x_blocked = _FALSE; - pbcmc_sta->dot118021XPrivacy= psecuritypriv->dot118021XGrpPrivacy;//rx will use bmc_sta's dot118021XPrivacy - } + pbcmc_sta->dot118021XPrivacy= psecuritypriv->dot118021XGrpPrivacy;//rx will use bmc_sta's dot118021XPrivacy + } } - + } - + } exit: if(pwep) { - rtw_mfree((u8 *)pwep, wep_total_len); - } - + rtw_mfree((u8 *)pwep, wep_total_len); + } + return ret; - + } static int rtw_set_beacon(struct net_device *dev, struct ieee_param *param, int len) { - int ret=0; + int ret=0; struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); struct sta_priv *pstapriv = &padapter->stapriv; @@ -8084,26 +8084,26 @@ static int rtw_set_beacon(struct net_device *dev, struct ieee_param *param, int ret = 0; else ret = -EINVAL; - + return ret; - + } static int rtw_hostapd_sta_flush(struct net_device *dev) { //_irqL irqL; //_list *phead, *plist; - int ret=0; + int ret=0; //struct sta_info *psta = NULL; - struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); + struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); //struct sta_priv *pstapriv = &padapter->stapriv; DBG_871X("%s\n", __FUNCTION__); flush_all_cam_entry(padapter); //clear CAM - ret = rtw_sta_flush(padapter); + ret = rtw_sta_flush(padapter); return ret; @@ -8112,24 +8112,24 @@ static int rtw_hostapd_sta_flush(struct net_device *dev) static int rtw_add_sta(struct net_device *dev, struct ieee_param *param) { _irqL irqL; - int ret=0; + int ret=0; struct sta_info *psta = NULL; struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); struct sta_priv *pstapriv = &padapter->stapriv; DBG_871X("rtw_add_sta(aid=%d)=" MAC_FMT "\n", param->u.add_sta.aid, MAC_ARG(param->sta_addr)); - - if(check_fwstate(pmlmepriv, (_FW_LINKED|WIFI_AP_STATE)) != _TRUE) + + if(check_fwstate(pmlmepriv, (_FW_LINKED|WIFI_AP_STATE)) != _TRUE) { - return -EINVAL; + return -EINVAL; } if (param->sta_addr[0] == 0xff && param->sta_addr[1] == 0xff && param->sta_addr[2] == 0xff && param->sta_addr[3] == 0xff && - param->sta_addr[4] == 0xff && param->sta_addr[5] == 0xff) + param->sta_addr[4] == 0xff && param->sta_addr[5] == 0xff) { - return -EINVAL; + return -EINVAL; } /* @@ -8137,37 +8137,37 @@ static int rtw_add_sta(struct net_device *dev, struct ieee_param *param) if(psta) { DBG_871X("rtw_add_sta(), free has been added psta=%p\n", psta); - _enter_critical_bh(&(pstapriv->sta_hash_lock), &irqL); - rtw_free_stainfo(padapter, psta); + _enter_critical_bh(&(pstapriv->sta_hash_lock), &irqL); + rtw_free_stainfo(padapter, psta); _exit_critical_bh(&(pstapriv->sta_hash_lock), &irqL); psta = NULL; - } + } */ //psta = rtw_alloc_stainfo(pstapriv, param->sta_addr); psta = rtw_get_stainfo(pstapriv, param->sta_addr); if(psta) { - int flags = param->u.add_sta.flags; - + int flags = param->u.add_sta.flags; + //DBG_871X("rtw_add_sta(), init sta's variables, psta=%p\n", psta); - + psta->aid = param->u.add_sta.aid;//aid=1~2007 _rtw_memcpy(psta->bssrateset, param->u.add_sta.tx_supp_rates, 16); - - + + //check wmm cap. if(WLAN_STA_WME&flags) psta->qos_option = 1; else psta->qos_option = 0; - if(pmlmepriv->qospriv.qos_option == 0) + if(pmlmepriv->qospriv.qos_option == 0) psta->qos_option = 0; - -#ifdef CONFIG_80211N_HT + +#ifdef CONFIG_80211N_HT //chec 802.11n ht cap. if(WLAN_STA_HT&flags) { @@ -8175,89 +8175,89 @@ static int rtw_add_sta(struct net_device *dev, struct ieee_param *param) psta->qos_option = 1; _rtw_memcpy((void*)&psta->htpriv.ht_cap, (void*)¶m->u.add_sta.ht_cap, sizeof(struct rtw_ieee80211_ht_cap)); } - else + else { psta->htpriv.ht_option = _FALSE; } - - if(pmlmepriv->htpriv.ht_option == _FALSE) + + if(pmlmepriv->htpriv.ht_option == _FALSE) psta->htpriv.ht_option = _FALSE; -#endif +#endif update_sta_info_apmode(padapter, psta); - - + + } else { ret = -ENOMEM; - } - + } + return ret; - + } static int rtw_del_sta(struct net_device *dev, struct ieee_param *param) { _irqL irqL; - int ret=0; + int ret=0; struct sta_info *psta = NULL; struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); struct sta_priv *pstapriv = &padapter->stapriv; DBG_871X("rtw_del_sta=" MAC_FMT "\n", MAC_ARG(param->sta_addr)); - - if(check_fwstate(pmlmepriv, (_FW_LINKED|WIFI_AP_STATE)) != _TRUE) + + if(check_fwstate(pmlmepriv, (_FW_LINKED|WIFI_AP_STATE)) != _TRUE) { - return -EINVAL; + return -EINVAL; } if (param->sta_addr[0] == 0xff && param->sta_addr[1] == 0xff && param->sta_addr[2] == 0xff && param->sta_addr[3] == 0xff && - param->sta_addr[4] == 0xff && param->sta_addr[5] == 0xff) + param->sta_addr[4] == 0xff && param->sta_addr[5] == 0xff) { - return -EINVAL; + return -EINVAL; } psta = rtw_get_stainfo(pstapriv, param->sta_addr); if(psta) { u8 updated; - + //DBG_871X("free psta=%p, aid=%d\n", psta, psta->aid); _enter_critical_bh(&pstapriv->asoc_list_lock, &irqL); if(rtw_is_list_empty(&psta->asoc_list)==_FALSE) - { + { rtw_list_delete(&psta->asoc_list); pstapriv->asoc_list_cnt--; updated = ap_free_sta(padapter, psta, _TRUE, WLAN_REASON_DEAUTH_LEAVING); } _exit_critical_bh(&pstapriv->asoc_list_lock, &irqL); - + associated_clients_update(padapter, updated); - + psta = NULL; - + } else { DBG_871X("rtw_del_sta(), sta has already been removed or never been added\n"); - + //ret = -1; } - - + + return ret; - + } static int rtw_ioctl_get_sta_data(struct net_device *dev, struct ieee_param *param, int len) { - int ret=0; + int ret=0; struct sta_info *psta = NULL; struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); @@ -8267,16 +8267,16 @@ static int rtw_ioctl_get_sta_data(struct net_device *dev, struct ieee_param *par DBG_871X("rtw_ioctl_get_sta_info, sta_addr: " MAC_FMT "\n", MAC_ARG(param_ex->sta_addr)); - if(check_fwstate(pmlmepriv, (_FW_LINKED|WIFI_AP_STATE)) != _TRUE) + if(check_fwstate(pmlmepriv, (_FW_LINKED|WIFI_AP_STATE)) != _TRUE) { - return -EINVAL; + return -EINVAL; } if (param_ex->sta_addr[0] == 0xff && param_ex->sta_addr[1] == 0xff && param_ex->sta_addr[2] == 0xff && param_ex->sta_addr[3] == 0xff && - param_ex->sta_addr[4] == 0xff && param_ex->sta_addr[5] == 0xff) + param_ex->sta_addr[4] == 0xff && param_ex->sta_addr[5] == 0xff) { - return -EINVAL; + return -EINVAL; } psta = rtw_get_stainfo(pstapriv, param_ex->sta_addr); @@ -8288,7 +8288,7 @@ static int rtw_ioctl_get_sta_data(struct net_device *dev, struct ieee_param *par u16 capability; int flags; u32 sta_set; - u8 tx_supp_rates[16]; + u8 tx_supp_rates[16]; u32 tx_supp_rates_len; struct rtw_ieee80211_ht_cap ht_cap; u64 rx_pkts; @@ -8297,7 +8297,7 @@ static int rtw_ioctl_get_sta_data(struct net_device *dev, struct ieee_param *par u64 tx_pkts; u64 tx_bytes; u64 tx_drops; - } get_sta; + } get_sta; #endif psta_data->aid = (u16)psta->aid; psta_data->capability = psta->capability; @@ -8331,7 +8331,7 @@ static int rtw_ioctl_get_sta_data(struct net_device *dev, struct ieee_param *par psta_data->tx_pkts = psta->sta_stats.tx_pkts; psta_data->tx_bytes = psta->sta_stats.tx_bytes; psta_data->tx_drops = psta->sta_stats.tx_drops; - + } else @@ -8345,7 +8345,7 @@ static int rtw_ioctl_get_sta_data(struct net_device *dev, struct ieee_param *par static int rtw_get_sta_wpaie(struct net_device *dev, struct ieee_param *param) { - int ret=0; + int ret=0; struct sta_info *psta = NULL; struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); @@ -8353,16 +8353,16 @@ static int rtw_get_sta_wpaie(struct net_device *dev, struct ieee_param *param) DBG_871X("rtw_get_sta_wpaie, sta_addr: " MAC_FMT "\n", MAC_ARG(param->sta_addr)); - if(check_fwstate(pmlmepriv, (_FW_LINKED|WIFI_AP_STATE)) != _TRUE) + if(check_fwstate(pmlmepriv, (_FW_LINKED|WIFI_AP_STATE)) != _TRUE) { - return -EINVAL; + return -EINVAL; } if (param->sta_addr[0] == 0xff && param->sta_addr[1] == 0xff && param->sta_addr[2] == 0xff && param->sta_addr[3] == 0xff && - param->sta_addr[4] == 0xff && param->sta_addr[5] == 0xff) + param->sta_addr[4] == 0xff && param->sta_addr[5] == 0xff) { - return -EINVAL; + return -EINVAL; } psta = rtw_get_stainfo(pstapriv, param->sta_addr); @@ -8374,9 +8374,9 @@ static int rtw_get_sta_wpaie(struct net_device *dev, struct ieee_param *param) int copy_len; wpa_ie_len = psta->wpa_ie[1]; - + copy_len = ((wpa_ie_len+2) > sizeof(psta->wpa_ie)) ? (sizeof(psta->wpa_ie)):(wpa_ie_len+2); - + param->u.wpa_ie.len = copy_len; _rtw_memcpy(param->u.wpa_ie.reserved, psta->wpa_ie, copy_len); @@ -8385,7 +8385,7 @@ static int rtw_get_sta_wpaie(struct net_device *dev, struct ieee_param *param) { //ret = -1; DBG_871X("sta's wpa_ie is NONE\n"); - } + } } else { @@ -8400,7 +8400,7 @@ static int rtw_set_wps_beacon(struct net_device *dev, struct ieee_param *param, { int ret=0; unsigned char wps_oui[4]={0x0,0x50,0xf2,0x04}; - struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); + struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); @@ -8417,8 +8417,8 @@ static int rtw_set_wps_beacon(struct net_device *dev, struct ieee_param *param, if(pmlmepriv->wps_beacon_ie) { rtw_mfree(pmlmepriv->wps_beacon_ie, pmlmepriv->wps_beacon_ie_len); - pmlmepriv->wps_beacon_ie = NULL; - } + pmlmepriv->wps_beacon_ie = NULL; + } if(ie_len>0) { @@ -8432,20 +8432,20 @@ static int rtw_set_wps_beacon(struct net_device *dev, struct ieee_param *param, _rtw_memcpy(pmlmepriv->wps_beacon_ie, param->u.bcn_ie.buf, ie_len); update_beacon(padapter, _VENDOR_SPECIFIC_IE_, wps_oui, _TRUE); - + pmlmeext->bstart_bss = _TRUE; - + } - - - return ret; + + + return ret; } static int rtw_set_wps_probe_resp(struct net_device *dev, struct ieee_param *param, int len) { int ret=0; - struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); + struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); int ie_len; @@ -8460,8 +8460,8 @@ static int rtw_set_wps_probe_resp(struct net_device *dev, struct ieee_param *par if(pmlmepriv->wps_probe_resp_ie) { rtw_mfree(pmlmepriv->wps_probe_resp_ie, pmlmepriv->wps_probe_resp_ie_len); - pmlmepriv->wps_probe_resp_ie = NULL; - } + pmlmepriv->wps_probe_resp_ie = NULL; + } if(ie_len>0) { @@ -8471,10 +8471,10 @@ static int rtw_set_wps_probe_resp(struct net_device *dev, struct ieee_param *par DBG_871X("%s()-%d: rtw_malloc() ERROR!\n", __FUNCTION__, __LINE__); return -EINVAL; } - _rtw_memcpy(pmlmepriv->wps_probe_resp_ie, param->u.bcn_ie.buf, ie_len); + _rtw_memcpy(pmlmepriv->wps_probe_resp_ie, param->u.bcn_ie.buf, ie_len); } - - + + return ret; } @@ -8482,7 +8482,7 @@ static int rtw_set_wps_probe_resp(struct net_device *dev, struct ieee_param *par static int rtw_set_wps_assoc_resp(struct net_device *dev, struct ieee_param *param, int len) { int ret=0; - struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); + struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); int ie_len; @@ -8497,8 +8497,8 @@ static int rtw_set_wps_assoc_resp(struct net_device *dev, struct ieee_param *par if(pmlmepriv->wps_assoc_resp_ie) { rtw_mfree(pmlmepriv->wps_assoc_resp_ie, pmlmepriv->wps_assoc_resp_ie_len); - pmlmepriv->wps_assoc_resp_ie = NULL; - } + pmlmepriv->wps_assoc_resp_ie = NULL; + } if(ie_len>0) { @@ -8508,11 +8508,11 @@ static int rtw_set_wps_assoc_resp(struct net_device *dev, struct ieee_param *par DBG_871X("%s()-%d: rtw_malloc() ERROR!\n", __FUNCTION__, __LINE__); return -EINVAL; } - - _rtw_memcpy(pmlmepriv->wps_assoc_resp_ie, param->u.bcn_ie.buf, ie_len); + + _rtw_memcpy(pmlmepriv->wps_assoc_resp_ie, param->u.bcn_ie.buf, ie_len); } - - + + return ret; } @@ -8574,57 +8574,57 @@ static int rtw_set_hidden_ssid(struct net_device *dev, struct ieee_param *param, static int rtw_ioctl_acl_remove_sta(struct net_device *dev, struct ieee_param *param, int len) { int ret=0; - struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); - struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); + struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); + struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); if(check_fwstate(pmlmepriv, WIFI_AP_STATE) != _TRUE) return -EINVAL; if (param->sta_addr[0] == 0xff && param->sta_addr[1] == 0xff && param->sta_addr[2] == 0xff && param->sta_addr[3] == 0xff && - param->sta_addr[4] == 0xff && param->sta_addr[5] == 0xff) + param->sta_addr[4] == 0xff && param->sta_addr[5] == 0xff) { - return -EINVAL; + return -EINVAL; } - ret = rtw_acl_remove_sta(padapter, param->sta_addr); + ret = rtw_acl_remove_sta(padapter, param->sta_addr); - return ret; + return ret; } static int rtw_ioctl_acl_add_sta(struct net_device *dev, struct ieee_param *param, int len) { int ret=0; - struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); + struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); - + if(check_fwstate(pmlmepriv, WIFI_AP_STATE) != _TRUE) return -EINVAL; if (param->sta_addr[0] == 0xff && param->sta_addr[1] == 0xff && param->sta_addr[2] == 0xff && param->sta_addr[3] == 0xff && - param->sta_addr[4] == 0xff && param->sta_addr[5] == 0xff) + param->sta_addr[4] == 0xff && param->sta_addr[5] == 0xff) { - return -EINVAL; + return -EINVAL; } - ret = rtw_acl_add_sta(padapter, param->sta_addr); + ret = rtw_acl_add_sta(padapter, param->sta_addr); - return ret; + return ret; } static int rtw_ioctl_set_macaddr_acl(struct net_device *dev, struct ieee_param *param, int len) { int ret=0; - struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); + struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); - + if(check_fwstate(pmlmepriv, WIFI_AP_STATE) != _TRUE) - return -EINVAL; - - rtw_set_macaddr_acl(padapter, param->u.mlme.command); + return -EINVAL; + + rtw_set_macaddr_acl(padapter, param->u.mlme.command); return ret; } @@ -8653,14 +8653,14 @@ static int rtw_hostapd_ioctl(struct net_device *dev, struct iw_point *p) ret = -EINVAL; goto out; } - + param = (struct ieee_param *)rtw_malloc(p->length); if (param == NULL) { ret = -ENOMEM; goto out; } - + if (copy_from_user(param, p->pointer, p->length)) { rtw_mfree((u8*)param, p->length); @@ -8670,18 +8670,18 @@ static int rtw_hostapd_ioctl(struct net_device *dev, struct iw_point *p) //DBG_871X("%s, cmd=%d\n", __FUNCTION__, param->cmd); - switch (param->cmd) - { + switch (param->cmd) + { case RTL871X_HOSTAPD_FLUSH: ret = rtw_hostapd_sta_flush(dev); break; - - case RTL871X_HOSTAPD_ADD_STA: - - ret = rtw_add_sta(dev, param); - + + case RTL871X_HOSTAPD_ADD_STA: + + ret = rtw_add_sta(dev, param); + break; case RTL871X_HOSTAPD_REMOVE_STA: @@ -8689,25 +8689,25 @@ static int rtw_hostapd_ioctl(struct net_device *dev, struct iw_point *p) ret = rtw_del_sta(dev, param); break; - + case RTL871X_HOSTAPD_SET_BEACON: ret = rtw_set_beacon(dev, param, p->length); break; - + case RTL871X_SET_ENCRYPTION: ret = rtw_set_encryption(dev, param, p->length); - + break; - + case RTL871X_HOSTAPD_GET_WPAIE_STA: ret = rtw_get_sta_wpaie(dev, param); - + break; - + case RTL871X_HOSTAPD_SET_WPS_BEACON: ret = rtw_set_wps_beacon(dev, param, p->length); @@ -8717,14 +8717,14 @@ static int rtw_hostapd_ioctl(struct net_device *dev, struct iw_point *p) case RTL871X_HOSTAPD_SET_WPS_PROBE_RESP: ret = rtw_set_wps_probe_resp(dev, param, p->length); - - break; - + + break; + case RTL871X_HOSTAPD_SET_WPS_ASSOC_RESP: ret = rtw_set_wps_assoc_resp(dev, param, p->length); - - break; + + break; case RTL871X_HOSTAPD_SET_HIDDEN_SSID: @@ -8737,7 +8737,7 @@ static int rtw_hostapd_ioctl(struct net_device *dev, struct iw_point *p) ret = rtw_ioctl_get_sta_data(dev, param, p->length); break; - + case RTL871X_HOSTAPD_SET_MACADDR_ACL: ret = rtw_ioctl_set_macaddr_acl(dev, param, p->length); @@ -8755,12 +8755,12 @@ static int rtw_hostapd_ioctl(struct net_device *dev, struct iw_point *p) ret = rtw_ioctl_acl_remove_sta(dev, param, p->length); break; - + default: DBG_871X("Unknown hostapd request: %d\n", param->cmd); ret = -EOPNOTSUPP; break; - + } if (ret == 0 && copy_to_user(p->pointer, param, p->length)) @@ -8768,11 +8768,11 @@ static int rtw_hostapd_ioctl(struct net_device *dev, struct iw_point *p) rtw_mfree((u8 *)param, p->length); - + out: - + return ret; - + } #endif @@ -8798,7 +8798,7 @@ static int rtw_wx_set_priv(struct net_device *dev, //RT_TRACE(_module_rtl871x_ioctl_os_c, _drv_notice_, ("+rtw_wx_set_priv\n")); if(dwrq->length == 0) return -EFAULT; - + len = dwrq->length; if (!(ext = rtw_vmalloc(len))) return -ENOMEM; @@ -8813,25 +8813,25 @@ static int rtw_wx_set_priv(struct net_device *dev, // ("rtw_wx_set_priv: %s req=%s\n", // dev->name, ext)); - #ifdef CONFIG_DEBUG_RTW_WX_SET_PRIV + #ifdef CONFIG_DEBUG_RTW_WX_SET_PRIV if (!(ext_dbg = rtw_vmalloc(len))) { rtw_vmfree(ext, len); return -ENOMEM; - } - + } + _rtw_memcpy(ext_dbg, ext, len); #endif //added for wps2.0 @20110524 if(dwrq->flags == 0x8766 && len > 8) { - u32 cp_sz; + u32 cp_sz; struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); u8 *probereq_wpsie = ext; int probereq_wpsie_len = len; - u8 wps_oui[4]={0x0,0x50,0xf2,0x04}; - + u8 wps_oui[4]={0x0,0x50,0xf2,0x04}; + if((_VENDOR_SPECIFIC_IE_ == probereq_wpsie[0]) && (_rtw_memcmp(&probereq_wpsie[2], wps_oui, 4) ==_TRUE)) { @@ -8844,24 +8844,24 @@ static int rtw_wx_set_priv(struct net_device *dev, u32 free_len = pmlmepriv->wps_probe_req_ie_len; pmlmepriv->wps_probe_req_ie_len = 0; rtw_mfree(pmlmepriv->wps_probe_req_ie, free_len); - pmlmepriv->wps_probe_req_ie = NULL; - } + pmlmepriv->wps_probe_req_ie = NULL; + } pmlmepriv->wps_probe_req_ie = rtw_malloc(cp_sz); if ( pmlmepriv->wps_probe_req_ie == NULL) { printk("%s()-%d: rtw_malloc() ERROR!\n", __FUNCTION__, __LINE__); ret = -EINVAL; goto FREE_EXT; - + } - + _rtw_memcpy(pmlmepriv->wps_probe_req_ie, probereq_wpsie, cp_sz); - pmlmepriv->wps_probe_req_ie_len = cp_sz; - - } - + pmlmepriv->wps_probe_req_ie_len = cp_sz; + + } + goto FREE_EXT; - + } if( len >= WEXT_CSCAN_HEADER_SIZE @@ -8870,7 +8870,7 @@ static int rtw_wx_set_priv(struct net_device *dev, ret = rtw_wx_set_scan(dev, info, awrq, ext); goto FREE_EXT; } - + #ifdef CONFIG_ANDROID //DBG_871X("rtw_wx_set_priv: %s req=%s\n", dev->name, ext); @@ -8885,7 +8885,7 @@ static int rtw_wx_set_priv(struct net_device *dev, break; case ANDROID_WIFI_CMD_RSSI : { - struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); + struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); struct wlan_network *pcur_network = &pmlmepriv->cur_network; if(check_fwstate(pmlmepriv, _FW_LINKED) == _TRUE) { @@ -8932,7 +8932,7 @@ static int rtw_wx_set_priv(struct net_device *dev, #endif sprintf(ext, "OK"); - + } if (copy_to_user(dwrq->pointer, ext, min(dwrq->length, (u16)(strlen(ext)+1)) ) ) @@ -8952,11 +8952,11 @@ FREE_EXT: rtw_vmfree(ext_dbg, len); #endif - //DBG_871X("rtw_wx_set_priv: (SIOCSIWPRIV) %s ret=%d\n", + //DBG_871X("rtw_wx_set_priv: (SIOCSIWPRIV) %s ret=%d\n", // dev->name, ret); return ret; - + } #ifdef CONFIG_WOWLAN @@ -8974,21 +8974,21 @@ static int rtw_wowlan_ctrl(struct net_device *dev, poidparam.subcode = 0; DBG_871X("+rtw_wowlan_ctrl: %s\n", extra); - + if(pwrctrlpriv->bSupportRemoteWakeup==_FALSE){ ret = -EPERM; DBG_871X("+rtw_wowlan_ctrl: Device didn't support the remote wakeup!!\n"); goto _rtw_wowlan_ctrl_exit_free; } - if (!check_fwstate(pmlmepriv, _FW_LINKED) && + if (!check_fwstate(pmlmepriv, _FW_LINKED) && check_fwstate(pmlmepriv, WIFI_STATION_STATE)) { DBG_871X("[%s] WARNING: Please Connect With AP First!!\n", __func__); goto _rtw_wowlan_ctrl_exit_free; } if (_rtw_memcmp( extra, "enable", 6 )) { - + while (pwrctrlpriv->bips_processing == _TRUE) rtw_msleep_os(1); @@ -9066,7 +9066,7 @@ static int rtw_pm_set(struct net_device *dev, if ( _rtw_memcmp( extra, "lps=", 4 ) ) { - sscanf(extra+4, "%u", &mode); + sscanf(extra+4, "%u", &mode); ret = rtw_pm_set_lps(padapter,mode); } else if ( _rtw_memcmp( extra, "ips=", 4 ) ) @@ -9091,10 +9091,10 @@ static int rtw_mp_efuse_get(struct net_device *dev, PHAL_DATA_TYPE pHalData = GET_HAL_DATA(padapter); PEFUSE_HAL pEfuseHal; struct iw_point *wrqu; - + u8 *PROMContent = pEEPROM->efuse_eeprom_data; struct pwrctrl_priv *pwrctrlpriv ; - + u8 *data = NULL; u8 *rawdata = NULL; char *pch, *ptmp, *token, *tmp[3]={NULL, NULL, NULL}; @@ -9105,9 +9105,9 @@ static int rtw_mp_efuse_get(struct net_device *dev, #ifdef CONFIG_IOL u8 org_fw_iol = padapter->registrypriv.fw_iol;// 0:Disable, 1:enable, 2:by usb speed #endif - + wrqu = (struct iw_point*)wdata; - pwrctrlpriv = adapter_to_pwrctl(padapter); + pwrctrlpriv = adapter_to_pwrctl(padapter); pEfuseHal = &pHalData->EfuseHal; err = 0; @@ -9132,13 +9132,13 @@ static int rtw_mp_efuse_get(struct net_device *dev, #ifdef CONFIG_LPS lps_mode = pwrctrlpriv->power_mgnt;//keep org value rtw_pm_set_lps(padapter,PS_MODE_ACTIVE); - #endif - - #ifdef CONFIG_IPS + #endif + + #ifdef CONFIG_IPS ips_mode = pwrctrlpriv->ips_mode;//keep org value rtw_pm_set_ips(padapter,IPS_NONE); - #endif - + #endif + pch = extra; DBG_871X("%s: in=%s\n", __FUNCTION__, extra); @@ -9153,7 +9153,7 @@ static int rtw_mp_efuse_get(struct net_device *dev, #ifdef CONFIG_IOL padapter->registrypriv.fw_iol = 0;// 0:Disable, 1:enable, 2:by usb speed #endif - + if(strcmp(tmp[0], "status") == 0){ sprintf(extra, "Load File efuse=%s,Load File MAC=%s",(pEEPROM->bloadfile_fail_flag? "FAIL" : "OK"),(pEEPROM->bloadmac_fail_flag? "FAIL" : "OK")); @@ -9162,7 +9162,7 @@ static int rtw_mp_efuse_get(struct net_device *dev, else if (strcmp(tmp[0], "drvmap") == 0) { mapLen = EFUSE_MAP_SIZE; - + sprintf(extra, "\n"); for (i = 0; i < EFUSE_MAP_SIZE; i += 16) { @@ -9302,7 +9302,7 @@ static int rtw_mp_efuse_get(struct net_device *dev, #else addr = EEPROM_MAC_ADDR_88EU; #endif - + cnts = 6; EFUSE_GetEfuseDefinition(padapter, EFUSE_WIFI, TYPE_AVAILABLE_EFUSE_BYTES_TOTAL, (PVOID)&max_available_size, _FALSE); @@ -9463,7 +9463,7 @@ static int rtw_mp_efuse_get(struct net_device *dev, goto exit; } - if (rtw_BT_efuse_map_read(padapter, addr, cnts, data) == _FAIL) + if (rtw_BT_efuse_map_read(padapter, addr, cnts, data) == _FAIL) { DBG_871X("%s: rtw_BT_efuse_map_read error!!\n", __FUNCTION__); err = -EFAULT; @@ -9567,7 +9567,7 @@ static int rtw_mp_efuse_get(struct net_device *dev, // rmap addr cnts addr = simple_strtoul(tmp[1], &ptmp, 16); DBG_871X("%s: addr=%x\n", __FUNCTION__, addr); - + cnts = simple_strtoul(tmp[2], &ptmp, 10); if (cnts == 0) { @@ -9576,7 +9576,7 @@ static int rtw_mp_efuse_get(struct net_device *dev, goto exit; } DBG_871X("%s: cnts=%d\n", __FUNCTION__, cnts); - + // DBG_871X("%s: data={", __FUNCTION__); *extra = 0; for (i=0; ilength = strlen(extra); - - #ifdef CONFIG_IPS + + #ifdef CONFIG_IPS rtw_pm_set_ips(padapter, ips_mode); #endif - #ifdef CONFIG_LPS + #ifdef CONFIG_LPS rtw_pm_set_lps(padapter, lps_mode); #endif #ifdef CONFIG_IOL @@ -9692,16 +9692,16 @@ static int rtw_mp_efuse_set(struct net_device *dev, #ifdef CONFIG_LPS lps_mode = pwrctrlpriv->power_mgnt;//keep org value rtw_pm_set_lps(padapter,PS_MODE_ACTIVE); - #endif - - #ifdef CONFIG_IPS + #endif + + #ifdef CONFIG_IPS ips_mode = pwrctrlpriv->ips_mode;//keep org value rtw_pm_set_ips(padapter,IPS_NONE); - #endif + #endif pch = extra; DBG_871X("%s: in=%s\n", __FUNCTION__, extra); - + i = 0; while ((token = strsep(&pch, ",")) != NULL) { @@ -9739,7 +9739,7 @@ static int rtw_mp_efuse_set(struct net_device *dev, DBG_871X("%s: addr=0x%X\n", __FUNCTION__, addr); DBG_871X("%s: cnts=%d\n", __FUNCTION__, cnts); DBG_871X("%s: map data=%s\n", __FUNCTION__, tmp[2]); - + for (jj=0, kk=0; jjfakeEfuseModifiedMap) == _SUCCESS) { - DBG_871X("%s: WiFi hw efuse dump to Fake map success \n", __FUNCTION__); + DBG_871X("%s: WiFi hw efuse dump to Fake map success \n", __FUNCTION__); } else { DBG_871X("%s: WiFi hw efuse dump to Fake map Fail \n", __FUNCTION__); err = -EFAULT; @@ -9997,7 +9997,7 @@ static int rtw_mp_efuse_set(struct net_device *dev, DBG_871X("%s: addr=0x%X\n", __FUNCTION__, addr); DBG_871X("%s: cnts=%d\n", __FUNCTION__, cnts); DBG_871X("%s: BT tmp data=%s\n", __FUNCTION__, tmp[2]); - + for (jj=0, kk=0; jjfakeBTEfuseModifiedMap[addr+jj] = key_2char2num(tmp[2][kk], tmp[2][kk+1]); @@ -10015,8 +10015,8 @@ static int rtw_mp_efuse_set(struct net_device *dev, else if (strcmp(tmp[0], "btfk2map") == 0) { _rtw_memcpy(pEfuseHal->BTEfuseModifiedMap, pEfuseHal->fakeBTEfuseModifiedMap, EFUSE_BT_MAX_MAP_LEN); - - EFUSE_GetEfuseDefinition(padapter, EFUSE_BT, TYPE_AVAILABLE_EFUSE_BYTES_TOTAL, (PVOID)&max_available_size, _FALSE); + + EFUSE_GetEfuseDefinition(padapter, EFUSE_BT, TYPE_AVAILABLE_EFUSE_BYTES_TOTAL, (PVOID)&max_available_size, _FALSE); if (max_available_size < 1) { err = -EFAULT; @@ -10032,7 +10032,7 @@ static int rtw_mp_efuse_set(struct net_device *dev, } else if (strcmp(tmp[0], "wlfk2map") == 0) { - EFUSE_GetEfuseDefinition(padapter, EFUSE_WIFI, TYPE_AVAILABLE_EFUSE_BYTES_TOTAL, (PVOID)&max_available_size, _FALSE); + EFUSE_GetEfuseDefinition(padapter, EFUSE_WIFI, TYPE_AVAILABLE_EFUSE_BYTES_TOTAL, (PVOID)&max_available_size, _FALSE); if (max_available_size < 1) { err = -EFAULT; @@ -10089,11 +10089,11 @@ exit: rtw_mfree(ShadowMapWiFi, EFUSE_MAP_SIZE); if (setrawdata) rtw_mfree(setrawdata, EFUSE_MAX_SIZE); - - #ifdef CONFIG_IPS + + #ifdef CONFIG_IPS rtw_pm_set_ips(padapter, ips_mode); #endif - #ifdef CONFIG_LPS + #ifdef CONFIG_LPS rtw_pm_set_lps(padapter, lps_mode); #endif @@ -10124,7 +10124,7 @@ static int rtw_wfd_tdls_enable(struct net_device *dev, #endif //CONFIG_WFD #endif //CONFIG_TDLS - + return ret; } @@ -10150,7 +10150,7 @@ static int rtw_tdls_weaksec(struct net_device *dev, padapter->wdinfo.wfd_tdls_weaksec = 1; } #endif - + return ret; } @@ -10189,7 +10189,7 @@ static int rtw_tdls_enable(struct net_device *dev, { phead = &(pstapriv->sta_hash[index]); plist = get_next(phead); - + while ((rtw_end_of_queue_search(phead, plist)) == _FALSE) { psta = LIST_CONTAINOR(plist, struct sta_info ,hash_list); @@ -10220,7 +10220,7 @@ static int rtw_tdls_enable(struct net_device *dev, ptdlsinfo->enable = 1; } #endif //CONFIG_TDLS - + return ret; } @@ -10266,7 +10266,7 @@ static int rtw_tdls_setup(struct net_device *dev, issue_tdls_setup_req(padapter, mac_addr); } #endif - + return ret; } @@ -10290,7 +10290,7 @@ static int rtw_tdls_teardown(struct net_device *dev, } ptdls_sta = rtw_get_stainfo( &(padapter->stapriv), mac_addr); - + if(ptdls_sta != NULL) { ptdls_sta->stat_code = _RSON_TDLS_TEAR_UN_RSN_; @@ -10298,7 +10298,7 @@ static int rtw_tdls_teardown(struct net_device *dev, } #endif //CONFIG_TDLS - + return ret; } @@ -10309,7 +10309,7 @@ static int rtw_tdls_discovery(struct net_device *dev, int ret = 0; #ifdef CONFIG_TDLS - + struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); @@ -10330,7 +10330,7 @@ static int rtw_tdls_ch_switch(struct net_device *dev, int ret = 0; #ifdef CONFIG_TDLS - + struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); struct tdls_info *ptdlsinfo = &padapter->tdlsinfo; u8 i, j, mac_addr[ETH_ALEN]; @@ -10353,7 +10353,7 @@ static int rtw_tdls_ch_switch(struct net_device *dev, return ret; } - + static int rtw_tdls_pson(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) @@ -10361,7 +10361,7 @@ static int rtw_tdls_pson(struct net_device *dev, int ret = 0; #ifdef CONFIG_TDLS - + struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); @@ -10377,12 +10377,12 @@ static int rtw_tdls_pson(struct net_device *dev, ptdls_sta = rtw_get_stainfo(&padapter->stapriv, mac_addr); issue_nulldata_to_TDLS_peer_STA(padapter, ptdls_sta, 1); - + #endif //CONFIG_TDLS return ret; } - + static int rtw_tdls_psoff(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) @@ -10390,13 +10390,13 @@ static int rtw_tdls_psoff(struct net_device *dev, int ret = 0; #ifdef CONFIG_TDLS - + struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); u8 i, j, mac_addr[ETH_ALEN]; struct sta_info *ptdls_sta = NULL; - + DBG_8192C( "[%s] %s %d\n", __FUNCTION__, extra, wrqu->data.length -1 ); for( i=0, j=0 ; i < ETH_ALEN; i++, j+=3 ){ @@ -10406,7 +10406,7 @@ static int rtw_tdls_psoff(struct net_device *dev, ptdls_sta = rtw_get_stainfo(&padapter->stapriv, mac_addr); issue_nulldata_to_TDLS_peer_STA(padapter, ptdls_sta, 0); - + #endif //CONFIG_TDLS return ret; @@ -10420,12 +10420,12 @@ static int rtw_tdls_setip(struct net_device *dev, #ifdef CONFIG_TDLS #ifdef CONFIG_WFD - + struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); struct tdls_info *ptdlsinfo = &padapter->tdlsinfo; struct wifi_display_info *pwfd_info = ptdlsinfo->wfd_info; u8 i=0, j=0, k=0, tag=0, ip[3] = { 0xff }, *ptr = extra; - + printk( "[%s] %s %d\n", __FUNCTION__, extra, wrqu->data.length - 1 ); @@ -10440,7 +10440,7 @@ static int rtw_tdls_setip(struct net_device *dev, if( j == 2 ) pwfd_info->ip_address[i]=convert_ip_addr( '0', *(extra+(j-2)+tag), *(extra+(j-1)+tag)); if( j == 3 ) - pwfd_info->ip_address[i]=convert_ip_addr( *(extra+(j-3)+tag), *(extra+(j-2)+tag), *(extra+(j-1)+tag)); + pwfd_info->ip_address[i]=convert_ip_addr( *(extra+(j-3)+tag), *(extra+(j-2)+tag), *(extra+(j-1)+tag)); tag += j + 1; break; @@ -10449,12 +10449,12 @@ static int rtw_tdls_setip(struct net_device *dev, i++; } - printk( "[%s] Set IP = %u.%u.%u.%u \n", __FUNCTION__, + printk( "[%s] Set IP = %u.%u.%u.%u \n", __FUNCTION__, ptdlsinfo->wfd_info->ip_address[0], ptdlsinfo->wfd_info->ip_address[1], ptdlsinfo->wfd_info->ip_address[2], ptdlsinfo->wfd_info->ip_address[3] ); -#endif //CONFIG_WFD +#endif //CONFIG_WFD #endif //CONFIG_TDLS return ret; @@ -10468,26 +10468,26 @@ static int rtw_tdls_getip(struct net_device *dev, #ifdef CONFIG_TDLS #ifdef CONFIG_WFD - + struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); struct tdls_info *ptdlsinfo = &padapter->tdlsinfo; struct wifi_display_info *pwfd_info = ptdlsinfo->wfd_info; - + printk( "[%s]\n", __FUNCTION__); - sprintf( extra, "\n\n%u.%u.%u.%u\n", - pwfd_info->peer_ip_address[0], pwfd_info->peer_ip_address[1], + sprintf( extra, "\n\n%u.%u.%u.%u\n", + pwfd_info->peer_ip_address[0], pwfd_info->peer_ip_address[1], pwfd_info->peer_ip_address[2], pwfd_info->peer_ip_address[3] ); printk( "[%s] IP=%u.%u.%u.%u\n", __FUNCTION__, - pwfd_info->peer_ip_address[0], pwfd_info->peer_ip_address[1], + pwfd_info->peer_ip_address[0], pwfd_info->peer_ip_address[1], pwfd_info->peer_ip_address[2], pwfd_info->peer_ip_address[3] ); - + wrqu->data.length = strlen( extra ); -#endif //CONFIG_WFD +#endif //CONFIG_WFD #endif //CONFIG_TDLS return ret; @@ -10497,8 +10497,8 @@ static int rtw_tdls_getport(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - - int ret = 0; + + int ret = 0; #ifdef CONFIG_TDLS #ifdef CONFIG_WFD @@ -10511,14 +10511,14 @@ static int rtw_tdls_getport(struct net_device *dev, sprintf( extra, "\n\n%d\n", pwfd_info->peer_rtsp_ctrlport ); printk( "[%s] remote port = %d\n", __FUNCTION__, pwfd_info->peer_rtsp_ctrlport ); - + wrqu->data.length = strlen( extra ); #endif //CONFIG_WFD #endif //CONFIG_TDLS return ret; - + } //WFDTDLS, for sigma test @@ -10526,8 +10526,8 @@ static int rtw_tdls_dis_result(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - - int ret = 0; + + int ret = 0; #ifdef CONFIG_TDLS #ifdef CONFIG_WFD @@ -10543,14 +10543,14 @@ static int rtw_tdls_dis_result(struct net_device *dev, sprintf( extra, "\n\nDis=1\n" ); ptdlsinfo->dev_discovered = 0; } - + wrqu->data.length = strlen( extra ); #endif //CONFIG_WFD #endif //CONFIG_TDLS return ret; - + } //WFDTDLS, for sigma test @@ -10558,8 +10558,8 @@ static int rtw_wfd_tdls_status(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - - int ret = 0; + + int ret = 0; #ifdef CONFIG_TDLS #ifdef CONFIG_WFD @@ -10578,14 +10578,14 @@ static int rtw_wfd_tdls_status(struct net_device *dev, { sprintf( extra, "\n\nStatus=0\n" ); } - + wrqu->data.length = strlen( extra ); #endif //CONFIG_WFD #endif //CONFIG_TDLS return ret; - + } static int rtw_tdls_ch_switch_off(struct net_device *dev, @@ -10595,11 +10595,11 @@ static int rtw_tdls_ch_switch_off(struct net_device *dev, int ret = 0; #ifdef CONFIG_TDLS - + struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); u8 i, j, mac_addr[ETH_ALEN]; struct sta_info *ptdls_sta = NULL; - + DBG_871X( "[%s] %s %d\n", __FUNCTION__, extra, wrqu->data.length -1 ); for( i=0, j=0 ; i < ETH_ALEN; i++, j+=3 ){ @@ -10616,7 +10616,7 @@ static int rtw_tdls_ch_switch_off(struct net_device *dev, DBG_871X("issue tdls ch switch req back to base channel\n"); } */ - + #endif //CONFIG_TDLS return ret; @@ -10682,7 +10682,7 @@ static int rtw_tdls(struct net_device *dev, { wrqu->data.length -= 6; rtw_tdls_ch_switch_off( dev, info, wrqu, &extra[6] ); - } + } else if (_rtw_memcmp( extra, "pson=", 5 ) ) { wrqu->data.length -= 5; @@ -10706,7 +10706,7 @@ static int rtw_tdls(struct net_device *dev, #endif //CONFIG_WFD #endif //CONFIG_TDLS - + return ret; } @@ -11191,7 +11191,7 @@ thread_return lbk_thread(thread_context context) pktsize = (pktsize % 1535) + 1; // 1~1535 } else pktsize = ploopback->size; - + pxmitframe = createloopbackpkt(padapter, pktsize); if (pxmitframe == NULL) { sprintf(ploopback->msg, "loopback FAIL! 3. create Packet FAIL!"); @@ -11447,7 +11447,7 @@ static iw_handler rtw_handlers[] = NULL, /* SIOCGIWENCODEEXT */ rtw_wx_set_pmkid, /* SIOCSIWPMKSA */ NULL, /*---hole---*/ -}; +}; static const struct iw_priv_args rtw_private_args[] = { { @@ -11477,7 +11477,7 @@ static const struct iw_priv_args rtw_private_args[] = { SIOCIWFIRSTPRIV + 0x6, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "wps_start" }, -//for PLATFORM_MT53XX +//for PLATFORM_MT53XX { SIOCIWFIRSTPRIV + 0x7, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "get_sensitivity" @@ -11491,7 +11491,7 @@ static const struct iw_priv_args rtw_private_args[] = { IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "wps_assoc_req_ie" }, -//for RTK_DMP_PLATFORM +//for RTK_DMP_PLATFORM { SIOCIWFIRSTPRIV + 0xA, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "channel_plan" @@ -11500,7 +11500,7 @@ static const struct iw_priv_args rtw_private_args[] = { { SIOCIWFIRSTPRIV + 0xB, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2, 0, "dbg" - }, + }, { SIOCIWFIRSTPRIV + 0xC, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3, 0, "rfw" @@ -11523,7 +11523,7 @@ static const struct iw_priv_args rtw_private_args[] = { { SIOCIWFIRSTPRIV + 0x13, IW_PRIV_TYPE_CHAR | 64, IW_PRIV_TYPE_CHAR | 64 , "p2p_get2" - }, + }, { SIOCIWFIRSTPRIV + 0x14, IW_PRIV_TYPE_CHAR | 64, 0, "tdls" @@ -11531,7 +11531,7 @@ static const struct iw_priv_args rtw_private_args[] = { { SIOCIWFIRSTPRIV + 0x15, IW_PRIV_TYPE_CHAR | P2P_PRIVATE_IOCTL_SET_LEN, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | P2P_PRIVATE_IOCTL_SET_LEN , "tdls_get" - }, + }, { SIOCIWFIRSTPRIV + 0x16, IW_PRIV_TYPE_CHAR | 64, 0, "pm_set" @@ -11558,11 +11558,11 @@ static const struct iw_priv_args rtw_private_args[] = { #endif // CONFIG_INTEL_WIDI #ifdef CONFIG_WOWLAN - { MP_WOW_ENABLE , IW_PRIV_TYPE_CHAR | 1024, 0, "wow_enable" }, //set + { MP_WOW_ENABLE , IW_PRIV_TYPE_CHAR | 1024, 0, "wow_enable" }, //set #endif }; -static iw_handler rtw_private_handler[] = +static iw_handler rtw_private_handler[] = { rtw_wx_write32, //0x00 rtw_wx_read32, //0x01 @@ -11613,7 +11613,7 @@ static iw_handler rtw_private_handler[] = #endif // CONFIG_INTEL_WIDI }; -#if WIRELESS_EXT >= 17 +#if WIRELESS_EXT >= 17 static struct iw_statistics *rtw_get_wireless_stats(struct net_device *dev) { struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); @@ -11631,7 +11631,7 @@ static struct iw_statistics *rtw_get_wireless_stats(struct net_device *dev) } else{ #ifdef CONFIG_SIGNAL_DISPLAY_DBM - tmp_level = translate_percentage_to_dbm(padapter->recvpriv.signal_strength); + tmp_level = translate_percentage_to_dbm(padapter->recvpriv.signal_strength); #else tmp_level = padapter->recvpriv.signal_strength; #ifdef CONFIG_BT_COEXIST @@ -11642,9 +11642,9 @@ static struct iw_statistics *rtw_get_wireless_stats(struct net_device *dev) } #endif // CONFIG_BT_COEXIST #endif - + tmp_qual = padapter->recvpriv.signal_qual; - tmp_noise =padapter->recvpriv.noise; + tmp_noise =padapter->recvpriv.noise; //DBG_871X("level:%d, qual:%d, noise:%d, rssi (%d)\n", tmp_level, tmp_qual, tmp_noise,padapter->recvpriv.rssi); piwstats->qual.level = tmp_level; @@ -11680,7 +11680,7 @@ struct iw_handler_def rtw_handlers_def = .private = rtw_private_handler, .private_args = (struct iw_priv_args *)rtw_private_args, .num_private = sizeof(rtw_private_handler) / sizeof(iw_handler), - .num_private_args = sizeof(rtw_private_args) / sizeof(struct iw_priv_args), + .num_private_args = sizeof(rtw_private_args) / sizeof(struct iw_priv_args), #endif #if WIRELESS_EXT >= 17 .get_wireless_stats = rtw_get_wireless_stats, diff --git a/os_dep/mlme_linux.c b/os_dep/mlme_linux.c index f8e5235..3355222 100755 --- a/os_dep/mlme_linux.c +++ b/os_dep/mlme_linux.c @@ -1,7 +1,7 @@ /****************************************************************************** * * 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. @@ -94,20 +94,20 @@ static void _dynamic_check_timer_handlder (void *FunctionContext) { struct adapter *adapter = (struct adapter *)FunctionContext; /* remove for MP power tracking DM. -#if (MP_DRIVER == 1) +#if (MP_DRIVER == 1) if (adapter->registrypriv.mp_mode == 1) return; #endif */ rtw_dynamic_check_timer_handlder(adapter); - + _set_timer(&adapter->mlmepriv.dynamic_chk_timer, 2000); } #ifdef CONFIG_SET_SCAN_DENY_TIMER void _rtw_set_scan_deny_timer_hdl(void *FunctionContext) { - struct adapter *adapter = (struct adapter *)FunctionContext; + struct adapter *adapter = (struct adapter *)FunctionContext; rtw_set_scan_deny_timer_hdl(adapter); } #endif @@ -118,7 +118,7 @@ void _rtw_event_polling_timer_hdl(void *FunctionContext) struct adapter *adapter = (struct adapter *)FunctionContext; rtw_event_polling_timer_hdl(adapter); - + _set_timer(&adapter->mlmepriv.event_polling_timer, 200); } #endif @@ -148,7 +148,7 @@ void rtw_init_mlme_timer(struct adapter *padapter) #if defined(CONFIG_CHECK_BT_HANG) && defined(CONFIG_BT_COEXIST) if (padapter->HalFunc.hal_init_checkbthang_workqueue) padapter->HalFunc.hal_init_checkbthang_workqueue(padapter); -#endif +#endif } extern void rtw_indicate_wx_assoc_event(struct adapter *padapter); @@ -157,10 +157,10 @@ extern void rtw_indicate_wx_disassoc_event(struct adapter *padapter); void rtw_os_indicate_connect(struct adapter *adapter) { struct mlme_priv *pmlmepriv = &(adapter->mlmepriv); -_func_enter_; +_func_enter_; #ifdef CONFIG_IOCTL_CFG80211 - if ( (check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE)==_TRUE ) || + if ( (check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE)==_TRUE ) || (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE)==_TRUE ) ) { rtw_cfg80211_ibss_indicate_connect(adapter); @@ -179,7 +179,7 @@ _func_enter_; _set_workitem(&adapter->mlmepriv.Linkup_workitem); #endif -_func_exit_; +_func_exit_; } @@ -201,11 +201,11 @@ void rtw_reset_securitypriv( struct adapter *adapter ) // add for CONFIG_IEEE80211W, none 11w also can use _irqL irqL; struct mlme_ext_priv *pmlmeext = &adapter->mlmeextpriv; - + _enter_critical_bh(&adapter->security_key_mutex, &irqL); - + if(adapter->securitypriv.dot11AuthAlgrthm == dot11AuthAlgrthm_8021X)//802.1x - { + { // Added by Albert 2009/02/18 // We have to backup the PMK information for WiFi PMK Caching test item. // @@ -217,7 +217,7 @@ void rtw_reset_securitypriv( struct adapter *adapter ) _rtw_memcpy( &backupPMKIDList[ 0 ], &adapter->securitypriv.PMKIDList[ 0 ], sizeof( RT_PMKID_LIST ) * NUM_PMKID_CACHE ); backupPMKIDIndex = adapter->securitypriv.PMKIDIndex; backupTKIPCountermeasure = adapter->securitypriv.btkip_countermeasure; - backupTKIPcountermeasure_time = adapter->securitypriv.btkip_countermeasure_time; + backupTKIPcountermeasure_time = adapter->securitypriv.btkip_countermeasure_time; #ifdef CONFIG_IEEE80211W //reset RX BIP packet number pmlmeext->mgnt_80211w_IPN_rx = 0; @@ -230,13 +230,13 @@ void rtw_reset_securitypriv( struct adapter *adapter ) _rtw_memcpy( &adapter->securitypriv.PMKIDList[ 0 ], &backupPMKIDList[ 0 ], sizeof( RT_PMKID_LIST ) * NUM_PMKID_CACHE ); adapter->securitypriv.PMKIDIndex = backupPMKIDIndex; adapter->securitypriv.btkip_countermeasure = backupTKIPCountermeasure; - adapter->securitypriv.btkip_countermeasure_time = backupTKIPcountermeasure_time; + adapter->securitypriv.btkip_countermeasure_time = backupTKIPcountermeasure_time; adapter->securitypriv.ndisauthtype = Ndis802_11AuthModeOpen; adapter->securitypriv.ndisencryptstatus = Ndis802_11WEPDisabled; } - else //reset values in securitypriv + else //reset values in securitypriv { //if(adapter->mlmepriv.fw_state & WIFI_STATION_STATE) //{ @@ -295,37 +295,37 @@ _func_enter_; if(authmode==_WPA_IE_ID_) { RT_TRACE(_module_mlme_osdep_c_,_drv_info_,("rtw_report_sec_ie, authmode=%d\n", authmode)); - + buff = rtw_malloc(IW_CUSTOM_MAX); - + _rtw_memset(buff,0,IW_CUSTOM_MAX); - + p=buff; - + p+=sprintf(p,"ASSOCINFO(ReqIEs="); len = sec_ie[1]+2; len = (len < IW_CUSTOM_MAX) ? len:IW_CUSTOM_MAX; - + for(i=0;ipnetdev,IWEVCUSTOM,&wrqu,buff); #endif if(buff) rtw_mfree(buff, IW_CUSTOM_MAX); - + } _func_exit_; @@ -335,7 +335,7 @@ _func_exit_; static void _survey_timer_hdl (void *FunctionContext) { struct adapter *padapter = (struct adapter *)FunctionContext; - + survey_timer_hdl(padapter); } @@ -380,7 +380,7 @@ void _reassoc_timer_hdl(void *FunctionContext) */ void init_mlme_ext_timer(struct adapter *padapter) -{ +{ struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; _init_timer(&pmlmeext->survey_timer, padapter->pnetdev, _survey_timer_hdl, padapter); @@ -409,14 +409,14 @@ void rtw_indicate_sta_assoc_event(struct adapter *padapter, struct sta_info *pst if(pstapriv->sta_aid[psta->aid - 1] != psta) return; - - - wrqu.addr.sa_family = ARPHRD_ETHER; - + + + wrqu.addr.sa_family = ARPHRD_ETHER; + _rtw_memcpy(wrqu.addr.sa_data, psta->hwaddr, ETH_ALEN); DBG_871X("+rtw_indicate_sta_assoc_event\n"); - + #ifndef CONFIG_IOCTL_CFG80211 wireless_send_event(padapter->pnetdev, IWEVREGISTERED, &wrqu, NULL); #endif @@ -436,18 +436,18 @@ void rtw_indicate_sta_disassoc_event(struct adapter *padapter, struct sta_info * if(pstapriv->sta_aid[psta->aid - 1] != psta) return; - - - wrqu.addr.sa_family = ARPHRD_ETHER; - + + + wrqu.addr.sa_family = ARPHRD_ETHER; + _rtw_memcpy(wrqu.addr.sa_data, psta->hwaddr, ETH_ALEN); DBG_871X("+rtw_indicate_sta_disassoc_event\n"); - + #ifndef CONFIG_IOCTL_CFG80211 wireless_send_event(padapter->pnetdev, IWEVEXPIRED, &wrqu, NULL); #endif - + } @@ -471,7 +471,7 @@ static int mgnt_netdev_open(struct net_device *pnetdev) init_usb_anchor(&phostapdpriv->anchored); - + if(!rtw_netif_queue_stopped(pnetdev)) rtw_netif_start_queue(pnetdev); else @@ -479,10 +479,10 @@ static int mgnt_netdev_open(struct net_device *pnetdev) netif_carrier_on(pnetdev); - - //rtw_write16(phostapdpriv->padapter, 0x0116, 0x0100);//only excluding beacon - - return 0; + + //rtw_write16(phostapdpriv->padapter, 0x0116, 0x0100);//only excluding beacon + + return 0; } static int mgnt_netdev_close(struct net_device *pnetdev) { @@ -496,10 +496,10 @@ static int mgnt_netdev_close(struct net_device *pnetdev) if (!rtw_netif_queue_stopped(pnetdev)) rtw_netif_stop_queue(pnetdev); - + //rtw_write16(phostapdpriv->padapter, 0x0116, 0x3f3f); - - return 0; + + return 0; } #if (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,29)) @@ -518,8 +518,8 @@ int hostapd_mode_init(struct adapter *padapter) unsigned char mac[ETH_ALEN]; struct hostapd_priv *phostapdpriv; struct net_device *pnetdev; - - pnetdev = rtw_alloc_etherdev(sizeof(struct hostapd_priv)); + + pnetdev = rtw_alloc_etherdev(sizeof(struct hostapd_priv)); if (!pnetdev) return -ENOMEM; @@ -527,49 +527,49 @@ int hostapd_mode_init(struct adapter *padapter) ether_setup(pnetdev); //pnetdev->type = ARPHRD_IEEE80211; - + phostapdpriv = rtw_netdev_priv(pnetdev); phostapdpriv->pmgnt_netdev = pnetdev; phostapdpriv->padapter= padapter; padapter->phostapdpriv = phostapdpriv; - + //pnetdev->init = NULL; - + #if (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,29)) DBG_871X("register rtl871x_mgnt_netdev_ops to netdev_ops\n"); pnetdev->netdev_ops = &rtl871x_mgnt_netdev_ops; - + #else pnetdev->open = mgnt_netdev_open; - pnetdev->stop = mgnt_netdev_close; - + pnetdev->stop = mgnt_netdev_close; + pnetdev->hard_start_xmit = mgnt_xmit_entry; - + //pnetdev->set_mac_address = r871x_net_set_mac_address; - + //pnetdev->get_stats = r871x_net_get_stats; //pnetdev->do_ioctl = r871x_mp_ioctl; - + #endif - pnetdev->watchdog_timeo = HZ; /* 1 second timeout */ + pnetdev->watchdog_timeo = HZ; /* 1 second timeout */ //pnetdev->wireless_handlers = NULL; #ifdef CONFIG_TCP_CSUM_OFFLOAD_TX pnetdev->features |= NETIF_F_IP_CSUM; -#endif +#endif + + - - if(dev_alloc_name(pnetdev,"mgnt.wlan%d") < 0) { - DBG_871X("hostapd_mode_init(): dev_alloc_name, fail! \n"); + DBG_871X("hostapd_mode_init(): dev_alloc_name, fail! \n"); } @@ -582,9 +582,9 @@ int hostapd_mode_init(struct adapter *padapter) mac[3]=0x87; mac[4]=0x11; mac[5]=0x12; - + _rtw_memcpy(pnetdev->dev_addr, mac, ETH_ALEN); - + netif_carrier_off(pnetdev); @@ -593,15 +593,15 @@ int hostapd_mode_init(struct adapter *padapter) if (register_netdev(pnetdev) != 0) { DBG_871X("hostapd_mode_init(): register_netdev fail!\n"); - + if(pnetdev) - { + { rtw_free_netdev(pnetdev); - } + } } - + return 0; - + } void hostapd_mode_unload(struct adapter *padapter) @@ -611,9 +611,8 @@ void hostapd_mode_unload(struct adapter *padapter) unregister_netdev(pnetdev); rtw_free_netdev(pnetdev); - + } #endif #endif - diff --git a/os_dep/os_intfs.c b/os_dep/os_intfs.c index 97e69c5..6a17a42 100755 --- a/os_dep/os_intfs.c +++ b/os_dep/os_intfs.c @@ -1,7 +1,7 @@ /****************************************************************************** * * 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. @@ -62,7 +62,7 @@ static int rtw_lbkmode = 0;//RTL8712_AIR_TRX; static int rtw_network_mode = Ndis802_11IBSS;//Ndis802_11Infrastructure;//infra, ad-hoc, auto //NDIS_802_11_SSID ssid; -static int rtw_channel = 1;//ad-hoc support requirement +static int rtw_channel = 1;//ad-hoc support requirement static int rtw_wireless_mode = WIRELESS_11BG_24N; static int rtw_vrtl_carrier_sense = AUTO_VCS; static int rtw_vcs_type = RTS_CTS;//* @@ -72,7 +72,7 @@ static int rtw_preamble = PREAMBLE_LONG;//long, short, auto static int rtw_scan_mode = 1;//active, passive static int rtw_adhoc_tx_pwr = 1; static int rtw_soft_ap = 0; -//int smart_ps = 1; +//int smart_ps = 1; #ifdef CONFIG_POWER_SAVING static int rtw_power_mgnt = 1; #ifdef CONFIG_IPS_LEVEL_2 @@ -107,7 +107,7 @@ static int rtw_software_encrypt = 0; static int rtw_software_decrypt = 0; static int rtw_acm_method = 0;// 0:By SW 1:By HW. - + static int rtw_wmm_enable = 1;// default is set to enable the wmm. static int rtw_uapsd_enable = 0; static int rtw_uapsd_max_sp = NO_LIMIT; @@ -115,7 +115,7 @@ static int rtw_uapsd_acbk_en = 0; static int rtw_uapsd_acbe_en = 0; static int rtw_uapsd_acvi_en = 0; static int rtw_uapsd_acvo_en = 0; - + #ifdef CONFIG_80211N_HT int rtw_ht_enable = 1; int rtw_cbw40_enable = 3; // 0 :diable, bit(0): enable 2.4g, bit(1): enable 5g @@ -126,7 +126,7 @@ static int rtw_ampdu_amsdu = 0;// 0: disabled, 1:enabled, 2:auto static int rtw_lowrate_two_xmit = 1;//Use 2 path Tx to transmit MCS0~7 and legacy mode -//int rf_config = RF_1T2R; // 1T2R +//int rf_config = RF_1T2R; // 1T2R static int rtw_rf_config = RF_819X_MAX_TYPE; //auto static int rtw_low_power = 0; #ifdef CONFIG_WIFI_TEST @@ -327,7 +327,7 @@ void rtw_proc_remove_one(struct net_device *dev) static uint loadparam( struct adapter *padapter, _nic_hdl pnetdev) { - + uint status = _SUCCESS; struct registry_priv *registry_par = &padapter->registrypriv; @@ -336,13 +336,13 @@ _func_enter_; GlobalDebugLevel = rtw_debug; registry_par->chip_version = (u8)rtw_chip_version; registry_par->rfintfs = (u8)rtw_rfintfs; - registry_par->lbkmode = (u8)rtw_lbkmode; + registry_par->lbkmode = (u8)rtw_lbkmode; //registry_par->hci = (u8)hci; - registry_par->network_mode = (u8)rtw_network_mode; + registry_par->network_mode = (u8)rtw_network_mode; _rtw_memcpy(registry_par->ssid.Ssid, "ANY", 3); registry_par->ssid.SsidLength = 3; - + registry_par->channel = (u8)rtw_channel; registry_par->wireless_mode = (u8)rtw_wireless_mode; registry_par->vrtl_carrier_sense = (u8)rtw_vrtl_carrier_sense ; @@ -353,25 +353,25 @@ _func_enter_; registry_par->scan_mode = (u8)rtw_scan_mode; registry_par->adhoc_tx_pwr = (u8)rtw_adhoc_tx_pwr; registry_par->soft_ap= (u8)rtw_soft_ap; - registry_par->smart_ps = (u8)rtw_smart_ps; + registry_par->smart_ps = (u8)rtw_smart_ps; registry_par->power_mgnt = (u8)rtw_power_mgnt; registry_par->ips_mode = (u8)rtw_ips_mode; registry_par->radio_enable = (u8)rtw_radio_enable; registry_par->radio_enable = (u8)rtw_radio_enable; registry_par->long_retry_lmt = (u8)rtw_long_retry_lmt; registry_par->short_retry_lmt = (u8)rtw_short_retry_lmt; - registry_par->busy_thresh = (u16)rtw_busy_thresh; - //registry_par->qos_enable = (u8)rtw_qos_enable; + registry_par->busy_thresh = (u16)rtw_busy_thresh; + //registry_par->qos_enable = (u8)rtw_qos_enable; registry_par->ack_policy = (u8)rtw_ack_policy; - registry_par->mp_mode = (u8)rtw_mp_mode; + registry_par->mp_mode = (u8)rtw_mp_mode; registry_par->software_encrypt = (u8)rtw_software_encrypt; - registry_par->software_decrypt = (u8)rtw_software_decrypt; + registry_par->software_decrypt = (u8)rtw_software_decrypt; registry_par->acm_method = (u8)rtw_acm_method; //UAPSD registry_par->wmm_enable = (u8)rtw_wmm_enable; - registry_par->uapsd_enable = (u8)rtw_uapsd_enable; + registry_par->uapsd_enable = (u8)rtw_uapsd_enable; registry_par->uapsd_max_sp = (u8)rtw_uapsd_max_sp; registry_par->uapsd_acbk_en = (u8)rtw_uapsd_acbk_en; registry_par->uapsd_acbe_en = (u8)rtw_uapsd_acbe_en; @@ -382,7 +382,7 @@ _func_enter_; registry_par->ht_enable = (u8)rtw_ht_enable; registry_par->cbw40_enable = (u8)rtw_cbw40_enable; registry_par->ampdu_enable = (u8)rtw_ampdu_enable; - registry_par->rx_stbc = (u8)rtw_rx_stbc; + registry_par->rx_stbc = (u8)rtw_rx_stbc; registry_par->ampdu_amsdu = (u8)rtw_ampdu_amsdu; #endif #ifdef CONFIG_TX_EARLY_MODE @@ -453,7 +453,7 @@ _func_enter_; registry_par->force_igi = (u8)rtw_force_igi; #endif registry_par->regulatory_tid = (u8)rtw_regulatory_id; - + _func_exit_; @@ -464,7 +464,7 @@ static int rtw_net_set_mac_address(struct net_device *pnetdev, void *p) { struct adapter *padapter = (struct adapter *)rtw_netdev_priv(pnetdev); struct sockaddr *addr = p; - + if(padapter->bup == _FALSE) { //DBG_871X("r8711_net_set_mac_address(), MAC=%x:%x:%x:%x:%x:%x\n", addr->sa_data[0], addr->sa_data[1], addr->sa_data[2], addr->sa_data[3], @@ -484,12 +484,12 @@ static struct net_device_stats *rtw_net_get_stats(struct net_device *pnetdev) struct recv_priv *precvpriv = &(padapter->recvpriv); padapter->stats.tx_packets = pxmitpriv->tx_pkts;//pxmitpriv->tx_pkts++; - padapter->stats.rx_packets = precvpriv->rx_pkts;//precvpriv->rx_pkts++; + padapter->stats.rx_packets = precvpriv->rx_pkts;//precvpriv->rx_pkts++; padapter->stats.tx_dropped = pxmitpriv->tx_drop; padapter->stats.rx_dropped = precvpriv->rx_drop; padapter->stats.tx_bytes = pxmitpriv->tx_bytes; padapter->stats.rx_bytes = precvpriv->rx_bytes; - + return &padapter->stats; } @@ -558,9 +558,9 @@ u16 rtw_recv_select_queue(struct sk_buff *skb) piphdr = (struct iphdr *)(pdata+ETH_HLEN); dscp = piphdr->tos & 0xfc; - + priority = dscp >> 5; - + break; default: priority = 0; @@ -592,7 +592,7 @@ int rtw_init_netdev_name(struct net_device *pnetdev, const char *ifname) #ifdef CONFIG_EASY_REPLACEMENT struct net_device *TargetNetdev = NULL; struct adapter *TargetAdapter = NULL; - struct net *devnet = NULL; + struct net *devnet = NULL; if(padapter->bDongle == 1) { @@ -614,7 +614,7 @@ int rtw_init_netdev_name(struct net_device *pnetdev, const char *ifname) padapter->pid[0] = TargetAdapter->pid[0]; padapter->pid[1] = TargetAdapter->pid[1]; padapter->pid[2] = TargetAdapter->pid[2]; - + dev_put(TargetNetdev); unregister_netdev(TargetNetdev); @@ -637,36 +637,36 @@ int rtw_init_netdev_name(struct net_device *pnetdev, const char *ifname) return 0; } -struct net_device *rtw_init_netdev(struct adapter *old_padapter) +struct net_device *rtw_init_netdev(struct adapter *old_padapter) { struct adapter *padapter; struct net_device *pnetdev; RT_TRACE(_module_os_intfs_c_,_drv_info_,("+init_net_dev\n")); - if(old_padapter != NULL) + if(old_padapter != NULL) pnetdev = rtw_alloc_etherdev_with_old_priv(sizeof(struct adapter), (void *)old_padapter); - else + else pnetdev = rtw_alloc_etherdev(sizeof(struct adapter)); - + if (!pnetdev) return NULL; padapter = rtw_netdev_priv(pnetdev); - padapter->pnetdev = pnetdev; + padapter->pnetdev = pnetdev; #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24) SET_MODULE_OWNER(pnetdev); #endif - + //pnetdev->init = NULL; - + #if (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,29)) DBG_871X("register rtw_netdev_ops to netdev_ops\n"); pnetdev->netdev_ops = &rtw_netdev_ops; #else pnetdev->open = netdev_open; - pnetdev->stop = netdev_close; + pnetdev->stop = netdev_close; pnetdev->hard_start_xmit = rtw_xmit_entry; pnetdev->set_mac_address = rtw_net_set_mac_address; pnetdev->get_stats = rtw_net_get_stats; @@ -676,7 +676,7 @@ struct net_device *rtw_init_netdev(struct adapter *old_padapter) #ifdef CONFIG_TCP_CSUM_OFFLOAD_TX pnetdev->features |= NETIF_F_IP_CSUM; -#endif +#endif //pnetdev->tx_timeout = NULL; pnetdev->watchdog_timeo = HZ*3; /* 3 second timeout */ #ifdef CONFIG_WIRELESS_EXT @@ -689,8 +689,8 @@ struct net_device *rtw_init_netdev(struct adapter *old_padapter) #endif //step 2. - loadparam(padapter, pnetdev); - + loadparam(padapter, pnetdev); + return pnetdev; } @@ -715,7 +715,7 @@ u32 rtw_start_drv_threads(struct adapter *padapter) #ifdef CONFIG_RECV_THREAD_MODE padapter->recvThread = kthread_run(rtw_recv_thread, padapter, "RTW_RECV_THREAD"); if(IS_ERR(padapter->recvThread)) - _status = _FAIL; + _status = _FAIL; #endif @@ -728,13 +728,13 @@ u32 rtw_start_drv_threads(struct adapter *padapter) _status = _FAIL; else _rtw_down_sema(&padapter->cmdpriv.terminate_cmdthread_sema); //wait for cmd_thread to run - } - + } + #ifdef CONFIG_EVENT_THREAD_MODE padapter->evtThread = kthread_run(event_thread, padapter, "RTW_EVENT_THREAD"); if(IS_ERR(padapter->evtThread)) - _status = _FAIL; + _status = _FAIL; #endif rtw_hal_start_thread(padapter); @@ -750,7 +750,7 @@ void rtw_unregister_netdevs(struct dvobj_priv *dvobj) for(i=0;iiface_nums;i++) { struct net_device *pnetdev = NULL; - + padapter = dvobj->padapters[i]; if (padapter == NULL) @@ -759,30 +759,30 @@ void rtw_unregister_netdevs(struct dvobj_priv *dvobj) pnetdev = padapter->pnetdev; if((padapter->DriverState != DRIVER_DISAPPEAR) && pnetdev) { - + unregister_netdev(pnetdev); //will call netdev_close() rtw_proc_remove_one(pnetdev); } -#ifdef CONFIG_IOCTL_CFG80211 +#ifdef CONFIG_IOCTL_CFG80211 rtw_wdev_unregister(padapter->rtw_wdev); #endif } - -} + +} void rtw_stop_drv_threads (struct adapter *padapter) { - RT_TRACE(_module_os_intfs_c_,_drv_info_,("+rtw_stop_drv_threads\n")); + RT_TRACE(_module_os_intfs_c_,_drv_info_,("+rtw_stop_drv_threads\n")); #ifdef CONFIG_CONCURRENT_MODE if(padapter->isprimary == _TRUE) #endif //CONFIG_CONCURRENT_MODE { rtw_stop_cmd_thread(padapter); - } + } #ifdef CONFIG_EVENT_THREAD_MODE _rtw_up_sema(&padapter->evtpriv.evt_notify); @@ -793,9 +793,9 @@ void rtw_stop_drv_threads (struct adapter *padapter) #ifdef CONFIG_XMIT_THREAD_MODE // Below is to termindate tx_thread... -#if defined(CONFIG_SDIO_HCI) && defined(CONFIG_CONCURRENT_MODE) +#if defined(CONFIG_SDIO_HCI) && defined(CONFIG_CONCURRENT_MODE) // Only wake-up primary adapter - if(padapter->adapter_type == PRIMARY_ADAPTER) + if(padapter->adapter_type == PRIMARY_ADAPTER) #endif //SDIO_HCI + CONCURRENT { _rtw_up_sema(&padapter->xmitpriv.xmit_sema); @@ -803,8 +803,8 @@ void rtw_stop_drv_threads (struct adapter *padapter) } RT_TRACE(_module_os_intfs_c_,_drv_info_,("\n drv_halt: rtw_xmit_thread can be terminated ! \n")); #endif - -#ifdef CONFIG_RECV_THREAD_MODE + +#ifdef CONFIG_RECV_THREAD_MODE // Below is to termindate rx_thread... _rtw_up_sema(&padapter->recvpriv.recv_sema); _rtw_down_sema(&padapter->recvpriv.terminate_recvthread_sema); @@ -829,11 +829,11 @@ u8 rtw_init_default_value(struct adapter *padapter) pxmitpriv->vcs_type = pregistrypriv->vcs_type; //pxmitpriv->rts_thresh = pregistrypriv->rts_thresh; pxmitpriv->frag_len = pregistrypriv->frag_thresh; - - + + //recv_priv - + //mlme_priv pmlmepriv->scan_interval = SCAN_INTERVAL;// 30*2 sec = 60sec @@ -841,18 +841,18 @@ u8 rtw_init_default_value(struct adapter *padapter) //qos_priv //pmlmepriv->qospriv.qos_option = pregistrypriv->wmm_enable; - + //ht_priv -#ifdef CONFIG_80211N_HT +#ifdef CONFIG_80211N_HT pmlmepriv->htpriv.ampdu_enable = _FALSE;//set to disabled -#endif +#endif //security_priv //rtw_get_encrypt_decrypt_from_registrypriv(padapter); psecuritypriv->binstallGrpkey = _FAIL; psecuritypriv->sw_encrypt=pregistrypriv->software_encrypt; psecuritypriv->sw_decrypt=pregistrypriv->software_decrypt; - + psecuritypriv->dot11AuthAlgrthm = dot11AuthAlgrthm_Open; //open system psecuritypriv->dot11PrivacyAlgrthm = _NO_PRIVACY_; @@ -863,13 +863,13 @@ u8 rtw_init_default_value(struct adapter *padapter) psecuritypriv->ndisauthtype = Ndis802_11AuthModeOpen; psecuritypriv->ndisencryptstatus = Ndis802_11WEPDisabled; - + //pwrctrl_priv //registry_priv - rtw_init_registrypriv_dev_network(padapter); + rtw_init_registrypriv_dev_network(padapter); rtw_update_registrypriv_dev_network(padapter); @@ -890,7 +890,7 @@ u8 rtw_init_default_value(struct adapter *padapter) u8 rtw_reset_drv_sw(struct adapter *padapter) { - u8 ret8=_SUCCESS; + u8 ret8=_SUCCESS; struct mlme_priv *pmlmepriv= &padapter->mlmepriv; struct pwrctrl_priv *pwrctrlpriv = adapter_to_pwrctl(padapter); @@ -908,7 +908,7 @@ u8 rtw_reset_drv_sw(struct adapter *padapter) _clr_fwstate_(pmlmepriv, _FW_UNDER_SURVEY |_FW_UNDER_LINKING); -#ifdef CONFIG_AUTOSUSPEND +#ifdef CONFIG_AUTOSUSPEND #if (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,22) && LINUX_VERSION_CODE<=KERNEL_VERSION(2,6,34)) adapter_to_dvobj(padapter)->pusbdev->autosuspend_disabled = 1;//autosuspend disabled by the user #endif @@ -945,17 +945,17 @@ _func_enter_; ret8=_FAIL; goto exit; } - + padapter->cmdpriv.padapter=padapter; - + if ((rtw_init_evt_priv(&padapter->evtpriv)) == _FAIL) { RT_TRACE(_module_os_intfs_c_,_drv_err_,("\n Can't init evt_priv\n")); ret8=_FAIL; goto exit; } - - + + if (rtw_init_mlme_priv(padapter) == _FAIL) { RT_TRACE(_module_os_intfs_c_,_drv_err_,("\n Can't init mlme_priv\n")); @@ -998,7 +998,7 @@ _func_enter_; ret8=_FAIL; goto exit; } - + if(_rtw_init_recv_priv(&padapter->recvpriv, padapter) == _FAIL) { DBG_871X("Can't _rtw_init_recv_priv\n"); @@ -1007,10 +1007,10 @@ _func_enter_; } // add for CONFIG_IEEE80211W, none 11w also can use _rtw_spinlock_init(&padapter->security_key_mutex); - + // We don't need to memset padapter->XXX to zero, because adapter is allocated by rtw_zvmalloc(). - //_rtw_memset((unsigned char *)&padapter->securitypriv, 0, sizeof (struct security_priv)); - + //_rtw_memset((unsigned char *)&padapter->securitypriv, 0, sizeof (struct security_priv)); + //_init_timer(&(padapter->securitypriv.tkip_timer), padapter->pifp, rtw_use_tkipkey_handler, padapter); if(_rtw_init_sta_priv(&padapter->stapriv) == _FAIL) @@ -1019,13 +1019,13 @@ _func_enter_; ret8=_FAIL; goto exit; } - - padapter->stapriv.padapter = padapter; - padapter->setband = GHZ24_50; + + padapter->stapriv.padapter = padapter; + padapter->setband = GHZ24_50; padapter->fix_rate = 0xFF; rtw_init_bcmc_stainfo(padapter); - rtw_init_pwrctrl_priv(padapter); + rtw_init_pwrctrl_priv(padapter); ret8 = rtw_init_default_value(padapter); @@ -1055,13 +1055,13 @@ _func_enter_; #endif // CONFIG_BR_EXT exit: - + RT_TRACE(_module_os_intfs_c_,_drv_info_,("-rtw_init_drv_sw\n")); - _func_exit_; - + _func_exit_; + return ret8; - + } #ifdef CONFIG_WOWLAN @@ -1083,8 +1083,8 @@ void rtw_cancel_all_timer(struct adapter *padapter) //RT_TRACE(_module_os_intfs_c_,_drv_info_,("rtw_cancel_all_timer:cancel tkip_timer! \n")); _cancel_timer_ex(&padapter->mlmepriv.scan_to_timer); - RT_TRACE(_module_os_intfs_c_,_drv_info_,("rtw_cancel_all_timer:cancel scan_to_timer! \n")); - + RT_TRACE(_module_os_intfs_c_,_drv_info_,("rtw_cancel_all_timer:cancel scan_to_timer! \n")); + _cancel_timer_ex(&padapter->mlmepriv.dynamic_chk_timer); RT_TRACE(_module_os_intfs_c_,_drv_info_,("rtw_cancel_all_timer:cancel dynamic_chk_timer! \n")); @@ -1117,9 +1117,9 @@ void rtw_cancel_all_timer(struct adapter *padapter) #if defined(CONFIG_CHECK_BT_HANG) && defined(CONFIG_BT_COEXIST) if (padapter->HalFunc.hal_cancel_checkbthang_workqueue) padapter->HalFunc.hal_cancel_checkbthang_workqueue(padapter); -#endif +#endif //cancel dm timer - rtw_hal_dm_deinit(padapter); + rtw_hal_dm_deinit(padapter); } @@ -1153,7 +1153,7 @@ u8 rtw_free_drv_sw(struct adapter *padapter) #endif // add for CONFIG_IEEE80211W, none 11w also can use _rtw_spinlock_free(&padapter->security_key_mutex); - + #ifdef CONFIG_BR_EXT _rtw_spinlock_free(&padapter->br_ext_lock); #endif // CONFIG_BR_EXT @@ -1163,27 +1163,27 @@ u8 rtw_free_drv_sw(struct adapter *padapter) #endif //CONFIG_INTEL_WIDI free_mlme_ext_priv(&padapter->mlmeextpriv); - + #ifdef CONFIG_TDLS //rtw_free_tdls_info(&padapter->tdlsinfo); #endif //CONFIG_TDLS - + rtw_free_cmd_priv(&padapter->cmdpriv); - + rtw_free_evt_priv(&padapter->evtpriv); rtw_free_mlme_priv(&padapter->mlmepriv); -#if defined(CONFIG_CHECK_BT_HANG) && defined(CONFIG_BT_COEXIST) +#if defined(CONFIG_CHECK_BT_HANG) && defined(CONFIG_BT_COEXIST) if (padapter->HalFunc.hal_free_checkbthang_workqueue) padapter->HalFunc.hal_free_checkbthang_workqueue(padapter); -#endif +#endif //free_io_queue(padapter); - + _rtw_free_xmit_priv(&padapter->xmitpriv); - + _rtw_free_sta_priv(&padapter->stapriv); //will free bcmc_stainfo here - - _rtw_free_recv_priv(&padapter->recvpriv); + + _rtw_free_recv_priv(&padapter->recvpriv); rtw_free_pwrctrl_priv(padapter); @@ -1201,7 +1201,7 @@ u8 rtw_free_drv_sw(struct adapter *padapter) if(padapter->rereg_nd_name_priv.old_pnetdev) { free_netdev(padapter->rereg_nd_name_priv.old_pnetdev); padapter->rereg_nd_name_priv.old_pnetdev = NULL; - } + } // clear pbuddy_adapter to avoid access wrong pointer. if(padapter->pbuddy_adapter != NULL) { @@ -1211,12 +1211,12 @@ u8 rtw_free_drv_sw(struct adapter *padapter) RT_TRACE(_module_os_intfs_c_,_drv_info_,("-rtw_free_drv_sw\n")); return _SUCCESS; - + } #ifdef CONFIG_CONCURRENT_MODE int _netdev_if2_open(struct net_device *pnetdev) -{ +{ struct adapter *padapter = (struct adapter *)rtw_netdev_priv(pnetdev); struct adapter *primary_padapter = padapter->pbuddy_adapter; @@ -1227,24 +1227,24 @@ int _netdev_if2_open(struct net_device *pnetdev) _netdev_open(primary_padapter->pnetdev); } - if(padapter->bup == _FALSE && primary_padapter->bup == _TRUE && + if(padapter->bup == _FALSE && primary_padapter->bup == _TRUE && primary_padapter->hw_init_completed == _TRUE) { int i; - + padapter->bDriverStopped = _FALSE; - padapter->bSurpriseRemoved = _FALSE; + padapter->bSurpriseRemoved = _FALSE; padapter->bCardDisableWOHSM = _FALSE; - + padapter->bFWReady = primary_padapter->bFWReady; - + //if (init_mlme_ext_priv(padapter) == _FAIL) - // goto netdev_if2_open_error; + // goto netdev_if2_open_error; if(rtw_start_drv_threads(padapter) == _FAIL) { - goto netdev_if2_open_error; + goto netdev_if2_open_error; } @@ -1252,7 +1252,7 @@ int _netdev_if2_open(struct net_device *pnetdev) { padapter->intf_start(padapter); } - + rtw_proc_init_one(pnetdev); @@ -1261,7 +1261,7 @@ int _netdev_if2_open(struct net_device *pnetdev) #endif padapter->bup = _TRUE; - + } padapter->net_closed = _FALSE; @@ -1279,11 +1279,11 @@ int _netdev_if2_open(struct net_device *pnetdev) netdev_if2_open_error: padapter->bup = _FALSE; - - netif_carrier_off(pnetdev); + + netif_carrier_off(pnetdev); rtw_netif_stop_queue(pnetdev); - - return (-1); + + return (-1); } @@ -1291,7 +1291,7 @@ int netdev_if2_open(struct net_device *pnetdev) { int ret; struct adapter *padapter = (struct adapter *)rtw_netdev_priv(pnetdev); - + _enter_critical_mutex(&(adapter_to_dvobj(padapter)->hw_init_mutex), NULL); ret = _netdev_if2_open(pnetdev); _exit_critical_mutex(&(adapter_to_dvobj(padapter)->hw_init_mutex), NULL); @@ -1304,7 +1304,7 @@ static int netdev_if2_close(struct net_device *pnetdev) padapter->net_closed = _TRUE; - if(pnetdev) + if(pnetdev) { if (!rtw_netif_queue_stopped(pnetdev)) rtw_netif_stop_queue(pnetdev); @@ -1328,7 +1328,7 @@ static const struct net_device_ops rtw_netdev_if2_ops = { .ndo_do_ioctl = rtw_ioctl, #if (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,35)) .ndo_select_queue = rtw_select_queue, -#endif +#endif }; #endif @@ -1349,7 +1349,7 @@ struct adapter *rtw_drv_if2_init(struct adapter *primary_padapter, void (*set_in /****** init netdev ******/ pnetdev = rtw_init_netdev(NULL); - if (!pnetdev) + if (!pnetdev) goto error_rtw_drv_if2_init; #if (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,29)) @@ -1359,7 +1359,7 @@ struct adapter *rtw_drv_if2_init(struct adapter *primary_padapter, void (*set_in pnetdev->open = netdev_if2_open; pnetdev->stop = netdev_if2_close; #endif - + #ifdef CONFIG_NO_WIRELESS_HANDLERS pnetdev->wireless_handlers = NULL; #endif @@ -1382,7 +1382,7 @@ struct adapter *rtw_drv_if2_init(struct adapter *primary_padapter, void (*set_in padapter->iface_id = IFACE_ID1; #ifndef CONFIG_HWPORT_SWAP //Port0 -> Pri , Port1 -> Sec padapter->iface_type = IFACE_PORT1; -#else +#else padapter->iface_type = IFACE_PORT0; #endif //CONFIG_HWPORT_SWAP // @@ -1399,17 +1399,17 @@ struct adapter *rtw_drv_if2_init(struct adapter *primary_padapter, void (*set_in #endif //CONFIG_IOCTL_CFG80211 //set interface_type/chip_type/HardwareType - padapter->interface_type = primary_padapter->interface_type; + padapter->interface_type = primary_padapter->interface_type; padapter->chip_type = primary_padapter->chip_type; padapter->HardwareType = primary_padapter->HardwareType; - + //step 2. hook HalFunc, allocate HalData hal_set_hal_ops(padapter); - + padapter->HalFunc.inirp_init = NULL; padapter->HalFunc.inirp_deinit = NULL; - // + // padapter->intf_start = primary_padapter->intf_start; padapter->intf_stop = primary_padapter->intf_stop; @@ -1431,7 +1431,7 @@ struct adapter *rtw_drv_if2_init(struct adapter *primary_padapter, void (*set_in //get mac address from primary_padapter _rtw_memcpy(mac, primary_padapter->eeprompriv.mac_addr, ETH_ALEN); - + if (((mac[0]==0xff) &&(mac[1]==0xff) && (mac[2]==0xff) && (mac[3]==0xff) && (mac[4]==0xff) &&(mac[5]==0xff)) || ((mac[0]==0x0) && (mac[1]==0x0) && (mac[2]==0x0) && @@ -1446,10 +1446,10 @@ struct adapter *rtw_drv_if2_init(struct adapter *primary_padapter, void (*set_in } else { - //If the BIT1 is 0, the address is universally administered. + //If the BIT1 is 0, the address is universally administered. //If it is 1, the address is locally administered mac[0] |= BIT(1); // locally administered - + } _rtw_memcpy(padapter->eeprompriv.mac_addr, mac, ETH_ALEN); @@ -1461,17 +1461,17 @@ struct adapter *rtw_drv_if2_init(struct adapter *primary_padapter, void (*set_in return padapter; - + error_rtw_drv_if2_init: if(padapter) - rtw_free_drv_sw(padapter); + rtw_free_drv_sw(padapter); if (pnetdev) rtw_free_netdev(pnetdev); return NULL; - + } void rtw_drv_if2_free(struct adapter *if2) @@ -1488,7 +1488,7 @@ void rtw_drv_if2_free(struct adapter *if2) rtw_wdev_free(padapter->rtw_wdev); #endif /* CONFIG_IOCTL_CFG80211 */ - + rtw_free_drv_sw(padapter); rtw_free_netdev(pnetdev); @@ -1518,14 +1518,14 @@ void rtw_drv_if2_stop(struct adapter *if2) if (padapter->xmitpriv.ack_tx) rtw_ack_tx_done(&padapter->xmitpriv, RTW_SCTX_DONE_DRV_STOP); #endif - + if(padapter->intf_stop) { padapter->intf_stop(padapter); } rtw_stop_drv_threads(padapter); - + padapter->bup = _FALSE; } /* @@ -1540,7 +1540,7 @@ void rtw_drv_if2_stop(struct adapter *if2) void netdev_br_init(struct net_device *netdev) { struct adapter *adapter = (struct adapter *)rtw_netdev_priv(netdev); - + #if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 35)) rcu_read_lock(); #endif // (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 35)) @@ -1549,7 +1549,7 @@ void netdev_br_init(struct net_device *netdev) { //struct net_bridge *br = netdev->br_port->br;//->dev->dev_addr; #if (LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 35)) - if (netdev->br_port) + if (netdev->br_port) #else // (LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 35)) if (rcu_dereference(adapter->pnetdev->rx_handler_data)) #endif // (LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 35)) @@ -1575,7 +1575,7 @@ void netdev_br_init(struct net_device *netdev) } else DBG_871X("%s()-%d: dev_get_by_name(%s) failed!", __FUNCTION__, __LINE__, CONFIG_BR_EXT_BRNAME); } - + adapter->ethBrExtInfo.addPPPoETag = 1; } @@ -1652,7 +1652,7 @@ int rtw_drv_register_netdev(struct adapter *if1) int _netdev_open(struct net_device *pnetdev) { - uint status; + uint status; struct adapter *padapter = (struct adapter *)rtw_netdev_priv(pnetdev); struct pwrctrl_priv *pwrctrlpriv = adapter_to_pwrctl(padapter); @@ -1667,27 +1667,27 @@ int _netdev_open(struct net_device *pnetdev) if(padapter->bup == _FALSE) { padapter->bDriverStopped = _FALSE; - padapter->bSurpriseRemoved = _FALSE; + padapter->bSurpriseRemoved = _FALSE; padapter->bCardDisableWOHSM = _FALSE; status = rtw_hal_init(padapter); if (status ==_FAIL) - { + { RT_TRACE(_module_os_intfs_c_,_drv_err_,("rtl871x_hal_init(): Can't init h/w!\n")); goto netdev_open_error; } - + DBG_871X("MAC Address = "MAC_FMT"\n", MAC_ARG(pnetdev->dev_addr)); #ifdef CONFIG_RF_GAIN_OFFSET - rtw_bb_rf_gain_offset(padapter); + rtw_bb_rf_gain_offset(padapter); #endif //CONFIG_RF_GAIN_OFFSET status=rtw_start_drv_threads(padapter); if(status ==_FAIL) - { + { DBG_871X("Initialize driver software resource Failed!\n"); - goto netdev_open_error; + goto netdev_open_error; } #ifdef CONFIG_DRVEXT_MODULE @@ -1710,8 +1710,8 @@ int _netdev_open(struct net_device *pnetdev) rtw_led_control(padapter, LED_CTL_NO_LINK); padapter->bup = _TRUE; - - pwrctrlpriv->bips_processing = _FALSE; + + pwrctrlpriv->bips_processing = _FALSE; } padapter->net_closed = _FALSE; @@ -1745,28 +1745,28 @@ netdev_open_normal_process: RT_TRACE(_module_os_intfs_c_,_drv_info_,("-871x_drv - dev_open\n")); DBG_871X("-871x_drv - drv_open, bup=%d\n", padapter->bup); - + return 0; - + netdev_open_error: padapter->bup = _FALSE; - - netif_carrier_off(pnetdev); + + netif_carrier_off(pnetdev); rtw_netif_stop_queue(pnetdev); - + RT_TRACE(_module_os_intfs_c_,_drv_err_,("-871x_drv - dev_open, fail!\n")); DBG_871X("-871x_drv - drv_open fail, bup=%d\n", padapter->bup); - + return (-1); - + } int netdev_open(struct net_device *pnetdev) { int ret; struct adapter *padapter = (struct adapter *)rtw_netdev_priv(pnetdev); - + _enter_critical_mutex(&(adapter_to_dvobj(padapter)->hw_init_mutex), NULL); ret = _netdev_open(pnetdev); _exit_critical_mutex(&(adapter_to_dvobj(padapter)->hw_init_mutex), NULL); @@ -1792,9 +1792,9 @@ static int ips_netdrv_open(struct adapter *padapter) RT_TRACE(_module_os_intfs_c_,_drv_err_,("ips_netdrv_open(): Can't init h/w!\n")); goto netdev_open_error; } - + #ifdef CONFIG_RF_GAIN_OFFSET - rtw_bb_rf_gain_offset(padapter); + rtw_bb_rf_gain_offset(padapter); #endif //CONFIG_RF_GAIN_OFFSET if(padapter->intf_start) @@ -1803,7 +1803,7 @@ static int ips_netdrv_open(struct adapter *padapter) } rtw_set_pwr_state_check_timer(adapter_to_pwrctl(padapter)); - _set_timer(&padapter->mlmepriv.dynamic_chk_timer,5000); + _set_timer(&padapter->mlmepriv.dynamic_chk_timer,5000); return _SUCCESS; @@ -1816,7 +1816,7 @@ netdev_open_error: int rtw_ips_pwr_up(struct adapter *padapter) -{ +{ int result; u32 start_time = rtw_get_current_time(); DBG_871X("===> rtw_ips_pwr_up..............\n"); @@ -1825,8 +1825,8 @@ int rtw_ips_pwr_up(struct adapter *padapter) result = ips_netdrv_open(padapter); rtw_led_control(padapter, LED_CTL_NO_LINK); - - DBG_871X("<=== rtw_ips_pwr_up.............. in %dms\n", rtw_get_passing_time_ms(start_time)); + + DBG_871X("<=== rtw_ips_pwr_up.............. in %dms\n", rtw_get_passing_time_ms(start_time)); return result; } @@ -1840,7 +1840,7 @@ void rtw_ips_pwr_down(struct adapter *padapter) padapter->net_closed = _TRUE; rtw_led_control(padapter, LED_CTL_POWER_OFF); - + rtw_ips_dev_unload(padapter); padapter->bCardDisableWOHSM = _FALSE; DBG_871X("<=== rtw_ips_pwr_down..................... in %dms\n", rtw_get_passing_time_ms(start_time)); @@ -1917,7 +1917,7 @@ static int netdev_close(struct net_device *pnetdev) { struct adapter *padapter = (struct adapter *)rtw_netdev_priv(pnetdev); - RT_TRACE(_module_os_intfs_c_,_drv_info_,("+871x_drv - drv_close\n")); + RT_TRACE(_module_os_intfs_c_,_drv_info_,("+871x_drv - drv_close\n")); if(adapter_to_pwrctl(padapter)->bInternalAutoSuspend == _TRUE) { @@ -1940,7 +1940,7 @@ static int netdev_close(struct net_device *pnetdev) DBG_871X("(2)871x_drv - drv_close, bup=%d, hw_init_completed=%d\n", padapter->bup, padapter->hw_init_completed); //s1. - if(pnetdev) + if(pnetdev) { if (!rtw_netif_queue_stopped(pnetdev)) rtw_netif_stop_queue(pnetdev); @@ -1952,7 +1952,7 @@ static int netdev_close(struct net_device *pnetdev) rtw_disassoc_cmd(padapter, 500, _FALSE); //s2-2. indicate disconnect to os rtw_indicate_disconnect(padapter); - //s2-3. + //s2-3. rtw_free_assoc_resources(padapter, 1); //s2-4. rtw_free_network_queue(padapter,_TRUE); @@ -1962,7 +1962,7 @@ static int netdev_close(struct net_device *pnetdev) } #ifdef CONFIG_BR_EXT - //if (OPMODE & (WIFI_STATION_STATE | WIFI_ADHOC_STATE)) + //if (OPMODE & (WIFI_STATION_STATE | WIFI_ADHOC_STATE)) { //void nat25_db_cleanup(struct adapter *priv); nat25_db_cleanup(padapter); @@ -1987,7 +1987,7 @@ static int netdev_close(struct net_device *pnetdev) DBG_871X("-871x_drv - drv_close, bup=%d\n", padapter->bup); return 0; - + } void rtw_ndev_destructor(struct net_device *ndev) @@ -2022,7 +2022,7 @@ static void parse_routes(struct nlmsghdr *nl_hdr, struct route_info *rt_info) rt_attr = (struct rtattr *) RTM_RTA(rt_msg); rt_len = RTM_PAYLOAD(nl_hdr); - for (; RTA_OK(rt_attr, rt_len); rt_attr = RTA_NEXT(rt_attr, rt_len)) + for (; RTA_OK(rt_attr, rt_len); rt_attr = RTA_NEXT(rt_attr, rt_len)) { switch (rt_attr->rta_type) { case RTA_OIF: @@ -2062,7 +2062,7 @@ static int route_dump(u32 *gw_addr ,int* gw_index) printk( ": Could not create a datagram socket, error = %d\n", -ENXIO); return err; } - + memset(&nladdr, 0, sizeof(nladdr)); nladdr.nl_family = AF_NETLINK; @@ -2100,7 +2100,7 @@ static int route_dump(u32 *gw_addr ,int* gw_index) restart: #endif - for (;;) + for (;;) { struct nlmsghdr *h; @@ -2120,8 +2120,8 @@ restart: } h = (struct nlmsghdr*) pg; - - while (NLMSG_OK(h, err)) + + while (NLMSG_OK(h, err)) { struct route_info rt_info; if (h->nlmsg_type == NLMSG_DONE) { @@ -2152,12 +2152,12 @@ restart: { *gw_addr = rt_info.gateway.s_addr; *gw_index = rt_info.dev_index; - + } h = NLMSG_NEXT(h, err); } - if (err) + if (err) { printk( "!!!Remnant of size %d %d %d\n", err, h->nlmsg_len, h->nlmsg_type); err = -EINVAL; @@ -2221,7 +2221,7 @@ static int get_defaultgw(u32 *ip_addr ,char mac[]) { int gw_index = 0; // oif device index struct net_device *gw_dev = NULL; //oif device - + route_dump(ip_addr, &gw_index); if( !(*ip_addr) || !gw_index ) @@ -2237,16 +2237,16 @@ static int get_defaultgw(u32 *ip_addr ,char mac[]) //DBG_871X("get Oif Device Fail \n"); return -1; } - + if(!arp_query(mac, *ip_addr, gw_dev)) { //DBG_871X( "arp query failed\n"); dev_put(gw_dev); return -1; - + } dev_put(gw_dev); - + return 0; } @@ -2275,7 +2275,7 @@ int rtw_gw_addr_query(struct adapter *padapter) } return res; -} +} #endif static int rtw_suspend_free_assoc_resource(struct adapter *padapter) @@ -2285,12 +2285,12 @@ static int rtw_suspend_free_assoc_resource(struct adapter *padapter) struct wifidirect_info* pwdinfo = &padapter->wdinfo; DBG_871X("==> "FUNC_ADPT_FMT" entry....\n", FUNC_ADPT_ARG(padapter)); - + rtw_cancel_all_timer(padapter); if(pnetdev){ netif_carrier_off(pnetdev); rtw_netif_stop_queue(pnetdev); - } + } #ifdef CONFIG_LAYER2_ROAMING_RESUME if(check_fwstate(pmlmepriv, WIFI_STATION_STATE) && check_fwstate(pmlmepriv, _FW_LINKED) && rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) @@ -2305,11 +2305,11 @@ static int rtw_suspend_free_assoc_resource(struct adapter *padapter) #endif //CONFIG_LAYER2_ROAMING_RESUME if(check_fwstate(pmlmepriv, WIFI_STATION_STATE) && check_fwstate(pmlmepriv, _FW_LINKED)) - { - rtw_disassoc_cmd(padapter, 0, _FALSE); + { + rtw_disassoc_cmd(padapter, 0, _FALSE); } #ifdef CONFIG_AP_MODE - else if(check_fwstate(pmlmepriv, WIFI_AP_STATE)) + else if(check_fwstate(pmlmepriv, WIFI_AP_STATE)) { rtw_sta_flush(padapter); } @@ -2318,7 +2318,7 @@ static int rtw_suspend_free_assoc_resource(struct adapter *padapter) //s2-2. indicate disconnect to os rtw_indicate_disconnect(padapter); } - + //s2-3. rtw_free_assoc_resources(padapter, 1); @@ -2330,7 +2330,7 @@ static int rtw_suspend_free_assoc_resource(struct adapter *padapter) if(check_fwstate(pmlmepriv, _FW_UNDER_SURVEY)) rtw_indicate_scan_done(padapter, 1); - + DBG_871X("==> "FUNC_ADPT_FMT" exit....\n", FUNC_ADPT_ARG(padapter)); return 0; } @@ -2339,11 +2339,11 @@ int rtw_suspend_common(struct adapter *padapter) { struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter); struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - + int ret = 0; _func_enter_; LeaveAllPowerSaveMode(padapter); - + rtw_suspend_free_assoc_resource(padapter); #ifdef CONFIG_CONCURRENT_MODE @@ -2352,7 +2352,7 @@ int rtw_suspend_common(struct adapter *padapter) } #endif rtw_led_control(padapter, LED_CTL_POWER_OFF); - + #ifdef CONFIG_CONCURRENT_MODE if(rtw_buddy_adapter_up(padapter)){ rtw_dev_unload(padapter->pbuddy_adapter); @@ -2392,13 +2392,13 @@ int rtw_resume_common(struct adapter *padapter) netif_device_attach(pnetdev); netif_carrier_on(pnetdev); - + #ifdef CONFIG_CONCURRENT_MODE - if(rtw_buddy_adapter_up(padapter)){ - pnetdev = padapter->pbuddy_adapter->pnetdev; - + if(rtw_buddy_adapter_up(padapter)){ + pnetdev = padapter->pbuddy_adapter->pnetdev; + netif_device_attach(pnetdev); - netif_carrier_on(pnetdev); + netif_carrier_on(pnetdev); } #endif @@ -2408,7 +2408,7 @@ int rtw_resume_common(struct adapter *padapter) #ifdef CONFIG_LAYER2_ROAMING_RESUME rtw_roaming(padapter, NULL); #endif //CONFIG_LAYER2_ROAMING_RESUME - + } else if (check_fwstate(mlmepriv, WIFI_AP_STATE)) { DBG_871X(FUNC_ADPT_FMT" fwstate:0x%08x - WIFI_AP_STATE\n", FUNC_ADPT_ARG(padapter), get_fwstate(mlmepriv)); rtw_ap_restore_network(padapter); @@ -2420,15 +2420,15 @@ int rtw_resume_common(struct adapter *padapter) #ifdef CONFIG_CONCURRENT_MODE if(rtw_buddy_adapter_up(padapter)) - { - mlmepriv = &padapter->pbuddy_adapter->mlmepriv; + { + mlmepriv = &padapter->pbuddy_adapter->mlmepriv; if (check_fwstate(mlmepriv, WIFI_STATION_STATE)) { DBG_871X(FUNC_ADPT_FMT" fwstate:0x%08x - WIFI_STATION_STATE\n", FUNC_ADPT_ARG(padapter), get_fwstate(mlmepriv)); #ifdef CONFIG_LAYER2_ROAMING_RESUME rtw_roaming(padapter->pbuddy_adapter, NULL); #endif //CONFIG_LAYER2_ROAMING_RESUME - + } else if (check_fwstate(mlmepriv, WIFI_AP_STATE)) { DBG_871X(FUNC_ADPT_FMT" fwstate:0x%08x - WIFI_AP_STATE\n", FUNC_ADPT_ARG(padapter), get_fwstate(mlmepriv)); rtw_ap_restore_network(padapter->pbuddy_adapter); @@ -2439,7 +2439,7 @@ int rtw_resume_common(struct adapter *padapter) } } #endif - + _func_exit_; return ret; } diff --git a/os_dep/osdep_service.c b/os_dep/osdep_service.c index 455ee31..eec9814 100755 --- a/os_dep/osdep_service.c +++ b/os_dep/osdep_service.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Copyright(c) 2007 - 2012 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. @@ -65,22 +65,22 @@ u32 rtw_atoi(u8* s) { if(s[i] >= '0' && s[i] <= '9') num = num * 10 + s[i] -'0'; - else if(s[0] == '-' && i==0) + else if(s[0] == '-' && i==0) flag =1; - else + else break; } if(flag == 1) num = num * -1; - return(num); + return(num); } inline u8* _rtw_vmalloc(u32 sz) { - u8 *pbuf; + u8 *pbuf; pbuf = vmalloc(sz); #ifdef DBG_MEMORY_LEAK if ( pbuf != NULL) { @@ -89,16 +89,16 @@ inline u8* _rtw_vmalloc(u32 sz) } #endif /* DBG_MEMORY_LEAK */ - return pbuf; + return pbuf; } inline u8* _rtw_zvmalloc(u32 sz) { - u8 *pbuf; + u8 *pbuf; pbuf = _rtw_vmalloc(sz); if (pbuf != NULL) memset(pbuf, 0, sz); - return pbuf; + return pbuf; } inline void _rtw_vmfree(u8 *pbuf, u32 sz) @@ -113,14 +113,14 @@ inline void _rtw_vmfree(u8 *pbuf, u32 sz) u8* _rtw_malloc(u32 sz) { - u8 *pbuf=NULL; + u8 *pbuf=NULL; #ifdef RTK_DMP_PLATFORM if(sz > 0x4000) pbuf = (u8 *)dvr_malloc(sz); else -#endif - pbuf = kmalloc(sz,in_interrupt() ? GFP_ATOMIC : GFP_KERNEL); +#endif + pbuf = kmalloc(sz,in_interrupt() ? GFP_ATOMIC : GFP_KERNEL); #ifdef DBG_MEMORY_LEAK if ( pbuf != NULL) { @@ -129,21 +129,21 @@ u8* _rtw_malloc(u32 sz) } #endif /* DBG_MEMORY_LEAK */ - return pbuf; - + return pbuf; + } u8* _rtw_zmalloc(u32 sz) { - u8 *pbuf = _rtw_malloc(sz); + u8 *pbuf = _rtw_malloc(sz); if (pbuf != NULL) { memset(pbuf, 0, sz); } - return pbuf; + return pbuf; } void _rtw_mfree(u8 *pbuf, u32 sz) @@ -159,7 +159,7 @@ void _rtw_mfree(u8 *pbuf, u32 sz) atomic_dec(&_malloc_cnt); atomic_sub(sz, &_malloc_size); #endif /* DBG_MEMORY_LEAK */ - + } inline struct sk_buff *_rtw_skb_alloc(u32 sz) @@ -209,7 +209,7 @@ inline void *_rtw_usb_buffer_alloc(struct usb_device *dev, size_t size, dma_addr inline void _rtw_usb_buffer_free(struct usb_device *dev, size_t size, void *addr, dma_addr_t dma) { #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35)) - usb_free_coherent(dev, size, addr, dma); + usb_free_coherent(dev, size, addr, dma); #else usb_buffer_free(dev, size, addr, dma); #endif @@ -220,7 +220,7 @@ inline void _rtw_usb_buffer_free(struct usb_device *dev, size_t size, void *addr struct rtw_mem_stat { ATOMIC_T alloc; // the memory bytes we allocate currently - ATOMIC_T peak; // the peak memory bytes we allocate + ATOMIC_T peak; // the peak memory bytes we allocate ATOMIC_T alloc_cnt; // the alloc count for alloc currently ATOMIC_T alloc_err_cnt; // the error times we fail to allocate memory }; @@ -250,7 +250,7 @@ int _rtw_mstat_dump(char *buf, int len) int i; int value_t[4][mstat_tf_idx(MSTAT_TYPE_MAX)]; int value_f[4][mstat_ff_idx(MSTAT_FUNC_MAX)]; - + int vir_alloc, vir_peak, vir_alloc_err, phy_alloc, phy_peak, phy_alloc_err; int tx_alloc, tx_peak, tx_alloc_err, rx_alloc, rx_peak, rx_alloc_err; @@ -358,7 +358,7 @@ inline u8* dbg_rtw_vmalloc(u32 sz, const enum mstat_f flags, const char *func, c { u8 *p; //DBG_871X("DBG_MEM_ALLOC %s:%d %s(%d)\n", func, line, __FUNCTION__, (sz)); - + p=_rtw_vmalloc((sz)); rtw_mstat_update( @@ -366,16 +366,16 @@ inline u8* dbg_rtw_vmalloc(u32 sz, const enum mstat_f flags, const char *func, c , p ? MSTAT_ALLOC_SUCCESS : MSTAT_ALLOC_FAIL , sz ); - + return p; } inline u8* dbg_rtw_zvmalloc(u32 sz, const enum mstat_f flags, const char *func, const int line) { u8 *p; - //DBG_871X("DBG_MEM_ALLOC %s:%d %s(%d)\n", func, line, __FUNCTION__, (sz)); - - p=_rtw_zvmalloc((sz)); + //DBG_871X("DBG_MEM_ALLOC %s:%d %s(%d)\n", func, line, __FUNCTION__, (sz)); + + p=_rtw_zvmalloc((sz)); rtw_mstat_update( flags @@ -389,8 +389,8 @@ inline u8* dbg_rtw_zvmalloc(u32 sz, const enum mstat_f flags, const char *func, inline void dbg_rtw_vmfree(u8 *pbuf, u32 sz, const enum mstat_f flags, const char *func, const int line) { //DBG_871X("DBG_MEM_ALLOC %s:%d %s(%p,%d)\n", func, line, __FUNCTION__, (pbuf), (sz)); - - _rtw_vmfree((pbuf), (sz)); + + _rtw_vmfree((pbuf), (sz)); rtw_mstat_update( flags @@ -399,18 +399,18 @@ inline void dbg_rtw_vmfree(u8 *pbuf, u32 sz, const enum mstat_f flags, const cha ); } -inline u8* dbg_rtw_malloc(u32 sz, const enum mstat_f flags, const char *func, const int line) +inline u8* dbg_rtw_malloc(u32 sz, const enum mstat_f flags, const char *func, const int line) { u8 *p; - //if(sz>=153 && sz<=306) + //if(sz>=153 && sz<=306) // DBG_871X("DBG_MEM_ALLOC %s:%d %s(%d)\n", func, line, __FUNCTION__, (sz)); - //if((sz)>4096) - // DBG_871X("DBG_MEM_ALLOC %s:%d %s(%d)\n", func, line, __FUNCTION__, (sz)); + //if((sz)>4096) + // DBG_871X("DBG_MEM_ALLOC %s:%d %s(%d)\n", func, line, __FUNCTION__, (sz)); p=_rtw_malloc((sz)); - + rtw_mstat_update( flags , p ? MSTAT_ALLOC_SUCCESS : MSTAT_ALLOC_FAIL @@ -424,7 +424,7 @@ inline u8* dbg_rtw_zmalloc(u32 sz, const enum mstat_f flags, const char *func, c { u8 *p; - //if(sz>=153 && sz<=306) + //if(sz>=153 && sz<=306) // DBG_871X("DBG_MEM_ALLOC %s:%d %s(%d)\n", func, line, __FUNCTION__, (sz)); //if((sz)>4096) @@ -443,12 +443,12 @@ inline u8* dbg_rtw_zmalloc(u32 sz, const enum mstat_f flags, const char *func, c inline void dbg_rtw_mfree(u8 *pbuf, u32 sz, const enum mstat_f flags, const char *func, const int line) { - //if(sz>=153 && sz<=306) + //if(sz>=153 && sz<=306) // DBG_871X("DBG_MEM_ALLOC %s:%d %s(%d)\n", func, line, __FUNCTION__, (sz)); //if((sz)>4096) // DBG_871X("DBG_MEM_ALLOC %s:%d %s(%p,%d)\n", func, line, __FUNCTION__, (pbuf), (sz)); - + _rtw_mfree((pbuf), (sz)); rtw_mstat_update( @@ -488,7 +488,7 @@ inline void dbg_rtw_skb_free(struct sk_buff *skb, const enum mstat_f flags, cons // DBG_871X("DBG_MEM_ALLOC %s:%d %s, truesize=%u\n", func, line, __FUNCTION__, truesize); _rtw_skb_free(skb); - + rtw_mstat_update( flags , MSTAT_FREE @@ -501,7 +501,7 @@ inline struct sk_buff *dbg_rtw_skb_copy(const struct sk_buff *skb, const enum ms struct sk_buff *skb_cp; unsigned int truesize = skb->truesize; unsigned int cp_truesize = 0; - + skb_cp = _rtw_skb_copy(skb); if(skb_cp) cp_truesize = skb_cp->truesize; @@ -549,7 +549,7 @@ inline int dbg_rtw_netif_rx(_nic_hdl ndev, struct sk_buff *skb, const enum mstat // DBG_871X("DBG_MEM_ALLOC %s:%d %s, truesize=%u\n", func, line, __FUNCTION__, truesize); ret = _rtw_netif_rx(ndev, skb); - + rtw_mstat_update( flags , MSTAT_FREE @@ -572,9 +572,9 @@ inline void *dbg_rtw_usb_buffer_alloc(struct usb_device *dev, size_t size, dma_a { void *p; //DBG_871X("DBG_MEM_ALLOC %s:%d %s(%d)\n", func, line, __FUNCTION__, size); - + p = _rtw_usb_buffer_alloc(dev, size, dma); - + rtw_mstat_update( flags , p ? MSTAT_ALLOC_SUCCESS : MSTAT_ALLOC_FAIL @@ -647,7 +647,7 @@ void _rtw_init_listhead(_list *list) /* -For the following list_xxx operations, +For the following list_xxx operations, caller must guarantee the atomic context. Otherwise, there will be racing condition. */ @@ -796,12 +796,12 @@ inline s32 rtw_get_time_interval_ms(u32 start, u32 end) { return rtw_systime_to_ms(end-start); } - -void rtw_sleep_schedulable(int ms) + +void rtw_sleep_schedulable(int ms) { u32 delta; - + delta = (ms * HZ)/1000;//(ms) if (delta == 0) { delta = 1;// 1 ms @@ -815,7 +815,7 @@ void rtw_sleep_schedulable(int ms) void rtw_msleep_os(int ms) { - msleep((unsigned int)ms); + msleep((unsigned int)ms); } void rtw_usleep_os(int us) @@ -831,22 +831,22 @@ void rtw_usleep_os(int us) void _rtw_mdelay_os(int ms, const char *func, const int line) { DBG_871X("%s:%d %s(%d)\n", func, line, __FUNCTION__, ms); - mdelay((unsigned long)ms); + mdelay((unsigned long)ms); } void _rtw_udelay_os(int us, const char *func, const int line) { DBG_871X("%s:%d %s(%d)\n", func, line, __FUNCTION__, us); - udelay((unsigned long)us); + udelay((unsigned long)us); } #else void rtw_mdelay_os(int ms) { - mdelay((unsigned long)ms); + mdelay((unsigned long)ms); } void rtw_udelay_os(int us) { - udelay((unsigned long)us); + udelay((unsigned long)us); } #endif @@ -995,19 +995,19 @@ inline int ATOMIC_DEC_RETURN(ATOMIC_T *v) * @param mode please refer to linux document * @return Linux specific error code */ -static int openFile(struct file **fpp, char *path, int flag, int mode) -{ - struct file *fp; - - fp=filp_open(path, flag, mode); +static int openFile(struct file **fpp, char *path, int flag, int mode) +{ + struct file *fp; + + fp=filp_open(path, flag, mode); if(IS_ERR(fp)) { *fpp=NULL; return PTR_ERR(fp); } else { - *fpp=fp; + *fpp=fp; return 0; - } + } } /* @@ -1015,17 +1015,17 @@ static int openFile(struct file **fpp, char *path, int flag, int mode) * @param fp the pointer of struct file to close * @return always 0 */ -static int closeFile(struct file *fp) -{ +static int closeFile(struct file *fp) +{ filp_close(fp,NULL); - return 0; + return 0; } -static int readFile(struct file *fp,char *buf,int len) -{ +static int readFile(struct file *fp,char *buf,int len) +{ int rlen=0, sum=0; - - if (!fp->f_op || !fp->f_op->read) + + if (!fp->f_op || !fp->f_op->read) return -EPERM; while(sumf_op || !fp->f_op->write) - return -EPERM; + + if (!fp->f_op || !fp->f_op->write) + return -EPERM; while(sumf_op->write(fp,buf+sum,len-sum, &fp->f_pos); @@ -1069,25 +1069,25 @@ static int writeFile(struct file *fp,char *buf,int len) * @return Linux specific error code */ static int isFileReadable(char *path) -{ +{ struct file *fp; int ret = 0; mm_segment_t oldfs; char buf; - - fp=filp_open(path, O_RDONLY, 0); + + fp=filp_open(path, O_RDONLY, 0); if(IS_ERR(fp)) { ret = PTR_ERR(fp); } else { oldfs = get_fs(); set_fs(get_ds()); - + if(1!=readFile(fp, &buf, 1)) ret = PTR_ERR(fp); - + set_fs(oldfs); filp_close(fp,NULL); - } + } return ret; } @@ -1112,9 +1112,9 @@ static int retriveFromFile(char *path, u8* buf, u32 sz) ret=readFile(fp, buf, sz); set_fs(oldfs); closeFile(fp); - + DBG_871X("%s readFile, ret:%d\n",__FUNCTION__, ret); - + } else { DBG_871X("%s openFile path:%s Fail, ret:%d\n",__FUNCTION__, path, ret); } @@ -1137,7 +1137,7 @@ static int storeToFile(char *path, u8* buf, u32 sz) int ret =0; mm_segment_t oldfs; struct file *fp; - + if(path && buf) { if( 0 == (ret=openFile(&fp, path, O_CREAT|O_WRONLY, 0666)) ) { DBG_871X("%s openFile path:%s fp=%p\n",__FUNCTION__, path ,fp); @@ -1148,10 +1148,10 @@ static int storeToFile(char *path, u8* buf, u32 sz) closeFile(fp); DBG_871X("%s writeFile, ret:%d\n",__FUNCTION__, ret); - + } else { DBG_871X("%s openFile path:%s Fail, ret:%d\n",__FUNCTION__, path, ret); - } + } } else { DBG_871X("%s NULL pointer\n",__FUNCTION__); ret = -EINVAL; @@ -1211,7 +1211,7 @@ struct net_device *rtw_alloc_etherdev_with_old_priv(int sizeof_priv, void *old_p #endif if (!pnetdev) goto RETURN; - + pnpi = netdev_priv(pnetdev); pnpi->priv=old_priv; pnpi->sizeof_priv=sizeof_priv; @@ -1232,16 +1232,16 @@ struct net_device *rtw_alloc_etherdev(int sizeof_priv) #endif if (!pnetdev) goto RETURN; - + pnpi = netdev_priv(pnetdev); - + pnpi->priv = rtw_zvmalloc(sizeof_priv); if (!pnpi->priv) { free_netdev(pnetdev); pnetdev = NULL; goto RETURN; } - + pnpi->sizeof_priv=sizeof_priv; RETURN: return pnetdev; @@ -1250,10 +1250,10 @@ RETURN: void rtw_free_netdev(struct net_device * netdev) { struct rtw_netdev_priv_indicator *pnpi; - + if(!netdev) goto RETURN; - + pnpi = netdev_priv(netdev); if(!pnpi->priv) @@ -1267,7 +1267,7 @@ RETURN: } /* -* Jeff: this function should be called under ioctl (rtnl_lock is accquired) while +* Jeff: this function should be called under ioctl (rtnl_lock is accquired) while * LINUX_VERSION_CODE < KERNEL_VERSION(2,6,26) */ int rtw_change_ifname(struct adapter *padapter, const char *ifname) @@ -1281,7 +1281,7 @@ int rtw_change_ifname(struct adapter *padapter, const char *ifname) goto error; rereg_priv = &padapter->rereg_nd_name_priv; - + //free the old_pnetdev if(rereg_priv->old_pnetdev) { free_netdev(rereg_priv->old_pnetdev); @@ -1328,9 +1328,9 @@ int rtw_change_ifname(struct adapter *padapter, const char *ifname) return 0; error: - + return -1; - + } #endif //MEM_ALLOC_REFINE_ADAPTOR @@ -1495,4 +1495,3 @@ void rtw_cbuf_free(struct rtw_cbuf *cbuf) { rtw_mfree((u8*)cbuf, sizeof(*cbuf) + sizeof(void*)*cbuf->size); } - diff --git a/os_dep/recv_linux.c b/os_dep/recv_linux.c index 1b39e8d..a9f3cef 100755 --- a/os_dep/recv_linux.c +++ b/os_dep/recv_linux.c @@ -45,7 +45,7 @@ int rtw_os_recv_resource_init(struct recv_priv *precvpriv, struct adapter *padap int rtw_os_recv_resource_alloc(struct adapter *padapter, union recv_frame *precvframe) { int res=_SUCCESS; - + precvframe->u.hdr.pkt_newalloc = precvframe->u.hdr.pkt = NULL; return res; @@ -105,7 +105,7 @@ int rtw_os_recvbuf_resource_alloc(struct adapter *padapter, struct recv_buf *pre if(precvbuf->pallocated_buf == NULL) return _FAIL; #endif //CONFIG_USE_USB_BUFFER_ALLOC_RX - + #endif //CONFIG_USB_HCI return res; @@ -154,7 +154,7 @@ void rtw_handle_tkip_mic_err(struct adapter *padapter,u8 bgroup) union iwreq_data wrqu; struct iw_michaelmicfailure ev; struct mlme_priv* pmlmepriv = &padapter->mlmepriv; - struct security_priv *psecuritypriv = &padapter->securitypriv; + struct security_priv *psecuritypriv = &padapter->securitypriv; u32 cur_time = 0; if( psecuritypriv->last_mic_err_time == 0 ) @@ -294,7 +294,7 @@ _func_enter_; goto _recv_indicatepkt_drop; } - RT_TRACE(_module_recv_osdep_c_,_drv_info_,("rtw_recv_indicatepkt():skb != NULL !!!\n")); + RT_TRACE(_module_recv_osdep_c_,_drv_info_,("rtw_recv_indicatepkt():skb != NULL !!!\n")); RT_TRACE(_module_recv_osdep_c_,_drv_info_,("rtw_recv_indicatepkt():precv_frame->u.hdr.rx_head=%p precv_frame->hdr.rx_data=%p\n", precv_frame->u.hdr.rx_head, precv_frame->u.hdr.rx_data)); RT_TRACE(_module_recv_osdep_c_,_drv_info_,("precv_frame->hdr.rx_tail=%p precv_frame->u.hdr.rx_end=%p precv_frame->hdr.len=%d \n", precv_frame->u.hdr.rx_tail, precv_frame->u.hdr.rx_end, precv_frame->u.hdr.len)); @@ -308,9 +308,9 @@ _func_enter_; if(check_fwstate(pmlmepriv, WIFI_AP_STATE) == _TRUE) { - _pkt *pskb2=NULL; - struct sta_info *psta = NULL; - struct sta_priv *pstapriv = &padapter->stapriv; + _pkt *pskb2=NULL; + struct sta_info *psta = NULL; + struct sta_priv *pstapriv = &padapter->stapriv; struct rx_pkt_attrib *pattrib = &precv_frame->u.hdr.attrib; int bmcast = IS_MCAST(pattrib->dst); @@ -330,16 +330,16 @@ _func_enter_; if(psta) { - struct net_device *pnetdev= (struct net_device*)padapter->pnetdev; + struct net_device *pnetdev= (struct net_device*)padapter->pnetdev; //DBG_871X("directly forwarding to the rtw_xmit_entry\n"); //skb->ip_summed = CHECKSUM_NONE; - skb->dev = pnetdev; + skb->dev = pnetdev; #if (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,35)) skb_set_queue_mapping(skb, rtw_recv_select_queue(skb)); #endif //LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,35) - + _rtw_xmit_entry(skb, pnetdev); if(bmcast) @@ -355,7 +355,7 @@ _func_enter_; //DBG_871X("to APSelf\n"); } } - + #ifdef CONFIG_BR_EXT @@ -367,19 +367,19 @@ _func_enter_; rcu_read_unlock(); #endif // (LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 35)) - if( br_port && (check_fwstate(pmlmepriv, WIFI_STATION_STATE|WIFI_ADHOC_STATE) == _TRUE) ) + if( br_port && (check_fwstate(pmlmepriv, WIFI_STATION_STATE|WIFI_ADHOC_STATE) == _TRUE) ) { int nat25_handle_frame(struct adapter *priv, struct sk_buff *skb); if (nat25_handle_frame(padapter, skb) == -1) { //priv->ext_stats.rx_data_drops++; //DEBUG_ERR("RX DROP: nat25_handle_frame fail!\n"); //return FAIL; -#if 1 +#if 1 // bypass this frame to upper layer!! #else goto _recv_indicatepkt_drop; #endif - } + } } #endif // CONFIG_BR_EXT @@ -404,16 +404,16 @@ _func_enter_; #ifdef DBG_TRX_STA_PKTS { - + struct sta_info *psta = NULL; - struct sta_priv *pstapriv = &padapter->stapriv; + struct sta_priv *pstapriv = &padapter->stapriv; struct rx_pkt_attrib *pattrib = &precv_frame->u.hdr.attrib; int bmcast = IS_MCAST(pattrib->dst); if(bmcast) { psta = rtw_get_bcmc_stainfo(padapter); - + } else { psta = rtw_get_stainfo(pstapriv, pattrib->src); } @@ -422,24 +422,24 @@ _func_enter_; switch(pattrib->priority) { case 1: - case 2: + case 2: psta->rx_bk_cnt++; break; case 4: - case 5: + case 5: psta->rx_vi_cnt++; break; case 6: - case 7: + case 7: psta->rx_vo_cnt++; break; case 0: case 3: - default: + default: psta->rx_be_cnt++; - break; + break; } - } + } } #endif @@ -509,4 +509,3 @@ void rtw_init_recv_timer(struct recv_reorder_ctrl *preorder_ctrl) _init_timer(&(preorder_ctrl->reordering_ctrl_timer), padapter->pnetdev, _rtw_reordering_ctrl_timeout_handler, preorder_ctrl); } - diff --git a/os_dep/rtw_android.c b/os_dep/rtw_android.c index dbb430a..c96ead4 100755 --- a/os_dep/rtw_android.c +++ b/os_dep/rtw_android.c @@ -1,7 +1,7 @@ /****************************************************************************** * * 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. @@ -85,13 +85,13 @@ static const char *android_wifi_cmd_str[ANDROID_WIFI_CMD_MAX] = { "WFD-DISABLE", "WFD-SET-TCPPORT", "WFD-SET-MAXTPUT", - "WFD-SET-DEVTYPE", + "WFD-SET-DEVTYPE", }; #ifdef PNO_SUPPORT #define PNO_TLV_PREFIX 'S' #define PNO_TLV_VERSION '1' -#define PNO_TLV_SUBVERSION '2' +#define PNO_TLV_SUBVERSION '2' #define PNO_TLV_RESERVED '0' #define PNO_TLV_TYPE_SSID_IE 'S' #define PNO_TLV_TYPE_TIME 'T' @@ -238,19 +238,19 @@ int rtw_android_cmdstr_to_num(char *cmdstr) for(cmd_num=0 ; cmd_nummlmepriv); + struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); struct wlan_network *pcur_network = &pmlmepriv->cur_network; int bytes_written = 0; - if(check_fwstate(pmlmepriv, _FW_LINKED) == _TRUE) { - bytes_written += snprintf(&command[bytes_written], total_len, "%s rssi %d", + if(check_fwstate(pmlmepriv, _FW_LINKED) == _TRUE) { + bytes_written += snprintf(&command[bytes_written], total_len, "%s rssi %d", pcur_network->network.Ssid.Ssid, padapter->recvpriv.rssi); } @@ -260,7 +260,7 @@ static int rtw_android_get_rssi(struct net_device *net, char *command, int total static int rtw_android_get_link_speed(struct net_device *net, char *command, int total_len) { struct adapter *padapter = (struct adapter *)rtw_netdev_priv(net); - struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); + struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); struct wlan_network *pcur_network = &pmlmepriv->cur_network; int bytes_written = 0; u16 link_speed = 0; @@ -275,7 +275,7 @@ static int rtw_android_get_macaddr(struct net_device *net, char *command, int to { struct adapter *adapter = (struct adapter *)rtw_netdev_priv(net); int bytes_written = 0; - + bytes_written = snprintf(command, total_len, "Macaddr = "MAC_FMT, MAC_ARG(net->dev_addr)); return bytes_written; } @@ -285,7 +285,7 @@ static int rtw_android_set_country(struct net_device *net, char *command, int to struct adapter *adapter = (struct adapter *)rtw_netdev_priv(net); char *country_code = command + strlen(android_wifi_cmd_str[ANDROID_WIFI_CMD_COUNTRY]) + 1; int ret = _FAIL; - + ret = rtw_set_country(adapter, country_code); return (ret==_SUCCESS)?0:-1; @@ -297,7 +297,7 @@ static int rtw_android_get_p2p_dev_addr(struct net_device *net, char *command, i //We use the same address as our HW MAC address _rtw_memcpy(command, net->dev_addr, ETH_ALEN); - + bytes_written = ETH_ALEN; return bytes_written; } @@ -310,7 +310,7 @@ static int rtw_android_set_block(struct net_device *net, char *command, int tota #ifdef CONFIG_IOCTL_CFG80211 wdev_to_priv(adapter->rtw_wdev)->block = (*block_value=='0')?_FALSE:_TRUE; #endif - + return 0; } @@ -352,7 +352,7 @@ int rtw_android_priv_cmd(struct net_device *net, struct ifreq *ifr, int cmd) ret = -EFAULT; goto exit; } - + //DBG_871X("%s priv_cmd.buf=%p priv_cmd.total_len=%d priv_cmd.used_len=%d\n",__func__,priv_cmd.buf,priv_cmd.total_len,priv_cmd.used_len); command = rtw_zmalloc(priv_cmd.total_len); if (!command) @@ -363,7 +363,7 @@ int rtw_android_priv_cmd(struct net_device *net, struct ifreq *ifr, int cmd) } if (!access_ok(VERIFY_READ, priv_cmd.buf, priv_cmd.total_len)){ - DBG_871X("%s: failed to access memory\n", __FUNCTION__); + DBG_871X("%s: failed to access memory\n", __FUNCTION__); ret = -EFAULT; goto exit; } @@ -376,7 +376,7 @@ int rtw_android_priv_cmd(struct net_device *net, struct ifreq *ifr, int cmd) , __FUNCTION__, command, ifr->ifr_name); cmd_num = rtw_android_cmdstr_to_num(command); - + switch(cmd_num) { case ANDROID_WIFI_CMD_START: //bytes_written = wl_android_wifi_on(net); @@ -397,19 +397,19 @@ int rtw_android_priv_cmd(struct net_device *net, struct ifreq *ifr, int cmd) case ANDROID_WIFI_CMD_STOP: //bytes_written = wl_android_wifi_off(net); break; - + case ANDROID_WIFI_CMD_SCAN_ACTIVE: //rtw_set_scan_mode((struct adapter *)rtw_netdev_priv(net), SCAN_ACTIVE); -#ifdef CONFIG_PLATFORM_MSTAR +#ifdef CONFIG_PLATFORM_MSTAR #ifdef CONFIG_IOCTL_CFG80211 - (wdev_to_priv(net->ieee80211_ptr))->bandroid_scan = _TRUE; + (wdev_to_priv(net->ieee80211_ptr))->bandroid_scan = _TRUE; #endif //CONFIG_IOCTL_CFG80211 #endif //CONFIG_PLATFORM_MSTAR break; case ANDROID_WIFI_CMD_SCAN_PASSIVE: //rtw_set_scan_mode((struct adapter *)rtw_netdev_priv(net), SCAN_PASSIVE); break; - + case ANDROID_WIFI_CMD_RSSI: bytes_written = rtw_android_get_rssi(net, command, priv_cmd.total_len); break; @@ -420,11 +420,11 @@ int rtw_android_priv_cmd(struct net_device *net, struct ifreq *ifr, int cmd) case ANDROID_WIFI_CMD_MACADDR: bytes_written = rtw_android_get_macaddr(net, command, priv_cmd.total_len); break; - + case ANDROID_WIFI_CMD_BLOCK: bytes_written = rtw_android_set_block(net, command, priv_cmd.total_len); break; - + case ANDROID_WIFI_CMD_RXFILTER_START: //bytes_written = net_os_set_packet_filter(net, 1); break; @@ -439,7 +439,7 @@ int rtw_android_priv_cmd(struct net_device *net, struct ifreq *ifr, int cmd) //int filter_num = *(command + strlen(CMD_RXFILTER_REMOVE) + 1) - '0'; //bytes_written = net_os_rxfilter_add_remove(net, FALSE, filter_num); break; - + case ANDROID_WIFI_CMD_BTCOEXSCAN_START: /* TBD: BTCOEXSCAN-START */ break; @@ -458,11 +458,11 @@ int rtw_android_priv_cmd(struct net_device *net, struct ifreq *ifr, int cmd) #endif #endif break; - + case ANDROID_WIFI_CMD_SETSUSPENDOPT: //bytes_written = wl_android_set_suspendopt(net, command, priv_cmd.total_len); break; - + case ANDROID_WIFI_CMD_SETBAND: { uint band = *(command + strlen("SETBAND") + 1) - '0'; @@ -476,11 +476,11 @@ int rtw_android_priv_cmd(struct net_device *net, struct ifreq *ifr, int cmd) case ANDROID_WIFI_CMD_GETBAND: //bytes_written = wl_android_get_band(net, command, priv_cmd.total_len); break; - + case ANDROID_WIFI_CMD_COUNTRY: bytes_written = rtw_android_set_country(net, command, priv_cmd.total_len); break; - + #ifdef PNO_SUPPORT case ANDROID_WIFI_CMD_PNOSSIDCLR_SET: //bytes_written = dhd_dev_pno_reset(net); @@ -508,7 +508,7 @@ int rtw_android_priv_cmd(struct net_device *net, struct ifreq *ifr, int cmd) //int skip = strlen(CMD_P2P_SET_PS) + 1; //bytes_written = wl_cfg80211_set_p2p_ps(net, command + skip, priv_cmd.total_len - skip); break; - + #ifdef CONFIG_IOCTL_CFG80211 case ANDROID_WIFI_CMD_SET_AP_WPS_P2P_IE: { @@ -552,14 +552,14 @@ int rtw_android_priv_cmd(struct net_device *net, struct ifreq *ifr, int cmd) { // Commented by Albert 2012/08/28 // Specify the WFD device type ( WFD source/primary sink ) - + struct wifi_display_info *pwfd_info; struct adapter* padapter = ( struct adapter * ) rtw_netdev_priv(net); - + pwfd_info = &padapter->wfd_info; if (padapter->wdinfo.driver_interface == DRIVER_CFG80211) { pwfd_info->wfd_device_type = (u8)get_int_from_command(priv_cmd.buf); - + pwfd_info->wfd_device_type &= WFD_DEVINFO_DUAL; } break; @@ -825,4 +825,3 @@ static void wifi_del_dev(void) platform_driver_unregister(&wifi_device_legacy); } #endif /* defined(RTW_ENABLE_WIFI_CONTROL_FUNC) */ - diff --git a/os_dep/usb_intf.c b/os_dep/usb_intf.c index 093bde1..be0861c 100755 --- a/os_dep/usb_intf.c +++ b/os_dep/usb_intf.c @@ -1,7 +1,7 @@ /****************************************************************************** * * 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. @@ -72,24 +72,24 @@ static void rtw_dev_shutdown(struct device *dev) #if (LINUX_VERSION_CODE<=KERNEL_VERSION(2,6,23)) /* Some useful macros to use to create struct usb_device_id */ - #define USB_DEVICE_ID_MATCH_VENDOR 0x0001 + #define USB_DEVICE_ID_MATCH_VENDOR 0x0001 #define USB_DEVICE_ID_MATCH_PRODUCT 0x0002 - #define USB_DEVICE_ID_MATCH_DEV_LO 0x0004 - #define USB_DEVICE_ID_MATCH_DEV_HI 0x0008 + #define USB_DEVICE_ID_MATCH_DEV_LO 0x0004 + #define USB_DEVICE_ID_MATCH_DEV_HI 0x0008 #define USB_DEVICE_ID_MATCH_DEV_CLASS 0x0010 #define USB_DEVICE_ID_MATCH_DEV_SUBCLASS 0x0020 #define USB_DEVICE_ID_MATCH_DEV_PROTOCOL 0x0040 #define USB_DEVICE_ID_MATCH_INT_CLASS 0x0080 #define USB_DEVICE_ID_MATCH_INT_SUBCLASS 0x0100 #define USB_DEVICE_ID_MATCH_INT_PROTOCOL 0x0200 - #define USB_DEVICE_ID_MATCH_INT_NUMBER 0x0400 + #define USB_DEVICE_ID_MATCH_INT_NUMBER 0x0400 #define USB_DEVICE_ID_MATCH_INT_INFO \ (USB_DEVICE_ID_MATCH_INT_CLASS | \ USB_DEVICE_ID_MATCH_INT_SUBCLASS | \ USB_DEVICE_ID_MATCH_INT_PROTOCOL) - + #define USB_DEVICE_AND_INTERFACE_INFO(vend, prod, cl, sc, pr) \ .match_flags = USB_DEVICE_ID_MATCH_INT_INFO \ @@ -99,7 +99,7 @@ static void rtw_dev_shutdown(struct device *dev) .bInterfaceClass = (cl), \ .bInterfaceSubClass = (sc), \ .bInterfaceProtocol = (pr) - + /** * USB_VENDOR_AND_INTERFACE_INFO - describe a specific usb vendor with a class of usb interfaces * @vend: the 16 bit USB Vendor ID @@ -120,7 +120,7 @@ static void rtw_dev_shutdown(struct device *dev) .bInterfaceClass = (cl), \ .bInterfaceSubClass = (sc), \ .bInterfaceProtocol = (pr) - + /* ----------------------------------------------------------------------- */ #endif @@ -146,7 +146,7 @@ static struct specific_device_id specific_device_id_tbl[] = { {.idVendor=USB_VENDER_ID_REALTEK, .idProduct=0x817E, .flags=SPEC_DEV_ID_DISABLE_HT},//8188CE-VAU USB minCard (b/g mode only) {.idVendor=0x0b05, .idProduct=0x1791, .flags=SPEC_DEV_ID_DISABLE_HT}, {.idVendor=0x13D3, .idProduct=0x3311, .flags=SPEC_DEV_ID_DISABLE_HT}, - {.idVendor=0x13D3, .idProduct=0x3359, .flags=SPEC_DEV_ID_DISABLE_HT},//Russian customer -Azwave (8188CE-VAU g mode) + {.idVendor=0x13D3, .idProduct=0x3359, .flags=SPEC_DEV_ID_DISABLE_HT},//Russian customer -Azwave (8188CE-VAU g mode) #ifdef RTK_DMP_PLATFORM {.idVendor=USB_VENDER_ID_REALTEK, .idProduct=0x8111, .flags=SPEC_DEV_ID_ASSIGN_IFNAME}, // Realtek 5G dongle for WiFi Display {.idVendor=0x2019, .idProduct=0xAB2D, .flags=SPEC_DEV_ID_ASSIGN_IFNAME}, // PCI-Abocom 5G dongle for WiFi Display @@ -172,10 +172,10 @@ static struct rtw_usb_drv rtl8188e_usb_drv = { .usbdrv.suspend = rtw_suspend, .usbdrv.resume = rtw_resume, #if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 22)) - .usbdrv.reset_resume = rtw_resume, + .usbdrv.reset_resume = rtw_resume, #endif - #ifdef CONFIG_AUTOSUSPEND - .usbdrv.supports_autosuspend = 1, + #ifdef CONFIG_AUTOSUSPEND + .usbdrv.supports_autosuspend = 1, #endif #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 19)) @@ -204,7 +204,7 @@ static inline int RT_usb_endpoint_xfer_int(const struct usb_endpoint_descriptor static inline int RT_usb_endpoint_xfer_bulk(const struct usb_endpoint_descriptor *epd) { - return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == USB_ENDPOINT_XFER_BULK); + return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == USB_ENDPOINT_XFER_BULK); } static inline int RT_usb_endpoint_is_bulk_in(const struct usb_endpoint_descriptor *epd) @@ -229,8 +229,8 @@ static inline int RT_usb_endpoint_num(const struct usb_endpoint_descriptor *epd) static u8 rtw_init_intf_priv(struct dvobj_priv *dvobj) { - u8 rst = _SUCCESS; - + u8 rst = _SUCCESS; + #ifdef CONFIG_USB_VENDOR_REQ_MUTEX _rtw_mutex_init(&dvobj->usb_vendor_req_mutex); #endif @@ -243,18 +243,18 @@ static u8 rtw_init_intf_priv(struct dvobj_priv *dvobj) rst = _FAIL; goto exit; } - dvobj->usb_vendor_req_buf = + dvobj->usb_vendor_req_buf = (u8 *)N_BYTE_ALIGMENT((SIZE_PTR)(dvobj->usb_alloc_vendor_req_buf ), ALIGNMENT_UNIT); exit: #endif return rst; - + } static u8 rtw_deinit_intf_priv(struct dvobj_priv *dvobj) { - u8 rst = _SUCCESS; + u8 rst = _SUCCESS; #ifdef CONFIG_USB_VENDOR_REQ_BUFFER_PREALLOC if(dvobj->usb_vendor_req_buf) @@ -264,7 +264,7 @@ static u8 rtw_deinit_intf_priv(struct dvobj_priv *dvobj) #ifdef CONFIG_USB_VENDOR_REQ_MUTEX _rtw_mutex_free(&dvobj->usb_vendor_req_mutex); #endif - + return rst; } @@ -274,7 +274,7 @@ static struct dvobj_priv *usb_dvobj_init(struct usb_interface *usb_intf) u8 val8; int status = _FAIL; struct dvobj_priv *pdvobjpriv; - struct usb_device_descriptor *pdev_desc; + struct usb_device_descriptor *pdev_desc; struct usb_host_config *phost_conf; struct usb_config_descriptor *pconf_desc; struct usb_host_interface *phost_iface; @@ -402,7 +402,7 @@ _func_enter_; pdvobjpriv->ep_num[i] = RT_usb_endpoint_num(pendp_desc); } } - + DBG_871X("nr_endpoint=%d, in_num=%d, out_num=%d\n\n", pdvobjpriv->nr_endpoint, pdvobjpriv->RtNumInPipes, pdvobjpriv->RtNumOutPipes); if (pusbd->speed == USB_SPEED_HIGH) { @@ -412,14 +412,14 @@ _func_enter_; pdvobjpriv->ishighspeed = _FALSE; DBG_871X("NON USB_SPEED_HIGH\n"); } - + if (rtw_init_intf_priv(pdvobjpriv) == _FAIL) { RT_TRACE(_module_os_intfs_c_,_drv_err_,("\n Can't INIT rtw_init_intf_priv\n")); goto free_dvobj; } //.3 misc - _rtw_init_sema(&(pdvobjpriv->usb_suspend_sema), 0); + _rtw_init_sema(&(pdvobjpriv->usb_suspend_sema), 0); rtw_reset_continual_io_error(pdvobjpriv); usb_get_dev(pusbd); @@ -453,7 +453,7 @@ _func_enter_; if ((dvobj->NumInterfaces != 2 && dvobj->NumInterfaces != 3) || (dvobj->InterfaceNumber == 1)) { if (interface_to_usbdev(usb_intf)->state != USB_STATE_NOTATTACHED) { - //If we didn't unplug usb dongle and remove/insert modlue, driver fails on sitesurvey for the first time when device is up . + //If we didn't unplug usb dongle and remove/insert modlue, driver fails on sitesurvey for the first time when device is up . //Reset usb port for sitesurvey fail issue. 2009.8.13, by Thomas DBG_871X("usb attached..., try to reset usb device\n"); usb_reset_device(interface_to_usbdev(usb_intf)); @@ -466,7 +466,7 @@ _func_enter_; _rtw_mutex_free(&dvobj->setbw_mutex); rtw_mfree((u8*)dvobj, sizeof(*dvobj)); } - + //DBG_871X("%s %d\n", __func__, ATOMIC_READ(&usb_intf->dev.kobj.kref.refcount)); usb_put_dev(interface_to_usbdev(usb_intf)); @@ -482,8 +482,8 @@ static void decide_chip_type_by_usb_device_id(struct adapter *padapter, const st static void usb_intf_start(struct adapter *padapter) { - RT_TRACE(_module_hci_intfs_c_,_drv_err_,("+usb_intf_start\n")); - + RT_TRACE(_module_hci_intfs_c_,_drv_err_,("+usb_intf_start\n")); + rtw_hal_inirp_init(padapter); RT_TRACE(_module_hci_intfs_c_,_drv_err_,("-usb_intf_start\n")); @@ -504,7 +504,7 @@ static void usb_intf_stop(struct adapter *padapter) } //cancel in irp - rtw_hal_inirp_deinit(padapter); + rtw_hal_inirp_deinit(padapter); //cancel out irp rtw_write_port_cancel(padapter); @@ -538,7 +538,7 @@ void rtw_dev_unload(struct adapter *padapter) } //s4. - if(!adapter_to_pwrctl(padapter)->bInternalAutoSuspend ) + if(!adapter_to_pwrctl(padapter)->bInternalAutoSuspend ) rtw_stop_drv_threads(padapter); @@ -602,7 +602,7 @@ static void process_spec_devid(const struct usb_device_id *pdid) if((pdid->idVendor==vid) && (pdid->idProduct==pid) && (flags&SPEC_DEV_ID_ASSIGN_IFNAME)) { extern char* ifname; - strncpy(ifname, "wlan10", 6); + strncpy(ifname, "wlan10", 6); //DBG_871X("%s()-%d: ifname=%s, vid=%04X, pid=%04X\n", __FUNCTION__, __LINE__, ifname, vid, pid); } #endif /* RTK_DMP_PLATFORM */ @@ -614,23 +614,23 @@ static void process_spec_devid(const struct usb_device_id *pdid) int rtw_hw_suspend(struct adapter *padapter ) { struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter); - struct usb_interface *pusb_intf = adapter_to_dvobj(padapter)->pusbintf; + struct usb_interface *pusb_intf = adapter_to_dvobj(padapter)->pusbintf; struct net_device *pnetdev = padapter->pnetdev; - + _func_enter_; if((!padapter->bup) || (padapter->bDriverStopped)||(padapter->bSurpriseRemoved)) { DBG_871X("padapter->bup=%d bDriverStopped=%d bSurpriseRemoved = %d\n", - padapter->bup, padapter->bDriverStopped,padapter->bSurpriseRemoved); + padapter->bup, padapter->bDriverStopped,padapter->bSurpriseRemoved); goto error_exit; } - + if(padapter)//system suspend - { + { LeaveAllPowerSaveMode(padapter); - - DBG_871X("==> rtw_hw_suspend\n"); + + DBG_871X("==> rtw_hw_suspend\n"); _enter_pwrlock(&pwrpriv->lock); pwrpriv->bips_processing = _TRUE; //padapter->net_closed = _TRUE; @@ -643,11 +643,11 @@ int rtw_hw_suspend(struct adapter *padapter ) //s2. rtw_disassoc_cmd(padapter, 500, _FALSE); - + //s2-2. indicate disconnect to os //rtw_indicate_disconnect(padapter); { - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; + struct mlme_priv *pmlmepriv = &padapter->mlmepriv; if(check_fwstate(pmlmepriv, _FW_LINKED)) { @@ -656,7 +656,7 @@ int rtw_hw_suspend(struct adapter *padapter ) rtw_led_control(padapter, LED_CTL_NO_LINK); rtw_os_indicate_disconnect(padapter); - + #ifdef CONFIG_LPS //donnot enqueue cmd rtw_lps_ctrl_wk_cmd(padapter, LPS_CTRL_DISCONNECT, 0); @@ -670,19 +670,19 @@ int rtw_hw_suspend(struct adapter *padapter ) //s2-4. rtw_free_network_queue(padapter,_TRUE); #ifdef CONFIG_IPS - rtw_ips_dev_unload(padapter); - #endif + rtw_ips_dev_unload(padapter); + #endif pwrpriv->rf_pwrstate = rf_off; - pwrpriv->bips_processing = _FALSE; + pwrpriv->bips_processing = _FALSE; _exit_pwrlock(&pwrpriv->lock); } else goto error_exit; - + _func_exit_; return 0; - + error_exit: DBG_871X("%s, failed \n",__FUNCTION__); return (-1); @@ -698,41 +698,41 @@ int rtw_hw_resume(struct adapter *padapter) _func_enter_; if(padapter)//system resume - { + { DBG_871X("==> rtw_hw_resume\n"); _enter_pwrlock(&pwrpriv->lock); pwrpriv->bips_processing = _TRUE; rtw_reset_drv_sw(padapter); - + if(pm_netdev_open(pnetdev,_FALSE) != 0) { _exit_pwrlock(&pwrpriv->lock); goto error_exit; } - netif_device_attach(pnetdev); + netif_device_attach(pnetdev); netif_carrier_on(pnetdev); if(!rtw_netif_queue_stopped(pnetdev)) - rtw_netif_start_queue(pnetdev); + rtw_netif_start_queue(pnetdev); else rtw_netif_wake_queue(pnetdev); - + pwrpriv->bkeepfwalive = _FALSE; pwrpriv->brfoffbyhw = _FALSE; - + pwrpriv->rf_pwrstate = rf_on; - pwrpriv->bips_processing = _FALSE; - + pwrpriv->bips_processing = _FALSE; + _exit_pwrlock(&pwrpriv->lock); } else { - goto error_exit; + goto error_exit; } _func_exit_; - + return 0; error_exit: DBG_871X("%s, Open net dev failed \n",__FUNCTION__); @@ -754,13 +754,13 @@ static void rtw_suspend_wow(struct adapter *padapter) pwrpriv->wowlan_mode = _TRUE; else pwrpriv->wowlan_mode = _FALSE; - - rtw_cancel_all_timer(padapter); + + rtw_cancel_all_timer(padapter); LeaveAllPowerSaveMode(padapter); rtw_stop_cmd_thread(padapter); - + //padapter->net_closed = _TRUE; //s1. if(pnetdev) @@ -790,7 +790,7 @@ static void rtw_suspend_wow(struct adapter *padapter) MAC_ARG(pmlmepriv->cur_network.network.MacAddress), pmlmepriv->cur_network.network.Ssid.SsidLength, pmlmepriv->assoc_ssid.SsidLength); - + rtw_set_roaming(padapter, 1); } #endif @@ -805,7 +805,7 @@ static void rtw_suspend_wow(struct adapter *padapter) rtw_free_network_queue(padapter, _TRUE); rtw_dev_unload(padapter); - + if(check_fwstate(pmlmepriv, _FW_UNDER_SURVEY)) rtw_indicate_scan_done(padapter, 1); @@ -826,7 +826,7 @@ static int rtw_suspend(struct usb_interface *pusb_intf, pm_message_t message) int ret = 0; u32 start_time = rtw_get_current_time(); - + _func_enter_; DBG_871X("==> %s (%s:%d)\n",__FUNCTION__, current->comm, current->pid); @@ -847,10 +847,10 @@ static int rtw_suspend(struct usb_interface *pusb_intf, pm_message_t message) padapter->bup, padapter->bDriverStopped,padapter->bSurpriseRemoved); goto exit; } - + if(pwrpriv->bInternalAutoSuspend ) { - #ifdef CONFIG_AUTOSUSPEND + #ifdef CONFIG_AUTOSUSPEND #ifdef SUPPORT_HW_RFOFF_DETECTED // The FW command register update must after MAC and FW init ready. if((padapter->bFWReady) && (pwrpriv->bHWPwrPindetect ) && (padapter->registrypriv.usbss_enable )) @@ -863,22 +863,22 @@ static int rtw_suspend(struct usb_interface *pusb_intf, pm_message_t message) #endif } - pwrpriv->bInSuspend = _TRUE; + pwrpriv->bInSuspend = _TRUE; _enter_pwrlock(&pwrpriv->lock); #ifdef CONFIG_WOWLAN rtw_suspend_wow(padapter); #else - rtw_suspend_common(padapter); + rtw_suspend_common(padapter); #endif - + #ifdef CONFIG_AUTOSUSPEND pwrpriv->rf_pwrstate = rf_off; pwrpriv->bips_processing = _FALSE; #endif _exit_pwrlock(&pwrpriv->lock); - + exit: DBG_871X("<=== %s return %d.............. in %dms\n", __FUNCTION__ , ret, rtw_get_passing_time_ms(start_time)); @@ -901,7 +901,7 @@ static int rtw_suspend(struct usb_interface *pusb_intf, pm_message_t message) int ret = 0; u32 start_time = rtw_get_current_time(); - + _func_enter_; DBG_871X("==> %s (%s:%d)\n",__FUNCTION__, current->comm, current->pid); @@ -919,10 +919,10 @@ static int rtw_suspend(struct usb_interface *pusb_intf, pm_message_t message) padapter->bup, padapter->bDriverStopped,padapter->bSurpriseRemoved); goto exit; } - + if(pwrpriv->bInternalAutoSuspend ) { - #ifdef CONFIG_AUTOSUSPEND + #ifdef CONFIG_AUTOSUSPEND #ifdef SUPPORT_HW_RFOFF_DETECTED // The FW command register update must after MAC and FW init ready. if((padapter->bFWReady) && (pwrpriv->bHWPwrPindetect ) && (padapter->registrypriv.usbss_enable )) @@ -934,8 +934,8 @@ static int rtw_suspend(struct usb_interface *pusb_intf, pm_message_t message) #endif #endif } - pwrpriv->bInSuspend = _TRUE; - rtw_cancel_all_timer(padapter); + pwrpriv->bInSuspend = _TRUE; + rtw_cancel_all_timer(padapter); LeaveAllPowerSaveMode(padapter); rtw_stop_cmd_thread(padapter); @@ -972,7 +972,7 @@ static int rtw_suspend(struct usb_interface *pusb_intf, pm_message_t message) MAC_ARG(pmlmepriv->cur_network.network.MacAddress), pmlmepriv->cur_network.network.Ssid.SsidLength, pmlmepriv->assoc_ssid.SsidLength); - + rtw_set_roaming(padapter, 1); } #endif @@ -998,7 +998,7 @@ static int rtw_suspend(struct usb_interface *pusb_intf, pm_message_t message) if(check_fwstate(pmlmepriv, _FW_UNDER_LINKING)) rtw_indicate_disconnect(padapter); - + exit: DBG_871X("<=== %s return %d.............. in %dms\n", __FUNCTION__ , ret, rtw_get_passing_time_ms(start_time)); @@ -1015,9 +1015,9 @@ static int rtw_resume(struct usb_interface *pusb_intf) struct net_device *pnetdev = padapter->pnetdev; struct pwrctrl_priv *pwrpriv = dvobj_to_pwrctl(dvobj); int ret = 0; - + if(pwrpriv->bInternalAutoSuspend ){ - ret = rtw_resume_process(padapter); + ret = rtw_resume_process(padapter); } else { #ifdef CONFIG_RESUME_IN_WORKQUEUE rtw_resume_in_workqueue(pwrpriv); @@ -1034,7 +1034,7 @@ static int rtw_resume(struct usb_interface *pusb_intf) } #endif /* CONFIG_RESUME_IN_WORKQUEUE */ } - + return ret; } @@ -1068,7 +1068,7 @@ int rtw_resume_process(struct adapter *padapter) #else DBG_871X("...pm_usage_cnt(%d).....\n", adapter_to_dvobj(padapter)->pusbintf->pm_usage_cnt); pm_cnt = adapter_to_dvobj(padapter)->pusbintf->pm_usage_cnt; - #endif + #endif DBG_871X("pwrpriv->bAutoResume (%x)\n",pwrpriv->bAutoResume ); if( _TRUE == pwrpriv->bAutoResume ){ @@ -1120,7 +1120,7 @@ int rtw_resume_process(struct adapter *padapter) if( padapter->pid[1]!=0) { DBG_871X("pid[1]:%d\n",padapter->pid[1]); rtw_signal_process(padapter->pid[1], SIGUSR2); - } + } ret = 0; exit: @@ -1131,35 +1131,35 @@ exit: pwrpriv->bInSuspend = _FALSE; DBG_871X("<=== %s return %d.............. in %dms\n", __FUNCTION__ , ret, rtw_get_passing_time_ms(start_time)); - + _func_exit_; - + return ret; } #ifdef CONFIG_AUTOSUSPEND -void autosuspend_enter(struct adapter* padapter) +void autosuspend_enter(struct adapter* padapter) { struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter); struct dvobj_priv *dvobj = adapter_to_dvobj(padapter); - + DBG_871X("==>autosuspend_enter...........\n"); pwrpriv->bInternalAutoSuspend = _TRUE; pwrpriv->bips_processing = _TRUE; - + if(rf_off == pwrpriv->change_rfpwrstate ) - { + { #ifndef CONFIG_BT_COEXIST #if (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,35)) usb_enable_autosuspend(dvobj->pusbdev); #else - dvobj->pusbdev->autosuspend_disabled = 0;//autosuspend disabled by the user + dvobj->pusbdev->autosuspend_disabled = 0;//autosuspend disabled by the user #endif - + #if (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,33)) - usb_autopm_put_interface(dvobj->pusbintf); - #elif (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,20)) + usb_autopm_put_interface(dvobj->pusbintf); + #elif (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,20)) usb_autopm_enable(dvobj->pusbintf); #else usb_autosuspend_device(dvobj->pusbdev, 1); @@ -1169,12 +1169,12 @@ void autosuspend_enter(struct adapter* padapter) #if (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,35)) usb_enable_autosuspend(dvobj->pusbdev); #else - dvobj->pusbdev->autosuspend_disabled = 0;//autosuspend disabled by the user + dvobj->pusbdev->autosuspend_disabled = 0;//autosuspend disabled by the user #endif - + #if (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,33)) - usb_autopm_put_interface(dvobj->pusbintf); - #elif (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,20)) + usb_autopm_put_interface(dvobj->pusbintf); + #elif (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,20)) usb_autopm_enable(dvobj->pusbintf); #else usb_autosuspend_device(dvobj->pusbdev, 1); @@ -1191,7 +1191,7 @@ void autosuspend_enter(struct adapter* padapter) #else DBG_871X("...pm_usage_cnt(%d).....\n", dvobj->pusbintf->pm_usage_cnt); #endif - + } int autoresume_enter(struct adapter* padapter) { @@ -1201,21 +1201,21 @@ int autoresume_enter(struct adapter* padapter) struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); struct dvobj_priv *dvobj = adapter_to_dvobj(padapter); - + DBG_871X("====> autoresume_enter \n"); - + if(rf_off == pwrpriv->rf_pwrstate ) { pwrpriv->ps_flag = _FALSE; #ifndef CONFIG_BT_COEXIST - #if (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,33)) - if (usb_autopm_get_interface(dvobj->pusbintf) < 0) + #if (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,33)) + if (usb_autopm_get_interface(dvobj->pusbintf) < 0) { DBG_871X( "can't get autopm: %d\n", result); result = _FAIL; goto error_exit; - } - #elif (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,20)) + } + #elif (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,20)) usb_autopm_disable(dvobj->pusbintf); #else usb_autoresume_device(dvobj->pusbdev, 1); @@ -1225,18 +1225,18 @@ int autoresume_enter(struct adapter* padapter) DBG_871X("...pm_usage_cnt(%d).....\n", atomic_read(&(dvobj->pusbintf->pm_usage_cnt))); #else DBG_871X("...pm_usage_cnt(%d).....\n", dvobj->pusbintf->pm_usage_cnt); - #endif + #endif #else //#ifndef CONFIG_BT_COEXIST - pwrpriv->bAutoResume=_TRUE; + pwrpriv->bAutoResume=_TRUE; if(0==pwrpriv->autopm_cnt){ - #if (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,33)) - if (usb_autopm_get_interface(dvobj->pusbintf) < 0) + #if (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,33)) + if (usb_autopm_get_interface(dvobj->pusbintf) < 0) { DBG_871X( "can't get autopm: %d\n", result); result = _FAIL; goto error_exit; - } - #elif (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,20)) + } + #elif (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,20)) usb_autopm_disable(dvobj->pusbintf); #else usb_autoresume_device(dvobj->pusbdev, 1); @@ -1245,15 +1245,15 @@ int autoresume_enter(struct adapter* padapter) DBG_871X("...pm_usage_cnt(%d).....\n", atomic_read(&(dvobj->pusbintf->pm_usage_cnt))); #else DBG_871X("...pm_usage_cnt(%d).....\n", dvobj->pusbintf->pm_usage_cnt); - #endif + #endif pwrpriv->autopm_cnt++; } else DBG_871X("0!=pwrpriv->autopm_cnt[%d] didn't usb_autopm_get_interface\n",pwrpriv->autopm_cnt); #endif //#ifndef CONFIG_BT_COEXIST - } + } DBG_871X("<==== autoresume_enter \n"); -error_exit: +error_exit: return result; } @@ -1299,7 +1299,7 @@ static struct adapter *rtw_usb_if1_init(struct dvobj_priv *dvobj, } padapter->dvobj = dvobj; dvobj->if1 = padapter; - + padapter->bDriverStopped=_TRUE; dvobj->padapters[dvobj->iface_nums++] = padapter; @@ -1308,7 +1308,7 @@ static struct adapter *rtw_usb_if1_init(struct dvobj_priv *dvobj, #if defined(CONFIG_CONCURRENT_MODE) || defined(CONFIG_DUALMAC_CONCURRENT) //set adapter_type/iface type for primary padapter padapter->isprimary = _TRUE; - padapter->adapter_type = PRIMARY_ADAPTER; + padapter->adapter_type = PRIMARY_ADAPTER; #ifndef CONFIG_HWPORT_SWAP padapter->iface_type = IFACE_PORT0; #else @@ -1354,7 +1354,7 @@ static struct adapter *rtw_usb_if1_init(struct dvobj_priv *dvobj, rtw_hal_chip_configure(padapter); //step read efuse/eeprom data and get mac_addr - rtw_hal_read_chip_info(padapter); + rtw_hal_read_chip_info(padapter); //step 5. if(rtw_init_drv_sw(padapter) ==_FAIL) { @@ -1367,7 +1367,7 @@ static struct adapter *rtw_usb_if1_init(struct dvobj_priv *dvobj, if(adapter_to_pwrctl(padapter)->bSupportRemoteWakeup) { dvobj->pusbdev->do_remote_wakeup=1; - pusb_intf->needs_remote_wakeup = 1; + pusb_intf->needs_remote_wakeup = 1; device_init_wakeup(&pusb_intf->dev, 1); DBG_871X("\n pwrctrlpriv.bSupportRemoteWakeup~~~~~~\n"); DBG_871X("\n pwrctrlpriv.bSupportRemoteWakeup~~~[%d]~~~\n",device_may_wakeup(&pusb_intf->dev)); @@ -1378,11 +1378,11 @@ static struct adapter *rtw_usb_if1_init(struct dvobj_priv *dvobj, #ifdef CONFIG_AUTOSUSPEND if( padapter->registrypriv.power_mgnt != PS_MODE_ACTIVE ) { - if(padapter->registrypriv.usbss_enable ){ /* autosuspend (2s delay) */ + if(padapter->registrypriv.usbss_enable ){ /* autosuspend (2s delay) */ #if (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,38)) - dvobj->pusbdev->dev.power.autosuspend_delay = 0 * HZ;//15 * HZ; idle-delay time + dvobj->pusbdev->dev.power.autosuspend_delay = 0 * HZ;//15 * HZ; idle-delay time #else - dvobj->pusbdev->autosuspend_delay = 0 * HZ;//15 * HZ; idle-delay time + dvobj->pusbdev->autosuspend_delay = 0 * HZ;//15 * HZ; idle-delay time #endif #if (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,35)) @@ -1398,13 +1398,13 @@ static struct adapter *rtw_usb_if1_init(struct dvobj_priv *dvobj, DBG_871X("%s...pm_usage_cnt(%d).....\n",__FUNCTION__,atomic_read(&(dvobj->pusbintf ->pm_usage_cnt))); #else DBG_871X("%s...pm_usage_cnt(%d).....\n",__FUNCTION__,dvobj->pusbintf ->pm_usage_cnt); - #endif + #endif } - } + } #endif - //2012-07-11 Move here to prevent the 8723AS-VAU BT auto suspend influence - #if (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,33)) - if (usb_autopm_get_interface(pusb_intf) < 0) + //2012-07-11 Move here to prevent the 8723AS-VAU BT auto suspend influence + #if (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,33)) + if (usb_autopm_get_interface(pusb_intf) < 0) { DBG_871X( "can't get autopm: \n"); } @@ -1498,8 +1498,8 @@ static void rtw_usb_if1_deinit(struct adapter *if1) #ifdef CONFIG_BT_COEXIST if(1 == pwrctl->autopm_cnt){ #if (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,33)) - usb_autopm_put_interface(adapter_to_dvobj(if1)->pusbintf); - #elif (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,20)) + usb_autopm_put_interface(adapter_to_dvobj(if1)->pusbintf); + #elif (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,20)) usb_autopm_enable(adapter_to_dvobj(if1)->pusbintf); #else usb_autosuspend_device(adapter_to_dvobj(if1)->pusbdev, 1); @@ -1526,11 +1526,11 @@ static void dump_usb_interface(struct usb_interface *usb_intf) u8 val8; struct usb_device *udev = interface_to_usbdev(usb_intf); - struct usb_device_descriptor *dev_desc = &udev->descriptor; - + struct usb_device_descriptor *dev_desc = &udev->descriptor; + struct usb_host_config *act_conf = udev->actconfig; struct usb_config_descriptor *act_conf_desc = &act_conf->desc; - + struct usb_host_interface *host_iface; struct usb_interface_descriptor *iface_desc; struct usb_host_endpoint *host_endp; @@ -1553,7 +1553,7 @@ static void dump_usb_interface(struct usb_interface *usb_intf) DBG_871X("iSerialNumber:0x%02x\n", dev_desc->iSerialNumber); DBG_871X("bNumConfigurations:%u\n", dev_desc->bNumConfigurations); #endif - + #if 1 /* The acting usb_config_descriptor */ DBG_871X("\nact_conf_desc:%p\n", act_conf_desc); @@ -1626,7 +1626,7 @@ static void dump_usb_interface(struct usb_interface *usb_intf) //pdvobjpriv->ep_num[i] = RT_usb_endpoint_num(pendp_desc); } } - + //DBG_871X("nr_endpoint=%d, in_num=%d, out_num=%d\n\n", pdvobjpriv->nr_endpoint, pdvobjpriv->RtNumInPipes, pdvobjpriv->RtNumOutPipes); #endif @@ -1669,10 +1669,10 @@ static int rtw_drv_init(struct usb_interface *pusb_intf, const struct usb_device #ifdef CONFIG_CONCURRENT_MODE if((if2 = rtw_drv_if2_init(if1, usb_set_intf_ops)) == NULL) { goto free_if1; - } + } #endif -#ifdef CONFIG_INTEL_PROXIM +#ifdef CONFIG_INTEL_PROXIM rtw_sw_export=if1; #endif @@ -1738,8 +1738,8 @@ _func_enter_; DBG_871X("+rtw_dev_remove\n"); RT_TRACE(_module_hci_intfs_c_,_drv_err_,("+dev_remove()\n")); dvobj->processing_dev_remove = _TRUE; - rtw_unregister_netdevs(dvobj); - + rtw_unregister_netdevs(dvobj); + if(usb_drv->drv_registered == _TRUE) { //DBG_871X("r871xu_dev_remove():padapter->bSurpriseRemoved == _TRUE\n"); @@ -1775,7 +1775,7 @@ _func_enter_; DBG_871X("-r871xu_dev_remove, done\n"); -#ifdef CONFIG_INTEL_PROXIM +#ifdef CONFIG_INTEL_PROXIM rtw_sw_export=NULL; #endif @@ -1784,7 +1784,7 @@ _func_exit_; return; } -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24)) +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24)) extern int console_suspend_enabled; #endif @@ -1799,18 +1799,18 @@ static int __init rtw_drv_entry(void) #endif #ifdef CONFIG_PLATFORM_ARM_SUNxI int ret = 0; - /* ----------get usb_wifi_usbc_num------------- */ - ret = script_parser_fetch("usb_wifi_para", "usb_wifi_usbc_num", (int *)&usb_wifi_host, 64); - if(ret != 0){ - DBG_8192C("ERR: script_parser_fetch usb_wifi_usbc_num failed\n"); - ret = -ENOMEM; - return ret; - } - DBG_8192C("sw_usb_enable_hcd: usbc_num = %d\n", usb_wifi_host); + /* ----------get usb_wifi_usbc_num------------- */ + ret = script_parser_fetch("usb_wifi_para", "usb_wifi_usbc_num", (int *)&usb_wifi_host, 64); + if(ret != 0){ + DBG_8192C("ERR: script_parser_fetch usb_wifi_usbc_num failed\n"); + ret = -ENOMEM; + return ret; + } + DBG_8192C("sw_usb_enable_hcd: usbc_num = %d\n", usb_wifi_host); sw_usb_enable_hcd(usb_wifi_host); #endif //CONFIG_PLATFORM_ARM_SUNxI -#if defined CONFIG_PLATFORM_ARM_SUN6I +#if defined CONFIG_PLATFORM_ARM_SUN6I script_item_value_type_e type; type = script_get_item("wifi_para", "wifi_usbc_id", &item); @@ -1822,7 +1822,7 @@ static int __init rtw_drv_entry(void) printk("sw_usb_enable_hcd: usbc_num = %d\n", item.val); wifi_pm_power(1); mdelay(10); - + sw_usb_enable_hcd(item.val); #endif // defined CONFIG_PLATFORM_ARM_SUN6I @@ -1830,8 +1830,8 @@ static int __init rtw_drv_entry(void) DBG_871X(DRV_NAME " driver version=%s\n", DRIVERVERSION); DBG_871X("build time: %s %s\n", __DATE__, __TIME__); - -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24)) + +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24)) //console_suspend_enabled=0; #endif @@ -1844,7 +1844,7 @@ static int __init rtw_drv_entry(void) static void __exit rtw_drv_halt(void) { RT_TRACE(_module_hci_intfs_c_,_drv_err_,("+rtw_drv_halt\n")); - DBG_871X("+rtw_drv_halt\n"); + DBG_871X("+rtw_drv_halt\n"); usb_drv->drv_registered = _FALSE; usb_deregister(&usb_drv->usbdrv); @@ -1869,11 +1869,10 @@ static void __exit rtw_drv_halt(void) module_init(rtw_drv_entry); module_exit(rtw_drv_halt); -#ifdef CONFIG_INTEL_PROXIM +#ifdef CONFIG_INTEL_PROXIM struct adapter *rtw_usb_get_sw_pointer(void) { return rtw_sw_export; } EXPORT_SYMBOL(rtw_usb_get_sw_pointer); #endif //CONFIG_INTEL_PROXIM - diff --git a/os_dep/usb_ops_linux.c b/os_dep/usb_ops_linux.c index 7de0d2f..cfce53d 100755 --- a/os_dep/usb_ops_linux.c +++ b/os_dep/usb_ops_linux.c @@ -1,698 +1,697 @@ -/****************************************************************************** - * - * Copyright(c) 2007 - 2012 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 - * - *******************************************************************************/ -#define _USB_OPS_LINUX_C_ - -#include -#include -#include - -#ifdef CONFIG_USB_SUPPORT_ASYNC_VDN_REQ -static void _usbctrl_vendorreq_async_callback(struct urb *urb, struct pt_regs *regs) -{ - if (urb) { - if (urb->context) { - rtw_mfree(urb->context); - } - usb_free_urb(urb); - } -} - -static int _usbctrl_vendorreq_async_write(struct usb_device *udev, u8 request, - u16 value, u16 index, void *pdata, u16 len, u8 requesttype) -{ - int rc; - unsigned int pipe; - u8 reqtype; - struct usb_ctrlrequest *dr; - struct urb *urb; - struct rtl819x_async_write_data { - u8 data[VENDOR_CMD_MAX_DATA_LEN]; - struct usb_ctrlrequest dr; - } *buf; - - - if (requesttype == VENDOR_READ) { - pipe = usb_rcvctrlpipe(udev, 0);//read_in - reqtype = REALTEK_USB_VENQT_READ; - } - else { - pipe = usb_sndctrlpipe(udev, 0);//write_out - reqtype = REALTEK_USB_VENQT_WRITE; - } - - buf = (struct rtl819x_async_write_data *)rtw_zmalloc(sizeof(*buf)); - if (!buf) { - rc = -ENOMEM; - goto exit; - } - - urb = usb_alloc_urb(0, GFP_ATOMIC); - if (!urb) { - rtw_mfree((u8*)buf, sizeof(*buf)); - rc = -ENOMEM; - goto exit; - } - - dr = &buf->dr; - - dr->bRequestType = reqtype; - dr->bRequest = request; - dr->wValue = cpu_to_le16(value); - dr->wIndex = cpu_to_le16(index); - dr->wLength = cpu_to_le16(len); - - _rtw_memcpy(buf, pdata, len); - - usb_fill_control_urb(urb, udev, pipe, (unsigned char *)dr, buf, len, - _usbctrl_vendorreq_async_callback, buf); - - rc = usb_submit_urb(urb, GFP_ATOMIC); - if (rc < 0) { - rtw_mfree((u8*)buf, sizeof(*buf)); - usb_free_urb(urb); - } - -exit: - return rc; -} - -int usb_write_async(struct usb_device *udev, u32 addr, void *pdata, u16 len) -{ - u8 request; - u8 requesttype; - u16 wvalue; - u16 index; - - int ret; - - requesttype = VENDOR_WRITE;//write_out - request = REALTEK_USB_VENQT_CMD_REQ; - index = REALTEK_USB_VENQT_CMD_IDX;//n/a - - wvalue = (u16)(addr&0x0000ffff); - - ret = _usbctrl_vendorreq_async_write(udev, request, wvalue, index, pdata, len, requesttype); - - return ret; -} - -int usb_async_write8(struct intf_hdl *pintfhdl, u32 addr, u8 val) -{ - u8 data; - int ret; - struct dvobj_priv *pdvobjpriv = (struct dvobj_priv *)pintfhdl->pintf_dev; - struct usb_device *udev=pdvobjpriv->pusbdev; - - _func_enter_; - data = val; - ret = usb_write_async(udev, addr, &data, 1); - _func_exit_; - - return ret; -} - -int usb_async_write16(struct intf_hdl *pintfhdl, u32 addr, u16 val) -{ - u16 data; - int ret; - struct dvobj_priv *pdvobjpriv = (struct dvobj_priv *)pintfhdl->pintf_dev; - struct usb_device *udev=pdvobjpriv->pusbdev; - - _func_enter_; - data = val; - ret = usb_write_async(udev, addr, &data, 2); - _func_exit_; - - return ret; -} - -int usb_async_write32(struct intf_hdl *pintfhdl, u32 addr, u32 val) -{ - u32 data; - int ret; - struct dvobj_priv *pdvobjpriv = (struct dvobj_priv *)pintfhdl->pintf_dev; - struct usb_device *udev=pdvobjpriv->pusbdev; - - _func_enter_; - data = val; - ret = usb_write_async(udev, addr, &data, 4); - _func_exit_; - - return ret; -} -#endif /* CONFIG_USB_SUPPORT_ASYNC_VDN_REQ */ - -unsigned int ffaddr2pipehdl(struct dvobj_priv *pdvobj, u32 addr) -{ - unsigned int pipe=0, ep_num=0; - struct usb_device *pusbd = pdvobj->pusbdev; - - if (addr == RECV_BULK_IN_ADDR) { - pipe=usb_rcvbulkpipe(pusbd, pdvobj->RtInPipe[0]); - - } else if (addr == RECV_INT_IN_ADDR) { - pipe=usb_rcvbulkpipe(pusbd, pdvobj->RtInPipe[1]); - - } else if (addr < HW_QUEUE_ENTRY) { - ep_num = pdvobj->Queue2Pipe[addr]; - pipe = usb_sndbulkpipe(pusbd, ep_num); - } - - return pipe; -} - -struct zero_bulkout_context{ - void *pbuf; - void *purb; - void *pirp; - void *padapter; -}; - -static void usb_bulkout_zero_complete(struct urb *purb, struct pt_regs *regs) -{ - struct zero_bulkout_context *pcontext = (struct zero_bulkout_context *)purb->context; - - //DBG_8192C("+usb_bulkout_zero_complete\n"); - - if(pcontext) - { - if(pcontext->pbuf) - { - rtw_mfree(pcontext->pbuf, sizeof(int)); - } - - if(pcontext->purb && (pcontext->purb==purb)) - { - usb_free_urb(pcontext->purb); - } - - - rtw_mfree((u8*)pcontext, sizeof(struct zero_bulkout_context)); - } - - -} - -static u32 usb_bulkout_zero(struct intf_hdl *pintfhdl, u32 addr) -{ - int pipe, status, len; - u32 ret; - unsigned char *pbuf; - struct zero_bulkout_context *pcontext; - PURB purb = NULL; - struct adapter *padapter = (struct adapter *)pintfhdl->padapter; - struct dvobj_priv *pdvobj = adapter_to_dvobj(padapter); - struct usb_device *pusbd = pdvobj->pusbdev; - - //DBG_871X("%s\n", __func__); - - - if((padapter->bDriverStopped) || (padapter->bSurpriseRemoved) ||(dvobj_to_pwrctl(pdvobj)->pnp_bstop_trx)) - { - return _FAIL; - } - - - pcontext = (struct zero_bulkout_context *)rtw_zmalloc(sizeof(struct zero_bulkout_context)); - - pbuf = (unsigned char *)rtw_zmalloc(sizeof(int)); - purb = usb_alloc_urb(0, GFP_ATOMIC); - - len = 0; - pcontext->pbuf = pbuf; - pcontext->purb = purb; - pcontext->pirp = NULL; - pcontext->padapter = padapter; - - - //translate DMA FIFO addr to pipehandle - //pipe = ffaddr2pipehdl(pdvobj, addr); - - usb_fill_bulk_urb(purb, pusbd, pipe, - pbuf, - len, - usb_bulkout_zero_complete, - pcontext);//context is pcontext - - status = usb_submit_urb(purb, GFP_ATOMIC); - - if (!status) - { - ret= _SUCCESS; - } - else - { - ret= _FAIL; - } - - - return _SUCCESS; - -} - -void usb_read_mem(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *rmem) -{ - -} - -void usb_write_mem(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *wmem) -{ - -} - - -void usb_read_port_cancel(struct intf_hdl *pintfhdl) -{ - int i; - struct recv_buf *precvbuf; - struct adapter *padapter = pintfhdl->padapter; - precvbuf = (struct recv_buf *)padapter->recvpriv.precv_buf; - - DBG_871X("%s\n", __func__); - - padapter->bReadPortCancel = _TRUE; - - for (i=0; i < NR_RECVBUFF ; i++) { - - precvbuf->reuse = _TRUE; - if (precvbuf->purb) { - //DBG_8192C("usb_read_port_cancel : usb_kill_urb \n"); - usb_kill_urb(precvbuf->purb); - } - precvbuf++; - } - -#ifdef CONFIG_USB_INTERRUPT_IN_PIPE - usb_kill_urb(padapter->recvpriv.int_in_urb); -#endif -} - -static void usb_write_port_complete(struct urb *purb, struct pt_regs *regs) -{ - _irqL irqL; - int i; - struct xmit_buf *pxmitbuf = (struct xmit_buf *)purb->context; - //struct xmit_frame *pxmitframe = (struct xmit_frame *)pxmitbuf->priv_data; - //struct adapter *padapter = pxmitframe->padapter; - struct adapter *padapter = pxmitbuf->padapter; - struct xmit_priv *pxmitpriv = &padapter->xmitpriv; - //struct pkt_attrib *pattrib = &pxmitframe->attrib; - -_func_enter_; - - switch(pxmitbuf->flags) - { - case VO_QUEUE_INX: - pxmitpriv->voq_cnt--; - break; - case VI_QUEUE_INX: - pxmitpriv->viq_cnt--; - break; - case BE_QUEUE_INX: - pxmitpriv->beq_cnt--; - break; - case BK_QUEUE_INX: - pxmitpriv->bkq_cnt--; - break; - case HIGH_QUEUE_INX: -#ifdef CONFIG_AP_MODE - rtw_chk_hi_queue_cmd(padapter); -#endif - break; - default: - break; - } - - -/* - _enter_critical(&pxmitpriv->lock, &irqL); - - pxmitpriv->txirp_cnt--; - - switch(pattrib->priority) - { - case 1: - case 2: - pxmitpriv->bkq_cnt--; - //DBG_8192C("pxmitpriv->bkq_cnt=%d\n", pxmitpriv->bkq_cnt); - break; - case 4: - case 5: - pxmitpriv->viq_cnt--; - //DBG_8192C("pxmitpriv->viq_cnt=%d\n", pxmitpriv->viq_cnt); - break; - case 6: - case 7: - pxmitpriv->voq_cnt--; - //DBG_8192C("pxmitpriv->voq_cnt=%d\n", pxmitpriv->voq_cnt); - break; - case 0: - case 3: - default: - pxmitpriv->beq_cnt--; - //DBG_8192C("pxmitpriv->beq_cnt=%d\n", pxmitpriv->beq_cnt); - break; - - } - - _exit_critical(&pxmitpriv->lock, &irqL); - - - if(pxmitpriv->txirp_cnt==0) - { - RT_TRACE(_module_hci_ops_os_c_,_drv_err_,("usb_write_port_complete: txirp_cnt== 0, set allrxreturnevt!\n")); - _rtw_up_sema(&(pxmitpriv->tx_retevt)); - } -*/ - //rtw_free_xmitframe(pxmitpriv, pxmitframe); - - if(padapter->bSurpriseRemoved || padapter->bDriverStopped ||padapter->bWritePortCancel) - { - RT_TRACE(_module_hci_ops_os_c_,_drv_err_,("usb_write_port_complete:bDriverStopped(%d) OR bSurpriseRemoved(%d)", padapter->bDriverStopped, padapter->bSurpriseRemoved)); - DBG_8192C("%s(): TX Warning! bDriverStopped(%d) OR bSurpriseRemoved(%d) bWritePortCancel(%d) pxmitbuf->ext_tag(%x) \n", - __FUNCTION__,padapter->bDriverStopped, padapter->bSurpriseRemoved,padapter->bReadPortCancel,pxmitbuf->ext_tag); - - goto check_completion; - } - - - if (purb->status==0) { - - } else { - RT_TRACE(_module_hci_ops_os_c_,_drv_err_,("usb_write_port_complete : purb->status(%d) != 0 \n", purb->status)); - DBG_871X("###=> urb_write_port_complete status(%d)\n",purb->status); - if((purb->status==-EPIPE)||(purb->status==-EPROTO)) - { - //usb_clear_halt(pusbdev, purb->pipe); - //msleep(10); - sreset_set_wifi_error_status(padapter, USB_WRITE_PORT_FAIL); - } else if (purb->status == -EINPROGRESS) { - RT_TRACE(_module_hci_ops_os_c_,_drv_err_,("usb_write_port_complete: EINPROGESS\n")); - goto check_completion; - - } else if (purb->status == -ENOENT) { - DBG_871X("%s: -ENOENT\n", __func__); - goto check_completion; - - } else if (purb->status == -ECONNRESET) { - DBG_871X("%s: -ECONNRESET\n", __func__); - goto check_completion; - - } else if (purb->status == -ESHUTDOWN) { - RT_TRACE(_module_hci_ops_os_c_,_drv_err_,("usb_write_port_complete: ESHUTDOWN\n")); - padapter->bDriverStopped=_TRUE; - RT_TRACE(_module_hci_ops_os_c_,_drv_err_,("usb_write_port_complete:bDriverStopped=TRUE\n")); - - goto check_completion; - } - else - { - padapter->bSurpriseRemoved=_TRUE; - DBG_8192C("bSurpriseRemoved=TRUE\n"); - //rtl8192cu_trigger_gpio_0(padapter); - RT_TRACE(_module_hci_ops_os_c_,_drv_err_,("usb_write_port_complete:bSurpriseRemoved=TRUE\n")); - - goto check_completion; - } - } - - #ifdef DBG_CONFIG_ERROR_DETECT - { - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter); - pHalData->srestpriv.last_tx_complete_time = rtw_get_current_time(); - } - #endif - -check_completion: - _enter_critical(&pxmitpriv->lock_sctx, &irqL); - rtw_sctx_done_err(&pxmitbuf->sctx, - purb->status ? RTW_SCTX_DONE_WRITE_PORT_ERR : RTW_SCTX_DONE_SUCCESS); - _exit_critical(&pxmitpriv->lock_sctx, &irqL); - - rtw_free_xmitbuf(pxmitpriv, pxmitbuf); - - //if(rtw_txframes_pending(padapter)) - { - tasklet_hi_schedule(&pxmitpriv->xmit_tasklet); - } - -_func_exit_; - -} - -u32 usb_write_port(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *wmem) -{ - _irqL irqL; - unsigned int pipe; - int status; - u32 ret = _FAIL, bwritezero = _FALSE; - PURB purb = NULL; - struct adapter *padapter = (struct adapter *)pintfhdl->padapter; - struct dvobj_priv *pdvobj = adapter_to_dvobj(padapter); - struct xmit_priv *pxmitpriv = &padapter->xmitpriv; - struct xmit_buf *pxmitbuf = (struct xmit_buf *)wmem; - struct xmit_frame *pxmitframe = (struct xmit_frame *)pxmitbuf->priv_data; - struct usb_device *pusbd = pdvobj->pusbdev; - struct pkt_attrib *pattrib = &pxmitframe->attrib; - -_func_enter_; - - RT_TRACE(_module_hci_ops_os_c_,_drv_err_,("+usb_write_port\n")); - - if ((padapter->bDriverStopped) || (padapter->bSurpriseRemoved) ||(dvobj_to_pwrctl(pdvobj)->pnp_bstop_trx)) { - #ifdef DBG_TX - DBG_871X(" DBG_TX %s:%d bDriverStopped%d, bSurpriseRemoved:%d, pnp_bstop_trx:%d\n",__FUNCTION__, __LINE__ - ,padapter->bDriverStopped, padapter->bSurpriseRemoved, dvobj_to_pwrctl(pdvobj)->pnp_bstop_trx ); - #endif - RT_TRACE(_module_hci_ops_os_c_,_drv_err_,("usb_write_port:( padapter->bDriverStopped ||padapter->bSurpriseRemoved ||pwrctl->pnp_bstop_trx)!!!\n")); - rtw_sctx_done_err(&pxmitbuf->sctx, RTW_SCTX_DONE_TX_DENY); - goto exit; - } - - _enter_critical(&pxmitpriv->lock, &irqL); - - switch(addr) - { - case VO_QUEUE_INX: - pxmitpriv->voq_cnt++; - pxmitbuf->flags = VO_QUEUE_INX; - break; - case VI_QUEUE_INX: - pxmitpriv->viq_cnt++; - pxmitbuf->flags = VI_QUEUE_INX; - break; - case BE_QUEUE_INX: - pxmitpriv->beq_cnt++; - pxmitbuf->flags = BE_QUEUE_INX; - break; - case BK_QUEUE_INX: - pxmitpriv->bkq_cnt++; - pxmitbuf->flags = BK_QUEUE_INX; - break; - case HIGH_QUEUE_INX: - pxmitbuf->flags = HIGH_QUEUE_INX; - break; - default: - pxmitbuf->flags = MGT_QUEUE_INX; - break; - } - - _exit_critical(&pxmitpriv->lock, &irqL); - - #ifdef DBG_TRX_STA_PKTS - { - struct sta_info *psta = NULL; - struct sta_priv *pstapriv = &padapter->stapriv; - int bmcast = IS_MCAST(pattrib->dst); - u8 agg_num = 1; - - #ifdef CONFIG_USB_HCI - #ifdef CONFIG_USB_TX_AGGREGATION - if(pxmitframe->agg_num>1) - agg_num = pxmitframe->agg_num; - #endif - #endif - - #if defined(CONFIG_SDIO_HCI) || defined(CONFIG_GSPI_HCI) - if(pxmitframe->agg_num>1) - agg_num = pxmitframe->agg_num; - #endif - - if(bmcast) - { - psta = rtw_get_bcmc_stainfo(padapter); - - } else { - psta = rtw_get_stainfo(pstapriv, pattrib->dst); - } - if(psta) - { - switch(pattrib->priority) - { - case 1: - case 2: - psta->tx_bk_cnt += agg_num; - break; - case 4: - case 5: - psta->tx_vi_cnt += agg_num; - break; - case 6: - case 7: - psta->tx_vo_cnt += agg_num; - break; - case 0: - case 3: - default: - psta->tx_be_cnt += agg_num; - break; - } - } - } - #endif - - purb = pxmitbuf->pxmit_urb[0]; - -#if 0 - if(pdvobj->ishighspeed) - { - if(cnt> 0 && cnt%512 == 0) - { - //DBG_8192C("ishighspeed, cnt=%d\n", cnt); - bwritezero = _TRUE; - } - } - else - { - if(cnt > 0 && cnt%64 == 0) - { - //DBG_8192C("cnt=%d\n", cnt); - bwritezero = _TRUE; - } - } -#endif - - //translate DMA FIFO addr to pipehandle - pipe = ffaddr2pipehdl(pdvobj, addr); - -#ifdef CONFIG_REDUCE_USB_TX_INT - if ( (pxmitpriv->free_xmitbuf_cnt%NR_XMITBUFF == 0) - || (pxmitbuf->ext_tag == _TRUE) ) - { - purb->transfer_flags &= (~URB_NO_INTERRUPT); - } else { - purb->transfer_flags |= URB_NO_INTERRUPT; - //DBG_8192C("URB_NO_INTERRUPT "); - } -#endif - - - usb_fill_bulk_urb(purb, pusbd, pipe, - pxmitframe->buf_addr, //= pxmitbuf->pbuf - cnt, - usb_write_port_complete, - pxmitbuf);//context is pxmitbuf - -#ifdef CONFIG_USE_USB_BUFFER_ALLOC_TX - purb->transfer_dma = pxmitbuf->dma_transfer_addr; - purb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; - purb->transfer_flags |= URB_ZERO_PACKET; -#endif // CONFIG_USE_USB_BUFFER_ALLOC_TX - -#if 0 - if (bwritezero) - { - purb->transfer_flags |= URB_ZERO_PACKET; - } -#endif - - status = usb_submit_urb(purb, GFP_ATOMIC); - if (!status) { - #ifdef DBG_CONFIG_ERROR_DETECT - { - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter); - pHalData->srestpriv.last_tx_time = rtw_get_current_time(); - } - #endif - } else { - rtw_sctx_done_err(&pxmitbuf->sctx, RTW_SCTX_DONE_WRITE_PORT_ERR); - DBG_871X("usb_write_port, status=%d\n", status); - RT_TRACE(_module_hci_ops_os_c_,_drv_err_,("usb_write_port(): usb_submit_urb, status=%x\n", status)); - - switch (status) { - case -ENODEV: - padapter->bDriverStopped=_TRUE; - break; - default: - break; - } - goto exit; - } - - ret= _SUCCESS; - -// Commented by Albert 2009/10/13 -// We add the URB_ZERO_PACKET flag to urb so that the host will send the zero packet automatically. -/* - if(bwritezero == _TRUE) - { - usb_bulkout_zero(pintfhdl, addr); - } -*/ - - RT_TRACE(_module_hci_ops_os_c_,_drv_err_,("-usb_write_port\n")); - -exit: - if (ret != _SUCCESS) - rtw_free_xmitbuf(pxmitpriv, pxmitbuf); -_func_exit_; - return ret; - -} - -void usb_write_port_cancel(struct intf_hdl *pintfhdl) -{ - int i, j; - struct adapter *padapter = pintfhdl->padapter; - struct xmit_buf *pxmitbuf = (struct xmit_buf *)padapter->xmitpriv.pxmitbuf; - - DBG_871X("%s \n", __func__); - - padapter->bWritePortCancel = _TRUE; - - for (i=0; ipxmit_urb[j]) { - usb_kill_urb(pxmitbuf->pxmit_urb[j]); - } - } - pxmitbuf++; - } - - pxmitbuf = (struct xmit_buf*)padapter->xmitpriv.pxmit_extbuf; - for (i = 0; i < NR_XMIT_EXTBUFF; i++) { - for (j=0; j<8; j++) { - if(pxmitbuf->pxmit_urb[j]) { - usb_kill_urb(pxmitbuf->pxmit_urb[j]); - } - } - pxmitbuf++; - } -} - +/****************************************************************************** + * + * Copyright(c) 2007 - 2012 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 + * + *******************************************************************************/ +#define _USB_OPS_LINUX_C_ + +#include +#include +#include + +#ifdef CONFIG_USB_SUPPORT_ASYNC_VDN_REQ +static void _usbctrl_vendorreq_async_callback(struct urb *urb, struct pt_regs *regs) +{ + if (urb) { + if (urb->context) { + rtw_mfree(urb->context); + } + usb_free_urb(urb); + } +} + +static int _usbctrl_vendorreq_async_write(struct usb_device *udev, u8 request, + u16 value, u16 index, void *pdata, u16 len, u8 requesttype) +{ + int rc; + unsigned int pipe; + u8 reqtype; + struct usb_ctrlrequest *dr; + struct urb *urb; + struct rtl819x_async_write_data { + u8 data[VENDOR_CMD_MAX_DATA_LEN]; + struct usb_ctrlrequest dr; + } *buf; + + + if (requesttype == VENDOR_READ) { + pipe = usb_rcvctrlpipe(udev, 0);//read_in + reqtype = REALTEK_USB_VENQT_READ; + } + else { + pipe = usb_sndctrlpipe(udev, 0);//write_out + reqtype = REALTEK_USB_VENQT_WRITE; + } + + buf = (struct rtl819x_async_write_data *)rtw_zmalloc(sizeof(*buf)); + if (!buf) { + rc = -ENOMEM; + goto exit; + } + + urb = usb_alloc_urb(0, GFP_ATOMIC); + if (!urb) { + rtw_mfree((u8*)buf, sizeof(*buf)); + rc = -ENOMEM; + goto exit; + } + + dr = &buf->dr; + + dr->bRequestType = reqtype; + dr->bRequest = request; + dr->wValue = cpu_to_le16(value); + dr->wIndex = cpu_to_le16(index); + dr->wLength = cpu_to_le16(len); + + _rtw_memcpy(buf, pdata, len); + + usb_fill_control_urb(urb, udev, pipe, (unsigned char *)dr, buf, len, + _usbctrl_vendorreq_async_callback, buf); + + rc = usb_submit_urb(urb, GFP_ATOMIC); + if (rc < 0) { + rtw_mfree((u8*)buf, sizeof(*buf)); + usb_free_urb(urb); + } + +exit: + return rc; +} + +int usb_write_async(struct usb_device *udev, u32 addr, void *pdata, u16 len) +{ + u8 request; + u8 requesttype; + u16 wvalue; + u16 index; + + int ret; + + requesttype = VENDOR_WRITE;//write_out + request = REALTEK_USB_VENQT_CMD_REQ; + index = REALTEK_USB_VENQT_CMD_IDX;//n/a + + wvalue = (u16)(addr&0x0000ffff); + + ret = _usbctrl_vendorreq_async_write(udev, request, wvalue, index, pdata, len, requesttype); + + return ret; +} + +int usb_async_write8(struct intf_hdl *pintfhdl, u32 addr, u8 val) +{ + u8 data; + int ret; + struct dvobj_priv *pdvobjpriv = (struct dvobj_priv *)pintfhdl->pintf_dev; + struct usb_device *udev=pdvobjpriv->pusbdev; + + _func_enter_; + data = val; + ret = usb_write_async(udev, addr, &data, 1); + _func_exit_; + + return ret; +} + +int usb_async_write16(struct intf_hdl *pintfhdl, u32 addr, u16 val) +{ + u16 data; + int ret; + struct dvobj_priv *pdvobjpriv = (struct dvobj_priv *)pintfhdl->pintf_dev; + struct usb_device *udev=pdvobjpriv->pusbdev; + + _func_enter_; + data = val; + ret = usb_write_async(udev, addr, &data, 2); + _func_exit_; + + return ret; +} + +int usb_async_write32(struct intf_hdl *pintfhdl, u32 addr, u32 val) +{ + u32 data; + int ret; + struct dvobj_priv *pdvobjpriv = (struct dvobj_priv *)pintfhdl->pintf_dev; + struct usb_device *udev=pdvobjpriv->pusbdev; + + _func_enter_; + data = val; + ret = usb_write_async(udev, addr, &data, 4); + _func_exit_; + + return ret; +} +#endif /* CONFIG_USB_SUPPORT_ASYNC_VDN_REQ */ + +unsigned int ffaddr2pipehdl(struct dvobj_priv *pdvobj, u32 addr) +{ + unsigned int pipe=0, ep_num=0; + struct usb_device *pusbd = pdvobj->pusbdev; + + if (addr == RECV_BULK_IN_ADDR) { + pipe=usb_rcvbulkpipe(pusbd, pdvobj->RtInPipe[0]); + + } else if (addr == RECV_INT_IN_ADDR) { + pipe=usb_rcvbulkpipe(pusbd, pdvobj->RtInPipe[1]); + + } else if (addr < HW_QUEUE_ENTRY) { + ep_num = pdvobj->Queue2Pipe[addr]; + pipe = usb_sndbulkpipe(pusbd, ep_num); + } + + return pipe; +} + +struct zero_bulkout_context{ + void *pbuf; + void *purb; + void *pirp; + void *padapter; +}; + +static void usb_bulkout_zero_complete(struct urb *purb, struct pt_regs *regs) +{ + struct zero_bulkout_context *pcontext = (struct zero_bulkout_context *)purb->context; + + //DBG_8192C("+usb_bulkout_zero_complete\n"); + + if(pcontext) + { + if(pcontext->pbuf) + { + rtw_mfree(pcontext->pbuf, sizeof(int)); + } + + if(pcontext->purb && (pcontext->purb==purb)) + { + usb_free_urb(pcontext->purb); + } + + + rtw_mfree((u8*)pcontext, sizeof(struct zero_bulkout_context)); + } + + +} + +static u32 usb_bulkout_zero(struct intf_hdl *pintfhdl, u32 addr) +{ + int pipe, status, len; + u32 ret; + unsigned char *pbuf; + struct zero_bulkout_context *pcontext; + PURB purb = NULL; + struct adapter *padapter = (struct adapter *)pintfhdl->padapter; + struct dvobj_priv *pdvobj = adapter_to_dvobj(padapter); + struct usb_device *pusbd = pdvobj->pusbdev; + + //DBG_871X("%s\n", __func__); + + + if((padapter->bDriverStopped) || (padapter->bSurpriseRemoved) ||(dvobj_to_pwrctl(pdvobj)->pnp_bstop_trx)) + { + return _FAIL; + } + + + pcontext = (struct zero_bulkout_context *)rtw_zmalloc(sizeof(struct zero_bulkout_context)); + + pbuf = (unsigned char *)rtw_zmalloc(sizeof(int)); + purb = usb_alloc_urb(0, GFP_ATOMIC); + + len = 0; + pcontext->pbuf = pbuf; + pcontext->purb = purb; + pcontext->pirp = NULL; + pcontext->padapter = padapter; + + + //translate DMA FIFO addr to pipehandle + //pipe = ffaddr2pipehdl(pdvobj, addr); + + usb_fill_bulk_urb(purb, pusbd, pipe, + pbuf, + len, + usb_bulkout_zero_complete, + pcontext);//context is pcontext + + status = usb_submit_urb(purb, GFP_ATOMIC); + + if (!status) + { + ret= _SUCCESS; + } + else + { + ret= _FAIL; + } + + + return _SUCCESS; + +} + +void usb_read_mem(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *rmem) +{ + +} + +void usb_write_mem(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *wmem) +{ + +} + + +void usb_read_port_cancel(struct intf_hdl *pintfhdl) +{ + int i; + struct recv_buf *precvbuf; + struct adapter *padapter = pintfhdl->padapter; + precvbuf = (struct recv_buf *)padapter->recvpriv.precv_buf; + + DBG_871X("%s\n", __func__); + + padapter->bReadPortCancel = _TRUE; + + for (i=0; i < NR_RECVBUFF ; i++) { + + precvbuf->reuse = _TRUE; + if (precvbuf->purb) { + //DBG_8192C("usb_read_port_cancel : usb_kill_urb \n"); + usb_kill_urb(precvbuf->purb); + } + precvbuf++; + } + +#ifdef CONFIG_USB_INTERRUPT_IN_PIPE + usb_kill_urb(padapter->recvpriv.int_in_urb); +#endif +} + +static void usb_write_port_complete(struct urb *purb, struct pt_regs *regs) +{ + _irqL irqL; + int i; + struct xmit_buf *pxmitbuf = (struct xmit_buf *)purb->context; + //struct xmit_frame *pxmitframe = (struct xmit_frame *)pxmitbuf->priv_data; + //struct adapter *padapter = pxmitframe->padapter; + struct adapter *padapter = pxmitbuf->padapter; + struct xmit_priv *pxmitpriv = &padapter->xmitpriv; + //struct pkt_attrib *pattrib = &pxmitframe->attrib; + +_func_enter_; + + switch(pxmitbuf->flags) + { + case VO_QUEUE_INX: + pxmitpriv->voq_cnt--; + break; + case VI_QUEUE_INX: + pxmitpriv->viq_cnt--; + break; + case BE_QUEUE_INX: + pxmitpriv->beq_cnt--; + break; + case BK_QUEUE_INX: + pxmitpriv->bkq_cnt--; + break; + case HIGH_QUEUE_INX: +#ifdef CONFIG_AP_MODE + rtw_chk_hi_queue_cmd(padapter); +#endif + break; + default: + break; + } + + +/* + _enter_critical(&pxmitpriv->lock, &irqL); + + pxmitpriv->txirp_cnt--; + + switch(pattrib->priority) + { + case 1: + case 2: + pxmitpriv->bkq_cnt--; + //DBG_8192C("pxmitpriv->bkq_cnt=%d\n", pxmitpriv->bkq_cnt); + break; + case 4: + case 5: + pxmitpriv->viq_cnt--; + //DBG_8192C("pxmitpriv->viq_cnt=%d\n", pxmitpriv->viq_cnt); + break; + case 6: + case 7: + pxmitpriv->voq_cnt--; + //DBG_8192C("pxmitpriv->voq_cnt=%d\n", pxmitpriv->voq_cnt); + break; + case 0: + case 3: + default: + pxmitpriv->beq_cnt--; + //DBG_8192C("pxmitpriv->beq_cnt=%d\n", pxmitpriv->beq_cnt); + break; + + } + + _exit_critical(&pxmitpriv->lock, &irqL); + + + if(pxmitpriv->txirp_cnt==0) + { + RT_TRACE(_module_hci_ops_os_c_,_drv_err_,("usb_write_port_complete: txirp_cnt== 0, set allrxreturnevt!\n")); + _rtw_up_sema(&(pxmitpriv->tx_retevt)); + } +*/ + //rtw_free_xmitframe(pxmitpriv, pxmitframe); + + if(padapter->bSurpriseRemoved || padapter->bDriverStopped ||padapter->bWritePortCancel) + { + RT_TRACE(_module_hci_ops_os_c_,_drv_err_,("usb_write_port_complete:bDriverStopped(%d) OR bSurpriseRemoved(%d)", padapter->bDriverStopped, padapter->bSurpriseRemoved)); + DBG_8192C("%s(): TX Warning! bDriverStopped(%d) OR bSurpriseRemoved(%d) bWritePortCancel(%d) pxmitbuf->ext_tag(%x) \n", + __FUNCTION__,padapter->bDriverStopped, padapter->bSurpriseRemoved,padapter->bReadPortCancel,pxmitbuf->ext_tag); + + goto check_completion; + } + + + if (purb->status==0) { + + } else { + RT_TRACE(_module_hci_ops_os_c_,_drv_err_,("usb_write_port_complete : purb->status(%d) != 0 \n", purb->status)); + DBG_871X("###=> urb_write_port_complete status(%d)\n",purb->status); + if((purb->status==-EPIPE)||(purb->status==-EPROTO)) + { + //usb_clear_halt(pusbdev, purb->pipe); + //msleep(10); + sreset_set_wifi_error_status(padapter, USB_WRITE_PORT_FAIL); + } else if (purb->status == -EINPROGRESS) { + RT_TRACE(_module_hci_ops_os_c_,_drv_err_,("usb_write_port_complete: EINPROGESS\n")); + goto check_completion; + + } else if (purb->status == -ENOENT) { + DBG_871X("%s: -ENOENT\n", __func__); + goto check_completion; + + } else if (purb->status == -ECONNRESET) { + DBG_871X("%s: -ECONNRESET\n", __func__); + goto check_completion; + + } else if (purb->status == -ESHUTDOWN) { + RT_TRACE(_module_hci_ops_os_c_,_drv_err_,("usb_write_port_complete: ESHUTDOWN\n")); + padapter->bDriverStopped=_TRUE; + RT_TRACE(_module_hci_ops_os_c_,_drv_err_,("usb_write_port_complete:bDriverStopped=TRUE\n")); + + goto check_completion; + } + else + { + padapter->bSurpriseRemoved=_TRUE; + DBG_8192C("bSurpriseRemoved=TRUE\n"); + //rtl8192cu_trigger_gpio_0(padapter); + RT_TRACE(_module_hci_ops_os_c_,_drv_err_,("usb_write_port_complete:bSurpriseRemoved=TRUE\n")); + + goto check_completion; + } + } + + #ifdef DBG_CONFIG_ERROR_DETECT + { + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter); + pHalData->srestpriv.last_tx_complete_time = rtw_get_current_time(); + } + #endif + +check_completion: + _enter_critical(&pxmitpriv->lock_sctx, &irqL); + rtw_sctx_done_err(&pxmitbuf->sctx, + purb->status ? RTW_SCTX_DONE_WRITE_PORT_ERR : RTW_SCTX_DONE_SUCCESS); + _exit_critical(&pxmitpriv->lock_sctx, &irqL); + + rtw_free_xmitbuf(pxmitpriv, pxmitbuf); + + //if(rtw_txframes_pending(padapter)) + { + tasklet_hi_schedule(&pxmitpriv->xmit_tasklet); + } + +_func_exit_; + +} + +u32 usb_write_port(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *wmem) +{ + _irqL irqL; + unsigned int pipe; + int status; + u32 ret = _FAIL, bwritezero = _FALSE; + PURB purb = NULL; + struct adapter *padapter = (struct adapter *)pintfhdl->padapter; + struct dvobj_priv *pdvobj = adapter_to_dvobj(padapter); + struct xmit_priv *pxmitpriv = &padapter->xmitpriv; + struct xmit_buf *pxmitbuf = (struct xmit_buf *)wmem; + struct xmit_frame *pxmitframe = (struct xmit_frame *)pxmitbuf->priv_data; + struct usb_device *pusbd = pdvobj->pusbdev; + struct pkt_attrib *pattrib = &pxmitframe->attrib; + +_func_enter_; + + RT_TRACE(_module_hci_ops_os_c_,_drv_err_,("+usb_write_port\n")); + + if ((padapter->bDriverStopped) || (padapter->bSurpriseRemoved) ||(dvobj_to_pwrctl(pdvobj)->pnp_bstop_trx)) { + #ifdef DBG_TX + DBG_871X(" DBG_TX %s:%d bDriverStopped%d, bSurpriseRemoved:%d, pnp_bstop_trx:%d\n",__FUNCTION__, __LINE__ + ,padapter->bDriverStopped, padapter->bSurpriseRemoved, dvobj_to_pwrctl(pdvobj)->pnp_bstop_trx ); + #endif + RT_TRACE(_module_hci_ops_os_c_,_drv_err_,("usb_write_port:( padapter->bDriverStopped ||padapter->bSurpriseRemoved ||pwrctl->pnp_bstop_trx)!!!\n")); + rtw_sctx_done_err(&pxmitbuf->sctx, RTW_SCTX_DONE_TX_DENY); + goto exit; + } + + _enter_critical(&pxmitpriv->lock, &irqL); + + switch(addr) + { + case VO_QUEUE_INX: + pxmitpriv->voq_cnt++; + pxmitbuf->flags = VO_QUEUE_INX; + break; + case VI_QUEUE_INX: + pxmitpriv->viq_cnt++; + pxmitbuf->flags = VI_QUEUE_INX; + break; + case BE_QUEUE_INX: + pxmitpriv->beq_cnt++; + pxmitbuf->flags = BE_QUEUE_INX; + break; + case BK_QUEUE_INX: + pxmitpriv->bkq_cnt++; + pxmitbuf->flags = BK_QUEUE_INX; + break; + case HIGH_QUEUE_INX: + pxmitbuf->flags = HIGH_QUEUE_INX; + break; + default: + pxmitbuf->flags = MGT_QUEUE_INX; + break; + } + + _exit_critical(&pxmitpriv->lock, &irqL); + + #ifdef DBG_TRX_STA_PKTS + { + struct sta_info *psta = NULL; + struct sta_priv *pstapriv = &padapter->stapriv; + int bmcast = IS_MCAST(pattrib->dst); + u8 agg_num = 1; + + #ifdef CONFIG_USB_HCI + #ifdef CONFIG_USB_TX_AGGREGATION + if(pxmitframe->agg_num>1) + agg_num = pxmitframe->agg_num; + #endif + #endif + + #if defined(CONFIG_SDIO_HCI) || defined(CONFIG_GSPI_HCI) + if(pxmitframe->agg_num>1) + agg_num = pxmitframe->agg_num; + #endif + + if(bmcast) + { + psta = rtw_get_bcmc_stainfo(padapter); + + } else { + psta = rtw_get_stainfo(pstapriv, pattrib->dst); + } + if(psta) + { + switch(pattrib->priority) + { + case 1: + case 2: + psta->tx_bk_cnt += agg_num; + break; + case 4: + case 5: + psta->tx_vi_cnt += agg_num; + break; + case 6: + case 7: + psta->tx_vo_cnt += agg_num; + break; + case 0: + case 3: + default: + psta->tx_be_cnt += agg_num; + break; + } + } + } + #endif + + purb = pxmitbuf->pxmit_urb[0]; + +#if 0 + if(pdvobj->ishighspeed) + { + if(cnt> 0 && cnt%512 == 0) + { + //DBG_8192C("ishighspeed, cnt=%d\n", cnt); + bwritezero = _TRUE; + } + } + else + { + if(cnt > 0 && cnt%64 == 0) + { + //DBG_8192C("cnt=%d\n", cnt); + bwritezero = _TRUE; + } + } +#endif + + //translate DMA FIFO addr to pipehandle + pipe = ffaddr2pipehdl(pdvobj, addr); + +#ifdef CONFIG_REDUCE_USB_TX_INT + if ( (pxmitpriv->free_xmitbuf_cnt%NR_XMITBUFF == 0) + || (pxmitbuf->ext_tag == _TRUE) ) + { + purb->transfer_flags &= (~URB_NO_INTERRUPT); + } else { + purb->transfer_flags |= URB_NO_INTERRUPT; + //DBG_8192C("URB_NO_INTERRUPT "); + } +#endif + + + usb_fill_bulk_urb(purb, pusbd, pipe, + pxmitframe->buf_addr, //= pxmitbuf->pbuf + cnt, + usb_write_port_complete, + pxmitbuf);//context is pxmitbuf + +#ifdef CONFIG_USE_USB_BUFFER_ALLOC_TX + purb->transfer_dma = pxmitbuf->dma_transfer_addr; + purb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; + purb->transfer_flags |= URB_ZERO_PACKET; +#endif // CONFIG_USE_USB_BUFFER_ALLOC_TX + +#if 0 + if (bwritezero) + { + purb->transfer_flags |= URB_ZERO_PACKET; + } +#endif + + status = usb_submit_urb(purb, GFP_ATOMIC); + if (!status) { + #ifdef DBG_CONFIG_ERROR_DETECT + { + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter); + pHalData->srestpriv.last_tx_time = rtw_get_current_time(); + } + #endif + } else { + rtw_sctx_done_err(&pxmitbuf->sctx, RTW_SCTX_DONE_WRITE_PORT_ERR); + DBG_871X("usb_write_port, status=%d\n", status); + RT_TRACE(_module_hci_ops_os_c_,_drv_err_,("usb_write_port(): usb_submit_urb, status=%x\n", status)); + + switch (status) { + case -ENODEV: + padapter->bDriverStopped=_TRUE; + break; + default: + break; + } + goto exit; + } + + ret= _SUCCESS; + +// Commented by Albert 2009/10/13 +// We add the URB_ZERO_PACKET flag to urb so that the host will send the zero packet automatically. +/* + if(bwritezero == _TRUE) + { + usb_bulkout_zero(pintfhdl, addr); + } +*/ + + RT_TRACE(_module_hci_ops_os_c_,_drv_err_,("-usb_write_port\n")); + +exit: + if (ret != _SUCCESS) + rtw_free_xmitbuf(pxmitpriv, pxmitbuf); +_func_exit_; + return ret; + +} + +void usb_write_port_cancel(struct intf_hdl *pintfhdl) +{ + int i, j; + struct adapter *padapter = pintfhdl->padapter; + struct xmit_buf *pxmitbuf = (struct xmit_buf *)padapter->xmitpriv.pxmitbuf; + + DBG_871X("%s \n", __func__); + + padapter->bWritePortCancel = _TRUE; + + for (i=0; ipxmit_urb[j]) { + usb_kill_urb(pxmitbuf->pxmit_urb[j]); + } + } + pxmitbuf++; + } + + pxmitbuf = (struct xmit_buf*)padapter->xmitpriv.pxmit_extbuf; + for (i = 0; i < NR_XMIT_EXTBUFF; i++) { + for (j=0; j<8; j++) { + if(pxmitbuf->pxmit_urb[j]) { + usb_kill_urb(pxmitbuf->pxmit_urb[j]); + } + } + pxmitbuf++; + } +} diff --git a/os_dep/xmit_linux.c b/os_dep/xmit_linux.c index b00c50b..37354de 100755 --- a/os_dep/xmit_linux.c +++ b/os_dep/xmit_linux.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Copyright(c) 2007 - 2012 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. @@ -46,28 +46,28 @@ _func_enter_; pfile->pkt_len = pfile->buf_len = pktptr->len; pfile->cur_buffer = pfile->buf_start ; - + _func_exit_; } uint _rtw_pktfile_read (struct pkt_file *pfile, u8 *rmem, uint rlen) -{ +{ uint len = 0; - + _func_enter_; len = rtw_remainder_len(pfile); - len = (rlen > len)? len: rlen; + len = (rlen > len)? len: rlen; if(rmem) skb_copy_bits(pfile->pkt, pfile->buf_len-pfile->pkt_len, rmem, len); pfile->cur_addr += len; pfile->pkt_len -= len; - -_func_exit_; - return len; +_func_exit_; + + return len; } sint rtw_endofpktfile(struct pkt_file *pfile) @@ -90,10 +90,10 @@ void rtw_set_tx_chksum_offload(_pkt *pkt, struct pkt_attrib *pattrib) #ifdef CONFIG_TCP_CSUM_OFFLOAD_TX struct sk_buff *skb = (struct sk_buff *)pkt; pattrib->hw_tcp_csum = 0; - + if (skb->ip_summed == CHECKSUM_PARTIAL) { if (skb_shinfo(skb)->nr_frags == 0) - { + { const struct iphdr *ip = ip_hdr(skb); if (ip->protocol == IPPROTO_TCP) { // TCP checksum offload by HW @@ -102,7 +102,7 @@ void rtw_set_tx_chksum_offload(_pkt *pkt, struct pkt_attrib *pattrib) //skb_checksum_help(skb); } else if (ip->protocol == IPPROTO_UDP) { //DBG_871X("CHECKSUM_PARTIAL UDP\n"); -#if 1 +#if 1 skb_checksum_help(skb); #else // Set UDP checksum = 0 to skip checksum check @@ -116,11 +116,11 @@ void rtw_set_tx_chksum_offload(_pkt *pkt, struct pkt_attrib *pattrib) } else { // IP fragmentation case DBG_871X("%s-%d nr_frags != 0, using skb_checksum_help(skb);!!\n", __FUNCTION__, __LINE__); - skb_checksum_help(skb); - } + skb_checksum_help(skb); + } } -#endif - +#endif + } int rtw_os_xmit_resource_alloc(struct adapter *padapter, struct xmit_buf *pxmitbuf,u32 alloc_sz) @@ -136,7 +136,7 @@ int rtw_os_xmit_resource_alloc(struct adapter *padapter, struct xmit_buf *pxmitb if(pxmitbuf->pallocated_buf == NULL) return _FAIL; #else // CONFIG_USE_USB_BUFFER_ALLOC_TX - + pxmitbuf->pallocated_buf = rtw_zmalloc(alloc_sz); if (pxmitbuf->pallocated_buf == NULL) { @@ -149,15 +149,15 @@ int rtw_os_xmit_resource_alloc(struct adapter *padapter, struct xmit_buf *pxmitb #endif // CONFIG_USE_USB_BUFFER_ALLOC_TX for(i=0; i<8; i++) - { - pxmitbuf->pxmit_urb[i] = usb_alloc_urb(0, GFP_KERNEL); - if(pxmitbuf->pxmit_urb[i] == NULL) - { - DBG_871X("pxmitbuf->pxmit_urb[i]==NULL"); - return _FAIL; - } - - } + { + pxmitbuf->pxmit_urb[i] = usb_alloc_urb(0, GFP_KERNEL); + if(pxmitbuf->pxmit_urb[i] == NULL) + { + DBG_871X("pxmitbuf->pxmit_urb[i]==NULL"); + return _FAIL; + } + + } #endif #if defined(CONFIG_PCI_HCI) || defined(CONFIG_SDIO_HCI) || defined(CONFIG_GSPI_HCI) pxmitbuf->pallocated_buf = rtw_zmalloc(alloc_sz); @@ -169,7 +169,7 @@ int rtw_os_xmit_resource_alloc(struct adapter *padapter, struct xmit_buf *pxmitb pxmitbuf->pbuf = (u8 *)N_BYTE_ALIGMENT((SIZE_PTR)(pxmitbuf->pallocated_buf), XMITBUF_ALIGN_SZ); #endif - return _SUCCESS; + return _SUCCESS; } void rtw_os_xmit_resource_free(struct adapter *padapter, struct xmit_buf *pxmitbuf,u32 free_sz) @@ -268,7 +268,7 @@ void rtw_os_xmit_schedule(struct adapter *padapter) _enter_critical_bh(&pxmitpriv->lock, &irqL); - if(rtw_txframes_pending(padapter)) + if(rtw_txframes_pending(padapter)) { tasklet_hi_schedule(&pxmitpriv->xmit_tasklet); } @@ -325,7 +325,7 @@ static int rtw_mlcst2unicst(struct adapter *padapter, struct sk_buff *skb) _enter_critical_bh(&pstapriv->asoc_list_lock, &irqL); phead = &pstapriv->asoc_list; plist = get_next(phead); - + //free sta asoc_queue while ((rtw_end_of_queue_search(phead, plist)) == _FALSE) { int stainfo_offset; @@ -342,9 +342,9 @@ static int rtw_mlcst2unicst(struct adapter *padapter, struct sk_buff *skb) for (i = 0; i < chk_alive_num; i++) { psta = rtw_get_stainfo_by_offset(pstapriv, chk_alive_list[i]); if(!(psta->state &_FW_LINKED)) - continue; - - /* avoid come from STA1 and send back STA1 */ + continue; + + /* avoid come from STA1 and send back STA1 */ if (_rtw_memcmp(psta->hwaddr, &skb->data[6], 6) == _TRUE || _rtw_memcmp(psta->hwaddr, null_addr, 6) == _TRUE || _rtw_memcmp(psta->hwaddr, bc_addr, 6) == _TRUE @@ -382,7 +382,7 @@ int _rtw_xmit_entry(_pkt *pkt, _nic_hdl pnetdev) struct xmit_priv *pxmitpriv = &padapter->xmitpriv; #ifdef CONFIG_TX_MCAST2UNI struct mlme_priv *pmlmepriv = &padapter->mlmepriv; -#endif // CONFIG_TX_MCAST2UNI +#endif // CONFIG_TX_MCAST2UNI s32 res = 0; #if (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,35)) u16 queue; @@ -419,8 +419,8 @@ _func_enter_; //DBG_871X("Stop M2U(%d, %d)! ", pxmitpriv->free_xmitframe_cnt, pxmitpriv->free_xmitbuf_cnt); //DBG_871X("!m2u ); } - } -#endif // CONFIG_TX_MCAST2UNI + } +#endif // CONFIG_TX_MCAST2UNI res = rtw_xmit(padapter, &pkt); if (res < 0) { @@ -452,4 +452,3 @@ int rtw_xmit_entry(_pkt *pkt, _nic_hdl pnetdev) rtw_mstat_update(MSTAT_TYPE_SKB, MSTAT_ALLOC_SUCCESS, pkt->truesize); return _rtw_xmit_entry(pkt, pnetdev); } -