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.tar.gz rockbox-295367686ec9855c4d90f68a6003e819fef8e7ab.zip |
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 01adfcc57d..75c6604682 100644 --- a/firmware/kernel.c +++ b/firmware/kernel.c | |||
@@ -56,7 +56,7 @@ void kernel_init(void) | |||
56 | void sleep(int ticks) | 56 | void sleep(int ticks) |
57 | { | 57 | { |
58 | #if CONFIG_CPU == S3C2440 && defined(BOOTLOADER) | 58 | #if CONFIG_CPU == S3C2440 && defined(BOOTLOADER) |
59 | int counter; | 59 | volatile int counter; |
60 | TCON &= ~(1 << 20); // stop timer 4 | 60 | TCON &= ~(1 << 20); // stop timer 4 |
61 | // TODO: this constant depends on dividers settings inherited from | 61 | // TODO: this constant depends on dividers settings inherited from |
62 | // firmware. Set them explicitly somwhere. | 62 | // firmware. Set them explicitly somwhere. |
@@ -76,7 +76,7 @@ void sleep(int ticks) | |||
76 | 76 | ||
77 | void yield(void) | 77 | void yield(void) |
78 | { | 78 | { |
79 | #if (CONFIG_CPU == S3C2440 || defined(ELIO_TPJ1022) && defined(BOOTLOADER)) | 79 | #if ((CONFIG_CPU == S3C2440 || defined(ELIO_TPJ1022)) && defined(BOOTLOADER)) |
80 | /* Some targets don't like yielding in the bootloader */ | 80 | /* Some targets don't like yielding in the bootloader */ |
81 | #else | 81 | #else |
82 | switch_thread(true, NULL); | 82 | switch_thread(true, NULL); |
@@ -560,27 +560,34 @@ void tick_start(unsigned int interval_in_ms) | |||
560 | #elif CONFIG_CPU == S3C2440 | 560 | #elif CONFIG_CPU == S3C2440 |
561 | void tick_start(unsigned int interval_in_ms) | 561 | void tick_start(unsigned int interval_in_ms) |
562 | { | 562 | { |
563 | unsigned long count; | 563 | TCON &= ~(1 << 20); // stop timer 4 |
564 | // TODO: this constant depends on dividers settings inherited from | ||
565 | // firmware. Set them explicitly somwhere. | ||
566 | TCNTB4 = 12193 * interval_in_ms / 1000; | ||
567 | TCON |= 1 << 21; // set manual bit | ||
568 | TCON &= ~(1 << 21); // reset manual bit | ||
569 | TCON |= 1 << 22; //interval mode | ||
570 | TCON |= (1 << 20); // start timer 4 | ||
564 | 571 | ||
565 | /* period = (n + 1) / 128 , n = tick time count (1~127)*/ | 572 | INTMOD &= ~(1 << 14); // timer 4 to IRQ mode |
566 | count = interval_in_ms / 1000 * 128 - 1; | 573 | INTMSK &= ~(1 << 14); // timer 4 unmask interrupts |
574 | } | ||
567 | 575 | ||
568 | if(count > 127) | 576 | void timer4(void) { |
577 | int i; | ||
578 | /* Run through the list of tick tasks */ | ||
579 | for(i = 0; i < MAX_NUM_TICK_TASKS; i++) | ||
569 | { | 580 | { |
570 | panicf("Error! The tick interval is too long (%d ms)\n", | 581 | if(tick_funcs[i]) |
571 | interval_in_ms); | 582 | { |
572 | return; | 583 | tick_funcs[i](); |
584 | } | ||
573 | } | 585 | } |
574 | 586 | ||
575 | /* Disable the tick */ | 587 | current_tick++; |
576 | TICNT &= ~(1<<7); | ||
577 | /* Set the count value */ | ||
578 | TICNT |= count; | ||
579 | /* Start up the ticker */ | ||
580 | TICNT |= (1<<7); | ||
581 | 588 | ||
582 | /* need interrupt handler ??? */ | 589 | /* following needs to be fixed. */ |
583 | 590 | /*wake_up_thread();*/ | |
584 | } | 591 | } |
585 | #endif | 592 | #endif |
586 | 593 | ||