XilinxProcessorIPLib/drivers/usbps/examples/xusbps_ch9.c
int XUsbPs_Ch9HandleSetupPacket(XUsbPs *InstancePtr,
				 XUsbPs_SetupData *SetupData)
{
	int Status = XST_SUCCESS;

#ifdef CH9_DEBUG
	printf("Handle setup packet\n");
#endif

	switch (SetupData->bmRequestType & XUSBPS_REQ_TYPE_MASK) {
	case XUSBPS_CMD_STDREQ:
		XUsbPs_StdDevReq(InstancePtr, SetupData);
		break;

	case XUSBPS_CMD_CLASSREQ:
		XUsbPs_ClassReq(InstancePtr, SetupData);
		break;

	case XUSBPS_CMD_VENDREQ:

#ifdef CH9_DEBUG
		printf("vendor request %x\n", SetupData->bRequest);
#endif
		Status = XUsbPs_HandleVendorReq(InstancePtr, SetupData);
		break;

	default:
		/* Stall on Endpoint 0 */
#ifdef CH9_DEBUG
		printf("unknown class req, stall 0 in out\n");
#endif
		XUsbPs_EpStall(InstancePtr, 0, XUSBPS_EP_DIRECTION_IN |
						XUSBPS_EP_DIRECTION_OUT);
		break;
	}

	return Status;
}
/*****************************************************************************/
/**
* This function handles a Setup Data packet from the host.
*
* @param	InstancePtr is a pointer to XUsbPs instance of the controller.
* @param	SetupData is the structure containing the setup request.
*
* @return
*		- XST_SUCCESS if the function is successful.
*		- XST_FAILURE if an Error occurred.
*
* @note		None.
*
******************************************************************************/
This function handles a Setup Data packet from the host.
This function handles a Setup Data packet from the host .
int XUsbPs_Ch9HandleSetupPacket(XUsbPs *InstancePtr,
				 XUsbPs_SetupData *SetupData)
{
	int Status = XST_SUCCESS;
#ifdef CH9_DEBUG
	printf("Handle setup packet\n");
#endif
	switch (SetupData->bmRequestType & XUSBPS_REQ_TYPE_MASK) {
	case XUSBPS_CMD_STDREQ:
		XUsbPs_StdDevReq(InstancePtr, SetupData);
		break;
	case XUSBPS_CMD_CLASSREQ:
		XUsbPs_ClassReq(InstancePtr, SetupData);
		break;
	case XUSBPS_CMD_VENDREQ:
#ifdef CH9_DEBUG
		printf("vendor request %x\n", SetupData->bRequest);
#endif
		Status = XUsbPs_HandleVendorReq(InstancePtr, SetupData);
		break;
	default:
#ifdef CH9_DEBUG
		printf("unknown class req, stall 0 in out\n");
#endif
		XUsbPs_EpStall(InstancePtr, 0, XUSBPS_EP_DIRECTION_IN |
						XUSBPS_EP_DIRECTION_OUT);
		break;
	}
	return Status;
}
int XUsbPs_Ch9HandleSetupPacket ( XUsbPs * InstancePtr , XUsbPs_SetupData * SetupData ) { int Status = XST_SUCCESS ; #ifdef CH9_DEBUG printf ( " \n " ) ; #endif switch ( SetupData -> bmRequestType & XUSBPS_REQ_TYPE_MASK ) { case XUSBPS_CMD_STDREQ : XUsbPs_StdDevReq ( InstancePtr , SetupData ) ; break ; case XUSBPS_CMD_CLASSREQ : XUsbPs_ClassReq ( InstancePtr , SetupData ) ; break ; case XUSBPS_CMD_VENDREQ : #ifdef CH9_DEBUG printf ( " \n " , SetupData -> bRequest ) ; #endif Status = XUsbPs_HandleVendorReq ( InstancePtr , SetupData ) ; break ; default : #ifdef CH9_DEBUG printf ( " \n " ) ; #endif XUsbPs_EpStall ( InstancePtr , 0 , XUSBPS_EP_DIRECTION_IN | XUSBPS_EP_DIRECTION_OUT ) ; break ; } return Status ; }
This function handles a Setup Data packet from the host.
This function handles a Setup Data packet from the host .
/* Stall on Endpoint 0 */