summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--openpcd/firmware/include/openpcd.h6
-rw-r--r--openpcd/firmware/src/main.c4
-rw-r--r--openpcd/firmware/src/pcd_enumerate.c11
3 files changed, 14 insertions, 7 deletions
diff --git a/openpcd/firmware/include/openpcd.h b/openpcd/firmware/include/openpcd.h
index 5c1e622..81d2ad1 100644
--- a/openpcd/firmware/include/openpcd.h
+++ b/openpcd/firmware/include/openpcd.h
@@ -29,4 +29,10 @@ struct openpcd_hdr {
#define OPENPCD_CMD_IRQ 0x40 /* IRQ reported by RC632 */
+#define OPENPCD_VENDOR_ID 0x2342
+#define OPENPCD_PRODUCT_ID 0x0001
+#define OPENPCD_OUT_EP 0x01
+#define OPENPCD_IN_EP 0x82
+#define OPENPCD_IRQ_EP 0x83
+
#endif
diff --git a/openpcd/firmware/src/main.c b/openpcd/firmware/src/main.c
index 4f5903e..9d53ed1 100644
--- a/openpcd/firmware/src/main.c
+++ b/openpcd/firmware/src/main.c
@@ -79,8 +79,8 @@ static int usb_in(struct req_ctx *rctx)
pih->val = rc632_reg_read(poh->reg);
break;
case OPENPCD_CMD_READ_FIFO:
- DEBUGP("READ FIFO(len=%u) ", poh->len);
- pih->len = rc632_fifo_read(poh->len, pih->data);
+ DEBUGP("READ FIFO(len=%u) ", poh->val);
+ pih->len = rc632_fifo_read(poh->val, pih->data);
rctx->tx.tot_len += pih->len;
break;
case OPENPCD_CMD_WRITE_REG:
diff --git a/openpcd/firmware/src/pcd_enumerate.c b/openpcd/firmware/src/pcd_enumerate.c
index c21c52e..64c915c 100644
--- a/openpcd/firmware/src/pcd_enumerate.c
+++ b/openpcd/firmware/src/pcd_enumerate.c
@@ -21,6 +21,7 @@
#include <include/types.h>
#include <include/usb_ch9.h>
#include <include/lib_AT91SAM7.h>
+#include <include/openpcd.h>
#include "pcd_enumerate.h"
#include "openpcd.h"
@@ -39,8 +40,8 @@ struct usb_device_descriptor devDescriptor = {
.bDeviceSubClass = 0xff,
.bDeviceProtocol = 0xff,
.bMaxPacketSize0 = 0x08,
- .idVendor = 0x2342,
- .idProduct = 0x0001,
+ .idVendor = OPENPCD_VENDOR_ID,
+ .idProduct = OPENPCD_PRODUCT_ID,
.bcdDevice = 0x0000,
.iManufacturer = 0x00,
.iProduct = 0x00,
@@ -81,21 +82,21 @@ const struct _desc cfgDescriptor = {
{
.bLength = USB_DT_ENDPOINT_SIZE,
.bDescriptorType = USB_DT_ENDPOINT,
- .bEndpointAddress = 0x01,
+ .bEndpointAddress = OPENPCD_OUT_EP,
.bmAttributes = USB_ENDPOINT_XFER_BULK,
.wMaxPacketSize = 64,
.bInterval = 0x10, /* FIXME */
}, {
.bLength = USB_DT_ENDPOINT_SIZE,
.bDescriptorType = USB_DT_ENDPOINT,
- .bEndpointAddress = 0x82,
+ .bEndpointAddress = OPENPCD_IN_EP,
.bmAttributes = USB_ENDPOINT_XFER_BULK,
.wMaxPacketSize = 64,
.bInterval = 0x10, /* FIXME */
}, {
.bLength = USB_DT_ENDPOINT_SIZE,
.bDescriptorType = USB_DT_ENDPOINT,
- .bEndpointAddress = 0x83,
+ .bEndpointAddress = OPENPCD_IRQ_EP,
.bmAttributes = USB_ENDPOINT_XFER_INT,
.wMaxPacketSize = 64,
.bInterval = 0x10, /* FIXME */
personal git repositories of Harald Welte. Your mileage may vary