USBMICOpen

Syntax

#include <cafe/usb_mic.h>

int USBMICOpen(usb_mic_handle_t h_mic, mem_res_t* p_mem_res, usb_mic_ringbuffer_t* prb);

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.
p_mem_res A pointer to a structure of type mem_res_t. Deprecated. The number of resources returned by USBMICOpenQuery is always zero.
prb A pointer to a ringbuffer structure of type usb_mic_ringbuffer_t. The minimal alignment of the memory buffer is 4 bytes. This memory can be used for DMA by the AX subsystem.

Return Values

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

Description

Calling this function will prepare the USB UAC stack and put it into a state of readiness. This function will only succeed if sufficient memory resources and ring buffer are provided. All resources referenced in calling USBMICOpen must remain allocated and accessible to the USB UAC stack until USBMICClose or USBMICUninit is called. Only the memory referenced in the ring buffer is shared between the USB UAC stack and the hierarchically higher level process. All other memory resources are for the exclusive use of the USB UAC stack.

The streaming of PCM data does not start until USBMICStart is called.

NOTE:
This function can be called from the event handler that was provided with USBMICInit.

This function is affected by foreground/background switching. Upon releasing foreground, an application is required to call USBMICStop, USBMICClose, and USBMICUninit to fully shut down the UAC driver stack. When foreground status is reacquired, an application needs to go through the sequence of USBMICInit and device discovery again.

This function requires several milliseconds to complete, although much of that time is spent waiting on synchronization objects. It is not recommended to call this function from a timing sensitive thread.

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
USBMICUninit
USBMICOpenQuery
USBMICClose
USBMICStart
USBMICStop
mem_res_t
usb_event_handler_t
usb_mic_ringbuffer_t
usb_mic_handle_t
Error Codes

Revision History

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


CONFIDENTIAL