diff options
author | Jens Arnold <amiconn@rockbox.org> | 2005-10-03 09:24:36 +0000 |
---|---|---|
committer | Jens Arnold <amiconn@rockbox.org> | 2005-10-03 09:24:36 +0000 |
commit | cfb073c452c0218a82e23fb5f5f89043719f2c07 (patch) | |
tree | 5aff8555b218e10037c086aaad3aaec1b4d677c8 /apps/plugins | |
parent | 7190cf2ed9cfa854d81e7bf9c0e8a1ef71935c1f (diff) | |
download | rockbox-cfb073c452c0218a82e23fb5f5f89043719f2c07.tar.gz rockbox-cfb073c452c0218a82e23fb5f5f89043719f2c07.zip |
Coldfire: New timer handling on CPU frequency change, adjusting the prescaler on the fly, for both tick and user timer. Precondition is that the higher frequencies are integer multiples of the base: now NORMAL is 45 MHz and MAX is 124 MHz. Removes the need for applications with longer timer periods (>= 10 ms) to boost the CPU all the time, e.g. the grayscale lib. Timer counts are now always based on the base frequency (CPU_FREQ). * Adjusted the RAM refresh timers to the new frequencies (all frequencies for H100) * All: Fixed the tick timer count being off by one.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7576 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins')
-rw-r--r-- | apps/plugins/grayscale.c | 6 | ||||
-rw-r--r-- | apps/plugins/lib/gray_core.c | 25 | ||||
-rw-r--r-- | apps/plugins/mandelbrot.c | 6 |
3 files changed, 17 insertions, 20 deletions
diff --git a/apps/plugins/grayscale.c b/apps/plugins/grayscale.c index cdb3f880e5..192dcc1738 100644 --- a/apps/plugins/grayscale.c +++ b/apps/plugins/grayscale.c | |||
@@ -164,6 +164,9 @@ int main(void) | |||
164 | rb->lcd_puts(0, 0, pbuf); | 164 | rb->lcd_puts(0, 0, pbuf); |
165 | rb->lcd_update(); | 165 | rb->lcd_update(); |
166 | 166 | ||
167 | #if !defined(SIMULATOR) && defined(HAVE_ADJUSTABLE_CPU_FREQ) | ||
168 | rb->cpu_boost(true); | ||
169 | #endif | ||
167 | gray_show(true); /* switch on greyscale overlay */ | 170 | gray_show(true); /* switch on greyscale overlay */ |
168 | 171 | ||
169 | time = *rb->current_tick; /* start time measurement */ | 172 | time = *rb->current_tick; /* start time measurement */ |
@@ -223,6 +226,9 @@ int main(void) | |||
223 | time / 100, time % 100); | 226 | time / 100, time % 100); |
224 | rb->lcd_puts(0, 0, pbuf); | 227 | rb->lcd_puts(0, 0, pbuf); |
225 | gray_deferred_lcd_update(); /* schedule an lcd_update() */ | 228 | gray_deferred_lcd_update(); /* schedule an lcd_update() */ |
229 | #if !defined(SIMULATOR) && defined(HAVE_ADJUSTABLE_CPU_FREQ) | ||
230 | rb->cpu_boost(false); | ||
231 | #endif | ||
226 | 232 | ||
227 | /* drawing is now finished, play around with scrolling | 233 | /* drawing is now finished, play around with scrolling |
228 | * until you press OFF or connect USB | 234 | * until you press OFF or connect USB |
diff --git a/apps/plugins/lib/gray_core.c b/apps/plugins/lib/gray_core.c index 02477b5b82..7fcd3dac80 100644 --- a/apps/plugins/lib/gray_core.c +++ b/apps/plugins/lib/gray_core.c | |||
@@ -226,38 +226,23 @@ void gray_release(void) | |||
226 | lcd_set_invert_display(), lcd_set_flip(), lcd_roll() */ | 226 | lcd_set_invert_display(), lcd_set_flip(), lcd_roll() */ |
227 | void gray_show(bool enable) | 227 | void gray_show(bool enable) |
228 | { | 228 | { |
229 | #if (CONFIG_CPU == SH7034) && (CONFIG_LCD == LCD_SSD1815) | ||
230 | if (enable) | ||
231 | { | ||
232 | _gray_info.flags |= _GRAY_RUNNING; | ||
233 | _gray_rb->timer_register(1, NULL, FREQ / 67, 1, _timer_isr); | ||
234 | _gray_rb->screen_dump_set_hook(gray_screendump_hook); | ||
235 | } | ||
236 | else | ||
237 | { | ||
238 | _gray_rb->timer_unregister(); | ||
239 | _gray_info.flags &= ~_GRAY_RUNNING; | ||
240 | _gray_rb->screen_dump_set_hook(NULL); | ||
241 | _gray_rb->lcd_update(); /* restore whatever there was before */ | ||
242 | } | ||
243 | #elif defined(CPU_COLDFIRE) && (CONFIG_LCD == LCD_S1D15E06) | ||
244 | if (enable && !(_gray_info.flags & _GRAY_RUNNING)) | 229 | if (enable && !(_gray_info.flags & _GRAY_RUNNING)) |
245 | { | 230 | { |
246 | _gray_info.flags |= _GRAY_RUNNING; | 231 | _gray_info.flags |= _GRAY_RUNNING; |
247 | _gray_rb->cpu_boost(true); /* run at 120 MHz to avoid freq changes */ | 232 | #if CONFIG_LCD == LCD_SSD1815 |
248 | _gray_rb->timer_register(1, NULL, *_gray_rb->cpu_frequency / 70, 1, | 233 | _gray_rb->timer_register(1, NULL, CPU_FREQ / 67, 1, _timer_isr); |
249 | _timer_isr); | 234 | #elif CONFIG_LCD == LCD_S1D15E06 |
235 | _gray_rb->timer_register(1, NULL, CPU_FREQ / 70, 1, _timer_isr); | ||
236 | #endif | ||
250 | _gray_rb->screen_dump_set_hook(gray_screendump_hook); | 237 | _gray_rb->screen_dump_set_hook(gray_screendump_hook); |
251 | } | 238 | } |
252 | else if (!enable && (_gray_info.flags & _GRAY_RUNNING)) | 239 | else if (!enable && (_gray_info.flags & _GRAY_RUNNING)) |
253 | { | 240 | { |
254 | _gray_rb->timer_unregister(); | 241 | _gray_rb->timer_unregister(); |
255 | _gray_rb->cpu_boost(false); | ||
256 | _gray_info.flags &= ~_GRAY_RUNNING; | 242 | _gray_info.flags &= ~_GRAY_RUNNING; |
257 | _gray_rb->screen_dump_set_hook(NULL); | 243 | _gray_rb->screen_dump_set_hook(NULL); |
258 | _gray_rb->lcd_update(); /* restore whatever there was before */ | 244 | _gray_rb->lcd_update(); /* restore whatever there was before */ |
259 | } | 245 | } |
260 | #endif | ||
261 | } | 246 | } |
262 | 247 | ||
263 | /* Update a rectangular area of the greyscale overlay */ | 248 | /* Update a rectangular area of the greyscale overlay */ |
diff --git a/apps/plugins/mandelbrot.c b/apps/plugins/mandelbrot.c index 88f48d3f2b..8830d7ab33 100644 --- a/apps/plugins/mandelbrot.c +++ b/apps/plugins/mandelbrot.c | |||
@@ -370,6 +370,9 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | |||
370 | /* main loop */ | 370 | /* main loop */ |
371 | while (true) { | 371 | while (true) { |
372 | if (redraw > REDRAW_NONE) { | 372 | if (redraw > REDRAW_NONE) { |
373 | #if !defined(SIMULATOR) && defined(HAVE_ADJUSTABLE_CPU_FREQ) | ||
374 | rb->cpu_boost(true); | ||
375 | #endif | ||
373 | if (redraw == REDRAW_FULL) | 376 | if (redraw == REDRAW_FULL) |
374 | gray_ub_clear_display(); | 377 | gray_ub_clear_display(); |
375 | 378 | ||
@@ -378,6 +381,9 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | |||
378 | else | 381 | else |
379 | calc_mandelbrot_32(); | 382 | calc_mandelbrot_32(); |
380 | 383 | ||
384 | #if !defined(SIMULATOR) && defined(HAVE_ADJUSTABLE_CPU_FREQ) | ||
385 | rb->cpu_boost(false); | ||
386 | #endif | ||
381 | px_min = 0; | 387 | px_min = 0; |
382 | px_max = LCD_WIDTH; | 388 | px_max = LCD_WIDTH; |
383 | py_min = 0; | 389 | py_min = 0; |