2020-07-13 09:33:23 -04:00
|
|
|
// 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.
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include "esp_attr.h"
|
|
|
|
#include "sdkconfig.h"
|
|
|
|
#include "hal/uart_ll.h"
|
|
|
|
|
|
|
|
#if CONFIG_IDF_TARGET_ESP32
|
|
|
|
/**
|
|
|
|
* The function defined in ROM code has a bug, so we re-implement it here.
|
|
|
|
*/
|
|
|
|
IRAM_ATTR void esp_rom_uart_tx_wait_idle(uint8_t uart_no)
|
|
|
|
{
|
2022-10-17 23:38:51 -04:00
|
|
|
while (!uart_ll_is_tx_idle(UART_LL_GET_HW(uart_no))) {};
|
2020-07-13 09:33:23 -04:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
IRAM_ATTR void esp_rom_uart_set_clock_baudrate(uint8_t uart_no, uint32_t clock_hz, uint32_t baud_rate)
|
|
|
|
{
|
2022-10-17 23:38:51 -04:00
|
|
|
(void)clock_hz;
|
|
|
|
uart_ll_set_baudrate(UART_LL_GET_HW(uart_no), baud_rate);
|
2020-07-13 09:33:23 -04:00
|
|
|
}
|