MICInit

Syntax

#include <cafe/mic.h>

mic_handle_t    MICInit(mic_inst_t instance, mem_res_t* p_res,
                        mic_ringbuffer_t* p_rb, int* perr);

Parameters

instance Instance of the device to initialize for use. Valid values are mic_inst_0 and mic_inst_1.
p_res Unused argument.
p_rb Pointer to the ring buffer used for data transfer between this driver and the upper-layer software.
perr Pointer to the variable that will contain the specific error code.

Return Values

A return value of MIC_ERROR_NONE (0) indicates success and -1 indicates an error. In the case of an error, perr is set.

MIC_ERROR_INV_ARG is returned when one or more of the arguments are invalid for the context of this API call. MIC_ERROR_ALREADY_OPEN is returned if an attempt is made to initialize more than once. MIC_ERROR_NOT_CONNECTED is returned when the DRC and the console have lost connection and are presently not connected. The preferred way of polling connection status with the DRC via the DRC microphone library is calling MICInit and checking for this error value.

Description

Validates the given parameters and then initializes the driver stack. The ring buffer shared between the upper-layer software and the microphone driver is provided with this call and validated.

The DRC microphone system can become uninitialized in three different ways: calling MICUninit, the console and DRC become disconnected, and releasing the foreground. The DRC microphone policy is to leave underlying hardware quiescent and to shut down the driver stack if any of those events occur. The DRC microphone library will not attempt to re-establish prior state when the DRC is reconnected or being switched back to foreground. After being uninitialized, the ring buffer will no longer be referenced by the DRC microphone library and the application can safely free or reuse that memory.

The processing performed in MICInit is lightweight and calling this function to poll the connection status can be performed from a timing sensitive thread.

Do Not Call From

Background Do not call this function from the background.
Multiple threads This function is not thread-safe.
Interrupt handler Do not call this function from any interrupt handler.
Exception handler Do not call this function from any exception handler.

See Also

MICUninit
mic_handle_t
mic_ringbuffer_t
Error Codes

Revision History

2013/05/08 Automated cleanup pass.
2012/08/03 Cleanup Pass.
2011/10/27 Initial version.


CONFIDENTIAL