From 528ec2a55512679b5776df34d57f77a28bff3fc2 Mon Sep 17 00:00:00 2001 From: Michael Sevakis Date: Sun, 7 Dec 2008 17:48:42 +0000 Subject: Meg F/X: Radically changing divider settings messed up the fake sleep in the bootloader. They aren't reset even after powering off. Make sure they are always specified. Move that code to target tree as well. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19358 a1c6a512-1295-4272-9138-f99709370657 --- .../target/arm/s3c2440/gigabeat-fx/kernel-meg-fx.c | 28 +++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) (limited to 'firmware/target/arm/s3c2440/gigabeat-fx/kernel-meg-fx.c') diff --git a/firmware/target/arm/s3c2440/gigabeat-fx/kernel-meg-fx.c b/firmware/target/arm/s3c2440/gigabeat-fx/kernel-meg-fx.c index 5ef8c8023a..6a750c32e2 100644 --- a/firmware/target/arm/s3c2440/gigabeat-fx/kernel-meg-fx.c +++ b/firmware/target/arm/s3c2440/gigabeat-fx/kernel-meg-fx.c @@ -24,7 +24,7 @@ #include "timer.h" #include "thread.h" -void tick_start(unsigned int interval_in_ms) +static inline void tick_set(unsigned int interval_in_ms) { /* * Based on default PCLK of 49.1568MHz - scaling chosen to give @@ -49,6 +49,12 @@ void tick_start(unsigned int interval_in_ms) TCON |= 1 << 21; /* reset manual bit */ TCON &= ~(1 << 21); +} + +void tick_start(unsigned int interval_in_ms) +{ + tick_set(interval_in_ms); + /* interval mode */ TCON |= 1 << 22; /* start timer 4 */ @@ -58,6 +64,26 @@ void tick_start(unsigned int interval_in_ms) INTMSK &= ~TIMER4_MASK; } +#ifdef BOOTLOADER +void delay(int ticks) +{ + volatile unsigned long counter; + + INTMSK |= TIMER4_MASK; + + tick_set(1000 * ticks / HZ); + + /* autoreload Off */ + TCON &= ~(1 << 22); + /* start timer 4 */ + TCON |= (1 << 20); + + do { + counter = TCNTO4; + } while(counter > 0); +} +#endif /* BOOTLOADER */ + void TIMER4(void) { /* Run through the list of tick tasks */ -- cgit v1.2.3