summaryrefslogtreecommitdiff
path: root/apps/plugins
diff options
context:
space:
mode:
authorJörg Hohensohn <hohensoh@rockbox.org>2004-04-30 21:13:49 +0000
committerJörg Hohensohn <hohensoh@rockbox.org>2004-04-30 21:13:49 +0000
commite724b605f402dbe58f61fdeea266fd2aab53784f (patch)
treed2fb3dbbd3704bb4800498e6c58685516a1bbfd7 /apps/plugins
parent664959aed4e9f7fe23a536bdd841b0d2b4d8affe (diff)
downloadrockbox-e724b605f402dbe58f61fdeea266fd2aab53784f.zip
rockbox-e724b605f402dbe58f61fdeea266fd2aab53784f.tar.gz
rockbox-e724b605f402dbe58f61fdeea266fd2aab53784f.tar.bz2
rockbox-e724b605f402dbe58f61fdeea266fd2aab53784f.tar.xz
uses the new timer registration of the plugin API, no hardware banging any more
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@4565 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins')
-rw-r--r--apps/plugins/mandelbrot.c37
1 files changed, 3 insertions, 34 deletions
diff --git a/apps/plugins/mandelbrot.c b/apps/plugins/mandelbrot.c
index 11c51bb..2f5bc53 100644
--- a/apps/plugins/mandelbrot.c
+++ b/apps/plugins/mandelbrot.c
@@ -66,8 +66,6 @@ static unsigned int gbuf_size = 0;
* you're doing.
*/
-#define IMIA4 (*((volatile unsigned long*)0x09000180)) /* timer 4 */
-
#define GRAY_RUNNING 0x0001 /* grayscale overlay is running */
#define GRAY_DEFERRED_UPDATE 0x0002 /* lcd_update() requested */
@@ -91,44 +89,15 @@ static tGraybuf *graybuf = NULL;
/** prototypes **/
-void timer_set(unsigned period);
-void timer4_isr(void) __attribute__((interrupt_handler));
+void timer4_isr(void);
void graypixel(int x, int y, unsigned long pattern);
void grayinvertmasked(int x, int yb, unsigned char mask);
/** implementation **/
-/* setup ISR and timer registers */
-void timer_set(unsigned period)
-{
- if (period)
- {
- and_b(~0x10, &TSTR); /* Stop the timer 4 */
- and_b(~0x10, &TSNC); /* No synchronization */
- and_b(~0x10, &TMDR); /* Operate normally */
-
- IMIA4 = (unsigned long) timer4_isr; /* install ISR */
-
- and_b(~0x01, &TSR4);
- TIER4 = 0xF9; /* Enable GRA match interrupt */
-
- GRA4 = (unsigned short)(period/4 - 1);
- TCR4 = 0x22; /* clear at GRA match, sysclock/4 */
- IPRD = (IPRD & 0xFF0F) | 0x0010; /* interrupt priority 1 (lowest) */
- or_b(0x10, &TSTR); /* start timer 4 */
- }
- else
- {
- and_b(~0x10, &TSTR); /* stop the timer 4 */
- IPRD = (IPRD & 0xFF0F); /* disable interrupt */
- }
-}
-
/* timer interrupt handler: display next bitplane */
void timer4_isr(void) /* IMIA4 */
{
- and_b(~0x01, &TSR4); /* clear the interrupt */
-
rb->lcd_blit(graybuf->data + (graybuf->plane_size * graybuf->cur_plane),
graybuf->x, graybuf->by, graybuf->width, graybuf->bheight,
graybuf->width);
@@ -505,11 +474,11 @@ void gray_show_display(bool enable)
if (enable)
{
graybuf->flags |= GRAY_RUNNING;
- timer_set(FREQ / 67);
+ rb->plugin_register_timer(FREQ / 67, 1, timer4_isr);
}
else
{
- timer_set(0);
+ rb->plugin_unregister_timer();
graybuf->flags &= ~GRAY_RUNNING;
rb->lcd_update(); /* restore whatever there was before */
}