mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
rom: patch uart function to switch buffer
This commit is contained in:
parent
0d07f85916
commit
b7799ec84d
@ -17,20 +17,6 @@
|
||||
#if CONFIG_IDF_TARGET_ESP32S2
|
||||
#include "esp32s2/rom/usb/cdc_acm.h"
|
||||
#include "esp32s2/rom/usb/usb_common.h"
|
||||
#elif CONFIG_IDF_TARGET_ESP32C3
|
||||
#include "esp32c3/rom/ets_sys.h"
|
||||
#include "esp32c3/rom/uart.h"
|
||||
#elif CONFIG_IDF_TARGET_ESP32S3
|
||||
#include "esp32s3/rom/uart.h"
|
||||
#elif CONFIG_IDF_TARGET_ESP32H4
|
||||
#include "esp32h4/rom/ets_sys.h"
|
||||
#include "esp32h4/rom/uart.h"
|
||||
#elif CONFIG_IDF_TARGET_ESP32C2
|
||||
#include "esp32c2/rom/ets_sys.h"
|
||||
#include "esp32c2/rom/uart.h"
|
||||
#elif CONFIG_IDF_TARGET_ESP32C6
|
||||
#include "esp32c6/rom/ets_sys.h"
|
||||
#include "esp32c6/rom/uart.h"
|
||||
#endif
|
||||
#include "esp_rom_gpio.h"
|
||||
#include "esp_rom_uart.h"
|
||||
@ -117,7 +103,6 @@ void bootloader_console_init(void)
|
||||
#ifdef CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG
|
||||
void bootloader_console_init(void)
|
||||
{
|
||||
UartDevice *uart = GetUartDevice();
|
||||
uart->buff_uart_no = ESP_ROM_USB_SERIAL_DEVICE_NUM;
|
||||
esp_rom_uart_switch_buffer(ESP_ROM_USB_SERIAL_DEVICE_NUM);
|
||||
}
|
||||
#endif //CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG
|
||||
|
@ -19,6 +19,10 @@ config ESP_ROM_HAS_JPEG_DECODE
|
||||
bool
|
||||
default y
|
||||
|
||||
config ESP_ROM_HAS_UART_BUF_SWITCH
|
||||
bool
|
||||
default y
|
||||
|
||||
config ESP_ROM_NEEDS_SWSETUP_WORKAROUND
|
||||
bool
|
||||
default y
|
||||
|
@ -10,4 +10,5 @@
|
||||
#define ESP_ROM_HAS_CRC_BE (1) // ROM CRC library supports Big Endian
|
||||
#define ESP_ROM_HAS_MZ_CRC32 (1) // ROM has mz_crc32 function
|
||||
#define ESP_ROM_HAS_JPEG_DECODE (1) // ROM has JPEG decode library
|
||||
#define ESP_ROM_HAS_UART_BUF_SWITCH (1) // ROM has exported the uart buffer switch function
|
||||
#define ESP_ROM_NEEDS_SWSETUP_WORKAROUND (1) // ROM uses 32-bit time_t. A workaround is required to prevent printf functions from crashing
|
||||
|
@ -26,6 +26,7 @@ PROVIDE ( esp_rom_uart_rx_one_char = uart_rx_one_char );
|
||||
PROVIDE ( esp_rom_uart_rx_string = UartRxString );
|
||||
PROVIDE ( esp_rom_uart_set_as_console = uart_tx_switch );
|
||||
PROVIDE ( esp_rom_uart_putc = ets_write_char_uart );
|
||||
PROVIDE ( esp_rom_uart_switch_buffer = uart_buff_switch );
|
||||
|
||||
/* wpa_supplicant re-implements the MD5 functions: MD5Init, MD5Update, MD5Final */
|
||||
/* so here we directly assign the symbols with the ROM API address */
|
||||
|
@ -11,6 +11,10 @@ config ESP_ROM_HAS_MZ_CRC32
|
||||
bool
|
||||
default y
|
||||
|
||||
config ESP_ROM_HAS_UART_BUF_SWITCH
|
||||
bool
|
||||
default y
|
||||
|
||||
config ESP_ROM_NEEDS_SWSETUP_WORKAROUND
|
||||
bool
|
||||
default y
|
||||
|
@ -8,5 +8,6 @@
|
||||
|
||||
#define ESP_ROM_HAS_CRC_LE (1) // ROM CRC library supports Little Endian
|
||||
#define ESP_ROM_HAS_MZ_CRC32 (1) // ROM has mz_crc32 function
|
||||
#define ESP_ROM_HAS_UART_BUF_SWITCH (1) // ROM has exported the uart buffer switch function
|
||||
#define ESP_ROM_NEEDS_SWSETUP_WORKAROUND (1) // ROM uses 32-bit time_t. A workaround is required to prevent printf functions from crashing
|
||||
#define ESP_ROM_HAS_REGI2C_BUG (1) // ROM has the regi2c bug
|
||||
|
@ -27,6 +27,7 @@ PROVIDE ( esp_rom_uart_rx_string = UartRxString );
|
||||
PROVIDE ( esp_rom_uart_set_as_console = uart_tx_switch );
|
||||
PROVIDE ( esp_rom_uart_usb_acm_init = Uart_Init_USB );
|
||||
PROVIDE ( esp_rom_uart_putc = ets_write_char_uart );
|
||||
PROVIDE ( esp_rom_uart_switch_buffer = uart_buff_switch );
|
||||
|
||||
/* wpa_supplicant re-implements the MD5 functions: MD5Init, MD5Update, MD5Final */
|
||||
/* so here we directly assign the symbols with the ROM API address */
|
||||
|
@ -1,16 +1,8 @@
|
||||
// Copyright 2010-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: 2010-2023 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
@ -91,10 +83,23 @@ int esp_rom_uart_rx_string(uint8_t *str, uint8_t max_len);
|
||||
/**
|
||||
* @brief Set the UART port used by ets_printf.
|
||||
*
|
||||
* @note USB-CDC port is also treated as "UART" port in the ROM code.
|
||||
* Use ESP_ROM_USB_SERIAL_DEVICE_NUM or ESP_ROM_USB_OTG_NUM to identify USB_SERIAL_JTAG and USB_OTG, respectively.
|
||||
*
|
||||
* @param uart_no UART port number
|
||||
*/
|
||||
void esp_rom_uart_set_as_console(uint8_t uart_no);
|
||||
|
||||
/**
|
||||
* @brief Switch the UART port that will use a buffer for TX and RX.
|
||||
*
|
||||
* @note USB-CDC port is also treated as "UART" port in the ROM code.
|
||||
* Use ESP_ROM_USB_SERIAL_DEVICE_NUM or ESP_ROM_USB_OTG_NUM to identify USB_SERIAL_JTAG and USB_OTG, respectively.
|
||||
*
|
||||
* @param uart_no UART port number
|
||||
*/
|
||||
void esp_rom_uart_switch_buffer(uint8_t uart_no);
|
||||
|
||||
/**
|
||||
* @brief Initialize the USB ACM UART
|
||||
* @note The ACM working memroy should be at least 128 bytes (ESP_ROM_CDC_ACM_WORK_BUF_MIN) in size.
|
||||
|
@ -10,6 +10,8 @@
|
||||
#include "sdkconfig.h"
|
||||
#include "hal/uart_ll.h"
|
||||
#include "hal/efuse_hal.h"
|
||||
#include "esp_rom_caps.h"
|
||||
#include "rom/uart.h"
|
||||
|
||||
#if CONFIG_IDF_TARGET_ESP32
|
||||
/**
|
||||
@ -47,3 +49,11 @@ IRAM_ATTR void esp_rom_uart_set_as_console(uint8_t uart_no)
|
||||
uart_tx_switch(uart_no);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !ESP_ROM_HAS_UART_BUF_SWITCH
|
||||
IRAM_ATTR void esp_rom_uart_switch_buffer(uint8_t uart_no)
|
||||
{
|
||||
UartDevice *uart = GetUartDevice();
|
||||
uart->buff_uart_no = uart_no;
|
||||
}
|
||||
#endif // !ESP_ROM_HAS_UART_BUF_SWITCH
|
||||
|
@ -539,7 +539,6 @@ 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/esp_rom_uart.h
|
||||
components/esp_rom/include/linux/soc/reset_reasons.h
|
||||
components/esp_rom/linux/esp_rom_crc.c
|
||||
components/esp_rom/linux/esp_rom_md5.c
|
||||
|
Loading…
x
Reference in New Issue
Block a user