summaryrefslogtreecommitdiff
path: root/apps/plugin.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugin.c')
-rw-r--r--apps/plugin.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/apps/plugin.c b/apps/plugin.c
index c1796ac1d2..e05a54d4ac 100644
--- a/apps/plugin.c
+++ b/apps/plugin.c
@@ -219,6 +219,7 @@ static const struct plugin_api rockbox_api = {
219 219
220 /* MAS communication */ 220 /* MAS communication */
221#ifndef SIMULATOR 221#ifndef SIMULATOR
222#if CONFIG_HWCODEC != MASNONE
222 mas_readmem, 223 mas_readmem,
223 mas_writemem, 224 mas_writemem,
224 mas_readreg, 225 mas_readreg,
@@ -227,6 +228,7 @@ static const struct plugin_api rockbox_api = {
227 mas_codec_writereg, 228 mas_codec_writereg,
228 mas_codec_readreg, 229 mas_codec_readreg,
229#endif 230#endif
231#endif /* HWCODEC != MASNONE */
230#endif 232#endif
231 233
232 /* misc */ 234 /* misc */
@@ -438,7 +440,7 @@ int plugin_register_timer(int cycles, int prio, void (*timer_callback)(void))
438 440
439 if (prescale > 8 || cycles == 0 || prio < 1 || prio > 15) 441 if (prescale > 8 || cycles == 0 || prio < 1 || prio > 15)
440 return 0; /* error, we can't do such period, bad argument */ 442 return 0; /* error, we can't do such period, bad argument */
441 443#if CONFIG_CPU == SH7034
442 and_b(~0x10, &TSTR); /* Stop the timer 4 */ 444 and_b(~0x10, &TSTR); /* Stop the timer 4 */
443 and_b(~0x10, &TSNC); /* No synchronization */ 445 and_b(~0x10, &TSNC); /* No synchronization */
444 and_b(~0x10, &TMDR); /* Operate normally */ 446 and_b(~0x10, &TMDR); /* Operate normally */
@@ -452,18 +454,21 @@ int plugin_register_timer(int cycles, int prio, void (*timer_callback)(void))
452 TCR4 = 0x20 | phi; /* clear at GRA match, set prescaler */ 454 TCR4 = 0x20 | phi; /* clear at GRA match, set prescaler */
453 IPRD = (IPRD & 0xFF0F) | prio << 4; /* interrupt priority */ 455 IPRD = (IPRD & 0xFF0F) | prio << 4; /* interrupt priority */
454 or_b(0x10, &TSTR); /* start timer 4 */ 456 or_b(0x10, &TSTR); /* start timer 4 */
455 457#endif
456 return cycles * prescale; /* return the actual period, in CPU clocks */ 458 return cycles * prescale; /* return the actual period, in CPU clocks */
457} 459}
458 460
459/* disable the user timer */ 461/* disable the user timer */
460void plugin_unregister_timer(void) 462void plugin_unregister_timer(void)
461{ 463{
464#if CONFIG_CPU == SH7034
462 and_b(~0x10, &TSTR); /* stop the timer 4 */ 465 and_b(~0x10, &TSTR); /* stop the timer 4 */
463 IPRD = (IPRD & 0xFF0F); /* disable interrupt */ 466 IPRD = (IPRD & 0xFF0F); /* disable interrupt */
464 pfn_timer = NULL; 467 pfn_timer = NULL;
468#endif
465} 469}
466 470
471#if CONFIG_CPU == SH7034
467/* interrupt handler for user timer */ 472/* interrupt handler for user timer */
468#pragma interrupt 473#pragma interrupt
469void IMIA4(void) 474void IMIA4(void)
@@ -472,6 +477,7 @@ void IMIA4(void)
472 pfn_timer(); /* call the user timer function */ 477 pfn_timer(); /* call the user timer function */
473 and_b(~0x01, &TSR4); /* clear the interrupt */ 478 and_b(~0x01, &TSR4); /* clear the interrupt */
474} 479}
480#endif /* CONFIG_CPU == SH7034 */
475#endif /* #ifndef SIMULATOR */ 481#endif /* #ifndef SIMULATOR */
476 482
477/* The plugin wants to stay resident after leaving its main function, e.g. 483/* The plugin wants to stay resident after leaving its main function, e.g.