1 // Copyright 2010-2020 Espressif Systems (Shanghai) PTE LTD 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 #include <stdint.h> 16 #include <stdbool.h> 17 #include "esp_attr.h" 18 19 #include "sdkconfig.h" 20 esp_rom_install_channel_putc(int channel,void (* putc)(char c))21IRAM_ATTR void esp_rom_install_channel_putc(int channel, void (*putc)(char c)) 22 { 23 extern void ets_install_putc1(void (*p)(char c)); 24 extern void ets_install_putc2(void (*p)(char c)); 25 switch (channel) { 26 case 1: 27 ets_install_putc1(putc); 28 break; 29 case 2: 30 ets_install_putc2(putc); 31 break; 32 default: 33 break; 34 } 35 } 36 37 #if CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32H2 esp_rom_install_uart_printf(void)38IRAM_ATTR void esp_rom_install_uart_printf(void) 39 { 40 extern void ets_install_uart_printf(void); 41 extern bool g_uart_print; 42 // If ROM log is disabled permanently via eFuse or temporarily via RTC storage register, 43 // this ROM symbol will be set to false, and cause ``esp_rom_printf`` can't work on esp-idf side. 44 g_uart_print = true; 45 ets_install_uart_printf(); 46 } 47 #endif 48