summaryrefslogtreecommitdiff
path: root/firmware/target/arm
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/arm')
-rwxr-xr-xfirmware/target/arm/tms320dm320/debug-dm320.c34
-rw-r--r--firmware/target/arm/tms320dm320/mrobe-500/button-mr500.c53
2 files changed, 65 insertions, 22 deletions
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)
35 35
36bool __dbg_hw_info(void) 36bool __dbg_hw_info(void)
37{ 37{
38 int line = 0, button; 38 int line = 0, button, oldline;
39 int *address=0x0; 39 int *address=0x0;
40 bool done=false; 40 bool done=false;
41 char buf[100]; 41 char buf[100];
@@ -43,11 +43,25 @@ bool __dbg_hw_info(void)
43 lcd_setmargins(0, 0); 43 lcd_setmargins(0, 0);
44 lcd_setfont(FONT_SYSFIXED); 44 lcd_setfont(FONT_SYSFIXED);
45 lcd_clear_display(); 45 lcd_clear_display();
46
47 /* Put all the static text befor the while loop */
46 lcd_puts(0, line++, "[Hardware info]"); 48 lcd_puts(0, line++, "[Hardware info]");
49
50 lcd_puts(0, line++, "Clock info:");
51 snprintf(buf, sizeof(buf), "IO_CLK_PLLA: 0x%04x IO_CLK_PLLB: 0x%04x IO_CLK_SEL0: 0x%04x IO_CLK_SEL1: 0x%04x",
52 IO_CLK_PLLA, IO_CLK_PLLB, IO_CLK_SEL0, IO_CLK_SEL1); lcd_puts(0, line++, buf);
53 snprintf(buf, sizeof(buf), "IO_CLK_SEL2: 0x%04x IO_CLK_DIV0: 0x%04x IO_CLK_DIV1: 0x%04x IO_CLK_DIV2: 0x%04x",
54 IO_CLK_SEL2, IO_CLK_DIV0, IO_CLK_DIV1, IO_CLK_DIV2); lcd_puts(0, line++, buf);
55 snprintf(buf, sizeof(buf), "IO_CLK_DIV3: 0x%04x IO_CLK_DIV4: 0x%04x IO_CLK_BYP : 0x%04x IO_CLK_INV : 0x%04x",
56 IO_CLK_DIV3, IO_CLK_DIV4, IO_CLK_BYP, IO_CLK_INV); lcd_puts(0, line++, buf);
57 snprintf(buf, sizeof(buf), "IO_CLK_MOD0: 0x%04x IO_CLK_MOD1: 0x%04x IO_CLK_MOD2: 0x%04x IO_CLK_LPCTL0: 0x%04x",
58 IO_CLK_MOD0, IO_CLK_MOD1, IO_CLK_MOD2, IO_CLK_LPCTL0); lcd_puts(0, line++, buf);
47 59
60 line++;
61 oldline=line;
48 while(!done) 62 while(!done)
49 { 63 {
50 line = 0; 64 line = oldline;
51 button = button_get(false); 65 button = button_get(false);
52 button&=~BUTTON_REPEAT; 66 button&=~BUTTON_REPEAT;
53 if (button == BUTTON_POWER) 67 if (button == BUTTON_POWER)
@@ -61,14 +75,14 @@ bool __dbg_hw_info(void)
61 else if (button==BUTTON_RC_REW) 75 else if (button==BUTTON_RC_REW)
62 address-=0x800; 76 address-=0x800;
63 77
64 snprintf(buf, sizeof(buf), "current tick: %04x", (unsigned int)current_tick); 78 snprintf(buf, sizeof(buf), "current tick: %08x Seconds running: %08d",
65 lcd_puts(0, line++, buf); 79 (unsigned int)current_tick, (unsigned int)current_tick/100); lcd_puts(0, line++, buf);
66 snprintf(buf, sizeof(buf), "Address: 0x%08x Data: 0x%08x", (unsigned int)address, *address); 80 snprintf(buf, sizeof(buf), "Address: 0x%08x Data: 0x%08x",
67 lcd_puts(0, line++, buf); 81 (unsigned int)address, *address); lcd_puts(0, line++, buf);
68 snprintf(buf, sizeof(buf), "Address: 0x%08x Data: 0x%08x", (unsigned int)(address+1), *(address+1)); 82 snprintf(buf, sizeof(buf), "Address: 0x%08x Data: 0x%08x",
69 lcd_puts(0, line++, buf); 83 (unsigned int)(address+1), *(address+1)); lcd_puts(0, line++, buf);
70 snprintf(buf, sizeof(buf), "Address: 0x%08x Data: 0x%08x", (unsigned int)(address+2), *(address+2)); 84 snprintf(buf, sizeof(buf), "Address: 0x%08x Data: 0x%08x",
71 lcd_puts(0, line++, buf); 85 (unsigned int)(address+2), *(address+2)); lcd_puts(0, line++, buf);
72 86
73 lcd_update(); 87 lcd_update();
74 } 88 }
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)
47 using_calibration = enable; 47 using_calibration = enable;
48} 48}
49/* Jd's tests.. These will hopefully work for everyone so we dont have to 49/* Jd's tests.. These will hopefully work for everyone so we dont have to
50 create a calibration screen. and 50 * create a calibration screen.
51(0,0) = 0x00c0, 0xf40 51 * Portait:
52(480,320) = 0x0f19, 0x00fc 52 * (0,0) = 200, 3900
53 * (480,640) = 3880, 270
54 * Landscape:
55 * (0,0) = 200, 270
56 * (640,480) = 3880, 3900
53*/ 57*/
54void set_calibration_points(struct touch_calibration_point *tl, 58void set_calibration_points(struct touch_calibration_point *tl,
55 struct touch_calibration_point *br) 59 struct touch_calibration_point *br)
@@ -57,16 +61,25 @@ void set_calibration_points(struct touch_calibration_point *tl,
57 memcpy(&topleft, tl, sizeof(struct touch_calibration_point)); 61 memcpy(&topleft, tl, sizeof(struct touch_calibration_point));
58 memcpy(&bottomright, br, sizeof(struct touch_calibration_point)); 62 memcpy(&bottomright, br, sizeof(struct touch_calibration_point));
59} 63}
64
60static int touch_to_pixels(short val_x, short val_y) 65static int touch_to_pixels(short val_x, short val_y)
61{ 66{
62 short x,y; 67 short x,y;
63 int x1,x2; 68
69#ifdef SCREEN_ROTATE /* portait */
70 x=val_x;
71 y=val_y;
72#else
73 x=val_y;
74 y=val_x;
75#endif
76
64 if (!using_calibration) 77 if (!using_calibration)
65 return (val_x<<16)|val_y; 78 return (val_x<<16)|val_y;
66 x1 = topleft.val_x; x2 = bottomright.val_x; 79
67 x = (val_x-x1)*(bottomright.px_x - topleft.px_x) / (x2 - x1) + topleft.px_x; 80 x = (x-topleft.val_x)*(bottomright.px_x - topleft.px_x) / (bottomright.val_x - topleft.val_x) + topleft.px_x;
68 x1 = topleft.val_y; x2 = bottomright.val_y; 81 y = (y-topleft.val_y)*(bottomright.px_y - topleft.px_y) / (bottomright.val_y - topleft.val_y) + topleft.px_y;
69 y = (val_y-x1)*(bottomright.px_y - topleft.px_y) / (x2 - x1) + topleft.px_y; 82
70 if (x < 0) 83 if (x < 0)
71 x = 0; 84 x = 0;
72 if (y < 0) 85 if (y < 0)
@@ -79,11 +92,27 @@ void button_init_device(void)
79 touch_available = false; 92 touch_available = false;
80 /* GIO is the power button, set as input */ 93 /* GIO is the power button, set as input */
81 IO_GIO_DIR0 |= 0x01; 94 IO_GIO_DIR0 |= 0x01;
82 topleft.px_x = 0; topleft.px_y = 0; 95
83 topleft.val_x = 0x00c0; topleft.val_y = 0xf40; 96#ifdef SCREEN_ROTATE /* portait */
97 topleft.val_x = 200;
98 topleft.val_y = 3900;
99
100 bottomright.val_x = 3880;
101 bottomright.val_y = 270;
102#else /* landscape */
103 topleft.val_x = 270;
104 topleft.val_y = 200;
105
106 bottomright.val_x = 3900;
107 bottomright.val_y = 3880;
108#endif
109
110 topleft.px_x = 0;
111 topleft.px_y = 0;
84 112
85 bottomright.px_x = LCD_WIDTH; bottomright.px_y = LCD_HEIGHT; 113 bottomright.px_x = LCD_WIDTH;
86 bottomright.val_x = 0x0f19; bottomright.val_y = 0x00fc; 114 bottomright.px_y = LCD_HEIGHT;
115
87 using_calibration = true; 116 using_calibration = true;
88 117
89 /* Enable the touchscreen interrupt */ 118 /* Enable the touchscreen interrupt */