From 068443caaf101bccfa5ff44b44e6f98e6612b27f Mon Sep 17 00:00:00 2001 From: Amaury Pouly Date: Sat, 19 May 2012 13:28:41 +0200 Subject: imx233: move away timer defines from imx233.h Change-Id: I9f721ae12a3ddf72c4e90ad0754a5c2b819847bb --- firmware/export/imx233.h | 10 +++------- firmware/target/arm/imx233/kernel-imx233.c | 10 ++++++++++ firmware/target/arm/imx233/timer-imx233.c | 10 ++++++++++ 3 files changed, 23 insertions(+), 7 deletions(-) (limited to 'firmware') 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 *)(® + 1))) #define __REG_CLR(reg) (*((volatile uint32_t *)(® + 2))) #define __REG_TOG(reg) (*((volatile uint32_t *)(® + 3))) +#define __REG_SET_CLR(reg, set) \ + (*((volatile uint32_t *)(® + (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) -- cgit v1.2.3