1
0
mirror of git://projects.qi-hardware.com/ben-wpan.git synced 2024-12-23 08:09:55 +02:00

atusb/fw/usb/: we were busy-looping on TXINI. Mask the interrupt when idle.

- usb/usb.h (usb_ep_change), usb/atu2.c (usb_ep_change): new function
  called by the USB stack to notify the hardware-specific driver of
  an endpoint state change (EP_TX or EP_RX)
- usb/usb.c (usb_io): call usb_ep_change
- usb/atu2.c (handle_ep): mask TXINI if we have nothing to send
This commit is contained in:
Werner Almesberger 2011-06-11 14:17:44 -03:00
parent d03beb2257
commit 376236949b
3 changed files with 13 additions and 0 deletions

View File

@ -70,6 +70,15 @@ int set_addr(uint8_t addr)
}
void usb_ep_change(struct ep_descr *ep)
{
if (ep->state == EP_TX) {
UENUM = ep-eps;
UEIENX |= 1 << TXINE;
}
}
static int ep_setup(void)
{
struct setup_request setup;
@ -157,6 +166,8 @@ static void handle_ep(int n)
UEINTX = ~(1 << TXINI);
if (ep->state == EP_IDLE && ep->callback)
ep->callback(ep->user);
} else {
UEIENX &= ~(1 << TXINE);
}
}
return;

View File

@ -51,6 +51,7 @@ void usb_io(struct ep_descr *ep, enum ep_state state, uint8_t *buf,
ep->end = buf+size;
ep->callback = callback;
ep->user = user;
usb_ep_change(ep);
}

View File

@ -150,6 +150,7 @@ void usb_io(struct ep_descr *ep, enum ep_state state, uint8_t *buf,
int handle_setup(const struct setup_request *setup);
int set_addr(uint8_t addr);
void usb_ep_change(struct ep_descr *ep);
void usb_reset(void);
void usb_init(void);