1 /*
2  * SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 #include "soc/soc_caps.h"
8 #include "hal/usb_wrap_ll.h"
9 #include "hal/usb_wrap_hal.h"
10 
usb_wrap_hal_init(usb_wrap_hal_context_t * hal)11 void usb_wrap_hal_init(usb_wrap_hal_context_t *hal)
12 {
13     hal->dev = &USB_WRAP;
14 #if !USB_WRAP_LL_EXT_PHY_SUPPORTED
15     usb_wrap_ll_phy_set_defaults(hal->dev);
16 #endif
17 }
18 
19 #if USB_WRAP_LL_EXT_PHY_SUPPORTED
usb_wrap_hal_phy_set_external(usb_wrap_hal_context_t * hal,bool external)20 void usb_wrap_hal_phy_set_external(usb_wrap_hal_context_t *hal, bool external)
21 {
22     if (external) {
23         usb_wrap_ll_phy_enable_external(hal->dev, true);
24     } else {
25         usb_wrap_ll_phy_enable_external(hal->dev, false);
26         usb_wrap_ll_phy_enable_pad(hal->dev, true);
27     }
28 }
29 #endif // USB_WRAP_LL_EXT_PHY_SUPPORTED
30