diff options
author | Will Robertson <aliask@rockbox.org> | 2007-09-21 15:51:53 +0000 |
---|---|---|
committer | Will Robertson <aliask@rockbox.org> | 2007-09-21 15:51:53 +0000 |
commit | 590501cfe404b5463adecc70628e5bc7c8f142a2 (patch) | |
tree | 3b038f90c9c3bbef8cf0b84f5a4ea338f9599851 /firmware/kernel.c | |
parent | a26110c52dff9bc15d20146462d52d07f61bd238 (diff) | |
download | rockbox-590501cfe404b5463adecc70628e5bc7c8f142a2.tar.gz rockbox-590501cfe404b5463adecc70628e5bc7c8f142a2.zip |
Merge the Gigabeat S branch back into trunk. Fingers crossed nothing breaks.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14805 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/kernel.c')
-rw-r--r-- | firmware/kernel.c | 49 |
1 files changed, 47 insertions, 2 deletions
diff --git a/firmware/kernel.c b/firmware/kernel.c index bb67ced64d..11b10e287e 100644 --- a/firmware/kernel.c +++ b/firmware/kernel.c | |||
@@ -24,8 +24,11 @@ | |||
24 | #include "cpu.h" | 24 | #include "cpu.h" |
25 | #include "system.h" | 25 | #include "system.h" |
26 | #include "panic.h" | 26 | #include "panic.h" |
27 | #if CONFIG_CPU == IMX31L | ||
28 | #include "avic-imx31.h" | ||
29 | #endif | ||
27 | 30 | ||
28 | #if !defined(CPU_PP) || !defined(BOOTLOADER) | 31 | #if (!defined(CPU_PP) && (CONFIG_CPU != IMX31L)) || !defined(BOOTLOADER) |
29 | volatile long current_tick NOCACHEDATA_ATTR = 0; | 32 | volatile long current_tick NOCACHEDATA_ATTR = 0; |
30 | #endif | 33 | #endif |
31 | 34 | ||
@@ -83,7 +86,7 @@ void sleep(int ticks) | |||
83 | 86 | ||
84 | void yield(void) | 87 | void yield(void) |
85 | { | 88 | { |
86 | #if ((CONFIG_CPU == S3C2440 || defined(ELIO_TPJ1022)) && defined(BOOTLOADER)) | 89 | #if ((CONFIG_CPU == S3C2440 || defined(ELIO_TPJ1022) || CONFIG_CPU == IMX31L) && defined(BOOTLOADER)) |
87 | /* Some targets don't like yielding in the bootloader */ | 90 | /* Some targets don't like yielding in the bootloader */ |
88 | #else | 91 | #else |
89 | switch_thread(true, NULL); | 92 | switch_thread(true, NULL); |
@@ -708,6 +711,48 @@ void tick_start(unsigned int interval_in_ms) | |||
708 | 711 | ||
709 | TIMER0.ctrl |= 0x80; /* Enable the counter */ | 712 | TIMER0.ctrl |= 0x80; /* Enable the counter */ |
710 | } | 713 | } |
714 | #elif CONFIG_CPU == IMX31L | ||
715 | void tick_start(unsigned int interval_in_ms) | ||
716 | { | ||
717 | EPITCR1 &= ~0x1; /* Disable the counter */ | ||
718 | |||
719 | EPITCR1 &= ~0xE; /* Disable interrupt, count down from 0xFFFFFFFF */ | ||
720 | EPITCR1 &= ~0xFFF0; /* Clear prescaler */ | ||
721 | #ifdef BOOTLOADER | ||
722 | EPITCR1 |= (2700 << 2); /* Prescaler = 2700 */ | ||
723 | #endif | ||
724 | EPITCR1 &= ~(0x3 << 24); | ||
725 | EPITCR1 |= (0x2 << 24); /* Set clock source to external clock (27mhz) */ | ||
726 | EPITSR1 = 1; /* Clear the interrupt request */ | ||
727 | #ifndef BOOTLOADER | ||
728 | EPITLR1 = 27000000 * interval_in_ms / 1000; | ||
729 | EPITCMPR1 = 27000000 * interval_in_ms / 1000; | ||
730 | #else | ||
731 | (void)interval_in_ms; | ||
732 | #endif | ||
733 | |||
734 | //avic_enable_int(EPIT1, IRQ, EPIT_HANDLER); | ||
735 | |||
736 | EPITCR1 |= 0x1; /* Enable the counter */ | ||
737 | } | ||
738 | |||
739 | #ifndef BOOTLOADER | ||
740 | void EPIT_HANDLER(void) __attribute__((interrupt("IRQ"))); | ||
741 | void EPIT_HANDLER(void) { | ||
742 | int i; | ||
743 | |||
744 | /* Run through the list of tick tasks */ | ||
745 | for(i = 0;i < MAX_NUM_TICK_TASKS;i++) | ||
746 | { | ||
747 | if(tick_funcs[i]) | ||
748 | tick_funcs[i](); | ||
749 | } | ||
750 | |||
751 | current_tick++; | ||
752 | |||
753 | EPITSR1 = 1; /* Clear the interrupt request */ | ||
754 | } | ||
755 | #endif | ||
711 | #endif | 756 | #endif |
712 | 757 | ||
713 | int tick_add_task(void (*f)(void)) | 758 | int tick_add_task(void (*f)(void)) |