XilinxProcessorIPLib/drivers/usbpsu/examples/xusb_ch9_composite.c
s32 Usb_SetConfiguration(struct Usb_DevData *InstancePtr, SetupPacket *Ctrl)
{
	u8 State;
	s32 Ret = XST_SUCCESS;

	Xil_AssertNonvoid(InstancePtr != NULL);
	Xil_AssertNonvoid(Ctrl != NULL);

	State = InstancePtr->State;
	SetConfigDone(InstancePtr->PrivateData, 0U);

	switch (State) {
		case USB_STATE_DEFAULT:
			Ret = XST_FAILURE;
			break;

		case USB_STATE_ADDRESS:
			InstancePtr->State = USB_STATE_CONFIGURED;
			break;

		case USB_STATE_CONFIGURED:
			break;

		default:
			Ret = XST_FAILURE;
			break;
	}

	return Ret;
}
/****************************************************************************/
/**
* Changes State of Core to USB configured State.
*
* @param	InstancePtr is a pointer to the Usb_DevData instance.
* @param	Ctrl is a pointer to the Setup packet data.
*
* @return	XST_SUCCESS else XST_FAILURE
*
* @note		None.
*
*****************************************************************************/
Changes State of Core to USB configured State.
Changes State of Core to USB configured State .
s32 Usb_SetConfiguration(struct Usb_DevData *InstancePtr, SetupPacket *Ctrl)
{
	u8 State;
	s32 Ret = XST_SUCCESS;
	Xil_AssertNonvoid(InstancePtr != NULL);
	Xil_AssertNonvoid(Ctrl != NULL);
	State = InstancePtr->State;
	SetConfigDone(InstancePtr->PrivateData, 0U);
	switch (State) {
		case USB_STATE_DEFAULT:
			Ret = XST_FAILURE;
			break;
		case USB_STATE_ADDRESS:
			InstancePtr->State = USB_STATE_CONFIGURED;
			break;
		case USB_STATE_CONFIGURED:
			break;
		default:
			Ret = XST_FAILURE;
			break;
	}
	return Ret;
}
s32 Usb_SetConfiguration ( struct Usb_DevData * InstancePtr , SetupPacket * Ctrl ) { u8 State ; s32 Ret = XST_SUCCESS ; Xil_AssertNonvoid ( InstancePtr != NULL ) ; Xil_AssertNonvoid ( Ctrl != NULL ) ; State = InstancePtr -> State ; SetConfigDone ( InstancePtr -> PrivateData , 0U ) ; switch ( State ) { case USB_STATE_DEFAULT : Ret = XST_FAILURE ; break ; case USB_STATE_ADDRESS : InstancePtr -> State = USB_STATE_CONFIGURED ; break ; case USB_STATE_CONFIGURED : break ; default : Ret = XST_FAILURE ; break ; } return Ret ; }
Changes State of Core to USB configured State.
Changes State of Core to USB configured State .