summaryrefslogtreecommitdiff
path: root/firmware
diff options
context:
space:
mode:
authorKarl Kurbjun <kkurbjun@gmail.com>2009-08-01 15:41:40 +0000
committerKarl Kurbjun <kkurbjun@gmail.com>2009-08-01 15:41:40 +0000
commitf3298a46126be6ee649da68d2d952daeb79e2a53 (patch)
tree3de9b7bdec6d5c677898bb1c3600c49cd24d2475 /firmware
parent5c882be6081391599158afb03be11ec18b2fc112 (diff)
M:Robe 500/M66591: Add support for full-speed USB transfers, and fix the UART interrupt clearing.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22095 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware')
-rw-r--r--firmware/drivers/m66591.c60
-rw-r--r--firmware/target/arm/tms320dm320/uart-dm320.c3
2 files changed, 43 insertions, 20 deletions
diff --git a/firmware/drivers/m66591.c b/firmware/drivers/m66591.c
index b70ff2ba7d..06d42b55c2 100644
--- a/firmware/drivers/m66591.c
+++ b/firmware/drivers/m66591.c
@@ -41,6 +41,11 @@
/*******************************************************************************
* These are the driver specific defines.
******************************************************************************/
+
+/* This define is primarily intended for testing, using HISPEED all the time
+ * should be acceptable since the defice should down-train if the host does not
+ * support HISPEED.
+ */
#define HISPEED
/* Right now sending blocks till the full transfer has completed, this needs to
@@ -134,24 +139,43 @@ static int pipe_buffer_size (int pipe) {
}
#endif
-/* This function returns the maximum packet size for each endpoint/pipe. It is
- * Currently only setup to support Highspeed mode.
+/* This function returns the maximum packet size for each endpoint/pipe. The
+ * max packet size is dependent on whether the device is running High or Full
+ * speed.
*/
static int pipe_maxpack_size (int pipe) {
- switch(pipe) {
- case 0:
- /* DCP max packet size is configurable */
- return M66591_DCP_MXPKSZ;
- case 1:
- case 2:
- case 3:
- case 4:
- return 512;
- case 5:
- case 6:
- return 64;
- default:
- return 0;
+ if( (M66591_HSFS & 0xFF) == 0x03 ) { /* Device is running Highspeed */
+ switch(pipe) {
+ case 0:
+ /* DCP max packet size is configurable */
+ return M66591_DCP_MXPKSZ;
+ case 1:
+ case 2:
+ case 3:
+ case 4:
+ return 512;
+ case 5:
+ case 6:
+ return 64;
+ default:
+ return 0;
+ }
+ } else { /* Device is running Full speed */
+ switch(pipe) {
+ case 0:
+ /* DCP max packet size is configurable */
+ return M66591_DCP_MXPKSZ;
+ case 1:
+ case 2:
+ case 3:
+ case 4:
+ return 64;
+ case 5:
+ case 6:
+ return 64;
+ default:
+ return 0;
+ }
}
}
@@ -461,7 +485,7 @@ void USB_DEVICE(void) {
case CTRL_RTDS:
case CTRL_WTDS:
case CTRL_WTND:
- // If data is not valid stop
+ /* If data is not valid stop */
if(!(M66591_INTSTAT_MAIN & (1<<3)) ) {
logf("mxx: CTRT interrupt but VALID is false");
break;
@@ -471,7 +495,7 @@ void USB_DEVICE(void) {
case CTRL_RTSS:
case CTRL_WTSS:
pipe_handshake(0, PIPE_SHAKE_BUF);
- M66591_DCPCTRL |= 1<<2; // Set CCPL
+ M66591_DCPCTRL |= 1<<2; /* Set CCPL */
break;
default:
logf("mxx: CTRT with unknown CTSQ");
diff --git a/firmware/target/arm/tms320dm320/uart-dm320.c b/firmware/target/arm/tms320dm320/uart-dm320.c
index d68beb6e01..414072c929 100644
--- a/firmware/target/arm/tms320dm320/uart-dm320.c
+++ b/firmware/target/arm/tms320dm320/uart-dm320.c
@@ -156,6 +156,7 @@ int uart1_gets_queue(char *str, int size)
/* UART1 receive/transmit interupt handler */
void UART1(void)
{
+ IO_INTC_IRQ0 = INTR_IRQ0_UART1; /* Clear the interrupt first */
while (IO_UART1_RFCR & 0x3f)
{
if (uart1_receive_count > RECEIVE_RING_SIZE)
@@ -176,6 +177,4 @@ void UART1(void)
IO_UART1_DTRR=uart1_send_buffer_ring[uart1_send_read++];
uart1_send_count--;
}
-
- IO_INTC_IRQ0 = INTR_IRQ0_UART1;
}