summaryrefslogtreecommitdiff
path: root/firmware
diff options
context:
space:
mode:
authorAmaury Pouly <amaury.pouly@gmail.com>2012-05-19 13:28:41 +0200
committerAmaury Pouly <amaury.pouly@gmail.com>2012-05-19 16:10:52 +0200
commit068443caaf101bccfa5ff44b44e6f98e6612b27f (patch)
tree174bc3b0099455a54e911a6315be4718ab094fb9 /firmware
parent9ced006c06a4240cbd2a9ebe9196d9a0658810f9 (diff)
imx233: move away timer defines from imx233.h
Change-Id: I9f721ae12a3ddf72c4e90ad0754a5c2b819847bb
Diffstat (limited to 'firmware')
-rw-r--r--firmware/export/imx233.h10
-rw-r--r--firmware/target/arm/imx233/kernel-imx233.c10
-rw-r--r--firmware/target/arm/imx233/timer-imx233.c10
3 files changed, 23 insertions, 7 deletions
diff --git a/firmware/export/imx233.h b/firmware/export/imx233.h
index d672137a48..58e1d48de6 100644
--- a/firmware/export/imx233.h
+++ b/firmware/export/imx233.h
@@ -64,13 +64,6 @@
/* Timer runs at APBX speed which is derived from ref_xtal@24MHz */
#define TIMER_FREQ 24000000
-#ifdef SANSA_FUZEPLUS
-#define TICK_TIMER_NR 0
-#define USER_TIMER_NR 1
-#else
-#error Select timers !
-#endif
-
/* USBOTG */
#define USB_QHARRAY_ATTR __attribute__((section(".qharray"),nocommon,aligned(2048)))
#define USB_NUM_ENDPOINTS 5
@@ -84,6 +77,8 @@
#define __REG_SET(reg) (*((volatile uint32_t *)(&reg + 1)))
#define __REG_CLR(reg) (*((volatile uint32_t *)(&reg + 2)))
#define __REG_TOG(reg) (*((volatile uint32_t *)(&reg + 3)))
+#define __REG_SET_CLR(reg, set) \
+ (*((volatile uint32_t *)(&reg + (set ? 1 : 2))))
#define __BLOCK_SFTRST (1 << 31)
#define __BLOCK_CLKGATE (1 << 30)
@@ -93,5 +88,6 @@
#define __XTRACT(reg, field) ((reg & reg##__##field##_BM) >> reg##__##field##_BP)
#define __XTRACT_EX(val, field) (((val) & field##_BM) >> field##_BP)
#define __FIELD_SET(reg, field, val) reg = (reg & ~reg##__##field##_BM) | (val << reg##__##field##_BP)
+#define __FIELD_SET_CLR(reg, field, set) __REG_SET_CLR(reg, set) = reg##__##field
#endif /* __IMX233_H__ */
diff --git a/firmware/target/arm/imx233/kernel-imx233.c b/firmware/target/arm/imx233/kernel-imx233.c
index 752db68149..8e1e122277 100644
--- a/firmware/target/arm/imx233/kernel-imx233.c
+++ b/firmware/target/arm/imx233/kernel-imx233.c
@@ -23,6 +23,16 @@
#include "clkctrl-imx233.h"
#include "kernel-imx233.h"
+#ifdef SANSA_FUZEPLUS
+#define TICK_TIMER_NR 0
+#elif defined(CREATIVE_ZENXFI2)
+#define TICK_TIMER_NR 0
+#elif defined(CREATIVE_ZENXFI3)
+#define TICK_TIMER_NR 0
+#else
+#error Select tick timer !
+#endif
+
static void tick_timer(void)
{
/* Run through the list of tick tasks */
diff --git a/firmware/target/arm/imx233/timer-imx233.c b/firmware/target/arm/imx233/timer-imx233.c
index 2812f1adfc..bcc1974c63 100644
--- a/firmware/target/arm/imx233/timer-imx233.c
+++ b/firmware/target/arm/imx233/timer-imx233.c
@@ -22,6 +22,16 @@
#include "timrot-imx233.h"
#include "timer.h"
+#ifdef SANSA_FUZEPLUS
+#define USER_TIMER_NR 1
+#elif defined(CREATIVE_ZENXFI2)
+#define USER_TIMER_NR 1
+#elif defined(CREATIVE_ZENXFI3)
+#define USER_TIMER_NR 1
+#else
+#error Select user timer !
+#endif
+
static long timer_cycles = 0;
static void timer_fn(void)