summaryrefslogtreecommitdiff
path: root/firmware/target
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target')
-rw-r--r--firmware/target/arm/gigabeat/meg-fx/pcm-meg-fx.c38
1 files changed, 19 insertions, 19 deletions
diff --git a/firmware/target/arm/gigabeat/meg-fx/pcm-meg-fx.c b/firmware/target/arm/gigabeat/meg-fx/pcm-meg-fx.c
index 38d300ae52..c68c359441 100644
--- a/firmware/target/arm/gigabeat/meg-fx/pcm-meg-fx.c
+++ b/firmware/target/arm/gigabeat/meg-fx/pcm-meg-fx.c
@@ -90,18 +90,17 @@ void pcm_init(void)
90 90
91 audiohw_init(); 91 audiohw_init();
92 audiohw_enable_output(true); 92 audiohw_enable_output(true);
93 audiohw_mute(true);
94 93
95 /* cannot use the WM8975 defaults since our clock is not the same */ 94 /* cannot use the WM8975 defaults since our clock is not the same */
96 /* the input master clock is 16.9344MHz - we can divide exact for that */ 95 /* the input master clock is 16.9344MHz - we can divide exact for that */
97 audiohw_set_sample_rate( (0<<6) | (0x11 << 1) | (0<<0)); 96 pcm_set_frequency(SAMPR_44);
98 97
99 /* init GPIO */ 98 /* init GPIO */
100 GPCCON = (GPCCON & ~(3<<14)) | (1<<14); 99 GPCCON = (GPCCON & ~(3<<14)) | (1<<14);
101 GPCDAT |= 1<<7; 100 GPCDAT |= 1<<7;
102 GPECON |= 0x2aa; 101 GPECON |= 0x2aa;
103 102
104 /* Do no service DMA0 requests, yet */ 103 /* Do not service DMA requests, yet */
105 /* clear any pending int and mask it */ 104 /* clear any pending int and mask it */
106 INTMSK |= (1<<19); /* mask the interrupt */ 105 INTMSK |= (1<<19); /* mask the interrupt */
107 SRCPND = (1<<19); /* clear any pending interrupts */ 106 SRCPND = (1<<19); /* clear any pending interrupts */
@@ -113,13 +112,14 @@ void pcm_init(void)
113 112
114void pcm_play_dma_start(const void *addr, size_t size) 113void pcm_play_dma_start(const void *addr, size_t size)
115{ 114{
115 static short value;
116
116 /* sanity check: bad pointer or too small file */ 117 /* sanity check: bad pointer or too small file */
117 if ((NULL == addr) || (size & ~1) <= IIS_FIFO_SIZE) return; 118 if (NULL == addr || size <= IIS_FIFO_SIZE) return;
118 119
119 p = (unsigned short *)addr; 120 p = (unsigned short *)addr;
120 p_size = size; 121 p_size = size;
121 122
122
123 /* Enable the IIS clock */ 123 /* Enable the IIS clock */
124 CLKCON |= (1<<17); 124 CLKCON |= (1<<17);
125 125
@@ -177,24 +177,24 @@ void pcm_play_dma_start(const void *addr, size_t size)
177/* Disconnect the DMA and wait for the FIFO to clear */ 177/* Disconnect the DMA and wait for the FIFO to clear */
178void pcm_play_dma_stop(void) 178void pcm_play_dma_stop(void)
179{ 179{
180 pcm_playing = false;
181
182 /* mask the DMA interrupt */ 180 /* mask the DMA interrupt */
183 INTMSK |= (1<<19); 181 INTMSK |= (1<<19);
184 182
185 /* De-Activate the channel */ 183 /* are we playing? wait for the chunk to finish */
186 DMASKTRIG2 = 0x4; 184 if (pcm_playing)
185 {
186 /* wait for the FIFO to empty before turning things off */
187 while (IISCON & (1<<7)) ;
187 188
188 /* idle the IIS transmit */ 189 pcm_playing = false;
189 IISCON |= (1<<3); 190 }
190 191
191 /* stop the IIS interface */ 192 /* De-Activate the DMA channel */
192 IISCON &= ~(1<<0); 193 DMASKTRIG2 = 0x4;
193 194
194 /* Disconnect the IIS IIS clock */ 195 /* Disconnect the IIS clock */
195 CLKCON &= ~(1<<17); 196 CLKCON &= ~(1<<17);
196 197
197
198 disable_fiq(); 198 disable_fiq();
199 199
200} 200}
@@ -203,16 +203,16 @@ void pcm_play_dma_stop(void)
203 203
204void pcm_play_pause_pause(void) 204void pcm_play_pause_pause(void)
205{ 205{
206 /* idle */ 206 /* stop servicing refills */
207 IISCON |= (1<<3); 207 INTMSK |= (1<<19);
208} 208}
209 209
210 210
211 211
212void pcm_play_pause_unpause(void) 212void pcm_play_pause_unpause(void)
213{ 213{
214 /* no idle */ 214 /* refill buffer and keep going */
215 IISCON &= ~(1<<3); 215 INTMSK &= ~(1<<19);
216} 216}
217 217
218 218