-
Notifications
You must be signed in to change notification settings - Fork 7.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(hal/usb): Add new USB PHY related HAL API
This commit adds/updates the USB PHY related HAL APIs. The following changes are made: - Updated 'usb_wrap_hal.h' API - Added 'usb_serial_jtag_hal.h' API
- Loading branch information
Showing
6 changed files
with
185 additions
and
137 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/* | ||
* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include "soc/soc_caps.h" | ||
#if SOC_USB_SERIAL_JTAG_SUPPORTED | ||
#include "hal/usb_serial_jtag_ll.h" | ||
#endif | ||
#include "hal/usb_serial_jtag_types.h" | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
#if SOC_USB_SERIAL_JTAG_SUPPORTED | ||
|
||
/** | ||
* @brief HAL context type of USJ driver | ||
*/ | ||
typedef struct { | ||
usb_serial_jtag_dev_t *dev; | ||
} usb_serial_jtag_hal_context_t; | ||
|
||
/** | ||
* @brief Initialize the USJ HAL driver | ||
* | ||
* @param hal USJ HAL context | ||
*/ | ||
void usb_serial_jtag_hal_init(usb_serial_jtag_hal_context_t *hal); | ||
|
||
/* ---------------------------- USB PHY Control ---------------------------- */ | ||
|
||
#if USB_SERIAL_JTAG_LL_EXT_PHY_SUPPORTED | ||
/** | ||
* @brief Configure whether USJ is routed to internal/external FSLS PHY | ||
* | ||
* @param hal USJ HAL context | ||
* @param external True if external, False if internal | ||
*/ | ||
void usb_serial_jtag_hal_phy_set_external(usb_serial_jtag_hal_context_t *hal, bool external); | ||
#endif // USB_SERIAL_JTAG_LL_EXT_PHY_SUPPORTED | ||
|
||
#endif // SOC_USB_SERIAL_JTAG_SUPPORTED | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* | ||
* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
#include "hal/usb_serial_jtag_ll.h" | ||
#include "hal/usb_serial_jtag_hal.h" | ||
|
||
void usb_serial_jtag_hal_init(usb_serial_jtag_hal_context_t *hal) | ||
{ | ||
hal->dev = &USB_SERIAL_JTAG; | ||
#if !USB_SERIAL_JTAG_LL_EXT_PHY_SUPPORTED | ||
usb_serial_jtag_ll_phy_set_defaults(); | ||
#endif | ||
} | ||
|
||
#if USB_SERIAL_JTAG_LL_EXT_PHY_SUPPORTED | ||
void usb_serial_jtag_hal_phy_set_external(usb_serial_jtag_hal_context_t *hal, bool external) | ||
{ | ||
if (external) { | ||
usb_serial_jtag_ll_phy_enable_external(true); | ||
} else { | ||
usb_serial_jtag_ll_phy_enable_external(false); | ||
usb_serial_jtag_ll_phy_enable_pad(true); | ||
} | ||
} | ||
#endif // USB_SERIAL_JTAG_LL_EXT_PHY_SUPPORTED |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.