forked from len0rd/rockbox
Add interrupt handler for iPod. Add timer tick support. Remove temporary thread sleep solution. Remove temporary iPod current_tick solution.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8224 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
07a2ad2a22
commit
544b03cf9a
5 changed files with 53 additions and 17 deletions
|
@ -275,6 +275,8 @@ ecode:
|
||||||
.word fiq_handler
|
.word fiq_handler
|
||||||
ecodeend:
|
ecodeend:
|
||||||
|
|
||||||
|
.global irq
|
||||||
|
|
||||||
undef_instr_handler:
|
undef_instr_handler:
|
||||||
software_int_handler:
|
software_int_handler:
|
||||||
reserved_handler:
|
reserved_handler:
|
||||||
|
@ -288,6 +290,9 @@ data_abort_handler:
|
||||||
subs pc, lr, #8
|
subs pc, lr, #8
|
||||||
|
|
||||||
irq_handler:
|
irq_handler:
|
||||||
|
stmfd sp!, {r0-r3, r12, lr}
|
||||||
|
bl irq
|
||||||
|
ldmfd sp!, {r0-r3, r12, lr}
|
||||||
subs pc, lr, #4
|
subs pc, lr, #4
|
||||||
|
|
||||||
/* 256 words of IRQ stack */
|
/* 256 words of IRQ stack */
|
||||||
|
|
|
@ -66,12 +66,7 @@ struct mutex
|
||||||
};
|
};
|
||||||
|
|
||||||
/* global tick variable */
|
/* global tick variable */
|
||||||
#if (CONFIG_CPU==PP5020)
|
|
||||||
/* A temporary hack until timer interrupt is enabled - use the RTC */
|
|
||||||
#define current_tick ((*((volatile long*)0x60005010))/10000)
|
|
||||||
#else
|
|
||||||
extern long current_tick;
|
extern long current_tick;
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef SIMULATOR
|
#ifdef SIMULATOR
|
||||||
#define sleep(x) sim_sleep(x)
|
#define sleep(x) sim_sleep(x)
|
||||||
|
|
|
@ -25,9 +25,7 @@
|
||||||
#include "system.h"
|
#include "system.h"
|
||||||
#include "panic.h"
|
#include "panic.h"
|
||||||
|
|
||||||
#if (CONFIG_CPU != PP5020)
|
|
||||||
long current_tick = 0;
|
long current_tick = 0;
|
||||||
#endif
|
|
||||||
|
|
||||||
static void (*tick_funcs[MAX_NUM_TICK_TASKS])(void);
|
static void (*tick_funcs[MAX_NUM_TICK_TASKS])(void);
|
||||||
|
|
||||||
|
@ -319,9 +317,36 @@ void tick_start(unsigned int interval_in_ms)
|
||||||
|
|
||||||
#elif CONFIG_CPU == PP5020
|
#elif CONFIG_CPU == PP5020
|
||||||
|
|
||||||
void tick_start(unsigned int interval_in_ms) {
|
#define USECS_PER_INT 0x2710
|
||||||
/* TODO: Implement tick_start */
|
|
||||||
(void)interval_in_ms;
|
void TIMER1(void)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
PP5020_TIMER1_ACK;
|
||||||
|
/* 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++;
|
||||||
|
wake_up_thread();
|
||||||
|
}
|
||||||
|
|
||||||
|
void tick_start(unsigned int interval_in_ms)
|
||||||
|
{
|
||||||
|
/* TODO: use interval_in_ms to set timer periode */
|
||||||
|
(void)interval_in_ms;
|
||||||
|
PP5020_TIMER1 = 0x0;
|
||||||
|
PP5020_TIMER1_ACK;
|
||||||
|
/* enable timer, period, trigger value 0x2710 -> 100Hz */
|
||||||
|
PP5020_TIMER1 = 0xc0000000 | USECS_PER_INT;
|
||||||
|
/* unmask interrupt source */
|
||||||
|
PP5020_CPU_INT_EN = PP5020_TIMER1_MASK;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1106,14 +1106,28 @@ int system_memory_guard(int newmode)
|
||||||
}
|
}
|
||||||
#elif CONFIG_CPU==PP5020
|
#elif CONFIG_CPU==PP5020
|
||||||
|
|
||||||
/* TODO: Implement system.c */
|
extern void TIMER1(void);
|
||||||
|
|
||||||
void system_init(void) {
|
|
||||||
|
|
||||||
|
void irq(void)
|
||||||
|
{
|
||||||
|
if (PP5020_CPU_INT_STAT & PP5020_TIMER1_MASK)
|
||||||
|
TIMER1();
|
||||||
}
|
}
|
||||||
|
|
||||||
void system_reboot(void) {
|
void system_init(void)
|
||||||
|
{
|
||||||
|
/* disable all irqs */
|
||||||
|
outl(-1, 0x60001138);
|
||||||
|
outl(-1, 0x60001128);
|
||||||
|
outl(-1, 0x6000111c);
|
||||||
|
|
||||||
|
outl(-1, 0x60001038);
|
||||||
|
outl(-1, 0x60001028);
|
||||||
|
outl(-1, 0x6000101c);
|
||||||
|
}
|
||||||
|
|
||||||
|
void system_reboot(void)
|
||||||
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
int system_memory_guard(int newmode)
|
int system_memory_guard(int newmode)
|
||||||
|
|
|
@ -251,8 +251,6 @@ void switch_thread(void)
|
||||||
#ifdef SIMULATOR
|
#ifdef SIMULATOR
|
||||||
/* Do nothing */
|
/* Do nothing */
|
||||||
#else
|
#else
|
||||||
/* We currently have no interrupts on iPod targets, so remove this temp. */
|
|
||||||
#if CONFIG_CPU != PP5020
|
|
||||||
while (num_sleepers == num_threads)
|
while (num_sleepers == num_threads)
|
||||||
{
|
{
|
||||||
/* Enter sleep mode, woken up on interrupt */
|
/* Enter sleep mode, woken up on interrupt */
|
||||||
|
@ -270,7 +268,6 @@ void switch_thread(void)
|
||||||
*/
|
*/
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
current = current_thread;
|
current = current_thread;
|
||||||
store_context(&thread_contexts[current]);
|
store_context(&thread_contexts[current]);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue