summaryrefslogtreecommitdiff
path: root/firmware/target/arm/s5l8700/pcm-s5l8700.c
diff options
context:
space:
mode:
authorDave Chapman <dave@dchapman.com>2009-07-25 00:49:13 +0000
committerDave Chapman <dave@dchapman.com>2009-07-25 00:49:13 +0000
commit5b3f333dd79394d8814a838df367b45523dc207d (patch)
tree1df0623da05366799ae1fca11c73d566455859fe /firmware/target/arm/s5l8700/pcm-s5l8700.c
parent658636996bf4988d81b1f105d7025d6fbf697578 (diff)
downloadrockbox-5b3f333dd79394d8814a838df367b45523dc207d.tar.gz
rockbox-5b3f333dd79394d8814a838df367b45523dc207d.zip
Correct the memory sizes (IRAM and DRAM) for the Nano2G.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22025 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target/arm/s5l8700/pcm-s5l8700.c')
-rw-r--r--firmware/target/arm/s5l8700/pcm-s5l8700.c47
1 files changed, 42 insertions, 5 deletions
diff --git a/firmware/target/arm/s5l8700/pcm-s5l8700.c b/firmware/target/arm/s5l8700/pcm-s5l8700.c
index 7a4bdeb174..9421956131 100644
--- a/firmware/target/arm/s5l8700/pcm-s5l8700.c
+++ b/firmware/target/arm/s5l8700/pcm-s5l8700.c
@@ -48,7 +48,11 @@ static const struct div_entry {
48 int pdiv, mdiv, sdiv, cdiv; 48 int pdiv, mdiv, sdiv, cdiv;
49} div_table[HW_NUM_FREQ] = { 49} div_table[HW_NUM_FREQ] = {
50 [HW_FREQ_11] = { 26, 189, 3, 8}, 50 [HW_FREQ_11] = { 26, 189, 3, 8},
51#ifdef IPOD_NANO2G
52 [HW_FREQ_22] = { 5, 6, 3, 4},
53#else
51 [HW_FREQ_22] = { 50, 98, 2, 8}, 54 [HW_FREQ_22] = { 50, 98, 2, 8},
55#endif
52 [HW_FREQ_44] = { 37, 151, 1, 9}, 56 [HW_FREQ_44] = { 37, 151, 1, 9},
53 [HW_FREQ_88] = { 50, 98, 1, 4}, 57 [HW_FREQ_88] = { 50, 98, 1, 4},
54#if 0 /* disabled because the codec driver does not support it (yet) */ 58#if 0 /* disabled because the codec driver does not support it (yet) */
@@ -116,6 +120,17 @@ void pcm_play_dma_start(const void *addr, size_t size)
116 DMA_IISOUT_DSIZE, DMA_IISOUT_BLEN, (void *)addr, size / 2, 120 DMA_IISOUT_DSIZE, DMA_IISOUT_BLEN, (void *)addr, size / 2,
117 dma_callback); 121 dma_callback);
118 122
123#ifdef IPOD_NANO2G
124 I2STXCON = (0x10 << 16) | /* burst length */
125 (0 << 15) | /* 0 = falling edge */
126 (0 << 13) | /* 0 = basic I2S format */
127 (0 << 12) | /* 0 = MSB first */
128 (0 << 11) | /* 0 = left channel for low polarity */
129 (5 << 8) | /* MCLK divider */
130 (0 << 5) | /* 0 = 16-bit */
131 (2 << 3) | /* bit clock per frame */
132 (1 << 0); /* channel index */
133#else
119 /* S2: IIS Tx mode set */ 134 /* S2: IIS Tx mode set */
120 I2STXCON = (DMA_IISOUT_BLEN << 16) | /* burst length */ 135 I2STXCON = (DMA_IISOUT_BLEN << 16) | /* burst length */
121 (0 << 15) | /* 0 = falling edge */ 136 (0 << 15) | /* 0 = falling edge */
@@ -126,6 +141,7 @@ void pcm_play_dma_start(const void *addr, size_t size)
126 (0 << 5) | /* 0 = 16-bit */ 141 (0 << 5) | /* 0 = 16-bit */
127 (0 << 3) | /* bit clock per frame */ 142 (0 << 3) | /* bit clock per frame */
128 (1 << 0); /* channel index */ 143 (1 << 0); /* channel index */
144#endif
129 145
130 /* S3: DMA channel 0 on */ 146 /* S3: DMA channel 0 on */
131 dma_enable_channel(DMA_IISOUT_CHANNEL); 147 dma_enable_channel(DMA_IISOUT_CHANNEL);
@@ -169,7 +185,12 @@ void pcm_play_dma_pause(bool pause)
169void pcm_play_dma_init(void) 185void pcm_play_dma_init(void)
170{ 186{
171 /* configure IIS pins */ 187 /* configure IIS pins */
188#ifdef IPOD_NANO2G
189 PCON5 = (PCON5 & ~(0xFFFFF000)) | 0x22220000;
190 PCON6 = (PCON6 & ~(0x0F000000)) | 0x02000000;
191#else
172 PCON7 = (PCON7 & ~(0x0FFFFF00)) | 0x02222200; 192 PCON7 = (PCON7 & ~(0x0FFFFF00)) | 0x02222200;
193#endif
173 194
174 /* enable clock to the IIS module */ 195 /* enable clock to the IIS module */
175 PWRCON &= ~(1 << 6); 196 PWRCON &= ~(1 << 6);
@@ -185,26 +206,42 @@ void pcm_postinit(void)
185/* set the configured PCM frequency */ 206/* set the configured PCM frequency */
186void pcm_dma_apply_settings(void) 207void pcm_dma_apply_settings(void)
187{ 208{
188 audiohw_set_frequency(pcm_sampr); 209 // audiohw_set_frequency(pcm_sampr);
189 210
190 struct div_entry div = div_table[pcm_fsel]; 211 struct div_entry div = div_table[pcm_fsel];
191 212
213 PLLCON &= ~4;
214 PLLCON &= ~0x10;
215 PLLCON &= 0x3f;
216 PLLCON |= 4;
217
192 /* configure PLL1 and MCLK for the desired sample rate */ 218 /* configure PLL1 and MCLK for the desired sample rate */
219#ifdef IPOD_NANO2G
220 PLL1PMS = (2 << 16) | /* PDIV */
221 (12 << 8) | /* MDIV */
222 (2 << 0); /* SDIV */
223 PLL1LCNT = 0x4d2;
224#else
193 PLL1PMS = (div.pdiv << 16) | 225 PLL1PMS = (div.pdiv << 16) |
194 (div.mdiv << 8) | 226 (div.mdiv << 8) |
195 (div.sdiv << 0); 227 (div.sdiv << 0);
196 PLL1LCNT = 7500; /* no idea what to put here */ 228 PLL1LCNT = 7500; /* no idea what to put here */
197 229#endif
230
198 /* enable PLL1 and wait for lock */ 231 /* enable PLL1 and wait for lock */
199 PLLCON |= (1 << 1); 232 PLLCON |= (1 << 1);
200 while ((PLLLOCK & (1 << 1)) == 0); 233 while ((PLLLOCK & (1 << 1)) == 0);
201 234
202 /* configure MCLK */ 235 /* configure MCLK */
203 CLKCON = (CLKCON & ~(0xFF)) | 236 CLKCON = (CLKCON & ~(0xFF)) |
204 (0 << 7) | /* MCLK_MASK */ 237 (0 << 7) | /* MCLK_MASK */
205 (2 << 5) | /* MCLK_SEL = PLL1 */ 238 (2 << 5) | /* MCLK_SEL = PLL2 */
206 (1 << 4) | /* MCLK_DIV_ON */ 239 (1 << 4) | /* MCLK_DIV_ON */
240#ifdef IPOD_NANO2G
241 (3 - 1); /* MCLK_DIV_VAL */
242#else
207 (div.cdiv - 1); /* MCLK_DIV_VAL */ 243 (div.cdiv - 1); /* MCLK_DIV_VAL */
244#endif
208} 245}
209 246
210size_t pcm_get_bytes_waiting(void) 247size_t pcm_get_bytes_waiting(void)