XilinxProcessorIPLib/drivers/usbpsu/examples/xusb_composite_example.c
static void Usb_AudioInHandler(void *CallBackRef, u32 RequestedBytes, u32 BytesTxed)
{
	struct Usb_DevData *InstancePtr = CallBackRef;
	USBCH9_DATA *ch9_ptr =
		(USBCH9_DATA *) Get_DrvData(InstancePtr->PrivateData);
	struct composite_dev *interface = (struct composite_dev *)(ch9_ptr->data_ptr);
	struct audio_if *f = &(interface->f_audio);
	u32 Size;

	Size = f->packetsize;
	f->residue += f->packetresidue;

	if ((f->residue / f->interval) >= f->framesize) {
		Size += f->framesize;
		f->residue -= f->framesize * f->interval;
	}

	/* Buffer is completed, retransmitting the same file data */
	if ((f->index + Size) > f->disksize)
		f->index = 0;

	if (EpBufferSend(InstancePtr->PrivateData, ISO_EP,
				f->disk + f->index, Size) == XST_SUCCESS) {
		f->index += Size;

		if (f->firstpkt) {
			Size = f->packetsize;
			f->residue += f->packetresidue;

			if ((f->residue / f->interval) >= f->framesize) {
				Size += f->framesize;
				f->residue -= f->framesize * f->interval;
			}

			/* Buffer is completed, retransmitting the same file data */
			if ((f->index + Size) > f->disksize)
				f->index = 0;
			else
				f->index += Size;

			f->firstpkt = 0;
		}
	}
}
/*****************************************************************************/
/**
 * This function is ISO IN Endpoint handler/Callback function, called by driver
 * when data is sent to host.
 *
 * @param	CallBackRef is pointer to Usb_DevData instance.
 * @param	RequestedBytes is number of bytes requested to send.
 * @param	BytesTxed is actual number of bytes sent to Host.
 *
 * @return	None
 *
 * @note	None.
 *
 *****************************************************************************/
This function is ISO IN Endpoint handler/Callback function, called by driver
when data is sent to host.

@param       CallBackRef is pointer to Usb_DevData instance.
@param       RequestedBytes is number of bytes requested to send.
@param       BytesTxed is actual number of bytes sent to Host.

@return      None

@note        None.
This function is ISO IN Endpoint handler / Callback function called by driver when data is sent to host . @param CallBackRef is pointer to Usb_DevData instance . @param RequestedBytes is number of bytes requested to send . @param BytesTxed is actual number of bytes sent to Host . @return None @note None .
static void Usb_AudioInHandler(void *CallBackRef, u32 RequestedBytes, u32 BytesTxed)
{
	struct Usb_DevData *InstancePtr = CallBackRef;
	USBCH9_DATA *ch9_ptr =
		(USBCH9_DATA *) Get_DrvData(InstancePtr->PrivateData);
	struct composite_dev *interface = (struct composite_dev *)(ch9_ptr->data_ptr);
	struct audio_if *f = &(interface->f_audio);
	u32 Size;
	Size = f->packetsize;
	f->residue += f->packetresidue;
	if ((f->residue / f->interval) >= f->framesize) {
		Size += f->framesize;
		f->residue -= f->framesize * f->interval;
	}
	if ((f->index + Size) > f->disksize)
		f->index = 0;
	if (EpBufferSend(InstancePtr->PrivateData, ISO_EP,
				f->disk + f->index, Size) == XST_SUCCESS) {
		f->index += Size;
		if (f->firstpkt) {
			Size = f->packetsize;
			f->residue += f->packetresidue;
			if ((f->residue / f->interval) >= f->framesize) {
				Size += f->framesize;
				f->residue -= f->framesize * f->interval;
			}
			if ((f->index + Size) > f->disksize)
				f->index = 0;
			else
				f->index += Size;
			f->firstpkt = 0;
		}
	}
}
static void Usb_AudioInHandler ( void * CallBackRef , u32 RequestedBytes , u32 BytesTxed ) { struct Usb_DevData * InstancePtr = CallBackRef ; USBCH9_DATA * ch9_ptr = ( USBCH9_DATA * ) Get_DrvData ( InstancePtr -> PrivateData ) ; struct composite_dev * interface = ( struct composite_dev * ) ( ch9_ptr -> data_ptr ) ; struct audio_if * f = & ( interface -> f_audio ) ; u32 Size ; Size = f -> packetsize ; f -> residue += f -> packetresidue ; if ( ( f -> residue / f -> interval ) >= f -> framesize ) { Size += f -> framesize ; f -> residue -= f -> framesize * f -> interval ; } if ( ( f -> index + Size ) > f -> disksize ) f -> index = 0 ; if ( EpBufferSend ( InstancePtr -> PrivateData , ISO_EP , f -> disk + f -> index , Size ) == XST_SUCCESS ) { f -> index += Size ; if ( f -> firstpkt ) { Size = f -> packetsize ; f -> residue += f -> packetresidue ; if ( ( f -> residue / f -> interval ) >= f -> framesize ) { Size += f -> framesize ; f -> residue -= f -> framesize * f -> interval ; } if ( ( f -> index + Size ) > f -> disksize ) f -> index = 0 ; else f -> index += Size ; f -> firstpkt = 0 ; } } }
This function is ISO IN Endpoint handler/Callback function, called by driver
 when data is sent to host.
This function is ISO IN Endpoint handler / Callback function called by driver when data is sent to host .
/* Buffer is completed, retransmitting the same file data */ /* Buffer is completed, retransmitting the same file data */