forked from len0rd/rockbox
H1x0: Add SPDIF power control and frequency measurement to the SPDIF monitor.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@9919 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
2de6604e3a
commit
073f1978e2
1 changed files with 21 additions and 9 deletions
|
|
@ -718,7 +718,6 @@ bool dbg_partitions(void)
|
||||||
bool dbg_spdif(void)
|
bool dbg_spdif(void)
|
||||||
{
|
{
|
||||||
char buf[128];
|
char buf[128];
|
||||||
int button;
|
|
||||||
int line;
|
int line;
|
||||||
unsigned int control;
|
unsigned int control;
|
||||||
int x;
|
int x;
|
||||||
|
|
@ -727,12 +726,17 @@ bool dbg_spdif(void)
|
||||||
int generation;
|
int generation;
|
||||||
unsigned int interruptstat;
|
unsigned int interruptstat;
|
||||||
bool valnogood, symbolerr, parityerr;
|
bool valnogood, symbolerr, parityerr;
|
||||||
|
bool done = false;
|
||||||
|
|
||||||
lcd_setmargins(0, 0);
|
lcd_setmargins(0, 0);
|
||||||
lcd_clear_display();
|
lcd_clear_display();
|
||||||
lcd_setfont(FONT_SYSFIXED);
|
lcd_setfont(FONT_SYSFIXED);
|
||||||
|
#ifdef HAVE_SPDIF_POWER
|
||||||
|
spdif_power_enable(true); /* We need SPDIF power for both sending & receiving */
|
||||||
|
#endif
|
||||||
|
PHASECONFIG = 0x34; /* Gain = 3*2^13, source = EBUIN */
|
||||||
|
|
||||||
while(1)
|
while (!done)
|
||||||
{
|
{
|
||||||
line = 0;
|
line = 0;
|
||||||
|
|
||||||
|
|
@ -855,21 +859,29 @@ bool dbg_spdif(void)
|
||||||
}
|
}
|
||||||
snprintf(buf, sizeof(buf), "Frequency: %d (%s)", x, s);
|
snprintf(buf, sizeof(buf), "Frequency: %d (%s)", x, s);
|
||||||
lcd_puts(0, line++, buf);
|
lcd_puts(0, line++, buf);
|
||||||
|
|
||||||
x = (control >> 2) & 3;
|
x = (control >> 2) & 3;
|
||||||
snprintf(buf, sizeof(buf), "Clock accuracy: %d", x);
|
snprintf(buf, sizeof(buf), "Clock accuracy: %d", x);
|
||||||
lcd_puts(0, line++, buf);
|
lcd_puts(0, line++, buf);
|
||||||
|
line++;
|
||||||
|
|
||||||
lcd_update();
|
snprintf(buf, sizeof(buf), "Measured freq: %ldHz",
|
||||||
button = button_get_w_tmo(HZ/10);
|
(long)((long long)FREQMEAS*CPU_FREQ/((1 << 15)*3*(1 << 13))/128));
|
||||||
|
lcd_puts(0, line++, buf);
|
||||||
|
|
||||||
switch(button)
|
lcd_update();
|
||||||
|
|
||||||
|
switch (button_get_w_tmo(HZ/10))
|
||||||
{
|
{
|
||||||
case SETTINGS_CANCEL:
|
case SETTINGS_CANCEL:
|
||||||
case SETTINGS_OK2:
|
case SETTINGS_OK2:
|
||||||
return false;
|
done = true;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#ifdef HAVE_SPDIF_POWER
|
||||||
|
spdif_power_enable(global_settings.spdif_enable);
|
||||||
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue