summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--openpcd/firmware/src/main_dumbreader.c16
-rw-r--r--openpcd/firmware/src/usb_handler.c19
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;
personal git repositories of Harald Welte. Your mileage may vary