1
0
Fork 0
forked from len0rd/rockbox

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
This commit is contained in:
Will Robertson 2007-09-21 15:51:53 +00:00
parent a26110c52d
commit 590501cfe4
57 changed files with 4016 additions and 17 deletions

View file

@ -24,8 +24,11 @@
#include "cpu.h"
#include "system.h"
#include "panic.h"
#if CONFIG_CPU == IMX31L
#include "avic-imx31.h"
#endif
#if !defined(CPU_PP) || !defined(BOOTLOADER)
#if (!defined(CPU_PP) && (CONFIG_CPU != IMX31L)) || !defined(BOOTLOADER)
volatile long current_tick NOCACHEDATA_ATTR = 0;
#endif
@ -83,7 +86,7 @@ void sleep(int ticks)
void yield(void)
{
#if ((CONFIG_CPU == S3C2440 || defined(ELIO_TPJ1022)) && defined(BOOTLOADER))
#if ((CONFIG_CPU == S3C2440 || defined(ELIO_TPJ1022) || CONFIG_CPU == IMX31L) && defined(BOOTLOADER))
/* Some targets don't like yielding in the bootloader */
#else
switch_thread(true, NULL);
@ -708,6 +711,48 @@ void tick_start(unsigned int interval_in_ms)
TIMER0.ctrl |= 0x80; /* Enable the counter */
}
#elif CONFIG_CPU == IMX31L
void tick_start(unsigned int interval_in_ms)
{
EPITCR1 &= ~0x1; /* Disable the counter */
EPITCR1 &= ~0xE; /* Disable interrupt, count down from 0xFFFFFFFF */
EPITCR1 &= ~0xFFF0; /* Clear prescaler */
#ifdef BOOTLOADER
EPITCR1 |= (2700 << 2); /* Prescaler = 2700 */
#endif
EPITCR1 &= ~(0x3 << 24);
EPITCR1 |= (0x2 << 24); /* Set clock source to external clock (27mhz) */
EPITSR1 = 1; /* Clear the interrupt request */
#ifndef BOOTLOADER
EPITLR1 = 27000000 * interval_in_ms / 1000;
EPITCMPR1 = 27000000 * interval_in_ms / 1000;
#else
(void)interval_in_ms;
#endif
//avic_enable_int(EPIT1, IRQ, EPIT_HANDLER);
EPITCR1 |= 0x1; /* Enable the counter */
}
#ifndef BOOTLOADER
void EPIT_HANDLER(void) __attribute__((interrupt("IRQ")));
void EPIT_HANDLER(void) {
int i;
/* Run through the list of tick tasks */
for(i = 0;i < MAX_NUM_TICK_TASKS;i++)
{
if(tick_funcs[i])
tick_funcs[i]();
}
current_tick++;
EPITSR1 = 1; /* Clear the interrupt request */
}
#endif
#endif
int tick_add_task(void (*f)(void))