summaryrefslogtreecommitdiff
path: root/firmware/usbstack
diff options
context:
space:
mode:
authorFranklin Wei <frankhwei536@gmail.com>2016-11-06 18:26:48 -0500
committerFranklin Wei <frankhwei536@gmail.com>2016-11-06 18:26:48 -0500
commit284b250c3b7feeef0bf5b45879922b6d4d51803d (patch)
tree17508a6cf6e61a5a44245545ec9af4b97eaf50b0 /firmware/usbstack
parent173d9fb38b029122e85610a69334ddb44107bd78 (diff)
parent3b7e7cb535582542b1dbebd87348a0fbf4f344bb (diff)
downloadrockbox-284b250c3b7feeef0bf5b45879922b6d4d51803d.zip
rockbox-284b250c3b7feeef0bf5b45879922b6d4d51803d.tar.gz
rockbox-284b250c3b7feeef0bf5b45879922b6d4d51803d.tar.bz2
rockbox-284b250c3b7feeef0bf5b45879922b6d4d51803d.tar.xz
Merge branch 'master' into working
Change-Id: Iad54233a3575c0117f88ce7a1e89bfa639760f63
Diffstat (limited to 'firmware/usbstack')
-rw-r--r--firmware/usbstack/usb_serial.c26
1 files changed, 11 insertions, 15 deletions
diff --git a/firmware/usbstack/usb_serial.c b/firmware/usbstack/usb_serial.c
index 7c425dc..d879dc7 100644
--- a/firmware/usbstack/usb_serial.c
+++ b/firmware/usbstack/usb_serial.c
@@ -55,16 +55,19 @@ static struct usb_endpoint_descriptor __attribute__((aligned(2)))
.bInterval = 0
};
+/* send_buffer: local ring buffer.
+ * transit_buffer: used to store aligned data that will be sent by the USB
+ * driver. PP502x needs boost for high speed USB, but still works up to
+ * around 100 bytes without boost, we play safe and limit packet size to 32
+ * bytes, it doesn't hurt because data can be sent over several transfers.
+ */
#define BUFFER_SIZE 512
-static unsigned char send_buffer[BUFFER_SIZE]
- USB_DEVBSS_ATTR __attribute__((aligned(32)));
+#define TRANSIT_BUFFER_SIZE 32
+static unsigned char send_buffer[BUFFER_SIZE];
+static unsigned char transit_buffer[TRANSIT_BUFFER_SIZE]
+ USB_DEVBSS_ATTR __attribute__((aligned(4)));
static unsigned char receive_buffer[32]
USB_DEVBSS_ATTR __attribute__((aligned(32)));
-#if CONFIG_USBOTG == USBOTG_DESIGNWARE
-/* Aligned transit buffer */
-static unsigned char transit_buffer[32]
- USB_DEVBSS_ATTR __attribute__((aligned(4)));
-#endif
static void sendout(void);
@@ -162,19 +165,12 @@ void usb_serial_disconnect(void)
static void sendout(void)
{
buffer_transitlength = MIN(buffer_length,BUFFER_SIZE-buffer_start);
- /* For unknown reasons packets larger than 96 bytes are not sent. We play
- * safe and limit to 32. TODO: find the real bug */
- buffer_transitlength = MIN(buffer_transitlength,32);
if(buffer_transitlength > 0)
{
+ buffer_transitlength = MIN(buffer_transitlength,TRANSIT_BUFFER_SIZE);
buffer_length -= buffer_transitlength;
-#if CONFIG_USBOTG == USBOTG_DESIGNWARE
memcpy(transit_buffer,&send_buffer[buffer_start],buffer_transitlength);
usb_drv_send_nonblocking(ep_in,transit_buffer,buffer_transitlength);
-#else
- usb_drv_send_nonblocking(ep_in, &send_buffer[buffer_start],
- buffer_transitlength);
-#endif
}
}