示例#1
0
unsigned int controlInit(MINIPORT_ADAPTER *Adapter)
{
	ENTER;
	// Receive control packets
	QueueInitList(Adapter->ctl.Q_Received.Head);
	spin_lock_init(&Adapter->ctl.Q_Received.Lock);
	
	QueueInitList(Adapter->ctl.Apps.ProcessList);
	spin_lock_init(&Adapter->ctl.Apps.Lock);
	Adapter->ctl.Apps.Inited = TRUE;

	Adapter->SndQLimit = MINIPORT_MAX_SEND_PACKETS_DEFAULT;
	Adapter->RcvQLimit = MINIPORT_MAX_RECV_PACKETS_DEFAULT;
	Adapter->FullQLimit = ((Adapter->SndQLimit + Adapter->RcvQLimit) / 2) - 1;

	LEAVE;
	return STATUS_SUCCESS;
}
示例#2
0
INT hwInit(MINIPORT_ADAPTER *Adapter)
{
	ENTER;

	static PVOID ReceiveBuffer = NULL;	//cky 20100624
	if(!hwGPIOInit())
	{
		DumpDebug(DISPATCH, "hwInit: Can't intialize GPIO");
		return STATUS_UNSUCCESSFUL;
	}

	if (ReceiveBuffer == NULL)
	{
		DumpDebug(DISPATCH, "Alloc ReceiveBuffer");
		ReceiveBuffer = kmalloc(SDIO_BUFFER_SIZE+8, GFP_KERNEL); //sumanth: the extra space required to copy ethernet header
		if (ReceiveBuffer == NULL)
		{
			DumpDebug(DISPATCH, "kmalloc fail!!");
			return -ENOMEM;
		}
	}
	else
	{
		DumpDebug(DISPATCH, "ReceiveBuffer already allocated - skip");
	}

	memset(&Adapter->hw,0,sizeof(HARDWARE_INFO));
/*	Adapter->hw.ReceiveBuffer= kmalloc(SDIO_BUFFER_SIZE, GFP_ATOMIC);
	if(Adapter->hw.ReceiveBuffer ==NULL) {
		return -ENOMEM;
	}*/ //sumanth: this buffer is not logically required hence it is eliminated
#if 1	//cky 20100624
	Adapter->hw.ReceiveTempBuffer = ReceiveBuffer;
#else
	Adapter->hw.ReceiveTempBuffer= kmalloc(SDIO_BUFFER_SIZE+8, GFP_ATOMIC); //sumanth: the extra space required to copy ethernet header
	if(Adapter->hw.ReceiveTempBuffer ==NULL) {
//			if(Adapter->hw.ReceiveBuffer)			//sumanth no point in freeing a NULL pointer
//				kfree(Adapter->hw.ReceiveTempBuffer);
		return -ENOMEM;
	}
#endif
	// For sending data and control packets
	QueueInitList(Adapter->hw.Q_Send.Head);
	spin_lock_init(&Adapter->hw.Q_Send.Lock);
	
	INIT_WORK(&Adapter->work, hwTransmitThread);
	init_waitqueue_head(&Adapter->hFWDNEndEvent);

	init_completion(&Adapter->hAwakeAckEvent);
	
	return STATUS_SUCCESS;
	LEAVE;
}