Example #1
0
//bool USBHook(Setup& setup)
bool USBHook()
{
	Setup& setup = _setup;
	u8 r = setup.bRequest;

	//	CDC Requests
	if (CDC_GET_LINE_CODING == r)
	{
		Send((const volatile u8*)&_usbLineInfo,7);
	}

	else if (CDC_SET_LINE_CODING ==  r)
	{
		WaitOUT();
		Recv((volatile u8*)&_usbLineInfo,7);
		ClearOUT();
	}

	else if (CDC_SET_CONTROL_LINE_STATE == r)
	{
		_usbLineInfo.lineState = setup.wValueL;
	}

	return true;
}
Example #2
0
//	Does not timeout or cross fifo boundaries
//	Will only work for transfers <= 64 bytes
//	TODO
int USB_RecvControl(void* d, int len)
{
	WaitOUT();
	Recv((u8*)d,len);
	ClearOUT();
	return len;
}
Example #3
0
File: Core.cpp Project: Dzenik/Cosa
int 
USB_RecvControl(void* d, int len)
{
  WaitOUT();
  Recv((uint8_t*)d,len);
  ClearOUT();
  return (len);
}
Example #4
0
//  Does not timeout or cross fifo boundaries
//  Will only work for transfers <= 64 bytes
//  TODO
int USB_RecvControl(void* d, int len)
{
  WaitOUT();

  // NOTE: if the 
  Recv((u8*)d,len);

  ClearOUT(); // allows me to receive data again

  return len;
}
Example #5
0
//	Does not timeout or cross fifo boundaries
int USB_RecvControl(void* d, int len)
{
	auto length = len;
	while(length)
	{
		// Dont receive more than the USB Control EP has to offer
		// Use fixed 64 because control EP always have 64 bytes even on 16u2.
		auto recvLength = length;
		if(recvLength > 64){
			recvLength = 64;
		}

		// Write data to fit to the end (not the beginning) of the array
		WaitOUT();
		Recv((u8*)d + len - length, recvLength);
		ClearOUT();
		length -= recvLength;
	}
	return len;
}