本文整理汇总了C++中rtw_msleep_os函数的典型用法代码示例。如果您正苦于以下问题:C++ rtw_msleep_os函数的具体用法?C++ rtw_msleep_os怎么用?C++ rtw_msleep_os使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了rtw_msleep_os函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: rtl8723as_xmit_handler
/*
* Description
* Transmit xmitframe from queue
*
* Return
* _SUCCESS ok
* _FAIL something error
*/
s32 rtl8723as_xmit_handler(PADAPTER padapter)
{
struct xmit_priv *pxmitpriv;
PHAL_DATA_TYPE phal;
s32 ret;
_irqL irql;
pxmitpriv = &padapter->xmitpriv;
phal = GET_HAL_DATA(padapter);
wait:
ret = _rtw_down_sema(&phal->SdioXmitSema);
if (_FAIL == ret) {
RT_TRACE(_module_hal_xmit_c_, _drv_emerg_, ("%s: down sema fail!\n", __FUNCTION__));
return _FAIL;
}
next:
if ((padapter->bDriverStopped == _TRUE) ||
(padapter->bSurpriseRemoved == _TRUE)) {
RT_TRACE(_module_hal_xmit_c_, _drv_notice_,
("%s: bDriverStopped(%d) bSurpriseRemoved(%d)\n",
__FUNCTION__, padapter->bDriverStopped, padapter->bSurpriseRemoved));
return _FAIL;
}
_enter_critical_bh(&pxmitpriv->lock, &irql);
ret = rtw_txframes_pending(padapter);
_exit_critical_bh(&pxmitpriv->lock, &irql);
if (ret == 0) {
return _SUCCESS;
}
// dequeue frame and write to hardware
ret = xmit_xmitframes(padapter, pxmitpriv);
if (ret == -2) {
rtw_msleep_os(1);
goto next;
}
_enter_critical_bh(&pxmitpriv->lock, &irql);
ret = rtw_txframes_pending(padapter);
_exit_critical_bh(&pxmitpriv->lock, &irql);
if (ret == 1) {
rtw_msleep_os(1);
goto next;
}
return _SUCCESS;
}
示例2: wps_connect_to_AP_by_certificate
static void wps_connect_to_AP_by_certificate(rtw_network_info_t *wifi)
{
#define RETRY_COUNT 3
int retry_count = RETRY_COUNT, ret;
printf("\r\n=============== wifi_certificate_info ===============\n");
printf("\r\nwps_wifi.ssid = %s\n", wifi->ssid.val);
printf("\r\nsecurity_type = %d\n", wifi->security_type);
printf("\r\nwps_wifi.password = %s\n", wifi->password);
printf("\r\nssid_len = %d\n", wifi->ssid.len);
printf("\r\npassword_len = %d\n", wifi->password_len);
while (1) {
ret = wifi_connect((char*)wifi->ssid.val,
wifi->security_type,
(char*)wifi->password,
wifi->ssid.len,
wifi->password_len,
wifi->key_id,
NULL);
if (ret == RTW_SUCCESS) {
if(retry_count == RETRY_COUNT)
rtw_msleep_os(1000); //When start wps with OPEN AP, AP will send a disassociate frame after STA connected, need reconnect here.
if(RTW_SUCCESS == wifi_is_ready_to_transceive(RTW_STA_INTERFACE)){
//printf("\r\n[WPS]Ready to tranceive!!\n");
wps_check_and_show_connection_info();
break;
}
}
if (retry_count == 0) {
printf("\r\n[WPS]Join bss failed\n");
break;
}
retry_count --;
}
}
示例3: wps_connect_to_AP_by_open_system
static int wps_connect_to_AP_by_open_system(char *target_ssid)
{
int retry_count = 3, ret;
if (target_ssid != NULL) {
rtw_msleep_os(500); //wait scan complete.
while (1) {
ret = wifi_connect(target_ssid,
RTW_SECURITY_OPEN,
NULL,
strlen(target_ssid),
0,
0,
NULL);
if (ret == RTW_SUCCESS) {
//wps_check_and_show_connection_info();
break;
}
if (retry_count == 0) {
printf("\r\n[WPS]Join bss failed\n");
return -1;
}
retry_count --;
}
//
} else {
printf("\r\n[WPS]Target SSID is NULL\n");
}
return 0;
}
示例4: rtl8188es_dequeue_writeport
//todo: static
s32 rtl8188es_dequeue_writeport(PADAPTER padapter, u8 *freePage)
{
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
struct dvobj_priv *pdvobjpriv = adapter_to_dvobj(padapter);
struct xmit_buf *pxmitbuf;
PADAPTER pri_padapter = padapter;
s32 ret = 0;
#ifdef CONFIG_CONCURRENT_MODE
if (padapter->adapter_type > 0)
pri_padapter = padapter->pbuddy_adapter;
if(rtw_buddy_adapter_up(padapter))
ret = check_buddy_fwstate( padapter, _FW_UNDER_SURVEY);
#endif
ret = ret || check_fwstate(pmlmepriv, _FW_UNDER_SURVEY);
if (_TRUE == ret)
pxmitbuf = dequeue_pending_xmitbuf_under_survey(pxmitpriv);
else
pxmitbuf = dequeue_pending_xmitbuf(pxmitpriv);
if (pxmitbuf == NULL)
return _TRUE;
query_free_page:
// check if hardware tx fifo page is enough
if( _FALSE == rtl8188es_query_tx_freepage(pri_padapter, pxmitbuf))
{
rtw_msleep_os(1);
goto query_free_page;
}
if ((padapter->bSurpriseRemoved == _TRUE)
|| (padapter->bDriverStopped == _TRUE)
#ifdef CONFIG_CONCURRENT_MODE
||((padapter->pbuddy_adapter)
&& ((padapter->pbuddy_adapter->bSurpriseRemoved) ||(padapter->pbuddy_adapter->bDriverStopped)))
#endif
){
RT_TRACE(_module_hal_xmit_c_, _drv_notice_,
("%s: bSurpriseRemoved(wirte port)\n", __FUNCTION__));
goto free_xmitbuf;
}
rtw_write_port(padapter, ffaddr2deviceId(pdvobjpriv, pxmitbuf->ff_hwaddr), pxmitbuf->len, (u8 *)pxmitbuf);
free_xmitbuf:
//rtw_free_xmitframe(pxmitpriv, pframe);
//pxmitbuf->priv_data = NULL;
rtw_free_xmitbuf(pxmitpriv, pxmitbuf);
#ifdef CONFIG_SDIO_TX_TASKLET
tasklet_hi_schedule(&pxmitpriv->xmit_tasklet);
#endif
return _FAIL;
}
示例5: rtl8723bs_xmit_handler
/*
* Description
* Transmit xmitframe from queue
*
* Return
* _SUCCESS ok
* _FAIL something error
*/
s32 rtl8723bs_xmit_handler(PADAPTER padapter)
{
struct xmit_priv *pxmitpriv;
s32 ret;
_irqL irql;
pxmitpriv = &padapter->xmitpriv;
wait:
ret = _rtw_down_sema(&pxmitpriv->SdioXmitSema);
if (_FAIL == ret) {
DBG_871X_LEVEL(_drv_emerg_, "%s: down sema fail!\n", __FUNCTION__);
return _FAIL;
}
next:
if ((padapter->bDriverStopped == _TRUE) ||
(padapter->bSurpriseRemoved == _TRUE)) {
RT_TRACE(_module_hal_xmit_c_, _drv_notice_,
("%s: bDriverStopped(%d) bSurpriseRemoved(%d)\n",
__FUNCTION__, padapter->bDriverStopped, padapter->bSurpriseRemoved));
return _FAIL;
}
_enter_critical_bh(&pxmitpriv->lock, &irql);
ret = rtw_txframes_pending(padapter);
_exit_critical_bh(&pxmitpriv->lock, &irql);
if (ret == 0) {
if(!padapter->registrypriv.wifi_spec)
rtw_yield_os();
return _SUCCESS;
}
// dequeue frame and write to hardware
ret = xmit_xmitframes(padapter, pxmitpriv);
if (ret == -2) {
//here sleep 1ms will cause big TP loss of TX
//from 50+ to 40+
if(padapter->registrypriv.wifi_spec)
rtw_msleep_os(1);
else
rtw_yield_os();
goto next;
}
_enter_critical_bh(&pxmitpriv->lock, &irql);
ret = rtw_txframes_pending(padapter);
_exit_critical_bh(&pxmitpriv->lock, &irql);
if (ret == 1) {
//rtw_msleep_os(1);
goto next;
}
return _SUCCESS;
}
示例6: MPT_DeInitAdapter
/*-----------------------------------------------------------------------------
* Function: MPT_DeInitAdapter()
*
* Overview: Extra DeInitialization for Mass Production Test.
*
* Input: PADAPTER pAdapter
*
* Output: NONE
*
* Return: NONE
*
* Revised History:
* When Who Remark
* 05/08/2007 MHC Create Version 0.
* 05/18/2007 MHC Add normal driver MPHalt code.
*
*---------------------------------------------------------------------------*/
VOID
MPT_DeInitAdapter(
IN PADAPTER pAdapter
)
{
PMPT_CONTEXT pMptCtx = &pAdapter->mppriv.MptCtx;
pMptCtx->bMptDrvUnload = _TRUE;
#ifdef CONFIG_RTL8723A
_rtw_free_sema(&(pMptCtx->MPh2c_Sema));
_cancel_timer_ex( &pMptCtx->MPh2c_timeout_timer);
rtw_write32(pAdapter, 0xcc, (rtw_read32(pAdapter, 0xcc)& 0xFFFFFFFD)| 0x00000002);
rtw_write32(pAdapter, 0x6b, (rtw_read32(pAdapter, 0x6b)& 0xFFFFFFFB));
rtw_msleep_os(500);
rtw_write32(pAdapter, 0x6b, (rtw_read32(pAdapter, 0x6b)& 0xFFFFFFFB)| 0x00000004);
rtw_write32(pAdapter, 0xcc, (rtw_read32(pAdapter, 0xcc)& 0xFFFFFFFD));
rtw_msleep_os(1000);
DBG_871X("_rtw_mp_xmit_priv reinit for normal mode\n");
_rtw_mp_xmit_priv(&pAdapter->xmitpriv);
#endif
#if 0 // for Windows
PlatformFreeWorkItem( &(pMptCtx->MptWorkItem) );
while(pMptCtx->bMptWorkItemInProgress)
{
if(NdisWaitEvent(&(pMptCtx->MptWorkItemEvent), 50))
{
break;
}
}
NdisFreeSpinLock( &(pMptCtx->MptWorkItemSpinLock) );
#endif
}
示例7: reset_tsf
int reset_tsf(PADAPTER Adapter, u8 reset_port )
{
u8 reset_cnt_before = 0, reset_cnt_after = 0, loop_cnt = 0;
u32 reg_reset_tsf_cnt = (IFACE_PORT0==reset_port) ?
REG_FW_RESET_TSF_CNT_0:REG_FW_RESET_TSF_CNT_1;
rtw_scan_abort(Adapter->pbuddy_adapter); /* site survey will cause reset_tsf fail */
reset_cnt_after = reset_cnt_before = rtw_read8(Adapter,reg_reset_tsf_cnt);
rtl8192d_reset_tsf(Adapter, reset_port);
while ((reset_cnt_after == reset_cnt_before ) && (loop_cnt < 10)) {
rtw_msleep_os(100);
loop_cnt++;
reset_cnt_after = rtw_read8(Adapter, reg_reset_tsf_cnt);
}
return(loop_cnt >= 10) ? _FAIL : _TRUE;
}
示例8: _rtw_mdelay_os
void _rtw_mdelay_os(int ms, const char *func, const int line)
{
#if 0
if(ms>10)
DBG_871X("%s:%d %s(%d)\n", func, line, __FUNCTION__, ms);
rtw_msleep_os(ms);
return;
#endif
DBG_871X("%s:%d %s(%d)\n", func, line, __FUNCTION__, ms);
#if defined(PLATFORM_LINUX)
mdelay((unsigned long)ms);
#endif
}
示例9: _is_fw_read_cmd_down
static u8 _is_fw_read_cmd_down(_adapter* padapter, u8 msgbox_num)
{
u8 read_down = _FALSE;
int retry_cnts = 100;
u8 valid;
//DBG_8192C(" _is_fw_read_cmd_down ,reg_1cc(%x),msg_box(%d)...\n",rtw_read8(padapter,REG_HMETFR),msgbox_num);
do{
valid = rtw_read8(padapter,REG_HMETFR) & BIT(msgbox_num);
if(0 == valid ){
read_down = _TRUE;
}
else
rtw_msleep_os(1);
}while( (!read_down) && (retry_cnts--));
return read_down;
}
示例10: _rtw_mdelay_os
void _rtw_mdelay_os(int ms, const char *func, const int line)
{
if(ms>10)
DBG_871X("%s:%d %s(%d)\n", func, line, __FUNCTION__, ms);
rtw_msleep_os(ms);
return;
DBG_871X("%s:%d %s(%d)\n", func, line, __FUNCTION__, ms);
#if defined(PLATFORM_LINUX)
mdelay((unsigned long)ms);
#elif defined(PLATFORM_WINDOWS)
NdisStallExecution(ms*1000); //(us)*1000=(ms)
#endif
}
示例11: rtw_sdio_wait_enough_TxOQT_space
static u8 rtw_sdio_wait_enough_TxOQT_space(PADAPTER padapter, u8 agg_num)
{
u32 n = 0;
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter);
while (pHalData->SdioTxOQTFreeSpace < agg_num)
{
if ((padapter->bSurpriseRemoved == _TRUE)
|| (padapter->bDriverStopped == _TRUE)
#ifdef CONFIG_CONCURRENT_MODE
||((padapter->pbuddy_adapter)
&& ((padapter->pbuddy_adapter->bSurpriseRemoved) ||(padapter->pbuddy_adapter->bDriverStopped)))
#endif
){
DBG_871X("%s: bSurpriseRemoved or bDriverStopped (wait TxOQT)\n", __func__);
return _FALSE;
}
HalQueryTxOQTBufferStatus8189ESdio(padapter);
if ((++n % 60) == 0) {
if ((n % 300) == 0) {
DBG_871X("%s(%d): QOT free space(%d), agg_num: %d\n",
__func__, n, pHalData->SdioTxOQTFreeSpace, agg_num);
}
rtw_msleep_os(1);
//yield();
}
}
pHalData->SdioTxOQTFreeSpace -= agg_num;
//if (n > 1)
// ++priv->pshare->nr_out_of_txoqt_space;
return _TRUE;
}
示例12: rtl8723bs_query_tx_freepage
static u8 rtl8723bs_query_tx_freepage(_adapter *padapter, struct xmit_buf *pxmitbuf)
{
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter);
struct dvobj_priv *pdvobjpriv = adapter_to_dvobj(padapter);
u8 TxRequiredPageNum = 0;
u8 DedicatedPgNum = 0;
u8 RequiredPublicFreePgNum = 0;
u8 PageIdx = 0;
u8 bResult = _TRUE;
u32 n, deviceId;
TxRequiredPageNum = pxmitbuf->pg_num;
deviceId = ffaddr2deviceId(pdvobjpriv, pxmitbuf->ff_hwaddr);
// translate fifo addr to queue index
switch (deviceId) {
case WLAN_TX_HIQ_DEVICE_ID:
PageIdx = HI_QUEUE_IDX;
break;
case WLAN_TX_MIQ_DEVICE_ID:
PageIdx = MID_QUEUE_IDX;
break;
case WLAN_TX_LOQ_DEVICE_ID:
PageIdx = LOW_QUEUE_IDX;
break;
}
// check if hardware tx fifo page is enough
n = 0;
do {
if ((padapter->bSurpriseRemoved == _TRUE) || (padapter->bDriverStopped == _TRUE)) {
RT_TRACE(_module_hal_xmit_c_, _drv_notice_,
("%s: bSurpriseRemoved(update TX FIFO page)\n", __FUNCTION__));
break;
}
// The number of page which public page is included is available .
if ((pHalData->SdioTxFIFOFreePage[PageIdx]+pHalData->SdioTxFIFOFreePage[PUBLIC_QUEUE_IDX]) > (TxRequiredPageNum+1)) {
DedicatedPgNum = pHalData->SdioTxFIFOFreePage[PageIdx];
if (TxRequiredPageNum <= DedicatedPgNum) {
pHalData->SdioTxFIFOFreePage[PageIdx] -= TxRequiredPageNum;
break;
} else {
pHalData->SdioTxFIFOFreePage[PageIdx] = 0;
RequiredPublicFreePgNum = TxRequiredPageNum - DedicatedPgNum;
pHalData->SdioTxFIFOFreePage[PUBLIC_QUEUE_IDX] -= RequiredPublicFreePgNum;
break;
}
}
n++;
#if 0
if (n >= 5000)
{
u8 reg_value_1 = 0;
u8 reg_value_2 = 0;
u8 reg_value_3 = 0;
//try to recover the transmission
reg_value_1 = rtw_read8(padapter, REG_SYS_FUNC_EN);
reg_value_2 = rtw_read8(padapter, REG_CR);
reg_value_3 = rtw_read8(padapter, REG_TXPAUSE);
DBG_871X("Before recovery: REG_SYS_FUNC_EN = 0x%X, REG_CR = 0x%X, REG_TXPAUSE = 0x%X\n", reg_value_1, reg_value_2, reg_value_3);
rtw_write8(padapter, REG_SYS_FUNC_EN, reg_value_1 | 0x01);
rtw_write8(padapter, REG_CR, reg_value_2 | 0xC0);
rtw_write8(padapter, REG_TXPAUSE, 0);
DBG_871X("After recovery: REG_SYS_FUNC_EN = 0x%X, REG_CR = 0x%X, REG_TXPAUSE = 0x%X\n",
rtw_read8(padapter, REG_SYS_FUNC_EN), rtw_read8(padapter, REG_CR), rtw_read8(padapter, REG_TXPAUSE));
}
#endif
if ((n % 0x7F) == 0) {//or 80
//DBG_871X("%s: FIFO starvation!(%d) len=%d agg=%d page=(R)%d(A)%d\n",
// __func__, n, pxmitbuf->len, pxmitbuf->agg_num, pframe->pg_num, freePage[PageIdx] + freePage[PUBLIC_QUEUE_IDX]);
rtw_msleep_os(1);
}
// Total number of page is NOT available, so update current FIFO status
HalQueryTxBufferStatus8723BSdio(padapter);
} while (1);
return bResult;
}
示例13: rtl8192d_set_wowlan_cmd
void rtl8192d_set_wowlan_cmd(_adapter* padapter)
{
u8 res=_SUCCESS;
u32 test=0;
struct recv_priv *precvpriv = &padapter->recvpriv;
SETWOWLAN_PARM pwowlan_parm;
struct pwrctrl_priv *pwrpriv=&padapter->pwrctrlpriv;
_func_enter_;
pwowlan_parm.mode =0;
pwowlan_parm.gpio_index=0;
pwowlan_parm.gpio_duration=0;
pwowlan_parm.second_mode =0;
pwowlan_parm.reserve=0;
//pause RX DMA
test = rtw_read8(padapter, REG_RXPKT_NUM+2);
test |= BIT(2);
rtw_write8(padapter, REG_RXPKT_NUM+2, test);
//286 BIT(1) , not 1(means idle) do rx urb
test = rtw_read8(padapter, REG_RXPKT_NUM+2) & BIT(1);
//printk("line(%d) 0x286=%d\n", __LINE__, rtw_read8(padapter, REG_RXPKT_NUM+2));
//check DMA idle?
while(test != BIT(1))
{
tasklet_schedule(&precvpriv->recv_tasklet);
test = rtw_read8(padapter, REG_RXPKT_NUM+2) & BIT(1);
rtw_msleep_os(10);
//printk("line(%d) 0x286=%d\n", __LINE__, test);
}
//mask usb se0 reset by Alex and DD
test = rtw_read8(padapter, 0xf8);
test &= ~(BIT(3)|BIT(4));
rtw_write8(padapter, 0xf8, test);
pwowlan_parm.mode |=FW_WOWLAN_FUN_EN;
//printk("\n %s 1.pwowlan_parm.mode=0x%x \n",__FUNCTION__,pwowlan_parm.mode );
if(pwrpriv->wowlan_pattern ==_TRUE){
pwowlan_parm.mode |= FW_WOWLAN_PATTERN_MATCH;
//printk("\n %s 2.pwowlan_parm.mode=0x%x \n",__FUNCTION__,pwowlan_parm.mode );
}
//if(pwrpriv->wowlan_magic ==_TRUE){
//pwowlan_parm.mode |=FW_WOWLAN_MAGIC_PKT;
//printk("\n %s 3.pwowlan_parm.mode=0x%x \n",__FUNCTION__,pwowlan_parm.mode );
//}
if(pwrpriv->wowlan_unicast ==_TRUE){
pwowlan_parm.mode |=FW_WOWLAN_UNICAST;
//printk("\n %s 4.pwowlan_parm.mode=0x%x \n",__FUNCTION__,pwowlan_parm.mode );
}
rtl8192d_set_FwJoinBssReport_cmd(padapter, 1);
//WOWLAN_GPIO_ACTIVE means GPIO high active
//pwowlan_parm.mode |=FW_WOWLAN_GPIO_ACTIVE;
pwowlan_parm.mode |=FW_WOWLAN_REKEY_WAKEUP;
pwowlan_parm.mode |=FW_WOWLAN_DEAUTH_WAKEUP;
//GPIO 0
pwowlan_parm.gpio_index=0;
//duration unit is 64us
pwowlan_parm.gpio_duration=0xff;
pwowlan_parm.second_mode|=FW_WOWLAN_GPIO_WAKEUP_EN;
pwowlan_parm.second_mode|=FW_FW_PARSE_MAGIC_PKT;
//printk("\n %s 5.pwowlan_parm.mode=0x%x \n",__FUNCTION__,pwowlan_parm.mode );
{ u8 *ptr=(u8 *)&pwowlan_parm;
printk("\n %s H2C_WO_WLAN=%x %02x:%02x:%02x:%02x:%02x \n",__FUNCTION__,H2C_WO_WLAN_CMD,ptr[0],ptr[1],ptr[2],ptr[3],ptr[4] );
}
FillH2CCmd92D(padapter, H2C_WO_WLAN_CMD, 4, (u8 *)&pwowlan_parm);
//keep alive period = 3 * 10 BCN interval
pwowlan_parm.mode =3;
pwowlan_parm.gpio_index=3;
FillH2CCmd92D(padapter, KEEP_ALIVE_CONTROL_CMD, 2, (u8 *)&pwowlan_parm);
printk("%s after KEEP_ALIVE_CONTROL_CMD register 0x81=%x \n",__FUNCTION__,rtw_read8(padapter, 0x85));
pwowlan_parm.mode =1;
pwowlan_parm.gpio_index=0;
pwowlan_parm.gpio_duration=0;
FillH2CCmd92D(padapter, DISCONNECT_DECISION_CTRL_CMD, 3, (u8 *)&pwowlan_parm);
printk("%s after DISCONNECT_DECISION_CTRL_CMD register 0x81=%x \n",__FUNCTION__,rtw_read8(padapter, 0x85));
//enable GPIO wakeup
pwowlan_parm.mode =1;
pwowlan_parm.gpio_index=0;
pwowlan_parm.gpio_duration=0;
FillH2CCmd92D(padapter, REMOTE_WAKE_CTRL_CMD, 1, (u8 *)&pwowlan_parm);
printk("%s after DISCONNECT_DECISION_CTRL_CMD register \n",__FUNCTION__);
_func_exit_;
return ;
}
示例14: rtw_gspi_suspend
static int rtw_gspi_suspend(struct spi_device *spi, pm_message_t mesg)
{
struct dvobj_priv *dvobj = spi_get_drvdata(spi);
PADAPTER padapter = dvobj->if1;
struct pwrctrl_priv *pwrpriv = &padapter->pwrctrlpriv;
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
struct net_device *pnetdev = padapter->pnetdev;
int ret = 0;
u32 start_time = rtw_get_current_time();
_func_enter_;
DBG_871X("==> %s (%s:%d)\n",__FUNCTION__, current->comm, current->pid);
pwrpriv->bInSuspend = _TRUE;
while (pwrpriv->bips_processing == _TRUE)
rtw_msleep_os(1);
if((!padapter->bup) || (padapter->bDriverStopped)||(padapter->bSurpriseRemoved))
{
DBG_871X("%s bup=%d bDriverStopped=%d bSurpriseRemoved = %d\n", __FUNCTION__
,padapter->bup, padapter->bDriverStopped,padapter->bSurpriseRemoved);
goto exit;
}
rtw_cancel_all_timer(padapter);
LeaveAllPowerSaveMode(padapter);
//padapter->net_closed = _TRUE;
//s1.
if(pnetdev)
{
netif_carrier_off(pnetdev);
rtw_netif_stop_queue(pnetdev);
}
#ifdef CONFIG_WOWLAN
padapter->pwrctrlpriv.bSupportRemoteWakeup=_TRUE;
#else
//s2.
//s2-1. issue rtw_disassoc_cmd to fw
disconnect_hdl(padapter, NULL);
//rtw_disassoc_cmd(padapter);
#endif
#ifdef CONFIG_LAYER2_ROAMING_RESUME
if(check_fwstate(pmlmepriv, WIFI_STATION_STATE) && check_fwstate(pmlmepriv, _FW_LINKED) )
{
DBG_871X("%s %s(" MAC_FMT "), length:%d assoc_ssid.length:%d\n",__FUNCTION__,
pmlmepriv->cur_network.network.Ssid.Ssid,
MAC_ARG(pmlmepriv->cur_network.network.MacAddress),
pmlmepriv->cur_network.network.Ssid.SsidLength,
pmlmepriv->assoc_ssid.SsidLength);
pmlmepriv->to_roaming = 1;
}
#endif
//s2-2. indicate disconnect to os
rtw_indicate_disconnect(padapter);
//s2-3.
rtw_free_assoc_resources(padapter, 1);
//s2-4.
rtw_free_network_queue(padapter, _TRUE);
rtw_led_control(padapter, LED_CTL_POWER_OFF);
rtw_dev_unload(padapter);
if(check_fwstate(pmlmepriv, _FW_UNDER_SURVEY))
rtw_indicate_scan_done(padapter, 1);
if(check_fwstate(pmlmepriv, _FW_UNDER_LINKING))
rtw_indicate_disconnect(padapter);
// interface deinit
gspi_deinit(dvobj);
RT_TRACE(_module_hci_intfs_c_, _drv_notice_, ("%s: deinit GSPI complete!\n", __FUNCTION__));
rtw_wifi_gpio_wlan_ctrl(WLAN_PWDN_OFF);
rtw_mdelay_os(1);
exit:
DBG_871X("<=== %s return %d.............. in %dms\n", __FUNCTION__
, ret, rtw_get_passing_time_ms(start_time));
_func_exit_;
return ret;
}
示例15: _rtw_pwr_wakeup
/*
* rtw_pwr_wakeup - Wake the NIC up from: 1)IPS. 2)USB autosuspend
* @adapter: pointer to _adapter structure
* @ips_deffer_ms: the ms wiil prevent from falling into IPS after wakeup
* Return _SUCCESS or _FAIL
*/
int _rtw_pwr_wakeup(struct rtw_adapter *padapter, u32 ips_deffer_ms,
const char *caller)
{
struct pwrctrl_priv *pwrpriv = &padapter->pwrctrlpriv;
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
int ret = _SUCCESS;
u32 start = rtw_get_current_time();
#ifdef CONFIG_CONCURRENT_MODE
if (padapter->pbuddy_adapter)
LeaveAllPowerSaveMode(padapter->pbuddy_adapter);
if ((padapter->isprimary == false) && padapter->pbuddy_adapter) {
padapter = padapter->pbuddy_adapter;
pwrpriv = &padapter->pwrctrlpriv;
pmlmepriv = &padapter->mlmepriv;
}
#endif
if (pwrpriv->ips_deny_time <
rtw_get_current_time() + rtw_ms_to_systime(ips_deffer_ms))
pwrpriv->ips_deny_time =
rtw_get_current_time() + rtw_ms_to_systime(ips_deffer_ms);
if (pwrpriv->ps_processing) {
DBG_8192D("%s wait ps_processing...\n", __func__);
while (pwrpriv->ps_processing &&
rtw_get_passing_time_ms(start) <= 3000)
rtw_msleep_os(10);
if (pwrpriv->ps_processing)
DBG_8192D("%s wait ps_processing timeout\n", __func__);
else
DBG_8192D("%s wait ps_processing done\n", __func__);
}
if (pwrpriv->bInternalAutoSuspend == false && pwrpriv->bInSuspend) {
DBG_8192D("%s wait bInSuspend...\n", __func__);
while (pwrpriv->bInSuspend &&
((rtw_get_passing_time_ms(start) <= 3000 &&
!rtw_is_do_late_resume(pwrpriv)) ||
(rtw_get_passing_time_ms(start) <= 500 &&
rtw_is_do_late_resume(pwrpriv)))) {
rtw_msleep_os(10);
}
if (pwrpriv->bInSuspend)
DBG_8192D("%s wait bInSuspend timeout\n", __func__);
else
DBG_8192D("%s wait bInSuspend done\n", __func__);
}
/* System suspend is not allowed to wakeup */
if ((pwrpriv->bInternalAutoSuspend == false) &&
(true == pwrpriv->bInSuspend)) {
ret = _FAIL;
goto exit;
}
/* block??? */
if ((pwrpriv->bInternalAutoSuspend == true) &&
(padapter->net_closed == true)) {
ret = _FAIL;
goto exit;
}
/* I think this should be check in IPS, LPS, autosuspend functions... */
if (check_fwstate(pmlmepriv, _FW_LINKED) == true) {
ret = _SUCCESS;
goto exit;
}
if (rf_off == pwrpriv->rf_pwrstate) {
#ifdef CONFIG_AUTOSUSPEND
if (pwrpriv->brfoffbyhw == true) {
DBG_8192D("hw still in rf_off state ...........\n");
ret = _FAIL;
goto exit;
} else if (padapter->registrypriv.usbss_enable) {
DBG_8192D("%s call autoresume_enter....\n", __func__);
if (_FAIL == autoresume_enter(padapter)) {
DBG_8192D
("======> autoresume fail.............\n");
ret = _FAIL;
goto exit;
}
} else
#endif
{
#ifdef CONFIG_IPS
DBG_8192D("%s call ips_leave....\n", __func__);
if (_FAIL == ips_leave(padapter)) {
DBG_8192D
("======> ips_leave fail.............\n");
ret = _FAIL;
goto exit;
//.........这里部分代码省略.........