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:
parent
d03beb2257
commit
376236949b
@ -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;
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user