コード例 #1
0
ファイル: usb_ops_linux.c プロジェクト: Audioniek/driver
static void usb_bulkout_zero_complete(struct urb *purb, struct pt_regs *regs)
#endif
{	
	struct zero_bulkout_context *pcontext = (struct zero_bulkout_context *)purb->context;

	//printk("+usb_bulkout_zero_complete\n");
	
	if(pcontext)
	{
		if(pcontext->pbuf)
		{			
			_mfree(pcontext->pbuf, sizeof(int));	
		}	

		if(pcontext->purb && (pcontext->purb==purb))
		{
			usb_free_urb(pcontext->purb);
		}

	
		_mfree((u8*)pcontext, sizeof(struct zero_bulkout_context));	
	}	
	

}
コード例 #2
0
void free_cmd_obj(struct cmd_obj *pcmd)
{

_func_enter_;

	if((pcmd->cmdcode!=_JoinBss_CMD_) &&(pcmd->cmdcode!= _CreateBss_CMD_))
	{
		//free parmbuf in cmd_obj
		_mfree((unsigned char*)pcmd->parmbuf, pcmd->cmdsz);
	}	
	
	if(pcmd->rsp!=NULL)
	{
		if(pcmd->rspsz!= 0)
		{
			//free rsp in cmd_obj
			_mfree((unsigned char*)pcmd->rsp, pcmd->rspsz);
		}	
	}	

	//free cmd_obj
	_mfree((unsigned char*)pcmd, sizeof(struct cmd_obj));
	
_func_exit_;		

}
コード例 #3
0
ファイル: rtl871x_cmd.c プロジェクト: OpenHMR/Open-HMR600
u8 setstakey_cmd(_adapter *padapter, u8 *psta, u8 unicast_key)
{
	struct cmd_obj		*ph2c;
	struct set_stakey_parm	*psetstakey_para;
	struct cmd_priv		*pcmdpriv = &padapter->cmdpriv;
	struct set_stakey_rsp	*psetstakey_rsp = NULL;
	struct mlme_priv	*pmlmepriv = &padapter->mlmepriv;
	struct security_priv	*psecuritypriv = &padapter->securitypriv;
	struct sta_info		*sta = (struct sta_info*)psta;
	u8 res = _SUCCESS;

_func_enter_;

	ph2c = (struct cmd_obj*)_malloc(sizeof(struct cmd_obj));
	if (ph2c == NULL) {
		res = _FAIL;
		goto exit;
	}

	psetstakey_para = (struct set_stakey_parm*)_malloc(sizeof(struct set_stakey_parm));
	if (psetstakey_para == NULL) {
		_mfree((u8 *) ph2c, sizeof(struct cmd_obj));
		res = _FAIL;
		goto exit;
	}

	psetstakey_rsp = (struct set_stakey_rsp*)_malloc(sizeof(struct set_stakey_rsp));
	if (psetstakey_rsp == NULL) {
		_mfree((u8 *) ph2c, sizeof(struct cmd_obj));
		_mfree((u8 *) psetstakey_para, sizeof(struct set_stakey_parm));
		res = _FAIL;
		goto exit;
	}

	init_h2fwcmd_w_parm_no_rsp(ph2c, psetstakey_para, _SetStaKey_CMD_);
	ph2c->rsp = (u8 *) psetstakey_rsp;
	ph2c->rspsz = sizeof(struct set_stakey_rsp);

	_memcpy(psetstakey_para->addr, sta->hwaddr, ETH_ALEN);

	if (check_fwstate(pmlmepriv, WIFI_STATION_STATE))
		psetstakey_para->algorithm =(unsigned char) psecuritypriv->dot11PrivacyAlgrthm;
	else
		GET_ENCRY_ALGO(psecuritypriv, sta, psetstakey_para->algorithm, _FALSE);

	if (unicast_key == _TRUE) {
		_memcpy(&psetstakey_para->key, &sta->dot118021x_UncstKey, 16);
        } else {
		_memcpy(&psetstakey_para->key, &psecuritypriv->dot118021XGrpKey[psecuritypriv->dot118021XGrpKeyid-1].skey, 16);
        }

	enqueue_cmd(pcmdpriv, ph2c);

exit:

_func_exit_;

	return res;
}
コード例 #4
0
ファイル: rtl871x_cmd.c プロジェクト: OpenHMR/Open-HMR600
void free_evt_obj(struct evt_obj *pevtobj)
{
_func_enter_;

	if(pevtobj->parmbuf)
		_mfree((unsigned char*)pevtobj->parmbuf, pevtobj->evtsz);

	_mfree((unsigned char*)pevtobj, sizeof(struct evt_obj));

_func_exit_;
}
コード例 #5
0
ファイル: rtl871x_cmd.c プロジェクト: OpenHMR/Open-HMR600
void readtssi_cmdrsp_callback(_adapter *padapter,  struct cmd_obj *pcmd)
{
 _func_enter_;

	_mfree((unsigned char*) pcmd->parmbuf, pcmd->cmdsz);
	_mfree((unsigned char*) pcmd, sizeof(struct cmd_obj));

	padapter->mppriv.workparam.bcompleted = _TRUE;

_func_exit_;
}
コード例 #6
0
ファイル: rtl871x_cmd.c プロジェクト: OpenHMR/Open-HMR600
void getbbrfreg_cmdrsp_callback(_adapter *padapter, struct cmd_obj *pcmd)
{
_func_enter_;

	//free_cmd_obj(pcmd);
	_mfree((unsigned char*) pcmd->parmbuf, pcmd->cmdsz);
	_mfree((unsigned char*) pcmd, sizeof(struct cmd_obj));

#ifdef CONFIG_MP_INCLUDED
	padapter->mppriv.workparam.bcompleted= _TRUE;
#endif

_func_exit_;
}
コード例 #7
0
ファイル: rtl871x_cmd.c プロジェクト: OpenHMR/Open-HMR600
/*
u8 setstandby_cmd(unsigned char  *adapter)
*/
u8 setstandby_cmd(_adapter *padapter, uint action)
{
	struct cmd_obj		*ph2c;
	struct usb_suspend_parm	*psetusbsuspend;
	struct cmd_priv 	*pcmdpriv = &padapter->cmdpriv;

	u8 ret = _SUCCESS;

_func_enter_;

	ph2c = (struct cmd_obj*)_malloc(sizeof(struct cmd_obj));
	if (ph2c == NULL) {
		ret = _FAIL;
		goto exit;
	}

	psetusbsuspend = (struct usb_suspend_parm*)_malloc(sizeof(struct usb_suspend_parm));
	if (psetusbsuspend == NULL) {
		_mfree((u8*)ph2c, sizeof(struct cmd_obj));
		ret = _FAIL;
		goto exit;
	}

	psetusbsuspend->action = action;

	init_h2fwcmd_w_parm_no_rsp(ph2c, psetusbsuspend, GEN_CMD_CODE(_SetUsbSuspend));

	enqueue_cmd(pcmdpriv, ph2c);

exit:

_func_exit_;

	return ret;
}
コード例 #8
0
u8 setfwra_cmd(_adapter*padapter, u8 type)
{
	
	struct cmd_obj*			ph2c;
	struct writePTM_parm*		pwriteptmparm;
	struct cmd_priv 			*pcmdpriv=&padapter->cmdpriv;	
	u8	res=_SUCCESS;
	
_func_enter_;

	ph2c = (struct cmd_obj*)_malloc(sizeof(struct cmd_obj));
	if(ph2c==NULL){
		res= _FAIL;
		goto exit;
		}
	pwriteptmparm = (struct writePTM_parm*)_malloc(sizeof(struct setra_parm)); 

	if(pwriteptmparm==NULL){
		_mfree((u8 *) ph2c, sizeof(struct	cmd_obj));
		res= _FAIL;
		goto exit;
	}

	init_h2fwcmd_w_parm_no_rsp(ph2c, pwriteptmparm, GEN_CMD_CODE(_SetRA));	

	pwriteptmparm->type= type;	

	enqueue_cmd(pcmdpriv, ph2c);	
exit:	
_func_exit_;	
	return res;
}
コード例 #9
0
/*
unsigned char setphy_cmd(unsigned char  *adapter) 

1.  be called only after update_registrypriv_dev_network( ~) or mp testing program
2.  for AdHoc/Ap mode or mp mode?

*/
u8 setphy_cmd(_adapter *padapter, u8 modem, u8 ch)
{
	struct cmd_obj*			ph2c;
	struct setphy_parm*		psetphypara;
	struct cmd_priv 			*pcmdpriv=&padapter->cmdpriv;
//	struct mlme_priv			*pmlmepriv = &padapter->mlmepriv;
//	struct registry_priv*		pregistry_priv = &padapter->registrypriv;
//	NDIS_WLAN_BSSID_EX		*dev_network = &padapter->registrypriv.dev_network;
	u8	res=_SUCCESS;
_func_enter_;	
	ph2c = (struct cmd_obj*)_malloc(sizeof(struct cmd_obj));
	if(ph2c==NULL){
		res= _FAIL;
		goto exit;
		}
	psetphypara = (struct setphy_parm*)_malloc(sizeof(struct setphy_parm)); 

	if(psetphypara==NULL){
		_mfree((u8 *) ph2c, sizeof(struct	cmd_obj));
		res= _FAIL;
		goto exit;
	}

	init_h2fwcmd_w_parm_no_rsp(ph2c, psetphypara, _SetPhy_CMD_);

	RT_TRACE(_module_rtl871x_cmd_c_,_drv_info_,("CH=%d, modem=%d", ch, modem));

	psetphypara->modem = modem;
	psetphypara->rfchannel = ch;

	enqueue_cmd(pcmdpriv, ph2c);	
exit:	
_func_exit_;		
	return res;
}
コード例 #10
0
ファイル: malloc.c プロジェクト: digofcbh/Cronus
void *_mrealloc (void *memblock, size_t size, const char *file, int line, const char *func)
{
	size_t old_size;

	if (memblock == NULL) {
		return _mmalloc (size, file, line, func);
	}

	old_size = ( (struct unit_head *) ( (char *) memblock - sizeof (struct unit_head) + sizeof (long)))->size;

	if (old_size == 0) {
		old_size = ( (struct unit_head_large *) ( (char *) memblock - sizeof (struct unit_head_large) + sizeof (long)))->size;
	}

	if (old_size > size) {
		// サイズ縮小 -> そのまま返す(手抜き)
		return memblock;
	}  else {
		// サイズ拡大
		void *p = _mmalloc (size, file, line, func);

		if (p != NULL) {
			memcpy (p, memblock, old_size);
		}

		_mfree (memblock, file, line, func);
		return p;
	}
}
コード例 #11
0
u8 getrfreg_cmd(_adapter  *padapter, u8 offset, u8 *pval)
{
	
	struct cmd_obj*			ph2c;
	struct readRF_parm*		prdrfparm;
	struct cmd_priv 			*pcmdpriv=&padapter->cmdpriv;	
	u8	res=_SUCCESS;
_func_enter_;
	ph2c = (struct cmd_obj*)_malloc(sizeof(struct cmd_obj));
	if(ph2c==NULL){
		res= _FAIL;
		goto exit;
		}
	prdrfparm = (struct readRF_parm*)_malloc(sizeof(struct readRF_parm)); 

	if(prdrfparm ==NULL){
		_mfree((u8 *) ph2c, sizeof(struct	cmd_obj));
		res= _FAIL;
		goto exit;
	}

	_init_listhead(&ph2c->list);
	ph2c->cmdcode =GEN_CMD_CODE(_GetRFReg);
	ph2c->parmbuf = (unsigned char *)prdrfparm;
	ph2c->cmdsz =  sizeof(struct readRF_parm);
	ph2c->rsp = pval;
	ph2c->rspsz = sizeof(struct readRF_rsp);
	
	prdrfparm ->offset = offset;
	
	enqueue_cmd(pcmdpriv, ph2c);	
exit:
_func_exit_;	
	return res;
}
コード例 #12
0
u8 setbasicrate_cmd(_adapter *padapter, u8 *rateset)
{
	struct cmd_obj*			ph2c;
	struct setbasicrate_parm*	pssetbasicratepara;
	struct cmd_priv*		pcmdpriv=&padapter->cmdpriv;
	u8	res = _SUCCESS;

_func_enter_;

	ph2c = (struct cmd_obj*)_malloc(sizeof(struct cmd_obj));
	if (ph2c == NULL) {
		res= _FAIL;
		goto exit;
	}
	pssetbasicratepara = (struct setbasicrate_parm*)_malloc(sizeof(struct setbasicrate_parm)); 

	if (pssetbasicratepara == NULL) {
		_mfree((u8*) ph2c, sizeof(struct cmd_obj));
		res = _FAIL;
		goto exit;
	}

	init_h2fwcmd_w_parm_no_rsp(ph2c, pssetbasicratepara, _SetBasicRate_CMD_);

	_memcpy(pssetbasicratepara->basicrates, rateset, NumRates);	   

	enqueue_cmd(pcmdpriv, ph2c);	
exit:	
_func_exit_;		
	return res;

}
コード例 #13
0
ファイル: rtl871x_cmd.c プロジェクト: OpenHMR/Open-HMR600
u8 setMacAddr_cmd(_adapter *padapter, u8 *mac_addr)
{
	struct cmd_priv 		*pcmdpriv = &padapter->cmdpriv;
	struct cmd_obj			*ph2c;
	struct SetMacAddr_param	*psetMacAddr_para;

	u8 res = _SUCCESS;

_func_enter_;

	ph2c = (struct cmd_obj*)_malloc(sizeof(struct cmd_obj));
	if (ph2c == NULL) {
		res = _FAIL;
		goto exit;
	}

	psetMacAddr_para = (struct SetMacAddr_param*)_malloc(sizeof(struct SetMacAddr_param));
	if (psetMacAddr_para == NULL) {
		_mfree((u8 *) ph2c, sizeof(struct cmd_obj));
		res = _FAIL;
		goto exit;
	}

	init_h2fwcmd_w_parm_no_rsp(ph2c, psetMacAddr_para, _SetMacAddress_CMD_);

	_memcpy(psetMacAddr_para->MacAddr, mac_addr,ETH_ALEN);

	enqueue_cmd(pcmdpriv, ph2c);

exit:

_func_exit_;

	return res;
 }
コード例 #14
0
u8  setatim_cmd(_adapter* adapter, u8 add, u8 txid)
{
	
	struct	cmd_obj*	ph2c;
	struct	setatim_parm* psetatim;
	struct	cmd_priv   *pcmdpriv= &( adapter->cmdpriv);
	u8	res=_SUCCESS;
_func_enter_;
	ph2c = (struct cmd_obj*)_malloc(sizeof(struct cmd_obj));
	if(ph2c==NULL){
		goto exit;
		res= _FAIL;
	}
	psetatim = (struct setatim_parm*)_malloc(sizeof(struct setatim_parm)); 

	if(psetatim == NULL){
		_mfree((unsigned char *) ph2c, sizeof(struct	cmd_obj));
		res= _FAIL;
		goto exit;
	}

	//NdisZeroMemory();
	psetatim->op = add;
	psetatim->txid = txid;


	init_h2fwcmd_w_parm_no_rsp(ph2c, psetatim, _SetAtim_CMD_);

	enqueue_cmd(pcmdpriv, ph2c);
exit:
_func_exit_;
	return res;	
}
コード例 #15
0
u8 setrfintfs_cmd(_adapter  *padapter, u8 mode)
{	
	struct cmd_obj*			ph2c;
	struct setrfintfs_parm*		psetrfintfsparm;	
	struct cmd_priv 			*pcmdpriv=&padapter->cmdpriv;
	u8	res=_SUCCESS;
_func_enter_;	

	ph2c = (struct cmd_obj*)_malloc(sizeof(struct cmd_obj));
	if(ph2c==NULL){
		res= _FAIL;
		goto exit;
		}
	psetrfintfsparm = (struct setrfintfs_parm*)_malloc(sizeof(struct setrfintfs_parm)); 

	if(psetrfintfsparm==NULL){
		_mfree((unsigned char *) ph2c, sizeof(struct	cmd_obj));
		res= _FAIL;
		goto exit;
	}

	init_h2fwcmd_w_parm_no_rsp(ph2c, psetrfintfsparm, GEN_CMD_CODE(_SetRFIntFs));

	psetrfintfsparm->rfintfs = mode;

	enqueue_cmd(pcmdpriv, ph2c);	
exit:
_func_exit_;	
	return res;

}
コード例 #16
0
u8 setrttbl_cmd(_adapter  *padapter, struct setratable_parm *prate_table)
{
	struct cmd_obj*			ph2c;
	struct setratable_parm *	psetrttblparm;	
	struct cmd_priv 			*pcmdpriv=&padapter->cmdpriv;
	u8	res=_SUCCESS;
_func_enter_;	

	ph2c = (struct cmd_obj*)_malloc(sizeof(struct cmd_obj));
	if(ph2c==NULL){
		res= _FAIL;
		goto exit;
		}
	psetrttblparm = (struct setratable_parm*)_malloc(sizeof(struct setratable_parm)); 

	if(psetrttblparm==NULL){
		_mfree((unsigned char *) ph2c, sizeof(struct	cmd_obj));
		res= _FAIL;
		goto exit;
	}

	init_h2fwcmd_w_parm_no_rsp(ph2c, psetrttblparm, GEN_CMD_CODE(_SetRaTable));

	_memcpy(psetrttblparm,prate_table,sizeof(struct setratable_parm));

	enqueue_cmd(pcmdpriv, ph2c);	
exit:
_func_exit_;	
	return res;

}
コード例 #17
0
u8 setopmode_cmd(_adapter  *padapter, NDIS_802_11_NETWORK_INFRASTRUCTURE networktype)
{
	struct	cmd_obj*	ph2c;
	struct	setopmode_parm* psetop;

	struct	cmd_priv   *pcmdpriv= &padapter->cmdpriv;
	u8	res=_SUCCESS;
_func_enter_;
	ph2c = (struct cmd_obj*)_malloc(sizeof(struct cmd_obj));			
	if(ph2c==NULL){
		res= _FALSE;
		goto exit;
		}
	psetop = (struct setopmode_parm*)_malloc(sizeof(struct setopmode_parm)); 

	if(psetop==NULL){
		_mfree((u8 *) ph2c, sizeof(struct	cmd_obj));
		res=_FALSE;
		goto exit;
	}

	init_h2fwcmd_w_parm_no_rsp(ph2c, psetop, _SetOpMode_CMD_);
	psetop->mode = networktype;

	enqueue_cmd(pcmdpriv, ph2c);
exit:
_func_exit_;	
	return res;

}
コード例 #18
0
u8 setrfreg_cmd(_adapter  *padapter, u8 offset, u32 val)
{
	
	struct cmd_obj*			ph2c;
	struct writeRF_parm*		pwriterfparm;
	struct cmd_priv 			*pcmdpriv=&padapter->cmdpriv;	
	u8	res=_SUCCESS;
_func_enter_;
	ph2c = (struct cmd_obj*)_malloc(sizeof(struct cmd_obj));
	if(ph2c==NULL){
		res= _FAIL;	
		goto exit;
		}
	pwriterfparm = (struct writeRF_parm*)_malloc(sizeof(struct writeRF_parm)); 

	if(pwriterfparm==NULL){
		_mfree((u8 *) ph2c, sizeof(struct	cmd_obj));
		res= _FAIL;
		goto exit;
	}

	init_h2fwcmd_w_parm_no_rsp(ph2c, pwriterfparm, GEN_CMD_CODE(_SetRFReg));	

	pwriterfparm->offset = offset;
	pwriterfparm->value = val;

	enqueue_cmd(pcmdpriv, ph2c);	
exit:
_func_exit_;	
	return res;
}
コード例 #19
0
ファイル: cfio_ops.c プロジェクト: OpenHMR/Open-HMR600
uint cf_init_intf_priv(struct intf_priv *pintfpriv)
{
	_func_enter_;
       pintfpriv->max_xmitsz =  512;
	pintfpriv->max_recvsz =  512;
	pintfpriv->max_iosz =  128;
	pintfpriv->intf_status =  0;
	pintfpriv->io_wsz = 0;
	pintfpriv->io_rsz = 0;	

      _rwlock_init(&pintfpriv->rwlock);
	
	pintfpriv->allocated_io_rwmem = (volatile u8 *)_malloc(pintfpriv->max_xmitsz +4); 
	
       if (pintfpriv->allocated_io_rwmem == NULL)
    	goto cfio_init_intf_priv_fail;

	pintfpriv->io_rwmem = pintfpriv->allocated_io_rwmem +  4\
	- ( (u32)(pintfpriv->allocated_io_rwmem) & 3);

	_func_exit_;
	return _SUCCESS;

cfio_init_intf_priv_fail:
	
	if (pintfpriv->allocated_io_rwmem)
		_mfree((u8 *)pintfpriv->allocated_io_rwmem, pintfpriv->max_xmitsz +4);
	_func_exit_;
	return _FAIL; 

}
コード例 #20
0
ファイル: malloc.c プロジェクト: digofcbh/Cronus
static void memmgr_final (void)
{
	struct block *block = block_first;
	struct unit_head_large *large = unit_head_large_first;
#ifdef LOG_MEMMGR
	int count = 0;
#endif /* LOG_MEMMGR */

	while (block) {
		if (block->unit_used) {
			int i;

			for (i = 0; i < block->unit_maxused; i++) {
				struct unit_head *head = block2unit (block, i);

				if (head->block != NULL) {
					char *ptr = (char *) head + sizeof (struct unit_head) - sizeof (long);
#ifdef LOG_MEMMGR
					char buf[1024];
					sprintf (buf,
							 "%04d : %s line %d size %lu address 0x%p\n", ++count,
							 head->file, head->line, (unsigned long) head->size, ptr);
					memmgr_log (buf);
#endif /* LOG_MEMMGR */
					// get block pointer and free it [celest]
					_mfree (ptr, ALC_MARK);
				}
			}
		}

		block = block->block_next;
	}

	while (large) {
		struct unit_head_large *large2;
#ifdef LOG_MEMMGR
		char buf[1024];
		sprintf (buf,
				 "%04d : %s line %d size %lu address 0x%p\n", ++count,
				 large->unit_head.file, large->unit_head.line, (unsigned long) large->size, &large->unit_head.checksum);
		memmgr_log (buf);
#endif /* LOG_MEMMGR */
		large2 = large->next;
		FREE (large, file, line, func);
		large = large2;
	}

#ifdef LOG_MEMMGR

	if (count == 0) {
		ShowInfo ("Memory manager: No memory leaks found.\n");
	} else {
		ShowWarning ("Memory manager: Memory leaks found and fixed.\n");
		fclose (log_fp);
	}

#endif /* LOG_MEMMGR */
}
コード例 #21
0
void _free_cmd_priv (struct	cmd_priv *pcmdpriv)
{
_func_enter_;

	if(pcmdpriv){
		_spinlock_free(&(pcmdpriv->cmd_queue.lock));
		_free_sema(&(pcmdpriv->cmd_queue_sema));
		//_free_sema(&(pcmdpriv->cmd_done_sema));
		_free_sema(&(pcmdpriv->terminate_cmdthread_sema));

		if (pcmdpriv->cmd_allocated_buf)
			_mfree(pcmdpriv->cmd_allocated_buf, MAX_CMDSZ + CMDBUFF_ALIGN_SZ);
		
		if (pcmdpriv->rsp_allocated_buf)
			_mfree(pcmdpriv->rsp_allocated_buf, MAX_RSPSZ + 4);
	}
_func_exit_;		
}
コード例 #22
0
ファイル: usb_ops_linux.c プロジェクト: Audioniek/driver
int usbctrl_vendorreq(struct intf_priv *pintfpriv, u8 request, u16 value, u16 index, void *pdata, u16 len, u8 requesttype)
{
	unsigned int pipe;
	int status;
	u8 reqtype;
	
	struct dvobj_priv  *pdvobjpriv = (struct dvobj_priv  *)pintfpriv->intf_dev;   
	struct usb_device *udev=pdvobjpriv->pusbdev;
		
	// Added by Albert 2010/02/09
	// For mstar platform, mstar suggests the address for USB IO should be 16 bytes alignment.
	// Trying to fix it here.

	u8 *palloc_buf, *pIo_buf;

	palloc_buf = _malloc( (u32) len + 16);
	
	if ( palloc_buf== NULL)
	{
		printk( "[%s] Can't alloc memory for vendor request\n", __FUNCTION__ );
		return(-1);
	}
	
	pIo_buf = palloc_buf + 16 -((uint)(palloc_buf) & 0x0f );
	
		
	if (requesttype == 0x01)
	{
		pipe = usb_rcvctrlpipe(udev, 0);//read_in
		reqtype =  RTL871X_VENQT_READ;		
	} 
	else 
	{
		pipe = usb_sndctrlpipe(udev, 0);//write_out
		reqtype =  RTL871X_VENQT_WRITE;		
		_memcpy( pIo_buf, pdata, len);
	}		
	
	status = usb_control_msg(udev, pipe, request, reqtype, value, index, pIo_buf, len, HZ/2);
	
	if (status < 0)
       {
		RT_TRACE(_module_hci_ops_os_c_,_drv_err_,("reg 0x%x, usb_read8 TimeOut! status:0x%x value=0x%x\n", value, status, *(u32*)pdata));
       }
	else if ( status > 0 )   // Success this control transfer.
	{
               if ( requesttype == 0x01 )
               {   // For Control read transfer, we have to copy the read data from pIo_buf to pdata.
                       _memcpy( pdata, pIo_buf,  status );
               }
	}

	_mfree( palloc_buf, (u32) len + 16 );

	return status;

}
コード例 #23
0
ファイル: rtl871x_cmd.c プロジェクト: OpenHMR/Open-HMR600
u8 setassocsta_cmd(_adapter *padapter, u8 *mac_addr)
{
	struct cmd_priv 		*pcmdpriv = &padapter->cmdpriv;
	struct cmd_obj			*ph2c;
	struct set_assocsta_parm	*psetassocsta_para;
	struct set_stakey_rsp		*psetassocsta_rsp = NULL;
	u8	res = _SUCCESS;

_func_enter_;

	ph2c = (struct cmd_obj*)_malloc(sizeof(struct cmd_obj));
	if (ph2c == NULL) {
		res = _FAIL;
		goto exit;
	}

	psetassocsta_para = (struct set_assocsta_parm*)_malloc(sizeof(struct set_assocsta_parm));
	if (psetassocsta_para == NULL) {
		_mfree((u8 *) ph2c, sizeof(struct cmd_obj));
		res = _FAIL;
		goto exit;
	}

	psetassocsta_rsp = (struct set_stakey_rsp*)_malloc(sizeof(struct set_assocsta_rsp));
	if (psetassocsta_rsp == NULL) {
		_mfree((u8 *) ph2c, sizeof(struct cmd_obj));
		_mfree((u8 *) psetassocsta_para, sizeof(struct set_assocsta_parm));
		return _FAIL;
	}

	init_h2fwcmd_w_parm_no_rsp(ph2c, psetassocsta_para, _SetAssocSta_CMD_);
	ph2c->rsp = (u8 *) psetassocsta_rsp;
	ph2c->rspsz = sizeof(struct set_assocsta_rsp);

	_memcpy(psetassocsta_para->addr, mac_addr,ETH_ALEN);

	enqueue_cmd(pcmdpriv, ph2c);

exit:

_func_exit_;

	return res;
 }
コード例 #24
0
ファイル: rtl871x_io.c プロジェクト: OpenHMR/Open-HMR600
uint _init_intf_hdl(_adapter *padapter, struct intf_hdl *pintf_hdl)
{	
	struct	intf_priv	*pintf_priv;
	void (*set_intf_option)(u32 *poption) = NULL;
	void (*set_intf_funs)(struct intf_hdl *pintf_hdl);
	void (*set_intf_ops)(struct _io_ops	*pops);
	uint (*init_intf_priv)(struct intf_priv *pintfpriv);

_func_enter_;
	
#ifdef CONFIG_SDIO_HCI
	set_intf_option = &(sdio_set_intf_option);
	set_intf_funs = &(sdio_set_intf_funs);
	set_intf_ops = &sdio_set_intf_ops;
	init_intf_priv = &sdio_init_intf_priv;
#endif

#ifdef CONFIG_USB_HCI
	set_intf_option = &(usb_set_intf_option);
	set_intf_funs = &(usb_set_intf_funs);
	set_intf_ops = &usb_set_intf_ops;
	init_intf_priv = &usb_init_intf_priv;
#endif

	pintf_priv = pintf_hdl->pintfpriv =(struct intf_priv *) _malloc(sizeof(struct intf_priv));
	
	if (pintf_priv == NULL)
		goto _init_intf_hdl_fail;

	pintf_hdl->adapter = (u8*)padapter;
	
	set_intf_option(&pintf_hdl->intf_option);
	set_intf_funs(pintf_hdl);
	set_intf_ops(&pintf_hdl->io_ops);

	pintf_priv->intf_dev = (u8 *)&(padapter->dvobjpriv);
	
	if (init_intf_priv(pintf_priv) == _FAIL)
		goto _init_intf_hdl_fail;
	
_func_exit_;

	return _SUCCESS;

_init_intf_hdl_fail:
	
	if (pintf_priv) {
		_mfree((u8 *)pintf_priv, sizeof(struct intf_priv));
	}
	
_func_exit_;

	return _FAIL;
	
}
コード例 #25
0
ファイル: mlme_linux.c プロジェクト: berte/mediaplayer
void report_sec_ie(_adapter *adapter,u8 authmode,u8 *sec_ie)
{
    uint len;
    u8 *buff,*p,i;
    union iwreq_data wrqu;

    _func_enter_;

    RT_TRACE(_module_mlme_osdep_c_,_drv_info_,("+report_sec_ie, authmode=%d\n", authmode));

    buff = NULL;
    if(authmode==_WPA_IE_ID_)
    {
        RT_TRACE(_module_mlme_osdep_c_,_drv_info_,("report_sec_ie, authmode=%d\n", authmode));

        buff = _malloc(IW_CUSTOM_MAX);

        if(buff == NULL) {
            RT_TRACE(_module_mlme_osdep_c_,_drv_info_,("report_sec_ie, _malloc fail !\n"));
            return;
        }

        _memset(buff,0,IW_CUSTOM_MAX);

        p=buff;

        p+=sprintf(p,"ASSOCINFO(ReqIEs=");

        len = sec_ie[1]+2;
        len =  (len < IW_CUSTOM_MAX) ? len:IW_CUSTOM_MAX;

        for(i=0; i<len; i++) {
            p+=sprintf(p,"%02x",sec_ie[i]);
        }

        p+=sprintf(p,")");

        _memset(&wrqu,0,sizeof(wrqu));

        wrqu.data.length=p-buff;

        wrqu.data.length = (wrqu.data.length<IW_CUSTOM_MAX) ? wrqu.data.length:IW_CUSTOM_MAX;

        wireless_send_event(adapter->pnetdev,IWEVCUSTOM,&wrqu,buff);

        if(buff)
            _mfree(buff, IW_CUSTOM_MAX);

    }

    _func_exit_;

}
コード例 #26
0
ファイル: rtl871x_sta_mgt.c プロジェクト: OpenHMR/Open-HMR600
u32	_free_sta_priv(struct	sta_priv *pstapriv)
{
_func_enter_;
	if(pstapriv){
		mfree_sta_priv_lock(pstapriv);

		_mfree(pstapriv->pallocated_stainfo_buf, sizeof(struct sta_info)*NUM_STA+4);		
	}
	
_func_exit_;
	return _SUCCESS;
}
コード例 #27
0
/*
sitesurvey_cmd(~)
	### NOTE:#### (!!!!)
	MUST TAKE CARE THAT BEFORE CALLING THIS FUNC, YOU SHOULD HAVE LOCKED pmlmepriv->lock
*/
u8 sitesurvey_cmd(_adapter  *padapter, NDIS_802_11_SSID *pssid)
{
	struct cmd_obj*		ph2c;
	struct sitesurvey_parm*	psurveyPara;
	struct cmd_priv 	*pcmdpriv = &padapter->cmdpriv;
	struct mlme_priv	*pmlmepriv = &padapter->mlmepriv;

_func_enter_;	
	
	ph2c = (struct cmd_obj*)_malloc(sizeof(struct cmd_obj));
	if (ph2c == NULL)
		return _FAIL;

	psurveyPara = (struct sitesurvey_parm*)_malloc(sizeof(struct sitesurvey_parm)); 

	if (psurveyPara == NULL) {
		_mfree((unsigned char*) ph2c, sizeof(struct cmd_obj));
		return _FAIL;
	}

	free_network_queue(padapter);
	RT_TRACE(_module_rtl871x_cmd_c_, _drv_info_, ("\nflush  network queue\n\n"));

	init_h2fwcmd_w_parm_no_rsp(ph2c, psurveyPara, GEN_CMD_CODE(_SiteSurvey));

	psurveyPara->bsslimit = cpu_to_le32(48);
	psurveyPara->passive_mode = cpu_to_le32(1);
	psurveyPara->ss_ssidlen= cpu_to_le32(0);// pssid->SsidLength;

	if (pssid->SsidLength)
	{
		_memcpy(psurveyPara->ss_ssid, pssid->Ssid, pssid->SsidLength);
		psurveyPara->ss_ssidlen = cpu_to_le32(pssid->SsidLength);
	}
	else
	{
		_memset(psurveyPara->ss_ssid, 0, IW_ESSID_MAX_SIZE + 1);
	}

	set_fwstate(pmlmepriv, _FW_UNDER_SURVEY);

	enqueue_cmd(pcmdpriv, ph2c);

	_set_timer(&pmlmepriv->scan_to_timer, SCANNING_TIMEOUT);

_func_exit_;		

	return _SUCCESS;
}
コード例 #28
0
ファイル: rtl871x_recv.c プロジェクト: OpenHMR/Open-HMR600
void _free_recv_priv (struct recv_priv *precvpriv)
{
_func_enter_;		

	mfree_recv_priv_lock(precvpriv);

	os_recv_resource_free(precvpriv);

	if(precvpriv->pallocated_frame_buf)
		_mfree(precvpriv->pallocated_frame_buf, NR_RECVFRAME * sizeof(union recv_frame) + RXFRAME_ALIGN_SZ);

	free_recv_priv(precvpriv);
	
_func_exit_;

}
コード例 #29
0
void _free_evt_priv (struct	evt_priv *pevtpriv)
{
_func_enter_;

	RT_TRACE(_module_rtl871x_cmd_c_,_drv_info_,("+_free_evt_priv \n"));

#ifdef CONFIG_EVENT_THREAD_MODE
	_free_sema(&(pevtpriv->evt_notify));
	_free_sema(&(pevtpriv->terminate_evtthread_sema));
#endif

	if (pevtpriv->evt_allocated_buf)
		_mfree(pevtpriv->evt_allocated_buf, MAX_EVTSZ + 4);

	RT_TRACE(_module_rtl871x_cmd_c_,_drv_info_,("-_free_evt_priv \n"));

_func_exit_;	  	

}	
コード例 #30
0
ファイル: rtl871x_cmd.c プロジェクト: OpenHMR/Open-HMR600
/*
sitesurvey_cmd(~)
	### NOTE:#### (!!!!)
	MUST TAKE CARE THAT BEFORE CALLING THIS FUNC, YOU SHOULD HAVE LOCKED pmlmepriv->lock
*/
u8 sitesurvey_cmd(_adapter *padapter, NDIS_802_11_SSID *pssid)
{
	struct cmd_obj		*ph2c;
	struct sitesurvey_parm	*psurveyPara;
	struct cmd_priv		*pcmdpriv = &padapter->cmdpriv;
	struct mlme_priv	*pmlmepriv = &padapter->mlmepriv;

_func_enter_;

	ph2c = (struct cmd_obj*)_malloc(sizeof(struct cmd_obj));
	if (ph2c == NULL)
		return _FAIL;

	psurveyPara = (struct sitesurvey_parm*)_malloc(sizeof(struct sitesurvey_parm));
	if (psurveyPara == NULL) {
		_mfree((unsigned char*) ph2c, sizeof(struct cmd_obj));
		return _FAIL;
	}

	init_h2fwcmd_w_parm_no_rsp(ph2c, psurveyPara, GEN_CMD_CODE(_SiteSurvey));

	psurveyPara->bsslimit = cpu_to_le32(48);
	psurveyPara->passive_mode = cpu_to_le32(1);
	psurveyPara->ss_ssidlen= cpu_to_le32(0);// pssid->SsidLength;
	_memset(psurveyPara->ss_ssid, 0, IW_ESSID_MAX_SIZE + 1);
	if ((pssid != NULL) && (pssid->SsidLength)) {
		_memcpy(psurveyPara->ss_ssid, pssid->Ssid, pssid->SsidLength);
		psurveyPara->ss_ssidlen = cpu_to_le32(pssid->SsidLength);
	}

	set_fwstate(pmlmepriv, _FW_UNDER_SURVEY);

	enqueue_cmd(pcmdpriv, ph2c);

	_set_timer(&pmlmepriv->scan_to_timer, SCANNING_TIMEOUT);
	padapter->ledpriv.LedControlHandler(padapter, LED_CTL_SITE_SURVEY);
	padapter->blnEnableRxFF0Filter = 0;

_func_exit_;

	return _SUCCESS;
}