From 706ffa9f3b986eff193377142459fbfde2362036 Mon Sep 17 00:00:00 2001 From: laforge Date: Fri, 22 Sep 2006 21:41:22 +0000 Subject: - move large rctx definitions to req_ctx.h - add more fine-grained debugging macros in pcd_enumarate.c - resolve race conditions between main-loop ep_refill and irq-triggered ep_refill by adding one irq-[b]locking variant - consolidate endpoint reset code into reset_ep() - add code to handle correct transmission and reception of usb transfers larger than endpoint size - use new jump address (0x104000) in DFU Cstartup.S - move main_usb to pcd subdirectory - fix include/compile.h make dependencies - make usb benchmark code use new large req_ctx git-svn-id: https://svn.openpcd.org:2342/trunk@219 6dc7ffe9-61d6-0310-9af1-9938baff3ed1 --- firmware/src/pcd/main_usb.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ firmware/src/pcd/rc632.c | 17 ++++++++++------- 2 files changed, 54 insertions(+), 7 deletions(-) create mode 100644 firmware/src/pcd/main_usb.c (limited to 'firmware/src/pcd') diff --git a/firmware/src/pcd/main_usb.c b/firmware/src/pcd/main_usb.c new file mode 100644 index 0000000..fcd3306 --- /dev/null +++ b/firmware/src/pcd/main_usb.c @@ -0,0 +1,44 @@ +/* main_usb - OpenPCD test firmware for benchmarking USB performance + * (C) 2006 by Harald Welte + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +static void help(void) +{ +} + +int _main_dbgu(char key) +{ + switch (key) { + default: + return -EINVAL; + } + + return 0; +} + +void _init_func(void) +{ + usbtest_init(); +} + +void _main_func(void) +{ + /* first we try to get rid of pending to-be-sent stuff */ + usb_out_process(); + + /* next we deal with incoming reqyests from USB EP1 (OUT) */ + usb_in_process(); + + /* try unthrottling sources since we now are [more] likely to + * have empty request contexts */ + udp_unthrottle(); +} diff --git a/firmware/src/pcd/rc632.c b/firmware/src/pcd/rc632.c index 3713d94..da9ffd0 100644 --- a/firmware/src/pcd/rc632.c +++ b/firmware/src/pcd/rc632.c @@ -38,8 +38,6 @@ #include #include "rc632.h" -#define ALWAYS_RESPOND - #define NOTHING do {} while(0) #if 0 @@ -50,7 +48,7 @@ #define DEBUGPSPIIRQ(x, args...) NOTHING #endif -#if 0 +#if 1 #define DEBUG632 DEBUGPCRF #else #define DEBUG632(x, args ...) NOTHING @@ -266,7 +264,7 @@ int rc632_fifo_read(struct rfid_asic_handle *hdl, DEBUG632("[FIFO] => %s", hexdump(data, rx_len-1)); - return 0; + return rx_len-1; } int rc632_set_bits(struct rfid_asic_handle *hdl, @@ -403,6 +401,9 @@ static int rc632_usb_in(struct req_ctx *rctx) struct openpcd_hdr *poh = (struct openpcd_hdr *) rctx->data; u_int16_t len = rctx->tot_len-sizeof(*poh); + /* initialize transmit length to header length */ + rctx->tot_len = sizeof(*poh); + switch (poh->cmd) { case OPENPCD_CMD_READ_REG: rc632_reg_read(RAH, poh->reg, &poh->val); @@ -415,6 +416,7 @@ static int rc632_usb_in(struct req_ctx *rctx) poh->flags &= OPENPCD_FLAG_RESPOND; { u_int16_t req_len = poh->val, remain_len = req_len, pih_len; +#if 0 if (req_len > MAX_PAYLOAD_LEN) { pih_len = MAX_PAYLOAD_LEN; remain_len -= pih_len; @@ -443,11 +445,12 @@ static int rc632_usb_in(struct req_ctx *rctx) /* don't set state of second rctx, main function * body will do this after switch statement */ } else { - rc632_fifo_read(RAH, req_len, poh->data); - rctx->tot_len += pih_len; +#endif + poh->val = rc632_fifo_read(RAH, req_len, poh->data); + rctx->tot_len += poh->val; DEBUGP("READ FIFO(len=%u)=%s ", poh->val, hexdump(poh->data, poh->val)); - } + //} } break; case OPENPCD_CMD_WRITE_REG: -- cgit v1.2.3