feat(esp_rom): Adds esp_rom_vprintf with the same capabilities as esp_rom_print

This commit is contained in:
Konstantin Kondrashov
2024-05-22 17:42:03 +03:00
parent 60532e7a80
commit a3be04a087
36 changed files with 516 additions and 289 deletions

View File

@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2010-2023 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2010-2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -9,6 +9,7 @@
#include <stdint.h>
#include <stdbool.h>
#include <stdarg.h>
#include "soc/soc.h"
@@ -63,7 +64,7 @@ struct ETSEventTag {
ETSParam par; /**< Event parameter, sometimes without usage, then will be set as 0*/
};
typedef void (*ETSTask)(ETSEvent *e); /**< Type of the Task processer*/
typedef void (*ETSTask)(ETSEvent *e); /**< Type of the Task processor*/
typedef void (* ets_idle_cb_t)(void *arg); /**< Type of the system idle callback*/
@@ -82,7 +83,7 @@ typedef void (* ets_idle_cb_t)(void *arg); /**< Type of the system idle callbac
* @{
*/
extern const char *const exc_cause_table[40]; ///**< excption cause that defined by the core.*/
extern const char *const exc_cause_table[40]; ///**< exception cause that defined by the core.*/
/**
* @brief Set Pro cpu Entry code, code can be called in PRO CPU when booting is not completed.
@@ -119,6 +120,20 @@ void ets_set_user_start(uint32_t start);
*/
int ets_printf(const char *fmt, ...);
/**
* @brief A ROM implementation of the `vprintf` function.
*
* This function formats and prints data to a specified output function based on the provided format string and arguments.
*
* @param putc A pointer to a function that outputs a single character.
* This function will be called for each character in the formatted output.
* @param fmt A format string that specifies how to format the arguments.
* @param ap A variable argument list containing the values to be formatted.
*
* @return The number of characters printed.
*/
int ets_vprintf(void (*putc)(char c), const char *fmt, va_list ap);
/**
* @brief Set the uart channel of ets_printf(uart_tx_one_char).
* ROM will set it base on the efuse and gpio setting, however, this can be changed after booting.
@@ -147,7 +162,7 @@ uint8_t ets_get_printf_channel(void);
void ets_write_char_uart(char c);
/**
* @brief Ets_printf have two output functions putc1 and putc2, both of which will be called if need ouput.
* @brief Ets_printf has two output functions putc1 and putc2, both of which will be called if needed.
* To install putc1, which is defaulted installed as ets_write_char_uart in none silent boot mode, as NULL in silent mode.
*
* @param void (*)(char) p: Output function to install.
@@ -157,7 +172,7 @@ void ets_write_char_uart(char c);
void ets_install_putc1(void (*p)(char c));
/**
* @brief Ets_printf have two output functions putc1 and putc2, both of which will be called if need ouput.
* @brief Ets_printf has two output functions putc1 and putc2, both of which will be called if needed.
* To install putc2, which is defaulted installed as NULL.
*
* @param void (*)(char) p: Output function to install.
@@ -200,7 +215,7 @@ typedef void ETSTimerFunc(void *timer_arg);/**< timer handler*/
typedef struct _ETSTIMER_ {
struct _ETSTIMER_ *timer_next; /**< timer linker*/
uint32_t timer_expire; /**< abstruct time when timer expire*/
uint32_t timer_expire; /**< abstract time when timer expire*/
uint32_t timer_period; /**< timer period, 0 means timer is not periodic repeated*/
ETSTimerFunc *timer_func; /**< timer handler*/
void *timer_arg; /**< timer handler argument*/