aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAJM <poslathian@poslathian.(none)>2010-04-25 00:51:43 -0400
committerbnewbold <bnewbold@robocracy.org>2010-05-20 22:09:15 -0400
commit4dcbd9612275d7957484f4a87e16f0bb09484ee6 (patch)
tree92909ce42b9baeb7cbd3e8dbe8e760bfb1914787
parent6ad3acd15e9859ac9bc77c1eb04d67108dcc5a03 (diff)
downloadlibrambutan-4dcbd9612275d7957484f4a87e16f0bb09484ee6.tar.gz
librambutan-4dcbd9612275d7957484f4a87e16f0bb09484ee6.zip
FINALLY figured out the tx/rx bugs, so the whole stack is officially working. for future reference its ESSENTIAL that you set the EPNUM flag of the global device struct appropriately regardless of whether or not you enable or configure more endpoints.
-rw-r--r--core/usb/usb.c1
-rw-r--r--core/usb/usb_callbacks.c20
-rw-r--r--core/usb/usb_config.h12
3 files changed, 19 insertions, 14 deletions
diff --git a/core/usb/usb.c b/core/usb/usb.c
index c8a27c2..c0229ff 100644
--- a/core/usb/usb.c
+++ b/core/usb/usb.c
@@ -418,5 +418,4 @@ void usbSendHello(void) {
char *line = "\n";
while(usbSendBytes(&thisVal,1) == 0);
while(usbSendBytes((uint8*)line,1) == 0);
- GetEPTxCount(1);
}
diff --git a/core/usb/usb_callbacks.c b/core/usb/usb_callbacks.c
index 402e8f5..1fb73d5 100644
--- a/core/usb/usb_callbacks.c
+++ b/core/usb/usb_callbacks.c
@@ -58,7 +58,7 @@ void vcomDataRxCb(void) {
/* setEPRxCount on the previous cycle should garuntee
we havnt received more bytes than we can fit */
- uint8 newBytes = _GetEPRxCount(VCOM_RX_ENDP);
+ uint8 newBytes = GetEPRxCount(VCOM_RX_ENDP);
/* assert (newBytes <= maxNewBytes); */
if (recvBufIn + newBytes < VCOM_RX_EPSIZE) {
@@ -82,7 +82,7 @@ void vcomDataRxCb(void) {
}
void vcomManagementCb(void) {
- /* unused. This enpoint would callback if we had sent a linestate
+/* unused. This enpoint would callback if we had sent a linestate
changed notification */
}
@@ -133,11 +133,17 @@ void usbReset(void) {
SetEPRxStatus (VCOM_NOTIFICATION_ENDP, EP_RX_DIS);
/* setup data endpoint OUT (rx) */
- SetEPType (VCOM_RX_ENDP, EP_BULK);
- SetEPRxAddr (VCOM_RX_ENDP, VCOM_RX_ADDR);
- SetEPRxCount (VCOM_RX_ENDP, VCOM_RX_EPSIZE);
- SetEPTxStatus (VCOM_RX_ENDP, EP_TX_DIS);
- SetEPRxStatus (VCOM_RX_ENDP, EP_RX_VALID);
+/* SetEPType (VCOM_RX_ENDP, EP_BULK); */
+/* SetEPRxAddr (VCOM_RX_ENDP, VCOM_RX_ADDR); */
+/* SetEPRxCount (VCOM_RX_ENDP, VCOM_RX_EPSIZE); */
+/* // SetEPTxStatus (VCOM_RX_ENDP, EP_TX_DIS); */
+/* SetEPRxStatus (VCOM_RX_ENDP, EP_RX_VALID); */
+
+ SetEPType (3, EP_BULK);
+ SetEPRxAddr (3, 0x110);
+ SetEPRxCount (3,64);
+ // SetEPTxStatus (VCOM_RX_ENDP, EP_TX_DIS);
+ SetEPRxStatus (3, EP_RX_VALID);
/* setup data endpoint IN (tx) */
SetEPType (VCOM_TX_ENDP, EP_BULK);
diff --git a/core/usb/usb_config.h b/core/usb/usb_config.h
index 12d21c8..5cdbcd7 100644
--- a/core/usb/usb_config.h
+++ b/core/usb/usb_config.h
@@ -17,16 +17,16 @@
#define VCOM_CTRL_TX_ADDR 0x80
#define VCOM_CTRL_EPSIZE 0x40
-#define VCOM_NOTIFICATION_ENDP ENDP2
-#define VCOM_NOTIFICATION_EPNUM 0x02
-#define VCOM_NOTIFICATION_ADDR 0x100
-#define VCOM_NOTIFICATION_EPSIZE 0x40
-
#define VCOM_TX_ENDP ENDP1
#define VCOM_TX_EPNUM 0x01
#define VCOM_TX_ADDR 0xC0
#define VCOM_TX_EPSIZE 0x40
+#define VCOM_NOTIFICATION_ENDP ENDP2
+#define VCOM_NOTIFICATION_EPNUM 0x02
+#define VCOM_NOTIFICATION_ADDR 0x100
+#define VCOM_NOTIFICATION_EPSIZE 0x40
+
#define VCOM_RX_ENDP ENDP3
#define VCOM_RX_EPNUM 0x03
#define VCOM_RX_ADDR 0x110
@@ -34,7 +34,7 @@
#define bMaxPacketSize 0x40 /* 64B, maximum for USB FS Devices */
-#define NUM_ENDPTS 0x03
+#define NUM_ENDPTS 0x04
/* handle all usb interrupts */
#define ISR_MSK ( CNTR_CTRM | \