/***************************************************************************** 函 数 名 : dmac_psm_lightsleep_stop 功能描述 : start light sleep: 1. stop MAC/phy PA 输入参数 : 输出参数 : 无 返 回 值 : 调用函数 : 被调函数 : 修改历史 : 1.日 期 : 2014年1月14日 作 者 : l00280485 修改内容 : 新生成函数 *****************************************************************************/ oal_uint8 dmac_psm_lightsleep_stop (oal_void) { #if 0 hal_to_dmac_device_stru *pst_hal_device; mac_device_stru *pst_device; pst_device = mac_res_get_dev(0); pst_hal_device = pst_device->pst_device_stru; //dmac_psm_recover_primary_channel(pst_device); /* 使能pa */ //hal_enable_machw_phy_and_pa(pst_hal_device); /* 恢复硬件发送 */ //hal_set_machw_tx_resume(pst_hal_device); #ifdef _PRE_WLAN_FEATURE_BTCOEX /* 通知bt wifi开始睡眠 */ hal_set_btcoex_soc_gpreg1(WIFIAWAKE, BIT0 | BIT1, 0); #endif #endif return OAL_TRUE; }
/***************************************************************************** 函 数 名 : dmac_psm_clean_state 功能描述 : this func must be called before any save ps state operate,because save ps state will use netbuf mem clean state including: 1. stop sys timer 2. free alloced netbuf 输入参数 : 输出参数 : 无 返 回 值 : 调用函数 : 被调函数 : 修改历史 : 1.日 期 : 2014年1月14日 作 者 : l00280485 修改内容 : 新生成函数 *****************************************************************************/ oal_uint8 dmac_psm_clean_state (oal_void) { hal_to_dmac_device_stru *pst_hal_device; mac_device_stru *pst_device; oal_uint32 ul_is_netbuf_empty; extern frw_event_mem_stru *g_pst_first_rx_event; /*低功耗前面的流程已检查过合法性,不需要重复检查*/ pst_device = mac_res_get_dev(0); pst_hal_device = pst_device->pst_device_stru; if(g_pst_first_rx_event) { FRW_EVENT_FREE(g_pst_first_rx_event); g_pst_first_rx_event = OAL_PTR_NULL; } hcc_slave_clean(); hal_rx_destroy_dscr_queue(pst_hal_device,OAL_TRUE); /* 检查除oam子池外的三个netbuf子池,深睡前应该这三个子池的netbuf内存都已经释放 */ ul_is_netbuf_empty = oal_mem_is_netbuf_empty(); if (ul_is_netbuf_empty != OAL_TRUE) { OAM_ERROR_LOG0(0,OAM_SF_PWR,"{dmac_psm_clean_state::before deep sleep netbuf is not empty.}"); OAL_MEM_INFO_PRINT(OAL_MEM_POOL_ID_NETBUF); } return OAL_SUCC; }
/***************************************************************************** 函 数 名 : dmac_txopps_set_machw_partialaid_sta 功能描述 : sta将partial aid写入到mac寄存器 输入参数 : 无 输出参数 : 无 返 回 值 : 调用函数 : 被调函数 : 修改历史 : 1.日 期 : 2014年7月17日 作 者 : z00237171 修改内容 : 新生成函数 *****************************************************************************/ oal_uint32 dmac_txopps_set_machw_partialaid_sta(mac_vap_stru *pst_mac_vap, oal_uint8 uc_len, oal_uint8 *puc_param) { oal_uint16 us_partial_aid; mac_device_stru *pst_mac_dev; mac_cfg_txop_sta_stru *pst_txop_info; if (OAL_PTR_NULL == puc_param) { OAM_ERROR_LOG0(0, OAM_SF_CFG, "{dmac_txopps_set_machw_partialaid_sta::INPUT NULL PTR.}"); return OAL_ERR_CODE_PTR_NULL; } pst_txop_info = (mac_cfg_txop_sta_stru *)puc_param; us_partial_aid = pst_txop_info->us_partial_aid; pst_mac_dev = (mac_device_stru *)mac_res_get_dev(pst_mac_vap->uc_device_id); if (OAL_UNLIKELY(OAL_PTR_NULL == pst_mac_dev)) { OAM_ERROR_LOG0(0, OAM_SF_TXOP, "{dmac_txopps_set_machw_partialaid_sta:: device is null}."); return OAL_ERR_CODE_PTR_NULL; } hal_set_txop_ps_partial_aid(pst_mac_dev->pst_device_stru, us_partial_aid); return OAL_SUCC; }
/***************************************************************************** 函 数 名 : hmac_protection_obss_aging_ap 功能描述 : 启动OBSS老化处理定时器 输入参数 : pst_hmac_vap : hmac vap结构体指针 输出参数 : 无 返 回 值 : oal_uint32 调用函数 : 被调函数 : 修改历史 : 1.日 期 : 2015年4月28日 作 者 : w00269675 修改内容 : 新生成函数 *****************************************************************************/ oal_uint32 hmac_protection_start_timer(hmac_vap_stru *pst_hmac_vap) { mac_device_stru *pst_mac_device; pst_mac_device = mac_res_get_dev(pst_hmac_vap->st_vap_base_info.uc_device_id); if (OAL_PTR_NULL == pst_mac_device) { OAM_WARNING_LOG0(0, OAM_SF_ANY, "{hmac_protection_start_timer::pst_mac_device null.}"); return OAL_ERR_CODE_PTR_NULL; } /* 启动OBSS保护老化定时器 定时器已开启,则不用再开启 */ if (OAL_FALSE == pst_mac_device->st_obss_aging_timer.en_is_registerd) { FRW_TIMER_CREATE_TIMER(&(pst_mac_device->st_obss_aging_timer), hmac_protection_obss_update_timer, WLAN_USER_AGING_TRIGGER_TIME, /* 5000ms触发一次 */ pst_mac_device, OAL_TRUE, OAM_MODULE_ID_HMAC, pst_mac_device->ul_core_id); } return OAL_SUCC; }
/***************************************************************************** 函 数 名 : dmac_txopps_set_machw_en_sta 功能描述 : sta模式,配置mac txop_ps使能寄存器,包括使能位,condition1和co- ndition2 输入参数 : pst_mac_vap : mac_vap结构 pst_txopps_machw_param : 设置mac txop ps使能寄存器参数结构 输出参数 : 无 返 回 值 : 调用函数 : 被调函数 : 修改历史 : 1.日 期 : 2014年7月16日 作 者 : z00237171 修改内容 : 新生成函数 *****************************************************************************/ oal_uint32 dmac_txopps_set_machw_en_sta( mac_vap_stru *pst_mac_vap, dmac_txopps_machw_param_stru *pst_txopps_machw_param) { mac_device_stru *pst_device; if (OAL_UNLIKELY(OAL_PTR_NULL == pst_mac_vap || OAL_PTR_NULL == pst_txopps_machw_param)) { OAM_ERROR_LOG2(0, OAM_SF_TXOP, "{dmac_txopps_set_machw_en_sta::param is null,vap=[%d],machw_param=[%d]}.", pst_mac_vap, pst_txopps_machw_param); return OAL_ERR_CODE_PTR_NULL; } pst_device = mac_res_get_dev(pst_mac_vap->uc_device_id); if (OAL_UNLIKELY(OAL_PTR_NULL == pst_device)) { OAM_ERROR_LOG0(pst_mac_vap->uc_vap_id, OAM_SF_TXOP, "{dmac_txopps_set_machw_en_sta:: mac_device is null}."); return OAL_ERR_CODE_PTR_NULL; } hal_set_txop_ps_enable(pst_device->pst_device_stru, pst_txopps_machw_param->en_machw_txopps_en); hal_set_txop_ps_condition1(pst_device->pst_device_stru, pst_txopps_machw_param->en_machw_txopps_condition1); hal_set_txop_ps_condition2(pst_device->pst_device_stru, pst_txopps_machw_param->en_machw_txopps_condition2); return OAL_SUCC; }
/***************************************************************************** 函 数 名 : dmac_psm_save_ps_state 功能描述 : Save Powersaving state including: 1. Save MAC & PHY Register 输入参数 : 输出参数 : 无 返 回 值 : 调用函数 : 被调函数 : 修改历史 : 1.日 期 : 2014年1月14日 作 者 : l00280485 修改内容 : 新生成函数 *****************************************************************************/ oal_uint8 dmac_psm_save_ps_state (oal_void) { hal_to_dmac_device_stru *pst_hal_device; mac_device_stru *pst_device; /*低功耗前面的流程已检查过合法性,不需要重复检查*/ pst_device = mac_res_get_dev(0); pst_hal_device = pst_device->pst_device_stru; dmac_psm_save_tcm(pst_hal_device); #ifdef _PRE_WLAN_FEATURE_EDCA_OPT dmac_psm_save_dutycycle(pst_device); #endif /* 保存PHY逻辑与寄存器 */ //dmac_psm_save_phy_hw_reg(pst_hal_device); /* 保存MAC逻辑与寄存器 */ //dmac_psm_save_mac_hw_reg(pst_hal_device); return OAL_TRUE; }
oal_uint32 dmac_config_data_acq(mac_vap_stru *pst_mac_vap, oal_uint8 uc_len, oal_uint8 *puc_param) { dmac_data_acq_enum_uint8 en_data_acq = 0; oal_uint32 ul_ret = OAL_SUCC; mac_device_stru *pst_device; oal_uint32 ul_offset = 0; oal_int8 ac_name[DMAC_HIPRIV_CMD_NAME_MAX_LEN]; pst_device = mac_res_get_dev(pst_mac_vap->uc_device_id); /* 设置配置命令参数 */ if(OAL_PTR_NULL == pst_device) { return OAL_FAIL; } OAL_MEMZERO(ac_name, DMAC_HIPRIV_CMD_NAME_MAX_LEN); /* 获取数据采集命令标识符 */ dmac_get_cmd_one_arg((oal_int8*)puc_param, ac_name, &ul_offset); en_data_acq = (dmac_data_acq_enum_uint8)oal_atoi(ac_name); /* 偏移,取下一个参数 */ puc_param = puc_param + ul_offset; switch(en_data_acq) { case DMAC_DATA_ACQ_PRE: /* 配置MAC寄存器 */ ul_ret = dmac_data_acq_prepare(pst_mac_vap, puc_param, pst_device); break; case DMAC_DATA_ACQ_COND: /* 配置PHY寄存器 */ ul_ret = dmac_data_acq_condition(pst_mac_vap, puc_param, pst_device); break; case DMAC_DATA_ACQ_ENABLE: /* 使能数据采集功能 */ ul_ret = dmac_data_acq_enable(pst_mac_vap, puc_param, pst_device); break; case DMAC_DATA_ACQ_STATUS: /* 获取数据采集状态 */ ul_ret = dmac_data_acq_get_status(pst_mac_vap, puc_param, pst_device); break; case DMAC_DATA_ACQ_RECODE: /* 获取数据采集数据 */ ul_ret = dmac_data_acq_get_record(); break; default: break; } return ul_ret; }
/***************************************************************************** 函 数 名 : dmac_psm_recover_ps_start_dma 功能描述 : 输入参数 : 输出参数 : 无 返 回 值 : 调用函数 : 被调函数 : 修改历史 : 1.日 期 : 2014年1月15日 作 者 : l00280485 修改内容 : 新生成函数 *****************************************************************************/ oal_void dmac_psm_recover_start_dma(oal_uint8 *puc_ch0,oal_uint8 *puc_ch1,oal_uint8 *puc_ch2) { hal_to_dmac_device_stru *pst_hal_device; mac_device_stru *pst_device; pst_device = mac_res_get_dev(0); pst_hal_device = pst_device->pst_device_stru; hal_reset_reg_dma_restore(pst_hal_device,puc_ch0,puc_ch1,puc_ch2); }
oal_void dmac_psm_save_start_dma (oal_uint8* puc_ch0,oal_uint8* puc_ch1,oal_uint8* puc_ch2) { hal_to_dmac_device_stru *pst_hal_device; mac_device_stru *pst_device; /*低功耗前面的流程已检查过合法性,不需要重复检查*/ pst_device = mac_res_get_dev(0); pst_hal_device = pst_device->pst_device_stru; hal_reset_reg_dma_save(pst_hal_device,puc_ch0,puc_ch1,puc_ch2); }
/***************************************************************************** 函 数 名 : dmac_device_exception_report_timeout_fn 功能描述 : 异常维测信息上报,定期读取寄存器,出现错误直接上报 输入参数 : 无 输出参数 : 无 返 回 值 : 调用函数 : 被调函数 : 修改历史 : 1.日 期 : 2014年8月4日 作 者 : huxiaotong 修改内容 : 新生成函数 2.日 期 : 2015年1月4日 作 者 : daihu 修改内容 : 增加双芯片时,pcie0和pcie1的读写 *****************************************************************************/ oal_uint32 dmac_device_exception_report_timeout_fn(oal_void *p_arg) { #if ((_PRE_OS_VERSION_LINUX == _PRE_OS_VERSION) && (_PRE_MULTI_CORE_MODE_OFFLOAD_DMAC != _PRE_MULTI_CORE_MODE)) oal_uint8 uc_pci_device_id = 0; oal_uint32 ul_reg_pci_rpt_val = 0; oal_uint32 ul_pci_warn_clear_cfg_val = 0xFFFFFFFF; /* 写1清 */ oal_uint32 ul_reg_pci_rpt_addr_offset = 0x110; /* PCIE 0x110寄存器 */ oal_bus_chip_stru *pst_bus_chip = OAL_PTR_NULL; hal_to_dmac_device_stru *pst_hal_device = OAL_PTR_NULL; mac_device_stru *pst_mac_device = OAL_PTR_NULL; pst_hal_device = (hal_to_dmac_device_stru *)p_arg; /* 获取chip id值 */ uc_pci_device_id = pst_hal_device->uc_chip_id; oal_bus_get_chip_instance(&pst_bus_chip, uc_pci_device_id); /* 然后读取1151侧的 PCIE */ ul_reg_pci_rpt_val = 0; oal_pci_read_config_dword(pst_bus_chip->pst_pci_device, ul_reg_pci_rpt_addr_offset, &ul_reg_pci_rpt_val); pst_mac_device = mac_res_get_dev(pst_hal_device->uc_mac_device_id); if (OAL_UNLIKELY(OAL_PTR_NULL == pst_mac_device)) { OAM_ERROR_LOG1(0, OAM_SF_ANY, "{dmac_device_exception_report_timeout_fn::pst_mac_device[%d] is NULL!}", pst_hal_device->uc_mac_device_id); return OAL_ERR_CODE_PTR_NULL; } pst_mac_device->ul_pcie_read_counter++; /* Bit[12]: Timer Timeout Status, 判断是否发生 timeout异常 */ if(0 != (ul_reg_pci_rpt_val & 0x1000)) { pst_mac_device->ul_pcie_reg110_timeout_counter++; OAM_WARNING_LOG4(0, OAM_SF_ANY, "{dmac_device_exception_report_timeout_fn:: read 1151 pcie reg0x110 timeout, chip id = %d, device id = %d, reg0x110 = [0x%08x]}, timeout counter: %d.", pst_hal_device->uc_chip_id, pst_hal_device->uc_mac_device_id, ul_reg_pci_rpt_val, pst_mac_device->ul_pcie_reg110_timeout_counter); oal_pci_write_config_dword(pst_bus_chip->pst_pci_device, ul_reg_pci_rpt_addr_offset, ul_pci_warn_clear_cfg_val); } /* 为防止出现 timeout异常后,长时间再未出现异常,每隔 10 * 64秒打印一次 timeout异常统计 */ else if(0 == (pst_mac_device->ul_pcie_read_counter & 0x3F)) { OAM_WARNING_LOG3(0, OAM_SF_ANY, "{dmac_device_exception_report_timeout_fn:: chip id = %d, device id = %d, reg0x110 read timeout counter: %d.", pst_hal_device->uc_chip_id, pst_hal_device->uc_mac_device_id, pst_mac_device->ul_pcie_reg110_timeout_counter); } #endif return OAL_SUCC; }
/***************************************************************************** 函 数 名 : dmac_psm_rf_sleep 功能描述 : rf sleep 输入参数 : 输出参数 : 无 返 回 值 : 调用函数 : 被调函数 : 修改历史 : 1.日 期 : 2014年1月14日 作 者 : l00280485 修改内容 : 新生成函数 *****************************************************************************/ oal_void dmac_psm_rf_sleep(oal_uint8 uc_restore_reg) { hal_to_dmac_device_stru *pst_hal_device; mac_device_stru *pst_device; pst_device = mac_res_get_dev(0); pst_hal_device = pst_device->pst_device_stru; hal_psm_rf_sleep(pst_hal_device, uc_restore_reg); return; }
oal_uint8 dmac_psm_check_hw_txq_state(oal_void) { mac_device_stru *pst_device; /*低功耗前面的流程已检查过合法性,不需要重复检查*/ pst_device = mac_res_get_dev(0); /*检查接收硬件发送队列和TID队列是否空*/ if(OAL_FALSE == dmac_psm_is_hw_queues_empty(pst_device)) { return OAL_FALSE; } return OAL_TRUE; }
/***************************************************************************** 函 数 名 : dmac_psm_recover_ps_state 功能描述 : recover Powersaving state including: 1. recover MAC & PHY Register 输入参数 : 输出参数 : 无 返 回 值 : 调用函数 : 被调函数 : 修改历史 : 1.日 期 : 2014年1月14日 作 者 : l00280485 修改内容 : 新生成函数 *****************************************************************************/ oal_uint8 dmac_psm_recover_no_powerdown (oal_void) { hal_to_dmac_device_stru *pst_hal_device; mac_device_stru *pst_device; hal_error_state_stru st_error_state; //oal_uint32 ul_ret; pst_device = mac_res_get_dev(0);//和平台沟通,目前先写死是device id,后面有需求再传入参 pst_hal_device = pst_device->pst_device_stru; PM_WLAN_Tsf_Aon_to_Inner_start(); //restart移动至paldo 开启处 frw_timer_time_fix(); /* g_st_netbuf_pool不下电, 重新初始化内存池时需清零 */ //OAL_MEMZERO(&g_st_netbuf_pool, OAL_SIZEOF(g_st_netbuf_pool)); //dmac_psm_init_netbuf_pool(); /*避免复位过程中接收描述符队列异常,重新初始化接收描述符队列*/ //hal_rx_destroy_dscr_queue(pst_hal_device,OAL_FALSE); /* 低功耗不下电唤醒后清除rx中断,防止rx中断里保留上一次睡前的值造成rx new */ hal_psm_clear_mac_rx_isr(pst_hal_device); hal_rx_init_dscr_queue(pst_hal_device,OAL_TRUE); /* 清中断状态 */ st_error_state.ul_error1_val = 0xFFFFFFFF; st_error_state.ul_error2_val = 0xFFFFFFFF; hal_clear_mac_error_int_status(pst_hal_device, &st_error_state); hal_clear_mac_int_status(pst_hal_device, 0xffffffff); /* SDIO 重新初始化 */ hcc_slave_reinit(); /*等待tsf同步完成*/ PM_WLAN_Aon_Tsf_Sync(); dmac_psm_sync_tsf_to_ap(); return OAL_TRUE; }
/***************************************************************************** 函 数 名 : dmac_psm_rf_awake 功能描述 : rf awake 输入参数 : 输出参数 : 无 返 回 值 : 调用函数 : 被调函数 : 修改历史 : 1.日 期 : 2014年1月14日 作 者 : l00280485 修改内容 : 新生成函数 *****************************************************************************/ oal_void dmac_psm_rf_awake (oal_uint8 uc_restore_reg) { hal_to_dmac_device_stru *pst_hal_device; mac_device_stru *pst_device; /*低功耗前面的流程已检查过合法性,不需要重复检查*/ pst_device = mac_res_get_dev(0); pst_hal_device = pst_device->pst_device_stru; hal_psm_rf_awake(pst_hal_device,uc_restore_reg); dmac_psm_recover_primary_channel(pst_device); return; }
/***************************************************************************** 函 数 名 : dmac_psm_cbb_stopwork 功能描述 : start light sleep: 1. stop MAC/phy PA 输入参数 : 输出参数 : 无 返 回 值 : 调用函数 : 被调函数 : 修改历史 : 1.日 期 : 2014年1月14日 作 者 : l00280485 修改内容 : 新生成函数 *****************************************************************************/ oal_uint8 dmac_psm_cbb_stopwork (oal_void) { hal_to_dmac_device_stru *pst_hal_device; mac_device_stru *pst_device; pst_device = mac_res_get_dev(0); pst_hal_device = pst_device->pst_device_stru; /* 挂起硬件发送 目前无此功能 */ //hal_set_machw_tx_suspend(pst_hal_device); /* 关闭pa */ hal_disable_machw_phy_and_pa(pst_hal_device); return OAL_TRUE; }
oal_void hmac_data_acq_down_vap(mac_vap_stru *pst_mac_vap) { oal_uint32 ul_ret; mac_device_stru *pst_device; oal_uint8 uc_vap_idx; mac_cfg_down_vap_param_stru st_down_vap; hmac_vap_stru *pst_hmac_vap; pst_device = mac_res_get_dev(pst_mac_vap->uc_device_id); if (OAL_PTR_NULL == pst_device) { OAM_WARNING_LOG0(pst_mac_vap->uc_vap_id, OAM_SF_ANY, "{hmac_data_acq_down_vap::pst_device null.}"); return; } /* 遍历device下所有vap,设置vap 下的信道号 */ for (uc_vap_idx = 0; uc_vap_idx < pst_device->uc_vap_num; uc_vap_idx++) { pst_hmac_vap = mac_res_get_hmac_vap(pst_device->auc_vap_id[uc_vap_idx]); if (OAL_PTR_NULL == pst_hmac_vap) { OAM_WARNING_LOG0(pst_mac_vap->uc_vap_id, OAM_SF_ANY, "{hmac_data_acq_down_vap::pst_hmac_vap null.}"); continue; } st_down_vap.pst_net_dev = pst_hmac_vap->pst_net_device; ul_ret = hmac_config_down_vap(&pst_hmac_vap->st_vap_base_info, OAL_SIZEOF(mac_cfg_down_vap_param_stru), (oal_uint8 *)&st_down_vap); if (OAL_UNLIKELY(OAL_SUCC != ul_ret)) { OAM_WARNING_LOG0(pst_mac_vap->uc_vap_id, OAM_SF_ANY, "{hmac_data_acq_down_vap::hmac_config_down_vap failed.}"); } } g_uc_data_acq_used = OAL_TRUE; OAM_INFO_LOG1(pst_mac_vap->uc_vap_id, OAM_SF_ANY, "{hmac_data_acq_down_vap::g_uc_data_acq_used=%d.}", g_uc_data_acq_used); }
/***************************************************************************** 函 数 名 : dmac_psm_is_fake_queues_empty 功能描述 : 检查fake_q,期望为空,调用dbac接口检查,不为空上报第一个帧 输入参数 : 输出参数 : 无 返 回 值 : oal_uint8 调用函数 : 被调函数 : 修改历史 : 1.日 期 : 2014年11月28日 作 者 : l00280485 修改内容 : 新生成函数 *****************************************************************************/ oal_uint8 dmac_psm_is_fake_queues_empty(oal_void) { mac_device_stru *pst_device; hal_to_dmac_device_stru *pst_hal_device; oal_uint8 uc_fake_q; oal_uint8 uc_ret = OAL_TRUE; /*低功耗前面的流程已检查过合法性,不需要重复检查*/ pst_device = mac_res_get_dev(0); pst_hal_device = pst_device->pst_device_stru; /* 目前检查完所有的fake_q,稳定后有false立刻break,不睡眠 */ for (uc_fake_q = 0; uc_fake_q <= HAL_TX_FAKE_QUEUE_BGSCAN_ID; uc_fake_q++) { if (dmac_tx_fake_queue_empty_assert(pst_hal_device, uc_fake_q, THIS_FILE_ID) != OAL_TRUE) { uc_ret = OAL_FALSE; } } return uc_ret; }
oal_uint8 device_psm_main_function(oal_void) { #ifdef _PRE_WLAN_FEATURE_BTCOEX mac_device_stru *pst_mac_device; hal_to_dmac_device_stru *pst_hal_device; #endif device_main_function(); #ifdef _PRE_WLAN_FEATURE_BTCOEX pst_mac_device = mac_res_get_dev(0); if (OAL_UNLIKELY(OAL_PTR_NULL == pst_mac_device)) { OAM_ERROR_LOG0(0, OAM_SF_ANY, "{device_psm_main_function::pst_device[id:0] is NULL!}"); return OAL_ERR_CODE_PTR_NULL; } pst_hal_device = pst_mac_device->pst_device_stru; hal_btcoex_process_bt_status(pst_hal_device); #endif return OAL_SUCC; }
OAL_STATIC ssize_t dmac_scan_proc_write(struct file *file, const char __user *buffer, size_t count, loff_t *ppos) { oal_uint8 auc_buffer[64]; oal_int8 ac_cmd[128], c_size; oal_uint8 uc_bidx = 0; oal_uint8 uc_state, uc_tmp, uc_device_id; oal_uint32 ul_cnt; oal_uint8 uc_band, uc_num, uc_chan_cnt = 0; mac_scan_req_stru st_scan_req; mac_device_stru *pst_mac_device; c_size = count; if (count > 127) { c_size = 127; } if (copy_from_user(ac_cmd, buffer, c_size) != 0) { return -EFAULT; } ac_cmd[c_size] = '\0'; uc_state = 0; uc_tmp = 0; OAL_MEMZERO(&st_scan_req, OAL_SIZEOF(st_scan_req)); g_st_scanner_record.uc_write_cnt += 1; for (ul_cnt = 0; ul_cnt < count; ul_cnt++) { if (0 == uc_state) { if (' ' == ac_cmd[ul_cnt]) { continue; } else if ((ac_cmd[ul_cnt] >= '0') && (ac_cmd[ul_cnt] <= '9')) { uc_state = 1; ul_cnt -= 1; } else if (('\0' == ac_cmd[ul_cnt]) || ('\n' == ac_cmd[ul_cnt])) { g_st_scanner_record.uc_curr_status = PROC_ERROR_TYPE_ALL_OK; break; } else { g_st_scanner_record.uc_curr_status = PROC_ERROR_TYPE_INVALID_CHAR; break; } } else if (1 == uc_state) { if (' ' == ac_cmd[ul_cnt]) { uc_state = 0; auc_buffer[uc_bidx++] = uc_tmp; uc_tmp = 0; } else { if ((ac_cmd[ul_cnt] >= '0') && (ac_cmd[ul_cnt] <= '9')) { uc_tmp = uc_tmp * 10 + ac_cmd[ul_cnt] - '0'; } else if (('\0' == ac_cmd[ul_cnt]) || ('\n' == ac_cmd[ul_cnt])) { auc_buffer[uc_bidx++] = uc_tmp; uc_state = 0; g_st_scanner_record.uc_curr_status = PROC_ERROR_TYPE_ALL_OK; break; } else { g_st_scanner_record.uc_curr_status = PROC_ERROR_TYPE_INVALID_CHAR; uc_state = 0; break; } } } } if (uc_state) { auc_buffer[uc_bidx++] = uc_tmp; } #if 1 OAM_INFO_LOG0(0, OAM_SF_ANY,"%d numbers.\n", uc_bidx); for (ul_cnt = 0; ul_cnt < uc_bidx; ul_cnt++) { OAL_IO_PRINT("..[%d].\n", auc_buffer[ul_cnt]); } #endif /* 解析命令 */ /* 命令格式(以字节为单位) */ /* scan_mode(1 byte) + scan_type(1 byte) + func_mode(1 byte) + band(1 byte) + channel_num(1byte) + 具体的信道列表(variable) */ st_scan_req.en_scan_mode = auc_buffer[1]; st_scan_req.en_scan_type = auc_buffer[2]; if (auc_buffer[3] & 0xf0) { g_st_scanner_record.uc_curr_status = PROC_ERROR_TYPE_INVALID_MODE; OAM_INFO_LOG1(0, OAM_SF_ANY,"abnormal, auc_buffer[3] is %d\n", auc_buffer[3]); goto out; } st_scan_req.uc_scan_func = auc_buffer[3]; ul_cnt = 4; uc_bidx -= 4; while(1) { if (uc_bidx && (uc_bidx < 2)) { g_st_scanner_record.uc_curr_status = PROC_ERROR_TYPE_INCOMP_CMD; OAM_INFO_LOG1(0, OAM_SF_ANY,"abnormal, uc_bidx is %d\n", uc_bidx); goto out; } uc_band = auc_buffer[ul_cnt++]; uc_num = auc_buffer[ul_cnt++]; OAM_INFO_LOG2(0, OAM_SF_ANY,"Add %d channels for band %d.\n", uc_num, uc_band); if ((PROC_SCANNER_BAND_2G != uc_band) && (PROC_SCANNER_BAND_5G != uc_band)) { g_st_scanner_record.uc_curr_status = PROC_ERROR_TYPE_INVALID_BAND; OAM_INFO_LOG1(0, OAM_SF_ANY,"abnormal, uc_band is %d\n", uc_band); goto out; } if (PROC_SCANNER_BAND_2G == uc_band) { uc_band = WLAN_BAND_2G; } else { uc_band = WLAN_BAND_5G; } uc_bidx -= 2; if (uc_bidx < uc_num) { g_st_scanner_record.uc_curr_status = PROC_ERROR_TYPE_INCOMP_CMD; break; } /* 提取信道列表 */ if (uc_num) { st_scan_req.uc_channel_nums += uc_num; uc_tmp = 0; while(uc_tmp < uc_num) { st_scan_req.ast_channel_list[uc_chan_cnt].en_band = uc_band; st_scan_req.ast_channel_list[uc_chan_cnt].en_bandwidth = WLAN_BAND_WIDTH_20M; st_scan_req.ast_channel_list[uc_chan_cnt].uc_chan_number = auc_buffer[ul_cnt + uc_tmp]; mac_get_channel_idx_from_num(uc_band, auc_buffer[ul_cnt + uc_tmp], &st_scan_req.ast_channel_list[uc_chan_cnt].uc_idx); uc_tmp++; uc_chan_cnt++; } ul_cnt += uc_num; } uc_bidx -= uc_num; /* 提交扫描请求 */ if (!uc_bidx) { oal_uint8 uc_tmp_i; for (uc_tmp_i = 0; uc_tmp_i < st_scan_req.uc_channel_nums; uc_tmp_i++) { OAM_INFO_LOG4(0, OAM_SF_ANY,"[%-6s:%4d]\n", st_scan_req.ast_channel_list[uc_tmp_i].en_band == WLAN_BAND_2G?"2.4G":"5G", st_scan_req.ast_channel_list[uc_tmp_i].uc_chan_number); } break; } } st_scan_req.p_fn_cb = dmac_scan_verify_cb; uc_device_id = auc_buffer[0]; pst_mac_device = mac_res_get_dev(uc_device_id); dmac_scan_add_req(pst_mac_device, &st_scan_req); out: return count; }
/***************************************************************************** 函 数 名 : dmac_wep_add_entry 功能描述 : 将一个关联station的密钥写进硬件寄存器 输入参数 : 无 输出参数 : 无 返 回 值 : 调用函数 : 被调函数 : 修改历史 : 1.日 期 : 2013年7月24日 作 者 : t00231215 修改内容 : 新生成函数 2.日 期 : 2013年10月17日 作 者 : l00218984 修改内容 : 新生成函数 *****************************************************************************/ oal_uint32 dmac_config_wep_add_entry(mac_vap_stru *pst_mac_vap, oal_uint8 uc_len, oal_uint8 *puc_param) { hal_security_key_stru st_wep_key = {0}; dmac_vap_stru *pst_dmac_vap = OAL_PTR_NULL; mac_user_stru *pst_mac_user = OAL_PTR_NULL; oal_uint8 *puc_addr = OAL_PTR_NULL; oal_uint32 ul_ret; #ifdef _PRE_WLAN_FEATURE_PROXYSTA mac_device_stru *pst_mac_device; #endif puc_addr = puc_param; pst_dmac_vap = mac_res_get_dmac_vap(pst_mac_vap->uc_vap_id); if (OAL_PTR_NULL == pst_dmac_vap) { OAM_ERROR_LOG0(pst_mac_vap->uc_vap_id, OAM_SF_WEP, "{dmac_config_wep_add_entry::pst_dmac_vap null.}"); return OAL_ERR_CODE_PTR_NULL; } pst_mac_user = (mac_user_stru *)mac_vap_get_user_by_addr(pst_mac_vap, puc_addr); if (OAL_PTR_NULL == pst_mac_user) { OAM_ERROR_LOG0(pst_mac_vap->uc_vap_id, OAM_SF_WEP, "{dmac_config_wep_add_entry::mac_user null.}"); return OAL_ERR_CODE_PTR_NULL; } /* 设置用户的发送加密套件*/ ul_ret = mac_user_update_wep_key(pst_mac_user, pst_mac_vap->us_multi_user_idx); if (OAL_SUCC != ul_ret) { OAM_ERROR_LOG1(pst_mac_vap->uc_vap_id, OAM_SF_WEP, "{dmac_config_wep_add_entry::mac_wep_add_usr_key FAIL[%d].}", ul_ret); return OAL_ERR_CODE_PTR_NULL; } st_wep_key.uc_key_id = pst_mac_user->st_key_info.uc_default_index; st_wep_key.en_cipher_type = pst_mac_user->st_key_info.en_cipher_type; st_wep_key.en_key_type = WLAN_KEY_TYPE_PTK; st_wep_key.uc_lut_idx = ((dmac_user_stru *)pst_mac_user)->uc_lut_index; st_wep_key.en_update_key = OAL_TRUE; st_wep_key.en_key_origin = WLAN_AUTH_KEY; /*密钥已经添加过,不需要重复添加,只需要激活用户即可*/ st_wep_key.puc_cipher_key = pst_mac_user->st_key_info.ast_key[st_wep_key.uc_key_id].auc_key; st_wep_key.puc_mic_key = OAL_PTR_NULL; #ifdef _PRE_WLAN_FEATURE_PROXYSTA pst_mac_device = mac_res_get_dev(pst_mac_vap->uc_device_id); if (OAL_PTR_NULL == pst_mac_device) { OAM_ERROR_LOG0(pst_mac_vap->uc_vap_id, OAM_SF_PROXYSTA, "{dmac_config_wep_add_entry::mac_res_get_dev is null.}"); return OAL_ERR_CODE_PTR_NULL; } if (OAL_TRUE == pst_mac_device->st_cap_flag.bit_proxysta) { if ((OAL_TRUE == pst_mac_vap->st_vap_proxysta.en_is_proxysta) && (OAL_FALSE == pst_mac_vap->st_vap_proxysta.en_is_main_proxysta)) { /* 写硬件寄存器 */ /* 对于proxysta来讲,peer_macaddr需要配置为自身mac地址,创建时已经配置过 */ hal_ce_add_key(pst_dmac_vap->pst_hal_device, &st_wep_key, OAL_PTR_NULL); } else { /* 写硬件寄存器 */ hal_ce_add_key(pst_dmac_vap->pst_hal_device, &st_wep_key, puc_addr); } } else { /* 写硬件寄存器 */ hal_ce_add_key(pst_dmac_vap->pst_hal_device, &st_wep_key, puc_addr); } #else /* 写硬件寄存器 */ hal_ce_add_key(pst_dmac_vap->pst_hal_device, &st_wep_key, puc_addr); #endif return OAL_SUCC; }
/***************************************************************************** 函 数 名 : dmac_vap_init 功能描述 : 初始化要添加的dmac vap的一些特性信息 输入参数 : 指向要添加的vap的指针 输出参数 : 无 返 回 值 : 成功或者失败原因 调用函数 : 被调函数 : 修改历史 : 1.日 期 : 2012年10月24日 作 者 : 康国昌 修改内容 : 新生成函数 *****************************************************************************/ oal_uint32 dmac_vap_init( dmac_vap_stru *pst_dmac_vap, oal_uint8 uc_chip_id, oal_uint8 uc_device_id, oal_uint8 uc_vap_id, mac_cfg_add_vap_param_stru *pst_param) { #if (_PRE_MULTI_CORE_MODE_OFFLOAD_DMAC == _PRE_MULTI_CORE_MODE) oal_uint32 ul_ret; #endif mac_device_stru *pst_mac_device = mac_res_get_dev(uc_device_id); if (OAL_UNLIKELY(OAL_PTR_NULL == pst_mac_device)) { OAM_ERROR_LOG1(0, OAM_SF_ANY, "{dmac_vap_init::pst_mac_device[%d] null!}", uc_device_id); return OAL_ERR_CODE_PTR_NULL; } /* DMAC VAP 部分初始清零 */ OAL_MEMZERO(((oal_uint8 *)pst_dmac_vap) + OAL_SIZEOF(mac_vap_stru), OAL_SIZEOF(dmac_vap_stru) - OAL_SIZEOF(mac_vap_stru)); #if (_PRE_PRODUCT_ID == _PRE_PRODUCT_ID_HI1151) /* 统计信息清零 */ oam_stats_clear_vap_stat_info(uc_vap_id); #endif #if (_PRE_MULTI_CORE_MODE_OFFLOAD_DMAC == _PRE_MULTI_CORE_MODE) /* 在非OFFLOAD情况下,这些操作HMAC都已经做过了 */ /* 初始化mac vap */ ul_ret = mac_vap_init(&pst_dmac_vap->st_vap_base_info, uc_chip_id, uc_device_id, uc_vap_id, pst_param); if (OAL_SUCC != ul_ret) { OAM_WARNING_LOG1(uc_vap_id, OAM_SF_CFG, "{dmac_vap_init::dmac_vap_init failed[%d].", ul_ret); return ul_ret; } pst_dmac_vap->bit_beacon_timeout_times = 0; #endif pst_dmac_vap->en_bfer_actived = pst_mac_device->bit_su_bfmer; pst_dmac_vap->en_bfee_actived = pst_mac_device->bit_su_bfmee; pst_dmac_vap->en_mu_bfee_actived = pst_mac_device->bit_mu_bfmee; pst_dmac_vap->en_txstbc_actived = pst_mac_device->bit_tx_stbc; pst_dmac_vap->en_multi_user_multi_ac_flag = OAL_FALSE; pst_dmac_vap->uc_traffic_type = OAL_TRAFFIC_NORMAL; /* 初始化特性标识中BEACON帧不轮流发送 */ pst_dmac_vap->en_beacon_chain_active = OAL_FALSE; /* VAP发送通道默认值赋值,按照device下能力赋值 */ pst_dmac_vap->uc_vap_tx_chain = pst_mac_device->uc_tx_chain; /* 速率结构体赋初值 */ /* 按照PHY给出的初始值 ul_value = 0x00800211 */ pst_dmac_vap->st_tx_alg.ast_per_rate[0].rate_bit_stru.bit_tx_count = 1; #if (_PRE_PRODUCT_ID == _PRE_PRODUCT_ID_HI1151) pst_dmac_vap->st_tx_alg.ast_per_rate[0].rate_bit_stru.bit_stbc_mode = 0; #endif pst_dmac_vap->st_tx_alg.ast_per_rate[0].rate_bit_stru.bit_tx_chain_selection = 1; pst_dmac_vap->st_tx_alg.ast_per_rate[0].rate_bit_stru.uc_tx_data_antenna = 2; /* FPGA zhangyu Debug 11n */ pst_dmac_vap->st_tx_alg.ast_per_rate[0].rate_bit_stru.un_nss_rate.st_ht_rate.bit_ht_mcs = 0; pst_dmac_vap->st_tx_alg.ast_per_rate[0].rate_bit_stru.un_nss_rate.st_ht_rate.bit_protocol_mode = WLAN_HT_PHY_PROTOCOL_MODE; /* 默认是HOST VAP */ pst_dmac_vap->en_is_host_vap = OAL_TRUE; /* 默认天线组合 */ pst_dmac_vap->uc_default_ant_bitmap = 0xFF; /* 初始化节能相关参数 */ pst_dmac_vap->uc_ps_user_num = 0; pst_dmac_vap->uc_dtim_count = WLAN_DTIM_DEFAULT; #ifdef _PRE_WLAN_CHIP_TEST pst_dmac_vap->pst_wow_probe_resp = OAL_PTR_NULL; pst_dmac_vap->pst_wow_null_data = OAL_PTR_NULL; #endif pst_dmac_vap->uc_sw_retry_limit = DMAC_MAX_SW_RETRIES; if (WLAN_VAP_MODE_BSS_AP == pst_dmac_vap->st_vap_base_info.en_vap_mode) { /* DTS2015050301014,双芯片实现时bitmap_len计算要乘以device(也即是chip)个数 */ pst_dmac_vap->uc_tim_bitmap_len = (oal_uint8)(2 + (((g_us_max_asoc_user + WLAN_SERVICE_VAP_MAX_NUM_PER_DEVICE)* MAC_RES_MAX_DEV_NUM + 7 ) >> 3)); pst_dmac_vap->puc_tim_bitmap = OAL_MEM_ALLOC(OAL_MEM_POOL_ID_LOCAL, pst_dmac_vap->uc_tim_bitmap_len, OAL_TRUE); if (OAL_PTR_NULL == pst_dmac_vap->puc_tim_bitmap) { OAM_ERROR_LOG0(uc_vap_id, OAM_SF_ANY, "{dmac_vap_init::puc_tim_bitmap null.}"); return OAL_ERR_CODE_ALLOC_MEM_FAIL; } OAL_MEMZERO(pst_dmac_vap->puc_tim_bitmap, pst_dmac_vap->uc_tim_bitmap_len); /* TIM bitmap len is default 1*/ pst_dmac_vap->puc_tim_bitmap[0] = 1; }
/***************************************************************************** 函 数 名 : hmac_smps_update_status 功能描述 : AP侧接收到对应STA的关联请求消息 输入参数 : 无 输出参数 : 无 返 回 值 : 调用函数 : 被调函数 : 修改历史 : 1.日 期 : 2014年4月16日 作 者 : zhangyu 修改内容 : 新生成函数 *****************************************************************************/ oal_uint32 hmac_smps_update_status(mac_vap_stru *pst_mac_vap, mac_user_stru *pst_mac_user, oal_bool_enum_uint8 en_plus_user) { mac_device_stru *pst_mac_device; wlan_mib_mimo_power_save_enum_uint8 en_user_smps_mode; frw_event_mem_stru *pst_event_mem; frw_event_stru *pst_event; oal_uint32 ul_ret; oal_bool_enum_uint8 en_ht_cap; mac_cfg_smps_mode_stru st_smps_mode = {0}; if ((OAL_PTR_NULL == pst_mac_vap) || (OAL_PTR_NULL == pst_mac_user)) { OAM_ERROR_LOG2(0, OAM_SF_SMPS, "{hmac_smps_update_status: NULL PTR pst_mac_vap is [%d] and pst_mac_user is [%d].}", pst_mac_vap, pst_mac_user); return OAL_ERR_CODE_PTR_NULL; } if (OAL_FALSE == mac_mib_get_HighThroughputOptionImplemented(pst_mac_vap)) { OAM_INFO_LOG0(pst_mac_vap->uc_vap_id, OAM_SF_SMPS, "{hmac_smps_update_status: pst_mac_vap is mimo.}"); return OAL_SUCC; } pst_mac_device = mac_res_get_dev(pst_mac_vap->uc_device_id); if (OAL_PTR_NULL == pst_mac_device) { OAM_ERROR_LOG0(pst_mac_vap->uc_vap_id, OAM_SF_SMPS, "{hmac_smps_update_status: pst_mac_device is null.}"); return OAL_ERR_CODE_PTR_NULL; } st_smps_mode.uc_smps_mode = WLAN_MIB_MIMO_POWER_SAVE_BUTT; st_smps_mode.us_user_idx = 0; en_user_smps_mode = (wlan_mib_mimo_power_save_enum_uint8)pst_mac_user->st_ht_hdl.bit_sm_power_save; en_ht_cap = (oal_bool_enum_uint8)pst_mac_user->st_ht_hdl.en_ht_capable; if (OAL_TRUE == en_plus_user) { if ((OAL_TRUE == en_ht_cap) && (WLAN_MIB_MIMO_POWER_SAVE_MIMO != en_user_smps_mode)) { /* 如果不是第一个用户,则直接返回 */ if (1 < pst_mac_device->uc_asoc_user_cnt) { return OAL_SUCC; } /* 如果是第一个用户,则进入SMPS模式 */ /* 设置SMPS模式信息 mib值 */ st_smps_mode.uc_smps_mode = (oal_uint8)pst_mac_vap->st_cap_flag.bit_smps; } else { pst_mac_device->uc_no_smps_user_cnt++; if (OAL_FALSE == pst_mac_device->en_smps) { return OAL_SUCC; } /* 设置SMPS模式disable */ st_smps_mode.uc_smps_mode = WLAN_MIB_MIMO_POWER_SAVE_MIMO; hmac_smps_all_vap_update(pst_mac_device, WLAN_MIB_MIMO_POWER_SAVE_MIMO); } } else { if ((OAL_TRUE == en_ht_cap) && (WLAN_MIB_MIMO_POWER_SAVE_MIMO != en_user_smps_mode)) { return OAL_SUCC; } if (0 < pst_mac_device->uc_no_smps_user_cnt) { pst_mac_device->uc_no_smps_user_cnt--; } if ((0 == pst_mac_device->uc_no_smps_user_cnt) && (OAL_FALSE == pst_mac_device->en_smps)) { /* 设置SMPS模式信息 mib值 */ st_smps_mode.uc_smps_mode = mac_mib_get_smps(pst_mac_vap); hmac_smps_all_vap_update(pst_mac_device, mac_mib_get_smps(pst_mac_vap)); } else { return OAL_SUCC; } } /* 抛事件到DMAC, 申请事件内存 */ pst_event_mem = FRW_EVENT_ALLOC(OAL_SIZEOF(st_smps_mode)); if (OAL_PTR_NULL == pst_event_mem) { OAM_ERROR_LOG0(pst_mac_vap->uc_vap_id, OAM_SF_SMPS, "{hmac_smps_update_status: FRW_EVENT_ALLOC fail.}"); return OAL_ERR_CODE_PTR_NULL; } ul_ret = mac_vap_find_user_by_macaddr(pst_mac_vap, pst_mac_user->auc_user_mac_addr, &(st_smps_mode.us_user_idx)); /* 查找用户失败或没有找到对应的用户 */ if (OAL_SUCC != ul_ret) { OAM_WARNING_LOG1(pst_mac_vap->uc_vap_id, OAM_SF_SMPS, "{hmac_smps_update_status::mac_vap_find_user_by_macaddr failed[%d].}", ul_ret); return ul_ret; } /* 填写事件 */ pst_event = (frw_event_stru *)pst_event_mem->puc_data; FRW_EVENT_HDR_INIT(&(pst_event->st_event_hdr), FRW_EVENT_TYPE_WLAN_CTX, DMAC_WLAN_CTX_EVENT_SUB_TYPE_SET_SMPS, OAL_SIZEOF(st_smps_mode), FRW_EVENT_PIPELINE_STAGE_1, pst_mac_vap->uc_chip_id, pst_mac_vap->uc_device_id, pst_mac_vap->uc_vap_id); /* 拷贝参数 */ oal_memcopy(pst_event->auc_event_data, (oal_void *)&st_smps_mode, OAL_SIZEOF(st_smps_mode)); /* 分发事件 */ ul_ret = frw_event_dispatch_event(pst_event_mem); if (OAL_SUCC != ul_ret) { FRW_EVENT_FREE(pst_event_mem); return OAL_FAIL; } FRW_EVENT_FREE(pst_event_mem); return OAL_SUCC; }
oal_netbuf_stru* hmac_defrag_process(hmac_user_stru *pst_hmac_user, oal_netbuf_stru *pst_netbuf, oal_uint32 ul_hrdsize) { mac_ieee80211_frame_stru *pst_mac_hdr = OAL_PTR_NULL; mac_ieee80211_frame_stru *pst_last_hdr = OAL_PTR_NULL; oal_uint16 us_rx_seq = 0; oal_uint16 us_last_seq = 0; oal_uint8 uc_frag_num = 0; oal_uint8 uc_last_frag_num = 0; oal_bool_enum_uint8 en_more_frag = OAL_FALSE; oal_netbuf_stru *pst_new_buf = OAL_PTR_NULL; mac_rx_ctl_stru *pst_rx_ctl; oal_uint32 ul_ret; oal_uint8 uc_device_id; mac_device_stru *pst_mac_device; oal_uint32 ul_core_id; pst_mac_hdr = (mac_ieee80211_frame_stru *)oal_netbuf_data(pst_netbuf); us_rx_seq = pst_mac_hdr->bit_seq_num; uc_frag_num = (oal_uint8)pst_mac_hdr->bit_frag_num; en_more_frag = (oal_bool_enum_uint8)pst_mac_hdr->st_frame_control.bit_more_frag; /* 如果没有什么可以去分片的则直接返回 */ if (!en_more_frag && 0 == uc_frag_num && OAL_PTR_NULL == pst_hmac_user->pst_defrag_netbuf) { return pst_netbuf; } OAL_MEM_NETBUF_TRACE(pst_netbuf, OAL_FALSE); /* 首先检查到来的分片报文是不是属于正在重组的分片报文 */ if (pst_hmac_user->pst_defrag_netbuf) { frw_timer_restart_timer(&pst_hmac_user->st_defrag_timer, HMAC_FRAG_TIMEOUT, OAL_FALSE); pst_last_hdr = (mac_ieee80211_frame_stru *)oal_netbuf_data(pst_hmac_user->pst_defrag_netbuf); us_last_seq = pst_last_hdr->bit_seq_num; uc_last_frag_num = (oal_uint8)pst_last_hdr->bit_frag_num; /* 如果地址不匹配,序列号不匹配,分片号不匹配则释放现在正在重组的报文 */ if (us_rx_seq != us_last_seq || uc_frag_num != (uc_last_frag_num + 1) || oal_compare_mac_addr(pst_last_hdr->auc_address1, pst_mac_hdr->auc_address1) || oal_compare_mac_addr(pst_last_hdr->auc_address2, pst_mac_hdr->auc_address2)) { oal_netbuf_free(pst_hmac_user->pst_defrag_netbuf); FRW_TIMER_IMMEDIATE_DESTROY_TIMER(&pst_hmac_user->st_defrag_timer); pst_hmac_user->pst_defrag_netbuf = OAL_PTR_NULL; } } /* 判断到来的分片报文是否是第一个分片 */ if (OAL_PTR_NULL == pst_hmac_user->pst_defrag_netbuf) { /* 首片分片的分片号不为0则释放 */ if (uc_frag_num != 0) { oal_netbuf_free(pst_netbuf); OAM_STAT_VAP_INCR(pst_hmac_user->st_user_base_info.uc_vap_id, rx_defrag_process_dropped, 1); OAM_INFO_LOG3(pst_hmac_user->st_user_base_info.uc_vap_id, OAM_SF_ANY, "{hmac_defrag_process::The first frag_num is not Zero(%d), seq_num[%d], mor_frag[%d].}", uc_frag_num, us_rx_seq, en_more_frag); return OAL_PTR_NULL; } /* 没有分片,直接返回 */ if (0 == en_more_frag && 0 == uc_frag_num) { return pst_netbuf; } uc_device_id = pst_hmac_user->st_user_base_info.uc_device_id; pst_mac_device = mac_res_get_dev((oal_uint32)uc_device_id); if (OAL_PTR_NULL == pst_mac_device) { OAM_ERROR_LOG4(pst_hmac_user->st_user_base_info.uc_vap_id, OAM_SF_ANY, "{hmac_defrag_process::user index[%d] user mac:XX:XX:XX:%02X:%02X:%02X}", pst_hmac_user->st_user_base_info.us_assoc_id, pst_hmac_user->st_user_base_info.auc_user_mac_addr[3], pst_hmac_user->st_user_base_info.auc_user_mac_addr[4], pst_hmac_user->st_user_base_info.auc_user_mac_addr[5]); /* user异常,丢弃报文 */ oal_netbuf_free(pst_netbuf); OAM_STAT_VAP_INCR(pst_hmac_user->st_user_base_info.uc_vap_id, rx_defrag_process_dropped, 1); return OAL_PTR_NULL; } ul_core_id = pst_mac_device->ul_core_id; /* 启动超时定时器,超时释放重组报文 */ FRW_TIMER_CREATE_TIMER(&pst_hmac_user->st_defrag_timer, hmac_defrag_timeout_fn, HMAC_FRAG_TIMEOUT, pst_hmac_user, OAL_FALSE, OAM_MODULE_ID_HMAC, ul_core_id); /* 内存池netbuf只有1600 可能不够,参照A公司申请2500操作系统原生态报文 */ pst_new_buf = OAL_MEM_NETBUF_ALLOC(OAL_NORMAL_NETBUF, HMAC_MAX_FRAG_SIZE, OAL_NETBUF_PRIORITY_MID); if (OAL_PTR_NULL == pst_new_buf) { OAM_ERROR_LOG1(pst_hmac_user->st_user_base_info.uc_vap_id, OAM_SF_ANY, "{hmac_defrag_process::Alloc new_buf null,size[%d].}", HMAC_MAX_FRAG_SIZE); return OAL_PTR_NULL; } OAL_MEM_NETBUF_TRACE(pst_new_buf, OAL_FALSE); /* 将分片报文拷贝到新申请的报文中并挂接到用户结构体下,释放原有的报文 */ oal_netbuf_init(pst_new_buf, OAL_NETBUF_LEN(pst_netbuf)); oal_netbuf_copydata(pst_netbuf, 0, oal_netbuf_data(pst_new_buf), OAL_NETBUF_LEN(pst_netbuf)); oal_memcopy(OAL_NETBUF_CB(pst_new_buf), OAL_NETBUF_CB(pst_netbuf), MAC_TX_CTL_SIZE); pst_rx_ctl = (mac_rx_ctl_stru *)OAL_NETBUF_CB(pst_new_buf); pst_rx_ctl->pul_mac_hdr_start_addr = (oal_uint32 *)OAL_NETBUF_HEADER(pst_new_buf); pst_hmac_user->pst_defrag_netbuf = pst_new_buf; oal_netbuf_free(pst_netbuf); pst_netbuf = pst_new_buf; } else { if (OAL_UNLIKELY(OAL_PTR_NULL == pst_last_hdr)) { OAM_ERROR_LOG0(pst_hmac_user->st_user_base_info.uc_vap_id, OAM_SF_ANY, "{hmac_defrag_process::pst_last_hdr is NULL.}"); return OAL_PTR_NULL; } /* 此分片是期望的到来的分片,重启定时器,并进行重组 */ frw_timer_restart_timer(&pst_hmac_user->st_defrag_timer, HMAC_FRAG_TIMEOUT, OAL_FALSE); oal_netbuf_pull(pst_netbuf, ul_hrdsize); /* 记录最新分片报文的分片号 */ pst_last_hdr->bit_seq_num = pst_mac_hdr->bit_seq_num; pst_last_hdr->bit_frag_num = pst_mac_hdr->bit_frag_num; /*此接口内会调用dev_kfree_skb*/ oal_netbuf_concat(pst_hmac_user->pst_defrag_netbuf, pst_netbuf); } /* 判断是否重组完毕,存在更多报文返回空指针,重组完毕返回组好的报文 */ if (en_more_frag) { pst_netbuf = OAL_PTR_NULL; } else { if (OAL_UNLIKELY(OAL_PTR_NULL == pst_last_hdr)) { OAM_ERROR_LOG0(pst_hmac_user->st_user_base_info.uc_vap_id, OAM_SF_ANY, "{hmac_defrag_process::pst_last_hdr is NULL.}"); oal_netbuf_free(pst_netbuf); pst_hmac_user->pst_defrag_netbuf = OAL_PTR_NULL; return OAL_PTR_NULL; } pst_netbuf = pst_hmac_user->pst_defrag_netbuf; /* 对重组好的报文进行mic检查 */ ul_ret = hmac_de_mic(pst_hmac_user, pst_netbuf); if (OAL_SUCC != ul_ret) { oal_netbuf_free(pst_netbuf); OAM_STAT_VAP_INCR(pst_hmac_user->st_user_base_info.uc_vap_id, rx_de_mic_fail_dropped, 1); pst_netbuf = OAL_PTR_NULL; OAM_INFO_LOG1(pst_hmac_user->st_user_base_info.uc_vap_id, OAM_SF_ANY, "{hmac_defrag_process::hmac_de_mic failed[%d].}", ul_ret); } pst_hmac_user->pst_defrag_netbuf = OAL_PTR_NULL; pst_last_hdr->bit_frag_num = 0; FRW_TIMER_IMMEDIATE_DESTROY_TIMER(&pst_hmac_user->st_defrag_timer); } return pst_netbuf; }
/***************************************************************************** 函 数 名 : dmac_device_init 功能描述 : device的初始化函数 输入参数 : 指向要进行初始化的device指针 输出参数 : 无 返 回 值 : 成功或者失败原因 调用函数 : 被调函数 : 修改历史 : 1.日 期 : 2012年10月19日 作 者 : huxiaotong 修改内容 : 新生成函数 *****************************************************************************/ OAL_STATIC oal_uint32 dmac_device_init(oal_uint8 *puc_device_id, oal_uint8 uc_chip_id, oal_uint8 uc_device_id, oal_uint32 ul_chip_ver) { oal_uint32 ul_ret; oal_uint8 uc_dev_id; mac_device_stru *pst_device; mac_data_rate_stru *pst_data_rate; oal_uint32 ul_rate_num = 0; oal_uint32 ul_idx; oal_uint32 ul_loop = 0; dmac_device_stru *pst_dmac_device; hal_cfg_rts_tx_param_stru st_hal_rts_tx_param; #ifdef _PRE_WLAN_DFT_STAT oam_stats_phy_node_idx_stru st_phy_node_idx = {{OAM_STATS_PHY_NODE_TX_CNT, OAM_STATS_PHY_NODE_RX_OK_CNT, OAM_STATS_PHY_NODE_11B_HDR_ERR_CNT, OAM_STATS_PHY_NODE_OFDM_HDR_ERR_CNT}}; #endif /*申请公共mac device结构体,修改下 名称*/ ul_ret = mac_res_alloc_dmac_dev(&uc_dev_id); if(OAL_UNLIKELY(ul_ret != OAL_SUCC)) { OAM_ERROR_LOG1(0, OAM_SF_ANY, "{dmac_device_init::mac_res_alloc_dmac_dev failed[%d].}", ul_ret); return OAL_FAIL; } pst_device = mac_res_get_dev(uc_dev_id); if (OAL_PTR_NULL == pst_device) { OAM_ERROR_LOG0(0, OAM_SF_ANY, "{dmac_device_init::pst_device null.}"); return OAL_ERR_CODE_PTR_NULL; } #if 0 pst_device->uc_chip_id = uc_chip_id; pst_device->uc_device_id = uc_dev_id; #endif /* 申请dmac device资源 */ if(OAL_UNLIKELY(dmac_res_alloc_mac_dev(uc_dev_id) != OAL_SUCC)) { OAM_ERROR_LOG0(0, OAM_SF_ANY, "{dmac_device_init::dmac_res_alloc_mac_dev failed.}"); return OAL_FAIL; } #if (_PRE_MULTI_CORE_MODE_OFFLOAD_DMAC == _PRE_MULTI_CORE_MODE) /* 初始化device级别的一些参数 */ ul_ret = mac_device_init(pst_device, ul_chip_ver, uc_chip_id, uc_dev_id); if (OAL_SUCC != ul_ret) { OAM_ERROR_LOG2(0, OAM_SF_ANY, "{dmac_device_init::mac_device_init failed[%d], chip_ver[0x%x].}", ul_ret, ul_chip_ver); dmac_res_free_mac_dev(uc_dev_id); mac_res_free_dev(uc_dev_id); return ul_ret; } #endif /* 获取hmac device,并进行相关参数赋值 */ pst_dmac_device = dmac_res_get_mac_dev(uc_dev_id); if (OAL_PTR_NULL == pst_dmac_device) { OAM_ERROR_LOG0(0, OAM_SF_ANY, "{dmac_device_init::pst_dmac_device null.}"); mac_res_free_dev(uc_dev_id); return OAL_ERR_CODE_PTR_NULL; } /* 结构体初始化 */ OAL_MEMZERO(pst_dmac_device, OAL_SIZEOF(*pst_dmac_device)); pst_dmac_device->pst_device_base_info = pst_device; #ifdef _PRE_WLAN_FEATURE_DFR pst_dmac_device->en_dfr_hw_reset_enable = OAL_FALSE; #endif //#ifdef _PRE_WLAN_FEATURE_DFR /* 硬mac结构指针只存在于DMAC中,需要针对device对象中私有部分 的内容进行初始化,用于逻辑和物理device的对应 */ ul_ret = hal_chip_get_device(uc_chip_id, uc_device_id, &pst_device->pst_device_stru); pst_device->ul_core_id = pst_device->pst_device_stru->ul_core_id; if (OAL_SUCC != ul_ret) { OAM_WARNING_LOG1(0, OAM_SF_ANY, "{dmac_device_init::hal_chip_get_device failed[%d].}", ul_ret); dmac_res_free_mac_dev(uc_dev_id); mac_res_free_dev(uc_dev_id); return ul_ret; } /* 保存mac层的device id */ pst_device->pst_device_stru->uc_mac_device_id = uc_dev_id; if(OAL_SUCC != mac_fcs_init(&pst_device->st_fcs_mgr, pst_device->uc_chip_id, pst_device->uc_device_id)) { OAM_WARNING_LOG0(0, OAM_SF_ANY, "{dmac_device_init::mac_fcs_init failed.}"); dmac_res_free_mac_dev(uc_dev_id); mac_res_free_dev(uc_dev_id); return OAL_FAIL; } /* 算法框架初始化 */ ul_ret = dmac_alg_init(pst_device); if (OAL_SUCC != ul_ret) { OAM_WARNING_LOG1(0, OAM_SF_ANY, "{dmac_device_init::dmac_alg_init failed[%d].}", ul_ret); dmac_res_free_mac_dev(uc_dev_id); mac_res_free_dev(uc_dev_id); return ul_ret; } /* 算法距离、干扰等状态初始化 */ dmac_alg_stat_init(pst_dmac_device); pst_device->us_total_mpdu_num = 0; /* 错误计数初始化 */ OAL_MEMZERO(pst_device->aul_mac_err_cnt, OAL_SIZEOF(pst_device->aul_mac_err_cnt)); /*初始化记录性能统计第一次时间戳*/ pst_device->ul_first_timestamp = 0; pst_device->ul_rx_buf_too_small_show_counter = 0; #if (_PRE_PRODUCT_ID == _PRE_PRODUCT_ID_HI1151) pst_device->ul_rx_fsm_st_timeout_show_counter = 0; pst_device->ul_tx_fsm_st_timeout_show_counter = 0; pst_device->ul_beacon_miss_show_counter = 0; pst_device->us_user_nums_max = WLAN_ASSOC_USER_MAX_NUM_SPEC; pst_device->ul_pcie_reg110_timeout_counter = 0; pst_device->ul_pcie_read_counter = 0; /* DTS2015100700205,特殊网卡兼容性问题规避方案: 会发生DataFlow Break时候会影响性能 */ pst_device->st_dataflow_brk_bypass.en_brk_limit_aggr_enable = OAL_FALSE; pst_device->st_dataflow_brk_bypass.ul_tx_dataflow_brk_cnt = 0; pst_device->st_dataflow_brk_bypass.ul_last_tx_complete_isr_cnt = 0; #endif for (ul_loop = 0; ul_loop < WLAN_WME_AC_BUTT; ul_loop++) { pst_device->aus_ac_mpdu_num[ul_loop] = 0; } for (ul_loop = 0; ul_loop < WLAN_VAP_SUPPORT_MAX_NUM_LIMIT; ul_loop++) { pst_device->aus_vap_mpdu_num[ul_loop] = 0; } for (ul_loop = WLAN_WME_AC_BE; ul_loop < WLAN_WME_AC_BUTT; ul_loop++) { pst_device->aus_ac_mpdu_num[ul_loop] = 0; } #ifdef _PRE_WLAN_DFT_STAT /* 初始化维测参数,空口环境类参数 */ OAL_MEMZERO(&(pst_device->st_dbb_env_param_ctx), OAL_SIZEOF(mac_device_dbb_env_param_ctx_stru)); #endif #ifdef _PRE_WLAN_FEATURE_PM pst_device->en_pm_enable = OAL_FALSE; mac_pm_arbiter_init(pst_device); #endif /* 初始化TXOP特性相关值 */ pst_device->en_txop_enable = OAL_FALSE; pst_device->uc_tx_ba_num = 0; /* 从eeprom或flash获得MAC地址 */ hal_get_hw_addr(pst_device->pst_device_stru, pst_device->auc_hw_addr); /* 初始化DEVICE下的速率集 */ hal_get_rate_80211g_table(pst_device->pst_device_stru, (oal_void *)&pst_data_rate); hal_get_rate_80211g_num(pst_device->pst_device_stru, &ul_rate_num); for (ul_idx = 0; ul_idx < ul_rate_num; ul_idx++) { oal_memcopy(&(pst_device->st_mac_rates_11g[ul_idx]),&pst_data_rate[ul_idx],OAL_SIZEOF(mac_data_rate_stru)); } /* 初始化2.4G和5G的RTS速率, RTS[0~2]设为24Mbps, RTS[3]在2.4G设为1Mbps、5G设为24Mbps*/ st_hal_rts_tx_param.auc_protocol_mode[0] = WLAN_LEGACY_OFDM_PHY_PROTOCOL_MODE; st_hal_rts_tx_param.auc_rate[0] = WLAN_LEGACY_OFDM_24M_BPS; st_hal_rts_tx_param.auc_protocol_mode[1] = WLAN_LEGACY_OFDM_PHY_PROTOCOL_MODE; st_hal_rts_tx_param.auc_rate[1] = WLAN_LEGACY_OFDM_24M_BPS; st_hal_rts_tx_param.auc_protocol_mode[2] = WLAN_LEGACY_OFDM_PHY_PROTOCOL_MODE; st_hal_rts_tx_param.auc_rate[2] = WLAN_LEGACY_OFDM_24M_BPS; st_hal_rts_tx_param.en_band = WLAN_BAND_2G; st_hal_rts_tx_param.auc_protocol_mode[3] = WLAN_11B_PHY_PROTOCOL_MODE; st_hal_rts_tx_param.auc_rate[3] = WLAN_LONG_11b_1_M_BPS; hal_set_rts_rate_params(pst_device->pst_device_stru, &st_hal_rts_tx_param); st_hal_rts_tx_param.en_band = WLAN_BAND_5G; st_hal_rts_tx_param.auc_protocol_mode[3] = WLAN_LEGACY_OFDM_PHY_PROTOCOL_MODE; st_hal_rts_tx_param.auc_rate[3] = WLAN_LEGACY_OFDM_24M_BPS; hal_set_rts_rate_params(pst_device->pst_device_stru, &st_hal_rts_tx_param); #if (_PRE_OS_VERSION_LINUX == _PRE_OS_VERSION)||(_PRE_OS_VERSION_RAW == _PRE_OS_VERSION) /* TBD */ /* hal_enable_radar_det(pst_device->pst_device_stru, OAL_TRUE); */ pst_device->us_dfs_timeout = 0; #endif /* 初始化DMAC SCANNER */ dmac_scan_init(pst_device); #ifdef _PRE_SUPPORT_ACS /* 初始化ACS结构体 */ dmac_acs_init(pst_device); #endif #ifdef _PRE_WLAN_DFT_REG /* 初始化寄存器读取定时器 */ FRW_TIMER_CREATE_TIMER(&pst_device->st_reg_prd_timer, dmac_reg_timeout, OAM_REGSTER_REFRESH_TIME_MS, pst_device->pst_device_stru, OAL_TRUE, OAM_MODULE_ID_DMAC, pst_device->ul_core_id); #endif /* 出参赋值,CHIP中需要保存该device id */ *puc_device_id = uc_dev_id; #ifdef _PRE_WLAN_FEATURE_AMPDU #ifdef _PRE_DEBUG_MODE //#if ((_PRE_TARGET_PRODUCT_TYPE_5610DMB != _PRE_CONFIG_TARGET_PRODUCT) ) //OAL_MEMZERO(g_ast_tx_ba_track[pst_device->uc_device_id], OAL_SIZEOF(dmac_tx_ba_track_stru) * HAL_MAX_AMPDU_LUT_SIZE); //#endif #endif #endif #ifdef _PRE_DEBUG_MODE OAL_MEMZERO(&(pst_device->st_exception_report_timer), OAL_SIZEOF(frw_timeout_stru)); FRW_TIMER_CREATE_TIMER(&(pst_device->st_exception_report_timer), dmac_device_exception_report_timeout_fn, MAC_EXCEPTION_TIME_OUT, pst_device->pst_device_stru, OAL_TRUE, OAM_MODULE_ID_MAC, pst_device->ul_core_id); #endif #ifdef _PRE_WLAN_DFT_STAT /* 初始化phy统计节点 */ dmac_dft_set_phy_stat_node(pst_device, &st_phy_node_idx); #endif ul_ret = dmac_cfg_vap_init(pst_device); if(OAL_UNLIKELY(ul_ret != OAL_SUCC)) { OAM_ERROR_LOG1(0, OAM_SF_ANY, "{hmac_chip_init::hmac_cfg_vap_init failed[%d].}", ul_ret); return OAL_FAIL; } return OAL_SUCC; }
/***************************************************************************** 函 数 名 : dmac_psm_check_txrx_state 功能描述 : 检测协议栈txrx状态是否满足睡眠条件 输入参数 : 输出参数 : 无 返 回 值 : 调用函数 : 被调函数 : 修改历史 : 1.日 期 : 2014年1月15日 作 者 : z00274374 修改内容 : 新生成函数 *****************************************************************************/ oal_uint8 dmac_psm_check_txrx_state(oal_void) { hal_to_dmac_device_stru *pst_hal_device; mac_device_stru *pst_device; dmac_vap_stru *pst_dmac_vap; oal_uint8 uc_vap_idx; pst_device = mac_res_get_dev(0); if (OAL_UNLIKELY(OAL_PTR_NULL == pst_device )) { OAM_ERROR_LOG0(0, OAM_SF_ANY, "{dmac_psm_check_txrx_state::pst_device[id:0] is NULL!}"); return OAL_FALSE; } pst_hal_device = pst_device->pst_device_stru; #ifdef _PRE_WLAN_FEATURE_BTCOEX if(pst_hal_device->st_btcoex_btble_status.un_bt_status.st_bt_status.bit_bt_on) { g_ul_coex_cnt++; } #endif /* 正在扫描不睡眠 */ if (MAC_SCAN_STATE_RUNNING == pst_device->en_curr_scan_state) { /* 仅在host允许睡的情况下计数++,此计数是为了验证低功耗在扫描过程中睡眠了 */ if (OAL_TRUE == PM_WLAN_IsHostSleep()) { g_ul_wait_scanning++; } return OAL_FALSE; } /* DBAC running 不睡眠 */ if(OAL_TRUE == mac_is_dbac_running(pst_device)) { g_ul_wait_dbac++; return OAL_FALSE; } /*检查接收硬件发送队列和TID队列是否空*/ if(OAL_FALSE == dmac_psm_is_hw_queues_empty(pst_device)) { //OAL_IO_PRINT("pm check:tx hw queues not empty\r\n"); g_ul_wait_hw++; return OAL_FALSE; } for (uc_vap_idx = 0; uc_vap_idx < pst_device->uc_vap_num; uc_vap_idx++) { pst_dmac_vap = mac_res_get_dmac_vap(pst_device->auc_vap_id[uc_vap_idx]); if (WLAN_VAP_MODE_BSS_STA == pst_dmac_vap->st_vap_base_info.en_vap_mode) { if(OAL_FALSE == dmac_psm_is_tid_queues_empty(pst_dmac_vap)) { //OAL_IO_PRINT("pm check:tx tid queues not empty\r\n"); g_ul_wait_tid++; return OAL_FALSE; } } } /*检查接收中断是否有残留*/ if (!oal_dlist_is_empty(&(pst_hal_device->ast_rx_isr_info_list[0]))) { //OAL_IO_PRINT("ast_rx_isr_info_list[0] IS NOT EMPTY\r\n"); g_ul_wait_rx_irq++; return OAL_FALSE; } if (!oal_dlist_is_empty(&(pst_hal_device->ast_rx_isr_info_list[1]))) { //OAL_IO_PRINT("ast_rx_isr_info_list[1] IS NOT EMPTY\r\n"); g_ul_wait_rx_irq++; return OAL_FALSE; } return OAL_TRUE; }
/***************************************************************************** 函 数 名 : dmac_psm_recover_ps_mac_state 功能描述 : phy状态恢复 输入参数 : 输出参数 : 无 返 回 值 : 调用函数 : 被调函数 : 修改历史 : 1.日 期 : 2014年1月15日 作 者 : l00280485 修改内容 : 新生成函数 *****************************************************************************/ oal_uint8 dmac_psm_recover_powerdown(oal_uint8 uc_dmach0,oal_uint8 uc_dmach1,oal_uint8 uc_dmach2) { hal_to_dmac_device_stru *pst_hal_device; mac_device_stru *pst_device; //oal_uint32 ul_ret = OAL_SUCC; hal_error_state_stru st_error_state; /*低功耗前面的流程已检查过合法性,不需要重复检查*/ pst_device = mac_res_get_dev(0);//和平台沟通,目前先写死是device id,后面有需求再传入参 pst_hal_device = pst_device->pst_device_stru; /*和TSF同步相关的BANK1寄存器恢复*/ dmac_psm_recover_mac_reg(pst_hal_device); /*tsf开始同步*/ PM_WLAN_Tsf_Aon_to_Inner_start(); //dmac_psm_recover_phy_reg(pst_hal_device); /* TCM 恢复*/ dmac_psm_recover_tcm(pst_hal_device); //restart移动至paldo 开启处 frw_timer_time_fix(); DMAWaitChannelDone(uc_dmach0); dmac_psm_init_netbuf_pool(); hal_rx_init_dscr_queue(pst_hal_device,OAL_FALSE); /*等待tsf同步完成*/ PM_WLAN_Aon_Tsf_Sync(); DMAWaitChannelDone(uc_dmach1); //DMAWaitChannelDone(uc_dmach2); /*避免复位过程中接收描述符队列异常,重新初始化接收描述符队列*/ //hal_rx_destroy_dscr_queue(pst_hal_device,OAL_FALSE); dmac_psm_sync_tsf_to_ap(); hal_irq_init((hal_device_stru*)pst_hal_device); hal_set_machw_rx_buff_addr(pst_hal_device, (oal_uint32)HAL_RX_DSCR_GET_REAL_ADDR(pst_hal_device->ast_rx_dscr_queue[HAL_RX_DSCR_NORMAL_PRI_QUEUE].pul_element_head), HAL_RX_DSCR_NORMAL_PRI_QUEUE); hal_set_machw_rx_buff_addr(pst_hal_device, (oal_uint32)HAL_RX_DSCR_GET_REAL_ADDR(pst_hal_device->ast_rx_dscr_queue[HAL_RX_DSCR_HIGH_PRI_QUEUE].pul_element_head), HAL_RX_DSCR_HIGH_PRI_QUEUE); hal_set_machw_rx_buff_addr(pst_hal_device, (oal_uint32)HAL_RX_DSCR_GET_REAL_ADDR(pst_hal_device->ast_rx_dscr_queue[HAL_RX_DSCR_SMALL_QUEUE].pul_element_head), HAL_RX_DSCR_SMALL_QUEUE); /* 清中断状态 */ st_error_state.ul_error1_val = 0xFFFFFFFF; st_error_state.ul_error2_val = 0xFFFFFFFF; hal_clear_mac_error_int_status(pst_hal_device, &st_error_state); hal_clear_mac_int_status(pst_hal_device, 0xffffffff); /* SDIO 重新初始化 */ hcc_slave_reinit(); return OAL_TRUE; }