1
0
Fork 0
forked from len0rd/rockbox

H1x0: Enable optical output to be switched on or off during playback and recording. Fixes FS#6414 - H120 opto out toggle freezes codec. Really DMA just needed a kickstart after setting the optical TXSRC if the peripheral requests were currently enabled (the method of detection).

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11661 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Michael Sevakis 2006-12-05 07:38:55 +00:00
parent 82cdc6914d
commit 81484e4b75

View file

@ -62,16 +62,34 @@ void spdif_set_output_source(int source, bool src_on)
[AUDIO_SRC_FMRADIO+1] = (7 << 12) | (4 << 8) | (1 << 5) | (5 << 2),
};
int level;
unsigned long playing, recording;
if ((unsigned)source >= ARRAYLEN(ebu1_config))
source = AUDIO_SRC_PLAYBACK;
EBU1CONFIG = 0x800; /* Reset before reprogram */
spdif_source = source;
spdif_on = spdif_powered() && src_on;
level = set_irq_level(HIGHEST_IRQ_LEVEL);
/* Check if DMA peripheral requests are enabled */
playing = DCR0 & DMA_EEXT;
recording = DCR1 & DMA_EEXT;
EBU1CONFIG = 0x800; /* Reset before reprogram */
/* Tranceiver must be powered or else monitoring will be disabled */
EBU1CONFIG = spdif_on ? ebu1_config[source + 1] : 0;
/* Kick-start DMAs if in progress */
if (recording)
DCR1 |= DMA_START;
if (playing)
DCR0 |= DMA_START;
set_irq_level(level);
} /* spdif_set_output_source */
/* Return the last set S/PDIF audio source */