#define ACM_CTRL_RTS BIT(1) /* unused with full duplex */
#define ACM_CTRL_DTR BIT(0) /* host is ready for data r/w */
- int controller_index;
+ struct udevice *udc;
};
static struct f_acm *default_acm_function;
int len, ret;
do {
- usb_gadget_handle_interrupts(f_acm->controller_index);
+ dm_usb_gadget_handle_interrupts(f_acm->udc);
if (!(f_acm->handshake_bits & ACM_CTRL_DTR))
break;
struct f_acm *f_acm = stdio_to_acm(dev);
/* give a chance to process udc irq */
- usb_gadget_handle_interrupts(f_acm->controller_index);
+ dm_usb_gadget_handle_interrupts(f_acm->udc);
return f_acm->connected;
}
f_acm->usb_function.descriptors = acm_fs_function;
f_acm->usb_function.hs_descriptors = acm_hs_function;
f_acm->usb_function.setup = acm_setup;
- f_acm->controller_index = 0;
+
+ status = udc_device_get_by_index(0, &f_acm->udc);
+ if (status)
+ return status;
status = usb_add_function(c, &f_acm->usb_function);
if (status) {
{
struct f_acm *f_acm = stdio_to_acm(dev);
- usb_gadget_handle_interrupts(f_acm->controller_index);
+ dm_usb_gadget_handle_interrupts(f_acm->udc);
return (f_acm->rx_buf.size > 0);
}