1 /*---------------------------------------------------------------------------* 2 3 Copyright (C) 2009-2013 Nintendo. All rights reserved. 4 5 These coded instructions, statements, and computer programs contain 6 proprietary information of Nintendo of America Inc. and/or Nintendo 7 Company Ltd., and are protected by Federal copyright law. They may 8 not be disclosed to third parties or copied or duplicated in any form, 9 in whole or in part, without the prior written consent of Nintendo. 10 11 *---------------------------------------------------------------------------*/ 12 /* 13 * CCR UAC Microphone Driver Defines, Types, and Prototypes 14 * Created by Gunter M. Zieber, September 13, 2011 15 */ 16 #ifndef __UAC_MIC__ 17 #define __UAC_MIC__ 18 19 #ifdef __cplusplus 20 extern "C" { 21 #endif 22 23 #include <cafe/mem_res.h> 24 25 typedef short int mic_pcm_sample_t; 26 27 typedef enum { 28 mic_state_sample_rate, 29 mic_state_gain_db, 30 mic_state_gain_min, 31 mic_state_gain_max, 32 mic_state_gain_step, 33 mic_state_mute, 34 mic_state_reserved1, 35 mic_state_echo_cancellation, 36 mic_state_auto_selection, 37 mic_state_digital_gain_db 38 } mic_state_t; 39 40 typedef struct { 41 unsigned long int modulus; 42 mic_pcm_sample_t* base; 43 } mic_ringbuffer_t; 44 45 typedef struct { 46 unsigned long int flags; 47 unsigned long int available; 48 unsigned long int read_idx; 49 } mic_status_t; 50 51 #define MIC_STATUS_FLAG_PCM16 (1 << 0) 52 #define MIC_STATUS_FLAG_OPEN (1 << 1) 53 #define MIC_STATUS_FLAG_CONNECTED (1 << 2) 54 55 typedef enum { 56 mic_inst_0, 57 mic_inst_1, 58 mic_inst_num 59 } mic_inst_t; 60 61 typedef int mic_handle_t; 62 /* 63 * Error Codes 64 */ 65 #define MIC_ERROR_NONE 0 66 #define MIC_ERROR_NOT_SUP (-1) 67 #define MIC_ERROR_INV_ARG (-2) 68 #define MIC_ERROR_INV_STATE (-3) 69 #define MIC_ERROR_NO_MEM (-4) 70 #define MIC_ERROR_ALREADY_OPEN (-5) 71 #define MIC_ERROR_NOT_OPEN (-6) 72 #define MIC_ERROR_NOT_INIT (-7) 73 #define MIC_ERROR_NOT_CONNECTED (-8) 74 /* 75 * API Function Prototypes 76 */ 77 int MICQueryResources(mic_inst_t instance, mem_res_query_t* p_res_query); 78 mic_handle_t MICInit(mic_inst_t instance, mem_res_t* p_res, mic_ringbuffer_t* p_rb, int* perr); 79 int MICUninit(mic_handle_t h_mic); 80 int MICOpen(mic_handle_t h_mic); 81 int MICGetStatus(mic_handle_t h_mic, mic_status_t* p_status); 82 int MICSetDataConsumed(mic_handle_t h_mic, unsigned int c_samples); 83 int MICSetState(mic_handle_t h_mic, mic_state_t state, unsigned int value); 84 int MICGetState(mic_handle_t h_mic, mic_state_t state, unsigned int* p_value); 85 int MICClose(mic_handle_t h_mic); 86 87 #ifdef __cplusplus 88 } 89 #endif 90 91 #endif // __UAC_MIC__ 92