|
ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
|
ESP-IDF-compatible logging surface, implemented by this port. More...
#include <stdint.h>Go to the source code of this file.
Macros | |
| #define | LOG_LOCAL_LEVEL ESP_LOG_INFO |
| Most verbose level this translation unit is allowed to emit. | |
| #define | ESP_LOG_LEVEL_LOCAL(level, tag, ...) |
| Emit a line only if this translation unit allows that severity. | |
| #define | ESP_LOGE(tag, ...) |
| Log a fault the caller cannot recover from itself. | |
| #define | ESP_LOGW(tag, ...) |
| Log something unexpected that was handled anyway. | |
| #define | ESP_LOGI(tag, ...) |
| Log a normal life-cycle milestone. | |
| #define | ESP_LOGD(tag, ...) |
| Log detail useful while bringing the link up. | |
| #define | ESP_LOGV(tag, ...) |
| Log per-frame or per-edge tracing. | |
| #define | ESP_EARLY_LOGE(tag, ...) |
| Error-level log usable before the scheduler and inside interrupts. | |
| #define | ESP_EARLY_LOGW(tag, ...) |
| Warning-level log usable from early or interrupt context. | |
| #define | ESP_EARLY_LOGI(tag, ...) |
| Info-level log usable from early or interrupt context. | |
| #define | ESP_EARLY_LOGD(tag, ...) |
| Debug-level log usable from early or interrupt context. | |
| #define | ESP_EARLY_LOGV(tag, ...) |
| Verbose-level log usable from early or interrupt context. | |
| #define | ESP_LOG_BUFFER_HEXDUMP(tag, buf, len, level) |
| Dump a buffer as hex at a given severity. | |
| #define | esp_log_level_set(tag, level) |
| Adjust one module's console threshold at run time. | |
| #define | ESP_ERROR_CHECK(x) |
| Evaluate an expression and stop the firmware if it is non-zero. | |
| #define | ESP_ERROR_CHECK_WITHOUT_ABORT(x) |
| Evaluate an expression, report a non-zero result, and carry on. | |
Enumerations | |
| enum | esp_log_level_t : uint8_t { ESP_LOG_NONE = 0 , ESP_LOG_ERROR = 1 , ESP_LOG_WARN = 2 , ESP_LOG_INFO = 3 , ESP_LOG_DEBUG = 4 , ESP_LOG_VERBOSE = 5 } |
| Severity of one log line, ordered from silent to most verbose. More... | |
Functions | |
| void | ra8_esp_hosted_log_write (int level, const char *tag, const char *fmt,...) |
| Emit one formatted esp-hosted log line. | |
| void | ra8_esp_hosted_log_hexdump (int level, const char *tag, const void *buf, uint32_t len) |
| Emit a hex dump of a buffer at a given severity. | |
| void | ra8_esp_hosted_log_level_set (const char *tag, int level) |
| Raise the console threshold for one module at run time. | |
| void | ra8_esp_hosted_log_fatal (const char *tag, const char *expr, int code) |
| Report a failed ESP_ERROR_CHECK and stop. | |
ESP-IDF-compatible logging surface, implemented by this port.
The vendored esp-hosted core is written against ESP-IDF and includes esp_log.h by name from eleven translation units. This project does not vendor ESP-IDF, so the name is satisfied here by a first-party header that offers exactly the surface the core uses – and nothing more, because an unused compatibility macro is a promise no one has checked.
Definition in file esp_log.h.
| #define ESP_EARLY_LOGD | ( | tag, | |
| ... ) |
Debug-level log usable from early or interrupt context.
The same path as ESP_LOGD; see ESP_EARLY_LOGE.
| [in] | tag | Module name string. |
| [in] | ... | Format string followed by its arguments. |
| #define ESP_EARLY_LOGE | ( | tag, | |
| ... ) |
Error-level log usable before the scheduler and inside interrupts.
The same path as ESP_LOGE. ESP-IDF needs a separate early logger because its normal one takes a lock; this port's writer is interrupt-safe by contract, so one implementation serves both.
| [in] | tag | Module name string. |
| [in] | ... | Format string followed by its arguments. |
| #define ESP_EARLY_LOGI | ( | tag, | |
| ... ) |
Info-level log usable from early or interrupt context.
The same path as ESP_LOGI; see ESP_EARLY_LOGE.
| [in] | tag | Module name string. |
| [in] | ... | Format string followed by its arguments. |
| #define ESP_EARLY_LOGV | ( | tag, | |
| ... ) |
Verbose-level log usable from early or interrupt context.
The same path as ESP_LOGV; see ESP_EARLY_LOGE. This is the spelling the vendored SPI driver uses inside both side-band edge handlers, which is what makes the interrupt-safety contract binding.
| [in] | tag | Module name string. |
| [in] | ... | Format string followed by its arguments. |
| #define ESP_EARLY_LOGW | ( | tag, | |
| ... ) |
Warning-level log usable from early or interrupt context.
The same path as ESP_LOGW; see ESP_EARLY_LOGE.
| [in] | tag | Module name string. |
| [in] | ... | Format string followed by its arguments. |
| #define ESP_ERROR_CHECK | ( | x | ) |
Evaluate an expression and stop the firmware if it is non-zero.
ESP-IDF's abort-on-error assertion, kept with its abort semantics: the vendored transport_drv.c uses it as a bounds check on an interface index, so downgrading it to a log would let an out-of-range index through. The expression is evaluated exactly once.
| [in] | x | Expression yielding zero on success and a non-zero error code, or a boolean that is true when something is wrong. |
x. | #define ESP_ERROR_CHECK_WITHOUT_ABORT | ( | x | ) |
Evaluate an expression, report a non-zero result, and carry on.
The recoverable half of ESP_ERROR_CHECK, and the reason both exist: esp_hosted_api.c reconfigures the transport with this one because a failed reconfiguration leaves the previous configuration standing rather than corrupting anything. The expression is evaluated exactly once.
ESP-IDF's version also yields the error code. This one is a statement instead, because yielding a value from a macro needs a GNU statement expression and both vendored call sites discard the result – buying a non-standard construct for a value nothing reads would be the wrong trade. A caller that needs the code should call the function and test it.
| [in] | x | Expression yielding zero on success and a non-zero error code. |
| #define ESP_LOG_BUFFER_HEXDUMP | ( | tag, | |
| buf, | |||
| len, | |||
| level ) |
Dump a buffer as hex at a given severity.
Guarded by the same compile-time threshold as the line macros, so a dump that would be suppressed costs neither the call nor the formatting. The vendored ESP_HEXLOGx helpers expand to this.
| [in] | tag | Module name string. |
| [in] | buf | Start of the region to dump. |
| [in] | len | Bytes to dump. |
| [in] | level | Severity, an esp_log_level_t value. |
| #define ESP_LOG_LEVEL_LOCAL | ( | level, | |
| tag, | |||
| ... ) |
Emit a line only if this translation unit allows that severity.
The one macro every other spelling in this header funnels through. The threshold test compares two compile-time constants, so a suppressed call costs nothing at run time while its arguments stay under -Wformat scrutiny.
| [in] | level | Severity, an esp_log_level_t value. |
| [in] | tag | Module name string. |
| [in] | ... | Format string followed by its arguments. |
| #define esp_log_level_set | ( | tag, | |
| level ) |
Adjust one module's console threshold at run time.
Routed to ra8_esp_hosted_log_level_set so every ESP-IDF spelling in this header resolves to the port's own logger rather than to a second implementation.
| [in] | tag | Module name string to adjust. |
| [in] | level | New threshold, an esp_log_level_t value. |
| #define ESP_LOGD | ( | tag, | |
| ... ) |
Log detail useful while bringing the link up.
Severity ESP_LOG_DEBUG; folded out at the default threshold.
| [in] | tag | Module name string. |
| [in] | ... | Format string followed by its arguments. |
| #define ESP_LOGE | ( | tag, | |
| ... ) |
Log a fault the caller cannot recover from itself.
Severity ESP_LOG_ERROR. The most-used spelling in the vendored core by a wide margin, and the one level this build never folds out.
| [in] | tag | Module name string, normally the file-scope TAG. |
| [in] | ... | Format string followed by its arguments. |
Definition at line 313 of file esp_log.h.
Referenced by internal_absent(), internal_configure_sideband(), internal_init_hook(), internal_restart_host(), and ra8_esp_hosted_port_init().
| #define ESP_LOGI | ( | tag, | |
| ... ) |
Log a normal life-cycle milestone.
Severity ESP_LOG_INFO, the default LOG_LOCAL_LEVEL, so these are the most verbose lines a stock build emits.
| [in] | tag | Module name string. |
| [in] | ... | Format string followed by its arguments. |
Definition at line 346 of file esp_log.h.
Referenced by ra8_esp_hosted_port_init().
| #define ESP_LOGV | ( | tag, | |
| ... ) |
Log per-frame or per-edge tracing.
Severity ESP_LOG_VERBOSE; folded out at the default threshold.
| [in] | tag | Module name string. |
| [in] | ... | Format string followed by its arguments. |
| #define ESP_LOGW | ( | tag, | |
| ... ) |
Log something unexpected that was handled anyway.
Severity ESP_LOG_WARN.
| [in] | tag | Module name string. |
| [in] | ... | Format string followed by its arguments. |
Definition at line 329 of file esp_log.h.
Referenced by internal_config_host_power_save(), and internal_start_host_power_save().
| #define LOG_LOCAL_LEVEL ESP_LOG_INFO |
Most verbose level this translation unit is allowed to emit.
ESP_LOG_INFO by default: life-cycle milestones and everything more severe reach the console, while the per-frame and per-edge tracing that would swamp a 115200-baud console – and change the timing of the link it is describing – is folded out. A translation unit that is being debugged may define this to a more verbose level before including this header, which is the ESP-IDF contract and the reason for the guard.
| enum esp_log_level_t : uint8_t |
Severity of one log line, ordered from silent to most verbose.
Numerically ordered so that "emit this line" is the single comparison level <= LOG_LOCAL_LEVEL. The values match ESP-IDF's, which matters because esp_hosted_log.h passes them around as plain integers and because a co-processor log capture read next to a host capture should use one scale.
| void ra8_esp_hosted_log_fatal | ( | const char * | tag, |
| const char * | expr, | ||
| int | code ) |
Report a failed ESP_ERROR_CHECK and stop.
The abort half of ESP_ERROR_CHECK. ESP-IDF's macro aborts on a non-zero result and the vendored core depends on that: transport_drv.c writes ESP_ERROR_CHECK(if_type >= ESP_MAX_IF) as a bounds assertion, so a version that merely logged would let an out-of-range interface index through. The implementation logs at ESP_LOG_ERROR and hands over to the firmware's fault path.
| [in] | tag | Module name of the failing call site. Never null. |
| [in] | expr | Stringised expression that failed. Never null. |
| [in] | code | The non-zero result the expression produced. |
tag and expr are non-null, null-terminated strings. code is non-zero; a zero result is not a failure and must not reach here. Report a failed ESP_ERROR_CHECK and stop.
Definition at line 240 of file ra8_esp_hosted_log.c.
References ESP_LOG_ERROR, ra8_esp_hosted_log_write(), and s_ra8_esp_hosted_log_tag.
| void ra8_esp_hosted_log_hexdump | ( | int | level, |
| const char * | tag, | ||
| const void * | buf, | ||
| uint32_t | len ) |
Emit a hex dump of a buffer at a given severity.
Backs ESP_LOG_BUFFER_HEXDUMP, which the vendored esp_hosted_log.h builds its ESP_HEXLOGx helpers on. The implementation decides the row width and whether an ASCII gutter is printed; the core only supplies the bytes.
| [in] | level | Severity as an int, carrying an esp_log_level_t value. |
| [in] | tag | Module name. Never null. |
| [in] | buf | Start of the region to dump. May be null only when len is zero. |
| [in] | len | Bytes to dump, starting at buf. |
tag is a non-null, null-terminated string. buf points to at least len readable bytes. len; the implementation truncates rather than growing an unbounded line.Emit a hex dump of a buffer at a given severity.
Definition at line 175 of file ra8_esp_hosted_log.c.
References internal_emit(), k_ra8_esp_hosted_fmt_digits_max, k_ra8_esp_hosted_log_dump_bytes, k_ra8_esp_hosted_log_dump_cost, k_ra8_esp_hosted_log_dump_nibbles, k_ra8_esp_hosted_log_dump_radix, k_ra8_esp_hosted_log_line_max, priv_ra8_esp_hosted_fmt_utoa(), priv_ra8_esp_hosted_log_accepts(), and s_ra8_esp_hosted_log_tag.
| void ra8_esp_hosted_log_level_set | ( | const char * | tag, |
| int | level ) |
Raise the console threshold for one module at run time.
Backs esp_log_level_set, which esp_hosted_api.c calls during initialisation to quieten the three RPC modules. The implementation keeps a small fixed table of overrides; a tag it has no room for keeps the compile-time LOG_LOCAL_LEVEL rather than displacing another entry.
| [in] | tag | Module name to adjust. Never null. Note that the vendored caller passes unprefixed names, which do not match the H_-prefixed tags DEFINE_LOG_TAG produces. |
| [in] | level | New threshold as an int carrying an esp_log_level_t value; ESP_LOG_NONE silences the module completely. |
tag is a non-null, null-terminated string. level is within ESP_LOG_NONE .. ESP_LOG_VERBOSE. level. Raise the console threshold for one module at run time.
Definition at line 217 of file ra8_esp_hosted_log.c.
References ESP_LOG_NONE, ESP_LOG_VERBOSE, and s_ra8_esp_hosted_log_level.
| void ra8_esp_hosted_log_write | ( | int | level, |
| const char * | tag, | ||
| const char * | fmt, | ||
| ... ) |
Emit one formatted esp-hosted log line.
The single entry point behind every ESP_LOGx spelling in this header. The implementation in port/esp-hosted/src/ prefixes the severity and the tag, formats the body and hands the result to the firmware's console sink.
| [in] | level | Severity as an int, carrying an esp_log_level_t value in the range ESP_LOG_ERROR .. ESP_LOG_VERBOSE. Taken as int because the vendored hex-dump helper passes the level through an untyped macro parameter. |
| [in] | tag | Module name, already carrying the H_ prefix that DEFINE_LOG_TAG adds. Never null; the macros always supply the file-scope TAG. |
| [in] | fmt | printf-style format string. Never null. |
| [in] | ... | Arguments matching fmt. |
tag and fmt are non-null, null-terminated strings. Emit one formatted esp-hosted log line.
Definition at line 165 of file ra8_esp_hosted_log.c.
References priv_ra8_esp_hosted_log_vwrite().
Referenced by ra8_esp_hosted_alloc_failed(), ra8_esp_hosted_log_fatal(), and ra8_esp_hosted_mem_dump().