mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-12-07 13:45:03 -05:00
usb: introduce new control request API
Change-Id: I6545d8985ab683c026f28f6a7c0e23b40d0a6506
This commit is contained in:
parent
71cc1e78fd
commit
ec164c389c
15 changed files with 168 additions and 14 deletions
|
|
@ -341,7 +341,7 @@ static void usb_handle_setup_rx(void)
|
|||
if (len == 8)
|
||||
{
|
||||
ISP1583_DFLOW_CTRLFUN |= DFLOW_CTRLFUN_STATUS; /* Acknowledge packet */
|
||||
usb_core_control_request((struct usb_ctrlrequest*)setup_pkt_buf);
|
||||
usb_core_legacy_control_request((struct usb_ctrlrequest*)setup_pkt_buf);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -208,7 +208,7 @@ static void control_received(void) {
|
|||
/* acknowledge packet recieved (clear valid) */
|
||||
M66591_INTSTAT_MAIN &= ~(1<<3);
|
||||
|
||||
usb_core_control_request(&temp);
|
||||
usb_core_legacy_control_request(&temp);
|
||||
}
|
||||
|
||||
/* This is a helper function, it is used to notife the stack that a transfer is
|
||||
|
|
|
|||
|
|
@ -741,7 +741,7 @@ static void usb_dw_handle_setup_received(void)
|
|||
&& (usb_ctrlsetup.bRequest == USB_REQ_SET_ADDRESS))
|
||||
usb_dw_set_address(usb_ctrlsetup.wValue);
|
||||
|
||||
usb_core_control_request(&usb_ctrlsetup);
|
||||
usb_core_legacy_control_request(&usb_ctrlsetup);
|
||||
}
|
||||
|
||||
static void usb_dw_abort_endpoint(int epnum, enum usb_dw_epdir epdir)
|
||||
|
|
|
|||
|
|
@ -51,7 +51,9 @@ struct usb_class_driver;
|
|||
|
||||
void usb_core_init(void);
|
||||
void usb_core_exit(void);
|
||||
void usb_core_control_request(struct usb_ctrlrequest* req);
|
||||
void usb_core_control_request(struct usb_ctrlrequest* req, void* data);
|
||||
void usb_core_control_complete(int status);
|
||||
void usb_core_legacy_control_request(struct usb_ctrlrequest* req);
|
||||
void usb_core_transfer_complete(int endpoint,int dir,int status,int length);
|
||||
void usb_core_bus_reset(void);
|
||||
bool usb_core_any_exclusive_storage(void);
|
||||
|
|
|
|||
|
|
@ -56,6 +56,12 @@
|
|||
* -> usb_drv_int_enable(false) [ditto]
|
||||
* -> soc specific controller/clock deinit */
|
||||
|
||||
enum usb_control_response {
|
||||
USB_CONTROL_ACK,
|
||||
USB_CONTROL_STALL,
|
||||
USB_CONTROL_RECEIVE,
|
||||
};
|
||||
|
||||
/* one-time initialisation of the USB driver */
|
||||
void usb_drv_startup(void);
|
||||
void usb_drv_int_enable(bool enable); /* Target implemented */
|
||||
|
|
@ -69,6 +75,8 @@ bool usb_drv_stalled(int endpoint,bool in);
|
|||
int usb_drv_send(int endpoint, void* ptr, int length);
|
||||
int usb_drv_send_nonblocking(int endpoint, void* ptr, int length);
|
||||
int usb_drv_recv_nonblocking(int endpoint, void* ptr, int length);
|
||||
void usb_drv_control_response(enum usb_control_response resp,
|
||||
void* data, int length);
|
||||
void usb_drv_set_address(int address);
|
||||
void usb_drv_reset_endpoint(int endpoint, bool send);
|
||||
bool usb_drv_powered(void);
|
||||
|
|
|
|||
|
|
@ -655,7 +655,7 @@ static void handle_out_ep(int ep)
|
|||
req->wIndex,
|
||||
req->wLength);
|
||||
|
||||
usb_core_control_request(&req_copy);
|
||||
usb_core_legacy_control_request(&req_copy);
|
||||
setup_desc_init(setup_desc);
|
||||
|
||||
ep_sts &= ~USB_EP_STAT_SETUP_RCVD;
|
||||
|
|
@ -760,7 +760,7 @@ void INT_USB_FUNC(void)
|
|||
got_set_configuration = 1;
|
||||
|
||||
set_config.wValue = USB_DEV_STS & USB_DEV_STS_MASK_CFG;
|
||||
usb_core_control_request(&set_config);
|
||||
usb_core_legacy_control_request(&set_config);
|
||||
intr &= ~USB_DEV_INTR_SET_CONFIG;
|
||||
}
|
||||
if (intr & USB_DEV_INTR_EARLY_SUSPEND) {/* idle >3ms detected */
|
||||
|
|
|
|||
|
|
@ -117,7 +117,7 @@ static void setup_received(void)
|
|||
setup_data[1] = SETUP2;
|
||||
|
||||
/* pass setup data to the upper layer */
|
||||
usb_core_control_request((struct usb_ctrlrequest*)setup_data);
|
||||
usb_core_legacy_control_request((struct usb_ctrlrequest*)setup_data);
|
||||
}
|
||||
|
||||
static int max_pkt_size(struct endpoint_t *endp)
|
||||
|
|
|
|||
|
|
@ -1181,7 +1181,7 @@ void VLYNQ(void)
|
|||
}
|
||||
|
||||
/* Process control packet */
|
||||
usb_core_control_request(&setup);
|
||||
usb_core_legacy_control_request(&setup);
|
||||
}
|
||||
|
||||
if (sysIntrStatus.f.ep0_in_ack)
|
||||
|
|
|
|||
|
|
@ -877,7 +877,7 @@ static void control_received(void)
|
|||
}
|
||||
}
|
||||
|
||||
usb_core_control_request((struct usb_ctrlrequest*)tmp);
|
||||
usb_core_legacy_control_request((struct usb_ctrlrequest*)tmp);
|
||||
}
|
||||
|
||||
static void transfer_completed(void)
|
||||
|
|
|
|||
|
|
@ -522,7 +522,7 @@ static void handle_ep_int(int ep, bool out)
|
|||
ep0_setup_pkt->bRequest == USB_REQ_SET_ADDRESS)
|
||||
DCFG = (DCFG & ~bitm(DCFG, devadr)) | (ep0_setup_pkt->wValue << DCFG_devadr_bitp);
|
||||
|
||||
usb_core_control_request(ep0_setup_pkt);
|
||||
usb_core_legacy_control_request(ep0_setup_pkt);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -251,7 +251,7 @@ void handle_control(void)
|
|||
DEBUG(2, "req: %02x %02d", req->bRequestType, req->bRequest);
|
||||
}
|
||||
|
||||
usb_core_control_request(req);
|
||||
usb_core_legacy_control_request(req);
|
||||
}
|
||||
|
||||
static
|
||||
|
|
|
|||
|
|
@ -239,7 +239,7 @@ static void EP0_handler(void)
|
|||
{
|
||||
readFIFO(ep_recv, REG_USB_REG_COUNT0);
|
||||
REG_USB_REG_CSR0 = csr0 | USB_CSR0_SVDOUTPKTRDY; /* clear OUTPKTRDY bit */
|
||||
usb_core_control_request((struct usb_ctrlrequest*)ep_recv->buf);
|
||||
usb_core_legacy_control_request((struct usb_ctrlrequest*)ep_recv->buf);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -335,7 +335,7 @@ static void EP0_handler(void)
|
|||
ep0_data_requested = true;
|
||||
else ep0_data_supplied = true;
|
||||
REG_USB_CSR0 = csr0;
|
||||
usb_core_control_request(&ep0_rx.request);
|
||||
usb_core_legacy_control_request(&ep0_rx.request);
|
||||
ep_transfer_completed(ep_recv);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -977,7 +977,7 @@ void usb_core_handle_notify(long id, intptr_t data)
|
|||
}
|
||||
|
||||
/* called by usb_drv_int() */
|
||||
void usb_core_control_request(struct usb_ctrlrequest* req)
|
||||
void usb_core_legacy_control_request(struct usb_ctrlrequest* req)
|
||||
{
|
||||
struct usb_transfer_completion_event_data* completion_event =
|
||||
&ep_data[EP_CONTROL].completion_event[EP_DIR(USB_DIR_IN)];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue