summaryrefslogtreecommitdiffstats
path: root/firmware
diff options
context:
space:
mode:
authorBertrik Sikken <bertrik@sikken.nl>2009-07-05 19:09:14 +0000
committerBertrik Sikken <bertrik@sikken.nl>2009-07-05 19:09:14 +0000
commit9926c933c799f93abc1d4650f2db349d74dce238 (patch)
tree6c0af9f2ca7328f4e7d7ee62b87b496f5a99a150 /firmware
parente63904c7e97cefa5644d9b02b3960f880d110232 (diff)
downloadrockbox-9926c933c799f93abc1d4650f2db349d74dce238.tar.gz
rockbox-9926c933c799f93abc1d4650f2db349d74dce238.tar.bz2
rockbox-9926c933c799f93abc1d4650f2db349d74dce238.zip
S5L8700: implement kernel timer
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21672 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware')
-rw-r--r--firmware/SOURCES3
-rw-r--r--firmware/target/arm/s5l8700/boot.lds2
-rw-r--r--firmware/target/arm/s5l8700/kernel-s5l8700.c59
3 files changed, 64 insertions, 0 deletions
diff --git a/firmware/SOURCES b/firmware/SOURCES
index 609521a4de..6f932d1887 100644
--- a/firmware/SOURCES
+++ b/firmware/SOURCES
@@ -1258,10 +1258,13 @@ target/arm/s5l8700/meizu-m6sp/lcd-m6sp.c
#ifdef MEIZU_M3
target/arm/s5l8700/backlight-meizu.c
+target/arm/s5l8700/kernel-s5l8700.c
target/arm/s5l8700/meizu-m3/lcd-m3.c
drivers/qt1106.c
#ifndef SIMULATOR
#ifndef BOOTLOADER
+target/arm/s5l8700/dma-s5l8700.c
+target/arm/s5l8700/pcm-s5l8700.c
target/arm/s5l8700/udacodec-meizu.c
#endif /* BOOTLOADER */
#endif /* SIMULATOR */
diff --git a/firmware/target/arm/s5l8700/boot.lds b/firmware/target/arm/s5l8700/boot.lds
index 2d2a686f9d..317e40b2ca 100644
--- a/firmware/target/arm/s5l8700/boot.lds
+++ b/firmware/target/arm/s5l8700/boot.lds
@@ -66,8 +66,10 @@ SECTIONS
{
*(.stack)
_stackbegin = .;
+ stackbegin = .;
. += 0x2000;
_stackend = .;
+ stackend = .;
_irqstackbegin = .;
. += 0x400;
_irqstackend = .;
diff --git a/firmware/target/arm/s5l8700/kernel-s5l8700.c b/firmware/target/arm/s5l8700/kernel-s5l8700.c
new file mode 100644
index 0000000000..b905ade0c1
--- /dev/null
+++ b/firmware/target/arm/s5l8700/kernel-s5l8700.c
@@ -0,0 +1,59 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ * $Id$
+ *
+ * Copyright 2009 Bertrik Sikken
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ****************************************************************************/
+#include "config.h"
+#include "system.h"
+#include "kernel.h"
+
+/* S5L8700 driver for the kernel timer
+
+ Timer B is configured as a 10 kHz timer (assuming PCLK = 100 MHz)
+ */
+
+void INT_TIMERB(void)
+{
+ /* clear interrupt */
+ TBCON = TBCON;
+
+ call_tick_tasks(); /* Run through the list of tick tasks */
+}
+
+void tick_start(unsigned int interval_in_ms)
+{
+ int cycles = 10 * interval_in_ms;
+
+ /* enable timer clock */
+ PWRCON &= ~(1 << 4);
+
+ /* configure timer for 10 kHz */
+ TBCMD = (1 << 1); /* TB_CLR */
+ TBPRE = 625; /* prescaler */
+ TBCON = (0 << 13) | /* TB_INT1_EN */
+ (1 << 12) | /* TB_INT0_EN */
+ (0 << 11) | /* TB_START */
+ (2 << 8) | /* TB_CS = PCLK / 16 */
+ (0 << 4); /* TB_MODE_SEL = interval mode */
+ TBDATA0 = cycles-1; /* set interval period */
+ TBCMD = (1 << 0); /* TB_EN */
+
+ /* enable timer interrupt */
+ INTMSK |= (1 << 7);
+}
+