From ed5f1ed3e21e44cf052834c7d6fd70abfd1a6196 Mon Sep 17 00:00:00 2001 From: Maurus Cuelenaere Date: Sat, 3 May 2008 14:43:43 +0000 Subject: 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 --- firmware/drivers/isp1583.c | 54 +++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 51 insertions(+), 3 deletions(-) (limited to 'firmware/drivers') 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 @@ #include "isp1583.h" #include "thread.h" #include "logf.h" +#include #define DIR_RX 0 #define DIR_TX 1 @@ -149,7 +150,7 @@ static void usb_enable_endpoint(int idx) endpoints[epidx_n(idx)].enabled[epidx_dir(idx)] = 1; } - +/* static void usb_disable_endpoint(int idx, bool set_struct) { usb_select_endpoint(idx); @@ -159,7 +160,7 @@ static void usb_disable_endpoint(int idx, bool set_struct) if(set_struct) endpoints[epidx_n(idx)].enabled[epidx_dir(idx)] = 0; } - +*/ static int usb_get_packet(unsigned char *buf, int max_len) { int len, i; @@ -389,7 +390,7 @@ void usb_helper(void) if(ISP1583_GEN_INT_READ & ISP1583_INIT_INTEN_READ) { #ifdef DEBUG - //logf("Helper detected interrupt... [%d]", current_tick); + logf("Helper detected interrupt... [%d]", current_tick); #endif usb_drv_int(); } @@ -712,6 +713,53 @@ void usb_drv_set_address(int address) usb_status_ack(0, DIR_TX); } +int dbg_usb_num_items(void) +{ + return 2+NUM_ENDPOINTS*2; +} + +char* dbg_usb_item(int selected_item, void *data, char *buffer, size_t buffer_len) +{ + if(selected_item < 2) + { + switch(selected_item) + { + case 0: + snprintf(buffer, buffer_len, "USB connected: %s", (usb_drv_connected() ? "Yes" : "No")); + return buffer; + case 1: + snprintf(buffer, buffer_len, "HS mode: %s", (high_speed_mode ? "Yes" : "No")); + return buffer; + } + } + else + { + int n = ep_index((selected_item - 2) / 2, (selected_item - 2) % 2); + if(endpoints[n].enabled == false) + snprintf(buffer, buffer_len, "EP%d[%s]: DISABLED", epidx_n(n), (epidx_dir(n) ? "TX" : "RX")); + else + { + if(epidx_dir(n)) + { + if(endpoints[n].out_in_progress) + 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); + else + snprintf(buffer, buffer_len, "EP%d[TX]: STANDBY", epidx_n(n)); + } + else + { + if(endpoints[n].in_buf && !endpoints[n].in_ack) + 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); + else + snprintf(buffer, buffer_len, "EP%d[RX]: STANDBY", epidx_n(n)); + } + } + return buffer; + } + return NULL; + (void)data; +} + void usb_drv_set_test_mode(int mode) { logf("usb_drv_set_test_mode(%d)", mode); -- cgit v1.2.3