diff options
author | Michael Sevakis <jethead71@rockbox.org> | 2007-03-04 21:43:35 +0000 |
---|---|---|
committer | Michael Sevakis <jethead71@rockbox.org> | 2007-03-04 21:43:35 +0000 |
commit | 198772a6b258a4a0f0fcf0c00639e0686000dcbd (patch) | |
tree | 9909343bd5576aa8a2aff11f8f944fd48c69a62a /firmware/target/coldfire/iriver/h100 | |
parent | 6a3a220da15e316ae7b39110eddb3114ef9f4e6b (diff) | |
download | rockbox-198772a6b258a4a0f0fcf0c00639e0686000dcbd.tar.gz rockbox-198772a6b258a4a0f0fcf0c00639e0686000dcbd.zip |
iRiver H100 series: Catching up on old work. Use a better way to keep playback going when switching optical output. Doesn't mess with the DMA peripheral requests to do it like before but just writes a sample to the FIFO. Would really like to reformulate interrupt scheme on Coldfire to allow DMA interrupts to be blocked specifically but not normally.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12605 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target/coldfire/iriver/h100')
-rw-r--r-- | firmware/target/coldfire/iriver/h100/spdif-h100.c | 45 |
1 files changed, 21 insertions, 24 deletions
diff --git a/firmware/target/coldfire/iriver/h100/spdif-h100.c b/firmware/target/coldfire/iriver/h100/spdif-h100.c index 8de96238a5..35508d10e8 100644 --- a/firmware/target/coldfire/iriver/h100/spdif-h100.c +++ b/firmware/target/coldfire/iriver/h100/spdif-h100.c | |||
@@ -50,46 +50,43 @@ unsigned long spdif_measure_frequency(void) | |||
50 | /* Set the S/PDIF audio feed */ | 50 | /* Set the S/PDIF audio feed */ |
51 | void spdif_set_output_source(int source, bool src_on) | 51 | void spdif_set_output_source(int source, bool src_on) |
52 | { | 52 | { |
53 | static const unsigned short ebu1_config[] = | 53 | static const unsigned short ebu1_config[AUDIO_NUM_SOURCES+1] = |
54 | { | 54 | { |
55 | /* SCLK2, TXSRC = PDOR3, validity, normal operation */ | 55 | /* SCLK2, TXSRC = PDOR3, validity, normal operation */ |
56 | [AUDIO_SRC_PLAYBACK+1] = (7 << 12) | (3 << 8) | (1 << 5) | (5 << 2), | 56 | [AUDIO_SRC_PLAYBACK+1] = (3 << 8) | (1 << 5) | (5 << 2), |
57 | /* Input source is EBUin1, Feed-through monitoring */ | 57 | /* Input source is EBUin1, Feed-through monitoring */ |
58 | [AUDIO_SRC_SPDIF+1] = (1 << 2), | 58 | [AUDIO_SRC_SPDIF+1] = (1 << 2), |
59 | /* SCLK2, TXSRC = IIS1recv, validity, normal operation */ | 59 | /* SCLK2, TXSRC = IIS1recv, validity, normal operation */ |
60 | [AUDIO_SRC_MIC+1] = (7 << 12) | (4 << 8) | (1 << 5) | (5 << 2), | 60 | [AUDIO_SRC_MIC+1] = (4 << 8) | (1 << 5) | (5 << 2), |
61 | [AUDIO_SRC_LINEIN+1] = (7 << 12) | (4 << 8) | (1 << 5) | (5 << 2), | 61 | [AUDIO_SRC_LINEIN+1] = (4 << 8) | (1 << 5) | (5 << 2), |
62 | [AUDIO_SRC_FMRADIO+1] = (7 << 12) | (4 << 8) | (1 << 5) | (5 << 2), | 62 | [AUDIO_SRC_FMRADIO+1] = (4 << 8) | (1 << 5) | (5 << 2), |
63 | }; | 63 | }; |
64 | 64 | ||
65 | int level; | 65 | bool kick; |
66 | unsigned long playing, recording; | ||
67 | 66 | ||
68 | if ((unsigned)source >= ARRAYLEN(ebu1_config)) | 67 | if ((unsigned)source >= ARRAYLEN(ebu1_config)) |
69 | source = AUDIO_SRC_PLAYBACK; | 68 | source = AUDIO_SRC_PLAYBACK; |
70 | 69 | ||
71 | spdif_source = source; | 70 | spdif_source = source; |
72 | spdif_on = spdif_powered() && src_on; | 71 | spdif_on = spdif_powered() && src_on; |
72 | kick = spdif_on && source == AUDIO_SRC_PLAYBACK; | ||
73 | 73 | ||
74 | level = set_irq_level(HIGHEST_IRQ_LEVEL); | 74 | /* FIFO must be in reset condition to reprogram bits 15-12 */ |
75 | or_l(0x800, &EBU1CONFIG); | ||
75 | 76 | ||
76 | /* Check if DMA peripheral requests are enabled */ | 77 | if (kick) |
77 | playing = DCR0 & DMA_EEXT; | 78 | or_l(0x800, &IIS2CONFIG); /* Have to resync IIS2 TXSRC */ |
78 | recording = DCR1 & DMA_EEXT; | ||
79 | 79 | ||
80 | EBU1CONFIG = 0x800; /* Reset before reprogram */ | 80 | /* Tranceiver must be powered or else monitoring will be disabled. |
81 | CLOCKSEL bits only have relevance to normal operation so just | ||
82 | set them always. */ | ||
83 | EBU1CONFIG = (spdif_on ? ebu1_config[source + 1] : 0) | (7 << 12); | ||
81 | 84 | ||
82 | /* Tranceiver must be powered or else monitoring will be disabled */ | 85 | if (kick && (DCR0 & DMA_EEXT)) /* only if still playing */ |
83 | EBU1CONFIG = spdif_on ? ebu1_config[source + 1] : 0; | 86 | { |
84 | 87 | and_l(~0x800, &IIS2CONFIG); | |
85 | /* Kick-start DMAs if in progress */ | 88 | PDOR3 = 0; /* A write to the FIFO kick-starts playback */ |
86 | if (recording) | 89 | } |
87 | DCR1 |= DMA_START; | ||
88 | |||
89 | if (playing) | ||
90 | DCR0 |= DMA_START; | ||
91 | |||
92 | set_irq_level(level); | ||
93 | } /* spdif_set_output_source */ | 90 | } /* spdif_set_output_source */ |
94 | 91 | ||
95 | /* Return the last set S/PDIF audio source */ | 92 | /* Return the last set S/PDIF audio source */ |