diff --git a/firmware/drivers/isp1583.c b/firmware/drivers/isp1583.c index c028d2fa01..18a4e9c720 100644 --- a/firmware/drivers/isp1583.c +++ b/firmware/drivers/isp1583.c @@ -531,9 +531,9 @@ static void in_callback(int ep, unsigned char *buf, int len) usb_core_transfer_complete(ep, false, 0, len); } -int usb_drv_recv(int ep, void* ptr, int length) +int usb_drv_recv_nonblocking(int ep, void* ptr, int length) { - logf("usb_drv_recv(%d, 0x%x, %d)", ep, (int)ptr, length); + logf("usb_drv_recv_nonblocking(%d, 0x%x, %d)", ep, (int)ptr, length); if(ep == EP_CONTROL && length == 0 && ptr == NULL) { usb_status_ack(ep, DIR_TX); diff --git a/firmware/drivers/m66591.c b/firmware/drivers/m66591.c index d09b269f33..5da1908290 100644 --- a/firmware/drivers/m66591.c +++ b/firmware/drivers/m66591.c @@ -869,7 +869,7 @@ int usb_drv_send(int endpoint, void* ptr, int length) /* This function begins a receive (on an OUT endpoint), it should not block * so the actual receive is done in the interrupt handler. */ -int usb_drv_recv(int endpoint, void* ptr, int length) +int usb_drv_recv_nonblocking(int endpoint, void* ptr, int length) { return mxx_queue(endpoint, ptr, length, false, false); } diff --git a/firmware/drivers/usb-designware.c b/firmware/drivers/usb-designware.c index 375fd8be74..ab4c6037b5 100644 --- a/firmware/drivers/usb-designware.c +++ b/firmware/drivers/usb-designware.c @@ -1333,7 +1333,7 @@ void usb_drv_release_endpoint(int endpoint) usb_dw_target_enable_irq(); } -int usb_drv_recv(int endpoint, void* ptr, int length) +int usb_drv_recv_nonblocking(int endpoint, void* ptr, int length) { int epnum = EP_NUM(endpoint); struct usb_dw_ep* dw_ep = usb_dw_get_ep(epnum, USB_DW_EPDIR_OUT); diff --git a/firmware/export/usb_drv.h b/firmware/export/usb_drv.h index 7ef7c8b7ee..01535c2786 100644 --- a/firmware/export/usb_drv.h +++ b/firmware/export/usb_drv.h @@ -68,8 +68,7 @@ void usb_drv_stall(int endpoint, bool stall,bool in); 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(int endpoint, void* ptr, int length); -void usb_drv_ack(struct usb_ctrlrequest* req); +int usb_drv_recv_nonblocking(int endpoint, void* ptr, int length); void usb_drv_set_address(int address); void usb_drv_reset_endpoint(int endpoint, bool send); bool usb_drv_powered(void); diff --git a/firmware/target/arm/as3525/usb-drv-as3525.c b/firmware/target/arm/as3525/usb-drv-as3525.c index 01fae5f0ab..8369edc400 100644 --- a/firmware/target/arm/as3525/usb-drv-as3525.c +++ b/firmware/target/arm/as3525/usb-drv-as3525.c @@ -412,12 +412,12 @@ void usb_drv_cancel_all_transfers(void) restore_irq(flags); } -int usb_drv_recv(int ep, void *ptr, int len) +int usb_drv_recv_nonblocking(int ep, void *ptr, int len) { struct usb_dev_dma_desc *uc_desc = endpoints[ep][1].uc_desc; ep &= 0x7f; - logf("usb_drv_recv(%d,%x,%d)\n", ep, (int)ptr, len); + logf("usb_drv_recv_nonblocking(%d,%x,%d)\n", ep, (int)ptr, len); if (len > USB_DMA_DESC_RXTX_BYTES) panicf("usb_recv: len=%d > %d", len, USB_DMA_DESC_RXTX_BYTES); @@ -674,7 +674,8 @@ static void handle_out_ep(int ep) * The usb_storage buffer is 63KB, but Linux sends 120KB. * We get the first part, but upon re-enabling receive dma we * get a 'buffer not available' error from the hardware, since - * we haven't gotten the next usb_drv_recv() from the stack yet. + * we haven't gotten the next usb_drv_recv_nonblocking() from + * the stack yet. * It seems the NAK bit is ignored here and the HW tries to dma * the incoming data anyway. * In theory I think the BNA error should be recoverable, but diff --git a/firmware/target/arm/rk27xx/usb-drv-rk27xx.c b/firmware/target/arm/rk27xx/usb-drv-rk27xx.c index 057ecf6ebc..aac271c47a 100644 --- a/firmware/target/arm/rk27xx/usb-drv-rk27xx.c +++ b/firmware/target/arm/rk27xx/usb-drv-rk27xx.c @@ -355,7 +355,7 @@ int usb_drv_send_nonblocking(int endpoint, void *ptr, int length) } /* Setup a receive transfer. (non blocking) */ -int usb_drv_recv(int endpoint, void* ptr, int length) +int usb_drv_recv_nonblocking(int endpoint, void* ptr, int length) { logf("udc: recv(%x)", endpoint); struct endpoint_t *ep; diff --git a/firmware/target/arm/tms320dm320/sansa-connect/tnetv105_usb_drv.c b/firmware/target/arm/tms320dm320/sansa-connect/tnetv105_usb_drv.c index 5563a40814..f1acc9c964 100644 --- a/firmware/target/arm/tms320dm320/sansa-connect/tnetv105_usb_drv.c +++ b/firmware/target/arm/tms320dm320/sansa-connect/tnetv105_usb_drv.c @@ -1026,8 +1026,8 @@ static bool tnetv_handle_cppi(void) if (rx_intstatus || tx_intstatus || rcv_sched) { /* Request calling again after short delay - * Needed when for example when OUT endpoint has pending - * data but the USB task did not call usb_drv_recv() yet. + * Needed when for example when OUT endpoint has pending data + * but the USB task did not call usb_drv_recv_nonblocking() yet. */ return true; } @@ -1371,7 +1371,7 @@ int usb_drv_send_nonblocking(int endpoint, void* ptr, int length) return _usb_drv_send(endpoint, ptr, length, false); } -int usb_drv_recv(int endpoint, void* ptr, int length) +int usb_drv_recv_nonblocking(int endpoint, void* ptr, int length) { int epn = EP_NUM(endpoint); struct ep_runtime_t *ep; @@ -1388,8 +1388,6 @@ int usb_drv_recv(int endpoint, void* ptr, int length) return 0; } -void usb_drv_ack(struct usb_ctrlrequest* req); - void usb_drv_set_address(int address) { UsbCtrlType usbCtrl; diff --git a/firmware/target/arm/usb-drv-arc.c b/firmware/target/arm/usb-drv-arc.c index b19b635923..4c53108f12 100644 --- a/firmware/target/arm/usb-drv-arc.c +++ b/firmware/target/arm/usb-drv-arc.c @@ -593,7 +593,7 @@ int usb_drv_send(int endpoint, void* ptr, int length) return prime_transfer(EP_NUM(endpoint), ptr, length, true, true); } -int usb_drv_recv(int endpoint, void* ptr, int length) +int usb_drv_recv_nonblocking(int endpoint, void* ptr, int length) { //logf("usbrecv(%x, %d)", ptr, length); return prime_transfer(EP_NUM(endpoint), ptr, length, false, false); diff --git a/firmware/target/arm/usb-s3c6400x.c b/firmware/target/arm/usb-s3c6400x.c index 920d1a6286..71d04e6f2a 100644 --- a/firmware/target/arm/usb-s3c6400x.c +++ b/firmware/target/arm/usb-s3c6400x.c @@ -166,7 +166,7 @@ int usb_drv_send_nonblocking(int endpoint, void *ptr, int length) return 0; } -int usb_drv_recv(int endpoint, void* ptr, int length) +int usb_drv_recv_nonblocking(int endpoint, void* ptr, int length) { ep_transfer(EP_NUM(endpoint), ptr, length, true); return 0; diff --git a/firmware/target/arm/usb-tcc.c b/firmware/target/arm/usb-tcc.c index 1b5f16c223..8ce75b6764 100644 --- a/firmware/target/arm/usb-tcc.c +++ b/firmware/target/arm/usb-tcc.c @@ -609,7 +609,7 @@ int usb_drv_send_nonblocking(int endpoint, void *ptr, int length) return rc; } -int usb_drv_recv(int endpoint, void* ptr, int length) +int usb_drv_recv_nonblocking(int endpoint, void* ptr, int length) { volatile struct tcc_ep *tcc_ep = &tcc_endpoints[endpoint & 0x7f]; int flags; diff --git a/firmware/target/mips/ingenic_jz47xx/usb-jz4740.c b/firmware/target/mips/ingenic_jz47xx/usb-jz4740.c index 162aeec97a..8d04c54a68 100644 --- a/firmware/target/mips/ingenic_jz47xx/usb-jz4740.c +++ b/firmware/target/mips/ingenic_jz47xx/usb-jz4740.c @@ -743,7 +743,7 @@ int usb_drv_send(int endpoint, void* ptr, int length) return 0; } -int usb_drv_recv(int endpoint, void* ptr, int length) +int usb_drv_recv_nonblocking(int endpoint, void* ptr, int length) { int flags; struct usb_endpoint *ep; diff --git a/firmware/target/mips/ingenic_jz47xx/usb-jz4760.c b/firmware/target/mips/ingenic_jz47xx/usb-jz4760.c index 37df1b3bb6..5dbf9455e3 100644 --- a/firmware/target/mips/ingenic_jz47xx/usb-jz4760.c +++ b/firmware/target/mips/ingenic_jz47xx/usb-jz4760.c @@ -1118,7 +1118,7 @@ int usb_drv_send(int endpoint, void* ptr, int length) return -1; } -int usb_drv_recv(int endpoint, void* ptr, int length) +int usb_drv_recv_nonblocking(int endpoint, void* ptr, int length) { int flags; struct usb_endpoint *ep; diff --git a/firmware/usbstack/usb_core.c b/firmware/usbstack/usb_core.c index b291dc7655..bf73c58abc 100644 --- a/firmware/usbstack/usb_core.c +++ b/firmware/usbstack/usb_core.c @@ -674,7 +674,7 @@ static void request_handler_device_get_descriptor(struct usb_ctrlrequest* req) if (ptr != response_data) memcpy(response_data, ptr, length); - usb_drv_recv(EP_CONTROL, NULL, 0); + usb_drv_recv_nonblocking(EP_CONTROL, NULL, 0); usb_drv_send(EP_CONTROL, response_data, length); } } @@ -725,7 +725,7 @@ static void request_handler_device(struct usb_ctrlrequest* req) case USB_REQ_GET_CONFIGURATION: { logf("usb_core: GET_CONFIG"); response_data[0] = (usb_state == ADDRESS ? 0 : 1); - usb_drv_recv(EP_CONTROL, NULL, 0); + usb_drv_recv_nonblocking(EP_CONTROL, NULL, 0); usb_drv_send(EP_CONTROL, response_data, 1); break; } @@ -759,7 +759,7 @@ static void request_handler_device(struct usb_ctrlrequest* req) case USB_REQ_GET_STATUS: response_data[0] = 0; response_data[1] = 0; - usb_drv_recv(EP_CONTROL, NULL, 0); + usb_drv_recv_nonblocking(EP_CONTROL, NULL, 0); usb_drv_send(EP_CONTROL, response_data, 2); break; default: @@ -781,7 +781,7 @@ static void request_handler_interface_standard(struct usb_ctrlrequest* req) case USB_REQ_GET_INTERFACE: logf("usb_core: GET_INTERFACE"); response_data[0] = 0; - usb_drv_recv(EP_CONTROL, NULL, 0); + usb_drv_recv_nonblocking(EP_CONTROL, NULL, 0); usb_drv_send(EP_CONTROL, response_data, 1); break; case USB_REQ_CLEAR_FEATURE: @@ -791,7 +791,7 @@ static void request_handler_interface_standard(struct usb_ctrlrequest* req) case USB_REQ_GET_STATUS: response_data[0] = 0; response_data[1] = 0; - usb_drv_recv(EP_CONTROL, NULL, 0); + usb_drv_recv_nonblocking(EP_CONTROL, NULL, 0); usb_drv_send(EP_CONTROL, response_data, 2); break; default: @@ -860,7 +860,7 @@ static void request_handler_endpoint_standard(struct usb_ctrlrequest* req) response_data[0] = usb_drv_stalled(EP_NUM(req->wIndex), EP_DIR(req->wIndex)); - usb_drv_recv(EP_CONTROL, NULL, 0); + usb_drv_recv_nonblocking(EP_CONTROL, NULL, 0); usb_drv_send(EP_CONTROL, response_data, 2); break; default: diff --git a/firmware/usbstack/usb_hid.c b/firmware/usbstack/usb_hid.c index 885ae4c24a..16dddb7db1 100644 --- a/firmware/usbstack/usb_hid.c +++ b/firmware/usbstack/usb_hid.c @@ -693,7 +693,7 @@ static int usb_hid_set_report(struct usb_ctrlrequest *req) } memset(buf, 0, length); - usb_drv_recv(EP_CONTROL, buf, length); + usb_drv_recv_nonblocking(EP_CONTROL, buf, length); #ifdef LOGF_ENABLE if (buf[1] & 0x01) @@ -772,7 +772,7 @@ bool usb_hid_control_request(struct usb_ctrlrequest *req, unsigned char *dest) if (dest != orig_dest) { - usb_drv_recv(EP_CONTROL, NULL, 0); /* ack */ + usb_drv_recv_nonblocking(EP_CONTROL, NULL, 0); /* ack */ usb_drv_send(EP_CONTROL, orig_dest, dest - orig_dest); return true; } @@ -809,7 +809,7 @@ bool usb_hid_control_request(struct usb_ctrlrequest *req, unsigned char *dest) if (dest != orig_dest) { - usb_drv_recv(EP_CONTROL, NULL, 0); /* ack */ + usb_drv_recv_nonblocking(EP_CONTROL, NULL, 0); /* ack */ usb_drv_send(EP_CONTROL, orig_dest, dest - orig_dest); } else diff --git a/firmware/usbstack/usb_serial.c b/firmware/usbstack/usb_serial.c index a08394c0a8..c96936f1d4 100644 --- a/firmware/usbstack/usb_serial.c +++ b/firmware/usbstack/usb_serial.c @@ -294,7 +294,7 @@ bool usb_serial_control_request(struct usb_ctrlrequest* req, unsigned char* dest if (req->wLength == sizeof(line_coding)) { /* Receive line coding into local copy */ - usb_drv_recv(EP_CONTROL, &line_coding, sizeof(line_coding)); + usb_drv_recv_nonblocking(EP_CONTROL, &line_coding, sizeof(line_coding)); usb_drv_send(EP_CONTROL, NULL, 0); /* ack */ handled = true; } @@ -316,7 +316,7 @@ bool usb_serial_control_request(struct usb_ctrlrequest* req, unsigned char* dest if (req->wLength == sizeof(line_coding)) { /* Send back line coding so host is happy */ - usb_drv_recv(EP_CONTROL, NULL, 0); /* ack */ + usb_drv_recv_nonblocking(EP_CONTROL, NULL, 0); /* ack */ usb_drv_send(EP_CONTROL, &line_coding, sizeof(line_coding)); handled = true; } @@ -329,7 +329,7 @@ bool usb_serial_control_request(struct usb_ctrlrequest* req, unsigned char* dest void usb_serial_init_connection(void) { /* prime rx endpoint */ - usb_drv_recv(ep_out, receive_buffer, sizeof receive_buffer); + usb_drv_recv_nonblocking(ep_out, receive_buffer, sizeof receive_buffer); /* we come here too after a bus reset, so reset some data */ buffer_transitlength = 0; @@ -420,7 +420,7 @@ void usb_serial_transfer_complete(int ep,int dir, int status, int length) /* Data received. TODO : Do something with it ? */ /* Get the next bit */ - usb_drv_recv(ep_out, receive_buffer, sizeof receive_buffer); + usb_drv_recv_nonblocking(ep_out, receive_buffer, sizeof receive_buffer); break; case USB_DIR_IN: diff --git a/firmware/usbstack/usb_storage.c b/firmware/usbstack/usb_storage.c index 8e1b507ac4..947006c1ec 100644 --- a/firmware/usbstack/usb_storage.c +++ b/firmware/usbstack/usb_storage.c @@ -470,7 +470,7 @@ void usb_storage_init_connection(void) ramdisk_buffer = tb.transfer_buffer + ALLOCATE_BUFFER_SIZE; #endif #endif - usb_drv_recv(ep_out, cbw_buffer, MAX_CBW_SIZE); + usb_drv_recv_nonblocking(ep_out, cbw_buffer, MAX_CBW_SIZE); int i; for(i=0;i