Ejemplo n.º 1
0
sint _init_evt_priv(struct evt_priv *pevtpriv)
{
	sint res=_SUCCESS;

_func_enter_;		
#ifdef CONFIG_EVENT_THREAD_MODE
	_init_sema(&(pevtpriv->evt_notify), 0);
	_init_sema(&(pevtpriv->terminate_evtthread_sema), 0);
#endif
#ifdef CONFIG_H2CLBK
	_init_sema(&(pevtpriv->lbkevt_done), 0);
	pevtpriv->lbkevt_limit = 0;
	pevtpriv->lbkevt_num = 0;
	pevtpriv->cmdevt_parm = NULL;		
#endif		
	
	//allocate DMA-able/Non-Page memory for cmd_buf and rsp_buf
	pevtpriv->event_seq = 0;
	pevtpriv->evt_allocated_buf = _malloc(MAX_EVTSZ + 4);
	
	if (pevtpriv->evt_allocated_buf == NULL){
		res= _FAIL;
		goto exit;
		}
	pevtpriv->evt_buf = pevtpriv->evt_allocated_buf  +  4 - ((unsigned int)(pevtpriv->evt_allocated_buf) & 3);
	
	pevtpriv->evt_done_cnt = 0;	
#ifdef CONFIG_SDIO_HCI
	pevtpriv->allocated_c2h_mem = _malloc(C2H_MEM_SZ +4); 
	
	if (pevtpriv->allocated_c2h_mem == NULL){
		res= _FAIL;
		goto exit;
	}

	pevtpriv->c2h_mem = pevtpriv->allocated_c2h_mem +  4\
	- ( (u32)(pevtpriv->allocated_c2h_mem) & 3);
#ifdef PLATFORM_OS_XP
	pevtpriv->pc2h_mdl= IoAllocateMdl((u8 *)pevtpriv->c2h_mem, C2H_MEM_SZ , FALSE, FALSE, NULL);
	
	if(pevtpriv->pc2h_mdl == NULL){
		res= _FAIL;
		goto exit;
	}
	MmBuildMdlForNonPagedPool(pevtpriv->pc2h_mdl);
#endif
#endif

exit:	

#ifdef CONFIG_RECV_BH

	_init_queue(&(pevtpriv->evt_queue));

#endif

_func_exit_;	  	 

	return res;
}
Ejemplo n.º 2
0
uint usb_init_intf_priv(struct intf_priv *pintfpriv)
{
_func_enter_;
	
	//pintfpriv->intf_status = _IOREADY;

	//_init_timer(&pintfpriv->io_timer, padapter->pnetdev, io_irp_timeout_handler, pintfpriv);
	
	pintfpriv->piorw_urb = usb_alloc_urb(0, GFP_ATOMIC);	
	if(pintfpriv->piorw_urb==NULL)
	{		
		RT_TRACE(_module_hci_ops_os_c_,_drv_err_,("pintfpriv->piorw_urb==NULL!!!\n"));
		goto usb_init_intf_priv_fail;
	}	
	
	_init_sema(&(pintfpriv->io_retevt), 0);

_func_exit_;

	return _SUCCESS;

usb_init_intf_priv_fail:

	if(pintfpriv->piorw_urb)
	{
		usb_free_urb(pintfpriv->piorw_urb);
	}	

_func_exit_;

	return _FAIL;
		
}
Ejemplo n.º 3
0
sint	_init_cmd_priv (struct	cmd_priv *pcmdpriv)
{
	sint res=_SUCCESS;
	
_func_enter_;		
	_init_sema(&(pcmdpriv->cmd_queue_sema), 0);
	//_init_sema(&(pcmdpriv->cmd_done_sema), 0);
	_init_sema(&(pcmdpriv->terminate_cmdthread_sema), 0);
	
	
	_init_queue(&(pcmdpriv->cmd_queue));
	
	//allocate DMA-able/Non-Page memory for cmd_buf and rsp_buf
	
	pcmdpriv->cmd_seq = 1;
	
	pcmdpriv->cmd_allocated_buf = _malloc(MAX_CMDSZ + CMDBUFF_ALIGN_SZ);
	
	if (pcmdpriv->cmd_allocated_buf == NULL){
		res= _FAIL;
		goto exit;
		}
	pcmdpriv->cmd_buf = pcmdpriv->cmd_allocated_buf  +  CMDBUFF_ALIGN_SZ - ( (uint)(pcmdpriv->cmd_allocated_buf) & (CMDBUFF_ALIGN_SZ-1));
		
	pcmdpriv->rsp_allocated_buf = _malloc(MAX_RSPSZ + 4);
	
	if (pcmdpriv->rsp_allocated_buf == NULL){
		res= _FAIL;
		goto exit;
		}
	pcmdpriv->rsp_buf = pcmdpriv->rsp_allocated_buf  +  4 - ( (uint)(pcmdpriv->rsp_allocated_buf) & 3);

	pcmdpriv->cmd_issued_cnt = pcmdpriv->cmd_done_cnt = pcmdpriv->rsp_cnt = 0;

exit:	
_func_exit_;	  	 
	return res;
}	
Ejemplo n.º 4
0
/*

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);

	}
Ejemplo n.º 5
0
sint	_init_recv_priv(struct recv_priv *precvpriv, _adapter *padapter)
{
	sint i;

	union recv_frame *precvframe;

	sint	res=_SUCCESS;
	
_func_enter_;		

	 _memset((unsigned char *)precvpriv, 0, sizeof (struct  recv_priv));

	_spinlock_init(&precvpriv->lock);

	_init_queue(&precvpriv->free_recv_queue);
	_init_queue(&precvpriv->recv_pending_queue);
	
	precvpriv->adapter = padapter;
	
	precvpriv->free_recvframe_cnt = NR_RECVFRAME;

	os_recv_resource_init(precvpriv, padapter);

	precvpriv->pallocated_frame_buf = _malloc(NR_RECVFRAME * sizeof(union recv_frame) + RXFRAME_ALIGN_SZ);
	if(precvpriv->pallocated_frame_buf==NULL){
		res= _FAIL;
		goto exit;
	}	
	_memset(precvpriv->pallocated_frame_buf, 0, NR_RECVFRAME * sizeof(union recv_frame) + RXFRAME_ALIGN_SZ);

	precvpriv->precv_frame_buf = precvpriv->pallocated_frame_buf + RXFRAME_ALIGN_SZ -
							((uint) (precvpriv->pallocated_frame_buf) &(RXFRAME_ALIGN_SZ-1));

	precvframe = (union recv_frame*) precvpriv->precv_frame_buf;


	for(i=0; i < NR_RECVFRAME ; i++)
	{
		_init_listhead(&(precvframe->u.list));

		list_insert_tail(&(precvframe->u.list), &(precvpriv->free_recv_queue.queue));

		res = os_recv_resource_alloc(padapter, precvframe);
	
            	precvframe->u.hdr.adapter =padapter;
		precvframe++;
		
	}
	
#ifdef CONFIG_USB_HCI

	precvpriv->rx_pending_cnt=1;

	_init_sema(&precvpriv->allrxreturnevt, 0);		
	
#endif
	
	
	res = init_recv_priv(precvpriv, padapter);

	
exit:

_func_exit_;

	return res;
	
}