summaryrefslogtreecommitdiff
path: root/firmware/usbstack
diff options
context:
space:
mode:
authorAidan MacDonald <amachronic@protonmail.com>2021-09-19 10:54:26 +0100
committerAidan MacDonald <amachronic@protonmail.com>2021-09-20 22:41:29 +0100
commit672bbe434b12d4730cf270f7245753fb98cf162d (patch)
tree3fdaa08ddc41f942336c968bb169e8806c7c3fa8 /firmware/usbstack
parent99f333c64f13c3f9a62b9f5e184ae87f053bf65a (diff)
usb: rename usb_drv_recv() to usb_recv_recv_nonblocking()
IMHO the current name is somewhat misleading: - usb_drv_send() is blocking and we have usb_drv_send_nonblocking() for the non-blocking case. This inconsistent naming can only promote confusion. (And what would we call a blocking receive?) - Other hardware abstraction APIs in Rockbox are usually blocking: storage, LCD, backlight, audio... in other words, blocking is the default expected behavior, with non-blocking calls being a rarity. Change-Id: I05b41088d09eab582697674f4f06fdca0c8950af
Diffstat (limited to 'firmware/usbstack')
-rw-r--r--firmware/usbstack/usb_core.c12
-rw-r--r--firmware/usbstack/usb_hid.c6
-rw-r--r--firmware/usbstack/usb_serial.c8
-rw-r--r--firmware/usbstack/usb_storage.c10
4 files changed, 18 insertions, 18 deletions
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<storage_num_drives();i++) {
@@ -685,7 +685,7 @@ bool usb_storage_control_request(struct usb_ctrlrequest* req, unsigned char* des
if(skip_first) (*tb.max_lun) --;
#endif
logf("ums: getmaxlun");
- usb_drv_recv(EP_CONTROL, NULL, 0); /* ack */
+ usb_drv_recv_nonblocking(EP_CONTROL, NULL, 0); /* ack */
usb_drv_send(EP_CONTROL, tb.max_lun, 1);
handled = true;
break;
@@ -1187,14 +1187,14 @@ static void send_command_failed_result(void)
#if CONFIG_RTC
static void receive_time(void)
{
- usb_drv_recv(ep_out, tb.transfer_buffer, 12);
+ usb_drv_recv_nonblocking(ep_out, tb.transfer_buffer, 12);
state = RECEIVING_TIME;
}
#endif /* CONFIG_RTC */
static void receive_block_data(void *data,int size)
{
- usb_drv_recv(ep_out, data, size);
+ usb_drv_recv_nonblocking(ep_out, data, size);
state = RECEIVING_BLOCKS;
}
@@ -1210,7 +1210,7 @@ static void send_csw(int status)
state = WAITING_FOR_CSW_COMPLETION_OR_COMMAND;
//logf("CSW: %X",status);
/* Already start waiting for the next command */
- usb_drv_recv(ep_out, cbw_buffer, MAX_CBW_SIZE);
+ usb_drv_recv_nonblocking(ep_out, cbw_buffer, MAX_CBW_SIZE);
/* The next completed transfer will be either the CSW one
* or the new command */