summaryrefslogtreecommitdiff
path: root/firmware/drivers
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/drivers
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/drivers')
-rw-r--r--firmware/drivers/isp1583.c54
1 files changed, 51 insertions, 3 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);