mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-12-09 05:05:20 -05:00
FS#10317 - Sansa AMS 32-bit timers. Configure the timers for 32-bit mode instead of the default 16-bit mode.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21266 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
9d2208e806
commit
d1faf8b39c
2 changed files with 16 additions and 30 deletions
|
|
@ -61,26 +61,18 @@ void INT_TIMER2(void)
|
|||
|
||||
void tick_start(unsigned int interval_in_ms)
|
||||
{
|
||||
int phi = 0; /* prescaler bits */
|
||||
int prescale = 1;
|
||||
int cycles = KERNEL_TIMER_FREQ / 1000 * interval_in_ms;
|
||||
|
||||
while(cycles > 0x10000)
|
||||
{
|
||||
phi++;
|
||||
prescale <<= 4;
|
||||
cycles >>= 4;
|
||||
}
|
||||
|
||||
if(prescale > 256)
|
||||
panicf("%s : interval too big", __func__);
|
||||
|
||||
CGU_PERI |= CGU_TIMER2_CLOCK_ENABLE; /* enable peripheral */
|
||||
VIC_INT_ENABLE |= INTERRUPT_TIMER2; /* enable interrupt */
|
||||
|
||||
TIMER2_LOAD = TIMER2_BGLOAD = cycles; /* timer period */
|
||||
|
||||
/* /!\ bit 4 (reserved) must not be modified
|
||||
* periodic mode, interrupt enabled, 16 bits counter */
|
||||
TIMER2_CONTROL = (TIMER2_CONTROL & (1<<4)) | 0xe0 | (phi<<2);
|
||||
* periodic mode, interrupt enabled, no prescale, 32 bits counter */
|
||||
TIMER2_CONTROL = (TIMER2_CONTROL & (1<<4)) |
|
||||
TIMER_ENABLE |
|
||||
TIMER_PERIODIC |
|
||||
TIMER_INT_ENABLE |
|
||||
TIMER_32_BIT;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue