mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
Merge branch 'refactor/usb_remove_unused_files_v5.1' into 'release/v5.1'
USB: Remove unused HAL files and deprecate usb_periph (v5.1) See merge request espressif/esp-idf!29790
This commit is contained in:
commit
54507f0113
@ -181,7 +181,6 @@ if(NOT BOOTLOADER_BUILD)
|
|||||||
|
|
||||||
if(CONFIG_SOC_USB_OTG_SUPPORTED)
|
if(CONFIG_SOC_USB_OTG_SUPPORTED)
|
||||||
list(APPEND srcs
|
list(APPEND srcs
|
||||||
"usb_hal.c"
|
|
||||||
"usb_dwc_hal.c"
|
"usb_dwc_hal.c"
|
||||||
"usb_fsls_phy_hal.c")
|
"usb_fsls_phy_hal.c")
|
||||||
endif()
|
endif()
|
||||||
|
@ -1,42 +0,0 @@
|
|||||||
// Copyright 2020 Espressif Systems (Shanghai) PTE LTD
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
// you may not use this file except in compliance with the License.
|
|
||||||
// You may obtain a copy of the License at
|
|
||||||
//
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
//
|
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
// See the License for the specific language governing permissions and
|
|
||||||
// limitations under the License.
|
|
||||||
|
|
||||||
|
|
||||||
#include "soc/soc.h"
|
|
||||||
#include "soc/system_reg.h"
|
|
||||||
#include "soc/gpio_sig_map.h"
|
|
||||||
#include "soc/usb_periph.h"
|
|
||||||
|
|
||||||
static inline void usb_ll_int_phy_enable(void)
|
|
||||||
{
|
|
||||||
USB_WRAP.otg_conf.pad_enable = 1;
|
|
||||||
USB_WRAP.otg_conf.phy_sel = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void usb_ll_ext_phy_enable(void)
|
|
||||||
{
|
|
||||||
USB_WRAP.otg_conf.pad_enable = 1;
|
|
||||||
USB_WRAP.otg_conf.phy_sel = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void usb_ll_int_phy_pullup_conf(bool dp_pu, bool dp_pd, bool dm_pu, bool dm_pd)
|
|
||||||
{
|
|
||||||
usb_wrap_otg_conf_reg_t conf = USB_WRAP.otg_conf;
|
|
||||||
conf.pad_pull_override = 1;
|
|
||||||
conf.dp_pullup = dp_pu;
|
|
||||||
conf.dp_pulldown = dp_pd;
|
|
||||||
conf.dm_pullup = dm_pu;
|
|
||||||
conf.dm_pulldown = dm_pd;
|
|
||||||
USB_WRAP.otg_conf = conf;
|
|
||||||
}
|
|
@ -1,53 +0,0 @@
|
|||||||
// Copyright 2020 Espressif Systems (Shanghai) PTE LTD
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
// you may not use this file except in compliance with the License.
|
|
||||||
// You may obtain a copy of the License at
|
|
||||||
//
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
//
|
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
// See the License for the specific language governing permissions and
|
|
||||||
// limitations under the License.
|
|
||||||
|
|
||||||
|
|
||||||
#include "soc/soc.h"
|
|
||||||
#include "soc/system_reg.h"
|
|
||||||
#include "soc/gpio_sig_map.h"
|
|
||||||
#include "soc/usb_periph.h"
|
|
||||||
#include "soc/rtc_cntl_struct.h"
|
|
||||||
|
|
||||||
static inline void usb_ll_int_phy_enable(void)
|
|
||||||
{
|
|
||||||
USB_WRAP.otg_conf.pad_enable = 1;
|
|
||||||
// USB_OTG use internal PHY
|
|
||||||
USB_WRAP.otg_conf.phy_sel = 0;
|
|
||||||
// phy_sel is controlled by the following register value
|
|
||||||
RTCCNTL.usb_conf.sw_hw_usb_phy_sel = 1;
|
|
||||||
// phy_sel=sw_usb_phy_sel=1, USB_OTG is connected with internal PHY
|
|
||||||
RTCCNTL.usb_conf.sw_usb_phy_sel = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void usb_ll_ext_phy_enable(void)
|
|
||||||
{
|
|
||||||
USB_WRAP.otg_conf.pad_enable = 1;
|
|
||||||
// USB_OTG use external PHY
|
|
||||||
USB_WRAP.otg_conf.phy_sel = 1;
|
|
||||||
// phy_sel is controlled by the following register value
|
|
||||||
RTCCNTL.usb_conf.sw_hw_usb_phy_sel = 1;
|
|
||||||
// phy_sel=sw_usb_phy_sel=0, USB_OTG is connected with external PHY through GPIO Matrix
|
|
||||||
RTCCNTL.usb_conf.sw_usb_phy_sel = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void usb_ll_int_phy_pullup_conf(bool dp_pu, bool dp_pd, bool dm_pu, bool dm_pd)
|
|
||||||
{
|
|
||||||
usb_wrap_otg_conf_reg_t conf = USB_WRAP.otg_conf;
|
|
||||||
conf.pad_pull_override = 1;
|
|
||||||
conf.dp_pullup = dp_pu;
|
|
||||||
conf.dp_pulldown = dp_pd;
|
|
||||||
conf.dm_pullup = dm_pu;
|
|
||||||
conf.dm_pulldown = dm_pd;
|
|
||||||
USB_WRAP.otg_conf = conf;
|
|
||||||
}
|
|
@ -1,31 +0,0 @@
|
|||||||
// Copyright 2020 Espressif Systems (Shanghai) PTE LTD
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
// you may not use this file except in compliance with the License.
|
|
||||||
// You may obtain a copy of the License at
|
|
||||||
//
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
//
|
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
// See the License for the specific language governing permissions and
|
|
||||||
// limitations under the License.
|
|
||||||
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
bool use_external_phy;
|
|
||||||
} usb_hal_context_t;
|
|
||||||
|
|
||||||
void usb_hal_init(usb_hal_context_t *usb);
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
@ -1,26 +0,0 @@
|
|||||||
// Copyright 2020 Espressif Systems (Shanghai) PTE LTD
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
// you may not use this file except in compliance with the License.
|
|
||||||
// You may obtain a copy of the License at
|
|
||||||
//
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
//
|
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
// See the License for the specific language governing permissions and
|
|
||||||
// limitations under the License.
|
|
||||||
|
|
||||||
|
|
||||||
#include "hal/usb_ll.h"
|
|
||||||
#include "hal/usb_hal.h"
|
|
||||||
|
|
||||||
void usb_hal_init(usb_hal_context_t *usb)
|
|
||||||
{
|
|
||||||
if (usb->use_external_phy) {
|
|
||||||
usb_ll_ext_phy_enable();
|
|
||||||
} else {
|
|
||||||
usb_ll_int_phy_enable();
|
|
||||||
}
|
|
||||||
}
|
|
@ -101,7 +101,7 @@ endif()
|
|||||||
|
|
||||||
if(CONFIG_SOC_USB_OTG_SUPPORTED)
|
if(CONFIG_SOC_USB_OTG_SUPPORTED)
|
||||||
list(APPEND srcs "${target}/usb_periph.c"
|
list(APPEND srcs "${target}/usb_periph.c"
|
||||||
"${target}/usb_otg_periph.c")
|
"${target}/usb_dwc_periph.c")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(CONFIG_SOC_DAC_SUPPORTED)
|
if(CONFIG_SOC_DAC_SUPPORTED)
|
||||||
|
@ -1,12 +1,18 @@
|
|||||||
/*
|
/*
|
||||||
* SPDX-FileCopyrightText: 2020-2022 Espressif Systems (Shanghai) CO LTD
|
* SPDX-FileCopyrightText: 2020-2024 Espressif Systems (Shanghai) CO LTD
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
/* GPIOs used to connect an external USB PHY */
|
/*
|
||||||
|
Note: These macros are deprecated. When connecting USB OTG to an external FSLS
|
||||||
|
PHY, the FSLS Serial Interface signals can be routed to any GPIO via the GPIO
|
||||||
|
matrix. Thus, these macros are meaningless.
|
||||||
|
|
||||||
|
Todo: Remove in IDF v6.0 (IDF-9029)
|
||||||
|
*/
|
||||||
#define USBPHY_VP_NUM 33
|
#define USBPHY_VP_NUM 33
|
||||||
#define USBPHY_VM_NUM 34
|
#define USBPHY_VM_NUM 34
|
||||||
#define USBPHY_RCV_NUM 35
|
#define USBPHY_RCV_NUM 35
|
||||||
|
@ -1,26 +1,41 @@
|
|||||||
// Copyright 2020 Espressif Systems (Shanghai) PTE LTD
|
/*
|
||||||
//
|
* SPDX-FileCopyrightText: 2020-2024 Espressif Systems (Shanghai) CO LTD
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
*
|
||||||
// you may not use this file except in compliance with the License.
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
// You may obtain a copy of the License at
|
*/
|
||||||
//
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
//
|
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
// See the License for the specific language governing permissions and
|
|
||||||
// limitations under the License.
|
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include "usb_types.h"
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* USB IN EP Register block type */
|
||||||
|
typedef struct usb_in_ep_reg {
|
||||||
|
volatile uint32_t diepctl;
|
||||||
|
uint32_t reserved;
|
||||||
|
volatile uint32_t diepint;
|
||||||
|
uint32_t reserved1;
|
||||||
|
volatile uint32_t dieptsiz;
|
||||||
|
volatile uint32_t diepdma;
|
||||||
|
volatile uint32_t dtxfsts;
|
||||||
|
uint32_t reserved2;
|
||||||
|
} usb_in_endpoint_t;
|
||||||
|
|
||||||
|
/* USB OUT EP Register block type */
|
||||||
|
typedef struct usb_out_ep_reg {
|
||||||
|
volatile uint32_t doepctl;
|
||||||
|
uint32_t reserved;
|
||||||
|
volatile uint32_t doepint;
|
||||||
|
uint32_t reserved1;
|
||||||
|
volatile uint32_t doeptsiz;
|
||||||
|
volatile uint32_t doepdma;
|
||||||
|
uint32_t reserved2;
|
||||||
|
uint32_t reserved3;
|
||||||
|
} usb_out_endpoint_t;
|
||||||
|
|
||||||
typedef struct usb_reg {
|
typedef struct usb_reg {
|
||||||
volatile uint32_t gotgctl; // 0x0000 OTG Control and Status Register
|
volatile uint32_t gotgctl; // 0x0000 OTG Control and Status Register
|
||||||
volatile uint32_t gotgint; // 0x0004 OTG Interrupt Register
|
volatile uint32_t gotgint; // 0x0004 OTG Interrupt Register
|
||||||
@ -82,10 +97,10 @@ typedef struct usb_reg {
|
|||||||
volatile uint32_t dtknqr4_fifoemptymsk; // 0x0834 Device IN Endpoint FIFO Empty Interrupt Mask register
|
volatile uint32_t dtknqr4_fifoemptymsk; // 0x0834 Device IN Endpoint FIFO Empty Interrupt Mask register
|
||||||
uint32_t reserved_0x0838_0x0900[50]; // 0x0838 to 0x0900
|
uint32_t reserved_0x0838_0x0900[50]; // 0x0838 to 0x0900
|
||||||
// Input Endpoints
|
// Input Endpoints
|
||||||
usb_in_endpoint_t in_ep_reg[USB_IN_EP_NUM]; // 0x0900 to 0x09e0 IN EP registers
|
usb_in_endpoint_t in_ep_reg[7]; // 0x0900 to 0x09e0 IN EP registers
|
||||||
uint32_t reserved_0x09e0_0x0b00[72]; // 0x09e0 to 0x0b00
|
uint32_t reserved_0x09e0_0x0b00[72]; // 0x09e0 to 0x0b00
|
||||||
// Output Endpoints
|
// Output Endpoints
|
||||||
usb_out_endpoint_t out_ep_reg[USB_OUT_EP_NUM]; // 0x0b00 to 0x0be0 OUT EP registers
|
usb_out_endpoint_t out_ep_reg[7]; // 0x0b00 to 0x0be0 OUT EP registers
|
||||||
uint32_t reserved_0x0be0_0x0d00[72]; // 0x0be0 to 0x0d00
|
uint32_t reserved_0x0be0_0x0d00[72]; // 0x0be0 to 0x0d00
|
||||||
uint32_t reserved_0x0d00_0x0e00[64]; // 0x0d00 to 0x0e00
|
uint32_t reserved_0x0d00_0x0e00[64]; // 0x0d00 to 0x0e00
|
||||||
/**
|
/**
|
||||||
|
@ -1,73 +0,0 @@
|
|||||||
// Copyright 2020 Espressif Systems (Shanghai) PTE LTD
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
// you may not use this file except in compliance with the License.
|
|
||||||
// You may obtain a copy of the License at
|
|
||||||
//
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
//
|
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
// See the License for the specific language governing permissions and
|
|
||||||
// limitations under the License.
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C"
|
|
||||||
{
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
|
|
||||||
/* USB IN EP index */
|
|
||||||
typedef enum {
|
|
||||||
USB_IN_EP_0 = 0,
|
|
||||||
USB_IN_EP_1,
|
|
||||||
USB_IN_EP_2,
|
|
||||||
USB_IN_EP_3,
|
|
||||||
USB_IN_EP_4,
|
|
||||||
USB_IN_EP_5,
|
|
||||||
USB_IN_EP_6,
|
|
||||||
USB_IN_EP_NUM
|
|
||||||
} usb_in_ep_idx_t;
|
|
||||||
|
|
||||||
/* USB OUT EP index */
|
|
||||||
typedef enum {
|
|
||||||
USB_OUT_EP_0 = 0,
|
|
||||||
USB_OUT_EP_1,
|
|
||||||
USB_OUT_EP_2,
|
|
||||||
USB_OUT_EP_3,
|
|
||||||
USB_OUT_EP_4,
|
|
||||||
USB_OUT_EP_5,
|
|
||||||
USB_OUT_EP_6,
|
|
||||||
USB_OUT_EP_NUM
|
|
||||||
} usb_out_ep_idx_t;
|
|
||||||
|
|
||||||
/* USB IN EP Register block type */
|
|
||||||
typedef struct usb_in_ep_reg {
|
|
||||||
volatile uint32_t diepctl;
|
|
||||||
uint32_t reserved;
|
|
||||||
volatile uint32_t diepint;
|
|
||||||
uint32_t reserved1;
|
|
||||||
volatile uint32_t dieptsiz;
|
|
||||||
volatile uint32_t diepdma;
|
|
||||||
volatile uint32_t dtxfsts;
|
|
||||||
uint32_t reserved2;
|
|
||||||
} usb_in_endpoint_t;
|
|
||||||
|
|
||||||
/* USB OUT EP Register block type */
|
|
||||||
typedef struct usb_out_ep_reg {
|
|
||||||
volatile uint32_t doepctl;
|
|
||||||
uint32_t reserved;
|
|
||||||
volatile uint32_t doepint;
|
|
||||||
uint32_t reserved1;
|
|
||||||
volatile uint32_t doeptsiz;
|
|
||||||
volatile uint32_t doepdma;
|
|
||||||
uint32_t reserved2;
|
|
||||||
uint32_t reserved3;
|
|
||||||
} usb_out_endpoint_t;
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
@ -1,10 +1,10 @@
|
|||||||
/*
|
/*
|
||||||
* SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD
|
* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "soc/usb_otg_periph.h"
|
#include "soc/usb_dwc_periph.h"
|
||||||
#include "soc/gpio_sig_map.h"
|
#include "soc/gpio_sig_map.h"
|
||||||
|
|
||||||
/*
|
/*
|
@ -1,20 +1,19 @@
|
|||||||
// Copyright 2020 Espressif Systems (Shanghai) PTE LTD
|
/*
|
||||||
//
|
* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
*
|
||||||
// you may not use this file except in compliance with the License.
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
// You may obtain a copy of the License at
|
*/
|
||||||
//
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
//
|
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
// See the License for the specific language governing permissions and
|
|
||||||
// limitations under the License.
|
|
||||||
|
|
||||||
#include "soc/soc_caps.h"
|
#include "soc/soc_caps.h"
|
||||||
#include "soc/usb_periph.h"
|
#include "soc/usb_periph.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
Note: These IO pins are deprecated. When connecting USB OTG to an external FSLS
|
||||||
|
PHY, the FSLS Serial Interface signals can be routed to any GPIO via the GPIO
|
||||||
|
matrix. Thus, this mapping of signals to IO pins is meaningless.
|
||||||
|
|
||||||
|
Todo: Remove in IDF v6.0 (IDF-9029)
|
||||||
|
*/
|
||||||
const usb_iopin_dsc_t usb_periph_iopins[] = {
|
const usb_iopin_dsc_t usb_periph_iopins[] = {
|
||||||
{USBPHY_VP_NUM, USB_EXTPHY_VP_IDX, 0, 1},
|
{USBPHY_VP_NUM, USB_EXTPHY_VP_IDX, 0, 1},
|
||||||
{USBPHY_VM_NUM, USB_EXTPHY_VM_IDX, 0, 1},
|
{USBPHY_VM_NUM, USB_EXTPHY_VM_IDX, 0, 1},
|
||||||
|
@ -1,12 +1,18 @@
|
|||||||
/*
|
/*
|
||||||
* SPDX-FileCopyrightText: 2020-2022 Espressif Systems (Shanghai) CO LTD
|
* SPDX-FileCopyrightText: 2020-2024 Espressif Systems (Shanghai) CO LTD
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
/* GPIOs used to connect an external USB PHY */
|
/*
|
||||||
|
Note: These macros are deprecated. When connecting USB OTG to an external FSLS
|
||||||
|
PHY, the FSLS Serial Interface signals can be routed to any GPIO via the GPIO
|
||||||
|
matrix. Thus, these macros are meaningless.
|
||||||
|
|
||||||
|
Todo: Remove in IDF v6.0 (IDF-9029)
|
||||||
|
*/
|
||||||
#define USBPHY_VP_NUM 42
|
#define USBPHY_VP_NUM 42
|
||||||
#define USBPHY_VM_NUM 41
|
#define USBPHY_VM_NUM 41
|
||||||
#define USBPHY_RCV_NUM 21
|
#define USBPHY_RCV_NUM 21
|
||||||
|
@ -1,27 +1,41 @@
|
|||||||
// Copyright 2020 Espressif Systems (Shanghai) PTE LTD
|
/*
|
||||||
//
|
* SPDX-FileCopyrightText: 2020-2024 Espressif Systems (Shanghai) CO LTD
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
*
|
||||||
// you may not use this file except in compliance with the License.
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
// You may obtain a copy of the License at
|
*/
|
||||||
//
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
//
|
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
// See the License for the specific language governing permissions and
|
|
||||||
// limitations under the License.
|
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include "usb_types.h"
|
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* USB IN EP Register block type */
|
||||||
|
typedef struct usb_in_ep_reg {
|
||||||
|
volatile uint32_t diepctl;
|
||||||
|
uint32_t reserved;
|
||||||
|
volatile uint32_t diepint;
|
||||||
|
uint32_t reserved1;
|
||||||
|
volatile uint32_t dieptsiz;
|
||||||
|
volatile uint32_t diepdma;
|
||||||
|
volatile uint32_t dtxfsts;
|
||||||
|
uint32_t reserved2;
|
||||||
|
} usb_in_endpoint_t;
|
||||||
|
|
||||||
|
/* USB OUT EP Register block type */
|
||||||
|
typedef struct usb_out_ep_reg {
|
||||||
|
volatile uint32_t doepctl;
|
||||||
|
uint32_t reserved;
|
||||||
|
volatile uint32_t doepint;
|
||||||
|
uint32_t reserved1;
|
||||||
|
volatile uint32_t doeptsiz;
|
||||||
|
volatile uint32_t doepdma;
|
||||||
|
uint32_t reserved2;
|
||||||
|
uint32_t reserved3;
|
||||||
|
} usb_out_endpoint_t;
|
||||||
|
|
||||||
typedef struct usb_reg {
|
typedef struct usb_reg {
|
||||||
volatile uint32_t gotgctl; // 0x0000 OTG Control and Status Register
|
volatile uint32_t gotgctl; // 0x0000 OTG Control and Status Register
|
||||||
volatile uint32_t gotgint; // 0x0004 OTG Interrupt Register
|
volatile uint32_t gotgint; // 0x0004 OTG Interrupt Register
|
||||||
@ -83,10 +97,10 @@ typedef struct usb_reg {
|
|||||||
volatile uint32_t dtknqr4_fifoemptymsk; // 0x0834 Device IN Endpoint FIFO Empty Interrupt Mask register
|
volatile uint32_t dtknqr4_fifoemptymsk; // 0x0834 Device IN Endpoint FIFO Empty Interrupt Mask register
|
||||||
uint32_t reserved_0x0838_0x0900[50]; // 0x0838 to 0x0900
|
uint32_t reserved_0x0838_0x0900[50]; // 0x0838 to 0x0900
|
||||||
// Input Endpoints
|
// Input Endpoints
|
||||||
usb_in_endpoint_t in_ep_reg[USB_IN_EP_NUM]; // 0x0900 to 0x09e0 IN EP registers
|
usb_in_endpoint_t in_ep_reg[7]; // 0x0900 to 0x09e0 IN EP registers
|
||||||
uint32_t reserved_0x09e0_0x0b00[72]; // 0x09e0 to 0x0b00
|
uint32_t reserved_0x09e0_0x0b00[72]; // 0x09e0 to 0x0b00
|
||||||
// Output Endpoints
|
// Output Endpoints
|
||||||
usb_out_endpoint_t out_ep_reg[USB_OUT_EP_NUM]; // 0x0b00 to 0x0be0 OUT EP registers
|
usb_out_endpoint_t out_ep_reg[7]; // 0x0b00 to 0x0be0 OUT EP registers
|
||||||
uint32_t reserved_0x0be0_0x0d00[72]; // 0x0be0 to 0x0d00
|
uint32_t reserved_0x0be0_0x0d00[72]; // 0x0be0 to 0x0d00
|
||||||
uint32_t reserved_0x0d00_0x0e00[64]; // 0x0d00 to 0x0e00
|
uint32_t reserved_0x0d00_0x0e00[64]; // 0x0d00 to 0x0e00
|
||||||
/**
|
/**
|
||||||
|
@ -1,73 +0,0 @@
|
|||||||
// Copyright 2020 Espressif Systems (Shanghai) PTE LTD
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
// you may not use this file except in compliance with the License.
|
|
||||||
// You may obtain a copy of the License at
|
|
||||||
//
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
//
|
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
// See the License for the specific language governing permissions and
|
|
||||||
// limitations under the License.
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C"
|
|
||||||
{
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
|
|
||||||
/* USB IN EP index */
|
|
||||||
typedef enum {
|
|
||||||
USB_IN_EP_0 = 0,
|
|
||||||
USB_IN_EP_1,
|
|
||||||
USB_IN_EP_2,
|
|
||||||
USB_IN_EP_3,
|
|
||||||
USB_IN_EP_4,
|
|
||||||
USB_IN_EP_5,
|
|
||||||
USB_IN_EP_6,
|
|
||||||
USB_IN_EP_NUM
|
|
||||||
} usb_in_ep_idx_t;
|
|
||||||
|
|
||||||
/* USB OUT EP index */
|
|
||||||
typedef enum {
|
|
||||||
USB_OUT_EP_0 = 0,
|
|
||||||
USB_OUT_EP_1,
|
|
||||||
USB_OUT_EP_2,
|
|
||||||
USB_OUT_EP_3,
|
|
||||||
USB_OUT_EP_4,
|
|
||||||
USB_OUT_EP_5,
|
|
||||||
USB_OUT_EP_6,
|
|
||||||
USB_OUT_EP_NUM
|
|
||||||
} usb_out_ep_idx_t;
|
|
||||||
|
|
||||||
/* USB IN EP Register block type */
|
|
||||||
typedef struct usb_in_ep_reg {
|
|
||||||
volatile uint32_t diepctl;
|
|
||||||
uint32_t reserved;
|
|
||||||
volatile uint32_t diepint;
|
|
||||||
uint32_t reserved1;
|
|
||||||
volatile uint32_t dieptsiz;
|
|
||||||
volatile uint32_t diepdma;
|
|
||||||
volatile uint32_t dtxfsts;
|
|
||||||
uint32_t reserved2;
|
|
||||||
} usb_in_endpoint_t;
|
|
||||||
|
|
||||||
/* USB OUT EP Register block type */
|
|
||||||
typedef struct usb_out_ep_reg {
|
|
||||||
volatile uint32_t doepctl;
|
|
||||||
uint32_t reserved;
|
|
||||||
volatile uint32_t doepint;
|
|
||||||
uint32_t reserved1;
|
|
||||||
volatile uint32_t doeptsiz;
|
|
||||||
volatile uint32_t doepdma;
|
|
||||||
uint32_t reserved2;
|
|
||||||
uint32_t reserved3;
|
|
||||||
} usb_out_endpoint_t;
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
@ -1,10 +1,10 @@
|
|||||||
/*
|
/*
|
||||||
* SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD
|
* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "soc/usb_otg_periph.h"
|
#include "soc/usb_dwc_periph.h"
|
||||||
#include "soc/gpio_sig_map.h"
|
#include "soc/gpio_sig_map.h"
|
||||||
|
|
||||||
/*
|
/*
|
@ -1,20 +1,19 @@
|
|||||||
// Copyright 2020 Espressif Systems (Shanghai) PTE LTD
|
/*
|
||||||
//
|
* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
*
|
||||||
// you may not use this file except in compliance with the License.
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
// You may obtain a copy of the License at
|
*/
|
||||||
//
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
//
|
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
// See the License for the specific language governing permissions and
|
|
||||||
// limitations under the License.
|
|
||||||
|
|
||||||
#include "soc/soc_caps.h"
|
#include "soc/soc_caps.h"
|
||||||
#include "soc/usb_periph.h"
|
#include "soc/usb_periph.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
Note: These IO pins are deprecated. When connecting USB OTG to an external FSLS
|
||||||
|
PHY, the FSLS Serial Interface signals can be routed to any GPIO via the GPIO
|
||||||
|
matrix. Thus, this mapping of signals to IO pins is meaningless.
|
||||||
|
|
||||||
|
Todo: Remove in IDF v6.0 (IDF-9029)
|
||||||
|
*/
|
||||||
const usb_iopin_dsc_t usb_periph_iopins[] = {
|
const usb_iopin_dsc_t usb_periph_iopins[] = {
|
||||||
{USBPHY_VP_NUM, USB_EXTPHY_VP_IDX, 0, 1},
|
{USBPHY_VP_NUM, USB_EXTPHY_VP_IDX, 0, 1},
|
||||||
{USBPHY_VM_NUM, USB_EXTPHY_VM_IDX, 0, 1},
|
{USBPHY_VM_NUM, USB_EXTPHY_VM_IDX, 0, 1},
|
||||||
|
46
components/soc/include/soc/usb_dwc_periph.h
Normal file
46
components/soc/include/soc/usb_dwc_periph.h
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
/*
|
||||||
|
* SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
#include <stdint.h>
|
||||||
|
#include "soc/soc_caps.h"
|
||||||
|
#include "soc/periph_defs.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
Stores a bunch of USB-peripheral data.
|
||||||
|
*/
|
||||||
|
typedef struct {
|
||||||
|
const uint8_t extphy_vp_in;
|
||||||
|
const uint8_t extphy_vm_in;
|
||||||
|
const uint8_t extphy_rcv_in;
|
||||||
|
const uint8_t extphy_oen_out;
|
||||||
|
const uint8_t extphy_vpo_out;
|
||||||
|
const uint8_t extphy_vmo_out;
|
||||||
|
const uint8_t extphy_suspend_in;
|
||||||
|
const uint8_t extphy_speed_in;
|
||||||
|
const uint8_t srp_bvalid_in;
|
||||||
|
const uint8_t srp_sessend_in;
|
||||||
|
const uint8_t srp_chrgvbus_out;
|
||||||
|
const uint8_t srp_dischrgvbus_out;
|
||||||
|
const uint8_t otg_iddig_in;
|
||||||
|
const uint8_t otg_avalid_in;
|
||||||
|
const uint8_t otg_vbusvalid_in;
|
||||||
|
const uint8_t otg_idpullup_out;
|
||||||
|
const uint8_t otg_dppulldown_out;
|
||||||
|
const uint8_t otg_dmpulldown_out;
|
||||||
|
const uint8_t otg_drvvbus_out;
|
||||||
|
const periph_module_t module;
|
||||||
|
} usb_phy_signal_conn_t;
|
||||||
|
|
||||||
|
extern const usb_phy_signal_conn_t usb_otg_periph_signal;
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
@ -1,46 +1,12 @@
|
|||||||
/*
|
/*
|
||||||
* SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD
|
* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <stdint.h>
|
|
||||||
#include "soc/soc_caps.h"
|
|
||||||
#include "soc/periph_defs.h"
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
/* Todo: Remove in ESP-IDF v6.0 (IDF-9052) */
|
||||||
extern "C" {
|
#warning "This header is deprecated, please use usb_dwc_periph.h instead"
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
#include "soc/usb_dwc_periph.h"
|
||||||
Stores a bunch of USB-peripheral data.
|
|
||||||
*/
|
|
||||||
typedef struct {
|
|
||||||
const uint8_t extphy_vp_in;
|
|
||||||
const uint8_t extphy_vm_in;
|
|
||||||
const uint8_t extphy_rcv_in;
|
|
||||||
const uint8_t extphy_oen_out;
|
|
||||||
const uint8_t extphy_vpo_out;
|
|
||||||
const uint8_t extphy_vmo_out;
|
|
||||||
const uint8_t extphy_suspend_in;
|
|
||||||
const uint8_t extphy_speed_in;
|
|
||||||
const uint8_t srp_bvalid_in;
|
|
||||||
const uint8_t srp_sessend_in;
|
|
||||||
const uint8_t srp_chrgvbus_out;
|
|
||||||
const uint8_t srp_dischrgvbus_out;
|
|
||||||
const uint8_t otg_iddig_in;
|
|
||||||
const uint8_t otg_avalid_in;
|
|
||||||
const uint8_t otg_vbusvalid_in;
|
|
||||||
const uint8_t otg_idpullup_out;
|
|
||||||
const uint8_t otg_dppulldown_out;
|
|
||||||
const uint8_t otg_dmpulldown_out;
|
|
||||||
const uint8_t otg_drvvbus_out;
|
|
||||||
const periph_module_t module;
|
|
||||||
} usb_phy_signal_conn_t;
|
|
||||||
|
|
||||||
extern const usb_phy_signal_conn_t usb_otg_periph_signal;
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* SPDX-FileCopyrightText: 2020-2022 Espressif Systems (Shanghai) CO LTD
|
* SPDX-FileCopyrightText: 2020-2024 Espressif Systems (Shanghai) CO LTD
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
@ -10,18 +10,21 @@
|
|||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include "soc/soc_pins.h"
|
#include "soc/soc_pins.h"
|
||||||
#include "soc/gpio_sig_map.h"
|
#include "soc/gpio_sig_map.h"
|
||||||
#include "soc/usb_reg.h"
|
|
||||||
#include "soc/usb_types.h"
|
|
||||||
#include "soc/usb_struct.h"
|
|
||||||
#include "soc/usb_wrap_reg.h"
|
|
||||||
#include "soc/usb_wrap_struct.h"
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if SOC_USB_OTG_SUPPORTED
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief A pin descriptor for init
|
* @brief A pin descriptor for init (DEPRECATED)
|
||||||
|
*
|
||||||
|
* Todo: Remove in IDF v6.0 (IDF-9029)
|
||||||
|
*
|
||||||
|
* @note These IO pins are deprecated. When connecting USB OTG to an external
|
||||||
|
* FSLS PHY, the FSLS Serial Interface signals can be routed to any GPIO via the
|
||||||
|
* GPI0 matrix. Thus, this mapping of signals to IO pins is meaningless.
|
||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct {
|
||||||
const int pin;
|
const int pin;
|
||||||
@ -32,6 +35,8 @@ typedef struct {
|
|||||||
|
|
||||||
extern const usb_iopin_dsc_t usb_periph_iopins[];
|
extern const usb_iopin_dsc_t usb_periph_iopins[];
|
||||||
|
|
||||||
|
#endif // SOC_USB_OTG_SUPPORTED
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
#include "esp_check.h"
|
#include "esp_check.h"
|
||||||
#include "esp_private/periph_ctrl.h"
|
#include "esp_private/periph_ctrl.h"
|
||||||
#include "esp_private/usb_phy.h"
|
#include "esp_private/usb_phy.h"
|
||||||
#include "soc/usb_otg_periph.h"
|
#include "soc/usb_dwc_periph.h"
|
||||||
#include "hal/usb_fsls_phy_hal.h"
|
#include "hal/usb_fsls_phy_hal.h"
|
||||||
#include "hal/usb_fsls_phy_ll.h"
|
#include "hal/usb_fsls_phy_ll.h"
|
||||||
#include "esp_rom_gpio.h"
|
#include "esp_rom_gpio.h"
|
||||||
|
@ -18,7 +18,6 @@
|
|||||||
#include "ffconf.h"
|
#include "ffconf.h"
|
||||||
#include "esp_vfs.h"
|
#include "esp_vfs.h"
|
||||||
#include "errno.h"
|
#include "errno.h"
|
||||||
#include "hal/usb_hal.h"
|
|
||||||
#include "driver/gpio.h"
|
#include "driver/gpio.h"
|
||||||
#include <esp_vfs_fat.h>
|
#include <esp_vfs_fat.h>
|
||||||
|
|
||||||
|
@ -878,15 +878,12 @@ components/soc/esp32s2/include/soc/touch_sensor_pins.h
|
|||||||
components/soc/esp32s2/include/soc/uart_pins.h
|
components/soc/esp32s2/include/soc/uart_pins.h
|
||||||
components/soc/esp32s2/include/soc/uart_reg.h
|
components/soc/esp32s2/include/soc/uart_reg.h
|
||||||
components/soc/esp32s2/include/soc/uhci_reg.h
|
components/soc/esp32s2/include/soc/uhci_reg.h
|
||||||
components/soc/esp32s2/include/soc/usb_struct.h
|
|
||||||
components/soc/esp32s2/include/soc/usb_types.h
|
|
||||||
components/soc/esp32s2/include/soc/usb_wrap_reg.h
|
components/soc/esp32s2/include/soc/usb_wrap_reg.h
|
||||||
components/soc/esp32s2/include/soc/usb_wrap_struct.h
|
components/soc/esp32s2/include/soc/usb_wrap_struct.h
|
||||||
components/soc/esp32s2/include/soc/usbh_struct.h
|
components/soc/esp32s2/include/soc/usbh_struct.h
|
||||||
components/soc/esp32s2/include/soc/wdev_reg.h
|
components/soc/esp32s2/include/soc/wdev_reg.h
|
||||||
components/soc/esp32s2/ledc_periph.c
|
components/soc/esp32s2/ledc_periph.c
|
||||||
components/soc/esp32s2/uart_periph.c
|
components/soc/esp32s2/uart_periph.c
|
||||||
components/soc/esp32s2/usb_periph.c
|
|
||||||
components/soc/esp32s3/dedic_gpio_periph.c
|
components/soc/esp32s3/dedic_gpio_periph.c
|
||||||
components/soc/esp32s3/i2c_periph.c
|
components/soc/esp32s3/i2c_periph.c
|
||||||
components/soc/esp32s3/include/soc/apb_ctrl_reg.h
|
components/soc/esp32s3/include/soc/apb_ctrl_reg.h
|
||||||
@ -950,8 +947,6 @@ components/soc/esp32s3/include/soc/uart_struct.h
|
|||||||
components/soc/esp32s3/include/soc/uhci_reg.h
|
components/soc/esp32s3/include/soc/uhci_reg.h
|
||||||
components/soc/esp32s3/include/soc/uhci_struct.h
|
components/soc/esp32s3/include/soc/uhci_struct.h
|
||||||
components/soc/esp32s3/include/soc/usb_serial_jtag_struct.h
|
components/soc/esp32s3/include/soc/usb_serial_jtag_struct.h
|
||||||
components/soc/esp32s3/include/soc/usb_struct.h
|
|
||||||
components/soc/esp32s3/include/soc/usb_types.h
|
|
||||||
components/soc/esp32s3/include/soc/usb_wrap_reg.h
|
components/soc/esp32s3/include/soc/usb_wrap_reg.h
|
||||||
components/soc/esp32s3/include/soc/usb_wrap_struct.h
|
components/soc/esp32s3/include/soc/usb_wrap_struct.h
|
||||||
components/soc/esp32s3/include/soc/usbh_struct.h
|
components/soc/esp32s3/include/soc/usbh_struct.h
|
||||||
@ -960,7 +955,6 @@ components/soc/esp32s3/ledc_periph.c
|
|||||||
components/soc/esp32s3/sdio_slave_periph.c
|
components/soc/esp32s3/sdio_slave_periph.c
|
||||||
components/soc/esp32s3/sdmmc_periph.c
|
components/soc/esp32s3/sdmmc_periph.c
|
||||||
components/soc/esp32s3/uart_periph.c
|
components/soc/esp32s3/uart_periph.c
|
||||||
components/soc/esp32s3/usb_periph.c
|
|
||||||
components/soc/include/soc/dedic_gpio_periph.h
|
components/soc/include/soc/dedic_gpio_periph.h
|
||||||
components/soc/include/soc/emac_periph.h
|
components/soc/include/soc/emac_periph.h
|
||||||
components/soc/include/soc/gpio_periph.h
|
components/soc/include/soc/gpio_periph.h
|
||||||
|
Loading…
Reference in New Issue
Block a user