summaryrefslogtreecommitdiff
path: root/firmware/target/coldfire/iriver
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2007-03-07 06:23:02 +0000
committerMichael Sevakis <jethead71@rockbox.org>2007-03-07 06:23:02 +0000
commit633f3880024a2f83a21dd96368aa397940bc9ad6 (patch)
tree7c4319b1715c5c86252fd816764fdf53435163fb /firmware/target/coldfire/iriver
parent2c94c1afc377c6605772008e6c27b06d579cecf4 (diff)
Coldfire targets: Shuffle IRQ levels around to have all interaction between low level audio function calls and DMA be atomic. Make recording and playback independently startable and stoppable so one can be running and not interfere with the other. All tests I can do at the moment check out ok (play, record, play+record, FM radio on iRivers, S/PDIF on H120 (w/running optical on/off), and on-the-fly samplerate changes). Recording tested for well over an hour run and no problems.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12658 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target/coldfire/iriver')
-rw-r--r--firmware/target/coldfire/iriver/audio-iriver.c4
-rw-r--r--firmware/target/coldfire/iriver/h100/power-h100.c2
-rw-r--r--firmware/target/coldfire/iriver/h100/spdif-h100.c18
-rw-r--r--firmware/target/coldfire/iriver/h300/power-h300.c2
4 files changed, 21 insertions, 5 deletions
diff --git a/firmware/target/coldfire/iriver/audio-iriver.c b/firmware/target/coldfire/iriver/audio-iriver.c
index 2df7a216a9..bd071430b2 100644
--- a/firmware/target/coldfire/iriver/audio-iriver.c
+++ b/firmware/target/coldfire/iriver/audio-iriver.c
@@ -34,10 +34,14 @@ void audio_set_output_source(int source)
#endif
};
+ int level = set_irq_level(DMA_IRQ_LEVEL);
+
if ((unsigned)source >= AUDIO_NUM_SOURCES)
source = AUDIO_SRC_PLAYBACK;
IIS2CONFIG = (IIS2CONFIG & ~(7 << 8)) | (txsrc_select[source+1] << 8);
+
+ set_irq_level(level);
} /* audio_set_output_source */
void audio_set_source(int source, unsigned flags)
diff --git a/firmware/target/coldfire/iriver/h100/power-h100.c b/firmware/target/coldfire/iriver/h100/power-h100.c
index 75c8bea9dd..ce1c350802 100644
--- a/firmware/target/coldfire/iriver/h100/power-h100.c
+++ b/firmware/target/coldfire/iriver/h100/power-h100.c
@@ -119,7 +119,7 @@ bool ide_powered(void)
void power_off(void)
{
- set_irq_level(HIGHEST_IRQ_LEVEL);
+ set_irq_level(DISABLE_INTERRUPTS);
and_l(~0x00080000, &GPIO1_OUT);
asm("halt");
while(1)
diff --git a/firmware/target/coldfire/iriver/h100/spdif-h100.c b/firmware/target/coldfire/iriver/h100/spdif-h100.c
index 35508d10e8..ee4a9402ea 100644
--- a/firmware/target/coldfire/iriver/h100/spdif-h100.c
+++ b/firmware/target/coldfire/iriver/h100/spdif-h100.c
@@ -63,30 +63,42 @@ void spdif_set_output_source(int source, bool src_on)
};
bool kick;
+ int level;
+ int iis2config = 0;
if ((unsigned)source >= ARRAYLEN(ebu1_config))
source = AUDIO_SRC_PLAYBACK;
spdif_source = source;
spdif_on = spdif_powered() && src_on;
- kick = spdif_on && source == AUDIO_SRC_PLAYBACK;
+
+ /* Keep a DMA interrupt initiated stop from changing play state */
+ level = set_irq_level(DMA_IRQ_LEVEL);
+
+ kick = spdif_on && source == AUDIO_SRC_PLAYBACK
+ && (DCR0 & DMA_EEXT);
/* FIFO must be in reset condition to reprogram bits 15-12 */
or_l(0x800, &EBU1CONFIG);
if (kick)
+ {
+ iis2config = IIS2CONFIG;
or_l(0x800, &IIS2CONFIG); /* Have to resync IIS2 TXSRC */
+ }
/* Tranceiver must be powered or else monitoring will be disabled.
CLOCKSEL bits only have relevance to normal operation so just
set them always. */
EBU1CONFIG = (spdif_on ? ebu1_config[source + 1] : 0) | (7 << 12);
- if (kick && (DCR0 & DMA_EEXT)) /* only if still playing */
+ if (kick)
{
- and_l(~0x800, &IIS2CONFIG);
+ IIS2CONFIG = iis2config;
PDOR3 = 0; /* A write to the FIFO kick-starts playback */
}
+
+ set_irq_level(level);
} /* spdif_set_output_source */
/* Return the last set S/PDIF audio source */
diff --git a/firmware/target/coldfire/iriver/h300/power-h300.c b/firmware/target/coldfire/iriver/h300/power-h300.c
index 2875fa2a47..5e57326c36 100644
--- a/firmware/target/coldfire/iriver/h300/power-h300.c
+++ b/firmware/target/coldfire/iriver/h300/power-h300.c
@@ -91,7 +91,7 @@ bool ide_powered(void)
void power_off(void)
{
- set_irq_level(HIGHEST_IRQ_LEVEL);
+ set_irq_level(DISABLE_INTERRUPTS);
and_l(~0x00080000, &GPIO1_OUT);
asm("halt");
while(1)