mirror of
git://projects.qi-hardware.com/ben-wpan.git
synced 2025-04-21 12:27:27 +03:00
atusb/fw: implemented USB bus reset (to host) and polling of reset from host
- usb/usb.h, usb/atu2.c (usb_reset): reset the USB bus by detaching and re-attaching the device - boot.c (main): force a USB reset before running the payload - usb/atu2.c (usb_poll): test for USB reset from the host (in progress) - usb/dfu.c (my_reset, dfu_init): register user USB reset handler
This commit is contained in:
@@ -171,6 +171,12 @@ void usb_poll(void)
|
||||
{
|
||||
uint8_t flags, i;
|
||||
|
||||
flags = UDINT;
|
||||
if (flags & EORSTI) {
|
||||
UDINT &= ~(1 << EORSTI);
|
||||
if (user_reset)
|
||||
user_reset();
|
||||
}
|
||||
flags = UEINT;
|
||||
for (i = 0; i != NUM_EPS; i++)
|
||||
if (1 || flags & (1 << i))
|
||||
@@ -194,6 +200,13 @@ static void ep_init(void)
|
||||
}
|
||||
|
||||
|
||||
void usb_reset(void)
|
||||
{
|
||||
UDCON |= 1 << DETACH; /* detach the pull-up */
|
||||
_delay_ms(1);
|
||||
}
|
||||
|
||||
|
||||
void usb_init(void)
|
||||
{
|
||||
USBCON |= 1 << FRZCLK; /* freeze the clock */
|
||||
|
||||
Reference in New Issue
Block a user