API References

I approach APIs the way I approach user documentation in general: I do everything I can to provide users the information they need to do their jobs. I keep asking questions, and I know enough C/C++ and Java to understand the answers. I have used these skills to develop and improve several API references.

For example, when I added an audio class to an API reference, I began with little more than a source listing and an SME name.

Sample Function

usb_audio_get_iso_ep_address()

Get the ISO endpoint address of an audio stream.

Synopsis
USB_STATUS usb_audio_get_iso_ep_address(
   CLASS_CALL_STRUCT_PTR cc_ptr,
   uint_8 bDirection,
   uint_8* bEP)
Parameters
     cc_ptr[IN]Device instance handle
     bDirection[IN]Audio stream direction
     bEP[OUT]ISO EP address
Returns
Description

Use this function to get the ISO endpoint address (bEP) as a parameter for audio-class-request function calls.

Example

This example, from the AudDrv.c example file included in your installation, gets the ISO endpoint address bUnit, and uses it as a parameter to call usb_host_aud_set_ class_ep_ctlr() to set the current sampling frequency.

usbStatus = usb_audio_get_iso_ep_address((CLASS_CALL_STRUCT_ PTR)&aud_device.CLASS_INTF, AUD_DIRECTION_OUT, &bUnit);    
   if (usbStatus == USB_OK) {
      htou32(data_buf, dwSampFreq);
      usbStatus = usb_host_aud_set_class_ep_ctlr(AUD_SET_CUR,
      AUD_EP_SAMPLE_FREQ,bUnit,3,data_buf);

      if (usbStatus == AUD_OK) {
         printf("SET_CUR Sample Frequence to 0x%x for EP %x.\n",
         dwSampFreq, bUnit);

           fflush(stdout);
                               }
                            }


650-787-9241