Skip to content

Commit 4c06f93

Browse files
Merge pull request #338 from espressif/refactor/hcd_dwc_remove_workaround_for_clang
refactor(hcd_dwc): Removed workaround for clang compatibility (IEC-433)
2 parents d2e6f62 + b000d3f commit 4c06f93

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
@@ -1312,13 +1331,7 @@ static esp_err_t _port_cmd_reset(port_t *port)
13121331

13131332
ret = ESP_OK;
13141333
bailout:
1315-
// Reinitialize channel registers
1316-
(void) 0; // clang doesn't allow variable declarations after labels
1317-
pipe_t *pipe;
1318-
TAILQ_FOREACH(pipe, &port->pipes_idle_tailq, tailq_entry) {
1319-
usb_dwc_hal_chan_set_ep_char(port->hal, pipe->chan_obj, &pipe->ep_char);
1320-
}
1321-
CACHE_SYNC_FRAME_LIST(port->frame_list);
1334+
_port_reset_all_pipes(port);
13221335
exit:
13231336
return ret;
13241337
}

0 commit comments

Comments
 (0)