summaryrefslogtreecommitdiff
path: root/apps
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
parent664959aed4e9f7fe23a536bdd841b0d2b4d8affe (diff)
downloadrockbox-e724b605f402dbe58f61fdeea266fd2aab53784f.tar.gz
rockbox-e724b605f402dbe58f61fdeea266fd2aab53784f.zip
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')
-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 11c51bb556..2f5bc53ab0 100644
--- a/apps/plugins/mandelbrot.c
+++ b/apps/plugins/mandelbrot.c
@@ -66,8 +66,6 @@ static unsigned int gbuf_size = 0;
66 * you're doing. 66 * you're doing.
67 */ 67 */
68 68
69#define IMIA4 (*((volatile unsigned long*)0x09000180)) /* timer 4 */
70
71#define GRAY_RUNNING 0x0001 /* grayscale overlay is running */ 69#define GRAY_RUNNING 0x0001 /* grayscale overlay is running */
72#define GRAY_DEFERRED_UPDATE 0x0002 /* lcd_update() requested */ 70#define GRAY_DEFERRED_UPDATE 0x0002 /* lcd_update() requested */
73 71
@@ -91,44 +89,15 @@ static tGraybuf *graybuf = NULL;
91 89
92/** prototypes **/ 90/** prototypes **/
93 91
94void timer_set(unsigned period); 92void timer4_isr(void);
95void timer4_isr(void) __attribute__((interrupt_handler));
96void graypixel(int x, int y, unsigned long pattern); 93void graypixel(int x, int y, unsigned long pattern);
97void grayinvertmasked(int x, int yb, unsigned char mask); 94void grayinvertmasked(int x, int yb, unsigned char mask);
98 95
99/** implementation **/ 96/** implementation **/
100 97
101/* setup ISR and timer registers */
102void timer_set(unsigned period)
103{
104 if (period)
105 {
106 and_b(~0x10, &TSTR); /* Stop the timer 4 */
107 and_b(~0x10, &TSNC); /* No synchronization */
108 and_b(~0x10, &TMDR); /* Operate normally */
109
110 IMIA4 = (unsigned long) timer4_isr; /* install ISR */
111
112 and_b(~0x01, &TSR4);
113 TIER4 = 0xF9; /* Enable GRA match interrupt */
114
115 GRA4 = (unsigned short)(period/4 - 1);
116 TCR4 = 0x22; /* clear at GRA match, sysclock/4 */
117 IPRD = (IPRD & 0xFF0F) | 0x0010; /* interrupt priority 1 (lowest) */
118 or_b(0x10, &TSTR); /* start timer 4 */
119 }
120 else
121 {
122 and_b(~0x10, &TSTR); /* stop the timer 4 */
123 IPRD = (IPRD & 0xFF0F); /* disable interrupt */
124 }
125}
126
127/* timer interrupt handler: display next bitplane */ 98/* timer interrupt handler: display next bitplane */
128void timer4_isr(void) /* IMIA4 */ 99void timer4_isr(void) /* IMIA4 */
129{ 100{
130 and_b(~0x01, &TSR4); /* clear the interrupt */
131
132 rb->lcd_blit(graybuf->data + (graybuf->plane_size * graybuf->cur_plane), 101 rb->lcd_blit(graybuf->data + (graybuf->plane_size * graybuf->cur_plane),
133 graybuf->x, graybuf->by, graybuf->width, graybuf->bheight, 102 graybuf->x, graybuf->by, graybuf->width, graybuf->bheight,
134 graybuf->width); 103 graybuf->width);
@@ -505,11 +474,11 @@ void gray_show_display(bool enable)
505 if (enable) 474 if (enable)
506 { 475 {
507 graybuf->flags |= GRAY_RUNNING; 476 graybuf->flags |= GRAY_RUNNING;
508 timer_set(FREQ / 67); 477 rb->plugin_register_timer(FREQ / 67, 1, timer4_isr);
509 } 478 }
510 else 479 else
511 { 480 {
512 timer_set(0); 481 rb->plugin_unregister_timer();
513 graybuf->flags &= ~GRAY_RUNNING; 482 graybuf->flags &= ~GRAY_RUNNING;
514 rb->lcd_update(); /* restore whatever there was before */ 483 rb->lcd_update(); /* restore whatever there was before */
515 } 484 }