mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
esp_rom: implement usb deinit functions added in S3 ROM for S2
This cleans up usb_console.c and prepares it for S3 support.
This commit is contained in:
parent
74fa41f434
commit
4a91ccf4ce
@ -295,5 +295,5 @@ else() # Regular app build
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(target STREQUAL "esp32s2")
|
if(target STREQUAL "esp32s2")
|
||||||
target_sources(${COMPONENT_LIB} PRIVATE "esp32s2/usb_descriptors.c")
|
target_sources(${COMPONENT_LIB} PRIVATE "esp32s2/usb_patches.c")
|
||||||
endif()
|
endif()
|
||||||
|
@ -65,3 +65,19 @@ void rom_usb_cdc_set_descriptor_patch(void)
|
|||||||
/* Override the pointer to descriptors structure */
|
/* Override the pointer to descriptors structure */
|
||||||
rom_usb_curr_desc = &s_acm_usb_descriptors_override;
|
rom_usb_curr_desc = &s_acm_usb_descriptors_override;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* On ESP32-S2, ROM doesn't provide interfaces to clear usb_dev and usb_dw_ctrl structures.
|
||||||
|
* Starting from ESP32-S3, usb_dev_deinit and usb_dw_ctrl_deinit ROM functions are available.
|
||||||
|
* Here we implement the missing functionality for the ESP32-S2.
|
||||||
|
*/
|
||||||
|
void usb_dev_deinit(void)
|
||||||
|
{
|
||||||
|
extern char rom_usb_dev, rom_usb_dev_end;
|
||||||
|
memset((void *) &rom_usb_dev, 0, &rom_usb_dev_end - &rom_usb_dev);
|
||||||
|
}
|
||||||
|
|
||||||
|
void usb_dw_ctrl_deinit(void)
|
||||||
|
{
|
||||||
|
extern char rom_usb_dw_ctrl, rom_usb_dw_ctrl_end;
|
||||||
|
memset((void *) &rom_usb_dw_ctrl, 0, &rom_usb_dw_ctrl_end - &rom_usb_dw_ctrl);
|
||||||
|
}
|
@ -232,12 +232,9 @@ void esp_usb_console_before_restart(void)
|
|||||||
*/
|
*/
|
||||||
static void esp_usb_console_rom_cleanup(void)
|
static void esp_usb_console_rom_cleanup(void)
|
||||||
{
|
{
|
||||||
extern char rom_usb_dev, rom_usb_dev_end;
|
usb_dev_deinit();
|
||||||
extern char rom_usb_dw_ctrl, rom_usb_dw_ctrl_end;
|
usb_dw_ctrl_deinit();
|
||||||
|
|
||||||
uart_acm_dev = NULL;
|
uart_acm_dev = NULL;
|
||||||
memset((void *) &rom_usb_dev, 0, &rom_usb_dev_end - &rom_usb_dev);
|
|
||||||
memset((void *) &rom_usb_dw_ctrl, 0, &rom_usb_dw_ctrl_end - &rom_usb_dw_ctrl);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
esp_err_t esp_usb_console_init(void)
|
esp_err_t esp_usb_console_init(void)
|
||||||
|
Loading…
Reference in New Issue
Block a user