__noinline void usb_handle_control_status(int fail) { if (fail) { usb_pipe_stall(&usbd_pipe_state[USBD_PIPE_EP0_RX]); usb_pipe_stall(&usbd_pipe_state[USBD_PIPE_EP0_TX]); } else { usb_handle_control_status_cb(usb_handle_control_done, NULL); } }
__noinline void usb_handle_control_status(int fail) { if (fail) { usb_pipe_stall(&usbd_ep_state[0].rx); usb_pipe_stall(&usbd_ep_state[0].tx); } else { usb_handle_control_status_cb(usb_handle_control_done); } }
void usb_setup_control(void) { void *buf = ep0_buf[usb.ep_state[0].rx.pingpong]; usb.ep_state[0].rx.data01 = USB_DATA01_DATA0; usb.ep_state[0].tx.data01 = USB_DATA01_DATA1; usb_pipe_stall(&usb.ep_state[0].tx); usb_rx(&usb.ep_state[0].rx, buf, EP0_BUFSIZE, usb_handle_control, NULL); }
void usb_handle_control_status(int fail) { if (fail) { usb_pipe_stall(&usb.ep_state[0].rx); usb_pipe_stall(&usb.ep_state[0].tx); return; } /* empty status transfer */ switch (usb.ctrl_dir) { case USB_CTRL_REQ_IN: usb.ep_state[0].rx.data01 = USB_DATA01_DATA1; usb_rx(&usb.ep_state[0].rx, NULL, 0, usb_handle_control_done, NULL); break; default: usb.ep_state[0].tx.data01 = USB_DATA01_DATA1; usb_ep0_tx_cp(NULL, 0, 1 /* short packet */, usb_handle_control_done, NULL); break; } }