summaryrefslogtreecommitdiff
path: root/firmware/target/coldfire/iriver
diff options
context:
space:
mode:
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)
34 #endif 34 #endif
35 }; 35 };
36 36
37 int level = set_irq_level(DMA_IRQ_LEVEL);
38
37 if ((unsigned)source >= AUDIO_NUM_SOURCES) 39 if ((unsigned)source >= AUDIO_NUM_SOURCES)
38 source = AUDIO_SRC_PLAYBACK; 40 source = AUDIO_SRC_PLAYBACK;
39 41
40 IIS2CONFIG = (IIS2CONFIG & ~(7 << 8)) | (txsrc_select[source+1] << 8); 42 IIS2CONFIG = (IIS2CONFIG & ~(7 << 8)) | (txsrc_select[source+1] << 8);
43
44 set_irq_level(level);
41} /* audio_set_output_source */ 45} /* audio_set_output_source */
42 46
43void audio_set_source(int source, unsigned flags) 47void 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)
119 119
120void power_off(void) 120void power_off(void)
121{ 121{
122 set_irq_level(HIGHEST_IRQ_LEVEL); 122 set_irq_level(DISABLE_INTERRUPTS);
123 and_l(~0x00080000, &GPIO1_OUT); 123 and_l(~0x00080000, &GPIO1_OUT);
124 asm("halt"); 124 asm("halt");
125 while(1) 125 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)
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 */
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)
91 91
92void power_off(void) 92void power_off(void)
93{ 93{
94 set_irq_level(HIGHEST_IRQ_LEVEL); 94 set_irq_level(DISABLE_INTERRUPTS);
95 and_l(~0x00080000, &GPIO1_OUT); 95 and_l(~0x00080000, &GPIO1_OUT);
96 asm("halt"); 96 asm("halt");
97 while(1) 97 while(1)