The code is quite special-cased. Some more changes will be necessary
for interrupt or OUT EPs.
- atu2.c (NUM_EPS): increased from 1 to 2
- atu2.c (ep_rx): send zero-length packet also for EPs != 0
- atu2.c (handle_ep): clear FIFOCON when sending data on EP != 0
- atu2.c (ep_init): configure EP 1 as bulk IN with size 64
- usb.c (NUM_EPS): we don't need to define NUM_EPS here
- 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 allows us to do other things as well, e.g., change state.
- ep0.c (ep0_init), usb/dfu.c (dfu_init): use user_setup
- usb/atu2.c (usb_poll): no need to reset user_setup - the user's
reset function can do that
- usb/usb.h (user_setups), usb/usb.c (handle_setup): removed
user_setups
- usb/usb.h (user_set_interface), usb/usb.c (user_set_interface,
handle_setup): callback for SET_INTERFACE
- ep0.c (ep0_init), usb/dfu.c (dfu_init): set user_setups[0] instead
of user_setup
- usb/atu2.c (usb_poll): reset user_setup on bus reset
- usb/usb.h (user_setups), usb/usb.c (user_setups): array of
interface-specific setup functions
- usb/usb.c (handle_setup): in SET_INTERFACE, select setup function
from user_setups according to interface
- usb/usb.c (handle_setup): if user_setup is not set (e.g., the
optional SET_INTERFACE was never issued), fall back to user_setups[0]