diff options
| author | Marcoen Hirschberg <marcoen@gmail.com> | 2006-12-29 02:49:12 +0000 |
|---|---|---|
| committer | Marcoen Hirschberg <marcoen@gmail.com> | 2006-12-29 02:49:12 +0000 |
| commit | 295367686ec9855c4d90f68a6003e819fef8e7ab (patch) | |
| tree | b4077ffb8d2283bf199ad12a90322be77040c2fd /firmware/kernel.c | |
| parent | 995a804defda23233ccbdd859023f4ba3ecba0bf (diff) | |
| download | rockbox-295367686ec9855c4d90f68a6003e819fef8e7ab.zip rockbox-295367686ec9855c4d90f68a6003e819fef8e7ab.tar.gz rockbox-295367686ec9855c4d90f68a6003e819fef8e7ab.tar.bz2 rockbox-295367686ec9855c4d90f68a6003e819fef8e7ab.tar.xz | |
merge a big part of the unofficial gigabeat cvs back. Includes working bootloader and rockbox with audio.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11850 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/kernel.c')
| -rw-r--r-- | firmware/kernel.c | 41 |
1 files changed, 24 insertions, 17 deletions
diff --git a/firmware/kernel.c b/firmware/kernel.c index 01adfcc..75c6604 100644 --- a/firmware/kernel.c +++ b/firmware/kernel.c @@ -56,7 +56,7 @@ void kernel_init(void) void sleep(int ticks) { #if CONFIG_CPU == S3C2440 && defined(BOOTLOADER) - int counter; + volatile int counter; TCON &= ~(1 << 20); // stop timer 4 // TODO: this constant depends on dividers settings inherited from // firmware. Set them explicitly somwhere. @@ -76,7 +76,7 @@ void sleep(int ticks) void yield(void) { -#if (CONFIG_CPU == S3C2440 || defined(ELIO_TPJ1022) && defined(BOOTLOADER)) +#if ((CONFIG_CPU == S3C2440 || defined(ELIO_TPJ1022)) && defined(BOOTLOADER)) /* Some targets don't like yielding in the bootloader */ #else switch_thread(true, NULL); @@ -560,27 +560,34 @@ void tick_start(unsigned int interval_in_ms) #elif CONFIG_CPU == S3C2440 void tick_start(unsigned int interval_in_ms) { - unsigned long count; + TCON &= ~(1 << 20); // stop timer 4 + // TODO: this constant depends on dividers settings inherited from + // firmware. Set them explicitly somwhere. + TCNTB4 = 12193 * interval_in_ms / 1000; + TCON |= 1 << 21; // set manual bit + TCON &= ~(1 << 21); // reset manual bit + TCON |= 1 << 22; //interval mode + TCON |= (1 << 20); // start timer 4 - /* period = (n + 1) / 128 , n = tick time count (1~127)*/ - count = interval_in_ms / 1000 * 128 - 1; + INTMOD &= ~(1 << 14); // timer 4 to IRQ mode + INTMSK &= ~(1 << 14); // timer 4 unmask interrupts +} - if(count > 127) +void timer4(void) { + int i; + /* Run through the list of tick tasks */ + for(i = 0; i < MAX_NUM_TICK_TASKS; i++) { - panicf("Error! The tick interval is too long (%d ms)\n", - interval_in_ms); - return; + if(tick_funcs[i]) + { + tick_funcs[i](); + } } - /* Disable the tick */ - TICNT &= ~(1<<7); - /* Set the count value */ - TICNT |= count; - /* Start up the ticker */ - TICNT |= (1<<7); + current_tick++; - /* need interrupt handler ??? */ - + /* following needs to be fixed. */ + /*wake_up_thread();*/ } #endif |