diff options
author | Dave Chapman <dave@dchapman.com> | 2006-07-19 13:08:19 +0000 |
---|---|---|
committer | Dave Chapman <dave@dchapman.com> | 2006-07-19 13:08:19 +0000 |
commit | 283de5f8690281e9ab098606edd2e1e5916e1b55 (patch) | |
tree | 57467a63771fee84bd0d86ff5abc0a5365f1fe40 | |
parent | ef8317b599b21ca8c6d5480e445a0de4018eed07 (diff) | |
download | rockbox-283de5f8690281e9ab098606edd2e1e5916e1b55.tar.gz rockbox-283de5f8690281e9ab098606edd2e1e5916e1b55.zip |
Patch #5680 from Daniel Ankers - adapt the assembler version of the FIQ playback function for the 3g
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@10246 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | firmware/crt0.S | 6 | ||||
-rw-r--r-- | firmware/pcm_playback.c | 36 |
2 files changed, 37 insertions, 5 deletions
diff --git a/firmware/crt0.S b/firmware/crt0.S index 163ed6c568..531ef373a9 100644 --- a/firmware/crt0.S +++ b/firmware/crt0.S | |||
@@ -288,7 +288,11 @@ boot_table: | |||
288 | #if CONFIG_CPU == PP5020 || CONFIG_CPU == PP5002 | 288 | #if CONFIG_CPU == PP5020 || CONFIG_CPU == PP5002 |
289 | /* We'll load the banked FIQ mode registers with useful values here. | 289 | /* We'll load the banked FIQ mode registers with useful values here. |
290 | These values will be used in the FIQ handler in pcm_playback.c */ | 290 | These values will be used in the FIQ handler in pcm_playback.c */ |
291 | ldr r12, =0x70002800 /* IISCONFIG */ | 291 | #if CONFIG_CPU == PP5002 |
292 | ldr r12, =0xc0002500 /* PP5002 IISCONFIG */ | ||
293 | #else | ||
294 | ldr r12, =0x70002800 /* PP502x IISCONFIG */ | ||
295 | #endif | ||
292 | ldr r11, =p | 296 | ldr r11, =p |
293 | #endif | 297 | #endif |
294 | /* Let abort and undefined modes use IRQ stack */ | 298 | /* Let abort and undefined modes use IRQ stack */ |
diff --git a/firmware/pcm_playback.c b/firmware/pcm_playback.c index 1d9b25f6fe..67e8b933ef 100644 --- a/firmware/pcm_playback.c +++ b/firmware/pcm_playback.c | |||
@@ -344,7 +344,7 @@ size_t pcm_get_bytes_waiting(void) | |||
344 | actually needs to do so when calling callback_for_more. C version is still | 344 | actually needs to do so when calling callback_for_more. C version is still |
345 | included below for reference. | 345 | included below for reference. |
346 | */ | 346 | */ |
347 | #if CONFIG_CPU == PP5020 | 347 | #if CONFIG_CPU == PP5020 || CONFIG_CPU == PP5002 |
348 | void fiq(void) ICODE_ATTR __attribute__((naked)); | 348 | void fiq(void) ICODE_ATTR __attribute__((naked)); |
349 | void fiq(void) | 349 | void fiq(void) |
350 | { | 350 | { |
@@ -356,18 +356,32 @@ void fiq(void) | |||
356 | * r10 is a working register. | 356 | * r10 is a working register. |
357 | */ | 357 | */ |
358 | asm volatile ( | 358 | asm volatile ( |
359 | #if CONFIG_CPU == PP5002 | ||
360 | "ldr r10, =0xcf001040 \n\t" /* Some magic from iPodLinux */ | ||
361 | "ldr r10, [r10] \n\t" | ||
362 | "ldr r10, [r12, #0x1c]\n\t" | ||
363 | "bic r10, r10, #0x200 \n\t" /* clear interrupt */ | ||
364 | "str r10, [r12, #0x1c]\n\t" | ||
365 | #else | ||
359 | "ldr r10, [r12] \n\t" | 366 | "ldr r10, [r12] \n\t" |
360 | "bic r10, r10, #0x2 \n\t" /* clear interrupt */ | 367 | "bic r10, r10, #0x2 \n\t" /* clear interrupt */ |
361 | "str r10, [r12] \n\t" | 368 | "str r10, [r12] \n\t" |
369 | #endif | ||
362 | "ldr r8, [r11, #4] \n\t" /* r8 = p_size */ | 370 | "ldr r8, [r11, #4] \n\t" /* r8 = p_size */ |
363 | "ldr r9, [r11] \n\t" /* r9 = p */ | 371 | "ldr r9, [r11] \n\t" /* r9 = p */ |
364 | ".loop: \n\t" | 372 | ".loop: \n\t" |
365 | "cmp r8, #0 \n\t" /* is p_size 0? */ | 373 | "cmp r8, #0 \n\t" /* is p_size 0? */ |
366 | "beq .more_data \n\t" /* if so, ask pcmbuf for more data */ | 374 | "beq .more_data \n\t" /* if so, ask pcmbuf for more data */ |
367 | ".fifo_loop: \n\t" | 375 | ".fifo_loop: \n\t" |
376 | #if CONFIG_CPU == PP5002 | ||
377 | "ldr r10, [r12, #0x1c]\n\t" /* read IISFIFO_CFG to check FIFO status */ | ||
378 | "and r10, r10, #0x7800000\n\t" | ||
379 | "cmp r10, #0x800000 \n\t" | ||
380 | #else | ||
368 | "ldr r10, [r12, #0x0c]\n\t" /* read IISFIFO_CFG to check FIFO status */ | 381 | "ldr r10, [r12, #0x0c]\n\t" /* read IISFIFO_CFG to check FIFO status */ |
369 | "and r10, r10, #0x3f0000\n\t" | 382 | "and r10, r10, #0x3f0000\n\t" |
370 | "cmp r10, #0x10000 \n\t" | 383 | "cmp r10, #0x10000 \n\t" |
384 | #endif | ||
371 | "bls .fifo_full \n\t" /* FIFO full, exit */ | 385 | "bls .fifo_full \n\t" /* FIFO full, exit */ |
372 | "ldr r10, [r9], #4 \n\t" /* load two samples */ | 386 | "ldr r10, [r9], #4 \n\t" /* load two samples */ |
373 | "mov r10, r10, ror #16\n\t" /* put left sample at the top bits */ | 387 | "mov r10, r10, ror #16\n\t" /* put left sample at the top bits */ |
@@ -395,9 +409,17 @@ void fiq(void) | |||
395 | ".dma_stop: \n\t" /* no more data, do dma_stop() and exit */ | 409 | ".dma_stop: \n\t" /* no more data, do dma_stop() and exit */ |
396 | "ldr r10, =pcm_playing\n\t" | 410 | "ldr r10, =pcm_playing\n\t" |
397 | "strb r8, [r10] \n\t" /* pcm_playing = false (r8=0, look above) */ | 411 | "strb r8, [r10] \n\t" /* pcm_playing = false (r8=0, look above) */ |
398 | "ldr r10, [r12] \n\t" | 412 | "ldr r10, [r12] \n\t" |
413 | #if CONFIG_CPU == PP5002 | ||
414 | "bic r10, r10, #0x4\n\t" /* disable playback FIFO */ | ||
415 | "str r10, [r12] \n\t" | ||
416 | "ldr r10, [r12, #0x1c] \n\t" | ||
417 | "bic r10, r10, #0x200 \n\t" /* clear interrupt */ | ||
418 | "str r10, [r12, #0x1c] \n\t" | ||
419 | #else | ||
399 | "bic r10, r10, #0x20000002\n\t" /* disable playback FIFO and IRQ */ | 420 | "bic r10, r10, #0x20000002\n\t" /* disable playback FIFO and IRQ */ |
400 | "str r10, [r12] \n\t" | 421 | "str r10, [r12] \n\t" |
422 | #endif | ||
401 | "mrs r10, cpsr \n\t" | 423 | "mrs r10, cpsr \n\t" |
402 | "orr r10, r10, #0x40 \n\t" /* disable FIQ */ | 424 | "orr r10, r10, #0x40 \n\t" /* disable FIQ */ |
403 | "msr cpsr_c, r10 \n\t" | 425 | "msr cpsr_c, r10 \n\t" |
@@ -406,9 +428,15 @@ void fiq(void) | |||
406 | "str r9, [r11] \n\t" | 428 | "str r9, [r11] \n\t" |
407 | "subs pc, lr, #4 \n\t" /* FIQ specific return sequence */ | 429 | "subs pc, lr, #4 \n\t" /* FIQ specific return sequence */ |
408 | ".fifo_full: \n\t" /* enable IRQ and exit */ | 430 | ".fifo_full: \n\t" /* enable IRQ and exit */ |
431 | #if CONFIG_CPU == PP5002 | ||
432 | "ldr r10, [r12, #0x1c]\n\t" | ||
433 | "orr r10, r10, #0x200 \n\t" /* set interrupt */ | ||
434 | "str r10, [r12, #0x1c]\n\t" | ||
435 | #else | ||
409 | "ldr r10, [r12] \n\t" | 436 | "ldr r10, [r12] \n\t" |
410 | "orr r10, r10, #0x2 \n\t" /* set interrupt */ | 437 | "orr r10, r10, #0x2 \n\t" /* set interrupt */ |
411 | "str r10, [r12] \n\t" | 438 | "str r10, [r12] \n\t" |
439 | #endif | ||
412 | "b .exit \n\t" | 440 | "b .exit \n\t" |
413 | ); | 441 | ); |
414 | } | 442 | } |