Following some samples codes and here are couple sections from it;
/*******************************************************************
* global variables and defines
*******************************************************************/
#define LEFT_LINE_IN 0x0000
#define RIGHT_LINE_IN 0x0200
#define LEFT_HEADPHONE_OUT 0x0400
#define RIGHT_HEADPHONE_OUT 0x0600
#define ANALOG_AUDIO_PATH_CONTROL 0x0800
#define DIGITAL_AUDIO_PATH_CONTROL 0x0a00
#define POWER_DOWN_CONTROL 0x0c00
#define DIGITAL_AUDIO_INTERFACE_FORMAT 0x0e00
#define SAMPLING_CONTROL 0x1000
#define ACTIVE_CONTROL 0x1200
#define RESET_CONTROL 0x1E00
#define CODEC_REGS_LENGTH | 9 |
volatile short sCodecTxRegs[CODEC_REGS_LENGTH] =
{
LEFT_LINE_IN | 0x01b, /* greater than 0db volume */
RIGHT_LINE_IN | 0x01b, /* greater than 0db volume */
LEFT_HEADPHONE_OUT | 0x07f, /* gain */
RIGHT_HEADPHONE_OUT | 0x07f, /* gain */
ANALOG_AUDIO_PATH_CONTROL | 0x010,
DIGITAL_AUDIO_PATH_CONTROL | 0x000,
POWER_DOWN_CONTROL | 0x000,
DIGITAL_AUDIO_INTERFACE_FORMAT | 0x042,
SAMPLING_CONTROL | 0x000, /* set Normal mode */
};
I can understand that sCodecTxRegs[] is a array of 9 with elements of two bytes long. however, I am not sure how the contents of this array is written to the Codec registers since it only been used twice later in the code as follow:
if( bMicInLineOut )
{
bMicInLineOut = false;
/* INSEL = Line Input Select to ADC */
sCodecTxRegs[4] &= 0xFFFB;
}
else
{
bMicInLineOut = true;
/* INSEL = Microphone Input Select to ADC */
sCodecTxRegs[4] |= 0x4;
}
Could someone tell me if sCodecTxRegs[] is a defined function so that the content would be written to the CODEC without any other code?
Thanks in advance
--Neo