icE1usb fw: Have usb_e1 handle the E1 polling and multi port

The init already takes care of both port and also calling
e1_init, so it makes sense to have a usb_e1_poll() that
encapsulate both the actual e1 hardware poll and running
the usb stuff for both port.

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: Icf81efcdc5c8f13480ba2652bc6e7c1ca226ae4d
This commit is contained in:
Sylvain Munaut 2022-01-12 11:47:08 +01:00
parent d8f33aa792
commit c9c22a62cd
3 changed files with 14 additions and 7 deletions

View File

@ -158,9 +158,6 @@ void main()
usb_poll();
/* E1 poll */
for (int port=0; port<2; port++) {
e1_poll(port);
usb_e1_run(port);
}
usb_e1_poll();
}
}

View File

@ -96,8 +96,8 @@ _usb_fill_feedback_ep(int port)
}
void
usb_e1_run(int port)
static void
_usb_e1_run(int port)
{
struct usb_e1_state *usb_e1 = _get_state(port);
volatile struct usb_ep *ep_regs;
@ -210,6 +210,16 @@ refill:
_usb_fill_feedback_ep(port);
}
void
usb_e1_poll(void)
{
for (int i=0; i<2; i++) {
e1_poll(i);
_usb_e1_run(i);
}
}
static enum usb_fnd_resp
_e1_set_conf(const struct usb_conf_desc *conf)
{

View File

@ -7,5 +7,5 @@
#pragma once
void usb_e1_run(int port);
void usb_e1_poll(void);
void usb_e1_init(void);