diff options
| author | Amaury Pouly <amaury.pouly@gmail.com> | 2013-07-13 02:41:45 +0200 |
|---|---|---|
| committer | Amaury Pouly <amaury.pouly@gmail.com> | 2013-07-13 02:42:17 +0200 |
| commit | bbe94e2b246d7bec307df7666416025b42d9a6f7 (patch) | |
| tree | 23a5d6016bacc836fc15fbc98b4860ebab2f2c0d | |
| parent | 8c91d05543aebb8de874270f0b770ef3e56b00bb (diff) | |
| download | rockbox-bbe94e2b246d7bec307df7666416025b42d9a6f7.zip rockbox-bbe94e2b246d7bec307df7666416025b42d9a6f7.tar.gz rockbox-bbe94e2b246d7bec307df7666416025b42d9a6f7.tar.bz2 rockbox-bbe94e2b246d7bec307df7666416025b42d9a6f7.tar.xz | |
imx233: fix audio debug screen
Change-Id: Iaadd43a28907ebd425a0b7199f067a4fab8e9653
| -rw-r--r-- | firmware/target/arm/imx233/audioout-imx233.c | 6 | ||||
| -rw-r--r-- | firmware/target/arm/imx233/audioout-imx233.h | 3 | ||||
| -rw-r--r-- | firmware/target/arm/imx233/debug-imx233.c | 31 |
3 files changed, 25 insertions, 15 deletions
diff --git a/firmware/target/arm/imx233/audioout-imx233.c b/firmware/target/arm/imx233/audioout-imx233.c index 66664ac..0ad78d2 100644 --- a/firmware/target/arm/imx233/audioout-imx233.c +++ b/firmware/target/arm/imx233/audioout-imx233.c @@ -251,14 +251,14 @@ struct imx233_audioout_info_t imx233_audioout_get_info(void) /* 6*10^6*basemult/(src_frac*8*(src_hold+1)) in Hz */ info.freq = 60000000 * BF_RD(AUDIOOUT_DACSRR, BASEMULT) / 8 / BF_RD(AUDIOOUT_DACSRR, SRC_FRAC) / (1 + BF_RD(AUDIOOUT_DACSRR, SRC_HOLD)); - info.hp_line1 = BF_RD(AUDIOOUT_HPVOL, SELECT); + info.hpselect = BF_RD(AUDIOOUT_HPVOL, SELECT); /* convert half-dB to tenth-dB */ info.dacvol[0] = MAX((int)BF_RD(AUDIOOUT_DACVOLUME, VOLUME_LEFT) - 0xff, -100) * 5; info.dacvol[1] = MAX((int)BF_RD(AUDIOOUT_DACVOLUME, VOLUME_RIGHT) - 0xff, -100) * 5; info.dacmute[0] = BF_RD(AUDIOOUT_DACVOLUME, MUTE_LEFT); info.dacmute[1] = BF_RD(AUDIOOUT_DACVOLUME, MUTE_RIGHT); - info.hpvol[0] = (info.hp_line1 ? 120 : 60) - 5 * BF_RD(AUDIOOUT_HPVOL, VOL_LEFT); - info.hpvol[1] = (info.hp_line1 ? 120 : 60) - 5 * BF_RD(AUDIOOUT_HPVOL, VOL_RIGHT); + info.hpvol[0] = (info.hpselect ? 120 : 60) - 5 * BF_RD(AUDIOOUT_HPVOL, VOL_LEFT); + info.hpvol[1] = (info.hpselect ? 120 : 60) - 5 * BF_RD(AUDIOOUT_HPVOL, VOL_RIGHT); info.hpmute[0] = info.hpmute[1] = BF_RD(AUDIOOUT_HPVOL, MUTE); info.spkrvol[0] = info.spkrvol[1] = 155; info.spkrmute[0] = info.spkrmute[1] = BF_RD(AUDIOOUT_SPEAKERCTRL, MUTE); diff --git a/firmware/target/arm/imx233/audioout-imx233.h b/firmware/target/arm/imx233/audioout-imx233.h index c7fcf64..b5c1676 100644 --- a/firmware/target/arm/imx233/audioout-imx233.h +++ b/firmware/target/arm/imx233/audioout-imx233.h @@ -29,8 +29,9 @@ struct imx233_audioout_info_t { + // NOTE there is a convention here: dac -> dacvol -> dacmute int freq; // in mHz - bool hp_line1; + bool hpselect; bool dac; int dacvol[2]; // in tenth-dB, l/r bool dacmute[2]; // l/r diff --git a/firmware/target/arm/imx233/debug-imx233.c b/firmware/target/arm/imx233/debug-imx233.c index ebef023..58d3082 100644 --- a/firmware/target/arm/imx233/debug-imx233.c +++ b/firmware/target/arm/imx233/debug-imx233.c @@ -34,6 +34,7 @@ #include "ocotp-imx233.h" #include "pwm-imx233.h" #include "emi-imx233.h" +#include "audioin-imx233.h" #include "audioout-imx233.h" #include "string.h" #include "stdio.h" @@ -799,8 +800,10 @@ bool dbg_hw_info_emi(void) } } -bool dbg_hw_info_audioout(void) +bool dbg_hw_info_audio(void) { + static const char *hp_sel[2] = {"DAC", "Line1"}; + static const char *mux_sel[4] = {"Mic", "Line1", "HP", "Line2"}; lcd_setfont(FONT_SYSFIXED); while(1) @@ -819,21 +822,22 @@ bool dbg_hw_info_audioout(void) } lcd_clear_display(); - struct imx233_audioout_info_t info = imx233_audioout_get_info(); + struct imx233_audioout_info_t out = imx233_audioout_get_info(); + struct imx233_audioin_info_t in = imx233_audioin_get_info(); int line = 0; -#define display_sys(sys, name) \ - if(info.sys) \ +#define display_sys(st, sys, name) \ + if(st.sys) \ { \ char buffer[64]; \ snprintf(buffer, 64, "%s: ", name); \ for(int i = 0; i < 2; i++) \ { \ - if(info.sys##mute[i]) \ + if(st.sys##mute[i]) \ strcat(buffer, "mute"); \ else \ snprintf(buffer + strlen(buffer), 64, "%d.%d", \ /* properly handle negative values ! */ \ - info.sys##vol[i] / 10, (10 + (info.sys##vol[i]) % 10) % 10); \ + st.sys##vol[i] / 10, (10 + (st.sys##vol[i]) % 10) % 10); \ if(i == 0) \ strcat(buffer, " / "); \ else \ @@ -843,11 +847,16 @@ bool dbg_hw_info_audioout(void) } \ else \ lcd_putsf(0, line++, "%s: powered down", name); - display_sys(dac, "DAC"); - display_sys(hp, "HP"); - display_sys(spkr, "SPKR"); + display_sys(out, dac, "DAC"); + display_sys(out, hp, "HP"); + display_sys(out, spkr, "SPKR"); + display_sys(in, adc, "ADC"); + display_sys(in, mux, "MUX"); + display_sys(in, mic, "MIC"); #undef display_sys - lcd_putsf(0, line++, "capless: %d", info.capless); + lcd_putsf(0, line++, "capless: %d", out.capless); + lcd_putsf(0, line++, "HP select: %s", hp_sel[out.hpselect]); + lcd_putsf(0, line++, "MUX select: %s / %s", mux_sel[in.muxselect[0]], mux_sel[in.muxselect[1]]); lcd_update(); yield(); @@ -873,7 +882,7 @@ static struct {"pwm", dbg_hw_info_pwm}, {"usb", dbg_hw_info_usb}, {"emi", dbg_hw_info_emi}, - {"audioout", dbg_hw_info_audioout}, + {"audio", dbg_hw_info_audio}, {"target", dbg_hw_target_info}, }; |