summaryrefslogtreecommitdiff
path: root/firmware
diff options
context:
space:
mode:
authorMaurus Cuelenaere <mcuelenaere@gmail.com>2008-05-03 14:43:43 +0000
committerMaurus Cuelenaere <mcuelenaere@gmail.com>2008-05-03 14:43:43 +0000
commited5f1ed3e21e44cf052834c7d6fd70abfd1a6196 (patch)
tree2a7ea36bf7739227091878407c1484f2a1a3cb5a /firmware
parent5fc59065032fda288e5f64405492ba8a949819f1 (diff)
downloadrockbox-ed5f1ed3e21e44cf052834c7d6fd70abfd1a6196.tar.gz
rockbox-ed5f1ed3e21e44cf052834c7d6fd70abfd1a6196.zip
1) add debug menu for USB & PIC
2) update keymap 3) fix yellow git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17324 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware')
-rw-r--r--firmware/drivers/isp1583.c54
-rw-r--r--firmware/target/arm/tms320dm320/creative-zvm/pic-creativezvm.c81
-rw-r--r--firmware/target/arm/tms320dm320/creative-zvm/usb-target.h1
-rwxr-xr-xfirmware/target/arm/tms320dm320/debug-dm320.c18
4 files changed, 116 insertions, 38 deletions
diff --git a/firmware/drivers/isp1583.c b/firmware/drivers/isp1583.c
index 351618d566..7e78f87468 100644
--- a/firmware/drivers/isp1583.c
+++ b/firmware/drivers/isp1583.c
@@ -26,6 +26,7 @@
26#include "isp1583.h" 26#include "isp1583.h"
27#include "thread.h" 27#include "thread.h"
28#include "logf.h" 28#include "logf.h"
29#include <stdio.h>
29 30
30#define DIR_RX 0 31#define DIR_RX 0
31#define DIR_TX 1 32#define DIR_TX 1
@@ -149,7 +150,7 @@ static void usb_enable_endpoint(int idx)
149 150
150 endpoints[epidx_n(idx)].enabled[epidx_dir(idx)] = 1; 151 endpoints[epidx_n(idx)].enabled[epidx_dir(idx)] = 1;
151} 152}
152 153/*
153static void usb_disable_endpoint(int idx, bool set_struct) 154static void usb_disable_endpoint(int idx, bool set_struct)
154{ 155{
155 usb_select_endpoint(idx); 156 usb_select_endpoint(idx);
@@ -159,7 +160,7 @@ static void usb_disable_endpoint(int idx, bool set_struct)
159 if(set_struct) 160 if(set_struct)
160 endpoints[epidx_n(idx)].enabled[epidx_dir(idx)] = 0; 161 endpoints[epidx_n(idx)].enabled[epidx_dir(idx)] = 0;
161} 162}
162 163*/
163static int usb_get_packet(unsigned char *buf, int max_len) 164static int usb_get_packet(unsigned char *buf, int max_len)
164{ 165{
165 int len, i; 166 int len, i;
@@ -389,7 +390,7 @@ void usb_helper(void)
389 if(ISP1583_GEN_INT_READ & ISP1583_INIT_INTEN_READ) 390 if(ISP1583_GEN_INT_READ & ISP1583_INIT_INTEN_READ)
390 { 391 {
391 #ifdef DEBUG 392 #ifdef DEBUG
392 //logf("Helper detected interrupt... [%d]", current_tick); 393 logf("Helper detected interrupt... [%d]", current_tick);
393 #endif 394 #endif
394 usb_drv_int(); 395 usb_drv_int();
395 } 396 }
@@ -712,6 +713,53 @@ void usb_drv_set_address(int address)
712 usb_status_ack(0, DIR_TX); 713 usb_status_ack(0, DIR_TX);
713} 714}
714 715
716int dbg_usb_num_items(void)
717{
718 return 2+NUM_ENDPOINTS*2;
719}
720
721char* dbg_usb_item(int selected_item, void *data, char *buffer, size_t buffer_len)
722{
723 if(selected_item < 2)
724 {
725 switch(selected_item)
726 {
727 case 0:
728 snprintf(buffer, buffer_len, "USB connected: %s", (usb_drv_connected() ? "Yes" : "No"));
729 return buffer;
730 case 1:
731 snprintf(buffer, buffer_len, "HS mode: %s", (high_speed_mode ? "Yes" : "No"));
732 return buffer;
733 }
734 }
735 else
736 {
737 int n = ep_index((selected_item - 2) / 2, (selected_item - 2) % 2);
738 if(endpoints[n].enabled == false)
739 snprintf(buffer, buffer_len, "EP%d[%s]: DISABLED", epidx_n(n), (epidx_dir(n) ? "TX" : "RX"));
740 else
741 {
742 if(epidx_dir(n))
743 {
744 if(endpoints[n].out_in_progress)
745 snprintf(buffer, buffer_len, "EP%d[TX]: TRANSFERRING DATA -> %d bytes/%d bytes", epidx_n(n), (endpoints[n].out_len - endpoints[n].out_ptr), endpoints[n].out_len);
746 else
747 snprintf(buffer, buffer_len, "EP%d[TX]: STANDBY", epidx_n(n));
748 }
749 else
750 {
751 if(endpoints[n].in_buf && !endpoints[n].in_ack)
752 snprintf(buffer, buffer_len, "EP%d[RX]: RECEIVING DATA -> %d bytes/%d bytes", epidx_n(n), endpoints[n].in_ptr, endpoints[n].in_max_len);
753 else
754 snprintf(buffer, buffer_len, "EP%d[RX]: STANDBY", epidx_n(n));
755 }
756 }
757 return buffer;
758 }
759 return NULL;
760 (void)data;
761}
762
715void usb_drv_set_test_mode(int mode) 763void usb_drv_set_test_mode(int mode)
716{ 764{
717 logf("usb_drv_set_test_mode(%d)", mode); 765 logf("usb_drv_set_test_mode(%d)", mode);
diff --git a/firmware/target/arm/tms320dm320/creative-zvm/pic-creativezvm.c b/firmware/target/arm/tms320dm320/creative-zvm/pic-creativezvm.c
index 09d3cf7c67..334ef25683 100644
--- a/firmware/target/arm/tms320dm320/creative-zvm/pic-creativezvm.c
+++ b/firmware/target/arm/tms320dm320/creative-zvm/pic-creativezvm.c
@@ -25,7 +25,6 @@
25#include "button-target.h" 25#include "button-target.h"
26#include "i2c-dm320.h" 26#include "i2c-dm320.h"
27 27
28
29#include "lcd-target.h" 28#include "lcd-target.h"
30#include "lcd.h" 29#include "lcd.h"
31#include "sprintf.h" 30#include "sprintf.h"
@@ -46,8 +45,10 @@
46#define BTN_REL 1 45#define BTN_REL 1
47 46
48#define BTN_TOUCHPAD_PRESS 0x1F00 47#define BTN_TOUCHPAD_PRESS 0x1F00
48#define BTN_TOUCHPAD_SCROLL_DOWN 0x0F03
49#define BTN_TOUCHPAD_CORNER_DOWN 0xAF00 49#define BTN_TOUCHPAD_CORNER_DOWN 0xAF00
50#define BTN_TOUCHPAD_CORNER_UP 0x3F00 50#define BTN_TOUCHPAD_CORNER_UP 0x3F00
51#define BTN_TOUCHPAD_SCROLL_UP 0x0F04
51 52
52#define HEADPHONE_PLUGIN_A 0x5707 53#define HEADPHONE_PLUGIN_A 0x5707
53#define HEADPHONE_PLUGIN_B 0x5F07 54#define HEADPHONE_PLUGIN_B 0x5F07
@@ -176,6 +177,9 @@ static bool sw = false;
176 177
177void GIO0(void) 178void GIO0(void)
178{ 179{
180 /* Mask GIO0 interrupt */
181 IO_INTC_IRQ1 = INTR_IRQ1_EXT0;
182
179 unsigned char msg[4]; 183 unsigned char msg[4];
180 i2c_read(PIC_ADR, msg, sizeof(msg)); 184 i2c_read(PIC_ADR, msg, sizeof(msg));
181 tick_diff = current_tick - last_tick; 185 tick_diff = current_tick - last_tick;
@@ -200,6 +204,12 @@ void GIO0(void)
200 map_button(BTN_TOUCHPAD_PRESS, BUTTON_SELECT); 204 map_button(BTN_TOUCHPAD_PRESS, BUTTON_SELECT);
201 map_button(BTN_TOUCHPAD_CORNER_DOWN, BUTTON_DOWN); 205 map_button(BTN_TOUCHPAD_CORNER_DOWN, BUTTON_DOWN);
202 map_button(BTN_TOUCHPAD_CORNER_UP, BUTTON_UP); 206 map_button(BTN_TOUCHPAD_CORNER_UP, BUTTON_UP);
207 case BTN_TOUCHPAD_SCROLL_DOWN:
208 btn = BUTTON_DOWN;
209 break;
210 case BTN_TOUCHPAD_SCROLL_UP:
211 btn = BUTTON_UP;
212 break;
203 case BTN_HOLD: 213 case BTN_HOLD:
204 hold_switch = true; 214 hold_switch = true;
205 break; 215 break;
@@ -252,8 +262,6 @@ void GIO0(void)
252 lcd_update(); 262 lcd_update();
253 sw = !sw; 263 sw = !sw;
254#endif 264#endif
255 /* Mask GIO0 interrupt */
256 IO_INTC_IRQ1 = INTR_IRQ1_EXT0;
257} 265}
258 266
259void send_command_to_pic(unsigned char in, unsigned char* out, 267void send_command_to_pic(unsigned char in, unsigned char* out,
@@ -292,8 +300,7 @@ void button_init_device(void)
292 it? */ 300 it? */
293 /* Enable GIO0 interrupt */ 301 /* Enable GIO0 interrupt */
294 IO_INTC_EINT1 |= INTR_EINT1_EXT0; 302 IO_INTC_EINT1 |= INTR_EINT1_EXT0;
295 btn = nonbtn = pic_init_value = pic_init2_value = last_btn = hold_switch = 303 btn=nonbtn=pic_init_value=pic_init2_value=last_btn=hold_switch=0;
296 0;
297 /* Initialize PIC */ 304 /* Initialize PIC */
298 send_command_to_pic(1, (unsigned char *)&pic_init_value, 305 send_command_to_pic(1, (unsigned char *)&pic_init_value,
299 sizeof(pic_init_value)); 306 sizeof(pic_init_value));
@@ -301,27 +308,12 @@ void button_init_device(void)
301 sizeof(pic_init2_value)); 308 sizeof(pic_init2_value));
302} 309}
303 310
304int get_debug_info(int choice)
305{
306 switch(choice)
307 {
308 case 1:
309 return pic_init_value;
310 case 2:
311 return pic_init2_value;
312 case 3:
313 return last_btn;
314 case 4:
315 return nonbtn;
316 case 5:
317 return tick_diff;
318 }
319 return -1;
320}
321
322int button_read_device(void) 311int button_read_device(void)
323{ 312{
324 return btn; 313 if(hold_switch)
314 return 0;
315 else
316 return btn;
325} 317}
326 318
327bool button_hold(void) 319bool button_hold(void)
@@ -333,3 +325,44 @@ bool button_usb_connected(void)
333{ 325{
334 return (bool)(nonbtn & NONBUTTON_USB); 326 return (bool)(nonbtn & NONBUTTON_USB);
335} 327}
328
329int pic_dbg_num_items(void)
330{
331 return 13;
332}
333
334char* pic_dbg_item(int selected_item, void *data, char *buffer, size_t buffer_len)
335{
336 (void)data;
337 switch(selected_item)
338 {
339 case 0:
340 snprintf(buffer, buffer_len, "Init value 1: 0x%04x", pic_init_value);
341 return buffer;
342 case 1:
343 snprintf(buffer, buffer_len, "Init value 2: 0x%04x", pic_init2_value);
344 return buffer;
345 case 2:
346 snprintf(buffer, buffer_len, "Last button value: 0x%04x Raw value: 0x%04x", last_btn, btn);
347 return buffer;
348 case 3:
349 snprintf(buffer, buffer_len, "Last button differs in ticks: 0x%04x", tick_diff);
350 return buffer;
351 case 4:
352 snprintf(buffer, buffer_len, "Dock values: 0x%04x", nonbtn);
353 return buffer;
354 #define B(n,w,b) case n: \
355 snprintf(buffer, buffer_len, "%s: 0x%04x", w, b); \
356 return buffer;
357 B(5, "MASK_TV_OUT", MASK_TV_OUT(pic_init_value));
358 B(6, "MASK_xx1", MASK_xx1(pic_init_value));
359 B(7, "MASK_xx2", MASK_xx2(pic_init_value));
360 B(8, "MASK_xx3", MASK_xx3(pic_init_value));
361 B(9, "MASK_xx4", MASK_xx4(pic_init_value));
362 B(10, "MASK_xx5", MASK_xx5(pic_init_value));
363 B(11, "MASK_xx6", MASK_xx6(pic_init_value));
364 B(12, "MASK_xx7", MASK_xx7(pic_init_value));
365 #undef B
366 }
367 return NULL;
368}
diff --git a/firmware/target/arm/tms320dm320/creative-zvm/usb-target.h b/firmware/target/arm/tms320dm320/creative-zvm/usb-target.h
index 4e3303911c..14ddc6eb0a 100644
--- a/firmware/target/arm/tms320dm320/creative-zvm/usb-target.h
+++ b/firmware/target/arm/tms320dm320/creative-zvm/usb-target.h
@@ -22,6 +22,7 @@
22 22
23#include "dm320.h" 23#include "dm320.h"
24 24
25/* General purpose memory region #2 */
25#define ISP1583_IOBASE 0x60FFC000 26#define ISP1583_IOBASE 0x60FFC000
26#define ISP1583_H_OVERRIDE 27#define ISP1583_H_OVERRIDE
27 28
diff --git a/firmware/target/arm/tms320dm320/debug-dm320.c b/firmware/target/arm/tms320dm320/debug-dm320.c
index abfb5b09bc..23257ddcc6 100755
--- a/firmware/target/arm/tms320dm320/debug-dm320.c
+++ b/firmware/target/arm/tms320dm320/debug-dm320.c
@@ -82,6 +82,13 @@ bool __dbg_hw_info(void)
82 lcd_puts(0, line++, buf); 82 lcd_puts(0, line++, buf);
83 snprintf(buf, sizeof(buf), " IO_CLK_MOD2: 0x%04x IO_CLK_LPCTL0: 0x%04x ", IO_CLK_MOD2, IO_CLK_LPCTL0); 83 snprintf(buf, sizeof(buf), " IO_CLK_MOD2: 0x%04x IO_CLK_LPCTL0: 0x%04x ", IO_CLK_MOD2, IO_CLK_LPCTL0);
84 lcd_puts(0, line++, buf); 84 lcd_puts(0, line++, buf);
85 lcd_puts(0, line++, "Interrupt info:");
86 snprintf(buf, sizeof(buf), " IO_INTC_EINT0: 0x%04x IO_INTC_EINT1: 0x%04x ", IO_INTC_EINT0, IO_INTC_EINT1);
87 lcd_puts(0, line++, buf);
88 snprintf(buf, sizeof(buf), " IO_INTC_EINT2: 0x%04x IO_INTC_IRQ0: 0x%04x ", IO_INTC_EINT2, IO_INTC_IRQ0);
89 lcd_puts(0, line++, buf);
90 snprintf(buf, sizeof(buf), " IO_INTC_IRQ1: 0x%04x IO_INTC_IRQ2: 0x%04x ", IO_INTC_IRQ1, IO_INTC_IRQ2);
91 lcd_puts(0, line++, buf);
85#endif 92#endif
86 93
87 lcd_puts(0, line++, "Board revision:"); 94 lcd_puts(0, line++, "Board revision:");
@@ -130,17 +137,6 @@ bool __dbg_hw_info(void)
130 else if(button & BUTTON_RIGHT) 137 else if(button & BUTTON_RIGHT)
131 lcd_set_direct_fb(true); 138 lcd_set_direct_fb(true);
132 139
133 lcd_puts(0, line++, "PIC info:");
134 snprintf(buf, sizeof(buf), " Init value 1: 0x%04x", get_debug_info(1));
135 lcd_puts(0, line++, buf);
136 snprintf(buf, sizeof(buf), " Init value 2: 0x%04x", get_debug_info(2));
137 lcd_puts(0, line++, buf);
138 snprintf(buf, sizeof(buf), " Last button value: 0x%04x Raw value: 0x%04x", get_debug_info(3), button_read_device());
139 lcd_puts(0, line++, buf);
140 snprintf(buf, sizeof(buf), " Last button at: 0x%04x", get_debug_info(5));
141 lcd_puts(0, line++, buf);
142 snprintf(buf, sizeof(buf), " Dock values: 0x%04x", get_debug_info(4));
143 lcd_puts(0, line++, buf);
144 lcd_puts(0, line++, "LCD info:"); 140 lcd_puts(0, line++, "LCD info:");
145 snprintf(buf, sizeof(buf), " LCD direct FB access? %s", (lcd_get_direct_fb() ? "yes" : "no")); 141 snprintf(buf, sizeof(buf), " LCD direct FB access? %s", (lcd_get_direct_fb() ? "yes" : "no"));
146 lcd_puts(0, line++, buf); 142 lcd_puts(0, line++, buf);