forked from len0rd/rockbox
Gigabeat: Add timer functionality. Rework tick timer setup to be exactly 100Hz. Metronome should work now but some pcm changes are needed to have faster tocks work correctly (in the works).
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13806 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
cbed7a2cd2
commit
4ae87c8b8a
8 changed files with 265 additions and 84 deletions
|
|
@ -29,7 +29,7 @@
|
|||
volatile long current_tick NOCACHEDATA_ATTR = 0;
|
||||
#endif
|
||||
|
||||
static void (*tick_funcs[MAX_NUM_TICK_TASKS])(void);
|
||||
void (*tick_funcs[MAX_NUM_TICK_TASKS])(void);
|
||||
|
||||
/* This array holds all queues that are initiated. It is used for broadcast. */
|
||||
static struct event_queue *all_queues[32] NOCACHEBSS_ATTR;
|
||||
|
|
@ -708,40 +708,6 @@ void tick_start(unsigned int interval_in_ms)
|
|||
|
||||
TIMER0.ctrl |= 0x80; /* Enable the counter */
|
||||
}
|
||||
#elif CONFIG_CPU == S3C2440
|
||||
void tick_start(unsigned int interval_in_ms)
|
||||
{
|
||||
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
|
||||
|
||||
INTMOD &= ~(1 << 14); // timer 4 to IRQ mode
|
||||
INTMSK &= ~(1 << 14); // timer 4 unmask interrupts
|
||||
}
|
||||
|
||||
void TIMER4(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
SRCPND = TIMER4_MASK;
|
||||
INTPND = TIMER4_MASK;
|
||||
|
||||
/* 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++;
|
||||
}
|
||||
#endif
|
||||
|
||||
int tick_add_task(void (*f)(void))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue