2013-05-08 21:45:39 +00:00
|
|
|
/******************************************************************************
|
|
|
|
*
|
|
|
|
* Copyright(c) 2007 - 2012 Realtek Corporation. All rights reserved.
|
2014-12-19 06:59:46 +00:00
|
|
|
*
|
2013-05-08 21:45:39 +00:00
|
|
|
* 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 _HAL_INTF_C_
|
2014-12-11 21:15:04 +00:00
|
|
|
#include <drv_conf.h>
|
2013-05-08 21:45:39 +00:00
|
|
|
#include <osdep_service.h>
|
|
|
|
#include <drv_types.h>
|
2014-12-11 21:15:04 +00:00
|
|
|
#include <rtw_byteorder.h>
|
2013-05-08 21:45:39 +00:00
|
|
|
#include <hal_intf.h>
|
2014-12-28 17:13:03 +00:00
|
|
|
#include <usb_hal.h>
|
2014-12-11 21:15:04 +00:00
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
void rtw_hal_chip_configure(struct adapter *padapter)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-11 21:15:04 +00:00
|
|
|
if(padapter->HalFunc.intf_chip_configure)
|
|
|
|
padapter->HalFunc.intf_chip_configure(padapter);
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
void rtw_hal_read_chip_info(struct adapter *padapter)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-11 21:15:04 +00:00
|
|
|
if(padapter->HalFunc.read_adapter_info)
|
|
|
|
padapter->HalFunc.read_adapter_info(padapter);
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
void rtw_hal_read_chip_version(struct adapter *padapter)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-11 21:15:04 +00:00
|
|
|
if(padapter->HalFunc.read_chip_version)
|
|
|
|
padapter->HalFunc.read_chip_version(padapter);
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
void rtw_hal_def_value_init(struct adapter *padapter)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-11 21:15:04 +00:00
|
|
|
if (is_primary_adapter(padapter))
|
|
|
|
if(padapter->HalFunc.init_default_value)
|
|
|
|
padapter->HalFunc.init_default_value(padapter);
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
2014-12-17 23:13:53 +00:00
|
|
|
void rtw_hal_free_data(struct adapter *padapter)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-11 21:15:04 +00:00
|
|
|
if (is_primary_adapter(padapter))
|
|
|
|
if(padapter->HalFunc.free_hal_data)
|
|
|
|
padapter->HalFunc.free_hal_data(padapter);
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
2014-12-17 23:13:53 +00:00
|
|
|
void rtw_hal_dm_init(struct adapter *padapter)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-11 21:15:04 +00:00
|
|
|
if (is_primary_adapter(padapter))
|
|
|
|
if(padapter->HalFunc.dm_init)
|
|
|
|
padapter->HalFunc.dm_init(padapter);
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
2014-12-17 23:13:53 +00:00
|
|
|
void rtw_hal_dm_deinit(struct adapter *padapter)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-11 21:15:04 +00:00
|
|
|
// cancel dm timer
|
|
|
|
if (is_primary_adapter(padapter))
|
|
|
|
if(padapter->HalFunc.dm_deinit)
|
|
|
|
padapter->HalFunc.dm_deinit(padapter);
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
2014-12-17 23:13:53 +00:00
|
|
|
void rtw_hal_sw_led_init(struct adapter *padapter)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-11 21:15:04 +00:00
|
|
|
if(padapter->HalFunc.InitSwLeds)
|
|
|
|
padapter->HalFunc.InitSwLeds(padapter);
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
void rtw_hal_sw_led_deinit(struct adapter *padapter)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-11 21:15:04 +00:00
|
|
|
if(padapter->HalFunc.DeInitSwLeds)
|
|
|
|
padapter->HalFunc.DeInitSwLeds(padapter);
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
u32 rtw_hal_power_on(struct adapter *padapter)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-11 21:15:04 +00:00
|
|
|
if(padapter->HalFunc.hal_power_on)
|
|
|
|
return padapter->HalFunc.hal_power_on(padapter);
|
2013-05-08 21:45:39 +00:00
|
|
|
return _FAIL;
|
|
|
|
}
|
2014-12-17 23:13:53 +00:00
|
|
|
void rtw_hal_power_off(struct adapter *padapter)
|
2014-12-11 21:15:04 +00:00
|
|
|
{
|
|
|
|
if(padapter->HalFunc.hal_power_off)
|
2014-12-19 06:59:46 +00:00
|
|
|
padapter->HalFunc.hal_power_off(padapter);
|
2014-12-11 21:15:04 +00:00
|
|
|
}
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
|
2014-12-19 06:59:46 +00:00
|
|
|
uint rtw_hal_init(struct adapter *padapter)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
|
|
|
uint status = _SUCCESS;
|
2014-12-11 21:15:04 +00:00
|
|
|
struct dvobj_priv *dvobj = adapter_to_dvobj(padapter);
|
|
|
|
int i;
|
|
|
|
|
|
|
|
#ifdef CONFIG_DUALMAC_CONCURRENT
|
|
|
|
if(padapter->hw_init_completed == _TRUE)
|
|
|
|
{
|
|
|
|
DBG_871X("rtw_hal_init: hw_init_completed == _TRUE\n");
|
|
|
|
return status;
|
|
|
|
}
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
// before init mac0, driver must init mac1 first to avoid usb rx error.
|
|
|
|
if((padapter->pbuddy_adapter != NULL) && (padapter->DualMacConcurrent == _TRUE)
|
|
|
|
&& (padapter->adapter_type == PRIMARY_ADAPTER))
|
|
|
|
{
|
|
|
|
if(padapter->pbuddy_adapter->hw_init_completed == _TRUE)
|
|
|
|
{
|
|
|
|
DBG_871X("rtw_hal_init: pbuddy_adapter hw_init_completed == _TRUE\n");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2014-12-19 06:59:46 +00:00
|
|
|
status = padapter->HalFunc.hal_init(padapter->pbuddy_adapter);
|
2014-12-11 21:15:04 +00:00
|
|
|
if(status == _SUCCESS){
|
|
|
|
padapter->pbuddy_adapter->hw_init_completed = _TRUE;
|
|
|
|
}
|
|
|
|
else{
|
2014-12-19 06:59:46 +00:00
|
|
|
padapter->pbuddy_adapter->hw_init_completed = _FALSE;
|
2014-12-11 21:15:04 +00:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
status = padapter->HalFunc.hal_init(padapter);
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
if(status == _SUCCESS){
|
|
|
|
for (i = 0; i<dvobj->iface_nums; i++) {
|
|
|
|
padapter = dvobj->padapters[i];
|
|
|
|
padapter->hw_init_completed = _TRUE;
|
|
|
|
}
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
if (padapter->registrypriv.notch_filter == 1)
|
|
|
|
rtw_hal_notch_filter(padapter, 1);
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
rtw_hal_reset_security_engine(padapter);
|
|
|
|
rtw_sec_restore_wep_key(padapter);
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
init_hw_mlme_ext(padapter);
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
for (i = 0; i<dvobj->iface_nums; i++) {
|
|
|
|
padapter = dvobj->padapters[i];
|
|
|
|
padapter->hw_init_completed = _FALSE;
|
|
|
|
}
|
|
|
|
DBG_871X("rtw_hal_init: hal__init fail\n");
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
RT_TRACE(_module_hal_init_c_,_drv_err_,("-rtl871x_hal_init:status=0x%x\n",status));
|
2013-05-08 21:45:39 +00:00
|
|
|
|
|
|
|
return status;
|
|
|
|
|
2014-12-19 06:59:46 +00:00
|
|
|
}
|
2014-12-11 21:15:04 +00:00
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
uint rtw_hal_deinit(struct adapter *padapter)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
|
|
|
uint status = _SUCCESS;
|
2014-12-11 21:15:04 +00:00
|
|
|
struct dvobj_priv *dvobj = adapter_to_dvobj(padapter);
|
|
|
|
int i;
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
_func_enter_;
|
|
|
|
if (!is_primary_adapter(padapter)){
|
|
|
|
DBG_871X(" rtw_hal_deinit: Secondary adapter return l\n");
|
|
|
|
return status;
|
|
|
|
}
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
status = padapter->HalFunc.hal_deinit(padapter);
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
if(status == _SUCCESS){
|
|
|
|
for (i = 0; i<dvobj->iface_nums; i++) {
|
|
|
|
padapter = dvobj->padapters[i];
|
|
|
|
padapter->hw_init_completed = _FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
DBG_871X("\n rtw_hal_deinit: hal_init fail\n");
|
|
|
|
}
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
_func_exit_;
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
return status;
|
|
|
|
}
|
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
void rtw_hal_set_hwreg(struct adapter *padapter, u8 variable, u8 *val)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-11 21:15:04 +00:00
|
|
|
if (padapter->HalFunc.SetHwRegHandler)
|
|
|
|
padapter->HalFunc.SetHwRegHandler(padapter, variable, val);
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
void rtw_hal_get_hwreg(struct adapter *padapter, u8 variable, u8 *val)
|
2013-05-19 04:28:07 +00:00
|
|
|
{
|
2014-12-11 21:15:04 +00:00
|
|
|
if (padapter->HalFunc.GetHwRegHandler)
|
|
|
|
padapter->HalFunc.GetHwRegHandler(padapter, variable, val);
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
2013-08-04 23:08:37 +00:00
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
u8 rtw_hal_set_def_var(struct adapter *padapter, HAL_DEF_VARIABLE eVariable, PVOID pValue)
|
2014-12-19 06:59:46 +00:00
|
|
|
{
|
2014-12-11 21:15:04 +00:00
|
|
|
if(padapter->HalFunc.SetHalDefVarHandler)
|
|
|
|
return padapter->HalFunc.SetHalDefVarHandler(padapter,eVariable,pValue);
|
2013-05-19 04:28:07 +00:00
|
|
|
return _FAIL;
|
|
|
|
}
|
2014-12-17 23:13:53 +00:00
|
|
|
u8 rtw_hal_get_def_var(struct adapter *padapter, HAL_DEF_VARIABLE eVariable, PVOID pValue)
|
2014-12-19 06:59:46 +00:00
|
|
|
{
|
2014-12-11 21:15:04 +00:00
|
|
|
if(padapter->HalFunc.GetHalDefVarHandler)
|
|
|
|
return padapter->HalFunc.GetHalDefVarHandler(padapter,eVariable,pValue);
|
2014-12-19 06:59:46 +00:00
|
|
|
return _FAIL;
|
|
|
|
}
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
void rtw_hal_set_odm_var(struct adapter *padapter, HAL_ODM_VARIABLE eVariable, PVOID pValue1,BOOLEAN bSet)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-11 21:15:04 +00:00
|
|
|
if(padapter->HalFunc.SetHalODMVarHandler)
|
|
|
|
padapter->HalFunc.SetHalODMVarHandler(padapter,eVariable,pValue1,bSet);
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
2014-12-17 23:13:53 +00:00
|
|
|
void rtw_hal_get_odm_var(struct adapter *padapter, HAL_ODM_VARIABLE eVariable, PVOID pValue1,BOOLEAN bSet)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-11 21:15:04 +00:00
|
|
|
if(padapter->HalFunc.GetHalODMVarHandler)
|
|
|
|
padapter->HalFunc.GetHalODMVarHandler(padapter,eVariable,pValue1,bSet);
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
void rtw_hal_enable_interrupt(struct adapter *padapter)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-11 21:15:04 +00:00
|
|
|
if (!is_primary_adapter(padapter)){
|
|
|
|
DBG_871X(" rtw_hal_enable_interrupt: Secondary adapter return l\n");
|
|
|
|
return;
|
|
|
|
}
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
if (padapter->HalFunc.enable_interrupt)
|
|
|
|
padapter->HalFunc.enable_interrupt(padapter);
|
2014-12-19 06:59:46 +00:00
|
|
|
else
|
2014-12-11 21:15:04 +00:00
|
|
|
DBG_871X("%s: HalFunc.enable_interrupt is NULL!\n", __FUNCTION__);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
}
|
2014-12-17 23:13:53 +00:00
|
|
|
void rtw_hal_disable_interrupt(struct adapter *padapter)
|
2014-12-11 21:15:04 +00:00
|
|
|
{
|
|
|
|
if (!is_primary_adapter(padapter)){
|
|
|
|
DBG_871X(" rtw_hal_disable_interrupt: Secondary adapter return l\n");
|
|
|
|
return;
|
|
|
|
}
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
if (padapter->HalFunc.disable_interrupt)
|
|
|
|
padapter->HalFunc.disable_interrupt(padapter);
|
2014-12-19 06:59:46 +00:00
|
|
|
else
|
2014-12-11 21:15:04 +00:00
|
|
|
DBG_871X("%s: HalFunc.disable_interrupt is NULL!\n", __FUNCTION__);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
2013-08-04 23:08:37 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
u32 rtw_hal_inirp_init(struct adapter *padapter)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
|
|
|
u32 rst = _FAIL;
|
2014-12-19 06:59:46 +00:00
|
|
|
if(padapter->HalFunc.inirp_init)
|
|
|
|
rst = padapter->HalFunc.inirp_init(padapter);
|
|
|
|
else
|
|
|
|
DBG_871X(" %s HalFunc.inirp_init is NULL!!!\n",__FUNCTION__);
|
2013-05-08 21:45:39 +00:00
|
|
|
return rst;
|
|
|
|
}
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
u32 rtw_hal_inirp_deinit(struct adapter *padapter)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
if(padapter->HalFunc.inirp_deinit)
|
|
|
|
return padapter->HalFunc.inirp_deinit(padapter);
|
2013-05-08 21:45:39 +00:00
|
|
|
|
|
|
|
return _FAIL;
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
u8 rtw_hal_intf_ps_func(struct adapter *padapter,HAL_INTF_PS_FUNC efunc_id, u8* val)
|
2014-12-19 06:59:46 +00:00
|
|
|
{
|
|
|
|
if(padapter->HalFunc.interface_ps_func)
|
2014-12-11 21:15:04 +00:00
|
|
|
return padapter->HalFunc.interface_ps_func(padapter,efunc_id,val);
|
2013-05-08 21:45:39 +00:00
|
|
|
return _FAIL;
|
|
|
|
}
|
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
s32 rtw_hal_xmitframe_enqueue(struct adapter *padapter, struct xmit_frame *pxmitframe)
|
2014-11-20 06:12:27 +00:00
|
|
|
{
|
|
|
|
if(padapter->HalFunc.hal_xmitframe_enqueue)
|
|
|
|
return padapter->HalFunc.hal_xmitframe_enqueue(padapter, pxmitframe);
|
2014-12-11 21:15:04 +00:00
|
|
|
|
2014-12-19 06:59:46 +00:00
|
|
|
return _FALSE;
|
2014-11-20 06:12:27 +00:00
|
|
|
}
|
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
s32 rtw_hal_xmit(struct adapter *padapter, struct xmit_frame *pxmitframe)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-11 21:15:04 +00:00
|
|
|
if(padapter->HalFunc.hal_xmit)
|
|
|
|
return padapter->HalFunc.hal_xmit(padapter, pxmitframe);
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-19 06:59:46 +00:00
|
|
|
return _FALSE;
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
s32 rtw_hal_mgnt_xmit(struct adapter *padapter, struct xmit_frame *pmgntframe)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
|
|
|
s32 ret = _FAIL;
|
2014-12-11 21:15:04 +00:00
|
|
|
unsigned char *pframe;
|
|
|
|
struct rtw_ieee80211_hdr *pwlanhdr;
|
|
|
|
|
|
|
|
pframe = (u8 *)(pmgntframe->buf_addr) + TXDESC_OFFSET;
|
|
|
|
pwlanhdr = (struct rtw_ieee80211_hdr *)pframe;
|
|
|
|
_rtw_memcpy(pmgntframe->attrib.ra, pwlanhdr->addr1, ETH_ALEN);
|
|
|
|
|
|
|
|
#ifdef CONFIG_IEEE80211W
|
|
|
|
if(padapter->securitypriv.binstallBIPkey == _TRUE)
|
|
|
|
{
|
|
|
|
if(IS_MCAST(pmgntframe->attrib.ra))
|
|
|
|
{
|
|
|
|
pmgntframe->attrib.encrypt = _BIP_;
|
|
|
|
//pmgntframe->attrib.bswenc = _TRUE;
|
2014-12-19 06:59:46 +00:00
|
|
|
}
|
2014-12-11 21:15:04 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
pmgntframe->attrib.encrypt = _AES_;
|
|
|
|
pmgntframe->attrib.bswenc = _TRUE;
|
|
|
|
}
|
|
|
|
rtw_mgmt_xmitframe_coalesce(padapter, pmgntframe->pkt, pmgntframe);
|
|
|
|
}
|
|
|
|
#endif //CONFIG_IEEE80211W
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
if(padapter->HalFunc.mgnt_xmit)
|
|
|
|
ret = padapter->HalFunc.mgnt_xmit(padapter, pmgntframe);
|
2013-05-08 21:45:39 +00:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
s32 rtw_hal_init_xmit_priv(struct adapter *padapter)
|
2014-12-19 06:59:46 +00:00
|
|
|
{
|
2014-12-11 21:15:04 +00:00
|
|
|
if(padapter->HalFunc.init_xmit_priv != NULL)
|
|
|
|
return padapter->HalFunc.init_xmit_priv(padapter);
|
2013-05-08 21:45:39 +00:00
|
|
|
return _FAIL;
|
|
|
|
}
|
2014-12-17 23:13:53 +00:00
|
|
|
void rtw_hal_free_xmit_priv(struct adapter *padapter)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-11 21:15:04 +00:00
|
|
|
if(padapter->HalFunc.free_xmit_priv != NULL)
|
|
|
|
padapter->HalFunc.free_xmit_priv(padapter);
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
s32 rtw_hal_init_recv_priv(struct adapter *padapter)
|
2014-12-19 06:59:46 +00:00
|
|
|
{
|
2014-12-11 21:15:04 +00:00
|
|
|
if(padapter->HalFunc.init_recv_priv)
|
|
|
|
return padapter->HalFunc.init_recv_priv(padapter);
|
2013-05-08 21:45:39 +00:00
|
|
|
|
|
|
|
return _FAIL;
|
|
|
|
}
|
2014-12-17 23:13:53 +00:00
|
|
|
void rtw_hal_free_recv_priv(struct adapter *padapter)
|
2014-12-19 06:59:46 +00:00
|
|
|
{
|
2014-12-11 21:15:04 +00:00
|
|
|
if(padapter->HalFunc.free_recv_priv)
|
|
|
|
padapter->HalFunc.free_recv_priv(padapter);
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
void rtw_hal_update_ra_mask(struct sta_info *psta, u8 rssi_level)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-17 23:13:53 +00:00
|
|
|
struct adapter *padapter;
|
2014-12-11 21:15:04 +00:00
|
|
|
struct mlme_priv *pmlmepriv;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
if(!psta)
|
|
|
|
return;
|
|
|
|
|
|
|
|
padapter = psta->padapter;
|
|
|
|
|
|
|
|
pmlmepriv = &(padapter->mlmepriv);
|
|
|
|
|
|
|
|
if(check_fwstate(pmlmepriv, WIFI_AP_STATE) == _TRUE)
|
|
|
|
{
|
|
|
|
add_RATid(padapter, psta, rssi_level);
|
2013-05-19 04:28:07 +00:00
|
|
|
}
|
2014-12-11 21:15:04 +00:00
|
|
|
else
|
2014-12-19 06:59:46 +00:00
|
|
|
{
|
2014-12-11 21:15:04 +00:00
|
|
|
if(padapter->HalFunc.UpdateRAMaskHandler)
|
|
|
|
padapter->HalFunc.UpdateRAMaskHandler(padapter, psta->mac_id, rssi_level);
|
2014-12-19 06:59:46 +00:00
|
|
|
}
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
void rtw_hal_add_ra_tid(struct adapter *padapter, u32 bitmap, u8 arg, u8 rssi_level)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-11 21:15:04 +00:00
|
|
|
if(padapter->HalFunc.Add_RateATid)
|
|
|
|
padapter->HalFunc.Add_RateATid(padapter, bitmap, arg, rssi_level);
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
2013-08-04 23:08:37 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
/* Start specifical interface thread */
|
2014-12-17 23:13:53 +00:00
|
|
|
void rtw_hal_start_thread(struct adapter *padapter)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-11 21:15:04 +00:00
|
|
|
if(padapter->HalFunc.run_thread)
|
|
|
|
padapter->HalFunc.run_thread(padapter);
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
/* Start specifical interface thread */
|
2014-12-17 23:13:53 +00:00
|
|
|
void rtw_hal_stop_thread(struct adapter *padapter)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-11 21:15:04 +00:00
|
|
|
if(padapter->HalFunc.cancel_thread)
|
|
|
|
padapter->HalFunc.cancel_thread(padapter);
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
u32 rtw_hal_read_bbreg(struct adapter *padapter, u32 RegAddr, u32 BitMask)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
|
|
|
u32 data = 0;
|
2014-12-11 21:15:04 +00:00
|
|
|
if(padapter->HalFunc.read_bbreg)
|
|
|
|
data = padapter->HalFunc.read_bbreg(padapter, RegAddr, BitMask);
|
2013-05-08 21:45:39 +00:00
|
|
|
return data;
|
|
|
|
}
|
2014-12-17 23:13:53 +00:00
|
|
|
void rtw_hal_write_bbreg(struct adapter *padapter, u32 RegAddr, u32 BitMask, u32 Data)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-11 21:15:04 +00:00
|
|
|
if(padapter->HalFunc.write_bbreg)
|
|
|
|
padapter->HalFunc.write_bbreg(padapter, RegAddr, BitMask, Data);
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
u32 rtw_hal_read_rfreg(struct adapter *padapter, u32 eRFPath, u32 RegAddr, u32 BitMask)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
|
|
|
u32 data = 0;
|
2014-12-11 21:15:04 +00:00
|
|
|
if( padapter->HalFunc.read_rfreg)
|
|
|
|
data = padapter->HalFunc.read_rfreg(padapter, eRFPath, RegAddr, BitMask);
|
2013-05-08 21:45:39 +00:00
|
|
|
return data;
|
|
|
|
}
|
2014-12-17 23:13:53 +00:00
|
|
|
void rtw_hal_write_rfreg(struct adapter *padapter, u32 eRFPath, u32 RegAddr, u32 BitMask, u32 Data)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-11 21:15:04 +00:00
|
|
|
if(padapter->HalFunc.write_rfreg)
|
2014-12-19 06:59:46 +00:00
|
|
|
padapter->HalFunc.write_rfreg(padapter, eRFPath, RegAddr, BitMask, Data);
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
s32 rtw_hal_interrupt_handler(struct adapter *padapter)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-11 21:15:04 +00:00
|
|
|
if(padapter->HalFunc.interrupt_handler)
|
|
|
|
return padapter->HalFunc.interrupt_handler(padapter);
|
2013-05-08 21:45:39 +00:00
|
|
|
return _FAIL;
|
|
|
|
}
|
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
void rtw_hal_set_bwmode(struct adapter *padapter, HT_CHANNEL_WIDTH Bandwidth, u8 Offset)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-11 21:15:04 +00:00
|
|
|
if(padapter->HalFunc.set_bwmode_handler)
|
|
|
|
padapter->HalFunc.set_bwmode_handler(padapter, Bandwidth, Offset);
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
void rtw_hal_set_chan(struct adapter *padapter, u8 channel)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-11 21:15:04 +00:00
|
|
|
if(padapter->HalFunc.set_channel_handler)
|
|
|
|
padapter->HalFunc.set_channel_handler(padapter, channel);
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
void rtw_hal_dm_watchdog(struct adapter *padapter)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-11 21:15:04 +00:00
|
|
|
#if defined(CONFIG_CONCURRENT_MODE)
|
|
|
|
if (padapter->adapter_type != PRIMARY_ADAPTER)
|
|
|
|
return;
|
2014-12-19 06:59:46 +00:00
|
|
|
#endif
|
2014-12-11 21:15:04 +00:00
|
|
|
if(padapter->HalFunc.hal_dm_watchdog)
|
|
|
|
padapter->HalFunc.hal_dm_watchdog(padapter);
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
void rtw_hal_bcn_related_reg_setting(struct adapter *padapter)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-11 21:15:04 +00:00
|
|
|
if(padapter->HalFunc.SetBeaconRelatedRegistersHandler)
|
2014-12-19 06:59:46 +00:00
|
|
|
padapter->HalFunc.SetBeaconRelatedRegistersHandler(padapter);
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
|
|
|
|
#ifdef CONFIG_ANTENNA_DIVERSITY
|
2014-12-17 23:13:53 +00:00
|
|
|
u8 rtw_hal_antdiv_before_linked(struct adapter *padapter)
|
2014-12-19 06:59:46 +00:00
|
|
|
{
|
2014-12-11 21:15:04 +00:00
|
|
|
if(padapter->HalFunc.AntDivBeforeLinkHandler)
|
|
|
|
return padapter->HalFunc.AntDivBeforeLinkHandler(padapter);
|
2014-12-19 06:59:46 +00:00
|
|
|
return _FALSE;
|
2014-12-11 21:15:04 +00:00
|
|
|
}
|
2014-12-17 23:13:53 +00:00
|
|
|
void rtw_hal_antdiv_rssi_compared(struct adapter *padapter, WLAN_BSSID_EX *dst, WLAN_BSSID_EX *src)
|
2013-05-19 04:28:07 +00:00
|
|
|
{
|
2014-12-11 21:15:04 +00:00
|
|
|
if(padapter->HalFunc.AntDivCompareHandler)
|
|
|
|
padapter->HalFunc.AntDivCompareHandler(padapter, dst, src);
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
2014-12-11 21:15:04 +00:00
|
|
|
#endif
|
2013-08-04 23:08:37 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
#ifdef CONFIG_HOSTAPD_MLME
|
2014-12-17 23:13:53 +00:00
|
|
|
s32 rtw_hal_hostap_mgnt_xmit_entry(struct adapter *padapter, _pkt *pkt)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-11 21:15:04 +00:00
|
|
|
if(padapter->HalFunc.hostap_mgnt_xmit_entry)
|
|
|
|
return padapter->HalFunc.hostap_mgnt_xmit_entry(padapter, pkt);
|
|
|
|
return _FAIL;
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
2014-12-11 21:15:04 +00:00
|
|
|
#endif //CONFIG_HOSTAPD_MLME
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
#ifdef DBG_CONFIG_ERROR_DETECT
|
2014-12-17 23:13:53 +00:00
|
|
|
void rtw_hal_sreset_init(struct adapter *padapter)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-11 21:15:04 +00:00
|
|
|
if(padapter->HalFunc.sreset_init_value)
|
2014-12-19 06:59:46 +00:00
|
|
|
padapter->HalFunc.sreset_init_value(padapter);
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
2014-12-17 23:13:53 +00:00
|
|
|
void rtw_hal_sreset_reset(struct adapter *padapter)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-11 21:15:04 +00:00
|
|
|
padapter = GET_PRIMARY_ADAPTER(padapter);
|
|
|
|
|
|
|
|
if(padapter->HalFunc.silentreset)
|
|
|
|
padapter->HalFunc.silentreset(padapter);
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
void rtw_hal_sreset_reset_value(struct adapter *padapter)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-11 21:15:04 +00:00
|
|
|
if(padapter->HalFunc.sreset_reset_value)
|
|
|
|
padapter->HalFunc.sreset_reset_value(padapter);
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
void rtw_hal_sreset_xmit_status_check(struct adapter *padapter)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-11 21:15:04 +00:00
|
|
|
if (!is_primary_adapter(padapter))
|
|
|
|
return;
|
|
|
|
|
|
|
|
if(padapter->HalFunc.sreset_xmit_status_check)
|
2014-12-19 06:59:46 +00:00
|
|
|
padapter->HalFunc.sreset_xmit_status_check(padapter);
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
2014-12-17 23:13:53 +00:00
|
|
|
void rtw_hal_sreset_linked_status_check(struct adapter *padapter)
|
2014-12-11 21:15:04 +00:00
|
|
|
{
|
|
|
|
if (!is_primary_adapter(padapter))
|
|
|
|
return;
|
2013-08-04 23:08:37 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
if(padapter->HalFunc.sreset_linked_status_check)
|
2014-12-19 06:59:46 +00:00
|
|
|
padapter->HalFunc.sreset_linked_status_check(padapter);
|
2014-12-11 21:15:04 +00:00
|
|
|
}
|
2014-12-17 23:13:53 +00:00
|
|
|
u8 rtw_hal_sreset_get_wifi_status(struct adapter *padapter)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-11 21:15:04 +00:00
|
|
|
u8 status = 0;
|
2014-12-19 06:59:46 +00:00
|
|
|
if(padapter->HalFunc.sreset_get_wifi_status)
|
|
|
|
status = padapter->HalFunc.sreset_get_wifi_status(padapter);
|
2014-12-11 21:15:04 +00:00
|
|
|
return status;
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
2013-08-04 23:08:37 +00:00
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
bool rtw_hal_sreset_inprogress(struct adapter *padapter)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-11 21:15:04 +00:00
|
|
|
bool inprogress = _FALSE;
|
2013-08-04 23:08:37 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
padapter = GET_PRIMARY_ADAPTER(padapter);
|
|
|
|
|
|
|
|
if(padapter->HalFunc.sreset_inprogress)
|
|
|
|
inprogress = padapter->HalFunc.sreset_inprogress(padapter);
|
|
|
|
return inprogress;
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
2014-12-11 21:15:04 +00:00
|
|
|
#endif //DBG_CONFIG_ERROR_DETECT
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
#ifdef CONFIG_IOL
|
2014-12-17 23:13:53 +00:00
|
|
|
int rtw_hal_iol_cmd(struct adapter *adapter, struct xmit_frame *xmit_frame, u32 max_wating_ms, u32 bndy_cnt)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-11 21:15:04 +00:00
|
|
|
if(adapter->HalFunc.IOL_exec_cmds_sync)
|
|
|
|
return adapter->HalFunc.IOL_exec_cmds_sync(adapter, xmit_frame, max_wating_ms,bndy_cnt);
|
2013-05-08 21:45:39 +00:00
|
|
|
return _FAIL;
|
|
|
|
}
|
2014-12-11 21:15:04 +00:00
|
|
|
#endif
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
#ifdef CONFIG_XMIT_THREAD_MODE
|
2014-12-17 23:13:53 +00:00
|
|
|
s32 rtw_hal_xmit_thread_handler(struct adapter *padapter)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-11 21:15:04 +00:00
|
|
|
if(padapter->HalFunc.xmit_thread_handler)
|
|
|
|
return padapter->HalFunc.xmit_thread_handler(padapter);
|
|
|
|
return _FAIL;
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
2014-12-11 21:15:04 +00:00
|
|
|
#endif
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
void rtw_hal_notch_filter(struct adapter *adapter, bool enable)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-11 21:15:04 +00:00
|
|
|
if(adapter->HalFunc.hal_notch_filter)
|
2014-12-19 06:59:46 +00:00
|
|
|
adapter->HalFunc.hal_notch_filter(adapter,enable);
|
2014-12-11 21:15:04 +00:00
|
|
|
}
|
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
void rtw_hal_reset_security_engine(struct adapter * adapter)
|
2014-12-11 21:15:04 +00:00
|
|
|
{
|
|
|
|
if(adapter->HalFunc.hal_reset_security_engine)
|
2013-05-08 21:45:39 +00:00
|
|
|
adapter->HalFunc.hal_reset_security_engine(adapter);
|
|
|
|
}
|
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
s32 rtw_hal_c2h_handler(struct adapter *adapter, struct c2h_evt_hdr *c2h_evt)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
|
|
|
s32 ret = _FAIL;
|
|
|
|
if (adapter->HalFunc.c2h_handler)
|
|
|
|
ret = adapter->HalFunc.c2h_handler(adapter, c2h_evt);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
c2h_id_filter rtw_hal_c2h_id_filter_ccx(struct adapter *adapter)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
|
|
|
return adapter->HalFunc.c2h_id_filter_ccx;
|
|
|
|
}
|