Date:2013-04-01 20:54:44 (6 years 7 months ago)
Author:Werner Almesberger
Commit:9b2696b8488dbc39b0fdcdefdfad775913cb6e2d
Message:atusb/fw/usb/: enable MCU reset on USB bus reset after config selection

This way the host can reset the MCU if it's hung (for example, in the
panic loop) and we don't need to unplug-replug.
Files: atusb/fw/usb/atu2.c (2 diffs)
atusb/fw/usb/usb.c (1 diff)
atusb/fw/usb/usb.h (1 diff)

Change Details

atusb/fw/usb/atu2.c
247247}
248248
249249
250void usb_enable_bus_reset(void)
251{
252    UDCON |= 1 << RSTCPU; /* reset CPU on bus reset */
253}
254
255
250256void usb_init(void)
251257{
252258    USBCON |= 1 << FRZCLK; /* freeze the clock */
...... 
263269
264270    UDCON &= ~(1 << DETACH); /* attach the pull-up */
265271    UDIEN = 1 << EORSTE; /* enable device interrupts */
266// UDCON |= 1 << RSTCPU; /* reset CPU on bus reset */
267272
268273    ep_init();
269274}
atusb/fw/usb/usb.c
118118    case TO_DEVICE(SET_CONFIGURATION):
119119        if (setup->wValue != config_descriptor[5])
120120            return 0;
121        usb_enable_bus_reset();
121122        break;
122123
123124    /*
atusb/fw/usb/usb.h
153153void set_addr(uint8_t addr);
154154void usb_ep_change(struct ep_descr *ep);
155155void usb_reset(void);
156void usb_enable_bus_reset(void);
156157void usb_init(void);
157158
158159#endif /* !USB_H */

Archive Download the corresponding diff file



interactive