From 59a2862347873c2dfcc9cd47cc788dbfef27fcf8 Mon Sep 17 00:00:00 2001 From: Karl Kurbjun Date: Sun, 11 Nov 2007 03:31:24 +0000 Subject: Show some more registers in the debug screen, fix the touchscreen when SCREEN_ROTATE is set. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15566 a1c6a512-1295-4272-9138-f99709370657 --- firmware/target/arm/tms320dm320/debug-dm320.c | 34 ++++++++++---- .../arm/tms320dm320/mrobe-500/button-mr500.c | 53 +++++++++++++++++----- 2 files changed, 65 insertions(+), 22 deletions(-) (limited to 'firmware/target') diff --git a/firmware/target/arm/tms320dm320/debug-dm320.c b/firmware/target/arm/tms320dm320/debug-dm320.c index 417dfee961..e12d86a03d 100755 --- a/firmware/target/arm/tms320dm320/debug-dm320.c +++ b/firmware/target/arm/tms320dm320/debug-dm320.c @@ -35,7 +35,7 @@ bool __dbg_ports(void) bool __dbg_hw_info(void) { - int line = 0, button; + int line = 0, button, oldline; int *address=0x0; bool done=false; char buf[100]; @@ -43,11 +43,25 @@ bool __dbg_hw_info(void) lcd_setmargins(0, 0); lcd_setfont(FONT_SYSFIXED); lcd_clear_display(); + + /* Put all the static text befor the while loop */ lcd_puts(0, line++, "[Hardware info]"); + + lcd_puts(0, line++, "Clock info:"); + snprintf(buf, sizeof(buf), "IO_CLK_PLLA: 0x%04x IO_CLK_PLLB: 0x%04x IO_CLK_SEL0: 0x%04x IO_CLK_SEL1: 0x%04x", + IO_CLK_PLLA, IO_CLK_PLLB, IO_CLK_SEL0, IO_CLK_SEL1); lcd_puts(0, line++, buf); + snprintf(buf, sizeof(buf), "IO_CLK_SEL2: 0x%04x IO_CLK_DIV0: 0x%04x IO_CLK_DIV1: 0x%04x IO_CLK_DIV2: 0x%04x", + IO_CLK_SEL2, IO_CLK_DIV0, IO_CLK_DIV1, IO_CLK_DIV2); lcd_puts(0, line++, buf); + snprintf(buf, sizeof(buf), "IO_CLK_DIV3: 0x%04x IO_CLK_DIV4: 0x%04x IO_CLK_BYP : 0x%04x IO_CLK_INV : 0x%04x", + IO_CLK_DIV3, IO_CLK_DIV4, IO_CLK_BYP, IO_CLK_INV); lcd_puts(0, line++, buf); + snprintf(buf, sizeof(buf), "IO_CLK_MOD0: 0x%04x IO_CLK_MOD1: 0x%04x IO_CLK_MOD2: 0x%04x IO_CLK_LPCTL0: 0x%04x", + IO_CLK_MOD0, IO_CLK_MOD1, IO_CLK_MOD2, IO_CLK_LPCTL0); lcd_puts(0, line++, buf); + line++; + oldline=line; while(!done) { - line = 0; + line = oldline; button = button_get(false); button&=~BUTTON_REPEAT; if (button == BUTTON_POWER) @@ -61,14 +75,14 @@ bool __dbg_hw_info(void) else if (button==BUTTON_RC_REW) address-=0x800; - snprintf(buf, sizeof(buf), "current tick: %04x", (unsigned int)current_tick); - lcd_puts(0, line++, buf); - snprintf(buf, sizeof(buf), "Address: 0x%08x Data: 0x%08x", (unsigned int)address, *address); - lcd_puts(0, line++, buf); - snprintf(buf, sizeof(buf), "Address: 0x%08x Data: 0x%08x", (unsigned int)(address+1), *(address+1)); - lcd_puts(0, line++, buf); - snprintf(buf, sizeof(buf), "Address: 0x%08x Data: 0x%08x", (unsigned int)(address+2), *(address+2)); - lcd_puts(0, line++, buf); + snprintf(buf, sizeof(buf), "current tick: %08x Seconds running: %08d", + (unsigned int)current_tick, (unsigned int)current_tick/100); lcd_puts(0, line++, buf); + snprintf(buf, sizeof(buf), "Address: 0x%08x Data: 0x%08x", + (unsigned int)address, *address); lcd_puts(0, line++, buf); + snprintf(buf, sizeof(buf), "Address: 0x%08x Data: 0x%08x", + (unsigned int)(address+1), *(address+1)); lcd_puts(0, line++, buf); + snprintf(buf, sizeof(buf), "Address: 0x%08x Data: 0x%08x", + (unsigned int)(address+2), *(address+2)); lcd_puts(0, line++, buf); lcd_update(); } diff --git a/firmware/target/arm/tms320dm320/mrobe-500/button-mr500.c b/firmware/target/arm/tms320dm320/mrobe-500/button-mr500.c index 837677250f..5b20300594 100644 --- a/firmware/target/arm/tms320dm320/mrobe-500/button-mr500.c +++ b/firmware/target/arm/tms320dm320/mrobe-500/button-mr500.c @@ -47,9 +47,13 @@ void use_calibration(bool enable) using_calibration = enable; } /* Jd's tests.. These will hopefully work for everyone so we dont have to - create a calibration screen. and -(0,0) = 0x00c0, 0xf40 -(480,320) = 0x0f19, 0x00fc + * create a calibration screen. + * Portait: + * (0,0) = 200, 3900 + * (480,640) = 3880, 270 + * Landscape: + * (0,0) = 200, 270 + * (640,480) = 3880, 3900 */ void set_calibration_points(struct touch_calibration_point *tl, struct touch_calibration_point *br) @@ -57,16 +61,25 @@ void set_calibration_points(struct touch_calibration_point *tl, memcpy(&topleft, tl, sizeof(struct touch_calibration_point)); memcpy(&bottomright, br, sizeof(struct touch_calibration_point)); } + static int touch_to_pixels(short val_x, short val_y) { short x,y; - int x1,x2; + +#ifdef SCREEN_ROTATE /* portait */ + x=val_x; + y=val_y; +#else + x=val_y; + y=val_x; +#endif + if (!using_calibration) return (val_x<<16)|val_y; - x1 = topleft.val_x; x2 = bottomright.val_x; - x = (val_x-x1)*(bottomright.px_x - topleft.px_x) / (x2 - x1) + topleft.px_x; - x1 = topleft.val_y; x2 = bottomright.val_y; - y = (val_y-x1)*(bottomright.px_y - topleft.px_y) / (x2 - x1) + topleft.px_y; + + x = (x-topleft.val_x)*(bottomright.px_x - topleft.px_x) / (bottomright.val_x - topleft.val_x) + topleft.px_x; + y = (y-topleft.val_y)*(bottomright.px_y - topleft.px_y) / (bottomright.val_y - topleft.val_y) + topleft.px_y; + if (x < 0) x = 0; if (y < 0) @@ -79,11 +92,27 @@ void button_init_device(void) touch_available = false; /* GIO is the power button, set as input */ IO_GIO_DIR0 |= 0x01; - topleft.px_x = 0; topleft.px_y = 0; - topleft.val_x = 0x00c0; topleft.val_y = 0xf40; + +#ifdef SCREEN_ROTATE /* portait */ + topleft.val_x = 200; + topleft.val_y = 3900; + + bottomright.val_x = 3880; + bottomright.val_y = 270; +#else /* landscape */ + topleft.val_x = 270; + topleft.val_y = 200; + + bottomright.val_x = 3900; + bottomright.val_y = 3880; +#endif + + topleft.px_x = 0; + topleft.px_y = 0; - bottomright.px_x = LCD_WIDTH; bottomright.px_y = LCD_HEIGHT; - bottomright.val_x = 0x0f19; bottomright.val_y = 0x00fc; + bottomright.px_x = LCD_WIDTH; + bottomright.px_y = LCD_HEIGHT; + using_calibration = true; /* Enable the touchscreen interrupt */ -- cgit v1.2.3