void setassocsta_cmdrsp_callback(_adapter* padapter, struct cmd_obj *pcmd) { _irqL irqL; struct sta_priv * pstapriv = &padapter->stapriv; struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct set_assocsta_parm* passocsta_parm = (struct set_assocsta_parm*)(pcmd->parmbuf); struct set_assocsta_rsp* passocsta_rsp = (struct set_assocsta_rsp*) (pcmd->rsp); struct sta_info* psta = get_stainfo(pstapriv, passocsta_parm->addr); _func_enter_; if(psta==NULL) { RT_TRACE(_module_rtl871x_cmd_c_,_drv_err_,("\nERROR: setassocsta_cmdrsp_callbac => can't get sta_info \n\n")); goto exit; } psta->aid = psta->mac_id = passocsta_rsp->cam_id; _enter_critical(&(pmlmepriv->lock), &irqL); if ((check_fwstate(pmlmepriv, WIFI_MP_STATE) == _TRUE) && (check_fwstate(pmlmepriv, _FW_UNDER_LINKING) == _TRUE)) pmlmepriv->fw_state ^= _FW_UNDER_LINKING; set_fwstate(pmlmepriv, _FW_LINKED); _exit_critical(&(pmlmepriv->lock), &irqL); free_cmd_obj(pcmd); exit: _func_exit_; }
// this function is used to free the memory of lock || sema for all stainfos void mfree_all_stainfo(struct sta_priv *pstapriv ) { _irqL irqL; _list *plist, *phead; struct sta_info *psta = NULL; _func_enter_; _enter_critical(&pstapriv->sta_hash_lock, &irqL); phead = get_list_head(&pstapriv->free_sta_queue); plist = get_next(phead); while ((end_of_queue_search(phead, plist)) == _FALSE) { psta = LIST_CONTAINOR(plist, struct sta_info ,list); plist = get_next(plist); mfree_stainfo(psta); } _exit_critical(&pstapriv->sta_hash_lock, &irqL); _func_exit_; }
s32 rtw_free_xmitbuf(PADAPTER padapter, struct xmit_buf *pxmitbuf) { _irqL irqL; _queue *queue = NULL; struct xmit_priv *pxmitpriv = &padapter->xmitpriv; _func_enter_; queue = &pxmitpriv->free_xmit_queue; if (pxmitbuf == NULL) { DBG_871X("======rtw_free_xmitbuf():pxmitbuf==NULL!!!!!!!!!!\n"); goto exit; } _enter_critical(&queue->lock, &irqL); rtw_list_delete(&pxmitbuf->list); rtw_list_insert_tail(&pxmitbuf->list, get_list_head(queue)); pxmitpriv->free_xmitbuf_cnt++; #ifdef DBG_XMIT_BUF DBG_871X("DBG_XMIT_BUF FREE no=%d, free_xmitbuf_cnt=%d\n",pxmitbuf->no ,pxmitpriv->free_xmitbuf_cnt); #endif _exit_critical(&queue->lock, &irqL); exit: _func_exit_; return _SUCCESS; }
void _al_win_mouse_handle_button(HWND hwnd, int button, BOOL down, int x, int y, BOOL abs) { int last_mouse_b; _enter_critical(); if (down) _mouse_b |= (1 << (button-1)); else _mouse_b &= ~(1 << (button-1)); last_mouse_b = _mouse_b; _exit_critical(); #if 0 /* Aseprite: We handle mouse capture in the she and ui layers */ /* If there is a mouse button pressed we capture the mouse, in any other cases we release it. */ if (last_mouse_b) { if (GetCapture() != hwnd) SetCapture(hwnd); } else { if (GetCapture() == hwnd) ReleaseCapture(); } #endif _handle_mouse_input(); }
s32 rtl8192de_enqueue_xmitbuf(struct rtw_tx_ring *ring, struct xmit_buf *pxmitbuf) { _irqL irqL; _queue *ppending_queue = &ring->queue; _func_enter_; //DBG_8192C("+enqueue_xmitbuf\n"); if(pxmitbuf==NULL) { return _FAIL; } _enter_critical(&ppending_queue->lock, &irqL); rtw_list_delete(&pxmitbuf->list); rtw_list_insert_tail(&(pxmitbuf->list), get_list_head(ppending_queue)); ring->qlen++; //DBG_8192C("FREE, free_xmitbuf_cnt=%d\n", pxmitpriv->free_xmitbuf_cnt); _exit_critical(&ppending_queue->lock, &irqL); _func_exit_; return _SUCCESS; }
struct xmit_buf * rtl8192de_dequeue_xmitbuf(struct rtw_tx_ring *ring) { _irqL irqL; _list *plist, *phead; struct xmit_buf *pxmitbuf = NULL; _queue *ppending_queue = &ring->queue; _func_enter_; _enter_critical(&ppending_queue->lock, &irqL); if(_rtw_queue_empty(ppending_queue) == _TRUE) { pxmitbuf = NULL; } else { phead = get_list_head(ppending_queue); plist = get_next(phead); pxmitbuf = LIST_CONTAINOR(plist, struct xmit_buf, list); rtw_list_delete(&(pxmitbuf->list)); } ring->qlen--; _exit_critical(&ppending_queue->lock, &irqL); _func_exit_; return pxmitbuf; }
sint enqueue_recvframe(union recv_frame *precvframe, _queue *queue) { _irqL irqL; _adapter *padapter=precvframe->u.hdr.adapter; struct recv_priv *precvpriv = &padapter->recvpriv; _func_enter_; //_spinlock(&pfree_recv_queue->lock); _enter_critical(&queue->lock, &irqL); //_init_listhead(&(precvframe->u.hdr.list)); list_delete(&(precvframe->u.hdr.list)); list_insert_tail(&(precvframe->u.hdr.list), get_list_head(queue)); if(padapter !=NULL){ if(queue == &precvpriv->free_recv_queue) precvpriv->free_recvframe_cnt++; } //_spinunlock(&pfree_recv_queue->lock); _exit_critical(&queue->lock, &irqL); _func_exit_; return _SUCCESS; }
void disassoc_cmd_callback(_adapter* padapter, struct cmd_obj *pcmd) { _irqL irqL; struct mlme_priv *pmlmepriv = &padapter->mlmepriv; _func_enter_; if((pcmd->res != H2C_SUCCESS)) { _enter_critical(&pmlmepriv->lock, &irqL); set_fwstate(pmlmepriv, _FW_LINKED); _exit_critical(&pmlmepriv->lock, &irqL); RT_TRACE(_module_rtl871x_cmd_c_,_drv_err_,("\n ***Error: disconnect_cmd_callback Fail ***\n.")); goto exit; } // free cmd free_cmd_obj(pcmd); exit: _func_exit_; }
u32 enqueue_cmd_ex(struct cmd_priv *pcmdpriv, struct cmd_obj *obj) { _irqL irqL; _queue *queue; _func_enter_; if (obj == NULL) goto exit; if(pcmdpriv->padapter->eeprompriv.bautoload_fail_flag==_TRUE) { return _FAIL; } queue = &(pcmdpriv->cmd_queue); _enter_critical(&(queue->lock), &irqL); list_insert_tail(&(obj->list), &(queue->queue)); _exit_critical(&(queue->lock), &irqL); _up_sema(&pcmdpriv->cmd_queue_sema); exit: _func_exit_; return _SUCCESS; }
/* mouse_winapi_set_speed: [primary thread] */ static void mouse_winapi_set_speed(int xspeed, int yspeed) { _enter_critical(); CLEAR_MICKEYS(); _exit_critical(); }
void free_txirp(_adapter *padapter, struct txirp *irp) { unsigned int flags; struct mib_info *pmibinfo = &(padapter->_sys_mib); _enter_critical(&(pmibinfo->free_txirp_mgt_lock), &flags); list_insert_tail(&(irp->list), &(pmibinfo->free_txirp_mgt)); _exit_critical(&(pmibinfo->free_txirp_mgt_lock), &flags); }
void _al_win_mouse_handle_wheel(HWND hwnd, int z, BOOL abs) { _enter_critical(); _mouse_z += z; _exit_critical(); _handle_mouse_input(); }
/* gfx_gdi_init: */ static struct BITMAP *gfx_gdi_init(int w, int h, int v_w, int v_h, int color_depth) { /* virtual screen are not supported */ if ((v_w!=0 && v_w!=w) || (v_h!=0 && v_h!=h)) return NULL; _enter_critical(); gfx_gdi.w = w; gfx_gdi.h = h; if (adjust_window(w, h) != 0) { _TRACE(PREFIX_E "window size not supported.\n"); ustrzcpy(allegro_error, ALLEGRO_ERROR_SIZE, get_config_text("Resolution not supported")); goto Error; } /* the last flag serves as an end of loop delimiter */ gdi_dirty_lines = _AL_MALLOC_ATOMIC((h+1) * sizeof(char)); ASSERT(gdi_dirty_lines); memset(gdi_dirty_lines, 0, (h+1) * sizeof(char)); gdi_dirty_lines[h] = 1; /* create the screen surface */ screen_surf = _AL_MALLOC_ATOMIC(w * h * BYTES_PER_PIXEL(color_depth)); gdi_screen = _make_bitmap(w, h, (unsigned long)screen_surf, &gfx_gdi, color_depth, w * BYTES_PER_PIXEL(color_depth)); gdi_screen->write_bank = gfx_gdi_write_bank; _screen_vtable.acquire = gfx_gdi_lock; _screen_vtable.release = gfx_gdi_unlock; _screen_vtable.unwrite_bank = gfx_gdi_unwrite_bank; /* create render timer */ vsync_event = CreateEvent(NULL, FALSE, FALSE, NULL); install_int(render_proc, RENDER_DELAY); /* connect to the system driver */ win_gfx_driver = &win_gfx_driver_gdi; /* set the default switching policy */ set_display_switch_mode(SWITCH_PAUSE); /* grab input devices */ win_grab_input(); _exit_critical(); return gdi_screen; Error: _exit_critical(); gfx_gdi_exit(NULL); return NULL; }
void free_rxirp(struct rxirp *irp) { unsigned int flags; _adapter *padapter = irp->adapter; struct mib_info *pmibinfo = &(padapter->_sys_mib); _enter_critical(&(pmibinfo->free_rxirp_mgt_lock), &flags); list_insert_tail(&(irp->list), &(pmibinfo->free_rxirp_mgt)); memset((u8*)irp->rxbuf_phyaddr, 0 , RXMGTBUF_SZ); irp->rx_len = 0; _exit_critical(&(pmibinfo->free_rxirp_mgt_lock), &flags); }
void pnp_sleep_wk(void *context) { _irqL irqL; _adapter *padapter = (_adapter *)context; struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct pwrctrl_priv *pwrctrl = &padapter->pwrctrlpriv; RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_info_,("pnp_sleep_wk ===>\n")); _enter_critical(&pmlmepriv->lock, &irqL ); if(check_fwstate(pmlmepriv, _FW_LINKED)== _TRUE) { indicate_disconnect(padapter); //will clr Linked_state; before this function, we must have chked whether issue dis-assoc_cmd or not free_assoc_resources(padapter); #ifndef CONFIG_POWER_DOWN_MODE disassoc_cmd(padapter); #endif } _exit_critical(&pmlmepriv->lock, &irqL ); RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_info_,("pnp_sleep_wk:fwstate:%d\n", pmlmepriv->fw_state)); #ifdef CONFIG_POWER_DOWN_MODE //before enter powerdown mode, we must ensure FW in S4 state. if (padapter->pwrctrlpriv.pwr_mode > PS_MODE_ACTIVE) { padapter->pwrctrlpriv.pwr_mode = PS_MODE_ACTIVE; _enter_pwrlock(&(padapter->pwrctrlpriv.lock)); set_rpwm(padapter, PS_STATE_S4); _exit_pwrlock(&(padapter->pwrctrlpriv.lock)); } while (pwrctrl->cpwm != PS_STATE_S4) { //waiting FW to become ACTIVE. msleep_os(10); } #endif write16(padapter, SDIO_HIMR, 0); pwrctrl->pnp_bstop_trx = _TRUE; padapter->hw_init_completed = _FALSE; NdisMSetInformationComplete(padapter->hndis_adapter, NDIS_STATUS_SUCCESS); RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_info_,("pnp_sleep_wk <===\n")); }
/* mouse_directx_set_speed: [primary thread] */ static void mouse_directx_set_speed(int xspeed, int yspeed) { _enter_critical(); mouse_sx = MAX(1, xspeed); mouse_sy = MAX(1, yspeed); mouse_mx = COORD_TO_MICKEY_X(_mouse_x); mouse_my = COORD_TO_MICKEY_Y(_mouse_y); CLEAR_MICKEYS(); _exit_critical(); }
/* init_directx_safe: * Initializes the DirectDraw fullscreen safe driver. */ static struct BITMAP *init_directx_safe(int w, int h, int v_w, int v_h, int color_depth) { struct BITMAP *bmp; _enter_critical(); bmp = gfx_directx_init(&gfx_directx_safe, w, h, v_w, v_h, color_depth); if (bmp) finalize_fullscreen_init(); _exit_critical(); return bmp; }
struct xmit_buf *rtw_alloc_xmitbuf(PADAPTER padapter)//(_queue *pfree_xmit_queue) { /* Please remember to use all the osdep_service api, and lock/unlock or _enter/_exit critical to protect pfree_xmit_queue */ _irqL irqL; struct xmit_buf *pxmitbuf = NULL; struct xmit_priv *pxmitpriv = &padapter->xmitpriv; _list *plist, *phead; _queue *pfree_xmit_queue = &pxmitpriv->free_xmit_queue; _func_enter_; _enter_critical(&pfree_xmit_queue->lock, &irqL); if (_rtw_queue_empty(pfree_xmit_queue) == _TRUE) { DBG_871X("rtw_alloc_xmitbuf failed!\n"); pxmitbuf= NULL; } else { phead = get_list_head(pfree_xmit_queue); plist = get_next(phead); pxmitbuf = LIST_CONTAINOR(plist, struct xmit_buf, list); rtw_list_delete(&(pxmitbuf->list)); } if(pxmitbuf){ pxmitpriv->free_xmitbuf_cnt--; #ifdef DBG_XMIT_BUF DBG_871X("DBG_XMIT_BUF ALLOC no=%d, free_xmitbuf_cnt=%d\n",pxmitbuf->no, pxmitpriv->free_xmitbuf_cnt); #endif #if defined(CONFIG_SDIO_HCI) || defined(CONFIG_GSPI_HCI) pxmitbuf->pkt_len = 0; pxmitbuf->pdata = pxmitbuf->ptail = pxmitbuf->phead; #endif } _exit_critical(&pfree_xmit_queue->lock, &irqL); _func_exit_; return pxmitbuf; }
/* mouse_winapi_set_range: [primary thread] */ static void mouse_winapi_set_range(int x1, int y1, int x2, int y2) { mouse_minx = x1; mouse_miny = y1; mouse_maxx = x2; mouse_maxy = y2; _enter_critical(); _mouse_x = CLAMP(mouse_minx, _mouse_x, mouse_maxx); _mouse_y = CLAMP(mouse_miny, _mouse_y, mouse_maxy); CLEAR_MICKEYS(); _exit_critical(); }
/* mouse_winapi_position: [primary thread] */ static void mouse_winapi_position(int x, int y) { _enter_critical(); _mouse_x = x; _mouse_y = y; if (gfx_driver && gfx_driver->windowed) SetCursorPos(x+wnd_x, y+wnd_y); CLEAR_MICKEYS(); mymickey_x = mymickey_y = 0; _exit_critical(); }
/* gfx_gdi_exit: */ static void gfx_gdi_exit(struct BITMAP *bmp) { _enter_critical(); _enter_gfx_critical(); if (bmp) { save_window_pos(); clear_bitmap(bmp); } /* stop timer */ remove_int(render_proc); CloseHandle(vsync_event); /* disconnect from the system driver */ win_gfx_driver = NULL; /* destroy dirty lines array */ _AL_FREE(gdi_dirty_lines); gdi_dirty_lines = NULL; /* destroy screen surface */ _AL_FREE(screen_surf); gdi_screen = NULL; /* destroy mouse bitmaps */ if (wgdi_mouse_sprite) { destroy_bitmap(wgdi_mouse_sprite); wgdi_mouse_sprite = NULL; destroy_bitmap(mouse_frontbuffer); mouse_frontbuffer = NULL; destroy_bitmap(mouse_backbuffer); mouse_backbuffer = NULL; } _exit_gfx_critical(); /* before restoring video mode, hide window */ set_display_switch_mode(SWITCH_PAUSE); system_driver->restore_console_state(); restore_window_style(); _exit_critical(); }
u8 set_802_11_bssid_list_scan(_adapter *padapter) { struct mlme_priv *pmlmepriv = NULL; _irqL irqL; u8 ret = _TRUE; _func_enter_; if (padapter == NULL) { ret = _FALSE; goto exit; } pmlmepriv = &padapter->mlmepriv; RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_notice_, ("+set_802_11_bssid_list_scan: fw_state=0x%08x\n", get_fwstate(pmlmepriv))); if (padapter->hw_init_completed == _FALSE) { ret = _FALSE; RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_err_,("!set_802_11_bssid_list_scan: hw_init_completed==_FALSE\n")); goto exit; } _enter_critical(&pmlmepriv->lock, &irqL); if ((check_fwstate(pmlmepriv, _FW_UNDER_SURVEY|_FW_UNDER_LINKING) == _TRUE) || (pmlmepriv->sitesurveyctrl.traffic_busy == _TRUE)) { // Scan or linking is in progress, do nothing. ret = (u8)check_fwstate(pmlmepriv, _FW_UNDER_SURVEY); RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_err_, ("!set_802_11_bssid_list_scan: FAIL! fw_state=0x%08x, busy=%d, ret=%d\n", pmlmepriv->fw_state, pmlmepriv->sitesurveyctrl.traffic_busy, ret)); } else { free_network_queue(padapter); RT_TRACE(_module_rtl871x_cmd_c_, _drv_notice_, ("set_802_11_bssid_list_scan: flush network queue\n")); ret = sitesurvey_cmd(padapter, NULL); } _exit_critical(&pmlmepriv->lock, &irqL); exit: _func_exit_; return ret; }
/* init_directx_soft: * Initializes the DirectDraw fullscreen software-only driver. */ static struct BITMAP *init_directx_soft(int w, int h, int v_w, int v_h, int color_depth) { struct BITMAP *bmp; _enter_critical(); bmp = gfx_directx_init(&gfx_directx_soft, w, h, v_w, v_h, color_depth); if (bmp) { gfx_directx_enable_triple_buffering(&gfx_directx_soft); finalize_fullscreen_init(); } _exit_critical(); return bmp; }
/* any station allocated can be searched by hash list */ struct sta_info *get_stainfo(struct sta_priv *pstapriv, u8 *hwaddr) { _irqL irqL; _list *plist, *phead; struct sta_info *psta = NULL; u32 index; _func_enter_; if(hwaddr==NULL) return NULL; index = wifi_mac_hash(hwaddr); //_enter_critical_bh(&pstapriv->sta_hash_lock, &irqL); _enter_critical(&pstapriv->sta_hash_lock, &irqL); phead = &(pstapriv->sta_hash[index]); plist = get_next(phead); while ((end_of_queue_search(phead, plist)) == _FALSE) { psta = LIST_CONTAINOR(plist, struct sta_info, hash_list); if ((_memcmp(psta->hwaddr,hwaddr, ETH_ALEN))== _TRUE) { // if found the matched address break; } psta=NULL; plist = get_next(plist); } //_exit_critical_bh(&pstapriv->sta_hash_lock, &irqL); _exit_critical(&pstapriv->sta_hash_lock, &irqL); _func_exit_; return psta; }
/* Must use critical section to protect alloc_ioreq and free_ioreq, due to the irq level possibilities of the callers. This is to guarantee the atomic context of the service. */ struct io_req *alloc_ioreq(struct io_queue *pio_q) { _irqL irqL; _list *phead = &pio_q->free_ioreqs; struct io_req *preq = NULL; _func_enter_; _enter_critical(&pio_q->lock, &irqL); if (is_list_empty(phead) == _FALSE) { preq = LIST_CONTAINOR(get_next(phead), struct io_req, list); list_delete(&preq->list); //_memset((u8 *)preq, 0, sizeof(struct io_req));//!!! _init_listhead(&preq->list); _init_sema(&preq->sema, 0); }
// free all stainfo which in sta_hash[all] void free_all_stainfo(_adapter *padapter) { _irqL irqL; _list *plist, *phead; s32 index; struct sta_info *psta = NULL; struct sta_priv *pstapriv = &padapter->stapriv; struct sta_info* pbcmc_stainfo =get_bcmc_stainfo( padapter); _func_enter_; if(pstapriv->asoc_sta_count==1) goto exit; _enter_critical(&pstapriv->sta_hash_lock, &irqL); for(index=0; index< NUM_STA; index++) { phead = &(pstapriv->sta_hash[index]); plist = get_next(phead); while ((end_of_queue_search(phead, plist)) == _FALSE) { psta = LIST_CONTAINOR(plist, struct sta_info ,hash_list); plist = get_next(plist); if(pbcmc_stainfo!=psta) free_stainfo(padapter , psta); } } _exit_critical(&pstapriv->sta_hash_lock, &irqL); exit: _func_exit_; }
/* mouse_directx_position: [primary thread] */ static void mouse_directx_position(int x, int y) { _enter_critical(); _mouse_x = x; _mouse_y = y; mouse_mx = COORD_TO_MICKEY_X(x); mouse_my = COORD_TO_MICKEY_Y(y); if (gfx_driver && gfx_driver->windowed) SetCursorPos(x+wnd_x, y+wnd_y); CLEAR_MICKEYS(); mymickey_x = mymickey_y = 0; /* force mouse update */ SetEvent(mouse_input_event); _exit_critical(); }
/* 0 struct list_head free_txirp_mgt; 1 struct list_head free_txirp_small; 2 struct list_head free_txirp_medium; 3 struct list_head free_txirp_large; */ struct txirp *alloc_txirp(_adapter *padapter) { _irqL flags; struct txirp *irp = NULL; struct mib_info *pmibinfo = &(padapter->_sys_mib); _list *head = &(pmibinfo->free_txirp_mgt); _enter_critical(&(pmibinfo->free_txirp_mgt_lock), &flags); if(is_list_empty(head)==_TRUE) goto ret; irp = LIST_CONTAINOR(head->next, struct txirp, list); list_delete(head->next); memset( (u8*)irp->txbuf_phyaddr, 0, TXMGTBUF_SZ); irp->tx_len = 0; ret: _exit_critical(&(pmibinfo->free_txirp_mgt_lock), &flags); return irp; }
union recv_frame *alloc_recvframe (_queue *pfree_recv_queue) { _irqL irqL; union recv_frame *precvframe; _list *plist, *phead; _adapter *padapter; struct recv_priv *precvpriv; _func_enter_; _enter_critical(&pfree_recv_queue->lock, &irqL); if(_queue_empty(pfree_recv_queue) == _TRUE) { precvframe = NULL; } else { phead = get_list_head(pfree_recv_queue); plist = get_next(phead); precvframe = LIST_CONTAINOR(plist, union recv_frame, u); list_delete(&precvframe->u.hdr.list); padapter=precvframe->u.hdr.adapter; if(padapter !=NULL){ precvpriv=&padapter->recvpriv; if(pfree_recv_queue == &precvpriv->free_recv_queue) precvpriv->free_recvframe_cnt--; } } _exit_critical(&pfree_recv_queue->lock, &irqL); _func_exit_; return precvframe; }
/* mouse_directx_set_range: [primary thread] */ static void mouse_directx_set_range(int x1, int y1, int x2, int y2) { mouse_minx = x1; mouse_miny = y1; mouse_maxx = x2; mouse_maxy = y2; _enter_critical(); _mouse_x = MID(mouse_minx, _mouse_x, mouse_maxx); _mouse_y = MID(mouse_miny, _mouse_y, mouse_maxy); mouse_mx = COORD_TO_MICKEY_X(_mouse_x); mouse_my = COORD_TO_MICKEY_Y(_mouse_y); CLEAR_MICKEYS(); _exit_critical(); /* scale up the acceleration multiplier to the range */ mouse_accel_mult = mouse_accel_fact * MAX(x2-x1+1, y2-y1+1)/320; }