mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-11-13 15:12:30 -05:00
H100/General: HAL for S/PDIF and refinement/bufixes in optical output powering/source selection.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11523 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
da55588fc7
commit
cc50c149e9
10 changed files with 183 additions and 113 deletions
|
|
@ -74,6 +74,9 @@
|
|||
#if CONFIG_CODEC == SWCODEC
|
||||
#include "pcmbuf.h"
|
||||
#include "pcm_playback.h"
|
||||
#if defined(HAVE_SPDIF_OUT) || defined(HAVE_SPDIF_IN)
|
||||
#include "spdif.h"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef IAUDIO_X5
|
||||
|
|
@ -774,14 +777,17 @@ bool dbg_spdif(void)
|
|||
unsigned int interruptstat;
|
||||
bool valnogood, symbolerr, parityerr;
|
||||
bool done = false;
|
||||
bool spdif_src_on;
|
||||
int spdif_source = spdif_get_output_source(&spdif_src_on);
|
||||
spdif_set_output_source(AUDIO_SRC_SPDIF, true);
|
||||
|
||||
lcd_setmargins(0, 0);
|
||||
lcd_clear_display();
|
||||
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 (!done)
|
||||
{
|
||||
|
|
@ -914,15 +920,18 @@ bool dbg_spdif(void)
|
|||
|
||||
#ifndef SIMULATOR
|
||||
snprintf(buf, sizeof(buf), "Measured freq: %ldHz",
|
||||
(long)((long long)FREQMEAS*CPU_FREQ/((1 << 15)*3*(1 << 13))/128));
|
||||
spdif_measure_frequency());
|
||||
lcd_puts(0, line++, buf);
|
||||
#endif
|
||||
|
||||
lcd_update();
|
||||
|
||||
if (action_userabort(HZ/10))
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
|
||||
spdif_set_output_source(spdif_source, spdif_src_on);
|
||||
|
||||
#ifdef HAVE_SPDIF_POWER
|
||||
spdif_power_enable(global_settings.spdif_enable);
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -34,7 +34,10 @@
|
|||
#include "pcm_playback.h"
|
||||
#include "playback.h"
|
||||
#include "enc_config.h"
|
||||
#if defined(HAVE_SPDIF_IN) || defined(HAVE_SPDIF_OUT)
|
||||
#include "spdif.h"
|
||||
#endif
|
||||
#endif /* CONFIG_CODEC == SWCODEC */
|
||||
#ifdef HAVE_UDA1380
|
||||
#include "uda1380.h"
|
||||
#endif
|
||||
|
|
@ -587,12 +590,6 @@ static void rec_boost(bool state)
|
|||
#define ac_set_monitor tlv320_set_monitor
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SPDIF_IN
|
||||
#define rec_spdif_set_monitor(m) audio_spdif_set_monitor(m)
|
||||
#else
|
||||
#define rec_spdif_set_monitor(m)
|
||||
#endif
|
||||
|
||||
void rec_set_source(int source, unsigned flags)
|
||||
{
|
||||
/* Prevent pops from unneeded switching */
|
||||
|
|
@ -613,15 +610,23 @@ void rec_set_source(int source, unsigned flags)
|
|||
/* Always boost for SPDIF */
|
||||
if ((source == AUDIO_SRC_SPDIF) != (source == last_source))
|
||||
rec_boost(source == AUDIO_SRC_SPDIF);
|
||||
#endif /* HAVE_SPDIF_IN */
|
||||
|
||||
#ifdef HAVE_SPDIF_POWER
|
||||
/* Check if S/PDIF output power should be switched off or on. NOTE: assumes
|
||||
both optical in and out is controlled by the same power source, which is
|
||||
the case on H1x0. */
|
||||
spdif_power_enable((source == AUDIO_SRC_SPDIF) ||
|
||||
audio_get_spdif_power_setting());
|
||||
global_settings.spdif_enable);
|
||||
/* Set the appropriate feed for spdif output */
|
||||
#ifdef HAVE_SPDIF_OUT
|
||||
spdif_set_output_source(source, global_settings.spdif_enable);
|
||||
#endif
|
||||
#else /* !HAVE_SPDIF_POWER */
|
||||
#ifdef HAVE_SPDIF_OUT
|
||||
spdif_set_output_source(source, true);
|
||||
#endif
|
||||
#endif /* !HAVE_SPDIF_POWER */
|
||||
|
||||
/** Tuner **/
|
||||
#ifdef CONFIG_TUNER
|
||||
|
|
@ -645,7 +650,6 @@ void rec_set_source(int source, unsigned flags)
|
|||
ac_disable_recording();
|
||||
ac_set_monitor(false);
|
||||
pcm_rec_mux(0); /* line in */
|
||||
rec_spdif_set_monitor(-1); /* silence it */
|
||||
break;
|
||||
|
||||
case AUDIO_SRC_MIC: /* recording only */
|
||||
|
|
@ -653,7 +657,6 @@ void rec_set_source(int source, unsigned flags)
|
|||
break;
|
||||
ac_enable_recording(true); /* source mic */
|
||||
pcm_rec_mux(0); /* line in */
|
||||
rec_spdif_set_monitor(0);
|
||||
break;
|
||||
|
||||
case AUDIO_SRC_LINEIN: /* recording only */
|
||||
|
|
@ -661,7 +664,6 @@ void rec_set_source(int source, unsigned flags)
|
|||
break;
|
||||
pcm_rec_mux(0); /* line in */
|
||||
ac_enable_recording(false); /* source line */
|
||||
rec_spdif_set_monitor(0);
|
||||
break;
|
||||
|
||||
#ifdef HAVE_SPDIF_IN
|
||||
|
|
@ -669,7 +671,6 @@ void rec_set_source(int source, unsigned flags)
|
|||
if (source == last_source)
|
||||
break;
|
||||
ac_disable_recording();
|
||||
audio_spdif_set_monitor(1);
|
||||
break;
|
||||
#endif /* HAVE_SPDIF_IN */
|
||||
|
||||
|
|
@ -690,7 +691,6 @@ void rec_set_source(int source, unsigned flags)
|
|||
break;
|
||||
/* I2S recording and playback */
|
||||
uda1380_enable_recording(false); /* source line */
|
||||
uda1380_set_monitor(true);
|
||||
#endif
|
||||
#ifdef HAVE_TLV320
|
||||
/* I2S recording and analog playback */
|
||||
|
|
@ -707,8 +707,6 @@ void rec_set_source(int source, unsigned flags)
|
|||
tlv320_set_monitor(true); /* analog bypass */
|
||||
}
|
||||
#endif
|
||||
|
||||
rec_spdif_set_monitor(0);
|
||||
break;
|
||||
/* #elif defined(CONFIG_TUNER) */
|
||||
/* Have radio but cannot record it */
|
||||
|
|
@ -745,18 +743,10 @@ void rec_set_recording_options(struct audio_recording_options *options)
|
|||
#if CONFIG_CODEC != SWCODEC
|
||||
if (global_settings.rec_prerecord_time)
|
||||
talk_buffer_steal(); /* will use the mp3 buffer */
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SPDIF_IN
|
||||
#ifdef HAVE_SPDIF_POWER
|
||||
audio_set_spdif_power_setting(global_settings.spdif_enable);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if CONFIG_CODEC == SWCODEC
|
||||
#else /* == SWOCODEC */
|
||||
rec_set_source(options->rec_source,
|
||||
options->rec_source_flags | SRCF_RECORDING);
|
||||
#endif
|
||||
#endif /* CONFIG_CODEC != SWCODEC */
|
||||
|
||||
audio_set_recording_options(options);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue