diff options
Diffstat (limited to 'firmware/target/arm/tms320dm320/kernel-dm320.c')
-rw-r--r-- | firmware/target/arm/tms320dm320/kernel-dm320.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/firmware/target/arm/tms320dm320/kernel-dm320.c b/firmware/target/arm/tms320dm320/kernel-dm320.c index 6608aea096..2b2e783c3f 100644 --- a/firmware/target/arm/tms320dm320/kernel-dm320.c +++ b/firmware/target/arm/tms320dm320/kernel-dm320.c | |||
@@ -27,6 +27,10 @@ extern void (*tick_funcs[MAX_NUM_TICK_TASKS])(void); | |||
27 | 27 | ||
28 | void tick_start(unsigned int interval_in_ms) | 28 | void tick_start(unsigned int interval_in_ms) |
29 | { | 29 | { |
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!!!!!!!!! | ||
30 | IO_TIMER1_TMMD = CONFIG_TIMER1_TMMD_STOP; | 34 | IO_TIMER1_TMMD = CONFIG_TIMER1_TMMD_STOP; |
31 | 35 | ||
32 | /* Setup the Prescalar (Divide by 10) | 36 | /* Setup the Prescalar (Divide by 10) |
@@ -35,13 +39,13 @@ void tick_start(unsigned int interval_in_ms) | |||
35 | IO_TIMER1_TMPRSCL = 0x0009; | 39 | IO_TIMER1_TMPRSCL = 0x0009; |
36 | 40 | ||
37 | /* Setup the Divisor */ | 41 | /* Setup the Divisor */ |
38 | IO_TIMER1_TMDIV = (TIMER_FREQ / (10*1000))*interval_in_ms; | 42 | IO_TIMER1_TMDIV = (TIMER_FREQ / (10*1000))*interval_in_ms - 1; |
39 | 43 | ||
40 | /* Turn Timer1 to Free Run mode */ | 44 | /* Turn Timer1 to Free Run mode */ |
41 | IO_TIMER1_TMMD = CONFIG_TIMER1_TMMD_FREE_RUN; | 45 | IO_TIMER1_TMMD = CONFIG_TIMER1_TMMD_FREE_RUN; |
42 | 46 | ||
43 | /* Enable the interrupt */ | 47 | /* Enable the interrupt */ |
44 | IO_INTC_EINT0 |= 1<<IRQ_TIMER1; | 48 | IO_INTC_EINT0 |= INTR_EINT0_TMR1; |
45 | } | 49 | } |
46 | 50 | ||
47 | void TIMER1(void) | 51 | void TIMER1(void) |
@@ -56,8 +60,7 @@ void TIMER1(void) | |||
56 | tick_funcs[i](); | 60 | tick_funcs[i](); |
57 | } | 61 | } |
58 | } | 62 | } |
59 | |||
60 | current_tick++; | 63 | current_tick++; |
61 | 64 | ||
62 | IO_INTC_IRQ0 = 1<<IRQ_TIMER1; | 65 | IO_INTC_IRQ0 = INTR_IRQ0_TMR1; |
63 | } | 66 | } |