From a5c8f60f59efa3259c02353c18e4b717b8dca66f Mon Sep 17 00:00:00 2001 From: "(no author)" <(no author)@6dc7ffe9-61d6-0310-9af1-9938baff3ed1> Date: Tue, 8 Aug 2006 17:21:49 +0000 Subject: move more usb related handling into usb_handler.c git-svn-id: https://svn.openpcd.org:2342/trunk@84 6dc7ffe9-61d6-0310-9af1-9938baff3ed1 --- openpcd/firmware/src/main_dumbreader.c | 16 +--------------- openpcd/firmware/src/usb_handler.c | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 15 deletions(-) diff --git a/openpcd/firmware/src/main_dumbreader.c b/openpcd/firmware/src/main_dumbreader.c index 54d7819..d9172ed 100644 --- a/openpcd/firmware/src/main_dumbreader.c +++ b/openpcd/firmware/src/main_dumbreader.c @@ -23,22 +23,8 @@ int _main_dbgu(char key) void _main_func(void) { - struct req_ctx *rctx; - /* first we try to get rid of pending to-be-sent stuff */ - while (rctx = req_ctx_find_get(RCTX_STATE_UDP_EP3_PENDING, - RCTX_STATE_UDP_EP3_BUSY)) { - DEBUGPCRF("EP3_BUSY for ctx %u", req_ctx_num(rctx)); - if (udp_refill_ep(3, rctx) < 0) - req_ctx_set_state(rctx, RCTX_STATE_UDP_EP3_PENDING); - } - - while (rctx = req_ctx_find_get(RCTX_STATE_UDP_EP2_PENDING, - RCTX_STATE_UDP_EP2_BUSY)) { - DEBUGPCRF("EP2_BUSY for ctx %u", req_ctx_num(rctx)); - if (udp_refill_ep(2, rctx) < 0) - req_ctx_set_state(rctx, RCTX_STATE_UDP_EP2_PENDING); - } + usb_out_process(); /* next we deal with incoming reqyests from USB EP1 (OUT) */ usb_in_process(); diff --git a/openpcd/firmware/src/usb_handler.c b/openpcd/firmware/src/usb_handler.c index dc5632e..4068486 100644 --- a/openpcd/firmware/src/usb_handler.c +++ b/openpcd/firmware/src/usb_handler.c @@ -133,6 +133,25 @@ respond: return 1; } +void usb_out_process(void) +{ + struct req_ctx *rctx; + + while (rctx = req_ctx_find_get(RCTX_STATE_UDP_EP3_PENDING, + RCTX_STATE_UDP_EP3_BUSY)) { + DEBUGPCRF("EP3_BUSY for ctx %u", req_ctx_num(rctx)); + if (udp_refill_ep(3, rctx) < 0) + req_ctx_set_state(rctx, RCTX_STATE_UDP_EP3_PENDING); + } + + while (rctx = req_ctx_find_get(RCTX_STATE_UDP_EP2_PENDING, + RCTX_STATE_UDP_EP2_BUSY)) { + DEBUGPCRF("EP2_BUSY for ctx %u", req_ctx_num(rctx)); + if (udp_refill_ep(2, rctx) < 0) + req_ctx_set_state(rctx, RCTX_STATE_UDP_EP2_PENDING); + } +} + void usb_in_process(void) { struct req_ctx *rctx; -- cgit v1.2.3