diff options
| author | Michael Sevakis <jethead71@rockbox.org> | 2008-12-12 11:01:07 +0000 |
|---|---|---|
| committer | Michael Sevakis <jethead71@rockbox.org> | 2008-12-12 11:01:07 +0000 |
| commit | e69d567d9ebf7d236ff9663b11ac396cc71dcd75 (patch) | |
| tree | 093b9d1bc979d79be1fcd0daac1d8daf8ac55503 /firmware/drivers/audio/tlv320.c | |
| parent | 0ad97d13fc52b28de566dc0ddaf7245583eec2cc (diff) | |
| download | rockbox-e69d567d9ebf7d236ff9663b11ac396cc71dcd75.zip rockbox-e69d567d9ebf7d236ff9663b11ac396cc71dcd75.tar.gz rockbox-e69d567d9ebf7d236ff9663b11ac396cc71dcd75.tar.bz2 rockbox-e69d567d9ebf7d236ff9663b11ac396cc71dcd75.tar.xz | |
Bring consistency to pcm implementation and samplerate handling. Less low-level duplication. A small test_sampr fix so it works on coldfire again.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19400 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/drivers/audio/tlv320.c')
| -rw-r--r-- | firmware/drivers/audio/tlv320.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/firmware/drivers/audio/tlv320.c b/firmware/drivers/audio/tlv320.c index b2c5be8..c85627e 100644 --- a/firmware/drivers/audio/tlv320.c +++ b/firmware/drivers/audio/tlv320.c @@ -152,21 +152,21 @@ void audiohw_postinit(void) * 44100: 1 = MCLK MCLK SCLK, LRCK: Audio Clk / 4 (default) * 88200: 2 = MCLK*2 MCLK SCLK, LRCK: Audio Clk / 2 */ -void audiohw_set_frequency(unsigned fsel) +void audiohw_set_frequency(int fsel) { /* All rates available for 11.2896MHz besides 8.021 */ - unsigned char values_src[3] = + static const unsigned char values_src[HW_NUM_FREQ] = { - /* Fs: */ - (0x8 << 2) | SRC_CLKIN, /* 11025, 22050 */ - (0x8 << 2), /* 44100 */ - (0xf << 2), /* 88200 */ + [HW_FREQ_11] = (0x8 << 2) | SRC_CLKIN, + [HW_FREQ_22] = (0x8 << 2) | SRC_CLKIN, + [HW_FREQ_44] = (0x8 << 2), + [HW_FREQ_88] = (0xf << 2), }; unsigned value_dap, value_pc; - if (fsel >= ARRAYLEN(values_src)) - fsel = 1; + if ((unsigned)fsel >= HW_NUM_FREQ) + fsel = HW_FREQ_DEFAULT; /* Temporarily turn off the DAC and ADC before switching sample rates or they don't choose their filters correctly */ |