1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
10 * Copyright (C) 2007 by Karl Kurbjun
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
20 ****************************************************************************/
28 void tick_start(unsigned int interval_in_ms
)
30 /* TODO: set up TIMER1 clock settings
31 IO_CLK_MOD2 &= ~CLK_MOD2_TMR1; //disable TIMER1 clock
32 IO_CLK_SEL0 |= (1 << 2); //set TIMER1 clock to PLLIN*/
33 IO_CLK_MOD2
|= CLK_MOD2_TMR1
; //enable TIMER1 clock!!!!!!!!!
34 IO_TIMER1_TMMD
= CONFIG_TIMER1_TMMD_STOP
;
36 /* Setup the Prescalar (Divide by 10)
37 * Based on linux/include/asm-arm/arch-integrator/timex.h
39 IO_TIMER1_TMPRSCL
= 0x0009;
41 /* Setup the Divisor */
42 IO_TIMER1_TMDIV
= (TIMER_FREQ
/ (10*1000))*interval_in_ms
- 1;
44 /* Turn Timer1 to Free Run mode */
45 IO_TIMER1_TMMD
= CONFIG_TIMER1_TMMD_FREE_RUN
;
47 /* Enable the interrupt */
48 IO_INTC_EINT0
|= INTR_EINT0_TMR1
;
51 void TIMER1(void) __attribute__ ((section(".icode")));
54 IO_INTC_IRQ0
= INTR_IRQ0_TMR1
;
56 /* Run through the list of tick tasks */