333553caf2
fix(hal/include): fix header violations in hal component fix(hal/include): Move type definitions from `xx_hal.h` to `xx_types.h` fix(hal/include): Move type definitions from `xx_hal.h` to `xx_types.h` fix(hal/include): Add comment for a far away `#endif` fix(hal/include): change scope for cpp guard ci: Remove components/hal/ comment from public headers check exceptions Add missing include macro sdkconfig.h for header files Add missing include macro stdbool.h for header files Add missing include macro stdint.h for header files Add missing capability guard macro for header files Add missing cpp guard macro for header files Remove some useless include macros Add some missing `inline` attribute for functions defined in header files Remove components/hal/ from public headers check exceptions fix(hal/include): fix invalid licenses fix(hal/include): fix invalid licenses fix(hal/include): add missing soc_caps.h fix(hal): include soc_caps.h before cap macro is used fix(hal): Remove unnecessary target check fix(hal): fix header and macro problems Add missing include macro Remove loop dependency in hal Add comment for far-away endif fix(hal): Add missing soc_caps.h ci: update check_copyright_ignore.txt Change the sequence of `#include` macro, cpp guard macro Change the wrap scope of capacity macro fix(hal): Change position of C++ guard to pass test
90 lines
2.2 KiB
C
90 lines
2.2 KiB
C
/*
|
|
* SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD
|
|
*
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <stdbool.h>
|
|
#include "usb_types_private.h"
|
|
#include "usb_phy_types.h"
|
|
#include "soc/soc_caps.h"
|
|
#if SOC_USB_OTG_SUPPORTED
|
|
#include "soc/usb_wrap_struct.h"
|
|
#endif
|
|
#if SOC_USB_SERIAL_JTAG_SUPPORTED
|
|
#include "soc/usb_serial_jtag_struct.h"
|
|
#endif
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
#if SOC_USB_OTG_SUPPORTED
|
|
/**
|
|
* Context that should be maintained by both the driver and the HAL
|
|
*/
|
|
|
|
typedef struct {
|
|
usb_wrap_dev_t *wrap_dev; /**< Pointer to base address of USB Wrapper registers */
|
|
#if SOC_USB_SERIAL_JTAG_SUPPORTED
|
|
usb_serial_jtag_dev_t *jtag_dev; /**< Pointer to base address of USB Serial JTAG registers */
|
|
#endif
|
|
} usb_phy_hal_context_t;
|
|
|
|
|
|
/**
|
|
* @brief Init the USB PHY hal. This function should be called first before other hal layer function is called
|
|
*
|
|
* @param hal Context of the HAL layer
|
|
*/
|
|
void usb_phy_hal_init(usb_phy_hal_context_t *hal);
|
|
|
|
/**
|
|
* @brief Configure internal/external PHY for USB_OTG
|
|
*
|
|
* @param hal Context of the HAL layer
|
|
* @param phy_target USB PHY target
|
|
*/
|
|
void usb_phy_hal_otg_conf(usb_phy_hal_context_t *hal, usb_phy_target_t phy_target);
|
|
|
|
#if SOC_USB_SERIAL_JTAG_SUPPORTED
|
|
/**
|
|
* @brief Configure internal/external PHY for USB_Serial_JTAG
|
|
*
|
|
* @param hal Context of the HAL layer
|
|
* @param phy_target USB PHY target
|
|
*/
|
|
void usb_phy_hal_jtag_conf(usb_phy_hal_context_t *hal, usb_phy_target_t phy_target);
|
|
#endif
|
|
|
|
/**
|
|
* @brief Configure pullup/pulldown loads for the D+/D- as a host
|
|
*
|
|
* @param hal Context of the HAL layer
|
|
*/
|
|
void usb_phy_hal_int_load_conf_host(usb_phy_hal_context_t *hal);
|
|
|
|
/**
|
|
* @brief Configure pullup/pulldown loads for the D+/D- as a device
|
|
*
|
|
* @param hal Context of the HAL layer
|
|
* @param speed USB speed
|
|
*/
|
|
void usb_phy_hal_int_load_conf_dev(usb_phy_hal_context_t *hal, usb_priv_speed_t speed);
|
|
|
|
/**
|
|
* @brief Enable/Disable test mode for internal PHY to mimick host-device disconnection
|
|
*
|
|
* @param hal Context of the HAL layer
|
|
* @param disconn Whether to disconnect
|
|
*/
|
|
void usb_phy_hal_int_mimick_disconn(usb_phy_hal_context_t *hal, bool disconn);
|
|
|
|
#endif
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|