1 /*---------------------------------------------------------------------------*
2   Project:  TwlSDK - snd - include
3   File:     sndex_common.h
4 
5   Copyright 2008 Nintendo. All rights reserved.
6 
7   These coded instructions, statements, and computer programs contain
8   proprietary information of Nintendo of America Inc. and/or Nintendo
9   Company Ltd., and are protected by Federal copyright law. They may
10   not be disclosed to third parties or copied or duplicated in any form,
11   in whole or in part, without the prior written consent of Nintendo.
12 
13   $Date:: 2009-01-22#$
14   $Rev: 9913 $
15   $Author: nishimoto_takashi $
16  *---------------------------------------------------------------------------*/
17 #ifndef TWL_SND_COMMON_SNDEX_COMMON_H_
18 #define TWL_SND_COMMON_SNDEX_COMMON_H_
19 #ifdef  __cplusplus
20 extern  "C" {
21 #endif
22 /*---------------------------------------------------------------------------*/
23 
24 /*---------------------------------------------------------------------------*
25     Constant Definitions
26  *---------------------------------------------------------------------------*/
27 /* PXI Command Format */
28 #define     SNDEX_PXI_COMMAND_MASK              0x00ff0000
29 #define     SNDEX_PXI_COMMAND_SHIFT             16
30 #define     SNDEX_PXI_RESULT_MASK               0x0000ff00
31 #define     SNDEX_PXI_RESULT_SHIFT              8
32 #define     SNDEX_PXI_PARAMETER_MASK            0x000000ff
33 #define     SNDEX_PXI_PARAMETER_SHIFT           0
34 #define     SNDEX_PXI_PARAMETER_MASK_IIR        0x0000ffff
35 #define     SNDEX_PXI_PARAMETER_SHIFT_IIR       0
36 
37 // Master list of parameters related to getting and setting the volume
38 #define     SNDEX_PXI_PARAMETER_MASK_VOL_VALUE  0x1f	// Speaker volume
39 #define     SNDEX_PXI_PARAMETER_MASK_VOL_KEEP   0x80	// Maintained value for pending speaker volume
40 #define     SNDEX_PXI_PARAMETER_SHIFT_VOL_KEEP  7
41 #define     SNDEX_PXI_PARAMETER_MASK_VOL_8LV    0x40	// Speaker volume (8 levels)
42 #define     SNDEX_PXI_PARAMETER_SHIFT_VOL_8LV   6
43 
44 /* PXI Command Types */
45 #define     SNDEX_PXI_COMMAND_GET_SMIX_MUTE           0x01    // Get the mute state
46 #define     SNDEX_PXI_COMMAND_GET_SMIX_FREQ           0x02    // Get the I2S frequency
47 #define     SNDEX_PXI_COMMAND_GET_SMIX_DSP            0x03    // Get the CPU/DSP output mix rate
48 #define     SNDEX_PXI_COMMAND_GET_VOLUME              0x04    // Get the volume
49 #define     SNDEX_PXI_COMMAND_GET_SND_DEVICE          0x05    // Get the setting for the audio output device
50 #define     SNDEX_PXI_COMMAND_SET_SMIX_MUTE           0x81    // Change the mute state
51 #define     SNDEX_PXI_COMMAND_SET_SMIX_FREQ           0x82    // Change the I2S frequency
52 #define     SNDEX_PXI_COMMAND_SET_SMIX_DSP            0x83    // Change the CPU/DSP output mix rate
53 #define     SNDEX_PXI_COMMAND_SET_VOLUME              0x84    // Change the volume
54 #define     SNDEX_PXI_COMMAND_SET_SND_DEVICE          0x85    // Change the setting for the audio output device
55 #define     SNDEX_PXI_COMMAND_SET_IIRFILTER_TARGET    0xc1    // Notification indicating where to apply IIR filters
56 #define     SNDEX_PXI_COMMAND_SET_IIRFILTER_PARAM_N0  0xc2    // Notification for IIR filter parameters
57 #define     SNDEX_PXI_COMMAND_SET_IIRFILTER_PARAM_N1  0xc3    // Notification for IIR filter parameters
58 #define     SNDEX_PXI_COMMAND_SET_IIRFILTER_PARAM_N2  0xc4    // Notification for IIR filter parameters
59 #define     SNDEX_PXI_COMMAND_SET_IIRFILTER_PARAM_D1  0xc5    // Notification for IIR filter parameters
60 #define     SNDEX_PXI_COMMAND_SET_IIRFILTER_PARAM_D2  0xc6    // Notification for IIR filter parameters
61 #define     SNDEX_PXI_COMMAND_SET_IIRFILTER           0xc7    // IIR filter registration
62 #define     SNDEX_PXI_COMMAND_PRE_PROC_SHUTTER        0xfb    // Pre-processing for shutter sound playback
63 #define     SNDEX_PXI_COMMAND_POST_PROC_SHUTTER       0xfc    // Post-processing for shutter sound playback
64 #define     SNDEX_PXI_COMMAND_PRESS_VOLSWITCH         0xfd    // Notification for a volume control press
65 #define     SNDEX_PXI_COMMAND_HP_CONNECT              0xfe    // Whether there are headphones connected
66 
67 /* Processing result types for PXI commands */
68 #define     SNDEX_PXI_RESULT_SUCCESS            0x00    // success
69 #define     SNDEX_PXI_RESULT_INVALID_COMMAND    0x01    // Unknown command
70 #define     SNDEX_PXI_RESULT_INVALID_PARAM      0x02    // Unknown parameter
71 #define     SNDEX_PXI_RESULT_EXCLUSIVE          0x03    // Exclusion control in effect
72 #define     SNDEX_PXI_RESULT_ILLEGAL_STATE      0x04    // Unprocessable state (non-mutex)
73 #define     SNDEX_PXI_RESULT_DEVICE_ERROR       0x05    // A device operation failed
74 #define     SNDEX_PXI_RESULT_FATAL_ERROR        0xff    // Fatal error that should not occur
75 
76 /* List of mute setting values for audio output */
77 #define     SNDEX_SMIX_MUTE_OFF                 0x00    // Audible
78 #define     SNDEX_SMIX_MUTE_ON                  0x01    // Muted
79 
80 /* List of values for the I2S frequency setting */
81 #define     SNDEX_SMIX_FREQ_32730               0x00    // 32.73 kHz
82 #define     SNDEX_SMIX_FREQ_47610               0x01    // 47.61 kHz
83 
84 /* List of values for the audio output device setting */
85 #define     SNDEX_MCU_DEVICE_AUTO               0x00    // Automatically select the output target according to the state
86 #define     SNDEX_MCU_DEVICE_SPEAKER            0x01    // Output only to the speakers
87 #define     SNDEX_MCU_DEVICE_HEADPHONE          0x02    // Output only to the headphones
88 #define     SNDEX_MCU_DEVICE_BOTH               0x03    // Output to both the speakers and headphones
89 
90 /* List of setting values for forced audio output through the speakers */
91 #define     SNDEX_FORCEOUT_OFF                  0x00    // Normal setting
92 #define     SNDEX_FORCEOUT_CAMERA_SHUTTER_ON    0x01    // State with forced output when the camera takes a photo
93 
94 /*---------------------------------------------------------------------------*/
95 #ifdef __cplusplus
96 }   // extern "C"
97 #endif
98 #endif  // TWL_SND_COMMON_SNDEX_COMMON_H_
99