summaryrefslogtreecommitdiff
path: root/apps/debug_menu.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/debug_menu.c')
-rw-r--r--apps/debug_menu.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/apps/debug_menu.c b/apps/debug_menu.c
index 4620adaaec..e1bb5ccb9f 100644
--- a/apps/debug_menu.c
+++ b/apps/debug_menu.c
@@ -74,6 +74,9 @@
74#if CONFIG_CODEC == SWCODEC 74#if CONFIG_CODEC == SWCODEC
75#include "pcmbuf.h" 75#include "pcmbuf.h"
76#include "pcm_playback.h" 76#include "pcm_playback.h"
77#if defined(HAVE_SPDIF_OUT) || defined(HAVE_SPDIF_IN)
78#include "spdif.h"
79#endif
77#endif 80#endif
78 81
79#ifdef IAUDIO_X5 82#ifdef IAUDIO_X5
@@ -774,14 +777,17 @@ bool dbg_spdif(void)
774 unsigned int interruptstat; 777 unsigned int interruptstat;
775 bool valnogood, symbolerr, parityerr; 778 bool valnogood, symbolerr, parityerr;
776 bool done = false; 779 bool done = false;
780 bool spdif_src_on;
781 int spdif_source = spdif_get_output_source(&spdif_src_on);
782 spdif_set_output_source(AUDIO_SRC_SPDIF, true);
777 783
778 lcd_setmargins(0, 0); 784 lcd_setmargins(0, 0);
779 lcd_clear_display(); 785 lcd_clear_display();
780 lcd_setfont(FONT_SYSFIXED); 786 lcd_setfont(FONT_SYSFIXED);
787
781#ifdef HAVE_SPDIF_POWER 788#ifdef HAVE_SPDIF_POWER
782 spdif_power_enable(true); /* We need SPDIF power for both sending & receiving */ 789 spdif_power_enable(true); /* We need SPDIF power for both sending & receiving */
783#endif 790#endif
784 PHASECONFIG = 0x34; /* Gain = 3*2^13, source = EBUIN */
785 791
786 while (!done) 792 while (!done)
787 { 793 {
@@ -914,15 +920,18 @@ bool dbg_spdif(void)
914 920
915#ifndef SIMULATOR 921#ifndef SIMULATOR
916 snprintf(buf, sizeof(buf), "Measured freq: %ldHz", 922 snprintf(buf, sizeof(buf), "Measured freq: %ldHz",
917 (long)((long long)FREQMEAS*CPU_FREQ/((1 << 15)*3*(1 << 13))/128)); 923 spdif_measure_frequency());
918 lcd_puts(0, line++, buf); 924 lcd_puts(0, line++, buf);
919#endif 925#endif
920 926
921 lcd_update(); 927 lcd_update();
922 928
923 if (action_userabort(HZ/10)) 929 if (action_userabort(HZ/10))
924 return false; 930 break;
925 } 931 }
932
933 spdif_set_output_source(spdif_source, spdif_src_on);
934
926#ifdef HAVE_SPDIF_POWER 935#ifdef HAVE_SPDIF_POWER
927 spdif_power_enable(global_settings.spdif_enable); 936 spdif_power_enable(global_settings.spdif_enable);
928#endif 937#endif