USB AMSv2: split handle_ep_int()

IN & OUT interrupts have not much in common so move each to its own
function

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28043 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Rafaël Carré 2010-09-08 05:43:05 +00:00
parent 5aa5de5dc8
commit f1adafc05a

View file

@ -461,11 +461,9 @@ void usb_drv_exit(void)
cpu_boost(0);
}
static void handle_ep_int(int ep, bool dir_in)
{
struct usb_endpoint *endpoint = &endpoints[ep][dir_in];
if(dir_in)
static void handle_ep_in_int(int ep)
{
struct usb_endpoint *endpoint = &endpoints[ep][DIR_IN];
unsigned long sts = DIEPINT(ep);
if(sts & DIEPINT_ahberr)
panicf("usb-drv: ahb error on EP%d IN", ep);
@ -504,8 +502,10 @@ static void handle_ep_int(int ep, bool dir_in)
/* clear interrupts */
DIEPINT(ep) = sts;
}
else
static void handle_ep_out_int(int ep)
{
struct usb_endpoint *endpoint = &endpoints[ep][DIR_OUT];
unsigned long sts = DOEPINT(ep);
if(sts & DOEPINT_ahberr)
panicf("usb-drv: ahb error on EP%d OUT", ep);
@ -557,7 +557,6 @@ static void handle_ep_int(int ep, bool dir_in)
/* clear interrupts */
DOEPINT(ep) = sts;
}
}
static void handle_ep_ints(void)
{
@ -568,10 +567,11 @@ static void handle_ep_ints(void)
FOR_EACH_IN_EP_AND_EP0(i, ep)
if(daint & DAINT_IN_EP(ep))
handle_ep_int(ep, true);
handle_ep_in_int(ep);
FOR_EACH_OUT_EP_AND_EP0(i, ep)
if(daint & DAINT_OUT_EP(ep))
handle_ep_int(ep, false);
handle_ep_out_int(ep);
/* write back to clear status */
DAINT = daint;