mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
esp_rom: sync changes for ESP32-S3 USB related files, minor fix for S2
Used esp-rom tag esp32s3-20210327 and did manual cleanup. Rename s_usb_osglue to rom_usb_osglue like it was done for esp32s2. Some comments in esp32s2 headers are synced from esp32s3.
This commit is contained in:
parent
2c341a8557
commit
c7b409aa94
@ -792,7 +792,7 @@ usb_dfu_force_detach = 0x40002a54;
|
||||
usb_dev_deinit = 0x40002a60;
|
||||
usb_dw_ctrl_deinit = 0x40002a6c;
|
||||
/* Data (.data, .bss, .rodata) */
|
||||
s_usb_osglue = 0x3fceffac;
|
||||
rom_usb_osglue = 0x3fceffac;
|
||||
|
||||
|
||||
/***************************************
|
||||
|
@ -372,19 +372,43 @@ int usb_dc_ep_read_continue(uint8_t ep);
|
||||
int usb_dc_ep_mps(uint8_t ep);
|
||||
|
||||
|
||||
|
||||
//Hack - fake interrupts by pollinfg
|
||||
/**
|
||||
* @brief Poll for interrupts that need to be handled
|
||||
*
|
||||
* When the USB interrupt is not hooked up to an actual CPU interrupt, you
|
||||
* can call this periodically to handle the USB events that need handling.
|
||||
*/
|
||||
void usb_dc_check_poll_for_interrupts(void);
|
||||
|
||||
|
||||
//Prepare for USB persist. You should reboot after this.
|
||||
/*
|
||||
* @brief Prepare for USB persist
|
||||
*
|
||||
* This takes the USB peripheral offline in such a way that it seems 'just busy' to the
|
||||
* host. This way, the chip can reboot (e.g. into bootloader mode) and pick up the USB
|
||||
* configuration again, without the conenction to the host being interrupted.
|
||||
*
|
||||
* @note Actual persistence is depending on USBDC_PERSIST_ENA being set in flags, as this
|
||||
* is also used to e.g. reboot into DFU mode.
|
||||
*
|
||||
* @note Please reboot soon after calling this.
|
||||
*/
|
||||
int usb_dc_prepare_persist(void);
|
||||
|
||||
|
||||
/*
|
||||
* @brief USB interrupt handler
|
||||
*
|
||||
* This can be hooked up by the OS to the USB peripheral interrupt.
|
||||
*/
|
||||
void usb_dw_isr_handler(void);
|
||||
|
||||
/**
|
||||
* @brief Provide IDF with an interface to clear the static variable usb_dw_ctrl
|
||||
*
|
||||
*
|
||||
*/
|
||||
void usb_dw_ctrl_deinit(void);
|
||||
|
||||
int usb_dc_ep_write_would_block(const uint8_t ep);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -392,6 +392,12 @@ int usb_transfer_sync(uint8_t ep, uint8_t *data, size_t dlen, unsigned int flags
|
||||
*/
|
||||
void usb_cancel_transfer(uint8_t ep);
|
||||
|
||||
/**
|
||||
* @brief Provide IDF with an interface to clear the static variable usb_dev
|
||||
*
|
||||
*
|
||||
*/
|
||||
void usb_dev_deinit(void);
|
||||
|
||||
void usb_dev_resume(int configuration);
|
||||
int usb_dev_get_configuration(void);
|
||||
|
@ -217,26 +217,6 @@ struct string_descriptor {
|
||||
uint16_t bString[];
|
||||
} __packed;
|
||||
|
||||
#define ROM_MAX_CFG_DESC_CNT 1
|
||||
|
||||
struct rom_usb_descriptors {
|
||||
const struct usb_device_descriptor *device_descr;
|
||||
const void *config_descr[ROM_MAX_CFG_DESC_CNT];
|
||||
int string_count; // including string_descriptor_zero
|
||||
const struct string_descriptor_zero *string0_descr;
|
||||
const struct string_descriptor *string_descrs[];
|
||||
};
|
||||
|
||||
/* Descriptors defined in the ROM */
|
||||
extern struct usb_device_descriptor general_device_descr;
|
||||
extern const void* acm_config_descr;
|
||||
extern const void* dfu_config_descr;
|
||||
extern const struct string_descriptor str_manu_descr;
|
||||
extern const struct string_descriptor str_prod_descr;
|
||||
extern const struct string_descriptor_zero string0_descr;
|
||||
extern const struct rom_usb_descriptors acm_usb_descriptors;
|
||||
extern const struct rom_usb_descriptors dfu_usb_descriptors;
|
||||
extern const struct rom_usb_descriptors *rom_usb_curr_desc;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -372,19 +372,42 @@ int usb_dc_ep_read_continue(uint8_t ep);
|
||||
int usb_dc_ep_mps(uint8_t ep);
|
||||
|
||||
|
||||
|
||||
//Hack - fake interrupts by pollinfg
|
||||
/**
|
||||
* @brief Poll for interrupts that need to be handled
|
||||
*
|
||||
* When the USB interrupt is not hooked up to an actual CPU interrupt, you
|
||||
* can call this periodically to handle the USB events that need handling.
|
||||
*/
|
||||
void usb_dc_check_poll_for_interrupts(void);
|
||||
|
||||
|
||||
//Prepare for USB persist. You should reboot after this.
|
||||
/*
|
||||
* @brief Prepare for USB persist
|
||||
*
|
||||
* This takes the USB peripheral offline in such a way that it seems 'just busy' to the
|
||||
* host. This way, the chip can reboot (e.g. into bootloader mode) and pick up the USB
|
||||
* configuration again, without the conenction to the host being interrupted.
|
||||
*
|
||||
* @note Actual persistence is depending on USBDC_PERSIST_ENA being set in flags, as this
|
||||
* is also used to e.g. reboot into DFU mode.
|
||||
*
|
||||
* @note Please reboot soon after calling this.
|
||||
*/
|
||||
int usb_dc_prepare_persist(void);
|
||||
|
||||
|
||||
/*
|
||||
* @brief USB interrupt handler
|
||||
*
|
||||
* This can be hooked up by the OS to the USB peripheral interrupt.
|
||||
*/
|
||||
void usb_dw_isr_handler(void);
|
||||
|
||||
|
||||
int usb_dc_ep_write_would_block(const uint8_t ep);
|
||||
/**
|
||||
* @brief Provide IDF with an interface to clear the static variable usb_dw_ctrl
|
||||
*
|
||||
*
|
||||
*/
|
||||
void usb_dw_ctrl_deinit(void);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -392,6 +392,12 @@ int usb_transfer_sync(uint8_t ep, uint8_t *data, size_t dlen, unsigned int flags
|
||||
*/
|
||||
void usb_cancel_transfer(uint8_t ep);
|
||||
|
||||
/**
|
||||
* @brief Provide IDF with an interface to clear the static variable usb_dev
|
||||
*
|
||||
*
|
||||
*/
|
||||
void usb_dev_deinit(void);
|
||||
|
||||
void usb_dev_resume(int configuration);
|
||||
int usb_dev_get_configuration(void);
|
||||
|
@ -140,6 +140,7 @@ int dfu_custom_handle_req(struct usb_setup_packet *pSetup,
|
||||
|
||||
typedef void(*usb_dfu_detach_routine_t)(int delay);
|
||||
void usb_dfu_set_detach_cb(usb_dfu_detach_routine_t cb);
|
||||
void usb_dfu_force_detach(void);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -1,16 +1,8 @@
|
||||
// Copyright 2019-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.
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2019-2022 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
@ -33,7 +25,7 @@ typedef struct {
|
||||
usb_osglue_wait_routine_t wait_proc;
|
||||
} usb_osglue_data_t;
|
||||
|
||||
extern usb_osglue_data_t s_usb_osglue;
|
||||
extern usb_osglue_data_t rom_usb_osglue;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -1,16 +1,8 @@
|
||||
// Copyright 2019-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.
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2019-2022 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
@ -34,7 +26,7 @@ extern "C" {
|
||||
|
||||
//This being non-0 indicates a memory location where a 'testament' is stored, aka a piece of text that should be output
|
||||
//after a reboot. Can contain core dump info or something.
|
||||
#define USBDC_TESTAMENT_LOC_MASK 0x7FFFF //bits 19-0; this is added to a base address of 0x3FF80000.
|
||||
#define USBDC_TESTAMENT_LOC_MASK 0x7FFFF //bits 19-0; this is added to a base address of SOC_MEM_INTERNAL_LOW. (0x3FF9E000)
|
||||
|
||||
//The testament is a FIFO. The ROM will output all data between textstart and textend; if textend is lower than textstart it will
|
||||
//output everything from textstart to memend, then memstart to textend.
|
||||
|
@ -524,8 +524,6 @@ components/esp_rom/include/esp32s3/rom/usb/usb_dc.h
|
||||
components/esp_rom/include/esp32s3/rom/usb/usb_descriptor.h
|
||||
components/esp_rom/include/esp32s3/rom/usb/usb_device.h
|
||||
components/esp_rom/include/esp32s3/rom/usb/usb_dfu.h
|
||||
components/esp_rom/include/esp32s3/rom/usb/usb_os_glue.h
|
||||
components/esp_rom/include/esp32s3/rom/usb/usb_persist.h
|
||||
components/esp_rom/include/esp_rom_crc.h
|
||||
components/esp_rom/include/esp_rom_gpio.h
|
||||
components/esp_rom/include/linux/soc/reset_reasons.h
|
||||
|
Loading…
Reference in New Issue
Block a user