summaryrefslogtreecommitdiff
path: root/firmware/target/arm/tms320dm320/kernel-mr500.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/arm/tms320dm320/kernel-mr500.c')
-rw-r--r--firmware/target/arm/tms320dm320/kernel-mr500.c63
1 files changed, 63 insertions, 0 deletions
diff --git a/firmware/target/arm/tms320dm320/kernel-mr500.c b/firmware/target/arm/tms320dm320/kernel-mr500.c
new file mode 100644
index 0000000000..be2b14b3cb
--- /dev/null
+++ b/firmware/target/arm/tms320dm320/kernel-mr500.c
@@ -0,0 +1,63 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2007 by Karl Kurbjun
11 *
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
14 *
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
17 *
18 ****************************************************************************/
19
20#include "config.h"
21#include "system.h"
22#include "kernel.h"
23#include "timer.h"
24#include "thread.h"
25
26extern void (*tick_funcs[MAX_NUM_TICK_TASKS])(void);
27
28void tick_start(unsigned int interval_in_ms)
29{
30 IO_TIMER1_TMMD = CONFIG_TIMER1_TMMD_STOP;
31
32 /* Setup the Prescalar (Divide by 10)
33 * Based on linux/include/asm-arm/arch-integrator/timex.h
34 */
35 IO_TIMER1_TMPRSCL = 0x000A;
36
37 /* Setup the Divisor */
38 IO_TIMER1_TMDIV = (TIMER_FREQ / (10*1000))*interval_in_ms;
39
40 /* Turn Timer1 to Free Run mode */
41 IO_TIMER1_TMMD = CONFIG_TIMER1_TMMD_FREE_RUN;
42
43 /* Enable the interrupt */
44 IO_INTC_EINT0 |= 1<<IRQ_TIMER1;
45}
46
47void TIMER1(void)
48{
49 int i;
50
51 /* Run through the list of tick tasks */
52 for(i = 0; i < MAX_NUM_TICK_TASKS; i++)
53 {
54 if(tick_funcs[i])
55 {
56 tick_funcs[i]();
57 }
58 }
59
60 current_tick++;
61
62 IO_INTC_IRQ0 = 1<<IRQ_TIMER1;
63}