Skip to content

Commit b000d3f

Browse files
committed
refactor(hcd_dwc): Removed workaround for clang compatibility
1 parent 5f54457 commit b000d3f

File tree

1 file changed

+20
-7
lines changed

1 file changed

+20
-7
lines changed

host/usb/src/hcd_dwc.c

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -562,6 +562,16 @@ static bool _port_check_all_pipes_halted(port_t *port);
562562
*/
563563
static bool _port_debounce(port_t *port);
564564

565+
/**
566+
* @brief Reset all idle pipes
567+
*
568+
* This function reapplying initial endpoint characteristics for the underlying HAL channels and synchronizes the cache
569+
* for the frame list when available.
570+
*
571+
* @param port Port object
572+
*/
573+
static void _port_reset_all_pipes(port_t *port);
574+
565575
/**
566576
* @brief Convert user-provided FIFO configuration to HAL format
567577
*
@@ -1189,6 +1199,15 @@ static bool _port_debounce(port_t *port)
11891199
return is_connected;
11901200
}
11911201

1202+
static void _port_reset_all_pipes(port_t *port)
1203+
{
1204+
pipe_t *pipe;
1205+
TAILQ_FOREACH(pipe, &port->pipes_idle_tailq, tailq_entry) {
1206+
usb_dwc_hal_chan_set_ep_char(port->hal, pipe->chan_obj, &pipe->ep_char);
1207+
}
1208+
CACHE_SYNC_FRAME_LIST(port->frame_list);
1209+
}
1210+
11921211
static esp_err_t convert_fifo_config_to_hal_config(const hcd_fifo_settings_t *src, usb_dwc_hal_fifo_config_t *dst)
11931212
{
11941213
// Check at least RX and NPTX are non-zero
@@ -1309,13 +1328,7 @@ static esp_err_t _port_cmd_reset(port_t *port)
13091328

13101329
ret = ESP_OK;
13111330
bailout:
1312-
// Reinitialize channel registers
1313-
(void) 0; // clang doesn't allow variable declarations after labels
1314-
pipe_t *pipe;
1315-
TAILQ_FOREACH(pipe, &port->pipes_idle_tailq, tailq_entry) {
1316-
usb_dwc_hal_chan_set_ep_char(port->hal, pipe->chan_obj, &pipe->ep_char);
1317-
}
1318-
CACHE_SYNC_FRAME_LIST(port->frame_list);
1331+
_port_reset_all_pipes(port);
13191332
exit:
13201333
return ret;
13211334
}

0 commit comments

Comments
 (0)