Exemplo n.º 1
0
VOID
halTxbf8814A_FwTxBFCmd(
	IN	PADAPTER	Adapter
)
{
	u1Byte	Idx, Period = 0;
	u1Byte	PageNum0 = 0xFF, PageNum1 = 0xFF;
	u1Byte	u1TxBFParm[3] = {0};

	PMGNT_INFO				pMgntInfo = &(Adapter->MgntInfo);
	PRT_BEAMFORMING_INFO	pBeamInfo = GET_BEAMFORM_INFO(Adapter);

	for (Idx = 0; Idx < BEAMFORMEE_ENTRY_NUM; Idx++) {
		if (pBeamInfo->BeamformeeEntry[Idx].bUsed && pBeamInfo->BeamformeeEntry[Idx].BeamformEntryState == BEAMFORMING_ENTRY_STATE_PROGRESSED) {
			if (pBeamInfo->BeamformeeEntry[Idx].bSound) {
				PageNum0 = 0xFE;
				PageNum1 = 0x07;
				Period = (u1Byte)(pBeamInfo->BeamformeeEntry[Idx].SoundPeriod);
			} else if (PageNum0 == 0xFF) {
				PageNum0 = 0xFF; /*stop sounding*/
				PageNum1 = 0x0F;
			}
		}
	}

	u1TxBFParm[0] = PageNum0;
	u1TxBFParm[1] = PageNum1;
	u1TxBFParm[2] = Period;
	FillH2CCmd(Adapter, PHYDM_H2C_TXBF, 3, u1TxBFParm);

	RT_DISP(FBEAM, FBEAM_FUN, ("@%s End, PageNum0 = 0x%x, PageNum1 = 0x%x Period = %d", __func__, PageNum0, PageNum1, Period));
}
Exemplo n.º 2
0
VOID
HALBT_SendBtDbgH2c(
	IN	PADAPTER	Adapter,
	IN	u4Byte		CmdLen,
	IN	pu1Byte 		pCmdBuffer
	)
{
	if(IS_HARDWARE_TYPE_8723A(Adapter))
	{
		FillH2CCmd(Adapter, 0x46, CmdLen, pCmdBuffer);
	}
	else
	{
		FillH2CCmd(Adapter, 0x67, CmdLen, pCmdBuffer);
	}
}
Exemplo n.º 3
0
void rtl8723a_set_FwPwrMode_cmd(struct rtw_adapter *padapter, u8 Mode)
{
	struct setpwrmode_parm H2CSetPwrMode;
	struct pwrctrl_priv *pwrpriv = &padapter->pwrctrlpriv;
	struct hal_data_8723a *pHalData = GET_HAL_DATA(padapter);

	DBG_8723A("%s: Mode =%d SmartPS =%d UAPSD =%d BcnMode = 0x%02x\n", __func__,
			Mode, pwrpriv->smart_ps, padapter->registrypriv.uapsd_enable, pwrpriv->bcn_ant_mode);

	/*  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 (Mode != PS_MODE_ACTIVE && pHalData->rf_type != RF_2T2R)
		ODM_RF_Saving23a(&pHalData->odmpriv, true);

	H2CSetPwrMode.Mode = Mode;
	H2CSetPwrMode.SmartPS = pwrpriv->smart_ps;
	H2CSetPwrMode.AwakeInterval = 1;
	H2CSetPwrMode.bAllQueueUAPSD = padapter->registrypriv.uapsd_enable;
	H2CSetPwrMode.BcnAntMode = pwrpriv->bcn_ant_mode;

	FillH2CCmd(padapter, SET_PWRMODE_EID, sizeof(H2CSetPwrMode), (u8 *)&H2CSetPwrMode);

}
Exemplo n.º 4
0
int rtl8723a_set_rssi_cmd(struct rtw_adapter *padapter, u8 *param)
{
	*((u32 *)param) = cpu_to_le32(*((u32 *)param));

	FillH2CCmd(padapter, RSSI_SETTING_EID, 3, param);

	return _SUCCESS;
}
Exemplo n.º 5
0
BT_CTRL_STATUS
mptbt_SendH2c(
	PADAPTER	Adapter,
	PBT_H2C	pH2c,
	u2Byte		h2cCmdLen
	)
{
	//KIRQL				OldIrql = KeGetCurrentIrql();
	BT_CTRL_STATUS	h2cStatus=BT_STATUS_H2C_SUCCESS;
	PMPT_CONTEXT		pMptCtx=&(Adapter->mppriv.MptCtx);
	u1Byte				i;

	DBG_8192C("[MPT], mptbt_SendH2c()=========>\n");

	//PlatformResetEvent(&pMptCtx->MptH2cRspEvent);
	//PlatformResetEvent(&pMptCtx->MptBtC2hEvent);
	
//	if(OldIrql == PASSIVE_LEVEL)
//	{
		//RTPRINT_DATA(FMPBT, FMPBT_H2C_CONTENT, ("[MPT], MPT H2C hex: \n"), pH2c, h2cCmdLen);

		for(i=0; i<BT_H2C_MAX_RETRY; i++)
		{
			DBG_8192C("[MPT], Send H2C command to wifi!!!\n");
			FillH2CCmd(Adapter, 70, h2cCmdLen, (pu1Byte)pH2c);
			pMptCtx->h2cReqNum++;
			pMptCtx->h2cReqNum %= 16;

			if(WaitC2Hevent(Adapter, &pMptCtx->MptH2cRspEvent, 100))
			{
				DBG_8192C("[MPT], Received WiFi MptH2cRspEvent!!!\n");
				if(WaitC2Hevent(Adapter, &pMptCtx->MptBtC2hEvent, 400))
				{
					DBG_8192C("[MPT], Received MptBtC2hEvent!!!\n");
					break;
				}
				else
				{
					DBG_8192C("[MPT], Error!!BT MptBtC2hEvent timeout!!\n");
					h2cStatus = BT_STATUS_H2C_BT_NO_RSP;
				}
			}
			else
			{
				DBG_8192C("[MPT], Error!!WiFi  MptH2cRspEvent timeout!!\n");
				h2cStatus = BT_STATUS_H2C_TIMTOUT;
			}
		}
//	}
//	else
//	{
//		RT_ASSERT(FALSE, ("[MPT],  mptbt_SendH2c() can only run under PASSIVE_LEVEL!!\n"));
//		h2cStatus = BT_STATUS_WRONG_LEVEL;
//	}

	DBG_8192C("[MPT], mptbt_SendH2c()<=========\n");
	return h2cStatus;
}
Exemplo n.º 6
0
VOID
ODM_FillH2CCmd(
	IN	PDM_ODM_T		pDM_Odm,
	IN	u1Byte 			phydm_h2c_id,
	IN	u4Byte 			CmdLen,
	IN	pu1Byte			pCmdBuffer
)
{
	PADAPTER 	Adapter = pDM_Odm->Adapter;
	u1Byte		platform_h2c_id;

	platform_h2c_id=phydm_trans_h2c_id(pDM_Odm, phydm_h2c_id);

	if(platform_h2c_id==0xff)
	{
		ODM_RT_TRACE(pDM_Odm,PHYDM_COMP_RA_DBG, ODM_DBG_LOUD, ("[H2C] Wrong H2C CMD-ID !! platform_h2c_id==0xff ,  PHYDM_ElementID=((%d )) \n",phydm_h2c_id));
		return;
	}

	#if(DM_ODM_SUPPORT_TYPE & ODM_WIN)
		if(pDM_Odm->SupportICType == ODM_RTL8188E)
		{
			if(!pDM_Odm->RaSupport88E)
				FillH2CCmd88E(Adapter, platform_h2c_id, CmdLen, pCmdBuffer);
		}
		else if(pDM_Odm->SupportICType == ODM_RTL8192C)
		{
			FillH2CCmd92C(Adapter, platform_h2c_id, CmdLen, pCmdBuffer);
		}
		else if(pDM_Odm->SupportICType == ODM_RTL8814A)
		{
			FillH2CCmd8814A(Adapter, platform_h2c_id, CmdLen, pCmdBuffer);
		}
		else
		{		
			FillH2CCmd(Adapter, platform_h2c_id, CmdLen, pCmdBuffer);
		}
	#elif(DM_ODM_SUPPORT_TYPE & ODM_CE)
		rtw_hal_fill_h2c_cmd(Adapter, platform_h2c_id, CmdLen, pCmdBuffer);

	#elif(DM_ODM_SUPPORT_TYPE & ODM_AP)	
		#if((RTL8881A_SUPPORT==1)||(RTL8192E_SUPPORT==1)||(RTL8814A_SUPPORT==1)) 
			if(pDM_Odm->SupportICType == ODM_RTL8881A || pDM_Odm->SupportICType == ODM_RTL8192E|| pDM_Odm->SupportICType == ODM_RTL8814A) 
			{
				GET_HAL_INTERFACE(pDM_Odm->priv)->FillH2CCmdHandler(pDM_Odm->priv, platform_h2c_id, CmdLen, pCmdBuffer);
				//FillH2CCmd88XX(pDM_Odm->priv, platform_h2c_id, CmdLen, pCmdBuffer);				
			} else
		#endif
		#if(RTL8812A_SUPPORT==1) 
			if(pDM_Odm->SupportICType == ODM_RTL8812)
			{
				FillH2CCmd8812(pDM_Odm->priv, platform_h2c_id, CmdLen, pCmdBuffer);
			} else
		#endif
			{}
	#endif
}
Exemplo n.º 7
0
int rtl8723a_set_raid_cmd(struct rtw_adapter *padapter, u32 mask, u8 arg)
{
	u8 buf[5];

	memset(buf, 0, 5);
	mask = cpu_to_le32(mask);
	memcpy(buf, &mask, 4);
	buf[4]  = arg;

	FillH2CCmd(padapter, MACID_CONFIG_EID, 5, buf);

	return _SUCCESS;
}
VOID
halTxbf8821B_FwTxBFCmd(
	IN PDM_ODM_T			pDM_Odm
)
{
	u1Byte	Idx, Period0 = 0, Period1 = 0;
	u1Byte	PageNum0 = 0xFF, PageNum1 = 0xFF;
	u1Byte	u1TxBFParm[3] = {0};
	PRT_BEAMFORMING_INFO	pBeamInfo = &pDM_Odm->BeamformingInfo;

	for (Idx = 0; Idx < BEAMFORMEE_ENTRY_NUM; Idx++) {
		/*Modified by David*/
		if (pBeamInfo->BeamformeeEntry[Idx].bUsed && pBeamInfo->BeamformeeEntry[Idx].BeamformEntryState == BEAMFORMING_ENTRY_STATE_PROGRESSED) {
			if (Idx == 0) {
				if (pBeamInfo->BeamformeeEntry[Idx].bSound)
					PageNum0 = 0xFE;
				else
					PageNum0 = 0xFF; /*stop sounding*/
				Period0 = (u1Byte)(pBeamInfo->BeamformeeEntry[Idx].SoundPeriod);
			} else if (Idx == 1) {
				if (pBeamInfo->BeamformeeEntry[Idx].bSound)
					PageNum1 = 0xFE;
				else
					PageNum1 = 0xFF; /*stop sounding*/
				Period1 = (u1Byte)(pBeamInfo->BeamformeeEntry[Idx].SoundPeriod);
			}
		}
	}

	u1TxBFParm[0] = PageNum0;
	u1TxBFParm[1] = PageNum1;
	u1TxBFParm[2] = (Period1 << 4) | Period0;
	FillH2CCmd(Adapter, PHYDM_H2C_TXBF, 3, u1TxBFParm);

	ODM_RT_TRACE(pDM_Odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, 
		("[%s] PageNum0 = %d Period0 = %d, PageNum1 = %d Period1 %d\n", __func__, PageNum0, Period0, PageNum1, Period1));
}
Exemplo n.º 9
0
VOID
ODM_FillH2CCmd(
	IN	PDM_ODM_T		pDM_Odm,
	IN	u1Byte 			ElementID,
	IN	u4Byte 			CmdLen,
	IN	pu1Byte			pCmdBuffer
)
{
	PADAPTER 		Adapter = pDM_Odm->Adapter;

	if(pDM_Odm->SupportICType & ODM_IC_11AC_SERIES)
	{
		switch(ElementID)
		{
			case ODM_H2C_RSSI_REPORT:

#if(DM_ODM_SUPPORT_TYPE & ODM_WIN)
				FillH2CCmd(Adapter, H2C_RSSI_REPORT, CmdLen, pCmdBuffer);
#else
	#if((RTL8812A_SUPPORT==1) ||(RTL8821A_SUPPORT==1))
				FillH2CCmd_8812(Adapter, H2C_8812_RSSI_REPORT, CmdLen, pCmdBuffer);
	#endif
#endif
				break;
			case ODM_H2C_IQ_CALIBRATION:
#if(DM_ODM_SUPPORT_TYPE & ODM_WIN)
				FillH2CCmd(Adapter, H2C_IQ_CALIBRATION, CmdLen, pCmdBuffer);
#else
	#if((RTL8812A_SUPPORT==1) ||(RTL8821A_SUPPORT==1))
				FillH2CCmd_8812(Adapter, H2C_8812_IQ_CALIBRATION, CmdLen, pCmdBuffer);
	#endif
#endif
				break;
			default:
				break;
		}

	}
	else if(pDM_Odm->SupportICType == ODM_RTL8192E)
	{
		switch(ElementID)
		{
			case ODM_H2C_RSSI_REPORT:
#if(DM_ODM_SUPPORT_TYPE & ODM_WIN)
				FillH2CCmd(Adapter, H2C_RSSI_REPORT, CmdLen, pCmdBuffer);
#else
	#if(RTL8192E_SUPPORT==1)
				FillH2CCmd_8192E(Adapter, H2C_8192E_RSSI_REPORT, CmdLen, pCmdBuffer);
	#endif
#endif
				break;
			default:
				break;
		}	
	}
	else if(pDM_Odm->SupportICType == ODM_RTL8723B)
	{
		switch(ElementID)
		{
			case ODM_H2C_RSSI_REPORT:
#if(DM_ODM_SUPPORT_TYPE & ODM_WIN)
				FillH2CCmd(Adapter, H2C_RSSI_REPORT, CmdLen, pCmdBuffer);
#else
	#if(RTL8723B_SUPPORT==1)
				FillH2CCmd8723B(Adapter, H2C_8723B_RSSI_SETTING, CmdLen, pCmdBuffer);
	#endif
#endif
				break;
			case ODM_H2C_WIFI_CALIBRATION:
#if(DM_ODM_SUPPORT_TYPE & ODM_WIN)
				FillH2CCmd(Adapter, H2C_WIFI_CALIBRATION, CmdLen, pCmdBuffer);
#else
	#if(RTL8723B_SUPPORT==1)
				FillH2CCmd8723B(Adapter, H2C_8723B_BT_WLAN_CALIBRATION, CmdLen, pCmdBuffer);
	#endif
#endif
			   	break;
			default:
				break;			   
		}

	}
	else if(pDM_Odm->SupportICType == ODM_RTL8188E)
	{
		switch(ElementID)
		{
			case ODM_H2C_RSSI_REPORT:
				//if((pDM_Odm->CutVersion == ODM_CUT_I) && (!pDM_Odm->RaSupport88E)){
				if(!pDM_Odm->RaSupport88E){
#if(DM_ODM_SUPPORT_TYPE & ODM_WIN)
					FillH2CCmd88E(Adapter, H2C_88E_RSSI_REPORT, CmdLen, pCmdBuffer);
#else
	#if(RTL8188E_SUPPORT==1)
					FillH2CCmd_88E(Adapter, H2C_RSSI_REPORT, CmdLen, pCmdBuffer);
	#endif
#endif			
				}
				break;
			default:
				break;
		}
	}
#if(DM_ODM_SUPPORT_TYPE & ODM_CE)
	else if(pDM_Odm->SupportICType == ODM_RTL8723A)
	{
		switch(ElementID)
		{
			case ODM_H2C_RSSI_REPORT:
	#if(RTL8723A_SUPPORT==1)
				FillH2CCmd(Adapter, RSSI_SETTING_EID, CmdLen, pCmdBuffer);
	#endif
				break;
			default:
				break;
		}
	}
	else if(pDM_Odm->SupportICType == ODM_RTL8192D)
	{
		switch(ElementID)
		{
			case ODM_H2C_RSSI_REPORT:
	#if(RTL8192D_SUPPORT==1)
			FillH2CCmd92D(Adapter, H2C_RSSI_REPORT, CmdLen, pCmdBuffer);	
	#endif
				break;
			default:
				break;
		}
	}
#endif
	else
	{
		switch(ElementID)
		{
			case ODM_H2C_RSSI_REPORT:
#if(DM_ODM_SUPPORT_TYPE & ODM_WIN)
				FillH2CCmd92C(Adapter, H2C_RSSI_REPORT, CmdLen, pCmdBuffer);
#else
	#if(RTL8192C_SUPPORT==1)
				rtl8192c_FillH2CCmd(Adapter, RSSI_SETTING_EID, CmdLen, pCmdBuffer);
	#endif
#endif
				break;
			default:
				break;
		}
	}
}
/*-----------------------------------------------------------------------------
 * Function:	FirmwareSetH2CCmd()
 *
 * Overview:	Set FW H2C command (Decide ElementID, cmd content length, and get FW buffer)
 *
 * Input:		H2CCmd: H2C command type. 
 *			pCmdBuffer: Pointer of the H2C command content.
 *
 * Output:		NONE
 *
 * Return:		RT_STATUS
 *
 * Revised History:
 *	When		Who		Remark
 *	2009/1/12	tynli		Create the version 0.
 *
 *---------------------------------------------------------------------------*/
RT_STATUS
FirmwareSetH2CCmd( 
	struct net_device 	*dev, 
	u8				H2CCmd,
	u8*				pCmdBuffer
	)
{	
	struct r8192_priv   *priv = rtllib_priv(dev);
	u32				ElementID;
	u32				Cmd_Len;
	cb_desc			*pTcb;
	struct sk_buff	    	*skb;
	u32				Len;

	RT_STATUS		rtStatus;

	switch(H2CCmd){
	case FW_H2C_SETPWRMODE:
		{
			ElementID = H2C_SetPwrMode_CMD ;
			Cmd_Len = sizeof(H2C_SETPWRMODE_PARM);
		}
		break;
	case FW_H2C_JOINBSSRPT:
		{
			ElementID = H2C_JoinbssRpt_CMD;
			Cmd_Len = sizeof(H2C_JOINBSSRPT_PARM);
		}
		break;
	case FW_H2C_WoWLAN_UPDATE_GTK:
		{
			ElementID = H2C_WoWLAN_UPDATE_GTK_CMD;
			Cmd_Len = sizeof(H2C_WPA_TWO_WAY_PARA);
		}
		break;	
	case FW_H2C_WoWLAN_UPDATE_IV:
		{
			ElementID = H2C_WoWLAN_UPDATE_IV_CMD;
			Cmd_Len = sizeof(unsigned long long);
		}
		break;

	case FW_H2C_WoWLAN_OFFLOAD:
		{
			ElementID = H2C_WoWLAN_FW_OFFLOAD;
			Cmd_Len = sizeof(u8);
		}
		break;
	case FW_H2C_SITESURVEY:
		{
			ElementID = H2C_SiteSurvey_CMD;
			Cmd_Len = sizeof(H2C_SITESURVEY_PARA) + ((PH2C_SITESURVEY_PARA)pCmdBuffer)->probe_req_len - sizeof(tx_desc_fw);
		}
		break;
	default:
		break;
	}

	RT_TRACE(COMP_CMD, "FirmwareSetH2CCmd() HW_VAR_SET_TX_CMD: ElementID = %d, %d+%d=Cmd_Len = %d\n", ElementID, sizeof(H2C_SITESURVEY_PARA),((PH2C_SITESURVEY_PARA)pCmdBuffer)->probe_req_len, Cmd_Len);

	{
		Len = GetH2CCmdLen(MAX_TRANSMIT_BUFFER_SIZE, 1, &Cmd_Len);

		RT_TRACE(COMP_CMD, "---------->%s(), cmdlen:%d,len:%d\n", __func__,Cmd_Len,Len);
		skb  = dev_alloc_skb(Len); 
		memcpy((unsigned char *)(skb->cb),&dev,sizeof(dev));

		pTcb = (cb_desc*)(skb->cb + MAX_DEV_ADDR_SIZE);
		
		FillH2CCmd(skb, MAX_TRANSMIT_BUFFER_SIZE, 1, &ElementID, &Cmd_Len, &pCmdBuffer, &priv->H2CTxCmdSeq);
		

		rtStatus = CmdSendPacket(dev, pTcb, skb, Len, DESC_PACKET_TYPE_NORMAL, false);
		
	}
	
	write_nic_byte(dev, TPPoll, TPPoll_CQ);

	return RT_STATUS_SUCCESS;
}
Exemplo n.º 11
0
static void SetFwRsvdPagePkt_BTCoex(struct rtw_adapter *padapter)
{
	struct hal_data_8723a *pHalData;
	struct xmit_frame *pmgntframe;
	struct pkt_attrib *pattrib;
	struct xmit_priv *pxmitpriv;
	struct mlme_ext_priv *pmlmeext;
	struct mlme_ext_info *pmlmeinfo;
	u8 fakemac[6] = {0x00, 0xe0, 0x4c, 0x00, 0x00, 0x00};
	u32 NullDataLength, BTQosNullLength;
	u8 *ReservedPagePacket;
	u8 PageNum, PageNeed, TxDescLen;
	u16 BufIndex;
	u32 TotalPacketLen;
	struct rsvdpage_loc	RsvdPageLoc;

	DBG_8723A("+%s\n", __func__);

	ReservedPagePacket = kzalloc(1024, GFP_KERNEL);
	if (ReservedPagePacket == NULL) {
		DBG_8723A("%s: alloc ReservedPagePacket fail!\n", __func__);
		return;
	}

	pHalData = GET_HAL_DATA(padapter);
	pxmitpriv = &padapter->xmitpriv;
	pmlmeext = &padapter->mlmeextpriv;
	pmlmeinfo = &pmlmeext->mlmext_info;

	TxDescLen = TXDESC_SIZE;
	PageNum = 0;

	/* 3 (1) beacon */
	BufIndex = TXDESC_OFFSET;
	/*  skip Beacon Packet */
	PageNeed = 3;

	PageNum += PageNeed;
	pHalData->FwRsvdPageStartOffset = PageNum;

	BufIndex += PageNeed*128;

	/* 3 (3) null data */
	RsvdPageLoc.LocNullData = PageNum;
	ConstructNullFunctionData(
		padapter,
		&ReservedPagePacket[BufIndex],
		&NullDataLength,
		fakemac,
		false, 0, 0, false);
	rtl8723a_fill_fake_txdesc(padapter, &ReservedPagePacket[BufIndex-TxDescLen], NullDataLength, false, false);

	PageNeed = (u8)PageNum_128(TxDescLen + NullDataLength);
	PageNum += PageNeed;

	BufIndex += PageNeed*128;

	/* 3 (6) BT Qos null data */
	RsvdPageLoc.LocBTQosNull = PageNum;
	ConstructNullFunctionData(
		padapter,
		&ReservedPagePacket[BufIndex],
		&BTQosNullLength,
		fakemac,
		true, 0, 0, false);
	rtl8723a_fill_fake_txdesc(padapter, &ReservedPagePacket[BufIndex-TxDescLen], BTQosNullLength, false, true);

	TotalPacketLen = BufIndex + BTQosNullLength;

	pmgntframe = alloc_mgtxmitframe23a(pxmitpriv);
	if (pmgntframe == NULL)
		goto exit;

	/*  update attribute */
	pattrib = &pmgntframe->attrib;
	update_mgntframe_attrib23a(padapter, pattrib);
	pattrib->qsel = 0x10;
	pattrib->pktlen = pattrib->last_txcmdsz = TotalPacketLen - TXDESC_OFFSET;
	memcpy(pmgntframe->buf_addr, ReservedPagePacket, TotalPacketLen);

	rtl8723au_mgnt_xmit(padapter, pmgntframe);

	DBG_8723A("%s: Set RSVD page location to Fw\n", __func__);
	FillH2CCmd(padapter, RSVD_PAGE_EID, sizeof(RsvdPageLoc), (u8 *)&RsvdPageLoc);

exit:
	kfree(ReservedPagePacket);
}
Exemplo n.º 12
0
void rtl8723a_set_FwJoinBssReport_cmd(struct rtw_adapter *padapter, u8 mstatus)
{
	struct joinbssrpt_parm	JoinBssRptParm;
	struct hal_data_8723a	*pHalData = GET_HAL_DATA(padapter);
	struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
	struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info;

	DBG_8723A("%s mstatus(%x)\n", __func__, mstatus);

	if (mstatus == 1) {
		bool bRecover = false;
		u8 v8;

		/*  We should set AID, correct TSF, HW seq enable before set JoinBssReport to Fw in 88/92C. */
		/*  Suggested by filen. Added by tynli. */
		rtl8723au_write16(padapter, REG_BCN_PSR_RPT,
				  0xC000|pmlmeinfo->aid);
		/*  Do not set TSF again here or vWiFi beacon DMA INT will not work. */
		/* correct_TSF23a(padapter, pmlmeext); */
		/*  Hw sequende enable by dedault. 2010.06.23. by tynli. */
		/* rtl8723au_write16(padapter, REG_NQOS_SEQ, ((pmlmeext->mgnt_seq+100)&0xFFF)); */
		/* rtl8723au_write8(padapter, REG_HWSEQ_CTRL, 0xFF); */

		/*  set REG_CR bit 8 */
		v8 = rtl8723au_read8(padapter, REG_CR+1);
		v8 |= BIT(0); /*  ENSWBCN */
		rtl8723au_write8(padapter,  REG_CR+1, v8);

		/*  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. */
/*			SetBcnCtrlReg23a(padapter, 0, BIT(3)); */
/*			SetBcnCtrlReg23a(padapter, BIT(4), 0); */
		SetBcnCtrlReg23a(padapter, BIT(4), BIT(3));

		/*  Set FWHW_TXQ_CTRL 0x422[6]= 0 to tell Hw the packet is not a real beacon frame. */
		if (pHalData->RegFwHwTxQCtrl & BIT(6))
			bRecover = true;

		/*  To tell Hw the packet is not a real beacon frame. */
		/* U1bTmp = rtl8723au_read8(padapter, REG_FWHW_TXQ_CTRL+2); */
		rtl8723au_write8(padapter, REG_FWHW_TXQ_CTRL + 2,
				 pHalData->RegFwHwTxQCtrl & ~BIT(6));
		pHalData->RegFwHwTxQCtrl &= ~BIT(6);
		SetFwRsvdPagePkt(padapter, 0);

		/*  2010.05.11. Added by tynli. */
		SetBcnCtrlReg23a(padapter, BIT(3), 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 (bRecover) {
			rtl8723au_write8(padapter, REG_FWHW_TXQ_CTRL + 2,
					 pHalData->RegFwHwTxQCtrl | BIT(6));
			pHalData->RegFwHwTxQCtrl |= BIT(6);
		}

		/*  Clear CR[8] or beacon packet will not be send to TxBuf anymore. */
		v8 = rtl8723au_read8(padapter, REG_CR+1);
		v8 &= ~BIT(0); /*  ~ENSWBCN */
		rtl8723au_write8(padapter, REG_CR+1, v8);
	}

	JoinBssRptParm.OpMode = mstatus;

	FillH2CCmd(padapter, JOINBSS_RPT_EID, sizeof(JoinBssRptParm), (u8 *)&JoinBssRptParm);

}
Exemplo n.º 13
0
/*  2009.10.15 by tynli. */
static void SetFwRsvdPagePkt(struct rtw_adapter *padapter, bool bDLFinished)
{
	struct hal_data_8723a *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 = 0, ProbeRspLength = 0, PSPollLength;
	u32 NullDataLength, QosNullLength, BTQosNullLength;
	u8 *ReservedPagePacket;
	u8 PageNum, PageNeed, TxDescLen;
	u16 BufIndex;
	u32 TotalPacketLen;
	struct rsvdpage_loc	RsvdPageLoc;

	DBG_8723A("%s\n", __func__);

	ReservedPagePacket = kzalloc(1000, GFP_KERNEL);
	if (ReservedPagePacket == NULL) {
		DBG_8723A("%s: alloc ReservedPagePacket fail!\n", __func__);
		return;
	}

	pHalData = GET_HAL_DATA(padapter);
	pxmitpriv = &padapter->xmitpriv;
	pmlmeext = &padapter->mlmeextpriv;
	pmlmeinfo = &pmlmeext->mlmext_info;

	TxDescLen = TXDESC_SIZE;
	PageNum = 0;

	/* 3 (1) beacon */
	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 */
	RsvdPageLoc.LocPsPoll = PageNum;
	ConstructPSPoll(padapter, &ReservedPagePacket[BufIndex], &PSPollLength);
	rtl8723a_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 */
	RsvdPageLoc.LocNullData = PageNum;
	ConstructNullFunctionData(padapter, &ReservedPagePacket[BufIndex],
				  &NullDataLength,
				  get_my_bssid23a(&pmlmeinfo->network),
				  false, 0, 0, false);
	rtl8723a_fill_fake_txdesc(padapter,
				  &ReservedPagePacket[BufIndex-TxDescLen],
				  NullDataLength, false, false);

	PageNeed = (u8)PageNum_128(TxDescLen + NullDataLength);
	PageNum += PageNeed;

	BufIndex += PageNeed*128;

	/* 3 (4) probe response */
	RsvdPageLoc.LocProbeRsp = PageNum;
	ConstructProbeRsp(
		padapter,
		&ReservedPagePacket[BufIndex],
		&ProbeRspLength,
		get_my_bssid23a(&pmlmeinfo->network),
		false);
	rtl8723a_fill_fake_txdesc(padapter, &ReservedPagePacket[BufIndex-TxDescLen], ProbeRspLength, false, false);

	PageNeed = (u8)PageNum_128(TxDescLen + ProbeRspLength);
	PageNum += PageNeed;

	BufIndex += PageNeed*128;

	/* 3 (5) Qos null data */
	RsvdPageLoc.LocQosNull = PageNum;
	ConstructNullFunctionData(
		padapter,
		&ReservedPagePacket[BufIndex],
		&QosNullLength,
		get_my_bssid23a(&pmlmeinfo->network),
		true, 0, 0, false);
	rtl8723a_fill_fake_txdesc(padapter, &ReservedPagePacket[BufIndex-TxDescLen], QosNullLength, false, false);

	PageNeed = (u8)PageNum_128(TxDescLen + QosNullLength);
	PageNum += PageNeed;

	BufIndex += PageNeed*128;

	/* 3 (6) BT Qos null data */
	RsvdPageLoc.LocBTQosNull = PageNum;
	ConstructNullFunctionData(
		padapter,
		&ReservedPagePacket[BufIndex],
		&BTQosNullLength,
		get_my_bssid23a(&pmlmeinfo->network),
		true, 0, 0, false);
	rtl8723a_fill_fake_txdesc(padapter, &ReservedPagePacket[BufIndex-TxDescLen], BTQosNullLength, false, true);

	TotalPacketLen = BufIndex + BTQosNullLength;

	pmgntframe = alloc_mgtxmitframe23a(pxmitpriv);
	if (pmgntframe == NULL)
		goto exit;

	/*  update attribute */
	pattrib = &pmgntframe->attrib;
	update_mgntframe_attrib23a(padapter, pattrib);
	pattrib->qsel = 0x10;
	pattrib->pktlen = pattrib->last_txcmdsz = TotalPacketLen - TXDESC_OFFSET;
	memcpy(pmgntframe->buf_addr, ReservedPagePacket, TotalPacketLen);

	rtl8723au_mgnt_xmit(padapter, pmgntframe);

	DBG_8723A("%s: Set RSVD page location to Fw\n", __func__);
	FillH2CCmd(padapter, RSVD_PAGE_EID, sizeof(RsvdPageLoc), (u8 *)&RsvdPageLoc);

exit:
	kfree(ReservedPagePacket);
}