XilinxProcessorIPLib/drivers/usbpsu/examples/xusb_freertos_class_keyboard.c
void Usb_ClassReq_Keyboard(struct Usb_DevData *InstancePtr,
		SetupPacket *SetupData)
{
	uint16_t reply_len = 0;
	uint8_t bRequest = SetupData->bRequest;
	uint8_t bRequestType = SetupData->bRequestType;
	uint16_t wValue = SetupData->wValue;
	uint16_t wLength = SetupData->wLength;

	switch ((bRequestType << 8) | bRequest) {
		case (((USB_DIR_OUT | USB_CMD_CLASSREQ | USB_STATUS_INTERFACE) << 8)
				| SET_IDLE_REQUEST):
			EpBufferSend(InstancePtr->PrivateData, 0, NULL, 0);
			break;

		case (((USB_DIR_IN | USB_CMD_CLASSREQ | USB_STATUS_INTERFACE) << 8)
				| GET_REPORT_REQUEST):
			/* send an empty report */
			reply_len = wLength > REPORT_LENGTH ?
				(u16)REPORT_LENGTH : wLength;

			memset(class_data, 0x0, reply_len);
			EpBufferSend(InstancePtr->PrivateData, 1,
					(u8 *)class_data, reply_len);
			break;

		default:
			xil_printf("Unknown class request 0x%x\n", wValue >> 8);
			Ep0StallRestart(InstancePtr->PrivateData);
	}
}
/****************************************************************************/
/**
* This function is class handler for HID and is called when
* Setup packet received is for Class request(not a Standard Device request)
*
* @param	InstancePtr is pointer to Usb_DevData instance.
* @param	SetupData is pointer to SetupPacket received.
*
* @return	None
*
* @note		None.
*
*****************************************************************************/
This function is class handler for HID and is called when
Setup packet received is for Class request(not a Standard Device request)
This function is class handler for HID and is called when Setup packet received is for Class request ( not a Standard Device request )
void Usb_ClassReq_Keyboard(struct Usb_DevData *InstancePtr,
		SetupPacket *SetupData)
{
	uint16_t reply_len = 0;
	uint8_t bRequest = SetupData->bRequest;
	uint8_t bRequestType = SetupData->bRequestType;
	uint16_t wValue = SetupData->wValue;
	uint16_t wLength = SetupData->wLength;
	switch ((bRequestType << 8) | bRequest) {
		case (((USB_DIR_OUT | USB_CMD_CLASSREQ | USB_STATUS_INTERFACE) << 8)
				| SET_IDLE_REQUEST):
			EpBufferSend(InstancePtr->PrivateData, 0, NULL, 0);
			break;
		case (((USB_DIR_IN | USB_CMD_CLASSREQ | USB_STATUS_INTERFACE) << 8)
				| GET_REPORT_REQUEST):
			reply_len = wLength > REPORT_LENGTH ?
				(u16)REPORT_LENGTH : wLength;
			memset(class_data, 0x0, reply_len);
			EpBufferSend(InstancePtr->PrivateData, 1,
					(u8 *)class_data, reply_len);
			break;
		default:
			xil_printf("Unknown class request 0x%x\n", wValue >> 8);
			Ep0StallRestart(InstancePtr->PrivateData);
	}
}
void Usb_ClassReq_Keyboard ( struct Usb_DevData * InstancePtr , SetupPacket * SetupData ) { uint16_t reply_len = 0 ; uint8_t bRequest = SetupData -> bRequest ; uint8_t bRequestType = SetupData -> bRequestType ; uint16_t wValue = SetupData -> wValue ; uint16_t wLength = SetupData -> wLength ; switch ( ( bRequestType << 8 ) | bRequest ) { case ( ( ( USB_DIR_OUT | USB_CMD_CLASSREQ | USB_STATUS_INTERFACE ) << 8 ) | SET_IDLE_REQUEST ) : EpBufferSend ( InstancePtr -> PrivateData , 0 , NULL , 0 ) ; break ; case ( ( ( USB_DIR_IN | USB_CMD_CLASSREQ | USB_STATUS_INTERFACE ) << 8 ) | GET_REPORT_REQUEST ) : reply_len = wLength > REPORT_LENGTH ? ( u16 ) REPORT_LENGTH : wLength ; memset ( class_data , 0x0 , reply_len ) ; EpBufferSend ( InstancePtr -> PrivateData , 1 , ( u8 * ) class_data , reply_len ) ; break ; default : xil_printf ( " \n " , wValue >> 8 ) ; Ep0StallRestart ( InstancePtr -> PrivateData ) ; } }
This function is class handler for HID and is called when
Setup packet received is for Class request(not a Standard Device request)
This function is class handler for HID and is called when Setup packet received is for Class request ( not a Standard Device request )
/* send an empty report */