diff options
-rw-r--r-- | bootloader/gigabeat-s.c | 3 | ||||
-rw-r--r-- | firmware/drivers/isp1583.c | 12 | ||||
-rw-r--r-- | firmware/export/dm320.h | 8 | ||||
-rw-r--r-- | firmware/target/arm/tms320dm320/creative-zvm/usb-creativezvm.c | 5 |
4 files changed, 19 insertions, 9 deletions
diff --git a/bootloader/gigabeat-s.c b/bootloader/gigabeat-s.c index 15cbcbed46..57eb18ec56 100644 --- a/bootloader/gigabeat-s.c +++ b/bootloader/gigabeat-s.c | |||
@@ -93,10 +93,7 @@ static void handle_usb(void) | |||
93 | /* Check if plugged and pause to look at messages. If the cable was pulled | 93 | /* Check if plugged and pause to look at messages. If the cable was pulled |
94 | * while waiting, proceed as if it never was plugged. */ | 94 | * while waiting, proceed as if it never was plugged. */ |
95 | if (!usb_plugged() || !pause_if_button_pressed(true)) | 95 | if (!usb_plugged() || !pause_if_button_pressed(true)) |
96 | { | ||
97 | /* Bang on the controller */ | ||
98 | return; | 96 | return; |
99 | } | ||
100 | 97 | ||
101 | /** Enter USB mode **/ | 98 | /** Enter USB mode **/ |
102 | 99 | ||
diff --git a/firmware/drivers/isp1583.c b/firmware/drivers/isp1583.c index 2d986384e6..9e7d601278 100644 --- a/firmware/drivers/isp1583.c +++ b/firmware/drivers/isp1583.c | |||
@@ -55,7 +55,7 @@ struct usb_endpoint | |||
55 | }; | 55 | }; |
56 | 56 | ||
57 | static unsigned char setup_pkt_buf[8]; | 57 | static unsigned char setup_pkt_buf[8]; |
58 | static struct usb_endpoint endpoints[NUM_ENDPOINTS]; | 58 | static struct usb_endpoint endpoints[USB_NUM_ENDPOINTS]; |
59 | 59 | ||
60 | static bool high_speed_mode = false; | 60 | static bool high_speed_mode = false; |
61 | 61 | ||
@@ -366,7 +366,7 @@ static void setup_endpoints(void) | |||
366 | usb_setup_endpoint(ep_index(0, DIR_TX), 64, 0); | 366 | usb_setup_endpoint(ep_index(0, DIR_TX), 64, 0); |
367 | 367 | ||
368 | int i; | 368 | int i; |
369 | for(i = 1; i < NUM_ENDPOINTS-1; i++) | 369 | for(i = 1; i < USB_NUM_ENDPOINTS-1; i++) |
370 | { | 370 | { |
371 | usb_setup_endpoint(ep_index(i, DIR_RX), (high_speed_mode ? 512 : 64), 2); /* 2 = TYPE_BULK */ | 371 | usb_setup_endpoint(ep_index(i, DIR_RX), (high_speed_mode ? 512 : 64), 2); /* 2 = TYPE_BULK */ |
372 | usb_setup_endpoint(ep_index(i, DIR_TX), (high_speed_mode ? 512 : 64), 2); | 372 | usb_setup_endpoint(ep_index(i, DIR_TX), (high_speed_mode ? 512 : 64), 2); |
@@ -375,7 +375,7 @@ static void setup_endpoints(void) | |||
375 | usb_enable_endpoint(ep_index(0, DIR_RX)); | 375 | usb_enable_endpoint(ep_index(0, DIR_RX)); |
376 | usb_enable_endpoint(ep_index(0, DIR_TX)); | 376 | usb_enable_endpoint(ep_index(0, DIR_TX)); |
377 | 377 | ||
378 | for (i = 1; i < NUM_ENDPOINTS-1; i++) | 378 | for (i = 1; i < USB_NUM_ENDPOINTS-1; i++) |
379 | { | 379 | { |
380 | usb_enable_endpoint(ep_index(i, DIR_RX)); | 380 | usb_enable_endpoint(ep_index(i, DIR_RX)); |
381 | usb_enable_endpoint(ep_index(i, DIR_TX)); | 381 | usb_enable_endpoint(ep_index(i, DIR_TX)); |
@@ -598,7 +598,7 @@ void usb_drv_cancel_all_transfers(void) | |||
598 | logf("usb_drv_cancel_all_tranfers()"); | 598 | logf("usb_drv_cancel_all_tranfers()"); |
599 | int i; | 599 | int i; |
600 | 600 | ||
601 | for(i=0;i<NUM_ENDPOINTS-1;i++) | 601 | for(i=0;i<USB_NUM_ENDPOINTS-1;i++) |
602 | endpoints[i].halt[0] = endpoints[i].halt[1] = 1; | 602 | endpoints[i].halt[0] = endpoints[i].halt[1] = 1; |
603 | } | 603 | } |
604 | 604 | ||
@@ -608,7 +608,7 @@ int usb_drv_request_endpoint(int dir) | |||
608 | 608 | ||
609 | bit=(dir & USB_DIR_IN)? 2:1; | 609 | bit=(dir & USB_DIR_IN)? 2:1; |
610 | 610 | ||
611 | for (i=1; i < NUM_ENDPOINTS; i++) { | 611 | for (i=1; i < USB_NUM_ENDPOINTS; i++) { |
612 | if((endpoints[i].allocation & bit)!=0) | 612 | if((endpoints[i].allocation & bit)!=0) |
613 | continue; | 613 | continue; |
614 | endpoints[i].allocation |= bit; | 614 | endpoints[i].allocation |= bit; |
@@ -738,7 +738,7 @@ void usb_drv_set_address(int address) | |||
738 | 738 | ||
739 | int dbg_usb_num_items(void) | 739 | int dbg_usb_num_items(void) |
740 | { | 740 | { |
741 | return 2+NUM_ENDPOINTS*2; | 741 | return 2+USB_NUM_ENDPOINTS*2; |
742 | } | 742 | } |
743 | 743 | ||
744 | char* dbg_usb_item(int selected_item, void *data, char *buffer, size_t buffer_len) | 744 | char* dbg_usb_item(int selected_item, void *data, char *buffer, size_t buffer_len) |
diff --git a/firmware/export/dm320.h b/firmware/export/dm320.h index 4d6b9ac08b..0e1623365a 100644 --- a/firmware/export/dm320.h +++ b/firmware/export/dm320.h | |||
@@ -43,6 +43,14 @@ | |||
43 | #define PHY_IO_BASE2 0x00060000 | 43 | #define PHY_IO_BASE2 0x00060000 |
44 | #define DM320_REG2(addr) (*(volatile unsigned int *)(PHY_IO_BASE2 + (addr))) | 44 | #define DM320_REG2(addr) (*(volatile unsigned int *)(PHY_IO_BASE2 + (addr))) |
45 | 45 | ||
46 | /* USBOTG */ | ||
47 | #define USB_NUM_ENDPOINTS 3 | ||
48 | /* This needs to be 2048 byte aligned, but USB_QHARRAY_ATTR should take care | ||
49 | * of that */ | ||
50 | #define USB_QHARRAY_ATTR __attribute__((section(".qharray"),nocommon,aligned(4))) | ||
51 | #define USB_DEVBSS_ATTR IBSS_ATTR | ||
52 | |||
53 | |||
46 | /* Timer 0-3 */ | 54 | /* Timer 0-3 */ |
47 | #define IO_TIMER0_TMMD DM320_REG(0x0000) | 55 | #define IO_TIMER0_TMMD DM320_REG(0x0000) |
48 | #define IO_TIMER0_TMRSV0 DM320_REG(0x0002) | 56 | #define IO_TIMER0_TMRSV0 DM320_REG(0x0002) |
diff --git a/firmware/target/arm/tms320dm320/creative-zvm/usb-creativezvm.c b/firmware/target/arm/tms320dm320/creative-zvm/usb-creativezvm.c index 52e5a95d36..9b362f003c 100644 --- a/firmware/target/arm/tms320dm320/creative-zvm/usb-creativezvm.c +++ b/firmware/target/arm/tms320dm320/creative-zvm/usb-creativezvm.c | |||
@@ -56,6 +56,11 @@ void usb_enable(bool on) | |||
56 | usb_core_exit(); | 56 | usb_core_exit(); |
57 | } | 57 | } |
58 | 58 | ||
59 | void usb_attach(void) | ||
60 | { | ||
61 | usb_enable(true); | ||
62 | } | ||
63 | |||
59 | void IRAM_ATTR GIO7(void) | 64 | void IRAM_ATTR GIO7(void) |
60 | { | 65 | { |
61 | #ifdef DEBUG | 66 | #ifdef DEBUG |