From 6556e87c2bb82e4a2002ceea08865236c4c996e7 Mon Sep 17 00:00:00 2001 From: "(no author)" <(no author)@6dc7ffe9-61d6-0310-9af1-9938baff3ed1> Date: Sun, 23 Jul 2006 18:32:16 +0000 Subject: - fix fifo read length - use openpcd defines for endpoints git-svn-id: https://svn.openpcd.org:2342/trunk@34 6dc7ffe9-61d6-0310-9af1-9938baff3ed1 --- openpcd/firmware/include/openpcd.h | 6 ++++++ openpcd/firmware/src/main.c | 4 ++-- openpcd/firmware/src/pcd_enumerate.c | 11 ++++++----- 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 #include +#include #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 */ -- cgit v1.2.3