summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bootloader/gigabeat-s.c3
-rw-r--r--firmware/drivers/isp1583.c12
-rw-r--r--firmware/export/dm320.h8
-rw-r--r--firmware/target/arm/tms320dm320/creative-zvm/usb-creativezvm.c5
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)
/* Check if plugged and pause to look at messages. If the cable was pulled
* while waiting, proceed as if it never was plugged. */
if (!usb_plugged() || !pause_if_button_pressed(true))
- {
- /* Bang on the controller */
return;
- }
/** Enter USB mode **/
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
};
static unsigned char setup_pkt_buf[8];
-static struct usb_endpoint endpoints[NUM_ENDPOINTS];
+static struct usb_endpoint endpoints[USB_NUM_ENDPOINTS];
static bool high_speed_mode = false;
@@ -366,7 +366,7 @@ static void setup_endpoints(void)
usb_setup_endpoint(ep_index(0, DIR_TX), 64, 0);
int i;
- for(i = 1; i < NUM_ENDPOINTS-1; i++)
+ for(i = 1; i < USB_NUM_ENDPOINTS-1; i++)
{
usb_setup_endpoint(ep_index(i, DIR_RX), (high_speed_mode ? 512 : 64), 2); /* 2 = TYPE_BULK */
usb_setup_endpoint(ep_index(i, DIR_TX), (high_speed_mode ? 512 : 64), 2);
@@ -375,7 +375,7 @@ static void setup_endpoints(void)
usb_enable_endpoint(ep_index(0, DIR_RX));
usb_enable_endpoint(ep_index(0, DIR_TX));
- for (i = 1; i < NUM_ENDPOINTS-1; i++)
+ for (i = 1; i < USB_NUM_ENDPOINTS-1; i++)
{
usb_enable_endpoint(ep_index(i, DIR_RX));
usb_enable_endpoint(ep_index(i, DIR_TX));
@@ -598,7 +598,7 @@ void usb_drv_cancel_all_transfers(void)
logf("usb_drv_cancel_all_tranfers()");
int i;
- for(i=0;i<NUM_ENDPOINTS-1;i++)
+ for(i=0;i<USB_NUM_ENDPOINTS-1;i++)
endpoints[i].halt[0] = endpoints[i].halt[1] = 1;
}
@@ -608,7 +608,7 @@ int usb_drv_request_endpoint(int dir)
bit=(dir & USB_DIR_IN)? 2:1;
- for (i=1; i < NUM_ENDPOINTS; i++) {
+ for (i=1; i < USB_NUM_ENDPOINTS; i++) {
if((endpoints[i].allocation & bit)!=0)
continue;
endpoints[i].allocation |= bit;
@@ -738,7 +738,7 @@ void usb_drv_set_address(int address)
int dbg_usb_num_items(void)
{
- return 2+NUM_ENDPOINTS*2;
+ return 2+USB_NUM_ENDPOINTS*2;
}
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 @@
#define PHY_IO_BASE2 0x00060000
#define DM320_REG2(addr) (*(volatile unsigned int *)(PHY_IO_BASE2 + (addr)))
+/* USBOTG */
+#define USB_NUM_ENDPOINTS 3
+/* This needs to be 2048 byte aligned, but USB_QHARRAY_ATTR should take care
+ * of that */
+#define USB_QHARRAY_ATTR __attribute__((section(".qharray"),nocommon,aligned(4)))
+#define USB_DEVBSS_ATTR IBSS_ATTR
+
+
/* Timer 0-3 */
#define IO_TIMER0_TMMD DM320_REG(0x0000)
#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)
usb_core_exit();
}
+void usb_attach(void)
+{
+ usb_enable(true);
+}
+
void IRAM_ATTR GIO7(void)
{
#ifdef DEBUG