usb
Vitis Drivers API Documentation
xusb_microphone.c File Reference

Overview

This file contains usb Microphone application related functions.

This example only provides a reference as to how an isochronous transfer related application can be written. This example emulates a microphone and when connected to a Windows PC will be detected as a Microphone and if we open sound recorder and start recording data, this example sends data on isochronous endpoint and the PC can store this data. Noise will be heard when this data is played on the PC.

Note
None.
MODIFICATION HISTORY:
Ver   Who  Date     Changes


1.00a hvm 12/20/10 First release 4.01a bss 11/01/11 Modified UsbIfIntrHandler function to unconditionally reset when USB reset is asserted (CR 627574). 4.02a bss 02/20/12 Modified main function to call Xil_DCacheFlushRange when DMA is enabled.(CR 640005) 5.6 pm 07/05/23 Removed powerpc support. 5.6 pm 07/05/23 Added support for system device-tree flow.

 

Functions

int main ()
 This main function starts the USB Intrerrupt example. More...
 
void InitUsbInterface (XUsb *InstancePtr)
 This is the USB initialization function. More...
 
void UsbIfIntrHandler (void *CallBackRef, u32 IntrStatus)
 This function is the interrupt handler for the USB microphone device application. More...
 
void Ep0IntrHandler (void *CallBackRef, u8 EpNum, u32 IntrStatus)
 This function is the interrupt handler for the USB End point Zero events. More...
 
void Ep1IntrHandler (void *CallBackRef, u8 EpNum, u32 IntrStatus)
 This function is the interrupt handler for the USB End point one events. More...
 

Function Documentation

void Ep0IntrHandler ( void *  CallBackRef,
u8  EpNum,
u32  IntrStatus 
)

This function is the interrupt handler for the USB End point Zero events.

Parameters
CallBackRefis the callback reference passed from the interrupt. handler, which in our case is a pointer to the driver instance.
EpNumis the end point number.
IntrStatusis a bit mask indicating pending interrupts.
Returns
None.
Note
EpNum is not used in this function as the handler is attached specific to end point zero. This parameter is useful when a single handler is used for processing all end point interrupts.

References XUsb_Config::BaseAddress, Chapter9(), XUsb::Config, XUsb::EndPointOffset, EP0ProcessInToken(), EP0ProcessOutToken(), XUSB_BUFFREADY_EP0_BUFF_MASK, XUSB_BUFFREADY_OFFSET, XUSB_EP_CFG_DATA_TOGGLE_MASK, XUsb_IntrEnable(), XUsb_ReadReg, XUSB_STATUS_DISCONNECT_MASK, XUSB_STATUS_FIFO_BUFF_FREE_MASK, XUSB_STATUS_FIFO_BUFF_RDY_MASK, XUSB_STATUS_RESET_MASK, XUSB_STATUS_SETUP_PACKET_MASK, XUSB_STATUS_SUSPEND_MASK, and XUsb_WriteReg.

void Ep1IntrHandler ( void *  CallBackRef,
u8  EpNum,
u32  IntrStatus 
)

This function is the interrupt handler for the USB End point one events.

Parameters
CallBackRefis the callback reference passed from the interrupt handler, which in our case is a pointer to the driver instance.
EpNumis the end point number.
IntrStatusis a bit mask indicating pending interrupts.
Returns
None.
Note
EpNum is not used in this function as the handler is attached specific to end point one. This parameter is useful when a single handler is used for processing all end point interrupts.

References XUsb_EpConfig::Buffer0Ready, XUsb_EpConfig::Buffer1Ready, XUsb::DeviceConfig, XUsb_DeviceConfig::Ep, XUSB_BUFFREADY_EP1_BUFF1_MASK, and XUSB_BUFFREADY_EP1_BUFF2_MASK.

void InitUsbInterface ( XUsb InstancePtr)

This is the USB initialization function.

This example initializes the device for Microphone Application. The following configuration is done.

  • EP0 : CONTROL end point, Bidirectional, Packet size 64 bytes.
  • EP1 : ISOCHRONOUS, BULK_IN, packet size 1024 bytes.
Parameters
InstancePtris a pointer to the XUsb instance.
Returns
None.
Note
None.

References XUsb::DeviceConfig, XUsb_DeviceConfig::Ep, XUsb_EpConfig::EpType, XUsb_DeviceConfig::NumEndpoints, XUsb_EpConfig::OutIn, XUsb_EpConfig::RamBase, XUsb_EpConfig::Size, XUsb_ConfigureDevice(), XUSB_EP_DIRECTION_IN, XUSB_EP_DIRECTION_OUT, and XUsb_EpEnable().

void UsbIfIntrHandler ( void *  CallBackRef,
u32  IntrStatus 
)

This function is the interrupt handler for the USB microphone device application.

This function is the interrupt handler for the USB mass storage device application.

Parameters
CallBackRefis the callback reference passed from the interrupt handler, which in our case is a pointer to the driver instance.
IntrStatusis a bit mask indicating pending interrupts.
Returns
None.
Note
None.

References XUsb_Config::BaseAddress, XUsb::Config, XUsb_DeviceConfig::CurrentConfiguration, XUsb::DeviceConfig, InitUsbInterface(), XUsb_DeviceConfig::Status, XUsb_IntrDisable(), XUsb_IntrEnable(), XUSB_RESET, XUsb_SetDeviceAddress(), XUsb_Start(), XUSB_STATUS_DISCONNECT_MASK, XUSB_STATUS_RESET_MASK, XUSB_STATUS_SUSPEND_MASK, XUsb_Stop(), and XUsb_WriteReg.