/*---------------------------------------------------------------------------* Copyright (C) Nintendo. All rights reserved. These coded instructions, statements, and computer programs contain proprietary information of Nintendo of America Inc. and/or Nintendo Company Ltd., and are protected by Federal copyright law. They may not be disclosed to third parties or copied or duplicated in any form, in whole or in part, without the prior written consent of Nintendo. *---------------------------------------------------------------------------*/ /* * CCR UAC Microphone Driver Defines, Types, and Prototypes * Created by Gunter M. Zieber, September 13, 2011 */ #ifndef __UAC_MIC__ #define __UAC_MIC__ #ifdef __cplusplus extern "C" { #endif #include typedef short int mic_pcm_sample_t; typedef enum { mic_state_sample_rate, mic_state_gain_db, mic_state_gain_min, mic_state_gain_max, mic_state_gain_step, mic_state_mute, mic_state_reserved1, mic_state_echo_cancellation, mic_state_auto_selection, mic_state_digital_gain_db } mic_state_t; typedef struct { unsigned long int modulus; mic_pcm_sample_t* base; } mic_ringbuffer_t; typedef struct { unsigned long int flags; unsigned long int available; unsigned long int read_idx; } mic_status_t; #define MIC_STATUS_FLAG_PCM16 (1 << 0) #define MIC_STATUS_FLAG_OPEN (1 << 1) #define MIC_STATUS_FLAG_CONNECTED (1 << 2) typedef enum { mic_inst_0, mic_inst_1, mic_inst_num } mic_inst_t; typedef int mic_handle_t; /* * Error Codes */ #define MIC_ERROR_NONE 0 #define MIC_ERROR_NOT_SUP (-1) #define MIC_ERROR_INV_ARG (-2) #define MIC_ERROR_INV_STATE (-3) #define MIC_ERROR_NO_MEM (-4) #define MIC_ERROR_ALREADY_OPEN (-5) #define MIC_ERROR_NOT_OPEN (-6) #define MIC_ERROR_NOT_INIT (-7) #define MIC_ERROR_NOT_CONNECTED (-8) /* * API Function Prototypes */ int MICQueryResources(mic_inst_t instance, mem_res_query_t* p_res_query); mic_handle_t MICInit(mic_inst_t instance, mem_res_t* p_res, mic_ringbuffer_t* p_rb, int* perr); int MICUninit(mic_handle_t h_mic); int MICOpen(mic_handle_t h_mic); int MICGetStatus(mic_handle_t h_mic, mic_status_t* p_status); int MICSetDataConsumed(mic_handle_t h_mic, unsigned int c_samples); int MICSetState(mic_handle_t h_mic, mic_state_t state, unsigned int value); int MICGetState(mic_handle_t h_mic, mic_state_t state, unsigned int* p_value); int MICClose(mic_handle_t h_mic); #ifdef __cplusplus } #endif #endif // __UAC_MIC__