diff options
-rw-r--r-- | apps/plugins/doom/i_system.c | 2 | ||||
-rwxr-xr-x | bootloader/mrobe500.c | 11 | ||||
-rw-r--r-- | firmware/target/arm/tms320dm320/kernel-dm320.c | 2 | ||||
-rw-r--r-- | firmware/target/arm/tms320dm320/system-dm320.c | 4 | ||||
-rw-r--r-- | firmware/target/arm/tms320dm320/timer-dm320.c | 52 |
5 files changed, 34 insertions, 37 deletions
diff --git a/apps/plugins/doom/i_system.c b/apps/plugins/doom/i_system.c index 95ea7a8f68..40ebe981b4 100644 --- a/apps/plugins/doom/i_system.c +++ b/apps/plugins/doom/i_system.c @@ -87,7 +87,7 @@ void doomtime(void) int I_GetTime (void) { -#if defined(HAVE_LCD_COLOR) && !defined(TOSHIBA_GIGABEAT_F) && !defined(SIMULATOR) && !defined(RB_PROFILE) +#if defined(HAVE_LCD_COLOR) && !defined(SIMULATOR) && !defined(RB_PROFILE) return doomtimer; #else #if HZ==100 diff --git a/bootloader/mrobe500.c b/bootloader/mrobe500.c index 3663612c74..ede05aa25c 100755 --- a/bootloader/mrobe500.c +++ b/bootloader/mrobe500.c @@ -109,6 +109,7 @@ void mrdebug(void) touchpad_calibrate_screen();
use_calibration(true);
#endif
+
while(true)
{
#if 0
@@ -144,14 +145,14 @@ void mrdebug(void) // tsc2100_read_values(&x, &y, &z1, &z2);
// printf("x: %04x y: %04x z1: %04x z2: %04x", x, y, z1, z2);
// printf("tsadc: %4x", tsc2100_readreg(TSADC_PAGE, TSADC_ADDRESS)&0xffff);
-// printf("current tick: %04x", current_tick);
-// printf("Address: 0x%08x Data: 0x%08x", address, *address);
-// printf("Address: 0x%08x Data: 0x%08x", address+1, *(address+1));
-// printf("Address: 0x%08x Data: 0x%08x", address+2, *(address+2));
+ printf("current tick: %04x", current_tick);
+ printf("Address: 0x%08x Data: 0x%08x", address, *address);
+ printf("Address: 0x%08x Data: 0x%08x", address+1, *(address+1));
+ printf("Address: 0x%08x Data: 0x%08x", address+2, *(address+2));
// // tsc2100_keyclick(); /* doesnt work :( */
// line -= 6;
// }
-#if 1
+#if 0
if (button&BUTTON_TOUCHPAD)
{
if (button&BUTTON_REL)
diff --git a/firmware/target/arm/tms320dm320/kernel-dm320.c b/firmware/target/arm/tms320dm320/kernel-dm320.c index be2b14b3cb..6608aea096 100644 --- a/firmware/target/arm/tms320dm320/kernel-dm320.c +++ b/firmware/target/arm/tms320dm320/kernel-dm320.c @@ -32,7 +32,7 @@ void tick_start(unsigned int interval_in_ms) /* Setup the Prescalar (Divide by 10) * Based on linux/include/asm-arm/arch-integrator/timex.h */ - IO_TIMER1_TMPRSCL = 0x000A; + IO_TIMER1_TMPRSCL = 0x0009; /* Setup the Divisor */ IO_TIMER1_TMDIV = (TIMER_FREQ / (10*1000))*interval_in_ms; diff --git a/firmware/target/arm/tms320dm320/system-dm320.c b/firmware/target/arm/tms320dm320/system-dm320.c index c009766f21..da3b9913a2 100644 --- a/firmware/target/arm/tms320dm320/system-dm320.c +++ b/firmware/target/arm/tms320dm320/system-dm320.c @@ -169,6 +169,10 @@ void system_init(void) IO_INTC_ENTRY_TBA0 = 0; IO_INTC_ENTRY_TBA1 = 0; + + /* Turn off other timers */ + IO_TIMER2_TMMD = CONFIG_TIMER2_TMMD_STOP; + IO_TIMER3_TMMD = CONFIG_TIMER3_TMMD_STOP; /* set GIO26 (reset pin) to output and low */ IO_GIO_BITCLR1=(1<<10); diff --git a/firmware/target/arm/tms320dm320/timer-dm320.c b/firmware/target/arm/tms320dm320/timer-dm320.c index 21449ed19f..482fef9f12 100644 --- a/firmware/target/arm/tms320dm320/timer-dm320.c +++ b/firmware/target/arm/tms320dm320/timer-dm320.c @@ -32,32 +32,16 @@ void TIMER0(void) IO_INTC_IRQ0 |= 1<<IRQ_TIMER0; } -static void stop_timer(void) -{ - IO_INTC_EINT0 &= ~(1<<IRQ_TIMER0); - - IO_INTC_IRQ0 |= 1<<IRQ_TIMER0; - - IO_TIMER0_TMMD = CONFIG_TIMER0_TMMD_STOP; -} - bool __timer_set(long cycles, bool start) { int oldlevel; - unsigned int divider; - /* taken from linux/arch/arm/mach-itdm320-20/time.c and timer-meg-fx.c */ + unsigned int divider=cycles, prescaler=0; - /* Turn off all timers */ - IO_TIMER0_TMMD = CONFIG_TIMER0_TMMD_STOP; - IO_TIMER1_TMMD = CONFIG_TIMER1_TMMD_STOP; - IO_TIMER2_TMMD = CONFIG_TIMER2_TMMD_STOP; - IO_TIMER3_TMMD = CONFIG_TIMER3_TMMD_STOP; + if(cycles<1) + return false; - /* Find the minimum factor that puts the counter in range 1-65535 */ - unsigned int prescaler = (cycles + 65534) / 65535; + IO_TIMER0_TMMD = CONFIG_TIMER0_TMMD_STOP; - /* Test this by writing 1's to registers to see how many bits we have */ - /* Maximum divider setting is x / 1024 / 65536 = x / 67108864 */ if (start && pfn_unregister != NULL) { pfn_unregister(); @@ -66,13 +50,14 @@ bool __timer_set(long cycles, bool start) oldlevel = set_irq_level(HIGHEST_IRQ_LEVEL); - /* Max prescale is 1023+1 */ - for (divider = 0; prescaler > 1024; prescaler >>= 1, divider++); + /* Increase prescale values starting from 0 to make the cycle count fit */ + while(divider>65535 && prescaler<1024) + { + prescaler++; + divider=cycles/(prescaler+1); + } - /* Setup the Prescalar */ IO_TIMER0_TMPRSCL = prescaler; - - /* Setup the Divisor */ IO_TIMER0_TMDIV = divider; set_irq_level(oldlevel); @@ -80,22 +65,29 @@ bool __timer_set(long cycles, bool start) return true; } -bool __timer_register(void) +static void stop_timer(void) { - bool retval = true; + IO_INTC_EINT0 &= ~(1<<IRQ_TIMER0); + + IO_INTC_IRQ0 |= 1<<IRQ_TIMER0; + + IO_TIMER0_TMMD = CONFIG_TIMER0_TMMD_STOP; +} +bool __timer_register(void) +{ int oldstatus = set_interrupt_status(IRQ_FIQ_DISABLED, IRQ_FIQ_STATUS); stop_timer(); /* Turn Timer0 to Free Run mode */ - IO_TIMER0_TMMD = CONFIG_TIMER0_TMMD_FREE_RUN; + IO_TIMER0_TMMD = CONFIG_TIMER0_TMMD_FREE_RUN; - IO_INTC_EINT0 |= 1<<IRQ_TIMER0; + IO_INTC_EINT0 |= 1<<IRQ_TIMER0; set_interrupt_status(oldstatus, IRQ_FIQ_STATUS); - return retval; + return true; } void __timer_unregister(void) |