USBMICSetDataConsumed

Syntax

#include <cafe/usb_mic.h>

int USBMICSetDataConsumed(usb_mic_handle_t h_mic, unsigned int c_samples);

Parameters

h_mic Instance handle returned via usb_event_data_t data structure through the event handler of type usb_event_handler_t that is provided as an argument to USBMICInit and will contain a valid instance handle when the USB microphone is attached.
c_samples The number of PCM samples (16-bit signed integer) that the application has taken from the ring buffer.

Return Values

A value of zero indicates success and any other value the type of error that was encountered.

Description

Calling this function will update the ring buffer state in the USB UAC library. The count is in samples, not bytes. One sample is sizeof(short int). Since this function will only update the internal state in the library, it does not matter whether the data were copied or DMA'ed.

Since this function serves the purpose of keeping track of the ring buffer state in the USB microphone library, it is permissible to consume more data than are available. Although that constitutes a ring buffer underflow, there are circumstances under which this can happen and coherent state needs to be preserved in those cases.

This function is designed to be callable from a timing sensitive thread such as an AX callback function.

Do Not Call From

Background Do not call this function from the background.
Interrupt handler Do not call this function from any interrupt handler.
Exception handler Do not call this function from any exception handler.

See Also

USBMICInit
usb_mic_handle_t
Error Codes

Revision History

2013-05-08 Automated cleanup pass.
2012-08-03 Cleanup Pass
2012-07-09 Update for SDK2.06.
2012-01-05 Initial version.


CONFIDENTIAL