u8 rtl8812_set_rssi_cmd(_adapter*padapter, u8 *param)
{
	u8	res=_SUCCESS;
	HAL_DATA_TYPE	*pHalData = GET_HAL_DATA(padapter);
_func_enter_;

	*((u32*) param ) = cpu_to_le32( *((u32*) param ) );

	FillH2CCmd_8812(padapter, H2C_8812_RSSI_REPORT, 4, param);

_func_exit_;

	return res;
}
u8 rtl8812_h2c_msg_hdl(_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_8812(padapter, ElementID, CmdLen, pCmdBuffer);

	return H2C_SUCCESS;
}
void rtl8812_set_raid_cmd(PADAPTER padapter, u32 bitmap, u8* arg)
{
	HAL_DATA_TYPE	*pHalData = GET_HAL_DATA(padapter);
	struct dm_priv	*pdmpriv = &pHalData->dmpriv;
	struct mlme_ext_priv	*pmlmeext = &padapter->mlmeextpriv;
	struct mlme_ext_info	*pmlmeinfo = &(pmlmeext->mlmext_info);
	struct sta_info	*psta;
	u8 macid, init_rate, raid, shortGIrate=_FALSE;

_func_enter_;

	macid = arg[0];
	raid = arg[1];
	shortGIrate = arg[2];
	init_rate = arg[3];

	psta = pmlmeinfo->FW_sta_info[macid].psta;
	if(psta == NULL)
	{
		return;
	}

	if(pHalData->fw_ractrl == _TRUE)
	{
		u8	H2CCommand[7] ={0};

		shortGIrate = Get_RA_ShortGI(padapter, psta, shortGIrate);
	
		H2CCommand[0] = macid;
		H2CCommand[1] = (raid & 0x1F) | (shortGIrate?0x80:0x00) ;
		H2CCommand[2] = (pmlmeext->cur_bwmode & 0x3) |Get_RA_LDPC_8812(psta) |Get_VHT_ENI(0, psta->wireless_mode, bitmap);

		H2CCommand[3] = (u8)(bitmap & 0x000000ff);
		H2CCommand[4] = (u8)((bitmap & 0x0000ff00) >>8);
		H2CCommand[5] = (u8)((bitmap & 0x00ff0000) >> 16);
		H2CCommand[6] = (u8)((bitmap & 0xff000000) >> 24);

		DBG_871X("rtl8812_set_raid_cmd, bitmap=0x%x, mac_id=0x%x, raid=0x%x, shortGIrate=%x\n", bitmap, macid, raid, shortGIrate);

		FillH2CCmd_8812(padapter, H2C_8812_RA_MASK, 7, H2CCommand);
	}
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;
		}
	}
}
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)
	
		#if((RTL8812A_SUPPORT==1) ||(RTL8821A_SUPPORT==1))
   			FillH2CCmd_8812(Adapter, platform_h2c_id, CmdLen, pCmdBuffer);
		#elif(RTL8192E_SUPPORT==1)
			FillH2CCmd_8192E(Adapter, platform_h2c_id, CmdLen, pCmdBuffer);
		#elif(RTL8723B_SUPPORT==1)
			FillH2CCmd8723B(Adapter, platform_h2c_id, CmdLen, pCmdBuffer);
		#elif(RTL8188E_SUPPORT==1)
			if(!pDM_Odm->RaSupport88E)
				FillH2CCmd_88E(Adapter, platform_h2c_id, CmdLen, pCmdBuffer);		
		#elif(RTL8723A_SUPPORT==1)
			FillH2CCmd(Adapter, platform_h2c_id, CmdLen, pCmdBuffer);
		#elif(RTL8192D_SUPPORT==1)
			FillH2CCmd92D(Adapter, platform_h2c_id, CmdLen, pCmdBuffer);
		#elif(RTL8192C_SUPPORT==1)
			rtl8192c_FillH2CCmd(Adapter, platform_h2c_id, CmdLen, pCmdBuffer);
		#endif

	#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
}