mirror of
https://github.com/espressif/esp-idf.git
synced 2025-07-30 18:57:19 +02:00
esp_rom: add rom api esp_rom_uart_set_as_console for riscv chips
This commit is contained in:
@ -19,7 +19,7 @@ else()
|
|||||||
"patches/esp_rom_uart.c"
|
"patches/esp_rom_uart.c"
|
||||||
"patches/esp_rom_tjpgd.c"
|
"patches/esp_rom_tjpgd.c"
|
||||||
"patches/esp_rom_efuse.c")
|
"patches/esp_rom_efuse.c")
|
||||||
list(APPEND private_required_comp soc hal)
|
list(APPEND private_required_comp soc hal efuse)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(CONFIG_IDF_TARGET_ARCH_XTENSA)
|
if(CONFIG_IDF_TARGET_ARCH_XTENSA)
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include "esp_attr.h"
|
#include "esp_attr.h"
|
||||||
|
#include "esp_efuse.h"
|
||||||
#include "sdkconfig.h"
|
#include "sdkconfig.h"
|
||||||
#include "hal/uart_ll.h"
|
#include "hal/uart_ll.h"
|
||||||
|
|
||||||
@ -33,3 +34,25 @@ IRAM_ATTR void esp_rom_uart_set_clock_baudrate(uint8_t uart_no, uint32_t clock_h
|
|||||||
(void)clock_hz;
|
(void)clock_hz;
|
||||||
uart_ll_set_baudrate(UART_LL_GET_HW(uart_no), baud_rate);
|
uart_ll_set_baudrate(UART_LL_GET_HW(uart_no), baud_rate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if CONFIG_IDF_TARGET_ESP32C3
|
||||||
|
/**
|
||||||
|
* The ESP32-C3 ROM has released two versions, one is the ECO3 version,
|
||||||
|
* and the other is the version before ECO3 (include ECO0 ECO1 ECO2).
|
||||||
|
* These two versions of the ROM code do not list uart_tx_switch wrap
|
||||||
|
* function in the ROM interface, so here use the uart_tx_switch direct
|
||||||
|
* address instead.
|
||||||
|
*/
|
||||||
|
IRAM_ATTR void esp_rom_uart_set_as_console(uint8_t uart_no)
|
||||||
|
{
|
||||||
|
typedef void (*rom_func_t)(uint8_t);
|
||||||
|
rom_func_t uart_tx_switch = NULL;
|
||||||
|
|
||||||
|
if (esp_efuse_get_chip_ver() < 3) {
|
||||||
|
uart_tx_switch = (rom_func_t)0x4004b8ca;
|
||||||
|
} else {
|
||||||
|
uart_tx_switch = (rom_func_t)0x4004c166;
|
||||||
|
}
|
||||||
|
uart_tx_switch(uart_no);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
Reference in New Issue
Block a user