diff options
author | Michael Sevakis <jethead71@rockbox.org> | 2007-03-07 06:23:02 +0000 |
---|---|---|
committer | Michael Sevakis <jethead71@rockbox.org> | 2007-03-07 06:23:02 +0000 |
commit | 633f3880024a2f83a21dd96368aa397940bc9ad6 (patch) | |
tree | 7c4319b1715c5c86252fd816764fdf53435163fb /firmware/target/coldfire/iriver/h100/spdif-h100.c | |
parent | 2c94c1afc377c6605772008e6c27b06d579cecf4 (diff) | |
download | rockbox-633f3880024a2f83a21dd96368aa397940bc9ad6.tar.gz rockbox-633f3880024a2f83a21dd96368aa397940bc9ad6.zip |
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/h100/spdif-h100.c')
-rw-r--r-- | firmware/target/coldfire/iriver/h100/spdif-h100.c | 18 |
1 files changed, 15 insertions, 3 deletions
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) | |||
63 | }; | 63 | }; |
64 | 64 | ||
65 | bool kick; | 65 | bool kick; |
66 | int level; | ||
67 | int iis2config = 0; | ||
66 | 68 | ||
67 | if ((unsigned)source >= ARRAYLEN(ebu1_config)) | 69 | if ((unsigned)source >= ARRAYLEN(ebu1_config)) |
68 | source = AUDIO_SRC_PLAYBACK; | 70 | source = AUDIO_SRC_PLAYBACK; |
69 | 71 | ||
70 | spdif_source = source; | 72 | spdif_source = source; |
71 | spdif_on = spdif_powered() && src_on; | 73 | spdif_on = spdif_powered() && src_on; |
72 | kick = spdif_on && source == AUDIO_SRC_PLAYBACK; | 74 | |
75 | /* Keep a DMA interrupt initiated stop from changing play state */ | ||
76 | level = set_irq_level(DMA_IRQ_LEVEL); | ||
77 | |||
78 | kick = spdif_on && source == AUDIO_SRC_PLAYBACK | ||
79 | && (DCR0 & DMA_EEXT); | ||
73 | 80 | ||
74 | /* FIFO must be in reset condition to reprogram bits 15-12 */ | 81 | /* FIFO must be in reset condition to reprogram bits 15-12 */ |
75 | or_l(0x800, &EBU1CONFIG); | 82 | or_l(0x800, &EBU1CONFIG); |
76 | 83 | ||
77 | if (kick) | 84 | if (kick) |
85 | { | ||
86 | iis2config = IIS2CONFIG; | ||
78 | or_l(0x800, &IIS2CONFIG); /* Have to resync IIS2 TXSRC */ | 87 | or_l(0x800, &IIS2CONFIG); /* Have to resync IIS2 TXSRC */ |
88 | } | ||
79 | 89 | ||
80 | /* Tranceiver must be powered or else monitoring will be disabled. | 90 | /* Tranceiver must be powered or else monitoring will be disabled. |
81 | CLOCKSEL bits only have relevance to normal operation so just | 91 | CLOCKSEL bits only have relevance to normal operation so just |
82 | set them always. */ | 92 | set them always. */ |
83 | EBU1CONFIG = (spdif_on ? ebu1_config[source + 1] : 0) | (7 << 12); | 93 | EBU1CONFIG = (spdif_on ? ebu1_config[source + 1] : 0) | (7 << 12); |
84 | 94 | ||
85 | if (kick && (DCR0 & DMA_EEXT)) /* only if still playing */ | 95 | if (kick) |
86 | { | 96 | { |
87 | and_l(~0x800, &IIS2CONFIG); | 97 | IIS2CONFIG = iis2config; |
88 | PDOR3 = 0; /* A write to the FIFO kick-starts playback */ | 98 | PDOR3 = 0; /* A write to the FIFO kick-starts playback */ |
89 | } | 99 | } |
100 | |||
101 | set_irq_level(level); | ||
90 | } /* spdif_set_output_source */ | 102 | } /* spdif_set_output_source */ |
91 | 103 | ||
92 | /* Return the last set S/PDIF audio source */ | 104 | /* Return the last set S/PDIF audio source */ |