Go to the source code of this file.
Left Line Input Channel Volume Control Register | |
#define | DAC_LLI_VOL 0x00 |
Register address. | |
#define | DAC_LLI_VOL_LRS 0x0100 |
Left/right simultaneous volume/mute update. | |
#define | DAC_LLI_VOL_LIM 0x0080 |
Mute. | |
#define | DAC_LLI_VOL_LIV 0x001F |
Volume control mask. | |
#define | DAC_LLI_VOL_LIV_LSB 0 |
Volume control LSB. | |
Right Line Input Channel Volume Control Register | |
#define | DAC_RLI_VOL 0x01 |
Register address. | |
#define | DAC_RLI_VOL_RLS 0x0100 |
Right/left simultaneous volume/mute update. | |
#define | DAC_RLI_VOL_RIM 0x0080 |
Mute. | |
#define | DAC_RLI_VOL_RIV 0x001F |
Volume control mask. | |
#define | DAC_RLI_VOL_RIV_LSB 0 |
Volume control LSB. | |
Left Channel Headphone Volume Control | |
#define | DAC_LHP_VOL 0x02 |
Register address. | |
#define | DAC_LHP_VOL_LRS 0x0100 |
Left/right simultaneous volume/mute update. | |
#define | DAC_LHP_VOL_LZC 0x0080 |
Zero cross detect. | |
#define | DAC_LHP_VOL_LHV 0x007F |
Volume control mask. | |
#define | DAC_LHP_VOL_LHV_LSB 0 |
Volume control LSB. | |
Right Channel Headphone Volume Control | |
#define | DAC_RHP_VOL 0x03 |
Register address. | |
#define | DAC_RHP_VOL_RLS 0x0100 |
Right/left simultaneous volume/mute update. | |
#define | DAC_RHP_VOL_LZC 0x0080 |
Zero cross detect. | |
#define | DAC_RHP_VOL_LHV 0x007F |
Volume control mask. | |
#define | DAC_RHP_VOL_LHV_LSB 0 |
Volume control LSB. | |
Analog Audio Path Control | |
#define | DAC_ANA_PATH 0x04 |
Register address. | |
#define | DAC_ANA_PATH_STA 0x01C0 |
Side tone mask. | |
#define | DAC_ANA_PATH_STA_LSB 6 |
Side tone LSB. | |
#define | DAC_ANA_PATH_STA_0DB 0x0100 |
Added side tone of 0dB. | |
#define | DAC_ANA_PATH_STA_M6DB 0x0000 |
Added side tone of -6dB. | |
#define | DAC_ANA_PATH_STA_M9DB 0x0040 |
Added side tone of -9dB. | |
#define | DAC_ANA_PATH_STA_M12DB 0x0080 |
Added side tone of -12dB. | |
#define | DAC_ANA_PATH_STA_M18DB 0x00C0 |
Added side tone of -18dB. | |
#define | DAC_ANA_PATH_STE 0x0020 |
Side tone enable. | |
#define | DAC_ANA_PATH_DAC 0x0010 |
DAC select. | |
#define | DAC_ANA_PATH_BYP 0x0008 |
Bypass. | |
#define | DAC_ANA_PATH_INSEL 0x0004 |
ADC microphone input. | |
#define | DAC_ANA_PATH_MICM 0x0002 |
Microphone mute. | |
#define | DAC_ANA_PATH_MICB 0x0001 |
Microphone boost. | |
Digital Audio Path Control | |
#define | DAC_DIG_PATH 0x05 |
Register address. | |
#define | DAC_DIG_PATH_DACM 0x0008 |
DAC soft mute. | |
#define | DAC_DIG_PATH_DEEMP 0x0006 |
De-emphases control mask. | |
#define | DAC_DIG_PATH_DEEMP_LSB 1 |
De-emphases control LSB. | |
#define | DAC_DIG_PATH_DEEMP_NONE 0x0000 |
De-emphases disabled. | |
#define | DAC_DIG_PATH_DEEMP_32KHZ 0x0002 |
De-emphases 32 kHz. | |
#define | DAC_DIG_PATH_DEEMP_44_1KHZ 0x0004 |
De-emphases 44.1 kHz. | |
#define | DAC_DIG_PATH_DEEMP_48KHZ 0x0006 |
De-emphases 48 kHz. | |
#define | DAC_DIG_PATH_ADCHP 0x0001 |
ADC high-pass filter. | |
Digital Audio Path Control | |
#define | DAC_PWRDN 0x06 |
Register address. | |
#define | DAC_PWRDN_OFF 0x0080 |
Device power off. | |
#define | DAC_PWRDN_CLK 0x0040 |
Clock off. | |
#define | DAC_PWRDN_OSC 0x0020 |
Oscillator off. | |
#define | DAC_PWRDN_OUT 0x0010 |
Outputs off. | |
#define | DAC_PWRDN_DAC 0x0008 |
DAC off. | |
#define | DAC_PWRDN_ADC 0x0004 |
ADC off. | |
#define | DAC_PWRDN_MIC 0x0002 |
Microphone input off. | |
#define | DAC_PWRDN_LINE 0x0001 |
Line input off. | |
Digital Audio Interface Format | |
#define | DAC_DAI_FMT 0x07 |
Register address. | |
#define | DAC_DAI_FMT_MS 0x0040 |
Maser mode. | |
#define | DAC_DAI_FMT_LRSWAP 0x0020 |
DAC left/right swap. | |
#define | DAC_DAI_FMT_LRP 0x0010 |
DAC left/right phase. | |
#define | DAC_DAI_FMT_IWL 0x000C |
Input bit length mask. | |
#define | DAC_DAI_FMT_IWL_LSB 2 |
Input bit length LSB. | |
#define | DAC_DAI_FMT_IWL_16 0x0000 |
16 bit input length. | |
#define | DAC_DAI_FMT_IWL_20 0x0004 |
20 bit input length. | |
#define | DAC_DAI_FMT_IWL_24 0x0008 |
24 bit input length. | |
#define | DAC_DAI_FMT_IWL_32 0x000C |
32 bit input length. | |
#define | DAC_DAI_FMT_FOR 0x0003 |
Data format mask. | |
#define | DAC_DAI_FMT_FOR_LSB 0 |
Data format LSB. | |
#define | DAC_DAI_FMT_FOR_RA 0x0000 |
MSB first, right aligned. | |
#define | DAC_DAI_FMT_FOR_LA 0x0001 |
MSB first, left aligned. | |
#define | DAC_DAI_FMT_FOR_I2S 0x0002 |
I2S format, MSB first, left – 1 aligned. | |
#define | DAC_DAI_FMT_FOR_DSP 0x0003 |
DSP format, frame sync followed by two data words. | |
Sample Rate Control | |
#define | DAC_SRATE 0x08 |
Register address. | |
#define | DAC_SRATE_CLKOUT 0x0080 |
Clock output divider. | |
#define | DAC_SRATE_CLKIN 0x0040 |
Clock input divider. | |
#define | DAC_SRATE_SR 0x003C |
Sampling rate mask. | |
#define | DAC_SRATE_SR_LSB 2 |
Sampling rate LSB. | |
#define | DAC_SRATE_BOSR 0x0002 |
Base oversampling rate. | |
#define | DAC_SRATE_USB 0x0001 |
USB clock mode. | |
Digital Interface Activation | |
#define | DAC_DI_ACT 0x09 |
Register address. | |
#define | DAC_DI_ACT_ACT 0x0001 |
Interface active. | |
Reset Register | |
#define | DAC_RESET 0x0F |
Register address. | |
Defines | |
#define | DAC_MAX_VOLUME 6 |
#define | DAC_MIN_VOLUME -73 |
Functions | |
int | Tlv320DacInit (unsigned int rate) |
Initialize TLV320AIC23B DAC interface. | |
int | Tlv320DacWrite (void *buf, int len) |
Add audio samples to the TLV320AIC23B transmit queue. | |
int | Tlv320DacFlush (void) |
Wait until all buffered samples have been transmitted. | |
u_char | Tlv320DacReadReg (unsigned int reg) |
Read value from specified DAC register. | |
void | Tlv320DacWriteReg (unsigned int reg, unsigned int val) |
Write value to specified DAC register. | |
int | Tlv320DacSetVolume (int left, int right) |
Set volume. | |
int | Tlv320DacSetRate (unsigned int rate) |
int | Tlv320SwitchMode (void) |
Copyright (C) 2007 by egnite Software GmbH. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of the copyright holders nor the names of contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY EGNITE SOFTWARE GMBH AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL EGNITE SOFTWARE GMBH OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
For additional information see http://www.ethernut.de/
* * $Log$ * Revision 1.2 2009/01/17 11:26:47 haraldkipp * Getting rid of two remaining BSD types in favor of stdint. * Replaced 'u_int' by 'unsinged int' and 'uptr_t' by 'uintptr_t'. * * Revision 1.1 2008/10/05 16:51:46 haraldkipp * Added suport for the TLV320 audio DAC. * * *
Definition in file tlv320dac.h.
#define DAC_LLI_VOL 0x00 |
#define DAC_LLI_VOL_LRS 0x0100 |
#define DAC_LLI_VOL_LIM 0x0080 |
#define DAC_LLI_VOL_LIV 0x001F |
Volume control mask.
From 0x00 (-34.5dB) to 0x1F (+12dB) in 1.5dB steps.
Definition at line 59 of file tlv320dac.h.
#define DAC_LLI_VOL_LIV_LSB 0 |
#define DAC_RLI_VOL 0x01 |
#define DAC_RLI_VOL_RLS 0x0100 |
#define DAC_RLI_VOL_RIM 0x0080 |
#define DAC_RLI_VOL_RIV 0x001F |
Volume control mask.
From 0x00 (-34.5dB) to 0x1F (+12dB) in 1.5dB steps.
Definition at line 71 of file tlv320dac.h.
#define DAC_RLI_VOL_RIV_LSB 0 |
#define DAC_LHP_VOL 0x02 |
Register address.
Definition at line 81 of file tlv320dac.h.
Referenced by Tlv320DacInit(), and Tlv320DacSetVolume().
#define DAC_LHP_VOL_LRS 0x0100 |
Left/right simultaneous volume/mute update.
Definition at line 82 of file tlv320dac.h.
Referenced by Tlv320DacInit().
#define DAC_LHP_VOL_LZC 0x0080 |
#define DAC_LHP_VOL_LHV 0x007F |
Volume control mask.
From 0x30 (-73dB, mute) to 0x3F (+6dB).
Definition at line 84 of file tlv320dac.h.
#define DAC_LHP_VOL_LHV_LSB 0 |
#define DAC_RHP_VOL 0x03 |
#define DAC_RHP_VOL_RLS 0x0100 |
#define DAC_RHP_VOL_LZC 0x0080 |
#define DAC_RHP_VOL_LHV 0x007F |
Volume control mask.
From 0x30 (-73dB, mute) to 0x3F (+6dB).
Definition at line 96 of file tlv320dac.h.
#define DAC_RHP_VOL_LHV_LSB 0 |
#define DAC_ANA_PATH 0x04 |
#define DAC_ANA_PATH_STA 0x01C0 |
#define DAC_ANA_PATH_STA_LSB 6 |
#define DAC_ANA_PATH_STA_0DB 0x0100 |
#define DAC_ANA_PATH_STA_M6DB 0x0000 |
#define DAC_ANA_PATH_STA_M9DB 0x0040 |
#define DAC_ANA_PATH_STA_M12DB 0x0080 |
#define DAC_ANA_PATH_STA_M18DB 0x00C0 |
#define DAC_ANA_PATH_STE 0x0020 |
#define DAC_ANA_PATH_DAC 0x0010 |
#define DAC_ANA_PATH_BYP 0x0008 |
#define DAC_ANA_PATH_INSEL 0x0004 |
#define DAC_ANA_PATH_MICM 0x0002 |
#define DAC_ANA_PATH_MICB 0x0001 |
#define DAC_DIG_PATH 0x05 |
#define DAC_DIG_PATH_DACM 0x0008 |
#define DAC_DIG_PATH_DEEMP 0x0006 |
#define DAC_DIG_PATH_DEEMP_LSB 1 |
#define DAC_DIG_PATH_DEEMP_NONE 0x0000 |
#define DAC_DIG_PATH_DEEMP_32KHZ 0x0002 |
#define DAC_DIG_PATH_DEEMP_44_1KHZ 0x0004 |
#define DAC_DIG_PATH_DEEMP_48KHZ 0x0006 |
#define DAC_DIG_PATH_ADCHP 0x0001 |
#define DAC_PWRDN 0x06 |
#define DAC_PWRDN_OFF 0x0080 |
#define DAC_PWRDN_CLK 0x0040 |
#define DAC_PWRDN_OSC 0x0020 |
#define DAC_PWRDN_OUT 0x0010 |
#define DAC_PWRDN_DAC 0x0008 |
#define DAC_PWRDN_ADC 0x0004 |
#define DAC_PWRDN_MIC 0x0002 |
#define DAC_PWRDN_LINE 0x0001 |
#define DAC_DAI_FMT 0x07 |
#define DAC_DAI_FMT_MS 0x0040 |
#define DAC_DAI_FMT_LRSWAP 0x0020 |
#define DAC_DAI_FMT_LRP 0x0010 |
#define DAC_DAI_FMT_IWL 0x000C |
#define DAC_DAI_FMT_IWL_LSB 2 |
#define DAC_DAI_FMT_IWL_16 0x0000 |
#define DAC_DAI_FMT_IWL_20 0x0004 |
#define DAC_DAI_FMT_IWL_24 0x0008 |
#define DAC_DAI_FMT_IWL_32 0x000C |
#define DAC_DAI_FMT_FOR 0x0003 |
#define DAC_DAI_FMT_FOR_LSB 0 |
#define DAC_DAI_FMT_FOR_RA 0x0000 |
#define DAC_DAI_FMT_FOR_LA 0x0001 |
#define DAC_DAI_FMT_FOR_I2S 0x0002 |
I2S format, MSB first, left – 1 aligned.
Definition at line 163 of file tlv320dac.h.
Referenced by Tlv320DacInit().
#define DAC_DAI_FMT_FOR_DSP 0x0003 |
#define DAC_SRATE 0x08 |
#define DAC_SRATE_CLKOUT 0x0080 |
#define DAC_SRATE_CLKIN 0x0040 |
#define DAC_SRATE_SR 0x003C |
#define DAC_SRATE_SR_LSB 2 |
#define DAC_SRATE_BOSR 0x0002 |
Base oversampling rate.
USB mode : 0=250 fs, 1=272 fs Normal mode: 0=256 fs, 1=384 fs
Definition at line 174 of file tlv320dac.h.
Referenced by Tlv320DacSetRate().
#define DAC_SRATE_USB 0x0001 |
#define DAC_DI_ACT 0x09 |
#define DAC_DI_ACT_ACT 0x0001 |
#define DAC_RESET 0x0F |
Register address.
Writing zero to this register triggers reset.
Definition at line 190 of file tlv320dac.h.
Referenced by Tlv320DacInit().
#define DAC_MAX_VOLUME 6 |
#define DAC_MIN_VOLUME -73 |
int Tlv320DacInit | ( | unsigned int | rate | ) |
Initialize TLV320AIC23B DAC interface.
rate | Sample rate. |
Definition at line 361 of file tlv320dac.c.
int Tlv320DacWrite | ( | void * | buf, | |
int | len | |||
) |
Add audio samples to the TLV320AIC23B transmit queue.
buf | Points to PCM data. | |
len | Number of samples. |
Definition at line 440 of file tlv320dac.c.
int Tlv320DacFlush | ( | void | ) |
Wait until all buffered samples have been transmitted.
Definition at line 419 of file tlv320dac.c.
u_char Tlv320DacReadReg | ( | unsigned int | reg | ) |
Read value from specified DAC register.
Not implemented, because the TLV320AIC23B is a write-only device.
reg | DAC register address. |
Definition at line 214 of file tlv320dac.c.
void Tlv320DacWriteReg | ( | unsigned int | reg, | |
unsigned int | val | |||
) |
Write value to specified DAC register.
Communicates with the DAC chip via TWI.
reg | DAC register address. | |
val | Value to store in specified register. |
Definition at line 227 of file tlv320dac.c.
Referenced by Tlv320DacInit(), Tlv320DacSetRate(), and Tlv320DacSetVolume().
int Tlv320DacSetVolume | ( | int | left, | |
int | right | |||
) |
Set volume.
Sets the master playback gain. Range is +6..-73 dB.
left | Left channel gain in dB. | |
right | Right channel gain in dB. |
Definition at line 496 of file tlv320dac.c.
int Tlv320DacSetRate | ( | unsigned int | rate | ) |
int Tlv320SwitchMode | ( | void | ) |
Definition at line 517 of file tlv320dac.c.