diff options
Diffstat (limited to 'firmware/target/arm/s5l8702/kernel-s5l8702.c')
-rw-r--r-- | firmware/target/arm/s5l8702/kernel-s5l8702.c | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/firmware/target/arm/s5l8702/kernel-s5l8702.c b/firmware/target/arm/s5l8702/kernel-s5l8702.c new file mode 100644 index 0000000000..67dabd5f3f --- /dev/null +++ b/firmware/target/arm/s5l8702/kernel-s5l8702.c | |||
@@ -0,0 +1,56 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id: kernel-s5l8700.c 28795 2010-12-11 17:52:52Z Buschel $ | ||
9 | * | ||
10 | * Copyright © 2009 Bertrik Sikken | ||
11 | * | ||
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. | ||
16 | * | ||
17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
18 | * KIND, either express or implied. | ||
19 | * | ||
20 | ****************************************************************************/ | ||
21 | #include "config.h" | ||
22 | #include "system.h" | ||
23 | #include "kernel.h" | ||
24 | |||
25 | /* S5L8702 driver for the kernel timer | ||
26 | |||
27 | Timer B is configured as a 10 kHz timer | ||
28 | */ | ||
29 | |||
30 | void INT_TIMERB(void) | ||
31 | { | ||
32 | /* clear interrupt */ | ||
33 | TBCON = TBCON; | ||
34 | |||
35 | call_tick_tasks(); /* Run through the list of tick tasks */ | ||
36 | } | ||
37 | |||
38 | void tick_start(unsigned int interval_in_ms) | ||
39 | { | ||
40 | int cycles = 10 * interval_in_ms; | ||
41 | |||
42 | /* configure timer for 10 kHz */ | ||
43 | TBCMD = (1 << 1); /* TB_CLR */ | ||
44 | TBPRE = 208 - 1; /* prescaler */ | ||
45 | TBCON = (0 << 13) | /* TB_INT1_EN */ | ||
46 | (1 << 12) | /* TB_INT0_EN */ | ||
47 | (0 << 11) | /* TB_START */ | ||
48 | (2 << 8) | /* TB_CS = PCLK / 16 */ | ||
49 | (0 << 4); /* TB_MODE_SEL = interval mode */ | ||
50 | TBDATA0 = cycles; /* set interval period */ | ||
51 | TBCMD = (1 << 0); /* TB_EN */ | ||
52 | |||
53 | /* enable timer interrupt */ | ||
54 | VIC0INTENABLE = 1 << IRQ_TIMER; | ||
55 | } | ||
56 | |||