Merge branch 'bugfix/2nd_bootloader_uart1_baudrate_issues_v5.0' into 'release/v5.0'

esp_rom: fix 2nd bootloader custom uart1 baudrate issue (backport to v5.0)

See merge request espressif/esp-idf!20653
This commit is contained in:
morris
2022-11-01 10:11:28 +08:00
2 changed files with 7 additions and 30 deletions

View File

@@ -1,23 +1,14 @@
// Copyright 2010-2020 Espressif Systems (Shanghai) PTE LTD /*
// * SPDX-FileCopyrightText: 2010-2022 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 <stdint.h> #include <stdint.h>
#include <stdlib.h> #include <stdlib.h>
#include "esp_attr.h" #include "esp_attr.h"
#include "sdkconfig.h" #include "sdkconfig.h"
#include "hal/uart_ll.h" #include "hal/uart_ll.h"
#include "soc/uart_struct.h"
#if CONFIG_IDF_TARGET_ESP32 #if CONFIG_IDF_TARGET_ESP32
/** /**
@@ -25,24 +16,11 @@
*/ */
IRAM_ATTR void esp_rom_uart_tx_wait_idle(uint8_t uart_no) IRAM_ATTR void esp_rom_uart_tx_wait_idle(uint8_t uart_no)
{ {
uart_dev_t *device = NULL; while (!uart_ll_is_tx_idle(UART_LL_GET_HW(uart_no))) {};
switch (uart_no) {
case 0:
device = &UART0;
break;
case 1:
device = &UART1;
break;
default:
device = &UART2;
break;
}
while (!uart_ll_is_tx_idle(device));
} }
#endif #endif
IRAM_ATTR void esp_rom_uart_set_clock_baudrate(uint8_t uart_no, uint32_t clock_hz, uint32_t baud_rate) IRAM_ATTR void esp_rom_uart_set_clock_baudrate(uint8_t uart_no, uint32_t clock_hz, uint32_t baud_rate)
{ {
extern void uart_div_modify(uint8_t uart_no, uint32_t DivLatchValue); uart_ll_set_baudrate(UART_LL_GET_HW(uart_no), baud_rate, clock_hz);
uart_div_modify(uart_no, (clock_hz << 4) / baud_rate);
} }

View File

@@ -619,7 +619,6 @@ components/esp_rom/linux/esp_rom_md5.c
components/esp_rom/linux/esp_rom_sys.c components/esp_rom/linux/esp_rom_sys.c
components/esp_rom/patches/esp_rom_crc.c components/esp_rom/patches/esp_rom_crc.c
components/esp_rom/patches/esp_rom_tjpgd.c components/esp_rom/patches/esp_rom_tjpgd.c
components/esp_rom/patches/esp_rom_uart.c
components/esp_rom/test/test_libgcc.c components/esp_rom/test/test_libgcc.c
components/esp_rom/test/test_miniz.c components/esp_rom/test/test_miniz.c
components/esp_rom/test/test_tjpgd.c components/esp_rom/test/test_tjpgd.c