XilinxProcessorIPLib/drivers/usbpsu/examples/xusb_ch9_composite.c
u32 Usb_GetDescReply(struct Usb_DevData *InstancePtr, SetupPacket *SetupData,
		u8 *BufPtr)
{
	u32 ReplyLen = 0;

	switch (SetupData->bRequest) {
	case USB_REQ_GET_DESCRIPTOR:
		switch (SetupData->wValue >> 8) {
		case USB_TYPE_HID_DESC:
			ReplyLen = sizeof(USB_STD_HID_DESC);
			memcpy(BufPtr, &hid_desc, ReplyLen);
			break;

		case USB_TYPE_REPORT_DESC:
			ReplyLen = sizeof(report_desc);
			ReplyLen = SetupData->wLength > ReplyLen ?
				ReplyLen : SetupData->wLength;
			memcpy(BufPtr, &report_desc, ReplyLen);
			break;

		default:
			xil_printf("Keyboard: Unknown desc request 0x%x\n",
					SetupData->wValue >> 8);
			break;
		}
		break;

	default:
		xil_printf("Keyboard: Unknown request 0x%x\r\n",
				SetupData->bRequest);
		break;
	}

	return ReplyLen;
}
/*****************************************************************************/
/**
*
* This function returns a keyboard descriptors.
*
* @param	InstancePtr is a pointer to the Usb_DevData instance.
* @param	Ctrl is a pointer to the Setup packet data.
* @param	BufPtr is a  pointer to the buffer that is to be filled with
*		the descriptor.
*
* @return	Length of the descriptor in the buffer on success.
*		0 on error.
*
******************************************************************************/
This function returns a keyboard descriptors.
This function returns a keyboard descriptors .
u32 Usb_GetDescReply(struct Usb_DevData *InstancePtr, SetupPacket *SetupData,
		u8 *BufPtr)
{
	u32 ReplyLen = 0;
	switch (SetupData->bRequest) {
	case USB_REQ_GET_DESCRIPTOR:
		switch (SetupData->wValue >> 8) {
		case USB_TYPE_HID_DESC:
			ReplyLen = sizeof(USB_STD_HID_DESC);
			memcpy(BufPtr, &hid_desc, ReplyLen);
			break;
		case USB_TYPE_REPORT_DESC:
			ReplyLen = sizeof(report_desc);
			ReplyLen = SetupData->wLength > ReplyLen ?
				ReplyLen : SetupData->wLength;
			memcpy(BufPtr, &report_desc, ReplyLen);
			break;
		default:
			xil_printf("Keyboard: Unknown desc request 0x%x\n",
					SetupData->wValue >> 8);
			break;
		}
		break;
	default:
		xil_printf("Keyboard: Unknown request 0x%x\r\n",
				SetupData->bRequest);
		break;
	}
	return ReplyLen;
}
u32 Usb_GetDescReply ( struct Usb_DevData * InstancePtr , SetupPacket * SetupData , u8 * BufPtr ) { u32 ReplyLen = 0 ; switch ( SetupData -> bRequest ) { case USB_REQ_GET_DESCRIPTOR : switch ( SetupData -> wValue >> 8 ) { case USB_TYPE_HID_DESC : ReplyLen = sizeof ( USB_STD_HID_DESC ) ; memcpy ( BufPtr , & hid_desc , ReplyLen ) ; break ; case USB_TYPE_REPORT_DESC : ReplyLen = sizeof ( report_desc ) ; ReplyLen = SetupData -> wLength > ReplyLen ? ReplyLen : SetupData -> wLength ; memcpy ( BufPtr , & report_desc , ReplyLen ) ; break ; default : xil_printf ( " \n " , SetupData -> wValue >> 8 ) ; break ; } break ; default : xil_printf ( " \r \n " , SetupData -> bRequest ) ; break ; } return ReplyLen ; }
This function returns a keyboard descriptors.
This function returns a keyboard descriptors .